diff options
author | Patrick Ohly <patrick.ohly@intel.com> | 2011-10-24 19:52:01 +0200 |
---|---|---|
committer | Patrick Ohly <patrick.ohly@intel.com> | 2011-11-04 11:05:20 +0100 |
commit | 8c89db5b0f55c3c888c765fa915d4e60e02d54d1 (patch) | |
tree | e6274b12e1739f2f7a5a9b817647c201745ab377 /src/syncevo/LocalTransportAgent.cpp | |
parent | 741d55e8bfb4aec182a78e3724d77aa308c00f76 (diff) |
sync modes: added refresh/one-way-from-local/remote (BMC #23537)
The -from-client/server sync modes are confusing because the direction
of the data exchange depends on which side acts as SyncML server or
client.
This patch introduces new modes which use -from-local/remote
instead. The statistics and messages also use these variants now. The
old modes are still understood, but are declared as "not recommended"
in the documentation.
Diffstat (limited to 'src/syncevo/LocalTransportAgent.cpp')
-rw-r--r-- | src/syncevo/LocalTransportAgent.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/syncevo/LocalTransportAgent.cpp b/src/syncevo/LocalTransportAgent.cpp index 4e4c43c2..82834b08 100644 --- a/src/syncevo/LocalTransportAgent.cpp +++ b/src/syncevo/LocalTransportAgent.cpp @@ -284,7 +284,7 @@ void LocalTransportAgent::run() BOOST_FOREACH(const string &sourceName, m_server->getSyncSources()) { SyncSourceNodes nodes = m_server->getSyncSourceNodesNoTracking(sourceName); SyncSourceConfig source(sourceName, nodes); - string sync = source.getSync(); + std::string sync = source.getSync(); if (sync != "disabled") { string targetName = source.getURINonEmpty(); SyncSourceNodes targetNodes = m_client->getSyncSourceNodes(targetName); @@ -304,13 +304,23 @@ void LocalTransportAgent::run() // so none of the regular config nodes have to // be written. If a sync mode was set, it must have been // done before in this loop => error in original config. - if (string(targetSource.getSync()) != "disabled") { + if (!targetSource.isDisabled()) { m_client->throwError(StringPrintf("%s: source targetted twice by %s", fullTargetName.c_str(), m_clientContext.c_str())); } - targetSource.setSync(sync.c_str(), true); - targetSource.setURI(sourceName.c_str(), true); + // invert data direction + if (sync == "refresh-from-local") { + sync = "refresh-from-remote"; + } else if (sync == "refresh-from-remote") { + sync = "refresh-from-local"; + } else if (sync == "one-way-from-local") { + sync = "one-way-from-remote"; + } else if (sync == "one-way-from-remote") { + sync = "one-way-from-local"; + } + targetSource.setSync(sync, true); + targetSource.setURI(sourceName, true); } } |