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

opercmds: skip verbose formatting of kill reasons for internal targets (#520)

This commit is contained in:
James Lu 2018-06-11 19:05:15 -07:00
parent 5ecbc2750e
commit 7d56b30582

View File

@ -390,10 +390,16 @@ def kill(irc, source, args):
irc.error("Cannot kill the main PyLink client!")
return
irc.kill(sender, targetu, reason)
# Deliver a more complete kill reason if our target is a non-PyLink client.
# We skip this for PyLink clients so that relayed kills don't get
# "Killed (abc (...))" tacked on both here and by the receiving IRCd.
if not irc.is_internal_client(targetu):
reason = "Killed (%s (Requested by %s: %s))" % (
irc.get_friendly_name(sender),
irc.get_friendly_name(source),
reason)
# Format the kill reason properly in hooks.
reason = "Killed (%s (%s))" % (irc.get_friendly_name(sender), reason)
irc.kill(sender, targetu, reason)
irc.reply("Done.")
irc.call_hooks([source, 'OPERCMDS_KILL', {'target': targetu, 'text': reason,