tcldrop-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tcldrop/CVS] tcldrop/modules core.tcl users/users.tcl users/...


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules core.tcl users/users.tcl users/...
Date: Thu, 13 Nov 2003 19:08:47 -0500

CVSROOT:        /cvsroot/tcldrop
Module name:    tcldrop
Branch:         
Changes by:     Philip Moore <address@hidden>   03/11/13 19:08:46

Modified files:
        modules        : core.tcl 
        modules/users  : users.tcl users_arraydb.tcl 

Log message:
        Removed encpass from the users module, cuz it didn't belong there.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/core.tcl.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/users/users.tcl.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/users/users_arraydb.tcl.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: tcldrop/modules/core.tcl
diff -u tcldrop/modules/core.tcl:1.14 tcldrop/modules/core.tcl:1.15
--- tcldrop/modules/core.tcl:1.14       Wed Jun  4 17:02:38 2003
+++ tcldrop/modules/core.tcl    Thu Nov 13 19:08:45 2003
@@ -1,6 +1,6 @@
 # core.tcl --
 #
-# $Id: core.tcl,v 1.14 2003/06/04 21:02:38 fireegl Exp $
+# $Id: core.tcl,v 1.15 2003/11/14 00:08:45 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -47,13 +47,13 @@
        # Provide the users module:
        variable version {0.3}
        package provide tcldrop::core $version
-       variable rcsid {$Id: core.tcl,v 1.14 2003/06/04 21:02:38 fireegl Exp $}
+       variable rcsid {$Id: core.tcl,v 1.15 2003/11/14 00:08:45 fireegl Exp $}
        # Initialize variables:
        variable Binds
        variable Timers
        variable TimerIDCount 1
        # Export all the commands that should be available to 3rd-party 
scripters:
-       namespace export bind unbind binds timer utimer killtimer killutimer 
timers utimers maskhost
+       namespace export bind unbind binds timer utimer killtimer killutimer 
timers utimers maskhost isbotnetnick
 }
 
 # Add our modules directory to the package require search path:
@@ -95,6 +95,25 @@
        clock format $time -format $format
 }
 
+# FixMe: This should also support weeks, months, and years..
+proc duration {seconds} { set timeatoms [list]
+       if {[catch {
+               foreach div {86400 3600 60 1} mod {0 24 60 60} name {day hr min 
sec} {
+                       set n [expr {$seconds / $div}]
+                       if {$mod > 0} { set n [expr {$n % $mod}] }
+                       if {$n > 1} {
+                               lappend timeatoms "$n ${name}s"
+                       } elseif {$n == 1} {
+                               lappend timeatoms "$n $name"
+                       }
+               }
+       } err]} {
+               return -code error "duration: $err"
+       } else {
+               join $timeatoms
+       }
+}
+
 proc addlang {language {module {core}}} {
        set ::lang $language
        set retval 0
@@ -182,6 +201,11 @@
 proc puterrlog {text {channel {-}}} { putloglev e $channel $text }
 proc putdebuglog {text {channel {-}}} { putloglev d $channel $text }
 
+proc bgerror {args} {
+puts $args
+puts $::errorInfo
+}
+
 # Flag handling, returns 1 if there's a match, 0 if there's not.
 # $flags2's flags should match at least one of the flags in $flags1:
 proc ::tcldrop::CheckFlags {flags1 flags2} {
@@ -244,7 +268,7 @@
 }
 
 # Setup a bind that logs to the "screen":
-# This bind will be unbind'ed later when if and when we no longer have a 
screen to log to.
+# This bind will be unbind'ed later..if and when we no longer have a screen to 
log to.
 ::tcldrop::bind log $console * ::tcldrop::Stdout 0
 
 proc ::tcldrop::unbind {type flags mask proc {priority {*}}} {
@@ -421,6 +445,7 @@
        return $host
 }
 
+proc ::tcldrop::isbotnetnick {nick} { string equal -nocase $nick 
${::botnet-nick} }
 
 # Import the core tcldrop commands to the global namespace:
 #namespace import -force {::tcldrop::*}
@@ -466,6 +491,10 @@
        }
 }
 
+# FixMe: checkmodule should do the same as loadmodule, except it shouldn't 
complain if the module is already loaded.
+proc checkmodule {module {version {}}} { loadmodule $module $version }
+
+
 proc unloadmodule {module} { set out {}
        # FixMe: create a new bind called "unloadmod" or something,
        #        so that modules can know when they're about to be unloaded.
@@ -506,6 +535,20 @@
        exit 0
 }
 
+# Encrypts $password:
+# Note, most of the comments in this proc are by address@hidden
+proc null_encpass {password} {
+       # FixMe: This should return the password as a crypt.
+       # Well here we have several possible solutions, we can load the base64 
lib, or we can source
+       # the md5.tcl file .... or we have to make a blowfish module ;) --- 
Papillon
+       # With base64 encoding we can decode it later if wanted
+       # set password [::base64::encode -maxlen 53 -wrapchar j $password]
+       # with md5 we can't decode it.. but then again.. anyone else will have 
a hard time decoding it aswell ;)
+       # set password [::md5::hmac $password $password]
+       return $password
+}
+
+
 # Rehash, just like in Eggdrop, it (re)loads the config.
 proc rehash {{type {}}} {
        callevent prerehash
@@ -560,7 +603,9 @@
        # Load the required modules (the order here is important):
        loadmodule users
        loadmodule idx
+       # FixMe: These packages should probably load on demand instead..
        package require ident
+       # package require proxy::https
        loadmodule dcc
        # Rehash, (re)loads the config file (which in turn should load the 
optional modules):
        rehash $type
