mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
IMAP: logout from the server with a LOGOUT command
CLOSE, which was used previously, only expunges messages and deselects folder, and it should only be called if some folder is selected. For that, Imap.close_folder() method is used.
This commit is contained in:
committed by
holger krekel
parent
554160db15
commit
f5156f3df6
@@ -314,9 +314,15 @@ impl Imap {
|
||||
}
|
||||
|
||||
async fn unsetup_handle(&mut self, context: &Context) {
|
||||
// Close folder if messages should be expunged
|
||||
if let Err(err) = self.close_folder(context).await {
|
||||
warn!(context, "failed to close folder: {:?}", err);
|
||||
}
|
||||
|
||||
// Logout from the server
|
||||
if let Some(mut session) = self.session.take() {
|
||||
if let Err(err) = session.close().await {
|
||||
warn!(context, "failed to close connection: {:?}", err);
|
||||
if let Err(err) = session.logout().await {
|
||||
warn!(context, "failed to logout: {:?}", err);
|
||||
}
|
||||
}
|
||||
self.connected = false;
|
||||
|
||||
@@ -27,7 +27,7 @@ impl Imap {
|
||||
///
|
||||
/// CLOSE is considerably faster than an EXPUNGE, see
|
||||
/// https://tools.ietf.org/html/rfc3501#section-6.4.2
|
||||
async fn close_folder(&mut self, context: &Context) -> Result<()> {
|
||||
pub(super) async fn close_folder(&mut self, context: &Context) -> Result<()> {
|
||||
if let Some(ref folder) = self.config.selected_folder {
|
||||
info!(context, "Expunge messages in \"{}\".", folder);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user