From: Florian Zeitz Date: Sun, 22 Mar 2009 02:39:41 +0000 (+0100) Subject: Don't send initial presence before roster is build. X-Git-Url: http://cgit.babelmonkeys.de/?p=socialXMPP.git;a=commitdiff_plain;h=4799ac077363c67e5a262442c234382ce8042325 Don't send initial presence before roster is build. --- 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()); } }