3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

relay: hide +s/+p channels in LINKED output (closes #110)

This commit is contained in:
James Lu 2015-09-18 22:05:51 -07:00
parent 4ad94ca4ea
commit 504e2683fb

View File

@ -1148,6 +1148,16 @@ def linked(irc, source, args):
# Sort relay DB by channel name, and then sort. # Sort relay DB by channel name, and then sort.
for k, v in sorted(db.items(), key=lambda channel: channel[0][1]): for k, v in sorted(db.items(), key=lambda channel: channel[0][1]):
s = '\x02%s%s\x02 ' % k s = '\x02%s%s\x02 ' % k
remoteirc = world.networkobjects.get(k[0])
channel = k[1]
if remoteirc and channel in remoteirc.channels:
c = remoteirc.channels[channel]
if ('s', None) in c.modes or ('p', None) in c.modes:
# Only show hidden channels to opers.
if utils.isOper(irc, source):
s += '\x02[secret]\x02 '
else:
continue
if v['links']: if v['links']:
s += ' '.join([''.join(link) for link in v['links']]) s += ' '.join([''.join(link) for link in v['links']])
else: else: