aboutsummaryrefslogtreecommitdiff
path: root/src/game/MiscHandler.cpp
diff options
context:
space:
mode:
authorraczman <none@none>2009-05-15 21:06:58 +0200
committerraczman <none@none>2009-05-15 21:06:58 +0200
commit5d78a9c6bdac0ec6f24327d3dc86ea6c63aec917 (patch)
tree386f11c4c0705cea4fc7427288c934571061d621 /src/game/MiscHandler.cpp
parentad552d272dc79413a428c766b9e6ce0c6e38163e (diff)
parentb5b9f281176a728599ff7a00b9927f478ee9ce90 (diff)
merge.
--HG-- branch : trunk
Diffstat (limited to 'src/game/MiscHandler.cpp')
-rw-r--r--src/game/MiscHandler.cpp41
1 files changed, 22 insertions, 19 deletions
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index 1bed4c6a483..34ed7fd3aab 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.cpp
@@ -46,6 +46,7 @@
#include "Pet.h"
#include "SocialMgr.h"
#include "CellImpl.h"
+#include "AccountMgr.h"
void WorldSession::HandleRepopRequestOpcode( WorldPacket & /*recv_data*/ )
{
@@ -555,12 +556,13 @@ void WorldSession::HandleAddFriendOpcode( WorldPacket & recv_data )
sLog.outDebug( "WORLD: %s asked to add friend : '%s'",
GetPlayer()->GetName(), friendName.c_str() );
- CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race FROM characters WHERE name = '%s'", friendName.c_str());
+ CharacterDatabase.AsyncPQuery(&WorldSession::HandleAddFriendOpcodeCallBack, GetAccountId(), friendNote, "SELECT guid, race, account FROM characters WHERE name = '%s'", friendName.c_str());
}
void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 accountId, std::string friendNote)
{
uint64 friendGuid;
+ uint64 friendAcctid;
uint32 team;
FriendsResult friendResult;
@@ -576,33 +578,34 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult *result, uint32 acc
{
friendGuid = MAKE_NEW_GUID((*result)[0].GetUInt32(), 0, HIGHGUID_PLAYER);
team = Player::TeamForRace((*result)[1].GetUInt8());
+ friendAcctid = (*result)[2].GetUInt32();
delete result;
- if(friendGuid)
- {
- if(friendGuid==session->GetPlayer()->GetGUID())
- friendResult = FRIEND_SELF;
- else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
- friendResult = FRIEND_ENEMY;
- else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
- friendResult = FRIEND_ALREADY;
- else
+ if ( session->GetSecurity() >= SEC_MODERATOR || sWorld.getConfig(CONFIG_ALLOW_GM_FRIEND) || accmgr.GetSecurity(friendAcctid) < SEC_MODERATOR)
+ if(friendGuid)
{
- Player* pFriend = ObjectAccessor::FindPlayer(friendGuid);
- if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
- friendResult = FRIEND_ADDED_ONLINE;
+ if(friendGuid==session->GetPlayer()->GetGUID())
+ friendResult = FRIEND_SELF;
+ else if(session->GetPlayer()->GetTeam() != team && !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && session->GetSecurity() < SEC_MODERATOR)
+ friendResult = FRIEND_ENEMY;
+ else if(session->GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid)))
+ friendResult = FRIEND_ALREADY;
else
- friendResult = FRIEND_ADDED_OFFLINE;
- if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
{
- friendResult = FRIEND_LIST_FULL;
- sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
+ Player* pFriend = ObjectAccessor::FindPlayer(friendGuid);
+ if( pFriend && pFriend->IsInWorld() && pFriend->IsVisibleGloballyFor(session->GetPlayer()))
+ friendResult = FRIEND_ADDED_ONLINE;
+ else
+ friendResult = FRIEND_ADDED_OFFLINE;
+ if(!session->GetPlayer()->GetSocial()->AddToSocialList(GUID_LOPART(friendGuid), false))
+ {
+ friendResult = FRIEND_LIST_FULL;
+ sLog.outDebug( "WORLD: %s's friend list is full.", session->GetPlayer()->GetName());
+ }
}
-
session->GetPlayer()->GetSocial()->SetFriendNote(GUID_LOPART(friendGuid), friendNote);
}
- }
}
sSocialMgr.SendFriendStatus(session->GetPlayer(), friendResult, GUID_LOPART(friendGuid), false);