Name

mail::account::copyMessagesTo — Move messages to another folder

Synopsis




#include <libmail/mail.H>


class myCallback : public mail::callback {
public:
    void success(std::string msg);
    void fail(std::string msg);
};

account->moveMessagesTo( const std::vector<size_t> &msgList,
  mail::folder *copyTo,
  myCallback &callback);
 

USAGE

mail::account::moveMessagesTo moves messages from the currently-open folder to another folder. msgList specifies a list of messages. Messages are numbered starting with message #0 and up to one less than mail::account::getFolderIndexSize(3x)() (when mail::account::getFolderIndexSize returns 6, the messages are numbered 0 through 5). Only the messages that appear in msgList are processed by this request.

This is similar to mail::account::copyMessagesTo(3x), except that the messages are removed from the original folder. The application can expect that the mail::account::messagesRemoved function in the currently opened folder's mail::callback::folder object will be invoked one or more times, as necessary, to reflect the removal of the listed messages from the currently open folder.

copyTo is a pointer to a mail::folder object, representing the folder where messages are moved to. copyTo may be a folder in another mail account, in which case this function transparently copies the indicated messages using mail::account::removeMessages(3x). Only SMAP and maildir-based mail accounts can move messages directly between folders; for all other accounts the copy/delete implementation will be used automatically.

Return Codes

The application must wait until callback's success or fail method is invoked. The success method is invoked when this request is succesfully processed. The fail method is invoked if this request cannot be processed. The application must not destroy callback until either the success or fail method is invoked.

Note

callback's fail method may be invoked even after other callback methods were invoked. This indicates that the request was partially completed before the error was encountered.

Note

Multiple applications may have the same account and folder opened at the same time. It is possible that a message referenced by this request was already deleted by another application. Depending on the underlying server implementation this will result in either a failed request, invoking callback.fail, or the request completing (callback.success invoked) but without invoking any callback function that refer to the message.

Note

If this request is interrupted, for some reason, it is possible that some or all messages have already been copied to the destination folder, but not yet removed from the original folder.