mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Added the network name to the logfile for channels by default.
This commit is contained in:
parent
74f2b75fac
commit
7ef716f406
@ -5,6 +5,9 @@
|
|||||||
* Fixed numerous bugs, high and low, big and small and
|
* Fixed numerous bugs, high and low, big and small and
|
||||||
in-between. Definitely worthy of a release.
|
in-between. Definitely worthy of a release.
|
||||||
|
|
||||||
|
* Added supybot.plugins.ChannelLogger.includeNetworkName, so the
|
||||||
|
logs aren't strangified when relaying between channels.
|
||||||
|
|
||||||
* Added a --capability option to User.list, to allow people to
|
* Added a --capability option to User.list, to allow people to
|
||||||
list all the users possessing a certain capability. The main
|
list all the users possessing a certain capability. The main
|
||||||
reason this was added is so jemfinch can tell who owns which
|
reason this was added is so jemfinch can tell who owns which
|
||||||
|
@ -61,6 +61,12 @@ conf.registerChannelValue(conf.supybot.plugins.ChannelLogger, 'noLogPrefix',
|
|||||||
registry.String('[nolog]', """Determines what string a message should be
|
registry.String('[nolog]', """Determines what string a message should be
|
||||||
prefixed with in order not to be logged. If you don't want any such
|
prefixed with in order not to be logged. If you don't want any such
|
||||||
prefix, just set it to the empty string."""))
|
prefix, just set it to the empty string."""))
|
||||||
|
conf.registerChannelValue(conf.supybot.plugins.ChannelLogger,
|
||||||
|
'includeNetworkName', registry.Boolean(True, """Determines whether the bot
|
||||||
|
will include the name of the network in the filename for channel logs.
|
||||||
|
Since this is a channel-specific value, you can override for any channel.
|
||||||
|
You almost certainly want this to be True if you're relaying in a given
|
||||||
|
channel."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.ChannelLogger, 'rotateLogs',
|
conf.registerChannelValue(conf.supybot.plugins.ChannelLogger, 'rotateLogs',
|
||||||
registry.Boolean(False, """Determines whether the bot will automatically
|
registry.Boolean(False, """Determines whether the bot will automatically
|
||||||
rotate the logs for this channel."""))
|
rotate the logs for this channel."""))
|
||||||
@ -138,7 +144,6 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
del self.logs[channel]
|
del self.logs[channel]
|
||||||
|
|
||||||
def getLog(self, channel):
|
def getLog(self, channel):
|
||||||
channel = ircutils.toLower(channel)
|
|
||||||
self.checkLogNames()
|
self.checkLogNames()
|
||||||
if channel in self.logs:
|
if channel in self.logs:
|
||||||
return self.logs[channel]
|
return self.logs[channel]
|
||||||
@ -159,8 +164,13 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
log.write(time.strftime(format))
|
log.write(time.strftime(format))
|
||||||
log.write(' ')
|
log.write(' ')
|
||||||
|
|
||||||
def doLog(self, channel, s):
|
def normalizeChannel(self, irc, channel):
|
||||||
channel = ircutils.toLower(channel)
|
if self.registryValue('includeNetworkName', channel):
|
||||||
|
channel = '%s@%s' % (channel, irc.network)
|
||||||
|
return ircutils.toLower(channel)
|
||||||
|
|
||||||
|
def doLog(self, irc, channel, s):
|
||||||
|
channel = self.normalizeChannel(irc, channel)
|
||||||
log = self.getLog(channel)
|
log = self.getLog(channel)
|
||||||
if self.registryValue('timestamp', channel):
|
if self.registryValue('timestamp', channel):
|
||||||
self.timestamp(log)
|
self.timestamp(log)
|
||||||
@ -177,20 +187,20 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
if ircutils.isChannel(channel):
|
if ircutils.isChannel(channel):
|
||||||
nick = msg.nick or irc.nick
|
nick = msg.nick or irc.nick
|
||||||
if ircmsgs.isAction(msg):
|
if ircmsgs.isAction(msg):
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'* %s %s\n' % (nick, ircmsgs.unAction(msg)))
|
'* %s %s\n' % (nick, ircmsgs.unAction(msg)))
|
||||||
else:
|
else:
|
||||||
self.doLog(channel, '<%s> %s\n' % (nick, text))
|
self.doLog(irc, channel, '<%s> %s\n' % (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(','):
|
||||||
if ircutils.isChannel(channel):
|
if ircutils.isChannel(channel):
|
||||||
self.doLog(channel, '-%s- %s\n' % (msg.nick, text))
|
self.doLog(irc, channel, '-%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(','):
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'*** %s has joined %s\n' %
|
'*** %s has joined %s\n' %
|
||||||
(msg.nick or msg.prefix, channel))
|
(msg.nick or msg.prefix, channel))
|
||||||
|
|
||||||
@ -201,21 +211,22 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
(channel, target) = msg.args
|
(channel, target) = msg.args
|
||||||
kickmsg = ''
|
kickmsg = ''
|
||||||
if kickmsg:
|
if kickmsg:
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'*** %s was kicked by %s (%s)\n' %
|
'*** %s was kicked by %s (%s)\n' %
|
||||||
(target, msg.nick, kickmsg))
|
(target, msg.nick, kickmsg))
|
||||||
else:
|
else:
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'*** %s was kicked by %s\n' % (target, msg.nick))
|
'*** %s was kicked by %s\n' % (target, msg.nick))
|
||||||
|
|
||||||
def doPart(self, irc, msg):
|
def doPart(self, irc, msg):
|
||||||
for channel in msg.args[0].split(','):
|
for channel in msg.args[0].split(','):
|
||||||
self.doLog(channel, '*** %s has left %s\n' % (msg.nick, channel))
|
self.doLog(irc, channel,
|
||||||
|
'*** %s has left %s\n' % (msg.nick, channel))
|
||||||
|
|
||||||
def doMode(self, irc, msg):
|
def doMode(self, irc, msg):
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
if ircutils.isChannel(channel) and msg.args[1:]:
|
if ircutils.isChannel(channel) and msg.args[1:]:
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'*** %s sets mode: %s %s\n' %
|
'*** %s sets mode: %s %s\n' %
|
||||||
(msg.nick or msg.prefix, msg.args[1],
|
(msg.nick or msg.prefix, msg.args[1],
|
||||||
' '.join(msg.args[2:])))
|
' '.join(msg.args[2:])))
|
||||||
@ -224,13 +235,13 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
if len(msg.args) == 1:
|
if len(msg.args) == 1:
|
||||||
return # It's an empty TOPIC just to get the current topic.
|
return # It's an empty TOPIC just to get the current topic.
|
||||||
channel = msg.args[0]
|
channel = msg.args[0]
|
||||||
self.doLog(channel,
|
self.doLog(irc, channel,
|
||||||
'*** %s changes topic to "%s"\n' % (msg.nick, msg.args[1]))
|
'*** %s changes topic to "%s"\n' % (msg.nick, msg.args[1]))
|
||||||
|
|
||||||
def doQuit(self, irc, msg):
|
def doQuit(self, irc, msg):
|
||||||
for (channel, chan) in self.laststate.channels.iteritems():
|
for (channel, chan) in self.laststate.channels.iteritems():
|
||||||
if msg.nick in chan.users:
|
if msg.nick in chan.users:
|
||||||
self.doLog(channel, '*** %s has quit IRC\n' % msg.nick)
|
self.doLog(irc, channel, '*** %s has quit IRC\n' % msg.nick)
|
||||||
|
|
||||||
def outFilter(self, irc, msg):
|
def outFilter(self, irc, msg):
|
||||||
# Gotta catch my own messages *somehow* :)
|
# Gotta catch my own messages *somehow* :)
|
||||||
|
Loading…
Reference in New Issue
Block a user