本文整理汇总了C++中MojObject::null方法的典型用法代码示例。如果您正苦于以下问题:C++ MojObject::null方法的具体用法?C++ MojObject::null怎么用?C++ MojObject::null使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MojObject
的用法示例。
在下文中一共展示了MojObject::null方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetAccount
void PopClient::SetAccount(MojObject& accountId)
{
MojLogTrace(s_log);
assert(m_state == State_None);
assert(!accountId.null());
assert(!accountId.undefined());
m_accountId = accountId;
m_builderFactory->SetAccountId(m_accountId);
}
示例2: UpdateEmailParts
void MojoDatabase::UpdateEmailParts(Signal::SlotRef slot, const MojObject& emailId, const MojObject& parts, bool autoDownload)
{
MojObject email;
MojErr err = email.put(PopEmailAdapter::ID, emailId);
ErrorToException(err);
err = email.put(EmailSchema::PARTS, parts);
ErrorToException(err);
if ((!parts.undefined() && !parts.null() && parts.size() > 0) || !autoDownload) {
err = email.put(PopEmailAdapter::DOWNLOADED, true);
ErrorToException(err);
}
MojLogDebug(PopClient::s_log, "Updating email '%s' with parts: '%s'", AsJsonString(emailId).c_str(), AsJsonString(parts).c_str());
err = m_dbClient.merge(slot, email);
ErrorToException(err);
}
示例3: DownloadAttachment
MojErr PopBusDispatcher::DownloadAttachment(MojServiceMessage* msg, MojObject& payload)
{
// cancel shut down if it is in shut down state
CancelShutdown();
MojLogTrace(s_log);
MojLogInfo(s_log, "Downloading parts from client");
try {
MojObject accountId;
MojErr err = payload.getRequired("accountId", accountId);
ErrorToException(err);
ClientPtr client = GetOrCreateClient(accountId, false);
MojObject folderId;
err = payload.getRequired("folderId", folderId);
ErrorToException(err);
if(folderId.undefined() || folderId.null())
MojErrThrowMsg(MojErrInternal, "Invalid folder ID");
MojObject emailId;
err = payload.getRequired("emailId", emailId);
ErrorToException(err);
MojObject partId;
err = payload.getRequired("partId", partId);
ErrorToException(err);
boost::shared_ptr<DownloadListener> listener(new DownloadListener(msg, emailId, partId));
client->DownloadPart(folderId, emailId, partId, listener);
return MojErrNone;
} catch (const std::exception& e) {
MojErrThrowMsg(MojErrInternal, "exception: %s", e.what());
}
return MojErrNone;
}
示例4: LoginSuccess
void SmtpValidator::LoginSuccess()
{
if (m_timeoutId) {
g_source_remove(m_timeoutId);
m_timeoutId = 0;
}
//MojLogInfo(m_log, "SmtpValidator %p LoginSuccess, was trying to connect to %s:%d", this, m_account->GetHostname().c_str(), m_account->GetPort());
MojLogInfo(m_log, "SmtpValidator %p LoginSuccess", this);
try {
MojObject reply;
MojErr err;
err = reply.putBool(MojServiceMessage::ReturnValueKey, true);
ErrorToException(err);
if(m_account->GetEncryption() == SmtpAccount::Encrypt_TLSIfAvailable) {
// Update protocol settings
MojObject config;
if(m_protocolSettings.get(SmtpAccountAdapter::CONFIG, config) && !config.null()) {
err = config.putString(SmtpAccountAdapter::ENCRYPTION,
m_tlsSupported ? SmtpAccountAdapter::TLS : SmtpAccountAdapter::NO_SSL);
ErrorToException(err);
err = m_protocolSettings.put(SmtpAccountAdapter::CONFIG, config);
ErrorToException(err);
}
}
err = reply.put("protocolSettings", m_protocolSettings);
ErrorToException(err);
// create credentials object
MojObject password;
err = password.putString("password", m_account->GetPassword().c_str());
ErrorToException(err);
MojObject smtp;
err = smtp.put("smtp", password);
ErrorToException(err);
err = reply.put("credentials", smtp);
ErrorToException(err);
if (!m_replied) {
// if we already replied due to a timeout, don't reply again.
err = m_msg->reply(reply);
ErrorToException(err);
m_replied = true;
}
} catch (const exception& e) {
if (!m_replied) {
// if we already replied due to a timeout, don't reply again.
m_msg->replyError(MojErrInternal);
m_replied = true;
}
}
RunState(State_SendQuitCommand);
return;
}
示例5: ParseDatabaseObject
void EmailAdapter::ParseDatabaseObject(const MojObject& obj, Email& email)
{
MojErr err;
MojObject folderId;
err = obj.getRequired(FOLDER_ID, folderId);
ErrorToException(err);
email.SetFolderId(folderId);
MojString subject;
err = obj.getRequired(SUBJECT, subject);
ErrorToException(err);
email.SetSubject( std::string(subject) );
MojObject fromAddress;
err = obj.getRequired(FROM, fromAddress);
ErrorToException(err);
email.SetFrom( ParseAddress(fromAddress) );
// Optional replyTo address
MojObject replyTo;
if(obj.get(REPLY_TO, replyTo) && !replyTo.null()) {
email.SetReplyTo( ParseAddress(replyTo) );
}
MojInt64 timestamp;
err = obj.getRequired(TIMESTAMP, timestamp);
ErrorToException(err);
email.SetDateReceived(timestamp);
// Parse recipients
MojObject recipients;
err = obj.getRequired(RECIPIENTS, recipients);
ErrorToException(err);
ParseRecipients(recipients, email);
// Parse flags
MojObject flags;
if (obj.get(FLAGS, flags)) {
ParseFlags(flags, email);
}
// Parse parts
MojObject parts;
err = obj.getRequired(PARTS, parts);
ErrorToException(err);
EmailPartList partList;
ParseParts(parts, partList);
email.SetPartList(partList);
MojObject originalMsgId;
if (obj.get(ORIGINAL_MSG_ID, originalMsgId)) {
email.SetOriginalMsgId(originalMsgId);
}
MojString draftType;
bool hasDraftType = false;
err = obj.get(DRAFT_TYPE, draftType, hasDraftType);
ErrorToException(err);
if (hasDraftType) {
email.SetDraftType( ParseDraftType(draftType) );
}
MojString priority;
bool hasPriority = false;
err = obj.get(PRIORITY, priority, hasPriority);
ErrorToException(err);
// If no priority exists, this will default to normal
email.SetPriority(ParsePriority(priority));
email.SetMessageId( DatabaseAdapter::GetOptionalString(obj, MESSAGE_ID) );
email.SetInReplyTo( DatabaseAdapter::GetOptionalString(obj, IN_REPLY_TO) );
// SendStatus
// NOTE: This is not being serialized back to the database in SerializeToDatabaseObject
MojObject sendStatus;
if (obj.get(SEND_STATUS, sendStatus)) {
bool isSent = false;
if (sendStatus.get(SendStatus::SENT, isSent)) {
email.SetSent(isSent);
}
bool hasFatalError = false;
if (sendStatus.get(SendStatus::FATAL_ERROR, hasFatalError)) {
email.SetHasFatalError(hasFatalError);
}
MojInt64 retryCount;
if (sendStatus.get(SendStatus::RETRY_COUNT, retryCount)) {
email.SetRetryCount(retryCount);
}
MojObject sendError;
if (sendStatus.get(SendStatus::ERROR, sendError)) {
MojObject errorCode;
if (sendError.get(SendStatusError::ERROR_CODE, errorCode) && !errorCode.null() && !errorCode.undefined()) {
email.SetSendError(static_cast<MailError::ErrorCode>(errorCode.intValue()));
}
}
}
}