diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/irc/irc-protocol.c | 24 | ||||
-rw-r--r-- | src/plugins/irc/irc-protocol.h | 3 | ||||
-rw-r--r-- | src/plugins/irc/irc-server.c | 30 |
3 files changed, 16 insertions, 41 deletions
diff --git a/src/plugins/irc/irc-protocol.c b/src/plugins/irc/irc-protocol.c index 15e4cee62..fd167d471 100644 --- a/src/plugins/irc/irc-protocol.c +++ b/src/plugins/irc/irc-protocol.c @@ -4341,12 +4341,10 @@ irc_protocol_is_numeric_command (const char *str) void irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line, - const char *host, const char *command, - const char *arguments) + const char *command) { int i, cmd_found, return_code, argc, decode_color; - char *pos, *nick; - char *dup_entire_line, *dup_host, *dup_arguments, *irc_message; + char *dup_entire_line; t_irc_recv_func *cmd_recv_func; const char *cmd_name; char **argv, **argv_eol; @@ -4535,16 +4533,6 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line, dup_entire_line = NULL; argv = weechat_string_explode (dup_entire_line, " ", 0, 0, &argc); argv_eol = weechat_string_explode (dup_entire_line, " ", 1, 0, NULL); - dup_host = (host) ? strdup (host) : NULL; - dup_arguments = (arguments) ? strdup (arguments) : NULL; - - pos = (dup_host) ? strchr (dup_host, '!') : NULL; - if (pos) - pos[0] = '\0'; - nick = (dup_host) ? strdup (dup_host) : NULL; - if (pos) - pos[0] = '!'; - irc_message = strdup (dup_entire_line); return_code = (int) (cmd_recv_func) (server, cmd_name, argc, argv, argv_eol); @@ -4565,16 +4553,8 @@ irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line, /* send signal with received command */ irc_server_send_signal (server, "irc_in2", command, entire_line); - if (irc_message) - free (irc_message); - if (nick) - free (nick); if (dup_entire_line) free (dup_entire_line); - if (dup_host) - free (dup_host); - if (dup_arguments) - free (dup_arguments); if (argv) weechat_string_free_exploded (argv); if (argv_eol) diff --git a/src/plugins/irc/irc-protocol.h b/src/plugins/irc/irc-protocol.h index cfaa5a23c..db1fe18b4 100644 --- a/src/plugins/irc/irc-protocol.h +++ b/src/plugins/irc/irc-protocol.h @@ -73,7 +73,6 @@ extern const char *irc_protocol_get_nick_from_host (const char *host); extern const char *irc_protocol_tags (const char *command, const char *tags); extern void irc_protocol_recv_command (struct t_irc_server *server, const char *entire_line, - const char *host, const char *command, - const char *arguments); + const char *command); #endif /* irc-protocol.h */ diff --git a/src/plugins/irc/irc-server.c b/src/plugins/irc/irc-server.c index c4b77dabc..ded43fa79 100644 --- a/src/plugins/irc/irc-server.c +++ b/src/plugins/irc/irc-server.c @@ -1287,7 +1287,6 @@ void irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg) { struct t_irc_message *message; - char *data_without_weechat_colors; if (!server->unterminated_message && !msg[0]) return; @@ -1324,14 +1323,6 @@ irc_server_msgq_add_msg (struct t_irc_server *server, const char *msg) else message->data = strdup (msg); - /* replace WeeChat internal color codes by "?" */ - data_without_weechat_colors = weechat_string_remove_color (message->data, "?"); - if (data_without_weechat_colors) - { - free (message->data); - message->data = data_without_weechat_colors; - } - message->next_message = NULL; if (irc_msgq_last_msg) @@ -1432,7 +1423,8 @@ irc_server_msgq_flush () { struct t_irc_message *next; char *ptr_data, *new_msg, *ptr_msg, *pos; - char *nick, *host, *command, *channel, *arguments, *msg_decoded; + char *nick, *host, *command, *channel; + char *msg_decoded, *msg_decoded_without_color; char str_modifier[64], modifier_data[256], *ptr_chan_nick; while (irc_recv_msgq) @@ -1485,7 +1477,7 @@ irc_server_msgq_flush () irc_server_parse_message (ptr_msg, &nick, &host, &command, &channel, - &arguments); + NULL); /* convert charset for message */ ptr_chan_nick = (channel) ? channel : nick; @@ -1509,12 +1501,16 @@ irc_server_msgq_flush () modifier_data, ptr_msg); + /* replace WeeChat internal color codes by "?" */ + msg_decoded_without_color = + weechat_string_remove_color ((msg_decoded) ? msg_decoded : ptr_msg, + "?"); + /* parse and execute command */ irc_protocol_recv_command (irc_recv_msgq->server, - (msg_decoded) ? msg_decoded : ptr_msg, - host, - command, - arguments); + (msg_decoded_without_color) ? + msg_decoded_without_color : ((msg_decoded) ? msg_decoded : ptr_msg), + command); if (nick) free (nick); @@ -1524,10 +1520,10 @@ irc_server_msgq_flush () free (command); if (channel) free (channel); - if (arguments) - free (arguments); if (msg_decoded) free (msg_decoded); + if (msg_decoded_without_color) + free (msg_decoded_without_color); if (pos) { |