mail::folder::destroy — Destroy an existing folder


#include <libmail/mail.H>

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

folder->create( myCallback &callback,
  bool destroyDir);


This function destroys the folder referenced by this mail::folder object. The mail::folder object itself is not destroyed (the usual C++ delete operator does the trick there), only the actual folder is destroyed.

Folders contain either messages, or other sub-folders (so-called "folder directories"). Some mail accounts may contain dual-purpose folders that contain both messages and sub-folders (see mail::account::createSubFolder(3x) for more information). With some account types, only completely empty folders may be deleted (the operation will fail if the folder still contains messages or other sub-folders).

destroyDir must be set to true when destroying a folder directory, and to false when destroying a regular folder.


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.


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.