本文整理汇总了C++中mail::callback::success方法的典型用法代码示例。如果您正苦于以下问题:C++ callback::success方法的具体用法?C++ callback::success怎么用?C++ callback::success使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mail::callback
的用法示例。
在下文中一共展示了callback::success方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DOFLAG
void mail::maildir::saveFolderIndexInfo(size_t msgNum,
const mail::messageInfo &info,
mail::callback &callback)
{
if (msgNum >= index.size())
{
callback.success("OK");
return;
}
mail::messageInfo &newFlags=index[msgNum];
#define DOFLAG(dummy, field, dummy2) \
newFlags.field=info.field;
LIBMAIL_MSGFLAGS;
#undef DOFLAG
string errmsg="Message updated";
if (!updateFlags(msgNum))
errmsg="Folder opened in read-only mode.";
callback.success(errmsg);
}
示例2:
void mail::maildir::folder::readFolderInfo( mail::callback::folderInfo
&callback1,
mail::callback &callback2) const
{
if (isDestroyed(callback2))
return;
callback1.messageCount=0;
callback1.unreadCount=0;
vector<maildirMessageInfo> dummyIndex;
if (!maildirAccount->scan(path, dummyIndex, true))
{
callback1.success();
callback2.fail("Invalid folder");
return;
}
vector<maildirMessageInfo>::iterator b=dummyIndex.begin(),
e=dummyIndex.end();
while (b != e)
{
callback1.messageCount++;
if ( b->unread)
callback1.unreadCount++;
b++;
}
callback1.success();
callback2.success("OK");
}
示例3: catch
void mail::addressbook::getEntry( string uid,
vector<T> &addrListArg,
mail::callback &callback)
{
size_t n=index.size();
size_t i;
for (i=0; i<n; i++)
if (server->getFolderIndexInfo(i).uid == uid)
{
GetAddressList<T> *get=
new GetAddressList<T>(this, i,
addrListArg,
callback);
if (!get)
{
callback.fail(strerror(errno));
return;
}
try {
get->go();
} catch (...) {
delete get;
LIBMAIL_THROW(LIBMAIL_THROW_EMPTY);
}
return;
}
callback.success("NOT FOUND.");
}
示例4: catch
void mail::maildir::folder::destroy(mail::callback &callback,
bool destroyDir) const
{
if (isDestroyed(callback))
return;
if (!destroyDir) // Folder directories are imaginary, cannot be nuked
{
string s;
char *d=maildir_name2dir(maildirAccount->path.c_str(),
path.c_str());
if (!d)
{
callback.fail(strerror(errno));
return;
}
try {
s=d;
free(d);
} catch (...) {
free(d);
LIBMAIL_THROW(LIBMAIL_THROW_EMPTY);
}
if (!mail::maildir::maildirdestroy(s))
{
callback.fail(strerror(errno));
return;
}
}
callback.success("Mail folder deleted");
}
示例5: f
void mail::imap::findFolder(string folder,
mail::callback::folderList &callback1,
mail::callback &callback2)
{
if (!ready(callback2))
return;
if (folder.size() == 0) // Top level hierarchy
{
mail::imapFolder f(*this, "", "", "", -1);
f.hasMessages(false);
f.hasSubFolders(true);
vector<const mail::folder *> list;
list.push_back(&f);
callback1.success(list);
callback2.success("OK");
return;
}
installForegroundTask( smap ?
(imapHandler *)
new mail::smapLISToneFolder(folder,
callback1,
callback2)
: new mail::imapListHandler(callback1,
callback2,
folder_chset(),
folder,
true));
}
示例6:
mail::maildir::maildir(mail::callback::disconnect &disconnect_callback,
mail::callback &callback,
string pathArg)
: mail::account(disconnect_callback), CONSTRUCTOR
{
if (init(callback, pathArg))
callback.success("Mail folders opened");
}
示例7: tempFolder
void mail::maildir::findFolder(string folder,
mail::callback::folderList &callback1,
mail::callback &callback2)
{
mail::maildir::folder tempFolder(this, folder);
vector<const mail::folder *> folderList;
folderList.push_back(&tempFolder);
callback1.success(folderList);
callback2.success("OK");
}
示例8:
void mail::imapFolder::readFolderInfo(mail::callback::folderInfo &callback1,
mail::callback &callback2) const
{
if (isDestroyed(callback2))
return;
if (imapAccount.currentFolder &&
imapAccount.currentFolder->path == path)
{
imapFOLDERinfo *f=imapAccount.currentFolder;
vector<imapFOLDERinfo::indexInfo>::iterator b, e;
b=f->index.begin();
e=f->index.end();
callback1.messageCount=f->index.size();
callback1.unreadCount=0;
while (b != e)
{
if (b->unread)
++callback1.unreadCount;
b++;
}
callback1.success();
callback2.success("OK");
return;
}
if (!imapAccount.smap && callback1.fastInfo &&
!imapAccount.hasCapability(LIBMAIL_CHEAPSTATUS))
{
callback2.success("OK");
return;
}
imapAccount.folderStatus(path, callback1, callback2);
}
示例9: newFolder
void mail::mbox::folder::createSubFolder(string name,
bool isDirectory,
mail::callback::folderList &callback1,
mail::callback &callback2) const
{
string fpath;
char *p=libmail_u_convert_tobuf(name.c_str(), unicode_default_chset(),
unicode_x_imap_modutf7 " ./~:", NULL);
if (!p)
LIBMAIL_THROW("Out of memory.");
try {
fpath=path + "/" + p;
free(p);
} catch (...) {
free(p);
LIBMAIL_THROW(LIBMAIL_THROW_EMPTY);
}
if (isDirectory) {
if (mkdir(fpath.c_str(), 0700) < 0)
{
callback2.fail(fpath + ": " + strerror(errno));
return;
}
} else {
int fd= ::open(fpath.c_str(), O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd < 0)
{
callback2.fail(fpath + ": " + strerror(errno));
return;
}
close(fd);
}
folder newFolder(fpath, mboxAccount);
vector<const mail::folder *> folderList;
folderList.push_back(&newFolder);
callback1.success(folderList);
callback2.success("OK");
}
示例10:
void mail::addressbook::getIndex( list< pair<string, std::string> > &listArg,
mail::callback &callback)
{
size_t n=index.size();
size_t i;
for (i=0; i<n; i++)
{
string nickname=index[i].nickname;
string uid=index[i].uid;
if (nickname.size() > 0 && uid.size() > 0)
listArg.push_back( make_pair(nickname, uid));
}
callback.success("Address book index retrieved");
}
示例11: inbox
void mail::maildir::readTopLevelFolders(mail::callback::folderList &callback1,
mail::callback &callback2)
{
mail::maildir::folder inbox(this, INBOX);
mail::maildir::folder folders(this, INBOX);
inbox.hasSubfoldersFlag=false;
folders.hasMessagesFlag=false;
vector<const mail::folder *> folderList;
folderList.push_back(&inbox);
if (!ispop3maildrop)
folderList.push_back(&folders);
callback1.success(folderList);
callback2.success("OK");
}
示例12:
void mail::mbox::folder::readFolderInfo( mail::callback::folderInfo
&callback1,
mail::callback &callback2) const
{
if (isDestroyed(callback2))
return;
callback1.messageCount=0;
callback1.unreadCount=0;
if (path.size() == 0)
{
callback1.success();
callback2.success("OK");
return;
}
mboxAccount.installTask(new mail::mbox::StatusTask(path, mboxAccount, callback2,
callback1));
}
示例13: strerror
void mail::mbox::folder::create(bool isDirectory,
mail::callback &callback) const
{
if (isDirectory) {
if (mkdir(path.c_str(), 0700) < 0)
{
callback.fail(path + ": " + strerror(errno));
return;
}
} else {
int fd= ::open(path.c_str(), O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd < 0)
{
callback.fail(path + ": " + strerror(errno));
return;
}
close(fd);
}
callback.success("OK");
}
示例14: catch
void mail::maildir::updateKeywords(const vector<size_t> &messages,
const set<string> &keywords,
bool setOrChange,
bool changeTo,
mail::callback &cb)
{
bool keepGoing;
if (folderPath.size() == 0)
{
cb.success("Ok.");
return;
}
string dir;
{
char *dirs=maildir_name2dir(path.c_str(), folderPath.c_str());
if (!dirs)
{
cb.fail(strerror(errno));
return;
}
try {
dir=dirs;
free(dirs);
} catch (...) {
free(dirs);
LIBMAIL_THROW(LIBMAIL_THROW_EMPTY);
}
}
if (!setOrChange)
{
if (!updateKeywords(dir,
messages, keywords, setOrChange, changeTo,
NULL, NULL))
{
cb.fail(strerror(errno));
return;
}
}
else do {
struct libmail_kwGeneric g;
libmail_kwgInit(&g);
char *imap_lock=NULL;
if (lockFolder)
{
int flag;
imap_lock=maildir_lock(dir.c_str(), lockFolder,
&flag);
if (!imap_lock)
{
if (!flag)
{
libmail_kwgDestroy(&g);
cb.fail(strerror(errno));
return;
}
}
}
try {
if (libmail_kwgReadMaildir(&g, dir.c_str()) < 0)
{
if (imap_lock)
{
unlink(imap_lock);
free(imap_lock);
imap_lock=NULL;
}
cb.fail(strerror(errno));
return;
}
keepGoing=false;
if (!updateKeywords(dir,
messages, keywords, setOrChange,
changeTo,
&g, &keepGoing))
{
if (imap_lock)
{
unlink(imap_lock);
free(imap_lock);
imap_lock=NULL;
}
libmail_kwgDestroy(&g);
if (keepGoing)
continue;
cb.fail(strerror(errno));
//.........这里部分代码省略.........