- cprintf("<presence type=\"unsubscribed\" from=\"%s\" to=\"%s\"></presence>",
- xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1),
- xmlesc(xmlbuf2, XMPP->client_jid, sizeof xmlbuf2)
- );
- // FIXME ... we should implement xmpp_indicate_nonpresence so we can use it elsewhere
+
+ /*
+ * Setting the "aggressively" flag also sends an "unsubscribed" presence update.
+ * We only ask for this when flushing the client side roster, because if we do it
+ * in the middle of a session when another user logs off, some clients (Jitsi) interpret
+ * it as a rejection of a subscription request.
+ */
+ if (aggressively) {
+ cprintf("<presence type=\"unsubscribed\" from=\"%s\" to=\"%s\"></presence>",
+ xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1),
+ xmlesc(xmlbuf2, XMPP->client_jid, sizeof xmlbuf2)
+ );
+ }
+
+ // note: we should implement xmpp_indicate_nonpresence so we can use it elsewhere