From 073dff330d1a735b0d39d6b22a4469e5c1efa773 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 19 Oct 2010 21:19:42 +0200 Subject: Fix use of flags for irc_server_sendf in signal irc_input_send --- src/plugins/irc/irc-input.c | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index e6206ad28..f88b69786 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -75,7 +75,7 @@ irc_input_user_message_display (struct t_gui_buffer *buffer, const char *text) } /* - * irc_input_send_user_message: send a PRIVMSG message, and split it it message + * irc_input_send_user_message: send a PRIVMSG message, and split it if message * size is > 512 bytes * Warning: this function makes temporarirly * changes in "message" @@ -143,21 +143,17 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags, } /* - * irc_input_data_cb: callback for input data in a buffer + * irc_input_data: input data in a buffer */ int -irc_input_data_cb (void *data, struct t_gui_buffer *buffer, - const char *input_data) +irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags) { const char *ptr_data; char *data_with_colors, *msg; IRC_BUFFER_GET_SERVER_CHANNEL(buffer); - /* make C compiler happy */ - (void) data; - if (buffer == irc_raw_buffer) { if (weechat_strcasecmp (input_data, "q") == 0) @@ -173,9 +169,10 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, && !weechat_string_input_for_buffer (input_data)) { if (ptr_server) - irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + { + irc_server_sendf (ptr_server, flags, NULL, weechat_utf8_next_char (input_data)); + } return WEECHAT_RC_OK; } @@ -190,10 +187,7 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, msg = strdup ((data_with_colors) ? data_with_colors : ptr_data); if (msg) { - irc_input_send_user_message (buffer, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, - NULL, - msg); + irc_input_send_user_message (buffer, flags, NULL, msg); free (msg); } @@ -211,6 +205,20 @@ irc_input_data_cb (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_OK; } +/* + * irc_input_data_cb: callback for input data in a buffer + */ + +int +irc_input_data_cb (void *data, struct t_gui_buffer *buffer, + const char *input_data) +{ + /* make C compiler happy */ + (void) data; + + return irc_input_data (buffer, input_data, IRC_SERVER_SEND_OUTQ_PRIO_HIGH); +} + /* * irc_input_send_cb: callback for "irc_input_send" signal * This signal can be used by other plugins/scripts, it @@ -290,13 +298,13 @@ irc_input_send_cb (void *data, const char *signal, } } - flags_value = 0; + flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH; if (flags) { error = NULL; flags_value = strtol (flags, &error, 10); if (flags_value < 0) - flags_value = 0; + flags_value = IRC_SERVER_SEND_OUTQ_PRIO_HIGH; } if (server && ptr_message) @@ -319,7 +327,7 @@ irc_input_send_cb (void *data, const char *signal, if (weechat_string_input_for_buffer (ptr_message)) { /* text as input */ - irc_input_data_cb (NULL, ptr_buffer, ptr_message); + irc_input_data (ptr_buffer, ptr_message, flags_value); } else { -- cgit v1.2.3