diff --git a/protocols/inspircd.py b/protocols/inspircd.py index ba02acb..a2e6a19 100644 --- a/protocols/inspircd.py +++ b/protocols/inspircd.py @@ -308,14 +308,6 @@ class InspIRCdProtocol(TS6BaseProtocol): self.call_hooks([self.sid, 'CHGNAME', {'target': target, 'newgecos': text}]) - def ping(self, source=None, target=None): - """Sends a PING to a target server. Periodic PINGs are sent to our uplink - automatically by the Irc() internals; plugins shouldn't have to use this.""" - source = source or self.sid - target = target or self.uplink - if not (target is None or source is None): - self._send_with_prefix(source, 'PING %s %s' % (source, target)) - def numeric(self, source, numeric, target, text): """Sends raw numerics from a server to a remote client.""" # InspIRCd 2.0 syntax (undocumented): diff --git a/protocols/ircs2s_common.py b/protocols/ircs2s_common.py index 0bb8bd3..6667284 100644 --- a/protocols/ircs2s_common.py +++ b/protocols/ircs2s_common.py @@ -256,7 +256,7 @@ class IRCCommonProtocol(IRCNetwork): log.debug('(%s) handle_005: got umode callerid=%r', self.name, self.umodes['callerid']) def _send_with_prefix(self, source, msg, **kwargs): - """Sends a RFC 459-style raw command from the given sender.""" + """Sends a RFC1459-style raw command from the given sender.""" self.send(':%s %s' % (self._expandPUID(source), msg), **kwargs) def _expandPUID(self, uid): @@ -358,6 +358,19 @@ class IRCS2SProtocol(IRCCommonProtocol): self._send_with_prefix(client, msg) self.handle_part(client, 'PART', [channel]) + def ping(self, source=None, target=None): + """Sends a PING to a target server. + + This is mostly used by PyLink internals to check whether the remote link is up.""" + source = source or self.sid + if source is None: # Source hasn't been initialized yet; ignore this command + return + + if target is not None: + self._send_with_prefix(source, 'PING %s %s' % (source, target)) + else: + self._send_with_prefix(source, 'PING %s' % source) + def quit(self, numeric, reason): """Quits a PyLink client.""" if self.is_internal_client(numeric): diff --git a/protocols/ts6.py b/protocols/ts6.py index 5a67e30..10943e0 100644 --- a/protocols/ts6.py +++ b/protocols/ts6.py @@ -242,17 +242,6 @@ class TS6Protocol(TS6BaseProtocol): raise NotImplementedError("Changing field %r of a client is " "unsupported by this protocol." % field) - def ping(self, source=None, target=None): - """Sends a PING to a target server. Periodic PINGs are sent to our uplink - automatically by the Irc() internals; plugins shouldn't have to use this.""" - source = source or self.sid - if source is None: - return - if target is not None: - self._send_with_prefix(source, 'PING %s %s' % (source, target)) - else: - self._send_with_prefix(source, 'PING %s' % source) - ### Core / handlers def post_connect(self):