Fix for relay whois bug with the reporting of status on channels.

This commit is contained in:
Jeremy Fincher 2003-10-28 14:08:11 +00:00
parent 186239ee84
commit 80deb23897

View File

@ -393,16 +393,33 @@ class Relay(callbacks.Privmsg):
user = d['311'].args[-1] user = d['311'].args[-1]
if '319' in d: if '319' in d:
channels = d['319'].args[-1].split() channels = d['319'].args[-1].split()
for (i, channel) in enumerate(channels): ops = []
channel = channel.replace('@', 'is an op on ') voices = []
channel = channel.replace('%', 'is a halfop on ') normal = []
channel = channel.replace('+', 'is voiced on ') halfops = []
channels[i] = channel for channel in channels:
if channel.startswith('@'):
ops.append(channel[:-1])
elif channel.startswith('%'):
halfops.append(channel[:-1])
elif channel.startswith('+'):
voices.append(channel[:-1])
else:
normal.append(channel)
L = []
if ops:
L.append('is an op on %s' % utils.commaAndify(ops))
if halfops:
L.append('is a halfop on %s' % utils.commaAndify(halfops))
if voices:
L.append('is voiced on %s' % utils.commaAndify(voices))
if L:
L.append('is also on %s' % utils.commaAndify(normal))
else:
L.append('is on %s' % utils.commaAndify(normal))
else: else:
channels = ['isn\'t on any non-secret channels'] L = ['isn\'t on any non-secret channels']
if not channels[0].startswith('is'): channels = utils.commaAndify(L)
channels[0] = 'is on ' + channels[0]
channels = utils.commaAndify(channels)
if '317' in d: if '317' in d:
idle = utils.timeElapsed(d['317'].args[2]) idle = utils.timeElapsed(d['317'].args[2])
signon = time.strftime(conf.humanTimestampFormat, signon = time.strftime(conf.humanTimestampFormat,