/[tcldrop]/tcldrop/modules/core.tcl
ViewVC logotype

Diff of /tcldrop/modules/core.tcl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.28 by fireegl, Mon Dec 1 23:23:51 2003 UTC revision 1.29 by fireegl, Tue Dec 2 00:57:51 2003 UTC
# Line 287  proc ::tcldrop::MergeFlags {flags1 flags Line 287  proc ::tcldrop::MergeFlags {flags1 flags
287  proc ::tcldrop::bind {type flags mask proc args} {  proc ::tcldrop::bind {type flags mask proc args} {
288          array set options [list -priority 50 type $type flags $flags mask $mask proc $proc count 0]          array set options [list -priority 50 type $type flags $flags mask $mask proc $proc count 0]
289          catch { array set options $args }          catch { array set options $args }
290          # FixMe: This should check a list of registered bind types before accepting the bind.          # Note/FixMe: Eggdrop checks to make sure $type is a valid bind type before accepting it, but currently I don't see why that's such a great idea.
291          # Note: + or * means "anybody".  And - means "nobody".          # Note: + or * means "anybody".  And - means "nobody".
292          switch -- $flags {          switch -- $flags {
293                  {-} - {+} - {*} - {-|-} - {*|*} { array set options [list flags {+|+}] }                  {-} - {+} - {*} - {-|-} - {*|*} { array set options [list flags {+|+}] }
# Line 298  proc ::tcldrop::bind {type flags mask pr Line 298  proc ::tcldrop::bind {type flags mask pr
298          set mask          set mask
299  }  }
300    
301  # Setup a bind that logs to the "screen":  # Setup a log bind that sends logs to the "screen":
302  # This bind will be unbind'ed later..if and when we no longer have a screen to log to.  # Note: This bind will be unbind'ed later..if/when we no longer have a screen to log to.
303  ::tcldrop::bind log $console * ::tcldrop::Stdout -priority 0  ::tcldrop::bind log $console * ::tcldrop::Stdout -priority 0
304    
305  proc ::tcldrop::unbind {type flags mask proc {priority {*}}} {  proc ::tcldrop::unbind {type flags mask proc {priority {*}}} {
# Line 317  proc ::tcldrop::binds {{typemask {*}} {m Line 317  proc ::tcldrop::binds {{typemask {*}} {m
317          }          }
318          if {[llength $matchbinds] == 0} {          if {[llength $matchbinds] == 0} {
319                  # If none were found by type, we search by mask:                  # If none were found by type, we search by mask:
320                    # FixMe: This is too slow!
321                  foreach b [lsort -dictionary [array names Binds]] {                  foreach b [lsort -dictionary [array names Binds]] {
322                          array set bind $Binds($b)                          array set bind $Binds($b)
323                          if {[string equal -nocase $typemask $bind(mask)]} {                          if {[string equal -nocase $typemask $bind(mask)]} {
# Line 710  if {[catch { restart {start} }]} { Line 711  if {[catch { restart {start} }]} {
711          die "failed to start."          die "failed to start."
712  } else {  } else {
713          callevent init          callevent init
714            # We wanna display how many channels and users there are (like Eggdrop):
715            if {[catch { ::tcldrop::Stdout o - "=== ${::botnet-nick}: [countchannels] channels, [countusers] users." }]} { ::tcldrop::Stdout o - "=== ${::botnet-nick}: [countusers] users." }
716          if {[info exists background-mode] && ${background-mode}} {          if {[info exists background-mode] && ${background-mode}} {
717                  # Disable showing logs to the "screen"...                  # Disable showing logs to the "screen"...
718                  # Because we're supposed to be running in the background.                  # Because we're supposed to be running in the background.
719                  unbind log - * ::tcldrop::Stdout                  unbind log - * ::tcldrop::Stdout
720                    # Note: Eggdrop doesn't close these, but then it may not need to.
721                    #       I think they should be closed though, since there is no "screen" anymore.
722                    catch {
723                            close stderr
724                            close stdout
725                            close stdin
726                    }
727          }          }
         # We wanna display how many channels and users there are (like Eggdrop):  
         if {[catch { ::tcldrop::Stdout o - "=== ${::botnet-nick}: [countchannels] channels, [countusers] users." }]} { ::tcldrop::Stdout o - "=== ${::botnet-nick}: [countusers] users." }  
728  }  }
729    

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26