You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
(56) |
Apr
(109) |
May
(15) |
Jun
(3) |
Jul
(37) |
Aug
(96) |
Sep
(40) |
Oct
(4) |
Nov
(54) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(47) |
Feb
(30) |
Mar
(102) |
Apr
(120) |
May
(68) |
Jun
(54) |
Jul
(53) |
Aug
(122) |
Sep
(190) |
Oct
(71) |
Nov
(85) |
Dec
(108) |
2007 |
Jan
(72) |
Feb
(190) |
Mar
(53) |
Apr
(101) |
May
(145) |
Jun
(148) |
Jul
(167) |
Aug
(143) |
Sep
(23) |
Oct
(198) |
Nov
(223) |
Dec
(195) |
2008 |
Jan
(100) |
Feb
(129) |
Mar
(79) |
Apr
(77) |
May
(34) |
Jun
(95) |
Jul
(112) |
Aug
(160) |
Sep
(82) |
Oct
(124) |
Nov
(199) |
Dec
(355) |
2009 |
Jan
(436) |
Feb
(89) |
Mar
(298) |
Apr
(189) |
May
(33) |
Jun
(88) |
Jul
(105) |
Aug
(44) |
Sep
(181) |
Oct
(87) |
Nov
(75) |
Dec
(1) |
2010 |
Jan
(63) |
Feb
(21) |
Mar
(3) |
Apr
(1) |
May
(1) |
Jun
(3) |
Jul
(26) |
Aug
(37) |
Sep
(26) |
Oct
(15) |
Nov
(13) |
Dec
|
From: <svn...@op...> - 2009-10-22 07:32:44
|
Author: henrik Date: Thu Oct 22 09:32:35 2009 New Revision: 5882 URL: http://www.opensync.org/changeset/5882 Log: Mozilla has static capabilities, so now we store the capabilities in a static xml file instead of generating them on the fly Added: plugins/mozilla-sync/trunk/src/mozilla-sync-caps.xml plugins/mozilla-sync/trunk/src/mozilla-sync-desc.xml Modified: plugins/mozilla-sync/trunk/src/CMakeLists.txt plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Modified: plugins/mozilla-sync/trunk/src/CMakeLists.txt ============================================================================== --- plugins/mozilla-sync/trunk/src/CMakeLists.txt Thu Oct 22 09:28:34 2009 (r5881) +++ plugins/mozilla-sync/trunk/src/CMakeLists.txt Thu Oct 22 09:32:35 2009 (r5882) @@ -4,7 +4,7 @@ # See http://www.KaarPoSoft.dk/bluezync/ # $Id$ # -# Copyright (C) 2007 Henrik Kaare Poulsen /KaarPoSoft +# Copyright (C) 2007-2009 Henrik Kaare Poulsen /KaarPoSoft # # This plugin is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -74,6 +74,9 @@ ###### PLUGIN ################### +OPENSYNC_PLUGIN_DESCRIPTIONS( mozilla-sync-desc.xml ) +OPENSYNC_PLUGIN_CAPABILITIES( mozilla-sync-caps.xml ) + OPENSYNC_PLUGIN_CONFIG( mozilla-sync ) OPENSYNC_PLUGIN_INSTALL( mozilla-sync ) Added: plugins/mozilla-sync/trunk/src/mozilla-sync-caps.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/mozilla-sync/trunk/src/mozilla-sync-caps.xml Thu Oct 22 09:32:35 2009 (r5882) @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<Caps Version="1.0" CapsFormat="xmlformat"> + +<ObjType Name="contact"> + +<Cap> + <Name>Address</Name> + <Cap><Name>Country</Name></Cap> + <Cap><Name>ExtendedAddress</Name></Cap> + <Cap><Name>Locality</Name></Cap> + <Cap><Name>PostalCode</Name></Cap> + <Cap><Name>Region</Name></Cap> + <Cap><Name>Street</Name></Cap> +</Cap> +<Cap><Name>EMail</Name></Cap> +<Cap><Name>FormattedName</Name></Cap> +<Cap> + <Name>Name</Name> + <Cap><Name>FirstName</Name></Cap> + <Cap><Name>LastName</Name></Cap> +</Cap> +<Cap><Name>Nickname</Name></Cap> +<Cap><Name>Note</Name></Cap> +<Cap><Name>Organization</Name></Cap> +<Cap><Name>Telephone</Name></Cap> +<Cap><Name>Title</Name></Cap> +<Cap><Name>Url</Name></Cap> + +</ObjType> + +<ObjType Name="event"> + +<Cap><Name>Alarm</Name></Cap> +<Cap><Name>AlarmRelatedEnd</Name></Cap> +<Cap><Name>Attach</Name></Cap> +<Cap><Name>Attendee</Name></Cap> +<Cap><Name>CalendarScale</Name></Cap> +<Cap><Name>Categories</Name></Cap> +<Cap><Name>Class</Name></Cap> +<Cap><Name>Comment</Name></Cap> +<Cap><Name>Contact</Name></Cap> +<Cap><Name>Created</Name></Cap> +<Cap><Name>DateCalendarCreated</Name></Cap> +<Cap><Name>DateEnd</Name></Cap> +<Cap><Name>DateStarted</Name></Cap> +<Cap><Name>Description</Name></Cap> +<Cap><Name>Duration</Name></Cap> +<Cap><Name>ExceptionDateTime</Name></Cap> +<Cap><Name>ExceptionRule</Name></Cap> +<Cap><Name>ExceptionRuleExtended</Name></Cap> +<Cap><Name>FreeBusy</Name></Cap> +<Cap><Name>Geo</Name></Cap> +<Cap><Name>LastModified</Name></Cap> +<Cap><Name>Location</Name></Cap> +<Cap><Name>Method</Name></Cap> +<Cap><Name>Organizer</Name></Cap> +<Cap><Name>Priority</Name></Cap> +<Cap><Name>ProductID</Name></Cap> +<Cap><Name>RStatus</Name></Cap> +<Cap><Name>RecurrenceDateTime</Name></Cap> +<Cap><Name>RecurrenceId</Name></Cap> +<Cap><Name>RecurrenceRule</Name></Cap> +<Cap><Name>RecurrenceRuleExtended</Name></Cap> +<Cap><Name>Related</Name></Cap> +<Cap><Name>Resources</Name></Cap> +<Cap><Name>Sequence</Name></Cap> +<Cap><Name>Status</Name></Cap> +<Cap><Name>Summary</Name></Cap> +<Cap><Name>TimeTransparency</Name></Cap> +<Cap><Name>Uid</Name></Cap> +<Cap><Name>Url</Name></Cap> +<Cap><Name>Version</Name></Cap> + +</ObjType> + +</Caps> + Added: plugins/mozilla-sync/trunk/src/mozilla-sync-desc.xml ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ plugins/mozilla-sync/trunk/src/mozilla-sync-desc.xml Thu Oct 22 09:32:35 2009 (r5882) @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<versions version="0.1"> +<version> +<PlugIn>mozilla-sync</PlugIn> +<Priority>100</Priority> +<Vendor>KaarPoSoft</Vendor> +<ModelVersion></ModelVersion> +<FirmwareVersion></FirmwareVersion> +<SoftwareVersion></SoftwareVersion> +<HardwareVersion></HardwareVersion> +<Identifier>mozilla-sync-caps.xml</Identifier> +</version> +</versions> Modified: plugins/mozilla-sync/trunk/src/mozilla-sync.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Thu Oct 22 09:28:34 2009 (r5881) +++ plugins/mozilla-sync/trunk/src/mozilla-sync.cpp Thu Oct 22 09:32:35 2009 (r5882) @@ -919,30 +919,6 @@ // ---------------------------------------- - -typedef struct _CapDef { - OSyncCapabilitiesObjType *pCapabilitiesObjType; - const char* szCap; - gboolean fError; - OSyncError **ppOSyncError; -} CapDef; - - -// ---------------------------------------- - -void addCapabilityEvent(void* voidSz, void* voidPCapDef) { - CapDef *pCapDef=(CapDef*) voidPCapDef; - if (pCapDef->fError) return; - char *sz = (char*) voidSz; - LOG(10, "Capability: [%s]", sz); - - OSyncCapability *pCapability = osync_capability_new(pCapDef->pCapabilitiesObjType, pCapDef->ppOSyncError); - if (!pCapability) pCapDef->fError=TRUE; - osync_capability_set_name(pCapability, g_strdup(sz)); -} - - -// ---------------------------------------- /** @brief Discover sinks Here we actually tell opensync which sinks are available. @@ -975,6 +951,7 @@ if (!version) { LOG_EXIT_ERROR_OSYNC_SZ(10, ppOSyncError, "Could not get osync_version_new"); return FALSE; } osync_version_set_plugin(version, "mozilla-sync"); + osync_version_set_vendor(version, "KaarPoSoft"); //osync_version_set_modelversion(version, "version"); //osync_version_set_firmwareversion(version, "firmwareversion"); //osync_version_set_softwareversion(version, "softwareversion"); @@ -1111,39 +1088,9 @@ } - OSyncCapabilities *pCapabilities=NULL; - - CapDef capDef; - capDef.fError=FALSE; - capDef.ppOSyncError=ppOSyncError; - - GList *pGList; - if (pOSyncMozillaEnv->mozillaConfig.szCalendarId) { - pCapabilities=osync_capabilities_new("vformat", ppOSyncError); - if (!pCapabilities) goto error; - capDef.pCapabilitiesObjType=osync_capabilities_objtype_new(pCapabilities, "event", ppOSyncError); - if (!capDef.pCapabilitiesObjType) goto error; - pGList=PGListEventCapabilities(); - g_list_foreach(pGList, addCapabilityEvent, &capDef); - } - - if (pOSyncMozillaEnv->mozillaConfig.szAddressbookFile) { - pCapabilities=osync_capabilities_new("xmlformat", ppOSyncError); - if (!pCapabilities) goto error; - capDef.pCapabilitiesObjType=osync_capabilities_objtype_new(pCapabilities, "contact", ppOSyncError); - if (!capDef.pCapabilitiesObjType) goto error; - pGList=ThunderbirdCard::PGListCapabilities(); - g_list_foreach(pGList, addCapabilityEvent, &capDef); - } - osync_plugin_info_set_capabilities(pOSyncPluginInfo, pCapabilities); - - if (capDef.fError) - { LOG_EXIT_ERROR_OSYNC_SZ(10, capDef.ppOSyncError, "Could not add capability"); return NULL; } LOG_EXIT(10, "(%p)", pOSyncMozillaEnv); return (void*) pOSyncMozillaEnv; -error: - LOG_EXIT_ERROR_OSYNC_SZ(10, capDef.ppOSyncError, "Could not add capabilities"); return NULL; } |
From: <svn...@op...> - 2009-10-22 07:28:48
|
Author: henrik Date: Thu Oct 22 09:28:34 2009 New Revision: 5881 URL: http://www.opensync.org/changeset/5881 Log: Make nsProfileDirServiceProvider::GetFile respond to NS_OS_CURRENT_PROCESS_DIR and "resource:app" needed for Thunderbird 3 Modified: plugins/mozilla-sync/trunk/src/nsProfileDirServiceProvider.cpp Modified: plugins/mozilla-sync/trunk/src/nsProfileDirServiceProvider.cpp ============================================================================== --- plugins/mozilla-sync/trunk/src/nsProfileDirServiceProvider.cpp Thu Oct 22 09:23:51 2009 (r5880) +++ plugins/mozilla-sync/trunk/src/nsProfileDirServiceProvider.cpp Thu Oct 22 09:28:34 2009 (r5881) @@ -56,6 +56,7 @@ // Define NSPROFILEDIRSERVICEPROVIDER_DEBUG to get a message on stdout when functions are called. // Handy when nothing works, and you have to figure out if the service was used at all... +#define NSPROFILEDIRSERVICEPROVIDER_DEBUG 1 #ifdef NSPROFILEDIRSERVICEPROVIDER_DEBUG #define LOG(level, message ...) \ { printf("nsProfileDirServiceProvider::%s(%d): ", __func__, __LINE__); printf(message); printf("\n"); } @@ -155,6 +156,12 @@ else if (strcmp(prop, NS_XPCOM_CURRENT_PROCESS_DIR) == 0) { rv = mGreDir->Clone(getter_AddRefs(file)); } +else if (strcmp(prop, NS_OS_CURRENT_PROCESS_DIR) == 0) { + rv = mGreDir->Clone(getter_AddRefs(file)); + } +else if (strcmp(prop, "resource:app") == 0) { + rv = mGreDir->Clone(getter_AddRefs(file)); + } else if (strcmp(prop, NS_GRE_COMPONENT_DIR) == 0) { rv = mGreDir->Clone(getter_AddRefs(file)); if (NS_SUCCEEDED(rv)) |
From: <svn...@op...> - 2009-10-22 07:24:08
|
Author: henrik Date: Thu Oct 22 09:23:51 2009 New Revision: 5880 URL: http://www.opensync.org/changeset/5880 Log: Do not feed Mozilla with empty VCard properties, which it cannot handle anyway Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_additional/add1 plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_additional/add1 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_additional/add1 Wed Oct 21 19:56:35 2009 (r5879) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_additional/add1 Thu Oct 22 09:23:51 2009 (r5880) @@ -4,7 +4,7 @@ th country EMAIL;PREF:add...@ex... FN:four additional -N:four;additional;;; +N:four;additional ORG:additional organization;additional department TEL;HOME:444222 TEL;WORK:444111 Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 Wed Oct 21 19:56:35 2009 (r5879) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/1 Thu Oct 22 09:23:51 2009 (r5880) @@ -7,7 +7,7 @@ EMAIL;PREF:on...@ex... EMAIL:fi...@ex... FN:one first -N:first;one;;; +N:first;one ORG:first organization;first department TEL;HOME:111222 TEL;CELL:111444 Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 Wed Oct 21 19:56:35 2009 (r5879) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/2 Thu Oct 22 09:23:51 2009 (r5880) @@ -8,7 +8,7 @@ EMAIL;PREF:tw...@ex... EMAIL:se...@ex... FN:two second -N:second;two;;; +N:second;two ORG:second organization;second department TEL;CELL:222444 TEL;WORK:222111 Modified: plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 ============================================================================== --- plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Wed Oct 21 19:56:35 2009 (r5879) +++ plugins/mozilla-sync/trunk/tests/blackbox_test_abook_vcard_base/3 Thu Oct 22 09:23:51 2009 (r5880) @@ -7,7 +7,7 @@ EMAIL;PREF:th...@ex... EMAIL:th...@ex... FN:three third -N:third;three;;; +N:third;three ORG:third organization;third department TEL;HOME:333222 TEL;CELL:333444 |
From: <svn...@op...> - 2009-10-21 17:56:45
|
Author: cstender Date: Wed Oct 21 19:56:35 2009 New Revision: 5879 URL: http://www.opensync.org/changeset/5879 Log: fixed conversion of name and adress attributes from xmlformat-contact to vcard Modified: format-plugins/vformat/src/xmlformat-common.c Modified: format-plugins/vformat/src/xmlformat-common.c ============================================================================== --- format-plugins/vformat/src/xmlformat-common.c Wed Oct 21 19:39:00 2009 (r5878) +++ format-plugins/vformat/src/xmlformat-common.c Wed Oct 21 19:56:35 2009 (r5879) @@ -227,7 +227,8 @@ vformat_attribute_add_value(attr, tmp); } -void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding) { +void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding) +{ const char **parameterValueArray = malloc(nParameters*sizeof(char*)); int n=-1; int i; @@ -235,9 +236,18 @@ parameterValueArray[i]=osync_xmlfield_get_key_value(xmlfield, parameterNameArray[i]); if (parameterValueArray[i]) n=i; } - for (i=0; i<=n; ++i) { + for (i=0; i<=n; ++i) + { const char *tmp = parameterValueArray[i]; - if (!tmp) continue; + + if (!tmp) { + /* If there is no node with the given name, add an empty value to the list. + * This is necessary because some fields (N and ADR, for example) need + * a specific order of the values + */ + tmp = ""; + } + if (needs_charset((unsigned char*)tmp)) if (!vformat_attribute_has_param (attr, "CHARSET")) vformat_attribute_add_param_with_value(attr, "CHARSET", "UTF-8"); |
From: <svn...@op...> - 2009-10-21 17:39:15
|
Author: henrik Date: Wed Oct 21 19:39:00 2009 New Revision: 5878 URL: http://www.opensync.org/changeset/5878 Log: Fixed xmlformat-vcard.c so handle_xml_name_attribute and handle_xml_address_attribute does not invent empty properties. Fixes #1173 Modified: format-plugins/vformat/src/xmlformat-common.c format-plugins/vformat/src/xmlformat-common.h format-plugins/vformat/src/xmlformat-vcard.c Modified: format-plugins/vformat/src/xmlformat-common.c ============================================================================== --- format-plugins/vformat/src/xmlformat-common.c Wed Oct 21 19:03:09 2009 (r5877) +++ format-plugins/vformat/src/xmlformat-common.c Wed Oct 21 19:39:00 2009 (r5878) @@ -227,6 +227,36 @@ vformat_attribute_add_value(attr, tmp); } +void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding) { + const char **parameterValueArray = malloc(nParameters*sizeof(char*)); + int n=-1; + int i; + for (i=0; i<nParameters; ++i) { + parameterValueArray[i]=osync_xmlfield_get_key_value(xmlfield, parameterNameArray[i]); + if (parameterValueArray[i]) n=i; + } + for (i=0; i<=n; ++i) { + const char *tmp = parameterValueArray[i]; + if (!tmp) continue; + if (needs_charset((unsigned char*)tmp)) + if (!vformat_attribute_has_param (attr, "CHARSET")) + vformat_attribute_add_param_with_value(attr, "CHARSET", "UTF-8"); + + /* XXX: This one breaks unit test case: conv_vcard_evolution2_special + TODO: Combine this with converter extension/config ... e.g. if a mobile needs QP! + */ + if (needs_encoding((unsigned char*)tmp, encoding)) { + if (!vformat_attribute_has_param (attr, "ENCODING")) + vformat_attribute_add_param_with_value(attr, "ENCODING", encoding); + vformat_attribute_add_value_decoded(attr, tmp, strlen(tmp) + 1); + } else + vformat_attribute_add_value(attr, tmp); + + } + free(parameterValueArray); +} + + void add_values(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding) { int i, c = osync_xmlfield_get_key_count(xmlfield); Modified: format-plugins/vformat/src/xmlformat-common.h ============================================================================== --- format-plugins/vformat/src/xmlformat-common.h Wed Oct 21 19:03:09 2009 (r5877) +++ format-plugins/vformat/src/xmlformat-common.h Wed Oct 21 19:39:00 2009 (r5878) @@ -71,6 +71,7 @@ osync_bool needs_charset(const unsigned char *tmp); void add_value(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *name, const char *encoding); +void add_value_array(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *parameterNameArray[], int nParameters, const char *encoding); void add_values(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding); void add_values_from_nth_field_on(VFormatAttribute *attr, OSyncXMLField *xmlfield, const char *encoding, int nth); Modified: format-plugins/vformat/src/xmlformat-vcard.c ============================================================================== --- format-plugins/vformat/src/xmlformat-vcard.c Wed Oct 21 19:03:09 2009 (r5877) +++ format-plugins/vformat/src/xmlformat-vcard.c Wed Oct 21 19:39:00 2009 (r5878) @@ -1213,17 +1213,13 @@ // g_free(content); //} +static const char* xml_address_parameters[] = { "PostOfficeBox", "ExtendedAddress", "Street", "Locality", "Region", "PostalCode", "Country" }; + static VFormatAttribute *handle_xml_address_attribute(VFormat *vcard, OSyncXMLField *xmlfield, const char *encoding) { osync_trace(TRACE_INTERNAL, "Handling address xml attribute"); VFormatAttribute *attr = vformat_attribute_new(NULL, "ADR"); - add_value(attr, xmlfield, "PostOfficeBox", encoding); - add_value(attr, xmlfield, "ExtendedAddress", encoding); - add_value(attr, xmlfield, "Street", encoding); - add_value(attr, xmlfield, "Locality", encoding); - add_value(attr, xmlfield, "Region", encoding); - add_value(attr, xmlfield, "PostalCode", encoding); - add_value(attr, xmlfield, "Country", encoding); + add_value_array(attr, xmlfield, xml_address_parameters, 7, encoding); vformat_add_attribute(vcard, attr); return attr; } @@ -1466,15 +1462,13 @@ return attr; } +static const char* xml_name_parameters[] = { "LastName", "FirstName", "Additional", "Prefix", "Suffix" }; + static VFormatAttribute *handle_xml_name_attribute(VFormat *vcard, OSyncXMLField *xmlfield, const char *encoding) { osync_trace(TRACE_INTERNAL, "Handling name xml attribute"); VFormatAttribute *attr = vformat_attribute_new(NULL, "N"); - add_value(attr, xmlfield, "LastName", encoding); - add_value(attr, xmlfield, "FirstName", encoding); - add_value(attr, xmlfield, "Additional", encoding); - add_value(attr, xmlfield, "Prefix", encoding); - add_value(attr, xmlfield, "Suffix", encoding); + add_value_array(attr, xmlfield, xml_name_parameters, 5, encoding); vformat_add_attribute(vcard, attr); return attr; } |
From: <svn...@op...> - 2009-10-21 17:03:22
|
Author: scriptor Date: Wed Oct 21 19:03:09 2009 New Revision: 5877 URL: http://www.opensync.org/changeset/5877 Log: I have corrected some error and trace messages. Modified: plugins/ldap-sync/src/ldap_format.c plugins/ldap-sync/src/ldap_plugin.c Modified: plugins/ldap-sync/src/ldap_format.c ============================================================================== --- plugins/ldap-sync/src/ldap_format.c Wed Oct 21 19:02:39 2009 (r5876) +++ plugins/ldap-sync/src/ldap_format.c Wed Oct 21 19:03:09 2009 (r5877) @@ -1380,12 +1380,12 @@ if (child_name == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name = NULL. Ignoring this node.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: child_name = NULL. Ignoring this node.\n", __FILE__, __LINE__); continue; } if (child_name[0] == 0) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: child_name[0] = 0. Ignoring this node.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: child_name[0] = 0. Ignoring this node.\n", __FILE__, __LINE__); continue; } @@ -1398,13 +1398,13 @@ if (child_value == NULL) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: child_value = NULL. Ignoring this node with child_name = \"%s\"\n", __FILE__, __LINE__, child_name); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: child_value = NULL. Ignoring this node with child_name = \"%s\"\n", __FILE__, __LINE__, child_name); continue; } if (child_value[0] == 0) { - osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: child_value[0] = 0. Ignoring this node with child_name = \"%s\"\n", __FILE__, __LINE__, child_name); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: child_value[0] = 0. Ignoring this node with child_name = \"%s\"\n", __FILE__, __LINE__, child_name); continue; } @@ -4117,12 +4117,12 @@ } if (value == NULL) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: value = NULL. Skipping this xmlnode.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: value = NULL. Skipping this xmlnode. name = \"%s\".\n", __FILE__, __LINE__, (char *)name ? (char *)name : "NULL"); continue; } if (value[0] == 0) { - osync_trace(TRACE_ERROR, "%s:%i: ERROR: value[0] = 0.\n", __FILE__, __LINE__); + osync_trace(TRACE_ERROR, "%s:%i: WARNING: value[0] = 0. Skipping this xmlnode. name = \"%s\".\n", __FILE__, __LINE__, (char *)name ? (char *)name : "NULL"); if (value) { xmlFree(value); value = NULL; Modified: plugins/ldap-sync/src/ldap_plugin.c ============================================================================== --- plugins/ldap-sync/src/ldap_plugin.c Wed Oct 21 19:02:39 2009 (r5876) +++ plugins/ldap-sync/src/ldap_plugin.c Wed Oct 21 19:03:09 2009 (r5877) @@ -3542,12 +3542,12 @@ * @brief This is a helper function for ldap_plugin_commit_modification(). * It looks for any modifications that are to be made on the LDAP * server's side from the perspective of the peer, i.e. it starts - * from the list of LDAP entries received as "change". + * with the list of LDAP entries received as "change". * * @param ctx The libopensync context. * @param sinkenv The plugin specific environment. * @param ldap_entries A list of LDAP entries which have changed and which - * need to change on the LDAP server side. + * need to be changed on the LDAP server side. * @param id_of_modified_entry This is the identifier ("uid=...") of the LDAP * entry that is to be modified. * @param dn_of_modified_entry This is not just the identifier, but the @@ -3562,10 +3562,10 @@ osync_bool ldap_plugin_commit_modification_from_server_s_view(OSyncContext *ctx, sink_environment *sinkenv, GList *ldap_entries, char **id_of_modified_entry, char **dn_of_modified_entry, char **hash, OSyncError **error) { - osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, ctx, sinkenv, ldap_entries, error); + osync_trace(TRACE_ENTRY, "%s(%p, %p, %p, %p, %p, %p, %p)", __func__, ctx, sinkenv, ldap_entries, id_of_modified_entry, dn_of_modified_entry, hash, error); - if (ldap_entries == NULL) { + if (ldap_entries == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: ldap_entries = NULL.\n", __FILE__, __LINE__); goto error; } @@ -3575,14 +3575,11 @@ goto error; } - - if (dn_of_modified_entry == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: dn_of_modified_entry = NULL.\n", __FILE__, __LINE__); goto error; } - if (hash == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: hash = NULL.\n", __FILE__, __LINE__); goto error; @@ -3781,7 +3778,7 @@ * @param sinkenv The plugin specific environment. * @param change The change object. * @param ldap_entries A list of LDAP entries which have changed and which - * need to change on the LDAP server side. + * need to be changed on the LDAP server side. * @param result As a result of this function this variable gets filled with * libldap errno: * LDAP_SUCCESS on success, @@ -3841,7 +3838,6 @@ goto error; } - if (result == NULL) { osync_error_set(error, OSYNC_ERROR_GENERIC, "%s:%i: ERROR: result is NULL.", __FILE__, __LINE__); goto error; |
From: <svn...@op...> - 2009-10-21 17:02:55
|
Author: scriptor Date: Wed Oct 21 19:02:39 2009 New Revision: 5876 URL: http://www.opensync.org/changeset/5876 Log: Update. Modified: plugins/ldap-sync/BUGS Modified: plugins/ldap-sync/BUGS ============================================================================== --- plugins/ldap-sync/BUGS Tue Oct 20 23:19:45 2009 (r5875) +++ plugins/ldap-sync/BUGS Wed Oct 21 19:02:39 2009 (r5876) @@ -12,6 +12,14 @@ /usr/local/share/libopensync1/schemas/xmlformat-*.xsd. +II. Referrals and continuations + +Currently there is no support for LDAP referrals or continuations. +(LDAP_RES_SEARCH_REFERENCE). This is a problem for distributed +LDAP systems, where, say, the addressbook is stored on one LDAP server, +and the calendar on another LDAP server. + + B. Design: @@ -33,6 +41,11 @@ more than just once. The *.xsd files allow for such multiple occurrences. +I deliberate on whether I should make use of multivalued LDAP +attributes. While this would be valid from the LDAP perspective, +it simply does not work, when XML attributes have to be dealt with, +or when I have to make use of those LDAP subentries for other reasons. + Maybe I should create opensync specific LDAP schemata? Don't know. I would have preferred using schemata that are already existing and used by other people... |
From: <svn...@op...> - 2009-10-20 21:20:00
|
Author: henrik Date: Tue Oct 20 23:19:45 2009 New Revision: 5875 URL: http://www.opensync.org/changeset/5875 Log: Make osync_bool osync_group_env_setup_config_dir work even if user has neither the new XDG_CONFIG_HOME/opensync/0.40 directory nor the old /home/Henrik//.opensync. Fixes #1172 Modified: trunk/opensync/group/opensync_group_env.c Modified: trunk/opensync/group/opensync_group_env.c ============================================================================== --- trunk/opensync/group/opensync_group_env.c Tue Oct 20 22:31:05 2009 (r5874) +++ trunk/opensync/group/opensync_group_env.c Tue Oct 20 23:19:45 2009 (r5875) @@ -271,8 +271,12 @@ homedir = g_get_home_dir(); osync22dir = osync_strdup_printf("%s%c.opensync", homedir, G_DIR_SEPARATOR); - if (!osync_glob_copy(osync22dir, "group*", groupsdir, error)) - goto destroy; + if (g_file_test(osync22dir, G_FILE_TEST_IS_DIR)) { + if (!osync_glob_copy(osync22dir, "group*", groupsdir, error)) + goto destroy; + } else { + osync_trace(TRACE_INTERNAL, "No old configdir %s to copy\n", osync22dir); + } osync_trace(TRACE_INTERNAL, "Created groups configdir %s\n", groupsdir); ret = TRUE; |
From: <svn...@op...> - 2009-10-20 20:31:23
|
Author: henrik Date: Tue Oct 20 22:31:05 2009 New Revision: 5874 URL: http://www.opensync.org/changeset/5874 Log: Correct cloning of mapping change in _osync_obj_engine_mapping_find. Fixes ticket 1170 Modified: trunk/opensync/engine/opensync_obj_engine.c Modified: trunk/opensync/engine/opensync_obj_engine.c ============================================================================== --- trunk/opensync/engine/opensync_obj_engine.c Sun Oct 18 04:40:44 2009 (r5873) +++ trunk/opensync/engine/opensync_obj_engine.c Tue Oct 20 22:31:05 2009 (r5874) @@ -310,15 +310,15 @@ osync_trace(TRACE_INTERNAL, "Member1-caps: %p Member2-caps: %p", caps1, caps2); - if (caps1) { - clone_change1 = _osync_obj_engine_clone_and_demerge_change(sinkengine->engine, caps1, change2, error); + if (caps2) { + clone_change1 = _osync_obj_engine_clone_and_demerge_change(sinkengine->engine, caps2, change1, error); if (!clone_change1) goto error; } - if (caps2) { - clone_change2 = _osync_obj_engine_clone_and_demerge_change(sinkengine->engine, caps2, change1, error); + if (caps1) { + clone_change2 = _osync_obj_engine_clone_and_demerge_change(sinkengine->engine, caps1, change2, error); if (!clone_change2) goto error; @@ -333,10 +333,10 @@ tmp_result = osync_change_compare(change1, change2, error); - if (caps1) + if (caps2) osync_change_unref(clone_change1); - if (caps2) + if (caps1) osync_change_unref(clone_change2); if(tmp_result == OSYNC_CONV_DATA_SAME) { |
From: <svn...@op...> - 2009-10-18 10:30:45
|
Author: bellmich Date: Sun Oct 18 12:30:32 2009 New Revision: 1347 URL: http://libsyncml.opensync.org/changeset/1347 Log: fixed slow sync behaviour to recover a mobile Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Sun Oct 18 12:29:40 2009 (r1346) +++ trunk/tools/syncml-ds-tool.c Sun Oct 18 12:30:32 2009 (r1347) @@ -1053,7 +1053,7 @@ /* fix indexes */ SmlChangeType changeType = SML_CHANGE_UNKNOWN; - if (original) + if (!datastore->slow && original) { /* potentially changed item */ if (strcmp(digest, original)) @@ -1121,7 +1121,7 @@ if (*error) goto error; gsize i = 0; - for (; i < count; i++) + for (; !datastore->slow && i < count; i++) { printf("\tItem %s was locally deleted.\n", keys[i]); |
From: <svn...@op...> - 2009-10-18 10:29:55
|
Author: bellmich Date: Sun Oct 18 12:29:40 2009 New Revision: 1346 URL: http://libsyncml.opensync.org/changeset/1346 Log: fixed CRLF issue within CDATA This is a fix for a expat/libwbxml issue. Expat normalizes all CR and CRLF in cdata sections to LF. This means that all CRs inside of a vCard are lost. This means that libwbxml cannot transport CRs. The result is a wrong length calculation for SyncML data items. The solution is to replace all CRs and CRLFs by LFs. This is fully compliant with the XML specs. The only problem is the SyncML spec. NOTICE: The problem was discovered when I try to recover my mobile. NOTICE: I used syncml-ds-tool for this. NOTICE: The vCard of my girl friend included a photo with CRLFs. Modified: trunk/libsyncml/data_sync_api/sml_data_sync_change_item.c trunk/tests/CMakeLists.txt trunk/tests/check_data_sync_api_change_item.c Modified: trunk/libsyncml/data_sync_api/sml_data_sync_change_item.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync_change_item.c Sun Oct 18 12:23:27 2009 (r1345) +++ trunk/libsyncml/data_sync_api/sml_data_sync_change_item.c Sun Oct 18 12:29:40 2009 (r1346) @@ -345,6 +345,31 @@ g_free (self->priv->data); self->priv->data = g_strndup(data, size); + /* Carriage Return and Newlines must be normalized + * because XML / WBXML conversion fails otherwise. + * This is an expat issue inside of libwbxml. + */ + + gsize i = 0; + for (; i < strlen(self->priv->data); i++) + { + if (self->priv->data[i] == '\r') + { + if (i+1 < strlen(self->priv->data) && + self->priv->data[i+1] == '\n') + { + /* \r\n => \n */ + self->priv->data[i] = '\0'; + gchar *help = g_strjoin(NULL, self->priv->data, self->priv->data + i + 1, NULL); + g_free(self->priv->data); + self->priv->data = help; + } else { + /* \r => \n */ + self->priv->data[i] = '\n'; + } + } + } + sml_return_val_error_if_fail (self->priv->data, FALSE, error, SML_ERROR_GENERIC, "Cannot copy the data - out of memory."); return TRUE; Modified: trunk/tests/CMakeLists.txt ============================================================================== --- trunk/tests/CMakeLists.txt Sun Oct 18 12:23:27 2009 (r1345) +++ trunk/tests/CMakeLists.txt Sun Oct 18 12:29:40 2009 (r1346) @@ -119,6 +119,9 @@ SML_ADD_TESTCASE( change_item_attach_fragment ) SML_ADD_TESTCASE( change_item_attach_too_long_fragment ) SML_ADD_TESTCASE( change_item_attach_unnecessary_fragment ) + SML_ADD_TESTCASE( change_item_data_fix_cr ) + SML_ADD_TESTCASE( change_item_data_fix_crlf ) + SML_ADD_TESTCASE( change_item_data_fix_cr_and_crlf ) SML_ADD_TESTCASE( change_item_references ) SML_END_TEST() Modified: trunk/tests/check_data_sync_api_change_item.c ============================================================================== --- trunk/tests/check_data_sync_api_change_item.c Sun Oct 18 12:23:27 2009 (r1345) +++ trunk/tests/check_data_sync_api_change_item.c Sun Oct 18 12:29:40 2009 (r1346) @@ -790,6 +790,104 @@ } END_TEST +START_TEST (change_item_data_fix_cr) +{ + setup_testbed(NULL); + + GError *error = NULL; + + SmlDataSyncChangeItem *item = sml_data_sync_change_item_new(); + sml_fail_unless(item != NULL, NULL); + + const gchar* data = "1\r2"; + const gchar* result = "1\n2"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) == strlen(sml_data_sync_change_item_get_data(item)), "The length should not change during CR replacement."); + sml_fail_unless(!strcmp(result, sml_data_sync_change_item_get_data(item)), "CR must be replaced by LF."); + + data = "1\r2\r3\r4"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) == strlen(sml_data_sync_change_item_get_data(item)), "CRs must be replaced by LFs."); + + data = "1\r2\r3\r4\r"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) == strlen(sml_data_sync_change_item_get_data(item)), "CRs even at the end must be replaced by LFs."); + + data = "1\r2\r\r\r3\r4"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) == strlen(sml_data_sync_change_item_get_data(item)), "CRs must be replaced by LFs."); + + g_object_unref(item); +} +END_TEST + +START_TEST (change_item_data_fix_crlf) +{ + setup_testbed(NULL); + + GError *error = NULL; + + SmlDataSyncChangeItem *item = sml_data_sync_change_item_new(); + sml_fail_unless(item != NULL, NULL); + + const gchar* data = "1\r\n2"; + const gchar* result = "1\n2"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -1 == strlen(sml_data_sync_change_item_get_data(item)), "One CRLF must be replaced by LF (%d != %d).", strlen(data) -1, strlen(sml_data_sync_change_item_get_data(item))); + sml_fail_unless(!strcmp(result, sml_data_sync_change_item_get_data(item)), "CRLF must be replaced by LF."); + + data = "1\r\n2\r\n3\r\n4"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -3 == strlen(sml_data_sync_change_item_get_data(item)), "CRLFs must be replaced by LFs."); + + data = "1\r\n2\r\n3\r\n4\r\n"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -4 == strlen(sml_data_sync_change_item_get_data(item)), "CRLFs even at the end must be replaced by LFs."); + + data = "1\r\n2\r\n\r\n\r\n3\r\n4"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -5 == strlen(sml_data_sync_change_item_get_data(item)), "CRLFs must be replaced by LFs."); + + g_object_unref(item); +} +END_TEST + +START_TEST (change_item_data_fix_cr_and_crlf) +{ + setup_testbed(NULL); + + GError *error = NULL; + + SmlDataSyncChangeItem *item = sml_data_sync_change_item_new(); + sml_fail_unless(item != NULL, NULL); + + const gchar* data = "1\r2\r\n3\r\r\n4\r\n\r5"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -3 == strlen(sml_data_sync_change_item_get_data(item)), "CRLF must be replaced by LF."); + + data = "1\r\n\r"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -1 == strlen(sml_data_sync_change_item_get_data(item)), "CRLF must be replaced by LF."); + + data = "1\r\r\n"; + sml_fail_unless(sml_data_sync_change_item_set_data(item, data, 0, &error), "%s", error?error->message:"No GError set."); + sml_fail_unless(error == NULL, NULL); + sml_fail_unless(strlen(data) -1 == strlen(sml_data_sync_change_item_get_data(item)), "CRLF must be replaced by LF."); + + g_object_unref(item); +} +END_TEST + START_TEST (change_item_references) { setup_testbed(NULL); |
From: <svn...@op...> - 2009-10-18 10:23:42
|
Author: bellmich Date: Sun Oct 18 12:23:27 2009 New Revision: 1345 URL: http://libsyncml.opensync.org/changeset/1345 Log: better debugging for problems with space calculation Modified: trunk/libsyncml/sml_parse.c Modified: trunk/libsyncml/sml_parse.c ============================================================================== --- trunk/libsyncml/sml_parse.c Sat Oct 17 18:01:15 2009 (r1344) +++ trunk/libsyncml/sml_parse.c Sun Oct 18 12:23:27 2009 (r1345) @@ -645,8 +645,12 @@ */ if (smlCommandGetType(cmd) == SML_COMMAND_TYPE_ADD || smlCommandGetType(cmd) == SML_COMMAND_TYPE_REPLACE) - size -= strlen(sml_data_sync_change_item_get_data(smlCommandGetNthChange(cmd, 0))); - + { + gsize length = strlen(sml_data_sync_change_item_get_data(smlCommandGetNthChange(cmd, 0))); + smlTrace(TRACE_INTERNAL, "%s: item data size %d", __func__, length); + size -= length; + } + if (limit <= size) *space = 0; else @@ -721,11 +725,11 @@ goto error; if (size > limit) { - /* The status does not fit. Remove it again */ + /* The status/command does not fit. Remove it again */ if (!assm->functions.rem_cmd(assm->assm_userdata, parentID, error)) goto error; - smlTrace(TRACE_EXIT, "%s: Mismatch", __func__); + smlTrace(TRACE_EXIT, "%s: Mismatch => size (%d) > limit (%d)", __func__, size, limit); return SML_ASSEMBLER_RESULT_MISMATCH; } smlTrace(TRACE_INTERNAL, "%s: size %i, limit %i", __func__, size, limit); |
From: <svn...@op...> - 2009-10-18 02:41:02
|
Author: paule Date: Sun Oct 18 04:40:44 2009 New Revision: 5873 URL: http://www.opensync.org/changeset/5873 Log: opie-sync: add ActiveConnection to default config Modified: plugins/opie-sync/src/opie-sync Modified: plugins/opie-sync/src/opie-sync ============================================================================== --- plugins/opie-sync/src/opie-sync Fri Oct 16 23:06:15 2009 (r5872) +++ plugins/opie-sync/src/opie-sync Sun Oct 18 04:40:44 2009 (r5873) @@ -45,6 +45,7 @@ <Address>192.168.0.202</Address> <Port>4242</Port> </Network> + <ActiveConnection>Network</ActiveConnection> </Connection> <Resources> <Resource> |
From: <svn...@op...> - 2009-10-17 16:01:37
|
Author: bellmich Date: Sat Oct 17 18:01:15 2009 New Revision: 1344 URL: http://libsyncml.opensync.org/changeset/1344 Log: committed patch from Henrik ticket #248 I only removed one thing from the patch. The pthread header file must still be included from sml_support.c. Modified: trunk/CMakeLists.txt trunk/ChangeLog trunk/libsyncml/CMakeLists.txt trunk/libsyncml/objects/sml_devinf_obj.c trunk/libsyncml/sml_support.c trunk/libsyncml/sml_support.h trunk/libsyncml/sml_thread.c trunk/libsyncml/transports/obex_client.c trunk/tools/syncml-ds-tool.c Modified: trunk/CMakeLists.txt ============================================================================== --- trunk/CMakeLists.txt Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/CMakeLists.txt Sat Oct 17 18:01:15 2009 (r1344) @@ -196,6 +196,12 @@ SET( MEMORYCHECK_AVAILABLE OFF ) ENDIF(MEMORYCHECK_COMMAND) +IF(MINGW) + SET( WINSOCK_LIBRARIES "-lwsock32" ) +ELSE(MINGW) + SET( WINSOCK_LIBRARIES "" ) +ENDIF(MINGW) + OPTION( ENABLE_TOOLS "enable building tools" ON ) OPTION( ENABLE_TRACE "enable tracing" ON ) Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/ChangeLog Sat Oct 17 18:01:15 2009 (r1344) @@ -2,6 +2,8 @@ * server can handle now several sessions at once * transport cleanup is now much more robust * map fragmentation is supported + * Henrik Kaare Poulsen <he...@ka...> fixed several + MinGW/MS Windows portability issues (r1344). * Jim Radford <ra...@bl...> supplied some patches: * a fix for some hangs on 64 bit machines because of mixed data types (r1285) Modified: trunk/libsyncml/CMakeLists.txt ============================================================================== --- trunk/libsyncml/CMakeLists.txt Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/CMakeLists.txt Sat Oct 17 18:01:15 2009 (r1344) @@ -69,7 +69,7 @@ SET_TARGET_PROPERTIES( syncml PROPERTIES SOVERSION ${LIBSYNCML_LIBVERSION_SOVERSION} ) SET_TARGET_PROPERTIES( syncml PROPERTIES VERSION ${LIBSYNCML_LIBVERSION_VERSION} ) -TARGET_LINK_LIBRARIES( syncml ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${GOBJECT2_LIBRARIES} ${LIBXML2_LIBRARIES} ${BLUEZ_LIBRARIES} ${LIBWBXML2_LIBRARIES} ${LIBSOUP2_LIBRARIES} ${OPENOBEX_LIBRARIES} ) +TARGET_LINK_LIBRARIES( syncml ${WINSOCK_LIBRARIES} ${GLIB2_LIBRARIES} ${GTHREAD2_LIBRARIES} ${GOBJECT2_LIBRARIES} ${LIBXML2_LIBRARIES} ${BLUEZ_LIBRARIES} ${LIBWBXML2_LIBRARIES} ${LIBSOUP2_LIBRARIES} ${OPENOBEX_LIBRARIES} ) INSTALL( TARGETS syncml DESTINATION ${LIBSYNCML_LIBRARIES_DIR} ) Modified: trunk/libsyncml/objects/sml_devinf_obj.c ============================================================================== --- trunk/libsyncml/objects/sml_devinf_obj.c Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/objects/sml_devinf_obj.c Sat Oct 17 18:01:15 2009 (r1344) @@ -35,6 +35,10 @@ #ifdef WIN32 #include <windef.h> +#ifndef MSVC +// For MinGW +#include <winbase.h> +#endif #else #include<sys/utsname.h> #endif Modified: trunk/libsyncml/sml_support.c ============================================================================== --- trunk/libsyncml/sml_support.c Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/sml_support.c Sat Oct 17 18:01:15 2009 (r1344) @@ -31,6 +31,8 @@ #include <pthread.h> #endif +GPrivate* thread_id = NULL; + GPrivate* current_tabs = NULL; #define G_ERRORCHECK_MUTEXES Modified: trunk/libsyncml/sml_support.h ============================================================================== --- trunk/libsyncml/sml_support.h Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/sml_support.h Sat Oct 17 18:01:15 2009 (r1344) @@ -26,6 +26,8 @@ #include <stdio.h> #include <stdlib.h> +extern GPrivate* thread_id; + /*! @ingroup SmlDebugAPI * @brief The type of the trace */ typedef enum { Modified: trunk/libsyncml/sml_thread.c ============================================================================== --- trunk/libsyncml/sml_thread.c Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/sml_thread.c Sat Oct 17 18:01:15 2009 (r1344) @@ -24,7 +24,7 @@ #include "sml_support.h" #include "sml_error_internals.h" -GPrivate* thread_id = NULL; + #define G_ERRORCHECK_MUTEXES Modified: trunk/libsyncml/transports/obex_client.c ============================================================================== --- trunk/libsyncml/transports/obex_client.c Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/libsyncml/transports/obex_client.c Sat Oct 17 18:01:15 2009 (r1344) @@ -867,7 +867,7 @@ struct sockaddr_in addr; memset(&addr, 0, sizeof(addr)); addr.sin_family = AF_INET; - addr.sin_port = htons(env->port); + addr.sin_port = g_htons(env->port); struct hostent *hostinfo = gethostbyname (env->path); if (!hostinfo) { Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Sat Oct 17 17:29:25 2009 (r1343) +++ trunk/tools/syncml-ds-tool.c Sat Oct 17 18:01:15 2009 (r1344) @@ -382,9 +382,11 @@ printf("OBEX_Init failed\n"); return; } - + +#ifndef WIN32 if (geteuid() != 0) fprintf(stderr, "Superuser privileges are required to access complete USB information.\n"); +#endif interfaces_number = OBEX_FindInterfaces(handle, &obex_intf); printf("Found %d USB OBEX interfaces\n", interfaces_number); |
From: <svn...@op...> - 2009-10-17 15:29:48
|
Author: bellmich Date: Sat Oct 17 17:29:25 2009 New Revision: 1343 URL: http://libsyncml.opensync.org/changeset/1343 Log: A delete is a delete is a delete. Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 18:26:49 2009 (r1342) +++ trunk/tools/syncml-ds-tool.c Sat Oct 17 17:29:25 2009 (r1343) @@ -1478,72 +1478,30 @@ } } } else { - /* The item was locally deleted. */ - if (index_digest && strcmp(index_digest, item_digest) == 0) - { - /* The change was locally known - * but the item is away. - */ - printf("\tThe item was already locally deleted.\n"); - g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); - } else { - /* The item was locally different - * but it was already deleted. - * This is a classical conflict. - */ - if (localWinsConflicts) - { - printf("\tConflict: Remote replace command is ignored.\n"); - printf("\tConflict: Local deletion wins conflict.\n"); - g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); - } else { - printf("\tConflict: Local deletion is ignored.\n"); - printf("\tConflict: Remote replace command wins conflict.\n"); - doWrite = TRUE; - SmlMapItem *map = sml_map_item_new(); - if (!sml_map_item_set_remote(map, uid, error)) - goto error; - SmlLocation *local = sml_location_new(); - sml_location_set_uri(local, safeUID); - if (!sml_map_item_set_local(map, local, error)) - goto error; - if (!sml_data_sync_data_store_session_add_mapping(session, map, NULL, error)) - goto error; - g_object_unref(map); - g_object_unref(local); - g_key_file_set_string(datastore->index, "map", safeUID, orgUID); - g_key_file_set_string(datastore->index, "reverse_map", orgUID, safeUID); - } - } + /* The item was locally deleted. + * If you need to restore it + * then you must add it again. + * A normal synchronization is no backup. + * You can only restore it if you do a slow sync. + * So the change will be committed but not executed. + */ + printf("\tThe item was already locally deleted.\n"); } break; case SML_CHANGE_DELETE: if (g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) { - if (strcmp(file_digest, index_digest) == 0) - { - /* All local changes are synchronized. - * So the deletion can be executed. - */ - printf("\tThe item will be deleted.\n"); - doWrite = TRUE; - } else { - /* The item is not synchronized - * but the item should be deleted. - * This is a classical conflict. - */ - if (localWinsConflicts) - { - printf("\tConflict: Remote delete command is ignored.\n"); - printf("\tConflict: Local changed item wins conflict.\n"); - } else { - printf("\tConflict: Local changed item is ignored.\n"); - printf("\tConflict: Remote delete command wins conflict.\n"); - doWrite = TRUE; - } - } + /* The item was deleted on the remote device. + * If you need to restore it + * then you must add it again. + * A normal synchronization is no backup. + * You can only restore it if you do a slow sync. + * So the change will be executed. + */ + printf("\tThe item will be deleted.\n"); + doWrite = TRUE; } else { - /* The item was locally deleted. */ + /* The item was already locally deleted. */ printf("\tThe item was already locally deleted.\n"); g_key_file_remove_key(datastore->index, "last_index", safeUID, NULL); } |
From: <svn...@op...> - 2009-10-16 21:06:29
|
Author: cdfrey Date: Fri Oct 16 23:06:15 2009 New Revision: 5872 URL: http://www.opensync.org/changeset/5872 Log: Fixed bug where member_id is not updated when new member is added This patch sets the member_id in osync_group_add_member() in the same place that the configdir is set, since that's when osync_group_create_member_id() is called. With this fix, it is possible to add a member to a group, and then immediately list it, without reloading from disk. Modified: trunk/opensync/group/opensync_group.c Modified: trunk/opensync/group/opensync_group.c ============================================================================== --- trunk/opensync/group/opensync_group.c Fri Oct 16 17:18:15 2009 (r5871) +++ trunk/opensync/group/opensync_group.c Fri Oct 16 23:06:15 2009 (r5872) @@ -777,7 +777,8 @@ osync_assert(group); if (!osync_member_get_configdir(member)) { - char *configdir = osync_strdup_printf("%s%c%lli", group->configdir, G_DIR_SEPARATOR, osync_group_create_member_id(group)); + member->id = osync_group_create_member_id(group); + char *configdir = osync_strdup_printf("%s%c%lli", group->configdir, G_DIR_SEPARATOR, member->id); osync_member_set_configdir(member, configdir); osync_free(configdir); } |
From: <svn...@op...> - 2009-10-16 16:27:38
|
Author: bellmich Date: Fri Oct 16 18:26:49 2009 New Revision: 1342 URL: http://libsyncml.opensync.org/changeset/1342 Log: Problem: unclean glib API change Function: g_key_file_remove_key Bug: The return type was changed from void to gboolean. Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 17:55:07 2009 (r1341) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 18:26:49 2009 (r1342) @@ -961,7 +961,9 @@ char *digest = g_key_file_get_string(datastore->index, "committed_index", keys[pos], &error); if (!digest && error) goto error; - if (!g_key_file_remove_key(datastore->index, "committed_index", keys[pos], &error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "committed_index", keys[pos], &error); + if (error) goto error; g_key_file_set_string(datastore->index, "last_index", keys[pos], digest); smlSafeCFree(&digest); @@ -1058,12 +1060,16 @@ printf("\tItem %s was locally changed.\n", filename); changeType = SML_CHANGE_REPLACE; g_key_file_set_string(datastore->index, "change_index", filename, digest); - if (!g_key_file_remove_key(datastore->index, "last_index", filename, error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "last_index", filename, error); + if (*error) goto error; } else { /* nothing to do */ g_key_file_set_string(datastore->index, "committed_index", filename, digest); - if (!g_key_file_remove_key(datastore->index, "last_index", filename, error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "last_index", filename, error); + if (*error) goto error; continue; } @@ -1123,7 +1129,9 @@ if (!digest && *error) goto error; g_key_file_set_string(datastore->index, "change_index", keys[i], digest); - if (!g_key_file_remove_key(datastore->index, "last_index", keys[i], error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "last_index", keys[i], error); + if (*error) goto error; /* add change */ @@ -1568,7 +1576,9 @@ absolute_uid); goto error; } - if (!g_key_file_remove_key(datastore->index, "last_index", safeUID, error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "last_index", safeUID, error); + if (*error) goto error; printf("\tThe item was successfully deleted.\n"); break; @@ -1671,7 +1681,9 @@ if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_DELETE) g_key_file_set_string(datastore->index, "committed_index", key, digest); - if (!g_key_file_remove_key(datastore->index, "change_index", key, error)) + /* NOTICE: glib changed the return type of g_key_file_remove_key */ + g_key_file_remove_key(datastore->index, "change_index", key, error); + if (*error) goto error; smlTrace(TRACE_EXIT, "%s - TRUE", __func__); |
From: <svn...@op...> - 2009-10-16 15:55:28
|
Author: bellmich Date: Fri Oct 16 17:55:07 2009 New Revision: 1341 URL: http://libsyncml.opensync.org/changeset/1341 Log: fixed missing glib checksum support for old platforms Modified: trunk/tools/syncml-ds-tool.c trunk/tools/syncml-ds-tool_internals.c trunk/tools/syncml-ds-tool_internals.h Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 17:44:28 2009 (r1340) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 17:55:07 2009 (r1341) @@ -1038,7 +1038,13 @@ smlSafeCFree(&absolute); /* calculate and load checksum */ +#ifdef HAVE_GLIB_GCHECKSUM_H char *digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) data, length); +#else + char *digest = sml_ds_tool_get_md5 (data, length, error); + if (!digest) + goto error; +#endif char *original = g_key_file_get_string(datastore->index, "last_index", filename, NULL); /* fix indexes */ @@ -1291,7 +1297,15 @@ index_digest = g_key_file_get_string(datastore->index, "last_index", safeUID, NULL); const char *data = sml_data_sync_change_item_get_data(item); if (data) + { +#ifdef HAVE_GLIB_GCHECKSUM_H item_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) data, strlen(data)); +#else + item_digest = sml_ds_tool_get_md5 (data, strlen(data), error); + if (!item_digest) + goto error; +#endif + } if (g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) { char *file_data = NULL; Modified: trunk/tools/syncml-ds-tool_internals.c ============================================================================== --- trunk/tools/syncml-ds-tool_internals.c Fri Oct 16 17:44:28 2009 (r1340) +++ trunk/tools/syncml-ds-tool_internals.c Fri Oct 16 17:55:07 2009 (r1341) @@ -25,7 +25,7 @@ #include <libsyncml/sml_md5.h> gchar* -sml_ds_tool_get_md5 (gchar *data, +sml_ds_tool_get_md5 (const gchar *data, gsize length, GError **error) { Modified: trunk/tools/syncml-ds-tool_internals.h ============================================================================== --- trunk/tools/syncml-ds-tool_internals.h Fri Oct 16 17:44:28 2009 (r1340) +++ trunk/tools/syncml-ds-tool_internals.h Fri Oct 16 17:55:07 2009 (r1341) @@ -40,7 +40,7 @@ #ifndef HAVE_GLIB_GCHECKSUM_H -gchar* sml_ds_tool_get_md5 (gchar *data, gsize length, GError **error); +gchar* sml_ds_tool_get_md5 (const gchar *data, gsize length, GError **error); #endif |
From: <svn...@op...> - 2009-10-16 15:44:52
|
Author: bellmich Date: Fri Oct 16 17:44:28 2009 New Revision: 1340 URL: http://libsyncml.opensync.org/changeset/1340 Log: try to fix problem with glib checksum support Modified: trunk/config.h.cmake trunk/tools/syncml-ds-tool.c trunk/tools/syncml-ds-tool_internals.c trunk/tools/syncml-ds-tool_internals.h Modified: trunk/config.h.cmake ============================================================================== --- trunk/config.h.cmake Fri Oct 16 17:09:09 2009 (r1339) +++ trunk/config.h.cmake Fri Oct 16 17:44:28 2009 (r1340) @@ -95,3 +95,7 @@ /* wbxml */ /* #undef WBXML_LIBS */ + +/* glib checksum support */ +#cmakedefine HAVE_GLIB_GCHECKSUM_H + Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 17:09:09 2009 (r1339) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 17:44:28 2009 (r1340) @@ -1298,7 +1298,13 @@ gsize file_length = 0; if (!g_file_get_contents(absolute_uid, &file_data, &file_length, error)) goto error; +#ifdef HAVE_GLIB_GCHECKSUM_H file_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) file_data, file_length); +#else + file_digest = sml_ds_tool_get_md5 (file_data, file_length, error); + if (!file_digest) + goto error; +#endif smlSafeCFree(&file_data); } Modified: trunk/tools/syncml-ds-tool_internals.c ============================================================================== --- trunk/tools/syncml-ds-tool_internals.c Fri Oct 16 17:09:09 2009 (r1339) +++ trunk/tools/syncml-ds-tool_internals.c Fri Oct 16 17:44:28 2009 (r1340) @@ -20,3 +20,18 @@ #include <libsyncml/sml_support.h> #include <libsyncml/sml_error_internals.h> + +#ifndef HAVE_GLIB_GCHECKSUM_H + +#include <libsyncml/sml_md5.h> +gchar* +sml_ds_tool_get_md5 (gchar *data, + gsize length, + GError **error) +{ + guchar md5[16]; + smlMD5GetDigest (data, length, md5); + return smlMD5ToString(md5, error); +} + +#endif Modified: trunk/tools/syncml-ds-tool_internals.h ============================================================================== --- trunk/tools/syncml-ds-tool_internals.h Fri Oct 16 17:09:09 2009 (r1339) +++ trunk/tools/syncml-ds-tool_internals.h Fri Oct 16 17:44:28 2009 (r1340) @@ -38,3 +38,9 @@ */ #define VA_STRING(param) param?param:"NULL" +#ifndef HAVE_GLIB_GCHECKSUM_H + +gchar* sml_ds_tool_get_md5 (gchar *data, gsize length, GError **error); + +#endif + |
From: <svn...@op...> - 2009-10-16 15:18:31
|
Author: bellmich Date: Fri Oct 16 17:18:15 2009 New Revision: 5871 URL: http://www.opensync.org/changeset/5871 Log: added detection of glib checksum support Modified: branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Modified: branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake ============================================================================== --- branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Tue Oct 13 21:35:20 2009 (r5870) +++ branches/3rd-party-cmake-modules/modules/FindGLIB2.cmake Fri Oct 16 17:18:15 2009 (r5871) @@ -229,6 +229,7 @@ INCLUDE( CheckIncludeFiles ) SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) + CHECK_INCLUDE_FILES ( glib/gchecksum.h HAVE_GLIB_GCHECKSUM_H ) # Reset CMAKE_REQUIRED_INCLUDES SET( CMAKE_REQUIRED_INCLUDES "" ) ENDIF( GLIB2_FOUND ) |
From: <svn...@op...> - 2009-10-16 15:09:25
|
Author: bellmich Date: Fri Oct 16 17:09:09 2009 New Revision: 1339 URL: http://libsyncml.opensync.org/changeset/1339 Log: fixed some warnings Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 16:49:30 2009 (r1338) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 17:09:09 2009 (r1339) @@ -954,7 +954,6 @@ goto error; /* migrate all entries from committed_index to last_index */ - gsize count = 0; char **keys = g_key_file_get_keys(datastore->index, "committed_index", NULL, NULL); int pos = 0; while (keys[pos] != NULL) @@ -1039,7 +1038,7 @@ smlSafeCFree(&absolute); /* calculate and load checksum */ - char *digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, data, length); + char *digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) data, length); char *original = g_key_file_get_string(datastore->index, "last_index", filename, NULL); /* fix indexes */ @@ -1292,14 +1291,14 @@ index_digest = g_key_file_get_string(datastore->index, "last_index", safeUID, NULL); const char *data = sml_data_sync_change_item_get_data(item); if (data) - item_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, data, strlen(data)); + item_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) data, strlen(data)); if (g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) { char *file_data = NULL; gsize file_length = 0; if (!g_file_get_contents(absolute_uid, &file_data, &file_length, error)) goto error; - file_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, file_data, file_length); + file_digest = g_compute_checksum_for_data(G_CHECKSUM_SHA256, (guchar *) file_data, file_length); smlSafeCFree(&file_data); } |
From: <svn...@op...> - 2009-10-16 14:49:45
|
Author: bellmich Date: Fri Oct 16 16:49:30 2009 New Revision: 1338 URL: http://libsyncml.opensync.org/changeset/1338 Log: added mapping support for locally deleted items Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 16:42:38 2009 (r1337) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 16:49:30 2009 (r1338) @@ -1077,7 +1077,7 @@ sml_data_sync_change_item_set_action(item, changeType); SmlLocation *uid = sml_location_new(); - if (changeType == SML_CHANGE_REPLACE) + if (changeType != SML_CHANGE_ADD) { const gchar *map = g_key_file_get_string(datastore->index, "map", filename, error); if (!map) @@ -1127,7 +1127,10 @@ sml_data_sync_change_item_set_action(item, SML_CHANGE_DELETE); SmlLocation *uid = sml_location_new(); - sml_location_set_uri(uid, keys[i]); + const gchar *map = g_key_file_get_string(datastore->index, "map", keys[i], error); + if (!map) + goto error; + sml_location_set_uri(uid, map); if (!sml_data_sync_change_item_set_location(item, uid, error)) goto error; |
From: <svn...@op...> - 2009-10-16 14:42:53
|
Author: bellmich Date: Fri Oct 16 16:42:38 2009 New Revision: 1337 URL: http://libsyncml.opensync.org/changeset/1337 Log: added mapping support for sent and received replace commands Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 16:17:08 2009 (r1336) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 16:42:38 2009 (r1337) @@ -407,7 +407,7 @@ static gboolean smlDsToolRecvChangeStatusCallback (SmlDataSyncDataStoreSession *self, SmlDataSyncChangeItem *item, SmlErrorType code, void *userdata, GError **error); static gboolean smlDsToolRecvMappingCallback (SmlDataSyncDataStoreSession *self, SmlMapItem *item, void *userdata, GError **error); static gchar* smlDsToolGetAnchorCallback (SmlDataSyncDataStoreSession *self, gboolean remote, void *userdata, GError **error); -static gboolean smlDsToolSetAnchorCallback (SmlDataSyncDataStoreSession *self, gboolean remote, const gchar* anchor, void *userdata, GError **error); +static gboolean smlDsToolSetAnchorCallback (SmlDataSyncDataStoreSession *self, gboolean remote, const gchar *anchor, void *userdata, GError **error); SmlTransportType getTransportType(int argc, char *argv[]) { @@ -1077,7 +1077,15 @@ sml_data_sync_change_item_set_action(item, changeType); SmlLocation *uid = sml_location_new(); - sml_location_set_uri(uid, filename); + if (changeType == SML_CHANGE_REPLACE) + { + const gchar *map = g_key_file_get_string(datastore->index, "map", filename, error); + if (!map) + goto error; + sml_location_set_uri(uid, map); + } else { + sml_location_set_uri(uid, filename); + } if (!sml_data_sync_change_item_set_location(item, uid, error)) goto error; if (!sml_data_sync_change_item_set_data(item, data, length, error)) @@ -1247,6 +1255,18 @@ const char *orgUID = sml_location_get_uri(uid); char *safeUID = getSafeFilename(orgUID); printf("Writing item %s to directory %s.\n", safeUID, datastore->directory); + + /* map the item if necessary */ + if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_ADD) + { + const char *map = g_key_file_get_string(datastore->index, "reverse_map", safeUID, error); + if (!map) + goto error; + smlSafeCFree(&safeUID); + safeUID = g_strdup(map); + printf("\tMap item to %s.\n", safeUID); + } + absolute_uid = g_strdup_printf("%s/%s", datastore->directory, safeUID); /* sanity check for uid */ if (!strncmp(safeUID, STATUS_FILENAME, strlen(STATUS_FILENAME))) @@ -1621,6 +1641,8 @@ SmlLocation *loc = sml_data_sync_change_item_get_location(item); const char *key = sml_location_get_uri(loc); + if (sml_data_sync_change_item_get_action(item) != SML_CHANGE_ADD) + key = g_key_file_get_string(datastore->index, "reverse_map", key, error); const char *digest = g_key_file_get_string(datastore->index, "change_index", key, error); if (!digest && *error) goto error; |
From: <svn...@op...> - 2009-10-16 14:17:23
|
Author: bellmich Date: Fri Oct 16 16:17:08 2009 New Revision: 1336 URL: http://libsyncml.opensync.org/changeset/1336 Log: added support for mapped new items Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 16:02:38 2009 (r1335) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 16:17:08 2009 (r1336) @@ -405,6 +405,7 @@ static SmlAlertType smlDsToolRecvAlertTypeCallback (SmlDataSyncDataStoreSession *self, SmlAlertType type, void *userdata, GError **error); static gboolean smlDsToolRecvChangeCallback (SmlDataSyncDataStoreSession *self, SmlDataSyncChangeItem *item, void *userdata, GError **error); static gboolean smlDsToolRecvChangeStatusCallback (SmlDataSyncDataStoreSession *self, SmlDataSyncChangeItem *item, SmlErrorType code, void *userdata, GError **error); +static gboolean smlDsToolRecvMappingCallback (SmlDataSyncDataStoreSession *self, SmlMapItem *item, void *userdata, GError **error); static gchar* smlDsToolGetAnchorCallback (SmlDataSyncDataStoreSession *self, gboolean remote, void *userdata, GError **error); static gboolean smlDsToolSetAnchorCallback (SmlDataSyncDataStoreSession *self, gboolean remote, const gchar* anchor, void *userdata, GError **error); @@ -477,6 +478,7 @@ sml_data_sync_data_store_register_get_alert_type_callback(datastore->object, smlDsToolRecvAlertTypeCallback, datastore); sml_data_sync_data_store_register_change_callback(datastore->object, smlDsToolRecvChangeCallback, datastore); sml_data_sync_data_store_register_change_status_callback(datastore->object, smlDsToolRecvChangeStatusCallback, datastore); + sml_data_sync_data_store_register_mapping_callback(datastore->object, smlDsToolRecvMappingCallback, datastore); /* sync type */ @@ -1559,6 +1561,38 @@ smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, (*error)->message); return FALSE; } + +static gboolean +smlDsToolRecvMappingCallback (SmlDataSyncDataStoreSession *session, + SmlMapItem *item, + void *userdata, + GError **error) +{ + smlTrace(TRACE_ENTRY, "%s(%p, %p, %p, %p)", __func__, session, item, userdata, error); + + /* find the appropriate datasoure */ + SmlDsToolLocationType *datastore = userdata; + if (!datastore) + { + g_set_error(error, TOOL_ERROR, SML_ERROR_GENERIC, + "The userdata of the callback %s is missing.", __func__); + goto error; + } + + /* handle the item */ + if (datastore->index) { + const gchar *local = sml_map_item_get_local_uri(item); + const gchar *remote = sml_map_item_get_remote_uri(item); + g_key_file_set_string(datastore->index, "map", local, remote); + g_key_file_set_string(datastore->index, "reverse_map", remote, local); + } + + smlTrace(TRACE_EXIT, "%s - TRUE", __func__); + return TRUE; +error: + smlTrace(TRACE_EXIT_ERROR, "%s - %s", __func__, (*error)->message); + return FALSE; +} static gboolean smlDsToolRecvChangeStatusCallback (SmlDataSyncDataStoreSession *session, |
From: <svn...@op...> - 2009-10-16 14:02:50
|
Author: bellmich Date: Fri Oct 16 16:02:38 2009 New Revision: 1335 URL: http://libsyncml.opensync.org/changeset/1335 Log: detect a normal change correctly Modified: trunk/tools/syncml-ds-tool.c Modified: trunk/tools/syncml-ds-tool.c ============================================================================== --- trunk/tools/syncml-ds-tool.c Fri Oct 16 15:48:26 2009 (r1334) +++ trunk/tools/syncml-ds-tool.c Fri Oct 16 16:02:38 2009 (r1335) @@ -1394,7 +1394,15 @@ case SML_CHANGE_REPLACE: if (g_file_test(absolute_uid, G_FILE_TEST_EXISTS)) { - if (strcmp(file_digest, item_digest) == 0) + if (strcmp(file_digest, index_digest) == 0) + { + /* There is no local change. + * The local item is in sync. + * So the remote change should be accepted. + */ + printf("\tThe local item will be changed.\n"); + doWrite = TRUE; + } else if (strcmp(file_digest, item_digest) == 0) { /* nothing to do - items identical */ printf("\tIdentical items detected.\n"); |