diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2006-08-07 22:26:55 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2006-08-07 22:26:55 +0000 |
commit | 1d211a16da60819b769e0805329dd218fa43b8e0 (patch) | |
tree | 4a3a08515b899c99532a1c643a0dd86a748c8020 /src/gui/curses/gui-curses-input.c | |
parent | f8c913a77ac493b4823bd7e9c64eff0b2aef67d8 (diff) | |
download | weechat-1d211a16da60819b769e0805329dd218fa43b8e0.zip |
Added missing modes (channel & user), now all modes are allowed (bug #16606), added "%m" for completion with self nick (on current server)
Diffstat (limited to 'src/gui/curses/gui-curses-input.c')
-rw-r--r-- | src/gui/curses/gui-curses-input.c | 44 |
1 files changed, 12 insertions, 32 deletions
diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c index 72b7c816d..d173f6416 100644 --- a/src/gui/curses/gui-curses-input.c +++ b/src/gui/curses/gui-curses-input.c @@ -25,6 +25,7 @@ #endif #include <stdlib.h> +#include <string.h> #include "../../common/weechat.h" #include "../gui.h" @@ -73,8 +74,8 @@ gui_input_set_color (t_gui_window *window, int irc_color) int gui_input_get_prompt_length (t_gui_window *window, char *nick) { - char *pos, saved_char, *modes; - int char_size, length, mode_found; + char *pos, saved_char; + int char_size, length; length = 0; pos = cfg_look_input_format; @@ -99,18 +100,9 @@ gui_input_get_prompt_length (t_gui_window *window, char *nick) case 'm': if (SERVER(window->buffer)) { - mode_found = 0; - for (modes = SERVER(window->buffer)->nick_modes; - modes && modes[0]; modes++) - { - if (modes[0] != ' ') - { - length++; - mode_found = 1; - } - } - if (mode_found) - length++; + if (SERVER(window->buffer)->nick_modes + && SERVER(window->buffer)->nick_modes[0]) + length += strlen (SERVER(window->buffer)->nick_modes); } pos++; break; @@ -155,8 +147,8 @@ 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, *modes; - int char_size, mode_found; + char *pos, saved_char; + int char_size; wmove (GUI_CURSES(window)->win_input, 0, 0); pos = cfg_look_input_format; @@ -191,25 +183,13 @@ gui_input_draw_prompt (t_gui_window *window, char *nick) case 'm': if (SERVER(window->buffer)) { - mode_found = 0; - for (modes = SERVER(window->buffer)->nick_modes; - modes && modes[0]; modes++) - { - if (modes[0] != ' ') - mode_found = 1; - } - if (mode_found) + if (SERVER(window->buffer)->nick_modes + && SERVER(window->buffer)->nick_modes[0]) { gui_window_set_weechat_color (GUI_CURSES(window)->win_input, COLOR_WIN_INPUT); - wprintw (GUI_CURSES(window)->win_input, "+"); - for (modes = SERVER(window->buffer)->nick_modes; - modes && modes[0]; modes++) - { - if (modes[0] != ' ') - wprintw (GUI_CURSES(window)->win_input, "%c", - modes[0]); - } + wprintw (GUI_CURSES(window)->win_input, "%s", + SERVER(window->buffer)->nick_modes); } } pos++; |