diff options
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r-- | indra/newview/llviewermessage.cpp | 160 |
1 files changed, 93 insertions, 67 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index c463beb375..1416ed5bc4 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -38,6 +38,7 @@ #include "llavataractions.h" #include "lscript_byteformat.h" #include "lleconomy.h" +#include "lleventtimer.h" #include "llfloaterreg.h" #include "llfollowcamparams.h" #include "llregionhandle.h" @@ -630,7 +631,6 @@ bool join_group_response(const LLSD& notification, const LLSD& response) delete_context_data = FALSE; LLSD args; args["NAME"] = name; - args["INVITE"] = message; LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]); } } @@ -861,29 +861,12 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f ++item_iter) { const LLUUID& item_id = (*item_iter); - LLInventoryItem* item = gInventory.getItem(item_id); - if(!item) + if(!highlight_offered_item(item_id)) { - LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL; continue; } - //////////////////////////////////////////////////////////////////////////////// - // Don't highlight if it's in certain "quiet" folders which don't need UI - // notification (e.g. trash, cof, lost-and-found). - const BOOL user_is_away = gAwayTimer.getStarted(); - if(!user_is_away) - { - const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id); - if (parent) - { - const LLFolderType::EType parent_type = parent->getPreferredType(); - if (LLViewerFolderType::lookupIsQuietType(parent_type)) - { - continue; - } - } - } + LLInventoryItem* item = gInventory.getItem(item_id); //////////////////////////////////////////////////////////////////////////////// // Special handling for various types. @@ -906,7 +889,7 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f if ("inventory_handler" == from_name) { //we have to filter inventory_handler messages to avoid notification displaying - LLSideTray::getInstance()->showPanel("panel_places", + LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "landmark").with("id", item->getUUID())); } else if("group_offer" == from_name) @@ -925,17 +908,20 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f args["FOLDER_NAME"] = std::string(parent_folder ? parent_folder->getName() : "unknown"); LLNotificationsUtil::add("LandmarkCreated", args); // Created landmark is passed to Places panel to allow its editing. In fact panel should be already displayed. + // If the panel is closed we don't reopen it until created landmark is loaded. //TODO*:: dserduk(7/12/09) remove LLPanelPlaces dependency from here - LLPanelPlaces *places_panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->showPanel("panel_places", LLSD())); + LLPanelPlaces *places_panel = dynamic_cast<LLPanelPlaces*>(LLSideTray::getInstance()->getPanel("panel_places")); if (places_panel) { - // we are creating a landmark - if("create_landmark" == places_panel->getPlaceInfoType() && !places_panel->getItem()) - { - places_panel->setItem(item); - } + // Landmark creation handling is moved to LLPanelPlaces::showAddedLandmarkInfo() + // TODO* LLPanelPlaces dependency is going to be removed. See EXT-4347. + //if("create_landmark" == places_panel->getPlaceInfoType() && !places_panel->getItem()) + //{ + // places_panel->setItem(item); + //} + //else // we are opening a group notice attachment - else + if("create_landmark" != places_panel->getPlaceInfoType()) { LLSD args; args["type"] = "landmark"; @@ -982,6 +968,34 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f } } +bool highlight_offered_item(const LLUUID& item_id) +{ + LLInventoryItem* item = gInventory.getItem(item_id); + if(!item) + { + LL_WARNS("Messaging") << "Unable to show inventory item: " << item_id << LL_ENDL; + return false; + } + + //////////////////////////////////////////////////////////////////////////////// + // Don't highlight if it's in certain "quiet" folders which don't need UI + // notification (e.g. trash, cof, lost-and-found). + if(!gAgent.getAFK()) + { + const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(item_id); + if (parent) + { + const LLFolderType::EType parent_type = parent->getPreferredType(); + if (LLViewerFolderType::lookupIsQuietType(parent_type)) + { + return false; + } + } + } + + return true; +} + void inventory_offer_mute_callback(const LLUUID& blocked_id, const std::string& first_name, const std::string& last_name, @@ -1249,10 +1263,6 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& gInventory.addObserver(opener); } - // Remove script dialog because there is no need in it no more. - LLUUID object_id = notification["payload"]["object_id"].asUUID(); - LLScriptFloaterManager::instance().removeNotificationByObjectId(object_id); - delete this; return false; } @@ -1365,10 +1375,9 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const if (check_offer_throttle(mFromName, true)) { log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); - //TODO* CHAT: how to show this? - //LLSD args; - //args["MESSAGE"] = log_message; - //LLNotificationsUtil::add("SystemMessage", args); + LLSD args; + args["MESSAGE"] = log_message; + LLNotificationsUtil::add("SystemMessage", args); } // we will want to open this item when it comes back. @@ -1410,11 +1419,10 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const // send the message msg->sendReliable(mHost); - //TODO* CHAT: how to show this? - //log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; - //LLSD args; - //args["MESSAGE"] = log_message; - //LLNotificationsUtil::add("SystemMessage", args); + log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +"."; + LLSD args; + args["MESSAGE"] = log_message; + LLNotificationsUtil::add("SystemMessage", args); if (busy && (!mFromGroup && !mFromObject)) { @@ -1428,10 +1436,6 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const gInventory.addObserver(opener); } - // Remove script dialog because there is no need in it no more. - LLUUID object_id = notification["payload"]["object_id"].asUUID(); - LLScriptFloaterManager::instance().removeNotificationByObjectId(object_id); - delete this; return false; } @@ -1468,14 +1472,14 @@ void inventory_offer_handler(LLOfferInfo* info) // Strip any SLURL from the message display. (DEV-2754) std::string msg = info->mDesc; int indx = msg.find(" ( http://slurl.com/secondlife/"); - if(indx >= 0) + if(indx == std::string::npos) { - LLStringUtil::truncate(msg, indx); + // try to find new slurl host + indx = msg.find(" ( http://maps.secondlife.com/secondlife/"); } - - if(LLAssetType::AT_LANDMARK == info->mType) + if(indx >= 0) { - msg = LLViewerInventoryItem::getDisplayName(msg); + LLStringUtil::truncate(msg, indx); } LLSD args; @@ -1582,7 +1586,6 @@ void inventory_offer_handler(LLOfferInfo* info) { payload["give_inventory_notification"] = TRUE; LLNotificationPtr notification = LLNotifications::instance().add(p.payload(payload)); - LLScriptFloaterManager::getInstance()->setNotificationToastId(object_id, notification->getID()); } } } @@ -1839,15 +1842,19 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { + /* + EXT-5099 + currently there is no way to store in history only... + using LLNotificationsUtil::add will add message to Nearby Chat + // muted user, so don't start an IM session, just record line in chat // history. Pretend the chat is from a local agent, // so it will go into the history but not be shown on screen. - //TODO* CHAT: how to show this? - //and this is not system message... - //LLSD args; - //args["MESSAGE"] = buffer; - //LLNotificationsUtil::add("SystemMessage", args); + LLSD args; + args["MESSAGE"] = buffer; + LLNotificationsUtil::add("SystemMessageTip", args); + */ } } break; @@ -1911,7 +1918,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (has_inventory) { - info = new LLOfferInfo; + info = new LLOfferInfo(); info->mIM = IM_GROUP_NOTICE; info->mFromID = from_id; @@ -1965,6 +1972,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info); } + else + { + delete info; + } } break; case IM_GROUP_INVITATION: @@ -2025,6 +2036,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (sizeof(offer_agent_bucket_t) != binary_bucket_size) { LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL; + delete info; break; } bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; @@ -2036,6 +2048,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (sizeof(S8) != binary_bucket_size) { LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL; + delete info; break; } info->mType = (LLAssetType::EType) binary_bucket[0]; @@ -2172,6 +2185,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = from_id ^ gAgent.getSessionID(); } + if(SYSTEM_FROM == name) + { + // System's UUID is NULL (fixes EXT-4766) + chat.mFromID = from_id = LLUUID::null; + } + LLSD query_string; query_string["owner"] = from_id; query_string["slurl"] = location; @@ -2193,7 +2212,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); if(nearby_chat) { - nearby_chat->addMessage(chat); + LLSD args; + args["owner_id"] = from_id; + args["slurl"] = location; + nearby_chat->addMessage(chat, true, args); } @@ -2215,7 +2237,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); } @@ -2517,7 +2539,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; @@ -2546,7 +2568,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) @@ -2691,8 +2713,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); } } @@ -3078,10 +3105,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) { // Chat the "back" SLURL. (DEV-4907) - //TODO* CHAT: how to show this? - //LLSD args; - //args["MESSAGE"] = message; - //LLNotificationsUtil::add("SystemMessage", args); + LLSD args; + args["MESSAGE"] = "Teleport completed from " + gAgent.getTeleportSourceSLURL(); + LLNotificationsUtil::add("SystemMessageTip", args); // Set the new position avatarp->setPositionAgent(agent_pos); |