]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conn-encoding.c
Specify session context for OpenSSL clients
[ngircd-alex.git] / src / ngircd / conn-encoding.c
index 71ab58848a5aa87d258f85156ab98021d5c0cd7a..412a85dcb297117d0801b07d85de3ead26667155 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
+ * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Functions to deal with character encodings and conversions
  */
 
-#include "imp.h"
 #include <assert.h>
 #include <stdio.h>
 #include <string.h>
+#include <strings.h>
 
-#include "defines.h"
 #include "conn.h"
-#include "log.h"
-
-#include "exp.h"
-#include "conn-encoding.h"
 
 #ifdef ICONV
 
-char Encoding_Buffer[COMMAND_LEN];
+#include "log.h"
+#include "conn-encoding.h"
 
+char Encoding_Buffer[COMMAND_LEN];
 char *Convert_Message PARAMS((iconv_t Handle, char *Message));
 
-
 /**
  * Set client character encoding on a connection.
  *
@@ -123,9 +119,9 @@ Convert_Message(iconv_t Handle, char *Message)
        out_left = sizeof(Encoding_Buffer) - 1;
 
        if (iconv(Handle, &Message, &in_left, &out, &out_left) == (size_t)(-1)) {
-               /* An error occured! */
+               /* An error occurred! */
                LogDebug("Error converting message encoding!");
-               strlcpy(Encoding_Buffer, Message, sizeof(Encoding_Buffer));
+               strlcpy(out, Message, sizeof(Encoding_Buffer));
                iconv(Handle, NULL, NULL, NULL, NULL);
        } else
                *out = '\0';
@@ -133,7 +129,7 @@ Convert_Message(iconv_t Handle, char *Message)
        return Encoding_Buffer;
 }
 
-#endif
+#endif /* ICONV */
 
 /**
  * Convert encoding of a message received from a connection.