Convert /rawxml argument to UTF8
authorMikael Berthe <mikael@lilotux.net>
Wed, 28 Sep 2005 21:56:35 +0200
changeset 461 1d8f5b3a5f2b
parent 460 b1910d8821ab
child 462 d580e87c11ed
Convert /rawxml argument to UTF8
mcabber/src/commands.c
mcabber/src/jabglue.c
--- a/mcabber/src/commands.c	Wed Sep 28 00:00:14 2005 +0200
+++ b/mcabber/src/commands.c	Wed Sep 28 21:56:35 2005 +0200
@@ -902,10 +902,17 @@
 static void do_rawxml(char *arg)
 {
   if (!strncasecmp(arg, "send ", 5))  {
+    gchar *buffer;
     for (arg += 5; *arg && *arg == ' '; arg++)
       ;
+    buffer = g_locale_to_utf8(arg, -1, NULL, NULL, NULL);
+    if (!buffer) {
+      scr_LogPrint(LPRINT_NORMAL, "Conversion error in XML string");
+      return;
+    }
     scr_LogPrint(LPRINT_NORMAL, "Sending XML string");
-    jb_send_raw(arg);
+    jb_send_raw(buffer);
+    g_free(buffer);
   } else {
     scr_LogPrint(LPRINT_NORMAL, "Please read the manual page"
                  " before using /rawxml :-)");
--- a/mcabber/src/jabglue.c	Wed Sep 28 00:00:14 2005 +0200
+++ b/mcabber/src/jabglue.c	Wed Sep 28 21:56:35 2005 +0200
@@ -175,7 +175,7 @@
 
 void jb_send_raw(const char *str)
 {
-  if (jc && online)
+  if (jc && online && str)
     jab_send_raw(jc, str);
 }