XMPP->iq_session = 1;
}
+ else if (!strcasecmp(el, "presence")) {
+
+ /* Respond to a <presence> update by firing back with presence information
+ * on the entire wholist. Check this assumption, it's probably wrong.
+ */
+ jabber_wholist_presence_dump();
+ }
+
XMPP->chardata_len = 0;
if (XMPP->chardata_alloc > 0) {
XMPP->chardata[0] = 0;
/*
- * $Id: $
+ * $Id$
*
*/
void xmpp_sasl_auth(char *, char *);
void xmpp_output_auth_mechs(void);
void xmpp_query_namespace(char *, char *, char *, char *);
+void jabber_wholist_presence_dump(void);
--- /dev/null
+/*
+ * $Id$
+ *
+ * Handle XMPP presence exchanges
+ *
+ * Copyright (c) 2007 by Art Cancro
+ * This code is released under the terms of the GNU General Public License.
+ *
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include <ctype.h>
+#include <libcitadel.h>
+#include "citadel.h"
+#include "server.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "internet_addressing.h"
+#include "md5.h"
+#include "ctdl_module.h"
+
+#ifdef HAVE_EXPAT
+#include <expat.h>
+#include "serv_xmpp.h"
+
+
+/*
+ * Initial dump of the entire wholist
+ */
+void jabber_wholist_presence_dump(void)
+{
+ struct CitContext *cptr;
+ int aide = (CC->user.axlevel >= 6);
+
+ for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
+ if (
+ (((cptr->cs_flags&CS_STEALTH)==0) || (aide)) /* aides can see everyone */
+ && (cptr->user.usernum != CC->user.usernum) /* don't tell me about myself */
+ ) {
+ cprintf("<presence type=\"available\" from=\"%s\"></presence>", cptr->cs_inet_email);
+ }
+ }
+}
+
+
+#endif /* HAVE_EXPAT */
/*
- * $Id: $
+ * $Id$
*
* Handle <iq> <get> <query> type situations (namespace queries)
*
/*
* Return the results for a "jabber:iq:roster:query"
*
- * Since we are not yet managing a roster, we simply return the entire wholist.
+ * Since we are not yet managing a roster, we simply return the entire wholist
+ * (minus any entries for this user -- don't tell me about myself)
*
*/
void jabber_iq_roster_query(void)
for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
- if (((cptr->cs_flags&CS_STEALTH)==0) || (aide)) {
+ if (
+ (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
+ && (cptr->user.usernum != CC->user.usernum)
+ ) {
cprintf("<item jid=\"%s\" name=\"%s\" subscription=\"both\">",
cptr->cs_inet_email,
cptr->user.fullname
}
}
-/**** these remain here for documentation example only
-
- cprintf("<item jid=\"romeo@example.net\" name=\"Romeo\" subscription=\"both\">");
- cprintf("<group>Friends</group>");
- cprintf("</item>");
-
- cprintf("<item jid=\"mercutio@example.org\" name=\"Mercutio\" subscription=\"from\">");
- cprintf("<group>Friends</group>");
- cprintf("</item>");
-
- cprintf("<item jid=\"benvolio@example.org\" name=\"Benvolio\" subscription=\"both\">");
- cprintf("<group>Friends</group>");
- cprintf("</item>");
-
- ****/
-
cprintf("</query>");
}
xmpp_query_namespace(purple5b5c1e58, splorph.xand.com, http://jabber.org/protocol/disco#items:query)
xmpp_query_namespace(purple5b5c1e59, splorph.xand.com, http://jabber.org/protocol/disco#info:query)
xmpp_query_namespace(purple5b5c1e5a, , vcard-temp:query)
-xmpp_query_namespace(purple5b5c1e5b, , jabber:iq:roster:query)
*
*/