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.

Get #auth on Mask

Help for those learning Tcl or writing their own scripts.
Post Reply
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Get #auth on Mask

Post by garfwen »

Hello.
On quakenet, when you'r authed, you can see you'r auth on your mask:

GaRfWeN!GaRfwen@ZIMBORA.users.quakenet.org

("ZIMBORA" is the #auth)

Code: Select all

bind pub - hello proc:hello

proc proc:hello {nick host hand chan text} {
				putquick "privmsg $chan :Hello $nick (#$auth)"
}
Now my question is how can i put the AUTH-NAME on the variable $auth ?

Ty,
GaRfWeN
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

try:

Code: Select all

putquick "privmsg $chan :Hello $nick ($nick!$host)"
:>
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

Post by garfwen »

Hello.

No, i just want the Auth-name:

"$auth"should be, in this case, "ZIMBORA"

:)
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

better to use WHOIS command than parse user host:

Code: Select all

# Author: tomekk
# e-mail:  tomekk/@/oswiecim/./eu/./org
# home page: http://tomekk.oswiecim.eu.org/
#
# Version 0.1
#
# This file is Copyrighted under the GNU Public License.
# http://www.gnu.org/copyleft/gpl.html

set auth_chans {#chan1 #chan2}

##################################################
bind pub - hello hello_proc
bind raw - 330 whois_proc

proc hello_proc { nick uhost hand chan arg } {
	global user_irc_name user_irc_chan auth_chans


	if {[lsearch $auth_chans $chan] != -1} {
		set user_irc_name $nick
		set user_irc_chan $chan

		putserv "WHOIS $nick"
	}
}

proc whois_proc { from keyword arg } {
	global user_irc_name user_irc_chan

	set list_of_args [split $arg]
	set auth_name [lindex $list_of_args 2]

	if {($auth_name != "") && ($keyword == 330)} {
		putquick "PRIVMSG $user_irc_chan :Hello $user_irc_name (\#$auth_name)"
	}
}

putlog "show-auth.tcl ver 0.1 by tomekk"
try :>
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Its better to use WHO with a special reply, raw 354 with %na arguments.
r0t3n @ #r0t3n @ Quakenet
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

Im using whois to check "account : " section.
It's just one line of output, can be easier? ;p
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Its infact 5 lines of output, but your only processing a certain line from the whois reply. WHO is however one line of output.
r0t3n @ #r0t3n @ Quakenet
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

In this case, adding another callback seems overkill to me, given the nature of the network.

Code: Select all

bind pub - hello proc:hello

proc proc:hello {nick host hand chan text} {
 set auth ""
 regexp {[^[:space:]@]+@([^[:space:].]+)\.users.quakenet.org} $host match auth
 putquick "privmsg $chan :Hello $nick (#$auth)"
} 
NML_375
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

Code: Select all

bind join - {*} hello:join
bind raw - {354} hello:raw

proc hello:join {n u h c t} {
    global hello
    if {[string match -nocase *users.quakenet.org $h]} {
        putserv "PRIVMSG $c :Hello $n ([lindex [split [lindex [split $h @] 1] .] 0])"
    } elseif {![info exists hello([string tolower $n])]} {
        set hello([string tolower $n]) "$c"
        putserv "WHO $n %nat,97"
    }
}

proc hello:raw {from raw arg} {
    global hello
    set t [lindex [split $arg] 1]
    set n [lindex [split $arg] 2]
    set a [lindex [split $arg] 3]
    if {![info exists hello([string tolower $n])]} { return }
    set c "$hello([string tolower $n])"
    unset hello([string tolower $n])
    if {$t == "97"} {
        if {$a != "" && $a != "0"} {
            putserv "PRIVMSG $c :Hello $n ($a)"
        } else {
            putserv "PRIVMSG $c :Hello $n"
        }
    }
}
Untested..
r0t3n @ #r0t3n @ Quakenet
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

now garfwen need to test them all ;p
g
garfwen
Halfop
Posts: 61
Joined: Wed Mar 12, 2008 5:16 pm

hehhe

Post by garfwen »

Hello :D

They are all working.

Ty :]
Post Reply