summaryrefslogtreecommitdiff
path: root/src/backends/evolution/EvolutionSyncSource.cpp
Commit message (Collapse)AuthorAge
* glib: stricter ref countingPatrick Ohly2013-05-16
| | | | | | | | | | | | | | | | Following the boost::instrusive_ptr example and making "add_ref = true" the default in our CXX GLib and GObject wrappers led to some memory leaks because it didn't enforce thinking about whether the plain pointer is already owned by us or not. It is better to use a mandatory enum value, ADD_REF and TRANSFER_REF, and force explicit construction. Doing that revealed that the assignment operator was implemented as constructing a CXX instance with increased ref count and/or that in some places, a real leak was caused by increasing the ref count unnecessarily. Running under valgrind gave a false sense of security. Some of the real leaks only showed up randomly in tests.
* Logging: eliminate _instance from SE_LOG* macrosPatrick Ohly2013-05-06
| | | | | With the _instance parameter always being NULL thanks to the previous patch, it can be removed completely.
* Logging: remove usage of Logger instancePatrick Ohly2013-05-06
| | | | | | | | | | | | | | | | Passing an explicit Logger instance to the SE_LOG* macros was hardly ever used and only made the macros more complex. The only usage of it was in some backends, which then added a prefix string automatically. The same effect can be achieved by passing getDisplayName(). Exception handling no longer needs a Logger instance, the prefix alone is enough. The other intended usage, avoiding global variables for logging by passing a logger known to the caller, was not possible at all. To make prefix handling more flexible, it is now passed as a "const std::string *" instead of a "const char *".
* EDS Client: handle "busy" errorPatrick Ohly2013-05-06
| | | | | | | | In EDS 3.6.4, opening fails a lot more often with E_CLIENT_ERROR_BUSY. We must retry until we succeed. Seen in particular with testpim.py testFilterStartup. Clients are expected to try the open call again. EDS >= 3.8 does that automatically.
* EDS + PIM: create phone number summary in contacts DB (part of FDO #59571)Patrick Ohly2013-03-04
| | | | | | | | | | | | | | | | | | | | | | | | | | | A quick-and-dirty solution for enabling phone number summaries when creating contact databases in the PIM Manager: let the EDS backend recognize the special UIDs used by the PIM Manager and then hard-code the minimal set of summary fields and indexed fields which allow executing the E_CONTACT_TEL, E_BOOK_QUERY_EQUALS_NATIONAL_PHONE_NUMBER query quickly. A proper solution would use a new EDS function for parsing ESource defaults from a string and then providing these defaults to the backend from the PIM Manager. Also note that configuring the EDS system address book must be covered elsewhere, because it wouldn't be correct for SyncEvolution as only one of many clients to change the configuration of that. To enable the special support, add the following section to share/evolution-data-server-3.6/rw-sources/system-address-book.source: [Backend Summary Setup] SummaryFields=phone IndexedFields=phone,phone This patch adds new function calls to code shared by syncecal and syncebook, so we have to add libebook-contacts to both to avoid link errors.
* EDS: share ESourceRegistry via libsyncevolutionPatrick Ohly2012-12-07
| | | | | Switch to the new EDSRegistryLoader from libsyncevolution. This will allow sharing the ESourceRegistry with the PIM Manager.
* EDS: fix creating databasesPatrick Ohly2012-12-03
| | | | | | | --create-database was broken in combination with the final code in EDS 3.6 because it passed NULL for the UID to e_source_new_with_uid(), which is considered an error by the implementation of that method. Must use e_source_new() if we don't have a UID.
* EDS Client: implement creating and deleting databasesPatrick Ohly2012-10-25
| | | | | | | | | | | | | | | | | Depends on the EDS 3.6 ESourceRegistry API. Needs the very latest EDS with the following commit. There's no configure check yet because EDS 3.6 is not released yet. commit 6df76009318eac9dbe3dd49165394d389102764e Author: Matthew Barnes <mbarnes@redhat.com> Date: Tue Sep 11 22:56:08 2012 -0400 Bug 683785 - Add e_source_new_with_uid() Variation of e_source_new() which allows a predetermined UID to be specified for a scratch source. This changes the "uid" property from read-only to read/write + construct-only, and eliminates the need for EServerSideSource to override the property.
* EDS Client: work around glib + e_source_registry_new_sync() deadlockPatrick Ohly2012-10-25
| | | | | | | | | | | | | | | | | The synchronous version used to deadlock frequently, the asynchronous one doesn't, so use that instead. The problem was also worked around later in EDS (commit below), but let's stick to the asynchronous version anyway to be closer to Evolution. commit 6c4c1c6a1f40a6873be954a0b9d770e31726bd50 Author: Matthew Barnes <mbarnes@redhat.com> Date: Fri Sep 7 07:40:09 2012 -0400 ESourceRegistry: Work around GType deadlock. Work around http://bugzilla.gnome.org/show_bug.cgi?id=683519 until GObject's type initialization deadlock issue is fixed. Apparently only the synchronous instantiation is affected.
* EDS: added support for EDS 3.5.xPatrick Ohly2012-07-24
| | | | | | | | | | | | | | | | | | | | | | | | | | | When compiled against EDS 3.5.x or later, SyncEvolution now uses the backend code originally written for the EClient API introduced in EDS 3.2. That code was changed so that it works with the new include file rules and ESourceRegistry in EDS 3.5.x. Support for using the EClient API with EDS 3.4 was removed because maintaining three different flavors of the EDS backend code would be too much work and not gain much (just the possibility to test the EDSClient code with 3.4). At the moment, this is a compile time choice made automatically by configure. syncevolution.org binaries are compiled against an older EDS and thus do not work with EDS 3.5.x or later. EDS 3.5.x handles authentication itself, using a standard system prompt if necessary. SyncEvolution can no longer provide the password, and thus the "databaseUser/Password" options have no effect when using EDS 3.5.x. The patch leaves code for older EDS almost completely unchanged and therefore is considered safe for the stable release series leading to 1.3. Using EClient is an all-or-nothing choice now, because the common EvolutionSyncSource needs to be compiled differently. Thanks to the reorganized API, a lot more common code for ECal and EBook sources could be moved into EvolutionSyncSource.
* Evolution: optionally use EDS 3.4 "Client" APIPatrick Ohly2012-05-25
| | | | | | | | | | | | | | | | | Merged branch 'eds-api'. Several changes that were made in the meantime on the master branch caused conflicts and/or required updating the new code to avoid regressions. The code was also updated to address some issues: - g_propagate_error() steals ownership from GErrorCXX, thus causing a double free. Replaced with consistent use of GErrorCXX. - Putting opening brackets into the middle of ifdefs breaks automatic code formatting. Now the code has "if(" and ") {" outside of the ifdef/else/endif block. The old code was updated to also use GErrorCXX. This revealed a memory leak in the error path for opening databases, where the GError was not cleared before returning.
* syncevo: Renamed GString typedef in SmartPtr.h to GStringPtr.Chris Kühl2011-08-26
| | | | | | I was getting type ambiguity errors when cleaning up the header files. The ambiguity was with the glib GString. This may be able to be reverted once the namespace pollution is dealt with.
* Evolution Address Book: avoid picking CouchDB by default, again (MB #7877)Patrick Ohly2010-02-22
| | | | | | | | | | | | | The first attempt at solving this problem was incomplete. In addition to reordering the databases so that CouchDB databases are listed last (previous patch), we also must change the code so that the first database *after* reordering is marked as default *and* that actual syncs use that database. Therefore this patch changes EvolutionContactSource::getDatabases() so that the setting of m_isDefault is done at the end and EvolutionSyncSource::findSource() so that it looks at that result when no DB is selected explicitly.
* files and classes renamed, include statements cleaned upPatrick Ohly2009-10-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The intention is to get rid of the historic and inconsistent naming of some classes and their corresponding files: * EvolutionSyncClient = class derived from Funambol's SyncClient, * SyncEvolutionConfig = SyncEvolution's config With the strict 'namespace SyncEvo' and the syncevo/ path prefix for most header files it is no longer necessary to have "SyncEvolution" or "Evolution" in the names. This patch thus renames as follows: EvolutionSyncClient => SyncContext EvolutionSmartPtr => SmartPtr SyncEvolutionCmdline => Cmdline SyncEvolutionConfig => SyncConfig SyncEvolutionUtil => util The former EvolutionSyncClient always had a role that went beyond just running a sync, for example it also provided config access. With the upcoming server support it also won't be just a client. Thus the new name "SyncContext". The 'syncevo/' prefix is used throughout the code now. removed whenever the prefix made it clear that the file belongs to SyncEvolution. This helps finding incorrect include paths. Quotes should be used exclusively for SyncEvolution files which don't have a specific prefix yet (test.h, config.h) to help identifying them.
* introduced "namespace SyncEvo" consistentlyPatrick Ohly2009-10-02
| | | | | | | | | | | | | | | Added syncevo/declarations.h, which has This is now used for all SyncEvolution source files, except for the GTK UI, which is written in plain C. In the library it helps to avoid name clashes. The reason for using defines instead of spelling out "namespace SyncEvo" is twofold: 1. if that should ever become necessary, it is easier to rename the namespace via configure options by changing the define 2. editors don't indent the whole file content
* redesigned SyncSource base class + APIPatrick Ohly2009-08-26
The main motivation for this change is that it allows the implementor of a backend to choose the implementations for the different aspects of a datasource (change tracking, item import/export, logging, ...) independently of each other. For example, change tracking via revision strings can now be combined with exchanging data with the Synthesis engine via a single string (the traditional method in SyncEvolution) and with direct access to the Synthesis field list (now possible for the first time). The new backend API is based on the concept of providing implementations for certain functionality via function objects instead of implementing certain virtual methods. The advantage is that implementors can define their own, custom interfaces and mix and match implementations of the different groups of functionality. Logging (see SyncSourceLogging in a later commit) can be done by wrapping some arbitrary other item import/export function objects (decorator design pattern). The class hierarchy is now this: - SyncSourceBase: interface for common utility code, all other classes are derived from it and thus can use that code - SyncSource: base class which implements SyncSourceBase and hooks a datasource into the SyncEvolution core; its "struct Operations" holds the function objects which can be implemented in different ways - TestingSyncSource: combines some of the following classes into an interface that is expected by the client-test program; backends only have to derive from (and implement this) if they want to use the automated testing - TrackingSyncSource: provides the same functionality as before (change tracking via revision strings, item import/export as string) in a single interface; the description of the pure virtual methods are duplicated so that developers can go through this class and find everything they need to know to implement it The following classes contain the code that was previously found in the EvolutionSyncSource base class. Implementors can derive from them and call the init() methods to inherit and activate the functionality: - SyncSourceSession: binds Synthesis session callbacks to virtual methods beginSync(), endSync() - SyncSourceChanges: implements Synthesis item tracking callbacks with set of LUIDs that the user of the class has to fill - SyncSourceDelete: binds Synthesis delete callback to virtual method - SyncSourceRaw: read and write items in the backends format, used for testing and backup/restore - SyncSourceSerialize: exchanges items with Synthesis engine using a string representation of the data; this is how EvolutionSyncSource has traditionally worked, so much of the same virtual methods are now in this class - SyncSourceRevisions: utility class which does change tracking via some kind of "revision" string which changes each time an item is modified; this code was previously in the TrackingSyncSource