2 * empathy-dispatch-operation.h - Header for EmpathyDispatchOperation
3 * Copyright (C) 2008 Collabora Ltd.
4 * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk>
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.
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.
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
21 #ifndef __EMPATHY_DISPATCH_OPERATION_H__
22 #define __EMPATHY_DISPATCH_OPERATION_H__
24 #include <glib-object.h>
26 #include <libempathy/empathy-contact.h>
30 typedef struct _EmpathyDispatchOperation EmpathyDispatchOperation
;
31 typedef struct _EmpathyDispatchOperationClass EmpathyDispatchOperationClass
;
33 struct _EmpathyDispatchOperationClass
{
34 GObjectClass parent_class
;
37 struct _EmpathyDispatchOperation
{
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
;
56 GType
empathy_dispatch_operation_get_type (void);
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))
75 EmpathyDispatchOperation
*empathy_dispatch_operation_new (
76 TpConnection
*connection
, TpChannel
*channel
, EmpathyContact
*contact
,
79 EmpathyDispatchOperation
*empathy_dispatch_operation_new_with_wrapper (
80 TpConnection
*connection
, TpChannel
*channel
, EmpathyContact
*contact
,
81 gboolean incoming
, GObject
*channel_wrapper
);
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
);
87 void empathy_dispatch_operation_approve (EmpathyDispatchOperation
*operation
);
89 /* Returns whether or not the operation was successfully claimed */
90 gboolean
empathy_dispatch_operation_claim (EmpathyDispatchOperation
*operation
);
92 TpChannel
*empathy_dispatch_operation_get_channel (
93 EmpathyDispatchOperation
*operation
);
95 GObject
*empathy_dispatch_operation_get_channel_wrapper (
96 EmpathyDispatchOperation
*operation
);
98 TpConnection
*empathy_dispatch_operation_get_tp_connection (
99 EmpathyDispatchOperation
*operation
);
101 const gchar
*empathy_dispatch_operation_get_channel_type (
102 EmpathyDispatchOperation
*operation
);
104 GQuark
empathy_dispatch_operation_get_channel_type_id (
105 EmpathyDispatchOperation
*operation
);
107 const gchar
* empathy_dispatch_operation_get_object_path (
108 EmpathyDispatchOperation
*operation
);
110 EmpathyDispatchOperationState
empathy_dispatch_operation_get_status (
111 EmpathyDispatchOperation
*operation
);
113 gboolean
empathy_dispatch_operation_is_incoming (
114 EmpathyDispatchOperation
*operation
);
118 #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/