当前位置: 首页>>代码示例>>C++>>正文


C++ pointer::sendResponse方法代码示例

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


在下文中一共展示了pointer::sendResponse方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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

示例2: 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

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

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

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

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

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

示例10: 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

示例11: sendOfflineEvent


//.........这里部分代码省略.........

						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
						{
							if (!sendMsg(response, offlineEvent->getFromAccount(), offlineEvent->fromInfo(), messageid, attach))
							{
								delete[] imageBuffer;
								return false;
							}
						}
						sizeSended += tosendSize;

#ifdef WIN32
						Sleep(5);
#else
						usleep(5000);
#endif
					}
					delete[] imageBuffer;
				}break;
			default:
				break;
			}

		}break;
	default:
		{
			if (offlineEvent->fromInfo()->fromType() == CFromInfo::FromDialogInfo)
			{
				response->setParameter(cgcParameter::create(_T("DID"), offlineEvent->fromInfo()->fromDialog()->dialogId()));
			}
			response->setParameter(cgcParameter::create(_T("FromAccount"), offlineEvent->getFromAccount()->getAccount()));
			response->sendResponse(0, offlineEvent->getEvent());
		}break;
	}
	return true;
}
开发者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::sendResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。