irc: send whole IRC message including IRCv3 tags in the signals irc_in, irc_in2, irc_raw_in and irc_raw_in2 (issue #787)

v2.8-utf8proc
Sébastien Helleu 2018-03-25 20:05:12 +02:00
parent aaad4ca6e5
commit c90572babe
8 changed files with 89 additions and 61 deletions

View File

@ -28,7 +28,8 @@ Improvements::
Bug fixes::
* irc: fix memory leak when receiving a message with tags
* irc: send whole IRC message including IRCv3 tags in the signals irc_in, irc_in2, irc_raw_in and irc_raw_in2 (issue #787)
* irc: fix memory leak when receiving a message with IRCv3 tags
Documentation::

View File

@ -9210,24 +9210,28 @@ List of signals sent by WeeChat and plugins:
| irc | xxx,irc_in_yyy ^(1)^ |
String: message. |
IRC message from server (before irc plugin uses it,
signal sent only if message is *not* ignored).
signal sent only if message is *not* ignored). +
Since version 2.2, the whole IRC message is sent, including tags.
| irc | xxx,irc_in2_yyy ^(1)^ |
String: message. |
IRC message from server (after irc plugin uses it,
signal sent only if message is *not* ignored).
signal sent only if message is *not* ignored). +
Since version 2.2, the whole IRC message is sent, including tags.
| irc | xxx,irc_raw_in_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
String: message. |
IRC message from server (before irc plugin uses it,
signal sent even if message is ignored).
signal sent even if message is ignored). +
Since version 2.2, the whole IRC message is sent, including tags.
| irc | xxx,irc_raw_in2_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
String: message. |
IRC message from server (after irc plugin uses it,
signal sent even if message is ignored).
signal sent even if message is ignored). +
Since version 2.2, the whole IRC message is sent, including tags.
| irc | xxx,irc_out1_yyy ^(1)^ +
_(WeeChat ≥ 0.3.7)_ |

View File

@ -9393,24 +9393,32 @@ Liste des signaux envoyés par WeeChat et les extensions :
| irc | xxx,irc_in_yyy ^(1)^ |
Chaîne : message. |
Message IRC du serveur (avant utilisation par l'extension irc,
signal envoyé uniquement si le message n'est *pas* ignoré).
signal envoyé uniquement si le message n'est *pas* ignoré). +
Depuis la version 2.2, le message IRC entier est envoyé, en incluant
les étiquettes.
| irc | xxx,irc_in2_yyy ^(1)^ |
Chaîne : message. |
Message IRC du serveur (après utilisation par l'extension irc,
signal envoyé uniquement si le message n'est *pas* ignoré).
signal envoyé uniquement si le message n'est *pas* ignoré). +
Depuis la version 2.2, le message IRC entier est envoyé, en incluant
les étiquettes.
| irc | xxx,irc_raw_in_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
Chaîne : message. |
Message IRC du serveur (avant utilisation par l'extension irc,
signal envoyé même si le message est ignoré).
signal envoyé même si le message est ignoré). +
Depuis la version 2.2, le message IRC entier est envoyé, en incluant
les étiquettes.
| irc | xxx,irc_raw_in2_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
Chaîne : message. |
Message IRC du serveur (après utilisation par l'extension irc,
signal envoyé même si le message est ignoré).
signal envoyé même si le message est ignoré). +
Depuis la version 2.2, le message IRC entier est envoyé, en incluant
les étiquettes.
| irc | xxx,irc_out1_yyy ^(1)^ +
_(WeeChat ≥ 0.3.7)_ |

View File

@ -9509,31 +9509,39 @@ List of signals sent by WeeChat and plugins:
String: comma-separated list of scripts removed. |
Scheme script(s) removed.
// TRANSLATION MISSING
| irc | xxx,irc_in_yyy ^(1)^ |
String: messaggio. |
Messaggio IRC dal server (prima di essere utilizzato
dal plugin irc, il segnale viene inviato solo se il
messaggio *non* viene ignorato).
messaggio *non* viene ignorato). +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_in2_yyy ^(1)^ |
String: messaggio. |
Messaggio IRC dal server (dopo essere stato
utilizzato dal plugin irc, il segnale viene inviato
solo se il messaggio *non* viene ignorato).
solo se il messaggio *non* viene ignorato). +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_raw_in_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
String: messaggio. |
Messaggio IRC dal server (prima di essere utilizzato
dal plugin irc, il segnale viene inviato anche se il
messaggio è stato ignorato).
messaggio è stato ignorato). +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_raw_in2_yyy ^(1)^ +
_(WeeChat ≥ 0.3.2)_ |
String: messaggio. |
Messaggio IRC dal server (dopo essere stato
utilizzato dal plugin irc, il segnale viene inviato
anche se il messaggio è stato ignorato).
anche se il messaggio è stato ignorato). +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_out1_yyy ^(1)^ +

