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

ctcp: don't use irc.reply in hook functions

This is undefined behaviour because nothing in this stack actually updates the 'last caller' variables irc.reply() use.
This commit is contained in:
James Lu 2018-02-24 14:18:32 -05:00
parent 50f8cde694
commit 3c0809dce0

View File

@ -36,9 +36,11 @@ def handle_ctcp(irc, source, command, args):
# Call the helper function and display its result.
result = SUPPORTED_COMMANDS[ctcp_command](irc, source, ctcp_command, data)
if result:
irc.reply('\x01%s %s\x01' % (ctcp_command, result),
notice=True, private=True, source=target)
if result and source in irc.users:
# Note, do NOT use irc.reply() in hook handlers because nothing except the
# command handler system actually updates the last caller.
irc.msg(source, '\x01%s %s\x01' % (ctcp_command, result),
notice=True, private=True, source=target)
return False # Block this message from reaching the general command handler
else: