[empathy: 2/16] add timestamp arg to empathy_dispatcher_chat_with_contact(_id)



commit 54ae82bdf32156387e3d720656bd361a859b8db6
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Sat Apr 24 17:16:32 2010 +0100

    add timestamp arg to empathy_dispatcher_chat_with_contact(_id)

 libempathy-gtk/empathy-chat.c               |    3 ++-
 libempathy-gtk/empathy-contact-list-view.c  |    3 ++-
 libempathy-gtk/empathy-contact-menu.c       |    3 ++-
 libempathy-gtk/empathy-new-message-dialog.c |    3 ++-
 libempathy/empathy-dispatcher.c             |   11 +++++++----
 libempathy/empathy-dispatcher.h             |    8 ++++++--
 src/empathy-chat-manager.c                  |    2 +-
 src/empathy-chat-window.c                   |    2 +-
 tests/interactive/empetit.c                 |    3 ++-
 9 files changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index b06329a..06ee4bb 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -262,7 +262,7 @@ reconnected_connection_ready_cb (TpConnection *connection,
 	switch (priv->handle_type) {
 		case TP_HANDLE_TYPE_CONTACT:
 			empathy_dispatcher_chat_with_contact_id (
-				connection, priv->id,
+				connection, priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION,
 				chat_connect_channel_reconnected,
 				chat);
 			break;
@@ -767,6 +767,7 @@ chat_command_msg_internal (EmpathyChat *chat,
 	data->message = g_strdup (message);
 	connection = empathy_tp_chat_get_connection (priv->tp_chat);
 	empathy_dispatcher_chat_with_contact_id (connection, contact_id,
+						 gtk_get_current_event_time (),
 						 chat_command_msg_cb,
 						 data);
 }
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 15df212..ae84e3e 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -804,7 +804,8 @@ contact_list_view_row_activated (GtkTreeView       *view,
 
 	if (contact) {
 		DEBUG ("Starting a chat");
-		empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
+		empathy_dispatcher_chat_with_contact (contact,
+			gtk_get_current_event_time (), NULL, NULL);
 		g_object_unref (contact);
 	}
 }
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index fbcd8dc..e160f5e 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -222,7 +222,8 @@ static void
 empathy_contact_chat_menu_item_activated (GtkMenuItem *item,
 	EmpathyContact *contact)
 {
-  empathy_dispatcher_chat_with_contact (contact, NULL, NULL);
+  empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time (),
+      NULL, NULL);
 }
 
 GtkWidget *
diff --git a/libempathy-gtk/empathy-new-message-dialog.c b/libempathy-gtk/empathy-new-message-dialog.c
index 338da27..5094385 100644
--- a/libempathy-gtk/empathy-new-message-dialog.c
+++ b/libempathy-gtk/empathy-new-message-dialog.c
@@ -70,7 +70,8 @@ empathy_new_message_dialog_response (GtkDialog *dialog, int response_id)
 
   if (EMP_STR_EMPTY (contact_id) || connection == NULL) goto out;
 
-  empathy_dispatcher_chat_with_contact_id (connection, contact_id, NULL, NULL);
+  empathy_dispatcher_chat_with_contact_id (connection, contact_id,
+      gtk_get_current_event_time (), NULL, NULL);
 
 out:
   gtk_widget_destroy (GTK_WIDGET (dialog));
diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c
index 046f6a9..40ee5dd 100644
--- a/libempathy/empathy-dispatcher.c
+++ b/libempathy/empathy-dispatcher.c
@@ -1301,6 +1301,7 @@ dispatcher_request_channel (DispatcherRequestData *request_data)
 
 void
 empathy_dispatcher_chat_with_contact (EmpathyContact *contact,
+                                      gint64 timestamp,
                                       EmpathyDispatcherRequestCb *callback,
                                       gpointer user_data)
 {
@@ -1332,8 +1333,7 @@ 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,
-    EMPATHY_DISPATCHER_NON_USER_ACTION, contact,
+    empathy_contact_get_handle (contact), NULL, timestamp, contact,
     callback, user_data);
   request_data->should_ensure = TRUE;
 
@@ -1351,6 +1351,7 @@ typedef struct
   EmpathyDispatcher *dispatcher;
   EmpathyDispatcherRequestCb *callback;
   gpointer user_data;
+  gint64 timestamp;
 } ChatWithContactIdData;
 
 static void
@@ -1373,8 +1374,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);
@@ -1384,6 +1385,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)
 {
@@ -1400,6 +1402,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);
 
diff --git a/libempathy/empathy-dispatcher.h b/libempathy/empathy-dispatcher.h
index 97ac49b..b3e9e1d 100644
--- a/libempathy/empathy-dispatcher.h
+++ b/libempathy/empathy-dispatcher.h
@@ -72,10 +72,14 @@ void empathy_dispatcher_create_channel (EmpathyDispatcher *dispatcher,
 
 /* 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,
diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c
index 01506f5..35b2324 100644
--- a/src/empathy-chat-manager.c
+++ b/src/empathy-chat-manager.c
@@ -202,7 +202,7 @@ connection_ready_cb (TpConnection *connection,
         empathy_dispatcher_join_muc (connection, data->id, NULL, NULL);
       else
         empathy_dispatcher_chat_with_contact_id (connection, data->id,
-            NULL, NULL);
+            EMPATHY_DISPATCHER_NON_USER_ACTION, NULL, NULL);
 
       g_signal_emit (self, signals[CHATS_CHANGED], 0,
           g_queue_get_length (priv->queue));
diff --git a/src/empathy-chat-window.c b/src/empathy-chat-window.c
index 6e80bb4..847c7f8 100644
--- a/src/empathy-chat-window.c
+++ b/src/empathy-chat-window.c
@@ -1682,7 +1682,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
 
 			if (connection) {
 				empathy_dispatcher_chat_with_contact_id (
-					connection, contact_id, NULL, NULL);
+					connection, contact_id, gtk_get_current_event_time (), NULL, NULL);
 			}
 
 			g_strfreev (strv);
diff --git a/tests/interactive/empetit.c b/tests/interactive/empetit.c
index e2eb61f..7bcaf03 100644
--- a/tests/interactive/empetit.c
+++ b/tests/interactive/empetit.c
@@ -42,7 +42,8 @@ clicked_cb (GtkButton *button,
   if (!contact)
     return;
 
-  empathy_dispatcher_chat_with_contact (contact, chat_cb, NULL);
+  empathy_dispatcher_chat_with_contact (contact, gtk_get_current_event_time (),
+      chat_cb, NULL);
 
   g_object_unref (contact);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]