3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-28 05:29:25 +01:00

unreal: fix services login tracking for UnrealIRCd 3.2 + Anope 1.8

More specifically, if the +d argument in SVS2MODE is a non-zero integer, ignore it and use the user's nick as account name instead.

(cherry picked from commit 7dcabf072b)
This commit is contained in:
James Lu 2016-08-08 16:35:10 -07:00
parent 8341667bdd
commit 84daec0f07

View File

@ -386,11 +386,11 @@ class UnrealProtocol(TS6BaseProtocol):
# If +x is not set, update to use the person's real host. # If +x is not set, update to use the person's real host.
self.irc.users[uid].host = realhost self.irc.users[uid].host = realhost
# Set the accountname if present # Set the account name if present: if this is a number, set it to the user nick.
if ('+r', None) in parsedmodes and accountname == '0': if ('+r', None) in parsedmodes and accountname.isdigit():
accountname = nick accountname = nick
if accountname != "0": if not accountname.isdigit():
self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}]) self.irc.callHooks([uid, 'CLIENT_SERVICES_LOGIN', {'text': accountname}])
return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip} return {'uid': uid, 'ts': ts, 'nick': nick, 'realhost': realhost, 'host': host, 'ident': ident, 'ip': ip}
@ -721,16 +721,33 @@ class UnrealProtocol(TS6BaseProtocol):
""" """
Handles SVS2MODE, which sets services login information on the given target. Handles SVS2MODE, which sets services login information on the given target.
""" """
# Once again this syntax is inconsistent and poorly documented. +d sets a
# "services stamp" that some services packages use as an account name field,
# while others simply use for tracking the login time? In a nutshell: check
# for the +d argument: if it's an integer, ignore it and set accountname to
# the user's nick. Otherwise, treat the parameter as a nick.
# Logging in (with account info, atheme): # Logging in (with account info, atheme):
# <- :NickServ SVS2MODE GL +rd GL # <- :NickServ SVS2MODE GL +rd GL
# Logging in (without account info, anope): # Logging in (without account info, anope 2.0?):
# <- :NickServ SVS2MODE 001WCO6YK +r # <- :NickServ SVS2MODE 001WCO6YK +r
# Logging in (without account info, anope 1.8):
# Note: ignore the timestamp.
# <- :services.abc.net SVS2MODE GLolol +rd 1470696723
# Logging out (atheme): # Logging out (atheme):
# <- :NickServ SVS2MODE GL -r+d 0 # <- :NickServ SVS2MODE GL -r+d 0
# Logging in to account from a different nick: # Logging out (anope 1.8):
# <- :services.abc.net SVS2MODE GLolol -r+d 1
# Logging out (anope 2.0):
# <- :NickServ SVS2MODE 009EWLA03 -r
# Logging in to account from a different nick (atheme):
# Note: no +r is being set.
# <- :NickServ SVS2MODE somenick +d GL # <- :NickServ SVS2MODE somenick +d GL
# Logging in to account from a different nick (anope): # Logging in to account from a different nick (anope):
@ -752,6 +769,11 @@ class UnrealProtocol(TS6BaseProtocol):
account = self.irc.getFriendlyName(target) account = self.irc.getFriendlyName(target)
else: else:
return return
else:
if account.isdigit():
# If the +d argument is a number, ignore it and set the account name to the nick.
account = self.irc.getFriendlyName(target)
elif ('-r', None) in parsedmodes: elif ('-r', None) in parsedmodes:
# Umode -r being set. # Umode -r being set.
@ -763,7 +785,7 @@ class UnrealProtocol(TS6BaseProtocol):
elif ('+d', None) in parsedmodes: elif ('+d', None) in parsedmodes:
# Nick identification status wasn't changed, but services account was. # Nick identification status wasn't changed, but services account was.
account = args[2] account = args[2]
if account == '0': # 0 means logout if account == '0': # +d 0 means logout
account = '' account = ''
else: else:
return return