diff options
-rw-r--r-- | indra/newview/llchathistory.cpp | 62 | ||||
-rw-r--r-- | indra/newview/llchathistory.h | 7 | ||||
-rw-r--r-- | indra/newview/llinspectremoteobject.cpp | 25 | ||||
-rw-r--r-- | indra/newview/lllocationhistory.cpp | 2 | ||||
-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 | 15 |
12 files changed, 109 insertions, 27 deletions
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 2cdbd18996..f1e7e622b3 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -36,6 +36,7 @@ #include "llimview.h" #include "llchathistory.h" +#include "llcommandhandler.h" #include "llpanel.h" #include "lluictrlfactory.h" #include "llscrollcontainer.h" @@ -47,8 +48,11 @@ #include "llfloaterreg.h" #include "llmutelist.h" #include "llstylemap.h" +#include "llslurl.h" #include "lllayoutstack.h" #include "llagent.h" +#include "llviewerregion.h" +#include "llworld.h" #include "llsidetray.h"//for blocked objects panel @@ -56,6 +60,38 @@ static LLDefaultChildRegistry::Register<LLChatHistory> r("chat_history"); const static std::string NEW_LINE(rawstr_to_utf8("\n")); +// support for secondlife:///app/objectim/{UUID}/ SLapps +class LLObjectIMHandler : public LLCommandHandler +{ +public: + // requests will be throttled from a non-trusted browser + LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) {} + + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) + { + if (params.size() < 1) + { + return false; + } + + LLUUID object_id; + if (!object_id.set(params[0], FALSE)) + { + return false; + } + + LLSD payload; + payload["object_id"] = object_id; + payload["owner_id"] = query_map["owner"]; + payload["name"] = query_map["name"]; + payload["slurl"] = query_map["slurl"]; + payload["group_owned"] = query_map["groupowned"]; + LLFloaterReg::showInstance("inspect_remote_object", payload); + return true; + } +}; +LLObjectIMHandler gObjectIMHandler; + class LLChatHistoryHeader: public LLPanel { public: @@ -465,8 +501,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); @@ -532,7 +569,28 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_ if (utf8str_trim(chat.mFromName).size() != 0) { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. - if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) + 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; + mEditor->appendText(chat.mFromName + delimiter, false, link_params); + } + else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() ) { LLStyle::Params link_params(style_params); link_params.fillFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); 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/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp index e4d2eec242..898f1cd9ac 100644 --- a/indra/newview/llinspectremoteobject.cpp +++ b/indra/newview/llinspectremoteobject.cpp @@ -31,17 +31,16 @@ #include "llviewerprecompiledheaders.h" +#include "llfloaterreg.h" #include "llinspectremoteobject.h" #include "llinspect.h" -#include "llslurl.h" #include "llmutelist.h" -#include "llurlaction.h" #include "llpanelblockedlist.h" -#include "llfloaterreg.h" +#include "llslurl.h" +#include "lltrans.h" #include "llui.h" #include "lluictrl.h" - -class LLViewerObject; +#include "llurlaction.h" ////////////////////////////////////////////////////////////////////////////// // LLInspectRemoteObject @@ -183,11 +182,25 @@ void LLInspectRemoteObject::update() owner = LLSLURL::buildCommand("agent", mOwnerID, "about"); } } + else + { + owner = LLTrans::getString("Unknown"); + } getChild<LLUICtrl>("object_owner")->setValue(owner); // display the object's SLurl - click it to teleport - std::string url = "secondlife:///app/teleport/" + mSLurl; + std::string url; + if (! mSLurl.empty()) + { + std::string url = "secondlife:///app/teleport/" + mSLurl; + } getChild<LLUICtrl>("object_slurl")->setValue(url); + + // disable the Map button if we don't have a SLurl + getChild<LLUICtrl>("map_btn")->setEnabled(! mSLurl.empty()); + + // disable the Block button if we don't have the owner ID + getChild<LLUICtrl>("block_btn")->setEnabled(! mOwnerID.isNull()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp index 47139758e5..df93930d33 100644 --- a/indra/newview/lllocationhistory.cpp +++ b/indra/newview/lllocationhistory.cpp @@ -62,7 +62,7 @@ void LLLocationHistory::addItem(const LLLocationHistoryItem& item) { { mItems.erase(mItems.begin(), mItems.end()-max_items); } - llassert((S32) mItems.size() <= max_items); + llassert((S32)mItems.size() <= max_items); } /* 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 aa77c9602f..f24fe07065 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2243,7 +2243,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["SESSION_NAME"] = session_name; if (from_group) { - payload["groupowned"] = "true"; + payload["group_owned"] = "true"; } LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload); } @@ -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); } } |