summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2022-01-28 07:26:11 +0100
committerSébastien Helleu <flashcode@flashtux.org>2022-01-28 07:26:11 +0100
commit05a9457504675b373cfca3c6d1e5e5bd7645b96f (patch)
tree2bb8755b939b70f86fd41bc0d4091bb08d9b678a /src
parent311074077789f1d645c3d8c3df58f78a54412222 (diff)
downloadweechat-05a9457504675b373cfca3c6d1e5e5bd7645b96f.zip
core: move functions from gui-chat.c to gui-line.c
Functions moved and renamed: - gui_chat_build_string_prefix_message -> gui_line_build_string_prefix_message - gui_chat_build_string_message_tags -> gui_line_build_string_message_tags
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-curses-chat.c2
-rw-r--r--src/gui/gui-chat.c65
-rw-r--r--src/gui/gui-chat.h2
-rw-r--r--src/gui/gui-line.c69
-rw-r--r--src/gui/gui-line.h2
5 files changed, 70 insertions, 70 deletions
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index a2cdb7800..a91fc549b 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -1421,7 +1421,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (line->data->message && line->data->message[0])
{
message_with_tags = (gui_chat_display_tags) ?
- gui_chat_build_string_message_tags (line) : NULL;
+ gui_line_build_string_message_tags (line) : NULL;
ptr_data = (message_with_tags) ?
message_with_tags : line->data->message;
message_with_search = NULL;
diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c
index 8403760f7..fdc4e1363 100644
--- a/src/gui/gui-chat.c
+++ b/src/gui/gui-chat.c
@@ -580,71 +580,6 @@ gui_chat_change_time_format ()
}
/*
- * Builds a string with prefix and message.
- *
- * Note: result must be freed after use.
- */
-
-char *
-gui_chat_build_string_prefix_message (struct t_gui_line *line)
-{
- char **string, *string_without_colors;
-
- string = string_dyn_alloc (256);
- if (!string)
- return NULL;
-
- if (line->data->prefix)
- string_dyn_concat (string, line->data->prefix, -1);
- string_dyn_concat (string, "\t", -1);
- if (line->data->message)
- string_dyn_concat (string, line->data->message, -1);
-
- string_without_colors = gui_color_decode (*string, NULL);
-
- string_dyn_free (string, 1);
-
- return string_without_colors;
-}
-
-/*
- * Builds a string with message and tags.
- *
- * Note: result must be freed after use.
- */
-
-char *
-gui_chat_build_string_message_tags (struct t_gui_line *line)
-{
- int i;
- char **string, *result;
-
- string = string_dyn_alloc (256);
- if (!string)
- return NULL;
-
- if (line->data->message)
- string_dyn_concat (string, line->data->message, -1);
- string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), -1);
- string_dyn_concat (string, " [", -1);
- string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_TAGS), -1);
- for (i = 0; i < line->data->tags_count; i++)
- {
- string_dyn_concat (string, line->data->tags_array[i], -1);
- if (i < line->data->tags_count - 1)
- string_dyn_concat (string, ",", -1);
- }
- string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), -1);
- string_dyn_concat (string, "]", -1);
-
- result = strdup (*string);
-
- string_dyn_free (string, 1);
-
- return result;
-}
-
-/*
* Checks if the buffer pointer is valid for printing a chat message,
* according to buffer type.
*
diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h
index f23513739..80903fbab 100644
--- a/src/gui/gui-chat.h
+++ b/src/gui/gui-chat.h
@@ -85,8 +85,6 @@ extern void gui_chat_get_word_info (struct t_gui_window *window,
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 int gui_chat_buffer_valid (struct t_gui_buffer *buffer,
int buffer_type);
extern void gui_chat_printf_date_tags (struct t_gui_buffer *buffer,
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index 603ae0786..9f1fad71e 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -373,6 +373,71 @@ gui_line_get_align (struct t_gui_buffer *buffer, struct t_gui_line *line,
}
/*
+ * Builds a string with prefix and message.
+ *
+ * Note: result must be freed after use.
+ */
+
+char *
+gui_line_build_string_prefix_message (struct t_gui_line *line)
+{
+ char **string, *string_without_colors;
+
+ string = string_dyn_alloc (256);
+ if (!string)
+ return NULL;
+
+ if (line->data->prefix)
+ string_dyn_concat (string, line->data->prefix, -1);
+ string_dyn_concat (string, "\t", -1);
+ if (line->data->message)
+ string_dyn_concat (string, line->data->message, -1);
+
+ string_without_colors = gui_color_decode (*string, NULL);
+
+ string_dyn_free (string, 1);
+
+ return string_without_colors;
+}
+
+/*
+ * Builds a string with message and tags.
+ *
+ * Note: result must be freed after use.
+ */
+
+char *
+gui_line_build_string_message_tags (struct t_gui_line *line)
+{
+ int i;
+ char **string, *result;
+
+ string = string_dyn_alloc (256);
+ if (!string)
+ return NULL;
+
+ if (line->data->message)
+ string_dyn_concat (string, line->data->message, -1);
+ string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), -1);
+ string_dyn_concat (string, " [", -1);
+ string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_TAGS), -1);
+ for (i = 0; i < line->data->tags_count; i++)
+ {
+ string_dyn_concat (string, line->data->tags_array[i], -1);
+ if (i < line->data->tags_count - 1)
+ string_dyn_concat (string, ",", -1);
+ }
+ string_dyn_concat (string, GUI_COLOR(GUI_COLOR_CHAT_DELIMITERS), -1);
+ string_dyn_concat (string, "]", -1);
+
+ result = strdup (*string);
+
+ string_dyn_free (string, 1);
+
+ return result;
+}
+
+/*
* Checks if a line is displayed (no filter on line or filters disabled).
*
* Returns:
@@ -1623,7 +1688,7 @@ gui_line_add (struct t_gui_line *line)
GUI_HOTLIST_HIGHLIGHT, NULL);
if (!weechat_upgrading)
{
- message_for_signal = gui_chat_build_string_prefix_message (line);
+ message_for_signal = gui_line_build_string_prefix_message (line);
if (message_for_signal)
{
(void) hook_signal_send ("weechat_highlight",
@@ -1638,7 +1703,7 @@ gui_line_add (struct t_gui_line *line)
if (!weechat_upgrading
&& (line->data->notify_level == GUI_HOTLIST_PRIVATE))
{
- message_for_signal = gui_chat_build_string_prefix_message (line);
+ message_for_signal = gui_line_build_string_prefix_message (line);
if (message_for_signal)
{
(void) hook_signal_send ("weechat_pv",
diff --git a/src/gui/gui-line.h b/src/gui/gui-line.h
index 1b6939080..ffc0a42ee 100644
--- a/src/gui/gui-line.h
+++ b/src/gui/gui-line.h
@@ -80,6 +80,8 @@ extern void gui_line_get_prefix_for_display (struct t_gui_line *line,
extern int gui_line_get_align (struct t_gui_buffer *buffer,
struct t_gui_line *line,
int with_suffix, int first_line);
+extern char *gui_line_build_string_prefix_message (struct t_gui_line *line);
+extern char *gui_line_build_string_message_tags (struct t_gui_line *line);
extern int gui_line_is_displayed (struct t_gui_line *line);
extern struct t_gui_line *gui_line_get_first_displayed (struct t_gui_buffer *buffer);
extern struct t_gui_line *gui_line_get_last_displayed (struct t_gui_buffer *buffer);