diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-04 20:20:15 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-05-04 20:20:15 +0800 |
commit | bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0 (patch) | |
tree | 5104009c41478f4672ad3deab29c03b50e54df3b /libempathy | |
parent | 046792f3fd596574132fe1d6217dd1877bffe743 (diff) | |
parent | 61de8fbbea5d8d096aafcaa8c2b8093d0f349c87 (diff) | |
download | gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar.gz gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar.bz2 gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar.lz gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar.xz gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.tar.zst gsoc2013-empathy-bb4750da5ff85a61e8e9d4643fc63fbefe34a1c0.zip |
Merge branch 'timestamp-615976'
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-call-handler.c | 5 | ||||
-rw-r--r-- | libempathy/empathy-call-handler.h | 3 | ||||
-rw-r--r-- | libempathy/empathy-dispatch-operation.c | 46 | ||||
-rw-r--r-- | libempathy/empathy-dispatch-operation.h | 14 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.c | 36 | ||||
-rw-r--r-- | libempathy/empathy-dispatcher.h | 22 | ||||
-rw-r--r-- | libempathy/empathy-ft-handler.c | 3 | ||||
-rw-r--r-- | libempathy/empathy-tp-chat.c | 2 |
8 files changed, 105 insertions, 26 deletions
diff --git a/libempathy/empathy-call-handler.c b/libempathy/empathy-call-handler.c index a49baed44..ec8b055c2 100644 --- a/libempathy/empathy-call-handler.c +++ b/libempathy/empathy-call-handler.c @@ -487,7 +487,8 @@ empathy_call_handler_request_cb (EmpathyDispatchOperation *operation, } void -empathy_call_handler_start_call (EmpathyCallHandler *handler) +empathy_call_handler_start_call (EmpathyCallHandler *handler, + gint64 timestamp) { EmpathyCallHandlerPriv *priv = GET_PRIV (handler); @@ -536,7 +537,7 @@ empathy_call_handler_start_call (EmpathyCallHandler *handler) g_hash_table_insert (request, TP_IFACE_CHANNEL ".TargetHandle", value); empathy_dispatcher_create_channel (dispatcher, connection, - request, empathy_call_handler_request_cb, handler); + request, timestamp, empathy_call_handler_request_cb, handler); g_object_unref (dispatcher); } diff --git a/libempathy/empathy-call-handler.h b/libempathy/empathy-call-handler.h index 1f67fe56b..f0be11ba5 100644 --- a/libempathy/empathy-call-handler.h +++ b/libempathy/empathy-call-handler.h @@ -70,7 +70,8 @@ EmpathyCallHandler * empathy_call_handler_new_for_contact_with_streams ( EmpathyCallHandler * empathy_call_handler_new_for_channel ( EmpathyTpCall *call); -void empathy_call_handler_start_call (EmpathyCallHandler *handler); +void empathy_call_handler_start_call (EmpathyCallHandler *handler, + gint64 timestamp); void empathy_call_handler_stop_call (EmpathyCallHandler *handler); gboolean empathy_call_handler_has_initial_video (EmpathyCallHandler *handler); diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c index 6120f8e05..08013889e 100644 --- a/libempathy/empathy-dispatch-operation.c +++ b/libempathy/empathy-dispatch-operation.c @@ -70,6 +70,7 @@ enum { PROP_CONTACT, PROP_INCOMING, PROP_STATUS, + PROP_USER_ACTION_TIME, }; /* private structure */ @@ -85,6 +86,7 @@ struct _EmpathyDispatchOperationPriv EmpathyContact *contact; EmpathyDispatchOperationState status; gboolean incoming; + gint64 user_action_time; gboolean approved; gulong invalidated_handler; gulong ready_handler; @@ -132,6 +134,10 @@ empathy_dispatch_operation_set_property (GObject *object, case PROP_INCOMING: priv->incoming = g_value_get_boolean (value); break; + + case PROP_USER_ACTION_TIME: + priv->user_action_time = g_value_get_int64 (value); + break; } } @@ -162,6 +168,9 @@ empathy_dispatch_operation_get_property (GObject *object, case PROP_STATUS: g_value_set_enum (value, priv->status); break; + case PROP_USER_ACTION_TIME: + g_value_set_int64 (value, priv->user_action_time); + break; } } @@ -357,6 +366,13 @@ empathy_dispatch_operation_class_init ( EMPATHY_TYPE_DISPATCH_OPERATION_STATE, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); g_object_class_install_property (object_class, PROP_STATUS, param_spec); + + param_spec = g_param_spec_int64 ("user-action-time", + "user action time", "The user action time of the operation", + G_MININT64, G_MAXINT64, 0, + G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_USER_ACTION_TIME, + param_spec); } void @@ -492,8 +508,11 @@ out: } EmpathyDispatchOperation * -empathy_dispatch_operation_new (TpConnection *connection, TpChannel *channel, - EmpathyContact *contact, gboolean incoming) +empathy_dispatch_operation_new (TpConnection *connection, + TpChannel *channel, + EmpathyContact *contact, + gboolean incoming, + gint64 user_action_time) { g_return_val_if_fail (connection != NULL, NULL); g_return_val_if_fail (channel != NULL, NULL); @@ -503,6 +522,7 @@ empathy_dispatch_operation_new (TpConnection *connection, TpChannel *channel, "channel", channel, "contact", contact, "incoming", incoming, + "user-action-time", user_action_time, NULL); } @@ -681,3 +701,25 @@ empathy_dispatch_operation_is_incoming (EmpathyDispatchOperation *operation) return priv->incoming; } + +void +empathy_dispatch_operation_set_user_action_time ( + EmpathyDispatchOperation *self, + gint64 user_action_time) +{ + EmpathyDispatchOperationPriv *priv = GET_PRIV (self); + + priv->user_action_time = user_action_time; +} + +gint64 +empathy_dispatch_operation_get_user_action_time (EmpathyDispatchOperation *self) +{ + EmpathyDispatchOperationPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_DISPATCH_OPERATION (self), FALSE); + + priv = GET_PRIV (self); + + return priv->user_action_time; +} diff --git a/libempathy/empathy-dispatch-operation.h b/libempathy/empathy-dispatch-operation.h index 148adec90..f199be521 100644 --- a/libempathy/empathy-dispatch-operation.h +++ b/libempathy/empathy-dispatch-operation.h @@ -76,11 +76,14 @@ GType empathy_dispatch_operation_get_type (void); EmpathyDispatchOperation *empathy_dispatch_operation_new ( TpConnection *connection, TpChannel *channel, EmpathyContact *contact, - gboolean incoming); + gboolean incoming, + gint64 user_action_time); EmpathyDispatchOperation *empathy_dispatch_operation_new_with_wrapper ( TpConnection *connection, TpChannel *channel, EmpathyContact *contact, - gboolean incoming, GObject *channel_wrapper); + gboolean incoming, + gint64 user_action_time, + GObject *channel_wrapper); /* Start the dispatching process, goes to the APPROVING state for incoming * channels and DISPATCHING for outgoing ones */ @@ -115,6 +118,13 @@ EmpathyDispatchOperationState empathy_dispatch_operation_get_status ( gboolean empathy_dispatch_operation_is_incoming ( EmpathyDispatchOperation *operation); +void empathy_dispatch_operation_set_user_action_time ( + EmpathyDispatchOperation *self, + gint64 user_action_time); + +gint64 empathy_dispatch_operation_get_user_action_time ( + EmpathyDispatchOperation *self); + G_END_DECLS #endif /* #ifndef __EMPATHY_DISPATCH_OPERATION_H__*/ diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 027a9601f..2141b0b15 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -141,6 +141,7 @@ typedef struct /* Properties to pass to the channel when requesting it */ GHashTable *request; + gint64 timestamp; EmpathyDispatcherRequestCb *cb; gpointer user_data; gpointer *request_data; @@ -218,6 +219,7 @@ new_dispatcher_request_data (EmpathyDispatcher *self, guint handle_type, guint handle, GHashTable *request, + gint64 timestamp, EmpathyContact *contact, EmpathyDispatcherRequestCb *cb, gpointer user_data) @@ -233,6 +235,7 @@ new_dispatcher_request_data (EmpathyDispatcher *self, result->handle_type = handle_type; result->handle = handle; result->request = request; + result->timestamp = timestamp; if (contact != NULL) result->contact = g_object_ref (contact); @@ -570,7 +573,8 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, guint handle, GHashTable *properties, gboolean incoming, - const GPtrArray *requests_satisfied) + const GPtrArray *requests_satisfied, + gint64 timestamp) { EmpathyDispatcherPriv *priv = GET_PRIV (self); TpChannel *channel; @@ -627,7 +631,7 @@ dispatcher_connection_new_channel (EmpathyDispatcher *self, priv->channels = g_list_prepend (priv->channels, channel); operation = empathy_dispatch_operation_new (connection, channel, NULL, - incoming); + incoming, timestamp); g_object_unref (channel); @@ -688,7 +692,8 @@ dispatcher_connection_new_channel_with_properties ( TpConnection *connection, const gchar *object_path, GHashTable *properties, - const GPtrArray *requests_satisfied) + const GPtrArray *requests_satisfied, + gint64 timestamp) { const gchar *channel_type; guint handle_type; @@ -732,7 +737,7 @@ dispatcher_connection_new_channel_with_properties ( dispatcher_connection_new_channel (self, connection, object_path, channel_type, handle_type, handle, properties, !requested, - requests_satisfied); + requests_satisfied, timestamp); } static void @@ -1298,6 +1303,7 @@ dispatcher_request_channel (DispatcherRequestData *request_data) void empathy_dispatcher_chat_with_contact (EmpathyContact *contact, + gint64 timestamp, EmpathyDispatcherRequestCb *callback, gpointer user_data) { @@ -1329,7 +1335,8 @@ empathy_dispatcher_chat_with_contact (EmpathyContact *contact, /* The contact handle might not be known yet */ request_data = new_dispatcher_request_data (self, connection, TP_IFACE_CHANNEL_TYPE_TEXT, TP_HANDLE_TYPE_CONTACT, - empathy_contact_get_handle (contact), NULL, contact, callback, user_data); + empathy_contact_get_handle (contact), NULL, timestamp, contact, + callback, user_data); request_data->should_ensure = TRUE; connection_data->outstanding_requests = g_list_prepend @@ -1346,6 +1353,7 @@ typedef struct EmpathyDispatcher *dispatcher; EmpathyDispatcherRequestCb *callback; gpointer user_data; + gint64 timestamp; } ChatWithContactIdData; static void @@ -1368,8 +1376,8 @@ dispatcher_chat_with_contact_id_cb (EmpathyTpContactFactory *factory, } else { - empathy_dispatcher_chat_with_contact (contact, data->callback, - data->user_data); + empathy_dispatcher_chat_with_contact (contact, data->timestamp, + data->callback, data->user_data); } g_object_unref (data->dispatcher); @@ -1379,6 +1387,7 @@ dispatcher_chat_with_contact_id_cb (EmpathyTpContactFactory *factory, void empathy_dispatcher_chat_with_contact_id (TpConnection *connection, const gchar *contact_id, + gint64 timestamp, EmpathyDispatcherRequestCb *callback, gpointer user_data) { @@ -1395,6 +1404,7 @@ empathy_dispatcher_chat_with_contact_id (TpConnection *connection, data->dispatcher = self; data->callback = callback; data->user_data = user_data; + data->timestamp = timestamp; empathy_tp_contact_factory_get_from_id (factory, contact_id, dispatcher_chat_with_contact_id_cb, data, NULL, NULL); @@ -1437,6 +1447,7 @@ dispatcher_request_handles_cb (TpConnection *connection, void empathy_dispatcher_join_muc (TpConnection *connection, const gchar *roomname, + gint64 timestamp, EmpathyDispatcherRequestCb *callback, gpointer user_data) { @@ -1458,7 +1469,7 @@ empathy_dispatcher_join_muc (TpConnection *connection, /* Don't know the room handle yet */ request_data = new_dispatcher_request_data (self, connection, - TP_IFACE_CHANNEL_TYPE_TEXT, TP_HANDLE_TYPE_ROOM, 0, NULL, + TP_IFACE_CHANNEL_TYPE_TEXT, TP_HANDLE_TYPE_ROOM, 0, NULL, timestamp, NULL, callback, user_data); request_data->should_ensure = TRUE; @@ -1619,7 +1630,7 @@ empathy_dispatcher_call_create_or_ensure_channel ( call = tp_cli_channel_dispatcher_call_ensure_channel ( priv->channel_dispatcher, -1, tp_proxy_get_object_path (TP_PROXY (account)), - request_data->request, 0, handler, + request_data->request, request_data->timestamp, handler, dispatcher_create_channel_cb, request_data, NULL, NULL); } else @@ -1627,7 +1638,7 @@ empathy_dispatcher_call_create_or_ensure_channel ( call = tp_cli_channel_dispatcher_call_create_channel ( priv->channel_dispatcher, -1, tp_proxy_get_object_path (TP_PROXY (account)), - request_data->request, 0, handler, + request_data->request, request_data->timestamp, handler, dispatcher_create_channel_cb, request_data, NULL, G_OBJECT (dispatcher)); } @@ -1653,6 +1664,7 @@ void empathy_dispatcher_create_channel (EmpathyDispatcher *self, TpConnection *connection, GHashTable *request, + gint64 timestamp, EmpathyDispatcherRequestCb *callback, gpointer user_data) { @@ -1681,7 +1693,7 @@ empathy_dispatcher_create_channel (EmpathyDispatcher *self, handle = tp_asv_get_uint32 (request, TP_IFACE_CHANNEL ".TargetHandle", NULL); request_data = new_dispatcher_request_data (self, connection, - channel_type, handle_type, handle, request, + channel_type, handle_type, handle, request, timestamp, NULL, callback, user_data); connection_data->outstanding_requests = g_list_prepend @@ -2068,7 +2080,7 @@ empathy_dispatcher_handle_channels (EmpathyHandler *handler, properties = g_value_get_boxed (g_value_array_get_nth (arr, 1)); dispatcher_connection_new_channel_with_properties (self, - connection, object_path, properties, requests_satisfied); + connection, object_path, properties, requests_satisfied, timestamp); } return TRUE; diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h index 6176ea088..d1dec072c 100644 --- a/libempathy/empathy-dispatcher.h +++ b/libempathy/empathy-dispatcher.h @@ -40,6 +40,9 @@ G_BEGIN_DECLS #define EMPATHY_IS_DISPATCHER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EMPATHY_TYPE_DISPATCHER)) #define EMPATHY_DISPATCHER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), EMPATHY_TYPE_DISPATCHER, EmpathyDispatcherClass)) +#define EMPATHY_DISPATCHER_NON_USER_ACTION (G_GINT64_CONSTANT (0)) +#define EMPATHY_DISPATCHER_CURRENT_TIME G_MAXINT64 + typedef struct _EmpathyDispatcher EmpathyDispatcher; typedef struct _EmpathyDispatcherClass EmpathyDispatcherClass; @@ -65,15 +68,22 @@ typedef void (EmpathyDispatcherFindChannelClassCb) ( GType empathy_dispatcher_get_type (void) G_GNUC_CONST; void empathy_dispatcher_create_channel (EmpathyDispatcher *dispatcher, - TpConnection *connection, GHashTable *request, - EmpathyDispatcherRequestCb *callback, gpointer user_data); + TpConnection *connection, + GHashTable *request, + gint64 timestamp, + EmpathyDispatcherRequestCb *callback, + gpointer user_data); /* Requesting 1 to 1 text channels */ void empathy_dispatcher_chat_with_contact_id (TpConnection *connection, - const gchar *contact_id, EmpathyDispatcherRequestCb *callback, + const gchar *contact_id, + gint64 timestamp, + EmpathyDispatcherRequestCb *callback, gpointer user_data); void empathy_dispatcher_chat_with_contact (EmpathyContact *contact, - EmpathyDispatcherRequestCb *callback, gpointer user_data); + gint64 timestamp, + EmpathyDispatcherRequestCb *callback, + gpointer user_data); /* Request a file channel to a specific contact */ void empathy_dispatcher_send_file_to_contact (EmpathyContact *contact, @@ -83,7 +93,9 @@ void empathy_dispatcher_send_file_to_contact (EmpathyContact *contact, /* Request a muc channel */ void empathy_dispatcher_join_muc (TpConnection *connection, - const gchar *roomname, EmpathyDispatcherRequestCb *callback, + const gchar *roomname, + gint64 timestamp, + EmpathyDispatcherRequestCb *callback, gpointer user_data); void empathy_dispatcher_find_requestable_channel_classes_async diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index ff3f9322a..bbc99f61a 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -757,7 +757,8 @@ ft_handler_push_to_dispatcher (EmpathyFTHandler *handler) /* I want to own a reference to the request, and destroy it later */ empathy_dispatcher_create_channel (priv->dispatcher, connection, - g_hash_table_ref (priv->request), ft_handler_create_channel_cb, handler); + g_hash_table_ref (priv->request), EMPATHY_DISPATCHER_NON_USER_ACTION, + ft_handler_create_channel_cb, handler); } static void diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 835827410..cad014df3 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -160,7 +160,7 @@ tp_chat_add (EmpathyContactList *list, * valid. * props now belongs to EmpathyDispatcher, don't free it */ empathy_dispatcher_create_channel (dispatcher, connection, - props, NULL, NULL); + props, EMPATHY_DISPATCHER_NON_USER_ACTION, NULL, NULL); g_object_unref (dispatcher); } else { |