support search login response, add fallback and have according debug

Armin Weatherwax 2012-05-21 16:02:54 +02:00
parent 42b46c38b2
commit 86e3122b8a
8 changed files with 259 additions and 8 deletions

View File

@ -1575,6 +1575,40 @@
<integer>1</integer>
</map>
<key>DebugSearch</key>
<map>
<key>Comment</key>
<string>If TRUE use search url as given in SearchURLDebug</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>0</integer>
</map>
<key>SearchURLDebug</key>
<map>
<key>Comment</key>
<string>Debug URL for Search website. Overrides any other search URL if DebugSearch is true. Displayed in the Find floater</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string/>
</map>
<key>SearchURLOpenSim</key>
<map>
<key>Comment</key>
<string>Fallback URL for Search website if the loginservice doesn't provide a search URL. Displayed in the Find floater</string>
<key>Persist</key>
<integer>0</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>http://search.metaverseink.com/opensim/results.jsp?query=[QUERY]&amp;submit=[CATEGORY]</string>
</map>
<key>CrashHostUrl</key>
<map>
<key>Comment</key>

View File

@ -128,6 +128,8 @@
#include "llhunspell.h"
// [/SL:KB]
#include "llviewernetwork.h" // <FS:AW opensim search support>
const F32 MAX_USER_FAR_CLIP = 512.f;
const F32 MIN_USER_FAR_CLIP = 64.f;
//<FS:HG> FIRE-6340, FIRE-6567 - Setting Bandwidth issues
@ -210,6 +212,10 @@ void handleFlightAssistOptionChanged(const LLSD& newvalue);
bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response);
bool callback_clear_cache(const LLSD& notification, const LLSD& response);
bool callback_clear_settings(const LLSD& notification, const LLSD& response);
// <FS:AW opensim search support>
bool callback_clear_debug_search(const LLSD& notification, const LLSD& response);
bool callback_pick_debug_search(const LLSD& notification, const LLSD& response);
// </FS:AW opensim search support>
//bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
//bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
@ -258,6 +264,46 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
return false;
}
// <FS:AW opensim search support>
bool callback_clear_debug_search(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( option == 0 ) // YES
{
gSavedSettings.setString("SearchURLDebug","");
}
return false;
}
bool callback_pick_debug_search(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if ( option == 0 ) // YES
{
std::string url;
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
if(LLGridManager::getInstance()->isInOpenSim())
{
url = LLLoginInstance::getInstance()->hasResponse("search")
? LLLoginInstance::getInstance()->getResponse("search").asString()
: gSavedSettings.getString("SearchURLOpenSim");
}
else // we are in SL or SL beta
#endif // HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
{
//not in OpenSim means we are in SL or SL beta
url = gSavedSettings.getString("SearchURL");
}
gSavedSettings.setString("SearchURLDebug", url);
}
return false;
}
// </FS:AW opensim search support>
void handleNameTagOptionChanged(const LLSD& newvalue)
{
LLVOAvatar::invalidateNameTags();
@ -392,6 +438,10 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
mCommitCallbackRegistrar.add("Pref.BlockList", boost::bind(&LLFloaterPreference::onClickBlockList, this));
mCommitCallbackRegistrar.add("Pref.Proxy", boost::bind(&LLFloaterPreference::onClickProxySettings, this));
mCommitCallbackRegistrar.add("Pref.TranslationSettings", boost::bind(&LLFloaterPreference::onClickTranslationSettings, this));
// <FS:AW opensim search support>
mCommitCallbackRegistrar.add("Pref.ClearDebugSearchURL", boost::bind(&LLFloaterPreference::onClickClearDebugSearchURL, this));
mCommitCallbackRegistrar.add("Pref.PickDebugSearchURL", boost::bind(&LLFloaterPreference::onClickPickDebugSearchURL, this));
// </FS:AW opensim search support>
mCommitCallbackRegistrar.add("FS.ToggleSortContacts", boost::bind(&LLFloaterPreference::onClickSortContacts, this));
mCommitCallbackRegistrar.add("NACL.AntiSpamUnblock", boost::bind(&LLFloaterPreference::onClickClearSpamList, this));
mCommitCallbackRegistrar.add("NACL.SetPreprocInclude", boost::bind(&LLFloaterPreference::setPreprocInclude, this));
@ -1017,6 +1067,20 @@ void LLFloaterPreference::onClickSetCache()
gSavedSettings.setString("CacheLocationTopFolder", top_folder);
}
}
// <FS:AW opensim search support>
void LLFloaterPreference::onClickClearDebugSearchURL()
{
LLNotificationsUtil::add("ConfirmClearDebugSearchURL", LLSD(), LLSD(), callback_clear_debug_search);
}
void LLFloaterPreference::onClickPickDebugSearchURL()
{
LLNotificationsUtil::add("ConfirmPickDebugSearchURL", LLSD(), LLSD(),callback_pick_debug_search );
}
// </FS:AW opensim search support>
void LLFloaterPreference::onClickBrowseCache()
{
gViewerWindow->getWindow()->openFile(gDirUtilp->getExpandedFilename(LL_PATH_CACHE,""));
@ -1359,8 +1423,21 @@ void LLFloaterPreference::refreshEnabledState()
// now turn off any features that are unavailable
disableUnavailableSettings();
// <FS:AW opensim search support>
// getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
bool logged_in = LLLoginInstance::getInstance()->authSuccess();
getChildView("block_list")->setEnabled(logged_in);
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
getChildView("pick_current_search_url")->setEnabled(logged_in);
getChildView("DebugSearch")->setEnabled(logged_in);
getChildView("debug_search_panel")->setEnabled(logged_in);
// <FS:AW optional opensim support>
#else // HAS_OPENSIM_SUPPORT
getChildView("debug_search_panel")->setVisible(false);
#endif // HAS_OPENSIM_SUPPORT
// </FS:AW optional opensim support>
getChildView("block_list")->setEnabled(LLLoginInstance::getInstance()->authSuccess());
// </FS:AW opensim search support>
}
void LLFloaterPreference::disableUnavailableSettings()

