First off, you should'nt use the same flag for the server record as for the ones trusted with the spyadd/spydel commands. We want a specific flag that identifies the servers uniquely, so that none may fake a logged message.
Next, the test for whether the IRC handle exists or not, and the subsequent adding of the record (if missing) was not intended to be added to any proc, but just a failsafe to make sure the user record gets created as the script loads. You could use it within the spyadd proc, but you'll need to keep your braces balanced (properly indenting the code helps getting this right).
Further, you you've added "pubm" and a space (typo?) in the name of the RecvSpyMessage proc. Having spaces in proc names is a very, very bad idea. Further, the command you added to the binding does not match this command name. You've also forgot to include the "mask" argument in the bind declaration.
Now to the logged error. I made a slight typo in the code that adds the new user record, HOST should really be HOSTS on the line starting with "setuser".
Corrected version of the code I posted earlier, also renamed the pubmRecvSpyMessage proc to RecvSpyMessage, as the previous name was misleading (bind declaration updated accordingly):
Code: Select all
if {![validuser "ircspy"]} {
adduser ircspy "IRC!IRC@irc.chattersworld.co.uk"
chattr ircspy +X
setuser ircspy HOSTS "IRC!IRC@leaf.chattersworld.co.uk"
}
proc RecvSpyMessage {nick host handle text} {
if {[regexp -- {^\[([[:alnum:]]) ([->]) ([[:alnum:]])\] (.*)$} $text match sender type recipient message]} {
putlog "Spy Message recieved, sender: $sender recipient: $recipient message: $message"
}
}
bind msgm X {[*]} RecvSpyMessage
Now, be careful when you add this code. You
cannot insert it inside any of your already existing procs, but it must be "outside" them.