]> git.0d.be Git - empathy.git/blob - libempathy/empathy-contact.h
Add empathy_contact_new_static() to create a contact that comes from logs
[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 <libmissioncontrol/mc-account.h>
29
30 G_BEGIN_DECLS
31
32 #define EMPATHY_TYPE_CONTACT         (empathy_contact_get_type ())
33 #define EMPATHY_CONTACT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT, EmpathyContact))
34 #define EMPATHY_CONTACT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
35 #define EMPATHY_IS_CONTACT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT))
36 #define EMPATHY_IS_CONTACT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT))
37 #define EMPATHY_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
38
39 typedef struct _EmpathyContact      EmpathyContact;
40 typedef struct _EmpathyContactClass EmpathyContactClass;
41
42 struct _EmpathyContact
43 {
44   GObject parent;
45   gpointer priv;
46 };
47
48 struct _EmpathyContactClass
49 {
50   GObjectClass parent_class;
51 };
52
53 typedef struct {
54   guchar *data;
55   gsize len;
56   gchar *format;
57   gchar *token;
58   guint refcount;
59 } EmpathyAvatar;
60
61 typedef enum {
62   EMPATHY_CAPABILITIES_NONE = 0,
63   EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
64   EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
65   EMPATHY_CAPABILITIES_FT = 1 << 2,
66   EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
67 } EmpathyCapabilities;
68
69 GType empathy_contact_get_type (void) G_GNUC_CONST;
70 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
71 EmpathyContact * empathy_contact_new_static (McAccount *account,
72     const gchar *id, const gchar *name, gboolean is_user);
73 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
74 const gchar * empathy_contact_get_id (EmpathyContact *contact);
75 void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
76 const gchar * empathy_contact_get_name (EmpathyContact *contact);
77 void empathy_contact_set_name (EmpathyContact *contact, const gchar *name);
78 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
79 void empathy_contact_set_avatar (EmpathyContact *contact,
80     EmpathyAvatar *avatar);
81 McAccount * empathy_contact_get_account (EmpathyContact *contact);
82 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
83 McPresence empathy_contact_get_presence (EmpathyContact *contact);
84 void empathy_contact_set_presence (EmpathyContact *contact,
85     McPresence presence);
86 const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
87 void empathy_contact_set_presence_message (EmpathyContact *contact,
88     const gchar *message);
89 guint empathy_contact_get_handle (EmpathyContact *contact);
90 void empathy_contact_set_handle (EmpathyContact *contact, guint handle);
91 EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact);
92 void empathy_contact_set_capabilities (EmpathyContact *contact,
93     EmpathyCapabilities capabilities);
94 gboolean empathy_contact_is_user (EmpathyContact *contact);
95 void empathy_contact_set_is_user (EmpathyContact *contact,
96     gboolean is_user);
97 gboolean empathy_contact_is_online (EmpathyContact *contact);
98 const gchar * empathy_contact_get_status (EmpathyContact *contact);
99 gboolean empathy_contact_can_voip (EmpathyContact *contact);
100 gboolean empathy_contact_can_send_files (EmpathyContact *contact);
101 guint empathy_contact_hash (gconstpointer key);
102
103 void empathy_contact_load_avatar_data (EmpathyContact *contact,
104     const guchar *data, const gsize len, const gchar *format,
105     const gchar *token);
106 gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
107     const gchar *token);
108
109
110 #define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())
111 GType empathy_avatar_get_type (void) G_GNUC_CONST;
112 EmpathyAvatar * empathy_avatar_new (guchar *data,
113     gsize len,
114     gchar *format,
115     gchar *token);
116 EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
117 void empathy_avatar_unref (EmpathyAvatar *avatar);
118
119 gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
120     const gchar *filename, GError **error);
121
122 G_END_DECLS
123
124 #endif /* __EMPATHY_CONTACT_H__ */