comparison mcabber/src/compl.c @ 1607:14690e624e9d

Add modules
author Myhailo Danylenko <isbear@ukrpost.net>
date Sun, 11 Oct 2009 16:01:52 +0200
parents dcd5d4c75199
children
comparison
equal deleted inserted replaced
1606:d7f26538c24c 1607:14690e624e9d
50 GSList *words; 50 GSList *words;
51 } category; 51 } category;
52 52
53 static GSList *Categories; 53 static GSList *Categories;
54 static compl *InputCompl; 54 static compl *InputCompl;
55
56 #ifdef MODULES_ENABLE
57 guint registered_cats = COMPL_CMD|COMPL_JID|COMPL_URLJID|COMPL_NAME| \
58 COMPL_STATUS|COMPL_FILENAME|COMPL_ROSTER|COMPL_BUFFER| \
59 COMPL_GROUP|COMPL_GROUPNAME|COMPL_MULTILINE|COMPL_ROOM| \
60 COMPL_RESOURCE|COMPL_AUTH|COMPL_REQUEST|COMPL_EVENTS| \
61 COMPL_EVENTSID|COMPL_PGP|COMPL_COLOR| \
62 COMPL_OTR|COMPL_OTRPOLICY| \
63 0;
64
65 // compl_new_category()
66 // Reserves id for new completion category.
67 // Returns 0, if no more categories can be allocated.
68 // Note, that user should not make any assumptions about id nature,
69 // as it is likely to change in future.
70 guint compl_new_category (void)
71 {
72 guint i = 0;
73 while ((registered_cats >> i) & 1)
74 i++;
75 if (i >= sizeof (guint)*8)
76 return 0;
77 else {
78 guint id = 1 << i;
79 registered_cats |= id;
80 return id;
81 }
82 }
83
84 // compl_del_category (id)
85 // Frees reserved id for category.
86 // Note, that for now it not validates its input, so, be careful
87 // and specify exactly what you get from compl_new_category.
88 void compl_del_category (guint id)
89 {
90 registered_cats &= ~id;
91 }
92 #endif
55 93
56 // new_completion(prefix, compl_cat) 94 // new_completion(prefix, compl_cat)
57 // . prefix = beginning of the word, typed by the user 95 // . prefix = beginning of the word, typed by the user
58 // . compl_cat = pointer to a completion category list (list of *char) 96 // . compl_cat = pointer to a completion category list (list of *char)
59 // Set the InputCompl pointer to an allocated compl structure. 97 // Set the InputCompl pointer to an allocated compl structure.