3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-30 14:49:28 +01:00

Consistently use applyModes in spawnClient, so user modes are stored like ('o', None) instead of ('+o', None)

Drop the 'modes' argument in IrcUser, for this is incorrect.
This commit is contained in:
James Lu 2015-07-22 21:14:22 -07:00
parent 686467ffa6
commit 8a1f965303
4 changed files with 7 additions and 5 deletions

View File

@ -9,7 +9,7 @@ import time
class IrcUser():
def __init__(self, nick, ts, uid, ident='null', host='null',
realname='PyLink dummy client', realhost='null',
ip='0.0.0.0', modes=set()):
ip='0.0.0.0'):
self.nick = nick
self.ts = ts
self.uid = uid
@ -18,7 +18,7 @@ class IrcUser():
self.realhost = realhost
self.ip = ip
self.realname = realname
self.modes = modes
self.modes = set()
self.identified = False
self.channels = set()

View File

@ -183,7 +183,7 @@ class Irc():
nick = self.botdata.get('nick') or 'PyLink'
ident = self.botdata.get('ident') or 'pylink'
host = self.serverdata["hostname"]
self.pseudoclient = self.proto.spawnClient(self, nick, ident, host, modes={("o", None)})
self.pseudoclient = self.proto.spawnClient(self, nick, ident, host, modes={("+o", None)})
for chan in self.serverdata['channels']:
self.proto.joinClient(self, self.pseudoclient.uid, chan)

View File

@ -39,7 +39,8 @@ def spawnClient(irc, nick, ident='null', host='null', realhost=None, modes=set()
realhost = realhost or host
raw_modes = utils.joinModes(modes)
u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, modes=modes)
realhost=realhost, ip=ip)
utils.applyModes(irc, uid, modes)
irc.servers[server].users.append(uid)
_send(irc, server, "UID {uid} {ts} {nick} {realhost} {host} {ident} {ip}"
" {ts} {modes} + :{realname}".format(ts=ts, host=host,

View File

@ -41,7 +41,8 @@ def spawnClient(irc, nick, ident='null', host='null', realhost=None, modes=set()
realhost = realhost or host
raw_modes = utils.joinModes(modes)
u = irc.users[uid] = IrcUser(nick, ts, uid, ident=ident, host=host, realname=realname,
realhost=realhost, ip=ip, modes=modes)
realhost=realhost, ip=ip)
utils.applyModes(irc, uid, modes)
irc.servers[server].users.append(uid)
_send(irc, server, "UID {nick} 1 {ts} {modes} {ident} {host} {ip} {uid} "
":{realname}".format(ts=ts, host=host,