Match historic configuration
This commit is contained in:
parent
72e90b6972
commit
6bef1d8f08
@ -2,6 +2,7 @@
|
||||
# Copyright (c) 2002-2004, Jeremiah Fincher
|
||||
# Copyright (c) 2009-2010, James McCoy
|
||||
# Copyright (c) 2010-2021, Valentin Lorentz
|
||||
# Copyright (c) 2024 Stanislas Daniel Claude Dolcini
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
@ -103,7 +104,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||
|
||||
def getLogName(self, network, channel):
|
||||
if self.registryValue('rotateLogs', channel, network):
|
||||
name = '%s.%s.log' % (channel, self.logNameTimestamp(network, channel))
|
||||
name = '%s-%s-%s.log' % (self.logNameTimestamp(network, channel), network, channel)
|
||||
else:
|
||||
name = '%s.log' % channel
|
||||
return utils.file.sanitizeName(name)
|
||||
@ -161,6 +162,12 @@ class ChannelLogger(callbacks.Plugin):
|
||||
string = string.decode('utf8', 'ignore')
|
||||
log.write(string)
|
||||
|
||||
def timestamp_log(self, log):
|
||||
format = '%H:%M'
|
||||
if format:
|
||||
log.write(time.strftime(format))
|
||||
log.write(' ')
|
||||
|
||||
def normalizeChannel(self, irc, channel):
|
||||
return ircutils.toLower(channel)
|
||||
|
||||
@ -171,7 +178,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||
channel = self.normalizeChannel(irc, channel)
|
||||
log = self.getLog(irc, channel)
|
||||
if self.registryValue('timestamp', channel, irc.network):
|
||||
self.timestamp(log)
|
||||
self.timestamp_log(log)
|
||||
if self.registryValue('stripFormatting', channel, irc.network):
|
||||
s = ircutils.stripFormatting(s)
|
||||
if minisix.PY2:
|
||||
@ -233,31 +240,31 @@ class ChannelLogger(callbacks.Plugin):
|
||||
for channel in msg.tagged('channels'):
|
||||
if self.registryValue('showAway', channel, irc.network):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s is now away: %s\n', msg.nick, away_message)
|
||||
'-!- %s is now away: %s\n', msg.nick, away_message)
|
||||
else:
|
||||
for channel in msg.tagged('channels'):
|
||||
if self.registryValue('showAway', channel, irc.network):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s is back\n', msg.nick)
|
||||
'-!- %s is back\n', msg.nick)
|
||||
|
||||
def doNick(self, irc, msg):
|
||||
oldNick = msg.nick
|
||||
newNick = msg.args[0]
|
||||
for channel in msg.tagged('channels'):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s is now known as %s\n', oldNick, newNick)
|
||||
'-!- %s is now known as %s\n', oldNick, newNick)
|
||||
|
||||
def doInvite(self, irc, msg):
|
||||
(target, channel) = msg.args
|
||||
self.doLog(irc, channel,
|
||||
'*** %s <%s> invited %s to %s\n',
|
||||
'-!- %s <%s> invited %s to %s\n',
|
||||
msg.nick, msg.prefix, target, channel)
|
||||
|
||||
def doJoin(self, irc, msg):
|
||||
for channel in msg.args[0].split(','):
|
||||
if(self.registryValue('showJoinParts', channel, irc.network)):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s <%s> has joined %s\n',
|
||||
'-!- %s [%s] has joined %s\n',
|
||||
msg.nick, msg.prefix, channel)
|
||||
|
||||
def doKick(self, irc, msg):
|
||||
@ -268,11 +275,11 @@ class ChannelLogger(callbacks.Plugin):
|
||||
kickmsg = ''
|
||||
if kickmsg:
|
||||
self.doLog(irc, channel,
|
||||
'*** %s was kicked by %s (%s)\n',
|
||||
'-!- %s was kicked by %s (%s)\n',
|
||||
target, msg.nick, kickmsg)
|
||||
else:
|
||||
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):
|
||||
if len(msg.args) > 1:
|
||||
@ -282,14 +289,14 @@ class ChannelLogger(callbacks.Plugin):
|
||||
for channel in msg.args[0].split(','):
|
||||
if(self.registryValue('showJoinParts', channel, irc.network)):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s <%s> has left %s%s\n',
|
||||
'-!- %s <%s> has left %s%s\n',
|
||||
msg.nick, msg.prefix, channel, reason)
|
||||
|
||||
def doMode(self, irc, msg):
|
||||
channel = msg.args[0]
|
||||
if irc.isChannel(channel) and msg.args[1:]:
|
||||
self.doLog(irc, channel,
|
||||
'*** %s sets mode: %s %s\n',
|
||||
'-!- %s sets mode: %s %s\n',
|
||||
msg.nick or msg.prefix, msg.args[1],
|
||||
' '.join(msg.args[2:]))
|
||||
|
||||
@ -298,7 +305,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||
return # It's an empty TOPIC just to get the current topic.
|
||||
channel = msg.args[0]
|
||||
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):
|
||||
if len(msg.args) == 1:
|
||||
@ -308,7 +315,7 @@ class ChannelLogger(callbacks.Plugin):
|
||||
for channel in msg.tagged('channels'):
|
||||
if(self.registryValue('showJoinParts', channel, irc.network)):
|
||||
self.doLog(irc, channel,
|
||||
'*** %s <%s> has quit IRC%s\n',
|
||||
'-!- %s <%s> has quit IRC%s\n',
|
||||
msg.nick, msg.prefix, reason)
|
||||
|
||||
def outFilter(self, irc, msg):
|
||||
|
Loading…
Reference in New Issue
Block a user