egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

bind join/part

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
WazzaUK
Voice


Joined: 02 Jul 2006
Posts: 19

PostPosted: Sun Sep 10, 2006 5:36 pm    Post subject: bind join/part Reply with quote

im trying to set a field in a MYSQL table when users are in a particular channel ('yes' when join, 'no' when part). Join works fine, but part doesnt even seem to call the procedure. Ive gotta be missing something..

Any ideas.....

Code:
load /usr/local/lib/mysqltcl-3.02/libmysqltcl3.02.so
package require mysqltcl
set db_handle [mysqlconnect -host ###.###.###.### -socket /var/lib/mysql/mysql.sock -user <user> -password <password> -db <database>

bind join - "#channel *" join_main
bind part - "#channel *" part_main

proc join_main {nick uhost hand channel} {
global db_handle botnick
  if {$nick==$botnick} {return 0}
  set sql "UPDATE users SET onirc = 'yes' WHERE username = '$nick'"
  putloglev d * "ircstats: executing $sql"
  set result [mysqlexec $db_handle $sql]
  if {$result != 1} {
    putlog "SQL - error"
  } else {
     set id [mysqlinsertid $db_handle]
     puthelp "PRIVMSG $channel :User Online \002$nick\002 added"
  }
}

proc part_main {nick uhost hand channel} {
global db_handle botnick
  if {$nick==$botnick} {return 0}
  set sql "UPDATE users SET onirc = 'no' WHERE username = '$nick'"
  putloglev d * "ircstats: executing $sql"
  set result [mysqlexec $db_handle $sql]
  if {$result != 1} {
    putlog "SQL - Error"
  } else {
     set id [mysqlinsertid $db_handle]
     puthelp "PRIVMSG $channel :User Offline \002$nick\002 removed"
  }
}
Back to top
View user's profile Send private message
WazzaUK
Voice


Joined: 02 Jul 2006
Posts: 19

PostPosted: Sun Sep 10, 2006 6:00 pm    Post subject: i see it Reply with quote

i forgot a msg param in part procedure
Back to top
View user's profile Send private message
WazzaUK
Voice


Joined: 02 Jul 2006
Posts: 19

PostPosted: Sun Sep 10, 2006 7:27 pm    Post subject: Quit / Ping timeout Reply with quote

seems that part doesnt cover quit and pingtime out - any ideas???
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Sun Sep 10, 2006 7:59 pm    Post subject: Reply with quote

Yup, quit is a completely separate (irc) command from part..
Hence it got its own binding, "sign":
Quote:

bind sign <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel> <reason>

Description: triggered by a signoff, or possibly by someone who got
netsplit and never returned. The signoff message is the last
argument to the proc. Wildcards can be used in the mask, which is
matched against '#channel nick!user@host'.

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
WazzaUK
Voice


Joined: 02 Jul 2006
Posts: 19

PostPosted: Mon Sep 11, 2006 2:22 am    Post subject: nick change Reply with quote

yep sign covered quit/ping timeout

what about nick change - is there a list of these procedures anywhere?

got it lol

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

Stackable
Triggered when someone changes nicknames. Wildcards are allowed. The mask is matched against #channel newnick.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber