summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorSteven Bennetts <steve@lindenlab.com>2007-01-31 19:36:32 +0000
committerSteven Bennetts <steve@lindenlab.com>2007-01-31 19:36:32 +0000
commit934e15973ea86e0e863123d4c5eabeae44d6c763 (patch)
treec4d9ff93e1d9283c4807981ecf1973babf620143 /indra/llcommon
parent565e6873decfaadf9eda2d0109132eb64c0ad325 (diff)
merge release@57486 release-candidate@57503
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/llassettype.cpp16
-rw-r--r--indra/llcommon/llassettype.h8
-rw-r--r--indra/llcommon/llavatarconstants.h12
-rw-r--r--indra/llcommon/llsdutil.cpp11
-rw-r--r--indra/llcommon/llsdutil.h3
-rw-r--r--indra/llcommon/lluri.cpp84
-rw-r--r--indra/llcommon/lluri.h7
7 files changed, 129 insertions, 12 deletions
diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index f6d9f166e1..628ebb7aec 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -8,9 +8,11 @@
#include "linden_common.h"
+#include "llassettype.h"
+
#include <time.h>
-#include "llassettype.h"
+#include "llstring.h"
#include "lltimer.h"
// I added lookups for exact text of asset type enums in addition to the ones below, so shoot me. -Steve
@@ -49,9 +51,9 @@ asset_info_t asset_types[] =
{ LLAssetType::AT_NONE, "NONE" },
};
-LLAssetType::EType LLAssetType::getType(const LLString& sin)
+LLAssetType::EType LLAssetType::getType(const std::string& sin)
{
- LLString s = sin;
+ std::string s = sin;
LLString::toUpper(s);
for (S32 idx = 0; ;idx++)
{
@@ -64,17 +66,17 @@ LLAssetType::EType LLAssetType::getType(const LLString& sin)
return LLAssetType::AT_NONE;
}
-LLString LLAssetType::getDesc(LLAssetType::EType type)
+std::string LLAssetType::getDesc(LLAssetType::EType type)
{
for (S32 idx = 0; ;idx++)
{
asset_info_t* info = asset_types + idx;
if (type == info->type)
- return LLString(info->desc);
+ return info->desc;
if (info->type == LLAssetType::AT_NONE)
break;
}
- return LLString("BAD TYPE");
+ return "BAD TYPE";
}
//============================================================================
@@ -206,7 +208,7 @@ EDragAndDropType LLAssetType::lookupDragAndDropType( EType asset )
// static. Generate a good default description
void LLAssetType::generateDescriptionFor(LLAssetType::EType type,
- LLString& desc)
+ std::string& desc)
{
const S32 BUF_SIZE = 30;
char time_str[BUF_SIZE]; /* Flawfinder: ignore */
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index 2b5aadf078..abc118fe9c 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -9,6 +9,8 @@
#ifndef LL_LLASSETTYPE
#define LL_LLASSETTYPE
+#include <string>
+
#include "stdenums.h" // for EDragAndDropType
class LLAssetType
@@ -131,10 +133,10 @@ public:
// Generate a good default description. You may want to add a verb
// or agent name after this depending on your application.
static void generateDescriptionFor(LLAssetType::EType type,
- LLString& desc);
+ std::string& desc);
- static EType getType(const LLString& sin);
- static LLString getDesc(EType type);
+ static EType getType(const std::string& sin);
+ static std::string getDesc(EType type);
private:
// don't instantiate or derive one of these objects
diff --git a/indra/llcommon/llavatarconstants.h b/indra/llcommon/llavatarconstants.h
index ccfec63b83..67bd329732 100644
--- a/indra/llcommon/llavatarconstants.h
+++ b/indra/llcommon/llavatarconstants.h
@@ -20,5 +20,17 @@ const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisa
// Maximum number of avatar picks
const S32 MAX_AVATAR_PICKS = 10;
+// For Flags in AvatarPropertiesReply
+const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
+const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
+const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
+const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
+const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
+
+static const std::string VISIBILITY_DEFAULT("default");
+static const std::string VISIBILITY_HIDDEN("hidden");
+static const std::string VISIBILITY_VISIBLE("visible");
+static const std::string VISIBILITY_INVISIBLE("invisible");
+
#endif
diff --git a/indra/llcommon/llsdutil.cpp b/indra/llcommon/llsdutil.cpp
index 7cd0ed4c08..a6ac2fb12b 100644
--- a/indra/llcommon/llsdutil.cpp
+++ b/indra/llcommon/llsdutil.cpp
@@ -203,3 +203,14 @@ U32 ll_ipaddr_from_sd(const LLSD& sd)
memcpy(&ret, &(v[0]), 4); /* Flawfinder: ignore */
return ret;
}
+
+// Converts an LLSD binary to an LLSD string
+LLSD ll_string_from_binary(const LLSD& sd)
+{
+ std::vector<U8> value = sd.asBinary();
+ char* c_str = new char[value.size() + 1];
+ memcpy(c_str, &value[0], value.size());
+ c_str[value.size()] = '\0';
+
+ return c_str;
+}
diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h
index 79961c5311..44e9429d7f 100644
--- a/indra/llcommon/llsdutil.h
+++ b/indra/llcommon/llsdutil.h
@@ -51,4 +51,7 @@ U64 ll_U64_from_sd(const LLSD& sd);
LLSD ll_sd_from_ipaddr(const U32);
U32 ll_ipaddr_from_sd(const LLSD& sd);
+// Binary to string
+LLSD ll_string_from_binary(const LLSD& sd);
+
#endif // LL_LLSDUTIL_H
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 1b66173399..5ecba4420d 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -9,9 +9,13 @@
*/
#include "linden_common.h"
+
+#include "llapp.h"
#include "lluri.h"
#include "llsd.h"
+#include "../llmath/lluuid.h"
+
// uric = reserved | unreserved | escaped
// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
// unreserved = alphanum | mark
@@ -353,9 +357,21 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
const LLSD& path)
{
LLURI result;
- result.mScheme = "HTTP";
+
// TODO: deal with '/' '?' '#' in host_port
- result.mEscapedAuthority = "//" + escape(host_port);
+ S32 index = host_port.find("://");
+ if (index != host_port.npos)
+ {
+ // The scheme is part of the host_port
+ result.mScheme = "";
+ result.mEscapedAuthority = escape(host_port);
+ }
+ else
+ {
+ result.mScheme = "HTTP";
+ result.mEscapedAuthority = "//" + escape(host_port);
+ }
+
if (path.isArray())
{
// break out and escape each path component
@@ -397,6 +413,70 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
return result;
}
+// static
+LLURI LLURI::buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app)
+{
+ std::string host = "localhost:12040";
+
+ if (app)
+ {
+ host = app->getOption("backbone-host-port").asString();
+ }
+
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append(agent_id);
+ path.append("presence");
+
+ return buildHTTP(host, path);
+}
+
+// static
+LLURI LLURI::buildBulkAgentPresenceURI(LLApp* app)
+{
+ std::string host = "localhost:12040";
+
+ if (app)
+ {
+ host = app->getOption("backbone-host-port").asString();
+ }
+
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append("presence");
+
+ return buildHTTP(host, path);
+}
+
+// static
+LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
+{
+ std::string host = "localhost:12040";
+
+ if (app)
+ {
+ host = app->getOption("backbone-host-port").asString();
+ }
+
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append(agent_id);
+ path.append("session");
+
+ return buildHTTP(host, path);
+}
+
+// static
+LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
+{
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append(agent_id);
+ path.append("logininfo");
+
+ return buildHTTP(dataserver, path);
+}
+
std::string LLURI::asString() const
{
if (mScheme.empty())
diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h
index 3fc62aeb98..b1ac0bca2b 100644
--- a/indra/llcommon/lluri.h
+++ b/indra/llcommon/lluri.h
@@ -14,6 +14,8 @@
#include <string>
class LLSD;
+class LLUUID;
+class LLApp;
/**
*
@@ -61,6 +63,11 @@ public:
static std::string escape(const std::string& str);
static std::string unescape(const std::string& str);
+ // Functions for building specific URIs for web services
+ static LLURI buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app);
+ static LLURI buildBulkAgentPresenceURI(LLApp* app);
+ static LLURI buildAgentSessionURI(const LLUUID& agent_id, LLApp* app);
+ static LLURI buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver);
private:
std::string mScheme;
std::string mEscapedOpaque;