aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llcommon/llassettype.cpp16
-rw-r--r--linden/indra/llcommon/llassettype.h8
-rw-r--r--linden/indra/llcommon/llavatarconstants.h12
-rw-r--r--linden/indra/llcommon/llsdutil.cpp11
-rw-r--r--linden/indra/llcommon/llsdutil.h3
-rw-r--r--linden/indra/llcommon/lluri.cpp84
-rw-r--r--linden/indra/llcommon/lluri.h7
-rw-r--r--linden/indra/llcommon/llversion.h4
8 files changed, 131 insertions, 14 deletions
diff --git a/linden/indra/llcommon/llassettype.cpp b/linden/indra/llcommon/llassettype.cpp
index cf38f7a..051092e 100644
--- a/linden/indra/llcommon/llassettype.cpp
+++ b/linden/indra/llcommon/llassettype.cpp
@@ -27,9 +27,11 @@
27 27
28#include "linden_common.h" 28#include "linden_common.h"
29 29
30#include "llassettype.h"
31
30#include <time.h> 32#include <time.h>
31 33
32#include "llassettype.h" 34#include "llstring.h"
33#include "lltimer.h" 35#include "lltimer.h"
34 36
35// I added lookups for exact text of asset type enums in addition to the ones below, so shoot me. -Steve 37// I added lookups for exact text of asset type enums in addition to the ones below, so shoot me. -Steve
@@ -68,9 +70,9 @@ asset_info_t asset_types[] =
68 { LLAssetType::AT_NONE, "NONE" }, 70 { LLAssetType::AT_NONE, "NONE" },
69}; 71};
70 72
71LLAssetType::EType LLAssetType::getType(const LLString& sin) 73LLAssetType::EType LLAssetType::getType(const std::string& sin)
72{ 74{
73 LLString s = sin; 75 std::string s = sin;
74 LLString::toUpper(s); 76 LLString::toUpper(s);
75 for (S32 idx = 0; ;idx++) 77 for (S32 idx = 0; ;idx++)
76 { 78 {
@@ -83,17 +85,17 @@ LLAssetType::EType LLAssetType::getType(const LLString& sin)
83 return LLAssetType::AT_NONE; 85 return LLAssetType::AT_NONE;
84} 86}
85 87
86LLString LLAssetType::getDesc(LLAssetType::EType type) 88std::string LLAssetType::getDesc(LLAssetType::EType type)
87{ 89{
88 for (S32 idx = 0; ;idx++) 90 for (S32 idx = 0; ;idx++)
89 { 91 {
90 asset_info_t* info = asset_types + idx; 92 asset_info_t* info = asset_types + idx;
91 if (type == info->type) 93 if (type == info->type)
92 return LLString(info->desc); 94 return info->desc;
93 if (info->type == LLAssetType::AT_NONE) 95 if (info->type == LLAssetType::AT_NONE)
94 break; 96 break;
95 } 97 }
96 return LLString("BAD TYPE"); 98 return "BAD TYPE";
97} 99}
98 100
99//============================================================================ 101//============================================================================
@@ -225,7 +227,7 @@ EDragAndDropType LLAssetType::lookupDragAndDropType( EType asset )
225 227
226// static. Generate a good default description 228// static. Generate a good default description
227void LLAssetType::generateDescriptionFor(LLAssetType::EType type, 229void LLAssetType::generateDescriptionFor(LLAssetType::EType type,
228 LLString& desc) 230 std::string& desc)
229{ 231{
230 const S32 BUF_SIZE = 30; 232 const S32 BUF_SIZE = 30;
231 char time_str[BUF_SIZE]; /* Flawfinder: ignore */ 233 char time_str[BUF_SIZE]; /* Flawfinder: ignore */
diff --git a/linden/indra/llcommon/llassettype.h b/linden/indra/llcommon/llassettype.h
index c62769a..67dc3ef 100644
--- a/linden/indra/llcommon/llassettype.h
+++ b/linden/indra/llcommon/llassettype.h
@@ -28,6 +28,8 @@
28#ifndef LL_LLASSETTYPE 28#ifndef LL_LLASSETTYPE
29#define LL_LLASSETTYPE 29#define LL_LLASSETTYPE
30 30
31#include <string>
32
31#include "stdenums.h" // for EDragAndDropType 33#include "stdenums.h" // for EDragAndDropType
32 34
33class LLAssetType 35class LLAssetType
@@ -150,10 +152,10 @@ public:
150 // Generate a good default description. You may want to add a verb 152 // Generate a good default description. You may want to add a verb
151 // or agent name after this depending on your application. 153 // or agent name after this depending on your application.
152 static void generateDescriptionFor(LLAssetType::EType type, 154 static void generateDescriptionFor(LLAssetType::EType type,
153 LLString& desc); 155 std::string& desc);
154 156
155 static EType getType(const LLString& sin); 157 static EType getType(const std::string& sin);
156 static LLString getDesc(EType type); 158 static std::string getDesc(EType type);
157 159
158private: 160private:
159 // don't instantiate or derive one of these objects 161 // don't instantiate or derive one of these objects
diff --git a/linden/indra/llcommon/llavatarconstants.h b/linden/indra/llcommon/llavatarconstants.h
index f56e9ab..3335949 100644
--- a/linden/indra/llcommon/llavatarconstants.h
+++ b/linden/indra/llcommon/llavatarconstants.h
@@ -39,5 +39,17 @@ const char* const BLACKLIST_PROFILE_WEB_URL = "http://secondlife.com/app/webdisa
39// Maximum number of avatar picks 39// Maximum number of avatar picks
40const S32 MAX_AVATAR_PICKS = 10; 40const S32 MAX_AVATAR_PICKS = 10;
41 41
42// For Flags in AvatarPropertiesReply
43const U32 AVATAR_ALLOW_PUBLISH = 0x1 << 0; // whether profile is externally visible or not
44const U32 AVATAR_MATURE_PUBLISH = 0x1 << 1; // profile is "mature"
45const U32 AVATAR_IDENTIFIED = 0x1 << 2; // whether avatar has provided payment info
46const U32 AVATAR_TRANSACTED = 0x1 << 3; // whether avatar has actively used payment info
47const U32 AVATAR_ONLINE = 0x1 << 4; // the online status of this avatar, if known.
48
49static const std::string VISIBILITY_DEFAULT("default");
50static const std::string VISIBILITY_HIDDEN("hidden");
51static const std::string VISIBILITY_VISIBLE("visible");
52static const std::string VISIBILITY_INVISIBLE("invisible");
53
42#endif 54#endif
43 55
diff --git a/linden/indra/llcommon/llsdutil.cpp b/linden/indra/llcommon/llsdutil.cpp
index f111039..0f295a1 100644
--- a/linden/indra/llcommon/llsdutil.cpp
+++ b/linden/indra/llcommon/llsdutil.cpp
@@ -222,3 +222,14 @@ U32 ll_ipaddr_from_sd(const LLSD& sd)
222 memcpy(&ret, &(v[0]), 4); /* Flawfinder: ignore */ 222 memcpy(&ret, &(v[0]), 4); /* Flawfinder: ignore */
223 return ret; 223 return ret;
224} 224}
225
226// Converts an LLSD binary to an LLSD string
227LLSD ll_string_from_binary(const LLSD& sd)
228{
229 std::vector<U8> value = sd.asBinary();
230 char* c_str = new char[value.size() + 1];
231 memcpy(c_str, &value[0], value.size());
232 c_str[value.size()] = '\0';
233
234 return c_str;
235}
diff --git a/linden/indra/llcommon/llsdutil.h b/linden/indra/llcommon/llsdutil.h
index 555d7fb..ca6b76f 100644
--- a/linden/indra/llcommon/llsdutil.h
+++ b/linden/indra/llcommon/llsdutil.h
@@ -70,4 +70,7 @@ U64 ll_U64_from_sd(const LLSD& sd);
70LLSD ll_sd_from_ipaddr(const U32); 70LLSD ll_sd_from_ipaddr(const U32);
71U32 ll_ipaddr_from_sd(const LLSD& sd); 71U32 ll_ipaddr_from_sd(const LLSD& sd);
72 72
73// Binary to string
74LLSD ll_string_from_binary(const LLSD& sd);
75
73#endif // LL_LLSDUTIL_H 76#endif // LL_LLSDUTIL_H
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp
index 2eb0f11..e697ec1 100644
--- a/linden/indra/llcommon/lluri.cpp
+++ b/linden/indra/llcommon/lluri.cpp
@@ -28,9 +28,13 @@
28 */ 28 */
29 29
30#include "linden_common.h" 30#include "linden_common.h"
31
32#include "llapp.h"
31#include "lluri.h" 33#include "lluri.h"
32#include "llsd.h" 34#include "llsd.h"
33 35
36#include "../llmath/lluuid.h"
37
34// uric = reserved | unreserved | escaped 38// uric = reserved | unreserved | escaped
35// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," 39// reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | ","
36// unreserved = alphanum | mark 40// unreserved = alphanum | mark
@@ -372,9 +376,21 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
372 const LLSD& path) 376 const LLSD& path)
373{ 377{
374 LLURI result; 378 LLURI result;
375 result.mScheme = "HTTP"; 379
376 // TODO: deal with '/' '?' '#' in host_port 380 // TODO: deal with '/' '?' '#' in host_port
377 result.mEscapedAuthority = "//" + escape(host_port); 381 S32 index = host_port.find("://");
382 if (index != host_port.npos)
383 {
384 // The scheme is part of the host_port
385 result.mScheme = "";
386 result.mEscapedAuthority = escape(host_port);
387 }
388 else
389 {
390 result.mScheme = "HTTP";
391 result.mEscapedAuthority = "//" + escape(host_port);
392 }
393
378 if (path.isArray()) 394 if (path.isArray())
379 { 395 {
380 // break out and escape each path component 396 // break out and escape each path component
@@ -416,6 +432,70 @@ LLURI LLURI::buildHTTP(const std::string& host_port,
416 return result; 432 return result;
417} 433}
418 434
435// static
436LLURI LLURI::buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app)
437{
438 std::string host = "localhost:12040";
439
440 if (app)
441 {
442 host = app->getOption("backbone-host-port").asString();
443 }
444
445 LLSD path = LLSD::emptyArray();
446 path.append("agent");
447 path.append(agent_id);
448 path.append("presence");
449
450 return buildHTTP(host, path);
451}
452
453// static
454LLURI LLURI::buildBulkAgentPresenceURI(LLApp* app)
455{
456 std::string host = "localhost:12040";
457
458 if (app)
459 {
460 host = app->getOption("backbone-host-port").asString();
461 }
462
463 LLSD path = LLSD::emptyArray();
464 path.append("agent");
465 path.append("presence");
466
467 return buildHTTP(host, path);
468}
469
470// static
471LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
472{
473 std::string host = "localhost:12040";
474
475 if (app)
476 {
477 host = app->getOption("backbone-host-port").asString();
478 }
479
480 LLSD path = LLSD::emptyArray();
481 path.append("agent");
482 path.append(agent_id);
483 path.append("session");
484
485 return buildHTTP(host, path);
486}
487
488// static
489LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
490{
491 LLSD path = LLSD::emptyArray();
492 path.append("agent");
493 path.append(agent_id);
494 path.append("logininfo");
495
496 return buildHTTP(dataserver, path);
497}
498
419std::string LLURI::asString() const 499std::string LLURI::asString() const
420{ 500{
421 if (mScheme.empty()) 501 if (mScheme.empty())
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h
index 52f07bf..f69472f 100644
--- a/linden/indra/llcommon/lluri.h
+++ b/linden/indra/llcommon/lluri.h
@@ -33,6 +33,8 @@
33#include <string> 33#include <string>
34 34
35class LLSD; 35class LLSD;
36class LLUUID;
37class LLApp;
36 38
37/** 39/**
38 * 40 *
@@ -80,6 +82,11 @@ public:
80 static std::string escape(const std::string& str); 82 static std::string escape(const std::string& str);
81 static std::string unescape(const std::string& str); 83 static std::string unescape(const std::string& str);
82 84
85 // Functions for building specific URIs for web services
86 static LLURI buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app);
87 static LLURI buildBulkAgentPresenceURI(LLApp* app);
88 static LLURI buildAgentSessionURI(const LLUUID& agent_id, LLApp* app);
89 static LLURI buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver);
83private: 90private:
84 std::string mScheme; 91 std::string mScheme;
85 std::string mEscapedOpaque; 92 std::string mEscapedOpaque;
diff --git a/linden/indra/llcommon/llversion.h b/linden/indra/llcommon/llversion.h
index 9cb01a3..af21f72 100644
--- a/linden/indra/llcommon/llversion.h
+++ b/linden/indra/llcommon/llversion.h
@@ -33,8 +33,8 @@
33// MUST ALSO change version number in secondlife setup.nsi 33// MUST ALSO change version number in secondlife setup.nsi
34const S32 LL_VERSION_MAJOR = 1; 34const S32 LL_VERSION_MAJOR = 1;
35const S32 LL_VERSION_MINOR = 13; 35const S32 LL_VERSION_MINOR = 13;
36const S32 LL_VERSION_PATCH = 2; 36const S32 LL_VERSION_PATCH = 3;
37const S32 LL_VERSION_BUILD = 15; 37const S32 LL_VERSION_BUILD = 2;
38 38
39 39
40 40