mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 17:23:15 +02:00
Added special names for plugin message handlers: weechat_pv, weechat_highlight, weechat_ctcp, weechat_dcc
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-02-28
|
||||
ChangeLog - 2006-03-02
|
||||
|
||||
|
||||
Version 0.1.8 (under dev!):
|
||||
* added special names for plugin message handlers: weechat_pv,
|
||||
weechat_highlight, weechat_ctcp, weechat_dcc
|
||||
* script plugins now load scripts in WeeChat system share directory
|
||||
* /msg command does not open any buffer any more
|
||||
* fixed crash when using global history (when older entry is removed)
|
||||
|
||||
+40
-2
@@ -1751,7 +1751,43 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
To know list of IRC messages, please consult
|
||||
<acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> and
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
Moreover you can use a special name, prefixed by "weechat_" to catch
|
||||
special events, as written in table below:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>weechat_pv</literal></entry>
|
||||
<entry>private message received</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_highlight</literal></entry>
|
||||
<entry>
|
||||
message with highlight (on a channel or pv)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_ctcp</literal></entry>
|
||||
<entry>
|
||||
CTCP message received (VERSION, PING, ..)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_dcc</literal></entry>
|
||||
<entry>
|
||||
DCC message received (chat or file)
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@@ -3937,7 +3973,9 @@ weechat.log("message", "#weechat", "freenode")
|
||||
<option>message</option>: name of IRC message. To know list
|
||||
of IRC messages, please consult <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> and
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
Moreover you can use a special name, prefixed by "weechat_" to catch
|
||||
special events (see <xref linkend="secAPI_msg_handler_add" />).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
||||
+42
-2
@@ -1788,7 +1788,44 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
Pour connaître la liste des messages IRC disponibles, merci
|
||||
de consulter les <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
De plus, vous pouvez utiliser un nom spécial, préfixé par
|
||||
"weechat_" pour capturer des évènements spéciaux, comme décrit
|
||||
dans le tableau ci-dessous :
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nom</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>weechat_pv</literal></entry>
|
||||
<entry>message privé reçu</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_highlight</literal></entry>
|
||||
<entry>
|
||||
message avec highlight (sur un canal ou en privé)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_ctcp</literal></entry>
|
||||
<entry>
|
||||
message CTCP reçu (VERSION, PING, etc...)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_dcc</literal></entry>
|
||||
<entry>
|
||||
message DCC reçu (discussion ou fichier)
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@@ -4015,7 +4052,10 @@ weechat.log("message", "#weechat", "freenode")
|
||||
Pour connaître la liste des messages IRC disponibles, merci
|
||||
de consulter les <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
De plus, vous pouvez utiliser un nom spécial, préfixé par
|
||||
"weechat_" pour capturer des évènements spéciaux
|
||||
(voir <xref linkend="secAPI_msg_handler_add" />).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
||||
+102
-6
@@ -43,6 +43,7 @@
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
char *irc_last_command_received = NULL;
|
||||
int command_ignored;
|
||||
|
||||
|
||||
@@ -246,9 +247,12 @@ irc_recv_command (t_irc_server *server, char *entire_line,
|
||||
pos[0] = '!';
|
||||
args_after_color = (char *)gui_color_decode ((unsigned char *)arguments,
|
||||
cfg_irc_colors_receive);
|
||||
irc_last_command_received = strdup (entire_line);
|
||||
return_code = (int) (irc_commands[i].recv_function) (server, host, nick,
|
||||
(args_after_color) ?
|
||||
args_after_color : arguments);
|
||||
if (irc_last_command_received)
|
||||
free (irc_last_command_received);
|
||||
if (args_after_color)
|
||||
free (args_after_color);
|
||||
if (nick)
|
||||
@@ -1137,6 +1141,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
struct timezone tz;
|
||||
long sec1, usec1, sec2, usec2, difftime;
|
||||
t_irc_channel *ptr_channel;
|
||||
int highlight;
|
||||
|
||||
host2 = NULL;
|
||||
if (host)
|
||||
@@ -1258,12 +1263,16 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
|
||||
nick);
|
||||
highlight = 0;
|
||||
}
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@@ -1271,6 +1280,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos);
|
||||
#ifdef PLUGINS
|
||||
if (highlight)
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1462,6 +1477,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
struct utsname *buf;
|
||||
int highlight;
|
||||
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
@@ -1521,14 +1537,23 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1638,13 +1663,22 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: %s> %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
(ptr_nick) ? NULL : nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1717,6 +1751,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
pos2);
|
||||
else
|
||||
gui_printf (server->buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1750,6 +1789,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1829,6 +1873,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
|
||||
atoi (pos_port), nick, -1, pos_file, NULL,
|
||||
strtoul (pos_size, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1891,6 +1940,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_accept_resume (server, pos_file, atoi (pos_port),
|
||||
strtoul (pos_start_resume, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1953,6 +2007,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_start_resume (server, pos_file, atoi (pos_port),
|
||||
strtoul (pos_start_resume, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2027,6 +2086,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
|
||||
atoi (pos_port), nick, -1, NULL, NULL, 0);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2079,14 +2143,28 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_pv",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2125,6 +2203,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
pos2);
|
||||
else
|
||||
gui_printf (server->buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2168,12 +2251,16 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
|
||||
nick);
|
||||
highlight = 0;
|
||||
}
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@@ -2181,6 +2268,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_pv",
|
||||
irc_last_command_received);
|
||||
if (highlight)
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2006-02-28
|
||||
ChangeLog - 2006-03-02
|
||||
|
||||
|
||||
Version 0.1.8 (under dev!):
|
||||
* added special names for plugin message handlers: weechat_pv,
|
||||
weechat_highlight, weechat_ctcp, weechat_dcc
|
||||
* script plugins now load scripts in WeeChat system share directory
|
||||
* /msg command does not open any buffer any more
|
||||
* fixed crash when using global history (when older entry is removed)
|
||||
|
||||
@@ -1751,7 +1751,43 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
To know list of IRC messages, please consult
|
||||
<acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> and
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
Moreover you can use a special name, prefixed by "weechat_" to catch
|
||||
special events, as written in table below:
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Name</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>weechat_pv</literal></entry>
|
||||
<entry>private message received</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_highlight</literal></entry>
|
||||
<entry>
|
||||
message with highlight (on a channel or pv)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_ctcp</literal></entry>
|
||||
<entry>
|
||||
CTCP message received (VERSION, PING, ..)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_dcc</literal></entry>
|
||||
<entry>
|
||||
DCC message received (chat or file)
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@@ -3937,7 +3973,9 @@ weechat.log("message", "#weechat", "freenode")
|
||||
<option>message</option>: name of IRC message. To know list
|
||||
of IRC messages, please consult <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> and
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
Moreover you can use a special name, prefixed by "weechat_" to catch
|
||||
special events (see <xref linkend="secAPI_msg_handler_add" />).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
||||
@@ -1788,7 +1788,44 @@ plugin->log (plugin, "freenode", "#weechat", "test");
|
||||
Pour connaître la liste des messages IRC disponibles, merci
|
||||
de consulter les <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
De plus, vous pouvez utiliser un nom spécial, préfixé par
|
||||
"weechat_" pour capturer des évènements spéciaux, comme décrit
|
||||
dans le tableau ci-dessous :
|
||||
<informaltable colsep="0" frame="none">
|
||||
<tgroup cols="2">
|
||||
<thead>
|
||||
<row>
|
||||
<entry>Nom</entry>
|
||||
<entry>Description</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry><literal>weechat_pv</literal></entry>
|
||||
<entry>message privé reçu</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_highlight</literal></entry>
|
||||
<entry>
|
||||
message avec highlight (sur un canal ou en privé)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_ctcp</literal></entry>
|
||||
<entry>
|
||||
message CTCP reçu (VERSION, PING, etc...)
|
||||
</entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry><literal>weechat_dcc</literal></entry>
|
||||
<entry>
|
||||
message DCC reçu (discussion ou fichier)
|
||||
</entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
@@ -4015,7 +4052,10 @@ weechat.log("message", "#weechat", "freenode")
|
||||
Pour connaître la liste des messages IRC disponibles, merci
|
||||
de consulter les <acronym>RFC</acronym>s
|
||||
<ulink url="http://www.ietf.org/rfc/rfc1459.txt">1459</ulink> et
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>
|
||||
<ulink url="http://www.ietf.org/rfc/rfc2812.txt">2812</ulink>.
|
||||
De plus, vous pouvez utiliser un nom spécial, préfixé par
|
||||
"weechat_" pour capturer des évènements spéciaux
|
||||
(voir <xref linkend="secAPI_msg_handler_add" />).
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
|
||||
+102
-6
@@ -43,6 +43,7 @@
|
||||
#include "../plugins/plugins.h"
|
||||
|
||||
|
||||
char *irc_last_command_received = NULL;
|
||||
int command_ignored;
|
||||
|
||||
|
||||
@@ -246,9 +247,12 @@ irc_recv_command (t_irc_server *server, char *entire_line,
|
||||
pos[0] = '!';
|
||||
args_after_color = (char *)gui_color_decode ((unsigned char *)arguments,
|
||||
cfg_irc_colors_receive);
|
||||
irc_last_command_received = strdup (entire_line);
|
||||
return_code = (int) (irc_commands[i].recv_function) (server, host, nick,
|
||||
(args_after_color) ?
|
||||
args_after_color : arguments);
|
||||
if (irc_last_command_received)
|
||||
free (irc_last_command_received);
|
||||
if (args_after_color)
|
||||
free (args_after_color);
|
||||
if (nick)
|
||||
@@ -1137,6 +1141,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
struct timezone tz;
|
||||
long sec1, usec1, sec2, usec2, difftime;
|
||||
t_irc_channel *ptr_channel;
|
||||
int highlight;
|
||||
|
||||
host2 = NULL;
|
||||
if (host)
|
||||
@@ -1258,12 +1263,16 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
|
||||
nick);
|
||||
highlight = 0;
|
||||
}
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@@ -1271,6 +1280,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *nick, char *argumen
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos);
|
||||
#ifdef PLUGINS
|
||||
if (highlight)
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1462,6 +1477,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
t_irc_channel *ptr_channel;
|
||||
t_irc_nick *ptr_nick;
|
||||
struct utsname *buf;
|
||||
int highlight;
|
||||
|
||||
/* no host => we can't identify sender of message! */
|
||||
if (host == NULL)
|
||||
@@ -1521,14 +1537,23 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1638,13 +1663,22 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: %s> %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
(ptr_nick) ? NULL : nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s\n", pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1717,6 +1751,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
pos2);
|
||||
else
|
||||
gui_printf (server->buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1750,6 +1789,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1829,6 +1873,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
dcc_add (server, DCC_FILE_RECV, strtoul (pos_addr, NULL, 10),
|
||||
atoi (pos_port), nick, -1, pos_file, NULL,
|
||||
strtoul (pos_size, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1891,6 +1940,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_accept_resume (server, pos_file, atoi (pos_port),
|
||||
strtoul (pos_start_resume, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1953,6 +2007,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_start_resume (server, pos_file, atoi (pos_port),
|
||||
strtoul (pos_start_resume, NULL, 10));
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2027,6 +2086,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
|
||||
dcc_add (server, DCC_CHAT_RECV, strtoul (pos_addr, NULL, 10),
|
||||
atoi (pos_port), nick, -1, NULL, NULL, 0);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_dcc",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2079,14 +2143,28 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
_("Channel"), " %s: * %s %s",
|
||||
ptr_channel->name,
|
||||
nick, pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_NICK),
|
||||
nick);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
gui_printf (ptr_channel->buffer, " %s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT), pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_pv",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2125,6 +2203,11 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
pos2);
|
||||
else
|
||||
gui_printf (server->buffer, "\n");
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_ctcp",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -2168,12 +2251,16 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
COLOR_WIN_INFOBAR_HIGHLIGHT,
|
||||
_("Private"), " %s> %s",
|
||||
nick, pos);
|
||||
highlight = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s%s",
|
||||
GUI_COLOR(COLOR_WIN_NICK_PRIVATE),
|
||||
nick);
|
||||
highlight = 0;
|
||||
}
|
||||
gui_printf_type (ptr_channel->buffer, MSG_TYPE_NICK,
|
||||
"%s> ",
|
||||
GUI_COLOR(COLOR_WIN_CHAT_DARK));
|
||||
@@ -2181,6 +2268,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *nick, char *argume
|
||||
"%s%s\n",
|
||||
GUI_COLOR(COLOR_WIN_CHAT),
|
||||
pos);
|
||||
#ifdef PLUGINS
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_pv",
|
||||
irc_last_command_received);
|
||||
if (highlight)
|
||||
(void) plugin_msg_handler_exec (server->name,
|
||||
"weechat_highlight",
|
||||
irc_last_command_received);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user