about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
authorDebXWoody <stefan@debxwoody.de>2020-06-20 06:45:40 +0200
committerDebXWoody <stefan@debxwoody.de>2020-06-20 06:45:40 +0200
commitb7f959bab4e8ed13e8b5d638180420e497844a26 (patch)
tree31a7ae550ec35656da09fa0fef717fb3ea6d2418 /src/command
parentc81931c35d1b6fbcc6cbbdf77379c1b22d682c36 (diff)
downloadprofani-tty-b7f959bab4e8ed13e8b5d638180420e497844a26.tar.gz
Clean-up: defines cmd_funcs.c
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_funcs.c48
1 files changed, 6 insertions, 42 deletions
diff --git a/src/command/cmd_funcs.c b/src/command/cmd_funcs.c
index 1c13d12f..d184e56e 100644
--- a/src/command/cmd_funcs.c
+++ b/src/command/cmd_funcs.c
@@ -2187,24 +2187,13 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
         }
         ui_focus_win((ProfWin*)chatwin);
 
-#ifdef HAVE_OMEMO
-#ifndef HAVE_LIBOTR
-        if (omemo_automatic_start(barejid)) {
-            omemo_start_session(barejid);
-            chatwin->is_omemo = TRUE;
-        }
+        gboolean is_otr_secure = FALSE;
+#ifdef HAVE_LIBOTR
+        is_otr_secure = otr_is_secure(barejid);
+#endif // HAVE_LIBOTR
 
-        if (msg) {
-            cl_ev_send_msg(chatwin, msg, NULL);
-        }
 
-        return TRUE;
-#endif
-#endif
-
-#ifdef HAVE_OMEMO
-#ifdef HAVE_LIBOTR
-        if (omemo_automatic_start(barejid) && otr_is_secure(barejid)) {
+        if (omemo_automatic_start(barejid) && is_otr_secure) {
             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_automatic_start(barejid)) {
@@ -2215,39 +2204,14 @@ cmd_msg(ProfWin *window, const char *const command, gchar **args)
         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));
             }
+#endif // HAVE_LIBOTR
         }
 
         return TRUE;
-#endif
-#endif
-
-#ifndef HAVE_OMEMO
-#ifndef HAVE_LIBOTR
-        if (msg) {
-            cl_ev_send_msg(chatwin, msg, NULL);
-        }
-
-        return TRUE;
-#endif
-#endif
-
     }
 }