1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * Copyright (C) 2007-2009 Collabora Ltd.
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.
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.
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
19 * Authors: Xavier Claessens <xclaesse@gmail.com>
22 #ifndef __EMPATHY_CONTACT_H__
23 #define __EMPATHY_CONTACT_H__
25 #include <glib-object.h>
27 #include <telepathy-glib/contact.h>
28 #include <telepathy-glib/account.h>
29 #include <telepathy-logger/entity.h>
30 #include <folks/folks.h>
34 #define EMPATHY_TYPE_CONTACT (empathy_contact_get_type ())
35 #define EMPATHY_CONTACT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EMPATHY_TYPE_CONTACT, EmpathyContact))
36 #define EMPATHY_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
37 #define EMPATHY_IS_CONTACT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EMPATHY_TYPE_CONTACT))
38 #define EMPATHY_IS_CONTACT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_CONTACT))
39 #define EMPATHY_CONTACT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_CONTACT, EmpathyContactClass))
41 typedef struct _EmpathyContact EmpathyContact;
42 typedef struct _EmpathyContactClass EmpathyContactClass;
44 struct _EmpathyContact
50 struct _EmpathyContactClass
52 GObjectClass parent_class;
65 EMPATHY_CAPABILITIES_NONE = 0,
66 EMPATHY_CAPABILITIES_AUDIO = 1 << 0,
67 EMPATHY_CAPABILITIES_VIDEO = 1 << 1,
68 EMPATHY_CAPABILITIES_FT = 1 << 2,
69 EMPATHY_CAPABILITIES_RFB_STREAM_TUBE = 1 << 3,
70 EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
71 } EmpathyCapabilities;
73 GType empathy_contact_get_type (void) G_GNUC_CONST;
74 EmpathyContact * empathy_contact_new (TpContact *tp_contact);
75 EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account,
76 TplEntity *tpl_contact);
77 EmpathyContact * empathy_contact_new_for_log (TpAccount *account,
78 const gchar *id, const gchar *alias, gboolean is_user);
79 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
80 const gchar * empathy_contact_get_id (EmpathyContact *contact);
81 void empathy_contact_set_id (EmpathyContact *contact, const gchar *id);
82 const gchar * empathy_contact_get_alias (EmpathyContact *contact);
83 void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias);
84 void empathy_contact_change_group (EmpathyContact *contact, const gchar *group,
86 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
87 void empathy_contact_set_avatar (EmpathyContact *contact,
88 EmpathyAvatar *avatar);
89 TpAccount * empathy_contact_get_account (EmpathyContact *contact);
90 FolksPersona * empathy_contact_get_persona (EmpathyContact *contact);
91 void empathy_contact_set_persona (EmpathyContact *contact,
92 FolksPersona *persona);
93 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
94 TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
95 void empathy_contact_set_presence (EmpathyContact *contact,
96 TpConnectionPresenceType presence);
97 const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
98 void empathy_contact_set_presence_message (EmpathyContact *contact,
99 const gchar *message);
100 guint empathy_contact_get_handle (EmpathyContact *contact);
101 void empathy_contact_set_handle (EmpathyContact *contact, guint handle);
102 EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact);
103 void empathy_contact_set_capabilities (EmpathyContact *contact,
104 EmpathyCapabilities capabilities);
105 gboolean empathy_contact_is_user (EmpathyContact *contact);
106 void empathy_contact_set_is_user (EmpathyContact *contact,
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_can_voip_audio (EmpathyContact *contact);
112 gboolean empathy_contact_can_voip_video (EmpathyContact *contact);
113 gboolean empathy_contact_can_send_files (EmpathyContact *contact);
114 gboolean empathy_contact_can_use_rfb_stream_tube (EmpathyContact *contact);
115 gboolean empathy_contact_load_avatar_cache (EmpathyContact *contact,
119 #define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())
120 GType empathy_avatar_get_type (void) G_GNUC_CONST;
121 EmpathyAvatar * empathy_avatar_new (guchar *data,
126 EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
127 void empathy_avatar_unref (EmpathyAvatar *avatar);
129 gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
130 const gchar *filename, GError **error);
132 GHashTable * empathy_contact_get_location (EmpathyContact *contact);
133 gboolean empathy_contact_equal (gconstpointer contact1,
134 gconstpointer contact2);
136 EmpathyContact *empathy_contact_dup_from_tp_contact (TpContact *tp_contact);
140 #endif /* __EMPATHY_CONTACT_H__ */