]> git.0d.be Git - empathy.git/blob - libempathy/empathy-dispatch-operation.h
b7614234f540d347651992606f11828a2fa7a8de
[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 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   gint64 user_action_time);
79
80 EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper (
81   TpConnection *connection, TpChannel *channel, EmpathyContact *contact,
82   gboolean incoming,
83   gint64 user_action_time,
84   GObject *channel_wrapper);
85
86 /* Start the dispatching process, goes to the APPROVING state for incoming
87  * channels and DISPATCHING for outgoing ones */
88 void empathy_dispatch_operation_start (EmpathyDispatchOperation *operation);
89
90 /* Returns whether or not the operation was successfully claimed */
91 gboolean empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation);
92
93 TpChannel *empathy_dispatch_operation_get_channel (
94   EmpathyDispatchOperation *operation);
95
96 GObject *empathy_dispatch_operation_get_channel_wrapper (
97   EmpathyDispatchOperation *operation);
98
99 TpConnection *empathy_dispatch_operation_get_tp_connection (
100   EmpathyDispatchOperation *operation);
101
102 const gchar *empathy_dispatch_operation_get_channel_type (
103   EmpathyDispatchOperation *operation);
104
105 GQuark empathy_dispatch_operation_get_channel_type_id (
106   EmpathyDispatchOperation *operation);
107
108 const gchar * empathy_dispatch_operation_get_object_path (
109   EmpathyDispatchOperation *operation);
110
111 EmpathyDispatchOperationState empathy_dispatch_operation_get_status (
112   EmpathyDispatchOperation *operation);
113
114 gboolean empathy_dispatch_operation_is_incoming (
115   EmpathyDispatchOperation *operation);
116
117 void empathy_dispatch_operation_set_user_action_time (
118     EmpathyDispatchOperation *self,
119     gint64 user_action_time);
120
121 gint64 empathy_dispatch_operation_get_user_action_time (
122     EmpathyDispatchOperation *self);
123
124 G_END_DECLS
125
126 #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/