Commit graph

3860 commits

Author SHA1 Message Date
Jussi Kukkonen
fa6dc330d0 syncevo-dbus-server: local configs should be 'present' (BMC #19488)
GetPresence and PresenceChanged should always return ""
(meaning MIGHTWORK) for local configurations.
2011-06-17 15:18:20 +02:00
Patrick Ohly
dade1731dd WebDAV: use "database" for resoure URL
The "database" property now can hold the final URL of the collection
(aka database) on the WebDAV server which is used for the
source. Setting it skips the entire auto-discovery process, which
makes access quite a bit faster and more reliable.

Because most UIs won't know initially how to find these URLs (listing
them not supported by the core SyncEvolution) and/or won't have the
necessary user dialogs, the property is set automatically after a
successful sync. This avoids the accidental switching between databases
when the user adds or removes databases on the server (which can lead
to different results of the auto discovery).

There's still no guarantee that the database picked by default is the
"right" one. That can only be solved in the UI because servers
typically don't have a "default" or "personal" flag for their
collections.
2011-06-17 15:01:37 +02:00
Patrick Ohly
1249834eef NeonCXX: fixed URI to URL conversion
The conversion from a parsed URI to a string URL dropped the query
part and introduced redundant characters when port, userinfo and
fragment were empty.

It also introduced an extra slash before the path, which broke Google
Calendar with cached URLs (400 "bad request" error when using a path
with double slashes at the beginning).
2011-06-17 15:01:37 +02:00
Patrick Ohly
b807e55158 testing: use WebDAV specific test cases for Client::Source::*::testImport
google_event.vcf and yahoo_contact.vcf were introduced together
with a configuration mechanism for selecting them because
different peers may need non-default test cases to pass the
testImport test. But the actual testing didn't use that yet - fixed.
2011-06-17 21:00:01 +08:00
Salvatore Iovene
f1783780f8 Merge branch 'master' of gitorious.org:meego-middleware/syncevolution 2011-06-17 05:17:01 -07:00
Salvatore Iovene
170b95ef0d NotificationManagerFactory: fallback to No-op backend if no other backend is present. 2011-06-17 05:09:15 -07:00
Jussi Kukkonen
014ea40eca Update NetworkManager Status-handling to 0.9 API (BMC #19470)
NetworkManager 0.9 changes the values of
org.freedesktop.NetworkManager.Status property. Fortunately the new
and old values are not in conflict.

Commit also starts setting presence to false only when we know this
should happen (and not the other way around): It's better to fail
this way than prevent user from syncing if things like this happen.
2011-06-17 12:39:52 +02:00
Jussi Kukkonen
6d4dde465e Specify interface name in NM DBus GetProperty call
NetworkManager 0.9 is more strict about the call arguments: it seems
newer dbus-glib requires that the interface name is specified, otherwise
there is an AccessDenied error.
2011-06-17 12:39:05 +02:00
Patrick Ohly
92ffd58e7a Google CalDAV: fixed the child hack
Google CalDAV does not deal well with a detached recurrence that has
no parent. The "Google child hack" avoids *adding* such a recurrence,
but it missed the case where the same problem occurs when removing the
parent before the children. Added similar code to the partial removal
code path.
2011-06-17 12:34:50 +02:00
Patrick Ohly
c07c34c77e Google CalDAV: fixed corner cases in delete hack
There were still several cases where the "Google delete hack" (= catch
 409 "Can't delete a recurring event except on its organizer's
 calendar", update item, delete again) did not work.

Sometimes it failed when only an EXDATE was set => also remove
EXDATE, not just RRULE, to convince the server that the event is not
recurring.

Sometimes it failed because the DELETE came too soon after the PUT
(?!). Added a retry loop.
2011-06-17 12:30:55 +02:00
Patrick Ohly
6022d0888b Google CalDAV: fixed corner case in update hack
When updating a meeting series by adding a child, the series' SEQ
value was not increased if the new child already had a higher SEQ
value. Then the updating failed because the other events in the series
didn't have a higher SEQ than on the server.

Fix this by always bumping first, then comparing against the new
event.
2011-06-17 12:28:08 +02:00
Patrick Ohly
78955078fa testing: remove "meeting invitation" from Google CalDAV test cases
The Google server seems to think that it can take over meeting
acceptance/decline handling when new events are stored on the server.

For example, PARTSTAT=ACCEPTED gets replaced with PARTSTAT=NEEDS-ACTION.
It has also been observed that participants and organizer get overwritten.

This needs further investigation, see BMC #19484. In the meantime I am
removing the problematic test case to get the testImport test to pass.
2011-06-17 12:10:54 +02:00
Patrick Ohly
1a40a29d9a local sync: remove timeouts for SyncML messages
Timeouts for the SyncML messages between master and child did not
make sense. In HTTP they are necessary to detect dead peers, but with
permanent pipes between both sides that isn't an issue.

Because the timeouts triggered incorrectly, this patch removes them by
never setting the m_timeoutSeconds member variable. For sending the
child's status report a fixed timeout of 5 minutes (the previous
default) continues to be used, just in case that something goes
horribly wrong (software bug) and sending the report somehow hangs
(which it shouldn't).
2011-06-16 22:48:53 +02:00
Patrick Ohly
2bd2f135c1 Timespec: added unsigned addition/substraction
Allow adding or substracting unsigned seconds without
forcing a type conversion.
2011-06-16 22:20:41 +02:00
Patrick Ohly
f8a8f9488d autotools: NotificationBackendLibnotify.cpp added to POTFILES.in
NotificationBackendLibnotify.cpp contains translated strings,
originally found in syncevo-dbus-server.cpp. It must be added
to POTFILES.in, the list files which are to be translated, to
ensure that these strings remain translated.
2011-06-16 21:43:02 +02:00
Patrick Ohly
71f0c41440 autotools: fixed "make dist", part II
Yet another header file was missing...
2011-06-16 20:41:47 +02:00
Patrick Ohly
a4b2353867 autotools: fixed "make dist"
Header files must be listed explicitly in autotools. Otherwise
they are not getting included in source tar balls. "make distcheck"
exposes that problem.
2011-06-16 19:36:32 +02:00
Patrick Ohly
871d55a9d3 NotificationBackendLibnotify: fixed compile problem
Initializing a pointer with false is not correct. With -Wall -Werror,
clang aborts.
2011-06-16 19:29:19 +02:00
Patrick Ohly
23cfd6a824 WebDAV + Google: fixed detecting of Google's "unavailable" redirect
Google temporarily redirects to a special URL when the calendar is
down. The check() function already recognized this and just told
the caller to try again. But Session::propfind*() methods threw
a redirect exception themselves before giving check() a chance to
catch the special case.

Solved by keeping ne_propfind_handler instance valid during the check()
call (necessary because deleting it would also delete the ne_status
needed by check()) and calling check() directly with all the needed
information.

The handler will be deleted by a destructor class in combination with
boost::shared_ptr when leaving propfindURI() or when trying again
with a fresh handler in the retry loop.
2011-06-16 18:24:39 +02:00
Patrick Ohly
73e3872e36 password request: avoid calling it "SyncML server" password
The description of the "password" property was "SyncML server",
which was used by the command line password prompt:
"Enter password for SyncML server: ..."

Given that the property now also is used for CalDAV credentials and
the prompt did not tell the user for which SyncML server they were
asked, it is better to use the config name as description. Now the
password prompt is, for example:
"Enter password for @google-calendar: ..."

Keyring access is not affected by this change because the password
description was not used to find or describe the stored password.
2011-06-16 18:24:03 +02:00
Patrick Ohly
792d6bc99a local sync: fixed password handling
There still was a TODO in the code for handling "-" as password value.
No surprise, not having that implemented broke CalDAV sync in
syncevo-dbus-server because it would try to read the password from
stdin (the default in SyncContext).

Probably SyncContext shouldn't provide such an unsafe fallback, but
that's something for another patch.

This patch addresses the immediate problem by moving the
initialization of the SyncContext used by the child process into the
master process and adding the password checking directly afterwards
(LocalTransportAgent::start()). It runs in the main process
(syncevolution or syncevo-dbus-server) and uses the "request password"
method of the main sync context. Passwords are then stored
temporarily, so the same check doesn't have to ask for passwords again
in the child  process.

Long term we'll need to rewrite the complete password handling...
2011-06-16 18:24:03 +02:00
Patrick Ohly
b534702c0c SyncConfig: removed obsolete check/save*Password() methods
This was replaced at some point with iterating over registered properties
(see SyncContext::sync()) without removing the obsolete methods. Removing
them now to avoid further confusion.
2011-06-16 18:24:03 +02:00
Patrick Ohly
b0da933afb mlite notifications: fixed configure issues
Explicit --enable-mlite didn't enable mlite (enable_mlite not set).
The default is now to not enable it in any case (even if available),
so traditional users won't have to add --disable-mlite to suppress
the error about it being not installed.

The code which depends on mlite must not be compiled if the feature
is disabled, because if mlite is not installed, it would cause compile
errors.
2011-06-16 18:17:21 +02:00
Patrick Ohly
efbce3eef9 autotools: squashed some more automake warnings
autotroll.mk sets DISTCLEANFILES and EXTRA_DIST, therefore Makefiles
which include it should add to those instead of setting them anew.
2011-06-16 15:54:03 +02:00
Salvatore Iovene
9131bd4446 Merge branch 'notifications' 2011-06-15 06:57:52 -07:00
Salvatore Iovene
8d771ab4d7 syncevo-dbus-server: notifications system made more generic.
The notifications system has been made template based. There is
a Factory object that creates NotificationManagers with the correct
template (mlite, libnotify, or a dummy no-op) according to the
platform.
2011-06-15 06:44:34 -07:00
Jussi Kukkonen
cfa5f08a31 GTK sync UI: Fix WebDAV config ignoring
Fix my own amateurish g_strcmp0() mistake. Also check url existence
to avoid g_str_prefix() complaining.
2011-06-14 08:47:30 +02:00
Patrick Ohly
a38c914087 nightly testing: handle "empty patch file" case
If (for whatever reason) the patch file is empty, we
shouldn't invoke the "patch" command. Some implementations
of it then complain instead of copying the input file.

This commit adds a copying of the original test case file
if the corresponding patch file exists and is empty.
2011-06-09 09:30:39 +02:00
Patrick Ohly
328da6ad63 Revert "src/Makefile-gen.am: ignore empty template patch files."
This reverts commit c1aaf7128e.

This patch doesn't work because the composed patch for valid
patches is no longer piped into the "patch" command due to
the additional test command in the middle. Will commit a different
solution.
2011-06-09 09:29:32 +02:00
Patrick Ohly
4dde831dd5 config templates: added missing .ini templates for servers
The "webdav-config" branch didn't have all files committed
and thus lacked the traditional set of SyncML servers.
2011-06-08 23:10:23 +02:00
Jussi Kukkonen
55bb8bbc19 autotools: check for testcase existence (dash compat)
The "-ot" ant "-nt" operators are not standard (dash -ot returns
false if file1 is missing, bash does not). Check for test case
existence explicitly.
2011-06-08 19:22:09 +02:00
Jussi Kukkonen
c1618a0b87 GTK sync UI: Ignore Webdav-related configs temporarily
Ignore "peerType = WebDAV" configurations as well as the
configurations with syncURL starting with "local://@" temporarily
(before we actually support WebDAV in the UI).
2011-06-08 19:22:09 +02:00
Patrick Ohly
db68674adb Buteo: also support Google Contacts via SyncML
This patch adds .xml configs which replace the google-contacts from
the patched Buteo plugins. The glue code configures it as the normal
"google" config.
2011-06-08 19:19:54 +02:00
Patrick Ohly
10109fd208 WebDAV + command line: simplify creation of source-config@yahoo|google-calendar
This patch teaches the command line how to infer the right template
for a source-config@<something> config creation:
   syncevolution --configure source-config@google-calendar

For this particular example, "google-calendar" must match the "Google
Calendar" fingerprint in the template. Spaces, hyphen and underscores
are now all considered equal in TemplateConfig::fingerprintMatch().

Also added CmdlineTest::testWebDAV unit test. The test can only run if
WebDAV support is enabled, because otherwise the
backend=CardDAV/CalDAV would be rejected.
2011-06-08 12:19:51 +02:00
Patrick Ohly
33f0c9c3f6 WebDAV: added templates for Yahoo and Google
This patch introduces the new "peerType" property which marks
templates and configs as something that can be used for the
'source-config@<target>' configs necessary for local sync.

Only "WebDAV" is used. If peerType is not set, the template or config
is traditional SyncML.

This patch also adds two templates, one for Google Calendar and one
for Yahoo CardDAV and CalDAV. Because Yahoo CardDAV is unreliable,
it is not enabled.
2011-06-08 12:19:51 +02:00
Patrick Ohly
bfb7a85f84 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.
2011-06-08 12:19:51 +02:00
Patrick Ohly
bf5793ba57 SyncConfig: avoid reading template if not needed
In TemplateConfig::fingerprintMatch the peerIsClient property only
matters when the mode is either "match only clients" or "match only
servers".

This patch checks for this first before reading the template.
Minor optimization, not performance critical.
2011-06-08 12:19:51 +02:00
Patrick Ohly
77765950a4 SyncConfig: allow SYNCEVOLUTION_TEMPLATE_DIR to start with a dot
The check with "starts with ." probably was meant to filter out hidden
files. Because it was applied to the full path, including the
directory names, it didn't have that effect. Instead it skipped all
entries of the template dir started with a dot, as in "./templates".

That was used in one of the Cmdline unit tests and only worked while
none of the templates there were needed for the test. It started to
fail after removing the builtin templates.
2011-06-08 12:19:51 +02:00
Patrick Ohly
c72ca29f5c Cmdline: better error reporting when unit tests fail
Better check error message before return code. That way
a non-zero error is visible in the output instead of
only the failed run check.

Calling doit() would be shorter, but hide the actual location
of the failure.
2011-06-08 12:19:51 +02:00
Patrick Ohly
f04988de68 Cmdline: cleaned up unit testing
Moved removal and creation of the test directory (= "CmdlineTest")
into the test setup method. That way all tests are guaranteed to
start in a clean state, without having to duplicate that all over
the place.

Motivated by the observation that at least one test didn't have the
necessary cleanup, which caused a failure when creating more
templates.
2011-06-08 12:19:51 +02:00
Patrick Ohly
78f1c3495c autotools: make src/templates a symlink
If compilation and testing runs outside of the original source,
the src/testcases must be made available to "client-test". This
used to be done with a full copy, but that means that changes
made later are not reflected in later tests. Better use a symlink.

Also remember to remove it as part of "make clean".
2011-06-08 12:19:51 +02:00
Patrick Ohly
fe67c53de5 D-Bus + templates: on-disk templates were not listed
Same bug as in command line (previous commit). Scanning
for on-disk templates only considered Bluetooth devices.

For server templates, only the ones built into SyncEvolution
were returned.
2011-06-08 12:19:50 +02:00
Salvatore Iovene
bbe95b753c src/Makefile-gen.am: fix the name of the test executable (client-test)
For some reason the 'valgrind' target attempted to run valgrind on a
./test executable. Perhaps it's a leftover from the past, as it should
be ./client-test.
2011-06-07 16:07:45 +02:00
Salvatore Iovene
6e2f5e0b14 test/test-dbus.py: syntax.
There was no global name 'pserver', as pserver really is a static
member of the DBusUtils. How did this work before? :)
2011-06-07 16:07:45 +02:00
Salvatore Iovene
09a09a89ed test/{ClientTest,client-test-main}.cpp: fix warnings.
The return value of 'system' should not be ignored.
2011-06-07 16:07:45 +02:00
Salvatore Iovene
ea4e811dda client-test-app.cpp: if(a||a) -> if(a). 2011-06-07 16:07:45 +02:00
Salvatore Iovene
c1aaf7128e src/Makefile-gen.am: ignore empty template patch files.
Nightly compilation was failing because empty template patch files
would result in an error like the following:
patch: **** Only garbage was found in the patch input.
Making sure that the patch file is not empty before trying to apply
the patch fixes the problem.
2011-06-07 16:07:45 +02:00
Gabriel Schulhof
2172a65136 Qt D-Bus bindings: give the D-Bus type registration function a more appropriate name 2011-05-20 14:31:05 +03:00
Gabriel Schulhof
93b6aa8620 Formatting: remove strange leading whitespace from dbustypes.cpp and dbustypes.h 2011-05-20 14:29:59 +03:00
Gabriel Schulhof
9a849f6588 autotools: Add moc files to BUILT_SOURCES in src/dbus/qt 2011-05-18 11:21:06 +03:00