[darcs-to-svn @ Syncing new contact list stuff from gossip]
[empathy.git] / libempathy / gossip-contact.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2004 Imendio AB
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License as
7  * published by the Free Software Foundation; either version 2 of the
8  * License, or (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public
16  * License along with this program; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GOSSIP_CONTACT_H__
22 #define __GOSSIP_CONTACT_H__
23
24 #include <glib-object.h>
25
26 #include <libmissioncontrol/mc-account.h>
27
28 #include "gossip-avatar.h"
29 #include "gossip-presence.h"
30
31 G_BEGIN_DECLS
32
33 #define GOSSIP_TYPE_CONTACT         (gossip_contact_get_gtype ())
34 #define GOSSIP_CONTACT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), GOSSIP_TYPE_CONTACT, GossipContact))
35 #define GOSSIP_CONTACT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), GOSSIP_TYPE_CONTACT, GossipContactClass))
36 #define GOSSIP_IS_CONTACT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), GOSSIP_TYPE_CONTACT))
37 #define GOSSIP_IS_CONTACT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), GOSSIP_TYPE_CONTACT))
38 #define GOSSIP_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOSSIP_TYPE_CONTACT, GossipContactClass))
39
40 typedef struct _GossipContact      GossipContact;
41 typedef struct _GossipContactClass GossipContactClass;
42
43 struct _GossipContact {
44         GObject parent;
45 };
46
47 struct _GossipContactClass {
48         GObjectClass parent_class;
49 };
50
51 typedef enum {
52         GOSSIP_SUBSCRIPTION_NONE = 0,
53         GOSSIP_SUBSCRIPTION_TO   = 1 << 0,      /* We send our presence to that contact */
54         GOSSIP_SUBSCRIPTION_FROM = 1 << 1,      /* That contact sends his presence to us */
55         GOSSIP_SUBSCRIPTION_BOTH = GOSSIP_SUBSCRIPTION_TO | GOSSIP_SUBSCRIPTION_FROM
56 } GossipSubscription;
57
58 GType              gossip_contact_get_gtype                 (void) G_GNUC_CONST;
59
60 GossipContact *    gossip_contact_new                       (McAccount          *account);
61 GossipContact *    gossip_contact_new_full                  (McAccount          *account,
62                                                              const gchar        *id,
63                                                              const gchar        *name);
64 const gchar *      gossip_contact_get_id                    (GossipContact      *contact);
65 const gchar *      gossip_contact_get_name                  (GossipContact      *contact);
66 GossipAvatar *     gossip_contact_get_avatar                (GossipContact      *contact);
67 McAccount *        gossip_contact_get_account               (GossipContact      *contact);
68 GossipPresence *   gossip_contact_get_presence              (GossipContact      *contact);
69 GList *            gossip_contact_get_groups                (GossipContact      *contact);
70 GossipSubscription gossip_contact_get_subscription          (GossipContact      *contact);
71 guint              gossip_contact_get_handle                (GossipContact      *contact);
72 void               gossip_contact_set_id                    (GossipContact      *contact,
73                                                              const gchar        *id);
74 void               gossip_contact_set_name                  (GossipContact      *contact,
75                                                              const gchar        *name);
76 void               gossip_contact_set_avatar                (GossipContact      *contact,
77                                                              GossipAvatar       *avatar);
78 void               gossip_contact_set_account               (GossipContact      *contact,
79                                                              McAccount          *account);
80 void               gossip_contact_set_presence              (GossipContact      *contact,
81                                                              GossipPresence     *presence);
82 void               gossip_contact_set_groups                (GossipContact      *contact,
83                                                              GList              *categories);
84 void               gossip_contact_set_subscription          (GossipContact      *contact,
85                                                              GossipSubscription  subscription);
86 void               gossip_contact_set_handle                (GossipContact      *contact,
87                                                              guint               handle);
88 gboolean           gossip_contact_is_online                 (GossipContact      *contact);
89 gboolean           gossip_contact_is_in_group               (GossipContact      *contact,
90                                                              const gchar        *group);
91 const gchar *      gossip_contact_get_status                (GossipContact      *contact);
92 gboolean           gossip_contact_equal                     (gconstpointer       v1,
93                                                              gconstpointer       v2);
94 guint              gossip_contact_hash                      (gconstpointer       key);
95
96 G_END_DECLS
97
98 #endif /* __GOSSIP_CONTACT_H__ */
99