HEAD: rearrange things a bit so we can have a libwvbase.so, which contains
[wvapps.git] / evolution / exchangeitstorage.h
blob77f946eb085dcb2a0eb9e614fdc7239c05d7ce63
1 #ifndef __EXCHANGEIT_STORAGE_H
2 #define __EXCHANGEIT_STORAGE_H
4 #include <stdint.h>
5 #include <shell/evolution-storage.h>
7 #include "exchangeitadaptor.h"
10 #include "wvlog.h"
11 #include "wvstring.h"
12 #include "wvstringlist.h"
13 #include "wvscatterhash.h"
14 #include "uniconf.h"
16 #define EXCHANGEIT_PATH "/.evolution-exchangeit"
17 #define STORAGE_PATH "/.evolution-exchangeit/storage"
19 #define EXCHANGEIT_GCONF_DIR "/apps/evolution-exchangeit"
20 #define EXCHANGEIT_FOLDER_ADD_DIR "/apps/evolution-exchangeit/folders/toadd"
21 #define EXCHANGEIT_FOLDER_REMOVE_DIR "/apps/evolution-exchangeit/folders/toremove"
22 #define EXCHANGEIT_QUEUE_DIR "/apps/evolution-exchangeit/tosend"
23 #define EXCHANGEIT_BLOCK_DIR "/apps/evolution-exchangeit/nosend"
25 DeclareWvScatterDict(ExchangeItAdaptor, WvString, key);
26 typedef ExchangeItAdaptorDict ExchangeItAdaptorScatterDict;
28 class ExchangeItStorage
30 public:
31 ExchangeItStorage(EvolutionStorage *evo_stor,
32 WvStringParm _base_path,
33 WvStringParm _owner,
34 UniConf root);
35 ~ExchangeItStorage();
37 bool migrate_account(WvStringParm new_owner);
38 bool add_folder(WvStringParm key, WvStringParm type,
39 const bool by_client_request = false);
40 bool remove_folder(WvStringParm key, const bool by_client_request = false);
41 bool folder_exists(WvStringParm key);
42 bool load_folders();
44 const UniConf get_state() const { return state; }
46 void sync_folder_hierarchy(WvStringParm path);
49 private:
50 EvolutionStorage *evo_storage;
51 WvString base_path;
52 WvLog log;
53 mutable ExchangeItAdaptorDict dict;
54 WvString owner;
55 UniConf state;
57 void clean_folder_hierarchy_upwards(WvStringParm path);
58 bool rename_local_folder(WvStringParm old_key, WvStringParm new_key);
59 bool is_ready() const;
61 public:
62 ExchangeItAdaptorDict &get_dict()
63 { return dict; }
64 WvStringParm get_owner() { return owner; }
65 WvStringList & get_adaptor_list();
68 bool is_folder_valid(WvStringParm folder_name);
70 #endif