diff options
author | Lynx Linden <lynx@lindenlab.com> | 2010-01-28 15:38:55 +0000 |
---|---|---|
committer | Lynx Linden <lynx@lindenlab.com> | 2010-01-28 15:38:55 +0000 |
commit | fee014bd82cd78f07bcc88c45109a1ea2b2eee24 (patch) | |
tree | 83801b354031134d1fd06ac1894552021ae6afc7 /indra/newview | |
parent | b3e25e1fbd9cfccc0363cb436ad4302ead974859 (diff) |
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
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llchathistory.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llchathistory.h | 7 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llnearbychat.h | 2 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llnearbychathandler.h | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationhandler.h | 2 | ||||
-rw-r--r-- | indra/newview/llnotificationmanager.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llnotificationmanager.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 13 |
10 files changed, 43 insertions, 18 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index fd438001e1..dd9f0c2ebe 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -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; diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index c2c60e60cf..32600bb71d 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -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); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 0a8d020b4f..90482eb74d 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -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) diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 938b77df7a..5fb8ade19e 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -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); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index a1a9d84c14..c08ca30bab 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -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 diff --git a/indra/newview/llnearbychathandler.h b/indra/newview/llnearbychathandler.h index fb2abac6a4..01a6de5610 100644 --- a/indra/newview/llnearbychathandler.h +++ b/indra/newview/llnearbychathandler.h @@ -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); diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 0fb438bfe9..e57674d31c 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -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; }; /** diff --git a/indra/newview/llnotificationmanager.cpp b/indra/newview/llnotificationmanager.cpp index 66bc217d15..4401bb953f 100644 --- a/indra/newview/llnotificationmanager.cpp +++ b/indra/newview/llnotificationmanager.cpp @@ -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 diff --git a/indra/newview/llnotificationmanager.h b/indra/newview/llnotificationmanager.h index 072fc6f24c..575aa69c4d 100644 --- a/indra/newview/llnotificationmanager.h +++ b/indra/newview/llnotificationmanager.h @@ -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); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 43c30b4c52..f24fe07065 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -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); } } |