X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fxmpp%2Fserv_xmpp.c;fp=citadel%2Fmodules%2Fxmpp%2Fserv_xmpp.c;h=7d8fbc67d02c3349ec864d3d56e916563962fc50;hp=7986cb573fdb254de00bac8f1684f79cff2896e6;hb=9530aa5d9ba02e3b186aec0c24a1fa7824b7b086;hpb=2b57abb4e89077f1bdf104e95203015810cf1a6f diff --git a/citadel/modules/xmpp/serv_xmpp.c b/citadel/modules/xmpp/serv_xmpp.c index 7986cb573..7d8fbc67d 100644 --- a/citadel/modules/xmpp/serv_xmpp.c +++ b/citadel/modules/xmpp/serv_xmpp.c @@ -81,25 +81,6 @@ static void xmpp_entity_declaration(void *userData, const XML_Char *entityName, } #endif -static inline int XMPP_GetUtf8SequenceLength(const char *CharS, const char *CharE) -{ - /* if this is is migrated to strbuf, remove this copy. */ - int n = 0; - unsigned char test = (1<<7); - - if ((*CharS & 0xC0) != 0xC0) - return 1; - - while ((n < 8) && - ((test & ((unsigned char)*CharS)) != 0)) - { - test = test >> 1; - n ++; - } - if ((n > 6) || ((CharE - CharS) < n)) - n = 0; - return n; -} /* @@ -112,11 +93,8 @@ static inline int XMPP_GetUtf8SequenceLength(const char *CharS, const char *Char char *xmlesc(char *buf, char *str, int bufsiz) { char *ptr; - char *eiptr; unsigned char ch; - int inlen; int len = 0; - int IsUtf8Sequence; if (!buf) return(NULL); buf[0] = 0; @@ -125,9 +103,6 @@ char *xmlesc(char *buf, char *str, int bufsiz) return(buf); } - inlen = strlen(str); - eiptr = str + inlen; - for (ptr=str; *ptr; ptr++) { ch = *ptr; if (ch == '<') { @@ -152,25 +127,10 @@ char *xmlesc(char *buf, char *str, int bufsiz) buf[len] = 0; } else { - char oct[32]; - - IsUtf8Sequence = XMPP_GetUtf8SequenceLength(&buf[len], eiptr); - if (IsUtf8Sequence) - { - while (IsUtf8Sequence > 0){ - buf[len] = *ptr; - len ++; - if (--IsUtf8Sequence) - ptr++; - } - buf[len] = '\0'; - } - else - { - sprintf(oct, "&#%o;", ch); - strcpy(&buf[len], oct); - len += strlen(oct); - } + char oct[10]; + sprintf(oct, "&#%o;", ch); + strcpy(&buf[len], oct); + len += strlen(oct); } if ((len + 6) > bufsiz) { return(buf); @@ -208,13 +168,13 @@ void xmpp_stream_start(void *data, const char *supplied_el, const char **attr) /* * TLS encryption (but only if it isn't already active) - * / + */ #ifdef HAVE_OPENSSL if (!CC->redirect_ssl) { cprintf(""); } #endif - */ + if (!CC->logged_in) { /* If we're not logged in yet, offer SASL as our feature set */ xmpp_output_auth_mechs();