View File

@ -9212,27 +9212,35 @@ WeeChat とプラグインが送信するシグナルのリスト:
String: 削除されたスクリプトへのパスのコンマ区切りリスト |
Scheme スクリプトを削除
// TRANSLATION MISSING
| irc | xxx,irc_in_yyy ^(1)^ |
String: メッセージ |
サーバから IRC メッセージを受信 (メッセージを *無視しない* 場合のみ irc
プラグインがメッセージを処理する前に、シグナルが送信される)
プラグインがメッセージを処理する前に、シグナルが送信される) +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_in2_yyy ^(1)^ |
String: メッセージ |
サーバから IRC メッセージを受信 (メッセージを *無視しない* 場合のみ irc
プラグインがメッセージを処理した後に、シグナルが送信される)
プラグインがメッセージを処理した後に、シグナルが送信される) +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_raw_in_yyy ^(1)^ +
_(WeeChat バージョン 0.3.2 以上で利用可)_ |
String: メッセージ |
サーバから IRC メッセージを受信 (メッセージを無視する場合でも irc
プラグインがメッセージを処理する前に、シグナルが送信される)
プラグインがメッセージを処理する前に、シグナルが送信される) +
Since version 2.2, the whole IRC message is sent, including tags.
// TRANSLATION MISSING
| irc | xxx,irc_raw_in2_yyy ^(1)^ +
_(WeeChat バージョン 0.3.2 以上で利用可)_ |
String: メッセージ |
サーバから IRC メッセージを受信 (メッセージを無視する場合でも irc
プラグインがメッセージを処理した後に、シグナルが送信される)
プラグインがメッセージを処理した後に、シグナルが送信される) +
Since version 2.2, the whole IRC message is sent, including tags.
| irc | xxx,irc_out1_yyy ^(1)^ +
_(WeeChat バージョン 0.3.7 以上で利用可)_ |

View File

