Preparing client use of external avatar servers.
This commit is contained in:
@@ -459,6 +459,9 @@ ClientStateReadingServerList::Process(ClientThread &client)
|
||||
addrNode = firstServer->FirstChild("IPv4Address");
|
||||
const TiXmlNode *portNode = firstServer->FirstChild("Port");
|
||||
|
||||
// Currently, only IPv4 is supported for avatar servers.
|
||||
const TiXmlNode *avatarNode = firstServer->FirstChild("AvatarServerIPv4Address");
|
||||
|
||||
if (!addrNode || !addrNode->ToElement() || !portNode || !portNode->ToElement())
|
||||
throw ClientException(__FILE__, __LINE__, ERR_SOCK_INVALID_SERVERLIST_XML, 0);
|
||||
|
||||
@@ -467,6 +470,12 @@ ClientStateReadingServerList::Process(ClientThread &client)
|
||||
int tmpPort = 0;
|
||||
portNode->ToElement()->QueryIntAttribute("value", &tmpPort);
|
||||
context.SetServerPort((unsigned)tmpPort);
|
||||
|
||||
if (avatarNode && avatarNode->ToElement()) // optional
|
||||
{
|
||||
context.SetAvatarServerAddr(addrNode->ToElement()->Attribute("value"));
|
||||
}
|
||||
|
||||
retVal = MSG_SOCK_SERVER_LIST_DONE;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -56,7 +56,8 @@ void
|
||||
ClientThread::Init(
|
||||
const string &serverAddress, const string &serverListUrl,
|
||||
bool useServerList, unsigned serverPort, bool ipv6, bool sctp,
|
||||
const string &pwd, const string &playerName, const string &avatarFile,
|
||||
const string &avatarServerAddress, const string &pwd,
|
||||
const string &playerName, const string &avatarFile,
|
||||
const string &cacheDir)
|
||||
{
|
||||
if (IsRunning())
|
||||
@@ -73,6 +74,7 @@ ClientThread::Init(
|
||||
context.SetServerListUrl(serverListUrl);
|
||||
context.SetUseServerList(useServerList);
|
||||
context.SetServerPort(serverPort);
|
||||
context.SetAvatarServerAddr(avatarServerAddress);
|
||||
context.SetPassword(pwd);
|
||||
context.SetPlayerName(playerName);
|
||||
context.SetAvatarFile(avatarFile);
|
||||
@@ -517,6 +519,8 @@ ClientThread::RetrieveAvatarIfNeeded(unsigned id, const PlayerInfo &info)
|
||||
if (info.hasAvatar && !info.avatar.IsZero() && !GetAvatarManager().HasAvatar(info.avatar))
|
||||
{
|
||||
m_avatarHasRequestedList.push_back(id); // Never remove from this list. Only request once.
|
||||
|
||||
// TODO: download from avatar server if applicable.
|
||||
boost::shared_ptr<NetPacket> retrieveAvatar(new NetPacketRetrieveAvatar);
|
||||
NetPacketRetrieveAvatar::Data retrieveAvatarData;
|
||||
retrieveAvatarData.requestId = id;
|
||||
|
||||
Reference in New Issue
Block a user