[haiku-commits] haiku: hrev52503 - src/add-ons/mail_daemon/inbound_protocols/imap

  • From: stippi@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 5 Nov 2018 12:30:14 -0500 (EST)

hrev52503 adds 1 changeset to branch 'master'
old head: 7c96721b517166d42a50f2dae481002272d6295a
new head: eef12cec97f96546a18c596fcfd5a07fb760b2df
overview: 
https://git.haiku-os.org/haiku/log/?qt=range&q=eef12cec97f9+%5E7c96721b5171

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

eef12cec97f9: mail_daemon: IMAP delete messages on the server only when 
delete_remote_when_local setting is set
  
  Change-Id: I88fcc7a185cede080af7c3b85f9466a02f895809
  Reviewed-on: https://review.haiku-os.org/674
  Reviewed-by: Stephan Aßmus <superstippi@xxxxxx>

                                         [ Peter Kosyh <p.kosyh@xxxxxxxxx> ]

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

Revision:    hrev52503
Commit:      eef12cec97f96546a18c596fcfd5a07fb760b2df
URL:         https://git.haiku-os.org/haiku/commit/?id=eef12cec97f9
Author:      Peter Kosyh <p.kosyh@xxxxxxxxx>
Date:        Mon Nov  5 13:18:39 2018 UTC
Committer:   Stephan Aßmus <superstippi@xxxxxx>
Commit-Date: Mon Nov  5 17:30:09 2018 UTC

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

3 files changed, 11 insertions(+), 3 deletions(-)
src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp | 3 ++-
src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h | 5 +++--
src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp   | 6 ++++++

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

diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp 
b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp
index 8b882c28ca..ec0cdfac37 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPFolder.cpp
@@ -247,7 +247,8 @@ IMAPFolder::SyncMessageFlags(uint32 uid, uint32 
mailboxFlags)
                        // The message does not exist anymore locally, delete 
it on the
                        // server
                        // TODO: copy it to the trash directory first!
-                       fProtocol.UpdateMessageFlags(*this, uid, 
IMAP::kDeleted);
+                       if (fProtocol.Settings()->DeleteRemoteWhenLocal())
+                               fProtocol.UpdateMessageFlags(*this, uid, 
IMAP::kDeleted);
                        return;
                }
                if (status == B_OK)
diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h 
b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h
index 0f89ae4b8a..24bf46fc2d 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/IMAPProtocol.h
@@ -49,6 +49,7 @@ public:
                                                                        
read_flags flags = B_READ);
 
        virtual void                            MessageReceived(BMessage* 
message);
+       const ::Settings*                       Settings() const { return 
&fSettings; };
 
 protected:
        virtual status_t                        HandleFetchBody(const 
entry_ref& ref,
@@ -66,7 +67,7 @@ protected:
        typedef std::map<IMAPFolder*, IMAPConnectionWorker*> WorkerMap;
        typedef std::map<ino_t, IMAPFolder*> FolderNodeMap;
 
-                       Settings                        fSettings;
+                       ::Settings                      fSettings;
                        mutex                           fWorkerLock;
                        BObjectList<IMAPConnectionWorker> fWorkers;
                        WorkerMap                       fWorkerMap;
@@ -75,4 +76,4 @@ protected:
 };
 
 
-#endif // IMAP_PROTOCOL_H
+#endif // IMAP_PROTOCOL_H
\ No newline at end of file
diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp 
b/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp
index 397d95128c..f77e9bd881 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp
@@ -108,3 +108,9 @@ Settings::BodyFetchLimit() const
 {
        return fMessage.GetInt32("partial_download_limit", -1);
 }
+
+bool
+Settings::DeleteRemoteWhenLocal() const
+{
+       return fMessage.FindBool("delete_remote_when_local");
+}


Other related posts:

  • » [haiku-commits] haiku: hrev52503 - src/add-ons/mail_daemon/inbound_protocols/imap - stippi