Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-09-04 18:05:19 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-09-05 14:45:50 +0300
commitd18ef16578dc34ffd67e48bc5c61654e55461ce9 (patch)
tree0fb85d03cba26c56be550b2cba5072dd6aca4e91 /lib/Events
parenteec81c6c38259c0edc843018581a1f1bd1ab280a (diff)
Move message sending and draft saving code
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/Events')
-rw-r--r--lib/Events/DraftSavedEvent.php62
-rw-r--r--lib/Events/MessageSentEvent.php92
-rw-r--r--lib/Events/SaveDraftEvent.php62
3 files changed, 216 insertions, 0 deletions
diff --git a/lib/Events/DraftSavedEvent.php b/lib/Events/DraftSavedEvent.php
new file mode 100644
index 000000000..79a385530
--- /dev/null
+++ b/lib/Events/DraftSavedEvent.php
@@ -0,0 +1,62 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Mail\Events;
+
+use OCA\Mail\Account;
+use OCA\Mail\Model\NewMessageData;
+use OCP\EventDispatcher\Event;
+
+class DraftSavedEvent extends Event {
+
+ /** @var Account */
+ private $account;
+
+ /** @var NewMessageData */
+ private $newMessageData;
+
+ /** @var int|null */
+ private $draftUid;
+
+ public function __construct(Account $account,
+ NewMessageData $newMessageData,
+ ?int $draftUid) {
+ parent::__construct();
+ $this->account = $account;
+ $this->newMessageData = $newMessageData;
+ $this->draftUid = $draftUid;
+ }
+
+ public function getAccount(): Account {
+ return $this->account;
+ }
+
+ public function getNewMessageData(): NewMessageData {
+ return $this->newMessageData;
+ }
+
+ public function getDraftUid(): ?int {
+ return $this->draftUid;
+ }
+
+}
diff --git a/lib/Events/MessageSentEvent.php b/lib/Events/MessageSentEvent.php
new file mode 100644
index 000000000..755079a3a
--- /dev/null
+++ b/lib/Events/MessageSentEvent.php
@@ -0,0 +1,92 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Mail\Events;
+
+use Horde_Mime_Mail;
+use OCA\Mail\Account;
+use OCA\Mail\Model\IMessage;
+use OCA\Mail\Model\NewMessageData;
+use OCA\Mail\Model\RepliedMessageData;
+use OCP\EventDispatcher\Event;
+
+class MessageSentEvent extends Event {
+
+ /** @var Account */
+ private $account;
+
+ /** @var NewMessageData */
+ private $newMessageData;
+
+ /** @var RepliedMessageData */
+ private $repliedMessageData;
+
+ /** @var int|null */
+ private $draftUid;
+
+ /** @var IMessage */
+ private $message;
+
+ /** @var Horde_Mime_Mail */
+ private $mail;
+
+ public function __construct(Account $account,
+ NewMessageData $newMessageData,
+ RepliedMessageData $repliedMessageData,
+ ?int $draftUid,
+ IMessage $message,
+ Horde_Mime_Mail $mail) {
+ parent::__construct();
+ $this->account = $account;
+ $this->newMessageData = $newMessageData;
+ $this->repliedMessageData = $repliedMessageData;
+ $this->draftUid = $draftUid;
+ $this->message = $message;
+ $this->mail = $mail;
+ }
+
+ public function getAccount(): Account {
+ return $this->account;
+ }
+
+ public function getNewMessageData(): NewMessageData {
+ return $this->newMessageData;
+ }
+
+ public function getRepliedMessageData(): RepliedMessageData {
+ return $this->repliedMessageData;
+ }
+
+ public function getDraftUid(): ?int {
+ return $this->draftUid;
+ }
+
+ public function getMessage(): IMessage {
+ return $this->message;
+ }
+
+ public function getMail(): Horde_Mime_Mail {
+ return $this->mail;
+ }
+
+}
diff --git a/lib/Events/SaveDraftEvent.php b/lib/Events/SaveDraftEvent.php
new file mode 100644
index 000000000..699a63ae7
--- /dev/null
+++ b/lib/Events/SaveDraftEvent.php
@@ -0,0 +1,62 @@
+<?php declare(strict_types=1);
+
+/**
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Mail\Events;
+
+use OCA\Mail\Account;
+use OCA\Mail\Model\NewMessageData;
+use OCP\EventDispatcher\Event;
+
+class SaveDraftEvent extends Event {
+
+ /** @var Account */
+ private $account;
+
+ /** @var NewMessageData */
+ private $newMessageData;
+
+ /** @var int|null */
+ private $draftUid;
+
+ public function __construct(Account $account,
+ NewMessageData $newMessageData,
+ ?int $draftUid) {
+ parent::__construct();
+ $this->account = $account;
+ $this->newMessageData = $newMessageData;
+ $this->draftUid = $draftUid;
+ }
+
+ public function getAccount(): Account {
+ return $this->account;
+ }
+
+ public function getNewMessageData(): NewMessageData {
+ return $this->newMessageData;
+ }
+
+ public function getDraftUid(): ?int {
+ return $this->draftUid;
+ }
+
+}