Further nick colors fixes
authorMichal 'vorner' Vaner <vorner@ucw.cz>
Tue, 28 Aug 2007 14:36:44 +0200
changeset 1296 7a0eaa53bd53
parent 1295 33cb828282d5
child 1297 60663a1f9e8d
Further nick colors fixes (right length computation with different locale than utf-8, proper loading of colors on startup)
mcabber/src/screen.c
--- a/mcabber/src/screen.c	Tue Aug 28 11:24:58 2007 +0200
+++ b/mcabber/src/screen.c	Tue Aug 28 14:36:44 2007 +0200
@@ -521,7 +521,7 @@
         if (!end)
           ended = true;
         *end = '\0';
-        int cl = color_to_color_fg(FindColorInternal(ncolors));
+        int cl = get_user_color(ncolors);
         if (cl < 0) {
           scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors);
         } else {
@@ -1203,6 +1203,7 @@
   int special;
   guint num_history_blocks;
   bool setmsgflg = FALSE;
+  char *nicktmp, *nicklocaltmp;
 
   // Look for the window entry.
   special = (winId == NULL);
@@ -1231,6 +1232,14 @@
     num_history_blocks = get_max_history_blocks();
 
   text_locale = from_utf8(text);
+  //Convert the nick alone and compute its length
+  if (mucnicklen) {
+    nicktmp = g_strndup(text, mucnicklen);
+    nicklocaltmp = from_utf8(nicktmp);
+    mucnicklen = strlen(nicklocaltmp);
+    g_free(nicklocaltmp);
+    g_free(nicktmp);
+  }
   hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags,
                 maxX - Roster_Width - getprefixwidth(), num_history_blocks, mucnicklen);
   g_free(text_locale);