summaryrefslogtreecommitdiff
path: root/manager/library/imap/imapParseAction.php
diff options
context:
space:
mode:
authorMarkus Warg <mw@it-sls.de>2010-04-14 15:20:40 +0200
committerMarkus Warg <mw@it-sls.de>2010-04-14 15:20:40 +0200
commitae053ad0371d46f529a26c2a18953189620b88e4 (patch)
treeaad5ebb03e7138647f950be8960c3f7c84df0020 /manager/library/imap/imapParseAction.php
parentd09a673644f87ee067f62f3de978cb046a02c7a8 (diff)
downloadcacert-mgr-ae053ad0371d46f529a26c2a18953189620b88e4.tar.gz
cacert-mgr-ae053ad0371d46f529a26c2a18953189620b88e4.tar.xz
cacert-mgr-ae053ad0371d46f529a26c2a18953189620b88e4.zip
imap class / mail controller
add imap class to access captured emails add mail controller to framework (display content)
Diffstat (limited to 'manager/library/imap/imapParseAction.php')
-rw-r--r--manager/library/imap/imapParseAction.php96
1 files changed, 96 insertions, 0 deletions
diff --git a/manager/library/imap/imapParseAction.php b/manager/library/imap/imapParseAction.php
new file mode 100644
index 0000000..d9e3fb0
--- /dev/null
+++ b/manager/library/imap/imapParseAction.php
@@ -0,0 +1,96 @@
+<?php
+/**
+ * @author markus
+ * $Id: $
+ */
+
+/**
+ * required files
+ * @ignore
+ */
+require_once('exception.IMAPException.php');
+
+/**
+ * Supportklasse für imapCleanMailbox
+ * Soll den in der Config pro Mailbox angegebenen Action-String auswerten
+ * und in eine automatisiert weiterverarbeitbare Form bringen.
+ */
+class imapParseAction {
+ /**
+ * Actions als Konstanten
+ * @var integer
+ */
+ const IMAP_ACTION_DELETE = 1;
+ const IMAP_ACTION_ARCHIVE = 2;
+
+ /**
+ * gesetzte Action
+ * @var integer
+ */
+ private $action = 0;
+
+ /**
+ * Modifikator keep gesetzt?
+ * @var boolean
+ */
+ private $delete_keep = false;
+
+ /**
+ * Wert des Modifikators keep
+ * @var integer
+ */
+ private $delete_keep_num = 0;
+
+ /**
+ * getAction
+ * @return integer
+ */
+ public function getAction() {
+ return $this->action;
+ }
+
+ /**
+ * getDeleteKeep
+ * @return boolean
+ */
+ public function getDeleteKeep() {
+ return $this->delete_keep;
+ }
+
+ /**
+ * getDeleteKeepNum
+ * @return integer
+ */
+ public function getDeleteKeepNum() {
+ return $this->delete_keep_num;
+ }
+
+ /**
+ * Konstruktor, parst eine Zeile mit Tokens und ermittelt, welche Aktionen
+ * auf einer Mailbox ausgeführt werden sollen
+ * @param string $action
+ */
+ public function __construct($action) {
+ $args = explode(' ', $action);
+
+ $numargs = count($args);
+
+ for ($arg = 0; $arg < $numargs; $arg++) {
+ switch ($args[$arg]) {
+ case 'delete':
+ $this->action = self::IMAP_ACTION_DELETE;
+ break;
+ case 'keep':
+ $arg++;
+ $this->delete_keep = true;
+ $this->delete_keep_num = $args[$arg];
+ break;
+ default:
+ /**
+ * @todo Exception werfen
+ */
+ break;
+ }
+ }
+ }
+}