Skip to content

Commit

Permalink
fix(imap): persist vanished messages immediately on EXAMINE commands
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Steinmetz <[email protected]>
  • Loading branch information
st3iny committed Oct 7, 2024
1 parent 15fe30f commit a2c9e8c
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 474 deletions.
12 changes: 7 additions & 5 deletions lib/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
use Horde_Imap_Client_Socket;
use JsonSerializable;
use OC;
use OCA\Mail\Cache\Cache;
use OCA\Mail\Cache\HordeCacheFactory;
use OCA\Mail\Db\Alias;
use OCA\Mail\Db\MailAccount;
use OCA\Mail\Exception\ServiceException;
Expand All @@ -48,6 +48,7 @@
use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\Security\ICrypto;
use OCP\Server;
use ReturnTypeWillChange;

class Account implements JsonSerializable {
Expand All @@ -69,6 +70,8 @@ class Account implements JsonSerializable {
/** @var Alias */
private $alias;

private HordeCacheFactory $hordeCacheFactory;

/**
* @param MailAccount $account
*/
Expand All @@ -77,6 +80,7 @@ public function __construct(MailAccount $account) {
$this->crypto = OC::$server->getCrypto();
$this->config = OC::$server->getConfig();
$this->memcacheFactory = OC::$server->getMemcacheFactory();
$this->hordeCacheFactory = Server::get(HordeCacheFactory::class);
}

public function __destruct() {
Expand Down Expand Up @@ -153,10 +157,8 @@ public function getImapConnection() {
if ($this->config->getSystemValue('app.mail.server-side-cache.enabled', true)) {
if ($this->memcacheFactory->isAvailable()) {
$params['cache'] = [
'backend' => new Cache([
'cacheob' => $this->memcacheFactory
->createDistributed(md5($this->getId() . $this->getEMailAddress()))
])];
'backend' => $this->hordeCacheFactory->newCache($this),
];
}
}
$this->client = new \Horde_Imap_Client_Socket($params);
Expand Down
Loading

0 comments on commit a2c9e8c

Please sign in to comment.