summaryrefslogtreecommitdiff
path: root/src/maildir-close.cc
blob: c0e0dbd5eee2865878fc15fa79dc997220b980bd (plain)
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
/**  --------------------------------------------------------------------
 *  @file  maildir-close.cc
 *  @brief  Implementation of the Maildir class.
 *  @author Andreas Aardal Hanssen
 *  @date 2002-2005
 *  -----------------------------------------------------------------  **/
#include "maildir.h"

#include <fcntl.h>
#include <unistd.h>

using namespace ::std;
using namespace Binc;

//------------------------------------------------------------------------
void Binc::Maildir::closeMailbox(void)
{
  if (!selected) return;

  if (mailboxchanged && !readOnly) writeCache();

  mailboxchanged = false;

  MaildirMessageCache::getInstance().clear();

  messages.clear();
  index.clear();
  newMessages.clear();
  oldrecent = 0;
  oldexists = 0;
  firstscan = true;
  cacheRead = false;
  uidvalidity = 0;
  uidnext = 1;
  selected = false;
  path = "";

  old_bincimap_cache_st_mtime = 0;
  old_bincimap_cache_st_ctime = 0;
  old_cur_st_mtime = 0;
  old_cur_st_ctime = 0;
  old_new_st_mtime = 0;
  old_new_st_ctime = 0;
}