From 09bed16dbd39791b43f86a1c00279c7fdb5cbb58 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Sat, 22 Nov 2008 17:47:25 +0100 Subject: Save last read line (for marker) within /upgrade --- src/core/wee-upgrade.c | 5 ++++- src/gui/gui-buffer.c | 4 ++++ src/gui/gui-buffer.h | 1 + src/plugins/plugin-api.c | 3 ++- 4 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index b8912525d..cb8eb9d12 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -151,7 +151,8 @@ upgrade_weechat_save_buffers (struct t_upgrade_file *upgrade_file) ptr_infolist = infolist_new (); if (!ptr_infolist) return 0; - if (!gui_buffer_line_add_to_infolist (ptr_infolist, ptr_line)) + if (!gui_buffer_line_add_to_infolist (ptr_infolist, + ptr_buffer, ptr_line)) { infolist_free (ptr_infolist); return 0; @@ -442,6 +443,8 @@ upgrade_weechat_read_cb (int object_id, { new_line->highlight = infolist_integer (infolist, "highlight"); } + if (infolist_integer (infolist, "last_read_line")) + upgrade_current_buffer->last_read_line = new_line; } break; case UPGRADE_WEECHAT_TYPE_NICKLIST: diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 50435adcd..22195097b 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -1565,6 +1565,7 @@ gui_buffer_add_to_infolist (struct t_infolist *infolist, int gui_buffer_line_add_to_infolist (struct t_infolist *infolist, + struct t_gui_buffer *buffer, struct t_gui_line *line) { struct t_infolist_item *ptr_item; @@ -1622,6 +1623,9 @@ gui_buffer_line_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_string (ptr_item, "message", line->message)) return 0; + if (!infolist_new_var_integer (ptr_item, "last_read_line", + (buffer->last_read_line == line) ? 1 : 0)) + return 0; return 1; } diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 0df4ab389..03c6806f6 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -245,6 +245,7 @@ extern void gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number); extern int gui_buffer_add_to_infolist (struct t_infolist *infolist, struct t_gui_buffer *buffer); extern int gui_buffer_line_add_to_infolist (struct t_infolist *infolist, + struct t_gui_buffer *buffer, struct t_gui_line *line); extern void gui_buffer_dump_hexa (struct t_gui_buffer *buffer); extern void gui_buffer_print_log (); diff --git a/src/plugins/plugin-api.c b/src/plugins/plugin-api.c index 3b9dd3fb5..0aea6d584 100644 --- a/src/plugins/plugin-api.c +++ b/src/plugins/plugin-api.c @@ -353,7 +353,8 @@ plugin_api_infolist_get_internal (void *data, const char *infolist_name, for (ptr_line = ((struct t_gui_buffer *)pointer)->lines; ptr_line; ptr_line = ptr_line->next_line) { - if (!gui_buffer_line_add_to_infolist (ptr_infolist, ptr_line)) + if (!gui_buffer_line_add_to_infolist (ptr_infolist, + pointer, ptr_line)) { infolist_free (ptr_infolist); return NULL; -- cgit v1.2.3