TnyMsgRemoveStrategy

TnyMsgRemoveStrategy — A type that implements removing a message

Synopsis

                    TnyMsgRemoveStrategy;
                    TnyMsgRemoveStrategyIface;
void                tny_msg_remove_strategy_perform_remove
                                                        (TnyMsgRemoveStrategy *self,
                                                         TnyFolder *folder,
                                                         TnyHeader *header,
                                                         GError **err);

Object Hierarchy

  GInterface
   +----TnyMsgRemoveStrategy

Known Implementations

TnyMsgRemoveStrategy is implemented by TnyCamelPopRemoteMsgRemoveStrategy and TnyCamelMsgRemoveStrategy.

Description

A type that implements removing a message from a TnyFolder

Details

TnyMsgRemoveStrategy

typedef struct _TnyMsgRemoveStrategy TnyMsgRemoveStrategy;

A strategy for removing messages

free-function: g_object_unref


TnyMsgRemoveStrategyIface

typedef struct {
	GTypeInterface parent;

	void (*perform_remove) (TnyMsgRemoveStrategy *self, TnyFolder *folder, TnyHeader *header, GError **err);
} TnyMsgRemoveStrategyIface;


tny_msg_remove_strategy_perform_remove ()

void                tny_msg_remove_strategy_perform_remove
                                                        (TnyMsgRemoveStrategy *self,
                                                         TnyFolder *folder,
                                                         TnyHeader *header,
                                                         GError **err);

Performs the removal of a message from folder.

This doesn't remove it from a TnyList that holds the headers (for example for a header summary view) if the tny_folder_get_headers() method happened before the deletion. You are responsible for refreshing your own lists. But take a look at TnyFolderMonitor which serves this purpose.

This method also doesn't have to wipe it immediately from folder. Depending on the implementation it might only mark it as removed (it for example sets the TNY_HEADER_FLAG_DELETED). In such a case only after performing the tny_folder_sync() method on folder, it will really be removed.

In such a case this means that a tny_folder_get_headers() method call will still prepend the removed message to the list. It will do this until the expunge happened. You are advised to hide messages that have been marked as being deleted from your summary view. In Gtk+, for the GtkTreeView component, you can do this using the GtkTreeModelFilter tree model filtering model.

The TnyCamelMsgRemoveStrategy implementation works this way. This implementation is also the default implementation for most TnyFolder implementations in libtinymail-camel

Note that it's possible that another implementation works differently. You could, for example, inherit or decorate the TnyCamelMsgRemoveStrategy implementation by adding code that also permanently removes the message in your inherited special type.

self :

a TnyMsgRemoveStrategy

folder :

a TnyFolder from which the message will be removed

header :

a TnyHeader of the message that must be removed

err :

(null-ok): a GError or NULL

Since 1.0 audience: application-developer

See Also

TnyFolder, TnyMsg, TnyHeader