I would have tried to edit the code you suggested above but as Chris said it wouldn't work and he's hadly ever wrong. So here's some code that does work, sorry for it being poorly coded it is kinda late, but you wont get a @Window or such telling you what's been rejected as spam, instead you will get a simple echo to yourself. Here it is..

Code:
menu channel {
  $iif($dialog(spam),$style(3)) Spam: {
    dialog -dm spam spam 
  }
}  

dialog spam { 
  title "Spam"  
  size -1 -1 84 132  
  option dbu  
  box "Spam list",1,2 0 80 115  
  list 2,3 7 78 110, autohs, sort 
  box "",4,2 113 80 18  
  button "Add", 5, 5 119 16 9  
  button "Del", 6, 24 119 16 9  
  button "Close", 7, 59 119 20 9, ok
}

on *:dialog:spam:init:*: {   
  did -b spam 6   
  if ($exists(spamlist.txt)) { play -cs spamlist.txt 0 }
}
on *:dialog:spam:sclick:2: {  
  set %spam.sel $did(2,$did(2).sel)  
  did -e spam 6
}

on *:dialog:spam:sclick:5: {   
  set %spam.add $$?="Enter Word:"   
  write spamlist.txt did -a spam 2 %spam.add   
  write spam.txt %spam.add 
  did -a spam 2 %spam.add 
}

on *:dialog:spam:sclick:6: {  
  write -dw $+ "* $+ %spam.sel $+ *" spamlist.txt   
  write -dw $+ "* $+ %spam.sel $+ *" spam.txt   
  did -d spam 2 $did(spam,2).sel  
  did -b spam 6 
}

on 1:Open:?:*: { 
  if ($read(spam.txt,w, $strip($1-))) {     
    close -m $nick   
    .ignore -pnu60 $nick 3    
    .notice $nick Message $ifmatch Spam is ignored ! Ignoring for 1 minute.    
    .echo -a $nick spammed you with $ifmatch now ignoring for 1 minute.    
    halt
  }
}