Update our url stuffs!

Adds support for JIRA link labels from Alchemy. (Made less of a mess by me)
Adds support for x-grid-info, the future of x-grid-info-location from Alchemy.
Updates uriparser latest from Alchemy.
Updates llstring to be more in line with upstream Alchemy.
Fixes our LLURI Implementation
Updates LLURLAction to modern C++ stuffies~
Adds Email protocol support from alchemy
Sync LLSLURL with Alchemy, adding x-grid-info support.
Also keep NoProtocol Support because yaaassss~
(also we won't suffer from MAINT-5019 because we're not dumb.)
This commit is contained in:
Lirusaito
2019-01-20 09:13:05 -05:00
parent 4b4c8c8e37
commit 7112e163e6
33 changed files with 1529 additions and 301 deletions

View File

@@ -1,3 +1,5 @@
// This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
/**
* @file llurlaction.cpp
* @author Martin Reddy
@@ -24,7 +26,6 @@
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "linden_common.h"
#include "llurlaction.h"
@@ -32,6 +33,7 @@
#include "llwindow.h"
#include "llurlregistry.h"
// global state for the callback functions
LLUrlAction::url_callback_t LLUrlAction::sOpenURLCallback;
LLUrlAction::url_callback_t LLUrlAction::sOpenURLInternalCallback;
@@ -83,18 +85,19 @@ void LLUrlAction::openURLExternal(std::string url)
}
}
void LLUrlAction::executeSLURL(std::string url)
bool LLUrlAction::executeSLURL(std::string url, bool trusted_content)
{
if (sExecuteSLURLCallback)
{
sExecuteSLURLCallback(url);
return sExecuteSLURLCallback(url, trusted_content);
}
return false;
}
void LLUrlAction::clickAction(std::string url)
void LLUrlAction::clickAction(std::string url, bool trusted_content)
{
// Try to handle as SLURL first, then http Url
if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url) )
if ( (sExecuteSLURLCallback) && !sExecuteSLURLCallback(url, trusted_content) )
{
if (sOpenURLCallback)
{
@@ -157,3 +160,86 @@ void LLUrlAction::showProfile(std::string url)
}
}
}
std::string LLUrlAction::getUserID(std::string url)
{
LLURI uri(url);
LLSD path_array = uri.pathArray();
std::string id_str;
if (path_array.size() == 4)
{
id_str = path_array.get(2).asString();
}
return id_str;
}
std::string LLUrlAction::getObjectId(std::string url)
{
LLURI uri(url);
LLSD path_array = uri.pathArray();
std::string id_str;
if (path_array.size() >= 3)
{
id_str = path_array.get(2).asString();
}
return id_str;
}
std::string LLUrlAction::getObjectName(std::string url)
{
LLURI uri(url);
LLSD query_map = uri.queryMap();
std::string name;
if (query_map.has("name"))
{
name = query_map["name"].asString();
}
return name;
}
void LLUrlAction::sendIM(std::string url)
{
std::string id_str = getUserID(url);
if (LLUUID::validate(id_str))
{
executeSLURL("secondlife:///app/agent/" + id_str + "/im");
}
}
void LLUrlAction::addFriend(std::string url)
{
std::string id_str = getUserID(url);
if (LLUUID::validate(id_str))
{
executeSLURL("secondlife:///app/agent/" + id_str + "/requestfriend");
}
}
void LLUrlAction::removeFriend(std::string url)
{
std::string id_str = getUserID(url);
if (LLUUID::validate(id_str))
{
executeSLURL("secondlife:///app/agent/" + id_str + "/removefriend");
}
}
void LLUrlAction::blockObject(std::string url)
{
std::string object_id = getObjectId(url);
std::string object_name = getObjectName(url);
if (LLUUID::validate(object_id))
{
executeSLURL("secondlife:///app/agent/" + object_id + "/block/" + LLURI::escape(object_name));
}
}
void LLUrlAction::unblockObject(std::string url)
{
std::string object_id = getObjectId(url);
std::string object_name = getObjectName(url);
if (LLUUID::validate(object_id))
{
executeSLURL("secondlife:///app/agent/" + object_id + "/unblock/" + object_name);
}
}