diff --git a/src/command/command.c b/src/command/command.c
index 72b4a07a..e5cda05c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -116,7 +116,7 @@ static struct cmd_t command_defs[] =
// NEW STYLE
{ "/help",
cmd_help, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/help [|]",
NULL
@@ -135,7 +135,7 @@ static struct cmd_t command_defs[] =
{ "/about",
cmd_about, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/about",
NULL
@@ -149,7 +149,7 @@ static struct cmd_t command_defs[] =
{ "/connect",
cmd_connect, parse_args, 0, 5, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/connect []",
"/connect [server ] [port ]",
@@ -174,7 +174,7 @@ static struct cmd_t command_defs[] =
{ "/disconnect",
cmd_disconnect, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/disconnect",
NULL
@@ -188,7 +188,7 @@ static struct cmd_t command_defs[] =
{ "/msg",
cmd_msg, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/msg []",
"/msg []",
@@ -213,7 +213,7 @@ static struct cmd_t command_defs[] =
{ "/roster",
cmd_roster, parse_args_with_freetext, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/roster",
"/roster online",
@@ -264,7 +264,7 @@ static struct cmd_t command_defs[] =
{ "/group",
cmd_group, parse_args_with_freetext, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/group",
"/group show ",
@@ -289,7 +289,7 @@ static struct cmd_t command_defs[] =
{ "/info",
cmd_info, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/info",
"/info |",
@@ -310,7 +310,7 @@ static struct cmd_t command_defs[] =
{ "/caps",
cmd_caps, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/caps",
"/caps |",
@@ -331,7 +331,7 @@ static struct cmd_t command_defs[] =
{ "/software",
cmd_software, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/software",
"/software |",
@@ -353,7 +353,7 @@ static struct cmd_t command_defs[] =
{ "/status",
cmd_status, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/status",
"/status |",
@@ -373,7 +373,7 @@ static struct cmd_t command_defs[] =
{ "/resource",
cmd_resource, parse_args, 1, 2, &cons_resource_setting,
- { NULL, NULL, { NULL },
+ {
{
"/resource set ",
"/resource off",
@@ -394,7 +394,7 @@ static struct cmd_t command_defs[] =
{ "/join",
cmd_join, parse_args, 0, 5, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/join",
"/join [nick ] [password ]",
@@ -421,7 +421,7 @@ static struct cmd_t command_defs[] =
{ "/leave",
cmd_leave, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/leave",
NULL
@@ -435,7 +435,7 @@ static struct cmd_t command_defs[] =
{ "/invite",
cmd_invite, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/invite []",
NULL
@@ -451,7 +451,7 @@ static struct cmd_t command_defs[] =
{ "/invites",
cmd_invites, parse_args_with_freetext, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/invites",
NULL
@@ -465,7 +465,7 @@ static struct cmd_t command_defs[] =
{ "/decline",
cmd_decline, parse_args_with_freetext, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/decline ",
NULL
@@ -480,7 +480,7 @@ static struct cmd_t command_defs[] =
{ "/room",
cmd_room, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/room accept|destroy|config",
NULL
@@ -497,7 +497,7 @@ static struct cmd_t command_defs[] =
{ "/kick",
cmd_kick, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/kick []",
NULL
@@ -513,7 +513,7 @@ static struct cmd_t command_defs[] =
{ "/ban",
cmd_ban, parse_args_with_freetext, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/ban []",
NULL
@@ -529,7 +529,7 @@ static struct cmd_t command_defs[] =
{ "/subject",
cmd_subject, parse_args_with_freetext, 0, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/subject set ",
"/subject clear",
@@ -546,7 +546,7 @@ static struct cmd_t command_defs[] =
{ "/affiliation",
cmd_affiliation, parse_args_with_freetext, 1, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/affiliation set []",
"/list []",
@@ -564,7 +564,7 @@ static struct cmd_t command_defs[] =
{ "/role",
cmd_role, parse_args_with_freetext, 1, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/role set []",
"/list []",
@@ -582,7 +582,7 @@ static struct cmd_t command_defs[] =
{ "/occupants",
cmd_occupants, parse_args, 1, 3, cons_occupants_setting,
- { NULL, NULL, { NULL },
+ {
{
"/occupants show|hide [jid]",
"/occupants default show|hide [jid]",
@@ -605,7 +605,7 @@ static struct cmd_t command_defs[] =
{ "/form",
cmd_form, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/form show",
"/form submit",
@@ -626,7 +626,7 @@ static struct cmd_t command_defs[] =
{ "/rooms",
cmd_rooms, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/rooms []",
NULL
@@ -643,7 +643,7 @@ static struct cmd_t command_defs[] =
{ "/bookmark",
cmd_bookmark, parse_args, 0, 8, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/bookmark",
"/bookmark list",
@@ -671,7 +671,7 @@ static struct cmd_t command_defs[] =
{ "/disco",
cmd_disco, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/disco info []",
"/disco items []",
@@ -693,7 +693,7 @@ static struct cmd_t command_defs[] =
{ "/nick",
cmd_nick, parse_args_with_freetext, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/nick ",
NULL
@@ -708,7 +708,7 @@ static struct cmd_t command_defs[] =
{ "/win",
cmd_win, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/win ",
NULL
@@ -723,7 +723,7 @@ static struct cmd_t command_defs[] =
{ "/wins",
cmd_wins, parse_args, 0, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/wins tidy",
"/wins prune",
@@ -743,7 +743,7 @@ static struct cmd_t command_defs[] =
{ "/sub",
cmd_sub, parse_args, 1, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/sub request []",
"/sub allow []",
@@ -773,7 +773,7 @@ static struct cmd_t command_defs[] =
{ "/tiny",
cmd_tiny, parse_args, 1, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/tiny ",
NULL
@@ -789,7 +789,7 @@ static struct cmd_t command_defs[] =
{ "/who",
cmd_who, parse_args, 0, 2, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/who",
"/who online|offline|away|dnd|xa|chat|available|unavailable|any []",
@@ -820,7 +820,7 @@ static struct cmd_t command_defs[] =
{ "/close",
cmd_close, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/close []",
"/close all|read",
@@ -839,7 +839,7 @@ static struct cmd_t command_defs[] =
{ "/clear",
cmd_clear, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/clear",
NULL
@@ -853,7 +853,7 @@ static struct cmd_t command_defs[] =
{ "/quit",
cmd_quit, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/quit",
NULL
@@ -867,7 +867,7 @@ static struct cmd_t command_defs[] =
{ "/privileges",
cmd_privileges, parse_args, 1, 1, &cons_privileges_setting,
- { NULL, NULL, { NULL },
+ {
{
"/privileges on|off",
NULL
@@ -882,7 +882,7 @@ static struct cmd_t command_defs[] =
{ "/beep",
cmd_beep, parse_args, 1, 1, &cons_beep_setting,
- { NULL, NULL, { NULL },
+ {
{
"/beep on|off",
NULL
@@ -899,7 +899,7 @@ static struct cmd_t command_defs[] =
{ "/encwarn",
cmd_encwarn, parse_args, 1, 1, &cons_encwarn_setting,
- { NULL, NULL, { NULL },
+ {
{
"/encwarn on|off",
NULL
@@ -914,7 +914,7 @@ static struct cmd_t command_defs[] =
{ "/presence",
cmd_presence, parse_args, 1, 1, &cons_presence_setting,
- { NULL, NULL, { NULL },
+ {
{
"/presence on|off",
NULL
@@ -929,7 +929,7 @@ static struct cmd_t command_defs[] =
{ "/wrap",
cmd_wrap, parse_args, 1, 1, &cons_wrap_setting,
- { NULL, NULL, { NULL },
+ {
{
"/wrap on|off",
NULL
@@ -944,7 +944,7 @@ static struct cmd_t command_defs[] =
{ "/winstidy",
cmd_winstidy, parse_args, 1, 1, &cons_winstidy_setting,
- { NULL, NULL, { NULL },
+ {
{
"/winstidy on|off",
NULL
@@ -959,7 +959,7 @@ static struct cmd_t command_defs[] =
{ "/time",
cmd_time, parse_args, 1, 3, &cons_time_setting,
- { NULL, NULL, { NULL },
+ {
{
"/time main set ",
"/time main off",
@@ -987,7 +987,7 @@ static struct cmd_t command_defs[] =
{ "/inpblock",
cmd_inpblock, parse_args, 2, 2, &cons_inpblock_setting,
- { NULL, NULL, { NULL },
+ {
{
"/inpblock timeout ",
"/inpblock dynamic on|off",
@@ -1004,7 +1004,7 @@ static struct cmd_t command_defs[] =
{ "/notify",
cmd_notify, parse_args, 2, 3, &cons_notify_setting,
- { NULL, NULL, { NULL },
+ {
{
"/notify message on|off",
"/notify message current on|off",
@@ -1047,7 +1047,7 @@ static struct cmd_t command_defs[] =
{ "/flash",
cmd_flash, parse_args, 1, 1, &cons_flash_setting,
- { NULL, NULL, { NULL },
+ {
{
"/flash on|off",
NULL
@@ -1063,7 +1063,7 @@ static struct cmd_t command_defs[] =
{ "/intype",
cmd_intype, parse_args, 1, 1, &cons_intype_setting,
- { NULL, NULL, { NULL },
+ {
{
"/intype on|off",
NULL
@@ -1079,7 +1079,7 @@ static struct cmd_t command_defs[] =
{ "/splash",
cmd_splash, parse_args, 1, 1, &cons_splash_setting,
- { NULL, NULL, { NULL },
+ {
{
"/splash on|off",
NULL
@@ -1094,7 +1094,7 @@ static struct cmd_t command_defs[] =
{ "/autoconnect",
cmd_autoconnect, parse_args, 1, 2, &cons_autoconnect_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoconnect set ",
"/autoconnect off",
@@ -1114,7 +1114,7 @@ static struct cmd_t command_defs[] =
{ "/vercheck",
cmd_vercheck, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/vercheck on|off",
NULL
@@ -1129,7 +1129,7 @@ static struct cmd_t command_defs[] =
{ "/titlebar",
cmd_titlebar, parse_args, 2, 2, &cons_titlebar_setting,
- { NULL, NULL, { NULL },
+ {
{
"/titlebar show on|off",
"/titlebar goodbye on|off",
@@ -1146,7 +1146,7 @@ static struct cmd_t command_defs[] =
{ "/alias",
cmd_alias, parse_args_with_freetext, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/alias list",
"/alias add ",
@@ -1170,7 +1170,7 @@ static struct cmd_t command_defs[] =
{ "/chlog",
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
- { NULL, NULL, { NULL },
+ {
{
"/chlog on|off",
NULL
@@ -1188,7 +1188,7 @@ static struct cmd_t command_defs[] =
{ "/grlog",
cmd_grlog, parse_args, 1, 1, &cons_grlog_setting,
- { NULL, NULL, { NULL },
+ {
{
"/grlog on|off",
NULL
@@ -1204,7 +1204,7 @@ static struct cmd_t command_defs[] =
{ "/states",
cmd_states, parse_args, 1, 1, &cons_states_setting,
- { NULL, NULL, { NULL },
+ {
{
"/states on|off",
NULL
@@ -1219,7 +1219,7 @@ static struct cmd_t command_defs[] =
{ "/pgp",
cmd_pgp, parse_args, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/pgp libver",
"/pgp keys",
@@ -1252,7 +1252,7 @@ static struct cmd_t command_defs[] =
{ "/otr",
cmd_otr, parse_args, 1, 3, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/otr libver",
"/otr gen",
@@ -1299,7 +1299,7 @@ static struct cmd_t command_defs[] =
{ "/outtype",
cmd_outtype, parse_args, 1, 1, &cons_outtype_setting,
- { NULL, NULL, { NULL },
+ {
{
"/outtype on|off",
NULL
@@ -1314,7 +1314,7 @@ static struct cmd_t command_defs[] =
{ "/gone",
cmd_gone, parse_args, 1, 1, &cons_gone_setting,
- { NULL, NULL, { NULL },
+ {
{
"/gone ",
NULL
@@ -1330,7 +1330,7 @@ static struct cmd_t command_defs[] =
{ "/history",
cmd_history, parse_args, 1, 1, &cons_history_setting,
- { NULL, NULL, { NULL },
+ {
{
"/history on|off",
NULL
@@ -1346,7 +1346,7 @@ static struct cmd_t command_defs[] =
{ "/log",
cmd_log, parse_args, 1, 2, &cons_log_setting,
- { NULL, NULL, { NULL },
+ {
{
"/log where",
"/log rotate on|off",
@@ -1367,7 +1367,7 @@ static struct cmd_t command_defs[] =
{ "/carbons",
cmd_carbons, parse_args, 1, 1, &cons_carbons_setting,
- { NULL, NULL, { NULL },
+ {
{
"/carbons on|off",
NULL
@@ -1383,7 +1383,7 @@ static struct cmd_t command_defs[] =
{ "/receipts",
cmd_receipts, parse_args, 2, 2, &cons_receipts_setting,
- { NULL, NULL, { NULL },
+ {
{
"/receipts request on|off",
"/receipts send on|off",
@@ -1400,7 +1400,7 @@ static struct cmd_t command_defs[] =
{ "/reconnect",
cmd_reconnect, parse_args, 1, 1, &cons_reconnect_setting,
- { NULL, NULL, { NULL },
+ {
{
"/reconnect ",
NULL
@@ -1415,7 +1415,7 @@ static struct cmd_t command_defs[] =
{ "/autoping",
cmd_autoping, parse_args, 1, 1, &cons_autoping_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoping ",
NULL
@@ -1430,7 +1430,7 @@ static struct cmd_t command_defs[] =
{ "/ping",
cmd_ping, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/ping []",
NULL
@@ -1446,7 +1446,7 @@ static struct cmd_t command_defs[] =
{ "/autoaway",
cmd_autoaway, parse_args_with_freetext, 2, 2, &cons_autoaway_setting,
- { NULL, NULL, { NULL },
+ {
{
"/autoaway mode idle|away|off",
"/autoaway time ",
@@ -1474,7 +1474,7 @@ static struct cmd_t command_defs[] =
{ "/priority",
cmd_priority, parse_args, 1, 1, &cons_priority_setting,
- { NULL, NULL, { NULL },
+ {
{
"/priority ",
NULL
@@ -1490,7 +1490,7 @@ static struct cmd_t command_defs[] =
{ "/account",
cmd_account, parse_args, 0, 4, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/account",
"/account list",
@@ -1567,7 +1567,7 @@ static struct cmd_t command_defs[] =
{ "/prefs",
cmd_prefs, parse_args, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/prefs [ui|desktop|chat|log|conn|presence]",
NULL
@@ -1588,7 +1588,7 @@ static struct cmd_t command_defs[] =
{ "/theme",
cmd_theme, parse_args, 1, 2, &cons_theme_setting,
- { NULL, NULL, { NULL },
+ {
{
"/theme list",
"/theme load ",
@@ -1609,7 +1609,7 @@ static struct cmd_t command_defs[] =
{ "/statuses",
cmd_statuses, parse_args, 2, 2, &cons_statuses_setting,
- { NULL, NULL, { NULL },
+ {
{
"/statuses console|chat|muc all|online|none",
NULL
@@ -1633,7 +1633,7 @@ static struct cmd_t command_defs[] =
{ "/xmlconsole",
cmd_xmlconsole, parse_args, 0, 0, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/xmlconsole",
NULL
@@ -1647,7 +1647,7 @@ static struct cmd_t command_defs[] =
{ "/away",
cmd_away, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/away []",
NULL
@@ -1664,7 +1664,7 @@ static struct cmd_t command_defs[] =
{ "/chat",
cmd_chat, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/chat []",
NULL
@@ -1681,7 +1681,7 @@ static struct cmd_t command_defs[] =
{ "/dnd",
cmd_dnd, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/dnd []",
NULL
@@ -1698,7 +1698,7 @@ static struct cmd_t command_defs[] =
{ "/online",
cmd_online, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/online []",
NULL
@@ -1715,7 +1715,7 @@ static struct cmd_t command_defs[] =
{ "/xa",
cmd_xa, parse_args_with_freetext, 0, 1, NULL,
- { NULL, NULL, { NULL },
+ {
{
"/xa []",
NULL
@@ -2502,10 +2502,10 @@ _cmd_execute(ProfWin *window, const char * const command, const char * const inp
if (cmd) {
gchar **args = cmd->parser(inp, cmd->min_args, cmd->max_args, &result);
if (result == FALSE) {
- ui_invalid_command_usage(cmd->help.usage, cmd->setting_func);
+ ui_invalid_command_usage(cmd->cmd, cmd->setting_func);
return TRUE;
} else {
- gboolean result = cmd->func(window, args, cmd->help);
+ gboolean result = cmd->func(window, args, command);
g_strfreev(args);
return result;
}
diff --git a/src/command/commands.c b/src/command/commands.c
index f8979aec..6f12f502 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -73,11 +73,11 @@
static void _update_presence(const resource_presence_t presence,
const char * const show, gchar **args);
-static gboolean _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
+static gboolean _cmd_set_boolean_preference(gchar *arg, const char * const command,
const char * const display, preference_t pref);
static void _cmd_show_filtered_help(char *heading, gchar *cmd_filter[], int filter_size);
-static void _who_room(ProfWin *window, gchar **args, struct cmd_help_t help);
-static void _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help);
+static void _who_room(ProfWin *window, gchar **args, const char * const command);
+static void _who_roster(ProfWin *window, gchar **args, const char * const command);
extern GHashTable *commands;
@@ -157,7 +157,7 @@ cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran)
}
gboolean
-cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_connect(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if ((conn_status != JABBER_DISCONNECTED) && (conn_status != JABBER_STARTED)) {
@@ -170,7 +170,7 @@ cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[args[0] ? 1 : 0], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -261,26 +261,26 @@ cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_account(ProfWin *window, gchar **args, const char * const command)
{
- char *command = args[0];
+ char *subcmd = args[0];
- if (command == NULL) {
+ if (subcmd == NULL) {
if (jabber_get_connection_status() != JABBER_CONNECTED) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
ProfAccount *account = accounts_get_account(jabber_get_account_name());
cons_show_account(account);
account_free(account);
}
- } else if (strcmp(command, "list") == 0) {
+ } else if (strcmp(subcmd, "list") == 0) {
gchar **accounts = accounts_get_list();
cons_show_account_list(accounts);
g_strfreev(accounts);
- } else if (strcmp(command, "show") == 0) {
+ } else if (strcmp(subcmd, "show") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
ProfAccount *account = accounts_get_account(account_name);
if (account == NULL) {
@@ -291,19 +291,19 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
account_free(account);
}
}
- } else if (strcmp(command, "add") == 0) {
+ } else if (strcmp(subcmd, "add") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
accounts_add(account_name, NULL, 0);
cons_show("Account created.");
cons_show("");
}
- } else if (strcmp(command, "remove") == 0) {
+ } else if (strcmp(subcmd, "remove") == 0) {
char *account_name = args[1];
if(!account_name) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
if(accounts_remove(account_name)){
@@ -319,10 +319,10 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
g_free(def);
}
- } else if (strcmp(command, "enable") == 0) {
+ } else if (strcmp(subcmd, "enable") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
if (accounts_enable(account_name)) {
cons_show("Account enabled.");
@@ -332,10 +332,10 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "disable") == 0) {
+ } else if (strcmp(subcmd, "disable") == 0) {
char *account_name = args[1];
if (account_name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
if (accounts_disable(account_name)) {
cons_show("Account disabled.");
@@ -345,9 +345,9 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "rename") == 0) {
+ } else if (strcmp(subcmd, "rename") == 0) {
if (g_strv_length(args) != 3) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *new_name = args[2];
@@ -360,7 +360,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("");
}
}
- } else if (strcmp(command, "default") == 0) {
+ } else if (strcmp(subcmd, "default") == 0) {
if(g_strv_length(args) == 1){
char *def = prefs_get_string(PREF_DEFAULT_ACCOUNT);
@@ -375,7 +375,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_set_string(PREF_DEFAULT_ACCOUNT, NULL);
cons_show("Removed default account.");
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
} else if(g_strv_length(args) == 3) {
if(strcmp(args[1], "set") == 0){
@@ -386,14 +386,14 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Account %s does not exist.", args[2]);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
- } else if (strcmp(command, "set") == 0) {
+ } else if (strcmp(subcmd, "set") == 0) {
if (g_strv_length(args) != 4) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *property = args[2];
@@ -536,9 +536,9 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
}
- } else if (strcmp(command, "clear") == 0) {
+ } else if (strcmp(subcmd, "clear") == 0) {
if (g_strv_length(args) != 3) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *account_name = args[1];
char *property = args[2];
@@ -578,6 +578,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
} else {
+ cons_bad_cmd_usage(command);
cons_show("");
}
@@ -585,7 +586,7 @@ cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_sub(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -599,7 +600,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
jid = args[1];
if (subcmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -666,7 +667,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
jid_destroy(jidp);
@@ -675,7 +676,7 @@ cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_disconnect(ProfWin *window, gchar **args, const char * const command)
{
if (jabber_get_connection_status() == JABBER_CONNECTED) {
char *jid = strdup(jabber_get_fulljid());
@@ -697,7 +698,7 @@ cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_quit(ProfWin *window, gchar **args, const char * const command)
{
log_info("Profanity is shutting down...");
exit(0);
@@ -705,7 +706,7 @@ cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_wins(ProfWin *window, gchar **args, const char * const command)
{
if (args[0] == NULL) {
cons_show_wins();
@@ -719,7 +720,7 @@ cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_prune_wins();
} else if (strcmp(args[0], "swap") == 0) {
if ((args[1] == NULL) || (args[2] == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
int source_win = atoi(args[1]);
int target_win = atoi(args[2]);
@@ -744,9 +745,9 @@ cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_winstidy(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Wins Auto Tidy", PREF_WINS_AUTO_TIDY);
if (result && g_strcmp0(args[0], "on") == 0) {
ui_tidy_wins();
@@ -756,7 +757,7 @@ cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_win(ProfWin *window, gchar **args, const char * const command)
{
int num = atoi(args[0]);
@@ -771,7 +772,7 @@ cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_help(ProfWin *window, gchar **args, const char * const command)
{
int num_args = g_strv_length(args);
if (num_args == 0) {
@@ -874,17 +875,7 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
Command *command = g_hash_table_lookup(commands, cmd_with_slash);
if (command) {
- // old
- if (command->help.usage) {
- const gchar **help_text = command->help.long_help;
- ProfWin *console = wins_get_console();
- cons_show("");
- ui_show_lines(console, help_text);
-
- // new
- } else {
- cons_show_help(command);
- }
+ cons_show_help(command);
} else {
cons_show("No such command.");
}
@@ -895,14 +886,14 @@ cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_about(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_about(ProfWin *window, gchar **args, const char * const command)
{
ui_about();
return TRUE;
}
gboolean
-cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_prefs(ProfWin *window, gchar **args, const char * const command)
{
if (args[0] == NULL) {
cons_prefs();
@@ -940,14 +931,14 @@ cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show_pgp_prefs();
cons_show("");
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_theme(ProfWin *window, gchar **args, const char * const command)
{
// list themes
if (g_strcmp0(args[0], "list") == 0) {
@@ -958,7 +949,7 @@ cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
// load a theme
} else if (g_strcmp0(args[0], "load") == 0) {
if (args[1] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else if (theme_load(args[1])) {
ui_load_colours();
prefs_set_string(PREF_THEME, args[1]);
@@ -982,14 +973,14 @@ cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (g_strcmp0(args[0], "colours") == 0) {
cons_theme_colours();
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
static void
-_who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
+_who_room(ProfWin *window, gchar **args, const char * const command)
{
if ((g_strv_length(args) == 2) && args[1]) {
cons_show("Argument group is not applicable to chat rooms.");
@@ -1013,7 +1004,7 @@ _who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(args[0], "admin") != 0) &&
(g_strcmp0(args[0], "member") != 0) &&
(g_strcmp0(args[0], "outcast") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return;
}
@@ -1119,7 +1110,7 @@ _who_room(ProfWin *window, gchar **args, struct cmd_help_t help)
}
static void
-_who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
+_who_roster(ProfWin *window, gchar **args, const char * const command)
{
char *presence = args[0];
@@ -1134,7 +1125,7 @@ _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
&& (strcmp(presence, "xa") != 0)
&& (strcmp(presence, "dnd") != 0)
&& (strcmp(presence, "any") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return;
}
@@ -1332,16 +1323,16 @@ _who_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_who(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
cons_show("You are not currently connected.");
} else if (window->type == WIN_MUC) {
- _who_room(window, args, help);
+ _who_room(window, args, command);
} else {
- _who_roster(window, args, help);
+ _who_roster(window, args, command);
}
if (window->type != WIN_CONSOLE && window->type != WIN_MUC) {
@@ -1352,7 +1343,7 @@ cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_msg(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
char *msg = args[1];
@@ -1419,7 +1410,7 @@ cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_group(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1450,7 +1441,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
if (strcmp(args[0], "show") == 0) {
char *group = args[1];
if (group == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1465,7 +1456,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
char *contact = args[2];
if ((group == NULL) || (contact == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1496,7 +1487,7 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
char *contact = args[2];
if ((group == NULL) || (contact == NULL)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1521,12 +1512,12 @@ cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_roster(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -1557,7 +1548,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
// set roster size
} else if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
int intval = 0;
@@ -1607,7 +1598,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else if (g_strcmp0(args[0], "hide") == 0) {
@@ -1640,7 +1631,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
// roster grouping
@@ -1667,7 +1658,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
// add contact
@@ -1678,7 +1669,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
char *name = args[2];
roster_send_add_new(jid, name);
@@ -1693,7 +1684,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
} else {
roster_send_remove(jid);
}
@@ -1701,7 +1692,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (strcmp(args[0], "remove_all") == 0) {
if (g_strcmp0(args[1], "contacts") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (conn_status != JABBER_CONNECTED) {
@@ -1728,13 +1719,13 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *name = args[2];
if (name == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1762,7 +1753,7 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
}
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1782,31 +1773,31 @@ cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_resource(ProfWin *window, gchar **args, const char * const command)
{
char *cmd = args[0];
char *setting = NULL;
if (g_strcmp0(cmd, "message") == 0) {
setting = args[1];
if (!setting) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
- return _cmd_set_boolean_preference(setting, help, "Message resource", PREF_RESOURCE_MESSAGE);
+ return _cmd_set_boolean_preference(setting, command, "Message resource", PREF_RESOURCE_MESSAGE);
}
} else if (g_strcmp0(cmd, "title") == 0) {
setting = args[1];
if (!setting) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
- return _cmd_set_boolean_preference(setting, help, "Title resource", PREF_RESOURCE_TITLE);
+ return _cmd_set_boolean_preference(setting, command, "Title resource", PREF_RESOURCE_TITLE);
}
}
@@ -1819,7 +1810,7 @@ cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
char *resource = args[1];
if (!resource) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -1854,13 +1845,13 @@ cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help)
chat_session_remove(chatwin->barejid);
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_status(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
@@ -1925,7 +1916,7 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
}
cons_show_status(usr_jid);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
break;
default:
@@ -1936,7 +1927,7 @@ cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_info(ProfWin *window, gchar **args, const char * const command)
{
char *usr = args[0];
@@ -2011,7 +2002,7 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("No such contact \"%s\" in roster.", usr);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
break;
default:
@@ -2022,7 +2013,7 @@ cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_caps(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
PContact pcontact = NULL;
@@ -2099,7 +2090,7 @@ cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help)
gboolean
-cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_software(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
Occupant *occupant = NULL;
@@ -2163,7 +2154,7 @@ cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_join(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
if (conn_status != JABBER_CONNECTED) {
@@ -2225,7 +2216,7 @@ cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[1], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
jid_destroy(room_arg);
return TRUE;
@@ -2261,7 +2252,7 @@ cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_invite(ProfWin *window, gchar **args, const char * const command)
{
char *contact = args[0];
char *reason = args[1];
@@ -2297,7 +2288,7 @@ cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_invites(ProfWin *window, gchar **args, const char * const command)
{
GSList *invites = muc_invites();
cons_show_room_invites(invites);
@@ -2306,7 +2297,7 @@ cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_decline(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_decline(ProfWin *window, gchar **args, const char * const command)
{
if (!muc_invites_contain(args[0])) {
cons_show("No such invite exists.");
@@ -2537,7 +2528,7 @@ cmd_form_field(ProfWin *window, char *tag, gchar **args)
}
gboolean
-cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_form(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2555,7 +2546,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(args[0], "cancel") != 0) &&
(g_strcmp0(args[0], "show") != 0) &&
(g_strcmp0(args[0], "help") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2578,7 +2569,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
Command *command = g_hash_table_lookup(commands, "/form");
if (command) {
- help_text = command->help.long_help;
+ help_text = command->help.synopsis;
}
ui_show_lines((ProfWin*) confwin, help_text);
@@ -2611,7 +2602,7 @@ cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_kick(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2637,14 +2628,14 @@ cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help)
win_vprint((ProfWin*) mucwin, '!', NULL, 0, 0, "", "Occupant does not exist: %s", nick);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_ban(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2666,13 +2657,13 @@ cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help)
char *reason = args[1];
iq_room_affiliation_set(mucwin->roomjid, jid, "outcast", reason);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_subject(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2704,7 +2695,7 @@ cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
if (args[1]) {
message_send_groupchat_subject(mucwin->roomjid, args[1]);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
@@ -2714,12 +2705,12 @@ cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_affiliation(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2735,7 +2726,7 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
char *cmd = args[0];
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2746,7 +2737,7 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(affiliation, "member") != 0) &&
(g_strcmp0(affiliation, "none") != 0) &&
(g_strcmp0(affiliation, "outcast") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2769,13 +2760,13 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
if (!affiliation) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *jid = args[2];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *reason = args[3];
@@ -2784,12 +2775,12 @@ cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_role(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2805,7 +2796,7 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
char *cmd = args[0];
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2815,7 +2806,7 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
(g_strcmp0(role, "participant") != 0) &&
(g_strcmp0(role, "moderator") != 0) &&
(g_strcmp0(role, "none") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2837,13 +2828,13 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(cmd, "set") == 0) {
if (!role) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *nick = args[2];
if (nick == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *reason = args[3];
@@ -2852,12 +2843,12 @@ cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help)
}
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_room(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2874,7 +2865,7 @@ cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
if ((g_strcmp0(args[0], "accept") != 0) &&
(g_strcmp0(args[0], "destroy") != 0) &&
(g_strcmp0(args[0], "config") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -2920,7 +2911,7 @@ cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_occupants(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -2931,7 +2922,7 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(args[0], "size") == 0) {
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
int intval = 0;
@@ -2970,7 +2961,7 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
}
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
@@ -2998,14 +2989,14 @@ cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_room_hide_occupants(mucwin->roomjid);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
-cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_rooms(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3026,7 +3017,7 @@ cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_bookmark(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3052,7 +3043,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
} else {
if (cmd == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3062,7 +3053,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
} else {
char *jid = args[1];
if (jid == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3090,7 +3081,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
GHashTable *options = parse_options(&args[2], opt_keys, &parsed);
if (!parsed) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3101,7 +3092,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
if (autojoin) {
if ((strcmp(autojoin, "on") != 0) && (strcmp(autojoin, "off") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
cons_show("");
return TRUE;
}
@@ -3126,7 +3117,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("No bookmark exists for %s.", jid);
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
options_destroy(options);
@@ -3137,7 +3128,7 @@ cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_disco(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3167,7 +3158,7 @@ cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_nick(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3189,14 +3180,14 @@ cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_alias(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
if (strcmp(subcmd, "add") == 0) {
char *alias = args[1];
if (alias == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
char *alias_p = alias;
@@ -3211,7 +3202,7 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
char *value = args[2];
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
g_string_free(ac_value, TRUE);
return TRUE;
} else if (cmd_exists(ac_value->str)) {
@@ -3230,7 +3221,7 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
} else if (strcmp(subcmd, "remove") == 0) {
char *alias = args[1];
if (alias == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
} else {
if (alias[0] == '/') {
@@ -3255,13 +3246,13 @@ cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_free_aliases(aliases);
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_tiny(ProfWin *window, gchar **args, const char * const command)
{
char *url = args[0];
@@ -3313,14 +3304,14 @@ cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_clear(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_clear(ProfWin *window, gchar **args, const char * const command)
{
ui_clear_win(window);
return TRUE;
}
gboolean
-cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_close(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = 0;
@@ -3392,7 +3383,7 @@ cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_leave(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
int index = wins_get_current_num();
@@ -3415,9 +3406,9 @@ cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_privileges(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "MUC privileges", PREF_MUC_PRIVILEGES);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "MUC privileges", PREF_MUC_PRIVILEGES);
ui_redraw_all_room_rosters();
@@ -3425,21 +3416,21 @@ cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_beep(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_beep(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Sound", PREF_BEEP);
+ return _cmd_set_boolean_preference(args[0], command, "Sound", PREF_BEEP);
}
gboolean
-cmd_presence(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_presence(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Contact presence", PREF_PRESENCE);
+ return _cmd_set_boolean_preference(args[0], command, "Contact presence", PREF_PRESENCE);
}
gboolean
-cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_wrap(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Word wrap", PREF_WRAP);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Word wrap", PREF_WRAP);
wins_resize_all();
@@ -3447,7 +3438,7 @@ cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_time(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "statusbar") == 0) {
if (args[1] == NULL) {
@@ -3464,7 +3455,7 @@ cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
ui_redraw();
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else if (g_strcmp0(args[0], "main") == 0) {
@@ -3482,19 +3473,19 @@ cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help)
wins_resize_all();
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_states(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help, "Sending chat states",
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Sending chat states",
PREF_STATES);
// if disabled, disable outtype and gone
@@ -3507,26 +3498,26 @@ cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_titlebar(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_titlebar(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "show") != 0 && g_strcmp0(args[0], "goodbye") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (g_strcmp0(args[0], "show") == 0 && g_strcmp0(args[1], "off") == 0) {
ui_clear_win_title();
}
if (g_strcmp0(args[0], "show") == 0) {
- return _cmd_set_boolean_preference(args[1], help, "Titlebar show", PREF_TITLEBAR_SHOW);
+ return _cmd_set_boolean_preference(args[1], command, "Titlebar show", PREF_TITLEBAR_SHOW);
} else {
- return _cmd_set_boolean_preference(args[1], help, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
+ return _cmd_set_boolean_preference(args[1], command, "Titlebar goodbye", PREF_TITLEBAR_GOODBYE);
}
}
gboolean
-cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_outtype(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
+ gboolean result = _cmd_set_boolean_preference(args[0], command,
"Sending typing notifications", PREF_OUTTYPE);
// if enabled, enable states
@@ -3538,7 +3529,7 @@ cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_gone(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3562,7 +3553,7 @@ cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help)
gboolean
-cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_notify(ProfWin *window, gchar **args, const char * const command)
{
char *kind = args[0];
@@ -3570,7 +3561,7 @@ cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
if ((strcmp(kind, "message") != 0) && (strcmp(kind, "typing") != 0) &&
(strcmp(kind, "remind") != 0) && (strcmp(kind, "invite") != 0) &&
(strcmp(kind, "sub") != 0) && (strcmp(kind, "room") != 0)) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
// set message setting
} else if (strcmp(kind, "message") == 0) {
@@ -3705,14 +3696,14 @@ cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_inpblock(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
char *value = args[1];
if (g_strcmp0(subcmd, "timeout") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3733,7 +3724,7 @@ cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
if (g_strcmp0(subcmd, "dynamic") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3742,23 +3733,23 @@ cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- return _cmd_set_boolean_preference(value, help, "Dynamic input blocking", PREF_INPBLOCK_DYNAMIC);
+ return _cmd_set_boolean_preference(value, command, "Dynamic input blocking", PREF_INPBLOCK_DYNAMIC);
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
gboolean
-cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_log(ProfWin *window, gchar **args, const char * const command)
{
char *subcmd = args[0];
char *value = args[1];
if (strcmp(subcmd, "maxsize") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -3777,18 +3768,18 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
if (strcmp(subcmd, "rotate") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
- return _cmd_set_boolean_preference(value, help, "Log rotate", PREF_LOG_ROTATE);
+ return _cmd_set_boolean_preference(value, command, "Log rotate", PREF_LOG_ROTATE);
}
if (strcmp(subcmd, "shared") == 0) {
if (value == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
- gboolean result = _cmd_set_boolean_preference(value, help, "Shared log", PREF_LOG_SHARED);
+ gboolean result = _cmd_set_boolean_preference(value, command, "Shared log", PREF_LOG_SHARED);
log_reinit();
return result;
}
@@ -3799,7 +3790,7 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
/* TODO: make 'level' subcommand for debug level */
@@ -3807,7 +3798,7 @@ cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_reconnect(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3823,7 +3814,7 @@ cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
} else {
cons_show(err_msg);
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
free(err_msg);
}
@@ -3831,7 +3822,7 @@ cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoping(ProfWin *window, gchar **args, const char * const command)
{
char *value = args[0];
@@ -3848,7 +3839,7 @@ cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
} else {
cons_show(err_msg);
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
free(err_msg);
}
@@ -3856,7 +3847,7 @@ cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_ping(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3876,7 +3867,7 @@ cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoaway(ProfWin *window, gchar **args, const char * const command)
{
char *setting = args[0];
char *value = args[1];
@@ -3927,15 +3918,14 @@ cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help)
}
if (strcmp(setting, "check") == 0) {
- return _cmd_set_boolean_preference(value, help, "Online check",
- PREF_AUTOAWAY_CHECK);
+ return _cmd_set_boolean_preference(value, command, "Online check", PREF_AUTOAWAY_CHECK);
}
return TRUE;
}
gboolean
-cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_priority(ProfWin *window, gchar **args, const char * const command)
{
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -3963,19 +3953,19 @@ cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_statuses(ProfWin *window, gchar **args, const char * const command)
{
if (strcmp(args[0], "console") != 0 &&
strcmp(args[0], "chat") != 0 &&
strcmp(args[0], "muc") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
if (strcmp(args[1], "all") != 0 &&
strcmp(args[1], "online") != 0 &&
strcmp(args[1], "none") != 0) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4016,7 +4006,7 @@ cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_vercheck(ProfWin *window, gchar **args, const char * const command)
{
int num_args = g_strv_length(args);
@@ -4024,13 +4014,12 @@ cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_check_version(TRUE);
return TRUE;
} else {
- return _cmd_set_boolean_preference(args[0], help,
- "Version checking", PREF_VERCHECK);
+ return _cmd_set_boolean_preference(args[0], command, "Version checking", PREF_VERCHECK);
}
}
gboolean
-cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command)
{
if (!ui_xmlconsole_exists()) {
ui_create_xmlconsole_win();
@@ -4042,28 +4031,25 @@ cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_flash(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_flash(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Screen flash", PREF_FLASH);
+ return _cmd_set_boolean_preference(args[0], command, "Screen flash", PREF_FLASH);
}
gboolean
-cmd_intype(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_intype(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Show contact typing", PREF_INTYPE);
+ return _cmd_set_boolean_preference(args[0], command, "Show contact typing", PREF_INTYPE);
}
gboolean
-cmd_splash(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_splash(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help,
- "Splash screen", PREF_SPLASH);
+ return _cmd_set_boolean_preference(args[0], command, "Splash screen", PREF_SPLASH);
}
gboolean
-cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_autoconnect(ProfWin *window, gchar **args, const char * const command)
{
if (strcmp(args[0], "off") == 0) {
prefs_set_string(PREF_CONNECT_ACCOUNT, NULL);
@@ -4072,16 +4058,15 @@ cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help)
prefs_set_string(PREF_CONNECT_ACCOUNT, args[1]);
cons_show("Autoconnect account set to: %s.", args[1]);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return true;
}
gboolean
-cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_chlog(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Chat logging", PREF_CHLOG);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat logging", PREF_CHLOG);
// if set to off, disable history
if (result == TRUE && (strcmp(args[0], "off") == 0)) {
@@ -4092,19 +4077,17 @@ cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_grlog(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_grlog(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Groupchat logging", PREF_GRLOG);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Groupchat logging", PREF_GRLOG);
return result;
}
gboolean
-cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_history(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Chat history", PREF_HISTORY);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Chat history", PREF_HISTORY);
// if set to on, set chlog
if (result == TRUE && (strcmp(args[0], "on") == 0)) {
@@ -4115,10 +4098,9 @@ cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_carbons(ProfWin *window, gchar **args, const char * const command)
{
- gboolean result = _cmd_set_boolean_preference(args[0], help,
- "Message carbons preference", PREF_CARBONS);
+ gboolean result = _cmd_set_boolean_preference(args[0], command, "Message carbons preference", PREF_CARBONS);
jabber_conn_status_t conn_status = jabber_get_connection_status();
@@ -4136,61 +4118,59 @@ cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_receipts(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_receipts(ProfWin *window, gchar **args, const char * const command)
{
if (g_strcmp0(args[0], "send") == 0) {
- return _cmd_set_boolean_preference(args[1], help,
- "Send delivery receipts", PREF_RECEIPTS_SEND);
+ return _cmd_set_boolean_preference(args[1], command, "Send delivery receipts", PREF_RECEIPTS_SEND);
} else if (g_strcmp0(args[0], "request") == 0) {
- return _cmd_set_boolean_preference(args[1], help,
- "Request delivery receipets", PREF_RECEIPTS_REQUEST);
+ return _cmd_set_boolean_preference(args[1], command, "Request delivery receipets", PREF_RECEIPTS_REQUEST);
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
}
gboolean
-cmd_away(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_away(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_AWAY, "away", args);
return TRUE;
}
gboolean
-cmd_online(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_online(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_ONLINE, "online", args);
return TRUE;
}
gboolean
-cmd_dnd(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_dnd(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_DND, "dnd", args);
return TRUE;
}
gboolean
-cmd_chat(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_chat(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_CHAT, "chat", args);
return TRUE;
}
gboolean
-cmd_xa(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_xa(ProfWin *window, gchar **args, const char * const command)
{
_update_presence(RESOURCE_XA, "xa", args);
return TRUE;
}
gboolean
-cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_pgp(ProfWin *window, gchar **args, const char * const command)
{
#ifdef HAVE_LIBGPGME
if (args[0] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4212,7 +4192,7 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
}
@@ -4246,13 +4226,13 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
char *jid = args[1];
if (!args[1]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
char *keyid = args[2];
if (!args[2]) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4388,7 +4368,7 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
}
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
#else
cons_show("This version of Profanity has not been built with PGP support enabled");
@@ -4398,11 +4378,11 @@ cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_otr(ProfWin *window, gchar **args, const char * const command)
{
#ifdef HAVE_LIBOTR
if (args[0] == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4424,7 +4404,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
cons_show("Chat logging is currently disabled, use '/chlog on' to enable.");
}
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
}
return TRUE;
@@ -4643,7 +4623,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *secret = args[1];
if (secret == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4654,7 +4634,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *question = args[1];
char *answer = args[2];
if (question == NULL || answer == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4688,7 +4668,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
char *answer = args[1];
if (answer == NULL) {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
@@ -4696,7 +4676,7 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
return TRUE;
} else {
- cons_show("Usage: %s", help.usage);
+ cons_bad_cmd_usage(command);
return TRUE;
}
#else
@@ -4706,9 +4686,9 @@ cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help)
}
gboolean
-cmd_encwarn(ProfWin *window, gchar **args, struct cmd_help_t help)
+cmd_encwarn(ProfWin *window, gchar **args, const char * const command)
{
- return _cmd_set_boolean_preference(args[0], help, "Encryption warning message", PREF_ENC_WARN);
+ return _cmd_set_boolean_preference(args[0], command, "Encryption warning message", PREF_ENC_WARN);
}
// helper function for status change commands
@@ -4734,7 +4714,7 @@ _update_presence(const resource_presence_t resource_presence,
// helper function for boolean preference commands
static gboolean
-_cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
+_cmd_set_boolean_preference(gchar *arg, const char * const command,
const char * const display, preference_t pref)
{
GString *enabled = g_string_new(display);
@@ -4744,9 +4724,7 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
g_string_append(disabled, " disabled.");
if (arg == NULL) {
- char usage[strlen(help.usage) + 8];
- sprintf(usage, "Usage: %s", help.usage);
- cons_show(usage);
+ cons_bad_cmd_usage(command);
} else if (strcmp(arg, "on") == 0) {
cons_show(enabled->str);
prefs_set_boolean(pref, TRUE);
@@ -4754,9 +4732,7 @@ _cmd_set_boolean_preference(gchar *arg, struct cmd_help_t help,
cons_show(disabled->str);
prefs_set_boolean(pref, FALSE);
} else {
- char usage[strlen(help.usage) + 8];
- sprintf(usage, "Usage: %s", help.usage);
- cons_show(usage);
+ cons_bad_cmd_usage(command);
}
g_string_free(enabled, TRUE);
diff --git a/src/command/commands.h b/src/command/commands.h
index bf0f94ae..70d5d5e0 100644
--- a/src/command/commands.h
+++ b/src/command/commands.h
@@ -39,10 +39,6 @@
// Command help strings
typedef struct cmd_help_t {
- const gchar *usage;
- const gchar *short_help;
- const gchar *long_help[50];
-
const gchar *synopsis[50];
const gchar *desc;
const gchar *args[50][2];
@@ -61,7 +57,7 @@ typedef struct cmd_help_t {
*/
typedef struct cmd_t {
gchar *cmd;
- gboolean (*func)(ProfWin *window, gchar **args, struct cmd_help_t help);
+ gboolean (*func)(ProfWin *window, gchar **args, const char * const command);
gchar** (*parser)(const char * const inp, int min, int max, gboolean *result);
int min_args;
int max_args;
@@ -72,85 +68,85 @@ typedef struct cmd_t {
gboolean cmd_execute_alias(ProfWin *window, const char * const inp, gboolean *ran);
gboolean cmd_execute_default(ProfWin *window, const char * inp);
-gboolean cmd_about(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_account(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoaway(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_autoping(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_away(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_beep(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_caps(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_chat(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_chlog(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_clear(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_close(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_connect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_decline(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_disco(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_disconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_dnd(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_flash(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_gone(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_grlog(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_group(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_help(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_history(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_carbons(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_receipts(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_info(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_intype(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_invite(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_invites(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_join(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_leave(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_log(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_msg(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_nick(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_notify(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_online(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_otr(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_pgp(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_outtype(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_prefs(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_priority(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_quit(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_reconnect(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_room(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_rooms(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_bookmark(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_roster(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_software(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_splash(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_states(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_status(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_statuses(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_sub(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_theme(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_tiny(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_titlebar(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_vercheck(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_who(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_win(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_wins(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_winstidy(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_xa(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_alias(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_xmlconsole(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_ping(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_form(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_occupants(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_kick(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_ban(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_subject(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_affiliation(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_role(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_privileges(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_presence(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_wrap(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_time(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_resource(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_inpblock(ProfWin *window, gchar **args, struct cmd_help_t help);
-gboolean cmd_encwarn(ProfWin *window, gchar **args, struct cmd_help_t help);
+gboolean cmd_about(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_account(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoaway(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_autoping(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_away(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_beep(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_caps(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_chat(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_chlog(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_clear(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_close(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_connect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_decline(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_disco(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_disconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_dnd(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_flash(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_gone(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_grlog(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_group(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_help(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_history(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_carbons(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_receipts(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_info(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_intype(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_invite(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_invites(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_join(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_leave(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_log(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_msg(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_nick(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_notify(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_online(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_otr(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_pgp(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_outtype(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_prefs(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_priority(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_quit(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_reconnect(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_room(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_rooms(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_bookmark(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_roster(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_software(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_splash(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_states(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_status(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_statuses(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_sub(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_theme(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_tiny(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_titlebar(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_vercheck(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_who(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_win(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_wins(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_winstidy(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_xa(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_alias(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_xmlconsole(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_ping(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_form(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_occupants(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_kick(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_ban(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_subject(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_affiliation(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_role(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_privileges(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_presence(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_wrap(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_time(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_resource(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_inpblock(ProfWin *window, gchar **args, const char * const command);
+gboolean cmd_encwarn(ProfWin *window, gchar **args, const char * const command);
gboolean cmd_form_field(ProfWin *window, char *tag, gchar **args);
diff --git a/src/ui/console.c b/src/ui/console.c
index 67c1da58..027f9e73 100644
--- a/src/ui/console.c
+++ b/src/ui/console.c
@@ -141,6 +141,18 @@ cons_show_help(Command *command)
}
}
+void
+cons_bad_cmd_usage(const char * const cmd)
+{
+ GString *msg = g_string_new("");
+ g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]);
+
+ cons_show("");
+ cons_show(msg->str);
+
+ g_string_free(msg, TRUE);
+}
+
void
cons_show_error(const char * const msg, ...)
{
diff --git a/src/ui/core.c b/src/ui/core.c
index 5f85a3cd..821de9fe 100644
--- a/src/ui/core.c
+++ b/src/ui/core.c
@@ -667,22 +667,25 @@ ui_handle_error(const char * const err_msg)
}
void
-ui_invalid_command_usage(const char * const usage, void (*setting_func)(void))
+ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void))
{
+ GString *msg = g_string_new("");
+ g_string_printf(msg, "Invalid usage, see '/help %s' for details.", &cmd[1]);
+
if (setting_func) {
cons_show("");
(*setting_func)();
- cons_show("Usage: %s", usage);
+ cons_show(msg->str);
} else {
cons_show("");
- cons_show("Usage: %s", usage);
+ cons_show(msg->str);
ProfWin *current = wins_get_current();
if (current->type == WIN_CHAT) {
- char usage_cpy[strlen(usage) + 8];
- sprintf(usage_cpy, "Usage: %s", usage);
- ui_current_print_line(usage_cpy);
+ ui_current_print_line(msg->str);
}
}
+
+ g_string_free(msg, TRUE);
}
void
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 58f1ee98..dba90d2b 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -228,7 +228,7 @@ void ui_input_clear(void);
void ui_input_nonblocking(gboolean);
void ui_write(char *line, int offset);
-void ui_invalid_command_usage(const char * const usage, void (*setting_func)(void));
+void ui_invalid_command_usage(const char * const cmd, void (*setting_func)(void));
void ui_create_xmlconsole_win(void);
gboolean ui_xmlconsole_exists(void);
@@ -243,6 +243,7 @@ void cons_show(const char * const msg, ...);
void cons_about(void);
void cons_help(void);
void cons_show_help(Command *command);
+void cons_bad_cmd_usage(const char * const cmd);
void cons_navigation_help(void);
void cons_prefs(void);
void cons_show_ui_prefs(void);