From: <svn...@op...> - 2009-09-14 17:50:10
|
Author: bellmich Date: Mon Sep 14 19:49:51 2009 New Revision: 1273 URL: http://libsyncml.opensync.org/changeset/1273 Log: - added get_local (sometimes necessary for sessions) - added get_remote (sometimes necessary for sessions) - enforce the source in case of an OMA client Modified: trunk/libsyncml/data_sync_api/sml_data_sync.c trunk/libsyncml/data_sync_api/sml_data_sync.h Modified: trunk/libsyncml/data_sync_api/sml_data_sync.c ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync.c Mon Sep 14 19:47:55 2009 (r1272) +++ trunk/libsyncml/data_sync_api/sml_data_sync.c Mon Sep 14 19:49:51 2009 (r1273) @@ -548,6 +548,18 @@ return TRUE; } +SmlLocation* +sml_data_sync_get_local (SmlDataSync *self) +{ + return self->priv->local; +} + +SmlLocation* +sml_data_sync_get_remote (SmlDataSync *self) +{ + return self->priv->remote; +} + /** * sml_data_sync_get_data_store_from_local_uri: * @self: A #SmlDataSync @@ -563,12 +575,14 @@ sml_return_val_error_if_fail (SML_IS_DATA_SYNC (self), FALSE, error, SML_ERROR_GENERIC, "There must be a SmlDataSync object."); sml_return_val_error_if_fail (local != NULL, FALSE, error, SML_ERROR_GENERIC, "There must be a local URI."); sml_return_val_error_if_fail (strlen(local) > 0, FALSE, error, SML_ERROR_GENERIC, "The local URI cannot be the empty word."); + smlTrace(TRACE_INTERNAL, "%s: searching %s", __func__, local); GList *o = self->priv->data_stores; for (; o; o = o->next) { SmlDataSyncDataStore *datastore = o->data; SmlLocation *loc = sml_data_sync_data_store_get_local(datastore); - if (!strcmp(sml_location_get_uri(loc), local)) + smlTrace(TRACE_INTERNAL, "%s: checking %s", __func__, sml_location_get_full_uri(loc)); + if (!strcmp(sml_location_get_full_uri(loc), local)) return datastore; } @@ -783,6 +797,11 @@ smlSessionUseOnlyReplace(session, self->priv->only_replace); smlSessionUseNumberOfChanges(session, self->priv->use_number_of_changes); + /* enforce own source after a SAN was received */ + /* clients are generally stupid and enforce their stuff */ + if (self->priv->session_type == SML_SESSION_TYPE_CLIENT) + smlSessionSetSource(session, self->priv->local); + /* authentication management for OMA DS clients*/ if (self->priv->session_type == SML_SESSION_TYPE_CLIENT && (self->priv->username || self->priv->password)) Modified: trunk/libsyncml/data_sync_api/sml_data_sync.h ============================================================================== --- trunk/libsyncml/data_sync_api/sml_data_sync.h Mon Sep 14 19:47:55 2009 (r1272) +++ trunk/libsyncml/data_sync_api/sml_data_sync.h Mon Sep 14 19:49:51 2009 (r1273) @@ -76,6 +76,8 @@ gboolean sml_data_sync_initialize (SmlDataSync *self, GError **error); gboolean sml_data_sync_run (SmlDataSync *self, GError **error); gboolean sml_data_sync_add_data_store (SmlDataSync *self, SmlDataSyncDataStore *ds, GError **error); +SmlLocation* sml_data_sync_get_local (SmlDataSync *self); +SmlLocation* sml_data_sync_get_remote (SmlDataSync *self); typedef void (* SmlDataSyncSessionEventCallback) (SmlDataSyncSession *self, SmlDataSync *data_sync, SmlDataSyncEventType type, void *userdata, const GError *error); typedef gboolean (* SmlDataSyncSessionWriteDevInfCallback) (SmlDataSyncSession *self, SmlDevInf *devinf, void *userdata, GError **error); |