configuration: removed builtin templates

The code for builtin templates had side effects, like always adding
all four standard sources to a template, even if the template itself
didn't have all of them defined. It also hid the problem that listing
templates didn't work for templates on disk.

Another benefit is that template files can be packaged separately. By
choosing the packages which are to be installed, a distributor of
SyncEvolution (like MeeGo) can choose which services to offer by
default.

Therefore this patch removes the "builtin templates" feature, which
was only useful in unusual use cases anyway (for example, single-binary
distribution).

Because there are no more default values for source properties, all
templates must specify the "backend" explicitly. syncevo-phone-config
was adapted accordingly, and also updated to use the current names of
the properties in the process.

As part of moving the templates into separate files, some of them
were cleaned up:
- Mobical: now points to Everdroid, its new name
- Google, Ovi: SSL verification is always enabled in the templates;
               the workaround for old libsoup should no longer be
               necessary for most users
- Google: renamed to "Google_Contacts", with "Google" as alias,
          because there will be two Google templates soon
- Scheduleworld: use "server no longer in operation" instead of
                 an invalid URL

The finger print match had a special case for "default". The exact
intention of that is unknown. Perhaps it was meant to give that
template a boost when it wouldn't match the string that is getting
searched for at all.

But it had the effect that an exact match when searching for the
"default" template was not found and thus that template couldn't be
used in the command line after moving it from builtin to external.

Removed the complete check.
This commit is contained in:
Patrick Ohly 2011-05-18 14:11:54 +02:00
parent bf5793ba57
commit bfb7a85f84
10 changed files with 87 additions and 369 deletions

View File

@ -2241,7 +2241,7 @@ protected:
void testSetupScheduleWorld() { doSetupScheduleWorld(false); }
void doSetupScheduleWorld(bool shared) {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2490,7 +2490,7 @@ protected:
void testSetupDefault() {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2511,7 +2511,7 @@ protected:
void testSetupRenamed() {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2533,7 +2533,7 @@ protected:
void testSetupFunambol() { doSetupFunambol(false); }
void doSetupFunambol(bool shared) {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2569,7 +2569,7 @@ protected:
void testSetupSynthesis() { doSetupSynthesis(false); }
void doSetupSynthesis(bool shared) {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2601,7 +2601,12 @@ protected:
}
void testTemplate() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
TestCmdline failure("--template", NULL);
CPPUNIT_ASSERT(!failure.m_cmdline->parse());
CPPUNIT_ASSERT_EQUAL_DIFF("", failure.m_out.str());
CPPUNIT_ASSERT_EQUAL(string("ERROR: missing parameter for '--template'\n"), lastLine(failure.m_err.str()));
@ -2612,13 +2617,13 @@ protected:
" template name = template description\n"
" eGroupware = http://www.egroupware.org\n"
" Funambol = http://my.funambol.com\n"
" Google = http://m.google.com/sync\n"
" Google_Contacts = contact sync via SyncML, see http://www.google.com/support/mobile/bin/topic.py?topic=22181\n"
" Goosync = http://www.goosync.com/\n"
" Memotoo = http://www.memotoo.com\n"
" Mobical = http://www.mobical.net\n"
" Mobical = https://www.everdroid.com\n"
" Oracle = http://www.oracle.com/technology/products/beehive/index.html\n"
" Ovi = http://www.ovi.com\n"
" ScheduleWorld = http://www.scheduleworld.com\n"
" ScheduleWorld = server no longer in operation\n"
" SyncEvolution = http://www.syncevolution.org\n"
" Synthesis = http://www.synthesis.ch\n",
help.m_out.str());
@ -2664,7 +2669,7 @@ protected:
}
void testPrintServers() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2683,7 +2688,7 @@ protected:
}
void testPrintConfig() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2892,7 +2897,7 @@ protected:
void testPrintFileTemplatesConfig() {
symlink("../templates", (m_testDir + "/syncevolution-templates").c_str());
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -2927,7 +2932,7 @@ protected:
void testAddSource() {
string root;
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3014,7 +3019,7 @@ protected:
}
void testConfigure() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3224,7 +3229,7 @@ protected:
* templates. See BMC #14805.
*/
void testConfigureTemplates() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3425,7 +3430,7 @@ protected:
void testConfigureSources() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3538,7 +3543,7 @@ protected:
}
void testOldConfigure() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3679,7 +3684,7 @@ protected:
}
void testMigrate() {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -3905,7 +3910,7 @@ protected:
// Migrate context containing a peer. Must also migrate peer.
// Covers special case of inconsistent "type".
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);
@ -4420,7 +4425,7 @@ private:
}
string printConfig(const string &server) {
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "/dev/null");
ScopedEnvChange templates("SYNCEVOLUTION_TEMPLATE_DIR", "templates");
ScopedEnvChange xdg("XDG_CONFIG_HOME", m_testDir);
ScopedEnvChange home("HOME", m_testDir);

