Home · All Classes · All Namespaces · Modules · Functions · Files |
#include <TelepathyQt4/Types>
Inherits QMap< QString, QDBusVariant >.
Mapping type generated from the specification. Convertible with QMap<QString, QDBusVariant>, but needed to have a discrete type in the Qt4 type system.
Part of a message's content. In practice, this mapping never
appears in isolation: incoming messages are represented by a list of
The first part of the message contains "headers", which refer
to the entire message. The second and subsequent parts contain the
message's content, including plain text, formatted text and/or
attached files. Well-known keys for the header and body parts are
defined by the
Instead of representing messages as aa{sv} where the first dictionary is special (a dictionary of headers), we could have used a signature like (a{sv}aa{sv}) to separate out the headers and the body parts.
However, this would make access to the messages more awkward.
In Python, the syntax for access to a header field would remain
message[0]['message-type']
, but access to a body
field in the second body part would change from
message[2]['content'] to message[1][1]['content']
. In
GLib, the message would change from being a
GPtrArray(GHashTable)
to being a
GValueArray(GHashTable, GPtrArray(GHashTable))
which
is rather inconvenient to dereference.
In any group of parts with the same non-empty value for the alternative key (which represent alternative versions of the same content), more faithful versions of the intended message MUST come before less faithful versions (note that this order is the opposite of MIME multipart/alternative parts). Clients SHOULD display the first alternative that they understand.
Specifying the preference order means that if the underlying protocol doesn't support alternatives, the CM can safely delete everything apart from the first supported alternative when sending messages.
The order is the reverse of MIME because MIME's rationale for placing the "plainest" part first (legibility in pre-MIME UAs) does not apply to us, and placing the most preferred part first simplifies display (a client can iterate the message in order, display the first alternative that it understands, and skip displaying all subsequent parts with the same "alternative" key).
Clients SHOULD present all parts that are not redundant alternatives in the order they appear in this array, possibly excluding parts that are referenced by another displayed part. It is implementation-specific how the parts are presented to the user.
This allows CMs to assume that all parts are actually shown to the user, even if they are not explicitly referenced - we do not yet recommend formatted text, and there is no way for plain text to reference an attachment since it has no concept of markup or references. This also forces clients to do something sensible with messages that consist entirely of "attachments", with no "body" at all.
For instance, when displaying the above example, a client that understands the HTML part should display the JPEG image once, between the two lines "Here is a photo of my cat:" and "Isn't it cute?"; it may additionally present the image in some way for a second time, after "Isn't it cute?", or may choose not to.
A client that does not understand HTML, displaying the same message, should display the plain-text part, followed by the JPEG image.
Connection managers, clients and extensions to this specification
SHOULD NOT include message-sender
in the
header.
Reference-counting handles in clients becomes problematic if the channel proxy cannot know whether particular map values are handles or not.
A rich-text message, with an embedded image, might be represented as:
[ { 'message-token': '9de9546a-3400-4419-a505-3ea270cb834c', 'message-sender': 42, 'message-sent': 1210067943, 'message-received': 1210067947, 'message-type': 0, # = Channel_Text_Message_Type_Normal 'pending-message-id': 437, }, { 'alternative': 'main', 'content-type': 'text/html', 'content': 'Here is a photo of my cat:<br />' + '<img src="cid:catphoto" alt="lol!" />' + '<br />Isn't it cute?', }, { 'alternative': 'main', 'content-type': 'text/plain', 'content': 'Here is a photo of my cat:\\n[IMG: lol!]\\nIsn't it cute?', }, { 'identifier': 'catphoto', 'content-type': 'image/jpeg', 'size': 101000, 'needs-retrieval': True, }, ]
telepathy-ring, Nokia's GSM connection manager, represents vCards sent via SMS as:
[ { 'message-token': '9de9546a-3400-4419-a505-3ea270cb834c', 'message-sender': 42, 'message-sent': 1210067943, 'message-received': 1210067947, 'message-type': 0, # = Channel_Text_Message_Type_Normal 'pending-message-id': 437, }, { 'content-type': 'text/x-vcard', 'content': [ 0x66, 0x69, 0x71, ...], # vCard data as an array of bytes }, ]
Delivery reports are also represented as messages with the
message-type header mapping to
For backwards- and forwards-compatibility, whenever a delivery
error report is signalled—that is, with delivery-status
mapping to
The result of attempting to send delivery reports using SendMessage() is currently undefined.
b9a991bd-8845-4d7f-a704-215186f43bb4
for an unknown
reason[{ # header 'message-sender': 123, 'message-type': Channel_Text_Message_Type_Delivery_Report, 'delivery-status': Delivery_Status_Permanently_Failed, 'delivery-token': 'b9a991bd-8845-4d7f-a704-215186f43bb4', } # no body ]
[{ # header 'message-sender': 123, 'message-type': Channel_Text_Message_Type_Delivery_Report, 'delivery-status': Delivery_Status_Temporarily_Failed, 'delivery-error': Channel_Text_Send_Error_Offline, 'delivery-echo': [{ # header of original message 'message-sender': 1, 'message-sent': 1210067943, }, { # body of original message 'content-type': 'text/plain', 'content': 'Hello, world!', }] ], # no body ]
b9a991bd-8845-4d7f-a704-215186f43bb4
to a contact
with handle 123, but that handle represents a contact who does not
actually exist[{ # header 'message-sender': 123, 'message-type': Channel_Text_Message_Type_Delivery_Report, 'delivery-status': Delivery_Status_Permanently_Failed, 'delivery-error': Channel_Text_Send_Error_Invalid_Contact, 'delivery-token': 'b9a991bd-8845-4d7f-a704-215186f43bb4', 'delivery-echo': [{ # header of original message 'message-sender': 1, 'message-sent': 1210067943, }, { # body of original message 'content-type': 'text/plain', 'content': 'Hello, world!', }] ], }, { # message from server (alternative in English) 'alternative': '404', 'content-type': 'text/plain', 'lang': 'en', 'content': 'I have no contact with that name', }, { # message from server (alternative in German) 'alternative': '404'. 'content-type': 'text/plain', 'lang': 'de', 'content', 'Ich habe keinen Kontakt mit diesem Namen', } ]
b9a991bd-8845-4d7f-a704-215186f43bb4
[{ # header 'message-sender': 123, 'message-type': Channel_Text_Message_Type_Delivery_Report, 'delivery-status': Delivery_Status_Delivered, 'delivery-token': 'b9a991bd-8845-4d7f-a704-215186f43bb4', } # no body ]
Tp::MessagePart::MessagePart | ( | ) | [inline] |
Tp::MessagePart::MessagePart | ( | const QMap< QString, QDBusVariant > & | a | ) | [inline] |
MessagePart& Tp::MessagePart::operator= | ( | const QMap< QString, QDBusVariant > & | a | ) | [inline] |
Copyright © 2008-2011 Collabora Ltd. and Nokia Corporation | Telepathy-Qt4 0.6.5 |