3
0
mirror of https://github.com/jlu5/PyLink.git synced 2025-01-11 12:42:34 +01:00

protocols: fix ts actually defaulting to None in sjoin()

This commit is contained in:
James Lu 2016-06-25 13:56:24 -07:00
parent 1ce6102ae8
commit fbeb3a3747
5 changed files with 10 additions and 8 deletions

View File

@ -1087,6 +1087,8 @@ class Protocol():
self.irc.applyModes(channel, modes)
our_ts = self.irc.channels[channel].ts
assert type(our_ts) == int, "Wrong type for our_ts (expected int, got %s)" % type(our_ts)
assert type(their_ts) == int, "Wrong type for our_ts (expected int, got %s)" % type(their_ts)
if their_ts < our_ts:
# Their TS is older than ours. We should clear our stored modes for the channel and

View File

@ -106,6 +106,8 @@ class InspIRCdProtocol(TS6BaseProtocol):
# Strip out list-modes, they shouldn't ever be sent in FJOIN (protocol rules).
modes = modes or self.irc.channels[channel].modes
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
banmodes = []
regularmodes = []
@ -148,8 +150,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
self._send(server, "FMODE {channel} {ts} {modes} ".format(
ts=ts, channel=channel, modes=self.irc.joinModes(banmodes)))
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
self.updateTS(channel, ts, changedmodes)
def _operUp(self, target, opertype=None):

View File

@ -475,6 +475,8 @@ class P10Protocol(Protocol):
# <- AB B #test2 1460743539 +l 10 ABAAA:vo :%*!*@bad.host
# <- AB B #test 1460747615 ABAAA:o :% ~ *!*@test.host
modes = modes or self.irc.channels[channel].modes
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
bans = []
exempts = []
@ -560,8 +562,6 @@ class P10Protocol(Protocol):
self.irc.channels[channel].users.update(changedusers)
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
self.updateTS(channel, ts, changedmodes)
def spawnServer(self, name, sid=None, uplink=None, desc=None, endburst_delay=0):

View File

@ -101,6 +101,8 @@ class TS6Protocol(TS6BaseProtocol):
raise LookupError('No such PyLink client exists.')
modes = set(modes or self.irc.channels[channel].modes)
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
# Get all the ban modes in a separate list. These are bursted using a separate BMASK
# command.
@ -151,8 +153,6 @@ class TS6Protocol(TS6BaseProtocol):
self._send(server, "BMASK {ts} {channel} {bmode} :{bans}".format(ts=ts,
channel=channel, bmode=bmode, bans=' '.join(bans)))
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
self.updateTS(channel, ts, changedmodes)
def mode(self, numeric, target, modes, ts=None):

View File

@ -148,6 +148,8 @@ class UnrealProtocol(TS6BaseProtocol):
raise LookupError('No such PyLink server exists.')
changedmodes = set(modes or self.irc.channels[channel].modes)
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
uids = []
namelist = []
@ -184,8 +186,6 @@ class UnrealProtocol(TS6BaseProtocol):
self.irc.channels[channel].users.update(uids)
orig_ts = self.irc.channels[channel].ts
ts = ts or orig_ts
self.updateTS(channel, ts, changedmodes)
def ping(self, source=None, target=None):