aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorChandni Verma <chandniverma2112@gmail.com>2011-05-04 03:29:12 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-05-05 14:30:39 +0800
commitb41c1f0e4b8277feee45703d283591adaed6305b (patch)
treecc16beae4b5d4540e26d17e2fe764c4c8f3c35f7 /libempathy
parentce8a8930c60b7dbb45f14ed49e8473c4f78e9686 (diff)
downloadgsoc2013-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
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-request-util.c55
-rw-r--r--libempathy/empathy-request-util.h5
2 files changed, 37 insertions, 23 deletions
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__ */