about summary refs log tree commit diff stats
path: root/src/ui/window_list.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-06-05 09:33:10 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-06-05 09:49:50 +0200
commit13675fbf06a0d0fbae2b974596a0fb513ba22340 (patch)
tree9194b150f3db163e5086d747a06f2f0f09cd72a7 /src/ui/window_list.c
parent06f5e94dd7792bba568af69822d57f8e699277b1 (diff)
downloadprofani-tty-13675fbf06a0d0fbae2b974596a0fb513ba22340.tar.gz
Only print room history for new messages upon reconnect
If re-establish a connection don't print the room history again.
In case there there happened nothing at all since we got the room
history on the last connection.
And in case there were no new messages during the time we have been
disconnected.

Instead of printing the room history again we now print 'Re-established
Connection'.

This adds a bit of overhead since we save the timestamp upon every MUC
message.

See: https://github.com/profanity-im/profanity/issues/704
Diffstat (limited to 'src/ui/window_list.c')
-rw-r--r--src/ui/window_list.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index 43230b57..6e2f82dd 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -846,6 +846,27 @@ wins_lost_connection(void)
 }
 
 void
+wins_reestablished_connection(void)
+{
+    GList *values = g_hash_table_get_values(windows);
+    GList *curr = values;
+
+    while (curr) {
+        ProfWin *window = curr->data;
+        if (window->type != WIN_CONSOLE) {
+            win_println(window, THEME_TEXT, '-', "Connection re-established.");
+
+            // if current win, set current_win_dirty
+            if (wins_is_current(window)) {
+                win_update_virtual(window);
+            }
+        }
+        curr = g_list_next(curr);
+    }
+    g_list_free(values);
+}
+
+void
 wins_swap(int source_win, int target_win)
 {
     ProfWin *source = g_hash_table_lookup(windows, GINT_TO_POINTER(source_win));