This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Script to log a channel between comands

Old posts that have not been replied to for several years.
Locked
H
HecKel
Voice
Posts: 23
Joined: Wed Jan 19, 2005 3:50 pm
Location: Lisbon, Portugal

Script to log a channel between comands

Post by HecKel »

I want to star a logfile when I enter

Code: Select all

!starlog <nick>
and stop the loggin when I enter

Code: Select all

!stoplog
The filename must be like this:

Code: Select all

<chan>.<nick>.<dd><mm><yyyy>.log
tnks HecKel
O
Ofloo
Owner
Posts: 953
Joined: Tue May 13, 2003 1:37 am
Location: Belguim
Contact:

Post by Ofloo »

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
 
}
not tested
XplaiN but think of me as stupid
Locked