+ char xmlbuf[256];
+
+ syslog(LOG_DEBUG, "xmpp: indicating presence of <%s> to <%s>", presence_jid, XMPP->client_jid);
+ cprintf("<presence from=\"%s\" ", xmlesc(xmlbuf, presence_jid, sizeof xmlbuf));
+ cprintf("to=\"%s\"></presence>", xmlesc(xmlbuf, XMPP->client_jid, sizeof xmlbuf));
+}
+
+
+/*
+ * Convenience function to determine whether any given session is 'visible' to any other given session,
+ * and is capable of receiving instant messages from that session.
+ */
+int xmpp_is_visible(struct CitContext *cptr, struct CitContext *to_whom) {
+ int aide = (to_whom->user.axlevel >= AxAideU);
+
+ if ( (cptr->logged_in)
+ && (((cptr->cs_flags&CS_STEALTH)==0) || (aide)) /* aides see everyone */
+ && (cptr->user.usernum != to_whom->user.usernum) /* don't show myself */
+ && (cptr->can_receive_im) /* IM-capable session */
+ ) {
+ return(1);
+ }
+ else {
+ return(0);
+ }