From 4799ac077363c67e5a262442c234382ce8042325 Mon Sep 17 00:00:00 2001 From: Florian Zeitz Date: Sun, 22 Mar 2009 03:39:41 +0100 Subject: [PATCH] Don't send initial presence before roster is build. --- scripts/basic.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/basic.js b/scripts/basic.js index 984b0cc..b7e597b 100644 --- a/scripts/basic.js +++ b/scripts/basic.js @@ -97,6 +97,10 @@ function _cbRoster(e) { } addFriend(entries[item].getAttribute('jid'), nick); } + connection.addHandler(_cbPEP, NS_PEP, 'message'); + var initialPresence = $pres().c('c', {xmlns: NS_CAPS, hash: 'sha-1', node: 'http://jabber.babelmonkeys.de', ver: genCaps()}).up(); + connection.send(initialPresence.tree()); + return false; } @@ -176,10 +180,7 @@ function onConnect(status) { } else if (status == Strophe.Status.CONNECTED) { log('Strophe is connected.'); getRoster(); - connection.addHandler(_cbPEP, NS_PEP, 'message'); connection.addHandler(_cbDisco, Strophe.NS.DISCO_INFO, 'iq', 'get'); - var initialPresence = $pres().c('c', {xmlns: NS_CAPS, hash: 'sha-1', node: 'http://jabber.babelmonkeys.de', ver: genCaps()}).up(); - connection.send(initialPresence.tree()); } } -- 2.39.2