4 * Handle <iq> <get> <query> type situations (namespace queries)
6 * Copyright (c) 2007 by Art Cancro
7 * This code is released under the terms of the GNU General Public License.
19 #include <sys/types.h>
21 #if TIME_WITH_SYS_TIME
22 # include <sys/time.h>
26 # include <sys/time.h>
36 #include <libcitadel.h>
39 #include "citserver.h"
42 #include "internet_addressing.h"
44 #include "ctdl_module.h"
48 #include "serv_xmpp.h"
52 * Return the results for a "jabber:iq:roster:query"
54 * Since we are not yet managing a roster, we simply return the entire wholist
55 * (minus any entries for this user -- don't tell me about myself)
58 void jabber_iq_roster_query(void)
60 struct CitContext *cptr;
61 int aide = (CC->user.axlevel >= 6);
63 cprintf("<query xmlns=\"jabber:iq:roster\">");
65 for (cptr = ContextList; cptr != NULL; cptr = cptr->next) {
68 (((cptr->cs_flags&CS_STEALTH)==0) || (aide))
69 && (cptr->user.usernum != CC->user.usernum)
71 cprintf("<item jid=\"%s\" name=\"%s\" subscription=\"both\">",
75 cprintf("<group>%s</group>", config.c_humannode);
85 * TODO: handle queries on some or all of these namespaces
87 xmpp_query_namespace(purple5b5c1e58, splorph.xand.com, http://jabber.org/protocol/disco#items:query)
88 xmpp_query_namespace(purple5b5c1e59, splorph.xand.com, http://jabber.org/protocol/disco#info:query)
89 xmpp_query_namespace(purple5b5c1e5a, , vcard-temp:query)
93 void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) {
95 lprintf(CTDL_DEBUG, "
\e[31mxmpp_query_namespace(%s, %s, %s, %s)
\e[0m\n",
96 iq_id, iq_from, iq_to, query_xmlns);
99 * Beginning of query result.
101 cprintf("<iq type=\"result\" ");
102 if (!IsEmptyStr(iq_from)) {
103 cprintf("to=\"%s\" ", iq_from);
105 cprintf("id=\"%s\">", iq_id);
108 * Is this a query we know how to handle?
110 if (!strcasecmp(query_xmlns, "jabber:iq:roster:query")) {
111 jabber_iq_roster_query();
115 * End of query result. If we didn't hit any known namespaces then we will
116 * have simply delivered an empty result stanza, which should be ok.
122 #endif /* HAVE_EXPAT */