262 |
} |
} |
263 |
} else { |
} else { |
264 |
if {[validuser $line] && ![passwdok $line -]} { |
if {[validuser $line] && ![passwdok $line -]} { |
265 |
putidx $idx {Password.} |
if {[matchattr $line b]} { |
266 |
|
putidx $idx {passreq} |
267 |
|
} else { |
268 |
|
putidx $idx {Password.} |
269 |
|
} |
270 |
::tcldrop::idx::ChInfo $idx [list handle $line type CHAT_PASS other {pass waited 3s} timestamp [unixtime]] |
::tcldrop::idx::ChInfo $idx [list handle $line type CHAT_PASS other {pass waited 3s} timestamp [unixtime]] |
271 |
} else { |
} else { |
272 |
putidx $idx {You don't have access.} |
if {[matchattr $line b]} { |
273 |
|
# FixMe: putidx $idx {FixMe: Make sure bots without passwords can link the first time.} |
274 |
|
} else { |
275 |
|
putidx $idx {You don't have access.} |
276 |
|
} |
277 |
} |
} |
278 |
} |
} |
279 |
} |
} |
280 |
{CHAT_PASS} { |
{CHAT_PASS} { |
281 |
|
# FixMe: For bots, this should send "*hello" and "version ", |
282 |
|
# and change the type to "BOT". |
283 |
if {[passwdok $chatinfo(handle) $line]} { |
if {[passwdok $chatinfo(handle) $line]} { |
284 |
::tcldrop::idx::ChInfo $idx [list type CHAT other {chat flags: ?/0} timestamp [unixtime]] |
if {[matchattr $chatinfo(handle) b]} { |
285 |
putidx $idx {Welcome!} |
putidx $idx {*hello} |
286 |
# FixMe: Show the MOTD and whatnot here. |
putidx $idx {version } |
287 |
|
::tcldrop::idx::ChInfo $idx [list type BOT other {bot flags: } timestamp [unixtime]] |
288 |
|
} else { |
289 |
|
putidx $idx {Welcome!} |
290 |
|
::tcldrop::idx::ChInfo $idx [list type CHAT other {chat flags: ?/0} timestamp [unixtime]] |
291 |
|
# FixMe: Show the MOTD and whatnot here. |
292 |
|
} |
293 |
|
} else { |
294 |
|
if {[matchattr $chatinfo(handle) b]} { |
295 |
|
putidx $idx {badpass} |
296 |
|
} else { |
297 |
|
putidx $idx {Bad password!} |
298 |
|
} |
299 |
|
killidx $idx |
300 |
} |
} |
301 |
} |
} |
302 |
{TELNET_NEW} { |
{TELNET_NEW} { |
353 |
# Update their laston info: |
# Update their laston info: |
354 |
catch { setlaston $chatinfo(handle) [unixtime] partyline } |
catch { setlaston $chatinfo(handle) [unixtime] partyline } |
355 |
} |
} |
356 |
{BOT_NEW} { |
{FORK_BOT} { |
357 |
# This is when the remote bot is asking what our handle is. |
if {$line != {}} { |
358 |
global botnet-nick |
# This is when the remote bot is asking what our handle is. |
359 |
putidx $idx ${botnet-nick} |
putidx $idx ${::botnet-nick} |
360 |
::tcldrop::idx::ChInfo $idx [list type BOT_PASS other {bot_pass}] |
::tcldrop::idx::ChInfo $idx [list type BOT_NEW other {bot_new}] |
361 |
|
} |
362 |
} |
} |
363 |
{BOT_PASS} { |
{BOT_NEW} { |
364 |
# This is when the remote bot is asking what our password (or password hash) is. |
# This is when the remote bot is asking what our password (or password hash) is. |
365 |
if {[string match -nocase {passreq*} $line]} { |
if {[string match -nocase {passreq*} $line]} { |
366 |
putidx $idx [getuser $chatinfo(handle) PASS] |
putidx $idx [getuser $chatinfo(handle) PASS] |
373 |
{BOT_HELLO} { |
{BOT_HELLO} { |
374 |
# This is after we've send our handle and password to the remote bot, |
# This is after we've send our handle and password to the remote bot, |
375 |
# so now we send our version and whatever else needs to be sent to start with. |
# so now we send our version and whatever else needs to be sent to start with. |
376 |
if {[string match -nocase {version *} $line]} { |
if {[string match -nocase {version*} $line]} { |
377 |
# FixMe: Add proper version info here. |
# FixMe: Add proper version info here. |
378 |
putidx $idx "version " |
putidx $idx "version " |
379 |
::tcldrop::idx::ChInfo $idx [list type BOT other {bot flags: }] |
::tcldrop::idx::ChInfo $idx [list type BOT other {bot flags: }] |
547 |
set host [lindex $botaddr 0] |
set host [lindex $botaddr 0] |
548 |
set port [lindex $botaddr 1] |
set port [lindex $botaddr 1] |
549 |
global my-ip |
global my-ip |
550 |
set fail [catch { connect $host $port -timeout 99 -myaddr ${my-ip} -control ::tcldrop::dcc::BOTRead -errors ::tcldrop::dcc::BOTConnectErrors -writable ::tcldrop::dcc::BOTWrite } idx] |
set fail [catch { connect $host $port -timeout 99 -myaddr ${my-ip} -control ::tcldrop::dcc::Read -errors ::tcldrop::dcc::BOTConnectErrors } idx] |
551 |
if {!$fail} { |
if {!$fail} { |
552 |
::tcldrop::idx::ChInfo $idx [list handle $bot remote $host hostname $host port $port type FORK_BOT other {conn bot} timestamp [set timestamp [unixtime]]] |
::tcldrop::idx::ChInfo $idx [list handle $bot remote $host hostname $host port $port type FORK_BOT other {conn bot} timestamp [set timestamp [unixtime]]] |
553 |
#set TimerID [utimer 99 [list ::tcldrop::dcc::BOTConnectTimeout $idx]] |
#set TimerID [utimer 99 [list ::tcldrop::dcc::BOTConnectTimeout $idx]] |