comparison mcabber/src/compl.c @ 225:d5ae42cbe1fa

[/trunk] Changeset 237 by mikael * Group names and JIDs completion
author mikael
date Sat, 04 Jun 2005 19:35:30 +0000
parents 94b251102069
children f879b17ecb8e
comparison
equal deleted inserted replaced
224:3795729cee54 225:d5ae42cbe1fa
30 */ 30 */
31 31
32 #include <string.h> 32 #include <string.h>
33 33
34 #include "compl.h" 34 #include "compl.h"
35 #include "roster.h"
35 36
36 // Completion structure 37 // Completion structure
37 typedef struct { 38 typedef struct {
38 GSList *list; // list of matches 39 GSList *list; // list of matches
39 guint len_prefix; // length of text already typed by the user 40 guint len_prefix; // length of text already typed by the user
48 } category; 49 } category;
49 50
50 static GSList *Categories; 51 static GSList *Categories;
51 static compl *InputCompl; 52 static compl *InputCompl;
52 53
53 // XXX Should not be there (?)
54 // jid_list(type)
55 // Returns a list of jid's. If type is COMPL_URLJID, urls are surrounded with
56 // '<' and '>'.
57 GSList *jid_list(guint type) // bool urlstyle?
58 {
59 }
60
61 // new_completion(prefix, compl_cat) 54 // new_completion(prefix, compl_cat)
62 // . prefix = beginning of the word, typed by the user 55 // . prefix = beginning of the word, typed by the user
63 // . compl_cat = pointer to a completion category list (list of *char) 56 // . compl_cat = pointer to a completion category list (list of *char)
64 // Returns a pointer to an allocated compl structure. This structure should 57 // Returns a pointer to an allocated compl structure. This structure should
65 // be freed by the caller when not used anymore. 58 // be freed by the caller when not used anymore.
66 //compl *new_completion(char *prefix, GSList *compl_cat)
67 void new_completion(char *prefix, GSList *compl_cat) 59 void new_completion(char *prefix, GSList *compl_cat)
68 { 60 {
69 compl *c; 61 compl *c;
70 GSList *sl_cat; 62 GSList *sl_cat;
71 int len = strlen(prefix); 63 int len = strlen(prefix);
177 break; 169 break;
178 } 170 }
179 if (sl_cat) // Category was found, easy... 171 if (sl_cat) // Category was found, easy...
180 return ((category*)sl_cat->data)->words; 172 return ((category*)sl_cat->data)->words;
181 173
182 // TODO handle dynamic SLists :) 174 // Handle dynamic SLists
175 if (cat_flags == COMPL_GROUPNAME) {
176 return compl_list(ROSTER_TYPE_GROUP);
177 }
178 if (cat_flags == COMPL_JID) {
179 return compl_list(ROSTER_TYPE_USER);
180 }
181
183 return NULL; 182 return NULL;
184 } 183 }
185 184