Fix smartlog function.

This commit is contained in:
Krytarik Raido 2021-10-10 01:04:04 +02:00
parent 5231ed21a8
commit 051a76fa2e

View File

@ -757,7 +757,7 @@ class Ircd(object):
c.close() c.close()
return b return b
def mark(self, irc, uid, message, prefix, db, logFunction, ct, useSmartLog = False): def mark(self, irc, uid, message, prefix, db, logFunction, ct, useSmartLog=False):
# won't use channel,mode,value, because Item may be removed already # won't use channel,mode,value, because Item may be removed already
if not (prefix and message): if not (prefix and message):
return False return False
@ -777,7 +777,7 @@ class Ircd(object):
if logFunction: if logFunction:
if ct.registryValue('useColorForAnnounces', channel=channel, network=irc.network): if ct.registryValue('useColorForAnnounces', channel=channel, network=irc.network):
if useSmartLog: if useSmartLog:
logFunction(irc, '"%s"' % message) logFunction('"%s"' % message)
else: else:
logFunction(irc, channel, '[%s] [#%s %s %s] marked by %s: %s' % ( logFunction(irc, channel, '[%s] [#%s %s %s] marked by %s: %s' % (
ircutils.bold(channel), ircutils.mircColor(uid, 'yellow', 'black'), ircutils.bold(channel), ircutils.mircColor(uid, 'yellow', 'black'),
@ -785,7 +785,7 @@ class Ircd(object):
ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], message)) ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], message))
else: else:
if useSmartLog: if useSmartLog:
logFunction(irc, channel, '"%s"' % message) logFunction('"%s"' % message)
else: else:
logFunction(irc, channel, '[%s] [#%s +%s %s] marked by %s: %s' % ( logFunction(irc, channel, '[%s] [#%s +%s %s] marked by %s: %s' % (
channel, uid, kind, mask, prefix.split('!')[0], message)) channel, uid, kind, mask, prefix.split('!')[0], message))
@ -869,7 +869,7 @@ class Ircd(object):
b = True b = True
return b return b
def edit(self, irc, channel, mode, value, seconds, prefix, db, scheduleFunction, logFunction, ct, useSmartLog = False): def edit(self, irc, channel, mode, value, seconds, prefix, db, scheduleFunction, logFunction, ct, useSmartLog=False):
# edit eIqb duration # edit eIqb duration
if not (channel and mode and value and prefix): if not (channel and mode and value and prefix):
return False return False
@ -919,7 +919,7 @@ class Ircd(object):
if logFunction: if logFunction:
if ct.registryValue('useColorForAnnounces', channel=channel, network=irc.network): if ct.registryValue('useColorForAnnounces', channel=channel, network=irc.network):
if useSmartLog: if useSmartLog:
logFunction(irc, '[%s] [#%s %s %s] by %s: %s' % ( logFunction('[%s] [#%s %s %s] by %s: %s' % (
ircutils.bold(channel), ircutils.mircColor(str(uid), 'yellow', 'black'), ircutils.bold(channel), ircutils.mircColor(str(uid), 'yellow', 'black'),
ircutils.bold(ircutils.mircColor('+%s' % kind, 'red')), ircutils.bold(ircutils.mircColor('+%s' % kind, 'red')),
ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], reason)) ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], reason))
@ -930,7 +930,7 @@ class Ircd(object):
ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], reason)) ircutils.mircColor(mask, 'light blue'), prefix.split('!')[0], reason))
else: else:
if useSmartLog: if useSmartLog:
logFunction(irc, channel, '[%s] [#%s +%s %s] by %s: %s' % ( logFunction('[%s] [#%s +%s %s] by %s: %s' % (
channel, uid, kind, mask, prefix.split('!')[0], reason)) channel, uid, kind, mask, prefix.split('!')[0], reason))
else: else:
logFunction(irc, channel, '[%s] [#%s +%s %s] edited by %s: %s' % ( logFunction(irc, channel, '[%s] [#%s +%s %s] edited by %s: %s' % (
@ -1624,9 +1624,9 @@ class ChanTracker(callbacks.Plugin, plugins.ChannelDBHandler):
if item: if item:
f = None f = None
mm = [] mm = []
useEAM = self.registryValue( useEAM = self.registryValue('announceInTimeEditAndMark', channel=item.channel, network=irc.network) \
'announceInTimeEditAndMark', channel=item.channel, network=irc.network) and not getDuration(seconds) == -1.0 and reason and len(reason) > 0 and not getDuration(seconds) == -1.0 and reason and len(reason) > 0
def ff(self, m): def ff(m):
mm.append(m) mm.append(m)
if len(mm) == 2: if len(mm) == 2:
lc(irc, item.channel, ' '.join(mm)) lc(irc, item.channel, ' '.join(mm))