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.

join / rejn and array question

Old posts that have not been replied to for several years.
Locked
User avatar
SaPrOuZy
Halfop
Posts: 75
Joined: Wed Mar 24, 2004 7:38 am
Location: Lebanon

join / rejn and array question

Post by SaPrOuZy »

Hello there,
i have 2 questions:

1- if i have bind join - * proc1
do nicks rejoining from a split activate proc1?
if it does, how can i ignore rejoining nicks and stop the proc from continuing

2- am using this queue implementation i found on the net:

Code: Select all

proc qinit {qvar} {
            upvar 1 $qvar Q
            set Q(i) 0
            set Q(l) [list]
            set Q(r) [list]
}

proc qput {qvar elem} {
            upvar 1 $qvar Q
            lappend Q(r) $elem
}

proc qget {qvar} {
            upvar 1 $qvar Q
            if {$Q(i) >= [llength $Q(l)]} {
                set Q(l) $Q(r)
                set Q(r) [list]
                set Q(i) 0
            }
            set head [lindex $Q(l) $Q(i)]
            incr Q(i)
            return $head
}

proc qempty {qvar} {
            upvar 1 $qvar Q
            return [expr {$Q(i) >= [llength $Q(l)] && [llength $Q(r)] == 0}]
}
if i try using like qinit q1($chan) , i get an error that var is not an array or something, how can i modify this queue implementation to allow arrays (q1($chan))

thanks alot.
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

1) Your proc1 will be activated whenever a user joins a channel. It doesn't have to be from a split, it can be a normal join as well. It will also trigger when the bot joins a channel itself.

Detecting split nicks rejoining with bind join would be foolish in my case. You can use bind rejn but you would have to check a variable in your .conf file:

Code: Select all

# Set here the time (in seconds) to wait for someone to return from a netsplit
# (i.e. wasop will expire afterwards). Set this to 1500 on IRCnet since its
# nick delay stops after 30 minutes.
set wait-split 600
SPLT (stackable)
bind splt <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>

Description: triggered when someone gets netsplit on the channel. Be aware that this may be a false alarm (it's easy to fake a netsplit signoff message on some networks); mask may contain wildcards and is matched against '#channel nick!user@host'. Anyone who is SPLT will trigger a REJN or SIGN within the next wait-split (defined in the config file) minutes.


REJN (stackable)
bind rejn <flags> <mask> <proc>
procname <nick> <user@host> <handle> <channel>

Description: someone who was split has rejoined. mask can contain wildcards, and is matched against '#channel nick!user@host'.
If the net re-joins after this interval of time, then it wouldn't be classified as bind rejn anymore, but it can activate bind join. Returning 0 could halt the procedure, or you can bind raw to the specific raw number if it exists for netsplits/rejoins and return 1 instead.

2) Secondly, what are you trying to accomplish with this queue system? -- trying todo. Maybe a smaller and easier method can be used.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
SaPrOuZy
Halfop
Posts: 75
Joined: Wed Mar 24, 2004 7:38 am
Location: Lebanon

Post by SaPrOuZy »

thanks for the reply

1) and 2)
am queuing hosts and nicks of pple joining a chan, so that in case i get let's say, 5 joins in 2 sec, i ban the hosts and kick the nicks.
but i don't want this to be triggered by nick rejoining from splits

i added this - inside the proc bound to join -, it seems to work fine (i was lucky a split occured just after i rehashed hehe), but i wanted to be sure it wont mess up

Code: Select all

bind rejn - * { putlog  "$nick returned on $zchan from split"; return 1}

2) i want to use the array so that i log each chan's joins separately, so far (beside the worry about the split rejoin thing) all my script works fine except that i can't run it for more than 1 chan
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Care to explain how this "queue implementation" works and is used?
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

For your question 2, now stated a bit clearly, I developed a script which actually does the same thing you want, and a bit more if I say so.

Here is the link, download it at see for yourself:
http://www.egghelp.org/cgi-bin/tcl_arch ... ad&id=1162

It is uses arrays for counting mass joins, mass parts and mass revolving doors or mass join/parts. Your array should have the $chan mentioned also.

Example:

Code: Select all

$clone_nicks($host:$chan)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
demond
Revered One
Posts: 3073
Joined: Sat Jun 12, 2004 9:58 am
Location: San Francisco, CA
Contact:

Post by demond »

1) no, [bind join] will not be triggered by rejoining from a split, so you can safely forget about that, it's not a problem
2) you need to use [qinit $chan], [qput $chan $uhost], [qget $chan] or [qempty $chan]; but you don't need a queue for that, a simple list will suffice
Locked