3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00

hybrid: only call endburst once per connection

Since this is based off TS6, both initial PING and EOB are handled as endburst. However, ENDBURST should only be called once per session, or things are respawned automatically and nick collisions happen.
This commit is contained in:
James Lu 2016-05-14 14:06:14 -07:00
parent 3930891e9f
commit 2864c41d7a

View File

@ -19,11 +19,12 @@ class HybridProtocol(TS6Protocol):
self.casemapping = 'ascii'
self.caps = {}
self.hook_map = {'EOB': 'ENDBURST', 'TBURST': 'TOPIC', 'SJOIN': 'JOIN'}
self.has_eob = False
def connect(self):
"""Initializes a connection to a server."""
ts = self.irc.start_ts
self.has_eob = False
f = self.irc.send
# https://github.com/grawity/irc-docs/blob/master/server/ts6.txt#L80
@ -210,7 +211,10 @@ class HybridProtocol(TS6Protocol):
def handle_eob(self, numeric, command, args):
log.debug('(%s) end of burst received', self.irc.name)
return {}
if not self.has_eob: # Only call ENDBURST hooks if we haven't already.
return {}
self.has_eob = True
def handle_svsmode(self, numeric, command, args):
"""