From c67313f3c37605d888e1be78880db418f9866a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 23 Jan 2013 20:27:45 +0100 Subject: [PATCH] imap: added Settings::MaxConnections()/IdleMode(). * Also made use of the new BMessage API for the existing methods. --- .../inbound_protocols/imap/Settings.cpp | 38 +++++++++---------- .../inbound_protocols/imap/Settings.h | 3 ++ 2 files changed, 21 insertions(+), 20 deletions(-) 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 c647e416a2..5c44c72554 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 "/boot/home/mail/in"; + return BPath(fMessage.GetString("destination", "/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 db49290821..cb3f2cc28e 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; };