about summary refs log tree commit diff stats
path: root/src/config/account.c
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-04-15 22:09:47 +0200
committerPaul Fariello <paul@fariello.eu>2019-04-17 14:03:14 +0200
commit5f015e32b263de6ebcaf9a3c6c2ffcad238410a0 (patch)
treea1aed9f92fe491d6e0af30b1c35b46c748ac8796 /src/config/account.c
parent9574127177a8e975add3cef523e85f6e75fe4585 (diff)
downloadprofani-tty-5f015e32b263de6ebcaf9a3c6c2ffcad238410a0.tar.gz
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
Diffstat (limited to 'src/config/account.c')
-rw-r--r--src/config/account.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/config/account.c b/src/config/account.c
index 93ba5078..0c23c585 100644
--- a/src/config/account.c
+++ b/src/config/account.c
@@ -52,7 +52,8 @@ account_new(const gchar *const name, const gchar *const jid,
     int priority_away, int priority_xa, int priority_dnd,
     const gchar *const muc_service, const gchar *const muc_nick,
     const gchar *const otr_policy, GList *otr_manual, GList *otr_opportunistic,
-    GList *otr_always, const gchar *const pgp_keyid, const char *const startscript,
+    GList *otr_always,  const gchar *const omemo_policy, GList *omemo_enabled,
+    GList *omemo_disabled, const gchar *const pgp_keyid, const char *const startscript,
     const char *const theme, gchar *tls_policy)
 {
     ProfAccount *new_account = malloc(sizeof(ProfAccount));
@@ -139,6 +140,15 @@ account_new(const gchar *const name, const gchar *const jid,
     new_account->otr_opportunistic = otr_opportunistic;
     new_account->otr_always = otr_always;
 
+    if (omemo_policy) {
+        new_account->omemo_policy = strdup(omemo_policy);
+    } else {
+        new_account->omemo_policy = NULL;
+    }
+
+    new_account->omemo_enabled = omemo_enabled;
+    new_account->omemo_disabled = omemo_disabled;
+
     if (pgp_keyid != NULL) {
         new_account->pgp_keyid = strdup(pgp_keyid);
     } else {
@@ -232,6 +242,7 @@ account_free(ProfAccount *account)
     free(account->muc_service);
     free(account->muc_nick);
     free(account->otr_policy);
+    free(account->omemo_policy);
     free(account->pgp_keyid);
     free(account->startscript);
     free(account->theme);
@@ -239,6 +250,8 @@ account_free(ProfAccount *account)
     g_list_free_full(account->otr_manual, g_free);
     g_list_free_full(account->otr_opportunistic, g_free);
     g_list_free_full(account->otr_always, g_free);
+    g_list_free_full(account->omemo_enabled, g_free);
+    g_list_free_full(account->omemo_disabled, g_free);
     free(account);
 }