[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: |
Mon, 17 Nov 2003 17:55:37 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/11/17 17:55:37
Modified files:
modules : dcc.tcl
Log message:
Added the following dcc commands: +user, save, uptime, backup, comment,
reload, rehash, die, loadmod, and unloadmod.
Note that there's very little error checking so far, and a lot of the
tcl commands they use haven't been written yet.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
Patches:
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.17 tcldrop/modules/dcc.tcl:1.18
--- tcldrop/modules/dcc.tcl:1.17 Sat Nov 15 21:55:37 2003
+++ tcldrop/modules/dcc.tcl Mon Nov 17 17:55:36 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.17 2003/11/16 02:55:37 fireegl Exp $
+# $Id: dcc.tcl,v 1.18 2003/11/17 22:55:36 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.17 2003/11/16 02:55:37 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.18 2003/11/17 22:55:36 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
@@ -636,6 +636,15 @@
putdcc "Added bot '$bot' with address '$address' and hostmask '$host'"
}
+bind dcc nm +user ::tcldrop::dcc::+USER
+proc ::tcldrop::dcc::+USER {handle idx text} {
+ set user [::tcldrop::slindex $text 0]
+ set hostmask [::tcldrop::slindex $text 1]
+ adduser $user $hostmask
+ putcmdlog "#$handle# +user $text"
+ putdcc $idx "Added $user ($hostmask) with [chattr $user] flags"
+}
+
bind dcc n -user ::tcldrop::dcc::-USER
proc ::tcldrop::dcc::-USER {handle idx text} {
if {[deluser $text]} {
@@ -704,7 +713,7 @@
set changes [::tcldrop::slindex $text 1]
set channel [::tcldrop::slindex $text 2]
if {[set chattr [chattr $who $changes $channel]] == {*}} {
- putdcc "No such user."
+ putdcc {No such user.}
} else {
putcmdlog "#$handle# chattr $text"
putdcc $idx "Global flags for $who are now +[lindex [split
$chattr |] 0]"
@@ -714,7 +723,71 @@
}
}
+bind dcc nmto save ::tcldrop::dcc::SAVE
+proc ::tcldrop::dcc::SAVE {handle idx text} {
+ save
+ putcmdlog "#$handle# save $text"
+ putdcc $idx {Saving user file...}
+}
+
+bind dcc nmtof uptime ::tcldrop::dcc::UPTIME
+proc ::tcldrop::dcc::UPTIME {handle idx text} {
+ putcmdlog "#$handle# uptime $text"
+ # FixMe: Add an [uptime] proc that returns the seconds that the bot has
been running.
+ putdcc $idx "Online for [duration [uptime]]."
+}
+
+bind dcc nmt backup ::tcldrop::dcc::BACKUP
+proc ::tcldrop::dcc::BACKUP {handle idx text} {
+ putcmdlog "#$handle# backup $text"
+ putdcc $idx {Backing up data files...}
+ # FixMe: Add a [backup] command that calls the "backup" bindings. The
bindings should in turn do the backing up of the user/channel files.
+ backup
+}
+
+bind dcc n comment ::tcldrop::dcc::COMMENT
+proc ::tcldrop::dcc::COMMENT {handle idx text} {
+ set who [::tcldrop::slindex $text 0]
+ set comment [::tcldrop::slindex $text 1]
+ setuser $who COMMENT $comment
+ putcmdlog "#$handle# comment $text"
+ putdcc $idx {Changed comment.}
+}
+
+bind dcc n reload ::tcldrop::dcc::RELOAD
+proc ::tcldrop::dcc::RELOAD {handle idx text} {
+ putcmdlog "#$handle# reload $text"
+ putdcc $idx {Reloading user file...}
+ reload
+}
+bind dcc n rehash ::tcldrop::dcc::REHASH
+proc ::tcldrop::dcc::REHASH {handle idx text} {
+ putcmdlog "#$handle# rehash $text"
+ putdcc $idx {Rehashing..}
+ rehash
+}
+
+bind dcc n die ::tcldrop::dcc::DIE
+proc ::tcldrop::dcc::DIE {handle idx text} {
+ putcmdlog "#$handle# die $text"
+ putdcc $idx {Dieing...}
+ die
+}
+
+bind dcc n loadmod ::tcldrop::dcc::LOADMOD
+proc ::tcldrop::dcc::LOADMOD {handle idx text} {
+ loadmodule $text
+ putcmdlog "#$handle# loadmod $text"
+ putdcc $idx "Module loaded: $text"
+}
+
+bind dcc n unloadmod ::tcldrop::dcc::UNLOADMOD
+proc ::tcldrop::dcc::UNLOADMOD {handle idx text} {
+ unloadmodule $text
+ putcmdlog "#$handle# unloadmod $text"
+ putdcc $idx "Module unloaded: $text"
+}
bind time - {* * * * *} ::tcldrop::dcc::AutoLinkBots
proc ::tcldrop::dcc::AutoLinkBots {minute hour day month year} {
- [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, 2003/11/15
- [Tcldrop/CVS] tcldrop/modules dcc.tcl,
Philip Moore <=
- [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