changeset 1357:7bbfb0073f88

Fix an UTF-8 problem in new hook_execute_internal() function There could be a double UTF-8 encoding, if the user has a non-utf8 locale. BTW improve bindcommand() -- unnecessary string duplication.
author Mikael Berthe <mikael@lilotux.net>
date Sun, 11 Nov 2007 11:29:16 +0100
parents 7794d76ca90e
children 005df14df743
files mcabber/src/hooks.c mcabber/src/screen.c
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/src/hooks.c	Sat Nov 10 23:23:44 2007 +0100
+++ b/mcabber/src/hooks.c	Sun Nov 11 11:29:16 2007 +0100
@@ -348,8 +348,8 @@
   buf = g_strdup_printf("Running %s...", hookname);
   scr_LogPrint(LPRINT_LOGNORM, "%s", buf);
 
-  cmdline = g_strdup_printf(mkcmdstr("%s"), hook_command);
-  process_command(hook_command, TRUE); // XXX Note: /quit won't work.
+  cmdline = from_utf8(hook_command);
+  process_command(cmdline, TRUE); // XXX Note: /quit won't work.
 
   g_free(cmdline);
   g_free(buf);
--- a/mcabber/src/screen.c	Sat Nov 10 23:23:44 2007 +0100
+++ b/mcabber/src/screen.c	Sun Nov 11 11:29:16 2007 +0100
@@ -3678,13 +3678,10 @@
   boundcmd = settings_get(SETTINGS_TYPE_BINDING, asciikey);
 
   if (boundcmd) {
-    gchar *cmdline, *boundcmd_locale;
-    boundcmd_locale = from_utf8(boundcmd);
-    cmdline = g_strdup_printf(mkcmdstr("%s"), boundcmd_locale);
+    gchar *cmdline = from_utf8(boundcmd);
     scr_CheckAutoAway(TRUE);
     if (process_command(cmdline, TRUE))
       return 255; // Quit
-    g_free(boundcmd_locale);
     g_free(cmdline);
     return 0;
   }