1 /* A Telepathy ChannelRequest object
2  *
3  * Copyright © 2009 Nokia Corporation
4  * Copyright © 2009-2010 Collabora Ltd.
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19  * 02110-1301 USA
20  *
21  */
22 
23 #ifndef MCD_REQUEST_H
24 #define MCD_REQUEST_H
25 
26 #include <telepathy-glib/telepathy-glib.h>
27 
28 #include "client-registry.h"
29 #include "mcd-account.h"
30 
31 G_BEGIN_DECLS
32 
33 typedef struct _McdRequest McdRequest;
34 typedef struct _McdRequestClass McdRequestClass;
35 typedef struct _McdRequestPrivate McdRequestPrivate;
36 
37 typedef void (*McdRequestInternalHandler)
38   (McdRequest *, McdChannel *, gpointer, gboolean);
39 
40 G_GNUC_INTERNAL GType _mcd_request_get_type (void);
41 
42 #define MCD_TYPE_REQUEST \
43   (_mcd_request_get_type ())
44 #define MCD_REQUEST(obj) \
45   (G_TYPE_CHECK_INSTANCE_CAST ((obj), MCD_TYPE_REQUEST, \
46                                McdRequest))
47 #define MCD_REQUEST_CLASS(klass) \
48   (G_TYPE_CHECK_CLASS_CAST ((klass), MCD_TYPE_REQUEST, \
49                             McdRequestClass))
50 #define MCD_IS_REQUEST(obj) \
51   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MCD_TYPE_REQUEST))
52 #define MCD_IS_REQUEST_CLASS(klass) \
53   (G_TYPE_CHECK_CLASS_TYPE ((klass), MCD_TYPE_REQUEST))
54 #define MCD_REQUEST_GET_CLASS(obj) \
55   (G_TYPE_INSTANCE_GET_CLASS ((obj), MCD_TYPE_REQUEST, \
56                               McdRequestClass))
57 
58 G_GNUC_INTERNAL McdRequest *_mcd_request_new (McdClientRegistry *clients,
59     gboolean use_existing,
60     McdAccount *account, GHashTable *properties, gint64 user_action_time,
61     const gchar *preferred_handler,
62     GHashTable *hints);
63 G_GNUC_INTERNAL gboolean _mcd_request_get_use_existing (McdRequest *self);
64 G_GNUC_INTERNAL McdAccount *_mcd_request_get_account (McdRequest *self);
65 G_GNUC_INTERNAL GHashTable *_mcd_request_get_properties (McdRequest *self);
66 G_GNUC_INTERNAL GVariant *mcd_request_dup_properties (McdRequest *self);
67 G_GNUC_INTERNAL gint64 _mcd_request_get_user_action_time (McdRequest *self);
68 G_GNUC_INTERNAL const gchar *_mcd_request_get_preferred_handler (
69     McdRequest *self);
70 G_GNUC_INTERNAL const gchar *_mcd_request_get_object_path (McdRequest *self);
71 G_GNUC_INTERNAL GHashTable *_mcd_request_get_hints (
72     McdRequest *self);
73 
74 G_GNUC_INTERNAL GHashTable *_mcd_request_dup_immutable_properties (
75     McdRequest *self);
76 
77 G_GNUC_INTERNAL void _mcd_request_proceed (McdRequest *self,
78     DBusGMethodInvocation *context);
79 
80 G_GNUC_INTERNAL void _mcd_request_start_delay (McdRequest *self);
81 G_GNUC_INTERNAL void _mcd_request_end_delay (McdRequest *self);
82 
83 G_GNUC_INTERNAL gboolean _mcd_request_is_complete (McdRequest *self);
84 G_GNUC_INTERNAL void _mcd_request_set_success (McdRequest *self,
85     TpChannel *channel);
86 G_GNUC_INTERNAL void _mcd_request_set_failure (McdRequest *self,
87     GQuark domain, gint code, const gchar *message);
88 G_GNUC_INTERNAL GError *_mcd_request_dup_failure (McdRequest *self);
89 
90 G_GNUC_INTERNAL void _mcd_request_set_uncancellable (McdRequest *self);
91 G_GNUC_INTERNAL gboolean _mcd_request_cancel (McdRequest *self,
92     GError **error);
93 
94 G_GNUC_INTERNAL void _mcd_request_predict_handler (McdRequest *self);
95 
96 G_GNUC_INTERNAL void _mcd_request_set_internal_handler (McdRequest *self,
97     McdRequestInternalHandler handler,
98     GFreeFunc free_func,
99     gpointer data);
100 G_GNUC_INTERNAL gboolean _mcd_request_handle_internally (McdRequest *self,
101     McdChannel *channel,
102     gboolean close_after);
103 G_GNUC_INTERNAL void _mcd_request_clear_internal_handler (McdRequest *self);
104 G_GNUC_INTERNAL gboolean _mcd_request_is_internal (McdRequest *self);
105 
106 G_GNUC_INTERNAL guint _mcd_request_block_account (const gchar *account);
107 G_GNUC_INTERNAL guint _mcd_request_unblock_account (const gchar *account);
108 
109 G_END_DECLS
110 
111 #endif
112