diff --git a/src/chat_control.py b/src/chat_control.py index 6760762e4..7b3705a47 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -621,13 +621,14 @@ class ChatControlBase(MessageControl): if not message or message == '\n': return 1 + ret = None + if not process_command or not self._process_command(message): ret = MessageControl.send_message(self, message, keyID, type = type, chatstate = chatstate, msg_id = msg_id, composing_xep = composing_xep, resource = resource, user_nick = self.user_nick) - if ret: - return ret + # Record message history self.save_sent_message(message) @@ -638,6 +639,8 @@ class ChatControlBase(MessageControl): message_buffer = self.msg_textview.get_buffer() message_buffer.set_text('') # clear message buffer (and tv of course) + return ret + def save_sent_message(self, message): # save the message, so user can scroll though the list with key up/down size = len(self.sent_history) @@ -1501,11 +1504,12 @@ class ChatControl(ChatControlBase): gobject.source_remove(self.possible_inactive_timeout_id) self._schedule_activity_timers() - if not ChatControlBase.send_message(self, message, keyID, type = 'chat', - chatstate = chatstate_to_send, composing_xep = composing_xep, - process_command = process_command): - self.print_conversation(message, self.contact.jid, - encrypted = encrypted) + ChatControlBase.send_message(self, message, keyID, + type = 'chat', chatstate = chatstate_to_send, + composing_xep = composing_xep, + process_command = process_command) + self.print_conversation(message, self.contact.jid, + encrypted = encrypted) def check_for_possible_paused_chatstate(self, arg): ''' did we move mouse of that window or write something in message diff --git a/src/common/connection.py b/src/common/connection.py index 71e8a498d..c3cdcaab5 100644 --- a/src/common/connection.py +++ b/src/common/connection.py @@ -1126,7 +1126,7 @@ class Connection(ConnectionHandlers): if session.enable_encryption: msg_iq = session.encrypt_stanza(msg_iq) - self.connection.send(msg_iq) + msg_id = self.connection.send(msg_iq) if not forward_from and session and session.is_loggable(): no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')\ .split() @@ -1148,6 +1148,8 @@ class Connection(ConnectionHandlers): self.dispatch('ERROR', (_('Disk Write Error'), str(e))) self.dispatch('MSGSENT', (jid, msg, keyID)) + return msg_id + def send_stanza(self, stanza): ''' send a stanza untouched ''' if not self.connection: diff --git a/src/common/connection_handlers.py b/src/common/connection_handlers.py index cfdfa4fd7..25a771e05 100644 --- a/src/common/connection_handlers.py +++ b/src/common/connection_handlers.py @@ -1694,7 +1694,9 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco, # Receipt requested # TODO: We shouldn't answer if we're invisible! if msg.getTag('request', namespace='urn:xmpp:receipts') and \ - gajim.config.get_per('accounts', self.name, 'answer_receipt'): + gajim.config.get_per('accounts', self.name, 'answer_receipt') \ + and gajim.contacts.get_contact_from_full_jid(self.name, frm). \ + sub not in (u'to', u'none'): receipt = common.xmpp.Message(to = jid, typ = 'chat') receipt.setID(msg.getID()) receipt.setTag('received',