CVS: sylpheedclaws/sylpheed-claws/src jpilot.c,1.18.2.19,1.18.2.20

[email protected] Tue, 19 Dec 2006 20:02:20 +0000
Newsgroups gmane.mail.sylpheed.claws.cvs
Message-ID <[email protected]>
Update of /pack/anoncvs/sylpheedclaws/sylpheed-claws/src
In directory sunsite.dk:/tmp/cvs-serv29138/src

Modified Files:
      Tag: gtk2
	jpilot.c 
Log Message:
2006-12-19 [colin]	2.6.1cvs55

	* src/jpilot.c
		Same as before, without depending on
		pisock >= 0.12

Index: jpilot.c
===================================================================
RCS file: /pack/anoncvs/sylpheedclaws/sylpheed-claws/src/jpilot.c,v
retrieving revision 1.18.2.19
retrieving revision 1.18.2.20
diff -u -d -r1.18.2.19 -r1.18.2.20
--- jpilot.c	2006/12/19 18:08:45	1.18.2.19
+++ jpilot.c	2006/12/19 20:02:04	1.18.2.20
@@ -38,13 +38,11 @@
 #include <netinet/in.h>
 
 #ifdef HAVE_LIBPISOCK_PI_ARGS_H
-#  include <libpisock/pi-util.h>
 #  include <libpisock/pi-args.h>
 #  include <libpisock/pi-appinfo.h>
 #  include <libpisock/pi-address.h>
 #  include <libpisock/pi-version.h>
 #else
-#  include <pi-util.h>
 #  include <pi-args.h>
 #  include <pi-appinfo.h>
 #  include <pi-address.h>
@@ -160,6 +158,19 @@
 
 gboolean convert_charcode = TRUE;
 
+static const gchar *jpilot_get_charset(void)
+{
+	static const gchar *charset = NULL;
+
+	if (charset == NULL)
+		charset = getenv("PILOT_CHARSET");
+
+	if (charset == NULL)
+		charset = CS_CP1252;
+	
+	return charset;
+}
+
 /*
 * Create new pilot file object.
 * \return Initialized JPilot file object.
@@ -1105,14 +1116,9 @@
 			addritem_email_set_address( email, node->data );
 			if (convert_charcode) {
 				gchar *convertBuff = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-				convert_FromPilotChar(CS_INTERNAL, labelEntry, 
-						strlen(labelEntry), &convertBuff);
-#else
 				convertBuff = conv_codeset_strdup( labelEntry, 
-						conv_get_locale_charset_str_no_utf8(), 
+						jpilot_get_charset(), 
 						CS_INTERNAL );
-#endif
 				if (convertBuff)
 					addritem_email_set_remarks( email, convertBuff );
 				g_free( convertBuff );
@@ -1210,14 +1216,9 @@
 
 	if( convert_charcode ) {
 		gchar *nameConv = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-		convert_FromPilotChar(CS_INTERNAL, fullName, 
-				strlen(fullName), &nameConv);
-#else
 		nameConv = conv_codeset_strdup( fullName, 
-				conv_get_locale_charset_str_no_utf8(), 
+				jpilot_get_charset(), 
 				CS_INTERNAL );
-#endif
 		if (nameConv)
 			strncpy2( fullName, nameConv, FULLNAME_BUFSIZE );
 		g_free( nameConv );
@@ -1383,14 +1384,9 @@
 
 				if( convert_charcode ) {
 					gchar *convertBuff = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-					convert_FromPilotChar(CS_INTERNAL, labelName, 
-							strlen(labelName), &convertBuff);
-#else
 					convertBuff = conv_codeset_strdup( labelName, 
-							conv_get_locale_charset_str_no_utf8(), 
+							jpilot_get_charset(), 
 							CS_INTERNAL );
-#endif
 					if (convertBuff) {
 						labelName = convertBuff;
 					}
@@ -1429,14 +1425,9 @@
 			if( labelName ) {
 				if( convert_charcode ) {
 					gchar *convertBuff = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-					convert_FromPilotChar(CS_INTERNAL, labelName, 
-							strlen(labelName), &convertBuff);
-#else
 					convertBuff = conv_codeset_strdup( labelName, 
-							conv_get_locale_charset_str_no_utf8(), 
+							jpilot_get_charset(), 
 							CS_INTERNAL );
-#endif
 					if (convertBuff) {
 						labelName = convertBuff;
 					}
@@ -1530,14 +1521,9 @@
 				if( *labelName != '\0' ) {
 					if( convert_charcode ) {
 						gchar *convertBuff = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-						convert_FromPilotChar(CS_INTERNAL, labelName, 
-								strlen(labelName), &convertBuff);
-#else
 						convertBuff = conv_codeset_strdup( labelName, 
-								conv_get_locale_charset_str_no_utf8(), 
+								jpilot_get_charset(), 
 								CS_INTERNAL );
-#endif
 						if (convertBuff) {
 							labelName = convertBuff;
 						}
@@ -1596,14 +1582,9 @@
 
 		if( convert_charcode ) {
 			gchar *convertBuff = NULL;
-#if (PILOT_LINK_MAJOR > 11)
-			convert_FromPilotChar(CS_INTERNAL, cat->name[i], 
-					strlen(cat->name[i]), &convertBuff);
-#else
 			convertBuff = conv_codeset_strdup( cat->name[i], 
-					conv_get_locale_charset_str_no_utf8(), 
+					jpilot_get_charset(), 
 					CS_INTERNAL );
-#endif
 			if (convertBuff) {
 				addritem_folder_set_name( folder, convertBuff );
 				g_free( convertBuff );