diff --git a/classes.py b/classes.py index db623cd..373a992 100644 --- a/classes.py +++ b/classes.py @@ -291,7 +291,7 @@ class IrcServer(): """ def __init__(self, uplink, name, internal=False): self.uplink = uplink - self.users = [] + self.users = set() self.internal = internal self.name = name.lower() def __repr__(self): diff --git a/protocols/inspircd.py b/protocols/inspircd.py index 3e8adf7..09dda1d 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -39,7 +39,7 @@ def spawnClient(irc, nick, ident='null', host='null', realhost=None, modes=set() u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, realhost=realhost, ip=ip) utils.applyModes(irc, uid, modes) - irc.servers[server].users.append(uid) + irc.servers[server].users.add(uid) _send(irc, server, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}" " {ts} {modes} + :{realname}".format(ts=ts, host=host, nick=nick, ident=ident, uid=uid, @@ -136,7 +136,7 @@ def removeClient(irc, numeric): log.debug('Removing client %s from irc.users', numeric) del irc.users[numeric] log.debug('Removing client %s from irc.servers[%s]', numeric, sid) - irc.servers[sid].users.remove(numeric) + irc.servers[sid].users.discard(numeric) def quitClient(irc, numeric, reason): """ @@ -420,7 +420,7 @@ def handle_uid(irc, numeric, command, args): parsedmodes = utils.parseModes(irc, uid, [args[8], args[9]]) log.debug('Applying modes %s for %s', parsedmodes, uid) utils.applyModes(irc, uid, parsedmodes) - irc.servers[numeric].users.append(uid) + irc.servers[numeric].users.add(uid) return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} def handle_quit(irc, numeric, command, args): diff --git a/protocols/ts6.py b/protocols/ts6.py index f0a06f3..94d8e10 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -42,7 +42,7 @@ def spawnClient(irc, nick, ident='null', host='null', realhost=None, modes=set() u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname, realhost=realhost, ip=ip) utils.applyModes(irc, uid, modes) - irc.servers[server].users.append(uid) + irc.servers[server].users.add(uid) _send(irc, server, "EUID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} " "{realhost} * :{realname}".format(ts=ts, host=host, nick=nick, ident=ident, uid=uid, @@ -469,7 +469,7 @@ def handle_euid(irc, numeric, command, args): parsedmodes = utils.parseModes(irc, uid, [modes]) log.debug('Applying modes %s for %s', parsedmodes, uid) utils.applyModes(irc, uid, parsedmodes) - irc.servers[numeric].users.append(uid) + irc.servers[numeric].users.add(uid) return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} def handle_uid(irc, numeric, command, args):