summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Chappa <chappa@washington.edu>2021-08-21 10:50:37 -0600
committerEduardo Chappa <chappa@washington.edu>2021-08-21 10:50:37 -0600
commit9f0cab04498b4f5033d8b7181d57534523ddac34 (patch)
treee0a4c83885114f5d9904d4c5920ca61f155e67d8
parent36ca37aa3d669a66a19100f4e2564d6cd1a1b999 (diff)
downloadalpine-9f0cab04498b4f5033d8b7181d57534523ddac34.tar.xz
* Add option -xoauth2-flow to the command line, so that users can specify the
parameters to set up an xoauth2 connection through the command line.
-rw-r--r--alpine/arg.c27
-rw-r--r--pith/pine.hlp5
2 files changed, 30 insertions, 2 deletions
diff --git a/alpine/arg.c b/alpine/arg.c
index ff646379..8a36497c 100644
--- a/alpine/arg.c
+++ b/alpine/arg.c
@@ -87,7 +87,8 @@ static char args_err_missing_client_id[] = N_("missing client-id name. Example:
static char args_err_missing_client_secret[] = N_("missing client-secret name. Example: -xoauth2-client-secret V56i0fa_");
static char args_err_missing_tenant[] = N_("missing tenant value. Example: -xoauth2-tenant common");
static char args_err_missing_user[] = N_("missing username value. Example: -xoauth2-user user@example.com");
-static char args_err_missing_xoauth_option[] = N_("at least one of the arguments -xoauth2-server, or -xoauth2-client-id, xoauth2-tenant, or -xoauth2-client-secret is missing.");
+static char args_err_missing_flow[] = N_("missing flow. Example: -xoauth2-client-flow Authorize");
+static char args_err_missing_xoauth_option[] = N_("you must set all options -xoauth2-server, -xoauth2-client-id and -xoauth2-client-secret if you use any of them");
static char *args_pine_args[] = {
N_("Possible Starting Arguments for Alpine program:"),
@@ -184,6 +185,10 @@ N_(" -xoauth2-server <value>"),
N_(" -xoauth2-client-id <value>"),
N_(" -xoauth2-client-secret <value>"),
N_("\tNote: All of -xoauth options above must be used, if any of them is used"),
+N_(" -xoauth2-tenant <value>"),
+N_(" -xoauth2-user <value>"),
+N_(" -xoauth2-flow <value>"),
+N_("\tNote: The previous two options are optional and if not used, Alpine resorts to their defualt values"),
" -<option>=<value> Assign <value> to the pinerc option <option>",
"\t\t e.g. -signature-file=sig1",
"\t\t e.g. -color-style=no-color",
@@ -687,6 +692,20 @@ Loop: while(--ac > 0)
}
goto Loop;
}
+ else if(strcmp(*av, "xoauth2-flow") == 0){
+ if(--ac){
+ if((str = *++av) != NULL){
+ if(x.flow)
+ fs_give((void **) &x.flow);
+ x.users = cpystr(str);
+ }
+ }
+ else{
+ display_args_err(_(args_err_missing_flow), NULL, 1);
+ ++usage;
+ }
+ goto Loop;
+ }
#ifdef _WINDOWS
else if(strcmp(*av, "install") == 0){
pine_state->install_flag = 1;
@@ -1028,6 +1047,12 @@ Loop: while(--ac > 0)
}
}
+ if((x.name || x.client_id || x.client_secret)
+ && !(x.name && x.client_id && x.client_secret)){
+ display_args_err(_(args_err_missing_xoauth_option), NULL, 1);
+ ++usage;
+ }
+
if(((do_conf ? 1 : 0)+(pinerc_file ? 1 : 0)) > 1){
display_args_err(_("May only have one of -conf and -pinerc"),
NULL, 1);
diff --git a/pith/pine.hlp b/pith/pine.hlp
index 075d1fd5..deb0ee8a 100644
--- a/pith/pine.hlp
+++ b/pith/pine.hlp
@@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any
reasonable place to be called from.
Dummy change to get revision in pine.hlp
============= h_revision =================
-Alpine Commit 574 2021-08-19 21:13:45
+Alpine Commit 575 2021-08-21 10:50:32
============= h_news =================
<HTML>
<HEAD>
@@ -234,6 +234,9 @@ New features include:
toggles between hiding or showing hidden files, and the &quot;G&quot;
command to travel between directories. Contributed by &Eacute;tienne
Deparis.
+
+<LI> Add option -xoauth2-flow to the command line, so that users can specify the
+ parameters to set up an xoauth2 connection through the command line.
</UL>
<P>