aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:58 -0500
committerJacek Antonelli2008-08-15 23:44:58 -0500
commit089fc07d207c71ce1401e72f09c31ad8c45872e2 (patch)
tree0028955add042c6f45b47a7b774adeeac9c592cb /linden/indra/llmessage
parentSecond Life viewer sources 1.16.0.5 (diff)
downloadmeta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.zip
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.gz
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.bz2
meta-impy-089fc07d207c71ce1401e72f09c31ad8c45872e2.tar.xz
Second Life viewer sources 1.17.0.12
Diffstat (limited to 'linden/indra/llmessage')
-rw-r--r--linden/indra/llmessage/llbuffer.h1
-rw-r--r--linden/indra/llmessage/llcachename.cpp6
-rw-r--r--linden/indra/llmessage/llcachename.h2
-rw-r--r--linden/indra/llmessage/llcurl.cpp11
-rw-r--r--linden/indra/llmessage/llcurl.h1
-rw-r--r--linden/indra/llmessage/llhttpclient.cpp53
-rw-r--r--linden/indra/llmessage/llhttpclient.h8
-rw-r--r--linden/indra/llmessage/llhttpnode.h7
-rw-r--r--linden/indra/llmessage/llinstantmessage.cpp36
-rw-r--r--linden/indra/llmessage/llinstantmessage.h20
-rw-r--r--linden/indra/llmessage/llmessageconfig.cpp5
-rw-r--r--linden/indra/llmessage/llregionflags.h9
-rw-r--r--linden/indra/llmessage/message.cpp21
13 files changed, 125 insertions, 55 deletions
diff --git a/linden/indra/llmessage/llbuffer.h b/linden/indra/llmessage/llbuffer.h
index badbc9f..63f7bea 100644
--- a/linden/indra/llmessage/llbuffer.h
+++ b/linden/indra/llmessage/llbuffer.h
@@ -39,6 +39,7 @@
39 */ 39 */
40 40
41#include <list> 41#include <list>
42#include <vector>
42 43
43/** 44/**
44 * @class LLChannelDescriptors 45 * @class LLChannelDescriptors
diff --git a/linden/indra/llmessage/llcachename.cpp b/linden/indra/llmessage/llcachename.cpp
index 3df4b82..2a21b5a 100644
--- a/linden/indra/llmessage/llcachename.cpp
+++ b/linden/indra/llmessage/llcachename.cpp
@@ -643,6 +643,12 @@ void LLCacheName::dumpStats()
643 << llendl; 643 << llendl;
644} 644}
645 645
646//static
647LLString LLCacheName::getDefaultName()
648{
649 return LLString(CN_WAITING);
650}
651
646void LLCacheName::Impl::processPendingAsks() 652void LLCacheName::Impl::processPendingAsks()
647{ 653{
648 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue); 654 sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
diff --git a/linden/indra/llmessage/llcachename.h b/linden/indra/llmessage/llcachename.h
index 7d606e6..d1a5cfe 100644
--- a/linden/indra/llmessage/llcachename.h
+++ b/linden/indra/llmessage/llcachename.h
@@ -101,6 +101,8 @@ public:
101 void dump(); // Dumps the contents of the cache 101 void dump(); // Dumps the contents of the cache
102 void dumpStats(); // Dumps the sizes of the cache and associated queues. 102 void dumpStats(); // Dumps the sizes of the cache and associated queues.
103 103
104 static LLString getDefaultName();
105
104private: 106private:
105 class Impl; 107 class Impl;
106 Impl& impl; 108 Impl& impl;
diff --git a/linden/indra/llmessage/llcurl.cpp b/linden/indra/llmessage/llcurl.cpp
index 9d883a7..5eaaab0 100644
--- a/linden/indra/llmessage/llcurl.cpp
+++ b/linden/indra/llmessage/llcurl.cpp
@@ -342,6 +342,12 @@ namespace
342 } 342 }
343 return sMainMulti; 343 return sMainMulti;
344 } 344 }
345
346 void freeMulti()
347 {
348 delete sMainMulti;
349 sMainMulti = NULL;
350 }
345} 351}
346 352
347void 353void
@@ -362,3 +368,8 @@ LLCurl::process()
362 mainMulti()->process(); 368 mainMulti()->process();
363} 369}
364 370
371void LLCurl::cleanup()
372{
373 freeMulti();
374 curl_global_cleanup();
375}
diff --git a/linden/indra/llmessage/llcurl.h b/linden/indra/llmessage/llcurl.h
index e188c38..2d7d5d8 100644
--- a/linden/indra/llmessage/llcurl.h
+++ b/linden/indra/llmessage/llcurl.h
@@ -128,6 +128,7 @@ public:
128 static void getByteRange(const std::string& url, S32 offset, S32 length, ResponderPtr responder); 128 static void getByteRange(const std::string& url, S32 offset, S32 length, ResponderPtr responder);
129 129
130 static void process(); 130 static void process();
131 static void cleanup();
131}; 132};
132 133
133namespace boost 134namespace boost
diff --git a/linden/indra/llmessage/llhttpclient.cpp b/linden/indra/llmessage/llhttpclient.cpp
index 8cb8344..a1f8e29 100644
--- a/linden/indra/llmessage/llhttpclient.cpp
+++ b/linden/indra/llmessage/llhttpclient.cpp
@@ -70,6 +70,29 @@ void LLHTTPClient::Responder::result(const LLSD& content)
70{ 70{
71} 71}
72 72
73// virtual
74void LLHTTPClient::Responder::completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels,
75 const LLIOPipe::buffer_ptr_t& buffer)
76{
77 LLBufferStream istr(channels, buffer.get());
78 LLSD content;
79
80 if (200 <= status && status < 300)
81 {
82 LLSDSerialize::fromXML(content, istr);
83/*
84 const S32 parseError = -1;
85 if(LLSDSerialize::fromXML(content, istr) == parseError)
86 {
87 mStatus = 498;
88 mReason = "Client Parse Error";
89 }
90*/
91 }
92
93 completed(status, reason, content);
94}
95
73// virtual 96// virtual
74void LLHTTPClient::Responder::completed(U32 status, const std::string& reason, const LLSD& content) 97void LLHTTPClient::Responder::completed(U32 status, const std::string& reason, const LLSD& content)
75{ 98{
@@ -108,25 +131,9 @@ namespace
108 virtual void complete(const LLChannelDescriptors& channels, 131 virtual void complete(const LLChannelDescriptors& channels,
109 const buffer_ptr_t& buffer) 132 const buffer_ptr_t& buffer)
110 { 133 {
111 LLBufferStream istr(channels, buffer.get());
112 LLSD content;
113
114 if (200 <= mStatus && mStatus < 300)
115 {
116 LLSDSerialize::fromXML(content, istr);
117/*
118 const S32 parseError = -1;
119 if(LLSDSerialize::fromXML(content, istr) == parseError)
120 {
121 mStatus = 498;
122 mReason = "Client Parse Error";
123 }
124*/
125 }
126
127 if (mResponder.get()) 134 if (mResponder.get())
128 { 135 {
129 mResponder->completed(mStatus, mReason, content); 136 mResponder->completedRaw(mStatus, mReason, channels, buffer);
130 } 137 }
131 } 138 }
132 139
@@ -243,15 +250,18 @@ namespace
243 LLPumpIO* theClientPump = NULL; 250 LLPumpIO* theClientPump = NULL;
244} 251}
245 252
246static void request(const std::string& url, LLURLRequest::ERequestAction method, 253static void request(
247 Injector* body_injector, LLHTTPClient::ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS) 254 const std::string& url,
255 LLURLRequest::ERequestAction method,
256 Injector* body_injector,
257 LLHTTPClient::ResponderPtr responder,
258 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
248{ 259{
249 if (!LLHTTPClient::hasPump()) 260 if (!LLHTTPClient::hasPump())
250 { 261 {
251 responder->completed(U32_MAX, "No pump", LLSD()); 262 responder->completed(U32_MAX, "No pump", LLSD());
252 return; 263 return;
253 } 264 }
254
255 LLPumpIO::chain_t chain; 265 LLPumpIO::chain_t chain;
256 266
257 LLURLRequest *req = new LLURLRequest(method, url); 267 LLURLRequest *req = new LLURLRequest(method, url);
@@ -262,7 +272,8 @@ static void request(const std::string& url, LLURLRequest::ERequestAction method,
262 } 272 }
263 req->setCallback(new LLHTTPClientURLAdaptor(responder)); 273 req->setCallback(new LLHTTPClientURLAdaptor(responder));
264 274
265 if (method == LLURLRequest::HTTP_POST && gMessageSystem) { 275 if (method == LLURLRequest::HTTP_POST && gMessageSystem)
276 {
266 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d", 277 req->addHeader(llformat("X-SecondLife-UDP-Listen-Port: %d",
267 gMessageSystem->mPort).c_str()); 278 gMessageSystem->mPort).c_str());
268 } 279 }
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h
index c2dfb5d..88f8cbb 100644
--- a/linden/indra/llmessage/llhttpclient.h
+++ b/linden/indra/llmessage/llhttpclient.h
@@ -38,6 +38,8 @@
38#include <boost/intrusive_ptr.hpp> 38#include <boost/intrusive_ptr.hpp>
39 39
40#include "llassettype.h" 40#include "llassettype.h"
41#include "llbuffer.h"
42#include "lliopipe.h"
41 43
42extern const F32 HTTP_REQUEST_EXPIRY_SECS; 44extern const F32 HTTP_REQUEST_EXPIRY_SECS;
43 45
@@ -58,7 +60,11 @@ public:
58 virtual void error(U32 status, const std::string& reason); // called with bad status codes 60 virtual void error(U32 status, const std::string& reason); // called with bad status codes
59 61
60 virtual void result(const LLSD& content); 62 virtual void result(const LLSD& content);
61 63
64 // Override point for clients that may want to use this class when the response is some other format besides LLSD
65 virtual void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels,
66 const LLIOPipe::buffer_ptr_t& buffer);
67
62 virtual void completed(U32 status, const std::string& reason, const LLSD& content); 68 virtual void completed(U32 status, const std::string& reason, const LLSD& content);
63 /**< The default implemetnation calls 69 /**< The default implemetnation calls
64 either: 70 either:
diff --git a/linden/indra/llmessage/llhttpnode.h b/linden/indra/llmessage/llhttpnode.h
index ae64a63..db82296 100644
--- a/linden/indra/llmessage/llhttpnode.h
+++ b/linden/indra/llmessage/llhttpnode.h
@@ -88,9 +88,10 @@ public:
88 88
89 class Response : public LLRefCount 89 class Response : public LLRefCount
90 { 90 {
91 public: 91 protected:
92 virtual ~Response(); 92 virtual ~Response();
93 93
94 public:
94 virtual void result(const LLSD&) = 0; 95 virtual void result(const LLSD&) = 0;
95 virtual void status(S32 code, const std::string& message) = 0; 96 virtual void status(S32 code, const std::string& message) = 0;
96 97
@@ -225,7 +226,6 @@ class LLSimpleResponse : public LLHTTPNode::Response
225{ 226{
226public: 227public:
227 static LLPointer<LLSimpleResponse> create(); 228 static LLPointer<LLSimpleResponse> create();
228 ~LLSimpleResponse();
229 229
230 void result(const LLSD& result); 230 void result(const LLSD& result);
231 void status(S32 code, const std::string& message); 231 void status(S32 code, const std::string& message);
@@ -235,6 +235,9 @@ public:
235 S32 mCode; 235 S32 mCode;
236 std::string mMessage; 236 std::string mMessage;
237 237
238protected:
239 ~LLSimpleResponse();
240
238private: 241private:
239 LLSimpleResponse() {;} // Must be accessed through LLPointer. 242 LLSimpleResponse() {;} // Must be accessed through LLPointer.
240}; 243};
diff --git a/linden/indra/llmessage/llinstantmessage.cpp b/linden/indra/llmessage/llinstantmessage.cpp
index 0ba7629..0a3a1e6 100644
--- a/linden/indra/llmessage/llinstantmessage.cpp
+++ b/linden/indra/llmessage/llinstantmessage.cpp
@@ -328,18 +328,46 @@ LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info)
328 param_message["parent_estate_id"] = (S32)im_info->mParentEstateID; 328 param_message["parent_estate_id"] = (S32)im_info->mParentEstateID;
329 param_message["region_id"] = im_info->mRegionID; 329 param_message["region_id"] = im_info->mRegionID;
330 param_message["position"] = ll_sd_from_vector3(im_info->mPosition); 330 param_message["position"] = ll_sd_from_vector3(im_info->mPosition);
331 if (im_info->mData) param_message["data"] = im_info->mData; 331 param_message["data"] = im_info->mData;
332 param_message["source"]= im_info->mSource;
333 param_message["ttl"] = im_info->mTTL;
334
332 LLSD param_agent; 335 LLSD param_agent;
333 param_agent["agent_id"] = im_info->mFromID; 336 param_agent["agent_id"] = im_info->mFromID;
334 337
335 LLSD params; 338 LLSD params;
336 params.append(param_version); 339 params["version_params"] = param_version;
337 params.append(param_message); 340 params["message_params"] = param_message;
338 params.append(param_agent); 341 params["agent_params"] = param_agent;
339 342
340 return params; 343 return params;
341} 344}
342 345
346LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd)
347{
348 LLSD param_message = im_info_sd["message_params"];
349 LLSD param_agent = im_info_sd["agent_params"];
350
351 LLPointer<LLIMInfo> im_info = new LLIMInfo(
352 param_message["from_id"].asUUID(),
353 param_message["from_group"].asBoolean(),
354 param_message["to_id"].asUUID(),
355 (EInstantMessage) param_message["type"].asInteger(),
356 param_message["from_name"].asString(),
357 param_message["message"].asString(),
358 param_message["id"].asUUID(),
359 (U32) param_message["parent_estate_id"].asInteger(),
360 im_info->mRegionID = param_message["region_id"].asUUID(),
361 ll_vector3_from_sd(param_message["position"]),
362 param_message["data"],
363 (U8) param_message["offline"].asInteger(),
364 (U32) param_message["timestamp"].asInteger(),
365 (EIMSource)param_message["source"].asInteger(),
366 param_message["ttl"].asInteger());
367
368 return im_info;
369}
370
343LLPointer<LLIMInfo> LLIMInfo::clone() 371LLPointer<LLIMInfo> LLIMInfo::clone()
344{ 372{
345 return new LLIMInfo( 373 return new LLIMInfo(
diff --git a/linden/indra/llmessage/llinstantmessage.h b/linden/indra/llmessage/llinstantmessage.h
index 0b2de19..45db037 100644
--- a/linden/indra/llmessage/llinstantmessage.h
+++ b/linden/indra/llmessage/llinstantmessage.h
@@ -94,13 +94,10 @@ enum EInstantMessage
94 // communicate with each other. 94 // communicate with each other.
95 // 95 //
96 96
97 // Add users to a session. 97 // Invite users to a session.
98 IM_SESSION_ADD = 13, 98 IM_SESSION_INVITE = 13,
99 99
100 // IM sent automatically on call for help, 100 IM_SESSION_P2P_INVITE = 14,
101 // sets up a way for each Helper reached to teleport to the
102 // helpee
103 IM_SESSION_911_SEND = 14,
104 101
105 // start a session with your gruop 102 // start a session with your gruop
106 IM_SESSION_GROUP_START = 15, 103 IM_SESSION_GROUP_START = 15,
@@ -112,7 +109,7 @@ enum EInstantMessage
112 IM_SESSION_SEND = 17, 109 IM_SESSION_SEND = 17,
113 110
114 // leave a session 111 // leave a session
115 IM_SESSION_DROP = 18, 112 IM_SESSION_LEAVE = 18,
116 113
117 // an instant message from an object - for differentiation on the 114 // an instant message from an object - for differentiation on the
118 // viewer, since you can't IM an object yet. 115 // viewer, since you can't IM an object yet.
@@ -141,14 +138,6 @@ enum EInstantMessage
141 // bucket. 138 // bucket.
142 IM_GOTO_URL = 28, 139 IM_GOTO_URL = 28,
143 140
144 // IM for help from the GAURDIAN_ANGELS
145 // Binary bucket contains the name of the session.
146 IM_SESSION_911_START = 29,
147
148 // IM for requesting to teleport to the creator
149 // of a livehelp session (assuming they are verified first)
150 IM_TELEPORT_911 = 30,
151
152 // a message generated by a script which we don't want to 141 // a message generated by a script which we don't want to
153 // be sent through e-mail. Similar to IM_FROM_TASK, but 142 // be sent through e-mail. Similar to IM_FROM_TASK, but
154 // it is shown as an alert on the viewer. 143 // it is shown as an alert on the viewer.
@@ -288,6 +277,7 @@ public:
288 S32 mTTL; 277 S32 mTTL;
289}; 278};
290 279
280LLPointer<LLIMInfo> llsd_to_im_info(const LLSD& im_info_sd);
291LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info); 281LLSD im_info_to_llsd(LLPointer<LLIMInfo> im_info);
292 282
293void pack_instant_message( 283void pack_instant_message(
diff --git a/linden/indra/llmessage/llmessageconfig.cpp b/linden/indra/llmessage/llmessageconfig.cpp
index a0566ea..687896b 100644
--- a/linden/indra/llmessage/llmessageconfig.cpp
+++ b/linden/indra/llmessage/llmessageconfig.cpp
@@ -112,9 +112,10 @@ void LLMessageConfigFile::loadServerDefaults(const LLSD& data)
112 112
113void LLMessageConfigFile::loadMessages(const LLSD& data) 113void LLMessageConfigFile::loadMessages(const LLSD& data)
114{ 114{
115 mMessages = data["messages"]; 115 LLPointer<LLSDXMLFormatter> formatter = new LLSDXMLFormatter;
116 std::ostringstream out; 116 std::ostringstream out;
117 LLSDXMLFormatter *formatter = new LLSDXMLFormatter; 117
118 mMessages = data["messages"];
118 formatter->format(mMessages, out); 119 formatter->format(mMessages, out);
119 lldebugs << "loading ... " << out.str() 120 lldebugs << "loading ... " << out.str()
120 << " LLMessageConfigFile::loadMessages loaded " 121 << " LLMessageConfigFile::loadMessages loaded "
diff --git a/linden/indra/llmessage/llregionflags.h b/linden/indra/llmessage/llregionflags.h
index fb9bf5b..8702277 100644
--- a/linden/indra/llmessage/llregionflags.h
+++ b/linden/indra/llmessage/llregionflags.h
@@ -56,7 +56,7 @@ const U32 REGION_FLAGS_BLOCK_LAND_RESELL = (1 << 7);
56 56
57// All content wiped once per night 57// All content wiped once per night
58const U32 REGION_FLAGS_SANDBOX = (1 << 8); 58const U32 REGION_FLAGS_SANDBOX = (1 << 8);
59 59const U32 REGION_FLAGS_NULL_LAYER = (1 << 9);
60const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10); 60const U32 REGION_FLAGS_SKIP_AGENT_ACTION = (1 << 10);
61const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11); 61const U32 REGION_FLAGS_SKIP_UPDATE_INTEREST_LIST= (1 << 11);
62const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies 62const U32 REGION_FLAGS_SKIP_COLLISIONS = (1 << 12); // Pin all non agent rigid bodies
@@ -88,11 +88,14 @@ const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES = (1 << 26);
88 88
89const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27); 89const U32 REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER = (1 << 27);
90 90
91const U32 REGION_FLAGS_NULL_LAYER = (1 << 9); 91const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28);
92
92 93
93const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | 94const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |
94 REGION_FLAGS_ALLOW_SET_HOME | 95 REGION_FLAGS_ALLOW_SET_HOME |
95 REGION_FLAGS_ALLOW_PARCEL_CHANGES; 96 REGION_FLAGS_ALLOW_PARCEL_CHANGES |
97 REGION_FLAGS_ALLOW_VOICE;
98
96 99
97const U32 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; 100const U32 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT;
98const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK 101const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp
index 29f232c..ab41cca 100644
--- a/linden/indra/llmessage/message.cpp
+++ b/linden/indra/llmessage/message.cpp
@@ -1344,12 +1344,17 @@ LLMessageSystem::~LLMessageSystem()
1344 end_net(); 1344 end_net();
1345 } 1345 }
1346 1346
1347 delete mMessageReader; 1347 delete mTemplateMessageReader;
1348 mTemplateMessageReader = NULL;
1348 mMessageReader = NULL; 1349 mMessageReader = NULL;
1349 1350
1350 delete mMessageBuilder; 1351 delete mTemplateMessageBuilder;
1352 mTemplateMessageBuilder = NULL;
1351 mMessageBuilder = NULL; 1353 mMessageBuilder = NULL;
1352 1354
1355 delete mLLSDMessageReader;
1356 mLLSDMessageReader = NULL;
1357
1353 delete mPollInfop; 1358 delete mPollInfop;
1354 mPollInfop = NULL; 1359 mPollInfop = NULL;
1355 1360
@@ -2942,17 +2947,19 @@ static LLHTTPNode& messageRootNode()
2942} 2947}
2943 2948
2944//static 2949//static
2945void LLMessageSystem::dispatch(const std::string& msg_name, 2950void LLMessageSystem::dispatch(
2946 const LLSD& message) 2951 const std::string& msg_name,
2952 const LLSD& message)
2947{ 2953{
2948 LLPointer<LLSimpleResponse> responsep = LLSimpleResponse::create(); 2954 LLPointer<LLSimpleResponse> responsep = LLSimpleResponse::create();
2949 dispatch(msg_name, message, responsep); 2955 dispatch(msg_name, message, responsep);
2950} 2956}
2951 2957
2952//static 2958//static
2953void LLMessageSystem::dispatch(const std::string& msg_name, 2959void LLMessageSystem::dispatch(
2954 const LLSD& message, 2960 const std::string& msg_name,
2955 LLHTTPNode::ResponsePtr responsep) 2961 const LLSD& message,
2962 LLHTTPNode::ResponsePtr responsep)
2956{ 2963{
2957 if (msg_name.empty()) 2964 if (msg_name.empty())
2958 { 2965 {