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>
27 #include <telepathy-glib/connection.h>
28 #include <telepathy-glib/channel.h>
32 typedef struct _EmpathyDispatchOperation EmpathyDispatchOperation;
33 typedef struct _EmpathyDispatchOperationClass EmpathyDispatchOperationClass;
35 struct _EmpathyDispatchOperationClass {
36 GObjectClass parent_class;
39 struct _EmpathyDispatchOperation {
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;
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,
78 gint64 user_action_time);
80 EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper (
81 TpConnection *connection, TpChannel *channel, EmpathyContact *contact,
83 gint64 user_action_time,
84 GObject *channel_wrapper);
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);
90 /* Returns whether or not the operation was successfully claimed */
91 gboolean empathy_dispatch_operation_claim (EmpathyDispatchOperation *operation);
93 TpChannel *empathy_dispatch_operation_get_channel (
94 EmpathyDispatchOperation *operation);
96 GObject *empathy_dispatch_operation_get_channel_wrapper (
97 EmpathyDispatchOperation *operation);
99 TpConnection *empathy_dispatch_operation_get_tp_connection (
100 EmpathyDispatchOperation *operation);
102 const gchar *empathy_dispatch_operation_get_channel_type (
103 EmpathyDispatchOperation *operation);
105 GQuark empathy_dispatch_operation_get_channel_type_id (
106 EmpathyDispatchOperation *operation);
108 const gchar * empathy_dispatch_operation_get_object_path (
109 EmpathyDispatchOperation *operation);
111 EmpathyDispatchOperationState empathy_dispatch_operation_get_status (
112 EmpathyDispatchOperation *operation);
114 gboolean empathy_dispatch_operation_is_incoming (
115 EmpathyDispatchOperation *operation);
117 void empathy_dispatch_operation_set_user_action_time (
118 EmpathyDispatchOperation *self,
119 gint64 user_action_time);
121 gint64 empathy_dispatch_operation_get_user_action_time (
122 EmpathyDispatchOperation *self);
126 #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/