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.

equivalent to getchanhost for a user outside the channel

Help for those learning Tcl or writing their own scripts.
Post Reply
r
redlander
Voice
Posts: 1
Joined: Wed Aug 17, 2005 6:17 am

equivalent to getchanhost for a user outside the channel

Post by redlander »

Greetings all,

I'm trying to grab ident@host for a user not in the bot chan. Is there an easy way to do this, or is a raw bind my only option?

Thanks,

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

Post by awyeah »

The only two methods I can think of currently are either perform a WHOIS or a WHO on that user. Unless if you are an OPER on that network then there are other ways.

CTCP hmmm, not really sure and it is unreliable since people can change their replies through scripting.

Obviously a WHO would be more simpler solution:

Code: Select all

putserv "WHO $nick"
And then use the raw binding with 352 as the keyword to get that user's user@host. Here is a simple example.

Code: Select all

bind raw - 352 get:uhost

proc get:uhost {from key arg} {
 set arg [split $arg]
 set uhost [lindex $arg 2]@[lindex $arg 3]
 #do your stuff here
}
In my case and honest oppinion:
You would have to use raw --> if the user is not on any of the channels the bot is on --> so the bot can retrieve that user's user@host

Other than that, I can't think of any other way not to use raw. Because raw is the only way you can retrieve information from the server if you can't see that user on any channel which you are in. (this goes the same if you are a user yourself and not a bot, you have to use: /whois or /who)
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Keep in mind to always explicitly define the return-value when using raw bindings...
doc/tcl-commands.doc wrote: (17) RAW (stackable)
bind raw <flags> <keyword> <proc>
procname <from> <keyword> <text>

Description: previous versions of Eggdrop required a special compile
option to enable this binding, but it's now standard. The keyword
is either a numeric, like "368", or a keyword, such as "PRIVMSG".
from will be the server name or the source user (depending on
the keyword); flags are ignored. The order of the arguments is
identical to the order that the IRC server sends to the bot. The
pre-processing only splits it apart enough to determine the
keyword. If the proc returns 1, Eggdrop will not process the line
any further (this could cause unexpected behavior in some cases).

Module: server
NML_375
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

I would use WHO with the nuh arguments (n=nickname,u=username(identd),h=hostname)

Code: Select all

putserv "WHO $nick %nuht,22"

bind raw - 354 get:uhost

proc get:uhost {from key arg} {
    if {[lindex [split $arg] 1] == "22"} {
        set hostname "[lindex [split $arg] 2]@[lindex [split $arg] 3]"
        set nickname "[lindex [split $arg] 4]"
        # do stuff here
    }
}
I prefer special formatted who's as it does not return all the other junk.
r0t3n @ #r0t3n @ Quakenet
User avatar
user
&nbsp;
Posts: 1452
Joined: Tue Mar 18, 2003 9:58 pm
Location: Norway

Post by user »

WHO? Why not USERHOST?
Have you ever read "The Manual"?
Post Reply