From 1a51b6b626098bb0b94d6e5a4bbf055b833b45db Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 11 Apr 2008 13:10:56 +0000 Subject: Add empathy_tp_group_get_invitation svn path=/trunk/; revision=903 --- libempathy/empathy-tp-group.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'libempathy/empathy-tp-group.c') diff --git a/libempathy/empathy-tp-group.c b/libempathy/empathy-tp-group.c index 0558bcb28..ef6697de4 100644 --- a/libempathy/empathy-tp-group.c +++ b/libempathy/empathy-tp-group.c @@ -954,4 +954,38 @@ empathy_tp_group_is_ready (EmpathyTpGroup *group) return priv->ready; } +EmpathyPendingInfo * +empathy_tp_group_get_invitation (EmpathyTpGroup *group, + EmpathyContact **remote_contact) +{ + EmpathyTpGroupPriv *priv = GET_PRIV (group); + EmpathyContact *contact = NULL; + EmpathyPendingInfo *invitation = NULL; + GList *l; + + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), FALSE); + g_return_val_if_fail (priv->ready, NULL); + + for (l = priv->local_pendings; l; l = l->next) { + EmpathyPendingInfo *info = l->data; + + if (empathy_contact_is_user (info->member)) { + invitation = info; + break; + } + } + + if (invitation && priv->members && !priv->members->next) { + contact = priv->members->data; + } + if (!invitation && priv->remote_pendings && !priv->remote_pendings->next) { + contact = priv->remote_pendings->data; + } + + if (remote_contact) { + *remote_contact = contact; + } + + return invitation; +} -- cgit v1.2.3