Philipp Hörist pushed to branch master at gajim / gajim
Commits:
89d4b34a by lovetox at 2020-04-11T22:22:32+02:00
Receipts: Don't send receipt if message could not be decrypted
Fixes #10051
- - - - -
549c3c92 by lovetox at 2020-04-11T22:25:17+02:00
Receipts: Don't stop propagation in all cases
- - - - -
1 changed file:
- gajim/common/modules/receipts.py
Changes:
=====================================
gajim/common/modules/receipts.py
=====================================
@@ -39,6 +39,8 @@ class Receipts(BaseModule):
return
if properties.type.is_error:
+ if properties.receipt.is_request:
+ return
# Don't propagate this event further
raise nbxmpp.NodeProcessed
@@ -56,6 +58,12 @@ class Receipts(BaseModule):
if not app.config.get_per('accounts', self._account,
'answer_receipts'):
return
+
+ if properties.eme is not None:
+ # Don't send receipt for message which couldn't be decrypted
+ if not properties.is_encrypted:
+ return
+
contact = self._get_contact(properties)
if contact is None:
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/07a8c98d6dc4050b4a3e1870ca9860e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/07a8c98d6dc4050b4a3e1870ca9860e…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
828ee78b by lovetox at 2020-04-11T17:35:39+02:00
Websocket: Pass stanza on data-sent
- - - - -
5d2bcd74 by lovetox at 2020-04-11T22:00:24+02:00
Smacks: Copy stanza before adding it to the queue
- - - - -
b169eb1a by lovetox at 2020-04-11T22:03:56+02:00
EntityCaps: Add missing node on disco info reply
- - - - -
3 changed files:
- nbxmpp/modules/entity_caps.py
- nbxmpp/smacks.py
- nbxmpp/websocket.py
Changes:
=====================================
nbxmpp/modules/entity_caps.py
=====================================
@@ -57,6 +57,7 @@ class EntityCaps(BaseModule):
return
iq = stanza.buildReply('result')
+ iq.setQuerynode(self._node)
query = iq.getQuery()
for identity in self._caps.identities:
query.addChild(node=identity.get_node())
=====================================
nbxmpp/smacks.py
=====================================
@@ -126,14 +126,13 @@ class Smacks:
# We did not yet sent 'enable' so the server
# will not count our stanzas
return
- if (stanza.getName() == 'message' and
- stanza.getType() in ('chat', 'groupchat')):
- timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
- attrs = {'stamp': timestamp}
- if stanza.getType() != 'groupchat':
- # Dont leak our JID to Groupchats
- attrs['from'] = str(self._client.get_bound_jid())
- stanza.addChild('delay', namespace=NS_DELAY2, attrs=attrs)
+
+ # Make a full copy so we dont run into problems when
+ # the stanza is modified after sending for some reason
+ stanza = type(stanza)(node=str(stanza))
+
+ self._add_delay(stanza)
+
self._uqueue.append(stanza)
self._log.debug('OUT, %s', stanza.getName())
self._out_h += 1
@@ -144,6 +143,22 @@ class Smacks:
if (self._in_h - self._acked_h) > 100:
self._send_ack()
+ def _add_delay(self, stanza):
+ if stanza.getName() != 'message':
+ return
+
+ if stanza.getType() not in ('chat', 'groupchat'):
+ return
+
+ timestamp = time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime())
+ attrs = {'stamp': timestamp}
+
+ if stanza.getType() != 'groupchat':
+ # Dont leak our JID to Groupchats
+ attrs['from'] = str(self._client.get_bound_jid())
+
+ stanza.addChild('delay', namespace=NS_DELAY2, attrs=attrs)
+
def _resend_queue(self):
"""
Resends unsent stanzas when a new session is established.
=====================================
nbxmpp/websocket.py
=====================================
@@ -139,7 +139,7 @@ class WebsocketConnection(Connection):
data = str(stanza)
self._websocket.send_text(data)
self._log_stanza(data, received=False)
- self.notify('data-sent', data)
+ self.notify('data-sent', stanza)
def disconnect(self):
if self._state == TCPState.CONNECTING:
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/852b29d8be3816ea8dbf8c5…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/compare/852b29d8be3816ea8dbf8c5…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
852b29d8 by lovetox at 2020-04-11T16:08:56+02:00
MAM: Check for first and last element in IQ result
- - - - -
1 changed file:
- nbxmpp/modules/mam.py
Changes:
=====================================
nbxmpp/modules/mam.py
=====================================
@@ -119,6 +119,12 @@ class MAM(BaseModule):
'rsm set missing')
complete = fin.getAttr('complete') == 'true'
+ if not complete:
+ if rsm.first is None or rsm.last is None:
+ return raise_error(self._log.warning,
+ stanza,
+ 'stanza-malformed',
+ 'missing first or last element')
return MAMQueryData(jid=jid,
complete=complete,
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/852b29d8be3816ea8dbf8c54…
--
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/-/commit/852b29d8be3816ea8dbf8c54…
You're receiving this email because of your account on dev.gajim.org.