From 086af65f89bf9c01b45d5578640e686aa2ea6cde Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Tue, 28 Jun 2016 10:33:48 -0400 Subject: [PATCH] SV-2093: Add Block option to ScriptDialogs. Thanks to routergray for helping me test this. --- indra/newview/llnotify.cpp | 10 +++++----- indra/newview/llviewermessage.cpp | 8 ++++++-- .../skins/default/xui/en-us/notifications.xml | 12 ++++++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/indra/newview/llnotify.cpp b/indra/newview/llnotify.cpp index 3a81ac69a..2bba6d4f9 100644 --- a/indra/newview/llnotify.cpp +++ b/indra/newview/llnotify.cpp @@ -390,9 +390,9 @@ LLButton* LLNotifyBox::addButton(const std::string& name, const std::string& lab if (layout_script_dialog) { - // Add two "blank" option spaces, before the "Ignore" button - index = button_index + 2; - if (button_index == 0) + // Add one "blank" option space, before the "Block" and "Ignore" buttons + index = button_index + 1; + if (button_index == 0 || button_index == 1) { // Ignore button is smaller, less wide btn_height = BTN_HEIGHT_SMALL; @@ -625,9 +625,9 @@ LLRect LLNotifyBox::getNotifyRect(S32 num_options, bool layout_script_dialog, bo if (num_options < 1) num_options = 1; - // Add two "blank" option spaces. + // Add one "blank" option space. if (layout_script_dialog) - num_options += 2; + num_options += 1; S32 additional_lines = (num_options-1) / 3; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index dceb46f1c..ddb63c0c0 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -8090,8 +8090,8 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) std::string button = LLNotification::getSelectedOptionName(response); S32 button_idx = LLNotification::getSelectedOption(notification, response); - // Didn't click "Ignore" - if (button_idx != -1) + // Didn't click "Ignore" or "Block" + if (button_idx > -1) { if (notification["payload"].has("textbox")) { @@ -8109,6 +8109,10 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) msg->addString("ButtonLabel", button); msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); } + else if (button_idx == -2) // Block + { + LLMuteList::getInstance()->add(LLMute(notification["payload"]["object_id"].asUUID(), notification["substitutions"]["TITLE"].asString(), LLMute::OBJECT)); + } return false; } diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index b82dfb7d0..29b956251 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -7537,6 +7537,10 @@ Grant this request? [NAME]'s '[TITLE]' (ch[CHANNEL]) [MESSAGE]
+