mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
IMAP UID is integer
This commit is contained in:
parent
9ffc90946c
commit
96e2e6576c
20 changed files with 124 additions and 139 deletions
|
|
@ -121,18 +121,17 @@ export const
|
||||||
* @param {string} folder
|
* @param {string} folder
|
||||||
* @param {number=} page = 1
|
* @param {number=} page = 1
|
||||||
* @param {string=} search = ''
|
* @param {string=} search = ''
|
||||||
* @param {string=} threadUid = ''
|
* @param {number=} threadUid = 0
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
mailBox = (folder, page = 1, search = '', threadUid = '') => {
|
mailBox = (folder, page = 1, search = '', threadUid = 0) => {
|
||||||
page = pInt(page, 1);
|
page = pInt(page, 1);
|
||||||
search = pString(search);
|
search = pString(search);
|
||||||
|
|
||||||
let result = HASH_PREFIX + 'mailbox/';
|
let result = HASH_PREFIX + 'mailbox/';
|
||||||
|
|
||||||
if (folder) {
|
if (folder) {
|
||||||
const resultThreadUid = pInt(threadUid);
|
result += encodeURI(folder) + (threadUid ? '~' + threadUid : '');
|
||||||
result += encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (1 < page) {
|
if (1 < page) {
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ export class MessageModel extends AbstractModel {
|
||||||
|
|
||||||
_reset() {
|
_reset() {
|
||||||
this.folder = '';
|
this.folder = '';
|
||||||
this.uid = '';
|
this.uid = 0;
|
||||||
this.hash = '';
|
this.hash = '';
|
||||||
this.requestHash = '';
|
this.requestHash = '';
|
||||||
this.externalProxy = false;
|
this.externalProxy = false;
|
||||||
|
|
@ -188,9 +188,8 @@ export class MessageModel extends AbstractModel {
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
revivePropertiesFromJson(json) {
|
revivePropertiesFromJson(json) {
|
||||||
if ('Priority' in json) {
|
if ('Priority' in json && ![MessagePriority.High, MessagePriority.Low].includes(json.Priority)) {
|
||||||
let p = parseInt(json.Priority, 10);
|
json.Priority = MessagePriority.Normal;
|
||||||
json.Priority = MessagePriority.High == p || MessagePriority.Low == p ? p : MessagePriority.Normal;
|
|
||||||
}
|
}
|
||||||
if (super.revivePropertiesFromJson(json)) {
|
if (super.revivePropertiesFromJson(json)) {
|
||||||
// this.foundedCIDs = isArray(json.FoundedCIDs) ? json.FoundedCIDs : [];
|
// this.foundedCIDs = isArray(json.FoundedCIDs) ? json.FoundedCIDs : [];
|
||||||
|
|
|
||||||
|
|
@ -239,7 +239,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
inboxUidNext = getFolderInboxName() === sFolderFullNameRaw ? getFolderUidNext(sFolderFullNameRaw) : '';
|
inboxUidNext = getFolderInboxName() === sFolderFullNameRaw ? getFolderUidNext(sFolderFullNameRaw) : '';
|
||||||
|
|
||||||
params.Folder = sFolderFullNameRaw;
|
params.Folder = sFolderFullNameRaw;
|
||||||
params.ThreadUid = useThreads ? params.ThreadUid : '';
|
params.ThreadUid = useThreads ? params.ThreadUid : 0;
|
||||||
params = Object.assign({
|
params = Object.assign({
|
||||||
Folder: '',
|
Folder: '',
|
||||||
Offset: 0,
|
Offset: 0,
|
||||||
|
|
@ -247,7 +247,7 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
Search: '',
|
Search: '',
|
||||||
UidNext: inboxUidNext,
|
UidNext: inboxUidNext,
|
||||||
UseThreads: useThreads,
|
UseThreads: useThreads,
|
||||||
ThreadUid: '',
|
ThreadUid: 0,
|
||||||
Sort: FolderUserStore.sortMode()
|
Sort: FolderUserStore.sortMode()
|
||||||
}, params);
|
}, params);
|
||||||
|
|
||||||
|
|
@ -385,8 +385,8 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
if (request) {
|
if (request) {
|
||||||
this.defaultRequest(fCallback, 'FolderInformation', {
|
this.defaultRequest(fCallback, 'FolderInformation', {
|
||||||
Folder: folder,
|
Folder: folder,
|
||||||
FlagsUids: isArray(uids) ? uids.join(',') : '',
|
FlagsUids: isArray(uids) ? uids : [],
|
||||||
UidNext: getFolderInboxName() === folder ? getFolderUidNext(folder) : ''
|
UidNext: getFolderInboxName() === folder ? getFolderUidNext(folder) : 0
|
||||||
});
|
});
|
||||||
} else if (SettingsUserStore.useThreads()) {
|
} else if (SettingsUserStore.useThreads()) {
|
||||||
rl.app.reloadFlagsCurrentMessageListAndMessageFromCache();
|
rl.app.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||||
|
|
@ -463,15 +463,15 @@ class RemoteUserFetch extends AbstractFetchRemote {
|
||||||
/**
|
/**
|
||||||
* @param {?Function} fCallback
|
* @param {?Function} fCallback
|
||||||
* @param {string} sMessageFolder
|
* @param {string} sMessageFolder
|
||||||
* @param {string} sMessageUid
|
* @param {number} iMessageUid
|
||||||
* @param {string} sReadReceipt
|
* @param {string} sReadReceipt
|
||||||
* @param {string} sSubject
|
* @param {string} sSubject
|
||||||
* @param {string} sText
|
* @param {string} sText
|
||||||
*/
|
*/
|
||||||
sendReadReceiptMessage(fCallback, sMessageFolder, sMessageUid, sReadReceipt, sSubject, sText) {
|
sendReadReceiptMessage(fCallback, sMessageFolder, iMessageUid, sReadReceipt, sSubject, sText) {
|
||||||
this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
|
this.defaultRequest(fCallback, 'SendReadReceiptMessage', {
|
||||||
MessageFolder: sMessageFolder,
|
MessageFolder: sMessageFolder,
|
||||||
MessageUid: sMessageUid,
|
MessageUid: iMessageUid,
|
||||||
ReadReceipt: sReadReceipt,
|
ReadReceipt: sReadReceipt,
|
||||||
Subject: sSubject,
|
Subject: sSubject,
|
||||||
Text: sText
|
Text: sText
|
||||||
|
|
|
||||||
|
|
@ -63,16 +63,13 @@ export class MailBoxUserScreen extends AbstractScreen {
|
||||||
onRoute(folderHash, page, search) {
|
onRoute(folderHash, page, search) {
|
||||||
const folder = getFolderFromCacheList(getFolderFullNameRaw(folderHash.replace(/~([\d]+)$/, '')));
|
const folder = getFolderFromCacheList(getFolderFullNameRaw(folderHash.replace(/~([\d]+)$/, '')));
|
||||||
if (folder) {
|
if (folder) {
|
||||||
let threadUid = folderHash.replace(/^.+~([\d]+)$/, '$1');
|
let threadUid = folderHash.replace(/^.+~(\d+)$/, '$1');
|
||||||
if (folderHash === threadUid) {
|
|
||||||
threadUid = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderUserStore.currentFolder(folder);
|
FolderUserStore.currentFolder(folder);
|
||||||
|
|
||||||
MessageUserStore.listPage(1 > page ? 1 : page);
|
MessageUserStore.listPage(1 > page ? 1 : page);
|
||||||
MessageUserStore.listSearch(search);
|
MessageUserStore.listSearch(search);
|
||||||
MessageUserStore.listThreadUid(threadUid);
|
MessageUserStore.listThreadUid((folderHash === threadUid) ? 0 : pInt(threadUid));
|
||||||
|
|
||||||
rl.app.reloadMessageList();
|
rl.app.reloadMessageList();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -77,14 +77,14 @@ export const MessageUserStore = new class {
|
||||||
addObservablesTo(this, {
|
addObservablesTo(this, {
|
||||||
listCount: 0,
|
listCount: 0,
|
||||||
listSearch: '',
|
listSearch: '',
|
||||||
listThreadUid: '',
|
listThreadUid: 0,
|
||||||
listPage: 1,
|
listPage: 1,
|
||||||
listPageBeforeThread: 1,
|
listPageBeforeThread: 1,
|
||||||
listError: '',
|
listError: '',
|
||||||
|
|
||||||
listEndFolder: '',
|
listEndFolder: '',
|
||||||
listEndSearch: '',
|
listEndSearch: '',
|
||||||
listEndThreadUid: '',
|
listEndThreadUid: 0,
|
||||||
listEndPage: 1,
|
listEndPage: 1,
|
||||||
|
|
||||||
listLoading: false,
|
listLoading: false,
|
||||||
|
|
@ -348,11 +348,11 @@ export const MessageUserStore = new class {
|
||||||
if (this.listThreadUid()) {
|
if (this.listThreadUid()) {
|
||||||
if (
|
if (
|
||||||
messageList.length &&
|
messageList.length &&
|
||||||
!!messageList.find(item => !!(item && item.deleted() && item.uid === this.listThreadUid()))
|
!!messageList.find(item => !!(item && item.deleted() && item.uid == this.listThreadUid()))
|
||||||
) {
|
) {
|
||||||
const message = messageList.find(item => item && !item.deleted());
|
const message = messageList.find(item => item && !item.deleted());
|
||||||
if (message && this.listThreadUid() !== pString(message.uid)) {
|
if (message && this.listThreadUid() != message.uid) {
|
||||||
this.listThreadUid(pString(message.uid));
|
this.listThreadUid(message.uid);
|
||||||
|
|
||||||
rl.route.setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
|
|
@ -379,7 +379,7 @@ export const MessageUserStore = new class {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
this.listThreadUid('');
|
this.listThreadUid(0);
|
||||||
|
|
||||||
rl.route.setHash(
|
rl.route.setHash(
|
||||||
mailBox(
|
mailBox(
|
||||||
|
|
@ -437,7 +437,7 @@ export const MessageUserStore = new class {
|
||||||
message.folder === json.Folder
|
message.folder === json.Folder
|
||||||
) {
|
) {
|
||||||
const threads = message.threads();
|
const threads = message.threads();
|
||||||
if (message.uid !== json.Uid && 1 < threads.length && threads.includes(json.Uid)) {
|
if (message.uid != json.Uid && 1 < threads.length && threads.includes(json.Uid)) {
|
||||||
message = oMessage ? null : MessageModel.reviveFromJson(json);
|
message = oMessage ? null : MessageModel.reviveFromJson(json);
|
||||||
if (message) {
|
if (message) {
|
||||||
message.threads(threads);
|
message.threads(threads);
|
||||||
|
|
@ -450,7 +450,7 @@ export const MessageUserStore = new class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message && message.uid === json.Uid) {
|
if (message && message.uid == json.Uid) {
|
||||||
oMessage || this.messageError('');
|
oMessage || this.messageError('');
|
||||||
|
|
||||||
if (cached) {
|
if (cached) {
|
||||||
|
|
@ -565,7 +565,7 @@ export const MessageUserStore = new class {
|
||||||
if (
|
if (
|
||||||
selectedMessage &&
|
selectedMessage &&
|
||||||
message &&
|
message &&
|
||||||
(message.folder !== selectedMessage.folder || message.uid !== selectedMessage.uid)
|
(message.folder !== selectedMessage.folder || message.uid != selectedMessage.uid)
|
||||||
) {
|
) {
|
||||||
this.selectorMessageSelected(null);
|
this.selectorMessageSelected(null);
|
||||||
if (1 === this.list.length) {
|
if (1 === this.list.length) {
|
||||||
|
|
@ -576,7 +576,7 @@ export const MessageUserStore = new class {
|
||||||
subMessage =>
|
subMessage =>
|
||||||
subMessage &&
|
subMessage &&
|
||||||
subMessage.folder === message.folder &&
|
subMessage.folder === message.folder &&
|
||||||
subMessage.uid === message.uid
|
subMessage.uid == message.uid
|
||||||
);
|
);
|
||||||
|
|
||||||
if (selectedMessage) {
|
if (selectedMessage) {
|
||||||
|
|
@ -598,11 +598,11 @@ export const MessageUserStore = new class {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectMessageByFolderAndUid(sFolder, sUid) {
|
selectMessageByFolderAndUid(sFolder, iUid) {
|
||||||
if (sFolder && sUid) {
|
if (sFolder && iUid) {
|
||||||
this.message(this.staticMessage.populateByMessageListItem(null));
|
this.message(this.staticMessage.populateByMessageListItem(null));
|
||||||
this.message().folder = sFolder;
|
this.message().folder = sFolder;
|
||||||
this.message().uid = sUid;
|
this.message().uid = iUid;
|
||||||
|
|
||||||
this.populateMessageBody(this.message());
|
this.populateMessageBody(this.message());
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -671,7 +671,7 @@ export const MessageUserStore = new class {
|
||||||
this.listCount(iCount);
|
this.listCount(iCount);
|
||||||
this.listSearch(pString(collection.Search));
|
this.listSearch(pString(collection.Search));
|
||||||
this.listPage(Math.ceil(iOffset / SettingsUserStore.messagesPerPage() + 1));
|
this.listPage(Math.ceil(iOffset / SettingsUserStore.messagesPerPage() + 1));
|
||||||
this.listThreadUid(pString(data.Result.ThreadUid));
|
this.listThreadUid(data.Result.ThreadUid);
|
||||||
|
|
||||||
this.listEndFolder(collection.Folder);
|
this.listEndFolder(collection.Folder);
|
||||||
this.listEndSearch(this.listSearch());
|
this.listEndSearch(this.listSearch());
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
showReplyTo: false,
|
showReplyTo: false,
|
||||||
|
|
||||||
draftFolder: '',
|
draftFolder: '',
|
||||||
draftUid: '',
|
draftUid: 0,
|
||||||
sending: false,
|
sending: false,
|
||||||
saving: false,
|
saving: false,
|
||||||
|
|
||||||
|
|
@ -465,7 +465,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
|
|
||||||
if (this.bFromDraft) {
|
if (this.bFromDraft) {
|
||||||
const message = MessageUserStore.message();
|
const message = MessageUserStore.message();
|
||||||
if (message && this.draftFolder() === message.folder && this.draftUid() === message.uid) {
|
if (message && this.draftFolder() === message.folder && this.draftUid() == message.uid) {
|
||||||
MessageUserStore.message(null);
|
MessageUserStore.message(null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1449,7 +1449,7 @@ class ComposePopupView extends AbstractViewPopup {
|
||||||
this.dragAndDropVisible(false);
|
this.dragAndDropVisible(false);
|
||||||
|
|
||||||
this.draftFolder('');
|
this.draftFolder('');
|
||||||
this.draftUid('');
|
this.draftUid(0);
|
||||||
|
|
||||||
this.sending(false);
|
this.sending(false);
|
||||||
this.saving(false);
|
this.saving(false);
|
||||||
|
|
|
||||||
|
|
@ -216,10 +216,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
);
|
);
|
||||||
|
|
||||||
addEventListener('mailbox.message.show', e => {
|
addEventListener('mailbox.message.show', e => {
|
||||||
const sFolder = e.detail.Folder, sUid = e.detail.Uid;
|
const sFolder = e.detail.Folder, iUid = e.detail.Uid;
|
||||||
|
|
||||||
const message = MessageUserStore.list.find(
|
const message = MessageUserStore.list.find(
|
||||||
item => item && sFolder === item.folder && sUid === item.uid
|
item => item && sFolder === item.folder && iUid == item.uid
|
||||||
);
|
);
|
||||||
|
|
||||||
if ('INBOX' === sFolder) {
|
if ('INBOX' === sFolder) {
|
||||||
|
|
@ -233,7 +233,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
rl.route.setHash(mailBox(sFolder, 1));
|
rl.route.setHash(mailBox(sFolder, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageUserStore.selectMessageByFolderAndUid(sFolder, sUid);
|
MessageUserStore.selectMessageByFolderAndUid(sFolder, iUid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -473,10 +473,10 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
/**
|
/**
|
||||||
* @param {string} sFolderFullNameRaw
|
* @param {string} sFolderFullNameRaw
|
||||||
* @param {number} iSetAction
|
* @param {number} iSetAction
|
||||||
* @param {string} sThreadUid = ''
|
* @param {number} iThreadUid = ''
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
setActionForAll(sFolderFullNameRaw, iSetAction, sThreadUid = '') {
|
setActionForAll(sFolderFullNameRaw, iSetAction, iThreadUid = 0) {
|
||||||
if (sFolderFullNameRaw) {
|
if (sFolderFullNameRaw) {
|
||||||
let cnt = 0;
|
let cnt = 0;
|
||||||
const uids = [];
|
const uids = [];
|
||||||
|
|
@ -496,7 +496,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
uids.push(message.uid);
|
uids.push(message.uid);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (sThreadUid) {
|
if (iThreadUid) {
|
||||||
folder.messageCountUnread(folder.messageCountUnread() - cnt);
|
folder.messageCountUnread(folder.messageCountUnread() - cnt);
|
||||||
if (0 > folder.messageCountUnread()) {
|
if (0 > folder.messageCountUnread()) {
|
||||||
folder.messageCountUnread(0);
|
folder.messageCountUnread(0);
|
||||||
|
|
@ -508,7 +508,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
MessageFlagsCache.clearFolder(sFolderFullNameRaw);
|
MessageFlagsCache.clearFolder(sFolderFullNameRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.messageSetSeenToAll(()=>0, sFolderFullNameRaw, true, sThreadUid ? uids : null);
|
Remote.messageSetSeenToAll(()=>0, sFolderFullNameRaw, true, iThreadUid ? uids : null);
|
||||||
break;
|
break;
|
||||||
case MessageSetAction.UnsetSeen:
|
case MessageSetAction.UnsetSeen:
|
||||||
folder = getFolderFromCacheList(sFolderFullNameRaw);
|
folder = getFolderFromCacheList(sFolderFullNameRaw);
|
||||||
|
|
@ -522,7 +522,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
uids.push(message.uid);
|
uids.push(message.uid);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (sThreadUid) {
|
if (iThreadUid) {
|
||||||
folder.messageCountUnread(folder.messageCountUnread() + cnt);
|
folder.messageCountUnread(folder.messageCountUnread() + cnt);
|
||||||
if (folder.messageCountAll() < folder.messageCountUnread()) {
|
if (folder.messageCountAll() < folder.messageCountUnread()) {
|
||||||
folder.messageCountUnread(folder.messageCountAll());
|
folder.messageCountUnread(folder.messageCountAll());
|
||||||
|
|
@ -534,7 +534,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
MessageFlagsCache.clearFolder(sFolderFullNameRaw);
|
MessageFlagsCache.clearFolder(sFolderFullNameRaw);
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.messageSetSeenToAll(()=>0, sFolderFullNameRaw, false, sThreadUid ? uids : null);
|
Remote.messageSetSeenToAll(()=>0, sFolderFullNameRaw, false, iThreadUid ? uids : null);
|
||||||
break;
|
break;
|
||||||
// no default
|
// no default
|
||||||
}
|
}
|
||||||
|
|
@ -702,15 +702,15 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
|
||||||
|
|
||||||
eqs(event, '.checkboxCheckAll') && this.checkAll(!this.checkAll());
|
eqs(event, '.checkboxCheckAll') && this.checkAll(!this.checkAll());
|
||||||
|
|
||||||
el = eqs(event, '.messageListItem .flagParent');
|
el = eqs(event, '.flagParent');
|
||||||
el && this.flagMessages(ko.dataFor(el));
|
el && this.flagMessages(ko.dataFor(el));
|
||||||
|
|
||||||
el = eqs(event, '.messageListItem .threads-len');
|
el = eqs(event, '.threads-len');
|
||||||
el && this.gotoThread(ko.dataFor(el));
|
el && this.gotoThread(ko.dataFor(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
dom.addEventListener('dblclick', event => {
|
dom.addEventListener('dblclick', event => {
|
||||||
let el = eqs(event, '.messageListItem .actionHandle');
|
let el = eqs(event, '.actionHandle');
|
||||||
el && this.gotoThread(ko.dataFor(el));
|
el && this.gotoThread(ko.dataFor(el));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,9 @@ class FolderInformation
|
||||||
public $Unread = null;
|
public $Unread = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* rfc3501 2.3.1.1
|
||||||
|
* A 32-bit value
|
||||||
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $Uidnext = null;
|
public $Uidnext = null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ class ResponseCollection extends \MailSo\Base\Collection
|
||||||
}
|
}
|
||||||
else if ('UIDNEXT' === $oResponse->OptionalResponse[0])
|
else if ('UIDNEXT' === $oResponse->OptionalResponse[0])
|
||||||
{
|
{
|
||||||
$oResult->Uidnext = $oResponse->OptionalResponse[1];
|
$oResult->Uidnext = (int) $oResponse->OptionalResponse[1];
|
||||||
}
|
}
|
||||||
else if ('HIGHESTMODSEQ' === $oResponse->OptionalResponse[0])
|
else if ('HIGHESTMODSEQ' === $oResponse->OptionalResponse[0])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -560,7 +560,7 @@ class MailClient
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function initFolderValues(string $sFolderName, int &$iCount, int &$iUnseenCount,
|
protected function initFolderValues(string $sFolderName, int &$iCount, int &$iUnseenCount,
|
||||||
string &$sUidNext, int &$iHighestModSeq = 0) : void
|
int &$iUidNext, int &$iHighestModSeq = 0) : void
|
||||||
{
|
{
|
||||||
$aTypes = array(
|
$aTypes = array(
|
||||||
\MailSo\Imap\Enumerations\FolderResponseStatus::MESSAGES,
|
\MailSo\Imap\Enumerations\FolderResponseStatus::MESSAGES,
|
||||||
|
|
@ -579,7 +579,7 @@ class MailClient
|
||||||
|
|
||||||
$iUnseenCount = (int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UNSEEN] ?? 0;
|
$iUnseenCount = (int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UNSEEN] ?? 0;
|
||||||
|
|
||||||
$sUidNext = (string) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT] ?? '0';
|
$iUidNext = (int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::UIDNEXT] ?? 0;
|
||||||
|
|
||||||
$iHighestModSeq = (int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::HIGHESTMODSEQ] ?? 0;
|
$iHighestModSeq = (int) $aFolderStatus[\MailSo\Imap\Enumerations\FolderResponseStatus::HIGHESTMODSEQ] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
@ -593,20 +593,20 @@ class MailClient
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GenerateFolderHash(string $sFolder, int $iCount, int $iUnseenCount, string $sUidNext, int $iHighestModSeq = 0) : string
|
public function GenerateFolderHash(string $sFolder, int $iCount, int $iUnseenCount, int $iUidNext, int $iHighestModSeq = 0) : string
|
||||||
{
|
{
|
||||||
$iUnseenCount = 0; // unneccessery
|
$iUnseenCount = 0; // unneccessery
|
||||||
return \md5('FolderHash/'.$sFolder.'-'.$iCount.'-'.$iUnseenCount.'-'.$sUidNext.'-'.
|
return \md5('FolderHash/'.$sFolder.'-'.$iCount.'-'.$iUnseenCount.'-'.$iUidNext.'-'.
|
||||||
$iHighestModSeq.'-'.$this->GenerateImapClientHash().'-'.
|
$iHighestModSeq.'-'.$this->GenerateImapClientHash().'-'.
|
||||||
\MailSo\Config::$MessageListPermanentFilter
|
\MailSo\Config::$MessageListPermanentFilter
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getFolderNextMessageInformation(string $sFolderName, string $sPrevUidNext, string $sCurrentUidNext) : array
|
private function getFolderNextMessageInformation(string $sFolderName, int $iPrevUidNext, int $iCurrentUidNext) : array
|
||||||
{
|
{
|
||||||
$aNewMessages = array();
|
$aNewMessages = array();
|
||||||
|
|
||||||
if (\strlen($sPrevUidNext) && (string) $sPrevUidNext !== (string) $sCurrentUidNext)
|
if ($iPrevUidNext && $iPrevUidNext != $iCurrentUidNext)
|
||||||
{
|
{
|
||||||
$this->oImapClient->FolderSelect($sFolderName);
|
$this->oImapClient->FolderSelect($sFolderName);
|
||||||
|
|
||||||
|
|
@ -619,7 +619,7 @@ class MailClient
|
||||||
\MailSo\Mime\Enumerations\Header::SUBJECT,
|
\MailSo\Mime\Enumerations\Header::SUBJECT,
|
||||||
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE
|
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE
|
||||||
))
|
))
|
||||||
), $sPrevUidNext.':*', true);
|
), $iPrevUidNext.':*', true);
|
||||||
|
|
||||||
foreach ($aFetchResponse as /* @var $oFetchResponse \MailSo\Imap\FetchResponse */ $oFetchResponse)
|
foreach ($aFetchResponse as /* @var $oFetchResponse \MailSo\Imap\FetchResponse */ $oFetchResponse)
|
||||||
{
|
{
|
||||||
|
|
@ -628,7 +628,7 @@ class MailClient
|
||||||
|
|
||||||
if (!\in_array(\strtolower(\MailSo\Imap\Enumerations\MessageFlag::SEEN), $aFlags))
|
if (!\in_array(\strtolower(\MailSo\Imap\Enumerations\MessageFlag::SEEN), $aFlags))
|
||||||
{
|
{
|
||||||
$sUid = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
$iUid = (int) $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
||||||
$sHeaders = $oFetchResponse->GetHeaderFieldsValue();
|
$sHeaders = $oFetchResponse->GetHeaderFieldsValue();
|
||||||
|
|
||||||
$oHeaders = new \MailSo\Mime\HeaderCollection($sHeaders);
|
$oHeaders = new \MailSo\Mime\HeaderCollection($sHeaders);
|
||||||
|
|
@ -651,7 +651,7 @@ class MailClient
|
||||||
|
|
||||||
$aNewMessages[] = array(
|
$aNewMessages[] = array(
|
||||||
'Folder' => $sFolderName,
|
'Folder' => $sFolderName,
|
||||||
'Uid' => $sUid,
|
'Uid' => $iUid,
|
||||||
'Subject' => $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::SUBJECT, !\strlen($sCharset)),
|
'Subject' => $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::SUBJECT, !\strlen($sCharset)),
|
||||||
'From' => $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::FROM_, !\strlen($sCharset))
|
'From' => $oHeaders->GetAsEmailCollection(\MailSo\Mime\Enumerations\Header::FROM_, !\strlen($sCharset))
|
||||||
);
|
);
|
||||||
|
|
@ -667,7 +667,7 @@ class MailClient
|
||||||
* @throws \MailSo\Net\Exceptions\Exception
|
* @throws \MailSo\Net\Exceptions\Exception
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function FolderInformation(string $sFolderName, string $sPrevUidNext = '', array $aUids = array()) : array
|
public function FolderInformation(string $sFolderName, int $iPrevUidNext = 0, array $aUids = array()) : array
|
||||||
{
|
{
|
||||||
$aFlags = array();
|
$aFlags = array();
|
||||||
|
|
||||||
|
|
@ -688,29 +688,29 @@ class MailClient
|
||||||
|
|
||||||
foreach ($aFetchResponse as $oFetchResponse)
|
foreach ($aFetchResponse as $oFetchResponse)
|
||||||
{
|
{
|
||||||
$sUid = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
$iUid = (int) $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
||||||
$aFlags[(\is_numeric($sUid) ? (int) $sUid : 0)] =
|
$aFlags[$iUid] =
|
||||||
$oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::FLAGS);
|
$oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::FLAGS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$iCount = 0;
|
$iCount = 0;
|
||||||
$iUnseenCount = 0;
|
$iUnseenCount = 0;
|
||||||
$sUidNext = '0';
|
$iUidNext = 0;
|
||||||
$iHighestModSeq = 0;
|
$iHighestModSeq = 0;
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext, $iHighestModSeq);
|
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $iUidNext, $iHighestModSeq);
|
||||||
|
|
||||||
$aResult = array(
|
$aResult = array(
|
||||||
'Folder' => $sFolderName,
|
'Folder' => $sFolderName,
|
||||||
'Hash' => $this->GenerateFolderHash($sFolderName, $iCount, $iUnseenCount, $sUidNext, $iHighestModSeq),
|
'Hash' => $this->GenerateFolderHash($sFolderName, $iCount, $iUnseenCount, $iUidNext, $iHighestModSeq),
|
||||||
'MessageCount' => $iCount,
|
'MessageCount' => $iCount,
|
||||||
'MessageUnseenCount' => $iUnseenCount,
|
'MessageUnseenCount' => $iUnseenCount,
|
||||||
'UidNext' => (int) $sUidNext,
|
'UidNext' => $iUidNext,
|
||||||
'Flags' => $aFlags,
|
'Flags' => $aFlags,
|
||||||
'HighestModSeq' => $iHighestModSeq,
|
'HighestModSeq' => $iHighestModSeq,
|
||||||
'NewMessages' => 'INBOX' === $sFolderName && \MailSo\Config::$CheckNewMessages ?
|
'NewMessages' => 'INBOX' === $sFolderName && \MailSo\Config::$CheckNewMessages ?
|
||||||
$this->getFolderNextMessageInformation($sFolderName, $sPrevUidNext, $sUidNext) : array()
|
$this->getFolderNextMessageInformation($sFolderName, $iPrevUidNext, $iUidNext) : array()
|
||||||
);
|
);
|
||||||
|
|
||||||
return $aResult;
|
return $aResult;
|
||||||
|
|
@ -725,12 +725,12 @@ class MailClient
|
||||||
{
|
{
|
||||||
$iCount = 0;
|
$iCount = 0;
|
||||||
$iUnseenCount = 0;
|
$iUnseenCount = 0;
|
||||||
$sUidNext = '0';
|
$iUidNext = 0;
|
||||||
$iHighestModSeq = 0;
|
$iHighestModSeq = 0;
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $sUidNext, $iHighestModSeq);
|
$this->initFolderValues($sFolderName, $iCount, $iUnseenCount, $iUidNext, $iHighestModSeq);
|
||||||
|
|
||||||
return $this->GenerateFolderHash($sFolderName, $iCount, $iUnseenCount, $sUidNext, $iHighestModSeq);
|
return $this->GenerateFolderHash($sFolderName, $iCount, $iUnseenCount, $iUidNext, $iHighestModSeq);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -1567,9 +1567,9 @@ class MailClient
|
||||||
* @throws \MailSo\Imap\Exceptions\Exception
|
* @throws \MailSo\Imap\Exceptions\Exception
|
||||||
*/
|
*/
|
||||||
public function MessageList(string $sFolderName, int $iOffset = 0, int $iLimit = 10,
|
public function MessageList(string $sFolderName, int $iOffset = 0, int $iLimit = 10,
|
||||||
string $sSearch = '', string $sPrevUidNext = '', ?\MailSo\Cache\CacheClient $oCacher = null,
|
string $sSearch = '', int $iPrevUidNext = 0, ?\MailSo\Cache\CacheClient $oCacher = null,
|
||||||
bool $bUseSortIfSupported = false, bool $bUseThreadSortIfSupported = false,
|
bool $bUseSortIfSupported = false, bool $bUseThreadSortIfSupported = false,
|
||||||
string $sThreadUid = '', string $sFilter = '', string $sSort = '') : MessageCollection
|
int $iThreadUid = 0, string $sFilter = '', string $sSort = '') : MessageCollection
|
||||||
{
|
{
|
||||||
$sFilter = \trim($sFilter);
|
$sFilter = \trim($sFilter);
|
||||||
$sSearch = \trim($sSearch);
|
$sSearch = \trim($sSearch);
|
||||||
|
|
@ -1588,18 +1588,16 @@ class MailClient
|
||||||
$oMessageCollection->Offset = $iOffset;
|
$oMessageCollection->Offset = $iOffset;
|
||||||
$oMessageCollection->Limit = $iLimit;
|
$oMessageCollection->Limit = $iLimit;
|
||||||
$oMessageCollection->Search = $sSearch;
|
$oMessageCollection->Search = $sSearch;
|
||||||
$oMessageCollection->ThreadUid = $sThreadUid;
|
$oMessageCollection->ThreadUid = $iThreadUid;
|
||||||
$oMessageCollection->Filtered = '' !== \MailSo\Config::$MessageListPermanentFilter;
|
$oMessageCollection->Filtered = '' !== \MailSo\Config::$MessageListPermanentFilter;
|
||||||
|
|
||||||
$aUids = array();
|
$aUids = array();
|
||||||
$mAllSortedUids = null;
|
$mAllSortedUids = null;
|
||||||
$mAllThreads = null;
|
$mAllThreads = null;
|
||||||
|
|
||||||
$iThreadUid = empty($sThreadUid) ? 0 : (int) $sThreadUid;
|
|
||||||
|
|
||||||
$iMessageRealCount = 0;
|
$iMessageRealCount = 0;
|
||||||
$iMessageUnseenCount = 0;
|
$iMessageUnseenCount = 0;
|
||||||
$sUidNext = '0';
|
$iUidNext = 0;
|
||||||
$iHighestModSeq = 0;
|
$iHighestModSeq = 0;
|
||||||
|
|
||||||
$bUseSortIfSupported = $bUseSortIfSupported && $this->oImapClient->IsSupported('SORT');
|
$bUseSortIfSupported = $bUseSortIfSupported && $this->oImapClient->IsSupported('SORT');
|
||||||
|
|
@ -1607,7 +1605,7 @@ class MailClient
|
||||||
$bUseThreadSortIfSupported = $bUseThreadSortIfSupported ?
|
$bUseThreadSortIfSupported = $bUseThreadSortIfSupported ?
|
||||||
($this->oImapClient->IsSupported('THREAD=REFS') || $this->oImapClient->IsSupported('THREAD=REFERENCES') || $this->oImapClient->IsSupported('THREAD=ORDEREDSUBJECT')) : false;
|
($this->oImapClient->IsSupported('THREAD=REFS') || $this->oImapClient->IsSupported('THREAD=REFERENCES') || $this->oImapClient->IsSupported('THREAD=ORDEREDSUBJECT')) : false;
|
||||||
|
|
||||||
if (!empty($sThreadUid) && !$bUseThreadSortIfSupported)
|
if ($iThreadUid && !$bUseThreadSortIfSupported)
|
||||||
{
|
{
|
||||||
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
throw new \MailSo\Base\Exceptions\InvalidArgumentException;
|
||||||
}
|
}
|
||||||
|
|
@ -1617,7 +1615,7 @@ class MailClient
|
||||||
$oCacher = null;
|
$oCacher = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->initFolderValues($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext, $iHighestModSeq);
|
$this->initFolderValues($sFolderName, $iMessageRealCount, $iMessageUnseenCount, $iUidNext, $iHighestModSeq);
|
||||||
|
|
||||||
if ($bUseFilter)
|
if ($bUseFilter)
|
||||||
{
|
{
|
||||||
|
|
@ -1625,14 +1623,14 @@ class MailClient
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMessageCollection->FolderHash = $this->GenerateFolderHash(
|
$oMessageCollection->FolderHash = $this->GenerateFolderHash(
|
||||||
$sFolderName, $iMessageRealCount, $iMessageUnseenCount, $sUidNext, $iHighestModSeq);
|
$sFolderName, $iMessageRealCount, $iMessageUnseenCount, $iUidNext, $iHighestModSeq);
|
||||||
|
|
||||||
$oMessageCollection->UidNext = $sUidNext;
|
$oMessageCollection->UidNext = $iUidNext;
|
||||||
|
|
||||||
if (empty($sThreadUid) && \strlen($sPrevUidNext) && 'INBOX' === $sFolderName)
|
if (!$iThreadUid && $iPrevUidNext && 'INBOX' === $sFolderName)
|
||||||
{
|
{
|
||||||
$oMessageCollection->NewMessages = $this->getFolderNextMessageInformation(
|
$oMessageCollection->NewMessages = $this->getFolderNextMessageInformation(
|
||||||
$sFolderName, $sPrevUidNext, $sUidNext);
|
$sFolderName, $iPrevUidNext, $iUidNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
$bSearch = false;
|
$bSearch = false;
|
||||||
|
|
@ -1711,7 +1709,7 @@ class MailClient
|
||||||
{
|
{
|
||||||
$aNewUids[] = $iUid;
|
$aNewUids[] = $iUid;
|
||||||
}
|
}
|
||||||
else if ($bUseThreadSortIfSupported && 0 === $iThreadUid && isset($mAllThreads[$iUid]) && \is_array($mAllThreads[$iUid]))
|
else if ($bUseThreadSortIfSupported && !$iThreadUid && isset($mAllThreads[$iUid]) && \is_array($mAllThreads[$iUid]))
|
||||||
{
|
{
|
||||||
foreach ($mAllThreads[$iUid] as $iSubUid)
|
foreach ($mAllThreads[$iUid] as $iSubUid)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -311,14 +311,12 @@ class Message implements \JsonSerializable
|
||||||
$oBodyStructure = $oFetchResponse->GetFetchBodyStructure();
|
$oBodyStructure = $oFetchResponse->GetFetchBodyStructure();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sUid = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
|
||||||
$sSize = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::RFC822_SIZE);
|
|
||||||
$sInternalDate = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::INTERNALDATE);
|
$sInternalDate = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::INTERNALDATE);
|
||||||
$aFlags = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::FLAGS);
|
$aFlags = $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::FLAGS);
|
||||||
|
|
||||||
$this->sFolder = $sFolder;
|
$this->sFolder = $sFolder;
|
||||||
$this->iUid = \is_numeric($sUid) ? (int) $sUid : 0;
|
$this->iUid = (int) $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::UID);
|
||||||
$this->iSize = \is_numeric($sSize) ? (int) $sSize : 0;
|
$this->iSize = (int) $oFetchResponse->GetFetchValue(\MailSo\Imap\Enumerations\FetchType::RFC822_SIZE);
|
||||||
$this->aFlags = \is_array($aFlags) ? $aFlags : array();
|
$this->aFlags = \is_array($aFlags) ? $aFlags : array();
|
||||||
$this->aFlagsLowerCase = \array_map('strtolower', $this->aFlags);
|
$this->aFlagsLowerCase = \array_map('strtolower', $this->aFlags);
|
||||||
|
|
||||||
|
|
@ -497,7 +495,7 @@ class Message implements \JsonSerializable
|
||||||
if (0 < \strlen($sDraftInfo)) {
|
if (0 < \strlen($sDraftInfo)) {
|
||||||
$sType = '';
|
$sType = '';
|
||||||
$sFolder = '';
|
$sFolder = '';
|
||||||
$sUid = '';
|
$iUid = 0;
|
||||||
|
|
||||||
$oParameters = new \MailSo\Mime\ParameterCollection($sDraftInfo);
|
$oParameters = new \MailSo\Mime\ParameterCollection($sDraftInfo);
|
||||||
foreach ($oParameters as $oParameter) {
|
foreach ($oParameters as $oParameter) {
|
||||||
|
|
@ -507,7 +505,7 @@ class Message implements \JsonSerializable
|
||||||
$sType = $oParameter->Value();
|
$sType = $oParameter->Value();
|
||||||
break;
|
break;
|
||||||
case 'uid':
|
case 'uid':
|
||||||
$sUid = $oParameter->Value();
|
$iUid = (int) $oParameter->Value();
|
||||||
break;
|
break;
|
||||||
case 'folder':
|
case 'folder':
|
||||||
$sFolder = \base64_decode($oParameter->Value());
|
$sFolder = \base64_decode($oParameter->Value());
|
||||||
|
|
@ -515,8 +513,8 @@ class Message implements \JsonSerializable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < \strlen($sType) && 0 < \strlen($sFolder) && 0 < \strlen($sUid)) {
|
if (0 < \strlen($sType) && 0 < \strlen($sFolder) && $iUid) {
|
||||||
$this->aDraftInfo = array($sType, $sUid, $sFolder);
|
$this->aDraftInfo = array($sType, $iUid, $sFolder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -661,7 +659,7 @@ class Message implements \JsonSerializable
|
||||||
return array(
|
return array(
|
||||||
'@Object' => 'Object/Message',
|
'@Object' => 'Object/Message',
|
||||||
'Folder' => $this->sFolder,
|
'Folder' => $this->sFolder,
|
||||||
'Uid' => (string) $this->iUid,
|
'Uid' => $this->iUid,
|
||||||
'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($this->sSubject)),
|
'Subject' => \trim(\MailSo\Base\Utils::Utf8Clear($this->sSubject)),
|
||||||
'MessageId' => $this->sMessageId,
|
'MessageId' => $this->sMessageId,
|
||||||
'Size' => $this->iSize,
|
'Size' => $this->iSize,
|
||||||
|
|
|
||||||
|
|
@ -58,12 +58,12 @@ class MessageCollection extends \MailSo\Base\Collection
|
||||||
public $Search;
|
public $Search;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $UidNext;
|
public $UidNext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var int
|
||||||
*/
|
*/
|
||||||
public $ThreadUid;
|
public $ThreadUid;
|
||||||
|
|
||||||
|
|
@ -104,8 +104,8 @@ class MessageCollection extends \MailSo\Base\Collection
|
||||||
$this->Offset = 0;
|
$this->Offset = 0;
|
||||||
$this->Limit = 0;
|
$this->Limit = 0;
|
||||||
$this->Search = '';
|
$this->Search = '';
|
||||||
$this->UidNext = '';
|
$this->UidNext = 0;
|
||||||
$this->ThreadUid = '';
|
$this->ThreadUid = 0;
|
||||||
$this->NewMessages = array();
|
$this->NewMessages = array();
|
||||||
|
|
||||||
$this->Filtered = false;
|
$this->Filtered = false;
|
||||||
|
|
|
||||||
|
|
@ -308,12 +308,12 @@ class Message
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetDraftInfo(string $sType, string $sUid, string $sFolder) : self
|
public function SetDraftInfo(string $sType, int $iUid, string $sFolder) : self
|
||||||
{
|
{
|
||||||
$this->aHeadersValue[Enumerations\Header::X_DRAFT_INFO] = (new ParameterCollection)
|
$this->aHeadersValue[Enumerations\Header::X_DRAFT_INFO] = (new ParameterCollection)
|
||||||
->Add(new Parameter('type', $sType))
|
->Add(new Parameter('type', $sType))
|
||||||
->Add(new Parameter('uid', $sUid))
|
->Add(new Parameter('uid', $iUid))
|
||||||
->Add(new Parameter('folder', base64_encode($sFolder)))
|
->Add(new Parameter('folder', \base64_encode($sFolder)))
|
||||||
;
|
;
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
||||||
|
|
@ -336,16 +336,8 @@ trait Folders
|
||||||
public function DoFolderInformation() : array
|
public function DoFolderInformation() : array
|
||||||
{
|
{
|
||||||
$sFolder = $this->GetActionParam('Folder', '');
|
$sFolder = $this->GetActionParam('Folder', '');
|
||||||
$sPrevUidNext = $this->GetActionParam('UidNext', '');
|
$iPrevUidNext = (int) $this->GetActionParam('UidNext', 0);
|
||||||
$aFlagsUids = array();
|
$aFlagsUids = \array_filter(\array_map('intval', $this->GetActionParam('FlagsUids', []))) ?: [];
|
||||||
$sFlagsUids = (string) $this->GetActionParam('FlagsUids', '');
|
|
||||||
|
|
||||||
$aFlagsFilteredUids = array();
|
|
||||||
if (0 < strlen($sFlagsUids))
|
|
||||||
{
|
|
||||||
$aFlagsUids = \explode(',', $sFlagsUids);
|
|
||||||
$aFlagsFilteredUids = \array_filter(\array_map('intval', $aFlagsUids));
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->initMailClientConnection();
|
$this->initMailClientConnection();
|
||||||
|
|
||||||
|
|
@ -354,7 +346,7 @@ trait Folders
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aInboxInformation = $this->MailClient()->FolderInformation(
|
$aInboxInformation = $this->MailClient()->FolderInformation(
|
||||||
$sFolder, $sPrevUidNext, $aFlagsFilteredUids
|
$sFolder, $iPrevUidNext, $aFlagsUids
|
||||||
);
|
);
|
||||||
|
|
||||||
foreach ($aInboxInformation['Flags'] as $iUid => $aFlags)
|
foreach ($aInboxInformation['Flags'] as $iUid => $aFlags)
|
||||||
|
|
@ -401,11 +393,11 @@ trait Folders
|
||||||
$aFolders = \array_unique($aFolders);
|
$aFolders = \array_unique($aFolders);
|
||||||
foreach ($aFolders as $sFolder)
|
foreach ($aFolders as $sFolder)
|
||||||
{
|
{
|
||||||
if (0 < \strlen(\trim($sFolder)) && 'INBOX' !== \strtoupper($sFolder))
|
if (0 < \strlen($sFolder) && 'INBOX' !== \strtoupper($sFolder))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$aInboxInformation = $this->MailClient()->FolderInformation($sFolder, '', array());
|
$aInboxInformation = $this->MailClient()->FolderInformation($sFolder);
|
||||||
if (isset($aInboxInformation['Folder']))
|
if (isset($aInboxInformation['Folder']))
|
||||||
{
|
{
|
||||||
$aResult['List'][] = [
|
$aResult['List'][] = [
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ trait Messages
|
||||||
$iOffset = 0;
|
$iOffset = 0;
|
||||||
$iLimit = 20;
|
$iLimit = 20;
|
||||||
$sSearch = '';
|
$sSearch = '';
|
||||||
$sUidNext = '';
|
$iUidNext = 0;
|
||||||
$bUseThreads = false;
|
$bUseThreads = false;
|
||||||
$sThreadUid = '';
|
$iThreadUid = '';
|
||||||
$sSort = '';
|
$sSort = '';
|
||||||
|
|
||||||
$sRawKey = $this->GetActionParam('RawKey', '');
|
$sRawKey = $this->GetActionParam('RawKey', '');
|
||||||
|
|
@ -35,12 +35,12 @@ trait Messages
|
||||||
$iOffset = (int) $aValues[3];
|
$iOffset = (int) $aValues[3];
|
||||||
$iLimit = (int) $aValues[4];
|
$iLimit = (int) $aValues[4];
|
||||||
$sSearch = (string) $aValues[5];
|
$sSearch = (string) $aValues[5];
|
||||||
$sUidNext = (string) $aValues[6];
|
$iUidNext = (int) $aValues[6];
|
||||||
$bUseThreads = (bool) $aValues[7];
|
$bUseThreads = (bool) $aValues[7];
|
||||||
|
|
||||||
if ($bUseThreads)
|
if ($bUseThreads)
|
||||||
{
|
{
|
||||||
$sThreadUid = isset($aValues[8]) ? (string) $aValues[8] : '';
|
$iThreadUid = isset($aValues[8]) ? (int) $aValues[8] : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sSort = isset($aValues[9]) ? (string) $aValues[9] : '';
|
$sSort = isset($aValues[9]) ? (string) $aValues[9] : '';
|
||||||
|
|
@ -54,12 +54,12 @@ trait Messages
|
||||||
$iLimit = (int) $this->GetActionParam('Limit', 10);
|
$iLimit = (int) $this->GetActionParam('Limit', 10);
|
||||||
$sSearch = $this->GetActionParam('Search', '');
|
$sSearch = $this->GetActionParam('Search', '');
|
||||||
$sSort = $this->GetActionParam('Sort', '');
|
$sSort = $this->GetActionParam('Sort', '');
|
||||||
$sUidNext = $this->GetActionParam('UidNext', '');
|
$iUidNext = (int) $this->GetActionParam('UidNext', 0);
|
||||||
$bUseThreads = !empty($this->GetActionParam('UseThreads', '0'));
|
$bUseThreads = !empty($this->GetActionParam('UseThreads', '0'));
|
||||||
|
|
||||||
if ($bUseThreads)
|
if ($bUseThreads)
|
||||||
{
|
{
|
||||||
$sThreadUid = (string) $this->GetActionParam('ThreadUid', '');
|
$iThreadUid = (int) $this->GetActionParam('ThreadUid', '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -78,11 +78,11 @@ trait Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
$oMessageList = $this->MailClient()->MessageList(
|
$oMessageList = $this->MailClient()->MessageList(
|
||||||
$sFolder, $iOffset, $iLimit, $sSearch, $sUidNext,
|
$sFolder, $iOffset, $iLimit, $sSearch, $iUidNext,
|
||||||
$this->cacherForUids(),
|
$this->cacherForUids(),
|
||||||
!!$this->Config()->Get('labs', 'use_imap_sort', true),
|
!!$this->Config()->Get('labs', 'use_imap_sort', true),
|
||||||
$bUseThreads,
|
$bUseThreads,
|
||||||
$sThreadUid,
|
$iThreadUid,
|
||||||
'',
|
'',
|
||||||
$sSort
|
$sSort
|
||||||
);
|
);
|
||||||
|
|
@ -110,7 +110,7 @@ trait Messages
|
||||||
}
|
}
|
||||||
|
|
||||||
$sMessageFolder = $this->GetActionParam('MessageFolder', '');
|
$sMessageFolder = $this->GetActionParam('MessageFolder', '');
|
||||||
$sMessageUid = $this->GetActionParam('MessageUid', '');
|
$iMessageUid = $this->GetActionParam('MessageUid', 0);
|
||||||
|
|
||||||
$sDraftFolder = $this->GetActionParam('SaveFolder', '');
|
$sDraftFolder = $this->GetActionParam('SaveFolder', '');
|
||||||
if (0 === strlen($sDraftFolder))
|
if (0 === strlen($sDraftFolder))
|
||||||
|
|
@ -149,9 +149,9 @@ trait Messages
|
||||||
|
|
||||||
$mResult = true;
|
$mResult = true;
|
||||||
|
|
||||||
if (0 < strlen($sMessageFolder) && 0 < strlen($sMessageUid))
|
if (0 < strlen($sMessageFolder) && 0 < $iMessageUid)
|
||||||
{
|
{
|
||||||
$this->MailClient()->MessageDelete($sMessageFolder, array($sMessageUid), true, true);
|
$this->MailClient()->MessageDelete($sMessageFolder, array($iMessageUid), true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null !== $iNewUid && 0 < $iNewUid)
|
if (null !== $iNewUid && 0 < $iNewUid)
|
||||||
|
|
@ -179,7 +179,7 @@ trait Messages
|
||||||
$oConfig = $this->Config();
|
$oConfig = $this->Config();
|
||||||
|
|
||||||
$sDraftFolder = $this->GetActionParam('MessageFolder', '');
|
$sDraftFolder = $this->GetActionParam('MessageFolder', '');
|
||||||
$sDraftUid = $this->GetActionParam('MessageUid', '');
|
$iDraftUid = $this->GetActionParam('MessageUid', 0);
|
||||||
$sSentFolder = $this->GetActionParam('SaveFolder', '');
|
$sSentFolder = $this->GetActionParam('SaveFolder', '');
|
||||||
$aDraftInfo = $this->GetActionParam('DraftInfo', null);
|
$aDraftInfo = $this->GetActionParam('DraftInfo', null);
|
||||||
$bDsn = '1' === (string) $this->GetActionParam('Dsn', '0');
|
$bDsn = '1' === (string) $this->GetActionParam('Dsn', '0');
|
||||||
|
|
@ -287,11 +287,11 @@ trait Messages
|
||||||
|
|
||||||
$this->deleteMessageAttachmnets($oAccount);
|
$this->deleteMessageAttachmnets($oAccount);
|
||||||
|
|
||||||
if (0 < \strlen($sDraftFolder) && 0 < \strlen($sDraftUid))
|
if (0 < \strlen($sDraftFolder) && 0 < $iDraftUid)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->MessageDelete($sDraftFolder, array($sDraftUid), true, true);
|
$this->MailClient()->MessageDelete($sDraftFolder, array($iDraftUid), true, true);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException)
|
catch (\Throwable $oException)
|
||||||
{
|
{
|
||||||
|
|
@ -388,15 +388,15 @@ trait Messages
|
||||||
if (!empty($sReadReceiptFlag))
|
if (!empty($sReadReceiptFlag))
|
||||||
{
|
{
|
||||||
$sFolderFullName = $this->GetActionParam('MessageFolder', '');
|
$sFolderFullName = $this->GetActionParam('MessageFolder', '');
|
||||||
$sUid = $this->GetActionParam('MessageUid', '');
|
$iUid = (int) $this->GetActionParam('MessageUid', 0);
|
||||||
|
|
||||||
$this->Cacher($oAccount)->Set(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $sFolderFullName, $sUid), '1');
|
$this->Cacher($oAccount)->Set(\RainLoop\KeyPathHelper::ReadReceiptCache($oAccount->Email(), $sFolderFullName, $iUid), '1');
|
||||||
|
|
||||||
if (0 < \strlen($sFolderFullName) && 0 < \strlen($sUid))
|
if (0 < \strlen($sFolderFullName) && 0 < $iUid)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$this->MailClient()->MessageSetFlag($sFolderFullName, array($sUid), true, $sReadReceiptFlag, true, true);
|
$this->MailClient()->MessageSetFlag($sFolderFullName, array($iUid), true, $sReadReceiptFlag, true, true);
|
||||||
}
|
}
|
||||||
catch (\Throwable $oException) {}
|
catch (\Throwable $oException) {}
|
||||||
}
|
}
|
||||||
|
|
@ -659,8 +659,8 @@ trait Messages
|
||||||
if ($aValues = \RainLoop\Utils::DecodeKeyValuesQ($sAttachment))
|
if ($aValues = \RainLoop\Utils::DecodeKeyValuesQ($sAttachment))
|
||||||
{
|
{
|
||||||
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
||||||
$iUid = (int) isset($aValues['Uid']) ? $aValues['Uid'] : 0;
|
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||||
$sMimeIndex = (string) isset($aValues['MimeIndex']) ? $aValues['MimeIndex'] : '';
|
$sMimeIndex = isset($aValues['MimeIndex']) ? (string) $aValues['MimeIndex'] : '';
|
||||||
|
|
||||||
$sTempName = \md5($sAttachment);
|
$sTempName = \md5($sAttachment);
|
||||||
if (!$this->FilesProvider()->FileExists($oAccount, $sTempName))
|
if (!$this->FilesProvider()->FileExists($oAccount, $sTempName))
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ trait Raw
|
||||||
$aValues = $this->getDecodedRawKeyValue($sRawKey);
|
$aValues = $this->getDecodedRawKeyValue($sRawKey);
|
||||||
|
|
||||||
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
||||||
$iUid = (int) (isset($aValues['Uid']) ? $aValues['Uid'] : 0);
|
$iUid = (isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0);
|
||||||
$sMimeIndex = (string) (isset($aValues['MimeIndex']) ? $aValues['MimeIndex'] : '');
|
$sMimeIndex = (string) (isset($aValues['MimeIndex']) ? $aValues['MimeIndex'] : '');
|
||||||
|
|
||||||
\header('Content-Type: text/plain');
|
\header('Content-Type: text/plain');
|
||||||
|
|
|
||||||
|
|
@ -416,7 +416,7 @@ trait Response
|
||||||
// $aExtended = array(
|
// $aExtended = array(
|
||||||
// 'MessageCount' => (int) $mStatus['MESSAGES'],
|
// 'MessageCount' => (int) $mStatus['MESSAGES'],
|
||||||
// 'MessageUnseenCount' => (int) $mStatus['UNSEEN'],
|
// 'MessageUnseenCount' => (int) $mStatus['UNSEEN'],
|
||||||
// 'UidNext' => (string) $mStatus['UIDNEXT'],
|
// 'UidNext' => (int) $mStatus['UIDNEXT'],
|
||||||
// 'Hash' => $this->MailClient()->GenerateFolderHash(
|
// 'Hash' => $this->MailClient()->GenerateFolderHash(
|
||||||
// $mResponse->FullNameRaw(), $mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT'],
|
// $mResponse->FullNameRaw(), $mStatus['MESSAGES'], $mStatus['UNSEEN'], $mStatus['UIDNEXT'],
|
||||||
// empty($mStatus['HIGHESTMODSEQ']) ? '' : $mStatus['HIGHESTMODSEQ'])
|
// empty($mStatus['HIGHESTMODSEQ']) ? '' : $mStatus['HIGHESTMODSEQ'])
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ trait User
|
||||||
$aValues = $this->getDecodedRawKeyValue($sHash);
|
$aValues = $this->getDecodedRawKeyValue($sHash);
|
||||||
|
|
||||||
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
$sFolder = isset($aValues['Folder']) ? $aValues['Folder'] : '';
|
||||||
$iUid = (int) isset($aValues['Uid']) ? $aValues['Uid'] : 0;
|
$iUid = isset($aValues['Uid']) ? (int) $aValues['Uid'] : 0;
|
||||||
$sMimeIndex = (string) isset($aValues['MimeIndex']) ? $aValues['MimeIndex'] : '';
|
$sMimeIndex = (string) isset($aValues['MimeIndex']) ? $aValues['MimeIndex'] : '';
|
||||||
|
|
||||||
$sContentTypeIn = (string) isset($aValues['MimeType']) ? $aValues['MimeType'] : '';
|
$sContentTypeIn = (string) isset($aValues['MimeType']) ? $aValues['MimeType'] : '';
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ class KeyPathHelper
|
||||||
return '/RepositoryCache/CoreRepo/'.$sRepo;
|
return '/RepositoryCache/CoreRepo/'.$sRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function ReadReceiptCache(string $sEmail, string $sFolderFullName, string $sUid) : string
|
static public function ReadReceiptCache(string $sEmail, string $sFolderFullName, int $iUid) : string
|
||||||
{
|
{
|
||||||
return '/ReadReceipt/'.$sEmail.'/'.$sFolderFullName.'/'.$sUid;
|
return '/ReadReceipt/'.$sEmail.'/'.$sFolderFullName.'/'.$iUid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public function LangCache(string $sLanguage, bool $bAdmim, string $sPluginsHash) : string
|
static public function LangCache(string $sLanguage, bool $bAdmim, string $sPluginsHash) : string
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="b-content" data-bind="initDom: dragOverBodyArea">
|
<div class="b-content" data-bind="initDom: dragOverBodyArea">
|
||||||
<div class="listThreadUidDesc" data-bind="visible: '' !== messageListEndThreadUid(), click: cancelThreadUid">
|
<div class="listThreadUidDesc" data-bind="visible: 0 < messageListEndThreadUid(), click: cancelThreadUid">
|
||||||
<i class="fontastic">⬅</i>
|
<i class="fontastic">⬅</i>
|
||||||
<span data-i18n="MESSAGE_LIST/BACK_TO_MESSAGE_LIST"></span>
|
<span data-i18n="MESSAGE_LIST/BACK_TO_MESSAGE_LIST"></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue