• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cgcresponse::pointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中cgcresponse::pointer的典型用法代码示例。如果您正苦于以下问题:C++ pointer类的具体用法?C++ pointer怎么用?C++ pointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了pointer类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:27,代码来源:sendresponse.cpp


示例2: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:18,代码来源:sendresponse.cpp


示例3: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:21,代码来源:sendresponse.cpp


示例4: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:16,代码来源:sendresponse.cpp


示例5: sendDiaInvite

bool sendDiaInvite(cgcResponse::pointer response, CUserInfo::pointer fromUser, CDialogInfo::pointer dialogInfo, CUserInfo::pointer inviteUserInfo)
{
	BOOST_ASSERT (response.get() != 0);
	BOOST_ASSERT (fromUser.get() != 0);
	BOOST_ASSERT (dialogInfo.get() != 0);
	BOOST_ASSERT (inviteUserInfo.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->setParameter(cgcParameter::create(_T("UA0"), inviteUserInfo->getAccount()));
	response->sendResponse(0, 601);
	return true;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:16,代码来源:sendresponse.cpp


示例6: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:13,代码来源:sendresponse.cpp


示例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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:19,代码来源:sendresponse.cpp


示例8: DiaInvite

extern "C" int CGC_API DiaInvite(const cgcRequest::pointer & request, cgcResponse::pointer response, cgcSession::pointer session)
{
	/////////////////////////////////
	// Request
	const tstring & sAccountId = request->getParameterValue(_T("AccountId"), _T(""));
	if (sAccountId.empty()) return -1;
	long dialogId = request->getParameterValue(_T("DID"), 0);

	/////////////////////////////////
	// Process
	CAccountInfo::pointer accountInfo = CGC_POINTER_CAST<CAccountInfo>(gApplication->getAttribute(BMT_ACCOUNTIDS, sAccountId));
	if (accountInfo.get() == NULL)
	//if (!gAVSProxy->m_accountids.find(sAccountId, accountInfo))
	{
		// Un register.
		return 14;
	}else if (session->getId().compare(accountInfo->getSessionId()) != 0)
	{
		// SessionId Error
		return -3;
	}

	CDialogInfo::pointer dialogInfo;
	if (dialogId == 0)
	{
		// New Dialog
		dialogInfo = CDialogInfo::create(gAVSProxy->getNextDialogId(), accountInfo->getUserinfo());
		dialogInfo->m_members.insert(accountInfo->getUserinfo()->getAccount(), accountInfo->getUserinfo());
		gApplication->setAttribute(BMT_DIALOGS, dialogInfo->dialogId(), dialogInfo);
		//gAVSProxy->m_dialogs.insert(dialogInfo->dialogId(), dialogInfo);

		response->setParameter(cgcParameter::create(_T("DID"), dialogInfo->dialogId()));
		response->sendResponse();
	}else
	{
		dialogInfo = CGC_POINTER_CAST<CDialogInfo>(gApplication->getAttribute(BMT_DIALOGS, dialogId));
		if (dialogInfo.get() == NULL)
		//if (!gAVSProxy->m_dialogs.find(dialogId, dialogInfo))
		{
			// Dialog id not exist.
			return 71;
		}/*else if (dialogInfo->manager().get() != accountInfo->getUserinfo().get())
		{
			// ?? Not the manager error.
			return 72;
		}*/
	}

	int index = 0;
	while (true)
	{
		char buffer[20];
		sprintf(buffer, "UA%d", index++);

		const tstring & sInviteUserAccount = request->getParameterValue(buffer, _T(""));
		if (sInviteUserAccount.empty())
		{
			break;
		}

		if (dialogInfo->m_members.exist(sInviteUserAccount))
		{
			// already exist in the dialog.
			continue;
		}

		CUserInfo::pointer inviteUserInfo;
		if (!getUserInfo(accountInfo, sInviteUserAccount, inviteUserInfo))
		{
			// ? continue;
			break;
		}

		// 1 Send the dialog members that invite account event.
		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;

			// Not register.
			CAccountInfo::pointer memberAccountInfo = CGC_POINTER_CAST<CAccountInfo>(gApplication->getAttribute(BMT_ACCOUNTS, memberUserInfo->getAccount()));
			if (memberAccountInfo.get() == NULL)
			//if (!gAVSProxy->m_accounts.find(memberUserInfo->getAccount(), memberAccountInfo))
			{
				// offline event
				CMessageInfo::pointer messageInfo = CMessageInfo::create(0, 0, CConversationInfo::CT_INVITE, true);
				COfflineEvent::pointer offlineEvent = COfflineEvent::create(601, CFromInfo::create(dialogInfo), accountInfo->getUserinfo(), messageInfo);
				offlineEvent->toAccount(inviteUserInfo);
				gAVSProxy->addOffEvent(memberUserInfo, offlineEvent);
				continue;
			}

			sendDiaInvite(memberAccountInfo, accountInfo->getUserinfo(), dialogInfo, inviteUserInfo);
		}
		lockUserInfo.unlock();

		// 2 Send invite useraccount the dialog members info.
		CAccountInfo::pointer inviteAccountInfo = CGC_POINTER_CAST<CAccountInfo>(gApplication->getAttribute(BMT_ACCOUNTS, sInviteUserAccount));
		if (inviteAccountInfo.get() != NULL)
//.........这里部分代码省略.........
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:101,代码来源:DialogMgr.cpp


示例9: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:31,代码来源:sendresponse.cpp


示例10: 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;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:36,代码来源:sendresponse.cpp


示例11: 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
//.........这里部分代码省略.........
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:101,代码来源:sendresponse.cpp


示例12: MsgRequest

extern "C" int CGC_API MsgRequest(const cgcRequest::pointer & request, cgcResponse::pointer response, cgcSession::pointer session)
{
	/////////////////////////////////
	// Request
	const tstring & sAccountId = request->getParameterValue(_T("AccountId"), _T(""));
	if (sAccountId.empty()) return -1;
	long mid = request->getParameterValue(_T("MID"), 0);
	const tstring & sFriendAccount = request->getParameterValue(_T("SendTo"), _T(""));
	if (sFriendAccount.empty()) return -1;
	long type = request->getParameterValue(_T("Type"), 0);

	/////////////////////////////////
	// Process
	CAccountInfo::pointer accountInfo = CGC_POINTER_CAST<CAccountInfo>(gApplication->getAttribute(BMT_ACCOUNTIDS, sAccountId));
	if (accountInfo.get() == NULL)
//	if (!gAVSProxy->m_accountids.find(sAccountId, accountInfo))
	{
		// Un register.
		return 14;
	}else if (session->getId().compare(accountInfo->getSessionId()) != 0)
	{
		// SessionId Error
		return -3;
	}

	CAccountInfo::pointer friendAccountInfo = CGC_POINTER_CAST<CAccountInfo>(gApplication->getAttribute(BMT_ACCOUNTS, sFriendAccount));
	if (friendAccountInfo.get() == NULL)
	//if (!gAVSProxy->m_accounts.find(sFriendAccount, friendAccountInfo))
	{
		// SentTo Account offline state;
		return 17;
	}

	long newmid = ++gCurrentMessageId;

	if (type == 11)
	{
		const tstring & filename = request->getParameterValue(_T("Name"), _T(""));
		if (filename.empty()) return -1;
		long filesize = request->getParameterValue(_T("Size"), 0);
		if (filesize <= 0) return -1;

		response->lockResponse();
		response->setParameter(cgcParameter::create(_T("MID"), mid));
		response->setParameter(cgcParameter::create(_T("NMID"), newmid));
		response->sendResponse();

		sendFileRequest(friendAccountInfo, accountInfo->getUserinfo(), newmid, filename, filesize);
	}else// if ()
	{
		response->lockResponse();
		response->setParameter(cgcParameter::create(_T("MID"), mid));
		response->setParameter(cgcParameter::create(_T("NMID"), newmid));
		response->sendResponse();

		sendMsgRequest(friendAccountInfo, accountInfo->getUserinfo(), newmid, type);
	}

	// Response
	return 0;
}
开发者ID:iamima,项目名称:biwoo_wxwidgets,代码行数:61,代码来源:MessageMgr.cpp



注:本文中的cgcresponse::pointer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ channel::ptr类代码示例发布时间:2022-05-31
下一篇:
C++ cgal::Timer类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap