Compare commits

...

185 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
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
329 changed files with 9659 additions and 44083 deletions

View File

@ -79,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.
@ -94,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$(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)$(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)
@ -354,7 +348,7 @@ endif
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;' \

23
NEWS
View File

@ -1,3 +1,26 @@
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
========================================

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.3])])
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,11 @@ 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.
@ -78,9 +83,13 @@ 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.
# -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],
[-Wall -Wno-unknown-pragmas -Wno-deprecated-declarations],
[])
# Fix code to work without deprecated methods: G GDK GDK_PIXBUF CAIRO PANGO GTK
@ -520,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
@ -581,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)
@ -740,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>],
@ -1154,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"

36
debian/README.source vendored
View File

@ -1,36 +0,0 @@
Building syncevolution for Debian
---------------------------------
The source package needs no special instructions; the discussion here
is about working with the git repository.
Patches are exported based on debian/source/git-patches; each line is
an argument to git-format-patch. The variables $DEB_VERSION and
$UPSTREAM_VERSION are the Debian and upstream version being exported.
You can either use git-format-patch manually, or install gitpkg
version 0.17 or later.
1) To have the patches automatically exported at source package creation time
a) to setup gitpkg, run
% git config gitpkg.deb-export-hook /usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
b) run
% gitpkg master
to make a source package.
2) To manually export patches, run
% ./debian/rules export-patches
The original source tarballs are stored in the git repo using
pristine-tar. You can (optionally) check out the current tarball by
git branch pristine-tar origin/pristine-tar
# UPSTREAM should be the current upstream version
pristine-tar checkout ../syncevolution_$(UPSTREAM).orig.tar.gz
-- David Bremner <bremner@debian.org>, Tue, 8 Mar 2011 19:34:24 -0400

8
debian/TODO vendored
View File

@ -1,5 +1,3 @@
- add missing manpages for syncompare and syncevo-http-server
- clean up src/syncevo/CmdLine.cpp(.orig|.rej)
-- David Bremner <bremner@debian.org>, Thu, 11 Nov 2010 11:48:32 -0400
* add missing manpages for syncompare and syncevo-http-server
* fix FTPFS with g++ 11 without CXXFLAG -std=c++14;
see <https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/issues/167>

94
debian/changelog vendored
View File

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

33
debian/clean vendored
View File

@ -1,33 +0,0 @@
Makefile.in
aclocal.m4
config.guess
config.h.in
config.sub
configure
configure.in
depcomp
install-sh
intltool-extract.in
intltool-merge.in
intltool-update.in
ltmain.sh
m4/intltool.m4
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
m4/ltversion.m4
m4/lt~obsolete.m4
missing
mkinstalldirs
po/Makefile.in.in
src/Makefile.am
src/Makefile.in
src/backends/addressbook/Makefile.in
src/backends/evolution/Makefile.in
src/backends/file/Makefile.in
src/backends/sqlite/Makefile.in
src/core/Makefile.in
src/dbus/Makefile.in
src/dbus/interfaces/Makefile.in
src/gtk-ui/Makefile.in
test/Makefile.in

1
debian/compat vendored
View File

@ -1 +0,0 @@
11

144
debian/control vendored
View File

