summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rw-r--r--indra/newview/llviewermessage.cpp178
1 files changed, 123 insertions, 55 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 43c7574830..d6f0afff88 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -51,10 +51,9 @@
#include "llagent.h"
#include "llcallingcard.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
#include "llfloaterbuycurrency.h"
#include "llfloaterbuyland.h"
-#include "llfloaterchat.h"
#include "llfloaterland.h"
#include "llfloaterregioninfo.h"
#include "llfloaterlandholdings.h"
@@ -711,6 +710,18 @@ protected:
}
};
+class LLOpenTaskGroupOffer : public LLInventoryAddedObserver
+{
+protected:
+ /*virtual*/ void done()
+ {
+ open_inventory_offer(mAdded, "group_offer");
+ mAdded.clear();
+ gInventory.removeObserver(this);
+ delete this;
+ }
+};
+
//one global instance to bind them
LLOpenTaskOffer* gNewInventoryObserver=NULL;
@@ -726,6 +737,7 @@ void start_new_inventory_observer()
class LLDiscardAgentOffer : public LLInventoryFetchComboObserver
{
+ LOG_CLASS(LLDiscardAgentOffer);
public:
LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) :
mFolderID(folder_id),
@@ -822,9 +834,13 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
}
message << ", automatic preview disabled for "
<< OFFER_THROTTLE_TIME << " seconds.";
- chat.mText = message.str();
+
//this is kinda important, so actually put it on screen
- LLFloaterChat::addChat(chat, FALSE, FALSE);
+ std::string log_msg = message.str();
+ LLSD args;
+ args["MESSAGE"] = log_msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+
throttle_logged=true;
}
return false;
@@ -892,6 +908,14 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
LLSideTray::getInstance()->showPanel("panel_places",
LLSD().with("type", "landmark").with("id", item->getUUID()));
}
+ else if("group_offer" == from_name)
+ {
+ // do not open inventory when we open group notice attachment because
+ // we already opened landmark info panel
+ // "group_offer" is passed by LLOpenTaskGroupOffer
+
+ continue;
+ }
else if(from_name.empty())
{
// we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
@@ -929,9 +953,6 @@ void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& f
case LLAssetType::AT_ANIMATION:
LLFloaterReg::showInstance("preview_anim", LLSD(item_id), take_focus);
break;
- case LLAssetType::AT_GESTURE:
- LLFloaterReg::showInstance("preview_gesture", LLSD(item_id), take_focus);
- break;
case LLAssetType::AT_SCRIPT:
LLFloaterReg::showInstance("preview_script", LLSD(item_id), take_focus);
break;
@@ -1105,7 +1126,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
// * callback may be called immediately,
// * adding the mute sends a message,
// * we can't build two messages at once.
- if (2 == button)
+ if (2 == button) // Block
{
gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,_4,this));
}
@@ -1146,6 +1167,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
}
break;
case IM_GROUP_NOTICE:
+ opener = new LLOpenTaskGroupOffer;
send_auto_receive_response();
break;
case IM_TASK_INVENTORY_OFFERED:
@@ -1167,8 +1189,9 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
if (check_offer_throttle(mFromName, true))
{
log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
- chat.mText = log_message;
- LLFloaterChat::addChatHistory(chat);
+ LLSD args;
+ args["MESSAGE"] = log_message;
+ LLNotificationsUtil::add("SystemMessage", args);
}
break;
@@ -1341,8 +1364,10 @@ 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(".");
- chat.mText = log_message;
- LLFloaterChat::addChatHistory(chat);
+ //TODO* CHAT: how to show this?
+ //LLSD args;
+ //args["MESSAGE"] = log_message;
+ //LLNotificationsUtil::add("SystemMessage", args);
}
// we will want to open this item when it comes back.
@@ -1384,13 +1409,11 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
// send the message
msg->sendReliable(mHost);
- log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
- chat.mText = log_message;
- if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
- {
- chat.mMuted = TRUE;
- }
- LLFloaterChat::addChatHistory(chat);
+ //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);
if (busy && (!mFromGroup && !mFromObject))
{
@@ -1752,10 +1775,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
region_id,
position,
true);
-
- // pretend this is chat generated by self, so it does not show up on screen
- chat.mText = std::string("IM: ") + name + separator_string + message;
- LLFloaterChat::addChat( chat, TRUE, TRUE );
}
else if (from_id.isNull())
{
@@ -1811,19 +1830,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
region_id,
position,
true);
- chat.mText = std::string("IM: ") + name + separator_string + saved + message;
-
- BOOL local_agent = FALSE;
- LLFloaterChat::addChat( chat, TRUE, local_agent );
}
else
{
// 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.
- chat.mText = buffer;
- BOOL local_agent = TRUE;
- LLFloaterChat::addChat( chat, TRUE, local_agent );
+
+ //TODO* CHAT: how to show this?
+ //and this is not system message...
+ //LLSD args;
+ //args["MESSAGE"] = buffer;
+ //LLNotificationsUtil::add("SystemMessage", args);
}
}
break;
@@ -2044,6 +2062,13 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
//if (((is_busy && !is_owned_by_me) || is_muted))
if ( is_muted || mute_im)
{
+ // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
+ LLInventoryFetchObserver::item_ref_t items;
+ items.push_back(info->mObjectID);
+ LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
+ fetch_item->fetchItems(items);
+ delete fetch_item;
+
// Same as closing window
info->forceResponse(IOR_DECLINE);
}
@@ -2120,9 +2145,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
region_id,
position,
true);
-
- chat.mText = std::string("IM: ") + name + separator_string + saved + message;
- LLFloaterChat::addChat(chat, TRUE, is_this_agent);
}
break;
@@ -2136,6 +2158,48 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
// Build a link to open the object IM info window.
std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1);
+ if (session_id.notNull())
+ {
+ chat.mFromID = session_id;
+ }
+ else
+ {
+ // This message originated on a region without the updated code for task id and slurl information.
+ // We just need a unique ID for this object that isn't the owner ID.
+ // If it is the owner ID it will overwrite the style that contains the link to that owner's profile.
+ // This isn't ideal - it will make 1 style for all objects owned by the the same person/group.
+ // This works because the only thing we can really do in this case is show the owner name and link to their profile.
+ chat.mFromID = from_id ^ gAgent.getSessionID();
+ }
+
+ LLSD query_string;
+ query_string["owner"] = from_id;
+ query_string["slurl"] = location;
+ query_string["name"] = name;
+ if (from_group)
+ {
+ query_string["groupowned"] = "true";
+ }
+
+ std::ostringstream link;
+ link << "secondlife:///app/objectim/" << session_id << LLURI::mapToQueryString(query_string);
+
+ chat.mURL = link.str();
+ chat.mText = message;
+ chat.mSourceType = CHAT_SOURCE_OBJECT;
+
+ // Note: lie to Nearby Chat, pretending that this is NOT an IM, because
+ // IMs from obejcts don't open IM sessions.
+ LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
+ if(nearby_chat)
+ {
+ nearby_chat->addMessage(chat);
+ }
+
+
+ //Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590)
+ if (SYSTEM_FROM != name) break;
+
LLSD substitutions;
substitutions["NAME"] = name;
substitutions["MSG"] = message;
@@ -2627,22 +2691,8 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
chat.mMuted = is_muted && !is_linden;
- if (!visible_in_chat_bubble
- && (is_linden || !is_busy || is_owned_by_me))
- {
- // show on screen and add to history
- LLNotificationsUI::LLNotificationManager::instance().onChat(
+ LLNotificationsUI::LLNotificationManager::instance().onChat(
chat, LLNotificationsUI::NT_NEARBYCHAT);
-
- LLFloaterChat::addChat(chat, FALSE, FALSE);
- }
- else
- {
- LLNotificationsUI::LLNotificationManager::instance().onChat(
- chat, LLNotificationsUI::NT_NEARBYCHAT);
- // adding temporarily
- LLFloaterChat::addChatHistory(chat);
- }
}
}
@@ -3027,9 +3077,11 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
if (avatarp)
{
// Chat the "back" SLURL. (DEV-4907)
- LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL());
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
- LLFloaterChat::addChatHistory(chat);
+
+ //TODO* CHAT: how to show this?
+ //LLSD args;
+ //args["MESSAGE"] = message;
+ //LLNotificationsUtil::add("SystemMessage", args);
// Set the new position
avatarp->setPositionAgent(agent_pos);
@@ -4337,10 +4389,10 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
if (gStatusBar)
{
- S32 old_balance = gStatusBar->getBalance();
+ // S32 old_balance = gStatusBar->getBalance();
// This is an update, not the first transmission of balance
- if (old_balance != 0)
+ /* if (old_balance != 0)
{
// this is actually an update
if (balance > old_balance)
@@ -4352,7 +4404,7 @@ void process_money_balance_reply( LLMessageSystem* msg, void** )
LLFirstUse::useBalanceDecrease(balance - old_balance);
}
}
-
+ */
gStatusBar->setBalance(balance);
gStatusBar->setLandCredit(credit);
gStatusBar->setLandCommitted(committed);
@@ -5363,8 +5415,24 @@ bool handle_lure_callback(const LLSD& notification, const LLSD& response)
it != notification["payload"]["ids"].endArray();
++it)
{
+ LLUUID target_id = it->asUUID();
+
msg->nextBlockFast(_PREHASH_TargetData);
- msg->addUUIDFast(_PREHASH_TargetID, it->asUUID());
+ msg->addUUIDFast(_PREHASH_TargetID, target_id);
+
+ // Record the offer.
+ {
+ std::string target_name;
+ gCacheName->getFullName(target_id, target_name);
+ LLSD args;
+ args["TO_NAME"] = target_name;
+
+ LLSD payload;
+ payload["from_id"] = target_id;
+ payload["SESSION_NAME"] = target_name;
+ payload["SUPPRESS_TOAST"] = true;
+ LLNotificationsUtil::add("TeleportOfferSent", args, payload);
+ }
}
gAgent.sendReliableMessage();
}