Browse Source

Add explanatory snippets from relevant XEP

JC Brand 6 years ago
parent
commit
c37a1dcbb2
2 changed files with 11 additions and 1 deletions
  1. 6 1
      dist/converse.js
  2. 5 0
      src/converse-mam.js

+ 6 - 1
dist/converse.js

@@ -66211,11 +66211,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
   const MAM_ATTRIBUTES = ['with', 'start', 'end'];
 
   function getMessageArchiveID(stanza) {
+    // See https://xmpp.org/extensions/xep-0313.html#results
+    //
+    // The result messages MUST contain a <result/> element with an 'id'
+    // attribute that gives the current message's archive UID
     const result = sizzle(`result[xmlns="${Strophe.NS.MAM}"]`, stanza).pop();
 
     if (!_.isUndefined(result)) {
       return result.getAttribute('id');
-    }
+    } // See: https://xmpp.org/extensions/xep-0313.html#archives_id
+
 
     const stanza_id = sizzle(`stanza-id[xmlns="${Strophe.NS.SID}"]`, stanza).pop();
 

+ 5 - 0
src/converse-mam.js

@@ -26,10 +26,15 @@
 
 
     function getMessageArchiveID (stanza) {
+        // See https://xmpp.org/extensions/xep-0313.html#results
+        //
+        // The result messages MUST contain a <result/> element with an 'id'
+        // attribute that gives the current message's archive UID
         const result = sizzle(`result[xmlns="${Strophe.NS.MAM}"]`, stanza).pop();
         if (!_.isUndefined(result)) {
             return result.getAttribute('id');
         }
+        // See: https://xmpp.org/extensions/xep-0313.html#archives_id
         const stanza_id = sizzle(`stanza-id[xmlns="${Strophe.NS.SID}"]`, stanza).pop();
         if (!_.isUndefined(stanza_id)) {
             return stanza_id.getAttribute('id');