Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/commands.c @ 1737:764ed5c12589
Move -f flag of /module command after a subcommand
author | Myhailo Danylenko <isbear@ukrpost.net> |
---|---|
date | Sat, 06 Mar 2010 21:04:31 +0200 |
parents | 5093b5ca1572 |
children | 391863b7952c |
comparison
equal
deleted
inserted
replaced
1736:15e1f3957786 | 1737:764ed5c12589 |
---|---|
2957 static void do_module(char *arg) | 2957 static void do_module(char *arg) |
2958 { | 2958 { |
2959 gboolean force = FALSE; | 2959 gboolean force = FALSE; |
2960 char **args; | 2960 char **args; |
2961 | 2961 |
2962 if (arg[0] == '-' && arg[1] == 'f') { | |
2963 force = TRUE; | |
2964 arg +=2; | |
2965 while (*arg && *arg == ' ') | |
2966 ++arg; | |
2967 } | |
2968 | |
2969 args = split_arg(arg, 2, 0); | 2962 args = split_arg(arg, 2, 0); |
2970 if (!args[0] || !strcmp(args[0], "list")) { | 2963 if (!args[0] || !strcmp(args[0], "list")) { |
2971 module_list_print(); | 2964 module_list_print(); |
2972 } else { | 2965 } else { |
2973 const gchar *error; | 2966 const gchar *error; |
2967 const gchar *name = args[1]; | |
2968 | |
2969 if (name && name[0] == '-' && name[1] == 'f') { | |
2970 force = TRUE; | |
2971 name +=2; | |
2972 while (*name && *name == ' ') | |
2973 ++name; | |
2974 } | |
2975 | |
2974 if (!strcmp(args[0], "load")) | 2976 if (!strcmp(args[0], "load")) |
2975 error = module_load(args[1], TRUE, force); | 2977 error = module_load(name, TRUE, force); |
2976 else if (!strcmp(args[0], "unload")) | 2978 else if (!strcmp(args[0], "unload")) |
2977 error = module_unload(args[1], TRUE, force); | 2979 error = module_unload(name, TRUE, force); |
2978 else | 2980 else |
2979 error = "Unknown subcommand"; | 2981 error = "Unknown subcommand"; |
2980 if (error) | 2982 if (error) |
2981 scr_LogPrint(LPRINT_LOGNORM, "Error: %s.", error); | 2983 scr_LogPrint(LPRINT_LOGNORM, "Error: %s.", error); |
2982 } | 2984 } |