diff nickname.js @ 1:d6df73b466f6

Implement XEP-0156 to discover the right BOSH endpoint.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Fri, 21 Dec 2018 23:44:18 +0100
parents 2a8d4e8600d0
children 13e8e4ea53c0
line wrap: on
line diff
--- a/nickname.js
+++ b/nickname.js
@@ -9,18 +9,6 @@ function initNickname(connection) {
             .c('items', {node: 'http://jabber.org/protocol/nick'});
     connection.sendIQ(iq, onNickname, onNicknameRetrievalError.bind(null, 'PubSub query failed.'));
 
-    function nsResolver(prefix) {
-        return {
-            pubsub: 'http://jabber.org/protocol/pubsub',
-            nickname: 'http://jabber.org/protocol/nick',
-        }[prefix] || null;
-    }
-
-    function parseXPath(elem, xpath)
-    {
-        return elem.getRootNode().evaluate(xpath, elem, nsResolver, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
-    }
-
     function onNickname(result_iq)
     {
         const item = parseXPath(result_iq, './pubsub:pubsub/pubsub:items/pubsub:item');