diff options
author | Chandni Verma <chandniverma2112@gmail.com> | 2011-05-04 03:29:12 +0800 |
---|---|---|
committer | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-05-05 14:30:39 +0800 |
commit | b41c1f0e4b8277feee45703d283591adaed6305b (patch) | |
tree | cc16beae4b5d4540e26d17e2fe764c4c8f3c35f7 | |
parent | ce8a8930c60b7dbb45f14ed49e8473c4f78e9686 (diff) | |
download | gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar.gz gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar.bz2 gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar.lz gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar.xz gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.tar.zst gsoc2013-empathy-b41c1f0e4b8277feee45703d283591adaed6305b.zip |
Move the code ensuring a requested sms channel to empathy-request-util
as empathy-dispatcher has been deleted in master
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 2 | ||||
-rw-r--r-- | libempathy/empathy-request-util.c | 55 | ||||
-rw-r--r-- | libempathy/empathy-request-util.h | 5 |
3 files changed, 38 insertions, 24 deletions
diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index 70846c763..576d3b9fa 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -561,7 +561,7 @@ empathy_individual_sms_menu_item_activated (GtkMenuItem *item, { g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - empathy_dispatcher_sms_contact_id ( + empathy_sms_contact_id ( empathy_contact_get_account (contact), empathy_contact_get_id (contact), gtk_get_current_event_time ()); diff --git a/libempathy/empathy-request-util.c b/libempathy/empathy-request-util.c index ea885dacc..6472230ab 100644 --- a/libempathy/empathy-request-util.c +++ b/libempathy/empathy-request-util.c @@ -58,9 +58,11 @@ ensure_text_channel_cb (GObject *source, } } -void -empathy_chat_with_contact_id (TpAccount *account, - const gchar *contact_id, +static void +create_text_channel (TpAccount *account, + TpHandleType target_handle_type, + const gchar *target_id, + gboolean sms_channel, gint64 timestamp) { GHashTable *request; @@ -69,39 +71,46 @@ empathy_chat_with_contact_id (TpAccount *account, request = tp_asv_new ( TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_TEXT, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_CONTACT, - TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, contact_id, + TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, target_handle_type, + TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, target_id, NULL); + if (sms_channel) + tp_asv_set_boolean (request, + TP_PROP_CHANNEL_INTERFACE_SMS_SMS_CHANNEL, TRUE); + req = tp_account_channel_request_new (account, request, timestamp); - tp_account_channel_request_ensure_channel_async (req, EMPATHY_CHAT_BUS_NAME, - NULL, ensure_text_channel_cb, NULL); + tp_account_channel_request_ensure_channel_async (req, NULL, NULL, + ensure_text_channel_cb, NULL); g_hash_table_unref (request); g_object_unref (req); } void +empathy_chat_with_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp) +{ + create_text_channel (account, TP_HANDLE_TYPE_CONTACT, + contact_id, FALSE, timestamp); +} + +void empathy_join_muc (TpAccount *account, const gchar *room_name, gint64 timestamp) { - GHashTable *request; - TpAccountChannelRequest *req; - - request = tp_asv_new ( - TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING, - TP_IFACE_CHANNEL_TYPE_TEXT, - TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT, TP_HANDLE_TYPE_ROOM, - TP_PROP_CHANNEL_TARGET_ID, G_TYPE_STRING, room_name, - NULL); - - req = tp_account_channel_request_new (account, request, timestamp); - - tp_account_channel_request_ensure_channel_async (req, EMPATHY_CHAT_BUS_NAME, - NULL, ensure_text_channel_cb, NULL); + create_text_channel (account, TP_HANDLE_TYPE_ROOM, + room_name, FALSE, timestamp); +} - g_hash_table_unref (request); - g_object_unref (req); +void +empathy_sms_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp) +{ + create_text_channel (account, TP_HANDLE_TYPE_CONTACT, + contact_id, TRUE, timestamp); } diff --git a/libempathy/empathy-request-util.h b/libempathy/empathy-request-util.h index afb8013cb..49b98a433 100644 --- a/libempathy/empathy-request-util.h +++ b/libempathy/empathy-request-util.h @@ -52,6 +52,11 @@ void empathy_join_muc (TpAccount *account, const gchar *roomname, gint64 timestamp); +/* Request a sms channel */ +void empathy_sms_contact_id (TpAccount *account, + const gchar *contact_id, + gint64 timestamp); + G_END_DECLS #endif /* __EMPATHY_DISPATCHER_H__ */ |