@ -1,31 +1,45 @@
Source: syncevolution
Section: utils
Priority: optional
Maintainer: Tino Mettler <tino+debian@tikei.de>
Build-Depends: debhelper (>= 11), libedataserver1.2-dev,
libecal1.2-dev, libebook1.2-dev, libcurl4-gnutls-dev, libboost-dev,
libsynthesis-dev (>=3.4.0.47.5),
libtool, automake, intltool, pkg-config,
libglib2.0-dev, libgladeui-dev, libdbus-glib-1-dev, libgtk-3-dev,
libgconf2-dev,
libsecret-1-dev,
xsltproc,
libopenobex2-dev [linux-any], libnotify-dev,
python-docutils, libical-dev, libneon27-gnutls-dev, libpcre3-dev,
libcppunit-dev, kdepimlibs5-dev, kdelibs5-dev,
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,
g++ (>= 4:7)
Standards-Version: 4.1.3
Homepage: http://www.syncevolution.org
Vcs-Git: git://anonscm.debian.org/collab-maint/syncevolution
Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/syncevolution.git
libneon27-gnutls-dev,
libnotify-dev,
libopenobex2-dev [linux-any],
libsecret-1-dev,
libsynthesis-dev,
python3-docutils,
python3-pygments,
xsltproc,
Standards-Version: 4.6.0
Homepage: https://www.syncevolution.org/
Vcs-Git: https://salsa.debian.org/debian/syncevolution.git
Vcs-Browser: https://salsa.debian.org/debian/syncevolution
Rules-Requires-Root: no
Package: syncevolution
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version})
Recommends: bluez
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
@ -38,9 +52,13 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (CLI)
Package: sync-ui
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}),
syncevolution-dbus
Recommends: bluez
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
@ -53,7 +71,11 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (GTK+ GUI)
Package: syncevolution-common
Architecture: all
Depends: ${misc:Depends}, libsynthesis0v5 (>= 3.4.0.47.5)
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
@ -66,9 +88,12 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (common fi
Package: syncevolution-libs
Architecture: any
Depends: syncevolution-libs-gnome (= ${binary:Version}) |
syncevolution-libs-kde (= ${binary:Version}),
${misc:Depends}, ${shlibs:Depends}
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
@ -81,10 +106,11 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (backend l
Package: syncevolution-libs-gnome
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Recommends: evolution-data-server
Replaces: syncevolution-libs (<< 1.3.99.7)
Breaks: syncevolution-libs (<< 1.3.99.7)
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
@ -95,26 +121,14 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (GNOME bac
.
This package provides private libraries and plugins for GNOME.
Package: syncevolution-libs-kde
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Replaces: syncevolution-libs (<< 1.3.99.7)
Breaks: syncevolution-libs (<< 1.3.99.7)
Description: Sync personal information data via SyncML/CalDAV/CardDAV (KDE 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 KDE.
Package: syncevolution-dbus
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends},
syncevolution-common (= ${source:Version}),
syncevolution-libs (= ${binary:Version}), dbus
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
@ -127,8 +141,14 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (D-Bus sup
Package: syncevolution-http
Architecture: all
Depends: ${misc:Depends}, syncevolution-dbus (>= ${source:Version}), python,
python-dbus, dbus-x11, python-twisted-web, python-gobject, python-openssl
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
@ -142,7 +162,11 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (HTTP serv
Package: libsyncevolution0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
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
@ -155,7 +179,11 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (shared li
Package: libsyncevo-dbus0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
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
@ -168,9 +196,11 @@ Description: Sync personal information data via SyncML/CalDAV/CardDAV (shared D-
Package: libgdbussyncevo0
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, syncevolution-common (= ${source:Version}), dbus
Replaces: syncevolution-libs (<< 1.2.99.1)
Breaks: syncevolution-libs (<< 1.2.99.1)
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

418
debian/copyright vendored
View File

@ -1,174 +1,280 @@
Source: http://downloads.syncevolution.org/syncevolution/sources/
git://git.moblin.org/syncevolution
Currently the tarball is built from a tag in the moblin repo to avoid the
embedded copy of libsynthesis. For details, see the get-orig-source rule
in debian/rules.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: SyncEvolution
Upstream-Contact: https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/issues
Source: https://gitlab.freedesktop.org/SyncEvolution/syncevolution/
Files: *
Copyright: © 2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
License: LGPL2.1 | LGPL3
Copyright:
2012 BMW Car IT GmbH.
2016 Emanoil Kotsev <emanoil.kotsev@fincom.at>
2008 Funambol, Inc.
2009, 2011-2012 Intel Corporation
2009 m-otion communications GmbH <knipp@m-otion.com>
2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
2011 Symbio, Ville Nummela
2004-2008 Synthesis AG
License-Grant:
This library is free software;
you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation;
either version 2.1 of the License, or (at your option) version 3.
License: LGPL-2.1 or LGPL-3
Comment:
Files below <src/backends/webdav/*> lack licensing.
Licensing of those files is assumed same as generally for the project.
File: test/client-test.cpp
Copyright: © 2008-2009 Patrick Ohly <patrick.ohly@gmx.de>
© 2008 Funambol, Inc
License: LGPL2.1 | LGPL3
Files:
build/xsl/*
Copyright:
2003 Jiří Kosek
1999-2007 Norman Walsh
2011-2012 O'Reilly Media
2004-2007 Steve Ball
2005-2008 The DocBook Project
License: Expat~Docbook
Reference: build/xsl/COPYING
Files: src/core/LogRedirect.h src/core/SoupTransportAgent.cpp
src/core/TransportAgent.cpp src/core/TransportAgent.h
src/core/SynthesisEngine.cpp src/DBusSyncClient.cpp
src/syncevo-dbus-server.cpp src/core/CurlTransportAgent.h
src/core/SoupTransportAgent.h src/core/CurlTransportAgent.cpp
src/DBusSyncClient.h src/syncevo-dbus-server.h src/dbus/* src/gtk-ui/*
test/test.cpp
Copyright: © 2009 Intel Corporation
License: LGPL2.1 | LGPL3
Files: m4-repo/*.m4
Copyright:
2008 Benjamin Kosnik <bkoz@redhat.com>
2014-2015 Google Inc.
2008 John Darrington <j.darrington@elvis.murdoch.edu.au>
2016 Krzesimir Nowak <qdlacz@gmail.com>
2015 Moritz Klammler <moritz@klammler.eu>
2015 Paul Norman <penorman@mac.com>
2009 Peter Adolphs
2013 Roy Stogner <roystgnr@ices.utexas.edu>
2008 Thomas Porschberg <thomas@randspringer.de>
2012 Xiyue Deng <manphiz@gmail.com>
2012 Zack Weinberg <zackw@panix.com>
License: FSFAP
Files: src/backends/addressbook/AddressBookSource.cpp
src/backends/file/FileSyncSource.cpp src/core/EvolutionSyncSource.cpp
src/client-test-app.cpp src/syncevolution.cpp
src/core/EvolutionSyncClient.cpp src/core/EvolutionSmartPtr.h
src/core/EvolutionSyncClient.h src/core/EvolutionSyncSource.h
src/backends/evolution/EvolutionContactSource.h
src/backends/evolution/EvolutionContactSource.cpp
src/backends/evolution/EvolutionCalendarSource.cpp
src/backends/evolution/EvolutionCalendarSource.h
src/backends/evolution/EvolutionMemoSource.cpp
src/backends/sqlite/SQLiteContactSource.cpp src/core/SynthesisEngine.h
src/core/SyncEvolutionCmdline.cpp src/core/TrackingSyncSource.cpp
src/core/SyncEvolutionUtil.cpp src/core/FileConfigNode.cpp
src/core/SyncEvolutionUtil.h src/core/SyncEvolutionConfig.cpp
src/core/TrackingSyncSource.h src/core/SyncEvolutionConfig.h
src/core/SyncML.h src/core/Logging.cpp src/core/LogStdout.h
src/core/Logging.h src/core/LogStdout.cpp src/core/SyncML.cpp
src/core/LogRedirect.cpp
Copyright: © 2009 Intel Corporation
© 2005-2009 Patrick Ohly <patrick.ohly@gmx.de>
License: LGPL2.1 | LGPL3
License: LGPL2.1 | LGPL3
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) version 3.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301 USA
Files: test/{ClientTest.cpp,ClientTest.h}
test/client-test-main.cpp
test/{test.h synccompare.pl}
Copyright: © 2008-2009 Patrick Ohly
© 2009 Intel Corporation
© 2008 Funambol Inc.
License: LGPL2.1 | LGPL3
They were contributed to the Funambol C++ client library under the
"docs/Sync4jContribution.pdf" agreement. They were maintained there by
Patrick and on February 17th 2009 copied back to SyncEvolution,
without any commits by other authors except for the license and
copyright changes applied by Funambol.
On March 25 2009 they were relicensed by Patrick Ohly, executing
the rights granted by the contributor agreement.
-------------------------------------------------------------------
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1 of the License, or (at your option)
version 3.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
more details.
You should have received a copy of the GNU Lesser General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Files: test/Algorith/Diff.pm
Copyright:© 2000-2004 Ned Konz, Tye McQueen.
License: GPL-1+ | Artistic
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl.
File: src/core/SynthesisDBPlugin.cpp
Copyright: © 2009 Intel Corporation
© 2004-2008 by Synthesis AG
License: LGPL2.1 | LGPL3
File: src/backends/evolution/e-cal-check-timezones.c
src/backends/evolution/e-cal-check-timezones.h
Copyright: © 2008 Novell, Inc
© 2009 Patrick Ohly <patrick.ohly@gmx.de>
Files:
src/backends/akonadi/akonadisyncsource.cpp
src/backends/akonadi/akonadisyncsource.h
src/backends/akonadi/contactssyncsource.cpp
src/backends/akonadi/contactssyncsource.h
src/backends/akonadi/eventssyncsource.cpp
src/backends/akonadi/eventssyncsource.h
src/backends/akonadi/notessyncsource.cpp
src/backends/akonadi/notessyncsource.h
src/backends/akonadi/todossyncsource.cpp
src/backends/akonadi/todossyncsource.h
Copyright:
2009 Sascha Peilicke <sasch.pe@gmx.de>
License-Grant:
This application is free software;
you can redistribute it and/or modify it
under the terms of the GNU Library General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
Files:
test/Algorith/Diff.pm
Copyright:
2000-2004 Ned Konz
2000-2004 Tye McQueen
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the same terms as Perl.
License: Artistic or GPL-1+
Comment:
Perl 5 is licensed under either the Artistic license
or the GNU General Public License version 1 or later.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
Files:
src/syncevo/icaltz-util.c
src/syncevo/icaltz-util.h
Copyright:
2007 Novell, Inc.
License-Grant:
This program is free software;
you can redistribute it and/or modify it
under the terms of version 2
of the GNU Lesser General Public License
as published by the Free Software Foundation.
License: LGPL-2
Foile: build/gen-changelog.pl
Copyright: © 2009 Emmanuele Bassi
License: GPL1+|Artistic
This program is free software. It can be distributed and/or modified under
the terms of Perl itself.
Files:
src/gtk-ui/gtkinfobar.c
src/gtk-ui/gtkinfobar.h
Copyright:
2005 Paolo Maggi
License-Grant:
This library is free software;
you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
Files: debian/*
Copyright: © 2009 David Bremner
License: same as upstream, LGPL2.1 or LGPL3
Files:
src/backends/tdepim/TDEPIMSyncSource.cpp
src/backends/tdepim/TDEPIMSyncSource.h
Copyright:
2016 Emanoil Kotsev <emanoil.kotsev@fincom.at>
License-Grant:
This application is free software;
you can redistribute it and/or modify it
under the terms of the GNU Library General Public License
as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
License: LGPL-2+
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/gdbus/test/example.cpp
Copyright: © 2009 Intel Corporation
License: GPL-2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
Files: src/dbus/interfaces/spec-to-docbook.xsl
Copyright: 2007, William Jon McCann
License-Grant:
License: GPL
License: GPL-1+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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+
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
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: src/gdbusxx/test/example.cpp
Copyright: © 2009 Intel Corporation
License: GPL-2
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
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.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
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
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
License: Artistic
Reference: /usr/share/common-licenses/Artistic
On Debian systems, you can find the full license text for the LGPL2.1, LGPL3,
GPL-2, GPL3 and Artistic Licenses at
/usr/share/common-licenses/{LGPL-2.1,LGPL-3,GPL-2,GPL-3,Artistic}
License: Expat~Docbook
Permission is hereby granted, free of charge,
to any person obtaining a copy
of this software and associated documentation files (the "Software"),
to deal in the Software without restriction,
including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
.
The above copyright notice and this permission notice
shall be included in all copies or substantial portions of the Software.
.
Except as contained in this notice,
the names of individuals credited with contribution to this software
shall not be used in advertising or otherwise
to promote the sale, use or other dealings in this Software
without prior written authorization from the individuals in question.
.
Any stylesheet derived from this Software
that is publically distributed
will be identified with a different name
and the version strings in any derived Software will be changed
so that no possibility of confusion
between the derived package and this Software will exist.
License: FSFAP
Copying and distribution of this file,
with or without modification,
are permitted in any medium without royalty
provided the copyright notice and this notice are preserved
This file is offered as-is, without any warranty.
License: GPL-1+
Reference: /usr/share/common-licenses/GPL-1
License: GPL-2+
Reference: /usr/share/common-licenses/GPL-2
License: GPL-3
Reference: /usr/share/common-licenses/GPL-3
License: LGPL-2
Reference: /usr/share/common-licenses/LGPL-2
License: LGPL-2+
Reference: /usr/share/common-licenses/LGPL-2
License: LGPL-2.1
Reference: /usr/share/common-licenses/LGPL-2.1
License: LGPL-3
Reference: /usr/share/common-licenses/LGPL-3

3
debian/copyright-check vendored Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
licensecheck --check '.*' --recursive --copyright --deb-machine --ignore '^(debian/(changelog|copyright(_hints)?))$' --lines 0 -- * > debian/copyright_hints

1188
debian/copyright_hints vendored Normal file

File diff suppressed because it is too large Load Diff

14
debian/gbp.conf vendored Normal file
View File

@ -0,0 +1,14 @@
# clone this source: gbp clone $PKG_GIT_URL
# track upstream source: git remote add upstream-git $UPSTREAM_GIT_URL
# update this source: gbp pull
# update upstream source: git fetch upstream-git --tags
# import upstream release: gbp import-orig --upstream-vcs-tag=$VERSION --uscan
# build package: gbp buildpackage
# publish source release: gbp tag && gbp push
[DEFAULT]
pristine-tar = True
sign-tags = True
filter = */.git*
debian-branch = debian/latest
upstream-branch = upstream/latest

26
debian/not-installed vendored Normal file
View File

@ -0,0 +1,26 @@
# we provide no -dev package
usr/include/*/*.h
usr/lib/*/*.a
usr/lib/*/*.la
usr/lib/*/*.so
usr/lib/*/*/*/*.a
usr/lib/*/*/*/*.la
usr/lib/*/pkgconfig/*.pc
# covered in debian/copyright
usr/share/doc/syncevolution/COPYING
# relates to unsupported KDE options --enable-kwallet --enable-akonadi
usr/lib/*/syncevolution/backends/platformkde.so
usr/lib/*/syncevolution/backends/syncakonadi.so
usr/lib/*/syncevolution/backends/syncactivesync.so
# relates to unsupported KDE-derived Trinity Desktop Environment (TDE)
usr/lib/*/syncevolution/backends/synctdepimabc.so
usr/lib/*/syncevolution/backends/synctdepimcal.so
usr/lib/*/syncevolution/backends/synctdepimnotes.so
usr/lib/*/syncevolution/backends/platformtde.so
# helper scripts for testing
usr/bin/syncevo-phone-config
usr/bin/synclog2html

View File

@ -1,48 +0,0 @@
From aabb99048290c0662629fe88588a80a0544fd8c5 Mon Sep 17 00:00:00 2001
From: Tino Mettler <tino+debian@tikei.de>
Date: Sun, 26 Oct 2014 12:54:31 +0100
Subject: [PATCH] Fix FTBFS on kfreebsd due to missing SOCK_CLOEXEC
Work around missing SOCK_CLOEXEC on kfreebsd by setting FD_CLOEXEC
afterwards.
---
src/gdbusxx/gdbus-cxx-bridge.cpp | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/src/gdbusxx/gdbus-cxx-bridge.cpp b/src/gdbusxx/gdbus-cxx-bridge.cpp
index 238b52f0..4f259576 100644
--- a/src/gdbusxx/gdbus-cxx-bridge.cpp
+++ b/src/gdbusxx/gdbus-cxx-bridge.cpp
@@ -276,6 +276,10 @@ void DBusConnectionPtr::setDisconnect(const Disconnect_t &func)
true);
}
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC 0
+#endif
+
boost::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const NewConnection_t &newConnection, DBusErrorCXX *)
{
// Create two fds connected via a two-way stream. The parent
@@ -286,6 +290,21 @@ boost::shared_ptr<DBusServerCXX> DBusServerCXX::listen(const NewConnection_t &ne
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]);

View File

@ -1,32 +0,0 @@
From 96ff80271fce975c9f73972d2d413da08f7de82e Mon Sep 17 00:00:00 2001
From: Tino Mettler <tino+debian@tikei.de>
Date: Mon, 22 Jan 2018 19:42:29 +0100
Subject: [PATCH] Disable the usage of CA certificates if the user disables
SSLVerifyServer and SSLVerifyHost
---
src/syncevo/SoupTransportAgent.cpp | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/syncevo/SoupTransportAgent.cpp b/src/syncevo/SoupTransportAgent.cpp
index 9dd7f581..ed24a4b4 100644
--- a/src/syncevo/SoupTransportAgent.cpp
+++ b/src/syncevo/SoupTransportAgent.cpp
@@ -130,9 +130,14 @@ void SoupTransportAgent::send(const char *data, size_t len)
// use CA certificates if available and needed,
// otherwise let soup use system default certificates
if (m_verifySSL) {
- if (!m_cacerts.empty()) {
- g_object_set(m_session.get(), SOUP_SESSION_SSL_CA_FILE, m_cacerts.c_str(), NULL);
- }
+ if (!m_cacerts.empty()) {
+ g_object_set(m_session.get(), SOUP_SESSION_SSL_CA_FILE,
+ m_cacerts.c_str(), NULL);
+ }
+ } else {
+ // Checking enabled by default, disable it.
+ g_object_set(m_session.get(), SOUP_SESSION_SSL_STRICT, false,
+ NULL);
}
soup_message_set_request(message.get(), m_contentType.c_str(),

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.

View File

@ -1,3 +1,2 @@
# debian/source/git-patches exported from git by quilt-patches-deb-export-hook
0001-Fix-FTBFS-on-kfreebsd-due-to-missing-SOCK_CLOEXEC.patch
0002-Disable-the-usage-of-CA-certificates-if-the-user-dis.patch
1001_SOCK_CLOEXEC.patch
1002_intltool.patch

40
debian/rules vendored
View File

@ -1,10 +1,7 @@
#!/usr/bin/make -f
# -*- makefile -*-
include /usr/share/dpkg/pkg-info.mk
ORIG=${DEB_SOURCE}_${DEB_VERSION_UPSTREAM}
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_CXXFLAGS_APPEND = -std=c++14
export CONFIG_SHELL=/bin/bash
@ -13,47 +10,30 @@ export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@ --parallel
dh $@
override_dh_auto_install:
make install DESTDIR=$(CURDIR)/debian/tmp
install --mode=0755 --owner=root test/syncevo-http-server.py \
$(CURDIR)/debian/tmp/usr/bin/syncevo-http-server
override_dh_autoreconf:
dh_autoreconf ./autogen.sh
override_dh_auto_configure:
sh autogen.sh
dh_auto_configure -- --with-synthesis-src=none --prefix=/usr \
--sysconfdir=/etc \
--libexecdir=/usr/lib/$(DEB_HOST_MULTIARCH)/syncevolution \
--enable-gui \
--enable-kwallet --enable-akonadi \
--with-rst2man --with-rst2html --enable-dav \
--enable-oauth2
execute_after_dh_auto_install:
cp test/syncevo-http-server.py \
debian/tmp/usr/bin/syncevo-http-server
override_dh_install:
dh_install -X"*.pl"
override_dh_strip:
dh_strip --dbgsym-migration='syncevolution-dbg'
override_dh_auto_clean:
rm -f INSTALL compile po/LINGUAS src/backends/backends.am \
src/synthesis-includes/Makefile.in test-driver
dh_auto_clean
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
get-orig-source:
git archive --format=tar upstream/${DEB_VERSION_UPSTREAM} --prefix=${ORIG}/ | gzip -9 > ../${ORIG}.orig.tar.gz
PATCH_EXPORT_SCRIPT=/usr/share/gitpkg/hooks/quilt-patches-deb-export-hook
export-patches:
[ ! -r debian/patches ] || \
grep "^\#*$(notdir $(PATCH_EXPORT_SCRIPT))" debian/patches/series
rm -rf debian/patches
bash $(PATCH_EXPORT_SCRIPT)

View File

@ -1,2 +0,0 @@
upstream/${UPSTREAM_REF}..patches/${DEB_REF}

17
debian/source/lintian-overrides vendored Normal file
View File

@ -0,0 +1,17 @@
# License is in Reference field (see bug#786450)
missing-license-paragraph-in-dep5-copyright debian/copyright artistic *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-1\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-2\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright gpl-3 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2\+ *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-2\.1 *
missing-license-paragraph-in-dep5-copyright debian/copyright lgpl-3 *
missing-license-text-in-dep5-copyright debian/copyright Artistic *
missing-license-text-in-dep5-copyright debian/copyright GPL-1\+ *
missing-license-text-in-dep5-copyright debian/copyright GPL-2\+ *
missing-license-text-in-dep5-copyright debian/copyright GPL-3 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2\+ *
missing-license-text-in-dep5-copyright debian/copyright LGPL-2\.1 *
missing-license-text-in-dep5-copyright debian/copyright LGPL-3 *

View File

@ -1,23 +1,4 @@
usr/share/locale/ja/LC_MESSAGES/syncevolution.mo
usr/share/locale/ro/LC_MESSAGES/syncevolution.mo
usr/share/locale/fi/LC_MESSAGES/syncevolution.mo
usr/share/locale/sv/LC_MESSAGES/syncevolution.mo
usr/share/locale/ar/LC_MESSAGES/syncevolution.mo
usr/share/locale/pt_BR/LC_MESSAGES/syncevolution.mo
usr/share/locale/gl/LC_MESSAGES/syncevolution.mo
usr/share/locale/hu/LC_MESSAGES/syncevolution.mo
usr/share/locale/ko/LC_MESSAGES/syncevolution.mo
usr/share/locale/zh_TW/LC_MESSAGES/syncevolution.mo
usr/share/locale/de/LC_MESSAGES/syncevolution.mo
usr/share/locale/zh_CN/LC_MESSAGES/syncevolution.mo
usr/share/locale/es/LC_MESSAGES/syncevolution.mo
usr/share/locale/pl/LC_MESSAGES/syncevolution.mo
usr/share/locale/id/LC_MESSAGES/syncevolution.mo
usr/share/locale/da/LC_MESSAGES/syncevolution.mo
usr/share/locale/fr/LC_MESSAGES/syncevolution.mo
usr/share/locale/nl/LC_MESSAGES/syncevolution.mo
usr/share/locale/it/LC_MESSAGES/syncevolution.mo
usr/share/locale/th/LC_MESSAGES/syncevolution.mo
usr/share/locale/ca/LC_MESSAGES/syncevolution.mo
usr/bin/synccompare
usr/bin/syncevo-webdav-lookup
usr/share/locale/*/LC_MESSAGES/syncevolution.mo
usr/share/syncevolution

View File

@ -1 +0,0 @@
test/dbus-server-sync.py

View File

@ -1,5 +1,6 @@
usr/share/dbus-1/services/org.syncevolution.service
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/lib/*/syncevolution/syncevo-dbus-server
usr/lib/*/syncevolution/syncevo-dbus-helper
usr/share/dbus-1/services/org.syncevolution.service

View File

@ -1 +1 @@
usr/bin/syncevo-http-server
usr/bin/syncevo-http-server

View File

@ -1,2 +0,0 @@
usr/lib/*/syncevolution/backends/platformkde.so
usr/lib/*/syncevolution/backends/syncakonadi.so

View File

@ -1,10 +1,12 @@
usr/lib/*/syncevolution/backends/syncfile.so
usr/lib/*/syncevolution/backends/syncdav.so
usr/lib/*/syncevolution/backends/syncxmlrpc.so
usr/lib/*/syncevolution/backends/synckcalextended.so
usr/lib/*/syncevolution/backends/syncqtcontacts.so
usr/lib/*/syncevolution/backends/syncmaemocal.so
usr/lib/*/syncevolution/backends/syncactivesync.so
usr/lib/*/syncevolution/backends/syncsqlite.so
usr/lib/*/syncevolution/backends/providergoa.so
usr/lib/*/syncevolution/backends/provideroauth2.so
usr/lib/*/syncevolution/syncevo-local-sync
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

View File

@ -1,9 +1,3 @@
debian/tmp/usr/share/doc/syncevolution/README.nokia_7210c
debian/tmp/usr/share/doc/syncevolution/README.scheduleworld
debian/tmp/usr/share/doc/syncevolution/README.mobical
debian/tmp/usr/share/doc/syncevolution/README
debian/tmp/usr/share/doc/syncevolution/README.funambol
debian/tmp/usr/share/doc/syncevolution/README.zyb
debian/tmp/usr/share/doc/syncevolution/NEWS
debian/tmp/usr/share/doc/syncevolution/README.google
debian/tmp/usr/share/doc/syncevolution/README.memotoo
debian/tmp/usr/share/doc/syncevolution/README
debian/tmp/usr/share/doc/syncevolution/README.*

View File

@ -1,2 +1,5 @@
debian/tmp/usr/share/doc/syncevolution/accounts
debian/tmp/usr/share/doc/syncevolution/syncevo-http-server-logging.conf
debian/tmp/usr/share/syncevolution/xml/update-samples.pl
debian/tmp/usr/share/doc/syncevolution/accounts
test/syncevo-phone-config.py

View File

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

12
debian/watch vendored
View File

@ -1,4 +1,10 @@
version=3
version=4
# check: uscan --report
# update: gbp import-orig --upstream-vcs-tag=vX.Y.Z --uscan
opts=dversionmangle=s/\+ds\d+$// \
https://downloads.syncevolution.org/syncevolution/sources/syncevolution-(.*).tar.gz
opts=\
filenamemangle=s/.*?(@ANY_VERSION@@ARCHIVE_EXT@)/@PACKAGE@$1/,\
uversionmangle=s/-(?=\d)/./g;s/-?pre/~pre/,\
dversionmangle=auto \
https://gitlab.freedesktop.org/SyncEvolution/syncevolution/-/tags \
.*?@ANY_VERSION@@ARCHIVE_EXT@

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,10 +183,10 @@ 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::unique_ptr<TestingSyncSource> res(create(client, clientID, source, isSourceA));
@ -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

@ -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
@ -75,7 +71,7 @@ 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;
}
@ -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;
}
@ -155,7 +151,7 @@ SyncSource::Databases AkonadiSyncSource::getDatabases()
void AkonadiSyncSource::open()
{
if (!GRunIsMain()) {
GRunInMain(boost::bind(&AkonadiSyncSource::open, this));
GRunInMain([this] () { open(); });
return;
}
@ -223,7 +219,7 @@ 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;
}
@ -232,7 +228,7 @@ void AkonadiSyncSource::listAllItems(SyncSourceRevisions::RevisionMap_t &revisio
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;
}
@ -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;
}
@ -313,7 +309,7 @@ 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;
}

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;
@ -97,7 +97,7 @@ EClientCXX EvolutionSyncSource::openESource(const char *extension,
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 (!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.
@ -153,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");
}
@ -166,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;
@ -211,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());
@ -219,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");
@ -227,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(),
@ -250,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);
}
@ -264,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
@ -294,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;
@ -303,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));
@ -327,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,9 +21,7 @@
#ifdef USE_GNOME_KEYRING
extern "C" {
#include <libsecret/secret.h>
}
#include "GNOMEPlatform.h"
@ -37,12 +35,12 @@ SE_BEGIN_CXX
/**
* GNOME keyring distinguishes between empty and unset
* password keys. This function returns NULL for an
* password keys. This function returns nullptr for an
* empty std::string.
*/
inline const char *passwdStr(const std::string &str)
{
return str.empty() ? NULL : str.c_str();
return str.empty() ? nullptr : str.c_str();
}
static bool UseGNOMEKeyring(const InitStateTri &keyring)
@ -128,7 +126,7 @@ bool GNOMELoadPasswordSlot(const InitStateTri &keyring,
GErrorCXX gerror;
PlainGStr result(secret_password_lookupv_sync(SECRET_SCHEMA_COMPAT_NETWORK,
hash,
NULL,
nullptr,
gerror));
// if find password stored in gnome keyring
@ -203,10 +201,10 @@ bool GNOMESavePasswordSlot(const InitStateTri &keyring,
GErrorCXX gerror;
gboolean result = secret_password_storev_sync(SECRET_SCHEMA_COMPAT_NETWORK,
hash,
NULL,
nullptr,
label.c_str(),
password.c_str(),
NULL,
nullptr,
gerror);
if (result) {
SE_LOG_DEBUG(NULL, "saved password in GNOME keyring using %s", key.toString().c_str());

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

@ -26,12 +26,14 @@
#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;
@ -47,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),
@ -54,12 +63,6 @@ public:
m_clientSecret(clientSecret),
m_refreshToken(refreshToken)
{
#ifdef ENABLE_LIBSOUP
m_agent = SoupTransportAgent::create(static_cast<GMainLoop *>(NULL));
#elif defined(ENABLE_LIBCURL)
boost::shared_ptr<CurlTransportAgent> agent(new CurlTransportAgent());
m_agent = agent;
#endif
}
virtual bool methodIsSupported(AuthMethod method) const { return method == AUTH_METHOD_OAUTH2; }
@ -158,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");
}
@ -207,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,7 +289,6 @@ private:
PbapSession(PbapSyncSource &parent);
PbapSyncSource &m_parent;
boost::weak_ptr<PbapSession> m_self;
std::unique_ptr<GDBusCXX::DBusRemoteObject> m_client;
bool m_frozen;
enum {
@ -333,13 +331,11 @@ private:
Transfers m_transfers;
std::string m_currentTransfer;
std::unique_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;
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,
@ -347,10 +343,9 @@ private:
const std::vector<std::string> &invalidated);
// new obexd API
typedef GDBusCXX::SignalWatch1<GDBusCXX::Path_t> CompleteSignal_t;
typedef GDBusCXX::SignalWatch<GDBusCXX::Path_t> CompleteSignal_t;
std::unique_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;
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);
@ -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.

