From f5a828c4af29c17feba8d209ef13b64d57cfe469 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 9 Jan 2016 20:30:54 -0800 Subject: [PATCH] relay: store creation TS in DB, showing it in LINKED if exists Closes #155. --- plugins/relay.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/relay.py b/plugins/relay.py index 43b78cf..b151c23 100644 --- a/plugins/relay.py +++ b/plugins/relay.py @@ -1128,7 +1128,8 @@ def create(irc, source, args): # 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': creator} + 'blocked_nets': set(), 'creator': creator, + 'ts': time.time()} log.info('(%s) relay: Channel %s created by %s.', irc.name, channel, creator) initializeChannel(irc, channel) irc.reply('Done.') @@ -1288,13 +1289,23 @@ def linked(irc, source, args): irc.msg(source, s) if utils.isOper(irc, source): + s = '' + # If the caller is an oper, we can show the hostmasks of people # that created all the available channels (Janus does this too!!) creator = v.get('creator') if creator: # But only if the value actually exists (old DBs will have it # missing). - irc.msg(source, ' Channel created by \x02%s\x02.' % creator) + s += ' by \x02%s\x02' % creator + + # Ditto for creation date + ts = v.get('ts') + if ts: + s += ' on %s' % time.ctime(ts) + + if s: + irc.msg(source, ' Channel created%s.' % s) @utils.add_cmd def linkacl(irc, source, args):