本文整理汇总了C++中boost::shared_ptr::CheckPermission方法的典型用法代码示例。如果您正苦于以下问题:C++ shared_ptr::CheckPermission方法的具体用法?C++ shared_ptr::CheckPermission怎么用?C++ shared_ptr::CheckPermission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::shared_ptr
的用法示例。
在下文中一共展示了shared_ptr::CheckPermission方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IMAPResult
IMAPResult
IMAPCommandEXAMINE::ExecuteCommand(boost::shared_ptr<HM::IMAPConnection> pConnection, boost::shared_ptr<IMAPCommandArgument> pArgument)
{
if (!pConnection->IsAuthenticated())
return IMAPResult(IMAPResult::ResultNo, "Authenticate first");
boost::shared_ptr<IMAPSimpleCommandParser> pParser = boost::shared_ptr<IMAPSimpleCommandParser>(new IMAPSimpleCommandParser());
pParser->Parse(pArgument);
if (pParser->ParamCount() < 1)
return IMAPResult(IMAPResult::ResultBad, "EXAMINE Command requires at least 1 parameter.");
// Fetch the folder
String sFolderName = pParser->GetParamValue(pArgument, 0);
boost::shared_ptr<IMAPFolder> pSelectedFolder = pConnection->GetFolderByFullPath(sFolderName);
if (!pSelectedFolder)
return IMAPResult(IMAPResult::ResultBad, "Folder could not be found.");
if (!pConnection->CheckPermission(pSelectedFolder, ACLPermission::PermissionRead))
return IMAPResult(IMAPResult::ResultBad, "ACL: Read permission denied (Required for EXAMINE command).");
pConnection->SetCurrentFolder(pSelectedFolder, true);
boost::shared_ptr<Messages> pMessages = pSelectedFolder->GetMessages();
long lCount = pMessages->GetCount();
__int64 lFirstUnseenID = pMessages->GetFirstUnseenUID();
long lRecentCount = pMessages->GetNoOfRecent();
String sRespTemp;
sRespTemp.Format(_T("* %d EXISTS\r\n"), lCount);
String sResponse = sRespTemp; // EXISTS
sRespTemp.Format(_T("* %d RECENT\r\n"), lRecentCount);
sResponse += sRespTemp;
sResponse += _T("* FLAGS (\\Deleted \\Seen \\Draft \\Answered \\Flagged)\r\n");
sRespTemp.Format(_T("* OK [UIDVALIDITY %d] current uidvalidity\r\n"), pSelectedFolder->GetCreationTime().ToInt());
sResponse += sRespTemp;
if (lFirstUnseenID > 0)
{
sRespTemp.Format(_T("* OK [UNSEEN %d] unseen messages\r\n"), lFirstUnseenID);
sResponse += sRespTemp;
}
sRespTemp.Format(_T("* OK [UIDNEXT %d] next uid\r\n"), pSelectedFolder->GetCurrentUID()+1);
sResponse += sRespTemp;
sResponse += _T("* OK [PERMANENTFLAGS ()] limited\r\n");
sResponse += pArgument->Tag() + _T(" OK [READ-ONLY] EXAMINE completed\r\n");
pConnection->SendAsciiData(sResponse);
return IMAPResult();
}
示例2: IMAPResult
IMAPResult
IMAPCommandCLOSE::ExecuteCommand(boost::shared_ptr<HM::IMAPConnection> pConnection, boost::shared_ptr<IMAPCommandArgument> pArgument)
{
if (!pConnection->IsAuthenticated())
return IMAPResult(IMAPResult::ResultNo, "Authenticate first");
// Iterate through mail boxes and delete messages marked for deletion.
boost::shared_ptr<IMAPFolder> pCurFolder = pConnection->GetCurrentFolder();
if (!pCurFolder)
return IMAPResult(IMAPResult::ResultBad, "No folder selected.");
// Check if user has permission to expunge. If so, do that.
if (!pConnection->GetCurrentFolderReadOnly() &&
pConnection->CheckPermission(pConnection->GetCurrentFolder(), ACLPermission::PermissionExpunge))
{
pCurFolder->Expunge();
}
pConnection->CloseCurrentFolder();
String sResponse = pArgument->Tag() + " OK CLOSE completed\r\n";
pConnection->SendAsciiData(sResponse);
return IMAPResult();
}