From: Art Cancro Date: Mon, 3 Dec 2007 04:29:51 +0000 (+0000) Subject: Updated roster push technique X-Git-Tag: v7.86~2692 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=4183fd67f13b96e377dd2578aa6517e0919114a6;p=citadel.git Updated roster push technique --- diff --git a/citadel/modules/jabber/xmpp_presence.c b/citadel/modules/jabber/xmpp_presence.c index 9cdbf4e7a..d63f15eae 100644 --- a/citadel/modules/jabber/xmpp_presence.c +++ b/citadel/modules/jabber/xmpp_presence.c @@ -78,22 +78,39 @@ void xmpp_presence_notify(char *presence_jid, char *presence_type) { /* FIXME subject this to the same conditions as above */ + /* FIXME make sure don't do this for multiple logins of the same user (login) + * or until the last concurrent login is logged out (logout) + */ + if (IsEmptyStr(presence_jid)) return; lprintf(CTDL_DEBUG, "Sending presence info about <%s> to session %d\n", presence_jid, CC->cs_pid); - /* Transmit an unsolicited roster update */ - for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { - if (!strcasecmp(cptr->cs_inet_email, presence_jid)) { - cprintf("", ++unsolicited_id); - cprintf(""); - jabber_roster_item(cptr); - cprintf("" - ""); + /* Transmit an unsolicited roster update if the presence is anything other than "unavailable" */ + if (strcasecmp(presence_type, "unavailable")) { + for (cptr = ContextList; cptr != NULL; cptr = cptr->next) { + if (!strcasecmp(cptr->cs_inet_email, presence_jid)) { + cprintf("", ++unsolicited_id); + cprintf(""); + jabber_roster_item(cptr); + cprintf("" + ""); + } } } /* Now transmit unsolicited presence information */ cprintf("", presence_type, presence_jid); + + /* For "unavailable" we do an unsolicited roster update that deletes the contact. */ + if (!strcasecmp(presence_type, "unavailable")) { + cprintf("", ++unsolicited_id); + cprintf(""); + cprintf("", presence_jid); + cprintf("%s", config.c_humannode); + cprintf(""); + cprintf("" + ""); + } }