Attachments

Attachments — Message Attachments

Functions

Properties

char * content-type Read / Write / Construct Only
guint64 id Read / Write / Construct
char * local-uri Read / Write / Construct
char * remote-uri Read / Write / Construct
guint64 size Read / Write / Construct

Types and Values

Object Hierarchy

    GInterface
    ╰── TalkatuAttachment

Known Implementations

TalkatuAttachment is implemented by TalkatuSimpleAttachment.

Description

Attachments can be images, files, etc that can be attached to a TalkatuMessage.

Functions

TalkatuAttachmentForeachFunc ()

void
(*TalkatuAttachmentForeachFunc) (TalkatuAttachment *attachment,
                                 gpointer data);

TalkatuAttachmentForeachFunc is a callback function called against each TalkatuAttachment in a collection.

Parameters

attachment

A TalkatuAttachment instance.

 

data

Caller supplied data.

 

talkatu_attachment_get_id ()

guint64
talkatu_attachment_get_id (TalkatuAttachment *attachment);

Gets the ID associated with attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The ID of attachment .

talkatu_attachment_get_hash_key ()

guint64 *
talkatu_attachment_get_hash_key (TalkatuAttachment *attachment);

Gets the hash key of attachment . This should only be used when trying to address a TalkatuAttachment in a GHashTable that is using g_int64_hash() as the key function.

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The hash key of attachment .

[transfer none]

talkatu_attachment_set_id ()

void
talkatu_attachment_set_id (TalkatuAttachment *attachment,
                           guint64 id);

Sets the ID of attachment to id .

Parameters

attachment

The TalkatuAttachment instance.

 

id

The new ID for attachment .

 

talkatu_attachment_get_content_type ()

gchar *
talkatu_attachment_get_content_type (TalkatuAttachment *attachment);

Returns the content type of the attachment.

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The content type of attachment .

talkatu_attachment_get_local_uri ()

gchar *
talkatu_attachment_get_local_uri (TalkatuAttachment *attachment);

Gets the local URI if any for attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The local URI for attachment .

talkatu_attachment_set_local_uri ()

void
talkatu_attachment_set_local_uri (TalkatuAttachment *attachment,
                                  const gchar *local_uri);

Sets the local URI of attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

local_uri

The new local URI.

 

talkatu_attachment_get_remote_uri ()

gchar *
talkatu_attachment_get_remote_uri (TalkatuAttachment *attachment);

Gets the remote URI if any for attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The remote URI for attachment .

[nullable]

talkatu_attachment_set_remote_uri ()

void
talkatu_attachment_set_remote_uri (TalkatuAttachment *attachment,
                                   const gchar *remote_uri);

Sets the remote URI of attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

remote_uri

The new remote URI.

 

talkatu_attachment_get_size ()

guint64
talkatu_attachment_get_size (TalkatuAttachment *attachment);

Gets the size of attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The size of attachment .

talkatu_attachment_set_size ()

void
talkatu_attachment_set_size (TalkatuAttachment *attachment,
                             guint64 size);

Sets the size of attachment to size .

Parameters

attachment

The TalkatuAttachment instance.

 

size

The new size of attachment .

 

talkatu_attachment_get_filename ()

gchar *
talkatu_attachment_get_filename (TalkatuAttachment *attachment);

Gets the base filename for attachment . Remote URI will be checked before local URI, but the basename of one of those is what will be returned.

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

The filename for attachment .

[transfer full]

talkatu_attachment_get_preview ()

GIcon *
talkatu_attachment_get_preview (TalkatuAttachment *attachment);

Create a GIcon as a preview for attachment .

Parameters

attachment

The TalkatuAttachment instance.

 

Returns

A preview image of attachment .

[transfer full]

Types and Values

TALKATU_TYPE_ATTACHMENT

#define TALKATU_TYPE_ATTACHMENT (talkatu_attachment_get_type())

The standard _get_type macro for TalkatuAttachment.

struct TalkatuAttachmentInterface

struct TalkatuAttachmentInterface {
	guint64 *(*get_hash_key)(TalkatuAttachment *attachment);
};

TalkatuAttachmentInterface defines the methods and behaviors that make up a TalkatuAttachment. This was made an interface so clients can represent their data however they want but still provide a common interface for Talkatu to work with.

Members

get_hash_key ()

A function that returns the key to hash the attachment with. This is typically just a pointer to the internal id variable, which is necessary due to the differences in 64-bit integers across platforms.

 

TalkatuAttachment

typedef struct _TalkatuAttachment TalkatuAttachment;

TalkatuAttachment represents an attached file. The files can be any type of regular file but only images will be previewed based on their actual contents.

Property Details

The “content-type” property

  “content-type”             char *

The content type of the attachment.

Owner: TalkatuAttachment

Flags: Read / Write / Construct Only

Default value: "application/octet-stream"

The “id” property

  “id”                       guint64

The identifier of the attachment.

Owner: TalkatuAttachment

Flags: Read / Write / Construct

Default value: 0

The “local-uri” property

  “local-uri”                char *

The local URI of the attachment.

Owner: TalkatuAttachment

Flags: Read / Write / Construct

Default value: NULL

The “remote-uri” property

  “remote-uri”               char *

The remote URI of the attachment.

Owner: TalkatuAttachment

Flags: Read / Write / Construct

Default value: NULL

The “size” property

  “size”                     guint64

The file size of the attachment in bytes.

Owner: TalkatuAttachment

Flags: Read / Write / Construct

Default value: 0