View File

@ -93,6 +93,11 @@ protected:
void onLanguageChange();
void onNameTagOpacityChange(const LLSD& newvalue);
// <FS:AW opensim search support>
void onClickClearDebugSearchURL();
void onClickPickDebugSearchURL();
// </FS:AW opensim search support>
// ## Zi: Pie menu
// make sure controls get greyed out or enabled when pie color override is toggled
void onPieColorsOverrideChanged();

View File

@ -38,6 +38,8 @@
#include "llui.h"
#include "llviewercontrol.h"
#include "llweb.h"
#include "llviewernetwork.h"// </FS:AW opensim search support>
// support secondlife:///app/search/{CATEGORY}/{QUERY} SLapps
class LLSearchHandler : public LLCommandHandler
@ -118,8 +120,18 @@ void LLFloaterSearch::onOpen(const LLSD& key)
{
Params p(key);
p.trusted_content = true;
// <FS:AW opensim search support>
// p.allow_address_entry = false;
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
bool debug = gSavedSettings.getBOOL("DebugSearch");
p.allow_address_entry = debug;
// <FS:AW optional opensim support>
#else // HAS_OPENSIM_SUPPORT
p.allow_address_entry = false;
#endif // HAS_OPENSIM_SUPPORT
// </FS:AW optional opensim support>
// </FS:AW opensim search support>
LLFloaterWebContent::onOpen(p);
search(p.search);
}
@ -199,7 +211,29 @@ void LLFloaterSearch::search(const SearchQuery &p)
// get the search URL and expand all of the substitutions
// (also adds things like [LANGUAGE], [VERSION], [OS], etc.)
std::string url = gSavedSettings.getString("SearchURL");
// <FS:AW opensim search support>
// std::string url = gSavedSettings.getString("SearchURL");
std::string url;
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
std::string debug_url = gSavedSettings.getString("SearchURLDebug");
if (gSavedSettings.getBOOL("DebugSearch") && !debug_url.empty())
{
url = debug_url;
}
else if(LLGridManager::getInstance()->isInOpenSim())
{
url = LLLoginInstance::getInstance()->hasResponse("search")
? LLLoginInstance::getInstance()->getResponse("search").asString()
: gSavedSettings.getString("SearchURLOpenSim");
}
else // we are in SL or SL beta
#endif // HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
{
url = gSavedSettings.getString("SearchURL");
}
// </FS:AW opensim search support>
url = LLWeb::expandURLSubstitutions(url, subs);
// and load the URL in the web view

