From 541d3a26efe89935b9fe05d37195958ced705c6d Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Sun, 11 Aug 2013 14:39:49 +0300 Subject: [PATCH] group: add interface for number of groups --- src/core/sipe-group.c | 5 +++++ src/core/sipe-group.h | 7 +++++++ src/core/sipe-notify.c | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/core/sipe-group.c b/src/core/sipe-group.c index 077f31e7..4da71736 100755 --- a/src/core/sipe-group.c +++ b/src/core/sipe-group.c @@ -364,6 +364,11 @@ void sipe_core_group_set_alias(struct sipe_core_public *sipe_public, send_buddy_update(sipe_private, buddy, alias); } +guint sipe_group_count(struct sipe_core_private *sipe_private) +{ + return(g_slist_length(sipe_private->groups)); +} + void sipe_group_init(struct sipe_core_private *sipe_private) { sipe_private->groups = NULL; diff --git a/src/core/sipe-group.h b/src/core/sipe-group.h index f92ac451..bbb951fb 100644 --- a/src/core/sipe-group.h +++ b/src/core/sipe-group.h @@ -56,6 +56,13 @@ void sipe_group_update_buddy(struct sipe_core_private *sipe_private, struct sipe_buddy *buddy); /** + * Number of groups + * + * @param sipe_private SIPE core data + */ +guint sipe_group_count(struct sipe_core_private *sipe_private); + +/** * Initialize group data * * @param sipe_private SIPE core data diff --git a/src/core/sipe-notify.c b/src/core/sipe-notify.c index bdcc227f..c27455a8 100644 --- a/src/core/sipe-notify.c +++ b/src/core/sipe-notify.c @@ -1124,7 +1124,7 @@ static void add_new_buddy(struct sipe_core_private *sipe_private, /* If couldn't find the right group for this contact, */ /* then just put it in the first group we have */ if ((group == NULL) && - (g_slist_length(sipe_private->groups) > 0)) + (sipe_group_count(sipe_private) > 0)) group = sipe_private->groups->data; if (group) { @@ -1211,7 +1211,7 @@ static gboolean sipe_process_roaming_contacts(struct sipe_core_private *sipe_pri add_new_group(sipe_private, group_node); /* Make sure we have at least one group */ - if (g_slist_length(sipe_private->groups) == 0) { + if (sipe_group_count(sipe_private) == 0) { sipe_group_create(sipe_private, _("Other Contacts"), NULL); } -- 2.11.4.GIT