void ObjectController::_handleFindFriendDBReply(uint64 retCode,string friendName)
{
	PlayerObject*	player	= dynamic_cast<PlayerObject*>(mObject);
	friendName.convert(BSTRType_Unicode16);
	if(retCode == 0)
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed_noname","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	PlayerObject*	searchObject	= dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(retCode));

	if(!searchObject)
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	//are we on our targets friendlist???
	if(!searchObject->checkFriendList(player->getFirstName().getCrc()))
	{
		gMessageLib->sendSystemMessage(player,L"","cmnty","friend_location_failed","","",L"",0,"","",friendName.getUnicode16());
		return;
	}

	Datapad* thePad = dynamic_cast<Datapad*>(searchObject->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));

	if(thePad && thePad->getCapacity())
	{
		//the datapad automatically checks for waypoint caspacity and gives the relevant error messages
		thePad->requestNewWaypoint(searchObject->getFirstName().getAnsi(),searchObject->mPosition,static_cast<uint16>(gWorldManager->getZoneId()),Waypoint_blue);
	}
}
void ObjectController::_handleRemoveIgnoreDBReply(uint32 retCode,string ignoreName)
{
	PlayerObject*	player	= dynamic_cast<PlayerObject*>(mObject);
	// gLogger->logMsgF("_handleRemoveIgnoreDBReply 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;

		// remove ok
		case 1:
		{
			// update list
			player->removeIgnore(ignoreName.getCrc());
			gMessageLib->sendIgnoreListPlay9(player);

			// send notification
			ignoreName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","ignore_removed","","",L"",0,"","",ignoreName.getUnicode16());

			// notify chat server
			if(player->isConnected())
			{
				gMessageFactory->StartMessage();
				gMessageFactory->addUint32(opNotifyChatRemoveIgnore);
				gMessageFactory->addString(ignoreName);
				Message* message = gMessageFactory->EndMessage();

				player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
			}
		}
		break;
	}

	player->setContactListUpdatePending(false);
}
void ObjectController::_handleAddFriendDBReply(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;

		// add ok
		case 1:
		{
			// update list
			player->addFriend(friendName.getAnsi());
			gMessageLib->sendFriendListPlay9(player);

			// send notification
			friendName.convert(BSTRType_Unicode16);
			gMessageLib->sendSystemMessage(player,L"","cmnty","friend_added","","",L"",0,"","",friendName.getUnicode16());

			// notify chat server
			if(player->isConnected())
			{
				gMessageFactory->StartMessage();
				gMessageFactory->addUint32(opNotifyChatAddFriend);
				gMessageFactory->addString(friendName);
				Message* message = gMessageFactory->EndMessage();

				player->getClient()->SendChannelA(message,player->getAccountId(),CR_Chat,2);
			}
		}
		break;
	}

	player->setContactListUpdatePending(false);
}