[Commits] [SCM] claws branch, master, updated. 3.17.8-87-g518bb83c8

paul at claws-mail.org paul at claws-mail.org
Fri Jul 2 13:38:27 CEST 2021


The branch, master has been updated
       via  518bb83c8e68f6fec13063d7385830e410a14c3b (commit)
      from  99b75b1559f14ec72f9941458ab2b809f5af3694 (commit)

Summary of changes:
 src/oauth2.c        | 18 +++++++--------
 src/prefs_account.c | 65 +++++++++++++++++++++--------------------------------
 src/prefs_account.h | 11 +++++----
 3 files changed, 38 insertions(+), 56 deletions(-)


- Log -----------------------------------------------------------------
commit 518bb83c8e68f6fec13063d7385830e410a14c3b
Author: Paul <paul at claws-mail.org>
Date:   Fri Jul 2 12:38:22 2021 +0100

    custom client IDs only for oauth2

diff --git a/src/oauth2.c b/src/oauth2.c
index 3d2739086..2c591dfd6 100644
--- a/src/oauth2.c
+++ b/src/oauth2.c
@@ -45,8 +45,8 @@
 
 static gchar *OAUTH2info[4][17]={
   {"accounts.google.com",
-   "G/jjil7/XHfv4mw90hhhFy5hRci8NeOF3w7QtX8hb9yljE+mU0/MvGk3G4RoUWK13phSIZ7+JSSg4R2f1RV2NbaT5DODMMt5",
-   "cABm8Lx5PgnrUOOwNJSamcG8Nlj8g8go",
+   "",
+   ".",
    "urn:ietf:wg:oauth:2.0:oob",
    "/o/oauth2/auth",
    "/o/oauth2/token",
@@ -62,7 +62,7 @@ static gchar *OAUTH2info[4][17]={
    "",
    ""},
   {"login.microsoftonline.com",
-   "Srm4tajDIHKiu25KIxOlaqei+AJ8q/DPT7PNOhskKrzIjlGT",
+   "",
    "",
    "https://login.microsoftonline.com/common/oauth2/nativeclient",
    "/common/oauth2/v2.0/authorize",
@@ -79,7 +79,7 @@ static gchar *OAUTH2info[4][17]={
    "fragment",
    ""},
   {"login.microsoftonline.com",
-   "Srm4tajDIHKiu25KIxOlaqei+AJ8q/DPT7PNOhskKrzIjlGT",
+   "",
    "",
    "https://login.microsoftonline.com/common/oauth2/nativeclient",
    "/common/oauth2/v2.0/authorize",
@@ -96,8 +96,8 @@ static gchar *OAUTH2info[4][17]={
    "fragment",
    ""},
   {"api.login.yahoo.com",
-   "TTzJciHB9+id6C5eZ1lhRQJVGy8GNYh+iXh8nhiD3cofx5zi4xHLN7Y/IWASKh4Oy7cghOQCs8Q1kmKB2xRWlKP8/fFNXSBFNYpni83PHGUUKgbTYJUz+3/nLLOJASYf",
-   "T/PyRkrw/ByaZ8mkn6aISpsXhci/fieo+ibj1aRkkqhUKqPKeeH7Xg==",
+   "",
+   ".",
    "oob",
    "/oauth2/request_auth",
    "/oauth2/get_token",
@@ -518,10 +518,8 @@ gint oauth2_check_passwds (PrefsAccount *ac_prefs)
 
 	oauth2_init (OAUTH2Data);
 
-	if (ac_prefs->oauth2_use_custom_id) {
-	  OAUTH2Data->custom_client_id = ac_prefs->oauth2_cust_client_id;
-	  OAUTH2Data->custom_client_secret = ac_prefs->oauth2_cust_client_secret;
-	}
+	OAUTH2Data->custom_client_id = ac_prefs->oauth2_client_id;
+	OAUTH2Data->custom_client_secret = ac_prefs->oauth2_client_secret;
 	
 	if(passwd_store_has_password(PWS_ACCOUNT, uid, PWS_ACCOUNT_OAUTH2_EXPIRY)) {
 	  expiry = atoi(passwd_store_get_account(ac_prefs->account_id, PWS_ACCOUNT_OAUTH2_EXPIRY));
diff --git a/src/prefs_account.c b/src/prefs_account.c
index 1e5f7edd9..a587db2c0 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -212,12 +212,11 @@ typedef struct Oauth2Page
 	GtkWidget *oauth2_deauthorise_btn;
 	GtkWidget *oauth2_authcode_entry;
 	GtkWidget *oauth2_auth_optmenu;	
- 	GtkWidget *oauth2_link_button;
- 	GtkWidget *oauth2_link_copy_button;
+	GtkWidget *oauth2_link_button;
+	GtkWidget *oauth2_link_copy_button;
         gpointer *protocol_optmenu;
-        GtkWidget *oauth2_customid_checkbtn;
-        GtkWidget *oauth2_cust_client_id_entry;
-        GtkWidget *oauth2_cust_client_secret_entry;
+	GtkWidget *oauth2_client_id_entry;
+	GtkWidget *oauth2_client_secret_entry;
 
 } Oauth2Page;
 
@@ -665,15 +664,11 @@ static PrefParam oauth2_param[] = {
 	{"oauth2_authcode", NULL, &tmp_ac_prefs.oauth2_authcode, P_PASSWORD,
 	 NULL, NULL, NULL},
 
-	{"oauth2_use_custom_id", "FALSE", &tmp_ac_prefs.oauth2_use_custom_id, P_BOOL,
-	 &oauth2_page.oauth2_customid_checkbtn,
-	 prefs_set_data_from_toggle, prefs_set_toggle},
-
-	{"oauth2_cust_client_id", NULL, &tmp_ac_prefs.oauth2_cust_client_id, P_STRING,
-	 &oauth2_page.oauth2_cust_client_id_entry, prefs_set_data_from_entry, prefs_set_entry},
+	{"oauth2_client_id", NULL, &tmp_ac_prefs.oauth2_client_id, P_STRING,
+	 &oauth2_page.oauth2_client_id_entry, prefs_set_data_from_entry, prefs_set_entry},
 
-	{"oauth2_cust_client_secret", NULL, &tmp_ac_prefs.oauth2_cust_client_secret, P_STRING,
-	 &oauth2_page.oauth2_cust_client_secret_entry, prefs_set_data_from_entry, prefs_set_entry},
+	{"oauth2_client_secret", NULL, &tmp_ac_prefs.oauth2_client_secret, P_STRING,
+	 &oauth2_page.oauth2_client_secret_entry, prefs_set_data_from_entry, prefs_set_entry},
 
 	{NULL, NULL, NULL, P_OTHER, NULL, NULL, NULL}
 };
@@ -2220,11 +2215,10 @@ static void oauth2_create_widget_func(PrefsPage * _page,
 	GtkWidget *label;
 	GtkWidget *oauth2_authcode_entry;
 	GtkWidget *oauth2_auth_optmenu;
-        GtkWidget *oauth2_link_button;
-        GtkWidget *oauth2_link_copy_button;
-	GtkWidget *oauth2_customid_checkbtn;
-	GtkWidget *oauth2_cust_client_id_entry;
-	GtkWidget *oauth2_cust_client_secret_entry;
+	GtkWidget *oauth2_link_button;
+	GtkWidget *oauth2_link_copy_button;
+	GtkWidget *oauth2_client_id_entry;
+	GtkWidget *oauth2_client_secret_entry;
 	GtkWidget *table1;
 	GtkListStore *menu;
 	GtkTreeIter iter;
@@ -2282,9 +2276,6 @@ static void oauth2_create_widget_func(PrefsPage * _page,
 	gtk_widget_show (vbox3);
 	gtk_box_pack_start (GTK_BOX (auth_vbox), vbox3, FALSE, FALSE, 0);
 
-	PACK_CHECK_BUTTON (vbox3, oauth2_customid_checkbtn,
-			   _("Use custom client details"));
-
 	vbox2 = gtk_vbox_new (FALSE, 0);
 	gtk_widget_show (vbox2);
 	gtk_box_pack_start (GTK_BOX (vbox3), vbox2, FALSE, FALSE, 0);
@@ -2308,15 +2299,15 @@ static void oauth2_create_widget_func(PrefsPage * _page,
 			  GTK_FILL, 0, 0, 0);
 	gtk_misc_set_alignment (GTK_MISC (label), 1, 0.5);
 
-	oauth2_cust_client_id_entry = gtk_entry_new ();
-	gtk_widget_show (oauth2_cust_client_id_entry);
-	gtk_table_attach (GTK_TABLE (table1), oauth2_cust_client_id_entry, 1, 2, 0, 1,
+	oauth2_client_id_entry = gtk_entry_new ();
+	gtk_widget_show (oauth2_client_id_entry);
+	gtk_table_attach (GTK_TABLE (table1), oauth2_client_id_entry, 1, 2, 0, 1,
 			  GTK_EXPAND | GTK_SHRINK | GTK_FILL,
 			  GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 
-	oauth2_cust_client_secret_entry = gtk_entry_new ();
-	gtk_widget_show (oauth2_cust_client_secret_entry);
-	gtk_table_attach (GTK_TABLE (table1), oauth2_cust_client_secret_entry, 1, 2, 1, 2,
+	oauth2_client_secret_entry = gtk_entry_new ();
+	gtk_widget_show (oauth2_client_secret_entry);
+	gtk_table_attach (GTK_TABLE (table1), oauth2_client_secret_entry, 1, 2, 1, 2,
 			  GTK_EXPAND | GTK_SHRINK | GTK_FILL,
 			  GTK_EXPAND | GTK_SHRINK | GTK_FILL, 0, 0);
 
@@ -2325,8 +2316,6 @@ static void oauth2_create_widget_func(PrefsPage * _page,
 	gtk_box_pack_start (GTK_BOX (hbox), hbox_spc, FALSE, FALSE, 0);
 	gtk_widget_set_size_request (hbox_spc, 12, -1);
 
-	SET_TOGGLE_SENSITIVITY (oauth2_customid_checkbtn, vbox2);
-
 	hbox_spc = gtk_hbox_new (FALSE, 0);
 	gtk_widget_show (hbox_spc);
 	gtk_box_pack_start (GTK_BOX (vbox2), hbox_spc, FALSE, FALSE, 0);
@@ -2390,9 +2379,8 @@ static void oauth2_create_widget_func(PrefsPage * _page,
 	page->oauth2_auth_optmenu = oauth2_auth_optmenu;
 	page->protocol_optmenu = (gpointer)protocol_optmenu;
 	page->oauth2_authorise_btn = oauth2_authorise_btn;
-	page->oauth2_customid_checkbtn = oauth2_customid_checkbtn;
-	page->oauth2_cust_client_id_entry = oauth2_cust_client_id_entry;
-	page->oauth2_cust_client_secret_entry = oauth2_cust_client_secret_entry;
+	page->oauth2_client_id_entry = oauth2_client_id_entry;
+	page->oauth2_client_secret_entry = oauth2_client_secret_entry;
 	page->vbox = vbox1;
 	page->page.widget = vbox1;
 	page->oauth2_sensitive = vbox3;
@@ -5148,8 +5136,7 @@ static void prefs_account_oauth2_copy_url(GtkButton *button, gpointer data)
 	
 	service = combobox_get_active_data(GTK_COMBO_BOX(optmenu));
 	
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(oauth2_page.oauth2_customid_checkbtn)) == TRUE)
-	  custom_client_id = gtk_entry_get_text ((GtkEntry *)oauth2_page.oauth2_cust_client_id_entry);
+	custom_client_id = gtk_entry_get_text ((GtkEntry *)oauth2_page.oauth2_client_id_entry);
 	
 	oauth2_authorisation_url(service, &url, custom_client_id);
 	
@@ -5181,12 +5168,10 @@ static void prefs_account_oauth2_obtain_tokens(GtkButton *button, gpointer data)
 
 	oauth2_init (OAUTH2Data);
 
-	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(oauth2_page.oauth2_customid_checkbtn)) == TRUE){
-	  OAUTH2Data->custom_client_secret = 
-	    g_strdup(gtk_entry_get_text ((GtkEntry *)oauth2_page.oauth2_cust_client_secret_entry));
-	  OAUTH2Data->custom_client_id = 
-	    g_strdup(gtk_entry_get_text ((GtkEntry *)oauth2_page.oauth2_cust_client_id_entry));
-	}
+	OAUTH2Data->custom_client_secret = 
+		g_strdup(gtk_entry_get_text((GtkEntry *)oauth2_page.oauth2_client_secret_entry));
+	OAUTH2Data->custom_client_id = 
+		g_strdup(gtk_entry_get_text((GtkEntry *)oauth2_page.oauth2_client_id_entry));
 
 	service = combobox_get_active_data(GTK_COMBO_BOX(optmenu));
 	ret = oauth2_obtain_tokens (service, OAUTH2Data, trim_text);
diff --git a/src/prefs_account.h b/src/prefs_account.h
index 3d6266760..539dfd9e5 100644
--- a/src/prefs_account.h
+++ b/src/prefs_account.h
@@ -137,12 +137,11 @@ struct _PrefsAccount
 	GSList *customhdr_list;
 
         /* OAuth2 */
-        gint oauth2_provider;
-        gint oauth2_date;
-        gchar *oauth2_authcode;
-        gboolean oauth2_use_custom_id;
-        gchar *oauth2_cust_client_id;
-        gchar *oauth2_cust_client_secret;
+	gint oauth2_provider;
+	gint oauth2_date;
+	gchar *oauth2_authcode;
+	gchar *oauth2_client_id;
+	gchar *oauth2_client_secret;
 
 	/* Compose */
 	SigType sig_type;

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list