]> git.0d.be Git - empathy.git/blob - libempathy/empathy-contact.h
Fix some coding style
[empathy.git] / libempathy / empathy-contact.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2004 Imendio AB
4  * Copyright (C) 2007-2008 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: Mikael Hallendal <micke@imendio.com>
22  *          Martyn Russell <martyn@imendio.com>
23  *          Xavier Claessens <xclaesse@gmail.com>
24  */
25
26 #ifndef __EMPATHY_CONTACT_H__
27 #define __EMPATHY_CONTACT_H__
28
29 #include <glib-object.h>
30
31 #include <libmissioncontrol/mc-account.h>
32 #include <libmissioncontrol/mission-control.h>
33
34 G_BEGIN_DECLS
35
36 #define EMPATHY_TYPE_CONTACT         (empathy_contact_get_type ())
37 #define EMPATHY_CONTACT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT, EmpathyContact))
38 #define EMPATHY_CONTACT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
39 #define EMPATHY_IS_CONTACT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT))
40 #define EMPATHY_IS_CONTACT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT))
41 #define EMPATHY_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
42
43 typedef struct _EmpathyContact      EmpathyContact;
44 typedef struct _EmpathyContactClass EmpathyContactClass;
45
46 struct _EmpathyContact
47 {
48   GObject parent;
49   gpointer priv;
50 };
51
52 struct _EmpathyContactClass
53 {
54   GObjectClass parent_class;
55 };
56
57 typedef struct {
58   guchar *data;
59   gsize len;
60   gchar *format;
61   gchar *token;
62   guint refcount;
63 } EmpathyAvatar;
64
65 typedef enum {
66   EMPATHY_CAPABILITIES_NONE = 0,
67   EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
68   EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
69   EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
70 } EmpathyCapabilities;
71
72 typedef enum {
73   EMPATHY_CONTACT_READY_NONE = 0,
74   EMPATHY_CONTACT_READY_ID = 1 << 0,
75   EMPATHY_CONTACT_READY_HANDLE = 1 << 1,
76   EMPATHY_CONTACT_READY_NAME = 1 << 2,
77   EMPATHY_CONTACT_READY_ALL = (1 << 3) - 1,
78 } EmpathyContactReady;
79
80 GType empathy_contact_get_type (void) G_GNUC_CONST;
81 EmpathyContact * empathy_contact_new (McAccount *account);
82 EmpathyContact * empathy_contact_new_full (McAccount *account, const gchar *id,
83     const gchar *name);
84 const gchar * empathy_contact_get_id (EmpathyContact *contact);
85 void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
86 const gchar * empathy_contact_get_name (EmpathyContact *contact);
87 void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
88 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
89 void empathy_contact_set_avatar (EmpathyContact *contact,
90     EmpathyAvatar *avatar);
91 McAccount * empathy_contact_get_account (EmpathyContact *contact);
92 void empathy_contact_set_account (EmpathyContact *contact, McAccount *account);
93 McPresence empathy_contact_get_presence (EmpathyContact *contact);
94 void empathy_contact_set_presence (EmpathyContact *contact,
95     McPresence presence);
96 const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
97 void empathy_contact_set_presence_message (EmpathyContact *contact,
98     const gchar *message);
99 guint empathy_contact_get_handle (EmpathyContact *contact);
100 void empathy_contact_set_handle (EmpathyContact *contact, guint handle);
101 EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact);
102 void empathy_contact_set_capabilities (EmpathyContact *contact,
103     EmpathyCapabilities capabilities);
104 EmpathyContactReady empathy_contact_get_ready (EmpathyContact *contact);
105 gboolean empathy_contact_is_user (EmpathyContact *contact);
106 void empathy_contact_set_is_user (EmpathyContact *contact,
107     gboolean is_user);
108 gboolean empathy_contact_is_online (EmpathyContact *contact);
109 const gchar * empathy_contact_get_status (EmpathyContact *contact);
110 gboolean empathy_contact_can_voip (EmpathyContact *contact);
111 gboolean empathy_contact_equal (gconstpointer v1, gconstpointer v2);
112 guint empathy_contact_hash (gconstpointer key);
113 void empathy_contact_run_until_ready (EmpathyContact *contact,
114     EmpathyContactReady ready, GMainLoop **loop);
115 void empathy_contact_load_avatar_data (EmpathyContact *contact,
116     const guchar *data, const gsize len, const gchar *format,
117     const gchar *token);
118 gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
119     const gchar *token);
120
121 #define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())
122 GType empathy_avatar_get_type (void) G_GNUC_CONST;
123 EmpathyAvatar * empathy_avatar_new (guchar *data,
124     gsize len,
125     gchar *format,
126     gchar *token);
127 EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
128 void empathy_avatar_unref (EmpathyAvatar *avatar);
129
130 gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
131     const gchar *filename, GError **error);
132
133 G_END_DECLS
134
135 #endif /* __EMPATHY_CONTACT_H__ */