summaryrefslogtreecommitdiff
path: root/src/maildir-select.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/maildir-select.cc')
-rw-r--r--src/maildir-select.cc45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/maildir-select.cc b/src/maildir-select.cc
new file mode 100644
index 0000000..78daf9d
--- /dev/null
+++ b/src/maildir-select.cc
@@ -0,0 +1,45 @@
+/** --------------------------------------------------------------------
+ * @file maildir-select.cc
+ * @brief Implementation of the Maildir class.
+ * @author Andreas Aardal Hanssen
+ * @date Andreas Aardal Hanssen
+ * ----------------------------------------------------------------- **/
+#include "maildir.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+using namespace ::std;
+using namespace Binc;
+
+//------------------------------------------------------------------------
+bool Binc::Maildir::selectMailbox(const std::string &name,
+ const std::string &s_in)
+{
+ setName(name);
+
+ if (selected) {
+ closeMailbox();
+ selected = false;
+ }
+
+ oldrecent = 0;
+ oldexists = 0;
+
+ mailboxchanged = false;
+
+ setPath(s_in);
+
+ switch (scan()) {
+ case Success:
+ break;
+ case TemporaryError:
+ if (scan() == Success)
+ break;
+ case PermanentError:
+ return false;
+ }
+
+ selected = true;
+ return true;
+}