about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/command/cmd_ac.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index d1d8cb62..63b0f045 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -72,9 +72,15 @@ static char* _account_autocomplete(ProfWin *window, const char *const input, gbo
 static char* _who_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _roster_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _bookmark_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+#ifdef HAVE_LIBOTR
 static char* _otr_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+#endif
+#ifdef HAVE_LIBGPGME
 static char* _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+#endif
+#ifdef HAVE_OMEMO
 static char* _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous);
+#endif
 static char* _connect_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _alias_autocomplete(ProfWin *window, const char *const input, gboolean previous);
 static char* _join_autocomplete(ProfWin *window, const char *const input, gboolean previous);
@@ -170,14 +176,18 @@ static Autocomplete roster_private_ac;
 static Autocomplete group_ac;
 static Autocomplete bookmark_ac;
 static Autocomplete bookmark_property_ac;
+#ifdef HAVE_LIBOTR
 static Autocomplete otr_ac;
 static Autocomplete otr_log_ac;
 static Autocomplete otr_policy_ac;
 static Autocomplete otr_sendfile_ac;
+#endif
+#ifdef HAVE_OMEMO
 static Autocomplete omemo_ac;
 static Autocomplete omemo_log_ac;
 static Autocomplete omemo_policy_ac;
 static Autocomplete omemo_sendfile_ac;
+#endif
 static Autocomplete connect_property_ac;
 static Autocomplete tls_property_ac;
 static Autocomplete alias_ac;
@@ -204,9 +214,11 @@ static Autocomplete time_format_ac;
 static Autocomplete resource_ac;
 static Autocomplete inpblock_ac;
 static Autocomplete receipts_ac;
+#ifdef HAVE_LIBGPGME
 static Autocomplete pgp_ac;
 static Autocomplete pgp_log_ac;
 static Autocomplete pgp_sendfile_ac;
+#endif
 static Autocomplete tls_ac;
 static Autocomplete titlebar_ac;
 static Autocomplete titlebar_show_ac;
@@ -272,9 +284,15 @@ cmd_ac_init(void)
     autocomplete_add(prefs_ac, "log");
     autocomplete_add(prefs_ac, "conn");
     autocomplete_add(prefs_ac, "presence");
+#ifdef HAVE_LIBOTR
     autocomplete_add(prefs_ac, "otr");
+#endif
+#ifdef HAVE_LIBGPGME
     autocomplete_add(prefs_ac, "pgp");
+#endif
+#ifdef HAVE_OMEMO
     autocomplete_add(prefs_ac, "omemo");
+#endif
 
     notify_ac = autocomplete_new();
     autocomplete_add(notify_ac, "chat");
@@ -594,6 +612,7 @@ cmd_ac_init(void)
     autocomplete_add(bookmark_property_ac, "password");
     autocomplete_add(bookmark_property_ac, "autojoin");
 
+#ifdef HAVE_LIBOTR
     otr_ac = autocomplete_new();
     autocomplete_add(otr_ac, "gen");
     autocomplete_add(otr_ac, "start");
@@ -624,7 +643,9 @@ cmd_ac_init(void)
     otr_sendfile_ac = autocomplete_new();
     autocomplete_add(otr_sendfile_ac, "on");
     autocomplete_add(otr_sendfile_ac, "off");
+#endif
 
+#ifdef HAVE_OMEMO
     omemo_ac = autocomplete_new();
     autocomplete_add(omemo_ac, "gen");
     autocomplete_add(omemo_ac, "log");
@@ -651,6 +672,7 @@ cmd_ac_init(void)
     omemo_sendfile_ac = autocomplete_new();
     autocomplete_add(omemo_sendfile_ac, "on");
     autocomplete_add(omemo_sendfile_ac, "off");
+#endif
 
     connect_property_ac = autocomplete_new();
     autocomplete_add(connect_property_ac, "server");
@@ -782,6 +804,7 @@ cmd_ac_init(void)
     autocomplete_add(receipts_ac, "send");
     autocomplete_add(receipts_ac, "request");
 
+#ifdef HAVE_LIBGPGME
     pgp_ac = autocomplete_new();
     autocomplete_add(pgp_ac, "keys");
     autocomplete_add(pgp_ac, "contacts");
@@ -801,6 +824,7 @@ cmd_ac_init(void)
     pgp_sendfile_ac = autocomplete_new();
     autocomplete_add(pgp_sendfile_ac, "on");
     autocomplete_add(pgp_sendfile_ac, "off");
+#endif
 
     tls_ac = autocomplete_new();
     autocomplete_add(tls_ac, "allow");
@@ -1213,14 +1237,18 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(wintitle_ac);
     autocomplete_reset(bookmark_ac);
     autocomplete_reset(bookmark_property_ac);
+#ifdef HAVE_LIBOTR
     autocomplete_reset(otr_ac);
     autocomplete_reset(otr_log_ac);
     autocomplete_reset(otr_policy_ac);
     autocomplete_reset(otr_sendfile_ac);
+#endif
+#ifdef HAVE_OMEMO
     autocomplete_reset(omemo_ac);
     autocomplete_reset(omemo_log_ac);
     autocomplete_reset(omemo_policy_ac);
     autocomplete_reset(omemo_sendfile_ac);
