mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-23 10:34:19 +01:00
Changed ChannelLogger to only log channels.
This commit is contained in:
parent
4e14a85ea1
commit
662024d63d
@ -35,7 +35,6 @@ Logs each channel to its own individual logfile.
|
|||||||
|
|
||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
import re
|
|
||||||
import time
|
import time
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
|
|
||||||
@ -51,7 +50,6 @@ import ircutils
|
|||||||
###
|
###
|
||||||
class ChannelLogger(irclib.IrcCallback):
|
class ChannelLogger(irclib.IrcCallback):
|
||||||
logs = ircutils.IrcDict()
|
logs = ircutils.IrcDict()
|
||||||
actionre = re.compile('\x01ACTION (.*)\x01')
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.laststate = None
|
self.laststate = None
|
||||||
world.flushers.append(self.flush)
|
world.flushers.append(self.flush)
|
||||||
@ -89,20 +87,21 @@ class ChannelLogger(irclib.IrcCallback):
|
|||||||
def doPrivmsg(self, irc, msg):
|
def doPrivmsg(self, irc, msg):
|
||||||
(recipients, text) = msg.args
|
(recipients, text) = msg.args
|
||||||
for channel in recipients.split(','):
|
for channel in recipients.split(','):
|
||||||
log = self.getLog(channel)
|
if ircutils.isChannel(channel):
|
||||||
self.timestamp(log)
|
log = self.getLog(channel)
|
||||||
m = re.match(self.actionre, text)
|
self.timestamp(log)
|
||||||
if m:
|
if ircmsgs.isAction(msg):
|
||||||
log.write('* %s %s\n' % (msg.nick, m.group(1)))
|
log.write('* %s %s\n' % (msg.nick, ircmsgs.unAction(msg)))
|
||||||
else:
|
else:
|
||||||
log.write('<%s> %s\n' % (msg.nick, text))
|
log.write('<%s> %s\n' % (msg.nick, text))
|
||||||
|
|
||||||
def doNotice(self, irc, msg):
|
def doNotice(self, irc, msg):
|
||||||
(recipients, text) = msg.args
|
(recipients, text) = msg.args
|
||||||
for channel in recipients.split(','):
|
for channel in recipients.split(','):
|
||||||
log = self.getLog(channel)
|
if ircutils.isChannel(channel):
|
||||||
self.timestamp(log)
|
log = self.getLog(channel)
|
||||||
log.write('-%s- %s\n' % (msg.nick, text))
|
self.timestamp(log)
|
||||||
|
log.write('-%s- %s\n' % (msg.nick, text))
|
||||||
|
|
||||||
def doJoin(self, irc, msg):
|
def doJoin(self, irc, msg):
|
||||||
for channel in msg.args[0].split(','):
|
for channel in msg.args[0].split(','):
|
||||||
@ -126,10 +125,12 @@ class ChannelLogger(irclib.IrcCallback):
|
|||||||
|
|
||||||
def doMode(self, irc, msg):
|
def doMode(self, irc, msg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
log = self.getLog(channel)
|
if ircutils.isChannel(channel):
|
||||||
self.timestamp(log)
|
log = self.getLog(channel)
|
||||||
log.write('*** %s sets mode: %s %s\n' % \
|
self.timestamp(log)
|
||||||
(msg.nick or msg.prefix, msg.args[1], ' '.join(msg.args[2:])))
|
log.write('*** %s sets mode: %s %s\n' % \
|
||||||
|
(msg.nick or msg.prefix, msg.args[1],
|
||||||
|
' '.join(msg.args[2:])))
|
||||||
|
|
||||||
def doTopic(self, irc, msg):
|
def doTopic(self, irc, msg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
@ -146,10 +147,8 @@ class ChannelLogger(irclib.IrcCallback):
|
|||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
# Gotta catch my own messages *somehow* :)
|
# Gotta catch my own messages *somehow* :)
|
||||||
# Let's try this little trick...
|
# Let's try this little trick...
|
||||||
if msg.command == 'PRIVMSG' or msg.command == 'NOTICE':
|
m = ircmsgs.IrcMsg(msg=msg, prefix=irc.prefix)
|
||||||
newmsgstr = ':%s!x@y %s %s :%s' % (irc.nick, msg.command,
|
self(irc, m)
|
||||||
msg.args[0], msg.args[1:])
|
|
||||||
self(irc, ircmsgs.IrcMsg(newmsgstr))
|
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user