about summary refs log tree commit diff stats
path: root/src/ui
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-04 21:39:56 +0100
committerJames Booth <boothj5@gmail.com>2015-05-04 21:39:56 +0100
commit176fba84a04d8c0864b57feb848cccfe5c4814e3 (patch)
treec5c114aeb3c39bf425c48cd3b727f7c32d74553d /src/ui
parent65ea572dae158be4ea2c3501e4cdd42fe3e658ee (diff)
parent8ccbeade44f7929d7ec77b2f0a6198bd95432f0f (diff)
downloadprofani-tty-176fba84a04d8c0864b57feb848cccfe5c4814e3.tar.gz
Merge branch 'master' into pgp
Diffstat (limited to 'src/ui')
-rw-r--r--src/ui/core.c14
-rw-r--r--src/ui/titlebar.c2
-rw-r--r--src/ui/window.c2
-rw-r--r--src/ui/window.h7
4 files changed, 15 insertions, 10 deletions
diff --git a/src/ui/core.c b/src/ui/core.c
index 8c4d4644..e75d5432 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -714,7 +714,7 @@ ui_close_connected_win(int index)
             ProfChatWin *chatwin = (ProfChatWin*) window;
             assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
 #ifdef HAVE_LIBOTR
-            if (chatwin->is_otr) {
+            if (chatwin->enc_mode == PROF_ENC_OTR) {
                 otr_end_session(chatwin->barejid);
             }
 #endif
@@ -896,7 +896,7 @@ ui_gone_secure(const char * const barejid, gboolean trusted)
         chatwin = (ProfChatWin*)window;
     }
 
-    chatwin->is_otr = TRUE;
+    chatwin->enc_mode = PROF_ENC_OTR;
     chatwin->is_trusted = trusted;
     if (trusted) {
         win_print(window, '!', NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (trusted).");
@@ -924,7 +924,7 @@ ui_gone_insecure(const char * const barejid)
 {
     ProfChatWin *chatwin = wins_get_chat(barejid);
     if (chatwin) {
-        chatwin->is_otr = FALSE;
+        chatwin->enc_mode = PROF_ENC_NONE;
         chatwin->is_trusted = FALSE;
 
         ProfWin *window = (ProfWin*)chatwin;
@@ -1043,7 +1043,7 @@ ui_trust(const char * const barejid)
 {
     ProfChatWin *chatwin = wins_get_chat(barejid);
     if (chatwin) {
-        chatwin->is_otr = TRUE;
+        chatwin->enc_mode = PROF_ENC_OTR;
         chatwin->is_trusted = TRUE;
 
         ProfWin *window = (ProfWin*)chatwin;
@@ -1059,7 +1059,7 @@ ui_untrust(const char * const barejid)
 {
     ProfChatWin *chatwin = wins_get_chat(barejid);
     if (chatwin) {
-        chatwin->is_otr = TRUE;
+        chatwin->enc_mode = PROF_ENC_OTR;
         chatwin->is_trusted = FALSE;
 
         ProfWin *window = (ProfWin*)chatwin;
@@ -1164,7 +1164,7 @@ ui_current_win_is_otr(void)
     if (current->type == WIN_CHAT) {
         ProfChatWin *chatwin = (ProfChatWin*)current;
         assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
-        return chatwin->is_otr;
+        return chatwin->enc_mode == PROF_ENC_OTR;
     } else {
         return FALSE;
     }
@@ -1304,7 +1304,7 @@ ui_new_chat_win(const char * const barejid)
 
 #ifdef HAVE_LIBOTR
     if (otr_is_secure(barejid)) {
-        chatwin->is_otr = TRUE;
+        chatwin->enc_mode = PROF_ENC_OTR;
     }
 #endif
 
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 7b80c889..08c9a8e6 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -252,7 +252,7 @@ _show_privacy(ProfChatWin *chatwin)
 {
     int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
 
-    if (!chatwin->is_otr) {
+    if (chatwin->enc_mode == PROF_ENC_NONE) {
         if (prefs_get_boolean(PREF_OTR_WARN)) {
             int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
             wprintw(win, " ");
diff --git a/src/ui/window.c b/src/ui/window.c
index ab894d07..60c71802 100644
--- a/src/ui/window.c
+++ b/src/ui/window.c
@@ -134,7 +134,7 @@ win_create_chat(const char * const barejid)
 
     new_win->barejid = strdup(barejid);
     new_win->resource_override = NULL;
-    new_win->is_otr = FALSE;
+    new_win->enc_mode = PROF_ENC_NONE;
     new_win->is_trusted = FALSE;
     new_win->history_shown = FALSE;
     new_win->unread = 0;
diff --git a/src/ui/window.h b/src/ui/window.h
index 650df67f..d5e57971 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -99,6 +99,11 @@ typedef enum {
     WIN_XML
 } win_type_t;
 
+typedef enum {
+    PROF_ENC_NONE,
+    PROF_ENC_OTR
+} prof_enc_t;
+
 typedef struct prof_win_t {
     win_type_t type;
     ProfLayout *layout;
@@ -113,7 +118,7 @@ typedef struct prof_chat_win_t {
     char *barejid;
     int unread;
     ChatState *state;
-    gboolean is_otr;
+    prof_enc_t enc_mode;
     gboolean is_trusted;
     char *resource_override;
     gboolean history_shown;