From d4010212c446b0892b62aae5418611f8fe889b94 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Tue, 3 Dec 2013 17:39:09 +0200 Subject: [PATCH] ucs: fix Persona key extraction Based on the log provided in the following discussion thread https://sourceforge.net/p/sipe/discussion/688534/thread/db025884/ it turned out that the text for Attribution/DisplayName is localized, i.e. the text "Lync Contacts" gets translated to the local language. Switch over to check IsQuickContact == true and IsHidden == false, which seems to be another indication that the Attribution node contains the key for the Lync Contact. It's still a guessing game :-( (cherry picked from commit 8763852bb5aa9709bbe6f93b9088f8d607e061b8) --- src/core/sipe-ucs.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/core/sipe-ucs.c b/src/core/sipe-ucs.c index c4d1df60..faacd729 100644 --- a/src/core/sipe-ucs.c +++ b/src/core/sipe-ucs.c @@ -308,23 +308,35 @@ static void ucs_extract_keys(const sipe_xml *persona_node, { const sipe_xml *attr_node; - /* extract Exchange key - not sure if this is correct */ + /* + * extract Exchange key - play the guessing game :-( + * + * We can't use the "DisplayName" node, because the text is localized. + * + * Assume that IsQuickContact == "true" and IsHidden == "false" means + * this Attribution node contains the information for the Lync contact. + */ for (attr_node = sipe_xml_child(persona_node, "Attributions/Attribution"); attr_node; attr_node = sipe_xml_twin(attr_node)) { const sipe_xml *id_node = sipe_xml_child(attr_node, "SourceId"); - gchar *type = sipe_xml_data(sipe_xml_child(attr_node, - "DisplayName")); + gchar *hidden = sipe_xml_data(sipe_xml_child(attr_node, + "IsHidden")); + gchar *quick = sipe_xml_data(sipe_xml_child(attr_node, + "IsQuickContact")); if (id_node && - sipe_strequal(type, "Lync Contacts")) { + sipe_strcase_equal(hidden, "false") && + sipe_strcase_equal(quick, "true")) { *key = sipe_xml_attribute(id_node, "Id"); *change = sipe_xml_attribute(id_node, "ChangeKey"); - g_free(type); + g_free(quick); + g_free(hidden); break; } - g_free(type); + g_free(quick); + g_free(hidden); } } -- 2.11.4.GIT