sbnc suspend/unsuspend is not working

Paste Your code(s) here, and state your problem.

sbnc suspend/unsuspend is not working

Postby jonlar » Fri Jan 30, 2009 12:28 pm

Hi there. I got a new sbnc script from WL, but its quit hard to get this guy, maybe he ignores ppl sometimes ;), so i ask u if u could maybe help me out one more time. In this sbnc script, the !suspend - !unsuspend triggers are not working.
I dont get any Errors. Just if i type !sbnc suspend <nick> ?reason? it happens nothing. Same with the unsuspend trigger. absolutly no (re)action.

Code: Select all
#    sBNC.tcl - A control script for the shroudBNC software.
#    Copyright (C) 2007  Alexander 'WindowsLive' B.
#
#    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 3 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.  If not, see http://www.gnu.org/licenses/.
#
###### BUG REPORT ######
##### Please send any bug report to #####
#### alex@alexanderb.info ####
### BUG REPORT ###
#
# Thanks for using!! :)

if {[lindex [bncversion] 0] != "1.2"} {
   putmainlog "(sBNC) Tut mir leid, dieses Script funktioniert nur mit sBNC 1.2!"
   haltoutput
   return 0
}

if {[info exists ::sbnc(global,timer)]} {
   putmainlog "(sBNC) Es läuft ein Timer, der das Script läd. Ich warte."
   return 0
}
# Gibts unseren Bot User überhaupt?
if {![bncvaliduser $::sbnc(global,ctx)]} {
   putmainlog "(sBNC) Hossa, $::sbnc(global,ctx) gibts nicht! Erstelle neuen Benutzer! - Bitte warte 30 Sekunden!!"
   addbncuser $::sbnc(global,ctx) [randstring 11]
   setbncuser $::sbnc(global,ctx) server [lindex $::sbnc(global,server) 0]
   setbncuser $::sbnc(global,ctx) port [lindex $::sbnc(global,server) 1]
   setbncuser $::sbnc(global,ctx) channels $::sbnc(global,home)
   setctx $::sbnc(global,ctx)
   jump
   set ::sbnc(global,timer) [utimer 30 "unset ::sbnc(global,timer) ; source scripts/sbnc.tcl"]
   return 0
}
set oldctx [getctx]
setctx $::sbnc(global,ctx)

# Erstmal überprüfen, ob es das erste mal ist!
proc sbnc:firststart { } {
# Ist der Bot auf einem Server?
   if {[getbncuser $::sbnc(global,ctx) realserver] == ""} {
      putmainlog "(sBNC) Ich bin auf gar keinen Server connected; ich versuchs in 30 Sekunden erneut!"
      setbncuser $::sbnc(global,ctx) server [lindex $::sbnc(global,server) 0]
      setbncuser $::sbnc(global,ctx) port [lindex $::sbnc(global,server) 1]
      jump
      set ::sbnc(global,timer) [utimer 30 "unset ::sbnc(global,timer) ; source scripts/sbnc.tcl"]
      return 0
   }
   if {![botonchan $::sbnc(global,home)]} {
   # Warum ist der Bot nicht im Home chan?!
      channel add $::sbnc(global,home)
      putmainlog "(sBNC) Ich bin gar nicht in $::sbnc(global,home) - Banned? Versuche nochmal zu joinen. - Bitte warte 30 Sekunden!!"
      set ::sbnc(global,timer) [utimer 30 "unset ::sbnc(global,timer) ; source scripts/sbnc.tcl"]
      return 0
   }
   if {[llength [userlist]] <= "0"} {
      putquick "WHO $::sbnc(global,home)"
      # Keine User vorhanden? Das ist ein schlechtes Zeichen ;P
      set added 0
      foreach u [bncuserlist] {
         if {[getbncuser $u admin] && [getbncuser $u realserver] != "" && [string match -nocase *$::sbnc(global,home)* [getbncuser $u channels]] && [onchan [getbncuser $u nick]] && [getchanhost [getbncuser $u nick]] != ""} {
            putmainlog "(sBNC) $u schaut nach einem Admin aus \(Nick: [getbncuser $u nick]\)! Füge $u mit Owner Rechten hinzu. Host: [getchanhost [getbncuser $u nick]]"
            adduser [string range $u 0 8]
            setuser [string range $u 0 8] hosts *![getchanhost [getbncuser $u nick]]
            # Da der User sowieso Admin Rechte hat, kann er auch gleich n bekommen.
            chattr [string range $u 0 8] +nS
            incr added
         }
         # Alle User hinzugefügt.
      }
      if {$added != "0"} {
         putmainlog "(sBNC) Die folgenden User haben nun Admin zugriff:"
         foreach a [userlist] {
            putmainlog "(sBNC) $a - [getuser $a hosts]"
         }
      } else {
         putmainlog "(sBNC) Kein User hinzugefügt, ich probiers später nochmal. Bitte warte 30 Sekunden!!"
         set ::sbnc(global,timer) [utimer 30 "unset ::sbnc(global,timer) ; source scripts/sbnc.tcl"]
         return 0
      }
   }
   setbncuser $::sbnc(global,ctx) tag confed 1
   # Kein Return, da die restlichen Sachen noch geladen werden müssen.
}

