From f16edf6efc6cbbd8b98134f02667bbed539d68b0 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 28 Nov 2015 21:18:30 -0800 Subject: [PATCH] relay: log (de)linked, created, and destroyed channels to INFO Closes #125. --- plugins/relay.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 68a9199..1439cb5 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -1117,11 +1117,12 @@ def create(irc, source, args): irc.reply('Error: Channel %r is already part of a relay.' % channel) return + creator = utils.getHostmask(irc, source) # Create the relay database entry with the (network name, channel name) # pair - this is just a dict with various keys. db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(), - 'blocked_nets': set(), - 'creator': utils.getHostmask(irc, source)} + 'blocked_nets': set(), 'creator': creator} + log.info('(%s) relay: Channel %s created by %s.', irc.name, channel, creator) initializeChannel(irc, channel) irc.reply('Done.') @@ -1147,6 +1148,8 @@ def destroy(irc, source, args): removeChannel(irc, channel) del db[entry] irc.reply('Done.') + log.info('(%s) relay: Channel %s destroyed by %s.', irc.name, + channel, utils.getHostmask(irc, source)) else: irc.reply('Error: No such relay %r exists.' % channel) return @@ -1193,11 +1196,12 @@ def link(irc, source, args): return for link in entry['links']: if link[0] == irc.name: - irc.reply("Error: Remote channel '%s%s' is already" - " linked here as %r." % (remotenet, - channel, link[1])) + irc.reply("Error: Remote channel '%s%s' is already linked here " + "as %r." % (remotenet, channel, link[1])) return entry['links'].add((irc.name, localchan)) + log.info('(%s) relay: Channel %s linked to %s%s by %s.', irc.name, + localchan, remotenet, channel, utils.getHostmask(irc, source)) initializeChannel(irc, localchan) irc.reply('Done.') @@ -1238,6 +1242,8 @@ def delink(irc, source, args): removeChannel(irc, channel) db[entry]['links'].remove((irc.name, channel)) irc.reply('Done.') + log.info('(%s) relay: Channel %s delinked from %s%s by %s.', irc.name, + channel, entry[0], entry[1], utils.getHostmask(irc, source)) else: irc.reply('Error: No such relay %r.' % channel)