From c0cbcd19c7475b060037d2b4682631b79fb9eb02 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Sat, 23 Oct 2021 17:48:49 -0600 Subject: * When alpine is authenticating using the XOAUTH2 method, servers will close the connection if the user takes too long to set it up. Closing the connection might confuse a user, making them believe that the process failed, just to find the next time they open the folder that alll is working well. With this modification alpine will silently reopen the connection to the server after the server closes it, and not report that the folder was closed, making it look as if the connection was never closed and reopened. --- pith/mailcmd.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'pith/mailcmd.c') diff --git a/pith/mailcmd.c b/pith/mailcmd.c index e5e70e02..c53afeb4 100644 --- a/pith/mailcmd.c +++ b/pith/mailcmd.c @@ -786,12 +786,26 @@ do_broach_folder(char *newfolder, CONTEXT_S *new_context, MAILSTREAM **streamp, openmode | (open_inbox ? SP_INBOX : 0), &rflags); + if(m == NULL + && ps_global->in_xoauth2_auth + && ps_global->preserve_password){ + ps_global->in_xoauth2_auth = ps_global->user_says_cancel = ps_global->preserve_password = 0; + m = context_open((new_context && !open_inbox) ? new_context : NULL, + stream, + open_inbox ? ps_global->VAR_INBOX_PATH : expanded_file, + openmode | (open_inbox ? SP_INBOX : 0), + &rflags); + } + /* * We aren't in a situation where we want a single cancel to * apply to multiple opens. */ ps_global->user_says_cancel = 0; + /* we are not in authentication mode anymore */ + ps_global->preserve_password = ps_global->in_xoauth2_auth = 0; + if(streamp) *streamp = m; -- cgit v1.2.3-54-g00ecf