1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-27 05:16:38 +02:00

Reintroduce highlight (move code from irc plugin to core)

This commit is contained in:
Sebastien Helleu
2008-06-01 22:09:12 +02:00
parent 4fa856c773
commit bd436db2bc
26 changed files with 1562 additions and 1700 deletions
+9
View File
@@ -81,6 +81,15 @@ irc_channel_new (struct t_irc_server *server, int channel_type,
"nicklist_group", 1);
}
/* set highlights settings on channel buffer */
weechat_buffer_set (new_buffer, "highlight_words", server->nick);
if (weechat_config_string (irc_config_look_highlight_tags)
&& weechat_config_string (irc_config_look_highlight_tags)[0])
{
weechat_buffer_set (new_buffer, "highlight_tags",
weechat_config_string (irc_config_look_highlight_tags));
}
/* initialize new channel */
new_channel->type = channel_type;
new_channel->name = strdup (channel_name);
+8 -7
View File
@@ -54,9 +54,9 @@ struct t_config_option *irc_config_look_nick_prefix;
struct t_config_option *irc_config_look_nick_suffix;
struct t_config_option *irc_config_look_nick_completion_smart;
struct t_config_option *irc_config_look_display_away;
struct t_config_option *irc_config_look_highlight_tags;
struct t_config_option *irc_config_look_show_away_once;
struct t_config_option *irc_config_look_notice_as_pv;
struct t_config_option *irc_config_look_highlight;
/* IRC config, network section */
@@ -905,6 +905,13 @@ irc_config_init ()
"display_away", "integer",
N_("display message when (un)marking as away"),
"off|local|channel", 0, 0, "local", NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight_tags = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight_tags", "string",
N_("comma separated list of tags for messages that may produce "
"highlight (usually any message from another user, not server "
"messages,..)"),
NULL, 0, 0, "irc_privmsg,irc_notice", NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_show_away_once = weechat_config_new_option (
irc_config_file, ptr_section,
"show_away_once", "boolean",
@@ -915,12 +922,6 @@ irc_config_init ()
"notice_as_pv", "boolean",
N_("display notices as private messages"),
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
irc_config_look_highlight = weechat_config_new_option (
irc_config_file, ptr_section,
"highlight", "string",
N_("comma separated list of words to highlight (case insensitive "
"comparison, words may begin or end with \"*\" for partial match)"),
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
ptr_section = weechat_config_new_section (irc_config_file, "network",
0, 0,
+1 -1
View File
@@ -66,9 +66,9 @@ extern struct t_config_option *irc_config_look_nick_prefix;
extern struct t_config_option *irc_config_look_nick_suffix;
extern struct t_config_option *irc_config_look_nick_completion_smart;
extern struct t_config_option *irc_config_look_display_away;
extern struct t_config_option *irc_config_look_highlight_tags;
extern struct t_config_option *irc_config_look_show_away_once;
extern struct t_config_option *irc_config_look_notice_as_pv;
extern struct t_config_option *irc_config_look_highlight;
extern struct t_config_option *irc_config_network_default_msg_part;
extern struct t_config_option *irc_config_network_default_msg_quit;
+2
View File
@@ -73,6 +73,8 @@ irc_debug_printf (struct t_irc_server *server, int send, int modified,
weechat_buffer_set (irc_debug_buffer,
"title", _("IRC debug messages"));
/* disabled all highlights on this debug buffer */
weechat_buffer_set (irc_debug_buffer, "highlight_words", "-");
}
buf = weechat_iconv_to_internal (NULL, message);
File diff suppressed because it is too large Load Diff
+1 -2
View File
@@ -45,8 +45,7 @@
struct t_irc_server;
typedef int (t_irc_recv_func)(struct t_irc_server *server, char *comand,
int argc, char **argv, char **argv_eol,
int highlight);
int argc, char **argv, char **argv_eol);
struct t_irc_protocol_msg
{
+14
View File
@@ -233,6 +233,8 @@ irc_server_set_nick (struct t_irc_server *server, char *nick)
weechat_buffer_set (server->buffer, "nick", nick);
weechat_buffer_set (server->buffer, "highlight_words", nick);
for (ptr_channel = server->channels; ptr_channel;
ptr_channel = ptr_channel->next_channel)
{
@@ -1847,9 +1849,21 @@ irc_server_connect (struct t_irc_server *server, int disable_autojoin)
&irc_buffer_close_cb, NULL);
if (!server->buffer)
return 0;
weechat_buffer_set (server->buffer, "display", "1");
weechat_hook_signal_send ("logger_backlog",
WEECHAT_HOOK_SIGNAL_POINTER, server->buffer);
/* set highlights settings on server buffer */
if (server->nick)
weechat_buffer_set (server->buffer, "highlight_words", server->nick);
if (weechat_config_string (irc_config_look_highlight_tags)
&& weechat_config_string (irc_config_look_highlight_tags)[0])
{
weechat_buffer_set (server->buffer, "highlight_tags",
weechat_config_string (irc_config_look_highlight_tags));
}
}
#ifndef HAVE_GNUTLS
+15
View File
@@ -526,6 +526,8 @@ plugin_api_infolist_get_add_buffer_line (struct t_plugin_infolist *infolist,
struct t_gui_line *line)
{
struct t_plugin_infolist_item *ptr_item;
int i;
char option_name[64];
if (!infolist || !line)
return 0;
@@ -540,6 +542,19 @@ plugin_api_infolist_get_add_buffer_line (struct t_plugin_infolist *infolist,
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "str_time", line->str_time))
return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "tags_count", line->tags_count))
return 0;
for (i = 0; i < line->tags_count; i++)
{
snprintf (option_name, sizeof (option_name), "tag_%05d", i + 1);
if (!plugin_infolist_new_var_string (ptr_item, option_name,
line->tags_array[i]))
return 0;
}
if (!plugin_infolist_new_var_integer (ptr_item, "displayed", line->displayed))
return 0;
if (!plugin_infolist_new_var_integer (ptr_item, "highlight", line->highlight))
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "prefix", line->prefix))
return 0;
if (!plugin_infolist_new_var_string (ptr_item, "message", line->message))
+1
View File
@@ -292,6 +292,7 @@ plugin_load (char *filename)
new_plugin->string_replace = &string_replace;
new_plugin->string_remove_quotes = &string_remove_quotes;
new_plugin->string_strip = &string_strip;
new_plugin->string_has_highlight = &string_has_highlight;
new_plugin->string_explode = &string_explode;
new_plugin->string_free_exploded = &string_free_exploded;
new_plugin->string_split_command = &string_split_command;
+3
View File
@@ -113,6 +113,7 @@ struct t_weechat_plugin
char *(*string_replace) (char *string, char *search, char *replace);
char *(*string_remove_quotes) (char *string, char *quotes);
char *(*string_strip) (char *string, int left, int right, char *chars);
int (*string_has_highlight) (char *string, char *highlight_words);
char **(*string_explode) (char *string, char *separators, int keep_eol,
int num_items_max, int *num_items);
void (*string_free_exploded) (char **exploded_string);
@@ -492,6 +493,8 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->string_remove_quotes(__string, __quotes)
#define weechat_string_strip(__string, __left, __right, __chars) \
weechat_plugin->string_strip(__string, __left, __right, __chars)
#define weechat_string_has_highlight(__string, __highlight_words) \
weechat_plugin->string_has_highlight(__string, __highlight_words)
#define weechat_string_explode(__string, __separator, __eol, __max, \
__num_items) \
weechat_plugin->string_explode(__string, __separator, __eol, \