Mercurial > ~mikael > mcabber > hg
annotate mcabber/mcabber/compl.c @ 1902:51cc01a1a5ec
Improve messages when connecting to the Jabber server
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Wed, 14 Apr 2010 21:27:37 +0200 |
parents | 057b514b1f12 |
children | 4ba68ad737bc |
rev | line source |
---|---|
94 | 1 /* |
2 * compl.c -- Completion system | |
393 | 3 * |
1729
e6e89b1d7831
Minor style and header updates
Mikael Berthe <mikael@lilotux.net>
parents:
1685
diff
changeset
|
4 * Copyright (C) 2005-2010 Mikael Berthe <mikael@lilotux.net> |
1828
8f7d7c05f275
Small coding style update
Mikael Berthe <mikael@lilotux.net>
parents:
1811
diff
changeset
|
5 * Copyright (C) 2009,2010 Myhailo Danylenko <isbear@ukrpost.net> |
94 | 6 * |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or (at | |
10 * your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, but | |
13 * WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 * General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
20 * USA | |
21 */ | |
22 | |
23 /* Usage, basically: | |
24 * - new_completion(); // 1. Initialization | |
25 * - complete(); // 2. 1st completion | |
26 * - cancel_completion(); // 3a. 2nd completion / cancel previous | |
27 * - complete(); // 3b. 2nd completion / complete | |
28 * ... | |
29 * - done_completion(); // n. finished -- free allocated areas | |
30 * | |
31 */ | |
32 | |
33 #include <string.h> | |
34 | |
35 #include "compl.h" | |
1240
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
36 #include "utf8.h" |
225 | 37 #include "roster.h" |
757
ae23c8826efb
Improve completion for the "/event" command
Mikael Berthe <mikael@lilotux.net>
parents:
735
diff
changeset
|
38 #include "events.h" |
94 | 39 |
40 // Completion structure | |
41 typedef struct { | |
42 GSList *list; // list of matches | |
43 guint len_prefix; // length of text already typed by the user | |
44 guint len_compl; // length of the last completion | |
45 GSList *next; // pointer to next completion to try | |
46 } compl; | |
47 | |
48 // Category structure | |
49 typedef struct { | |
50 guint flag; | |
51 GSList *words; | |
52 } category; | |
53 | |
54 static GSList *Categories; | |
55 static compl *InputCompl; | |
56 | |
1607 | 57 #ifdef MODULES_ENABLE |
58 guint registered_cats = COMPL_CMD|COMPL_JID|COMPL_URLJID|COMPL_NAME| \ | |
59 COMPL_STATUS|COMPL_FILENAME|COMPL_ROSTER|COMPL_BUFFER| \ | |
60 COMPL_GROUP|COMPL_GROUPNAME|COMPL_MULTILINE|COMPL_ROOM| \ | |
61 COMPL_RESOURCE|COMPL_AUTH|COMPL_REQUEST|COMPL_EVENTS| \ | |
62 COMPL_EVENTSID|COMPL_PGP|COMPL_COLOR| \ | |
63 COMPL_OTR|COMPL_OTRPOLICY| \ | |
64 0; | |
65 | |
66 // compl_new_category() | |
67 // Reserves id for new completion category. | |
68 // Returns 0, if no more categories can be allocated. | |
69 // Note, that user should not make any assumptions about id nature, | |
70 // as it is likely to change in future. | |
1828
8f7d7c05f275
Small coding style update
Mikael Berthe <mikael@lilotux.net>
parents:
1811
diff
changeset
|
71 guint compl_new_category(void) |
1607 | 72 { |
73 guint i = 0; | |
74 while ((registered_cats >> i) & 1) | |
75 i++; | |
1828
8f7d7c05f275
Small coding style update
Mikael Berthe <mikael@lilotux.net>
parents:
1811
diff
changeset
|
76 if (i >= 8 * sizeof (guint)) |
1607 | 77 return 0; |
78 else { | |
79 guint id = 1 << i; | |
80 registered_cats |= id; | |
81 return id; | |
82 } | |
83 } | |
84 | |
1828
8f7d7c05f275
Small coding style update
Mikael Berthe <mikael@lilotux.net>
parents:
1811
diff
changeset
|
85 // compl_del_category(id) |
1607 | 86 // Frees reserved id for category. |
87 // Note, that for now it not validates its input, so, be careful | |
88 // and specify exactly what you get from compl_new_category. | |
1828
8f7d7c05f275
Small coding style update
Mikael Berthe <mikael@lilotux.net>
parents:
1811
diff
changeset
|
89 void compl_del_category(guint id) |
1607 | 90 { |
91 registered_cats &= ~id; | |
92 } | |
93 #endif | |
94 | |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
95 // new_completion(prefix, compl_cat, suffix) |
94 | 96 // . prefix = beginning of the word, typed by the user |
97 // . compl_cat = pointer to a completion category list (list of *char) | |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
98 // . suffix = string to append to all completion possibilities (i.e. ":") |
894
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
99 // Set the InputCompl pointer to an allocated compl structure. |
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
100 // done_completion() must be called when finished. |
1228
9a68fe4515dc
Improve MUC nickname completion
Mikael Berthe <mikael@lilotux.net>
parents:
1205
diff
changeset
|
101 // Returns the number of possible completions. |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
102 guint new_completion(const char *prefix, GSList *compl_cat, const gchar *suffix) |
94 | 103 { |
104 compl *c; | |
105 GSList *sl_cat; | |
735 | 106 size_t len = strlen(prefix); |
94 | 107 |
108 if (InputCompl) { // This should not happen, but hey... | |
109 cancel_completion(); | |
110 } | |
111 | |
112 c = g_new0(compl, 1); | |
113 // Build the list of matches | |
1228
9a68fe4515dc
Improve MUC nickname completion
Mikael Berthe <mikael@lilotux.net>
parents:
1205
diff
changeset
|
114 for (sl_cat = compl_cat; sl_cat; sl_cat = g_slist_next(sl_cat)) { |
94 | 115 char *word = sl_cat->data; |
104 | 116 if (!strncasecmp(prefix, word, len)) { |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
117 if (strlen(word) != len) { |
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
118 gchar *compval; |
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
119 if (suffix) |
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
120 compval = g_strdup_printf("%s%s", word+len, suffix); |
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
121 else |
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
122 compval = g_strdup(word+len); |
1852 | 123 c->list = g_slist_insert_sorted(c->list, compval, |
124 (GCompareFunc)g_ascii_strcasecmp); | |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
125 } |
94 | 126 } |
127 } | |
128 c->next = c->list; | |
129 InputCompl = c; | |
1228
9a68fe4515dc
Improve MUC nickname completion
Mikael Berthe <mikael@lilotux.net>
parents:
1205
diff
changeset
|
130 return g_slist_length(c->list); |
94 | 131 } |
132 | |
133 // done_completion(); | |
134 void done_completion(void) | |
135 { | |
894
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
136 GSList *clp; |
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
137 |
98 | 138 if (!InputCompl) return; |
139 | |
894
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
140 // Free the current completion list |
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
141 for (clp = InputCompl->list; clp; clp = g_slist_next(clp)) |
f76b32ff2f14
done_completion(): free all allocated memory
Mikael Berthe <mikael@lilotux.net>
parents:
820
diff
changeset
|
142 g_free(clp->data); |
94 | 143 g_slist_free(InputCompl->list); |
144 g_free(InputCompl); | |
145 InputCompl = NULL; | |
146 } | |
147 | |
148 // cancel_completion() | |
149 // Returns the number of chars to delete to cancel the completion | |
150 guint cancel_completion(void) | |
151 { | |
98 | 152 if (!InputCompl) return 0; |
94 | 153 return InputCompl->len_compl; |
154 } | |
155 | |
156 // Returns pointer to text to insert, NULL if no completion. | |
157 const char *complete() | |
158 { | |
159 compl* c = InputCompl; | |
160 char *r; | |
98 | 161 |
162 if (!InputCompl) return NULL; | |
163 | |
94 | 164 if (!c->next) { |
165 c->next = c->list; // back to the beginning | |
166 c->len_compl = 0; | |
167 return NULL; | |
168 } | |
169 r = (char*)c->next->data; | |
170 c->next = g_slist_next(c->next); | |
1240
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
171 if (!utf8_mode) { |
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
172 c->len_compl = strlen(r); |
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
173 } else { |
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
174 char *wc; |
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
175 c->len_compl = 0; |
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
176 for (wc = r; *wc; wc = next_char(wc)) |
1569
21c553e4bfb9
Fix completion with wide characters (e.g. Japanese characters)
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1414
diff
changeset
|
177 c->len_compl++; |
1240
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
178 } |
94 | 179 return r; |
180 } | |
181 | |
182 | |
183 /* Categories functions */ | |
184 | |
95 | 185 // compl_add_category_word(categ, command) |
186 // Adds a keyword as a possible completion in category categ. | |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
187 void compl_add_category_word(guint categ, const gchar *word) |
94 | 188 { |
189 GSList *sl_cat; | |
190 category *cat; | |
121 | 191 char *nword; |
94 | 192 // Look for category |
193 for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) { | |
194 if (categ == ((category*)sl_cat->data)->flag) | |
195 break; | |
196 } | |
197 if (!sl_cat) { // Category not found, let's create it | |
198 cat = g_new0(category, 1); | |
199 cat->flag = categ; | |
200 Categories = g_slist_append(Categories, cat); | |
201 } else | |
202 cat = (category*)sl_cat->data; | |
203 | |
121 | 204 // If word is not space-terminated, we add one trailing space |
205 for (nword = (char*)word; *nword; nword++) | |
206 ; | |
207 if (nword > word) nword--; | |
208 if (*nword != ' ') { // Add a space | |
1240
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
209 nword = g_strdup_printf("%s ", word); |
121 | 210 } else { // word is fine |
211 nword = g_strdup(word); | |
212 } | |
213 | |
1852 | 214 if (g_slist_find_custom(cat->words, nword, (GCompareFunc)g_strcmp0) != NULL) |
1850
8d7810f529db
Sort items in completion lists
alkino <nicolas.cornu@ensi-bourges.fr>
parents:
1828
diff
changeset
|
215 return; |
8d7810f529db
Sort items in completion lists
alkino <nicolas.cornu@ensi-bourges.fr>
parents:
1828
diff
changeset
|
216 |
1852 | 217 cat->words = g_slist_insert_sorted(cat->words, nword, |
218 (GCompareFunc)g_ascii_strcasecmp); | |
94 | 219 } |
220 | |
284
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
221 // compl_del_category_word(categ, command) |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
222 // Removes a keyword from category categ in completion list. |
1756
e2c084204583
Add (optional) suffix after nick completion in Multi-User Chats
Mikael Berthe <mikael@lilotux.net>
parents:
1729
diff
changeset
|
223 void compl_del_category_word(guint categ, const gchar *word) |
284
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
224 { |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
225 GSList *sl_cat, *sl_elt; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
226 category *cat; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
227 char *nword; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
228 // Look for category |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
229 for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) { |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
230 if (categ == ((category*)sl_cat->data)->flag) |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
231 break; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
232 } |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
233 if (!sl_cat) return; // Category not found, finished! |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
234 |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
235 cat = (category*)sl_cat->data; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
236 |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
237 // If word is not space-terminated, we add one trailing space |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
238 for (nword = (char*)word; *nword; nword++) |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
239 ; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
240 if (nword > word) nword--; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
241 if (*nword != ' ') { // Add a space |
1240
a54645448e00
Fix completion of strings with multibyte chars
Mikael Berthe <mikael@lilotux.net>
parents:
1228
diff
changeset
|
242 nword = g_strdup_printf("%s ", word); |
284
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
243 } else { // word is fine |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
244 nword = g_strdup(word); |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
245 } |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
246 |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
247 sl_elt = cat->words; |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
248 while (sl_elt) { |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
249 if (!strcasecmp((char*)sl_elt->data, nword)) { |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
250 g_free(sl_elt->data); |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
251 cat->words = g_slist_delete_link(cat->words, sl_elt); |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
252 break; // Only remove first occurence |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
253 } |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
254 sl_elt = g_slist_next(sl_elt); |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
255 } |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
256 } |
f879b17ecb8e
Add compl_del_category_word()
Mikael Berthe <mikael@lilotux.net>
parents:
225
diff
changeset
|
257 |
95 | 258 // compl_get_category_list() |
259 // Returns a slist of all words in the categories specified by the given flags | |
1076
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
260 // Iff this function sets *dynlist to TRUE, then the caller must free the |
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
261 // whole list after use. |
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
262 GSList *compl_get_category_list(guint cat_flags, guint *dynlist) |
94 | 263 { |
264 GSList *sl_cat; | |
1076
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
265 |
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
266 *dynlist = FALSE; |
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
267 |
94 | 268 // Look for category |
269 // XXX Actually that's not that simple... cat_flags can be a combination | |
270 // of several flags! | |
271 for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) { | |
272 if (cat_flags == ((category*)sl_cat->data)->flag) | |
273 break; | |
274 } | |
275 if (sl_cat) // Category was found, easy... | |
276 return ((category*)sl_cat->data)->words; | |
277 | |
225 | 278 // Handle dynamic SLists |
1076
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
279 *dynlist = TRUE; |
225 | 280 if (cat_flags == COMPL_GROUPNAME) { |
281 return compl_list(ROSTER_TYPE_GROUP); | |
282 } | |
283 if (cat_flags == COMPL_JID) { | |
284 return compl_list(ROSTER_TYPE_USER); | |
285 } | |
501
7c1ca00070e8
Add COMPL_RESOURCE (resource completion category)
Mikael Berthe <mikael@lilotux.net>
parents:
393
diff
changeset
|
286 if (cat_flags == COMPL_RESOURCE) { |
792
89ad7b530b3c
MUC: Fix completion for UTF-8 nicknames
Mikael Berthe <mikael@lilotux.net>
parents:
757
diff
changeset
|
287 return buddy_getresources_locale(NULL); |
501
7c1ca00070e8
Add COMPL_RESOURCE (resource completion category)
Mikael Berthe <mikael@lilotux.net>
parents:
393
diff
changeset
|
288 } |
757
ae23c8826efb
Improve completion for the "/event" command
Mikael Berthe <mikael@lilotux.net>
parents:
735
diff
changeset
|
289 if (cat_flags == COMPL_EVENTSID) { |
1685
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
290 GSList *compl = evs_geteventslist(); |
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
291 GSList *cel; |
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
292 for (cel = compl; cel; cel = cel->next) |
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
293 cel->data = g_strdup(cel->data); |
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
294 compl = g_slist_append(compl, g_strdup("list")); |
1342df44c814
Improved events interface
Myhailo Danylenko <isbear@ukrpost.net>
parents:
1668
diff
changeset
|
295 return compl; |
757
ae23c8826efb
Improve completion for the "/event" command
Mikael Berthe <mikael@lilotux.net>
parents:
735
diff
changeset
|
296 } |
225 | 297 |
1076
b9698c89f46d
Fix memory leak in scr_handle_tab()
Mikael Berthe <mikael@lilotux.net>
parents:
894
diff
changeset
|
298 *dynlist = FALSE; |
94 | 299 return NULL; |
300 } | |
301 | |
1811 | 302 /* vim: set expandtab cindent cinoptions=>2\:2(0 sw=2 ts=2: For Vim users... */ |