Commit graph

556 commits

Author SHA1 Message Date
Ove Kåven
b52d20adc1 In KCalExtendedSource::open(), only load the contents of the notebook
we actually plan to sync, not all notebooks in the storage.
(cherry picked from commit 9c6685b803)
2012-09-25 21:56:10 +02:00
Ove Kåven
9399b8f2b3 When listing mkcal calendars, show notebook UID instead of storage,
and allow this UID to be used for selecting a particular calendar.
Since all listed calendars are in the default storage anyway,
the UID is far more useful to have. (On the N9, knowing the
physical storage does not help the user at all anyway, as access
to it is restricted and needs to go through the API anyway.)
(cherry picked from commit a5c2939c1d)
2012-09-25 21:56:00 +02:00
Ove Kåven
afa2633365 Fix to result code of incidence updates.
(cherry picked from commit 06f08ecb5a)
2012-09-25 21:55:52 +02:00
Ove Kåven
6d517f9e5e Merge tag 'syncevolution-1-3' into FREMANTLE-1-3-0 2012-09-25 21:50:47 +02:00
Patrick Ohly
c3049f3eb5 ActiveSync: avoid dangling const char pointer
The m_account variable was set to a temporary std::string. Better
copy use a std::string for m_account.
2012-08-31 19:04:20 +00:00
Patrick Ohly
d56c1b7b8f KDE: check for D-Bus to avoid crash in KApplication (BMC #25596)
Some unnamed version of KDE crashes in KApplication when invoked
without a D-Bus session. The reporter ran into this when compiling
from source, because the SyncEvolution binary is invoked as part of
the build process, which ran outside of a D-Bus session.

Avoid the crash by checking for a D-Bus session bus with
QDBusConnection::sessionBus().isConnected() before instantiating
KApplication. The QDBusConnection API does not say explicitly when it
connects to the daemon, but testing shows that in practice this
detects missing env variables and an unreachable daemon right away as
expected, while passing when the daemon can be contacted.

Instantiating KApplication was added for KWallet support. Without
D-Bus, KWallet does not work either, therefore throw an explicit error
when the lack of D-Bus was detected.
2012-08-16 18:49:52 +02:00
Ove Kåven
f314480d3e Activate the SyncSourceLogging stuff in the Maemo calendar backend. 2012-08-12 17:41:44 +02:00
Ove Kåven
cde144325f Make syncevolution-webdav-lookup work with the shells and
the "host" binaries available on Maemo.
2012-08-12 16:53:42 +02:00
Ove Kåven
91a5f70a9d Fixed broken rule for creating syncevo-webdav-lookup. 2012-08-11 12:35:00 +02:00
Ove Kåven
2333f8e495 Updates for Maemo calendar backend. 2012-08-10 08:13:39 +02:00
Ove Kåven
ea16d76011 Various packaging and build system patches for the Maemo 5 port. 2012-08-07 01:32:09 +02:00
Ove Kåven
c4b73b49ff Merge tag 'syncevolution-1-2-99-3' into FREMANTLE-1-2-99-3 2012-08-05 04:02:44 +02:00
Patrick Ohly
428a959af2 EDS: added support for EDS 3.5.x
When compiled against EDS 3.5.x or later, SyncEvolution now uses
the backend code originally written for the EClient API introduced
in EDS 3.2. That code was changed so that it works with the new
include file rules and ESourceRegistry in EDS 3.5.x. Support
for using the EClient API with EDS 3.4 was removed because maintaining
three different flavors of the EDS backend code would be too much
work and not gain much (just the possibility to test the EDSClient
code with 3.4).

At the moment, this is a compile time choice made automatically
by configure. syncevolution.org binaries are compiled against
an older EDS and thus do not work with EDS 3.5.x or later.

EDS 3.5.x handles authentication itself, using a standard system
prompt if necessary. SyncEvolution can no longer provide the password,
and thus the "databaseUser/Password" options have no effect when using
EDS 3.5.x.

The patch leaves code for older EDS almost completely unchanged and
therefore is considered safe for the stable release series leading to
1.3. Using EClient is an all-or-nothing choice now, because the common
EvolutionSyncSource needs to be compiled differently. Thanks to the
reorganized API, a lot more common code for ECal and EBook sources
could be moved into EvolutionSyncSource.
2012-07-24 08:25:20 +00:00
Patrick Ohly
f1b14c6418 AutoSync: fixed testing
Instantiating an ActiveSyncSource for testing must work with
empty database names now. Testing no longer forces the
database to be set.

While at it rewrote the code to avoid the explicit pointer.
2012-07-20 12:52:37 +00:00
Patrick Ohly
abc81eb117 ActiveSync: added some debug output
Tracking down account settings can be tricky. Explain it in
a debug message.
2012-07-20 12:51:32 +00:00
Patrick Ohly
8fcca74be7 ActiveSync: enable integration testing in all cases
A backend cannot know whether it'll be used together
with a client-test which supports integration testing.
Therefore the backend should always register its tests.
2012-07-18 13:30:33 +00:00
Patrick Ohly
81272fefdc ActiveSync: fixed updating of contacts on Google during a sync
Updating failed when using Google because the Synthesis engine
tried to read the existing item in order to merge it with
the update. This failed because Google does not implement the
Fetch command.

Pretending to update the item intelligently avoids that. It
also helps to improve performance of updates with Exchange.
The downside is that syncing with local storages which do
not support all ActiveSync fields will cause data loss.

Need to check whether Exchange-only attributes get lost
also when the local storage supports everything, for
example because activesynd unintentionally removes data.
2012-07-18 13:22:42 +00:00
Patrick Ohly
e9796468bb ActiveSync: adapted slow sync handling
The error message for "Invalid synchronization key" changed in
activesyncd, now it contains the D-Bus error type as prefix. Fixed by
doing a substring search.

Also, not freeing the GError before trying again is a bug. Apparently
that was ignored earlier, now it triggers an assert.
2012-07-17 09:28:30 +02:00
Patrick Ohly
15f2d03184 autotools: ensure that link lines are complete
As mentioned by Tino Keitel on the mailing list, some libs and
executables were only implicitly linked against libraries that they
called directly. This happened to work by chance because these libraries
ended up in the running executable anyway, due to indirect loading.

To catch such problems, the "make installcheck" was extended:
dpkg-shlibdeps is run, if available, and the error output is scanned
for the messages which indicate that a symbol is used without linking
to the right library (example output below).

Had to fix quite a few _LIBADD lines to pass the test.
Some exceptions are allowed:
- libsmltk depends on the caller providing SySync logging support.
- libneon is intentionally not linked explicitly for syncevolution.org
  binaries, to make resulting binaries work with GNUTLS and OpenSSL.

dpkg-shlibdeps: warning: debian/syncevolution-libs/usr/lib/syncevolution/backends/syncdav.so contains an unresolvable reference to symbol icalparameter_new_from_value_string: it's probably a plugin.
dpkg-shlibdeps: warning: 51 other similar warnings have been skipped (use -v to see them all).
...
dpkg-shlibdeps: warning: symbol dlsym used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
dpkg-shlibdeps: warning: symbol dlerror used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
dpkg-shlibdeps: warning: symbol dlopen used by debian/libsyncevolution0/usr/lib/libsyncevolution.so.0.0.0 found in none of the libraries.
2012-07-12 16:11:33 +00:00
Patrick Ohly
5947ba419f CalDAV + syncevolution.org: fixed segfault without libical+libecal
When libical and libecal were not installed, trying to use the CalDAV
backend for VEVENTs segfaulted because it depends on libical and did
not check properly for it. Only affected syncevolution.org binaries.

The root cause is that libical functions were only looked up in
combination with libecal, when compiled with
--enable-evolution-compatibility. Now they are first checked via
libecal (for old libecal which embedded libical) and separately in
libical itself as fallback.
2012-07-10 15:10:14 +02:00
Patrick Ohly
2673b67981 testing: fixed testInsertTwice
Backends need to declare how they'll react to inserting
the same item (= same UID) item twice.
2012-07-10 09:37:24 +00:00
Patrick Ohly
1f1009aaf6 Google Calendar: updated URL redirect handling
Google Calendar sometimes returns redirect requests to human-readable
web sites (an "unavailable" page, a login form). This is of course
bogus when the client is an automated CalDAV client.

The "unavailable.html" case was already handled. Made it a bit more
flexible to also catch possible variations of it (additional
parameters, https instead of http).

Added the https://accounts.google.com/ServiceLogin case. Not sure
whether retrying will help in that case, but there's not much else
that SyncEvolution can do.
2012-07-02 15:08:01 +02:00
Patrick Ohly
2add74a5ea WebDAV: handle UID conflicts
When asked to insert a VJOURNAL which already existed (= same UID),
CalDAV servers respond with a 412 "Precondition failed" error. This
needs to be detected and translated into an "item needs to be merged"
result so that the engine can load the existing item, merge the data,
and then write back.

A test for this, testInsertTwice, will be committed separately.  The
code was written so that it handles the same error when using CardDAV.
However, this was not tested because CardDAV test data does not have a
UID (wouldn't trigger the problem) and Radicale did not report 412 when
adding the UID.
2012-07-02 14:51:09 +02:00
Patrick Ohly
ff64158435 WebDAV: updated Radicale 412 -> 404 workaround
Instead of relying on catching an exception, better use the new
"expected status codes" feature and check for 412 as part of the
normal switch statement.
2012-07-02 14:07:51 +02:00
Patrick Ohly
68ff18bba4 WebDAV: added possibility to accept certain error codes
Some WebDAV requests might fail with a non-okay status code that the
caller expects. This was reported via an exception. But
SyncEvolution's design uses exceptions only for non-normal
incidencences. Therefore better allow the caller to indicate which
status codes are expected and return normally from run() and
checkError() when those are encountered, without retrying and without
throwing an exception.
2012-07-02 14:06:08 +02:00
Patrick Ohly
c81a7fceaf WebDAV: fixed data corruption issue when uploading item with long UID
In some cases data with a very long UID wasn't handled correctly,
causing the out-going data to be malformed and probably causing a
rejection by the server.

The root-cause was two-fold:
- extractUID() didn't expect folding. Normally it deals only with
  data encoded by libsynthesis, which does not use folding; the unexpected
  exception was data which gets imported directly (--import).
- setResourceName() used std::string::replace() incorrectly: second
  parameter is length, not end offset, of the data to be replaced.
2012-06-29 11:36:32 +02:00
Patrick Ohly
3d299422f9 WebDAV: --status for WebDAV source aborted
The command line --status operation did not complete when applied to a
CalDAV/CardDAV source. Instead it aborted because the operation took a
code path where the backend was not fully initialized.
2012-06-29 11:36:32 +02:00
Patrick Ohly
a7b569074a WebDAV: print INFO messages when access gets delayed
Sometimes the backend has to resend requests because of temporary
issues. If the problem turned out to be permanent, there was a long
period of time, retryDuration=5 minutes to be precice, in which no
visible progress happened.

Now SyncEvolution's WebDAV backend will print a message like this
before going to sleep until it is time to retry:

[INFO @client-test-googlecalendar] operation temporarily (?) failed, going to retry in 5.0s before giving up in 18.4s: PROPFIND: Neon error code 1: 401 Unauthorized

The uncertainty comes from several factors. In this example, the 401
might indicate a permanent problem (wrong credentials), or it could be
Google reporting a temporary authorization problem which is (probably)
meant to slow down the client while it asks the user to re-enter the
password. SyncEvolution only asks for passwords once, so it tries
again with the same password if it was successful with it in the
past. Otherwise it gives up immediately.

Another dubious example are name server lookup errors. They can be
ermanent (wrong host name) or temporary (name server
down). SyncEvolution errs on the side of retrying, to avoid
interrupting an operation which still has a chance to continue.

Currently this output is only visible in combination with --daemon=no,
because when using syncevo-dbus-server the output is not passed on
properly.
2012-06-28 14:38:32 +02:00
Rohan Garg
1f83a25513 Use proper paths to link to libraries 2012-06-25 10:31:43 +02:00
Patrick Ohly
b2a8365e44 WebDAV: improved support for aborting while resending
The message resend loop in the WebDAV backend did not check abort
requests. Now the error which caused the resend is reported
immediately in case of an abort. The actual send/receive still cannot
be interrupted, as it happens inside libneon with little chances to
influence the execution (?).
2012-06-20 12:27:39 +02:00
Patrick Ohly
3716ae2c9a core, WebDAV: improved support for aborting while sleeping
When waiting for resending a failed message, the sleeping couldn't be
interrupted when using the D-Bus server. It now uses the SuspendFlags
infrastructure and glib, which detects abort requests sent via D-Bus
in addition to those sent via signals (which already worked earlier).
2012-06-20 12:26:43 +02:00
Patrick Ohly
16e0b4af19 WebDAV: exchange VJOURNAL as iCalendar 2.0 or plain text
Use the new "text/calendar+plain" type so that "caldavjournal" can be
used with peers which do not support iCalendar 2.0 for memos.
2012-06-15 14:20:25 +02:00
Patrick Ohly
20398db1e7 WebDAV: moved UID manipulation into base class
CalDAV VJOURNAL and VTODO need similar UID handling as VCARD: when
creating or updating an item, ensure that it has a UID in the
payload.

It may also help to match that with the resource name and use
.ics/.vcf as suffix of the resource name. It was necessary for Yahoo's
CardDAV support and doesn't hurt elsewhere.

When updating, the merging with local data now ensures that any UID
different from the resource is properly preserved when the incoming
data has no UID.
2012-06-15 12:25:53 +02:00
Patrick Ohly
5014f9b105 backends: merge with incoming data by default
All backends except for EDS replaced local data wholesale with an
incoming update, even if that update came from a peer which did not
store all properties. The EDS backend had already been configured
earlier to always merge remote and local data before writing it back.

Instead of updating each backend individually it makes more sense to
make the more intelligent (and more expensive) merging the default in
backends derived from SyncSourceSerialize/TrackingSyncSource. Backends
which do not want it can remove
"<updateallfields>true</updateallfields>" from
SynthesisInfo::m_datastoreOptions.
2012-06-15 12:25:52 +02:00
Patrick Ohly
5bc01e7990 CalDAV: support VJOURNAL + VTODO (BMC #24893)
The new backend property values "CalDAVTodo" and "CalDAVJournal"
select tasks resp. memos stored in a CalDAV collection. "CalDAV"
continues to select events.

Events, tasks and journals can be mixed in the same resource (=
URL). However, this is less efficient than storing them separately.

A good CalDAV server allows filtering items by type, and SyncEvolution
uses that. However, it was found that Radicale 0.7 ignores this
filtering, which could have led to data loss (SyncEvolution asks for
all VTODOs in preparation for a "delete all items" operation in a
"CalDAVTodo" source, gets also VJOURNALs, then deletes them).

Therefore SyncEvolution plays it safe and downloads the VTODO and
VJOURNAL data to double-check that it is working on the right items.
This causes additional traffic for well-behaving servers; currently
it cannot be turned off.

What is missing for VJOURNAL is the conversion to plain text (see BMC
not possible yet.
2012-06-15 12:25:52 +02:00
Patrick Ohly
497a9bec74 WebDAV: handle 200 response to delete
Radicale reports 200 'Okay' instead of 204 when asked to delete an
existing item. Was triggering a status error. Found when running
Client::Source test against Radicale 0.7-7-g186c59c; 0.7 still
returned 204, see http://redmine.kozea.fr/issues/802.
2012-06-15 12:25:52 +02:00
Patrick Ohly
fdaf27f7e5 WebDAV: handle 412 response to delete
Radicale reports 412 'Preconditiona Failed' instead of 404 when asked
to delete a non-existent item. Translate that into the 404 expected by
the Synthesis engine. Found when running Client::Source test against
Radicale 0.7-7-g186c59c.
2012-06-15 12:25:52 +02:00
Patrick Ohly
5e82815b5c WebDAV: handle 410 response to read
Radicale reports 410 'Gone' instead of 404 when asked to read a
non-existent item. Translate that into the 404 expected by the
Synthesis engine. Found when running Client::Source test against
Radicale 0.7-7-g186c59c.
2012-06-15 12:25:52 +02:00
Patrick Ohly
eafc81c08d command line: allow setting empty properties
Due to the way how properties were handled internally, it wasn't
possible to explicitly set a property to its default value. Instead
the property was unset. For example, explicitly setting database= was
not possible.

This is necessary for client-test and ActiveSync, because client-test
needs to know that the testing is expected to run with the default
databases (something which normally is avoided by overwriting empty
database properties).

Now the "is set" state is tracked explicitly in the config storage and
command line property APIs. Unsetting a property via the command line
could be implemented with an explicit command line option, but is not
supported at the moment.

Tests were extended to cover the new functionality and adapted to the
change behavior for "type" migration: syncFormat was empty
already (because the empty string matched the default), but
forceSyncFormat was unnecessarily set explicitly. Now it is not.
2012-06-07 14:16:58 +02:00
Patrick Ohly
14889ede24 ActiveSync: allow testing against Google
Google doesn't seem to support the Fetch operation, which is used
during testing to retrieve unchanged items. During syncing it will
only be needed when merging incoming data with an existing item, which
should not be necessary... except that testing shows that it is
necessary. The case where it is needed is:
- incremental sync (cache empty)
- calendar event series needs to be modified
- items from that series need to be fetched in preparation
  for updating it

To allow testing, several workarounds are necessary:
- request *all* data before doing a data dump in testImport (and friends),
  to ensure that the cache in the backend is fully populated
- use the cache in ActiveSyncCalendarSource instead of accessing
  the base class directly, because that would trigger a Fetch

Accessing the base class is still useful for Exchange+calendar,
because testing then avoids the cache (and thus can expose bugs
in it).

While at it, adapted the README. "database" needs to be set
explicitly, "client-test" only does it when creating configs.
2012-06-07 14:16:58 +02:00
Patrick Ohly
c464394eda EDS: code cleanup
Fixed ESourceList leak. Was never freed?! Now assigned to a new GObject
C++ wrapper as owner.

client API: Use EvolutionSyncSource::throwError() consistently, because it
relates the error to the source (nicer).

client API: fixed "only-if-exists" issue for contacts.

client API: fixed leak of uid after creating calendar object.
2012-06-01 15:37:09 +00:00
Patrick Ohly
642f9c3fb3 KDE: re-arranged header files to avoid conflict
The Qt headers define "signal", which breaks GNOME header
files if those get included later. Rearranged header
files to avoid ugly "undefine" statements.

Found when using EDS client API header files, because those
include different GNOME headers.
2012-06-01 15:34:03 +00:00
Patrick Ohly
00fade1f93 EDS + client API: work around broken e_cal_client_tzlookup()
e_cal_client_tzlookup() doesn't detect that lookup
fails because of non-existant time zone, because it gets
a non-descriptive error code from EDS ("Invalid object").

Work around that by ignoring all errors in our own lookup
function.

See "[Evolution-hackers] e_cal_client_check_timezones() + e_cal_client_tzlookup() + Could not retrieve calendar time zone: Invalid object"
2012-06-01 15:28:32 +00:00
Patrick Ohly
8da86205df password handling: fixed KWallet support, global configuration option
KWallet support was broken: syncevo-dbus-server checked
KDE_FULL_SESSION to determine whether it should use KWallet instead of
GNOME Keyring. That did not work, because the env variable was not set
for D-Bus daemons.

Automatically detecting KDE users is not possible at the
moment. Instead KDE users have to manually set the new "keyring"
global config property to "KDE" (case insensitive) if the
SyncEvolution installation supports both, because GNOME Keyring is the
default to avoid surprises for traditional users. If only KWallet
support is enabled, then this is not necessary.

"GNOME" and "true/false/1/0/yes/no" can also be set. This has the
advantage that keyring usage can be enabled permanently for the
command line in --daemon=no mode; normally keyrings are not used in
that mode because accessing them can bring up UI dialogs.

It also becomes possible to disable keyring usage in syncevo-dbus-server,
something which couldn't be done before.

The --keyring command line option is still supported, as an alias for
"[--sync-property] keyring=<value>". The default value for --keyring
is true, to match the traditional behavior. In contrast to other sync
properties, setting "keyring" does not require an explicit --run
parameter. Again this is done to mirror traditional usage.

Reading a password also (unintentionally) checked all supported
storages while searching for the password. Now it uses exactly
one storage and falls back to asking for the password directly.

The commit itself also cleans up the code a bit (reformatted, fixed
comments). Choosing the right slot in the password signals is done via
a new InitStateTri parameter which contains the "keyring" setting.
Error checking (unsupported keyring string, --keyring=yes and no
keyring enabled) is done in additional slots which run after all the
regular ones.

Parameter parsing for --sync and --keyring were unified. However,
there is the difference that --keyring has an implicit default value
("yes") and never has an additional parameter, in contrast to --sync,
which always is followed by one.

The new CmdlineTest::testKeyring covers different ways of using
--keyring. It relies on actually invoking keyring backends, something
not done by the default SyncContext UI. Therefore
CmdlineSyncClient+KeyringSyncCmdline were moved into libsyncevolution,
to be used by CmdlineTest.
2012-05-30 09:09:00 +02:00
Patrick Ohly
5ac975a7fb Akonadi: don't auto-start daemon
A normal KDE user should already have the akonadi server running.
Others probably don't want it to be started, for example as part
of --print-databases.

Therefore auto-starting Akonadi is now disabled. Attempts to use
the Akonadi sources results in an error message with a hint
about akonadictl when Akonadi is not already running.

The same problem is less relevant for EDS (but still exists to
some extend): here listing databases "merely" starts gconfd.
2012-05-29 08:47:10 +00:00
Patrick Ohly
d54789ad37 Evolution: optionally use EDS 3.4 "Client" API
Merged branch 'eds-api'. Several changes that were made in the
meantime on the master branch caused conflicts and/or required
updating the new code to avoid regressions. The code was also
updated to address some issues:
- g_propagate_error() steals ownership from GErrorCXX,
  thus causing a double free. Replaced with consistent use
  of GErrorCXX.
- Putting opening brackets into the middle of ifdefs
  breaks automatic code formatting. Now the code has "if("
  and ") {" outside of the ifdef/else/endif block.

The old code was updated to also use GErrorCXX. This revealed a memory
leak in the error path for opening databases, where the GError was not
cleared before returning.
2012-05-25 12:42:54 +02:00
Patrick Ohly
6b5101f384 Evolution Calendar: avoid redundant item update
Each insertion of a new calendar item was accidentally followed by an
update of the same item, with the same data. A performance bug.
2012-05-25 08:36:38 +02:00
Christophe Dumez
e46a27b8c2 Support for the new ECalClient API in EDS 3.2
SyncEvolution EDS backend currently uses the ECal API which is
deprecated as of EDS v3.2 and replaced by the new ECalClient API.
This patch brings support for this new ECalClient API (when EDS
3.2 is detected at compile time).

The new code based on the ECalClient API will enable a few
optimizations, especially the partial fetching of components to
avoid useless DBus trafic. This results in better component change
tracking by fetching only the UID/RID/REV attributes for each
component.

Note: The new code uses the new GLibSupport header instead of the
deprecated SmartPointer (eptr).
2012-05-24 11:49:20 +02:00
Christophe Dumez
a44e506717 Support for the new EBookClient API in EDS 3.2
SyncEvolution EDS backend currently uses the EBook API which is
deprecated as of EDS v3.2 and replaced by the new EBookClient API.
This patch brings support for this new EBookClient API (when EDS
3.2 is detected at compile time).

The new code based on the EBookClient API enables a few
optimizations, especially the partial fetching of contacts to
avoid useless DBus trafic. This results in better contact change
tracking by fetching only the UID/REV attributes for each contact.

Note: The new code uses the new GLibSupport header instead of the
deprecated SmartPointer (eptr).
2012-05-24 11:49:06 +02:00
Patrick Ohly
d1db2d30a1 Buteo: removed from source code
Pseudo-backend (really more like a plugin for Buteo) and testing
framework changes were removed because Buteo is obsolete.
2012-05-22 15:02:59 +02:00