mail::account::copyMessagesTo
Prev | mail::account Native API reference | Next

## Name

mail::account::copyMessagesTo — Copy 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->copyMessagesTo(` | const std::vector<size_t> & | msgList,
| mail::folder * | copyTo,
| myCallback & | callback`)`;

## USAGE

`mail::account::copyMessagesTo` copies messages in 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.

`copyTo` is a pointer to a mail::folder object, representing the folder where messages are copied to. If `account` is an IMAP account and `copyTo` is another folder in the same account, then the messages are quickly copied by the IMAP server. Otherwise each message is individually downloaded and copied to the `copyTo` folder.

## 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.

## SEE ALSO

mail::account::moveMessagesTo(3x), mail::account::open(3x).

Prev | Up | Next
mail::account::checkNewMail | Home | ToC | mail::account::findFolder