![]() |
![]() |
![]() |
![]() |
char * | author | Read / Write / Construct |
GdkRGBA * | author-name-color | Read / Write / Construct |
TalkatuContentType | content-type | Read / Write / Construct Only |
char * | contents | Read / Write / Construct |
gboolean | edited | Read / Write / Construct |
char * | id | Read / Write / Construct |
GDateTime * | timestamp | Read / Write / Construct Only |
enum | TalkatuContentType |
#define | TALKATU_TYPE_MESSAGE |
struct | TalkatuMessageInterface |
TalkatuMessage |
Talkatu needs a way to represent a message in a client agnostic way, this is the API that does that.
gchar *
talkatu_message_get_id (TalkatuMessage *message
);
Gets the identifier of the message
.
void talkatu_message_set_id (TalkatuMessage *message
,const gchar *id
);
Sets the identifier of message
.
GDateTime *
talkatu_message_get_timestamp (TalkatuMessage *message
);
Gets the timestamp for when this message was created.
void talkatu_message_set_timestamp (TalkatuMessage *message
,GDateTime *timestamp
);
Sets the creation timestamp for message
to timestamp
.
message |
The TalkatuMessage instance. |
|
timestamp |
The new timestamp for |
[nullable] |
TalkatuContentType
talkatu_message_get_content_type (TalkatuMessage *message
);
Gets the content-type of message
.
void talkatu_message_set_content_type (TalkatuMessage *message
,TalkatuContentType content_type
);
Sets the content type of message
to content_type
.
gchar *
talkatu_message_get_author (TalkatuMessage *message
);
Gets the author of message
.
void talkatu_message_set_author (TalkatuMessage *message
,const gchar *author
);
Sets the author of message
to author
.
GdkRGBA *
talkatu_message_get_author_name_color (TalkatuMessage *message
);
Gets a GdkRGBA that the author's name will be rendered with or NULL
if no
color is set.
void talkatu_message_set_author_name_color (TalkatuMessage *message
,GdkRGBA *color
);
Sets the color for the name of the author of message
to color
. Calling
this with color
set to NULL
will unset a previously set color.
gchar *
talkatu_message_get_contents (TalkatuMessage *message
);
Gets the contents of message
.
void talkatu_message_set_contents (TalkatuMessage *message
,const gchar *contents
);
Sets the contents of message
to contents
.
gboolean
talkatu_message_get_edited (TalkatuMessage *message
);
Gets whether message
has been edited by its author.
void talkatu_message_set_edited (TalkatuMessage *message
,gboolean edited
);
Sets whether message
has been edited or not.
gboolean talkatu_message_add_attachment (TalkatuMessage *message
,TalkatuAttachment *attachment
);
Adds attachment
to message
.
Returns TRUE
if an attachment with the same ID did not already exist.
gboolean talkatu_message_remove_attachment (TalkatuMessage *message
,guint64 id
);
Removes the TalkatuAttachment identified by id
if it exists.
TalkatuAttachment * talkatu_message_get_attachment (TalkatuMessage *message
,guint64 id
);
Retrieves the TalkatuAttachment identified by id
from message
.
void talkatu_message_foreach_attachment (TalkatuMessage *message
,TalkatuAttachmentForeachFunc func
,gpointer data
);
Calls func
for each TalkatuAttachment that's attached to message
.
message |
The TalkatuMessage instance. |
|
func |
The TalkatuAttachmentForeachFunc to call. |
[scope call] |
data |
User data to pass to |
void
talkatu_message_clear_attachments (TalkatuMessage *message
);
Removes all attachments from message
.
#define TALKATU_TYPE_MESSAGE (talkatu_message_get_type())
The standard _get_type macro for TalkatuMessage.
struct TalkatuMessageInterface { gboolean (*add_attachment)(TalkatuMessage *message, TalkatuAttachment *attachment); gboolean (*remove_attachment)(TalkatuMessage *message, guint64 id); TalkatuAttachment *(*get_attachment)(TalkatuMessage *message, guint64 id); void (*foreach_attachment)(TalkatuMessage *message, TalkatuAttachmentForeachFunc func, gpointer data); void (*clear_attachments)(TalkatuMessage *message); };
TalkatuMessage is an interface to be implemented that standardizes the way messages are handled. All of its properties should be overridden with a sensible value returned for them.
It also needs to implement a storage mechanism for attachments which are identified by a guint64.
The add_attachment vfunc is called to add an attachment to the message. |
||
The remove_attachment vfunc is called to remove an attachment from the message. |
||
The get_attachment vfunc gets an attachment from the message. |
||
The foreach_attachment vfunc is called to iterate over each attachment in the message and call the provided TalkatuForeachAttachmentFunc on them. |
||
The clear_attachments vfunc is called to clear all attachments from the message. |
typedef struct _TalkatuMessage TalkatuMessage;
TalkatuMessage is an opaque data structure and can only be accessed using the following functions.
“author”
property“author” char *
The author of the message.
Owner: TalkatuMessage
Flags: Read / Write / Construct
Default value: NULL
“author-name-color”
property“author-name-color” GdkRGBA *
The color to use when rendering the author's name.
Owner: TalkatuMessage
Flags: Read / Write / Construct
“content-type”
property“content-type” TalkatuContentType
The content-type of the message.
Owner: TalkatuMessage
Flags: Read / Write / Construct Only
Default value: TALKATU_CONTENT_TYPE_PLAIN
“contents”
property“contents” char *
The contents of the message.
Owner: TalkatuMessage
Flags: Read / Write / Construct
Default value: NULL
“edited”
property“edited” gboolean
Whether this message has been edited by its author.
Owner: TalkatuMessage
Flags: Read / Write / Construct
Default value: FALSE
“id”
property“id” char *
The identifier of the message.
Owner: TalkatuMessage
Flags: Read / Write / Construct
Default value: NULL
“timestamp”
property“timestamp” GDateTime *
The timestamp of the message.
Owner: TalkatuMessage
Flags: Read / Write / Construct Only