-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvmrefresh.php
More file actions
59 lines (42 loc) · 1.49 KB
/
Copy pathvmrefresh.php
File metadata and controls
59 lines (42 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* vmrefresh
*
* Refresh count virtual mail boxes after move or delete message in real mail moxes.
*
* @version @package_version@
* @license GNU GPLv3+
* @author Sergey Sidlyarenko
*/
class vmrefresh extends rcube_plugin
{
private $rc;
function init()
{
$this->rc = rcmail::get_instance();
$this->add_hook('move_del_success', array($this,'refresh_virtual_mailboxes'));
$this->add_hook('show_success', array($this,'refresh_virtual_mailboxes'));
$this->add_hook('mark_success', array($this,'refresh_virtual_mailboxes'));
}
function refresh_virtual_mailboxes($args)
{
$this->load_config();
$a_mailboxes = $this->rc->config->get('vmrefresh_mailboxes', false);
$current = $this->rc->storage->get_folder();
// check recent/unseen counts
foreach ($a_mailboxes as $mbox_name) {
$is_current = $mbox_name == $current;
if ($is_current)
continue;
$this->rc->storage->folder_sync($mbox_name);
// Get mailbox status
$status = $this->rc->storage->folder_status($mbox_name, $diff);
if (empty($_REQUEST['_framed']))
rcmail_send_unread_count($mbox_name, true, null,
(!$is_current && ($status & 1)) ? 'recent' : '');
else
rcmail_send_unread_count($mbox_name, true, null,
(!$is_current && ($status & 1)) ? 'recent' : '', true);
}
}
}