Prevent failure to create SLURL when an object chats but is not on the object list.

Fixes an issue I couldn't remember nor find on the issue tracker.

SLURLs for found objects remain unchanged.
SLURLs for objects that are not found, but we could find their owners now display the owner's position and region, with "?owner_not_object" appended to the slurl as a note to the user
SLURLs for objects that are not found, and we could not find their owners, now display as being from the position 0, 0, 0 in the users region
This commit is contained in:
Inusaito Sayori
2014-12-16 19:57:46 -05:00
parent 9880134b4d
commit b67f55cff7

View File

@@ -3939,9 +3939,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
is_owned_by_me = chatter->permYouOwner();
}
else is_owned_by_me = owner_id == gAgentID;
U32 links_for_chatting_objects = gSavedSettings.getU32("LinksForChattingObjects");
if (links_for_chatting_objects != 0 && chatter && chat.mSourceType == CHAT_SOURCE_OBJECT &&
if (links_for_chatting_objects != 0 /*&& chatter*/ && chat.mSourceType == CHAT_SOURCE_OBJECT &&
(!is_owned_by_me || links_for_chatting_objects == 2)
// [RLVa:KB]
&& !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)
@@ -3956,13 +3957,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
if( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) )
// [/RLVa:KB]
{
// Fallback on the owner, if the chatter isn't present, lastly use the agent's region at the origin.
const LLViewerObject* obj(chatter ? chatter : gObjectList.findObject(owner_id));
// Compute the object SLURL.
LLVector3 pos = chatter->getPositionRegion();
LLVector3 pos = obj ? obj->getPositionRegion() : LLVector3::zero;
S32 x = llround((F32)fmod((F64)pos.mV[VX], (F64)REGION_WIDTH_METERS));
S32 y = llround((F32)fmod((F64)pos.mV[VY], (F64)REGION_WIDTH_METERS));
S32 z = llround((F32)pos.mV[VZ]);
std::ostringstream location;
location << chatter->getRegion()->getName() << "/" << x << "/" << y << "/" << z;
location << (obj ? obj->getRegion() : gAgent.getRegion())->getName() << "/" << x << "/" << y << "/" << z;
if (chatter != obj) location << "?owner_not_object";
query_string["slurl"] = location.str();
}