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.
Old posts that have not been replied to for several years.
S
Stafford
Post
by Stafford » Wed Jan 09, 2002 1:49 am
Hi guys, I'm wondering if there's such a script out there or someone has an idea about this:
'/msg $botnick auth $handle $passwd'
Any coding for this? The passwd should match that of $handle
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Wed Jan 09, 2002 1:59 am
Yes, there are plenty of scripts with this wort of system in.
Many of which are available in the Tcl archive.
S
Stafford
Post
by Stafford » Wed Jan 09, 2002 3:30 am
Ok, i need help with this thing. It gave me this error... TCL error [part_auth]: called "part_auth" with too many arguments
Here's the code
Code: Select all
proc auth:timer {hand} {
if {[hand2nick $hand] != ""} {
return 0
}
set a [getuser $hand XTRA auth]
if {$a != 0} {
setuser $hand XTRA auth 0
putcmdlog "AUTH: $hand didn't (re)join a channel in time."
if {$a == 2} {
set tmphost "*![getuser $hand XTRA authhost]"
delhost $hand $tmphost
putcmdlog "AUTH: Temporary hostmask $tmphost removed from $hand."
}
}
}
proc part_auth {nick host hand chan} {
if { $hand == "*" } { return 0 }
set a [getuser $hand XTRA auth]
if { $a >= 1 } {
utimer 10 "auth:timer $hand"
}
}
Hope someone can help me out.
<font size=-1>[ This Message was edited by: stafford on 2002-01-09 08:13 ]</font>
ppslim
Revered One
Posts: 3914 Joined: Sun Sep 23, 2001 8:00 pm
Location: Liverpool, England
Post
by ppslim » Wed Jan 09, 2002 12:51 pm
Read doc/tcl-commands.doc
proc part_auth {nick host hand chan} {
Read the section on binds (notible the part on the type PART).
S
Stafford
Post
by Stafford » Thu Jan 10, 2002 9:47 am
Thanks ppslim. I've changed the part proc. Here's the code of '/msg $botnick auth <nick> <pass>'. Is there anyway I can set a database (which is written to a file) and record the exact time the user auth? I'm not sure how to go about doing it.
Code: Select all
proc msg_auth {nick host hand arg} {
global botnick auth_clones rms_services
set authhand [lindex $arg 0]
set passwd [lindex $arg 1]
if {([llength [split $arg]]) > 2 || ([llength [split $arg]]) < 2} {
puthelp "NOTICE $nick :SYNTAX: /msg $botnick AUTH <nick> <password>"
return 0
}
if {[validuser $authhand] == 0} {
puthelp "NOTICE $nick :That nick is not registered in my database."
return 0
}
if {[passwdok $authhand $passwd] == 0} {
puthelp "NOTICE $nick :Authentication failed. Incorrect password"
return 0
}
if {[getuser $authhand XTRA auth] == 2} {
puthelp "NOTICE $nick :You are already authenticated."
return 0
}
putcmdlog "AUTH: $nick identified as $authhand"
setuser $authhand XTRA authhost $host
if {$auth_clones == 1} {
setuser $authhand XTRA authnick $nick
}
if {$hand != $authhand} {
# We need to temporarly add $hand's hostmast to $ahand
setuser $authhand HOSTS "*!$host"
setuser $authhand XTRA auth 2
putcmdlog "AUTH: $nick identified as $authhand with temporary hostmask *!$host"
} {
setuser $authhand XTRA auth 1
putcmdlog "AUTH: $nick identified as $authhand with known host $host"
}
if {[nick2hand $nick] == ""} {
puthelp "NOTICE $nick :Authentication successful."
puthelp "NOTICE $nick :You have $rms_services(joinlimit) minutes to join any channels I'm in or your authentication will expire."
putcmdlog "<$hand> Authenticated at [clock format [clock seconds] -format "%I:%M:%S %p"]"
timer $rms_services(joinlimit) "auth_check $nick $authhand"
return 0
}
}
S
Stafford
Post
by Stafford » Fri Jan 11, 2002 1:37 am
Ok, i've managed to figure it out how should I write into into database. I have a query now... hopefully someone can help. Here's part of the code:
Code: Select all
set authrec [open "auth.data.db" w]
puts $authrec "$hand $nick!$host [clock format [clock seconds] -format "%a %b %d %I:%M:%S SGT %Y"]"
close $authrec
That above would write the data to file.
Code: Select all
bind msg - info msg_info
proc msg_info {nick host hand arg} {
set authrec [open "auth.data.db" r]
gets $authrec
puthelp "NOTICE $nick :Registered Handle: [lindex authrec 0]"
close $authrec
return 0
}
How can I spilt the data such that the data recorded ($hand $nick!$host) and time can be each displayed as:
Registered Handle: $hand
last seen host: $nick!host
last time auth: 'time format'
Any help would be greatly appreciated.
<font size=-1>[ This Message was edited by: Stafford on 2002-01-10 22:38 ]</font>
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Fri Jan 11, 2002 2:06 am
First of all, your "gets" line is incorrect. Read the man page at
http://www.scriptics.com or tcl.activestate.com for information on the proper syntax.
About your question... you could use the "split" command, or you could change the database format. Instead of putting all the data on one line, why not split it up like:
nick
uhost
time
[blank line]
nick
uhost
time
Another option would be to separate the fields by tabs instead of spaces, so that you can do [split $line t]. That is preferable to the normal split command, because some of your fields (time) include spaces.
S
Stafford
Post
by Stafford » Fri Jan 11, 2002 4:24 am
Alright! I've got it. Thanks stdragon. Btw, there's this code
Code: Select all
if {[getuser $authhand XTRA auth] == 2} {
puthelp "NOTICE $nick :You are already authenticated."
return 0
}
This would prevent the user from '/msg $botnick auth <handle> <password>' twice. Is there anyway I can make it such that if the user has already auth and it trying to auth from the same host, the bot would give the above syntax. However if the user is from a different host (clones) and tries to auth, it will allow the user to auth?
<font size=-1>[ This Message was edited by: stafford on 2002-01-11 02:17 ]</font>
S
Stafford
Post
by Stafford » Fri Jan 11, 2002 11:32 pm
Help...
Though I managed to write data into file auth.data.db, it seems that if a different "handle" auth him/herself, it would overwrite other handles. Which means that the file would only contain 1 handle details. Any solutions?
stdragon
Owner
Posts: 959 Joined: Sun Sep 23, 2001 8:00 pm
Contact:
Post
by stdragon » Sat Jan 12, 2002 1:35 am
It's all in the documentation, man. Read about the open command. Hint: You are opening in mode 'w' which is overwriting the file.