mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-10-31 15:07:25 +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:
		
							parent
							
								
									50f8cde694
								
							
						
					
					
						commit
						3c0809dce0
					
				| @ -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: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 James Lu
						James Lu