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.

Freenode and WHOIS output

Help for those learning Tcl or writing their own scripts.
Post Reply
z
zammer
Voice
Posts: 2
Joined: Tue Feb 14, 2012 11:13 am

Freenode and WHOIS output

Post by zammer »

Hey,

In irssi I have something like this (/whois zammer):
16:14:11 [freenode] -!- zammer [zammer@somewhere.com]
12:14:11 [freenode] -!- ircname : zammer
12:14:11 [freenode] -!- channels : #chan1 #chan2
12:14:11 [freenode] -!- server : leguin.freenode.net [Ume?, SE, EU]
12:14:11 [freenode] -!- hostname : somewhere.com 72.57.251.23
12:14:11 [freenode] -!- idle : 0 days 0 hours 0 mins 4 secs [signon: Tue Feb 11 15:34:09 2012]
12:14:11 [freenode] -!- account : zammer
12:14:11 [freenode] -!- End of WHOIS
Could someone tell me please how can read into script:
16:14:11 [freenode] -!- account : zammer

I want to check account name and do some things if it match.
I have no idea how to do this with Freenode and the custom IRCd.

Any hint?

Thanks!
Best regards.
J
Johannes13
Halfop
Posts: 46
Joined: Sun Oct 10, 2010 11:38 am

Post by Johannes13 »

bind raw 330

:holmes.freenode.net 330 Johannes13 Johannes13 Johannes13 :is logged in as

ok, 1st nick is your nick (botnick)
2nd nick is the nick of the whois target
3rd nick is the accountname.
w
willyw
Revered One
Posts: 1209
Joined: Thu Jan 15, 2009 12:55 am

Re: Freenode and WHOIS output

Post by willyw »

zammer wrote: In irssi I have something like this (/whois zammer):
....
12:14:11 [freenode] -!- account : zammer
...
Something to be aware of:
The way that line looks when you see it in irssi, is different from the way it looks when it appears in bot.
This is what it looks like to bot:

Code: Select all

<botnick> [12:36:23] [@] barjavel.freenode.net 330 botnick jack3 jack3 :is logged in as
Could someone tell me please how can read into script:
16:14:11 [freenode] -!- account : zammer

I want to check account name and do some things if it match.
I have no idea how to do this with Freenode and the custom IRCd.
...
Here is some stuff to play with. I hope it illustrates what is going on, and how to do it. You can uncomment lines as you wish, to see.

The way it is below, it sets a variable, and then sends you a line of text.
I assume that once you get the value into the variable, then that is what you wanted here... from there, you can do your own matching, etc.

Code: Select all


# Feb 14, 2012

# experimenting with obtaining info from a /whois on freenode

# http://forum.egghelp.org/viewtopic.php?t=18839


# set your nick here. Bot will be sending a query (pm) to it
set mynick "zammer"




# reference:
# http://www.eggheads.org/support/egghtml/1.6.21/tcl-commands.html#binda
# and scroll down to      bind raw
bind raw - 330 fn_whois



proc fn_whois {from key text} {
global mynick

        #putserv "privmsg $mynick :from is   $from"
        #putserv "privmsg $mynick :key is    $key"
        #putserv "privmsg $mynick :text is   $text"

        #putserv "privmsg $mynick :first element is   [lindex [split $text] 0]"
        #putserv "privmsg $mynick :second element is  [lindex [split $text] 1]"
        #putserv "privmsg $mynick :third element is   [lindex [split $text] 2]"
        #putserv "privmsg $mynick :the rest is        [lrange [split $text] 3 end]"

        set accountname [lindex [split $text] 2]

        putserv "privmsg $mynick :account name is:  $accountname "

}

With a quick test, on Freenode, the above worked for me.

I hope it helps to answer your question.
z
zammer
Voice
Posts: 2
Joined: Tue Feb 14, 2012 11:13 am

Post by zammer »

Hey,

Thanks for the hint.
I was looking at 330 output but I didn't know that the 3rd position is acc name.

Thanks
Best Regards
Post Reply