View File

@ -48,10 +48,6 @@ SE_BEGIN_CXX
const char *const SourceAdminDataName = "adminData";
static bool SourcePropBackendIsSet(boost::shared_ptr<SyncSourceConfig> source);
static bool SourcePropURIIsSet(boost::shared_ptr<SyncSourceConfig> source);
static bool SourcePropSyncIsSet(boost::shared_ptr<SyncSourceConfig> source);
int ConfigVersions[CONFIG_LEVEL_MAX][CONFIG_VERSION_MAX] =
{
{ CONFIG_ROOT_MIN_VERSION, CONFIG_ROOT_CUR_VERSION },
@ -654,50 +650,6 @@ SyncConfig::ConfigList SyncConfig::getConfigs()
return res;
}
/* Get a list of all templates, both for any phones listed in @peers*/
SyncConfig::TemplateList SyncConfig::getPeerTemplates(const DeviceList &peers)
{
TemplateList result1, result2;
result1 = matchPeerTemplates (peers);
result2 = getBuiltInTemplates();
result1.insert (result1.end(), result2.begin(), result2.end());
return result1;
}
SyncConfig::TemplateList SyncConfig::getBuiltInTemplates()
{
class TmpList : public TemplateList {
public:
void addDefaultTemplate(const string &server, const string &url) {
BOOST_FOREACH(const boost::shared_ptr<TemplateDescription> entry, static_cast<TemplateList &>(*this)) {
if (boost::iequals(entry->m_templateId, server)) {
//already present
return;
}
}
push_back (boost::shared_ptr<TemplateDescription> (new TemplateDescription(server, url)));
}
} result;
// builtin templates if not present
result.addDefaultTemplate("Funambol", "http://my.funambol.com");
result.addDefaultTemplate("ScheduleWorld", "http://www.scheduleworld.com");
result.addDefaultTemplate("Synthesis", "http://www.synthesis.ch");
result.addDefaultTemplate("Memotoo", "http://www.memotoo.com");
result.addDefaultTemplate("Google", "http://m.google.com/sync");
result.addDefaultTemplate("Mobical", "http://www.mobical.net");
result.addDefaultTemplate("Oracle", "http://www.oracle.com/technology/products/beehive/index.html");
result.addDefaultTemplate("Goosync", "http://www.goosync.com/");
result.addDefaultTemplate("SyncEvolution", "http://www.syncevolution.org");
result.addDefaultTemplate("Ovi", "http://www.ovi.com");
result.addDefaultTemplate("eGroupware", "http://www.egroupware.org");
result.sort (TemplateDescription::compare_op);
return result;
}
static string SyncEvolutionTemplateDir()
{
string templateDir(TEMPLATE_DIR);
@ -792,10 +744,10 @@ boost::shared_ptr<SyncConfig> SyncConfig::createPeerTemplate(const string &serve
// before starting another fuzzy match process, first try to load the
// template directly taking the parameter as the path
bool fromDisk = false;
if (TemplateConfig::isTemplateConfig(server)) {
if (server == "none") {
// nothing to read from, just set some defaults below
} else if (TemplateConfig::isTemplateConfig(server)) {
templateConfig = server;
fromDisk = true;
} else {
SyncConfig::DeviceList devices;
devices.push_back (DeviceDescription("", server, MATCH_ALL));
@ -805,10 +757,8 @@ boost::shared_ptr<SyncConfig> SyncConfig::createPeerTemplate(const string &serve
templateConfig = templates.front()->m_path;
}
if (templateConfig.empty()) {
// not found, avoid reading current directory by using one which doesn't exist
templateConfig = "/dev/null";
} else {
fromDisk = true;
// return "not found"
return boost::shared_ptr<SyncConfig>();
}
}
@ -824,272 +774,26 @@ boost::shared_ptr<SyncConfig> SyncConfig::createPeerTemplate(const string &serve
return config;
}
// create sync source configs and set non-default values
config->setSourceDefaults("addressbook", false);
config->setSourceDefaults("calendar", false);
config->setSourceDefaults("todo", false);
config->setSourceDefaults("memo", false);
// check for icon
if (config->getIconURI().empty()) {
string dirname, filename;
splitPath(templateConfig, dirname, filename);
ReadDir dir(getDirname(dirname));
source = config->getSyncSourceConfig("addressbook");
if (!SourcePropBackendIsSet(source)) {
source->setBackend("addressbook");
}
if (!SourcePropURIIsSet(source)) {
source->setURI("card");
}
if (!SourcePropSyncIsSet(source)) {
source->setSync("two-way");
}
// remove last suffix, regardless what it is
size_t pos = filename.rfind('.');
if (pos != filename.npos) {
filename.resize(pos);
}
filename += "-icon";
source = config->getSyncSourceConfig("calendar");
if (!SourcePropBackendIsSet(source)) {
source->setBackend("calendar");
}
if (!SourcePropURIIsSet(source)) {
source->setURI("event");
}
if (!SourcePropSyncIsSet(source)) {
source->setSync("two-way");
}
source = config->getSyncSourceConfig("todo");
if (!SourcePropBackendIsSet(source)) {
source->setBackend("todo");
}
if (!SourcePropURIIsSet(source)) {
source->setURI("task");
}
if (!SourcePropSyncIsSet(source)) {
source->setSync("two-way");
}
source = config->getSyncSourceConfig("memo");
if (!SourcePropBackendIsSet(source)) {
source->setBackend("memo");
}
if (!SourcePropURIIsSet(source)) {
source->setURI("note");
}
if (!SourcePropSyncIsSet(source)) {
source->setSync("two-way");
}
if (fromDisk) {
// check for icon
if (config->getIconURI().empty()) {
string dirname, filename;
splitPath(templateConfig, dirname, filename);
ReadDir dir(getDirname(dirname));
// remove last suffix, regardless what it is
size_t pos = filename.rfind('.');
if (pos != filename.npos) {
filename.resize(pos);
}
filename += "-icon";
BOOST_FOREACH(const string &entry, dir) {
if (boost::istarts_with(entry, filename)) {
config->setIconURI("file://" + dirname + "/" + entry);
break;
}
BOOST_FOREACH(const string &entry, dir) {
if (boost::istarts_with(entry, filename)) {
config->setIconURI("file://" + dirname + "/" + entry);
break;
}
}
// leave the source configs alone and return the config as it is:
// in order to have sources configured as part of the template,
// the template must have entries for all sources under "sources"
return config;
}
if (boost::iequals(server, "scheduleworld") ||
boost::iequals(server, "default")) {
config->setSyncURL("http://sync.scheduleworld.com/funambol/ds");
config->setWebURL("http://www.scheduleworld.com");
// ScheduleWorld was shut down end of November 2010.
// Completely removing all traces of it from SyncEvolution
// source code is too intrusive for the time being, so
// just disable it in the UI.
// config->setConsumerReady(false);
source = config->getSyncSourceConfig("addressbook");
source->setURI("card3");
source->setBackend("addressbook");
source->setSyncFormat("text/vcard");
source = config->getSyncSourceConfig("calendar");
source->setURI("cal2");
source = config->getSyncSourceConfig("todo");
source->setURI("task2");
source = config->getSyncSourceConfig("memo");
source->setURI("note");
} else if (boost::iequals(server, "funambol")) {
config->setSyncURL("http://my.funambol.com/sync");
config->setWebURL("http://my.funambol.com");
config->setWBXML(false);
config->setRetryInterval(0);
config->setConsumerReady(true);
source = config->getSyncSourceConfig("calendar");
source->setSync("two-way");
source->setURI("event");
source->setSyncFormat("text/calendar");
source->setForceSyncFormat(true);
source = config->getSyncSourceConfig("todo");
source->setSync("two-way");
source->setURI("task");
source->setSyncFormat("text/calendar");
source->setForceSyncFormat(true);
} else if (boost::iequals(server, "synthesis")) {
config->setSyncURL("http://www.synthesis.ch/sync");
config->setWebURL("http://www.synthesis.ch");
source = config->getSyncSourceConfig("addressbook");
source->setURI("contacts");
source = config->getSyncSourceConfig("calendar");
source->setURI("events");
source->setSync("disabled");
source = config->getSyncSourceConfig("todo");
source->setURI("tasks");
source->setSync("disabled");
source = config->getSyncSourceConfig("memo");
source->setURI("notes");
} else if (boost::iequals(server, "memotoo")) {
config->setSyncURL("http://sync.memotoo.com/syncML");
config->setWebURL("http://www.memotoo.com");
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");
source->setURI("task");
source = config->getSyncSourceConfig("memo");
source->setURI("note");
} else if (boost::iequals(server, "google")) {
config->setSyncURL("https://m.google.com/syncml");
config->setWebURL("http://m.google.com/sync");
config->setClientAuthType("syncml:auth-basic");
config->setWBXML(true);
config->setConsumerReady(true);
#ifndef ENABLE_SSL_CERTIFICATE_CHECK
// temporarily (?) disabled certificate checking because
// libsoup/gnutls do not accept the Verisign certificate
// (GNOME Bugzilla #589323)
config->setSSLVerifyServer(false);
config->setSSLVerifyHost(false);
#endif
source = config->getSyncSourceConfig("addressbook");
source->setURI("contacts");
source->setSyncFormat("text/x-vcard");
/* Google support only addressbook sync via syncml */
source = config->getSyncSourceConfig("calendar");
source->setSync("none");
source->setURI("");
source = config->getSyncSourceConfig("todo");
source->setSync("none");
source->setURI("");
source = config->getSyncSourceConfig("memo");
source->setSync("none");
source->setURI("");
} else if (boost::iequals(server, "mobical")) {
config->setSyncURL("http://www.mobical.net/sync/server");
config->setWebURL("http://www.mobical.net");
config->setConsumerReady(true);
source = config->getSyncSourceConfig("addressbook");
source->setURI("con");
source = config->getSyncSourceConfig("calendar");
source->setURI("cal");
source = config->getSyncSourceConfig("todo");
source->setURI("task");
source = config->getSyncSourceConfig("memo");
source->setURI("pnote");
} else if (boost::iequals(server, "oracle")) {
config->setSyncURL("https://your.company/mobilesync/server");
config->setWebURL("http://www.oracle.com/technology/products/beehive/");
source = config->getSyncSourceConfig("addressbook");
source->setURI("./contacts");
source = config->getSyncSourceConfig("calendar");
source->setURI("./calendar/events");
source = config->getSyncSourceConfig("todo");
source->setURI("./calendar/tasks");
source = config->getSyncSourceConfig("memo");
source->setURI("./notes");
} else if (boost::iequals(server, "Ovi")) {
config->setSyncURL("https://sync.ovi.com/services/syncml");
config->setWebURL("http://www.ovi.com");
#ifndef ENABLE_SSL_CERTIFICATE_CHECK
// temporarily (?) disabled certificate checking because
// libsoup/gnutls do not accept the Verisign certificate
// (GNOME Bugzilla #589323)
config->setSSLVerifyServer(false);
config->setSSLVerifyHost(false);
#endif
//prefer vcard 3.0
source = config->getSyncSourceConfig("addressbook");
source->setSyncFormat("text/vcard");
source->setURI("./Contact/Unfiled");
source = config->getSyncSourceConfig("calendar");
source->setSync("none");
source->setURI("");
//prefer vcalendar 1.0
source->setSyncFormat("text/x-vcalendar");
source = config->getSyncSourceConfig("todo");
source->setSync("none");
source->setURI("");
//prefer vcalendar 1.0
source->setSyncFormat("text/x-vcalendar");
//A virtual datastore combining calendar and todo
source = config->getSyncSourceConfig("calendar+todo");
source->setURI("./EventTask/Tasks");
source->setBackend("virtual");
source->setSyncFormat("text/x-vcalendar");
source->setDatabaseID("calendar,todo");
source->setSync("two-way");
//Memo is disabled
source = config->getSyncSourceConfig("memo");
source->setSync("none");
source->setURI("");
} else if (boost::iequals(server, "goosync")) {
config->setSyncURL("http://sync2.goosync.com/");
config->setWebURL("http://www.goosync.com/");
source = config->getSyncSourceConfig("addressbook");
source->setURI("contacts");
source = config->getSyncSourceConfig("calendar");
source->setURI("calendar");
source = config->getSyncSourceConfig("todo");
source->setURI("tasks");
source = config->getSyncSourceConfig("memo");
source->setURI("");
} else if (boost::iequals(server, "syncevolution")) {
config->setSyncURL("http://yourserver:port");
config->setWebURL("http://www.syncevolution.org");
config->setConsumerReady(false);
source = config->getSyncSourceConfig("addressbook");
source->setURI("addressbook");
source = config->getSyncSourceConfig("calendar");
source->setURI("calendar");
source = config->getSyncSourceConfig("todo");
source->setURI("todo");
source = config->getSyncSourceConfig("memo");
source->setURI("memo");
} else if (boost::iequals(server, "egroupware")) {
config->setSyncURL("http://set.your.domain.here/rpc.php");
config->setWebURL("http://www.egroupware.org");
// Not much testing is happening with eGroupware
// and users need to be aware of the special URL;
// but Ovi is not necessarily better and is visible.
// Let's show it.
config->setConsumerReady(true);
source = config->getSyncSourceConfig("addressbook");
source->setURI("./contacts");
source = config->getSyncSourceConfig("calendar");
source->setURI("calendar");
source = config->getSyncSourceConfig("todo");
source->setURI("./tasks");
source = config->getSyncSourceConfig("memo");
source->setURI("./notes");
} else {
config.reset();
}
return config;
}
@ -2400,11 +2104,6 @@ StringConfigProperty SyncSourceConfig::m_sourcePropSync("sync",
(Aliases("one-way-from-client") + "one-way-client") +
(Aliases("one-way-from-server") + "one-way-server" + "one-way") +
(Aliases("disabled") + "none"));
static bool SourcePropSyncIsSet(boost::shared_ptr<SyncSourceConfig> source)
{
return source->isSet(SyncSourceConfig::m_sourcePropSync);
}
static class SourceBackendConfigProperty : public StringConfigProperty {
public:
@ -2489,10 +2188,6 @@ public:
return res;
}
} sourcePropBackend;
static bool SourcePropBackendIsSet(boost::shared_ptr<SyncSourceConfig> source)
{
return source->isSet(sourcePropBackend);
}
StringConfigProperty sourcePropSyncFormat("syncFormat",
"When there are alternative formats for the same data,\n"
@ -2551,10 +2246,6 @@ static ConfigProperty sourcePropURI("uri",
"this is appended to the server's URL to identify the\n"
"server's database; if unset, the source name is used as\n"
"fallback");
static bool SourcePropURIIsSet(boost::shared_ptr<SyncSourceConfig> source)
{
return source->isSet(sourcePropURI);
}
static ConfigProperty sourcePropUser(Aliases("databaseUser") + "evolutionuser",
"authentication for backend data source; password can be specified\n"
@ -2924,13 +2615,6 @@ int TemplateConfig::fingerprintMatch (const string &fingerprint)
//return the largest match value
int max = NO_MATCH;
BOOST_FOREACH (std::string sub, subfingerprints){
if (boost::iequals (sub, "default")){
if (LEVEL1_MATCH > max) {
max = LEVEL1_MATCH;
}
continue;
}
std::vector< LCS::Entry <char> > result;
std::string match = sub;
boost::to_lower(match);

View File

@ -1110,6 +1110,8 @@ class SyncConfig {
static ConfigList getConfigs();
/**
* TODO: fix description of matchPeerTemplates() and remove getPeerTemplates()
*
* returns list of available config templates:
* for each peer listed in @peers, matching against the fingerprint information
* from the peer (deviceName likely), sorted by the matching score,
@ -1120,7 +1122,7 @@ class SyncConfig {
* The assumption currently is only work for SyncML client peers.
* DeviceList is a list of matching tuples <fingerprint, SyncConfig::MatchMode>.
*/
static TemplateList getPeerTemplates(const DeviceList &peers);
static TemplateList getPeerTemplates(const DeviceList &peers) { return matchPeerTemplates(peers, true); }
/**
* match the built-in templates against @param fingerprint, return a list of
@ -1128,11 +1130,6 @@ class SyncConfig {
* */
static TemplateList matchPeerTemplates(const DeviceList &peers, bool fuzzyMatch = true);
/**
* get the built-in default templates
*/
static TemplateList getBuiltInTemplates ();
/**
* Creates a new instance of a configuration template.
* The result can be modified to set filters, but it

View File

@ -11,16 +11,19 @@ ConsumerReady = 1
=== sources/addressbook/config.ini ===
sync = two-way
uri = addressbook
backend = addressbook
=== sources/calendar/config.ini ===
sync = two-way
uri = calendar
backend = calendar
=== sources/todo/config.ini ===
sync = two-way
uri = todo
backend = todo
=== sources/memo/config.ini ===
sync = two-way
uri = memo
backend = memo

View File

@ -11,21 +11,25 @@ ConsumerReady = 1
=== sources/addressbook/config.ini ===
sync = two-way
uri = Contacts
backend = addressbook
=== sources/calendar/config.ini ===
sync = none
backend = calendar
=== sources/todo/config.ini ===
sync = none
backend = todo
=== sources/memo/config.ini ===
sync = two-way
uri = Notes
backend = memo
=== sources/calendar+todo/config.ini ===
sync = two-way
backend = virtual
syncFormat = text/x-vcalendar
evolutionsource = calendar,todo
uri = Calendar
backend = virtual

View File

@ -11,12 +11,16 @@ ConsumerReady = 1
=== sources/addressbook/config.ini ===
uri = Contact
backend = addressbook
=== sources/calendar/config.ini ===
uri = Calendar
backend = calendar
=== sources/todo/config.ini ===
uri = Task
backend = todo
=== sources/memo/config.ini ===
uri = Memo
backend = memo

View File

@ -10,12 +10,16 @@ ConsumerReady = 1
=== sources/addressbook/config.ini ===
uri = Contact
backend = addressbook
=== sources/calendar/config.ini ===
uri = Calendar
backend = calendar
=== sources/todo/config.ini ===
uri = Task
backend = todo
=== sources/memo/config.ini ===
uri = Memo
backend = memo

View File

@ -10,18 +10,25 @@ ConsumerReady = TRUE
RetryInterval = 0
=== sources/addressbook/config.ini ===
sync = two-way
uri = card
backend = addressbook
=== sources/calendar/config.ini ===
sync = two-way
uri = event
syncFormat = text/calendar
forceSyncFormat = 1
backend = calendar
=== sources/todo/config.ini ===
sync = two-way
uri = task
syncFormat = text/calendar
forceSyncFormat = 1
backend = todo
=== sources/memo/config.ini ===
sync = two-way
uri = note
backend = memo

View File

@ -1,21 +1,28 @@
=== template.ini ===
fingerprint = ScheduleWorld, default
description = http://www.scheduleworld.org
description = server no longer in operation
=== config.ini ===
syncURL = http://sync.scheduleworld.com/funambol/ds
WebURL = http://www.scheduleworld.com
=== sources/addressbook/config.ini ===
sync = two-way
uri = card3
syncFormat = text/vcard
backend = addressbook
=== sources/calendar/config.ini ===
sync = two-way
uri = cal2
backend = calendar
=== sources/todo/config.ini ===
sync = two-way
uri = task2
backend = todo
=== sources/memo/config.ini ===
sync = two-way
uri = note
backend = memo

View File

@ -647,15 +647,18 @@ class TestingConfiguration():
configini["SyncMLVersion"] = config.version
sourceini["sync"] = "two-way"
sourceini["uri"] = config.uri
sourceini["type"] = "%s:%s" % (source, strip_version(config.type))
sourceini["backend"] = source
sourceini["syncFormat"] = strip_version(config.type)
sourceConfigInis[source] = sourceini
# create 'calendar+todo' entry, disable separate 'calendar' and 'todo'?
if have_combined:
sourceini = {}
sourceini["evolutionsource"] = "calendar,todo"
sourceini["sync"] = "two-way"
sourceini["database"] = "calendar,todo"
sourceini["uri"] = self.wConfigs['calendar'].uri
sourceini["type"] = "virtual:%s" % strip_version(self.wConfigs['calendar'].type)
sourceini["backend"] = "virtual"
sourceini["syncFormat"] = strip_version(self.wConfigs['calendar'].type)
sourceConfigInis['calendar+todo'] = sourceini
# disable the sub datasources
for source in ('calendar', 'todo'):