50
* The SyncEvolution configuration is versioned, so that incompatible
51
* changes to the on-disk config and files can be made more reliably.
53
* The on-disk configuration is versioned at three levels:
58
* This granularity allows migrating individual peers, contexts or
59
* everything to a new format.
61
* For each of these levels, two numbers are stored on disk and
62
* hard-coded in the binary:
63
* - current version = incremented each time the format is extended
64
* - minimum version = set to current version each time a backwards
65
* incompatible change is made
67
* This mirrors the libtool library versioning.
69
* Reading must check that the on-disk minimum version is <= the
70
* binary's current version. Otherwise the config is too recent to
73
* Writing will bump minimum and current version on disk to the
74
* versions in the binary. It will never decrease versions. This
75
* works when the more recent format adds information that can
76
* be safely ignored by older releases. If that is not possible,
77
* then the "minimum" version must be increased to prevent older
78
* releases from using the config.
80
* If bumping the versions increases the minimum version
81
* beyond the version supported by the release which wrote the config,
82
* that release will no longer work. Experimental releases will throw
83
* an error and users must explicitly migrate to the current
84
* format. Stable releases will migrate automatically.
86
* The on-disks current version can be checked to determine how to
87
* handle it. It may be more obvious to simple check for the existence
88
* of certain properties (that's how this was handled before the
89
* introduction of versioning).
91
* Here are some simple rules for handling the versions:
92
* - increase CUR version when adding new properties or files
93
* - set MIN to CUR when it is not safe that older releases
94
* read and write a config with the current format
96
* SyncEvolution < 1.2 had no versioning. It's format is 0.
98
* - config peer min/cur version 1, because
99
* of modified libsynthesis binfiles and
100
* - context min/cur version 1, because
101
* evolutionsource->database, evolutionuser/password->databaseUser/Password
103
static const int CONFIG_ROOT_MIN_VERSION = 0;
104
static const int CONFIG_ROOT_CUR_VERSION = 0;
105
static const int CONFIG_CONTEXT_MIN_VERSION = 1;
106
static const int CONFIG_CONTEXT_CUR_VERSION = 1;
107
static const int CONFIG_PEER_MIN_VERSION = 1;
108
static const int CONFIG_PEER_CUR_VERSION = 1;
111
CONFIG_LEVEL_ROOT, /**< = GLOBAL_SHARING */
112
CONFIG_LEVEL_CONTEXT, /**< = SOURCE_SET_SHARING */
113
CONFIG_LEVEL_PEER, /**< = NO_SHARING */
117
std::string ConfigLevel2String(ConfigLevel level);
125
extern int ConfigVersions[CONFIG_LEVEL_MAX][CONFIG_VERSION_MAX];
49
127
class SyncSourceConfig;
50
128
typedef SyncSourceConfig PersistentSyncSourceConfig;
56
134
/** name of the per-source admin data property */
57
135
extern const char *const SourceAdminDataName;
137
/** simplified creation of string lists: InitList("foo") + "bar" + ... */
138
template<class T> class InitList : public list<T> {
141
InitList(const T &initialValue) {
142
list<T>::push_back(initialValue);
144
InitList &operator + (const T &rhs) {
145
list<T>::push_back(rhs);
148
InitList &operator += (const T &rhs) {
149
list<T>::push_back(rhs);
153
typedef InitList<string> Aliases;
154
typedef InitList<Aliases> Values;
157
/** sync properties occur once per config */
159
/** source properties occur once per source in each config */
160
SOURCE_PROPERTY_TYPE,
161
/** exact type is unknown */
162
UNKNOWN_PROPERTY_TYPE
166
* A property name with optional source and context.
167
* String format is [<source>/]<property>[@<context>|@<peer>@<context>]
169
* Note that the part after the @ sign without another @ is always
170
* a context. The normal shorthand of just <peer> without context
171
* does not work here.
173
class PropertySpecifier {
175
std::string m_source; /**< source name, empty if applicable to all or sync property */
176
std::string m_property; /**< property name, must not be empty */
177
std::string m_config; /**< config name, empty if none, otherwise @<context> or <peer>@<context> */
180
NO_NORMALIZATION = 0,
181
NORMALIZE_SOURCE = 1,
185
/** parse, optionally also normalize source and config */
186
static PropertySpecifier StringToPropSpec(const std::string &spec, int flags = NORMALIZE_SOURCE|NORMALIZE_CONFIG);
187
std::string toString();
60
191
* A property has a name and a comment. Derived classes might have
61
192
* additional code to read and write the property from/to a
63
194
* on the fly, therefore the virtual get methods which return a
64
195
* string value and not just a reference.
197
* In addition to the name, it may also have aliases. When reading
198
* from a ConfigNode, all specified names are checked in the order in
199
* which they are listed, and the first one found is used. When
200
* writing, an existing key is overwritten, otherwise the main name is
201
* created as a new key.
66
203
* A default value is returned if the ConfigNode doesn't have
67
204
* a value set (= empty string). Invalid values in the configuration
68
205
* trigger an exception. Setting invalid values does not because
99
236
class ConfigProperty {
101
ConfigProperty(const string &name, const string &comment,
238
ConfigProperty(const string &name, const string &comment,
239
const string &def = string(""), const string &descr = string("")) :
242
m_sharing(NO_SHARING),
245
m_comment(boost::trim_right_copy(comment)),
250
ConfigProperty(const Aliases &names, const string &comment,
102
251
const string &def = string(""), const string &descr = string("")) :
103
252
m_obligatory(false),
105
254
m_sharing(NO_SHARING),
108
257
m_comment(boost::trim_right_copy(comment)),
112
261
virtual ~ConfigProperty() {}
114
virtual string getName() const { return m_name; }
263
/** name to be used for a specific node: first name if not in node, otherwise existing key */
264
string getName(const ConfigNode &node) const;
267
string getMainName() const { return m_names.front(); }
269
/* virtual so that derived classes like SourceBackendConfigProperty can generate the result dynamically */
270
virtual const Aliases &getNames() const { return m_names; }
115
271
virtual string getComment() const { return m_comment; }
116
272
virtual string getDefValue() const { return m_defValue; }
117
273
virtual string getDescr() const { return m_descr; }
156
312
* This is used to generate description dynamically according to the context information
157
* Defalut implmenentation is to return value set in the constructor.
313
* Default implmenentation is to return value set in the constructor, otherwise the server name.
158
314
* Derived classes can override this function. Used by 'checkPassword' and 'savePassword'
159
315
* to generate description for user interface.
161
317
virtual const string getDescr(const string &serverName,
162
318
FilterConfigNode &globalConfigNode,
163
319
const string &sourceName = string(),
164
const boost::shared_ptr<FilterConfigNode> &sourceConfigNode=boost::shared_ptr<FilterConfigNode>()) const { return m_descr; }
320
const boost::shared_ptr<FilterConfigNode> &sourceConfigNode=boost::shared_ptr<FilterConfigNode>()) const { return m_descr.empty() ? serverName : m_descr; }
167
323
/** split \n separated comment into lines without \n, appending them to commentLines */
189
345
Sharing getSharing() const { return m_sharing; }
190
346
void setSharing(Sharing sharing) { m_sharing = sharing; }
193
* special hacks for certain properties
196
SHARED_AND_UNSHARED = 1<<0 /**< value is stored with
197
SOURCE_SET_SHARING and
198
NO_SHARING, the later taking
199
precedency when reading
202
void setFlags(int flags) { m_flags = flags; }
203
int getFlags(void) const { return m_flags; }
205
348
/** set value unconditionally, even if it is not valid */
206
void setProperty(ConfigNode &node, const string &value) const { node.setProperty(getName(), value, getComment()); }
349
void setProperty(ConfigNode &node, const string &value) const { node.setProperty(getName(node), value, getComment()); }
207
350
void setProperty(FilterConfigNode &node, const string &value, bool temporarily = false) const {
351
string name = getName(node);
208
352
if (temporarily) {
209
node.addFilter(m_name, value);
353
node.addFilter(name, value);
211
node.setProperty(m_name, value, getComment());
355
node.setProperty(name, value, getComment());
215
359
/** set default value of a property, marked as default unless forced setting */
216
360
void setDefaultProperty(ConfigNode &node, bool force) const {
361
string name = getName(node);
217
362
string defValue = getDefValue();
218
node.setProperty(m_name, defValue, getComment(), force ? NULL : &defValue);
363
node.setProperty(name, defValue, getComment(), force ? NULL : &defValue);
262
407
Sharing m_sharing;
264
const string m_name, m_comment, m_defValue, m_descr;
267
template<class T> class InitList : public list<T> {
270
InitList(const T &initialValue) {
271
push_back(initialValue);
273
InitList &operator + (const T &rhs) {
277
InitList &operator += (const T &rhs) {
282
typedef InitList<string> Aliases;
283
typedef InitList<Aliases> Values;
409
const Aliases m_names;
410
const string m_comment, m_defValue, m_descr;
287
414
* A string property which maps multiple different possible value
403
530
ostringstream out;
406
node.setProperty(getName(), out.str(), getComment());
533
node.setProperty(getName(node), out.str(), getComment());
408
535
void setProperty(FilterConfigNode &node, const T &value, bool temporarily = false) const {
409
536
ostringstream out;
537
string name = getName(node);
412
540
if (temporarily) {
413
node.addFilter(getName(), out.str());
541
node.addFilter(name, out.str());
415
node.setProperty(getName(), out.str(), getComment());
543
node.setProperty(name, out.str(), getComment());
419
547
T getPropertyValue(const ConfigNode &node, bool *isDefault = NULL) const {
420
string name = getName();
548
string name = getName(node);
421
549
string value = node.readProperty(name);
422
550
istringstream in(value);
612
748
PasswordConfigProperty(const string &name, const string &comment, const string &def = string(""),const string &descr = string("")) :
613
749
ConfigProperty(name, comment, def, descr)
751
PasswordConfigProperty(const Aliases &names, const string &comment, const string &def = string(""),const string &descr = string("")) :
752
ConfigProperty(names, comment, def, descr)
617
756
* Check the password and cache the result.
683
822
* A derived ConfigProperty class for the property "evolutionpassword"
685
class EvolutionPasswordConfigProperty : public PasswordConfigProperty {
824
class DatabasePasswordConfigProperty : public PasswordConfigProperty {
687
EvolutionPasswordConfigProperty(const string &name,
688
const string &comment,
689
const string &def = string(""),
690
const string &descr = string("")):
691
PasswordConfigProperty(name,comment,def,descr)
826
DatabasePasswordConfigProperty(const Aliases &names,
827
const string &comment,
828
const string &def = string(""),
829
const string &descr = string("")):
830
PasswordConfigProperty(names,comment,def,descr)
693
832
virtual ConfigPasswordKey getPasswordKey(const string &descr,
694
833
const string &serverName,
772
* Store the current string value of a property in a cache
773
* and return the "const char *" pointer that is expected by
774
* the client library.
776
class ConfigStringCache {
778
const char *getProperty(const ConfigNode &node, const ConfigProperty &prop) {
779
string value = prop.getProperty(node);
780
return storeString(prop.getName(), value);
783
const char *storeString(const string &key, const string &value) {
784
const string &entry = m_cache[key] = value;
785
return entry.c_str();
789
map<string, string> m_cache;
793
913
* This class implements the client library configuration interface
794
914
* by mapping values to properties to entries in a ConfigTree. The
795
915
* mapping is either the traditional one used by SyncEvolution <= 0.7
834
954
* places. Will succeed even if config does not
835
955
* yet exist: flushing such a config creates it.
957
* Does a version check to ensure that the config can be
958
* read. Users of the instance must to an explicit
959
* prepareConfigForWrite() if the config or the files associated
960
* with it (Synthesis bin files) are going to be written.
837
962
* @param peer string that identifies the peer,
838
963
* matching regex (.*)(@([^@]*))?
839
964
* where the $1 (the first part) is
849
974
* as configuration tree instead of
850
975
* searching for it; always uses the
851
976
* current layout in that tree
978
* @param redirectPeerRootPath
979
* Can be used to redirect the per-peer
980
* files into a different directory. Only works
981
* in non-peer context configs.
982
* Used by SyncContext for local sync.
853
984
SyncConfig(const string &peer,
854
boost::shared_ptr<ConfigTree> tree = boost::shared_ptr<ConfigTree>());
985
boost::shared_ptr<ConfigTree> tree = boost::shared_ptr<ConfigTree>(),
986
const string &redirectPeerRootPath = "");
857
990
* Creates a temporary configuration.
996
* determines whether the need to migrate a config causes a
997
* STATUS_MIGRATION_NEEDED error or does the migration
998
* automatically; default is to migrate automatically in
999
* stable releases and to ask in development releases
1001
enum ConfigWriteMode {
1002
MIGRATE_AUTOMATICALLY,
1005
ConfigWriteMode getConfigWriteMode() const { return m_configWriteMode; }
1006
void setConfigWriteMode(ConfigWriteMode mode) { m_configWriteMode = mode; }
1009
* This does another version check which ensures that the config
1010
* is not unintentionally altered so that it cannot be read by
1011
* older SyncEvolution releases. If the config cannot be written
1012
* without breaking older releases, then either the call will fail
1013
* (development releases) or migrate the config (stable releases).
1014
* Can be controlled via setConfigWriteMode();
1016
* Also writes the current config versions into the config.
1018
void prepareConfigForWrite();
862
1020
/** absolute directory name of the configuration root */
863
1021
string getRootPath() const;
945
1103
* returns list of servers in either the old (.sync4j) or
946
1104
* new config directory (.config), given as server name
947
1105
* and absolute root of config
1107
* Guaranteed to be sorted by the (context, peer name, path) tuple,
1108
* in increasing order (foo@bar < abc@xyz < abc.old@xyz).
949
1110
static ConfigList getConfigs();
1113
* TODO: fix description of matchPeerTemplates() and remove getPeerTemplates()
952
1115
* returns list of available config templates:
953
1116
* for each peer listed in @peers, matching against the fingerprint information
954
1117
* from the peer (deviceName likely), sorted by the matching score,
968
1131
static TemplateList matchPeerTemplates(const DeviceList &peers, bool fuzzyMatch = true);
971
* get the built-in default templates
973
static TemplateList getBuiltInTemplates ();
976
1134
* Creates a new instance of a configuration template.
977
1135
* The result can be modified to set filters, but it
978
1136
* cannot be flushed.
980
1138
* @param peer a configuration name, *without* a context (scheduleworld, not scheduleworld@default),
981
1139
* or a configuration path in the system directory which can avoid another fuzzy match process.
1140
* "none" returns an empty template (default sync properties and dev ID set).
982
1141
* @return NULL if no such template
984
1143
static boost::shared_ptr<SyncConfig> createPeerTemplate(const string &peer);
986
/** true if the main configuration file already exists */
1146
* true if the main configuration file already exists;
1147
* "main" here means the per-peer config or context config,
1148
* depending on what the config refers to
987
1150
bool exists() const;
1153
* true if the config files for the selected level exist;
1154
* false is returned for CONFIG_LEVEL_PEER and a config
1155
* which refers to a context
1157
bool exists(ConfigLevel level) const;
990
1160
* The normalized, unique config name used by this instance.
991
1161
* Empty if not backed up by a real config.
993
1163
string getConfigName() const { return m_peer; }
1166
* The normalized context used by this instance.
1169
string getContextName() const;
1172
* the normalized peer name, empty if not a peer config
1174
string getPeerName() const;
1177
* true if the config is for a peer, false if a context config
1179
bool hasPeerProperties() const { return !m_peerPath.empty(); }
1182
* returns names of peers inside this config;
1183
* empty if not a context
1185
list<string> getPeers() const;
996
1188
* Do something before doing flush to files. This is particularly
997
1189
* useful when user interface wants to do preparation jobs, such
998
1190
* as savePassword and others.
1021
1213
static ConfigPropertyRegistry &getRegistry();
1215
enum NormalizeFlags {
1216
NORMALIZE_LONG_FORMAT = 0, /**< include context in normal form */
1217
NORMALIZE_SHORTHAND = 1, /**< keep normal form shorter by not specifying @default */
1218
NORMALIZE_IS_NEW = 2, /**< does not refer to an existing config, do not search
1219
for it among existing configs */
1220
NORMALIZE_MAX = 0xFFFF
1024
1224
* Normalize a config string:
1026
1226
* - non-printable and unsafe characters (colon, slash, backslash)
1027
1227
* replaced by underscore
1028
* - when no context specified: search for peer config first in @default,
1029
* then also in other contexts in alphabetical order
1030
* - @default stripped
1228
* - when no context specified and NORMALIZE_IS_NEW not set:
1229
* search for peer config first in @default, then also in other contexts
1230
* in alphabetical order
1231
* - NORMALIZE_SHORTHAND set: @default stripped (dangerous: result "foo"
1232
* may incorrectly be mapped to "foo@bar" if the "foo@default" config gets removed),
1233
* otherwise added if missing
1031
1234
* - empty string replaced with "@default"
1033
static string normalizeConfigString(const string &config);
1236
static string normalizeConfigString(const string &config, NormalizeFlags flags = NORMALIZE_SHORTHAND);
1036
1239
* Split a config string (normalized or not) into the peer part
1285
* Returns the right config node for a certain registered property,
1286
* looked up by name. NULL if not found.
1288
boost::shared_ptr<FilterConfigNode> getNode(const std::string &propName);
1289
boost::shared_ptr<const FilterConfigNode> getNode(const std::string &propName) const
1291
return const_cast<SyncConfig *>(this)->getNode(propName);
1079
1295
* Returns a wrapper around all properties of the given source
1080
1296
* which are saved in the config tree. Note that this is different
1081
1297
* from the set of sync source configs used by the SyncManager:
1102
1318
* Creates config nodes for a certain node. The nodes are not
1103
1319
* yet created in the backend if they do not yet exist.
1321
* Calling this for the same name repeatedly will return the
1322
* same set of node instances. This allows to set properties
1323
* temporarily in one place and have them used elsewhere.
1325
* setConfigFilter() resets this cache of nodes. Requesting nodes
1326
* after that call will create a new set of nodes with properties
1327
* modified temporarily according to these filters.
1105
1329
* @param name the name of the sync source
1106
1330
* @param trackName additional part of the tracking node name (used for unit testing)
1227
* @name Settings inherited from Funambol
1454
* @name SyncML Settings
1229
* These settings are required by the Funambol C++ client library.
1456
* These settings are required by the Synthesis engine.
1230
1457
* Some of them are hard-coded in this class. A derived class could
1231
1458
* make them configurable again, should that be desired.
1235
virtual const char* getUsername() const;
1236
virtual void setUsername(const string &value, bool temporarily = false);
1237
virtual const char* getPassword() const;
1238
virtual void setPassword(const string &value, bool temporarily = false);
1241
* Look at the password setting and if it requires user interaction,
1242
* get it from the user. Then store it for later usage in getPassword().
1243
* Without this call, getPassword() returns the original, unmodified
1246
virtual void checkPassword(ConfigUserInterface &ui);
1249
* Look at the password setting and if it needs special mechanism to
1250
* save password, this function is used to store specified password
1251
* in the config tree.
1252
* @param ui the ui pointer
1254
virtual void savePassword(ConfigUserInterface &ui);
1462
virtual std::string getSyncUsername() const;
1463
virtual void setSyncUsername(const string &value, bool temporarily = false);
1464
virtual std::string getSyncPassword() const;
1465
virtual void setSyncPassword(const string &value, bool temporarily = false);
1256
1467
virtual bool getPreventSlowSync() const;
1257
1468
virtual void setPreventSlowSync(bool value, bool temporarily = false);
1258
1469
virtual bool getUseProxy() const;
1259
1470
virtual void setUseProxy(bool value, bool temporarily = false);
1260
virtual const char* getProxyHost() const;
1471
virtual std::string getProxyHost() const;
1261
1472
virtual void setProxyHost(const string &value, bool temporarily = false);
1262
1473
virtual int getProxyPort() const { return 0; }
1263
virtual const char* getProxyUsername() const;
1474
virtual std::string getProxyUsername() const;
1264
1475
virtual void setProxyUsername(const string &value, bool temporarily = false);
1265
virtual const char* getProxyPassword() const;
1266
virtual void checkProxyPassword(ConfigUserInterface &ui);
1267
virtual void saveProxyPassword(ConfigUserInterface &ui);
1476
virtual std::string getProxyPassword() const;
1268
1477
virtual void setProxyPassword(const string &value, bool temporarily = false);
1269
1478
virtual vector<string> getSyncURL() const;
1270
1479
virtual void setSyncURL(const string &value, bool temporarily = false);
1271
1480
virtual void setSyncURL(const vector<string> &value, bool temporarily = false);
1272
virtual const char* getClientAuthType() const;
1481
virtual std::string getClientAuthType() const;
1273
1482
virtual void setClientAuthType(const string &value, bool temporarily = false);
1274
1483
virtual unsigned long getMaxMsgSize() const;
1275
1484
virtual void setMaxMsgSize(unsigned long value, bool temporarily = false);
1276
1485
virtual unsigned int getMaxObjSize() const;
1277
1486
virtual void setMaxObjSize(unsigned int value, bool temporarily = false);
1278
1487
virtual unsigned long getReadBufferSize() const { return 0; }
1279
virtual const char* getSSLServerCertificates() const;
1488
virtual std::string getSSLServerCertificates() const;
1282
1491
* iterate over files mentioned in getSSLServerCertificates()
1297
1506
virtual bool getCompression() const;
1298
1507
virtual void setCompression(bool value, bool temporarily = false);
1299
1508
virtual unsigned int getResponseTimeout() const { return 0; }
1300
virtual const char* getDevID() const;
1509
virtual std::string getDevID() const;
1301
1510
virtual void setDevID(const string &value, bool temporarily = false);
1303
1512
/*Used for Server Alerted Sync*/
1304
virtual const char* getRemoteIdentifier() const;
1513
virtual std::string getRemoteIdentifier() const;
1305
1514
virtual void setRemoteIdentifier (const string &value, bool temporaritly = false);
1306
1515
virtual bool getPeerIsClient () const;
1307
1516
virtual void setPeerIsClient (bool value, bool temporarily = false);
1308
virtual const char* getSyncMLVersion() const;
1517
virtual std::string getSyncMLVersion() const;
1309
1518
virtual void setSyncMLVersion (const string &value, bool temporarily = false);
1355
1564
virtual bool getWBXML() const;
1356
1565
virtual void setWBXML(bool isWBXML, bool temporarily = false);
1358
virtual const char* getUserAgent() const { return "SyncEvolution"; }
1359
virtual const char* getMan() const { return "Patrick Ohly"; }
1360
virtual const char* getMod() const { return "SyncEvolution"; }
1361
virtual const char* getOem() const { return "Open Source"; }
1362
virtual const char* getHwv() const { return "unknown"; }
1363
virtual const char* getSwv() const;
1364
virtual const char* getDevType() const;
1567
virtual std::string getUserAgent() const { return "SyncEvolution"; }
1568
virtual std::string getMan() const { return "Patrick Ohly"; }
1569
virtual std::string getMod() const { return "SyncEvolution"; }
1570
virtual std::string getOem() const { return "Open Source"; }
1571
virtual std::string getHwv() const { return "unknown"; }
1572
virtual std::string getSwv() const;
1573
virtual std::string getDevType() const;
1369
1577
SYNC4J_LAYOUT, /**< .syncj4/evolution/<server>, SyncEvolution <= 0.7.x */
1370
1578
HTTP_SERVER_LAYOUT, /**< .config/syncevolution/<server> with sources
1384
1599
const std::string &configname,
1385
1600
SyncConfig::ConfigList &res);
1602
/* internal access to configuration versioning */
1603
void setConfigVersion(ConfigLevel level, ConfigLimit limit, int version);
1606
* migrate root (""), context or peer config and everything contained in them to
1607
* the current config format
1609
void migrate(const std::string &config);
1388
1612
* set tree and nodes to VolatileConfigTree/Node
1442
1669
* temporary override for all sync source settings
1670
* ("" as key) or specific sources (source name as key)
1444
FilterConfigNode::ConfigFilter m_sourceFilter;
1446
/** temporary override for settings of specific sources */
1447
typedef std::map<std::string, FilterConfigNode::ConfigFilter> SourceFilters_t;
1448
SourceFilters_t m_sourceFilters;
1450
mutable ConfigStringCache m_stringCache;
1672
SourceProps m_sourceFilters;
1452
1674
static string getOldRoot() {
1453
1675
return getHome() + "/.sync4j/evolution";
1556
1791
struct SourceType {
1557
1792
SourceType():m_forceFormat(false)
1796
* Parses the SyncEvolution <= 1.1 type specifier:
1797
* <backend>[:<format>[:<version>][!]]
1799
* The <version> part is not stored anymore (was required by file
1800
* backend, but not actually used).
1802
SourceType(const string &type);
1805
* converts back to SyncEvolution <= 1.1 type specifier
1807
string toString() const;
1559
1809
string m_backend; /**< identifies the SyncEvolution backend (either via a generic term like "addressbook" or a specific one like "Evolution Contacts") */
1560
string m_format; /**< the format to be used (typically a MIME type) */
1810
string m_localFormat; /**< the format to be used inside the backend for storing items; typically
1811
hard-coded and not configurable */
1812
string m_format; /**< the format to be used (typically a MIME type) when talking to our peer */
1561
1813
bool m_forceFormat; /**< force to use the client's preferred format instead giving the engine and server a choice */
1651
1903
* configuration; different SyncSources then check whether
1652
1904
* they support that type. This call has to work before instantiating
1653
1905
* a source and thus gets passed a node to read from.
1655
* @return the pair of <backend> and the (possibly empty)
1656
* <format> specified in the "type" property; see
1657
* sourcePropSourceType in SyncConfig.cpp
1660
1907
static SourceType getSourceType(const SyncSourceNodes &nodes);
1661
static string getSourceTypeString(const SyncSourceNodes &nodes);
1662
1908
virtual SourceType getSourceType() const;
1664
/** set the source type in <backend>[:format] style */
1665
virtual void setSourceType(const string &value, bool temporarily = false);
1910
/** set source backend and formats in one step */
1911
virtual void setSourceType(const SourceType &type, bool temporarily = false);
1913
virtual void setBackend(const std::string &value, bool temporarily = false);
1914
virtual std::string getBackend() const;
1915
virtual void setDatabaseFormat(const std::string &value, bool temporarily = false);
1916
virtual std::string getDatabaseFormat() const;
1917
virtual void setSyncFormat(const std::string &value, bool temporarily = false);
1918
virtual std::string getSyncFormat() const;
1919
virtual void setForceSyncFormat(bool value, bool temporarily = false);
1920
virtual bool getForceSyncFormat() const;
1668
1923
* Returns the SyncSource URI: used in SyncML to address the data
1672
1927
* two different sync sources cannot access the same data at
1673
1928
* the same time.
1675
virtual const char* getURI() const;
1930
virtual std::string getURI() const;
1676
1931
virtual void setURI(const string &value, bool temporarily = false);
1934
* like getURI(), but instead of returning an empty string when
1935
* not configured, return the source name
1937
virtual std::string getURINonEmpty() const;
1679
1941
* Gets the default syncMode.
1681
1943
* Sync modes can be one of: