comparison mcabber/src/commands.c @ 755:b747f76e57ae

Add "/event n ignore"
author Mikael Berthe <mikael@lilotux.net>
date Tue, 14 Mar 2006 12:08:57 +0100
parents 938a8791658c
children ae23c8826efb
comparison
equal deleted inserted replaced
754:5b962b978573 755:b747f76e57ae
194 compl_add_category_word(COMPL_REQUEST, "time"); 194 compl_add_category_word(COMPL_REQUEST, "time");
195 compl_add_category_word(COMPL_REQUEST, "version"); 195 compl_add_category_word(COMPL_REQUEST, "version");
196 196
197 // Events category 197 // Events category
198 compl_add_category_word(COMPL_EVENTS, "accept"); 198 compl_add_category_word(COMPL_EVENTS, "accept");
199 compl_add_category_word(COMPL_EVENTS, "ignore");
199 compl_add_category_word(COMPL_EVENTS, "reject"); 200 compl_add_category_word(COMPL_EVENTS, "reject");
200 } 201 }
201 202
202 // expandalias(line) 203 // expandalias(line)
203 // If there is one, expand the alias in line and returns a new allocated line 204 // If there is one, expand the alias in line and returns a new allocated line
1972 1973
1973 if (!strcasecmp(subcmd, "reject")) 1974 if (!strcasecmp(subcmd, "reject"))
1974 action = 0; 1975 action = 0;
1975 else if (!strcasecmp(subcmd, "accept")) 1976 else if (!strcasecmp(subcmd, "accept"))
1976 action = 1; 1977 action = 1;
1978 else if (!strcasecmp(subcmd, "ignore"))
1979 action = 2;
1977 1980
1978 if (action == -1) { 1981 if (action == -1) {
1979 scr_LogPrint(LPRINT_NORMAL, "Wrong action parameter."); 1982 scr_LogPrint(LPRINT_NORMAL, "Wrong action parameter.");
1980 } else if (action == 0 || action == 1) { 1983 } else if (action >= 0 && action <= 2) {
1981 if (evs_callback(evid, EVS_CONTEXT_USER + action) == -1) { 1984 if (action == 2) {
1985 action = EVS_CONTEXT_CANCEL;
1986 } else {
1987 action += EVS_CONTEXT_USER;
1988 }
1989 if (evs_callback(evid, action) == -1) {
1982 scr_LogPrint(LPRINT_NORMAL, "Event %s not found.", evid); 1990 scr_LogPrint(LPRINT_NORMAL, "Event %s not found.", evid);
1983 } 1991 }
1984 } 1992 }
1985 1993
1986 free_arg_lst(paramlst); 1994 free_arg_lst(paramlst);