3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-23 18:54:05 +01:00

Merge branch 'master' into devel

This commit is contained in:
James Lu 2015-08-26 14:59:22 -07:00
commit ab4cb4d895
2 changed files with 12 additions and 12 deletions

View File

@ -407,6 +407,7 @@ def handle_fjoin(irc, servernumeric, command, args):
modeprefix, user = user.split(',', 1) modeprefix, user = user.split(',', 1)
namelist.append(user) namelist.append(user)
irc.users[user].channels.add(channel) irc.users[user].channels.add(channel)
if their_ts <= our_ts:
utils.applyModes(irc, channel, [('+%s' % mode, user) for mode in modeprefix]) utils.applyModes(irc, channel, [('+%s' % mode, user) for mode in modeprefix])
irc.channels[channel].users.add(user) irc.channels[channel].users.add(user)
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts} return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts}
@ -563,21 +564,20 @@ def handle_events(irc, data):
irc.connected.set() irc.connected.set()
try: try:
real_args = [] real_args = []
for arg in args: for idx, arg in enumerate(args):
real_args.append(arg) real_args.append(arg)
# If the argument starts with ':' and ISN'T the first argument. # If the argument starts with ':' and ISN'T the first argument.
# The first argument is used for denoting the source UID/SID. # The first argument is used for denoting the source UID/SID.
if arg.startswith(':') and args.index(arg) != 0: if arg.startswith(':') and idx != 0:
# : is used for multi-word arguments that last until the end # : is used for multi-word arguments that last until the end
# of the message. We can use list splicing here to turn them all # of the message. We can use list splicing here to turn them all
# into one argument. # into one argument.
index = args.index(arg) # Get the array index of the multi-word arg
# Set the last arg to a joined version of the remaining args # Set the last arg to a joined version of the remaining args
arg = args[index:] arg = args[idx:]
arg = ' '.join(arg)[1:] arg = ' '.join(arg)[1:]
# Cut the original argument list right before the multi-word arg, # Cut the original argument list right before the multi-word arg,
# and then append the multi-word arg. # and then append the multi-word arg.
real_args = args[:index] real_args = args[:idx]
real_args.append(arg) real_args.append(arg)
break break
real_args[0] = real_args[0].split(':', 1)[1] real_args[0] = real_args[0].split(':', 1)[1]

View File

@ -422,6 +422,7 @@ def handle_sjoin(irc, servernumeric, command, args):
finalprefix += char finalprefix += char
namelist.append(user) namelist.append(user)
irc.users[user].channels.add(channel) irc.users[user].channels.add(channel)
if their_ts <= our_ts:
utils.applyModes(irc, channel, [('+%s' % mode, user) for mode in finalprefix]) utils.applyModes(irc, channel, [('+%s' % mode, user) for mode in finalprefix])
irc.channels[channel].users.add(user) irc.channels[channel].users.add(user)
return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts} return {'channel': channel, 'users': namelist, 'modes': parsedmodes, 'ts': their_ts}
@ -564,21 +565,20 @@ def handle_events(irc, data):
endburst_timer.start() endburst_timer.start()
try: try:
real_args = [] real_args = []
for arg in args: for idx, arg in enumerate(args):
real_args.append(arg) real_args.append(arg)
# If the argument starts with ':' and ISN'T the first argument. # If the argument starts with ':' and ISN'T the first argument.
# The first argument is used for denoting the source UID/SID. # The first argument is used for denoting the source UID/SID.
if arg.startswith(':') and args.index(arg) != 0: if arg.startswith(':') and idx != 0:
# : is used for multi-word arguments that last until the end # : is used for multi-word arguments that last until the end
# of the message. We can use list splicing here to turn them all # of the message. We can use list splicing here to turn them all
# into one argument. # into one argument.
index = args.index(arg) # Get the array index of the multi-word arg
# Set the last arg to a joined version of the remaining args # Set the last arg to a joined version of the remaining args
arg = args[index:] arg = args[idx:]
arg = ' '.join(arg)[1:] arg = ' '.join(arg)[1:]
# Cut the original argument list right before the multi-word arg, # Cut the original argument list right before the multi-word arg,
# and then append the multi-word arg. # and then append the multi-word arg.
real_args = args[:index] real_args = args[:idx]
real_args.append(arg) real_args.append(arg)
break break
real_args[0] = real_args[0].split(':', 1)[1] real_args[0] = real_args[0].split(':', 1)[1]