mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Merge pull request #1171 from ailin-nemui/hidden-options
hide the deprecated -ssl options from completion
This commit is contained in:
commit
261631a6e1
@ -517,7 +517,12 @@ void chat_commands_init(void)
|
||||
|
||||
signal_add("server sendmsg", (SIGNAL_FUNC) sig_server_sendmsg);
|
||||
|
||||
command_set_options("connect", "4 6 !! -network ssl +ssl_cert +ssl_pkey +ssl_pass ssl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_pinned_cert +ssl_pinned_pubkey tls +tls_cert +tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
|
||||
command_set_options(
|
||||
"connect",
|
||||
"4 6 !! -network ~ssl ~+ssl_cert ~+ssl_pkey ~+ssl_pass ~ssl_verify ~+ssl_cafile "
|
||||
"~+ssl_capath ~+ssl_ciphers ~+ssl_pinned_cert ~+ssl_pinned_pubkey tls +tls_cert "
|
||||
"+tls_pkey +tls_pass tls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert "
|
||||
"+tls_pinned_pubkey +host noproxy -rawlog noautosendcmd");
|
||||
command_set_options("msg", "channel nick");
|
||||
}
|
||||
|
||||
|
@ -339,11 +339,28 @@ void command_runsub(const char *cmd, const char *data,
|
||||
g_free(orig);
|
||||
}
|
||||
|
||||
static char *optname(char *option)
|
||||
{
|
||||
char *opt = option;
|
||||
if (*opt == '~')
|
||||
opt++;
|
||||
if (iscmdtype(*opt))
|
||||
opt++;
|
||||
return opt;
|
||||
}
|
||||
|
||||
static gboolean optflag(char *option, char *flag)
|
||||
{
|
||||
if (*option == '~')
|
||||
return optflag(option + 1, flag);
|
||||
|
||||
return (strchr(flag, *option) != NULL) || (!iscmdtype(*option) && strchr(flag, ' '));
|
||||
}
|
||||
|
||||
static GSList *optlist_find(GSList *optlist, const char *option)
|
||||
{
|
||||
while (optlist != NULL) {
|
||||
char *name = optlist->data;
|
||||
if (iscmdtype(*name)) name++;
|
||||
char *name = optname(optlist->data);
|
||||
|
||||
if (g_ascii_strcasecmp(name, option) == 0)
|
||||
return optlist;
|
||||
@ -369,7 +386,7 @@ int command_have_option(const char *cmd, const char *option)
|
||||
return FALSE;
|
||||
|
||||
for (tmp = rec->options; *tmp != NULL; tmp++) {
|
||||
char *name = iscmdtype(**tmp) ? (*tmp)+1 : *tmp;
|
||||
char *name = optname(*tmp);
|
||||
|
||||
if (g_ascii_strcasecmp(name, option) == 0)
|
||||
return TRUE;
|
||||
@ -399,7 +416,7 @@ static void command_calc_options(COMMAND_REC *rec, const char *options)
|
||||
|
||||
/* merge the options */
|
||||
for (tmp = optlist; *tmp != NULL; tmp++) {
|
||||
name = iscmdtype(**tmp) ? (*tmp)+1 : *tmp;
|
||||
name = optname(*tmp);
|
||||
|
||||
oldopt = optlist_find(list, name);
|
||||
if (oldopt != NULL) {
|
||||
@ -529,7 +546,7 @@ static int option_find(char **array, const char *option)
|
||||
|
||||
found = -1; index = 0; multiple = FALSE;
|
||||
for (tmp = array; *tmp != NULL; tmp++, index++) {
|
||||
const char *text = *tmp + iscmdtype(**tmp);
|
||||
const char *text = optname(*tmp);
|
||||
|
||||
if (g_ascii_strncasecmp(text, option, len) == 0) {
|
||||
if (text[len] == '\0') {
|
||||
@ -568,9 +585,9 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
option = NULL; pos = -1;
|
||||
for (;;) {
|
||||
if (**data == '\0' || **data == '-') {
|
||||
if (option != NULL && *optlist[pos] == '+') {
|
||||
if (option != NULL && optflag(optlist[pos], "+")) {
|
||||
/* required argument missing! */
|
||||
*data = optlist[pos] + 1;
|
||||
*data = optname(optlist[pos]);
|
||||
return CMDERR_OPTION_ARG_MISSING;
|
||||
}
|
||||
}
|
||||
@ -621,14 +638,12 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
if (pos >= 0) {
|
||||
/* if we used a shortcut of parameter, put
|
||||
the whole parameter name in options table */
|
||||
option = optlist[pos] +
|
||||
iscmdtype(*optlist[pos]);
|
||||
option = optname(optlist[pos]);
|
||||
}
|
||||
if (options != NULL && pos != -3)
|
||||
g_hash_table_insert(options, option, "");
|
||||
|
||||
if (pos < 0 || !iscmdtype(*optlist[pos]) ||
|
||||
*optlist[pos] == '!')
|
||||
if (pos < 0 || optflag(optlist[pos], " !"))
|
||||
option = NULL;
|
||||
|
||||
while (**data == ' ') (*data)++;
|
||||
@ -638,7 +653,7 @@ static int get_cmd_options(char **data, int ignore_unknown,
|
||||
if (option == NULL)
|
||||
break;
|
||||
|
||||
if (*optlist[pos] == '@' && !is_numeric(*data, ' '))
|
||||
if (optflag(optlist[pos], "@") && !is_numeric(*data, ' '))
|
||||
break; /* expected a numeric argument */
|
||||
|
||||
/* save the argument */
|
||||
|
@ -544,7 +544,11 @@ static GList *completion_get_options(const char *cmd, const char *option)
|
||||
list = NULL;
|
||||
len = strlen(option);
|
||||
for (tmp = rec->options; *tmp != NULL; tmp++) {
|
||||
const char *optname = *tmp + iscmdtype(**tmp);
|
||||
const char *optname;
|
||||
if (**tmp == '~')
|
||||
continue; /* deprecated or hidden option */
|
||||
|
||||
optname = *tmp + iscmdtype(**tmp);
|
||||
|
||||
if (len == 0 || g_ascii_strncasecmp(optname, option, len) == 0)
|
||||
list = g_list_append(list, g_strconcat("-", optname, NULL));
|
||||
|
@ -453,8 +453,19 @@ void fe_server_init(void)
|
||||
command_bind_first("server", NULL, (SIGNAL_FUNC) server_command);
|
||||
command_bind_first("disconnect", NULL, (SIGNAL_FUNC) server_command);
|
||||
|
||||
command_set_options("server add", "4 6 !! ssl nossl +ssl_cert +ssl_pkey +ssl_pass ssl_verify nossl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls notls +tls_cert +tls_pkey +tls_pass tls_verify notls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options("server modify", "4 6 !! ssl nossl +ssl_cert +ssl_pkey +ssl_pass ssl_verify nossl_verify +ssl_cafile +ssl_capath +ssl_ciphers +ssl_fingerprint tls notls +tls_cert +tls_pkey +tls_pass tls_verify notls_verify +tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert +tls_pinned_pubkey auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options(
|
||||
"server add", "4 6 !! ~ssl ~nossl ~+ssl_cert ~+ssl_pkey ~+ssl_pass ~ssl_verify "
|
||||
"~nossl_verify ~+ssl_cafile ~+ssl_capath ~+ssl_ciphers ~+ssl_fingerprint "
|
||||
"tls notls +tls_cert +tls_pkey +tls_pass tls_verify notls_verify "
|
||||
"+tls_cafile +tls_capath +tls_ciphers +tls_pinned_cert "
|
||||
"+tls_pinned_pubkey auto noauto proxy noproxy -host -port noautosendcmd");
|
||||
command_set_options(
|
||||
"server modify",
|
||||
"4 6 !! ~ssl ~nossl ~+ssl_cert ~+ssl_pkey ~+ssl_pass ~ssl_verify ~nossl_verify "
|
||||
"~+ssl_cafile ~+ssl_capath ~+ssl_ciphers ~+ssl_fingerprint tls notls +tls_cert "
|
||||
"+tls_pkey +tls_pass tls_verify notls_verify +tls_cafile +tls_capath +tls_ciphers "
|
||||
"+tls_pinned_cert +tls_pinned_pubkey auto noauto proxy noproxy -host -port "
|
||||
"noautosendcmd");
|
||||
|
||||
signal_add("server looking", (SIGNAL_FUNC) sig_server_looking);
|
||||
signal_add("server connecting", (SIGNAL_FUNC) sig_server_connecting);
|
||||
|
Loading…
Reference in New Issue
Block a user