From 1396a8100af580d83c9a29e0fc0dbbd74b1fe15f Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Fri, 9 Aug 2013 14:23:04 +0300 Subject: [PATCH] notify: ignore contact list when migrated to UCS This partially reverts commit 0f5cb722461ea9a3f3050ddbec959acd3dc05aed. --- src/core/sip-soap.c | 2 +- src/core/sipe-notify.c | 19 ++++++++----------- src/core/sipe-ucs.c | 3 +-- src/core/sipe-ucs.h | 12 +++++++++--- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/core/sip-soap.c b/src/core/sip-soap.c index 2f576813..eefd17a7 100644 --- a/src/core/sip-soap.c +++ b/src/core/sip-soap.c @@ -51,7 +51,7 @@ void sip_soap_raw_request_cb(struct sipe_core_private *sipe_private, * * contact list has been migrated to UCS -> SOAP requests will fail */ - if (sipe_ucs_migrated(sipe_private)) { + if (sipe_ucs_is_migrated(sipe_private)) { if (callback) { struct transaction trans; trans.payload = payload; diff --git a/src/core/sipe-notify.c b/src/core/sipe-notify.c index 9bd364ee..d70c322b 100644 --- a/src/core/sipe-notify.c +++ b/src/core/sipe-notify.c @@ -1288,7 +1288,7 @@ static gboolean sipe_process_roaming_contacts(struct sipe_core_private *sipe_pri * * - Lync 2013 with buddy list migrated to Unified Contact Store (UCS) * * Notify piggy-backed on SUBSCRIBE response with empty list - * * NOTIFY send by server with standard list + * * NOTIFY send by server with standard list (ignored by us) */ if (sipe_strequal(sipe_xml_name(isc), "contactList")) { const gchar *ucsmode = sipe_xml_attribute(isc, "ucsmode"); @@ -1305,16 +1305,12 @@ static gboolean sipe_process_roaming_contacts(struct sipe_core_private *sipe_pri sipe_ucs_init(sipe_private, migrated); } - group_node = sipe_xml_child(isc, "group"); - item = sipe_xml_child(isc, "contact"); - - if (!SIPE_CORE_PRIVATE_FLAG_IS(OCS2007) || group_node || item) { - + if (!sipe_ucs_is_migrated(sipe_private)) { /* Start processing contact list */ sipe_backend_buddy_list_processing_start(SIPE_CORE_PUBLIC); /* Parse groups */ - for (; group_node; group_node = sipe_xml_twin(group_node)) + for (group_node = sipe_xml_child(isc, "group"); group_node; group_node = sipe_xml_twin(group_node)) add_new_group(sipe_private, group_node); /* Make sure we have at least one group */ @@ -1323,7 +1319,7 @@ static gboolean sipe_process_roaming_contacts(struct sipe_core_private *sipe_pri } /* Parse contacts */ - for (; item; item = sipe_xml_twin(item)) { + for (item = sipe_xml_child(isc, "contact"); item; item = sipe_xml_twin(item)) { const gchar *name = sipe_xml_attribute(item, "uri"); gchar *uri = sip_uri_from_name(name); add_new_buddy(sipe_private, item, uri, name); @@ -1520,11 +1516,12 @@ static gboolean sipe_process_roaming_contacts(struct sipe_core_private *sipe_pri sipe_xml_free(isc); /* - * Subscribe to buddies (if any), but only do it once. + * Subscribe to buddies (if not migrated to UCS), but only do it once. * We'll resubsribe to them based on the Expire field values. */ - if (!SIPE_CORE_PRIVATE_FLAG_IS(SUBSCRIBED_BUDDIES) && - g_hash_table_size(sipe_private->buddies)) { + if (!(SIPE_CORE_PRIVATE_FLAG_IS(SUBSCRIBED_BUDDIES) || + sipe_ucs_is_migrated(sipe_private))) { + /* do it once, then count Expire field to schedule resubscribe */ if (SIPE_CORE_PRIVATE_FLAG_IS(BATCHED_SUPPORT)) { sipe_subscribe_presence_batched(sipe_private); } else { diff --git a/src/core/sipe-ucs.c b/src/core/sipe-ucs.c index 7f9d1e38..6c5cf0fd 100644 --- a/src/core/sipe-ucs.c +++ b/src/core/sipe-ucs.c @@ -299,8 +299,7 @@ static void ucs_ews_autodiscover_cb(struct sipe_core_private *sipe_private, } } -/* TEMPORARY HACK: DO NOT USE! */ -gboolean sipe_ucs_migrated(struct sipe_core_private *sipe_private) +gboolean sipe_ucs_is_migrated(struct sipe_core_private *sipe_private) { return(sipe_private->ucs ? sipe_private->ucs->migrated : FALSE); } diff --git a/src/core/sipe-ucs.h b/src/core/sipe-ucs.h index 20365c85..12c6e2b2 100644 --- a/src/core/sipe-ucs.h +++ b/src/core/sipe-ucs.h @@ -34,6 +34,15 @@ void sipe_ucs_get_photo(struct sipe_core_private *sipe_private, const gchar *uri); /** + * Has contact list been migrated to UCS? + * + * @param sipe_private SIPE core private data + * + * @return @c TRUE if contact list has been migrated + */ +gboolean sipe_ucs_is_migrated(struct sipe_core_private *sipe_private); + +/** * Initialize UCS * * @param sipe_private SIPE core private data @@ -42,9 +51,6 @@ void sipe_ucs_get_photo(struct sipe_core_private *sipe_private, void sipe_ucs_init(struct sipe_core_private *sipe_private, gboolean migrated); -/* TEMPORARY HACK: DO NOT USE! */ -gboolean sipe_ucs_migrated(struct sipe_core_private *sipe_private); - /** * Free UCS data * -- 2.11.4.GIT