* Fix passing of message ID.
* Don't asnwer to receipt requests from users not in roster.
This commit is contained in:
parent
c2eb4b5a9f
commit
593ed0c6d8
3 changed files with 17 additions and 9 deletions
|
@ -621,13 +621,14 @@ class ChatControlBase(MessageControl):
|
||||||
if not message or message == '\n':
|
if not message or message == '\n':
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
ret = None
|
||||||
|
|
||||||
if not process_command or not self._process_command(message):
|
if not process_command or not self._process_command(message):
|
||||||
ret = MessageControl.send_message(self, message, keyID, type = type,
|
ret = MessageControl.send_message(self, message, keyID, type = type,
|
||||||
chatstate = chatstate, msg_id = msg_id,
|
chatstate = chatstate, msg_id = msg_id,
|
||||||
composing_xep = composing_xep, resource = resource,
|
composing_xep = composing_xep, resource = resource,
|
||||||
user_nick = self.user_nick)
|
user_nick = self.user_nick)
|
||||||
if ret:
|
|
||||||
return ret
|
|
||||||
# Record message history
|
# Record message history
|
||||||
self.save_sent_message(message)
|
self.save_sent_message(message)
|
||||||
|
|
||||||
|
@ -638,6 +639,8 @@ class ChatControlBase(MessageControl):
|
||||||
message_buffer = self.msg_textview.get_buffer()
|
message_buffer = self.msg_textview.get_buffer()
|
||||||
message_buffer.set_text('') # clear message buffer (and tv of course)
|
message_buffer.set_text('') # clear message buffer (and tv of course)
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
def save_sent_message(self, message):
|
def save_sent_message(self, message):
|
||||||
# save the message, so user can scroll though the list with key up/down
|
# save the message, so user can scroll though the list with key up/down
|
||||||
size = len(self.sent_history)
|
size = len(self.sent_history)
|
||||||
|
@ -1501,9 +1504,10 @@ 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()
|
||||||
|
|
||||||
if not ChatControlBase.send_message(self, message, keyID, type = 'chat',
|
ChatControlBase.send_message(self, message, keyID,
|
||||||
chatstate = chatstate_to_send, composing_xep = composing_xep,
|
type = 'chat', chatstate = chatstate_to_send,
|
||||||
process_command = process_command):
|
composing_xep = composing_xep,
|
||||||
|
process_command = process_command)
|
||||||
self.print_conversation(message, self.contact.jid,
|
self.print_conversation(message, self.contact.jid,
|
||||||
encrypted = encrypted)
|
encrypted = encrypted)
|
||||||
|
|
||||||
|
|
|
@ -1126,7 +1126,7 @@ class Connection(ConnectionHandlers):
|
||||||
if session.enable_encryption:
|
if session.enable_encryption:
|
||||||
msg_iq = session.encrypt_stanza(msg_iq)
|
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():
|
if not forward_from and session and session.is_loggable():
|
||||||
no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')\
|
no_log_for = gajim.config.get_per('accounts', self.name, 'no_log_for')\
|
||||||
.split()
|
.split()
|
||||||
|
@ -1148,6 +1148,8 @@ class Connection(ConnectionHandlers):
|
||||||
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
|
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
|
||||||
self.dispatch('MSGSENT', (jid, msg, keyID))
|
self.dispatch('MSGSENT', (jid, msg, keyID))
|
||||||
|
|
||||||
|
return msg_id
|
||||||
|
|
||||||
def send_stanza(self, stanza):
|
def send_stanza(self, stanza):
|
||||||
''' send a stanza untouched '''
|
''' send a stanza untouched '''
|
||||||
if not self.connection:
|
if not self.connection:
|
||||||
|
|
|
@ -1694,7 +1694,9 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
||||||
# Receipt requested
|
# Receipt requested
|
||||||
# TODO: We shouldn't answer if we're invisible!
|
# TODO: We shouldn't answer if we're invisible!
|
||||||
if msg.getTag('request', namespace='urn:xmpp:receipts') and \
|
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 = common.xmpp.Message(to = jid, typ = 'chat')
|
||||||
receipt.setID(msg.getID())
|
receipt.setID(msg.getID())
|
||||||
receipt.setTag('received',
|
receipt.setTag('received',
|
||||||
|
|
Loading…
Add table
Reference in a new issue