diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-13 15:25:38 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-06-13 15:25:38 +0200 |
commit | 1e71196aee318a2e7a68242ed2099170b36b9f32 (patch) | |
tree | 455efca0256f5c4de46144975c881c01e72304d8 /src/gui/gui-chat.c | |
parent | 00ab6400b8c4cf2decf7538146302392e6340abc (diff) | |
download | weechat-1e71196aee318a2e7a68242ed2099170b36b9f32.zip |
core: add option "tags" for command /debug
Diffstat (limited to 'src/gui/gui-chat.c')
-rw-r--r-- | src/gui/gui-chat.c | 40 |
1 files changed, 40 insertions, 0 deletions
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 |