summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-10-17autotools: bumped minor versionbmc22881Patrick Ohly1-1/+1
Bumped because of the new <plugin_earlystartdataread> + 508 feature.
2011-10-17engine: fixed handling of 508Patrick Ohly1-0/+1
After detecting the special 508 "request slow sync" error, the LOCERR_OK must be returned to the higher levels in the stack, otherwise syncing aborts.
2011-10-17engine: added <plugin_earlystartdataread> to allow StartDataRead to occur ↵Lukas Zeller4-15/+72
early and possibly force a slow sync by returning 508 error code The new <plugin_earlystartdataread> flag causes StartDataRead to occur immediately after the admin data has been loaded. This causes the followin change in semantics for StartDataRead() database plugin API call: - the call can return the special 508 status code to signal the engine that a slow sync must be forced for internal database reasons (such as having lost ability to track changes). - the ContextSupport("ReadNextItem:allfields") call that was issued (if all fields were requested at all) BEFORE StartDataRead() in the default case will be issued before first call to ReadNextItem(), but AFTER StartDataRead().
2011-10-17white space cleanupPatrick Ohly1-4/+4
Necessary for the next patch from Lukas to apply cleanly.
2011-10-13autotools: must include m4-repo in ACLOCAL_AMFLAGSlibsynthesis_3.4.0.16+syncevolution-1-2Patrick Ohly1-1/+2
Without it, "./config.status --recheck" will not find dk-warn.m4, leading to: syntax error near unexpected token `SYNTHESIS_WFLAGS,' `DK_ARG_ENABLE_WARNINGS(SYNTHESIS_WFLAGS,'
2011-10-13autotools: version bump for SyncEvolution 1.2Patrick Ohly2-4/+4
Bumped to 3.4.0.16.4 because of the DB_Conflict bug fix. Also increased libtool versions to reflect added features.
2011-10-12autotools: same suppressions for all warning levelsPatrick Ohly1-1/+1
Warnings that are ignored at the "fatal" level shouldn't be shown at the minimum level because that becomes confusing.
2011-10-11DB_Conflict (409): fixed uninitialized memory accessPatrick Ohly1-0/+1
aChangedNewVersion in TCustomImplDS::mergeWithDatabaseVersion() was only initialized if it had to be set to true while doing the merge. It had to be set to false somewhere up the stack.
2011-10-10autotools: bumped version to 3.4.0.16.3Patrick Ohly1-1/+1
Added "newest wins" for add<->add conflict.
2011-09-30DB_Conflict (409): avoid sending unnecessary changes back to clientbmc22783Patrick Ohly2-11/+15
In server mode, when the merging after a 409 from the DB determines that the client already has the latest data, sending it a Replace command can be avoided. This patch achieves that by introducing a new boolean remoteHasLatestData which is false by default and only set when it is certain that sending the update can be avoided. To minimize changes, the DB_DataReplaced code path is left unchanged. It could be changed to set the same boolean. Not sure whether that will also avoid unnecessary changes sent when a client detects a conflict.
2011-09-30DB_Conflict (409): correctly count updated and unmodified itemsPatrick Ohly1-1/+12
TLocalEngineDS::engProcessRemoteItemAsServer() in localengineds.cpp counts Add commands as "added items", even if later on a 409 DB result causes the item to be updated or be left unmodified. Instead changing the whole statistics logic, this patch merely fixes the statistics locally in the 409 handling code.
2011-09-30DB_Conflict (409): do age comparison before merging, avoid unneeded changesPatrick Ohly2-14/+53
Instead of always assuming that the incoming item is meant to win, look at the age of the two items first. Also tell the code which updates the DB item whether it was changed at all and skip the DB write if it is not needed. Note that statistics are still wrong: a server add is counted as "item added" in all cases, even if it is turned into an update or becomes a nop.
2011-09-30DB_Conflict (409): avoid confusing log messagePatrick Ohly1-1/+1
When the 409 handling call falls back to the older merge handling code, that code ends up logging 207 as the status. Replaced with a full list of possible reasons why the code might have been invoked.
2011-09-30COMPAREFIELDS(): fix -1 casePatrick Ohly1-1/+1
The compare result was only 1 or 0, never -1, because of a teriary operator which mapped all non-null values to 1. Cut-and-paste error? The fix passes the underlying value through unchanged. Perhaps this will return values like -999 to the caller, in contradiction to the definition of the macro. However, it is unclear what should be returned in that case.
2011-09-15DB_DataMerged (207): avoid double freelibsynthesis_3.4.0.16+syncevolution-1-1-99-7Patrick Ohly1-1/+1
When a merged item is added to the items which need to be sent with SendDBVersionOfItemAsServer(), the same item must not be freed again immediately because the send queue holds another pointer to it.
2011-09-15autotools: bumped version to 3.4.0.16.2Patrick Ohly1-1/+1
New feature added: DB_DataChanged/Replaced/Conflict support.
2011-09-15plugin API: support new DB_DataReplaced/Merged/Conflict status codesPatrick Ohly1-12/+16
For these codes the local ID must be passed through to the caller. For DB_Conflict no real changes were made in the plugin, so after write scripts and blog writing are not invoked.
2011-09-15plugin API: treat DB_DataMerged as successPatrick Ohly1-1/+2
Plugins are now allowed to return LOCERR_OK and DB_DataMerged. The latter must be treated like success at the API level. Special treatment then happens in the caller.
2011-09-15dataconversion.cpp: added dummy getConflictingItemByLocalID() to resolve ↵Patrick Ohly1-0/+1
compile problem After the recent change ("server engine: better support for backend doing its own duplicate merging (status 207 from API)"), dataconversion.cpp no longer compiled because the dummy engine didn't implement the new pure virtual getConflictingItemByLocalID().
2011-09-15engine: added more merge options for DB implementations to ask engine for.Lukas Zeller7-27/+128
Up to now, only DB_DataMerged (207) had a special meaning when returned by the DB backend for a server add. Now the following options exist for server add operations: - DB backend returns DB_DataMerged (207): This means that the backend has augmented the item with additional data, either from an external source, or by merging with another item in the sync set. The backend must return the localID for the augmented item. In case the augmented item was created by combining with a existing item already in the sync set, the localID of that existing item must be returned (and not a new ID!) The client will be updated with the augmented version. Additionally, if the new version was created by merge with an existing item in the sync set, a delete is sent to the client to remove the old (pre-merge) version of the item from the client. - DB backend returns DB_DataReplaced (208): This means that the backend has stored the item, but doing so, an existing item from the sync set was replaced. The backend must return the localID for the replaced item which must also become the localID of the newly stored version. The client item will not be updated (as the item was stored as received), but otherwise the processing is the same as described for DB_DataMerged (207) above. Additionally, for both server and client, add and replace, the following new option exists: - DB backend returns DB_Conflict (409) This means that the backend did NOT store the item, but has detected a need to merge the current version stored in the backend with the new version. The engine will read the current version, merge it with the incoming version, and issue an updateItem operation on the backend with the merge result. In server add case, after the merge the same processing occurs as for DB_DataMerged (see above).
2011-09-15server engine: better support for backend doing its own duplicate merging ↵Lukas Zeller6-9/+80
(status 207 from API) So far, the DB backend could return DB_DataMerged (=207) for an add to signal that the added data was merged with some pre-existing data and thus the client should be updated with the merge result. This was intended for merge with external data (augmenting entries with lookups from other sources), but not yet for duplicate elimination. This patch adds support for propagating merges that eliminate duplicates in addition to merges that just add external data. When a client sends a new item (new = client side ID not yet known server side), and the DB backend returns status 207 for AddItem, the following happens: - current maps are searched for an item with the same localID as what the DB backend just returned as the "new" localID. If such an item is found, this means the add was completed by merging with an existing item. - If so, this means that for this single localID, there are now two versions with different remoteIDs on the client. The item with the remoteID found in the map must be deleted, so a delete command is added to the list of changes to be sent to the client. - It might also be that the item merged was just added to the server (and not yet known to the client), or had another change predating the merge. If so, the list of changes to be sent to the client will contain an add or a replace, resp. that must NOT propagate to the client, so it is removed from the list now. - Finally, the result of the merge is fetched from the database and propagated to the client as a replace command.
2011-09-13autotools: fixed --enable-warning integrationPatrick Ohly2-2/+3
Switching between distros only works when wiping out the wrong m4 macros. Use the same approach as in SyncEvolution: temporary macros in m4, permanent ones under git control in m4-repo.
2011-09-02autotools: added --enable-warningsPatrick Ohly4-3/+124
Use --enable-warnings=fatal to compile with warnings enabled which the code needs to pass and these warnings turned into errors. Easier than having to remember and set the right CFLAGS/CXXFLAGS.
2011-08-24engine: MIME-DIR, fixed de-escaping in only-de-escape-linefeeds modeLukas Zeller1-1/+1
The way the code was before, a sequence like "foo\,bar" would have been converted into "foo,,bar", i.e. duplicated the escaped char instead of retaining the escape.
2011-08-22TEngineModuleBase::GetStrValue: use more efficient std::string::assign()Patrick Ohly1-1/+1
Copying the "char *" into std::string is more efficient with std::string::assign() than with the assignment operator because the already known string length can be reused. As a side effect it also avoids a valgrind warning about reading one byte past the end of the allocated string buffer inside char_traits.h line 261. Probably was cause by an optimized strlen() variant inside std::string.
2011-08-17bumped version to 3.4.0.16.1 and .so revision by onelibsynthesis_3.4.0.16+syncevolution-1-1-99-6Patrick Ohly2-2/+4
The first four digits are from the upstream tag. The last digit needs to be incremented each time relevant changes are released as part of the Linux libsynthesis release in SyncEvolution. This is relevant primarily for the PKG_CONFIG_CHECK(), which now can check that the libsynthesis that is installed is recent enough.
2011-08-09Add dl libraries to libsynthesis_la_LIBADD to make the sources compile on ↵Rohan Garg1-1/+1
Ubuntu Oneiric
2011-07-25"blob" fields: Added separate CONVMODE_BLOB_AUTO conversion mode for fields ↵bmc19661Lukas Zeller2-10/+23
that should be rendered as B64 only in case they are really non-printable or non-ASCII This is an addition to 8d5cce896d ("blob" fields: avoid binary encoding if possible) to avoid change of behaviour for CONVMODE_BLOB_B64.
2011-07-22scripting: added READ() methodPatrick Ohly1-0/+51
The READ(filename) method returns the content of the file identified with "filename". Relative paths are interpreted relative to the current directory. On failures, an error messages is logged and UNASSIGNED is returned. This method is useful for inlining the photo data referenced with local file:// URIs shortly before sending to a remote peer. SyncEvolution uses the method in its outgoing vcard script as follows: Field list: <!-- Photo --> <field name="PHOTO" type="blob" compare="never" merge="fillempty"/> <field name="PHOTO_TYPE" type="string" compare="never" merge="fillempty"/> <field name="PHOTO_VALUE" type="string" compare="never" merge="fillempty"/> Profile: <property name="PHOTO" filter="no"> <value field="PHOTO" conversion="BLOB_B64"/> <parameter name="TYPE" default="no" show="yes"> <value field="PHOTO_TYPE"/> </parameter> <parameter name="VALUE" default="no" show="yes"> <value field="PHOTO_VALUE"/> </parameter> </property> Script: if (PHOTO_VALUE == "uri" && SUBSTR(PHOTO, 0, 7) == "file://") { // inline the photo data string data; data = READ(SUBSTR(PHOTO, 7)); if (data != UNASSIGNED) { PHOTO = data; PHOTO_VALUE = "binary"; } } Test cases for inlining, not inlining because of non-file URI and failed inling (file not found) were added to SyncEvolution.
2011-07-22script error messages: fixed invalid memory accessPatrick Ohly1-5/+6
If the text goes through macro expansion, then "aScriptText" is not the chunk of memory which holds the script and "text" doesn't point into it anymore. Therefore "text-aScriptText" calculates the wrong offset. Fixed by storing the real start of memory in a different variable and using that instead of aScriptText. Found when enclosing a string with single quotes instead of double quotes. The resulting syntax error message contained garbled characters instead of the real script line.
2011-07-22"blob" fields: avoid binary encoding if possiblePatrick Ohly1-2/+13
This change is meant for the PHOTO value, which can contain both binary data and plain text URIs. Other binary data fields might also benefit when their content turns out to be plain text (shorter encoding). The change is that base64 encoding is not enforced if all characters are ASCII and printable. That allows special characters like colon, comma, and semicolon to appear unchanged in the content. Regardless whether the check succeeds, the result is guaranteed to contain only ASCII characters, either because it only contains those to start with or because of the base64 encoding.
2011-07-22SMLTK: fixed g++ 4.6 compiler warningPatrick Ohly1-1/+1
g++ 4.6 warns that the "rc" variable is getting assigned but never used. smlEndEvaluation() must have been meant to return that error code instead of always returning SML_ERR_OK - fixed.
2011-06-21engine: updated implementation of "unprocessed" wildcard propertieslibsynthesis_3.4.0.16+syncevolution-1-1-99-5blibsynthesis_3.4.0.16+syncevolution-1-1-99-5alibsynthesis_3.4.0.16+syncevolution-1-1-99-5overridedevinfPatrick Ohly1-4/+4
The 3529d3cb commit which introduced support for "unprocessed" wildcard properties added the logic that such properties are always considered "available" regardless of the actual CtCap of the peer. This has the undesirable effect that the content of these properties are removed when receiving an update from a peer which doesn't support them. Therefore this commit reverts that part of 3529d3cb: setfieldoptions() with NULL as first parameter now only enables mandatory properties, as it did before the introduction of "unprocessed" properties. "unprocessed" properties need to be listed explicitly in the CtCap like any other property. This is currently untested.
2011-06-20Merge branch 'master' into overridedevinfPatrick Ohly3-0/+30
2011-06-20<comparescript>: added COMPAREMODE(), needed to determine compare modeLukas Zeller3-0/+30
A compare script must know what the compare mode is. When checking for "items equal", it must return 0 (equal) or -999 (not equal). When doing an age comparison, it must 1 or -1. The new COMPAREMODE() method returns a string which identifies the current mode: "all", // compare all fields, even irrelevant ones "n/a", // n/a (scripted) "conflict", // compare fields relevant for (normal sync) conflict detection "slowsync", // compare fields relevant for slow sync match "firstsync", // compare fields relevant for first time slow sync match (possibly relaxed comparison rules) "age", // no test for equality, only for age (returns SYSYNC_NOT_COMPARABLE if age comparison not possible) A script only needs to check for "age", and it equal, do the age comparison instead of checking for equality.
2011-06-16libsmltk.so: export xltDecInit/xltDecTerminate/xltDecNextPatrick Ohly1-0/+3
These functions are used by the XML DevInf parser and thus must be exported by libsmltk.so, otherwise linking fails. Perhaps a different API should be used instead. Exporting these functions seemed like the simpler solution for the moment.
2011-06-15remote rules + OverrideDevInf: parse DevInf as part of checking the configPatrick Ohly2-75/+85
Now the DevInf is parsed in TSessionConfig::localResolve(). The result is stored in the TRemoteRuleConfig instance. The advantage is that syntax errors are found earlier and for all remote rules, not just the one active during a sync. The downside is somewhat increased memory and CPU consumption. The DevInf in XML format is kept in memory although no longer needed after localResolve(). That might be useful for debugging.
2011-06-15remote rules: added OverrideDevInfPatrick Ohly5-7/+99
Many SyncML servers send DevInf without CtCap inside. For those servers, the engine (often incorrectly) has to assume that they support all fields. This patch adds a configuration element "OverrideDevInf" which helps to address this problem. It may occur in a "RemoteRule". Once that rule matches a DevInf sent by a peer, processing of CtCap continues with the CtCap element of the DevInf inside the remote rule. This allows adding and overriding the CtCap from a peer. "OverrideDevInf" must contain a complete DevInf, although right now only the CtCap inside it really matters. This approach has the advantage that it can reuse the existing and somewhat documented CtCap format for describing capabilities. The downside is that not everything can be encoded in that format, for example, how many components of the ORG field are supported. A possible solution for that is to extend the format in a way that only the Synthesis engine understand and/or standardize such extensions. Right now the "OverrideDevInf" content is only parsed when needed. Beware that syntax errors will only be found when using the rule!
2011-05-19TDebugLoggerBase: improved clang error suppressionPatrick Ohly1-0/+4
Hide the pragmas inside ifdefs to avoid complaints from other compilers about unknown pragmas.
2011-05-19BinFileImplDS: ignore apiEndDataWrite() name clashPatrick Ohly1-0/+9
The name clash is okay in this case. The two virtual methods really can be overridden separately. Tell clang that via pragmas. The pragmas themselves are inside ifdefs to avoid complaints from other compilers about unknown pragmas.
2011-05-19Revert "BinFileImplDS: apiEndDataWrite() ambiguous"Patrick Ohly2-3/+2
This reverts commit 487d78832ca43879902dd0a119fcc2015c50e88c. Will fix the clang compiler warning differently. As Lukas explained: These two versions of apiEndDataWrite() must both exist. It's a historic thing: - TBinfileImplDS always had no-op apiEndDataWrite(void), that *could* be overridden by direct descendant (which exist e.g. in non-OS WinMobile and PalmOS datastores) - TCustomImplDS always had abstract apiEndDataWrite(string &) which has to be implemented in a descendant (and is, in odbcabidb and pluginapidb).
2011-05-05gcc 4.6: fixed compile issuePatrick Ohly2-0/+2
gcc 4.6 seems to change header dependencies. cstddef must be included explicitly. Kudos to Peter Robinson for reporting this and providing the patch.
2011-04-20MAKE/PARSETEXTWITHPROFILE(): support recursive <include rule>libsynthesis_3.4.0.16+syncevolution-1-1-99-4Patrick Ohly1-4/+6
The code added in commit e8b3e088fdc894cade81472412817c01c7cef57f only acticated sub-rules directly included by the rule specified as parameter of MAKE/PARSETEXTWITHPROFILE(). With this patch, TMimeDirProfileHandler::activateRemoteRule() activates sub-rules recursively. As before the settings of a rule are activated before activating sub-rules, so they may overwrite their parent's settings again. Because setRemoteRule/activateRemoteRule() are only used by scripts, syncing is not affected by this change. I haven't checked whether recursive inclusion is handled there.
2011-04-19server progress events: report stable sync modePatrick Ohly2-11/+37
In a client, PEV_ALERTED was reported to the app with the final sync mode. On the server, that was missing, partly because the determination of the final sync mode has to be delayed a bit. This patch moves the progress event into the one place that is called in all cases: TLocalEngineDS::changeState() for aNewState == dssta_syncmodestable. There it is executed for client and server.
2011-04-11fixed compiler warnings around "unsigned >= 0"Patrick Ohly4-8/+8
clang 2.9 detects comparisons which are always true, like "unsigned value >= 0", and warns about them. In some cases the usage of a signed type prevents detecting underflows (argidx = c-'1'), in another it means that error handling was never done (fread() returns 0 on error, not -1). Fixed by switching (back?) to signed types and casting to unsigned after sanity check and before comparison against other, real unsigned types.
2011-04-11BinFileImplDS: apiEndDataWrite() ambiguousPatrick Ohly2-2/+3
clang 2.9 pointed out that apiEndDataWrite() existed in versions with and without parameter. Unified that to the version with a string retval. Probably never mattered because all implementations are empty?!
2011-03-28Synthesis SDK: explicitly define dependency on libsmltkPatrick Ohly3-2/+3
libsynthesissdk calls libsmltk directly (in san.cpp). libsmltk used to be provided via libsynthesis, but only if really linked (not always the case, for example when using the SDK in "open engine dynamically" mode) and indirect linking stopped working with more recent Linux bintools which enforce that all libraries are properly declared. This patch fixes this both in libtool linking (.la files, LIBADD) and pkg-config definition files (.pc files).
2011-02-28version bump: new revision, mark in .pc filePatrick Ohly2-3/+3
The VERSION set by AM_INIT_AUTOMAKE() was only used in the *.pc files and has never been updated since the initial Linux release. Bumped it to 3.4, so that SyncEvolution can test for a recent enough libsynthesis during configuration. Also incremented the .so. New features were added, without breaking backwards compatibility. This is not quite the same as extending the ABI, but close.
2011-02-18compiler fixes for clang 2.8libsynthesis_3.4.0.16+syncevolution-1-1-99-3Patrick Ohly11-18/+30
With these fixes, clang -Wall -Werror -Wno-unknown-pragmas compiles cleanly. Changes: - short <-> int mismatches in printf formatting - NULL format string causes a warning (okay in DebugOpenBlock(), but cannot tell the compiler -> disable checking in that one place where it happens) - return NULL pointer instead of implicitly converting false to NULL - use curly brackets to denote empty body because clang does not accept a single colon
2011-01-31Merge remote branch 'synthesis/luz'libsynthesis_3.4.0.16+syncevolution-1-1-99-2Patrick Ohly3-17/+19