diff options
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | src/irc/irc-recv.c | 13 | ||||
-rw-r--r-- | src/plugins/plugins.c | 2 | ||||
-rw-r--r-- | src/plugins/scripts/lua/weechat-lua.c | 11 | ||||
-rw-r--r-- | src/plugins/scripts/perl/weechat-perl.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/python/weechat-python.c | 1 | ||||
-rw-r--r-- | src/plugins/scripts/ruby/weechat-ruby.c | 3 | ||||
-rw-r--r-- | src/plugins/weechat-plugin.h | 2 | ||||
-rw-r--r-- | weechat/ChangeLog | 2 | ||||
-rw-r--r-- | weechat/src/irc/irc-recv.c | 13 | ||||
-rw-r--r-- | weechat/src/plugins/plugins.c | 2 | ||||
-rw-r--r-- | weechat/src/plugins/scripts/lua/weechat-lua.c | 11 | ||||
-rw-r--r-- | weechat/src/plugins/scripts/perl/weechat-perl.c | 1 | ||||
-rw-r--r-- | weechat/src/plugins/scripts/python/weechat-python.c | 1 | ||||
-rw-r--r-- | weechat/src/plugins/scripts/ruby/weechat-ruby.c | 3 | ||||
-rw-r--r-- | weechat/src/plugins/weechat-plugin.h | 2 |
16 files changed, 66 insertions, 4 deletions
@@ -5,6 +5,8 @@ ChangeLog - 2007-03-06 Version 0.2.4 (under dev!): + * added new return code in plugin API to force highlight (for message + handlers only) * fixed bug with server buffer when "look_one_server_buffer" is ON and server buffer is moved to any number > 1 (bug #19219) * fixed /help command: displays plugin help for redefined commands diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c index 401da46fd..245d39895 100644 --- a/src/irc/irc-recv.c +++ b/src/irc/irc-recv.c @@ -50,7 +50,7 @@ char *irc_last_command_received = NULL; -int command_ignored; +int command_ignored, command_force_highlight; /* @@ -105,6 +105,10 @@ irc_is_highlight (char *message, char *nick) /* empty message ? */ if (!message || !message[0]) return 0; + + /* highlight asked by a plugin */ + if (command_force_highlight) + return 1; /* highlight by nickname */ match = strstr (message, nick); @@ -272,6 +276,7 @@ irc_recv_command (t_irc_server *server, char *entire_line, cmd_name, NULL, server->name); + command_force_highlight = 0; #ifdef PLUGINS return_code = plugin_msg_handler_exec (server->name, cmd_name, @@ -280,6 +285,12 @@ irc_recv_command (t_irc_server *server, char *entire_line, so we ignore this message in standard handler */ if (return_code & PLUGIN_RC_OK_IGNORE_WEECHAT) command_ignored = 1; + /* plugin asked for highlight ? */ + if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT) + { + command_force_highlight = 1; + gui_printf (NULL, "highlight!!!\n"); + } #endif pos = (dup_host) ? strchr (dup_host, '!') : NULL; if (pos) diff --git a/src/plugins/plugins.c b/src/plugins/plugins.c index 3f2dbb26d..430c80935 100644 --- a/src/plugins/plugins.c +++ b/src/plugins/plugins.c @@ -551,6 +551,8 @@ plugin_msg_handler_exec (char *server, char *irc_command, char *irc_message) final_return_code = PLUGIN_RC_OK_IGNORE_WEECHAT; if (return_code & PLUGIN_RC_OK_IGNORE_PLUGINS) return final_return_code; + if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT) + final_return_code = PLUGIN_RC_OK_WITH_HIGHLIGHT; } } } diff --git a/src/plugins/scripts/lua/weechat-lua.c b/src/plugins/scripts/lua/weechat-lua.c index 969e04ff8..384e930e6 100644 --- a/src/plugins/scripts/lua/weechat-lua.c +++ b/src/plugins/scripts/lua/weechat-lua.c @@ -2228,6 +2228,16 @@ weechat_lua_constant_plugin_rc_ok_ignore_all (lua_State *L) return 1; } +static int +weechat_lua_constant_plugin_rc_ok_with_highlight (lua_State *L) +{ + /* make C compiler happy */ + (void) L; + + lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_WITH_HIGHLIGHT); + return 1; +} + /* * Lua subroutines */ @@ -2272,6 +2282,7 @@ const struct luaL_reg weechat_lua_funcs[] = { { "PLUGIN_RC_OK_IGNORE_WEECHAT", weechat_lua_constant_plugin_rc_ok_ignore_weechat }, { "PLUGIN_RC_OK_IGNORE_PLUGINS", weechat_lua_constant_plugin_rc_ok_ignore_plugins }, { "PLUGIN_RC_OK_IGNORE_ALL", weechat_lua_constant_plugin_rc_ok_ignore_all }, + { "PLUGIN_RC_OK_WITH_HIGHLIGHT", weechat_lua_constant_plugin_rc_ok_with_highlight }, { NULL, NULL } }; diff --git a/src/plugins/scripts/perl/weechat-perl.c b/src/plugins/scripts/perl/weechat-perl.c index ed0ad28e2..4e4530e21 100644 --- a/src/plugins/scripts/perl/weechat-perl.c +++ b/src/plugins/scripts/perl/weechat-perl.c @@ -1940,6 +1940,7 @@ weechat_perl_xs_init (pTHX) newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_WEECHAT", newSViv (PLUGIN_RC_OK_IGNORE_WEECHAT)); newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_PLUGINS", newSViv (PLUGIN_RC_OK_IGNORE_PLUGINS)); newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_ALL", newSViv (PLUGIN_RC_OK_IGNORE_ALL)); + newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_WITH_HIGHLIGHT", newSViv (PLUGIN_RC_OK_WITH_HIGHLIGHT)); } /* diff --git a/src/plugins/scripts/python/weechat-python.c b/src/plugins/scripts/python/weechat-python.c index 7a5d58e4d..58ca1f154 100644 --- a/src/plugins/scripts/python/weechat-python.c +++ b/src/plugins/scripts/python/weechat-python.c @@ -2296,6 +2296,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename) PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_WEECHAT", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_WEECHAT)); PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_PLUGINS", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_PLUGINS)); PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_ALL", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_ALL)); + PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_WITH_HIGHLIGHT", PyInt_FromLong((long) PLUGIN_RC_OK_WITH_HIGHLIGHT)); weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs); if (weechat_outputs == NULL) diff --git a/src/plugins/scripts/ruby/weechat-ruby.c b/src/plugins/scripts/ruby/weechat-ruby.c index c685fbc46..40f0cde87 100644 --- a/src/plugins/scripts/ruby/weechat-ruby.c +++ b/src/plugins/scripts/ruby/weechat-ruby.c @@ -2607,7 +2607,8 @@ weechat_plugin_init (t_weechat_plugin *plugin) rb_define_const(ruby_mWeechat, "PLUGIN_RC_KO", INT2NUM(PLUGIN_RC_KO)); rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_WEECHAT", INT2NUM(PLUGIN_RC_OK_IGNORE_WEECHAT)); rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_PLUGINS", INT2NUM(PLUGIN_RC_OK_IGNORE_PLUGINS)); - rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL)); + rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL)); + rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_WITH_HIGHLIGHT", INT2NUM(PLUGIN_RC_OK_WITH_HIGHLIGHT)); rb_define_module_function (ruby_mWeechat, "register", weechat_ruby_register, -1); rb_define_module_function (ruby_mWeechat, "set_charset", weechat_ruby_set_charset, 1); rb_define_module_function (ruby_mWeechat, "print", weechat_ruby_print, -1); diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h index 9e0e50684..12bae1ed1 100644 --- a/src/plugins/weechat-plugin.h +++ b/src/plugins/weechat-plugin.h @@ -35,6 +35,8 @@ #define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \ | PLUGIN_RC_OK_IGNORE_PLUGINS) /* ignore WeeChat and other plugins */ +#define PLUGIN_RC_OK_WITH_HIGHLIGHT 4 /* ok and ask for highlight */ + /* (for message handler only) */ #define WEECHAT_IRC_COLOR_WHITE 0 #define WEECHAT_IRC_COLOR_BLACK 1 diff --git a/weechat/ChangeLog b/weechat/ChangeLog index 2f70c5a91..629087dab 100644 --- a/weechat/ChangeLog +++ b/weechat/ChangeLog @@ -5,6 +5,8 @@ ChangeLog - 2007-03-06 Version 0.2.4 (under dev!): + * added new return code in plugin API to force highlight (for message + handlers only) * fixed bug with server buffer when "look_one_server_buffer" is ON and server buffer is moved to any number > 1 (bug #19219) * fixed /help command: displays plugin help for redefined commands diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c index 401da46fd..245d39895 100644 --- a/weechat/src/irc/irc-recv.c +++ b/weechat/src/irc/irc-recv.c @@ -50,7 +50,7 @@ char *irc_last_command_received = NULL; -int command_ignored; +int command_ignored, command_force_highlight; /* @@ -105,6 +105,10 @@ irc_is_highlight (char *message, char *nick) /* empty message ? */ if (!message || !message[0]) return 0; + + /* highlight asked by a plugin */ + if (command_force_highlight) + return 1; /* highlight by nickname */ match = strstr (message, nick); @@ -272,6 +276,7 @@ irc_recv_command (t_irc_server *server, char *entire_line, cmd_name, NULL, server->name); + command_force_highlight = 0; #ifdef PLUGINS return_code = plugin_msg_handler_exec (server->name, cmd_name, @@ -280,6 +285,12 @@ irc_recv_command (t_irc_server *server, char *entire_line, so we ignore this message in standard handler */ if (return_code & PLUGIN_RC_OK_IGNORE_WEECHAT) command_ignored = 1; + /* plugin asked for highlight ? */ + if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT) + { + command_force_highlight = 1; + gui_printf (NULL, "highlight!!!\n"); + } #endif pos = (dup_host) ? strchr (dup_host, '!') : NULL; if (pos) diff --git a/weechat/src/plugins/plugins.c b/weechat/src/plugins/plugins.c index 3f2dbb26d..430c80935 100644 --- a/weechat/src/plugins/plugins.c +++ b/weechat/src/plugins/plugins.c @@ -551,6 +551,8 @@ plugin_msg_handler_exec (char *server, char *irc_command, char *irc_message) final_return_code = PLUGIN_RC_OK_IGNORE_WEECHAT; if (return_code & PLUGIN_RC_OK_IGNORE_PLUGINS) return final_return_code; + if (return_code & PLUGIN_RC_OK_WITH_HIGHLIGHT) + final_return_code = PLUGIN_RC_OK_WITH_HIGHLIGHT; } } } diff --git a/weechat/src/plugins/scripts/lua/weechat-lua.c b/weechat/src/plugins/scripts/lua/weechat-lua.c index 969e04ff8..384e930e6 100644 --- a/weechat/src/plugins/scripts/lua/weechat-lua.c +++ b/weechat/src/plugins/scripts/lua/weechat-lua.c @@ -2228,6 +2228,16 @@ weechat_lua_constant_plugin_rc_ok_ignore_all (lua_State *L) return 1; } +static int +weechat_lua_constant_plugin_rc_ok_with_highlight (lua_State *L) +{ + /* make C compiler happy */ + (void) L; + + lua_pushnumber (lua_current_interpreter, PLUGIN_RC_OK_WITH_HIGHLIGHT); + return 1; +} + /* * Lua subroutines */ @@ -2272,6 +2282,7 @@ const struct luaL_reg weechat_lua_funcs[] = { { "PLUGIN_RC_OK_IGNORE_WEECHAT", weechat_lua_constant_plugin_rc_ok_ignore_weechat }, { "PLUGIN_RC_OK_IGNORE_PLUGINS", weechat_lua_constant_plugin_rc_ok_ignore_plugins }, { "PLUGIN_RC_OK_IGNORE_ALL", weechat_lua_constant_plugin_rc_ok_ignore_all }, + { "PLUGIN_RC_OK_WITH_HIGHLIGHT", weechat_lua_constant_plugin_rc_ok_with_highlight }, { NULL, NULL } }; diff --git a/weechat/src/plugins/scripts/perl/weechat-perl.c b/weechat/src/plugins/scripts/perl/weechat-perl.c index ed0ad28e2..4e4530e21 100644 --- a/weechat/src/plugins/scripts/perl/weechat-perl.c +++ b/weechat/src/plugins/scripts/perl/weechat-perl.c @@ -1940,6 +1940,7 @@ weechat_perl_xs_init (pTHX) newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_WEECHAT", newSViv (PLUGIN_RC_OK_IGNORE_WEECHAT)); newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_PLUGINS", newSViv (PLUGIN_RC_OK_IGNORE_PLUGINS)); newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_IGNORE_ALL", newSViv (PLUGIN_RC_OK_IGNORE_ALL)); + newCONSTSUB (stash, "weechat::PLUGIN_RC_OK_WITH_HIGHLIGHT", newSViv (PLUGIN_RC_OK_WITH_HIGHLIGHT)); } /* diff --git a/weechat/src/plugins/scripts/python/weechat-python.c b/weechat/src/plugins/scripts/python/weechat-python.c index 7a5d58e4d..58ca1f154 100644 --- a/weechat/src/plugins/scripts/python/weechat-python.c +++ b/weechat/src/plugins/scripts/python/weechat-python.c @@ -2296,6 +2296,7 @@ weechat_python_load (t_weechat_plugin *plugin, char *filename) PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_WEECHAT", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_WEECHAT)); PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_PLUGINS", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_PLUGINS)); PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_IGNORE_ALL", PyInt_FromLong((long) PLUGIN_RC_OK_IGNORE_ALL)); + PyDict_SetItemString(weechat_dict, "PLUGIN_RC_OK_WITH_HIGHLIGHT", PyInt_FromLong((long) PLUGIN_RC_OK_WITH_HIGHLIGHT)); weechat_outputs = Py_InitModule("weechatOutputs", weechat_python_output_funcs); if (weechat_outputs == NULL) diff --git a/weechat/src/plugins/scripts/ruby/weechat-ruby.c b/weechat/src/plugins/scripts/ruby/weechat-ruby.c index c685fbc46..40f0cde87 100644 --- a/weechat/src/plugins/scripts/ruby/weechat-ruby.c +++ b/weechat/src/plugins/scripts/ruby/weechat-ruby.c @@ -2607,7 +2607,8 @@ weechat_plugin_init (t_weechat_plugin *plugin) rb_define_const(ruby_mWeechat, "PLUGIN_RC_KO", INT2NUM(PLUGIN_RC_KO)); rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_WEECHAT", INT2NUM(PLUGIN_RC_OK_IGNORE_WEECHAT)); rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_PLUGINS", INT2NUM(PLUGIN_RC_OK_IGNORE_PLUGINS)); - rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL)); + rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_IGNORE_ALL", INT2NUM(PLUGIN_RC_OK_IGNORE_ALL)); + rb_define_const(ruby_mWeechat, "PLUGIN_RC_OK_WITH_HIGHLIGHT", INT2NUM(PLUGIN_RC_OK_WITH_HIGHLIGHT)); rb_define_module_function (ruby_mWeechat, "register", weechat_ruby_register, -1); rb_define_module_function (ruby_mWeechat, "set_charset", weechat_ruby_set_charset, 1); rb_define_module_function (ruby_mWeechat, "print", weechat_ruby_print, -1); diff --git a/weechat/src/plugins/weechat-plugin.h b/weechat/src/plugins/weechat-plugin.h index 9e0e50684..12bae1ed1 100644 --- a/weechat/src/plugins/weechat-plugin.h +++ b/weechat/src/plugins/weechat-plugin.h @@ -35,6 +35,8 @@ #define PLUGIN_RC_OK_IGNORE_ALL (PLUGIN_RC_OK_IGNORE_WEECHAT \ | PLUGIN_RC_OK_IGNORE_PLUGINS) /* ignore WeeChat and other plugins */ +#define PLUGIN_RC_OK_WITH_HIGHLIGHT 4 /* ok and ask for highlight */ + /* (for message handler only) */ #define WEECHAT_IRC_COLOR_WHITE 0 #define WEECHAT_IRC_COLOR_BLACK 1 |