Compare commits

...

446 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 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
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
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
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
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
Tino Keitel e30181949c Document 1.3.2-1 Debian package 2013-10-01 10:57:01 +02:00
Tino Keitel 6255e32e10 Depend on recent libsynthesis, to pull in the fix for #694005 2013-09-25 13:12:14 +02:00
Tino Keitel f08b7c1eb4 Build with --as-needed and with hardening flags enabled 2013-09-25 13:12:14 +02:00
Tino Keitel 1e4baae4e1 Raise debhelper compatibility level to 9 2013-09-25 13:12:14 +02:00
Tino Keitel 7fef193c5a Use multiarch paths for shared object files 2013-09-25 13:12:14 +02:00
Tino Keitel 50dea7cfed New upstream release
Closes: #682280
Closes: #684077
Closes: #694004
Closes: #722044
2013-09-25 13:11:50 +02:00
Tino Keitel 82f46d6191 Install syncevo-local-sync helper, required for CardDAV/CalDAV
syncevo-local-sync is missing, but it is required for certain sync
operations, e.h. DAV sync.

Closes: #679657
Thanks: Gregor Herrmann for the patch.
2013-06-18 12:00:22 +02:00
Tino Keitel b837bb9e67 Merge branch 'upstream' 2013-06-18 11:52:25 +02:00
Tino Keitel aa72f6fd12 1.2.99.1-1.1 package 2013-04-11 08:51:19 +02:00
Tino Keitel d0284f3323 Finish changelog für 1.2.99.1-1
Change distribution from UNRELEASED to unstable
2012-06-29 12:42:39 +02:00
Tino Keitel df22cb3375 1.2.99.1-1 package 2012-06-28 11:42:10 +02:00
Tino Keitel 3e62c563e0 Document possible issues when upgrading from 1.2.x in NEWS 2012-06-28 11:42:06 +02:00
Tino Keitel 3e8f8190ce Install new syncevo-dbus-helper binary 2012-06-27 17:25:29 +02:00
Tino Keitel 28b1f815c7 New library package for libgdbussyncevo
Upstream moved libgdbussyncevo to /usr/lib. Added new library package
with matching Breaks: and Replaces: for upgrades of syncevolution-libs.
2012-06-27 11:06:46 +02:00
Tino Keitel e60bd72922 Add libpcre3-dev and libcppunit-dev build dependencies
Both are required as of upstream version 1.3
2012-06-27 11:06:46 +02:00
Tino Keitel 7451ea467f Use DEB_REF instead of UPSTREAM_REF for git based patch creation
UPSTREAM_REF is not suitable as different Debian revisions can contain
different patches, and UPSTREAM_REF does not contain the Debian revision
2012-06-27 11:06:29 +02:00
Tino Keitel f4dcd709a6 New upstream release candidate
Closes: #675288
2012-06-27 11:04:35 +02:00
Tino Keitel 8443db176f Merge branch 'upstream' into HEAD 2012-06-26 22:38:56 +02:00
Tino Keitel 818cebfad8 Re-add sync-ui icon referenced in .desktop file (bug#658519)
This got lost by accident.
2012-02-09 13:55:26 +01:00
Tino Keitel c246660ddf Switch packaging to 1.2.2 2012-02-09 13:54:40 +01:00
Tino Keitel 925ff92b5e Add Breaks: and Replaces: to syncevolution-dbus
This fixes upgrades from squeeze (bug#657001).
2012-01-26 21:21:24 +01:00
Tino Keitel 143f22f7af Merge branch 'upstream' 2012-01-26 21:00:44 +01:00
tino+debian@tikei.de c6d6ef23d1 Debian: move packaging to 1.2.1 2011-12-19 21:40:57 +01:00
Tino Keitel efc29d41e7 Merge branch 'upstream' 2011-12-07 21:18:26 +01:00
Tino Keitel ab34545ee7 Debian: correctly enable CardDAV/CalDAV support in the configure call 2011-08-03 21:09:15 +02:00
Tino Keitel b69c3d67d7 Debian: new maintainer: me 2011-08-03 21:09:15 +02:00
Tino Keitel 79338edb1e Debian: add README.Debian for server operation 2011-08-03 21:09:15 +02:00
Tino Keitel 9de85589e1 Debian: rework package descriptions to mention new features 2011-08-03 21:08:51 +02:00
Tino Keitel 8ae7cde9f2 Debian: add documentation fix from upstream git 2011-07-26 19:17:18 +02:00
Tino Keitel 806cb07788 Debian: bump to 1.1.99.5a-2 2011-07-26 15:32:52 +02:00
Tino Keitel 40e670c4d5 Debian: bluez is only available on Linux, specify build deps accordingly 2011-07-24 22:49:42 +02:00
Tino Keitel 0c808f9cfd Debian: updated changelog 2011-07-20 16:12:47 +02:00
Tino Keitel bf41fb9404 Debian: updated NEWS file for 1.1.99.5a 2011-07-19 15:03:59 +02:00
Tino Keitel 0aaa6c49f0 Debian: update upstream tag 2011-07-19 14:12:55 +02:00
Tino Keitel 3afabd9821 Debian: added myself to Uploaders: 2011-07-19 14:12:55 +02:00
Tino Keitel 04b662309e Debian: fixed .orig.tar.gz generation in get-orig-source target 2011-07-19 14:12:54 +02:00
Tino Keitel 63e08795ed Debian: bump version to 1.1.99.5a 2011-07-19 14:12:44 +02:00
Tino Keitel ca60aa3911 Debian: add versioned dependency on libsynthesis
This syncevolution version requires features not present in older
libsynthesis0 packages.
2011-07-19 13:28:35 +02:00
Tino Keitel 686f6ff183 Debian: added python-openssl dependency
The HTTP server now also supports HTTPS and requires python-openssl.
2011-07-19 13:27:40 +02:00
Tino Keitel 3fc49586d8 Merge branch 'upstream' 2011-07-15 19:49:20 +02:00
Tino Keitel c731a10f74 bump version to 1.99.5-1 2011-07-14 13:00:19 +02:00
Tino Keitel 7bfa5f45ad Merge branch 'upstream' 2011-07-14 12:46:36 +02:00
Tino Keitel b064187240 corrected version in NEWS, otherwise the message won't be shown 2011-07-14 11:53:18 +02:00
Tino Keitel f7e482821c rename NEWS.Debian to the correct name NEWS 2011-07-14 11:14:32 +02:00
David Bremner aba977a444 disable maintainer scripts for syncevolution-libs 2011-06-04 09:22:46 -03:00
David Bremner 3f5965ab3b update changelog 2011-06-03 21:57:08 -03:00
David Bremner f81e155abc upload to experimental due to lack of testing 2011-06-03 07:37:43 -03:00
David Bremner af175b0ce4 add binary package for private libraries 2011-05-30 08:41:16 -03:00
David Bremner a14ca7759e add shlib packages for libsyncevolution and libsyncevo-dbus 2011-05-29 13:07:15 -03:00
David Bremner 8efdfddf15 bump standards version 2011-05-29 11:23:48 -03:00
David Bremner f6bbca6005 use bash for patch export 2011-05-29 11:07:09 -03:00
David Bremner 7f932c7c04 Put back git-patches file, now that we need to patch configure-pre.in 2011-05-29 09:55:31 -03:00
David Bremner 96c04147f5 work around apparent failure of CONFIG_SHELL 2011-05-29 09:44:16 -03:00
David Bremner 23ac969561 enable CalDAV 2011-05-29 08:20:14 -03:00
David Bremner 2eea821b4c Merge branch 'upstream' 2011-05-29 08:10:11 -03:00
David Bremner 9f426fa911 start new upstream release 2011-05-29 08:07:41 -03:00
David Bremner c6553f08af add README.source 2011-03-08 19:35:39 -04:00
David Bremner 20244071fe add NEWS.Debian file to point out some pitfalls of upgrading 2011-03-08 17:03:12 -04:00
David Bremner 604835116a fix date in changelog 2011-03-08 16:06:35 -04:00
David Bremner f426cdabc3 add patch export based on gitpkg hook 2011-03-07 12:38:30 -04:00
David Bremner a31bf33d9c add libical-dev as a build dependency.
The packaging docs mention libecal _or_ libical, but perhaps both are needed.
2011-03-07 07:07:27 -04:00
David Bremner bfbdf3078e update version of synthesis dependencies. 2011-03-06 22:19:43 -04:00
David Bremner ad50e17bfa remove Makefile.am from debian/clean 2011-03-06 22:09:03 -04:00
David Bremner 542fcf47d8 Remove patches, all are now upstream 2011-03-06 21:52:18 -04:00
David Bremner cef68e96c3 Update rules and changelog for new version. 2011-03-06 21:31:55 -04:00
David Bremner 38600b38ce Merge branch 'upstream' 2011-03-06 21:25:25 -04:00
David Bremner eb4771c0aa re-export patches 2011-02-19 15:13:55 -04:00
David Bremner 699119e3ce Merge branch 'upstream'
Conflicts are because upstream decided to delete their debian directory.

Conflicts:
	debian/changelog
	debian/compat
	debian/control
	debian/copyright
	debian/docs
	debian/rules
	debian/syncevolution.install
2011-02-19 15:11:34 -04:00
David Bremner b45cd2d084 bump upstream version 2011-02-19 15:03:15 -04:00
David Bremner 58564bfdd7 cut down number of remotes 2011-02-19 14:25:06 -04:00
David Bremner 0389efdec4 update changelog 2010-11-28 10:46:52 -04:00
David Bremner a63eaca08a more synccompare manpage to syncevolution-common 2010-11-28 10:45:50 -04:00
David Bremner 9487efbb77 update changelog, close correct bug this time 2010-11-28 10:32:53 -04:00
David Bremner ab3a2bb3c6 Merge remote branch 'origin/master' 2010-11-28 10:09:00 -04:00
David Bremner 8aa380d10e add TODO for packaging issues 2010-11-28 10:08:52 -04:00
David Bremner 9b523b1823 re-export patches, add new patch 2010-11-27 21:29:25 -04:00
David Bremner c26f9e0f33 Tidy changelog 2010-11-27 10:08:53 -08:00
David Bremner e43e7bd738 export patches from patch-queue/master 2010-11-26 22:47:25 -08:00
David Bremner 8c357287d5 update changelog with patch description and close bug 2010-11-24 15:10:35 -08:00
David Bremner fcd0594507 export patches from branch patch-queue/master 2010-11-24 15:08:04 -08:00
David Bremner bae4fe5f68 Build without libopenobex on hurd 2010-11-24 09:32:26 -08:00
David Bremner f762050027 expand dependencies of libsynthesis-dev.
This seems to be needed to get syncevolution to build in a experimental chroot.
2010-11-24 00:03:30 -08:00
David Bremner cb9fc3fade new release for test building 2010-11-21 08:47:07 -08:00
David Bremner 260de4b117 new Debian release, fix bad conflicts. 2010-11-20 17:32:33 -08:00
David Bremner b278dac27c update standards version; no changes 2010-11-08 20:10:55 -04:00
David Bremner fc9de44b3c update maintainer email. 2010-11-08 20:07:59 -04:00
David Bremner e911d9f0f1 update changelog and rules for new upstream version 2010-11-08 20:06:51 -04:00
David Bremner 018fde5ffe Merge branch 'upstream' 2010-11-08 20:05:40 -04:00
David Bremner 38c821c510 set distribution to experimental 2010-10-12 21:38:49 -03:00
David Bremner 5225aa2089 remove /usr/share/syncevolution files from sync-ui binary package.
This is slightly wasteful since these files are not needed by the
syncevolution command line client, as a percentage of the size of the
binaries, the waste is small.
2010-10-10 13:02:10 -03:00
David Bremner 946694dd42 Merge branch 'upstream' 2010-10-10 11:44:59 -03:00
David Bremner 7251befa68 bump upstream version 2010-10-10 11:43:15 -03:00
David Bremner fb6625f05b fix Vcs-Browse URL 2010-09-14 08:14:21 -03:00
David Bremner 59d248ac6a move all of /usr/share/syncevolution and /usr/bin/synccompare into syncevolution-common.
This resolves a problem reported Matthijs Kooijman with
syncevolution-http.  It is arguably overkill, but it does have the
benefit of minimizing archive size.
2010-09-13 18:38:07 -03:00
David Bremner 4849a06741 Use upstream manpage for syncevolution. 2010-09-11 15:30:08 -04:00
David Bremner 7a1d1cc31b Bump standards version; no changes 2010-08-03 16:09:13 -04:00
David Bremner fa391f4f30 merge changelog stanza's for non-uploaded version. Fix typos. 2010-08-03 16:08:12 -04:00
David Bremner ed1745a838 relax strict dependency of -http on -dbus; this allows binNMU's. 2010-08-03 16:08:07 -04:00
David Bremner 8d6be4bc61 make a separate binary package for syncevo-http-server.
This is mainly because the python depends for this script add
another (roughly) 35M of installed space to syncevolution-dbus.
2010-08-03 13:27:53 -04:00
David Bremner 846bd3f244 update d/rules and d/changelog for new upstream version 2010-08-01 20:48:16 -04:00
David Bremner c5cc1879d0 Merge branch 'upstream' 2010-08-01 20:39:24 -04:00
David Bremner 85b40ca3f0 Fix upstream tag. 2010-06-17 22:04:09 -03:00
David Bremner b62c88bb25 Merge branch 'upstream' 2010-06-17 22:01:13 -03:00
David Bremner 4ac5e62f09 update changelog and rules for new upstream release 2010-06-17 22:00:52 -03:00
David Bremner eefba98a80 add meego repos 2010-06-17 21:57:07 -03:00
David Bremner d5e794448a update changelog to reflect new package and change recommends 2010-06-16 07:56:49 -03:00
David Bremner 70befa10a3 fix changelog reference to wrong example collection 2010-06-13 15:05:27 -03:00
David Bremner 39dfdf0be9 modify full description 2010-06-13 14:37:03 -03:00
David Bremner 193338dd62 Weaken recommends by recommending evolution-data-server instead of
evolution.  One could quite reasonably use eds with another client.
2010-06-13 14:36:53 -03:00
David Bremner 556ce4a20c Add a package for debugging symbols 2010-06-12 16:25:14 -03:00
David Bremner 5aab681c88 add dependency of sync-ui on syncevolution-dbus 2010-05-30 08:42:04 -03:00
David Bremner 08225b14d9 remove ${shlibs:Depends} from syncevolution-common 2010-05-30 08:29:43 -03:00
David Bremner 398e78566f Add conflicts, replaces to allow sync-ui to be upgraded to sync-ui+syncevolution-common 2010-05-30 08:25:14 -03:00
David Bremner 9f555d08a3 tidy descriptions 2010-05-29 23:26:35 -03:00
David Bremner 507cdcb630 remove build-depend on bash 2010-05-29 23:01:52 -03:00
David Bremner 0f3c1967c6 Shorten changelog entry 2010-05-29 19:36:44 -06:00
David Bremner fe6fcfaeec make syncevolution-dbus arch any 2010-05-29 19:32:08 -06:00
Thomas Bechtold cfa0cfcee7 split dbus package. fix libsynthesis dependencies. add bluez recommends. 2010-05-29 19:09:52 -06:00
Thomas Bechtold 2e95e54d79 remove sync-ui.examples because example moved to syncevolution.example. 2010-05-29 19:09:52 -06:00
Thomas Bechtold a243ad875e fix debian/control. move syncevo-dbus-server to syncevolution-package. 2010-05-29 19:09:52 -06:00
Thomas Bechtold 1ed8884266 remove install image files from debian/sync-ui.install due to dh_install error. 2010-05-29 19:09:52 -06:00
Thomas Bechtold e783ff1268 Create syncevolution-common binary package. Move language files and dbus-server to syncevolution-common. 2010-05-29 19:09:52 -06:00
David Bremner 7826527ff8 add build dependency on libnotify-dev 2010-05-01 09:31:42 -03:00
David Bremner 5fa6b2652e Merge branch 'upstream' 2010-05-01 09:02:39 -03:00
David Bremner 59dd2128c4 update upstream tag, add new version to changelog 2010-05-01 09:00:39 -03:00
David Bremner fdeb090e94 add syncevo-http-server.py to sync-ui examples, by request. It really
suggests that maybe the dbus stuff should be in its own binary package.
2010-03-14 08:40:58 -03:00
David Bremner 0512ddb4f3 move perl file to examples 2010-03-07 08:26:51 -04:00
David Bremner ef0e35e6cf bump standards version 2010-03-07 07:31:47 -04:00
David Bremner b55adb210d add missing files 2010-03-06 22:52:22 -04:00
David Bremner 2602c9c579 simplify syncevolution.install, and add missing xml files 2010-03-06 21:00:29 -04:00
David Bremner a692ef945b remove extra COPYING file 2010-03-06 20:53:14 -04:00
David Bremner fc0fc0bd34 remove debugging output 2010-03-06 18:05:01 -04:00
David Bremner 38c9b081cd Use more readable version scheme.
Close wishlist upgrade bug.
2010-03-06 18:04:32 -04:00
David Bremner cfc466ce21 update list of configuration templates 2010-02-27 13:47:17 -04:00
David Bremner 482b8b85a6 bump dependency on libsynthesis 2010-02-27 08:15:50 -04:00
David Bremner be89067372 Merge branch 'upstream'
Conflicts:
	debian/changelog
	debian/compat
	debian/control
	debian/copyright
	debian/docs
	debian/rules
	src/gnome-bluetooth/configure-sub.in
2010-02-26 15:54:45 -04:00
David Bremner 54a4f86b07 remove upstream debian directory 2010-02-26 15:52:02 -04:00
David Bremner 247074a9a4 Update for new beta snapshot 2010-02-26 15:45:39 -04:00
David Bremner 950714d15b avoid libopenobex (and consequently bluez) on kfreebsd-* 2010-01-26 23:29:18 -04:00
David Bremner 5f9c18f7fc add libopenobex1-dev as build depends to enable bluetooth 2010-01-23 13:06:56 -04:00
David Bremner 032dfb07a7 fix distribution in changelog 2010-01-23 13:03:17 -04:00
David Bremner 05dedd663e update installed files for new upstream version 2010-01-21 08:51:52 -04:00
David Bremner b6521fec0e Bump dependency on libsynthesis to new (moblin) version 2010-01-20 06:33:23 -04:00
David Bremner 11a96879c5 New upstream version (alpha release) 2010-01-17 22:16:00 -04:00
David Bremner 134a88c85d Merge remote branch 'alioth/master' 2010-01-17 22:04:43 -04:00
David Bremner f4b670c39d Merge branch 'upstream' 2010-01-17 21:59:08 -04:00
David Bremner d230107a72 bump standards version; update changelog 2009-11-23 22:25:28 -04:00
David Bremner 89e81cae33 convert to quilt 3.0 source format 2009-11-23 00:24:40 -04:00
David Bremner 6c7d5df831 add versioned build depends on libsynthesis 2009-11-23 00:21:11 -04:00
David Bremner e2290982bf Merge branch 'upstream' 2009-11-20 08:02:39 -04:00
David Bremner 0e341da74d add new upstream version to changelog 2009-11-20 07:56:18 -04:00
David Bremner 93a1a3c05c bump upstream tag 2009-11-20 07:54:32 -04:00
David Bremner 38fa890877 add final newlines to two files 2009-08-31 18:06:59 -03:00
David Bremner 60312bc650 update debian/changelog for new version 2009-08-31 18:04:01 -03:00
David Bremner 7c8c5c8e00 extensive updating of debian/copyright to show all copyright holders 2009-08-31 18:00:27 -03:00
David Bremner 3ebef28fe4 Re-flow build-depends. Modify long descriptions to replace mention of
Funambol client libs.  Remove explicit dependence on synthesis shlibs.
2009-08-22 08:52:16 -04:00
David Bremner 57fb55f76f add extremely minimal manpage for sync-ui 2009-08-22 08:29:46 -04:00
David Bremner 5d29a3b7da modify sync-ui long description 2009-08-22 08:17:54 -04:00
David Bremner 627006eb43 remove backup file 2009-08-22 08:02:53 -04:00
David Bremner e3b75901e8 add xsltproc as build dep 2009-08-22 08:01:56 -04:00
David Bremner 830125a6ce split to make new sync-ui binary package 2009-08-22 07:43:58 -04:00
David Bremner 759904bd01 install sync-ui 2009-08-22 07:33:51 -04:00
David Bremner bb7e9ab56d enable gui in configuration 2009-08-22 07:18:25 -04:00
David Bremner cda1d90b09 remove debian/clean from debian/clean 2009-08-22 07:14:49 -04:00
David Bremner ac94ff1b50 add build depends for gnome ui 2009-08-22 07:14:07 -04:00
David Bremner 64a2fdb1ea add convenience script to set up remotes 2009-08-22 00:06:30 -04:00
David Bremner 5ba1286508 clean up automake droppings 2009-08-21 14:36:19 -04:00
David Bremner ee5d5a0ac8 add debian/install to put files in different directories 2009-08-21 10:25:20 -04:00
David Bremner 6feeb68d9e override install dest 2009-08-21 10:05:54 -04:00
David Bremner 440e91c461 remove /usr/sbin from debian/dirs 2009-08-20 22:14:28 -04:00
David Bremner 9872ae78a2 add whatis entry 2009-08-20 22:13:26 -04:00
David Bremner 251a57a803 mangle version numbers to remove +dsNN 2009-08-20 22:09:42 -04:00
David Bremner cd5e41c7fc add libexecdir to config 2009-08-20 21:52:18 -04:00
David Bremner f180a316fa add watchfile 2009-08-20 21:48:24 -04:00
David Bremner ff300cdcef fix bad section in synccompare.1 2009-08-17 09:37:07 -03:00
David Bremner 40ed3b453b add Homepage to source package 2009-08-17 09:35:18 -03:00
David Bremner 9656ceec00 quick and dirty man pages 2009-08-17 09:35:11 -03:00
David Bremner b7a63e00ca add dependency on debhelper 7.0.50 2009-08-17 08:24:28 -03:00
David Bremner 4128d5808b describe how upstream tarball is built. Remove discussion of
libsynthesis, since it is no long distributed in source or binary from this package.
2009-08-17 00:24:15 -03:00
David Bremner 5f93eab167 add +ds1 suffix to upstream version 2009-08-17 00:23:10 -03:00
David Bremner 7486653fd2 add build depends for autogen.sh 2009-08-17 00:17:52 -03:00
David Bremner 626fb8b3d1 call autogen.sh now that we are building from git 2009-08-17 00:12:28 -03:00
David Bremner da2967f98b bump version 2009-08-17 00:07:34 -03:00
David Bremner dbd379e732 add git-orig-source rule 2009-08-17 00:07:34 -03:00
David Bremner 43e37ace7b put back libsynthesis-dev dependency 2009-08-17 00:07:33 -03:00
David Bremner 1b3c4172c8 Put back libboost-dev dependency 2009-08-17 00:07:33 -03:00
David Bremner 6ffcc5bb6e set config prefix to /etc 2009-08-17 00:07:33 -03:00
David Bremner 581e4f93ca Revert "add dependency on libboost-dev, libpcre3-dev, libsqlite3-dev."
Should not be needed with seperate libsynthesis

This reverts commit 875b801d9c3df3b34fe34b7fad5d3bc6d1ee3276.

Conflicts:

	debian/control
2009-08-17 00:07:33 -03:00
David Bremner 094c59b6cf add dependency on synthesis shared libs. 2009-08-17 00:07:33 -03:00
David Bremner 13c482c478 change prefix 2009-08-17 00:07:33 -03:00
David Bremner e426251089 add dependency on libsynthesis-dev 2009-08-17 00:07:33 -03:00
David Bremner 7631f79e86 override configure to skip synthesis build 2009-08-17 00:07:33 -03:00
David Bremner 0944b1f3be add copyright section for libsynthesis 2009-08-17 00:07:33 -03:00
David Bremner d574a8bec8 add dependency on libboost-dev, libpcre3-dev, libsqlite3-dev. These are all for libsynthesis, which should be split out from the packaging. 2009-08-17 00:07:33 -03:00
David Bremner bf00769769 update debian/changelog for new version 2009-08-17 00:07:33 -03:00
David Bremner 9a0f65670b add (mandatory) description of upstream source to debian/copyright 2009-08-17 00:07:33 -03:00
David Bremner 198a63857a try depending on the gnutls version of libcurl 2009-08-17 00:07:33 -03:00
David Bremner 7144a3da44 first attempt at debian/copyright 2009-08-17 00:07:33 -03:00
David Bremner 6930da8c6c compat file for debhelper 7, standard debian/dirs 2009-08-17 00:07:33 -03:00
David Bremner 115df974d6 new minimal debian/rules 2009-08-17 00:07:33 -03:00
David Bremner 8e784ce153 new debian/control 2009-08-17 00:07:32 -03:00
David Bremner 0154ee2991 new changelog 2009-08-17 00:07:32 -03:00
David Bremner 04b640eadb remove upstream debian packaging 2009-08-17 00:07:32 -03:00
368 changed files with 11868 additions and 44425 deletions

133
.gitignore vendored
View File

@ -1,133 +0,0 @@
# general
*.la
*.lo
*.o
*.pyc
*~
.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
/install-sh
/libtool
/ltmain.sh
/m4
/missing
/mkinstalldirs
/README
/README.html
/stamp-h1
/syncevolution.1
/syncevolution-*.tar.gz
/test-driver
# for Maemo build
/libsynthesis
# 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 =
@ -132,7 +126,7 @@ TYPE_rpm = -R
# - same for kdepimlibs5 -> libakonadi-kde4
# - 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$(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)'"
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
@ -140,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 | libical1 | libical1a | libical2
endif
VERSION_deb = 1:$(STABLE_VERSION)$(VERSION)
VERSION_rpm = `echo $(VERSION) | sed -e s/-/_/g`
RELEASE = 2
@ -179,6 +170,7 @@ deb rpm : checkinstall/dist/$(distdir) checkinstall/dist/debian/control
$(TYPE_$@) \
$(REQUIRES_$@) \
--fstrans=yes \
--install=no \
--strip=no \
--pkgversion=$(VERSION_$@) \
--pkgrelease=$(RELEASE) \
@ -200,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
@ -220,6 +213,7 @@ SYNCEVOLUTION_evolution_DEB_ARGS = \
--conflicts=syncevolution-foobar \
--replaces=syncevolution-foobar
SYNCEVOLUTION_evolution_DEB_REQUIRES = \
, evolution-data-server \
, $(EXTRA_BACKENDS_EBOOK_REQUIRES) \
, $(EXTRA_BACKENDS_ECAL_REQUIRES)
@ -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='$*' \
@ -351,9 +345,10 @@ 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;' \
@ -365,6 +360,14 @@ README.patched.rst: README.rst src/syncevolution
-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

83
NEWS
View File

@ -1,3 +1,86 @@
SyncEvolution 1.5.3 -> 2.0.0, 21.03.2021
========================================
This release modernizes the code base and removes usage of out-dated
libraries and APIs. All Python scripts require Python 3. The major
version bump reflects that this release is not just a minor bug fix.
However, no new features were added.
Binaries on syncevolution.org get built for distros >= Ubuntu Bionic
and Debian Buster. Testing is now based on Docker containers instead
of a custom schroot solution, so adding testing against other distros
will be easier in the future. Compilation on Fedora Rawhide was
already added.
Some features are no longer built and thus untested:
- ActiveSync
- KDE
The code is still there, but needs help from interested developers to
ensure that it really works. It may get removed in a future version if
there is no interest.
SyncEvolution 1.5.2 -> 1.5.3, 03.01.2018
========================================
Maintenance release. syncevolution.org binaries are now getting
compiled for distros >= Ubuntu Xenial 16.04 LTS. Usage of deprecated
libraries (GNOME keyring) and APIs (SoupAsyncSession) was
replaced. libical v3 is supported.
The code now compiles more cleanly with recent compilers and depends
on C++11 support.
Details:
* 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.
* 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.
* C++: replace auto_ptr with unique_ptr, require C++11
auto_ptr has been deprecated for a while now. unique_ptr can
be taken for granted now, so use that instead.
* 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
* 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.
* 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.
Original author: Milan Crha
* syncevolution.org: fixed packaging (FDO #98014, FDO #100549)
The activesyncd package missing dependencies on libgnome-keyring0 and
libglib2.0-bin and therefore failed to work when installed on a minimal
system without those.
* various build and test fixes/workarounds
SyncEvolution 1.5.1 -> 1.5.2, 08.11.2016
========================================

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

@ -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.5.2])])
AC_INIT([syncevolution], [m4_esyscmd([build/gen-git-version.sh 2.0.0])])
# STABLE_VERSION=1.0.1+
AC_SUBST(STABLE_VERSION)
@ -62,6 +62,19 @@ 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.
@ -70,8 +83,17 @@ 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],
[])
@ -223,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"
@ -477,6 +496,18 @@ 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=args],
@ -498,33 +529,15 @@ if test "$enable_dbus_service" != "no" && test "$enable_dbus_service" != "yes";
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" != "no"; then
if test -z "$XSLT"; then
@ -559,74 +572,7 @@ if test "$enable_dbus_service" != "no"; then
MLITE_LIBS=
fi
AC_DEFINE(DBUS_SERVICE, 1, [define if dbus service is enabled])
AC_ARG_ENABLE(dbus-service-pim,
AS_HELP_STRING([--enable-dbus-service-pim[=<locale>]],
[Enable implementation of org._01.pim D-Bus APIs (depends on libfolks),
using src/dbus/server/pim/locale-factory-<locale>.cpp to implement sorting
and searching. The default is <locale>=boost, which uses boost::locale.]),
[ enable_dbus_pim="$enableval" ],
[ enable_dbus_pim="no" ])
case "$enable_dbus_pim" in
no) ;;
*)
if test "$enable_dbus_pim" = "yes"; then
enable_dbus_pim=boost
fi
if ! test -r "$srcdir/src/dbus/server/pim/locale-factory-$enable_dbus_pim.cpp"; then
AC_MSG_ERROR([invalid value '$enable_dbus_pim' for --enable-dbus-service-pim, $srcdir/src/dbus/server/pim/locale-factory-$enable_dbus_pim.cpp does not exist or is not readable])
fi
PKG_CHECK_MODULES(FOLKS, [folks folks-eds])
AC_DEFINE(ENABLE_DBUS_PIM, 1, [org._01.pim D-Bus API enabled])
DBUS_PIM_PLUGIN=$enable_dbus_pim
AC_SUBST(DBUS_PIM_PLUGIN)
case "$enable_dbus_pim" in
boost)
AX_BOOST_LOCALE
# AX_BOOST_LOCALE incorrectly puts -L/... into LDFLAGS.
# That's broken because it then overrides the search path
# for *all* libraries in a link, not just for boost. Fix
# this by putting the LDFLAGS before the lib and leaving
# DBUS_PIM_PLUGIN_LDFLAGS empty (for now - might have to
# be revised if there ever are any boost flags which need
# to go to the start of the link line).
DBUS_PIM_PLUGIN_LIBS='$(BOOST_LDFLAGS) $(BOOST_LOCALE_LIB)'
DBUS_PIM_PLUGIN_LDFLAGS=
# We need to call ICU directly for the Han->Latin transformation.
PKG_CHECK_MODULES(ICU, [icu-uc icu-i18n])
;;
esac
AC_SUBST(DBUS_PIM_PLUGIN_CFLAGS)
AC_SUBST(DBUS_PIM_PLUGIN_LIBS)
AC_SUBST(DBUS_PIM_PLUGIN_LDFLAGS)
# http://code.google.com/p/libphonenumber/
AC_LANG(C++)
SAVED_CPPFLAGS=$CPPFLAGS
if test ! "$PHONENUMBERS_CFLAGS"; then
PHONENUMBERS_CFLAGS=-DI18N_PHONENUMBERS_USE_BOOST
fi
CPPFLAGS="$CPPFLAGS ${PHONENUMBERS_CFLAGS}"
AC_CHECK_HEADERS([phonenumbers/phonenumberutil.h])
SAVED_LIBS=$LIBS
if test ! "$PHONENUMBERS_LIBS"; then
PHONENUMBERS_LIBS=-lphonenumber
fi
LIBS="$LIBS $PHONENUMBERS_LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include <phonenumbers/phonenumberutil.h>],
[i18n::phonenumbers::PhoneNumberUtil::GetInstance()])],
[true],
[AC_ERROR([libphonebook not found, set PHONENUMBERS_CFLAGS and PHONENUMBERS_LIBS.])])
AC_SUBST(PHONENUMBERS_CFLAGS)
AC_SUBST(PHONENUMBERS_LIBS)
LIBS=$SAVED_LIBS
CPPFLAGS=$SAVED_CPPFLAGS
;;
esac
fi
AM_CONDITIONAL([COND_DBUS_PIM], [test "$enable_dbus_pim" != "no"])
AC_SUBST(DBUS_CFLAGS)
AC_SUBST(DBUS_LIBS)
@ -718,14 +664,6 @@ AC_SUBST(GUI_LIBS)
AC_SUBST(GUI_PROGRAMS)
AC_SUBST(GUI_DESKTOP_FILES)
# C++ regular expression support is required often enough to make it
# mandatory.
PKG_CHECK_MODULES(PCRECPP, libpcrecpp,,
AC_CHECK_LIB(pcrecpp,main,
AC_SUBST(PCRECPP_LIBS,-lpcrecpp),
AC_MSG_ERROR([pcrecpp not found])
))
# need rst2man for man pages
AC_ARG_WITH(rst2man,
AS_HELP_STRING([--with-rst2man=<path to reStructuredText to man converter>],
@ -1132,7 +1070,6 @@ 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"

42
debian/NEWS vendored Normal file
View File

@ -0,0 +1,42 @@
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)
must be updated manually, because the server has encoding problems when
using vCard 3.0 (now the default for Evolution contacts):
syncevolution --configure \
syncFormat=text/x-vcard \
mobical addressbook
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:
syncevolution configure \
enableRefreshSync=TRUE \
funambol
-- Tino Keitel <tino+debian@tikei.de> Thu, 28 Jun 2012 08:01:52 +0200
syncevolution (1.1.99.5a-1) experimental; urgency=low
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.
In particular, it probably won't work with the version of evolution in
squeeze.
-- David Bremner <bremner@debian.org> Tue, 08 Mar 2011 17:01:37 -0400

11
debian/README.Debian vendored Normal file
View File

@ -0,0 +1,11 @@
Hints for server operation
^^^^^^^^^^^^^^^^^^^^^^^^^^
One SyncEvolution instance can currently provide data for one user only.
If you want to setup a SyncEvolution server headless without using an
Evolution Data Server with plain file storage, you can use the file storage
as described here:
http://syncevolution.org/wiki/http-server-howto

3
debian/TODO vendored Normal file
View File

@ -0,0 +1,3 @@
* 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>

417
debian/changelog vendored Normal file
View File

@ -0,0 +1,417 @@
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.
Thanks to Gregor Herrmann for the patch. (Closes: #679657)
* New upstream release (Closes: #682280, #684077, #694004, #722044)
* Use multiarch paths for shared object files
* Raise debhelper compatibility level to 9
* Build with --as-needed and with hardening flags enabled
* Depend on recent libsynthesis, to pull in the fix for #694005
* Added upstream patch 0001-GTK-GTK3-UI-fix-crash-on-64-bit.patch to fix a
segmentation fault in sync-ui when built with hardening=+pie
-- Tino Keitel <tino+debian@tikei.de> Tue, 01 Oct 2013 10:52:25 +0200
syncevolution (1.2.99.1-1.1) unstable; urgency=low
* Non-maintainer upload.
* dbus-auto-activation.patch: new patch backported from upstream; fix
D-Bus auto-activation. Thanks to Josselin Mouette for pointing to the
relevant commit. (Closes: #699852)
-- Sébastien Villemot <sebastien@debian.org> Mon, 01 Apr 2013 20:12:55 +0200
syncevolution (1.2.99.1-1) unstable; urgency=low
* New upstream release candidate (Closes: #675288)
* Use DEB_REF instead of UPSTREAM_REF for git based patch creation
* Add libpcre3-dev and libcppunit-dev build dependencies
* New library package for libgdbussyncevo
* Install new syncevo-dbus-helper binary
* Document possible issues when upgrading from 1.2.x in NEWS
-- Tino Keitel <tino+debian@tikei.de> Fri, 29 Jun 2012 12:42:18 +0200
syncevolution (1.2.2-1) unstable; urgency=medium
* New upstream version
* Fix upgrade from squeeze (Closes: #657001)
* Re-add sync-ui icon file (Closes: #658519)
-- Tino Keitel <tino+debian@tikei.de> Mon, 06 Feb 2012 19:33:08 +0100
syncevolution (1.2.1-1) unstable; urgency=low
* New upstream release
* Update build dependencies to current libsynthesis
* Remove 0001-README-crucial-syncURL-was-missing.patch, included upstream
-- Tino Keitel <tino+debian@tikei.de> Mon, 19 Dec 2011 21:35:51 +0100
syncevolution (1.1.99.5a-2) unstable; urgency=low
* Upload to unstable
* New maintainer: me. Thanks David for the great work. (Closes: #624540)
* Replace "!kfreebsd-*" and "!hurd-*" build depencendies with "linux-any"
as bluez is only available on Linux (Closes: #634747)
* Add 0001-README-crucial-syncURL-was-missing.patch which contains a
small CalDAV/CardDAV documentation fix from upstream git
* Rework package descriptions to mention new features
* Add README.Debian with some hints for HTTP server operation
* Correctly enable CalDAV/WebDAV in the configure call (Closes: #624642)
-- Tino Keitel <tino+debian@tikei.de> Wed, 03 Aug 2011 15:18:46 +0200
syncevolution (1.1.99.5a-1) experimental; urgency=low
* New upstream version 1.1.99.5a, first release candiate for 1.2
* Added python-openssl dependency, the HTTP server needs it for HTTPS support
* Added versioned dependency on libsynthesis0 to get required features
* Fixed .orig.tar.gz generation in get-orig-source target
* Added myself to Uploaders:, thanks to David for sponsoring
* Use updated upstream tag for source package generation
* Removed 0001-Replace-with-in-call-to-PKG_CHECK_MODULES.patch, fixed upstream
* Renamed NEWS.Debian to NEWS so that it is actually used
* Updated NEWS for 1.1.99.5a
-- Tino Keitel <tino+debian@tikei.de> Wed, 20 Jul 2011 16:02:02 +0200
syncevolution (1.1.99.4+ds1-1) experimental; urgency=low
* New upstream release candidate
* Rebuilt against new libsynthesis (Closes: #615263)
* Removed icalstrdup patch, now upstream.
* Enable CalDAV/CardDAV (Closes: #624642)
* Bump Standards-Version to 3.9.2 (no changes)
* New binary packages: libsyncevolution0, libsyncevo-dbus0
syncevolution-libs
-- David Bremner <bremner@debian.org> Fri, 03 Jun 2011 21:56:26 -0300
syncevolution (1.1.99.3+ds1-1) experimental; urgency=low
* New upstream (pre-release) version
* Remove two s390 related patches, now contained in upstream
commit 63d76f874270cbafb2.
-- David Bremner <bremner@debian.org> Tue, 08 Mar 2011 16:05:30 -0400
syncevolution (1.1+ds1-5) unstable; urgency=low
* patch: Avoid dependence on PATH_MAX (fixes FTBFS on hurd).
* patch: Add a second translation between sysync::memSize and size_t
(Closed: #604840)
* Move synccompare man page to syncevolution-common
-- David Bremner <bremner@debian.org> Sun, 28 Nov 2010 10:27:11 -0400
syncevolution (1.1+ds1-4) experimental; urgency=low
* 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.
-- David Bremner <bremner@debian.org> Wed, 24 Nov 2010 15:10:00 -0800
syncevolution (1.1+ds1-3) experimental; urgency=low
* Upload to experimental to test autobuilding, particularly on Hurd.
-- David Bremner <bremner@debian.org> Sun, 21 Nov 2010 08:37:48 -0800
syncevolution (1.1+ds1-2) experimental; urgency=low
* Update conflicts/replaces for syncevolution-common. Thanks to Simon
McVittie for the report, and the fix. (Closes: #603023).
-- David Bremner <bremner@debian.org> Wed, 10 Nov 2010 16:32:55 -0400
syncevolution (1.1+ds1-1) experimental; urgency=low
[ David Bremner ]
* New upstream release (Closes: #582376)
* Update maintainer address
* New binary package syncevolution-http for syncevo-http-server
(Closes: #573265)
* 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.
* add dbus-server-sync.py and syncevo-phone-config.py to syncevolution
examples
-- David Bremner <bremner@debian.org> Mon, 08 Nov 2010 19:59:29 -0400
syncevolution (1.0+ds1~beta2a-1) unstable; urgency=low
* New upstream beta (Closes: #572640)
* According to http://bugzilla.moblin.org/show_bug.cgi?id=8758,
syncevolution is now smarter about retrying in certain situations.
(Closes: #565527).
* Update Standard-Version to 3.8.4 (No changes).
-- David Bremner <bremner@unb.ca> Fri, 26 Feb 2010 15:45:00 -0400
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
(Closes: #566940)
-- David Bremner <bremner@unb.ca> Tue, 26 Jan 2010 23:28:44 -0400
syncevolution (1.0+ds1~a1-1) experimental; urgency=low
* New Upstream Version
* Development snapshot, use with caution.
-- David Bremner <bremner@unb.ca> Sun, 17 Jan 2010 22:07:03 -0400
syncevolution (0.9.1+ds1-1) unstable; urgency=low
* New Upstream Version
* Standards Version 3.8.3 (no changes)
* Convert to source package format 3.0 (quilt)
-- David Bremner <bremner@unb.ca> Fri, 20 Nov 2009 07:55:54 -0400
syncevolution (0.9+ds1-2) unstable; urgency=low
* Major update to debian/changelog to list all copyright holders.
-- David Bremner <bremner@unb.ca> Fri, 20 Nov 2009 07:55:03 -0400
syncevolution (0.9+ds1-1) unstable; urgency=low
* Initial release (Closes: #404942)
-- David Bremner <bremner@unb.ca> Sun, 16 Aug 2009 23:53:47 -0300

212
debian/control vendored Normal file
View File

@ -0,0 +1,212 @@
Source: syncevolution
Section: utils
Priority: optional
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:
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.
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 the CLI client.
Package: sync-ui
Architecture: any
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.
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 a GTK+ graphical user interface.
Package: syncevolution-common
Architecture: all
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.
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 common architecture independent files.
Package: syncevolution-libs
Architecture: any
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.
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.
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:
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.
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 D-Bus services.
Package: syncevolution-http
Architecture: all
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.
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 a python script to make SyncEvolution act as a HTTP(S)
server for other SyncML clients.
Package: libsyncevolution0
Architecture: any
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.
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 a shared library.
Package: libsyncevo-dbus0
Architecture: any
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.
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 a shared library.
Package: libgdbussyncevo0
Architecture: any
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.
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 a shared library.

280
debian/copyright vendored Normal file
View File

@ -0,0 +1,280 @@
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:
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.
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: 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/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+
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.
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
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:
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+
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

1
debian/dirs vendored Normal file
View File

@ -0,0 +1 @@
usr/bin

3
debian/docs vendored Normal file
View File

@ -0,0 +1,3 @@
HACKING
NEWS
README

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

3
debian/git-init-remotes.sh vendored Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
git remote add meego git://gitorious.org/meego-middleware/syncevolution.git

1
debian/libgdbussyncevo0.install vendored Normal file
View File

@ -0,0 +1 @@
usr/lib/*/libgdbussyncevo.so.*

2
debian/libsyncevo-dbus0.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/*/libsyncevo-dbus.so.0
usr/lib/*/libsyncevo-dbus.so.0.0.0

2
debian/libsyncevolution0.install vendored Normal file
View File

@ -0,0 +1,2 @@
usr/lib/*/libsyncevolution.so.0
usr/lib/*/libsyncevolution.so.0.0.0

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

39
debian/rules vendored Executable file
View File

@ -0,0 +1,39 @@
#!/usr/bin/make -f
# -*- makefile -*-
export DEB_CXXFLAGS_APPEND = -std=c++14
export CONFIG_SHELL=/bin/bash
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_autoreconf:
dh_autoreconf ./autogen.sh
override_dh_auto_configure:
dh_auto_configure -- --with-synthesis-src=none --prefix=/usr \
--sysconfdir=/etc \
--enable-gui \
--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_missing:
dh_missing
override_dh_makeshlibs:
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

1
debian/source/format vendored Normal file
View File

@ -0,0 +1 @@
3.0 (quilt)

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 *

13
debian/sync-ui.1 vendored Normal file
View File

@ -0,0 +1,13 @@
.TH --VERSION: "1" "August 2009" "SyncEvolution 0.9" "User Commands"
.SH NAME
sync-ui \- Graphical interface to syncevolution SyncML client
.SH DESCRIPTION
.nf
Usage: sync-ui
sync-ui provides a graphical interface to configure synchronization
sources and sync the local Evolution addressbook, calendar, and so on.
.fi

3
debian/sync-ui.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin/sync-ui /usr/bin
usr/share/applications/sync.desktop
usr/share/icons/hicolor/48x48/apps/sync.png

1
debian/sync-ui.manpages vendored Normal file
View File

@ -0,0 +1 @@
debian/sync-ui.1

36
debian/synccompare.1 vendored Normal file
View File

@ -0,0 +1,36 @@
.TH --VERSION: "1" "August 2009" "SyncEvolution 0.9" "User Commands"
.SH NAME
synccompare \- normalize or compare addressbook files
.SH DESCRIPTION
.nf
Usage: synccompare <file>
synccompare <left file> <right file>
Either normalizes a file or compares two of them in a side-by-side
diff.
Checks environment variables:
CLIENT_TEST_SERVER=funambol|scheduleworld|egroupware|synthesis
Enables code which simplifies the text files just like
certain well-known servers do. This is useful for testing
to ignore the data loss introduced by these servers or (for
users) to simulate the effect of these servers on their data.
CLIENT_TEST_CLIENT=evolution|addressbook (Mac OS X/iPhone)
Same as for servers this replicates the effect of storing
data in the clients.
CLIENT_TEST_LEFT_NAME="before sync"
CLIENT_TEST_RIGHT_NAME="after sync"
CLIENT_TEST_REMOVED="removed during sync"
CLIENT_TEST_ADDED="added during sync"
Setting these variables changes the default legend
print above the left and right file during a
comparison.
CLIENT_TEST_COMPARISON_FAILED=1
Overrides the default error code when changes are found.
.fi

4
debian/syncevolution-common.install vendored Normal file
View File

@ -0,0 +1,4 @@
usr/bin/synccompare
usr/bin/syncevo-webdav-lookup
usr/share/locale/*/LC_MESSAGES/syncevolution.mo
usr/share/syncevolution

1
debian/syncevolution-common.manpages vendored Normal file
View File

@ -0,0 +1 @@
debian/synccompare.1

6
debian/syncevolution-dbus.install vendored Normal file
View File

@ -0,0 +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

1
debian/syncevolution-http.docs vendored Normal file
View File

@ -0,0 +1 @@
debian/README.Debian

1
debian/syncevolution-http.install vendored Normal file
View File

@ -0,0 +1 @@
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

12
debian/syncevolution-libs.install vendored Normal file
View File

@ -0,0 +1,12 @@
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

3
debian/syncevolution.docs vendored Normal file
View File

@ -0,0 +1,3 @@
debian/tmp/usr/share/doc/syncevolution/NEWS
debian/tmp/usr/share/doc/syncevolution/README
debian/tmp/usr/share/doc/syncevolution/README.*

5
debian/syncevolution.examples vendored Normal file
View File

@ -0,0 +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

1
debian/syncevolution.install vendored Normal file
View File

@ -0,0 +1 @@
usr/bin/syncevolution

1
debian/syncevolution.manpages vendored Normal file
View File

@ -0,0 +1 @@
debian/tmp/usr/share/man/man1/syncevolution.1

10
debian/watch vendored Normal file
View File

@ -0,0 +1,10 @@
version=4
# check: uscan --report
# update: gbp import-orig --upstream-vcs-tag=vX.Y.Z --uscan
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@

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

@ -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

@ -1,4 +1,3 @@
src/gtk-ui/ui.xml
src/gtk-ui/gtkinfobar.c
src/synthesis/src/pcre/pcre_compile.c
src/dbus/server/pim/testpim.py

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

@ -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

@ -58,7 +58,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
// 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;
@ -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;
@ -142,7 +142,7 @@ 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(SE_HERE, "no server ID for new eas item");
}
@ -155,13 +155,13 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
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) {
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(SE_HERE, "no server ID for updated eas item");
}
@ -174,13 +174,13 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
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) {
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(SE_HERE, "no server ID for deleted eas item");
}
@ -192,7 +192,7 @@ void ActiveSyncCalendarSource::beginSync(const std::string &lastToken, const std
if (event.m_subids.empty()) {
SE_LOG_DEBUG(getDisplayName(), "deleted eas item %s empty?!", easid.c_str());
} else {
BOOST_FOREACH(const std::string &subid, event.m_subids) {
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,10 +218,10 @@ 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) {
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());
@ -298,7 +298,7 @@ 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(SE_HERE, STATUS_NOT_FOUND, "merged event not found: " + easid);
}
@ -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)) {
@ -653,7 +653,7 @@ void ActiveSyncCalendarSource::deleteItem(const string &luid)
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);
@ -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

@ -88,13 +88,13 @@ void ActiveSyncSource::findCollections(const std::string &account, const bool fo
if (!eas_sync_handler_get_folder_list (handler,
force_update,
folders,
NULL,
nullptr,
gerror)) {
gerror.throwError(SE_HERE, "fetching folder list");
}
/* Save the Collections */
BOOST_FOREACH(EasFolder *folder, folders) {
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;
@ -103,7 +103,7 @@ void ActiveSyncSource::findCollections(const std::string &account, const bool fo
}
/* Save the full paths */
BOOST_FOREACH(std::string id, m_collections | boost::adaptors::map_keys) {
for (std::string id: m_collections | boost::adaptors::map_keys) {
m_folderPaths[m_collections[id].fullPath()] = id;
}
}
@ -165,7 +165,7 @@ ActiveSyncSource::Databases ActiveSyncSource::getDatabases()
findCollections(account, true);
BOOST_FOREACH(Collection coll, m_collections | boost::adaptors::map_values) {
for (Collection coll: m_collections | boost::adaptors::map_values) {
if (coll.getFolderType() == getEasType()) {
result.push_back(Database(coll.pathName, coll.collectionId, coll.collectionIsDefault()));
}
@ -192,7 +192,7 @@ std::string ActiveSyncSource::lookupFolder(const std::string &folder) {
}
// Lookup folder name
FolderPaths::const_iterator entry = m_folderPaths.find(key);
auto entry = m_folderPaths.find(key);
if (entry != m_folderPaths.end()) {
return entry->second;
}
@ -242,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)
@ -278,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;
@ -315,7 +315,7 @@ 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(SE_HERE, "no server ID for new eas item");
}
@ -331,7 +331,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
}
m_items[luid] = item->data;
}
BOOST_FOREACH(EasItemInfo *item, updated) {
for (EasItemInfo *item: updated) {
if (!item->server_id) {
throwError(SE_HERE, "no server ID for updated eas item");
}
@ -347,7 +347,7 @@ void ActiveSyncSource::beginSync(const std::string &lastToken, const std::string
}
m_items[luid] = item->data;
}
BOOST_FOREACH(const char *serverID, deleted) {
for (const char *serverID: deleted) {
if (!serverID) {
throwError(SE_HERE, "no server ID for deleted eas item");
}
@ -379,7 +379,7 @@ 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(getDisplayName(), "existing item %s", luid.c_str());
addItem(luid, ANY);
@ -523,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");

View File

@ -31,8 +31,6 @@
#include <syncevo/SmartPtr.h>
#include <syncevo/GLibSupport.h>
#include <boost/bind.hpp>
#include <string>
#include <map>
@ -135,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) {
@ -143,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 */
@ -183,11 +181,11 @@ class ActiveSyncSource :
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:
/** "target-config@<context>" instance which holds our username == ActiveSync account ID */
boost::shared_ptr<SyncConfig> m_context;
std::shared_ptr<SyncConfig> m_context;
/** account ID for libeas, must be set in "username" config property */
std::string m_account;
@ -206,9 +204,9 @@ 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
@ -231,7 +229,7 @@ class ActiveSyncSource :
Collection() :
type(0),
pathFound(false),
source(NULL)
source(nullptr)
{}
int getFolderType();

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,12 +183,12 @@ 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
@ -201,12 +201,12 @@ static TestingSyncSource *createEASSource(const ClientTestConfig::createsource_t
}
if (res->getDatabaseID().empty()) {
return res.release();
return res;
} else {
// sorry, no database
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

@ -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",
@ -147,59 +147,59 @@ class AkonadiTest : public CppUnit::TestFixture {
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());
// }
@ -209,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 =

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 = src/syncevo/libsyncevolution.la

View File

@ -39,10 +39,6 @@
#include <syncevo/util.h>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/bind.hpp>
#include <QtCore/QDebug>
SE_BEGIN_CXX
@ -56,7 +52,7 @@ using namespace Akonadi;
*
* To avoid double frees, we need to disable auto-deletion.
* This method does that. Use like this:
* std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
* std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
*/
template<class J> J *DisableAutoDelete(J *job) { job->setAutoDelete(false); return job; }
@ -75,12 +71,12 @@ bool AkonadiSyncSource::isEmpty()
{
if (!GRunIsMain()) {
bool result;
GRunInMain(boost::lambda::var(result) = boost::lambda::bind(&AkonadiSyncSource::isEmpty, this));
GRunInMain([this, &result] () { result = isEmpty(); });
return result;
}
//To Check if the respective collection is Empty, without actually loading the collections
std::auto_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
std::unique_ptr<CollectionStatisticsJob> statisticsJob(DisableAutoDelete(new CollectionStatisticsJob(m_collection)));
if (!statisticsJob->exec()) {
throwError(SE_HERE, "Error fetching the collection stats");
}
@ -90,7 +86,7 @@ bool AkonadiSyncSource::isEmpty()
void AkonadiSyncSource::start()
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::start, this));
GRunInMain([this]() { start(); });
return;
}
@ -117,7 +113,7 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
{
if (!GRunIsMain()) {
Databases result;
GRunInMain(boost::lambda::var(result) = boost::lambda::bind(&AkonadiSyncSource::getDatabases, this));
GRunInMain([this, &result] () { result = getDatabases(); });
return result;
}
@ -129,8 +125,8 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
// as the default one used by the source.
// res.push_back("Contacts", "some-KDE-specific-ID", isDefault);
std::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
CollectionFetchJob::Recursive)));
std::unique_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(Collection::root(),
CollectionFetchJob::Recursive)));
fetchJob->fetchScope().setContentMimeTypes(m_mimeTypes);
@ -155,7 +151,7 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
void AkonadiSyncSource::open()
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::open, this));
GRunInMain([this] () { open(); });
return;
}
@ -193,8 +189,8 @@ void AkonadiSyncSource::open()
// 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::auto_ptr<CollectionFetchJob> fetchJob(DisableAutoDelete(new CollectionFetchJob(m_collection,
CollectionFetchJob::Base)));
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()));
}
@ -223,16 +219,16 @@ void AkonadiSyncSource::open()
void AkonadiSyncSource::listAllItems(SyncSourceRevisions::RevisionMap_t &revisions)
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::listAllItems, this, boost::ref(revisions)));
GRunInMain([this, &revisions] () { listAllItems(revisions); });
return;
}
// copy all local IDs and the corresponding revision
std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(m_collection)));
if (!fetchJob->exec()) {
throwError(SE_HERE, "listing items");
}
BOOST_FOREACH (const Item &item, fetchJob->items()) {
for (const Item &item: fetchJob->items()) {
// Filter out items which don't have the right type (for example, VTODO when
// syncing events)
if (m_mimeTypes.contains(item.mimeType())) {
@ -251,7 +247,7 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
{
if (!GRunIsMain()) {
InsertItemResult result;
GRunInMain(boost::lambda::var(result) = boost::lambda::bind(&AkonadiSyncSource::insertItem, this, boost::cref(luid), boost::cref(data), raw));
GRunInMain([this, &result, &luid, &data, raw] () { return insertItem(luid, data, raw); });
return result;
}
@ -260,7 +256,7 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
if (luid.empty()) {
item.setMimeType(m_mimeTypes.front());
item.setPayloadFromData(QByteArray(data.c_str()));
std::auto_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
std::unique_ptr<ItemCreateJob> createJob(DisableAutoDelete(new ItemCreateJob(item, m_collection)));
if (!createJob->exec()) {
throwError(SE_HERE, string("storing new item ") + luid);
return InsertItemResult("", "", ITEM_OKAY);
@ -268,13 +264,13 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
item = createJob->item();
} else {
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
if (!fetchJob->exec()) {
throwError(SE_HERE, string("checking item ") + luid);
}
item = fetchJob->items().first();
item.setPayloadFromData(QByteArray(data.c_str()));
std::auto_ptr<ItemModifyJob> modifyJob(DisableAutoDelete(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
@ -296,7 +292,7 @@ TrackingSyncSource::InsertItemResult AkonadiSyncSource::insertItem(const std::st
void AkonadiSyncSource::removeItem(const string &luid)
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::removeItem, this, boost::cref(luid)));
GRunInMain([this, &luid] () { removeItem(luid); });
return;
}
@ -304,7 +300,7 @@ void AkonadiSyncSource::removeItem(const string &luid)
// Delete the item from our collection
// TODO: check that the revision is right (need revision from SyncEvolution)
std::auto_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
std::unique_ptr<ItemDeleteJob> deleteJob(DisableAutoDelete(new ItemDeleteJob(Item(syncItemId))));
if (!deleteJob->exec()) {
throwError(SE_HERE, string("deleting item " ) + luid);
}
@ -313,13 +309,13 @@ void AkonadiSyncSource::removeItem(const string &luid)
void AkonadiSyncSource::readItem(const std::string &luid, std::string &data, bool raw)
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::readItem, this, boost::cref(luid), boost::ref(data), raw));
GRunInMain([this, &luid, &data, raw] () { readItem(luid, data, raw); });
return;
}
Entity::Id syncItemId = QByteArray(luid.c_str()).toLongLong();
std::auto_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
std::unique_ptr<ItemFetchJob> fetchJob(DisableAutoDelete(new ItemFetchJob(Item(syncItemId))));
fetchJob->fetchScope().fetchFullPayload();
if (fetchJob->exec()) {
if (fetchJob->items().empty()) {

View File

@ -14,7 +14,7 @@ if ! test "$KDEPIM_CFLAGS"; then
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"

View File

@ -19,7 +19,6 @@
*/
#include <memory>
using namespace std;
#include "config.h"
@ -36,9 +35,6 @@ using namespace std;
#include "EvolutionMemoSource.h"
#include "e-cal-check-timezones.h"
#include <boost/foreach.hpp>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -62,7 +58,7 @@ void EvolutionCalendarSource::LUIDs::eraseLUID(const ItemID &id)
{
iterator it = find(id.m_uid);
if (it != end()) {
set<string>::iterator it2 = it->second.find(id.m_rid);
auto it2 = it->second.find(id.m_rid);
if (it2 != it->second.end()) {
it->second.erase(it2);
if (it->second.empty()) {
@ -124,7 +120,7 @@ EvolutionCalendarSource::EvolutionCalendarSource(EvolutionCalendarSourceType typ
// This is not available in older Evolution versions.
// A configure check could detect that, but as this isn't
// important the functionality is simply disabled.
m_newSystem = NULL /* e_cal_new_system_memos */;
m_newSystem = nullptr /* e_cal_new_system_memos */;
#endif
break;
default:
@ -144,21 +140,21 @@ SyncSource::Databases EvolutionCalendarSource::getDatabases()
m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS ? e_source_registry_ref_default_calendar :
m_type == EVOLUTION_CAL_SOURCE_TYPE_TASKS ? e_source_registry_ref_default_task_list :
m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS ? e_source_registry_ref_default_memo_list :
NULL);
nullptr);
#else
ESourceList *tmp = NULL;
ESourceList *tmp = nullptr;
if (!e_cal_get_sources(&tmp, sourceType(), gerror)) {
// ignore unspecific errors (like on Maemo with no support for memos)
// and continue with empty list (perhaps defaults work)
if (!gerror) {
tmp = NULL;
tmp = nullptr;
} else {
throwError(SE_HERE, "unable to access backend databases", gerror);
}
}
ESourceListCXX sources(tmp, TRANSFER_REF);
bool first = true;
for (GSList *g = sources ? e_source_list_peek_groups (sources) : NULL;
for (GSList *g = sources ? e_source_list_peek_groups (sources) : nullptr;
g;
g = g->next) {
ESourceGroup *group = E_SOURCE_GROUP (g->data);
@ -184,14 +180,7 @@ SyncSource::Databases EvolutionCalendarSource::getDatabases()
return result;
}
#ifdef USE_EDS_CLIENT
static EClient *newECalClient(ESource *source,
ECalClientSourceType ecalSourceType,
GError **gerror)
{
return E_CLIENT(e_cal_client_new(source, ecalSourceType, gerror));
}
#else
#ifndef USE_EDS_CLIENT
char *EvolutionCalendarSource::authenticate(const char *prompt,
const char *key)
{
@ -200,7 +189,7 @@ char *EvolutionCalendarSource::authenticate(const char *prompt,
SE_LOG_DEBUG(getDisplayName(), "authentication requested, prompt \"%s\", key \"%s\" => %s",
prompt, key,
!passwd.empty() ? "returning configured password" : "no password configured");
return !passwd.empty() ? strdup(passwd.c_str()) : NULL;
return !passwd.empty() ? strdup(passwd.c_str()) : nullptr;
}
#endif
@ -218,15 +207,18 @@ void EvolutionCalendarSource::open()
// be others with similar problems and for local storage it is
// a reasonably cheap operation (so no harm there).
for (int retries = 0; retries < 2; retries++) {
auto create = [type=sourceType()] (ESource *source, GError **gerror) {
return E_CLIENT(e_cal_client_connect_sync(source, type,
-1, // timeout in seconds
nullptr, // cancellable
gerror));
};
m_calendar.reset(E_CAL_CLIENT(openESource(sourceExtension(),
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 :
NULL,
boost::bind(newECalClient,
_1,
sourceType(),
_2)).get()));
nullptr,
create).get()));
}
#else
GErrorCXX gerror;
@ -307,7 +299,7 @@ bool EvolutionCalendarSource::isEmpty()
#ifdef USE_EDS_CLIENT
class ECalClientViewSyncHandler {
public:
typedef boost::function<void(const GSList *list)> Process_t;
typedef std::function<void(const GSList *list)> Process_t;
ECalClientViewSyncHandler(ECalClientViewCXX &view,
const Process_t &process) :
@ -318,12 +310,12 @@ class ECalClientViewSyncHandler {
bool processSync(GErrorCXX &gerror)
{
// Listen for view signals
m_view.connectSignal<void (ECalClientView *ebookview,
const GSList *contacts)>("objects-added",
boost::bind(m_process, _2));
m_view.connectSignal<void (EBookClientView *ebookview,
const GError *error)>("complete",
boost::bind(&ECalClientViewSyncHandler::completed, this, _2));
m_view.connectSignal<ECalClientView *,
const GSList *>()("objects-added",
[this] (ECalClientView *, const GSList *list) { m_process(list); });
m_view.connectSignal<ECalClientView *,
const GError *>()("complete",
[this] (ECalClientView *, const GError *gerror) { completed(gerror); });
// Start the view
e_cal_client_view_start (m_view, m_error);
@ -334,7 +326,7 @@ class ECalClientViewSyncHandler {
// Async -> Sync
m_loop.run();
e_cal_client_view_stop (m_view, NULL);
e_cal_client_view_stop (m_view, nullptr);
if (m_error) {
std::swap(gerror, m_error);
@ -364,21 +356,7 @@ class ECalClientViewSyncHandler {
// Possible error while watching the view
GErrorCXX m_error;
};
static void list_revisions(const GSList *objects, EvolutionCalendarSource::RevisionMap_t *revisions)
{
const GSList *l;
for (l = objects; l; l = l->next) {
icalcomponent *icomp = (icalcomponent*)l->data;
EvolutionCalendarSource::ItemID id = EvolutionCalendarSource::getItemID(icomp);
string luid = id.getLUID();
string modTime = EvolutionCalendarSource::getItemModTime(icomp);
(*revisions)[luid] = modTime;
}
}
#endif
#endif // USE_EDS_CLIENT
void EvolutionCalendarSource::listAllItems(RevisionMap_t &revisions)
{
@ -386,14 +364,29 @@ void EvolutionCalendarSource::listAllItems(RevisionMap_t &revisions)
#ifdef USE_EDS_CLIENT
ECalClientView *view;
if (!e_cal_client_get_view_sync (m_calendar, "#t", &view, NULL, gerror)) {
if (!e_cal_client_get_view_sync (m_calendar, "#t", &view, nullptr, gerror)) {
throwError(SE_HERE, "getting the view" , gerror);
}
ECalClientViewCXX viewPtr = ECalClientViewCXX::steal(view);
// TODO: Optimization: use set fields_of_interest (UID / REV / LAST-MODIFIED)
ECalClientViewSyncHandler handler(viewPtr, boost::bind(list_revisions, _1, &revisions));
auto process = [&revisions] (const GSList *objects) {
const GSList *l;
for (l = objects; l; l = l->next) {
#ifdef HAVE_LIBECAL_2_0
ICalComponent *icomp = (ICalComponent*)l->data;
#else
icalcomponent *icomp = (icalcomponent*)l->data;
#endif
EvolutionCalendarSource::ItemID id = EvolutionCalendarSource::getItemID(icomp);
string luid = id.getLUID();
string modTime = EvolutionCalendarSource::getItemModTime(icomp);
revisions[luid] = modTime;
}
};
ECalClientViewSyncHandler handler(viewPtr, process);
if (!handler.processSync(gerror)) {
throwError(SE_HERE, "watching view", gerror);
}
@ -440,14 +433,26 @@ void EvolutionCalendarSource::readItem(const string &luid, std::string &item, bo
}
#ifdef USE_EDS_CLIENT
#ifdef HAVE_LIBECAL_2_0
ICalTimezone *
#else /* HAVE_LIBECAL_2_0 */
icaltimezone *
#endif /* HAVE_LIBECAL_2_0 */
my_tzlookup(const gchar *tzid,
#ifdef HAVE_LIBECAL_2_0
gpointer ecalclient,
#else
gconstpointer ecalclient,
#endif
GCancellable *cancellable,
GError **error)
{
icaltimezone *zone = NULL;
GError *local_error = NULL;
#ifdef HAVE_LIBECAL_2_0
ICalTimezone *zone = nullptr;
#else
icaltimezone *zone = nullptr;
#endif
GError *local_error = nullptr;
if (e_cal_client_get_timezone_sync((ECalClient *)ecalclient, tzid, &zone, cancellable, &local_error)) {
return zone;
@ -461,7 +466,7 @@ my_tzlookup(const gchar *tzid,
g_propagate_error (error, local_error);
}
return NULL;
return nullptr;
}
#endif
@ -504,7 +509,11 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
SE_LOG_DEBUG(getDisplayName(), "after replacing , with \\, in CATEGORIES:\n%s", data.c_str());
}
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> icomp(i_cal_component_new_from_string((char *)data.c_str()));
#else
eptr<icalcomponent> icomp(icalcomponent_new_from_string((char *)data.c_str()));
#endif
if( !icomp ) {
throwError(SE_HERE, string("failure parsing ical") + data);
@ -515,15 +524,24 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// fix up TZIDs
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_check_timezones(icomp,
NULL,
#ifdef HAVE_LIBECAL_2_0
!e_cal_client_check_timezones_sync(
#else
!e_cal_client_check_timezones(
#endif
icomp,
nullptr,
my_tzlookup,
#ifdef HAVE_LIBECAL_2_0
(gpointer)m_calendar.get(),
#else
(const void *)m_calendar.get(),
NULL,
#endif
nullptr,
gerror)
#else
!e_cal_check_timezones(icomp,
NULL,
nullptr,
e_cal_tzlookup_ecal,
(const void *)m_calendar.get(),
gerror)
@ -535,21 +553,35 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// insert before adding/updating the event so that the new VTIMEZONE is
// immediately available should anyone want it
#ifdef HAVE_LIBECAL_2_0
for (ICalComponent *tcomp = i_cal_component_get_first_component(icomp, I_CAL_VTIMEZONE_COMPONENT);
tcomp;
g_object_unref (tcomp), tcomp = i_cal_component_get_next_component(icomp, I_CAL_VTIMEZONE_COMPONENT)) {
eptr<ICalTimezone> zone(i_cal_timezone_new(), "icaltimezone");
i_cal_timezone_set_component(zone, tcomp);
#else
for (icalcomponent *tcomp = icalcomponent_get_first_component(icomp, ICAL_VTIMEZONE_COMPONENT);
tcomp;
tcomp = icalcomponent_get_next_component(icomp, ICAL_VTIMEZONE_COMPONENT)) {
eptr<icaltimezone> zone(icaltimezone_new(), "icaltimezone");
icaltimezone_set_component(zone, tcomp);
#endif
GErrorCXX gerror;
const char *tzid = icaltimezone_get_tzid(zone);
const char *tzid;
#ifdef HAVE_LIBECAL_2_0
tzid = i_cal_timezone_get_tzid(zone);
#else
tzid = icaltimezone_get_tzid(zone);
#endif
if (!tzid || !tzid[0]) {
// cannot add a VTIMEZONE without TZID
SE_LOG_DEBUG(getDisplayName(), "skipping VTIMEZONE without TZID");
} else {
gboolean success =
#ifdef USE_EDS_CLIENT
e_cal_client_add_timezone_sync(m_calendar, zone, NULL, gerror)
e_cal_client_add_timezone_sync(m_calendar, zone, nullptr, gerror)
#else
e_cal_add_timezone(m_calendar, zone, gerror)
#endif
@ -564,8 +596,14 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// the component to update/add must be the
// ICAL_VEVENT/VTODO_COMPONENT of the item,
// e_cal_create/modify_object() fail otherwise
#ifdef HAVE_LIBECAL_2_0
ICalComponent *subcomp = i_cal_component_get_first_component(icomp,
getCompType());
#else
icalcomponent *subcomp = icalcomponent_get_first_component(icomp,
getCompType());
#endif
if (!subcomp) {
throwError(SE_HERE, "extracting event");
}
@ -573,16 +611,20 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// Remove LAST-MODIFIED: the Evolution Exchange Connector does not
// properly update this property if it is already present in the
// incoming data.
#ifdef HAVE_LIBECAL_2_0
e_cal_util_component_remove_property_by_kind(subcomp, I_CAL_LASTMODIFIED_PROPERTY, TRUE);
#else
icalproperty *modprop;
while ((modprop = icalcomponent_get_first_property(subcomp, ICAL_LASTMODIFIED_PROPERTY)) != NULL) {
while ((modprop = icalcomponent_get_first_property(subcomp, ICAL_LASTMODIFIED_PROPERTY)) != nullptr) {
icalcomponent_remove_property(subcomp, modprop);
icalproperty_free(modprop);
modprop = NULL;
modprop = nullptr;
}
#endif
if (!update) {
ItemID id = getItemID(subcomp);
const char *uid = NULL;
const char *uid = nullptr;
// Trying to add a normal event which already exists leads to a
// gerror->domain == E_CALENDAR_ERROR
@ -628,8 +670,11 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// creating new objects works for normal events and detached occurrences alike
if (
#ifdef USE_EDS_CLIENT
e_cal_client_create_object_sync(m_calendar, subcomp, (gchar **)&uid,
NULL, gerror)
e_cal_client_create_object_sync(m_calendar, subcomp,
#ifdef HAVE_LIBECAL_2_0
E_CAL_OPERATION_FLAG_NONE,
#endif
(gchar **)&uid, nullptr, gerror)
#else
e_cal_create_object(m_calendar, subcomp, (gchar **)&uid, gerror)
#endif
@ -650,12 +695,20 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// Recreate any children removed earlier: when we get here,
// the parent exists and we must update it.
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
#ifdef HAVE_LIBECAL_2_0
for (std::shared_ptr< eptr<ICalComponent> > &icalcomp: children) {
#else
for (std::shared_ptr< eptr<icalcomponent> > &icalcomp: children) {
#endif
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
CALOBJ_MOD_THIS, NULL,
gerror)
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_THIS,
#endif
nullptr, gerror)
#else
!e_cal_modify_object(m_calendar, *icalcomp,
CALOBJ_MOD_THIS,
@ -679,13 +732,33 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// RECURRENCE-ID
if (update) {
if (!id.m_uid.empty()) {
#ifdef HAVE_LIBECAL_2_0
i_cal_component_set_uid(subcomp, id.m_uid.c_str());
#else
icalcomponent_set_uid(subcomp, id.m_uid.c_str());
#endif
}
if (!id.m_rid.empty()) {
// Reconstructing the RECURRENCE-ID is non-trivial,
// because our luid only contains the date-time, but
// not the time zone. Only do the work if the event
// really doesn't have a RECURRENCE-ID.
#ifdef HAVE_LIBECAL_2_0
ICalTime *rid;
rid = i_cal_component_get_recurrenceid(subcomp);
if (!rid || i_cal_time_is_null_time(rid)) {
// Preserve the original RECURRENCE-ID, including
// timezone, no matter what the update contains
// (might have wrong timezone or UTC).
eptr<ICalComponent> orig(retrieveItem(id));
ICalProperty *orig_rid = i_cal_component_get_first_property(orig, I_CAL_RECURRENCEID_PROPERTY);
if (orig_rid) {
i_cal_component_take_property(subcomp, i_cal_property_clone(orig_rid));
}
g_clear_object(&orig_rid);
}
g_clear_object(&rid);
#else
struct icaltimetype rid;
rid = icalcomponent_get_recurrenceid(subcomp);
if (icaltime_is_null_time(rid)) {
@ -698,6 +771,7 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
icalcomponent_add_property(subcomp, icalproperty_new_clone(orig_rid));
}
}
#endif
}
}
@ -708,9 +782,9 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// Therefore we have to use CALOBJ_MOD_ALL, but that removes
// children.
bool hasChildren = false;
LUIDs::const_iterator it = m_allLUIDs.find(id.m_uid);
auto it = m_allLUIDs.find(id.m_uid);
if (it != m_allLUIDs.end()) {
BOOST_FOREACH(const string &rid, it->second) {
for (const string &rid: it->second) {
if (!rid.empty()) {
hasChildren = true;
break;
@ -725,11 +799,14 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
ICalComps_t children = removeEvents(id.m_uid, true);
// Parent is gone, too, and needs to be recreated.
const char *uid = NULL;
const char *uid = nullptr;
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_create_object_sync(m_calendar, subcomp, (char **)&uid,
NULL, gerror)
!e_cal_client_create_object_sync(m_calendar, subcomp,
#ifdef HAVE_LIBECAL_2_0
E_CAL_OPERATION_FLAG_NONE,
#endif
(char **)&uid, nullptr, gerror)
#else
!e_cal_create_object(m_calendar, subcomp, (char **)&uid, gerror)
#endif
@ -742,12 +819,20 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
// Recreate any children removed earlier: when we get here,
// the parent exists and we must update it.
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
#ifdef HAVE_LIBECAL_2_0
for (std::shared_ptr< eptr<ICalComponent> > &icalcomp: children) {
#else
for (std::shared_ptr< eptr<icalcomponent> > &icalcomp: children) {
#endif
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
CALOBJ_MOD_THIS, NULL,
gerror)
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_THIS,
#endif
nullptr, gerror)
#else
!e_cal_modify_object(m_calendar, *icalcomp,
CALOBJ_MOD_THIS,
@ -762,8 +847,12 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, subcomp,
CALOBJ_MOD_ALL, NULL,
gerror)
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_ALL,
#endif
nullptr, gerror)
#else
!e_cal_modify_object(m_calendar, subcomp,
CALOBJ_MOD_ALL,
@ -778,8 +867,12 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, subcomp,
CALOBJ_MOD_THIS, NULL,
gerror)
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_THIS,
#endif
nullptr, gerror)
#else
!e_cal_modify_object(m_calendar, subcomp,
CALOBJ_MOD_THIS,
@ -795,6 +888,11 @@ EvolutionCalendarSource::InsertItemResult EvolutionCalendarSource::insertItem(co
modTime = getItemModTime(newid);
}
#ifdef HAVE_LIBECAL_2_0
// TODO: this object leaks when an exception is thrown. Store in smart pointer.
g_clear_object(&subcomp);
#endif
return InsertItemResult(newluid, modTime, state);
}
@ -802,16 +900,28 @@ EvolutionCalendarSource::ICalComps_t EvolutionCalendarSource::removeEvents(const
{
ICalComps_t events;
LUIDs::const_iterator it = m_allLUIDs.find(uid);
auto it = m_allLUIDs.find(uid);
if (it != m_allLUIDs.end()) {
BOOST_FOREACH(const string &rid, it->second) {
for (const string &rid: it->second) {
ItemID id(uid, rid);
#ifdef HAVE_LIBECAL_2_0
ICalComponent *icomp = retrieveItem(id);
#else
icalcomponent *icomp = retrieveItem(id);
#endif
if (icomp) {
if (id.m_rid.empty() && returnOnlyChildren) {
#ifdef HAVE_LIBECAL_2_0
g_clear_object(&icomp);
#else
icalcomponent_free(icomp);
#endif
} else {
#ifdef HAVE_LIBECAL_2_0
events.push_back(ICalComps_t::value_type(new eptr<ICalComponent>(icomp)));
#else
events.push_back(ICalComps_t::value_type(new eptr<icalcomponent>(icomp)));
#endif
}
}
}
@ -821,9 +931,13 @@ EvolutionCalendarSource::ICalComps_t EvolutionCalendarSource::removeEvents(const
GErrorCXX gerror;
if (!uid.empty() && // e_cal_client_remove_object_sync() in EDS 3.8 aborts the process for empty UID, other versions cannot succeed, so skip the call.
#ifdef USE_EDS_CLIENT
!e_cal_client_remove_object_sync(m_calendar,
uid.c_str(), NULL, CALOBJ_MOD_ALL,
NULL, gerror)
!e_cal_client_remove_object_sync(m_calendar, uid.c_str(), nullptr,
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_ALL, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_ALL,
#endif
nullptr, gerror)
#else
!e_cal_remove_object(m_calendar,
@ -862,14 +976,21 @@ void EvolutionCalendarSource::removeItem(const string &luid)
// recreate children
bool first = true;
BOOST_FOREACH(boost::shared_ptr< eptr<icalcomponent> > &icalcomp, children) {
#ifdef HAVE_LIBECAL_2_0
for (std::shared_ptr< eptr<ICalComponent> > &icalcomp: children) {
#else
for (std::shared_ptr< eptr<icalcomponent> > &icalcomp: children) {
#endif
if (first) {
char *uid;
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_create_object_sync(m_calendar, *icalcomp, &uid,
NULL, gerror)
!e_cal_client_create_object_sync(m_calendar, *icalcomp,
#ifdef HAVE_LIBECAL_2_0
E_CAL_OPERATION_FLAG_NONE,
#endif
&uid, nullptr, gerror)
#else
!e_cal_create_object(m_calendar, *icalcomp, &uid, gerror)
#endif
@ -884,8 +1005,12 @@ void EvolutionCalendarSource::removeItem(const string &luid)
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_modify_object_sync(m_calendar, *icalcomp,
CALOBJ_MOD_THIS, NULL,
gerror)
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_THIS, E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_THIS,
#endif
nullptr, gerror)
#else
!e_cal_modify_object(m_calendar, *icalcomp,
CALOBJ_MOD_THIS,
@ -900,15 +1025,24 @@ void EvolutionCalendarSource::removeItem(const string &luid)
// workaround for EDS 2.32 API semantic: succeeds even if
// detached recurrence doesn't exist and adds EXDATE,
// therefore we have to check for existence first
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> item(retrieveItem(id));
#else
eptr<icalcomponent> item(retrieveItem(id));
#endif
gboolean success = !item ? false :
#ifdef USE_EDS_CLIENT
// TODO: is this necessary?
e_cal_client_remove_object_sync(m_calendar,
id.m_uid.c_str(),
id.m_rid.c_str(),
#ifdef HAVE_LIBECAL_2_0
E_CAL_OBJ_MOD_ONLY_THIS,
E_CAL_OPERATION_FLAG_NONE,
#else
CALOBJ_MOD_ONLY_THIS,
NULL,
#endif
nullptr,
gerror)
#else
e_cal_remove_object_with_mod(m_calendar,
@ -951,23 +1085,31 @@ void EvolutionCalendarSource::removeItem(const string &luid)
}
}
#ifdef HAVE_LIBECAL_2_0
ICalComponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
#else
icalcomponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
#endif
{
GErrorCXX gerror;
icalcomponent *comp = NULL;
#ifdef HAVE_LIBECAL_2_0
ICalComponent *comp = nullptr;
#else
icalcomponent *comp = nullptr;
#endif
if (
#ifdef USE_EDS_CLIENT
!e_cal_client_get_object_sync(m_calendar,
id.m_uid.c_str(),
!id.m_rid.empty() ? id.m_rid.c_str() : NULL,
!id.m_rid.empty() ? id.m_rid.c_str() : nullptr,
&comp,
NULL,
nullptr,
gerror)
#else
!e_cal_get_object(m_calendar,
id.m_uid.c_str(),
!id.m_rid.empty() ? id.m_rid.c_str() : NULL,
!id.m_rid.empty() ? id.m_rid.c_str() : nullptr,
&comp,
gerror)
#endif
@ -981,7 +1123,11 @@ icalcomponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
if (!comp) {
throwError(SE_HERE, string("retrieving item: ") + id.getLUID());
}
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> ptr(comp);
#else
eptr<icalcomponent> ptr(comp);
#endif
/*
* EDS bug: if a parent doesn't exist while a child does, and we ask
@ -989,8 +1135,15 @@ icalcomponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
* turn it into a "not found" error.
*/
if (id.m_rid.empty()) {
#ifdef HAVE_LIBECAL_2_0
ICalTime *rid = i_cal_component_get_recurrenceid(comp);
if (!rid || i_cal_time_is_null_time(rid)) {
g_clear_object(&rid);
} else {
#else
struct icaltimetype rid = icalcomponent_get_recurrenceid(comp);
if (!icaltime_is_null_time(rid)) {
#endif
throwError(SE_HERE, string("retrieving item: got child instead of parent: ") + id.m_uid);
}
}
@ -1000,7 +1153,11 @@ icalcomponent *EvolutionCalendarSource::retrieveItem(const ItemID &id)
string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
{
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> comp(retrieveItem(id));
#else
eptr<icalcomponent> comp(retrieveItem(id));
#endif
eptr<char> icalstr;
#ifdef USE_EDS_CLIENT
@ -1015,6 +1172,15 @@ string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
// definition. Evolution GUI ignores the TZID and interprets
// the times as local time. Do the same when exporting the
// event by removing the bogus TZID.
#ifdef HAVE_LIBECAL_2_0
ICalProperty *prop;
for (prop = i_cal_component_get_first_property (comp, I_CAL_ANY_PROPERTY);
prop;
g_object_unref(prop), prop = i_cal_component_get_next_property (comp, I_CAL_ANY_PROPERTY)) {
// removes only the *first* TZID - but there shouldn't be more than one
i_cal_property_remove_parameter_by_kind(prop, I_CAL_TZID_PARAMETER);
}
#else
icalproperty *prop = icalcomponent_get_first_property (comp,
ICAL_ANY_PROPERTY);
@ -1024,6 +1190,7 @@ string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
prop = icalcomponent_get_next_property (comp,
ICAL_ANY_PROPERTY);
}
#endif
// now try again
#ifdef USE_EDS_CLIENT
@ -1075,16 +1242,28 @@ string EvolutionCalendarSource::retrieveItemAsString(const ItemID &id)
std::string EvolutionCalendarSource::getDescription(const string &luid)
{
try {
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> comp(retrieveItem(ItemID(luid)));
#else
eptr<icalcomponent> comp(retrieveItem(ItemID(luid)));
#endif
std::string descr;
#ifdef HAVE_LIBECAL_2_0
const char *summary = i_cal_component_get_summary(comp);
#else
const char *summary = icalcomponent_get_summary(comp);
#endif
if (summary && summary[0]) {
descr += summary;
}
if (m_type == EVOLUTION_CAL_SOURCE_TYPE_EVENTS) {
#ifdef HAVE_LIBECAL_2_0
const char *location = i_cal_component_get_location(comp);
#else
const char *location = icalcomponent_get_location(comp);
#endif
if (location && location[0]) {
if (!descr.empty()) {
descr += ", ";
@ -1096,9 +1275,17 @@ std::string EvolutionCalendarSource::getDescription(const string &luid)
if (m_type == EVOLUTION_CAL_SOURCE_TYPE_MEMOS &&
descr.empty()) {
// fallback to first line of body text
#ifdef HAVE_LIBECAL_2_0
ICalProperty *desc = i_cal_component_get_first_property(comp, I_CAL_DESCRIPTION_PROPERTY);
#else
icalproperty *desc = icalcomponent_get_first_property(comp, ICAL_DESCRIPTION_PROPERTY);
#endif
if (desc) {
#ifdef HAVE_LIBECAL_2_0
const char *text = i_cal_property_get_description(desc);
#else
const char *text = icalproperty_get_description(desc);
#endif
if (text) {
const char *eol = strchr(text, '\n');
if (eol) {
@ -1107,6 +1294,9 @@ std::string EvolutionCalendarSource::getDescription(const string &luid)
descr = text;
}
}
#ifdef HAVE_LIBECAL_2_0
g_object_unref(desc);
#endif
}
}
@ -1144,7 +1334,11 @@ EvolutionCalendarSource::ItemID::ItemID(const string &luid)
EvolutionCalendarSource::ItemID EvolutionCalendarSource::getItemID(ECalComponent *ecomp)
{
#ifdef HAVE_LIBECAL_2_0
ICalComponent *icomp = e_cal_component_get_icalcomponent(ecomp);
#else
icalcomponent *icomp = e_cal_component_get_icalcomponent(ecomp);
#endif
if (!icomp) {
SE_THROW("internal error in getItemID(): ECalComponent without icalcomp");
}
@ -1162,15 +1356,38 @@ EvolutionCalendarSource::ItemID EvolutionCalendarSource::getItemID(icalcomponent
icalTime2Str(rid));
}
#ifdef HAVE_LIBECAL_2_0
EvolutionCalendarSource::ItemID EvolutionCalendarSource::getItemID(ICalComponent *icomp)
{
icalcomponent *native_icomp;
native_icomp = static_cast<icalcomponent *>(i_cal_object_get_native(I_CAL_OBJECT (icomp)));
if (!native_icomp) {
SE_THROW("internal error in getItemID(): ICalComponent without native icalcomp");
}
return getItemID(native_icomp);
}
#endif
string EvolutionCalendarSource::getItemModTime(ECalComponent *ecomp)
{
#ifdef HAVE_LIBECAL_2_0
ICalTime *modTime;
modTime = e_cal_component_get_last_modified(ecomp);
eptr<ICalTime, ICalTime, UnrefFree<ICalTime> > modTimePtr(modTime);
#else
struct icaltimetype *modTime;
e_cal_component_get_last_modified(ecomp, &modTime);
eptr<struct icaltimetype, struct icaltimetype, UnrefFree<struct icaltimetype> > modTimePtr(modTime);
#endif
if (!modTimePtr) {
return "";
} else {
#ifdef HAVE_LIBECAL_2_0
return icalTime2Str(modTimePtr.get());
#else
return icalTime2Str(*modTimePtr.get());
#endif
}
}
@ -1179,7 +1396,11 @@ string EvolutionCalendarSource::getItemModTime(const ItemID &id)
if (!needChanges()) {
return "";
}
#ifdef HAVE_LIBECAL_2_0
eptr<ICalComponent> icomp(retrieveItem(id));
#else
eptr<icalcomponent> icomp(retrieveItem(id));
#endif
return getItemModTime(icomp);
}
@ -1194,6 +1415,15 @@ string EvolutionCalendarSource::getItemModTime(icalcomponent *icomp)
return icalTime2Str(modTime);
}
#ifdef HAVE_LIBECAL_2_0
string EvolutionCalendarSource::getItemModTime(ICalComponent *icomp)
{
icalcomponent *native_icomp = static_cast<icalcomponent *>(i_cal_object_get_native(I_CAL_OBJECT (icomp)));
return getItemModTime(native_icomp);
}
#endif
string EvolutionCalendarSource::icalTime2Str(const icaltimetype &tt)
{
static const struct icaltimetype null = { 0 };
@ -1208,6 +1438,21 @@ string EvolutionCalendarSource::icalTime2Str(const icaltimetype &tt)
}
}
#ifdef HAVE_LIBECAL_2_0
string EvolutionCalendarSource::icalTime2Str(const ICalTime *tt)
{
if (tt || !i_cal_time_is_valid_time (tt) || i_cal_time_is_null_time (tt)) {
return "";
} else {
eptr<char> timestr(i_cal_time_as_ical_string(tt));
if (!timestr) {
SE_THROW("cannot convert to time string");
}
return timestr.get();
}
}
#endif
SE_END_CXX
#endif /* ENABLE_ECAL */

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:
//
@ -182,8 +188,8 @@ class EvolutionCalendarSource : public EvolutionSyncSource,
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 :
NULL;
return ESourceCXX(ref ? ref(EDSRegistryLoader::getESourceRegistry()) : NULL, TRANSFER_REF);
nullptr;
return ESourceCXX(ref ? ref(EDSRegistryLoader::getESourceRegistry()) : nullptr, TRANSFER_REF);
}
#else
ECalSourceType sourceType() const {
@ -196,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 */
@ -239,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
@ -263,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,11 +27,13 @@
#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;
#ifdef ENABLE_ECAL
const bool enabled = true;
#endif
EDSAbiWrapperInit();
@ -43,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;
}
}
@ -54,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;
}
}
@ -76,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",
@ -124,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());
}
@ -171,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 =
@ -212,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,
@ -221,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 =
@ -242,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 =
@ -279,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,
@ -294,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));
}
};

View File

@ -22,7 +22,6 @@
#include <map>
#include <sstream>
#include <list>
using namespace std;
#include "config.h"
#include "EvolutionSyncSource.h"
@ -41,8 +40,6 @@ using namespace std;
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/foreach.hpp>
#include <boost/lambda/lambda.hpp>
#include <syncevo/declarations.h>
@ -121,8 +118,8 @@ EvolutionSyncSource::Databases EvolutionContactSource::getDatabases()
E_SOURCE_EXTENSION_ADDRESS_BOOK,
e_source_registry_ref_default_address_book);
#else
ESourceList *sources = NULL;
if (!e_book_get_addressbooks(&sources, NULL)) {
ESourceList *sources = nullptr;
if (!e_book_get_addressbooks(&sources, nullptr)) {
Exception::throwError(SE_HERE, "unable to access address books");
}
@ -290,7 +287,7 @@ bool EvolutionContactSource::isEmpty()
#ifdef USE_EDS_CLIENT
class EBookClientViewSyncHandler {
public:
typedef boost::function<void (const GSList *list)> Process_t;
typedef std::function<void (const GSList *list)> Process_t;
EBookClientViewSyncHandler(const EBookClientViewCXX &view,
const Process_t &process) :
@ -300,12 +297,12 @@ class EBookClientViewSyncHandler {
bool process(GErrorCXX &gerror) {
// Listen for view signals
m_view.connectSignal<void (EBookClientView *ebookview,
const GSList *contacts)>("objects-added",
boost::bind(m_process, _2));
m_view.connectSignal<void (EBookClientView *ebookview,
const GError *error)>("complete",
boost::bind(&EBookClientViewSyncHandler::completed, this, _2));
m_view.connectSignal<EBookClientView *,
const GSList *>()("objects-added",
[this] (EBookClientView *, const GSList *list) { m_process(list); } );
m_view.connectSignal<EBookClientView *,
const GError *>()("complete",
[this] (EBookClientView *, const GError *gerror) { completed(gerror); });
// Start the view
e_book_client_view_start (m_view, m_error);
@ -316,7 +313,7 @@ class EBookClientViewSyncHandler {
// Async -> Sync
m_loop.run();
e_book_client_view_stop (m_view, NULL);
e_book_client_view_stop (m_view, nullptr);
if (m_error) {
std::swap(gerror, m_error);
@ -337,39 +334,12 @@ class EBookClientViewSyncHandler {
private:
// Process list callback
boost::function<void (const GSList *list)> m_process;
std::function<void (const GSList *list)> m_process;
// View watched
EBookClientViewCXX m_view;
// Possible error while watching the view
GErrorCXX m_error;
};
static void list_revisions(const GSList *contacts, EvolutionContactSource::RevisionMap_t *revisions)
{
const GSList *l;
for (l = contacts; l; l = l->next) {
EContact *contact = E_CONTACT(l->data);
if (!contact) {
SE_THROW("contact entry without data");
}
pair<string, string> revmapping;
const char *uid = (const char *)e_contact_get_const(contact,
E_CONTACT_UID);
if (!uid || !uid[0]) {
SE_THROW("contact entry without UID");
}
revmapping.first = uid;
const char *rev = (const char *)e_contact_get_const(contact,
E_CONTACT_REV);
if (!rev || !rev[0]) {
SE_THROW(string("contact entry without REV: ") + revmapping.first);
}
revmapping.second = rev;
revisions->insert(revmapping);
}
}
#endif
void EvolutionContactSource::listAllItems(RevisionMap_t &revisions)
@ -387,7 +357,7 @@ void EvolutionContactSource::listAllItems(RevisionMap_t &revisions)
sexp = buffer;
}
if (!e_book_client_get_view_sync(m_addressbook, sexp, &view, NULL, gerror)) {
if (!e_book_client_get_view_sync(m_addressbook, sexp, &view, nullptr, gerror)) {
throwError(SE_HERE, "getting the view" , gerror);
}
EBookClientViewCXX viewPtr = EBookClientViewCXX::steal(view);
@ -402,7 +372,28 @@ void EvolutionContactSource::listAllItems(RevisionMap_t &revisions)
gerror.clear();
}
EBookClientViewSyncHandler handler(viewPtr, boost::bind(list_revisions, _1, &revisions));
auto process = [&revisions] (const GSList *contacts) {
const GSList *l;
for (l = contacts; l; l = l->next) {
EContact *contact = E_CONTACT(l->data);
if (!contact) {
SE_THROW("contact entry without data");
}
const char *uid = (const char *)e_contact_get_const(contact,
E_CONTACT_UID);
if (!uid || !uid[0]) {
SE_THROW("contact entry without UID");
}
const char *rev = (const char *)e_contact_get_const(contact,
E_CONTACT_REV);
if (!rev || !rev[0]) {
SE_THROW(string("contact entry without REV: ") + uid);
}
revisions[uid] = rev;
}
};
EBookClientViewSyncHandler handler(viewPtr, process);
if (!handler.process(gerror)) {
throwError(SE_HERE, "watching view", gerror);
}
@ -456,7 +447,7 @@ string EvolutionContactSource::getRevision(const string &luid)
!e_book_client_get_contact_sync(m_addressbook,
luid.c_str(),
&contact,
NULL,
nullptr,
gerror)
#else
!e_book_get_contact(m_addressbook,
@ -528,7 +519,7 @@ void EvolutionContactSource::getReadAheadOrder(ReadAheadOrder &order,
luids = m_nextLUIDs;
}
void EvolutionContactSource::checkCacheForError(boost::shared_ptr<ContactCache> &cache)
void EvolutionContactSource::checkCacheForError(std::shared_ptr<ContactCache> &cache)
{
if (cache->m_gerror) {
GErrorCXX gerror;
@ -544,10 +535,10 @@ void EvolutionContactSource::invalidateCachedContact(const std::string &luid)
invalidateCachedContact(m_contactCacheNext, luid);
}
void EvolutionContactSource::invalidateCachedContact(boost::shared_ptr<ContactCache> &cache, const std::string &luid)
void EvolutionContactSource::invalidateCachedContact(std::shared_ptr<ContactCache> &cache, const std::string &luid)
{
if (cache) {
ContactCache::iterator it = cache->find(luid);
auto it = cache->find(luid);
if (it != cache->end()) {
SE_LOG_DEBUG(getDisplayName(), "reading: remove contact %s from cache because of remove or update", luid.c_str());
// If we happen to read that contact (unlikely), it'll be
@ -591,7 +582,7 @@ bool EvolutionContactSource::getContact(const string &luid, EContact **contact,
return e_book_client_get_contact_sync(m_addressbook,
luid.c_str(),
contact,
NULL,
nullptr,
gerror);
} else {
return getContactFromCache(luid, contact, gerror);
@ -600,7 +591,7 @@ bool EvolutionContactSource::getContact(const string &luid, EContact **contact,
bool EvolutionContactSource::getContactFromCache(const string &luid, EContact **contact, GErrorCXX &gerror)
{
*contact = NULL;
*contact = nullptr;
// Use ContactCache.
if (m_contactCache) {
@ -609,7 +600,7 @@ bool EvolutionContactSource::getContactFromCache(const string &luid, EContact **
checkCacheForError(m_contactCache);
// Does the cache cover our item?
ContactCache::const_iterator it = m_contactCache->find(luid);
auto it = m_contactCache->find(luid);
if (it == m_contactCache->end()) {
if (m_contactCacheNext) {
SE_LOG_DEBUG(getDisplayName(), "reading: not in cache, try cache %s",
@ -628,7 +619,7 @@ bool EvolutionContactSource::getContactFromCache(const string &luid, EContact **
SE_LOG_DEBUG(getDisplayName(), "reading: in %s cache", m_contactCache->m_running ? "running" : "loaded");
if (m_contactCache->m_running) {
m_cacheStalls++;
GRunWhile(boost::lambda::var(m_contactCache->m_running));
GRunWhile([this] () { return this->m_contactCache->m_running; });
}
// Problem?
checkCacheForError(m_contactCache);
@ -673,7 +664,7 @@ static int MaxBatchSize()
return maxBatchSize;
}
boost::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::string &luid, ReadingMode mode)
std::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::string &luid, ReadingMode mode)
{
SE_LOG_DEBUG(getDisplayName(), "reading: %s contact %s",
mode == START ? "must read" :
@ -695,7 +686,7 @@ boost::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::
const Items_t &items = getAllItems();
const Items_t &newItems = getNewItems();
const Items_t &updatedItems = getUpdatedItems();
Items_t::const_iterator it = items.find(luid);
auto it = items.find(luid);
// Always read the requested item, even if not found in item list?
if (mode == START) {
@ -727,7 +718,7 @@ boost::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::
break;
}
case READ_SELECTED_ITEMS: {
ReadAheadItems::const_iterator it = boost::find(std::make_pair(m_nextLUIDs.begin(), m_nextLUIDs.end()), luid);
auto it = boost::find(std::make_pair(m_nextLUIDs.begin(), m_nextLUIDs.end()), luid);
// Always read the requested item, even if not found in item list?
if (mode == START) {
uids[0] = &luid;
@ -767,10 +758,10 @@ boost::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::
m_readAheadOrder = READ_NONE;
}
boost::shared_ptr<ContactCache> cache;
std::shared_ptr<ContactCache> cache;
if (size) {
// Prepare parameter for EDS C call. Ownership of query instances is in uidQueries array.
boost::scoped_array<EBookQuery *> queries(new EBookQuery *[size]);
auto queries = std::make_unique<EBookQuery *[]>(size);
for (int i = 0; i < size; i++) {
// This shouldn't compile because we don't specify how ownership is handled.
// The reset() method always bumps the ref count, which is not what we want here!
@ -787,52 +778,45 @@ boost::shared_ptr<ContactCache> EvolutionContactSource::startReading(const std::
cache->m_running = true;
cache->m_name = StringPrintf("%s-%s (%d)", uids[0]->c_str(), uids[size - 1]->c_str(), size);
cache->m_lastLUID = *uids[size - 1];
BOOST_FOREACH (const std::string *uid, std::make_pair(uids.begin(), uids.begin() + size)) {
for (const std::string *uid: boost::make_iterator_range(uids.begin(), uids.begin() + size)) {
(*cache)[*uid] = EContactCXX();
}
m_contactsFromDB += size;
m_contactQueries++;
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_get_contacts,
boost::bind(&EvolutionContactSource::completedRead,
this,
boost::weak_ptr<ContactCache>(cache),
_1, _2, _3),
m_addressbook, sexp, NULL);
auto process = [this, cachePtr=std::weak_ptr<ContactCache>(cache)] (gboolean success, GSList *contactsPtr, const GError *gerror) noexcept {
try {
using ContactListCXX = GListCXX< EContact, GSList, GObjectDestructor<EContact> >;
ContactListCXX contacts(contactsPtr); // transfers ownership
std::shared_ptr<ContactCache> cache = cachePtr.lock();
if (!cache) {
SE_LOG_DEBUG(getDisplayName(), "reading: contact read finished, results no longer needed: %s", gerror ? gerror->message : "<<successful>>");
return;
}
SE_LOG_DEBUG(getDisplayName(), "reading: contact read %s finished: %s",
cache->m_name.c_str(),
gerror ? gerror->message : "<<successful>>");
if (success) {
for (EContact *contact: contacts) {
const char *uid = (const char *)e_contact_get_const(contact, E_CONTACT_UID);
SE_LOG_DEBUG(getDisplayName(), "reading: contact read %s got %s", cache->m_name.c_str(), uid);
(*cache)[uid] = EContactCXX(contact, ADD_REF);
}
} else {
cache->m_gerror = gerror;
}
cache->m_running = false;
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
};
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_get_contacts, process,
m_addressbook, sexp, nullptr);
SE_LOG_DEBUG(getDisplayName(), "reading: started contact read %s", cache->m_name.c_str());
}
return cache;
}
typedef GListCXX< EContact, GSList, GObjectDestructor<EContact> > ContactListCXX;
void EvolutionContactSource::completedRead(const boost::weak_ptr<ContactCache> &cachePtr, gboolean success, GSList *contactsPtr, const GError *gerror) throw()
{
try {
ContactListCXX contacts(contactsPtr); // transfers ownership
boost::shared_ptr<ContactCache> cache = cachePtr.lock();
if (!cache) {
SE_LOG_DEBUG(getDisplayName(), "reading: contact read finished, results no longer needed: %s", gerror ? gerror->message : "<<successful>>");
return;
}
SE_LOG_DEBUG(getDisplayName(), "reading: contact read %s finished: %s",
cache->m_name.c_str(),
gerror ? gerror->message : "<<successful>>");
if (success) {
BOOST_FOREACH (EContact *contact, contacts) {
const char *uid = (const char *)e_contact_get_const(contact, E_CONTACT_UID);
SE_LOG_DEBUG(getDisplayName(), "reading: contact read %s got %s", cache->m_name.c_str(), uid);
(*cache)[uid] = EContactCXX(contact, ADD_REF);
}
} else {
cache->m_gerror = gerror;
}
cache->m_running = false;
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
}
void EvolutionContactSource::logCacheStats(Logger::Level level)
{
SE_LOG(getDisplayName(), level,
@ -873,7 +857,7 @@ void EvolutionContactSource::readItem(const string &luid, std::string &item, boo
// Inline PHOTO data if exporting, leave VALUE=uri references unchanged
// when processing inside engine (will be inlined by engine as needed).
// The function for doing the inlining was added in EDS 3.4.
// In compatibility mode, we must check the function pointer for non-NULL.
// In compatibility mode, we must check the function pointer for non-nullptr.
// In direct call mode, the existence check is done by configure.
if (raw) {
#if defined(HAVE_E_CONTACT_INLINE_LOCAL_PHOTOS)
@ -893,11 +877,11 @@ void EvolutionContactSource::readItem(const string &luid, std::string &item, boo
}
#ifdef USE_EDS_CLIENT
TrackingSyncSource::InsertItemResult EvolutionContactSource::checkBatchedInsert(const boost::shared_ptr<Pending> &pending)
TrackingSyncSource::InsertItemResult EvolutionContactSource::checkBatchedInsert(const std::shared_ptr<Pending> &pending)
{
SE_LOG_DEBUG(pending->m_name, "checking operation: %s", pending->m_status == MODIFYING ? "waiting" : "inserted");
if (pending->m_status == MODIFYING) {
return TrackingSyncSource::InsertItemResult(boost::bind(&EvolutionContactSource::checkBatchedInsert, this, pending));
return TrackingSyncSource::InsertItemResult([this, pending] () { return checkBatchedInsert(pending); });
}
if (pending->m_gerror) {
pending->m_gerror.throwError(SE_HERE, pending->m_name);
@ -906,70 +890,6 @@ TrackingSyncSource::InsertItemResult EvolutionContactSource::checkBatchedInsert(
return TrackingSyncSource::InsertItemResult(pending->m_uid, newrev, ITEM_OKAY);
}
void EvolutionContactSource::completedAdd(const boost::shared_ptr<PendingContainer_t> &batched, gboolean success, GSList *uids, const GError *gerror) throw()
{
try {
// The destructor ensures that the pending operations complete
// before destructing the instance, so our "this" pointer is
// always valid here.
SE_LOG_DEBUG(getDisplayName(), "batch add of %d contacts completed", (int)batched->size());
m_numRunningOperations--;
PendingContainer_t::iterator it = (*batched).begin();
GSList *uid = uids;
while (it != (*batched).end() && uid) {
SE_LOG_DEBUG((*it)->m_name, "completed: %s",
success ? "<<successfully>>" :
gerror ? gerror->message :
"<<unknown failure>>");
if (success) {
(*it)->m_uid = static_cast<gchar *>(uid->data);
// Get revision when engine checks the item.
(*it)->m_status = REVISION;
} else {
(*it)->m_status = DONE;
(*it)->m_gerror = gerror;
}
++it;
uid = uid->next;
}
while (it != (*batched).end()) {
// Should never happen.
SE_LOG_DEBUG((*it)->m_name, "completed: missing uid?!");
(*it)->m_status = DONE;
++it;
}
g_slist_free_full(uids, g_free);
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
}
void EvolutionContactSource::completedUpdate(const boost::shared_ptr<PendingContainer_t> &batched, gboolean success, const GError *gerror) throw()
{
try {
SE_LOG_DEBUG(getDisplayName(), "batch update of %d contacts completed", (int)batched->size());
m_numRunningOperations--;
PendingContainer_t::iterator it = (*batched).begin();
while (it != (*batched).end()) {
SE_LOG_DEBUG((*it)->m_name, "completed: %s",
success ? "<<successfully>>" :
gerror ? gerror->message :
"<<unknown failure>>");
if (success) {
(*it)->m_status = REVISION;
} else {
(*it)->m_status = DONE;
(*it)->m_gerror = gerror;
}
++it;
}
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
}
void EvolutionContactSource::flushItemChanges()
{
if (!m_batchedAdd.empty()) {
@ -977,34 +897,94 @@ void EvolutionContactSource::flushItemChanges()
m_numRunningOperations++;
GListCXX<EContact, GSList> contacts;
// Iterate backwards, push to front (cheaper for single-linked list) -> same order in the end.
BOOST_REVERSE_FOREACH (const boost::shared_ptr<Pending> &pending, m_batchedAdd) {
for (const auto &pending: reverse(m_batchedAdd)) {
contacts.push_front(pending->m_contact.get());
}
// Transfer content without copying and then copy only the shared pointer.
boost::shared_ptr<PendingContainer_t> batched(new PendingContainer_t);
auto batched = std::make_shared<PendingContainer_t>();
std::swap(*batched, m_batchedAdd);
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_add_contacts,
boost::bind(&EvolutionContactSource::completedAdd,
this,
batched,
_1, _2, _3),
m_addressbook, contacts, NULL);
auto process = [this, batched] (gboolean success, GSList *uids, const GError *gerror) noexcept {
try {
// The destructor ensures that the pending operations complete
// before destructing the instance, so our "this" pointer is
// always valid here.
SE_LOG_DEBUG(getDisplayName(), "batch add of %d contacts completed", (int)batched->size());
m_numRunningOperations--;
auto it = (*batched).begin();
GSList *uid = uids;
while (it != (*batched).end() && uid) {
SE_LOG_DEBUG((*it)->m_name, "completed: %s",
success ? "<<successfully>>" :
gerror ? gerror->message :
"<<unknown failure>>");
if (success) {
(*it)->m_uid = static_cast<gchar *>(uid->data);
// Get revision when engine checks the item.
(*it)->m_status = REVISION;
} else {
(*it)->m_status = DONE;
(*it)->m_gerror = gerror;
}
++it;
uid = uid->next;
}
while (it != (*batched).end()) {
// Should never happen.
SE_LOG_DEBUG((*it)->m_name, "completed: missing uid?!");
(*it)->m_status = DONE;
++it;
}
g_slist_free_full(uids, g_free);
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
};
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_add_contacts, process,
m_addressbook, contacts,
#ifdef HAVE_E_BOOK_OPERATION_FLAGS
E_BOOK_OPERATION_FLAG_NONE,
#endif
nullptr);
}
if (!m_batchedUpdate.empty()) {
SE_LOG_DEBUG(getDisplayName(), "batch update of %d contacts starting", (int)m_batchedUpdate.size());
m_numRunningOperations++;
GListCXX<EContact, GSList> contacts;
BOOST_REVERSE_FOREACH (const boost::shared_ptr<Pending> &pending, m_batchedUpdate) {
for (const auto &pending: reverse(m_batchedUpdate)) {
contacts.push_front(pending->m_contact.get());
}
boost::shared_ptr<PendingContainer_t> batched(new PendingContainer_t);
auto batched = std::make_shared<PendingContainer_t>();
std::swap(*batched, m_batchedUpdate);
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_modify_contacts,
boost::bind(&EvolutionContactSource::completedUpdate,
this,
batched,
_1, _2),
m_addressbook, contacts, NULL);
auto process = [this, batched] (gboolean success, const GError *gerror) noexcept {
try {
SE_LOG_DEBUG(getDisplayName(), "batch update of %d contacts completed", (int)batched->size());
m_numRunningOperations--;
auto it = (*batched).begin();
while (it != (*batched).end()) {
SE_LOG_DEBUG((*it)->m_name, "completed: %s",
success ? "<<successfully>>" :
gerror ? gerror->message :
"<<unknown failure>>");
if (success) {
(*it)->m_status = REVISION;
} else {
(*it)->m_status = DONE;
(*it)->m_gerror = gerror;
}
++it;
}
} catch (...) {
Exception::handle(HANDLE_EXCEPTION_FATAL);
}
};
SYNCEVO_GLIB_CALL_ASYNC(e_book_client_modify_contacts, process,
m_addressbook, contacts,
#ifdef HAVE_E_BOOK_OPERATION_FLAGS
E_BOOK_OPERATION_FLAG_NONE,
#endif
nullptr);
}
}
@ -1013,7 +993,7 @@ void EvolutionContactSource::finishItemChanges()
if (m_numRunningOperations) {
SE_LOG_DEBUG(getDisplayName(), "waiting for %d pending operations to complete", m_numRunningOperations.get());
while (m_numRunningOperations) {
g_main_context_iteration(NULL, true);
g_main_context_iteration(nullptr, true);
}
SE_LOG_DEBUG(getDisplayName(), "pending operations completed");
}
@ -1028,7 +1008,7 @@ EvolutionContactSource::insertItem(const string &uid, const std::string &item, b
if (contact) {
e_contact_set(contact, E_CONTACT_UID,
uid.empty() ?
NULL :
nullptr :
const_cast<char *>(uid.c_str()));
GErrorCXX gerror;
#ifdef USE_EDS_CLIENT
@ -1037,14 +1017,22 @@ EvolutionContactSource::insertItem(const string &uid, const std::string &item, b
case SYNCHRONOUS:
if (uid.empty()) {
gchar* newuid;
if (!e_book_client_add_contact_sync(m_addressbook, contact, &newuid, NULL, gerror)) {
if (!e_book_client_add_contact_sync(m_addressbook, contact,
#ifdef HAVE_E_BOOK_OPERATION_FLAGS
E_BOOK_OPERATION_FLAG_NONE,
#endif
&newuid, nullptr, gerror)) {
throwError(SE_HERE, "add new contact", gerror);
}
PlainGStr newuidPtr(newuid);
string newrev = getRevision(newuid);
return InsertItemResult(newuid, newrev, ITEM_OKAY);
} else {
if (!e_book_client_modify_contact_sync(m_addressbook, contact, NULL, gerror)) {
if (!e_book_client_modify_contact_sync(m_addressbook, contact,
#ifdef HAVE_E_BOOK_OPERATION_FLAGS
E_BOOK_OPERATION_FLAG_NONE,
#endif
nullptr, gerror)) {
throwError(SE_HERE, "updating contact "+ uid, gerror);
}
string newrev = getRevision(uid);
@ -1058,7 +1046,7 @@ EvolutionContactSource::insertItem(const string &uid, const std::string &item, b
uid.empty() ? "add" : ("insert " + uid).c_str(),
m_asyncOpCounter++);
SE_LOG_DEBUG(name, "queueing for batched %s", uid.empty() ? "add" : "update");
boost::shared_ptr<Pending> pending(new Pending);
auto pending = std::make_shared<Pending>();
pending->m_name = name;
pending->m_contact = contact;
pending->m_uid = uid;
@ -1069,7 +1057,7 @@ EvolutionContactSource::insertItem(const string &uid, const std::string &item, b
}
// SyncSource is going to live longer than Synthesis
// engine, so using "this" is safe here.
return InsertItemResult(boost::bind(&EvolutionContactSource::checkBatchedInsert, this, pending));
return InsertItemResult([this, pending] () { return checkBatchedInsert(pending); });
break;
}
#else
@ -1102,7 +1090,11 @@ void EvolutionContactSource::removeItem(const string &uid)
if (
#ifdef USE_EDS_CLIENT
(invalidateCachedContact(uid),
!e_book_client_remove_contact_by_uid_sync(m_addressbook, uid.c_str(), NULL, gerror))
!e_book_client_remove_contact_by_uid_sync(m_addressbook, uid.c_str(),
#ifdef HAVE_E_BOOK_OPERATION_FLAGS
E_BOOK_OPERATION_FLAG_NONE,
#endif
nullptr, gerror))
#else
!e_book_remove_contact(m_addressbook, uid.c_str(), gerror)
#endif

View File

@ -137,7 +137,7 @@ class EvolutionContactSource : public EvolutionSyncSource,
Pending() : m_status(MODIFYING) {}
};
typedef std::list< boost::shared_ptr<Pending> >PendingContainer_t;
typedef std::list< std::shared_ptr<Pending> >PendingContainer_t;
/**
* Batched "contact add/update" operations.
@ -148,14 +148,12 @@ class EvolutionContactSource : public EvolutionSyncSource,
PendingContainer_t m_batchedUpdate;
InitState<int> m_numRunningOperations;
InsertItemResult checkBatchedInsert(const boost::shared_ptr<Pending> &pending);
void completedAdd(const boost::shared_ptr<PendingContainer_t> &batched, gboolean success, /* const GStringListFreeCXX &uids */ GSList *uids, const GError *gerror) throw ();
void completedUpdate(const boost::shared_ptr<PendingContainer_t> &batched, gboolean success, const GError *gerror) throw ();
InsertItemResult checkBatchedInsert(const std::shared_ptr<Pending> &pending);
virtual void flushItemChanges();
virtual void finishItemChanges();
// Read-ahead of item data.
boost::shared_ptr<ContactCache> m_contactCache, m_contactCacheNext;
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) */
@ -164,9 +162,9 @@ class EvolutionContactSource : public EvolutionSyncSource,
ReadAheadOrder m_readAheadOrder;
ReadAheadItems m_nextLUIDs;
void checkCacheForError(boost::shared_ptr<ContactCache> &cache);
void checkCacheForError(std::shared_ptr<ContactCache> &cache);
void invalidateCachedContact(const std::string &luid);
void invalidateCachedContact(boost::shared_ptr<ContactCache> &cache, 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
@ -174,8 +172,7 @@ class EvolutionContactSource : public EvolutionSyncSource,
START, /**< luid is needed, must be read */
CONTINUE /**< luid is from old request, find next ones */
};
boost::shared_ptr<ContactCache> startReading(const std::string &luid, ReadingMode mode);
void completedRead(const boost::weak_ptr<ContactCache> &cachePtr, gboolean success, GSList *contactsPtr, const GError *gerror) throw();
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.

View File

@ -24,12 +24,14 @@
#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";
#ifdef ENABLE_EBOOK
const bool enabled = true;
#endif
EDSAbiWrapperInit();
@ -37,18 +39,18 @@ static SyncSource *createSource(const SyncSourceParams &params)
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",
@ -77,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);
}
/**
@ -93,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

@ -41,9 +41,9 @@ void EvolutionSyncSource::getDatabasesFromRegistry(SyncSource::Databases &result
{
ESourceRegistryCXX registry = EDSRegistryLoader::getESourceRegistry();
ESourceListCXX sources(e_source_registry_list_sources(registry, extension));
ESourceCXX def(refDef ? refDef(registry) : NULL,
ESourceCXX def(refDef ? refDef(registry) : nullptr,
TRANSFER_REF);
BOOST_FOREACH (ESource *source, sources) {
for (ESource *source: sources) {
result.push_back(Database(e_source_get_display_name(source),
e_source_get_uid(source),
e_source_equal(def, source)));
@ -58,7 +58,7 @@ static void handleErrorCB(EClient */*client*/, const gchar *error_msg, gpointer
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;
@ -66,7 +66,6 @@ EClientCXX EvolutionSyncSource::openESource(const char *extension,
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>>")) {
@ -78,7 +77,6 @@ EClientCXX EvolutionSyncSource::openESource(const char *extension,
} else {
throwError(SE_HERE, string("database not found: '") + id + "'");
}
created = true;
} else {
client = EClientCXX::steal(newClient(source, gerror));
}
@ -95,19 +93,19 @@ EClientCXX EvolutionSyncSource::openESource(const char *extension,
(void *)"Evolution Data Server has died unexpectedly.");
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, NULL, gerror)) {
if (gerror && g_error_matches(gerror, E_CLIENT_ERROR, E_CLIENT_ERROR_BUSY)) {
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);
} else if (created) {
// Opening newly created address books often failed in
// old EDS releases - try again. Probably covered by
// more recently added E_CLIENT_ERROR_BUSY check above.
gerror.clear();
sleep(5);
retries++;
} else {
throwError(SE_HERE, "opening database", gerror);
}
@ -155,7 +153,7 @@ SyncSource::Database EvolutionSyncSource::createDatabase(const Database &databas
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, NULL, gerror));
PlainGStrArray keys(g_key_file_get_keys(keyfile, mainSection, nullptr, gerror));
if (!keys) {
gerror.throwError(SE_HERE, "listing keys in main section");
}
@ -168,7 +166,7 @@ SyncSource::Database EvolutionSyncSource::createDatabase(const Database &databas
}
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, NULL);
ini = g_key_file_to_data(keyfile, &len, nullptr);
const char *configDir = g_get_user_config_dir();
int fd;
std::string filename;
@ -213,7 +211,7 @@ SyncSource::Database EvolutionSyncSource::createDatabase(const Database &databas
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(NULL, true);
g_main_context_iteration(nullptr, true);
}
SE_LOG_DEBUG(getDisplayName(), "ESourceRegistry has new ESource %s", uid.c_str());
@ -221,7 +219,7 @@ SyncSource::Database EvolutionSyncSource::createDatabase(const Database &databas
// 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(),
// NULL, gerror),
// nullptr, gerror),
// TRANSFER_REF);
// e_source_set_display_name(source, "syncevolution-fake");
// e_source_set_parent(source, "local-stub");
@ -229,7 +227,7 @@ SyncSource::Database EvolutionSyncSource::createDatabase(const Database &databas
// sources.push_back(source.ref()); // ESourceListCXX unrefs sources it points to
// if (!e_source_registry_create_sources_sync(registry,
// sources,
// NULL,
// nullptr,
// gerror)) {
// gerror.throwError(SE_HERE, StringPrintf("creating EDS database of type %s with name '%s'%s%s",
// sourceExtension(),
@ -252,7 +250,7 @@ void EvolutionSyncSource::deleteDatabase(const std::string &uri, RemoveData remo
uri.c_str()));
}
GErrorCXX gerror;
if (!e_source_remove_sync(source, NULL, gerror)) {
if (!e_source_remove_sync(source, nullptr, gerror)) {
throwError(SE_HERE, StringPrintf("deleting EDS database with URI '%s'", uri.c_str()),
gerror);
}
@ -266,10 +264,10 @@ void EvolutionSyncSource::deleteDatabase(const std::string &uri, RemoveData remo
// 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)) {
BOOST_FOREACH (const std::string &kind, ReadDir(basedir)) {
for (const std::string &kind: ReadDir(basedir)) {
std::string subdir = basedir + "/" + kind;
if (isDir(subdir)) {
BOOST_FOREACH (const std::string &source, ReadDir(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
@ -296,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;
@ -305,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));
@ -329,7 +327,7 @@ ESource *EvolutionSyncSource::findSource(const ESourceListCXX &list, const strin
}
}
#endif
return NULL;
return nullptr;
}
void EvolutionSyncSource::throwError(const SourceLocation &where, const string &action, GErrorCXX &gerror)

View File

@ -71,7 +71,7 @@ class EvolutionSyncSource : public TrackingSyncSource
ESource *(*getDef)(ESourceRegistry *));
EClientCXX openESource(const char *extension,
ESource *(*refBuiltin)(ESourceRegistry *),
const boost::function<EClient *(ESource *, GError **gerror)> &newClient);
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).
@ -90,7 +90,7 @@ class EvolutionSyncSource : public TrackingSyncSource
*
* @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);
@ -124,7 +124,7 @@ class EvolutionAsync {
public:
EvolutionAsync()
{
m_loop = GMainLoopStealCXX(g_main_loop_new(NULL, TRUE));
m_loop = GMainLoopStealCXX(g_main_loop_new(nullptr, TRUE));
}
/** start processing events */

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)])],

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

@ -137,7 +137,7 @@ void FileSyncSource::open()
bool FileSyncSource::isEmpty()
{
DIR *dir = NULL;
DIR *dir = nullptr;
bool empty = true;
try {
@ -197,7 +197,7 @@ void FileSyncSource::listAllItems(RevisionMap_t &revisions)
SE_LOG_DEBUG(getDisplayName(), "continue listing items in file source");
}
BOOST_FOREACH(const string &entry, dirContent) {
for (const string &entry: dirContent) {
string filename = createFilename(entry);
string revision = getATimeString(filename);
long entrynum = atoll(entry.c_str());

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

@ -21,63 +21,26 @@
#ifdef USE_GNOME_KEYRING
extern "C" {
#include <gnome-keyring.h>
}
#include <libsecret/secret.h>
#include "GNOMEPlatform.h"
#include <syncevo/Exception.h>
#include <syncevo/UserInterface.h>
#include <syncevo/SyncConfig.h>
#include <syncevo/GLibSupport.h>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
// Occasionally, libgnome-keyring fails with the following error messages:
// Gkr: received an invalid, unencryptable, or non-utf8 secret
// Gkr: call to daemon returned an invalid response: (null).(null)
//
// We work around that by retrying the operation a few times, for at
// most this period of time. Didn't really help, so disable it for now
// by using a zero duration.
static const double GNOMEKeyringRetryDuration = 2; // seconds
static const double GNOMEKeyringRetryInterval = 0.1; // seconds
/**
* libgnome-keyring has an internal gkr_reset_session()
* method which gets called when the "org.freedesktop.secrets"
* disconnects from the D-Bus session bus.
*
* We cannot call that method directly, but we can get it called by
* faking the "disconnect" signal. That works because
* on_connection_filter() in gkr-operation.c doesn't check who the
* sender of the signal is.
*
* Once gkr_reset_session() got called, the next operation will
* re-establish the connection. After the failure above, the second
* attempt usually works.
*
* Any other client using libgnome-keyring will also be tricked into
* disconnecting temporarily. That should be fine, any running
* operation will continue to run and complete (?).
*/
static void FlushGNOMEKeyring()
{
// Invoking dbus-send is easier than writing this in C++.
// Besides, it ensures that the signal comes from some other
// process. Not sure whether signals are sent back to the sender.
system("dbus-send --session --type=signal /org/freedesktop/DBus org.freedesktop.DBus.NameOwnerChanged string:'org.freedesktop.secrets' string:':9.99' string:''");
}
/**
* 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)
@ -97,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,
@ -108,46 +121,49 @@ bool GNOMELoadPasswordSlot(const InitStateTri &keyring,
return false;
}
GnomeKeyringResult result = GNOME_KEYRING_RESULT_OK;
GList* list;
Timespec start = Timespec::monotonic();
double sleepSecs = 0;
do {
if (sleepSecs != 0) {
SE_LOG_DEBUG(NULL, "%s: previous attempt to load password '%s' from GNOME keyring failed, will try again: %s",
key.description.c_str(),
key.toString().c_str(),
gnome_keyring_result_to_message(result));
FlushGNOMEKeyring();
Sleep(sleepSecs);
}
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);
sleepSecs = GNOMEKeyringRetryInterval;
} while (result != GNOME_KEYRING_RESULT_OK &&
(Timespec::monotonic() - start).duration() < GNOMEKeyringRetryDuration);
LibSecretHash hash(key);
for (int i = 0; ; i++ ) {
GErrorCXX gerror;
PlainGStr result(secret_password_lookupv_sync(SECRET_SCHEMA_COMPAT_NETWORK,
hash,
nullptr,
gerror));
// 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);
SE_LOG_DEBUG(NULL, "%s: loaded password from GNOME keyring using %s",
key.description.c_str(),
key.toString().c_str());
} else {
SE_LOG_DEBUG(NULL, "password not in GNOME keyring using %s: %s",
key.toString().c_str(),
result == GNOME_KEYRING_RESULT_NO_MATCH ? "no match" :
result != GNOME_KEYRING_RESULT_OK ? gnome_keyring_result_to_message(result) :
"empty result 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;
@ -173,40 +189,38 @@ bool GNOMESavePasswordSlot(const InitStateTri &keyring,
key.toString().c_str()));
}
guint32 itemId;
GnomeKeyringResult result = GNOME_KEYRING_RESULT_OK;
// write password to keyring
Timespec start = Timespec::monotonic();
double sleepSecs = 0;
do {
if (sleepSecs != 0) {
SE_LOG_DEBUG(NULL, "%s: previous attempt to save password '%s' in GNOME keyring failed, will try again: %s",
key.description.c_str(),
key.toString().c_str(),
gnome_keyring_result_to_message(result));
FlushGNOMEKeyring();
Sleep(sleepSecs);
}
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);
sleepSecs = GNOMEKeyringRetryInterval;
} while (result != GNOME_KEYRING_RESULT_OK &&
(Timespec::monotonic() - start).duration() < GNOMEKeyringRetryDuration);
if (result != GNOME_KEYRING_RESULT_OK) {
Exception::throwError(SE_HERE, StringPrintf("%s: saving password '%s' in GNOME keyring failed: %s",
key.description.c_str(),
key.toString().c_str(),
gnome_keyring_result_to_message(result)));
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()));
}
}
SE_LOG_DEBUG(NULL, "saved password in GNOME keyring using %s", key.toString().c_str());
// handled
return true;

View File

@ -1,10 +1,13 @@
PKG_CHECK_MODULES(KEYRING, [gnome-keyring-1 >= 2.20], 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 >= 2.20 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

View File

@ -36,11 +36,11 @@ public:
" using an account created and managed with GNOME Control Center.")
{}
virtual boost::shared_ptr<AuthProvider> create(const InitStateString &username,
virtual std::shared_ptr<AuthProvider> create(const InitStateString &username,
const InitStateString &password)
{
// Returning NULL if not enabled...
boost::shared_ptr<AuthProvider> provider;
// Returning nullptr if not enabled...
std::shared_ptr<AuthProvider> provider;
#ifdef USE_GOA
provider = createGOAAuthProvider(username, password);
#endif

View File

@ -26,7 +26,6 @@
#include <gdbus-cxx-bridge.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/foreach.hpp>
#include <algorithm>
@ -65,7 +64,7 @@ class GOAManager : private GDBusCXX::DBusRemoteObject
Properties
> Interfaces;
typedef std::map<GDBusCXX::DBusObject_t, Interfaces> ManagedObjects;
GDBusCXX::DBusClientCall1<ManagedObjects> m_getManagedObjects;
GDBusCXX::DBusClientCall<ManagedObjects> m_getManagedObjects;
public:
GOAManager(const GDBusCXX::DBusConnectionPtr &conn);
@ -75,7 +74,7 @@ class GOAManager : private GDBusCXX::DBusRemoteObject
* (the unique user visible string). The account must support OAuth2,
* otherwise an error is thrown.
*/
boost::shared_ptr<GOAAccount> lookupAccount(const std::string &representationID);
std::shared_ptr<GOAAccount> lookupAccount(const std::string &representationID);
};
class GOAAccount
@ -88,8 +87,8 @@ public:
GOAAccount(const GDBusCXX::DBusConnectionPtr &conn,
const std::string &path);
GDBusCXX::DBusClientCall1<int32_t> m_ensureCredentials;
GDBusCXX::DBusClientCall1<std::string> m_getAccessToken;
GDBusCXX::DBusClientCall<int32_t> m_ensureCredentials;
GDBusCXX::DBusClientCall<std::string> m_getAccessToken;
};
GOAManager::GOAManager(const GDBusCXX::DBusConnectionPtr &conn) :
@ -98,7 +97,7 @@ GOAManager::GOAManager(const GDBusCXX::DBusConnectionPtr &conn) :
{
}
boost::shared_ptr<GOAAccount> GOAManager::lookupAccount(const std::string &username)
std::shared_ptr<GOAAccount> GOAManager::lookupAccount(const std::string &username)
{
SE_LOG_DEBUG(NULL, "Looking up all accounts in GNOME Online Accounts, searching for '%s'.", username.c_str());
ManagedObjects objects = m_getManagedObjects();
@ -107,26 +106,26 @@ boost::shared_ptr<GOAAccount> GOAManager::lookupAccount(const std::string &usern
bool unique = true;
bool hasOAuth2 = false;
std::vector<std::string> accounts;
BOOST_FOREACH (const ManagedObjects::value_type &object, objects) {
for (const auto &object: objects) {
const GDBusCXX::DBusObject_t &path = object.first;
const Interfaces &interfaces = object.second;
// boost::adaptors::keys() would be nicer, but is not available on Ubuntu Lucid.
std::list<std::string> interfaceKeys;
BOOST_FOREACH (const Interfaces::value_type &entry, interfaces) {
for (const auto &entry: interfaces) {
interfaceKeys.push_back(entry.first);
}
SE_LOG_DEBUG(NULL, "GOA object %s implements %s", path.c_str(),
boost::join(interfaceKeys, ", ").c_str());
Interfaces::const_iterator it = interfaces.find(GOA_ACCOUNT_INTERFACE);
auto it = interfaces.find(GOA_ACCOUNT_INTERFACE);
if (it != interfaces.end()) {
const Properties &properties = it->second;
Properties::const_iterator id = properties.find(GOA_ACCOUNT_ID);
Properties::const_iterator presentationID = properties.find(GOA_ACCOUNT_PRESENTATION_IDENTITY);
auto id = properties.find(GOA_ACCOUNT_ID);
auto presentationID = properties.find(GOA_ACCOUNT_PRESENTATION_IDENTITY);
if (id != properties.end() &&
presentationID != properties.end()) {
const std::string &idStr = boost::get<std::string>(id->second);
const std::string &presentationIDStr = boost::get<std::string>(presentationID->second);
Properties::const_iterator provider = properties.find(GOA_ACCOUNT_PROVIDER_NAME);
auto provider = properties.find(GOA_ACCOUNT_PROVIDER_NAME);
std::string description = StringPrintf("%s, %s = %s",
provider == properties.end() ? "???" : boost::get<std::string>(provider->second).c_str(),
presentationIDStr.c_str(),
@ -173,7 +172,7 @@ boost::shared_ptr<GOAAccount> GOAManager::lookupAccount(const std::string &usern
username.c_str()));
}
boost::shared_ptr<GOAAccount> account(new GOAAccount(getConnection(), accountPath));
auto account = std::make_shared<GOAAccount>(getConnection(), accountPath);
return account;
}
@ -188,10 +187,10 @@ GOAAccount::GOAAccount(const GDBusCXX::DBusConnectionPtr &conn,
class GOAAuthProvider : public AuthProvider
{
boost::shared_ptr<GOAAccount> m_account;
std::shared_ptr<GOAAccount> m_account;
public:
GOAAuthProvider(const boost::shared_ptr<GOAAccount> &account) :
GOAAuthProvider(const std::shared_ptr<GOAAccount> &account) :
m_account(account)
{}
@ -209,13 +208,13 @@ public:
virtual std::string getUsername() const { return ""; }
};
boost::shared_ptr<AuthProvider> createGOAAuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createGOAAuthProvider(const InitStateString &username,
const InitStateString &password)
{
// Because we share the connection, hopefully this won't be too expensive.
GDBusCXX::DBusErrorCXX err;
GDBusCXX::DBusConnectionPtr conn = dbus_get_bus_connection("SESSION",
NULL,
nullptr,
false,
&err);
if (!conn) {
@ -223,8 +222,8 @@ boost::shared_ptr<AuthProvider> createGOAAuthProvider(const InitStateString &use
}
GOAManager manager(conn);
boost::shared_ptr<GOAAccount> account = manager.lookupAccount(username);
boost::shared_ptr<AuthProvider> provider(new GOAAuthProvider(account));
std::shared_ptr<GOAAccount> account = manager.lookupAccount(username);
auto provider = std::make_shared<GOAAuthProvider>(account);
return provider;
}

View File

@ -21,13 +21,13 @@
#include <syncevo/util.h>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
class AuthProvider;
boost::shared_ptr<AuthProvider> createGOAAuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createGOAAuthProvider(const InitStateString &username,
const InitStateString &password);
SE_END_CXX

View File

@ -216,7 +216,7 @@ KCalExtendedSource::KCalExtendedSource(const SyncSourceParams &params, Type type
break;
}
m_data = NULL;
m_data = nullptr;
m_type = type;
m_delete_run = 0;
m_insert_run = 0;
@ -311,8 +311,8 @@ void KCalExtendedSource::open()
mKCal::Notebook::List notebookList = m_data->m_storage->notebooks();
mKCal::Notebook::List::Iterator it;
for ( it = notebookList.begin(); it != notebookList.end(); ++it ) {
if ( name == (*it)->name() ) {
for (auto notebook: notebookList) {
if ( name == notebook->name() ) {
break;
}
}
@ -388,19 +388,19 @@ KCalExtendedSource::Databases KCalExtendedSource::getDatabases()
}
mKCal::Notebook::List notebookList = m_data->m_storage->notebooks();
mKCal::Notebook::List::Iterator it;
for ( it = notebookList.begin(); it != notebookList.end(); ++it ) {
for (auto notebook: notebookList) {
#ifdef ENABLE_MAEMO
string name = (*it)->name().toStdString();
string uid = (*it)->uid().toStdString();
string name = notebook->name().toStdString();
string uid = notebook->uid().toStdString();
// For notes, we need a different default database:
// Notes (uid:66666666-7777-8888-9999-000000000000)
bool isDefault = (m_type != Journal) ?
(*it)->isDefault() :
notebook->isDefault() :
(uid == "66666666-7777-8888-9999-000000000000");
result.push_back(Database( name, "uid:" + uid, isDefault ));
#else
bool isDefault = (*it)->isDefault();
result.push_back(Database( (*it)->name().toStdString(),
bool isDefault = notebook->isDefault();
result.push_back(Database( notebook->name().toStdString(),
(m_data->m_storage).staticCast<mKCal::SqliteStorage>()->databaseName().toStdString(),
isDefault));
#endif
@ -447,7 +447,7 @@ std::string KCalExtendedSource::endSync(bool success)
if (!m_data->m_storage->save()) {
throwError(SE_HERE, "could not save calendar");
}
time_t modtime = time(NULL);
time_t modtime = time(nullptr);
// Saving set the modified time stamps of all items needed
// saving, so ensure that we sleep for one second starting now.
// Must sleep before taking the time stamp for the anchor,
@ -456,7 +456,7 @@ std::string KCalExtendedSource::endSync(bool success)
time_t current = modtime;
do {
sleep(1 - (current - modtime));
current = time(NULL);
current = time(nullptr);
} while (current - modtime < 1);
m_delete_run = 0;
m_insert_run = 0;
@ -531,7 +531,7 @@ TestingSyncSource::InsertItemResult KCalExtendedSource::insertItem(const string
if (source) {
KCalCore::ICalTimeZones *target = m_data->m_calendar->timeZones();
if (target) {
BOOST_FOREACH(const KCalCore::ICalTimeZone &zone, source->zones().values()) {
for (const auto &zone: source->zones().values()) {
target->add(zone);
}
}

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);
bool isMe = sourceType.m_backend == "mkcal-events";
@ -39,7 +39,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifdef ENABLE_KCALEXTENDED
true ? new KCalExtendedSource(params, KCalExtendedSource::Event) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
@ -55,7 +55,7 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifdef ENABLE_KCALEXTENDED
true ? new KCalExtendedSource(params, KCalExtendedSource::Todo) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
@ -71,11 +71,11 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifdef ENABLE_KCALEXTENDED
true ? new KCalExtendedSource(params, KCalExtendedSource::Journal) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("KCalExtended",
@ -126,8 +126,8 @@ class KCalExtendedSourceUnitTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("KCalExtended", "KCalExtended:text/calendar:2.0", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("KCalExtended", "KCalExtended:text/calendar:2.0", true);
}
};

View File

@ -70,7 +70,7 @@ void KDEInitMainSlot(const char *appname)
//QCoreApplication *app;
int argc = 1;
static char *argv[] = { const_cast<char *>(appname), NULL };
static char *argv[] = { const_cast<char *>(appname), nullptr };
KAboutData aboutData(// The program name used internally.
"syncevolution",
// The message catalog name
@ -99,8 +99,8 @@ void KDEInitMainSlot(const char *appname)
// Don't allow KApplication to mess with SIGINT/SIGTERM.
// Restore current behavior after construction.
struct sigaction oldsigint, oldsigterm;
sigaction(SIGINT, NULL, &oldsigint);
sigaction(SIGTERM, NULL, &oldsigterm);
sigaction(SIGINT, nullptr, &oldsigint);
sigaction(SIGTERM, nullptr, &oldsigterm);
// Explicitly disable GUI mode in the KApplication. Otherwise
// the whole binary will fail to run when there is no X11
@ -109,8 +109,8 @@ void KDEInitMainSlot(const char *appname)
//To stop KApplication from spawning it's own DBus Service ... Will have to patch KApplication about this
QDBusConnection::sessionBus().unregisterService("org.syncevolution.syncevolution-"+QString::number(getpid()));
sigaction(SIGINT, &oldsigint, NULL);
sigaction(SIGTERM, &oldsigterm, NULL);
sigaction(SIGINT, &oldsigint, nullptr);
sigaction(SIGTERM, &oldsigterm, nullptr);
}
}

View File

@ -67,8 +67,8 @@ MaemoCalendarSource::MaemoCalendarSource(int EntryType, int EntryFormat,
break;
}
mc = CMulticalendar::MCInstance();
cal = NULL;
conv = NULL;
cal = nullptr;
conv = nullptr;
if (!mc) {
throwError(SE_HERE, "Could not connect to Maemo Calendar backend");
}
@ -89,7 +89,7 @@ std::string MaemoCalendarSource::getMimeType() const
"text/calendar+plain" :
"text/calendar";
case VCAL_TYPE: return "text/x-calendar";
default: return NULL;
default: return nullptr;
}
}
@ -99,7 +99,7 @@ std::string MaemoCalendarSource::getMimeVersion() const
case -1: return "1.0";
case ICAL_TYPE: return "2.0";
case VCAL_TYPE: return "1.0";
default: return NULL;
default: return nullptr;
}
}
@ -155,9 +155,9 @@ bool MaemoCalendarSource::isEmpty()
void MaemoCalendarSource::close()
{
delete conv;
conv = NULL;
conv = nullptr;
delete cal;
cal = NULL;
cal = nullptr;
}
MaemoCalendarSource::Databases MaemoCalendarSource::getDatabases()
@ -170,7 +170,7 @@ MaemoCalendarSource::Databases MaemoCalendarSource::getDatabases()
vector< CCalendar * > calendars = mc->getListCalFromMc();
Databases result;
BOOST_FOREACH(CCalendar * c, calendars) {
for (CCalendar * c: calendars) {
int id = c->getCalendarId();
ostringstream uri;
uri << "id:" << id;
@ -204,7 +204,7 @@ void MaemoCalendarSource::listAllItems(RevisionMap_t &revisions)
// components of the specified type, so just ignore it for now
if (!comps.size())
break;
BOOST_FOREACH(CComponent * c, comps) {
for (CComponent * c: comps) {
revisions[c->getId()] = get_revision(c);
// Testing shows that the backend doesn't free the memory itself
delete c;
@ -219,7 +219,7 @@ void MaemoCalendarSource::listAllItems(RevisionMap_t &revisions)
// desirable, given the N900's limited memory.
int err;
vector< string > ids = cal->getIdList(entry_type, err);
BOOST_FOREACH(std::string& id, ids) {
for (std::string& id: ids) {
CComponent *c = cal->getEntry(id, entry_type, err);
if (!c)
{
@ -278,7 +278,7 @@ TrackingSyncSource::InsertItemResult MaemoCalendarSource::insertItem(const strin
throwError(SE_HERE, string("no events in ical: ") + item);
}
}
vector< CComponent * >::iterator it = comps.begin();
vector< CComponent * auto it = comps.begin();
if (comps.size() > 1) {
for (; it != comps.end(); ++it) {
delete (*it);

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);
bool isMe = sourceType.m_backend == "Maemo Calendar";
@ -35,11 +35,11 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe || maybeMe) {
if (sourceType.m_format == "" || sourceType.m_format == "text/calendar") {
return new MaemoCalendarSource(EVENT, ICAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(EVENT, ICAL_TYPE, params);
} else if (sourceType.m_format == "text/x-vcalendar") {
return new MaemoCalendarSource(EVENT, VCAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(EVENT, VCAL_TYPE, params);
} else {
return NULL;
return nullptr;
}
}
#endif
@ -52,11 +52,11 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe || maybeMe) {
if (sourceType.m_format == "" || sourceType.m_format == "text/calendar") {
return new MaemoCalendarSource(TODO, ICAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(TODO, ICAL_TYPE, params);
} else if (sourceType.m_format == "text/x-vcalendar") {
return new MaemoCalendarSource(TODO, VCAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(TODO, VCAL_TYPE, params);
} else {
return NULL;
return nullptr;
}
}
#endif
@ -69,18 +69,18 @@ static SyncSource *createSource(const SyncSourceParams &params)
if (isMe || maybeMe) {
if (sourceType.m_format == "" || sourceType.m_format == "text/calendar") {
return new MaemoCalendarSource(JOURNAL, ICAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(JOURNAL, ICAL_TYPE, params);
} else if (sourceType.m_format == "text/x-vcalendar") {
return new MaemoCalendarSource(JOURNAL, VCAL_TYPE, params);
return std::make_unique<MaemoCalendarSource>(JOURNAL, VCAL_TYPE, params);
} else if (sourceType.m_format == "text/plain") {
return new MaemoCalendarSource(JOURNAL, -1, params);
return std::make_unique<MaemoCalendarSource>(JOURNAL, -1, params);
} else {
return NULL;
return nullptr;
}
}
#endif
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("Maemo Calendar/Tasks/Notes",
@ -115,10 +115,10 @@ class MaemoCalendarSourceUnitTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("calendar", "calendar", true));
source.reset(SyncSource::createTestingSource("calendar", "maemo-events", true));
source.reset(SyncSource::createTestingSource("calendar", "Maemo Calendar:text/calendar", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("calendar", "calendar", true);
source = SyncSource::createTestingSource("calendar", "maemo-events", true);
source = SyncSource::createTestingSource("calendar", "Maemo Calendar:text/calendar", true);
}
};

View File

@ -23,14 +23,17 @@
#include <syncevo/GLibSupport.h>
#include <syncevo/GVariantSupport.h>
#include <syncevo/SoupTransportAgent.h>
#include <syncevo/CurlTransportAgent.h>
#include <json.h>
#include <sstream>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
class RefreshTokenAuthProvider : public AuthProvider
{
boost::shared_ptr<HTTPTransportAgent> m_agent;
std::shared_ptr<HTTPTransportAgent> m_agent;
std::string m_tokenHost;
std::string m_tokenPath;
std::string m_scope;
@ -46,6 +49,13 @@ public:
const char* clientID,
const char* clientSecret,
const char* refreshToken) :
m_agent(
#ifdef ENABLE_LIBSOUP
make_weak_shared::make<SoupTransportAgent>(static_cast<GMainLoop *>(nullptr))
#elif defined(ENABLE_LIBCURL)
std::make_shared<CurlTransportAgent>()
#endif
),
m_tokenHost(tokenHost),
m_tokenPath(tokenPath),
m_scope(scope),
@ -53,12 +63,6 @@ public:
m_clientSecret(clientSecret),
m_refreshToken(refreshToken)
{
#ifdef ENABLE_LIBSOUP
boost::shared_ptr<SoupTransportAgent> agent(new SoupTransportAgent(static_cast<GMainLoop *>(NULL)));
m_agent = agent;
#elif defined(ENABLE_LIBCURL)
m_agent = new CurlTransportAgent();
#endif
}
virtual bool methodIsSupported(AuthMethod method) const { return method == AUTH_METHOD_OAUTH2; }
@ -157,15 +161,15 @@ public:
virtual std::string getUsername() const { return ""; }
};
boost::shared_ptr<AuthProvider> createOAuth2AuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createOAuth2AuthProvider(const InitStateString &username,
const InitStateString &password)
{
// Expected content of parameter GVariant.
boost::shared_ptr<GVariantType> hashtype(g_variant_type_new("a{ss}"), g_variant_type_free);
std::shared_ptr<GVariantType> hashtype(g_variant_type_new("a{ss}"), g_variant_type_free);
// 'username' is the part after oauth2: which we can parse directly.
GErrorCXX gerror;
GVariantStealCXX parametersVar(g_variant_parse(hashtype.get(), username.c_str(), NULL, NULL, gerror));
GVariantStealCXX parametersVar(g_variant_parse(hashtype.get(), username.c_str(), nullptr, nullptr, gerror));
if (!parametersVar) {
gerror.throwError(SE_HERE, "parsing 'oauth2:' username");
}
@ -206,7 +210,7 @@ boost::shared_ptr<AuthProvider> createOAuth2AuthProvider(const InitStateString &
if (password.empty()) {
SE_THROW("need refresh token provided as password");
}
boost::shared_ptr<AuthProvider> provider(new RefreshTokenAuthProvider(tokenHost, tokenPath, scope, clientID, clientSecret, password.c_str()));
auto provider = std::make_shared<RefreshTokenAuthProvider>(tokenHost, tokenPath, scope, clientID, clientSecret, password.c_str());
return provider;
}

View File

@ -21,13 +21,13 @@
#include <syncevo/util.h>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
class AuthProvider;
boost::shared_ptr<AuthProvider> createOAuth2AuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createOAuth2AuthProvider(const InitStateString &username,
const InitStateString &password);
SE_END_CXX

View File

@ -41,10 +41,10 @@ public:
" 'Scope', 'ClientID', 'ClientSecret'\n")
{}
virtual boost::shared_ptr<AuthProvider> create(const InitStateString &username,
virtual std::shared_ptr<AuthProvider> create(const InitStateString &username,
const InitStateString &password)
{
boost::shared_ptr<AuthProvider> provider;
std::shared_ptr<AuthProvider> provider;
provider = createOAuth2AuthProvider(username, password);
return provider;
}

View File

@ -25,7 +25,6 @@
#include "PbapSyncSource.h"
#include <boost/assign/list_of.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <boost/tokenizer.hpp>
@ -33,8 +32,8 @@
#include <unistd.h>
#include <stdint.h>
#include <pcrecpp.h>
#include <algorithm>
#include <regex>
#include <syncevo/GLibSupport.h> // PBAP backend does not compile without GLib.
#include <syncevo/util.h>
@ -45,7 +44,6 @@
#include "gdbus-cxx-bridge.h"
#include <boost/algorithm/string/predicate.hpp>
#include <boost/bind.hpp>
#include <synthesis/SDK_util.h>
@ -64,7 +62,7 @@ SE_BEGIN_CXX
#define OBC_TRANSFER_INTERFACE_NEW "org.bluez.obex.Transfer"
#define OBC_TRANSFER_INTERFACE_NEW5 "org.bluez.obex.Transfer1"
typedef std::map<int, pcrecpp::StringPiece> Content;
typedef std::map<int, StringPiece> Content;
typedef std::list<std::string> ContactQueue;
typedef std::list<std::string> Properties;
typedef boost::variant< std::string, Properties, uint16_t > Bluez5Values;
@ -146,7 +144,7 @@ struct PullParams
*
* Note that GetSize() is specified as returning the number of entries in
* the selected phonebook object that are actually used (i.e. indexes that
* correspond to non-NULL entries). This is relevant if contacts get
* correspond to non-nullptr entries). This is relevant if contacts get
* deleted after starting the session. In that case, the algorithm above
* will not necessarily read all contacts. Here's an example:
* offsets #0 till #99, with contacts #10 till #19 deleted
@ -226,7 +224,7 @@ class PullAll
uint16_t m_numContacts; // Number of existing contacts, according to GetSize() or after downloading.
uint16_t m_currentContact; // Numbered starting with zero according to discovery in addVCards.
boost::shared_ptr<PbapSession> m_session; // Only set when there is a transfer ongoing.
std::shared_ptr<PbapSession> m_session; // Only set when there is a transfer ongoing.
size_t m_tmpFileOffset; // Number of bytes already parsed.
uint16_t m_transferOffset; // First contact requested as part of current transfer.
uint16_t m_initialOffset; // First contact request by first transfer.
@ -247,8 +245,8 @@ public:
~PullAll();
std::string getNextID();
bool getContact(const char *id, pcrecpp::StringPiece &vcard);
const char *addVCards(int startIndex, const pcrecpp::StringPiece &content);
bool getContact(const char *id, StringPiece &vcard);
const char *addVCards(int startIndex, const StringPiece &content, bool eof);
};
PullAll::PullAll() :
@ -269,15 +267,16 @@ PullAll::~PullAll()
{
}
class PbapSession : private boost::noncopyable {
class PbapSession : private boost::noncopyable, public enable_weak_from_this<PbapSession> {
public:
static boost::shared_ptr<PbapSession> create(PbapSyncSource &parent);
// Construct via make_weak_shared.
friend make_weak_shared;
void initSession(const std::string &address, const std::string &format);
typedef std::map<std::string, pcrecpp::StringPiece> Content;
typedef std::map<std::string, StringPiece> Content;
boost::shared_ptr<PullAll> startPullAll(const PullParams &pullParams);
std::shared_ptr<PullAll> startPullAll(const PullParams &pullParams);
void continuePullAll(PullAll &state);
void checkForError(); // Throws exception if transfer failed.
Timespec transferComplete() const;
@ -290,8 +289,7 @@ private:
PbapSession(PbapSyncSource &parent);
PbapSyncSource &m_parent;
boost::weak_ptr<PbapSession> m_self;
std::auto_ptr<GDBusCXX::DBusRemoteObject> m_client;
std::unique_ptr<GDBusCXX::DBusRemoteObject> m_client;
bool m_frozen;
enum {
OBEXD_OLD, // obexd < 0.47
@ -333,28 +331,25 @@ private:
Transfers m_transfers;
std::string m_currentTransfer;
std::auto_ptr<GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string> >
std::unique_ptr<GDBusCXX::SignalWatch<GDBusCXX::Path_t, std::string, std::string> >
m_errorSignal;
void errorCb(const GDBusCXX::Path_t &path, const std::string &error,
const std::string &msg);
// Bluez 5
typedef GDBusCXX::SignalWatch4<GDBusCXX::Path_t, std::string, Params, std::vector<std::string> > PropChangedSignal_t;
std::auto_ptr<PropChangedSignal_t> m_propChangedSignal;
typedef GDBusCXX::SignalWatch<GDBusCXX::Path_t, std::string, Params, std::vector<std::string> > PropChangedSignal_t;
std::unique_ptr<PropChangedSignal_t> m_propChangedSignal;
void propChangedCb(const GDBusCXX::Path_t &path,
const std::string &interface,
const Params &changed,
const std::vector<std::string> &invalidated);
// new obexd API
typedef GDBusCXX::SignalWatch1<GDBusCXX::Path_t> CompleteSignal_t;
std::auto_ptr<CompleteSignal_t> m_completeSignal;
void completeCb(const GDBusCXX::Path_t &path);
typedef GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, boost::variant<int64_t> > PropertyChangedSignal_t;
std::auto_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
typedef GDBusCXX::SignalWatch<GDBusCXX::Path_t> CompleteSignal_t;
std::unique_ptr<CompleteSignal_t> m_completeSignal;
typedef GDBusCXX::SignalWatch<GDBusCXX::Path_t, std::string, boost::variant<int64_t> > PropertyChangedSignal_t;
std::unique_ptr<PropertyChangedSignal_t> m_propertyChangedSignal;
void propertyChangedCb(const GDBusCXX::Path_t &path, const std::string &name, const boost::variant<int64_t> &value);
std::auto_ptr<GDBusCXX::DBusRemoteObject> m_session;
std::unique_ptr<GDBusCXX::DBusRemoteObject> m_session;
};
PbapSession::PbapSession(PbapSyncSource &parent) :
@ -363,13 +358,6 @@ PbapSession::PbapSession(PbapSyncSource &parent) :
{
}
boost::shared_ptr<PbapSession> PbapSession::create(PbapSyncSource &parent)
{
boost::shared_ptr<PbapSession> session(new PbapSession(parent));
session->m_self = session;
return session;
}
void PbapSession::propChangedCb(const GDBusCXX::Path_t &path,
const std::string &interface,
const Params &changed,
@ -377,7 +365,7 @@ void PbapSession::propChangedCb(const GDBusCXX::Path_t &path,
{
// Called for a path which matches the current session, so we know
// that the signal is for our transfer. Only need to check the status.
Params::const_iterator it = changed.find("Status");
auto it = changed.find("Status");
if (it != changed.end()) {
std::string status = boost::get<std::string>(it->second);
SE_LOG_DEBUG(NULL, "OBEXD transfer %s: %s",
@ -399,7 +387,7 @@ void PbapSession::propChangedCb(const GDBusCXX::Path_t &path,
OBC_TRANSFER_INTERFACE_NEW5,
OBC_SERVICE_NEW5,
true);
GDBusCXX::DBusClientCall0(transfer, "Suspend")();
GDBusCXX::DBusClientCall<>(transfer, "Suspend")();
SE_LOG_DEBUG(NULL, "successfully suspended transfer when it became active");
} catch (...) {
// Ignore all errors here. The worst that can happen is that
@ -413,24 +401,6 @@ void PbapSession::propChangedCb(const GDBusCXX::Path_t &path,
}
}
void PbapSession::completeCb(const GDBusCXX::Path_t &path)
{
SE_LOG_DEBUG(NULL, "obexd transfer %s completed", path.c_str());
m_transfers[path] = Completion::now();
}
void PbapSession::errorCb(const GDBusCXX::Path_t &path,
const std::string &error,
const std::string &msg)
{
SE_LOG_DEBUG(NULL, "obexd transfer %s failed: %s %s",
path.c_str(), error.c_str(), msg.c_str());
Completion &completion = m_transfers[path];
completion.m_transferComplete = Timespec::monotonic();
completion.m_transferErrorCode = error;
completion.m_transferErrorMsg = msg;
}
void PbapSession::propertyChangedCb(const GDBusCXX::Path_t &path,
const std::string &name,
const boost::variant<int64_t> &value)
@ -448,35 +418,36 @@ void PbapSession::propertyChangedCb(const GDBusCXX::Path_t &path,
Properties PbapSession::supportedProperties() const
{
Properties props;
static const std::set<std::string> supported =
boost::assign::list_of("VERSION")
("FN")
("N")
("PHOTO")
("BDAY")
("ADR")
("LABEL")
("TEL")
("EMAIL")
("MAILER")
("TZ")
("GEO")
("TITLE")
("ROLE")
("LOGO")
("AGENT")
("ORG")
("NOTE")
("REV")
("SOUND")
("URL")
("UID")
("KEY")
("NICKNAME")
("CATEGORIES")
("CLASS");
static const std::set<std::string> supported = {
"VERSION",
"FN",
"N",
"PHOTO",
"BDAY",
"ADR",
"LABEL",
"TEL",
"EMAIL",
"MAILER",
"TZ",
"GEO",
"TITLE",
"ROLE",
"LOGO",
"AGENT",
"ORG",
"NOTE",
"REV",
"SOUND",
"URL",
"UID",
"KEY",
"NICKNAME",
"CATEGORIES",
"CLASS"
};
BOOST_FOREACH (const std::string &prop, m_filterFields) {
for (const std::string &prop: m_filterFields) {
// Be conservative and only ask for properties that we
// really know how to use. obexd also lists the bit field
// strings ("BIT01") but phones have been seen to reject
@ -500,14 +471,15 @@ void PbapSession::initSession(const std::string &address, const std::string &for
// 3.0:^PHOTO = download in vCard 3.0 format, excluding PHOTO
// 2.1:PHOTO = download in vCard 2.1 format, only the PHOTO
std::string version;
std::string tmp;
std::string properties;
const pcrecpp::RE re("(?:(2\\.1|3\\.0):?)?(\\^?)([-a-zA-Z,]*)");
if (!re.FullMatch(format, &version, &tmp, &properties)) {
const static std::regex re(R"del((?:(2\.1|3\.0):?)?(\^?)([-a-zA-Z,]*))del");
std::smatch match;
if (!std::regex_match(format, match, re)) {
m_parent.throwError(SE_HERE, StringPrintf("invalid specification of PBAP vCard format (databaseFormat): %s",
format.c_str()));
}
std::string version = match[1];
std::string tmp = match[2];
std::string properties = match[3];
char negated = tmp.c_str()[0];
if (version.empty()) {
// same default as in obexd
@ -525,7 +497,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
params["Target"] = std::string("PBAP");
std::string session;
GDBusCXX::DBusConnectionPtr conn = GDBusCXX::dbus_get_bus_connection("SESSION", NULL, true, NULL);
GDBusCXX::DBusConnectionPtr conn = GDBusCXX::dbus_get_bus_connection("SESSION", nullptr, true, nullptr);
// We must attempt to use the new interface(s), otherwise we won't know whether
// the daemon exists or can be started.
@ -537,7 +509,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
try {
SE_LOG_DEBUG(NULL, "trying to use bluez 5 obexd service %s", OBC_SERVICE_NEW5);
session =
GDBusCXX::DBusClientCall1<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(address, params);
GDBusCXX::DBusClientCall<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(address, params);
} catch (const std::exception &error) {
if (!strstr(error.what(), "org.freedesktop.DBus.Error.ServiceUnknown") &&
!strstr(error.what(), "org.freedesktop.DBus.Error.UnknownObject")) {
@ -556,7 +528,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
try {
SE_LOG_DEBUG(NULL, "trying to use new obexd service %s", OBC_SERVICE_NEW);
session =
GDBusCXX::DBusClientCall1<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(address, params);
GDBusCXX::DBusClientCall<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(address, params);
} catch (const std::exception &error) {
if (!strstr(error.what(), "org.freedesktop.DBus.Error.ServiceUnknown")) {
throw;
@ -573,7 +545,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
m_client.reset(new GDBusCXX::DBusRemoteObject(conn, "/", OBC_CLIENT_INTERFACE,
OBC_SERVICE, true));
params["Destination"] = std::string(address);
session = GDBusCXX::DBusClientCall1<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(params);
session = GDBusCXX::DBusClientCall<GDBusCXX::DBusObject_t>(*m_client, "CreateSession")(params);
}
if (session.empty()) {
@ -598,7 +570,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
// pointer and ignore callback when the instance is already gone.
// Should not happen with signals (destructing the class unregisters
// the watch), but very well may happen in asynchronous method
// calls. Therefore maintain m_self and show how to use it here.
// calls.
if (m_obexAPI == BLUEZ5) {
// Bluez 5
m_propChangedSignal.reset(new PropChangedSignal_t
@ -607,7 +579,12 @@ void PbapSession::initSession(const std::string &address, const std::string &for
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
GDBusCXX::SignalFilter::SIGNAL_FILTER_PATH_PREFIX)));
m_propChangedSignal->activate(boost::bind(&PbapSession::propChangedCb, m_self, _1, _2, _3, _4));
m_propChangedSignal->activate([self=weak_from_this()] (const GDBusCXX::Path_t &path, const std::string &interface, const Params &changed, const std::vector<std::string> &invalidated) {
auto lock = self.lock();
if (lock) {
lock->propChangedCb(path, interface, changed, invalidated);
}
});
} else {
// obexd >= 0.47
m_completeSignal.reset(new CompleteSignal_t
@ -616,16 +593,32 @@ void PbapSession::initSession(const std::string &address, const std::string &for
OBC_TRANSFER_INTERFACE_NEW,
"Complete",
GDBusCXX::SignalFilter::SIGNAL_FILTER_PATH_PREFIX)));
m_completeSignal->activate(boost::bind(&PbapSession::completeCb, m_self, _1));
m_completeSignal->activate([self=weak_from_this()] (const GDBusCXX::Path_t &path) {
auto lock = self.lock();
SE_LOG_DEBUG(NULL, "obexd transfer %s completed", path.c_str());
if (lock) {
lock->m_transfers[path] = Completion::now();
}
});
// same for error
m_errorSignal.reset(new GDBusCXX::SignalWatch3<GDBusCXX::Path_t, std::string, std::string>
m_errorSignal.reset(new GDBusCXX::SignalWatch<GDBusCXX::Path_t, std::string, std::string>
(GDBusCXX::SignalFilter(m_client->getConnection(),
session,
OBC_TRANSFER_INTERFACE_NEW,
"Error",
GDBusCXX::SignalFilter::SIGNAL_FILTER_PATH_PREFIX)));
m_errorSignal->activate(boost::bind(&PbapSession::errorCb, m_self, _1, _2, _3));
m_errorSignal->activate([self=weak_from_this()] (const GDBusCXX::Path_t &path, const std::string &error, const std::string &msg) {
auto lock = self.lock();
SE_LOG_DEBUG(NULL, "obexd transfer %s failed: %s %s",
path.c_str(), error.c_str(), msg.c_str());
if (lock) {
Completion &completion = lock->m_transfers[path];
completion.m_transferComplete = Timespec::monotonic();
completion.m_transferErrorCode = error;
completion.m_transferErrorMsg = msg;
}
});
// and property changes
m_propertyChangedSignal.reset(new PropertyChangedSignal_t(GDBusCXX::SignalFilter(m_client->getConnection(),
@ -633,7 +626,12 @@ void PbapSession::initSession(const std::string &address, const std::string &for
OBC_TRANSFER_INTERFACE_NEW,
"PropertyChanged",
GDBusCXX::SignalFilter::SIGNAL_FILTER_PATH_PREFIX)));
m_propertyChangedSignal->activate(boost::bind(&PbapSession::propertyChangedCb, m_self, _1, _2, _3));
m_propertyChangedSignal->activate([self=weak_from_this()] (const GDBusCXX::Path_t &path, const std::string &interface , const boost::variant<int64_t> &value) {
auto lock = self.lock();
if (lock) {
lock->propertyChangedCb(path, interface, value);
}
});
}
} else {
// obexd < 0.47
@ -647,7 +645,7 @@ void PbapSession::initSession(const std::string &address, const std::string &for
SE_LOG_DEBUG(NULL, "PBAP session created: %s", m_session->getPath());
// get filter list so that we can continue validating our format specifier
m_filterFields = GDBusCXX::DBusClientCall1< Properties >(*m_session, "ListFilterFields")();
m_filterFields = GDBusCXX::DBusClientCall< Properties >(*m_session, "ListFilterFields")();
SE_LOG_DEBUG(NULL, "supported PBAP filter fields:\n %s",
boost::join(m_filterFields, "\n ").c_str());
@ -658,15 +656,15 @@ void PbapSession::initSession(const std::string &address, const std::string &for
}
// validate parameters and update filter
BOOST_FOREACH (const std::string &prop, keywords) {
for (const std::string &prop: keywords) {
if (prop.empty()) {
continue;
}
Properties::const_iterator entry =
auto entry =
std::find_if(m_filterFields.begin(),
m_filterFields.end(),
boost::bind(&boost::iequals<std::string,std::string>, _1, prop, std::locale()));
[&prop] (const std::string &other) { return boost::iequals(other, prop, std::locale()); });
if (entry == m_filterFields.end()) {
m_parent.throwError(SE_HERE, StringPrintf("invalid property name in PBAP vCard format specification (databaseFormat): %s",
@ -680,14 +678,14 @@ void PbapSession::initSession(const std::string &address, const std::string &for
}
}
GDBusCXX::DBusClientCall0(*m_session, "Select")(std::string("int"), std::string("PB"));
GDBusCXX::DBusClientCall<>(*m_session, "Select")(std::string("int"), std::string("PB"));
m_filter5["Format"] = version == "2.1" ? "vcard21" : "vcard30";
m_filter5["Fields"] = filter;
SE_LOG_DEBUG(NULL, "PBAP session initialized");
}
boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParams)
std::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParams)
{
resetTransfer();
blockOnFreeze();
@ -717,7 +715,7 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
if (filter.empty()) {
filter = supportedProperties();
}
for (Properties::iterator it = filter.begin();
for (auto it = filter.begin();
it != filter.end();
++it) {
if (*it == "PHOTO") {
@ -734,8 +732,8 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
if (m_obexAPI == OBEXD_OLD ||
m_obexAPI == OBEXD_NEW) {
try {
GDBusCXX::DBusClientCall0(*m_session, "SetFilter")(filter);
GDBusCXX::DBusClientCall0(*m_session, "SetFormat")(format);
GDBusCXX::DBusClientCall<>(*m_session, "SetFilter")(filter);
GDBusCXX::DBusClientCall<>(*m_session, "SetFormat")(format);
} catch (...) {
// Ignore failure, can happen with 0.48. Instead send filter together
// with PullAll method call.
@ -744,7 +742,7 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
}
}
boost::shared_ptr<PullAll> state(new PullAll);
auto state = std::make_shared<PullAll>();
state->m_pullParams = pullParams;
state->m_contentStartIndex = 0;
state->m_currentContact = 0;
@ -759,7 +757,7 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
// Beware, this will lead to a "Complete" signal in obexd
// 0.47. We need to be careful with looking at the right
// transfer to determine whether PullAll completed.
state->m_numContacts = GDBusCXX::DBusClientCall1<uint16_t>(*m_session, "GetSize")();
state->m_numContacts = GDBusCXX::DBusClientCall<uint16_t>(*m_session, "GetSize")();
SE_LOG_DEBUG(NULL, "Expecting %d contacts.", state->m_numContacts);
state->m_tmpFile.create(TmpFile::FILE);
@ -791,12 +789,12 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
Bluez5PullAllResult tuple =
pullAllWithFiltersFallback ?
// 0.48
GDBusCXX::DBusClientCall1<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state->m_tmpFile.filename(), currentFilter) :
GDBusCXX::DBusClientCall<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state->m_tmpFile.filename(), currentFilter) :
m_obexAPI == OBEXD_NEW ?
// 0.47
GDBusCXX::DBusClientCall1<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state->m_tmpFile.filename()) :
GDBusCXX::DBusClientCall<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state->m_tmpFile.filename()) :
// 5.x
GDBusCXX::DBusClientCall2<GDBusCXX::DBusObject_t, Params>(*m_session, "PullAll")(state->m_tmpFile.filename(), currentFilter);
GDBusCXX::DBusClientCall<GDBusCXX::DBusObject_t, Params>(*m_session, "PullAll")(state->m_tmpFile.filename(), currentFilter);
const GDBusCXX::DBusObject_t &transfer = tuple.first;
const Params &properties = tuple.second;
m_currentTransfer = transfer;
@ -812,7 +810,7 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
// and the Synthesis engine will ignore the ID (src/sysync/binfileimplds.cpp:
// "Record does not exist any more in database%s -> ignore").
state->m_tmpFileOffset = 0;
state->m_session = m_self.lock();
state->m_session = shared_from_this();
state->m_filter = currentFilter;
} else {
// < 0.47
@ -823,28 +821,66 @@ boost::shared_ptr<PullAll> PbapSession::startPullAll(const PullParams &pullParam
// of obex-client < 0.47. Not sure what we should do about
// this: disable incremental sync for old obex-client? Reject
// it? Catch the error and add a better exlanation?
GDBusCXX::DBusClientCall1<std::string> pullall(*m_session, "PullAll");
GDBusCXX::DBusClientCall<std::string> pullall(*m_session, "PullAll");
state->m_buffer = pullall();
state->addVCards(0, state->m_buffer);
state->addVCards(0, state->m_buffer, true);
state->m_numContacts = state->m_content.size();
}
return state;
}
const char *PullAll::addVCards(int startIndex, const pcrecpp::StringPiece &vcards)
const char *findLine(const StringPiece &hay, const StringPiece &needle, bool eof)
{
pcrecpp::StringPiece vcarddata;
pcrecpp::StringPiece tmp = vcards;
int count = startIndex;
pcrecpp::RE re("[\\r\\n]*(^BEGIN:VCARD.*?^END:VCARD)",
pcrecpp::RE_Options().set_dotall(true).set_multiline(true));
while (re.Consume(&tmp, &vcarddata)) {
m_content[count] = vcarddata;
++count;
const char *current = hay.begin();
const char *end = hay.end();
size_t size = needle.size();
while (current < end) {
// Skip line break(s).
while (current < end && (*current == '\n' || *current == '\r')) {
current++;
}
const char *next = current + size;
if (next <= end &&
!memcmp(current, needle.begin(), size) &&
((eof && next == end) ||
(next + 1 < end && (*next == '\n' || *next == '\r')))) {
// Found a matching line.
return current;
}
// Skip line.
while (current < end && *current != '\n' && *current != '\r') {
current++;
}
}
return nullptr;
}
const char *PullAll::addVCards(int startIndex, const StringPiece &vcards, bool eof)
{
const char *current = vcards.begin();
const char *end = vcards.end();
const static StringPiece BEGIN_VCARD("BEGIN:VCARD");
const static StringPiece END_VCARD("END:VCARD");
int count = startIndex;
while (true) {
StringPiece remaining(current, end - current);
const char *begin_vcard = findLine(remaining, BEGIN_VCARD, eof);
if (begin_vcard) {
const char *end_vcard = findLine(StringPiece(remaining), END_VCARD, eof);
if (end_vcard) {
const char *next = end_vcard + END_VCARD.size();
StringPiece vcarddata(begin_vcard, next - begin_vcard);
m_content[count] = vcarddata;
++count;
current = next;
continue;
}
}
// No further vcard found, try again when we have more data.
break;
}
SE_LOG_DEBUG(NULL, "PBAP content parsed: %d contacts starting at ID %d", count - startIndex, startIndex);
return tmp.data();
return current;
}
void PbapSession::continuePullAll(PullAll &state)
@ -855,9 +891,9 @@ void PbapSession::continuePullAll(PullAll &state)
Bluez5PullAllResult tuple =
m_obexAPI == BLUEZ5 ?
GDBusCXX::DBusClientCall2<GDBusCXX::DBusObject_t, Params>(*m_session, "PullAll")(state.m_tmpFile.filename(), state.m_filter) :
GDBusCXX::DBusClientCall<GDBusCXX::DBusObject_t, Params>(*m_session, "PullAll")(state.m_tmpFile.filename(), state.m_filter) :
// must be 0.48
GDBusCXX::DBusClientCall1<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state.m_tmpFile.filename(), state.m_filter);
GDBusCXX::DBusClientCall<std::pair<GDBusCXX::DBusObject_t, Params> >(*m_session, "PullAll")(state.m_tmpFile.filename(), state.m_filter);
const GDBusCXX::DBusObject_t &transfer = tuple.first;
const Params &properties = tuple.second;
@ -871,7 +907,7 @@ void PbapSession::continuePullAll(PullAll &state)
void PbapSession::checkForError()
{
Transfers::const_iterator it = m_transfers.find(m_currentTransfer);
auto it = m_transfers.find(m_currentTransfer);
if (it != m_transfers.end()) {
if (!it->second.m_transferErrorCode.empty()) {
m_parent.throwError(SE_HERE, StringPrintf("%s: %s",
@ -884,7 +920,7 @@ void PbapSession::checkForError()
Timespec PbapSession::transferComplete() const
{
Timespec res;
Transfers::const_iterator it = m_transfers.find(m_currentTransfer);
auto it = m_transfers.find(m_currentTransfer);
if (it != m_transfers.end()) {
res = it->second.m_transferComplete;
}
@ -906,7 +942,7 @@ std::string PullAll::getNextID()
return id;
}
bool PullAll::getContact(const char *id, pcrecpp::StringPiece &vcard)
bool PullAll::getContact(const char *id, StringPiece &vcard)
{
int contactNumber = atoi(id);
SE_LOG_DEBUG(NULL, "get PBAP contact ID %s", id);
@ -932,7 +968,7 @@ bool PullAll::getContact(const char *id, pcrecpp::StringPiece &vcard)
// now).
while (!m_session->transferComplete() && m_tmpFile.moreData() < 128 * 1024) {
s.checkForNormal();
g_main_context_iteration(NULL, true);
g_main_context_iteration(nullptr, true);
}
m_session->checkForError();
@ -940,13 +976,13 @@ bool PullAll::getContact(const char *id, pcrecpp::StringPiece &vcard)
if (m_tmpFile.moreData()) {
// Remap. This shifts all addresses already stored in
// m_content, so beware and update those.
pcrecpp::StringPiece oldMem = m_tmpFile.stringPiece();
StringPiece oldMem = m_tmpFile.stringPiece();
m_tmpFile.unmap();
m_tmpFile.map();
pcrecpp::StringPiece newMem = m_tmpFile.stringPiece();
StringPiece newMem = m_tmpFile.stringPiece();
ssize_t delta = newMem.data() - oldMem.data();
BOOST_FOREACH (Content::value_type &entry, m_content) {
pcrecpp::StringPiece &vcard = entry.second;
for (auto &entry: m_content) {
StringPiece &vcard = entry.second;
vcard.set(vcard.data() + delta, vcard.size());
}
@ -955,15 +991,15 @@ bool PullAll::getContact(const char *id, pcrecpp::StringPiece &vcard)
m_tmpFile.remove();
// Continue parsing where we stopped before.
pcrecpp::StringPiece next(newMem.data() + m_tmpFileOffset,
newMem.size() - m_tmpFileOffset);
const char *end = addVCards(m_contentStartIndex + m_content.size(), next);
StringPiece next(newMem.data() + m_tmpFileOffset,
newMem.size() - m_tmpFileOffset);
const char *end = addVCards(m_contentStartIndex + m_content.size(), next, completed);
size_t newTmpFileOffset = end - newMem.data();
SE_LOG_DEBUG(NULL, "PBAP content parsed: %ld out of %d (total), %d out of %d (last update)",
SE_LOG_DEBUG(NULL, "PBAP content parsed: %ld out of %ld (total), %d out of %ld (last update)",
(long)newTmpFileOffset,
newMem.size(),
(long)newMem.size(),
(int)(end - next.data()),
next.size());
(long)next.size());
m_tmpFileOffset = newTmpFileOffset;
if (completed) {
@ -1039,7 +1075,7 @@ bool PullAll::getContact(const char *id, pcrecpp::StringPiece &vcard)
void PbapSession::shutdown(void)
{
GDBusCXX::DBusClientCall0 removeSession(*m_client, "RemoveSession");
GDBusCXX::DBusClientCall<> removeSession(*m_client, "RemoveSession");
// always clear pointer, even if method call fails
GDBusCXX::DBusObject_t path(m_session->getPath());
@ -1075,9 +1111,9 @@ void PbapSession::setFreeze(bool freeze)
true);
try {
if (freeze) {
GDBusCXX::DBusClientCall0(transfer, "Suspend")();
GDBusCXX::DBusClientCall<>(transfer, "Suspend")();
} else {
GDBusCXX::DBusClientCall0(transfer, "Resume")();
GDBusCXX::DBusClientCall<>(transfer, "Resume")();
}
} catch (...) {
std::string explanation;
@ -1101,7 +1137,7 @@ void PbapSession::setFreeze(bool freeze)
SE_LOG_DEBUG(NULL, "must retry Suspend(), got error at the moment: %s", explanation.c_str());
} else {
// Have to abort.
GDBusCXX::DBusClientCall0(transfer, "Cancel")();
GDBusCXX::DBusClientCall<>(transfer, "Cancel")();
// Bluez does not change the transfer status when cancelling it,
// so our propChangedCb() doesn't get called. We need to record
@ -1127,7 +1163,7 @@ void PbapSession::blockOnFreeze()
SuspendFlags &s = SuspendFlags::getSuspendFlags();
while (m_frozen) {
s.checkForNormal();
g_main_context_iteration(NULL, true);
g_main_context_iteration(nullptr, true);
}
}
@ -1135,12 +1171,17 @@ PbapSyncSource::PbapSyncSource(const SyncSourceParams &params) :
SyncSource(params)
{
SyncSourceSession::init(m_operations);
m_operations.m_readNextItem = boost::bind(&PbapSyncSource::readNextItem, this, _1, _2, _3);
m_operations.m_readItemAsKey = boost::bind(&PbapSyncSource::readItemAsKey,
this, _1, _2);
m_session = PbapSession::create(*this);
m_operations.m_readNextItem = [this] (sysync::ItemID aID,
sysync::sInt32 *aStatus,
bool aFirst) {
return readNextItem(aID, aStatus, aFirst);
};
m_operations.m_readItemAsKey = [this] (sysync::cItemID aID, sysync::KeyH aItemKey) {
return readItemAsKey(aID, aItemKey);
};
m_session = make_weak_shared::make<PbapSession>(*this);
const char *PBAPSyncMode = getenv("SYNCEVOLUTION_PBAP_SYNC");
m_PBAPSyncMode = !PBAPSyncMode ? PBAP_SYNC_NORMAL :
m_PBAPSyncMode = !PBAPSyncMode ? PBAP_SYNC_INCREMENTAL :
boost::iequals(PBAPSyncMode, "incremental") ? PBAP_SYNC_INCREMENTAL :
boost::iequals(PBAPSyncMode, "text") ? PBAP_SYNC_TEXT :
boost::iequals(PBAPSyncMode, "all") ? PBAP_SYNC_NORMAL :
@ -1273,13 +1314,13 @@ sysync::TSyError PbapSyncSource::readNextItem(sysync::ItemID aID,
PULL_AS_CONFIGURED;
const char *env;
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_TRANSFER_TIME")) != NULL) {
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_TRANSFER_TIME")) != nullptr) {
params.m_timePerChunk = atof(env);
} else {
params.m_timePerChunk = 30;
}
static const double LAMBDA_DEF = 0.1;
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_TIME_LAMBDA")) != NULL) {
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_TIME_LAMBDA")) != nullptr) {
params.m_timeLambda = atof(env);
} else {
params.m_timeLambda = LAMBDA_DEF;
@ -1288,13 +1329,13 @@ sysync::TSyError PbapSyncSource::readNextItem(sysync::ItemID aID,
params.m_timeLambda > 1) {
params.m_timeLambda = LAMBDA_DEF;
}
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_PHOTO")) != NULL) {
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_PHOTO")) != nullptr) {
params.m_startMaxCount[true] = atoi(env);
}
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_NO_PHOTO")) != NULL) {
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_MAX_COUNT_NO_PHOTO")) != nullptr) {
params.m_startMaxCount[false] = atoi(env);
}
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_OFFSET")) != NULL) {
if ((env = getenv("SYNCEVOLUTION_PBAP_CHUNK_OFFSET")) != nullptr) {
params.m_startOffset = atoi(env);
} else {
unsigned int seed = (unsigned int)Timespec::system().seconds();
@ -1319,7 +1360,7 @@ sysync::TSyError PbapSyncSource::readNextItem(sysync::ItemID aID,
} else {
*aStatus = sysync::ReadNextItem_Unchanged;
aID->item = StrAlloc(id.c_str());
aID->parent = NULL;
aID->parent = nullptr;
m_hadContacts = true;
}
return sysync::LOCERR_OK;
@ -1330,7 +1371,7 @@ sysync::TSyError PbapSyncSource::readItemAsKey(sysync::cItemID aID, sysync::KeyH
if (!m_pullAll) {
throwError(SE_HERE, "logic error: readItemAsKey() without preceeding readNextItem()");
}
pcrecpp::StringPiece vcard;
StringPiece vcard;
if (m_pullAll->getContact(aID->item, vcard)) {
return getSynthesisAPI()->setValue(aItemKey, "itemdata", vcard.data(), vcard.size());
} else {
@ -1349,7 +1390,7 @@ void PbapSyncSource::readItemRaw(const std::string &luid, std::string &item)
if (!m_pullAll) {
throwError(SE_HERE, "logic error: readItemRaw() without preceeding readNextItem()");
}
pcrecpp::StringPiece vcard;
StringPiece vcard;
if (m_pullAll->getContact(luid.c_str(), vcard)) {
item.assign(vcard.data(), vcard.size());
} else {

View File

@ -28,8 +28,6 @@
#include <memory>
#include <boost/noncopyable.hpp>
#include <pcrecpp.h>
#include <syncevo/declarations.h>
#include <syncevo/TmpFile.h>
SE_BEGIN_CXX
@ -65,8 +63,8 @@ class PbapSyncSource : virtual public SyncSource, virtual public SyncSourceSessi
virtual void readItemRaw(const std::string &luid, std::string &item);
private:
boost::shared_ptr<PbapSession> m_session;
boost::shared_ptr<PullAll> m_pullAll;
std::shared_ptr<PbapSession> m_session;
std::shared_ptr<PullAll> m_pullAll;
enum PBAPSyncMode {
PBAP_SYNC_NORMAL, ///< Read contact data according to filter.
PBAP_SYNC_TEXT, ///< Sync without reading photo data from phone and keeping local photos instead.

Some files were not shown because too many files have changed in this diff Show More