]> git.0d.be Git - empathy.git/blob - libempathy/empathy-contact.h
add a copy of the LGPLv2.1
[empathy.git] / libempathy / empathy-contact.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 /*
3  * Copyright (C) 2007-2009 Collabora Ltd.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library 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  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18  *
19  * Authors: Xavier Claessens <xclaesse@gmail.com>
20  */
21
22 #ifndef __EMPATHY_CONTACT_H__
23 #define __EMPATHY_CONTACT_H__
24
25 #include <glib-object.h>
26
27 #include <telepathy-glib/contact.h>
28 #include <telepathy-glib/account.h>
29 #ifdef ENABLE_TPL
30 #include <telepathy-logger/contact.h>
31 #endif /* ENABLE_TPL */
32
33 G_BEGIN_DECLS
34
35 #define EMPATHY_TYPE_CONTACT         (empathy_contact_get_type ())
36 #define EMPATHY_CONTACT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT, EmpathyContact))
37 #define EMPATHY_CONTACT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
38 #define EMPATHY_IS_CONTACT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT))
39 #define EMPATHY_IS_CONTACT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT))
40 #define EMPATHY_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
41
42 typedef struct _EmpathyContact      EmpathyContact;
43 typedef struct _EmpathyContactClass EmpathyContactClass;
44
45 struct _EmpathyContact
46 {
47   GObject parent;
48   gpointer priv;
49 };
50
51 struct _EmpathyContactClass
52 {
53   GObjectClass parent_class;
54 };
55
56 typedef struct {
57   guchar *data;
58   gsize len;
59   gchar *format;
60   gchar *token;
61   gchar *filename;
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_FT = 1 << 2,
70   EMPATHY_CAPABILITIES_STREAM_TUBE = 1 << 3,
71   EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
72 } EmpathyCapabilities;
73
74 GType empathy_contact_get_type (void) G_GNUC_CONST;
75 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
76 #ifdef ENABLE_TPL
77 EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account,
78     TplContact *tpl_contact);
79 #endif /* ENABLE_TPL */
80 EmpathyContact * empathy_contact_new_for_log (TpAccount *account,
81     const gchar *id, const gchar *name, gboolean is_user);
82 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
83 const gchar * empathy_contact_get_id (EmpathyContact *contact);
84 void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
85 const gchar * empathy_contact_get_name (EmpathyContact *contact);
86 void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
87 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
88 void empathy_contact_set_avatar (EmpathyContact *contact,
89     EmpathyAvatar *avatar);
90 TpAccount * empathy_contact_get_account (EmpathyContact *contact);
91 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
92 TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
93 void empathy_contact_set_presence (EmpathyContact *contact,
94     TpConnectionPresenceType presence);
95 const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
96 void empathy_contact_set_presence_message (EmpathyContact *contact,
97     const gchar *message);
98 guint empathy_contact_get_handle (EmpathyContact *contact);
99 void empathy_contact_set_handle (EmpathyContact *contact, guint handle);
100 EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact);
101 void empathy_contact_set_capabilities (EmpathyContact *contact,
102     EmpathyCapabilities capabilities);
103 gboolean empathy_contact_is_user (EmpathyContact *contact);
104 void empathy_contact_set_is_user (EmpathyContact *contact,
105     gboolean is_user);
106 gboolean empathy_contact_is_online (EmpathyContact *contact);
107 const gchar * empathy_contact_get_status (EmpathyContact *contact);
108 gboolean empathy_contact_can_voip (EmpathyContact *contact);
109 gboolean empathy_contact_can_voip_audio (EmpathyContact *contact);
110 gboolean empathy_contact_can_voip_video (EmpathyContact *contact);
111 gboolean empathy_contact_can_send_files (EmpathyContact *contact);
112 gboolean empathy_contact_can_use_stream_tube (EmpathyContact *contact);
113
114 void empathy_contact_load_avatar_data (EmpathyContact *contact,
115     const guchar *data, const gsize len, const gchar *format,
116     const gchar *token);
117 gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
118     const gchar *token);
119
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     gchar *filename);
128 EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
129 void empathy_avatar_unref (EmpathyAvatar *avatar);
130
131 gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
132     const gchar *filename, GError **error);
133
134 GHashTable * empathy_contact_get_location (EmpathyContact *contact);
135 void empathy_contact_set_location (EmpathyContact *contact,
136     GHashTable *location);
137 gboolean empathy_contact_equal (gconstpointer contact1,
138     gconstpointer contact2);
139
140 G_END_DECLS
141
142 #endif /* __EMPATHY_CONTACT_H__ */