本文整理汇总了C++中UserSession::updateConsort方法的典型用法代码示例。如果您正苦于以下问题:C++ UserSession::updateConsort方法的具体用法?C++ UserSession::updateConsort怎么用?C++ UserSession::updateConsort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserSession
的用法示例。
在下文中一共展示了UserSession::updateConsort方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processUserMessage
/**
* \brief 处理Gateway转发过来的客户端消息
* \param pNullCmd 消息体
* \param cmdLen 消息长度
* \return true 处理完毕,false 不在处理范围之中
*/
bool CRelationManager::processUserMessage(const Cmd::stNullUserCmd *pNullCmd,const DWORD cmdLen)
{
switch(pNullCmd->byCmd)
{
case Cmd::RELATION_USERCMD:
{
switch(pNullCmd->byParam)
{
case UNMARRY_PARA:
{
CRelation* relation = NULL;
relation = getMarryRelation();
if (relation)
{
UserSession *otherUser = NULL;
otherUser = UserSessionManager::getInstance()->getUserSessionByName(relation->name);
if (otherUser)
{
removeRelation(relation->name);
otherUser->relationManager.removeRelation(user->name);
otherUser->sendSysChat(Cmd::INFO_TYPE_FAIL,"%s选择和你离婚",user->name);
otherUser->updateConsort();
}
else
{
CRelation *tRelation = NULL;
tRelation = (CRelation *)getEntryByName(relation->name);
if (tRelation) writeOfflineNotify(tRelation);
removeRelation(relation->name);
}
user->updateConsort();
}
}
break;
case Cmd::RELATION_STATUS_PARA:
{
Cmd::stRelationStatusCmd *rev = (Cmd::stRelationStatusCmd *)pNullCmd;
switch(rev->byState)
{
case Cmd::RELATION_ADD:
{
if (!strncmp(rev->name,user->name,MAX_NAMESIZE))
{
user->sendSysChat(Cmd::INFO_TYPE_FAIL,"不能把自己加入名单中?");
return true;
}
if (300>size())
{
if (rev->type == Cmd::RELATION_TYPE_BAD)
{
addBadRelation(rev->name);
}
else
{
addEnemyRelation(rev->name);
}
}
else
{
user->sendSysChat(Cmd::INFO_TYPE_FAIL,"名单列表已满!");
}
return true;
}
break;
case Cmd::RELATION_ANSWER_NO:
{
UserSession *otherUser = NULL;
otherUser = UserSessionManager::getInstance()->getUserByID(rev->userid);
if (otherUser)
{
switch(rev->type)
{
case Cmd::RELATION_TYPE_FRIEND:
{
otherUser->sendSysChat(Cmd::INFO_TYPE_FAIL,"对方不同意与你结为好友");
return true;
}
break;
case Cmd::RELATION_TYPE_LOVE:
{
otherUser->sendSysChat(Cmd::INFO_TYPE_FAIL,"对方不同意与你结为夫妻");
}
break;
default:
break;
}
}
}
break;
case Cmd::RELATION_ANSWER_YES:
{
//.........这里部分代码省略.........