Don't return 1 on error, but None. 1 could also be a message ID.

This commit is contained in:
js 2008-06-08 16:54:59 +00:00
parent 593ed0c6d8
commit d0b15bf5fd

View file

@ -619,7 +619,7 @@ class ChatControlBase(MessageControl):
'''Send the given message to the active tab. Doesn't return None if error '''Send the given message to the active tab. Doesn't return None if error
''' '''
if not message or message == '\n': if not message or message == '\n':
return 1 return None
ret = None ret = None
@ -1453,7 +1453,7 @@ class ChatControl(ChatControlBase):
def send_message(self, message, keyID = '', chatstate = None): def send_message(self, message, keyID = '', chatstate = None):
'''Send a message to contact''' '''Send a message to contact'''
if message in ('', None, '\n') or self._process_command(message): if message in ('', None, '\n') or self._process_command(message):
return return None
# Do we need to process command for the message ? # Do we need to process command for the message ?
process_command = True process_command = True
@ -1504,12 +1504,12 @@ class ChatControl(ChatControlBase):
gobject.source_remove(self.possible_inactive_timeout_id) gobject.source_remove(self.possible_inactive_timeout_id)
self._schedule_activity_timers() self._schedule_activity_timers()
ChatControlBase.send_message(self, message, keyID, if ChatControlBase.send_message(self, message, keyID,
type = 'chat', chatstate = chatstate_to_send, type = 'chat', chatstate = chatstate_to_send,
composing_xep = composing_xep, composing_xep = composing_xep,
process_command = process_command) process_command = process_command):
self.print_conversation(message, self.contact.jid, self.print_conversation(message, self.contact.jid,
encrypted = encrypted) encrypted = encrypted)
def check_for_possible_paused_chatstate(self, arg): def check_for_possible_paused_chatstate(self, arg):
''' did we move mouse of that window or write something in message ''' did we move mouse of that window or write something in message