imap: added Settings::MaxConnections()/IdleMode().

* Also made use of the new BMessage API for the existing methods.
This commit is contained in:
Axel Dörfler
2015-01-06 15:24:51 +01:00
parent f8b5e17a23
commit c67313f3c3
2 changed files with 21 additions and 20 deletions
@@ -31,11 +31,7 @@ Settings::ServerAddress() const
BString BString
Settings::Server() const Settings::Server() const
{ {
BString server; return fMessage.GetString("server", "");
if (fMessage.FindString("server", &server) == B_OK)
return server;
return "";
} }
@@ -53,22 +49,14 @@ Settings::Port() const
bool bool
Settings::UseSSL() const Settings::UseSSL() const
{ {
int32 flavor; return fMessage.GetInt32("flavor", 1) == 1;
if (fMessage.FindInt32("flavor", &flavor) == B_OK)
return flavor == 1;
return false;
} }
BString BString
Settings::Username() const Settings::Username() const
{ {
BString username; return fMessage.GetString("username", "");
if (fMessage.FindString("username", &username) == B_OK)
return username;
return "";
} }
@@ -90,9 +78,19 @@ Settings::Password() const
BPath BPath
Settings::Destination() const Settings::Destination() const
{ {
BString destination; return BPath(fMessage.GetString("destination", "/boot/home/mail/in"));
if (fMessage.FindString("destination", &destination) == B_OK) }
return BPath(destination);
return "/boot/home/mail/in"; int32
Settings::MaxConnections() const
{
return fMessage.GetInt32("max connections", 1);
}
bool
Settings::IdleMode() const
{
return fMessage.GetBool("idle", true);
} }
@@ -27,6 +27,9 @@ public:
BPath Destination() const; BPath Destination() const;
int32 MaxConnections() const;
bool IdleMode() const;
private: private:
const BMessage fMessage; const BMessage fMessage;
}; };