]> git.0d.be Git - empathy.git/commitdiff
empathy_dispatcher_chat_with_contact_id(): add optional cb
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Tue, 24 May 2011 15:23:22 +0000 (16:23 +0100)
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>
Mon, 5 Sep 2011 14:53:37 +0000 (15:53 +0100)
Conflicts:

libempathy-gtk/empathy-individual-menu.c
libempathy-gtk/empathy-new-message-dialog.c
libempathy/empathy-dispatcher.c
libempathy/empathy-dispatcher.h
src/empathy-chat-manager.c
src/empathy-chat-window.c

libempathy-gtk/empathy-chat.c
libempathy-gtk/empathy-individual-menu.c
libempathy-gtk/empathy-new-message-dialog.c
libempathy/empathy-auth-factory.c
libempathy/empathy-request-util.c
libempathy/empathy-request-util.h
src/empathy-chat-manager.c
src/empathy-chat-window.c

index 032dd246417dcc3e16b0b175a9201414f8b00296..cf01632b48f6645e61d93a49b729f9ce18eb6022 100644 (file)
@@ -275,11 +275,13 @@ account_reconnected (EmpathyChat *chat,
                        if (priv->sms_channel)
                                empathy_sms_contact_id (
                                        account, priv->id,
-                                       TP_USER_ACTION_TIME_NOT_USER_ACTION);
+                                       TP_USER_ACTION_TIME_NOT_USER_ACTION,
+                                       NULL, NULL);
                        else
                                empathy_chat_with_contact_id (
                                        account, priv->id,
-                                       TP_USER_ACTION_TIME_NOT_USER_ACTION);
+                                       TP_USER_ACTION_TIME_NOT_USER_ACTION,
+                                       NULL, NULL);
                        break;
                case TP_HANDLE_TYPE_ROOM:
                        empathy_join_muc (account, priv->id,
index 745474d843c1eeaaaefc0f8f5c313b967e370edf..1a3dbb7e1e8be7750ad86b5680bd9510e42a861c 100644 (file)
@@ -786,7 +786,8 @@ empathy_individual_sms_menu_item_activated (GtkMenuItem *item,
   empathy_sms_contact_id (
       empathy_contact_get_account (contact),
       empathy_contact_get_id (contact),
-      empathy_get_current_action_time ());
+      empathy_get_current_action_time (),
+      NULL, NULL);
 }
 
 GtkWidget *
index 1c4bbaad50d2aa9d6e2ed795916a0510f79d6e72..40c25974c91474c4a5b532ba8d90eeeeca851b8d 100644 (file)
@@ -80,12 +80,14 @@ empathy_new_message_dialog_response (GtkDialog *dialog, int response_id)
     {
       case EMP_NEW_MESSAGE_TEXT:
         empathy_chat_with_contact_id (account, contact_id,
-            empathy_get_current_action_time ());
+            empathy_get_current_action_time (),
+            NULL, NULL);
         break;
 
       case EMP_NEW_MESSAGE_SMS:
         empathy_sms_contact_id (account, contact_id,
-            empathy_get_current_action_time ());
+            empathy_get_current_action_time (),
+            NULL, NULL);
         break;
 
       default:
index 56b3b73eb9981c598056e31bcc03cbfa74a93286..069f60756504f7e795b5258ca6c6ab12ce2049e3 100644 (file)
@@ -20,9 +20,7 @@
 
 #include "empathy-auth-factory.h"
 
-#include <telepathy-glib/interfaces.h>
-#include <telepathy-glib/simple-handler.h>
-#include <telepathy-glib/util.h>
+#include <telepathy-glib/telepathy-glib.h>
 
 #define DEBUG_FLAG EMPATHY_DEBUG_TLS
 #include "empathy-debug.h"
index 409fdf54a7447cc5b3ea1a5570a75be0ab9ad2b9..6b53dab9a7583329f5eb789f446d42130c2e61b1 100644 (file)
@@ -40,7 +40,7 @@ empathy_chat_with_contact (EmpathyContact *contact,
 {
   empathy_chat_with_contact_id (
       empathy_contact_get_account (contact), empathy_contact_get_id (contact),
-      timestamp);
+      timestamp, NULL, NULL);
 }
 
 static void
