Fixed: Server side issues

This commit is contained in:
kervala 2012-11-26 18:41:30 +01:00
parent 003ec79559
commit 3378daf329
4 changed files with 60 additions and 38 deletions

View file

@ -91,6 +91,8 @@ void CRoomInstanceGuild::removeUser( CCharacter* user )
return; return;
} }
user->sendUrl("app_ryzhome action=quit_guild_room&room_name="+guildBuilding->getName(), "");
--_RefCount; --_RefCount;
if ( _RefCount == 0 ) if ( _RefCount == 0 )
{ {
@ -104,9 +106,14 @@ void CRoomInstanceGuild::addUser( CCharacter* user, CCharacter* owner )
{ {
BOMB_IF( !user, "<BUILDING> null character!", return ); BOMB_IF( !user, "<BUILDING> null character!", return );
CBuildingPhysicalGuild * guildBuilding = dynamic_cast<CBuildingPhysicalGuild *>( _Building );
BOMB_IF( !guildBuilding, "<BUILDING> building type does not match with room type", return );
// open guild inventory window // open guild inventory window
PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY"); PlayerManager.sendImpulseToClient(user->getId(), "GUILD:OPEN_INVENTORY");
user->sendUrl("app_ryzhome action=open_guild_room&owner="+ owner->getName().toString()+"&room_name="+guildBuilding->getName(), "");
++_RefCount; ++_RefCount;
} }
@ -141,20 +148,7 @@ void CRoomInstancePlayer::removeUser( CCharacter* user )
return; return;
} }
TVectorParamCheck titleParams; user->sendUrl("app_ryzhome action=quit_player_room&room_name="+playerBuilding->getName(), "");
TVectorParamCheck textParams;
uint32 userId = PlayerManager.getPlayerId( user->getId() );
std::string name = "CLOSE_URL";
//send command to close webig
ucstring phrase = ucstring("CLOSE_URL(){[WEB : app_ryzhome action=quit_room]}");
NLNET::CMessage msgout("SET_PHRASE");
msgout.serial(name);
msgout.serial(phrase);
sendMessageViaMirror("IOS", msgout);
uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams);
uint32 textId = STRING_MANAGER::sendStringToUser(userId, "CLOSE_URL", textParams);
PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId);
--_RefCount; --_RefCount;
if ( _RefCount == 0 ) if ( _RefCount == 0 )
@ -170,6 +164,9 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner )
{ {
BOMB_IF( !user, "<BUILDING> null character!", return ); BOMB_IF( !user, "<BUILDING> null character!", return );
CBuildingPhysicalPlayer * playerBuilding = dynamic_cast<CBuildingPhysicalPlayer *>( _Building );
BOMB_IF( !playerBuilding, "<BUILDING> building type does not match with room type", return );
// open room inventory window // open room inventory window
PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY"); PlayerManager.sendImpulseToClient(user->getId(), "ITEM:OPEN_ROOM_INVENTORY");
if (owner) if (owner)
@ -182,23 +179,7 @@ void CRoomInstancePlayer::addUser( CCharacter* user, CCharacter* owner )
// Very rare case // Very rare case
owner = user; owner = user;
} }
// solve bot names for title and text user->sendUrl("app_ryzhome action=open_player_room&owner="+ owner->getName().toString()+"&room_name="+playerBuilding->getName(), "");
TVectorParamCheck titleParams;
TVectorParamCheck textParams;
// send the popup message
uint32 userId = PlayerManager.getPlayerId( user->getId() );
std::string name = "RYZHOME_URL";
ucstring phrase = "RYZHOME_URL(){[WEB : app_ryzhome user=" + owner->getName().toString() + "]}";
NLNET::CMessage msgout("SET_PHRASE");
msgout.serial(name);
msgout.serial(phrase);
sendMessageViaMirror("IOS", msgout);
uint32 titleId = STRING_MANAGER::sendStringToUser(userId, "web_transactions", titleParams);
uint32 textId = STRING_MANAGER::sendStringToUser(userId, "RYZHOME_URL", textParams);
PlayerManager.sendImpulseToClient(user->getId(), "USER:POPUP", titleId, textId);
++_RefCount; ++_RefCount;
} }

