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

Fix joinModes, and use it in protocol/inspircd's joinClient

In short, PyLink should be sending FJOINs to channels with the modes that it already has (or what we believe it has). This prevents clearing mode lists when PyLink's channel TS is slightly earlier than the IRCd's.
This commit is contained in:
James Lu 2015-07-06 12:28:10 -07:00
parent 170620c410
commit 74339d1038
2 changed files with 7 additions and 4 deletions

View File

@ -54,8 +54,9 @@ def joinClient(irc, client, channel):
if not utils.isChannel(channel):
raise ValueError('Invalid channel name %r.' % channel)
# One channel per line here!
_sendFromServer(irc, server, "FJOIN {channel} {ts} + :,{uid}".format(
ts=int(time.time()), uid=client, channel=channel))
_sendFromServer(irc, server, "FJOIN {channel} {ts} {modes} :,{uid}".format(
ts=int(time.time()), uid=client, channel=channel,
modes=utils.joinModes(irc.channels[channel].modes)))
irc.channels[channel].users.add(client)
def partClient(irc, client, channel, reason=None):

View File

@ -195,10 +195,12 @@ def joinModes(modes):
args = []
for modepair in modes:
mode, arg = modepair
modelist += mode[1]
modelist += mode
if arg is not None:
args.append(arg)
s = '+%s %s' % (modelist, ' '.join(args))
s = '+%s' % modelist
if args:
s += ' %s' % ' '.join(args)
return s
def isInternalClient(irc, numeric):