View File

@ -584,20 +584,20 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
requested_options.append("god-connect");
}
// <FS:AW opensim currency support>
// <FS:AW various patches>
#ifdef HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
//TODO: make this more flexible
if (LLGridManager::getInstance()->isInOpenSim())
{
requested_options.append("currency");
requested_options.append("currency");// <FS:AW opensim currency support>
requested_options.append("search"); // <FS:AW opensim search support>
//not in this patch
//requested_options.append("max_groups");
//requested_options.append("profile-server-url");
//requested_options.append("search");
//requested_options.append("web-profile-url");
}
#endif // HAS_OPENSIM_SUPPORT // <FS:AW optional opensim support>
// </FS:AW opensim currency support>
// </FS:AW various patches>
// (re)initialize the request params with creds.
LLSD request_params = user_credential->getLoginParams();

View File

@ -57,6 +57,9 @@ public:
const std::string& getLoginState() { return mLoginState; }
LLSD getResponse(const std::string& key) { return getResponse()[key]; }
LLSD getResponse();
// <FS:AW various patches>
bool hasResponse(const std::string& key) { return mResponseData.has(key); }
// </FS:AW various patches>
// Only valid when authSuccess == true.
const F64 getLastTransferRateBPS() { return mTransferRate; }

View File

@ -8187,6 +8187,30 @@ Otherwise, you can look at the Map and find places marked &quot;Infohub&quot;.
<global name="You died and have been teleported to your home location">
You died and have been teleported to your home location.
</global>
<!-- <FS:AW> opensim search support-->
<notification
icon="alertmodal.tga"
name="ConfirmClearDebugSearchURL"
type="alertmodal">
Are you sure you want to clear the debug search url?
<tag>confirm</tag>
<usetemplate
name="okcancelbuttons"
notext="Cancel"
yestext="OK"/>
</notification>
<notification
icon="alertmodal.tga"
name="ConfirmPickDebugSearchURL"
type="alertmodal">
Are you sure you want to pick the current search url as debug search url?
<tag>confirm</tag>
<usetemplate
name="okcancelbuttons"
notext="Cancel"
yestext="OK"/>
</notification>
<!-- </FS:AW> opensim search support-->
<notification
icon="notifytip.tga"

View File

@ -57,7 +57,80 @@
name="show_develop_menu_check"
top_pad="5"
width="237"/>
<panel
border="false"
follows="all"
height="56"
layout="topleft"
left="1"
top_pad="0"
width="540"
label=""
name="debug_search_panel">
<check_box
control_name="DebugSearch"
height="16"
initial_value="false"
label="Debug Search"
layout="topleft"
left="30"
name="DebugSearch"
top_pad="1"
width="256" />
<text
type="string"
length="1"
follows="left|top"
height="12"
layout="topleft"
left="80"
name="search_url_debug_text"
top_pad="1"
width="300">
Override current search url: (no override if empty)
</text>
<line_editor
control_name="SearchURLDebug"
enabled_control="DebugSearch"
border_style="line"
border_thickness="1"
follows="left|top"
font="SansSerif"
height="19"
layout="topleft"
left="80"
max_length="4096"
name="search_url_debug"
top_pad="5"
width="270" />
<button
enabled_control="DebugSearch"
follows="left|top"
height="19"
label="Clear"
label_selected="Clear"
layout="topleft"
left_pad="2"
name="clear_search_url_debug"
top_delta="0"
width="50">
<button.commit_callback
function="Pref.ClearDebugSearchURL" />
</button>
<button
enabled_control="DebugSearch"
follows="left|top"
height="19"
label="Pick"
layout="topleft"
left_pad="2"
name="pick_current_search_url"
top_delta="0"
width="50">
<button.commit_callback
function="Pref.PickDebugSearchURL" />
</button>
</panel>
<button
top="40"
enabled="true"
@ -66,7 +139,7 @@
height="25"
label="Reset All Settings"
label_selected="Reset All Settings..."
left_delta="0"
left="30"
mouse_opaque="true"
name="clear_settings"
scale_image="true"
@ -74,4 +147,5 @@
<button.commit_callback
function="Pref.ClearSettings" />
</button>
</panel>