X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fxmpp%2Fserv_xmpp.c;h=07188c2e948594fb57c25c8aea4cce9e5dee5e1c;hb=3144440e07822224c1967203c77ca3ef0f419e43;hp=cc75f6dd190751d88f112fa6c91035277d28c2d2;hpb=5e630368347015f99043c6edbc8c1b474cf892ff;p=citadel.git diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index cc75f6dd1..07188c2e9 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -67,7 +67,6 @@ 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, @@ -92,17 +91,17 @@ static inline int Ctdl_GetUtf8SequenceLength(const char *CharS, const char *Char int n = 0; unsigned char test = (1<<7); - if ((*CharS & 0xC0) != 0xC0) + if ((*CharS & 0xC0) != 0xC0) { return 1; + } - while ((n < 8) && - ((test & ((unsigned char)*CharS)) != 0)) - { + while ((n < 8) && ((test & ((unsigned char)*CharS)) != 0)) { test = test >> 1; n ++; } - if ((n > 6) || ((CharE - CharS) < n)) + if ((n > 6) || ((CharE - CharS) < n)) { n = 0; + } return n; } @@ -299,7 +298,6 @@ void xmpp_xml_start(void *data, const char *supplied_el, const char **attr) { } - void xmpp_xml_end(void *data, const char *supplied_el) { char el[256]; char *sep = NULL; @@ -392,8 +390,7 @@ void xmpp_xml_end(void *data, const char *supplied_el) { xmpp_non_sasl_authenticate( XMPP->iq_id, XMPP->iq_client_username, - XMPP->iq_client_password, - XMPP->iq_client_resource + XMPP->iq_client_password ); } @@ -407,25 +404,14 @@ void xmpp_xml_end(void *data, const char *supplied_el) { ) { /* If the client has not specified a client resource, generate one */ - if (IsEmptyStr(XMPP->iq_client_resource)) { - generate_uuid(XMPP->iq_client_resource); + snprintf(XMPP->iq_client_resource, sizeof XMPP->iq_client_resource, "%d", CC->cs_pid); } - /* 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 - ); - - /* FIXME look here ... there's nothing before the slash ... wtf? - syslog(LOG_DEBUG, "\033[31m client resource = '%s' \033[0m", XMPP->client_jid); - */ + /* Generate the "full JID" of the client (user@host/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 */ - cprintf("", xmlesc(xmlbuf, XMPP->iq_id, sizeof xmlbuf)); cprintf(""); cprintf("%s", xmlesc(xmlbuf, XMPP->client_jid, sizeof xmlbuf));