telepathygabble/inc/group-mixin.h
changeset 10 59927b2d3b75
parent 0 d0f3a028347a
equal deleted inserted replaced
0:d0f3a028347a 10:59927b2d3b75
     1 /*
       
     2  * group-mixin.h - Header for GabbleGroupMixin
       
     3  * Copyright (C) 2006 Collabora Ltd.
       
     4  * 
       
     5  *   @author Ole Andre Vadla Ravnaas <ole.andre.ravnaas@collabora.co.uk>
       
     6  *   @author Robert McQueen <robert.mcqueen@collabora.co.uk>
       
     7  *
       
     8  * Portions 
       
     9  *
       
    10  * This library is free software; you can redistribute it and/or
       
    11  * modify it under the terms of the GNU Lesser General Public
       
    12  * License as published by the Free Software Foundation; either
       
    13  * version 2.1 of the License, or (at your option) any later version.
       
    14  *
       
    15  * This library is distributed in the hope that it will be useful,
       
    16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    18  * Lesser General Public License for more details.
       
    19  *
       
    20  * You should have received a copy of the GNU Lesser General Public
       
    21  * License along with this library; if not, write to the Free Software
       
    22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    23  */
       
    24 
       
    25 #ifndef __GABBLE_GROUP_MIXIN_H__
       
    26 #define __GABBLE_GROUP_MIXIN_H__
       
    27 
       
    28 #include "handles.h"
       
    29 #include "handle-set.h"
       
    30 #include "util.h"
       
    31 
       
    32 G_BEGIN_DECLS
       
    33 
       
    34 typedef struct _GabbleGroupMixinClass GabbleGroupMixinClass;
       
    35 typedef struct _GabbleGroupMixin GabbleGroupMixin;
       
    36 typedef struct _GabbleGroupMixinPrivate GabbleGroupMixinPrivate;
       
    37 
       
    38 typedef gboolean (*GabbleGroupMixinAddMemberFunc) (GObject *obj, GabbleHandle handle, const gchar *message, GError **error);
       
    39 typedef gboolean (*GabbleGroupMixinRemMemberFunc) (GObject *obj, GabbleHandle handle, const gchar *message, GError **error);
       
    40 
       
    41 struct _GabbleGroupMixinClass {
       
    42   GabbleGroupMixinAddMemberFunc add_member;
       
    43   GabbleGroupMixinRemMemberFunc remove_member;
       
    44 
       
    45   guint group_flags_changed_signal_id;
       
    46   guint members_changed_signal_id;
       
    47 };
       
    48 
       
    49 struct _GabbleGroupMixin {
       
    50   GabbleHandleRepo *handle_repo;
       
    51   GabbleHandle self_handle;
       
    52 
       
    53   TpChannelGroupFlags group_flags;
       
    54 
       
    55   GabbleHandleSet *members;
       
    56   GabbleHandleSet *local_pending;
       
    57   GabbleHandleSet *remote_pending;
       
    58 
       
    59   GabbleGroupMixinPrivate *priv;
       
    60 };
       
    61 
       
    62 /* TYPE MACROS */
       
    63 #define GABBLE_GROUP_MIXIN_CLASS_OFFSET_QUARK (gabble_group_mixin_class_get_offset_quark())
       
    64 #define GABBLE_GROUP_MIXIN_CLASS_OFFSET(o) (GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_CLASS_TYPE (o), GABBLE_GROUP_MIXIN_CLASS_OFFSET_QUARK)))
       
    65 #define GABBLE_GROUP_MIXIN_CLASS(o) ((GabbleGroupMixinClass *) gabble_mixin_offset_cast (o, GABBLE_GROUP_MIXIN_CLASS_OFFSET (o)))
       
    66 
       
    67 #define GABBLE_GROUP_MIXIN_OFFSET_QUARK (gabble_group_mixin_get_offset_quark())
       
    68 #define GABBLE_GROUP_MIXIN_OFFSET(o) (GPOINTER_TO_UINT (g_type_get_qdata (G_OBJECT_TYPE (o), GABBLE_GROUP_MIXIN_OFFSET_QUARK)))
       
    69 #define GABBLE_GROUP_MIXIN(o) ((GabbleGroupMixin *) gabble_mixin_offset_cast (o, GABBLE_GROUP_MIXIN_OFFSET(o)))
       
    70 
       
    71 GQuark gabble_group_mixin_class_get_offset_quark (void);
       
    72 GQuark gabble_group_mixin_get_offset_quark (void);
       
    73 
       
    74 void gabble_group_mixin_class_init (GObjectClass *obj_cls, glong offset, GabbleGroupMixinAddMemberFunc add_func, GabbleGroupMixinRemMemberFunc rem_func);
       
    75 
       
    76 void gabble_group_mixin_init (GObject *obj, glong offset, GabbleHandleRepo *handle_repo, GabbleHandle self_handle);
       
    77 void gabble_group_mixin_finalize (GObject *obj);
       
    78 
       
    79 gboolean gabble_group_mixin_get_self_handle (GObject *obj, guint *ret, GError **error);
       
    80 gboolean gabble_group_mixin_get_group_flags (GObject *obj, guint *ret, GError **error);
       
    81 
       
    82 gboolean gabble_group_mixin_add_members (GObject *obj, const GArray *contacts, const gchar *message, GError **error);
       
    83 gboolean gabble_group_mixin_remove_members (GObject *obj, const GArray *contacts, const gchar *message, GError **error);
       
    84 
       
    85 gboolean gabble_group_mixin_get_members (GObject *obj, GArray **ret, GError **error);
       
    86 gboolean gabble_group_mixin_get_local_pending_members (GObject *obj, GArray **ret, GError **error);
       
    87 gboolean gabble_group_mixin_get_remote_pending_members (GObject *obj, GArray **ret, GError **error);
       
    88 gboolean gabble_group_mixin_get_all_members (GObject *obj, GArray **ret, GArray **ret1, GArray **ret2, GError **error);
       
    89 
       
    90 gboolean gabble_group_mixin_get_handle_owners (GObject *obj, const GArray *handles, GArray **ret, GError **error);
       
    91 
       
    92 void gabble_group_mixin_change_flags (GObject *obj, TpChannelGroupFlags add, TpChannelGroupFlags remove);
       
    93 gboolean gabble_group_mixin_change_members (GObject *obj, const gchar *message, GIntSet *add, GIntSet *remove, GIntSet *local_pending, GIntSet *remote_pending, GabbleHandle actor, guint reason);
       
    94 
       
    95 void gabble_group_mixin_add_handle_owner (GObject *obj, GabbleHandle local_handle, GabbleHandle owner_handle);
       
    96 
       
    97 G_END_DECLS
       
    98 
       
    99 #endif /* #ifndef __GABBLE_GROUP_MIXIN_H__ */