about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-06-09 18:41:56 +0200
committerMichael Vetter <jubalh@iodoru.org>2021-06-09 18:41:56 +0200
commit86aec9d06885785ddd35185d1f17394554814f3d (patch)
treeb6101ccfcc338f23172f278c1a4e68a3c3d92015
parent343d970e3da319afe4109ad1c9d664ffe09dedfa (diff)
downloadprofani-tty-86aec9d06885785ddd35185d1f17394554814f3d.tar.gz
win unread: fix window test
Fix https://github.com/profanity-im/profanity/issues/1554
-rw-r--r--src/ui/window_list.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/ui/window_list.c b/src/ui/window_list.c
index 19104ea0..d698d778 100644
--- a/src/ui/window_list.c
+++ b/src/ui/window_list.c
@@ -1205,16 +1205,15 @@ ProfWin*
 wins_get_next_unread(void)
 {
     // get and sort win nums
-    GList* values = g_hash_table_get_values(windows);
+    GList* values = g_hash_table_get_keys(windows);
     values = g_list_sort(values, _wins_cmp_num);
     GList* curr = values;
 
     while (curr) {
-        if (current == GPOINTER_TO_INT(curr->data)) {
-            break;
-        }
+        int curr_win_num = GPOINTER_TO_INT(curr->data); 
+        ProfWin* window = wins_get_by_num(curr_win_num);
 
-        ProfWin* window = curr->data;
+        // test if window has unread messages
         if (win_unread(window) > 0) {
             g_list_free(values);
             return window;