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

Make IrcUser.modes a set

This commit is contained in:
James Lu 2015-06-20 20:58:25 -07:00
parent d3257f9314
commit aeb53a14e3
3 changed files with 4 additions and 7 deletions

View File

@ -1,7 +1,7 @@
class IrcUser(): class IrcUser():
def __init__(self, nick, ts, uid, ident='null', host='null', def __init__(self, nick, ts, uid, ident='null', host='null',
realname='PyLink dummy client', realhost='null', realname='PyLink dummy client', realhost='null',
ip='0.0.0.0', modes=[]): ip='0.0.0.0', modes=set()):
self.nick = nick self.nick = nick
self.ts = ts self.ts = ts
self.uid = uid self.uid = uid

View File

@ -127,7 +127,7 @@ def connect(irc):
# :751 UID 751AAAAAA 1220196319 Brain brainwave.brainbox.cc # :751 UID 751AAAAAA 1220196319 Brain brainwave.brainbox.cc
# netadmin.chatspike.net brain 192.168.1.10 1220196324 +Siosw # netadmin.chatspike.net brain 192.168.1.10 1220196324 +Siosw
# +ACKNOQcdfgklnoqtx :Craig Edwards # +ACKNOQcdfgklnoqtx :Craig Edwards
irc.pseudoclient = spawnClient(irc, 'PyLink', 'pylink', host, modes=["+o"]) irc.pseudoclient = spawnClient(irc, 'PyLink', 'pylink', host, modes=set(["+o"]))
f(':%s ENDBURST' % (irc.sid)) f(':%s ENDBURST' % (irc.sid))
for chan in irc.serverdata['channels']: for chan in irc.serverdata['channels']:
joinClient(irc, irc.pseudoclient.uid, chan) joinClient(irc, irc.pseudoclient.uid, chan)

View File

@ -79,13 +79,10 @@ def applyModes(modelist, changedmodes):
for mode in changedmodes: for mode in changedmodes:
if mode[0] == '+': if mode[0] == '+':
# We're adding a mode # We're adding a mode
modelist.append(mode) modelist.add(mode)
else: else:
# We're removing a mode # We're removing a mode
try: modelist.discard(mode)
modelist.remove(mode)
except ValueError:
print('Attempted to remove modes %r not in %s\'s modes' % (mode, numeric))
return modelist return modelist
def joinModes(modes): def joinModes(modes):