/*
* XMPP (Jabber) service for the Citadel system
- * Copyright (c) 2007-2017 by Art Cancro and citadel.org
+ * Copyright (c) 2007-2018 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 as published by
struct xmpp_event *xmpp_queue = NULL;
-
-
#ifdef HAVE_XML_STOPPARSER
/* Stop the parser if an entity declaration is hit. */
static void xmpp_entity_declaration(void *userData, const XML_Char *entityName,
#endif
-
/*
* Given a source string and a target buffer, returns the string
* properly escaped for insertion into an XML stream. Returns a
return n;
}
+
char *xmlesc(char *buf, char *str, int bufsiz)
{
int IsUtf8Sequence;
if (!strcasecmp(el, "resource")) {
if (XMPP->chardata_len > 0) {
- safestrncpy(XMPP->iq_client_resource, XMPP->chardata,
- sizeof XMPP->iq_client_resource);
+ safestrncpy(XMPP->iq_client_resource, XMPP->chardata, sizeof XMPP->iq_client_resource);
striplt(XMPP->iq_client_resource);
}
}
else if (!strcasecmp(el, "username")) { /* NON SASL ONLY */
if (XMPP->chardata_len > 0) {
- safestrncpy(XMPP->iq_client_username, XMPP->chardata,
- sizeof XMPP->iq_client_username);
+ safestrncpy(XMPP->iq_client_username, XMPP->chardata, sizeof XMPP->iq_client_username);
striplt(XMPP->iq_client_username);
}
}
else if (!strcasecmp(el, "password")) { /* NON SASL ONLY */
if (XMPP->chardata_len > 0) {
- safestrncpy(XMPP->iq_client_password, XMPP->chardata,
- sizeof XMPP->iq_client_password);
+ safestrncpy(XMPP->iq_client_password, XMPP->chardata, sizeof XMPP->iq_client_password);
striplt(XMPP->iq_client_password);
}
}
* Query on a namespace
*/
if (!IsEmptyStr(XMPP->iq_query_xmlns)) {
- xmpp_query_namespace(XMPP->iq_id, XMPP->iq_from,
- XMPP->iq_to, XMPP->iq_query_xmlns);
+ xmpp_query_namespace(XMPP->iq_id, XMPP->iq_from, XMPP->iq_to, XMPP->iq_query_xmlns);
}
/*
else if (
(XMPP->bind_requested)
&& (!IsEmptyStr(XMPP->iq_id))
- && (!IsEmptyStr(XMPP->iq_client_resource))
&& (CC->logged_in)
- ) {
+ ) {
- /* Generate the "full JID" of the client resource */
+ /* If the client has not specified a client resource, generate one */
- snprintf(XMPP->client_jid, sizeof XMPP->client_jid,
- "%s/%s",
- CC->cs_inet_email,
- XMPP->iq_client_resource
- );
+ if (IsEmptyStr(XMPP->iq_client_resource)) {
+ generate_uuid(XMPP->iq_client_resource);
+ }
+
+ /* Generate the "full JID" of the client resource */
+ snprintf(XMPP->client_jid, sizeof XMPP->client_jid, "%s/%s", CC->cs_inet_email, XMPP->iq_client_resource);
/* Tell the client what its JID is */
}
-
/*
* Here's where our XMPP session begins its happy day.
*/