From 5ad4e85ed50029e2b66382c0315914cf7aa0ecaf Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 20 Oct 2014 21:58:20 +0200 Subject: [PATCH] Setup Roster before sending initial presence Thanks to Phil Winder for reporting the issue. --- .../java/org/jivesoftware/smack/AbstractXMPPConnection.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java index 793b5b852..5904ace57 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/AbstractXMPPConnection.java @@ -453,6 +453,11 @@ public abstract class AbstractXMPPConnection implements XMPPConnection { // eventually load the roster. And we should load the roster before we // send the initial presence. if (config.isSendPresence() && !resumed) { + if (!isAnonymous()) { + // Make sure that the roster has setup its listeners prior sending the initial presence by calling + // getRoster() + getRoster(); + } sendPacket(new Presence(Presence.Type.available)); } }