about summary refs log tree commit diff stats
path: root/src/ui/titlebar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/titlebar.c')
-rw-r--r--src/ui/titlebar.c98
1 files changed, 54 insertions, 44 deletions
diff --git a/src/ui/titlebar.c b/src/ui/titlebar.c
index 746d2782..16a9eaff 100644
--- a/src/ui/titlebar.c
+++ b/src/ui/titlebar.c
@@ -58,9 +58,7 @@ static GTimer *typing_elapsed;
 static void _title_bar_draw(void);
 static void _show_self_presence(void);
 static void _show_contact_presence(ProfChatWin *chatwin);
-#ifdef HAVE_LIBOTR
 static void _show_privacy(ProfChatWin *chatwin);
-#endif
 
 void
 create_title_bar(void)
@@ -174,10 +172,7 @@ _title_bar_draw(void)
         ProfChatWin *chatwin = (ProfChatWin*) current;
         assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
         _show_contact_presence(chatwin);
-
-#ifdef HAVE_LIBOTR
         _show_privacy(chatwin);
-#endif
 
         if (typing) {
             wprintw(win, " (typing...)");
@@ -246,66 +241,81 @@ _show_self_presence(void)
     wattroff(win, bracket_attrs);
 }
 
-#ifdef HAVE_LIBOTR
 static void
 _show_privacy(ProfChatWin *chatwin)
 {
     int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
+    int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED);
+    int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
+    int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED);
+    int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED);
+
+    switch (chatwin->enc_mode) {
+        case PROF_ENC_NONE:
+            if (prefs_get_boolean(PREF_ENC_WARN)) {
+                wprintw(win, " ");
+                wattron(win, bracket_attrs);
+                wprintw(win, "[");
+                wattroff(win, bracket_attrs);
+                wattron(win, unencrypted_attrs);
+                wprintw(win, "unencrypted");
+                wattroff(win, unencrypted_attrs);
+                wattron(win, bracket_attrs);
+                wprintw(win, "]");
+                wattroff(win, bracket_attrs);
+            }
+            break;
 
-    if (chatwin->enc_mode == PROF_ENC_NONE) {
-        if (prefs_get_boolean(PREF_OTR_WARN)) {
-            int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
+        case PROF_ENC_OTR:
             wprintw(win, " ");
             wattron(win, bracket_attrs);
             wprintw(win, "[");
             wattroff(win, bracket_attrs);
-            wattron(win, unencrypted_attrs);
-            wprintw(win, "unencrypted");
-            wattroff(win, unencrypted_attrs);
+            wattron(win, encrypted_attrs);
+            wprintw(win, "OTR");
+            wattroff(win, encrypted_attrs);
             wattron(win, bracket_attrs);
             wprintw(win, "]");
             wattroff(win, bracket_attrs);
-        }
-    } else {
-        int encrypted_attrs = theme_attrs(THEME_TITLE_ENCRYPTED);
-        wprintw(win, " ");
-        wattron(win, bracket_attrs);
-        wprintw(win, "[");
-        wattroff(win, bracket_attrs);
-        wattron(win, encrypted_attrs);
-        wprintw(win, "OTR");
-        wattroff(win, encrypted_attrs);
-        wattron(win, bracket_attrs);
-        wprintw(win, "]");
-        wattroff(win, bracket_attrs);
-        if (chatwin->otr_is_trusted) {
-            int trusted_attrs = theme_attrs(THEME_TITLE_TRUSTED);
-            wprintw(win, " ");
-            wattron(win, bracket_attrs);
-            wprintw(win, "[");
-            wattroff(win, bracket_attrs);
-            wattron(win, trusted_attrs);
-            wprintw(win, "trusted");
-            wattroff(win, trusted_attrs);
-            wattron(win, bracket_attrs);
-            wprintw(win, "]");
-            wattroff(win, bracket_attrs);
-        } else {
-            int untrusted_attrs = theme_attrs(THEME_TITLE_UNTRUSTED);
+            if (chatwin->otr_is_trusted) {
+                wprintw(win, " ");
+                wattron(win, bracket_attrs);
+                wprintw(win, "[");
+                wattroff(win, bracket_attrs);
+                wattron(win, trusted_attrs);
+                wprintw(win, "trusted");
+                wattroff(win, trusted_attrs);
+                wattron(win, bracket_attrs);
+                wprintw(win, "]");
+                wattroff(win, bracket_attrs);
+            } else {
+                wprintw(win, " ");
+                wattron(win, bracket_attrs);
+                wprintw(win, "[");
+                wattroff(win, bracket_attrs);
+                wattron(win, untrusted_attrs);
+                wprintw(win, "untrusted");
+                wattroff(win, untrusted_attrs);
+                wattron(win, bracket_attrs);
+                wprintw(win, "]");
+                wattroff(win, bracket_attrs);
+            }
+            break;
+
+        case PROF_ENC_PGP:
             wprintw(win, " ");
             wattron(win, bracket_attrs);
             wprintw(win, "[");
             wattroff(win, bracket_attrs);
-            wattron(win, untrusted_attrs);
-            wprintw(win, "untrusted");
-            wattroff(win, untrusted_attrs);
+            wattron(win, encrypted_attrs);
+            wprintw(win, "PGP");
+            wattroff(win, encrypted_attrs);
             wattron(win, bracket_attrs);
             wprintw(win, "]");
             wattroff(win, bracket_attrs);
-        }
+            break;
     }
 }
-#endif
 
 static void
 _show_contact_presence(ProfChatWin *chatwin)
tik.com> 2020-11-02 21:24:53 -0800 committer Kartik Agaram <vc@akkartik.com> 2020-11-02 21:24:53 -0800 7162' href='/akkartik/mu/commit/html/411string.mu.html?h=main&id=3d1c4216ede8c628558c9fe700fb2be1aa08b473'>3d1c4216 ^
3ff2fe60 ^
3d1c4216 ^

dd60caa3 ^
3350c34a ^
3d1c4216 ^
dd60caa3 ^
3d1c4216 ^
3ff2fe60 ^
372367f5 ^
3d1c4216 ^



3ff2fe60 ^
3350c34a ^
3d1c4216 ^

3350c34a ^
3d1c4216 ^

3ff2fe60 ^
3350c34a ^
3d1c4216 ^



3ff2fe60 ^
3350c34a ^
3d1c4216 ^
3ff2fe60 ^
3d1c4216 ^
3350c34a ^
3d1c4216 ^


775f77c3 ^
3d1c4216 ^



dd60caa3 ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^
52e3ea8a ^
3d1c4216 ^

3350c34a ^
3d1c4216 ^

52e3ea8a ^
3d1c4216 ^

3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

52e3ea8a ^
3350c34a ^
3d1c4216 ^

3ff2fe60 ^
3d1c4216 ^
dd60caa3 ^
3350c34a ^
3d1c4216 ^
dd60caa3 ^
3d1c4216 ^
dd60caa3 ^
3d1c4216 ^
3ff2fe60 ^
3d1c4216 ^

3ff2fe60 ^
3d1c4216 ^





372367f5 ^
775f77c3 ^
3d1c4216 ^
3350c34a ^
3d1c4216 ^

3ff2fe60 ^
3d1c4216 ^

775f77c3 ^
3d1c4216 ^



dd60caa3 ^
3d1c4216 ^







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192