summaryrefslogtreecommitdiff
path: root/src/mcd-account-priv.h
blob: c4991325578b4742bc39e4c2e3c04235efced42e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/* vi: set et sw=4 ts=8 cino=t0,(0: */
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
/*
 * This file is part of mission-control
 *
 * Copyright (C) 2007-2009 Nokia Corporation.
 * Copyright (C) 2009 Collabora Ltd.
 *
 * Contact: Naba Kumar  <naba.kumar@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * version 2.1 as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef __MCD_ACCOUNT_PRIV_H__
#define __MCD_ACCOUNT_PRIV_H__

#include "mcd-account.h"
#include "mcd-account-config.h"
#include "mcd-channel.h"
#include "mcd-dbusprop.h"
#include "request.h"

#include <telepathy-glib/proxy-subclass.h>

G_GNUC_INTERNAL void _mcd_account_maybe_autoconnect (McdAccount *account);
G_GNUC_INTERNAL void _mcd_account_connect (McdAccount *account,
                                           GHashTable *params);


typedef void (McdAccountSetParametersCb) (McdAccount *account,
                                          GPtrArray *not_yet,
                                          const GError *error,
                                          gpointer user_data);

G_GNUC_INTERNAL void _mcd_account_set_parameters (McdAccount *account,
                                                  GHashTable *params,
                                                  const gchar **unset,
                                                  McdAccountSetParametersCb callback,
                                                  gpointer user_data);

G_GNUC_INTERNAL void _mcd_account_request_temporary_presence (McdAccount *self,
    TpConnectionPresenceType type, const gchar *status);

G_GNUC_INTERNAL GKeyFile *_mcd_account_get_keyfile (McdAccount *account);

G_GNUC_INTERNAL void _mcd_account_set_has_been_online (McdAccount *account);

G_GNUC_INTERNAL void _mcd_account_set_normalized_name (McdAccount *account,
                                                       const gchar *name);

G_GNUC_INTERNAL gboolean _mcd_account_set_avatar (McdAccount *account,
                                                  const GArray *avatar,
                                                  const gchar *mime_type,
                                                  const gchar *token,
                                                  GError **error);
G_GNUC_INTERNAL void _mcd_account_get_avatar (McdAccount *account,
                                              GArray **avatar,
                                              gchar **mime_type);
G_GNUC_INTERNAL void _mcd_account_set_avatar_token (McdAccount *account,
                                                    const gchar *token);
G_GNUC_INTERNAL gchar *_mcd_account_get_avatar_token (McdAccount *account);

G_GNUC_INTERNAL void _mcd_account_set_alias (McdAccount *account,
                                             const gchar *alias);

G_GNUC_INTERNAL GPtrArray *_mcd_account_get_supersedes (McdAccount *self);

G_GNUC_INTERNAL void _mcd_account_tp_connection_changed (McdAccount *account,
    TpConnection *tp_conn);

G_GNUC_INTERNAL void _mcd_account_load (McdAccount *account,
                                        McdAccountLoadCb callback,
                                        gpointer user_data);
G_GNUC_INTERNAL void _mcd_account_set_connection (McdAccount *account,
                                                  McdConnection *connection);
G_GNUC_INTERNAL void _mcd_account_set_connection_status
    (McdAccount *account, TpConnectionStatus status,
     TpConnectionStatusReason reason, TpConnection *tp_conn,
     const gchar *dbus_error, const GHashTable *details);

typedef void (*McdOnlineRequestCb) (McdAccount *account, gpointer userdata,
				    const GError *error);
void _mcd_account_online_request (McdAccount *account,
                                  McdOnlineRequestCb callback,
                                  gpointer userdata);
void _mcd_account_connect_with_auto_presence (McdAccount *account,
                                              gboolean user_initiated);

G_GNUC_INTERNAL McdStorage *_mcd_account_get_storage (McdAccount *account);

static inline void
_mcd_account_write_conf (McdAccount *account)
{
    McdStorage *storage = _mcd_account_get_storage (account);

    g_return_if_fail (MCD_IS_STORAGE (storage));

    mcd_storage_commit (storage, mcd_account_get_unique_name (account));
}

G_GNUC_INTERNAL void _mcd_account_connection_begin (McdAccount *account,
                                                    gboolean user_initiated);

extern const McdDBusProp account_channelrequests_properties[];

G_GNUC_INTERNAL McdChannel *_mcd_account_create_request (
    McdClientRegistry *clients, McdAccount *account,
    GHashTable *properties, gint64 user_action_time,
    const gchar *preferred_handler, GHashTable *request_metadata,
    gboolean use_existing,
    McdRequest **request_out, GError **error);

typedef void (*McdAccountDupParametersCb) (McdAccount *account,
                                           GHashTable *params,
                                           gpointer user_data);

G_GNUC_INTERNAL G_GNUC_WARN_UNUSED_RESULT
GHashTable *_mcd_account_dup_parameters (McdAccount *account);

G_GNUC_INTERNAL gboolean _mcd_account_check_request_real (McdAccount *account,
                                                          GHashTable *request,
                                                          GError **error);

G_GNUC_INTERNAL void _mcd_account_set_changing_presence (McdAccount *self,
                                                         gboolean value);
G_GNUC_INTERNAL gboolean _mcd_account_set_enabled (McdAccount *account,
                                                   gboolean enabled,
                                                   gboolean write_out,
                                                   McdDBusPropSetFlags flags,
                                                   GError **error);

G_GNUC_INTERNAL gboolean _mcd_account_presence_type_is_settable (
        TpConnectionPresenceType type);

G_GNUC_INTERNAL gboolean _mcd_account_needs_dispatch (McdAccount *account);

G_GNUC_INTERNAL void _mcd_account_reconnect (McdAccount *self,
    gboolean user_initiated);


#endif /* __MCD_ACCOUNT_PRIV_H__ */