本文整理汇总了C++中cgcresponse::pointer::get方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::get方法的具体用法?C++ pointer::get怎么用?C++ pointer::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cgcresponse::pointer
的用法示例。
在下文中一共展示了pointer::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendDiaMembers
bool sendDiaMembers(cgcResponse::pointer response, CUserInfo::pointer fromUser, CDialogInfo::pointer dialogInfo)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (fromUser.get() != 0);
BOOST_ASSERT (dialogInfo.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("DID"), dialogInfo->dialogId()));
response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount()));
int index = 0;
CLockMap<std::string, CUserInfo::pointer>::const_iterator iterUserInfo;
boost::mutex::scoped_lock lockUserInfo(const_cast<boost::mutex&>(dialogInfo->m_members.mutex()));
for (iterUserInfo=dialogInfo->m_members.begin(); iterUserInfo!=dialogInfo->m_members.end(); iterUserInfo++)
{
CUserInfo::pointer memberUserInfo = iterUserInfo->second;
char uaBuffer[12];
sprintf(uaBuffer, "UA%d", index++);
response->setParameter(cgcParameter::create(uaBuffer, memberUserInfo->getAccount()));
}
response->sendResponse(0, 601);
return true;
}
示例2: sendMsgImage
bool sendMsgImage(cgcResponse::pointer response, CUserInfo::pointer fromUser, CFromInfo::pointer fromInfo, long mid, long width, long height, long type, cgcAttachment::pointer attachment, bool bNew, time_t offeventTime)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (fromUser.get() != 0);
BOOST_ASSERT (fromInfo.get() != 0);
BOOST_ASSERT (attachment.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
if (fromInfo->fromType() == CFromInfo::FromDialogInfo)
{
response->setParameter(cgcParameter::create(_T("DID"), fromInfo->fromDialog()->dialogId()));
}
response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount()));
response->setParameter(cgcParameter::create(_T("MID"), mid));
response->setParameter(cgcParameter::create(_T("Type"), type));
response->setParameter(cgcParameter::create(_T("Width"), width));
response->setParameter(cgcParameter::create(_T("Height"), height));
response->setParameter(cgcParameter::create2(_T("New"), bNew));
if (offeventTime > 0)
{
char buffer[20];
sprintf(buffer, "%ld", offeventTime);
response->setParameter(cgcParameter::create(cgcParameter::PT_DATETIME, _T("Time"), buffer));
}
response->setAttachInfo(attachment->getTotal(), attachment->getIndex());
response->setAttachData(attachment->getAttachData(), attachment->getAttachSize());
response->sendResponse(0, 501);
return true;
}
示例3: sendCompanyInfo
bool sendCompanyInfo(cgcResponse::pointer response, CCompanyInfo::pointer companyInfo)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (companyInfo.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("Id"), companyInfo->id()));
response->setParameter(cgcParameter::create(_T("Name"), companyInfo->name()));
response->sendResponse(0, 110);
return true;
}
示例4: sendDiaQuit
bool sendDiaQuit(cgcResponse::pointer response, CUserInfo::pointer fromUser, CDialogInfo::pointer dialogInfo)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (fromUser.get() != 0);
BOOST_ASSERT (dialogInfo.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("DID"), dialogInfo->dialogId()));
response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount()));
response->sendResponse(0, 602);
return true;
}
示例5: sendDataGroupInfo
// sendDataGroupInfo
bool sendDataGroupInfo(cgcResponse::pointer response, CDataGroup::pointer dataGroup)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (dataGroup.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("GroupId"), dataGroup->groupid()));
response->setParameter(cgcParameter::create(_T("Name"), dataGroup->name()));
if (dataGroup->parentgroup().get() != 0)
response->setParameter(cgcParameter::create(_T("ParentId"), dataGroup->parentgroup()->groupid()));
response->sendResponse(0, 151);
return true;
}
示例6: sendCoGroupInfo
bool sendCoGroupInfo(cgcResponse::pointer response, unsigned int coId, CCoGroupInfo::pointer cogroupInfo, bool isMyCoGroup)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (cogroupInfo.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("CoId"), (long)coId));
response->setParameter(cgcParameter::create(_T("Id"), cogroupInfo->groupid()));
response->setParameter(cgcParameter::create(_T("Type"), (long)cogroupInfo->type()));
response->setParameter(cgcParameter::create(_T("Name"), cogroupInfo->name()));
if (cogroupInfo->parentgroup().get() != 0)
response->setParameter(cgcParameter::create(_T("ParentId"), cogroupInfo->parentgroup()->groupid()));
response->setParameter(cgcParameter::create2(_T("MyCoGroup"), isMyCoGroup));
response->sendResponse(0, 111);
return true;
}
示例7: sendDataInfo
// sendDataInfo
bool sendDataInfo(cgcResponse::pointer response, CDataInfo::pointer dataInfo)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (dataInfo.get() != 0);
BOOST_ASSERT (dataInfo->parentgroup() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("GrouId"), dataInfo->parentgroup()->groupid()));
response->setParameter(cgcParameter::create(_T("DataId"), dataInfo->dataid()));
response->setParameter(cgcParameter::create(_T("Name"), dataInfo->name()));
response->setParameter(cgcParameter::create(_T("Desc"), dataInfo->desc()));
// ???
//response->setParameter(cgcParameter::create(_T("AttachName"), dataId));
response->sendResponse(0, 152);
return true;
}
示例8: sendMsg
bool sendMsg(cgcResponse::pointer response, CUserInfo::pointer fromUser, CFromInfo::pointer fromInfo, long mid, cgcAttachment::pointer attachment)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (fromUser.get() != 0);
BOOST_ASSERT (fromInfo.get() != 0);
BOOST_ASSERT (attachment.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
if (fromInfo->fromType() == CFromInfo::FromDialogInfo)
{
response->setParameter(cgcParameter::create(_T("DID"), fromInfo->fromDialog()->dialogId()));
}
response->setParameter(cgcParameter::create(_T("FromAccount"), fromUser->getAccount()));
response->setParameter(cgcParameter::create(_T("MID"), mid));
response->setAttachInfo(attachment->getTotal(), attachment->getIndex());
response->setAttachData(attachment->getAttachData(), attachment->getAttachSize());
response->sendResponse(0, 501);
return true;
}
示例9: sendCoGroupUserInfo
bool sendCoGroupUserInfo(cgcResponse::pointer response, unsigned int coId, unsigned cogroupId, CUserInfoPointer userInfo)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (userInfo.get() != 0);
if (response->isInvalidate()) return false;
response->lockResponse();
response->setParameter(cgcParameter::create(_T("CoId"), (long)coId));
//response->setParameter(cgcParameter::create(_T("Id"), cogroupId));
int index = 0;
CLockMap<unsigned int, CCoGroupInfo::pointer>::const_iterator iterCoGroup;
boost::mutex::scoped_lock lockCoGroupInfo(const_cast<boost::mutex&>(userInfo->m_cogroups.mutex()));
for (iterCoGroup=userInfo->m_cogroups.begin(); iterCoGroup!=userInfo->m_cogroups.end(); iterCoGroup++)
{
CCoGroupInfo::pointer cogroupInfo = iterCoGroup->second;
char buffer[10];
sprintf(buffer, "Id%d", index++);
response->setParameter(cgcParameter::create(buffer, (long)cogroupInfo->groupid()));
}
response->setParameter(cgcParameter::create(_T("Account"), userInfo->getAccount()));
response->setParameter(cgcParameter::create(_T("Name"), userInfo->getUserName()));
response->setParameter(cgcParameter::create(_T("Nick"), userInfo->getNick()));
response->setParameter(cgcParameter::create(_T("Gender"), (long)userInfo->getGender()));
response->setParameter(cgcParameter::create(_T("Ext"), userInfo->getExtension()));
response->setParameter(cgcParameter::create(_T("Phone"), userInfo->getPhone()));
response->setParameter(cgcParameter::create(_T("Mobile"), userInfo->getMobile()));
response->setParameter(cgcParameter::create(_T("Email"), userInfo->getEmail()));
//response->setParameter(cgcParameter::create(_T("Desc"), userInfo->getDescription()));
response->setParameter(cgcParameter::create(_T("LineState"), (long)userInfo->getLineState()));
response->sendResponse(0, 112);
return true;
}
示例10: sendOfflineEvent
// sendOfflineEvent
bool sendOfflineEvent(cgcResponse::pointer response, COfflineEvent::pointer offlineEvent)
{
BOOST_ASSERT (response.get() != 0);
BOOST_ASSERT (offlineEvent.get() != 0);
if (response->isInvalidate()) return false;
switch (offlineEvent->getEvent())
{
case 501:
{
CMessageInfo::pointer messageInfo = offlineEvent->getMessage();
BOOST_ASSERT (messageInfo.get() != 0);
long messageid = messageInfo->messageid();
short msgtype = messageInfo->type();
bool newflag = messageInfo->newflag();
size_t sizeSended = 0;
size_t tosendSize = 0;
switch (msgtype)
{
case 1:
{
size_t toSendSizeTotal = messageInfo->total();
cgc::cgcAttachment::pointer attach(cgcAttachment::create());
attach->setName("text");
attach->setTotal(toSendSizeTotal);
while (sizeSended < toSendSizeTotal)
{
tosendSize = (short)(toSendSizeTotal-sizeSended) > MAX_PACKET_SIZE ? MAX_PACKET_SIZE : (toSendSizeTotal-sizeSended);
attach->setAttach((const unsigned char*)messageInfo->getdata()+sizeSended, tosendSize);
attach->setIndex(sizeSended);
if (attach->getIndex() == 0)
{
if (!sendMsg(response, offlineEvent->getFromAccount(), offlineEvent->fromInfo(), messageid, msgtype, attach, newflag, offlineEvent->getMessage()->msgtime()))
{
return false;
}
}else
{
if (!sendMsg(response, offlineEvent->getFromAccount(), offlineEvent->fromInfo(), messageid, attach))
{
return false;
}
}
sizeSended += tosendSize;
#ifdef WIN32
Sleep(5);
#else
usleep(5000);
#endif
}
}break;
case 3:
{
std::string filename = messageInfo->tostring();
size_t nFilesize = messageInfo->filesize();
char filepath[256];
sprintf(filepath, "%s/File/%s", gApplication->getAppConfPath().c_str(), filename.c_str());
FILE * hfile = fopen(filepath, "rb");
if (hfile == NULL)
{
return false;
}
unsigned char * imageBuffer = new unsigned char[nFilesize+1];
size_t imageSize = fread(imageBuffer, 1, nFilesize, hfile);
fclose(hfile);
namespace fs = boost::filesystem;
fs::path pathFile(filepath, fs::native);
fs::remove(pathFile);
if (imageSize == 0)
{
delete[] imageBuffer;
return false;
}
cgc::cgcAttachment::pointer attach(cgcAttachment::create());
attach->setName("image");
attach->setTotal(imageSize);
while (sizeSended < imageSize)
{
tosendSize = (short)(imageSize-sizeSended) > MAX_PACKET_SIZE ? MAX_PACKET_SIZE : (imageSize-sizeSended);
attach->setAttach((const unsigned char*)imageBuffer+sizeSended, tosendSize);
attach->setIndex(sizeSended);
if (attach->getIndex() == 0)
{
long nWidth = messageInfo->imageWidth();
long nHeight = messageInfo->imageHeight();
if (!sendMsgImage(response, offlineEvent->getFromAccount(), offlineEvent->fromInfo(), messageid, nWidth, nHeight, msgtype, attach, newflag, offlineEvent->getMessage()->msgtime()))
{
delete[] imageBuffer;
return false;
}
}else
//.........这里部分代码省略.........