mail::ACCOUNT::updateFolderIndexFlags — Update status of multiple messages


#include <libmail/sync.H>

mail::ACCOUNT *mail;

bool ok=mail->updateFolderIndexFlags( const std::vector<size_t> msgList,
  bool doFlip,
  bool enableDisable,
  const messageInfo &msgInfo);

std::string errmsg=mail->getErrmsg();


This is a version of mail::ACCOUNT::saveFolderIndexInfo(3x) that updates the status of multiple messages with one request.

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. When a message is removed from the folder, by mail::ACCOUNT::updateFolderIndexInfo(3x), the following messages are renumbered accordingly.


Most mail servers allow multiple applications to open the same folder. Therefore, changes to the folder's contents can occur at any time. Before making this request, the application should use mail::ACCOUNT::checkNewMail(3x) to verify that no unexpected changes have been made to the folder's contents.

msgInfo selects which message status flags should be updated in every message. See mail::ACCOUNT::getFolderIndexInfo(3x).

msgInfo does NOT specify the new value of the status flags, only which status flags should be updated. For example, setting msgInfo.marked to true indicates that the messages' marked status flag will be set to the value specified by doFlip and enableDisable.

Setting doFlip to true "flips" the selected status flags (each message's flag will be set to false if the status flag was originally true, and set to true if the status flag was originalfalse). If doFlip is false, then the selected status flags are set to the value of enableDisable enableDisable is ignored when Setting doFlip is true.

Return Codes

This method returns true if it succeeds, or false if it fails. If the method fails, use mail::ACCOUNT::getErrmsg() to read a brief description of the error.