Skip to content
Snippets Groups Projects
Commit fee014bd authored by Lynx Linden's avatar Lynx Linden
Browse files

EXT-4693: Pass through owner ID to remote object inspector.

Plumbing to pass the owner ID for a chatting object down into the
LLChatHistory::appendMessage() method where we create the objectim
SLapp that will bring up the remote object inspector. Pheww.

For object notifications that are displayed as text chat, we
parent b3e25e1f
No related branches found
No related tags found
No related merge requests found
......@@ -50,6 +50,8 @@
#include "llslurl.h"
#include "lllayoutstack.h"
#include "llagent.h"
#include "llviewerregion.h"
#include "llworld.h"
#include "llsidetray.h"//for blocked objects panel
......@@ -491,8 +493,9 @@ void LLChatHistory::clear()
mLastFromID = LLUUID::null;
}
void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_chat_history, const LLStyle::Params& input_append_params)
void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LLStyle::Params& input_append_params)
{
bool use_plain_text_chat_history = args["use_plain_text_chat_history"].asBoolean();
if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty())
{
mUnreadChatSources.insert(chat.mFromName);
......@@ -560,9 +563,20 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
// Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text.
if ( chat.mSourceType == CHAT_SOURCE_OBJECT )
{
// for object IMs, create a secondlife:///app/objectim SLapp
std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
url += "?name=" + chat.mFromName;
url += "&owner=" + args["owner_id"].asString();
LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
if (region)
{
S32 x, y, z;
LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z);
url += "&slurl=" + region->getName() + llformat("/%d/%d/%d", x, y, z);
}
// set the link for the object name to be the objectim SLapp
LLStyle::Params link_params(style_params);
link_params.color.control = "HTMLLinkColor";
link_params.link_href = url;
......
......@@ -113,11 +113,14 @@ class LLChatHistory : public LLUICtrl
* Appends a widget message.
* If last user appended message, concurs with current user,
* separator is added before the message, otherwise header is added.
* The args LLSD contains:
* - use_plain_text_chat_history (bool) - whether to add message as plain text.
* - owner_id (LLUUID) - the owner ID for object chat
* @param chat - base chat message.
* @param use_plain_text_chat_history - whether to add message as plain text.
* @param args - additional arguments
* @param input_append_params - font style.
*/
void appendMessage(const LLChat& chat, const bool use_plain_text_chat_history = false, const LLStyle::Params& input_append_params = LLStyle::Params());
void appendMessage(const LLChat& chat, const LLSD &args = LLSD(), const LLStyle::Params& input_append_params = LLStyle::Params());
/*virtual*/ void clear();
/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
......
......@@ -153,7 +153,7 @@ std::string appendTime()
}
void LLNearbyChat::addMessage(const LLChat& chat,bool archive)
void LLNearbyChat::addMessage(const LLChat& chat,bool archive,const LLSD &args)
{
if (chat.mChatType == CHAT_TYPE_DEBUG_MSG)
{
......@@ -184,7 +184,9 @@ void LLNearbyChat::addMessage(const LLChat& chat,bool archive)
if (!chat.mMuted)
{
tmp_chat.mFromName = chat.mFromName;
mChatHistory->appendMessage(chat, use_plain_text_chat_history);
LLSD chat_args = args;
chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history;
mChatHistory->appendMessage(chat, chat_args);
}
if(archive)
......
......@@ -47,7 +47,7 @@ public:
~LLNearbyChat();
BOOL postBuild ();
void addMessage (const LLChat& message,bool archive = true);
void addMessage (const LLChat& message,bool archive = true, const LLSD &args = LLSD());
void onNearbyChatContextMenuItemClicked(const LLSD& userdata);
bool onNearbyChatCheckContextMenuItem(const LLSD& userdata);
......
......@@ -319,7 +319,7 @@ void LLNearbyChatHandler::initChannel()
void LLNearbyChatHandler::processChat(const LLChat& chat_msg)
void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args)
{
if(chat_msg.mMuted == TRUE)
return;
......@@ -337,7 +337,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg)
//if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
// tmp_chat.mFromName = tmp_chat.mFromID.asString();
}
nearby_chat->addMessage(chat_msg);
nearby_chat->addMessage(chat_msg, true, args);
if(nearby_chat->getVisible())
return;//no need in toast if chat is visible
......
......@@ -45,7 +45,7 @@ public:
virtual ~LLNearbyChatHandler();
virtual void processChat(const LLChat& chat_msg);
virtual void processChat(const LLChat& chat_msg, const LLSD &args);
protected:
virtual void onDeleteToast(LLToast* toast);
......
......@@ -135,7 +135,7 @@ class LLChatHandler : public LLEventHandler
public:
virtual ~LLChatHandler() {};
virtual void processChat(const LLChat& chat_msg)=0;
virtual void processChat(const LLChat& chat_msg, const LLSD &args)=0;
};
/**
......
......@@ -107,16 +107,17 @@ bool LLNotificationManager::onNotification(const LLSD& notify)
}
//--------------------------------------------------------------------------
void LLNotificationManager::onChat(const LLChat& msg,ENotificationType type)
void LLNotificationManager::onChat(const LLChat& msg, const LLSD &args)
{
switch(type)
// check ENotificationType argument
switch(args["type"].asInteger())
{
case NT_NEARBYCHAT:
{
LLNearbyChatHandler* handle = dynamic_cast<LLNearbyChatHandler*>(mNotifyHandlers["nearbychat"].get());
if(handle)
handle->processChat(msg);
handle->processChat(msg, args);
}
break;
default: //no need to handle all enum types
......
......@@ -66,7 +66,7 @@ public:
bool onNotification(const LLSD& notification);
// this method reacts on chat notifications and calls an appropriate handler
void onChat(const LLChat& msg,ENotificationType type);
void onChat(const LLChat& msg, const LLSD &args);
// get a handler for a certain type of notification
LLEventHandler* getHandlerForNotification(std::string notification_type);
......
......@@ -2545,7 +2545,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
// Object owner for objects
msg->getUUID("ChatData", "OwnerID", owner_id);
msg->getU8Fast(_PREHASH_ChatData, _PREHASH_SourceType, source_temp);
chat.mSourceType = (EChatSourceType)source_temp;
......@@ -2574,7 +2574,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
if (chatter)
{
chat.mPosAgent = chatter->getPositionAgent();
// Make swirly things only for talking objects. (not script debug messages, though)
if (chat.mSourceType == CHAT_SOURCE_OBJECT
&& chat.mChatType != CHAT_TYPE_DEBUG_MSG)
......@@ -2719,8 +2719,13 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
chat.mMuted = is_muted && !is_linden;
LLNotificationsUI::LLNotificationManager::instance().onChat(
chat, LLNotificationsUI::NT_NEARBYCHAT);
// pass owner_id to chat so that we can display the remote
// object inspect for an object that is chatting with you
LLSD args;
args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
args["owner_id"] = owner_id;
LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment