I must be missing something somewhere... I have been looking at all the threads in here that talk about opening a dcc chat, but I just don't freaking get it.
Basically, I am still tweaking my qstat code... and I want to give the user the option to have the results sent by dcc (thereby being faster).
Here is the current code that just uses the standard putserv...
pub:qstat_results {nick pf} {
set output_list ""
while {[gets $pf line] >= 0} {
lappend output_list $line
}
if {[string match "DOWN*" [lindex $output_list 0]]} {
putserv "PRIVMSG $nick :Connection refused while querying server"
break
} elseif {[string match "HOSTNOTFOUND*" [lindex $output_list 0]]} {
putserv "PRIVMSG $nick :Host not found"
break
} elseif {[string match "TIMEOUT*" [lindex $output_list 0]]} {
putserv "PRIVMSG $nick :Timeout while querying server"
break
} else {
foreach output_line $output_list {
if {[string index $output_line 1]==0} {
putserv "PRIVMSG $nick :\00304,0 $output_line"
} elseif {[string index $output_line 1]==1} {
putserv "PRIVMSG $nick :\00302,0 $output_line"
} else {
putserv "PRIVMSG $nick :\00301,0 $output_line"
}
}
}
}
How do I make the bot initiate the DCC to the user (rather than have the user initiate)? Once how do I make the bot realize that the chat has been accepted and then dump the results?
set asus(port) "8000"
bind MSG - dcc_chat asus_dcc
proc asus_dcc {nick uhost hand vasus} {
global asus botnick
## Do all ya check stuff here##
## ![validuser $hand] ##
putserv "PRIVMSG $nick :\001DCC CHAT chat [myip] $asus(port)\001"
}
listen $asus(port) script asus_catch
proc asus_catch {idx} {
asus_dcc_window $idx
control $idx asus_dcc_catch
}
proc asus_dcc_window {idx} {
global botnick
putdcc $idx "Welcome to $botnick Dcc CHAT."
putdcc $idx "All my msgs will be sent in here, so plz keep this window open while using my services"
putdcc $idx "At any time write /002.help/002 for any help.
}
proc asus_dcc_catch {idx dcc_catch} {
global botnick
if {[string [split $asus_catch] 0] == ".help"} {
putdcc $idx " $botnick HELP"
putdcc $idx " etc etc...."
}
}
I had a script that I wrote for about the same perpose. So with some changes, I hope that helps you out!
It is not tested. But it looks right. So if I get time in the next 3 days (I wont be online for about a week I think, if I get this new Job!) I will test to make sure that it works and post the bug fix....
LOL . I looked over it for the last time quickly and I missed the last } in asus_dcc_catch. But I think that is it.
I would recomend setting up the litening port before sending the CTCP message. What if the port is allready in use?
Another method is to use port number 0. Apparently, you can use this to get aggrop to find a port for you, and this port number is used as the retrun value.
Alright... Finally had the time to sit back down and work on this... I have it mostly working... the only thing that I run into is if 2 or more people try to get server status at the same time, it sends the output requested by the first user to the last person that requested it.
How can I lock it until it is finished sending to one person? I'm not worried about it keeping the chat open, as I only want it to open the dcc, send the status requested, and kill it. Any thoughts?