diff mcabber/src/compl.c @ 1228:9a68fe4515dc

Improve MUC nickname completion
author Mikael Berthe <mikael@lilotux.net>
date Sun, 20 May 2007 22:01:20 +0200
parents 2de8f8ba1f34
children a54645448e00
line wrap: on
line diff
--- a/mcabber/src/compl.c	Sat May 19 12:18:25 2007 +0200
+++ b/mcabber/src/compl.c	Sun May 20 22:01:20 2007 +0200
@@ -57,7 +57,8 @@
 // . compl_cat = pointer to a completion category list (list of *char)
 // Set the InputCompl pointer to an allocated compl structure.
 // done_completion() must be called when finished.
-void new_completion(char *prefix, GSList *compl_cat)
+// Returns the number of possible completions.
+guint new_completion(char *prefix, GSList *compl_cat)
 {
   compl *c;
   GSList *sl_cat;
@@ -69,7 +70,7 @@
 
   c = g_new0(compl, 1);
   // Build the list of matches
-  for (sl_cat=compl_cat; sl_cat; sl_cat = g_slist_next(sl_cat)) {
+  for (sl_cat = compl_cat; sl_cat; sl_cat = g_slist_next(sl_cat)) {
     char *word = sl_cat->data;
     if (!strncasecmp(prefix, word, len)) {
       if (strlen(word) != len)
@@ -78,6 +79,7 @@
   }
   c->next = c->list;
   InputCompl = c;
+  return g_slist_length(c->list);
 }
 
 //  done_completion();