if {[getbncuser $::sbnc(global,ctx) tag confed] != "1"} {
   sbnc:firststart
}

# Dies wird ein pub Bind, da wir die Flags später prüfen!!
bind pub -|- $::sbnc(trigger)sbnc sbnc:pub
bind time - "00 00 *" sbnc:dailycheck

# Die Proc
proc sbnc:pub { nick host hand chan arg } {
   if {[matchattr $hand n]} {
      set accesslvl 100
   } elseif {[matchattr $hand S]} {
      set accesslvl 10
   } else {
      return 0
   }

   # sBNC Bug :/
   if {$::lastbind != "$::sbnc(trigger)sbnc"} {
      return "0"
   }

   # Der Switch :)
   switch -- [lindex $arg 0] {
      check {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         foreach x [bncuserlist] {
            setctx $x
            if {[validchan $::sbnc(global,home)] && [botonchan $::sbnc(global,home)]} { continue }
            channel add $::sbnc(global,home)
            putserv "JOIN $::sbnc(global,home)"
         }
         setctx $::sbnc(global,ctx)
         sbncmsg 1 notice $nick "Done. Alle [llength [bncuserlist]] User sollten nun in $::sbnc(global,home) sein."
         return 1
      }
      tcl {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set command [join [lrange [split $arg] 1 end]]
         if {$command == ""} {
            sbncmsg 2 privmsg $chan "Falsche Eingabe. Benutz: $::sbnc(trigger)sbnc tcl command"
            return 0
         }
         catch {eval $command} output
         setctx $::sbnc(global,ctx)
         sbncmsg 2 privmsg $chan "Done. \"$command\" ausgeführt. Ausgabe:"
         sbncmsg 2 privmsg $chan "$output"
      }
      simul {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set user [lindex [split $arg] 1]
         set command [join [lrange [split $arg] 2 end]]
         if {$user == "" || $command == ""} {
            sbncmsg 1 privmsg $chan "Falsche Eingabe. Benutz: $::sbnc(trigger)sbnc simul ident command"
            return
         }
         if {$user == "all"} {
            foreach x [bncuserlist] {
               setctx $x
               catch {eval $command} null
            }
            setctx $::sbnc(global,ctx)
            sbncmsg 1 privmsg $chan "Done. \"$command\" wurde ausgeführt."
            return 1
         }
         if {![bncvaliduser $user]} {
            sbncmsg 1 privmsg $chan "$user gibt es nicht."
            return
         }
         setctx $user
         catch {eval $command} output
         setctx $::sbnc(global,ctx)
         sbncmsg 2 privmsg $chan "Done. \"$command\" wurde von \"$user\" ausgeführt. Output: $output"
         return 1
      }
      add {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         set inhere [lindex [split $arg] 2]
         set realname [lrange [split $arg] 3 end]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Falsche Eingabe. Benutz: $::sbnc(trigger)sbnc add ident ?user? ?realname?"
            return 0
         }
         if {$realname == ""} {
            set realname $::sbnc(global,realname)
         }
         if {$inhere == ""} {
            set inhere $nick
         }
         if {![onchan $inhere $chan]} {
            sbncmsg 1 privmsg $chan "Fehler. $inhere ist nicht in diesem Channel."
            return 0
         }
         if {[bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Fehler. Da ist bereits ein Bouncer mit Ident $ident."
            return 0
         }
         if {[llength [bncuserlist]] == $::sbnc(global,max)} {
            sbncmsg 1 privmsg $chan "Fehler. Es sind bereits $::sbnc(global,max) Bouncer hinzugefügt."
            return 0
         }
         if {[string length $ident] > "9" || ![bncvalidusername $ident]} {
            sbncmsg 1 privmsg $chan "Fehler. Die Ident ist zu lang oder enthält ungültige Zeichen."
            return 0
         }
         set pass [randstring 8]

         addbncuser $ident $pass
         setbncuser $ident tag nick $inhere
         setbncuser $ident tag time [clock seconds]
         setbncuser $ident tag addedby $nick
         setbncuser $ident realname "$realname"
         setbncuser $ident server [lindex $::sbnc(global,server) 0]
         setbncuser $ident port [lindex $::sbnc(global,server) 1]
         setbncuser $ident channels $::sbnc(global,home)

         if {$::sbnc(lock) == "1"} {
            setbncuser $ident tag locksetting [join $::sbnc(locksetting) ,]
         }
         if {$::sbnc(global,ifaceon) == "1"} {
            putquick "PRIVMSG $inhere :Neuer Bouncer hinzugefügt! Powered by $::sbnc(global,home)"
            putquick "PRIVMSG $inhere :Server: $::sbnc(global,sbncip) | Port: $::sbnc(global,sbncport)"
            putquick "PRIVMSG $inhere :User: $ident | Password: $pass"
            putquick "PRIVMSG $inhere :Webinterface: $::sbnc(global,iface)"
            putquick "PRIVMSG $inhere :Wenn Du den BNC nicht mehr willst gib /sbnc delme ein"
         } else {
            putquick "PRIVMSG $inhere :Neuer Bouncer hinzugefügt! | Powered by $::sbnc(global,home)"
            putquick "PRIVMSG $inhere :Server: $::sbnc(global,sbncip) | Port: $::sbnc(global,sbncport)"
            putquick "PRIVMSG $inhere :User: $ident | Password: $pass"
            putquick "PRIVMSG $inhere :Wenn Du den BNC nicht mehr willst gib /sbnc delme ein"
         }
         sbncmsg 1 privmsg $chan "Done. User $ident hinzugefügt | Bouncer [llength [bncuserlist]] / $::sbnc(global,max)"
         return 1
      }
      del {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutze: $::sbnc(trigger)sbnc del ident"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Tut mir Leid, aber $ident kann ich nicht finden!"
            return 0
         }
         if {[getbncuser $ident tag locked] == "1"} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist geschützt und kann nicht gelöscht werden!"
            return 0
         }
         if {[getbncuser $ident admin]} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist admin und kann nicht gelöscht werden!"
            return 0
         }
         if {[string tolower $ident] == [getctx]} {
            sbncmsg 1 privmsg $chan "Mich selbst löschen? Hättest du wohl gerne!"
            return 0
         }
         delbncuser $ident
         sbncmsg 1 privmsg $chan "Done. $ident wurde gelöscht."
         return 1
      }
      suspend {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         set reason [lrange [split $arg] 2 end]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutze: $::sbnc(trigger)sbnc suspend ident ?reason?"
            return 0
         }
         if {$reason == ""} {
            sbncmsg 1 privmsg $chan "Bitte gib einen Grund an!"
         }
         if {![bncvaliduser]} {
            sbncmsg 1 privmsg $chan "Tut mir Leid... $ident ist mir unbekannt."
            return 0
         }
         if {[getbncuser $ident lock]} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist bereits suspendiert."
            return 0
         }
         if {[getbncuser $ident tag locked] == "1"} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist geschützt und kann nicht gelöscht werden!"
            return 0
         }
         if {[getbncuser $ident admin]} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist admin und kann nicht suspendiert werden!"
            return 0
         }
         setbncuser $ident lock 1
         setbncuser $ident suspendreason "$reason"
         setbncuser $ident server ""
         setbncuser $ident tag szeit [clock seconds]
         setbncuser $ident tag suser $nick
         setctx $ident
         bnckill "Suspendiert von einem Admin."
         bncdisconnect "Dieser Bouncer wurde suspendiert."
         setctx $::sbnc(global,ctx)
         sbncmsg 1 privmsg $chan "Done."
         return 1
      }
      unsuspend {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutz: $::sbnc(trigger)sbnc unsuspend ident"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Tut mir Leid... $ident ist mir unbekannt."
            return 0
         }
         if {![getbncuser $ident lock]} {
            sbncmsg 1 privmsg $chan "$ident ist nicht suspendiert."
            return 0
         }
         setbncuser $ident server [lindex $::sbnc(global,irc) 0]
         setbncuser $ident tag suser ""
         setbncuser $ident tag szeit ""
         setbncuser $ident lock 0
         sbncmsg 1 privmsg $chan "Done."
         return 1

      }

      resetpass {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         set user [lindex [split $arg] 2]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutz: $::sbnc(trigger)sbnc resetpass ident ?user?"
            return 0
         }
         if {$user == ""} {
            set user "$nick"
         }
         if {![onchan $user $chan]} {
            sbncmsg 1 privmsg $chan "Fehler. $user ist nicht in $chan"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist mir unbekannt."
            return 0
         }
         if {[getbncuser $ident tag locked] == "1"} {
            sbncmsg 1 privmsg $chan "Fehler. $ident ist geschützt und kann nicht gelöscht werden!"
            return 0
         }
         set temppass [randstring 8]
         addbncuser $ident $temppass
         putserv "PRIVMSG $user :Hallo! Dein Passwort vom Bouncer von $::sbnc(global,home) wurde zurückgesetzt!"
         putserv "PRIVMSG $user :IP: $::sbnc(global,sbncip) Port: $::sbnc(global,sbncport) "
         putserv "PRIVMSG $user :Ident: $ident | Dein neues Passwort lautet: $temppass"
         if {$::sbnc(global,ifaceon) == "1"} {
            putquick "PRIVMSG $user :Webinterface: $::sbnc(global,iface)"
         }
         sbncmsg 1 privmsg $chan "Done. Passwort von $ident geändert. Neues Passwort wurde zu $user gesendet."
         return 1
      }
      global {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set message [lrange [split $arg] 1 end]
         if {$message == ""} {
            sbncmsg 1 privmsg $chan "Du hast deine Nachricht vergessen!"
            return
         }
         foreach user [bncuserlist] { setctx $user; bncnotc "$message" }
         setctx $::sbnc(global,ctx)
         sbncmsg 1 privmsg $chan "Done. [llength [bncuserlist]] User haben diese Nachricht erhalten."
      }
      iface {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         if {$::sbnc(global,ifaceon) == "1"} {
            sbncmsg 1 privmsg $chan "Webinterface: $::sbnc(global,iface)"
         } else {
            sbncmsg 1 privmsg $chan "Zur Zeit ist das Webinterface leider nicht verfügbar."
         }
      }
      stats {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set locked ""
         set connected ""
         set quakenet ""
         set admin ""
         foreach x [bncuserlist] {
            if {[getbncuser $x lock]} { lappend locked $x }
            if {[getbncuser $x client] != ""} { lappend connected $x }
            if {[string match "*quakenet.org" [getbncuser $x realserver]]} { lappend quakenet $x }
            if {[getbncuser $x admin]} { lappend admin $x }
         }
         sbncmsg 1 privmsg $chan "Zur Zeit gibt es [llength [bncuserlist]] Bouncer. Möglich sind $::sbnc(global,max) Bouncer. [expr {$::sbnc(global,max) - [llength [bncuserlist]]}] freie Bouncer."
         if {[llength $locked] < "2" && [llength $locked] > "0"} {
            sbncmsg 1 privmsg $chan "[llength $locked] Bouncer ist suspendiert."
         } else {
            sbncmsg 1 privmsg $chan "[llength $locked] Bouncer sind suspendiert."
         }
         sbncmsg 1 privmsg $chan "[llength $connected] User sind zum Bouncer connected. [llength $quakenet] Bouncer sind zum Quakenet connected."
         if {[llength $admin] < "2"} {
            sbncmsg 1 privmsg $chan "Es gibt [llength $admin] Admin."
         } else {
            sbncmsg 1 privmsg $chan "Es gibt [llength $admin] Admins."
         }
      }
      ulist {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         foreach x [userlist n] {
            lappend owner "\0034$x\003"
         }
         sbncmsg 1 notice $nick "Userlist: $owner [userlist S]"
      }
      version {
         putquick "PRIVMSG $chan :\001ACTION benutzt sBNC-Admin-Control \(deutsch\) von Alexander 'WindowsLive' B. - #BundesTrojaner - Version: $::sbnc(version)"
      }
      admin {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutz: $::sbnc(global,trigger)sbnc admin Ident"
            return
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden!"
            return 0
         }
         if {[setbncuser $ident admin 1]} {
            sbncmsg 1 privmsg $chan "Done. $ident ist nun Admin."
            return
         }
      }
      unadmin {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Fehler. Benutz: $::sbnc(global,trigger)sbnc unadmin Ident"
            return
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden!"
            return 0
         }
         if {[setbncuser $ident admin 0]} {
            sbncmsg 1 privmsg $chan "Done. $ident ist kein Admin mehr.."
            return 0
         }
      }
      list {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         foreach x [bncuserlist] {
            lappend ids $x
         }
         if {![info exists ids]} {
            sbncmsg 1 privmsg $nick "Kein Bouncer geadded."
            return
         }
         while {[llength $ids] > 0} {
            set p [lrange $ids 0 10]
            sbncmsg 1 notice $nick "\002Userlist:\002 [join $p ", "]"
            set ids [lreplace $ids 0 10]
         }

      }
      slist {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         foreach x [bncuserlist] {
            if {[getbncuser $x lock]} {
               lappend ids $x
            }
         }
         if {![info exists ids]} {
            sbncmsg 1 privmsg $nick "Kein Bouncer suspended."
            return
         }
         while {[llength $ids] > 0} {
            set p [lrange $ids 0 10]
            sbncmsg 1 notice  $nick "\002Suspended Userlist:\002 [join $p ", "]"
            set ids [lreplace $ids 0 10]
         }
      }
      adduser {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set unick [lindex [split $arg] 1]
         if {$unick == ""} { sbncmsg 1 notice $nick "Nickname vergessen. Benutz: !sbnc adduser nick \[--owner\]" ; return }
         if {[string length $unick] > "9"} {
            set handle [string range $unick 0 8]
         } else {
            set handle "$unick"
         }
         if {[validuser $handle]} {
            sbncmsg 1 privmsg $chan "$unick ist bereits als $handle geadded."
            return
         }
         adduser $handle *![getchanhost $unick]
         if {[lindex [split $arg] 2] == "--owner"} {
            chattr $handle n
         } else {
            chattr $handle S
         }
         sbncmsg 1 privmsg $chan "Done."
      }
      deluser {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set unick [lindex [split $arg] 1]
         if {$unick == ""} { sbncmsg 1 notice $nick "Nickname vergessen." ; return 0 }
         if {[nick2hand $unick] != "*"} { set unick [nick2hand $unick] }
         if {![validuser $unick]} {
            sbncmsg 1 privmsg $chan "$unick ist mir nicht bekannt."
            return
         }
         deluser $unick
         sbncmsg 1 privmsg $chan "Done."
      }
      lock {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Bitte benutz $::sbnc(global,trigger)sbnc lock ident"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden."
            return 0
         }
         if {[getbncuser $ident tag locked] == "1"} {
            sbncmsg 1 privmsg $chan "$ident ist bereits geschützt."
            return 0
         }
         setbncuser $ident tag locked 1
         sbncmsg 1 privmsg $chan "$ident wurde geschützt."
         return 1
      }
      unlock {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Bitte benutz $::sbnc(global,trigger)sbnc unlock ident"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden."
            return 0
         }
         if {[getbncuser $ident tag locked] == "0"} {
            sbncmsg 1 privmsg $chan "$ident ist nicht geschützt."
            return 0
         }
         setbncuser $ident tag locked 0
         sbncmsg 1 privmsg $chan "$ident ist nicht mehr geschützt."
         return 1
      }
      info {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Bitte benutz $::sbnc(global,trigger)sbnc info ident"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden."
            return 0
         }
         if {[getbncuser $ident admin]} { set admin "ja" } else { set admin "nein" }
         if {[getbncuser $ident lock]} { set suspend "ja" } else { set suspend "nein" }
         set lock ""
         if {[getbncuser $ident tag locked] == "1"} { set lock "| Dieser BNC ist geschützt." }
         sbncmsg 1 privmsg $chan "Infos über: $ident | Erstellt am [ctime [getbncuser $ident tag time]] von [getbncuser $ident tag addedby] | Realnick: [getbncuser $ident tag nick] | Admin: $admin | Suspendiert: $suspend $lock"
         if {[getbncuser $ident lock]} {
            sbncmsg 1 privmsg $chan "Suspendiert von [getbncuser $ident tag suser] am [ctime [getbncuser $ident tag szeit]] | Grund: [getbncuser $ident tag suspendreason]"
         } else {
            if {[getbncuser $ident hasclient]} { set status "online" } else { set status "offline" }
            sbncmsg 1 privmsg $chan "Connected zu [getbncuser $ident realserver] mit dem Nick [getbncuser $ident nick] | Letzter Login: [ctime [getbncuser $ident seen]] | Client ist $status"
         }
      }
      idlers {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set tage [lindex [split $arg] 1]

         if {![isnumber $tage]} {
            sbncmsg 1 privmsg $chan "Fehler. Bitte benutz: !sbnc idlers tage \[--delete\]"
            return 0
         }

         set alt [expr {[unixtime] - [expr {$tage * "86400"}]}]

         foreach xyz [bncuserlist] {
            if {[getbncuser $xyz seen] < $alt} {
               if {[getbncuser $xyz tag locked] != "1" && $xyz != $::sbnc(global,ctx) && ![getbncuser $xyz hasclient] && ![getbncuser $xyz lock]} {
                  lappend idleruser $xyz
               }
            }
         }
         if {![info exists idleruser]} { set idleruser "Keiner." }
         if {[lindex [split $arg] 2] == "--delete"} {
            sbncmsg 1 privmsg $chan "Folgende User waren seit mehr als $tage Tage inaktiv und wurden nun gelöscht:"
         } else {
            sbncmsg 1 privmsg $chan "Folgende User sind seit mehr als $tage Tage inaktiv:"
         }
         sbncmsg 1 privmsg $chan "$idleruser"
         if {$idleruser != "Keiner." && [lindex [split $arg] 2] == "--delete"} {
            foreach x $idleruser {
               if {[getbncuser $x tag locked] != "1" && ![getbncuser $x admin] && $x != $::sbnc(global,ctx)} {
                  delbncuser $x
               }
            }
         }
         return 1
      }
      jump {
         if {$accesslvl < "100" && ![string match -nocase *[lindex $arg 0]* $::sbnc(access,support)]} { sbncmsg 2 notice $nick "Kein Zugriff!" ; return 0 }
         set ident [lindex [split $arg] 1]
         set reason [lrange [split $arg] 2 end]
         if {$ident == ""} {
            sbncmsg 1 privmsg $chan "Bitte benutz $::sbnc(global,trigger)sbnc jump ident reason"
            return 0
         }
         if {![bncvaliduser $ident]} {
            sbncmsg 1 privmsg $chan "Kann $ident nicht finden."
            return 0
         }
         if {$reason == ""} {
            sbncmsg 1 privmsg $chan "Bitte gib einen Grund an!"
            return 0
         }
         setctx $ident
         jump
         putlog "Dein Bouncer wurde gejumpt. Grund: $reason"
         setctx $::sbnc(global,ctx)
         sbncmsg 1 privmsg $chan "Done. $ident jumpte! :P"

      }
      default {
         sbncmsg 1 notice $nick "Befehle: $::sbnc(trigger)sbnc add/del/check/simul/admin/tcl/unadmin/lock/unlock/idlers/info/jump/suspend/unsuspend/resetpass/global/iface/stats/ulist/list/slist/adduser/deluser"
         return 1
      }
   }
}

