Code: Select all
!starlog <nick>
Code: Select all
!stoplog
Code: Select all
<chan>.<nick>.<dd><mm><yyyy>.log
Code: Select all
!starlog <nick>
Code: Select all
!stoplog
Code: Select all
<chan>.<nick>.<dd><mm><yyyy>.log
Code: Select all
################################################################################
#
# TCL scripts by Ofloo all rights reserved.
#
# HomePage: http://ofloo.net/
# CVS: http://cvs.ofloo.net/
# Email: support[at]ofloo.net
#
# 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 2
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
################################################################################
namespace eval mrSpy {
proc start_spy_pub {nick host hand chan arg} {
if {[onchan [lindex [split $arg] 0]]} {
if {![validuser [lindex [split $arg] 0]]} {
set i 0
while {1 < 0} {
if {[adduser [lindex [split $arg] 0] [maskhost [getchanhost [lindex [split $arg] 0]]]]} {
chattr [lindex [split $arg] 0] +L
putserv "PRIVMSG $chan :Adding log flag to [lindex [split $arg] 0]."
break
} else {
if {[adduser [lindex [split $arg] 0]$i [maskhost [getchanhost [lindex [split $arg] 0]]]]} {
chattr [lindex [split $arg] 0] +L
putserv "PRIVMSG $chan :Adding log flag to [lindex [split $arg] 0]."
break
}
}
incr i
}
} elseif {[matchattr [lindex [split $arg] 0] L]} {
putserv "PRIVMSG $chan :Sorry [lindex [split $arg] 0] is marked for logging."
} else {
putserv "PRIVMSG $chan :Adding log flag to [lindex [split $arg] 0]."
chattr [lindex [split $arg] 0] +L
}
} else {
putserv "PRIVMSG $chan :[lindex [split $arg] 0] not on any chan."
}
}
proc stop_spy_pub {nick host hand chan arg} {
if {[validuser [lindex [split $arg] 0]]} {
if {[matchattr [lindex [split $arg] 0] L]} {
putserv "PRIVMSG $chan :Removing log flag from [lindex [split $arg] 0]."
chattr [lindex [split $arg] 0] -L
} else {
putserv "PRIVMSG $chan :[lindex [split $arg] 0] does not match the log flag."
}
} else {
putserv "PRIVMSG $chan :[lindex [split $arg] 0] does not match the log flag."
}
}
proc spy_logger_pubm {nick host hand chan arg} {
if {[matchattr $hand L]} {
if {[catch {open logs/[clock format [clock seconds] -format "${chan}\x2e${hand}\x2e%d\x2e%m\x2e%Y\x2elog"] a+} af]} {
puts $af "$arg"
close $af
} else {
putlog "Couldn't open spy file."
}
}
}
bind pub n|n !startlog [namespace current]::start_spy_pub
bind pub n|n !stoplog [namespace current]::stop_spy_pub
bind pubm - * [namespace current]::spy_logger_pubm
}