TnyHeader

TnyHeader — A type that defines a header

Synopsis




#define             TNY_TYPE_HEADER_FLAGS
                    TnyHeader;
                    TnyHeaderIface;
#define             TNY_HEADER_FLAG_PRIORITY_MASK
GType               tny_header_flags_get_type           (void);
time_t              tny_header_get_date_received        (TnyHeader *self);
time_t              tny_header_get_date_sent            (TnyHeader *self);
guint               tny_header_get_message_size         (TnyHeader *self);
void                tny_header_set_bcc                  (TnyHeader *self,
                                                         const gchar *bcc);
void                tny_header_set_cc                   (TnyHeader *self,
                                                         const gchar *cc);
void                tny_header_set_from                 (TnyHeader *self,
                                                         const gchar *from);
void                tny_header_set_subject              (TnyHeader *self,
                                                         const gchar *subject);
void                tny_header_set_to                   (TnyHeader *self,
                                                         const gchar *to);
void                tny_header_set_replyto              (TnyHeader *self,
                                                         const gchar *to);
TnyFolder*          tny_header_get_folder               (TnyHeader *self);
TnyHeaderFlags      tny_header_get_flags                (TnyHeader *self);
void                tny_header_set_flag                 (TnyHeader *self,
                                                         TnyHeaderFlags mask);
void                tny_header_unset_flag               (TnyHeader *self,
                                                         TnyHeaderFlags mask);
TnyHeaderFlags      tny_header_get_priority             (TnyHeader *self);
void                tny_header_set_priority             (TnyHeader *self,
                                                         TnyHeaderFlags priority);

Object Hierarchy


  GInterface
   +----TnyHeader

Prerequisites

TnyHeader requires GObject.

Known Implementations

TnyHeader is implemented by TnyCamelHeader, TnyCamelBsMsgHeader and TnyCamelMsgHeader.

Description

A header of a TnyMsg instance is the non-body information. It contains for example the "to", the "from", the "subject" and the "sent-date" information. It's typically used by a summary view to give the user an overview of the available messages in a folder.

One TnyHeader means all the typical headers. Not all headers but only the typical ones (like subject, from, dates and to). For getting all headers, wait for or implement an API in TnyMsg as you will need to fetch the entire message for that.

Details

TNY_TYPE_HEADER_FLAGS

#define TNY_TYPE_HEADER_FLAGS (tny_header_flags_get_type())


TnyHeader

typedef struct _TnyHeader TnyHeader;

A summary item, envelope or group of E-mail headers. Depending on how you like to call it.

free-function: g_object_unref


TnyHeaderIface

typedef struct {
	GTypeInterface g;

	gchar* (*dup_uid) (TnyHeader *self);
	gchar* (*dup_bcc) (TnyHeader *self);
	gchar* (*dup_cc) (TnyHeader *self);
	gchar* (*dup_subject) (TnyHeader *self);
	gchar* (*dup_to) (TnyHeader *self);
	gchar* (*dup_from) (TnyHeader *self);
	gchar* (*dup_replyto) (TnyHeader *self);
	gchar* (*dup_message_id) (TnyHeader *self);
	guint (*get_message_size) (TnyHeader *self);
	time_t (*get_date_received) (TnyHeader *self);
	time_t (*get_date_sent) (TnyHeader *self);
	void (*set_bcc) (TnyHeader *self, const gchar *bcc);
	void (*set_cc) (TnyHeader *self, const gchar *cc);
	void (*set_from) (TnyHeader *self, const gchar *from);
	void (*set_subject) (TnyHeader *self, const gchar *subject);
	void (*set_to) (TnyHeader *self, const gchar *to);
	void (*set_replyto) (TnyHeader *self, const gchar *to);
	TnyFolder* (*get_folder) (TnyHeader *self);
	TnyHeaderFlags (*get_flags) (TnyHeader *self);
	void (*set_flag) (TnyHeader *self, TnyHeaderFlags mask);
	void (*unset_flag) (TnyHeader *self, TnyHeaderFlags mask);
} TnyHeaderIface;


TNY_HEADER_FLAG_PRIORITY_MASK

#define TNY_HEADER_FLAG_PRIORITY_MASK (1<<9|1<<10)


tny_header_flags_get_type ()

GType               tny_header_flags_get_type           (void);

GType system helper function

Returns : a GType

tny_header_get_date_received ()

time_t              tny_header_get_date_received        (TnyHeader *self);

Get the Date Received header as a time_t

self : a TnyHeader
Returns : date received header

Since 1.0 audience: application-developer


tny_header_get_date_sent ()

time_t              tny_header_get_date_sent            (TnyHeader *self);

Get the Date Sent header as a time_t

self : a TnyHeader
Returns : date sent header

