tcldrop-commits
[Top][All Lists]
Advanced

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

[Tcldrop/CVS] tcldrop/modules conn.tcl core.tcl irc/irc.tcl


From: Philip Moore
Subject: [Tcldrop/CVS] tcldrop/modules conn.tcl core.tcl irc/irc.tcl
Date: Tue, 25 Nov 2003 19:54:03 -0500

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

Modified files:
        modules        : conn.tcl core.tcl 
        modules/irc    : irc.tcl 

Log message:
        More tweaks and fixes.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/conn.tcl.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/core.tcl.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/tcldrop/tcldrop/modules/irc/irc.tcl.diff?tr1=1.23&tr2=1.24&r1=text&r2=text

Patches:
Index: tcldrop/modules/conn.tcl
diff -u tcldrop/modules/conn.tcl:1.6 tcldrop/modules/conn.tcl:1.7
--- tcldrop/modules/conn.tcl:1.6        Fri Nov 14 10:58:46 2003
+++ tcldrop/modules/conn.tcl    Tue Nov 25 19:54:02 2003
@@ -3,7 +3,7 @@
 #              * The connect and control commands, used for all outgoing 
connections.
 #      Depends: idx.
 #
-# $Id: conn.tcl,v 1.6 2003/11/14 15:58:46 fireegl Exp $
+# $Id: conn.tcl,v 1.7 2003/11/26 00:54:02 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -136,6 +136,7 @@
                        $idxinfo(control) $idx $line
                }
        } else {
+               putloglev d * "net: eof!(read) idx $idx"
                # Send {} to the control proc and kill the sock/idx.
                # Note, A check on valididx (from the control proc) is one way 
to tell wether or not an EOF has actually been received.
                $idxinfo(control) $idx {}
@@ -147,9 +148,10 @@
        foreach {a d} [::tcldrop::idx::Info $idx] { array set idxinfo $d }
        catch { killutimer $idxinfo(connecttimer) }
        catch { fileevent $idxinfo(sock) writable {} }
-       if {[info exists idxinfo(writable)]} {
-               $idxinfo(writable) $idx
-       }
+       if {[info exists idxinfo(writable)]} { $idxinfo(writable) $idx }
 }
 
-proc ::tcldrop::conn::ConnectTimeout {idx} { killidx $idx }
+proc ::tcldrop::conn::ConnectTimeout {idx} {
+       putloglev d * "net: timeout!(connect) idx $idx"
+       killidx $idx
+}
Index: tcldrop/modules/core.tcl
diff -u tcldrop/modules/core.tcl:1.22 tcldrop/modules/core.tcl:1.23
--- tcldrop/modules/core.tcl:1.22       Tue Nov 25 19:05:05 2003
+++ tcldrop/modules/core.tcl    Tue Nov 25 19:54:03 2003
@@ -1,6 +1,6 @@
 # core.tcl --
 #
-# $Id: core.tcl,v 1.22 2003/11/26 00:05:05 fireegl Exp $
+# $Id: core.tcl,v 1.23 2003/11/26 00:54:03 fireegl Exp $
 #
 # Copyright (C) 2003 FireEgl (Philip Moore) <address@hidden>
 #
@@ -47,7 +47,7 @@
        # Provide the users module:
        variable version {0.3}
        package provide tcldrop::core $version
-       variable rcsid {$Id: core.tcl,v 1.22 2003/11/26 00:05:05 fireegl Exp $}
+       variable rcsid {$Id: core.tcl,v 1.23 2003/11/26 00:54:03 fireegl Exp $}
        # Initialize variables:
        variable Binds
        variable Timers
@@ -453,10 +453,6 @@
        }
 }
 
-# Every $hourly-updates we call the "save" event:
-proc ::tcldrop::HourlyUpdates {minute hour day month year} { callevent save }
-bind evnt - loaded {event} { bind time - "${::hourly-updates} * * * *" 
::tcldrop::HourlyUpdates }
-
 #  maskhost <address@hidden>
 #    Returns: masked hostmask for the string given ("address@hidden" -> 
"address@hidden",
 #      "address@hidden" -> "address@hidden", "address@hidden" -> 
"address@hidden")
@@ -534,6 +530,9 @@
 #namespace import -force {::tcldrop::*}
 namespace import {::tcldrop::*}
 
