本文整理汇总了C++中mercury::Bundle::appendBlob方法的典型用法代码示例。如果您正苦于以下问题:C++ Bundle::appendBlob方法的具体用法?C++ Bundle::appendBlob怎么用?C++ Bundle::appendBlob使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mercury::Bundle
的用法示例。
在下文中一共展示了Bundle::appendBlob方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onReqCreateAccountResult
//-------------------------------------------------------------------------------------
void Loginapp::onReqCreateAccountResult(Mercury::Channel* pChannel, MemoryStream& s)
{
SERVER_ERROR_CODE failedcode;
std::string accountName;
std::string password;
std::string retdatas = "";
s >> failedcode >> accountName >> password;
s.readBlob(retdatas);
DEBUG_MSG(boost::format("Loginapp::onReqCreateAccountResult: accountName=%1%, failedcode=%2%.\n") %
accountName.c_str() % failedcode);
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName);
if(ptinfos == NULL)
return;
Mercury::Channel* pClientChannel = this->getNetworkInterface().findChannel(ptinfos->addr);
if(pClientChannel == NULL)
return;
pClientChannel->extra("");
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
bundle << failedcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pClientChannel);
SAFE_RELEASE(ptinfos);
}
示例2: login
//-------------------------------------------------------------------------------------
bool ClientObject::login()
{
if(error_ != C_ERROR_NONE)
return false;
Mercury::Bundle bundle;
std::string bindatas = "bots client";
// 提交账号密码请求登录
bundle.newMessage(LoginappInterface::login);
CLIENT_CTYPE tclient = CLIENT_TYPE_BOTS;
bundle << tclient;
bundle.appendBlob(bindatas);
bundle << name_;
bundle << password_;
bundle.send(*pChannel_->endpoint());
return true;
}
示例3: onReqCreateMailAccountResult
//-------------------------------------------------------------------------------------
void Loginapp::onReqCreateMailAccountResult(Mercury::Channel* pChannel, MemoryStream& s)
{
SERVER_ERROR_CODE failedcode;
std::string accountName;
std::string password;
std::string retdatas = "";
s >> failedcode >> accountName >> password;
s.readBlob(retdatas);
DEBUG_MSG(boost::format("Loginapp::onReqCreateMailAccountResult: accountName=%1%, failedcode=%2%.\n") %
accountName.c_str() % failedcode);
if(failedcode == SERVER_SUCCESS)
{
threadPool_.addTask(new SendActivateEMailTask(accountName, retdatas,
g_kbeSrvConfig.getLoginApp().http_cbhost,
g_kbeSrvConfig.getLoginApp().http_cbport));
}
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName);
if(ptinfos == NULL)
return;
Mercury::Channel* pClientChannel = this->getNetworkInterface().findChannel(ptinfos->addr);
if(pClientChannel == NULL)
return;
pClientChannel->extra("");
retdatas = "";
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
bundle << failedcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pClientChannel);
SAFE_RELEASE(ptinfos);
}
示例4: _createAccount
//-------------------------------------------------------------------------------------
bool Loginapp::_createAccount(Mercury::Channel* pChannel, std::string& accountName,
std::string& password, std::string& datas, ACCOUNT_TYPE type)
{
accountName = KBEngine::strutil::kbe_trim(accountName);
password = KBEngine::strutil::kbe_trim(password);
if(accountName.size() > ACCOUNT_NAME_MAX_LENGTH)
{
ERROR_MSG(boost::format("Loginapp::_createAccount: accountName too big, size=%1%, limit=%2%.\n") %
accountName.size() % ACCOUNT_NAME_MAX_LENGTH);
return false;
}
if(password.size() > ACCOUNT_PASSWD_MAX_LENGTH)
{
ERROR_MSG(boost::format("Loginapp::_createAccount: password too big, size=%1%, limit=%2%.\n") %
password.size() % ACCOUNT_PASSWD_MAX_LENGTH);
return false;
}
if(datas.size() > ACCOUNT_DATA_MAX_LENGTH)
{
ERROR_MSG(boost::format("Loginapp::_createAccount: bindatas too big, size=%1%, limit=%2%.\n") %
datas.size() % ACCOUNT_DATA_MAX_LENGTH);
return false;
}
std::string retdatas = "";
if(shuttingdown_)
{
WARNING_MSG(boost::format("Loginapp::_createAccount: shutting down, create %1% failed!\n") % accountName);
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_SHUTTINGDOWN;
bundle << retcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pChannel);
return false;
}
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.find(const_cast<std::string&>(accountName));
if(ptinfos != NULL)
{
WARNING_MSG(boost::format("Loginapp::_createAccount: pendingCreateMgr has %1%, request create failed!\n") %
accountName);
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_BUSY;
bundle << retcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pChannel);
return false;
}
if(type == ACCOUNT_TYPE_SMART)
{
if (email_isvalid(accountName.c_str()))
{
type = ACCOUNT_TYPE_MAIL;
}
else
{
if(!validName(accountName))
{
ERROR_MSG(boost::format("Loginapp::_createAccount: invalid accountName(%1%)\n") %
accountName);
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_NAME;
bundle << retcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pChannel);
return false;
}
type = ACCOUNT_TYPE_NORMAL;
}
}
else if(type == ACCOUNT_TYPE_NORMAL)
{
if(!validName(accountName))
{
ERROR_MSG(boost::format("Loginapp::_createAccount: invalid accountName(%1%)\n") %
accountName);
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
SERVER_ERROR_CODE retcode = SERVER_ERR_NAME;
bundle << retcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pChannel);
return false;
}
//.........这里部分代码省略.........
示例5: onReqCreateMailAccountResult
//-------------------------------------------------------------------------------------
void Loginapp::onReqCreateMailAccountResult(Mercury::Channel* pChannel, MemoryStream& s)
{
SERVER_ERROR_CODE failedcode;
std::string accountName;
std::string password;
std::string retdatas = "";
s >> failedcode >> accountName >> password;
s.readBlob(retdatas);
DEBUG_MSG(boost::format("Loginapp::onReqCreateMailAccountResult: accountName=%1%, failedcode=%2%.\n") %
accountName.c_str() % failedcode);
if(failedcode == SERVER_SUCCESS)
{
Components::COMPONENTS& loginapps = Components::getSingleton().getComponents(LOGINAPP_TYPE);
std::string http_host = "localhost";
if(startGroupOrder_ == 1)
{
if(strlen((const char*)&g_kbeSrvConfig.getLoginApp().externalAddress) > 0)
http_host = g_kbeSrvConfig.getBaseApp().externalAddress;
else
http_host = inet_ntoa((struct in_addr&)Loginapp::getSingleton().getNetworkInterface().extaddr().ip);
}
else
{
Components::COMPONENTS::iterator iter = loginapps.begin();
for(; iter != loginapps.end(); iter++)
{
if((*iter).groupOrderid == 1)
{
if(strlen((const char*)&(*iter).externalAddressEx) > 0)
http_host = (*iter).externalAddressEx;
else
http_host = inet_ntoa((struct in_addr&)(*iter).pExtAddr->ip);
}
}
}
threadPool_.addTask(new SendActivateEMailTask(accountName, retdatas,
http_host,
g_kbeSrvConfig.getLoginApp().http_cbport));
}
PendingLoginMgr::PLInfos* ptinfos = pendingCreateMgr_.remove(accountName);
if(ptinfos == NULL)
return;
Mercury::Channel* pClientChannel = this->getNetworkInterface().findChannel(ptinfos->addr);
if(pClientChannel == NULL)
return;
pClientChannel->extra("");
retdatas = "";
Mercury::Bundle bundle;
bundle.newMessage(ClientInterface::onCreateAccountResult);
bundle << failedcode;
bundle.appendBlob(retdatas);
bundle.send(this->getNetworkInterface(), pClientChannel);
SAFE_RELEASE(ptinfos);
}
示例6: staticAddToBundle
static void staticAddToBundle(Mercury::Bundle& s,
std::string init_strarg)
{
s.appendBlob(init_strarg);
}