comparison mcabber/src/compl.c @ 95:9e6b7897ec37

[/trunk] Changeset 109 by mikael * Work on compl.* integration. No big change yet...
author mikael
date Wed, 20 Apr 2005 19:06:25 +0000
parents 9a4aa2797f02
children f20831f7d349
comparison
equal deleted inserted replaced
94:9a4aa2797f02 95:9e6b7897ec37
120 } 120 }
121 121
122 122
123 /* Categories functions */ 123 /* Categories functions */
124 124
125 // compl_add_category_command(categ, command) 125 // compl_add_category_word(categ, command)
126 // Adds command as a possible completion in category categ. 126 // Adds a keyword as a possible completion in category categ.
127 void compl_add_category_command(guint categ, char *command) 127 void compl_add_category_word(guint categ, const char *word)
128 { 128 {
129 GSList *sl_cat; 129 GSList *sl_cat;
130 category *cat; 130 category *cat;
131 // Look for category 131 // Look for category
132 for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) { 132 for (sl_cat=Categories; sl_cat; sl_cat = g_slist_next(sl_cat)) {
139 Categories = g_slist_append(Categories, cat); 139 Categories = g_slist_append(Categories, cat);
140 } else 140 } else
141 cat = (category*)sl_cat->data; 141 cat = (category*)sl_cat->data;
142 142
143 // TODO Check word does not already exist 143 // TODO Check word does not already exist
144 cat->words = g_slist_append(cat->words, g_strdup(command)); // TODO sort 144 cat->words = g_slist_append(cat->words, g_strdup(word)); // TODO sort
145 } 145 }
146 146
147 // compl_get_category_list()
148 // Returns a slist of all words in the categories specified by the given flags
147 GSList *compl_get_category_list(guint cat_flags) 149 GSList *compl_get_category_list(guint cat_flags)
148 { 150 {
149 GSList *sl_cat; 151 GSList *sl_cat;
150 // Look for category 152 // Look for category
151 // XXX Actually that's not that simple... cat_flags can be a combination 153 // XXX Actually that's not that simple... cat_flags can be a combination
197 back = cancel_completion(); 199 back = cancel_completion();
198 printf("Back: %d\n", back); 200 printf("Back: %d\n", back);
199 done_completion(); 201 done_completion();
200 } 202 }
201 } 203 }
202
203 int main()
204 {
205 compl_add_category_command(COMPL_CMD, "add");
206 compl_add_category_command(COMPL_CMD, "clear");
207 compl_add_category_command(COMPL_CMD, "del");
208 compl_add_category_command(COMPL_CMD, "group");
209 compl_add_category_command(COMPL_CMD, "info");
210 compl_add_category_command(COMPL_CMD, "move");
211 compl_add_category_command(COMPL_CMD, "rename");
212 compl_add_category_command(COMPL_CMD, "request_auth");
213 compl_add_category_command(COMPL_CMD, "say");
214 compl_add_category_command(COMPL_CMD, "search");
215 compl_add_category_command(COMPL_CMD, "send_auth");
216 compl_add_category_command(COMPL_CMD, "status");
217 compl_add_category_command(COMPL_STATUS, "online");
218 compl_add_category_command(COMPL_STATUS, "avail");
219 compl_add_category_command(COMPL_STATUS, "invisible");
220 compl_add_category_command(COMPL_STATUS, "free");
221 compl_add_category_command(COMPL_STATUS, "dnd");
222 compl_add_category_command(COMPL_STATUS, "busy");
223 compl_add_category_command(COMPL_STATUS, "notavail");
224 compl_add_category_command(COMPL_STATUS, "away");
225
226 //test_dump_categories();
227
228 test_comp(COMPL_STATUS, "d");
229 test_comp(COMPL_CMD, "s");
230
231 return 0;
232 }
233 */ 204 */