@ -5874,16 +5874,15 @@ irc_protocol_get_message_tag_time (struct t_hashtable *tags)
void
irc_protocol_recv_command (struct t_irc_server *server,
const char *irc_message,
const char *msg_tags,
const char *msg_command,
const char *msg_channel)
{
int i, cmd_found, return_code, argc, decode_color, keep_trailing_spaces;
int message_ignored;
char *dup_irc_message, *pos_space;
char *message_colors_decoded, *pos_space, *tags;
struct t_irc_channel *ptr_channel;
t_irc_recv_func *cmd_recv_func;
const char *cmd_name;
const char *cmd_name, *ptr_msg_after_tags;
time_t date;
const char *nick1, *address1, *host1;
char *nick, *address, *address_color, *host, *host_no_color, *host_color;
@ -6045,29 +6044,48 @@ irc_protocol_recv_command (struct t_irc_server *server,
if (!msg_command)
return;
dup_irc_message = NULL;
message_colors_decoded = NULL;
argv = NULL;
argv_eol = NULL;
hash_tags = NULL;
date = 0;
ptr_msg_after_tags = irc_message;
/* get tags as hashtable */
if (msg_tags)
if (irc_message && (irc_message[0] == '@'))
{
hash_tags = irc_protocol_get_message_tags (msg_tags);
if (hash_tags)
date = irc_protocol_get_message_tag_time (hash_tags);
pos_space = strchr (irc_message, ' ');
if (pos_space)
{
tags = weechat_strndup (irc_message + 1,
pos_space - (irc_message + 1));
if (tags)
{
hash_tags = irc_protocol_get_message_tags (tags);
if (hash_tags)
date = irc_protocol_get_message_tag_time (hash_tags);
free (tags);
}
ptr_msg_after_tags = pos_space;
while (ptr_msg_after_tags[0] == ' ')
{
ptr_msg_after_tags++;
}
}
else
ptr_msg_after_tags = NULL;
}
/* get nick/host/address from IRC message */
nick1 = NULL;
address1 = NULL;
host1 = NULL;
if (irc_message && (irc_message[0] == ':'))
if (ptr_msg_after_tags && (ptr_msg_after_tags[0] == ':'))
{
nick1 = irc_message_get_nick_from_host (irc_message);
address1 = irc_message_get_address_from_host (irc_message);
host1 = irc_message + 1;
nick1 = irc_message_get_nick_from_host (ptr_msg_after_tags);
address1 = irc_message_get_address_from_host (ptr_msg_after_tags);
host1 = ptr_msg_after_tags + 1;
}
nick = (nick1) ? strdup (nick1) : NULL;
address = (address1) ? strdup (address1) : NULL;
@ -6155,23 +6173,23 @@ irc_protocol_recv_command (struct t_irc_server *server,
if (cmd_recv_func != NULL)
{
if (irc_message)
if (ptr_msg_after_tags)
{
if (decode_color)
{
dup_irc_message = irc_color_decode (
irc_message,
message_colors_decoded = irc_color_decode (
ptr_msg_after_tags,
weechat_config_boolean (irc_config_network_colors_receive));
}
else
{
dup_irc_message = strdup (irc_message);
message_colors_decoded = strdup (ptr_msg_after_tags);
}
}
else
dup_irc_message = NULL;
argv = weechat_string_split (dup_irc_message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (dup_irc_message, " ",
message_colors_decoded = NULL;
argv = weechat_string_split (message_colors_decoded, " ", 0, 0, &argc);
argv_eol = weechat_string_split (message_colors_decoded, " ",
1 + keep_trailing_spaces, 0, NULL);
return_code = (int) (cmd_recv_func) (server,
@ -6217,8 +6235,8 @@ end:
free (host_no_color);
if (host_color)
free (host_color);
if (dup_irc_message)
free (dup_irc_message);
if (message_colors_decoded)
free (message_colors_decoded);
if (argv)
weechat_string_free_split (argv);
if (argv_eol)

View File

@ -87,7 +87,6 @@ extern const char *irc_protocol_tags (const char *command, const char *tags,
const char *nick, const char *address);
extern void irc_protocol_recv_command (struct t_irc_server *server,
const char *irc_message,
const char *msg_tags,
const char *msg_command,
const char *msg_channel);

View File

@ -2848,8 +2848,8 @@ void
irc_server_msgq_flush ()
{
struct t_irc_message *next;
char *ptr_data, *new_msg, *new_msg2, *ptr_msg, *ptr_msg2, *ptr_msg3, *pos;
char *tags, *nick, *host, *command, *channel, *arguments;
char *ptr_data, *new_msg, *new_msg2, *ptr_msg, *ptr_msg2, *pos;
char *nick, *host, *command, *channel, *arguments;
char *msg_decoded, *msg_decoded_without_color;
char str_modifier[128], modifier_data[256];
int pos_channel, pos_text, pos_decode;
@ -2914,7 +2914,7 @@ irc_server_msgq_flush ()
}
irc_message_parse (irc_recv_msgq->server, ptr_msg,
&tags, NULL, &nick, &host,
NULL, NULL, &nick, &host,
&command, &channel, &arguments,
NULL, NULL, NULL,
&pos_channel, &pos_text);
@ -3001,25 +3001,9 @@ irc_server_msgq_flush ()
else
{
/* message not redirected, display it */
ptr_msg3 = ptr_msg2;
if (ptr_msg3[0] == '@')
{
/* skip tags in message */
ptr_msg3 = strchr (ptr_msg3, ' ');
if (ptr_msg3)
{
while (ptr_msg3[0] == ' ')
{
ptr_msg3++;
}
}
else
ptr_msg3 = ptr_msg2;
}
irc_protocol_recv_command (
irc_recv_msgq->server,
ptr_msg3,
tags,
ptr_msg2,
command,
channel);
}
@ -3027,8 +3011,6 @@ irc_server_msgq_flush ()
if (new_msg2)
free (new_msg2);
if (tags)
free (tags);
if (nick)
free (nick);
if (host)