aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-06 20:37:42 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2011-05-18 21:40:09 +0800
commit44162e3ac3604c3e4f14dd01b48fc32cd7fd1007 (patch)
tree987e3f2d7c0f2fcbd244c94cc347499f9d832d87 /src
parent9e46660b7f36e1274ca43a47b9a011c056c35746 (diff)
downloadgsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar.gz
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar.bz2
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar.lz
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar.xz
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.tar.zst
gsoc2013-empathy-44162e3ac3604c3e4f14dd01b48fc32cd7fd1007.zip
invite-participant-dialog: filter out contacts already in the chat
Diffstat (limited to 'src')
-rw-r--r--src/empathy-invite-participant-dialog.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/empathy-invite-participant-dialog.c b/src/empathy-invite-participant-dialog.c
index 30c168dc8..f0ce85e07 100644
--- a/src/empathy-invite-participant-dialog.c
+++ b/src/empathy-invite-participant-dialog.c
@@ -166,6 +166,9 @@ filter_func (GtkTreeModel *model,
FolksIndividual *individual;
TpContact *contact;
gboolean is_online;
+ GList *members, *l;
+ gboolean display;
+ TpChannel *channel;
gtk_tree_model_get (model, iter,
EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual,
@@ -181,7 +184,35 @@ filter_func (GtkTreeModel *model,
if (contact == NULL)
return FALSE;
- return TRUE;
+ /* Filter out contacts which are already in the chat */
+ members = empathy_contact_list_get_members (EMPATHY_CONTACT_LIST (
+ self->priv->tp_chat));
+
+ display = TRUE;
+ channel = empathy_tp_chat_get_channel (self->priv->tp_chat);
+
+ for (l = members; l != NULL; l = g_list_next (l))
+ {
+ EmpathyContact *member = l->data;
+ TpHandle handle;
+
+ /* Try to get the non-channel specific handle. */
+ handle = tp_channel_group_get_handle_owner (channel,
+ empathy_contact_get_handle (member));
+ if (handle == 0)
+ handle = empathy_contact_get_handle (member);
+
+ if (handle == tp_contact_get_handle (contact))
+ {
+ display = FALSE;
+ break;
+ }
+ }
+
+ g_list_foreach (members, (GFunc) g_object_unref, NULL);
+ g_list_free (members);
+
+ return display;
}
static void