diff --git a/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt b/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt index aee2825c50..f3994f06bb 100644 --- a/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt +++ b/indra/newview/fs_resources/EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt @@ -1,4 +1,4 @@ -// HTTP Bridge script v.2.17 +// HTTP Bridge script v.2.16 // Firestorm // Tozh Taurog, Arrehn Oberlander, Tonya Souther @@ -8,7 +8,7 @@ // Bridge platform string bridgeAuth = "BRIDGEKEY"; // Filled in dynamically - string bridgeVersion = "2.17"; // This should match fslslbridge.cpp + string bridgeVersion = "2.16"; // This should match fslslbridge.cpp string latestURL; integer viewerIsFirestorm; integer tryHandshakeOnce = TRUE; @@ -491,11 +491,6 @@ default llOwnerSay(""); } - else if (cmd == "QueryGridStatus") - { - llHTTPRequest("http://status.secondlifegrid.net/feed/rss/", [], ""); - } - else if (cmd == "llMoveToTarget") { @@ -604,31 +599,6 @@ default } } - http_response(key request_id, integer status, list metadata, string body) - { - if (status == 200) - { - integer itemEnd = llSubStringIndex(body, ""); - if (itemEnd != -1) - { - string theNews = llGetSubString(body, llSubStringIndex(body, "") + 6, itemEnd - 1); - llOwnerSay("[" + llGetSubString(theNews, llSubStringIndex(theNews, "") + 7, llSubStringIndex(theNews, "") - 1) + "] " + llStringTrim(llGetSubString(theNews, llSubStringIndex(theNews, "") + 13, llSubStringIndex(theNews, "") - 1), STRING_TRIM) + " [ " + llGetSubString(theNews, llSubStringIndex(theNews, "") + 6, llSubStringIndex(theNews, "") - 1) + " ]"); - } - else - { - llOwnerSay("SL Grid Status error: Invalid message format. Try again later."); - } - } - else if (status == 499) - { - llOwnerSay("SL Grid Status error: Request timed out."); - } - else - { - llOwnerSay("SL Grid Status error: " + (string)status + " (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes)."); - } - } - listen(integer fromChan, string senderName, key senderID, string msg) { // llOwnerSay("listen() from "+senderName+" msg: "+msg); diff --git a/indra/newview/fslslbridge.cpp b/indra/newview/fslslbridge.cpp index cbfa8fe8fb..dde5345cc9 100644 --- a/indra/newview/fslslbridge.cpp +++ b/indra/newview/fslslbridge.cpp @@ -68,10 +68,10 @@ const std::string FS_BRIDGE_FOLDER = "#LSL Bridge"; const std::string FS_BRIDGE_CONTAINER_FOLDER = "Landscaping"; const U32 FS_BRIDGE_MAJOR_VERSION = 2; -const U32 FS_BRIDGE_MINOR_VERSION = 17; +const U32 FS_BRIDGE_MINOR_VERSION = 16; const U32 FS_MAX_MINOR_VERSION = 99; -//current script version is 2.17 +//current script version is 2.16 const std::string UPLOAD_SCRIPT_CURRENT = "EBEDD1D2-A320-43f5-88CF-DD47BBCA5DFB.lsltxt"; // @@ -235,12 +235,6 @@ bool FSLSLBridge::lslToViewer(const std::string& message, const LLUUID& fromID, updateBoolSettingValue("RelockMoveLockAfterMovement"); updateIntegrations(); - - if (gSavedPerAccountSettings.getBOOL("AutoQueryGridStatus")) - { - viewerToLSL("QueryGridStatus", new FSLSLBridgeRequestResponder()); - } - mIsFirstCallDone = true; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 11168f213e..8ff703af43 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -115,6 +115,7 @@ #include "llgroupmgr.h" #include "llhudeffecttrail.h" #include "llhudmanager.h" +#include "llbufferstream.h" // For SL Grid Status #include "llhttpclient.h" #include "llimagebmp.h" #include "llinventorybridge.h" @@ -368,6 +369,71 @@ public: }; // +// +class SLGridStatusResponder : public LLHTTPClient::Responder +{ +public: + virtual void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) + { + + if (!isGoodStatus(status) && status != 304) + { + if (status == 499) + { + reportToNearbyChat(LLTrans::getString("SLGridStatusTimedOut")); + } + else + { + LLStringUtil::format_map_t args; + args["STATUS"] = llformat("%d", status); + reportToNearbyChat(LLTrans::getString("SLGridStatusOtherError", args)); + } + LL_WARNS("SLGridStatusResponder") << "Error - status " << status << LL_ENDL; + return; + } + + S32 outputSize = buffer->countAfter(channels.in(), NULL); + if (outputSize <= 0) + { + reportToNearbyChat(LLTrans::getString("SLGridStatusInvalidMsg")); + LL_WARNS("SLGridStatusResponder") << "Error - empty output" << LL_ENDL; + return; + } + + LLBufferStream istr(channels, buffer.get()); + std::stringstream strstrm; + strstrm << istr.rdbuf(); + std::string fetchedNews = strstrm.str(); + + S32 itemEnd = fetchedNews.find(""); + if (itemEnd != std::string::npos) + { + + S32 itemStart = fetchedNews.find("") + 6; + std::string theNews = fetchedNews.substr(itemStart, itemEnd - itemStart); + + S32 titleStart = theNews.find("") + 7; + S32 descStart = theNews.find("<description>") + 13; + S32 linkStart = theNews.find("<link>") + 6; + std::string newsTitle = theNews.substr(titleStart, theNews.find("") - titleStart); + std::string newsDesc = theNews.substr(descStart, theNews.find("") - descStart); + std::string newsLink = theNews.substr(linkStart, theNews.find("") - linkStart); + LLStringUtil::trim(newsTitle); + LLStringUtil::trim(newsDesc); + LLStringUtil::trim(newsLink); + reportToNearbyChat("[" + newsTitle + "] " + newsDesc + " [ " + newsLink + " ]"); + + } + else + { + reportToNearbyChat(LLTrans::getString("SLGridStatusInvalidMsg")); + LL_WARNS("SLGridStatusResponder") << "Error - output without " << LL_ENDL; + } + + } +}; +// + void update_texture_fetch() { LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread @@ -1537,6 +1603,13 @@ bool idle_startup() reportToNearbyChat(gAgent.mMOTD); } // + // + if (gSavedPerAccountSettings.getBOOL("AutoQueryGridStatus")) + { + std::string url = "http://status.secondlifegrid.net/feed/rss/"; + LLHTTPClient::get(url, new SLGridStatusResponder()); + } + // display_startup(); // We should have an agent id by this point. llassert(!(gAgentID == LLUUID::null)); diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 6dbfecbe01..13352486e5 100755 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -765,10 +765,6 @@ class LLAdvancedToggleHUDInfo : public view_listener_t { reportToNearbyChat(gAgent.mMOTD); } - else if ("gridstatus" == info_type) - { - FSLSLBridge::instance().viewerToLSL("QueryGridStatus"); - } // return true; } diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7ec1f4b039..58791d488e 100755 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -1930,13 +1930,6 @@ function="Advanced.ToggleHUDInfo" parameter="motd" /> - - - diff --git a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml index 7dbda03c8c..a2198b2e12 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_alerts.xml @@ -290,9 +290,8 @@ width="160"/> You belong to [COUNT] groups ([REMAINING] remaining). You belong to [COUNT] groups. + SL Grid Status error: Invalid message format. Try again later. + SL Grid Status error: Request timed out. + SL Grid Status error: [STATUS] (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes). + diff --git a/indra/newview/skins/default/xui/pl/menu_viewer.xml b/indra/newview/skins/default/xui/pl/menu_viewer.xml index 0b755ece95..32a8586bd5 100755 --- a/indra/newview/skins/default/xui/pl/menu_viewer.xml +++ b/indra/newview/skins/default/xui/pl/menu_viewer.xml @@ -223,7 +223,6 @@ - diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml index 1e1f27d057..631e87b51e 100755 --- a/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml +++ b/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml @@ -34,7 +34,7 @@ - + diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml index 5e64032db9..ea3984dbd2 100755 --- a/indra/newview/skins/default/xui/pl/strings.xml +++ b/indra/newview/skins/default/xui/pl/strings.xml @@ -5450,4 +5450,13 @@ Spróbuj załączyć ścieżkę do edytora w cytowaniu. Należysz do [COUNT] grup. + + Błąd strony SL Grid Status: Nieprawidłowy format wiadomości. Spróbuj ponownie później. + + + Błąd strony SL Grid Status: Upłynął limit czasu żądania. + + + Błąd strony SL Grid Status: [STATUS] (https://pl.wikipedia.org/wiki/Kod_odpowiedzi_HTTP). +