summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rwxr-xr-xindra/newview/llviewermessage.cpp338
1 files changed, 215 insertions, 123 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 25e8c2f441..2775a320d4 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -118,6 +118,7 @@
#include <boost/regex.hpp>
#include "llnotificationmanager.h" //
+#include "llexperiencecache.h"
#if LL_MSVC
// disable boost::lexical_cast warning
@@ -143,6 +144,7 @@ extern bool gShiftFrame;
bool check_offer_throttle(const std::string& from_name, bool check_only);
bool check_asset_previewable(const LLAssetType::EType asset_type);
static void process_money_balance_reply_extended(LLMessageSystem* msg);
+bool handle_trusted_experiences_notification(const LLSD&);
//inventory offer throttle globals
LLFrameTimer gThrottleTimer;
@@ -5695,164 +5697,192 @@ bool handle_prompt_for_maturity_level_change_and_reteleport_callback(const LLSD&
// some of the server notifications need special handling. This is where we do that.
bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
{
- U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
- std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
- LLStringUtil::toLower(regionMaturity);
- llsdBlock["REGIONMATURITY"] = regionMaturity;
bool returnValue = false;
- LLNotificationPtr maturityLevelNotification;
- std::string notifySuffix = "_Notify";
- if (regionAccess == SIM_ACCESS_MATURE)
- {
- if (gAgent.isTeen())
+ if(llsdBlock.has("_region_access"))
+ {
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
+ std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
+ LLStringUtil::toLower(regionMaturity);
+ llsdBlock["REGIONMATURITY"] = regionMaturity;
+ LLNotificationPtr maturityLevelNotification;
+ std::string notifySuffix = "_Notify";
+ if (regionAccess == SIM_ACCESS_MATURE)
{
- gAgent.clearTeleportRequest();
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
+ if (gAgent.isTeen())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
- notifySuffix = "_NotifyAdultsOnly";
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG())
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
}
- else if (gAgent.prefersPG())
+ else if (regionAccess == SIM_ACCESS_ADULT)
{
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
+ if (!gAgent.isAdult())
+ {
+ gAgent.clearTeleportRequest();
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
+ returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG() || gAgent.prefersMature())
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
+ else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ {
+ maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
+ returnValue = true;
+ }
}
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+
+ if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored())
{
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
- returnValue = true;
+ // Given a simple notification if no maturityLevelNotification is set or it is ignore
+ LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
}
}
- else if (regionAccess == SIM_ACCESS_ADULT)
+
+ return returnValue;
+}
+
+bool handle_trusted_experiences_notification(const LLSD& llsdBlock)
+{
+ if(llsdBlock.has("trusted_experiences"))
{
- if (!gAgent.isAdult())
- {
- gAgent.clearTeleportRequest();
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG() || gAgent.prefersMature())
+ std::ostringstream str;
+ const LLSD& experiences = llsdBlock["trusted_experiences"];
+ LLSD::array_const_iterator it = experiences.beginArray();
+ for(/**/; it != experiences.endArray(); ++it)
{
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
+ str<<LLSLURL("experience", it->asUUID(), "profile").getSLURLString() << "\n";
}
- else if (LLStringUtil::compareStrings(notificationID, "RegionEntryAccessBlocked") == 0)
+ std::string str_list = str.str();
+ if(!str_list.empty())
{
- maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock);
- returnValue = true;
+ LLNotificationsUtil::add("TrustedExperiencesAvailable", LLSD::emptyMap().with("EXPERIENCE_LIST", (LLSD)str_list));
+ return true;
}
}
-
- if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored())
- {
- // Given a simple notification if no maturityLevelNotification is set or it is ignore
- LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
- }
-
- return returnValue;
+ return false;
}
// some of the server notifications need special handling. This is where we do that.
bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notificationID, const std::string & defaultMessage)
{
- U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
- std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
- LLStringUtil::toLower(regionMaturity);
- llsdBlock["REGIONMATURITY"] = regionMaturity;
-
bool returnValue = false;
- LLNotificationPtr tp_failure_notification;
- std::string notifySuffix;
-
- if (notificationID == std::string("TeleportEntryAccessBlocked"))
+ if(llsdBlock.has("_region_access"))
{
- notifySuffix = "_Notify";
- if (regionAccess == SIM_ACCESS_MATURE)
- {
- if (gAgent.isTeen())
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
+ U8 regionAccess = static_cast<U8>(llsdBlock["_region_access"].asInteger());
+ std::string regionMaturity = LLViewerRegion::accessToString(regionAccess);
+ LLStringUtil::toLower(regionMaturity);
+ llsdBlock["REGIONMATURITY"] = regionMaturity;
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG())
+ LLNotificationPtr tp_failure_notification;
+ std::string notifySuffix;
+
+ if (notificationID == std::string("TeleportEntryAccessBlocked"))
+ {
+ notifySuffix = "_Notify";
+ if (regionAccess == SIM_ACCESS_MATURE)
{
- if (gAgent.hasRestartableFailedTeleportRequest())
+ if (gAgent.isTeen())
{
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG())
+ {
+ if (gAgent.hasRestartableFailedTeleportRequest())
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ returnValue = true;
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
}
else
{
gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
returnValue = true;
}
}
- else
+ else if (regionAccess == SIM_ACCESS_ADULT)
{
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
- }
- }
- else if (regionAccess == SIM_ACCESS_ADULT)
- {
- if (!gAgent.isAdult())
- {
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
- returnValue = true;
-
- notifySuffix = "_NotifyAdultsOnly";
- }
- else if (gAgent.prefersPG() || gAgent.prefersMature())
- {
- if (gAgent.hasRestartableFailedTeleportRequest())
+ if (!gAgent.isAdult())
{
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock);
returnValue = true;
+
+ notifySuffix = "_NotifyAdultsOnly";
+ }
+ else if (gAgent.prefersPG() || gAgent.prefersMature())
+ {
+ if (gAgent.hasRestartableFailedTeleportRequest())
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback);
+ returnValue = true;
+ }
+ else
+ {
+ gAgent.clearTeleportRequest();
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ returnValue = true;
+ }
}
else
{
gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
+ tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
returnValue = true;
}
}
+ } // End of special handling for "TeleportEntryAccessBlocked"
+ else
+ { // Normal case, no message munging
+ gAgent.clearTeleportRequest();
+ if (LLNotifications::getInstance()->templateExists(notificationID))
+ {
+ tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock);
+ }
else
{
- gAgent.clearTeleportRequest();
- tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback);
- returnValue = true;
+ llsdBlock["MESSAGE"] = defaultMessage;
+ tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock);
}
- }
- } // End of special handling for "TeleportEntryAccessBlocked"
- else
- { // Normal case, no message munging
- gAgent.clearTeleportRequest();
- if (LLNotifications::getInstance()->templateExists(notificationID))
- {
- tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock);
+ returnValue = true;
}
- else
+
+ if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored())
{
- llsdBlock["MESSAGE"] = defaultMessage;
- tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock);
+ // Given a simple notification if no tp_failure_notification is set or it is ignore
+ LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
}
- returnValue = true;
- }
-
- if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored())
- {
- // Given a simple notification if no tp_failure_notification is set or it is ignore
- LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock);
}
+ handle_trusted_experiences_notification(llsdBlock);
return returnValue;
}
@@ -5882,6 +5912,9 @@ bool attempt_standard_notification(LLMessageSystem* msgsystem)
}
}
+
+ handle_trusted_experiences_notification(llsdBlock);
+
if (
(notificationID == "RegionEntryAccessBlocked") ||
(notificationID == "LandClaimAccessBlocked") ||
@@ -6083,8 +6116,8 @@ void process_alert_core(const std::string& message, BOOL modal)
std::string alert_name(message.substr(ALERT_PREFIX.length()));
if (!handle_special_alerts(alert_name))
{
- LLNotificationsUtil::add(alert_name);
- }
+ LLNotificationsUtil::add(alert_name);
+ }
}
else if (message.find(NOTIFY_PREFIX) == 0)
{
@@ -6106,10 +6139,10 @@ void process_alert_core(const std::string& message, BOOL modal)
LLFloaterRegionRestarting::close();
}
- std::string new_msg =LLNotifications::instance().getGlobalString(text);
- args["MESSAGE"] = new_msg;
- LLNotificationsUtil::add("SystemMessage", args);
- }
+ std::string new_msg =LLNotifications::instance().getGlobalString(text);
+ args["MESSAGE"] = new_msg;
+ LLNotificationsUtil::add("SystemMessage", args);
+ }
else if (modal)
{
LLSD args;
@@ -6364,6 +6397,12 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
return false;
}
+ LLUUID experience;
+ if(notification["payload"].has("experience"))
+ {
+ experience = notification["payload"]["experience"].asUUID();
+ }
+
// check whether permissions were granted or denied
BOOL allowed = TRUE;
// the "yes/accept" button is the first button in the template, making it button 0
@@ -6373,6 +6412,16 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
new_questions = 0;
allowed = FALSE;
}
+ else if(experience.notNull())
+ {
+ LLSD permission;
+ LLSD data;
+ permission["permission"]="Allow";
+
+ data[experience.asString()]=permission;
+ data["experience"]=experience;
+ LLEventPumps::instance().obtain("experience_permission").post(data);
+ }
LLUUID task_id = notification["payload"]["task_id"].asUUID();
LLUUID item_id = notification["payload"]["item_id"].asUUID();
@@ -6399,7 +6448,27 @@ bool script_question_cb(const LLSD& notification, const LLSD& response)
{
script_question_mute(task_id,notification["payload"]["object_name"].asString());
}
+ if ( response["BlockExperience"] )
+ {
+ if(experience.notNull())
+ {
+ LLViewerRegion* region = gAgent.getRegion();
+ if (!region)
+ return false;
+
+ std::string lookup_url=region->getCapability("ExperiencePreferences");
+ if(lookup_url.empty())
+ return false;
+ LLSD permission;
+ LLSD data;
+ permission["permission"]="Block";
+ data[experience.asString()]=permission;
+ LLHTTPClient::put(lookup_url, data, NULL);
+ data["experience"]=experience;
+ LLEventPumps::instance().obtain("experience_permission").post(data);
+ }
+}
return false;
}
@@ -6432,8 +6501,24 @@ void script_question_mute(const LLUUID& task_id, const std::string& object_name)
static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb);
static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb);
+static LLNotificationFunctorRegistration script_question_cb_reg_3("ScriptQuestionExperience", script_question_cb);
static LLNotificationFunctorRegistration unknown_script_question_cb_reg("UnknownScriptQuestion", unknown_script_question_cb);
+void process_script_experience_details(const LLSD& experience_details, LLSD args, LLSD payload)
+{
+ if(experience_details[LLExperienceCache::PROPERTIES].asInteger() & LLExperienceCache::PROPERTY_GRID)
+ {
+ args["GRID_WIDE"] = LLTrans::getString("Grid-Scope");
+ }
+ else
+ {
+ args["GRID_WIDE"] = LLTrans::getString("Land-Scope");
+ }
+ args["EXPERIENCE"] = LLSLURL("experience", experience_details[LLExperienceCache::EXPERIENCE_ID].asUUID(), "profile").getSLURLString();
+
+ LLNotificationsUtil::add("ScriptQuestionExperience", args, payload);
+}
+
void process_script_question(LLMessageSystem *msg, void **user_data)
{
// *TODO: Translate owner name -> [FIRST] [LAST]
@@ -6445,6 +6530,7 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
S32 questions;
std::string object_name;
std::string owner_name;
+ LLUUID experienceid;
// taskid -> object key of object requesting permissions
msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid );
@@ -6454,6 +6540,11 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name);
msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
+ if(msg->has(_PREHASH_Experience))
+ {
+ msg->getUUIDFast(_PREHASH_Experience, _PREHASH_ExperienceID, experienceid);
+ }
+
// Special case. If the objects are owned by this agent, throttle per-object instead
// of per-owner. It's common for residents to reset a ton of scripts that re-request
// permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa,
@@ -6540,20 +6631,21 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
payload["owner_name"] = owner_name;
// check whether cautions are even enabled or not
- if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
+ const char* notification = "ScriptQuestion";
+
+ if(caution && gSavedSettings.getBOOL("PermissionsCautionEnabled"))
{
- if (caution)
- {
- args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
- }
- // display the caution permissions prompt
- LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
+ args["FOOTERTEXT"] = (count > 1) ? LLTrans::getString("AdditionalPermissionsRequestHeader") + "\n\n" + script_question : "";
+ notification = "ScriptQuestionCaution";
}
- else
+ else if(experienceid.notNull())
{
- // fall back to default behavior if cautions are entirely disabled
- LLNotificationsUtil::add("ScriptQuestion", args, payload);
+ payload["experience"]=experienceid;
+ LLExperienceCache::get(experienceid, boost::bind(process_script_experience_details, _1, args, payload));
+ return;
}
+
+ LLNotificationsUtil::add(notification, args, payload);
}
}
}