[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules dcc.tcl
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules dcc.tcl |
Date: |
Sat, 15 Nov 2003 21:55:38 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/11/15 21:55:38
Modified files:
modules : dcc.tcl
Log message:
Added the following dcc binds: whoami, -host, bots, newpass, +bot,
-user, -bot, link, chaddr, chpass, +host, and chattr.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.16 tcldrop/modules/dcc.tcl:1.17
--- tcldrop/modules/dcc.tcl:1.16 Fri Nov 14 16:36:11 2003
+++ tcldrop/modules/dcc.tcl Sat Nov 15 21:55:37 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.16 2003/11/14 21:36:11 fireegl Exp $
+# $Id: dcc.tcl,v 1.17 2003/11/16 02:55:37 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
#
@@ -32,7 +32,7 @@
# Provide the users module:
variable version {0.2}
package provide tcldrop::dcc $version
- variable rcsid {$Id: dcc.tcl,v 1.16 2003/11/14 21:36:11 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.17 2003/11/16 02:55:37 fireegl Exp $}
#checkmodule console
# Export all the commands that should be available to 3rd-party
scripters:
namespace export dcclist listen putdcc getchan setchan console echo
strip idx2hand hand2idx link bots islinked putbot putallbots sock2idx idx2sock
@@ -552,6 +552,7 @@
# Here goes all the DCC binds:
bind dcc n tcl ::tcldrop::dcc::TCL
proc ::tcldrop::dcc::TCL {handle idx text} {
+ putcmdlog "#$handle# tcl $text"
if {[catch { uplevel \#0 $text } out]} {
set out "TCL error: $out"
} else {
@@ -562,8 +563,9 @@
bind dcc n set ::tcldrop::dcc::SET
proc ::tcldrop::dcc::SET {handle idx text} {
- set variable [lindex [set text [split $text]] 0]
- set value [join [lrange $text 1 end]]
+ putcmdlog "#$handle# set $text"
+ set variable [::tcldrop::::tcldrop::slindex $text 0]
+ set value [join [::tcldrop::slrange $text 1 end]]
if {[catch { uplevel \#0 [list set $variable $value] } out]} {
set out "Error: $out"
} else {
@@ -574,6 +576,7 @@
bind dcc - help ::tcldrop::dcc::HELP
proc ::tcldrop::dcc::HELP {handle idx text} {
+ putcmdlog "#$handle# help $text"
putdcc $idx "There's no help here! FixMe!"
}
@@ -583,12 +586,134 @@
if {[idx2sock $idx] == {stdout}} {
putdcc $idx {Sorry, console users can't .quit (FixMe!)}
} else {
+ putcmdlog "#$handle# quit $text"
putdcc $idx {Bu-Bye!}
# FixMe: This should be $nick $uhost instead:
putlog "[format $::tcldrop::lang(0xe16) $handle $idx]"
killdcc $idx $text
}
}
+
+bind dcc - whoami ::tcldrop::dcc::WHOAMI
+proc ::tcldrop::dcc::WHOAMI {handle idx text} {
+ putcmdlog "#$handle# whoami $text"
+ putdcc $idx "You are address@hidden::botnet-nick}"
+}
+
+bind dcc - -host ::tcldrop::dcc::-HOST
+proc ::tcldrop::dcc::-HOST {handle idx text} {
+ set who [::tcldrop::slindex $text 0]
+ set host [::tcldrop::slindex $text 1]
+ # FixMe: This should let anyone with higher flags that the person they
want to -host remove their host, I think..
+ if {(([string equal -nocase $handle $who]) || ([matchattr $handle n]))
&& ([delhost $who $host])} {
+ putcmdlog "#$handle# -host $who $host"
+ putdcc $idx "Removed '$host' from $who"
+ }
+}
+
+bind dcc nmt bots ::tcldrop::dcc::BOTS
+proc ::tcldrop::dcc::BOTS {handle idx text} {
+ putcmdlog "#$handle# bots"
+ putdcc $idx "Bots: [join [bots] {, }]."
+ putdcc $idx "(Total: [llength [bots]])"
+}
+
+bind dcc - newpass ::tcldrop::dcc::NEWPASS
+proc ::tcldrop::dcc::NEWPASS {handle idx text} {
+ chpass $handle $text
+ putcmdlog "#$handle# newpass..."
+ putdcc $idx "Changed password to '$text'"
+}
+
+bind dcc nmt +bot ::tcldrop::dcc::+BOT
+proc ::tcldrop::dcc::+BOT {handle idx text} {
+ set bot [::tcldrop::slindex $text 0]
+ set address [::tcldrop::slindex $text 1]
+ set host [::tcldrop::slindex $text 2]
+ addbot $bot $address
+ addhost $bot $host
+ putcmdlog "#$handle# +bot $text"
+ putdcc "Added bot '$bot' with address '$address' and hostmask '$host'"
+}
+
+bind dcc n -user ::tcldrop::dcc::-USER
+proc ::tcldrop::dcc::-USER {handle idx text} {
+ if {[deluser $text]} {
+ putcmdlog "#$handle# -bot $text"
+ putdcc $idx "Deleted $text."
+ }
+}
+
+bind dcc nmt -bot ::tcldrop::dcc::-BOT
+proc ::tcldrop::dcc::-BOT {handle idx text} {
+ if {[matchattr $text b]} {
+ -USER $handle $idx $text
+ }
+}
+
+bind dcc nmt link ::tcldrop::dcc::LINK
+proc ::tcldrop::dcc::LINK {handle idx text} {
+ if {[matchattr $text b]} {
+ putcmdlog "#$handle# link $text"
+ putdcc "Attempting to link to $text..."
+ link $text
+ }
+}
+
+bind dcc nmt chaddr ::tcldrop::dcc::CHADDR
+proc ::tcldrop::dcc::CHADDR {handle idx text} {
+ set bot [::tcldrop::slindex $text 0]
+ if {[matchattr $bot b]} {
+ set address [split [::tcldrop::slindex $text 1] "\\/:"]
+ set botport [lindex $address 1]
+ set userport [lindex $address 2]
+ if {$userport == {}} { set userport $botport }
+ set address [lindex $address 0]
+ setuser $bot BOTADDR [list $address $botport $userport]
+ putcmdlog "#$handle# chaddr $text"
+ putdcc $idx {Changed bots address.}
+ }
+}
+
+# FixMe: Allow non-owners to use this securely:
+bind dcc n chpass ::tcldrop::dcc::CHPASS
+proc ::tcldrop::dcc::CHPASS {handle idx text} {
+ set who [::tcldrop::slindex $text 0]
+ set pass [::tcldrop::slindex $text 1]
+ chpass $who $pass
+ putcmdlog "#$handle# chpass $who \[something\]"
+ putdcc $idx {Changed password.}
+}
+
+bind dcc - +host ::tcldrop::dcc::+HOST
+proc ::tcldrop::dcc::+HOST {handle idx text} {
+ set who [::tcldrop::slindex $text 0]
+ set host [::tcldrop::slindex $text 1]
+ # FixMe: This shouldn't be restricted to owners:
+ if {[string equal -nocase $who $handle] || [matchattr $handle n]} {
+ addhost $who $host
+ putcmdlog "#$handle# +host $text"
+ putdcc $idx "Added '$host' to $who."
+ }
+}
+
+# FixMe: This shouldn't be restricted to just owners:
+bind dcc n chattr ::tcldrop::dcc::CHATTR
+proc ::tcldrop::dcc::CHATTR {handle idx text} {
+ set who [::tcldrop::slindex $text 0]
+ set changes [::tcldrop::slindex $text 1]
+ set channel [::tcldrop::slindex $text 2]
+ if {[set chattr [chattr $who $changes $channel]] == {*}} {
+ putdcc "No such user."
+ } else {
+ putcmdlog "#$handle# chattr $text"
+ putdcc $idx "Global flags for $who are now +[lindex [split
$chattr |] 0]"
+ if {$channel != {}} {
+ putdcc $idx "Channel flags for $who on $channel are now
+[lindex [split $chattr |] end]."
+ }
+ }
+}
+
bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/01
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/04
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/04
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/10
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/14
- [Tcldrop/CVS] tcldrop/modules dcc.tcl,
Philip Moore <=
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/17
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/18
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/19
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/22
- [Tcldrop/CVS] tcldrop/modules dcc.tcl, Philip Moore, 2003/11/25