diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2013-04-14 11:55:14 +0100 |
---|---|---|
committer | Will Thompson <will.thompson@collabora.co.uk> | 2013-04-14 11:55:25 +0100 |
commit | f58e406cfffc1782ece080a17177271c098a1e0e (patch) | |
tree | 3e2b45ce11caab463e82782cb331fc0a235cfbf3 | |
parent | 5d5c11908eb9b6e91455416d96e41a7a636c56e5 (diff) | |
parent | 5cb65fa971d4461b1f6fc6fd79a4f5b6fff3a8cc (diff) | |
download | telepathy-glib-f58e406cfffc1782ece080a17177271c098a1e0e.tar.gz |
Merge branch 'telepathy-glib-0.20' and update NEWS
Conflicts:
NEWS
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | telepathy-glib/account.c | 2 | ||||
-rw-r--r-- | telepathy-glib/message.c | 6 | ||||
-rw-r--r-- | tests/Makefile.am | 7 | ||||
-rw-r--r-- | tests/message.c | 70 |
5 files changed, 88 insertions, 3 deletions
@@ -5,6 +5,12 @@ Fixes: • Isolate regression tests better (fd.o #63119, Simon) +• Explicitly annotate tp_account_update_parameters_finish()'s + 'unset_parameters' argument to be a NULL-terminated string array. It was + previously incorrectly inferred to be a string, for some reason. (wjt) + +• Always flag delivery reports with Non_Text_Content. (fd.o #61254, wjt) + telepathy-glib 0.21.0 (2013-04-03) ================================== diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c index 18114e05f..23cc796ae 100644 --- a/telepathy-glib/account.c +++ b/telepathy-glib/account.c @@ -2929,7 +2929,7 @@ tp_account_update_parameters_finish (TpAccount *account, * @account: a #TpAccount * @parameters: (transfer none): a variant of type %G_VARIANT_TYPE_VARDICT * containing new parameters to set on @account - * @unset_parameters: list of parameters to unset on @account + * @unset_parameters: (array zero-terminated=1): list of parameters to unset on @account * @callback: a callback to call when the request is satisfied * @user_data: data to pass to @callback * diff --git a/telepathy-glib/message.c b/telepathy-glib/message.c index 2c27b445f..381707466 100644 --- a/telepathy-glib/message.c +++ b/telepathy-glib/message.c @@ -750,9 +750,11 @@ tp_message_to_text (TpMessage *message, if (tp_asv_get_boolean (header, "rescued", NULL)) flags |= TP_CHANNEL_TEXT_MESSAGE_FLAG_RESCUED; - /* If the message is on an extended interface or only contains headers, - * definitely set the "your client is too old" flag. */ + /* If the message is on an extended interface, is a delivery report, or only + * contains headers, definitely set the "your client is too old" flag. */ if (message->parts->len <= 1 || + tp_asv_get_uint32 (header, "message-type", NULL) + == TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT || g_hash_table_lookup (header, "interface") != NULL) { flags |= TP_CHANNEL_TEXT_MESSAGE_FLAG_NON_TEXT_CONTENT; diff --git a/tests/Makefile.am b/tests/Makefile.am index f6397ae2d..bb9f70541 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -14,6 +14,7 @@ programs_list = \ test-heap \ test-internal-debug \ test-intset \ + test-message \ test-signal-connect-object \ test-util \ test-debug-domain \ @@ -123,6 +124,12 @@ test_debug_domain_SOURCES = \ test_internal_debug_SOURCES = \ internal-debug.c +test_message_SOURCES = \ + message.c +test_message_LDADD = \ + $(top_builddir)/tests/lib/libtp-glib-tests.la \ + $(LDADD) + test_signal_connect_object_SOURCES = \ signal-connect-object.c test_signal_connect_object_LDADD = \ diff --git a/tests/message.c b/tests/message.c new file mode 100644 index 000000000..4fc08a997 --- /dev/null +++ b/tests/message.c @@ -0,0 +1,70 @@ +/* Tests of TpMessage + * + * Copyright © 2013 Collabora Ltd. <http://www.collabora.co.uk/> + * + * Copying and distribution of this file, with or without modification, + * are permitted in any medium without royalty provided the copyright + * notice and this notice are preserved. + */ + +#include "tests/lib/util.h" + +static void +test_delivery_report_with_body (void) +{ + TpMessage *message = tp_client_message_new (); + guint i; + gchar *text; + TpChannelTextMessageFlags flags; + + g_test_bug ("61254"); + + tp_message_set_uint32 (message, 0, "message-type", + TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT); + tp_message_set_uint32 (message, 0, "delivery-status", + TP_DELIVERY_STATUS_PERMANENTLY_FAILED); + + /* message from server (alternative in English) */ + i = tp_message_append_part (message); + tp_message_set_string (message, i, "alternative", "404"); + tp_message_set_string (message, i, "content-type", "text/plain"); + tp_message_set_string (message, i, "lang", "en"); + tp_message_set_string (message, i, "content", + "I have no contact with that name"); + + /* message from server (alternative in German) */ + i = tp_message_append_part (message); + tp_message_set_string (message, i, "alternative", "404"); + tp_message_set_string (message, i, "content-type", "text/plain"); + tp_message_set_string (message, i, "lang", "de"); + tp_message_set_string (message, i, "content", + "Ich habe keinen Kontakt mit diesem Namen"); + + text = tp_message_to_text (message, &flags); + + g_assert (text != NULL); + /* tp_message_to_text should only pick one language, and it's arbitrarily the + * first. */ + g_assert_cmpstr (text, ==, "I have no contact with that name"); + + /* This is a delivery report, so old clients should know that there's + * something more to the message than just a message. + */ + g_assert_cmpuint (flags, ==, TP_CHANNEL_TEXT_MESSAGE_FLAG_NON_TEXT_CONTENT); + + g_free (text); + g_object_unref (message); +} + +int +main (int argc, + char **argv) +{ + tp_tests_init (&argc, &argv); + g_test_bug_base ("http://bugs.freedesktop.org/show_bug.cgi?id="); + + g_test_add_func ("/text-channel/delivery-report-with-body", + test_delivery_report_with_body); + + return g_test_run (); +} |