Index: tcldrop/modules/users/users.tcl
diff -u tcldrop/modules/users/users.tcl:1.11 
tcldrop/modules/users/users.tcl:1.12
--- tcldrop/modules/users/users.tcl:1.11        Mon Nov  3 22:14:36 2003
+++ tcldrop/modules/users/users.tcl     Thu Nov 13 19:08:46 2003
@@ -1,6 +1,6 @@
 # users.tcl --
 #
-# $Id: users.tcl,v 1.11 2003/11/04 03:14:36 fireegl Exp $
+# $Id: users.tcl,v 1.12 2003/11/14 00:08:46 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -55,7 +55,7 @@
        # Provide the users module:
        package provide tcldrop::users $version
        # Export all the commands that should be available to 3rd-party 
scripters:
-       namespace export adduser countusers validuser finduser matchattr 
matchchanattr userlist passwdok getuser setuser getinfo getchaninfo 
getting-users chhandle chattr botattr adduser addbot deluser delhost addchanrec 
delchanrec encpass save backup reload chpass setlaston
+       namespace export adduser countusers validuser finduser matchattr 
matchchanattr userlist passwdok getuser setuser getinfo getchaninfo 
getting-users chhandle chattr botattr adduser addbot deluser delhost addchanrec 
delchanrec save backup reload chpass setlaston
        # Set internal defaults for globals:
        ::tcldrop::SetDefault default-flags {}
        # Set the default user database module:
@@ -433,19 +433,6 @@
                return -code $lev $val
        }
        return -code error {No user database module has been loaded.}
-}
-
-# Encrypts $password:
-# Note, most of the comments in this proc are by address@hidden
-proc ::tcldrop::users::encpass {password} {
-       # FixMe: This should return the password as a crypt.
-       # Well here we have several possible solutions, we can load the base64 
lib, or we can source
-       # the md5.tcl file .... or we have to make a blowfish module ;) --- 
Papillon
-       # With base64 encoding we can decode it later if wanted
-       # set password [::base64::encode -maxlen 53 -wrapchar j $password]
-       # with md5 we can't decode it.. but then again.. anyone else will have 
a hard time decoding it aswell ;)
-       # set password [::md5::hmac $password $password]
-       return $password
 }
 
 # Saves the user database to the hard disk:
Index: tcldrop/modules/users/users_arraydb.tcl
diff -u tcldrop/modules/users/users_arraydb.tcl:1.7 
tcldrop/modules/users/users_arraydb.tcl:1.8
--- tcldrop/modules/users/users_arraydb.tcl:1.7 Mon Jun 30 02:25:05 2003
+++ tcldrop/modules/users/users_arraydb.tcl     Thu Nov 13 19:08:46 2003
@@ -1,6 +1,6 @@
 # users_arraydb.tcl --
 #
-# $Id: users_arraydb.tcl,v 1.7 2003/06/30 06:25:05 fireegl Exp $
+# $Id: users_arraydb.tcl,v 1.8 2003/11/14 00:08:46 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -65,8 +65,8 @@
 
 # Checks $handle for $flags, $channel is optional.
 proc ::tcldrop::users::arraydb::matchattr {handle flags {channel {}}} {
-       switch -- $flags {
-               {+|+} - {*|*} - {+} - {*} {
+       switch -exact -- $flags {
+               {*} - {+} - {*|*} - {+|+} {
                        # * or + means anybody, return 1.
                        return 1
                }
@@ -351,11 +351,12 @@
 proc ::tcldrop::users::arraydb::addbot {handle {address {}} {hostmask {}}} {
        if {![validuser $handle]} {
                setuser $handle
-               setuser $lowerhandle hosts $hostmask
+               setuser $handle hosts $hostmask
                set addr [lindex [split $address :] 0]
-               set botport [lindex [split $address :/] 1
+               set botport [lindex [split $address :/] 1]
                set userport [lindex [split $address /] end]
-               setuser $lowerhandle botaddr [list $addr $botport $userport]
+               chattr $handle +b
+               setuser $handle botaddr [list $addr $botport $userport]
                return 1
        } else {
                return 0
@@ -426,18 +427,6 @@
        }
 }
 
-# Encrypts $password:
-# Note, most of the comments in this proc are by address@hidden
-proc ::tcldrop::users::arraydb::encpass {password} {
-       # FixMe: This should return the password as a crypt.
-       # Well here we have several possible solutions, we can load the base64 
lib, or we can source
-       # the md5.tcl file .... or we have to make a blowfish module ;) --- 
Papillon
-       # With base64 encoding we can decode it later if wanted
-       # set password [::base64::encode -maxlen 53 -wrapchar j $password]
-       # with md5 we can't decode it.. but then again.. anyone else will have 
a hard time decoding it aswell ;)
-       # set password [::md5::hmac $password $password]
-       return $password
-}
 
 # Saves the user database to the hard disk:
 # The default is to write it in the background (nonblocking).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]