View file

@ -50,14 +50,14 @@ void CDynChatEGS::init()
{ {
{ "DYN_CHAT:ADD_SERVICE_CHAN", CDynChatEGS::cbServiceAddChan }, { "DYN_CHAT:ADD_SERVICE_CHAN", CDynChatEGS::cbServiceAddChan },
{ "DYN_CHAT:SET_HIDE_BUBBLE", CDynChatEGS::cbServiceSetHideBubble }, { "DYN_CHAT:SET_HIDE_BUBBLE", CDynChatEGS::cbServiceSetHideBubble },
{ "DYN_CHAT:SET_UNIVERSAL_CHANNEL", CDynChatEGS::cbServiceSetUniversalChannel},
{ "DYN_CHAT:SET_CHAN_HISTORY", CDynChatEGS::cbServiceSetChanHistory }, { "DYN_CHAT:SET_CHAN_HISTORY", CDynChatEGS::cbServiceSetChanHistory },
{ "DYN_CHAT:REMOVE_SERVICE_CHAN", CDynChatEGS::cbServiceRemoveChan }, { "DYN_CHAT:REMOVE_SERVICE_CHAN", CDynChatEGS::cbServiceRemoveChan },
{ "DYN_CHAT:ADD_CLIENT", CDynChatEGS::cbServiceAddClient }, { "DYN_CHAT:ADD_CLIENT", CDynChatEGS::cbServiceAddClient },
{ "DYN_CHAT:ADD_SESSION", CDynChatEGS::cbServiceAddSession }, { "DYN_CHAT:ADD_SESSION", CDynChatEGS::cbServiceAddSession },
{ "DYN_CHAT:ADD_SESSION_ENTITY", CDynChatEGS::cbServiceAddSessionEntity }, { "DYN_CHAT:ADD_SESSION_ENTITY", CDynChatEGS::cbServiceAddSessionEntity },
{ "DYN_CHAT:REMOVE_SESSION", CDynChatEGS::cbServiceRemoveSession }, { "DYN_CHAT:REMOVE_SESSION", CDynChatEGS::cbServiceRemoveSession },
{ "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity } { "DYN_CHAT:REMOVE_SESSION_ENTITY", CDynChatEGS::cbServiceRemoveSessionEntity}
}; };
CUnifiedNetwork::getInstance()->addCallbackArray( _cbArray, sizeof(_cbArray) / sizeof(_cbArray[0]) ); CUnifiedNetwork::getInstance()->addCallbackArray( _cbArray, sizeof(_cbArray) / sizeof(_cbArray[0]) );
@ -315,7 +315,16 @@ bool CDynChatEGS::setHideBubble(TChanID chanID, bool hideBubble)
return true; return true;
} }
//============================================================================================================
bool CDynChatEGS::setUniversalChannel(TChanID chanID, bool universalChannel)
{
CDynChatChan *chan = _DynChat.getChan(chanID);
if (!chan) return false;
if (universalChannel == chan->UniversalChannel) return true; // already good value
chan->UniversalChannel = universalChannel;
iosSetUniversalChannel(chanID, universalChannel);
return true;
}
//============================================================================================================ //============================================================================================================
void CDynChatEGS::cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId) void CDynChatEGS::cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
@ -344,6 +353,16 @@ void CDynChatEGS::cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::stri
DynChatEGS.setHideBubble(chan, hideBubble); DynChatEGS.setHideBubble(chan, hideBubble);
} }
//============================================================================================================ //============================================================================================================
void CDynChatEGS::cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{
TChanID chan;
bool universalChannel;
msgin.serial(chan);
msgin.serial(universalChannel);
DynChatEGS.setUniversalChannel(chan, universalChannel);
}
//============================================================================================================
void CDynChatEGS::cbServiceAddClient(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId) void CDynChatEGS::cbServiceAddClient(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId)
{ {
TDataSetRow dsr; TDataSetRow dsr;
@ -484,6 +503,15 @@ void CDynChatEGS::iosSetHideBubble(TChanID chan, bool hideBubble)
sendMessageViaMirror( "IOS", msg); sendMessageViaMirror( "IOS", msg);
} }
//============================================================================================================
void CDynChatEGS::iosSetUniversalChannel(TChanID chan, bool universalChannel)
{
CMessage msg("DYN_CHAT:SET_UNIVERSAL_CHANNEL");
msg.serial(chan);
msg.serial(universalChannel);
sendMessageViaMirror( "IOS", msg);
}
//============================================================================================================ //============================================================================================================
void CDynChatEGS::iosRemoveSession(TChanID chan, const TDataSetRow &client) void CDynChatEGS::iosRemoveSession(TChanID chan, const TDataSetRow &client)
{ {

View file

@ -68,6 +68,12 @@ public:
* \return true if success * \return true if success
*/ */
bool setHideBubble(TChanID chan, bool hideBubble); bool setHideBubble(TChanID chan, bool hideBubble);
/** Change sessions in channel 'chan' so that chat is treated like universe channel
* \return true if success
*/
bool setUniversalChannel(TChanID chan, bool universalChannel);
/** Stop session in channel 'chan' for the client 'client'. /** Stop session in channel 'chan' for the client 'client'.
* \return true if success * \return true if success
*/ */
@ -92,6 +98,8 @@ public:
static void cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); static void cbServiceAddChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/// Message from a service that need to hide bubbble of player/npc speaking in that channel /// Message from a service that need to hide bubbble of player/npc speaking in that channel
static void cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); static void cbServiceSetHideBubble(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/// Message from a service that need to set channel to be like universe channel
static void cbServiceSetUniversalChannel(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/// Message from a service: remove a channel. /// Message from a service: remove a channel.
static void cbServiceRemoveChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId); static void cbServiceRemoveChan(NLNET::CMessage& msgin, const std::string &serviceName, NLNET::TServiceId serviceId);
/// Message from a service : set the channel history /// Message from a service : set the channel history
@ -116,7 +124,8 @@ private:
private: private:
// ios msg // ios msg
void iosAddChan(TChanID chan, bool noBroadcast, bool forwardPlayerInputs, bool unify); void iosAddChan(TChanID chan, bool noBroadcast, bool forwardPlayerInputs, bool unify);
void iosSetHideBubble(TChanID chan, bool hiddeBubble); void iosSetHideBubble(TChanID chan, bool hideBubble);
void iosSetUniversalChannel(TChanID chan, bool universalChannel);
void iosRemoveChan(TChanID chan); void iosRemoveChan(TChanID chan);
void iosAddSession(TChanID chan, const TDataSetRow &client, bool readOnly); void iosAddSession(TChanID chan, const TDataSetRow &client, bool readOnly);
void iosRemoveSession(TChanID chan, const TDataSetRow &client); void iosRemoveSession(TChanID chan, const TDataSetRow &client);

View file

@ -13660,9 +13660,13 @@ void CCharacter::sendUrl(const string &url, const string &salt)
string control; string control;
if (!salt.empty()) if (!salt.empty())
{ {
string checksum = salt+url;
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString(); control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&salt[0], (uint32)salt.size()).toString();
} }
else
{
string defaultSalt = toString(getLastConnectedDate());
control = "&hmac="+getHMacSHA1((uint8*)&url[0], (uint32)url.size(), (uint8*)&defaultSalt[0], (uint32)defaultSalt.size()).toString();
}
nlinfo(url.c_str()); nlinfo(url.c_str());
TVectorParamCheck titleParams; TVectorParamCheck titleParams;