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 

How to get user list on specified channel?

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


Joined: 19 Jun 2007
Posts: 6

PostPosted: Thu Jun 21, 2007 10:21 am    Post subject: How to get user list on specified channel? Reply with quote

I tried to use command: chanlist <channel> [flags[&chanflags]], but documentation says:

documentation wrote:
Returns: list of nicknames currently on the bot's channel that have all of the flags specified;. If no flags are given, all of the nicknames are returned. 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.


I don't know how to get list of users which are currently on my channel Sad
Back to top
View user's profile Send private message
DragnLord
Owner


Joined: 24 Jan 2004
Posts: 711
Location: C'ville, Virginia, USA

PostPosted: Thu Jun 21, 2007 10:38 am    Post subject: Reply with quote

.channel #channel
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jun 21, 2007 10:56 am    Post subject: Reply with quote

What's meant by the comment you highlighted is that if you execute this command in a sign/part procedure, the nick which parted/signed will still be listed in the chan list. If you're not executing it inside a sign/part-proc then you'll be getting the list of users currently in the channel. However, if it is being used inside a part/sign-proc you can simply exclude the nick that parted from the chanlist.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DzieX
Voice


Joined: 19 Jun 2007
Posts: 6

PostPosted: Thu Jun 21, 2007 4:24 pm    Post subject: Reply with quote

I thought, I can do it simpler, but OK.
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Thu Jun 21, 2007 7:12 pm    Post subject: Reply with quote

DzieX wrote:
I thought, I can do it simpler, but OK.

It is simple. What exactly is your problem?
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DzieX
Voice


Joined: 19 Jun 2007
Posts: 6

PostPosted: Fri Jun 22, 2007 8:03 am    Post subject: Reply with quote

All events call the same function with one parameter - channel name, so I don't have access to nick and can't exclude it from list.
Back to top
View user's profile Send private message
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Fri Jun 22, 2007 9:49 am    Post subject: Reply with quote

doc/tcl-commands.doc wrote:
(9) 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

(10) SIGN (stackable)
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'.
Module: irc

You've got nick, ident@host, possible handle, channel, and for sign, reason. Obviously, both these will provide the nickname of the one who left, and thus excluding it from the output of chanlist should'nt be so hard using a few temporary variables, lreplace, and lsearch.

DzieX wrote:
All events call the same function with one parameter - channel name, so I don't have access to nick and can't exclude it from list.

What are you talking about here? The only two bindings that are effected are the PART and SIGN bindings, both which supply alot more than simply a channelname...
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 9:55 am    Post subject: Reply with quote

DzieX wrote:
All events call the same function with one parameter - channel name, so I don't have access to nick and can't exclude it from list.

Ok, then as I said before you are getting the nicks that are currently in the channel and you need no "nick" to be removed.

Unless you're using it inside PART or SIGN binds, you don't need to remove the parting/quitting nick from the chanlist list.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
DzieX
Voice


Joined: 19 Jun 2007
Posts: 6

PostPosted: Fri Jun 22, 2007 10:57 am    Post subject: Reply with quote

Ok, maybe if I paste script in here You will understand what I'm writing about:

Code:
proc join {nick host handle chan} {
    make $chan
}
proc kick {nick host handle chan knick arg} {
    make $chan
}
proc mode {nick host handle chan arg mnick} {
    make $chan
}
proc nick {nick host handle chan newnick} {
    make $chan
}
proc part {nick host handle chan rest} {
    make $chan
}
proc sign {nick host handle chan arg} {
    make $chan
}
proc topc {nick host handle chan topic} {
    make $chan
}


Code:
bind join - * join
bind kick - * kick
bind mode - * mode
bind nick - * nick
bind part - * part
bind sign - * sign
bind topc - * topc


make is my procedure, which writes all data to database (6 records Razz).

OK, now I know how to do that. make will get one extra default parameter - nickname. In procedures sign and part, it will get user name, who has left channel. In other no (parameter by default will be "").

Thanks, for help and patience Smile
Back to top
View user's profile Send private message
Sir_Fz
Revered One


Joined: 27 Apr 2003
Posts: 3793
Location: Lebanon

PostPosted: Fri Jun 22, 2007 6:28 pm    Post subject: Reply with quote

Ok, so
Code:
proc make {chan {nick ""}} {
 set chanlist [chanlist $chan]
 if {$nick != ""} {
  set i [lsearch -exact $chanlist $chan]
  set chanlist [lreplace $chanlist $i $i]
 }
 # do whatever here
}

So, in you part/sign/kick procedures, pass an extra argument to [make] which is $nick.
_________________
Follow me on GitHub

- Opposing

Public Tcl scripts
Back to top
View user's profile Send private message Visit poster's website
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