mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-17 14:01:03 +01:00
pr/inspircd: update channel TS when receiving remote FJOIN with lower TS
This commit is contained in:
parent
8bed47e7bb
commit
33d23893f8
@ -1,4 +1,5 @@
|
||||
from collections import defaultdict
|
||||
import time
|
||||
|
||||
class IrcUser():
|
||||
def __init__(self, nick, ts, uid, ident='null', host='null',
|
||||
@ -40,6 +41,7 @@ class IrcChannel():
|
||||
self.users = set()
|
||||
self.modes = set()
|
||||
self.topic = ''
|
||||
self.ts = int(time.time())
|
||||
self.prefixmodes = {'ops': set(), 'halfops': set(), 'voices': set(),
|
||||
'owners': set(), 'admins': set()}
|
||||
|
||||
|
@ -55,7 +55,7 @@ def joinClient(irc, client, channel):
|
||||
raise ValueError('Invalid channel name %r.' % channel)
|
||||
# One channel per line here!
|
||||
_sendFromServer(irc, server, "FJOIN {channel} {ts} {modes} :,{uid}".format(
|
||||
ts=int(time.time()), uid=client, channel=channel,
|
||||
ts=irc.channels[channel].ts, uid=client, channel=channel,
|
||||
modes=utils.joinModes(irc.channels[channel].modes)))
|
||||
irc.channels[channel].users.add(client)
|
||||
|
||||
@ -151,10 +151,7 @@ def handle_privmsg(irc, source, command, args):
|
||||
if args[0] == irc.pseudoclient.uid:
|
||||
cmd_args = args[1].split(' ')
|
||||
cmd = cmd_args[0].lower()
|
||||
try:
|
||||
cmd_args = cmd_args[1:]
|
||||
except IndexError:
|
||||
cmd_args = []
|
||||
cmd_args = cmd_args[1:]
|
||||
try:
|
||||
func = utils.bot_commands[cmd]
|
||||
except KeyError:
|
||||
@ -205,7 +202,13 @@ def handle_fjoin(irc, servernumeric, command, args):
|
||||
channel = args[0].lower()
|
||||
# InspIRCd sends each user's channel data in the form of 'modeprefix(es),UID'
|
||||
userlist = args[-1].split()
|
||||
ts = args[1]
|
||||
our_ts = irc.channels[channel].ts
|
||||
their_ts = int(args[1])
|
||||
if their_ts < our_ts:
|
||||
# Channel timestamp was reset on burst
|
||||
log.debug('(%s) Setting channel TS of %s to %s from %s',
|
||||
irc.name, channel, their_ts, our_ts)
|
||||
irc.channels[channel].ts = their_ts
|
||||
modestring = args[2:-1] or args[2]
|
||||
utils.applyModes(irc, channel, utils.parseModes(irc, channel, modestring))
|
||||
namelist = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user