mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Added more JMAP info
This commit is contained in:
parent
21eaf88fd9
commit
fd6dc611bb
5 changed files with 54 additions and 15 deletions
|
|
@ -67,7 +67,7 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
|
||||||
Subscribe: folder.isSubscribed() ? 1 : 0
|
Subscribe: folder.isSubscribed() ? 1 : 0
|
||||||
})
|
})
|
||||||
.then(data => {
|
.then(data => {
|
||||||
folder.name(nameToEdit/*data.Name*/);
|
folder.name(nameToEdit/*data.name*/);
|
||||||
if (folder.subFolders.length) {
|
if (folder.subFolders.length) {
|
||||||
Remote.setTrigger(FolderUserStore.foldersLoading, true);
|
Remote.setTrigger(FolderUserStore.foldersLoading, true);
|
||||||
// clearTimeout(Remote.foldersTimeout);
|
// clearTimeout(Remote.foldersTimeout);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ trait ACL
|
||||||
*/
|
*/
|
||||||
public function ACLAllow(string $sFolderName, string $command) : bool
|
public function ACLAllow(string $sFolderName, string $command) : bool
|
||||||
{
|
{
|
||||||
if ($this->IsSupported('ACL') || $this->IsSupported('RIGHTS=texk')) {
|
if ($this->IsSupported('ACL') || $this->CapabilityValue('RIGHTS')) {
|
||||||
if ('MYRIGHTS' === $command) {
|
if ('MYRIGHTS' === $command) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -128,6 +128,7 @@ trait ACL
|
||||||
|
|
||||||
public function FolderMyRights(string $sFolderName) : ?ACLResponse
|
public function FolderMyRights(string $sFolderName) : ?ACLResponse
|
||||||
{
|
{
|
||||||
|
// if ($this->ACLAllow($sFolderName, 'MYRIGHTS')) {
|
||||||
// if ($this->IsSupported('ACL')) {
|
// if ($this->IsSupported('ACL')) {
|
||||||
$oResponses = $this->SendRequestGetResponse('MYRIGHTS', array($this->EscapeString($sFolderName)));
|
$oResponses = $this->SendRequestGetResponse('MYRIGHTS', array($this->EscapeString($sFolderName)));
|
||||||
foreach ($oResponses as $oResponse) {
|
foreach ($oResponses as $oResponse) {
|
||||||
|
|
|
||||||
|
|
@ -280,6 +280,18 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
return $this->aCapabilityItems;
|
return $this->aCapabilityItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function CapabilityValue(string $sExtentionName) : ?string
|
||||||
|
{
|
||||||
|
$sExtentionName = \trim($sExtentionName) . '=';
|
||||||
|
$aCapabilities = $this->Capability() ?: [];
|
||||||
|
foreach ($aCapabilities as $string) {
|
||||||
|
if (\str_starts_with($string, $sExtentionName)) {
|
||||||
|
return \substr($string, \strlen($sExtentionName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private function setCapabilities(ResponseCollection $oResponseCollection) : void
|
private function setCapabilities(ResponseCollection $oResponseCollection) : void
|
||||||
{
|
{
|
||||||
$aList = $oResponseCollection->getCapabilityResult();
|
$aList = $oResponseCollection->getCapabilityResult();
|
||||||
|
|
@ -375,14 +387,8 @@ class ImapClient extends \MailSo\Net\NetClient
|
||||||
*/
|
*/
|
||||||
public function AppendLimit() : ?int
|
public function AppendLimit() : ?int
|
||||||
{
|
{
|
||||||
if ($this->Capability()) {
|
$string = $this->CapabilityValue('APPENDLIMIT');
|
||||||
foreach ($this->aCapabilityItems as $string) {
|
return \is_null($string) ? null : (int) $string;
|
||||||
if ('APPENDLIMIT=' === \substr($string, 0, 12)) {
|
|
||||||
return (int) \substr($string, 12);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ class Folder implements \JsonSerializable
|
||||||
return $this->oImapFolder->IsInbox();
|
return $this->oImapFolder->IsInbox();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetFolderListType() : int
|
public function GetType() : int
|
||||||
{
|
{
|
||||||
$aFlags = $this->oImapFolder->FlagsLowerCase();
|
$aFlags = $this->oImapFolder->FlagsLowerCase();
|
||||||
// RFC 6154
|
// RFC 6154
|
||||||
|
|
@ -205,10 +205,24 @@ class Folder implements \JsonSerializable
|
||||||
// 'Hash' => $this->Hash($this->MailClient()->GenerateImapClientHash())
|
// 'Hash' => $this->Hash($this->MailClient()->GenerateImapClientHash())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
$types = [
|
||||||
|
FolderType::INBOX => 'inbox',
|
||||||
|
FolderType::ALL => 'all',
|
||||||
|
FolderType::ARCHIVE => 'archive',
|
||||||
|
FolderType::DRAFTS => 'drafts',
|
||||||
|
FolderType::FLAGGED => 'flagged',
|
||||||
|
FolderType::IMPORTANT => 'important',
|
||||||
|
FolderType::JUNK => 'junk',
|
||||||
|
FolderType::SENT => 'sent',
|
||||||
|
FolderType::TRASH => 'trash',
|
||||||
|
];
|
||||||
|
$type = $this->GetType();
|
||||||
*/
|
*/
|
||||||
return array(
|
return array(
|
||||||
'@Object' => 'Object/Folder',
|
'@Object' => 'Object/Folder',
|
||||||
'Name' => $this->Name(),
|
'name' => $this->Name(),
|
||||||
'FullName' => $this->FullName(),
|
'FullName' => $this->FullName(),
|
||||||
'Delimiter' => (string) $this->Delimiter(),
|
'Delimiter' => (string) $this->Delimiter(),
|
||||||
'isSubscribed' => $this->bSubscribed,
|
'isSubscribed' => $this->bSubscribed,
|
||||||
|
|
@ -219,10 +233,28 @@ class Folder implements \JsonSerializable
|
||||||
// 'PermanentFlags' => $this->oImapFolder->PermanentFlags,
|
// 'PermanentFlags' => $this->oImapFolder->PermanentFlags,
|
||||||
'Metadata' => $this->oImapFolder->Metadata(),
|
'Metadata' => $this->oImapFolder->Metadata(),
|
||||||
'UidNext' => $this->oImapFolder->UIDNEXT,
|
'UidNext' => $this->oImapFolder->UIDNEXT,
|
||||||
// RFC 8621
|
// https://datatracker.ietf.org/doc/html/rfc8621#section-2
|
||||||
'totalEmails' => $this->oImapFolder->MESSAGES,
|
'totalEmails' => $this->oImapFolder->MESSAGES,
|
||||||
'unreadEmails' => $this->oImapFolder->UNSEEN,
|
'unreadEmails' => $this->oImapFolder->UNSEEN,
|
||||||
'id' => $this->oImapFolder->MAILBOXID
|
'id' => $this->oImapFolder->MAILBOXID,
|
||||||
|
/*
|
||||||
|
'role' => isset($types[$type]) ? $types[$type] : null,
|
||||||
|
|
||||||
|
if ($this->IsSupported('ACL') || $this->CapabilityValue('RIGHTS')) {
|
||||||
|
$rights = $this->FolderMyRights($this->FullName());
|
||||||
|
}
|
||||||
|
'myRights' => [
|
||||||
|
'mayReadItems' => !$rights || ($rights->hasRight('l') && $rights->hasRight('r')),
|
||||||
|
'mayAddItems' => !$rights || $rights->hasRight('i'),
|
||||||
|
'mayRemoveItems' => !$rights || ($rights->hasRight('t') && $rights->hasRight('e')),
|
||||||
|
'maySetSeen' => !$rights || $rights->hasRight('s'),
|
||||||
|
'maySetKeywords' => !$rights || $rights->hasRight('w'),
|
||||||
|
'mayCreateChild' => !$rights || $rights->hasRight('k'),
|
||||||
|
'mayRename' => !$rights || $rights->hasRight('x'),
|
||||||
|
'mayDelete' => !$rights || $rights->hasRight('x'),
|
||||||
|
'maySubmit' => !$rights || $rights->hasRight('p')
|
||||||
|
]
|
||||||
|
*/
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ trait Folders
|
||||||
{
|
{
|
||||||
foreach ($oFolders as $oFolder)
|
foreach ($oFolders as $oFolder)
|
||||||
{
|
{
|
||||||
$iFolderType = $oFolder->GetFolderListType();
|
$iFolderType = $oFolder->GetType();
|
||||||
if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
|
if (!isset($aResult[$iFolderType]) && \in_array($iFolderType, array(
|
||||||
FolderType::INBOX,
|
FolderType::INBOX,
|
||||||
FolderType::SENT,
|
FolderType::SENT,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue