Add OMEMO policy
There is 3 policy: - manual: OMEMO session are only started manually - automatic: OMEMO session are only started if they have been started manually before - always: OMEMO session are always started unless they have been ended manually before Closes #1040 and fixes #1052
This commit is contained in:
@@ -50,6 +50,9 @@
|
||||
#ifdef HAVE_LIBOTR
|
||||
#include "otr/otr.h"
|
||||
#endif
|
||||
#ifdef HAVE_OMEMO
|
||||
#include "omemo/omemo.h"
|
||||
#endif
|
||||
|
||||
static void _chatwin_history(ProfChatWin *chatwin, const char *const contact);
|
||||
|
||||
@@ -73,6 +76,13 @@ chatwin_new(const char *const barejid)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo_automatic_start(barejid)) {
|
||||
omemo_start_session(barejid);
|
||||
chatwin->is_omemo = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return chatwin;
|
||||
}
|
||||
|
||||
|
||||
@@ -2004,6 +2004,10 @@ cons_show_omemo_prefs(void)
|
||||
cons_show("OMEMO preferences:");
|
||||
cons_show("");
|
||||
|
||||
char *policy_value = prefs_get_string(PREF_OMEMO_POLICY);
|
||||
cons_show("OMEMO policy (/omemo policy) : %s", policy_value);
|
||||
prefs_free_string(policy_value);
|
||||
|
||||
char *log_value = prefs_get_string(PREF_OMEMO_LOG);
|
||||
if (strcmp(log_value, "on") == 0) {
|
||||
cons_show("OMEMO logging (/omemo log) : ON");
|
||||
|
||||
@@ -763,7 +763,7 @@ ui_room_join(const char *const roomjid, gboolean focus)
|
||||
{
|
||||
ProfMucWin *mucwin = wins_get_muc(roomjid);
|
||||
if (mucwin == NULL) {
|
||||
mucwin = (ProfMucWin*)wins_new_muc(roomjid);
|
||||
mucwin = mucwin_new(roomjid);
|
||||
}
|
||||
ProfWin *window = (ProfWin*)mucwin;
|
||||
|
||||
|
||||
@@ -44,6 +44,25 @@
|
||||
#include "ui/window.h"
|
||||
#include "ui/win_types.h"
|
||||
#include "ui/window_list.h"
|
||||
#ifdef HAVE_OMEMO
|
||||
#include "omemo/omemo.h"
|
||||
#endif
|
||||
|
||||
ProfMucWin*
|
||||
mucwin_new(const char *const barejid)
|
||||
{
|
||||
ProfWin *window = wins_new_muc(barejid);
|
||||
ProfMucWin *mucwin = (ProfMucWin *)window;
|
||||
|
||||
#ifdef HAVE_OMEMO
|
||||
if (omemo_automatic_start(barejid)) {
|
||||
omemo_start_muc_sessions(barejid);
|
||||
mucwin->is_omemo = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return mucwin;
|
||||
}
|
||||
|
||||
void
|
||||
mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason)
|
||||
|
||||
@@ -149,6 +149,7 @@ void chatwin_set_outgoing_char(ProfChatWin *chatwin, const char *const ch);
|
||||
void chatwin_unset_outgoing_char(ProfChatWin *chatwin);
|
||||
|
||||
// MUC window
|
||||
ProfMucWin* mucwin_new(const char *const barejid);
|
||||
void mucwin_role_change(ProfMucWin *mucwin, const char *const role, const char *const actor, const char *const reason);
|
||||
void mucwin_affiliation_change(ProfMucWin *mucwin, const char *const affiliation, const char *const actor,
|
||||
const char *const reason);
|
||||
|
||||
Reference in New Issue
Block a user