comparison mcabber/src/screen.c @ 1296:7a0eaa53bd53

Further nick colors fixes (right length computation with different locale than utf-8, proper loading of colors on startup)
author Michal 'vorner' Vaner <vorner@ucw.cz>
date Tue, 28 Aug 2007 14:36:44 +0200
parents 33cb828282d5
children af035a304bec
comparison
equal deleted inserted replaced
1295:33cb828282d5 1296:7a0eaa53bd53
519 while (*end && (*end != ' ') && (*end != '\t')) 519 while (*end && (*end != ' ') && (*end != '\t'))
520 end++; 520 end++;
521 if (!end) 521 if (!end)
522 ended = true; 522 ended = true;
523 *end = '\0'; 523 *end = '\0';
524 int cl = color_to_color_fg(FindColorInternal(ncolors)); 524 int cl = get_user_color(ncolors);
525 if (cl < 0) { 525 if (cl < 0) {
526 scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors); 526 scr_LogPrint(LPRINT_NORMAL, "Unknown color %s", ncolors);
527 } else { 527 } else {
528 nickcols = g_realloc(nickcols, (++nickcolcount) * sizeof *nickcols); 528 nickcols = g_realloc(nickcols, (++nickcolcount) * sizeof *nickcols);
529 nickcols[nickcolcount-1] = cl; 529 nickcols[nickcolcount-1] = cl;
1201 char *text_locale; 1201 char *text_locale;
1202 int dont_show = FALSE; 1202 int dont_show = FALSE;
1203 int special; 1203 int special;
1204 guint num_history_blocks; 1204 guint num_history_blocks;
1205 bool setmsgflg = FALSE; 1205 bool setmsgflg = FALSE;
1206 char *nicktmp, *nicklocaltmp;
1206 1207
1207 // Look for the window entry. 1208 // Look for the window entry.
1208 special = (winId == NULL); 1209 special = (winId == NULL);
1209 win_entry = scr_SearchWindow(winId, special); 1210 win_entry = scr_SearchWindow(winId, special);
1210 1211
1229 num_history_blocks = 0U; 1230 num_history_blocks = 0U;
1230 else 1231 else
1231 num_history_blocks = get_max_history_blocks(); 1232 num_history_blocks = get_max_history_blocks();
1232 1233
1233 text_locale = from_utf8(text); 1234 text_locale = from_utf8(text);
1235 //Convert the nick alone and compute its length
1236 if (mucnicklen) {
1237 nicktmp = g_strndup(text, mucnicklen);
1238 nicklocaltmp = from_utf8(nicktmp);
1239 mucnicklen = strlen(nicklocaltmp);
1240 g_free(nicklocaltmp);
1241 g_free(nicktmp);
1242 }
1234 hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags, 1243 hbuf_add_line(&win_entry->bd->hbuf, text_locale, timestamp, prefix_flags,
1235 maxX - Roster_Width - getprefixwidth(), num_history_blocks, mucnicklen); 1244 maxX - Roster_Width - getprefixwidth(), num_history_blocks, mucnicklen);
1236 g_free(text_locale); 1245 g_free(text_locale);
1237 1246
1238 if (win_entry->bd->cleared) { 1247 if (win_entry->bd->cleared) {