@@ -63,7 +63,9 @@ create_text_channel (TpAccount *account,
     TpHandleType target_handle_type,
     const gchar *target_id,
     gboolean sms_channel,
-    gint64 timestamp)
+    gint64 timestamp,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
 {
   GHashTable *request;
   TpAccountChannelRequest *req;
@@ -83,19 +85,23 @@ create_text_channel (TpAccount *account,
   tp_account_channel_request_set_delegate_to_preferred_handler (req, TRUE);
 
   tp_account_channel_request_ensure_channel_async (req, EMPATHY_CHAT_BUS_NAME,
-      NULL, ensure_text_channel_cb, NULL);
+      NULL, callback ? callback : ensure_text_channel_cb, user_data);
 
   g_hash_table_unref (request);
   g_object_unref (req);
 }
 
+/* @callback is optional, but if it's provided, it should call the right
+ * _finish() func that we call in ensure_text_channel_cb() */
 void
 empathy_chat_with_contact_id (TpAccount *account,
     const gchar *contact_id,
-    gint64 timestamp)
+    gint64 timestamp,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
 {
   create_text_channel (account, TP_HANDLE_TYPE_CONTACT,
-      contact_id, FALSE, timestamp);
+      contact_id, FALSE, timestamp, callback, user_data);
 }
 
 void
@@ -104,14 +110,18 @@ empathy_join_muc (TpAccount *account,
     gint64 timestamp)
 {
   create_text_channel (account, TP_HANDLE_TYPE_ROOM,
-      room_name, FALSE, timestamp);
+      room_name, FALSE, timestamp, NULL, NULL);
 }
 
+/* @callback is optional, but if it's provided, it should call the right
+ * _finish() func that we call in ensure_text_channel_cb() */
 void
 empathy_sms_contact_id (TpAccount *account,
     const gchar *contact_id,
-    gint64 timestamp)
+    gint64 timestamp,
+    GAsyncReadyCallback callback,
+    gpointer user_data)
 {
   create_text_channel (account, TP_HANDLE_TYPE_CONTACT,
-      contact_id, TRUE, timestamp);
+      contact_id, TRUE, timestamp, callback, user_data);
 }
index 70a607e73c41d35614805d7140d19ec221868376..6781b72d40b4ac2351f5a4fa08ce0da0cdefe005 100644 (file)
@@ -45,9 +45,11 @@ G_BEGIN_DECLS
 /* Requesting 1 to 1 text channels */
 void empathy_chat_with_contact_id (TpAccount *account,
   const gchar *contact_id,
-  gint64 timestamp);
+  gint64 timestamp,
+  GAsyncReadyCallback callback,
+  gpointer user_data);
 
-void  empathy_chat_with_contact (EmpathyContact *contact,
+void empathy_chat_with_contact (EmpathyContact *contact,
   gint64 timestamp);
 
 /* Request a muc channel */
@@ -58,7 +60,9 @@ void empathy_join_muc (TpAccount *account,
 /* Request a sms channel */
 void empathy_sms_contact_id (TpAccount *account,
   const gchar *contact_id,
-  gint64 timestamp);
+  gint64 timestamp,
+  GAsyncReadyCallback callback,
+  gpointer user_data);
 
 G_END_DECLS
 
index 0e1745edbff5a0c2ea8a67691cc396d452d02142..5f19159c5aa29f70a46d0da4818d91b0f67f2a55 100644 (file)
@@ -448,9 +448,11 @@ empathy_chat_manager_undo_closed_chat (EmpathyChatManager *self,
   if (data->room)
     empathy_join_muc (data->account, data->id, timestamp);
   else if (data->sms)
-    empathy_sms_contact_id (data->account, data->id, timestamp);
+    empathy_sms_contact_id (data->account, data->id, timestamp,
+        NULL, NULL);
   else
-    empathy_chat_with_contact_id (data->account, data->id, timestamp);
+    empathy_chat_with_contact_id (data->account, data->id, timestamp,
+        NULL, NULL);
 
   g_signal_emit (self, signals[CLOSED_CHATS_CHANGED], 0,
       g_queue_get_length (priv->closed_queue));
index 97ed1b9de51c7696308f5015037b261338f31358..a84eef7a0322d5fbe429f1fac50d48ebb7e05ba1 100644 (file)
@@ -1866,7 +1866,9 @@ chat_window_drag_data_received (GtkWidget        *widget,
 
                if (!chat) {
                        empathy_chat_with_contact_id (
-                               account, contact_id, empathy_get_current_action_time ());
+                               account, contact_id,
+                               empathy_get_current_action_time (),
+                               NULL, NULL);
 
                        g_strfreev (strv);
                        return;