3 // Container / environment class for the sync module.
7 Copyright (C) 2006-2009, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_SYNC_ENVIRONMENT_H__
23 #define __BARRY_SYNC_ENVIRONMENT_H__
25 #include <opensync/opensync.h>
26 #include <barry/barry.h>
32 struct DatabaseSyncState
35 OSyncObjTypeSink
*sink
;
37 // cache is a map of record ID to bool... the bool doesn't mean
38 // anything... the mere existence of the ID means it belongs
40 typedef std::map
<uint32_t, bool> cache_type
;
44 std::string m_CacheFilename
;
48 std::string m_MapFilename
;
54 Barry::RecordStateTable m_Table
;
62 DatabaseSyncState(OSyncPluginInfo
*info
, const char *description
);
72 void ClearDirtyFlags();
74 std::string
Map2Uid(uint32_t recordId
) const;
75 unsigned long GetMappedRecordId(const std::string
&uid
);
79 struct BarryEnvironment
83 OSyncPluginInfo
*info
;
86 std::string m_ConfigData
;
89 std::string m_password
;
91 // device communication
92 Barry::IConverter m_IConverter
;
93 Barry::ProbeResult m_ProbeResult
;
94 Barry::Controller
*m_pCon
;
95 Barry::Mode::Desktop
*m_pDesktop
;
98 DatabaseSyncState m_CalendarSync
, m_ContactsSync
;
104 // BarryEnvironment(OSyncMember *pm);
105 BarryEnvironment(OSyncPluginInfo
*info
);
108 void Connect(const Barry::ProbeResult
&result
);
112 DatabaseSyncState
* GetSyncObject(OSyncChange
*change
);
116 void ClearDirtyFlags(Barry::RecordStateTable
&table
, const std::string
&dbname
);
117 void ClearCalendarDirtyFlags();
118 void ClearContactsDirtyFlags();