DoctorD90 icon

ErrorReporter.tcl 1.2.0

DoctorD90 | PRO | 05/15/13 09:50:49 AM UTC | 0 ⭐ | 6219 👁️ | Never ⏰ | []
TCL |

3.21 KB

|

None

|

0 👍

/

0 👎

### ErrorReporter.tcl 1.2.0 MDL5RT8X
 
#SUGGESTED
# PBinSrc.tcl fMrtKqyq
# TCLLoader.tcl smApj15u
 
#LICENSE
# Copyright © 2013 Alberto Dietze "DoctorD90"
#
#    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/>.
#
# Full GPLv3 Text: http://www.gnu.org/licenses/gpl.txt
 
#PATERNITY
#Coder: DoctorD90
#Network: irc.OnlineGamesNet.net
#Chan: #eHito
#Mail: [email protected]
#Script's List: www.EggTcl.tk
#
#Thanks to guys on #egghelp on irc.freenode.net
#Special thanks to Thommey and Speechles
 
#PURPOSE
#Get error from irc instead of partyline.
#Settable if reset error after get it.
 
#USAGE
#Use commands that you set in SETTINGS section.
 
#SETTINGS
#Set flag of allowed people to use public setting command.
set errrep(pflags) "n"
#Set flag of allowed people to use query setting command.
set errrep(qflags) "n"
#Set public command to get clear error.
set errrep(pset) ".errcls"
#Set query command to get clear error.
set errrep(qset) ".errcls"
#Set where store log file.
set errrep(dir) "text/"
#Set flag of allowed people to use public commands. 
set errrep(pflagc) "n"
#Set flag of allowed people to use query command.
set errrep(qflagc) "n"
#Set public command to get last error.
set errrep(pcmd) ".err"
#Set query command to get last error.
set errrep(qcmd) ".err"
 
 
### DON'T EDIT ANYTHING BELOW ###
 
if {[file exists " ${::errrep(dir)}err.rep"]} {
  set ::errrep(cls) 1
} else {
  set ::errrep(cls) 0
}
 
bind pub $errrep(pflags) $errrep(pset) pub_errset
proc pub_errset {nick uhost hand chan text} {
  err_set $nick
}
 
bind msg $errrep(qflags) $errrep(qset) msg_errset
proc msg_errset {nick uhost hand text} {
  err_set $nick
}
 
proc err_set {nick} {
  if {[file exists "${::errrep(dir)}err.rep"]} {
    file delete -force "${::errrep(dir)}err.rep"
    set ::errrep(cls) 0
    set msg "Dis"
  } else {
    set fs [open "${::errrep(dir)}err.rep" w]
    close $fs
    set ::errrep(cls) 1
    set msg "En"
  }
  putserv "NOTICE $nick :\002ErrorReporter:\002 Clear ErrorInfo ${msg}abled."
} 
 
bind pub $errrep(pflagc) $errrep(pcmd) pub_errget
proc pub_errget {nick uhost hand chan text} {
  err_get $nick
}
 
bind msg $errrep(qflagc) $errrep(qcmd) msg_errget
proc msg_errget {nick uhost hand text} {
  err_get $nick
}
 
proc err_get {nick} {
  if {![info exists ::errorInfo]} {
    putserv "NOTICE $nick :There is not error, yet."
  } else {
    foreach line [split $::errorInfo \n] {
      putserv "NOTICE $nick :$line"
    }
    putserv "NOTICE $nick :*END*"
    if {$::errrep(cls)} {
      unset ::errorInfo
    }
  }
}
 
###
putlog "ErrorReporter.tcl LOADED"

Comments