• if ($read(spam.txt,w, $strip($1-))) {

That probably won't work as intended unless the text file contains the entire message on one line, which would be a cumbersome way to add items to block grin

I used your dialog (added an edit button) and changed it all slightly so it loads the file into a hash table.
This does not have any notification of blocks at all, it just does it quietly grin
Code:
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,disable
  button "Edit", 7, 43 119 16 9,disable
  button "Close", 8, 62 119 19 9, ok
}
on *:dialog:spam:init:*:{
  if $isfile(spam.txt) { spamfilefix | loadbuf -o spam 2 spam.txt }
}
on *:dialog:spam:sclick:2: {
  if $did(2).sel { did -e spam 6,7 }
}
on *:dialog:spam:sclick:5:{
  var %a = $$input(Enter Word:,eu,Spam)
  if $left(%a,1) $right(%a,1) != * * { %a = $+(*,%a,*) }
  did -a spam 2 %a
  write spam.txt %a
  _spaminit
}
on *:dialog:spam:sclick:6:{
  write -dw $+ $did(2,$did(2).sel) spam.txt
  did -d spam 2 $did(spam,2).sel
  did -b spam 6,7
  savebuf -o spam 2 spam.txt
  _spaminit
}
on *:dialog:spam:sclick:7:{
  var %a = $$input(Enter word or string to block:,eu,Spam,$did(2,$did(2).sel))
  did -d spam 2 $did(spam,2).sel
  if $left(%a,1) $right(%a,1) != * * { %a = $+(*,%a,*) }
  did -a spam 2 %a
  did -b spam 6,7
  savebuf -o spam 2 spam.txt
  _spaminit
}
on *^:open:?:{
  if !$hget(spam) { _spaminit }
  if $hfind(spam,$strip($1-),1,W).data { .ignore -pnu60 $wildsite | halt }
}
on *^:text:*:?:
  if !$hget(spam) { _spaminit }
  if $hfind(spam,$strip($1-),1,W).data { .ignore -pnu60 $wildsite | close -m $nick | haltdef }
}
alias -l _spaminit {
  if $hget(spam) { hdel -w spam * }
  else hmake spam 5
  if $isfile(spam.txt) { hload -n spam spam.txt }
}
alias -l _spamfix  {
  tokenize 32 $1
  if $left($2,1) $right($2-,1) != * * {
    write -l $+ $1 spam.txt $+(*,$2-,*)
    ; If it has one * but not the other an extra one won't hurt anything
  }
}
menu channel,nicklist,query,status {
  $iif($dialog(spam),$style(3)) Spam:dialog -mo spam spam
}
alias spamfilefix {
  filter -fnk spam.txt _spamfix
}

When the dialog is opened it will alter 'spam.txt' to the format required here. The other file is not needed. :[/b])