# sbncmsg
proc sbncmsg { queue typ chan txt } {
   if {$queue != "1" && $queue != "2" && $queue != "3"} {
      set queue 2
   }
   if {$typ != "notice" && $typ != "privmsg"} {
      return "Bitte Typ angeben! \(notice oder privmsg\)"
   }
   set color 1
   if {[validchan $chan] && [string match *c* [getchanmode $chan]]} {
      set color 0
   }
   if {$queue == "1"} {
      if {$color} {
         putquick "$typ $chan :\002\(\002sBNC\002\)\002 $txt"
      } else {
         putquick "$typ $chan :\(sBNC\) [stripcodes bcruag $txt]"
      }
      return 1
   } elseif {$queue == "2"} {
      if {$color} {
         putserv "$typ $chan :\002\(\002sBNC\002\)\002 $txt"
      } else {
         putserv "$typ $chan :\(sBNC\) [stripcodes bcruag $txt]"
      }
      return 1
   } else {
      if {$color} {
         puthelp "$typ $chan :\002\(\002sBNC\002\)\002 $txt"
      } else {
         puthelp "$typ $chan :\(sBNC\) [stripcodes bcruag $txt]"
      }
      return 1
   }
}

if {$::sbnc(doublecheck)} {
   internalbind attach sbnc:clientcheck

   proc sbnc:clientcheck { client } {
      set host [getbncuser $client client]
      foreach u [bncuserlist] {
         if {$u != $client && [getbncuser $u client] == "$host"} {
            putmainlog "\(sBNC\) $u \([getbncuser $u client]\) hat den selben Userhost wie $client \($host\) - Der Client hat warscheinlich 2 Bouncer!!"
         }
      }

   }
}

