]> git.0d.be Git - empathy.git/blob - libempathy/empathy-dispatch-operation.h
Add empathy_tp_chat_get_connection() to direct access the channel's connection.
[empathy.git] / libempathy / empathy-dispatch-operation.h
1 /*
2  * empathy-dispatch-operation.h - Header for EmpathyDispatchOperation
3  * Copyright (C) 2008 Collabora Ltd.
4  * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk>
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,
12  * but 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  02110-1301  USA
19  */
20
21 #ifndef __EMPATHY_DISPATCH_OPERATION_H__
22 #define __EMPATHY_DISPATCH_OPERATION_H__
23
24 #include <glib-object.h>
25
26 #include <libempathy/empathy-contact.h>
27
28 G_BEGIN_DECLS
29
30 typedef struct _EmpathyDispatchOperation EmpathyDispatchOperation;
31 typedef struct _EmpathyDispatchOperationClass EmpathyDispatchOperationClass;
32
33 struct _EmpathyDispatchOperationClass {
34     GObjectClass parent_class;
35 };
36
37 struct _EmpathyDispatchOperation {
38     GObject parent;
39 };
40
41 typedef enum {
42     /* waiting for the channel information to be ready */
43     EMPATHY_DISPATCHER_OPERATION_STATE_PREPARING = 0,
44     /* Information gathered ready to be dispatched */
45     EMPATHY_DISPATCHER_OPERATION_STATE_PENDING,
46     /* Send to approving bits for approval */
47     EMPATHY_DISPATCHER_OPERATION_STATE_APPROVING,
48     /* Send to handlers for dispatching */
49     EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING,
50     /* somebody claimed the channel */
51     EMPATHY_DISPATCHER_OPERATION_STATE_CLAIMED,
52     /* dispatch operation invalidated, underlying channel died */
53     EMPATHY_DISPATCHER_OPERATION_STATE_INVALIDATED,
54 } EmpathyDispatchOperationState;
55
56 GType empathy_dispatch_operation_get_type (void);
57
58 /* TYPE MACROS */
59 #define EMPATHY_TYPE_DISPATCH_OPERATION \
60   (empathy_dispatch_operation_get_type())
61 #define EMPATHY_DISPATCH_OPERATION(obj) \
62   (G_TYPE_CHECK_INSTANCE_CAST((obj), EMPATHY_TYPE_DISPATCH_OPERATION, \
63     EmpathyDispatchOperation))
64 #define EMPATHY_DISPATCH_OPERATION_CLASS(klass) \
65   (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_DISPATCH_OPERATION, \
66   EmpathyDispatchOperationClass))
67 #define EMPATHY_IS_DISPATCH_OPERATION(obj) \
68   (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_DISPATCH_OPERATION))
69 #define EMPATHY_IS_DISPATCH_OPERATION_CLASS(klass) \
70   (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_DISPATCH_OPERATION))
71 #define EMPATHY_DISPATCH_OPERATION_GET_CLASS(obj) \
72   (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_DISPATCH_OPERATION, \
73   EmpathyDispatchOperationClass))
74
75 EmpathyDispatchOperation *empathy_dispatch_operation_new (
76   TpConnection *connection, TpChannel *channel, EmpathyContact *contact,
77   gboolean incoming);
78
79 EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper (
80   TpConnection *connection, TpChannel *channel, EmpathyContact *contact,
81   gboolean incoming, GObject *channel_wrapper);
82
83 /* Start the dispatching process, goes to the APPROVING state for incoming
84  * channels and DISPATCHING for outgoing ones */
85 void empathy_dispatch_operation_start (EmpathyDispatchOperation *operation);
86
87 void empathy_dispatch_operation_approve (EmpathyDispatchOperation *operation);
88
89 /* Returns whether or not the operation was successfully claimed */
90 gboolean empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation);
91
92 TpChannel *empathy_dispatch_operation_get_channel (
93   EmpathyDispatchOperation *operation);
94
95 GObject *empathy_dispatch_operation_get_channel_wrapper (
96   EmpathyDispatchOperation *operation);
97
98 TpConnection *empathy_dispatch_operation_get_tp_connection (
99   EmpathyDispatchOperation *operation);
100
101 const gchar *empathy_dispatch_operation_get_channel_type (
102   EmpathyDispatchOperation *operation);
103
104 GQuark empathy_dispatch_operation_get_channel_type_id (
105   EmpathyDispatchOperation *operation);
106
107 const gchar * empathy_dispatch_operation_get_object_path (
108   EmpathyDispatchOperation *operation);
109
110 EmpathyDispatchOperationState empathy_dispatch_operation_get_status (
111   EmpathyDispatchOperation *operation);
112
113 gboolean empathy_dispatch_operation_is_incoming (
114   EmpathyDispatchOperation *operation);
115
116 G_END_DECLS
117
118 #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/