diff options
Diffstat (limited to 'src/server/game/Handlers/MiscHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MiscHandler.cpp | 177 |
1 files changed, 0 insertions, 177 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 53b3208b771..0af8f69c0ad 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -39,7 +39,6 @@ #include "Battleground.h" #include "OutdoorPvP.h" #include "Pet.h" -#include "SocialMgr.h" #include "CellImpl.h" #include "AccountMgr.h" #include "Vehicle.h" @@ -529,182 +528,6 @@ void WorldSession::HandleStandStateChangeOpcode(WorldPackets::Misc::StandStateCh _player->SetStandState(packet.StandState); } -void WorldSession::HandleContactListOpcode(WorldPacket& recvData) -{ - recvData.read_skip<uint32>(); // always 1 - _player->GetSocial()->SendSocialList(_player); -} - -void WorldSession::HandleAddFriendOpcode(WorldPacket& recvData) -{ - TC_LOG_DEBUG("network", "WORLD: Received CMSG_ADD_FRIEND"); - - std::string friendName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); - std::string friendNote; - - recvData >> friendName; - - recvData >> friendNote; - - if (!normalizePlayerName(friendName)) - return; - - TC_LOG_DEBUG("network", "WORLD: %s asked to add friend : '%s'", - GetPlayer()->GetName().c_str(), friendName.c_str()); - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME); - - stmt->setString(0, friendName); - - _addFriendCallback.SetParam(friendNote); - _addFriendCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt)); -} - -void WorldSession::HandleAddFriendOpcodeCallBack(PreparedQueryResult result, std::string const& friendNote) -{ - if (!GetPlayer()) - return; - - ObjectGuid friendGuid; - uint32 friendAccountId; - uint32 team; - FriendsResult friendResult = FRIEND_NOT_FOUND; - - if (result) - { - Field* fields = result->Fetch(); - - friendGuid = ObjectGuid::Create<HighGuid::Player>(fields[0].GetUInt64()); - team = Player::TeamForRace(fields[1].GetUInt8()); - friendAccountId = fields[2].GetUInt32(); - - if (HasPermission(rbac::RBAC_PERM_ALLOW_GM_FRIEND) || AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(friendAccountId, realmHandle.Index))) - { - if (!friendGuid.IsEmpty()) - { - if (friendGuid == GetPlayer()->GetGUID()) - friendResult = FRIEND_SELF; - else if (GetPlayer()->GetTeam() != team && !HasPermission(rbac::RBAC_PERM_TWO_SIDE_ADD_FRIEND)) - friendResult = FRIEND_ENEMY; - else if (GetPlayer()->GetSocial()->HasFriend(friendGuid)) - friendResult = FRIEND_ALREADY; - else - { - Player* pFriend = ObjectAccessor::FindPlayer(friendGuid); - if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer())) - friendResult = FRIEND_ADDED_ONLINE; - else - friendResult = FRIEND_ADDED_OFFLINE; - if (!GetPlayer()->GetSocial()->AddToSocialList(friendGuid, false)) - { - friendResult = FRIEND_LIST_FULL; - TC_LOG_DEBUG("network", "WORLD: %s's friend list is full.", GetPlayer()->GetName().c_str()); - } - } - GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote); - } - } - } - - sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid, false); - - TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); -} - -void WorldSession::HandleDelFriendOpcode(WorldPacket& recvData) -{ - ObjectGuid FriendGUID; - - TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_FRIEND"); - - recvData >> FriendGUID; - - _player->GetSocial()->RemoveFromSocialList(FriendGUID, false); - - sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID, false); - - TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); -} - -void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recvData) -{ - TC_LOG_DEBUG("network", "WORLD: Received CMSG_ADD_IGNORE"); - - std::string ignoreName = GetTrinityString(LANG_FRIEND_IGNORE_UNKNOWN); - - recvData >> ignoreName; - - if (!normalizePlayerName(ignoreName)) - return; - - TC_LOG_DEBUG("network", "WORLD: %s asked to Ignore: '%s'", - GetPlayer()->GetName().c_str(), ignoreName.c_str()); - - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_BY_NAME); - - stmt->setString(0, ignoreName); - - _addIgnoreCallback = CharacterDatabase.AsyncQuery(stmt); -} - -void WorldSession::HandleAddIgnoreOpcodeCallBack(PreparedQueryResult result) -{ - if (!GetPlayer()) - return; - - ObjectGuid IgnoreGuid; - FriendsResult ignoreResult = FRIEND_IGNORE_NOT_FOUND; - - if (result) - { - IgnoreGuid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt64()); - - if (!IgnoreGuid.IsEmpty()) - { - if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself - ignoreResult = FRIEND_IGNORE_SELF; - else if (GetPlayer()->GetSocial()->HasIgnore(IgnoreGuid)) - ignoreResult = FRIEND_IGNORE_ALREADY; - else - { - ignoreResult = FRIEND_IGNORE_ADDED; - - // ignore list full - if (!GetPlayer()->GetSocial()->AddToSocialList(IgnoreGuid, true)) - ignoreResult = FRIEND_IGNORE_FULL; - } - } - } - - sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, IgnoreGuid, false); - - TC_LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)"); -} - -void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recvData) -{ - ObjectGuid IgnoreGUID; - - TC_LOG_DEBUG("network", "WORLD: Received CMSG_DEL_IGNORE"); - - recvData >> IgnoreGUID; - - _player->GetSocial()->RemoveFromSocialList(IgnoreGUID, true); - - sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID, false); - - TC_LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)"); -} - -void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recvData) -{ - TC_LOG_DEBUG("network", "CMSG_SET_CONTACT_NOTES"); - ObjectGuid guid; - std::string note; - recvData >> guid >> note; - _player->GetSocial()->SetFriendNote(guid, note); -} - void WorldSession::HandleBugReportOpcode(WorldPacket& recvData) { uint32 suggestion, contentlen, typelen; |