3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

protocols: move setting irc.connected to endburst

This commit is contained in:
James Lu 2017-08-30 19:39:57 -07:00
parent cad55097f1
commit 8170e777e8
6 changed files with 15 additions and 14 deletions

View File

@ -633,10 +633,9 @@ class ClientbotWrapperProtocol(IRCCommonProtocol):
self.send(line)
# Virtual endburst hook.
self.connected.set() # Note, this should always be set before sending ENDBURST
if not self.has_eob:
self.has_eob = True
return {'parse_as': 'ENDBURST'}
self.connected.set() # Note, this should always be set before the actual ENDBURST hook
self.servers[self.uplink].has_eob = True
return {'parse_as': 'ENDBURST'}
handle_422 = handle_376

View File

@ -230,6 +230,9 @@ class HybridProtocol(TS6Protocol):
if not self.servers[numeric].has_eob:
# Don't fight with TS6's generic PING-as-EOB
self.servers[numeric].has_eob = True
if numeric == self.uplink:
self.connected.set()
return {}
def handle_svsmode(self, numeric, command, args):

View File

@ -520,9 +520,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
log.debug('(%s) self.prefixmodes set to %r', self.name,
self.prefixmodes)
# Finally, set the irc.connected (protocol negotiation complete)
# state to True.
self.connected.set()
elif args[0] == 'MODSUPPORT':
# <- CAPAB MODSUPPORT :m_alltime.so m_check.so m_chghost.so m_chgident.so m_chgname.so m_fullversion.so m_gecosban.so m_knock.so m_muteban.so m_nicklock.so m_nopartmsg.so m_opmoderated.so m_sajoin.so m_sanick.so m_sapart.so m_serverban.so m_services_account.so m_showwhois.so m_silence.so m_swhois.so m_uninvite.so m_watch.so
self.modsupport = args[-1].split()
@ -717,6 +714,8 @@ class InspIRCdProtocol(TS6BaseProtocol):
def handle_endburst(self, numeric, command, args):
"""ENDBURST handler; sends a hook with empty contents."""
self.servers[numeric].has_eob = True
if numeric == self.uplink:
self.connected.set()
return {}
def handle_away(self, numeric, command, args):

View File

@ -824,7 +824,6 @@ class P10Protocol(IRCS2SProtocol):
self.send('SERVER %s 1 %s %s J10 %s]]] +s6 :%s' % (name, ts, ts, sid, desc))
self._send_with_prefix(sid, "EB")
self.connected.set()
def handle_server(self, source, command, args):
"""Handles incoming server introductions."""
@ -1119,6 +1118,7 @@ class P10Protocol(IRCS2SProtocol):
# and needed if we want to be able to receive channel messages, etc.
if source == self.uplink:
self._send_with_prefix(self.sid, 'EA')
self.connected.set()
self.servers[source].has_eob = True
return {}

View File

@ -419,9 +419,6 @@ class TS6Protocol(TS6BaseProtocol):
if 'SERVICES' in caps:
self.cmodes['regonly'] = 'r'
log.debug('(%s) self.connected set!', self.name)
self.connected.set()
def handle_ping(self, source, command, args):
"""Handles incoming PING commands."""
# PING:
@ -446,6 +443,10 @@ class TS6Protocol(TS6BaseProtocol):
# https://github.com/charybdis-ircd/charybdis/blob/dc336d1/modules/core/m_server.c#L484-L485
self.servers[source].has_eob = True
if source == self.uplink:
log.debug('(%s) self.connected set!', self.name)
self.connected.set()
# Return the endburst hook.
return {'parse_as': 'ENDBURST'}

View File

@ -380,6 +380,8 @@ class UnrealProtocol(TS6BaseProtocol):
def handle_eos(self, numeric, command, args):
"""EOS is used to denote end of burst."""
self.servers[numeric].has_eob = True
if numeric == self.uplink:
self.connected.set()
return {}
def handle_uid(self, numeric, command, args):
@ -483,9 +485,6 @@ class UnrealProtocol(TS6BaseProtocol):
"(Unreal 4.x), got %s)" % (self.min_proto_ver, protover))
self.servers[numeric] = Server(self, None, sname, desc=sdesc)
# Set irc.connected to True, meaning that protocol negotiation passed.
log.debug('(%s) self.connected set!', self.name)
self.connected.set()
else:
# Legacy (non-SID) servers can still be introduced using the SERVER command.
# <- :services.int SERVER a.bc 2 :(H) [GL] a