[Commits] [SCM] claws branch, gtk2, updated. 3.19.0-43-g65da44cd9

mones at claws-mail.org mones at claws-mail.org
Wed Jun 8 23:14:11 UTC 2022


The branch, gtk2 has been updated
       via  65da44cd9c4b265c914c17f1c2c222b297f7c443 (commit)
      from  1d816bb15001d193b9680b2e624a35dfeedd7191 (commit)

Summary of changes:
 src/prefs_account.c | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)


- Log -----------------------------------------------------------------
commit 65da44cd9c4b265c914c17f1c2c222b297f7c443
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu Jun 9 01:13:07 2022 +0200

    Make OAuth2 displayed results translatable…
    
    …and remove artificial limits to accommodate translations.

diff --git a/src/prefs_account.c b/src/prefs_account.c
index 0f82fb653..d08ed5bb8 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -6144,8 +6144,10 @@ static void prefs_account_oauth2_listener(GTask *task, gpointer source, gpointer
 	int client_sock, c;
 	struct sockaddr_in server , client;
 	char client_message[2000];
-	char reply[600];
-	char reply_message[400];
+	char *reply;
+	char *reply_message;
+	char *title;
+	char *body;
 	fd_set rfds;
 	gint ret = 1;
 	struct timeval timeout;
@@ -6210,15 +6212,23 @@ static void prefs_account_oauth2_listener(GTask *task, gpointer source, gpointer
 
 			if(!ret){
 				oauth2_listener_data->success = TRUE;
-				sprintf(reply_message, "<html><body><h1>Authorisation complete</h1><p>Your oauth2 authorisation code has been received by Claws Mail</p></body></html>");
+				title = _("Authorisation complete");
+				body = _("Your OAuth2 authorisation code has been received by Claws Mail");
 			}else{
 				//Something went wrong
-				log_message(LOG_PROTOCOL, "oauth2 authorisation code not received\n");
-				sprintf(reply_message, "<html><body><h1>Authorisation NOT completed</h1><p>Your authorisation code was not received by Claws Mail</p></body></html>");
+				title = _("Authorisation NOT completed");
+				body = _("Your OAuth2 authorisation code was not received by Claws Mail");
+				log_message(LOG_PROTOCOL, "OAuth2 authorisation code not received\n");
 			}
-
-			sprintf(reply, "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Length: %lu\r\n\r\n%s", strlen(reply_message), reply_message);
+			reply_message = g_strconcat("<html><head><title>", title,
+					"</title><meta charset=\"utf-8\"></head><body><h1>", title,
+					"</h1><p>", body, "</p></body></html>", NULL);
+			reply = g_strdup_printf(
+					"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\nContent-Length: %lu\r\n\r\n%s",
+					strlen(reply_message), reply_message);
+			g_free(reply_message);
 			write(client_sock, reply, strlen(reply));
+			g_free(reply);
 			close(client_sock);
 		}
 	}while(ret && !oauth2_listener_cancel);

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list