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 

chanlist displaying users that have left the channel

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


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Fri Aug 14, 2009 5:35 pm    Post subject: chanlist displaying users that have left the channel Reply with quote

Quote:
Please note that if you're executing chanlist after a part or sign bind, the gone user will still be listed, so you can check for wasop, isop, etc.
Taken from Eggdrop TCL Commands file. I dont think this would be a common thing on small channels, only for large channels. Would doing a foreach loop with 'onchan' to creat a new channel list be the best way to avoid this Question
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Fri Aug 14, 2009 6:00 pm    Post subject: Re: chanlist displaying users that have left the channel Reply with quote

TCL_no_TK wrote:
Quote:
Please note that if you're executing chanlist after a part or sign bind, the gone user will still be listed, so you can check for wasop, isop, etc.
Taken from Eggdrop TCL Commands file. I dont think this would be a common thing on small channels, only for large channels. Would doing a foreach loop with 'onchan' to creat a new channel list be the best way to avoid this Question

Why would you need a second list? Are you storing this as a file or something? Wouldn't it just be easier, and more efficient just to use continue?
Code:
foreach member [chanlist $chan] {
  if {![onchan $member $chan]} { continue }
  # do more stuff down here, the user is _actually_ present
}


What do you mean by this statement: "I dont think this would be a common thing on small channels, only for large channels." ??! It has the same bearing on small channels as large channels. What it means is that if you have a procedure bound, to sign/part and within that procedure use the [chanlist $chan]. That user who triggered the bind on sign/part is still going to be listed in the chanlist until the part/sign procedure ends. At which point housekeeping takes place and *poof* they disappear from the chanlist. Their nick will still be passed as usual as one of the arguments of the sign/part as well. It is only during sign/part procedures that this is going to be an issue and it adopts this behavior so it's still possible to tell what mode that person had on irc prior to their depature.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sat Aug 15, 2009 12:28 pm    Post subject: Reply with quote

Thanks Very Happy dats a big help

Question question about why i said the "common on small channels".
Arrow If its a small channel there wouldn't be that many sign/parts so the [chanlist $chan] wouldn't contain as many (or any for that matter) as a large channel would with alot of sign/parts leaving more chance of getting a [chanlist $chan] with alot of nickname's that are no longer pressant on the channel
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Sat Aug 15, 2009 6:52 pm    Post subject: Reply with quote

TCL_no_TK wrote:
Question question about why i said the "common on small channels".
Arrow If its a small channel there wouldn't be that many sign/parts so the [chanlist $chan] wouldn't contain as many (or any for that matter) as a large channel would with alot of sign/parts leaving more chance of getting a [chanlist $chan] with alot of nickname's that are no longer pressant on the channel


You do realize this thinking is incorrect right? The [chanlist $chan] list would have only _ONE_ nickname in it that has parted/quit, and that would be the nickname which triggered the bind to sign/part. This would only occur inside the procedure which is invoked from the sign/part and after this procedure ends the normal housekeeping eggdrop does would remove this _ONE_ person from the chanlist afterwards. There is no possibility alot of nicknames not present would occur.

This happens because of how eggdrop handles binds and events. Any tcl script bound will be executed _before_ eggdrop's normal routines will react on the same event. This is so that eggdrop's housekeeping duties do not interfere/remove elements which might be needed within the bound tcl script. Hopefully you get the jist of what I'm saying. If not might need nml375 to re-word what I've said so it's more understandable.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
TCL_no_TK
Owner


Joined: 25 Aug 2006
Posts: 509
Location: England, Yorkshire

PostPosted: Sat Aug 15, 2009 8:35 pm    Post subject: Reply with quote

narr, not at all bud. Its a great insite in to it for me Smile cheers x really helpful Exclamation
_________________
TCL the misunderstood
Back to top
View user's profile Send private message Send e-mail
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Aug 19, 2009 5:19 pm    Post subject: Reply with quote

Another approach, most suitable if you need the list of channel members rather than performing an action on each still-present channel member would be to use the nick (which is available from the binding...) to lsearch the list and then just lreplace it.

However, I'd say the continue-approach would be most suitable if you need to run a foreach loop on all the still-present nicknames..
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Ganondorf
Voice


Joined: 07 Jun 2012
Posts: 1

PostPosted: Thu Jun 07, 2012 5:40 am    Post subject: Re: chanlist displaying users that have left the channel Reply with quote

speechles wrote:
Code:
foreach member [chanlist $chan] {
  if {![onchan $member $chan]} { continue }
  # do more stuff down here, the user is _actually_ present
}



That doesn't work for me. Sad

I have bind on part and I do this in the called proc

Code:

set nicklist [chanlist $channel]
foreach user $nicklist {
  if {![onchan $user $channel]} {
    putlog $user
    putlog " offline"
    continue
  } else {
    putlog $user
    putlog " online"
  }
}


and I get every nick (including the one that disconnected) with "online"
I'm using Eggdrop v1.6.21

and idea what's wrong?
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Jun 07, 2012 4:07 pm    Post subject: Reply with quote

Ganondorf,
That is because the part-binding is triggered before the nickname has been removed from the internal channel-members list.
If you'd like to exclude the parting nick from the iteration, you could either use lsearch/lreplace to remove the nick manually, or compare each item during the iteration to see if it matches the parting nickname.
_________________
NML_375, idling at #eggdrop@IrcNET
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