This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

PART bind failing to return part msg

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

PART bind failing to return part msg

Post by arfer »

I have been coding a script to deal with recent spam on DALnet, including banning users that part a channel where the part message matches one of a preconfigured number of text patterns. The problem is that it sometimes worked and sometimes didn't.

In order to try to identify the problem I used another bot to create a catch-all part bind and echo the arguments passed to the bind proc to an IRC channel. It confirmed that the exact same part message is sometimes returned and sometimes not, as follows :-

----- 1st event -----

IRC client join/part
[23:47] * jinglun has joined #Atlantis
[23:47] * jinglun has left #Atlantis (WWW.TheBestScript.TK .)

part bind proc arguments
[23:47] <@Baal> *-PART-* nick (jinglun), user@host (chrissy@94.159.3.2), handle (*), channel (#Atlantis), message ()

----- 2nd event -----

IRC client join/part
[00:00] * rowatt has joined #Atlantis
[00:00] * rowatt has left #Atlantis (WWW.TheBestScript.TK .)

part bind proc arguments
[00:00] <@Baal> *-PART-* nick (rowatt), user@host (milicent@123.237.8.238), handle (*), channel (#Atlantis), message (WWW.TheBestScript.TK .)

------------------------

So, on both occasions the part message is identical yet it is only sent to the part bind proc on one of the two occasions. Anybody know why?

Is it anything to do with being on the same IRC server as the spammer?
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

If you haven't read the tcl-commands.doc/html then, this should help

Code: Select all

PART (stackable)

bind part <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <msg>

Description: triggered by someone leaving the channel. The mask is matched against "#channel nick!user@host" and can contain wildcards. If no part message is specified, msg will be set to "".

New Tcl procs should be declared as
  proc partproc {nick uhost hand chan {msg ""}} { ... }

for compatibility.

Module: irc
Usually, if you are reciving an error or the script isn't working its down to you not account for this in the script. Just check if there is a part message or not with something like

Code: Select all

if {$msg != ""} { ..we have a part message }
in your script.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

As I recall, not all irc servers do relay the part-reason onto other servers in the network. So yes, I believe this comes down to being on the same irc server as the spammer or not.

It is not related to some improper use of the part binding, obviously as your script triggers in both cases.
You could throw in the suggestion from the tcl-commands.doc, but that'd only be useful if you intend to use your script in both old eggis and more recent. If you're happy with just running it on recent eggies (say 1.6.15+), it'll work just as fine with fixed arguments.
NML_375
User avatar
arfer
Master
Posts: 436
Joined: Fri Nov 26, 2004 8:45 pm
Location: Manchester, UK

Post by arfer »

Yes, thanks nml375. I thought as much.

There are times when I forget that what I see in my IRC client is not necessarily what the eggdrop sees.
Post Reply