mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-21 16:00:57 +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
|
from collections import defaultdict
|
||||||
|
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',
|
||||||
@ -40,6 +41,7 @@ class IrcChannel():
|
|||||||
self.users = set()
|
self.users = set()
|
||||||
self.modes = set()
|
self.modes = set()
|
||||||
self.topic = ''
|
self.topic = ''
|
||||||
|
self.ts = int(time.time())
|
||||||
self.prefixmodes = {'ops': set(), 'halfops': set(), 'voices': set(),
|
self.prefixmodes = {'ops': set(), 'halfops': set(), 'voices': set(),
|
||||||
'owners': set(), 'admins': set()}
|
'owners': set(), 'admins': set()}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ def joinClient(irc, client, channel):
|
|||||||
raise ValueError('Invalid channel name %r.' % channel)
|
raise ValueError('Invalid channel name %r.' % channel)
|
||||||
# One channel per line here!
|
# One channel per line here!
|
||||||
_sendFromServer(irc, server, "FJOIN {channel} {ts} {modes} :,{uid}".format(
|
_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)))
|
modes=utils.joinModes(irc.channels[channel].modes)))
|
||||||
irc.channels[channel].users.add(client)
|
irc.channels[channel].users.add(client)
|
||||||
|
|
||||||
@ -151,10 +151,7 @@ def handle_privmsg(irc, source, command, args):
|
|||||||
if args[0] == irc.pseudoclient.uid:
|
if args[0] == irc.pseudoclient.uid:
|
||||||
cmd_args = args[1].split(' ')
|
cmd_args = args[1].split(' ')
|
||||||
cmd = cmd_args[0].lower()
|
cmd = cmd_args[0].lower()
|
||||||
try:
|
|
||||||
cmd_args = cmd_args[1:]
|
cmd_args = cmd_args[1:]
|
||||||
except IndexError:
|
|
||||||
cmd_args = []
|
|
||||||
try:
|
try:
|
||||||
func = utils.bot_commands[cmd]
|
func = utils.bot_commands[cmd]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -205,7 +202,13 @@ def handle_fjoin(irc, servernumeric, command, args):
|
|||||||
channel = args[0].lower()
|
channel = args[0].lower()
|
||||||
# InspIRCd sends each user's channel data in the form of 'modeprefix(es),UID'
|
# InspIRCd sends each user's channel data in the form of 'modeprefix(es),UID'
|
||||||
userlist = args[-1].split()
|
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]
|
modestring = args[2:-1] or args[2]
|
||||||
utils.applyModes(irc, channel, utils.parseModes(irc, channel, modestring))
|
utils.applyModes(irc, channel, utils.parseModes(irc, channel, modestring))
|
||||||
namelist = []
|
namelist = []
|
||||||
|
Loading…
x
Reference in New Issue
Block a user