Judging from what your post title is, I assume you mean you don't want to receive any msgs within, say, 10 seconds from entering a channel. If it is not, be more specific.

Code:
[color:green]; when you join any channel[/color]
on *:JOIN:#: {
  [color:green]; add the channel to a list - people are not  allowed to msg you from those[/color]
  %chans = %chans $chan
  [color:green]; remove the channel after 10 secs[/color]
  .timer 1 10 %chans = $remtok(%chans,$chan,1,32)
}
[color:green] [/color]
[color:green]; when you receive a PM[/color]
on *:OPEN:?:*: {
  [color:green]; create a setting to detect what we want[/color]
  set %tmp 1
  [color:green]; check if the user is in a forbidden channel[/color]
  var %i = $numtok(%chan,32)
  while (%i) { if ($nick ison $gettok(%chan,%i,32)) unset %tmp | dec %i }
  [color:green]; if not found, ignore, else allow[/color]
  if (%tmp) { unset %tmp }
  else { .timer 1 0 close -m $nick }
}


DALnet #Helpdesk
I hear and I forget. I see and I remember. I do and I understand. -Confucius