mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
classes: IrcServer.users is now a set()
This commit is contained in:
parent
adb9ef13a6
commit
549a1d1ba4
@ -291,7 +291,7 @@ class IrcServer():
|
|||||||
"""
|
"""
|
||||||
def __init__(self, uplink, name, internal=False):
|
def __init__(self, uplink, name, internal=False):
|
||||||
self.uplink = uplink
|
self.uplink = uplink
|
||||||
self.users = []
|
self.users = set()
|
||||||
self.internal = internal
|
self.internal = internal
|
||||||
self.name = name.lower()
|
self.name = name.lower()
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
@ -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,
|
u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname,
|
||||||
realhost=realhost, ip=ip)
|
realhost=realhost, ip=ip)
|
||||||
utils.applyModes(irc, uid, modes)
|
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}"
|
_send(irc, server, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}"
|
||||||
" {ts} {modes} + :{realname}".format(ts=ts, host=host,
|
" {ts} {modes} + :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
@ -136,7 +136,7 @@ def removeClient(irc, numeric):
|
|||||||
log.debug('Removing client %s from irc.users', numeric)
|
log.debug('Removing client %s from irc.users', numeric)
|
||||||
del irc.users[numeric]
|
del irc.users[numeric]
|
||||||
log.debug('Removing client %s from irc.servers[%s]', numeric, sid)
|
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):
|
def quitClient(irc, numeric, reason):
|
||||||
"""<irc object> <client numeric>
|
"""<irc object> <client numeric>
|
||||||
@ -420,7 +420,7 @@ def handle_uid(irc, numeric, command, args):
|
|||||||
parsedmodes = utils.parseModes(irc, uid, [args[8], args[9]])
|
parsedmodes = utils.parseModes(irc, uid, [args[8], args[9]])
|
||||||
log.debug('Applying modes %s for %s', parsedmodes, uid)
|
log.debug('Applying modes %s for %s', parsedmodes, uid)
|
||||||
utils.applyModes(irc, uid, parsedmodes)
|
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}
|
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
|
||||||
|
|
||||||
def handle_quit(irc, numeric, command, args):
|
def handle_quit(irc, numeric, command, args):
|
||||||
|
@ -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,
|
u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname,
|
||||||
realhost=realhost, ip=ip)
|
realhost=realhost, ip=ip)
|
||||||
utils.applyModes(irc, uid, modes)
|
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} "
|
_send(irc, server, "EUID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} "
|
||||||
"{realhost} * :{realname}".format(ts=ts, host=host,
|
"{realhost} * :{realname}".format(ts=ts, host=host,
|
||||||
nick=nick, ident=ident, uid=uid,
|
nick=nick, ident=ident, uid=uid,
|
||||||
@ -469,7 +469,7 @@ def handle_euid(irc, numeric, command, args):
|
|||||||
parsedmodes = utils.parseModes(irc, uid, [modes])
|
parsedmodes = utils.parseModes(irc, uid, [modes])
|
||||||
log.debug('Applying modes %s for %s', parsedmodes, uid)
|
log.debug('Applying modes %s for %s', parsedmodes, uid)
|
||||||
utils.applyModes(irc, uid, parsedmodes)
|
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}
|
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
|
||||||
|
|
||||||
def handle_uid(irc, numeric, command, args):
|
def handle_uid(irc, numeric, command, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user