1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-06-23 21:45:30 +00:00

Added enc_mode to ProfChatWin

This commit is contained in:
James Booth 2015-05-04 21:38:19 +01:00
parent a0c872edf8
commit 8ccbeade44
4 changed files with 15 additions and 10 deletions

View File

@ -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

View File

@ -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, " ");

View File

@ -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;

View File

@ -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;