GTK UI + config: fix "custom server" setup (BMC #13511)

When the "default" config template (= ScheduleWorld) was downgraded to
"not consumer ready" in SyncEvolution 1.1.0.99.1, setting up a custom
SyncML service in the GTK UI stopped working because the UI wouldn't
show the "not consumer ready" config.

Fixed by changing the "default" config:
- always has ConsumerReady = 1
- PeerName empty
- based on SyncEvolution server template (not essential,
  but has saner, minimal settings for all sources and
  will make it easier to remove the ScheduleWorld template)

It is uncertain why the initial bug report says that the failure is
random and why Jussi was unable to reproduce the problem. The problem
describe above is deterministic. So perhaps there is also another,
related issue.
This commit is contained in:
Patrick Ohly 2011-11-17 14:30:15 +01:00
parent 12562fb928
commit 220d60caae
4 changed files with 34 additions and 5 deletions

View File

@ -2617,9 +2617,9 @@ protected:
NULL);
cmdline.doit();
string res = scanFiles(root, "some-other-server");
string expected = ScheduleWorldConfig();
string expected = DefaultConfig();
sortConfig(expected);
boost::replace_all(expected, "/scheduleworld/", "/some-other-server/");
boost::replace_all(expected, "/syncevolution/", "/some-other-server/");
CPPUNIT_ASSERT_EQUAL_DIFF(expected, res);
}
@ -2867,7 +2867,7 @@ protected:
CPPUNIT_ASSERT_EQUAL_DIFF("", cmdline.m_err.str());
string actual = injectValues(filterConfig(cmdline.m_out.str()));
CPPUNIT_ASSERT(boost::contains(actual, "deviceId = fixed-devid"));
CPPUNIT_ASSERT_EQUAL_DIFF(filterConfig(internalToIni(ScheduleWorldConfig())),
CPPUNIT_ASSERT_EQUAL_DIFF(filterConfig(internalToIni(DefaultConfig())),
actual);
}
@ -4326,6 +4326,24 @@ private:
boost::scoped_array<const char *> m_argv;
};
string DefaultConfig() {
string config = ScheduleWorldConfig();
boost::replace_first(config,
"syncURL = http://sync.scheduleworld.com/funambol/ds",
"syncURL = http://yourserver:port");
boost::replace_first(config, "http://www.scheduleworld.com", "http://www.syncevolution.org");
boost::replace_all(config, "ScheduleWorld", "SyncEvolution");
boost::replace_all(config, "scheduleworld", "syncevolution");
boost::replace_first(config, "PeerName = SyncEvolution", "# PeerName = ");
boost::replace_first(config, "# ConsumerReady = 0", "ConsumerReady = 1");
boost::replace_first(config, "uri = card3", "uri = addressbook");
boost::replace_first(config, "uri = cal2", "uri = calendar");
boost::replace_first(config, "uri = task2", "uri = todo");
boost::replace_first(config, "uri = note", "uri = memo");
boost::replace_first(config, "syncFormat = text/vcard", "# syncFormat = ");
return config;
}
string ScheduleWorldConfig(int contextMinVersion = CONFIG_CONTEXT_MIN_VERSION,
int contextCurVersion = CONFIG_CONTEXT_CUR_VERSION,
int peerMinVersion = CONFIG_PEER_MIN_VERSION,

View File

@ -810,6 +810,17 @@ boost::shared_ptr<SyncConfig> SyncConfig::createPeerTemplate(const string &serve
}
}
}
// "default" maps to SyncEvolution server template, which is not
// consumer ready. When used as "default" by the GTK sync UI,
// the UI expects the "consumer ready" flag to be set. Do that
// here. Also unset the peer name, because otherwise it shows
// up in the UI.
if (server == "default") {
config->setConsumerReady(true);
config->setUserPeerName("");
}
return config;
}

View File

@ -1,5 +1,5 @@
=== template.ini ===
fingerprint = ScheduleWorld, default
fingerprint = ScheduleWorld
description = server no longer in operation
=== config.ini ===

View File

@ -1,5 +1,5 @@
=== template.ini ===
fingerprint = SyncEvolution
fingerprint = SyncEvolution, default
description = http://www.syncevolution.org
=== config.ini ===