diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2005-12-17 11:54:41 +0000 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2005-12-17 11:54:41 +0000 |
commit | 04fda8a3147b78213f79f53ccdff93c6f6959a3d (patch) | |
tree | a4d769156c2d389ee7c5ff065dd8ecf095857b41 /src | |
parent | d5b58ff068c601906c83524b91b7d5aea666faa0 (diff) | |
download | weechat-04fda8a3147b78213f79f53ccdff93c6f6959a3d.zip |
Fixed FIFO pipe buffer detection, away message (301) now displayed in query if
exists, otherwise on server buffer
Diffstat (limited to 'src')
-rw-r--r-- | src/common/command.c | 42 | ||||
-rw-r--r-- | src/common/command.h | 2 | ||||
-rw-r--r-- | src/common/fifo.c | 22 | ||||
-rw-r--r-- | src/gui/gui-action.c | 2 | ||||
-rw-r--r-- | src/gui/gui-keyboard.c | 2 | ||||
-rw-r--r-- | src/irc/irc-recv.c | 9 | ||||
-rw-r--r-- | src/plugins/plugins-interface.c | 9 |
7 files changed, 48 insertions, 40 deletions
diff --git a/src/common/command.c b/src/common/command.c index ff497169a..cc7c3469a 100644 --- a/src/common/command.c +++ b/src/common/command.c @@ -741,8 +741,9 @@ exec_weechat_command (t_gui_window *window, t_irc_server *server, char *string) */ void -user_command (t_gui_window *window, t_irc_server *server, char *command) +user_command (t_gui_buffer *buffer, t_irc_server *server, char *command) { + t_gui_window *ptr_window; t_irc_nick *ptr_nick; int plugin_args_length; char *command_with_colors, *command_with_colors2, *plugin_args; @@ -750,47 +751,56 @@ user_command (t_gui_window *window, t_irc_server *server, char *command) if ((!command) || (!command[0]) || (command[0] == '\r') || (command[0] == '\n')) return; + if (!buffer) + { + buffer = gui_current_window->buffer; + ptr_window = gui_current_window; + } + else + { + ptr_window = gui_buffer_find_window (buffer); + if (!ptr_window) + ptr_window = gui_current_window; + } + if ((command[0] == '/') && (command[1] != '/')) { /* WeeChat internal command (or IRC command) */ - (void) exec_weechat_command (window, server, command); + (void) exec_weechat_command (ptr_window, server, command); } else { - if (!window) - window = gui_current_window; - if ((command[0] == '/') && (command[1] == '/')) command++; - if (server && (!BUFFER_IS_SERVER(window->buffer))) + if (server && (!BUFFER_IS_SERVER(buffer))) { command_with_colors = (cfg_irc_colors_send) ? (char *)gui_color_encode ((unsigned char *)command) : NULL; - if (CHANNEL(window->buffer)->dcc_chat) - dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(window->buffer)->dcc_chat), + if (CHANNEL(buffer)->dcc_chat) + dcc_chat_sendf ((t_irc_dcc *)(CHANNEL(buffer)->dcc_chat), "%s\r\n", (command_with_colors) ? command_with_colors : command); else server_sendf (server, "PRIVMSG %s :%s\r\n", - CHANNEL(window->buffer)->name, + CHANNEL(buffer)->name, (command_with_colors) ? command_with_colors : command); command_with_colors2 = (command_with_colors) ? (char *)gui_color_decode ((unsigned char *)command_with_colors, 1) : NULL; - if (CHANNEL(window->buffer)->type == CHANNEL_TYPE_PRIVATE) + if (CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE) { - gui_printf_type (window->buffer, + gui_printf_type (buffer, MSG_TYPE_NICK, "%s<%s%s%s> ", GUI_COLOR(COLOR_WIN_CHAT_DARK), GUI_COLOR(COLOR_WIN_NICK_SELF), server->nick, GUI_COLOR(COLOR_WIN_CHAT_DARK)); - gui_printf_type (window->buffer, + gui_printf_type (buffer, MSG_TYPE_MSG, "%s%s\n", GUI_COLOR(COLOR_WIN_CHAT), @@ -799,12 +809,12 @@ user_command (t_gui_window *window, t_irc_server *server, char *command) } else { - ptr_nick = nick_search (CHANNEL(window->buffer), server->nick); + ptr_nick = nick_search (CHANNEL(buffer), server->nick); if (ptr_nick) { - irc_display_nick (CHANNEL(window->buffer)->buffer, ptr_nick, NULL, + irc_display_nick (CHANNEL(buffer)->buffer, ptr_nick, NULL, MSG_TYPE_NICK, 1, 1, 0); - gui_printf (CHANNEL(window->buffer)->buffer, + gui_printf (CHANNEL(buffer)->buffer, "%s\n", (command_with_colors2) ? command_with_colors2 : command); @@ -3176,7 +3186,7 @@ weechat_cmd_uptime (t_gui_window *window, int argc, char **argv) sec, ctime (&weechat_start_time)); string[strlen (string) - 1] = '\0'; - user_command (window, SERVER(window->buffer), string); + user_command (window->buffer, SERVER(window->buffer), string); } else { diff --git a/src/common/command.h b/src/common/command.h index 4d9d7fcd0..759a9dada 100644 --- a/src/common/command.h +++ b/src/common/command.h @@ -67,7 +67,7 @@ extern void alias_free_all (); extern char **explode_string (char *, char *, int, int *); extern void free_exploded_string (char **); extern int exec_weechat_command (t_gui_window *, t_irc_server *, char *); -extern void user_command (t_gui_window *, t_irc_server *, char *); +extern void user_command (t_gui_buffer *, t_irc_server *, char *); extern int weechat_cmd_alias (t_gui_window *, char *); extern int weechat_cmd_buffer (t_gui_window *, int, char **); extern int weechat_cmd_charset (t_gui_window *, int, char **); diff --git a/src/common/fifo.c b/src/common/fifo.c index c53987796..d4a2384d6 100644 --- a/src/common/fifo.c +++ b/src/common/fifo.c @@ -148,19 +148,16 @@ fifo_exec (char *text) WEECHAT_WARNING, text); return; } - if (ptr_server) + if (ptr_server && pos) { - if (pos) + ptr_channel = channel_search (ptr_server, pos + 1); + if (!ptr_channel) { - ptr_channel = channel_search (ptr_server, pos + 1); - if (!ptr_channel) - { - irc_display_prefix (NULL, NULL, PREFIX_ERROR); - gui_printf (NULL, - _("%s channel \"%s\" not found (FIFO pipe data)\n"), - WEECHAT_WARNING, pos + 1); - return; - } + irc_display_prefix (NULL, NULL, PREFIX_ERROR); + gui_printf (NULL, + _("%s channel \"%s\" not found (FIFO pipe data)\n"), + WEECHAT_WARNING, pos + 1); + return; } } } @@ -174,8 +171,7 @@ fifo_exec (char *text) ptr_buffer = gui_buffers; } - user_command (gui_buffer_find_window (ptr_buffer), - ptr_server, pos_msg); + user_command (ptr_buffer, ptr_server, pos_msg); } /* diff --git a/src/gui/gui-action.c b/src/gui/gui-action.c index f84af7ced..6f705d527 100644 --- a/src/gui/gui-action.c +++ b/src/gui/gui-action.c @@ -108,7 +108,7 @@ gui_action_return (t_gui_window *window) window->buffer->completion.position = -1; window->buffer->ptr_history = NULL; gui_draw_buffer_input (window->buffer, 0); - user_command (window, SERVER(window->buffer), command); + user_command (window->buffer, SERVER(window->buffer), command); free (command); } } diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index 556962f3c..e933ebff2 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -517,7 +517,7 @@ gui_key_pressed (char *key_str) /* exact combo found => execute function or command */ gui_key_buffer[0] = '\0'; if (ptr_key->command) - user_command (gui_current_window, + user_command (gui_current_window->buffer, SERVER(gui_current_window->buffer), ptr_key->command); else diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index bb0eeb359..bb89d1d71 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -2537,6 +2537,8 @@ int irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) { char *pos_nick, *pos_message; + t_irc_channel *ptr_channel; + t_gui_buffer *ptr_buffer; /* make gcc happy */ (void) server; @@ -2560,8 +2562,11 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *nick, char *arguments) if (!command_ignored) { - irc_display_prefix (server, gui_current_window->buffer, PREFIX_INFO); - gui_printf (gui_current_window->buffer, + /* look for private buffer to display message */ + ptr_channel = channel_search (server, pos_nick); + ptr_buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer; + irc_display_prefix (server, ptr_buffer, PREFIX_INFO); + gui_printf (ptr_buffer, _("%s%s%s is away: %s\n"), GUI_COLOR(COLOR_WIN_CHAT_NICK), pos_nick, diff --git a/src/plugins/plugins-interface.c b/src/plugins/plugins-interface.c index 13aaf06a4..fd6cd0672 100644 --- a/src/plugins/plugins-interface.c +++ b/src/plugins/plugins-interface.c @@ -290,14 +290,11 @@ weechat_plugin_exec_command (t_weechat_plugin *plugin, plugin_find_server_channel (server, channel, &ptr_server, &ptr_channel); if (ptr_server && ptr_channel) - user_command (gui_buffer_find_window (ptr_channel->buffer), - ptr_server, command); + user_command (ptr_channel->buffer, ptr_server, command); else if (ptr_server && (ptr_server->buffer)) - user_command (gui_buffer_find_window (ptr_server->buffer), - ptr_server, command); + user_command (ptr_server->buffer, ptr_server, command); else - user_command (gui_buffer_find_window (gui_buffers), - NULL, command); + user_command (gui_buffers, NULL, command); } /* |