3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-17 23:52:49 +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. # Call the helper function and display its result.
result = SUPPORTED_COMMANDS[ctcp_command](irc, source, ctcp_command, data) result = SUPPORTED_COMMANDS[ctcp_command](irc, source, ctcp_command, data)
if result: if result and source in irc.users:
irc.reply('\x01%s %s\x01' % (ctcp_command, result), # Note, do NOT use irc.reply() in hook handlers because nothing except the
notice=True, private=True, source=target) # 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 return False # Block this message from reaching the general command handler
else: else: