3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-24 03:29:28 +01:00

relay: store creation TS in DB, showing it in LINKED if exists

Closes #155.
This commit is contained in:
James Lu 2016-01-09 20:30:54 -08:00
parent 925e11d6c4
commit f5a828c4af

View File

@ -1128,7 +1128,8 @@ def create(irc, source, args):
# Create the relay database entry with the (network name, channel name) # Create the relay database entry with the (network name, channel name)
# pair - this is just a dict with various keys. # pair - this is just a dict with various keys.
db[(irc.name, channel)] = {'claim': [irc.name], 'links': set(), 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) log.info('(%s) relay: Channel %s created by %s.', irc.name, channel, creator)
initializeChannel(irc, channel) initializeChannel(irc, channel)
irc.reply('Done.') irc.reply('Done.')
@ -1288,13 +1289,23 @@ def linked(irc, source, args):
irc.msg(source, s) irc.msg(source, s)
if utils.isOper(irc, source): if utils.isOper(irc, source):
s = ''
# If the caller is an oper, we can show the hostmasks of people # If the caller is an oper, we can show the hostmasks of people
# that created all the available channels (Janus does this too!!) # that created all the available channels (Janus does this too!!)
creator = v.get('creator') creator = v.get('creator')
if creator: if creator:
# But only if the value actually exists (old DBs will have it # But only if the value actually exists (old DBs will have it
# missing). # 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 @utils.add_cmd
def linkacl(irc, source, args): def linkacl(irc, source, args):