diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-09-29 20:37:53 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-09-29 21:00:02 +0300 |
commit | a0c3f8f4ee8a835a57985d46e7531e21cbc7706e (patch) | |
tree | 22f68108a1bf8beede5f3769b13bba91c9acdb23 /lib/IMAP | |
parent | 839788a9892febc38728843dfc89c3c94e2d4403 (diff) |
Add a CLI command to export all threading data
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/IMAP')
-rw-r--r-- | lib/IMAP/Threading/DatabaseMessage.php | 13 | ||||
-rw-r--r-- | lib/IMAP/Threading/Message.php | 11 |
2 files changed, 22 insertions, 2 deletions
diff --git a/lib/IMAP/Threading/DatabaseMessage.php b/lib/IMAP/Threading/DatabaseMessage.php index d85654a4f..d36001885 100644 --- a/lib/IMAP/Threading/DatabaseMessage.php +++ b/lib/IMAP/Threading/DatabaseMessage.php @@ -25,9 +25,11 @@ declare(strict_types=1); namespace OCA\Mail\IMAP\Threading; +use JsonSerializable; +use function array_merge; use function json_decode; -class DatabaseMessage extends Message { +class DatabaseMessage extends Message implements JsonSerializable { /** @var int */ private $databaseId; @@ -88,4 +90,13 @@ class DatabaseMessage extends Message { public function isDirty(): bool { return $this->dirty; } + + public function jsonSerialize(): array { + return array_merge( + parent::jsonSerialize(), + [ + 'databaseId' => $this->databaseId, + ] + ); + } } diff --git a/lib/IMAP/Threading/Message.php b/lib/IMAP/Threading/Message.php index 7b3684963..8fd7170ae 100644 --- a/lib/IMAP/Threading/Message.php +++ b/lib/IMAP/Threading/Message.php @@ -25,10 +25,11 @@ declare(strict_types=1); namespace OCA\Mail\IMAP\Threading; +use JsonSerializable; use function str_replace; use function strpos; -class Message { +class Message implements JsonSerializable { /** @var string */ private $subject; @@ -72,4 +73,12 @@ class Message { public function getReferences(): array { return $this->references; } + + public function jsonSerialize(): array { + return [ + 'subject' => $this->subject, + 'id' => $this->id, + 'references' => $this->references, + ]; + } } |