3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

Merge branch 'master' into devel

Conflicts:
	plugins/networks.py
This commit is contained in:
James Lu 2016-12-18 00:15:24 -08:00
commit 5f6337a734
7 changed files with 21 additions and 0 deletions

View File

@ -179,6 +179,10 @@ def normalize_host(irc, host):
if irc.protoname not in ('inspircd', 'ts6', 'clientbot', 'nefarious'): if irc.protoname not in ('inspircd', 'ts6', 'clientbot', 'nefarious'):
# UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames # UnrealIRCd and IRCd-Hybrid don't allow slashes in hostnames
host = host.replace('/', '.') host = host.replace('/', '.')
if irc.protoname in ('ts6', 'ratbox'):
# TS6 doesn't allow _ in hosts.
host = host.replace('_', '.')
host = host.replace('\x03', '') # Strip colours host = host.replace('\x03', '') # Strip colours
host = host.replace('\x02', '') # Strip bold host = host.replace('\x02', '') # Strip bold
host = host.replace('\x1f', '') # Strip underline host = host.replace('\x1f', '') # Strip underline

View File

@ -168,6 +168,7 @@ class HybridProtocol(TS6Protocol):
""" """
# <- :0UY UID dan 1 1451041551 +Facdeiklosuw ~ident localhost 127.0.0.1 0UYAAAAAB * :realname # <- :0UY UID dan 1 1451041551 +Facdeiklosuw ~ident localhost 127.0.0.1 0UYAAAAAB * :realname
nick = args[0] nick = args[0]
self.checkCollision(nick)
ts, modes, ident, host, ip, uid, account, realname = args[2:10] ts, modes, ident, host, ip, uid, account, realname = args[2:10]
if account == '*': if account == '*':
account = None account = None

View File

@ -561,6 +561,7 @@ class InspIRCdProtocol(TS6BaseProtocol):
"""Handles incoming UID commands (user introduction).""" """Handles incoming UID commands (user introduction)."""
# :70M UID 70MAAAAAB 1429934638 GL 0::1 hidden-7j810p.9mdf.lrek.0000.0000.IP gl 0::1 1429934638 +Wioswx +ACGKNOQXacfgklnoqvx :realname # :70M UID 70MAAAAAB 1429934638 GL 0::1 hidden-7j810p.9mdf.lrek.0000.0000.IP gl 0::1 1429934638 +Wioswx +ACGKNOQXacfgklnoqvx :realname
uid, ts, nick, realhost, host, ident, ip = args[0:7] uid, ts, nick, realhost, host, ident, ip = args[0:7]
self.checkCollision(nick)
realname = args[-1] realname = args[-1]
self.irc.users[uid] = userobj = IrcUser(nick, ts, uid, numeric, ident, host, realname, realhost, ip) self.irc.users[uid] = userobj = IrcUser(nick, ts, uid, numeric, ident, host, realname, realhost, ip)

View File

@ -7,6 +7,18 @@ from pylinkirc.log import log
class IRCS2SProtocol(Protocol): class IRCS2SProtocol(Protocol):
def checkCollision(self, nick):
"""
Nick collision checker.
"""
uid = self.irc.nickToUid(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.irc.name,
uid, nick)
self.irc.callHooks([self.irc.sid, 'SAVE', {'target': uid}])
def handle_kill(self, source, command, args): def handle_kill(self, source, command, args):
"""Handles incoming KILLs.""" """Handles incoming KILLs."""
killed = args[0] killed = args[0]

View File

@ -827,6 +827,7 @@ class P10Protocol(IRCS2SProtocol):
# <- AB N GL 1 1460673049 ~gl nefarious.midnight.vpn +iw B]AAAB ABAAA :realname # <- AB N GL 1 1460673049 ~gl nefarious.midnight.vpn +iw B]AAAB ABAAA :realname
nick = args[0] nick = args[0]
self.checkCollision(nick)
ts, ident, host = args[2:5] ts, ident, host = args[2:5]
realhost = host realhost = host
ip = args[-3] ip = args[-3]

View File

@ -499,6 +499,7 @@ class TS6Protocol(TS6BaseProtocol):
"""Handles incoming EUID commands (user introduction).""" """Handles incoming EUID commands (user introduction)."""
# <- :42X EUID GL 1 1437505322 +ailoswz ~gl 127.0.0.1 127.0.0.1 42XAAAAAB * * :realname # <- :42X EUID GL 1 1437505322 +ailoswz ~gl 127.0.0.1 127.0.0.1 42XAAAAAB * * :realname
nick = args[0] nick = args[0]
self.checkCollision(nick)
ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11] ts, modes, ident, host, ip, uid, realhost, accountname, realname = args[2:11]
if realhost == '*': if realhost == '*':
realhost = None realhost = None

View File

@ -336,6 +336,7 @@ class UnrealProtocol(TS6BaseProtocol):
# arguments: nick, hopcount?, ts, ident, real-host, UID, services account (0 if none), modes, # arguments: nick, hopcount?, ts, ident, real-host, UID, services account (0 if none), modes,
# displayed host, cloaked (+x) host, base64-encoded IP, and realname # displayed host, cloaked (+x) host, base64-encoded IP, and realname
nick = args[0] nick = args[0]
self.checkCollision(nick)
ts, ident, realhost, uid, accountname, modestring, host = args[2:9] ts, ident, realhost, uid, accountname, modestring, host = args[2:9]
if host == '*': if host == '*':