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 2013-01-23 20:27:45 +01:00
parent f8b5e17a23
commit c67313f3c3
2 changed files with 21 additions and 20 deletions

View File

@ -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);
}

View File

@ -27,6 +27,9 @@ public:
BPath Destination() const;
int32 MaxConnections() const;
bool IdleMode() const;
private:
const BMessage fMessage;
};