Update:

I added another missing value to this code, 350:

Code
#islogged off
raw *:*:{
  if ($numeric isnum 307-320) || ($numeric isnum 615-617) { haltdef }
  if ($istok(301 330 335 338 344 [color:#FF0000]350[/color] 378 379 671,$numeric,32)) { haltdef }
  if (*is logged* iswm $2-) { set %islogged $3 | haltdef }
  if ($numeric == 318) {
    $iif(%islogged,ban_reg_user $2 $v1,ban_noreg_user $2)
    unset %islogged | .disable #islogged
  }
}
#islogged end

Since it caused this writing to appear continuously:

"Nick" * * is connected via the webircgateway WebIRC gateway