summaryrefslogtreecommitdiff
path: root/src/mcd-account.h
blob: 85a56ccea6c3e72303d8368b8e91b59fa19cccb6 (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
155
/* vi: set et sw=4 ts=8 cino=t0,(0: */
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 8 -*- */
/*
 * mcd-account.h - the Telepathy Account D-Bus interface (service side)
 *
 * Copyright © 2008–2011 Collabora Ltd. <http://www.collabora.co.uk/>
 * Copyright © 2008 Nokia Corporation
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * 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_H__
#define __MCD_ACCOUNT_H__

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

G_BEGIN_DECLS
#define MCD_TYPE_ACCOUNT         (mcd_account_get_type ())
#define MCD_ACCOUNT(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), MCD_TYPE_ACCOUNT, McdAccount))
#define MCD_ACCOUNT_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST((k), MCD_TYPE_ACCOUNT, McdAccountClass))
#define MCD_IS_ACCOUNT(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), MCD_TYPE_ACCOUNT))
#define MCD_IS_ACCOUNT_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), MCD_TYPE_ACCOUNT))
#define MCD_ACCOUNT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MCD_TYPE_ACCOUNT, McdAccountClass))

typedef struct _McdAccount McdAccount;
typedef struct _McdAccountPrivate McdAccountPrivate;
typedef struct _McdAccountClass McdAccountClass;

#include "mcd-connection.h"
#include "mcd-account-manager.h"
#include "mcd-dbusprop.h"

struct _McdAccount
{
    GObject parent;
    McdAccountPrivate *priv;
};

typedef enum
{
  MCD_ACCOUNT_ERROR_SET_PARAMETER,
  MCD_ACCOUNT_ERROR_GET_PARAMETER,
} McdAccountError;

GQuark mcd_account_error_quark (void);

#define MCD_ACCOUNT_ERROR (mcd_account_error_quark ())

typedef void (*McdAccountLoadCb) (McdAccount *account,
                                  const GError *error,
                                  gpointer user_data);

struct _McdAccountClass
{
    GObjectClass parent_class;
    /* Used to be get_parameter; set_parameter; delete; load. These are not
     * implementeed in any known subclass of this class, so have been removed;
     * these padding fields are to preserve ABI compatibility.
     */
    GCallback dummy[4];
    gboolean (*check_request) (McdAccount *account, GHashTable *request,
                               GError **error);
    void (*_mc_reserved6) (void);
    void (*_mc_reserved7) (void);
};

GType mcd_account_get_type (void);

McdAccount *mcd_account_new (McdAccountManager *account_manager,
    const gchar *name,
    McdConnectivityMonitor *minotaur,
    McpAccountStorage *storage_plugin);

void mcd_account_delete_async (McdAccount *account,
    McdDBusPropSetFlags flags,
    GAsyncReadyCallback callback,
    gpointer user_data);
gboolean mcd_account_delete_finish (McdAccount *account,
    GAsyncResult *result,
    GError **error);

const gchar *mcd_account_get_unique_name (McdAccount *account);
const gchar *mcd_account_get_object_path (McdAccount *account);

gboolean mcd_account_is_valid (McdAccount *account);

gboolean mcd_account_check_validity (McdAccount *account,
    GError **error);

gboolean mcd_account_is_enabled (McdAccount *account);

const gchar *mcd_account_get_manager_name (McdAccount *account);
const gchar *mcd_account_get_protocol_name (McdAccount *account);
TpConnectionManager *mcd_account_get_cm (McdAccount *account);

void mcd_account_request_presence (McdAccount *account,
				   TpConnectionPresenceType type,
				   const gchar *status, const gchar *message);
void mcd_account_get_current_presence (McdAccount *account,
				       TpConnectionPresenceType *presence,
				       const gchar **status,
				       const gchar **message);
void mcd_account_get_requested_presence (McdAccount *account,
					 TpConnectionPresenceType *presence,
					 const gchar **status,
					 const gchar **message);

gboolean mcd_account_would_like_to_connect (McdAccount *account);

TpConnectionStatus mcd_account_get_connection_status (McdAccount *account);

McdConnection *mcd_account_get_connection (McdAccount *account);

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

void mcd_account_altered_by_plugin (McdAccount *account, const gchar *name);

gchar * mcd_account_dup_display_name (McdAccount *self);

gboolean mcd_account_get_parameter_of_known_type (McdAccount *account,
                                                  const gchar *name,
                                                  const GVariantType *variant_type,
                                                  GType type,
                                                  GValue *parameter,
                                                  GError **error);

gchar * mcd_account_dup_icon (McdAccount *self);

gchar * mcd_account_dup_nickname (McdAccount *self);

McdConnectivityMonitor *mcd_account_get_connectivity_monitor (
    McdAccount *self);

gboolean mcd_account_get_waiting_for_connectivity (McdAccount *self);
void mcd_account_set_waiting_for_connectivity (McdAccount *self,
    gboolean waiting);

McpAccountStorage *mcd_account_get_storage_plugin (McdAccount *account);

G_END_DECLS

#endif