1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2004 Imendio AB
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.
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.
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.
21 #ifndef __GOSSIP_CONTACT_H__
22 #define __GOSSIP_CONTACT_H__
24 #include <glib-object.h>
26 #include <libmissioncontrol/mc-account.h>
28 #include "gossip-avatar.h"
29 #include "gossip-presence.h"
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))
40 typedef struct _GossipContact GossipContact;
41 typedef struct _GossipContactClass GossipContactClass;
43 struct _GossipContact {
47 struct _GossipContactClass {
48 GObjectClass parent_class;
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
58 GType gossip_contact_get_gtype (void) G_GNUC_CONST;
60 GossipContact * gossip_contact_new (McAccount *account);
61 GossipContact * gossip_contact_new_full (McAccount *account,
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 void gossip_contact_add_presence (GossipContact *contact,
69 GossipPresence *presence);
70 void gossip_contact_remove_presence (GossipContact *contact,
71 GossipPresence *presence);
72 GossipPresence * gossip_contact_get_presence_for_resource (GossipContact *contact,
73 const gchar *resource);
74 GossipPresence * gossip_contact_get_active_presence (GossipContact *contact);
75 GList * gossip_contact_get_presence_list (GossipContact *contact);
76 GList * gossip_contact_get_groups (GossipContact *contact);
77 GossipSubscription gossip_contact_get_subscription (GossipContact *contact);
78 guint gossip_contact_get_handle (GossipContact *contact);
79 void gossip_contact_set_id (GossipContact *contact,
81 void gossip_contact_set_name (GossipContact *contact,
83 void gossip_contact_set_avatar (GossipContact *contact,
84 GossipAvatar *avatar);
85 void gossip_contact_set_account (GossipContact *contact,
87 void gossip_contact_set_groups (GossipContact *contact,
89 void gossip_contact_set_subscription (GossipContact *contact,
90 GossipSubscription subscription);
91 void gossip_contact_set_handle (GossipContact *contact,
93 gboolean gossip_contact_is_online (GossipContact *contact);
94 const gchar * gossip_contact_get_status (GossipContact *contact);
95 gboolean gossip_contact_equal (gconstpointer v1,
97 guint gossip_contact_hash (gconstpointer key);
101 #endif /* __GOSSIP_CONTACT_H__ */