empathy r903 - trunk/libempathy



Author: xclaesse
Date: Fri Apr 11 14:10:56 2008
New Revision: 903
URL: http://svn.gnome.org/viewvc/empathy?rev=903&view=rev

Log:
Add empathy_tp_group_get_invitation


Modified:
   trunk/libempathy/empathy-tp-group.c
   trunk/libempathy/empathy-tp-group.h

Modified: trunk/libempathy/empathy-tp-group.c
==============================================================================
--- trunk/libempathy/empathy-tp-group.c	(original)
+++ trunk/libempathy/empathy-tp-group.c	Fri Apr 11 14:10:56 2008
@@ -954,4 +954,38 @@
 	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;
+}
 

Modified: trunk/libempathy/empathy-tp-group.h
==============================================================================
--- trunk/libempathy/empathy-tp-group.h	(original)
+++ trunk/libempathy/empathy-tp-group.h	Fri Apr 11 14:10:56 2008
@@ -81,6 +81,8 @@
 gboolean            empathy_tp_group_is_member           (EmpathyTpGroup     *group,
 							  EmpathyContact     *contact);
 gboolean            empathy_tp_group_is_ready            (EmpathyTpGroup     *group);
+EmpathyPendingInfo *empathy_tp_group_get_invitation      (EmpathyTpGroup     *group,
+							  EmpathyContact    **remote_contact);
 EmpathyPendingInfo *empathy_pending_info_new             (EmpathyContact     *member,
 							  EmpathyContact     *actor,
 							  const gchar        *message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]