summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlberto Mardegan <mardy@users.sourceforge.net>2007-07-10 10:44:42 +0000
committerAlberto Mardegan <mardy@users.sourceforge.net>2007-07-10 10:44:42 +0000
commit47bc108067f9964c53a48156f61216358afc31b8 (patch)
tree5d55dfca3e79e93e9a3f945da4ec3f5598357277 /src
parent91082693861b307bab361b87dd18cd9005a90754 (diff)
New mcd_channel_leave() API for removing the self handle from a
channel. git-svn-id: https://mission-control.svn.sourceforge.net/svnroot/mission-control/trunk@84 d91c8aed-3f2b-0410-a83d-924a1c20a0ba
Diffstat (limited to 'src')
-rw-r--r--src/mcd-channel.c36
-rw-r--r--src/mcd-channel.h2
2 files changed, 38 insertions, 0 deletions
diff --git a/src/mcd-channel.c b/src/mcd-channel.c
index 27a7c5ae..fe7ac2c0 100644
--- a/src/mcd-channel.c
+++ b/src/mcd-channel.c
@@ -787,6 +787,13 @@ err_missing_interface:
return members;
}
+static inline void
+tp_chan_iface_group_remove_members_with_reason_no_reply (DBusGProxy *proxy, const GArray* IN_contacts, const char * IN_message, const guint IN_reason)
+
+{
+ dbus_g_proxy_call_no_reply (proxy, "RemoveMembersWithReason", dbus_g_type_get_collection ("GArray", G_TYPE_UINT), IN_contacts, G_TYPE_STRING, IN_message, G_TYPE_UINT, IN_reason, G_TYPE_INVALID);
+}
+
/**
* mcd_channel_get_name:
* @channel: the #McdChannel.
@@ -851,3 +858,32 @@ mcd_channel_is_missed (McdChannel *channel)
return MCD_CHANNEL_PRIV (channel)->missed;
}
+/**
+ * mcd_channel_leave:
+ * @channel: the #McdChannel.
+ * @reason: a #TelepathyChannelGroupChangeReason.
+ *
+ * Leaves @channel with reason @reason.
+ *
+ * Returns: %TRUE for success, %FALSE otherwise.
+ */
+gboolean
+mcd_channel_leave (McdChannel *channel, const gchar *message,
+ TelepathyChannelGroupChangeReason reason)
+{
+ McdChannelPrivate *priv = MCD_CHANNEL_PRIV (channel);
+ DBusGProxy *group;
+ GArray members;
+
+ if (!priv->tp_chan) return FALSE;
+ group = tp_chan_get_interface (priv->tp_chan,
+ TELEPATHY_CHAN_IFACE_GROUP_QUARK);
+ if (!group) return FALSE;
+ g_debug ("removing self");
+ members.len = 1;
+ members.data = (gchar *)&priv->self_handle;
+ tp_chan_iface_group_remove_members_with_reason_no_reply (group, &members,
+ message, reason);
+ return TRUE;
+}
+
diff --git a/src/mcd-channel.h b/src/mcd-channel.h
index 6a075b6b..ed099fef 100644
--- a/src/mcd-channel.h
+++ b/src/mcd-channel.h
@@ -102,6 +102,8 @@ gint mcd_channel_get_flags (McdChannel *channel);
GPtrArray* mcd_channel_get_members (McdChannel *channel);
const gchar *mcd_channel_get_name (McdChannel *channel);
gboolean mcd_channel_is_missed (McdChannel *channel);
+gboolean mcd_channel_leave (McdChannel *channel, const gchar *message,
+ TelepathyChannelGroupChangeReason reason);
G_END_DECLS
#endif /* MCD_CHANNEL_H */