Class
PurpleMessage
unstable since: 3.0
Description [src]
final class Purple.Message : GObject.Object
{
/* No available fields */
}
PurpleMessage represents any message passed between users in libpurple.
There are a number of ways to create messages but purple_message_new() and
purple_message_new_with_id() are the primary ways to do so. There is also
purple_conversation_create_message() which will create a message with the
author set to the account that the conversation belongs to. This is useful
for user interfaces and unit tests. Finally, if you need more control over
what properties are set initially, you can also use
g_object_new() directly.
PurpleMessage:contents contains the plain text of the message while the
formatting is stored separately in PurpleMessage:attributes. Pango
Markup is used as the common
markup format. This means that user interfaces will need to parse it for
display and that protocols will need to handle encoding and decoding of it
to support formatting.
There are a number of flags for messages as well. They are
PurpleMessage:action, PurpleMessage:event,
PurpleMessage:notice, PurpleMessage:system, and
PurpleMessage:highlighted. Any combination of these can be used at the
same time and more may be added in the future.
Messages also have a number of properties for controlling their look and
feel including PurpleMessage:highlight-color, PurpleMessage:icon,
and PurpleMessage:title. User interfaces can choose to use or ignore
any of these values. These can be used to highlight messages of new
participants among other things.
Messages also have PurpleMessage:attachments which can be any number
of files. Attachments can be used to emulate different types of messages
for protocols that make that distinction. For example, to represent an image
message on Matrix, you would create a PurpleMessage with no contents and a
single attachment with the image.
There are also a number of timestamps that are important for messages.
Anyone can set the PurpleMessage:timestamp but the protocol may choose
to modify it before sending. However, PurpleMessage:delivered-at and
PurpleMessage:edited-at should only ever be modified by the protocol.
PurpleMessage:error is primarily meant to be used to report delivery
failures and allow the user interface to present a resend option, but it
will accept any error.
Available since: 3.0
Instance methods
purple_message_get_delivered_at
Gets the time that the message was delivered at.
unstable since: 3.0
purple_message_get_highlight_color
Gets the hex color code that should be used when highlighting.
unstable since: 3.0
purple_message_get_highlighted
Gets whether or not this message should be highlighted.
unstable since: 3.0
purple_message_get_replying_to
Gets the id of the message that this message is replying to.
unstable since: 3.0
purple_message_get_timestamp
Gets the timestamp of when the message was created.
unstable since: 3.0
purple_message_set_highlighted
Sets whether or not the message should be highlighted.
unstable since: 3.0
purple_message_set_replying_to
Sets the id of the message that this message is a reply to.
unstable since: 3.0
purple_message_set_timestamp_now
Sets PurpleMessage:timestamp to the current UTC time.
unstable since: 3.0
Properties
Purple.Message:delivered
Whether or not the message was delivered. This is protocol dependent and
possibly client dependent as well. So if this is FALSE that doesn’t
necessarily mean the message was not delivered.
unstable since: 3.0
Purple.Message:delivered-at
The time that the message was delivered. This is protocol dependent and
possibly client dependent as well. So if this is NULL that doesn’t
necessarily mean the message was not delivered.
unstable since: 3.0
Purple.Message:edited-at
The time that the message was last edited at. This is protocol dependent
and possibly client dependent as well. So if this is NULL that doesn’t
necessarily mean the message was not edited.
unstable since: 3.0
Purple.Message:error
An error that this message encountered. This could be something like a failed delivery, or failed redaction, or rate limited, etc.
unstable since: 3.0
Purple.Message:replying-to
The id of the message that this message is replying to.
unstable since: 3.0
Signals
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.