View File

@ -25,7 +25,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
@ -35,16 +35,16 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifndef ENABLE_PBAP
// 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 PbapSyncSource!
bool maybeMe = false /* sourceType.m_backend == "addressbook" */;
if (isMe || maybeMe) {
return new PbapSyncSource(params);
return std::make_unique<PbapSyncSource>(params);
}
return NULL;
return nullptr;
#endif
}

View File

@ -17,7 +17,7 @@ src_backends_pbap_src = \
src/backends/pbap/PbapSyncSource.cpp
src_backends_pbap_syncpbap_la_SOURCES = $(src_backends_pbap_src)
src_backends_pbap_syncpbap_la_LIBADD = $(PBAP_LIBS) $(PCRECPP_LIBS) $(SYNCEVOLUTION_LIBS) $(DBUS_LIBS) $(gdbus_build_dir)/libgdbussyncevo.la
src_backends_pbap_syncpbap_la_LIBADD = $(PBAP_LIBS) $(SYNCEVOLUTION_LIBS) $(DBUS_LIBS) $(gdbus_build_dir)/libgdbussyncevo.la
src_backends_pbap_syncpbap_la_LDFLAGS = -module -avoid-version $(DBUS_LIBS)
src_backends_pbap_syncpbap_la_CXXFLAGS = $(SYNCEVOLUTION_CXXFLAGS) $(SYNCEVO_WFLAGS) $(DBUS_CFLAGS)
src_backends_pbap_syncpbap_la_CPPFLAGS = $(SYNCEVOLUTION_CFLAGS) -I$(gdbus_dir) -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)

