[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tcldrop/CVS] tcldrop/modules dcc.tcl console/console.tcl
From: |
Philip Moore |
Subject: |
[Tcldrop/CVS] tcldrop/modules dcc.tcl console/console.tcl |
Date: |
Mon, 17 Nov 2003 21:58:32 -0500 |
CVSROOT: /cvsroot/tcldrop
Module name: tcldrop
Branch:
Changes by: Philip Moore <address@hidden> 03/11/17 21:58:31
Modified files:
modules : dcc.tcl
modules/console: console.tcl
Log message:
The [console] command works fully now.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/dcc.tcl.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/console/console.tcl.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
Patches:
Index: tcldrop/modules/console/console.tcl
diff -u tcldrop/modules/console/console.tcl:1.5
tcldrop/modules/console/console.tcl:1.6
--- tcldrop/modules/console/console.tcl:1.5 Fri Nov 14 10:58:47 2003
+++ tcldrop/modules/console/console.tcl Mon Nov 17 21:58:31 2003
@@ -1,24 +1,24 @@
# console.tcl --
#
-# $Id: console.tcl,v 1.5 2003/11/14 15:58:47 fireegl Exp $
+# $Id: console.tcl,v 1.6 2003/11/18 02:58:31 fireegl Exp $
#
# Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
-#
+#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program (see gpl.txt); if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
# Or visit http://www.GNU.Org/licenses/gpl.html
-#
+#
# The author of this project can be reached at address@hidden
# Or can be found on IRC (EFNet or FreeNode) as FireEgl.
#
@@ -36,7 +36,11 @@
# Stores the console data in the userfile for $idx:
proc console::store {idx} {
- # FixMe: Complete.
+ if {![catch { setuser [idx2hand $idx] [console $idx] }]} {
+ return 1
+ } else {
+ return 0
+ }
}
# FixMe: Provide the .console and .store DCC commands.
Index: tcldrop/modules/dcc.tcl
diff -u tcldrop/modules/dcc.tcl:1.18 tcldrop/modules/dcc.tcl:1.19
--- tcldrop/modules/dcc.tcl:1.18 Mon Nov 17 17:55:36 2003
+++ tcldrop/modules/dcc.tcl Mon Nov 17 21:58:31 2003
@@ -1,6 +1,6 @@
# dcc.tcl --
#
-# $Id: dcc.tcl,v 1.18 2003/11/17 22:55:36 fireegl Exp $
+# $Id: dcc.tcl,v 1.19 2003/11/18 02:58:31 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.18 2003/11/17 22:55:36 fireegl Exp $}
+ variable rcsid {$Id: dcc.tcl,v 1.19 2003/11/18 02:58:31 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
@@ -115,25 +115,22 @@
# console modes, or nothing if that user isn't currently on the partyline
# Module: core
proc ::tcldrop::dcc::console {idx {channel {}} {modes {}}} {
- if {"$channel$modes" == {}} {
- # Return their current console channel and modes.
- # FixMe: If we don't have any set, then get it from the
userfile.
- # FixMe: Or, if they don't have any console data in the
userfile,
- # set it to sane defaults.
- if {$idx == 0} {
- # Return the default console:
- return [list - $::console - 1 0 0]
- } elseif {![catch { ::tcldrop::idx::GetInfo $idx console }
console]} {
- # Return the currently active console:
- return $console
- } elseif {![catch { getuser [idx2hand $idx] console } console]
&& $console != {}} {
- ::tcldrop::idx::ChInfo $idx [list console $console]
- # Return the console settings from the userfile:
- return $console
- } else {
- # Return the default console:
- return [list - $::console - 1 0 0]
- }
+ if {$idx == 0} {
+ # The default console.
+ set changed 0
+ set console [list - $::console - 1 0 0]
+ } elseif {![catch { ::tcldrop::idx::GetInfo $idx console } console]} {
+ # The current idx's console settings.
+ set changed 0
+ } elseif {![catch { getuser [idx2hand $idx] console } console] &&
$console != {}} {
+ # The console settings from the userfile.
+ set changed 1
+ } elseif {![valididx $idx]} {
+ return -code error {Invalid idx.}
+ } else {
+ # The default console:
+ set changed 1
+ set console [list - $::console - 1 0 0]
}
# Eggdrop treats $channel the same as $modes, and vice versa, so we'll
do the same...
foreach whatever [list $channel $modes] {
@@ -141,12 +138,17 @@
if {[validchan $whatever]} {
# They want to change their IRC console channel.
if {[matchattr [idx2hand $idx] vfomn|vfomn $whatever]} {
- # FixMe: So change it.
+ set changed 1
+ set console [lreplace $console 0 0 $whatever]
}
} else {
- # FixMe: They want to change their modes.
+ set changed 1
+ set console [lreplace $console 1 1
[::tcldrop::MergeFlags $whatever [lindex $console 1]]]
}
}
+ # Set the new console settings to the idx:
+ if {$changed} { ::tcldrop::idx::ChInfo $idx [list console $console] }
+ return $console
}
# echo <idx> [status]
- [Tcldrop/CVS] tcldrop/modules dcc.tcl console/console.tcl,
Philip Moore <=