summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c13
-rw-r--r--src/core/wee-config.c8
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/curses/gui-curses-chat.c9
-rw-r--r--src/gui/curses/gui-curses-color.c1
-rw-r--r--src/gui/gui-chat.c40
-rw-r--r--src/gui/gui-chat.h2
-rw-r--r--src/gui/gui-color.h1
8 files changed, 71 insertions, 4 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index b30371862..85a8ec15e 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -1164,6 +1164,11 @@ COMMAND_CALLBACK(debug)
{
debug_memory ();
}
+ else if (string_strcasecmp (argv[1], "tags") == 0)
+ {
+ gui_chat_display_tags ^= 1;
+ gui_window_ask_refresh (2);
+ }
else if (string_strcasecmp (argv[1], "term") == 0)
{
gui_window_term_display_infos ();
@@ -4841,7 +4846,8 @@ command_init ()
N_("list"
" || set <plugin> <level>"
" || dump [<plugin>]"
- " || buffer|color|hdata|infolists|memory|term|windows"),
+ " || buffer|color|hdata|infolists|memory|tags|term"
+ "|windows"),
N_(" list: list plugins with debug levels\n"
" set: set debug level for plugin\n"
" plugin: name of plugin (\"core\" for WeeChat core)\n"
@@ -4854,6 +4860,7 @@ command_init ()
" hdata: display infos about hdata\n"
"infolists: display infos about infolists\n"
" memory: display infos about memory usage\n"
+ " tags: display tags for lines\n"
" term: display infos about terminal\n"
" windows: display windows tree"),
"list"
@@ -4864,6 +4871,7 @@ command_init ()
" || hdata"
" || infolists"
" || memory"
+ " || tags"
" || term"
" || windows",
&command_debug, NULL);
@@ -4908,7 +4916,8 @@ command_init ()
" nick_xxx (xxx is nick in message),\n"
" irc_xxx (xxx is command name or number, see /server raw),\n"
" irc_numeric, irc_error, irc_action, irc_ctcp, "
- "irc_ctcp_reply, irc_smart_filter, away_info.\n\n"
+ "irc_ctcp_reply, irc_smart_filter, away_info.\n"
+ "To see tags for lines in buffers: /debug tags\n\n"
"Examples:\n"
" use IRC smart filter on all buffers:\n"
" /filter add irc_smart * irc_smart_filter *\n"
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index b21fa1fea..6402adbad 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -157,6 +157,7 @@ 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_chat_tags;
struct t_config_option *config_color_chat_text_found;
struct t_config_option *config_color_chat_text_found_bg;
struct t_config_option *config_color_chat_value;
@@ -2106,6 +2107,13 @@ config_weechat_init_options ()
N_("background color for unread data marker"),
NULL, -1, 0, "default", NULL, 0,
NULL, NULL, &config_change_color, NULL, NULL, NULL);
+ config_color_chat_tags = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "chat_tags", "color",
+ N_("text color for tags after messages (displayed with command /debug "
+ "tags)"),
+ NULL, GUI_COLOR_CHAT_TAGS, 0, "red", NULL, 0,
+ NULL, NULL, &config_change_color, NULL, NULL, NULL);
config_color_chat_text_found = config_file_new_option (
weechat_config_file, ptr_section,
"chat_text_found", "color",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index 9b2e44d15..8c4804130 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -180,6 +180,7 @@ 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_chat_tags;
extern struct t_config_option *config_color_chat_text_found;
extern struct t_config_option *config_color_chat_text_found_bg;
extern struct t_config_option *config_color_chat_value;
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index c9173fdb1..6c380f051 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -712,7 +712,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
int word_start_offset, word_end_offset;
int word_length_with_spaces, word_length;
char *ptr_data, *ptr_end_offset, *next_char;
- char *ptr_style;
+ char *ptr_style, *message_with_tags;
if (!line)
return 0;
@@ -762,7 +762,10 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
}
else
{
- ptr_data = line->data->message;
+ message_with_tags = (gui_chat_display_tags) ?
+ gui_chat_build_string_message_tags (line) : NULL;
+ ptr_data = (message_with_tags) ?
+ message_with_tags : line->data->message;
while (ptr_data && ptr_data[0])
{
gui_chat_get_word_info (window,
@@ -838,6 +841,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
ptr_data = NULL;
}
}
+ if (message_with_tags)
+ free (message_with_tags);
}
if (marker_line)
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c
index c85961bfc..9f1a9f359 100644
--- a/src/gui/curses/gui-curses-color.c
+++ b/src/gui/curses/gui-curses-color.c
@@ -1379,6 +1379,7 @@ gui_color_init_weechat ()
gui_color_build (GUI_COLOR_CHAT_TEXT_FOUND, CONFIG_COLOR(config_color_chat_text_found), CONFIG_COLOR(config_color_chat_text_found_bg));
gui_color_build (GUI_COLOR_CHAT_VALUE, CONFIG_COLOR(config_color_chat_value), CONFIG_COLOR(config_color_chat_bg));
gui_color_build (GUI_COLOR_CHAT_PREFIX_BUFFER, CONFIG_COLOR(config_color_chat_prefix_buffer), CONFIG_COLOR(config_color_chat_bg));
+ gui_color_build (GUI_COLOR_CHAT_TAGS, CONFIG_COLOR(config_color_chat_tags), CONFIG_COLOR(config_color_chat_bg));
/*
* define old nick colors for compatibility on /upgrade with previous
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index a12d127e7..514506cd8 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -52,6 +52,7 @@ char gui_chat_prefix_empty[] = ""; /* empty prefix */
int gui_chat_time_length = 0; /* length of time for each line (in chars) */
int gui_chat_mute = GUI_CHAT_MUTE_DISABLED; /* mute mode */
struct t_gui_buffer *gui_chat_mute_buffer = NULL; /* mute buffer */
+int gui_chat_display_tags = 0; /* display tags? */
/*
@@ -481,6 +482,45 @@ gui_chat_build_string_prefix_message (struct t_gui_line *line)
}
/*
+ * gui_chat_build_string_prefix_message: build a string with message and tags
+ */
+
+
+char *
+gui_chat_build_string_message_tags (struct t_gui_line *line)
+{
+ int i, length;
+ char *buf;
+
+ length = 64 + 2;
+ if (line->data->message)
+ length += strlen (line->data->message);
+ for (i = 0; i < line->data->tags_count; i++)
+ {
+ length += strlen (line->data->tags_array[i]) + 1;
+ }
+ length += 2;
+
+ buf = malloc (length);
+ buf[0] = '\0';
+ if (line->data->message)
+ strcat (buf, line->data->message);
+ strcat (buf, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
+ strcat (buf, " [");
+ strcat (buf, GUI_COLOR(GUI_COLOR_CHAT_TAGS));
+ for (i = 0; i < line->data->tags_count; i++)
+ {
+ strcat (buf, line->data->tags_array[i]);
+ if (i < line->data->tags_count - 1)
+ strcat (buf, ",");
+ }
+ strcat (buf, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS));
+ strcat (buf, "]");
+
+ return buf;
+}
+
+/*
* gui_chat_printf_date_tags: display a message in a buffer with optional
* date and tags
* Info: this function works only with formatted
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index 15e6263e8..009877f3c 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -52,6 +52,7 @@ extern char gui_chat_prefix_empty[];
extern int gui_chat_time_length;
extern int gui_chat_mute;
extern struct t_gui_buffer *gui_chat_mute_buffer;
+extern int gui_chat_display_tags;
/* chat functions */
@@ -70,6 +71,7 @@ extern char *gui_chat_get_time_string (time_t date);
extern int gui_chat_get_time_length ();
extern void gui_chat_change_time_format ();
extern char *gui_chat_build_string_prefix_message (struct t_gui_line *line);
+extern char *gui_chat_build_string_message_tags (struct t_gui_line *line);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
time_t date, const char *tags,
const char *message, ...);
diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h
index 5774ecb77..d4c6fb633 100644
--- a/src/gui/gui-color.h
+++ b/src/gui/gui-color.h
@@ -61,6 +61,7 @@ enum t_gui_color_enum
GUI_COLOR_CHAT_TEXT_FOUND,
GUI_COLOR_CHAT_VALUE,
GUI_COLOR_CHAT_PREFIX_BUFFER,
+ GUI_COLOR_CHAT_TAGS,
/* number of colors */
GUI_COLOR_NUM_COLORS,