1
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-01-03 14:57:42 -05:00

Refactored cmd_execute

This commit is contained in:
James Booth 2014-04-09 21:38:42 +01:00
parent c3e3759256
commit 26216f6c17

View File

@ -1251,18 +1251,19 @@ cmd_execute(const char * const command, const char * const inp)
if (cmd != NULL) {
gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
if ((result == FALSE) && (cmd->setting_func != NULL)) {
cons_show("");
(*cmd->setting_func)();
cons_show("Usage: %s", cmd->help.usage);
return TRUE;
} else if (result == FALSE) {
cons_show("");
cons_show("Usage: %s", cmd->help.usage);
if (ui_current_win_type() == WIN_CHAT) {
char usage[strlen(cmd->help.usage) + 8];
sprintf(usage, "Usage: %s", cmd->help.usage);
ui_current_print_line(usage);
if (result == FALSE) {
if (cmd->setting_func != NULL) {
cons_show("");
(*cmd->setting_func)();
cons_show("Usage: %s", cmd->help.usage);
} else {
cons_show("");
cons_show("Usage: %s", cmd->help.usage);
if (ui_current_win_type() == WIN_CHAT) {
char usage[strlen(cmd->help.usage) + 8];
sprintf(usage, "Usage: %s", cmd->help.usage);
ui_current_print_line(usage);
}
}
return TRUE;
} else {