From 1e8414f75c54b36988d3dfedbc08bd8f907c6d16 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sun, 12 May 2013 19:32:05 +0300 Subject: [PATCH] Fix #193: Pidgin Status changes stop working When we subscribe to a new user with batched subscription then the response will only contain that user. In order not to loose the information about all the other subscribed users we now merge the old and the new buddies list in the subscription data structure. TODO; check if this works correctly also when we remove a buddy. --- ChangeLog | 1 + src/core/sipe-subscriptions.c | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 40178f10..5ca9c6fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ version 1.16.0 "HTTP Rewrite" (2013-XX-XX) - Feature #58: Implement Digest authentication scheme for SIP Proxy Authentication (Stefan Becker) + - Fixed #193: Pidgin Status changes stop working (Stefan Becker) - Fixed #186: Users appear offline when they are not (Stefan Becker) - rewritten HTTP stack from scratch (Stefan Becker) * cleaner, layered and hopefully less error-prone implementation diff --git a/src/core/sipe-subscriptions.c b/src/core/sipe-subscriptions.c index 9c34954f..edf15d7e 100644 --- a/src/core/sipe-subscriptions.c +++ b/src/core/sipe-subscriptions.c @@ -661,12 +661,24 @@ static void sipe_subscribe_presence_batched_schedule(struct sipe_core_private *s action_name); struct presence_batched_routed *payload = g_malloc(sizeof(struct presence_batched_routed)); - /* @TODO: merge old & new list */ - sipe_utils_slist_free_full(subscription->buddies, g_free); - subscription->buddies = buddies; + if (subscription->buddies) { + /* merge old and new list */ + GSList *entry = buddies; + while (entry) { + subscription->buddies = sipe_utils_slist_insert_unique_sorted(subscription->buddies, + g_strdup(entry->data), + (GCompareFunc) g_ascii_strcasecmp, + g_free); + entry = entry->next; + } + sipe_utils_slist_free_full(buddies, g_free); + } else { + /* no list yet, simply take ownership of whole list */ + subscription->buddies = buddies; + } payload->host = g_strdup(who); - payload->buddies = buddies; + payload->buddies = subscription->buddies; sipe_schedule_seconds(sipe_private, action_name, payload, -- 2.11.4.GIT