--- a/mcabber/src/commands.c Sat Apr 22 10:50:54 2006 +0200
+++ b/mcabber/src/commands.c Sat Apr 22 22:41:06 2006 +0200
@@ -2086,6 +2086,7 @@
char **paramlst;
char *evid, *subcmd;
int action = -1;
+ GSList *evidlst;
paramlst = split_arg(arg, 2, 0); // id, subcmd
evid = *paramlst;
@@ -2112,14 +2113,28 @@
if (action == -1) {
scr_LogPrint(LPRINT_NORMAL, "Wrong action parameter.");
} else if (action >= 0 && action <= 2) {
+ GSList *p;
+
if (action == 2) {
action = EVS_CONTEXT_CANCEL;
} else {
action += EVS_CONTEXT_USER;
}
- if (evs_callback(evid, action) == -1) {
- scr_LogPrint(LPRINT_NORMAL, "Event %s not found.", evid);
+
+ if (!strcmp(evid, "*")) {
+ // Use completion list
+ evidlst = evs_geteventslist(FALSE);
+ } else {
+ // Let's create a slist with the provided event id
+ evidlst = g_slist_append(NULL, g_strdup(evid));
}
+ for (p = evidlst; p; p = g_slist_next(p)) {
+ if (evs_callback(p->data, action) == -1) {
+ scr_LogPrint(LPRINT_NORMAL, "Event %s not found.", p->data);
+ }
+ g_free(p->data);
+ }
+ g_slist_free(evidlst);
}
free_arg_lst(paramlst);
--- a/mcabber/src/compl.c Sat Apr 22 10:50:54 2006 +0200
+++ b/mcabber/src/compl.c Sat Apr 22 22:41:06 2006 +0200
@@ -222,7 +222,7 @@
return buddy_getresources_locale(NULL);
}
if (cat_flags == COMPL_EVENTSID) {
- return evs_geteventscomplist();
+ return evs_geteventslist(TRUE);
}
return NULL;
--- a/mcabber/src/events.c Sat Apr 22 10:50:54 2006 +0200
+++ b/mcabber/src/events.c Sat Apr 22 22:41:06 2006 +0200
@@ -149,10 +149,11 @@
scr_LogPrint(LPRINT_LOGNORM, "End of events list.");
}
-// evs_geteventscomplist()
+// evs_geteventslist(bool comp)
// Return a singly-linked-list of events ids, for the completion system.
+// If comp is true, the string "list" is added (it's a completion argument).
// Note: the caller should free the list (and data) after use.
-GSList *evs_geteventscomplist(void)
+GSList *evs_geteventslist(int compl)
{
GSList *evidlist = NULL, *p;
eviqs *i;
@@ -162,8 +163,10 @@
evidlist = g_slist_append(evidlist, g_strdup(i->id));
}
- // Last item is the "list" subcommand.
- evidlist = g_slist_append(evidlist, g_strdup("list"));
+ if (compl) {
+ // Last item is the "list" subcommand.
+ evidlist = g_slist_append(evidlist, g_strdup("list"));
+ }
return evidlist;
}
--- a/mcabber/src/events.h Sat Apr 22 10:50:54 2006 +0200
+++ b/mcabber/src/events.h Sat Apr 22 22:41:06 2006 +0200
@@ -32,7 +32,7 @@
int evs_callback(const char *evid, guint evcontext);
void evs_check_timeout(time_t now_t);
void evs_display_list(void);
-GSList *evs_geteventscomplist(void);
+GSList *evs_geteventslist(int forcompl);
#endif /* __EVENTS_H__ */