summaryrefslogtreecommitdiff
path: root/telepathy-glib/group-mixin.h
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2007-04-19 17:35:17 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2007-04-19 17:35:17 +0000
commit05b3d77a6ceaf9142e0dee8bf52e7637d5823bdd (patch)
treeae7da2dc08fb4c3aa1c6b09ffa1c57d2d3adf24a /telepathy-glib/group-mixin.h
parent90720ee40eb30e2b1c9aa90501391d3a0a411250 (diff)
Move contents of lib/ into root directory
Diffstat (limited to 'telepathy-glib/group-mixin.h')
-rw-r--r--telepathy-glib/group-mixin.h189
1 files changed, 189 insertions, 0 deletions
diff --git a/telepathy-glib/group-mixin.h b/telepathy-glib/group-mixin.h
new file mode 100644
index 000000000..f316e41e4
--- /dev/null
+++ b/telepathy-glib/group-mixin.h
@@ -0,0 +1,189 @@
+/*
+ * group-mixin.h - Header for TpGroupMixin
+ * Copyright (C) 2006 Collabora Ltd.
+ * Copyright (C) 2006 Nokia Corporation
+ * @author Ole Andre Vadla Ravnaas <ole.andre.ravnaas@collabora.co.uk>
+ * @author Robert McQueen <robert.mcqueen@collabora.co.uk>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __TP_GROUP_MIXIN_H__
+#define __TP_GROUP_MIXIN_H__
+
+#include <telepathy-glib/handle-repo.h>
+#include <telepathy-glib/svc-channel.h>
+#include <telepathy-glib/util.h>
+
+G_BEGIN_DECLS
+
+typedef struct _TpGroupMixinClass TpGroupMixinClass;
+typedef struct _TpGroupMixinClassPrivate TpGroupMixinClassPrivate;
+
+typedef struct _TpGroupMixin TpGroupMixin;
+typedef struct _TpGroupMixinPrivate TpGroupMixinPrivate;
+
+/**
+ * TpGroupMixinAddMemberFunc:
+ * @obj: An object implementing the group interface with this mixin
+ * @handle: The handle of the contact to be added
+ * @message: A message to be sent if the protocol supports it
+ * @error: Used to return a Telepathy D-Bus error if %FALSE is returned
+ *
+ * Signature of the callback used to add a member to the group.
+ * This should perform the necessary operations in the underlying IM protocol
+ * to cause the member to be added.
+ *
+ * Returns: %TRUE on success, %FALSE with @error set on error
+ */
+typedef gboolean (*TpGroupMixinAddMemberFunc) (GObject *obj,
+ TpHandle handle, const gchar *message, GError **error);
+
+/**
+ * TpGroupMixinRemMemberFunc:
+ * @obj: An object implementing the group interface with this mixin
+ * @handle: The handle of the contact to be removed
+ * @message: A message to be sent if the protocol supports it
+ * @error: Used to return a Telepathy D-Bus error if %FALSE is returned
+ *
+ * Signature of the callback used to remove a member from the group.
+ * This should perform the necessary operations in the underlying IM protocol
+ * to cause the member to be removed.
+ *
+ * Returns: %TRUE on success, %FALSE with @error set on error
+ */
+typedef gboolean (*TpGroupMixinRemMemberFunc) (GObject *obj,
+ TpHandle handle, const gchar *message, GError **error);
+
+/**
+ * TpGroupMixinClass:
+ * @add_member: The add-member function that was passed to
+ * tp_group_mixin_class_init()
+ * @remove_member: The remove-member function that was passed to
+ * tp_group_mixin_class_init()
+ * @priv: Pointer to opaque private data
+ *
+ * Structure representing the group mixin as used in a particular class.
+ * To be placed in the implementation's class structure.
+ *
+ * Initialize this with tp_group_mixin_class_init().
+ *
+ * All fields should be considered read-only.
+ */
+struct _TpGroupMixinClass {
+ TpGroupMixinAddMemberFunc add_member;
+ TpGroupMixinRemMemberFunc remove_member;
+ TpGroupMixinClassPrivate *priv;
+};
+
+/**
+ * TpGroupMixin:
+ * @handle_repo: The connection's contact handle repository
+ * @self_handle: The local user's handle within this group, or 0 if none.
+ * Set using (FIXME: how do we do self-renaming?)
+ * @group_flags: This group's flags. Set using tp_group_mixin_change_flags().
+ * @members: The members of the group. Alter using
+ * tp_group_mixin_change_members().
+ * @local_pending: Members awaiting the local user's approval to join the
+ * group. Alter using tp_group_mixin_change_members().
+ * @remote_pending: Members awaiting remote (e.g. remote user or server)
+ * approval to join the group. Alter using tp_group_mixin_change_members().
+ * @priv: Pointer to opaque private data
+ *
+ * Structure representing the group mixin as used in a particular class.
+ * To be placed in the implementation's instance structure.
+ *
+ * All fields should be considered read-only.
+ */
+struct _TpGroupMixin {
+ TpHandleRepoIface *handle_repo;
+ TpHandle self_handle;
+
+ TpChannelGroupFlags group_flags;
+
+ TpHandleSet *members;
+ TpHandleSet *local_pending;
+ TpHandleSet *remote_pending;
+
+ TpGroupMixinPrivate *priv;
+};
+
+/* TYPE MACROS */
+#define TP_GROUP_MIXIN_CLASS_OFFSET_QUARK \
+ (tp_group_mixin_class_get_offset_quark ())
+#define TP_GROUP_MIXIN_CLASS_OFFSET(o) \
+ (GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_CLASS_TYPE (o), \
+ TP_GROUP_MIXIN_CLASS_OFFSET_QUARK)))
+#define TP_GROUP_MIXIN_CLASS(o) \
+ ((TpGroupMixinClass *) tp_mixin_offset_cast (o, \
+ TP_GROUP_MIXIN_CLASS_OFFSET (o)))
+
+#define TP_GROUP_MIXIN_OFFSET_QUARK (tp_group_mixin_get_offset_quark ())
+#define TP_GROUP_MIXIN_OFFSET(o) (GPOINTER_TO_UINT (g_type_get_qdata (\
+ G_OBJECT_TYPE (o), TP_GROUP_MIXIN_OFFSET_QUARK)))
+#define TP_GROUP_MIXIN(o) ((TpGroupMixin *) tp_mixin_offset_cast (o, \
+ TP_GROUP_MIXIN_OFFSET(o)))
+
+GQuark tp_group_mixin_class_get_offset_quark (void);
+GQuark tp_group_mixin_get_offset_quark (void);
+
+void tp_group_mixin_class_init (GObjectClass *obj_cls,
+ glong offset, TpGroupMixinAddMemberFunc add_func,
+ TpGroupMixinRemMemberFunc rem_func);
+
+void tp_group_mixin_init (GObject *obj, glong offset,
+ TpHandleRepoIface *handle_repo, TpHandle self_handle);
+void tp_group_mixin_finalize (GObject *obj);
+
+gboolean tp_group_mixin_get_self_handle (GObject *obj,
+ guint *ret, GError **error);
+gboolean tp_group_mixin_get_group_flags (GObject *obj,
+ guint *ret, GError **error);
+
+gboolean tp_group_mixin_add_members (GObject *obj,
+ const GArray *contacts, const gchar *message, GError **error);
+gboolean tp_group_mixin_remove_members (GObject *obj,
+ const GArray *contacts, const gchar *message, GError **error);
+
+gboolean tp_group_mixin_get_members (GObject *obj,
+ GArray **ret, GError **error);
+gboolean tp_group_mixin_get_local_pending_members (GObject *obj,
+ GArray **ret, GError **error);
+gboolean tp_group_mixin_get_local_pending_members_with_info (GObject *obj,
+ GPtrArray **ret, GError **error);
+gboolean tp_group_mixin_get_remote_pending_members (GObject *obj,
+ GArray **ret, GError **error);
+gboolean tp_group_mixin_get_all_members (GObject *obj,
+ GArray **members, GArray **local_pending, GArray **remote_pending,
+ GError **error);
+
+gboolean tp_group_mixin_get_handle_owners (GObject *obj,
+ const GArray *handles, GArray **ret, GError **error);
+
+void tp_group_mixin_change_flags (GObject *obj,
+ TpChannelGroupFlags add, TpChannelGroupFlags remove);
+gboolean tp_group_mixin_change_members (GObject *obj,
+ const gchar *message, TpIntSet *add, TpIntSet *remove,
+ TpIntSet *add_local_pending, TpIntSet *add_remote_pending, TpHandle actor,
+ TpChannelGroupChangeReason reason);
+
+void tp_group_mixin_add_handle_owner (GObject *obj,
+ TpHandle local_handle, TpHandle owner_handle);
+
+void tp_group_mixin_iface_init (gpointer g_iface, gpointer iface_data);
+
+G_END_DECLS
+
+#endif /* #ifndef __TP_GROUP_MIXIN_H__ */