3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +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(): 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=set()): ip='0.0.0.0'):
self.nick = nick self.nick = nick
self.ts = ts self.ts = ts
self.uid = uid self.uid = uid
@ -18,7 +18,7 @@ class IrcUser():
self.realhost = realhost self.realhost = realhost
self.ip = ip self.ip = ip
self.realname = realname self.realname = realname
self.modes = modes self.modes = set()
self.identified = False self.identified = False
self.channels = set() self.channels = set()

View File

@ -183,7 +183,7 @@ class Irc():
nick = self.botdata.get('nick') or 'PyLink' nick = self.botdata.get('nick') or 'PyLink'
ident = self.botdata.get('ident') or 'pylink' ident = self.botdata.get('ident') or 'pylink'
host = self.serverdata["hostname"] 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']: for chan in self.serverdata['channels']:
self.proto.joinClient(self, self.pseudoclient.uid, chan) 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 realhost = realhost or host
raw_modes = utils.joinModes(modes) raw_modes = utils.joinModes(modes)
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, modes=modes) realhost=realhost, ip=ip)
utils.applyModes(irc, uid, modes)
irc.servers[server].users.append(uid) irc.servers[server].users.append(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,

View File

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