+# Every $hourly-updates we call the "save" event:
+proc ::tcldrop::HourlyUpdates {minute hour day month year} { callevent save }
+
 # The loadmodule and unloadmodule commands MUST be defined here.
 # Because package require loads the packages from the global namespace (I 
think).
 # And because [namespace import] imports into the current namespace.
@@ -677,6 +676,8 @@
        ::tcldrop::SetDefault botnet-nick $::nick
        callevent $type
        callevent loaded
+       bind time - "${::hourly-updates} * * * *" ::tcldrop::HourlyUpdates
+       return $type
 }
 
 bind evnt - init ::tcldrop::MakePIDFile
Index: tcldrop/modules/irc/irc.tcl
diff -u tcldrop/modules/irc/irc.tcl:1.23 tcldrop/modules/irc/irc.tcl:1.24
--- tcldrop/modules/irc/irc.tcl:1.23    Tue Nov 25 16:27:47 2003
+++ tcldrop/modules/irc/irc.tcl Tue Nov 25 19:54:03 2003
@@ -4,7 +4,7 @@
 #              * All IRC related commands.
 #      Depends: core, server, channels.
 #
-# $Id: irc.tcl,v 1.23 2003/11/25 21:27:47 fireegl Exp $
+# $Id: irc.tcl,v 1.24 2003/11/26 00:54:03 fireegl Exp $
 #
 # Copyright (C) 2003 Tcldrop Development Team <Tcldrop-Devel>
 #
@@ -30,7 +30,7 @@
 namespace eval ::tcldrop::irc {
        # Provide the irc module:
        variable version {0.2}
-       variable rcsid {$Id: irc.tcl,v 1.23 2003/11/25 21:27:47 fireegl Exp $}
+       variable rcsid {$Id: irc.tcl,v 1.24 2003/11/26 00:54:03 fireegl Exp $}
        package provide tcldrop::irc $version
        # Initialize variables:
        # Nicks stores the non-channel specific info for each nick:
@@ -155,13 +155,33 @@
                        }
                }
        }
+       if {[set script [channel get $channel "need-$type"]] != {}} {
+               if {[catch { eval $script } err]} {
+                       putlog "Error in $script: $err"
+                       puterrlog "$::errorInfo"
+               }
+       }
 }
 
-# This gets called once a minute and all it does it try to join the channels 
we're not in.
-bind time - {* * * * *} ::tcldrop::irc::CheckNeeds
-# Note: It's called CheckNeeds, because we assume the irc server will tell us 
why we can't join a channel. And therefore we'll have raw binds in place to 
call the need-binds.
-proc ::tcldrop::irc::CheckNeeds {minute hour day month year} {
-       foreach channel [channels] { if {![botonchan $channel]} { puthelp "JOIN 
$channel" } }
+# This gets called once a minute and joins the channels we need in, and parts 
the ones we're not supposed to be in.
+# It also does a [callneed $channel op] if the bot is in a channel but doesn't 
have ops.
+bind time - {* * * * *} ::tcldrop::irc::JoinChannels
+proc ::tcldrop::irc::JoinChannels {args} {
+       foreach channel [channels] {
+               if {[channel get $channel inactive]} {
+                       if {[botonchan $channel]} {
+                               putloglev d $channel "Joined +inactive channel 
$channel ...Leaving!"
+                               lappend partchannels $channel
+                       }
+               } elseif {![botonchan $channel]} {
+                       lappend joinchannels $channel
+               } elseif {![botisop $channel]} {
+                       callneed $channel op
+               }
+               # Note/FixMe: This is where support for need-voice and 
need-halfops would go, if we want that.
+       }
+       if {[info exists joinchannels]} { putserv "JOIN [join $joinchannels ,]" 
}
+       if {[info exists partchannels]} { puthelp "PART [join $partchannels ,]" 
}
 }
 
 # Proc by address@hidden
@@ -268,7 +288,7 @@
        # Find out our own hostname and whatnot:
        putquick "WHOIS $::botnick"
        # Start trying to join the channels:
-       putserv "JOIN [join [channels] ,]"
+       JoinChannels
 }
 
 bind raw - JOIN ::tcldrop::irc::JOIN 99




reply via email to

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