]> git.0d.be Git - empathy.git/blob - libempathy/empathy-tp-group.h
Completely reworked ContactList API. Fixes bug #471611, bug #467280, bug #459540...
[empathy.git] / libempathy / empathy-tp-group.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2006 Xavier Claessens <xclaesse@gmail.com>
4  * Copyright (C) 2007 Collabora Ltd.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License as
8  * published by the Free Software Foundation; either version 2 of the
9  * License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public
17  * License along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  * Authors: Xavier Claessens <xclaesse@gmail.com>
22  */
23
24 #ifndef __EMPATHY_TP_GROUP_H__
25 #define __EMPATHY_TP_GROUP_H__
26
27 #include <glib.h>
28
29 #include <libtelepathy/tp-chan.h>
30 #include <libtelepathy/tp-constants.h>
31 #include <libmissioncontrol/mc-account.h>
32
33 #include "empathy-contact.h"
34
35 G_BEGIN_DECLS
36
37 #define EMPATHY_TYPE_TP_GROUP         (empathy_tp_group_get_type ())
38 #define EMPATHY_TP_GROUP(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroup))
39 #define EMPATHY_TP_GROUP_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupClass))
40 #define EMPATHY_IS_TP_GROUP(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_TP_GROUP))
41 #define EMPATHY_IS_TP_GROUP_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_TP_GROUP))
42 #define EMPATHY_TP_GROUP_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_TP_GROUP, EmpathyTpGroupClass))
43
44 typedef struct _EmpathyTpGroup      EmpathyTpGroup;
45 typedef struct _EmpathyTpGroupClass EmpathyTpGroupClass;
46 typedef struct _EmpathyTpGroupPriv  EmpathyTpGroupPriv;
47
48 struct _EmpathyTpGroup {
49         GObject      parent;
50 };
51
52 struct _EmpathyTpGroupClass {
53         GObjectClass parent_class;
54 };
55
56 typedef struct {
57         EmpathyContact *member;
58         EmpathyContact *actor;
59         gchar          *message;
60         guint           reason;
61 } EmpathyPendingInfo;
62
63 GType               empathy_tp_group_get_type            (void) G_GNUC_CONST;
64 EmpathyTpGroup *    empathy_tp_group_new                 (McAccount          *account,
65                                                           TpChan             *tp_chan);
66 void                empathy_tp_group_close               (EmpathyTpGroup     *group);
67 void                empathy_tp_group_add_members         (EmpathyTpGroup     *group,
68                                                           GList              *contacts,
69                                                           const gchar        *message);
70 void                empathy_tp_group_add_member          (EmpathyTpGroup     *group,
71                                                           EmpathyContact     *contact,
72                                                           const gchar        *message);
73 void                empathy_tp_group_remove_members      (EmpathyTpGroup     *group,
74                                                           GList              *contacts,
75                                                           const gchar        *message);
76 void                empathy_tp_group_remove_member       (EmpathyTpGroup     *group,
77                                                           EmpathyContact     *contact,
78                                                           const gchar        *message);
79 GList *             empathy_tp_group_get_members         (EmpathyTpGroup     *group);
80 GList *             empathy_tp_group_get_local_pendings  (EmpathyTpGroup     *group);
81 GList *             empathy_tp_group_get_remote_pendings (EmpathyTpGroup     *group);
82 const gchar *       empathy_tp_group_get_name            (EmpathyTpGroup     *group);
83 EmpathyContact *    empathy_tp_group_get_self_contact    (EmpathyTpGroup     *group);
84 const gchar *       empathy_tp_group_get_object_path     (EmpathyTpGroup     *group);
85 gboolean            empathy_tp_group_is_member           (EmpathyTpGroup     *group,
86                                                           EmpathyContact     *contact);
87 EmpathyPendingInfo *empathy_pending_info_new             (EmpathyContact     *member,
88                                                           EmpathyContact     *actor,
89                                                           const gchar        *message);
90 void                empathy_pending_info_free            (EmpathyPendingInfo *info);
91
92 G_END_DECLS
93
94 #endif /* __EMPATHY_TP_GROUP_H__ */