]> git.0d.be Git - empathy.git/blob - libempathy/empathy-contact.h
individual-menu: remove link-contacts-activated signal
[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 #include <telepathy-logger/entity.h>
30 #include <folks/folks.h>
31
32 G_BEGIN_DECLS
33
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))
40
41 typedef struct _EmpathyContact      EmpathyContact;
42 typedef struct _EmpathyContactClass EmpathyContactClass;
43
44 struct _EmpathyContact
45 {
46   GObject parent;
47   gpointer priv;
48 };
49
50 struct _EmpathyContactClass
51 {
52   GObjectClass parent_class;
53 };
54
55 typedef struct {
56   guchar *data;
57   gsize len;
58   gchar *format;
59   gchar *token;
60   gchar *filename;
61   guint refcount;
62 } EmpathyAvatar;
63
64 typedef enum {
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_SMS = 1 << 4,
71   EMPATHY_CAPABILITIES_UNKNOWN = 1 << 7
72 } EmpathyCapabilities;
73
74 GType empathy_contact_get_type (void) G_GNUC_CONST;
75 EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account,
76     TplEntity *tpl_contact);
77 TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact);
78 const gchar * empathy_contact_get_id (EmpathyContact *contact);
79 const gchar * empathy_contact_get_alias (EmpathyContact *contact);
80 const gchar * empathy_contact_get_logged_alias (EmpathyContact *contact);
81 void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias);
82 void empathy_contact_change_group (EmpathyContact *contact, const gchar *group,
83     gboolean is_member);
84 EmpathyAvatar * empathy_contact_get_avatar (EmpathyContact *contact);
85 TpAccount * empathy_contact_get_account (EmpathyContact *contact);
86 FolksPersona * empathy_contact_get_persona (EmpathyContact *contact);
87 void empathy_contact_set_persona (EmpathyContact *contact,
88     FolksPersona *persona);
89 TpConnection * empathy_contact_get_connection (EmpathyContact *contact);
90 TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact);
91 const gchar * empathy_contact_get_presence_message (EmpathyContact *contact);
92 guint empathy_contact_get_handle (EmpathyContact *contact);
93 EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact);
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_sms (EmpathyContact *contact);
100 gboolean empathy_contact_can_voip (EmpathyContact *contact);
101 gboolean empathy_contact_can_voip_audio (EmpathyContact *contact);
102 gboolean empathy_contact_can_voip_video (EmpathyContact *contact);
103 gboolean empathy_contact_can_send_files (EmpathyContact *contact);
104 gboolean empathy_contact_can_use_rfb_stream_tube (EmpathyContact *contact);
105
106 typedef enum {
107   EMPATHY_ACTION_CHAT,
108   EMPATHY_ACTION_SMS,
109   EMPATHY_ACTION_AUDIO_CALL,
110   EMPATHY_ACTION_VIDEO_CALL,
111   EMPATHY_ACTION_VIEW_LOGS,
112   EMPATHY_ACTION_SEND_FILE,
113   EMPATHY_ACTION_SHARE_MY_DESKTOP,
114 } EmpathyActionType;
115
116 gboolean empathy_contact_can_do_action (EmpathyContact *self,
117     EmpathyActionType action_type);
118
119 #define EMPATHY_TYPE_AVATAR (empathy_avatar_get_type ())
120 GType empathy_avatar_get_type (void) G_GNUC_CONST;
121 EmpathyAvatar * empathy_avatar_new (const guchar *data,
122     gsize len,
123     const gchar *format,
124     const gchar *filename);
125 EmpathyAvatar * empathy_avatar_ref (EmpathyAvatar *avatar);
126 void empathy_avatar_unref (EmpathyAvatar *avatar);
127
128 gboolean empathy_avatar_save_to_file (EmpathyAvatar *avatar,
129     const gchar *filename, GError **error);
130
131 GHashTable * empathy_contact_get_location (EmpathyContact *contact);
132 const gchar * const * empathy_contact_get_client_types (EmpathyContact *contact);
133 gboolean empathy_contact_equal (gconstpointer contact1,
134     gconstpointer contact2);
135
136 EmpathyContact *empathy_contact_dup_from_tp_contact (TpContact *tp_contact);
137 EmpathyContact * empathy_contact_dup_best_for_action (
138     FolksIndividual *individual,
139     EmpathyActionType action_type);
140
141 void empathy_contact_add_to_contact_list (EmpathyContact *self,
142     const gchar *message);
143
144 void empathy_contact_remove_from_contact_list (EmpathyContact *self);
145
146 G_END_DECLS
147
148 #endif /* __EMPATHY_CONTACT_H__ */