1 /* vi: set et sw=4 ts=8 cino=t0,(0: */
2 /* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
3 /*
4 * This file is part of mission-control
5 *
6 * Copyright (C) 2007-2009 Nokia Corporation.
7 * Copyright (C) 2009 Collabora Ltd.
8 *
9 * Contact: Naba Kumar <naba.kumar@nokia.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public License
13 * version 2.1 as published by the Free Software Foundation.
14 *
15 * This library is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27 #ifndef __MCD_ACCOUNT_PRIV_H__
28 #define __MCD_ACCOUNT_PRIV_H__
29
30 #include "mcd-account.h"
31 #include "mcd-account-config.h"
32 #include "mcd-channel.h"
33 #include "mcd-dbusprop.h"
34 #include "request.h"
35
36 #include <telepathy-glib/proxy-subclass.h>
37
38 /* auto-generated stubs */
39 #include "_gen/svc-Account_Interface_Conditions.h"
40 #include "_gen/svc-Account_Interface_External_Password_Storage.h"
41 #include "_gen/svc-Account_Interface_Hidden.h"
42
43 #include "_gen/cli-Connection_Manager_Interface_Account_Storage.h"
44
45 G_GNUC_INTERNAL void _mcd_account_maybe_autoconnect (McdAccount *account);
46 G_GNUC_INTERNAL void _mcd_account_connect (McdAccount *account,
47 GHashTable *params);
48
49
50 typedef void (McdAccountSetParametersCb) (McdAccount *account,
51 GPtrArray *not_yet,
52 const GError *error,
53 gpointer user_data);
54
55 G_GNUC_INTERNAL void _mcd_account_set_parameters (McdAccount *account,
56 GHashTable *params,
57 const gchar **unset,
58 McdAccountSetParametersCb callback,
59 gpointer user_data);
60
61 G_GNUC_INTERNAL void _mcd_account_request_temporary_presence (McdAccount *self,
62 TpConnectionPresenceType type, const gchar *status);
63
64 G_GNUC_INTERNAL GKeyFile *_mcd_account_get_keyfile (McdAccount *account);
65
66 G_GNUC_INTERNAL void _mcd_account_set_has_been_online (McdAccount *account);
67
68 G_GNUC_INTERNAL void _mcd_account_set_normalized_name (McdAccount *account,
69 const gchar *name);
70
71 G_GNUC_INTERNAL gboolean _mcd_account_set_avatar (McdAccount *account,
72 const GArray *avatar,
73 const gchar *mime_type,
74 const gchar *token,
75 GError **error);
76 G_GNUC_INTERNAL void _mcd_account_get_avatar (McdAccount *account,
77 GArray **avatar,
78 gchar **mime_type);
79 G_GNUC_INTERNAL void _mcd_account_set_avatar_token (McdAccount *account,
80 const gchar *token);
81 G_GNUC_INTERNAL gchar *_mcd_account_get_avatar_token (McdAccount *account);
82
83 G_GNUC_INTERNAL void _mcd_account_set_alias (McdAccount *account,
84 const gchar *alias);
85
86 G_GNUC_INTERNAL GPtrArray *_mcd_account_get_supersedes (McdAccount *self);
87
88 G_GNUC_INTERNAL void _mcd_account_tp_connection_changed (McdAccount *account,
89 TpConnection *tp_conn);
90
91 G_GNUC_INTERNAL void _mcd_account_load (McdAccount *account,
92 McdAccountLoadCb callback,
93 gpointer user_data);
94 G_GNUC_INTERNAL void _mcd_account_set_connection (McdAccount *account,
95 McdConnection *connection);
96 G_GNUC_INTERNAL void _mcd_account_set_connection_status
97 (McdAccount *account, TpConnectionStatus status,
98 TpConnectionStatusReason reason, TpConnection *tp_conn,
99 const gchar *dbus_error, const GHashTable *details);
100
101 typedef void (*McdOnlineRequestCb) (McdAccount *account, gpointer userdata,
102 const GError *error);
103 void _mcd_account_online_request (McdAccount *account,
104 McdOnlineRequestCb callback,
105 gpointer userdata);
106 void _mcd_account_connect_with_auto_presence (McdAccount *account,
107 gboolean user_initiated);
108
109 G_GNUC_INTERNAL McdStorage *_mcd_account_get_storage (McdAccount *account);
110
111 static inline void
_mcd_account_write_conf(McdAccount * account)112 _mcd_account_write_conf (McdAccount *account)
113 {
114 McdStorage *storage = _mcd_account_get_storage (account);
115
116 g_return_if_fail (MCD_IS_STORAGE (storage));
117
118 mcd_storage_commit (storage, mcd_account_get_unique_name (account));
119 }
120
121 G_GNUC_INTERNAL void _mcd_account_connection_begin (McdAccount *account,
122 gboolean user_initiated);
123
124 extern const McdDBusProp account_channelrequests_properties[];
125
126 G_GNUC_INTERNAL McdChannel *_mcd_account_create_request (
127 McdClientRegistry *clients, McdAccount *account,
128 GHashTable *properties, gint64 user_action_time,
129 const gchar *preferred_handler, GHashTable *request_metadata,
130 gboolean use_existing,
131 McdRequest **request_out, GError **error);
132
133 typedef struct _McdAccountConnectionContext McdAccountConnectionContext;
134
135 G_GNUC_INTERNAL
136 McdAccountConnectionContext *_mcd_account_get_connection_context
137 (McdAccount *self);
138
139 G_GNUC_INTERNAL
140 void _mcd_account_set_connection_context (McdAccount *self,
141 McdAccountConnectionContext *c);
142
143 G_GNUC_INTERNAL void _mcd_account_connection_context_free
144 (McdAccountConnectionContext *c);
145
146 typedef void (*McdAccountDupParametersCb) (McdAccount *account,
147 GHashTable *params,
148 gpointer user_data);
149
150 G_GNUC_INTERNAL G_GNUC_WARN_UNUSED_RESULT
151 GHashTable *_mcd_account_dup_parameters (McdAccount *account);
152
153 extern const McdDBusProp account_conditions_properties[];
154
155 void account_conditions_iface_init (McSvcAccountInterfaceConditionsClass *iface,
156 gpointer iface_data);
157
158 G_GNUC_INTERNAL gboolean _mcd_account_check_request_real (McdAccount *account,
159 GHashTable *request,
160 GError **error);
161
162 G_GNUC_INTERNAL gboolean _mcd_account_get_always_on (McdAccount *self);
163
164 G_GNUC_INTERNAL void _mcd_account_set_changing_presence (McdAccount *self,
165 gboolean value);
166 G_GNUC_INTERNAL gboolean _mcd_account_set_enabled (McdAccount *account,
167 gboolean enabled,
168 gboolean write_out,
169 McdDBusPropSetFlags flags,
170 GError **error);
171
172 G_GNUC_INTERNAL gboolean _mcd_account_presence_type_is_settable (
173 TpConnectionPresenceType type);
174
175 gboolean _mcd_account_is_hidden (McdAccount *account);
176
177 G_GNUC_INTERNAL gboolean _mcd_account_needs_dispatch (McdAccount *account);
178
179 G_GNUC_INTERNAL void _mcd_account_reconnect (McdAccount *self,
180 gboolean user_initiated);
181
182
183 #endif /* __MCD_ACCOUNT_PRIV_H__ */
184