[haiku-commits] r41077 - in haiku/trunk: headers/os/mail src/kits/mail src/servers/mail

  • From: clemens.zeidler@xxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 22 Mar 2011 11:28:22 +0100 (CET)

Author: czeidler
Date: 2011-03-22 11:28:22 +0100 (Tue, 22 Mar 2011)
New Revision: 41077
Changeset: https://dev.haiku-os.org/changeset/41077

Modified:
   haiku/trunk/headers/os/mail/MailSettings.h
   haiku/trunk/src/kits/mail/MailSettings.cpp
   haiku/trunk/src/servers/mail/MailDaemon.cpp
Log:
Add settings to enable and disable in and outgoing mail accounts.



Modified: haiku/trunk/headers/os/mail/MailSettings.h
===================================================================
--- haiku/trunk/headers/os/mail/MailSettings.h  2011-03-22 03:05:39 UTC (rev 
41076)
+++ haiku/trunk/headers/os/mail/MailSettings.h  2011-03-22 10:28:22 UTC (rev 
41077)
@@ -164,6 +164,11 @@
                        bool                            HasInbound();
                        bool                            HasOutbound();
 
+                       void                            SetInboundEnabled(bool 
enabled = true);
+                       bool                            IsInboundEnabled() 
const;
+                       void                            SetOutboundEnabled(bool 
enabled = true);
+                       bool                            IsOutboundEnabled() 
const;
+
                        status_t                        Reload();
                        status_t                        Save();
                        status_t                        Delete();
@@ -186,6 +191,9 @@
                        MailAddonSettings       fInboundSettings;
                        MailAddonSettings       fOutboundSettings;
 
+                       bool                            fInboundEnabled;
+                       bool                            fOutboundEnabled;
+
                        bool                            fModified;
 };
 

Modified: haiku/trunk/src/kits/mail/MailSettings.cpp
===================================================================
--- haiku/trunk/src/kits/mail/MailSettings.cpp  2011-03-22 03:05:39 UTC (rev 
41076)
+++ haiku/trunk/src/kits/mail/MailSettings.cpp  2011-03-22 10:28:22 UTC (rev 
41077)
@@ -611,6 +611,8 @@
 BMailAccountSettings::BMailAccountSettings()
        :
        fStatus(B_OK),
+       fInboundEnabled(true),
+       fOutboundEnabled(true),
        fModified(true)
 {
        fAccountID = real_time_clock();
@@ -772,6 +774,36 @@
 }
 
 
+void
+BMailAccountSettings::SetInboundEnabled(bool enabled)
+{
+       fInboundEnabled = enabled;
+       fModified = true;
+}
+
+
+bool
+BMailAccountSettings::IsInboundEnabled() const
+{
+       return fInboundEnabled;
+}
+
+
+void
+BMailAccountSettings::SetOutboundEnabled(bool enabled)
+{
+       fOutboundEnabled = enabled;
+       fModified = true;
+}
+
+
+bool
+BMailAccountSettings::IsOutboundEnabled() const
+{
+       return fOutboundEnabled;
+}
+
+
 status_t
 BMailAccountSettings::Reload()
 {
@@ -796,6 +828,11 @@
        settings.FindMessage("outbound", &outboundSettings);
        fOutboundSettings.Load(outboundSettings);
 
+       if (settings.FindBool("inbound_enabled", &fInboundEnabled) != B_OK)
+               fInboundEnabled = true;
+       if (settings.FindBool("outbound_enabled", &fOutboundEnabled) != B_OK)
+               fOutboundEnabled = true;
+
        fModified = false;
        return B_OK;
 }
@@ -819,6 +856,9 @@
        fOutboundSettings.Save(outboundSettings);
        settings.AddMessage("outbound", &outboundSettings);
 
+       settings.AddBool("inbound_enabled", fInboundEnabled);
+       settings.AddBool("outbound_enabled", fOutboundEnabled);
+
        status_t status = _CreateAccountFilePath();
        if (status != B_OK)
                return status;

Modified: haiku/trunk/src/servers/mail/MailDaemon.cpp
===================================================================
--- haiku/trunk/src/servers/mail/MailDaemon.cpp 2011-03-22 03:05:39 UTC (rev 
41076)
+++ haiku/trunk/src/servers/mail/MailDaemon.cpp 2011-03-22 10:28:22 UTC (rev 
41077)
@@ -223,8 +223,13 @@
 MailDaemonApp::_InitAccount(BMailAccountSettings& settings)
 {
        account_protocols account;
-       account.inboundProtocol = _CreateInboundProtocol(settings,
-               account.inboundImage);
+       // inbound
+       if (settings.IsInboundEnabled()) {
+               account.inboundProtocol = _CreateInboundProtocol(settings,
+                       account.inboundImage);
+       } else {
+               account.inboundProtocol = NULL;
+       }
        if (account.inboundProtocol) {
                DefaultNotifier* notifier = new 
DefaultNotifier(settings.Name(), true,
                        fErrorLogWindow, fMailStatusWindow);
@@ -235,8 +240,13 @@
                account.inboundThread->Run();
        }
 
-       account.outboundProtocol = _CreateOutboundProtocol(settings,
-               account.outboundImage);
+       // outbound
+       if (settings.IsOutboundEnabled()) {
+               account.outboundProtocol = _CreateOutboundProtocol(settings,
+                       account.outboundImage);
+       } else {
+               account.outboundProtocol = NULL;
+       }
        if (account.outboundProtocol) {
                DefaultNotifier* notifier = new 
DefaultNotifier(settings.Name(), false,
                        fErrorLogWindow, fMailStatusWindow);


Other related posts:

  • » [haiku-commits] r41077 - in haiku/trunk: headers/os/mail src/kits/mail src/servers/mail - clemens . zeidler