Fetch news from status.secondlifegrid.net viewer-side, not script-side
Also, removing option from menu...
parent
937acfc075
commit
9a7c4c95c8
|
|
@ -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("<bridgeMovelock state=" + (string)useMoveLock + ">");
|
||||
}
|
||||
|
||||
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, "</item>");
|
||||
if (itemEnd != -1)
|
||||
{
|
||||
string theNews = llGetSubString(body, llSubStringIndex(body, "<item>") + 6, itemEnd - 1);
|
||||
llOwnerSay("[" + llGetSubString(theNews, llSubStringIndex(theNews, "<title>") + 7, llSubStringIndex(theNews, "</title>") - 1) + "] " + llStringTrim(llGetSubString(theNews, llSubStringIndex(theNews, "<description>") + 13, llSubStringIndex(theNews, "</description>") - 1), STRING_TRIM) + " [ " + llGetSubString(theNews, llSubStringIndex(theNews, "<link>") + 6, llSubStringIndex(theNews, "</link>") - 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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@
|
|||
#include "llgroupmgr.h"
|
||||
#include "llhudeffecttrail.h"
|
||||
#include "llhudmanager.h"
|
||||
#include "llbufferstream.h" // <FS:PP> For SL Grid Status
|
||||
#include "llhttpclient.h"
|
||||
#include "llimagebmp.h"
|
||||
#include "llinventorybridge.h"
|
||||
|
|
@ -368,6 +369,71 @@ public:
|
|||
};
|
||||
// </AW: opensim>
|
||||
|
||||
// <FS:PP>
|
||||
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("</item>");
|
||||
if (itemEnd != std::string::npos)
|
||||
{
|
||||
|
||||
S32 itemStart = fetchedNews.find("<item>") + 6;
|
||||
std::string theNews = fetchedNews.substr(itemStart, itemEnd - itemStart);
|
||||
|
||||
S32 titleStart = theNews.find("<title>") + 7;
|
||||
S32 descStart = theNews.find("<description>") + 13;
|
||||
S32 linkStart = theNews.find("<link>") + 6;
|
||||
std::string newsTitle = theNews.substr(titleStart, theNews.find("</title>") - titleStart);
|
||||
std::string newsDesc = theNews.substr(descStart, theNews.find("</description>") - descStart);
|
||||
std::string newsLink = theNews.substr(linkStart, theNews.find("</link>") - 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 </item>" << LL_ENDL;
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
// </FS:PP>
|
||||
|
||||
void update_texture_fetch()
|
||||
{
|
||||
LLAppViewer::getTextureCache()->update(1); // unpauses the texture cache thread
|
||||
|
|
@ -1537,6 +1603,13 @@ bool idle_startup()
|
|||
reportToNearbyChat(gAgent.mMOTD);
|
||||
}
|
||||
// </FS:Techwolf Lupindo>
|
||||
// <FS:PP>
|
||||
if (gSavedPerAccountSettings.getBOOL("AutoQueryGridStatus"))
|
||||
{
|
||||
std::string url = "http://status.secondlifegrid.net/feed/rss/";
|
||||
LLHTTPClient::get(url, new SLGridStatusResponder());
|
||||
}
|
||||
// </FS:PP>
|
||||
display_startup();
|
||||
// We should have an agent id by this point.
|
||||
llassert(!(gAgentID == LLUUID::null));
|
||||
|
|
|
|||
|
|
@ -765,10 +765,6 @@ class LLAdvancedToggleHUDInfo : public view_listener_t
|
|||
{
|
||||
reportToNearbyChat(gAgent.mMOTD);
|
||||
}
|
||||
else if ("gridstatus" == info_type)
|
||||
{
|
||||
FSLSLBridge::instance().viewerToLSL("QueryGridStatus");
|
||||
}
|
||||
// </FS:PP>
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1930,13 +1930,6 @@
|
|||
function="Advanced.ToggleHUDInfo"
|
||||
parameter="motd" />
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Latest grid status report"
|
||||
name="LatestGridStatusReport">
|
||||
<menu_item_call.on_click
|
||||
function="Advanced.ToggleHUDInfo"
|
||||
parameter="gridstatus" />
|
||||
</menu_item_call>
|
||||
</menu>
|
||||
|
||||
<!-- Help Menu -->
|
||||
|
|
|
|||
|
|
@ -290,9 +290,8 @@
|
|||
width="160"/>
|
||||
<check_box
|
||||
control_name="AutoQueryGridStatus"
|
||||
enabled_control="UseLSLBridge"
|
||||
height="16"
|
||||
label="Use the LSL-Client Bridge to query status.secondlifegrid.net for latest news at login"
|
||||
label="Query status.secondlifegrid.net for latest news at login"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="AutoQueryGridStatus"
|
||||
|
|
|
|||
|
|
@ -2701,4 +2701,8 @@ Try enclosing path to the editor with double quotes.
|
|||
<string name="groupcountstring">You belong to [COUNT] groups ([REMAINING] remaining).</string>
|
||||
<string name="groupcountunlimitedstring">You belong to [COUNT] groups.</string>
|
||||
|
||||
<string name="SLGridStatusInvalidMsg">SL Grid Status error: Invalid message format. Try again later.</string>
|
||||
<string name="SLGridStatusTimedOut">SL Grid Status error: Request timed out.</string>
|
||||
<string name="SLGridStatusOtherError">SL Grid Status error: [STATUS] (https://en.wikipedia.org/wiki/List_of_HTTP_status_codes).</string>
|
||||
|
||||
</strings>
|
||||
|
|
|
|||
|
|
@ -223,7 +223,6 @@
|
|||
<menu_item_call label="Twitter Firestorma" name="Firestorm Twitter"/>
|
||||
<menu_item_call label="Plurk Firestorma" name="Firestorm Plurk"/>
|
||||
<menu_item_call label="Wiadomość dnia" name="Firestorm MoTD"/>
|
||||
<menu_item_call label="Najnowszy news o stanie siatki" name="LatestGridStatusReport"/>
|
||||
</menu>
|
||||
<menu label="Pomoc" name="Help">
|
||||
<menu_item_check label="Włącz podpowiedzi" name="Enable Hints"/>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<check_box label="Mrugaj ikoną aplikacji, gdy nadchodzi wiadomość, a [APP_NAME] jest w tle" name="FSFlashOnMessage"/>
|
||||
<check_box label="Mrugaj ikoną aplikacji, gdy otwiera się okno dialogowe skryptu, a [APP_NAME] jest w tle" name="FSFlashOnScriptDialog"/>
|
||||
<check_box label="Wyłącz powiadomienia mówiące o zwróceniu przedmiotów do szafy" name="FSDisableReturnObjectNotification"/>
|
||||
<check_box label="Użyj Mostu LSL do pobrania ostatniego newsa z status.secondlifegrid.net przy logowaniu" name="AutoQueryGridStatus"/>
|
||||
<check_box label="Pobieraj najnowszego newsa z status.secondlifegrid.net przy logowaniu" name="AutoQueryGridStatus"/>
|
||||
<check_box label="Włącz powiadomienia Growl" name="notify_growl_checkbox"/>
|
||||
<check_box label="Włącz Growl nawet gdy Firestorm jest aktywny" name="notify_growl_always_checkbox"/>
|
||||
</panel>
|
||||
|
|
|
|||
|
|
@ -5450,4 +5450,13 @@ Spróbuj załączyć ścieżkę do edytora w cytowaniu.
|
|||
<string name="groupcountunlimitedstring">
|
||||
Należysz do [COUNT] grup.
|
||||
</string>
|
||||
<string name="SLGridStatusInvalidMsg">
|
||||
Błąd strony SL Grid Status: Nieprawidłowy format wiadomości. Spróbuj ponownie później.
|
||||
</string>
|
||||
<string name="SLGridStatusTimedOut">
|
||||
Błąd strony SL Grid Status: Upłynął limit czasu żądania.
|
||||
</string>
|
||||
<string name="SLGridStatusOtherError">
|
||||
Błąd strony SL Grid Status: [STATUS] (https://pl.wikipedia.org/wiki/Kod_odpowiedzi_HTTP).
|
||||
</string>
|
||||
</strings>
|
||||
|
|
|
|||
Loading…
Reference in New Issue