19 if (!$result->isSuccess())
23 $result = $this->setMessagesFlag(static::FLAG_UNSEEN);
24 if ($result->isSuccess())
26 $this->updateLeftMenuCounter();
34 if (!$result->isSuccess())
38 $result = $this->setMessagesFlag(static::FLAG_SEEN);
39 if ($result->isSuccess())
41 $this->updateLeftMenuCounter();
46 private function setMessagesFlag($flag)
50 if ($flag === static::FLAG_SEEN)
52 $result = $this->mailboxHelper->markSeen($this->messages);
54 elseif ($flag === static::FLAG_UNSEEN)
56 $result = $this->mailboxHelper->markUnseen($this->messages);
59 if ($result->isSuccess())
61 if ($flag === static::FLAG_SEEN)
63 $this->repository->markMessagesSeen($this->messages, $this->mailbox);
65 elseif ($flag === static::FLAG_UNSEEN)
67 $this->repository->markMessagesUnseen($this->messages, $this->mailbox);
70 return new Main\Result();
72 return (
new Main\Result())->addError(
new Main\
Error(
Loc::getMessage(
'MAIL_CLIENT_SYNC_ERROR'),
'MAIL_CLIENT_SYNC_ERROR'));
75 private function updateLeftMenuCounter()
78 Main\Engine\CurrentUser::get()->getId(),
80 Mail\Helper\Message::getCountersForUserMailboxes(Main\Engine\CurrentUser::get()->getId(),
true),
static getMessage($code, $replace=null, $language=null)