mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Added skeleton /alias command
This commit is contained in:
parent
b6c52007ee
commit
8ba2d26947
@ -546,6 +546,14 @@ static struct cmd_t command_defs[] =
|
||||
"The default is 'off'.",
|
||||
NULL } } },
|
||||
|
||||
{ "/alias",
|
||||
cmd_alias, parse_args, 1, 3, &cons_alias_setting,
|
||||
{ "/alias add|remove|list [name value]", "Add your own command aliases.",
|
||||
{ "/alias add|remove|list [name value]",
|
||||
"-----------------------------------",
|
||||
"Add, remove or show command aliases.",
|
||||
NULL } } },
|
||||
|
||||
{ "/chlog",
|
||||
cmd_chlog, parse_args, 1, 1, &cons_chlog_setting,
|
||||
{ "/chlog on|off", "Chat logging to file.",
|
||||
@ -861,6 +869,7 @@ static Autocomplete otr_log_ac;
|
||||
static Autocomplete connect_property_ac;
|
||||
static Autocomplete statuses_ac;
|
||||
static Autocomplete statuses_cons_chat_ac;
|
||||
static Autocomplete alias_ac;
|
||||
|
||||
/*
|
||||
* Initialise command autocompleter and history
|
||||
@ -1044,6 +1053,11 @@ cmd_init(void)
|
||||
autocomplete_add(statuses_cons_chat_ac, "online");
|
||||
autocomplete_add(statuses_cons_chat_ac, "none");
|
||||
|
||||
alias_ac = autocomplete_new();
|
||||
autocomplete_add(alias_ac, "add");
|
||||
autocomplete_add(alias_ac, "remove");
|
||||
autocomplete_add(alias_ac, "list");
|
||||
|
||||
cmd_history_init();
|
||||
}
|
||||
|
||||
@ -1079,6 +1093,7 @@ cmd_uninit(void)
|
||||
autocomplete_free(connect_property_ac);
|
||||
autocomplete_free(statuses_ac);
|
||||
autocomplete_free(statuses_cons_chat_ac);
|
||||
autocomplete_free(alias_ac);
|
||||
}
|
||||
|
||||
// Command autocompletion functions
|
||||
@ -1157,6 +1172,7 @@ cmd_reset_autocomplete()
|
||||
autocomplete_reset(connect_property_ac);
|
||||
autocomplete_reset(statuses_ac);
|
||||
autocomplete_reset(statuses_cons_chat_ac);
|
||||
autocomplete_reset(alias_ac);
|
||||
bookmark_autocomplete_reset();
|
||||
}
|
||||
|
||||
@ -1378,8 +1394,8 @@ _cmd_complete_parameters(char *input, int *size)
|
||||
return;
|
||||
}
|
||||
|
||||
gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac };
|
||||
gchar *cmds[] = { "/help", "/prefs", "/log", "/disco", "/close", "/wins", "/alias" };
|
||||
Autocomplete completers[] = { help_ac, prefs_ac, log_ac, disco_ac, close_ac, wins_ac, alias_ac };
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
|
||||
result = autocomplete_param_with_ac(input, size, cmds[i], completers[i]);
|
||||
|
@ -1818,6 +1818,13 @@ cmd_nick(gchar **args, struct cmd_help_t help)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_alias(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
cons_show("Alias command TODO");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cmd_tiny(gchar **args, struct cmd_help_t help)
|
||||
{
|
||||
|
@ -109,5 +109,6 @@ gboolean cmd_who(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_win(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_wins(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_xa(gchar **args, struct cmd_help_t help);
|
||||
gboolean cmd_alias(gchar **args, struct cmd_help_t help);
|
||||
|
||||
#endif
|
||||
|
@ -902,6 +902,12 @@ _cons_show_account(ProfAccount *account)
|
||||
cons_alert();
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_alias_setting(void)
|
||||
{
|
||||
cons_show("Alias setting TODO");
|
||||
}
|
||||
|
||||
static void
|
||||
_cons_theme_setting(void)
|
||||
{
|
||||
@ -1607,6 +1613,7 @@ console_init_module(void)
|
||||
cons_mouse_setting = _cons_mouse_setting;
|
||||
cons_statuses_setting = _cons_statuses_setting;
|
||||
cons_titlebar_setting = _cons_titlebar_setting;
|
||||
cons_alias_setting = _cons_alias_setting;
|
||||
cons_show_ui_prefs = _cons_show_ui_prefs;
|
||||
cons_notify_setting = _cons_notify_setting;
|
||||
cons_show_desktop_prefs = _cons_show_desktop_prefs;
|
||||
|
@ -202,6 +202,7 @@ void (*cons_show_received_subs)(void);
|
||||
void (*cons_show_sent_subs)(void);
|
||||
void (*cons_alert)(void);
|
||||
void (*cons_theme_setting)(void);
|
||||
void (*cons_alias_setting)(void);
|
||||
void (*cons_beep_setting)(void);
|
||||
void (*cons_flash_setting)(void);
|
||||
void (*cons_splash_setting)(void);
|
||||
|
Loading…
Reference in New Issue
Block a user