mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Enable detection of some Kolab 'mail.*' folder types
This commit is contained in:
parent
d534d2700a
commit
524cafe689
2 changed files with 44 additions and 33 deletions
|
|
@ -29,6 +29,9 @@ abstract class FolderType
|
||||||
const ARCHIVE = 12;
|
const ARCHIVE = 12;
|
||||||
const ALL = 13;
|
const ALL = 13;
|
||||||
|
|
||||||
|
// TODO: SnappyMail
|
||||||
|
const TEMPLATES = 19;
|
||||||
|
|
||||||
// Kolab
|
// Kolab
|
||||||
const CONFIGURATION = 20;
|
const CONFIGURATION = 20;
|
||||||
const CALENDAR = 21;
|
const CALENDAR = 21;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
namespace MailSo\Mail;
|
namespace MailSo\Mail;
|
||||||
|
|
||||||
|
use MailSo\Imap\Enumerations\FolderType;
|
||||||
use MailSo\Imap\Enumerations\MetadataKeys;
|
use MailSo\Imap\Enumerations\MetadataKeys;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -195,76 +196,83 @@ class Folder implements \JsonSerializable
|
||||||
switch (true)
|
switch (true)
|
||||||
{
|
{
|
||||||
case \in_array('\\inbox', $aFlags) || 'INBOX' === \strtoupper($this->FullNameRaw()):
|
case \in_array('\\inbox', $aFlags) || 'INBOX' === \strtoupper($this->FullNameRaw()):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::INBOX;
|
return FolderType::INBOX;
|
||||||
|
|
||||||
case \in_array('\\sent', $aFlags):
|
case \in_array('\\sent', $aFlags):
|
||||||
case \in_array('\\sentmail', $aFlags):
|
case \in_array('\\sentmail', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::SENT;
|
return FolderType::SENT;
|
||||||
|
|
||||||
case \in_array('\\drafts', $aFlags):
|
case \in_array('\\drafts', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
return FolderType::DRAFTS;
|
||||||
|
|
||||||
case \in_array('\\junk', $aFlags):
|
case \in_array('\\junk', $aFlags):
|
||||||
case \in_array('\\spam', $aFlags):
|
case \in_array('\\spam', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::JUNK;
|
return FolderType::JUNK;
|
||||||
|
|
||||||
case \in_array('\\trash', $aFlags):
|
case \in_array('\\trash', $aFlags):
|
||||||
case \in_array('\\bin', $aFlags):
|
case \in_array('\\bin', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::TRASH;
|
return FolderType::TRASH;
|
||||||
|
|
||||||
case \in_array('\\important', $aFlags):
|
case \in_array('\\important', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::IMPORTANT;
|
return FolderType::IMPORTANT;
|
||||||
|
|
||||||
case \in_array('\\flagged', $aFlags):
|
case \in_array('\\flagged', $aFlags):
|
||||||
case \in_array('\\starred', $aFlags):
|
case \in_array('\\starred', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::FLAGGED;
|
return FolderType::FLAGGED;
|
||||||
|
|
||||||
case \in_array('\\archive', $aFlags):
|
case \in_array('\\archive', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::ARCHIVE;
|
return FolderType::ARCHIVE;
|
||||||
|
|
||||||
case \in_array('\\all', $aFlags):
|
case \in_array('\\all', $aFlags):
|
||||||
case \in_array('\\allmail', $aFlags):
|
case \in_array('\\allmail', $aFlags):
|
||||||
return \MailSo\Imap\Enumerations\FolderType::ALL;
|
return FolderType::ALL;
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// case 'Templates' === $this->FullNameRaw():
|
// case 'Templates' === $this->FullNameRaw():
|
||||||
// return \MailSo\Imap\Enumerations\FolderType::TEMPLATES;
|
// return FolderType::TEMPLATES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Kolab
|
||||||
// TODO: Kolab
|
|
||||||
$type = $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED);
|
$type = $this->GetMetadata(MetadataKeys::KOLAB_CTYPE) ?: $this->GetMetadata(MetadataKeys::KOLAB_CTYPE_SHARED);
|
||||||
switch (($type && 0 !== \strpos($type, 'mail.')) ? $type : null)
|
switch ($type)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
// TODO: Kolab
|
||||||
case 'event':
|
case 'event':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::CALENDAR;
|
case 'event.default':
|
||||||
|
return FolderType::CALENDAR;
|
||||||
case 'contact':
|
case 'contact':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::CONTACTS;
|
case 'contact.default':
|
||||||
|
return FolderType::CONTACTS;
|
||||||
case 'task':
|
case 'task':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::TASKS;
|
case 'task.default':
|
||||||
|
return FolderType::TASKS;
|
||||||
case 'note':
|
case 'note':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::NOTES;
|
case 'note.default':
|
||||||
|
return FolderType::NOTES;
|
||||||
case 'file':
|
case 'file':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::FILES;
|
case 'file.default':
|
||||||
|
return FolderType::FILES;
|
||||||
case 'configuration':
|
case 'configuration':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::CONFIGURATION;
|
return FolderType::CONFIGURATION;
|
||||||
case 'journal':
|
case 'journal':
|
||||||
return \MailSo\Imap\Enumerations\FolderType::JOURNAL;
|
case 'journal.default':
|
||||||
case 'mail.inbox':
|
return FolderType::JOURNAL;
|
||||||
return \MailSo\Imap\Enumerations\FolderType::INBOX;
|
|
||||||
case 'mail.drafts':
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::DRAFTS;
|
|
||||||
case 'mail.sentitems':
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::SENT;
|
|
||||||
case 'mail.wastebasket':
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::TRASH;
|
|
||||||
// case 'mail.outbox':
|
|
||||||
case 'mail.junkemail':
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::JUNK;
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
case 'mail.inbox':
|
||||||
|
return FolderType::INBOX;
|
||||||
|
// case 'mail.outbox':
|
||||||
|
case 'mail.sentitems':
|
||||||
|
return FolderType::SENT;
|
||||||
|
case 'mail.drafts':
|
||||||
|
return FolderType::DRAFTS;
|
||||||
|
case 'mail.junkemail':
|
||||||
|
return FolderType::JUNK;
|
||||||
|
case 'mail.wastebasket':
|
||||||
|
return FolderType::TRASH;
|
||||||
|
}
|
||||||
|
|
||||||
return \MailSo\Imap\Enumerations\FolderType::USER;
|
return FolderType::USER;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue