本文整理汇总了C++中cuserinfo::pointer::getUsername方法的典型用法代码示例。如果您正苦于以下问题:C++ pointer::getUsername方法的具体用法?C++ pointer::getUsername怎么用?C++ pointer::getUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cuserinfo::pointer
的用法示例。
在下文中一共展示了pointer::getUsername方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// ResponseP2PUser: 响应一个P2P请求
extern "C" int CGC_API ResponseP2PUser(const cgcSotpRequest::pointer & request, cgcSotpResponse::pointer response)
{
// Request
cgcParameter::pointer pFromUser = request->getParameter(_T("FromUser"));
if (pFromUser == 0 || pFromUser->empty()) return -1;
cgcParameter::pointer pToUser = request->getParameter(_T("ToUser"));
if (pToUser == 0 || pToUser->empty()) return -1;
long nP2PType = request->getParameterValue(_T("P2PType"), 0);
long nP2PParam = request->getParameterValue(_T("P2PParam"), 0);
cgcAttributes::pointer attributes = theApplication->getAttributes(true);
// Send P2P Response
CUserInfo::pointer pFromUserInfo = CGC_OBJECT_CAST<CUserInfo>(attributes->getAttribute(NAME_USERINFO, pFromUser->getStr()));
if (pFromUserInfo.get() == NULL) return -2;
//if (!gAVSProxy->m_mapUserInfo.find(pFromUser->getValue(), pFromUserInfo)) return -2;
CUserInfo::pointer pToUserInfo = CGC_OBJECT_CAST<CUserInfo>(attributes->getAttribute(NAME_USERINFO, pToUser->getStr()));
if (pToUserInfo.get() == NULL) return -2;
//if (!gAVSProxy->m_mapUserInfo.find(pToUser->getValue(), pToUserInfo)) return -2;
cgcSession::pointer pToUserCgcSession = theSystem->getSession(pToUserInfo->getSessionId());
if (pToUserCgcSession.get() == NULL) return -3;
cgcSotpResponse::pointer pToUserCgcResponse = CGC_SOTPRESPONSE_CAST(pToUserCgcSession->getLastResponse());
if (pToUserCgcResponse.get() == NULL || pToUserCgcResponse->isInvalidate())
{
return -3;
}
response->sendResponse();
// response->sendResponse();
// response->sendResponse();
// ???
// Message:
// 1003: P2P Response Message
// pToUserCgcResponse->addParameter(CGC_PARAMETER(cgcParameter::PT_INT, _T("MessageType"), _T("1003")));
pToUserCgcResponse->addParameter(CGC_PARAMETER(_T("FromUser"), pFromUserInfo->getUsername()));
pToUserCgcResponse->addParameter(CGC_PARAMETER(_T("P2PType"), nP2PType));
pToUserCgcResponse->addParameter(CGC_PARAMETER(_T("P2PParam"), nP2PParam));
pToUserCgcResponse->addParameter(CGC_PARAMETER(_T("RemoteAddr"), request->getRemoteAddr()));
pToUserCgcResponse->sendResponse(0, 1003);
cgcSession::pointer pFromUserCgcSession = theSystem->getSession(pFromUserInfo->getSessionId());
if (pFromUserCgcSession.get() == NULL) return -4;
cgcSotpResponse::pointer pFromUserCgcResponse = CGC_SOTPRESPONSE_CAST(pFromUserCgcSession->getLastResponse());
if (pFromUserCgcResponse.get() == NULL || pFromUserCgcResponse->isInvalidate())
{
return -4;
}
pFromUserCgcResponse->addParameter(CGC_PARAMETER(_T("ToUser"), pToUser->getStr()));
pFromUserCgcResponse->addParameter(CGC_PARAMETER(_T("P2PType"), nP2PType));
pFromUserCgcResponse->addParameter(CGC_PARAMETER(_T("P2PParam"), nP2PParam));
pFromUserCgcResponse->sendResponse(0, 1004);
return 0;
}