mirror of
https://github.com/profanity-im/profanity.git
synced 2025-02-02 15:08:15 -05:00
Fixed help command name clash on status
This commit is contained in:
parent
fd4d00cdd2
commit
8ecbe0c590
@ -125,7 +125,7 @@ static struct cmd_t main_commands[] =
|
||||
"-------------------------",
|
||||
"Show help options.",
|
||||
"Specify list if you want a list of all commands.",
|
||||
"Specify an area (basic, status, settings, navigation) for more help on that area.",
|
||||
"Specify an area (basic, presence, settings, navigation) for more help on that area.",
|
||||
"Specify the command if you want more detailed help on a specific command.",
|
||||
"",
|
||||
"Example : /help list",
|
||||
@ -193,9 +193,9 @@ static struct cmd_t main_commands[] =
|
||||
|
||||
{ "/status",
|
||||
_cmd_status,
|
||||
{ "/msg user@host", "Find out a contacts status.",
|
||||
{ "/msg user@host",
|
||||
"--------------",
|
||||
{ "/status user@host", "Find out a contacts status.",
|
||||
{ "/status user@host",
|
||||
"-----------------",
|
||||
"Find out someones presence information.",
|
||||
"Use tab completion to autocomplete the contact.",
|
||||
NULL } } },
|
||||
@ -436,7 +436,7 @@ static struct cmd_t setting_commands[] =
|
||||
NULL } } }
|
||||
};
|
||||
|
||||
static struct cmd_t status_commands[] =
|
||||
static struct cmd_t presence_commands[] =
|
||||
{
|
||||
{ "/away",
|
||||
_cmd_away,
|
||||
@ -518,7 +518,7 @@ cmd_init(void)
|
||||
help_ac = p_autocomplete_new();
|
||||
p_autocomplete_add(help_ac, strdup("list"));
|
||||
p_autocomplete_add(help_ac, strdup("basic"));
|
||||
p_autocomplete_add(help_ac, strdup("status"));
|
||||
p_autocomplete_add(help_ac, strdup("presence"));
|
||||
p_autocomplete_add(help_ac, strdup("settings"));
|
||||
p_autocomplete_add(help_ac, strdup("navigation"));
|
||||
|
||||
@ -549,8 +549,8 @@ cmd_init(void)
|
||||
p_autocomplete_add(help_ac, (gchar *)strdup(pcmd->cmd+1));
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(status_commands); i++) {
|
||||
struct cmd_t *pcmd = status_commands+i;
|
||||
for (i = 0; i < ARRAY_SIZE(presence_commands); i++) {
|
||||
struct cmd_t *pcmd = presence_commands+i;
|
||||
p_autocomplete_add(commands_ac, (gchar *)strdup(pcmd->cmd));
|
||||
p_autocomplete_add(help_ac, (gchar *)strdup(pcmd->cmd+1));
|
||||
p_autocomplete_add(who_ac, (gchar *)strdup(pcmd->cmd+1));
|
||||
@ -640,13 +640,13 @@ cmd_get_settings_help(void)
|
||||
}
|
||||
|
||||
GSList *
|
||||
cmd_get_status_help(void)
|
||||
cmd_get_presence_help(void)
|
||||
{
|
||||
GSList *result = NULL;
|
||||
|
||||
unsigned int i;
|
||||
for (i = 0; i < ARRAY_SIZE(status_commands); i++) {
|
||||
result = g_slist_append(result, &((status_commands+i)->help));
|
||||
for (i = 0; i < ARRAY_SIZE(presence_commands); i++) {
|
||||
result = g_slist_append(result, &((presence_commands+i)->help));
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -951,19 +951,19 @@ _cmd_help(const char * const inp, struct cmd_help_t help)
|
||||
}
|
||||
}
|
||||
cons_show_word("\n");
|
||||
cons_show("Status commands:");
|
||||
cons_show("Presence commands:");
|
||||
cons_show_time();
|
||||
for (i = 0; i < ARRAY_SIZE(status_commands); i++) {
|
||||
cons_show_word( (status_commands+i)->cmd );
|
||||
if (i < ARRAY_SIZE(status_commands) - 1) {
|
||||
for (i = 0; i < ARRAY_SIZE(presence_commands); i++) {
|
||||
cons_show_word( (presence_commands+i)->cmd );
|
||||
if (i < ARRAY_SIZE(presence_commands) - 1) {
|
||||
cons_show_word(", ");
|
||||
}
|
||||
}
|
||||
cons_show_word("\n");
|
||||
} else if (strcmp(inp, "/help basic") == 0) {
|
||||
cons_basic_help();
|
||||
} else if (strcmp(inp, "/help status") == 0) {
|
||||
cons_status_help();
|
||||
} else if (strcmp(inp, "/help presence") == 0) {
|
||||
cons_presence_help();
|
||||
} else if (strcmp(inp, "/help settings") == 0) {
|
||||
cons_settings_help();
|
||||
} else if (strcmp(inp, "/help navigation") == 0) {
|
||||
@ -1614,8 +1614,8 @@ _cmd_get_command(const char * const command)
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(status_commands); i++) {
|
||||
struct cmd_t *pcmd = status_commands+i;
|
||||
for (i = 0; i < ARRAY_SIZE(presence_commands); i++) {
|
||||
struct cmd_t *pcmd = presence_commands+i;
|
||||
if (strcmp(pcmd->cmd, command) == 0) {
|
||||
return pcmd;
|
||||
}
|
||||
|
@ -43,6 +43,6 @@ gboolean cmd_execute_default(const char * const inp);
|
||||
|
||||
GSList * cmd_get_basic_help(void);
|
||||
GSList * cmd_get_settings_help(void);
|
||||
GSList * cmd_get_status_help(void);
|
||||
GSList * cmd_get_presence_help(void);
|
||||
|
||||
#endif
|
||||
|
2
src/ui.h
2
src/ui.h
@ -134,7 +134,7 @@ void cons_about(void);
|
||||
void cons_help(void);
|
||||
void cons_basic_help(void);
|
||||
void cons_settings_help(void);
|
||||
void cons_status_help(void);
|
||||
void cons_presence_help(void);
|
||||
void cons_navigation_help(void);
|
||||
void cons_prefs(void);
|
||||
void cons_bad_command(const char * const cmd);
|
||||
|
@ -943,7 +943,7 @@ cons_help(void)
|
||||
cons_show("");
|
||||
cons_show("/help list - List all commands.");
|
||||
cons_show("/help basic - Summary of basic usgae commands.");
|
||||
cons_show("/help status - Summary of online status change commands.");
|
||||
cons_show("/help presence - Summary of online status change commands.");
|
||||
cons_show("/help settings - Summary of commands for changing Profanity settings.");
|
||||
cons_show("/help navigation - How to navigate around Profanity.");
|
||||
cons_show("/help [command] - Detailed help on a specific command.");
|
||||
@ -985,17 +985,17 @@ cons_settings_help(void)
|
||||
}
|
||||
|
||||
void
|
||||
cons_status_help(void)
|
||||
cons_presence_help(void)
|
||||
{
|
||||
cons_show("");
|
||||
cons_show("Status changes:");
|
||||
cons_show("Presence changes:");
|
||||
cons_show("");
|
||||
|
||||
GSList *status_helpers = cmd_get_status_help();
|
||||
while (status_helpers != NULL) {
|
||||
struct cmd_help_t *help = (struct cmd_help_t *)status_helpers->data;
|
||||
GSList *presence_helpers = cmd_get_presence_help();
|
||||
while (presence_helpers != NULL) {
|
||||
struct cmd_help_t *help = (struct cmd_help_t *)presence_helpers->data;
|
||||
cons_show("%-25s: %s", help->usage, help->short_help);
|
||||
status_helpers = g_slist_next(status_helpers);
|
||||
presence_helpers = g_slist_next(presence_helpers);
|
||||
}
|
||||
|
||||
cons_show("");
|
||||
|
Loading…
x
Reference in New Issue
Block a user