Since 1.0 audience: application-developer


tny_header_get_message_size ()

guint               tny_header_get_message_size         (TnyHeader *self);

Get the expected message's size (the accuracy of the size prediction depends on the availability of an accurate total size of the message at the service).

self : a TnyHeader
Returns : expected message size

Since 1.0 audience: application-developer


tny_header_set_bcc ()

void                tny_header_set_bcc                  (TnyHeader *self,
                                                         const gchar *bcc);

Set the BCC header. Look at the To header for more information about formatting.

self : a TnyHeader
bcc : (null-ok): the BCC header in a comma separated list or NULL

Since 1.0 audience: application-developer


tny_header_set_cc ()

void                tny_header_set_cc                   (TnyHeader *self,
                                                         const gchar *cc);

Set the CC header. Look at the To header for more information about formatting.

self : a TnyHeader
cc : (null-ok): the CC header in a comma separated list or NULL

Since 1.0 audience: application-developer


tny_header_set_from ()

void                tny_header_set_from                 (TnyHeader *self,
                                                         const gchar *from);

Set the from header

self : a TnyHeader
from : (null-ok): the from header or NULL

Since 1.0 audience: application-developer


tny_header_set_subject ()

void                tny_header_set_subject              (TnyHeader *self,
                                                         const gchar *subject);

Set the subject header

self : a TnyHeader
subject : (null-ok): the subject header or NULL

Since 1.0 audience: application-developer


tny_header_set_to ()

void                tny_header_set_to                   (TnyHeader *self,
                                                         const gchar *to);

Set the To header.

The format is a comma separated list like this: Full name >userdomain<, Full name >userdomain<

There are no quotes nor anything special. Just commas.

self : a TnyHeader
to : (null-ok): the To header in a comma separated list or NULL

Since 1.0 audience: application-developer


tny_header_set_replyto ()

void                tny_header_set_replyto              (TnyHeader *self,
                                                         const gchar *to);

Set the reply-to header

self : a TnyHeader
to : (null-ok): the reply-to header or NULL

Since 1.0 audience: application-developer


tny_header_get_folder ()

TnyFolder*          tny_header_get_folder               (TnyHeader *self);

Get the parent folder where this message header is located. This method can return NULL in case the folder isn't know. The returned value, if not NULL, must be unreferenced after use.

self : a TnyHeader
Returns : (null-ok) (caller-owns): The folder of the message header or NULL

Since 1.0 audience: application-developer


tny_header_get_flags ()

TnyHeaderFlags      tny_header_get_flags                (TnyHeader *self);

Get message's information flags like the message's read state and whether it's detected that it has attachments.

Note: don't use this method to get priority settings. Use tny_header_get_priority in stead.

self : a TnyHeader object
Returns : flags bitmask

Since 1.0 audience: application-developer


tny_header_set_flag ()

void                tny_header_set_flag                 (TnyHeader *self,
                                                         TnyHeaderFlags mask);

Modify message's flag mask. Modifying the TNY_HEADER_FLAG_SEEN will trigger the notification of folder observers if self was originated from a folder.

Do not use this method to set priority settings. Use tny_header_set_priority() in stead. Don't set more than one flag. Use the labels of the TnyHeaderFlags as an enum.

self : a TnyHeader
mask : a TnyHeaderFlags bitmask flag to set.

Since 1.0 audience: application-developer


tny_header_unset_flag ()

void                tny_header_unset_flag               (TnyHeader *self,
                                                         TnyHeaderFlags mask);

Reset message flag mask. Modifying the TNY_HEADER_FLAG_SEEN will trigger the notification of folder observers if self was originated from a folder.

Don't attempt to unset the priority. Use tny_header_set_priority() with TNY_HEADER_FLAG_NORMAL_PRIORITY to set the priority of a message to normal (which is the same as unsetting it). Don't unset multiple flags.

self : a TnyHeader
mask : a TnyHeaderFlags flag to clear.

Since 1.0 audience: application-developer


tny_header_get_priority ()

TnyHeaderFlags      tny_header_get_priority             (TnyHeader *self);

Get message's priority

self : a TnyHeader
Returns : priority of the message

Since 1.0 audience: application-developer


tny_header_set_priority ()

void                tny_header_set_priority             (TnyHeader *self,
                                                         TnyHeaderFlags priority);

Set the priority of the message. To unset the priority, you can use TNY_HEADER_FLAG_NORMAL_PRIORITY as priority. Don't combine priority with other flags. Use additional tny_header_set_flag() calls if you want to do that.

self : a TnyHeader
priority : A priority setting (high, low or normal)

Since 1.0 audience: application-developer

See Also

TnyMsg, TnyFolder, TnyGtkHeaderListModel, TnyHeaderFlags