Initial XEP-0184 support.
TODO: * Implement section 5. * Think of a way to show in GUI Possible way: Grey out the sent msg until we receive a <received/>, but only if we know the other end supports XEP-0184. * Maybe implement section 6?
This commit is contained in:
parent
7fbfa0547d
commit
a495d090c3
3 changed files with 20 additions and 1 deletions
|
@ -311,6 +311,8 @@ class Config:
|
||||||
'zeroconf_jabber_id': [ opt_str, '', '', True ],
|
'zeroconf_jabber_id': [ opt_str, '', '', True ],
|
||||||
'zeroconf_email': [ opt_str, '', '', True ],
|
'zeroconf_email': [ opt_str, '', '', True ],
|
||||||
'use_env_http_proxy' : [opt_bool, False],
|
'use_env_http_proxy' : [opt_bool, False],
|
||||||
|
'answer_receipt' : [opt_bool, True],
|
||||||
|
'request_receipt' : [opt_bool, True],
|
||||||
'otr_flags': [opt_int, 58 ],
|
'otr_flags': [opt_int, 58 ],
|
||||||
'publish_mood': [opt_bool, True],
|
'publish_mood': [opt_bool, True],
|
||||||
'publish_activity': [opt_bool, True],
|
'publish_activity': [opt_bool, True],
|
||||||
|
|
|
@ -1123,6 +1123,14 @@ class Connection(ConnectionHandlers):
|
||||||
namespace=common.xmpp.NS_ADDRESS)
|
namespace=common.xmpp.NS_ADDRESS)
|
||||||
addresses.addChild('address', attrs = {'type': 'ofrom',
|
addresses.addChild('address', attrs = {'type': 'ofrom',
|
||||||
'jid': forward_from})
|
'jid': forward_from})
|
||||||
|
|
||||||
|
# TODO: We should also check if the other end supports it
|
||||||
|
# as XEP 0184 says checking is a SHOULD. Maybe we should
|
||||||
|
# implement section 6 of the XEP as well?
|
||||||
|
if msgtxt and gajim.config.get_per('accounts', self.name,
|
||||||
|
'request_receipt'):
|
||||||
|
msg_iq.setTag('request', namespace='urn:xmpp:receipts')
|
||||||
|
|
||||||
if session:
|
if session:
|
||||||
# XEP-0201
|
# XEP-0201
|
||||||
session.last_send = time.time()
|
session.last_send = time.time()
|
||||||
|
@ -1132,7 +1140,6 @@ 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)
|
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')\
|
||||||
|
|
|
@ -1693,6 +1693,16 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
|
||||||
|
|
||||||
encrypted = False
|
encrypted = False
|
||||||
xep_200_encrypted = msg.getTag('c', namespace=common.xmpp.NS_STANZA_CRYPTO)
|
xep_200_encrypted = msg.getTag('c', namespace=common.xmpp.NS_STANZA_CRYPTO)
|
||||||
|
|
||||||
|
# Receipt requested
|
||||||
|
if msg.getTag('request', namespace='urn:xmpp:receipts') and \
|
||||||
|
gajim.config.get_per('accounts', self.name, 'answer_receipt'):
|
||||||
|
receipt = common.xmpp.Message(to = jid, typ = 'chat')
|
||||||
|
receipt.setID(msg.getID())
|
||||||
|
receipt.setTag('received',
|
||||||
|
namespace='urn:xmpp:receipts')
|
||||||
|
receipt.setThread(thread_id)
|
||||||
|
con.send(receipt)
|
||||||
|
|
||||||
# We don't trust libotr, that's why we only pass the message
|
# We don't trust libotr, that's why we only pass the message
|
||||||
# to it if necessary. otrl_proto_message_type does this check.
|
# to it if necessary. otrl_proto_message_type does this check.
|
||||||
|
|
Loading…
Add table
Reference in a new issue