diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-01-06 22:24:54 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-01-06 22:24:54 +0000 |
commit | bbe2f9093c00471f993c08abd8084af673182459 (patch) | |
tree | b7a66ef0d8083158e517b01b7737691e0a2d4719 /src/gui/curses | |
parent | 09efc5333f5a75d5d0374e51b739b4260b4be6c1 (diff) | |
download | weechat-bbe2f9093c00471f993c08abd8084af673182459.zip |
Fixed bugs with charset: now decodes/encodes nicks and channels in IRC messages (bug #18716)
Diffstat (limited to 'src/gui/curses')
-rw-r--r-- | src/gui/curses/gui-curses-input.c | 25 | ||||
-rw-r--r-- | src/gui/curses/gui-curses-nicklist.c | 11 |
2 files changed, 27 insertions, 9 deletions
diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c index 55b57119e..0e1c1349e 100644 --- a/src/gui/curses/gui-curses-input.c +++ b/src/gui/curses/gui-curses-input.c @@ -90,11 +90,11 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick) { case 'c': if (CHANNEL(window->buffer)) - length += utf8_strlen (CHANNEL(window->buffer)->name); + length += utf8_width_screen (CHANNEL(window->buffer)->name); else { if (SERVER(window->buffer)) - length += utf8_strlen (SERVER(window->buffer)->name); + length += utf8_width_screen (SERVER(window->buffer)->name); } pos++; break; @@ -108,7 +108,7 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick) pos++; break; case 'n': - length += utf8_strlen (nick); + length += utf8_width_screen (nick); pos++; break; default: @@ -148,7 +148,7 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick) void gui_input_draw_prompt (t_gui_window *window, char *nick) { - char *pos, saved_char; + char *pos, saved_char, *buf; int char_size; wmove (GUI_CURSES(window)->win_input, 0, 0); @@ -166,8 +166,12 @@ gui_input_draw_prompt (t_gui_window *window, char *nick) { gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT_CHANNEL); + buf = weechat_iconv_from_internal (NULL, + CHANNEL(window->buffer)->name); wprintw (GUI_CURSES(window)->win_input, "%s", - CHANNEL(window->buffer)->name); + (buf) ? buf : CHANNEL(window->buffer)->name); + if (buf) + free (buf); } else { @@ -175,8 +179,12 @@ gui_input_draw_prompt (t_gui_window *window, char *nick) { gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT_SERVER); + buf = weechat_iconv_from_internal (NULL, + SERVER(window->buffer)->name); wprintw (GUI_CURSES(window)->win_input, "%s", - SERVER(window->buffer)->name); + (buf) ? buf : SERVER(window->buffer)->name); + if (buf) + free (buf); } } pos++; @@ -198,7 +206,10 @@ gui_input_draw_prompt (t_gui_window *window, char *nick) case 'n': gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT_NICK); - wprintw (GUI_CURSES(window)->win_input, "%s", nick); + buf = weechat_iconv_from_internal (NULL, nick); + wprintw (GUI_CURSES(window)->win_input, "%s", (buf) ? buf : nick); + if (buf) + free (buf); pos++; break; default: diff --git a/src/gui/curses/gui-curses-nicklist.c b/src/gui/curses/gui-curses-nicklist.c index f6dc3aeb5..7c3c9efb3 100644 --- a/src/gui/curses/gui-curses-nicklist.c +++ b/src/gui/curses/gui-curses-nicklist.c @@ -24,8 +24,11 @@ #include "config.h" #endif +#include <stdlib.h> + #include "../../common/weechat.h" #include "../gui.h" +#include "../../common/util.h" #include "../../common/weeconfig.h" #include "../../irc/irc.h" #include "gui-curses.h" @@ -40,7 +43,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size) { t_gui_window *ptr_win; int i, j, x, y, x2, column, max_length, nicks_displayed; - char format[32], format_empty[32]; + char format[32], format_empty[32], *buf; t_irc_nick *ptr_nick; if (!gui_ok || !BUFFER_HAS_NICKLIST(buffer)) @@ -203,7 +206,11 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size) gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, ((cfg_irc_away_check > 0) && (ptr_nick->flags & NICK_AWAY)) ? COLOR_WIN_NICK_AWAY : COLOR_WIN_NICK); - mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, format, ptr_nick->nick); + buf = weechat_iconv_from_internal (NULL, ptr_nick->nick); + mvwprintw (GUI_CURSES(ptr_win)->win_nick, y, x, format, + (buf) ? buf : ptr_nick->nick); + if (buf) + free (buf); ptr_nick = ptr_nick->next_nick; |