[haiku-commits] BRANCH axeld-github.imap - src/add-ons/mail_daemon/inbound_protocols/imap

  • From: axeld-github.imap <community@xxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 16 Feb 2013 00:00:55 +0100 (CET)

added 1 changeset to branch 'refs/remotes/axeld-github/imap'
old head: 3c3383e3b1917d10bf6d259f65ba4f57dde7aa61
new head: d6ae76ba37539ab57ff26a379375f46dfe34f2b8
overview: https://github.com/axeld/haiku/compare/3c3383e...d6ae76b

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

d6ae76b: imap: added Settings::MaxConnections()/IdleMode().
  
  * Also made use of the new BMessage API for the existing methods.

                                   [ Axel Dörfler <axeld@xxxxxxxxxxxxxxxx> ]

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

Commit:      d6ae76ba37539ab57ff26a379375f46dfe34f2b8
Author:      Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
Date:        Wed Jan 23 19:27:45 2013 UTC

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

2 files changed, 20 insertions(+), 19 deletions(-)
.../inbound_protocols/imap/Settings.cpp          | 36 +++++++++-----------
.../inbound_protocols/imap/Settings.h            |  3 ++

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

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 c647e41..5c44c72 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.cpp
@@ -31,11 +31,7 @@ Settings::ServerAddress() const
 BString
 Settings::Server() const
 {
-       BString server;
-       if (fMessage.FindString("server", &server) == B_OK)
-               return server;
-
-       return "";
+       return fMessage.GetString("server", "");
 }
 
 
@@ -53,22 +49,14 @@ Settings::Port() const
 bool
 Settings::UseSSL() const
 {
-       int32 flavor;
-       if (fMessage.FindInt32("flavor", &flavor) == B_OK)
-               return flavor == 1;
-
-       return false;
+       return fMessage.GetInt32("flavor", 1) == 1;
 }
 
 
 BString
 Settings::Username() const
 {
-       BString username;
-       if (fMessage.FindString("username", &username) == B_OK)
-               return username;
-
-       return "";
+       return fMessage.GetString("username", "");
 }
 
 
@@ -90,9 +78,19 @@ Settings::Password() const
 BPath
 Settings::Destination() const
 {
-       BString destination;
-       if (fMessage.FindString("destination", &destination) == B_OK)
-               return BPath(destination);
+       return BPath(fMessage.GetString("destination", "/boot/home/mail/in"));
+}
+
 
-       return "/boot/home/mail/in";
+int32
+Settings::MaxConnections() const
+{
+       return fMessage.GetInt32("max connections", 1);
+}
+
+
+bool
+Settings::IdleMode() const
+{
+       return fMessage.GetBool("idle", true);
 }
diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.h 
b/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.h
index db49290..cb3f2cc 100644
--- a/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.h
+++ b/src/add-ons/mail_daemon/inbound_protocols/imap/Settings.h
@@ -27,6 +27,9 @@ public:
 
                        BPath                           Destination() const;
 
+                       int32                           MaxConnections() const;
+                       bool                            IdleMode() const;
+
 private:
                        const BMessage          fMessage;
 };


Other related posts: