X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fxmpp%2Fxmpp_query_namespace.c;h=1b17b952f166ec0c5a3f544f08e033552ac73177;hb=1ab27069271df6ed100343866c93c0ef2eb2a888;hp=fb3374e9e73984a91d1584ab90007171305cd0ad;hpb=73bcf6081a14008eb1020126273f133a324bb910;p=citadel.git diff --git a/citadel/modules/xmpp/xmpp_query_namespace.c b/citadel/modules/xmpp/xmpp_query_namespace.c index fb3374e9e..1b17b952f 100644 --- a/citadel/modules/xmpp/xmpp_query_namespace.c +++ b/citadel/modules/xmpp/xmpp_query_namespace.c @@ -1,7 +1,7 @@ /* * Handle type situations (namespace queries) * - * Copyright (c) 2007-2009 by Art Cancro + * Copyright (c) 2007-2015 by Art Cancro and citadel.org * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -45,7 +45,6 @@ #include "support.h" #include "config.h" #include "internet_addressing.h" -#include "md5.h" #include "ctdl_module.h" #include "serv_xmpp.h" @@ -58,10 +57,10 @@ void xmpp_roster_item(struct CitContext *cptr) { char xmlbuf2[256]; cprintf("", - xmlesc(xmlbuf1, cptr->cs_inet_email, sizeof xmlbuf1), + xmlesc(xmlbuf1, cptr->cs_principal_id, sizeof xmlbuf1), xmlesc(xmlbuf2, cptr->user.fullname, sizeof xmlbuf2) ); - cprintf("%s", xmlesc(xmlbuf1, config.c_humannode, sizeof xmlbuf1)); + cprintf("%s", xmlesc(xmlbuf1, CtdlGetConfigStr("c_humannode"), sizeof xmlbuf1)); cprintf(""); } @@ -78,12 +77,13 @@ void xmpp_iq_roster_query(void) struct CitContext *cptr; int nContexts, i; + syslog(LOG_DEBUG, "xmpp: roster push!"); cprintf(""); cptr = CtdlGetContextArray(&nContexts); if (cptr) { for (i=0; i>>>>>> 1c0b8162b0a90f2e97028a531005c11b09441498 void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) { int supported_namespace = 0; int roster_query = 0; char xmlbuf[256]; + int reply_must_be_from_my_jid = 0; /* We need to know before we begin the response whether this is a supported namespace, so * unfortunately all supported namespaces need to be defined here *and* down below where @@ -121,31 +116,48 @@ void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_x supported_namespace = 1; } -<<<<<<< HEAD - syslog(LOG_DEBUG, "xmpp_query_namespace(id=%s, from=%s, to=%s, xmlns=%s)\n", iq_id, iq_from, iq_to, query_xmlns); -======= - XMPP_syslog(LOG_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns); ->>>>>>> 1c0b8162b0a90f2e97028a531005c11b09441498 + syslog(LOG_DEBUG, "xmpp: xmpp_query_namespace(id=%s, from=%s, to=%s, xmlns=%s)", iq_id, iq_from, iq_to, query_xmlns); /* * Beginning of query result. */ - if (supported_namespace) { - cprintf("client_jid, sizeof(dom)); + char *slash = strchr(dom, '/'); + if (slash) { + *slash = 0; + } } else { - cprintf("client_jid, sizeof(dom)); // client is expecting to see the reply + if (IsEmptyStr(dom)) { // coming "from" the domain of the user's jid + safestrncpy(dom, XMPP->server_name, sizeof(dom)); + } + char *at = strrchr(dom, '@'); + if (at) { + strcpy(dom, ++at); + } + char *slash = strchr(dom, '/'); + if (slash) { + *slash = 0; + } } - if (!IsEmptyStr(iq_from)) { - cprintf("to=\"%s\" ", xmlesc(xmlbuf, iq_from, sizeof xmlbuf)); + + if (supported_namespace) { + cprintf(">>>>>> 1c0b8162b0a90f2e97028a531005c11b09441498 cprintf("id=\"%s\">", xmlesc(xmlbuf, iq_id, sizeof xmlbuf)); /* @@ -180,14 +192,7 @@ void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_x */ else { -<<<<<<< HEAD - syslog(LOG_DEBUG, "Unknown query namespace '%s' - returning \n", query_xmlns); -======= - XMPP_syslog(LOG_DEBUG, - "Unknown query namespace '%s' - returning \n", - query_xmlns - ); ->>>>>>> 1c0b8162b0a90f2e97028a531005c11b09441498 + syslog(LOG_DEBUG, "xmpp: unknown query namespace '%s' - returning ", query_xmlns); cprintf("" "" ""