X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fngircd%2Fconn.c;h=80b085a83e2f3e4b6108ed36c30c8358ff5ac441;hb=eb4f9eac0c35071838c9367f1204db0d0b98ad2e;hp=81a0f4507eed0fb79d470bf323452bd1a328dd58;hpb=01b62202b2caa1b8161e62f149a9d6f705713869;p=ngircd.git diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index 81a0f450..80b085a8 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -47,10 +47,6 @@ # include #endif -#ifdef HAVE_STDINT_H -# include /* e.g. for Mac OS X */ -#endif - #ifdef TCPWRAP # include /* for TCP Wrappers */ #endif @@ -67,6 +63,7 @@ #include "client.h" #include "class.h" #include "conf.h" +#include "conn-encoding.h" #include "conn-ssl.h" #include "conn-zip.h" #include "conn-func.h" @@ -865,6 +862,9 @@ va_dcl #endif { char buffer[COMMAND_LEN]; +#ifdef ICONV + char *ptr, *message; +#endif size_t len; bool ok; va_list ap; @@ -905,6 +905,16 @@ va_dcl CUT_TXTSUFFIX); } +#ifdef ICONV + ptr = strchr(buffer + 1, ':'); + if (ptr) { + ptr++; + message = Conn_EncodingTo(Idx, ptr); + if (message != ptr) + strlcpy(ptr, message, sizeof(buffer) - (ptr - buffer)); + } +#endif + #ifdef SNIFFER if (NGIRCd_Sniffer) Log(LOG_DEBUG, " -> connection %d: '%s'.", Idx, buffer); @@ -1366,7 +1376,7 @@ Count_Connections(ng_ipaddr_t *a) * @returns Accepted socket descriptor or -1 on error. */ static int -New_Connection(int Sock, bool IsSSL) +New_Connection(int Sock, UNUSED bool IsSSL) { #ifdef TCPWRAP struct request_info req; @@ -2069,7 +2079,8 @@ New_Server( int Server , ng_ipaddr_t *dest) Client_SetToken( c, TOKEN_OUTBOUND ); /* Register connection */ - Conf_SetServer(Server, new_sock); + if (!Conf_SetServer(Server, new_sock)) + return; My_Connections[new_sock].sock = new_sock; My_Connections[new_sock].addr = *dest; My_Connections[new_sock].client = c; @@ -2109,6 +2120,11 @@ Init_Conn_Struct(CONN_ID Idx) My_Connections[Idx].lastdata = now; My_Connections[Idx].lastprivmsg = now; Proc_InitStruct(&My_Connections[Idx].proc_stat); + +#ifdef ICONV + My_Connections[Idx].iconv_from = (iconv_t)(-1); + My_Connections[Idx].iconv_to = (iconv_t)(-1); +#endif } /* Init_Conn_Struct */