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