[Telepathy-commits] [telepathy-glib/master] MessageMixin: Correctly fall back from "content-type" to "type"
Will Thompson
will.thompson at collabora.co.uk
Thu Dec 18 10:41:56 PST 2008
In passing, correct the version of the spec in which the key changed
(the release was incorrectly tagged in telepathy-spec git as 0.7.14
rather than 0.17.14).
---
telepathy-glib/message-mixin.c | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index 56d6af0..37c64fc 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -104,7 +104,7 @@ static const char * const forbidden_keys[] = {
static const char * const body_only[] = {
"alternative",
"content-type",
- "type", /* deprecated in 0.7.14 */
+ "type", /* deprecated in 0.17.14 */
"content",
"identifier",
"needs-retrieval",
@@ -931,8 +931,9 @@ parts_to_text (const GPtrArray *parts,
const gchar *type = tp_asv_get_string (part, "content-type");
const gchar *alternative = tp_asv_get_string (part, "alternative");
+ /* Renamed to "content-type" in spec 0.17.14 */
if (type == NULL)
- tp_asv_get_string (part, "content-type");
+ type = tp_asv_get_string (part, "type");
DEBUG ("Parsing part %u, type %s, alternative %s", i, type, alternative);
@@ -1423,9 +1424,10 @@ tp_message_mixin_get_pending_message_content_async (
part_data = g_ptr_array_index (item->parts, part);
/* skip parts with no type (reserved) */
- if (tp_asv_get_string (part_data, "content-type") == NULL)
- if (tp_asv_get_string (part_data, "type") == NULL)
- continue;
+ if (tp_asv_get_string (part_data, "content-type") == NULL &&
+ /* Renamed to "content-type" in spec 0.17.14 */
+ tp_asv_get_string (part_data, "type") == NULL)
+ continue;
value = g_hash_table_lookup (part_data, "content");
@@ -1751,7 +1753,7 @@ tp_message_mixin_send_async (TpSvcChannelTypeText *iface,
tp_message_set_uint32 (message, 0, "message-type", message_type);
tp_message_set_string (message, 1, "content-type", "text/plain");
- tp_message_set_string (message, 1, "type", "text/plain"); /* Deprecated in 0.7.14 */
+ tp_message_set_string (message, 1, "type", "text/plain"); /* Removed in 0.17.14 */
tp_message_set_string (message, 1, "content", text);
message->outgoing_context = context;
--
1.5.6.5
More information about the Telepathy-commits
mailing list