From ca1821048583acedaae7e1dbfe83a0b058faee2c Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Wed, 29 Sep 2010 19:00:55 +0100 Subject: more robustness for empty-but-not-aborted textboxes. --- indra/newview/lltoastscripttextbox.cpp | 6 ++++++ indra/newview/llviewermessage.cpp | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'indra') diff --git a/indra/newview/lltoastscripttextbox.cpp b/indra/newview/lltoastscripttextbox.cpp index 91a4831a9c..bdadff4cb0 100644 --- a/indra/newview/lltoastscripttextbox.cpp +++ b/indra/newview/lltoastscripttextbox.cpp @@ -171,6 +171,12 @@ void LLToastScriptTextbox::onClickOk() LLSD response = mNotification->getResponseTemplate(); //response["OH MY GOD WHAT A HACK"] = "woot"; response[TEXTBOX_MAGIC_TOKEN] = pMessageText->getText(); + if (response[TEXTBOX_MAGIC_TOKEN].asString().empty()) + { + // so we can distinguish between a successfully + // submitted blank textbox, and an ignored toast + response[TEXTBOX_MAGIC_TOKEN] = true; + } mNotification->respond(response); close(); llwarns << response << llendl; diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 321100e140..3a8f76aca1 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -6179,15 +6179,14 @@ bool callback_script_dialog(const LLSD& notification, const LLSD& response) llwarns << "ok: " << response << llendl; std::string rtn_text; S32 button_idx; - if (response[TEXTBOX_MAGIC_TOKEN].isDefined()) + button_idx = LLNotification::getSelectedOption(notification, response); + if (response[TEXTBOX_MAGIC_TOKEN].isString()) { rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); - button_idx = 0; } else { rtn_text = LLNotification::getSelectedOptionName(response); - button_idx = LLNotification::getSelectedOption(notification, response); } llwarns << "rtn: " << rtn_text << " btnidx: " << button_idx << llendl; // Didn't click "Ignore" -- cgit v1.2.3