summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog.adoc1
-rw-r--r--doc/de/includes/autogen_api_hdata.de.adoc2
-rw-r--r--doc/en/includes/autogen_api_hdata.en.adoc2
-rw-r--r--doc/fr/includes/autogen_api_hdata.fr.adoc2
-rw-r--r--doc/it/includes/autogen_api_hdata.it.adoc2
-rw-r--r--doc/ja/includes/autogen_api_hdata.ja.adoc2
-rw-r--r--doc/pl/includes/autogen_api_hdata.pl.adoc2
-rw-r--r--doc/sr/includes/autogen_api_hdata.sr.adoc2
-rw-r--r--src/core/wee-upgrade.c7
-rw-r--r--src/gui/gui-buffer.c9
-rw-r--r--src/gui/gui-buffer.h2
-rw-r--r--src/gui/gui-line.c17
-rw-r--r--src/gui/gui-line.h3
-rw-r--r--tests/unit/gui/test-gui-buffer.cpp1
-rw-r--r--tests/unit/gui/test-gui-line.cpp140
15 files changed, 192 insertions, 2 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 88eba477f..f7ab6d59f 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -22,6 +22,7 @@ New features::
* core: allow command `/toggle` to create option before setting the value, if allowed in the section (issue #1837)
* core: add signals "buffer_user_input_xxx" and "buffer_user_closing_xxx" for buffers created with `/buffer add` (issue #1848)
+ * core: add identifier in buffer lines (issue #901)
* trigger: add regex command "y" to translate chars, set default regex command to "s" (regex replace) (issue #1510)
Bug fixes::
diff --git a/doc/de/includes/autogen_api_hdata.de.adoc b/doc/de/includes/autogen_api_hdata.de.adoc
index 3a352d85d..0e717e51a 100644
--- a/doc/de/includes/autogen_api_hdata.de.adoc
+++ b/doc/de/includes/autogen_api_hdata.de.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| Struktur mit einzeiligen Daten
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/en/includes/autogen_api_hdata.en.adoc b/doc/en/includes/autogen_api_hdata.en.adoc
index a98fed949..5fb08dc29 100644
--- a/doc/en/includes/autogen_api_hdata.en.adoc
+++ b/doc/en/includes/autogen_api_hdata.en.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| structure with one line data
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/fr/includes/autogen_api_hdata.fr.adoc b/doc/fr/includes/autogen_api_hdata.fr.adoc
index 859454a35..7ae875f5e 100644
--- a/doc/fr/includes/autogen_api_hdata.fr.adoc
+++ b/doc/fr/includes/autogen_api_hdata.fr.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| structure avec les données d'une ligne
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/it/includes/autogen_api_hdata.it.adoc b/doc/it/includes/autogen_api_hdata.it.adoc
index e2722ee5a..2cefc69e9 100644
--- a/doc/it/includes/autogen_api_hdata.it.adoc
+++ b/doc/it/includes/autogen_api_hdata.it.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| struttura con una riga di dati
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/ja/includes/autogen_api_hdata.ja.adoc b/doc/ja/includes/autogen_api_hdata.ja.adoc
index 7bc9ced4f..42310f58c 100644
--- a/doc/ja/includes/autogen_api_hdata.ja.adoc
+++ b/doc/ja/includes/autogen_api_hdata.ja.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| 1 行データ構造
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/pl/includes/autogen_api_hdata.pl.adoc b/doc/pl/includes/autogen_api_hdata.pl.adoc
index efd3dc432..d6fa191c8 100644
--- a/doc/pl/includes/autogen_api_hdata.pl.adoc
+++ b/doc/pl/includes/autogen_api_hdata.pl.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| struktura z jedno liniowymi danymi
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/doc/sr/includes/autogen_api_hdata.sr.adoc b/doc/sr/includes/autogen_api_hdata.sr.adoc
index 2a5e3d47f..07e8179c4 100644
--- a/doc/sr/includes/autogen_api_hdata.sr.adoc
+++ b/doc/sr/includes/autogen_api_hdata.sr.adoc
@@ -582,6 +582,7 @@ _title_   (string) +
_own_lines_   (pointer, hdata: "lines") +
_mixed_lines_   (pointer, hdata: "lines") +
_lines_   (pointer, hdata: "lines") +
+_next_line_id_   (integer) +
_time_for_each_line_   (integer) +
_chat_refresh_needed_   (integer) +
_nicklist_   (integer) +
@@ -923,6 +924,7 @@ _next_line_   (pointer, hdata: "line") +
| структура са подацима у једној линији
| -
| _buffer_   (pointer, hdata: "buffer") +
+_id_   (integer) +
_y_   (integer) +
_date_   (time) +
_date_printed_   (time) +
diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c
index 404c98797..2369feccf 100644
--- a/src/core/wee-upgrade.c
+++ b/src/core/wee-upgrade.c
@@ -508,6 +508,9 @@ upgrade_weechat_read_buffer (struct t_infolist *infolist)
ptr_buffer->lines->first_line_not_read =
infolist_integer (infolist, "first_line_not_read");
+ /* next line id */
+ ptr_buffer->next_line_id = infolist_integer (infolist, "next_line_id");
+
/* time for each line */
ptr_buffer->time_for_each_line =
infolist_integer (infolist, "time_for_each_line");
@@ -651,6 +654,7 @@ upgrade_weechat_read_buffer_line (struct t_infolist *infolist)
infolist_string (infolist, "message"));
if (new_line)
{
+ new_line->data->id = infolist_integer (infolist, "id");
gui_line_add (new_line);
new_line->data->highlight = infolist_integer (infolist,
"highlight");
@@ -667,7 +671,10 @@ upgrade_weechat_read_buffer_line (struct t_infolist *infolist)
NULL,
infolist_string (infolist, "message"));
if (new_line)
+ {
+ new_line->data->id = infolist_integer (infolist, "id");
gui_line_add_y (new_line);
+ }
break;
case GUI_BUFFER_NUM_TYPES:
break;
diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c
index 16fab2c71..3ffc1bb96 100644
--- a/src/gui/gui-buffer.c
+++ b/src/gui/gui-buffer.c
@@ -92,7 +92,7 @@ char *gui_buffer_properties_get_integer[] =
{ "number", "layout_number", "layout_number_merge_order", "type", "notify",
"num_displayed", "active", "hidden", "zoomed", "print_hooks_enabled",
"day_change", "clear", "filter", "closing", "lines_hidden",
- "prefix_max_length", "time_for_each_line", "nicklist",
+ "prefix_max_length", "next_line_id", "time_for_each_line", "nicklist",
"nicklist_case_sensitive", "nicklist_max_length", "nicklist_display_groups",
"nicklist_count", "nicklist_visible_count",
"nicklist_groups_count", "nicklist_groups_visible_count",
@@ -742,6 +742,7 @@ gui_buffer_new_props (struct t_weechat_plugin *plugin,
new_buffer->own_lines = gui_line_lines_alloc ();
new_buffer->mixed_lines = NULL;
new_buffer->lines = new_buffer->own_lines;
+ new_buffer->next_line_id = 0;
new_buffer->time_for_each_line = 1;
new_buffer->chat_refresh_needed = 2;
@@ -1266,6 +1267,8 @@ gui_buffer_get_integer (struct t_gui_buffer *buffer, const char *property)
return buffer->lines->lines_hidden;
else if (string_strcasecmp (property, "prefix_max_length") == 0)
return buffer->lines->prefix_max_length;
+ else if (string_strcasecmp (property, "next_line_id") == 0)
+ return buffer->next_line_id;
else if (string_strcasecmp (property, "time_for_each_line") == 0)
return buffer->time_for_each_line;
else if (string_strcasecmp (property, "nicklist") == 0)
@@ -4482,6 +4485,7 @@ gui_buffer_hdata_buffer_cb (const void *pointer, void *data,
HDATA_VAR(struct t_gui_buffer, own_lines, POINTER, 0, NULL, "lines");
HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER, 0, NULL, "lines");
HDATA_VAR(struct t_gui_buffer, lines, POINTER, 0, NULL, "lines");
+ HDATA_VAR(struct t_gui_buffer, next_line_id, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER, 0, NULL, NULL);
@@ -4683,6 +4687,8 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist,
return 0;
if (!infolist_new_var_integer (ptr_item, "prefix_max_length", buffer->lines->prefix_max_length))
return 0;
+ if (!infolist_new_var_integer (ptr_item, "next_line_id", buffer->next_line_id))
+ return 0;
if (!infolist_new_var_integer (ptr_item, "time_for_each_line", buffer->time_for_each_line))
return 0;
if (!infolist_new_var_integer (ptr_item, "nicklist_case_sensitive", buffer->nicklist_case_sensitive))
@@ -4913,6 +4919,7 @@ gui_buffer_print_log ()
log_printf (" mixed_lines . . . . . . : 0x%lx", ptr_buffer->mixed_lines);
gui_lines_print_log (ptr_buffer->mixed_lines);
log_printf (" lines . . . . . . . . . : 0x%lx", ptr_buffer->lines);
+ log_printf (" next_line_id. . . . . . : %d", ptr_buffer->next_line_id);
log_printf (" time_for_each_line. . . : %d", ptr_buffer->time_for_each_line);
log_printf (" chat_refresh_needed . . : %d", ptr_buffer->chat_refresh_needed);
log_printf (" nicklist. . . . . . . . : %d", ptr_buffer->nicklist);
diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h
index 336e6a316..d4b840e90 100644
--- a/src/gui/gui-buffer.h
+++ b/src/gui/gui-buffer.h
@@ -124,6 +124,8 @@ struct t_gui_buffer
struct t_gui_lines *mixed_lines; /* mixed lines (if buffers merged) */
struct t_gui_lines *lines; /* pointer to "own_lines" or */
/* "mixed_lines" */
+ int next_line_id; /* next line id */
+ /* (used with formatted type only) */
int time_for_each_line; /* time is displayed for each line? */
int chat_refresh_needed; /* refresh for chat is needed ? */
/* (1=refresh, 2=erase+refresh) */
diff --git a/src/gui/gui-line.c b/src/gui/gui-line.c
index f31d3e2b4..cb69f1787 100644
--- a/src/gui/gui-line.c
+++ b/src/gui/gui-line.c
@@ -1488,6 +1488,9 @@ gui_line_new (struct t_gui_buffer *buffer, int y, time_t date,
struct t_gui_line_data *new_line_data;
int max_notify_level;
+ if (!buffer)
+ return NULL;
+
/* create new line */
new_line = malloc (sizeof (*new_line));
if (!new_line)
@@ -1508,6 +1511,16 @@ gui_line_new (struct t_gui_buffer *buffer, int y, time_t date,
if (buffer->type == GUI_BUFFER_TYPE_FORMATTED)
{
+ /*
+ * the line identifier is almost unique: when reaching INT_MAX, it is
+ * reset to 0; it is extremely unlikely all integer are used in the
+ * same buffer, that would mean the buffer has a huge number of lines;
+ * when searching a line id in a buffer, it is recommended to start
+ * from the last line and loop to the first
+ */
+ new_line->data->id = buffer->next_line_id;
+ buffer->next_line_id = (buffer->next_line_id == INT_MAX) ?
+ 0 : buffer->next_line_id + 1;
new_line->data->y = -1;
new_line->data->date = date;
new_line->data->date_printed = date_printed;
@@ -1526,6 +1539,7 @@ gui_line_new (struct t_gui_buffer *buffer, int y, time_t date,
}
else
{
+ new_line->data->id = y;
new_line->data->y = y;
new_line->data->date = date;
new_line->data->date_printed = date_printed;
@@ -2225,6 +2239,7 @@ gui_line_hdata_line_data_cb (const void *pointer, void *data,
if (hdata)
{
HDATA_VAR(struct t_gui_line_data, buffer, POINTER, 0, NULL, "buffer");
+ HDATA_VAR(struct t_gui_line_data, id, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_line_data, y, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_line_data, date, TIME, 1, NULL, NULL);
HDATA_VAR(struct t_gui_line_data, date_printed, TIME, 1, NULL, NULL);
@@ -2266,6 +2281,8 @@ gui_line_add_to_infolist (struct t_infolist *infolist,
if (!ptr_item)
return 0;
+ if (!infolist_new_var_integer (ptr_item, "id", line->data->id))
+ return 0;
if (!infolist_new_var_integer (ptr_item, "y", line->data->y))
return 0;
if (!infolist_new_var_time (ptr_item, "date", line->data->date))
diff --git a/src/gui/gui-line.h b/src/gui/gui-line.h
index 9bb7ea95a..9941ab7d4 100644
--- a/src/gui/gui-line.h
+++ b/src/gui/gui-line.h
@@ -30,6 +30,9 @@ struct t_infolist;
struct t_gui_line_data
{
struct t_gui_buffer *buffer; /* pointer to buffer */
+ int id; /* formatted buffer: (almost) unique */
+ /* line id in buffer */
+ /* free buffer: equals to "y" */
int y; /* line position (for free buffer) */
time_t date; /* date/time of line (may be past) */
time_t date_printed; /* date/time when weechat print it */
diff --git a/tests/unit/gui/test-gui-buffer.cpp b/tests/unit/gui/test-gui-buffer.cpp
index ab2d79ff6..06f94d127 100644
--- a/tests/unit/gui/test-gui-buffer.cpp
+++ b/tests/unit/gui/test-gui-buffer.cpp
@@ -370,6 +370,7 @@ TEST(GuiBuffer, NewProps)
POINTERS_EQUAL(NULL, buffer->own_lines->first_line);
POINTERS_EQUAL(NULL, buffer->own_lines->last_line);
POINTERS_EQUAL(NULL, buffer->own_lines->last_read_line);
+ LONGS_EQUAL(0, buffer->next_line_id);
LONGS_EQUAL(0, buffer->time_for_each_line);
LONGS_EQUAL(2, buffer->chat_refresh_needed);
LONGS_EQUAL(0, buffer->nicklist);
diff --git a/tests/unit/gui/test-gui-line.cpp b/tests/unit/gui/test-gui-line.cpp
index 3e2e8b24c..80f7b7ca7 100644
--- a/tests/unit/gui/test-gui-line.cpp
+++ b/tests/unit/gui/test-gui-line.cpp
@@ -27,6 +27,7 @@ extern "C"
#include "src/core/wee-config.h"
#include "src/core/wee-string.h"
#include "src/gui/gui-buffer.h"
+#include "src/gui/gui-chat.h"
#include "src/gui/gui-color.h"
#include "src/gui/gui-filter.h"
#include "src/gui/gui-hotlist.h"
@@ -843,7 +844,144 @@ TEST(GuiLine, SetHighlight)
TEST(GuiLine, New)
{
- /* TODO: write tests */
+ struct t_gui_buffer *buffer;
+ struct t_gui_line *line1, *line2, *line3, *line4;
+ time_t date_printed, date;
+ char *str_time;
+
+ date_printed = time (NULL);
+ date = date_printed - 1;
+ str_time = gui_chat_get_time_string (date);
+
+ POINTERS_EQUAL(NULL,
+ gui_line_new (NULL, 0, date, date_printed, NULL, NULL, NULL));
+
+ /* create a new test buffer (formatted content) */
+ buffer = gui_buffer_new_user ("test", GUI_BUFFER_TYPE_FORMATTED);
+ CHECK(buffer);
+
+ line1 = gui_line_new (buffer, 0, date, date_printed, NULL, NULL, NULL);
+ CHECK(line1);
+ CHECK(line1->data);
+ POINTERS_EQUAL(NULL, line1->prev_line);
+ POINTERS_EQUAL(NULL, line1->next_line);
+ POINTERS_EQUAL(buffer, line1->data->buffer);
+ LONGS_EQUAL(0, line1->data->id);
+ LONGS_EQUAL(-1, line1->data->y);
+ LONGS_EQUAL(date, line1->data->date);
+ LONGS_EQUAL(date_printed, line1->data->date_printed);
+ STRCMP_EQUAL(str_time, line1->data->str_time);
+ LONGS_EQUAL(0, line1->data->tags_count);
+ POINTERS_EQUAL(NULL, line1->data->tags_array);
+ LONGS_EQUAL(1, line1->data->displayed);
+ LONGS_EQUAL(GUI_HOTLIST_LOW, line1->data->notify_level);
+ LONGS_EQUAL(0, line1->data->highlight);
+ LONGS_EQUAL(0, line1->data->refresh_needed);
+ STRCMP_EQUAL("", line1->data->prefix);
+ LONGS_EQUAL(0, line1->data->prefix_length);
+ STRCMP_EQUAL("", line1->data->message);
+ gui_line_add (line1);
+ POINTERS_EQUAL(NULL, line1->prev_line);
+ POINTERS_EQUAL(NULL, line1->next_line);
+
+ line2 = gui_line_new (buffer, 0, date, date_printed, "tag1,tag2,tag3",
+ "prefix", "message");
+ CHECK(line2);
+ CHECK(line2->data);
+ POINTERS_EQUAL(NULL, line2->prev_line);
+ POINTERS_EQUAL(NULL, line2->next_line);
+ POINTERS_EQUAL(buffer, line2->data->buffer);
+ LONGS_EQUAL(1, line2->data->id);
+ LONGS_EQUAL(-1, line2->data->y);
+ LONGS_EQUAL(date, line2->data->date);
+ LONGS_EQUAL(date_printed, line2->data->date_printed);
+ STRCMP_EQUAL(str_time, line2->data->str_time);
+ LONGS_EQUAL(3, line2->data->tags_count);
+ CHECK(line2->data->tags_array);
+ STRCMP_EQUAL("tag1", line2->data->tags_array[0]);
+ STRCMP_EQUAL("tag2", line2->data->tags_array[1]);
+ STRCMP_EQUAL("tag3", line2->data->tags_array[2]);
+ LONGS_EQUAL(1, line2->data->displayed);
+ LONGS_EQUAL(GUI_HOTLIST_LOW, line2->data->notify_level);
+ LONGS_EQUAL(0, line2->data->highlight);
+ LONGS_EQUAL(0, line2->data->refresh_needed);
+ STRCMP_EQUAL("prefix", line2->data->prefix);
+ LONGS_EQUAL(6, line2->data->prefix_length);
+ STRCMP_EQUAL("message", line2->data->message);
+ gui_line_add (line2);
+ POINTERS_EQUAL(line1, line2->prev_line);
+ POINTERS_EQUAL(NULL, line2->next_line);
+
+ /* simulate next_line_id == INT_MAX and display 2 lines */
+ buffer->next_line_id = INT_MAX;
+ line3 = gui_line_new (buffer, 0, date, date_printed, NULL, NULL, "test");
+ CHECK(line3);
+ LONGS_EQUAL(INT_MAX, line3->data->id);
+ line4 = gui_line_new (buffer, 0, date, date_printed, NULL, NULL, "test");
+ CHECK(line4);
+ LONGS_EQUAL(0, line4->data->id);
+
+ gui_buffer_close (buffer);
+
+ /* create a new test buffer (free content) */
+ buffer = gui_buffer_new_user ("test", GUI_BUFFER_TYPE_FREE);
+ CHECK(buffer);
+
+ line1 = gui_line_new (buffer, 0, date, date_printed, NULL, NULL, NULL);
+ CHECK(line1);
+ CHECK(line1->data);
+ POINTERS_EQUAL(NULL, line1->prev_line);
+ POINTERS_EQUAL(NULL, line1->next_line);
+ POINTERS_EQUAL(buffer, line1->data->buffer);
+ LONGS_EQUAL(0, line1->data->id);
+ LONGS_EQUAL(0, line1->data->y);
+ LONGS_EQUAL(date, line1->data->date);
+ LONGS_EQUAL(date_printed, line1->data->date_printed);
+ POINTERS_EQUAL(NULL, line1->data->str_time);
+ LONGS_EQUAL(0, line1->data->tags_count);
+ POINTERS_EQUAL(NULL, line1->data->tags_array);
+ LONGS_EQUAL(1, line1->data->displayed);
+ LONGS_EQUAL(GUI_HOTLIST_LOW, line1->data->notify_level);
+ LONGS_EQUAL(0, line1->data->highlight);
+ LONGS_EQUAL(1, line1->data->refresh_needed);
+ POINTERS_EQUAL(NULL, line1->data->prefix);
+ LONGS_EQUAL(0, line1->data->prefix_length);
+ STRCMP_EQUAL("", line1->data->message);
+ gui_line_add (line1);
+ POINTERS_EQUAL(NULL, line1->prev_line);
+ POINTERS_EQUAL(NULL, line1->next_line);
+
+ line2 = gui_line_new (buffer, 3, date, date_printed, "tag1,tag2,tag3",
+ NULL, "message");
+ CHECK(line2);
+ CHECK(line2->data);
+ POINTERS_EQUAL(NULL, line2->prev_line);
+ POINTERS_EQUAL(NULL, line2->next_line);
+ POINTERS_EQUAL(buffer, line2->data->buffer);
+ LONGS_EQUAL(3, line2->data->id);
+ LONGS_EQUAL(3, line2->data->y);
+ LONGS_EQUAL(date, line2->data->date);
+ LONGS_EQUAL(date_printed, line2->data->date_printed);
+ POINTERS_EQUAL(NULL, line2->data->str_time);
+ LONGS_EQUAL(3, line2->data->tags_count);
+ CHECK(line2->data->tags_array);
+ STRCMP_EQUAL("tag1", line2->data->tags_array[0]);
+ STRCMP_EQUAL("tag2", line2->data->tags_array[1]);
+ STRCMP_EQUAL("tag3", line2->data->tags_array[2]);
+ LONGS_EQUAL(1, line2->data->displayed);
+ LONGS_EQUAL(GUI_HOTLIST_LOW, line2->data->notify_level);
+ LONGS_EQUAL(0, line2->data->highlight);
+ LONGS_EQUAL(1, line2->data->refresh_needed);
+ POINTERS_EQUAL(NULL, line2->data->prefix);
+ LONGS_EQUAL(0, line2->data->prefix_length);
+ STRCMP_EQUAL("message", line2->data->message);
+ gui_line_add (line2);
+ CHECK(line2->prev_line);
+ POINTERS_EQUAL(NULL, line2->next_line);
+
+ gui_buffer_close (buffer);
+
+ free (str_time);
}
/*