mirror of
https://github.com/weechat/weechat.git
synced 2026-07-03 00:03:12 +02:00
irc: fix unexpected message sent to server when part of the second line of an IRC command (closes #1992)
This commit is contained in:
@@ -56,6 +56,7 @@ Bug fixes::
|
||||
* fset: remove extra spaces between min and max values when second format is used
|
||||
* fset: fix mouse actions when second format is used
|
||||
* fset: apply option fset.color.help_description (issue #1988)
|
||||
* irc: fix unexpected message sent to server when part of the second line of an IRC command (issue #1992)
|
||||
* irc: fix autojoin of channels when private buffers are opened (issue #2012)
|
||||
* irc: fix string comparison when CASEMAPPING is set to "ascii"
|
||||
* irc: fix display of country code in message 344 received as whois geo info (issue #1736)
|
||||
|
||||
@@ -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]);
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user