about summary refs log tree commit diff stats
path: root/src/ui/window.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-12-10 01:33:46 +0000
committerJames Booth <boothj5@gmail.com>2014-12-10 01:33:46 +0000
commit12d0d22ab325aafc38e094f16f76ddf3408da181 (patch)
tree318ea190237157e4dd5e2f0829c5b5071d115e04 /src/ui/window.c
parent7b44ac97cc8894047f21233dcbec9a841a636876 (diff)
downloadprofani-tty-12d0d22ab325aafc38e094f16f76ddf3408da181.tar.gz
Moved otr properties to WIN_CHAT type
Diffstat (limited to 'src/ui/window.c')
-rw-r--r--src/ui/window.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/src/ui/window.c b/src/ui/window.c
index 3b189134..89fde6c3 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -79,7 +79,9 @@ win_create(const char * const title, win_type_t type)
     ProfWin *new_win = malloc(sizeof(ProfWin));
     int cols = getmaxx(stdscr);
 
-    switch (type) {
+    new_win->type = type;
+
+    switch (new_win->type) {
     case WIN_CONSOLE:
         new_win->win = newpad(PAD_SIZE, (cols));
         wbkgd(new_win->win, theme_attrs(THEME_TEXT));
@@ -116,10 +118,14 @@ win_create(const char * const title, win_type_t type)
     new_win->paged = 0;
     new_win->unread = 0;
     new_win->history_shown = 0;
-    new_win->type = type;
-    new_win->is_otr = FALSE;
-    new_win->is_trusted = FALSE;
+
+    if (new_win->type == WIN_CHAT) {
+        new_win->wins.chat.is_otr = FALSE;
+        new_win->wins.chat.is_trusted = FALSE;
+    }
+
     new_win->chat_resource = NULL;
+
     scrollok(new_win->win, TRUE);
 
     return new_win;
@@ -178,6 +184,24 @@ win_show_subwin(ProfWin *window)
     }
 }
 
+gboolean win_is_otr(ProfWin *window)
+{
+    if (window->type == WIN_CHAT) {
+        return window->wins.chat.is_otr;
+    } else {
+        return FALSE;
+    }
+}
+
+gboolean win_is_trusted(ProfWin *window)
+{
+    if (window->type == WIN_CHAT) {
+        return window->wins.chat.is_trusted;
+    } else {
+        return FALSE;
+    }
+}
+
 void
 win_free(ProfWin* window)
 {