Don't use charsets by default (#117).
authorJelmer Vernooij <jelmer@samba.org>
Thu, 12 Apr 2007 22:57:43 +0000 (00:57 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 12 Apr 2007 22:57:43 +0000 (00:57 +0200)
NEWS
src/client.c
src/isupport.c
src/network.c
src/network.h
src/settings.h

diff --git a/NEWS b/NEWS
index 8a8d3dff299573035c59d05109612310bd3a3475..064b9f6b0905780a62685ae3c667481eee2502d4 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -47,6 +47,10 @@ Ctrlproxy 3.0.2 UNRELEASED
 
        * Handle disconnects of clients properly (#108)
 
+       * Fix handling of non-UTF8 characters in linestack_file.
+
+       * Don't use CHARSETs by default (#117).
+
   FEATURES
 
     * More advanced help support
index 48f8e7613a53fd7ff466d06dc040b09b06d638f1..9f5c7b50a4ca5f0e202d3df5bf19c27b05adfb67 100644 (file)
@@ -637,11 +637,16 @@ void kill_pending_clients(const char *reason)
 gboolean client_set_charset(struct client *c, const char *name)
 {
        GIConv tmp;
-       tmp = g_iconv_open(name, "UTF-8");
 
-       if (tmp == (GIConv)-1) {
-               log_client(LOG_WARNING, c, "Unable to find charset `%s'", name);
-               return FALSE;
+       if (name != NULL) {
+               tmp = g_iconv_open(name, "UTF-8");
+
+               if (tmp == (GIConv)-1) {
+                       log_client(LOG_WARNING, c, "Unable to find charset `%s'", name);
+                       return FALSE;
+               }
+       } else {
+               tmp = (GIConv)-1;
        }
        
        if (c->outgoing_iconv != (GIConv)-1)
@@ -649,10 +654,15 @@ gboolean client_set_charset(struct client *c, const char *name)
 
        c->outgoing_iconv = tmp;
 
-       tmp = g_iconv_open("UTF-8", name);
-       if (tmp == (GIConv)-1) {
-               log_client(LOG_WARNING, c, "Unable to find charset `%s'", name);
-               return FALSE;
+       if (name != NULL) {
+               tmp = g_iconv_open("UTF-8", name);
+
+               if (tmp == (GIConv)-1) {
+                       log_client(LOG_WARNING, c, "Unable to find charset `%s'", name);
+                       return FALSE;
+               }
+       } else {
+               tmp = (GIConv)-1;
        }
 
        if (c->incoming_iconv != (GIConv)-1)
index 60699d25f5b0473a1f79544331af717d6ee667e4..93d36a8811232b44385e1dff58e2d03dac3c0ec7 100644 (file)
@@ -433,7 +433,6 @@ gboolean is_prefix(char p, const struct network_info *n)
 const char *get_charset(const struct network_info *n)
 {
        g_assert(n != NULL);
-       g_assert(n->charset != NULL);
        return n->charset;
 }
 
index 978adfa7a9c0153dec62e89f1b1cba3bd9bb2784..933145120204b6d7b8336c9d8a120a38f5279589 100644 (file)
@@ -84,11 +84,16 @@ static void server_send_login (struct network *s)
 gboolean network_set_charset(struct network *n, const char *name)
 {
        GIConv tmp;
-       tmp = g_iconv_open(name, "UTF-8");
 
-       if (tmp == (GIConv)-1) {
-               log_network(LOG_WARNING, n, "Unable to find charset `%s'", name);
-               return FALSE;
+       if (name != NULL) {
+               tmp = g_iconv_open(name, "UTF-8");
+
+               if (tmp == (GIConv)-1) {
+                       log_network(LOG_WARNING, n, "Unable to find charset `%s'", name);
+                       return FALSE;
+               }
+       } else {
+               tmp = (GIConv)-1;
        }
        
        if (n->connection.outgoing_iconv != (GIConv)-1)
@@ -96,10 +101,14 @@ gboolean network_set_charset(struct network *n, const char *name)
 
        n->connection.outgoing_iconv = tmp;
 
-       tmp = g_iconv_open("UTF-8", name);
-       if (tmp == (GIConv)-1) {
-               log_network(LOG_WARNING, n, "Unable to find charset `%s'", name);
-               return FALSE;
+       if (name != NULL) {
+               tmp = g_iconv_open("UTF-8", name);
+               if (tmp == (GIConv)-1) {
+                       log_network(LOG_WARNING, n, "Unable to find charset `%s'", name);
+                       return FALSE;
+               }
+       } else {
+               tmp = (GIConv)-1;
        }
 
        if (n->connection.incoming_iconv != (GIConv)-1)
index e1e73a9d4e9be5dd0de49141c475390513a237af..a14d093b2f88ac5bf47170973aa82b81b7a55be9 100644 (file)
@@ -33,6 +33,8 @@
 #include "isupport.h"
 #include <sys/socket.h>
 
+#define DEFAULT_NETWORK_CHARSET NULL
+
 struct global;
 struct network;
 struct client;
index a4abcfc37cf03109fd610c44e2a6d330ff957bf4..6d81e633e3c1886c38c6fed8e633637c1d6afc1f 100644 (file)
@@ -25,7 +25,7 @@
  * @brief Settings
  */
 
-#define DEFAULT_CLIENT_CHARSET "UTF-8"
+#define DEFAULT_CLIENT_CHARSET NULL
 
 /**
  * Configuration for a particular channel