mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-23 08:50:44 +01:00
IRCS2SProtocol: handle both killpath-based and preformatted kill reasons
Also drop the override in protocols/inspircd, as it is no longer needed.
This commit is contained in:
parent
1e5985b608
commit
56c8b90362
@ -767,19 +767,6 @@ class InspIRCdProtocol(TS6BaseProtocol):
|
|||||||
Stub VERSION handler (does nothing) to override the one in ts6_common.
|
Stub VERSION handler (does nothing) to override the one in ts6_common.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def handle_kill(self, source, command, args):
|
|
||||||
"""Handles incoming KILLs."""
|
|
||||||
killed = args[0]
|
|
||||||
# Depending on whether the IRCd sends explicit QUIT messages for
|
|
||||||
# killed clients, the user may or may not have automatically been
|
|
||||||
# removed from our user list.
|
|
||||||
# If not, we have to assume that KILL = QUIT and remove them
|
|
||||||
# ourselves.
|
|
||||||
data = self.users.get(killed)
|
|
||||||
if data:
|
|
||||||
self._remove_client(killed)
|
|
||||||
return {'target': killed, 'text': args[1], 'userdata': data}
|
|
||||||
|
|
||||||
def handle_sakick(self, source, command, args):
|
def handle_sakick(self, source, command, args):
|
||||||
"""Handles forced kicks (SAKICK)."""
|
"""Handles forced kicks (SAKICK)."""
|
||||||
# <- :1MLAAAAAD ENCAP 0AL SAKICK #test 0ALAAAAAB :test
|
# <- :1MLAAAAAD ENCAP 0AL SAKICK #test 0ALAAAAAB :test
|
||||||
|
@ -518,18 +518,26 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
|||||||
# What we actually want is to format a pretty kill message, in the form
|
# What we actually want is to format a pretty kill message, in the form
|
||||||
# "Killed (killername (reason))".
|
# "Killed (killername (reason))".
|
||||||
|
|
||||||
try:
|
if '!' in args[1].split(" ", 1)[0]:
|
||||||
# Get the nick or server name of the caller.
|
try:
|
||||||
killer = self.get_friendly_name(source)
|
# Get the nick or server name of the caller.
|
||||||
except KeyError:
|
killer = self.get_friendly_name(source)
|
||||||
# Killer was... neither? We must have aliens or something. Fallback
|
except KeyError:
|
||||||
# to the given "UID".
|
# Killer was... neither? We must have aliens or something. Fallback
|
||||||
killer = source
|
# to the given "UID".
|
||||||
|
killer = source
|
||||||
|
|
||||||
# Get the reason, which is enclosed in brackets.
|
# Get the reason, which is enclosed in brackets.
|
||||||
reason = ' '.join(args[1].split(" ")[1:])
|
reason = ' '.join(args[1].split(" ")[1:])
|
||||||
|
|
||||||
killmsg = "Killed (%s %s)" % (killer, reason)
|
killmsg = "Killed (%s %s)" % (killer, reason)
|
||||||
|
else:
|
||||||
|
# We already have a preformatted kill, so just pass it on as is.
|
||||||
|
# InspIRCd:
|
||||||
|
# <- :1MLAAAAA1 KILL 0ALAAAAAC :Killed (GL (test))
|
||||||
|
# ngIRCd:
|
||||||
|
# <- :GL KILL PyLink-devel :KILLed by GL: ?
|
||||||
|
killmsg = args[1]
|
||||||
|
|
||||||
return {'target': killed, 'text': killmsg, 'userdata': data}
|
return {'target': killed, 'text': killmsg, 'userdata': data}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user