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.
|
||||
"""
|
||||
|
||||
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):
|
||||
"""Handles forced kicks (SAKICK)."""
|
||||
# <- :1MLAAAAAD ENCAP 0AL SAKICK #test 0ALAAAAAB :test
|
||||
|
@ -518,6 +518,7 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
||||
# What we actually want is to format a pretty kill message, in the form
|
||||
# "Killed (killername (reason))".
|
||||
|
||||
if '!' in args[1].split(" ", 1)[0]:
|
||||
try:
|
||||
# Get the nick or server name of the caller.
|
||||
killer = self.get_friendly_name(source)
|
||||
@ -530,6 +531,13 @@ class IRCS2SProtocol(IRCCommonProtocol):
|
||||
reason = ' '.join(args[1].split(" ")[1:])
|
||||
|
||||
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}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user