View File

@ -154,7 +154,7 @@ public:
QStringList content;
content << detail.definitionName(); // <detail>
QVariantMap fields = detail.variantValues();
for (QVariantMap::const_iterator entry = fields.begin();
for (auto entry = fields.begin();
entry != fields.end();
++entry) {
const QString &fieldName = entry.key();
@ -198,7 +198,7 @@ public:
#else
StringEscape escape('|', "^");
std::list<std::string> strings;
BOOST_FOREACH(const QString &str, content) {
for (const QString &str: content) {
strings.push_back(escape.escape(string(str.toUtf8().constData())));
}
prop.setValue(QVariant(QString::fromUtf8(boost::join(strings, "^").c_str())));
@ -237,7 +237,7 @@ public:
// detail name available?
if (content.size() > 0) {
const QString &detailName = content[0];
QMap<QString, QContactDetailDefinition>::const_iterator it = m_details.constFind(detailName);
auto it = m_details.constFind(detailName);
// detail still exists?
if (it != m_details.constEnd()) {
const QContactDetailDefinition &definition = *it;
@ -273,9 +273,8 @@ public:
}
// skip fields which are (no longer) valid, have wrong type or wrong value
QMap<QString, QContactDetailFieldDefinition> fields = definition.fields();
QMap<QString, QContactDetailFieldDefinition>::const_iterator it2 =
fields.constFind(fieldName);
auto fields = definition.fields();
auto it2 = fields.constFind(fieldName);
if (it2 != fields.constEnd()) {
if (it2->dataType() == value.type()) {
QVariantList allowed = it2->allowableValues();
@ -376,7 +375,7 @@ public:
QtContactsSource::QtContactsSource(const SyncSourceParams &params) :
TrackingSyncSource(params)
{
m_data = NULL;
m_data = nullptr;
SyncSourceLogging::init(InitList<std::string>("N_FIRST") + "N_MIDDLE" + "N_LAST",
" ",
m_operations);

View File

@ -30,7 +30,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 == "QtContacts";
@ -44,10 +44,10 @@ static SyncSource *createSource(const SyncSourceParams &params)
#ifdef ENABLE_QTCONTACTS
true ? new QtContactsSource(params) :
#endif
isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
}
}
return NULL;
return nullptr;
}
static RegisterSyncSource registerMe("QtContacts",
@ -76,9 +76,9 @@ class QtContactsSourceUnitTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("qtcontacts", "qtcontacts:text/vcard:3.0", true));
source.reset(SyncSource::createTestingSource("qtcontacts", "QtContacts", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("qtcontacts", "qtcontacts:text/vcard:3.0", true);
source = SyncSource::createTestingSource("qtcontacts", "QtContacts", true);
}
void testHandler() {

View File

@ -38,9 +38,8 @@
#include <syncevo/GLibSupport.h>
#include <syncevo/GVariantSupport.h>
#include <pcrecpp.h>
#include <boost/lambda/core.hpp>
#include <regex>
SE_GOBJECT_TYPE(SignonAuthService)
SE_GOBJECT_TYPE(SignonAuthSession)
@ -111,8 +110,8 @@ public:
SE_THROW("Username or password missing");
}
Credentials credentials;
credentials.m_username = g_variant_get_string(usernameVar, NULL);
credentials.m_password = g_variant_get_string(passwordVar, NULL);
credentials.m_username = g_variant_get_string(usernameVar, nullptr);
credentials.m_password = g_variant_get_string(passwordVar, nullptr);
if (credentials.m_password.empty()) {
SE_THROW("Got an empty password");
} else if (m_invalidateCache &&
@ -145,7 +144,7 @@ public:
if (!tokenVar) {
SE_THROW("no AccessToken in OAuth2 response");
}
std::string newToken = g_variant_get_string(tokenVar, NULL);
std::string newToken = g_variant_get_string(tokenVar, nullptr);
if (newToken.empty()) {
SE_THROW("AccessToken did not contain a string value");
} else if (m_invalidateCache && newToken == m_accessToken) {
@ -175,8 +174,8 @@ private:
#define signon_auth_session_process_async_finish signon_auth_session_process_finish
SYNCEVO_GLIB_CALL_SYNC(resultData, gerror, signon_auth_session_process_async,
m_authSession, sessionData, mechanism, NULL);
buffer.reset(resultData ? g_variant_print(resultData, true) : NULL);
m_authSession, sessionData, mechanism, nullptr);
buffer.reset(resultData ? g_variant_print(resultData, true) : nullptr);
SE_LOG_DEBUG(NULL, "authentication result: %s, %s",
buffer.get() ? buffer.get() : "<<null>>",
gerror ? gerror->message : "???");
@ -210,21 +209,22 @@ static void StoreIdentityCB(SignonIdentity *self,
data->m_gerror = error;
}
boost::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &username,
const InitStateString &password)
{
boost::shared_ptr<AuthProvider> provider;
std::shared_ptr<AuthProvider> provider;
// Split username into <account ID> and <service name>.
// Be flexible and allow leading/trailing white space.
// Comma is optional.
static const pcrecpp::RE re("^\\s*(\\d+)\\s*,?\\s*(.*)\\s*$");
AgAccountId accountID;
std::string serviceName;
if (!re.FullMatch(username, &accountID, &serviceName)) {
static const std::regex re(R"del(\s*(\d+)\s*,?\s*(.*)\s*)del");
std::smatch match;
if (!std::regex_match(username, match, re)) {
SE_THROW(StringPrintf("username must have the format " SE_SIGNON_PROVIDER_ID ":<account ID>,<service name>: %s",
username.c_str()));
}
AgAccountId accountID = std::stol(match[1].str());
std::string serviceName = match[2].str();
SE_LOG_DEBUG(NULL, "looking up account ID %d and service '%s'",
accountID,
serviceName.c_str());
@ -243,10 +243,10 @@ boost::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &
}
AgAccountServiceCXX accountService;
if (serviceName.empty()) {
accountService = AgAccountServiceCXX::steal(ag_account_service_new(account, NULL));
accountService = AgAccountServiceCXX::steal(ag_account_service_new(account, nullptr));
} else {
ServiceListCXX services(ag_account_list_enabled_services(account));
BOOST_FOREACH (AgService *service, services) {
for (AgService *service: services) {
const char *name = ag_service_get_name(service);
SE_LOG_DEBUG(NULL, "enabled service: %s", name);
if (serviceName == name) {

View File

@ -49,9 +49,9 @@ else
noinst_LTLIBRARIES += $(src_backends_signon_libs)
endif
src_backends_signon_common_libadd = $(SYNCEVOLUTION_LIBS)
src_backends_signon_common_libadd = $(SYNCEVOLUTION_LIBS) $(PCRECPP_LIBS)
src_backends_signon_common_ldflags = -module -avoid-version
src_backends_signon_common_cxxflags = $(SYNCEVOLUTION_CFLAGS)
src_backends_signon_common_cxxflags = $(SYNCEVOLUTION_CFLAGS) $(PCRECPP_CFLAGS)
src_backends_signon_common_cppflags = -DUSE_SIGNON -I$(top_srcdir)/test $(BACKEND_CPPFLAGS)
src_backends_signon_common_dependencies = src/syncevo/libsyncevolution.la

View File

@ -32,9 +32,6 @@
#include <syncevo/GLibSupport.h>
#include <syncevo/GVariantSupport.h>
#include <pcrecpp.h>
#include <boost/lambda/core.hpp>
SE_GOBJECT_TYPE(SignonAuthService)
SE_GOBJECT_TYPE(SignonAuthSession)
@ -94,8 +91,8 @@ public:
#define signon_auth_session_process_async_finish signon_auth_session_process_finish
SYNCEVO_GLIB_CALL_SYNC(resultDataVar, gerror, signon_auth_session_process_async,
m_authSession, sessionDataVar, m_mechanism.c_str(), NULL);
buffer.reset(resultDataVar ? g_variant_print(resultDataVar, true) : NULL);
m_authSession, sessionDataVar, m_mechanism.c_str(), nullptr);
buffer.reset(resultDataVar ? g_variant_print(resultDataVar, true) : nullptr);
SE_LOG_DEBUG(NULL, "OAuth2 token result: %s, %s",
buffer.get() ? buffer.get() : "<<null>>",
gerror ? gerror->message : "???");
@ -109,7 +106,7 @@ public:
if (!tokenVar) {
SE_THROW("no AccessToken in OAuth2 response");
}
std::string newToken = g_variant_get_string(tokenVar, NULL);
std::string newToken = g_variant_get_string(tokenVar, nullptr);
if (newToken.empty()) {
SE_THROW("AccessToken did not contain a string value");
} else if (m_invalidateCache && newToken == m_accessToken) {
@ -124,15 +121,15 @@ public:
virtual std::string getUsername() const { return ""; }
};
boost::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &username,
std::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &username,
const InitStateString &password)
{
// Expected content of parameter GVariant.
boost::shared_ptr<GVariantType> hashtype(g_variant_type_new("a{sv}"), g_variant_type_free);
std::shared_ptr<GVariantType> hashtype(g_variant_type_new("a{sv}"), g_variant_type_free);
// 'username' is the part after signon: which we can parse directly.
GErrorCXX gerror;
GVariantCXX parametersVar(g_variant_parse(hashtype.get(), username.c_str(), NULL, NULL, gerror),
GVariantCXX parametersVar(g_variant_parse(hashtype.get(), username.c_str(), nullptr, nullptr, gerror),
TRANSFER_REF);
if (!parametersVar) {
gerror.throwError(SE_HERE, "parsing 'signon:' username");
@ -157,14 +154,14 @@ boost::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &
!g_variant_type_equal(G_VARIANT_TYPE_STRING, g_variant_get_type(value))) {
SE_THROW("need 'method: <string>' in 'signon:' parameters");
}
method = g_variant_get_string(value, NULL);
method = g_variant_get_string(value, nullptr);
value = (GVariant *)g_hash_table_lookup(parameters, "mechanism");
if (!value ||
!g_variant_type_equal(G_VARIANT_TYPE_STRING, g_variant_get_type(value))) {
SE_THROW("need 'mechanism: <string>' in 'signon:' parameters");
}
mechanism = g_variant_get_string(value, NULL);
mechanism = g_variant_get_string(value, nullptr);
value = (GVariant *)g_hash_table_lookup(parameters, "session");
if (!value ||
@ -179,7 +176,7 @@ boost::shared_ptr<AuthProvider> createSignonAuthProvider(const InitStateString &
SE_LOG_DEBUG(NULL, "using signond identity %d", signonID);
SignonAuthSessionCXX authSession(signon_identity_create_session(identity, method, gerror), TRANSFER_REF);
boost::shared_ptr<AuthProvider> provider(new SignonAuthProvider(authSession, sessionData, mechanism));
auto provider = std::make_shared<SignonAuthProvider>(authSession, sessionData, mechanism);
return provider;
}

View File

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

View File

@ -64,10 +64,10 @@ public:
#endif
{}
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 = createSignonAuthProvider(username, password);
return provider;
}

View File

@ -117,7 +117,7 @@ void SQLiteContactSource::open()
{ "BlogURL", "ABPerson", "BLOGURL" },
{ "VideoURL", "ABPerson", "VIDEOURL" },
{ NULL }
{ nullptr }
};
static const char *schema =
"BEGIN TRANSACTION;"
@ -159,7 +159,7 @@ void SQLiteContactSource::open()
"FileAs TEXT);"
"COMMIT;";
string id = getDatabaseID();
std::string id = getDatabaseID();
m_sqlite.open(getName(),
id.c_str(),
mapping,
@ -174,7 +174,7 @@ void SQLiteContactSource::close()
void SQLiteContactSource::getSynthesisInfo(SynthesisInfo &info, XMLConfigFragments &fragment)
{
SourceType sourceType = getSourceType();
string type;
std::string type;
if (!sourceType.m_format.empty()) {
type = sourceType.m_format;
}
@ -199,7 +199,7 @@ void SQLiteContactSource::getSynthesisInfo(SynthesisInfo &info, XMLConfigFragmen
" <use datatype='vCard21' mode='rw'/>\n";
}
} else {
throwError(SE_HERE, string("configured MIME type not supported: ") + type);
throwError(SE_HERE, std::string("configured MIME type not supported: ") + type);
}
}
@ -229,26 +229,26 @@ void SQLiteContactSource::listAllItems(RevisionMap_t &revisions)
{
sqliteptr all(m_sqlite.prepareSQL("SELECT ROWID, CreationDate, ModificationDate FROM ABPerson;"));
while (m_sqlite.checkSQL(sqlite3_step(all)) == SQLITE_ROW) {
string uid = m_sqlite.toString(SQLITE3_COLUMN_KEY(all, 0));
string modTime = m_sqlite.time2str(m_sqlite.getTimeColumn(all, 2));
std::string uid = m_sqlite.toString(SQLITE3_COLUMN_KEY(all, 0));
std::string modTime = m_sqlite.time2str(m_sqlite.getTimeColumn(all, 2));
revisions.insert(RevisionMap_t::value_type(uid, modTime));
}
}
sysync::TSyError SQLiteContactSource::readItemAsKey(sysync::cItemID aID, sysync::KeyH aItemKey)
{
string uid = aID->item;
std::string uid = aID->item;
sqliteptr contact(m_sqlite.prepareSQL("SELECT * FROM ABPerson WHERE ROWID = '%s';", uid.c_str()));
if (m_sqlite.checkSQL(sqlite3_step(contact)) != SQLITE_ROW) {
throwError(SE_HERE, STATUS_NOT_FOUND, string("contact not found: ") + uid);
throwError(SE_HERE, STATUS_NOT_FOUND, std::string("contact not found: ") + uid);
}
for (int i = 0; i<LAST_COL; i++) {
SQLiteUtil::Mapping map = m_sqlite.getMapping(i);
string field = map.fieldname;
std::string field = map.fieldname;
if(!field.empty()) {
string value = m_sqlite.getTextColumn(contact, map.colindex);
std::string value = m_sqlite.getTextColumn(contact, map.colindex);
sysync::TSyError res = getSynthesisAPI()->setValue(aItemKey, field, value.c_str(), value.size());
if (res != sysync::LOCERR_OK) {
SE_LOG_WARNING(getDisplayName(), "SQLite backend: set field %s value %s failed", field.c_str(), value.c_str());
@ -260,23 +260,23 @@ sysync::TSyError SQLiteContactSource::readItemAsKey(sysync::cItemID aID, sysync:
sysync::TSyError SQLiteContactSource::insertItemAsKey(sysync::KeyH aItemKey, sysync::cItemID aID, sysync::ItemID newID)
{
string uid = aID ? aID->item :"";
string newuid = uid;
string creationTime;
string first, last;
std::string uid = aID ? aID->item :"";
std::string newuid = uid;
std::string creationTime;
std::string first, last;
stringstream cols;
stringstream values;
std::stringstream cols;
std::stringstream values;
// scan-build: value stored to 'numparams' is never read.
std::list<string> insValues;
std::list<std::string> insValues;
for (int i = 0; i<LAST_COL; i++) {
SQLiteUtil::Mapping map = m_sqlite.getMapping(i);
string field = map.fieldname;
std::string field = map.fieldname;
SharedBuffer data;
if (!field.empty() && !getSynthesisAPI()->getValue (aItemKey, field, data)) {
insValues.push_back (string (data.get()));
insValues.push_back (std::string (data.get()));
cols << m_sqlite.getMapping(i).colname << ", ";
values <<"?, ";
if (field == "N_FIRST") {
@ -288,9 +288,9 @@ sysync::TSyError SQLiteContactSource::insertItemAsKey(sysync::KeyH aItemKey, sys
}
// synthesize sort keys: upper case with specific order of first/last name
string firstsort = first + " " + last;
std::string firstsort = first + " " + last;
boost::to_upper(firstsort);
string lastsort = last + " " + first;
std::string lastsort = last + " " + first;
boost::to_upper(lastsort);
cols << "FirstSort, LastSort";
@ -314,23 +314,23 @@ sysync::TSyError SQLiteContactSource::insertItemAsKey(sysync::KeyH aItemKey, sys
m_sqlite.checkSQL(sqlite3_step(remove));
}
string cols_str = cols.str();
string values_str = values.str();
std::string cols_str = cols.str();
std::string values_str = values.str();
sqliteptr insert(m_sqlite.prepareSQL("INSERT INTO ABPerson( %s ) VALUES( %s );", cols.str().c_str(), values.str().c_str()));
// now bind parameter values in the same order as the columns specification above
int param = 1;
BOOST_FOREACH (string &value, insValues) {
for (std::string &value: insValues) {
m_sqlite.checkSQL(sqlite3_bind_text(insert, param++, value.c_str(), -1, SQLITE_TRANSIENT));
}
if (uid.size()) {
m_sqlite.checkSQL(sqlite3_bind_text(insert, param++, uid.c_str(), -1, SQLITE_TRANSIENT));
m_sqlite.checkSQL(sqlite3_bind_text(insert, param++, creationTime.c_str(), -1, SQLITE_TRANSIENT));
} else {
m_sqlite.checkSQL(sqlite3_bind_int64(insert, param++, (long long)time(NULL)));
m_sqlite.checkSQL(sqlite3_bind_int64(insert, param++, (long long)time(nullptr)));
}
SQLiteUtil::syncml_time_t modificationTime = time(NULL);
SQLiteUtil::syncml_time_t modificationTime = time(nullptr);
m_sqlite.checkSQL(sqlite3_bind_int64(insert, param++, modificationTime));
m_sqlite.checkSQL(sqlite3_step(insert));
@ -346,7 +346,7 @@ sysync::TSyError SQLiteContactSource::insertItemAsKey(sysync::KeyH aItemKey, sys
}
void SQLiteContactSource::deleteItem(const string& uid)
void SQLiteContactSource::deleteItem(const std::string& uid)
{
sqliteptr del;

View File

@ -25,8 +25,6 @@
#include <syncevo/SafeConfigNode.h>
#include <SQLiteUtil.h>
#include <boost/bind.hpp>
#include <syncevo/declarations.h>
SE_BEGIN_CXX
@ -64,17 +62,17 @@ class SQLiteContactSource : public SyncSource,
SQLiteContactSource(const SyncSourceParams &params) :
SyncSource(params),
m_trackingNode(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()))))
{
SyncSourceSession::init(m_operations);
SyncSourceDelete::init(m_operations);
SyncSourceRevisions::init(NULL, NULL, 1, m_operations);
SyncSourceRevisions::init(nullptr, nullptr, 1, m_operations);
SyncSourceChanges::init(m_operations);
m_operations.m_isEmpty = boost::bind(&SQLiteContactSource::isEmpty, this);
m_operations.m_readItemAsKey = boost::bind(&SQLiteContactSource::readItemAsKey, this, _1, _2);
m_operations.m_insertItemAsKey = boost::bind(&SQLiteContactSource::insertItemAsKey, this, _1, (sysync::cItemID)NULL, _2);
m_operations.m_updateItemAsKey = boost::bind(&SQLiteContactSource::insertItemAsKey, this, _1, _2, _3);
m_operations.m_isEmpty = [this] () { return isEmpty(); };
m_operations.m_readItemAsKey = [this] (sysync::cItemID aID, sysync::KeyH aItemKey) { return readItemAsKey(aID, aItemKey); };
m_operations.m_insertItemAsKey = [this] (sysync::KeyH aItemKey, sysync::ItemID newID) { return insertItemAsKey(aItemKey, nullptr, newID); };
m_operations.m_updateItemAsKey = [this] (sysync::KeyH aItemKey, sysync::cItemID aID, sysync::ItemID newID) { return insertItemAsKey(aItemKey, aID, newID); };
SyncSourceLogging::init(InitList<std::string> ("N_FIRST")+"N_MIDDLE"+"N_LAST", ", ", m_operations);
}
@ -103,7 +101,7 @@ class SQLiteContactSource : public SyncSource,
virtual void listAllItems(RevisionMap_t &revisions);
private:
/** encapsulates access to database */
boost::shared_ptr<ConfigNode> m_trackingNode;
std::shared_ptr<ConfigNode> m_trackingNode;
SQLiteUtil m_sqlite;
/** implements the m_isEmpty operation */

View File

@ -28,24 +28,24 @@
#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 == "SQLite Address Book";
#ifndef ENABLE_SQLITE
return isMe ? RegisterSyncSource::InactiveSource(params) : NULL;
return isMe ? RegisterSyncSource::InactiveSource(params) : nullptr;
#else
bool maybeMe = sourceType.m_backend == "addressbook";
if (isMe || maybeMe) {
if (sourceType.m_format == "" || sourceType.m_format == "text/x-vcard") {
return new SQLiteContactSource(params);
return std::make_unique<SQLiteContactSource>(params);
} else {
return NULL;
return nullptr;
}
}
return NULL;
return nullptr;
#endif
}
@ -71,11 +71,11 @@ class EvolutionSQLiteContactsTest : public CppUnit::TestFixture {
protected:
void testInstantiate() {
boost::shared_ptr<SyncSource> source;
source.reset(SyncSource::createTestingSource("contacts", "contacts", true));
source.reset(SyncSource::createTestingSource("contacts", "addressbook", true));
source.reset(SyncSource::createTestingSource("contacts", "sqlite-contacts", true));
source.reset(SyncSource::createTestingSource("contacts", "SQLite Address Book:text/x-vcard", true));
std::unique_ptr<SyncSource> source;
source = SyncSource::createTestingSource("contacts", "contacts", true);
source = SyncSource::createTestingSource("contacts", "addressbook", true);
source = SyncSource::createTestingSource("contacts", "sqlite-contacts", true);
source = SyncSource::createTestingSource("contacts", "SQLite Address Book:text/x-vcard", true);
}
};

View File

@ -33,9 +33,9 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
void SQLiteUtil::throwError(const SourceLocation &here, const string &operation)
void SQLiteUtil::throwError(const SourceLocation &here, const std::string &operation)
{
string descr = m_name + ": '" + m_fileid + "': " + operation + " failed";
std::string descr = m_name + ": '" + m_fileid + "': " + operation + " failed";
if (m_db) {
const char *error = sqlite3_errmsg(m_db);
@ -48,7 +48,7 @@ void SQLiteUtil::throwError(const SourceLocation &here, const string &operation)
sqlite3_stmt *SQLiteUtil::prepareSQLWrapper(const char *sql, const char **nextsql)
{
sqlite3_stmt *stmt = NULL;
sqlite3_stmt *stmt = nullptr;
checkSQL(sqlite3_prepare(m_db, sql, -1, &stmt, nextsql), sql);
return stmt;
@ -59,7 +59,7 @@ sqlite3_stmt *SQLiteUtil::prepareSQL(const char *sqlfmt, ...)
va_list ap;
va_start(ap, sqlfmt);
string s = StringPrintfV (sqlfmt, ap);
std::string s = StringPrintfV (sqlfmt, ap);
va_end(ap);
return prepareSQLWrapper(s.c_str());
}
@ -77,7 +77,7 @@ SQLiteUtil::key_t SQLiteUtil::findKey(const char *database, const char *keyname,
}
}
string SQLiteUtil::findColumn(const char *database, const char *keyname, const char *key, const char *column, const char *def)
std::string SQLiteUtil::findColumn(const char *database, const char *keyname, const char *key, const char *column, const char *def)
{
sqliteptr query(prepareSQL("SELECT %s FROM %s WHERE %s = '%s';", column, database, keyname, key));
@ -91,7 +91,7 @@ string SQLiteUtil::findColumn(const char *database, const char *keyname, const c
}
}
string SQLiteUtil::getTextColumn(sqlite3_stmt *stmt, int col, const char *def)
std::string SQLiteUtil::getTextColumn(sqlite3_stmt *stmt, int col, const char *def)
{
const unsigned char *text = sqlite3_column_text(stmt, col);
return text ? (const char *)text : def;
@ -103,15 +103,15 @@ SQLiteUtil::syncml_time_t SQLiteUtil::getTimeColumn(sqlite3_stmt *stmt, int col)
return sqlite3_column_int64(stmt, col);
}
string SQLiteUtil::time2str(SQLiteUtil::syncml_time_t t)
std::string SQLiteUtil::time2str(SQLiteUtil::syncml_time_t t)
{
char buffer[128];
sprintf(buffer, "%lu", t);
return buffer;
}
void SQLiteUtil::open(const string &name,
const string &fileid,
void SQLiteUtil::open(const std::string &name,
const std::string &fileid,
const SQLiteUtil::Mapping *mapping,
const char *schema)
{
@ -119,12 +119,12 @@ void SQLiteUtil::open(const string &name,
m_name = name;
m_fileid = fileid;
const string prefix("file://");
const std::string prefix("file://");
bool create = fileid.substr(0, prefix.size()) == prefix;
string filename = create ? fileid.substr(prefix.size()) : fileid;
std::string filename = create ? fileid.substr(prefix.size()) : fileid;
if (!create && access(filename.c_str(), F_OK)) {
throw runtime_error(m_name + ": no such database: '" + filename + "'");
throw std::runtime_error(m_name + ": no such database: '" + filename + "'");
}
sqlite3 *db;
@ -167,7 +167,7 @@ void SQLiteUtil::open(const string &name,
for (i = 0; mapping[i].colname; i++) ;
m_mapping.set(new Mapping[i + 1]);
sqliteptr query;
string tablename;
std::string tablename;
for (i = 0; mapping[i].colname; i++) {
m_mapping[i] = mapping[i];
@ -192,7 +192,7 @@ void SQLiteUtil::open(const string &name,
void SQLiteUtil::close()
{
m_db = NULL;
m_db = nullptr;
}

View File

@ -31,7 +31,6 @@
#include <syncevo/declarations.h>
SE_BEGIN_CXX
using namespace std;
class SQLiteUnref {
public:
@ -65,11 +64,11 @@ class SQLiteUtil
* @param name a name for the data source, used for error messages
* @param fileid a descriptor which identifies the file to be opened:
* currently valid syntax is file:// followed by path
* @param mapping array with database mapping, terminated by NULL colname
* @param schema database schema to use when creating new databases, may be NULL
* @param mapping array with database mapping, terminated by nullptr colname
* @param schema database schema to use when creating new databases, may be nullptr
*/
void open(const string &name,
const string &fileid,
void open(const std::string &name,
const std::string &fileid,
const Mapping *mapping,
const char *schema);
@ -79,7 +78,7 @@ class SQLiteUtil
* throw error for a specific sqlite3 operation on m_db
* @param operation a description of the operation which failed
*/
void throwError(const SourceLocation &where, const string &operation);
void throwError(const SourceLocation &where, const std::string &operation);
/**
* wrapper around sqlite3_prepare() which operates on the current
@ -96,7 +95,7 @@ class SQLiteUtil
* @param sql preformatted SQL statement(s)
* @param nextsql pointer to next statement in sql
*/
sqlite3_stmt *prepareSQLWrapper(const char *sql, const char **nextsql = NULL);
sqlite3_stmt *prepareSQLWrapper(const char *sql, const char **nextsql = nullptr);
/** checks the result of an sqlite3 call, throws an error if faulty, otherwise returns the result */
@ -109,30 +108,30 @@ class SQLiteUtil
/** type used for row keys */
typedef long long key_t;
string toString(key_t key) { char buffer[32]; sprintf(buffer, "%lld", key); return buffer; }
std::string toString(key_t key) { char buffer[32]; sprintf(buffer, "%lld", key); return buffer; }
#define SQLITE3_COLUMN_KEY sqlite3_column_int64
/** return row ID for a certain row */
key_t findKey(const char *database, const char *keyname, const char *key);
/** return a specific column for a row identified by a certain key column as text, returns default text if not found */
string findColumn(const char *database, const char *keyname, const char *key, const char *column, const char *def);
std::string findColumn(const char *database, const char *keyname, const char *key, const char *column, const char *def);
/** a wrapper for sqlite3_column_test() which will check for NULL and returns default text instead */
string getTextColumn(sqlite3_stmt *stmt, int col, const char *def = "");
/** a wrapper for sqlite3_column_test() which will check for nullptr and returns default text instead */
std::string getTextColumn(sqlite3_stmt *stmt, int col, const char *def = "");
typedef unsigned long syncml_time_t;
/** transform column to same time base as used by SyncML libary (typically time()) */
syncml_time_t getTimeColumn(sqlite3_stmt *stmt, int col);
/** convert time to string */
static string time2str(syncml_time_t t);
static std::string time2str(syncml_time_t t);
private:
/* copy of open() parameters */
arrayptr<Mapping> m_mapping;
string m_name;
string m_fileid;
std::string m_name;
std::string m_fileid;
/** current database */
eptr<sqlite3, sqlite3, SQLiteUnref> m_db;

View File

@ -1,69 +0,0 @@
<!DOCTYPE DCOP-IDL><DCOP-IDL>
<SOURCE>/opt/software_x64/KDE/TDE/tdepim/knotes/KNotesIface.h</SOURCE>
<INCLUDE>tqstring.h</INCLUDE>
<INCLUDE>tqdatetime.h</INCLUDE>
<INCLUDE>tqmap.h</INCLUDE>
<INCLUDE>dcopobject.h</INCLUDE>
<CLASS>
<NAME>KNotesIface</NAME>
<SUPER>DCOPObject</SUPER>
<FUNC>
<TYPE>TQString</TYPE>
<NAME>newNote</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>name</NAME></ARG>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>text</NAME></ARG>
</FUNC>
<FUNC>
<TYPE>TQString</TYPE>
<NAME>newNoteFromClipboard</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>name</NAME></ARG>
</FUNC>
<FUNC>
<TYPE>ASYNC</TYPE>
<NAME>killNote</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
</FUNC>
<FUNC>
<TYPE>ASYNC</TYPE>
<NAME>killNote</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
<ARG><TYPE>bool</TYPE><NAME>force</NAME></ARG>
</FUNC>
<FUNC qual="const">
<TYPE>TQMap&lt;TQString,TQString&gt;</TYPE>
<NAME>notes</NAME>
</FUNC>
<FUNC>
<TYPE>ASYNC</TYPE>
<NAME>setName</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>newName</NAME></ARG>
</FUNC>
<FUNC>
<TYPE>ASYNC</TYPE>
<NAME>setText</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>newText</NAME></ARG>
</FUNC>
<FUNC qual="const">
<TYPE>TQString</TYPE>
<NAME>name</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
</FUNC>
<FUNC qual="const">
<TYPE>TQString</TYPE>
<NAME>text</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
</FUNC>
<FUNC qual="const">
<TYPE>int</TYPE>
<NAME>getRevision</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
</FUNC>
<FUNC qual="const">
<TYPE>TQDateTime</TYPE>
<NAME>getLastModified</NAME>
<ARG><TYPE qleft="const" qright="&amp;">TQString</TYPE><NAME>noteId</NAME></ARG>
</FUNC>
</CLASS>
</DCOP-IDL>

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