about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2021-05-31 10:03:22 +0200
committerGitHub <noreply@github.com>2021-05-31 10:03:22 +0200
commit956fd547c1beaeb1254b2899f1f3576f5511128a (patch)
tree1e4baf645cd61d75682ccbf722223592ac5fbaca /src/ui/window.c
parent9f174c53cf7d52a7b684ed1e0d6ed00463eb498b (diff)
parent6df062b542d2376d464b2a9d8d6577fdf906cab4 (diff)
downloadprofani-tty-956fd547c1beaeb1254b2899f1f3576f5511128a.tar.gz
Merge pull request #1543 from DebXWoody/feature/attention-flag
Feature - attention flag
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index b6676774..4fb7d5f7 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -158,7 +158,7 @@ win_create_chat(const char* const barejid)
     new_win->outgoing_char = NULL;
     new_win->last_message = NULL;
     new_win->last_msg_id = NULL;
-
+    new_win->has_attention = FALSE;
     new_win->memcheck = PROFCHATWIN_MEMCHECK;
 
     return &new_win->window;
@@ -213,6 +213,7 @@ win_create_muc(const char* const roomjid)
     new_win->is_omemo = FALSE;
     new_win->last_message = NULL;
     new_win->last_msg_id = NULL;
+    new_win->has_attention = FALSE;
 
     new_win->memcheck = PROFMUCWIN_MEMCHECK;
 
@@ -1841,6 +1842,39 @@ win_unread(ProfWin* window)
     }
 }
 
+gboolean
+win_has_attention(ProfWin* window) 
+{
+    if (window->type == WIN_CHAT) {
+        ProfChatWin* chatwin = (ProfChatWin*)window;
+        assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+        return chatwin->has_attention;
+    } else if (window->type == WIN_MUC) {
+        ProfMucWin* mucwin = (ProfMucWin*)window;
+        assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+        return mucwin->has_attention;
+    }
+    return FALSE;
+}
+
+gboolean 
+win_toggle_attention(ProfWin* window) 
+{
+    if (window->type == WIN_CHAT) {
+        ProfChatWin* chatwin = (ProfChatWin*)window;
+        assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
+        chatwin->has_attention = !chatwin->has_attention;
+        return chatwin->has_attention;
+    } else if (window->type == WIN_MUC) {
+        ProfMucWin* mucwin = (ProfMucWin*)window;
+        assert(mucwin->memcheck == PROFMUCWIN_MEMCHECK);
+        mucwin->has_attention = !mucwin->has_attention;
+        return mucwin->has_attention;
+    }
+    return FALSE;
+}
+
+
 void
 win_sub_print(WINDOW* win, char* msg, gboolean newline, gboolean wrap, int indent)
 {