PIM: PBAP chunk transfer flags in SyncPeerWithFlags()

All of the new PBPA chunk env variables can now also be set
for individual syncs via flags in SyncPeerWithFlags().
This commit is contained in:
Patrick Ohly 2014-07-17 15:33:46 +02:00
parent 037b8b46c4
commit 1a9e55bfe6
3 changed files with 45 additions and 1 deletions

View File

@ -351,6 +351,10 @@ in SyncPeerWithFlags(). The following keys are possible:
"pbap-sync": string "text"|"all"|"incremental" - synchronize only
text properties, all properties or first text, then all. The default is
taken from SYNCEVOLUTION_PBAP_SYNC if set, otherwise it is "incremental".
"pbap-chunk-max-count-photo", "pbap-chunk-max-count-no-photo",
"pbap-chunk-transfer-time", "pbap-chunk-offset": int32_t -
see PBAP README.
"pbap-chunk-time-lambda": double - see PBAP README
When doing text syncing, local photo data is preserved. The
incremental sync has the same effect as a text-only sync followed by

View File

@ -1574,6 +1574,46 @@ void Manager::doSyncPeer(const boost::shared_ptr<Session> &session,
SE_THROW(StringPrintf("SyncPeerWithFlags flag 'pbap-sync' expects one of 'text', 'all', or 'incremental': %s", value->c_str()));
}
env["SYNCEVOLUTION_PBAP_SYNC"] = *value;
} else if (entry.first == "pbap-chunk-max-count-photo") {
const int32_t *value = boost::get<int32_t>(&entry.second);
if (!value) {
SE_THROW(StringPrintf("SyncPeerWithFlags flag '%s' expects an integer value, got instead: %s",
entry.first.c_str(),
ToString(entry.second).c_str()));
}
env["SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_PHOTO"] = StringPrintf("%d", *value);
} else if (entry.first == "pbap-chunk-max-count-no-photo") {
const int32_t *value = boost::get<int32_t>(&entry.second);
if (!value) {
SE_THROW(StringPrintf("SyncPeerWithFlags flag '%s' expects an integer value, got instead: %s",
entry.first.c_str(),
ToString(entry.second).c_str()));
}
env["SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_NO_PHOTO"] = StringPrintf("%d", *value);
} else if (entry.first == "pbap-chunk-transfer-time") {
const int32_t *value = boost::get<int32_t>(&entry.second);
if (!value) {
SE_THROW(StringPrintf("SyncPeerWithFlags flag '%s' expects an integer value, got instead: %s",
entry.first.c_str(),
ToString(entry.second).c_str()));
}
env["SYNCEVOLUTION_PBAP_CHUNK_TRANSFER_TIME"] = StringPrintf("%d", *value);
} else if (entry.first == "pbap-chunk-time-lambda") {
const double *value = boost::get<double>(&entry.second);
if (!value) {
SE_THROW(StringPrintf("SyncPeerWithFlags flag '%s' expects a double value, got instead: %s",
entry.first.c_str(),
ToString(entry.second).c_str()));
}
env["SYNCEVOLUTION_PBAP_CHUNK_TIME_LAMBDA"] = StringPrintf("%f", *value);
} else if (entry.first == "pbap-chunk-offset") {
const int32_t *value = boost::get<int32_t>(&entry.second);
if (!value) {
SE_THROW(StringPrintf("SyncPeerWithFlags flag '%s' expects an integer value, got instead: %s",
entry.first.c_str(),
ToString(entry.second).c_str()));
}
env["SYNCEVOLUTION_PBAP_CHUNK_OFFSET"] = StringPrintf("%d", *value);
} else if (entry.first == "progress-frequency") {
const double *value = boost::get<const double>(&entry.second);
if (!value) {

View File

@ -148,7 +148,7 @@ class Manager : public GDBusCXX::DBusObjectHelper
void syncPeer(const boost::shared_ptr<GDBusCXX::Result1<SyncResult> > &result,
const std::string &uid);
typedef std::map<std::string, boost::variant<std::string, double> > SyncFlags;
typedef std::map<std::string, boost::variant<std::string, double, int32_t> > SyncFlags;
/** Manager.SyncPeerWithFlags() */
void syncPeerWithFlags(const boost::shared_ptr<GDBusCXX::Result1<SyncResult> > &result,
const std::string &uid,