about summary refs log tree commit diff stats
path: root/src/xmpp
diff options
context:
space:
mode:
authorDebXWoody <stefan@debxwoody.de>2020-05-23 07:41:06 +0200
committerDebXWoody <stefan@debxwoody.de>2020-05-23 07:41:06 +0200
commitb882fd495a5488a136b7e2d39bc09583658d9e77 (patch)
treefe44536319530acbb1be1cdf62a8e72bfa7fb14c /src/xmpp
parent86f0e0ea7033a27a83a5c24091ae1fd5b579296d (diff)
downloadprofani-tty-b882fd495a5488a136b7e2d39bc09583658d9e77.tar.gz
OMEMO - Request only "current" item
NOTE: as per XEP-0060 ยง12.20, it is RECOMMENDED for the publisher to specify an
ItemID of "current" to ensure that the publication of a new item will overwrite
the existing item.
https://xmpp.org/extensions/xep-0384.html#devices

Issue: 1329
Diffstat (limited to 'src/xmpp')
-rw-r--r--src/xmpp/omemo.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c
index 780cfe17..3be4dad5 100644
--- a/src/xmpp/omemo.c
+++ b/src/xmpp/omemo.c
@@ -442,7 +442,7 @@ _omemo_receive_devicelist(xmpp_stanza_t *const stanza, void *const userdata)
     }
 
     xmpp_stanza_t *item = xmpp_stanza_get_child_by_name(items, "item");
-    if (item) {
+    if (item && g_strcmp0(xmpp_stanza_get_id(item), "current") == 0 ) {
         xmpp_stanza_t *list = xmpp_stanza_get_child_by_ns(item, STANZA_NS_OMEMO);
         if (!list) {
             return 1;
@@ -462,6 +462,10 @@ _omemo_receive_devicelist(xmpp_stanza_t *const stanza, void *const userdata)
             }
         }
     }
+    if (item && g_strcmp0(xmpp_stanza_get_id(item), "current") != 0 ) {
+        log_warning("OMEMO: User %s has a non 'current' device item list: %s.", from, xmpp_stanza_get_id(item));
+    }
+
     omemo_set_device_list(from, device_list);
 
     return 1;