diff options
Diffstat (limited to 'src/plugins/irc')
-rw-r--r-- | src/plugins/irc/irc-command.c | 37 | ||||
-rw-r--r-- | src/plugins/irc/irc-ctcp.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-input.c | 7 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 18 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.h | 1 |
5 files changed, 55 insertions, 15 deletions
diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 77becfdc7..31a7eb4bb 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -370,7 +370,8 @@ irc_command_me_channel_message (struct t_irc_server *server, list_messages = irc_server_sendf ( server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST + | IRC_SERVER_SEND_MULTILINE, NULL, "PRIVMSG %s :\01ACTION%s%s\01", channel_name, @@ -3839,7 +3840,9 @@ IRC_COMMAND_CALLBACK(msg) 1); /* decode_colors */ } irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "PRIVMSG %s :%s", ptr_channel->name, argv_eol[arg_text]); } @@ -3860,7 +3863,9 @@ IRC_COMMAND_CALLBACK(msg) 1); /* decode_colors */ } irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "PRIVMSG %s :%s", targets[i], argv_eol[arg_text]); } @@ -4034,7 +4039,8 @@ IRC_COMMAND_CALLBACK(notice) list_messages = irc_server_sendf ( ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH | IRC_SERVER_SEND_RETURN_LIST + | IRC_SERVER_SEND_MULTILINE, NULL, "NOTICE %s :%s", argv[arg_target], argv_eol[arg_text]); @@ -4587,7 +4593,9 @@ IRC_COMMAND_CALLBACK(query) argv_eol[arg_text], 1); /* decode_colors */ } - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, NULL, "PRIVMSG %s :%s", nicks[i], argv_eol[arg_text]); @@ -4696,14 +4704,20 @@ IRC_COMMAND_CALLBACK(quote) ptr_server = irc_server_search (argv[2]); if (!ptr_server || (ptr_server->sock < 0)) WEECHAT_COMMAND_ERROR; - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "%s", argv_eol[3]); } else { if (!ptr_server || (ptr_server->sock < 0)) WEECHAT_COMMAND_ERROR; - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "%s", argv_eol[1]); } @@ -6668,7 +6682,10 @@ IRC_COMMAND_CALLBACK(wallchops) * if WALLCHOPS is supported, or if STATUSMSG includes '@', * then send a notice to @#channel */ - irc_server_sendf (ptr_server, IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + irc_server_sendf (ptr_server, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "NOTICE @%s :%s", ptr_channel->name, argv_eol[pos_args]); } @@ -6687,7 +6704,9 @@ IRC_COMMAND_CALLBACK(wallchops) ptr_server->nick) != 0)) { irc_server_sendf (ptr_server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "NOTICE %s :%s", ptr_nick->name, argv_eol[pos_args]); } diff --git a/src/plugins/irc/irc-ctcp.c b/src/plugins/irc/irc-ctcp.c index 996784d9a..b161d4bc1 100644 --- a/src/plugins/irc/irc-ctcp.c +++ b/src/plugins/irc/irc-ctcp.c @@ -370,7 +370,8 @@ irc_ctcp_reply_to_nick (struct t_irc_server *server, list_messages = irc_server_sendf ( server, - IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_LIST, + IRC_SERVER_SEND_OUTQ_PRIO_LOW | IRC_SERVER_SEND_RETURN_LIST + | IRC_SERVER_SEND_MULTILINE, NULL, "NOTICE %s :\01%s%s%s\01", nick, @@ -1602,7 +1603,9 @@ irc_ctcp_send (struct t_irc_server *server, const char *target, const char *type, const char *args) { irc_server_sendf (server, - IRC_SERVER_SEND_OUTQ_PRIO_HIGH, NULL, + IRC_SERVER_SEND_OUTQ_PRIO_HIGH + | IRC_SERVER_SEND_MULTILINE, + NULL, "PRIVMSG %s :\01%s%s%s\01", target, type, diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index 6071396c0..73c999e8c 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -319,7 +319,8 @@ irc_input_send_user_message (struct t_gui_buffer *buffer, int flags, return; } list_messages = irc_server_sendf (ptr_server, - flags | IRC_SERVER_SEND_RETURN_LIST, + flags | IRC_SERVER_SEND_RETURN_LIST + | IRC_SERVER_SEND_MULTILINE, tags, "PRIVMSG %s :%s", ptr_channel->name, message); @@ -386,7 +387,9 @@ irc_input_data (struct t_gui_buffer *buffer, const char *input_data, int flags, { if (ptr_server) { - irc_server_sendf (ptr_server, flags, NULL, + irc_server_sendf (ptr_server, + flags | IRC_SERVER_SEND_MULTILINE, + NULL, "%s", weechat_utf8_next_char (input_data)); } return WEECHAT_RC_OK; diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index 4ec8a856c..74bd49555 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -3174,8 +3174,8 @@ struct t_arraylist * irc_server_sendf (struct t_irc_server *server, int flags, const char *tags, const char *format, ...) { - char hash_key[32], *nick, *command, *channel, *new_msg; - char str_modifier[128]; + char hash_key[32], *nick, *command, *channel, *new_msg, str_modifier[128]; + char *pos; const char *str_message, *str_args, *ptr_msg; int number, multiline; struct t_hashtable *hashtable; @@ -3200,6 +3200,20 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags, list_messages = NULL; } + if (!(flags & IRC_SERVER_SEND_MULTILINE)) + { + /* + * if multiline is not allowed, we stop at first \r or \n in the + * message, and everything after is ignored + */ + pos = strchr (vbuffer, '\r'); + if (pos) + pos[0] = '\0'; + pos = strchr (vbuffer, '\n'); + if (pos) + pos[0] = '\0'; + } + /* run modifier "irc_out1_xxx" (like "irc_out_xxx", but before split) */ irc_message_parse (server, vbuffer, diff --git a/src/plugins/irc/irc-server.h b/src/plugins/irc/irc-server.h index e779aee36..2b6b652d7 100644 --- a/src/plugins/irc/irc-server.h +++ b/src/plugins/irc/irc-server.h @@ -140,6 +140,7 @@ enum t_irc_server_option #define IRC_SERVER_SEND_OUTQ_PRIO_HIGH (1 << 1) #define IRC_SERVER_SEND_OUTQ_PRIO_LOW (1 << 2) #define IRC_SERVER_SEND_RETURN_LIST (1 << 3) +#define IRC_SERVER_SEND_MULTILINE (1 << 4) /* version strings */ #define IRC_SERVER_VERSION_CAP "302" |