about summary refs log tree commit diff stats
path: root/src/command
diff options
context:
space:
mode:
Diffstat (limited to 'src/command')
-rw-r--r--src/command/cmd_ac.c146
1 files changed, 74 insertions, 72 deletions
diff --git a/src/command/cmd_ac.c b/src/command/cmd_ac.c
index 8654a07b..c986be5e 100644
--- a/src/command/cmd_ac.c
+++ b/src/command/cmd_ac.c
@@ -294,6 +294,8 @@ static Autocomplete vcard_togglable_param_ac;
 static Autocomplete vcard_toggle_ac;
 static Autocomplete vcard_address_type_ac;
 
+static GHashTable* ac_funcs = NULL;
+
 /*!
  * \brief Initialization of auto completion for commands.
  *
@@ -1297,6 +1299,78 @@ cmd_ac_init(void)
     vcard_address_type_ac = autocomplete_new();
     autocomplete_add(vcard_address_type_ac, "domestic");
     autocomplete_add(vcard_address_type_ac, "international");
+
+    if (ac_funcs != NULL)
+        g_hash_table_destroy(ac_funcs);
+    ac_funcs = g_hash_table_new(g_str_hash, g_str_equal);
+    g_hash_table_insert(ac_funcs, "/account", _account_autocomplete);
+    g_hash_table_insert(ac_funcs, "/affiliation", _affiliation_autocomplete);
+    g_hash_table_insert(ac_funcs, "/alias", _alias_autocomplete);
+    g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
+    g_hash_table_insert(ac_funcs, "/autoconnect", _autoconnect_autocomplete);
+    g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
+    g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
+    g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
+    g_hash_table_insert(ac_funcs, "/bookmark", _bookmark_autocomplete);
+    g_hash_table_insert(ac_funcs, "/clear", _clear_autocomplete);
+    g_hash_table_insert(ac_funcs, "/close", _close_autocomplete);
+    g_hash_table_insert(ac_funcs, "/cmd", _adhoc_cmd_autocomplete);
+    g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
+    g_hash_table_insert(ac_funcs, "/connect", _connect_autocomplete);
+    g_hash_table_insert(ac_funcs, "/console", _console_autocomplete);
+    g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
+    g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
+    g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
+    g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
+    g_hash_table_insert(ac_funcs, "/help", _help_autocomplete);
+    g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
+    g_hash_table_insert(ac_funcs, "/intype", _intype_autocomplete);
+    g_hash_table_insert(ac_funcs, "/invite", _invite_autocomplete);
+    g_hash_table_insert(ac_funcs, "/join", _join_autocomplete);
+    g_hash_table_insert(ac_funcs, "/kick", _kick_autocomplete);
+    g_hash_table_insert(ac_funcs, "/lastactivity", _lastactivity_autocomplete);
+    g_hash_table_insert(ac_funcs, "/log", _log_autocomplete);
+    g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
+    g_hash_table_insert(ac_funcs, "/mood", _mood_autocomplete);
+    g_hash_table_insert(ac_funcs, "/notify", _notify_autocomplete);
+    g_hash_table_insert(ac_funcs, "/occupants", _occupants_autocomplete);
+#ifdef HAVE_OMEMO
+    g_hash_table_insert(ac_funcs, "/omemo", _omemo_autocomplete);
+#endif
+#ifdef HAVE_LIBOTR
+    g_hash_table_insert(ac_funcs, "/otr", _otr_autocomplete);
+#endif
+#ifdef HAVE_LIBGPGME
+    g_hash_table_insert(ac_funcs, "/ox", _ox_autocomplete);
+    g_hash_table_insert(ac_funcs, "/pgp", _pgp_autocomplete);
+#endif
+    g_hash_table_insert(ac_funcs, "/plugins", _plugins_autocomplete);
+    g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
+    g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
+    g_hash_table_insert(ac_funcs, "/reconnect", _reconnect_autocomplete);
+    g_hash_table_insert(ac_funcs, "/resource", _resource_autocomplete);
+    g_hash_table_insert(ac_funcs, "/role", _role_autocomplete);
+    g_hash_table_insert(ac_funcs, "/rooms", _rooms_autocomplete);
+    g_hash_table_insert(ac_funcs, "/roster", _roster_autocomplete);
+    g_hash_table_insert(ac_funcs, "/script", _script_autocomplete);
+    g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
+    g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
+    g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
+    g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
+    g_hash_table_insert(ac_funcs, "/strophe", _strophe_autocomplete);
+    g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
+    g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
+    g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
+    g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
+    g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
+    g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete);
+    g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
+    g_hash_table_insert(ac_funcs, "/url", _url_autocomplete);
+    g_hash_table_insert(ac_funcs, "/vcard", _vcard_autocomplete);
+    g_hash_table_insert(ac_funcs, "/who", _who_autocomplete);
+    g_hash_table_insert(ac_funcs, "/win", _win_autocomplete);
+    g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
+    g_hash_table_insert(ac_funcs, "/wintitle", _wintitle_autocomplete);
 }
 
 void
@@ -2019,76 +2093,6 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
         }
     }
 
-    GHashTable* ac_funcs = g_hash_table_new(g_str_hash, g_str_equal);
-    g_hash_table_insert(ac_funcs, "/help", _help_autocomplete);
-    g_hash_table_insert(ac_funcs, "/who", _who_autocomplete);
-    g_hash_table_insert(ac_funcs, "/sub", _sub_autocomplete);
-    g_hash_table_insert(ac_funcs, "/notify", _notify_autocomplete);
-    g_hash_table_insert(ac_funcs, "/autoaway", _autoaway_autocomplete);
-    g_hash_table_insert(ac_funcs, "/theme", _theme_autocomplete);
-    g_hash_table_insert(ac_funcs, "/log", _log_autocomplete);
-    g_hash_table_insert(ac_funcs, "/account", _account_autocomplete);
-    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);
-    g_hash_table_insert(ac_funcs, "/ox", _ox_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);
-    g_hash_table_insert(ac_funcs, "/form", _form_autocomplete);
-    g_hash_table_insert(ac_funcs, "/occupants", _occupants_autocomplete);
-    g_hash_table_insert(ac_funcs, "/kick", _kick_autocomplete);
-    g_hash_table_insert(ac_funcs, "/ban", _ban_autocomplete);
-    g_hash_table_insert(ac_funcs, "/affiliation", _affiliation_autocomplete);
-    g_hash_table_insert(ac_funcs, "/role", _role_autocomplete);
-    g_hash_table_insert(ac_funcs, "/resource", _resource_autocomplete);
-    g_hash_table_insert(ac_funcs, "/wintitle", _wintitle_autocomplete);
-    g_hash_table_insert(ac_funcs, "/inpblock", _inpblock_autocomplete);
-    g_hash_table_insert(ac_funcs, "/time", _time_autocomplete);
-    g_hash_table_insert(ac_funcs, "/receipts", _receipts_autocomplete);
-    g_hash_table_insert(ac_funcs, "/reconnect", _reconnect_autocomplete);
-    g_hash_table_insert(ac_funcs, "/wins", _wins_autocomplete);
-    g_hash_table_insert(ac_funcs, "/tls", _tls_autocomplete);
-    g_hash_table_insert(ac_funcs, "/titlebar", _titlebar_autocomplete);
-    g_hash_table_insert(ac_funcs, "/script", _script_autocomplete);
-    g_hash_table_insert(ac_funcs, "/subject", _subject_autocomplete);
-    g_hash_table_insert(ac_funcs, "/console", _console_autocomplete);
-    g_hash_table_insert(ac_funcs, "/win", _win_autocomplete);
-    g_hash_table_insert(ac_funcs, "/close", _close_autocomplete);
-    g_hash_table_insert(ac_funcs, "/plugins", _plugins_autocomplete);
-    g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
-    g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
-    g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
-    g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
-    g_hash_table_insert(ac_funcs, "/rooms", _rooms_autocomplete);
-    g_hash_table_insert(ac_funcs, "/statusbar", _statusbar_autocomplete);
-    g_hash_table_insert(ac_funcs, "/clear", _clear_autocomplete);
-    g_hash_table_insert(ac_funcs, "/invite", _invite_autocomplete);
-    g_hash_table_insert(ac_funcs, "/status", _status_autocomplete);
-    g_hash_table_insert(ac_funcs, "/logging", _logging_autocomplete);
-    g_hash_table_insert(ac_funcs, "/color", _color_autocomplete);
-    g_hash_table_insert(ac_funcs, "/avatar", _avatar_autocomplete);
-    g_hash_table_insert(ac_funcs, "/correction", _correction_autocomplete);
-    g_hash_table_insert(ac_funcs, "/correct", _correct_autocomplete);
-    g_hash_table_insert(ac_funcs, "/software", _software_autocomplete);
-    g_hash_table_insert(ac_funcs, "/url", _url_autocomplete);
-    g_hash_table_insert(ac_funcs, "/executable", _executable_autocomplete);
-    g_hash_table_insert(ac_funcs, "/lastactivity", _lastactivity_autocomplete);
-    g_hash_table_insert(ac_funcs, "/intype", _intype_autocomplete);
-    g_hash_table_insert(ac_funcs, "/mood", _mood_autocomplete);
-    g_hash_table_insert(ac_funcs, "/strophe", _strophe_autocomplete);
-    g_hash_table_insert(ac_funcs, "/cmd", _adhoc_cmd_autocomplete);
-    g_hash_table_insert(ac_funcs, "/vcard", _vcard_autocomplete);
-
     int len = strlen(input);
     char parsed[len + 1];
     int i = 0;
@@ -2106,11 +2110,9 @@ _cmd_ac_complete_params(ProfWin* window, const char* const input, gboolean previ
     if (ac_func) {
         result = ac_func(window, input, previous);
         if (result) {
-            g_hash_table_destroy(ac_funcs);
             return result;
         }
     }
-    g_hash_table_destroy(ac_funcs);
 
     result = plugins_autocomplete(input, previous);
     if (result) {
/widget hierarchy and directory structure' href='/akspecs/ranger/commit/ranger/actions.py?h=v1.8.0&id=d88232a386dbc2153aa12bea7f30c9c53c414010'>d88232a3 ^
0c0b9489 ^

728fb838 ^
b4b0eb24 ^



728fb838 ^
0c0b9489 ^












728fb838 ^
0c0b9489 ^



7ec262f8 ^
728fb838 ^
d88232a3 ^
7ec262f8 ^
0c0b9489 ^

728fb838 ^
0c0b9489 ^


728fb838 ^
0c0b9489 ^



728fb838 ^
d88232a3 ^
0c0b9489 ^



728fb838 ^
0c0b9489 ^


728fb838 ^
0c0b9489 ^




728fb838 ^
0c0b9489 ^


e65cebe4 ^


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138