mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added enc_mode to ProfChatWin
This commit is contained in:
parent
a0c872edf8
commit
8ccbeade44
@ -714,7 +714,7 @@ ui_close_connected_win(int index)
|
|||||||
ProfChatWin *chatwin = (ProfChatWin*) window;
|
ProfChatWin *chatwin = (ProfChatWin*) window;
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
if (chatwin->is_otr) {
|
if (chatwin->enc_mode == PROF_ENC_OTR) {
|
||||||
otr_end_session(chatwin->barejid);
|
otr_end_session(chatwin->barejid);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -896,7 +896,7 @@ ui_gone_secure(const char * const barejid, gboolean trusted)
|
|||||||
chatwin = (ProfChatWin*)window;
|
chatwin = (ProfChatWin*)window;
|
||||||
}
|
}
|
||||||
|
|
||||||
chatwin->is_otr = TRUE;
|
chatwin->enc_mode = PROF_ENC_OTR;
|
||||||
chatwin->is_trusted = trusted;
|
chatwin->is_trusted = trusted;
|
||||||
if (trusted) {
|
if (trusted) {
|
||||||
win_print(window, '!', NULL, 0, THEME_OTR_STARTED_TRUSTED, "", "OTR session started (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);
|
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||||
if (chatwin) {
|
if (chatwin) {
|
||||||
chatwin->is_otr = FALSE;
|
chatwin->enc_mode = PROF_ENC_NONE;
|
||||||
chatwin->is_trusted = FALSE;
|
chatwin->is_trusted = FALSE;
|
||||||
|
|
||||||
ProfWin *window = (ProfWin*)chatwin;
|
ProfWin *window = (ProfWin*)chatwin;
|
||||||
@ -1043,7 +1043,7 @@ ui_trust(const char * const barejid)
|
|||||||
{
|
{
|
||||||
ProfChatWin *chatwin = wins_get_chat(barejid);
|
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||||
if (chatwin) {
|
if (chatwin) {
|
||||||
chatwin->is_otr = TRUE;
|
chatwin->enc_mode = PROF_ENC_OTR;
|
||||||
chatwin->is_trusted = TRUE;
|
chatwin->is_trusted = TRUE;
|
||||||
|
|
||||||
ProfWin *window = (ProfWin*)chatwin;
|
ProfWin *window = (ProfWin*)chatwin;
|
||||||
@ -1059,7 +1059,7 @@ ui_untrust(const char * const barejid)
|
|||||||
{
|
{
|
||||||
ProfChatWin *chatwin = wins_get_chat(barejid);
|
ProfChatWin *chatwin = wins_get_chat(barejid);
|
||||||
if (chatwin) {
|
if (chatwin) {
|
||||||
chatwin->is_otr = TRUE;
|
chatwin->enc_mode = PROF_ENC_OTR;
|
||||||
chatwin->is_trusted = FALSE;
|
chatwin->is_trusted = FALSE;
|
||||||
|
|
||||||
ProfWin *window = (ProfWin*)chatwin;
|
ProfWin *window = (ProfWin*)chatwin;
|
||||||
@ -1164,7 +1164,7 @@ ui_current_win_is_otr(void)
|
|||||||
if (current->type == WIN_CHAT) {
|
if (current->type == WIN_CHAT) {
|
||||||
ProfChatWin *chatwin = (ProfChatWin*)current;
|
ProfChatWin *chatwin = (ProfChatWin*)current;
|
||||||
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
|
||||||
return chatwin->is_otr;
|
return chatwin->enc_mode == PROF_ENC_OTR;
|
||||||
} else {
|
} else {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1304,7 +1304,7 @@ ui_new_chat_win(const char * const barejid)
|
|||||||
|
|
||||||
#ifdef HAVE_LIBOTR
|
#ifdef HAVE_LIBOTR
|
||||||
if (otr_is_secure(barejid)) {
|
if (otr_is_secure(barejid)) {
|
||||||
chatwin->is_otr = TRUE;
|
chatwin->enc_mode = PROF_ENC_OTR;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ _show_privacy(ProfChatWin *chatwin)
|
|||||||
{
|
{
|
||||||
int bracket_attrs = theme_attrs(THEME_TITLE_BRACKET);
|
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)) {
|
if (prefs_get_boolean(PREF_OTR_WARN)) {
|
||||||
int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
|
int unencrypted_attrs = theme_attrs(THEME_TITLE_UNENCRYPTED);
|
||||||
wprintw(win, " ");
|
wprintw(win, " ");
|
||||||
|
@ -134,7 +134,7 @@ win_create_chat(const char * const barejid)
|
|||||||
|
|
||||||
new_win->barejid = strdup(barejid);
|
new_win->barejid = strdup(barejid);
|
||||||
new_win->resource_override = NULL;
|
new_win->resource_override = NULL;
|
||||||
new_win->is_otr = FALSE;
|
new_win->enc_mode = PROF_ENC_NONE;
|
||||||
new_win->is_trusted = FALSE;
|
new_win->is_trusted = FALSE;
|
||||||
new_win->history_shown = FALSE;
|
new_win->history_shown = FALSE;
|
||||||
new_win->unread = 0;
|
new_win->unread = 0;
|
||||||
|
@ -99,6 +99,11 @@ typedef enum {
|
|||||||
WIN_XML
|
WIN_XML
|
||||||
} win_type_t;
|
} win_type_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PROF_ENC_NONE,
|
||||||
|
PROF_ENC_OTR
|
||||||
|
} prof_enc_t;
|
||||||
|
|
||||||
typedef struct prof_win_t {
|
typedef struct prof_win_t {
|
||||||
win_type_t type;
|
win_type_t type;
|
||||||
ProfLayout *layout;
|
ProfLayout *layout;
|
||||||
@ -113,7 +118,7 @@ typedef struct prof_chat_win_t {
|
|||||||
char *barejid;
|
char *barejid;
|
||||||
int unread;
|
int unread;
|
||||||
ChatState *state;
|
ChatState *state;
|
||||||
gboolean is_otr;
|
prof_enc_t enc_mode;
|
||||||
gboolean is_trusted;
|
gboolean is_trusted;
|
||||||
char *resource_override;
|
char *resource_override;
|
||||||
gboolean history_shown;
|
gboolean history_shown;
|
||||||
|
Loading…
Reference in New Issue
Block a user