proc sbnc:dailycheck { minute hour day month year } {
   if {$::sbnc(autodelete) != "1"} { return 0 }
   foreach u [bncuserlist] {
      if {[getbncuser $u seen] == "0" && [getbncuser $u tag locked] != "1" && [expr {[getbncuser $u tag time] + [expr {86400 * $::sbnc(autodelete,days)}]}] < [unixtime] && $u != $::sbnc(global,ctx)} {
         delbncuser $u
         putmainlog "$u wurde gelöscht, da er seit $::sbnc(autodelete,days) Tagen nie eingeloggt hat!"
      }
   }
   return 1
}

if {[getbncuser $::sbnc(global,ctx) realserver] != ""} {
   putmainlog "\002\(\002sBNC\002\)\002 Alles OK! Mein Nick im IRC: $::botnick - Server: $::server - Channels: [channels] - Bind: $::sbnc(trigger)sbnc - Admins: [llength [userlist nS]]"
} else {
   putmainlog "\002\(\002sBNC\002\)\002 Script geladen! Ich bin jedoch mit keinem Server verbunden! Ich versuche nun, dieses Problem zu beheben!"
   sbnc:firststart
}

set ::sbnc(version) "4.0 BETA"
# Wird eigentlich nicht benötigt, schöner ists trotzdem.
setctx $oldctx
# EOF
jonlar
 

Re: sbnc suspend/unsuspend is not working

Postby Lukemob » Tue Nov 09, 2010 1:42 pm

Is $::sbnc(trigger) variable set? And, do you have a proper access to bot? Please try to telnet to your bot and see what happens!
Lukemob
 


Return to TCL Scripting Help

Who is online

Users browsing this forum: No registered users and 0 guests

cron