Compare commits

...

1408 Commits

Author SHA1 Message Date
Jonas Smedegaard 0ea9928830 prepare for release: update changelog 2021-11-03 15:51:23 +01:00
Jonas Smedegaard c270ddb719 work around FTPFS with g++ 11 by setting CXXFLAG -std=c++14 2021-11-03 15:19:10 +01:00
Jonas Smedegaard 438d62ce7c fix install SRV resolver script in syncevolution-common, recommend adns-utils (or simpler fallbacks), and have syncevolution-libs recommend syncevolution-common 2021-11-03 13:53:43 +01:00
Jonas Smedegaard 98cb3656e8 fix install XDG startup files in syncevolution-dbus 2021-11-03 13:35:00 +01:00
Jonas Smedegaard 572c919417 list another helper script for testing as not-installed 2021-11-03 13:20:31 +01:00
Jonas Smedegaard c08bef0a7f list helper script for testing as not-installed 2021-11-03 13:13:04 +01:00
Jonas Smedegaard 205941ae82 list unversioned symlinks to shared objects as not-installed 2021-11-03 12:35:06 +01:00
Jonas Smedegaard 8d1aee7be7 tighten dh-missing to fail (not only warn) on missed files 2021-11-03 12:06:17 +01:00
Jonas Smedegaard 49b48ca081 tidy comments on not-installed files 2021-11-03 12:03:46 +01:00
Joao Azevedo e68e594824
update TODO 2021-11-03 11:15:24 +01:00
Joao Azevedo 02633098cd
add syncpbap providergoa to the list of libs to be installed 2021-11-03 11:14:23 +01:00
Joao Azevedo 607d66eacf
do not install TDEPIM libs 2021-11-03 11:10:44 +01:00
Jonas Smedegaard 4d1112fa6f update TODOs: add FTBFS with g++-11 2021-10-29 18:00:15 +02:00
Jonas Smedegaard 2fe6b6edbf update changelog and copyright hints 2021-10-29 19:27:47 +02:00
Jonas Smedegaard 896b40a689 fix drop depending on python3-twisted-core: used only by exerimental unused script 2021-10-29 19:12:11 +02:00
Jonas Smedegaard 46b5c47f1c update TODOs 2021-10-29 19:03:51 +02:00
Jonas Smedegaard b317241f69 fix have syncevolution-http depend on python3-gi (not bogus python3-gobject: earlier python-gobject was transitional package pulling in python-gi) 2021-10-29 19:03:04 +02:00
Jonas Smedegaard 46189709b2 fix have syncevolution-http depend on python3-twisted-core (not bogus python3-twisted-web: earlier python-twisted-web was transitional package pulling in python-twisted-core) 2021-10-29 19:00:30 +02:00
Joao Azevedo b1e9e28b21
Added syncactivesync.so to the not-installed list 2021-10-29 16:17:50 +02:00
Joao Azevedo 401b323d79
add list of libs that do not yet install 2021-10-29 16:14:50 +02:00
Joao Azevedo d9ef53d5e4
Revert "Add missing backend libs and paths"
This reverts commit 83c95e2dd3.
2021-10-29 15:38:50 +02:00
Joao Azevedo 5793a37819
Revert "fix paths for libs"
This reverts commit d3ea13e54e.
2021-10-29 15:36:08 +02:00
Joao Azevedo 97ba8ef723
Added missing deps to TODO list 2021-10-29 13:59:27 +02:00
Joao Azevedo d3ea13e54e
fix paths for libs 2021-10-26 21:14:43 +02:00
Joao Azevedo 83c95e2dd3
Add missing backend libs and paths 2021-10-05 23:57:08 +02:00
Jonas Smedegaard 96080d09ea update copyright info: tighten license-related lintian overrides 2021-10-05 17:58:30 +02:00
Jonas Smedegaard 173347e839 update copyright info: fix add License section LGPL-2 2021-10-05 17:57:36 +02:00
Jonas Smedegaard 2fc7443c7e update copyright info: fix consistently use field Files (not bogus File) 2021-10-05 17:54:59 +02:00
Jonas Smedegaard 990bd45fc2 update copyright info: fix consistently use field License-Grant (not Grant) 2021-10-05 17:53:14 +02:00
Jonas Smedegaard f04507e70d prepare for release: update changelog 2021-10-05 17:45:21 +02:00
João Azevedo dce6ad2b7e
don't use install for syncevo-http-server.py 2021-10-05 16:14:22 +02:00
Jonas Smedegaard ac0bc67fb0 prepare for release: update changelog and copyright hints 2021-10-05 10:35:48 +02:00
Jonas Smedegaard e9616bad84 update copyright info: update coverage 2021-10-05 10:34:56 +02:00
Jonas Smedegaard 9672db0cd3 Update upstream source from tag 'upstream/2.0.0'
Update to upstream version '2.0.0'
with Debian dir 902300043f
2021-10-05 01:41:39 +02:00
Jonas Smedegaard e11228cf77 New upstream version 2.0.0 2021-10-05 01:41:33 +02:00
Jonas Smedegaard 1fdc215aff update copyright info: track Gitlab source (not official upstream tarballs) 2021-10-05 01:39:57 +02:00
Jonas Smedegaard 0184c3385a update watch file: use file format 4; track Gitlab source; mention gbp --uscan in usage comment; use substitution strings 2021-10-05 01:39:57 +02:00
Jonas Smedegaard 7ee81214af add source helper script copyright-check 2021-10-05 01:24:49 +02:00
Jonas Smedegaard 00fd4dd934 update copyright info: add lintian overrides 2021-10-05 01:20:59 +02:00
Jonas Smedegaard c42a2612fc update copyright info: relicense packaging under GPL-3 2021-10-05 01:17:18 +02:00
Jonas Smedegaard 09a674a13f update copyright info: rewrite using machine-readable file format 1.0 2021-10-05 01:13:08 +02:00
Jonas Smedegaard 0858593426 use secure homepage URI 2021-10-05 00:18:21 +02:00
Jonas Smedegaard e98850b7a5 use salsa.debian.org in Vcs-* URIs 2021-10-05 00:17:46 +02:00
Jonas Smedegaard e35961252e set Rules-Requires-Root: no 2021-10-05 00:16:41 +02:00
Jonas Smedegaard f8f0ddec27 declare compliance with Debian Policy 4.6.0 2021-10-05 00:16:11 +02:00
Jonas Smedegaard 199ad5b24d list myself as Maintainer 2021-10-05 00:16:00 +02:00
Jonas Smedegaard 84102327d5 fix drop obsolete file debian/source/git-patches 2021-10-05 00:14:45 +02:00
Jonas Smedegaard 96a4801af7 update changelog and TODOs 2021-10-05 00:01:24 +02:00
Jonas Smedegaard fc19a86e83 update install paths 2021-10-04 23:56:27 +02:00
Jonas Smedegaard d3526b3a96 stop install syncevolution-dbus examples dropped upstream 2021-10-04 23:56:10 +02:00
Jonas Smedegaard cbdafe2783 list file explicitly not installed 2021-10-04 23:55:54 +02:00
Jonas Smedegaard d72ec5241c improve install tracking with dh_missing: package upstream-installed manpage (not source file) 2021-10-04 23:55:54 +02:00
Jonas Smedegaard 4fff221b94 install more example files 2021-10-04 23:55:54 +02:00
Jonas Smedegaard d9ffe16513 install all upstream-provided README.* files 2021-10-04 23:55:50 +02:00
Jonas Smedegaard 629b069e0b tidy rules: sort targets roughly by order of dh sequencer use 2021-10-04 23:55:50 +02:00
Jonas Smedegaard 02d72e2fbe fix install all upstream-provided gettext machine-object files 2021-10-04 23:55:42 +02:00
Jonas Smedegaard 0139dc3440 add patch 1002 to adjust whitespace as required for recent autotools 2021-10-04 23:41:58 +02:00
Jonas Smedegaard 4e50cab599 unfuzz patch 1001 2021-10-04 23:41:58 +02:00
Jonas Smedegaard 73336f6a5a relax to build-depend unversioned on libsynthesis-dev: required version satisfied in all supported Debian releases 2021-10-04 23:41:58 +02:00
Jonas Smedegaard be77943a00 build-depend on libecal2.0-dev (not libecal1.2-dev) 2021-10-04 23:41:58 +02:00
Jonas Smedegaard fd832ff9a2 stop build-depend on libpcre3-dev 2021-10-04 23:41:58 +02:00
Jonas Smedegaard 6674f63d2f use Python 3.x libraries: build-depend on python3-docutils (not python-docutils); have syncevolution-http depend on python3 python3-dbus python3-gobject python3-openssl python3-pygments python3-twisted-web (not python python-dbus python-gobject python-openssl python-twisted-web) 2021-10-04 23:41:58 +02:00
Jonas Smedegaard 58a357cc52 stop install library to support ActiveSync (no longer supported upstream) 2021-10-04 23:10:28 +02:00
Jonas Smedegaard 612b1d2d2a stop link against KDE libraries (no longer supported upstream): drop binary package syncevolution-libs-kde; stop build-depend on kdelibs5-dev kdepimlibs5-dev 2021-10-04 23:10:13 +02:00
Jonas Smedegaard da7996df58 drop ancient Breaks/Replaces hints 2021-10-04 23:06:21 +02:00
Jonas Smedegaard b986fd87e3 tidy: wrap and sort packaging files, with shortening options -ast 2021-10-04 23:06:21 +02:00
Jonas Smedegaard e1df01ef96 relax to stop build-depend explicitly on g++: required version satisfied by default in all supported Debian releases 2021-10-04 23:06:21 +02:00
Jonas Smedegaard df08e36fc0 simplifiy rules: stop explicitly build-depend on libtool automake pkg-config; stop clean autogenerated files (both handled by autoreconf since debhelper compatibility level 10) 2021-10-04 23:06:20 +02:00
Jonas Smedegaard 04e752b84e simplify rules: use relative install path 2021-10-04 23:05:38 +02:00
Jonas Smedegaard b62cbf7e60 use debhelper compatibility level 13 (not 11); build-depend on debhelper-compat (not debhelper) 2021-10-04 23:05:35 +02:00
Jonas Smedegaard ff5dc93d5b simplifiy rules: stop explicitly enable parallel build (done by default since debhelper compatibility level 10) 2021-09-30 12:16:38 +02:00
Jonas Smedegaard fac5c460cc simplify rules: call autogen.sh with autoreconf (not independently) 2021-09-30 12:16:37 +02:00
Jonas Smedegaard 0ca2baaf33 simplifiy rules: stop explicitly set multiarch path (done by default sine debhelper compatibility level 9) 2021-09-30 10:03:15 +02:00
Jonas Smedegaard 142ff5e66e simplify rules: drop obsolete export-patches target 2021-09-30 09:40:46 +02:00
Jonas Smedegaard 4ec6fd12db simplify rules: drop get-orig-source target (use gbp import-orig --uscan instead) 2021-09-30 09:40:46 +02:00
Jonas Smedegaard 73412b147f drop obsolete *-dbg to *-dbgsym migration 2021-09-30 09:34:21 +02:00
Jonas Smedegaard 59a2637307 Update upstream source from tag 'upstream/2.0.0'
Update to upstream version '2.0.0'
with Debian dir 5170e55a80
2021-09-29 23:12:19 +02:00
Jonas Smedegaard b0da99eb22 New upstream version 2.0.0 2021-09-29 23:11:16 +02:00
Jonas Smedegaard 979892df3a add git-buildpackage config: use pristine-tar; sign tags; avoid any .git* files; use DEP-14 branches debian/latest upstream/latest; add usage comment 2021-09-29 23:04:16 +02:00
Jonas Smedegaard 015be34169 isolate kfreebsd FTBFS fix as patch 1001, and track package source with patches unapplied
This reverts commit aabb990482.
2021-09-29 23:03:47 +02:00
Tino Mettler b9c153ddf3 Import Debian changes 1.5.3-2
syncevolution (1.5.3-2) unstable; urgency=medium
.
  * Remove libgconf2-dev build-dep (Closes: #897258)
2021-09-29 23:02:05 +02:00
Jonas Smedegaard 693ba4c3fe Import Upstream version 1.5.3 2021-09-29 23:01:46 +02:00
Tino Mettler 22449d72c0 Import Debian changes 1.5.3-1
syncevolution (1.5.3-1) unstable; urgency=medium
.
  * New upstream release
  * Fix override_dh_makeshlibs to handle all packages with public shared libs
    (Closes: #887043)
  * Remove obsolete Conflicts:/Breaks:/Replaces: sync-ui (<<1.1+ds1-1~)
  * Change debhelper compatibility to 11, which is recommended
  * Bump standards version to 4.1.3, no changes needed
  * Fix several lintian warnings
2021-09-29 23:01:46 +02:00
Tino Mettler 8065ff5f75 Import Debian changes 1.5.2-3
syncevolution (1.5.2-3) unstable; urgency=medium
.
  [ Patrick Ohly ]
  * libical: support libical v3 (Closes: #884158)
  * GNOME: replace gnome-keyring with libsecret
.
  [ Tino Mettler ]
  * Change build dependencies for libgtk and glade to use GTK3 for sync-ui
    (Closes: #884162)
  * Add Build-Dep on libjson-c-dev (Closes: #884170)
  * Handle C++ conversion operator name mangling in GCC 7 (Closes: #871284)
  * Build depend on libsecret-1-dev instead of deprecated libgnome-keyring-dev
    (Closes: #867944)
2021-09-29 23:01:40 +02:00
Tino Mettler 0819d57e03 Import Debian changes 1.5.2-2
syncevolution (1.5.2-2) unstable; urgency=medium
.
  * Add missing service file for syncevo-dbus-server (Closes: #854941)
2021-09-29 22:58:03 +02:00
Patrick Ohly 238f9368c2 autotools, NEWS: SyncEvolution 2.0.0
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-03-21 07:16:32 -07:00
Patrick Ohly 971da5408f log2html.py: support writing UTF-8 to stdout
When invoked during automated testing, stdout is not automatically
configured to support UTF-8. We know that our encoding is UTF-8,
so we can enable that unconditionally.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-03-21 06:57:47 -07:00
Patrick Ohly 6fc5f4703b Revert "C++: instantiate some templates once in libsyncevolution"
This reverts commit 7d527c6dd8.

It causes link errors on Fedora, see
https://bugzilla.redhat.com/show_bug.cgi?id=1926932

This might be a compiler bug, but as this is a not particular
important size optimization, removing it is the easiest fix.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-03-21 06:57:47 -07:00
Patrick Ohly 9b7a9ed7ef 1.99.2 pre-release 2021-02-06 11:39:24 -08:00
Patrick Ohly bf14e33977 C++: better types for loop variables
This addresses two different warnings from Fedora Rawhide:

/srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp: In member function 'std::string SyncEvo::XMLFiles::get(SyncEvo::XMLFiles::Category)':
/srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp:2390:28: error: loop variable 'entry' of type 'const StringPair&' {aka 'const std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&'} binds to a temporary constructed from type 'std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >' [-Werror=range-loop-construct]
 2390 |     for (const StringPair &entry: m_files[category]) {
      |                            ^~~~~
/srv/runtests/work/sources/syncevolution/src/syncevo/SyncContext.cpp:2390:28: note: use non-reference type 'const StringPair' {aka 'const std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >'} to make the copy explicit or 'const std::pair<const std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >&' to prevent copying

This fails because StringPair has non-const members. By using "auto",
we get rid of the need to define and pick exactly the right type.

/srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp: In member function 'void SyncEvo::SyncConfig::removeSyncSource(const string&)':
/srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp:2552:36: error: loop variable 'peer' creates a copy from type 'const string' {aka 'const std::__cxx11::basic_string<char>'} [-Werror=range-loop-construct]
 2552 |             for (const std::string peer: m_tree->getChildren(m_contextPath + "/peers")) {
      |                                    ^~~~
/srv/runtests/work/sources/syncevolution/src/syncevo/SyncConfig.cpp:2552:36: note: use reference type to prevent copying
 2552 |             for (const std::string peer: m_tree->getChildren(m_contextPath + "/peers")) {
      |                                    ^~~~
      |                                    &

We could have used "auto" also instead of "std::string", but here it
doesn't save that much typing and is more readable. We just have to
use a reference.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:39:12 -08:00
Patrick Ohly 28ee02b0eb test: prefer more recent D-Bus config
On Fedora Rawhide the old location is unusable.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:35:18 -08:00
Patrick Ohly d4ed6cae5b GTK UI: avoid G_TYPE_INSTANCE_GET_PRIVATE
G_TYPE_INSTANCE_GET_PRIVATE was deprecated.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:32:49 -08:00
Patrick Ohly 3968562049 test: remove unchecked dynamic cast
Recent g++ on Fedora Rawhide warns that the dynamic cast result
is used without NULL check. We know that the cast must succeed,
so a static cast is more appropriate.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:31:11 -08:00
Patrick Ohly e132410296 gnome: remove libsecret include hack
Some older version of libsecret.h lacked `extern "C"`. Adding
that manually now causes compile errors on Fedora Rawhide and thus
has to be removed:

/usr/include/c++/11/type_traits:480:3: error: template with C linkage
  480 |   template<typename _Tp>
      |   ^~~~~~~~
/srv/runtests/work/sources/syncevolution/src/backends/gnome/GNOMEPlatform.cpp:24:1: note: 'extern "C"' linkage started here
   24 | extern "C" {
      | ^~~~~~~~~~
In file included from /usr/include/glib-2.0/glib/gmacros.h:241,
                 from /usr/lib64/glib-2.0/include/glibconfig.h:9,
                 from /usr/include/glib-2.0/glib/gtypes.h:32,
                 from /usr/include/glib-2.0/glib/galloca.h:32,
                 from /usr/include/glib-2.0/glib.h:30,
                 from /usr/include/libsecret-1/libsecret/secret.h:18,
                 from /srv/runtests/work/sources/syncevolution/src/backends/gnome/GNOMEPlatform.cpp:25:

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:28:52 -08:00
Patrick Ohly 0a64fbadcc akonadi: avoid link error on Fedora Rawhide
At least on Fedora Rawhide -lkdeui and -lkdecore
are not found and not needed.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-02-06 06:27:30 -08:00
Milan Crha c656bc4a08 build: boost::placeholders
On Fedora, Boost placeholders are now in their own namespace.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2021-01-24 10:33:45 +01:00
Patrick Ohly dc88a596b3 .github: mirror from gitlab.freedesktop.org
This GitHub action will run periodically and mirror
the entire repository content.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-28 21:06:21 +01:00
Patrick Ohly b4f8743bfc test: refresh valgrind suppressions
A lot of the old suppressions are no longer needed (determined by
running valgrind with -v during a full nightly test run) and some new
ones are needed after updating to new Linux distros.
2020-12-28 05:10:25 -08:00
Patrick Ohly 420c44ea6b GTK3 sync-ui: drop dependency on libunique
The builtin GtkApplication support is almost equivalent and allows
getting rid of the deprecated libunique which isn't available anymore
in recent Linux distros.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:44:07 -08:00
Patrick Ohly 2bc0535881 test: drop useless "set -x"
This no longer works when running tests in Docker containers because
the wrapper script for starting there only accepts a simple command,
not something that must be interpreted by a shell.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:57 -08:00
Patrick Ohly 90c3ca329d build: only link against libcppunit if needed
The --as-needed linker flag didn't work anymore on recent Linux
distros, with the result that libcppunit became a library dependency
of the syncevolution binaries although they didn't need it.

A better approach anyway is to only link the lib when it is expected
to be used (unit testing or in client-test).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:42 -08:00
Patrick Ohly 54d5f08d76 build: stop building useless KDE deb
The KDE backends is now typically disabled and thus a separate
KDE deb is not needed anymore.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:31 -08:00
Patrick Ohly 798c2f4d09 sys.supp: more general gnutls_x509_trust_list_add_trust_file
The soname is different on more recent Linux distros, so better
leave it out.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-22 11:43:22 -08:00
Patrick Ohly 7cf0dd5217 1.99.1 pre-release 2020-12-19 01:43:24 -08:00
Patrick Ohly 64c62b53b4 tde: fix "make dist" issue
"make dist" tries to include all source files in the archive, which
does not work for the generated files.
2020-12-18 08:14:41 -08:00
Patrick Ohly 516d8258ca sys.supp: add gnutls_x509_trust_list_add_trust_file 2020-12-17 03:21:37 -08:00
deloptes 57d357afee tdepim: various changes
Submitted by deloptes via private email.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-06 11:25:57 +01:00
Patrick Ohly a6b490ef83 OBEX: additional debug output
This shows more clearly when OBEX function calls are made, which is
relevant for libopenobex2 (OBEX_HandleInput must be called after
OBEX_Request).
2020-12-05 21:28:08 +01:00
Patrick Ohly 051b8ac8d2 EDS: avoid dead code warnings when disabled 2020-12-05 21:28:08 +01:00
Patrick Ohly 8f7fc79007 build: avoid deprecation warning
-Wno-deprecated-declarations is needed everywhere (i.e. not just in certain
modules, like SYNCEVO_WFLAGS_DEPRECATED) because EDS on Ubuntu Eon uses
the deprecated GDateTime in its header, which we included through our
EDS/libical wrapper even when not actually used.
2020-12-05 21:28:08 +01:00
Patrick Ohly f9ca9e34de test: fix compiler warning about return code of symlink 2020-12-05 21:28:08 +01:00
Milan Crha edb458dfcb EDS: EDS 3.33.2, libecal 2.0 support
Developed originally by Milan Crha for Fedora, copied and updated
by Patrick Ohly.

From Milan:

There are going to be made huge libecal API changes, as huge as it
deserved a version bump from 1.2 to 2.0, and together with it a small
libebook API changes, most likely being part of the evolution-data-
server 3.33.2 release, which is planned for May 20. More about this can
be found here:
https://mail.gnome.org/archives/desktop-devel-list/2019-April/msg00016.html

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly a3bb1fba4a SyncSource.h: fix compiler warning
Clang complained about "exec" being uninitialized.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly afd10b27e2 c++: add missing va_end
Found via cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly b2b1f2f161 c++: avoid slicing exception
Newer clang (or was it gcc?) warn about catching exceptions by value
which have virtual methods. This shouldn't have mattered here because
the exception values where not really used, but using a const
reference is better nonetheless.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 0e5ee4f41a gdbus: replace helper class with normal glib classes
The signond pipe helper class uses deprecated glib methods. Not sure
whether that wasn't an option at the time that it was written, but
nowadays glib has classes which can be used instead.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e88bfa6214 C++: automatically determine iterator types
Having to specify the type of an iterator is annoying and does not
really add clarity to the code. With C++11 we can use "auto"
instead and in some cases remove helper typedefs.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 7d527c6dd8 C++: instantiate some templates once in libsyncevolution
This saves some space (total number of blocks for SyncEvolution object
files when building statically down from 421588 to 413300) and
presumably also build times (not measured).

However, it did not work for all templates, leading to link errors
when trying to add std::map and std::pair of strings. It probably also
does not make sense for templates where only some functionality is
used.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 85edb458f4 util.h: remove unused ToString()
It pulled sstream into many compilation units.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly b8cbd5358f C++: avoid NULL
NULL is ambiguous (can be integer and pointer) and using it as
terminator for vararg list of pointers without explicit casting to a
pointer was downright incorrect. nullptr fixes that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 02a711f143 C++: replace BOOST_TYPEOF
decltype does the same thing.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 74f0d01f33 C++: remove more boost headers (tuple, assign, utility)
Several headers were no longer needed resp. could be replaced by more
specific ones like noncopyable.hpp.

boost::assign mostly can be replaced with initialization lists and
boost::tuple with std::tuple.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly ae4969cfa3 C++: replace pcrecpp with std::regex
This allows us to get rid of an external dependency. Mostly std::regex
works, but there are limitations that have to be worked around:
- no multiline support in C++11
- conversion of groups to non-string types has to be done manually

While at it, use raw strings to get rid of excessive backslash
escaping.

pcrecpp::StringPiece was used as a general-purpose utility class. Now
we have our own implementation.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 6217ba0bd1 C++: avoid boost::scope_ptr/array and plain pointers
std::unique_ptr usually can be used instead. std::vector also works
for arrays and even has a data() method as part of the official API in
C++11.

For historic reasons, the functions creating SyncSources returned
plain pointers. We are breaking the API now, so we might as well fix
that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 67147853f7 src/async.patch: remove obsolete patch
This was committed to SVN, probably because it might have become
relevant again. Now it is long obsolete.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 2fa3c3335a C++: replace boost::shared_ptr, boost::function, boost::bind
We can use std::shared_ptr and std::function instead now.

Lambdas are usually a better alternative to boost/std::bind. The
downside is the need to explicitly specify parameters completely. When
inlining callbacks entirely with lambdas, duplication of that
parameter list can be avoided.

Whenever possible, use std::make_shared to construct objects that are
tracked by std::shared_ptr.

Some objects need a std::weak_ptr during object destruction. For that
we have to use our own implementation of std::enable_shared_from_this,
with a matching creator function. The additional benefit is that we
can get rid of explicit static "create" methods by making that create
function a friend.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly d0c08bf0dd C++: avoid "using namespace std"
It saved some typing, but isn't good style.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly bce7526da1 C++: simpler for loops
boost/foreach.hpp is no longer needed, range-based loops work
the same. With some helpers, even reverse iteration and
boost::make_split_iterator() can be handled the same way.

"auto" makes it possible to avoid explicitly spelling out the
expected type.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 623397c674 C++: lambdas instead of static methods
Lambdas without variable capture are guaranteed to be compatible with
plain C functions, so we can use them as callbacks. That keeps the
code closer together and avoids having to declare helper methods as
part of the public class.

In some cases the static method is the actual code, in which case only
"nothrow()" gets replaced with "noexcept" because it's cleaner and to
mark that the code was looked at and intentionally left as-is.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e95ac67d4b C++: more modern timeout.h
Universal references and template methods make it possible to pass
through arbitrary callbacks right through to the point where we need
to create a std::function for a plain-C lambda.

Boost is not needed anymore.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 39bf3f1291 C++: variadic connectSignal()
By specifying the list of signal types as template parameters
it becomes possible to use a single implementation. Lambdas
can replace explicit callback methods.

The reimplementation is more flexible and does not enforce
the use of a boost::function. This matches how connectSignal()
was used in practice. Thanks to universal references, the boost::bind
instances get moved directly into the allocated instances that are
attached to the signal handler.

The downside is that the call syntax changes slightly, because
partially specifying template parameters does not work.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3729a239fc C++: variadic templates in D-Bus bindings
Using templates with a varying number of types allows removing
duplicated code for the different cases.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 618e8b9d71 SyncSource.h: variadic templates
The OperationWrapperSwitch class can be reduced to just two cases,
which reduces code duplication considerably. Conditional compilation
with "if constexpr" could be used to eliminate the helper class
entirely, but that's C++17.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 8713809b35 C++: use lambdas instead of boost::lambda, std::exception_ptr
The code becomes a lot more readable. One can also set breakpoints
inside the callbacks.

Exception handling in GRunInMain() is better now, with the ability to
rethrow arbitrary exceptions thanks to std::exception_ptr.

Only some usage of boost::lambda in the Akonadi backend remains.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3dc1514ab9 syncevo-dbus-server: remove virtual address book feature
This aspect of syncevo-dbus-server had been developed for use in an
IVI head unit. It's currently neither used nor tested and no longer
compiles (timeout.h moved, API changes in libfolks).

Instead of trying to keep it working while enhancing the usage of C++,
removing it entirely is easier.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 04f8ac0454 gdbus: remove old libdbus-based implementation
GIO D-Bus is a more modern and capable implementation. The older one
was only needed on certain old Linux distros (Maemo) which did not
have a recent enough glib.

The reason for removing the old one is that it allows making API
incompatible changes for the C++ D-Bus binding without having to do
that in two places.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 2705d06fa6 connection.cpp: better check for obex-bt:// URLs
cppcheck started complaining about std::string::find() being
inefficient. boost::starts_with() would indeed be better, but even simpler
and more readable is a whole-string comparison.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e3783d3039 installcheck-local.sh: test with C++14
Some header files use C++14 features.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 068e8d0ae3 SuspendFlags: restore printing of messages
Commit 5bafef3957 (included in v1.4)
broke the printing of the messages about Ctrl-C handling, in
particular the hint that using it quickly will switch from suspending
to aborting.

The message code was getting overwritten by a new default case due to
a missing break.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly e773bc9a69 installcheck-local.sh: test with C++11
Some header files use C++11 features.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 25442ad2e6 timeout.h: include glib.h
The header file is not usable without glib. Users of it need to be aware of
that.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 7014e5bb67 installcheck-local.sh: test with glib enabled
At least timeout.h only works with glib, and that's okay.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 9c00b725f9 SoupTransportAgent: fix disabled SSL checking
The SoupTransportAgent modernization in 1.5.3 led to SSL checking
always being enabled because the default changed from disabled to
enabled and SyncEvolution did not set it.

Worse, in older versions it probably (untested) was always disabled
because it was not enabled either.

Now the checking of SSL is always set explicitly and thus always
mirrors the SyncEvolution configuration.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 55cb5ad46f sync: avoid setenv()
set/getenv() are not thread-safe, and a recent bug report via private
email shows that this does cause segfaults:

Thread 4 (Thread 19251):
....

Thread 1 (Thread 19311):
...

In this case, DLT was used and the setenv call was setting the
LIBSYNTHESIS_<context> variables.

The solution is to avoid setenv() in code which might run in parallel
to other threads:
- DLT-related variables are set at the beginning of
  syncevo-dbus-server startup which then gets inherited
  by syncevo-dbus-helper and in the environment prepared
  for syncevo-local-sync (because the latter might run with
  a different log level)
- the default for SYNCEVOLUTION_PBAP_SYNC is now "incremental"
  everywhere and SyncContext is told about the special
  mode where it needs to keep photo data differently, i.e. setting
  SYNCEVOLUTION_PBAP_SYNC in dbus-sync.cpp for PBAP syncing is
  no longer necessary

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly d5a7d38029 docs: replace meego.org references (FDO #104936)
meego.org is long gone, replace it where possible. Some of the old bug
references might have a corresponding bug in bugs.freedesktop.org but
trying to update them probably isn't worth it.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly 3cd62b3e41 signon: fix pcrecpp build flags
Dropping the pcrecpp build hacks in the nightly testing showed that
the flags for normal linking and compilation were missing.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Patrick Ohly edf1314def test: convert scripts to Python3
This is the result of 2to3, with the interpreter path updated manually,
tabs replaced by spaces and some obsolete packages removed.

Required because the current nightly build host no longer has Python2 installed.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-12-05 21:28:08 +01:00
Milan Crha 75dff12823 Python2 -> Python3
Originally developed by Milan Crha for Fedora, copied from there
by Patrick Ohly.
2020-08-09 16:31:32 +02:00
Patrick Ohly 3bd97cc795 runtests.py: remove lpia hack
With support for 32 bit binaries removed, we also no longer need
to build the special lpia packages.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly fb8e527afc runtests.py: do not use resources.py during Git checkout
The script comes from SyncEvolution and might not be ready yet
when checking out other repos.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly 407f213a7f runtests.py: fix command invocation
Splitting commands with a semicolon didn't work as intended. We need
to use the helper function's parameters instead.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly c78bcbb076 D-Bus server: fix server restarting
After moving to different pre-built testing, the wrong
syncevo-dbus-server binary was getting started (/usr/lib instead from
the test directory). We must find the binary via normal PATH lookup
and also deal with symlinks before comparing.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly 8378272412 test: fix D-Bus testing result gathering
Successful tests were not picked up by the result checker if there was
extra output between printing the test name and the " ... ok".

One source of that extra output was the D-Bus server and daemons
started by it (now redirected to a file), the other a glib warning
about an event ID not being found (caused by double-removal of a
timer, which is mostly avoided now).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly 77a9a450d2 test: allow missing remote branches
The code for checking out source code for testing no longer worked
with newer git when there weren't any remote branches which had to be
reset.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly 1216bdaebc build: don't attempt to install .deb archives while building them
Testing them is done in separate environments and installing them
no longer works in Docker-based build environments (permission
issues).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly b649bf454c build: remove special libical deps
Newer packages will be built without the ical compatibility hack and
will start to depend on libical3, so we have to remove the packaging
hack.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly ba95bce198 build: use Docker containers instead of chroots
Previously, nightly testing used a home-grown set of scripts arounds
Debian's schroot tool. This became increasingly harder to maintain and
update, in particular because the chroot's themselves were set up
manually. Using Docker files for building container images and then
running in those avoids this. In SyncEvolution, this affects some
places where direct access from the host to the test filesystem was
assumed.

Testing of pre-built binaries also gets changed: instead of pointing
to some directory from a previous build, we always install the output
packages from an apt repo in a clean, minimal container. Runtime
dependencies like "evolution-data-server" must be declared correctly
because they might no longer be installed already.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly e39167a9d8 test/resources.py: Python3, remove Murphy support
Running Murphy for resource allocation is overkill and
complicated (need a shared D-Bus session!). Sharing a local directory
between different test runs and using file locking is simpler. With
flock, locks are associated with a file descriptor, so they will be
returned automatically when the process quits, just like they used to
be with Murphy.

We don't want these file descriptors to be inherited by child
processes; Python 3 does that by default, so we switch to it. This is
is also a worthwhile goal by itself.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-08-09 16:26:42 +02:00
Patrick Ohly 749a889bf2 test: ignore empty CLIENT_TEST_SOURCES
Running with no sources leads to exception later on and isn't
intended; it makes more sense to treat an empty env var like an unset
one and use the default source list.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-07-24 22:01:33 +02:00
Patrick Ohly 1bf4ce81b1 test: switch from .log to .txt for log files
The current HTTP server for nightly.syncevolution.org reports the
content type for .txt files as plain text, but not for .log
files. Plain text is desirable for easy viewing in a web
browser. While the .log suffix is nicer, getting the HTTP server
reconfigured is hard and might have to be repeated again in the
future, so let's just use .txt.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2020-07-24 22:01:33 +02:00
Patrick Ohly 83fe101576 autotools, NEWS: SyncEvolution 1.5.3
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:28 -08:00
Patrick Ohly c077579240 gdb-dump-stack: automatic stack dumps
This is meant to be used by automated testing, with gdb acting as
wrapper around a command so that stack traces are created
automatically when something goes wrong.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:28 -08:00
Patrick Ohly b7dbeeac49 sys.supp: more dl suppressions
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:28 -08:00
Patrick Ohly 3afdbaf651 EDS: more generic open retry handling
Recent EDS started to exhibit race conditions when opening a database (for
example, https://bugzilla.gnome.org/show_bug.cgi?id=791306). Opening was
already tried again for a certain known error in some old EDS version. Now it
is tried five times with a delay of one second for all errors.

The advantage is that this does not depend on accurately detecting the race
condition error.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:28 -08:00
Patrick Ohly 8d6d960153 sys.supp: suppress EDS/glib closure issue
Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:27 -08:00
Patrick Ohly 2747426b7c oauth2.cpp: fix usage of curl
When libcurl was selected instead of libsoup, compilation failed
because the necessary header file was missing and the direct assignment
of a plain pointer to the shared_ptr failed.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:27 -08:00
Patrick Ohly 1126b65b6a autotools: be more selective about suppressing deprecation warnings
Suppressing the warning for all code hid the deprecation warning
about auto_ptr, which is something that should have been fixed
before.

Now only some code still suppresses the warning (GTK UI, Akonadi)
because there is no time to also update and test that part.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:27 -08:00
Patrick Ohly 0db56499c2 SoupTransportAgent: require libsoup 2.42, no deprecated methods
This allows us to get rid of deprecated function calls. We no longer
need to set a default proxy either, the newer libsoup does that itself
by default
(https://developer.gnome.org/libsoup/stable/libsoup-session-porting.html).

Not mentioned in the porting guide is that the based soup session now
has a 60s timeout by default. We don't want to time out.

We also need to quit the event loop explicitly when timing out. Somehow
that wasn't necessary before.

When using the generic SoupSession, it is no longer guaranteed that canceling
an operation invokes the callbacks before returning. Therefore we have to be
prepared for callbacks occuring after destructing the SoupTransportAgent. This
is achieved by storing all SoupTransportAgent in a boost::shared_ptr and
letting the instance know about that with a weak_ptr, which then can be used
by the callbacks.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:27 -08:00
Patrick Ohly d7a591dc73 timeout.h: move from D-Bus server to syncevo
The helper class is also useful outside of the D-Bus server,
for example in the glib-based SoupTransportAgent.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-09 07:53:27 -08:00
Patrick Ohly 88619eb58c C++: replace auto_ptr with unique_ptr
auto_ptr has been deprecated for a while now. unique_ptr can
be taken for granted now, so use that instead.

GDBusMessage requires a custom deleter. Not sure how auto_ptr
handled that before.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:51 +01:00
Patrick Ohly 52a3457037 C++: try to use C++14, rely on C++11
This makes it possible to use C++11 features. Choosing C++14 when available
gives us advance warning when something might break under C++14. Test builds
on a system with only C++11 and another with C++14 are needed to ensure that
both really works.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 7e4bdb5b07 test: honor warning flags
Without them, --enable-warnings=fatal was ignored for the D-Bus test
program, causing deprecation warnings about auto_ptr to be printed
without aborting the build.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 60de1423aa testing: work around Google CalDAV RECURRENCE-ID
Stand-alone events with RECURRENCE-ID get mangled by the server:
it converts the RECURRENCE-ID time to UTC. Reported in:
https://stackoverflow.com/questions/47811670/detached-recurrence-without-parent-event

For now we ignore the error (googlecalendar source) or avoid it (testItems).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 0abc7d8251 testing: exclude PHOTO data from Google Contacts sync tests
The server started to re-encode the image, thus breaking the strict
comparison that is done for these tests. Normal testing allows such
changes for the Google server by ignoring PHOTO data, but in these
tests we want comparison to be strict, so we have to change the test
data.

The downside is less test coverage.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly b71ed933a8 autotools: let caller suppress automatic lib dependencies
shlibs.local was used in combination with explicit ebook/ecal/ical
dependencies to replace the automatic dependencies. It needs to
be maintained together with those explicit dependencies, so it
makes more sense to use a file provided by the code which
calls make to build releases.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 55c7eba954 autotools: building of binaries optional
When building and installing backends on additional build platforms, linking
the binaries is both unnecessary and sometimes problematic (for example,
helper libraries not available in a version that works).

Therefore configure arguments can be used to disable linking of the binaries.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 0c59f20b91 C++: initialize all members of SyncSourceEvent
While not necessary (attributes are not read for NOP event), it's
still cleaner to also initialize them. Found with cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 62387107f9 TDEPIMNotesSource.h: remove unused kn_dcop
It's a local variable in the implementation. Found with cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 77335c8d82 icaltz-util.c: avoid undefined signed int shifting
The result of shifting a signed int is undefined. Better operate
on unsigned int of the same size.

Found by clang or cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 3a79a8d398 SynthesisDBPlugin.cpp: fix error path
This is a cut-and-paste error from upstream libsynthesis: an error
code was returned in an error case where a boolean should have been
returned.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly f797987710 C++: const and const ref enhancements
Found with clang and/or cppcheck.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly bd6adff9a5 C++: implement missing copy operator
It's good practice to implement the copy operator, even if not needed
at the moment.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 11e5e94ac2 C++: avoid non-standard typeof
Building with recent Clang in C++ mode fails when using the non-standard
typeof operator. We can't rely on the new(ish) decltype yet, so use
the Boost implementation instead.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 4fe4b6dd14 ClientTest.cpp: clean cppcheck warnings
The only actual error was incorrect nesting of ifdef/endif and comments.

The iterator change avoids a false positive where cppcheck's for correct
begin()/end() comparisons fail. It's also a bit shorter and cleaner.

The copy operator is not needed.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 8ce962a3bd runtests.py: suppress m_source cppcheck warning
Recent cppcheck warns about m_source not being initialized, which is a false
positive (it's a reference and gets initialized). Inline suppressions did not
work, so instead disable the entire warning for SyncSource.h.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 705a5c66a8 wrappercheck.sh: detect premature exit while waiting for D-Bus daemon
The "waiting for daemon to connect to D-Bus" loop did not check whether daemon
was still running at all, causing testing to get stuck occasionally when the
daemon failed.

THe loop waiting for output already checked that, but can be simplified.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 3325aebbff GNOME: retry keyring operations
Sometimes GNOME keyring and libsecret fail to set up the right temporary keys
(https://bugzilla.gnome.org/show_bug.cgi?id=778357). This has been fixed
upstream, but still breaks with the distros used by the automated testing
occassionally.

Retrying the operations after disconnecting from the server is an attempt
to recover from this sporadic error.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:50 +01:00
Patrick Ohly 7b7660af60 GNOME: replace gnome-keyring with libsecret (FDO #104219)
The GNOME keyring library has been obsoleted for a long time now,
long enough that the replacement libsecret is available on all
supported distros. Therefore we can switch unconditionally.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:34 +01:00
Patrick Ohly d5ecc1b468 libical: support libical v3 (FDO #104220)
libical v3 removes some deprecated functions (like icaltime_from_timet)
and removes the "is_utc" member from icaltimetype. The replacement
code works with old and new libical and thus needs no ifdefs.

However, that struct is part of the ABI, which impacts the tricks that
syncevolution.org binaries use to get built against libical v2 and then
run with more recent libs like libical v3.

Depending on the platform ABI, it may still be okay, because the calling code
in SyncEvolution reserves and copies enough bytes for the icaltimetype
instances and because that code never directly accesses any member (is_date,
is_daylight, zone) whose offset changes.

Original author: Milan Crha <mcrha@redhat.com>

Slightly modified it so that icaltime_t.zone is not set.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2018-01-03 10:39:13 +01:00
Tino Mettler 448b37c80b Ready for upload to unstable 2016-11-18 13:49:32 +01:00
Tino Mettler 6de96622b3 1.5.2-1 package 2016-11-18 13:29:33 +01:00
Tino Mettler f96746af9f Improve short descriptions
Some packages shared the same short description.
2016-11-18 13:06:32 +01:00
Tino Mettler 1e1aa05fe6 Use HTTPS for URL to git web view 2016-11-18 13:06:31 +01:00
Tino Mettler 4f314c6271 Revert "Fix FTBFS with libical2"
This reverts commit 5feaaf8692.
2016-11-18 13:06:31 +01:00
Tino Mettler c1f51573c4 New upstream version 2016-11-15 12:33:09 +01:00
Tino Mettler 531075d5dd Merge tag 'patches/1.5.2-1'
Patches for 1.5.2-1
2016-11-15 12:32:52 +01:00
Tino Mettler 2785be0b6f Revert "Add missing casts from shared_ptr to bool to fix FTBFS with GCC 6"
This reverts commit 9286b88515.
2016-11-15 12:32:37 +01:00
Tino Mettler acbedcb9aa Revert "Fix remaining FTBFS with GCC 6 by downgrading the C++ dialect to gnu++98"
This reverts commit b5f5312b1c.
2016-11-15 12:32:35 +01:00
Tino Mettler aabb990482 Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC
Work around missing SOCK_CLOEXEC on kfreebsd by setting FD_CLOEXEC
afterwards.
2016-11-15 12:30:30 +01:00
Patrick Ohly 7a2c76607d .gitignore: ignore test-driver
autotools started creating that after the recent update to Ubuntu
Trusty as main build platform.
2016-11-08 07:47:05 -08:00
Patrick Ohly 5198c48ab5 configure.ac: 1.5.2 2016-11-08 03:40:08 -08:00
Patrick Ohly 9993e16e2a NEWS: finalize 1.5.2
Mention the TDE desktop, today's date added.
2016-11-08 03:33:29 -08:00
Patrick Ohly 55c463dd94 eds_event.ics.exchange.tem.patch: adapt to Exchange 2016
Switching the testing to Exchange 2016 revealed a slightly
different time zone mangling than before:
- the "US & C" time zone name already gets truncated before the C
- due to recent rules on the server (?), several TZNAMEs get
  changed

Updating the data again...
2016-11-04 03:10:08 -07:00
Patrick Ohly e844f43a4f runtests.py: uninstalled activesyncd + glib schemas
The more recent activesyncd uses GSetting schema files. We
need to set an env variable if they are nor installed in the
default system location.
2016-11-04 03:07:09 -07:00
Patrick Ohly 451440bd54 TDE: fix compile issue
When the TDE notes backend was disabled, the code didn't compile
because the SE_END_CXX wasn't nested properly inside the ifdef/endif.
2016-11-04 03:06:02 -07:00
Patrick Ohly 5937277102 SignonAuthProvider: fix ref counting issue
The account data was unreferenced once too often, or rather, a suitable ref
count increase was missing. A debug build of glib detects that ("GLib:
g_variant_unref: assertion 'value->ref_count > 0' failed"), but without that
check the code might also crash.
2016-11-03 00:50:26 -07:00
deloptes 7f3ec05c05 TDE: various fixes
Prevents the wallet backend from crashing SyncEvolution when
enabled. Functionality not really tested, though.

PIM backend had compile problems when enabled.
2016-11-03 00:36:32 -07:00
SyncEvolution Nightly Testing 46a81a3cb8 Merge remote-tracking branch 'origin/for-master/tde' into nightly 2016-10-13 05:07:07 -07:00
Patrick Ohly 7d06fd2869 TDEPIMCalendarSourceRegister.cpp: only grab generic types when active
When a backend is inactive, it is meant to ignore generic types like
"calendar". The idea behind that is that typically users install or
compile just the backends they want, and then ask for the "calendar"
backend using the generic sync templates or instructions.

When adding the TDEPIM calendar backend, that broke because it also
instantiated itself for those terms when active. The other TDEPIM
backends already did this as intended.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-10-09 23:20:16 -07:00
Patrick Ohly 30d42f88ca activesync: fix packaging of activesyncd (FDO #98014)
The latest activesyncd contains GSettings schema files
which get installed by the top-level makefile, therefore
we have to install everything.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-10-07 15:25:38 +02:00
Patrick Ohly e05817a492 tdepim: fix build issues
The *Register.cpp files and everything they include must compile
without hard dependencies on header files which are TDE specific,
so add some ifdefs. Compiling with TDE backends disabled broke
because of this.

When enabled (untested!), it is unclear how some of these *Register.cpp
could have worked without including the header file that defines the
class they instantiate. Added the necessary includes.

A closing } was missing (found by cppcheck, which tests all variations
of the code, not just those currently enabled).

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2016-10-07 15:17:41 +02:00
deloptes 160b1f5e60 tde, tdepim: adapt to TDE 14.1
The notes API changed in TDE 14.1. Also includes several other
enhancements (error checking, testing).
2016-09-26 21:14:58 +02:00
deloptes cb34f4972b tde, tdepim: backend for the TDE desktop (FDO #97780)
This is the code for TDE < 14.1.
2016-09-26 21:07:55 +02:00
Patrick Ohly 8fccc44cc5 NEWS: SyncEvolution 1.5.2 snapshot 2016-09-26 13:18:13 +02:00
Patrick Ohly a6dd353c6a ClientTest: avoid pass-by-value
The CreateSource instance can be big, so passing by reference definitely
is better. Found with cppcheck.
2016-09-26 12:58:27 +02:00
Patrick Ohly b6f6f61bce dbus-session.sh: avoid using dbus-launch
dbus-launch is considered deprecated because of the X11 dependency.
See https://lists.debian.org/debian-devel/2016/08/msg00554.html "Mass bug
filing: use and misuse of dbus-launch (dbus-x11)"

The script still needs to start the D-Bus daemon when used in the nightly
testing, so the code now does it as in
6cc8062cfb

syncevo-http-server still has some usage of dbus-launch left, but that's
strictly for systems which don't have the more modern D-Bus.
2016-09-26 12:58:27 +02:00
Patrick Ohly f2c9838e97 syncevo-dbus-server-startup.sh.in: optional start via D-Bus activation
With the recent change ("Add a systemd user service as a backend for the D-Bus
session services"), activating syncevo-dbus-server via D-Bus will integrate
better with systemd. When auto-starting via the .desktop file, we can do the
same by activating via D-Bus.

We use dbus-send for that, if available. A recent busctl from systemd could
also be used, but for example the one in Debian Jessie is still to old. Better
use dbus-send. Directly starting the binary is used as fallback.

Based on a patch from Simon McVittie.
2016-09-26 12:58:27 +02:00
Simon McVittie 9103a70c72 Add a systemd user service as a backend for the D-Bus session services
On systems with a systemd user session and a D-Bus user bus that
uses it for activation, this ensures that syncevo-dbus-server ends
up in its own cgroup, instead of being treated as part of dbus.service.

If org._01.pim.contacts and org.syncevolution are activated in quick
succession, it also prevents a race condition that would make one of
the activations fail, similar to
<https://bugs.freedesktop.org/show_bug.cgi?id=53220> in
telepathy-mission-control.
2016-09-26 12:58:27 +02:00
Patrick Ohly e126bd500e ObexTransportAgent.cpp: properly shut down connection (FDO #91485)
Apparently there's a race condition in the OBEX transport that causes the
connection to phones via Bluetooth to be shut down prematurely.  Some phones
react by doing a slow sync instead of an incremental sync the next time.

Waiting during shutdown should address the problem (however, it was not
possible to confirm this).
2016-09-26 12:58:27 +02:00
Patrick Ohly 90a4758ce1 PbapSyncSource.cpp.rej: remove from repo
Was accidentally added, does not belong into git repo.
Reported by Tino Mettler.
2016-09-26 12:58:27 +02:00
Patrick Ohly 830367c3f9 gdbusxx/gdbus-cxx-bridge.h: avoid copying of parameter
The value is not big, but const reference is still a bit more efficient.
Found with cppcheck.
2016-09-26 12:58:27 +02:00
Patrick Ohly 426ec3543a syncevolution.org: compile on Ubuntu Trusty, libical v1/v2 compatibility
syncevolution.org binaries are now getting compiled on Ubuntu Trusty and thus
no longer support distros with older EDS. The code should still compile
against older EDS (for example, for Maemo), but that is not getting tested
anymore.

This allows removing the dynamic linker hacks related to older libraries,
which was only used in those binaries. Instead, backends using libical or EDS
get compiled on Ubuntu Trusty and then the soname of those libs get patched to
make the backend module usable in combination with a different set of
libs. That patching is part of a script maintained in the syncevolution.org
build infrastructure.

This approach was already used before to generate different EDS backends
for EDS versions with the newer EClient API, because that turned out to be
easier than the dynamic loading approach. It works because none of the methods
used by SyncEvolution changed their ABI, only some other parts of the
libraries did. Should there ever be a situation again that cannot be handled
like this, then backends might also get compiled on different distros than
Ubuntu Trusty (however, that may lead to problems due to the libstdc++ ABI
changes - to be decided...).

libical still requires one special hack: system time zone loading in
libical v1 (and only in that version, v2 has builtin support again) must
be overridden such that time zones are generated with rules instead
of transitions because that is more compatible with the peers that
SyncEvolution exchanges data with.

That hack now relies on overriding the two relevant functions inside the main
binaries (has to be there, otherwise libical still ends up calling its own
internal implementation). The overriding code is in
libsyncevo-icaltz-util.so.0 and depends on libical.so.1. If
libsyncevo-icaltz-util.so.0 can be loaded, the wrappers in the main binary use
it, otherwise they fall through to the code from the current libical.so, which
then should be libical.so.2 or more recent.

This hack is active by default when libical v1 is detected during configuration.
2016-09-26 12:58:26 +02:00
Patrick Ohly 405ca882eb libsyncevolution: load backends in function instead of constructor
Previously, backends were loaded in a constructor. At some point (*), that
loading crashed with a segfault in the dynamic linker. To make debugging a bit
easier and rule out non-determinism as the root cause of that crash, loading
backends was moved into SyncContect::initMain().

(*) the crash happened when there were two backends which couldn't
be loaded due to missing libraries and was related to error strings.
A simpler test program did not trigger the problem, and now SyncEvolution
has suitable backends for (hopefully?!) all platforms, so it no longer
occurs, at least not during automated testing.
2016-09-26 12:58:26 +02:00
Patrick Ohly 2ad9a45d45 Cmdline.cpp: optionally show debug output in --version output
SYNCEVOLUTION_DEBUG=1 syncevolution --daemon=no --version now
dumps also the debug information gathered by the binary
compatibility code. It was only available in sync logs before.
2016-09-26 12:58:26 +02:00
Patrick Ohly 5638b9ed3f autotools: link libsyncevolution against libpthread explicitly
We call some pthread methods and thus must link against libpthread.
Previously this must have worked by accident, but started failing
on more recent distros.
2016-09-26 12:58:26 +02:00
Patrick Ohly ba8bdc5fb5 carddav testing: only use test cases with REV
DAViCal on Debian Stretch incorrectly re-formats contacts which do not have a
REV property (see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=837154).
Until this gets fixed we work around the problem by including a REV in all
test cases, which implies refreshing the Google CardDAV patch.
2016-09-26 12:58:26 +02:00
Patrick Ohly 941774a1d1 D-Bus testing: fix slowing down file sources
Recent shells filter out environment variables that are not valid shell
variables, so for example,
SYNCEVOLUTION_FILE_SOURCE_DELAY_OPEN_addressbook-slow-server did not get
passed through to syncevo-dbus-server because of the hyphen. As a result, the
tests became unreliable (non-deterministic timing) or outright failed.

Now we ensure that these variables are valid also in a shell and in addition,
make the test stricter such that it detects when the file backend did not
wait.
2016-09-26 12:58:26 +02:00
Patrick Ohly c1ba103059 test-dbus.py: adapt to modified dbus-monitor output
Recent distros like Debian Stretch have newer dbus-monitor with
extended content that no longer matched the regex used before. The
relaxed regex works with old and new dbus-monitor.
2016-09-26 12:58:26 +02:00
Patrick Ohly ad33e1fbba sys.supp: ignore g_dbus_connection_new_sync
Started to appear on Debian Stretch after switching to gdbus from glib.
2016-09-26 12:58:26 +02:00
Patrick Ohly ec32dd02d0 runtests.py: disable rpm packaging
When building on the new syncevolution.org reference platform, Ubuntu Trusty,
building rpm packages with checkinstall fails for unknown reasons. As
providing those rpms is of questionable value (libraries are more likely to be
different on rpm-based distros than on Debian/Ubuntu), building rpm simply
gets disabled entirely.

As a fallback for users there still are the plain .tar.gz archives containing
the same files.
2016-09-26 12:58:26 +02:00
Patrick Ohly 0c90fff232 runtests.py: don't run tests unless explicitly enabled
Previously, when --enabled was not given, all tests were run.  That was meant
to simplify running all tests, but that is rare and more likely to happen by
mistake when not selecting tests correctly in the automated testing, so now we
revert the logic and don't select a test if no --enable filter is set.
2016-09-26 12:58:26 +02:00
Patrick Ohly 40c801ccf9 runtests.py: fix XDG dir fallback
The XDG symlinks were created as fallback in case that the XDG env variables
somehow were ignored. In practice, the symlinks were not needed, so it didn't
matter that they were set incorrectly to the path name outside of the chroot.
But it's confusing when debugging the setup and just plain wrong, so better
fix it...
2016-09-26 12:58:26 +02:00
Patrick Ohly d0d778ed99 runtests.py: make published test results world-readable
client-test makes new directories user-readable because that is
the default for all SyncEvolution directories. But after publishing
the test results, they need to be world-readable, because they are
going to be accessed via some kind of web server running under
some different user.
2016-09-26 12:58:26 +02:00
Patrick Ohly f183271d65 autotools: allow extending core linker flags
These linker flags are added to those normally used for linking against
libsyncevolution. The intended usage is to extend linking of syncevolution.org
binaries such that static versions of libcppunit, libpcrecpp and libopenobex
are used, because the ABI of those libs have changed such that binaries linked
on Ubuntu Trusty would not run on more recent distros like Ubuntu Xenial.

For example, on Ubuntu Trusty i386 one can configure with:
   PCRECPP_LIBS=-lpcre \
   LIBOPENOBEX_LIBS=-lpcre \
   '--with-extra-core-ldadd=/usr/lib/i386-linux-gnu/libpcrecpp.a -lpcre /usr/lib/libopenobex.a /usr/lib/i386-linux-gnu/libusb.a' \
   CPPUNIT_LIBS=/usr/lib/i386-linux-gnu/libcppunit.a
2016-09-26 12:58:26 +02:00
Patrick Ohly 33dce914e8 autotools: use cppcheck.pc
Now cppcheck is found via the normal PKG_CHECK_MODULES. The advantage
is that CPPUNIT_CFLAGS and CPPUNIT_LIBS can be overridden with
configure parameters, which will be used to link cppcheck statically
into syncevolution.org binaries (libcppunit ABI has changed).
2016-09-20 07:00:28 -07:00
Patrick Ohly 499c1c72d5 syncevolution.org: drop binary compatibility hack for old libnotify
syncevolution.org binaries are going to support distros >= Ubuntu Trusty.
All of those have libnotify.so.4, so the old binary compatibility hack is
no longer needed.
2016-09-20 06:51:11 -07:00
Patrick Ohly bf3c8d5361 ClientTest.cpp: fix clang warning
SOURCE_ASSERT_EQUAL() expects to get an expression as first parameter
which may become NULL. Passing a known-non-NULL pointer makes no sense
and triggers a warning from clang:

ClientTestAssert.h:109:50: error: nonnull argument 'copy' compared to NULL
[-Werror=nonnull-compare]
 # define CT_ASSERT_TRUE_CLANG_BUILD(_expression) if (!(_expression)) {
 exit(1); }
...                                                  ^
ClientTest.cpp:859:5: note: in
expansion of macro 'SOURCE_ASSERT_EQUAL'
SOURCE_ASSERT_EQUAL(&copy, 0, config.m_dump(client, copy, copyFile));
2016-08-29 04:59:38 -07:00
Patrick Ohly a53e5289bd dbus-sync.cpp: fix cppcheck performance warning
cppcheck correctly warned that initializing a reference is enough,
no need to copy the string:

dbus-sync.cpp:97: cppcheck performance: passedByValue - Function parameter
'source' should be passed by reference.
2016-08-29 04:58:24 -07:00
Patrick Ohly 16e6e854c3 gdbus-cxx-bridge.h: avoid false cppcheck warning
cppcheck seems to mix up different template variations. The following error
needs to be suppressed in the classes which don't even have an m_a member:

gdbus-cxx-bridge.h:330: cppcheck warning: uninitMemberVar - Member variable
'Set::m_a' is not initialized in the constructor.
gdbus-cxx-bridge.h:339: cppcheck warning: uninitMemberVar - Member variable
'Set::m_a' is not initialized in the constructor.
2016-08-29 04:55:24 -07:00
Patrick Ohly d560aeda07 compilation: fix std::find() == 0 misuse
cppcheck correctly warns about the old code as less efficient (looks
at entire string instead of just the start). Using boost::starts_with
is less obscure and avoids the warning.
2016-08-29 04:52:49 -07:00
Patrick Ohly f7dbb2ed72 runtests.py: better logging of failed command
When execution of a command fails, then printing the actual
string passed to system() is more readable and accurate than
the original array.
2016-08-26 11:20:30 -07:00
Patrick Ohly 2b4b93f1ab compilation: fix const/non-const issue under C++14/gcc 6
Building client-test fails because a const pointer looses the
const attribute while passing it through boost::bind.

Fixes:

boost/lambda/detail/function_adaptors.hpp:357:16: error: invalid conversion
from 'const SyncEvo::SyncSource*' to 'SyncEvo::SyncSource*' [-fpermissive]
return func(a1);
2016-08-26 11:18:20 -07:00
Patrick Ohly 14452722fd compilation: fix push_back ambiguity under gcc 6/C++14
When compiling as C++14 (the default under gcc 6), template
expansion no longer picks the right instantiation of push_back.
We have to disambiguate which of the different push_back
alternatives we want.

Fixes:

Cmdline.cpp:1734:85: error: no matching function for call to 'bind(<unresolved
overloaded function type>, const boost::reference_wrapper<std::__cxx11::list<std::__cxx11::basic_string<char> >
>, const boost::arg<1>&)'
     processLUIDs(source, boost::bind(&list<string>::push_back, boost::ref(luids), _1));
2016-08-26 11:15:23 -07:00
Patrick Ohly 3299613591 compilation: fix boost::shared_ptr->bool issue under C++14
The implicit conversion of boost::shared_ptr->bool is no
longer supported when compiling as C++14 (the default under
gcc 6). We have to cast explicitly.

Fixes errors like this:

Logging.h:258:41: error: cannot convert 'const boost::shared_ptr<SyncEvo::Logger>' to 'bool' in return
         operator bool () const { return m_logger; }
2016-08-26 11:14:44 -07:00
Patrick Ohly 4e2dd07580 autotools: disable timezone override hack when using libical v2
libical v2 provides support for interoperable timezone definitions
again, so the copy of the original code that was added for libical v1
is not needed anymore and also wouldn't compile.

Therefore SyncEvolution can drop it when being compiled for v2. In that
case, a corresponding change in libsynthesis calls
icaltzutil_set_exact_vtimezones_support(0) to enable interoperable
timezones.

This addresses compilation and running with libical v2, i.e. what
normal distros are doing. Compiling with libical v1 and running
with v2 needs to be addressed separately, if possible at all.
2016-08-26 09:15:22 -07:00
Tino Mettler a9aaf5b1e6 1.5.1-2 package 2016-07-14 09:50:37 +02:00
Tino Mettler b5f5312b1c Fix remaining FTBFS with GCC 6 by downgrading the C++ dialect to gnu++98
Closes: #811624
2016-07-14 09:50:11 +02:00
Tino Mettler 80a82f6d27 Merge tag 'patches/1.5.1-2'
Patches for 1.5.1-2
2016-07-14 09:48:41 +02:00
Tino Mettler 9286b88515 Add missing casts from shared_ptr to bool to fix FTBFS with GCC 6 2016-07-08 12:54:32 +02:00
Tino Mettler 46a2401a19 1.5.1-1 package 2016-05-19 16:23:30 +02:00
Tino Mettler 0751ac954e Depend on recent libsynthesis package 2016-05-19 16:23:30 +02:00
Tino Mettler 470ecf0810 Remove old debug package definition, use the new dbgsym packages 2016-05-19 16:23:30 +02:00
Tino Mettler 254581a15b Upstream generates a manpage, remove outdated and obsolete own version 2016-05-19 16:23:30 +02:00
Tino Mettler 6a291c3ca9 Add dh_auto_clean quirk to make the package build twice in a row 2016-05-19 16:23:30 +02:00
Tino Mettler ce127cfff5 Bump standards version, no changes needed 2016-05-19 16:23:24 +02:00
Tino Mettler b2bcf9e9f2 Update Vcs-* fields to new URLs 2016-05-19 10:14:39 +02:00
Tino Mettler cd3958d29d New upstream release 2016-05-19 10:14:39 +02:00
Tino Mettler b096541898 Merge tag 'patches/1.5.1-1'
Patches for 1.5.1-1
2016-05-19 10:14:34 +02:00
Tino Mettler 5feaaf8692 Fix FTBFS with libical2
Use patch from Fedora package to fix FTBFS with libical2.

Taken from http://pkgs.fedoraproject.org/cgit/rpms/syncevolution.git/commit/syncevolution-1.5.1-libical2.patch?id=a53ce39a06ba73e210fd229690392bea8e800d20

Closes: #824426
2016-05-19 10:08:39 +02:00
Tino Mettler 9cc6dae34b Merge tag 'upstream/1.5.1' into patch-queue/upstream
Upstream version 1.5.1
2016-03-01 10:15:27 +01:00
Tino Mettler ed33df2b0d 1.4.99.4-5 package 2016-02-26 11:58:09 +01:00
Tino Mettler b281c6ad3f Build-depend on libopenobex2-dev (Closes: #813819) 2016-02-26 11:58:09 +01:00
Tino Mettler ef8aa5f277 1.4.99.4-4 was released 2016-02-26 11:58:09 +01:00
Tino Mettler e8235b149d 1.4.99.4-4 2015-09-10 11:50:07 +02:00
Tino Mettler 409e631301 Fix libsynthesis depencency after GCC5 transition
The libsynthesis0 package was renamed to  libsynthesis0v5.

Closes: #797966
2015-09-10 11:37:51 +02:00
Patrick Ohly bbfe468290 mkdir_p: support non-readable parent directories (FDO #91000)
The previous mkdir_p() walked down top to bottom and checked each path
entry as it went along. That approach failed unnecessarily when some
existing parent directory could not be read (non-readable /home, for
example).

The new version tries to create the lowest directories first
(brute-force) and only walks up when that is necessary to avoid an
ENOENT.
2015-08-14 18:42:47 +02:00
Patrick Ohly 5a7bb9b572 autotools, NEWS: SyncEvolution 1.5.1 2015-06-05 14:58:41 +02:00
frdsktp bcf21809d5 syncevo-http-server: stop using deprecated twisted.web.error (FDO #90419)
twisted.web.error.NoResource was replaced by
twisted.web.resource.NoResource.  This has become a real problem for
example on Fedora 22 where the old name is no longer available.
2015-06-05 14:31:43 +02:00
Patrick Ohly a5f0139a10 syncing: avoid segfault for invalid text inside items (FDO #90118)
As reported by Canonical, syncing fails if data items contain
text which is not correct UTF-8 in one of the fields that
SyncEvolution logs in the command line output (like SUMMARY of
a calendar event).

That is because the byte string coming from the item is passed
unchecked to the D-Bus implementation for transmission via D-Bus. But
D-Bus strings must be correct UTF-8, so depending on the D-Bus library
in use, one gets a segfault (GIO D-Bus, due to an unchecked NULL
pointer access) or an "out of memory" error (libdbus, which checks for
NULL).

What the D-Bus bindings now do is checking the string in advance (to
avoid error messages inside the D-Bus implementations) and then
replacing all invalid bytes with question marks. The rest of the
string is preserved.

Handling this inside the D-Bus binding layer is not the "correct"
solution (which would be to check for UTF-8 in the higher layers were
such bad data might get into SyncEvolution), but it is the less
intrusive and more complete one. Changing the bindings such that all
strings must be declared explicitly as "UTF-8 string" would have been
a way to find all places where such checks are missing, but it turned
out to be too complex and requiring too many changes.
2015-06-05 05:26:26 -07:00
Patrick Ohly 1385ac43fb file backend: log item manipulation
Extracting a meaningful description of each item from the Synthesis
engine when updating and adding items is easy to do for items of
certain known types (contacts and calendar items) and arguably an
improvement; in particular it makes tests like
TestCmdline.testSyncOutput more realistic.
2015-06-01 14:23:46 +02:00
Patrick Ohly c9a7cf1901 D-Bus testing: check sync result on both sides of TestLocalSync.testSync
Checking that the item still exists on the side where it was created
is okay, but it is more important to check that it also reached the
other side.
2015-06-01 14:22:19 +02:00
Patrick Ohly 0ac91f5658 command line: preserve log prefix of target side of local sync
In some cases, the prefix which was supposed to be embedded
in the log messages from the target side of a local sync got
lost on the way to the command line tool.

Primarily this affected the added/updated/deleted messages, as in:

[INFO remote@client] @client/addressbook: started
[INFO remote@client] updating "Joan Doe"
[INFO remote@client] @client/addressbook: received 1/1

This was not caught by automated testing because the corresponding
test (TestCmdline.testSyncOutput and TestCmdline.testSyncOutput2) is
using the file backend, which does not generate such messages at the
moment (to be changed separately).
2015-06-01 14:17:14 +02:00
Niels Ole Salscheider cd93586d0b Use ${PKG_CONFIG} instead of pkg-config.
This fixes the build on Exherbo that only has prefixed versions of pkg-config.
2015-04-17 10:41:44 +02:00
Patrick Ohly 84a30285a9 WebDAV: handle 403 during Google OAuth authentication
When sending an access token with insufficient scope (for example,
because the Ubuntu Online Accounts service definition was incomplete,
as documented in FDO #86824), Google responds with a 403 "service
denied" error.

Neon (arguably correctly) treats this as a permanent error and not
as a transient authentication error. Google should better send
a 401 error.

To activate the 401 error handling in SyncEvolution, detect this
special case and turn the general SE_ERROR error into SE_AUTH.
2015-03-03 10:44:03 +01:00
Patrick Ohly d84f323398 signon: ensure consistent use of "username" provider prefix
The Ubuntu Online Accounts signon backend complained about
invalid "username" content with an error message containing "sso",
the string used for gSSO.

Define these magic strings once and then use only the defines.
2015-03-03 10:44:03 +01:00
Alberto Mardegan 9acfd11de7 signon-accounts: implement getCredentials
Use the information contained in the AgAuthData object to decide which
authentication method is being used.
Move the common authentication code into a private authenticate()
method.

[PO: fixed g_variant_builder_end() mem leak]
[PO: avoid issue found via cppcheck: returning std::string::c_str() in
a method returning a std::string forces a string copy, which is
inefficient.]
[PO: UiPolicy was not set because of an invalid g_variant_builder_add()
"sv" parameter.]
2015-03-03 10:43:26 +01:00
Alberto Mardegan c58ed9ff59 signon-accounts: pass the AgAuthData to the SignonAuthProvider
Instead of passing the session data and the mechanism, pass the full
AgAuthData object to the SignonAuthProvider constructor.
This object can be used to build the session data without converting all
dictionaries to and from GHashTable.

[PO: fixed g_variant_builder_end() mem leak]
[PO: ForceTokenRefresh was not set because of an invalid g_variant_builder_add()
"sv" parameter.]
2015-03-03 10:41:52 +01:00
Alberto Mardegan 382c81e70f signon-accounts: do not create identities on the fly
It's not sync-evolution task to complete the account creation; in those
platforms where this backend is deployed (Ubuntu, Elementary, KDE) the
account should already be created with a proper SignonIdentity attached
to it.
2015-03-03 10:30:53 +01:00
Alberto Mardegan ff12834be1 AuthProvider: removed failure count
Remove the failure count from the getOAuth2Bearer() method, and add an
invalidateCachedSecrets() method instead.

This moves the logic of how to deal with failures back to the
AuthProvider backend and simplifies the session code, which only needs
to call invalidateCachedSecrets() when the token is wrong.
This will help implementing a similar logic for the getCredentials()
method, where authentication errors could lead to requesting a new
password.

[PO: avoid issue found via cppcheck: returning std::string::c_str() in
a method returning a std::string forces a string copy, which is
inefficient.]
2015-03-03 10:30:29 +01:00
Alberto Mardegan ab4524ab9f signon: move libaccounts-based plugins into their own source file
The libaccounts-based backends ("gsso" and "uoa") are going to use more
of libaccounts-glib, making sharing of code with the plain "signon"
plugin much harder to maintain.
2015-03-03 10:15:44 +01:00
Patrick Ohly 75115022c5 CalDAV: more efficient "is empty" check (FDO #86335)
Since 1.4.99.4, syncing WebDAV collections always checks first
whether there are items in the collections. This was partly done for
slow sync prevention (which is not necessary for empty collections),
partly for the "is the datastore usable" check.

However, this did not take into account that for CalDAV collections,
the entire content gets downloaded for this check. That is because
filtering by item type (VEVENT vs. VJOURNAL) is not implemented
correctly by all servers. So now all CalDAV syncs, whether incremental
or slow, always transfered all items, which is not the
intention (incremental syncs should be fast and efficient).

This commit adds a more efficient isEmpty() check: for simple CardDAV
collections, only luid and etag get transferred, as in
listAllItems(). This is the behavior from 1.5.

For CalDAV, a report with a filter for the content type is used and
the transfer gets aborted after the first item, without actually
double-checking the content of the item. This is different from
listAllItems(), which really transfers the content. This extra content
check would only be needed for some old servers (Radical 0.7) and is
not essential, because reporting "not empty" even when empty is safe.
2015-03-03 10:15:44 +01:00
Patrick Ohly 7e5638fd90 WebDAV: utility class for ne_status
Besides offering C++ wrappers for the C API, this class also ensures
that memory for the "reason_string" is properly freed.
2015-03-03 10:15:44 +01:00
Patrick Ohly 85df49a68b WebDAV: enhance report handling (status, aborting)
Capture the item status and pass it to the response handler.

Response handlers are allowed to return a non-zero integer when using
the initAbortingReportParser(), which then aborts processing of the
response.

This leads to errors being returned by
ne_xml_dispatch_request(). Session::run() needs to be told if the
request was aborted, in which case all errors are ignored.
2015-03-03 10:15:44 +01:00
Patrick Ohly 905ca53824 WebDAV: send Basic Auth via http in some cases (FDO #57248)
It turned out that finding databases on an Apple Calendar server accessed via
http depends on sending Basic Auth even when the server does not ask for it:
without authentication, there is no information about the current principal,
which is necessary for finding the user's databases.

To make this work again, sending the authentication header is now forced for
plain http if (and only if) the request which should have returned the
principal URL fails to include it. This implies sending the same request
twice, but as this scenario should be rare in practise (was only done for
testing), this is acceptable.
2015-03-03 10:15:44 +01:00
Patrick Ohly 096b7e61aa wrappercheck.sh: enhanced killing of daemon
Occasionally the script shutdown got stuck on Ubuntu Vivid because killing
the background daemon failed although it was still runnning, thus causing the
wait to hang forever.

Not exactly sure what caused this. The enhancement tries to fall back to
killing the process instead of the process group (in case that there is
a race condition, which shouldn't be the case when waiting for the daemon),
preserves stderr from the kill commands and adds ps output when there is
an unexpected failure.
2015-03-03 10:15:44 +01:00
Patrick Ohly f4f83c1540 wrappercheck.sh: route daemon stderr through logger.py
Only stdout got passed through logger.py before. stderr ended up
in the daemon log unmodified.
2015-03-03 10:15:44 +01:00
Patrick Ohly f192b140eb wrappercheck.sh: add --wait-for-dbus-daemon
EDS 3.12 on Ubuntu Vivid no longer prints the message about obtaining
the D-Bus name. Instead we need to wait for it to show up on the session
bus.
2015-03-03 10:15:44 +01:00
Patrick Ohly f7b19f645e wrappercheck.sh: avoid kill without process pids
During exit, check whether there are really processes to be killed.
Avoids some error messages from the bogus kill invocation.
2015-03-03 10:15:44 +01:00
Patrick Ohly a8e39070d6 testing: relax SyncEvo::IcalTest::testTimezone
The test started to fail in 2015 because the VTIMEZONE generated by
the code copied from libical has a minor dependency on the current
time: it finds the transitions for the current year, then pretends
that the same rule applied since 1970. While doing that, it uses this
years transition date and just replaces the year. Because the exact
date varies between years, the result depends on the current year.

The test now simply ignores the day of the month, while still checking
year and month. Those should always be the same.
2015-03-03 10:15:44 +01:00
Patrick Ohly 4e60b67c27 testing: ignore dl error on Ubuntu Vivid 2015-03-03 10:14:19 +01:00
Patrick Ohly fa27793134 PlainGStr: fix incorrect destruction when using reset()
When storing a pointer with PlainGStr::reset(), the default delete []
was used to free the memory. Should have used g_free(), as in the
constructor. Affects the signon backend.
2015-03-03 10:14:19 +01:00
Patrick Ohly 0c5f9c5170 StringPrintfV: add missing va_end()
When returning prematurely, va_end() was not called. This is a
potential resource leak. Found with cppcheck 1.67.
2015-03-03 10:14:19 +01:00
Patrick Ohly 4bedb549b3 gdbus: add missing va_end()
When returning prematurely, va_end() was not called. This is a
potential resource leak. Found with cppcheck 1.67.
2015-03-03 10:14:19 +01:00
Patrick Ohly b74f7273fa PullParams: cleaner initialization
cppcheck warned about the non-portable initialization of a float
via memset. It is okay on all current architectures, but better
assign a real float 0 value anyway, while keeping the memset for
the rest of the elements.

The second memset() had already become redundant when adding the
PullParams constructor.
2015-03-03 10:14:19 +01:00
Patrick Ohly 08ba09df04 shutdown: fix memory allocation deadlock
When the SuspendFlags::handleSignal() signal handler got called while
the program was allocating memory in libc, a deadlock occurred when
the mutex locking code in RecMutex::lock() tried to allocate the guard
instance (see backtrace below).

This could be fixed with new mutex code which gives up the guard
concept, a guard concept using C11 mechanisms (copy semantic of a
stack-allocated guard) or not locking at all in getSuspendFlags().

This commit uses the latter. It is simpler and can still be done
correctly because locking is not necessary except when the singleton
has not been allocated yet. That part gets moved into the process
startup phase via SyncContext::initMain().

Thread 1 (Thread 0x7fec389e6840 (LWP 16592)):
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
   from /lib/x86_64-linux-gnu/libc.so.6
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
    d=<optimized out>, p=0x7fec38196f60 <SyncEvo::suspendRecMutex>,
    this=<synthetic pointer>)
    at /usr/include/boost/smart_ptr/detail/shared_count.hpp:167
    p=0x7fec38196f60 <SyncEvo::suspendRecMutex>, this=<synthetic pointer>)
    at /usr/include/boost/smart_ptr/shared_ptr.hpp:363
    this=<synthetic pointer>)
    at /data/runtests/work/sources/syncevolution/src/syncevo/ThreadSupport.h:60
    at /data/runtests/work/sources/syncevolution/src/syncevo/ThreadSupport.h:81
    at /data/runtests/work/sources/syncevolution/src/syncevo/SuspendFlags.cpp:58
    at /data/runtests/work/sources/syncevolution/src/syncevo/SuspendFlags.cpp:280
    oldp=0x115b7d0, oldsize=80, nb=48) at malloc.c:4208
    at malloc.c:3029
    n_bytes=n_bytes@entry=32)
2015-03-03 10:14:19 +01:00
Patrick Ohly c61db46f8d syncevolution.org binaries: allow libical1a
Because of the confustion around the libical 1.0 ABI, Debian ended
up renaming the package for Debian Jessie while keeping the libical.so.1
soname. Pre-built binaries from older distros work, so just adapt
the package meta data.
2015-03-03 10:14:19 +01:00
Patrick Ohly 112c932432 glib: fix TrackGLib::ref()
The class is used for non-GObject types, so we must use a
type-specific method to increase the
ref-count. intrusive_ptr_add_ref() does that automatically for us.
Calling g_object_ref() was a cut-and-paste error.
2015-02-09 15:02:22 +01:00
Tino Mettler 89dbb2d223 Use TLS instead of SSLv3
This fixes a potential security risk and connection problems with clients
that don't support SSLv3 anymore.

Closes: #772040
2014-12-12 08:45:24 +01:00
Patrick Ohly 0511cb1dcf GDBus GIO: fix compilation on s390 32bit, II (Fedora Bug #1163188)
The previous commit for the problem caused a compilation error
in the PBAP backend, because Bluez uses a 64 bit type that no longer
had a type trait on 32 bit architectures.

Adding "[unsigned] long long" traits fixes that. It seems to work
also on 64 bit architectures, so I am not adding any ifdefs and just
enable it unconditionally.
2014-12-11 23:29:26 -08:00
Tino Mettler 8de548f123 1.4.99.4-3 package 2014-12-04 22:46:12 +01:00
Tino Mettler 2dc7a0ba47 Merge tag 'patches/1.4.99.4-3'
patches for 1.4.99.4-3
2014-12-04 22:44:33 +01:00
Tino Mettler 7d28023144 Use TLS instead of SSLv3 in SyncML server script
This fixes a potential security risk. It also avoids connection problems
with clients that don't support SSLv3 anymore, like the syncevolution SyncML
client itself.

Closes: #772040
2014-12-04 22:43:32 +01:00
Tino Mettler 8e9e1841aa 1.4.99.4-2 package 2014-12-04 22:40:35 +01:00
Patrick Ohly f4d91d4cef GDBus GIO: fix compilation on s390 32bit (Fedora Bug #1163188)
size_t is defined as unsigned long on s390 in 32bit mode, which is is not the
same type as uin32_t = unsigned int, which caused a compile failure due to the
missing type trait.

The solution is to define traits for all the standard language types instead
of the fixed-size types. This removes the 64 bit types on 32 bit platforms but
adds the types that were missing on s390.

All the types that we use in the D-Bus bindings are among these standard
types, so that is okay.
2014-11-17 23:33:41 -08:00
Patrick Ohly 97b2051c2d autotools, NEWS: SyncEvolution 1.5 2014-10-31 13:22:05 +01:00
Patrick Ohly 5e0680a448 signon: fix HashTable2Variant() ref counting (TC-1667)
This fixes a crash/memory corruption issue in the plain signon backend
as used in Tizen.

The real bug was that HashTable2Variant() creates a GHashTableCXX by
stealing a floating GVariant without actually acquiring the reference,
leading to various glib errors caused by double free and/or invalid
memory access.

The code in signon.cpp receiving the GHashTableCXX was correct, albeit
overly complicated (creating a new reference via g_variant_ref_sink()
explicitly instead of relying on GHashTableCXX semantic).
2014-10-31 13:22:04 +01:00
Patrick Ohly 37bd43cc20 autotools: bump libsynthesis requirement
We need a libsynthesis with RELAXEDCOMPARE().
2014-10-30 21:49:51 +01:00
Tino Mettler 7610b4d1f0 Merge tag 'patches/1.4.99.4-2'
Patches for 1.4.99.4-2
2014-10-26 14:09:51 +01:00
Tino Mettler 0a4e4b6575 Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC
Work around missing SOCK_CLOEXEC on kfreebsd by setting FD_CLOEXEC
afterwards.
2014-10-26 13:47:05 +01:00
Tino Mettler eed22f7ead 1.4.99.4-1 package 2014-10-25 22:34:46 +02:00
Tino Mettler f095ec0853 syncaddressbook.so vanished, as iOS addressbook support was removed
Upstream didn't support it anymore, so it was removed.
2014-10-25 22:19:15 +02:00
Tino Mettler f0a010bcf5 Build-depend on libsynthesis 3.4.0.47.4 2014-10-25 22:00:52 +02:00
Tino Mettler 87d467fcae New upstream release candidate 2014-10-25 21:34:52 +02:00
Tino Mettler 9f8d2a372b Merge branch 'patch-queue/upstream' 2014-10-25 21:33:41 +02:00
Patrick Ohly 0f41165500 sync: ignore unnecessary username property
A local sync or Bluetooth sync do not need the 'username' property.
When it is set despite that, issue a warning.

Previously, the value was checked even when not needed, which
caused such syncs to fail when set to something other than a plain
username.
2014-10-24 16:42:34 +02:00
Patrick Ohly f3e1e10916 wrappercheck: augment output of daemon with time stamps
Useful for correlating events in the daemon with events in testing.
We need to use a process group to deliver SIGINT/SIGTERM, otherwise
we cannot be sure that we catch all processes created by the daemon.

The return code of the daemon was not checked before (accidentally?!)
and this patch does not change that. Might be fixed in the future.
2014-10-24 07:13:33 -07:00
Patrick Ohly 7a046c1998 wrappercheck: fix repeated daemon startup
The daemon log gets reused when starting daemons multiple times.
When starting a second time, the simple grep used to find the
output of the previous and did not wait properly. We need to count
matching lines and continue once a new one appears.
2014-10-24 07:06:38 -07:00
Patrick Ohly 3d2b8841ea wrappercheck: augment output
Multiple different wrappercheck instances are running concurrently
in the nightly testing, so better include a prefix with unique PID
in the "set -x" output to identify where it came from.
2014-10-24 07:04:49 -07:00
Patrick Ohly 18d301b37c wrappercheck: configurable sleep after daemon launch
When output checking isn't possible, allow sleeping for a configurable
amount of time.
2014-10-24 07:02:17 -07:00
Patrick Ohly c2dd6033ed D-Bus server: fix unreliable shutdown handling
Occassionally, syncevo-dbus-server locked up after receiving
a CTRL-C. This primarily affected nightly testing, in particular (?)
on Ubuntu Lucid.

The reason was two-fold:
- indirectly allocating memory when getSuspendFlags() had to
  allocated the guard instance of the mutex
- glib mutex held by some other thread when trying to do
  g_main_loop_quit().

SuspendFlags already handles signals without these problems. So
instead of overriding that, let SuspendFlags signal the receival
of a signal by writing to its FD and monitor that in our main
event loop, then quit the main event loop from inside the main
thread itself.
2014-10-24 05:25:04 -07:00
Patrick Ohly efedc4d4f1 glib: add GIOChannelCXX
Will be needed by D-Bus server when watching SuspendFlags FD.
2014-10-24 05:21:21 -07:00
Patrick Ohly 5668542116 testing: include stack backtrace when killing stuck process
The issue with malloc being called in niam() in syncevo-dbus-server
and deadlocking was only found after adding gdb's output of the
syncevo-dbus-server stack backtrace.
2014-10-10 03:19:45 -07:00
Patrick Ohly 9f04119d32 testing: ignore some minor leaks 2014-10-10 03:19:45 -07:00
Patrick Ohly bce3ebdbf9 testing: Google testcases must work with and without libphonenumber support in EDS
"primary 80" ends up being recognized as phone number, adding the E.164
parameter if (and only if) EDS was compiled with libphonenumber support
(Debian Jessie!). Adding that breaks the comparison, so avoid the situation
by updating to a string which is not a phone number.
2014-10-10 03:19:44 -07:00
Patrick Ohly 86ef9e515f testing: ignore valid Akonadi vCard changes
Manipulating GEO and not storing X-EVOLUTION-UI-SLOT parameters
are acceptable changes, ignore them when testing.
2014-10-10 03:19:44 -07:00
Patrick Ohly 652c096cd3 testing: ignore Akonadi encodig issues
Akonadi uses different quoting for special characters. Probably would have to
be looked into and reported, but for now ignore it by not testing these
special cases.
2014-10-10 03:19:44 -07:00
Patrick Ohly 44c52bc9c6 testing: ignore Akonadi Client::Sync::file_event::testAddBothSides failures
When syncing Akonadi with file source, neither side recognizes duplicates
based on UID/RECURRENCE-ID. Should be added to Akonadi source. For now ignore
it.
2014-10-10 03:19:44 -07:00
Patrick Ohly 3f5e25ac31 testing: ignore Memotoo eds_memo update failures
Memotoo randomly decides to send back an unmodified iCalendar 2.0 memo.
This does not hurt, so don't check the exact sync result when testing
Memotoo.
2014-10-10 03:19:35 -07:00
Patrick Ohly d50e61db85 testing: give valgrind more time in SyncTests::testTimeout() 2014-10-10 03:19:31 -07:00
Patrick Ohly 470c3490e6 PIM testing: allow testSync to run longer udner valgrind 2014-10-10 03:19:29 -07:00
Patrick Ohly 50148ab580 scripting: prevent premature loop timeouts
The more complex "avoid data loss during merging" scripting ran for longer
than 5s limit under extreme conditions (full logging, busy system, running
under valgrind), which resulted in aborting the script and a 10500 "local
internal error" sync failure.

The endless loop prevention should only be necessary to detect programming
mistakes, so better disable it entirely.
2014-10-10 03:19:27 -07:00
Patrick Ohly b99e3bea06 testing: run one test per client-test instance
When client-test starts, it determines all tests that would get
run, then runs all of them one-by-one in new instances. A single
test gets run directly.

The output changes slightly: the CppUnit summary with number of
failures or errors is no longer available and there are additional
blank lines between tests.

The advantage is that each single test is properly isolated from the
other, which is closer to how real syncs run. It also helps when
running under valgrind, because a leak can be attributed exactly to
one test and because it avoids permanently growing memory consumption
in long-running client-test runs (seen in the nightly testing even
when there were no leaks, perhaps because of memory fragmentation).

A potential downside of this change is that unexpected and undesirable
side effects of modules might no longer show up in testing, only when
combining them in real syncs. This should still be covered by
Client::Sync tests involving multiple modules.
2014-10-10 03:17:47 -07:00
Patrick Ohly ba75dac798 PIM: always install examples
The PIM example Python scripts are useful also when testing is not
enabled; previously, they were not distributed at all.
2014-10-10 01:55:42 -07:00
Patrick Ohly a6061cd1d3 PIM: make examples work with recent Python GNOME
Try the traditional "import gobject" first, fall back to GIR
introspection. Needed for distros like Tizen.
2014-10-10 01:55:42 -07:00
Patrick Ohly 7f678583a9 signon: fix providersignon.so
The shared providersignon.so ended up being compiled with "gsso" as
prefix for the username. We need to check that this really works by also
testing for USE_ACCOUNTS.
2014-10-10 01:55:41 -07:00
Patrick Ohly 83d9d96be5 PIM testing: use file source similar to PBAP (part of FDO #84710)
Bug #84710 was not found by the automated testing because the file
source still sent re-encoded items. Switching it to raw items
triggered the bug and now helps to avoid regressions in the modified
merge script.
2014-10-09 21:32:03 +02:00
Patrick Ohly 2e2c9dca77 vcard: fix caching of PBAP contacts (FDO #84710)
After changing PBAP to send raw items, caching them led to unnecessary
disk writes and bogus "contacts changed" reports. That's because
the merge script relied on the exact order of properties, which was
only the same when doing the redundant decode/encode on the PBAP side.

Instead of reverting back to sending re-encoded items, better enhance
the contact merge script such that it detects contacts as unchanged
when just the order of entries in the property arrays is different.
This relies on an enhanced libsynthesis with the new RELAXEDCOMPARE()
and modified MERGEFIELDS().
2014-10-09 21:31:31 +02:00
Patrick Ohly 936ccc5df2 vcard: remove duplicate loops
Due to cut-and-paste, some arrays were checked multiple times. Only
caused unnecessary overhead.
2014-10-09 21:26:02 +02:00
Mateusz Polrola 569e6b29bf PBAP: Wrong behaviour when SYNCEVOLUTION_PBAP_CHUNK_TRANSFER_TIME is <= 0.
Setting SYNCEVOLUTION_PBAP_CHUNK_TRANSFER_TIME to value <= 0 is not
working like described in README file.
Currently in such case desired chunk size is very quickly decreasing
to 0 and causing synchronization finish without downloading all
contacts.

This patch is disabling tuning desired chunk size in such case,
keeping transfer size constant and equal to initially set value.
2014-09-24 13:14:17 +02:00
Patrick Ohly d6a3ab3209 autotools, NEWS: SyncEvolution 1.4.99.4 2014-09-12 11:38:57 +02:00
Patrick Ohly 79f98f3df9 testing: ignore Memotoo eds_memo failure
When sent
  SUMMARY:Simple
  DESCRIPTION:Simple
Memotoo returns
  SUMMARY:Simple
  DESCRIPTION:Simple\nSimple

Remove this particular test case until the problem in the server
is fixed.
2014-09-12 11:38:57 +02:00
Patrick Ohly b26f49eaa3 oauth2: refresh token -> oauth2
That the backend is based on a refresh token is an implementation
detail; it might even change at some point if we figure out how
to do OAuth2 internally.

Better use the shorter "oauth2" name in the "username" property.

Also better align .so name and global variable names/defines in
configure and Makefile with the name of the backend.
2014-09-12 11:38:57 +02:00
Patrick Ohly be846f8e60 oauth2: handle errors during password update
There is no guarantee that the password can be updated. Allow the attempt
to fail without treating it as an error (that would be confusing in the most
common case, where "password" was given on the command line) and instead
just print an INFO message with the new token and some instructions.
2014-09-12 11:38:57 +02:00
Patrick Ohly 64fb7212cf oauth2: use simpler username syntax
All the values in the username hash are strings. This is unlikely to
change and if it does, we can always do some string-to-value
conversion in our own code. Therefore use the simpler syntax without
the angle brackets marking a variant value.

Simplifies our C++ code, too, and now also compiles on Ubuntu Trusty
(which doesn't have a recent enough glib for G_VARIANT_TYPE_VARDICT).
2014-09-12 11:38:57 +02:00
Patrick Ohly efca1250fd GVariant: also support conversion to simpler string hash
Extracting actual values from a hash with GVariant as value is more
work than reading string values directly. For cases where only strings
may occur as values, the simpler string hash is therefore prefered.
2014-09-12 11:38:57 +02:00
Patrick Ohly a6079c376e oauth2: README update
Avoid the term HMI because it is only used in certain communities.

Make the example username work for CalDAV and CardDAV and base it on
GOA, because that's what most users will have installed.
2014-09-12 11:38:57 +02:00
Patrick Ohly bfc60f1784 oauth2: support json.pc and json-c.pc
The only difference is the name of the module and the path to json.h,
which can be found as just json.h when using the -I statements from
the .pc files.
2014-09-12 11:38:57 +02:00
Mateusz Polrola 00ff3abbc7 oauth2: new backend using libsoup/libcurl
New backend implements identity provider for obtaining OAuth2 access
token for systems without HMI support.
Access token is obtained by making direct HTTP request to OAuth2 server
and using refresh token obtained by user in some other way.
New provider automatically updates stored refresh token when OAuth2
server is issuing new one.
2014-09-12 11:38:57 +02:00
Patrick Ohly 6298afabcb SoupTransport: avoid uninitialized memory read
Don't depend on setSSL() to initialize the instance, because when used
as part of the upcoming oauth2 backend, setSSL() is never called.
2014-09-12 11:38:56 +02:00
Patrick Ohly f5ae660c70 SoupTransport: drop CA file check
It used to be necessary to specify a CA file for libsoup to enable SSL
certificate checking. Nowadays libsoup uses the default CA store
unless told otherwise, so the check in SyncEvolution became
obsolete. However, now there is a certain risk that no SSL checking is
done although the user asked for it (when libsoup is not recent enough
or compiled correctly).
2014-09-12 11:38:56 +02:00
Mateusz Polrola b747a8c2e4 identity: allow using and updating the "password" property
So far, only the "username" property was used once identity providers
were involved. The upcoming oauth2 provider uses the "password"
property for the refresh token and needs the ability to store a new
token if the OAuth2 server updates it.

Setting the new value will not always be possible (for example,
when running a command line operation where all properties were
provided on the command line without a permanent config). This still
needs to be handled.
2014-09-12 11:38:56 +02:00
Patrick Ohly f2b2ea4271 GVariant: move common code into libsyncevolution
The same code will also be needed by the upcoming oauth2 backend.  The
header file depends on glib, so don't install it as a public header
file of libsyncevolution (i.e. only allow using it internally).

The original signon code used a custom GVariant auto_ptr because it
needed the simple assignment semantic of "transfers ownership". Now
that the GVariantCXX class is in a shared header file, better make it
identical to the other CXX classes (i.e., a shared pointer). Avoid
returning plain pointers because ownership of those cannot be checked
by the compiler.

The signon case can be handled with GVariantStealCXX, which by default
takes ownership in the constructor and the default assignment
operator.
2014-09-12 11:38:56 +02:00
Patrick Ohly a2e990e51f PBAP: use raw text items
This avoids the redundant parse/generate step on the sending
side of the PBAP sync.
2014-09-12 11:38:50 +02:00
Patrick Ohly 626e027d3d datatypes: raw text items with minimal conversion (FDO #52791)
When using "raw/text/calendar" or "raw/text/vcard" as SyncEvolution
"databaseFormat", all parsing and conversion is skipped. The backend's
data is identical to the item data in the engine. Finding duplicates
in a slow sync is very limited when using these types because the entire
item data must match exactly.

This is useful for the file backend when the goal is to store an exact copy
of what a peer has or for limited, read-only backends (PBAP).

The implementation uses the "raw" base type which does nothing but storing
the item content verbatim. That type requires a field named "ITEMDATA". After
renaming the variable used by our MAKETEXTWITHPROFILE/PARSETEXTWITHPROFILE
with other, more complex types, all we have to do is skip this conversion
by not providing a profile name.
In a refresh-from-remote local sync of 1000 contacts with photo data
using the file backend, this reduces the number of CPU cycles from
2861476184 to 1840952543 on the server side.
2014-09-12 11:38:40 +02:00
Patrick Ohly f994f1efb2 SyncSource: flush map items less frequently
The Synthesis API does not say explicitly, but in practice all map
items get updated in a tight loop. Rewriting the m_mappingNode (case
insensitive string comparisons) and serialization to disk
(std::ostrstream) consume a significant amount of CPU cycles and cause
extra disk writes.

It is better to allow changes to be cached in memory instead and only
flush to disk at the end. There is no explicit flush API, so we use
SaveAdminData as trigger for flushing instead.

In a refresh-from-remote local sync of 1000 contacts with photo data
using the file backend, this reduces the number of CPU cycles from
4138538276 to 2861476184 (measured with callgrind on x86_64).
2014-09-10 14:19:22 +02:00
Patrick Ohly e60e0d0955 local sync: exchange SyncML messages via shared memory
Encoding/decoding of the uint8_t array in D-Bus took a surprisingly
large amount of CPU cycles relative to the rest of the SyncML message
processing. Now the actual data resides in memory-mapped temporary
files and the D-Bus messages only contain offset and size inside these
files. Both sides use memory mapping to read and write directly.

For caching 1000 contacts with photos on a fast laptop, total sync
time roughly drops from 6s to 3s.

To eliminate memory copies, memory handling in libsynthesis or rather,
libsmltk is tweaked such that it allocates the buffer used for SyncML
message data in the shared memory buffer directly. This relies on
knowledge of libsmltk internals, but those shouldn't change and if they
do, SyncEvolution will notice ("unexpected send buffer").
2014-09-10 12:06:53 +02:00
Patrick Ohly 345a58abe4 config: sanitize maxMsgSize and maxObjSize while reading from config
Unusually small values were ignored during syncing. Doing this in the config
access methods instead of the sync session setup ensures that all components
in SyncEvolution use the same value.
2014-09-10 12:06:53 +02:00
Patrick Ohly 9ea6379f98 GDBus libdbus: add 64 and double
These types were already added for GDBus on GIO. 64 bit unsigned
will be needed for transmitting size_t during local sync.
2014-09-10 12:06:53 +02:00
Patrick Ohly b4b611002c TmpFile: support IPC via shared memory mapping
For this to work, the memory must be mapped MAP_SHARED (otherwise
writes are not visible outside of the process) and the recipient
of a file descriptor must be able to create a TmpFile for it, which
then can be used to create a memory mapping.
2014-09-10 12:06:53 +02:00
Patrick Ohly 85b570e5db testing: cover disk write avoidance
During TestCmdline.testSyncOutput also verify that syncs which don't
change the database also don't update the ~/.config meta data.

The listall() method from testpim.py is used and extended for that
and therefore moved to test-dbus.py.
2014-09-10 12:06:53 +02:00
Patrick Ohly 8dca19a6cf local sync: avoid updating meta data when nothing changed
The sync meta data (sync anchors, client change log) get updated after
a sync even if nothing changed and the existing meta data could be
used again. This can be skipped for local sync, because then
SyncEvolution can ensure that both sides skip updating the meta
data. With a remote SyncML server that is not possible and thus
SyncEvolution has to update its data.

This optimization is only used for local syncs with one source.  It is
based on the observation that when the server side calls
SaveAdminData, the client has sent its last message and the sync is
complete. At that point, SyncEvolution can check whether anything has
changed and if not, skip saving the server's admin data and stop the
sync without sending the real reply to the client.

Instead the client gets an empty message with "quitsync" as content
type. Then it takes shortcuts to close down without finalizing the
sync engine, because that would trigger writing of meta data
changes. The server continues its shutdown normally.

This optimization is limited to syncs with a single source, because
the assumption about when aborting is possible is harder to verify
when multiple sources are involved.
2014-09-10 12:06:53 +02:00
Patrick Ohly b985da7011 TrackingSyncSource: avoid .ini write when nothing changes
During syncs where nothing changes, reseting the database revision and
setting it again at the end of the sync causes undesirable disk
writes. To avoid that, reset the database revision the first time an
item change is done.
2014-09-10 12:06:53 +02:00
Patrick Ohly 72b4a8b167 IniConfigNode: avoid writing unmodified data
Sometimes the new content of the file is exactly the same as the old
one, for example when the tracking node gets reset and
recreated. Detect that for all cases at the lower level by reading the
existing file first and comparing it against the new content.
2014-09-10 12:06:53 +02:00
Patrick Ohly 7b8a173d2d SyncContext: fix session cleanup
Synthesis cleanup was supposed to happen between "closing session" and
"session closed" log messages. Because we kept additional references
to the session, this only happened later. Need to drop also references
to shared buffers, because those hold a reference to their session.
2014-09-10 12:06:52 +02:00
Patrick Ohly 2d5c60f644 SyncSource: add operation signal handler return code
This allows signal handlers to affect the operation execution and
result without having to throw an exception, which would get logged as
error and is not desirable when the operation gets skipped
intentionally. Needed for skipping SaveAdminData in the next patch.
2014-09-10 12:06:52 +02:00
Patrick Ohly a9f265971b engine: avoid flipping configdate
The engine gets instantiated twice: once for logging, once for
syncing. The config generated in each case is different because
sources only become active for syncing. Therefore the config change
check unnecessarily triggered during each sync (first getConfigXML
call created one hash, then the second another), causing DevInf to be
sent unnecessarily and always rewriting the .ini file.

The check is only needed when instantiating the engine that is getting
used for syncing. However, the config date must always be valid.
2014-09-10 12:06:31 +02:00
Patrick Ohly 9581b682a4 PIM: include CardDAV in CreatePeer()
This adds "protocol: CardDAV" as a valid value, with corresponding
changes to the interpretation of some existing properties and some new
ones. The API itself is not changed.

Suspending a CardDAV sync is possible. This freezes the internal
SyncML message exchange, so data exchange with the CardDAV server may
continue for a while after SuspendPeer().

Photo data is always downloaded immediately. The "pbap-sync" flag
in SyncPeerWithFlags() has no effect.

Syncing can be configured to be one-way (local side is read-only
cache) or two-way (local side is read/write). Meta data must be
written either way, to speed up caching or allow two-way syncing. The
most common case (no changes on either side) will have to be optimized
such that existing meta data is not touched and thus no disk writes
occur.
2014-09-08 11:07:31 +02:00
Patrick Ohly 07292559b7 PIM: handle SuspendPeer() before and after transfer (FDO #82863)
A SuspendPeer() only succeeded while the underlying Bluetooth transfer
was active. Outside of that, Bluez errors caused SyncEvolution to
attempt a cancelation of the transfer and stopped the sync.

When the transfer was still queueing, obexd returns
org.bluez.obex.Error.NotInProgress. This is difficult to handle for
SyncEvolution: it cannot prevent the transfer from starting and has to
let it become active before it can suspend the transfer. Canceling
would lead to difficult to handle error cases (like partially parsed
data) and therefore is not done.

The Bluez team was asked to implement suspending of queued transfers
(see "org.bluez.obex.Transfer1 Suspend/Resume in queued state" on
linux-bluetooth@vger.kernel.org), so this case might not happen
anymore with future Bluez.

When the transfer completes before obexd processes the Suspend(),
org.freedesktop.DBus.Error.UnknownObject gets returned by
obexd. SyncEvolution can ignore errors which occur after the active
transfer completed. In addition, it should prevent starting the next
one. This may be relevant for transfer in chunks, although the sync
engine will also stop asking for data and thus typically no new
transfer gets triggered anyway.
2014-09-08 11:07:31 +02:00
Patrick Ohly 81ea67f74a PIM: fix potential segfault during shutdown
When syncevo-dbus-server was shutting down due to a signal and there
was a sync session running that was triggered via the PIM Manager API,
then a segfault occurred because the manager instance got destroyed
before invoking a Session callback holding a pointer to it.

The fix is to use slot tracking of the weak pointer.
2014-09-08 11:07:31 +02:00
Patrick Ohly b02b83bce0 PIM: add suspend/resume/abort to sync.py
CTRL-C while waiting for the end of a sync causes an interactive
prompt to appear where one can choose been suspend/resume/abort and
continuing to wait. CTRL-C again in the prompt aborts the script.
2014-09-08 11:07:31 +02:00
Patrick Ohly eaf66412d9 PIM: fix sync.py --sync-flags
The help text used single quotes for the JSON example instead of
the required double quotes. Running without --sync-flags was broken
because of trying to parse the empty string as JSON.
2014-09-08 11:07:31 +02:00
Patrick Ohly dec741ea50 VirtualSyncSource, MapSyncSource: implement m_isEmpty
This is relevant for isUsable() and not so much (not at all?) for
slow sync prevention.
2014-09-08 11:07:31 +02:00
Patrick Ohly 8ac69096e8 command line: revise usability checking of datastores
When configuring a new sync config, the command line checks whether a
datastore is usable before enabling it. If no datastores were listed
explicitly, only the usable ones get enabled. If unusable datastores
were explicitly listed, the entire configure operation fails.

This check was based on listing databases, which turned out to be too
unspecific for the WebDAV backend: when "database" was set to some URL
which is good enough to list databases, but not a database URL itself,
the sources where configured with that bad URL.

Now a new SyncSource::isUsable() operation is used, which by default
just falls back to calling the existing Operations::m_isEmpty. In
practice, all sources either check their config in open() or the
m_isEmpty operation, so the source is usable if no error is
enountered.

For WebDAV, the usability check is skipped because it would require
contacting a remote server, which is both confusing (why does a local
configure operation need the server?) and could fail even for valid
configs (server temporarily down). The check was incomplete anyway
because listing databases gave a fixed help text response when no
credentials were given. For usability checking that should have
resulted in "not usable" and didn't.

The output during the check was confusing: it always said "listing
databases" without giving a reason why that was done. The intention
was to give some feedback while a potentially expensive operation
ran. Now the isUsable() method itself prints "checking usability" if
(and only if!) such a check is really done.

Sometimes datastores were checked even when they were about to be
configure as "disabled" already. Now checking such datastores is
skipped.
2014-09-08 11:07:31 +02:00
Patrick Ohly 045bf7aa5b D-Bus server: preserve log prefix
The log prefix seems to be unused (except for some debug message) at
the moment but will be soon, so make sure it gets embedded in the
string sent to the syncevo-dbus-server.
2014-09-08 11:07:31 +02:00
Patrick Ohly ff35aa5ace testing: include prefix in TestCmdline tests
Will become relevant with the next commit, which moves the
source name from being part of the text into the prefix. So far,
the prefix is unused during Cmdline tests.
2014-09-08 11:07:31 +02:00
Patrick Ohly e06d39b5bd InactiveSyncSource: simpler implementation
When deriving from DummySyncSource we need to implement less
pure virtual functions. Only the ones where the behavior
needs to differ from DummySyncSource are needed.
2014-09-08 11:07:31 +02:00
Patrick Ohly 6770237424 EDS: memo syncing as iCalendar 2.0 (FDO #52714)
When syncing memos with a peer which also supports iCalendar 2.0 as
data format, the engine will now pick iCalendar 2.0 instead of
converting to/from plain text. The advantage is that some additional
properties like start date and categories can also be synchronized.

The code is a lot simpler, too, because the EDS specific iCalendar 2.0
<-> text conversion code can be removed.
2014-09-08 11:07:31 +02:00
Patrick Ohly adf2522ad1 datatypes: text/calendar+plain revised heuristic, II
When sending a VEVENT, DESCRIPTION was set to the SUMMARY if empty. This may
have been necessary for some peers, but for notes (= VJOURNAL) we don't know
that (hasn't been used in the past) and don't want to alter the item
unnecessarily, so skip that part and allow empty DESCRIPTION.
2014-09-08 11:07:31 +02:00
Patrick Ohly 3392cbf267 datatypes: text/calendar+plain revised heuristic
When receiving a plain text note, the "text/calendar+plain" type
used to store the first line as summary and the rest as description.
This may be correct in some cases and wrong in others.

The EDS backend implemented a different heuristic: there the first
line is copied into the summary and stays in the description. This
makes a bit more sense (the description alone is always enough to
understand the note). Therefore and to avoid behavioral changes
for EDS users when switching the EDS backend to use text/calendar+plain,
the engine now uses the same approach.

For this to work in all cases, the datatype must always call
MEMO_INCOMING_SCRIPT.
2014-07-31 20:20:34 +02:00
Patrick Ohly 04f11b422e source -> datastore rename, improved terminology
The word "source" implies reading, while in fact access is read/write.
"datastore" avoids that misconception. Writing it in one word emphasizes
that it is single entity.

While renaming, also remove references to explicit --*-property
parameters. The only necessary use today is "--sync-property ?"
and "--datastore-property ?".

--datastore-property was used instead of the short --store-property
because "store" might be mistaken for the verb. It doesn't matter
that it is longer because it doesn't get typed often.

--source-property must remain valid for backward compatility.

As many user-visible instances of "source" as possible got replaced in
text strings by the newer term "datastore". Debug messages were left
unchanged unless some regex happened to match it.

The source code will continue to use the old variable and class names
based on "source".

Various documentation enhancements:
  Better explain what local sync is and how it involves two sync
  configs. "originating config" gets introduces instead of just
  "sync config".

  Better explain the relationship between contexts, sync configs,
  and source configs ("a sync config can use the datastore configs in
  the same context").

  An entire section on config properties in the terminology
  section. "item" added (Todd Wilson correctly pointed out that it was
  missing).

  Less focus on conflict resolution, as suggested by Graham Cobb.

  Fix examples that became invalid when fixing the password
  storage/lookup mechanism for GNOME keyring in 1.4.

  The "command line conventions", "Synchronization beyond SyncML" and
  "CalDAV and CardDAV" sections were updated. It's possible that the
  other sections also contain slightly incorrect usage of the
  terminology or are simply out-dated.
2014-07-28 15:29:41 +02:00
Patrick Ohly 581cee897e Google: remove SyncML template, combine CalDAV/CardDAV
Google has turned off their SyncML server, so the corresponding
"Google Contacts" template became useless and needs to be removed. It
gets replaced by a "Google" template which combines the three
different URLs currently used by Google for CalDAV/CardDAV.

This new template can be used to configure a "target-config@google"
with default calendar and address book database already enabled. The
actual URL of these databases will be determined during the first
sync using them.

The template relies on the WebDAV backend's new capability to search
multiple different entries in the syncURL property for databases. To
avoid listing each calendar twice (once for the legacy URL, once with
the new one) when using basic username/password authentication, the
backend needs a special case for Google and detect that the legacy URL
does not need to be checked.
2014-07-28 15:24:46 +02:00
Patrick Ohly 74143960b9 WebDAV: support multiple URLs in syncURL
The syncURL property may contain multiple different space or tab
separated URLs. Previously, the WebDAV backend only used the first one
when scanning for databases. Now it tries all of them.

This will be useful for configuring all Google endpoints in one
template.
2014-07-28 15:24:46 +02:00
Patrick Ohly cab4d0a98d WebDAV: avoid DNS SRV retry loop for aliases
Certains domains (like googleapis.com) are aliases. The lookup tools
do not fail with NXDOMAIN in this case, causing the
syncevo-webdav-lookup script to return only an unknown lookup error,
in which case the WebDAV backend will retry for a while.

We need to detect aliases resp. missing SRV information and return a
"no information error".
2014-07-28 15:24:46 +02:00
Patrick Ohly 2371f69f97 PIM testing: remove asyncError test
The asyncError relied on calling
folks_individual_aggregator_remove_individual() incorrectly
with a NULL pointer. folks in Debian Testing just crashes
now, so we can no longer do this.
2014-07-25 14:23:30 +02:00
Patrick Ohly 8c6f770e38 local sync: allow config name in syncURL=local://
Previously, only syncURL=local://@<context name> was allowed and used
the "target-config@context name" config as target side in the local
sync.

Now "local://config-name@context-name" or simply "local://config-name"
are also allowed. "target-config" is still the fallback if only a
context is give.

It also has one more special meaning: "--configure
target-config@google-calendar" will pick the "Google_Calendar"
template automatically because it knows that the intention is to
configure the target side of a local sync. It does not know that when
using some other name for the config, in which case the template (if
needed) must be specified explicitly.

The process name in output from the target side now also includes the
configuration name if it is not the default "target-config".
2014-07-25 03:01:52 -07:00
Patrick Ohly 5ab328af07 D-Bus testing: fix race condition in TestLocalSync.testNoParent
The first progress signal gets emitted after sleeping for 10 seconds
at the start of the sync and then killing syncevo-dbus-server races
with completing the sync. What we want is to kill during the 10 second
wait, so we better wait for the debug output directly before it and
then kill directly.
2014-07-24 15:39:52 +02:00
Patrick Ohly 57f44fe607 config: allow storing credentials for email address
When configuring a WebDAV server with username = email address and no
URL (which is possible if the server supports service discovery via
the domain in the email address), then storing the credentials in the
GNOME keyring used to fail with "cannot store password in GNOME
keyring, not enough attributes".

That is because GNOME keyring seemed to get confused when a network
login has no server name and some extra safeguards were added to
SyncEvolution to avoid this.

To store the credentials in the case above, the email address now gets
split into user and domain part and together get used to look up the
password.
2014-07-24 15:39:35 +02:00
Patrick Ohly 76599a8056 autotools, NEWS: SyncEvolution 1.4.99.3 2014-07-23 12:29:44 +02:00
Patrick Ohly 834c1e7a6b ephemeral sync: don't write binfile client files (FDO #55921)
When doing PBAP caching, we don't want any meta data written because
the next sync would not use it anyway. With the latest libsynthesis
we can configure "/dev/null" as datadir for the client's binfiles and
libsynthesis will avoid writing them.

The PIM manager uses this for PBAP syncing automatically. For testing
it can be enabled by setting the SYNCEVOLUTION_EPHEMERAL env variable.
2014-07-23 10:48:19 +02:00
Patrick Ohly 198594b622 PIM testing: fix target session checking
The recent change which introduced checking of the target session only
worked if the entries were listed in the "right" (= target-config
entry last) order. Don't reply on that, instead check for the one new entry
that we should find and use that.
2014-07-23 10:48:19 +02:00
Patrick Ohly 36b7e9cd0f glib: avoid GValue compile problem
clang 3.4 generated references to the unused (!?) dummyTake() and
dummySetStatic(). Provide an empty implementation of them.
2014-07-23 10:48:19 +02:00
Patrick Ohly 7a04bde07d D-Bus server: remove some dead code
Some of the global constants were not used. Found by clang 3.4.
2014-07-23 10:48:19 +02:00
Patrick Ohly 7ca22d8db8 testing: avoid undefined vararg after reference
clang 3.4 warns about undefined behavior when applying va_start()
to a reference. We have to use a pointer here to avoid that.
2014-07-23 10:48:19 +02:00
Patrick Ohly 96e873a935 suspend flags: try harder to write data in signal handler
As pointed out by compiler warnings on recent distros, the write()
result in the SuspendFlags signal handler was ignored. Not sure
whether it really can fail in practice. Handle some
possible errors with retrying.
2014-07-23 10:48:19 +02:00
Patrick Ohly 38d6498e4e testing: check symlink() result (FDO #79316)
The Cmdline.cpp unit tests did not check the symlink() result,
causing a warning resp. error depending on the configure options.

Reported by Emiliano Heyns.
2014-07-23 10:48:19 +02:00
Patrick Ohly eaeb528896 autotools: fix linking of dbus-client-server against pcre
When building shared binaries, the pcre libs must be explicitly
listed because dbus-client-server calls them through test.c.
2014-07-23 10:48:19 +02:00
Patrick Ohly 8e333f0a46 glib: avoid deprecated g_type_init and g_thread_init
Calling them triggers warnings with newer glib which are fatal
when compiling with -Werror.
2014-07-23 10:48:19 +02:00
Patrick Ohly d06e40d365 engine: enable batching by default (FDO #52669)
This reverts commit c435e937cd.

Commit 7b636720a in libsynthesis fixes an unitialized memory read in
the asynchronous item update code path.

Testing confirms that we can now used batched writes reliably with EDS
(the only backend currently supporting asynchronous writes +
batching), so this change enables it again also for local and
SyncEvolution<->SyncEvolution sync (with asynchronous execution of
contact add/update overlapped with SyncML message exchanges) and other
SyncML syncs (with changes combined into batches and executed at the
end of each message).
2014-07-23 10:42:31 +02:00
Patrick Ohly 0c989eb74d CardDAV: implement read-ahead
Instead of downloading contacts one-by-one with GET, SyncEvolution now
looks at contacts that are most likely going to be needed soon and
gets all of them at once with addressbook-multiget REPORT.

The number of contacts per REPORT is 50 by default, configurable by
setting the SYNCEVOLUTION_CARDDAV_BATCH_SIZE env variable.

This has two advantages:
- It avoids round-trips to the server and thus speeds up a large
  download (100 small contacts with individual GETs took 28s on
  a fast connection, 3s with two REPORTs).
- It reduces the overall number of requests. Google CardDAV is known
  to start issuing intermittent 401 authentication errors when the
  number of contacts retrieved via GET is too large. Perhaps this
  can be avoided with addressbook-multiget.

This is similar to read-ahead in EDS contacts. However, because we
cannot run Neon requests asynchronously (at least not easily), a
batched read must complete before any contact from it can be
returned to the caller.
2014-07-21 12:15:52 +02:00
Patrick Ohly bc392b99f5 PIM: sync.py --sync-flags
Arbitrary sync flags can be passed to SyncPeerWithFlags() with the
new --sync-flags command line parameter. The value of that parameter
must be a JSON formatted hash.

The advantage of this approach over explicit command line parameters
(like --progress-frequency) is that we do not need to add further code
when adding new flags. We can also pass intentionally broken flags
to check the PIM Managers error handling.

The downside is that it is a bit less user-friendly.

With this change, progress frequency and PBAP sync can be set in two
ways, either as part of --sync-flags or with the individual command
line parameters.  The latter override --sync-flags.
2014-07-21 10:40:57 +02:00
Patrick Ohly 1a9e55bfe6 PIM: PBAP chunk transfer flags in SyncPeerWithFlags()
All of the new PBPA chunk env variables can now also be set
for individual syncs via flags in SyncPeerWithFlags().
2014-07-21 10:40:57 +02:00
Patrick Ohly 037b8b46c4 PIM: better error messages for SyncPeerWithFlags
When the value of a flag has the wrong type, then dumping the value
may provide some hint about what is wrong. Note that values of types
not expected at all by the SyncFlags type already get filtered out
already by our D-Bus binding, in which case the error message shows
no value.
2014-07-21 10:40:57 +02:00
Patrick Ohly 40eb6880f0 util: ToString()
Template method which converts any type with a << operator into
a string.
2014-07-21 10:40:57 +02:00
Patrick Ohly 27f4952e5c PBAP: typo fix in README 2014-07-21 10:40:57 +02:00
Patrick Ohly fda741136f testing: include syncevo-webdav-lookup in test binaries
syncevo-webdav-lookup is needed during testing when doing
WebDAV database scans, so build it in "src" like the rest
of the binaries and link to it in the installed test suite.
2014-07-21 10:40:57 +02:00
Patrick Ohly 124f6e7b2c testing: uninstall synclog2html
The test script was installed, but not uninstalled.
2014-07-21 10:40:57 +02:00
Patrick Ohly 43ab1aba81 Google Calendar: remove child hack, improve alarm hack (FDO #63881)
Google recently enhanced support for RECURRENCE-ID, so SyncEvolution
no longer needs to replace the property when uploading a single
detached event with RECURRENCE-ID. However, several things are still
broken in the server, with no workaround in SyncEvolution:
- Removing individual events gets ignored by the server;
  a full "wipe out server data" might work (untested).
- When updating the parent event, all child events also get
  updated even though they were included unchanged in the data
  sent by SyncEvolution.
- The RECURRENCE-ID of a child event of an all-day recurring event
  does not get stored properly.
- The update hack seems to fail for complex meetings: uploading them
  once and then deleting them seems to make uploading them again
  impossible.

All of these issues were reported to Google and are worked on there,
so perhaps the situation will improve. In the meantime, syncing with
Google CalDAV should better be limited to:
- Downloading a Google calendar in one-way mode.
- Two-way syncing of simple calendars without complex meeting
  serieses.

While updating the Google workarounds, the alarm hack (sending a
new event without alarms twice to avoid the automatic server side
alarm) was simplified. Now the new event gets sent only once with a
pseudo-alarm.
2014-07-14 04:46:29 -07:00
Patrick Ohly 6b131dc27f testing: refresh test data
Google seems to have changed its PHOTO rewriting. If that keeps
happening, we need to stop comparing the actual data.

However, comparing the actual data is useful to detect when we
do not properly handle it. For example, in testUpdateRemoteWins/local-synced
it was a bit surprising that only one contact had to be updated at first.

It turned out that libsynthesis did not compare the entire photo data,
only the part before embedded null bytes.
2014-07-14 04:43:05 -07:00
Patrick Ohly d7f16430bc PIM testing: enhance PBAP caching test
The bugs caused by introducing merging of arrays were not detected
by the automated testing. We need to repeat syncing after we have
data and check that nothing changes in the default, no-phone mode,
and we need to check that nothing got changed on the remote side.

In PBAP mode that would have triggered an error, but when using the
file backend we silently modified its data.

Removing the URL ensures that the failure to avoid writes of
incomplete contacts gets covered. Rearranging the properties
also may be relevant (but was handled already).
2014-07-14 13:39:23 +02:00
Patrick Ohly 5d3df97cac datatypes: fix contact caching
Adding grouping to the contact datatype broke PBAP caching: when
sending an empty URL, for example, during the sync, the parsed contact
had different field arrays than the locally stored contact, because the
latter was saved without the empty URL.

This caused the field-based comparison to detect a difference even when
the final, reencoded contact wasn't different at all.

To solve this, syncing now uses the same "don't send empty properties"
configuration as local storages. Testing shows that this resolves
the difference for EDS.

A more resilient solution would be to add a check based on the encoded
data, but that's more costly performance wise.
2014-07-14 13:38:55 +02:00
Patrick Ohly 7d66823e5f datatypes: fix vCard handling
The new "preserve repeating properties during conflict resolution"
feature was only active when using EDS as storage. The relevant
merge script must be applied to all datatypes, not just the EDS
flavor.

The feature was also unintentionally active when running in
caching mode. This caused two problems:
- The cached item was updated even though only the
  ordering of repeating properties had been modified during
  merging.
- The merged item was sent back to the client side, which
  was undesirable (caching is supposed to be one-way) or even
  impossible (PBAP is read-only, causing sync failures eith error 20030).

We must check for caching mode and disable merging when it is active.
We also must not tell the engine that we updated the photo property
in the winning item, because then that item would get sent to the
read-only side of the sync.

Perhaps a better solution would be to actually tell the engine
that the remote side is read-only when we activate caching mode.
2014-07-11 11:57:14 +02:00
Patrick Ohly 1431fd4a7b datatypes: avoid PHOTO corruption during merge (FDO #77065)
When handling an update/update conflict (both sides of the sync have an
updated contact) and photo data was moved into a local file by EDS, the engine
merged the file path and the photo data together and thus corrupted the photo.

The engine does not know about the special role of the photo property.
This needs to be handled by the merge script, and that script did not
cover this particular situation. Now the loosing side is cleared,
causing the engine to then copy the winning side over into the loosing
one.

Found by Renato Filho/Canonical when testing SyncEvolution for Ubuntu 14.04.
2014-07-11 11:57:14 +02:00
Patrick Ohly bbe782a658 testing: ignore some more Akonadi runtime files
Seen after updating Debian Testing.
2014-07-11 11:57:14 +02:00
Patrick Ohly 845b0ba614 testing: ignore minor leak when using DLT 2014-07-11 11:57:14 +02:00
Patrick Ohly 38c6466738 PBAP: silence cppcheck warnings
cppcheck warns when members are not initialized in the constructor.
That's okay in this case, but let's do it anyway.
2014-07-11 11:57:14 +02:00
Patrick Ohly 527b47c80e PBAP: transfer in chunks (FDO #77272)
If enabled via env variables, PullAll transfers will be limited to
a certain numbers contacts at different offsets until all data got
pulled. See README for details.

When transfering in chunks, the enumeration of contacts for the engine
no longer matches the PBAP enumeration. Debug output uses "offset #x"
for PBAP and "ID y" for the engine.
2014-07-11 11:57:14 +02:00
Patrick Ohly 52a478a811 PBAP: clean up internal PullAll API
Returning an ID as string and then taking an int as argument was not
very clean. Document the logic and make this more consistent.
2014-07-11 11:57:14 +02:00
Patrick Ohly 7ae52c29ba PBAP: mention SyncPeerWithFlags in README
The env variable is no longer necessary for users of the D-Bus API.
2014-07-11 11:57:14 +02:00
Patrick Ohly 8142fefe91 PBAP: remove transfer via pipe
Using a pipe was never fully supported by obexd (blocks
obexd). Transfering in suitably sized chunks (FDO #77272) will be a
more obexd friendly solution with a similar effect (not having to
buffer the entire address book in memory).
2014-07-11 11:57:14 +02:00
Patrick Ohly 4f16f586f1 remove unused member variables
gcc 4.9 found some unused member variables which can be removed.
2014-07-03 11:20:10 +02:00
Patrick Ohly 4dd10c1c0c D-Bus server: fix compiler warning
Passing 0.1 as delay did not work as intended because it was converted
to an integer value of 0 seconds. Found by gcc 4.9. Must use a one second
delay.
2014-07-03 11:20:10 +02:00
Patrick Ohly 5aee365225 testing: use inline cppcheck suppressions for libsynthesis
cppcheck 1.65 finds several false positives which are easier
to handle with inline suppressions.
2014-07-03 11:20:10 +02:00
Patrick Ohly 1f9d7b5979 cppcheck: suppress if check warning
s.getState() returns a different value later, so there is no
dead code as cppunit 1.65 believes.
2014-07-03 11:20:10 +02:00
Patrick Ohly d81f8168a3 cppcheck: suppress NULL warning in printf util
cppcheck 1.65 does not recognize that the preceeding if
check on the size of the buffer always causes it to be allocated
first.
2014-07-03 11:20:10 +02:00
Patrick Ohly 6d660250cc D-Bus server: remove redundant m_server
The base class already has a copy of it, so Session doesn't
need its own. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly fdd66536ce PIM: fix cppcheck control flow warning
The "func" variable was correctly initialized to NULL if no comparsion
matches, but cppcheck 1.65 warns anyway. Use the more readable
intialization to NULL in the final else clause.
2014-07-03 11:20:10 +02:00
Patrick Ohly 535bb97ae8 PIM: fix cppcheck performance warning
The code did one rare string copy instead of using a reference,
due to a missing ampersand. Found by cppcheck 1.65.
2014-07-03 11:20:10 +02:00
Patrick Ohly 764e9eee79 testing: fix cppcheck ClientTest::registerTests() warning
cppcheck warns that "factory" might get overwritten. Probably
never happened becaued registerTests() is only called once, but
let's fix it anyway.
2014-07-03 11:20:10 +02:00
Patrick Ohly 16db5644c6 autotools: fix PIM Manager link issue on Debian Testing
We call ICU i18 directly and thus must link against it.
Used to work earlier, probably because something pulled
in the library.
2014-07-03 11:20:10 +02:00
Mateusz Polrola cf2a2092ca autotools: fix compilation with recent libphonenumber
libphonenumber 1.6.x has the header files reorganized such that the
caller has to define how he is using the library. We want to use
boost.

Setting this doesn't hurt with older libphonenumber releases.
2014-07-03 11:20:10 +02:00
Patrick Ohly 6977a261e3 PIM: fix invalid call to folks_note_field_details_new
folks_note_field_details_new() takes an additional uid parameter.
Passing NULL is okay, but SyncEvolution wasn't doing that due to
an incorrect function type cast. Found by valgrind only after
a valgrind and tool chain update. Probably we passed a valid
value accidentally before.

Fixed by using a wrapper function.

Ideally the function typecast should get replaced entirely with just casting
the returned pointer.
2014-07-03 11:20:10 +02:00
Patrick Ohly f3f689b857 PIM: fix phone number normalization
The parsed number always has a country code, whereas SyncEvolution expected it
to be zero for strings without an explicit country code. This caused a caller
ID lookup of numbers like "089788899" in DE to find only telephone numbers in
the current default country, instead of being more permissive and also finding
"+189788899". The corresponding unit test was broken and checked for the wrong
result. Found while investigating an unrelated test failure when updating
libphonenumber.

EDS handles this differently, by calling ParseAndKeepRawInput() if necessary
(checked by configure) and looking at the source of the country code. Instead
of replicating that logic, let's use EPhoneNumber. This means that EDS has to
be compiled with libphonenumber support, because SyncEvolution can no longer
fall back to using libphonenumber directly.

For testing purposes it is still useful to not depend on X-EVOLUTION-E164.
testLocaledPhone uses this at the moment, because re-generating
X-EVOLUTION-E164 during a locale change seems to be broken at the moment
in the intel-work-3-12 branch.

The test itself has to be updated for the newer libphonenumber (6.1.1 instead
of 5.3.2). The "12345" string it relied upon now gets parsed consistently in
US and DE. Instead we use the "01164 3 331 6005" string (as in libphonenumber
tests) which is treated differently.
2014-07-03 11:20:10 +02:00
Patrick Ohly 944281a024 PIM: fix libphonenumer patch
The "Fixed compilation error when using libphonenumber from revision
>= 568" patch caused a double free error because SetLogger() owns the
logger instance and, with libphonenumber >= r571 actually frees the
instance.

Old libphonenumber release are compatible with the revised call,
however, they never free the instance.
2014-06-25 12:24:25 +02:00
Patrick Ohly d8c8e153ea PBAP: avoid empty field filter
Empty field filter is supposed to mean "return all supported
fields". This used to work and stopped working with Android phones
after an update to 4.3 (seen on Galaxy S3); now the phone only
returns the mandatory TEL, FN, N fields.

The workaround is to replace the empty filter list with the list of
known and supported properties. This means we only pull data we really
need, but it also means we won't get to see any additional properties
that the phone might support.
2014-06-20 09:16:52 +02:00
Patrick Ohly b3d6024247 autotools, NEWS: SyncEvolution 1.4.99.2 2014-05-23 15:46:22 +02:00
Mateusz Polrola 59932d1b25 PIM: fixed compilation error when using libphonenumber from revision >= 586 2014-05-23 14:39:46 +02:00
Patrick Ohly 89c9d82363 xmlrpc: fix compile problem
The source no longer compiled due to an API change in ClientTestConfig.
2014-05-22 17:05:15 +02:00
Patrick Ohly 42daad6034 signon: make Accounts optional
The new "signon" provider only depends on lib[g]signon-glib. It uses
gSSO if found, else UOA. Instead of pulling parameters and the
identity via libaccounts-glib, the user of SyncEvolution now has to
ensure that the identity exists and pass all relevant parameters
in the "signon:" username.

This does not have to be user-friendly, so the machine-readable
GVariant text dump format is used to pass all parameters.
2014-05-22 17:05:08 +02:00
Patrick Ohly 026903b57d gSSO: adapt to gSSO >= 2.0
gSSO >= 2.0 requires a list of realms to which the identity
applies. We take this list from a new "Realms" setting for the
provider in Accounts.

This is how SyncEvolution does it; it hasn't been checked what
upstream will do around this. In Tizen, libaccounts is not used
and thus a different solution is needed there.

The API of libgsignond >= 2.0 was also changed to be more compatible
with the original libsignon. This allows (and requires) removing
some gSSO ifdefs.
2014-05-22 17:05:08 +02:00
Patrick Ohly 47940a959d WebDAV: fix database scan on iCloud
The calendar home set URL on iCloud (the one ending in /calendars/) is
declared as containing calendar data. That was enough for
SyncEvolution to accept it incorrectly as calendar. However, the home
set only contains calendar data indirectly.

We must use the stricter check for leaf collections containing the
right data.
2014-05-22 17:05:08 +02:00
Patrick Ohly f5f88c61aa WebDAV: support redirects between hosts and DNS SRV lookup based on URL
When finding a new URL, we must be prepared to reinitialize the Neon
session with the new host settings. To implement this, candidates are
now full URIs, not just paths on the initial host.

A home set on iCloud contains full URLs, not just paths. We need to
parse the individual entries, which happens to work for paths and URLs
because paths are just special URLS without an explicit host.

iCloud does not have .well-known support on its www.icloud.com
server. To support lookup with a non-icloudd.com email address, we
must do DNS SRV lookup when access to .well-known URLs fails. We do
this without a www prefix on the host first, because that is what happens
to work for icloud.com.

With these changes it becomes possible to do database scans on Apple
iCloud, using syncURL=https://www.icloud.com or
syncURL=https://icloud.com. The former is a bit faster because the
icloud.com redirects to www.icloud.com before we end up doing the DNS
SRV lookup to find the CalDAV resp. CardDAV hosts.
2014-05-22 17:05:07 +02:00
Patrick Ohly 1e83e22e57 WebDAV: enhanced URI comparisons
Treat URI with explicit port as equal to an URI where the port number
is implied by the scheme. Add compare() operation similar to
std::string::compare and add full set of compare operators based on it.
2014-05-22 17:05:07 +02:00
Patrick Ohly 8df1ec15af WebDAV: don't retry after 501 error
501 means "not implemented", in which case resending the same request
is unlikely to succeed. This is relevant for scanning iCloud, because
PROPFIND on http://www.icloud.com returns that.
2014-05-22 17:05:07 +02:00
Patrick Ohly 1910e5efb3 WebDAV: send "User-Agent: SyncEvolution"
Apple iCloud servers reject requests unless they contain a User-Agent
header. The exact value doesn't seem to matter. Making the string
configurable might be better, but can still be done later when it
is more certain whether and for what it is needed.
2014-05-22 17:05:07 +02:00
Patrick Ohly 167f04ef19 WebDAV: avoid potential crash
Passing NULL as vararg parameter is not safe in C++ because there is
no guarantee that it is as large as a pointer. Must cast it.
2014-05-22 17:05:07 +02:00
Patrick Ohly 0f136e2884 WebDAV: refactor and fix DNS SRV lookup
Moved into a separate function and fixed return code handling: due to
missing decoding of the shell scripts return code, all errors were
treated as potentially temporary errors and thus lookup was retried
instead of giving up immediately when there is no DNS SRV entry.
2014-05-22 17:05:07 +02:00
Patrick Ohly 5816c35f75 syncevo-webdav-lookup: report when DNS entry does not exist
Missing information in DNS was treated like a DNS failure, which
caused SyncEvolution to retry the lookup until it eventually timed
out.
2014-05-22 17:05:07 +02:00
Patrick Ohly e71b925f17 config templates: Funambol URLs
Funambol turned of the URL redirect from my.funambol.com to
onemedia.com. The Funambol template now uses the current URL.  Users
with existing Funambol configs must updated the syncURL property
manually to https://onemediahub.com/sync

Kudos to Daniel Clement for reporting the change.
2014-05-22 17:05:01 +02:00
Patrick Ohly 1dcbf3988d testing: enable sync tests for Google CardDAV
For performance reasons we only run selected Client::Sync
tests with Google CardDAV (each PUT/POST and DELETE take 10
seconds because of some intentional delay on the server).

Some Google-specific tests should also be run.
2014-05-19 21:33:45 +02:00
Patrick Ohly ae84edf417 testing: simulate remote item manipulation
Traditionally, SyncEvolution only modified remote data via syncing.
This is not enough because it does not cover data on the remote side
that SyncEvolution cannot sync.

The new tests solve this by using the command line's import/update
operations which modify data more or less directly.

Now we can test:
- downloading data created remotely
- uploading data via sync, export directly, compare
- simulate conflicts with changes made remotely

The download and upload test include full round-trips, i.e.
the initial transfer plus a change that needs to be synced back.

Because this is highly dependent on the exact data stored by the
peer, all these tests depend on per-peer test data and scripts
for modifying that data. The tests only get enabled if the test
data is found.

The initial test data covers Apple Calendar server, EDS<->EDS
and Google Contacts.
2014-05-19 21:33:45 +02:00
Patrick Ohly 9c0916bee8 vcard profile: avoid data loss during merging
When resolving a merge conflict, repeating properties were taken
wholesale from the winning side (for example, all email addresses). If
a new email address had been added on the loosing side, it got lost.

Arguably it is better to preserve as much data as possible during a
conflict. SyncEvolution now does that in a merge script by checking
which properties in the loosing side do not exist in the winning side
and copying those entries.

Typically only the main value (email address, phone number) is checked
and not the additional meta data (like the type). Otherwise minor
differences (for example, both sides have same email address, but with
different types) would lead to duplicates.

Only addresses are treated differently: for them all attributes
(street, country, city, etc.) are compared, because there is no single
main value.

When copying properties which may have labels, the new entries must be
added such that a unique label can be copied or set. Other properties
can be added at the end of their array.
2014-05-19 21:33:45 +02:00
Patrick Ohly 8c12816dec vcard profile: avoid X-ABLabel without a real property value
The modern profile typically doesn't generate empty properties, and therefore
it is useless to create an IMPP, X-ABRELATEDNAMES or X-ABDATE entry with has
an empty value. It just has the effect of creating X-ABLabels which are not
attached to any property.
2014-05-19 21:33:45 +02:00
Patrick Ohly 933d10f97c CardDAV: use Apple/Google/CardDAV vCard flavor
In principle, CardDAV servers support arbitrary vCard 3.0
data. Extensions can be different and need to be preserved. However,
when multiple different clients or the server's Web UI interpret the
vCards, they need to agree on the semantic of these vCard extensions.

In practice, CardDAV was pushed by Apple and Apple clients are
probably the most common clients of CardDAV services. When the Google
Contacts Web UI creates or edits a contact, Google CardDAV will
send that data using the vCard flavor used by Apple.

Therefore it makes sense to exchange contacts with *all* CardDAV
servers using that format. This format could be made configurable in
SyncEvolution on a case-by-case basis; at the moment, it is
hard-coded.

During syncing, SyncEvolution takes care to translate between the
vCard flavor used internally (based on Evolution) and the CardDAV
vCard flavor. This mapping includes:

X-AIM/JABBER/... <-> IMPP + X-SERVICE-TYPE

  Any IMPP property declared as X-SERVICE-TYPE=AIM will get
  mapped to X-AIM. Same for others. Some IMPP service types
  have no known X- property extension; they are stored in
  EDS as IMPP. X- property extensions without a known X-SERVICE-TYPE
  (for example, GaduGadu and Groupwise) are stored with
  X-SERVICE-TYPE values chosen by SyncEvolution so that
  Google CardDAV preserves them (GroupWise with mixed case
  got translated by Google into Groupwise, so the latter is used).

  Google always sends an X-ABLabel:Other for IMPP. This is ignored
  because the service type overrides it.

  The value itself also gets transformed during the mapping. IMPP uses
  an URI as value, with a chat protocol (like "aim" or "xmpp") and
  some protocol specific identifier. For each X- extension the
  protocol is determined by the property name and the value is the
  protocol specific identifier without URL encoding.

X-SPOUSE/MANAGER/ASSISTANT <-> X-ABRELATEDNAMES + X-ABLabel

  The mapping is based on the X-ABLabel property attached to
  the X-ABRELATEDNAMES property. This depends on the English
  words "Spouse", "Manager", "Assistant" that Google CardDAV
  and Apple devices seem to use regardless of the configured
  language.

  As with IMPP, only the subset of related names which have
  a corresponding X- property extension get mapped. The rest
  is stored in EDS using the X-ABRELATEDNAMES property.

X-ANNIVERSARY <-> X-ABDATE

  Same here, with X-ABLabel:Anniversary as the special case
  which gets mapped.

X-ABLabel parameter <-> property

  CardDAV vCards have labels attached to arbitrary other properties
  (TEL, ADR, X-ABDATE, X-ABRELATEDNAMES, ...) via vCard group tags:
  item1.X-ABDATE:2010-01-01
  item1.X-ABLabel:Anniversary

  The advantage is that property values can contain arbitrary
  characters, including line breaks and double quotation marks,
  which is not possible in property parameters.

  Neither EDS nor KDE (judging from the lack of responses on the
  KDE-PIM mailing list) support custom labels. SyncEvolution could
  have used grouping as it is done in CardDAV, but grouping is not
  used much (not at all?) by the UIs working with the vCards in EDS
  and KDE. It seemed easier to use a new X-ABLabel parameter.

  Characters which cannot be stored in a parameter get converted
  (double space to single space, line break to space, etc.) during
  syncing. In practice, these characters don't appear in X-ABLabel
  properties anyway because neither Apple nor Google UIs allow entering
  them for custom labels.

  The "Other" label is used by Google even in case where it adds no
  information. For example, all XMPP properties have an associated
  X-ABLabel=Other although the Web UI does not provide a means to edit
  or show such a label. Editing the text before the value in the UI
  changes the X-SERVICE-TYPE parameter value, not the X-ABLabel as for
  other fields.

  Therefore the "Other" label is ignored by removing it during syncing.

X-EVOLUTION-UI-SLOT (the parameter used in Evolution to determine the
order of properties in the UI) gets stored in CardDAV. The only exception
is Google CardDAV which got confused when an IMPP property had both
X-SERVICE-TYPE and X-EVOLUTION-UI-SLOT parameters set. For Google,
X-EVOLUTION-UI-SLOT is only sent on other properties and thus ordering
of chat information can get lost when syncing with Google.

CardDAV needs to use test data with the new CardDAV vCard flavor.
Most CardDAV servers can store EDS vCards and thus
Client::Source::*::testImport passed (with minor tweaks in
synccompare) when using the default eds_contact.vcf, but
Client::Sync::*::testItems fails when comparing synced data with test
cases when the synced data uses the native format and the test cases
are still the ones from EDS.

A libsynthesis with URLENCODE/DECODE() and sharedfield parameter for
<property> is needed.
2014-05-19 21:33:38 +02:00
Patrick Ohly f61e417360 synccompare: properly support quoted string parameters
The previous, regular expression based reordering of parameters broke
parameters containing semicolons in quoted strings. The splitting must
be done using a proper parser which knows whether a semicolon
delimits a parameter (outside of quotation marks) or is part of the
parameter value (inside quotation marks).

synccompare now also normalizes the quoting of parameter values:
quotation marks are used for anything more complex than alphanumeric
plus underscore and hyphen.
2014-05-19 11:55:12 +02:00
Patrick Ohly 68f6640612 synccompare: ignore remaining X-ABLabel in group
When removing an empty property, we may still have the corresponding
X-ABLabel left. Remove that, too.

Example:
item1.URL:
item1.X-ABLabel:Other
2014-05-19 11:55:12 +02:00
Patrick Ohly 18a18d057e synccompare: IMPP + X-ABLabel:Other normalization
Google CardDAV always adds the "Other" label to IMPP properties.
Ignore this by replacing the group of these two properties
with just the IMPP property. The normalization is intentionally
only done for two grouped properties. If we end up with more,
we need to check what that means instead of removing the label.
It's also more efficient and easier to implement this way.
2014-05-17 21:31:29 +02:00
Patrick Ohly 87dd789b99 synccompare: handle grouping
Grouped properties are sorted first according to the actual property
name, then related properties are moved to the place where their group
tag appears first. The first grouped property gets a "- " prefix, all
following ones are just indended with "  ". The actual group tag is not
part of the normalized output, because its value is irrelevant:

BDAY:19701230
- EMAIL:john@custom.com
  X-ABLabel:custom-label2
...
FN:Mr. John 1 Doe Sr.
- IMPP;X-SERVICE-TYPE=AIM:aim:aim
  X-ABLabel:Other
...
- X-ABDATE:19710101
  X-ABLabel:Anniversary

Redundant tags (those set for only a single property) get removed as
part of normalizing an item.
2014-05-17 21:31:29 +02:00
Patrick Ohly 93b9b57e7d WebDAV: fix server-specific workarounds
The code checking the session URL was never used because the
session did not exist yet during syncing. Adding a contactServer()
call fixes that.

The default WebDAV code in the dead code was redundant. The
default is set before checking for a specific server.
2014-05-16 11:33:50 +02:00
Patrick Ohly d90c952b4c WebDAV: avoid redundant work
Different backend functions had to ensure that a connection
to the server existed. That work was meant to be done only
once during the existence of the backend instance, but due to
a missing "return" it was potentially (?) repeated multiple
times. Didn't cause any noticable problems.
2014-05-16 11:32:13 +02:00
Patrick Ohly 74b0da36b7 vcard profile: remove unused fields
The fields and their offsets were originally used for Synthesis vCard
extensions (X-CustomLabel-* and X-Synthesis-Ref). SyncEvolution never
used those. The extra fields cause unecessary overhead (logging,
merging, memory even when empty), so better remove them.
2014-05-16 11:26:55 +02:00
Patrick Ohly 9efa21496f autotools: avoid redundancy in installation of test files
testcase files used to be installed in src/testcases.am, using a duplicated
list of files. Better do it in test/test.am with the canonical list of files
and only install generated files in src/testcases.am. This makes it easier
to extend the list in the future.
2014-05-16 11:26:55 +02:00
Patrick Ohly f0df27f407 testing: relax gnutls leak suppression
Also happens with realloc.
2014-05-05 09:28:14 +02:00
Patrick Ohly 56c106703a testing: ignore Apple Calendar Server 5.2 VTIMEZONE bug
As confirmed by Cyrus Daboo, Apple Calendar Server 5.2 should
return VTIMEZONE embedded in the item data if matching against
well-known timezones fails. This broken when Apple implemented
support for timezones via reference.

Long term we need to support that feature, but for now it and
this bug are not important because for most timezones, we should
be fine with our TZID based mapping. Ignore the issue during
testing...
2014-05-05 09:28:14 +02:00
Patrick Ohly eedc598a1a synccompare: optionally ignore VTIMEZONE definitions
Depends on CLIENT_TEST_NO_TIMEZONES. Needed to work around
an Apple Calendar Server bug.
2014-05-05 09:28:14 +02:00
Patrick Ohly cca89dbf87 WebDAV: use server's order when listing collections
When doing a recursive scan of the home set, preserve the order of
entries as reported by the server and check the first one first. The
server knows better which entries are more relevant for the user (and
thus should be the default) or may have some other relevant
order. Previously, SyncEvolution replaced that order with sorting by
URL, which led to a predictable, but rather meaningless order.

For example, Google lists the users own calendar first, followed by
the shared calendars sorted alphabetical by their name. Now
SyncEvolution picks the main calendar as default correctly when
scanning from https://www.google.com/calendar/dav/.
2014-05-05 09:28:14 +02:00
Patrick Ohly 29c08781ef WebDAV: improved database search (Google, Zimbra)
Zimbra has a principal URL that also serves as home set. When using it
as start URL, SyncEvolution only looked the URL once, without listing
its content, and thus did not find the databases.

When following the Zimbra principal URL indirectly, SyncEvolution did
check all of the collections there recursively. Unfortunately that
also includes many mail folders, causing the scan to abort after
checking 1000 collections (an internal safe guard).

The solution for both includes tracking what to do with a URL. For the
initial URL, only meta data about the URL itself gets
checked. Recursive scanning is only done for the home set. If that
home set contains many collections, scanning is still slow and may run
into the internal safe guard limit. This cannot be avoided because the
CalDAV spec explicitly states that the home set may contain normal
collections which contain other collections, so a client has to do the
recursive scan.

When looking at a specific calendar, Google CalDAV does not report
what the current principal or the home set is and therefore
SyncEvolution stopped after finding just the initial calendar. Now it
detects the lack of meta information and adds all parents also as
candidates that need to be looked at. The downside of this is that it
doesn't know anything about which parents are relevant, so it ends up
checking https://www.google.com/calendar/ and
https://www.google.com/.

In both cases Basic Auth gets rejected with a temporary redirect to
the Google login page, which is something that SyncEvolution must
ignore immediately during scanning without applying the resend
workaround for "temporary rejection of valid credentials" that can
happen for valid Google CalDAV URLs.

The sorting of sub collections is redundant and can be removed,
because sorting already happens when storing the information for each
path. When scanning Google CalDAV starting at
https://www.google.com/calendar/dav/, the main calendar gets listed by
Google first, but because we reorder by sorting by path, it ends up
last in the SyncEvolution database list and thus is not picked as
default. This needs to be fixed separately by preserving the server's
order.
2014-05-05 09:28:14 +02:00
Patrick Ohly 03f0a6d9dc WebDAV: fix installation of syncevo-webdav-lookup
The previous change to the syncevo-webdav-lookup broke out-of-tree
compilation because it created a symlink to syncevo-webdav-lookup.sh
inside the current directory, which is not where the file resides when
compiling out-of-tree.

Instead of trying to be smart with symlinks (was only done for to avoid
a small file copy), simply copy the file.
2014-05-05 09:28:14 +02:00
Patrick Ohly e77ec5d3b8 WebDAV: DNS lookup script depends on bash
syncevo-webdav-lookup.sh uses bash features (pipefail) and thus
must choose /bin/bash as shell explicitly. On systems with dash
as /bin/sh the script failed.
2014-05-05 09:28:14 +02:00
Patrick Ohly 9c733242a4 D-Bus server: delay message processing until server is running
Server::run() still does some initialization (backend loading and file
watching). We need to wait with processing calls until that is done,
otherwise we have a race condition in TestFileNotify.testSession3:
- server starts
- test calls GetVersion()
- server answers as part of sending out log messages or loading backends (?),
  sending incomplete information (no backends loaded yet)
- test touches syncevo-dbus-server
- server sets up watch
=> test fails because server missed the file modification and incorrect information returned
   by GetVersions()
2014-05-05 09:28:13 +02:00
Patrick Ohly dd66d1d0cb GDBus GIO: copy constructor for GDBusConnectionPtr
When we have attached a name to GDBusConnectionPtr in
dbus_get_bus_connection(), we must copy that name when
passing the connection on.

Otherwise requesting a name via dbus_get_bus_connection()
and later calling dbus_bus_connection_undelay() on a copy
fails to request the name.
2014-05-05 09:28:13 +02:00
Patrick Ohly c5cec8e62b testing: try harder to send email
When any kind of exception occurs, send an email with the exception
because it is likely that the real result email was not sent.
2014-05-05 09:28:13 +02:00
Patrick Ohly b25f175284 autotools: remove duplicate eds_contact.vcf
This crept in during the conversion to the non-recursive build.
It was not a problem for "make dist", but when using the list in rules
it causes make warnings.
2014-05-02 16:43:53 +02:00
Patrick Ohly c33205a7be WebDAV: use vCard UID handling in engine
This takes advantage of the engine setting (new items) and preserving
(existing items) the UID for backends and then generating it as part of
serialization.

The older hacks in create/setResourceName() relied on resource name matching
the UID, which is not guaranteed for items created by us via POST (depending
on the server) and/or other CardDAV clients.

The hacks could be removed; they are simply not used anymore at the moment.
2014-05-02 16:43:53 +02:00
Patrick Ohly 4b2b2bb64e engine: UID support in contact data
Before, the UID property in a vCard was ignored by the engine.
Backends were responsible for ensuring that the property is
set if required by the underlying storage.

This change moves this into the engine:
- UID is now field. It does not get used for matching
  because the engine cannot rely on it being stored
  by both sides.
- It gets parsed if present, but only generated if
  explicitly enabled (because that is the traditional
  behavior).
- It is never shown in the DevInf's CtCap
  because the Synthesis engine would always show it
  regardless whether a rule enabled the property.
  That's because rules normally only get triggered
  after exchanging DevInf and thus DevInf has to
  be rule-independent. We don't want it shown because
  then merging the incoming item during a local sync
  would use the incoming UID, even if it is empty.
- Before writing, ensure that UID is set.

When updating an existing item, the Synthesis engine reads
the existing item, preserves the existing UID unless the peer
claims to support UID, and then updates with the existing UID.

This works for local sync (where SyncEvolution never claims
to support UID when talking to the other side). It will break
with peers which have UID in their CtCap although they
rewrite the UID and backends whose underlying storage cannot
handle UID changes during an update (for example, CardDAV).

A backend must still activate the UID property by setting m_backendRule
to LOCALSTORAGE-WITH-UID instead of the default LOCALSTORAGE.
Custom backend rules must include the new sub-rule HAVE-VCARD-UID.

See "[os-libsynthesis] UID + CardDAV" for a discussion of this change.
Long term it would be better to configure profiles without depending
on the rule hack.
2014-05-02 16:43:53 +02:00
Patrick Ohly 3347c585ff engine: clean up contacts profile
The "show" attribute of the property values is not supported
and was silently ignored by the Synthesis engine and thus had
no effect. Remove the useless attributes.
2014-05-02 16:43:53 +02:00
Patrick Ohly 82288638e0 WebDAV: handle read-only collections
Check whether a collection is read-only by reading ACL properties.
The check is intentionally a bit fuzzy to avoid accidentally marking
a collection as read-only.

All read-only collections are moved to the end of the found databases, to
avoid picking them as default when there are read/write collections. This
needs to be done in both "list all databases" mode (aka --print-databases)
and in "pick default database" mode (aka syncing with a source which
had no explicit 'database' set).

To use a read-only collection, configure it in the 'database'
property.

This is relevant for OwnDrive, aka ownCloud, which has a read-only "birthday"
calendar which was picked as default instead of the real calendar.
2014-05-02 16:43:53 +02:00
Patrick Ohly 2765c14dd0 WebDAV: better INFO messages about URL handling
The WebDAV backend determines what database to use based on 'database',
'syncURL', and (for DNS SRV discovery) 'databaseUser' respectively
'username'. The new messages help figuring out which settings were
really used.
2014-05-02 16:43:52 +02:00
Patrick Ohly 8b833c20bc PBAP: databases are read-only
PBAP is always read-only.
2014-05-02 16:43:52 +02:00
Patrick Ohly 8fae2cd0c9 command line: read-only databases and --print-databases
Read-only database are shown with a new "<read-only>" tag.
There is no explicit read/write flag, so a lack of that tag
is no guarantee that a database is really writable. It depends
on the backend whether it checks for write acccess.
2014-05-02 16:43:52 +02:00
Patrick Ohly 237a240a7f SyncSource: allow marking databases as read-only
This is relevant for WebDAV database scanning (read-only
databases should not be the default) and could also be used
to enhance automatic setups (for example, do not use two-way
syncing for read-only databases).
2014-05-02 16:43:52 +02:00
Patrick Ohly 51d21e8127 D-Bus testing: fix TestFileNotify
The test assumed that it can rename the main syncevo-dbus-server
executable to trigger the file watch mechanism. That's not correct:
- It might be the system's /usr/libexec/syncevo-dbus-server,
  which a normal user cannot rename.
- The binary might be also active in some other, parallel tests.
  Renaming it interferes with those other tests.

The latter happened in the nightly testing: HTTP server tests with
a long-running syncevo-dbus-server failed because the daemon terminated
during the tests.
2014-05-02 16:43:52 +02:00
Patrick Ohly 58fa67f76d D-Bus server: enhance logging of file modification
Include the name of the file which got modified. This helped track down why
the server sometimes shut down unexpectedly during parallel testing (main
executable was renamed by D-Bus testing).
2014-05-02 16:43:52 +02:00
Patrick Ohly 02088c22e0 SyncSource: add source name to all exception handling
Not all exceptions thrown while executing a source operation contain
the source name. SyncSource::throwError() does that, but SE_THROW() as
used in helper code does not. It is better to add the source name as
logging prefix. The other advantage is that all lines will have the
prefix, not just the first one.

The SyncSource operations need access to the SyncSource class which
contains them to access the display name of the SyncSource instance.
A positive a side effect of telling the wrappers about the instance at
construction time is that the caller no longer has to pass the source
reference.

This change allows removing the SyncSource::throwError() special
cases, which completes the transition towards having correct source
code location information for all exceptions.
2014-05-02 16:43:52 +02:00
Patrick Ohly c95bc08e61 logging: avoid empty " :" prefix
This could happen when using item operations on the command line.
In that case a source without name was created and that empty
name was inserted as prefix before errors encountered while
using the source.

Now empty string is the same as no string.
2014-05-02 16:43:52 +02:00
Patrick Ohly de8461f802 code restructing: Exception, throwError()
Raising exceptions via throwError() looses the original source code
location information. Fixing that by explicitly passing that
information as additional parameter, created with the preprocessor
macro SE_HERE.

Several files included the complex SyncContext.h only because needed
throwError(). A better place for the revised implementation is the
Exception class which used to be in util.h, now Exception.h.

Simplifying the include statements exposed indirect include
dependencies and removed "using namespace std" from the compilation of
some source files which happened to rely on it. We want to get rid of
that name space polution, so fix the code instead of adding it back.
2014-05-02 16:43:52 +02:00
Patrick Ohly 7812dc126f DAV: enhanced database search
Additional databases where not found for several
reasons. SyncEvolution ignored all shared calendars
(http://calendarserver.org/ns/shared) and Google marks the additional
calendars that way. The other problem was that the check for leaf
collections (= collections which cannot contain other desired
collections) incorrectly excluded those collections instead of only
preventing listing of their content.

With this change,
https://www.google.com/calendar/dav/?SyncEvolution=Google can be used
as starting point for Google Calendar.
2014-05-02 16:43:52 +02:00
Patrick Ohly 27af370ac2 WebDAV: do not mangle UID when sending items
The WebDAV backends contained a hack where the UID inside the data was forced
to be identical to the resource name. This is wrong for items created by us
via POST (because the server may choose a resource name != UID) or by some
other entity (where we have no idea how the resource name got chosen).

This commit removes the hack. Testing must be updated to pass correct data
with the same UID as on the server when updating an item, because the backend
will no longer ensure that and changing the UID of a resource gets rejected by
some servers.

The hack was introduced for peers which do not store the UID (for example, a
vCard or iCalendar 1.0 based SyncML client). A better solution must be found,
probably involving the Synthesis engine and its read/update/write cycle.
2014-05-02 16:43:44 +02:00
Patrick Ohly 03a7b4f1ab DAV: more efficient item creation
PUT has the disadvantage that a client needs to choose a name and then
figure out what the real name on the server is. With Google CardDAV that
requires sending another request and only works because the server happens
to remember the original name (which is not guaranteed!).

POST works for new items without a name and happens to be implemented
by Google such that the response already includes all required
information (new name and revision string).

POST is checked for as described in RFC 5995 once before creating a new
item. Servers which don't support it continue to get a PUT.

The 403 status code must be checked to detect UID conflicts when adding
an item that already exists on the server.
2014-04-24 04:32:19 -07:00
Patrick Ohly 211884e232 DAV: additional log message
Document why PROPFIND is called, as done elsewhere.
2014-04-24 04:32:18 -07:00
Patrick Ohly 021e106b57 DAV: eliminate m_davProps member
The life time and content of the member was not defined. It got used
in multiple places. It's cleaner to bind the openPropCallback() to
a local Props_t instance.
2014-04-24 04:32:18 -07:00
Patrick Ohly b80302cf67 PBAP: remove obsolete .orig source file
This was accidentally checked in when refactoring.
2014-04-24 04:32:18 -07:00
Patrick Ohly 841b737740 addressbook: removing iOS support
The "addressbook" source was written for the original iPhone and
Mac OS X. It hasn't been in use for a long time, keeping the code
around without actually compiling it makes no sense anymore.
2014-04-24 04:32:18 -07:00
Patrick Ohly c722909a8f command line: fix --update from directory
The "--update <dir name>" operation was supposed to take the
item luids from the file names inside the directory. That part
had not been implemented, turning the operation accidentally
into an "--import".

Also missing was the escaping/unescaping of luids. Now the
same escaping is done as in command line output and command
line parsing to make the luids safe for use as file name.
2014-04-24 04:32:18 -07:00
Patrick Ohly 1afcdb5de8 testing: further Akonadi parallel test fixes
When running Akonadi with the reference home dir, it creates
a socket symlink that we must not copy. Otherwise all Akonadi
instances end up sharing the same Unix domain socket name and
thus Akonadi instance.
2014-04-24 04:32:18 -07:00
Patrick Ohly b57ae0d319 testing: more verbose HTTP server testing
Seeing all daemon output is useful and does not bloat the logs too
much, enable it permanently.
2014-04-24 04:32:18 -07:00
Patrick Ohly 0d2d047cdc testing: more logging around directory handling
Sometimes os.getcwd() returns an empty string. Not sure why, perhaps
more logging will help to track this down.
2014-04-24 04:32:18 -07:00
Patrick Ohly 9e00e3154e testing: ignore ESourceRegistry unref leak 2014-04-24 04:32:18 -07:00
Patrick Ohly 32e3e92de7 testing: ignore locale when invoking certain shell tools
When testing for specific output of shell tools, we need to ensure that the
system locale (typically engineering English) is active, otherwise we end
up with mismatches when the error messages get translated.
2014-04-24 04:32:18 -07:00
Patrick Ohly 15bb6dcc23 testing: replace CT_ASSERT_TRUE
The macro was supposed to help Clang scan-build detect that error
paths are not taken. However, it caused the expression to be
evaluated twice, which is not okay for some more recent checks.

Instead we now enable either the real assert or our simplified check,
depending on a custom CT_ASSERT_SIMPLE that has to be set when running with
scan-build.

The same applies to "no throw" asserts. To keep the wrapper macros
simple, we pass the same statement twice.
2014-04-24 04:30:34 -07:00
Patrick Ohly 225a1c3eed testing: use simpler shell for result checking
The --shell value used for Clang build-scan builds includes
scan-build and an additional wrapper script. These extra commands
break result checking. Instead of trying to filter them out,
use the new, optional --simple-shell.
2014-04-24 04:30:34 -07:00
Patrick Ohly 6d0498295a ical: remove dead assignment
Found by Clang scan-build after fixing the report generation.
2014-04-24 04:30:33 -07:00
Patrick Ohly 372992a20d autotools, NEWS: SyncEvolution 1.4.99.1 2014-04-01 16:57:04 +02:00
Patrick Ohly 1c3038c40d LogRedirect: safeguard against memory corruption
When aborting, our AbortHandler gets called to close down logging.
This may involve memory allocation, which is unsafe. In FDO #76375, a
deadlock on a libc mutex was seen.

To ensure that the process shuts down anyway, install an alarm and give
the process five seconds to shut down before the SIGALRM signal will kill
it.
2014-04-01 16:45:09 +02:00
Patrick Ohly fc8caadd8d PBAP: Suspend/ResumeSync() (FDO #72112)
The information that the sync is freezing is now also handed down to
the transport and all sources. In the case of PBAP caching, the local
transport notifies the child where the PBAP source then uses Bluez
5.15 Transfer1.Suspend/Resume to freeze/thaw the actual OBEX transfer.

If that fails (for example, not implemented because Bluez is too old
or the transfer is still queueing), then the transfer gets cancelled
and the entire sync fails. This is desirable for PBAP caching and
Bluetooth because a failed sync can easily be recovered from (just
start it again) and the overall goal is to free up Bluetooth bandwidth
quickly.
2014-04-01 16:45:09 +02:00
Patrick Ohly 5e541505a5 PIM example: fix typo
"we" was missing in "Stop polling, in case that we remove the peer."
2014-04-01 16:45:09 +02:00
Patrick Ohly d89ca72d01 D-Bus: use streams for direct IPC with GIO
When using GIO, it is possible to avoid the DBusServer listening on a
publicly accessible address. Connection setup becomes more reliable,
too, because the D-Bus server side can detect that a child died
because the connection will be closed.

When using libdbus, the traditional server/listen and client/connect
model is still used. GDBus GIO mimicks the same API to minimize
changes in ForkExec. The API gets simplified to support both
approaches:
- Choosing an address is no longer possible (was only used in the
  test example anyway)
- The new connection callback must be specified already when starting
  the server.

The GDBus GIO implementation uses SyncEvolution utility code. Strictly
speaking, this creates a circular dependency
libsyncevolution<->libgdbus. This is solved by not linking libgdbus
against libsyncevolution and expecting executables to do that instead.

The GDBus GIO example no longer linked because of that; it gets removed
because it was of little value.

Now that we started using CLOEXEC, we might as well use it for the
permanent file descriptors created for each ForkExec instance.
2014-04-01 16:45:09 +02:00
Patrick Ohly d0b7dfadf3 GuardFD: smart pointer for file descriptors
A std::auto_ptr for file descriptors, including support for releasing
the file descriptor and automatic conversion to int.
2014-04-01 16:45:09 +02:00
Patrick Ohly 08184857b7 GSignondPipeStream: only compile for GDBus GIO
The class is only used in combination with GDBus GIO, so don't
compile it otherwise (although that would work).
2014-04-01 16:45:09 +02:00
Patrick Ohly 0b16e74004 GSignondPipeStream: avoid depending on newer glib
g_clear_object() unnecessarily creates a dependency on a more recent glib
version. It probably isn't used correctly here anyway (g_clear_object() checks
for NULL itself, so the code around it doesn't need and should do that), so we
can use the older g_object_unref() instead.
2014-04-01 16:45:09 +02:00
Imran Zaman fcfe079a09 GSignondPipeStream: utility class for D-Bus over file descriptor
The code is a verbatim copy of the corresponding files from gSSO. The
only difference is that we compile the implementation as C++ code,
because that is what we set compile flags for in libsyncevolution.

This helper class will be used for D-Bus over plain files in
combination with g_dbus_connection_new().
2014-04-01 16:45:09 +02:00
Patrick Ohly 9c3601809d PIM: Suspend/ResumeSync() (part of FDO #72112)
Currently implements the new API by stopping to consume data on the
local side of the sync. The Bluetooth transfer on the remote side
continues to run and isn't even notified about the suspend; need a new
obexd API to also suspend that and then notify the remote side when we
want it to do that.
2014-04-01 16:45:09 +02:00
Patrick Ohly 3c01a1ebf6 PIM: enhanced progress notifications (FDO #72114)
This adds GetPeerStatus() and "progress" events.

To detect DB changes as they happen, the SyncSource operations are
monitored. Upon entry, a counter gets increased and transmitted
through to the PIM manager in syncevo-dbus-server using extended
SourceProgress structs (only visible internally - public API must not
be extended!). This will count operations which fail and count those
twice which get resumed, so the counts will be too high
occasionally. That is in line with the API definition; because it is
not exact, the API only exposes a "modified" flag.

Progress is reported based on the "item received" Synthesis event and
the total item count. A modified libsynthesis is needed where the
SyncML binfile client on the target side of the local sync actually
sends the total item count (via NumberOfChanges). This cannot be done
yet right at the start of the sync, only the second SyncML message
will have it. That is acceptable, because completion is reached very
quickly anyway for syncs involving only one message.

At the moment, SyncContext::displaySourceProgress() holds back "item
received" events until a different event needs to be emitted. Progress
reporting might get more fine-grained when adding allowing held back
events to be emitted at a fixed rate, every 0.1s. This is not done yet
because it seems to work well enough already.

For testing and demonstration purposes, sync.py gets command line
arguments for setting progress frequency and showing progress either
via listening to signals or polling.
2014-04-01 16:45:09 +02:00
Patrick Ohly d7b7f6dc35 D-Bus GIO + libdbus: support structs with base struct
Allow (de)serialization of "struct foo : public bar" kind of
structures.
2014-04-01 16:45:09 +02:00
Patrick Ohly 940f1ba7d8 sync output: hide "<source>: started" INFO messages
These messages get printed at the start of processing each
SyncML message. This is not particularly useful and just
adds noise to the output.
2014-04-01 16:45:09 +02:00
Patrick Ohly 3bcb67178c D-Bus server: use monotonic time for timeouts
gettimeofday() has the disadvantage that it may jump as system time
gets set or adjusted. Timespec::monotonic() avoids that.
2014-04-01 16:45:09 +02:00
Patrick Ohly f44621a5e3 PIM testing: handle test data without photo data
The code was meant to check whether a contact really has contact
data; because the if check was missing, the sync result checking
in testSync failed for test data where one or more contacts had
not photos.
2014-04-01 16:45:09 +02:00
Patrick Ohly 16a6c6affd PIM testing: better timeFunction()
The function now keeps the event loop running while waiting for
completion. That ensures that events get received immediately.

testpim.py now matches the po scanning process because of the _(' text
pattern. We need to exclude it explicitly.
2014-04-01 16:45:09 +02:00
Patrick Ohly 988ad5d2e8 D-Bus GIO: variant with more types
Will be needed for PIM Manager, therefore not also added to D-Bus
libdbus.
2014-04-01 16:45:09 +02:00
Patrick Ohly e29d376df0 Timespec: in-place resetMonotonic() and resetSystem()
The new methods are slightly more efficient for updating an existing
Timespec instance than creating a temporary instance and assigning
that.
2014-04-01 16:45:08 +02:00
Patrick Ohly 3f82f32a0c PIM: add SyncPeerWithFlags() and 'pbap-sync' flag (FDO #70950)
The is new API and flag grant control over the PBAP sync mode. It is
implemented by setting the SYNCEVOLUTION_PBAP_SYNC env variable in the
forked helper process.
2014-04-01 16:45:08 +02:00
Patrick Ohly b202f656dc PBAP: transfer data via pipe (part of FDO #72112)
The main advantage is that processed data can be discarded
immediately. When using a plain file, the entire address book must be
stored in it.

It also enables suspending a transfer by stopping to read from the
pipe, either via some internal API or simply freezing the
syncevo-local-sync process with SIGSTOP.

The drawback is that obexd does not react well to a full pipe. It
simply gets stuck in a blocking write(); in other words, all obexd
operations get frozen and obexd stops responding on D-Bus.
2014-04-01 16:45:08 +02:00
Patrick Ohly 46042c397e signon: fix build
Static build was broken for gSSO and UOA (wrong path name to .la file)
and gSSO was not enabled properly (wrong condition check).
2014-04-01 16:27:29 +02:00
Patrick Ohly 7771ee4ad1 autotools, NEWS: SyncEvolution 1.4.1 2014-03-31 16:35:58 +02:00
Patrick Ohly ef9a89f788 EDS: only load one backend plugin of each kind
SyncEvolution was meant to load the syncecal or syncebook shared object
which uses the most recent libraries (libical, libecal/libebook) on
the system and then stop loading further backends. Due to a string
handling bug the check for already backends always found nothing,
leading to multiple conflicting backends loaded on some systems (for
example, those with libical0 and libical1 installed).

If that happened, the backend became unusable.
2014-03-31 16:08:08 +02:00
Patrick Ohly 9ac06d187f D-Bus testing: fix testAutoSyncNoNetworkManager
In testAutoSyncNoNetworkManager, syncs keep happening while the test
terminates. The processes get killed correctly, but that ocassionally triggers
notifictions which the post-test D-Bus log checking treats as test failures.

To avoid this, truncate the D-Bus log before shutting down. Then all extra
events are available for debugging, but will not be seen by the check code.
2014-03-31 11:12:21 +02:00
Patrick Ohly 4879b697df D-Bus testing: extra sanity checks before starting daemon
Check for an already running instance. Otherwise the new one
will fail to start up, which will be hard to diagnose. Happened
recently when a test was broken and failed to kill its daemon
instance.
2014-03-31 11:12:21 +02:00
Patrick Ohly 2ce83fcb14 testing: updated valgrind supressions for Debian Testing and Ubuntu Saucy
New problems showed up after updating Debian Testing, similar
to what was seen also on Ubuntu Saucy.
2014-03-31 11:12:21 +02:00
Patrick Ohly 93612b5f6d testing: enable dbug mode when running syncevo-http-server
The logs do not get that much larger and the additional output
is useful when debugging problems, so enable it by default.
2014-03-31 11:12:21 +02:00
Patrick Ohly 624c357e11 http server: include time stamps in debug mode
Sometimes time stamps are necessary to understand timing-dependent
issues. A separate flag for timestamps on/off might be useful.
For now, enable them in debug mode.
2014-03-31 11:12:21 +02:00
Patrick Ohly 5713f8ff3d testing: fix akonadi.db creation problem
Occasionally in the nightly testing reading the existing akonadi.db
produced incomplete output which could not be used to create the
modified akonadi.db. This patch works around that by using pre-generated
akonadi.db.dump files as input if found.
2014-03-31 11:12:21 +02:00
Patrick Ohly 4462536f16 testing: split up local testing
"evolution" tests used to be a traditional name for all Client::Source
and SyncEvolution unit tests. This caused problems when adding
Akonadi (crash in Akonadi client lib when EDS was used before) and
was not nice in the test reporting (multiple different tests all mixed
into one summary line). It also prevented running these tests in parallel.

All of this gets fixed by splitting "evolution" into "eds", "kde",
"file" and "unittests". To avoid updating the nightly test run scripts,
--enable evolution=.... is still understood.
2014-03-31 11:12:21 +02:00
Patrick Ohly 7df500d509 testing: create XDG_RUNTIME_DIR in dbus-session.sh
More recent distros (for example, Ubuntu Saucy) rely on
XDG_RUNTIME_DIR. Each time dbus-session.sh runs, it must
ensure that the runtime dir exists and is empty.

Not doing so may have caused random concurrency issues in
parallel nightly testing.

It also was a problem when trying to run activesyncd + SyncEvolution
on a headless Ubuntu Saucy server (see FDO #76273).
2014-03-31 11:12:20 +02:00
Patrick Ohly 07d7a9f306 testing: fix empty DBUS_SESSION_BUS_PID in dbus-session.sh
If the variable was empty (not likely/possible?), then the test became
invalid.
2014-03-31 11:12:20 +02:00
Patrick Ohly e2c76c9e2e testing: remove debug logging from dbus-session.sh
set -x output is not needed anymore, we "echo" everything that is
going on.
2014-03-31 11:12:20 +02:00
Patrick Ohly 5fd70f38e7 testing: use absolute path for valgrind log file
Better assume that the program may change directories. In that
case we need an absolute path for the output file.

Nightly testing failed once because valgrind was not able to
write its output file in the new directory. It remained unclear
why the directory was changed and to what, though. But that is
a different problem.
2014-03-31 11:12:20 +02:00
Patrick Ohly f33db08c43 syncing: remember original path to session dir
Nightly testing uses a "Client_Sync_Current" symlink to point
the server to a location where it shall write its per-test logs
without having to reconfigure the server.

When the server-side session runs longer than a specific test, it ends up
using the "Client_Sync_Current" link of the next test. "permission denied"
errors were also seen, although it is less certain whether that had the same
root cause.

To avoid such issues, the sync session now tries to resolve the log dir
path to an absolute path at the start of the session.
2014-03-31 11:11:56 +02:00
Patrick Ohly ffc0c57402 D-Bus testing: fix testNoParent
When spawning the dlt daemon under "unbuffer", a lingering tclsh process
exists before the test starts and the test ended up waiting for that to
stop.

We need to be more specific with identifying sync processes: only those
processes started as part of syncing matter.
2014-03-31 11:11:41 +02:00
Patrick Ohly 5066fe2a97 D-Bus testing: increase timeouts
On a fully loaded system some tests took longer than expected.
Allow that.
2014-03-31 11:11:34 +02:00
Patrick Ohly cf08b687dc testing: remove LANGUAGE from ATTENDEE
Specifying the language of the email address did not make much sense
to start with, even if EDS does (did?) it that way originally. Akonadi
strips LANGUAGE=en. Instead of filtering that out for Akonadi, better
simplify the test data.
2014-03-26 09:48:53 +01:00
Patrick Ohly 4600c2c0d0 testing: ignore harmless data changes in Akonadi
Akonadi formats iCalendar 2.0 data slightly differently. It is okay
to ignore that in the normalized data before comparison.
2014-03-26 09:48:53 +01:00
Patrick Ohly 3632af817a testing: ignore one more Akonadi 404 failure
The linked item tests also checked for reading non-existent items,
which does not fail as expected with Akonadi.
2014-03-26 09:48:53 +01:00
Patrick Ohly 43309b14fa testing: ignore filekde::file_contact::testItems test failures
The test fails because we don't deal with some of minor data changes
introduced by KDE. Could use some love and care, ignore for now.
2014-03-26 09:48:53 +01:00
Patrick Ohly f9c9a7371c Akonadi: support KDE Notes, enhanced "database" check
The KDE Notes resources store items under a different MIME type than the one
used in AKonadi (see "[Kde-pim] note format"). SyncEvolution use the same type
as Akonadi and thus did not find existing KDE Notes resources.

To support both while KDE and Akonadi transition to the same type,
SyncEvolution now looks for notes resources using both MIME types and accepts
both kinds of items when reading. When writing, SyncEvolution picks the MIME
type that is supported by the resource, which hopefully avoids confusing the
KDE app using the resource (untested).

As a positive side effect, the "database" value used for opening a resource is
now checked more thoroughly. Non-existent resources and the type mismatches
like pointing a "kde-contacts" backend to a calendar resource are now detected
early.
2014-03-26 09:48:52 +01:00
Patrick Ohly a496f9dbfc Akonadi: ensure that UID is set (FDO #74342)
Akonadi resources do not enforce iCalendar 2.0 semantic like
"each VEVENT must have a UID" (see "[Kde-pim] iCalendar semantic").
When receiving an event from a peer which itself does not enforce
that semantic (Funambol, vCalendar 1.0 based phones), then we
need to generate a UID, otherwise KOrganizer will ignore the
imported event.
2014-03-26 09:48:52 +01:00
Patrick Ohly 387a0f58a7 testing: disable "NoID" tests when source does not support iCalendar 2.0 semantic
The tests depend on the source re-adding UID and/or RECURRENCE-ID during an
update. The Akonadi source and file source do not do that and thus we cannot
run the test against them.
2014-03-26 09:48:52 +01:00
Patrick Ohly b97dddc4b2 Akonadi: disable testing of iCalendar 2.0 semantic
Akonadi and Akonadi resources do not enforce iCalendar 2.0 semantic
like "UID+RECURRENCE-ID must be unique in a collection". Therefore we
must disable all tests expecting that behavior.

Regular syncing should work okay as long as the peer behaves. A misbehaving
peer will be able to send us invalid sets of items and syncing will not be
able to detect that because the sync engine itself is also agnostic to the
special iCalendar 2.0 semantic.

See "[Kde-pim] iCalendar semantic".
2014-03-26 09:48:52 +01:00
Patrick Ohly 05c5d53627 testing: simplify Akonadi server startup
Do not run agents that we do not need by setting
AKONADI_DISABLE_AGENT_AUTOSTART=1. See "[Kde-pim] configuring Akonadi server".
2014-03-26 09:48:52 +01:00
Patrick Ohly 6655e5ebe8 syncevo-http-server: remove D-Bus timeouts
Under heavy load while testing, syncing occasionally failed with a D-Bus
message timeout, for example in the Close() call. Let's disable these timeouts
by explicitly passing something very large (infinite is not supported by the
Python bindings).

If HTTP processing takes to long, the client may resend, but in contrast to a
failed D-Bus method call that case is handled.

The increased timeout has no negative effect on detecting when
syncevo-dbus-server dies, because then the D-Bus daemon will notify
us immediately.
2014-03-26 09:48:52 +01:00
Patrick Ohly 55bd6a76f6 testing: optimize sleep 60 in wrapperchecks.h
The previous solution left the "sleep 60" shell command running despite
killing the shell that spawned it. That lingering process caused schroot to
wait during session shutdown, which slowed down result checking considerably.

Now a single Perl process does the sleep and the killing. Killing that
process allows schroot to proceed immediately.
2014-03-26 09:48:52 +01:00
Patrick Ohly 163a27c7d9 testing: more SyncEvolution client/server combinations
filekde covers running Akonadi in HTTP server mode, which was broken in
SyncEvolution 1.4 (see FDO 75672). kdekde and filefile get added for
the sake of completeness.
2014-03-26 09:48:52 +01:00
Patrick Ohly 77ae1f2d09 testing: improved parallel testing of Akonadi
Somehow akonadi.db ends up lacking any resources. Check each sqlite3 call, log
db content and explicitly close akonadiserverc to be more resilient.
2014-03-26 09:48:52 +01:00
Patrick Ohly 2d862c7375 testing: support parallel testing of Akonadi
When cloning the home dir template, take care of adapting
some hard-coded paths in akonadiserverrc and the akonadi.db
used for sqlite. This only works when Akonadi was configured
to use sqlite as backend in the home dir template.
2014-03-26 09:48:52 +01:00
Patrick Ohly 853f70a2a1 Akonadi: avoid threading problem in HTTP server mode (FDO #75672)
When used as storage in a server, Akonadi got called in a background thread
that gets created to handle slow initialization of sources and preventing
ensuing timeouts in HTTP clients (probably not needed for Akonadi itself,
but may still be useful when combining it with other sources).

Akonadi cannot be used like that, leading to false "Akonadi not running"
errors or (if one got past that check) failing item operations.

This commit avoids the situation by shifting the work back into the main
thread.
2014-03-26 09:48:52 +01:00
Patrick Ohly 07bc8414c2 glib: adding GRunInMain() and GRunIsMain()
This is needed to move one-time operations from AkonadiSyncSource into the
main thread if (and only if) the source is used in a background
thread. Akonadi can't be used in a thread unless the thread was created with
QThread, which is not the case in SyncEvolution.

The basic functionality is the same as the older GRunWhile(). It just has to
be extended so that the action is guaranteed to be called only in the main
thread and there runs only once. This is achieved by turning the action
into a check which immediately returns false.

AkonadiSyncSource cannot include GLibSupport.h due to conflicting usage of
"signal" (a define in Qt, parameter name in glib), therefore these functions
are now made available via util.h.
2014-03-26 09:48:52 +01:00
Patrick Ohly 2a63d6d694 testing: check that we get the right VTIMEZONE
Writing a test that ensures that libsynthesis gets the right
timezone was hard, because the original problem only occurs
when syncing a vCalendar 1.0 based device with SyncEvolution.

Emulating libsynthesis at least comes close.
2014-03-26 09:48:52 +01:00
Patrick Ohly 9d13210d0b ical: workaround for libical 1.0 builtin timezone change
libical 1.0 started to return VTIMEZONE definitions with multiple
absolute transition times instead of RRULEs. This causes problems when
exchanging data with peers (see
https://sourceforge.net/p/freeassociation/bugs/95/).

In SyncEvolution, this affected sending an event using New Zealand
time in vCalendar 1.0 format to a phone, because the internal,
out-dated definition of the time zone in libsynthesis was used as
fallback when loading RRULE-based timezone definitions from libical
failed (see "[SyncEvolution] Some events showing wrong time on
phone"). It might also affect exchanging data with CalDAV peers (not
tested).

The workaround is to include the original code from libical from
before the change in SyncEvolution and override
icaltimezone_get_component() with a version that uses the original
timezone loading code. This does not fix cases where other code causes
libical itself to load a timezone, but for libsynthesis it is good
enough because it does the loading early when no other code should
have used libical.

The downside is that now we need to maintain the RRULE heuristics and
ensure that they actually work. Copying libical/src/test/timezones.c
would be useful for that.

Long-term it would be good to enhance libical itself such that it can
return a VTIMEZONE with suitable RRULEs matching a specific event,
point in time or time range.
2014-03-26 09:48:52 +01:00
Patrick Ohly 5d43c5d7e3 ical: support overriding icaltimezone_get_component() in compat layer
Check for icaltimezone_get_component() before actually loading libical.
That way our own code uses our own copy of that method from the copied
icaltz-util.c instead of always using the one from libical.

For that we must not overwriting already found functions.
2014-03-26 09:48:44 +01:00
Patrick Ohly b0ddae71cc ical compatibility: cover more symbols
The additional ones are needed for icaltz-util.c.
2014-03-26 09:48:32 +01:00
Patrick Ohly 8d84ef1ab4 ical: fix gcc 4.4 warning
gcc 4.4 complains about "num_types" being used potentially uninitialized.
This probably refers to bailing out before num_types gets set. However,
the use is conditional on "types", which is only set after "num_types",
so this is a false warning.

Prevent the warning anyway for the sake of clean -Wall -Werror compilation.
2014-03-26 09:42:57 +01:00
Patrick Ohly fd0d1582f7 ical: fix memory leak in case of read error
When EFREAD() does a "goto error", the code leaks the "r_trans"
memory. Found with cppcheck. Adding cleanup code fixes that.

To avoid a false cppcheck warning, the free() call must use the same
variable name as the calloc() assignment. It is a bit more readable
that way, too.
2014-03-26 09:42:57 +01:00
Patrick Ohly cbad1fd697 ical: enable icaltz-util executable
Can be compiled separately when linking against libical. For this
to work it must use header file locations as in libical client
programs.

icaltzutil_get_zone_directory() can come from either libical or
the icatz-util.c copy, depending on DISABLE_ICALTZUTIL_GET_ZONE_DIRECTORY.
2014-03-26 09:42:57 +01:00
Patrick Ohly c0f10a0e21 ical: unistd.h is needed for access()
This allows compiling with -Wall.
2014-03-26 09:42:57 +01:00
Patrick Ohly 4455907097 ical: import icaltz-util
This is an unmodified copy from libical trunk revision 1130, the
latest one before RRULE calculation was removed from the code.

See
https://sourceforge.net/p/freeassociation/code/1130
https://sourceforge.net/p/freeassociation/bugs/95/
2014-03-26 09:42:57 +01:00
Patrick Ohly 912bb10395 EDS: allow compat init before main()
We have to use singleton methods to ensure that the global std::string
instances are initialized before use. There was some non-determinism before
because SyncSource loading happens as part of the executable initialization,
too, and can cause a call to EDSAbiWrapperInit().
2014-03-26 09:42:42 +01:00
Patrick Ohly 62c835ea69 testing: ignore some more leaks 2014-03-19 19:26:15 +01:00
Patrick Ohly 10a2d04519 testing: link client-test with original LDFLAGS
On some platforms, LDFLAGS is used during configure to set rpath
options. runtests.py must pass the -no-install to the linker
of client-test without overwriting those flags.
2014-03-19 19:26:15 +01:00
Patrick Ohly 6147b3cc93 autotools: fix dist checking
Selecting the list of backends used invalid grep syntax ("grep -v -2.so"). It
also did not exclude the other additional backends.
2014-03-19 19:26:15 +01:00
Niels Ole Salscheider 7aa9f6d87f autotools: Add QtCore include path to KDEPIM_CFLAGS (FDO #75670)
This fixes an issue where configure fails to find Akonadi when
test programs do not compile because QString is not found:

checking for Akonadi/Collection... no
configure: error: akonadi.pc not found. Install it to compile with the Akonadi backend enabled.
...

configure:21857: checking Akonadi/Collection presence
configure:21857: g++ -E  -I/usr/include/ -I/usr/include//KDE -I/usr/include/qt4 conftest.cpp
In file included from /usr/include//KDE/Akonadi/../../akonadi/collection.h:25:0,
                 from /usr/include//KDE/Akonadi/Collection:1,
                 from conftest.cpp:44:
/usr/include/akonadi/entity.h:24:19: fatal error: QString: No such file or directory
 #include <QString>
2014-03-05 12:18:17 +01:00
Tino Mettler b560e16b6a GDBus GIO: include missing stdint.h
Eglibc 2.18 requires this additional include, otherwise there will be
an FTBFS due to missing C99 integer types.
2014-03-05 11:15:54 +01:00
Tino Mettler d3f7386387 1.4-1 package 2014-02-21 14:15:15 +01:00
Tino Mettler a8b9c78a65 Add sections for files previously missing in copyright information
Add src/gdbusxx/test/example.cpp and src/gdbus/test/example.cpp to
debian/copyright.

Closes: #739616
2014-02-21 14:15:15 +01:00
Tino Mettler 999fb6d448 Fix upgrade from versions before 1.3.99.7 due to file conflicts
Add Replaces: and Breaks: lines for older syncevolution-libs versions to
avoid file conflicts with new syncevolution-libs-gnome and
syncevolution-libs-kde packages.

Thanks: Simon McVittie
Closes: #739662
2014-02-21 14:15:15 +01:00
Tino Mettler 6da4626c21 Fix FTBFS due to erroneously hardcoded x86_64 path in an install file
The install path had x86_64 hardcoded. The build therefore only workded on
x86_64 and failed on all other architectures.

Closes: #739665
2014-02-21 14:15:15 +01:00
Tino Mettler c06a67d02f Allow parallel builds
Invoke dh with --parallel to allow parallel builds.
2014-02-21 14:15:15 +01:00
Tino Mettler 4686d27650 Adjust Maintainer: field to new surname
My surname changed recently.
2014-02-21 14:15:15 +01:00
Tino Mettler f74d777f30 New upstream release 2014-02-21 09:52:52 +01:00
Tino Mettler c546eb0d21 Merge tag 'upstream/1.4'
Upstream version 1.4
2014-02-21 09:28:26 +01:00
Patrick Ohly bb73c877a6 autotools, NEWS: SyncEvolution 1.4 2014-02-16 20:56:14 +01:00
Patrick Ohly 82bb12c5fc autotools: fix version check
The libsynthesis_3.4.0.47+syncevolution-1-3-99-7-20140203 tag
accidentally matched the check for a non-exact-tag "git-describe"
output (-<number of changes>-g<hash>). Therefore the actual tags
weren't even checked.

Reversing the check such that we look at tags ourselves and proceed with
them if one matches avoids this problem.
2014-02-16 20:56:14 +01:00
Patrick Ohly 969c794606 D-Bus testing: must ping server more often in testNoTerm
The test randomly failed under load because the client's GetVersion
call did not make it to the server in time. It seems to work better
with a smaller delay.
2014-02-16 20:56:14 +01:00
Patrick Ohly 2e2767de7c autotools: fix temp file vulnerability during compilation (CVE-2014-1639)
We must use the temporary file that was created for us securily, not
a temp file named after that file. This caused a temp file vulnerability
and the real temporary files were not deleted by the script.

We need the right file suffix for the compiler. "mktemp --suffix"
would be useful, but it not yet available in Ubuntu Lucid. So instead
create a temp dir (which works in Ubuntu Lucid) and create files
inside that.
2014-02-16 20:56:14 +01:00
Patrick Ohly f033cb9297 D-Bus testing: more debug output for testNoTerm
The test randomly fails. Perhaps we can find out why with a dump
of the actual D-Bus exception.
2014-02-13 07:30:52 -08:00
Patrick Ohly 553703f237 testing: ignore repeated TZID suffices
With DAViCal, the "EST/EDT" VTIMEZONE gets renamed by e_cal_check_timezones()
because DAViCal reorders properties and thus breaking the simple string
comparison even though the semantic of the timezone did not change.

If this happens multiple times (for example, in testTwinning), the test
failed because the " 1" suffix was only stripped once. We also need to
ignore multiple repeated suffices (" 1 1") because e_cal_check_timezones()
is not intelligent enough to bump an existing suffix.

Long term, it would be better to teach e_cal_check_timezones() how to
normalize timezones before the comparison and thus avoiding the duplicated
timezones in the first place.
2014-02-13 07:26:07 -08:00
Patrick Ohly df8aa5aa3b PIM testing: remove some debug print
This crept in with the "parallel runtests.py" commit.
2014-02-13 07:24:21 -08:00
Patrick Ohly 43d4a00963 D-Bus testing: remove race condition in testNoParent
The test relied on fixed timeouts for a) killing syncevo-dbus-server
and b) completion of the sync. The second timeout sometimes occurred
to soon, causing the testNoParent itself to fail and also the following
test (because log files from testNoParent were not removed).

Now be more careful about really killing in the middle of the sync (thanks
to delaying the sync and not the helper startup) and really wait for process
termination (with getChildren() and os.kill() checking).
2014-02-12 12:52:56 +01:00
Patrick Ohly 6f08c6de8d testing: ignore Google CalDAV backslash encoding problem
Google CalDAV server does not handle \\\n properly. It adds
an extra backslash. Avoid this aspect of the test case because
a fix on the server side has been slow in coming.

eds_event.ics.googlecalendar.tem.patch is used with
Client::Sync::eds_event and Google CalDAV as server. google_event.ics
is used for Client::Source::google_caldav.
2014-02-12 12:52:09 +01:00
Patrick Ohly 33428312b2 D-Bus testing: allow more time when running under valgrind
valgrind on Ubuntu Saucy is slower than on previous distros.
Need to increase timeouts to get tests to pass.
2014-02-12 12:52:09 +01:00
Patrick Ohly 816c756d7b testing: ignore some minor (false) valgrind leaks
Started to appear when testing on Ubuntu Saucy and Trusty and/or
with GDBus GIO over sockets. Seems minor.
2014-02-12 12:52:09 +01:00
Patrick Ohly 0385fbae55 testing: ignore Memotoo X-AIM merge failure
Memotoo should preserve X-AIM during merge conflict handling.
Instead it drops the extension. Ignore the problem, it was reported
via email and we can't work around it.

https://lists.syncevolution.org/pipermail/syncevolution/2012-July/003711.html
2014-02-12 12:52:08 +01:00
Patrick Ohly 466199d318 testing: ignore Google CardDAV X- testRemoveProperties problem
Google CardDAV preserves X- properties when they are not included
in an update. Perhaps sending them as empty properties would work.
In the meantime, ignore the failure by stripping X- props before
comparison.
2014-02-12 12:52:08 +01:00
Patrick Ohly 12b1b2f4dc testing: limit Akonadi unit testing
Disabling the Akonadi test in the backend which used to run
as part of "client-test SyncEvolution" and fail unless Akonadi
was started first. The test is not important enough to justify
running Akonadi.
2014-02-12 12:52:08 +01:00
Patrick Ohly 2d6d1cfa9c glib: fix double-free of source tags
glib 2.39.0 (aka GNOME 3.10) as found in Ubuntu Trusty introduces
warnings when g_source_remove() is passed an unknown tag. SyncEvolution
did this in two cases: in both, the source callback returned false and thus
caused the source to be removed by the caller. In that case, the explicit
g_source_remove() is redundant and must be avoided.

Such a call is faulty and might accidentally remove a new source with the same
tag (unlikely though, given that tags seem to get assigned incrementally).

The only noticable effect were additional error messages with different
numbers:

[ERROR] GLib: Source ID 9 was not found when attempting to remove it
2014-02-12 12:52:08 +01:00
Patrick Ohly 599580649f libical: compatibiliy mode for libical.so.0 and libical.so.1
libical 1.0 broke the ABI, leading to libical.so.1. The only relevant change
for SyncEvolution is the renumbering of ICAL_*_PROPERTY enum values. We can
adapt to that change at runtime, which allows us to compile once with
libical.so.0, then patch executables or use dynamic loading to run with the
more recent libical.so.0 if we add 1 to the known constants. Done without
changing all code via define tricks.

This new mode is enabled for --enable-evolution-compatibility or (limited to
ical) for --enable-evolution-compatibility=ical.
2014-02-12 12:52:08 +01:00
Patrick Ohly 6c972c4684 testing: parallel runtests.py
Testing on one platform can only be sped up further by parallelizing
it. Each action started by runtests.py may potentially run in parallel
to other actions, if it either does not need files in the home
directory (like checking out source) or can be run in its own, private
home directory.

The new --home-template parameter specifies the location of a home
directory that runtests.py can copy to create these private home
directory of each test. Each action is run in a fork of the main
runtests.py, so env and working directory changes are confined to that
fork and do not affect other actions.

When --home-template is given, runtests.py will also set up a new home
directory and point to it with HOME,
XDG_CACHE/CONFIG/DATA_HOME. Because test-dbus.py and testpim.py use a
non-standard layout of the XDG dirs without directories hidden by the
leading dot, runtests.py must move the standard directories to conform
with the other scripts' expectation.

testpim.py itself must be more flexible and allow running with a root
for the XDG dirs that is not called "temp-testpim". To allow parallel
tests, GNOME keyrings must be located in XDG_DATA_HOME, which is
supported since gnome-keyring 3.6. On older distros, parallel testing
does not work because gnome-keyring-daemon would always look in the
home directory as specified in /etc/passwd, which we cannot override.
testpim.py must not delete the keyrings when cleaning up the XDG dirs
for a test.

Locking Murphy resources and allocating jobs from GNU make jobserver
gets moved into a separate script which wraps the actual execution of
the action. Some change would have been necessary anyway (we cannot
connect to D-Bus and then fork) and the new approach is cleaner. It
ensures that cut-and-paste of the action command line into a shell
will only run with the necessary Murphy resource locked. Previously,
it might have conflicted with a running test.

As a new feature, test names as passed to resources.py can be mapped
to actual resource names via RESOURCE_<test name> env
variables. Useful for tests with different names which use the same
resources (currently DAViCal for the DAV server tests).
2014-02-03 14:30:45 +01:00
Patrick Ohly 856185019c testing: more time for TestCmdline.testSyncOutput2
When running under valgrind on a loaded machine, the test might run
for more than the 200s allowed earlier.
2014-02-02 19:32:42 +01:00
Patrick Ohly 1953dc2961 testing: wait for syncevo-http-server, enable more logging
Use the new wrappercheck.sh option --wait-for-daemon-output to ensure
that the syncevo-http-server is really running. This solves both a
timing issue (tests might start too soon) and make it more obvious when
the HTTP server is not working properly.

Diagnosing that was hard. Now we detect it and also write more debug
output from the HTTP server side into the syncevohttp.log.
2014-02-02 19:32:42 +01:00
Patrick Ohly da6dab0d3b testing: wait for background daemon in wrappercheck
When starting a daemon via wrappercheck, optionally wait for the
daemon to write a certain message to its log file. The message is
searched for with "grep -e", so regular expressions matching one line
are acceptable. Only works in combination with writing that log file.

This will be used to wait for syncevo-http-server to confirm that it
is running and ready to accept connections.
2014-02-02 19:32:42 +01:00
Patrick Ohly d747fc1e14 testing: wait for background daemon in wrappercheck
When starting a daemon via wrappercheck, optionally wait for the
daemon to write a certain message to its log file. The message is
searched for with "grep -e", so regular expressions matching one line
are acceptable. Only works in combination with writing that log file.

This will be used to wait for syncevo-http-server to confirm that it
is running and ready to accept connections.
2014-02-02 19:32:42 +01:00
Patrick Ohly 88ac5872a5 testing: more resilient resultchecker.py
Don't assume that each server actually has an entry in the result
list. In case of a failure to write that, treat the server as failed
to highlight the problem instead of failing in the resultchecker.py
script.
2014-02-02 19:32:42 +01:00
Tino Keitel 82795c4ef6 1.3.99.7-1 package 2014-01-31 16:07:10 +01:00
Tino Keitel 4172b2205a Add NEWS item to describe changes regarding KDE and GNOME support 2014-01-31 12:40:25 +01:00
Tino Keitel ea4d253f03 Update standards version to 3.9.5, no changes needed 2014-01-30 14:35:37 +01:00
Tino Keitel 4396381d7f Enable Akonadi support, separate Evolution (GNOME) and Akonadi (KDE) support
Closes: #682520
2014-01-30 14:26:00 +01:00
Tino Keitel 07dfd3949c New upstream release candidate 2014-01-30 14:25:43 +01:00
Tino Keitel 6a2aeed73f Merge tag 'upstream/1.3.99.7'
Tag upstream 1.3.99.7
2014-01-30 14:05:26 +01:00
Patrick Ohly 73e061f81a Merge remote-tracking branch 'origin/for-master/release' 2014-01-23 05:21:57 -08:00
Patrick Ohly f3cf4a80b9 autotools, NEWS: SyncEvolution 1.3.99.7 2014-01-22 01:39:59 -08:00
Patrick Ohly c99d93372b autotools: build issue with PIM Manager + boost-locale
On current Debian Testing, boost libraries are installed in /usr/lib/<arch>
directories where they are not found by the Boost m4 macros. This breaks the
boost-locale detection because it only tries linking against libs that it
finds in the file system first.

To fix this, at least try linking with -lboost-locale and use that if it
works.
2014-01-21 23:26:45 -08:00
Patrick Ohly ee4cad7944 autotools, NEWS: SyncEvolution 1.3.99.7 2014-01-20 11:22:15 +01:00
Patrick Ohly 10acea4a6d autotools: fix rpm packages and description (FDO #73347)
At least on OpenSUSE, ldconfig must be run after installing
SyncEvolution to update the shared library information cache.
Do that automatically as part of the rpm's post and postun steps.

The syncevolution-bundle description was wrong. It incorrectly
used the description of a meta package.
2014-01-20 01:58:31 -08:00
Patrick Ohly 21a1b79915 ForkExec: ignore unexpected SIGKILL
Sometimes, on a more recent Linux distro, the helper is said to terminate
with SIGKILL although we only sent a SIGTERM. Not sure why that happens.
It randomly breaks tests, so let's ignore the unexpected signal. Everything
else seems to work correctly.
2014-01-17 16:15:16 +01:00
Patrick Ohly c1e894b5e7 message resend: be more conservative
When timing out, SyncContext nevertheless sometimes resent a message despite
being close to the final timeout deadline. Relax the math further so that more
time must remain before the deadline when attempting a resend.

The earlier behavior randomly broke some of the resend tests.
2014-01-17 16:15:16 +01:00
Patrick Ohly d99c25f20a PIM testing: try to use EDS for E.164 normalization during locale change
Tried it, didn't work due to an EDS crash during localed change handling
(https://bugs.freedesktop.org/show_bug.cgi?id=59571#c20). Keep the code
around anyway although it is not active yet.
2014-01-17 16:15:16 +01:00
Patrick Ohly 54bbeeb247 PIM testing: fix failure in testLocaledPhone
When testLocaledPhone was run after testLocale, it used the localed installed
by the earlier test. We must ensure that daemons on the system bus get removed
after each test.
2014-01-17 16:15:16 +01:00
Patrick Ohly 3bde1fe9bd D-Bus testing: fix and enhance TestHTTP
Picking a port dynamically was broken: if 9999 was in use, the test script
connected to the wrong process and then incorrectly continued, instead of
detecting that syncevo-http-server failed. Use the auto-alloc feature
of syncevo-http-server (port == 0) instead and get the actual port
from the output.

Now that we redirect that output into a file, it makes sense to also include
that log in test failure reports.
2014-01-17 16:15:16 +01:00
Patrick Ohly c1384c9279 syncevo-http-server: log port which is used
This is particularly useful in combination with an URL that
has "0" as port number, because then Twisted will automatically pick
a port.
2014-01-17 16:15:16 +01:00
Patrick Ohly ca0b2db58c testing: help scan-tool by adding noreturn annotations
When an assert triggers, the following code does not get executed.
clang's scan-tool could not detect that because CppUnit's templates
are not annotated with the "noreturn" attribute. We already use
wrappers around CppUnit, so we can fairly easily add a fake "noreturn"
call to exit() to the assertion failure path.

While at it, avoid unnecessary inlining and update the macros to
handle parameters with commans (the necessary brackets were missing).

With this and the preceeding changes, a build with most SyncEvolution features
enabled passes scan-build without errors. There are still errors in
libsynthesis, though. See https://bugs.freedesktop.org/show_bug.cgi?id=73393
2014-01-17 16:15:16 +01:00
Patrick Ohly 7292332027 testing: avoid false scan-tool warning
clang's scan-tool fails to detect that the variable is bound
to a boost::lambda expression and indeed does get read later on.
Hide the write via ifdefs to suppress the warning when doing
static code analysis.
2014-01-17 16:15:16 +01:00
Patrick Ohly b1668bce81 EDS: fix false clang warning
Control flow analysis from clang's own C++ compiler and clang's
scan-tool come to different results: the compiler fails to detect
that the variable will be initialized in all cases and thus requires
a redundant initialization to avoid an "uninitialized memory read"
error with -Wall, while scan-tool complains about the redundant write.

To satisfy both, avoid the initialization when doing static code analysis.
2014-01-17 16:15:16 +01:00
Patrick Ohly 1d6f88cbbe SuspendFlags: avoid scan-build warning
The intermediate "msg" variable caused a warning from clang's scan-build about
setting but not reading it. To get rid of the warning we are now writing into
the final buffer directly.
2014-01-17 16:15:16 +01:00
Patrick Ohly 7086ebcae8 GNOME Bluetooth: fix false (?) buffer overflow
From scan-build: size argument is greater than the free space in the
destination buffer, for the line with strncat().

This might be a false positive in scan-build, the size looks right
at first glance. To be on the safe side and get rid of the warning,
allocate one one more byte...
2014-01-17 16:15:16 +01:00
Patrick Ohly 46ded509e0 D-Bus server: avoid scan-tool false positive
clang's scan-tool complains about keeping a local address stored
in a global structure, the argument description. This is not a real
problem because the structure is not going to be used after leaving
main(), but perhaps it is cleaner nevertheless to allocate the
structure on the stack.
2014-01-17 16:15:16 +01:00
Patrick Ohly 5ea8b597df sqlite: dead code removal
The "numargs" variable was only set and modified, but never used.
Must be an artifact, can be removed. Found by clang's scan-tool.
2014-01-17 16:15:16 +01:00
Patrick Ohly 0855a8b961 core: mark error throwing or exit functions as SE_NORETURN
throwError() never returns normally. fatalError() terminates the process.
2014-01-17 16:15:16 +01:00
Patrick Ohly 0851a3aa3a core: add SE_NORETURN
Allow marking methods and functions as "does not return". This may
help static code analysis tools to determine that certain code paths
will not be taken.
2014-01-17 16:15:16 +01:00
Patrick Ohly 69d77b30d2 testing: include cppcheck
The new runtest.py --cppcheck flag can be used in combination with
sources checked out earlier. The source checkout actions then
run cppcheck on each source tree and fail if cppcheck finds any
non-suppressed problems.

A wrapper around cppcheck must be used because --error-exitcode caused
non-zero exit codes also when errors where suppressed, at least in cppcheck
1.61.

We check the SyncEvolution source a bit more thoroughly than the rest because
we can fix or suppress issues inline, which might not be acceptable for
libsynthesis or activesyncd.
2014-01-17 16:15:16 +01:00
Patrick Ohly fa6db3eba7 cppcheck: suppress warnings
The remaining warnings are either not valid or refer to code which
is intentionally broken. Suppress these warnings.

SyncEvolution now passes scanning with cppcheck 1.61 without warnings.
2014-01-17 16:15:16 +01:00
Patrick Ohly edc21305af testing: fix naming of log files in doCopy()
The log file guard instance which should have added a "copy" part to log files
was deleted again before it could have the desired effect.  Found by cppcheck
("Instance of 'SyncPrefix' object is destroyed immediately.").
2014-01-17 16:15:16 +01:00
Patrick Ohly cee4265d94 testing: cppcheck redundant assignment
cppcheck correctly identified a redundant assignment which can be removed.
2014-01-17 16:15:15 +01:00
Patrick Ohly 5fed9ef3e6 testing: avoid unitialized members after constructor
cppcheck warned about this. This wasn't actually a problem (one member
was not used at all, the other was set later), but for the sake of
clean cppcheck scans let's fix it.
2014-01-17 16:15:15 +01:00
Patrick Ohly d9ecdafb01 local sync: avoid redundant ConfigNode instances
When configuring a local sync on the target side, the code in
SyncConfig::getSyncSourceNodes() created redundant ConfigNode instances.  This
was pointed out by cppcheck as redundant variable assignments.  The code which
created these additional instances may have had side-effects, but it doesn't
look like these were desired and/or relevant.
2014-01-17 16:15:15 +01:00
Patrick Ohly 3f58a4ab2d GTK-UIs: avoid unnecessary variable initialization
In this case it is fairly obvious that new_active and old_active
will both be set before use. There is no need for setting old_active
to FALSE. cppcheck warned about this.
2014-01-17 16:15:15 +01:00
Patrick Ohly 1707566ebe GDBus libdbus: fix realloc error handling
When realloc fails, do not drop the original pointer because it is
still valid. It must be freed later. Found by cppcheck.
2014-01-17 16:15:15 +01:00
Patrick Ohly 9d473b3a65 WebDAV: fix cppcheck warning about uninitialized memory read
cppcheck cannot know that one of the two if checks must succeed
and warns about the case when both are false. This shouldn't
happen, but it doesn't hurt to initialize the const char * pointer
to a default value.
2014-01-17 16:15:15 +01:00
Patrick Ohly d88d2e8403 maemo: don't rely on close() to free resources
cppcheck complained about "con" not being initialized in the constructor.
In general it is better to fully initialize all members, even if (as in this
case) they are not used outside of a second initialization step (open/close).

This warning pointed to a second potential problem: should SyncEvolution ever
fail to call close() after open(), resources would leak because all allocated
resources get freed in close(). For the sake of defensive programming it is
better to initialize in the constructor, then free in both close() and the
destructor.
2014-01-17 16:15:15 +01:00
Patrick Ohly ba7e3543f0 EDS contacts: better check SYNCEVOLUTION_EDS_ACCESS_MODE in constructor
That way we can initialize m_accessMode immediately in the constructor,
which keeps cppcheck happy and avoids uninitalized data in the instance
between creation and open(), which is better than before.
2014-01-17 16:15:15 +01:00
Patrick Ohly e407d71410 cppcheck performance: function parameter should be passed by reference
cppcheck found some minor cases where complex parameters were accidentally
passed by value.
2014-01-17 16:15:15 +01:00
Patrick Ohly b27e560085 cppcheck performance: possible inefficient checking for emptiness
cppcheck correctly identified some places where the weaker empty()
call can be used instead of size() to determine whether an STL
data structure contains something.

None of them were really performance critical, but let's fix them
anyway for the sake of clean cppcheck scan results.
2014-01-17 16:15:15 +01:00
Patrick Ohly 37c43f00ea cppcheck performance: Prefer prefix ++/-- operators for non-primitive types.
This fixes all instances found by cppcheck where a prefix opererator
should have been used.
2014-01-17 16:15:15 +01:00
Patrick Ohly db01a1a8cc OS X Addressbook: ignore cppcheck warning
The warning might not apply and the code is pretty much dead anyway.
2014-01-17 16:15:15 +01:00
Patrick Ohly 4e833ec546 activesync: code cleanup (cppcheck)
cppcheck complains about sub-optimal performance (std::string should be passed
via const reference, not by value). It is not critical here, but for the sake
of getting clean scan results let's fix the issues...

One of the offending methods was never implemented, nor called. Removed.

The Collection class did not initialize all its members. Even if the code
never relied on them being initialized (not checked), it is better to be
safe and predictable, which means initializing all members in the constructor.
2014-01-17 16:15:15 +01:00
Patrick Ohly a0de6e6720 packaging: support EDS 3.10, fix dependencies
Renaming the backends now needs to be done before calling make.
This is used to include two versions of syncecal.so:
- one for EDS >= 3.6 < 3.10
- one for EDS >= 3.10 with the libecal-1.2 soname patched

The second flavor became necessary because EDS 3.10 accidentally
changed the soname. The API and ABI actually is the same, so
we don't need to compile twice.

The package meta data must include additional alternatives for
libecal and libebook when including extra backends. This must
be passed in via EXTRA_BACKENDS_ECAL/EBOOK_REQUIRES; the makefile
does not attempt to determine what those are.
2014-01-17 16:15:15 +01:00
Patrick Ohly daa4bc7d27 packaging: remove redundant ADD_EXTRA_PACKAGES
After adding installation of the extra packages to "make install",
adding them as part of packaging became redundant.
2014-01-17 16:15:15 +01:00
Patrick Ohly 3b528ec6d0 packaging: update syncevolution-kde dependencies
kdebase-runtime became kde-runtime in Debian Wheezy. Accept both
as prerequisite of syncevolution-kde to allow installation on
newer distros without pulling in the transitional kdebase-runtime
package.
2014-01-17 16:15:15 +01:00
Patrick Ohly 1e6bad0cfe D-Bus testing: use different ports for http server tests
The tests must use different ports, otherwise they cannot run in
parallel.
2014-01-17 16:15:15 +01:00
Patrick Ohly 70bca00073 testing: separate distcheck
"dist" must complete before being able to install and test packages on
different platforms. By running "make distcheck" separately, we can
start with parallel testing sooner and separately enable/disable
distcheck testing.
2014-01-17 16:15:15 +01:00
Patrick Ohly 333b282b9b testing: do not rely on "compile" being enabled
This fixes a problem during source checkout.
2014-01-17 16:15:15 +01:00
Patrick Ohly edda92b352 testing: allow invoking runtest.py multiple times for the same platform
When run with an existing resultdir, do not remove the resultdir
and append to output.txt. This is useful for splitting compilation and
testing into two separate phases where testing on other platforms
can be started in parallel once compilation is complete.

Depends on the enhanced resultchecker.py.
2014-01-17 16:15:14 +01:00
Patrick Ohly a0863378d9 testing: log PID of runtests.py
Tracking of PIDs becomes relevant when parallelizing testing. The message
also shows when a particular runtest.py run started.
2014-01-17 16:15:14 +01:00
Patrick Ohly ed3cf97a87 testing: handle output.txt files with multiple entries per action
Compilation and actual testing will be split into two runtest.py invocations
to support parallelizing of testing. resultchecker.py must handle the
resulting output.txt, which will have multiple entries for for each action:
first compilation followed by skipped testing, then skipped compilation
followed by testing. resultcheckper.py must report the non-skipped
results and only fall back to "skipped" if none are found.

In addition, make it clear that the initial steps are about the source code by
renaming the step in the report with a "-source" suffix.
2014-01-17 16:15:14 +01:00
Patrick Ohly b37eadf203 testing: support result checking in platforms which have no pkg-config
When testing pre-compiled binaries it may happen that we cannot
determine library versions with pkg-config because development
files are not installed. Ignore these errors and skip adding
library version numbers.
2014-01-17 16:15:14 +01:00
Patrick Ohly 958c240857 testing: be more careful when cleaning up D-Bus session
When already started with D-Bus env variables, do not kill those
daemons. When killing daemons, report it on stderr so that it can
be tracked down who killed which processes.
2014-01-17 16:15:14 +01:00
Patrick Ohly 55b4056f0c testing: compile with lower priority
Compile jobs are not timing sensitive, so run them with lower priority than
test jobs. This becomes relevant when multiple runtests.py instances are
active.
2014-01-17 16:15:14 +01:00
Patrick Ohly 9a1fbcab5e testing: fix source checkout
Reordering the command line just cannot cope with the complex command line
setup for checking out source code. Disable the reordering for that command.
2014-01-17 16:15:14 +01:00
Patrick Ohly ce244e4a44 testing: don't overwrite LD_LIBRARY_PATH and PATH
Both env variables might be set multiple times, once as part of the shell
prefix and again for the specific test. The second instance used to overwrite
the previous one unless one was very careful about embedding the environment's
current value of these variables.

The problem with that was that LD_LIBRARY_PATH had to be set in the
environment of runtest.py, where it may break running other commands outside
of the test shell.

Better be a bit more smart about the final command and merge the two values
into one.
2014-01-17 16:11:09 +01:00
Patrick Ohly 5fe1af993d testing: support make's jobserver to control number of processes
When running multiple instances of runtests.py, optionally ask
the make jobserver for permission to run jobs before proceeding
with an action.
2014-01-17 16:11:09 +01:00
Patrick Ohly f28861884e testing: use Murphy to control resource access during testing
When multiple different runtests.py instances are active, they must coordinate
access to shared resources like accounts on servers. We can use Murphy
(https://01.org/murphy/) for that.

If runtest.py is started with a D-Bus session address set in the environment,
it expects Murphy to be running there and will lock a resource named after
each operation before running the operation. Some operations (like "compile")
can be granted to each instance, but some (like "memotoo") must be exclusive.

Here's a complete Murphy lua config:

m = murphy.get()

-- try loading console plugin
m:try_load_plugin('console')

-- load the native resource plugin
if m:plugin_exists('resource-native') then
    m:load_plugin('resource-native')
    m:info("native resource plugin loaded")
else
    m:info("No native resource plugin found...")
end

-- load the dbus resource plugin
m:try_load_plugin('resource-dbus', {
    dbus_bus = "session",
    dbus_service = "org.Murphy",
    dbus_track = true,
    default_zone = "driver",
    default_class = "implicit"
  })
m:info("dbus resource plugin loaded")

-- define application classes
application_class { name="implicit" , priority=0 , modal=false, share=true ,
order="fifo" }

-- define zone attributes
zone.attributes {
}

-- define zones
zone {
     name = "driver"
}

-- define resource classes
resource.class {
     name = "audio_playback",
     shareable = true,
     attributes = {
         role = { mdb.string, "music", "rw" },
         pid = { mdb.string, "<unknown>", "rw" },
         policy = { mdb.string, "relaxed", "rw" }
     }
}

-- SyncEvolution resources: one per runtest.py
-- Some tests can run in parallel. Those resources are shareable.
for i,v in pairs {
    -- compiling the source on one platform
    "compile",
    "install",
    "dist",

    -- checking out source
    "libsynthesis",
    "syncevolution",
    "activesyncd",

    -- local tests
    "evolution",
    "dbus",
    "pim",
    } do
    resource.class {
        name = v,
        shareable = true
    }
end

-- TODO (in runtests.py): some of these resources overlap
for i,v in pairs {
    -- tests involving unique peers
    "googlecalendar",
    "googlecontacts",
    "owndrive",
    "yahoo",
    "oracle",
    "davical",
    "apple",
    "googleeas",
    "exchange",
    "edsfile",
    "edseds",
    "edsxfile",
    "davfile",
    "edsdav",
    "mobical",
    "memotoo",
    } do
    resource.class {
        name = v,
        shareable = false
    }
end

-- test for creating selections: don't remove, murphyd won't start without it
-- (E: Failed to enable resolver autoupdate.)
mdb.select {
           name = "audio_owner",
           table = "audio_playback_owner",
           columns = {"application_class"},
           condition = "zone_name = 'driver'",
}
2014-01-17 16:11:09 +01:00
Patrick Ohly 28c0f6d923 testing: automatically flush runtest.py output
This becomes relevant when running runtest.py multiple times in
parallel.
2014-01-17 16:11:00 +01:00
Patrick Ohly 032ce4b027 testing: include timing information in runtest.py output
It is useful to know when certain actions happened and how long they
took, in particular when running multiple runtests.py instances.
2014-01-17 16:08:28 +01:00
Patrick Ohly 228d479a6b testing: prepare running in incomplete chroots
The resultchecker.py script must not rely on being able to cd into
a specific directory and then having the chroot use that same directory,
because paths may be different. Instead always use absolute paths inside
the schroot commands.
2014-01-17 16:08:15 +01:00
Patrick Ohly f663c2716c testing: update packaging and testing of pre-compiled binaries
Only the "client-test" executable and its test data were installed so far, in
/usr/bin resp. the doc dir. Now also test-dbus.py and testpim.py plus their
data files get installed, using a new /usr/lib/syncevolution/test directory
for all test files and commands.

"runtests.py --prebuilt" can take one or more .deb files including these
tests, will install them as the "compile" operation and then will use the
installed SyncEvolution, without overriding any paths. This relies on having
suitable rights for "dpkg" and /usr/lib/syncevolution/test; the way how that
is done in the nightly testing is via chroots where the entire file system
is writable by the normal test user.

Normal users without such write access to /usr/lib/syncevolution/test need
to copy that directory into their home directory first.
2014-01-17 16:07:58 +01:00
Patrick Ohly fc3d1d6ec4 D-Bus testing: cover auto-sync + command line session (FDO #73562)
This adds hooks into doAutoSyncLocalSuccess() which are used by
testAutoSyncLocalMultiple() to start a session while waiting for auto-sync,
access the config which will get auto-synced, then continue waiting.

While at it, also measure the actual auto sync interval and roughly
compare against the configured one.
2014-01-17 05:18:19 -08:00
Patrick Ohly 2ee22d1741 D-Bus testing: compatibility with Python < 2.7
Allow using some Python 2.7 unittest methods by introducing out own
fallbacks: assertLess, assertLessEqual, assertAlmostEqual with delta.
2014-01-17 05:18:19 -08:00
Patrick Ohly 1ae7603a34 D-Bus testing: fix glib timeout duration
The actual timeout duration was too small by a factor of 1000 (ms
versus s mismatch). Did not affect existing tests which just had their
(anyway small) timeouts triggered too soon.
2014-01-17 05:18:19 -08:00
Patrick Ohly ac1887741f D-Bus server: fix abort when mixing auto-sync and manual operations (FDO #73562)
When enabling auto-sync for a config and then accessing or syncing the
config manually via the command line tool, the server would abort at
the time when the auto-sync was originally scheduled.

The reason is that rescheduling reset the timeout which caused the
rescheduling, only to be cleared when the rescheduling callback
returns. Then when it triggered next, an empty boost::method was
called. The fix is to to track whether the Timeout instance still
refers to the same glib timeout and only clear the instance if that's
still the case.

A unit test will be committed separately.
2014-01-17 05:18:19 -08:00
Patrick Ohly e7289857e3 config: clarify autoSyncInterval
The interval is measured from the start of last sync. The rationale for that
is that it makes the time when syncs run independent from the duration of each
sync, which is more predictable.

The implementation already works like that, it just was not clear from the
property description.
2014-01-17 05:18:18 -08:00
Patrick Ohly 57f0027e98 EDS: libsyncevolution.so no longer depends on EDS
The ESourceRegistry singleton used to be handled by the lib, now it
only hosts a pointer to it created elsewhere. To avoid a false
dependency, the lib should not be linked against EDS.
2014-01-14 14:48:57 +01:00
Patrick Ohly 41e878d0d8 D-Bus server: accept WBXML with charset in incoming connections
A user reported via email that the Nokia 515 sends
'application/vnd.syncml+wbxml; charset=UTF-8' as type of its messages
this tripped up the syncevo-http-server, leading to:

   [ERROR] syncevo-dbus-server: /org/syncevolution/Server: message type 'application/vnd.syncml+wbxml; charset=UTF-8' not supported for starting a sync

We need to strip the '; charset=UTF-8' suffix also when checking for
WBXML.
2014-01-09 08:47:22 +01:00
Patrick Ohly e6dddfd1c4 autotools: mark all .99 releases as pre-release
Somehow some policy crept in that said that only versions < .99.6 are
pre-releases. Not sure where that came from. The goal ist to mark all
.99 releases as pre-release in the version string.
2014-01-09 08:47:22 +01:00
Patrick Ohly 66a4812567 signon: fix compilation with nothing enabled, II
The earlier fix did not cover the case of compiling SyncEvolution
statically. In that case the *Register.cpp files do get compiled for
all backends. When nothing is enabled, signonRegister.cpp cannot
register any kind of provider.

Source backends can register an inactive source backend to document
that the backend exists and merely was not enabled during compilation;
there is no such support for providers.
2014-01-09 08:43:36 +01:00
Patrick Ohly 9e6fcc2869 autotools: relax dist checking
When trying to add provideruoa.so compiled on Ubuntu Quantal to
the archive compiled on Ubuntu Lucid, undefined references to
future libstdc++ tripped up the symbol check.

This is actually okay for system libraries, the .so will simply
not load and/or work on older systems. Filter out such warnings,
starting with libstdc++. Other system libs can be added as needed.
2014-01-08 15:51:54 +01:00
Patrick Ohly 64a21f8f5d signon: add version check for UOA
Better check in configure that libgsignon-glib and libaccounts-glib
are recent enough to match the code.
2014-01-08 15:51:54 +01:00
Patrick Ohly 48499d3cfd signon: fix compilation with nothing enabled
When neither gSSO nor UOA were enabled, the provideruoa.so was
still enabled and failed to link because its LDFLAGS were not
set. It shouldn't have been enabled at all.

While we are at it, allow both to be enabled in the build rules,
even though the code doesn't support it (symbol clashes).
2014-01-08 15:51:54 +01:00
Alberto Mardegan 80f1deb5e9 signon: add Ubuntu Online Accounts support
Add a new configuration flag (--enable-uoa) to enable building the
signon backend for Ubuntu Online Accounts. The work done for gSSO is
reused and just slightly adapted (using preprocessor conditions) to work
with UOA as well.
2014-01-08 15:51:54 +01:00
Patrick Ohly 143b7022af signon: fix compile error
Converting PlainGStr to bool is ambiguous, some compilers
fail on it. Avoid the ambiguity by checking the actual
char string pointer.
2014-01-08 15:51:54 +01:00
Patrick Ohly e1fb7eb282 testing: prepare running in incomplete chroots
In the future, nightly testing will use chroots which copy their root
filesystem and all additional files, instead of bind mounting them as it is
done now. The advantage of that setup is that the test runs become independent
from each other and thus can be parallelized. The downside is that paths to
files created inside the chroot has to be accessed via a different path from
the outside.

runtests.py will be invoked with those outside paths and needs to translate
them to the shorter paths used inside the chroot when invoking commands that
run inside it. This affects the current directory and any paths in the
argument list.
2013-12-09 08:41:06 -08:00
Patrick Ohly 30575344cf command line: randomly did not show output
Because of an uninitialized memory read introduced for DLT after
1.3.99.5, output from the syncevolution command line tool was not
shown randomly.

Other usages of the second constructor for MessageOptions may also
have been affected.

That this was not caught by nightly testing points towards a problem
which will have to be solve separately: test-dbus.py needs to run
syncevolution under valgrind.
2013-12-09 16:35:59 +01:00
Patrick Ohly 7ccfc4f524 NEWS, autotools: SyncEvolution 1.3.99.6 2013-12-04 13:57:30 +01:00
Patrick Ohly 0010c03b48 GOA: fix usage with libdbus
We must not request a name, so don't pass "". This caused
assertions inside libdbus when trying to set up a Google
sync config.
2013-12-04 13:53:08 +01:00
Patrick Ohly 607b41723c PBAP: document known issue with obexd < 0.47
PullAll only worked once. Not sure why, but at least document the
issue in the source as comment.
2013-12-04 13:53:08 +01:00
Patrick Ohly dc05bf78ce PIM: fix sync.py + multiple peers
Due to overwriting a variable, configuring multiple different
peers did not work.
2013-12-04 13:53:08 +01:00
Patrick Ohly c435e937cd engine: disable batching by default
Change the EDS backend to not batch by default and only enable it
for PIM Manager PBAP syncs.

This avoids unnecessary overhead when running a normal SyncML sync
with a non-SyncEvolution peer, because then the batched operation
would be flushed immediately by the Synthesis engine, and more
importantly, it fixes a segfault in
Client::Sync::eds_event_eds_contact::testLargeObject EDS<->DAV tests.

Enabling batching during general syncs obviously needs further work...
2013-11-29 14:30:16 +01:00
Patrick Ohly 5dc6ef241b testing: ignore GNOME 3.8 leaks
"Testing" was updated from Debian Wheezy to the current Debian Testing
with GNOME 3.8. This triggered some minor new leaks and changed some existing
ones.
2013-11-26 17:03:03 +01:00
Patrick Ohly 7d769bc8bf testing: include DLT in nightly testing
When TEST_DBUS_DLT is set, start the DLT daemon and tell syncevo-dbus-server
to use it. This relies on dlt-daemon being in the PATH, which requires
some changes in setting that env variable via runtests.py.

unbuffer from expect-dev (on Debian) is needed to get dlt-daemon to
print each message immediately.

This only adds the infrastructure for testing DLT logging. The actual
tests still need to be added.
2013-11-26 17:03:03 +01:00
Patrick Ohly 5f28e661b8 testing: ignore DLT leak
libsynthesis leaks some small amount of memory when it gets unloaded.
That's better than trying to free on unload, because it is not clear
how long the instances are needed.
2013-11-26 17:03:03 +01:00
Patrick Ohly 23929575e9 DLT: fix minor memory leak
Found when adding DLT to nightly testing under valgrind.
2013-11-26 17:03:02 +01:00
Patrick Ohly 354ca6e2a3 testing: always log to stderr by default in wrappercheck.sh
As in the other scripts, don't pollute stdout of the actual command.
2013-11-26 17:03:02 +01:00
Patrick Ohly 755438ceb7 testing: fix test failures caused by syncebook/cal-2.so
The hyphen introduced with the alternate EDS backends wasn't expected
by the regex. Now simply assume that backend names are non-whitespace
characters.
2013-11-26 17:03:02 +01:00
Patrick Ohly 1c6bf2303e testing: allow more time for shutdown under valgrind
In testSyncOutput, valgrind really chewed more than one minute
on syncevo-dbus-server during process shutdown. We need to give
it enough time, otherwise the test failed with "process had to be
killed".
2013-11-26 17:03:02 +01:00
Patrick Ohly a58a7b58f0 testing: fix linked items remove normal test
The hack for the EDS < 3.6 deficiency where EDS adds an EXDATE must not
be used when running a client-test executable compiled for old EDS with
an EDS backend for new EDS. This caused incorrect test failures with
new EDS.

Therefore replace the compile-time check with a runtime check.
2013-11-26 17:03:02 +01:00
Patrick Ohly 06e7d0946f compatibility hack: support libical.so.1
libical 1.0 changed the library name to libical.so.1, causing dependency
problems becaus syncevolution.org binaries required libical.so.0.

It turned out that the relevant parts of the API and ABI had not changed,
so simply allowing both versions of the library is sufficient.

In addition, a detection of libical.so.1 gets added, just in case.
2013-11-26 17:03:02 +01:00
Patrick Ohly 5e46710ea9 logging: hide glib warnings from users
Most glib warnings are too technical for normal users. Better restrict
their logging to "for developers", which keeps them out of stderr of normal
invocations.

Triggered by a new warning showing up with GNOME 3.8 which didn't seem
to cause any problems.
2013-11-26 17:03:02 +01:00
Patrick Ohly 9ad092745d CalDAV: remove dead code
The code wasn't used and incorrectly made it look like SyncEvolution used an
enum which changed its value between libical.so.0 and libical.so.1. Better
remove the code...
2013-11-26 17:03:02 +01:00
Patrick Ohly 47e89b1781 autotools: fix libsynthesis version dependency
Upstream Synthesis source code has increased the major version number.
2013-11-26 17:03:02 +01:00
Patrick Ohly 6a4ab50aee PBAP: add support for obexd 0.48
obexd 0.48 is almost the same as obexd 0.47, except that it dropped
the SetFilter and SetFormat methods in favor of passing a Bluex 5-style
filter parameter to PullAll.

SyncEvolution now supports 4, in words, four different obexd
APIs. Sigh.
2013-11-26 17:03:02 +01:00
Patrick Ohly 05e5911e05 testing: ignore g_socket_accept + cancel leak 2013-10-30 05:13:34 -07:00
Patrick Ohly 02dbb246bf testing: ignore GIO thread leak, variant 2 2013-10-30 05:13:10 -07:00
Patrick Ohly da4987a1aa NEWS, autotools: SyncEvolution 1.3.99.6 preparations 2013-10-30 11:55:18 +01:00
Patrick Ohly a102e5c224 testing: ignore getaddrinfo valgrind warning
Found on current Debian Testing.
2013-10-29 13:18:13 +01:00
Patrick Ohly 28a1483b7e PIM: fix compiler warning
Recent gcc complains about redundant local typedef.
2013-10-29 13:18:13 +01:00
Patrick Ohly 700ddd7b41 PIM testing: check behavior with broken pim-manager.ini (FDO #70772)
The PIM Manager should be able to start normally and the default sort
order should be used instead of the invalid one from the config.

Invalid address books are also tested, without checking for any
specific value from GetActiveAddressBooks().
2013-10-29 13:18:13 +01:00
Patrick Ohly 1f8f2d14ea PIM: ignore broken sort order in config (FDO #70772)
Failure to set the sort order from pim-manager.ini should not
prevent the startup of the PIM Manager because the client
cannot really diagnose and fix the problem. It is better
to try again with the default sort order.
2013-10-29 13:18:13 +01:00
Patrick Ohly 0d7ed20931 PIM testing: cover pim-manager.ini handling during SetPeer() (FDO #70772)
The content of pim-manager.ini should be monitored to find issues
like the one reported in FDO #70772. For that particular problem
to appear we also need to use SetActiveAddressBooks().
2013-10-29 13:18:13 +01:00
Patrick Ohly b1ca48ca0a PIM: fix incorrect write into pim-manager.ini (FDO #70772)
Removing a peer accidentally wrote the updated list of active address
books into the "sort" property of pim-manager.ini, which then
prevented starting the PIM Manager (a different problem which will
be addressed separately).
2013-10-29 13:18:13 +01:00
Patrick Ohly 04879b6026 PIM: explicitly re-calculate pre-computed data on locale change
The normalization of phone numbers depends on the locale. This commit
adds a test for that and code which works without relying on EDS to
re-calculate those normalized numbers.

This is not the normal mode of operation and thus this can't be the
final solution. The right solution would be for EDS to notice the
locale change, re-check all precomputed phone numbers
(X-EVOLUTION-E164 parameter) and emit change notifications. Those then
would get picked up by folks and from there, update the PIM views.

The tests rely on running dbus-session.sh with
DBUS_SESSION_SH_SYSTEM_BUS set.
2013-10-29 13:18:13 +01:00
Patrick Ohly bbc8816b30 D-Bus testing: allow creating a private system bus
If started with DBUS_SESSION_SH_SYSTEM_BUS non-empty, dbus-session.sh
will create two private buses and use one as the system bus, the other
as session bus.

The purpose is to allow fake daemons on the system bus without having
to modify the clients. At the moment, those clients still need to be
told to contact a fake daemon on the session bus.
2013-10-29 13:18:13 +01:00
Patrick Ohly 08f44ab6bf D-Bus testing: avoid error message when /usr/bin/gnome-keyring-daemon is missing
dbus-session.sh should not try to start /usr/bin/gnome-keyring-daemon
when it is missing or not executable.
2013-10-29 13:18:13 +01:00
Patrick Ohly 73d72502b8 PIM: adapt to locale changes at runtime (FDO #66618)
Listen to signals from localed D-Bus system service and update all
internal state which depends on the current locale. This state includes:
- pre-computed data in all loaded contacts
- filtering (for example, case sensitivity is locale dependent)
- the sort order

In the current implementation, the entire LocaleFactory gets replaced
when the environment changes. The new instance gets installed in
FullView, then the sort comparison gets created anew and the existing
setSortOrder() updates the main view, which includes re-computing all
pre-computed data.

As a last step, the search filter is re-recreated and filtering gets
updated in all active filter views.

There is a minor risk that unnecessary changes get emitted because
first filtered views react to modified contacts and/or reshuffling
them, then later their filter gets replaced.
2013-10-29 13:18:13 +01:00
Patrick Ohly 6285597579 D-Bus server: LocaledListener must not fail without system bus
The listening functionality is meant to be optional, which includes
running inside an environment which doesn't even have a system D-Bus,
like the nightly testing.
2013-10-29 13:08:18 +01:00
Patrick Ohly 76d7af91ce D-Bus server: utility class for localed D-Bus interface
This is the client side for the org.freedesktop.locale1 "Locale"
property. It ensures that new values of that property are made
available locally.

Optionally it can also update the current process' environment and
send a simpler "locale environment changed" if it made some changes.
This needs to be enabled by connecting the setLocale() method to the
m_localeValues signal.
2013-10-29 13:08:04 +01:00
Patrick Ohly 44b31eac29 EDS: disable asynchronous creation of ESourceRegistry
After testing more with EDS 3.8 on Debian Testing, random hangs
were observed inside the glib main loop while waiting for the
registry creation callback. It's uncertain why that happens,
and due to lack of time at the moment it is easier to switch
back to the synchronous method. Needs to be investigated later.
2013-10-29 13:04:44 +01:00
Patrick Ohly 1043dbf9eb PIM: accent-insensitive and transliterated search (FDO #56524)
Accent-insensitive search ignores accents, using the same code as in
EDS.  Transliterated search ignores foreign scripts by transliterating
search term and contact properties to Latin first. That one is using
ICU directly in the same way as EDS, but doesn't use the EDS
ETransliterator class to avoid extra string copying.

This commit changes the default behavior such that searching is by
default most permissive (case- and accent-insensitive, does
transliteration).  Flags exist to restore more restrictive matching.
2013-10-29 13:04:32 +01:00
Patrick Ohly 771ed318eb D-Bus: configure option for overriding default logging
By default, syncevo-dbus-server logs to syslog. This can be changed
with the new parameter of --enable-dbus-service. For example, this
changes the logging to DLT (must be available, or course):
  configure "--enable-dbus-server=--dlt --no-syslog"
2013-10-25 21:07:35 +01:00
Patrick Ohly e7a8f1b456 logging: support DLT (FDO #66769)
Diagnostic Log and Trace (DLT) manages a sequence of log messages,
with remote controllable level of detail. SyncEvolution optionally
(can be chosen at compile time and again at runtime) uses DLT instead
of its own syncevolution-log.html files.
2013-10-25 21:07:27 +01:00
Patrick Ohly 6e47a118da testing: allow building without client-test
The nightly testing always built client-test. When compiling
for EDS 3.6, we don't actually run any tests on the build platform,
so in that case it was not immediately possible to build client-test
(no cppunit installed). We could build it now, but there's simply
no need for it, so save the time and skip it.
2013-10-25 21:07:26 +01:00
Patrick Ohly db5f24e10d autotools: fix make error
Adding link flags to the libsyncevlution.la dependencies only works
for .la file. This started to break on Debian Testing (?) because
a -L<something> flag became a dependency.

A proper fix would be to set libs and dependencies separately,
but for now it is easier to rely on GNU make and filter for the
desired .la files.
2013-10-25 21:07:26 +01:00
Patrick Ohly 0a8c8ddb71 autotools: fix packaging of extra backends
They need to be part of the "make install" result for the nightly
testing, and to keep "make distcheck" working we also need to uninstall
them.
2013-10-25 21:07:26 +01:00
Patrick Ohly 317246c352 D-Bus: fix compiler warning
We unintentionally and unnecessarily included boost/signals.hpp instead of
boost/signals2.hpp, which started to trigger warnings with later versions of
boost.
2013-10-25 21:07:26 +01:00
Patrick Ohly abeefa3a4e EDS: remove redundant libebook-contacts dependency
This fixes compilation with EDS 3.6. libebook-contacts was needed
for a while when configuring address books directly. It is not needed
anymore because now we simply clone the system database.
2013-10-25 21:07:26 +01:00
Patrick Ohly 6c8dc7b194 ActiveSync: don't build Qt UI
The Qt UI no longer works with EDS >= 3.6. We don't need it, so
don't bother with it.
2013-10-25 21:07:26 +01:00
Patrick Ohly 34b0399cd5 autotools: cppunit is optional
The rewrite for non-recursive make made the cppunit utility mandatory.
This is too strict, it really isn't needed when both integration and
unit tests are disabled.

We still want the make variables set, though, if cppunit was found,
because then "make src/client-test" still works.
2013-10-25 21:07:26 +01:00
Patrick Ohly b3b0f3c7e1 EDS: support dual-install of ebook/ecal backends for EDS < 3.6 and EDS >= 3.6
The backends must be compiled differently for EDS < 3.6 (using the old
API before EBookClient, ECalClient and ESource, ideally in
compatibility mode) and for EDS >= 3.6 (using the new API, with hard
linking against libebook-1.2.so.14, libecal-1.2.so.15,
libedataserver-1.2.so.17).

With these changes, a SyncEvolution binary compiled for the older EDS
API will be able to load and use backends compiled against the current
one. Both backends can be installed in the same
lib/syncevolution/backends dir under different names. The newer ones
must have an additional -<version> appendix before the .so suffix.

Then loading will attempt to use those backends first and if
successful, skip the older ones. This is necessary because loading
both into the same process will fail due to symbol clashes. If
unsuccessful (as on systems with only the older EDS), the dynamic
linker will fail and SyncEvolution proceeds with the backends for the
old API.

Packaging of binaries as .dev/.rpm/.tar.gz includes these additional
backends if given in the EXTRA_BACKENDS variable when invoking "make
deb rpm distbin".
2013-10-25 21:07:26 +01:00
Patrick Ohly 4c962b3c49 EDS: improve EDS compatibility mode
The EDS backends for >= 3.6 failed to work property in SyncEvolution
binaries compiled for EDS < 3.6, because the EDS compatibility
layer reported "EDS not found" to the backend.

A backend that gets compiled without compatibility hacks doesn't
need the runtime check, because merely loading already guarantees
that the necessary libs were found. Therefore make the check
a compile-time define when compatibility mode is disabled.

A backend compiled with compatibility mode enabled then fails to load
in a binary compiled without because libsyncevolution.so does not
export the necessary symbols. That's actually desirable, because the
backend would not work anyway.
2013-10-25 21:07:18 +01:00
Patrick Ohly 7e655089e3 EDS: SYNCEVOLUTION_EBOOK_QUERY env variable
Setting the SYNCEVOLUTION_EBOOK_QUERY env variable to a valid EBook
query string limits the results to contacts matching that
query. Useful only in combination with --print-items or --export. Only
implemented for EDS >= 3.6.
2013-10-24 13:19:31 +01:00
Patrick Ohly ed1f1f4aa2 PIM: relax phone number matching
Previously, the current default country was used to turn phone numbers
without an explicit country code into full E164 numbers, which then
had to match the search term when doing a caller ID lookup.

This was inconsistent with EDS, where a weaker
EQUALS_NATIONAL_PHONE_NUMBER was done. The difference is that a
comparison between a number with country code matches one without if
the national number of the same, regardless of the current default
country. This is better because it reduces the influence of the hard
to guess default country on matching.

SyncEvolution also differed from EDS by doing a prefix comparison,
which in theory might have also ignored differences caused by
extensions. It is uncertain whether that was useful, so for the sake
of consistency, a full number comparison of the national number is now
done.

Another advantage of this change is the lower memory consumption and
faster comparison, because strings are now stored in 4 + 8 byte
numbers instead of strings of varying length.
2013-10-24 13:19:31 +01:00
Patrick Ohly c472fd0af6 testing: ignore fontconfig issue
Started to appear on Debian Testing after the Wheezy release.
2013-10-24 13:19:31 +01:00
Patrick Ohly 1260a702f4 glib: prevent accidental usage of PlainGStrArray []
The array operator happens to work on some platforms, but not others
(see previous commit). Make it private without an implementation to
catch the undesired usage of it on platforms whether the code would
happen to work otherwise.
2013-10-18 09:58:28 +02:00
Patrick Ohly dd61308c67 EDS: fix compile problem with boost and EDS > 3.36
This fixes the following problem, seen with Boost 1.53.0 on altlinux
when compiling for EDS >= 3.6:

/usr/include/boost/smart_ptr/shared_ptr.hpp: In instantiation of 'typename boost::detail::sp_array_access<T>::type boost::shared_ptr<T>::operator[](std::ptrdiff_t) const [with T = char*; typename boost::detail::sp_array_access<T>::type = void; std::ptrdiff_t = long int]':
src/backends/evolution/EvolutionSyncSource.cpp:163:38: required from here
/usr/include/boost/smart_ptr/shared_ptr.hpp:663:22: error: return-statement with a value, in function returning 'void' [-fpermissive]
make[2]: *** [src/backends/evolution/src_backends_evolution_syncecal_la-EvolutionSyncSource.lo]

The "void" type above is wrong, so it looks like a missing type trait
for the pointer type used in the smart_ptr. PlainGStrArray already had
an at() method to work around such issues, so use it. Not sure why this
one usage of [] slipped through.
2013-10-18 09:58:28 +02:00
Patrick Ohly 10de41f262 NEWS: typo fix 2013-10-18 09:58:28 +02:00
Patrick Ohly 5267926a04 autotools, NEWS: SyncEvolution 1.3.99.5 2013-10-01 12:09:18 +02:00
Patrick Ohly 9d1b079750 GTK/GTK3 UI: fix crash on 64 bit
While running a sync with a binary compiled with -fPIE -pie, a crash
in strlen() occured because a 64 bit string pointer coming from D-Bus
was incorrectly passed through a 32 bit unsigned variable.

These special compile flags merely caused the problem to occur
reliably, it may also have crashed under other circumstances.

Kudos to Tino Keitel for reporting the problem and identifying the
relation to the compile flags.
2013-10-01 09:28:39 +02:00
Patrick Ohly 5a0f5a9793 GTK/GTK3 UI: fix crash when a sync runs while no service is selected
Running a sync while the UI had no service selected caused a crash in
find_updated_source_progress() because the code dereferences the NULL
prog_data->data->current_service pointer. Affected both the GTK2 and
GTK3 UI.

Fix it by checking for NULL and not doing anything if NULL.
2013-10-01 09:28:39 +02:00
Patrick Ohly f9f6eda294 autotools: compile client-test with -g by default
When compiling source files of client-test, use -g as default CXXFLAGS
instead of the "-g -O2" that autotools normally picks.  That speeds up
compilation significantly (on some platforms, gcc can't deal with the
many templates in ClientTest.cpp well) and leads to more useful
executables (suitable for interactive debugging) even when the rest of
the code gets optimized.

Explicitly specifying CXXFLAGS still overrides this per-target
default.

This feature depends on GNU make. A configure check is in place
to disable it when not using GNU make.
2013-10-01 09:28:39 +02:00
Patrick Ohly 9edf97bd2b GNOME: work around GNOME keyring communication problem
It seems that sometimes setting up a session with GNOME keyring fails such
that all further communication leads to decoding problem.

There is an internal method to reset the session, but it cannot be called
directly. As a workaround, fake the death of the GNOME keyring daemon
and thus trigger a reconnect when retrying the GNOME keyring access.
2013-10-01 09:28:39 +02:00
Patrick Ohly 02bd2f3a2d GNOME: clean up keyring access
This drops the support for libgnome-keyring < 2.20, because older
versions did not have the error->text conversion method which is now
used in revised error and log messages.

This code also adds a retry loop around reading/writing passwords.
This was meant to work around these intermittent Gkr errors:

Gkr: received an invalid, unencryptable, or non-utf8 secret
Gkr: call to daemon returned an invalid response: (null).(null)()

These lead to an "Error communicating with gnome-keyring-daemon" status
code from libgnome-keyring.

However, once the error occurred in a process, it persists for at least
two seconds, possibly forever. Therefore the retry loop is not enabled.
2013-10-01 09:28:39 +02:00
Patrick Ohly 5e530e9c54 testing: cover owndrive.com = OwnCloud
This enables interoperability testing with owndrive.com, a hosted OwnCloud
provider. owndrive.com was chosen because a user picked it and support was
able to help with some problems. It's also a bit simpler than running OwnCloud
ourselves. But it may also be slower, so perhaps ultimately a local
installation will be needed.
2013-10-01 09:28:39 +02:00
Patrick Ohly 046d4c31a9 testing: cover Google CardDAV
This adds testing of Google Contacts syncing via CardDAV. It passes
only thanks to the simplified EDS contacts test cases, with one exception:
removing extensions is known to fail because the server keeps them even
when receiving an update without them.
2013-10-01 09:28:39 +02:00
Patrick Ohly ed19df3c6f WebDAV: support Google CardDAV, break Yahoo
Google CardDAV has one peculiarity: it renames new contacts during PUT without
returning the new path to the client. See also
http://lists.calconnect.org/pipermail/caldeveloper-l/2013-July/000524.html

SyncEvolution already had a workaround for that (PROPGET on old path, extract
new path from response) which happened to work. This workaround was originally
added for Yahoo, which sometimes merges contacts into existing ones. In
contrast to Yahoo, Google really seems to create new items.

Without some server specific hacks, the client cannot tell what happened.
Because Google is currently supported and Yahoo is not, let's change the
hard-coded behavior to "renamed items are new".
2013-10-01 09:28:39 +02:00
Patrick Ohly bdb0cd195a testing: ignore URL encoding issue in Google CardDAV
Google unnecessarily escapes the colon with a backslash, which
breaks the URL during a full rountrip sync.
2013-10-01 09:28:39 +02:00
Patrick Ohly cc8cb80398 testing: Google CardDAV + NOTE folding + colon escaping
Google CardDAV parser/encoder swallows white spaces, possibly because
of the differences between vCard 2.1 and 3.0. It also escapes the colon
although it shouldn't.

Google is looking into this, so I am not trying to work out a workaround and
merely remove the problematic fields (mostly NOTEs and one URL) to get the
tests to pass.
2013-10-01 09:28:39 +02:00
Patrick Ohly 3c5ea7e956 testing: Google CardDAV + NOTE + CHARSET
An explicit CHARSET parameter causes the Google CardDAV server to drop
the NOTE, even if the charset is UTF-8. Removing this know problem from
the test set because it shouldn't happen in practice.
2013-10-01 09:28:39 +02:00
Patrick Ohly 8a1f1f4139 testing: Google CardDAV does not support several properties
CALURI, CATEGORIES, FBURL, GEO and ROLE are not supported by
the server and dropped. Of ORG, only the first two components
are supported.
2013-10-01 09:28:39 +02:00
Patrick Ohly 102c90d70c testing: preserve XDG dirs if located inside builddir
The nightly testing configures some platforms such that
XDG_CONFIG/DATA/CACHE_HOME are inside the build dir. It also populates these
dirs with files (for example, GNOME Online Accounts) which must survive all
cleaning of these directories.

Long term it would be better to separate test files from build files,
but that's a task for some other time...
2013-10-01 09:28:39 +02:00
Patrick Ohly beb7f77d2f testing: avoid output on stdout
When running a command with dbus-session.sh, all additional
output should got to stderr. That keeps stdout available for output
from the command (like "syncevolution --print-databases") without
getting poluted by something else.

This extra output also showed up in the nightly tests reports.
2013-10-01 09:28:39 +02:00
Patrick Ohly ec9de82a7d SyncContext: use AuthProvider
When running a local sync, the syncURL/username/password are not meant
for the sync and cannot be used if they refer to an AuthProvider which
cannot return plain username/password.

In all other cases, this may or may not work, so at least try it instead
of hard-coding the IdentityProviderCredentials.
2013-10-01 09:28:38 +02:00
Patrick Ohly 8f3f6130ab GOA: get OAuth2 tokens out of GNOME Online Accounts
"username = goa:..." selects an account in GOA and retrieves the
OAuth2 token from that.

The implementation uses the GOA D-Bus API directly, because our C++
D-Bus bindings are easier to use and this avoids an additional library
dependency.
2013-10-01 09:28:38 +02:00
Patrick Ohly 582025171d testing: remove timeout= parameters from D-Bus method calls
These became redundant after patching the bus object to set such
a timeout by default.
2013-10-01 09:28:38 +02:00
Patrick Ohly 3458d61164 D-Bus testing: default timeout -> infinite
It is highly annoying that D-Bus method calls (synchronous and
asynchronous!) time out fairly quickly (a few minutes) when doing
interactive debugging of syncevo-dbus-server.

Traditionally, every single method call had to be made with
timeout=<some high value>, which made the test code unnecessarily
larger and often was forgotten.

Now all method calls via the session bus connection are done with a
high timeout if none was set by the caller. This is achieved by
wrapping the default (internal?) method send methods on the bus object
with versions which add that timeout. This should be safe, because
these methods are part of the public D-Bus Python API.
2013-10-01 09:28:38 +02:00
Patrick Ohly 83c515b950 SyncContext: use SimpleUserInterface without keyring access
Code-refactoring, the default user interface has the same functionality
as our dummy one if told to not use keyrings.
2013-10-01 09:28:38 +02:00
Patrick Ohly 12f3545e4f UserInterface: provide simple default implementation
A default implementation for optional, read-only access to the keyrings.
2013-10-01 09:28:38 +02:00
Patrick Ohly 8b391dbb79 D-Bus server: password not stored in GNOME keyring or KWallet (FDO #66110)
When clients like the GTK sync-ui stored a password, it was always
stored as plain text in the config.ini file by the
syncevo-dbus-server. The necessary code for redirecting the password
storage in a keyring (GNOME or KWallet) simply wasn't called in that
case.

The command line tool, even when using the D-Bus server to run the
operation, had the necessary code active and thus was not affected.
2013-10-01 09:28:38 +02:00
Patrick Ohly 115137b8b4 templates: don't store username/password for SyncEvolution client
The client template is also used in cases where passwords are not
needed (local sync) and where passwords cannot be stored in a keyring
due to the missing syncURL/remoteDeviceID. Therefore don't set dummy
username/password values in the template.
2013-10-01 09:28:38 +02:00
Patrick Ohly 3f19af6a54 Cmdline: add missing password lookup
When configuring a new peer and looking for databases, we need the
database password of an already existing source config, otherwise the
lookup will fail if that password is hidden in a keyring.
2013-10-01 09:28:38 +02:00
Patrick Ohly 584210b94a testing: ignore GNOME keyring problems
Some new resp. slightly different sightings of leaks involving
the GNOME keyring. Came up after using the keyring more often.
2013-10-01 09:28:38 +02:00
Patrick Ohly e85cca1912 config: revise default of the "keyring" property
The command line tool in --daemon=no mode did not use the GNOME
keyring or KWallet even if the syncevo-dbus-server did, leading
to failing test cases when actually starting to use it by default
there.

Now all components use the same default: use safe password storage if
any was enabled during compilation, don't use if not.

This also makes SyncEvolution work without user intervention on
systems without a password storage.
2013-10-01 09:28:38 +02:00
Patrick Ohly e18360d896 GNOME: add debug messages for GNOME Keyring
Makes it easier to determine whether GNOME Keuring is used.
2013-10-01 09:28:38 +02:00
Patrick Ohly b211506711 KDE: add debug messages around KWallet
Makes it easier to determine whether KWallet is used.
2013-10-01 09:28:38 +02:00
Patrick Ohly 7808af7c46 logging: debug output for password handling
Figuring out where credentials come from became harder. These debug
messages help. Perhaps they should even be logged as INFO messages
such that normal users can see them?
2013-10-01 09:28:37 +02:00
Patrick Ohly 471842e767 signon: README and example Google accounts files
The README explains how to use Google CalDAV/CardDAV together with
the example accounts config files.
2013-10-01 09:28:29 +02:00
Patrick Ohly c531017185 signon: new backend using libgsignond-glib + libaccounts-glib
The code works with gSSO (https://01.org/gsso). With some tweaks to
the configure check and some ifdefs it probably could be made to work
with Ubuntu Online Accounts.

The code depends on an account accessible via libaccounts-glib which
has a provider and and (optionally) services enabled for that
provider. It is not necessary that the account already has a signon
identity ID, the backend will create that for the provider (and thus
shared between all services) if necessary.

Therefore it is possible to use the ag-tool to create and enable the
account and services. Provider and service templates are in the next
commit.
2013-09-27 08:59:14 -07:00
Patrick Ohly 2102cca90b WebDAV: support OAuth2
If given an AuthProvider which can handle OAuth2, then OAuth2 is
used instead of plain username/password authentication.

Obtaining the OAuth2 token must be done at a point where we can still
abort the request. If obtaining the token fails, then this should be
considered a fatal error which aborts scanning for resources. Other
errors cause the current URL to be skipped while scanning continues.

This commit moves the "execute request" functionality back into the
Neon::Session class, because that is where most of the logic (retry
request?) and state is (access tokens which persist across requests).
2013-09-27 08:59:14 -07:00
Patrick Ohly 306e4c042d WebDAV: testing a WebDAV source depends on password lookup
This becomes relevant once passwords are actually stored in
a keyring.
2013-09-27 08:59:14 -07:00
Patrick Ohly 83768d41ae config: add identity provider registry
Similar to the RegisterSyncSource concept, but trimmed down:
- virtual method creates instances
- keys have to be unique
2013-09-27 08:59:14 -07:00
Patrick Ohly 5d9aa1ac85 config: introduce AuthProvider
AuthProvider is the instance created by specific IdentityProvider
backends which then hands out username/password credentials or OAuth2
bearer tokens.
2013-09-27 08:59:14 -07:00
Patrick Ohly 526723acf5 config: first step towards modular identity providers
Let the conversion to username+password be handled by the
IdentityProvider module.
2013-09-27 08:59:14 -07:00
Patrick Ohly c47183685a D-Bus testing: test indirect password lookup
Only password must get mirrored from credentials config, username must
stay the same.
2013-09-27 08:59:14 -07:00
Patrick Ohly 7a28f3664c config: selectively resolve username during indirect credential lookup
The real username is only relevant when running a sync. When looking
at a config with a D-Bus client like the GTK UI, the username should
always be "id:<config>", to avoid accidentally removing the
indirection, while the password should be the real one, to allow the
user to edit like he normally would with passwords stored in a
keyring.

To achive this, overriding the username must be suppressed when
resolving as part of the D-Bus config API. While at it, move the
entire "iterate over properties" into a common utility function in
PasswordConfigProperty.
2013-09-27 08:59:14 -07:00
Patrick Ohly 1ab5aeac8d SyncConfig: implement "id" handling for reading and writing credentials
save/checkPassword both know how to handle the "id" provider now.
2013-09-27 08:59:13 -07:00
Patrick Ohly efd6b2aebf ConfigPasswordKey: add toString()
Will be used for debugging messages.
2013-09-27 08:59:13 -07:00
Patrick Ohly 4f423bbf4e GNOME keyring: prevent empty "server" key in password lookup
Storing a password with just "user=foo" as lookup attributes is problematic
because it is too unspecific. Different services or configs with the same
user, but different passwords end up overwriting each other's passwords. In
practice, the config with "user=foo" even had the effect of removing the entry
for "user=foo server=bar".

The situation can be avoided by using the remotePeerId as fallback when the
syncURL is empty. There is a (minor?) risk that some configs were stored
in the past without that additional key and now won't be found anymore in the
keyring. Users need to re-set such passwords.

If an attempt is made to store a password with insufficient lookup attributes,
GNOME keyring will now reject the attempt.
2013-09-27 08:59:13 -07:00
Patrick Ohly e5bc0a6cd4 config: avoid empty server key during password lookup in keyring
Empty server strings cause problems with GNOME keyring. Removing an
entry with the same user name and a server string has been observed in
practice.
2013-09-27 08:59:13 -07:00
Patrick Ohly 19079c4999 config: reuse existing node and tree instances
When instantiating multiple SyncConfig instances, it is important that
they share filter nodes and the underlying tree, because the nodes
store copies of already retrieved credentials (lookup shall only be
done once!) and the trees represent the current content of the config
(which must be consistent when making changes).

Currently the new code is not thread-safe, but nor are nodes and trees,
so a lot more work would be needed to make this safe. Instead we avoid
concurrency.
2013-09-27 08:59:13 -07:00
Patrick Ohly 2b92db7c1f SyncConfig: do not rely on creating of empty config during test
SyncConfigTest::normalize() only passed because FileConfigTree accidentally
created the "peers" directory inside the peer. That will change, so don't rely
on that. Instead ensure that the config.ini file of the peers gets written
because it contains something.
2013-09-27 08:59:13 -07:00
Patrick Ohly 401de08d5e SyncContext: avoid caching config tree for entire duration of client-test
Instantiating LogDirTest used to create a SyncContext and use that as logger
for the entire duration of testing inside client-test, even when not running
LogDirTest tests at all. This is undesirable and together with caching of the
config tree while in use, broke some other tests (EvolutionCalendarTest)
because obsolete DB names were shared.

It is better to create the context during setUp() and remove it in tearDown().
2013-09-27 08:59:13 -07:00
Patrick Ohly ba5eaccef9 config: refactor root path handling
The previous approach made FileConfigTree more complex than necessary.
Having an abstract ConfigTree::getRootPath() with undefined behavior
is bad design.

The code was had undesiredable side effects: inside a peer config,
another "peers" directory was created because FileConfigTree didn't
know whether creating that dir was required or not.

Now all of the complexity is in SyncConfig, which arguably knows
better what the tree stands for and how to use
it.
2013-09-27 08:59:13 -07:00
Patrick Ohly 37b03d5e8d SyncConfig: simplify password API
In practice, the methods are always called for a specific SyncConfig.
Passing that allows removing several other parameters and, more
importantly, also grants access to the config and through that other
configs. This will be needed for the indirect credential lookup.
2013-09-27 08:59:13 -07:00
Patrick Ohly c1808f72aa SyncSourceConfig: remove obsolete password methods
Not used, the per-source password operations are done via the
ConfigProperty interface.
2013-09-27 08:59:13 -07:00
Patrick Ohly 4c52378ec3 config: user name -> identity
"username", "proxyUsername" and "databaseUser" used to be simply a
string containing the name of the respective user or (in the case of
the ActiveSync backend) the account ID in gconf.

Now it is also possible to provide credentials (username + password)
indirectly: when any of these properties is set to "id:<config name>",
then the "username/password" properties in that config are used
instead. This is useful in particular with WebDAV, where credentials
had to be repeated several times (target config, in each database when
used as part of SyncML) or when using a service which requires several
configs (Google via SyncML and CalDAV).

For user names which contain colons, the new "user:<user name>" format
must be used. Strings without colons are assumed to be normal user
names.

This commit changes the SyncConfig APIs for this extension. More work
is needed to make the indirect lookup via "id" functional.
2013-09-27 08:59:13 -07:00
Patrick Ohly 7fa64a040c SyncConfig: remove obsolete caching of passwords
Passwords are cached after the initial check as temporary property
values. The explicit string members are obsolete and can be removed
together with the code using them.
2013-09-27 08:59:12 -07:00
Patrick Ohly d0f2c61b95 testing: ignore GIO socket leak introduced by GNOME 3.8
The leak started showing up after switching to GNOME 3.8, independent
of any change in SyncEvolution. Looks like a bug in GNOME. I tried
to debug it, but gave up because it seems to be timing dependent such
that the error path was not triggered when running without valgrind.
2013-09-27 08:59:12 -07:00
SyncEvolution Nightly Testing 43382e5f44 PIM testing: fix test for sync running longer than auto shutdown period
Somehow an intermediate version ended up in the master branch. It
broke TestContacts.
2013-09-04 16:49:48 +02:00
Patrick Ohly b9ee14622a PIM: fix D-Bus timeout problem in sync.py
Using asynchronous method calls did not eliminate the default timeout,
as expected. In particular, SyncPeer() still timed out when syncing many
contacts.

Instead set up all necessary parameters (= callbacks and now also a
long timeout) in a hash and pass that to all D-Bus method calls. It's
less code duplication, too.
2013-09-04 11:12:06 +02:00
Patrick Ohly e6e48ce7f0 PIM: fix UID usage in sync.py example
Using the underscore in the UID has been wrong all along, it only
happened to work because UID sanity checking was missing. After adding
it, the example broke.

Now simply remove the colon. It makes the UID less readable, but it
doesn't have to be, and ensures that file names and database names
contain the UID as-is.
2013-09-04 11:12:06 +02:00
Patrick Ohly 00a13c1307 PBAP: include README in source distribution 2013-09-04 11:12:06 +02:00
Patrick Ohly 928cff942b PBAP: do not end Bluez5 transfer prematurely
A transfer was marked as finished prematurely when encountering the
"active" Status value, which can happen for longer transfers.
2013-09-04 11:12:06 +02:00
Patrick Ohly 1a4d9fd06f testing: make testSession3 reliable again, finish server startup change
The "D-Bus testing: don't depend on server output during startup, truely quiet
TEST_DBUS_QUIET" change broke TestFileNotify.testSession3: because the test
started after syncevo-dbus-server obtained the bus name and before the server
could finish its startup (which test-dbus.py previously waited for by waiting
for the server's output), the executable was touched too soon and the server
often didn't notice that it had to shut down.

This inherent race condition can't be fixed, but in reality it should be a lot
rarer (not happening at all?) than in testing. Therefore fix testing by having
test-dbus.py wait for a response from syncevo-dbus-server (which implies that
it is done with its startup) before starting the test.

This actually applies to all three ways of starting syncevo-dbus-server (with
gdb, with and without logging), so now all of them use the same code.
2013-09-04 11:11:54 +02:00
Patrick Ohly 83dcba8486 autotools: fix race condition related to src/dbus/interfaces docs
Only saw this once in nightly testing and couldn't reproduce it:

$ make -j 16
perl /data/runtests/work/sources/syncevolution/src/syncevo/readme2c.pl
    /data/runtests/work/sources/syncevolution/README.rst
    >src/syncevo/CmdlineHelp.c
/usr/bin/xsltproc -o src/dbus/interfaces/syncevo-server-doc.xml
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/spec-to-docbook.xsl
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/syncevo-server-full.xml
/usr/bin/xsltproc -o src/dbus/interfaces/syncevo-connection-doc.xml
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/spec-to-docbook.xsl
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/syncevo-connection-full.xml
/usr/bin/xsltproc -o src/dbus/interfaces/syncevo-session-doc.xml
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/spec-to-docbook.xsl
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/syncevo-session-full.xml
/usr/bin/glib-genmarshal
    /data/runtests/work/sources/syncevolution/src/dbus/glib/syncevo-marshal.list
    --header --prefix=syncevo_marshal > src/dbus/glib/syncevo-marshal.h
runtime error
xsltApplyStylesheet: saving to src/dbus/interfaces/syncevo-session-doc.xml may
    not be possible
/usr/bin/xsltproc -o src/dbus/glib/syncevo-server.xml
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/spec-strip-docs.xsl
    /data/runtests/work/sources/syncevolution/src/dbus/interfaces/syncevo-server-full.xml
runtime error
xsltApplyStylesheet: saving to src/dbus/interfaces/syncevo-server-doc.xml may
    not be possible
make: *** [src/dbus/interfaces/syncevo-server-doc.xml] Error 9
make: *** Deleting file `src/dbus/interfaces/syncevo-server-doc.xml'
make: *** Waiting for unfinished jobs....
make: *** [src/dbus/interfaces/syncevo-session-doc.xml] Error 9
make: *** Deleting file `src/dbus/interfaces/syncevo-session-doc.xml'

Looks like multiple xsltproc commands ran in parallel and then stepped on each
others toes while creating the src/dbus/interfaces directory, which does not
exist after an out-of-tree configure.

To address the issue, serialize creating that directory by having make create
it as a prerequisite.
2013-09-04 11:09:34 +02:00
Patrick Ohly 115a71e670 testing: fix Exchange eds_contact:testItems
Since the "EDS contacts: avoid unnecessary DB writes during slow sync due to
FILE-AS" change, eds_contact::testItems failed because the "bday;special UTC
offset" (specific to Exchange testing) test user had no FILE-AS set, while the
one eventually stored in EDS had (because of the slow sync patch). Using EDS
3.8 probably would have triggered the same issue.

Fixing this by adding the FILE-AS property to the reference data. This is
a hard requirement now for tests to pass with EDS.
2013-09-04 11:09:21 +02:00
Patrick Ohly 23afceee94 testing: ignore GNOME keyring leak also for other operations
Recently the same error showed up also with a gnome_keyring_find_* function
in the backtrace. Ignore that, too.
2013-09-04 11:08:52 +02:00
Patrick Ohly 5e4a04e3d6 PIM testing: test for sync running longer than auto shutdown period
This test runs with an artificially low auto shutdown period (set via
a modified run() method) and a delayed sync.
2013-09-04 11:08:02 +02:00
Patrick Ohly 0fcf21ef3a D-Bus server: if busy, don't shut down
While there are sessions pending or active, the server should not shut down.
It did that while executing a long-running PIM Manager SyncPeer() operations,
by default after 10 minutes.

This was not a problem elsewhere because other operations are associated with
a client, whose presence also prevents shutdowns. Perhaps PIM Manager should
also track the caller and treat it like a client.
2013-09-04 11:08:02 +02:00
Patrick Ohly 73fa7512a5 D-Bus testing: D-Bus method call timeouts
Add unlimited timeout to some more method calls to allow interactive
debugging.
2013-09-04 11:06:38 +02:00
Patrick Ohly a882bc7e90 glib: SYNCEVO_GLIB_CALL_SYNC() must use GRunWhile()
Like everything else that waits for a certain event on the main loop,
SYNCEVO_GLIB_CALL_SYNC() should also better use GRunWhile(). This is
necessary to be usable in threads.
2013-09-04 11:05:47 +02:00
Patrick Ohly 932e3ee80b D-Bus testing: fix testSyncFailure2
With the [INFO] line always coming first, the check for which error
came first broke.
2013-08-05 08:08:35 +02:00
Patrick Ohly b7fa64f15c signon: revert accidental inclusion in master branch
The code wasn't ready and got pushed as part of some other change.
2013-08-02 22:02:03 +02:00
Patrick Ohly c0212c4585 PBAP: add support for obexd 0.48
obexd 0.48 is almost the same as obexd 0.47, except that it dropped
the SetFilter and SetFormat methods in favor of passing a Bluex 5-style
filter parameter to PullAll.

SyncEvolution now supports 4, in words, four different obexd
APIs. Sigh.
2013-08-02 16:37:01 +02:00
Patrick Ohly a6b8eea548 signon: README and example Google accounts files
The README explains how to use Google CalDAV/CardDAV together with
the example accounts config files.
2013-08-02 13:17:02 +02:00
Patrick Ohly f0254a30bb singon: new backend using libgsignond-glib + libaccounts-glib
The code works with gSSO (https://01.org/gsso). With some tweaks to
the configure check and some ifdefs it probably could be made to work
Ubuntu Online Accounts.

The code depends on an account accessible via libaccounts-glib which
has a provider and and (optionally) services enabled for that
provider. It is not necessary that the account already has a signon
identity ID, the backend will create that for the provider (and thus
shared between all services) if necessary.

Therefore it is possible to use the ag-tool to create and enable the
account and services. Provider and service templates are in the next
commit.
2013-08-02 13:16:11 +02:00
Patrick Ohly 3de6da6022 WebDAV: support OAuth2
If given an AuthProvider which can handle OAuth2, then OAuth2 is
used instead of plain username/password authentication.

Obtaining the OAuth2 token must be done at a point where we can still
abort the request. If obtaining the token fails, then this should be
considered a fatal error which aborts scanning for resources. Other
errors cause the current URL to be skipped while scanning continues.

This commit moves the "execute request" functionality back into the
Neon::Session class, because that is where most of the logic (retry
request?) and state is (access tokens which persist across requests).
2013-08-02 13:15:33 +02:00
Patrick Ohly 7fdd878bc1 config: add identity provider registry
Similar to the RegisterSyncSource concept, but trimmed down:
- virtual method creates instances
- keys have to be unique
2013-08-02 13:15:27 +02:00
Patrick Ohly 03efa0c44d config: introduce AuthProvider
AuthProvider is the instance created by specific IdentityProvider
backends which then hands out username/password credentials or OAuth2
bearer tokens.
2013-08-02 13:15:27 +02:00
Patrick Ohly 80e68a747a config: first step towards modular identity providers
Let the conversion to username+password be handled by the
IdentityProvider module.
2013-08-02 13:15:27 +02:00
Patrick Ohly a8080b8e39 D-Bus testing: test indirect password lookup
Only password must get mirrored from credentials config, username must
stay the same.
2013-08-02 13:15:26 +02:00
Patrick Ohly 97863d3b7e config: selectively resolve username during indirect credential lookup
The real username is only relevant when running a sync. When looking
at a config with a D-Bus client like the GTK UI, the username should
always be "id:<config>", to avoid accidentally removing the
indirection, while the password should be the real one, to allow the
user to edit like he normally would with passwords stored in a
keyring.

To achive this, overriding the username must be suppressed when
resolving as part of the D-Bus config API. While at it, move the
entire "iterate over properties" into a common utility function in
PasswordConfigProperty.
2013-08-02 13:15:26 +02:00
Patrick Ohly c3fdf439da SyncConfig: implement "id" handling for reading and writing credentials
save/checkPassword both know how to handle the "id" provider now.
2013-08-02 13:15:26 +02:00
Patrick Ohly d2a4164668 SyncConfig: allow sharing file config tree between configs
A SHARED_LAYOUT config tree caches config nodes. Allow a second config
to use those same nodes as an already existing config. This will be
useful in combination with indirect password lookup, because then the
credentials can be stored as temporary property values and be reused
when used multiple times in a process (for example, by CardDAV and by
CalDAV).
2013-08-02 13:15:20 +02:00
Patrick Ohly d9f87251c0 SyncConfig: simplify password API
In practice, the methods are always called for a specific SyncConfig.
Passing that allows removing several other parameters and, more
importantly, also grants access to the config and through that other
configs. This will be needed for the indirect credential lookup.
2013-08-02 13:15:14 +02:00
Patrick Ohly 1131379cc5 SyncConfig: allow access to ConfigTree
This will be needed to access other configs in the indirect password
lookup.
2013-08-02 13:15:13 +02:00
Patrick Ohly 059bb0bd6f SyncSourceConfig: remove obsolete password methods
Not used, the per-source password operations are done via the
ConfigProperty interface.
2013-08-02 13:15:13 +02:00
Patrick Ohly 5ff97dea44 config: user name -> identity
"username", "proxyUsername" and "databaseUser" used to be simply a
string containing the name of the respective user or (in the case of
the ActiveSync backend) the account ID in gconf.

Now it is also possible to provide credentials (username + password)
indirectly: when any of these properties is set to "id:<config name>",
then the "username/password" properties in that config are used
instead. This is useful in particular with WebDAV, where credentials
had to be repeated several times (target config, in each database when
used as part of SyncML) or when using a service which requires several
configs (Google via SyncML and CalDAV).

For user names which contain colons, the new "user:<user name>" format
must be used. Strings without colons are assumed to be normal user
names.

This commit changes the SyncConfig APIs for this extension. More work
is needed to make the indirect lookup via "id" functional.
2013-08-02 13:15:13 +02:00
Patrick Ohly 56ac0812a4 SyncConfig: remove obsolete caching of passwords
Passwords are cached after the initial check as temporary property
values. The explicit string members are obsolete and can be removed
together with the code using them.
2013-08-02 13:15:13 +02:00
Patrick Ohly 193ef1e534 glib: SYNCEVO_GLIB_CALL_SYNC() must use GRunWhile()
Like everything else that waits for a certain event on the main loop,
SYNCEVO_GLIB_CALL_SYNC() should also better use GRunWhile(). This is
necessary to be usable in threads.
2013-08-02 13:15:13 +02:00
Patrick Ohly 0a8b3f1f48 D-Bus server: password not stored in GNOME keyring or KWallet (FDO #66110)
When clients like the GTK sync-ui stored a password, it was always
stored as plain text in the config.ini file by the
syncevo-dbus-server. The necessary code for redirecting the password
storage in a keyring (GNOME or KWallet) simply wasn't called in that
case.

The command line tool, even when using the D-Bus server to run the
operation, had the necessary code active and thus was not affected.
2013-08-02 13:15:13 +02:00
Patrick Ohly 8bc48fd7d8 PBAP: compile fix for "PBAP: transfer data inside ReadItemAsKey"
uint16 happened to work when compiling with a recent GNOME stack, but
without that uint16 is not defined. The right approach is to use
stdint.h and uint16_t.
2013-07-25 11:19:03 +02:00
Patrick Ohly 94ab0a279a NEWS, autotools: SyncEvolution 1.3.99.4 2013-07-12 16:19:53 +02:00
Guido Günther 85fca61913 build: use top_builddir instead of builddir
when building syncevo-local-sync. Maemo's old automake doesn't now
about builddir.

This only fixes the one occurence relevant to Maemo.
2013-07-12 16:18:12 +02:00
Guido Günther f65d91e132 build: Split autoreconf options
maemo's Scratchbox autoreconf chokes on the combined ones
2013-07-12 16:18:12 +02:00
Patrick Ohly 8694f06fb2 D-Bus testing: fix race in TestCmdline.testSyncFailure2
We used to kill it when it showed the first sign of life via D-Bus log output
- any output! Depending on timing, it may or may not have been able to send
the "target side ready" INFO message. If it did, our strict output check
failed.

Fix that by waiting for that message, which should be the only INFO message
and thus the only one which will appear in the output text, before killing the
process.
2013-07-12 11:44:39 +02:00
Patrick Ohly 924a8a7dd3 D-Bus testing: fix TestLocalCache.testPropertyRemovalIncremental100 name 2013-07-12 11:44:39 +02:00
Patrick Ohly c16f1b0756 sync: avoid maintaining suspend/resume meta data during ephemeral sync
Both maintaining the map items inside the Synthesis engine and storing
them in .ini hash config nodes inside SyncEvolution are fairly heavy
operations which are not needed at all during an ephemeral sync (= no
meta data stored, done by the PIM Manager when triggering a pure PBAP
sync).

Using the new Synthesis CA_ResumeSupported DB capability it is
possible to suppress these operations without having to fiddle with
the Synthesis DB API that SyncEvolution provides. To make it possible
at the DB layer to detect that the meta data is not needed, the
ConfigNode passed to it must be marked as volatile.

This change sped up a sync with 10000 unmodified, known items from 38s
to 23s.
2013-07-12 11:44:39 +02:00
Patrick Ohly 5aec08d12c SyncSourceConfig: cache synthesisID
The synthesisID value is required for each Synthesis source progress
event, which can be fairly frequent (more than one per item). Instead
of going down to the underlying .ini config node each time, cache the
value in the SyncSourceConfig layer.
2013-07-12 11:44:39 +02:00
Patrick Ohly a05197891f sync: reduce D-Bus traffic
Syncing was slowed down by fowarding all log messages from the local
sync helper to its parent and from the D-Bus helper to
syncevo-dbus-server. Quite often, the log messages then were simply
discarded by the recipient. To speed up syncing, better filter at the
source.

The syncevo-dbus-helper is told which messages are relevant by
forwarding the syncevo-dbus-server "D-Bus log level" command line
setting to the helper process as part of its argv parameters.

The synevo-local-sync helper applies its own log level now also to the
messages sent to the parent. This ensures that messages stored in the
client log also show up in the parent log (unless the parent has more
restrictive settints, which is uncommon) and that INFO/SHOW messages
still reach the user.
2013-07-12 11:44:39 +02:00
Patrick Ohly b34d56482e sync: less verbose output, shorter runtime
For each incoming change, one INFO line with "received x[/out of y]"
was printed, immediately followed by another line with total counts
"added x, updated y, removed z". For each outgoing change, a "sent
x[/out of y]" was printed.

In addition, these changes were forwarded to the D-Bus server where a
"percent complete" was calculated and broadcasted to clients. All of
that caused a very high overhead for every single change, even if the
actual logging was off. The syncevo-dbus-server was constantly
consuming CPU time during a sync when it should have been mostly idle.

To avoid this overhead, the updated received/sent numbers that come
from the Synthesis engine are now cached and only processed when done
with a SyncML message or some other event happens (whatever happens
first).

To keep the implementation simple, the "added x, updated y, removed z"
information is ignored completely and no longer appears in the output.

As a result, syncevo-dbus-server is now almost completely idle during
a running sync with no log output. Such a sync involving 10000 contacts
was sped up from 37s to 26s total runtime.
2013-07-12 11:43:40 +02:00
Patrick Ohly f2378b7909 ForkExec: allow passing arguments to helper
The optional args array will be used when executing the helper
executable.
2013-07-11 11:40:51 +02:00
Patrick Ohly a69018e6da D-Bus testing: don't depend on server output during startup, truely quiet TEST_DBUS_QUIET
When asked to run quietly via a non-empty TEST_DBUS_QUIET,
test-dbus.py still enabled INFO messages to determine that the server
is ready. Waiting for bus name (as already done when starting with a
debugger) avoids that and allows us to disable all LogOutput signals.
2013-07-10 15:37:37 +02:00
Patrick Ohly 0a3ec71e92 PIM testing: include testcase from FDO #66618
Ordering of 鳥 = niǎo before 女性 = nǚ xìng depends on the right
env variables. It works in this test.
2013-07-10 13:08:02 +02:00
Patrick Ohly 4577c27fda HTTP server: handle message resends
If a client gave up waiting for the server's response and resent its message
while the server was still processing the message, syncing failed with
"protocol error: already processing a message" raised by the
syncevo-dbus-server because it wasn't prepared to handle that situation.

The right place to handle this is inside the syncevo-http-server, because it
depends on the protocol (HTTP in this case) whether resending is valid or
not. It handles that now by tracking the message that is currently in
processing and matching it against each new message. If it matches, the new
request replaces the obsolete one without sending the message again to
syncevo-dbus-server. When syncevo-dbus-server replies to the old message, the
reply is used to finish the newer request.

This situation is covered by
Client::Sync::eds_event_eds_contact::testManyDeletes with 100 items and
client and server running under valgrind. The test failed earlier and works
now.
2013-07-10 13:08:02 +02:00
Patrick Ohly dc35d87dec D-Bus: better logging of server stub transport exceptions
Use SE_THROW() instead of "throw" because we want the error being
logged in the current sync log.
2013-07-10 13:08:02 +02:00
Patrick Ohly 7059459768 D-Bus: allow catching syncevo-dbus-helper in valgrind debugger
Set SYNCEVOLUTION_DBUS_HELPER_VGDB=1, add --vgdb-error=1 --vgdb=yes
to VALGRIND_ARGS, run test, wait for vgdb message in valgrind*.out files,
attach as instructed.

With --vgdb-error=0, all processes block during startup, waiting for
the debugger to attach.
2013-07-10 13:08:02 +02:00
Patrick Ohly 1538b89b36 PBAP: transfer data inside ReadItemAsKey
The previous attempt with concurrent reading while listing IDs did not
work, that listing must complete before the SyncML client contacts the
server. What works is transfering and parsing after the engine starts
to ask for the actual data.

For that we need to list IDs in advance. We use GetSize() for that.

If contacts get deleted while we read, getting the data for the
contacts at the end of the range will fail with 404, which is
understood by the Synthesis engine and leads to ignoring the ID, as
intended.

If contacts get added while we read, we will ignore them even if they
happen to be in the result of PullAll. The next sync will include
them.
2013-07-10 13:08:02 +02:00
Patrick Ohly 19aeba2029 PIM: use incremental sync for PBAP by default (FDO #59551)
When doing a PBAP sync, PIM manager asks the D-Bus sync helper to set
its SYNCEVOLUTION_PBAP_SYNC to "incremental". If the env variable
is already set, it does not get overwritten, which allows overriding
this default.
2013-07-10 13:08:02 +02:00
Patrick Ohly 7bd8a187d2 PIM testing: more flexible exclusion of empty vcard
Don't depend on order of properties, something else was seen.
2013-07-10 13:08:02 +02:00
Patrick Ohly ddc1e53b0c PBAP: incremental sync (FDO #59551)
Depending on the SYNCEVOLUTION_PBAP_SYNC env variable, syncing reads
all properties as configured ("all"), excludes photos ("text") or
first text, then all ("incremental").

When excluding photos, only known properties get requested. This
avoids issues with phones which reject the request when enabling
properties via the bit flags. This also helps with
"databaseFormat=^PHOTO".

When excluding photos, the vcard merge script as used by EDS ensures
that existing photo data is preserved. This only works during a slow
sync (merge script not called otherwise, okay for PBAP because it
always syncs in slow sync) and EDS (other backends do not use the
merge script, okay at the moment because PIM Manager is hard-coded to
use EDS).

The PBAP backend must be aware of the PBAP sync mode and request a
second cycle, which again must be a slow sync. This only works because
the sync engine is aware of the special mode and sets a new session
variable "keepPhotoData". It would be better to have the PBAP backend
send CTCap with PHOTO marked as not supported for text-only syncs and
enabled when sending PHOTO data, but that is considerably harder to
implement (CTCap cannot be adjusted at runtime).

beginSync() may only ask for a slow sync when not already called
for one. That's what the command line tool does when accessing
items. It fails when getting the 508 status.

The original goal of overlapping syncing with download has not been
achieved yet. It turned out that all item IDs get requested before
syncing starts, which thus depends on downloading all items in the current
implementation. Can be fixed by making up IDs based on the number of
existing items (see GetSize() in PBAP) and then downloading later when
the data is needed.
2013-07-10 13:08:02 +02:00
Patrick Ohly 309bed01e1 SyncSource: avoid ERROR logging for 508 status code
Returning a 508 status from beginSync() via a StatusException is
valid, this should only be logged by the originator if it deems that
an error.
2013-07-10 13:08:02 +02:00
Patrick Ohly 6d3b1cf64b EDS: update PHOTO+GEO during slow sync, avoid rewriting PHOTO file
If PHOTO and/or GEO were the only modified properties during a slow
sync, the updated item was not written into local storage because
they were marked as compare="never" = "not relevant".

For PHOTO this was intentional in the sample config, with the
rationale that local storages often don't store the data exactly as
requested. When that happens, comparing the data would lead to
unnecessary writes. But EDS and probably all other local SyncEvolution
storages (KDE, file) store the photo exactly as requested, so not
considering changes had the undesirable effect of not always writing
new photo data.

For GEO, ignoring it was accidental.

A special merge script handles EDS file:// photo URIs. When the
loosing item has the data in a file and the winning item has binary
data, the data in the file may still be up-to-date, so before allowing
MERGEFIELDS() to overwrite the file reference with binary data and
thus forcing EDS to write a new file, check the content. If it
matches, use the file reference in both items.
2013-07-10 13:08:02 +02:00
Patrick Ohly 50c06bbe61 EDS contacts: read-ahead cache
Performance is improved by requesting multiple contacts at once and
overlapping reading with processing. On a fast system (SSD, CPU fast
enough to not be the limiting factor), testpim.py's testSync takes 8
seconds for a "match" sync where 1000 contacts get loaded and compared
against the same set of contacts. Read-ahead with only 1 contact per
query speeds that up to 6.7s due to overlapping IO and
processing. Read-ahead with the default 50 contacts per query takes
5.5s. It does not get much faster with larger queries.

While returning items from one cache populated with a single
e_book_client_get_contacts() call, another query is started to overlap
processing and loading.

To achieve efficient read-ahead, the backend relies on the hint given
to it via setReadAheadOrder(). As soon as it detects that a contact is
not the next one according to that order, it switches back to reading
one contact at a time. This happens during the write phase of a sync
where the Synthesis engine needs to read, update, and write back
changes based on updates sent by the peer.

Cache statistics show that this works well for --print-items, --export
and slow syncs.

Writing into the database must invalidate the corresponding cached
contact. Otherwise the backup operation after a sync may end up
reading stale data.
2013-07-10 13:07:53 +02:00
Patrick Ohly 7d12c0a586 read-ahead: tell SyncSource about the upcoming read accesses
Trying to predict in the SyncSource which items will be needed is
hard. It depends what the item is retrieved for (sync or
backup/printing) and on the sync mode (during a sync).

Instead of guessing, better have the user of the source tell the
source in advance what it will read. In most cases this is cheap
because it does not involve copying of items luids ("read all items",
"read new or modified items"). The source then can use its own internal
mechanisms to figure out what that means.

Only extracting specific items specified on the command line and the
backup operation must explicitly pass an ordered list of luids. For
the sake of simplicity, do that in a std::vector even though it
involves copying.
2013-07-10 13:07:44 +02:00
Patrick Ohly 81fdf67437 glib: allow other threads to check something after each main loop iteration
The
  while (<something>) g_main_context_iterate(NULL, true);
pattern only works in the main thread. As soon as multiple
threads are allowed to process events, race conditions occur,
as described before.

But the pattern is useful, so support it in all threads by
shifting the check into the main thread, which will then notify
other threads via a condition variable when something changes.
2013-07-10 13:07:35 +02:00
Patrick Ohly ce1809d811 Threading: add Cond class
A thin wrapper around GMutex, initializes the condition variable
automatically.
2013-07-05 17:44:20 +02:00
Patrick Ohly 8ba5b42b92 Threading: fix Dyn*Mutex
gcc complained about the "protected" m_mutex access. Apparently
it did not realize that the access was to a base class. An explicit
get() solves that. Another way to get the pointer is a type cast.
2013-07-05 17:44:20 +02:00
Patrick Ohly a5fd9df29d PBAP: refactor PbapSyncSource, asyncronous transfer, report items immediately
Derive from SyncSource and SyncSourceSession directly instead of going
through TrackingSyncSource. This allows removing several dummy methods
that we have to implement for TrackingSyncSource and allows
reporting existing items incrementally, instead of having to load all
of them at once for the old listAllItems().

Contacts are now already reported to the engine while their transfer
still runs. That depends on monitoring the temporary file, remapping
the larger file and continuing parsing where the previous parsing
stopped.

This only works with obexd 0.47 and obexd from Bluez 5, because it
depends on the temporary file interface. The older PullAll did not
return any data until it had downloaded everything.

Because it isn't known when the contact data will be needed, the backend
still maintains the mapping from ID to vCard data for all contacts seen
in the current session. Because that memory is backed by a temporary file
system, unused memory can be swapped out (and in) well by the OS.

If the file is in a ram-based temp file system, then it may also not
matter at all that the file gets mapped multiple times.
2013-07-05 17:44:20 +02:00
Patrick Ohly 37c29253cf GErrorCXX: add take()
The other methods always make a copy of the GError. The new take()
method takes over ownership. Use in combination with g_error_new().
2013-07-05 17:44:20 +02:00
Patrick Ohly 55c0806800 command line: execute --export and --print-items while the source is still reading
Instead of reading all item IDs, then iterating over them, process
each new ID as soon as it is available. With sources that support
incremental reading (only the PBAP source at the moment) that provides
output sooner and is a bit more memory efficient.
2013-07-05 17:44:20 +02:00
Patrick Ohly e6c07b32b9 TmpFile: add moreData() and remove()
remove() is useful when want to continue using the file but also want
to ensure that it gets deleted when we crash.

moreData() can be used to determine if the file has grown since the
last time that map() was called. In other words, it supports
processing data while obexd still writes into the file.
2013-07-05 17:44:20 +02:00
Patrick Ohly d0626ea46c GDBus GIO: support int64_t and uint64_t
The dbus_traits for them were simply missing.
2013-07-05 17:44:20 +02:00
Patrick Ohly 4bf2adbe25 GDBus GIO: avoid unnecessary case-insentive type comparison.
The type is already lower-case on both sides, so there's no
need for the case-insensitive comparison.
2013-07-05 17:44:20 +02:00
Patrick Ohly 25f24387c3 PBAP: fix support for obexd == 0.47, break 0.48
The previous commit "PBAP: fix support for obexd >= 0.47 and < Bluez 5"
made the backend work with obexd 0.48 and broke it with 0.47. That's because
there was another API change between 0.47 and 0.48, which wasn't known
at the time of that commit.

SyncEvolution now works with 0.47 and does not work with 0.48. This choice
was made because 0.47 supports the file-based data transfer (same as in Bluez 5
and thus useful for testing when Bluez 5 is not available) and 0.47 still
compiles against older Bluez versions (which makes it easier to use than 0.48).
2013-07-05 17:44:10 +02:00
Patrick Ohly eca4dcb4b5 SuspendFlags: make it thread-safe
A new internal recursive mutex protects data that may get accessed
from different threads. It's recursive because callbacks may need to
lock it again.
2013-07-05 17:44:10 +02:00
Patrick Ohly aa961d85f6 testing: run local sync tests with more items
Several of the recent changes are meant for exchanging many items.
Tests that when running syncs locally, that way we also cover
both sides (client and server).
2013-07-05 17:44:10 +02:00
Patrick Ohly 0c63a4f7f0 D-Bus testing: support git glib/gobject bindings
More recent GNOME Python bindings are provided by gobject
introspection. The traditional gobject/glib modules no
longer exist.

The API is similar enough that we just need to adapt importing: if
importing the normal modules fails, try importing from gi.repository
instead.
2013-07-05 17:44:10 +02:00
Patrick Ohly 9c6022bd13 testing: better logging of synccompare invocation
In testExtension, the local environment variables matter when invoking
synccompare. Include them in the debug output.
2013-07-05 17:44:10 +02:00
Patrick Ohly dfd0bc29af EDS contacts: avoid unnecessary DB writes during slow sync due to FILE-AS
EDS 3.8 sets X-EVOLUTION-FILE-AS to "last, first" when a contact is
created without it. This leads again to unnecessary DB updates because
the incoming item that the engine works with doesn't have that field
set.

To mitigate that issue, set FILE_AS (renamed to make the field name
valid in a script) like EDS would do during writing.

The downside is that all incoming items now have FILE_AS set, which
will overwrite a locally stored copy of that property even if the peer
did not store X-EVOLUTION-FILE-AS. Previously, as tested by
testExtension, the local value was preserved. There is no good solution
that works for both use cases, so allow X-EVOLUTION-FILE-AS to get lost
and relax the test.
2013-07-05 17:44:10 +02:00
Patrick Ohly d2a43b1e50 EDS contacts: avoid unnecessary DB writes during slow sync
Traditionally, contacts were modified shortly before writing into EDS
to match with Evolution expectations (must have N, only one CELL TEL,
VOICE flag must be set). During a slow sync, the engine compare the
modified contacts with the unmodified, incoming one. This led to
mismatches and/or merge operations which end up not changing anything
in the DB because the only difference would be removed again before
writing.

To avoid this, define datatypes which include the EDS modifications in
its <incomingscript>. Then the engine works with an item as it would
be written to EDS and correctly determines that the incoming and DB
items are identical.

Found in testpim.py's testSync when applied to the test cases
generated by the Openismus test case generator.
2013-07-05 17:44:10 +02:00
Patrick Ohly 634e5e4e90 EDS: avoid retrieving REV/LAST-MODIFIED if not needed
If the sources are used in a mode which doesn't need revision strings,
then skip the retrieval of items from the EDS daemons when we would
normally do it to get the revision string.
2013-07-05 17:44:10 +02:00
Patrick Ohly 6c551167c4 engine: change tracking optional for caching mode and item modification
Recording the revision of items during a caching sync is unnecessary
because the next sync will not use the information. For item
modifications, the information was not even recorded.

Now a "don't need changes" mode can be set in SyncSource, which is
done for caching and command line item operations. This is better than
second-guessing the mode in which a source is used.

SyncSourceRevision checks that flag and skips updating the
luid->revision mapping if set.

Individual backends can also check the flag and skip calculating the
revision to begin with.
2013-07-05 17:44:10 +02:00
Patrick Ohly b7ea49ea8d EDS: implement batched add/update of contacts
Only works when compiled for EDS >= 3.6. Uses the new ITEM_AGAIN in
SyncSourceSerialize. Combines multiple add/update operations into one
asynchronous batch operation which can overlap with network IO if
the engine supports it.
2013-07-05 17:44:10 +02:00
Patrick Ohly 0b35ac1e6d engine: enable out-of-order command execution for SyncEvolution<->SyncEvolution
To take full advantage of batch operations, we must enable out-of-order
execution of commands. Otherwise the engine will never issue more than
one change to us. Do it for SyncEvolution as peer.

TODO: do it for all peers or disable batched processing when it is not
enabled.
2013-07-05 17:44:09 +02:00
Patrick Ohly ebef300ae5 SyncSource: support asynchronous add/update in utility classes
SyncSourceSerialize uses ITEM_AGAIN plus a callback in
InsertItemResult to indicate that and how an insert (aka add or
update) operation must be continued.

TrackingSyncSource merely passes that result through until it finally
completes.

Direct, raw access to items as done by the command line and restore
operations is not done asynchronously. The backend does not need to
know how it is used, the SyncSourceSerialize wrapper around the
backend will flush and wait.

Asynchronous deleting is not supported. It would require throwing an
exception or an API change (better - exceptions are for errors!)
because removeItem() has no return code which could be extended.
2013-07-05 17:44:09 +02:00
Patrick Ohly 856295b1e1 SyncSource: optional support for asynchronous insert/update/delete
The wrapper around the actual operation checks if the operation
returned an error or result code (traditional behavior). If not, it
expects a ContinueOperation instance, remembers it and calls it when
the same operation gets called again for the same item.

For add/insert, "same item" is detected based on the KeyH address,
which must not change. For delete, the item local ID is used.

Pre- and post-signals are called exactly once, before the first call
and after the last call of the item.

ContinueOperation is a simple boost::function pointer for now. The
Synthesis engine itself is not able to force completion of the
operation, it just polls. This can lead to many empty messages with
just an Alert inside, thus triggering the "endless loop" protection,
which aborts the sync.

We overcome this limitation in the SyncEvolution layer above the
Synthesis engine: first, we flush pending operations before starting
network IO. This is a good place to batch together all pending
operations. Second, to overcome the "endless loop" problem, we force
a waiting for completion if the last message already was empty. If
that happened, we are done with items and should start sending our
responses.

Binding a function which returns the traditional TSyError still works
because it gets copied transparently into the boost::variant that the
wrapper expects, so no other code in SyncSource or backends needs to
be adapted. Enabling the use of LOCERR_AGAIN in the utility classes
and backends will follow in the next patches.
2013-07-05 17:44:09 +02:00
Patrick Ohly b072af3dc1 engine: make FinalizeLocalID a real NOP
The function gets called and always logged the same "not implemented",
which unnecessarily increased the size of log files. Return directly.
2013-07-05 17:44:09 +02:00
Patrick Ohly c4de1cb227 SyncSource: simplify getPre/PostSignal()
Const-casting the member references is easier (= less code) because we
have a typedef for them and we can omit the access via "this".
2013-07-05 17:44:09 +02:00
Patrick Ohly 790502be21 PIM testing: enhance testFilterLiveLimit
Check conditions each time they change as part of view updates. This
would have helped to find the invalid check earlier and catches
temporary violations of the invariants.
2013-07-05 17:44:09 +02:00
Patrick Ohly b9e4bb995f PIM testing: fix testView and testViewSorting
The assertEqual() expected 'quiesence' to be seen, but runUntil() was not
asked to run until that was seen. Therefore tests failed randomly depending on
timing: they passed if the quiescence signal was processed in the same event
loop run as the change that was waited for and failed if it arrived later.

Fixed by waiting for 'quiesence' explicitly. It should arrive last.
2013-07-05 17:44:09 +02:00
Patrick Ohly 65fc725020 PIM testing: fixed testFilterLiveLimit
When "Abraham" falls out of the view, it is possible that we have temporarily
no contacts in the view, because first "Abraham" gets reviewed and then
"Benjamin" gets added. The check "at least one contact" therefore was too
strict.
2013-07-05 17:44:09 +02:00
Patrick Ohly 6a69b3f7e7 PIM testing: revise state checking
So far, a "check" callback was passed to runUntil() which checked the state
after each main loop run and at regular time intervals. The downside was that
an incorrect state change inside a single main loop run (for example, removing
a contact and adding one in testMerge) was not detected.

To increase coverage of state changes, the check is now also invoked after
each method call in the ViewAgent. If a check fails, it gets recorded as
error in the view and then will get noticed outside of the event loop by the
check that is passed to runUntil().

These checks needs to be installed before running the command line which
changes the state, not just as part of runTime(), because running the command
line also processes glib events.

This insufficient coverage was found when changes in timing caused testMerge
to fail: the previous check for "always exactly one contact" turned out to be
too strict and merely passed when remove + add were processed together. In
practice, the contact's ID changes because folks ties the merged contact to
a different primary store than the unmerged, original contact.
2013-07-05 17:44:09 +02:00
Patrick Ohly 08053b2ee7 PIM testing: testSync + test case files
TESTPIM_TEST_SYNC_TESTCASES can be set to the name of a file
containing contacts in vCard 3.0 format with an empty line as
separator. In this mode, testSync() measures the duration of cleaning
the local cache, importing all test cases, matching them against the
cache (which must not write into the cache!) and removing the cached
contacts.
2013-07-05 17:44:09 +02:00
Patrick Ohly a2c9ad75fe PIM: set debug level in peer configs via env variable
Typically the peer configs get created from scratch, in particular
when testing with testpim.py. In that case the log level cannot be set
in advance and doing it via the D-Bus API is also not supported.
Therefore, for debugging, use SYNCEVOLUTION_LOGLEVEL=<level> to create
peers with a specific log level.
2013-07-05 17:44:09 +02:00
Patrick Ohly 03d03ced60 testing: suppress libsoup cancellation error leak
I don't think we get to see the error that libsoup is setting
here, so this probably leaks inside libsoup.
2013-07-05 17:44:09 +02:00
Patrick Ohly 445d534388 SyncContext: "server" -> "peer" in debug message
The error message also applies to SyncML clients, so use "peer"
instead of "server".
2013-07-05 17:44:08 +02:00
Patrick Ohly 121b0e9066 SyncContext: include process name in Synthesis log
The process name has become essential to distinguish messages
from local sync parent and child, because the parent will include
the child's output in its own log.

We cannot pass a process name to the Synthesis logging mechanism, so
use the logging prefix instead. Relies on a patch to libsynthesis to
enable the logging of that prefix.
2013-07-05 17:44:08 +02:00
Patrick Ohly 193dd7456a EDS: fix cloning of system source
The localized DisplayName strings must be removed explicitly. To find them,
list all properties in the main section and then remove if the prefix
matches.
2013-07-05 17:44:01 +02:00
Patrick Ohly 993d4d58b8 glib: smart pointer for glib string arrays
Automatically calls g_strfreev(). Accessing entries in the array must
be done with at(), overloading the [] operator led to a "operator
ambiguous" warning from gcc on Debian Stable in x86.
2013-07-05 17:42:30 +02:00
Patrick Ohly b4d880bb8a engine: fix "override blocking threading code in libsynthesis"
CondTimedWaitGLib() would not have returned immediately for
milliSecondsToWait == 0, as expected by the Synthesis engine.
Not sure whether it mattered in practice, though.
2013-06-20 12:19:44 +02:00
Patrick Ohly 950007252b PIM: include pim-manager-api.txt in source distro (FDO #62516)
The text file must be listed explicitly to be included by "make dist".
2013-05-29 09:32:34 +02:00
Patrick Ohly fff4bc802c PIM: "full name" -> "fullname" fix in documentation (FDO #62515)
Make the documentation match the code. A single word without
space makes more sense, so let's go with what the code already
used.
2013-05-29 09:23:07 +02:00
Patrick Ohly 1f57b6c47b testing: updated valgrind suppressions
Testing showed one new, rare leak and some variations of older ones.
2013-05-29 09:14:02 +02:00
Patrick Ohly 48cdd04827 Apple: test with less items
Running the sync and/or the host machine became slower, leading to
timeouts and general slowness in the nightly testing. Test with less
items to stay within the allotted time.
2013-05-29 09:14:02 +02:00
Patrick Ohly 801ed0cefc Funambol: finally fix testing
Escaping the ( in the regular expression cannot be done when setting
it, because running the command will parse and re-generate the command
line. That code must be made aware that ( requires special care.
2013-05-29 09:13:53 +02:00
Patrick Ohly 8725ceb13a testing: remove redundant registration of testTwoWayRestart
testTwoWayRestart was added to the suite twice. Once is enough...
2013-05-29 09:13:46 +02:00
Patrick Ohly 0a7939139d D-Bus: fix minor memory leak
When setting up a connection to the system D-Bus failed, the error
message was leaked - occurred in testing, very unlikely in a real
systen.
2013-05-29 09:13:46 +02:00
Patrick Ohly 3bf8588aa0 PIM: fix SyncProgress signal
If the parent dies, the child must continue syncing. Therefore the
signal delivery via D-Bus must be marked as "optional", i.e., allowed
to fail.
2013-05-29 09:13:46 +02:00
Patrick Ohly 236a89fd86 PIM: document enhanced searching (search part of FDO #64177)
Documents 'or', 'and' and new per-field
'is|contains|begins_with|ends_with' operations.
2013-05-29 09:13:46 +02:00
Patrick Ohly 34241881ae PIM testing: test field tests
doFilter() gets extended to take (<full name>, <vcard>) tuples in
addition to the full name alone. Then this is used to create one large
vCard that is suitable for testing (field content unique, all fields
set, etc.) with various filters. All field tests are covered with at
least one positive and one negative case.
2013-05-29 09:13:46 +02:00
Patrick Ohly c922aed0f2 PIM: implement 'is/contains/begins-with/ends-with'
The operation is a runtime parameter of different classes, whereas
extracting the right values to compare via the operation is hard-coded
at compile time. This is a rather arbitrary compromise between code
duplication, simplicity and performance (which, in fact, was not
measured at all).

The code for selecting case-sensitivity and the normalization before
the string operations is shared with the older 'any-contains'
operation.
2013-05-29 09:13:46 +02:00
Patrick Ohly c24d196dc4 PIM: minor performance enhancement in 'any-contains'
Iterate over FolksAbstractFieldDetails to avoid unnecessary casting.
2013-05-29 09:13:46 +02:00
Patrick Ohly 3796f3cdde PIM testing: test case for 'and' and 'or'
The new TestContacts.testFilterLogic uses the same infrastructure as
the language tests and covers some combinations of 'and' and 'or'.

In some cases, Python lists had to be avoided in favor of tuples,
because Python cannot automatically map the lists to a 'av' array of
variants, while sending a tuple enumerating its types can be sent and
gets accepted by PIM Manager.
2013-05-29 09:13:46 +02:00
Patrick Ohly b42e093a60 PIM: implement 'and' and 'or'
Implementation falls naturally into the new framework, with
special logic filters combining the results of sub-filters.
2013-05-29 09:13:46 +02:00
Patrick Ohly 9942cecd84 PIM: support recursive search filter
This changes the signature of the filter parameter in Search(),
RefineSearch() and ReplaceSearch() from 'as' (array of strings) to
'av' (array of variants). Allowed entries in the variant are arrays
containing strings and/or other such arrays (recursive!).

A single string as value is not supported, which is the reason why
'av' instead of just plain 'v' makes sense (mismatches can already be
found in the sender, potentially at compile time). It also helps
Python choose the right type when asked to send an empty list. When
just using 'v', Python cannot decide automatically.

Error messages include a backtrace of all terms that the current,
faulty term was included in. That helps to locate the error in a
potentially larger filter.

The scope of supported searches has not changed (yet).
2013-05-29 09:13:46 +02:00
Patrick Ohly 4a617c1cc9 GDBus GIO: support recursive variant with one type
The signature of the new type is just a 'v' for variant. Recursion is
only supported in combination with std::vector. This is done to keep
implementation simpler. std::vector was chosen over other collections
because it is easier to work with in method calls, the main purpose
of the new type.

The conversion from D-Bus messages accepts anything which can be mapped
into the variant: arrays, tuples, plain types, and of course variants
containing those. This helps with backward compatibility (one can
turn an interface which took a fixed type like std::vector<std::string>
into something with a recursive variant) and with Python, because
Python sends arrays and tuples without converting into variants
when the app uses those simpler types.

One caveat exists with sending an empty list in Python: when using 'v'
as signature in the interface, Python doesn't know how to send the
empty list without assistance by the programmer (as in dbus.Array([],
signature='s'). If possible, avoid the plain 'v' in an interface in
favor of something like 'av' (= std::vector<boost::variant>).
2013-05-29 09:13:46 +02:00
Patrick Ohly 39bb3b6fec GDBus GIO: improve boost::variant visitor
There's no need to specify all valid types explicitly. We can use
a single method template instead.
2013-05-29 09:13:46 +02:00
Patrick Ohly 23ffd67ae5 PIM testing: check that EDS DB really gets removed (part of FDO #64835)
Check that PIM Manager removes the actual database files. Try it while
EDS is running and without.
2013-05-29 09:13:46 +02:00
Patrick Ohly 521c7ac967 PIM: allow removal of data together with database removal (part of FDO #64835)
There is a difference in EDS between removing the database definition
from the ESourceRegistry (which makes the data unaccessible via EDS)
and removing the actual database. EDS itself only removes the definition
and leaves the data around to be garbage-collected eventually. This is
not what we want for the PIM Manager API; the API makes a stronger
guarantee that data is really gone.

Fixed by introducing a new mode flag for the deleteDatabase() method
and deleting the directory of the source directly in the EDS backend,
if requested by the caller.

The syncevolution command line tool will use the default mode and thus
keep the data around, while the PIM Manager forces the removal of
data.
2013-05-29 09:13:38 +02:00
Patrick Ohly 5925ccee7f EDS: create new databases by cloning the builtin ones (FDO #64176)
Instead of hard-coding a specific "Backend Summary Setup" in
SyncEvolution, copy the config of the system database. That way
special flags (like the desired "Backend Summary Setup" for local
address books) can be set on a system-wide basis and without having to
modify or configure SyncEvolution.

Because EDS has no APIs to clone an ESource or turn a .source file
into a new ESource, SyncEvolution has to resort to manipulating and
creating the keyfile directly.
2013-05-29 09:13:37 +02:00
Patrick Ohly 0cd7f2ba62 PIM testing: add test for right error when using invalid UID
This covers the issue found in GDBus GIO where a generic error message
was returned and exception handling provided more details too late.
2013-05-29 09:13:37 +02:00
Patrick Ohly 31e4df6760 GDBus GIO: fix returning of error exceptions from asynchronous method + Interface_t/Member_t
When an asynchronous method call failed with an exception, the code
DBusResult got destructed first before handling the exception and then
sent a generic, uninformative error back to the caller. A test
demonstrating that for the PIM Manager SetPeer() with an invalid UID
be committed separately.

To fix this, the DBusResult must know whether it is really responsible
for replying to the method message. The method call handlers
themselves do not know whether any of their parameters is a
DBusResult, so we have to activate the automatic reply indirectly, via
a guard instance with the same life time as the handler.

When the guard destructs, it can check whether the handler has
replied, because the handler then clears the message pointers. If it
hasn't, the DBusResult becomes the owner of the message. For this to
work, an extra try/catch block is necessary. Otherwise exception
handling would still occur too late, at a time when the guard is gone
and the DBusResult has sent the generic error.

Some other classes had to be adapted to allow for this extra level of
indirection. While doing so, another bug was found.

Retrieving the interface and member used when calling a method
returned the path instead, due to a cut-and-paste error. Fixed. Not
used in practice.
2013-05-29 09:13:31 +02:00
Patrick Ohly f919856f6b PIM testing: run with temp-testpim as location for EDS and PIM Manager files
Having to look for XDG config files in two different locations was
confusing. The XDG_DATA_HOME=temp-testpim/local/cache was also wrong,
because "cache" is for XDG_CACHE_HOME.

Now XDG_CONFIG/CACHE/DATA_HOME must be set to
temp-testpim/[config|cache|data], which is consistent with the usage
of private XDG dirs in test-dbus.py, and the directories are shared by
EDS and PIM Manager.

EDS keeps running throughout all tests. This must be taken into
account when cleaning temp-testpim. evolution-source-registry does not
cope with removal of its "sources" directory, so we have to keep that,
although we are removing its content. evolution-addressbook-factory
may continue to have an ESource open although its client *and* the
source are gone (should be fixed in EDS by tracking clients *and*
source removals!).

When that happens and we reuse a DB UUID,
evolution-addressbook-factory continues to use the deleted instance,
leading to IO errors. To avoid that inside a test run, we use
different UID prefices for each test, by embedding the test name. To
avoid it between test runs, kill evolution-addressbook-factory
first. When killing evolution-source-registry, use -9, because
otherwise it shuts down too slowly, which may lead to test failures
when it talks to the closing instance.

For the system address book we can't change the UID between tests, so
we must not delete it.
2013-05-29 09:13:24 +02:00
Patrick Ohly 6218e3ac2d D-Bus testing: allow tests to install files in a shared XDG tree
It is useful to let tests add (or more likely, overwrite) files to an
XDG directory shared between tests. Those tests must be aware that
there may be other files in the XDG dir from other tests.
2013-05-29 09:13:17 +02:00
Patrick Ohly 4511c431bc dbus-session.sh: create XDG dirs
Programs expect that XDG dirs exist. We cannot really guarantee that
in the test wrapper scripts, because the entire directory containing
the XDG dirs may get wiped. So (re-)create the dirs shortly before they
are needed, which is by the programs launched via dbus-session.sh.
2013-05-29 09:13:17 +02:00
Patrick Ohly fa0d5c4f83 dbus-session.sh: fix bashism
The "return $res" does not work when /bin/sh is not bash.
2013-05-24 21:59:29 +02:00
Patrick Ohly a59e0ac00e PBAP: fix support for obexd >= 0.47 and < Bluez 5
The API flavor implemented by obexd after and including 0.47 and
before migrating to Bluez was not used correctly, completely breaking
transfers.
2013-05-24 21:59:29 +02:00
Patrick Ohly e0162da6e0 Funambol: fix command line syntax
The previous commit added brackets to the command line
without escaping them.
2013-05-18 04:23:15 -07:00
Patrick Ohly 6d50a84902 gee: stricter ref counting
As with glib before, now GeeCollCXX also makes the parameter for declaring the
pointer ownership mandatory. The ensuing code analysis showed that in two
cases involving gee_multi_map_get() the transfer of ownership was not handled
correctly, leading to memory leaks.
2013-05-17 12:38:17 -07:00
Patrick Ohly c667ff0eb9 Logging: apply filter to glib messages
Traditionally, glib messages were caught via LogRedirect.
Later, they got redirected by installing a handler. That change
disabled the message filtering for known harmless error messages
in LogRedirect, which caused messages from folks to show up
in TestCmdline D-Bus tests randomly, depending on the timing.

Reestablish the filtering by checking it in the glog callback.
To minimize changes, keep the error registry in LogRedirect.
It must be thread-safe now.
2013-05-17 12:25:54 -07:00
Patrick Ohly e86cb1cd71 local sync: avoid potential crash
The D-Bus method reply may occur when the calling instance of
LocalTransportAgent is already gone. Therefore bind to a weak
pointer instead of this.

Seen when testing against Apple Calendar Server in the nightly
testing. It was a bit uncertain from the logs why it happened,
but it is clear that it can happen and thus the patch makes
sense even though it might not address the real problem.
2013-05-17 12:21:33 -07:00
Patrick Ohly f46f6eadf0 D-Bus testing: fix testAbortThread
It can happen that the background thread terminates before libsynthesis checks
for termination. In that case our helper code does not get called and thus
cannot log the message that the test was checking for. Instead check for
proper continuation of the file source open.
2013-05-17 12:18:33 -07:00
Patrick Ohly 8dd516846a engine: free engine while still protected from signals
Explicitly free the engine before releasing our lock on shutdown
signals. This prevents getting killed by a signal while we are still
freeing resources, which can take some time when a background thread
is involved (seen in some tests covering that).
2013-05-16 11:25:05 +02:00
Patrick Ohly 69b8780bde engine: avoid false resending of messages shortly before final timeout
The D-Bus TestHTTP tests occasionally failed because a message was resend
due to rounding issues. Be a bit (= 0.1 seconds) more conservative about
resending to avoid this.
2013-05-16 11:25:05 +02:00
Patrick Ohly ef52bf1379 PIM testing: fix TestContacts.testDeadAgent
Sometimes an extra "quiescent" signal was seen. It came from the
FolksAggregator before reporting any contacts. Not exactly sure
why that happens, but because it is not the responsibility of this
test to detect that, let's ignore it here.
2013-05-16 11:25:05 +02:00
Patrick Ohly 11224d2df0 PIM testing: sorting test for de
The test only passes for Germany. In Austria, ICU itself does
not return the results mentioned in Wikipedia. Therefore that
test is commented out.
2013-05-16 11:25:05 +02:00
Patrick Ohly 0681183fac PIM: select "phonebook" for de and fi (part of FDO #64173)
We have to hard code this instead of always using it because ICU does
not properly fall back to non-phonebook defaults. Without phonebook as
collation, sorting was not done correctly in Germany.
2013-05-16 11:25:05 +02:00
Patrick Ohly bcf5b59c59 PIM testing: removed debug print
The print statement was no longer necessary and actually caused a
problem by itself when it failed to print some unicode character.
2013-05-16 11:25:04 +02:00
Patrick Ohly 74515d4061 PIM: use higher collation level
Now also pay attention to case and punctuation. Previously these were
ignored for performance reasons. The reasoning that case doesn't
matter was wrong, it is useful as a tie breaker (which is what the
higher level does).
2013-05-16 11:25:04 +02:00
Patrick Ohly 2ced6a51d5 PIM testing: add tests for Chinese and Japanese sorting
The approach is the same in both cases:
- import a certain set of testcases
- filter
- compare against expected order of results
2013-05-16 11:24:48 +02:00
Patrick Ohly bab3906e12 PIM: Pinyin sorting for zh languages (part of FDO #64173)
Full interleaving of Pinyin transliterations of Chinese names with
Western names can be done by doing an explicit Pinyin transliteration
as part of computing the sort keys.

This is done using ICU's Transliteration("Han-Latin"), which we have
to call directly because boost::locale does not expose that API.

We hard-code this behavior for all "zh" languages (as identified by
boost::locale), because by default, ICU would sort Pinyin separately
from Western names when using the "pinyin" collation.
2013-05-16 11:24:48 +02:00
Patrick Ohly 542236bb5e PIM: refactor Boost localization
Move common code in compare classes into CompareBoost.
2013-05-16 11:24:48 +02:00
Patrick Ohly b6b75de59b PIM: new return value for SyncPeer(), new SyncProgress signal (FDO #63417)
The SyncPeer() result is derived from the sync statistics. To have
them available, the "sync done" signal must include the SyncReport.

Start and end of a sync could already be detected; "modified" signals
while a sync runs depends on a new signal inside the SyncContext when
switching from one cycle to the next and at the end of the last one.
2013-05-16 11:24:48 +02:00
Patrick Ohly d3eee8a039 glib: stricter ref counting
Following the boost::instrusive_ptr example and making "add_ref =
true" the default in our CXX GLib and GObject wrappers led to some
memory leaks because it didn't enforce thinking about whether the
plain pointer is already owned by us or not.

It is better to use a mandatory enum value, ADD_REF and TRANSFER_REF,
and force explicit construction. Doing that revealed that the
assignment operator was implemented as constructing a CXX instance
with increased ref count and/or that in some places, a real leak was
caused by increasing the ref count unnecessarily.

Running under valgrind gave a false sense of security. Some of the
real leaks only showed up randomly in tests.
2013-05-16 11:19:32 +02:00
Patrick Ohly fb83c468a8 SmartPtr: add reset()
This mimics the behavior of boost smart pointers and is useful for
code where variables can be of either type, because "= NULL" is
not supported by our boost::intrusive_ptr wrapper.
2013-05-16 11:19:32 +02:00
Patrick Ohly 0c5ba9355f Funambol: avoid testing slow sync mode
Funambol reacts with a 407 "retry later" very quickly when clients
to slow syncs. Avoid that, because it pretty much prevents getting
any of the tests to run.
2013-05-16 11:19:32 +02:00
Patrick Ohly cee96ac9c7 WebDAV: avoid segfault during collection lookup
Avoid referencing pathProps->second when the set of paths that
PROPFINDs returns is empty. Apparently this can happen in combination
with Calypso.

The stack backtrace sent via email looked like this:

Program received signal SIGSEGV, Segmentation fault.
0x4031a1a0 in std::_Rb_tree<std::string, std::pair<std::string const, std::string>, std::_Select1st<std::pair<std::string const, std::string> >, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > >::find(std::string const&) const () from /usr/lib/libsyncevolution.so.0
0x4031a1a0 <_ZNKSt8_Rb_treeISsSt4pairIKSsSsESt10_Select1stIS2_ESt4lessISsESaIS2_EE4findERS1_+60>:       ldr     r4, [r0, #-12]
(gdb) bt
   from /usr/lib/syncevolution/backends/syncdav.so
   from /usr/lib/syncevolution/backends/syncdav.so
   from /usr/lib/libsyncevolution.so.0
2013-05-16 11:19:32 +02:00
Patrick Ohly d75b15f653 PIM: fix for pre-computed normalized phone numbers from EDS (FDO #59571, part 1)
The method folks_abstract_field_details_get_parameter_values() returns a copy
of the values. Must free it, otherwise we leak memory.
2013-05-13 17:51:38 +02:00
Patrick Ohly 57162cb8c7 ForkExec: better debug output
Include the pid of the child process in all messages relating to it,
to help in cases where the same program is started multiple times.

Log something in the parent when destroying the fake API instance and
thus canceling the fake method call from the child, because that will
trigger a "lost connection" message in the child which was hard to
correlate with events in the server without those additional log
messages in the parent.
2013-05-13 17:49:50 +02:00
Patrick Ohly 4661a721c3 D-Bus testing: remove timeout in TestSessionAPIsDummy.testInteractivePassword
The timeout kept firing and showed up in other tests when those timed
out, which was very confusing. Had no negative impact otherwise.
2013-05-13 17:49:50 +02:00
Patrick Ohly 83a0c05763 D-Bus testing: implement removal of glib timeout
Use type checking to determine whether a timeout was done via
glib or signals. Without removal of a glib timeout, a periodic
timeout keeps firing in other tests.
2013-05-13 17:49:50 +02:00
Patrick Ohly 60f7ccda87 D-Bus testing: abort server with background thread
Ensure that server is currently waiting for background thread, then
abort via Session.Abort(). Needs to be detected by backend and the
lead to normal session shutdown.
2013-05-13 17:49:50 +02:00
Patrick Ohly 59f2c2b101 D-Bus server: activate sessions created for incoming connections
Sessions created via the Server.Connect() API were announced via
signals, but not activated. Therefore querying their status or
aborting them via D-Bus was not possible. Found while writing the
TestHTTP.testAbortThread D-Bus test.
2013-05-13 17:49:50 +02:00
Patrick Ohly 4ad28f7a63 testing: add EDS<->EDS syncing via HTTP
Running EDS on the server side is a relevant use case and may
have its own share of problems, in particular when the server
runs the EDS code in a background thread. Better test that with
libebook and libecal...
2013-05-13 17:49:50 +02:00
Patrick Ohly 9a3b17b82a engine: eliminate virtual checkForSuspend/Abort()
Since the introduction of SuspendFlags, the ony remaining user
of the virtual aspect of checkForSuspend/checkForAbort() was the
testing code. By using the suspend/abort request mechanism in
SuspendFlags, it becomes possible to move checkForSuspend/Abort()
into SuspendFlags itself.

This will be useful to use it outside of a SyncContext member.
2013-05-13 17:49:50 +02:00
Diane Trout 05fb1aebc3 KDE: fix Akonadi backend for tasks
Because of a too generic mime type in SyncEvolution, task collections
were not found.
2013-05-13 17:49:50 +02:00
Patrick Ohly 9c96257948 autotools: libsynthesis for SyncEvolution now on freedesktop.org 2013-05-13 17:49:50 +02:00
Patrick Ohly 35fc6e80ab D-Bus testing: cover implicit URI
The local source name is the default for the URI value, test that
for "calendar".
2013-05-13 17:49:50 +02:00
Patrick Ohly 088053c3f0 D-Bus testing: cover multithreading and HTTP
test-dbus.py now knows how to start syncevo-http-server. Therefore
it can test normal HTTP-based syncing as well as several scenarios
which fail or succeed with a slow server depending on the server's
ability to send SyncML messages while still initializing the storage.

To make the server slow, env variables are checked by the file
backend. It may matter whether open() or listAll() are slow, so test
both.

The tests expecting the 2 minute default must check whether the
feature is enabled at all in the binary that they are testing. If not,
the test cannot run. All other tests work, albeit somewhat unsafely
because they force the engine to run multithreaded when the engine was
compiled without mutex locking of global data structures.
2013-05-13 17:49:50 +02:00
Patrick Ohly 9d2df20ccc engine: override blocking threading code in libsynthesis
We need to keep the glib event loop running while the main thread
waits for the background thread to finish. Otherwise code using
glib events (like EDS) may get stuck (observed with Sleep()
when using g_timeout_add() and synchronous calls in EDS 3.6).

We also need to watch for abort requests. When aborted, we give up
waiting for the thread and tell the engine to proceed. This will
eventually return control to us, where we can shut down.

When libsynthesis shuts down, it'll wait forever for the background
thread's shutdown. In this case we must wait and hope that the background
thread completes or aborts by itself.
2013-05-13 17:49:50 +02:00
Patrick Ohly 9a4c770d8e engine: prevent timeouts in HTTP server mode
HTTP SyncML clients give up after a certain timeout (SyncEvolution
after RetryDuration = 5 minutes by default, Nokia e51 after 15
minutes) when the server fails to respond.

This can happen with SyncEvolution as server when it uses a slow
storage with many items, for example via WebDAV. In the case of slow
session startup, multithreading is now used to run the storage
initializing in parallel to sending regular "keep-alive" SyncML
replies to the client.

By default, these replies are sent every 2 minutes. This can be
configured with another extensions of the SyncMLVersion property:
  SyncMLVersion = REQUESTMAXTIME=5m

Other modes do not use multithreading by default, but it can be
enabled by setting REQUESTMAXTIME explicitly. It can be disabled
by setting the time to zero.

The new feature depends on a libsynthesis with multithreading enabled
and glib >= 2.32.0, which is necessary to make SyncEvolution itself
thread-safe. With an older glib, multithreading is disabled, but can
be enabled as a stop-gap measure by setting REQUESTMAXTIME explicitly.
2013-05-13 17:49:50 +02:00
Patrick Ohly 2032d17098 engine: event processing when using multithreading
Only one thread may handle events in the default context at any point
in time. If a second thread calls g_main_context_iteration() or
g_main_loop_run(), it blocks until the other thread releases ownership
of the context. In that case, the first thread may wake up because of
an event that the second thread waits for, in which case the second
thread may never wake up. See
https://mail.gnome.org/archives/gtk-list/2013-April/msg00040.html

This means that SyncEvolution can no longer rely on these functions
outside of the main thread. This affects Sleep() and the EDS backend.

As an interim solution, take over permanent ownership of the default
context in the main thread. This prevents fights over the ownership
when the main thread enters and leaves the main loop
repeatedly. Utility code using the main context must check for
ownership first and fall back to some other means when not the owner.

The assumption for the fallback is that the main thread will drive the
event loop, so polling with small delays for the expected status
change (like "view complete" in the EDS backend) is going to succeed
eventually.

A better solution would be to have one thread running the event loop
permanently and push all event handling into that thread. There is C++
utility code for such things in:
http://cxx-gtk-utils.sourceforge.net/2.0/index.html

See in particular the TaskManager class and its
make_task_when()/make_task_compose()/make_task_when_full() functions
for executing asynchronous results via a glib main loop, also the
Future::when() method and a number of other similar things in the
library.
2013-05-13 17:49:50 +02:00
Patrick Ohly 8bdea72be5 D-Bus testing: improved running of command line tool
Refactored the code into a new utility base class for use in other
tests.

Replace pipes with temporary files, using the same base name as the
traditional .syncevo.log and .dbus.log. They are numbered (because the
command line might be run multiple times per test) and use .out, .err,
or .outerr as suffix depending on what kind of output they
contain. The advantage is that the output gets recorded permanently.

Use that when waiting for command completion times out: in that case,
the content of the output file(s) gets added to the exception.

The subprocess handle returned by startCmdline() is extended with
information about output redirection that is then used by
finishCmdline(). This makes one parameter of finishCmdline()
redundant.
2013-05-13 17:49:49 +02:00
Patrick Ohly 0f3d2fda7c engine: clarify m_remoteInitiated
It means "the remote was initiated", not "we were initiated by the
remote side". Somewhat unfortunate choice of a variable name, but
leave it for now...
2013-05-13 17:49:49 +02:00
Patrick Ohly e154b747d2 engine: better transport timeout handling
Use the monotonic system time. Timespec has sub-second resolution and
by using the monotonic time, we are independent of time corrections.

If retryDuration is smaller than retryInterval, then time out after
retryDuration instead of waiting once for retryInterval and then
checking retryDuration.

When the request timed out *exactly* after retryDuration or the next
resend would happen after the retryDuration, then give up immediately.
2013-05-13 17:49:49 +02:00
Patrick Ohly e891851b0f Google: ignore loss of TRANSP property
Google Calendar currently drops the TRANSP property. This is a regression
that was reported to Google. While waiting for a fix ignore the problem.
2013-05-13 17:49:49 +02:00
Patrick Ohly e90575224e D-Bus: fix random session failures
When the helper shuts down normally after the parent is done with it,
there was a race between handling the signal and the loss of connection,
leading to random "return 1" errors. This showed up in nightly testing
in particular in the test-dbus.py testConfigure.

The loss of connection at that point is not an error, so don't treat it
as one and simply return 0.
2013-05-13 17:49:49 +02:00
Patrick Ohly 8db33a4ba5 D-Bus: add helper's stdout to parent's stdout
During normal operation, the helper's messages were never printed to any
output stream. They only went out via D-Bus. This was surprising when
debugging syncevo-dbus-server and it's interaction with syncevo-dbus-helper.

It's better to let the parent print the helper's output if the helper
doesn't do it itself, so that console output is the same with and without
SYNCEVOLUTION_DEBUG.
2013-05-13 17:49:49 +02:00
Patrick Ohly a21dc9a029 D-Bus: fix shutdown race condition after aborted sync
When a sync in syncevo-dbus-helper was aborted, the process did not
wait in main() for the server to acknowledge the D-Bus method
response. If the process quit to early, the parent did not get the
method response, leading to an "internal error" instead of "aborted"
as result of the sync.

The reason is that the acknowledgement was meant to be done via
SIGTERM, but that had already been sent and thus syncevo-dbus-helper
did not wait. Solved by using SIGURG for the acknowledgement.

In addition, the parent must not close its connection when sending
signals to the child, because the child may still need to send its
sync report and/or log output signals.
2013-05-13 17:49:49 +02:00
Patrick Ohly 65caef7ee6 D-Bus: fix syncevo-dbus-server<->syncevo-dbus-helper communication when using GIO D-Bus
D-Bus objects in a process exist independently from a specific D-Bus
connection. They are only identified by their path. When syncevo-dbus-server
forked multiple syncevo-dbus-helper instances, it indirectly (in ForkExec)
created multiple callback objects for the childs "watch" functionality (a
pending method call that the parent never replies to). These method calls were
associated with the a random (oldest?) session instead of the current one.

This causes problems once an older session terminates and the callback object
destructs, because then the wrong children get a failure response, which they
treat as "connection lost = parent has terminated". Found while trying to fix
shutdown race conditions.

The solution is to generate a unique counter for each child and communicate
that counter to the child via a new env variable.
2013-05-13 17:49:49 +02:00
Patrick Ohly 5bafef3957 engine: support additional signals in SuspendFlags
It can be useful to use additional signals like SIGURG or SIGIO
(typically not used elsewhere) for simple interprocess
communication. SuspendFlags now supports that by letting the process
catch more than just SIGINT and SIGTERM and recording which signals
were received.

activate() calls can happen when already active, for example when
syncevo-dbus-helper instantiates SyncContext, which activates signal
handling for the duration of the sync. This was not handled well
before, leaking previously allocated FDs and not restoring signal
handlers correctly. Because the process quit anyway soon, this did not
matter in practice.

Now the code explicitly checks for this and returns the existing Guard
in all following activate() calls, without changing the signal
handling.
2013-05-06 16:28:13 +02:00
Patrick Ohly 649837c2c2 Logging: thread-safe
Logging must be thread-safe, because the glib log callback may be
called from arbitrary threads. This becomes more important with EDS
3.8, because it shifts the execution of synchronous calls into
threads.

Thread-safe logging will also be required for running the Synthesis
engine multithreaded, to overlap SyncML client communication with
preparing the sources.

To achieve this, the core Logging module protects its global data with
a recursive mutex. A recursive mutes is used because logging calls
themselves may be recursive, so ensuring single-lock semantic would be
hard.

Ref-counted boost pointers are used to track usage of Logger
instances.  This allows removal of an instance from the logging stack
while it may still be in use. Destruction then will be delayed until
the last user of the instance drops it. The instance itself must be
prepared to handle this.

The Logging mutex is available to users of the Logging module. Code
which holds the logging mutex should not lock any other mutex, to
avoid deadlocks. The new code is a bit fuzzy on that, because it calls
other modules (glib, Synthesis engine) while holding the mutex. If
that becomes a problem, then the mutex can be unlocked, at the risk of
leading to reordered log messages in different channels (see
ServerLogger).

Making all loggers follow the new rules uses different
approaches.

Loggers like the one in the local transport child which use a parent
logger and an additional ref-counted class like the D-Bus helper keep
a weak reference to the helper and lock it before use. If it is gone
already, the second logging part is skipped. This is the recommended
approach.

In cases where introducing ref-counting for the second class would
have been too intrusive (Server and SessionHelper), a fake
boost::shared_ptr without a destructor is used as an intermediate step
towards the recommended approach. To avoid race conditions while the
instance these fake pointers refer to destructs, an explicit
"remove()" method is necessary which must hold the Logging
mutex. Using the potentially removed pointer must do the same. Such
fake ref-counted Loggers cannot be used as parent logger of other
loggers, because then remove() would not be able to drop the last
reference to the fake boost::shared_ptr.

Loggers with fake boost::shared_ptr must keep a strong reference,
because no-one else does. The goal is to turn this into weak
references eventually.

LogDir must protect concurrent access to m_report and the Synthesis
engine.

The LogRedirectLogger assumes that it is still the active logger while
disabling itself. The remove() callback method will always be invoked
before removing a logger from the stack.
2013-05-06 16:28:13 +02:00
Patrick Ohly 2f6f880910 Logging: merge Logger and LoggerBase
Having two separate classes had little (no?!) benefit and just
caused confusion.
2013-05-06 16:28:13 +02:00
Patrick Ohly ff2c4584b2 Logging: remove obsolete isProcessSafe()
The method became obsolete when introducing fork+exec for local
syncing. Before that, the method was used to remove unsafe loggers in
the child's process. Now exec() does that for us.
2013-05-06 16:28:13 +02:00
Patrick Ohly ecfceb3f98 Logging: avoid changing global process name
Changing the process' name, even temporarily, is not thread-safe
and needs to be avoided. Instead pass the additional parameter
explicitly via the MessageOptions container.

Logger::formatLines() and LogStdout::write() are passed the process
name as "const std::string *" pointer, with Logger::getProcessName()
acting as fallback for NULL. Calling that is delayed as long as possible,
to avoid making the string copy when not necessary.

The previous implementation of formatLines() used a std::string
reference, but only used the content to determine whether to include
the current process name - probably not what was intended, but harmless
because either the empty string or the current name were passed.
2013-05-06 16:28:13 +02:00
Patrick Ohly 30955bab34 Logging: move messagev parameters into struct, rename different versions of messagev
The number of parameters for messagev has grown unreasonably, and more
parameters will be needed soon (explicit process name). Better store
the parameters in a struct and pass around a pointer to such a struct
instance. The code becomes shorter and new parameters can be passed
through intermediate functions without modifying them.
2013-05-06 16:28:13 +02:00
Patrick Ohly 4f8615ee8b Logging: eliminate _instance from SE_LOG* macros
With the _instance parameter always being NULL thanks to the previous
patch, it can be removed completely.
2013-05-06 16:28:13 +02:00
Patrick Ohly b5befe6cbf Logging: remove usage of Logger instance
Passing an explicit Logger instance to the SE_LOG* macros was hardly
ever used and only made the macros more complex.

The only usage of it was in some backends, which then added a prefix
string automatically. The same effect can be achieved by passing
getDisplayName(). Exception handling no longer needs a Logger instance,
the prefix alone is enough.

The other intended usage, avoiding global variables for logging by
passing a logger known to the caller, was not possible at all.

To make prefix handling more flexible, it is now passed as a "const
std::string *" instead of a "const char *".
2013-05-06 16:28:12 +02:00
Patrick Ohly 77b26de4b8 engine: add mutex support via glib
The new ThreadSupport.h provides C++ recursive and non-recursive
mutices for static and dynamic allocation, with RAII for unlocking
them automatically.

The current implementation depends on glib >= 2.32.0. Without it, the
C++ classes are dummies which do no real locking. On systems without
glib or a glib older than 2.32.0 (Debian Etch, Ubuntu Lucid 12.04),
thread support does not work because it depends on the revised glib
threading API from 2.32.0.
2013-05-06 16:28:12 +02:00
Patrick Ohly 75e3fb86f9 EDS: avoid e_cal_client_remove_object_sync with empty UID
The call cannot succeed without an empty UID, so there's no point
even trying it. Worse, EDS 3.8 aborts the process when given
an empty UID:
[ERROR 00:00:00] GLib: g_variant_builder_end: assertion
`!GVSB(builder)->uniform_item_types || GVSB(builder)->prev_item_type != NULL
|| g_variant_type_is_definite (GVSB(builder)->type)' failed
[ERROR 00:00:00] GLib: g_variant_get_type: assertion `value != NULL' failed
[ERROR 00:00:00] GLib: g_variant_type_is_subtype_of: assertion `g_variant_type_check (type)' failed
[ERROR 00:00:00] GLib: g_variant_get_type_string: assertion `value != NULL' failed
[ERROR 00:00:00] GLib: g_variant_new: expected GVariant of type `a(ss)' but received value has type `(null)'

See https://bugzilla.gnome.org/show_bug.cgi?id=697705
2013-05-06 16:28:12 +02:00
Patrick Ohly 6156ae620c D-Bus testing: increase message bus timeout
For interactive debugging it is better to have an infinite timeout of
the D-Bus method call. The overall test will still time out as quickly
as it did before.
2013-05-06 16:28:12 +02:00
Patrick Ohly 5344aa0239 testing: avoid system-wide killing of valgrind in valgrindcheck.sh
When running EDS under valgrindcheck.sh in parallel to running
syncevo-dbus-server under valgrindcheck.sh, then cleaning up after
syncevo-dbus-server must not kill EDS.

To achieve this, look at all log files created for us and extract the
pid from each file.

Also fix sending INT/TERM vs. KILL signals to these processes.
2013-05-06 16:28:12 +02:00
Patrick Ohly 28835d448b D-Bus testing: improve TestSessionAPIsDummy.testInteractivePassword
The invocation of killall was unnecessarily complex.
2013-05-06 16:28:12 +02:00
Patrick Ohly 6bc1687877 D-Bus testing: SYNCEVOLUTION_DEBUG skips output redirection
When running test-dbus.py or testpim.py with SYNCEVOLUTION_DEBUG
set, they now skip the redirection of syncevo-dbus-server output
into a file. Useful when doing interactive debugging without running
under a debugger.
2013-05-06 16:28:12 +02:00
Patrick Ohly 3badde0ceb testing: apply valgrind to EDS when running test-dbus.py and testpim.py
When starting a D-Bus session for test-dbus.py and testpim.py, valgrind
gets injected via an env variable and the older check of the program to
be started did not match. Need to check the environment in addition to
the command line, otherwise EDS gets started by the D-Bus daemon and
we never see its output nor does it get checked by valgrind.
2013-05-06 16:28:12 +02:00
Patrick Ohly 07b0fdd5b2 testing: add missing rule names
This allows grepping the "valgrind -v" output for new suppressions.
Without this change, grep finds statistics about the known suppressions.
2013-05-06 16:28:12 +02:00
Patrick Ohly 2863498d12 testing: remove suppression for EDS leak
The problem has been fixed in the meantime (00f566 "sqlite addressbook: fix
memory corruption in get_revision") and no longer occurs in an release we test
against.
2013-05-06 16:28:12 +02:00
Patrick Ohly f640ee89b2 D-Bus testing: set locale in some more tests
Run some more tests with the right locale. The tests check for
a localized error message ("The connection is closed").
2013-05-06 16:28:12 +02:00
Patrick Ohly 89970c04c1 PIM testing: ignore folks rec mutex leak
New variant of an older, minor leak.
2013-05-06 16:28:12 +02:00
Patrick Ohly e3f0a297f7 EDS Client: handle "busy" error
In EDS 3.6.4, opening fails a lot more often with E_CLIENT_ERROR_BUSY.
We must retry until we succeed.

Seen in particular with testpim.py testFilterStartup. Clients are expected to
try the open call again. EDS >= 3.8 does that automatically.
2013-05-06 16:28:12 +02:00
Patrick Ohly 065fdcd343 D-Bus testing: start EDS also for testpim.py
Manually start EDS also when testing with testpim.py, to see the
output of the factory processes and allow running them from places
where the D-Bus daemon would not find them.
2013-05-06 16:28:12 +02:00
Patrick Ohly 4fd4334821 PIM Manager: remove redundant type check+cast
Cut-and-paste error, casting into FolksAbstractFieldDetails twice is
unnecessary.
2013-05-06 16:28:12 +02:00
Patrick Ohly d9881c30f5 PIM testing: data output in testActive
When setting TESTPIM_TEST_ACTIVE_RESPONSE to a negative value, print
the ping samples instead of checking them. Useful to gather statistics
(see stats, https://github.com/rustyrussell/stats, or histogram.py,
https://github.com/bitly/data_hacks).
2013-05-06 16:28:12 +02:00
Patrick Ohly be4b2393cd PIM testing: allow more than 1000 contacts in testActive
The sorting got broken when the number of contacts exceeds the 3
digits reserved via the 03d formatting specifier. Now allow four
digits = up to 9999 contacts.
2013-05-06 16:28:12 +02:00
Patrick Ohly 48b577370f PIM testing: fix reference to start time in testActive
Binding _done() to self.start reads the *current* value of self.start
when _done() gets called. We need to bind to an inmuted local instance
instead to achieve the desired effect.
2013-05-06 16:28:12 +02:00
Patrick Ohly e583973999 command line: check for strdup() failure
Handle the unlikely case that strdup() fails during program
startup.
2013-05-06 16:28:11 +02:00
Patrick Ohly 930f5fa71a TransportAgent: destructor must be virtual
The destructor must be virtual, otherwise destructors in dervived
classes are not getting called when destructing via a downcasted
pointer. Should be relevant, but did not show up in valgrind?!
2013-05-06 16:28:11 +02:00
Patrick Ohly 132e915624 engine: call getenv() only once
Helps Klocwork, which otherwise warned about the potential
NULL return from the second call.
2013-05-06 16:28:11 +02:00
Patrick Ohly cbac788a65 engine: use thread-safe localtime_r(), check results
Klocwork complained about not checking the result. Depending on the
situation we now give up or use some kind of fallback (for example,
when logging).

SyncEvolution itself is not multithreaded, but utility libraries
might be, so better avoid the localtime() function and its global
state. May also be relevant when function A gets a tm * pointer,
calls function B which calls localtime() again, then A tries to
use its original value.
2013-05-06 16:27:40 +02:00
Patrick Ohly 4af81c9803 LogRedirect: better handling of realloc failure
When realloc() returns NULL, the already allocated buffer remains
available. Previously we discarded (and leaked!) it. Now we track
whether that memory already contains parts of the next log message
and use that when realloc fails. The dgram will then get discarded
without reading the rest.

When reading from a stream, realloc will only be called once to
get the initial buffer. When that fails, we give up.
2013-04-22 16:01:45 +02:00
Patrick Ohly eb40cfe045 LogRedirect: mark class as noncopyable
The class is noncopyable because of a plain pointer. Klocwork warned
about that.
2013-04-22 16:01:45 +02:00
Patrick Ohly 8f24f1706b GDBus GIO: mark class as noncopyable
The class is noncopyable because of a plain pointer. Klocwork warned
about that.
2013-04-22 16:01:44 +02:00
Patrick Ohly 99427fbae7 D-Bus server: fix memory leak in case of failed restart
Found via Klocwork. Hardly relevant in practice.
2013-04-22 16:01:44 +02:00
Patrick Ohly 1bd0d59703 D-Bus server: avoid potential segfault
Klocwork warned about using a NULL starttime pointer in the case that
the transport is unknown. Not sure whether this can actually happen at the
moment, fix it anyway.
2013-04-22 16:01:44 +02:00
Patrick Ohly 7a1278dae1 testing: only call getenv() once for each var
Klocwork warned about the second call because it did not recognize that
it cannot return NULL.
2013-04-22 16:01:44 +02:00
Patrick Ohly 3858d78370 KDE: more explicit memory handling in Akonadi backend
All of the jobs were allocated dynamically without freeing them
explicitly, instead relying on auto-deletion (enabled by default).

This behavior is surprising for SyncEvolution developers and Klocwork,
which expects explicit delete calls for each new. Better use
traditional RAII.

The advantage also is that each job gets deleted right away, instead
of waiting for another round of event processing, which may or may not
happen soon.
2013-04-22 15:59:15 +02:00
Patrick Ohly c7c0152776 KDE: avoid creating a shared session D-Bus connection before creating the app
Qt has never been happy with the old code, reporting:
  QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.

This error message became visible again after some recent logging
changes and broke tests, so better avoid it by testing for D-Bus
with a private connection.
2013-04-22 15:58:32 +02:00
Patrick Ohly 2894f5c573 SyncSourceBlob: avoid crash in ReadBlob()
Klocwork correctly reported that the underlying implementation in
libsynthesis must not be called with NULL pointers. Therefore always
allow it to set the return values, even if our caller was not
interested.
2013-03-19 14:58:46 +01:00
Patrick Ohly a69b9c904d testing: read env variable only once
Klocwork failed to detect that the result of getenv() was checked.
Keep Klocwork happy by assigning the result to a temporary variable
and checking that.
2013-03-19 14:57:11 +01:00
Patrick Ohly 3ec359deed testing: avoid unlikely fd leak
If opening the server log file returned 0 as fd, the writing was
skipped and the file was not closed. Found by Klocwork, unrealistic in
practice.
2013-03-19 14:56:10 +01:00
Patrick Ohly 81d1bef13c testing: mark ClientTest non-copyable
Fixes a correct Klocwork warning about a memory leak when using the default
copy operator - never happens in practice, though.
2013-03-19 14:55:13 +01:00
Patrick Ohly 5758d2d037 GDBus GIO: better DBusErrorCXX copy operator
The old code triggered a Klocwork warning about the missing self check
in the copy operator. This was not a real problem because of the
temporary instance from which m_error got taken, but that was not
obvious even to a human.

Better use standard coding practices:
- skip the operation when assigning to self
- reuse the set() operation
- return reference instead of copy (probably a bug!)
2013-03-19 14:52:30 +01:00
Patrick Ohly aff78c4fe5 NEWS, configure: SyncEvolution 1.3.99.3 2013-03-07 19:57:34 +01:00
Patrick Ohly 3bc0adfebf Revert "testing: ignore GIO D-Bus leak"
This reverts commit 3c0396abcf.

Conflicts:
	test/evo.supp

Memory leak is fixed in SyncEvolution now. However, glib itself
also leaks the GDBusMethodInfo when the method gets called.
See https://bugzilla.gnome.org/show_bug.cgi?id=695376
2013-03-07 19:55:48 +01:00
Patrick Ohly afe766b4e5 GDBus GIO: fix memory leak of GDBusMethod/SignalInfo
The code tried to transfer ownership of the GDBusMethodInfo and
GDBusSignalInfo arrays to the refcounted GDBusInterfaceInfo instance,
but that does not work because g_dbus_interface_info_unref() does not
free those arrays.

Let's simplify this so that all memory, including the GDBusInterfaceInfo
instance, is owned by DBusObjectHelper and kept around as long as the
object is active.

The stack-allocated GDBusInterfaceVTable happened to work in practice,
but the API description does not say whether
g_dbus_connection_register_object() makes a copy, so better keep that
around longer, too.

Finally, clean up checking for "is activated" to use only
m_connId. m_activated was redundant and the method resp. signal
pointers are now always non-NULL.
2013-03-07 19:55:48 +01:00
Patrick Ohly d303670549 testing: temporarily ignore neon + gnutls leak
Tracked as FDO #61851.
2013-03-06 02:07:07 -08:00
Patrick Ohly ef4f77e06a D-Bus testing: kill partially terminated processes
When running syncevo-dbus-server under valgrindcheck.sh,
the following happened occasionally:
- syncevo-dbus-server main thread quits, some threads keep running
  => ps shows the process as <defunct> with ppid = 1 = init
- valgrindcheck.sh notices that the process is done,
  reports status and quits
- test-dbus.py fails to wait for the syncevo-dbus-server
  process (because it is not the parent) and assumes that
  the process is gone

At this point there is a lingering process which occupies the
well-known D-Bus name (= all further tests fail) and which
prevents unmounting the chroot.

It's unknown how the syncevo-dbus-server gets into that state.
Could be valgrind 3.7.0 or the kernel 3.4.28-2.20-xen.

As a workaround, let test-dbus.py collect the pids of all processed that it
couldn't wait for and send them SIGKILLs until that returns with "not
found".
2013-03-06 02:07:07 -08:00
Patrick Ohly 762d6c0910 Nokia: always add TYPE=INTERNET to EMAIL (FDO #61784)
Without the explicit TYPE=INTERNET, email addresses sent to a Nokia
e51 were not shown by the phone and even got lost eventually (when
syncing back?).

This commit ensures that the type is set for all emails sent to any
Nokia phone, because there may be other phones which need it and
phones which don't, shouldn't mind. This was spot-checked with a N97
mini, which works fine with and without the INTERNET type.

This behavior can be disabled again for specific Nokia phones by
adding a remote rule which sets the addInternetEmail session variable
to FALSE again.

Non-Nokia phones can enable the feature in a similar way, by setting
the variable to TRUE.
2013-03-05 16:12:48 +01:00
Patrick Ohly e1af3d87d6 testing: don't use -O2 on client-test
Compilation takes a lot longer when using -O2 and the result
is less debugger friendly, so filter out the flag. This is
relevant when building a release where the flag is set for the
rest of the compilation.
2013-03-04 07:36:22 -08:00
Patrick Ohly e1317c149c wrappercheck.sh: more resilient against race conditions
Killing the helper shell may fail when the shell already quit.
2013-03-04 07:36:22 -08:00
Patrick Ohly 748618d6e3 PIM testing: ignore valgrind ERROR when checking output
Complaining about "ERROR SUMMARY" when using valgrind is a false
positive. Ignore that text by making it lower case before searching.  Other
attempts based on regex matching somehow failed (UTF-8 encoding error?!).
2013-03-04 07:36:22 -08:00
Patrick Ohly 87177c71c9 D-Bus testing: more logging in auto start test
Capture output and include it error report. Helped to track
down the reason why startup failed in the jhbuild environment.
2013-03-04 07:36:22 -08:00
Patrick Ohly 1995bd6184 D-Bus testing: fix auto start test when using jhbuild
The test must not overwrite XDG_DATA_DIRS, because jhbuild sets
essential values there. Instead append.
2013-03-04 07:36:22 -08:00
Patrick Ohly f5286a09fa D-Bus testing: catch server startup failure
When starting the server fails, an exception gets thrown when
trying to determine its pid. This used to abort the whole
test script without recording much information. In particular
the server's output was not included.

Now the exception is caught, recorded as error and testing continues
with the next test.

This did not fix the root cause (a stuck process occupied the
D-Bus name) but at least it helped to identify the problem.
2013-03-04 07:36:22 -08:00
Patrick Ohly e8f7753573 testing: add debug output for importing test cases
With all the interaction between Client::Sync, Client::Source and
CLIENT_TEST_SERVER it can be hard to figure out which test case file
gets used. Log that explicitly.
2013-03-04 07:36:22 -08:00
Patrick Ohly 68ef2f37dd WebDAV: don't send Basic Auth via http (FDO #57248)
Sending basic authentication headers via http is insecure.
Only do it when the connection is encrypted and thus
protects the information.
2013-03-04 07:36:21 -08:00
Patrick Ohly 4898f813ff Google CalDAV testing: avoid multiple detached recurrences, II
Because of Google issue with detached recurrences without parent
(http://code.google.com/p/google-caldav-issues/issues/detail?id=58)
and the SyncEvolution workaround (replacing RECURRENCE-ID with
X-SYNCEVOLUTION-RECURRENCE-ID) only one detached recurrence per UID
can be stored.

Removing the second modified recurrence from the test cases for
Google.

Somehow the second modified recurrence made its way back into the
test data while rewriting the generic eds_event.ics.
2013-03-04 07:36:21 -08:00
Patrick Ohly de56cc626b SyncML: workarounds for broken peers, attempt 2
Some peers have problems with meta data (CtCap, old Nokia phones) and
the sync mode extensions required for advertising the restart
capability (Oracle Beehive).

Because the problem occurs when SyncEvolution contacts the peers
before it gets the device information from the peer, dynamic rules
based on the peer identifiers cannot be used. Instead the local config
must already disable these extra features in advance.

The "SyncMLVersion" property gets extended for this. Instead of just
"SyncMLVersion = 1.0" (as before) it now becomes possible to say
"SyncMLVersion = 1.0, noctcap, norestart".

"noctcap" disables sending CtCap. "norestart" disables the sync mode
extensions and thus doing multiple sync cycles in the same session
(used between SyncEvolution instances in some cases to get client and
server into sync in one session).

Both keywords are case-insensitive. There's no error checking for
typos, so beware!

The "SyncMLVersion" property was chosen because it was already in use
for configuring SyncML compatibility aspects and adding a new property
would have been harder.

In the previous attempt (commit a0375e) setting the <syncmodeextensions>
option was only done on the client side, thus breaking multi-cycle
syncing with SyncEvolution as server. On the server side the option
shouldn't be needed (the server never sends the extensions unless
the client did first), but for symmetry and testing reasons it makes
sense to also offer the options there.
2013-03-04 07:36:21 -08:00
Graham R. Cobb 36e8a6005a ActiveSync: added support for specifying folder names
Previously, the database field was interpreted as a Collection ID.  This adds
logic to allow the database to be interpreted as a folder path.  The logic is:

1) If the database is an empty string, pass it through (this is the most
common case as it is interpreted as "use the default folder for the
source type").

2) If the database matches a Collection ID, use the ID (this is the same as
the previous behaviour).

3) If the database matches a folder path name, with an optional leading "/",
use the Collection ID for the matching folder.

4) Otherwise, force a FolderSync to get the latest folder changes from the
server and repeat steps 2 and 3

5) If still no match, throw an error.

Steps 2 and 3 are in the new function lookupFolder.  The remaining logic has
been added to the open function.  Note that the result is that m_folder (and
hence getFolder()) are always either empty or a Collection ID -- that is as
before so the sync logic itself is unchanged.
2013-03-04 07:36:21 -08:00
Patrick Ohly e96ff22fdd ActiveSync: avoid explicit g_object_unref for EasSyncHandler
Better use a smart pointer - less code and harder to make mistakes.
2013-03-04 07:36:21 -08:00
Patrick Ohly e05454d563 command line: show backend error when listing databases fails
The command line swallowed errors thrown by the backend while listing
databases. Instead it just showed "<backend name>: backend failed". The goal
was to not distract users who accidentally access a non-functional backend.
But the result is that operations like --configure or --print-databases could
fail without giving the user any hint about the root cause of the issue.

Now the error explanation in all its gory details is included.

For example, not having activesyncd running leads to:
INFO] eas_contact: backend failed: fetching folder list:
GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name
org.meego.activesyncd was not provided by any .service files

And running activesyncd without the necessary gconf keys shows up as:
[INFO] eas_contact: backend failed: fetching folder list:
GDBus.Error:org.meego.activesyncd.Error.AccountNotFound: Failed to find
account [syncevolution@lists.intel.com]

Both of these happened when trying to use the "list database" ActiveSync
patches in the nightly test setup...
2013-03-04 07:36:21 -08:00
Graham R. Cobb 5920bf59b3 ActiveSync: added getDatabases support for fetching folder list
A new method, findCollections, fetches the folder list from the server and
creates two maps:

m_collections - store all the information about each collection (folder),
indexed by server collection ID

m_folderPaths - map full folder paths to collection IDs

getDatabases uses this data to returns the folder path, collection ID and a
flag indicating if the folder is the default for that type.

Note 1: getDatabases always asks activesyncd to update the folder list from the
server in order to return up to date information.

Note 2: this depends on a new libeasclient routine:
eas_sync_handler_get_folder_list
2013-03-04 07:36:21 -08:00
Patrick Ohly d8ca8b64cf EDS + PIM: create phone number summary in contacts DB (part of FDO #59571)
A quick-and-dirty solution for enabling phone number summaries when
creating contact databases in the PIM Manager: let the EDS backend
recognize the special UIDs used by the PIM Manager and then hard-code
the minimal set of summary fields and indexed fields which allow
executing the E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER
query quickly.

A proper solution would use a new EDS function for parsing ESource
defaults from a string and then providing these defaults to the
backend from the PIM Manager.

Also note that configuring the EDS system address book must be covered
elsewhere, because it wouldn't be correct for SyncEvolution as only
one of many clients to change the configuration of that.

To enable the special support, add the following section to
share/evolution-data-server-3.6/rw-sources/system-address-book.source:

[Backend Summary Setup]
SummaryFields=phone
IndexedFields=phone,phone

This patch adds new function calls to code shared by syncecal and syncebook,
so we have to add libebook-contacts to both to avoid link errors.
2013-03-04 07:35:04 -08:00
Patrick Ohly e2647f4962 NEWS: preparations for 1.3.99.3
Add missing date to 1.3.99.2 release and summarize all changes so
far for the next release.
2013-02-26 12:03:46 +01:00
Patrick Ohly cc68e3c807 Revert "ActiveSync: added getDatabases support for fetching folder list"
This reverts commit 2735273ec60b289c5ec2c49f3eacb9d7d04d5ea1.

With this patch, setting up ActiveSync fails with Google as server.
Needs further investigation.

Also note the explicit g_object_unref() and EASFolderUnref - these
should get replace with SE_GOBJECT_TYPE smart pointers.
2013-02-26 12:03:46 +01:00
Patrick Ohly 6076c980b7 Revert "ActiveSync: added support for specifying folder names"
This reverts commit 7327b23a4dd31abdc9596916743892402bcffe0c.

Depends on 273527 "ActiveSync: added getDatabases support for fetching
folder list" which has to be reverted.
2013-02-26 12:03:46 +01:00
Patrick Ohly 374b277883 EDS: temporarily ignore a minor leak (BGO #694730)
See https://bugzilla.gnome.org/show_bug.cgi?id=694730

==18552== 25 bytes in 1 blocks are definitely lost in loss record 2,353 of
6,616
==18552==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
==18552==    by 0xADC3D40: g_malloc (gmem.c:159)
==18552==    by 0xADDA3BB: g_strdup (gstrfuncs.c:364)
==18552==    by 0x1146400B: get_string_cb (e-book-backend-sqlitedb.c:255)
==18552==    by 0x854F1CE: sqlite3_exec (in
/usr/lib/x86_64-linux-gnu/libsqlite3.so.0.8.6)
==18552==    by 0x114665A2: book_backend_sql_exec_real
(e-book-backend-sqlitedb.c:301)
==18552==    by 0x1146666F: book_backend_sql_exec
(e-book-backend-sqlitedb.c:391)
==18552==    by 0x11469FC6: e_book_backend_sqlitedb_get_revision
(e-book-backend-sqlitedb.c:3995)
==18552==    by 0x1F90480E: e_book_backend_file_open
(e-book-backend-file.c:656)
==18552==    by 0x1146C229: book_backend_open (e-book-backend-sync.c:397)
==18552==    by 0x11473F26: operation_thread (e-data-book.c:292)
==18552==    by 0xADE2181: g_thread_pool_thread_proxy (gthreadpool.c:309)
==18552==    by 0xADE1964: g_thread_proxy (gthread.c:797)
==18552==    by 0x8E34B4F: start_thread (pthread_create.c:304)
==18552==    by 0xB90F70C: clone (clone.S:112)
2013-02-26 12:03:46 +01:00
Patrick Ohly fde7bc7974 PIM: add ReplaceSearch, always allow it
The new ReplaceSearch is more flexible than RefineSearch. It can
handle both tightening the search and relaxing it. The downside of it
is the more expensive implementation (must check all contacts again,
then find minimal set of change signals to update view).

Previously, a search which had no filter set at all at the begining
could not be refined. This limitation of the implementation gets
removed by always using a FilteredView, even if the initial filter is
empty.

When the parent of a FilteredView emits signals, it is not necessarily
always in a consistent state and the FilteredView must not invoke
methods in the parent. Stressing the FilteredView by using it in tests
originally written for the FullView showed that the filling up a view
violated that rule and led to contacts being present multiple
times. Fixed by delaying the reading from the parent into either an
idle callback or the parent's quiescence signal processing, whichever
comes first.
2013-02-26 12:03:46 +01:00
Patrick Ohly 3c21df32e0 D-Bus server: more flexible timeouts
Added priorities and proper tracking of "activated" state. The latter
depends on having the Timeout instance valid when the callback
returns, therefore the Server must delay the deletion of the instance
until the callback is done executing.

Priorities are needed to order different tasks in the PIM manager
correctly.

The "activated" state is something that the PIM manager needs to track
reliably, which had to be done by every callback. If a callback forgot
to do that, in the worst case this might have removed an entirely
unrelated source when the tag got reused in the meantime.
2013-02-26 12:03:46 +01:00
Graham R. Cobb 44d9b2c989 ActiveSync: added support for specifying folder names
Previously, the database field was interpreted as a Collection ID.  This adds
logic to allow the database to be interpreted as a folder path.  The logic is:

1) If the database is an empty string, pass it through (this is the most
common case as it is interpreted as "use the default folder for the
source type").

2) If the database matches a Collection ID, use the ID (this is the same as
the previous behaviour).

3) If the database matches a folder path name, with an optional leading "/",
use the Collection ID for the matching folder.

4) Otherwise, force a FolderSync to get the latest folder changes from the
server and repeat steps 2 and 3

5) If still no match, throw an error.

Steps 2 and 3 are in the new function lookupFolder.  The remaining logic has
been added to the open function.  Note that the result is that m_folder (and
hence getFolder()) are always either empty or a Collection ID -- that is as
before so the sync logic itself is unchanged.
2013-02-26 12:03:46 +01:00
Graham R. Cobb 02c3b84ac3 ActiveSync: added getDatabases support for fetching folder list
A new method, findCollections, fetches the folder list from the server and
creates two maps:

m_collections - store all the information about each collection (folder),
indexed by server collection ID

m_folderPaths - map full folder paths to collection IDs

getDatabases uses this data to returns the folder path, collection ID and a
flag indicating if the folder is the default for that type.

Note 1: getDatabases always asks activesyncd to update the folder list from the
server in order to return up to date information.

Note 2: this depends on a new libeasclient routine:
eas_sync_handler_get_folder_list
2013-02-26 12:03:46 +01:00
Patrick Ohly fe92461ddc PIM: intelligent phone search in EDS (FDO #59571, part 2)
If phone number search is possible, then the direct search in EDS now
uses the more accurate E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER
comparison, with the E164 formatted caller ID as value to compare
against. That value includes the current country code.

For testing purposes, setting SYNCEVOLUTION_PIM_EDS_SUBSTRING forces
the usage of the traditional suffix match. This is used to test both
the old and new flavor of testFilterStartupRefine.
FilterStartupRefineSmart is the one which uses phone number matching.
2013-02-26 12:03:46 +01:00
Patrick Ohly 58500350d5 D-Bus testing: merge with truncated D-Bus log 2013-02-26 12:03:46 +01:00
Patrick Ohly 9e197a48f3 PIM: use pre-computed normalized phone numbers from EDS (FDO #59571, part 1)
When available, the pre-computed E164 number from EDS will be used
instead of doing one libphonebook parser run for each telephone number
while reading. Benchmarking showed that this parsing was the number
one hotspot, so this is a considerable improvement.
2013-02-26 12:03:45 +01:00
Patrick Ohly bfe1b062cb testing: more workarounds for Google CalDAV + unique IDs
Google became even more strict about checking REV. Tests which
reused a UID after deleting the original item started to fail sometime
since middle of December 2012.

To fix this, tests must differentiate reuse of an item by adding a suffix
("-A", "-B", etc.). If CLIENT_TEST_UNIQUE_UID has a value >= 2, that suffix
will be used when mangling the input item. Otherwise the suffix is ignored
and nothing changes.

For testing Google, CLIENT_TEST_UNIQUE_UID=2 is used.
2013-02-26 12:03:45 +01:00
Patrick Ohly 7214834e0b autotools: avoid -lrt in make dependencies
The backends had SYNCEVOLUTION_LIBS in their _DEPENDENCIES entries,
which is wrong because SYNCEVOLUTION_LIBS must include -lrt (which
can't be a dependency).

Fixed by depending on libsyncevolution.la directly.
2013-02-26 12:03:45 +01:00
Patrick Ohly d3257fe7fd autotools: add missing pcre libs to syncevo-dbus-server
The library might be used, for example when the PIM Manager is part of
the server, so better add it. Avoids hard linker errors on some
systems when it is used and not specified, which is better than given
one extraneous library that -as-needed can take care of.
2013-02-26 12:03:45 +01:00
Patrick Ohly a0b5ea8711 PIM testing: ensure that no ERROR messages are printed
This covers D-Bus log messages and stdout. Adding the check revealed
several issues which were fixed in the previous commits.
2013-02-26 12:03:45 +01:00
Patrick Ohly e6c5d574ae Folks: avoid warnings when unsetting photo
The code which removed a photo from a contact did it by creating a
g_file_icon() with a NULL GFile. This is invalid and caused warnings
from glib. Eventually it must have passed NULL to folks, which is what
the new code does directly.
2013-02-26 12:03:45 +01:00
Patrick Ohly 84855750f9 PIM: fix initialization of folks backends
The FolksBackendStore must be prepared before disabling or enabling
backends. Using the wrong order caused ERROR messages about using a
NULL key file.
2013-02-26 12:03:45 +01:00
Patrick Ohly 882ff26695 PIM: capture libphonenumber output
Don't let libphonenumber write to stdout. Instead redirect into
SyncEvolution logging and manage severity level. For example,
previously parsing errors of phone numbers were logged as [ERROR] by
libphonenumber. Now that appears as "phonenumber error: ...".
2013-02-26 12:03:45 +01:00
Patrick Ohly 22a809beae logging: more independent of namespace
The previous macros assumed to be used inside the SyncEvo namespace
and had problems when used in a context where "Logger" was resolved to
something other than SyncEvo::Logger. Making that more explicit solved
that problem.
2013-02-26 12:03:45 +01:00
Patrick Ohly cf01f9296f D-Bus testing: enhanced checking of D-Bus and stdout log
Adds the possibility to check the servers standard output
similar to its D-Bus log output. Both can now also be set
before invoking runTest() because that method no longer
sets the members.
2013-02-26 12:03:45 +01:00
Patrick Ohly 227cab6953 EDS: direct access with EDS master
Use e_book_client_connect_direct_sync(), the official API, when
available. Support for e_book_client_new_direct() is still in the
code; it can be removed onces the 3.6 openismus-work branch adapts the
official API.
2013-02-26 12:03:45 +01:00
Patrick Ohly a01824793e PBAP: support Bluez 5
The new Bluez 5 API is the third supported API for doing PBAP
transfers. It gets checked first, then the PBAB backend falls back to
new-style obexd (file based, similar to Bluez 5, but not quite the
same) and finally old-style obexd (data transfer via D-Bus).

In contrast to previous APIs, Bluez 5 does not report the reason for a
failed PBAP transfer. SyncEvolution then throws a generic "transfer
failed" error with "reason unknown" as message.
2013-02-26 12:03:44 +01:00
Patrick Ohly 4946adeb83 PIM testing: turn testActive into performance test
When using more than 10 contacts (TESTPIM_TEST_ACTIVE_NUM), logging
and polling are turned towards causing less work by testpim.py itself.

TESTPIM_TEST_ACTIVE_RESPONSE can be used to give a maximum response
time in seconds, which gets checked by watchdog by calling
GetAllPeers().

This is relevant in two cases, data loaded before folks starts reading
from EDS (TESTPIM_TEST_ACTIVE_LOAD set) and folks getting change
notifications as SyncEvolution imports data into EDS (not set).

Related to FDO #60851. Currently SyncEvolution+Folks do not pass the
performance test.
2013-02-26 12:03:44 +01:00
Patrick Ohly fa83ec1538 PIM testing: introduce watchdog
The server must remain responsive at all times. The new Watchdog
class tests that by calling GetAllPeers() at regular intervals. It
can only be used in tests which do not block the event processing
in the Python script itself.

Once the watchdog runs, it must be removed when a test stops.  The new
cleanup test member can be used to add cleanup code at runtime which
will be called when tearing down the test.
2013-02-26 12:03:44 +01:00
Patrick Ohly 8b2b79f0cc PIM testing: avoid large ReadContacts() calls
The D-Bus server has to respond to the entire request at once, which
makes it unresponsive. Needs to be avoided in the client, because
doing it on the server side is too complicated. The server would have
to start gathering results, but those results may become invalid again
in response to processing events before it can send them out.

Related to BGO #60851.
2013-02-26 12:03:44 +01:00
Patrick Ohly c6f872228f PIM testing: fix testRead test case
The \n in the testRead vCard was interpreted by Python instead of
being written into the file. Must mark the string as raw. Did not
affect the test itself, but the libebook vCard parser reported
warnings.
2013-02-26 12:03:44 +01:00
Patrick Ohly 459d6a49bf PIM: debug messages for modifying contact
Track which changes need to be stored and how that gets processed. Was
useful for finding that modifying groups failed when the groups hadn't
actually changed.
2013-02-26 12:03:44 +01:00
Patrick Ohly 6323155dd0 PIM: adapt to gee 0.8
The latest folks from master uses gee 0.8. Requires changing some
GeeHashSet instantiations due to an API change.
2013-02-26 12:03:44 +01:00
Patrick Ohly 1f082efdf3 PIM testing: testActive for large number of contacts
Setting TESTPIM_TEST_ACTIVE_NUM to a value larger than 10 enables a
mode with less logging and more efficient event handling in
runUntil. Useful for performance testing, because otherwise testpim.py
itself consumes considerable CPU cycles.
2013-02-26 12:03:44 +01:00
Patrick Ohly 7c029afcb6 PIM testing: more efficient ViewAgent
Support disabling of logging in ViewAgent. Necessary when dealing with
large views.
2013-02-26 12:03:43 +01:00
Patrick Ohly 91b79834c7 D-Bus testing: improved logging
Log message now contain time stamps. A NullLogging class mimics the
Logging interface and can be used instead of that to suppress logging.

As a side effect of turning the log() method into a wrapper, the D-Bus
signal is now called "log2", which makes it possible to search for it
case-insensitively in emacs without finding the LogOutput signal.
2013-02-26 12:03:43 +01:00
Patrick Ohly 5ae059affc D-Bus testing: optionally use gzip
The dbus-monitor output can be very large. Handle that a bit better by
compressing the file with a gzip pipe. Experimental and a bit broken:
output is not flushed properly when killing dbus-monitor + gzip.
2013-02-26 12:03:43 +01:00
Patrick Ohly 9156ff3598 D-Bus testing: more efficient runUntil
An different approach is taken when runUntil() is called with
may_block=True: it lets the main loop run for 0.5 seconds and then
returns to do the status checking. No logging is done for each check.
This is meant for long-running operations where the 0.5 second latency
doesn't matter and too frequent checking and logging cause overhead.

The default code path checks every 0.1 second and recognizes
progress (defined as "there was an event to be processed"), which then
causes debug logging about waiting.
2013-02-26 12:03:43 +01:00
Patrick Ohly 1c125ac680 PIM testing: avoid reading multiple times
Mark pending reads by adding the start time. Avoid requesting data
again which is still pending. Relevant when dealing with many contacts
in testActive, helps performance by avoiding redundant operations.
2013-02-26 12:03:43 +01:00
Patrick Ohly cd5a3944cd D-Bus server: reduce D-Bus log messages
Sending DEBUG messages via the LogOutput signal is expensive and often
not necessary. Ideally LogOutput should only send data that someone is
interested in. The problem is that the SyncEvolution D-Bus API has no
way of specifying that and some clients, like dbus-monitor, would not be
able to use it.

Therefore this commit makes the default level of detail configurable
when syncevo-dbus-server is started, via a separate --dbus-verbosity
option.

This gets applied to output generated from syncevo-dbus-server itself
as well as output from sync sessions.

test-dbus.py exposes that via a new TEST_DBUS_QUIET option. The
default is to include DEBUG output. When TEST_DBUS_QUIET is set to a
non-empty string, only ERROR and INFO messages are sent.
2013-02-26 12:03:43 +01:00
Patrick Ohly 179590135f D-Bus testing: avoid extranuous message about SIGTERM
The message was printed also when there were no children to kill
that way. Now also include the process list of hanging children.
2013-02-26 12:03:43 +01:00
Patrick Ohly 5d0b2bb89b D-Bus testing: TEST_DBUS_VERBOSE shows logging messages
When setting TEST_DBUS_VERBOSE to a non-empty value, all the Python
log messages are printed directly. TEST_DBUS_GDB implies
TEST_DBUS_VERBOSE.
2013-02-26 12:03:43 +01:00
Patrick Ohly b29ffb2da7 PIM: introduce CreateConfig()
That SetPeer() allows modifying and creating a config leads to race
conditions when multiple clients want to create a config. The new
CreateConfig() avoids that by atomically checking that a config does
not exist yet and creating it.

SetPeer() is still available for backwards compatibility. It continues
to be used for modifying an existing config in TestContacts.testSync
to check the effect of the logging settings.
2013-02-26 12:03:43 +01:00
Patrick Ohly 3c0fee9536 PIM: support location = GEO property (FDO #60373)
Exposed as "location" -> (lat, long) in the D-Bus bindings.
Reading, writing and updating are supported. Depends on a folks
release which has the patch which adds FolksLocationDetails.

Default EDS test data now includes GEO. Several peers do not support
it, which gets ignored by synccompare.
2013-02-26 12:03:43 +01:00
Patrick Ohly 0dfc364d82 PIM: support groups = CATEGORIES (FDO #60380)
Allow reading and writing of groups (folks terminology), aka
CATEGORIES in vCard.
2013-02-26 12:03:43 +01:00
Patrick Ohly b81aa5ab3c engine: support GEO property (part of FDO #60374)
Was lost earlier during syncing. Must be defined in field list and
vCard profile. Still not supported by PIM Manager, because folks doesn't
support it (see FDO #60373).
2013-02-26 12:03:42 +01:00
Patrick Ohly 2659d3358b PIM: fix memory leaks during writing of contacts
Constructing the GValues created additional references instead
of taking over ownership as intended. For refcounted GObject,
the solution is to pass the instance and let GValue take the
reference.

For other cases, ownership of a new instance is transfered to the
GValue using the new constructors with a boolean flag.
2013-02-26 12:03:42 +01:00
Patrick Ohly cf30d7b0fe GValue: support constructors which take ownership
The existing constructors with native data pointers
always copied data or increased the reference counter.
It is useful to store the result of creation methods
directly in a GValue, so allow that with a second
variation of the constructors which explicitly take
an "addRef" parameter.
2013-02-26 12:03:42 +01:00
Patrick Ohly 4add4e91fe syslog: fix read-after-free bug
openlog() expects the string to remain valid. Must ensure that in
LoggerSyslog by making a copy. Found with valgrind.
2013-02-26 12:03:42 +01:00
Patrick Ohly 0c99abad29 PIM testing: D-Bus methods thread-safe
The test must be activated by compiling manager.cpp with
PIM_MANAGER_TEST_THREADING and then runs start() in a new
thread which gets created during startup.
2013-02-26 12:03:42 +01:00
Patrick Ohly 612db449d5 PIM Manager: make some of the D-Bus methods thread-safe, attempt II
The first attempt was buggy: the idle callback is always active and
prevents sleeping => 100% CPU load. It also seems to prevent proper
shutdown somehow.

This version is much simpler. It removes the task queue and the
manager's idle callback. Instead the non-main thread adds an idle
callback itself which gets run once. To have the main thread notice
the new idle callback, g_main_context_wakeup() is used, as before.

The reason for not using this approach before was that the glib
documentation only mentioned GAsyncQueue as one of its structures
which are thread-safe. A look at the code shows that GMainContext and
GMainLoop are also thread-safe.
2013-02-26 12:03:42 +01:00
Patrick Ohly fecfd3f69d PIM Manager: make some of the D-Bus methods thread-safe
This adds the infrastructure for shifting the work of the D-Bus
methods into the main thread if called by another thread, which may
happen when we add other bindings for them.

Work is shifted to the main thread via a GAsyncQueue +
g_main_context_wakeup(). The calling thread then blocks waiting on a
condition variable until signaled by the main thread. Results are
stored for the calling thread as part of the operation that it
provides. Exceptions in the main thread are caught+serialized as
string and deserialized+rethrown in the calling thread - a bit crude,
but should work and reuses existing code.
2013-02-26 12:03:42 +01:00
Patrick Ohly 501c32c06d Exception: tryRethrow() can be used to throw in all cases
It is useful to let tryRethrow be used in a mode where it never
returns. The PIM Manager will use that.
2013-02-26 12:03:42 +01:00
Patrick Ohly 771d630400 glib: support ...CXX::steal() and ..StealCXX() for non-GObject
This makes the C++ plain GLib types like GMainLoop consistent
with their GObject counterparts.
2013-02-26 12:03:42 +01:00
Patrick Ohly 388a196510 CalDAV: work around Google server regression (undeclared namespace prefix in XML)
Google CalDAV currently sends invalid XML back when asked to include
CardDAV properties in a PROPFIND. This gets rejected in the XML
parser, which prevents syncing calendar data:
   Neon error code 1: XML parse error at line 55: undeclared namespace prefix

The incorrect XML is this:
  <D:propstat>
   <D:status>HTTP/1.1 404 Not Found</D:status>
   <D:prop>
   ...
    <caldav:max-attendees-per-instance/>
    <ns1:addressbook-home-set xmlns:ns1="urn:ietf:params:xml:ns:carddav"/>
==> <ns1:principal-address/>
    <ns1:addressbook-description/>
    <ns1:supported-address-data/>
    <ns1:max-resource-size/>
   </D:prop>
  </D:propstat>

This was introduced on the server side sometime after December 12nd
2012 (tests run at that time showed a different response) and does not
affect SyncEvolution 1.2 because it did not yet ask for CardDAV
properties.

The workaround on the client side is to ask for only the properties
which are really needed.
2013-02-26 12:03:42 +01:00
Patrick Ohly e83b58e933 PIM testing: include PHOTO data in testSync
Photo data is special. Syncing it was not covered elsewhere, so
include it in the testSync test.
2013-02-26 12:03:41 +01:00
Patrick Ohly 0d2201605a PIM testing: fixed testSync with Nokia phone
Must exclude SyncML configs and logs when checking files. Ignore the
empty vCard that the N97 mini insists on sending via PBAP.
2013-02-26 12:03:41 +01:00
Patrick Ohly 83cdc39c66 PIM testing: handle missing config dirs
Don't try to list non-existent directories, that causes an uncaught
Python exception. Happens when using testpim.py for the first time
in a clean directory.
2013-02-26 12:03:41 +01:00
Patrick Ohly b202533b7d command line: recover from slow sync with new sync modes
The error message for an unexpected slow sync still mentioned
the old and obsolete "refresh-from-client/server" sync modes.
Better mention "refresh-from-local/remote".
2013-02-26 12:03:41 +01:00
Patrick Ohly 505b2cd63d Merge tag 'syncevolution-1-3-99-2' 2013-02-26 12:02:16 +01:00
Mario Kicherer 57a6c5a214 sqlite: add #include <stdio.h>
Fails to compile on Gentoo with gcc 4.5.4 otherwise because the header
file is needed for sprintf.
2013-01-15 16:26:12 +01:00
Patrick Ohly 453ee98740 autotools: bump version to 1.3.99.2 2012-12-12 18:57:17 +01:00
Patrick Ohly 16a532893b Revert "SyncML: workarounds for broken peers"
This reverts commit 3a71a2bf53 and
commit a0375e0160.

Need to back out the workaround for broken peers because it breaks
SyncEvolution<->SyncEvolution syncing.
2012-12-12 18:56:10 +01:00
Patrick Ohly f1e7d92265 NEWS, PIM API + README: updated for 1.3.99.2 2012-12-07 20:09:08 +01:00
Patrick Ohly 677f2efd18 testing: support --enable dist=<configure flags>
Allow the runtest.py caller to choose which kind of distcheck
is done. When "dist" has parameters, then those are used
as distcheck configure flags instead of trying out a set
of default ones.
2012-12-07 20:09:08 +01:00
Patrick Ohly cabcfedae7 PIM Manager: don't prevent auto termination when idle
When compiled with PIM Manager, syncevo-dbus-server still should
shut down automatically when idle. Only when the PIM Manager was
started and has (or will have) a unified address book, then keep
the process running.
2012-12-07 20:09:08 +01:00
Patrick Ohly 3a6c0c35c7 debugging: revise suppression rule
The old suppression rule for a problem with ESourceRegistry no
longer matched after introducing EDSRegistryLoader. Support old and
new flavor.
2012-12-07 20:09:08 +01:00
Patrick Ohly c02571bcf5 autotools: fix "make distcheck" when LD_LIBRARY_PATH is set
Because of a space instead of colon the command line for the
link check was broken when LD_LIBRARY_PATH was non-empty.
2012-12-07 20:09:08 +01:00
Patrick Ohly b38c88b40c PIM: avoid compiler warnings in 32 bit
gcc warns about a "long int" vs. "unsigned int" mismatch when
compiling for x86. All of that is in debugging output printfs.
Cast the index_t into long int to avoid that.
2012-12-07 20:09:08 +01:00
Patrick Ohly 2e48d4ef9d PIM: fix signed/unsigned comparison warning
g++ in contrast to clang++ warns about this.
2012-12-07 20:09:08 +01:00
Patrick Ohly 3a71a2bf53 SyncConfig: fix g++ 4.4 compile issue
Another workaround for the "is_any_of + array out of bounds" g++ 4.4
problem.
2012-12-07 20:09:08 +01:00
Patrick Ohly 34cf32750d glib: add bool cast to CXX pointers
Some gcc version did not like the usage of a smart pointer in a
boolean and expression (something about ambiguous conversion). Fixed
by making the conversion explicit, as NULL check.
2012-12-07 20:09:08 +01:00
Patrick Ohly 59b858167b PIM testing: adapt test runtime for automated testing
Running under valgrind can be slow, increase timeouts as needed and/or
reduce problem size.
2012-12-07 20:09:08 +01:00
Patrick Ohly ec8f063985 PIM testing: writing contacts needs country
testContactWrite includes a phone search, which depends on having a
valid country code. Ensure that by setting the locale via env
variables.
2012-12-07 20:09:08 +01:00
Patrick Ohly 3f8a9ccc02 PIM + EDS: use direct read mode if available
Check for e_book_client_new_direct() in configure and use it if
found. This enables direct reading from the EDS file backend in the
direct searching of EDS address books.
2012-12-07 20:09:08 +01:00
Patrick Ohly 07b82c9c64 PIM: allow configuration of session dirs (part of FDO #55921)
Useful for moving the session directories to a temporary file system.
They are essentially just useful for debugging when used as part of
PIM Manager.

- "logdir" - a directory in which directories are created with
             debug information about sync session
- "maxsessions" - number of sessions that are allowed to exist
                  after a sync (>= 0): 0 is special and means unlimited,
                  1 for just the latest, etc.;
                  old sessions are pruned heuristically (for example,
                  keep sessions where something changed instead of
                  some where nothing changed), so there is no hard
                  guarantee that the last n sessions are present.
2012-12-07 20:09:08 +01:00
Patrick Ohly 8f9669ec97 PIM + sync: write less data to disk (part of FDO #55921)
Avoid writing config file changes to disk by enabling a new
"ephemeral" mode for syncing via the PIM Manager. This mode is enabled
via the sync mode parameter of the D-Bus API and from there passed
through to the SyncConfig and local sync helper. It cannot be enabled
in the config files (yet?).

In this mode, config file changes are not flushed resp. discarded
directly in the config nodes. This prevents writing to .ini files in
~/.config.

The "synthesis" binfile client files are still written, but they get
redirected into the session directory, which can (and should) be set
to a temp file system and get deleted again quickly.

Data dumps are turned off now in the configs created by the PIM
Manager.
2012-12-07 20:09:08 +01:00
Patrick Ohly 489e379440 PIM Manager: command line option for starting unification
As mentioned in FDO #56334, automatically starting folks
to get a unified address book together as soon as possible
makes sense. A new command line option now allows that:

  -p, --start-pim
      Activate the PIM Manager (= unified address book) immediately.
2012-12-07 20:09:07 +01:00
Patrick Ohly 8ac33aa2ef PIM Manager: make API public in C++
The D-Bus API was locked into the Manager class as private methods.
Make them public so that CreateContactManager() can call start(); the
other methods are public now for the sake of consistenty and because
they might be useful elsewhere.
2012-12-07 20:09:07 +01:00
Patrick Ohly 9700079e61 syncevo-dbus-server: log only to syslog by default
The new default is to log error messages to syslog.
Command line options can increase (or reduce) verbosity
and choose whether stdout and/or syslog shall be active:

  -d, --duration=seconds/'unlimited'
      Shut down automatically when idle for this duration
  -v, --verbosity=level
      Choose amount of output, 0 = no output, 1 = errors,
      2 = info, 3 = debug; default is 1.
  -o, --stdout
      Enable printing to stdout (result of operations) and
      stderr (errors/info/debug).
  -s, --no-syslog
      Disable printing to syslog.

To get the same behavior as before when debugging via the Python
scripts, "--no-syslog --stdout --verbosity=3" is passed to
syncevo-dbus-server when started via Python.
2012-12-07 20:09:00 +01:00
Patrick Ohly 91c4960f1e LoggerSyslog: remove unused members, add stacking support
m_startTime and m_processName were not used, can be removed. Instead
add tracking of the parent logger and forward messages to that, to
allow combining LoggerSyslog with some other logger (for example,
stdout or redirection).
2012-12-07 20:00:44 +01:00
Patrick Ohly 34b4b8048e D-Bus server: use glib command line parsing
Instead of the home-grown argv parsing, use glib commandline option
parser. That gives us --help output and will make it easier to add
more options.
2012-12-07 20:00:44 +01:00
Patrick Ohly e80ce47b47 PIM: store set of active address books persistently (FDO #56334)
Together with storing the sort order persistently, this allows
restarting the daemon and have it create the same unified address book
again.

The set is stored as comma, space or tab separated list of words in
the value of the "active" property in the
~/.config/syncevolution/pim-manager.ini file.
2012-12-07 20:00:44 +01:00
Patrick Ohly 34562f4893 PIM: share ESourceRegistry via libsyncevolution
Switch to the new EDSRegistryLoader from libsyncevolution. This will
allow sharing the ESourceRegistry with the EDS backend.

We use the asynchronous loading method, to avoid blocking the
server. This requires turning the search() method into an asynchronous
method. The actual code runs once the ESourceRegistry is available,
whether it is needed or not (keeps the logic simpler and minimizes
code changes).

To avoid reindenting the old code, the try/catch block and error
checking for the callback was added in a separate intermediate
function which then calls the old code.
2012-12-07 20:00:44 +01:00
Patrick Ohly 36eaa323bc Boost helper: support weak pointer indirection for up to 9 parameters
Adding more variants of the NULL pointer checked method invocation to
cover up to 9 parameters. Needed by PIM Manager.
2012-12-07 20:00:44 +01:00
Patrick Ohly a7c1475b79 EDS: share ESourceRegistry via libsyncevolution
Switch to the new EDSRegistryLoader from libsyncevolution. This will
allow sharing the ESourceRegistry with the PIM Manager.
2012-12-07 20:00:44 +01:00
Patrick Ohly 976c6bd769 EDS: shared loading of ESourceRegistry
Add a class, EDSRegistryLoader, which owns the creation of
ESourceRegistry and notifies other components synchronously or
asynchronously when the instance is ready.
2012-12-07 20:00:44 +01:00
Patrick Ohly 43073081c0 PIM: remove colon from valid peer UID character set (FDO #56436)
Using the UID as part of file names gets more problematic when
allowing colons. Remove that character from the API and enforce
the format in the source code.
2012-12-07 20:00:44 +01:00
Patrick Ohly 7bfa3f63eb PIM: ViewAgent.Quiescent() optional (FDO #56428)
Document the new callback, make it optional and add tests, also for
the old behavior of "close view when ViewAgent methods return error".
2012-12-07 20:00:44 +01:00
Patrick Ohly 175a436839 PBAP: databaseFormat + filter fields
Print filter fields as part of the debug output and document the
semantic of databaseFormat (was only in a commit message before).
2012-12-07 20:00:44 +01:00
Patrick Ohly 8bf486427f PIM: search for phone number in EDS directly during startup
Bypass folks while it still loads contacts and search for a phone
number directly in EDS. This is necessary to ensure prompt responses
for the caller ID lookup.

Done with a StreamingView which translates EContacts into
FolksIndividuals with the help of folks-eds = edsf.

Combining these intermediate results and switching to the final
results is done by a new MergeView class.

A quiescence signal is emitted after receiving the EDS results and
after folks is done. The first signal will be skipped when folks
finishes first. The second signal will always be send, even if
switching to folks did not change anything.

Together with an artificial delay before folks is considered done,
that approach make testing more reliable.
2012-12-07 20:00:36 +01:00
Patrick Ohly 970e4c5b5f EDS: shared common EDS Client API inside SyncEvolution
The PIM code and the EDS backend both need access to common classes
(like the smart pointers) and eventually will share one instance of
the ESourceRegistry.
2012-12-05 15:33:46 +01:00
Patrick Ohly f26c98d430 PIM testing: improved core infrastructure
Log "quiescence" signal. Avoid starting the initial search if "search
== None". Both will be needed for startup search testing.

While at it, use the "quiescence" signal to continue after the initial
search. Much faster than always waiting 5 seconds.
2012-12-05 15:33:46 +01:00
Patrick Ohly cbd6ab0ecc PIM: refactor folks classes
Move IndividualView, FullView and FilteredView into separate source
files. They are large enough to justify that and it'll avoid header
file dependency cycles.

Introduce a new View base class, which contains the "start"
functionality and a new name for debug messages.

The new StreamingView is based on it and will be used for reporting
results in an EDS query.

Avoid passing NULL IndividualCompare pointer to views. Instead make
the CompareFormattedName class available as the default compare
method.
2012-12-05 15:33:33 +01:00
Patrick Ohly 437abf1606 Folks: better check for NULL persona
While it is likely that there is a GError when adding a persona fails,
better check for it explicitly. The code would crash with a NULL
persona pointer.
2012-12-03 17:14:48 +01:00
Patrick Ohly 37ed37fd08 glib: support return parameters in GAsyncReady finish function
Some finish functions must return more values than just the return
value of the finish function. They do that via return
parameters. Support that by first switching via the arity of the
finish function and then based on types of the parameters + return
value.

Up to five parameters for the finish function are now supported. To
minimize the number of different combinations, only two variantions
are supported once return values are involved:
- non-void return value, GError * as last parameter
- non-void return value, no GError

The special semantic of GError is preserved (owned by callback
wrapper). All other results must be freed by the C++ callback.

To have a sane ordering of results, return value and GError were
swapped, leading to the following ordering:
 - return value of the _finish call, if non-void
 - all return parameters of the _finish call, in the order
   in which they appear there
 - a GError is passed as "const GError *", with NULL if the
   _finish function did not set an error; it does not have to
   be freed.

This affects only one place, the handling of
folks_persona_store_add_persona_from_details in the PIM module.
2012-12-03 17:14:48 +01:00
Patrick Ohly 3d2a5bb864 glib: added reset() to GList utility class
reset() with same semantic as boost::shared_ptr::reset()
makes sense...
2012-12-03 17:14:48 +01:00
Patrick Ohly 2bba8ed198 glib: improved cast to pointer in GOBJECT_TYPE
The cast could not be used on const smart pointers, although get() on
such a pointer, because the "const" qualifier was missing on the cast
operator.
2012-12-03 17:14:48 +01:00
Patrick Ohly 00d1614e62 PIM: limit number of search results (FDO #56142)
A 'limit' search term with a number as parameter (formatted as string)
can be added to a 'phone' or 'any-contains' search term to truncate the
search results after a certain number of contacts. Example:
  Search([['any-contains', 'Joe'], ['limit', '10']])
  => return the first 10 Joes.

As with any other search, the resulting view will be updated if
contact data changes.

The limit must not be changed in a RefineSearch(). A 'limit' term may
(but doesn't have to) be given. If it is given, its value must match
the value set when creating the search. This limitation simplifies the
implementation and its testing. The limitation could be removed if
there is sufficient demand.
2012-12-03 17:14:48 +01:00
Patrick Ohly bdf8d33f44 Folks: fix change emission in FilteredView + removal of contacts
Fix the order of changes to internal data structures and emitting
change signals so that the changes are completed first. That way, if
the change signals are hooked up to classes which call the view back,
those calls can be processed correctly.

The code for removing a contact did this incorrectly: it skipped
updating the indices when the removed contact wasn't included in the
filtered view, although indices in the parent changed.
2012-12-03 17:14:48 +01:00
Patrick Ohly d79bc6943f Folks: fix refining a search
Due to not mapping the local index in the view to the parent's index,
refining only worked in views where parent and child had the same
index for the contacts in the search view.

Make the tests more complex to trigger this bug and fix it by adding
the required indirection.
2012-12-03 17:14:48 +01:00
Patrick Ohly d7ee52ac8e PIM testing: cover SetActiveAddressBooks() + system address book (FDO #57209)
Also include the system address book in testing. May matter because
folks considers it the primary address book and thus has special
cases involving it.
2012-12-03 17:14:48 +01:00
Patrick Ohly 88bc31e1b4 PIM testing: cover SetActiveAddressBooks() (FDO #57209)
This test creates three address books with (by default) 100 contacts
each and then selects different permutations of them. This found a bug
in folks where disabling address books had no effect (see
https://bugzilla.gnome.org/show_bug.cgi?id=689146, patch is pending
review).
2012-12-03 17:14:48 +01:00
Patrick Ohly d77e5053cc PIM: pre-compute normalized telephone numbers
Looking up by phone number spends most of its cycles in normalizing of
the phone numbers in the unified address book. Instead of doing that
work over and over again during the search, do it once while loading.

This has implications for several classes:
- IndividualData must be extended to hold the pre-computed values;
  what kind of data can be stored there is currently hard-coded
  in the LocaleFactory base class, to keep it simple and minimize
  memory fragmentation.
- Internal contact changes and access must be based on IndividualData,
  not FolksIndividual.
- FullView must know which LocaleFactory will pre-compute the data.
- Changing contacts may have no effect on sorting, but may lead
  to different pre-computed data.

Looking up a phone number only once does not gain from this change, it
even gets slower (more memory intensive, less cache locality). Only
searching multiple times becomes faster.

Ultimately it would be best to store the normalized strings together
with the telephone number inside EDS when the contact gets
created.
2012-12-03 17:14:48 +01:00
Patrick Ohly d92b237e37 PIM testing: test changing telephone numbers
Caching normalized telephone numbers will lead to two special cases:
- contact changed directly in EDS
- contact changed through folks

Cover both cases with extensions to testFilterLive and
testContactWrite.
2012-12-03 17:14:48 +01:00
Patrick Ohly f3d9383d4c Folks: remove dead unit tests
The unit tests did not work because creating FolksIndividual
instances with attributes is not supported unless they come from
a specific folks backend.

Removing them in preparation of changing the API of
IndividualAggregator (pass LocaleFactory for pre-computing values).
2012-12-03 17:14:48 +01:00
Patrick Ohly 0204764b98 Folks: fix writing contact, support photo and notes
folks and EDS do not support writing properties in parallel
(https://bugzilla.gnome.org/show_bug.cgi?id=652659). Must serialize
setting of modified properties.

Once that is done, we can also write photos ("is modified" check was
missing, now done with some code refactoring) and notes (which somehow
always end up being treated as "modified").

Set empty values if empty in D-Bus and non-empty in folks. Without
that step, properties that were removed via D-Bus would not get
removed inside folks.

We really must create empty sets. A NULL pointer is not accepted by
folks. Somehow it leads to internal "timeout" errors inside folks.
2012-12-03 17:14:48 +01:00
Patrick Ohly 7383ff0525 PIM Manager: avoid sending empty "roles"
It can happen that Folks has non-empty roles details, but the
containes roles do not contain values that SyncEvolution exposes via
D-Bus. When checking whether "roles" must be added to the top-level
dictionary, the "non default" check must do a deep dive into the
content of the set, instead of just checking for non-empty (as for
other sets).
2012-12-03 17:14:48 +01:00
Patrick Ohly f2dcd84bb2 GDBus libdbus + GIO: missing out parameters in D-Bus introspection XML (FDO #57292)
The problem is in the C++ D-Bus binding. If the method that gets bound
to D-Bus returns a value, that value is ignored in the signature:
 int foo() => no out parameter

It works when the method is declared as having a retval:
 void foo (int &result) => integer out parameter

This problem exists for both the libdbus and the GIO D-Bus
bindings. In SyncEvolution it affects methods like GetVersions().

The fix consists of always returning a type for the R return type in
the libdbus bindings. getReturn() returned "" because the type was not
a retval. In the GIO binding, the R type was not handled at all. Also
move some common code into a helper function.
2012-12-03 17:14:48 +01:00
Patrick Ohly c1391b954f Folks: improve performance of FullView sorting
This fixes the hotspot during populating the FullView content: moving
contacts around required copying IndividualData and thus copying
complex C++ structs and strings. Storing pointers and moving those
avoids that, with no lack of convenience thanks to boost::ptr_vector.

Reordering also becomes faster, because the intermediate copy only
needs to be of the pointers instead of the full content.
2012-12-03 17:14:48 +01:00
Patrick Ohly 1e11ebd3a8 PIM Manager: detect NOP SetSortOrder()
When SetSortOrder() just sets the order which is already in use,
then nothing needs to be done.
2012-12-03 17:14:48 +01:00
Patrick Ohly dc479157dd PIM example: add benchmarking
The new "checkpoints" split up the whole script run into pieces which
are timed separately, with duration printed to stdout. In addition,
tools like "perf" can be started for the duration of one phase.

Benchmarking is different from permanently reading and monitoring
changes. --read-all enables a single read operation once the initial
set of new contact IDs are known.
2012-12-03 17:14:48 +01:00
Patrick Ohly a4a843ceea PIM example: make sync.py executable 2012-12-03 17:14:47 +01:00
Patrick Ohly 53011249e7 PIM: fix quiescence signal
The signal was not sent reliably. Now it is guaranteed to be sent once
when a search has finished sending its initial results, and not
sooner.

This makes it possible to rely on the "Quiescence" signal when
checking whether the current data contains some contact or not.
2012-12-03 17:14:47 +01:00
Patrick Ohly 88b7663596 Folks: fix starting when done via search
When the unified address book (= FullView) was not running yet at the
time when a client wanted to search it, the unified address book was
not started and thus the search never returned results.

Will be tested as part of the upcoming testFilterQuiescence.
2012-12-03 17:14:47 +01:00
Patrick Ohly 307c5a17a6 D-Bus testing: typo quiesence -> quiescence
Only affected a comment string.
2012-12-03 17:14:47 +01:00
Patrick Ohly b89b37fc8c PIM: typo quiesent -> quiescent
The typo affected both internal variables and the API's "Quiescent"
signal. "Quiescence" was also spelled wrong.
2012-12-03 17:14:47 +01:00
Patrick Ohly 1b18051270 PIM examples: added verbosity to search.py
Running at full verbosity is much too slow when there many
contacts. Therefore adding:

  --verbosity=VERBOSITY
                        Determine what is printed. 0 = only minimal progress
                        messages. 1 = also summary of view notifications. 2 =
                        also a one-line entry per contact. 3 = also a dump of
                        the contact. 4 = also debug output for the script
                        itself.
2012-12-03 17:14:47 +01:00
Patrick Ohly 85775caf4d PIM: add --debug to sync.py example
The --debug command line flag enables printing of the debug output
sent by SyncEvolution over D-Bus. To capture it in a timely manner,
the running method calls must be done asynchronously with a running
main loop.

This also solves the timeout problem more nicely and is closer to how
a real application should be written.
2012-12-03 17:14:47 +01:00
Patrick Ohly daba264160 PIM: implement contact ID, part II
Use contact IDs in ReadContacts(). Finding the contacts in the view is
done with an (almost) brute force search: a linear search looks at all
contacts and compares against the requested ID. The only enhancement is
that searching starts at the index of the previous contact, which makes
it a bit more efficient when reading consecutively.
2012-12-03 17:14:47 +01:00
Patrick Ohly 48be1eb1ff PIM: implement contact ID, part I
As first step, notifications and contact data include the new string
ID. It is a direct copy of the FolksIndividual ID. The next step is
to adapt the ReadContacts() implementation.

The change primarily affects notification buffering in the
Manager. Not only does it have to remember ranges, but also the
corresponding IDs.

The Python test now stores either a ID or a dictionary at each view
entry. This required changing all comparisons against None, the
previous value for "no data". The assertions in ContactsView now use
the unittest assertions because they produce nicer error output, and
these errors get logged via Python (to make them show up in the D-Bus
log together with the other logging of the notification callbacks).

As before, the ContactsView class is picked up as a test class with no
test members. Request that unittest skips it (will still show up in
testpim.py output, though).
2012-12-03 17:14:47 +01:00
Patrick Ohly 1609fb9532 PIM API: introduce string ID for contacts
This simplifies writing clients which want to read all new or modified
contacts. Previously, with just a range being used in ReadContacts(),
the client had to be prepared to re-issue reads when changes to the
range happened on the server before the request was processed.

The ViewAgent notifications all take IDs. For added contacts the need
is obvious. For modified contacts it comes from the situations where
one contact replaces another. This was already possible before, so the
comment about "temporarily appear at two different positions" merely
documents existing behavior. Removal notifications include the ID
primarily for consistency with the other notifications. It was also
already useful for debugging.
2012-12-03 17:14:47 +01:00
Patrick Ohly eefd7d248e GDBus GIO: add support for deque and list
The actual implementation is the same as for vector, with D-Bus array
on the D-Bus side. Now the common code is in a template base class and
referenced by the traits for vector, list and deque.

No attempt is made to automatically pick that trait for other classes
which also could be treated like an ordered collection of items.
2012-12-03 17:14:47 +01:00
Patrick Ohly 1c043630c2 Folks: fix incorrect contact removal signals in filtered view
The filtered view did not check whether a parent's removed contact was
really part of the view before sending a removal signal for it. Was
not (and still isn't) found by unit tests because the expected signals
were sent and the tests don't wait for the superfluous additional
removal signals.
2012-12-03 17:14:47 +01:00
Patrick Ohly a0375e0160 SyncML: workarounds for broken peers
Some peers have problems with meta data (CtCap, old Nokia phones) and
the sync mode extensions required for advertising the restart
capability (Oracle Beehive).

Because the problem occurs when SyncEvolution contacts the peers
before it gets the device information from the peer, dynamic rules
based on the peer identifiers cannot be used. Instead the local config
must already disable these extra features in advance.

The "SyncMLVersion" property gets extended for this. Instead of just
"SyncMLVersion = 1.0" (as before) it now becomes possible to say
"SyncMLVersion = 1.0, noctcap, norestart".

"noctcap" disables sending CtCap. "norestart" disables the sync mode
extensions and thus doing multiple sync cycles in the same session
(used between SyncEvolution instances in some cases to get client and
server into sync in one session).

Both keywords are case-insensitive. There's no error checking for
typos, so beware!

The "SyncMLVersion" property was chosen because it was already in use
for configuring SyncML compatibility aspects and adding a new property
would have been harder.
2012-12-03 17:14:47 +01:00
Patrick Ohly f0308a9386 EDS: fix creating databases
--create-database was broken in combination with the final code in EDS
3.6 because it passed NULL for the UID to e_source_new_with_uid(),
which is considered an error by the implementation of that
method. Must use e_source_new() if we don't have a UID.
2012-12-03 17:14:47 +01:00
Patrick Ohly d9202d2297 PIM testing: avoid premature timeouts during sync
When running under a debugger or valgrind, the SyncPeer()
call can take a long time. Use "infinite" timeout.
2012-12-03 17:14:47 +01:00
Patrick Ohly afc19138af Folks: use GeeStringCollection
Cosmetic change, use common definition of the helper class.
2012-12-03 17:14:47 +01:00
Patrick Ohly eeda8f3043 gee: define GeeStringCollection type
This is GeeCollCXX for "gchar *".
2012-12-03 17:14:47 +01:00
Patrick Ohly 1ed9a9c466 gee: fix memory leak in GeeCollCXX
gee_collection_iterator_get() always transfers ownership. The caller
must g_free() (for strings) or unref (for GObjects) the returned value.

The revised GeeCollCXX does this automatically, with GObject being the default
(relies on the GObject intrusive pointer template classes) and "gchar *" a
special case in the template specialization of an utility traits class.

The usage is almost as before. However, because of the reliance on
SE_GOBJECT_TYPE, that macro must have been used for all types over which
is to be iterated. Requires moving some definitions into header files
where they can be shared.
2012-12-03 17:14:47 +01:00
Patrick Ohly 36d7e5f64b glib: use template class for GObject intrusive pointer + "steal" references
The main motivation is that it allows other template classes to define a smart
tracking pointer for an arbitrary GObject-derived type. Adding a second flavor
of the class where the constructor with a plain pointer takes over ("steals")
the reference becomes easy.

The caveat is that the template is still unusable without the SE_GOBJECT_TYPE
macro for the type, because without the macro there is no suitable
intrusive_ptr_add_ref/release.

Using a template instead of expanding source code might also be slightly
more efficient regarding compile time. It allows setting breakpoints.

It would be nice to have a default implementation of that which the C++
compiler picks if and only if the pointer is derived from GObject.
Unfortunately that relationship is opaque to the compiler (struct starts
with GObject, but that does not enable any special relationship at the
semantic level). Perhaps play tricks based the common conventions for naming
that first instance ("parent", "parent_instance", "parent_object")?

The change is almost transparent for users of SE_GOBJECT_TYPE,
except for one thing: the defined CXX name is now a typedef instead
of a class. This prevents simple forward declarations, thus folks.h
had to include individual-traits.h.
2012-12-03 17:14:47 +01:00
Patrick Ohly 9630aef090 glib: fixed memory leak in some GAsyncReady helpers
The callback was allocated with new for the duration of the operation
and must be deleted. Was done via try/catch in some cases, but not all.

The better solution is to use RAII and store the instance in an auto_ptr
as soon as that is possible again.
2012-12-03 17:14:47 +01:00
Patrick Ohly 57f39003ef Folks: temporarily disable saving of notes
The comparison fails in nightly testing and causes unnecessary
property changes, which in turn causes the complete test to fail.
See https://bugzilla.gnome.org/show_bug.cgi?id=652659

Disable saving notes to get the test to pass.
2012-12-03 17:14:47 +01:00
Patrick Ohly 4a7582e28b testing: ignore minor leak in libedataserver
Looks like a minor one-time leak inside the account handling
code of libedataserver.
2012-12-03 17:14:47 +01:00
Patrick Ohly 953edd89cf PIM testing: permanently ignore static mutext memory loss
Seems related to the deprecated static recursive mutex that
the vala compiler is using. Not much that can be done about
that.
2012-12-03 17:14:47 +01:00
Patrick Ohly 9acdb5b3bc Revert "Folks: temporarily ignore memory leaks"
This reverts commit 42145be68d.
2012-12-03 17:14:47 +01:00
Patrick Ohly 7c4a957ca6 Merge tag 'syncevolution-1-3-2'
Conflicts:
	NEWS
	configure.ac
2012-11-29 21:52:59 -08:00
Patrick Ohly 340579cbdb Merge branch 'HARMATTAN-1-3-1'
Fetched the code and its history from the 1.3.1 archives at:
http://people.debian.org/~ovek/maemo/
http://people.debian.org/~ovek/harmattan/

Merged almost everything, except for Maemo/Harmattan specific build files:
  autogen-maemo.sh builddeb buildsrc debian

The following changes were also removed, because they are either local
workarounds or merge artifacts which probably also don't belong into
the Maemo/Harmattan branch:

diff --git a/configure.ac b/configure.ac
index cb66617..2c4403c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -44,7 +44,7 @@ if test "$enable_release_mode" = "yes"; then
    AC_DEFINE(SYNCEVOLUTION_STABLE_RELEASE, 1, [binary is meant for end-users])
 fi

-AM_INIT_AUTOMAKE([1.11.1 tar-ustar silent-rules subdir-objects -Wno-portability])
+AM_INIT_AUTOMAKE([subdir-objects -Wno-portability])

 AM_PROG_CC_C_O

diff --git a/src/backends/webdav/CalDAVSource.cpp b/src/backends/webdav/CalDAVSource.cpp
index decd170..7d338ac 100644
--- a/src/backends/webdav/CalDAVSource.cpp
+++ b/src/backends/webdav/CalDAVSource.cpp
@@ -1282,6 +1282,7 @@ void CalDAVSource::Event::fixIncomingCalendar(icalcomponent *calendar)
     // time.
     bool ridInUTC = false;
     const icaltimezone *zone = NULL;
+    icalcomponent *parent = NULL;

     for (icalcomponent *comp = icalcomponent_get_first_component(calendar, ICAL_VEVENT_COMPONENT);
          comp;
@@ -1295,6 +1296,7 @@ void CalDAVSource::Event::fixIncomingCalendar(icalcomponent *calendar)
         // is parent event? -> remember time zone unless it is UTC
         static const struct icaltimetype null = { 0 };
         if (!memcmp(&rid, &null, sizeof(null))) {
+            parent = comp;
             struct icaltimetype dtstart = icalcomponent_get_dtstart(comp);
             if (!icaltime_is_utc(dtstart)) {
                 zone = icaltime_get_timezone(dtstart);
diff --git a/src/backends/webdav/CalDAVSource.h b/src/backends/webdav/CalDAVSource.h
index 517ac2f..fa7c2ca 100644
--- a/src/backends/webdav/CalDAVSource.h
+++ b/src/backends/webdav/CalDAVSource.h
@@ -45,6 +45,10 @@ class CalDAVSource : public WebDAVSource,
     virtual void removeMergedItem(const std::string &luid);
     virtual void flushItem(const string &uid);
     virtual std::string getSubDescription(const string &uid, const string &subid);
+    virtual void updateSynthesisInfo(SynthesisInfo &info,
+                                     XMLConfigFragments &fragments) {
+        info.m_backendRule = "HAVE-SYNCEVOLUTION-EXDATE-DETACHED";
+    }

     // implementation of SyncSourceLogging callback
     virtual std::string getDescription(const string &luid);

Making SySync_ConsolePrintf a real instance inside SyncEvolution leads
to link errors in other configurations. It really has to be extern. Added
a comment to the master branch to make that more obvious:

-extern "C" { // without curly braces, g++ 4.2 thinks the variable is extern
-    int (*SySync_ConsolePrintf)(FILE *stream, const char *format, ...);
-}
+// This is just the declaration. The actual function pointer instance
+// is inside libsynthesis, which, for historic purposes, doesn't define
+// it in its header files (yet).
+extern "C" int (*SySync_ConsolePrintf)(FILE *stream, const char *format, ...);
2012-11-01 19:13:58 +01:00
Patrick Ohly 6648a36578 NEWS + PIM README + autotools: updated for 1.3.99.1 2012-10-26 20:05:57 +02:00
Patrick Ohly 82c58337a1 PIM Manager: add sync and search examples
Syncing configures a phone, caches its data and can remove the peer
again.

Searching shows and modifies the current state (sorting and active
address books) and can run a search view.
2012-10-26 20:05:56 +02:00
Patrick Ohly be64c71fe4 PIM Manager: syncing must not prevent slow syncs
A slow sync is acceptable and necessary in PBAP caching mode. Don't
prevent it.
2012-10-26 20:05:56 +02:00
Patrick Ohly 2b6093441b gitignore: added *.pyc
Needed for testdbus.pyc.
2012-10-26 20:05:56 +02:00
Patrick Ohly ecafb1f1f8 PIM testing: cover GetActiveAddressBooks()
Tested as part of setting up the view. testMerge uses more than
one database. testContactWrite uses the system address book.
2012-10-26 20:05:56 +02:00
Patrick Ohly 26883a8081 PIM Manager: implement GetActiveAddressBooks()
Must translate back from the internal EDS UUID list to the database
IDs as specified by the API.
2012-10-26 20:05:56 +02:00
Patrick Ohly b4ae657ddb PIM Manager: install .service file
For auto-activation via D-Bus a second .service file is needed.
2012-10-26 20:05:43 +02:00
Patrick Ohly 28ad61cd41 testing: ignore one-time leak
Not sure where this happens. Found on Debian Wheezy.
2012-10-25 16:43:51 +02:00
Patrick Ohly 42145be68d Folks: temporarily ignore memory leaks
folks and/or SyncEvolution leak some small amounts of memory,
as reported by valgrind during testing. Ignore these analyzed
problems for now, fix them later.
2012-10-25 16:43:51 +02:00
Patrick Ohly 7e3318db91 Folks: ignore known warnings
folks prints some output when disabling backends which we don't want
to show as SyncEvolution output.
2012-10-25 16:43:51 +02:00
Patrick Ohly d986719845 g++ 4.5 workaround: bool initialization
g++ 4.5 on Debian Wheezy fails to recognize that the boolean variable
gets initialized before use. Keep that compiler happy by explicitly
initializing the variables it complains about.
2012-10-25 16:43:51 +02:00
Patrick Ohly 6d91e26980 command line: fix for --create/remove-database
Renaming "listing" to "acessing" broke testPrintDatabases (because
it needs to suppress that error for KDE, which is not running
during D-Bus testing) and introduced a typo.
2012-10-25 16:43:51 +02:00
Patrick Ohly 5f24f0ed53 PIM testing: distribute test files
Tell autotools to include testpim.py + data files in the source
.tar.gz.
2012-10-25 16:43:51 +02:00
Patrick Ohly 96eeefc568 PIM testing: cover adding/modifying/removing
These operations manipulate the system address book. To avoid
unexpected data loss when a developer runs the script in his
normal environment, check that testpim.py gets run like this:

XDG_CONFIG_HOME=`pwd`/temp-testpim/config \
XDG_DATA_HOME=`pwd`/temp-testpim/local/cache \
PATH=<SyncEvolution install path>/bin:<SyncEvolution install path>/libexec:$PATH
   <path to SyncEvolution source>/test/dbus-session.sh \
   <path to SyncEvolution source>/src/dbus/server/pim/testpim.py

This will use temp-testpim in addition to temp-testdbus in the current
directory for temporary files.
2012-10-25 16:43:51 +02:00
Patrick Ohly 6d225f2627 PIM Manager: implemented adding, modifying, removing contact
Adding depends on conversion from D-Bus into a GHashSet of persona
details.

Modifying uses the same GHashSet as intermediate representation, but
then has to look up the Persona and modify its properties. Currently
each property write triggers a write to EDS, which is inefficient and
worse, deadlocks EDS when many properties are set (see
https://bugzilla.gnome.org/show_bug.cgi?id=652659). As a partial
solution, SyncEvolution checks that a property is really different
before setting it. This is good enough to get a few properties changed
without running into the deadlock. But ultimately this needs to be
improved in folks and fixed in EDS.

The nickname cannot be set or modified. Depends on a folks change, see
https://bugzilla.gnome.org/show_bug.cgi?id=686695

Removing a contact shares the "lookup persona" code with modifying.

All three operations can only be done once the EDS backend is loaded
and the system address book is ready. The actual execution therefore
has to be delayed, which requires making these operations
asynchronous in IndividualAggregator.
2012-10-25 16:43:50 +02:00
Patrick Ohly f53e518746 D-Bus server: enhance asynchronous result reporting
Grant access to stored Result callbacks, needed because PIM manager
needs to report failures and can do that more efficiently when keeping
a copy of just the error callback, instead of adding yet another
boost::bind on top of Result.

Also add factory methods which wrap the D-Bus result object in a
Result instance of the right type. Also needed for PIM manager.
2012-10-25 16:43:50 +02:00
Patrick Ohly 16ca0b0ee9 GDBus GIO: support boost::tuple with up to four values
Requires copy-and-paste for the different number of values.
Like std::pair, it maps to a D-Bus struct.
2012-10-25 16:43:50 +02:00
Patrick Ohly a7eeefb9e2 glib: removed deprecated GLibErrorException
Replaced by static GErrorCXX::throwError(const std::string &action, const GError *err)
2012-10-25 16:43:50 +02:00
Patrick Ohly e8dfd4f3c2 PIM testing: cover ViewControl.RefineSearch
Only tested as part of fixed database content. The only difference
(and potential bug) in live views is that the refined filter must be
remembered by the FilterView (which it does, see the source code).
2012-10-25 16:43:50 +02:00
Patrick Ohly 8df6ddf954 PIM Manager: implement ViewControl.RefineSearch
Only works for a FilteredView. A FullView cannot be retroactively
turned into a search.
2012-10-25 16:43:50 +02:00
Patrick Ohly 484b9d5a3b PIM Manager: implement Manager.Stop() properly and fix delayed starting
Instead of always stopping, first check that there are no views in use
by a client. This can be determined based on the use count of the full
view.

For testing this, an internal, undocumented Manager.IsRunning() D-Bus
method gets added.

While writing the corresponding test, it became obvious that setting the sort
order had the undesired side effect of starting up folks. Aggregation still
didn't run (that gets started by ViewResource), but even just having folks
running is too much for a syncevo-dbus-server that is just used for syncing.
2012-10-25 16:43:50 +02:00
Patrick Ohly 7883cba5f2 PIM Manager: store sort order persistently
The "sort" property in the ini-style ~/.config/config/pim-manager.ini
file stores the string persistently. XDG_CONFIG_ROOT and HOME are
checked to find the file.

Changing the sort order only has an effect if the new order is valid.

Most of the tests are executed with "sort =" (empty), which picks the
simpler builtin sorting from FullView, as before. Other tests check
that the initial content of the .ini file is used and that it gets
modified by SetSortOrder().
2012-10-25 16:43:50 +02:00
Patrick Ohly 3af1e8e1b8 PIM Manager: implement phone number lookup and search
Lookup and search are different: the former is based on a valid
number, the later on user input.

A lookup can compare normalized numbers including the country code, to
ensure that the lookup is exact and does not mismatch numbers from
different countries. Heuristics like suffix matching do not do this
correctly in all cases.

A search is based on user input, which might contain just some digits
in the middle of the phone number. The search ignores formatting in
both input and address book.

In both cases, alpha characters are treated as aliases for their
corresponding digit on a keypad.

The implementation uses Google's libphonebook to implement phone
number normalization and boost::locale to get the ISO-3199 country
code of the current locale.

Here some examples how the implementation works (from the tests),
based on de_DE.UTF-8 locale = DE = +49:

'any-contains 1234', 'any-contains 23', 'any-contains 12/34' find 1234.
'any-contains 5678' finds 56/78.
'any-contains 366227', 'any-contains +1-800-foobar' find +1-800-FOOBAR.
'phone +1800366227' matches +1-800-FOOBAR.
'phone +49897888', 'phone 0897888' all match 089/7888-99 and not
+189788899.
'phone +49897888000' does not match 089/7888-99.
2012-10-25 16:43:50 +02:00
Patrick Ohly 0c4201a07f PIM Testing: cover "any-contains" and FilteredView
The testFilterExisting covers the semantic of "any-contains",
in particular case-insensitiveness when applied to non-ASCII
characters and matching different properties of the individuals.

The testFilterLive covers adding, updating and removing contacts while
a view is active.
2012-10-25 16:43:50 +02:00
Patrick Ohly 9c4ac85e39 PIM: FilteredView
Implement FilteredView, according to the revised API definition
with list of search terms instead of a dictionary.
2012-10-25 16:43:49 +02:00
Patrick Ohly e4cf0e3a3e PIM Locale: implement "any-contains" search
Covers the "any-contains" search, using boost::locale to get a
case-independent representation when asked for case-insensitive
searching. boost::icontains doesn't work as well because it can only
ignore the case of ASCII characters when dealing with UTF-8.

Telephone search still needs to be implemented.
2012-10-25 16:43:49 +02:00
Patrick Ohly 0e6c02b40a PIM Manager: implement removed+added=modified change merging
At least in one case, folks emitted a removed + changed signal
when a contact was modified in EDS. Therefore implement the
merging of these two different change signals into on at the
D-Bus level.
2012-10-25 16:43:49 +02:00
Patrick Ohly 90ef1f063a PIM Manager: enhanced debug output
Include view D-Bus path, to distinguish debug output when multiple
views are active.
2012-10-25 16:43:49 +02:00
Patrick Ohly bfdb9987fb PIM Manager: add "Quiesent" signal
This exposes the internal "stable state reached" information to the
D-Bus client. Useful for testing.
2012-10-25 16:43:49 +02:00
Patrick Ohly 796ccdc878 PIM Manager: revise search API and define searches in SyncEvolution
Using a list of lists allows composing more complex searches.

In SyncEvolution, some basic searches are going to be implemented:
- caller ID lookup ("phone")
- text search ("any-contains")
2012-10-25 16:43:49 +02:00
Patrick Ohly eb28724de0 D-Bus testing: improved logging
Avoid printing the message in runUntil() every 0.1 second.

When running syncevo-dbus-server in a debugger, print to stdout so
that the developer can follow the progress of the Python test.
2012-10-25 16:43:49 +02:00
Patrick Ohly 986fed783e PIM testing: cover sorting with boost::locale
This is based on the API description of the different sort modes. It
does not make assumptions about how the view changes in reaction to
reordering, except that the final result must have the right indices
marked as changed.

The test data uses accents, which must be ignored when using the
de_DE.UTF-8 locale that is set in the environment before starting the
D-Bus server.
2012-10-25 16:43:49 +02:00
Patrick Ohly a9ba05dada PIM: implement sorting with boost::locale
This provides the sorting as described in the API.
Using the phonebook collation is left for later.
2012-10-25 16:43:49 +02:00
Patrick Ohly 2bf7a7359d PIM Manager: revised sorting documentation
Clarify language, change fallback for missing full name to
concatenation of name components starting with first name and ending
with suffix. This is how Google Contacts sorts.
2012-10-25 16:43:49 +02:00
Patrick Ohly f13956bd4b PIM: locale-aware sorting and searching
Change the --enable-dbus-service-pim parameter into one which takes a
parameter that specifies how locale-aware sorting and searching is to
be implemented. The default implementation uses boost::locale. It is
expected to get replaced or augemented by OEMs which want to implement
more complex sorting or searching (like ignoring Tussenvoegsel in the
Netherlands).

The LocaleFactory instance takes the current locale from the
environment. Making it and its users aware of locale changes at
runtime might be needed at some point but is not part of the API at
the moment.

The Manager class uses the factory to handle sorting and searching
requests coming in via D-Bus. Right now, that is not functional yet
because the boost::locale implementation is just a stub. It only
compiles and links.

FullView::setSortOrder is now functional.

Clean up view code a bit:
- All views delay populating their content until the caller asks for
  it. For the FullView this will only happen once, so the caller must be
  able to handle an already populated view, which was missing
  in ViewResource. Still need a test for this.
- Use init(<smart pointer) consistently.
2012-10-25 16:43:48 +02:00
Patrick Ohly 8b5644ad0f PIM Manager: implemented SetActiveAddressBooks()
The set of active EDS databases is set after backends are loaded and
before the aggregator is asked to start. This ensures that we never
load data from inactive databases.

The patch depends on a functional implementation of the
folks_backend_set_persona_stores() method. The
folks_individual_aggregator_new_with_backend_store() is used although
it is not necessary at the moment, because there is only a single
instance of the FolksBackendStore class.

Tests cover running with no active address book and merging data from
two address books. The testMerge test case has several properties.
The one which causes folks to link it is X-JABBER and EMAIL (with
the patch for https://bugzilla.gnome.org/show_bug.cgi?id=685401).
2012-10-25 16:43:48 +02:00
Patrick Ohly c0d1206af6 D-Bus testing: check conditions regularly in runUntil()
Allow checks to change their result without changes inside the event
loop. Previously, the checks were only invoked if there were
events inside the event loop.

Necessary for checking events for a certain period of time.
2012-10-25 16:43:48 +02:00
Patrick Ohly a73030c0fa PIM testing: cover vcard->D-Bus conversion
Imports one vCard into EDS, then checks that reading it via folks and
PIM Manager yields the expected result. Uses pretty much all fields
supported by EDS. Not all of these need to be represented in the PIM
Manager API, see spec.
2012-10-25 16:43:48 +02:00
Patrick Ohly 45b8320967 D-Bus testing: assertEqual for D-Bus, sortLists
unittest.assertEqual() works for standard Python to dbus type
comparisons, but the output for mismatches is very unreadable. The
custom version which is now used everywhere reduces the dbus types to
their Python counterparts, which makes the error output much more
useful (diff with Python 2.7).

Also added an optional sortLists parameter which, if true, normalizes
the lists in the values. This is necessary for D-Bus APIs which return
lists without guaranteeing a specific order of the elements.
2012-10-25 16:43:48 +02:00
Patrick Ohly 9803f41b0a PIM Manager: implemented FolksIndividual -> D-Bus conversion
All the regular contact properties are supported.

Need to update the API documentation.
2012-10-25 16:43:48 +02:00
Patrick Ohly e1953a4c3a GDBus GIO: allow sending "const char *"
Previously, strings had to be passed into GDBus as std::string.
Now "const char *" also works. A NULL pointer is allowed and
is turned into an empty string.
2012-10-25 16:43:48 +02:00
Patrick Ohly 78fe76a592 glib: SE_GLIB_TYPE for types like GMainLoop
Generalization of the code which defined GMainLoopCXX: assumes that
there are _ref/_unref() methods and defines an intrusive boost pointer
for the type.
2012-10-25 16:43:48 +02:00
Patrick Ohly a2b98b2bae PIM Testing: cover full view, including sorting and changes
Add two tests, one with just a single contact which gets added,
modified and removed and one which works with three different
contacts. The second test covers code paths like merging change events
before sending via D-Bus and re-ordering contacts when they get
renamed.

Changing the sort order and searching still need to be implemented and
tested.

Currently the tests only pass when none of the other EDS address books
contain data, because the aggregated view is not limited to the test
address books.
2012-10-25 16:43:48 +02:00
Patrick Ohly 956c3616dd D-Bus testing: improved interactive testing with gdb
Avoid race condition after starting gdb by simply checking for the
presence of syncevo-dbus-server on the session bus. Previously the
output was checked, which failed due to race conditions and/or
unexpected output when setting breakpoints (not investigated further).

Once the test failed, print the failure or error immediately instead
of in the summary after gdb quit. This is information which might be
relevant for debugging the running syncevo-dbus-server.

After gdb quit, don't attempt to read the syncevo-dbus-server output
file (doesn't exit) and don't dump the D-Bus output to the screen
(usually too long to read without less, which is not possible when
doing interactive debugging). Instead point to the log file.
2012-10-25 16:43:48 +02:00
Patrick Ohly a8a3788a58 D-Bus testing: fix loading of .gdbinit
When TEST_DBUS_GDB=1 is set, syncevo-dbus-server gets run under gdb.
That gdb is passed the modified environment with a (potentially)
replaced HOME. In that case gdb needs an explicit -x parameter,
otherwise it won't find the user's .gdbinit.
2012-10-25 16:43:48 +02:00
Patrick Ohly 2c40d33ee7 D-Bus server: support idle callback in Timeout class
The Timeout class now can also invoke the callback when the process is
idle. Pass a negative timeout to trigger that behavior. Most of the
code is similar to waiting for a certain amount of time, which is why
adding that functionality here makes sense despite the slightly
misleading "Timeout" class name.
2012-10-25 16:43:48 +02:00
Patrick Ohly dab4c96f00 D-Bus testing: improved test timeouts and looping in GLib
It was observed that raising an exception in the signal handler did
not propagate to the calling Python code when it was currently in
loop.get_context().iteration().

This commit adds debug logging for timeouts and some utility methods
which avoid the problem by adding logging to the iteration()
call. Python then re-raises the exception in the D-Bus logging code.

This looks like a deficiency (bug?!) of the Python bindings for
iteration() which is merely worked around.

However, the utility methods may also be useful by their own right,
for example to avoid the awkward loop.run() + loop.quit() pairs.
2012-10-25 16:43:48 +02:00
Patrick Ohly f6e979c2fd PIM Manager: implemented watching of folks changes
Adding, updating (via GObject "notify") and removing contacts works.
FullView needs access to the FolksIndividualAggregator for
this.

The order of instantiating was changed so that Manager creates the
FullView as part of starting, instead of having an idle FullView as
envisioned earlier. Seems easier that way.

The CompareFormattedName class (previously only used for unit testing)
is used for sorting in ascending "last, first" by default. It is
convenient for testing, because the sort criteria are plain strings
which can be dumped in a debugger (in contrast to boost::locale
transformed strings). Later this default will have to be replaced with
a true locale aware sorting.

Local changes are delayed and merged as much as reasonably possible in
the Manager before sending them out via D-Bus, to avoid excessive
traffic.

This is done until the underlying view is stable
("quiesent"). Detecting that when reading from libfolks is difficult
(see GNOME feature request #684766). The current approach is to flush
pending changes when the process goes idle. In practice this prevents
merging multiple "add" changes, because the process goes idle between
imports from EDS - probably need further work, either in libfolks or
SyncEvolution (use a timeout after all, despite the extra latency?).

Interaction between delaying change signals and reading contacts must
be handled carefully. The client must be up-to-date when it receives
the results of the read request, and "modified" signals must be
enabled again for the data that was sent.

Normally invalidating the same contacts multiple times is prevented,
because folks sends "modified" signals pretty often (GNOME bug
modified FolksIndividual instances until the process is idle and all
major changes to the instance are (hopefully) done.

There is a slight race condition (client reads contact that was
already modified, SyncEvolution processes "modified" signal later) but
because the result is only that the client is asked to re-read the
contact, that is not a problem.
2012-10-25 16:43:47 +02:00
Patrick Ohly 2fe69bc266 GDBus GIO: store path in DBusObject_t
DBusObject_t is just an alias for std::string, so functional there's
no change. Adding getObject() which returns a const reference to it
allows the caller to use the value in D-Bus traits where the
difference between a plain string and an object path matters.
2012-10-25 16:43:47 +02:00
Patrick Ohly f13ff87e7e PIM Manager: moved D-Bus traits into separate file
It is fairly independent of PIM Manager, so let's keep it in a
separate file.
2012-10-25 16:43:47 +02:00
Patrick Ohly d588e929e1 Folks: disable tests which never worked
The tests were originally added to test compilation of code written
against the proposed APIs. After implementing them it turned out that
creating FolksIndividual instances and setting properties is not
supported by libfolks
(https://bugzilla.gnome.org/show_bug.cgi?id=684557), and thus testing
like this is impossible.

Keeping the tests anyway, without running them, because perhaps such
testing becomes possible at some point (mock FolksIndividual?!) and
the tests still cover compilation against the APIs.
2012-10-25 16:43:47 +02:00
Patrick Ohly a044071e0c PIM Testing: cover StopSync()
The test covers aborting a running sync as well as a pending one; both
goes through different code paths.

The asserts only work in unittest from Python >= 2.7. For testing the
PIM Manager that is okay, because it needs a fairly recent software
elsewhere, too. Only test-dbus.py itself must still work with older
Python.
2012-10-25 16:43:47 +02:00
Patrick Ohly 647cb91fd6 PIM Manager: implement Aborted and BadStatus D-Bus errors
In order to tell the caller more than the default "method failed"
error, the Manager has to know the Result handle of the pending
SyncPeer calls.
2012-10-25 16:43:47 +02:00
Patrick Ohly 8084191132 PIM Manager: document D-Bus errors
org._01.pim.contacts.Manager.Aborted may be useful if the caller of
SyncPeer() wants to distinguish between sync failures (BadStatus) and
intentionally aborted syncs.
2012-10-25 16:43:47 +02:00
Patrick Ohly d1d9ec2406 PIM testing: use real phone in testSync()
If TEST_DBUS_PBAP_PHONE is set to the Bluetooth MAC address (like
A0:4E:04:1E:AD:30) of a phone, PBAP syncing with that phone is tested.

The phone must be paired, connected and support SyncML in addition to
PBAP. The test hard-codes Nokia SyncML settings to keep it simpe and
because Nokia phones are most likely to be used.

X- extensions added by phones as part of the local->SyncML->PBAP
roundtrip are ignored. This can hide issues. For example, the Nokia
N97 Mini incorrectly sends X-CLASS:private in vCard 3.0 mode (should
use CLASS), which is faithfully copied into the local side as-is,
althought it might be better to recognize and translate it. Not a big
deal for X-CLASS, but might be for other properties.
2012-10-25 16:43:47 +02:00
Patrick Ohly 46072a5ae5 PIM testing: cover Manager.SyncPeer()
Uses the SyncEvolution file backend for testing, so that the
test can run without a PBAP-capable and connected phone.
2012-10-25 16:43:47 +02:00
Patrick Ohly a7ae2a67bd PIM Manager: allow "files" as protocol
Allow testing of peer syncing with the SyncEvolution file backend as
target. "database" must be set to a directory name which holds
individual vCard 3.0 files.
2012-10-25 16:43:47 +02:00
Patrick Ohly fcdb78717f PIM testing: initial tests for PIM Manager API
Start testing the new org._01.pim.contacts D-Bus API, as implemented
by SyncEvolution with EDS as storage.

Currently EDS has a race condition where an ESource becomes
unremovable when reusing the UID. Therefore the tests temporarily
avoid doing that.

The sleeps are necessary to prevent problems caused by creating and
removing an ESource before the file monitoring code in
evolution-source-registry can process the file events.
2012-10-25 16:43:47 +02:00
Patrick Ohly 8f27cc95c0 D-Bus testing: allow 'import testdbus'
Turn the 'test' directory into a Python package (by adding
__init__.py) and adding 'testdbus' as symlink (because 'import
test-dbus' is invalid due to the hyphen).

The entire test-dbus.py could have been renamed, but that would entail
changes elsewhere (nightly testing) and make following the history in
the repository harder.
2012-10-25 16:43:47 +02:00
Patrick Ohly 6bcc99e376 D-Bus testing: better way of accessing function properties
Looking up the method via eval() no longer worked when test-dbus.py
was used as submodule. Better look up the function in the current
instance of the class via the method name, which itself can be
extracted from the current test id.
2012-10-25 16:43:47 +02:00
Patrick Ohly a18097e23c PIM Manager: claim the org._01.pim.contacts.manager bus name
The same process now owns two different names on the same connection.
This is transparent for clients; it would be possible to implement
the second service in a different process.
2012-10-25 16:43:47 +02:00
Patrick Ohly f8f5ff3eeb PIM Manager: add getAllPeers()
Matches the code which creates the configs. Has to recreate the
properties based on the information found in the SyncEvolution
configuration.

Runs outside of a Session because it works with an atomic snapshot of
the SyncEvolution configs (no other code can modify it while this code
reads it).
2012-10-25 16:43:47 +02:00
Patrick Ohly cadd53eaba PIM Manager: implement peer operations
The peer properties are are stored as normal SyncEvolution
configurations.  Every peer gets its own context, which contains both
the local source definition for the peer and sync plus target configs.
The special name space prefix "pim-manager-" used to identify them and
avoid potential conflicts with normal SyncEvolution configurations.

Local EDS databases are created with a fixed UID and name that also
have that prefix. One could go one step further than it is currently
done and set these databases to "disabled" in the ESourceRegistry,
which would hide them in Evolution.

Creating the databases via the synchronous SyncEvolution SyncSource
API is cheating a bit - strictly speaking, syncevo-dbus-server should
not call methods which can block, to keep it responsive. The long term
goal for syncevo-dbus-server is to move all SyncSource instantiation
and usage into separate processes, to avoid tainting the D-Bus service
with the mess that loading arbitrary third-party libraries can cause.

Config changes and syncing must be serialized, to avoid race
conditions. The Server class tracks Sessions and only activates one at
a time. This patch hooks into that concept and executes the different
operations once the requested session is the active one.

The PIM Manager doesn't have to keep track of the pending D-Bus calls.
That is done implicitly as part of binding an operation to the Session
instance via the "active" signal. What does have to track are pending
sessions, because it is the owner of those. The shared_ptr in
m_pending are the only strong reference to these sessions.

Removing them (as done in stopSync()) automatically destroys the
session and the pending D-Bus call, which (via the default behavior of
DBusResult in GDBus GIO) will send a generic "method failed" error to
the caller.

If the caller needs to distinguish between "operation cancelled" and
"fatal error", then this indirect tracking of the DBusResult must be
changed so that removing a session can call the failed() method with a
suitable error (to be defined in the API).

The Server and Session classes get extended so that it becomes
possibly to create sessions which do not belong to a D-Bus client and
to query the result of a sync directly.
2012-10-25 16:43:47 +02:00
Patrick Ohly 8ab44f35a0 local sync: allow sync and target context to be the same
It is possible to sync source A in context @X with source B in the
same context @X. The PIM manager is doing that with one context per
peer and databases that are guaranteed to not conflict with anything
else.

Therefore allow such configs. A better check is left for later, if it
really should be needed at all.
2012-10-25 16:43:46 +02:00
Patrick Ohly c0a975ad41 PIM Manager: added support for reading contacts
The key trick is the mapping between FolksIndividual and D-Bus.  The
patch verifies that this can be done via D-Bus traits, without
fleshing out more than the very basics (sending full name).
2012-10-25 16:43:46 +02:00
Patrick Ohly a8118eff89 PIM Manager: initial D-Bus binding
Adds a subset of the D-Bus API to syncevo-dbus-server. Views are
resources that are attached to the client and thus get destroyed
automatically when the client disconnects from D-Bus.

In addition, failures for calls to the client's ViewAgent delete the
view. In this case, the client stays connected, because it might only
have destroyed one agent with others still active.
2012-10-25 16:43:46 +02:00
Patrick Ohly 7651b432c2 folks: added support for retrieving contacts
The choice of std::vector in getContacts() comes from the goal of
using this function more or less directly in a D-Bus implementation.
It works efficiently because the size can be computed in advance.

A more general API, like for example one which stores via some append
iterator, would also have been possible but probably isn't worth
the effort.
2012-10-25 16:43:46 +02:00
Patrick Ohly d260b5e032 folks: allow aggregator to be started multiple times
Only the first call has any effect. Matches the D-Bus API
description.
2012-10-25 16:43:46 +02:00
Patrick Ohly 3691f52ccf folks: initial set of classes for viewing, sorting, searching
The classes on top of libfolks are  designed such that they can
be tested without involving libfolks. Right now the goal is only
to get the API right; most of the actual functionality is missing.

The terminology (added/modified/removed) is aligned with libebook
terminology and the PIM Manager API description.
2012-10-25 16:43:46 +02:00
Patrick Ohly 4107353d14 PIM Manager: autotools + libfolks + API
Initial step towards using SyncEvolution, PBAP and libfolks in the
context of IVI (in-vehicle-infotainment): D-Bus API definition for the
org._01.pim.contact API, --enable-dbus-service-pim, find libs, compile
into syncevo-dbus-server and client-test.

The only functional code at this time is the unit testing of libfolks,
GValueCXX and libgee.
2012-10-25 16:43:46 +02:00
Patrick Ohly 849c5408e5 command line: implement --create/remove-database
Creating a database is only possible with a chosen name. The UID is
chosen automatically by the storage. A new property would be needed
to also specify the UID.

There are no command line tests for the new functionality because
support for it in backends is limited.
2012-10-25 16:43:46 +02:00
Patrick Ohly a4cc410b31 EDS Client: implement creating and deleting databases
Depends on the EDS 3.6 ESourceRegistry API. Needs the very latest EDS
with the following commit. There's no configure check yet because EDS
3.6 is not released yet.

commit 6df76009318eac9dbe3dd49165394d389102764e
Author: Matthew Barnes <mbarnes@redhat.com>
Date:   Tue Sep 11 22:56:08 2012 -0400

    Bug 683785 - Add e_source_new_with_uid()

    Variation of e_source_new() which allows a predetermined UID to be
    specified for a scratch source.  This changes the "uid" property from
    read-only to read/write + construct-only, and eliminates the need for
    EServerSideSource to override the property.
2012-10-25 16:43:46 +02:00
Patrick Ohly f1bbe9802a SyncSource: add API for creating and deleting databases
The API supports creating a database with a specific name and UID. To
avoid ambiguities, deleting is done via the UID.

Looking up the UID for a "database" property value is meant to be
supported by opening the SyncSource and then getting the current
database that was opened.

This allows implementing a delete operation that uses the same
database lookup method as syncing.

All of the new methods have stubs which reject the operation
respectively tell the caller that no information is available. This
was done to avoid having to adapt all derived SyncSources. Support for
the new functionality is optional.
2012-10-25 16:43:46 +02:00
Patrick Ohly faf8814912 D-Bus server: comment update
The TODO is no longer open... use BoostSupport.h!
2012-10-25 16:43:45 +02:00
Patrick Ohly eefb631d28 util: add GetWithDef()
Looks up a value in a map and returns a found value or a default. This
mimicks Python's dict.get().

Because it is not possible in C++ to return None as default, the
returned value is wrapped in a InitState to tell the caller whether
the value was found.

Depends on the unified InitState template.
2012-10-25 16:43:45 +02:00
Patrick Ohly 53b72a035a InitState: merged InitState and InitStateClass
The new InitState template works for both classes and generic types.
The difference is in the kind of base class that it inherits from: the
one for classes "is" an instance of the wrapped type, the other "has"
such an instance. boost::is_class is used to pick the right utility
class, something that had to be done manually previously.

While touching the classes, the explicit initialization with "const
char *" was replace with a more general template constructor.

The main advantage is that other template code, like the D-Bus traits,
no longer needs to distinguish between InitState and
InitStateClass. The InitState implementation did not become
smaller. At least it avoids code duplication (m_wasSet handled in one
place).
2012-10-25 16:43:45 +02:00
Patrick Ohly ea5860b178 GDBus GIO: allow call instances to be const
Using a DBusClient* to make an actual call does not change the object.
The call is independent of the instance used to make it (see also the
previous commit about handling method results for asynchronous calls
after destroying the call instance). Therefore it makes sense to mark
the methods as const.
2012-10-25 16:43:45 +02:00
Patrick Ohly 11f9d90ba2 GDBus GIO: ensure that there is always a reply to a D-Bus method call
Now DBusResult itself tracks whether a reply was sent. If not, it
reports a generic "processing the method call failed" error. If that
error is not good enough for the method implementation, then it must
call failed() itself, as before.
2012-10-25 16:43:45 +02:00
Patrick Ohly 88169d2164 GDBus GIO: finish code refactoring of DBusResult
Two done() calls still used g_dbus_connection_send_message()
directly instead of the common sendMsg() in the base class.
2012-10-25 16:43:45 +02:00
Patrick Ohly cec6865898 GDBus GIO: revamped name owning
Remove global variables and allow addditional names to be owned via
DBusConnectionPtr::ownName().

g_bus_own_name_on_connection() is given shared access to a ref-counted
OwnNameAsyncData (instead of full ownership) because that way it is
guaranteed that the instance is still around while waiting for name
acquisition in undelay().
2012-10-25 16:43:45 +02:00
Patrick Ohly 3004545b0c libgee: C++ wrappers for collections
Primarily this is meant to be used for iterating over collections
in libfolks, which come straight from libgee.

The header file assumes that the corresponding gee header files are
available. A user of it must link against libgee.
2012-10-25 16:43:45 +02:00
Patrick Ohly 2d1d77a3fb GValue: added C++ wrapper
The wrapper enhances type safety (can only assign values of
the right type, enforced at compile time) and automates resource
tracking (g_value_unset() called be destructor). Generic,
boxed values need special treatment because their GType
is not a constant.

The header file assumes that the corresponding glib header files
are available. A user of it must link against libgobject.
2012-10-25 16:43:45 +02:00
Patrick Ohly 26f8af424f EDS Client: work around glib + e_source_registry_new_sync() deadlock
The synchronous version used to deadlock frequently, the asynchronous
one doesn't, so use that instead. The problem was also worked around
later in EDS (commit below), but let's stick to the asynchronous
version anyway to be closer to Evolution.

commit 6c4c1c6a1f40a6873be954a0b9d770e31726bd50
Author: Matthew Barnes <mbarnes@redhat.com>
Date:   Fri Sep 7 07:40:09 2012 -0400

    ESourceRegistry: Work around GType deadlock.

    Work around http://bugzilla.gnome.org/show_bug.cgi?id=683519
    until GObject's type initialization deadlock issue is fixed.
    Apparently only the synchronous instantiation is affected.
2012-10-25 16:43:45 +02:00
Patrick Ohly c997f63b51 EDS: use signalConnect() and boost::bind()
Instead of manually written callback functions, use the C++ helper
code to get C++ code invoked from inside glib. Reduces the code
size and ensures that no exceptions escape into glib C code.
2012-10-25 16:43:44 +02:00
Patrick Ohly 0e2b68d88f glib: connectSignal() + handler for single parameter
The handler for signals with one parameter was missing.
2012-10-25 16:43:44 +02:00
patrick.ohly@intel.com 6e5ee269fb glib: fix compile issue with GAsyncReady
gcc failed because the type of the function is not a pointer, and it
does not allow that as template parameter (in contrast to
clang). Explicitly turn the function name into a pointer.
2012-10-25 16:43:44 +02:00
Patrick Ohly 1668b3a5c0 glib: support more GAsyncResult finish calls
Some asynchronous operations are guaranteed to not fail, in which case
the finish method will have two parameters (object + handle), or just
one (handle).

This patch adds support for that by checking the type of the first
parameter to distinguish between these additional cases. It switches
to function_traits to determine function attributes. Using
boost::function also works, but was a bit hacky.
2012-10-25 16:43:44 +02:00
Patrick Ohly a77b7148d5 glib: improved GAsyncReady support
e_source_registry_new_finish() does not take a GObject pointer
as first parameter. Added another flavor of GAsyncReadyCXX
for _finish() calls with only two instead of three parameters.

A common pattern when the result is needed immediately is to write a
callback function which just stores the result and then iterate the
main loop until the asynchronous method completes. The new
SYNCEVO_GLIB_CALL_SYNC() macro provides such storage methods in the
GAsyncReadyDoneCXX helper classes and waits until the method is done.
2012-10-25 16:43:44 +02:00
Patrick Ohly 868a168b08 glib: added C++ binding for GAsyncReady
The C++ wrapper invokes a boost::function with the final
result and an optional GError pointer (in case of a failure).
A macro reduces typing.
2012-10-25 16:43:44 +02:00
Patrick Ohly 0b3384d184 glib: added ref() to CXX smart pointers
ref() is useful when a new reference to the GObject instance in the
smart pointer is needed.
2012-10-25 16:43:44 +02:00
Patrick Ohly 91018211ce glib: connect GObject signals to boost::function
The connectSignal() utility code can be used instead of manually
written static callback functions. The direct C callbacks are provided
by the header file for up to nine parameters and invoke a
boost::function (or any class which can be turned into a
boost::function, like the result of boost::bind).

The provided C callbacks ensure that exceptions do not escape into the
calling glib. Any exception making it that far aborts the
program. This is often missing from manually written callbacks.

The trick is to allocate a boost::function which is owned by glib and
gets destroyed with another callback when no longer needed.
2012-10-25 16:43:44 +02:00
Patrick Ohly 54d1398b38 synccompare: support Zimbra and Google Contacts via CardDAV
Zimbra uses \N, which is valid. Added a very simplistic conversion
to \n, which is good enough for our known test cases where \\N will
not occur.

Removing VALUE=DATE from BDAY was necessary for Zimbra (?).

Both Zimbra and Google Contacts don't preserve the X-EVOLUTION-UI-SLOT
parameter.

As with SyncML, FN is not preserved by Google when using CardDAV.

In contrast to SyncML, Google's CardDAV supports additional features,
like setting a description for URL, TEL, ADR, etc. via vCard grouping
and X-ABLabel (an Apple Address Book app extensions). For now ignore
that while testing. Long term support for this in SyncEvolution would
be good.
2012-10-25 16:43:44 +02:00
Patrick Ohly f4803dc5d1 WebDAV: auto-discovery fix
With Google Contact + CardDAV the auto-discovery failed after
finding the default address, without reporting that result.

The reason was that the search continued at the root of the server
where PROPFIND triggers an error when using the Google server. Because
of a missing check for "have result", that error was treated as
something which needs to be reported to the user.

Fixed by unifying the various checks in a singe class.
2012-10-25 16:43:44 +02:00
Patrick Ohly 2986054ecc Util: sort in ReadDir
The randomness of readdir() can cause heisenbugs. It also makes
operations like --import of files in a directory unpredictable, unless
the caller remembers to sort himself. Better make sorting
mandatory. There shouldn't be any need for performance critical
directory reading.
2012-10-25 16:43:43 +02:00
Jussi Laako fa2b30fea1 Impove temp file creation and handling, especially for memory mapped
temp files
2012-10-25 16:43:08 +02:00
patrick.ohly@intel.com 976d30c24b Merge branch 'syncevolution-1-3-branch' 2012-10-15 04:30:15 -07:00
Patrick Ohly 6d1cb8f6a0 Merge tag 'syncevolution-1-3-1' 2012-10-08 10:08:06 +02:00
Patrick Ohly 355cb43814 PBAP: clean up and bug fixes for new API support
Fallback to old obexd API was broken because creating the
DBusRemoteObject does not verify whether the service really exists and
thus always succeeds. Fixed by checking for existence as part of the
actual CreateSession method call.

The new code needs glib. Include header file and declare dependency in
configure.

The backend must throw errors when something fatal happens. Logging
the error is not enough, because that can't be checked by the
caller. Throwing errors is best done via the utility methods in
SyncSource, because those include the source name in the exception.

Memory handling was broken: nothing owned the memory in the
StringPiece instances, munmap() was missing. Fixed by making
PbabSyncSource the owner of both.

Unified the parsing of the result. The new code based on pcrecpp is
used for both old and new obexd API.

File name and GError allocated by g_file_open_tmp() were leaked. The
file descriptor and the file were leaked in case of aborting via an
exception. Now these resources are owned by a class which will always
clean up when getting destructed.

A failed transfer was not checked for when using the new API. Probably
failed when trying to use the file (because obexd deletes it), but
better show the error message that we got for the failed transfer.

Remove the obsolete vcardParse().

The backend is not useful for most users, therefore it has to be enable
during compilation with --enable-pbap. The code for "PBAP disabled"
had to be adapted to a backend API change.
2012-09-26 14:01:42 +02:00
Patrick Ohly 628414e956 GDBus GIO: use RAII for GVariant
Instead of using explicit g_variant_unref() calls, let a smart pointer
class own the instance. This allows to remove code and (more
important) fixes leaks when something throws an exception or the
D-Bus traits for boost::variant return prematurely.
2012-09-26 13:43:53 +02:00
Jeremy Whiting 8e4781b210 pbap: Use StringPiece to store vcards in map rather than copying to string. 2012-09-26 08:48:43 +02:00
Jeremy Whiting 680e2a560e pbap: Remove the temporary file after the sync is complete. 2012-09-26 08:47:45 +02:00
Jeremy Whiting 1566e3d609 PBAP: Fix vcard parsing regexp so all vcards are parsed. 2012-09-26 08:47:45 +02:00
Patrick Ohly 0fe056c0f0 PBAP: fixed compiler warning
%d != long
2012-09-26 08:47:45 +02:00
Jeremy Whiting a2758d6c87 PBAP: add support for obex 0.47 to pbap backend. 2012-09-26 08:47:34 +02:00
Patrick Ohly 6c8870236c GDBus GIO: fix SignalFilter
The signal name was not stored, making the actual filtering more
relaxed than it should have been. Worse, the path was redundantly
checked for a complete match even when SIGNAL_FILTER_PATH_PREFIX was
set, thus preventing signal deliver in that case.
2012-09-26 08:36:35 +02:00
Patrick Ohly db3f5d69db GDBus GIO: more flexible SignalWatch
Working with obexd 0.47's Transfer object depends on path prefix
filtering of signals to be efficient. This patch adds that support in
the GDBus C++ bindings, together with some documentation on how to
use it.

It also allows relaxing the signal matching by interpreting empty
strings as "match any".

Finally it adds support for passing of sender, path, interface and
member (= signal name) information to the user of the D-Bus
binding. This is necessary because a handler with wildcards for
matching cannot know the actual values unless they are passed to the
callback explicitly. This was not possible at all before for signals
(because extracting that information relied on a message pointer,
which wasn't set while decoding signal messages) and limited to just
the sender in method implementations.

Besides in functionality, GDBus for GIO and for libdbus now also
differ slightly in their API. In order to pass meta data about a
signal into the demarshalling get() methods, they have to be stored in
ExtractArgs first and passed to get() via that struct, which is an
interface change.

Derived code which extends marshalling/demarshalling needs to be
adapted accordingly. Allowing some ifdefs elsewhere seems simpler than
adapting GDBus for libdbus. Those ifdefs can be removed once libdbus
support is no longer needed.

The patch relaxes access control to DBusObject and DBusRemoteObject
because that simplifies the code which works better with std::string.

Traditionally the sender of a signal was not checked. This is probably
related to unsolved questions like "should watching org.foo.bar follow
owner changes", but not doing any checking is just not right
either. Not fixed in this patch.
2012-09-26 08:36:35 +02:00
Ove Kåven 0d86dc1431 Updated changelog for this branch. 2012-09-25 22:28:49 +02:00
Ove Kåven 768245c22f Merge branch 'FREMANTLE-1-3-0' into HARMATTAN-1-3-0 2012-09-25 22:27:33 +02:00
Ove Kåven 899a952d82 Updated changelog. 2012-09-25 22:09:31 +02:00
Ove Kåven c76facf3de Re-add "uid:" prefix to notebook UID when printing KCal databases.
It probably got lost when implementing tasks and notes.
(cherry picked from commit 5472d28aa3)
2012-09-25 21:58:47 +02:00
Ove Kåven 0c3da5af0a Since we're using load() anyway, there's no need to call allIncidences(),
it would just waste memory. Grab the already loaded incidences instead.
(cherry picked from commit ac9f9183cf)
2012-09-25 21:58:20 +02:00
Ove Kåven cc25c61d2b Implemented support for tasks and notes in the KCalExtended backend.
(cherry picked from commit 0384f211cc)
2012-09-25 21:57:22 +02:00
Ove Kåven b88ebb5430 Fixed KCalExtendedSource failures when refreshing from peer
because the storage's save() inserts first and deletes last.
(cherry picked from commit f11748675a)
2012-09-25 21:57:14 +02:00
ovek dd65471d50 Implemented KCalExtendedSource::isEmpty().
(cherry picked from commit 2f5edf4adb)
2012-09-25 21:57:05 +02:00
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 32aee2fa77 Updated changelog and version for this branch. 2012-09-25 21:52:10 +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 36204047b3 PBAP: fixed linking issue
The PBAP backend must link against pcrecpp explicitly. The header
files are part of the global search path, but the library is not.
Having to specify the library explicitly is right (avoids
adding it to modules which don't need it); perhaps the header
file flags also should have to be added explicitly.

It worked when linked into an executable which also uses pcrecpp, but
can fail to build depending on how strict the toolchain is. Found
by dist checks in the nightly testing.
2012-09-17 11:00:13 +02:00
Patrick Ohly c2dffa3b0f Merge branch 'master' into pbap 2012-09-13 16:36:09 +02:00
Ove Kåven ca184c36dc Updated changelog. 2012-09-06 23:38:55 +02:00
Patrick Ohly 19c5b38d55 local sync: fix timeout with local sync with libdbus
When using libdbus instead of GIO D-Bus (as done by syncevolution.org
binaries and SyncEvolution on Maemo), local sync may have aborted
after 25 seconds when syncing many items with a D-Bus timeout error:

[ERROR] sending message to child failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Reported by Toke Høiland-Jørgensen for Harmattan. Somehow not encountered
elsewhere.

Root cause is the use of the default D-Bus timeout of 25 seconds
instead of disabling the timeout altogether. Fixed by using
DBUS_TIMEOUT_INFINITE and INT_MAX as fallback.
(cherry picked from commit a15e8be1c2)
2012-09-06 23:35:18 +02:00
Ove Kåven 5472d28aa3 Re-add "uid:" prefix to notebook UID when printing KCal databases.
It probably got lost when implementing tasks and notes.
2012-09-06 23:30:49 +02:00
Patrick Ohly d2fae2948a PBAP: updated docs to include caching mode
Caching mode is how the PBAP backend is meant to be used now.
Slow sync prevention must be disabled in that mode.
2012-08-31 15:04:31 +02:00
Patrick Ohly 43371ac180 sources: force slow sync when listAllItems() returns no revisions
First, clarified that a source has to set all revision strings or
none. This was implied, but not spelled out explicitly.
Second, use that to detect when a sync must be done in slow mode.
Third, avoid calculating changes when that isn't needed. This last
point was left as TODO while in release preparations and can
be committed now.

This changes is needed for the PBAP backend which does not currently
set revision strings and thus cannot be used in incremental syncing.
2012-08-31 15:00:25 +02:00
Patrick Ohly dff2be3c9a engine: local cache sync mode
This patch  introduces support for true one-way syncing ("caching"):
the local datastore is meant to be an exact copy of the data on the
remote side. The assumption is that no modifications are ever made
locally outside of syncing. This is different from one-way sync modes,
which allows local changes and only temporarily disables sending them
to the remote side.

Another goal of the new mode is to avoid data writes as much as
possible.

This new mode only works on the server side of a sync, where the
engine has enough control over the data flow.

Most of the changes are in libsynthesis. SyncEvolution only needs to
enable the new mode, which is done via an extension of the "sync"
property:
- "local-cache-incremental" will do an incremental sync (if possible)
  or a slow sync (otherwise). This is usually the right mode to use,
  and thus has "local-cache" as alias.
- "local-cache-slow" will always do a slow sync. Useful for
  debugging or after (accidentally) making changes on the server side.
  An incremental sync will ignore such changes because they are not
  meant to happen and thus leave client and sync out-of-sync!

Both modes are recorded in the sync report of the local side. The
target side is the client and records the normal "two-way" or "slow"
sync modes.

With the current SyncEvolution contact field list, first, middle and
last name are used to find matches during any kind of slow sync. The
organization field is ignored for matching during the initial slow
sync and used in all following ones. That's okay, the difference won't
matter in practice because the initial slow sync in PBAP caching will
be done with no local data. The test achieve the same result in both
cases by keeping the organization set in the reduced data set.

It's also okay to include the property in the comparison, because it
might help to distinguish between "John Doe" in different companies.

It might be worthwhile to add more fields as match criteria, for
example the birthday. Currently they are excluded, probably because
they are not trusted to be supported by SyncML peers. In caching mode
the situation is different, because all our data came from the peer.

The downside is that in cases where matching has to be done all the
time because change detection is not supported (PBAP), including the
birthday as criteria will cause unnecessary contact removed/added
events (and thus disk IO) when a contact was originally created
without birthday locally and then a birthday gets added on the phone.

Testing is done as part of the D-Bus testing framework, because usually
this functionality will be used as part of the D-Bus server and writing
tests in Python is easier.

A new test class "TestLocalCache" contains the new tests. They include
tests for removing extra items during a slow sync (testItemRemoval),
adding new client items under various conditions (testItemAdd*) and
updating/removing an item during incremental syncing
(testItemUpdate/Delete*). Doing these changes during a slow sync could
also be tested (not currently covered).

The tests for removing properties (testPropertyRemoval*) cover
removing almost all contact properties during an initial slow sync, a
second slow sync (which is treated differently in libsynthesis, see
merge=always and merge=slowsync), and an incremental sync.
2012-08-31 14:00:46 +02:00
Patrick Ohly 2f25b65cbc D-Bus testing: better support for interactive testing
When delaying processes as part of the sync, disable the normal
test timeouts. Useful for attaching to the delayed process
with gdb and then debugging without running into the test
timeouts.
2012-08-31 12:23:04 +02:00
Patrick Ohly cbbe245693 engine: avoid sync mode comparisons against mode strings
Instead of duplicating the sync mode strings, better compare
against the enum values. Better because it helps to catch
typos.
2012-08-31 12:21:11 +02:00
Patrick Ohly 5214e0052a D-Bus server: ensure progress percentage is 0-100
For example in the new TestLocalCache.testItemDelete100, the
percentage value in the ProgressChanged signal become larger
than 100 and then revert to 100 at the end of the sync.

Seems the underlying calculation is faulty or simply inaccurate.
This patch does not fix that. Instead it just clips the final
result to the valid range. It also cleans up ownership of the
actual int32_t progress value.
2012-08-29 11:01:29 +02:00
Patrick Ohly f0c7a3e2da D-Bus server: simplified server class
Instad of having three of the helper classes as members,
only store pointers to them in Server. The advantage is
that including Server.h becomes simpler for .cpp files
which do not need to use these classes and that they
can be constructed/destructed more explicitly. This is
particularly important because they get access to the
Server instance which is still in the process of
initializing itself.
2012-08-29 11:01:29 +02:00
Patrick Ohly de44e4b8cd file backend: use sub-second mod time stamps
Change tracking in the file backend used to be based on the
modification time in seconds. When running many syncs quickly (as in
testing), that can lead to changes not being detected when they happen
within a second.

Now the file backend also includes the sub-second part of the
modification time stamp, if available. The revision string
intentionally uses no leading zeros, because that would make it
unnecessarily larger.

This change is relevant when upgrading SyncEvolution: most of the
items will be considered "updated" once during the first sync after
the upgrade (or a downgrade) because the revision strings get
calculated differently.
2012-08-29 11:01:29 +02:00
Patrick Ohly cb9ce72b9d Merge remote-tracking branch 'origin/master' into pbap2 2012-08-29 10:58:29 +02:00
Patrick Ohly 9dce6488d6 PBAP: allow configuring format and fields via databaseFormat
With this patch, the databaseFormat can be used as follows:

  [(2.1|3.0)][:][^]propname,propname,...

  3.0 = download in vCard 3.0 instead of the default 2.1
  3.0:^PHOTO = download in vCard 3.0 format, excluding PHOTO
  PHOTO = download in vCard 2.1 format, only the PHOTO

Valid property names are pulled from obexd with ListFilterFields().
2012-08-27 11:51:14 +02:00
Patrick Ohly 03d11362e9 PBAP: fixed dangling reference
Binding a temporary std::string (the result of getDatabase() in this
case) to a const reference is broken, because the temporary instance
will get deleted before the reference.
2012-08-27 11:49:19 +02:00
Patrick Ohly e0cf4666e3 PBAP: fixed parsing of PullAll result
Pulling the individual vCard out of the result stream was faulty: it
used the end position as length and thus included data from the next
vCard.
2012-08-27 11:47:03 +02:00
Patrick Ohly 808b9ca8be PBAP: don't try to make up stable local IDs
Local IDs across sessions are only useful when we also have useful
revision strings. For debugging it is easier to just enumerate the
contacts. Would be nice to use the same number as in the PBAP session,
but that information is not currently available via obexd (see "PBAP +
two-step download" on Bluez mailing list).

As it stands now, the PBAP backend can only be used in slow syncs
where the engine does the matching. Perhaps that's the right way to do
it, instead of adding redundant code to the backends.
2012-08-27 11:10:48 +02:00
Patrick Ohly 406f5a0d40 local sync: fix timeout with local sync with libdbus
When using libdbus instead of GIO D-Bus (as done by syncevolution.org
binaries and SyncEvolution on Maemo), local sync may have aborted
after 25 seconds when syncing many items with a D-Bus timeout error:

[ERROR] sending message to child failed: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Reported by Toke Høiland-Jørgensen for Harmattan. Somehow not encountered
elsewhere.

Root cause is the use of the default D-Bus timeout of 25 seconds
instead of disabling the timeout altogether. Fixed by using
DBUS_TIMEOUT_INFINITE and INT_MAX as fallback.
2012-08-23 13:57:29 +02:00
Patrick Ohly 92b3196bc6 GDBus GIO: removed dead code 2012-08-23 13:51:09 +02:00
Patrick Ohly 3035254a8a SyncContext: removed dead "SyncModes" code
Not used anywhere, remove it do avoid confusion.
2012-08-17 15:14:09 +02:00
Patrick Ohly 7dadd14d7e Merge remote-tracking branch 'origin/master' into pbap 2012-08-16 19:06:54 +02:00
Ove Kåven 0c7e57181e Updated changelog. 2012-08-14 12:05:25 +02:00
Ove Kåven c821557d73 Merge branch 'FREMANTLE-1-2-99-4' into HARMATTAN-1-2-99-4 2012-08-14 12:04:52 +02:00
Ove Kåven ac9f9183cf Since we're using load() anyway, there's no need to call allIncidences(),
it would just waste memory. Grab the already loaded incidences instead.
2012-08-14 11:58:03 +02:00
Ove Kåven eb2c73a226 Updated changelog with descriptions of the KCalExtended changes. 2012-08-13 06:54:58 +02:00
Ove Kåven 0384f211cc Implemented support for tasks and notes in the KCalExtended backend. 2012-08-13 06:54:53 +02:00
Ove Kåven c7f7bfd566 Make syncevolution-webdav-lookup work with the shells and
the "host" binaries available on Maemo.
2012-08-13 06:11:14 +02:00
Ove Kåven e88d94bc18 Updated changelog. 2012-08-12 19:37:29 +02:00
Ove Kåven 0352113e8d Merge tag 'syncevolution-1-2-99-4' into FREMANTLE-1-2-99-4 2012-08-12 19:34:03 +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 f11748675a Fixed KCalExtendedSource failures when refreshing from peer
because the storage's save() inserts first and deletes last.
2012-08-12 17:21:23 +02:00
ovek 2f5edf4adb Implemented KCalExtendedSource::isEmpty(). 2012-08-12 17:21:23 +02:00
Ove Kåven a6a7d20b81 On Harmattan, embed host and libneon into the syncevolution packages. 2012-08-12 17:21:18 +02:00
Ove Kåven 0af3ef1605 Add myself to debian/copyright. 2012-08-12 17:18:05 +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 426ade85c3 Added dependency to run libsynthesis's autogen.sh after the main one. 2012-08-12 16:23:54 +02:00
Ove Kåven 16bc8b6d83 Cleanups to debian/rules. 2012-08-12 16:23:49 +02:00
Ove Kåven 91a16dea66 Cleanups to debian/rules. 2012-08-12 16:22:55 +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 ff97574d70 Fixed broken rule for creating syncevo-webdav-lookup. 2012-08-11 12:11:30 +02:00
Ove Kåven 9c6685b803 In KCalExtendedSource::open(), only load the contents of the notebook
we actually plan to sync, not all notebooks in the storage.
2012-08-11 10:33:23 +02:00
Ove Kåven 0ebcbf47bb Added dependency to run libsynthesis's autogen.sh after the main one. 2012-08-11 10:29:39 +02:00
Ove Kåven a5c2939c1d 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.)
2012-08-11 10:18:17 +02:00
Ove Kåven 06f08ecb5a Fix to result code of incidence updates. 2012-08-11 10:17:41 +02:00
Ove Kåven 5c8fb97875 Use regular autogen.sh in Harmattan builds. 2012-08-11 10:17:27 +02:00
Ove Kåven 7c30b21fb4 Updated changelog for this branch. 2012-08-11 10:17:00 +02:00
Ove Kåven d6fee9ad06 Merge branch 'FREMANTLE-1-2-99-3' into HARMATTAN-1-2-99-3 2012-08-11 10:04:56 +02:00
Ove Kåven 2333f8e495 Updates for Maemo calendar backend. 2012-08-10 08:13:39 +02:00
Ove Kåven 591de01543 Updated changelog. 2012-08-07 01:33:33 +02:00
Ove Kåven 8277b213e5 Fixes for compilation on gcc 4.2, used on Maemo 5. 2012-08-07 01:32:14 +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 8aff8fab34 Remove INSTALL file from version control. 2012-08-05 04:05:01 +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
Ove Kåven bb76a6139c I think I fixed my scratchbox. 2012-08-04 22:20:30 +02:00
Patrick Ohly 816c928dbe PBAP: fixed vcard parser
First, FN is not mandatory in PBAP for vCard 2.1. Better use N as key,
which is mandatory. Second, finding the property name must stop at
colon or semicolon, whatever comes first. The previous code included
the colon and the first name component because it stopped at the first
semicolon.
2012-04-24 14:51:55 +02:00
Patrick Ohly aa78d7a6e4 PBAP: fixed D-Bus calls
Must pass object paths with that type, some servers check it.
2012-04-24 14:24:25 +02:00
Patrick Ohly 935e1d92ce Merge branch 'master' into pbap 2012-04-19 10:20:39 +02:00
Patrick Ohly 90ee964b90 Merge branch 'master' into pbap 2012-03-07 08:22:41 +01:00
Patrick Ohly 46d7d344f3 PBAB: Merge branch 'master' into pbap + D-Bus method calls
The mechanism for making D-Bus method calls changed on the master
branch. The normal call operator now does a blocking method call,
which breaks code depending on the former non-blocking semantic.

All D-Bus methods calls in the PBAB backend are now blocking. This
allows removing all callback methods and the start/stop main loop
tricks. A lot easier to read and problems while executing the method
calls are now properly reported back to the user of the backend via
exceptions.
2012-02-21 15:20:30 +01:00
Mikel Astiz c12cde00d1 pbap backend: add simple README 2012-01-27 20:19:02 +00:00
Mikel Astiz e8f931bb73 pbap backend: some log traces added 2012-01-27 20:19:02 +00:00
Mikel Astiz 6b32093c74 pbap backend: implement addressbook pull
Populates the local cache with the addressbook given by the remote
device as result of PullAll().

The LUID is built from the full-name of the vcard entry, combined with a
suffix that avoid collisions in case of multiple entries with the same
full-name.
2012-01-27 20:19:02 +00:00
Mikel Astiz 82f55381ea pback backend: create obex session on open()
This instantiates the D-Bus wrapper and thus requests a obex-client
session.

A local cache of the addressbook has been added which will be loaded
when the database is opened.
2012-01-27 20:19:02 +00:00
Patrick Ohly ff0b745f73 PBAP: support both GIO and libdbus C++ bindings
Fixed the autotools rules and include statement so that the top-level
configure+Makefile can choose between the two different C++
bindings. The library must be linked explicitly to avoid problems when
linking statically.
2012-01-27 20:19:02 +00:00
Mikel Astiz 95473af272 pbap backend: add obex-client D-Bus wrapper
This class is a convenient wrapper hiding the D-Bus method calls, while
avoiding compilation dependencies in PbapSyncSource.h.
2012-01-27 20:17:48 +00:00
Patrick Ohly c7376d250f GDBus libdbus: add variant append support
In libdbus, the variant must be opened as a sub-iterator with the type
of the actual value as parameter. Do that in the boost::variant
visitor, using a template call operator so that we don't need multiple
versions of it for each type in the variant.
2012-01-27 20:17:48 +00:00
Mikel Astiz de0e47e85e GDBus GIO: add variant append support
Sending variant values was previously not supported.
2012-01-27 20:17:22 +00:00
Patrick Ohly 02a68ac46a PBAP: removed source tests
The tests were copied without adapting them to PBAP. They won't work
(name not unique, tests depend on write access), thus removing them.
2012-01-27 20:17:22 +00:00
Mikel Astiz a961533556 pbap client: add skeleton
This new backend represents a phonebook accessible using the Bluetooth
PBAP profile.
2012-01-27 17:05:34 +00:00
Ove Kåven a653ba3177 Updated changelog for this branch. 2012-01-23 23:51:47 +01:00
Ove Kåven 95b2c267fe Merge branch 'FREMANTLE-1-2-2' into HARMATTAN-1-2-2 2012-01-23 23:49:07 +01:00
Ove Kåven b2c8923031 QtContacts backend improvements for Harmattan.
- list all available managers as backend databases
- only sync contacts with a Sync Target of "addressbook"
(cherry picked from commit eff97d30ec)
2012-01-23 23:24:48 +01:00
Ove Kåven 2b250a462b Updated changelog and version for this branch. 2012-01-23 23:21:06 +01:00
Ove Kåven 4358eca262 Merge commit 'syncevolution-1-2-2' into FREMANTLE-1-2-2 2012-01-23 23:18:55 +01:00
Ove Kåven eff97d30ec QtContacts backend improvements for Harmattan.
- list all available managers as backend databases
- only sync contacts with a Sync Target of "addressbook"
2011-11-29 06:37:39 +01:00
Ove Kåven 19438944fc Merge branch 'FREMANTLE-1-2-1' into HARMATTAN-1-2-1
Conflicts:
	debian/changelog
2011-11-29 02:01:44 +01:00
Ove Kåven 717320d9dd Updated changelog. 2011-11-28 23:24:42 +01:00
Ove Kåven a6b4e97472 Updated KCalExtended and QtContacts backends for new insertItem() signature.
(cherry picked from commit 73e8a72abe)
2011-11-28 23:22:04 +01:00
Ove Kåven 540e324501 Update changelog and version of this branch. 2011-11-28 22:40:46 +01:00
Ove Kåven 39bd615014 Merge commit 'syncevolution-1-2-1' into FREMANTLE-1-2-1 2011-11-28 22:39:19 +01:00
Ove Kåven 73e8a72abe Updated KCalExtended and QtContacts backends for new insertItem() signature. 2011-11-28 22:06:16 +01:00
Ove Kåven b2d6d21491 Merge branch 'FREMANTLE-1-2-0' into HARMATTAN-1-2-0
Conflicts:
	debian/changelog
	debian/control
	debian/rules
2011-11-21 01:53:53 +01:00
Ove Kåven 38a40b45c8 Updated changelog and version for the newest RECURRENCE-ID fixes. 2011-11-21 01:35:53 +01:00
Patrick Ohly 37a8e2d3e6 CalDAV: filter out X-SYNCEVOLUTION-EXDATE-DETACHED
If the engine got a parent event with X-SYNCEVOLUTION-EXDATE-DETACHED,
merged it internally and then wrote it back, the
X-SYNCEVOLUTION-EXDATE-DETACHED would have been stored in the CalDAV
server. Now this is avoided by removing all such properties before
storing the new or updated event.

This was previously done (and still is) as an extra precaution in the
code which adds the properties.

(cherry picked from commit ede6e65ccb)
2011-11-20 20:27:40 +01:00
Patrick Ohly 4b71540288 CalDAV: revised RECURRENCE-ID -> EXDATE support
The previous approach (updating the internal cache) had the drawback
that X-SYNCEVOLUTION-EXDATE-DETACHED was also sent to the CalDAV
server. The work of generating it was done in all cases, even if not
needed. Found when running the full test suite.

Now the X-SYNCEVOLUTION-EXDATE-DETACHED properties are only added to
the icalcomponent that is generated for the engine in
readSubItem(). There's still the risk that such an extended VEVENT
will be stored again (read/modify/write conflict resolution), so
further changes will be needed to filter them out.

To ensure that this change doesn't break the intended semantic of
X-SYNCEVOLUTION-EXDATE-DETACHED, the presence of these properties is
now checked in the LinkedItems::testLinkedItemsParentChild test.

(cherry picked from commit 1cd49e9ecd)
2011-11-20 20:27:24 +01:00
Patrick Ohly e006374074 EDS compatibility: fixed inconsistency in libecal check
The check for the _r variants in libical still used an older max
version. This might have prevented using them (if not found) or
could have led to a mixture of old and new libecal in the same
process (probably crashed).
(cherry picked from commit f93b675d77)
2011-11-20 20:26:36 +01:00
Patrick Ohly c9a8875b40 EDS compatibility: added functions needed for X- properties
Required for Maemo 5 recurrences workaround.
icalproperty_get_value_as_string() is one of those
functions for which a _r variant exists; use that
if possible.

(cherry picked from commit 88b0cc2b62)
2011-11-20 20:26:12 +01:00
Ove Kåven 9c15ca6b76 Switched to OpenSSL version of libneon. 2011-11-08 21:27:23 +01:00
Ove Kåven dbf1a54943 Update changelog for the additional RECURRENCE-ID fixups. 2011-11-08 19:45:47 +01:00
Patrick Ohly 5d3577821a CalDAV: add RECURRENCE-ID in update
When storing an updated detached recurrence, the VEVENT was expected
to contain a RECURRENCE-ID. This might not be the case when the peer
in a local sync (typically the local storage) was unable to store that
property.

Support such a local storage by re-adding the RECURRENCE-ID based on
the available information:
- RECURRENCE-ID value from sub ID
- TZID from parent event's DTSTART (if parent exists) or
  current event's DTSTART (otherwise)

Tests for different scenarios (all-day event with date-only RECURRENCE-ID,
with TZID, without TZID) will be committed separately.

(cherry picked from commit 03d3c720ba)
2011-11-07 22:53:40 +01:00
Patrick Ohly 15bcade1a1 EDS compatibility: added icalparameter_new_clone + icalproperty_new_recurrenceid
Needed for re-adding RECURRENCE-ID when missing.

(cherry picked from commit a2add05a34)
2011-11-07 22:53:12 +01:00
Patrick Ohly 590df5ba92 Smart Pointer: added eptr support for icalproperty and icalparameter
Needed for code which creates icalproperty or icalparameter and does
not immediately add it to a parent.

(cherry picked from commit bee26ca9f9)
2011-11-07 22:52:48 +01:00
Ove Kåven c58c7ee7d8 Update changelog for the merged RECURRENCE-ID conversions. 2011-11-06 18:53:46 +01:00
Patrick Ohly b7d2ce6751 Maemo Calendar: fix EXDATEs after reading from storage
If the event has a DTSTART with TZID, then the EXDATE also should
have that same TZID. It is uncertain whether the backend provides
the TZID, but even if it does, because of the SIMPLE-EXDATE rule
the value wouldn't be parsed.

(cherry picked from commit 6d80112dc4959e8c4f940b026e0447fcf7256142)
2011-11-06 18:53:42 +01:00
Patrick Ohly 0027f48fbc Maemo Calendar: avoid TZID in EXDATE property
This must be done for regular EXDATE values in the EXDATE array field
(new SIMPLE-EXDATE rule) and for the addition EXDATE values created
for RECURRENCE-IDs in the EXDATES_DETACHED array field (new
HAVE-EXDATE-DETACHED-NO-TZID rule).

Both these rules are activated as subrules by the new MAEMO-CALENDAR
rule, which is set by the Maemo Calendar backend now.

There is one caveat the SIMPLE-EXDATE rule is also active when parsing
an EXDATE created by the storage and therefore TZID will be ignored,
if any is set at all (uncertain).

A vCalendar outgoing script could fix this by adding the DTSTART time
zone to the floating time value in the parsed EXDATEs.

(cherry picked from commit 755638e3c570b531c9bba81f99a8ac710cb25564)
2011-11-06 18:53:32 +01:00
Patrick Ohly 3cbead2b86 Maemo 5 calendar: import RECURRENCE-IDs as EXDATEs on parent event
Tell the engine to pass us EXDATEs created for each RECURRENCE-ID in a
detached recurrence. Necessary because the storage and app do not
support UID/RECURRENCE-ID and thus show duplicates without this
workaround.

(cherry picked from commit 165ea81fca9493d0dce55b82d127ad74cf7b56af)

Conflicts:

	src/backends/maemo/MaemoCalendarSource.h
2011-11-01 06:12:23 +01:00
Patrick Ohly 06643196f9 CalDAV: support RECURRENCE-ID -> EXDATEs hint
Add X-SYNCEVOLUTION-EXDATE-DETACHED properties to main event for each
detached recurrence. Needed by some other SyncEvolution
backends (for example, Maemo 5).

(cherry picked from commit 253adad7d77910b120b4f89a9922dd30516ed3bd)
2011-11-01 06:12:17 +01:00
Patrick Ohly 1633c7c516 engine: tell peers about detached recurrence exceptions
The Maemo 5 calendar backend does not support UID/RECURRENCE-ID
semantic. This is problematic in combination with peers which rely on
that to override the main recurring event on specific recurrences,
because the Maemo 5 calendar will show duplicates.

Fixing this inside the calendar backend is hard because it doesn't get
to see all related events at once. The engine has the same
problem. Therefore a workaround is used:
- backends which have that unified access to all related events
  add special X-SYNCEVOLUTION-EXDATE-DETACHED properties to the
  main event which correspond to the exceptions represented by
  detached recurrences, in addition to the regular EXDATE; the
  backend must set the HAVE-SYNCEVOLUTION-EXDATE-DETACHED rule when
  using PARSETEXTWITHPROFILE()
- the engine parses the special property (only if the
  HAVE-SYNCEVOLUTION-EXDATE-DETACHED rule is active!) and stores
  the values in the EXDATES_DETACHED field
- this gets passed between SyncEvolution instances in a local
  or SyncML sync
- another SyncEvolution backend can request to get either
  X-SYNCEVOLUTION-EXDATE-DETACHED or regular EXDATE properties
  by setting the HAVE-[SYNCEVOLUTION-]EXDATE-DETACHED rules

The Maemo 5 backend needs to set HAVE-EXDATE-DETACHED. This means that
importing events will add additional EXDATEs which will be sent back
when updating events inside the calendar app, but that is okay. They
are merely redundant.

(cherry picked from commit a4d0909b28721ff3500306f5a29a367ba2f2bffb)

Conflicts:

	src/syncevo/MapSyncSource.h
2011-11-01 06:03:38 +01:00
Ove Kåven ae4f3bf607 Update changelog and version of this branch. 2011-11-01 05:34:12 +01:00
Ove Kåven a8ebf7f999 Merge commit 'syncevolution-1-2' into FREMANTLE-1-2-0 2011-11-01 05:23:03 +01:00
Ove Kåven 63a8f620e8 Updated Maemo backend for new InsertItemResult() signature. 2011-09-20 02:26:17 +02:00
Ove Kåven 59ce93f244 Update changelog and version of this branch. 2011-09-19 18:37:01 +02:00
Ove Kåven e8d886f5ee On Maemo, suppress the "self" contact in QtContacts. 2011-09-19 18:29:34 +02:00
Ove Kåven c04dbbbe08 Disable static libraries, they're not needed on Maemo. 2011-09-19 18:29:03 +02:00
Ove Kåven 6ee1e9e8f8 Only disable iCalendar 2.0 UID comparisons when using calendar-backend (Fremantle).
When using mkcal (Harmattan), UID comparisons are possible and should be enabled.
2011-09-19 18:27:44 +02:00
Ove Kåven 8bdaba2d84 Added Aegis manifest for Harmattan. 2011-09-19 18:27:37 +02:00
Ove Kåven 55440820b6 Merge commit 'syncevolution-1-1-99-7' into FREMANTLE-1-1-99-7 2011-09-19 18:25:54 +02:00
Ove Kåven df0e850077 Bumped version. 2011-09-08 00:03:57 +02:00
Ove Kåven b59af1103e On Maemo, suppress the "self" contact in QtContacts. 2011-09-07 23:58:59 +02:00
Ove Kåven a1d73c86bf Disable static libraries, they're not needed on Maemo. 2011-09-07 23:25:18 +02:00
Ove Kåven 7fa4ad5655 Only disable iCalendar 2.0 UID comparisons when using calendar-backend (Fremantle).
When using mkcal (Harmattan), UID comparisons are possible and should be enabled.
2011-09-07 23:14:19 +02:00
Ove Kåven ba8cddec08 Added Aegis manifest for Harmattan. 2011-09-07 23:12:48 +02:00
Ove Kåven e4303c5588 Updated with backends and build-deps available on Harmattan.
(WebDAV is not yet available.)
2011-09-04 21:53:01 +02:00
Ove Kåven 627d7a3429 No longer use e_contact_inline_data(), now SyncEvolution can embed the photos itself.
This reverts commit d955587714.
2011-09-04 20:47:33 +02:00
Ove Kåven 6887541503 Update version of this branch. 2011-09-04 20:46:19 +02:00
Ove Kåven 4ab7337c0e Fix autogen-maemo.sh to work with my bastardized scratchbox. 2011-09-04 20:44:47 +02:00
Ove Kåven b98a72b3a1 Merge commit 'syncevolution-1-1-99-6' into FREMANTLE-1-1-99-6 2011-09-04 20:41:36 +02:00
Ove Kåven 21df0dc91c Added debian/rules rule to rerun libsynthesis/autogen-maemo.sh if needed. 2011-07-29 08:38:48 +02:00
Ove Kåven 297c4d1d81 On Maemo, disable iCalendar 2.0 UID comparisons.
(Needed since calendar-backend can't store globally unique UIDs.)
2011-07-29 06:37:05 +02:00
Ove Kåven 89a5a0570d Remove -L option from find, it's not supported in Fremantle's findutils. 2011-07-15 12:31:10 +02:00
Ove Kåven a24f9da930 Update version of this branch. 2011-07-15 12:29:31 +02:00
Ove Kåven f7166fb189 Merge commit 'syncevolution-1-1-99-5a' into FREMANTLE-1-1-99-5 2011-07-15 12:28:01 +02:00
Ove Kåven 701886e329 No longer bother to set CFLAGS from debian/rules. 2011-06-25 17:43:02 +02:00
Patrick Ohly a8a12e9e2a WebDAV: avoid null pointer error when listing databases
Running "syncevolution" without parameters ran into a null
pointer access in a Boost shared pointer, leading to an abort
of the program with a Boost exception.

Fix this by checking whether the backend really has a context
node. Long term we need a solution which provides the necessary
information even when running without a sync config.
2011-06-19 22:04:38 +02:00
Ove Kåven 7c942691f8 Fixed libsyncevolution linking issue. 2011-06-19 21:31:08 +02:00
Ove Kåven 4c4d870e9a Updated MaemoCalendarSource to compile with changed TrackingSyncSource. 2011-06-19 20:50:37 +02:00
Ove Kåven 9f31481e45 Set PKG_CONFIG_PATH to the optified equivalent of the default pkgconfig path.
Needed for building against the current version of libneon27-gnutls-dev.
2011-06-19 18:59:38 +02:00
Ove Kåven 60630e43d2 Packaging updates for WebDAV support. 2011-06-19 18:15:25 +02:00
Ove Kåven 3074098108 Update version of this branch. 2011-06-19 17:40:12 +02:00
Ove Kåven beb9f5d51f Merge commit 'syncevolution-1-1-99-4' into FREMANTLE-1-1-99-4 2011-06-19 17:24:37 +02:00
Ove Kaaven 96a6e63b6b Updated debian/changelog. 2011-02-05 00:09:36 +01:00
Ove Kaaven d955587714 On Maemo, use e_contact_inline_data() to properly embed photos for syncing. 2011-02-04 23:53:28 +01:00
Ove Kaaven 36866c239b Added debian/rules rule to rerun autogen-maemo.sh if needed. 2011-02-04 23:02:29 +01:00
Ove Kaaven 134ab399a1 Remove "tar-ustar" from the configure-pre.in in the Maemo branch. 2011-02-04 23:00:24 +01:00
Ove Kaaven e5af78fcf6 Update version of this branch. 2011-02-04 20:00:22 +01:00
Ove Kaaven 6999770d9a Merge commit 'syncevolution-1-1-1' into FREMANTLE-1-1-1 2011-02-04 19:49:00 +01:00
Ove Kaaven 9536daf065 Updated debian/changelog. 2010-07-20 20:20:17 +02:00
Ove Kaaven 72ed18933e Implemented MaemoCalendarSource::isEmpty() 2010-07-20 20:20:17 +02:00
Ove Kaaven db6175c41f Refuse to delete items from smart calendar. 2010-07-20 20:20:17 +02:00
Ove Kaaven 0d611128b8 Updated bugtracker field. 2010-07-20 18:35:01 +02:00
Ove Kaaven 499975f19b Changed section from user/office to utils. Users who don't
use apt-get will then only see the syncevolution-frontend package
(which depends on this syncevolution package, but has a GUI).
2010-07-20 18:32:05 +02:00
Ove Kaaven 6b54f8488b Use --disable-ssl-certificate-check configure option in Maemo for now. 2010-07-20 18:32:05 +02:00
Ove Kaaven 6e4195f341 Force IPv4 host resolution on Maemo. 2010-07-20 18:32:05 +02:00
Ove Kaaven 147373e2e0 Fixed retrieval of maemo notes in text/plain format. 2010-07-20 18:32:05 +02:00
Ove Kaaven c3ef395f7d Install /usr/libexec 2010-07-20 18:32:05 +02:00
Ove Kaaven cf18767c37 Helper scripts for the Maemo build. 2010-07-20 18:32:05 +02:00
Ove Kaaven 926ab46449 Remove apparently obsolete stuff to create EvolutionSyncClient.cpp 2010-07-20 18:32:05 +02:00
Ove Kaaven fbedce32ca Ignore some stuff in the Maemo build. 2010-07-20 18:32:05 +02:00
Ove Kaaven 993194211a Update version of this branch 2010-07-12 12:27:05 +02:00
500 changed files with 47725 additions and 35232 deletions

127
.gitignore vendored
View File

@ -1,127 +0,0 @@
# general
*.la
*.lo
*.o
*~
.deps
.dirstamp
.libs
Makefile
Makefile.in
# top level
/INSTALL
/autom4te.cache
/aclocal.m4
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.status
/config.sub
/configure
/depcomp
/install-sh
/libtool
/ltmain.sh
/m4
/missing
/mkinstalldirs
/README
/README.html
/stamp-h1
/syncevolution.1
/syncevolution-*.tar.gz
# po
/po/*.gmo
/po/.intltool-merge-cache
/po/LINGUAS
/po/Makefile.in.in
/po/POTFILES
/po/stamp-it
# src
/src/autotroll.mk
/src/Client_Source_*.log
/src/Client_Sync_*.log
/src/Client_Sync_*.A
/src/client-test
/src/LogDirTest
/src/LogRedirectTest_glib.out
/src/N7SyncEvo*.log
/src/synccompare
/src/syncevo-dbus-server
/src/syncevo-http-server
/src/syncevolution
/src/testcases/
# src/backends
/src/backends/backends.am
# src/backends/webdav
/src/backends/webdav/syncevo-webdav-lookup
# src/dbus/glib
/src/dbus/glib/stamp-syncevo-connection-bindings.h
/src/dbus/glib/stamp-syncevo-connection-glue.h
/src/dbus/glib/stamp-syncevo-server-bindings.h
/src/dbus/glib/stamp-syncevo-server-glue.h
/src/dbus/glib/stamp-syncevo-session-bindings.h
/src/dbus/glib/stamp-syncevo-session-glue.h
/src/dbus/glib/syncevo-connection-glue.h
/src/dbus/glib/syncevo-connection-bindings.h
/src/dbus/glib/syncevo-connection.xml
/src/dbus/glib/syncevo-dbus.pc
/src/dbus/glib/syncevo-marshal.c
/src/dbus/glib/syncevo-marshal.h
/src/dbus/glib/syncevo-server-glue.h
/src/dbus/glib/syncevo-server-bindings.h
/src/dbus/glib/syncevo-server.xml
/src/dbus/glib/syncevo-session-glue.h
/src/dbus/glib/syncevo-session-bindings.h
/src/dbus/glib/syncevo-session.xml
/src/dbus/glib/test-syncevo-dbus
# src/dbus/interfaces
/src/dbus/interfaces/syncevo-connection-doc.xml
/src/dbus/interfaces/syncevo-dbus-api-doc.html
/src/dbus/interfaces/syncevo-dbus-api-doc.xml
/src/dbus/interfaces/syncevo-server-doc.xml
/src/dbus/interfaces/syncevo-session-doc.xml
# src/dbus/qt
/src/dbus/qt/autotroll.mk
/src/dbus/qt/syncevolution-qt-dbus.pc
/src/dbus/qt/stamp-connection
/src/dbus/qt/stamp-server
/src/dbus/qt/stamp-session
/src/dbus/qt/syncevo-connection-full.cpp
/src/dbus/qt/syncevo-connection-full.h
/src/dbus/qt/syncevo-connection-full.moc.cpp
/src/dbus/qt/syncevo-server-full.cpp
/src/dbus/qt/syncevo-server-full.h
/src/dbus/qt/syncevo-server-full.moc.cpp
/src/dbus/qt/syncevo-session-full.cpp
/src/dbus/qt/syncevo-session-full.h
/src/dbus/qt/syncevo-session-full.moc.cpp
# src/dbus/server
/src/dbus/server/org.syncevolution.service
/src/dbus/server/syncevo-dbus-server-startup.sh
/src/dbus/server/syncevo-dbus-server.desktop
# src/gdbus
/src/gdbus/example
# src/gtk-ui
/src/gtk-ui/sync-ui
/src/gtk-ui/sync.desktop
/src/gtk-ui/ui.xml
# src/syncevo
/src/syncevo-phone-config
/src/syncevo/CmdlineHelp.c
/src/syncevo/SyncEvolutionXML.c
/src/syncevo/syncevolution.pc

11
HACKING
View File

@ -44,9 +44,10 @@ The test framework also requires CPPUnit:
For the GUI and its D-Bus based service backend:
apt-get install xsltproc \
libdbus-glib-1-dev \
libglib2.0-dev \
libgtk2.0-dev libglade2-dev \
libgnome-keyring-dev \
libsecret-1-dev \
libgconf2-dev libgnomevfs2-dev
Optional packages for GUI:
@ -78,8 +79,8 @@ It depends on:
Checking out the Source
-----------------------
SyncEvolution is hosted on moblin.org. Anonymous access is via
git clone git://git.moblin.org/syncevolution.git
SyncEvolution is hosted on freedesktop.org. Anonymous access is via
git clone git://anongit.freedesktop.org/SyncEvolution/syncevolution
Before using sources checked out from Subversion, invoke "sh
autogen.sh" with appropriate autotools packages installed.
@ -93,9 +94,9 @@ faster compilation) and will bundle the Synthesis sources in source
The upstream Synthesis source code is here:
git://www.synthesis.ch/libsynthesis.git
The staging area for patches developed as part of Moblin are
The staging area for patches developed as part of SyncEvolution are
in the following repository:
git://git.moblin.org/libsynthesis.git
git://anongit.freedesktop.org/SyncEvolution/libsynthesis
The intention is to include all these patches upstream to
prevent forking the code. If you want to get patches included

View File

@ -16,14 +16,8 @@ endif
SUBDIRS += .
# choose D-Bus implementation
if COND_GIO_GDBUS
gdbus_dir = $(top_srcdir)/src/gdbusxx
gdbus_build_dir = src/gdbusxx
else
gdbus_dir = $(top_srcdir)/src/gdbus
gdbus_build_dir = src/gdbus
endif
disted_docs =
distbin_docs =
@ -130,8 +124,9 @@ TYPE_rpm = -R
# Squeeze the package was replaced by individual library packages. On such
# distros, libkdeui5 is what we need.
# - same for kdepimlibs5 -> libakonadi-kde4
REQUIRES_SED_KDE = -e 's/kdelibs5 ([^,]*),/kdelibs5 | libkdeui5,/g' -e 's/kdepimlibs5 ([^,]*),/kdepimlibs5 | libakonadi-kde4,/g'
REQUIRES_deb = --requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(srcdir)/src/shlibs.local --ignore-missing-info -O $$(for i in $$(find $(distdir) -type f -perm /u+x | grep -v -e client-test -e lib/syncevolution/backends/); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//')$(REQUIRES_deb_neon)$(REQUIRES_deb_ical)'"
# - kdebase-runtime became kde-runtime in Debian Wheezy
REQUIRES_SED_KDE = -e 's/kdelibs5 ([^,]*),/kdelibs5 | libkdeui5,/g' -e 's/kdepimlibs5 ([^,]*),/kdepimlibs5 | libakonadi-kde4,/g' -e 's/kdebase-runtime/kdebase-runtime | kde-runtime/g'
REQUIRES_deb = --requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(EXTRA_SHLIBS_LOCAL) --ignore-missing-info -O $$(for i in $$(find $(distdir) -type f -perm /u+x | grep -v -e client-test -e lib/syncevolution/backends/); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//')$(REQUIRES_deb_neon)'"
if NEON_COMPATIBILITY
# --enable-neon-compatibility in src/backends/webdav:
# replace dependencies from linking with hard-coded dlopen() dependencies
@ -139,9 +134,6 @@ REQUIRES_deb_neon = , libneon27 (>= 0.29.0) | libneon27-gnutls (>= 0.29.0)
else
REQUIRES_deb_neon =
endif
if ENABLE_ICAL
REQUIRES_deb_ical = , libical0
endif
VERSION_deb = 1:$(STABLE_VERSION)$(VERSION)
VERSION_rpm = `echo $(VERSION) | sed -e s/-/_/g`
RELEASE = 2
@ -167,7 +159,9 @@ PKGS = $(addprefix syncevolution-evolution-, 2.6 2.8 2.12)
# after the lib and its major version, which holds for libsmltk and
# libsynthesis in Debian.
deb rpm : checkinstall/dist/$(distdir) checkinstall/dist/debian/control
(echo "SyncEvolution - synchronizing personal information management data" && cat $(srcdir)/description) >description-pak
(echo "SyncEvolution - synchronizing personal information management data" && cat $(srcdir)/description) >checkinstall/description-pak
echo "/sbin/ldconfig" >checkinstall/postremove-pak
echo "/sbin/ldconfig" >checkinstall/postinstall-pak
conflicts=`ls -1 checkinstall/dist/$(distdir)/usr/lib/*.so.[0123456789] | sed -e 's;.*/;;' -e 's/\.so\.//' -e 's/$$/, /'` && \
tmpdir=`mktemp -d $$HOME/syncevolution.XXXXXXXXXX` && \
trap "rm -rf $$tmpdir" EXIT && \
@ -176,6 +170,7 @@ deb rpm : checkinstall/dist/$(distdir) checkinstall/dist/debian/control
$(TYPE_$@) \
$(REQUIRES_$@) \
--fstrans=yes \
--install=no \
--strip=no \
--pkgversion=$(VERSION_$@) \
--pkgrelease=$(RELEASE) \
@ -197,7 +192,8 @@ deb rpm : checkinstall/dist/$(distdir) checkinstall/dist/debian/control
PLATFORM_DEB_VERSION = $(VERSION_deb)
PLATFORM_DEB_RELEASE = 1
if ENABLE_MODULES
deb : syncevolution-kde-deb
# Not supported anymore.
# deb : syncevolution-kde-deb
deb : syncevolution-evolution-deb
endif
@ -208,20 +204,18 @@ PLATFORM_FILES_kde = platformkde syncakonadi
# Additional parameters for syncevolution-kde/evolution.deb.
# Fake conflicts/replaces works around a bug in CheckInstall,
# which creates empty, invalid entries for those unless
# something is given. For Evolution we hard-code dependencies
# (because with EDS compatibility turned on, several
# alternatives will work at runtime) and conflict with
# EDS 3.6, because that breaks the API and does not work for us
# at the moment.
# something is given. For Evolution we expect the caller
# to provide the actual dependencies.
SYNCEVOLUTION_kde_DEB_ARGS = \
--conflicts=syncevolution-foobar \
--replaces=syncevolution-foobar
SYNCEVOLUTION_evolution_DEB_ARGS = \
--conflicts="'evolution-data-server (>= 3.6), libebook-1.2-14 (>= 3.6), libecal-1.2.12 (>= 3.6)'" \
--conflicts=syncevolution-foobar \
--replaces=syncevolution-foobar
SYNCEVOLUTION_evolution_DEB_REQUIRES = \
, libebook1.2-5 | libebook1.2-6 | libebook1.2-7 | libebook1.2-8 | libebook1.2-9 | libebook1.2-10 | libebook1.2-11 | libebook-1.2-11 | libebook-1.2-12 | libebook-1.2-13 \
, libecal1.2-3 | libecal1.2-4 | libecal1.2-5 | libecal1.2-6 | libecal1.2-7 | libecal1.2-8 | libecal1.2-9 | libecal1.2-10 | libecal-1.2-10 | libecal-1.2-11
, evolution-data-server \
, $(EXTRA_BACKENDS_EBOOK_REQUIRES) \
, $(EXTRA_BACKENDS_ECAL_REQUIRES)
syncevolution-%-deb: checkinstall/dist/$(distdir) checkinstall/dist/debian/control
(echo "SyncEvolution - meta package for $*" && cat $(srcdir)/description) >checkinstall/description-pak
@ -238,7 +232,7 @@ syncevolution-%-deb: checkinstall/dist/$(distdir) checkinstall/dist/debian/contr
$(SYNCEVOLUTION_$*_DEB_ARGS) \
--pkgname=syncevolution-$* \
--pkgarch=all \
--requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(srcdir)/src/shlibs.local --ignore-missing-info -O $$(for i in $(patsubst %,$(distdir)/usr/lib/syncevolution/backends/%.so,$(PLATFORM_FILES_$*)); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//'), $(PKGNAME) (= $(VERSION_deb)-$(RELEASE))$(SYNCEVOLUTION_$*_DEB_REQUIRES)'" \
--requires="'$(shell set -x; cd checkinstall/dist; LD_LIBRARY_PATH=$(distdir)/usr/lib:$(distdir)/usr/lib/syncevolution dpkg-shlibdeps -L$(EXTRA_SHLIBS_LOCAL) --ignore-missing-info -O $$(for i in $(patsubst %,$(distdir)/usr/lib/syncevolution/backends/%.so,$(PLATFORM_FILES_$*)); do if file $$i | grep ELF >/dev/null; then echo $$i; fi; done) | sed $(REQUIRES_SED_KDE) -e 's/[^=]*=//'), $(PKGNAME) (= $(VERSION_deb)-$(RELEASE))$(SYNCEVOLUTION_$*_DEB_REQUIRES)'" \
--maintainer="'Patrick Ohly <patrick.ohly@gmx.de>'" \
--pkgsource='http://syncevolution.org' \
--pkggroup='$*' \
@ -293,27 +287,6 @@ dot_dist_hook:
echo 'A git checkout is required to generate a ChangeLog.' >&2; \
fi
if ENABLE_EVOLUTION_COMPATIBILITY
# check .so (relevant for modular builds) and main syncevolution binary
# (relevant in that case and for static builds) for dependencies on
# problematic libraries and symbols
#
# ical_strdup is an exception because it is in SyncEvolution.
all_local_installchecks += toplevel_so_check
toplevel_so_check:
for i in `find $(DESTDIR)/$(libdir)/syncevolution $(DESTDIR)/$(libdir)/libsyncevo* $(DESTDIR)/$(libdir)/libsynthesis* -name *.so` $(DESTDIR)/$(bindir)/syncevolution; \
do \
if objdump -T -C $$i | grep -v :: | grep '\*UND\*' | sort | grep -v -w ical_strdup | grep -e ical -e " e_"; then \
echo "$$i should not depend on EDS, libical or libbluetooth"; \
exit 1; \
fi; \
if ldd $$i | grep -e libecal -e libebook -e libedata -e libical -e libbluetooth; then \
echo "$$i should not be linked against EDS, libical or libbluetooth"; \
exit 1; \
fi; \
done
endif
# Check that no executable or shared object depends on symbols in
# libraries that it does not link against. Unnecessarily linking
# against libs is okay, that can be caught and fixed by
@ -349,7 +322,16 @@ if NEON_COMPATIBILITY
# libneon is intentionally not linked against, to choose between
# GNUTLS and OpenSSL at runtime.
LINK_CHECK_ALLOWED += -e 'symbol ne_.*syncdav.so'
# Allow undefined references to libstdcxx. This happens when
# adding backends compiled on more recent Linux distros into
# the release archive.
LINK_CHECK_ALLOWED += -e '@GLIBCXX_[^ ]* used by'
endif
# libgdbussyncevo uses some symbols from libsyncevolution without
# linking against it (circular dependency).
LINK_CHECK_ALLOWED += -e SyncEvo.*libgdbussyncevo -e gsignond_pipe_stream_new.*libgdbussyncevo
LINK_CHECK_ALLOWED += $(EXTRA_LINK_CHECK_ALLOWED)
# Be strict about running 'syncevolution' only when not doing
# cross-compilation: in that case, if running 'syncevolution' fails,
@ -363,20 +345,29 @@ RUN_SYNCEVOLUTION_CHECK=die if $$?; return $$buffer;
endif
# patch README.rst properties on-the-fly
if COND_CMDLINE
README.patched.rst: README.rst src/syncevolution
$(AM_V_GEN)perl -e '$$syncfound=0; $$sourcefound=0; $$res=0;' \
-e 'sub run { $$cmd = shift; $$buffer = `env LD_LIBRARY_PATH=src/syncevo/.libs:src/gdbus/.libs:src/gdbusxx/.libs:src/build-synthesis/src/.libs:$$ENV{LD_LIBRARY_PATH} $$cmd`; $(RUN_SYNCEVOLUTION_CHECK) }' \
-e 'sub run { $$cmd = shift; $$buffer = `env LD_LIBRARY_PATH=src/syncevo/.libs:src/gdbusxx/.libs:src/build-synthesis/src/.libs:$$ENV{LD_LIBRARY_PATH} $$cmd`; $(RUN_SYNCEVOLUTION_CHECK) }' \
-e 'while (<>) {' \
-e 's/^:Version: .*/:Version: $(VERSION)/;' \
-e 's/:Date: .*/":Date: " . `date +%Y-%m-%d`/e;' \
-e 'if (s;(<< see "syncevolution --sync-property ." >>\n);run("src/syncevolution --daemon=no --sync-property ?") || $$1;e) { $$syncfound=1; }' \
-e 'if (s;(<< see "syncevolution --source-property ." >>\n);run("src/syncevolution --daemon=no --source-property ?") || $$1;e) { $$sourcefound=1; }' \
-e 'if (s;(<< see "syncevolution --datastore-property ." >>\n);run("src/syncevolution --daemon=no --source-property ?") || $$1;e) { $$sourcefound=1; }' \
-e 'print;' \
-e '}' \
-e 'die "<<sync-property>> tag not in README.rst?!" unless $$syncfound;' \
-e 'die "<<source-property>> tag not in README.rst?!" unless $$sourcefound;' \
-e 'exit $$res;' \
$< >$@
else
# Simpler version without inserting the actual sync and datastore properties.
README.patched.rst: README.rst
$(AM_V_GEN)perl -p \
-e 's/^:Version: .*/:Version: $(VERSION)/;' \
-e 's/:Date: .*/":Date: " . `date +%Y-%m-%d`/e;' \
$< >$@
endif
CLEANFILES += README.patched.rst
# produce man pages
@ -402,12 +393,27 @@ CLEANFILES += README.html
installcheck-local: $(all_local_installchecks) ;
dist-hook: $(all_dist_hooks)
install-exec-hook: $(all_install_exec_hooks)
uninstall-hook: $(all_uninstall_hooks)
# Can be overridden during make invocation to inject additional commands.
CREATE_EXTRA_BACKENDS=true
# Force sequential installation. This is a workaround for relinking failures
# during concurrent distcheck (a backend was relinked against not yet installed
# libsyncevolution.la).
#
# Also used to add additional backends. EXTRA_BACKENDS must already contain
# renamed files, by convention using -2.so, -3.so, etc as suffix instead of the
# base file's .so.
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am
@$(MAKE) $(AM_MAKEFLAGS) install-data-am
$(CREATE_EXTRA_BACKENDS) $(DESTDIR)/$(BACKENDS_DIRECTORY)
for i in $(EXTRA_BACKENDS); do $(INSTALL) $$i $(DESTDIR)/$(BACKENDS_DIRECTORY)/; done
# Necessary for "make distcheck": must not leave files behind.
uninstall-local:
rm -f $(DESTDIR)/$(BACKENDS_DIRECTORY)/*-[0-9].so
.DELETE_ON_ERROR:

4319
NEWS

File diff suppressed because it is too large Load Diff

30
README-DLT.rst Normal file
View File

@ -0,0 +1,30 @@
Diagnostic Log and Trace
========================
Diagnostic Log and Trace (DLT) is a logging mechanism defined and
implemented by GENIVI: http://projects.genivi.org/diagnostic-log-trace/
SyncEvolution optionally supports DLT as follows:
* syncevo-dbus-server, syncevo-dbus-helper and syncevo-local-sync can
log to DLT. Operations with "syncevolution --daemon=no" never use
DLT.
* Each of the three processes uses a different application ID. By
default, these IDs are "SYNS", "SYNH", "SYNL". These default can be
changed via configure options. All processes use just one context,
with the fixed ID "SYNC".
* syncevo-dbus-helper and syncevo-local-sync only run occasionally.
This makes is hard to adjust their log levels, for example via the
dlt-viewer, because the processes and their contexts are only shown
(known?) while the processes run. To work around this, the initial
log level of these two helpers are inherited from the
log level of the "SYNC" context in syncevo-dbus-helper.
* That log level defaults to "WARN", which ensures that normal runs
produce no output.
* To enable DLT support during compilation, use
"--enable-dlt" and "--with-dlt-syncevolution=SYNS,SYNH,SYNL" where SYNS/H/L
are the actual application IDs.
* To enable DLT support at runtime, run syncevo-dbus-server with
"--dlt". Logging to syslog should be disabled with "--no-syslog".
* The hierarchical log from libsynthesis gets flattened into a flat
stream of messages and no syncevolution-log.html files are written.

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ mkdir m4
glib-gettextize --force --copy
intltoolize --force --copy --automake
autoreconf -vifW all -W no-portability -W no-obsolete
autoreconf -v -i -f -W all -W no-portability -W no-obsolete
#libtoolize -c
#glib-gettextize --force --copy

View File

@ -3,7 +3,6 @@ dist_noinst_SCRIPTS += build/gen-git-version.sh \
EXTRA_DIST += \
build/export-foreign-git.sh \
build/export-gdbus.sh \
build/export-synthesis-xml.sh \
build/gen-backends-am.sh \
build/gen-backends.sh \

View File

@ -1,21 +0,0 @@
#! /bin/sh
#
# Run this inside the top level of a clean
# syncevolution git repository. Pass the path
# to a gdbus repository (default: ../libgdbus).
#
# The script generates .patch files for all changes
# made in the current branch to files which are
# shared with gdbus. The resulting files can
# be imported with "git am".
set -e
set -x
`dirname $0`/export-foreign-git.sh "${1:-../libgdbus}" src src/gdbus \
src/gdbus/debug.c \
src/gdbus/debug.h \
src/gdbus/gdbus.h \
src/gdbus/mainloop.c \
src/gdbus/object.c \
src/gdbus/watch.c

View File

@ -48,17 +48,17 @@ checksource ()
# already a hash, abbreviate
hash=`echo $hash | sed -e 's/\(......\).*/\1/'`
fi
# detect -<number of changes>-g<hash> suffix added when tag is older than HEAD
if perl -e "exit !('$describe' =~ m/-[0-9]+-[0-9a-g]{8}\$/);"; then
# remove suffix to get tag (doesn't matter if we do not pick
# the most recent one)
exact=
tag=`echo $describe | sed -e 's/-[0123456789]*-g.*//'`
else
if git show-ref --tags | grep -q $hash; then
# there is at least one tag matching HEAD;
# pick the most recent one (based on lexical sorting)
exact=1
tag=`git show-ref --tags | grep $hash | sort | tail -1 | sed -e 's;.*refs/tags/;;'`
else
# Detect -<number of changes>-g<hash> suffix added when tag is older than HEAD.
# Remove suffix to get tag (doesn't matter if we do not pick
# the most recent one).
exact=
tag=`echo $describe | sed -e 's/-[0123456789]*-g.*//'`
fi
simpletag=$tag
# Hyphens between numbers in the tag are dots in the version

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
"""
Converts source code (first parameter, can be - for stdin) to HTML
@ -29,8 +29,8 @@ try:
pygments.highlight(code, lexer, formatter, out)
except:
import cgi
print >>sys.stderr, "source2html.py failed with pygments:", sys.exc_info()
print >>sys.stderr, "falling back to internal code"
print("source2html.py failed with pygments:", sys.exc_info(), file=sys.stderr)
print("falling back to internal code", file=sys.stderr)
out.write('''<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>

View File

@ -8,7 +8,7 @@ dnl Invoke autogen.sh to produce a configure script.
#
# Starting with the 1.1 release cycle, the rpm-style
# .99 pseudo-version number is used to mark a pre-release.
AC_INIT([syncevolution], [m4_esyscmd([build/gen-git-version.sh 1.3.2])])
AC_INIT([syncevolution], [m4_esyscmd([build/gen-git-version.sh 2.0.0])])
# STABLE_VERSION=1.0.1+
AC_SUBST(STABLE_VERSION)
@ -25,7 +25,7 @@ SE_CHECK_FOR_STABLE_RELEASE
# Minimum version of libsynthesis as defined in its
# configure script and thus .pc files:
define([SYNTHESIS_MIN_VERSION], [3.4.0.16.8])
define([SYNTHESIS_MIN_VERSION], [3.4.0.47.5])
# Line above is patched by gen-autotools.sh. Handle
# both "yes" and "no".
@ -55,17 +55,45 @@ dnl Specify git revisions/branches without prefix, i.e., without 'origin'.
dnl We'll sort that out below.
define([SYNTHESISSRC_REVISION], [syncevolution-0.9])
AC_CONFIG_HEADERS(config.h)
LT_INIT([dlopen])
AC_LIBTOOL_DLOPEN
AC_PROG_LIBTOOL
dnl check for programs.
AC_PROG_CXX
AC_PROG_MAKE_SET
AC_PATH_PROGS(PYTHON, python3 python, "")
if test "x$PYTHON" = "x" ; then
AC_ERROR([python3 not found])
fi
dnl Use the most recent C++ standard that is supported by the code.
dnl We can fall back to older versions, but not below C++11.
dnl Akonadi/Qt don't work with C++17 yet, so we can't enable that.
AX_CXX_COMPILE_STDCXX_14(noext, optional)
if test "$HAVE_CXX14" -ne 1; then
AX_CXX_COMPILE_STDCXX_11(noext, mandatory)
fi
# Boost headers: boost/foreach.hpp is needed (1.33/Debian Etch
# doesn't have it, 1.34/Ubuntu 8.10 Hardy does). 1.35 is available
# as Debian Etch backport.
AX_BOOST_BASE(1.34)
# TODO: Fix code to pass with -pedantic -Wextra.
# -Wno-unknown-pragmas needed because icalstrdup.h
# currently uses the "#pragma }" trick. Should remove that.
# Fix code to work without deprecated methods: G GDK GDK_PIXBUF CAIRO PANGO GTK
# -Wno-deprecated-declarations is needed everywhere (i.e. not just in certain
# modules, like SYNCEVO_WFLAGS_DEPRECATED) because EDS on Ubuntu Eon uses
# the deprecated GDateTime in its header, which we included through our
# EDS/libical wrapper even when not actually used.
DK_ARG_ENABLE_WARNINGS([SYNCEVO_WFLAGS],
[-Wall -Wno-unknown-pragmas],
[-Wall -Wno-unknown-pragmas -Wno-deprecated-declarations],
[])
# Fix code to work without deprecated methods: G GDK GDK_PIXBUF CAIRO PANGO GTK
DK_ARG_ENABLE_WARNINGS([SYNCEVO_WFLAGS_DEPRECATED],
[-Wall -Wno-unknown-pragmas -Wno-deprecated-declarations],
[-Wall -Wno-unknown-pragmas -Wno-deprecated-declarations],
[])
@ -110,6 +138,12 @@ AC_ARG_WITH(synthesis-revision,
[Identifies which source revision to use from --with-synthesis-src repository, empty string stands for latest. Default for default --synthesis-src: SYNTHESISSRC_REVISION]),
[REVISION="$withval"])
AC_ARG_WITH(extra-core-ldadd,
AS_HELP_STRING([--with-extra-core-ldadd=<linker options>],
[Additional linker flags, used to produce more portable syncevolution.org binaries.]),
[EXTRACORELDADD="$withval"])
AC_SUBST(EXTRACORELDADD)
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared],
[build backends as dynamically loadable modules]),
@ -136,9 +170,21 @@ AC_ARG_ENABLE(static-cxx,
AC_ARG_ENABLE(evolution-compatibility,
AS_HELP_STRING([--enable-evolution-compatibility],
[build executables which only call Evolution via dlopen/dlsym: this avoids all hard dependencies on EDS shared objects, but might lead to crashes when their ABI changes]),
[build executables which only call Evolution via dlopen/dlsym: this avoids all hard dependencies on EDS shared objects, but might lead to crashes when their ABI changes; use --enable-evolution-compatibility=ical to enable a weaker mode where linking is done normally and only libical.so.0/1 enum differences are worked around (allows patching resulting executables to use either of these two)]),
enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
AC_ARG_ENABLE(internal-icaltz,
AS_HELP_STRING([--disable-internal-icaltz],
[libical 1.0 updated its system zone data parsing code so that it produces VTIMEZONEs which are unsuitable for syncing. SyncEvolution ships with a copy of the older code and uses it by default in combination with libical 1.0. Starting with libical v2, icaltzutil_set_exact_vtimezones_support and the code in libical is used again.]),
[enable_icaltz_util="$enableval"
test "$enable_icaltz_util" = "yes" || test "$enable_icaltz_util" = "no" || AC_ERROR([invalid value of --disable-internal-icaltz: $enableval])],
[PKG_CHECK_MODULES(LIBICAL2, libical >= 2, [enable_icaltz_util="no"], [enable_icaltz_util="yes"])])
if test "$enable_icaltz_util" = "yes"; then
AC_DEFINE(ENABLE_ICALTZ_UTIL, [1], [use internal icaltz-util.c])
AC_DEFINE(DISABLE_ICALTZUTIL_GET_ZONE_DIRECTORY, [1], [use libical's icaltzutil_get_zone_directory()])
fi
AM_CONDITIONAL([ENABLE_ICALTZ_UTIL], [test "$enable_icaltz_util" = "yes"])
AC_ARG_ENABLE(developer-mode,
AS_HELP_STRING([--enable-developer-mode],
[The dynamic loadble backend libraries is loaded from current build directory instead of the standard library path]),
@ -157,19 +203,18 @@ AC_SUBST(MODIFY_SYNCCOMPARE)
AC_CHECK_HEADERS(signal.h dlfcn.h)
# For icaltz-util.c
AC_CHECK_HEADERS(byteswap.h endian.h sys/endian.h unistd.h stdint.h)
# cppunit-config is used even when both unit tests and integration tests are disabled.
AC_PATH_PROG([CPPUNIT_CONFIG], [cppunit-config], [no])
test "x$CPPUNIT_CONFIG" != 'xno' || AC_MSG_ERROR("cppunit-config not found.")
# cppunit needed?
#if test "x$enable_unit_tests" = 'xyes' || test "x$enable_integration_tests" = 'xyes'
#then
CPPUNIT_CXXFLAGS=`$CPPUNIT_CONFIG --cflags`
CPPUNIT_LDFLAGS=`$CPPUNIT_CONFIG --libs`
#fi
AC_SUBST(CPPUNIT_CXXFLAGS)
AC_SUBST(CPPUNIT_LDFLAGS)
PKG_CHECK_MODULES(CPPUNIT, cppunit,
[true],
[if test "$enable_unit_tests" = 'yes' || test "$enable_integration_tests" = 'yes'; then
AC_MSG_ERROR("cppunit.pc not found.")
fi])
if test "x$enable_unit_tests" = 'xyes'; then
AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
@ -200,12 +245,9 @@ else
have_libcurl="no"
fi
PKG_CHECK_MODULES(LIBSOUP, libsoup-gnome-2.4,
[have_libsoup="yes"
AC_DEFINE(HAVE_LIBSOUP_SOUP_GNOME_FEATURES_H, 1, [enable GNOME specific libsoup])],
[PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4,
have_libsoup="yes",
have_libsoup="no")])
PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4 >= 2.42,
have_libsoup="yes",
have_libsoup="no")
PKG_CHECK_MODULES(LIBOPENOBEX, openobex, have_obex="yes", have_obex="no")
have_bluetooth="no"
@ -281,6 +323,30 @@ AC_ARG_ENABLE(libsoup,
# SoupTransportAgent depends on glib
case "$TRANSPORT" in *libsoup*) need_glib=yes;; esac
AC_ARG_ENABLE(dlt,
AS_HELP_STRING([--enable-dlt],
[enable logging via GENIVI Diagnostic Log and Trace (DLT)]),
[enable_dlt=$enableval
test $enable_dlt = "yes" || test $enable_dlt = "no" || AC_ERROR([invalid value of --enable-dlt: $enableval])],
[enable_dlt="no"])
if test "$enable_dlt" = "yes"; then
PKG_CHECK_MODULES(DLT, automotive-dlt,
[USE_DLT=1],
[AC_ERROR([dlt not found, required for --enable-dlt])])
AC_DEFINE(USE_DLT, 1, "optionally use GENIVI Diagnostic Log and Trace for logging")
AC_ARG_WITH([dlt-syncevolution],
AS_HELP_STRING([--with-dlt-syncevolution=SYNS,SYNH,SYNL],
[controls the application IDs used by syncevo-dbus-server, syncevo-dbus-helper and syncevo-local-sync]),
[with_dlt_ids="$withval"],
[with_dlt_ids="SYNS,SYNH,SYNL"])
syns=`echo $with_dlt_ids | cut -d , -f 1`
synh=`echo $with_dlt_ids | cut -d , -f 2`
synl=`echo $with_dlt_ids | cut -d , -f 3`
AC_DEFINE_UNQUOTED(DLT_SYNCEVO_DBUS_SERVER_ID, "$syns", "DLT app ID for syncevo-dbus-server")
AC_DEFINE_UNQUOTED(DLT_SYNCEVO_DBUS_HELPER_ID, "$synh", "DLT app ID for syncevo-dbus-helper")
AC_DEFINE_UNQUOTED(DLT_SYNCEVO_LOCAL_HELPER_ID, "$synl", "DLT app ID for syncevo-local-helper")
fi
bluetooth_disabled=no
AC_ARG_ENABLE(bluetooth,
AS_HELP_STRING([--enable-bluetooth],
@ -430,48 +496,50 @@ AC_ARG_ENABLE(core,
enable_core="$enableval",
enable_core="yes")
AM_CONDITIONAL([COND_CORE], [test "$enable_core" = "yes"])
AC_ARG_ENABLE(cmdline,
AS_HELP_STRING([--enable-cmdline],
[enables building the SyncEvolution command line tool, syncevolution]),
enable_cmdline="$enableval",
enable_cmdline="yes")
AM_CONDITIONAL([COND_CMDLINE], [test "$enable_cmdline" = "yes"])
AC_ARG_ENABLE(local-sync,
AS_HELP_STRING([--enable-local-sync],
[enables building the local synchronization support, in particular syncevo-local-sync]),
enable_local_sync="$enableval",
enable_local_sync="yes")
AM_CONDITIONAL([COND_LOCAL_SYNC], [test "$enable_local_sync" = "yes"])
AC_ARG_ENABLE(dbus-service,
AS_HELP_STRING([--enable-dbus-service],
[enables building the dbus service executable and all related features
(the DBus wrapper library, command line usage of server, etc).]),
AS_HELP_STRING([--enable-dbus-service=args],
[Enables building the dbus service executable and all related features
(the DBus wrapper library, command line usage of server, etc).
The optional arguments are syncevo-dbus-server command line arguments
that are used when auto-starting via D-Bus or .desktop file. By default,
the daemon logs to syslog. This can be changed via command line arguments.
]),
enable_dbus_service="$enableval",
[if test $enable_gui = "no"; then
enable_dbus_service="no"
else
enable_dbus_service="yes"
fi])
AM_CONDITIONAL([COND_DBUS], [test "$enable_dbus_service" = "yes"])
AM_CONDITIONAL([COND_DBUS], [test "$enable_dbus_service" != "no"])
if test "$enable_dbus_service" != "no" && test "$enable_dbus_service" != "yes"; then
SYNCEVO_DBUS_SERVER_ARGS="$enable_dbus_service"
fi
AC_SUBST(SYNCEVO_DBUS_SERVER_ARGS)
AC_ARG_WITH([gio-gdbus],
AS_HELP_STRING([--with-gio-gdbus],
[enables use of GIO's GDBus instead of the in-tree, Bluez gdbus.]),
with_gio_gdbus="$withval",
PKG_CHECK_EXISTS([gio-2.0 >= 2.30],
[with_gio_gdbus="yes"],
[with_gio_gdbus="no"]))
AM_CONDITIONAL([COND_GIO_GDBUS], [test "x$with_gio_gdbus" = "xyes"])
# We only need to check for dbus-1 if gio-gdbus is not used.
#
# Local sync depends on D-Bus communication between parent
# and child process (works without a D-Bus daemon), and local
# sync is not an optional feature. Could be made one if
# someone is interested enough.
#
# Therefore, at the moment, either libdbus or gio-gdbus are needed
# Therefore, at the moment, gio-gdbus is needed
# unconditionally. glib is needed in all cases now.
need_glib=yes
AS_IF([test "x$with_gio_gdbus" = "xyes"],
[PKG_CHECK_MODULES([DBUS], [gio-2.0 >= 2.26])
AC_DEFINE([WITH_GIO_GDBUS],[],[Set if using GIO GDBus])],
[PKG_CHECK_MODULES(DBUS, dbus-1, dummy=yes,
AC_MSG_ERROR(libdbus-1 is required))
AC_CHECK_LIB(dbus-1, dbus_watch_get_unix_fd, dummy=yes,
AC_DEFINE(NEED_DBUS_WATCH_GET_UNIX_FD, 1,
[Define to 1 if you need the dbus_watch_get_unix_fd() function.]))])
PKG_CHECK_MODULES([DBUS], [gio-2.0 >= 2.26])
if test $enable_dbus_service = "yes"; then
if test "$enable_dbus_service" != "no"; then
if test -z "$XSLT"; then
AC_MSG_ERROR([xsltproc not found, is required for D-Bus service])
fi
@ -487,17 +555,6 @@ if test $enable_dbus_service = "yes"; then
[AC_DEFINE(HAS_NOTIFY, 1,
[define if libnotify could be used in dbus service])])
AC_ARG_ENABLE(notify-compatibility,
AS_HELP_STRING([--enable-notify-compatibility],
[increase compatibility with binary libnotify installations by loading libnotify.so.1..4 dynamically instead of linking against it]),
[enable_notify_compat="$enableval"],
[enable_notify_compat="no"]
)
if test "$enable_notify_compat" = "yes"; then
AC_DEFINE(NOTIFY_COMPATIBILITY, 1, [dynamically open libnotify])
LIBNOTIFY_LIBS="`echo $LIBNOTIFY_LIBS | sed -e 's/\(-lnotify\|[^ ]*libnotify.la\)/-ldl/'`"
fi
# Here we're using QtGui too because mlite fails to depend on it,
# despite using QAction.
PKG_CHECK_MODULES(MLITE, [mlite QtGui], HAVE_MLITE=yes, HAVE_MLITE=no)
@ -516,7 +573,6 @@ if test $enable_dbus_service = "yes"; then
fi
AC_DEFINE(DBUS_SERVICE, 1, [define if dbus service is enabled])
fi
AM_CONDITIONAL([NOTIFY_COMPATIBILITY], [test "$enable_notify_compat" = "yes"])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
@ -530,7 +586,7 @@ DBUS_SERVICES_DIR="${datadir}/dbus-1/services"
AC_SUBST(DBUS_SERVICES_DIR)
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Location of D-Bus services directory])
if test $enable_gui != "no" || test $enable_dbus_service = "yes"; then
if test "$enable_gui" != "no" || test "$enable_dbus_service" != "no"; then
IT_PROG_INTLTOOL([0.37.1])
GETTEXT_PACKAGE=syncevolution
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name])
@ -594,7 +650,7 @@ if test $enable_gui != "no"; then
PKG_CHECK_MODULES(GUI, $gui_modules)
elif test "$enable_dbus_service" = "yes"; then
elif test "$enable_dbus_service" != "no"; then
# syncevo-dbus-server needs localization
:
else
@ -608,15 +664,6 @@ AC_SUBST(GUI_LIBS)
AC_SUBST(GUI_PROGRAMS)
AC_SUBST(GUI_DESKTOP_FILES)
# Boost headers: boost/foreach.hpp is needed (1.33/Debian Etch
# doesn't have it, 1.34/Ubuntu 8.10 Hardy does). 1.35 is available
# as Debian Etch backport.
AX_BOOST_BASE(1.34)
# C++ regular expression support is required often enough to make it
# mandatory.
PKG_CHECK_MODULES(PCRECPP, libpcrecpp)
# need rst2man for man pages
AC_ARG_WITH(rst2man,
AS_HELP_STRING([--with-rst2man=<path to reStructuredText to man converter>],
@ -764,7 +811,7 @@ if test $SYNTHESIS_SRC != "no-synthesis-source"; then
export PKG_CONFIG_PATH=$SYNTHESIS_SUBDIR:$PKG_CONFIG_PATH
PKG_CHECK_MODULES([WITH_SYNTHESIS_SRC], [synthesis >= SYNTHESIS_MIN_VERSION],
[],
[AC_MSG_ERROR([need at least libsynthesis >= SYNTHESIS_MIN_VERSION; the latest libsynthesis for SyncEvolution is the one from http://meego.gitorious.org/meego-middleware/libsynthesis])])
[AC_MSG_ERROR([need at least libsynthesis >= SYNTHESIS_MIN_VERSION; the latest libsynthesis for SyncEvolution is the one from http://cgit.freedesktop.org/SyncEvolution/])])
fi
@ -871,6 +918,7 @@ if test "$need_glib" = "yes"; then
PKG_CHECK_MODULES(GTHREAD, "gthread-2.0", , GLIBFOUND=no)
PKG_CHECK_MODULES(GOBJECT, "gobject-2.0", , GLIBFOUND=no)
PKG_CHECK_MODULES(GIO, "gio-2.0", , GLIBFOUND=no)
PKG_CHECK_MODULES(GIOUNIX, "gio-unix-2.0", , GLIBFOUND=no)
if test "x${GLIBFOUND}" = "xyes"; then
AC_DEFINE(HAVE_GLIB, 1, [glib found])
@ -880,16 +928,20 @@ if test "$need_glib" = "yes"; then
BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $GLIB_CFLAGS $GTHREAD_CFLAGS $GOBJECT_CFLAGS"
fi
dnl use libical if and only if required by some backend
dnl check for libical if needed by backend or icaltz-util.
if test "$need_ical" = "yes" || test "$enable_icaltz_util" = "yes"; then
PKG_CHECK_MODULES(LIBICAL, libical)
PKG_CHECK_MODULES(LIBICAL_AVAILABLE, libical >= 0.43,
[AC_DEFINE(HAVE_LIBICAL_R, 1, [have recent enough libical with _r variants])],
[true])
fi
dnl Use libical in eds_abi_wrapper if and only if required by some backend.
if test "$need_ical" = "yes"; then
PKG_CHECK_MODULES(LIBICAL, libical,
[true],
[PKG_CHECK_MODULES(LIBICAL, libecal-1.2)])
AC_DEFINE(ENABLE_ICAL, 1, [libical in use])
fi
AM_CONDITIONAL([ENABLE_ICAL], [test "$need_ical" = "yes"])
# Check for Qt if some backend needs it.
if test "$need_qt_modules"; then
AT_WITH_QT([-gui $need_qt_modules],
@ -934,21 +986,6 @@ if test "$host" = "arm-apple-darwin"; then
DEVICE_TYPE=iPhone
fi
dnl --enable-evolution-compatibility
if test "$enable_evolution_compatibility" = "yes"; then
AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects])
# don't link against libs wrapped by eds_abi_wrapper (no longer limited to EDS alone...)
ECAL_LIBS=
EBOOK_LIBS=
EPACKAGE_LIBS=
BLUEZ_LIBS=
fi
AM_CONDITIONAL([ENABLE_EVOLUTION_COMPATIBILITY], [test "$enable_evolution_compatibility" = "yes"])
PKG_CHECK_MODULES(LIBICAL_AVAILABLE,
libical >= 0.43,
AC_DEFINE(HAVE_LIBICAL_R, 1, [have recent enough libical with _r variants]),
pass)
dnl --enable-developer-mode
if test "$enable_developer_mode" = "yes"; then
BACKENDS_SEARCH_DIRECTORY="`pwd`/src/backends/"
@ -1000,6 +1037,7 @@ fi
# When adding something here, remember to also update syncevolution.pc.in.
# -lrt is for clock_gettime() in the Timespec.h inline functions.
SYNCEVOLUTION_CFLAGS=-I`cd $srcdir && pwd`/src
# Linker flags including libsyncevolution.la and some libs.
SYNCEVOLUTION_LIBS="src/syncevo/libsyncevolution.la -lrt"
AC_SUBST(SYNCEVOLUTION_CFLAGS)
AC_SUBST(SYNCEVOLUTION_LIBS)
@ -1007,6 +1045,12 @@ AC_SUBST(SYNCEVOLUTION_LIBS)
# invoking syncevolution binary is allowed to fail when cross-compiling
AM_CONDITIONAL([COND_CROSS_COMPILING], [test "$cross_compiling" = "yes"])
# Set by any of the backends providing a keyring, determines the
# default for the "keyring" option.
if test "$have_keyring" = "yes"; then
AC_DEFINE(HAVE_KEYRING, 1, [some kind of secure credential store is available])
fi
AC_CONFIG_FILES([
Makefile
src/syncevo/syncevolution.pc
@ -1022,9 +1066,10 @@ echo "Core SyncEvolution: $enable_core"
for backend in $BACKENDS; do
eval echo $backend: \${enable_${backend}}
done
echo "libical v1 timezone hack: $enable_icaltz_util"
echo "DBus service: $enable_dbus_service"
echo "org._01.pim support in DBus service: $enable_dbus_pim"
echo "Notifications: $enable_notify"
echo "GIO GDBus: $with_gio_gdbus"
echo "GNOME keyring: $enable_gnome_keyring"
if test "$enable_gui" = "no"; then
echo "UI (DBus client): no"

17
debian/NEWS vendored
View File

@ -1,6 +1,15 @@
syncevolution (1.3.99.7-1) unstable; urgency=high
Akonadi support for KDE is now enabled. The support for GNOME and KDE
has been split into new packages named syncevolution-libs-gnome and
syncevolution-libs-kde. If you only want to use KDE, you can remove
syncevolution-libs-gnome.
-- Tino Keitel <tino+debian@tikei.de> Fri, 31 Jan 2014 12:37:10 +0100
syncevolution (1.2.99.1-1) unstable; urgency=low
* The sync format of existing configurations for Mobical (aka Everdroid)
The sync format of existing configurations for Mobical (aka Everdroid)
must be updated manually, because the server has encoding problems when
using vCard 3.0 (now the default for Evolution contacts):
@ -8,7 +17,7 @@ syncevolution (1.2.99.1-1) unstable; urgency=low
syncFormat=text/x-vcard \
mobical addressbook
* The Funambol template explicitly enables usage of the
The Funambol template explicitly enables usage of the
"refresh-from-server" sync mode to avoid getting throttled with 417
'retry later' errors. The same must be added to existing configs
manually:
@ -21,11 +30,11 @@ syncevolution (1.2.99.1-1) unstable; urgency=low
syncevolution (1.1.99.5a-1) experimental; urgency=low
* This version of syncevolution introduces an irreversible change to the
This version of syncevolution introduces an irreversible change to the
config layout, see the --migrate option in the syncevolution man page.
Migration happens automatically at first invocation.
* This version is only know to work with version 2.32.2 of evolution.
This version is only know to work with version 2.32.2 of evolution.
In particular, it probably won't work with the version of evolution in
squeeze.

36
debian/README.source vendored
View File

@ -1,36 +0,0 @@
Building syncevolution for Debian
---------------------------------
The source package needs no special instructions; the discussion here
is about working with the git repository.
Patches are exported based on debian/source/git-patches; each line is
an argument to git-format-patch. The variables $DEB_VERSION and
$UPSTREAM_VERSION are the Debian and upstream version being exported.
You can either use git-format-patch manually, or install gitpkg
version 0.17 or later.
1) To have the patches automatically exported at source package creation time
a) to setup gitpkg, run
% git config gitpkg.deb-export-hook /usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
b) run
% gitpkg master
to make a source package.
2) To manually export patches, run
% ./debian/rules export-patches
The original source tarballs are stored in the git repo using
pristine-tar. You can (optionally) check out the current tarball by
git branch pristine-tar origin/pristine-tar
# UPSTREAM should be the current upstream version
pristine-tar checkout ../syncevolution_$(UPSTREAM).orig.tar.gz
-- David Bremner <bremner@debian.org>, Tue, 8 Mar 2011 19:34:24 -0400

8
debian/TODO vendored
View File

@ -1,5 +1,3 @@
- add missing manpages for syncompare and syncevo-http-server
- clean up src/syncevo/CmdLine.cpp(.orig|.rej)
-- David Bremner <bremner@debian.org>, Thu, 11 Nov 2010 11:48:32 -0400
* add missing manpages for syncompare and syncevo-http-server
* fix FTPFS with g++ 11 without CXXFLAG -std=c++14;
see <https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/issues/167>

235
debian/changelog vendored
View File

@ -1,3 +1,228 @@
syncevolution (2.0.0-2) experimental; urgency=medium
[ Jonas Smedegaard ]
* update copyright info:
+ fix consistently use field License-Grant (not Grant)
+ fix consistently use field Files (not bogus File)
+ fix add License section LGPL-2
+ tighten license-related lintian overrides
* fix have syncevolution-http depend on python3-gi
(not bogus python3-gobject:
earlier transitional package python-gobject pulled in python-gi)
* fix drop depending on python3-twisted-web:
bogus (transitioned to python3-twisted-core)
and used only by exerimental unused script
* tighten dh-missing to fail (not only warn) on missed files
+ list unversioned symlinks to shared objects as not-installed
+ list helper scripts for testing as not-installed
* fix install XDG startup files in syncevolution-dbus
* fix install SRV resolver script in syncevolution-common,
recommend adns-utils (or simpler fallbacks),
and have syncevolution-libs recommend syncevolution-common
* work around FTPFS with g++ 11 by setting CXXFLAG -std=c++14
[ Joao Azevedo ]
* list library syncactivesync.so as not installed
(to match upstream intent in unconventional build target)
* list TDEPIM libraries as not installed
(we no longer link against KDE libraries so unlikely to be useful)
* fix install libraries syncpbap providergoa
-- Jonas Smedegaard <dr@jones.dk> Wed, 03 Nov 2021 15:50:49 +0100
syncevolution (2.0.0-1) experimental; urgency=medium
[ upstream ]
* new release
[ Jonas Smedegaard ]
* isolate kfreebsd FTBFS fix as patch 1001,
and track package source with patches unapplied
* add git-buildpackage config:
+ use pristine-tar
+ sign tags
+ avoid any .git* files
+ use DEP-14 branches debian/latest upstream/latest
+ add usage comment
* drop obsolete *-dbg to *-dbgsym migration
* simplify rules;
stop explicitly build-depend on libtool automake pkg-config
(pulled in via autoreconf since debhelper compatibility level 10)
* use debhelper compatibility level 13 (not 11);
build-depend on debhelper-compat (not debhelper)
* relax to stop build-depend explicitly on g++:
required version satisfied by default
in all supported Debian releases
* drop ancient Breaks/Replaces hints
* stop link against KDE libraries (no longer supported upstream):
+ drop binary package syncevolution-libs-kde
+ stop build-depend on kdelibs5-dev kdepimlibs5-dev
* stop install library to support ActiveSync
(no longer supported upstream)
* use Python 3.x libraries:
+ build-depend on python3-docutils (not python-docutils)
+ have syncevolution-http depend on python3 python3-dbus
python3-gobject python3-openssl
python3-pygments python3-twisted-web
(not python python-dbus python-gobject
python-openssl python-twisted-web)
* stop build-depend on libpcre3-dev
* build-depend on libecal2.0-dev (not libecal1.2-dev)
* relax to build-depend unversioned on libsynthesis-dev:
required version satisfied in all supported Debian releases
* add patch 1002
to adjust whitespace as required for recent autotools
* fix install all pstream-provided gettext machine-object files
* install all upstream-provided README.* files
* install more example files
* improve install tracking with dh_missing:
package upstream-installed manpage (not source file)
* explicitly list files deliberately not installed
* stop install syncevolution-dbus example file dropped upstream
* update install paths
[ João Azevedo ]
* don't use install for syncevo-http-server.py
-- Jonas Smedegaard <dr@jones.dk> Tue, 05 Oct 2021 17:45:04 +0200
syncevolution (1.5.3-2) unstable; urgency=medium
* Remove libgconf2-dev build-dep (Closes: #897258)
-- Tino Mettler <tino+debian@tikei.de> Thu, 21 Jun 2018 21:19:04 +0200
syncevolution (1.5.3-1) unstable; urgency=medium
* New upstream release
* Fix override_dh_makeshlibs to handle all packages with public shared libs
(Closes: #887043)
* Remove obsolete Conflicts:/Breaks:/Replaces: sync-ui (<<1.1+ds1-1~)
* Change debhelper compatibility to 11, which is recommended
* Bump standards version to 4.1.3, no changes needed
* Fix several lintian warnings
-- Tino Mettler <tino+debian@tikei.de> Sat, 13 Jan 2018 22:47:44 +0100
syncevolution (1.5.2-3) unstable; urgency=medium
[ Patrick Ohly ]
* libical: support libical v3 (Closes: #884158)
* GNOME: replace gnome-keyring with libsecret
[ Tino Mettler ]
* Change build dependencies for libgtk and glade to use GTK3 for sync-ui
(Closes: #884162)
* Add Build-Dep on libjson-c-dev, enable and include oauth2 backend
(Closes: #884170)
* Handle C++ conversion operator name mangling in GCC 7 (Closes: #871284)
* Build depend on libsecret-1-dev instead of deprecated libgnome-keyring-dev
(Closes: #867944)
-- Tino Mettler <tino+debian@tikei.de> Thu, 04 Jan 2018 22:21:57 +0100
syncevolution (1.5.2-2) unstable; urgency=medium
* Add missing service file for syncevo-dbus-server (Closes: #854941)
-- Tino Mettler <tino+debian@tikei.de> Fri, 24 Feb 2017 12:17:56 +0100
syncevolution (1.5.2-1) unstable; urgency=medium
* New upstream version
* Remove patch for GCC6 build failures, as they are fixed upstream
* Remove flags to downgrade the C++ dialect, fixed upstream
* Remove 0002-Fix-FTBFS-with-libical2.patch, fixed upstream
* Use HTTPS for URL to git web view
* Improve short descriptions
-- Tino Mettler <tino+debian@tikei.de> Fri, 18 Nov 2016 13:11:53 +0100
syncevolution (1.5.1-2) unstable; urgency=medium
* Add 0003-Add-missing-casts-from-shared_ptr-to-bool-to-fix-FTB.patch
to add missing casts from shared_ptr to bool, fixes FTBFS with GCC 6
* Fix remaining FTBFS with GCC 6 by downgrading the C++ dialect to gnu++98
(Closes: #811624)
-- Tino Mettler <tino+debian@tikei.de> Mon, 11 Jul 2016 10:17:38 +0200
syncevolution (1.5.1-1) unstable; urgency=medium
* New upstream release (Closes: #803416)
* Fix FTBFS with libical2 (Closes: #824426)
* Remove 0002-Use-TLS-instead-of-SSLv3-in-SyncML-server-script.patch
which was merged upstream
* Update Vcs-* fields to new URLs
* Bump standards version, no changes needed
* Add dh_auto_clean quirk to make the package build twice in a row
* Upstream generates a manpage, remove outdated and obsolete own version
* Remove old debug package definition, use the new dbgsym packages
* Depend on recent libsynthesis package
-- Tino Mettler <tino+debian@tikei.de> Thu, 19 May 2016 11:41:07 +0200
syncevolution (1.4.99.4-5) unstable; urgency=medium
* Build-depend on libopenobex2-dev (Closes: #813819)
-- Tino Mettler <tino+debian@tikei.de> Fri, 26 Feb 2016 11:57:35 +0100
syncevolution (1.4.99.4-4) unstable; urgency=medium
* Fix libsynthesis depencency after GCC5 transition (Closes: #797966)
-- Tino Mettler <tino+debian@tikei.de> Fri, 26 Feb 2016 11:56:50 +0100
syncevolution (1.4.99.4-3) unstable; urgency=medium
* Use TLS instead of SSLv3 in SyncML server script (Closes: #772040)
-- Tino Mettler <tino+debian@tikei.de> Thu, 04 Dec 2014 22:44:49 +0100
syncevolution (1.4.99.4-2) unstable; urgency=medium
* Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC
-- Tino Mettler <tino+debian@tikei.de> Sun, 26 Oct 2014 14:12:59 +0100
syncevolution (1.4.99.4-1) unstable; urgency=medium
* New upstream release candidate
* Build-depend on libsynthesis 3.4.0.47.4
* syncaddressbook.so vanished, as iOS addressbook support was removed
-- Tino Mettler <tino+debian@tikei.de> Sat, 25 Oct 2014 22:34:41 +0200
syncevolution (1.4-1) unstable; urgency=high
* New upstream release
* Allow parallel builds
* Adjust Maintainer: field to new surname
* Fix FTBFS due to erroneously hardcoded x86_64 path in an install file
(Closes: #739665)
* Fix upgrade from versions before 1.3.99.7 due to file conflicts.
Thanks to Simon McVittie (Closes: #739662)
* Add sections for files previously missing in copyright information
(Closes: #739616)
* Remove 0001-Fix-incorrect-mktemp-usage-reported-by-Helmut-Grohne.patch,
fixed upstream in a different way
-- Tino Mettler <tino+debian@tikei.de> Fri, 21 Feb 2014 11:44:04 +0100
syncevolution (1.3.99.7-1) unstable; urgency=high
* New upstream release candidate
* Add 0001-Fix-incorrect-mktemp-usage-reported-by-Helmut-Grohne.patch,
which fixes CVE-2014-1639
(Closes: #736357)
* Enable Akonadi support, separate Evolution (GNOME) and Akonadi (KDE) support
(Closes: #682520)
* Update standards version to 3.9.5, no changes needed
* Add NEWS item to describe changes regarding KDE and GNOME support
-- Tino Keitel <tino+debian@tikei.de> Fri, 31 Jan 2014 12:44:35 +0100
syncevolution (1.3.2-1) unstable; urgency=low
* Install syncevo-local-sync helper, required for CardDAV/CalDAV.
@ -91,7 +316,7 @@ syncevolution (1.1.99.4+ds1-1) experimental; urgency=low
syncevolution (1.1.99.3+ds1-1) experimental; urgency=low
* New upstream (pre-release) version
* Remove two s390 related patches, now contained in upstream
* Remove two s390 related patches, now contained in upstream
commit 63d76f874270cbafb2.
-- David Bremner <bremner@debian.org> Tue, 08 Mar 2011 16:05:30 -0400
@ -107,7 +332,7 @@ syncevolution (1.1+ds1-5) unstable; urgency=low
syncevolution (1.1+ds1-4) experimental; urgency=low
* Remove build dependency on libopenobex1-dev on hurd-i386, because it is not
* Remove build dependency on libopenobex1-dev on hurd-i386, because it is not
available there. The package is already built without it on kfreebsd.
* Explicitly translate between sysync::memSize and size_t. Thanks to
Patrick Ohly for the patch.
@ -137,7 +362,7 @@ syncevolution (1.1+ds1-1) experimental; urgency=low
* Add -dbg package to hold debugging symbols
* Recommend evolution-data-server instead of evolution
* Update Standards-Version to 3.9.1 (No changes).
[ Thomas Bechtold ]
* Split source package into syncevolution-common, syncevolution and
sync-ui.
@ -159,7 +384,7 @@ syncevolution (1.0+ds1~beta2a-1) unstable; urgency=low
syncevolution (1.0+ds1~a1-2) experimental; urgency=low
* Don't build depend on libopenobex1-dev on kfreebsd-*. This avoids
trying to compile bluetooth support, which relies on bluez
trying to compile bluetooth support, which relies on bluez
(Closes: #566940)
-- David Bremner <bremner@unb.ca> Tue, 26 Jan 2010 23:28:44 -0400
@ -187,6 +412,6 @@ syncevolution (0.9+ds1-2) unstable; urgency=low
syncevolution (0.9+ds1-1) unstable; urgency=low
* Initial release (Closes: #404942)
* Initial release (Closes: #404942)
-- David Bremner <bremner@unb.ca> Sun, 16 Aug 2009 23:53:47 -0300

33
debian/clean vendored
View File

@ -1,33 +0,0 @@
Makefile.in
aclocal.m4
config.guess
config.h.in
config.sub
configure
configure.in
depcomp
install-sh
intltool-extract.in
intltool-merge.in
intltool-update.in
ltmain.sh
m4/intltool.m4
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
mkinstalldirs
po/Makefile.in.in
src/Makefile.am
src/Makefile.in
src/backends/addressbook/Makefile.in
src/backends/evolution/Makefile.in
src/backends/file/Makefile.in
src/backends/sqlite/Makefile.in
src/core/Makefile.in
src/dbus/Makefile.in
src/dbus/interfaces/Makefile.in
src/gtk-ui/Makefile.in
test/Makefile.in

1
debian/compat vendored
View File

@ -1 +0,0 @@
9

173
debian/control vendored
View File

@ -1,28 +1,46 @@
Source: syncevolution
Section: utils
Priority: optional
Maintainer: Tino Keitel <tino+debian@tikei.de>
Build-Depends: debhelper (>= 9), autotools-dev, libedataserver1.2-dev,
libecal1.2-dev, libebook1.2-dev, libcurl4-gnutls-dev, libboost-dev,
libsynthesis-dev (>=3.4.0.16.8),
libtool, automake, intltool, pkg-config,
libglib2.0-dev, libglade2-dev, libdbus-glib-1-dev, libgtk2.0-dev,
libgconf2-dev, libgnome-keyring-dev, xsltproc,
libopenobex1-dev [linux-any], libnotify-dev,
python-docutils, libical-dev, libneon27-gnutls-dev, libpcre3-dev,
libcppunit-dev
Standards-Version: 3.9.2
Homepage: http://www.syncevolution.org
Vcs-Git: git://git.debian.org/git/collab-maint/syncevolution
Vcs-Browser: http://git.debian.org/?p=collab-maint/syncevolution.git
Maintainer: Jonas Smedegaard <dr@jones.dk>
Build-Depends:
debhelper-compat (= 13),
intltool,
libboost-dev,
libcppunit-dev,
libcurl4-gnutls-dev,
libdbus-glib-1-dev,
libebook1.2-dev,
libecal2.0-dev,
libedataserver1.2-dev,
libgladeui-dev,
libglib2.0-dev,
libgtk-3-dev,
libical-dev,
libjson-c-dev,
libneon27-gnutls-dev,
libnotify-dev,
libopenobex2-dev [linux-any],
libsecret-1-dev,
libsynthesis-dev,
python3-docutils,
python3-pygments,
xsltproc,
Standards-Version: 4.6.0
Homepage: https://www.syncevolution.org/
Vcs-Git: https://salsa.debian.org/debian/syncevolution.git
Vcs-Browser: https://salsa.debian.org/debian/syncevolution
Rules-Requires-Root: no
Package: syncevolution
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version})
Recommends: evolution-data-server, bluez
Description: Sync personal information data using SyncML and CalDAV/CardDAV (CLI)
Depends:
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends},
Recommends:
bluez,
Description: Sync personal information data via SyncML/CalDAV/CardDAV (CLI)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -34,10 +52,14 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (CLI
Package: sync-ui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}),
syncevolution-dbus
Recommends: evolution-data-server, bluez
Description: Sync personal information data using SyncML and CalDAV/CardDAV (GTK+ GUI)
Depends:
syncevolution-common (= ${source:Version}),
syncevolution-dbus,
${misc:Depends},
${shlibs:Depends},
Recommends:
bluez,
Description: Sync personal information data via SyncML/CalDAV/CardDAV (GTK+ GUI)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -49,10 +71,12 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (GTK
Package: syncevolution-common
Architecture: all
Depends: ${misc:Depends}, libsynthesis0 (>= 3.4.0.16.8)
Conflicts: sync-ui (<<1.1+ds1-1~), syncevolution (<<1.1+ds1-1~)
Replaces: sync-ui (<<1.1+ds1-1~), syncevolution (<<1.1+ds1-1~)
Description: Sync personal information data using SyncML and CalDAV/CardDAV
Depends:
libsynthesis0v5 (>= 3.4.0.47.5),
${misc:Depends},
Recommends:
adns-tools | host | dnsutils,
Description: Sync personal information data via SyncML/CalDAV/CardDAV (common files)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -64,8 +88,13 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV
Package: syncevolution-libs
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Sync personal information data using SyncML and CalDAV/CardDAV (libraries)
Depends:
syncevolution-libs-gnome (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends},
Recommends:
syncevolution-common (= ${source:Version}),
Description: Sync personal information data via SyncML/CalDAV/CardDAV (backend libraries)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -75,15 +104,32 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (lib
.
This package provides private libraries and plugins.
Package: syncevolution-libs-gnome
Architecture: any
Depends:
${misc:Depends},
${shlibs:Depends},
Recommends:
evolution-data-server,
Description: Sync personal information data via SyncML/CalDAV/CardDAV (GNOME backend)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
Data exchange can happen via HTTP(S) and Bluetooth. Full, one-way and
incremental synchronization of items are supported. SyncEvolution can act as
a SyncML/DAV client and SyncML server.
.
This package provides private libraries and plugins for GNOME.
Package: syncevolution-dbus
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version}), dbus
Recommends: evolution-data-server
Replaces: sync-ui (<< 1.1+ds1-1)
Breaks: sync-ui (<< 1.1+ds1-1)
Description: Sync personal information data using SyncML and CalDAV/CardDAV (D-Bus support)
Depends:
dbus,
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends},
Description: Sync personal information data via SyncML/CalDAV/CardDAV (D-Bus support)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -95,9 +141,15 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (D-B
Package: syncevolution-http
Architecture: all
Depends: ${misc:Depends}, syncevolution-dbus (>= ${source:Version}), python,
python-dbus, dbus-x11, python-twisted-web, python-gobject, python-openssl
Description: Sync personal information data using SyncML and CalDAV/CardDAV (HTTP server)
Depends:
dbus-x11,
python3,
python3-dbus,
python3-gi,
python3-openssl,
syncevolution-dbus (>= ${source:Version}),
${misc:Depends},
Description: Sync personal information data via SyncML/CalDAV/CardDAV (HTTP server)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -108,27 +160,14 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (HTT
This package provides a python script to make SyncEvolution act as a HTTP(S)
server for other SyncML clients.
Package: syncevolution-dbg
Architecture: any
Section: debug
Priority: extra
Depends: ${misc:Depends}, syncevolution (= ${binary:Version}),
sync-ui (= ${binary:Version}),
syncevolution-dbus (= ${binary:Version})
Description: Sync personal information data using SyncML and CalDAV/CardDAV (debugging)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
Data exchange can happen via HTTP(S) and Bluetooth. Full, one-way and
incremental synchronization of items are supported. SyncEvolution can act as
a SyncML/DAV client and SyncML server.
.
This package provides debugging symbols
Package: libsyncevolution0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
Description: Sync personal information data using SyncML and CalDAV/CardDAV (shared library)
Depends:
dbus,
syncevolution-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends},
Description: Sync personal information data via SyncML/CalDAV/CardDAV (shared library)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -140,8 +179,12 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (sha
Package: libsyncevo-dbus0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
Description: Sync personal information data using SyncML and CalDAV/CardDAV (shared library)
Depends:
dbus,
syncevolution-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends},
Description: Sync personal information data via SyncML/CalDAV/CardDAV (shared D-Bus library)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.
@ -153,10 +196,12 @@ Description: Sync personal information data using SyncML and CalDAV/CardDAV (sha
Package: libgdbussyncevo0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
Replaces: syncevolution-libs (<< 1.2.99.1)
Breaks: syncevolution-libs (<< 1.2.99.1)
Description: Sync personal information data using SyncML and CalDAV/CardDAV (shared library)
Depends:
dbus,
syncevolution-common (= ${source:Version}),
${misc:Depends},
${shlibs:Depends},
Description: Sync personal information data via SyncML/CalDAV/CardDAV (shared gdbus library)
SyncEvolution synchronizes contact, calendar and task items via SyncML and
CalDAV/CardDAV with other servers or devices. It uses the Evolution Data Server
to sync PIM data in Evolution, but a plain file storage is also supported.

397
debian/copyright vendored
View File

@ -1,143 +1,280 @@
Source: http://downloads.syncevolution.org/syncevolution/sources/
git://git.moblin.org/syncevolution
Currently the tarball is built from a tag in the moblin repo to avoid the
embedded copy of libsynthesis. For details, see the get-orig-source rule
in debian/rules.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SyncEvolution
Upstream-Contact: https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/issues
Source: https://gitlab.freedesktop.org/SyncEvolution/syncevolution/
Files: *
Copyright: © 2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
License: LGPL2.1 | LGPL3
Copyright:
2012 BMW Car IT GmbH.
2016 Emanoil Kotsev <emanoil.kotsev@fincom.at>
2008 Funambol, Inc.
2009, 2011-2012 Intel Corporation
2009 m-otion communications GmbH <knipp@m-otion.com>
2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
2011 Symbio, Ville Nummela
2004-2008 Synthesis AG
License-Grant:
This library is free software;
you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) version 3.
License: LGPL-2.1 or LGPL-3
Comment:
Files below <src/backends/webdav/*> lack licensing.
Licensing of those files is assumed same as generally for the project.
File: test/client-test.cpp
Copyright: © 2008-2009 Patrick Ohly <patrick.ohly@gmx.de>
© 2008 Funambol, Inc
License: LGPL2.1 | LGPL3
Files:
build/xsl/*
Copyright:
2003 Jiří Kosek
1999-2007 Norman Walsh
2011-2012 O'Reilly Media
2004-2007 Steve Ball
2005-2008 The DocBook Project
License: Expat~Docbook
Reference: build/xsl/COPYING
Files: src/core/LogRedirect.h src/core/SoupTransportAgent.cpp
src/core/TransportAgent.cpp src/core/TransportAgent.h
src/core/SynthesisEngine.cpp src/DBusSyncClient.cpp
src/syncevo-dbus-server.cpp src/core/CurlTransportAgent.h
src/core/SoupTransportAgent.h src/core/CurlTransportAgent.cpp
src/DBusSyncClient.h src/syncevo-dbus-server.h src/dbus/* src/gtk-ui/*
test/test.cpp
Copyright: © 2009 Intel Corporation
License: LGPL2.1 | LGPL3
Files: m4-repo/*.m4
Copyright:
2008 Benjamin Kosnik <bkoz@redhat.com>
2014-2015 Google Inc.
2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
2016 Krzesimir Nowak <qdlacz@gmail.com>
2015 Moritz Klammler <moritz@klammler.eu>
2015 Paul Norman <penorman@mac.com>
2009 Peter Adolphs
2013 Roy Stogner <roystgnr@ices.utexas.edu>
2008 Thomas Porschberg <thomas@randspringer.de>
2012 Xiyue Deng <manphiz@gmail.com>
2012 Zack Weinberg <zackw@panix.com>
License: FSFAP
Files: src/backends/addressbook/AddressBookSource.cpp
src/backends/file/FileSyncSource.cpp src/core/EvolutionSyncSource.cpp
src/client-test-app.cpp src/syncevolution.cpp
src/core/EvolutionSyncClient.cpp src/core/EvolutionSmartPtr.h
src/core/EvolutionSyncClient.h src/core/EvolutionSyncSource.h
src/backends/evolution/EvolutionContactSource.h
src/backends/evolution/EvolutionContactSource.cpp
src/backends/evolution/EvolutionCalendarSource.cpp
src/backends/evolution/EvolutionCalendarSource.h
src/backends/evolution/EvolutionMemoSource.cpp
src/backends/sqlite/SQLiteContactSource.cpp src/core/SynthesisEngine.h
src/core/SyncEvolutionCmdline.cpp src/core/TrackingSyncSource.cpp
src/core/SyncEvolutionUtil.cpp src/core/FileConfigNode.cpp
src/core/SyncEvolutionUtil.h src/core/SyncEvolutionConfig.cpp
src/core/TrackingSyncSource.h src/core/SyncEvolutionConfig.h
src/core/SyncML.h src/core/Logging.cpp src/core/LogStdout.h
src/core/Logging.h src/core/LogStdout.cpp src/core/SyncML.cpp
src/core/LogRedirect.cpp
Copyright: © 2009 Intel Corporation
© 2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
License: LGPL2.1 | LGPL3
License: LGPL2.1 | LGPL3
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
Files: test/{ClientTest.cpp,ClientTest.h}
test/client-test-main.cpp
test/{test.h synccompare.pl}
Copyright: © 2008-2009 Patrick Ohly
© 2009 Intel Corporation
© 2008 Funambol Inc.
License: LGPL2.1 | LGPL3
They were contributed to the Funambol C++ client library under the
"docs/Sync4jContribution.pdf" agreement. They were maintained there by
Patrick and on February 17th 2009 copied back to SyncEvolution,
without any commits by other authors except for the license and
copyright changes applied by Funambol.
On March 25 2009 they were relicensed by Patrick Ohly, executing
the rights granted by the contributor agreement.
-------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
version 3.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Files: test/Algorith/Diff.pm
Copyright:© 2000-2004 Ned Konz, Tye McQueen.
License: GPL-1+ | Artistic
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl.
File: src/core/SynthesisDBPlugin.cpp
Copyright: © 2009 Intel Corporation
© 2004-2008 by Synthesis AG
License: LGPL2.1 | LGPL3
File: src/backends/evolution/e-cal-check-timezones.c
src/backends/evolution/e-cal-check-timezones.h
Copyright: © 2008 Novell, Inc
© 2009 Patrick Ohly <patrick.ohly@gmx.de>
Files:
src/backends/akonadi/akonadisyncsource.cpp
src/backends/akonadi/akonadisyncsource.h
src/backends/akonadi/contactssyncsource.cpp
src/backends/akonadi/contactssyncsource.h
src/backends/akonadi/eventssyncsource.cpp
src/backends/akonadi/eventssyncsource.h
src/backends/akonadi/notessyncsource.cpp
src/backends/akonadi/notessyncsource.h
src/backends/akonadi/todossyncsource.cpp
src/backends/akonadi/todossyncsource.h
Copyright:
2009 Sascha Peilicke <sasch.pe@gmx.de>
License-Grant:
This application is free software;
you can redistribute it and/or modify it
under the terms of the GNU Library General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
Files:
test/Algorith/Diff.pm
Copyright:
2000-2004 Ned Konz
2000-2004 Tye McQueen
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the same terms as Perl.
License: Artistic or GPL-1+
Comment:
Perl 5 is licensed under either the Artistic license
or the GNU General Public License version 1 or later.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
Files:
src/syncevo/icaltz-util.c
src/syncevo/icaltz-util.h
Copyright:
2007 Novell, Inc.
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the terms of version 2
of the GNU Lesser General Public License
as published by the Free Software Foundation.
License: LGPL-2
Foile: build/gen-changelog.pl
Copyright: © 2009 Emmanuele Bassi
License: GPL1+|Artistic
This program is free software. It can be distributed and/or modified under
the terms of Perl itself.
Files:
src/gtk-ui/gtkinfobar.c
src/gtk-ui/gtkinfobar.h
Copyright:
2005 Paolo Maggi
License-Grant:
This library is free software;
you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
Files: debian/*
Copyright: © 2009 David Bremner
License: same as upstream, LGPL2.1 or LGPL3
Files:
src/backends/tdepim/TDEPIMSyncSource.cpp
src/backends/tdepim/TDEPIMSyncSource.h
Copyright:
2016 Emanoil Kotsev <emanoil.kotsev@fincom.at>
License-Grant:
This application is free software;
you can redistribute it and/or modify it
under the terms of the GNU Library General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
On Debian systems, you can find the full license text for the LGPL3,
GPL3 and Artistic Licenses at
/usr/share/common-licenses/{LGPL-3,GPL3, Artistic}
Files:
src/backends/evolution/e-cal-check-timezones.c
src/backends/evolution/e-cal-check-timezones.h
Copyright:
2008 Novell, Inc
2009 Patrick Ohly <patrick.ohly@gmx.de>
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
Comment:
The granted license does not exist at described version.
Licensing assumed to be GNU Library General Public License 2.0 or newer.
Files: src/dbus/interfaces/spec-to-docbook.xsl
Copyright: 2007, William Jon McCann
License-Grant:
License: GPL
License: GPL-1+
Files:
m4-repo/dk-warn.m4
Copyright:
2004-2007 Daniel Elstner <daniel.kitta@gmail.com>
License-Grant:
danielk's Autostuff is free software;
you can redistribute it and/or modify it
under the terms of the GNU General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: GPL-2+
Files:
m4-repo/autotroll.m4
autotroll.am
Copyright:
2006-2007, 2009-2010 Benoit Sigoure <benoit.sigoure@lrde.epita.fr>
License-Grant:
AutoTroll is free software;
you can redistribute it and/or modify it
under the terms of the GNU General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: GPL-2+ with Autoconf-2.0~AutoTroll exception
In addition, as a special exception,
the copyright holders of AutoTroll give you unlimited permission
to copy, distribute and modify the configure scripts
that are the output of Autoconf
when processing the macros of AutoTroll.
You need not follow the terms of the GNU General Public License
when using or distributing such scripts,
even though portions of the text of AutoTroll appear in them.
The GNU General Public License (GPL) does govern
all other use of the material that constitutes AutoTroll.
.
This special exception to the GPL applies
to versions of AutoTroll released
by the copyright holders of AutoTroll.
Note that people who make
modified versions of AutoTroll are not obligated
to grant this special exception for their modified versions;
it is their choice whether to do so.
The GNU General Public License gives permission
to release a modified version without this exception;
this exception also makes it possible to release
a modified version which carries forward this exception.
Files:
build/gen-changelog.pl
Copyright:
2009 Emmanuele Bassi <ebassi@gnome.org>
License-Grant:
This program is free software.
It can be distributed and/or modified
under the terms of Perl itself.
License: GPL-1+ or Artistic
Comment:
Perl 5 is licensed under either the Artistic license
or the GNU General Public License version 1 or later.
Files:
debian/*
Copyright:
2009 David Bremner
2021 Jonas Smedegaard <dr@jones.dk>
License-Grant:
This packaging is free software;
you can redistribute it and/or modify it
under the terms of the GNU General Public License
as published by the Free Software Foundation;
version 3.
License: GPL-3
Reference: debian/copyright
License: Artistic
Reference: /usr/share/common-licenses/Artistic
License: Expat~Docbook
Permission is hereby granted, free of charge,
to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
.
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
.
Except as contained in this notice,
the names of individuals credited with contribution to this software
shall not be used in advertising or otherwise
to promote the sale, use or other dealings in this Software
without prior written authorization from the individuals in question.
.
Any stylesheet derived from this Software
that is publically distributed
will be identified with a different name
and the version strings in any derived Software will be changed
so that no possibility of confusion
between the derived package and this Software will exist.
License: FSFAP
Copying and distribution of this file,
with or without modification,
are permitted in any medium without royalty
provided the copyright notice and this notice are preserved
This file is offered as-is, without any warranty.
License: GPL-1+
Reference: /usr/share/common-licenses/GPL-1
License: GPL-2+
Reference: /usr/share/common-licenses/GPL-2
License: GPL-3
Reference: /usr/share/common-licenses/GPL-3
License: LGPL-2
Reference: /usr/share/common-licenses/LGPL-2
License: LGPL-2+
Reference: /usr/share/common-licenses/LGPL-2
License: LGPL-2.1
Reference: /usr/share/common-licenses/LGPL-2.1
License: LGPL-3
Reference: /usr/share/common-licenses/LGPL-3

3
debian/copyright-check vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
licensecheck --check '.*' --recursive --copyright --deb-machine --ignore '^(debian/(changelog|copyright(_hints)?))$' --lines 0 -- * > debian/copyright_hints

1188
debian/copyright_hints vendored Normal file

File diff suppressed because it is too large Load Diff

14
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,14 @@
# clone this source: gbp clone $PKG_GIT_URL
# track upstream source: git remote add upstream-git $UPSTREAM_GIT_URL
# update this source: gbp pull
# update upstream source: git fetch upstream-git --tags
# import upstream release: gbp import-orig --upstream-vcs-tag=$VERSION --uscan
# build package: gbp buildpackage
# publish source release: gbp tag && gbp push
[DEFAULT]
pristine-tar = True
sign-tags = True
filter = */.git*
debian-branch = debian/latest
upstream-branch = upstream/latest

26
debian/not-installed vendored Normal file
View File

@ -0,0 +1,26 @@
# we provide no -dev package
usr/include/*/*.h
usr/lib/*/*.a
usr/lib/*/*.la
usr/lib/*/*.so
usr/lib/*/*/*/*.a
usr/lib/*/*/*/*.la
usr/lib/*/pkgconfig/*.pc
# covered in debian/copyright
usr/share/doc/syncevolution/COPYING
# relates to unsupported KDE options --enable-kwallet --enable-akonadi
usr/lib/*/syncevolution/backends/platformkde.so
usr/lib/*/syncevolution/backends/syncakonadi.so
usr/lib/*/syncevolution/backends/syncactivesync.so
# relates to unsupported KDE-derived Trinity Desktop Environment (TDE)
usr/lib/*/syncevolution/backends/synctdepimabc.so
usr/lib/*/syncevolution/backends/synctdepimcal.so
usr/lib/*/syncevolution/backends/synctdepimnotes.so
usr/lib/*/syncevolution/backends/platformtde.so
# helper scripts for testing
usr/bin/syncevo-phone-config
usr/bin/synclog2html

42
debian/patches/1001_SOCK_CLOEXEC.patch vendored Normal file
View File

@ -0,0 +1,42 @@
Description: Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC
Work around missing SOCK_CLOEXEC on kfreebsd
by setting FD_CLOEXEC afterwards.
Author: Tino Mettler <tino+debian@tikei.de>
Last-Update: 2021-09-29
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/src/gdbusxx/gdbus-cxx-bridge.cpp
+++ b/src/gdbusxx/gdbus-cxx-bridge.cpp
@@ -285,6 +285,10 @@
true);
}
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
+
std::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const NewConnection_t &newConnection, DBusErrorCXX *)
{
// Create two fds connected via a two-way stream. The parent
@@ -295,6 +299,21 @@
if (retval) {
SE_THROW(StringPrintf("socketpair: %s", strerror(errno)));
}
+
+ if(SOCK_CLOEXEC == 0) {
+ int flags;
+ int i;
+ for(i = 0; i < 2; i++) {
+ flags = fcntl(fds[i], F_GETFD);
+ if (flags == -1){
+ SE_THROW(StringPrintf("fcntl: %s", strerror(errno)));
+ }
+ flags |= FD_CLOEXEC;
+ if (fcntl(fds[i], F_SETFD, flags) == -1){
+ SE_THROW(StringPrintf("fcntl: %s", strerror(errno)));
+ }
+ }
+ }
GuardFD parentfd(fds[0]);
GuardFD childfd(fds[1]);

31
debian/patches/1002_intltool.patch vendored Normal file
View File

@ -0,0 +1,31 @@
Description: adjust whitespace as required for recent autotools
Recent releases of autotools (possibly only autoreconf
apparently only recognizes the macro IT_PROG_INTLTOOL
when listed as the first word on a line.
Otherwise autoreconf fails with the following error message:
.
autoreconf: running: intltoolize --copy --force
ERROR: 'IT_PROG_INTLTOOL' must appear in configure.ac for intltool to work.
Author: Jonas Smedegaard <dr@jones.dk>
Last-Update: 2021-10-01
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/configure.ac
+++ b/configure.ac
@@ -587,11 +587,11 @@
AC_DEFINE_UNQUOTED(DBUS_SERVICES_DIR, "$DBUS_SERVICES_DIR", [Location of D-Bus services directory])
if test "$enable_gui" != "no" || test "$enable_dbus_service" != "no"; then
- IT_PROG_INTLTOOL([0.37.1])
- GETTEXT_PACKAGE=syncevolution
- AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name])
- AM_GLIB_GNU_GETTEXT
- SYNCEVOLUTION_LOCALEDIR=[${datadir}/locale]
+IT_PROG_INTLTOOL([0.37.1])
+GETTEXT_PACKAGE=syncevolution
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The gettext package name])
+AM_GLIB_GNU_GETTEXT
+SYNCEVOLUTION_LOCALEDIR=[${datadir}/locale]
fi
# decide which sync-ui(s) we are building:

3
debian/patches/README vendored Normal file
View File

@ -0,0 +1,3 @@
0xxx: Grabbed from upstream development.
1xxx: Possibly relevant for upstream adoption.
2xxx: Only relevant for official Debian release.

2
debian/patches/series vendored Normal file
View File

@ -0,0 +1,2 @@
1001_SOCK_CLOEXEC.patch
1002_intltool.patch

46
debian/rules vendored
View File

@ -1,12 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-
UPSTREAMTAG=upstream/1.3.2
SOURCEPKG=$(shell dpkg-parsechangelog | sed -n 's/^Source: \(.*\)/\1/p')
UPSTREAM=$(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*\)-[^-]*/\1/p')
ORIG=${SOURCEPKG}_${UPSTREAM}.orig.tar.gz
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_CXXFLAGS_APPEND = -std=c++14
export CONFIG_SHELL=/bin/bash
@ -14,38 +9,31 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
%:
dh $@
override_dh_auto_install:
make install DESTDIR=$(CURDIR)/debian/tmp
install --mode=0755 --owner=root test/syncevo-http-server.py \
$(CURDIR)/debian/tmp/usr/bin/syncevo-http-server
override_dh_autoreconf:
dh_autoreconf ./autogen.sh
override_dh_auto_configure:
sh autogen.sh
override_dh_auto_configure:
dh_auto_configure -- --with-synthesis-src=none --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH)/syncevolution \
--enable-gui \
--with-rst2man --with-rst2html --enable-dav
--with-rst2man --with-rst2html --enable-dav \
--enable-oauth2
execute_after_dh_auto_install:
cp test/syncevo-http-server.py \
debian/tmp/usr/bin/syncevo-http-server
override_dh_install:
dh_install -X"*.pl"
override_dh_strip:
dh_strip --dbg-package=syncevolution-dbg
override_dh_missing:
dh_missing
override_dh_makeshlibs:
dh_makeshlibs -psyncevolution-libs -n
dh_makeshlibs -Nsyncevolution-libs
get-orig-source:
git archive --format=tar ${UPSTREAMTAG} --prefix=${SOURCEPKG}_${UPSTREAM}/ | gzip -9 > ../${ORIG}
PATCH_EXPORT_SCRIPT=/usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
export-patches:
[ ! -r debian/patches ] || \
grep "^\#*$(notdir $(PATCH_EXPORT_SCRIPT))" debian/patches/series
rm -rf debian/patches
bash $(PATCH_EXPORT_SCRIPT)
dh_makeshlibs -V'libsyncevolution0 (>= 1.5.2-3~)' -plibsyncevolution0
dh_makeshlibs -V'libsyncevo-dbus0 (>= 1.5.2-3~)' -plibsyncevo-dbus0
dh_makeshlibs -V'libgdbussyncevo0 (>= 1.5.2-3~)' -plibgdbussyncevo0
dh_makeshlibs --remaining-packages

View File

@ -1,2 +0,0 @@
upstream/${UPSTREAM_REF}..patches/${DEB_REF}

17
debian/source/lintian-overrides vendored Normal file
View File

@ -0,0 +1,17 @@
# License is in Reference field (see bug#786450)
missing-license-paragraph-in-dep5-copyright debian/copyright artistic *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-1\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-2\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-3 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2\.1 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-3 *
missing-license-text-in-dep5-copyright debian/copyright Artistic *
missing-license-text-in-dep5-copyright debian/copyright GPL-1\+ *
missing-license-text-in-dep5-copyright debian/copyright GPL-2\+ *
missing-license-text-in-dep5-copyright debian/copyright GPL-3 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2\+ *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2\.1 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-3 *

View File

@ -1,23 +1,4 @@
usr/share/locale/ja/LC_MESSAGES/syncevolution.mo
usr/share/locale/ro/LC_MESSAGES/syncevolution.mo
usr/share/locale/fi/LC_MESSAGES/syncevolution.mo
usr/share/locale/sv/LC_MESSAGES/syncevolution.mo
usr/share/locale/ar/LC_MESSAGES/syncevolution.mo
usr/share/locale/pt_BR/LC_MESSAGES/syncevolution.mo
usr/share/locale/gl/LC_MESSAGES/syncevolution.mo
usr/share/locale/hu/LC_MESSAGES/syncevolution.mo
usr/share/locale/ko/LC_MESSAGES/syncevolution.mo
usr/share/locale/zh_TW/LC_MESSAGES/syncevolution.mo
usr/share/locale/de/LC_MESSAGES/syncevolution.mo
usr/share/locale/zh_CN/LC_MESSAGES/syncevolution.mo
usr/share/locale/es/LC_MESSAGES/syncevolution.mo
usr/share/locale/pl/LC_MESSAGES/syncevolution.mo
usr/share/locale/id/LC_MESSAGES/syncevolution.mo
usr/share/locale/da/LC_MESSAGES/syncevolution.mo
usr/share/locale/fr/LC_MESSAGES/syncevolution.mo
usr/share/locale/nl/LC_MESSAGES/syncevolution.mo
usr/share/locale/it/LC_MESSAGES/syncevolution.mo
usr/share/locale/th/LC_MESSAGES/syncevolution.mo
usr/share/locale/ca/LC_MESSAGES/syncevolution.mo
usr/bin/synccompare
usr/bin/syncevo-webdav-lookup
usr/share/locale/*/LC_MESSAGES/syncevolution.mo
usr/share/syncevolution

View File

@ -1 +0,0 @@
test/dbus-server-sync.py

View File

@ -1,4 +1,6 @@
etc/xdg/autostart/syncevo-dbus-server.desktop
usr/libexec/syncevo-dbus-helper
usr/libexec/syncevo-dbus-server
usr/libexec/syncevo-dbus-server-startup.sh
usr/lib/systemd/user/*.service
usr/share/dbus-1/services/org.syncevolution.service
usr/lib/*/syncevolution/syncevo-dbus-server
usr/lib/*/syncevolution/syncevo-dbus-helper

View File

@ -1 +1 @@
usr/bin/syncevo-http-server
usr/bin/syncevo-http-server

View File

@ -0,0 +1,3 @@
usr/lib/*/syncevolution/backends/platformgnome.so
usr/lib/*/syncevolution/backends/syncebook.so
usr/lib/*/syncevolution/backends/syncecal.so

View File

@ -1,2 +1,12 @@
usr/lib/*/syncevolution/backends/*.so
usr/lib/*/syncevolution/syncevo-local-sync
usr/lib/*/syncevolution/backends/providergoa.so
usr/lib/*/syncevolution/backends/provideroauth2.so
usr/lib/*/syncevolution/backends/syncdav.so
usr/lib/*/syncevolution/backends/syncfile.so
usr/lib/*/syncevolution/backends/syncpbap.so
usr/lib/*/syncevolution/backends/synckcalextended.so
usr/lib/*/syncevolution/backends/syncmaemocal.so
usr/lib/*/syncevolution/backends/syncqtcontacts.so
usr/lib/*/syncevolution/backends/syncsqlite.so
usr/lib/*/syncevolution/backends/syncxmlrpc.so
usr/libexec/syncevo-local-sync

154
debian/syncevolution.1 vendored
View File

@ -1,154 +0,0 @@
.TH SYNCEVOLUTION "1" "August 2009" "SyncEvolution 0.9" "User Commands"
.SH NAME
SyncEvolution \- synchronize personal information management (PIM) using SyncML
.SH DESCRIPTION
.SS "Show available sources:"
.IP
syncevolution
.SS "Show information about configuration(s) and sync sessions:"
.IP
syncevolution \fB\-\-print\-servers\fR
syncevolution \fB\-\-print\-config\fR [\-\-quiet] <server> [sync|<source ...]
syncevolution \fB\-\-print\-sessions\fR [\-\-quiet] <server>
.SS "Show information about SyncEvolution:"
.IP
syncevolution \fB\-\-help\fR|\-h
syncevolution \fB\-\-version\fR
.SS "Run a synchronization:"
.IP
syncevolution <server> [<source> ...]
syncevolution \fB\-\-run\fR <options for run> <server> [<source> ...]
.SS "Restore data from the automatic backups:"
.IP
syncevolution \fB\-\-restore\fR <session directory> \fB\-\-before\fR|\-\-after [\-\-dry\-run] <server> <source> ...
.SS "Remove a configuration:"
.IP
syncevolution \fB\-\-remove\fR <server>
.SS "Modify configuration:"
.IP
syncevolution \fB\-\-configure\fR <options for configuration> <server> [<source> ...]
syncevolution \fB\-\-migrate\fR <server>
.SH OPTIONS
\fB\-\-sync\fR|\-s <mode>
\fB\-\-sync\fR|\-s ?
.IP
Temporarily synchronize the active sources in that mode. Useful
for a "refresh\-from\-server" or "refresh\-from\-client" sync which
clears all data at one end and copies all items from the other.
.PP
\fB\-\-print\-servers\fR
.IP
Prints the names of all configured servers to stdout.
.PP
\fB\-\-print\-config\fR|\-p
.IP
Prints the complete configuration for the selected server
to stdout, including up\-to\-date comments for all properties. The
format is the normal .ini format with source configurations in
different sections introduced with [<source>] lines. Can be combined
with \fB\-\-sync\-property\fR and \fB\-\-source\-property\fR to modify the configuration
on\-the\-fly. When one or more sources are listed after the <server>
name on the command line, then only the configs of those sources are
printed. Using \fB\-\-quiet\fR suppresses the comments for each property.
When setting a \fB\-\-template\fR, then the reference configuration for
that server is printed instead of an existing configuration.
.PP
\fB\-\-print\-sessions\fR
.IP
Prints a list of all previous log directories. Unless \fB\-\-quiet\fR is used, each
file name is followed by the original sync report.
.PP
\-\-configure|\-c
.IP
Modify the configuration files for the selected server. If no such
configuration exists, then a new one is created using one of the
template configurations (see \fB\-\-template\fR option). When creating
a new configuration only the active sources will be set to active
in the new configuration, i.e. "syncevolution \fB\-c\fR scheduleworld addressbook"
followed by "syncevolution scheduleworld" will only synchronize the
address book. The other sources are created in a disabled state.
When modifying an existing configuration and sources are specified,
then the source properties of only those sources are modified.
.PP
\fB\-\-migrate\fR
.IP
In SyncEvolution <= 0.7 a different layout of configuration files
was used. Using \fB\-\-migrate\fR will automatically migrate to the new
layout and rename the old directory $HOME/.sync4j/evolution/<server>
into $HOME/.sync4j/evolution/<server>.old to prevent accidental use
of the old configuration. WARNING: old SyncEvolution releases cannot
use the new configuration!
The switch can also be used to migrate a configuration in the current
configuration directory: this preserves all property values, discards
obsolete properties and sets all comments exactly as if the configuration
had been created from scratch. WARNING: custom comments in the
configuration are not preserved.
\fB\-\-migrate\fR implies \fB\-\-configure\fR and can be combined with modifying
properties.
.PP
\fB\-\-restore\fR
.IP
Restores the data of the selected sources to the state from before or after the
selected synchronization. The synchronization is selected via its log directory
(see \fB\-\-print\-sessions\fR). Other directories can also be given as long as
they contain database dumps in the format created by SyncEvolution.
The output includes information about the changes made during the
restore, both in terms of item changes and content changes (which is
not always the same, see manual for details). This output can be suppressed
with \fB\-\-quiet\fR.
In combination with \fB\-\-dry\-run\fR, the changes to local data are only simulated.
This can be used to check that \fB\-\-restore\fR will not remove valuable information.
.PP
\fB\-\-remove\fR
.IP
This removes only the configuration files and related meta information.
If other files were added to the config directory of the server, then
those and the directory will not be removed. Log directories will also
not be removed.
.PP
\fB\-\-sync\-property\fR|\-y <property>=<value>
\fB\-\-sync\-property\fR|\-y ?
\fB\-\-sync\-property\fR|\-y <property>=?
.IP
Overrides a configuration property in the <server>/config.ini file
for the current synchronization run or permanently when \fB\-\-configure\fR
is used to update the configuration. Can be used multiple times.
Specifying an unused property will trigger an error message.
.PP
\fB\-\-source\-property\fR|\-z <property>=<value>
\fB\-\-source\-property\fR|\-z ?
\fB\-\-source\-property\fR|\-z <property>=?
.IP
Same as \fB\-\-sync\-option\fR, but applies to the configuration of all active
sources. "\-\-sync <mode>" is a shortcut for "\-\-source\-option sync=<mode>".
.PP
\fB\-\-template\fR|\-l <server name>|default|?
.IP
Can be used to select from one of the built\-in default configurations
for known SyncML servers. Defaults to the <server> name, so \fB\-\-template\fR
only has to be specified when creating multiple different configurations
for the same server. "default" is an alias for "scheduleworld" and can be
used as the starting point for servers which do not have a built\-in
configuration.
Each template contains a pseudo\-random device ID. Therefore setting the
"deviceId" sync property is only necessary when manually recreating a
configuration or when a more descriptive name is desired.
.PP
\fB\-\-status\fR|\-t
.IP
The changes made to local data since the last synchronization are
shown without starting a new one. This can be used to see in advance
whether the local data needs to be synchronized with the server.
.PP
\fB\-\-quiet\fR|\-q
.IP
Suppresses most of the normal output during a synchronization. The
log file still contains all the information.
.PP
\fB\-\-help\fR|\-h
.IP
Prints usage information.
.PP
\fB\-\-version\fR
.IP
Prints the SyncEvolution version.

View File

@ -1,9 +1,3 @@
debian/tmp/usr/share/doc/syncevolution/README.nokia_7210c
debian/tmp/usr/share/doc/syncevolution/README.scheduleworld
debian/tmp/usr/share/doc/syncevolution/README.mobical
debian/tmp/usr/share/doc/syncevolution/README
debian/tmp/usr/share/doc/syncevolution/README.funambol
debian/tmp/usr/share/doc/syncevolution/README.zyb
debian/tmp/usr/share/doc/syncevolution/NEWS
debian/tmp/usr/share/doc/syncevolution/README.google
debian/tmp/usr/share/doc/syncevolution/README.memotoo
debian/tmp/usr/share/doc/syncevolution/README
debian/tmp/usr/share/doc/syncevolution/README.*

View File

@ -1,2 +1,5 @@
debian/tmp/usr/share/doc/syncevolution/accounts
debian/tmp/usr/share/doc/syncevolution/syncevo-http-server-logging.conf
debian/tmp/usr/share/syncevolution/xml/update-samples.pl
debian/tmp/usr/share/doc/syncevolution/accounts
test/syncevo-phone-config.py

View File

@ -1,2 +1 @@
syncevolution.1
debian/tmp/usr/share/man/man1/syncevolution.1

12
debian/watch vendored
View File

@ -1,4 +1,10 @@
version=3
version=4
# check: uscan --report
# update: gbp import-orig --upstream-vcs-tag=vX.Y.Z --uscan
opts=dversionmangle=s/\+ds\d+$// \
http://downloads.syncevolution.org/syncevolution/sources/syncevolution-(.*).tar.gz
opts=\
filenamemangle=s/.*?(@ANY_VERSION@@ARCHIVE_EXT@)/@PACKAGE@$1/,\
uversionmangle=s/-(?=\d)/./g;s/-?pre/~pre/,\
dversionmangle=auto \
https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/tags \
.*?@ANY_VERSION@@ARCHIVE_EXT@

119
m4-repo/ax_boost_locale.m4 Normal file
View File

@ -0,0 +1,119 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_boost_locale.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_BOOST_LOCALE
#
# DESCRIPTION
#
# Test for System library from the Boost C++ libraries. The macro requires
# a preceding call to AX_BOOST_BASE. Further documentation is available at
# <http://randspringer.de/boost/index.html>.
#
# This macro calls:
#
# AC_SUBST(BOOST_LOCALE_LIB)
#
# And sets:
#
# HAVE_BOOST_LOCALE
#
# LICENSE
#
# Copyright (c) 2012 Xiyue Deng <manphiz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 1
AC_DEFUN([AX_BOOST_LOCALE],
[
AC_ARG_WITH([boost-locale],
AS_HELP_STRING([--with-boost-locale@<:@=special-lib@:>@],
[use the Locale library from boost - it is possible to specify a certain library for the linker
e.g. --with-boost-locale=boost_locale-gcc-mt ]),
[
if test "$withval" = "no"; then
want_boost="no"
elif test "$withval" = "yes"; then
want_boost="yes"
ax_boost_user_locale_lib=""
else
want_boost="yes"
ax_boost_user_locale_lib="$withval"
fi
],
[want_boost="yes"]
)
if test "x$want_boost" = "xyes"; then
AC_REQUIRE([AC_PROG_CC])
AC_REQUIRE([AC_CANONICAL_BUILD])
CPPFLAGS_SAVED="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
export CPPFLAGS
LDFLAGS_SAVED="$LDFLAGS"
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
export LDFLAGS
AC_CACHE_CHECK(whether the Boost::Locale library is available,
ax_cv_boost_locale,
[AC_LANG_PUSH([C++])
CXXFLAGS_SAVE=$CXXFLAGS
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <boost/locale.hpp>]],
[[boost::locale::generator gen;
std::locale::global(gen(""));]])],
ax_cv_boost_locale=yes, ax_cv_boost_locale=no)
CXXFLAGS=$CXXFLAGS_SAVE
AC_LANG_POP([C++])
])
if test "x$ax_cv_boost_locale" = "xyes"; then
AC_SUBST(BOOST_CPPFLAGS)
AC_DEFINE(HAVE_BOOST_LOCALE,,[define if the Boost::Locale library is available])
BOOSTLIBDIR=`echo $BOOST_LDFLAGS | sed -e 's/@<:@^\/@:>@*//'`
LDFLAGS_SAVE=$LDFLAGS
if test "x$ax_boost_user_locale_lib" = "x"; then
for libextension in `ls $BOOSTLIBDIR/libboost_locale*.so* $BOOSTLIBDIR/libboost_locale*.dylib* $BOOSTLIBDIR/libboost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^lib\(boost_locale.*\)\.so.*$;\1;' -e 's;^lib\(boost_locale.*\)\.dylib.*$;\1;' -e 's;^lib\(boost_locale.*\)\.a.*$;\1;'` ; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
if test "x$link_locale" != "xyes"; then
for libextension in `ls $BOOSTLIBDIR/boost_locale*.dll* $BOOSTLIBDIR/boost_locale*.a* 2>/dev/null | sed 's,.*/,,' | sed -e 's;^\(boost_locale.*\)\.dll.*$;\1;' -e 's;^\(boost_locale.*\)\.a.*$;\1;'` boost_locale; do
ax_lib=${libextension}
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
else
for ax_lib in $ax_boost_user_locale_lib boost_locale-$ax_boost_user_locale_lib; do
AC_CHECK_LIB($ax_lib, exit,
[BOOST_LOCALE_LIB="-l$ax_lib"; AC_SUBST(BOOST_LOCALE_LIB) link_locale="yes"; break],
[link_locale="no"])
done
fi
if test "x$ax_lib" = "x"; then
AC_MSG_ERROR(Could not find a version of the library!)
fi
if test "x$link_locale" = "xno"; then
AC_MSG_ERROR(Could not link against $ax_lib !)
fi
fi
CPPFLAGS="$CPPFLAGS_SAVED"
LDFLAGS="$LDFLAGS_SAVED"
fi
])

View File

@ -0,0 +1,78 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CHECK_GNU_MAKE()
#
# DESCRIPTION
#
# This macro searches for a GNU version of make. If a match is found, the
# makefile variable `ifGNUmake' is set to the empty string, otherwise it
# is set to "#". This is useful for including a special features in a
# Makefile, which cannot be handled by other versions of make. The
# variable _cv_gnu_make_command is set to the command to invoke GNU make
# if it exists, the empty string otherwise.
#
# Here is an example of its use:
#
# Makefile.in might contain:
#
# # A failsafe way of putting a dependency rule into a makefile
# $(DEPEND):
# $(CC) -MM $(srcdir)/*.c > $(DEPEND)
#
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
# @ifGNUmake@ include $(DEPEND)
# @ifGNUmake@ endif
#
# Then configure.in would normally contain:
#
# AX_CHECK_GNU_MAKE()
# AC_OUTPUT(Makefile)
#
# Then perhaps to cause gnu make to override any other make, we could do
# something like this (note that GNU make always looks for GNUmakefile
# first):
#
# if ! test x$_cv_gnu_make_command = x ; then
# mv Makefile GNUmakefile
# echo .DEFAULT: > Makefile ;
# echo \ $_cv_gnu_make_command \$@ >> Makefile;
# fi
#
# Then, if any (well almost any) other make is called, and GNU make also
# exists, then the other make wraps the GNU make.
#
# LICENSE
#
# Copyright (c) 2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
AC_DEFUN([AX_CHECK_GNU_MAKE], [ AC_CACHE_CHECK( for GNU make,_cv_gnu_make_command,
_cv_gnu_make_command='' ;
dnl Search all the common names for GNU make
for a in "$MAKE" make gmake gnumake ; do
if test -z "$a" ; then continue ; fi ;
if ( sh -c "$a --version" 2> /dev/null | grep GNU 2>&1 > /dev/null ) ; then
_cv_gnu_make_command=$a ;
break;
fi
done ;
) ;
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
if test "x$_cv_gnu_make_command" != "x" ; then
ifGNUmake='' ;
else
ifGNUmake='#' ;
AC_MSG_RESULT("Not found");
fi
AC_SUBST(ifGNUmake)
] )

View File

@ -0,0 +1,982 @@
# ===========================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX(VERSION, [ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the specified
# version of the C++ standard. If necessary, add switches to CXX and
# CXXCPP to enable support. VERSION may be '11' (for the C++11 standard)
# or '14' (for the C++14 standard).
#
# The second argument, if specified, indicates whether you insist on an
# extended mode (e.g. -std=gnu++11) or a strict conformance mode (e.g.
# -std=c++11). If neither is specified, you get whatever works, with
# preference for an extended mode.
#
# The third argument, if specified 'mandatory' or if left unspecified,
# indicates that baseline support for the specified C++ standard is
# required and that the macro should error out if no mode with that
# support is found. If specified 'optional', then configuration proceeds
# regardless, after defining HAVE_CXX${VERSION} if and only if a
# supporting mode is found.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
# Copyright (c) 2016 Krzesimir Nowak <qdlacz@gmail.com>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 7
dnl This macro is based on the code from the AX_CXX_COMPILE_STDCXX_11 macro
dnl (serial version number 13).
AX_REQUIRE_DEFINED([AC_MSG_WARN])
AC_DEFUN([AX_CXX_COMPILE_STDCXX], [dnl
m4_if([$1], [11], [ax_cxx_compile_alternatives="11 0x"],
[$1], [14], [ax_cxx_compile_alternatives="14 1y"],
[$1], [17], [ax_cxx_compile_alternatives="17 1z"],
[m4_fatal([invalid first argument `$1' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$2], [], [],
[$2], [ext], [],
[$2], [noext], [],
[m4_fatal([invalid second argument `$2' to AX_CXX_COMPILE_STDCXX])])dnl
m4_if([$3], [], [ax_cxx_compile_cxx$1_required=true],
[$3], [mandatory], [ax_cxx_compile_cxx$1_required=true],
[$3], [optional], [ax_cxx_compile_cxx$1_required=false],
[m4_fatal([invalid third argument `$3' to AX_CXX_COMPILE_STDCXX])])
AC_LANG_PUSH([C++])dnl
ac_success=no
AC_CACHE_CHECK(whether $CXX supports C++$1 features by default,
ax_cv_cxx_compile_cxx$1,
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[ax_cv_cxx_compile_cxx$1=yes],
[ax_cv_cxx_compile_cxx$1=no])])
if test x$ax_cv_cxx_compile_cxx$1 = xyes; then
ac_success=yes
fi
m4_if([$2], [noext], [], [dnl
if test x$ac_success = xno; then
for alternative in ${ax_cxx_compile_alternatives}; do
switch="-std=gnu++${alternative}"
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
fi])
m4_if([$2], [ext], [], [dnl
if test x$ac_success = xno; then
dnl HP's aCC needs +std=c++11 according to:
dnl http://h21007.www2.hp.com/portal/download/files/unprot/aCxx/PDF_Release_Notes/769149-001.pdf
dnl Cray's crayCC needs "-h std=c++11"
for alternative in ${ax_cxx_compile_alternatives}; do
for switch in -std=c++${alternative} +std=c++${alternative} "-h std=c++${alternative}"; do
cachevar=AS_TR_SH([ax_cv_cxx_compile_cxx$1_$switch])
AC_CACHE_CHECK(whether $CXX supports C++$1 features with $switch,
$cachevar,
[ac_save_CXX="$CXX"
CXX="$CXX $switch"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([_AX_CXX_COMPILE_STDCXX_testbody_$1])],
[eval $cachevar=yes],
[eval $cachevar=no])
CXX="$ac_save_CXX"])
if eval test x\$$cachevar = xyes; then
CXX="$CXX $switch"
if test -n "$CXXCPP" ; then
CXXCPP="$CXXCPP $switch"
fi
ac_success=yes
break
fi
done
if test x$ac_success = xyes; then
break
fi
done
fi])
AC_LANG_POP([C++])
if test x$ax_cxx_compile_cxx$1_required = xtrue; then
if test x$ac_success = xno; then
AC_MSG_ERROR([*** A compiler with support for C++$1 language features is required.])
fi
fi
if test x$ac_success = xno; then
HAVE_CXX$1=0
AC_MSG_NOTICE([No compiler with C++$1 support was found])
else
HAVE_CXX$1=1
AC_DEFINE(HAVE_CXX$1,1,
[define if the compiler supports basic C++$1 syntax])
fi
AC_SUBST(HAVE_CXX$1)
m4_if([$1], [17], [AC_MSG_WARN([C++17 is not yet standardized, so the checks may change in incompatible ways anytime])])
])
dnl Test body for checking C++11 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_11],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
)
dnl Test body for checking C++14 support
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_14],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
)
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_17],
_AX_CXX_COMPILE_STDCXX_testbody_new_in_11
_AX_CXX_COMPILE_STDCXX_testbody_new_in_14
_AX_CXX_COMPILE_STDCXX_testbody_new_in_17
)
dnl Tests for new features in C++11
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_11], [[
// If the compiler admits that it is not ready for C++11, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201103L
#error "This is not a C++11 compiler"
#else
namespace cxx11
{
namespace test_static_assert
{
template <typename T>
struct check
{
static_assert(sizeof(int) <= sizeof(T), "not big enough");
};
}
namespace test_final_override
{
struct Base
{
virtual void f() {}
};
struct Derived : public Base
{
virtual void f() override {}
};
}
namespace test_double_right_angle_brackets
{
template < typename T >
struct check {};
typedef check<void> single_type;
typedef check<check<void>> double_type;
typedef check<check<check<void>>> triple_type;
typedef check<check<check<check<void>>>> quadruple_type;
}
namespace test_decltype
{
int
f()
{
int a = 1;
decltype(a) b = 2;
return a + b;
}
}
namespace test_type_deduction
{
template < typename T1, typename T2 >
struct is_same
{
static const bool value = false;
};
template < typename T >
struct is_same<T, T>
{
static const bool value = true;
};
template < typename T1, typename T2 >
auto
add(T1 a1, T2 a2) -> decltype(a1 + a2)
{
return a1 + a2;
}
int
test(const int c, volatile int v)
{
static_assert(is_same<int, decltype(0)>::value == true, "");
static_assert(is_same<int, decltype(c)>::value == false, "");
static_assert(is_same<int, decltype(v)>::value == false, "");
auto ac = c;
auto av = v;
auto sumi = ac + av + 'x';
auto sumf = ac + av + 1.0;
static_assert(is_same<int, decltype(ac)>::value == true, "");
static_assert(is_same<int, decltype(av)>::value == true, "");
static_assert(is_same<int, decltype(sumi)>::value == true, "");
static_assert(is_same<int, decltype(sumf)>::value == false, "");
static_assert(is_same<int, decltype(add(c, v))>::value == true, "");
return (sumf > 0.0) ? sumi : add(c, v);
}
}
namespace test_noexcept
{
int f() { return 0; }
int g() noexcept { return 0; }
static_assert(noexcept(f()) == false, "");
static_assert(noexcept(g()) == true, "");
}
namespace test_constexpr
{
template < typename CharT >
unsigned long constexpr
strlen_c_r(const CharT *const s, const unsigned long acc) noexcept
{
return *s ? strlen_c_r(s + 1, acc + 1) : acc;
}
template < typename CharT >
unsigned long constexpr
strlen_c(const CharT *const s) noexcept
{
return strlen_c_r(s, 0UL);
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("1") == 1UL, "");
static_assert(strlen_c("example") == 7UL, "");
static_assert(strlen_c("another\0example") == 7UL, "");
}
namespace test_rvalue_references
{
template < int N >
struct answer
{
static constexpr int value = N;
};
answer<1> f(int&) { return answer<1>(); }
answer<2> f(const int&) { return answer<2>(); }
answer<3> f(int&&) { return answer<3>(); }
void
test()
{
int i = 0;
const int c = 0;
static_assert(decltype(f(i))::value == 1, "");
static_assert(decltype(f(c))::value == 2, "");
static_assert(decltype(f(0))::value == 3, "");
}
}
namespace test_uniform_initialization
{
struct test
{
static const int zero {};
static const int one {1};
};
static_assert(test::zero == 0, "");
static_assert(test::one == 1, "");
}
namespace test_lambdas
{
void
test1()
{
auto lambda1 = [](){};
auto lambda2 = lambda1;
lambda1();
lambda2();
}
int
test2()
{
auto a = [](int i, int j){ return i + j; }(1, 2);
auto b = []() -> int { return '0'; }();
auto c = [=](){ return a + b; }();
auto d = [&](){ return c; }();
auto e = [a, &b](int x) mutable {
const auto identity = [](int y){ return y; };
for (auto i = 0; i < a; ++i)
a += b--;
return x + identity(a + b);
}(0);
return a + b + c + d + e;
}
int
test3()
{
const auto nullary = [](){ return 0; };
const auto unary = [](int x){ return x; };
using nullary_t = decltype(nullary);
using unary_t = decltype(unary);
const auto higher1st = [](nullary_t f){ return f(); };
const auto higher2nd = [unary](nullary_t f1){
return [unary, f1](unary_t f2){ return f2(unary(f1())); };
};
return higher1st(nullary) + higher2nd(nullary)(unary);
}
}
namespace test_variadic_templates
{
template <int...>
struct sum;
template <int N0, int... N1toN>
struct sum<N0, N1toN...>
{
static constexpr auto value = N0 + sum<N1toN...>::value;
};
template <>
struct sum<>
{
static constexpr auto value = 0;
};
static_assert(sum<>::value == 0, "");
static_assert(sum<1>::value == 1, "");
static_assert(sum<23>::value == 23, "");
static_assert(sum<1, 2>::value == 3, "");
static_assert(sum<5, 5, 11>::value == 21, "");
static_assert(sum<2, 3, 5, 7, 11, 13>::value == 41, "");
}
// http://stackoverflow.com/questions/13728184/template-aliases-and-sfinae
// Clang 3.1 fails with headers of libstd++ 4.8.3 when using std::function
// because of this.
namespace test_template_alias_sfinae
{
struct foo {};
template<typename T>
using member = typename T::member_type;
template<typename T>
void func(...) {}
template<typename T>
void func(member<T>*) {}
void test();
void test() { func<foo>(0); }
}
} // namespace cxx11
#endif // __cplusplus >= 201103L
]])
dnl Tests for new features in C++14
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_14], [[
// If the compiler admits that it is not ready for C++14, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus < 201402L
#error "This is not a C++14 compiler"
#else
namespace cxx14
{
namespace test_polymorphic_lambdas
{
int
test()
{
const auto lambda = [](auto&&... args){
const auto istiny = [](auto x){
return (sizeof(x) == 1UL) ? 1 : 0;
};
const int aretiny[] = { istiny(args)... };
return aretiny[0];
};
return lambda(1, 1L, 1.0f, '1');
}
}
namespace test_binary_literals
{
constexpr auto ivii = 0b0000000000101010;
static_assert(ivii == 42, "wrong value");
}
namespace test_generalized_constexpr
{
template < typename CharT >
constexpr unsigned long
strlen_c(const CharT *const s) noexcept
{
auto length = 0UL;
for (auto p = s; *p; ++p)
++length;
return length;
}
static_assert(strlen_c("") == 0UL, "");
static_assert(strlen_c("x") == 1UL, "");
static_assert(strlen_c("test") == 4UL, "");
static_assert(strlen_c("another\0test") == 7UL, "");
}
namespace test_lambda_init_capture
{
int
test()
{
auto x = 0;
const auto lambda1 = [a = x](int b){ return a + b; };
const auto lambda2 = [a = lambda1(x)](){ return a; };
return lambda2();
}
}
namespace test_digit_separators
{
constexpr auto ten_million = 100'000'000;
static_assert(ten_million == 100000000, "");
}
namespace test_return_type_deduction
{
auto f(int& x) { return x; }
decltype(auto) g(int& x) { return x; }
template < typename T1, typename T2 >
struct is_same
{
static constexpr auto value = false;
};
template < typename T >
struct is_same<T, T>
{
static constexpr auto value = true;
};
int
test()
{
auto x = 0;
static_assert(is_same<int, decltype(f(x))>::value, "");
static_assert(is_same<int&, decltype(g(x))>::value, "");
return x;
}
}
} // namespace cxx14
#endif // __cplusplus >= 201402L
]])
dnl Tests for new features in C++17
m4_define([_AX_CXX_COMPILE_STDCXX_testbody_new_in_17], [[
// If the compiler admits that it is not ready for C++17, why torture it?
// Hopefully, this will speed up the test.
#ifndef __cplusplus
#error "This is not a C++ compiler"
#elif __cplusplus <= 201402L
#error "This is not a C++17 compiler"
#else
#if defined(__clang__)
#define REALLY_CLANG
#else
#if defined(__GNUC__)
#define REALLY_GCC
#endif
#endif
#include <initializer_list>
#include <utility>
#include <type_traits>
namespace cxx17
{
#if !defined(REALLY_CLANG)
namespace test_constexpr_lambdas
{
// TODO: test it with clang++ from git
constexpr int foo = [](){return 42;}();
}
#endif // !defined(REALLY_CLANG)
namespace test::nested_namespace::definitions
{
}
namespace test_fold_expression
{
template<typename... Args>
int multiply(Args... args)
{
return (args * ... * 1);
}
template<typename... Args>
bool all(Args... args)
{
return (args && ...);
}
}
namespace test_extended_static_assert
{
static_assert (true);
}
namespace test_auto_brace_init_list
{
auto foo = {5};
auto bar {5};
static_assert(std::is_same<std::initializer_list<int>, decltype(foo)>::value);
static_assert(std::is_same<int, decltype(bar)>::value);
}
namespace test_typename_in_template_template_parameter
{
template<template<typename> typename X> struct D;
}
namespace test_fallthrough_nodiscard_maybe_unused_attributes
{
int f1()
{
return 42;
}
[[nodiscard]] int f2()
{
[[maybe_unused]] auto unused = f1();
switch (f1())
{
case 17:
f1();
[[fallthrough]];
case 42:
f1();
}
return f1();
}
}
namespace test_extended_aggregate_initialization
{
struct base1
{
int b1, b2 = 42;
};
struct base2
{
base2() {
b3 = 42;
}
int b3;
};
struct derived : base1, base2
{
int d;
};
derived d1 {{1, 2}, {}, 4}; // full initialization
derived d2 {{}, {}, 4}; // value-initialized bases
}
namespace test_general_range_based_for_loop
{
struct iter
{
int i;
int& operator* ()
{
return i;
}
const int& operator* () const
{
return i;
}
iter& operator++()
{
++i;
return *this;
}
};
struct sentinel
{
int i;
};
bool operator== (const iter& i, const sentinel& s)
{
return i.i == s.i;
}
bool operator!= (const iter& i, const sentinel& s)
{
return !(i == s);
}
struct range
{
iter begin() const
{
return {0};
}
sentinel end() const
{
return {5};
}
};
void f()
{
range r {};
for (auto i : r)
{
[[maybe_unused]] auto v = i;
}
}
}
namespace test_lambda_capture_asterisk_this_by_value
{
struct t
{
int i;
int foo()
{
return [*this]()
{
return i;
}();
}
};
}
namespace test_enum_class_construction
{
enum class byte : unsigned char
{};
byte foo {42};
}
namespace test_constexpr_if
{
template <bool cond>
int f ()
{
if constexpr(cond)
{
return 13;
}
else
{
return 42;
}
}
}
namespace test_selection_statement_with_initializer
{
int f()
{
return 13;
}
int f2()
{
if (auto i = f(); i > 0)
{
return 3;
}
switch (auto i = f(); i + 4)
{
case 17:
return 2;
default:
return 1;
}
}
}
#if !defined(REALLY_CLANG)
namespace test_template_argument_deduction_for_class_templates
{
// TODO: test it with clang++ from git
template <typename T1, typename T2>
struct pair
{
pair (T1 p1, T2 p2)
: m1 {p1},
m2 {p2}
{}
T1 m1;
T2 m2;
};
void f()
{
[[maybe_unused]] auto p = pair{13, 42u};
}
}
#endif // !defined(REALLY_CLANG)
namespace test_non_type_auto_template_parameters
{
template <auto n>
struct B
{};
B<5> b1;
B<'a'> b2;
}
#if !defined(REALLY_CLANG)
namespace test_structured_bindings
{
// TODO: test it with clang++ from git
int arr[2] = { 1, 2 };
std::pair<int, int> pr = { 1, 2 };
auto f1() -> int(&)[2]
{
return arr;
}
auto f2() -> std::pair<int, int>&
{
return pr;
}
struct S
{
int x1 : 2;
volatile double y1;
};
S f3()
{
return {};
}
auto [ x1, y1 ] = f1();
auto& [ xr1, yr1 ] = f1();
auto [ x2, y2 ] = f2();
auto& [ xr2, yr2 ] = f2();
const auto [ x3, y3 ] = f3();
}
#endif // !defined(REALLY_CLANG)
#if !defined(REALLY_CLANG)
namespace test_exception_spec_type_system
{
// TODO: test it with clang++ from git
struct Good {};
struct Bad {};
void g1() noexcept;
void g2();
template<typename T>
Bad
f(T*, T*);
template<typename T1, typename T2>
Good
f(T1*, T2*);
static_assert (std::is_same_v<Good, decltype(f(g1, g2))>);
}
#endif // !defined(REALLY_CLANG)
namespace test_inline_variables
{
template<class T> void f(T)
{}
template<class T> inline T g(T)
{
return T{};
}
template<> inline void f<>(int)
{}
template<> int g<>(int)
{
return 5;
}
}
} // namespace cxx17
#endif // __cplusplus <= 201402L
]])

View File

@ -0,0 +1,39 @@
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_11.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_11([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++11
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++11. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# LICENSE
#
# Copyright (c) 2008 Benjamin Kosnik <bkoz@redhat.com>
# Copyright (c) 2012 Zack Weinberg <zackw@panix.com>
# Copyright (c) 2013 Roy Stogner <roystgnr@ices.utexas.edu>
# Copyright (c) 2014, 2015 Google Inc.; contributed by Alexey Sokolov <sokolov@google.com>
# Copyright (c) 2015 Paul Norman <penorman@mac.com>
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 18
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_11], [AX_CXX_COMPILE_STDCXX([11], [$1], [$2])])

View File

@ -0,0 +1,34 @@
# =============================================================================
# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_14.html
# =============================================================================
#
# SYNOPSIS
#
# AX_CXX_COMPILE_STDCXX_14([ext|noext], [mandatory|optional])
#
# DESCRIPTION
#
# Check for baseline language coverage in the compiler for the C++14
# standard; if necessary, add switches to CXX and CXXCPP to enable
# support.
#
# This macro is a convenience alias for calling the AX_CXX_COMPILE_STDCXX
# macro with the version set to C++14. The two optional arguments are
# forwarded literally as the second and third argument respectively.
# Please see the documentation for the AX_CXX_COMPILE_STDCXX macro for
# more information. If you want to use this macro, you also need to
# download the ax_cxx_compile_stdcxx.m4 file.
#
# LICENSE
#
# Copyright (c) 2015 Moritz Klammler <moritz@klammler.eu>
#
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 5
AX_REQUIRE_DEFINED([AX_CXX_COMPILE_STDCXX])
AC_DEFUN([AX_CXX_COMPILE_STDCXX_14], [AX_CXX_COMPILE_STDCXX([14], [$1], [$2])])

View File

@ -31,11 +31,12 @@ m4_define([_SE_VERSIONS],
## SE_CHECK_FOR_STABLE_RELEASE
##
## No-op if STABLE_RELEASE is already defined.
## Defines STABLE_RELEASE to 'yes' if nano and micro versions are greater or
## equal 99.5. (So 1.1.99.5b is counted as table release.)
## If above condition is not true then STABLE_RELEASE is defined to 'yes' if
## current version is not dirty (nothing is appended by gen-git-version.sh).
## If above fails, then STABLE_RELEASE is defined to 'no'.
##
## Defines STABLE_RELEASE to 'no' if the nano version is 99 (1.1.99.5 is
## an unstable, pre-release version) or the current version is dirty
## (something is appended by gen-git-version.sh).
##
## If above fails, then STABLE_RELEASE is defined to 'yes'.
##
AC_DEFUN([SE_CHECK_FOR_STABLE_RELEASE],
[m4_ifndef([STABLE_RELEASE],
@ -55,11 +56,11 @@ AC_DEFUN([SE_CHECK_FOR_STABLE_RELEASE],
m4_if(se_test_micro_version, [99],
[dnl if part
m4_define([se_test_nano_number], m4_translit(se_test_nano_version, [A-Za-z]))
m4_if(m4_eval(se_test_nano_number [>= 5]), [1],
[dnl if part
m4_define([STABLE_RELEASE], [yes])
]
)
dnl m4_if(m4_eval(se_test_nano_number [>= 5]), [1],
dnl [dnl if part
dnl m4_define([STABLE_RELEASE], [yes])
dnl ]
dnl )
],
[dnl else part
m4_ifndef([se_test_dirty_version],

View File

@ -34,7 +34,7 @@ COPYRIGHT_HOLDER =
# It can be your email address, or a mailing list address where translators
# can write to without being subscribed, or the URL of a web page through
# which the translators can contact you.
MSGID_BUGS_ADDRESS = http://moblin.org/projects/syncevolution
MSGID_BUGS_ADDRESS = https://syncevolution.org/
# This is the list of locale categories, beyond LC_MESSAGES, for which the
# message catalogs shall be used. It is usually empty.

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-10-16 11:24+0000\n"
"PO-Revision-Date: 2009-11-16 16:28+0200\n"
"Last-Translator: Yousef Abu Al Naser <yousef@itsoftex.com>\n"

View File

@ -1,7 +1,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution.master\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2010-05-22 09:19+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: astur <malditoastur@gmail.com>\n"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: Syncevolution 2.x\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-08-15 09:21+0000\n"
"PO-Revision-Date: 2010-01-02 14:18+0100\n"
"Last-Translator: Gil Forcada <gilforcada@guifi.net>\n"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-11-19 18:24+0000\n"
"PO-Revision-Date: 2009-11-24 22:25+0100\n"
"Last-Translator: Kris Thomsen <lakristho@gmail.com>\n"

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-10-01 19:27+0000\n"
"PO-Revision-Date: 2009-10-14 21:52+0200\n"
"Last-Translator: Xosé <xosecalvo@gmail.com>\n"

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-12-21 18:45+0000\n"
"PO-Revision-Date: 2010-01-26 16:07+0100\n"
"Last-Translator: Gergely Lónyai <aleph@mandriva.org>\n"

View File

@ -2,7 +2,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-10-01 19:27+0000\n"
"PO-Revision-Date: \n"
"Last-Translator: Andika Triwidada <andika@gmail.com>\n"

View File

@ -7,7 +7,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-10-01 19:27+0000\n"
"PO-Revision-Date: 2009-10-03 20:23+0200\n"
"Last-Translator: Cosmin Bordeianu <elloxar@gmail.com>\n"

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution.master\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2010-04-21 09:23+0000\n"
"PO-Revision-Date: 2010-04-20 23:45+0200\n"
"Last-Translator: Tomáš Virgl <tomas@virgl.net>\n"

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: syncevolution\n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2009-12-21 18:45+0000\n"
"PO-Revision-Date: 2010-01-19 22:07+0700\n"
"Last-Translator: Anuchit Chalothorn <anoochit@gmail.com>\n"

View File

@ -6,7 +6,7 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://moblin.org/projects/syncevolution\n"
"Report-Msgid-Bugs-To: https://syncevolution.org/\n"
"POT-Creation-Date: 2010-05-19 09:19+0000\n"
"PO-Revision-Date: 2010-05-19 10:57-0500\n"
"Last-Translator: Ahmet Özgür Erdemli <dbl2010@gmail.com>\n"

View File

@ -17,6 +17,15 @@ MOSTLYCLEANFILES =
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
# Install test suite (client-test, test-dbus.py, testpim.py, etc.).
testparentdir = $(libdir)/syncevolution
# Must end in "/test" so that we can use nobase_testparent_DATA=test/...
testdir = $(testparentdir)/test
test_DATA =
nobase_test_DATA =
test_PROGRAMS =
test_SCRIPTS =
nobase_testparent_DATA =
# standard variables with standard prefixes
dist_doc_DATA =
@ -40,6 +49,8 @@ nodist_bin_SCRIPTS =
# other
all_dist_hooks =
all_install_exec_hooks =
all_uninstall_hooks =
all_local_installchecks =
all_phonies =
BUILT_SOURCES =

View File

@ -1,532 +0,0 @@
This patch demonstrates how switching from the current, synchronous
to the corresponding asynchronous API could work. This helps to
avoid some timeouts with EDS-DBus, but not all: the e_book_async_get_changes()
call still times out.
Index: src/EvolutionContactSource.cpp
===================================================================
RCS file: /cvsroot/sync4jevolution/sync4jevolution/src/EvolutionContactSource.cpp,v
retrieving revision 1.50
diff -c -r1.50 EvolutionContactSource.cpp
*** src/EvolutionContactSource.cpp 3 Jan 2007 20:58:41 -0000 1.50
--- src/EvolutionContactSource.cpp 22 Feb 2007 19:27:50 -0000
***************
*** 27,32 ****
--- 27,33 ----
#ifdef ENABLE_EBOOK
#include "EvolutionContactSource.h"
+ #include <libebook/e-book-view.h>
#include <common/base/Log.h>
#include "vocl/VConverter.h"
***************
*** 154,159 ****
--- 155,207 ----
}
}
+ void EvolutionContactSource::addContacts(void *custom, GList *nextItem)
+ {
+ EvolutionContactSource *source = (EvolutionContactSource *)custom;
+
+ while (nextItem) {
+ const char *uid = (const char *)e_contact_get_const(E_CONTACT(nextItem->data),
+ E_CONTACT_UID);
+ source->m_allItems.addItem(uid);
+ nextItem = nextItem->next;
+ }
+ }
+
+ void EvolutionContactSource::addChanges(EBook *book,
+ EBookStatus status,
+ GList *nextItem,
+ gpointer custom)
+ {
+ EvolutionContactSource *source = (EvolutionContactSource *)custom;
+ source->m_status = status;
+
+ while (nextItem) {
+ EBookChange *ebc = (EBookChange *)nextItem->data;
+
+ if (ebc->contact) {
+ const char *uid = (const char *)e_contact_get_const( ebc->contact, E_CONTACT_UID );
+
+ if (uid) {
+ switch (ebc->change_type) {
+ case E_BOOK_CHANGE_CARD_ADDED:
+ source->m_newItems.addItem(uid);
+ break;
+ case E_BOOK_CHANGE_CARD_MODIFIED:
+ source->m_updatedItems.addItem(uid);
+ break;
+ case E_BOOK_CHANGE_CARD_DELETED:
+ source->m_deletedItems.addItem(uid);
+ break;
+ }
+ }
+ }
+ nextItem = nextItem->next;
+ }
+
+ source->m_loop.quit();
+ }
+
+
void EvolutionContactSource::beginSyncThrow(bool needAll,
bool needPartial,
bool deleteLocal)
***************
*** 161,234 ****
GError *gerror = NULL;
if (deleteLocal) {
! eptr<EBookQuery> allItemsQuery( e_book_query_any_field_contains(""), "query" );
! GList *nextItem;
! if (!e_book_get_contacts( m_addressbook, allItemsQuery, &nextItem, &gerror )) {
! throwError( "reading all items", gerror );
! }
! while (nextItem) {
! const char *uid = (const char *)e_contact_get_const(E_CONTACT(nextItem->data),
! E_CONTACT_UID);
! if (!e_book_remove_contact( m_addressbook, uid, &gerror ) ) {
! throwError( string( "deleting contact " ) + uid,
gerror );
}
- nextItem = nextItem->next;
}
}
if (needAll) {
! eptr<EBookQuery> allItemsQuery( e_book_query_any_field_contains(""), "query" );
! GList *nextItem;
! if (!e_book_get_contacts( m_addressbook, allItemsQuery, &nextItem, &gerror )) {
! throwError( "reading all items", gerror );
! }
! while (nextItem) {
! const char *uid = (const char *)e_contact_get_const(E_CONTACT(nextItem->data),
! E_CONTACT_UID);
! m_allItems.addItem(uid);
! nextItem = nextItem->next;
! }
}
if (needPartial) {
GList *nextItem;
if (!e_book_get_changes( m_addressbook, (char *)m_changeId.c_str(), &nextItem, &gerror )) {
throwError( "reading changes", gerror );
}
! while (nextItem) {
! EBookChange *ebc = (EBookChange *)nextItem->data;
!
! if (ebc->contact) {
! const char *uid = (const char *)e_contact_get_const( ebc->contact, E_CONTACT_UID );
!
! if (uid) {
! switch (ebc->change_type) {
! case E_BOOK_CHANGE_CARD_ADDED:
! m_newItems.addItem(uid);
! break;
! case E_BOOK_CHANGE_CARD_MODIFIED:
! m_updatedItems.addItem(uid);
! break;
! case E_BOOK_CHANGE_CARD_DELETED:
! m_deletedItems.addItem(uid);
! break;
! }
! }
! }
! nextItem = nextItem->next;
}
}
}
void EvolutionContactSource::endSyncThrow()
{
if (m_isModified) {
- GError *gerror = NULL;
- GList *nextItem;
// move change_id forward so that our own changes are not listed the next time
! if (!e_book_get_changes( m_addressbook, (char *)m_changeId.c_str(), &nextItem, &gerror )) {
! throwError( "reading changes", gerror );
}
}
resetItems();
--- 209,264 ----
GError *gerror = NULL;
if (deleteLocal) {
! m_allItems.clear();
! listAllContacts(addContacts, this);
!
! EvolutionSyncSource::itemList::const_iterator it;
! for (it = m_allItems.begin();
! it != m_allItems.end();
! ++it) {
! if (!e_book_remove_contact( m_addressbook, it->c_str(), &gerror ) ) {
! throwError( string( "deleting contact " ) + *it,
gerror );
}
}
+ m_allItems.clear();
}
if (needAll) {
! listAllContacts(addContacts, this);
}
if (needPartial) {
+ #if 0
+ // times out on N770
+ GError *gerror = NULL;
GList *nextItem;
if (!e_book_get_changes( m_addressbook, (char *)m_changeId.c_str(), &nextItem, &gerror )) {
throwError( "reading changes", gerror );
}
! addChanges(m_addressbook, E_BOOK_ERROR_OK, nextItem, (gpointer)this);
! #else
! if (e_book_async_get_changes(m_addressbook, (char *)m_changeId.c_str(), addChanges, this)) {
! throwError( "reading changes", gerror );
}
+ m_loop.run();
+ if (m_status != E_BOOK_ERROR_OK) {
+ throw runtime_error("reading changes stopped with an error");
+ }
+ #endif
}
}
void EvolutionContactSource::endSyncThrow()
{
if (m_isModified) {
// move change_id forward so that our own changes are not listed the next time
! if (e_book_async_get_changes(m_addressbook, (char *)m_changeId.c_str(), addChanges, this)) {
! throw runtime_error("reading changes");
! }
! m_loop.run();
! if (m_status != E_BOOK_ERROR_OK) {
! throw runtime_error("reading changes stopped with an error");
}
}
resetItems();
***************
*** 241,263 ****
m_addressbook = NULL;
}
! void EvolutionContactSource::exportData(ostream &out)
{
! eptr<EBookQuery> allItemsQuery( e_book_query_any_field_contains(""), "query" );
! GList *nextItem;
! GError *gerror = NULL;
! if (!e_book_get_contacts( m_addressbook, allItemsQuery, &nextItem, &gerror )) {
! throwError( "reading all items", gerror );
! }
while (nextItem) {
eptr<char> vcardstr(e_vcard_to_string(&E_CONTACT(nextItem->data)->parent,
EVC_FORMAT_VCARD_30));
! out << (const char *)vcardstr << "\r\n\r\n";
nextItem = nextItem->next;
}
}
SyncItem *EvolutionContactSource::createItem( const string &uid, SyncState state )
{
logItem( uid, "extracting from EV" );
--- 271,296 ----
m_addressbook = NULL;
}
!
! static void dumpContacts(void *custom, GList *nextItem)
{
! ostream *out = (ostream *)custom;
!
while (nextItem) {
eptr<char> vcardstr(e_vcard_to_string(&E_CONTACT(nextItem->data)->parent,
EVC_FORMAT_VCARD_30));
! *out << (const char *)vcardstr << "\r\n\r\n";
!
nextItem = nextItem->next;
}
}
+ void EvolutionContactSource::exportData(ostream &out)
+ {
+ listAllContacts(dumpContacts, (void *)&out);
+ }
+
SyncItem *EvolutionContactSource::createItem( const string &uid, SyncState state )
{
logItem( uid, "extracting from EV" );
***************
*** 773,776 ****
--- 806,876 ----
}
}
+ class EvolutionContactListAll {
+ public:
+ EvolutionContactListAll(void (*processList)(void *custom, GList *list), void *custom, EvolutionContactSource &source):
+ m_processList(processList),
+ m_custom(custom),
+ m_source(source),
+ m_status(E_BOOK_VIEW_STATUS_OK)
+ {}
+
+ static void contactsAdded(EBookView *ebookview,
+ gpointer arg1,
+ gpointer user_data) {
+ EvolutionContactListAll *listAll = (EvolutionContactListAll *)user_data;
+ listAll->m_processList(listAll->m_custom, (GList *)arg1);
+ }
+
+ static void sequenceDone(EBookView *ebookview,
+ gint arg1,
+ gpointer user_data) {
+ EvolutionContactListAll *listAll = (EvolutionContactListAll *)user_data;
+ listAll->m_status = (EBookViewStatus)arg1;
+ listAll->m_source.m_loop.quit();
+ }
+
+ /** throw an error exception if an error occurred */
+ void checkStatus() {
+ if (m_status != E_BOOK_VIEW_STATUS_OK) {
+ throw runtime_error("iterating over all contacts failed");
+ }
+ }
+
+ private:
+ void (*m_processList)(void *custom, GList *list);
+ void *m_custom;
+ EvolutionContactSource &m_source;
+ EBookViewStatus m_status;
+ };
+
+
+
+
+
+ void EvolutionContactSource::listAllContacts(void (*processList)(void *custom, GList *list), void *custom)
+ {
+ eptr<EBookQuery> allItemsQuery( e_book_query_any_field_contains(""), "query" );
+ GError *gerror = NULL;
+ EBookView *viewptr;
+
+ if (e_book_get_book_view(m_addressbook, allItemsQuery, NULL, -1, &viewptr, &gerror)) {
+ eptr<EBookView, GObject> view(viewptr);
+ EvolutionContactListAll listAll(processList, custom, *this);
+
+ g_signal_connect(viewptr, "contacts-added", G_CALLBACK(listAll.contactsAdded), &listAll);
+ g_signal_connect(viewptr, "sequence-complete", G_CALLBACK(listAll.sequenceDone), &listAll);
+ e_book_view_start(view);
+ m_loop.run();
+ e_book_view_stop(view);
+ // workaround for http://bugzilla.gnome.org/show_bug.cgi?id=399011
+ // Without the sleep() EDS often (but not always) crashes in e_book_backend_get_book_views()
+ // during one of the following calls.
+ sleep(1);
+ listAll.checkStatus();
+ } else {
+ throwError( "getting view on addressbook", gerror );
+ }
+ }
+
#endif /* ENABLE_EBOOK */
Index: src/EvolutionContactSource.h
===================================================================
RCS file: /cvsroot/sync4jevolution/sync4jevolution/src/EvolutionContactSource.h,v
retrieving revision 1.22
diff -c -r1.22 EvolutionContactSource.h
*** src/EvolutionContactSource.h 10 Dec 2006 17:35:18 -0000 1.22
--- src/EvolutionContactSource.h 22 Feb 2007 19:27:50 -0000
***************
*** 32,37 ****
--- 32,49 ----
#include <set>
/**
+ * callback used by EvolutionContactSource::listAll() and
+ */
+ class EvolutionCallback
+ {
+ public:
+ /**
+ * Called to iterate over data. Content of list depends on context.
+ */
+ virtual void processList(GList *list) = 0;
+ };
+
+ /**
* Implements access to Evolution address books.
*/
class EvolutionContactSource : public EvolutionSyncSource
***************
*** 81,87 ****
// implementation of SyncSource
//
virtual ArrayElement *clone() { return new EvolutionContactSource(*this); }
!
protected:
//
// implementation of EvolutionSyncSource callbacks
--- 93,102 ----
// implementation of SyncSource
//
virtual ArrayElement *clone() { return new EvolutionContactSource(*this); }
!
! /** start and stop event processing on this source */
! EvolutionAsync m_loop;
!
protected:
//
// implementation of EvolutionSyncSource callbacks
***************
*** 142,149 ****
--- 157,191 ----
insert("CALURI");
}
} m_uniqueProperties;
+
+ /**
+ * extracts all contacts
+ *
+ * @param processList is fed the contacts, possibly in multiple chunks
+ * @param custom pointer passed through to processList
+ */
+ void listAllContacts(void (*processList)(void *custom, GList *list), void *custom);
+
+ /**
+ * callback for listAllContacts() which adds all contacts to m_allItems
+ */
+ static void addContacts(void *custom, GList *nextItem);
+
+ /**
+ * EBookListCallback for beginSyncThrow()'s e_book_async_get_changes ()
+ */
+ static void addChanges(EBook *book,
+ EBookStatus status,
+ GList *nextItem,
+ gpointer custom);
+ /**
+ * status passed to addChanges()
+ */
+ EBookStatus m_status;
};
+
+
#endif // ENABLE_EBOOK
#endif // INCL_EVOLUTIONCONTACTSOURCE
Index: src/EvolutionSmartPtr.h
===================================================================
RCS file: /cvsroot/sync4jevolution/sync4jevolution/src/EvolutionSmartPtr.h,v
retrieving revision 1.8
diff -c -r1.8 EvolutionSmartPtr.h
*** src/EvolutionSmartPtr.h 10 Dec 2006 17:35:19 -0000 1.8
--- src/EvolutionSmartPtr.h 22 Feb 2007 19:27:50 -0000
***************
*** 34,39 ****
--- 34,40 ----
void inline unref( char *pointer ) { free( pointer ); }
void inline unref( GObject *pointer ) { g_object_unref( pointer ); }
+ void inline unref( GMainLoop *pointer ) { g_main_loop_unref( pointer ); }
#ifdef ENABLE_EBOOK
void inline unref( EBookQuery *pointer ) { e_book_query_unref( pointer ); }
#endif
Index: src/EvolutionSyncClient.cpp
===================================================================
RCS file: /cvsroot/sync4jevolution/sync4jevolution/src/EvolutionSyncClient.cpp,v
retrieving revision 1.24
diff -c -r1.24 EvolutionSyncClient.cpp
*** src/EvolutionSyncClient.cpp 17 Dec 2006 16:33:45 -0000 1.24
--- src/EvolutionSyncClient.cpp 22 Feb 2007 19:27:50 -0000
***************
*** 432,438 ****
int res = DMTClientConfig::readDevInfoConfig(syncMLNode, syncMLNode);
// always read device ID from the traditional property "deviceId"
! eptr<char> tmp(syncMLNode.readPropertyValue("deviceId"));
deviceConfig.setDevID(tmp);
return res;
--- 432,438 ----
int res = DMTClientConfig::readDevInfoConfig(syncMLNode, syncMLNode);
// always read device ID from the traditional property "deviceId"
! arrayptr<char> tmp(syncMLNode.readPropertyValue("deviceId"));
deviceConfig.setDevID(tmp);
return res;
***************
*** 482,489 ****
// redirect logging as soon as possible
SourceList sourceList(m_server, m_doLogging);
! eptr<char> logdir(config.getSyncMLNode()->readPropertyValue("logdir"));
! eptr<char> maxlogdirs(config.getSyncMLNode()->readPropertyValue("maxlogdirs"));
sourceList.setLogdir(logdir, atoi(maxlogdirs));
SyncSourceConfig *sourceconfigs = config.getSyncSourceConfigs();
--- 482,489 ----
// redirect logging as soon as possible
SourceList sourceList(m_server, m_doLogging);
! arrayptr<char> logdir(config.getSyncMLNode()->readPropertyValue("logdir"));
! arrayptr<char> maxlogdirs(config.getSyncMLNode()->readPropertyValue("maxlogdirs"));
sourceList.setLogdir(logdir, atoi(maxlogdirs));
SyncSourceConfig *sourceconfigs = config.getSyncSourceConfigs();
Index: src/EvolutionSyncSource.h
===================================================================
RCS file: /cvsroot/sync4jevolution/sync4jevolution/src/EvolutionSyncSource.h,v
retrieving revision 1.24
diff -c -r1.24 EvolutionSyncSource.h
*** src/EvolutionSyncSource.h 10 Dec 2006 17:35:19 -0000 1.24
--- src/EvolutionSyncSource.h 22 Feb 2007 19:27:51 -0000
***************
*** 33,38 ****
--- 33,40 ----
#include <spdm/ManagementNode.h>
#include <base/Log.h>
+ #include <EvolutionSmartPtr.h>
+
/**
* This class implements the functionality shared by
* both EvolutionCalenderSource and EvolutionContactSource:
***************
*** 371,374 ****
--- 373,400 ----
string m_user, m_passwd;
};
+ /**
+ * Utility class which hides the mechanisms needed to handle events
+ * during asynchronous calls.
+ */
+ class EvolutionAsync {
+ public:
+ EvolutionAsync() :
+ m_loop(g_main_loop_new(NULL, FALSE), "main loop")
+ {}
+
+ /** start processing events */
+ void run() {
+ g_main_loop_run(m_loop);
+ }
+
+ /** stop processing events, to be called inside run() by callback */
+ void quit() {
+ g_main_loop_quit(m_loop);
+ }
+
+ private:
+ eptr<GMainLoop> m_loop;
+ };
+
#endif // INCL_EVOLUTIONSYNCSOURCE

View File

@ -50,15 +50,15 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
setStartSyncKey(lastToken);
if (lastToken.empty()) {
// slow sync: wipe out cached list of IDs, will be filled anew below
SE_LOG_DEBUG(this, NULL, "sync key empty, starting slow sync");
SE_LOG_DEBUG(getDisplayName(), "sync key empty, starting slow sync");
m_trackingNode->clear();
} else {
SE_LOG_DEBUG(this, NULL, "sync key %s, starting incremental sync", lastToken.c_str());
SE_LOG_DEBUG(getDisplayName(), "sync key %s, starting incremental sync", lastToken.c_str());
// re-populate cache from storage, without any item data
ConfigProps props;
m_trackingNode->readProperties(props);
BOOST_FOREACH(const StringPair &prop, props) {
for (const auto &prop: props) {
const std::string &easid = prop.first;
const std::string &value = prop.second;
size_t pos = value.find('/');
@ -70,9 +70,9 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
size_t nextpos = value.find('/', pos + 1);
if (nextpos != value.npos) {
std::string uid = m_escape.unescape(value.substr(pos + 1, nextpos - pos - 1));
boost::shared_ptr<Event> &eventptr = m_cache[easid];
std::shared_ptr<Event> &eventptr = m_cache[easid];
if (!eventptr) {
eventptr = boost::shared_ptr<Event>(new Event);
eventptr = std::make_shared<Event>();
}
eventptr->m_easid = easid;
eventptr->m_uid = uid;
@ -87,7 +87,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
}
}
if (!okay) {
SE_LOG_DEBUG(this, NULL, "unsupported or corrupt revision entry: %s = %s",
SE_LOG_DEBUG(getDisplayName(), "unsupported or corrupt revision entry: %s = %s",
easid.c_str(),
value.c_str());
}
@ -104,7 +104,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
for (bool firstIteration = true;
moreAvailable;
firstIteration = false) {
gchar *buffer = NULL;
gchar *buffer = nullptr;
GErrorCXX gerror;
EASItemsCXX created, updated;
EASIdsCXX deleted;
@ -132,7 +132,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
continue;
}
gerror.throwError("reading ActiveSync changes");
gerror.throwError(SE_HERE, "reading ActiveSync changes");
}
GStringPtr bufferOwner(buffer, "reading changes: empty sync key returned");
@ -142,58 +142,58 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
// populate ID lists and content cache
BOOST_FOREACH(EasItemInfo *item, created) {
for (EasItemInfo *item: created) {
if (!item->server_id) {
throwError("no server ID for new eas item");
throwError(SE_HERE, "no server ID for new eas item");
}
string easid(item->server_id);
if (easid.empty()) {
throwError("empty server ID for new eas item");
throwError(SE_HERE, "empty server ID for new eas item");
}
SE_LOG_DEBUG(this, NULL, "new eas item %s", easid.c_str());
SE_LOG_DEBUG(getDisplayName(), "new eas item %s", easid.c_str());
if (!item->data) {
throwError(StringPrintf("no body returned for new eas item %s", easid.c_str()));
throwError(SE_HERE, StringPrintf("no body returned for new eas item %s", easid.c_str()));
}
Event &event = setItemData(easid, item->data);
BOOST_FOREACH(const std::string &subid, event.m_subids) {
SE_LOG_DEBUG(this, NULL, "new eas item %s = uid %s + rid %s",
for (const std::string &subid: event.m_subids) {
SE_LOG_DEBUG(getDisplayName(), "new eas item %s = uid %s + rid %s",
easid.c_str(), event.m_uid.c_str(), subid.c_str());
addItem(createLUID(easid, subid), NEW);
}
}
BOOST_FOREACH(EasItemInfo *item, updated) {
for (EasItemInfo *item: updated) {
if (!item->server_id) {
throwError("no server ID for updated eas item");
throwError(SE_HERE, "no server ID for updated eas item");
}
string easid(item->server_id);
if (easid.empty()) {
throwError("empty server ID for updated eas item");
throwError(SE_HERE, "empty server ID for updated eas item");
}
SE_LOG_DEBUG(this, NULL, "updated eas item %s", easid.c_str());
SE_LOG_DEBUG(getDisplayName(), "updated eas item %s", easid.c_str());
if (!item->data) {
throwError(StringPrintf("no body returned for updated eas item %s", easid.c_str()));
throwError(SE_HERE, StringPrintf("no body returned for updated eas item %s", easid.c_str()));
}
Event &event = setItemData(easid, item->data);
BOOST_FOREACH(const std::string &subid, event.m_subids) {
SE_LOG_DEBUG(this, NULL, "deleted eas item %s = uid %s + rid %s",
for (const std::string &subid: event.m_subids) {
SE_LOG_DEBUG(getDisplayName(), "deleted eas item %s = uid %s + rid %s",
easid.c_str(), event.m_uid.c_str(), subid.c_str());
addItem(createLUID(easid, subid), UPDATED);
}
}
BOOST_FOREACH(const char *serverID, deleted) {
for (const char *serverID: deleted) {
if (!serverID) {
throwError("no server ID for deleted eas item");
throwError(SE_HERE, "no server ID for deleted eas item");
}
string easid(serverID);
if (easid.empty()) {
throwError("empty server ID for deleted eas item");
throwError(SE_HERE, "empty server ID for deleted eas item");
}
Event &event = findItem(easid);
if (event.m_subids.empty()) {
SE_LOG_DEBUG(this, NULL, "deleted eas item %s empty?!", easid.c_str());
SE_LOG_DEBUG(getDisplayName(), "deleted eas item %s empty?!", easid.c_str());
} else {
BOOST_FOREACH(const std::string &subid, event.m_subids) {
SE_LOG_DEBUG(this, NULL, "deleted eas item %s = uid %s + rid %s",
for (const std::string &subid: event.m_subids) {
SE_LOG_DEBUG(getDisplayName(), "deleted eas item %s = uid %s + rid %s",
easid.c_str(), event.m_uid.c_str(), subid.c_str());
addItem(createLUID(easid, subid), DELETED);
}
@ -218,11 +218,11 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
// now also generate full list of all current items:
// old items + new (added to m_events above) - deleted (removed above)
BOOST_FOREACH(const EventCache::value_type &entry, m_cache) {
for (const auto &entry: m_cache) {
const std::string &easid = entry.first;
const boost::shared_ptr<Event> &eventptr = entry.second;
BOOST_FOREACH(const std::string &subid, eventptr->m_subids) {
SE_LOG_DEBUG(this, NULL, "existing eas item %s = uid %s + rid %s",
const std::shared_ptr<Event> &eventptr = entry.second;
for (const std::string &subid: eventptr->m_subids) {
SE_LOG_DEBUG(getDisplayName(), "existing eas item %s = uid %s + rid %s",
easid.c_str(), eventptr->m_uid.c_str(), subid.c_str());
addItem(createLUID(easid, subid), ANY);
}
@ -233,13 +233,13 @@ std::string ActiveSyncCalendarSource::endSync(bool success)
{
m_trackingNode->clear();
if (success) {
BOOST_FOREACH(const EventCache::value_type &entry, m_cache) {
for (const auto &entry: m_cache) {
const std::string &easid = entry.first;
const boost::shared_ptr<Event> &eventptr = entry.second;
const std::shared_ptr<Event> &eventptr = entry.second;
std::stringstream buffer;
buffer << "//"; // use same format as in MapSyncSource, just in case - was '/' << m_escape.escape(ids.m_revision) << '/';
buffer << m_escape.escape(eventptr->m_uid) << '/';
BOOST_FOREACH(const std::string &subid, eventptr->m_subids) {
for (const std::string &subid: eventptr->m_subids) {
buffer << m_escape.escape(subid) << '/';
}
m_trackingNode->setProperty(easid, buffer.str());
@ -253,7 +253,7 @@ std::string ActiveSyncCalendarSource::endSync(bool success)
m_trackingNode->flush();
std::string newSyncKey = getCurrentSyncKey();
SE_LOG_DEBUG(this, NULL, "next sync key %s", newSyncKey.empty() ? "empty" : newSyncKey.c_str());
SE_LOG_DEBUG(getDisplayName(), "next sync key %s", newSyncKey.empty() ? "empty" : newSyncKey.c_str());
return newSyncKey;
}
@ -298,9 +298,9 @@ std::string ActiveSyncCalendarSource::getDescription(const string &luid)
ActiveSyncCalendarSource::Event &ActiveSyncCalendarSource::findItem(const std::string &easid)
{
EventCache::iterator it = m_cache.find(easid);
auto it = m_cache.find(easid);
if (it == m_cache.end()) {
throwError(STATUS_NOT_FOUND, "merged event not found: " + easid);
throwError(SE_HERE, STATUS_NOT_FOUND, "merged event not found: " + easid);
}
return *it->second;
}
@ -324,12 +324,12 @@ ActiveSyncCalendarSource::Event &ActiveSyncCalendarSource::loadItem(Event &event
ActiveSyncCalendarSource::Event &ActiveSyncCalendarSource::setItemData(const std::string &easid, const std::string &data)
{
boost::shared_ptr<Event> &eventptr = m_cache[easid];
std::shared_ptr<Event> &eventptr = m_cache[easid];
if (eventptr) {
eventptr->m_uid.clear();
eventptr->m_subids.clear();
} else {
eventptr = boost::shared_ptr<Event>(new Event);
eventptr = std::make_shared<Event>();
}
Event &event = *eventptr;
@ -408,10 +408,10 @@ SyncSourceRaw::InsertItemResult ActiveSyncCalendarSource::insertItem(const std::
const std::string &callerSubID = ids.second;
// parse new event
boost::shared_ptr<Event> newEvent(new Event);
auto newEvent = std::make_shared<Event>();
newEvent->m_calendar.set(icalcomponent_new_from_string((char *)item.c_str()), // hack for old libical
"parsing iCalendar 2.0");
icalcomponent *firstcomp = NULL;
icalcomponent *firstcomp = nullptr;
for (icalcomponent *comp = firstcomp = icalcomponent_get_first_component(newEvent->m_calendar, ICAL_VEVENT_COMPONENT);
comp;
comp = icalcomponent_get_next_component(newEvent->m_calendar, ICAL_VEVENT_COMPONENT)) {
@ -444,7 +444,7 @@ SyncSourceRaw::InsertItemResult ActiveSyncCalendarSource::insertItem(const std::
// our caller didn't.
std::string knownSubID = callerSubID;
if (easid.empty()) {
EventCache::iterator it = m_cache.findByUID(newEvent->m_uid);
auto it = m_cache.findByUID(newEvent->m_uid);
if (it != m_cache.end()) {
easid = it->first;
knownSubID = subid;
@ -458,7 +458,7 @@ SyncSourceRaw::InsertItemResult ActiveSyncCalendarSource::insertItem(const std::
InsertItemResult res = ActiveSyncSource::insertItem("", item);
easid = res.m_luid;
EventCache::iterator it = m_cache.find(res.m_luid);
auto it = m_cache.find(res.m_luid);
if (it != m_cache.end()) {
// merge into existing Event
Event &event = loadItem(*it->second);
@ -499,7 +499,7 @@ SyncSourceRaw::InsertItemResult ActiveSyncCalendarSource::insertItem(const std::
// the parent event or (if not found) the current event
eptr<icalproperty> rid(icalproperty_new_recurrenceid(icaltime_from_string(knownSubID.c_str())),
"new rid");
icalproperty *dtstart = NULL;
icalproperty *dtstart = nullptr;
icalcomponent *comp;
// look for parent first
for (comp = icalcomponent_get_first_component(event.m_calendar, ICAL_VEVENT_COMPONENT);
@ -541,7 +541,7 @@ SyncSourceRaw::InsertItemResult ActiveSyncCalendarSource::insertItem(const std::
loadItem(event);
// update cache: find old VEVENT and remove it before adding new one
icalcomponent *removeme = NULL;
icalcomponent *removeme = nullptr;
for (icalcomponent *comp = icalcomponent_get_first_component(event.m_calendar, ICAL_VEVENT_COMPONENT);
comp;
comp = icalcomponent_get_next_component(event.m_calendar, ICAL_VEVENT_COMPONENT)) {
@ -606,7 +606,7 @@ void ActiveSyncCalendarSource::readItem(const std::string &luid, std::string &it
eptr<char> icalstr(ical_strdup(icalcomponent_as_ical_string(event.m_calendar)));
item = icalstr.get();
} else {
throwError(STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
throwError(SE_HERE, STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
}
} else {
// complex case: create VCALENDAR with just the VTIMEZONE definition(s)
@ -630,7 +630,7 @@ void ActiveSyncCalendarSource::readItem(const std::string &luid, std::string &it
}
}
if (!found) {
throwError(STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
throwError(SE_HERE, STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
}
eptr<char> icalstr(ical_strdup(icalcomponent_as_ical_string(calendar)));
item = icalstr.get();
@ -650,10 +650,10 @@ void ActiveSyncCalendarSource::deleteItem(const string &luid)
if (event.m_subids.size() == 1) {
// remove entire merged item, nothing will be left after removal
if (*event.m_subids.begin() != subid) {
throwError(STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
throwError(SE_HERE, STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
} else {
event.m_subids.clear();
event.m_calendar = NULL;
event.m_calendar = nullptr;
ActiveSyncSource::deleteItem(ids.first);
}
m_cache.erase(easid);
@ -674,7 +674,7 @@ void ActiveSyncCalendarSource::deleteItem(const string &luid)
}
}
if (!found) {
throwError(STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
throwError(SE_HERE, STATUS_NOT_FOUND, "sub event not found: " + subid + " in " + easid);
}
event.m_subids.erase(subid);
// TODO: avoid updating the item immediately
@ -689,7 +689,7 @@ void ActiveSyncCalendarSource::deleteItem(const string &luid)
void ActiveSyncCalendarSource::removeAllItems()
{
BOOST_FOREACH(const EventCache::value_type &entry, m_cache) {
for (const auto &entry: m_cache) {
ActiveSyncSource::deleteItem(entry.first);
}
m_cache.clear();

View File

@ -29,8 +29,7 @@
#include <syncevo/eds_abi_wrapper.h>
#include <syncevo/SmartPtr.h>
#include <boost/utility.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -100,7 +99,7 @@ class ActiveSyncCalendarSource : public ActiveSyncCalFormatSource
/**
* parsed VCALENDAR component representing the current
* state of the item as it exists on the WebDAV server,
* must be kept up-to-date as we make changes, may be NULL
* must be kept up-to-date as we make changes, may be nullptr
*/
eptr<icalcomponent> m_calendar;
@ -119,7 +118,7 @@ class ActiveSyncCalendarSource : public ActiveSyncCalFormatSource
* A cache of information about each merged item. Maps from
* easid to Event.
*/
class EventCache : public std::map<std::string, boost::shared_ptr<Event> >
class EventCache : public std::map<std::string, std::shared_ptr<Event> >
{
public:
EventCache() : m_initialized(false) {}
@ -141,7 +140,7 @@ class ActiveSyncCalendarSource : public ActiveSyncCalFormatSource
* On-disk representation of m_cache (without the item data).
* Format same as in MapSyncSource (code copied, refactor!).
*/
boost::shared_ptr<ConfigNode> m_trackingNode;
std::shared_ptr<ConfigNode> m_trackingNode;
};
SE_END_CXX

View File

@ -25,6 +25,7 @@
#ifdef ENABLE_ACTIVESYNC
#include "ActiveSyncSource.h"
#include <syncevo/IdentityProvider.h>
#include <eas-errors.h>
@ -32,6 +33,9 @@
#include <errno.h>
#include <boost/algorithm/string.hpp>
#include <boost/range/adaptors.hpp>
SE_GOBJECT_TYPE(EasSyncHandler)
/* #include <eas-connection-errors.h> */
#include <syncevo/declarations.h>
@ -39,6 +43,7 @@ SE_BEGIN_CXX
void EASItemUnref(EasItemInfo *info) { g_object_unref(&info->parent_instance); }
void GStringUnref(char *str) { g_free(str); }
void EASFolderUnref(EasFolder *f) { g_object_unref(&f->parent_instance); }
void ActiveSyncSource::enableServerMode()
{
@ -50,26 +55,185 @@ bool ActiveSyncSource::serverModeEnabled() const
return m_operations.m_loadAdminData;
}
/* Recursively work out full path name */
std::string ActiveSyncSource::Collection::fullPath() {
if (!pathFound) {
if (parentId == "0") {
pathName = name;
} else {
pathName = source->m_collections[parentId].fullPath() + "/" + name;
}
pathFound = true;
}
return pathName;
}
void ActiveSyncSource::findCollections(const std::string &account, const bool force_update)
{
GErrorCXX gerror;
EasSyncHandlerCXX handler;
EASFoldersCXX folders;
if (!m_collections.empty()) {
if (!force_update) return;
m_collections.clear();
m_folderPaths.clear();
}
/* Fetch the folders */
handler = EasSyncHandlerCXX::steal(eas_sync_handler_new(account.c_str()));
if (!handler) throwError(SE_HERE, "findCollections cannot allocate sync handler");
if (!eas_sync_handler_get_folder_list (handler,
force_update,
folders,
nullptr,
gerror)) {
gerror.throwError(SE_HERE, "fetching folder list");
}
/* Save the Collections */
for (EasFolder *folder: folders) {
m_collections[folder->folder_id].collectionId = folder->folder_id;
m_collections[folder->folder_id].name = folder->display_name;
m_collections[folder->folder_id].parentId = folder->parent_id;
m_collections[folder->folder_id].type = folder->type;
m_collections[folder->folder_id].source = this;
}
/* Save the full paths */
for (std::string id: m_collections | boost::adaptors::map_keys) {
m_folderPaths[m_collections[id].fullPath()] = id;
}
}
int ActiveSyncSource::Collection::getFolderType () {
switch (type) {
case EAS_FOLDER_TYPE_DEFAULT_INBOX:
case EAS_FOLDER_TYPE_DEFAULT_DRAFTS:
case EAS_FOLDER_TYPE_DEFAULT_DELETED_ITEMS:
case EAS_FOLDER_TYPE_DEFAULT_SENT_ITEMS:
case EAS_FOLDER_TYPE_DEFAULT_OUTBOX:
case EAS_FOLDER_TYPE_USER_CREATED_MAIL:
return EAS_ITEM_MAIL;
case EAS_FOLDER_TYPE_DEFAULT_TASKS:
case EAS_FOLDER_TYPE_USER_CREATED_TASKS:
return EAS_ITEM_TODO;
case EAS_FOLDER_TYPE_DEFAULT_CALENDAR:
case EAS_FOLDER_TYPE_USER_CREATED_CALENDAR:
return EAS_ITEM_CALENDAR;
case EAS_FOLDER_TYPE_DEFAULT_CONTACTS:
case EAS_FOLDER_TYPE_USER_CREATED_CONTACTS:
return EAS_ITEM_CONTACT;
case EAS_FOLDER_TYPE_DEFAULT_NOTES:
case EAS_FOLDER_TYPE_USER_CREATED_NOTES:
//TODO: implement memos
case EAS_FOLDER_TYPE_DEFAULT_JOURNAL:
case EAS_FOLDER_TYPE_USER_CREATED_JOURNAL:
case EAS_FOLDER_TYPE_UNKNOWN:
case EAS_FOLDER_TYPE_RECIPIENT_CACHE:
default:
return -1;
}
}
bool ActiveSyncSource::Collection::collectionIsDefault () {
return type == EAS_FOLDER_TYPE_DEFAULT_INBOX ||
type == EAS_FOLDER_TYPE_DEFAULT_DRAFTS ||
type == EAS_FOLDER_TYPE_DEFAULT_DELETED_ITEMS ||
type == EAS_FOLDER_TYPE_DEFAULT_SENT_ITEMS ||
type == EAS_FOLDER_TYPE_DEFAULT_OUTBOX ||
type == EAS_FOLDER_TYPE_DEFAULT_TASKS ||
type == EAS_FOLDER_TYPE_DEFAULT_CALENDAR ||
type == EAS_FOLDER_TYPE_DEFAULT_CONTACTS ||
type == EAS_FOLDER_TYPE_DEFAULT_NOTES ||
type == EAS_FOLDER_TYPE_DEFAULT_JOURNAL;
}
ActiveSyncSource::Databases ActiveSyncSource::getDatabases()
{
Databases result;
// empty string always selects the default database
result.push_back(Database("", "", true));
// do a scan if username is set
UserIdentity identity = m_context->getSyncUser();
if (identity.m_provider != USER_IDENTITY_PLAIN_TEXT) {
throwError(SE_HERE, StringPrintf("%s: only the 'user:<account ID in gconf>' format is supported by ActiveSync", identity.toString().c_str()));
}
const std::string &account = identity.m_identity;
if (!account.empty()) {
findCollections(account, true);
for (Collection coll: m_collections | boost::adaptors::map_values) {
if (coll.getFolderType() == getEasType()) {
result.push_back(Database(coll.pathName, coll.collectionId, coll.collectionIsDefault()));
}
}
} else {
result.push_back(Database("to scan, specify --print-databases username=<account> backend=\""+getSourceType().m_backend+"\"",
""));
}
return result;
}
std::string ActiveSyncSource::lookupFolder(const std::string &folder) {
// If folder matches a collectionId, use that
if (m_collections.find(folder) != m_collections.end()) return folder;
// If folder begins with /, drop it
std::string key;
if (!folder.empty() && folder[0] == '/') {
key = folder.substr(1);
} else {
key = folder;
}
// Lookup folder name
auto entry = m_folderPaths.find(key);
if (entry != m_folderPaths.end()) {
return entry->second;
}
// Not found
return "";
}
void ActiveSyncSource::open()
{
// extract account ID and throw error if missing
std::string username = m_context->getSyncUsername();
SE_LOG_DEBUG(NULL, NULL,
"using eas sync account %s from config %s",
UserIdentity identity = m_context->getSyncUser();
if (identity.m_provider != USER_IDENTITY_PLAIN_TEXT) {
throwError(SE_HERE, StringPrintf("%s: only the 'user:<account ID in gconf>' format is supported by ActiveSync", identity.toString().c_str()));
}
const std::string &username = identity.m_identity;
std::string folder = getDatabaseID();
SE_LOG_DEBUG(NULL,
"using eas sync account %s from config %s with folder %s",
username.c_str(),
m_context->getConfigName().c_str());
m_context->getConfigName().c_str(),
folder.c_str());
if (folder.empty()) { // Most common case is empty string
m_folder = folder;
} else { // Lookup folder name
// Try using cached folder list
findCollections(username, false);
m_folder = lookupFolder(folder);
if (m_folder.empty()) {
// Fetch latest folder list and try again
findCollections(username, true);
m_folder = lookupFolder(folder);
}
if (m_folder.empty()) {
throwError(SE_HERE, "could not find folder: "+folder);
}
}
m_account = username;
m_folder = getDatabaseID();
// create handler
m_handler.set(eas_sync_handler_new(m_account.c_str()), "EAS handler");
@ -78,7 +242,7 @@ void ActiveSyncSource::open()
void ActiveSyncSource::close()
{
// free handler if not done already
m_handler.set(NULL);
m_handler.set(nullptr);
}
void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string &resumeToken)
@ -95,10 +259,10 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
m_startSyncKey = lastToken;
if (lastToken.empty()) {
// slow sync: wipe out cached list of IDs, will be filled anew below
SE_LOG_DEBUG(this, NULL, "sync key empty, starting slow sync");
SE_LOG_DEBUG(getDisplayName(), "sync key empty, starting slow sync");
m_ids->clear();
} else {
SE_LOG_DEBUG(this, NULL, "sync key %s for account '%s' folder '%s', starting incremental sync",
SE_LOG_DEBUG(getDisplayName(), "sync key %s for account '%s' folder '%s', starting incremental sync",
lastToken.c_str(),
m_account.c_str(),
m_folder.c_str());
@ -114,7 +278,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
for (bool firstIteration = true;
moreAvailable;
firstIteration = false) {
gchar *buffer = NULL;
gchar *buffer = nullptr;
GErrorCXX gerror;
EASItemsCXX created, updated;
EASIdsCXX deleted;
@ -142,7 +306,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
continue;
}
gerror.throwError("reading ActiveSync changes");
gerror.throwError(SE_HERE, "reading ActiveSync changes");
}
GStringPtr bufferOwner(buffer, "reading changes: empty sync key returned");
@ -151,47 +315,47 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
// will ask us for older, unmodified item content which we won't have.
// populate ID lists and content cache
BOOST_FOREACH(EasItemInfo *item, created) {
for (EasItemInfo *item: created) {
if (!item->server_id) {
throwError("no server ID for new eas item");
throwError(SE_HERE, "no server ID for new eas item");
}
string luid(item->server_id);
if (luid.empty()) {
throwError("empty server ID for new eas item");
throwError(SE_HERE, "empty server ID for new eas item");
}
SE_LOG_DEBUG(this, NULL, "new item %s", luid.c_str());
SE_LOG_DEBUG(getDisplayName(), "new item %s", luid.c_str());
addItem(luid, NEW);
m_ids->setProperty(luid, "1");
if (!item->data) {
throwError(StringPrintf("no body returned for new eas item %s", luid.c_str()));
throwError(SE_HERE, StringPrintf("no body returned for new eas item %s", luid.c_str()));
}
m_items[luid] = item->data;
}
BOOST_FOREACH(EasItemInfo *item, updated) {
for (EasItemInfo *item: updated) {
if (!item->server_id) {
throwError("no server ID for updated eas item");
throwError(SE_HERE, "no server ID for updated eas item");
}
string luid(item->server_id);
if (luid.empty()) {
throwError("empty server ID for updated eas item");
throwError(SE_HERE, "empty server ID for updated eas item");
}
SE_LOG_DEBUG(this, NULL, "updated item %s", luid.c_str());
SE_LOG_DEBUG(getDisplayName(), "updated item %s", luid.c_str());
addItem(luid, UPDATED);
// m_ids.setProperty(luid, "1"); not necessary, should already exist (TODO: check?!)
if (!item->data) {
throwError(StringPrintf("no body returned for updated eas item %s", luid.c_str()));
throwError(SE_HERE, StringPrintf("no body returned for updated eas item %s", luid.c_str()));
}
m_items[luid] = item->data;
}
BOOST_FOREACH(const char *serverID, deleted) {
for (const char *serverID: deleted) {
if (!serverID) {
throwError("no server ID for deleted eas item");
throwError(SE_HERE, "no server ID for deleted eas item");
}
string luid(serverID);
if (luid.empty()) {
throwError("empty server ID for deleted eas item");
throwError(SE_HERE, "empty server ID for deleted eas item");
}
SE_LOG_DEBUG(this, NULL, "deleted item %s", luid.c_str());
SE_LOG_DEBUG(getDisplayName(), "deleted item %s", luid.c_str());
addItem(luid, DELETED);
m_ids->removeProperty(luid);
}
@ -215,9 +379,9 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
// old items + new (added to m_ids above) - deleted (removed above)
ConfigProps props;
m_ids->readProperties(props);
BOOST_FOREACH(const StringPair &entry, props) {
for (const auto &entry: props) {
const std::string &luid = entry.first;
SE_LOG_DEBUG(this, NULL, "existing item %s", luid.c_str());
SE_LOG_DEBUG(getDisplayName(), "existing item %s", luid.c_str());
addItem(luid, ANY);
}
@ -240,7 +404,7 @@ std::string ActiveSyncSource::endSync(bool success)
// let engine do incremental sync next time or start from scratch
// in case of failure
std::string newSyncKey = success ? m_currentSyncKey : "";
SE_LOG_DEBUG(this, NULL, "next sync key %s", newSyncKey.empty() ? "empty" : newSyncKey.c_str());
SE_LOG_DEBUG(getDisplayName(), "next sync key %s", newSyncKey.empty() ? "empty" : newSyncKey.c_str());
return newSyncKey;
}
@ -251,7 +415,7 @@ void ActiveSyncSource::deleteItem(const string &luid)
// the problem by looking up the item in our list (and keep the
// list up-to-date elsewhere)
if (m_ids && m_ids->readProperty(luid).empty()) {
throwError(STATUS_NOT_FOUND, "item not found: " + luid);
throwError(SE_HERE, STATUS_NOT_FOUND, "item not found: " + luid);
}
// send delete request
@ -268,7 +432,7 @@ void ActiveSyncSource::deleteItem(const string &luid)
m_folder.c_str(),
items,
gerror)) {
gerror.throwError("deleting eas item");
gerror.throwError(SE_HERE, "deleting eas item");
}
GStringPtr bufferOwner(buffer, "delete items: empty sync key returned");
@ -313,15 +477,15 @@ SyncSourceSerialize::InsertItemResult ActiveSyncSource::insertItem(const std::st
m_folder.c_str(),
items,
gerror)) {
gerror.throwError("adding eas item");
gerror.throwError(SE_HERE, "adding eas item");
}
if (!item->server_id) {
throwError("no server ID for new eas item");
throwError(SE_HERE, "no server ID for new eas item");
}
// get new ID from updated item
res.m_luid = item->server_id;
if (res.m_luid.empty()) {
throwError("empty server ID for new eas item");
throwError(SE_HERE, "empty server ID for new eas item");
}
// TODO: if someone else has inserted a new calendar item
@ -338,7 +502,7 @@ SyncSourceSerialize::InsertItemResult ActiveSyncSource::insertItem(const std::st
m_folder.c_str(),
items,
gerror)) {
gerror.throwError("updating eas item");
gerror.throwError(SE_HERE, "updating eas item");
}
res.m_luid = luid;
}
@ -359,7 +523,7 @@ SyncSourceSerialize::InsertItemResult ActiveSyncSource::insertItem(const std::st
void ActiveSyncSource::readItem(const std::string &luid, std::string &item)
{
// return straight from cache?
std::map<std::string, std::string>::iterator it = m_items.find(luid);
auto it = m_items.find(luid);
if (it == m_items.end()) {
// no, must fetch
EASItemPtr tmp(eas_item_info_new(), "EasItem");
@ -378,13 +542,13 @@ void ActiveSyncSource::readItem(const std::string &luid, std::string &item)
message = 0xda2940 "GDBus.Error:org.meego.activesyncd.ItemOperationsError.ObjectNotFound: Document library - The object was not found or access denied."}
*/) {
throwError(STATUS_NOT_FOUND, "item not found: " + luid);
throwError(SE_HERE, STATUS_NOT_FOUND, "item not found: " + luid);
} else {
gerror.throwError(StringPrintf("reading eas item %s", luid.c_str()));
gerror.throwError(SE_HERE, StringPrintf("reading eas item %s", luid.c_str()));
}
}
if (!tmp->data) {
throwError(StringPrintf("no body returned for eas item %s", luid.c_str()));
throwError(SE_HERE, StringPrintf("no body returned for eas item %s", luid.c_str()));
}
item = tmp->data;
} else {

View File

@ -31,13 +31,12 @@
#include <syncevo/SmartPtr.h>
#include <syncevo/GLibSupport.h>
#include <boost/bind.hpp>
#include <string>
#include <map>
#include "libeassync.h"
#include <eas-item-info.h>
#include <eas-folder.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -134,7 +133,7 @@ class ActiveSyncSource :
// that we use a common prefix, so that we can use the key/value store
// also for other keys if the need ever arises).
m_itemNode(new PrefixConfigNode("item-",
boost::shared_ptr<ConfigNode>(new SafeConfigNode(params.m_nodes.getTrackingNode())))),
std::static_pointer_cast<ConfigNode>(std::make_shared<SafeConfigNode>(params.m_nodes.getTrackingNode())))),
m_context(params.m_context)
{
if (!m_context) {
@ -142,7 +141,7 @@ class ActiveSyncSource :
}
}
/** sync config used by this instance, never NULL */
/** sync config used by this instance, never nullptr */
SyncConfig &getSyncConfig() { return *m_context; }
/* partial implementation of SyncSource */
@ -179,12 +178,14 @@ class ActiveSyncSource :
void setStartSyncKey(const std::string &startSyncKey) { m_startSyncKey = startSyncKey; }
std::string getCurrentSyncKey() { return m_currentSyncKey; }
void setCurrentSyncKey(const std::string &currentSyncKey) { m_currentSyncKey = currentSyncKey; }
void findCollections(const std::string &account, bool force_update);
std::string lookupFolder(const std::string &folder);
boost::shared_ptr<ConfigNode> m_itemNode;
std::shared_ptr<ConfigNode> m_itemNode;
private:
/** "source-config@<context>" instance which holds our username == ActiveSync account ID */
boost::shared_ptr<SyncConfig> m_context;
/** "target-config@<context>" instance which holds our username == ActiveSync account ID */
std::shared_ptr<SyncConfig> m_context;
/** account ID for libeas, must be set in "username" config property */
std::string m_account;
@ -203,15 +204,42 @@ class ActiveSyncSource :
/**
* server-side IDs of all items, updated as changes are reported and/or are made;
* NULL if not using change tracking
* nullptr if not using change tracking
*/
boost::shared_ptr<ConfigNode> m_ids;
std::shared_ptr<ConfigNode> m_ids;
/**
* cache of all items, filled at begin of session and updated as
* changes are made (if doing change tracking)
*/
std::map<std::string, std::string> m_items;
/**
* list of folders
*/
typedef struct Collection {
std::string collectionId;
std::string name;
std::string parentId;
std::string pathName;
unsigned type;
bool pathFound;
ActiveSyncSource *source;
Collection() :
type(0),
pathFound(false),
source(nullptr)
{}
int getFolderType();
bool collectionIsDefault();
std::string fullPath();
} collection;
std::map<std::string, Collection> m_collections; // Indexed by collectionID
typedef std::map<std::string, std::string> FolderPaths;
FolderPaths m_folderPaths; // Maps pathName to collectionId
};
class ActiveSyncContactSource : public ActiveSyncSource
@ -263,6 +291,11 @@ typedef GListCXX<char, GSList, GStringUnref> EASIdsCXX;
/** non-copyable smart pointer to an EasItemInfo, unrefs when going out of scope */
typedef eptr<EasItemInfo, GObject> EASItemPtr;
void EASFolderUnref(EasFolder *f);
/** non-copyable list of EasFolder pointers, owned by list */
typedef GListCXX<EasFolder, GSList, EASFolderUnref> EASFoldersCXX;
SE_END_CXX
#endif // ENABLE_ACTIVESYNC

View File

@ -35,7 +35,7 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
static std::unique_ptr<SyncSource> createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
bool isMe;
@ -44,7 +44,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe) {
return
#ifdef ENABLE_ACTIVESYNC
new ActiveSyncContactSource(params)
std::make_unique<ActiveSyncContactSource>(params)
#else
RegisterSyncSource::InactiveSource(params)
#endif
@ -55,7 +55,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe) {
return
#ifdef ENABLE_ACTIVESYNC
new ActiveSyncCalendarSource(params, EAS_ITEM_CALENDAR)
std::make_unique<ActiveSyncCalendarSource>(params, EAS_ITEM_CALENDAR)
#else
RegisterSyncSource::InactiveSource(params)
#endif
@ -66,7 +66,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe) {
return
#ifdef ENABLE_ACTIVESYNC
new ActiveSyncCalFormatSource(params, EAS_ITEM_TODO)
std::make_unique<ActiveSyncCalFormatSource>(params, EAS_ITEM_TODO)
#else
RegisterSyncSource::InactiveSource(params)
#endif
@ -77,14 +77,14 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe) {
return
#ifdef ENABLE_ACTIVESYNC
new ActiveSyncCalFormatSource(params, EAS_ITEM_JOURNAL)
std::make_unique<ActiveSyncCalFormatSource>(params, EAS_ITEM_JOURNAL)
#else
RegisterSyncSource::InactiveSource(params)
#endif
;
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("ActiveSync",
@ -114,11 +114,11 @@ class ActiveSyncsTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("contacts", "ActiveSync Address Book", true));
source.reset(SyncSource::createTestingSource("events", "ActiveSync Events", true));
source.reset(SyncSource::createTestingSource("todos", "ActiveSync Todos", true));
source.reset(SyncSource::createTestingSource("memos", "ActiveSync Memos", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("contacts", "ActiveSync Address Book", true);
source = SyncSource::createTestingSource("events", "ActiveSync Events", true);
source = SyncSource::createTestingSource("todos", "ActiveSync Todos", true);
source = SyncSource::createTestingSource("memos", "ActiveSync Memos", true);
}
};
@ -151,7 +151,7 @@ static int DumpItems(ClientTest &client, TestingSyncSource &source, const std::s
// each server ID might appear multiple times, once for each
// recurrence associated with it
std::set<std::string> easids;
BOOST_FOREACH (const std::string &luid, eassource.getAllItems()) {
for (const std::string &luid: eassource.getAllItems()) {
// slight hack: we know that luids in ActiveSyncSource base
// class pass through this method unmodified, so no need to
// avoid it
@ -159,7 +159,7 @@ static int DumpItems(ClientTest &client, TestingSyncSource &source, const std::s
easids.insert(ids.first);
}
BOOST_FOREACH(const std::string &easid, easids) {
for (const std::string &easid: easids) {
std::string item;
if (forceBaseReadItem) {
// This bypasses the more specialized
@ -183,30 +183,30 @@ static int DumpItems(ClientTest &client, TestingSyncSource &source, const std::s
return 0;
}
static TestingSyncSource *createEASSource(const ClientTestConfig::createsource_t &create,
ClientTest &client,
const std::string &clientID,
int source, bool isSourceA)
static std::unique_ptr<TestingSyncSource> createEASSource(const ClientTestConfig::createsource_t &create,
ClientTest &client,
const std::string &clientID,
int source, bool isSourceA)
{
std::auto_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
std::unique_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
// Mangle username: if the base username in the config is account
// "foo", then source B uses "foo_B", because otherwise it'll end
// up sharing change tracking with source A.
if (!isSourceA) {
ActiveSyncSource *eassource = static_cast<ActiveSyncSource *>(res.get());
std::string account = eassource->getSyncConfig().getSyncUsername();
std::string account = eassource->getSyncConfig().getSyncUser().toString();
account += "_B";
eassource->getSyncConfig().setSyncUsername(account, true);
}
if (res->getDatabaseID().empty()) {
return res.release();
return res;
} else {
// sorry, no database
SE_LOG_ERROR(NULL, NULL, "cannot create EAS source for database %s, check config",
SE_LOG_ERROR(NULL, "cannot create EAS datastore for database %s, check config",
res->getDatabaseID().c_str());
return NULL;
return nullptr;
}
}
@ -218,17 +218,20 @@ static void updateConfigEAS(const RegisterSyncSourceTest */* me */,
// cannot run tests involving a second database:
// wrap orginal source creation, set default database for
// database #0 and refuse to return a source for database #1
config.m_createSourceA = boost::bind(createEASSource, config.m_createSourceA,
_1, _2, _3, _4);
config.m_createSourceB = boost::bind(createEASSource, config.m_createSourceB,
_1, _2, _3, _4);
config.m_dump = boost::bind(DumpItems, _1, _2, _3,
type == EAS_ITEM_CONTACT ||
// need to read from our cache for Google Calendar,
// because it does not support Fetch
strcmp(getEnv("CLIENT_TEST_SERVER", ""), "googleeas")
);
config.m_createSourceA = [create=config.m_createSourceA] (ClientTest &client, const std::string &clientID, int source, bool isSourceA) {
return createEASSource(create, client, clientID, source, isSourceA);
};
config.m_createSourceB = [create=config.m_createSourceB] (ClientTest &client, const std::string &clientID, int source, bool isSourceA) {
return createEASSource(create, client, clientID, source, isSourceA);
};
config.m_dump = [type] (ClientTest &client, TestingSyncSource &source, const std::string &file) {
return DumpItems(client, source, file,
type == EAS_ITEM_CONTACT ||
// need to read from our cache for Google Calendar,
// because it does not support Fetch
strcmp(getEnv("CLIENT_TEST_SERVER", ""), "googleeas")
);
};
config.m_sourceLUIDsAreVolatile = true;
// TODO: find out how ActiveSync/Exchange handle children without parent;
// at the moment, the child is stored as if it was a stand-alone event

View File

@ -22,12 +22,9 @@ src_backends_activesync_syncactivesync_la_LIBADD = $(EASCLIENT_LIBS) $(SYNCEVOLU
src_backends_activesync_syncactivesync_la_LDFLAGS = -no-undefined -module -avoid-version
src_backends_activesync_syncactivesync_la_CPPFLAGS = $(SYNCEVOLUTION_CFLAGS) -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_activesync_syncactivesync_la_CXXFLAGS = $(EASCLIENT_CFLAGS) $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS) $(LIBICAL_CFLAGS) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
src_backends_activesync_syncactivesync_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS) $(EASCLIENT_DEPENDENCIES)
src_backends_activesync_syncactivesync_la_DEPENDENCIES = src/syncevo/libsyncevolution.la $(EASCLIENT_DEPENDENCIES)
# activated by EASCLIENT_DEPENDENCIES: usually empty, unless --with-activesyncd-src is used
$(src_backends_activesync_src) src/backends/activesync/ActiveSyncSourceRegister.cpp: $(EASCLIENT_DEPENDENCIES)
$(EASCLIENT_DEPENDENCIES): $(LIBEASCLIENT_LA_DEPENDENCIES)
cd src/backends/activesync/activesyncd/build && $(MAKE)
for i in libeasaccount/src libeasclient eas-daemon/libeas libeastest/src eas-daemon/src; do \
(cd src/backends/activesync/activesyncd/build/$$i && $(MAKE) DESTDIR= install) || exit 1; \
done
cd src/backends/activesync/activesyncd/build && $(MAKE) && $(MAKE) DESTDIR= install

View File

@ -24,7 +24,7 @@ if test "$enable_activesync" = "yes"; then
mkdir -p src/backends/activesync/activesyncd/build
AC_MSG_NOTICE([configuring activesyncd using the $ACTIVESYNCDSRC source code])
( set -x; cd src/backends/activesync/activesyncd/build &&
$ACTIVESYNCDSRC/configure --disable-eplugin --disable-camel-backend --prefix=`pwd`/../install) ||
$ACTIVESYNCDSRC/configure --disable-eplugin --disable-camel-backend --disable-qtconfig --prefix=`pwd`/../install) ||
AC_MSG_ERROR([configuring activesyncd failed])
# hard-coded replacement for pkg-config: necessary because

View File

@ -1,148 +0,0 @@
/*
* Copyright (C) 2007-2009 Patrick Ohly <patrick.ohly@gmx.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "config.h"
#ifdef ENABLE_ADDRESSBOOK
#include <CoreFoundation/CoreFoundation.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
/**
* constants missing from AddressBook framework on iPhone: use strings
* as found in SQLite database on iPhone
*
* kABTitleProperty is also missing, but the ABRecord constants which
* are CFStrings on Mac OS seem to be numeric constants on the iPhone so
* we cannot guess it might be (if it exists at all), so not supported.
*/
#ifdef __arm__
// CFStringRef kABCAIMInstantProperty;
CFStringRef kABCAddressCityKey;
CFStringRef kABCAddressCountryKey;
CFStringRef kABCAddressHomeLabel;
CFStringRef kABCAddressStateKey;
CFStringRef kABCAddressStreetKey;
CFStringRef kABCAddressWorkLabel;
CFStringRef kABCAddressZIPKey;
CFStringRef kABCAssistantLabel;
CFStringRef kABCEmailHomeLabel;
CFStringRef kABCEmailWorkLabel;
CFStringRef kABCHomePageLabel;
// CFStringRef kABCHomePageProperty;
// CFStringRef kABCICQInstantProperty;
CFStringRef kABCJabberHomeLabel;
// CFStringRef kABCJabberInstantProperty;
CFStringRef kABCJabberWorkLabel;
// CFStringRef kABCMSNInstantProperty;
CFStringRef kABCManagerLabel;
// CFStringRef kABCOtherDatesProperty;
CFStringRef kABCPhoneHomeFAXLabel;
CFStringRef kABCPhoneHomeLabel;
CFStringRef kABCPhoneMainLabel;
CFStringRef kABCPhoneMobileLabel;
CFStringRef kABCPhonePagerLabel;
CFStringRef kABCPhoneWorkFAXLabel;
CFStringRef kABCPhoneWorkLabel;
CFStringRef kABCSpouseLabel;
// CFStringRef kABCTitleProperty;
// CFStringRef kABCURLsProperty;
// CFStringRef kABCYahooInstantProperty;
#endif
class constants {
public:
constants() {
#ifdef __arm__
// kABCAIMInstantProperty = CFStringCreateWithCString(NULL, "AIMInstant", kCFStringEncodingUTF8);
kABCAddressCityKey = CFStringCreateWithCString(NULL, "City", kCFStringEncodingUTF8);
kABCAddressCountryKey = CFStringCreateWithCString(NULL, "Country", kCFStringEncodingUTF8);
kABCAddressHomeLabel = CFStringCreateWithCString(NULL, "_$!<Home>!$_", kCFStringEncodingUTF8);
kABCAddressStateKey = CFStringCreateWithCString(NULL, "State", kCFStringEncodingUTF8);
kABCAddressStreetKey = CFStringCreateWithCString(NULL, "Street", kCFStringEncodingUTF8);
kABCAddressWorkLabel = CFStringCreateWithCString(NULL, "_$!<Work>!$_", kCFStringEncodingUTF8);
kABCAddressZIPKey = CFStringCreateWithCString(NULL, "ZIP", kCFStringEncodingUTF8);
kABCAssistantLabel = CFStringCreateWithCString(NULL, "_$!<Assistant>!$_", kCFStringEncodingUTF8);
kABCEmailHomeLabel = CFStringCreateWithCString(NULL, "_$!<Home>!$_", kCFStringEncodingUTF8);
kABCEmailWorkLabel = CFStringCreateWithCString(NULL, "_$!<Work>!$_", kCFStringEncodingUTF8);
kABCHomePageLabel = CFStringCreateWithCString(NULL, "_$!<HomePage>!$_", kCFStringEncodingUTF8);
// kABCHomePageProperty = CFStringCreateWithCString(NULL, "HomePage", kCFStringEncodingUTF8);
// kABCICQInstantProperty = CFStringCreateWithCString(NULL, "ICQInstant", kCFStringEncodingUTF8);
kABCJabberHomeLabel = CFStringCreateWithCString(NULL, "_$!<Home>!$_", kCFStringEncodingUTF8);
// kABCJabberInstantProperty = CFStringCreateWithCString(NULL, "JabberInstant", kCFStringEncodingUTF8);
kABCJabberWorkLabel = CFStringCreateWithCString(NULL, "_$!<Work>!$_", kCFStringEncodingUTF8);
// kABCMSNInstantProperty = CFStringCreateWithCString(NULL, "MSNInstant", kCFStringEncodingUTF8);
kABCManagerLabel = CFStringCreateWithCString(NULL, "_$!<Manager>!$_", kCFStringEncodingUTF8);
// kABCOtherDatesProperty = CFStringCreateWithCString(NULL, "ABDate", kCFStringEncodingUTF8);
kABCPhoneHomeFAXLabel = CFStringCreateWithCString(NULL, "_$!<HomeFAX>!$_", kCFStringEncodingUTF8);
kABCPhoneHomeLabel = CFStringCreateWithCString(NULL, "_$!<Home>!$_", kCFStringEncodingUTF8);
kABCPhoneMainLabel = CFStringCreateWithCString(NULL, "_$!<Main>!$_", kCFStringEncodingUTF8);
kABCPhoneMobileLabel = CFStringCreateWithCString(NULL, "_$!<Mobile>!$_", kCFStringEncodingUTF8);
kABCPhonePagerLabel = CFStringCreateWithCString(NULL, "_$!<Pager>!$_", kCFStringEncodingUTF8);
kABCPhoneWorkFAXLabel = CFStringCreateWithCString(NULL, "_$!<WorkFAX>!$_", kCFStringEncodingUTF8);
kABCPhoneWorkLabel = CFStringCreateWithCString(NULL, "_$!<Work>!$_", kCFStringEncodingUTF8);
kABCSpouseLabel = CFStringCreateWithCString(NULL, "_$!<Spouse>!$_", kCFStringEncodingUTF8);
// kABCTitleProperty = CFStringCreateWithCString(NULL, "Title", kCFStringEncodingUTF8);
// kABCURLsProperty = CFStringCreateWithCString(NULL, "URLs", kCFStringEncodingUTF8);
// kABCYahooInstantProperty = CFStringCreateWithCString(NULL, "YahooInstant", kCFStringEncodingUTF8);
#endif
#if 0
#define printconstant(_x) printf(#_x ": %s\n", CFString2Std((CFStringRef)_x).c_str())
printconstant(kABAIMInstantProperty);
printconstant(kABAddressCityKey);
printconstant(kABAddressCountryKey);
printconstant(kABAddressHomeLabel);
printconstant(kABAddressStateKey);
printconstant(kABAddressStreetKey);
printconstant(kABAddressWorkLabel);
printconstant(kABAddressZIPKey);
printconstant(kABAssistantLabel);
printconstant(kABEmailHomeLabel);
printconstant(kABEmailWorkLabel);
printconstant(kABHomePageLabel);
printconstant(kABHomePageProperty);
printconstant(kABICQInstantProperty);
printconstant(kABJabberHomeLabel);
printconstant(kABJabberInstantProperty);
printconstant(kABJabberWorkLabel);
printconstant(kABMSNInstantProperty);
printconstant(kABManagerLabel);
printconstant(kABOtherDatesProperty);
printconstant(kABPhoneHomeFAXLabel);
printconstant(kABPhoneHomeLabel);
printconstant(kABPhoneMainLabel);
printconstant(kABPhoneMobileLabel);
printconstant(kABPhonePagerLabel);
printconstant(kABPhoneWorkFAXLabel);
printconstant(kABPhoneWorkLabel);
printconstant(kABSpouseLabel);
// printconstant(kABTitleProperty);
printconstant(kABURLsProperty);
printconstant(kABYahooInstantProperty);
#endif
}
} constants;
SE_END_CXX
#endif // ENABLE_ADDRESSBOOK

File diff suppressed because it is too large Load Diff

View File

@ -1,195 +0,0 @@
/*
* Copyright (C) 2007-2009 Patrick Ohly <patrick.ohly@gmx.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef INCL_ADDRESSBOOKSOURCE
#define INCL_ADDRESSBOOKSOURCE
#include "config.h"
#include <syncevo/TrackingSyncSource.h>
#ifdef ENABLE_ADDRESSBOOK
#include <AddressBook/ABAddressBookC.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
/**
* a smart pointer for CoreFoundation object references
*
* trying to store a NULL pointer raises an exception,
* unreferencing valid objects is done automatically
*
* @param T the pointer type
* @param release CFRelease() is only called when passing true
*/
template<class T, bool doRelease =
#ifdef IPHONE
// by default do not release anything because that has led
// to crashes: this is the safe default in case of doubt
false
#else
true
#endif
> class ref {
/** do not allow copy construction */
ref( const ref &other) {};
/** do not allow copying */
void operator = ( const ref &other ) {}
protected:
T m_pointer;
public:
/**
* create a smart pointer that owns the given object;
* passing a NULL pointer and a name for the object raises an error
*/
ref(T pointer = NULL, const char *objectName = NULL) :
m_pointer( pointer )
{
if (!pointer && objectName ) {
throw std::runtime_error(std::string("Error allocating ") + objectName);
}
};
~ref()
{
set( NULL );
}
/**
* store another object in this pointer, replacing any which was
* referenced there before;
* passing a NULL pointer and a name for the object raises an error
*/
void set( T pointer, const char *objectName = NULL )
{
if (m_pointer && doRelease) {
CFRelease(m_pointer);
}
if (!pointer && objectName) {
throw std::runtime_error(std::string("Error allocating ") + objectName);
}
m_pointer = pointer;
}
ref<T> &operator = ( T pointer ) { set( pointer ); return *this; }
T operator-> () { return m_pointer; }
T operator * () { return m_pointer; }
operator T () { return m_pointer; }
operator bool () { return m_pointer != NULL; }
T release() {
T res = m_pointer;
m_pointer = NULL;
return res;
}
};
#if 0
/* template typedefs would have been handy here, but are not specified in C++ (yet) */
#ifdef IPHONE
/** do not free some particular objects on the iPhone because that crashes */
template<class T> typedef ref<T, false> iphoneref;
#else
template<class T> typedef ref<T, true> iphoneref;
#endif
#else
#ifdef IPHONE
# define IPHONE_RELEASE false
#else
# define IPHONE_RELEASE true
#endif
#endif
/**
* The AddressBookSource synchronizes the Mac OS X and iPhone system
* address book using the "AddressBook" framework. Changes are tracked
* by comparing the current time stamp of a contact against its time
* stamp from the previous sync, stored in a separate key/value
* database. Contacts are converted to/from vCard 2.1 using custom
* code because a) the mapping can be chosen so that typical SyncML
* servers understand it and b) the iPhone's AddressBook does not have
* vcard import/export functions.
*
* On the iPhone the interface is similar, but not the same. These
* differences are hidden behind "ifdef IPHONE" which depends (for
* simplicity reasons) on the __arm__ define.
*
* Some of the differences and how they are handled are listed here.
* - ABC instead of AB prefix, other renames: map Mac OS X name to iPhone
* name before including AddressBook.h, then use Mac OS X names
* - CFRelease() and CFCopyDescription on ABMultiValueRef crash (bugs?!):
* use ref<T, IPHONE_RELEASE> for those instead the normal ref smart pointer,
* avoid CFCopyDescription()
* - UID is integer, not CFStringRef: added wrapper function
* - the address of kABC*Property identifies properties, not the CFStringRef
* at that address, caused toolchain problems when initializing data
* with these addresses: added one additional address indirection
* - UIDs are assigned to added contacts only during saving, but are needed
* earlier: save after adding each contact (affects performance and aborted
* sync changes address book - perhaps better guess UID?)
* - Mac OS X 10.4 still uses the kABHomePageProperty (a single string),
* the iPhone switched to the more recent kABCURLProperty/kABURLsProperty:
* conversion code is slightly different
* - iPhone does not have a title (e.g. "sir") property, only the job title
* - label constants are not part of the framework:
* defined in AddressSourceConstants
*/
class AddressBookSource : public TrackingSyncSource
{
public:
AddressBookSource(const EvolutionSyncSourceParams &params, bool asVCard30);
virtual ~AddressBookSource() { close(); }
void setVCard30(bool asVCard30) { m_asVCard30 = asVCard30; }
bool getVCard30() { return m_asVCard30; }
virtual Databases getDatabases();
virtual void open();
virtual void listAllItems(RevisionMap_t &revisions);
virtual InsertItemResult insertItem(const string &uid, const std::string &item, bool raw);
void readItem(const std::string &luid, std::string &item, bool raw);
virtual void removeItem(const string &uid);
virtual void close();
virtual const char *getMimeType() const { return m_asVCard30 ? "text/vcard" : "text/x-vcard"; }
virtual const char *getMimeVersion() const { return m_asVCard30 ? "3.0" : "2.1"; }
virtual const char *getSupportedTypes() const { return m_asVCard30 ? "text/vcard:3.0" : "text/x-vcard:2.1"; }
private:
/** valid after open(): the address book that this source references */
ABAddressBookRef m_addressbook;
/** returns absolute modification time or (if that doesn't exist) the creation time */
string getModTime(ABRecordRef record);
/** unless selected otherwise send items as vCard 2.1 */
bool m_asVCard30;
};
SE_END_CXX
#endif // ENABLE_EBOOK
#endif // INCL_ADDRESSBOOKSOURCE

View File

@ -1,123 +0,0 @@
/*
* Copyright (C) 2008-2009 Patrick Ohly <patrick.ohly@gmx.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include "AddressBookSource.h"
#include <syncevo/util.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
bool isMe = sourceType.m_backend == "apple-contacts";
#ifndef ENABLE_ADDRESSBOOK
return isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
#else
bool maybeMe = sourceType.m_backend == "addressbook";
if (isMe || maybeMe) {
// Hack: choose default based on server URI. "card3"
// indicates ScheduleWorld, which works better with (requires?)
// sending vCard 3.0.
bool vCard3 = false;
PersistentEvolutionSyncSourceConfig config(params.m_name, params.m_nodes);
if (config.getURI() && !strcmp(config.getURI(), "card3")) {
vCard3 = true;
}
if (sourceType.m_format == "text/x-vcard") {
vCard3 = false;
} else if (sourceType.m_format == "text/vcard") {
vCard3 = true;
}
return new AddressBookSource(params, vCard3);
}
return NULL;
#endif
}
static RegisterSyncSource registerMe("iPhone/Mac OS X Address Book",
#ifdef ENABLE_ADDRESSBOOK
true,
#else
false,
#endif
createSource,
"Mac OS X or iPhone Address Book = addressbook = contacts = apple-contacts\n",
Values() +
(Aliases("apple-contacts") + "Mac OS X Address Book" + "iPhone Address Book"));
#ifdef ENABLE_ADDRESSBOOK
#ifdef ENABLE_UNIT_TESTS
class EvolutionAddressbookTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(EvolutionAddressbookTest);
CPPUNIT_TEST(testInstantiate);
CPPUNIT_TEST_SUITE_END();
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("contacts", "contacts", true));
source.reset(SyncSource::createTestingSource("contacts", "addressbook", true));
source.reset(SyncSource::createTestingSource("contacts", "apple-contacts", true));
source.reset(SyncSource::createTestingSource("contacts", "Mac OS X Address Book:text/vcard", true));
source.reset(SyncSource::createTestingSource("contacts", "iPhone Address Book:text/x-vcard", true));
}
};
SYNCEVOLUTION_TEST_SUITE_REGISTRATION(EvolutionAddressbookTest);
#endif // ENABLE_UNIT_TESTS
#ifdef ENABLE_INTEGRATION_TESTS
namespace {
#if 0
}
#endif
static class VCard21Test : public RegisterSyncSourceTest {
public:
VCard21Test() : RegisterSyncSourceTest("addressbook_eds_contact", "eds_contact") {}
virtual void updateConfig(ClientTestConfig &config) const
{
config.m_type = "apple-contacts:text/x-vcard";
}
} vCard21Test;
static class VCard30Test : public RegisterSyncSourceTest {
public:
VCard30Test() : RegisterSyncSourceTest("addressbook_eds_contact", "eds_contact") {}
virtual void updateConfig(ClientTestConfig &config) const
{
config.m_type = "apple-contacts:text/vcard";
}
} vCard30Test;
}
#endif // ENABLE_INTEGRATION_TESTS
#endif // ENABLE_ADDRESSBOOK
SE_END_CXX

View File

@ -1,22 +0,0 @@
dist_noinst_DATA += src/backends/addressbook/configure-sub.in
src_backends_addressbook_lib = src/backends/addressbook/syncaddressbook.la
MOSTLYCLEANFILES += $(src_backends_addressbook_lib)
if ENABLE_MODULES
src_backends_addressbook_backenddir = $(BACKENDS_DIRECTORY)
src_backends_addressbook_backend_LTLIBRARIES = $(src_backends_addressbook_lib)
else
noinst_LTLIBRARIES += $(src_backends_addressbook_lib)
endif
src_backends_addressbook_src = \
src/backends/addressbook/AddressBookSource.h \
src/backends/addressbook/AddressBookConstants.cpp \
src/backends/addressbook/AddressBookSource.cpp
src_backends_addressbook_syncaddressbook_la_SOURCES = $(src_backends_addressbook_src)
src_backends_addressbook_syncaddressbook_la_LIBADD = $(ADDRESSBOOK_LIBS) $(SYNCEVOLUTION_LIBS)
src_backends_addressbook_syncaddressbook_la_LDFLAGS = -module -avoid-version
src_backends_addressbook_syncaddressbook_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS)
src_backends_addressbook_syncaddressbook_la_CPPFLAGS = $(SYNCEVOLUTION_CFLAGS) -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_addressbook_syncaddressbook_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS)

View File

@ -1,25 +0,0 @@
dnl -*- mode: Autoconf; -*-
dnl Invoke autogen.sh to produce a configure script.
dnl hard-coded settings for Mac OS X AddressBook
ADDRESSBOOK_CFLAGS=
ADDRESSBOOK_LIBS="-framework AddressBook -framework CoreFoundation"
AC_SUBST(ADDRESSBOOK_CFLAGS)
AC_SUBST(ADDRESSBOOK_LIBS)
BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $ADDRESSBOOK_CFLAGS"
SE_ARG_ENABLE_BACKEND(addressbook, addressbook,
[AS_HELP_STRING([--enable-addressbook],
[enable access to Mac OS X address book (default off)])],
[enable_addressbook="$enableval"], [enable_addressbook="no"]
)
if test "$enable_addressbook" = "yes"; then
AC_DEFINE(ENABLE_ADDRESSBOOK, 1, [addressbook available])
DEVICE_TYPE=MacOS_X
enable_any="yes"
else
ADDRESSBOOK_LIBS=
fi

View File

@ -27,7 +27,7 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
static std::unique_ptr<SyncSource> createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
bool isMe;
@ -40,13 +40,13 @@ static SyncSource *createSource(const SyncSourceParams &params)
|| sourceType.m_format == "text/x-vcard") {
return
#ifdef ENABLE_AKONADI
new AkonadiContactSource(params)
std::make_unique<AkonadiContactSource>(params)
#else
isMe ? RegisterSyncSource::InactiveSource(params) : NULL
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr
#endif
;
} else {
return NULL;
return nullptr;
}
}
@ -56,13 +56,13 @@ static SyncSource *createSource(const SyncSourceParams &params)
|| sourceType.m_format == "text/x-vcalendar") {
return
#ifdef ENABLE_AKONADI
new AkonadiTaskSource(params)
std::make_unique<AkonadiTaskSource>(params)
#else
isMe ? RegisterSyncSource::InactiveSource(params) : NULL
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr
#endif
;
} else {
return NULL;
return nullptr;
}
}
@ -71,13 +71,13 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (sourceType.m_format == "" || sourceType.m_format == "text/plain") {
return
#ifdef ENABLE_AKONADI
new AkonadiMemoSource(params)
std::make_unique<AkonadiMemoSource>(params)
#else
isMe ? RegisterSyncSource::InactiveSource(params) : NULL
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr
#endif
;
} else {
return NULL;
return nullptr;
}
}
@ -87,17 +87,17 @@ static SyncSource *createSource(const SyncSourceParams &params)
sourceType.m_format == "text/x-vcalendar" /* this is for backwards compatibility with broken configs */ ) {
return
#ifdef ENABLE_AKONADI
new AkonadiCalendarSource(params)
std::make_unique<AkonadiCalendarSource>(params)
#else
isMe ? RegisterSyncSource::InactiveSource(params) : NULL
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr
#endif
;
} else {
return NULL;
return nullptr;
}
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("KDE Contact/Calendar/Task List/Memos",
@ -133,66 +133,73 @@ static RegisterSyncSource registerMe("KDE Contact/Calendar/Task List/Memos",
class AkonadiTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(AkonadiTest);
CPPUNIT_TEST(testInstantiate);
// There is no default database in Akonadi:
// CPPUNIT_TEST(testOpenDefaultCalendar);
// CPPUNIT_TEST(testOpenDefaultTodo);
// CPPUNIT_TEST(testOpenDefaultMemo);
CPPUNIT_TEST(testTimezones);
// Besides, don't enable tests which depend on running Akonadi,
// because that would cause "client-test SyncEvolution" unless
// Akonadi was started first:
// CPPUNIT_TEST(testTimezones);
CPPUNIT_TEST_SUITE_END();
protected:
static string addItem(boost::shared_ptr<TestingSyncSource> source,
static string addItem(std::shared_ptr<TestingSyncSource> source,
string &data) {
SyncSourceRaw::InsertItemResult res = source->insertItemRaw("", data);
return res.m_luid;
}
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
// source.reset(SyncSource::createTestingSource("addressbook", "addressbook", true));
// source.reset(SyncSource::createTestingSource("addressbook", "contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "kde-contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "KDE Contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "KDE Address Book:text/x-vcard", true));
source.reset(SyncSource::createTestingSource("addressbook", "KDE Address Book:text/vcard", true));
std::unique_ptr<SyncSource> source;
// source = SyncSource::createTestingSource("addressbook", "addressbook", true);
// source = SyncSource::createTestingSource("addressbook", "contacts", true);
source = SyncSource::createTestingSource("addressbook", "kde-contacts", true);
source = SyncSource::createTestingSource("addressbook", "KDE Contacts", true);
source = SyncSource::createTestingSource("addressbook", "KDE Address Book:text/x-vcard", true);
source = SyncSource::createTestingSource("addressbook", "KDE Address Book:text/vcard", true);
// source.reset(SyncSource::createTestingSource("calendar", "calendar", true));
source.reset(SyncSource::createTestingSource("calendar", "kde-calendar", true));
source.reset(SyncSource::createTestingSource("calendar", "KDE Calendar:text/calendar", true));
// source = SyncSource::createTestingSource("calendar", "calendar", true);
source = SyncSource::createTestingSource("calendar", "kde-calendar", true);
source = SyncSource::createTestingSource("calendar", "KDE Calendar:text/calendar", true);
// source.reset(SyncSource::createTestingSource("tasks", "tasks", true));
source.reset(SyncSource::createTestingSource("tasks", "kde-tasks", true));
source.reset(SyncSource::createTestingSource("tasks", "KDE Tasks", true));
source.reset(SyncSource::createTestingSource("tasks", "KDE Task List:text/calendar", true));
// source = SyncSource::createTestingSource("tasks", "tasks", true);
source = SyncSource::createTestingSource("tasks", "kde-tasks", true);
source = SyncSource::createTestingSource("tasks", "KDE Tasks", true);
source = SyncSource::createTestingSource("tasks", "KDE Task List:text/calendar", true);
// source.reset(SyncSource::createTestingSource("memos", "memos", true));
source.reset(SyncSource::createTestingSource("memos", "kde-memos", true));
source.reset(SyncSource::createTestingSource("memos", "KDE Memos:text/plain", true));
// source = SyncSource::createTestingSource("memos", "memos", true);
source = SyncSource::createTestingSource("memos", "kde-memos", true);
source = SyncSource::createTestingSource("memos", "KDE Memos:text/plain", true);
}
// TODO: support default databases
// void testOpenDefaultAddressBook() {
// boost::shared_ptr<TestingSyncSource> source;
// source.reset((TestingSyncSource *)SyncSource::createTestingSource("contacts", "kde-contacts", true, NULL));
// std::shared_ptr<TestingSyncSource> source;
// source = (TestingSyncSource *)SyncSource::createTestingSource("contacts", "kde-contacts", true, nullptr);
// CPPUNIT_ASSERT_NO_THROW(source->open());
// }
// void testOpenDefaultCalendar() {
// boost::shared_ptr<TestingSyncSource> source;
// source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "kde-calendar", true, NULL));
// std::shared_ptr<TestingSyncSource> source;
// source = (TestingSyncSource *)SyncSource::createTestingSource("calendar", "kde-calendar", true, nullptr);
// CPPUNIT_ASSERT_NO_THROW(source->open());
// }
// void testOpenDefaultTodo() {
// boost::shared_ptr<TestingSyncSource> source;
// source.reset((TestingSyncSource *)SyncSource::createTestingSource("tasks", "kde-tasks", true, NULL));
// std::shared_ptr<TestingSyncSource> source;
// source = (TestingSyncSource *)SyncSource::createTestingSource("tasks", "kde-tasks", true, nullptr);
// CPPUNIT_ASSERT_NO_THROW(source->open());
// }
// void testOpenDefaultMemo() {
// boost::shared_ptr<TestingSyncSource> source;
// source.reset((TestingSyncSource *)SyncSource::createTestingSource("memos", "kde-memos", true, NULL));
// std::shared_ptr<TestingSyncSource> source;
// source = (TestingSyncSource *)SyncSource::createTestingSource("memos", "kde-memos", true, nullptr);
// CPPUNIT_ASSERT_NO_THROW(source->open());
// }
@ -202,8 +209,8 @@ protected:
prefix = "SyncEvolution_Test_";
}
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("eds_event", "kde-calendar", true, prefix));
std::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("eds_event", "kde-calendar", true, prefix).release());
CPPUNIT_ASSERT_NO_THROW(source->open());
string newyork =
@ -358,6 +365,13 @@ public:
virtual void updateConfig(ClientTestConfig &config) const
{
config.m_type = "kde-calendar";
// Looks like iCalendar file resource in Akonadi 1.11.0 does
// not actually enforce iCalendar 2.0 semantic. It allows
// updating of events with no UID
// (testLinkedItemsInsertBothUpdateChildNoIDs)
// and fails to detect double-adds (testInsertTwice).
// TODO: this should better be fixed.
config.m_sourceKnowsItemSemantic = false;
}
} iCal20Test;
@ -368,6 +382,8 @@ public:
virtual void updateConfig(ClientTestConfig &config) const
{
config.m_type = "kde-tasks";
// See above.
config.m_sourceKnowsItemSemantic = false;
}
} iTodo20Test;

View File

@ -27,13 +27,13 @@ Query databases:
syncevolution
Configuring syncevolution for contacts with Akonadi as backend:
syncevolution --configure --source-property sync=none \
syncevolution --configure --datastore-property sync=none \
--sync-property username=... \
--sync-property password=... \
scheduleworld
syncevolution --configure --source-property sync=two-way \
--source-property type=kde-contacts \
--source-property evolutionsource=akonadi:?... \
syncevolution --configure --datastore-property sync=two-way \
--datastore-property type=kde-contacts \
--datastore-property evolutionsource=akonadi:?... \
scheduleworld addressbook
Initial run:

View File

@ -16,6 +16,6 @@ src_backends_akonadi_syncakonadi_la_SOURCES = \
src/backends/akonadi/akonadisyncsource.cpp
src_backends_akonadi_syncakonadi_la_LIBADD = $(KDEPIM_LIBS) $(SYNCEVOLUTION_LIBS)
src_backends_akonadi_syncakonadi_la_LDFLAGS = -module -avoid-version
src_backends_akonadi_syncakonadi_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS)
src_backends_akonadi_syncakonadi_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS_DEPRECATED)
src_backends_akonadi_syncakonadi_la_CPPFLAGS = $(SYNCEVOLUTION_CFLAGS) -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_akonadi_syncakonadi_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS)
src_backends_akonadi_syncakonadi_la_DEPENDENCIES = src/syncevo/libsyncevolution.la

View File

@ -37,16 +37,30 @@
#include <Akonadi/Control>
#include <kurl.h>
#include <syncevo/util.h>
#include <QtCore/QDebug>
SE_BEGIN_CXX
using namespace Akonadi;
/**
* We take over ownership of jobs by storing them in smart pointers
* (RAII). This is how SyncEvolution does things and more predictable
* than assuming that a future exec() call will auto-delete them as
* part of its event processing.
*
* To avoid double frees, we need to disable auto-deletion.
* This method does that. Use like this:
* std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
*/
template<class J> J *DisableAutoDelete(J *job) { job->setAutoDelete(false); return job; }
AkonadiSyncSource::AkonadiSyncSource(const char *submime,
const SyncSourceParams &params)
: TrackingSyncSource(params)
, m_subMime(submime)
{
m_mimeTypes = QString(submime).split(",", QString::SkipEmptyParts);
}
AkonadiSyncSource::~AkonadiSyncSource()
@ -55,17 +69,28 @@ AkonadiSyncSource::~AkonadiSyncSource()
bool AkonadiSyncSource::isEmpty()
{
if (!GRunIsMain()) {
bool result;
GRunInMain([this, &result] () { result = isEmpty(); });
return result;
}
//To Check if the respective collection is Empty, without actually loading the collections
CollectionStatisticsJob *statisticsJob = new CollectionStatisticsJob(m_collection);
std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
if (!statisticsJob->exec()) {
throwError("Error fetching the collection stats");
throwError(SE_HERE, "Error fetching the collection stats");
}
return statisticsJob->statistics().count() == 0;
}
void AkonadiSyncSource::start()
{
// Start The Akonadi Server if not already Running.
if (!GRunIsMain()) {
GRunInMain([this]() { start(); });
return;
}
// Check for Akonadi server.
if (!Akonadi::ServerManager::isRunning()) {
// Don't try to start it. A normal KDE user should have it already
// running. Users of other desktop systems probably don't want it
@ -74,7 +99,7 @@ void AkonadiSyncSource::start()
// Starting it here also produces output that we don't want mixed
// into normal SyncEvolution command line output.
#if 0
SE_LOG_DEBUG(NULL, NULL, "Akonadi Server isn't running, and hence starting it.");
SE_LOG_DEBUG(NULL, "Akonadi Server isn't running, and hence starting it.");
if (!Akonadi::Control::start()) {
SE_THROW("Couldn't Start Akonadi Server: hence the akonadi backend of syncevolution wont work ..");
}
@ -86,23 +111,27 @@ void AkonadiSyncSource::start()
SyncSource::Databases AkonadiSyncSource::getDatabases()
{
if (!GRunIsMain()) {
Databases result;
GRunInMain([this, &result] () { result = getDatabases(); });
return result;
}
start();
Databases res;
QStringList mimeTypes;
mimeTypes << m_subMime.c_str();
// Insert databases which match the "type" of the source, including a user-visible
// description and a database IDs. Exactly one of the databases should be marked
// as the default one used by the source.
// res.push_back("Contacts", "some-KDE-specific-ID", isDefault);
CollectionFetchJob *fetchJob = new CollectionFetchJob(Collection::root(),
CollectionFetchJob::Recursive);
std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
CollectionFetchJob::Recursive)));
fetchJob->fetchScope().setContentMimeTypes(mimeTypes);
fetchJob->fetchScope().setContentMimeTypes(m_mimeTypes);
if (!fetchJob->exec()) {
throwError("cannot list collections");
throwError(SE_HERE, "cannot list collections");
}
// Currently, the first collection of the right type is the default
@ -121,6 +150,11 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
void AkonadiSyncSource::open()
{
if (!GRunIsMain()) {
GRunInMain([this] () { open(); });
return;
}
start();
// the "evolutionsource" property, empty for default,
@ -141,7 +175,7 @@ void AkonadiSyncSource::open()
SE_THROW("need two Akonadi resources for testing");
}
id = databases[index].m_uri;
SE_LOG_DEBUG(NULL, NULL, "testing Akonadi with %s", id.c_str());
SE_LOG_DEBUG(NULL, "testing Akonadi with %s", id.c_str());
}
}
@ -151,20 +185,53 @@ void AkonadiSyncSource::open()
}
m_collection = Collection::fromUrl(KUrl(id.c_str()));
// Verify that the collection exists and ensure that
// m_collection.contentMimeTypes() returns valid information. The
// collection constructed so far only contains the collection ID.
std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
CollectionFetchJob::Base)));
if (!fetchJob->exec()) {
throwError(SE_HERE, StringPrintf("cannot fetch collection %s", id.c_str()));
}
Collection::List collections = fetchJob->collections();
if (collections.isEmpty()) {
throwError(SE_HERE, StringPrintf("collection %s not found", id.c_str()));
}
m_collection = collections.front();
m_contentMimeType = "";
QStringList collectionMimeTypes = m_collection.contentMimeTypes();
foreach (const QString &mimeType, m_mimeTypes) {
if (collectionMimeTypes.contains(mimeType)) {
m_contentMimeType = mimeType;
break;
}
}
if (m_contentMimeType.isEmpty()) {
throwError(SE_HERE, StringPrintf("Resource %s cannot store items of type(s) %s. It can only store %s.",
id.c_str(),
m_mimeTypes.join(",").toUtf8().constData(),
collectionMimeTypes.join(",").toUtf8().constData()));
}
}
void AkonadiSyncSource::listAllItems(SyncSourceRevisions::RevisionMap_t &revisions)
{
// copy all local IDs and the corresponding revision
ItemFetchJob *fetchJob = new ItemFetchJob(m_collection);
if (!fetchJob->exec()) {
throwError("listing items");
if (!GRunIsMain()) {
GRunInMain([this, &revisions] () { listAllItems(revisions); });
return;
}
BOOST_FOREACH (const Item &item, fetchJob->items()) {
// copy all local IDs and the corresponding revision
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
if (!fetchJob->exec()) {
throwError(SE_HERE, "listing items");
}
for (const Item &item: fetchJob->items()) {
// Filter out items which don't have the right type (for example, VTODO when
// syncing events)
if (item.mimeType() == m_subMime.c_str()) {
if (m_mimeTypes.contains(item.mimeType())) {
revisions[QByteArray::number(item.id()).constData()] =
QByteArray::number(item.revision()).constData();
}
@ -178,31 +245,37 @@ void AkonadiSyncSource::close()
TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::string &luid, const std::string &data, bool raw)
{
if (!GRunIsMain()) {
InsertItemResult result;
GRunInMain([this, &result, &luid, &data, raw] () { return insertItem(luid, data, raw); });
return result;
}
Item item;
if (luid.empty()) {
item.setMimeType(m_subMime.c_str());
item.setMimeType(m_mimeTypes.front());
item.setPayloadFromData(QByteArray(data.c_str()));
ItemCreateJob *createJob = new ItemCreateJob(item, m_collection);
std::unique_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
if (!createJob->exec()) {
throwError(string("storing new item ") + luid);
throwError(SE_HERE, string("storing new item ") + luid);
return InsertItemResult("", "", ITEM_OKAY);
}
item = createJob->item();
} else {
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
ItemFetchJob *fetchJob = new ItemFetchJob(Item(syncItemId));
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
if (!fetchJob->exec()) {
throwError(string("checking item ") + luid);
throwError(SE_HERE, string("checking item ") + luid);
}
item = fetchJob->items().first();
item.setPayloadFromData(QByteArray(data.c_str()));
ItemModifyJob *modifyJob = new ItemModifyJob(item);
std::unique_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(new ItemModifyJob(item)));
// TODO: SyncEvolution must pass the known revision that
// we are updating.
// TODO: check that the item has not been updated in the meantime
if (!modifyJob->exec()) {
throwError(string("updating item ") + luid);
throwError(SE_HERE, string("updating item ") + luid);
return InsertItemResult("", "", ITEM_OKAY);
}
item = modifyJob->item();
@ -218,31 +291,41 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
void AkonadiSyncSource::removeItem(const string &luid)
{
if (!GRunIsMain()) {
GRunInMain([this, &luid] () { removeItem(luid); });
return;
}
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
// Delete the item from our collection
// TODO: check that the revision is right (need revision from SyncEvolution)
ItemDeleteJob *deleteJob = new ItemDeleteJob(Item(syncItemId));
std::unique_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
if (!deleteJob->exec()) {
throwError(string("deleting item " ) + luid);
throwError(SE_HERE, string("deleting item " ) + luid);
}
}
void AkonadiSyncSource::readItem(const std::string &luid, std::string &data, bool raw)
{
if (!GRunIsMain()) {
GRunInMain([this, &luid, &data, raw] () { readItem(luid, data, raw); });
return;
}
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
ItemFetchJob *fetchJob = new ItemFetchJob(Item(syncItemId));
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
fetchJob->fetchScope().fetchFullPayload();
if (fetchJob->exec()) {
if (fetchJob->items().empty()) {
throwError(STATUS_NOT_FOUND, string("extracting item ") + luid);
throwError(SE_HERE, STATUS_NOT_FOUND, string("extracting item ") + luid);
}
QByteArray payload = fetchJob->items().first().payloadData();
data.assign(payload.constData(),
payload.size());
} else {
throwError(string("extracting item " ) + luid);
throwError(SE_HERE, string("extracting item " ) + luid);
}
}

View File

@ -72,7 +72,19 @@ private:
void start();
protected:
Akonadi::Collection m_collection;
const std::string m_subMime;
/**
* MIME types(s) of items, from submime constructor parameter.
* Only one format is supported, but it may have different aliases (for example,
* application/x-vnd.kde.notes == application/x-vnd.akonadi.note).
*/
QStringList m_mimeTypes;
/**
* The actual type to be used inside the collection. Set after opening
* the collection.
*/
QString m_contentMimeType;
};
class AkonadiContactSource : public AkonadiSyncSource
@ -128,7 +140,7 @@ class AkonadiTaskSource : public AkonadiSyncSource
{
public:
AkonadiTaskSource(const SyncSourceParams &params)
: AkonadiSyncSource("text/calendar", params)
: AkonadiSyncSource("application/x-vnd.akonadi.calendar.todo", params)
{
}
@ -143,8 +155,8 @@ private:
QString toSynthesis(QString data);
public:
AkonadiMemoSource(const SyncSourceParams &params)
: AkonadiSyncSource("text/x-vnd.akonadi.note", params)
AkonadiMemoSource(const SyncSourceParams &params) :
AkonadiSyncSource("text/x-vnd.akonadi.note,application/x-vnd.kde.notes", params)
{
}

View File

@ -10,11 +10,11 @@ AKONADIFOUND=yes
if ! test "$KDEPIM_CFLAGS"; then
KDEPIM_CFLAGS="-I`kde4-config --path include` -I`kde4-config --path include`/KDE"
if test "$QMAKE"; then
KDEPIM_CFLAGS="$KDEPIM_CFLAGS -I`$QMAKE -query QT_INSTALL_HEADERS`"
KDEPIM_CFLAGS="$KDEPIM_CFLAGS -I`$QMAKE -query QT_INSTALL_HEADERS` -I`$QMAKE -query QT_INSTALL_HEADERS`/QtCore"
fi
fi
if ! test "$KDEPIM_LIBS"; then
KDEPIM_LIBS="-L`kde4-config --install lib` -lakonadi-kde `pkg-config --libs QtDBus` -lQtCore -lkdeui -lkdecore"
KDEPIM_LIBS="-L`kde4-config --install lib` -lakonadi-kde `${PKG_CONFIG} --libs QtDBus` -lQtCore"
fi
AC_LANG_PUSH(C++)
old_CPPFLAGS="$CPPFLAGS"

File diff suppressed because it is too large Load Diff

View File

@ -134,6 +134,9 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
*/
static ItemID getItemID(ECalComponent *ecomp);
static ItemID getItemID(icalcomponent *icomp);
#ifdef HAVE_LIBECAL_2_0
static ItemID getItemID(ICalComponent *icomp);
#endif
/**
* Extract modification string from calendar item.
@ -141,6 +144,9 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
*/
static string getItemModTime(ECalComponent *ecomp);
static string getItemModTime(icalcomponent *icomp);
#ifdef HAVE_LIBECAL_2_0
static string getItemModTime(ICalComponent *icomp);
#endif
protected:
//
@ -170,13 +176,21 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
ECalClientSourceType sourceType() const {
return (ECalClientSourceType)m_type;
}
const char *sourceExtension() const {
virtual const char *sourceExtension() const {
return
m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? E_SOURCE_EXTENSION_CALENDAR :
m_type == EVOLUTION_CAL_SOURCE_TYPE_TASKS ? E_SOURCE_EXTENSION_TASK_LIST :
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? E_SOURCE_EXTENSION_MEMO_LIST :
"";
}
virtual ESourceCXX refSystemDB() const {
ESource *(*ref)(ESourceRegistry *) =
m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? e_source_registry_ref_builtin_calendar :
m_type == EVOLUTION_CAL_SOURCE_TYPE_TASKS ? e_source_registry_ref_builtin_task_list :
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? e_source_registry_ref_builtin_memo_list :
nullptr;
return ESourceCXX(ref ? ref(EDSRegistryLoader::getESourceRegistry()) : nullptr, TRANSFER_REF);
}
#else
ECalSourceType sourceType() const {
return (ECalSourceType)m_type;
@ -188,18 +202,30 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
*
* caller has to free result
*/
#ifdef HAVE_LIBECAL_2_0
ICalComponent *retrieveItem(const ItemID &id);
#else
icalcomponent *retrieveItem(const ItemID &id);
#endif
/** retrieve the item with the given luid as VCALENDAR string - may throw exception */
string retrieveItemAsString(const ItemID &id);
/** returns the type which the ical library uses for our components */
#ifdef HAVE_LIBECAL_2_0
ICalComponentKind getCompType() {
return m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? I_CAL_VEVENT_COMPONENT :
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? I_CAL_VJOURNAL_COMPONENT :
I_CAL_VTODO_COMPONENT;
}
#else
icalcomponent_kind getCompType() {
return m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? ICAL_VEVENT_COMPONENT :
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? ICAL_VJOURNAL_COMPONENT :
ICAL_VTODO_COMPONENT;
}
#endif
#ifndef USE_EDS_CLIENT
/** ECalAuthFunc which calls the authenticate() methods */
@ -231,6 +257,9 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
* Convert to string in canonical representation.
*/
static string icalTime2Str(const struct icaltimetype &tt);
#ifdef HAVE_LIBECAL_2_0
static string icalTime2Str(const ICalTime *tt);
#endif
/**
* A set of all existing objects. Initialized in the last call to
@ -255,7 +284,11 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
* will destroy the smart pointer, which then calls
* icalcomponent_free().
*/
typedef list< boost::shared_ptr< eptr<icalcomponent> > > ICalComps_t;
#ifdef HAVE_LIBECAL_2_0
typedef list< std::shared_ptr< eptr<ICalComponent> > > ICalComps_t;
#else
typedef list< std::shared_ptr< eptr<icalcomponent> > > ICalComps_t;
#endif
/**
* Utility function which extracts all icalcomponents with

View File

@ -27,14 +27,15 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
static std::unique_ptr<SyncSource> createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
bool isMe;
bool enabled;
#ifdef ENABLE_ECAL
const bool enabled = true;
#endif
EDSAbiWrapperInit();
enabled = EDSAbiHaveEcal && EDSAbiHaveEdataserver;
isMe = sourceType.m_backend == "Evolution Task List";
if (isMe || sourceType.m_backend == "todo") {
@ -44,9 +45,9 @@ static SyncSource *createSource(const SyncSourceParams &params)
sourceType.m_format == "text/x-vcalendar") {
return
#ifdef ENABLE_ECAL
enabled ? new EvolutionCalendarSource(EVOLUTION_CAL_SOURCE_TYPE_TASKS, params) :
enabled ? std::make_unique<EvolutionCalendarSource>(EVOLUTION_CAL_SOURCE_TYPE_TASKS, params) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
@ -55,17 +56,17 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (sourceType.m_format == "" || sourceType.m_format == "text/plain") {
return
#ifdef ENABLE_ECAL
enabled ? new EvolutionMemoSource(params) :
enabled ? std::make_unique<EvolutionMemoSource>(params) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
} else if (sourceType.m_format == "text/calendar") {
return
#ifdef ENABLE_ECAL
enabled ? new EvolutionCalendarSource(EVOLUTION_CAL_SOURCE_TYPE_MEMOS, params) :
enabled ? std::make_unique<EvolutionCalendarSource>(EVOLUTION_CAL_SOURCE_TYPE_MEMOS, params) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
} else {
return NULL;
return nullptr;
}
}
@ -77,15 +78,15 @@ static SyncSource *createSource(const SyncSourceParams &params)
sourceType.m_format == "text/x-vcalendar") {
return
#ifdef ENABLE_ECAL
enabled ? new EvolutionCalendarSource(EVOLUTION_CAL_SOURCE_TYPE_EVENTS, params) :
enabled ? std::make_unique<EvolutionCalendarSource>(EVOLUTION_CAL_SOURCE_TYPE_EVENTS, params) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
} else {
return NULL;
return nullptr;
}
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("Evolution Calendar/Task List/Memos",
@ -125,44 +126,44 @@ class EvolutionCalendarTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE_END();
protected:
static string addItem(boost::shared_ptr<TestingSyncSource> source,
static string addItem(TestingSyncSource &source,
string &data) {
SyncSourceRaw::InsertItemResult res = source->insertItemRaw("", data);
SyncSourceRaw::InsertItemResult res = source.insertItemRaw("", data);
return res.m_luid;
}
void testInstantiate() {
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "calendar", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-calendar", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "Evolution Calendar:text/calendar", true));
std::unique_ptr<TestingSyncSource> source;
source = SyncSource::createTestingSource("calendar", "calendar", true);
source = SyncSource::createTestingSource("calendar", "evolution-calendar", true);
source = SyncSource::createTestingSource("calendar", "Evolution Calendar:text/calendar", true);
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "tasks", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-tasks", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "Evolution Tasks", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "Evolution Task List:text/calendar", true));
source = SyncSource::createTestingSource("calendar", "tasks", true);
source = SyncSource::createTestingSource("calendar", "evolution-tasks", true);
source = SyncSource::createTestingSource("calendar", "Evolution Tasks", true);
source = SyncSource::createTestingSource("calendar", "Evolution Task List:text/calendar", true);
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "memos", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-memos", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "Evolution Memos:text/plain", true));
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "Evolution Memos:text/calendar", true));
source = SyncSource::createTestingSource("calendar", "memos", true);
source = SyncSource::createTestingSource("calendar", "evolution-memos", true);
source = SyncSource::createTestingSource("calendar", "Evolution Memos:text/plain", true);
source = SyncSource::createTestingSource("calendar", "Evolution Memos:text/calendar", true);
}
void testOpenDefaultCalendar() {
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-calendar", true, NULL));
std::unique_ptr<TestingSyncSource> source;
source = SyncSource::createTestingSource("calendar", "evolution-calendar", true, nullptr);
CPPUNIT_ASSERT_NO_THROW(source->open());
}
void testOpenDefaultTodo() {
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-tasks", true, NULL));
std::unique_ptr<TestingSyncSource> source;
source = SyncSource::createTestingSource("calendar", "evolution-tasks", true, nullptr);
CPPUNIT_ASSERT_NO_THROW(source->open());
}
void testOpenDefaultMemo() {
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("calendar", "evolution-memos", true, NULL));
std::unique_ptr<TestingSyncSource> source;
source = SyncSource::createTestingSource("calendar", "evolution-memos", true, nullptr);
CPPUNIT_ASSERT_NO_THROW(source->open());
}
@ -172,8 +173,8 @@ protected:
prefix = "SyncEvolution_Test_";
}
boost::shared_ptr<TestingSyncSource> source;
source.reset((TestingSyncSource *)SyncSource::createTestingSource("eds_event", "evolution-calendar", true, prefix));
std::unique_ptr<TestingSyncSource> source;
source = SyncSource::createTestingSource("eds_event", "evolution-calendar", true, prefix);
CPPUNIT_ASSERT_NO_THROW(source->open());
string newyork =
@ -213,7 +214,7 @@ protected:
"END:VCALENDAR\n";
string luid;
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, newyork));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, newyork));
string newyork_suffix = newyork;
boost::replace_first(newyork_suffix,
@ -222,7 +223,7 @@ protected:
boost::replace_all(newyork_suffix,
"TZID:America/New_York",
"TZID://FOOBAR/America/New_York-SUFFIX");
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, newyork_suffix));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, newyork_suffix));
string notimezone =
@ -243,7 +244,7 @@ protected:
"LAST-MODIFIED:20060416T205301Z\n"
"END:VEVENT\n"
"END:VCALENDAR\n";
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, notimezone));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, notimezone));
// fake VTIMEZONE where daylight saving starts on first Sunday in March
string fake_march =
@ -280,7 +281,7 @@ protected:
"LAST-MODIFIED:20060416T205301Z\n"
"END:VEVENT\n"
"END:VCALENDAR\n";
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, fake_march));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, fake_march));
string fake_may = fake_march;
boost::replace_first(fake_may,
@ -295,10 +296,10 @@ protected:
boost::replace_first(fake_may,
"TZNAME:EST MARCH",
"TZNAME:EST MAY");
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, fake_may));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, fake_may));
// insert again, shouldn't re-add timezone
CPPUNIT_ASSERT_NO_THROW(luid = addItem(source, fake_may));
CPPUNIT_ASSERT_NO_THROW(luid = addItem(*source, fake_may));
}
};

File diff suppressed because it is too large Load Diff

View File

@ -38,9 +38,12 @@
SE_GOBJECT_TYPE(EBookClient)
SE_GOBJECT_TYPE(EBookClientView)
#endif
SE_GOBJECT_TYPE(EContact)
SE_BEGIN_CXX
class ContactCache;
/**
* Implements access to Evolution address books.
*/
@ -51,7 +54,7 @@ class EvolutionContactSource : public EvolutionSyncSource,
public:
EvolutionContactSource(const SyncSourceParams &params,
EVCardFormat vcardFormat = EVC_FORMAT_VCARD_30);
virtual ~EvolutionContactSource() { close(); }
virtual ~EvolutionContactSource();
//
// implementation of SyncSource
@ -81,11 +84,29 @@ class EvolutionContactSource : public EvolutionSyncSource,
{
EvolutionSyncSource::getSynthesisInfo(info, fragments);
info.m_profile = "\"vCard\", 2";
info.m_native = "vCard30";
info.m_native = "vCard30EDS";
// Replace normal vCard30 and vCard21 types with the
// EDS flavors which apply EDS specific transformations *before*
// letting the engine process the incoming item. This ensures
// that during a slow sync, modified (!) incoming item and
// DB item really match. Otherwise the engine compares unmodified
// incoming item and modified DB item, finding a mismatch caused
// by the transformations, and writes an item which ends up being
// identical to the one which is in the DB.
boost::replace_all(info.m_datatypes, "vCard30", "vCard30EDS");
boost::replace_all(info.m_datatypes, "vCard21", "vCard21EDS");
// Redundant when the same transformations are already applied to
// incoming items. But disabling it does not improve performance much,
// so keep it enabled just to be on the safe side.
info.m_beforeWriteScript = "$VCARD_BEFOREWRITE_SCRIPT_EVOLUTION;";
info.m_afterReadScript = "$VCARD_AFTERREAD_SCRIPT_EVOLUTION;";
}
#ifdef USE_EDS_CLIENT
virtual const char *sourceExtension() const { return E_SOURCE_EXTENSION_ADDRESS_BOOK; }
virtual ESourceCXX refSystemDB() const { return ESourceCXX(e_source_registry_ref_builtin_address_book(EDSRegistryLoader::getESourceRegistry()), TRANSFER_REF); }
#endif
private:
/** extract REV string for contact, throw error if not found */
std::string getRevision(const std::string &uid);
@ -93,6 +114,73 @@ class EvolutionContactSource : public EvolutionSyncSource,
/** valid after open(): the address book that this source references */
#ifdef USE_EDS_CLIENT
EBookClientCXX m_addressbook;
enum AccessMode {
SYNCHRONOUS,
BATCHED,
DEFAULT
} m_accessMode;
InitState<int> m_asyncOpCounter;
enum AsyncStatus {
MODIFYING, /**< insert or update request sent */
REVISION, /**< asked for revision */
DONE /**< finished successfully or with failure, depending on m_gerror */
};
struct Pending {
std::string m_name;
EContactCXX m_contact;
std::string m_uid;
std::string m_revision;
AsyncStatus m_status;
GErrorCXX m_gerror;
Pending() : m_status(MODIFYING) {}
};
typedef std::list< std::shared_ptr<Pending> >PendingContainer_t;
/**
* Batched "contact add/update" operations.
* Delete is not batched because we need per-item status
* information - see removeItem().
*/
PendingContainer_t m_batchedAdd;
PendingContainer_t m_batchedUpdate;
InitState<int> m_numRunningOperations;
InsertItemResult checkBatchedInsert(const std::shared_ptr<Pending> &pending);
virtual void flushItemChanges();
virtual void finishItemChanges();
// Read-ahead of item data.
std::shared_ptr<ContactCache> m_contactCache, m_contactCacheNext;
int m_cacheMisses, m_cacheStalls;
int m_contactReads; /**< number of readItemAsKey() calls */
int m_contactsFromDB; /**< number of contacts requested from DB (including ones not found) */
int m_contactQueries; /**< total number of e_book_client_get_contacts() calls */
ReadAheadOrder m_readAheadOrder;
ReadAheadItems m_nextLUIDs;
void checkCacheForError(std::shared_ptr<ContactCache> &cache);
void invalidateCachedContact(const std::string &luid);
void invalidateCachedContact(std::shared_ptr<ContactCache> &cache, const std::string &luid);
bool getContact(const string &luid, EContact **contact, GErrorCXX &gerror);
bool getContactFromCache(const string &luid, EContact **contact, GErrorCXX &gerror);
enum ReadingMode
{
START, /**< luid is needed, must be read */
CONTINUE /**< luid is from old request, find next ones */
};
std::shared_ptr<ContactCache> startReading(const std::string &luid, ReadingMode mode);
void logCacheStats(Logger::Level level);
// Use the information provided to us to implement read-ahead efficiently.
virtual void setReadAheadOrder(ReadAheadOrder order,
const ReadAheadItems &luids);
virtual void getReadAheadOrder(ReadAheadOrder &order,
ReadAheadItems &luids);
#else
eptr<EBook, GObject> m_addressbook;
#endif

View File

@ -24,32 +24,33 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
static std::unique_ptr<SyncSource> createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
bool isMe = sourceType.m_backend == "Evolution Address Book";
bool maybeMe = sourceType.m_backend == "addressbook";
bool enabled;
#ifdef ENABLE_EBOOK
const bool enabled = true;
#endif
EDSAbiWrapperInit();
enabled = EDSAbiHaveEbook && EDSAbiHaveEdataserver;
if (isMe || maybeMe) {
if (sourceType.m_format == "text/x-vcard") {
return
#ifdef ENABLE_EBOOK
enabled ? new EvolutionContactSource(params, EVC_FORMAT_VCARD_21) :
enabled ? std::make_unique<EvolutionContactSource>(params, EVC_FORMAT_VCARD_21) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
} else if (sourceType.m_format == "" || sourceType.m_format == "text/vcard") {
return
#ifdef ENABLE_EBOOK
enabled ? new EvolutionContactSource(params, EVC_FORMAT_VCARD_30) :
enabled ? std::make_unique<EvolutionContactSource>(params, EVC_FORMAT_VCARD_30) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("Evolution Address Book",
@ -78,13 +79,13 @@ class EvolutionContactTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("addressbook", "addressbook", true));
source.reset(SyncSource::createTestingSource("addressbook", "contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "evolution-contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "Evolution Contacts", true));
source.reset(SyncSource::createTestingSource("addressbook", "Evolution Address Book:text/x-vcard", true));
source.reset(SyncSource::createTestingSource("addressbook", "Evolution Address Book:text/vcard", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("addressbook", "addressbook", true);
source = SyncSource::createTestingSource("addressbook", "contacts", true);
source = SyncSource::createTestingSource("addressbook", "evolution-contacts", true);
source = SyncSource::createTestingSource("addressbook", "Evolution Contacts", true);
source = SyncSource::createTestingSource("addressbook", "Evolution Address Book:text/x-vcard", true);
source = SyncSource::createTestingSource("addressbook", "Evolution Address Book:text/vcard", true);
}
/**
@ -94,47 +95,8 @@ protected:
*/
void testImport() {
// this only tests that we can instantiate something under the type "addressbook";
// it might not be an EvolutionContactSource
boost::shared_ptr<EvolutionContactSource> source21(dynamic_cast<EvolutionContactSource *>(SyncSource::createTestingSource("evolutioncontactsource21", "evolution-contacts:text/x-vcard", true)));
boost::shared_ptr<EvolutionContactSource> source30(dynamic_cast<EvolutionContactSource *>(SyncSource::createTestingSource("evolutioncontactsource30", "Evolution Address Book:text/vcard", true)));
string parsed;
#if 0
// TODO: enable testing of incoming items again. Right now preparse() doesn't
// do anything and needs to be replaced with Synthesis mechanisms.
// SF bug 1796086: sync with EGW: lost or messed up telephones
parsed = "BEGIN:VCARD\r\nVERSION:3.0\r\nTEL;CELL:cell\r\nEND:VCARD\r\n";
CPPUNIT_ASSERT_EQUAL(parsed,
preparse(*source21,
"BEGIN:VCARD\nVERSION:2.1\nTEL;CELL:cell\nEND:VCARD\n",
"text/x-vcard"));
parsed = "BEGIN:VCARD\r\nVERSION:3.0\r\nTEL;TYPE=CAR:car\r\nEND:VCARD\r\n";
CPPUNIT_ASSERT_EQUAL(parsed,
preparse(*source21,
"BEGIN:VCARD\nVERSION:2.1\nTEL;TYPE=CAR:car\nEND:VCARD\n",
"text/x-vcard"));
parsed = "BEGIN:VCARD\r\nVERSION:3.0\r\nTEL;TYPE=HOME:home\r\nEND:VCARD\r\n";
CPPUNIT_ASSERT_EQUAL(parsed,
preparse(*source21,
"BEGIN:VCARD\nVERSION:2.1\nTEL:home\nEND:VCARD\n",
"text/x-vcard"));
// TYPE=PARCEL not supported by Evolution, used to represent Evolutions TYPE=OTHER
parsed = "BEGIN:VCARD\r\nVERSION:3.0\r\nTEL;TYPE=OTHER:other\r\nEND:VCARD\r\n";
CPPUNIT_ASSERT_EQUAL(parsed,
preparse(*source21,
"BEGIN:VCARD\nVERSION:2.1\nTEL;TYPE=PARCEL:other\nEND:VCARD\n",
"text/x-vcard"));
parsed = "BEGIN:VCARD\r\nVERSION:3.0\r\nTEL;TYPE=HOME;TYPE=VOICE:cell\r\nEND:VCARD\r\n";
CPPUNIT_ASSERT_EQUAL(parsed,
preparse(*source21,
"BEGIN:VCARD\nVERSION:2.1\nTEL;TYPE=HOME,VOICE:cell\nEND:VCARD\n",
"text/x-vcard"));
#endif
auto source21 = SyncSource::createTestingSource("evolutioncontactsource21", "evolution-contacts:text/x-vcard", true);
auto source30 = SyncSource::createTestingSource("evolutioncontactsource30", "Evolution Address Book:text/vcard", true);
}
};

View File

@ -1,255 +0,0 @@
/*
* Copyright (C) 2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
* Copyright (C) 2009 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) version 3.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <memory>
using namespace std;
#include "config.h"
#ifdef ENABLE_ECAL
#include "EvolutionMemoSource.h"
#include <syncevo/Logging.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
void EvolutionMemoSource::readItem(const string &luid, std::string &item, bool raw)
{
if (raw) {
EvolutionCalendarSource::readItem(luid, item, false);
return;
}
ItemID id(luid);
eptr<icalcomponent> comp(retrieveItem(id));
icalcomponent *cal = icalcomponent_get_first_component(comp, ICAL_VCALENDAR_COMPONENT);
if (!cal) {
cal = comp;
}
icalcomponent *journal = icalcomponent_get_first_component(cal, ICAL_VJOURNAL_COMPONENT);
if (!journal) {
journal = comp;
}
icalproperty *summaryprop = icalcomponent_get_first_property(journal, ICAL_SUMMARY_PROPERTY);
string summary;
if (summaryprop) {
const char *summaryptr = icalproperty_get_summary(summaryprop);
if (summaryptr) {
summary = summaryptr;
}
}
icalproperty *desc = icalcomponent_get_first_property(journal, ICAL_DESCRIPTION_PROPERTY);
if (desc) {
const char *text = icalproperty_get_description(desc);
if (text) {
size_t len = strlen(text);
bool insertSummary = false;
const char *eol;
// Check the first line: if it is the same as the summary,
// then ignore the summary. Otherwise include the summary
// as first line in the text body. At a receiving Evolution
// the summary will remain part of the text for compatibility
// with other clients which might use the first line as part
// of the normal text.
eol = strchr(text, '\n');
if (!eol) {
eol = text + len;
}
if (summary.size() &&
summary.compare(0, summary.size(), text, eol - text)) {
insertSummary = true;
}
// Replace all \n with \r\n: in the worst case the text
// becomes twice as long. Also make room for summary.
eptr<char> dostext((char *)malloc(len * 2 + 1 +
(insertSummary ? summary.size() + 2 : 0)));
const char *from = text;
char *to = dostext;
if (insertSummary) {
memcpy(to, summary.c_str(), summary.size());
memcpy(to + summary.size(), "\r\n", 2);
to += summary.size() + 2;
}
eol = strchr(from, '\n');
while (eol) {
size_t linelen = eol - from;
memcpy(to, from, linelen);
to += linelen;
from += linelen;
to[0] = '\r';
to[1] = '\n';
to += 2;
from++;
eol = strchr(from, '\n');
}
memcpy(to, from, strlen(from) + 1);
item = dostext.get();
}
}
if (item.empty()) {
// no description, use summary
item = summary;
}
}
EvolutionCalendarSource::InsertItemResult EvolutionMemoSource::insertItem(const string &luid, const std::string &item, bool raw)
{
if (raw) {
return EvolutionCalendarSource::insertItem(luid, item, false);
}
bool update = !luid.empty();
InsertItemResultState state = ITEM_OKAY;
string newluid = luid;
string modTime;
eptr<char> text;
text.set((char *)malloc(item.size() + 1), "copy of item");
memcpy(text, item.c_str(), item.size());
text.get()[item.size()] = 0;
// replace all \r\n with \n
char *from = text, *to = text;
const char *eol = strstr(from, "\r\n");
while (eol) {
size_t linelen = eol - from;
if (to != from) {
memmove(to, from, linelen);
}
to += linelen;
from += linelen;
*to = '\n';
to++;
from += 2;
eol = strstr(from, "\r\n");
}
if (to != from) {
memmove(to, from, strlen(from) + 1);
}
eol = strchr(text, '\n');
string summary;
if (eol) {
summary.insert(0, (char *)text, eol - (char *)text);
} else {
summary = (char *)text;
}
eptr<icalcomponent> subcomp(icalcomponent_vanew(
ICAL_VJOURNAL_COMPONENT,
icalproperty_new_summary(summary.c_str()),
icalproperty_new_description(text),
0));
if( !subcomp ) {
throwError(string("failure creating vjournal " ) + summary);
}
GErrorCXX gerror;
if (!update) {
const char *uid = NULL;
#ifdef USE_EDS_CLIENT
// UID only needs to be freed in ECalClient API
PlainGStr uidOwner;
#endif
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_create_object_sync(m_calendar, subcomp, (gchar **)&uid, NULL, gerror)
#else
!e_cal_create_object(m_calendar, subcomp, (gchar **)&uid, gerror)
#endif
) {
if (
#ifdef USE_EDS_CLIENT
gerror->domain == E_CAL_CLIENT_ERROR &&
gerror->code == E_CAL_CLIENT_ERROR_OBJECT_ID_ALREADY_EXISTS
#else
gerror->domain == E_CALENDAR_ERROR &&
gerror->code == E_CALENDAR_STATUS_OBJECT_ID_ALREADY_EXISTS
#endif
) {
// Deal with error due to adding already existing item.
// Should never happen for plain text journal entries because
// they have no embedded ID, but who knows...
state = ITEM_NEEDS_MERGE;
uid = icalcomponent_get_uid(subcomp);
if (!uid) {
throwError("storing new memo item, no UID set", gerror);
}
} else {
throwError("storing new memo item", gerror);
}
}
#ifdef USE_EDS_CLIENT
else {
uidOwner = PlainGStr((gchar *)uid);
}
#endif
ItemID id(uid, "");
newluid = id.getLUID();
if (state != ITEM_NEEDS_MERGE) {
modTime = getItemModTime(id);
}
} else {
ItemID id(newluid);
// ensure that the component has the right UID
if (update && !id.m_uid.empty()) {
icalcomponent_set_uid(subcomp, id.m_uid.c_str());
}
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, subcomp, CALOBJ_MOD_ALL,
NULL, gerror)
#else
!e_cal_modify_object(m_calendar, subcomp, CALOBJ_MOD_ALL, gerror)
#endif
) {
throwError(string("updating memo item ") + luid, gerror);
}
ItemID newid = getItemID(subcomp);
newluid = newid.getLUID();
modTime = getItemModTime(newid);
}
return InsertItemResult(newluid, modTime, state);
}
bool EvolutionMemoSource::isNativeType(const char *type)
{
return type &&
(!strcasecmp(type, "raw") ||
!strcasecmp(type, "text/x-vcalendar") ||
!strcasecmp(type, "text/calendar"));
}
SE_END_CXX
#endif /* ENABLE_ECAL */

View File

@ -43,13 +43,8 @@ class EvolutionMemoSource : public EvolutionCalendarSource
//
// implementation of SyncSource
//
virtual InsertItemResult insertItem(const string &uid, const std::string &item, bool raw);
void readItem(const std::string &luid, std::string &item, bool raw);
virtual std::string getMimeType() const { return "text/plain"; }
virtual std::string getMimeVersion() const { return "1.0"; }
private:
bool isNativeType(const char *type);
virtual std::string getMimeType() const { return "text/calendar+plain"; }
virtual std::string getMimeVersion() const { return "2.0"; }
};
#endif // ENABLE_ECAL

View File

@ -20,7 +20,13 @@
#include "EvolutionSyncSource.h"
#include <syncevo/SmartPtr.h>
#include <syncevo/SyncContext.h>
#include <syncevo/Exception.h>
#include <syncevo/GLibSupport.h>
#ifdef USE_EDS_CLIENT
#include <syncevo/GValueSupport.h>
SE_GLIB_TYPE(GKeyFile, g_key_file)
#endif
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -33,105 +39,252 @@ void EvolutionSyncSource::getDatabasesFromRegistry(SyncSource::Databases &result
const char *extension,
ESource *(*refDef)(ESourceRegistry *))
{
GErrorCXX gerror;
ESourceRegistryCXX registry = getSourceRegistry();
if (!registry) {
throwError("unable to access databases registry", gerror);
}
ESourceRegistryCXX registry = EDSRegistryLoader::getESourceRegistry();
ESourceListCXX sources(e_source_registry_list_sources(registry, extension));
ESourceCXX def(refDef ? refDef(registry) : NULL,
false);
BOOST_FOREACH (ESource *source, sources) {
ESourceCXX def(refDef ? refDef(registry) : nullptr,
TRANSFER_REF);
for (ESource *source: sources) {
result.push_back(Database(e_source_get_display_name(source),
e_source_get_uid(source),
e_source_equal(def, source)));
}
}
ESourceRegistryCXX EvolutionSyncSource::getSourceRegistry()
{
// Keep the instance forever. This is a bit more efficient. But
// primarily it avoids a file and memory descriptor leak in EDS
// 3.5.x when the registry is created and freed over and over
// again.
static ESourceRegistryCXX registry;
if (!registry) {
GErrorCXX gerror;
registry = ESourceRegistryCXX::steal(e_source_registry_new_sync(NULL, gerror));
if (!registry) {
throwError("unable to access databases registry", gerror);
}
}
return registry;
}
static void handleErrorCB(EClient */*client*/, const gchar *error_msg, gpointer user_data)
{
EvolutionSyncSource *that = static_cast<EvolutionSyncSource *>(user_data);
SE_LOG_ERROR(that, NULL, "%s", error_msg);
SE_LOG_ERROR(that->getDisplayName(), "%s", error_msg);
}
EClientCXX EvolutionSyncSource::openESource(const char *extension,
ESource *(*refBuiltin)(ESourceRegistry *),
const boost::function<EClient *(ESource *, GError **gerror)> &newClient)
const std::function<EClient *(ESource *, GError **gerror)> &newClient)
{
EClientCXX client;
GErrorCXX gerror;
ESourceRegistryCXX registry = getSourceRegistry();
if (!registry) {
throwError("unable to access databases registry", gerror);
}
ESourceRegistryCXX registry = EDSRegistryLoader::getESourceRegistry();
ESourceListCXX sources(e_source_registry_list_sources(registry, extension));
string id = getDatabaseID();
ESource *source = findSource(sources, id);
bool created = false;
if (!source) {
if (refBuiltin && (id.empty() || id == "<<system>>")) {
ESourceCXX builtin(refBuiltin(registry), false);
ESourceCXX builtin(refBuiltin(registry), TRANSFER_REF);
client = EClientCXX::steal(newClient(builtin, gerror));
// } else if (!id.compare(0, 7, "file://")) {
// TODO: create source
// m_calendar = ECalClientCXX::steal(e_cal_client_new_from_uri(id.c_str(), sourceType(), gerror));
} else {
throwError(string("database not found: '") + id + "'");
throwError(SE_HERE, string("database not found: '") + id + "'");
}
created = true;
} else {
client = EClientCXX::steal(newClient(source, gerror));
}
if (!client) {
throwError("accessing database", gerror);
throwError(SE_HERE, "accessing database", gerror);
}
// Listen for errors
g_signal_connect (client, "backend-error", G_CALLBACK(handleErrorCB), this);
g_signal_connect_after(client,
"backend-died",
G_CALLBACK(SyncContext::fatalError),
G_CALLBACK(Exception::fatalError),
(void *)"Evolution Data Server has died unexpectedly.");
// Always allow EDS to create the database. "only-if-exists =
// true" does not make sense.
if (!e_client_open_sync(client, false, NULL, gerror)) {
if (created) {
// Opening newly created address books often failed in old
// EDS releases - try again.
gerror.clear();
sleep(5);
if (!e_client_open_sync(client, false, NULL, gerror)) {
throwError("opening database", gerror);
int retries = 0;
while (true) {
// Always allow EDS to create the database. "only-if-exists =
// true" does not make sense.
if (!e_client_open_sync(client, false, nullptr, gerror)) {
if (retries < 5) {
// EDS 3.18 and 3.26 have various race conditions during startup.
// Try a few times.
// https://bugzilla.gnome.org/show_bug.cgi?id=791306
SE_LOG_DEBUG(NULL, "Opening EDS source: ignoring error, trying again: %s", gerror->message);
gerror.clear();
sleep(1);
retries++;
} else {
throwError(SE_HERE, "opening database", gerror);
}
} else {
throwError("opening database", gerror);
// Success!
break;
}
}
// record result for SyncSource::getDatabase()
source = e_client_get_source(client);
if (source) {
Database database(e_source_get_display_name(source),
e_source_get_uid(source));
setDatabase(database);
}
return client;
}
SyncSource::Database EvolutionSyncSource::createDatabase(const Database &database)
{
// We'll need this later. Create it before doing any real work.
ESourceRegistryCXX registry = EDSRegistryLoader::getESourceRegistry();
// Clone the system DB. This allows the distro to change the
// configuration (backend, extensions (= in particular
// the contacts DB summary fields)) without having to
// modify SyncEvolution.
ESourceCXX systemSource = refSystemDB();
gsize len;
PlainGStr ini(e_source_to_string(systemSource, &len));
// Modify the entries in the key file directly. We can't
// instantiate an ESource (no API for it), copying the values from
// the key file into a fresh ESource is difficult (would have to
// reimplement EDS internal encoding/decoding), and copying from
// systemSource is hard (don't know which extensions it has,
// cannot instantiate extensions of unknown types, because
// e_source_get_extension() only works for types that were
// created).
static const char *mainSection = "Data Source";
GKeyFileCXX keyfile(g_key_file_new(), TRANSFER_REF);
GErrorCXX gerror;
if (!g_key_file_load_from_data(keyfile, ini, len, G_KEY_FILE_NONE, gerror)) {
gerror.throwError(SE_HERE, "parsing ESource .ini data");
}
PlainGStrArray keys(g_key_file_get_keys(keyfile, mainSection, nullptr, gerror));
if (!keys) {
gerror.throwError(SE_HERE, "listing keys in main section");
}
for (int i = 0; keys.at(i); i++) {
if (boost::starts_with(keys.at(i), "DisplayName[")) {
if (!g_key_file_remove_key(keyfile, mainSection, keys.at(i), gerror)) {
gerror.throwError(SE_HERE, "remove key");
}
}
}
g_key_file_set_string(keyfile, mainSection, "DisplayName", database.m_name.c_str());
g_key_file_set_boolean(keyfile, mainSection, "Enabled", true);
ini = g_key_file_to_data(keyfile, &len, nullptr);
const char *configDir = g_get_user_config_dir();
int fd;
std::string filename;
std::string uid;
// Create sources dir. It might have been removed (for example, while
// testing) without having been recreated by evolution-source-registry.
std::string sourceDir = StringPrintf("%s/evolution/sources",
configDir);
mkdir_p(sourceDir);
// Create unique ID if necessary.
while (true) {
uid = database.m_uri.empty() ?
UUID() :
database.m_uri;
filename = StringPrintf("%s/%s.source", sourceDir.c_str(), uid.c_str());
fd = ::open(filename.c_str(),
O_WRONLY|O_CREAT|O_EXCL,
S_IRUSR|S_IWUSR);
if (fd >= 0) {
break;
}
if (errno == EEXIST) {
if (!database.m_uri.empty()) {
SE_THROW(StringPrintf("ESource UUID %s already in use", database.m_uri.c_str()));
} else {
// try again with new random UUID
}
} else {
SE_THROW(StringPrintf("creating %s failed: %s", filename.c_str(), strerror(errno)));
}
}
ssize_t written = write(fd, ini.get(), len);
int res = ::close(fd);
if (written != (ssize_t)len || res) {
SE_THROW(StringPrintf("writing to %s failed: %s", filename.c_str(), strerror(errno)));
}
// We need to wait until ESourceRegistry notices the new file.
SE_LOG_DEBUG(getDisplayName(), "waiting for ESourceRegistry to notice new ESource %s", uid.c_str());
while (!ESourceCXX(e_source_registry_ref_source(registry, uid.c_str()), TRANSFER_REF)) {
// This will block forever if called from the non-main-thread.
// Don't do that...
g_main_context_iteration(nullptr, true);
}
SE_LOG_DEBUG(getDisplayName(), "ESourceRegistry has new ESource %s", uid.c_str());
// Try triggering that by attempting to create an ESource with the same
// UUID. Does not work! evolution-source-registry simply overwrites the
// file that we created earlier.
// ESourceCXX source(e_source_new_with_uid(uid.c_str(),
// nullptr, gerror),
// TRANSFER_REF);
// e_source_set_display_name(source, "syncevolution-fake");
// e_source_set_parent(source, "local-stub");
// ESourceListCXX sources;
// sources.push_back(source.ref()); // ESourceListCXX unrefs sources it points to
// if (!e_source_registry_create_sources_sync(registry,
// sources,
// nullptr,
// gerror)) {
// gerror.throwError(SE_HERE, StringPrintf("creating EDS database of type %s with name '%s'%s%s",
// sourceExtension(),
// database.m_name.c_str(),
// database.m_uri.empty() ? "" : " and URI ",
// database.m_uri.c_str()));
// } else {
// SE_THROW("creating syncevolution-fake ESource succeeded although it should have failed");
// }
return Database(database.m_name, uid);
}
void EvolutionSyncSource::deleteDatabase(const std::string &uri, RemoveData removeData)
{
ESourceRegistryCXX registry = EDSRegistryLoader::getESourceRegistry();
ESourceCXX source(e_source_registry_ref_source(registry, uri.c_str()), TRANSFER_REF);
if (!source) {
throwError(SE_HERE, StringPrintf("EDS database with URI '%s' cannot be deleted, does not exist",
uri.c_str()));
}
GErrorCXX gerror;
if (!e_source_remove_sync(source, nullptr, gerror)) {
throwError(SE_HERE, StringPrintf("deleting EDS database with URI '%s'", uri.c_str()),
gerror);
}
if (removeData == REMOVE_DATA_FORCE) {
// Don't wait for evolution-source-registry cache-reaper to
// run, instead remove files ourselves. The reaper runs only
// once per day and also only moves the data into a trash
// folder, were it would linger until finally removed after 30
// days.
//
// This is equivalent to "rm -rf $XDG_DATA_HOME/evolution/*/<uuid>".
std::string basedir = StringPrintf("%s/evolution", g_get_user_data_dir());
if (isDir(basedir)) {
for (const std::string &kind: ReadDir(basedir)) {
std::string subdir = basedir + "/" + kind;
if (isDir(subdir)) {
for (const std::string &source: ReadDir(subdir)) {
// We assume that the UUID of the database
// consists only of characters which can be
// used in the directory name, i.e., no
// special encoding of the directory name.
if (source == uri) {
rm_r(subdir + "/" + source);
// Keep searching, just in case, although
// there should only be one.
}
}
}
}
}
}
}
#endif // USE_EDS_CLIENT
ESource *EvolutionSyncSource::findSource(const ESourceListCXX &list, const string &id )
@ -141,7 +294,7 @@ ESource *EvolutionSyncSource::findSource(const ESourceListCXX &list, const strin
finalID = id;
} else {
// Nothing selected specifically, use the one marked as default.
BOOST_FOREACH(const Database &db, getDatabases()) {
for (const Database &db: getDatabases()) {
if (db.m_isDefault) {
finalID = db.m_uri;
break;
@ -150,7 +303,7 @@ ESource *EvolutionSyncSource::findSource(const ESourceListCXX &list, const strin
}
#ifdef USE_EDS_CLIENT
BOOST_FOREACH (ESource *source, list) {
for (ESource *source: list) {
bool found =
!finalID.compare(e_source_get_display_name(source)) ||
!finalID.compare(e_source_get_uid(source));
@ -174,10 +327,10 @@ ESource *EvolutionSyncSource::findSource(const ESourceListCXX &list, const strin
}
}
#endif
return NULL;
return nullptr;
}
void EvolutionSyncSource::throwError(const string &action, GErrorCXX &gerror)
void EvolutionSyncSource::throwError(const SourceLocation &where, const string &action, GErrorCXX &gerror)
{
string gerrorstr;
if (gerror) {
@ -187,7 +340,7 @@ void EvolutionSyncSource::throwError(const string &action, GErrorCXX &gerror)
gerrorstr = ": failure";
}
throwError(action + gerrorstr);
throwError(where, action + gerrorstr);
}
#endif // HAVE_EDS

View File

@ -29,10 +29,7 @@
#if defined(HAVE_EDS)
# if defined(USE_EDS_CLIENT)
typedef SyncEvo::GListCXX<ESource, GList, SyncEvo::GObjectDestructor> ESourceListCXX;
SE_GOBJECT_TYPE(ESourceRegistry)
SE_GOBJECT_TYPE(ESource)
SE_GOBJECT_TYPE(EClient)
# include <syncevo/EDSClient.h>
# else
SE_GOBJECT_TYPE(ESourceList)
#endif
@ -74,15 +71,26 @@ class EvolutionSyncSource : public TrackingSyncSource
ESource *(*getDef)(ESourceRegistry *));
EClientCXX openESource(const char *extension,
ESource *(*refBuiltin)(ESourceRegistry *),
const boost::function<EClient *(ESource *, GError **gerror)> &newClient);
ESourceRegistryCXX getSourceRegistry();
const std::function<EClient *(ESource *, GError **gerror)> &newClient);
// Implementation of SyncSource calls which only works when using EDS Client API
// and EDS > 3.4. Older EDS has no way of creating sources easily (or at all).
virtual Database createDatabase(const Database &database);
virtual void deleteDatabase(const std::string &uri, RemoveData removeData);
/** E_SOURCE_EXTENSION_ADDRESS_BOOK, etc. */
virtual const char *sourceExtension() const = 0;
/** reference the system address book, calendar, etc. */
virtual ESourceCXX refSystemDB() const = 0;
#endif
/**
* searches the list for a source with the given uri or name
*
* @param list a list previously obtained from Gnome
* @param id a string identifying the data source: either its name or uri
* @return pointer to source (caller owns reference) or NULL if not found
* @return pointer to source (caller owns reference) or nullptr if not found
*/
ESource *findSource(const ESourceListCXX &list,
const string &id);
@ -102,7 +110,8 @@ class EvolutionSyncSource : public TrackingSyncSource
* @param gerror a more detailed description of the failure,
* may be empty
*/
void throwError(const string &action,
void throwError(const SourceLocation &where,
const string &action,
GErrorCXX &gerror);
#endif
};
@ -115,12 +124,19 @@ class EvolutionAsync {
public:
EvolutionAsync()
{
m_loop = GMainLoopCXX(g_main_loop_new(NULL, FALSE), false);
m_loop = GMainLoopStealCXX(g_main_loop_new(nullptr, TRUE));
}
/** start processing events */
void run() {
g_main_loop_run(m_loop.get());
if (g_main_context_is_owner(g_main_context_default())) {
g_main_loop_run(m_loop.get());
} else {
// Let master thread handle events.
while (g_main_loop_is_running(m_loop.get())) {
Sleep(0.1);
}
}
}
/** stop processing events, to be called inside run() by callback */

View File

@ -15,13 +15,23 @@ $anymissing"
dnl check for Evolution packages
PKG_CHECK_MODULES(EPACKAGE, libedataserver-1.2, EDSFOUND=yes, [EDSFOUND=no])
PKG_CHECK_MODULES(ECAL, libecal-1.2, ECALFOUND=yes, [ECALFOUND=no])
PKG_CHECK_MODULES(ECAL, libecal-2.0, ECALFOUND=yes, [ECALFOUND=no])
PKG_CHECK_MODULES(EBOOK, libebook-1.2, EBOOKFOUND=yes, [EBOOKFOUND=no])
if test "$ECALFOUND" = "yes"; then
AC_DEFINE(HAVE_LIBECAL_2_0, 1, [libecal 2.0])
else
PKG_CHECK_MODULES(ECAL, libecal-1.2, ECALFOUND=yes, [ECALFOUND=no])
fi
PKG_CHECK_MODULES(EBOOK_VERSION, [libebook-1.2 >= 3.3],
[AC_DEFINE(HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS, 1, [have e_contact_inline_local_photos()])],
[true])
PKG_CHECK_MODULES(EBOOK_VERSION_3_33, [libebook-1.2 >= 3.33.2],
[AC_DEFINE(HAVE_E_BOOK_OPERATION_FLAGS, 1, [have EBookOperationFlags])],
[true])
SE_ARG_ENABLE_BACKEND(ebook, evolution,
[AS_HELP_STRING([--disable-ebook],
[disable access to Evolution addressbooks (must be used to compile without it)])],
@ -67,11 +77,26 @@ if test "$enable_evo" = "yes"; then
fi
# Only the EClient code supports the API in EDS 3.5.x.
PKG_CHECK_MODULES(EDS_VERSION, [libedataserver-1.2 >= 3.5],
[AC_DEFINE(USE_EDS_CLIENT, 1, [use e_book/cal_client_* calls])],
[true])
[AC_DEFINE(USE_EDS_CLIENT, 1, [use e_book/cal_client_* calls])
# Was used for a while (ESourceBackendSummarySetup), but not anymore.
# Don't depend on it, it wasn't in 3.6 yet.
# PKG_CHECK_MODULES(EBOOKCONTACTS, libebook-contacts-1.2)
AC_CHECK_LIB(ebook-1.2, e_book_client_new_direct,
[AC_DEFINE(HAVE_E_BOOK_CLIENT_NEW_DIRECT, 1, [use e_book_client_new_direct])],
[true],
[$EDS_VERSION_LIBS])
AC_CHECK_LIB(ebook-1.2, e_book_client_connect_direct_sync,
[AC_DEFINE(HAVE_E_BOOK_CLIENT_CONNECT_DIRECT_SYNC, 1, [use e_book_client_connect_direct_sync])],
[true],
[$EDS_VERSION_LIBS])
],
[CFLAGS_old="$CFLAGS"
CFLAGS="$CFLAGS $EPACKAGE_CFLAGS"
AC_CHECK_HEADERS(libedataserver/eds-version.h)
CFLAGS="$CFLAGS_old"])
else
EPACKAGE_CFLAGS=
EPACKAGE_LIBS=
fi
BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EPACKAGE_CFLAGS $ECAL_CFLAGS $EBOOK_CFLAGS"
BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $EPACKAGE_CFLAGS $ECAL_CFLAGS $EBOOK_CFLAGS $EBOOKCONTACTS_CFLAGS"

View File

@ -414,7 +414,11 @@ gboolean e_cal_check_timezones(icalcomponent *comp,
goto done;
nomem:
/* set gerror for "out of memory" if possible, otherwise abort via g_error() */
#ifdef HAVE_LIBECAL_2_0
*error = g_error_new(E_CLIENT_ERROR, E_CLIENT_ERROR_OTHER_ERROR, "out of memory");
#else
*error = g_error_new(E_CALENDAR_ERROR, E_CALENDAR_STATUS_OTHER_ERROR, "out of memory");
#endif
if (!*error) {
g_error("e_cal_check_timezones(): out of memory, cannot proceed - sorry!");
}
@ -451,6 +455,10 @@ icaltimezone *e_cal_tzlookup_ecal(const char *tzid,
const void *custom,
GError **error)
{
#ifdef HAVE_LIBECAL_2_0
g_propagate_error(error, e_client_error_create(E_CLIENT_ERROR_NOT_SUPPORTED, NULL));
return NULL;
#else
ECal *ecal = (ECal *)custom;
icaltimezone *zone = NULL;
@ -470,6 +478,7 @@ icaltimezone *e_cal_tzlookup_ecal(const char *tzid,
}
return NULL;
}
#endif
}
/**

View File

@ -15,7 +15,7 @@ src_backends_evolution_syncecal_src = \
src/backends/evolution/EvolutionCalendarSource.h \
src/backends/evolution/EvolutionMemoSource.h \
src/backends/evolution/EvolutionCalendarSource.cpp \
src/backends/evolution/EvolutionMemoSource.cpp
$(NOP)
if ENABLE_ECAL
src_backends_evolution_syncecal_src += \
@ -36,7 +36,9 @@ src_backends_evolution_cppflags = \
-I$(top_srcdir)/src/backends/evolution
src_backends_evolution_syncecal_la_SOURCES = $(src_backends_evolution_syncecal_src)
src_backends_evolution_syncecal_la_LIBADD = $(ECAL_LIBS) $(SYNCEVOLUTION_LIBS) $(GLIB_LIBS) $(GOBJECT_LIBS)
# $(EBOOKCONTACTS_LIBS) is needed for ESourceBackendSummary, which we
# use in EvolutionSyncSource and thus in syncecal.
src_backends_evolution_syncecal_la_LIBADD = $(ECAL_LIBS) $(EBOOKCONTACTS_LIBS) $(SYNCEVOLUTION_LIBS) $(GLIB_LIBS) $(GOBJECT_LIBS)
# _GNU_SOURCE and -ldl for libical.c + dlsym():
src_backends_evolution_syncecal_la_CPPFLAGS = -D_GNU_SOURCE \
-De_cal_check_timezones=syncevolution_check_timezones \
@ -46,11 +48,11 @@ src_backends_evolution_syncecal_la_CPPFLAGS = -D_GNU_SOURCE \
$(src_backends_evolution_cppflags)
src_backends_evolution_syncecal_la_LDFLAGS = -module -avoid-version -ldl
src_backends_evolution_syncecal_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
src_backends_evolution_syncecal_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS)
src_backends_evolution_syncecal_la_DEPENDENCIES = src/syncevo/libsyncevolution.la
src_backends_evolution_syncebook_la_SOURCES = $(src_backends_evolution_syncebook_src)
src_backends_evolution_syncebook_la_LIBADD = $(EBOOK_LIBS) $(SYNCEVOLUTION_LIBS) $(GLIB_LIBS) $(GOBJECT_LIBS)
src_backends_evolution_syncebook_la_LIBADD = $(EBOOK_LIBS) $(EBOOKCONTACTS_LIBS) $(SYNCEVOLUTION_LIBS) $(GLIB_LIBS) $(GOBJECT_LIBS)
src_backends_evolution_syncebook_la_LDFLAGS = -module -avoid-version
src_backends_evolution_syncebook_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS) $(GLIB_CFLAGS) $(GOBJECT_CFLAGS)
src_backends_evolution_syncebook_la_CPPFLAGS = $(src_backends_evolution_cppflags)
src_backends_evolution_syncebook_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS)
src_backends_evolution_syncebook_la_DEPENDENCIES = src/syncevo/libsyncevolution.la

View File

@ -45,7 +45,6 @@
#include <sstream>
#include <fstream>
#include <syncevo/SyncContext.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -56,7 +55,24 @@ FileSyncSource::FileSyncSource(const SyncSourceParams &params,
m_entryCounter(0)
{
if (dataformat.empty()) {
throwError("a database format must be specified");
throwError(SE_HERE, "a database format must be specified");
}
std::list<std::string> fields;
std::string separator;
if (m_mimeType == "text/vcard" ||
m_mimeType == "text/x-vcard") {
fields.push_back("N_FIRST");
fields.push_back("N_MIDDLE");
fields.push_back("N_LAST");
separator = " ";
} else if (m_mimeType == "text/calendar" ||
m_mimeType == "text/x-vcalendar") {
fields.push_back("SUMMARY");
fields.push_back("LOCATION");
separator = ", ";
}
if (!fields.empty()) {
SyncSourceLogging::init(fields, separator, m_operations);
}
}
@ -87,6 +103,16 @@ void FileSyncSource::open()
string basedir;
bool createDir = false;
std::string varname = StringPrintf("SYNCEVOLUTION_FILE_SOURCE_DELAY_OPEN_%s", getDisplayName().c_str());
boost::replace_all(varname, "-", "_");
const char *delay = getenv(varname.c_str());
if (delay) {
int seconds = atoi(delay);
SE_LOG_DEBUG(getDisplayName(), "sleeping %ds while opening file source", seconds);
Sleep(seconds);
SE_LOG_DEBUG(getDisplayName(), "continue opening file source");
}
// file:// is optional. It indicates that the
// directory is to be created.
if (boost::starts_with(database, prefix)) {
@ -101,7 +127,7 @@ void FileSyncSource::open()
if (errno == ENOENT && createDir) {
mkdir_p(basedir.c_str());
} else {
throwError(basedir, errno);
throwError(SE_HERE, basedir, errno);
}
}
@ -111,13 +137,13 @@ void FileSyncSource::open()
bool FileSyncSource::isEmpty()
{
DIR *dir = NULL;
DIR *dir = nullptr;
bool empty = true;
try {
dir = opendir(m_basedir.c_str());
if (!dir) {
SyncContext::throwError(m_basedir, errno);
Exception::throwError(SE_HERE, m_basedir, errno);
}
errno = 0;
struct dirent *entry = readdir(dir);
@ -130,7 +156,7 @@ bool FileSyncSource::isEmpty()
entry = readdir(dir);
}
if (errno) {
SyncContext::throwError(m_basedir, errno);
Exception::throwError(SE_HERE, m_basedir, errno);
}
} catch(...) {
if (dir) {
@ -161,7 +187,17 @@ void FileSyncSource::listAllItems(RevisionMap_t &revisions)
{
ReadDir dirContent(m_basedir);
BOOST_FOREACH(const string &entry, dirContent) {
std::string varname = StringPrintf("SYNCEVOLUTION_FILE_SOURCE_DELAY_LISTALL_%s", getDisplayName().c_str());
boost::replace_all(varname, "-", "_");
const char *delay = getenv(varname.c_str());
if (delay) {
int seconds = atoi(delay);
SE_LOG_DEBUG(getDisplayName(), "sleeping %ds while listing items in file source", seconds);
Sleep(seconds);
SE_LOG_DEBUG(getDisplayName(), "continue listing items in file source");
}
for (const string &entry: dirContent) {
string filename = createFilename(entry);
string revision = getATimeString(filename);
long entrynum = atoll(entry.c_str());
@ -177,7 +213,7 @@ void FileSyncSource::readItem(const string &uid, std::string &item, bool raw)
string filename = createFilename(uid);
if (!ReadFile(filename, item)) {
throwError(filename + ": reading failed", errno);
throwError(SE_HERE, filename + ": reading failed", errno);
}
}
@ -215,7 +251,7 @@ TrackingSyncSource::InsertItemResult FileSyncSource::insertItem(const string &ui
newuid = buff.str();
break;
} else {
throwError(filename, errno);
throwError(SE_HERE, filename, errno);
}
}
@ -228,7 +264,7 @@ TrackingSyncSource::InsertItemResult FileSyncSource::insertItem(const string &ui
out.write(item.c_str(), item.size());
out.close();
if (!out.good()) {
throwError(filename + ": writing failed", errno);
throwError(SE_HERE, filename + ": writing failed", errno);
}
return InsertItemResult(newuid,
@ -242,7 +278,7 @@ void FileSyncSource::removeItem(const string &uid)
string filename = createFilename(uid);
if (unlink(filename.c_str())) {
throwError(filename, errno);
throwError(SE_HERE, filename, errno);
}
}
@ -250,12 +286,16 @@ string FileSyncSource::getATimeString(const string &filename)
{
struct stat buf;
if (stat(filename.c_str(), &buf)) {
throwError(filename, errno);
throwError(SE_HERE, filename, errno);
}
time_t mtime = buf.st_mtime;
int mnsec = buf.st_mtim.tv_nsec;
ostringstream revision;
revision << mtime;
if (mnsec) {
revision << "." << mnsec;
}
return revision.str();
}

View File

@ -54,7 +54,7 @@ SE_BEGIN_CXX
* - type=file:text/vcard:3.0
* - type=file:text/plain:1.0
*/
class FileSyncSource : public TrackingSyncSource, private boost::noncopyable
class FileSyncSource : public TrackingSyncSource, public SyncSourceLogging, private boost::noncopyable
{
public:
FileSyncSource(const SyncSourceParams &params,

View File

@ -24,7 +24,7 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
static SyncSource *createSource(const SyncSourceParams &params)
static std::unique_ptr<SyncSource> createSource(const SyncSourceParams &params)
{
SourceType sourceType = SyncSource::getSourceType(params.m_nodes);
// The string returned by getSourceType() is always the one
@ -34,7 +34,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifndef ENABLE_FILE
// tell SyncEvolution if the user wanted to use a disabled sync source,
// otherwise let it continue searching
return isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
return isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
#else
// Also recognize one of the standard types?
// Not in the FileSyncSource!
@ -43,12 +43,12 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe || maybeMe) {
// The FileSyncSource always needs the database format.
if (!sourceType.m_localFormat.empty()) {
return new FileSyncSource(params, sourceType.m_localFormat);
return std::make_unique<FileSyncSource>(params, sourceType.m_localFormat);
} else {
return NULL;
return nullptr;
}
}
return NULL;
return nullptr;
#endif
}
@ -88,10 +88,10 @@ class FileSyncSourceUnitTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("file", "file:text/vcard:3.0", true));
source.reset(SyncSource::createTestingSource("file", "file:text/plain:1.0", true));
source.reset(SyncSource::createTestingSource("file", "Files in one directory:text/x-vcard:2.1", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("file", "file:text/vcard:3.0", true);
source = SyncSource::createTestingSource("file", "file:text/plain:1.0", true);
source = SyncSource::createTestingSource("file", "Files in one directory:text/x-vcard:2.1", true);
}
};

View File

@ -18,7 +18,7 @@ src_backends_file_syncfile_la_LIBADD = $(FILE_LIBS) $(SYNCEVOLUTION_LIBS)
src_backends_file_syncfile_la_LDFLAGS = -module -avoid-version
src_backends_file_syncfile_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS)
src_backends_file_syncfile_la_CPPFLAGS = $(SYNCEVOLUTION_CFLAGS) -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_file_syncfile_la_DEPENDENCIES = $(SYNCEVOLUTION_LIBS)
src_backends_file_syncfile_la_DEPENDENCIES = src/syncevo/libsyncevolution.la
# If you need special test cases for your sync source, then
# install them here. Here's how the sqlite backend does that:
#

View File

@ -21,27 +21,26 @@
#ifdef USE_GNOME_KEYRING
extern "C" {
#include <gnome-keyring.h>
}
#include <libsecret/secret.h>
#include "GNOMEPlatform.h"
#include <syncevo/SyncContext.h>
#include <syncevo/Exception.h>
#include <syncevo/UserInterface.h>
#include <syncevo/SyncConfig.h>
#include <syncevo/GLibSupport.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
/**
* GNOME keyring distinguishes between empty and unset
* password keys. This function returns NULL for an
* password keys. This function returns nullptr for an
* empty std::string.
*/
inline const char *passwdStr(const std::string &str)
{
return str.empty() ? NULL : str.c_str();
return str.empty() ? nullptr : str.c_str();
}
static bool UseGNOMEKeyring(const InitStateTri &keyring)
@ -61,6 +60,56 @@ static bool UseGNOMEKeyring(const InitStateTri &keyring)
return true;
}
class LibSecretHash : public GHashTableCXX
{
std::list<std::string> m_buffer;
public:
LibSecretHash(const ConfigPasswordKey &key) :
GHashTableCXX(g_hash_table_new(g_str_hash, g_str_equal), TRANSFER_REF)
{
// see https://developer.gnome.org/libsecret/0.16/libsecret-SecretSchema.html#SECRET-SCHEMA-COMPAT-NETWORK:CAPS
insert("user", key.user);
insert("domain", key.domain);
insert("server", key.server);
insert("object", key.object);
insert("protocol", key.protocol);
insert("authtype", key.authtype);
if (key.port) {
std::string value = StringPrintf("%d", key.port);
insert("port", value);
}
}
/** Keys are expected to be constants and not copied. Values are copied. */
void insert(const char *key, const std::string &value)
{
if (!value.empty()) {
m_buffer.push_back(value);
g_hash_table_insert(get(),
const_cast<char *>(key),
const_cast<char *>(m_buffer.back().c_str()));
}
}
};
/**
* Sometimes libsecret and GNOME Keyring fail to initialize
* the encryption: https://bugzilla.gnome.org/show_bug.cgi?id=778357
* If that happens, then trying with a new SecretService instance
* may work.
*
* When libsecret detects that, we get a well-defined error.
* When GNOME Keyring detects it, the error is less obvious.
*/
static bool IsSharedSecretError(const GErrorCXX &gerror)
{
bool result = gerror.matches(SECRET_ERROR, SECRET_ERROR_PROTOCOL) /* = "received an invalid or unencryptable secret" */ ||
strstr(gerror->message, "The secret was transferred or encrypted in an invalid way");
SE_LOG_DEBUG(NULL, "IsSharedSecretError: %d/%d/%s: %s", (int)gerror->domain, (int)gerror->code, gerror->message, result ? "yes" : "no");
return result;
}
bool GNOMELoadPasswordSlot(const InitStateTri &keyring,
const std::string &passwordName,
const std::string &descr,
@ -68,27 +117,53 @@ bool GNOMELoadPasswordSlot(const InitStateTri &keyring,
InitStateString &password)
{
if (!UseGNOMEKeyring(keyring)) {
SE_LOG_DEBUG(NULL, "not using GNOME keyring");
return false;
}
GnomeKeyringResult result;
GList* list;
LibSecretHash hash(key);
for (int i = 0; ; i++ ) {
GErrorCXX gerror;
PlainGStr result(secret_password_lookupv_sync(SECRET_SCHEMA_COMPAT_NETWORK,
hash,
nullptr,
gerror));
result = gnome_keyring_find_network_password_sync(passwdStr(key.user),
passwdStr(key.domain),
passwdStr(key.server),
passwdStr(key.object),
passwdStr(key.protocol),
passwdStr(key.authtype),
key.port,
&list);
// if find password stored in gnome keyring
if(result == GNOME_KEYRING_RESULT_OK && list && list->data ) {
GnomeKeyringNetworkPasswordData *key_data;
key_data = (GnomeKeyringNetworkPasswordData*)list->data;
password = std::string(key_data->password);
gnome_keyring_network_password_list_free(list);
// if find password stored in gnome keyring
if (gerror) {
/* It is uncertain whether we end up here at all when such
an error occurs. Check just in case. */
if (IsSharedSecretError(gerror) &&
i < 3) {
SE_LOG_DEBUG(NULL, "disconnecting secret service: %u/%d = %s", gerror->domain, gerror->code, gerror->message);
secret_service_disconnect();
} else {
gerror.throwError(SE_HERE, StringPrintf("looking up password '%s'", descr.c_str()));
}
} else if (result.get()) {
SE_LOG_DEBUG(NULL, "%s: loaded password from GNOME keyring using %s",
key.description.c_str(),
key.toString().c_str());
password = result;
break;
} else {
/*
* There have been cases where "received an invalid or
* unencryptable secret" was printed to the console right
* before we end up here. Apparently the error doesn't
* get propagated properly to us.
*
* To cope with that, we try to disconnect and check again.
*/
if (i < 3) {
SE_LOG_DEBUG(NULL, "disconnecting secret service: password not found");
secret_service_disconnect();
} else {
SE_LOG_DEBUG(NULL, "password not in GNOME keyring using %s",
key.toString().c_str());
break;
}
}
}
return true;
@ -100,32 +175,51 @@ bool GNOMESavePasswordSlot(const InitStateTri &keyring,
const ConfigPasswordKey &key)
{
if (!UseGNOMEKeyring(keyring)) {
SE_LOG_DEBUG(NULL, "not using GNOME keyring");
return false;
}
guint32 itemId;
GnomeKeyringResult result;
// write password to keyring
result = gnome_keyring_set_network_password_sync(NULL,
passwdStr(key.user),
passwdStr(key.domain),
passwdStr(key.server),
passwdStr(key.object),
passwdStr(key.protocol),
passwdStr(key.authtype),
key.port,
password.c_str(),
&itemId);
/* if set operation is failed */
if(result != GNOME_KEYRING_RESULT_OK) {
#ifdef GNOME_KEYRING_220
SyncContext::throwError("Try to save " + passwordName + " in gnome-keyring but get an error. " + gnome_keyring_result_to_message(result));
#else
/** if gnome-keyring version is below 2.20, it doesn't support 'gnome_keyring_result_to_message'. */
stringstream value;
value << (int)result;
SyncContext::throwError("Try to save " + passwordName + " in gnome-keyring but get an error. The gnome-keyring error code is " + value.str() + ".");
#endif
// Cannot store a password for just a user, that's ambiguous.
// Also, a password without server ("user=foo") somehow removes
// the password with server ("user=foo server=bar").
if (key.user.empty() ||
(key.domain.empty() && key.server.empty() && key.object.empty())) {
SE_THROW(StringPrintf("%s: cannot store password in GNOME keyring, not enough attributes (%s). Try setting syncURL or remoteDeviceID if this is a sync password.",
key.description.c_str(),
key.toString().c_str()));
}
LibSecretHash hash(key);
std::string label;
if (!key.user.empty() && !key.server.empty()) {
// This emulates the behavior of libgnomekeyring.
label = key.user + "@" + key.server;
} else {
label = passwordName;
}
for (int i = 0; ; i++) {
GErrorCXX gerror;
gboolean result = secret_password_storev_sync(SECRET_SCHEMA_COMPAT_NETWORK,
hash,
nullptr,
label.c_str(),
password.c_str(),
nullptr,
gerror);
if (result) {
SE_LOG_DEBUG(NULL, "saved password in GNOME keyring using %s", key.toString().c_str());
break;
}
if (IsSharedSecretError(gerror) &&
i < 3) {
SE_LOG_DEBUG(NULL, "disconnecting secret service: %u/%d = %s", gerror->domain, gerror->code, gerror->message);
secret_service_disconnect();
} else {
gerror.throwError(SE_HERE, StringPrintf("%s: saving password '%s' in GNOME keyring",
key.description.c_str(),
key.toString().c_str()));
}
}
// handled

View File

@ -1,16 +1,17 @@
PKG_CHECK_MODULES(KEYRING, [gnome-keyring-1], HAVE_KEYRING=yes, HAVE_KEYRING=no)
# According to https://developer.gnome.org/libsecret/0.16/libsecret-Password-storage.html#secret-password-store-sync
# the simple API was still considered unstable. All supported distros
# now have 0.18 where the API is stable.
PKG_CHECK_MODULES(KEYRING, [libsecret-1 >= 0.18], HAVE_KEYRING=yes, HAVE_KEYRING=no)
AC_ARG_ENABLE(gnome-keyring,
AS_HELP_STRING([--enable-gnome-keyring],
[enables or disables support for the GNOME keyring; default is on if development files are available]),
[enables or disables support for the GNOME keyring via libsecret; default is on if development files are available]),
[enable_gnome_keyring="$enableval"
test "$enable_gnome_keyring" = "yes" || test "$enable_gnome_keyring" = "no" || AC_MSG_ERROR([invalid value for --enable-gnome-keyring: $enable_gnome_keyring])
test "$enable_gnome_keyring" = "no" || test "$HAVE_KEYRING" = "yes" || AC_MSG_ERROR([gnome-keyring-1 pkg not found, needed for --enable-gnome-keyring])],
test "$enable_gnome_keyring" = "no" || test "$HAVE_KEYRING" = "yes" || AC_MSG_ERROR([libsecret-1 >= 0.18 not found, needed for --enable-gnome-keyring])],
enable_gnome_keyring="$HAVE_KEYRING")
if test $enable_gnome_keyring = "yes"; then
have_keyring=yes
AC_DEFINE(USE_GNOME_KEYRING, 1, [define if gnome keyring should be used in dbus service])
PKG_CHECK_MODULES([KEYRING_2_20], [gnome-keyring-1 >= 2.20 ],
[AC_DEFINE(GNOME_KEYRING_220, 1, [define if gnome keyring version is above 2.20])],
[true])
# link into static executables, similar to a SyncSource
SYNCSOURCES="$SYNCSOURCES src/backends/gnome/platformgnome.la"
fi

Some files were not shown because too many files have changed in this diff Show More