aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorPaul Fariello <paul@fariello.eu>2019-04-09 08:22:35 +0320
committerPaul Fariello <paul@fariello.eu>2019-04-10 17:24:56 +0200
commit0bc660400b9a62ae2982b1ec6c374de13ec54477 (patch)
tree9dda2dbd9913e3a90f1fb7da4597b2f7683378c4 /src/command
parent25eb138d0b1cdddb5b0338f84c5b5f4dca0098ca (diff)
downloadprofani-tty-0bc660400b9a62ae2982b1ec6c374de13ec54477.tar.gz
Automatically starts OMEMO if one identity is trusted
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index e1f62ace..b004c4e1 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2150,17 +2150,67 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
}
ui_focus_win((ProfWin*)chatwin);
+#ifdef HAVE_OMEMO
+#ifndef HAVE_LIBOTR
+ if (omemo_is_trusted_jid(barejid)) {
+ omemo_start_session(barejid);
+ chatwin->is_omemo = TRUE;
+ }
+
+ if (msg) {
+ cl_ev_send_msg(chatwin, msg, NULL);
+ }
+
+ return TRUE;
+#endif
+#endif
+
+#ifdef HAVE_OMEMO
+#ifdef HAVE_LIBOTR
+ if (omemo_is_trusted_jid(barejid) && otr_is_secure(barejid)) {
+ win_println(window, THEME_DEFAULT, '!', "Chat could be either OMEMO or OTR encrypted. Use '/omemo start %s' or '/otr start %s' to start a session.", usr, usr);
+ return TRUE;
+ } else if (omemo_is_trusted_jid(barejid)) {
+ omemo_start_session(barejid);
+ chatwin->is_omemo = TRUE;
+ }
+
if (msg) {
cl_ev_send_msg(chatwin, msg, NULL);
} else {
+ if (otr_is_secure(barejid)) {
+ chatwin_otr_secured(chatwin, otr_is_trusted(barejid));
+ }
+ }
+
+ return TRUE;
+#endif
+#endif
+
+#ifndef HAVE_OMEMO
#ifdef HAVE_LIBOTR
+ if (msg) {
+ cl_ev_send_msg(chatwin, msg, NULL);
+ } else {
if (otr_is_secure(barejid)) {
chatwin_otr_secured(chatwin, otr_is_trusted(barejid));
}
+ }
+
+ return TRUE;
#endif
+#endif
+
+#ifndef HAVE_OMEMO
+#ifndef HAVE_LIBOTR
+ if (msg) {
+ cl_ev_send_msg(chatwin, msg, NULL);
}
return TRUE;
+#endif
+#endif
+
}
}