don't print empty messages (especialy with typing notif)

This commit is contained in:
Yann Leboulanger 2005-07-19 19:10:03 +00:00
parent 92c0c5fdb2
commit 2cfe7ad0d4
1 changed files with 15 additions and 12 deletions

View File

@ -377,6 +377,20 @@ class Interface:
not gajim.contacts[account].has_key(jid): not gajim.contacts[account].has_key(jid):
return return
if self.windows[account]['chats'].has_key(jid):
chat_win = self.windows[account]['chats'][jid]
# chatstates - display jep85 events in window
if chatstate_tag != None:
if chat_win.chatstates[jid] == 'ask':
chat_win.chatstates[jid] = 'active'
chat_win.print_conversation(jid + ' is now ' + chatstate_tag, jid, 'status', tim = array[2])
else:
# got no valid jep85 answer, peer does not support it
chat_win.chatstates[jid] = -1
if not array[1]: #empty message
return
first = False first = False
if not self.windows[account]['chats'].has_key(jid) and \ if not self.windows[account]['chats'].has_key(jid) and \
not gajim.awaiting_messages[account].has_key(jid): not gajim.awaiting_messages[account].has_key(jid):
@ -409,18 +423,7 @@ class Interface:
self.play_sound('next_message_received') self.play_sound('next_message_received')
if self.remote and self.remote.is_enabled(): if self.remote and self.remote.is_enabled():
self.remote.raise_signal('NewMessage', (account, array)) self.remote.raise_signal('NewMessage', (account, array))
if self.windows[account]['chats'].has_key(jid):
chat_win = self.windows[account]['chats'][jid]
# chatstates - display jep85 events in window
if chatstate_tag != None:
if chat_win.chatstates[jid] == 'ask':
chat_win.chatstates[jid] = 'active'
chat_win.print_conversation(jid + ' is now ' + chatstate_tag, jid, 'status', tim = array[2])
else:
# got no valid jep85 answer, peer does not support it
chat_win.chatstates[jid] = -1
def handle_event_msgerror(self, account, array): def handle_event_msgerror(self, account, array):
#('MSGERROR', account, (jid, error_code, error_msg, msg, time)) #('MSGERROR', account, (jid, error_code, error_msg, msg, time))
fjid = array[0] fjid = array[0]