From 04f6364a70dfd1027644d2c41aac37bd0e4b37ab Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 7 May 2012 18:31:52 +0100 Subject: [PATCH 3/3] Use non-deprecated TpMessage APIs --- src/text-helper.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/text-helper.c b/src/text-helper.c index c21842f..58dd9b3 100644 --- a/src/text-helper.c +++ b/src/text-helper.c @@ -313,16 +313,18 @@ text_helper_report_delivery_error (TpSvcChannel *self, "handle-type", &handle_type, NULL); - delivery_echo = tp_message_new (base_conn, 2, 2); - tp_message_set_handle (delivery_echo, 0, "message-sender", - TP_HANDLE_TYPE_CONTACT, base_conn->self_handle); + delivery_echo = tp_cm_message_new (base_conn, 2); + tp_cm_message_set_sender (delivery_echo, base_conn->self_handle); tp_message_set_uint32 (delivery_echo, 0, "message-type", type); tp_message_set_int64 (delivery_echo, 0, "message-sent", (gint64)timestamp); tp_message_set_string (delivery_echo, 1, "content-type", "text/plain"); tp_message_set_string (delivery_echo, 1, "content", text); - message = tp_message_new (base_conn, 1, 1); - tp_message_set_handle (message, 0, "message-sender", handle_type, handle); + message = tp_cm_message_new (base_conn, 1); + + if (handle_type == TP_HANDLE_TYPE_CONTACT) + tp_cm_message_set_sender (message, handle); + tp_message_set_uint32 (message, 0, "message-type", TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT); tp_message_set_uint32 (message, 0, "delivery-status", @@ -330,7 +332,7 @@ text_helper_report_delivery_error (TpSvcChannel *self, tp_message_set_uint32 (message, 0, "delivery-error", TP_CHANNEL_TEXT_SEND_ERROR_OFFLINE); tp_message_set_string (message, 0, "delivery-token", token); - tp_message_take_message (message, 0, "delivery-echo", delivery_echo); + tp_cm_message_take_message (message, 0, "delivery-echo", delivery_echo); g_object_unref (base_conn); @@ -344,11 +346,10 @@ text_helper_create_received_message (TpBaseConnection *base_conn, guint type, const gchar *text) { - TpMessage *message = tp_message_new (base_conn, 2, 2); + TpMessage *message = tp_cm_message_new (base_conn, 2); tp_message_set_uint32 (message, 0, "message-type", type); - tp_message_set_handle (message, 0, "message-sender", - TP_HANDLE_TYPE_CONTACT, sender_handle); + tp_cm_message_set_sender (message, sender_handle); tp_message_set_int64 (message, 0, "message-received", timestamp); tp_message_set_string (message, 1, "content-type", "text/plain"); -- 1.7.10