本文整理汇总了C++中PlayerObject::setContactListUpdatePending方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerObject::setContactListUpdatePending方法的具体用法?C++ PlayerObject::setContactListUpdatePending怎么用?C++ PlayerObject::setContactListUpdatePending使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerObject
的用法示例。
在下文中一共展示了PlayerObject::setContactListUpdatePending方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _handleRemoveFriend
void ObjectController::_handleRemoveFriend(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getContactListUpdatePending())
return;
else
player->setContactListUpdatePending(true);
string friendName;
int8 sql[1024],end[16],*sqlPointer;
message->getStringUnicode16(friendName);
friendName.convert(BSTRType_ANSI);
if(!friendName.getLength())
{
player->setContactListUpdatePending(false);
return;
}
if(player->isConnected())
gMessageLib->sendHeartBeat(player->getClient());
friendName.toLower();
if(!player->checkFriendList(friendName.getCrc()))
{
player->setContactListUpdatePending(false);
return;
}
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_RemoveFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT sf_removeFriend(%"PRIu64",'",player->getId());
sprintf(end,"')");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,friendName.getAnsi(),friendName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}
示例2: _handleAddIgnoreDBReply
void ObjectController::_handleAddIgnoreDBReply(uint32 retCode,string ignoreName)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
// gLogger->logMsgF("_handleAddIgnoreDBReply retCode = %u",MSG_NORMAL, retCode);
switch(retCode)
{
// no such name
case 0:
default:
{
ignoreName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","ignore_not_found","","",L"",0,"","",ignoreName.getUnicode16());
}
break;
// add ok
case 1:
{
// update list
player->addIgnore(ignoreName.getAnsi());
gMessageLib->sendIgnoreListPlay9(player);
// send notification
ignoreName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","ignore_added","","",L"",0,"","",ignoreName.getUnicode16());
// notify chat server
if(player->isConnected())
{
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opNotifyChatAddIgnore);
gMessageFactory->addString(ignoreName);
Message* message = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
}
}
break;
}
player->setContactListUpdatePending(false);
}
示例3: _handleRemoveFriendDBReply
void ObjectController::_handleRemoveFriendDBReply(uint32 retCode,string friendName)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
switch(retCode)
{
// no such name
case 0:
default:
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_not_found","","",L"",0,"","",friendName.getUnicode16());
}
break;
// remove ok
case 1:
{
// update list
player->removeFriend(friendName.getCrc());
gMessageLib->sendFriendListPlay9(player);
// send notification
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_removed","","",L"",0,"","",friendName.getUnicode16());
if(player->isConnected())
{
// notify chat server
gMessageFactory->StartMessage();
gMessageFactory->addUint32(opNotifyChatRemoveFriend);
gMessageFactory->addString(friendName);
Message* message = gMessageFactory->EndMessage();
player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
}
}
break;
}
player->setContactListUpdatePending(false);
}
示例4: _handleAddFriend
void ObjectController::_handleAddFriend(uint64 targetId,Message* message,ObjectControllerCmdProperties* cmdProperties)
{
PlayerObject* player = dynamic_cast<PlayerObject*>(mObject);
if(player->getContactListUpdatePending())
return;
else
player->setContactListUpdatePending(true);
string friendName;
int8 sql[1024],end[16],*sqlPointer;
message->getStringUnicode16(friendName);
friendName.convert(BSTRType_ANSI);
if(!friendName.getLength())
{
player->setContactListUpdatePending(false);
return;
}
if(player->isConnected())
gMessageLib->sendHeartBeat(player->getClient());
friendName.toLower();
// check if he's already our friend
if(player->checkFriendList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_duplicate","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// or ignored
if(player->checkIgnoreList(friendName.getCrc()))
{
friendName.convert(BSTRType_Unicode16);
gMessageLib->sendSystemMessage(player,L"","cmnty","friend_fail_is_ignored","","",L"",0,"","",friendName.getUnicode16());
player->setContactListUpdatePending(false);
return;
}
// check our own name
string firstName = player->getFirstName().getAnsi();
firstName.toLower();
if(strcmp(firstName.getAnsi(),friendName.getAnsi()) == 0)
{
player->setContactListUpdatePending(false);
return;
}
// pull the db query
ObjControllerAsyncContainer* asyncContainer = new(mDBAsyncContainerPool.malloc()) ObjControllerAsyncContainer(OCQuery_AddFriend);
asyncContainer->mString = friendName.getAnsi();
sprintf(sql,"SELECT sf_addFriend(%"PRIu64",'",player->getId());
sprintf(end,"')");
sqlPointer = sql + strlen(sql);
sqlPointer += mDatabase->Escape_String(sqlPointer,friendName.getAnsi(),friendName.getLength());
strcat(sql,end);
mDatabase->ExecuteSqlAsync(this,asyncContainer,sql);
}