1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-09 03:03:12 +02:00

irc: add support of tags in messages, add support of "server-time" capability (task #12255)

For a server called "znc" in WeeChat, following command will enable the
"server-time" capability:

/set irc.server.znc.capabilities "znc.in/server-time"
This commit is contained in:
Sebastien Helleu
2012-11-23 21:31:22 +01:00
parent 777f977ea5
commit 53b8cdfef3
26 changed files with 1959 additions and 1625 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.4.0-dev, 2012-11-22
v0.4.0-dev, 2012-11-23
Version 0.4.0 (under dev!)
@@ -32,6 +32,8 @@ Version 0.4.0 (under dev!)
aspell.check.suggestions (task #12061)
* aspell: fix creation of spellers when number of dictionaries is different
between two buffers
* irc: add support of "server-time" capability (task #12255)
* irc: add support of tags in messages
* irc: fix crash on /upgrade (free channels before server data when a server
is destroyed) (bug #37736)
* irc: fix crash when decoding IRC colors in strings (bug #37704)
@@ -2,7 +2,7 @@
|========================================
| Erweiterung | Name | Beschreibung | Hashtable (Eingabe) | Hashtable (Ausgabe)
| irc | irc_message_parse | Parse eine IRC Nachricht | "message": IRC Nachricht, "server": Servername (optional) | "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (beinhaltet Channel)
| irc | irc_message_parse | Parse eine IRC Nachricht | "message": IRC Nachricht, "server": Servername (optional) | "tags": tags, "message_without_tags": message without the tags, "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel)
| irc | irc_message_split | dient zum Aufteilen einer überlangen IRC Nachricht (in maximal 512 Bytes große Nachrichten) | "message": IRC Nachricht, "server": Servername (optional) | "msg1" ... "msgN": Nachrichten die versendet werden sollen (ohne abschließendes "\r\n"), "args1" ... "argsN": Argumente für Nachrichten, "count": Anzahl der Nachrichten
@@ -2,7 +2,7 @@
|========================================
| Plugin | Name | Description | Hashtable (input) | Hashtable (output)
| irc | irc_message_parse | parse an IRC message | "message": IRC message, "server": server name (optional) | "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel)
| irc | irc_message_parse | parse an IRC message | "message": IRC message, "server": server name (optional) | "tags": tags, "message_without_tags": message without the tags, "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel)
| irc | irc_message_split | split an IRC message (to fit in 512 bytes) | "message": IRC message, "server": server name (optional) | "msg1" ... "msgN": messages to send (without final "\r\n"), "args1" ... "argsN": arguments of messages, "count": number of messages
@@ -2,7 +2,7 @@
|========================================
| Extension | Nom | Description | Hashtable (entrée) | Hashtable (sortie)
| irc | irc_message_parse | analyse un message IRC | "message": message IRC, "server": nom du serveur (optionnel) | "nick": pseudo, "host": nom d'hôte, "command": commande, "channel": canal, "arguments": paramètres (inclut le canal)
| irc | irc_message_parse | analyse un message IRC | "message": message IRC, "server": nom du serveur (optionnel) | "tags": étiquettes, "message_without_tags": message sans les étiquettes, "nick": pseudo, "host": nom d'hôte, "command": commande, "channel": canal, "arguments": paramètres (inclut le canal)
| irc | irc_message_split | découper un message IRC (pour tenir dans les 512 octets) | "message": message IRC, "server": nom du serveur (optionnel) | "msg1" ... "msgN": messages à envoyer (sans le "\r\n" final), "args1" ... "argsN": paramètres des messages, "count": nombre de messages
@@ -2,7 +2,7 @@
|========================================
| Plugin | Nome | Descrizione | Tabella hash (input) | Tabella hash (output)
| irc | irc_message_parse | controlla un messaggio IRC | "message": messaggio IRC, "server": nome server (opzionale) | "nick": nick, "host": nome host, "command": comando, "channel": canale, "arguments": argomenti (include il canale)
| irc | irc_message_parse | controlla un messaggio IRC | "message": messaggio IRC, "server": nome server (opzionale) | "tags": tags, "message_without_tags": message without the tags, "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel)
| irc | irc_message_split | divide un messaggio IRC (per adattarlo in 512 byte) | "message": messaggio IRC, "server": nome server (opzionale) | "msg1" ... "msgN": messaggio da inviare (senza "\r\n" finale), "args1" ... "argsN": argomenti dei messaggi, "count": numero di messaggi
@@ -2,7 +2,7 @@
|========================================
| プラグイン | 名前 | 説明 | ハッシュテーブル (入力) | ハッシュテーブル (出力)
| irc | irc_message_parse | IRC メッセージを解析 | "message": IRC メッセージ、"server": サーバ名 (オプション) | "nick": ニックネーム、"host": ホスト名、"command": コマンド、"channel": チャンネル、"arguments": 引数 (チャンネルを含む)
| irc | irc_message_parse | IRC メッセージを解析 | "message": IRC メッセージ、"server": サーバ名 (オプション) | "tags": tags, "message_without_tags": message without the tags, "nick": nick, "host": host, "command": command, "channel": channel, "arguments": arguments (includes channel)
| irc | irc_message_split | IRC メッセージを分割 (512バイトに収める) | "message": IRC メッセージ、"server": サーバ名 (オプション) | "msg1" ... "msgN": 送信メッセージ (最後の "\r\n" は無し), "args1" ... "argsN": メッセージの引数、"count": メッセージの数
+4 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6280,8 +6280,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr ""
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": přezdívka, \"host\": host, \"command\": příkaz, \"channel\": "
+4 -2
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-05 13:19+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-11-04 15:41+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -6927,8 +6927,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"message\": IRC Nachricht, \"server\": Servername (optional)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
+4 -2
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6539,8 +6539,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"message\": mensaje IRC, \"server\": nombre del servidor (opcional)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": apodo, \"host\": host, \"command\": comando, \"channel\": canal, "
+5 -3
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"PO-Revision-Date: 2012-11-04 10:55+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-11-23 20:20+0100\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -6722,9 +6722,11 @@ msgstr "\"message\": message IRC, \"server\": nom du serveur (optionnel)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"tags\": étiquettes, \"message_without_tags\": message sans les étiquettes, "
"\"nick\": pseudo, \"host\": nom d'hôte, \"command\": commande, \"channel\": "
"canal, \"arguments\": paramètres (inclut le canal)"
+3 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5840,7 +5840,8 @@ msgstr ""
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
+4 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6540,8 +6540,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"message\": messaggio IRC, \"server\": nome server (opzionale)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": nick, \"host\": nome host, \"command\": comando, \"channel\": "
+4 -2
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -6390,8 +6390,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"message\": IRC メッセージ、\"server\": サーバ名 (オプション)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": ニックネーム、\"host\": ホスト名、\"command\": コマンド、\"channel"
+4 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:42+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -6505,8 +6505,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"message\": wiadomość IRC, \"server\": nazwa serwera (opcjonalne)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": nick, \"host\": host, \"komenda\": komenda, \"kanał\": kanał, "
+4 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:43+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5992,8 +5992,10 @@ msgid "\"message\": IRC message, \"server\": server name (optional)"
msgstr "\"mensagem\": mensagem IRC, \"servidor\": nome do servidor (opcional)"
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
#, fuzzy
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
"\"nick\": apelido, \"host\": host, \"command\": comando, \"channel\": canal, "
+3 -2
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.4.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: 2012-09-29 11:43+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -5864,7 +5864,8 @@ msgstr ""
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
+3 -2
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-11-04 11:49+0100\n"
"POT-Creation-Date: 2012-11-23 20:19+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -5068,7 +5068,8 @@ msgstr ""
#. TRANSLATORS: please do not translate key names (enclosed by quotes)
msgid ""
"\"nick\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"tags\": tags, \"message_without_tags\": message without the tags, \"nick"
"\": nick, \"host\": host, \"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"
msgstr ""
+131 -123
View File
@@ -111,6 +111,7 @@ irc_ctcp_get_reply (struct t_irc_server *server, const char *ctcp)
void
irc_ctcp_display_request (struct t_irc_server *server,
time_t date,
const char *command,
struct t_irc_channel *channel,
const char *nick, const char *ctcp,
@@ -122,21 +123,22 @@ irc_ctcp_display_request (struct t_irc_server *server,
&& !weechat_config_boolean (irc_config_look_display_ctcp_blocked))
return;
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
(channel) ? channel->buffer : NULL),
irc_protocol_tags (command, "irc_ctcp", NULL),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
IRC_COLOR_RESET,
(arguments) ? " " : "",
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command, "irc_ctcp", NULL),
_("%sCTCP requested by %s%s%s: %s%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL, nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
ctcp,
IRC_COLOR_RESET,
(arguments) ? " " : "",
(arguments) ? arguments : "",
(reply && !reply[0]) ? _(" (blocked)") : "");
}
/*
@@ -144,7 +146,7 @@ irc_ctcp_display_request (struct t_irc_server *server,
*/
void
irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
irc_ctcp_display_reply_from_nick (struct t_irc_server *server, time_t date,
const char *command, const char *nick,
char *arguments)
{
@@ -182,74 +184,77 @@ irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
difftime = ((sec2 * 1000000) + usec2) -
((sec1 * 1000000) + usec1);
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server,
nick,
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
NULL),
date,
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sCTCP reply from %s%s%s: %s%s%s "
"%ld.%ld %s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server,
NULL,
"ctcp",
NULL),
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sCTCP reply from %s%s%s: %s%s%s "
"%ld.%ld %s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server,
NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
difftime / 1000000,
(difftime % 1000000) / 1000,
(NG_("second", "seconds",
(difftime / 1000000))));
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
difftime / 1000000,
(difftime % 1000000) / 1000,
(NG_("second", "seconds",
(difftime / 1000000))));
pos_usec[0] = ' ';
}
}
else
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
NULL),
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
" ",
pos_args);
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
NULL),
date,
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
IRC_COLOR_RESET,
" ",
pos_args);
}
pos_space[0] = ' ';
}
else
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
NULL),
irc_protocol_tags (command, NULL, NULL),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
"",
"",
"");
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server, nick,
NULL, "ctcp",
NULL),
date,
irc_protocol_tags (command, NULL, NULL),
_("%sCTCP reply from %s%s%s: %s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server, NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
"",
"",
"");
}
if (pos_end)
@@ -895,7 +900,7 @@ irc_ctcp_recv_dcc (struct t_irc_server *server, const char *nick,
*/
void
irc_ctcp_recv (struct t_irc_server *server, const char *command,
irc_ctcp_recv (struct t_irc_server *server, time_t date, const char *command,
struct t_irc_channel *channel, const char *address,
const char *nick, const char *remote_nick, char *arguments,
char *message)
@@ -940,20 +945,21 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
irc_channel_nick_speaking_time_remove_old (channel);
irc_channel_nick_speaking_time_add (server, channel, nick,
time (NULL));
weechat_printf_tags (channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_message",
nick),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
(ptr_nick) ? ptr_nick->color : ((nick) ? irc_nick_find_color (nick) : IRC_COLOR_CHAT_NICK),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_printf_date_tags (channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_message",
nick),
"%s%s%s%s%s%s%s",
weechat_prefix ("action"),
irc_nick_mode_for_display (server, ptr_nick, 0),
(ptr_nick) ? ptr_nick->color : ((nick) ? irc_nick_find_color (nick) : IRC_COLOR_CHAT_NICK),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
else
{
@@ -977,20 +983,21 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
if (!ptr_channel->topic)
irc_channel_set_topic (ptr_channel, address);
weechat_printf_tags (ptr_channel->buffer,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_private",
nick),
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_printf_date_tags (ptr_channel->buffer,
date,
irc_protocol_tags (command,
(nick_is_me) ?
"irc_action,notify_none,no_highlight" :
"irc_action,notify_private",
nick),
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(nick_is_me) ?
IRC_COLOR_CHAT_NICK_SELF : irc_nick_color_for_pv (ptr_channel, nick),
nick,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
weechat_hook_signal_send ("irc_pv",
WEECHAT_HOOK_SIGNAL_STRING,
message);
@@ -1001,7 +1008,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
else if (strcmp (arguments + 1, "PING") == 0)
{
reply = irc_ctcp_get_reply (server, arguments + 1);
irc_ctcp_display_request (server, command, channel, nick,
irc_ctcp_display_request (server, date, command, channel, nick,
arguments + 1, pos_args, reply);
if (!reply || reply[0])
{
@@ -1020,7 +1027,7 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
reply = irc_ctcp_get_reply (server, arguments + 1);
if (reply)
{
irc_ctcp_display_request (server, command, channel, nick,
irc_ctcp_display_request (server, date, command, channel, nick,
arguments + 1, pos_args, reply);
if (reply[0])
@@ -1038,27 +1045,28 @@ irc_ctcp_recv (struct t_irc_server *server, const char *command,
{
if (weechat_config_boolean (irc_config_look_display_ctcp_unknown))
{
weechat_printf_tags (irc_msgbuffer_get_target_buffer (server,
nick,
weechat_printf_date_tags (irc_msgbuffer_get_target_buffer (server,
nick,
NULL,
"ctcp",
(channel) ? channel->buffer : NULL),
date,
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sUnknown CTCP requested by %s%s%s: "
"%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server,
NULL,
"ctcp",
(channel) ? channel->buffer : NULL),
irc_protocol_tags (command,
"irc_ctcp",
NULL),
_("%sUnknown CTCP requested by %s%s%s: "
"%s%s%s%s%s"),
weechat_prefix ("network"),
irc_nick_color_for_message (server,
NULL,
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
nick),
nick,
IRC_COLOR_RESET,
IRC_COLOR_CHAT_CHANNEL,
arguments + 1,
(pos_args) ? IRC_COLOR_RESET : "",
(pos_args) ? " " : "",
(pos_args) ? pos_args : "");
}
}
}
+6 -4
View File
@@ -31,12 +31,14 @@ struct t_irc_ctcp_reply
extern const char *irc_ctcp_get_default_reply (const char *ctcp);
extern void irc_ctcp_display_reply_from_nick (struct t_irc_server *server,
time_t date,
const char *command,
const char *nick,
char *arguments);
extern void irc_ctcp_recv (struct t_irc_server *server, const char *command,
struct t_irc_channel *channel, const char *address,
const char *nick, const char *remote_nick,
char *arguments, char *message);
extern void irc_ctcp_recv (struct t_irc_server *server, time_t date,
const char *command, struct t_irc_channel *channel,
const char *address, const char *nick,
const char *remote_nick, char *arguments,
char *message);
#endif /* __WEECHAT_IRC_CTCP_H */
+5 -3
View File
@@ -622,9 +622,11 @@ irc_info_init ()
N_("\"message\": IRC message, "
"\"server\": server name (optional)"),
/* TRANSLATORS: please do not translate key names (enclosed by quotes) */
N_("\"nick\": nick, \"host\": host, "
"\"command\": command, \"channel\": channel, "
"\"arguments\": arguments (includes channel)"),
N_("\"tags\": tags, \"message_without_tags\": "
"message without the tags, \"nick\": nick, "
"\"host\": host, \"command\": command, "
"\"channel\": channel, \"arguments\": "
"arguments (includes channel)"),
&irc_info_get_info_hashtable_cb, NULL);
weechat_hook_info_hashtable ("irc_message_split",
N_("split an IRC message (to fit in 512 bytes)"),
+168 -94
View File
@@ -32,17 +32,23 @@
/*
* irc_message_parse: parse IRC message and return pointer to host, command,
* channel, target nick and arguments (if any)
* irc_message_parse: parse IRC message and return pointer to tags, message
* without tags, host, command, channel, target nick and
* arguments (if any)
*/
void
irc_message_parse (struct t_irc_server *server, const char *message,
char **nick, char **host, char **command, char **channel,
char **tags, char **message_without_tags, char **nick,
char **host, char **command, char **channel,
char **arguments)
{
const char *pos, *pos2, *pos3, *pos4, *pos5;
const char *ptr_message, *pos, *pos2, *pos3, *pos4;
if (tags)
*tags = NULL;
if (message_without_tags)
*message_without_tags = NULL;
if (nick)
*nick = NULL;
if (host)
@@ -57,101 +63,126 @@ irc_message_parse (struct t_irc_server *server, const char *message,
if (!message)
return;
ptr_message = message;
/*
* we will use this message as example:
* :FlashCode!n=FlashCod@host.com PRIVMSG #channel :hello!
*
* @tags :FlashCode!n=flash@host.com PRIVMSG #channel :hello!
*/
if (message[0] == ':')
if (ptr_message[0] == '@')
{
pos2 = strchr (message, '!');
pos = strchr (message, ' ');
/*
* read tags (they are optional and enabled only if client enabled
* a server capability, see:
* http://ircv3.atheme.org/specification/message-tags-3.2)
*/
pos = strchr (ptr_message, ' ');
if (pos)
{
if (tags)
*tags = weechat_strndup (message + 1, pos - (message + 1));
ptr_message = pos + 1;
while (ptr_message[0] == ' ')
{
ptr_message++;
}
}
}
if (message_without_tags)
*message_without_tags = strdup (ptr_message);
/* now we have: ptr_message --> ":FlashCode!n=flash@host.com PRIVMSG #channel :hello!" */
if (ptr_message[0] == ':')
{
/* read host/nick */
pos2 = strchr (ptr_message, '!');
pos = strchr (ptr_message, ' ');
if (pos2 && (!pos || pos > pos2))
{
if (nick)
*nick = weechat_strndup (message + 1, pos2 - (message + 1));
*nick = weechat_strndup (ptr_message + 1, pos2 - (ptr_message + 1));
}
else if (pos)
{
if (nick)
*nick = weechat_strndup (message + 1, pos - (message + 1));
*nick = weechat_strndup (ptr_message + 1, pos - (ptr_message + 1));
}
if (pos)
{
if (host)
*host = weechat_strndup (message + 1, pos - (message + 1));
pos++;
}
else
pos = message;
}
else
pos = message;
/* pos is pointer on PRIVMSG #channel :hello! */
if (pos && pos[0])
{
while (pos[0] == ' ')
{
pos++;
}
pos2 = strchr (pos, ' ');
if (pos2)
{
/* pos2 is pointer on #channel :hello! */
if (command)
*command = weechat_strndup (pos, pos2 - pos);
pos2++;
while (pos2[0] == ' ')
*host = weechat_strndup (ptr_message + 1, pos - (ptr_message + 1));
ptr_message = pos + 1;
while (ptr_message[0] == ' ')
{
pos2++;
ptr_message++;
}
if (arguments)
*arguments = strdup (pos2);
if (pos2[0] != ':')
}
}
/* now we have: ptr_message --> "PRIVMSG #channel :hello!" */
if (ptr_message[0])
{
pos = strchr (ptr_message, ' ');
if (pos)
{
if (command)
*command = weechat_strndup (ptr_message, pos - ptr_message);
pos++;
while (pos[0] == ' ')
{
if (irc_channel_is_channel (server, pos2))
pos++;
}
/* now we have: pos --> "#channel :hello!" */
if (arguments)
*arguments = strdup (pos);
if (pos[0] != ':')
{
if (irc_channel_is_channel (server, pos))
{
pos3 = strchr (pos2, ' ');
pos2 = strchr (pos, ' ');
if (channel)
{
if (pos3)
*channel = weechat_strndup (pos2, pos3 - pos2);
if (pos2)
*channel = weechat_strndup (pos, pos2 - pos);
else
*channel = strdup (pos2);
*channel = strdup (pos);
}
}
else
{
pos3 = strchr (pos2, ' ');
pos2 = strchr (pos, ' ');
if (nick && !*nick)
{
if (pos3)
*nick = weechat_strndup (pos2, pos3 - pos2);
if (pos2)
*nick = weechat_strndup (pos, pos2 - pos);
else
*nick = strdup (pos2);
*nick = strdup (pos);
}
if (pos3)
if (pos2)
{
pos4 = pos3;
pos3++;
while (pos3[0] == ' ')
pos3 = pos2;
pos2++;
while (pos2[0] == ' ')
{
pos3++;
pos2++;
}
if (irc_channel_is_channel (server, pos3))
if (irc_channel_is_channel (server, pos2))
{
pos5 = strchr (pos3, ' ');
pos4 = strchr (pos2, ' ');
if (channel)
{
if (pos5)
*channel = weechat_strndup (pos3, pos5 - pos3);
if (pos4)
*channel = weechat_strndup (pos2, pos4 - pos2);
else
*channel = strdup (pos3);
*channel = strdup (pos2);
}
}
else if (channel && !*channel)
{
*channel = weechat_strndup (pos2, pos4 - pos2);
*channel = weechat_strndup (pos, pos3 - pos);
}
}
}
@@ -160,7 +191,7 @@ irc_message_parse (struct t_irc_server *server, const char *message,
else
{
if (command)
*command = strdup (pos);
*command = strdup (ptr_message);
}
}
}
@@ -176,12 +207,13 @@ struct t_hashtable *
irc_message_parse_to_hashtable (struct t_irc_server *server,
const char *message)
{
char *nick, *host, *command, *channel, *arguments;
char *tags,*message_without_tags, *nick, *host, *command, *channel;
char *arguments;
char empty_str[1] = { '\0' };
struct t_hashtable *hashtable;
irc_message_parse (server, message, &nick, &host, &command, &channel,
&arguments);
irc_message_parse (server, message, &tags, &message_without_tags, &nick,
&host, &command, &channel, &arguments);
hashtable = weechat_hashtable_new (8,
WEECHAT_HASHTABLE_STRING,
@@ -191,12 +223,18 @@ irc_message_parse_to_hashtable (struct t_irc_server *server,
if (!hashtable)
return NULL;
weechat_hashtable_set (hashtable, "tags", (tags) ? tags : empty_str);
weechat_hashtable_set (hashtable, "message_without_tags", (message_without_tags) ? message_without_tags : empty_str);
weechat_hashtable_set (hashtable, "nick", (nick) ? nick : empty_str);
weechat_hashtable_set (hashtable, "host", (host) ? host : empty_str);
weechat_hashtable_set (hashtable, "command", (command) ? command : empty_str);
weechat_hashtable_set (hashtable, "channel", (channel) ? channel : empty_str);
weechat_hashtable_set (hashtable, "arguments", (arguments) ? arguments : empty_str);
if (tags)
free (tags);
if (message_without_tags)
free (message_without_tags);
if (nick)
free (nick);
if (host)
@@ -348,20 +386,30 @@ irc_message_replace_vars (struct t_irc_server *server,
void
irc_message_split_add (struct t_hashtable *hashtable, int number,
const char *message, const char *arguments)
const char *tags, const char *message,
const char *arguments)
{
char key[32], value[32];
char key[32], value[32], *buf;
int length;
if (message)
{
snprintf (key, sizeof (key), "msg%d", number);
weechat_hashtable_set (hashtable, key, message);
if (weechat_irc_plugin->debug >= 2)
length = ((tags) ? strlen (tags) : 0) + strlen (message) + 1;
buf = malloc (length);
if (buf)
{
weechat_printf (NULL,
"irc_message_split_add >> %s='%s' (%d bytes)",
key, message,
strlen (message));
snprintf (key, sizeof (key), "msg%d", number);
snprintf (buf, length, "%s%s",
(tags) ? tags : "",
message);
weechat_hashtable_set (hashtable, key, buf);
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (NULL,
"irc_message_split_add >> %s='%s' (%d bytes)",
key, buf, length - 1);
}
free (buf);
}
}
if (arguments)
@@ -389,6 +437,7 @@ irc_message_split_add (struct t_hashtable *hashtable, int number,
int
irc_message_split_string (struct t_hashtable *hashtable,
const char *tags,
const char *host,
const char *command,
const char *target,
@@ -444,10 +493,10 @@ irc_message_split_string (struct t_hashtable *hashtable,
if (weechat_irc_plugin->debug >= 2)
{
weechat_printf (NULL,
"irc_message_split_string: host='%s', command='%s', "
"target='%s', prefix='%s', arguments='%s', "
"suffix='%s', max_length=%d",
host, command, target, prefix, arguments, suffix,
"irc_message_split_string: tags='%s', host='%s', "
"command='%s', target='%s', prefix='%s', "
"arguments='%s', suffix='%s', max_length=%d",
tags, host, command, target, prefix, arguments, suffix,
max_length);
}
@@ -463,7 +512,7 @@ irc_message_split_string (struct t_hashtable *hashtable,
(target && target[0]) ? " " : "",
(prefix) ? prefix : "",
(suffix) ? suffix : "");
irc_message_split_add (hashtable, 1, message, "");
irc_message_split_add (hashtable, 1, tags, message, "");
return 1;
}
@@ -495,7 +544,8 @@ irc_message_split_string (struct t_hashtable *hashtable,
(prefix) ? prefix : "",
dup_arguments,
(suffix) ? suffix : "");
irc_message_split_add (hashtable, number, message, dup_arguments);
irc_message_split_add (hashtable, number, tags, message,
dup_arguments);
number++;
free (dup_arguments);
}
@@ -513,7 +563,8 @@ irc_message_split_string (struct t_hashtable *hashtable,
int
irc_message_split_join (struct t_hashtable *hashtable,
const char *host, const char *arguments)
const char *tags, const char *host,
const char *arguments)
{
int number, channels_count, keys_count, length, length_no_channel;
int length_to_add, index_channel;
@@ -582,6 +633,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
{
strcat (msg_to_send, keys_to_add);
irc_message_split_add (hashtable, number,
tags,
msg_to_send,
msg_to_send + length_no_channel + 1);
number++;
@@ -597,6 +649,7 @@ irc_message_split_join (struct t_hashtable *hashtable,
{
strcat (msg_to_send, keys_to_add);
irc_message_split_add (hashtable, number,
tags,
msg_to_send,
msg_to_send + length_no_channel + 1);
}
@@ -618,8 +671,9 @@ irc_message_split_join (struct t_hashtable *hashtable,
int
irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
char *host, char *command, char *target,
char *arguments, int max_length_host)
char *tags, char *host, char *command,
char *target, char *arguments,
int max_length_host)
{
char prefix[512], suffix[2], *pos, saved_char;
int length, rc;
@@ -656,7 +710,7 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
if (!prefix[0])
strcpy (prefix, ":");
rc = irc_message_split_string (hashtable, host, command, target,
rc = irc_message_split_string (hashtable, tags, host, command, target,
prefix, arguments, suffix,
' ', max_length_host);
@@ -670,7 +724,8 @@ irc_message_split_privmsg_notice (struct t_hashtable *hashtable,
int
irc_message_split_005 (struct t_hashtable *hashtable,
char *host, char *command, char *target, char *arguments)
char *tags, char *host, char *command, char *target,
char *arguments)
{
char *pos, suffix[512];
@@ -691,14 +746,16 @@ irc_message_split_005 (struct t_hashtable *hashtable,
pos[0] = '\0';
}
return irc_message_split_string (hashtable, host, command, target,
return irc_message_split_string (hashtable, tags, host, command, target,
NULL, arguments, suffix, ' ', -1);
}
/*
* irc_message_split: split an IRC message about to be sent to IRC server
* The maximum length of an IRC message is 510 bytes for
* user data + final "\r\n", so full size is 512 bytes.
* user data + final "\r\n", so full size is 512 bytes
* (the user data does not include the optional tags before
* the host).
* The split takes care about type of message to do a split
* at best place in message.
* The hashtable returned contains keys "msg1", "msg2", ...,
@@ -714,10 +771,12 @@ struct t_hashtable *
irc_message_split (struct t_irc_server *server, const char *message)
{
struct t_hashtable *hashtable;
char **argv, **argv_eol, *host, *command, *arguments, target[512];
char **argv, **argv_eol, *tags, *host, *command, *arguments, target[512];
char *pos;
int split_ok, argc, index_args, max_length_nick, max_length_host;
split_ok = 0;
tags = NULL;
host = NULL;
command = NULL;
arguments = NULL;
@@ -740,6 +799,16 @@ irc_message_split (struct t_irc_server *server, const char *message)
if (!message || !message[0])
goto end;
if (message[0] == '@')
{
pos = strchr (message, ' ');
if (pos)
{
tags = weechat_strndup (message, pos - message + 1);
message = pos + 1;
}
}
argv = weechat_string_split (message, " ", 0, 0, &argc);
argv_eol = weechat_string_split (message, " ", 2, 0, NULL);
@@ -773,7 +842,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
if ((weechat_strcasecmp (command, "ison") == 0)
|| (weechat_strcasecmp (command, "wallops") == 0))
{
split_ok = irc_message_split_string (hashtable, host, command,
split_ok = irc_message_split_string (hashtable, tags, host, command,
NULL, ":",
(argv_eol[index_args][0] == ':') ?
argv_eol[index_args] + 1 : argv_eol[index_args],
@@ -783,7 +852,10 @@ irc_message_split (struct t_irc_server *server, const char *message)
{
/* split join (if it's more than 510 bytes) */
if (strlen (message) > 510)
split_ok = irc_message_split_join (hashtable, host, arguments);
{
split_ok = irc_message_split_join (hashtable, tags, host,
arguments);
}
}
else if ((weechat_strcasecmp (command, "privmsg") == 0)
|| (weechat_strcasecmp (command, "notice") == 0))
@@ -791,7 +863,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
/* split privmsg/notice */
if (index_args + 1 <= argc - 1)
{
split_ok = irc_message_split_privmsg_notice (hashtable, host,
split_ok = irc_message_split_privmsg_notice (hashtable, tags, host,
command,
argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
@@ -804,7 +876,7 @@ irc_message_split (struct t_irc_server *server, const char *message)
/* split 005 (isupport) */
if (index_args + 1 <= argc - 1)
{
split_ok = irc_message_split_005 (hashtable, host, command,
split_ok = irc_message_split_005 (hashtable, tags, host, command,
argv[index_args],
(argv_eol[index_args + 1][0] == ':') ?
argv_eol[index_args + 1] + 1 : argv_eol[index_args + 1]);
@@ -822,8 +894,8 @@ irc_message_split (struct t_irc_server *server, const char *message)
{
snprintf (target, sizeof (target), "%s %s",
argv[index_args], argv[index_args + 1]);
split_ok = irc_message_split_string (hashtable, host, command,
target, ":",
split_ok = irc_message_split_string (hashtable, tags, host,
command, target, ":",
(argv_eol[index_args + 2][0] == ':') ?
argv_eol[index_args + 2] + 1 : argv_eol[index_args + 2],
NULL, ' ', -1);
@@ -835,8 +907,8 @@ irc_message_split (struct t_irc_server *server, const char *message)
snprintf (target, sizeof (target), "%s %s %s",
argv[index_args], argv[index_args + 1],
argv[index_args + 2]);
split_ok = irc_message_split_string (hashtable, host, command,
target, ":",
split_ok = irc_message_split_string (hashtable, tags, host,
command, target, ":",
(argv_eol[index_args + 3][0] == ':') ?
argv_eol[index_args + 3] + 1 : argv_eol[index_args + 3],
NULL, ' ', -1);
@@ -846,10 +918,12 @@ irc_message_split (struct t_irc_server *server, const char *message)
}
end:
if (tags)
free (tags);
if (!split_ok
|| (weechat_hashtable_get_integer (hashtable, "items_count") == 0))
{
irc_message_split_add (hashtable, 1, message, arguments);
irc_message_split_add (hashtable, 1, tags, message, arguments);
}
if (argv)
+1
View File
@@ -24,6 +24,7 @@ struct t_irc_server;
struct t_irc_channel;
extern void irc_message_parse (struct t_irc_server *server, const char *message,
char **tags, char **message_without_tags,
char **nick, char **host, char **command,
char **channel, char **arguments);
extern struct t_hashtable *irc_message_parse_to_hashtable (struct t_irc_server *server,
+2 -2
View File
@@ -700,7 +700,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
for (i = 0; i < num_messages; i++)
{
irc_message_parse (ptr_server, messages[i], NULL, NULL, NULL,
NULL, &arguments);
NULL, NULL, NULL, &arguments);
if (arguments)
{
pos = strchr (arguments, ' ');
@@ -780,7 +780,7 @@ irc_notify_hsignal_cb (void *data, const char *signal,
for (i = 0; i < num_messages; i++)
{
irc_message_parse (ptr_server, messages[0], NULL, NULL,
&irc_cmd, NULL, &arguments);
NULL, NULL, &irc_cmd, NULL, &arguments);
if (irc_cmd && arguments)
{
if (strcmp (irc_cmd, "401") == 0)
File diff suppressed because it is too large Load Diff
+6 -2
View File
@@ -23,6 +23,7 @@
#define IRC_PROTOCOL_CALLBACK(__command) \
int \
irc_protocol_cb_##__command (struct t_irc_server *server, \
time_t date, \
const char *nick, \
const char *address, \
const char *host, \
@@ -33,6 +34,7 @@
char **argv_eol)
#define IRC_PROTOCOL_MIN_ARGS(__min_args) \
(void) date; \
(void) nick; \
(void) address; \
(void) host; \
@@ -65,8 +67,9 @@
struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server,
const char *nick, const char *address,
const char *host, const char *command,
time_t date, const char *nick,
const char *address, const char *host,
const char *command,
int ignored,
int argc, char **argv, char **argv_eol);
@@ -82,6 +85,7 @@ extern const char *irc_protocol_tags (const char *command, const char *tags,
const char *nick);
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);
+26 -9
View File
@@ -2072,7 +2072,7 @@ irc_server_sendf (struct t_irc_server *server, int flags, const char *tags,
for (i = 0; i < items_count; i++)
{
/* run modifier "irc_out1_xxx" (like "irc_out_xxx", but before split) */
irc_message_parse (server, items[i],
irc_message_parse (server, items[i], NULL, NULL,
&nick, NULL, &command, &channel, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_out1_%s",
@@ -2301,8 +2301,8 @@ void
irc_server_msgq_flush ()
{
struct t_irc_message *next;
char *ptr_data, *new_msg, *new_msg2, *ptr_msg, *ptr_msg2, *pos;
char *nick, *host, *command, *channel, *arguments;
char *ptr_data, *new_msg, *new_msg2, *ptr_msg, *ptr_msg2, *ptr_msg3, *pos;
char *tags, *nick, *host, *command, *channel, *arguments;
char *msg_decoded, *msg_decoded_without_color;
char str_modifier[128], modifier_data[256];
@@ -2325,8 +2325,8 @@ irc_server_msgq_flush ()
ptr_data);
irc_message_parse (irc_recv_msgq->server,
ptr_data, NULL, NULL, &command, NULL,
NULL);
ptr_data, NULL, NULL, NULL, NULL,
&command, NULL, NULL);
snprintf (str_modifier, sizeof (str_modifier),
"irc_in_%s",
(command) ? command : "unknown");
@@ -2362,9 +2362,9 @@ irc_server_msgq_flush ()
ptr_msg);
}
irc_message_parse (irc_recv_msgq->server,
ptr_msg, &nick, &host, &command,
&channel, &arguments);
irc_message_parse (irc_recv_msgq->server, ptr_msg,
&tags, NULL, &nick, &host,
&command, &channel, &arguments);
/* convert charset for message */
if (channel
@@ -2436,8 +2436,25 @@ 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_msg2, command,
ptr_msg3,
tags,
command,
channel);
}
}