Memotoo: use vCard 3.0

When SyncEvolution prefers vCard 3.0, additional properties like
NICKNAME work with Memotoo. This patch a) makes that the default
syncFormat in the Memotoo template and b) automatically sets it
in the "addressbook" source of all migrated configs which sync
with Memotoo (detected based on the syncURL).

The automatic config rewriting is possible because users upgrading
from the previous stable SyncEvolution release need to migrate their
configs anyway. Normally SyncEvolution does not modify configs like
this.
This commit is contained in:
Patrick Ohly 2011-03-02 11:05:18 +01:00
parent ad608ca221
commit da7f503bee
2 changed files with 15 additions and 0 deletions

View File

@ -547,6 +547,20 @@ void Cmdline::migratePeer(const std::string &fromPeer, const std::string &toPeer
// hack: move to different target config for createSyncClient()
m_server = toPeer;
boost::shared_ptr<SyncContext> to(createSyncClient());
// Special case for Memotoo: explicitly set preferred sync format
// to vCard 3.0 as part of the SyncEvolution 1.1.x -> 1.2 migration,
// because it works better. Template was also updated in 1.2, but
// that alone wouldn't improve existing configs.
if (from->getConfigVersion(CONFIG_LEVEL_PEER, CONFIG_CUR_VERSION) == 0) {
vector<string> urls = from->getSyncURL();
if (urls.size() == 1 &&
urls[0] == "http://sync.memotoo.com/syncML") {
boost::shared_ptr<SyncContext> to(createSyncClient());
m_props[to->getContextName()].m_sourceProps["addressbook"].insert(make_pair("syncFormat", "text/vcard"));
}
}
copyConfig(from, to, set<string>());
finishCopy(from, to);
}

View File

@ -947,6 +947,7 @@ boost::shared_ptr<SyncConfig> SyncConfig::createPeerTemplate(const string &serve
config->setConsumerReady(true);
source = config->getSyncSourceConfig("addressbook");
source->setURI("con");
source->setSyncFormat("text/vcard"); // vCard 3.0 works better than vCard 2.1 (NICKNAME!)
source = config->getSyncSourceConfig("calendar");
source->setURI("cal");
source = config->getSyncSourceConfig("todo");