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

Move _check_nick_collision to NetworkCoreWithUtils

This is useful for networks that emulate IRC as well, to prevent clashes between real clients and virtual ones.
This commit is contained in:
James Lu 2017-07-31 20:58:02 +08:00
parent 47f3977554
commit 981e6c508f
2 changed files with 12 additions and 12 deletions

View File

@ -1077,6 +1077,18 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
_clear() _clear()
_apply() _apply()
def _check_nick_collision(self, nick):
"""
Nick collision checker.
"""
uid = self.nick_to_uid(nick)
# If there is a nick collision, we simply alert plugins. Relay will purposely try to
# lose fights and tag nicks instead, while other plugins can choose how to handle this.
if uid:
log.info('(%s) Nick collision on %s/%s, forwarding this to plugins', self.name,
uid, nick)
self.call_hooks([self.sid, 'SAVE', {'target': uid}])
class IRCNetwork(PyLinkNetworkCoreWithUtils): class IRCNetwork(PyLinkNetworkCoreWithUtils):
S2S_BUFSIZE = 510 S2S_BUFSIZE = 510

View File

@ -459,18 +459,6 @@ class IRCS2SProtocol(IRCCommonProtocol):
self.channels[target].topicset = True self.channels[target].topicset = True
topic_burst = topic topic_burst = topic
def _check_nick_collision(self, nick):
"""
Nick collision checker.
"""
uid = self.nick_to_uid(nick)
# If there is a nick collision, we simply alert plugins. Relay will purposely try to
# lose fights and tag nicks instead, while other plugins can choose how to handle this.
if uid:
log.info('(%s) Nick collision on %s/%s, forwarding this to plugins', self.name,
uid, nick)
self.call_hooks([self.sid, 'SAVE', {'target': uid}])
def handle_away(self, numeric, command, args): def handle_away(self, numeric, command, args):
"""Handles incoming AWAY messages.""" """Handles incoming AWAY messages."""
# TS6: # TS6: