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

Ancestors

Constructors

purple_message_new

Creates a new message.

unstable since: 3.0

purple_message_new_with_id

Creates a new message with the given properties.

unstable since: 3.0

Instance methods

purple_message_compare_timestamp

Compares two messages.

unstable since: 3.0

purple_message_format_timestamp

Formats the timestamp of the message.

unstable since: 3.0

purple_message_get_action

Gets whether or not the message is an action.

unstable since: 3.0

purple_message_get_attachments

Gets the attachments for the message.

unstable since: 3.0

purple_message_get_attributes

Gets the formatting attributes of the message.

unstable since: 3.0

purple_message_get_author

Gets the author of the message.

unstable since: 3.0

purple_message_get_contents

Gets the contents of the message.

unstable since: 3.0

purple_message_get_delivered

Gets whether or not the message was delivered.

unstable since: 3.0

purple_message_get_delivered_at

Gets the time that the message was delivered at.

unstable since: 3.0

purple_message_get_edited

Gets whether or not the message has been edited.

unstable since: 3.0

purple_message_get_edited_at

Gets the time that the message was last edited.

unstable since: 3.0

purple_message_get_error

Gets the error.

unstable since: 3.0

purple_message_get_event

Gets whether or not the message is for an event.

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_icon

Gets the icon for a message.

unstable since: 3.0

purple_message_get_id

Get the unique identifier of the message.

unstable since: 3.0

purple_message_get_notice

Gets whether or not the message is a notice.

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_system

Gets whether or not the message is a system message.

unstable since: 3.0

purple_message_get_timestamp

Gets the timestamp of when the message was created.

unstable since: 3.0

purple_message_get_title

Gets the title from a message.

unstable since: 3.0

purple_message_is_empty

Checks if the message’s contents are empty.

unstable since: 3.0

purple_message_set_action

Sets whether or not the message is an action.

unstable since: 3.0

purple_message_set_attributes

Sets the formatting attributes of the message.

unstable since: 3.0

purple_message_set_contents

Sets the contents of the message.

unstable since: 3.0

purple_message_set_delivered

Sets whether or not a message was delivered.

unstable since: 3.0

purple_message_set_delivered_at

Sets the delivery time.

unstable since: 3.0

purple_message_set_edited

Sets the edited state of the message.

unstable since: 3.0

purple_message_set_edited_at

Sets the last edit timestamp.

unstable since: 3.0

purple_message_set_error

Sets the error of the message.

unstable since: 3.0

purple_message_set_event

Sets whether or not the message is for an event.

unstable since: 3.0

purple_message_set_highlight_color

Sets the highlight color for the message.

unstable since: 3.0

purple_message_set_highlighted

Sets whether or not the message should be highlighted.

unstable since: 3.0

purple_message_set_icon

Sets the icon for a message.

unstable since: 3.0

purple_message_set_id

Sets the id of the message.

unstable since: 3.0

purple_message_set_notice

Sets whether or not the message is a notice.

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_system

Sets whether or not the message is a system message.

unstable since: 3.0

purple_message_set_timestamp

Sets the timestamp of message.

unstable since: 3.0

purple_message_set_timestamp_now

Sets PurpleMessage:timestamp to the current UTC time.

unstable since: 3.0

purple_message_set_title

Sets the title for a message.

unstable since: 3.0

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Purple.Message:action

Whether or not the message is an action.

unstable since: 3.0

Purple.Message:attachments

The attachments for the message.

unstable since: 3.0

Purple.Message:attributes

The formatting attributes of the message.

unstable since: 3.0

Purple.Message:author

The author of the message.

unstable since: 3.0

Purple.Message:contents

The contents of the message.

unstable since: 3.0

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

Whether or not this message has been edited.

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:event

Whether or not this message is for an event.

unstable since: 3.0

Purple.Message:highlight-color

The color to use if the message is highlighted.

unstable since: 3.0

Purple.Message:highlighted

Whether or not the message should be highlighted.

unstable since: 3.0

Purple.Message:icon

An icon for the message.

unstable since: 3.0

Purple.Message:id

The protocol-specific identifier of the message.

unstable since: 3.0

Purple.Message:notice

Whether or not this message is a notice.

unstable since: 3.0

Purple.Message:replying-to

The id of the message that this message is replying to.

unstable since: 3.0

Purple.Message:system

Whether or not this is a system message.

unstable since: 3.0

Purple.Message:timestamp

The timestamp of the message.

unstable since: 3.0

Purple.Message:title

A title for the message.

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.

Class structure

struct PurpleMessageClass {
  GObjectClass parent_class;
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.