mirror of
https://github.com/weechat/weechat.git
synced 2026-06-29 14:26:39 +02:00
Reintroduce highlight (move code from irc plugin to core)
This commit is contained in:
+182
-167
@@ -60,49 +60,49 @@ struct t_config_section *weechat_config_section_bar = NULL;
|
||||
|
||||
/* config, startup section */
|
||||
|
||||
struct t_config_option *config_startup_command_after_plugins;
|
||||
struct t_config_option *config_startup_command_before_plugins;
|
||||
struct t_config_option *config_startup_display_logo;
|
||||
struct t_config_option *config_startup_display_version;
|
||||
struct t_config_option *config_startup_command_before_plugins;
|
||||
struct t_config_option *config_startup_command_after_plugins;
|
||||
struct t_config_option *config_startup_weechat_slogan;
|
||||
|
||||
/* config, look & feel section */
|
||||
|
||||
struct t_config_option *config_look_color_real_white;
|
||||
struct t_config_option *config_look_save_on_exit;
|
||||
struct t_config_option *config_look_set_title;
|
||||
struct t_config_option *config_look_scroll_amount;
|
||||
struct t_config_option *config_look_buffer_time_format;
|
||||
struct t_config_option *config_look_color_nicks_number;
|
||||
struct t_config_option *config_look_color_real_white;
|
||||
struct t_config_option *config_look_day_change;
|
||||
struct t_config_option *config_look_day_change_time_format;
|
||||
struct t_config_option *config_look_highlight;
|
||||
struct t_config_option *config_look_hotlist_names_count;
|
||||
struct t_config_option *config_look_hotlist_names_length;
|
||||
struct t_config_option *config_look_hotlist_names_level;
|
||||
struct t_config_option *config_look_hotlist_sort;
|
||||
struct t_config_option *config_look_infobar;
|
||||
struct t_config_option *config_look_infobar_delay_highlight;
|
||||
struct t_config_option *config_look_infobar_seconds;
|
||||
struct t_config_option *config_look_infobar_time_format;
|
||||
struct t_config_option *config_look_input_format;
|
||||
struct t_config_option *config_look_item_time_format;
|
||||
struct t_config_option *config_look_nick_complete_first;
|
||||
struct t_config_option *config_look_nick_completion_ignore;
|
||||
struct t_config_option *config_look_nick_completor;
|
||||
struct t_config_option *config_look_nicklist;
|
||||
struct t_config_option *config_look_nicklist_position;
|
||||
struct t_config_option *config_look_nicklist_min_size;
|
||||
struct t_config_option *config_look_nicklist_max_size;
|
||||
struct t_config_option *config_look_nicklist_min_size;
|
||||
struct t_config_option *config_look_nicklist_position;
|
||||
struct t_config_option *config_look_nicklist_separator;
|
||||
struct t_config_option *config_look_nickmode;
|
||||
struct t_config_option *config_look_nickmode_empty;
|
||||
struct t_config_option *config_look_no_nickname;
|
||||
struct t_config_option *config_look_paste_max_lines;
|
||||
struct t_config_option *config_look_prefix[GUI_CHAT_NUM_PREFIXES];
|
||||
struct t_config_option *config_look_prefix_align;
|
||||
struct t_config_option *config_look_prefix_align_max;
|
||||
struct t_config_option *config_look_prefix_suffix;
|
||||
struct t_config_option *config_look_nick_completor;
|
||||
struct t_config_option *config_look_nick_completion_ignore;
|
||||
struct t_config_option *config_look_nick_complete_first;
|
||||
struct t_config_option *config_look_infobar;
|
||||
struct t_config_option *config_look_infobar_time_format;
|
||||
struct t_config_option *config_look_infobar_seconds;
|
||||
struct t_config_option *config_look_infobar_delay_highlight;
|
||||
struct t_config_option *config_look_item_time_format;
|
||||
struct t_config_option *config_look_hotlist_names_count;
|
||||
struct t_config_option *config_look_hotlist_names_level;
|
||||
struct t_config_option *config_look_hotlist_names_length;
|
||||
struct t_config_option *config_look_hotlist_sort;
|
||||
struct t_config_option *config_look_day_change;
|
||||
struct t_config_option *config_look_day_change_time_format;
|
||||
struct t_config_option *config_look_read_marker;
|
||||
struct t_config_option *config_look_input_format;
|
||||
struct t_config_option *config_look_paste_max_lines;
|
||||
struct t_config_option *config_look_save_on_exit;
|
||||
struct t_config_option *config_look_scroll_amount;
|
||||
struct t_config_option *config_look_set_title;
|
||||
|
||||
/* config, colors section */
|
||||
|
||||
@@ -127,6 +127,7 @@ struct t_config_option *config_color_chat_nick_colors[GUI_COLOR_NICK_NUMBER];
|
||||
struct t_config_option *config_color_chat_host;
|
||||
struct t_config_option *config_color_chat_delimiters;
|
||||
struct t_config_option *config_color_chat_highlight;
|
||||
struct t_config_option *config_color_chat_highlight_bg;
|
||||
struct t_config_option *config_color_chat_read_marker;
|
||||
struct t_config_option *config_color_chat_read_marker_bg;
|
||||
struct t_config_option *config_color_status;
|
||||
@@ -745,6 +746,16 @@ config_weechat_init ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
config_startup_command_after_plugins = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"command_after_plugins", "string",
|
||||
N_("command executed when WeeChat starts, after loading plugins"),
|
||||
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_startup_command_before_plugins = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"command_before_plugins", "string",
|
||||
N_("command executed when WeeChat starts, before loading plugins"),
|
||||
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_startup_display_logo = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"display_logo", "boolean",
|
||||
@@ -755,16 +766,6 @@ config_weechat_init ()
|
||||
"display_version", "boolean",
|
||||
N_("display WeeChat version at startup"),
|
||||
NULL, 0, 0, "on", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_startup_command_before_plugins = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"command_before_plugins", "string",
|
||||
N_("command executed when WeeChat starts, before loading plugins"),
|
||||
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_startup_command_after_plugins = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"command_after_plugins", "string",
|
||||
N_("command executed when WeeChat starts, after loading plugins"),
|
||||
NULL, 0, 0, "", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_startup_weechat_slogan = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"weechat_slogan", "string",
|
||||
@@ -781,33 +782,7 @@ config_weechat_init ()
|
||||
config_file_free (weechat_config_file);
|
||||
return 0;
|
||||
}
|
||||
|
||||
config_look_color_real_white = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"color_real_white", "boolean",
|
||||
N_("if set, uses real white color, disabled by default "
|
||||
"for terms with white background (if you never use "
|
||||
"white background, you should turn on this option to "
|
||||
"see real white instead of default term foreground "
|
||||
"color)"),
|
||||
NULL, 0, 0, "off", NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_look_save_on_exit = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"save_on_exit", "boolean",
|
||||
N_("save configuration file on exit"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_save_on_exit, NULL, NULL, NULL);
|
||||
config_look_set_title = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"set_title", "boolean",
|
||||
N_("set title for window (terminal for Curses GUI) with "
|
||||
"name and version"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_title, NULL, NULL, NULL);
|
||||
config_look_scroll_amount = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"scroll_amount", "integer",
|
||||
N_("how many lines to scroll by with scroll_up and "
|
||||
"scroll_down"),
|
||||
NULL, 1, INT_MAX, "3", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
|
||||
config_look_buffer_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"buffer_time_format", "string",
|
||||
@@ -818,23 +793,111 @@ config_weechat_init ()
|
||||
"color_nicks_number", "integer",
|
||||
N_("number of colors to use for nicks colors"),
|
||||
NULL, 1, 10, "10", NULL, NULL, &config_change_nicks_colors, NULL, NULL, NULL);
|
||||
config_look_color_real_white = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"color_real_white", "boolean",
|
||||
N_("if set, uses real white color, disabled by default "
|
||||
"for terms with white background (if you never use "
|
||||
"white background, you should turn on this option to "
|
||||
"see real white instead of default term foreground "
|
||||
"color)"),
|
||||
NULL, 0, 0, "off", NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_look_day_change = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"day_change", "boolean",
|
||||
N_("display special message when day changes"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_day_change, NULL, NULL, NULL);
|
||||
config_look_day_change_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"day_change_time_format", "string",
|
||||
N_("time format for date displayed when day changed"),
|
||||
NULL, 0, 0, "%a, %d %b %Y", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_highlight = config_file_new_option (
|
||||
weechat_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);
|
||||
config_look_hotlist_names_count = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_count", "integer",
|
||||
N_("max number of names in hotlist (0 = no name "
|
||||
"displayed, only buffer numbers)"),
|
||||
NULL, 0, 32, "3", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_names_length = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_length", "integer",
|
||||
N_("max length of names in hotlist (0 = no limit)"),
|
||||
NULL, 0, 32, "0", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_names_level = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_level", "integer",
|
||||
N_("level for displaying names in hotlist (combination "
|
||||
"of: 1=join/part, 2=message, 4=private, 8=highlight, "
|
||||
"for example: 12=private+highlight)"),
|
||||
NULL, 1, 15, "12", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_sort = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_sort", "integer",
|
||||
N_("hotlist sort type (group_time_asc (default), "
|
||||
"group_time_desc, group_number_asc, group_number_desc, "
|
||||
"number_asc, number_desc)"),
|
||||
"group_time_asc|group_time_desc|group_number_asc|"
|
||||
"group_number_desc|number_asc|number_desc",
|
||||
0, 0, "group_time_asc", NULL, NULL, &config_change_hotlist, NULL, NULL, NULL);
|
||||
config_look_infobar = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar", "boolean",
|
||||
N_("enable info bar"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_infobar_delay_highlight = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_delay_highlight", "integer",
|
||||
N_("delay (in seconds) for highlight messages in "
|
||||
"infobar (0 = disable highlight notifications in "
|
||||
"infobar)"),
|
||||
NULL, 0, INT_MAX, "7", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_infobar_seconds = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_seconds", "boolean",
|
||||
N_("display seconds in infobar time"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_infobar_seconds, NULL, NULL, NULL);
|
||||
config_look_infobar_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_time_format", "string",
|
||||
N_("time format for time in infobar"),
|
||||
NULL, 0, 0, "%B, %A %d %Y", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_input_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"input_format", "string",
|
||||
N_("format for input prompt ('%c' is replaced by channel "
|
||||
"or server, '%n' by nick and '%m' by nick modes)"),
|
||||
NULL, 0, 0, "[%n(%m)] ", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_item_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"item_time_format", "string",
|
||||
N_("time format for \"time\" bar item"),
|
||||
NULL, 0, 0, "%H:%M", NULL, NULL, &config_change_item_time_format, NULL, NULL, NULL);
|
||||
config_look_nick_complete_first = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_complete_first", "boolean",
|
||||
N_("complete only with first nick found"),
|
||||
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_nick_completion_ignore = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_completion_ignore", "string",
|
||||
N_("chars ignored for nick completion"),
|
||||
NULL, 0, 0, "[]-^", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_nick_completor = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_completor", "string",
|
||||
N_("string inserted after nick completion"),
|
||||
NULL, 0, 0, ":", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_nicklist = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist", "boolean",
|
||||
N_("display nicklist (on buffers with nicklist enabled)"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_position = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_position", "integer",
|
||||
N_("nicklist position (top, left, right (default), "
|
||||
"bottom)"),
|
||||
"left|right|top|bottom", 0, 0, "right", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_min_size = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_min_size", "integer",
|
||||
N_("min size for nicklist (width or height, depending on "
|
||||
"nicklist_position (0 = no min size))"),
|
||||
NULL, 0, 100, "0", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_max_size = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_max_size", "integer",
|
||||
@@ -842,6 +905,18 @@ config_weechat_init ()
|
||||
"nicklist_position (0 = no max size; if min = max "
|
||||
"and > 0, then size is fixed))"),
|
||||
NULL, 0, 100, "0", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_min_size = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_min_size", "integer",
|
||||
N_("min size for nicklist (width or height, depending on "
|
||||
"nicklist_position (0 = no min size))"),
|
||||
NULL, 0, 100, "0", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_position = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_position", "integer",
|
||||
N_("nicklist position (top, left, right (default), "
|
||||
"bottom)"),
|
||||
"left|right|top|bottom", 0, 0, "right", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nicklist_separator = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nicklist_separator", "boolean",
|
||||
@@ -857,6 +932,12 @@ config_weechat_init ()
|
||||
"nickmode_empty", "boolean",
|
||||
N_("display space if nick mode is not (half)op/voice"),
|
||||
NULL, 0, 0, "off", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_paste_max_lines = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"paste_max_lines", "integer",
|
||||
N_("max number of lines for paste without asking user "
|
||||
"(0 = disable this feature)"),
|
||||
NULL, 0, INT_MAX, "3", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_prefix[GUI_CHAT_PREFIX_ERROR] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_error", "string",
|
||||
@@ -871,7 +952,7 @@ config_weechat_init ()
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_action", "string",
|
||||
N_("prefix for action messages"),
|
||||
NULL, 0, 0, "*", NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
|
||||
NULL, 0, 0, " *", NULL, NULL, &config_change_prefix, NULL, NULL, NULL);
|
||||
config_look_prefix[GUI_CHAT_PREFIX_JOIN] = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"prefix_join", "string",
|
||||
@@ -897,103 +978,29 @@ config_weechat_init ()
|
||||
"prefix_suffix", "string",
|
||||
N_("string displayed after prefix"),
|
||||
NULL, 0, 0, "|", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_nick_completor = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_completor", "string",
|
||||
N_("string inserted after nick completion"),
|
||||
NULL, 0, 0, ":", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_nick_completion_ignore = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_completion_ignore", "string",
|
||||
N_("chars ignored for nick completion"),
|
||||
NULL, 0, 0, "[]-^", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_nick_complete_first = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"nick_complete_first", "boolean",
|
||||
N_("complete only with first nick found"),
|
||||
NULL, 0, 0, "off", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_infobar = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar", "boolean",
|
||||
N_("enable info bar"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
|
||||
config_look_infobar_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_time_format", "string",
|
||||
N_("time format for time in infobar"),
|
||||
NULL, 0, 0, "%B, %A %d %Y", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_infobar_seconds = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_seconds", "boolean",
|
||||
N_("display seconds in infobar time"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_infobar_seconds, NULL, NULL, NULL);
|
||||
config_look_infobar_delay_highlight = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"infobar_delay_highlight", "integer",
|
||||
N_("delay (in seconds) for highlight messages in "
|
||||
"infobar (0 = disable highlight notifications in "
|
||||
"infobar)"),
|
||||
NULL, 0, INT_MAX, "7", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_item_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"item_time_format", "string",
|
||||
N_("time format for \"time\" bar item"),
|
||||
NULL, 0, 0, "%H:%M", NULL, NULL, &config_change_item_time_format, NULL, NULL, NULL);
|
||||
config_look_hotlist_names_count = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_count", "integer",
|
||||
N_("max number of names in hotlist (0 = no name "
|
||||
"displayed, only buffer numbers)"),
|
||||
NULL, 0, 32, "3", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_names_level = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_level", "integer",
|
||||
N_("level for displaying names in hotlist (combination "
|
||||
"of: 1=join/part, 2=message, 4=private, 8=highlight, "
|
||||
"for example: 12=private+highlight)"),
|
||||
NULL, 1, 15, "12", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_names_length = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_names_length", "integer",
|
||||
N_("max length of names in hotlist (0 = no limit)"),
|
||||
NULL, 0, 32, "0", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_hotlist_sort = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"hotlist_sort", "integer",
|
||||
N_("hotlist sort type (group_time_asc (default), "
|
||||
"group_time_desc, group_number_asc, group_number_desc, "
|
||||
"number_asc, number_desc)"),
|
||||
"group_time_asc|group_time_desc|group_number_asc|"
|
||||
"group_number_desc|number_asc|number_desc",
|
||||
0, 0, "group_time_asc", NULL, NULL, &config_change_hotlist, NULL, NULL, NULL);
|
||||
config_look_day_change = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"day_change", "boolean",
|
||||
N_("display special message when day changes"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_day_change, NULL, NULL, NULL);
|
||||
config_look_day_change_time_format = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"day_change_time_format", "string",
|
||||
N_("time format for date displayed when day changed"),
|
||||
NULL, 0, 0, "%a, %d %b %Y", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
config_look_read_marker = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"read_marker", "integer",
|
||||
N_("use a marker (line or char) on buffers to show first unread line"),
|
||||
"none|line|dotted-line|char",
|
||||
0, 0, "dotted-line", NULL, NULL, &config_change_read_marker, NULL, NULL, NULL);
|
||||
config_look_input_format = config_file_new_option (
|
||||
config_look_save_on_exit = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"input_format", "string",
|
||||
N_("format for input prompt ('%c' is replaced by channel "
|
||||
"or server, '%n' by nick and '%m' by nick modes)"),
|
||||
NULL, 0, 0, "[%n(%m)] ", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_paste_max_lines = config_file_new_option (
|
||||
"save_on_exit", "boolean",
|
||||
N_("save configuration file on exit"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_save_on_exit, NULL, NULL, NULL);
|
||||
config_look_scroll_amount = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"paste_max_lines", "integer",
|
||||
N_("max number of lines for paste without asking user "
|
||||
"(0 = disable this feature)"),
|
||||
NULL, 0, INT_MAX, "3", NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
"scroll_amount", "integer",
|
||||
N_("how many lines to scroll by with scroll_up and "
|
||||
"scroll_down"),
|
||||
NULL, 1, INT_MAX, "3", NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
|
||||
config_look_set_title = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"set_title", "boolean",
|
||||
N_("set title for window (terminal for Curses GUI) with "
|
||||
"name and version"),
|
||||
NULL, 0, 0, "on", NULL, NULL, &config_change_title, NULL, NULL, NULL);
|
||||
|
||||
/* colors */
|
||||
ptr_section = config_file_new_section (weechat_config_file, "color",
|
||||
@@ -1210,9 +1217,15 @@ config_weechat_init ()
|
||||
config_color_chat_highlight = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_highlight", "color",
|
||||
N_("text color for highlighted nick"),
|
||||
N_("text color for highlighted prefix"),
|
||||
NULL, GUI_COLOR_CHAT_HIGHLIGHT, 0, "yellow",
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_highlight_bg = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_highlight_bg", "color",
|
||||
N_("background color for highlighted prefix"),
|
||||
NULL, -1, 0, "magenta",
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_chat_read_marker = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_read_marker", "color",
|
||||
@@ -1223,7 +1236,8 @@ config_weechat_init ()
|
||||
weechat_config_file, ptr_section,
|
||||
"chat_read_marker_bg", "color",
|
||||
N_("background color for unread data marker"),
|
||||
NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
NULL, -1, 0, "default",
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
/* status window */
|
||||
config_color_status = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
@@ -1235,7 +1249,8 @@ config_weechat_init ()
|
||||
weechat_config_file, ptr_section,
|
||||
"status_bg", "color",
|
||||
N_("background color for status bar"),
|
||||
NULL, -1, 0, "blue", NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
NULL, -1, 0, "blue",
|
||||
NULL, NULL, &config_change_color, NULL, NULL, NULL);
|
||||
config_color_status_delimiters = config_file_new_option (
|
||||
weechat_config_file, ptr_section,
|
||||
"status_delimiters", "color",
|
||||
|
||||
+26
-29
@@ -48,51 +48,47 @@
|
||||
extern struct t_config_file *weechat_config_file;
|
||||
extern struct t_config_section *weechat_config_section_bar;
|
||||
|
||||
extern struct t_config_option *config_startup_command_after_plugins;
|
||||
extern struct t_config_option *config_startup_command_before_plugins;
|
||||
extern struct t_config_option *config_startup_display_logo;
|
||||
extern struct t_config_option *config_startup_display_version;
|
||||
extern struct t_config_option *config_startup_command_before_plugins;
|
||||
extern struct t_config_option *config_startup_command_after_plugins;
|
||||
extern struct t_config_option *config_startup_weechat_slogan;
|
||||
|
||||
extern struct t_config_option *config_look_color_real_white;
|
||||
extern struct t_config_option *config_look_save_on_exit;
|
||||
extern struct t_config_option *config_look_set_title;
|
||||
extern struct t_config_option *config_look_one_server_buffer;
|
||||
extern struct t_config_option *config_look_open_near_server;
|
||||
extern struct t_config_option *config_look_scroll_amount;
|
||||
extern struct t_config_option *config_look_buffer_time_format;
|
||||
extern struct t_config_option *config_look_color_nicks_number;
|
||||
extern struct t_config_option *config_look_color_actions;
|
||||
extern struct t_config_option *config_look_color_real_white;
|
||||
extern struct t_config_option *config_look_day_change;
|
||||
extern struct t_config_option *config_look_day_change_time_format;
|
||||
extern struct t_config_option *config_look_highlight;
|
||||
extern struct t_config_option *config_look_hotlist_names_count;
|
||||
extern struct t_config_option *config_look_hotlist_names_length;
|
||||
extern struct t_config_option *config_look_hotlist_names_level;
|
||||
extern struct t_config_option *config_look_hotlist_sort;
|
||||
extern struct t_config_option *config_look_infobar;
|
||||
extern struct t_config_option *config_look_infobar_delay_highlight;
|
||||
extern struct t_config_option *config_look_infobar_seconds;
|
||||
extern struct t_config_option *config_look_infobar_time_format;
|
||||
extern struct t_config_option *config_look_input_format;
|
||||
extern struct t_config_option *config_look_item_time_format;
|
||||
extern struct t_config_option *config_look_nick_complete_first;
|
||||
extern struct t_config_option *config_look_nick_completion_ignore;
|
||||
extern struct t_config_option *config_look_nick_completor;
|
||||
extern struct t_config_option *config_look_nicklist;
|
||||
extern struct t_config_option *config_look_nicklist_position;
|
||||
extern struct t_config_option *config_look_nicklist_min_size;
|
||||
extern struct t_config_option *config_look_nicklist_max_size;
|
||||
extern struct t_config_option *config_look_nicklist_min_size;
|
||||
extern struct t_config_option *config_look_nicklist_position;
|
||||
extern struct t_config_option *config_look_nicklist_separator;
|
||||
extern struct t_config_option *config_look_nickmode;
|
||||
extern struct t_config_option *config_look_nickmode_empty;
|
||||
extern struct t_config_option *config_look_no_nickname;
|
||||
extern struct t_config_option *config_look_paste_max_lines;
|
||||
extern struct t_config_option *config_look_prefix[];
|
||||
extern struct t_config_option *config_look_prefix_align;
|
||||
extern struct t_config_option *config_look_prefix_align_max;
|
||||
extern struct t_config_option *config_look_prefix_suffix;
|
||||
extern struct t_config_option *config_look_nick_completor;
|
||||
extern struct t_config_option *config_look_nick_completion_ignore;
|
||||
extern struct t_config_option *config_look_nick_complete_first;
|
||||
extern struct t_config_option *config_look_infobar;
|
||||
extern struct t_config_option *config_look_infobar_time_format;
|
||||
extern struct t_config_option *config_look_infobar_seconds;
|
||||
extern struct t_config_option *config_look_infobar_delay_highlight;
|
||||
extern struct t_config_option *config_look_item_time_format;
|
||||
extern struct t_config_option *config_look_hotlist_names_count;
|
||||
extern struct t_config_option *config_look_hotlist_names_level;
|
||||
extern struct t_config_option *config_look_hotlist_names_length;
|
||||
extern struct t_config_option *config_look_hotlist_sort;
|
||||
extern struct t_config_option *config_look_day_change;
|
||||
extern struct t_config_option *config_look_day_change_time_format;
|
||||
extern struct t_config_option *config_look_read_marker;
|
||||
extern struct t_config_option *config_look_input_format;
|
||||
extern struct t_config_option *config_look_paste_max_lines;
|
||||
extern struct t_config_option *config_look_default_msg_quit;
|
||||
extern struct t_config_option *config_look_save_on_exit;
|
||||
extern struct t_config_option *config_look_scroll_amount;
|
||||
extern struct t_config_option *config_look_set_title;
|
||||
|
||||
extern struct t_config_option *config_color_separator;
|
||||
extern struct t_config_option *config_color_title;
|
||||
@@ -115,6 +111,7 @@ extern struct t_config_option *config_color_chat_nick_colors[];
|
||||
extern struct t_config_option *config_color_chat_host;
|
||||
extern struct t_config_option *config_color_chat_delimiters;
|
||||
extern struct t_config_option *config_color_chat_highlight;
|
||||
extern struct t_config_option *config_color_chat_highlight_bg;
|
||||
extern struct t_config_option *config_color_chat_read_marker;
|
||||
extern struct t_config_option *config_color_chat_read_marker_bg;
|
||||
extern struct t_config_option *config_color_status;
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#if defined(__OpenBSD__)
|
||||
#include <utf8/wchar.h>
|
||||
#else
|
||||
#include <wchar.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
#include <iconv.h>
|
||||
@@ -538,6 +545,173 @@ string_convert_hex_chars (char *string)
|
||||
return output;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_get_wide_char: get wide char from string (first char)
|
||||
*/
|
||||
|
||||
wint_t
|
||||
string_get_wide_char (char *string)
|
||||
{
|
||||
int char_size;
|
||||
wint_t result;
|
||||
|
||||
if (!string || !string[0])
|
||||
return WEOF;
|
||||
|
||||
char_size = utf8_char_size (string);
|
||||
switch (char_size)
|
||||
{
|
||||
case 1:
|
||||
result = (wint_t)string[0];
|
||||
break;
|
||||
case 2:
|
||||
result = ((wint_t)((unsigned char)string[0])) << 8
|
||||
| ((wint_t)((unsigned char)string[1]));
|
||||
break;
|
||||
case 3:
|
||||
result = ((wint_t)((unsigned char)string[0])) << 16
|
||||
| ((wint_t)((unsigned char)string[1])) << 8
|
||||
| ((wint_t)((unsigned char)string[2]));
|
||||
break;
|
||||
case 4:
|
||||
result = ((wint_t)((unsigned char)string[0])) << 24
|
||||
| ((wint_t)((unsigned char)string[1])) << 16
|
||||
| ((wint_t)((unsigned char)string[2])) << 8
|
||||
| ((wint_t)((unsigned char)string[3]));
|
||||
break;
|
||||
default:
|
||||
result = WEOF;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_is_word_char: return 1 if given character is a "word character"
|
||||
*/
|
||||
|
||||
int
|
||||
string_is_word_char (char *string)
|
||||
{
|
||||
wint_t c = string_get_wide_char (string);
|
||||
|
||||
if (c == WEOF)
|
||||
return 0;
|
||||
|
||||
if (iswalnum (c))
|
||||
return 1;
|
||||
|
||||
switch (c)
|
||||
{
|
||||
case '-':
|
||||
case '_':
|
||||
case '|':
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* not a 'word char' */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_has_highlight: return 1 if string contains a highlight (using list of
|
||||
* words to highlight)
|
||||
* return 0 if no highlight is found in string
|
||||
*/
|
||||
|
||||
int
|
||||
string_has_highlight (char *string, char *highlight_words)
|
||||
{
|
||||
char *msg, *highlight, *match, *match_pre, *match_post, *msg_pos, *pos, *pos_end;
|
||||
int end, length, startswith, endswith, wildcard_start, wildcard_end;
|
||||
|
||||
if (!string || !string[0] || !highlight_words || !highlight_words[0])
|
||||
return 0;
|
||||
|
||||
/* convert both strings to lower case */
|
||||
msg = strdup (string);
|
||||
if (!msg)
|
||||
return 0;
|
||||
string_tolower (msg);
|
||||
highlight = strdup (highlight_words);
|
||||
if (!highlight)
|
||||
{
|
||||
free (msg);
|
||||
return 0;
|
||||
}
|
||||
string_tolower (highlight);
|
||||
|
||||
pos = highlight;
|
||||
end = 0;
|
||||
while (!end)
|
||||
{
|
||||
pos_end = strchr (pos, ',');
|
||||
if (!pos_end)
|
||||
{
|
||||
pos_end = strchr (pos, '\0');
|
||||
end = 1;
|
||||
}
|
||||
/* error parsing string! */
|
||||
if (!pos_end)
|
||||
{
|
||||
free (msg);
|
||||
free (highlight);
|
||||
return 0;
|
||||
}
|
||||
|
||||
length = pos_end - pos;
|
||||
pos_end[0] = '\0';
|
||||
if (length > 0)
|
||||
{
|
||||
if ((wildcard_start = (pos[0] == '*')))
|
||||
{
|
||||
pos++;
|
||||
length--;
|
||||
}
|
||||
if ((wildcard_end = (*(pos_end - 1) == '*')))
|
||||
{
|
||||
*(pos_end - 1) = '\0';
|
||||
length--;
|
||||
}
|
||||
}
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
msg_pos = msg;
|
||||
/* highlight found! */
|
||||
while ((match = strstr (msg_pos, pos)) != NULL)
|
||||
{
|
||||
match_pre = match - 1;
|
||||
match_pre = utf8_prev_char (msg, match);
|
||||
if (!match_pre)
|
||||
match_pre = match - 1;
|
||||
match_post = match + length;
|
||||
startswith = ((match == msg) || (!string_is_word_char (match_pre)));
|
||||
endswith = ((!match_post[0]) || (!string_is_word_char (match_post)));
|
||||
if ((wildcard_start && wildcard_end) ||
|
||||
(!wildcard_start && !wildcard_end &&
|
||||
startswith && endswith) ||
|
||||
(wildcard_start && endswith) ||
|
||||
(wildcard_end && startswith))
|
||||
{
|
||||
free (msg);
|
||||
free (highlight);
|
||||
return 1;
|
||||
}
|
||||
msg_pos = match_post;
|
||||
}
|
||||
}
|
||||
|
||||
if (!end)
|
||||
pos = pos_end + 1;
|
||||
}
|
||||
|
||||
free (msg);
|
||||
free (highlight);
|
||||
|
||||
/* no highlight found */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* string_explode: explode a string according to separators
|
||||
* examples:
|
||||
|
||||
@@ -33,6 +33,7 @@ extern char *string_replace (char *string, char *search, char *replace);
|
||||
extern char *string_remove_quotes (char *string, char *quotes);
|
||||
extern char *string_strip (char *string, int left, int right, char *chars);
|
||||
extern char *string_convert_hex_chars (char *string);
|
||||
extern int string_has_highlight (char *string, char *highlight_words);
|
||||
extern char **string_explode (char *string, char *separators, int keep_eol,
|
||||
int num_items_max, int *num_items);
|
||||
extern void string_free_exploded (char **exploded_string);
|
||||
|
||||
@@ -566,7 +566,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
|
||||
int *lines_displayed,
|
||||
int simulate)
|
||||
{
|
||||
char str_space[] = " ", str_plus[] = "+";
|
||||
char str_space[] = " ", str_plus[] = "+", *prefix_highlighted;
|
||||
int i, length_allowed, num_spaces;
|
||||
|
||||
/* display time */
|
||||
@@ -608,14 +608,25 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
|
||||
{
|
||||
gui_chat_display_word (window, line, str_space,
|
||||
NULL, 1, num_lines, count,
|
||||
lines_displayed,simulate);
|
||||
lines_displayed, simulate);
|
||||
}
|
||||
}
|
||||
|
||||
prefix_highlighted = NULL;
|
||||
if (line->highlight)
|
||||
{
|
||||
prefix_highlighted = (char *)gui_color_decode ((unsigned char *)line->prefix);
|
||||
if (!simulate)
|
||||
gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
|
||||
GUI_COLOR_CHAT_HIGHLIGHT);
|
||||
}
|
||||
|
||||
/* not enough space to display full prefix ? => truncate it! */
|
||||
if ((CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)
|
||||
&& (num_spaces < 0))
|
||||
{
|
||||
gui_chat_display_word (window, line, line->prefix,
|
||||
gui_chat_display_word (window, line,
|
||||
(prefix_highlighted) ? prefix_highlighted : line->prefix,
|
||||
line->prefix +
|
||||
gui_chat_string_real_pos (line->prefix,
|
||||
length_allowed - 1),
|
||||
@@ -624,11 +635,15 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_chat_display_word (window, line, line->prefix,
|
||||
gui_chat_display_word (window, line,
|
||||
(prefix_highlighted) ? prefix_highlighted : line->prefix,
|
||||
NULL, 1, num_lines, count, lines_displayed,
|
||||
simulate);
|
||||
}
|
||||
|
||||
if (prefix_highlighted)
|
||||
free (prefix_highlighted);
|
||||
|
||||
if (!simulate)
|
||||
gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ gui_color_init_weechat ()
|
||||
}
|
||||
gui_color[GUI_COLOR_CHAT_HOST] = gui_color_build (GUI_COLOR_CHAT_HOST, CONFIG_COLOR(config_color_chat_host), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color[GUI_COLOR_CHAT_DELIMITERS] = gui_color_build (GUI_COLOR_CHAT_DELIMITERS, CONFIG_COLOR(config_color_chat_delimiters), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color[GUI_COLOR_CHAT_HIGHLIGHT] = gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_bg));
|
||||
gui_color[GUI_COLOR_CHAT_HIGHLIGHT] = gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_highlight_bg));
|
||||
gui_color[GUI_COLOR_CHAT_READ_MARKER] = gui_color_build (GUI_COLOR_CHAT_READ_MARKER, CONFIG_COLOR(config_color_chat_read_marker), CONFIG_COLOR(config_color_chat_read_marker_bg));
|
||||
|
||||
gui_color[GUI_COLOR_STATUS] = gui_color_build (GUI_COLOR_STATUS, CONFIG_COLOR(config_color_status), CONFIG_COLOR(config_color_status_bg));
|
||||
|
||||
+60
-1
@@ -164,6 +164,11 @@ gui_buffer_new (struct t_weechat_plugin *plugin, char *category, char *name,
|
||||
new_buffer->text_search_found = 0;
|
||||
new_buffer->text_search_input = NULL;
|
||||
|
||||
/* highlight */
|
||||
new_buffer->highlight_words = NULL;
|
||||
new_buffer->highlight_tags_count = 0;
|
||||
new_buffer->highlight_tags_array = NULL;
|
||||
|
||||
/* keys */
|
||||
new_buffer->keys = NULL;
|
||||
new_buffer->last_key = NULL;
|
||||
@@ -426,6 +431,44 @@ gui_buffer_set_nick (struct t_gui_buffer *buffer, char *new_nick)
|
||||
gui_buffer_ask_input_refresh (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_set_highlight_words: set highlight words for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_set_highlight_words (struct t_gui_buffer *buffer,
|
||||
char *new_highlight_words)
|
||||
{
|
||||
if (buffer->highlight_words)
|
||||
free (buffer->highlight_words);
|
||||
buffer->highlight_words = (new_highlight_words && new_highlight_words[0]) ?
|
||||
strdup (new_highlight_words) : NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_set_highlight_tags: set highlight tags for a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_set_highlight_tags (struct t_gui_buffer *buffer,
|
||||
char *new_highlight_tags)
|
||||
{
|
||||
if (buffer->highlight_tags_array)
|
||||
string_free_exploded (buffer->highlight_tags_array);
|
||||
|
||||
if (new_highlight_tags)
|
||||
{
|
||||
buffer->highlight_tags_array = string_explode (new_highlight_tags,
|
||||
",", 0, 0,
|
||||
&buffer->highlight_tags_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer->highlight_tags_count = 0;
|
||||
buffer->highlight_tags_array = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_set: set a buffer property
|
||||
*/
|
||||
@@ -502,6 +545,14 @@ gui_buffer_set (struct t_gui_buffer *buffer, char *property, char *value)
|
||||
gui_hotlist_add (buffer, number, NULL, 1);
|
||||
}
|
||||
}
|
||||
else if (string_strcasecmp (property, "highlight_words") == 0)
|
||||
{
|
||||
gui_buffer_set_highlight_words (buffer, value);
|
||||
}
|
||||
else if (string_strcasecmp (property, "highlight_tags") == 0)
|
||||
{
|
||||
gui_buffer_set_highlight_tags (buffer, value);
|
||||
}
|
||||
else if (string_strncasecmp (property, "key_bind_", 9) == 0)
|
||||
{
|
||||
gui_keyboard_bind (buffer, property + 9, value);
|
||||
@@ -805,6 +856,10 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another)
|
||||
if (buffer->text_search_input)
|
||||
free (buffer->text_search_input);
|
||||
gui_nicklist_remove_all (buffer);
|
||||
if (buffer->highlight_words)
|
||||
free (buffer->highlight_words);
|
||||
if (buffer->highlight_tags_array)
|
||||
string_free_exploded (buffer->highlight_tags_array);
|
||||
gui_keyboard_free_all (&buffer->keys, &buffer->last_key);
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
@@ -1126,6 +1181,9 @@ gui_buffer_print_log ()
|
||||
log_printf (" text_search_exact. . . : %d", ptr_buffer->text_search_exact);
|
||||
log_printf (" text_search_found. . . : %d", ptr_buffer->text_search_found);
|
||||
log_printf (" text_search_input. . . : '%s'", ptr_buffer->text_search_input);
|
||||
log_printf (" highlight_words. . . . : '%s'", ptr_buffer->highlight_words);
|
||||
log_printf (" highlight_tags_count . : %d", ptr_buffer->highlight_tags_count);
|
||||
log_printf (" highlight_tags_array . : 0x%x", ptr_buffer->highlight_tags_array);
|
||||
log_printf (" prev_buffer. . . . . . : 0x%x", ptr_buffer->prev_buffer);
|
||||
log_printf (" next_buffer. . . . . . : 0x%x", ptr_buffer->next_buffer);
|
||||
|
||||
@@ -1160,10 +1218,11 @@ gui_buffer_print_log ()
|
||||
num--;
|
||||
tags = string_build_with_exploded (ptr_line->tags_array, ",");
|
||||
log_printf (" line N-%05d: y:%d, str_time:'%s', tags:'%s', "
|
||||
"displayed:%d, refresh_needed:%d, prefix:'%s'",
|
||||
"displayed:%d, highlight:%d, refresh_needed:%d, prefix:'%s'",
|
||||
num, ptr_line->y, ptr_line->str_time,
|
||||
(tags) ? tags : "",
|
||||
(int)(ptr_line->displayed),
|
||||
(int) (ptr_line->highlight),
|
||||
(int)(ptr_line->refresh_needed),
|
||||
ptr_line->prefix);
|
||||
log_printf (" data: '%s'",
|
||||
|
||||
@@ -49,6 +49,7 @@ struct t_gui_line
|
||||
int tags_count; /* number of tags for line */
|
||||
char **tags_array; /* tags for line */
|
||||
char displayed; /* 1 if line is displayed */
|
||||
char highlight; /* 1 if line has highlight */
|
||||
char refresh_needed; /* 1 if refresh asked (free buffer) */
|
||||
char *prefix; /* prefix for line (may be NULL) */
|
||||
int prefix_length; /* prefix length (on screen) */
|
||||
@@ -131,6 +132,12 @@ struct t_gui_buffer
|
||||
int text_search_found; /* 1 if text found, otherwise 0 */
|
||||
char *text_search_input; /* input saved before text search */
|
||||
|
||||
/* highlight settings for buffer */
|
||||
char *highlight_words; /* list of words to highlight */
|
||||
int highlight_tags_count; /* number of tags to highlight */
|
||||
/* (if 0, any tag is highlighted) */
|
||||
char **highlight_tags_array; /* tags to highlight */
|
||||
|
||||
/* keys associated to buffer */
|
||||
struct t_gui_key *keys; /* keys specific to buffer */
|
||||
struct t_gui_key *last_key; /* last key for buffer */
|
||||
|
||||
@@ -557,6 +557,50 @@ gui_chat_line_match_tags (struct t_gui_line *line, int tags_count,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_chat_line_has_highlight: return 1 if given message contains highlight (with
|
||||
* a string in global highlight or buffer highlight)
|
||||
*/
|
||||
|
||||
int
|
||||
gui_chat_line_has_highlight (struct t_gui_buffer *buffer,
|
||||
struct t_gui_line *line)
|
||||
{
|
||||
int rc;
|
||||
char *msg_no_color;
|
||||
|
||||
/* highlights are disabled on this buffer? (special value "-" means that
|
||||
buffer does not want any highlight) */
|
||||
if (buffer->highlight_words && (strcmp (buffer->highlight_words, "-") == 0))
|
||||
return 0;
|
||||
|
||||
/* check that line matches highlight tags, if any (if no tag is specified,
|
||||
then any tag is allowed) */
|
||||
if (buffer->highlight_tags_count > 0)
|
||||
{
|
||||
if (!gui_chat_line_match_tags (line,
|
||||
buffer->highlight_tags_count,
|
||||
buffer->highlight_tags_array))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* remove color codes from line message */
|
||||
msg_no_color = (char *)gui_color_decode ((unsigned char *)line->message);
|
||||
if (!msg_no_color)
|
||||
return 0;
|
||||
|
||||
/* there is highlight on line if one of global highlight words matches line
|
||||
or one of buffer highlight words matches line */
|
||||
rc = (string_has_highlight (msg_no_color,
|
||||
CONFIG_STRING(config_look_highlight)) ||
|
||||
string_has_highlight (msg_no_color,
|
||||
buffer->highlight_words));
|
||||
|
||||
free (msg_no_color);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_chat_line_free: delete a formated line from a buffer
|
||||
*/
|
||||
@@ -662,6 +706,9 @@ gui_chat_line_add (struct t_gui_buffer *buffer, time_t date,
|
||||
if (new_line->prefix_length > buffer->prefix_max_length)
|
||||
buffer->prefix_max_length = new_line->prefix_length;
|
||||
new_line->message = (message) ? strdup (message) : strdup ("");
|
||||
new_line->highlight = gui_chat_line_has_highlight (buffer, new_line);
|
||||
if (new_line->highlight)
|
||||
gui_hotlist_add (buffer, GUI_HOTLIST_HIGHLIGHT, NULL, 0);
|
||||
|
||||
/* add line to lines list */
|
||||
if (!buffer->lines)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
+113
-642
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
{
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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, \
|
||||
|
||||
Reference in New Issue
Block a user