+#endif
     autocomplete_reset(connect_property_ac);
     autocomplete_reset(tls_property_ac);
     autocomplete_reset(alias_ac);
@@ -1247,9 +1275,11 @@ cmd_ac_reset(ProfWin *window)
     autocomplete_reset(resource_ac);
     autocomplete_reset(inpblock_ac);
     autocomplete_reset(receipts_ac);
+#ifdef HAVE_LIBGPGME
     autocomplete_reset(pgp_ac);
     autocomplete_reset(pgp_log_ac);
     autocomplete_reset(pgp_sendfile_ac);
+#endif
     autocomplete_reset(tls_ac);
     autocomplete_reset(titlebar_ac);
     autocomplete_reset(titlebar_show_ac);
@@ -1362,14 +1392,18 @@ cmd_ac_uninit(void)
     autocomplete_free(group_ac);
     autocomplete_free(bookmark_ac);
     autocomplete_free(bookmark_property_ac);
+#ifdef HAVE_LIBOTR
     autocomplete_free(otr_ac);
     autocomplete_free(otr_log_ac);
     autocomplete_free(otr_policy_ac);
     autocomplete_free(otr_sendfile_ac);
+#endif
+#ifdef HAVE_OMEMO
     autocomplete_free(omemo_ac);
     autocomplete_free(omemo_log_ac);
     autocomplete_free(omemo_policy_ac);
     autocomplete_free(omemo_sendfile_ac);
+#endif
     autocomplete_free(connect_property_ac);
     autocomplete_free(tls_property_ac);
     autocomplete_free(alias_ac);
@@ -1395,9 +1429,11 @@ cmd_ac_uninit(void)
     autocomplete_free(resource_ac);
     autocomplete_free(inpblock_ac);
     autocomplete_free(receipts_ac);
+#ifdef HAVE_LIBGPGME
     autocomplete_free(pgp_ac);
     autocomplete_free(pgp_log_ac);
     autocomplete_free(pgp_sendfile_ac);
+#endif
     autocomplete_free(tls_ac);
     autocomplete_free(titlebar_ac);
     autocomplete_free(titlebar_show_ac);
@@ -1644,9 +1680,15 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input, gboolean previ
     g_hash_table_insert(ac_funcs, "/roster",        _roster_autocomplete);
     g_hash_table_insert(ac_funcs, "/bookmark",      _bookmark_autocomplete);
     g_hash_table_insert(ac_funcs, "/autoconnect",   _autoconnect_autocomplete);
+#ifdef HAVE_LIBOTR
     g_hash_table_insert(ac_funcs, "/otr",           _otr_autocomplete);
+#endif
+#ifdef HAVE_LIBGPGME
     g_hash_table_insert(ac_funcs, "/pgp",           _pgp_autocomplete);
+#endif
+#ifdef HAVE_OMEMO
     g_hash_table_insert(ac_funcs, "/omemo",         _omemo_autocomplete);
+#endif
     g_hash_table_insert(ac_funcs, "/connect",       _connect_autocomplete);
     g_hash_table_insert(ac_funcs, "/alias",         _alias_autocomplete);
     g_hash_table_insert(ac_funcs, "/join",          _join_autocomplete);
@@ -2222,6 +2264,7 @@ _autoconnect_autocomplete(ProfWin *window, const char *const input, gboolean pre
     return NULL;
 }
 
+#ifdef HAVE_LIBOTR
 static char*
 _otr_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 {
@@ -2280,7 +2323,9 @@ _otr_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 
     return NULL;
 }
+#endif
 
+#ifdef HAVE_LIBGPGME
 static char*
 _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 {
@@ -2305,7 +2350,6 @@ _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
         return found;
     }
 
-#ifdef HAVE_LIBGPGME
     gboolean result;
     gchar **args = parse_args(input, 2, 3, &result);
     if ((strncmp(input, "/pgp", 4) == 0) && (result == TRUE)) {
@@ -2323,7 +2367,6 @@ _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
         }
     }
     g_strfreev(args);
-#endif
 
     if (conn_status == JABBER_CONNECTED) {
         found = autocomplete_param_with_func(input, "/pgp setkey", roster_barejid_autocomplete, previous, NULL);
@@ -2339,7 +2382,9 @@ _pgp_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 
     return NULL;
 }
+#endif
 
+#ifdef HAVE_OMEMO
 static char*
 _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 {
@@ -2373,7 +2418,6 @@ _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
             return found;
         }
 
-#ifdef HAVE_OMEMO
         if (window->type == WIN_CHAT) {
             ProfChatWin *chatwin = (ProfChatWin*)window;
             assert(chatwin->memcheck == PROFCHATWIN_MEMCHECK);
@@ -2399,10 +2443,7 @@ _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
                     }
                 }
             }
-
-            return NULL;
         }
-#endif
     }
 
     found = autocomplete_param_with_ac(input, "/omemo", omemo_ac, TRUE, previous);
@@ -2412,6 +2453,7 @@ _omemo_autocomplete(ProfWin *window, const char *const input, gboolean previous)
 
     return NULL;
 }
+#endif
 
 static char*
 _plugins_autocomplete(ProfWin *window, const char *const input, gboolean previous)