summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcachename.cpp224
-rw-r--r--indra/llmessage/llcachename.h14
2 files changed, 10 insertions, 228 deletions
diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp
index 3d4f24abc7..21c0e579ac 100644
--- a/indra/llmessage/llcachename.cpp
+++ b/indra/llmessage/llcachename.cpp
@@ -42,8 +42,7 @@
#include "llsdserialize.h"
#include "lluuid.h"
#include "message.h"
-#include "llservicebuilder.h"
-#include "llframetimer.h"
+
// Constants
static const std::string CN_WAITING("(Loading...)"); // *TODO: translate
static const std::string CN_NOBODY("(nobody)"); // *TODO: translate
@@ -198,8 +197,6 @@ class LLCacheName::Impl
public:
LLMessageSystem* mMsg;
LLHost mUpstreamHost;
- std::string mGroupNameURL;
- std::string mAgentNameURL;
Cache mCache;
// the map of UUIDs to names
@@ -225,8 +222,6 @@ public:
void processPendingReplies();
void sendRequest(const char* msg_name, const AskQueue& queue);
bool isRequestPending(const LLUUID& id);
- void getAgentName(const AskQueue&);
- void getGroupName(const AskQueue&);
// Message system callbacks.
void processUUIDRequest(LLMessageSystem* msg, bool isGroup);
@@ -240,35 +235,6 @@ public:
void notifyObservers(const LLUUID& id, const std::string& first, const std::string& last, BOOL group);
};
-class LLHTTPAgentNamesResponse : public LLHTTPClient::Responder
-{
-public:
- LLHTTPAgentNamesResponse(const LLSD& agent_ids)
- : mAgentIDs(agent_ids)
- { }
- void result(const LLSD& content);
-private:
- LLHost mSender;
- LLSD mAgentIDs;
-
-};
-
-class LLHTTPGroupNamesResponse : public LLHTTPClient::Responder
-{
-public:
- LLHTTPGroupNamesResponse(const LLSD& group_ids)
- : mGroupIDs(group_ids)
- { };
-
- void result(const LLSD& content);
-private:
- LLHost mSender;
- LLSD mGroupIDs;
-
-};
-
-
-
/// --------------------------------------------------------------------------
/// class LLCacheName
@@ -354,57 +320,6 @@ void LLCacheName::cancelCallback(const LLUUID& id, LLCacheNameCallback callback,
}
}
-void LLCacheName::sendAgentNames(const LLUUID& id, std::string& first, std::string& last)
-{
-
- LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
- if (!entry)
- {
- entry = new LLCacheNameEntry;
- impl.mCache[id] = entry;
-
- }
- entry->mIsGroup = false;
- entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
- //entry->mFirstName = first;
- //entry->mLastName = last;
- //LLStringUtil::truncate(entry->mFirstName, DB_FIRST_NAME_BUF_SIZE);
- //LLStringUtil::truncate(entry->mLastName, DB_LAST_NAME_BUF_SIZE);
- entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
- entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
-
- impl.mPendingQueue.erase(id);
- impl.notifyObservers(id,
- entry->mFirstName, entry->mLastName,
- FALSE);
-
-}
-
-void LLCacheName::sendGroupNames(const LLUUID& id, std::string& name)
-{
-
- LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id);
- if (!entry)
- {
- entry = new LLCacheNameEntry;
- impl.mCache[id] = entry;
-
- }
-
- entry->mIsGroup = true;
- entry->mCreateTime = (U32)time(NULL);
-
- entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
-
- impl.mPendingQueue.erase(id);
-
- impl.notifyObservers(id,
- entry->mFirstName, entry->mLastName,
- FALSE);
-
-
-}
-
void LLCacheName::importFile(LLFILE* fp)
{
S32 count = 0;
@@ -610,16 +525,6 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
return res;
}
-void LLCacheName::setGroupURL(const std::string& group_url)
-{
- impl.mGroupNameURL = group_url;
-}
-
-void LLCacheName::setAgentURL(const std::string& agent_url)
-{
- impl.mAgentNameURL = agent_url;
-}
-
BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
{
if(id.isNull())
@@ -654,111 +559,6 @@ BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
}
}
-void LLCacheName::Impl::getAgentName(const AskQueue &queue)
-{
-
- // get the names from backbone module
- if(queue.empty())
- {
- return;
- }
-
- LLSD request;
- request["action"] = "GET";
- LLSD id_block = LLSD::emptyArray();
- AskQueue::const_iterator it = queue.begin();
- AskQueue::const_iterator end = queue.end();
- for(;it!=end;++it)
- {
- id_block.append(*it);
- }
- lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(id_block) <<llendl;
-
- request["agents"] = id_block;
-
- LLHTTPClient::post(
- mAgentNameURL,
- request,
- new LLHTTPAgentNamesResponse(id_block));
-
-
- lldebugs<<"Service builder call to agent-name "<<mAgentNameURL<<llendl;
-
-}
-
-void LLHTTPAgentNamesResponse::result(const LLSD& content)
-{
- LLUUID id;
- lldebugs<<LLSDOStreamer<LLSDNotationFormatter>(content) <<llendl;
-
- LLSD::map_const_iterator iter = content.beginMap();
- for ( ; iter != content.endMap(); ++iter)
- {
- id.set((*iter).first);
- LLSD name = (*iter).second;
- LLCacheNameEntry* entry = new LLCacheNameEntry;
- entry->mIsGroup = FALSE;
- entry->mCreateTime = (U32)LLFrameTimer::getTotalSeconds();
- std::string first = name["first"];
- std::string last = name["last"];
- entry->mFirstName = std::string(first, DB_FIRST_NAME_BUF_SIZE);
- entry->mLastName = std::string(last, DB_LAST_NAME_BUF_SIZE);
-
- gCacheName->sendAgentNames(id,first,last);
- }
-}
-
-
-void LLCacheName::Impl::getGroupName(const AskQueue &queue)
-{
- // get the group names from backbone module
- if(queue.empty())
- {
- return;
- }
-
- LLSD request;
- request["action"] = "GET";
- LLSD id_block = LLSD::emptyArray();
- AskQueue::const_iterator it = queue.begin();
- AskQueue::const_iterator end = queue.end();
- for(;it!=end;++it)
- {
- id_block.append(*it);
- }
-
- request["groups"] = id_block;
-
- if(!mGroupNameURL.empty())
- {
- LLHTTPClient::post(
- mGroupNameURL,
- request,
- new LLHTTPGroupNamesResponse(id_block));
- }
- lldebugs<<"Service builder call to group-name "<< mGroupNameURL<<llendl;
-}
-
-void LLHTTPGroupNamesResponse::result(const LLSD& content)
-{
- lldebugs<<"Result"<<LLSDOStreamer<LLSDNotationFormatter>(content) << llendl;
- LLUUID id;
-
- LLSD::map_const_iterator iter = content.beginMap();
- for ( ; iter != content.endMap(); ++iter)
- {
-
- id.set((*iter).first);
- std::string name = (*iter).second.asString();
- LLCacheNameEntry* entry = new LLCacheNameEntry;
- entry->mIsGroup = TRUE;
- entry->mCreateTime = (U32)time(NULL);
- entry->mGroupName = std::string(name, DB_GROUP_NAME_BUF_SIZE);
- lldebugs<<"Group Name"<<name<<llendl;
- gCacheName->sendGroupNames(id,name);
- }
-}
-
// TODO: Make the cache name callback take a SINGLE std::string,
// not a separate first and last name.
void LLCacheName::get(const LLUUID& id, BOOL is_group, LLCacheNameCallback callback, void* user_data)
@@ -807,14 +607,12 @@ void LLCacheName::processPending()
return;
}
- /*
if(!impl.mUpstreamHost.isOk())
{
lldebugs << "LLCacheName::processPending() - bad upstream host."
<< llendl;
return;
}
- */
impl.processPendingAsks();
impl.processPendingReplies();
@@ -896,16 +694,8 @@ std::string LLCacheName::getDefaultName()
void LLCacheName::Impl::processPendingAsks()
{
- if (mUpstreamHost.isOk()) //its the vuewer asking for names send request to simulator
- {
- sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
- sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue);
- }
- else //its simulator asking for names ask the backbone
- {
- getAgentName(mAskNameQueue);
- getGroupName(mAskGroupQueue);
- }
+ sendRequest(_PREHASH_UUIDNameRequest, mAskNameQueue);
+ sendRequest(_PREHASH_UUIDGroupNameRequest, mAskGroupQueue);
mAskNameQueue.clear();
mAskGroupQueue.clear();
}
@@ -1026,15 +816,12 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup)
{
// You should only get this message if the cache is at the simulator
// level, hence having an upstream provider.
- // 03/31/2008 Simulator is talking to backbone and not dataserver
- // This check was for dataserver
- /*
if (!mUpstreamHost.isOk())
{
llwarns << "LLCacheName - got UUID name/group request, but no upstream provider!" << llendl;
return;
}
- */
+
LLHost fromHost = msg->getSender();
ReplySender sender(msg);
@@ -1105,8 +892,9 @@ void LLCacheName::Impl::processUUIDReply(LLMessageSystem* msg, bool isGroup)
msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_LastName, entry->mLastName, i);
}
else
- {
+ { // is group
msg->getStringFast(_PREHASH_UUIDNameBlock, _PREHASH_GroupName, entry->mGroupName, i);
+ LLStringFn::replace_nonprintable(entry->mGroupName, LL_UNKNOWN_CHAR);
}
if (!isGroup)
diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h
index 31af5e6240..2757b86a7c 100644
--- a/indra/llmessage/llcachename.h
+++ b/indra/llmessage/llcachename.h
@@ -32,9 +32,7 @@
#ifndef LL_LLCACHENAME_H
#define LL_LLCACHENAME_H
-#include "llhttpclient.h"
-#include "llhost.h"
-#include "lluri.h"
+
class LLMessageSystem;
class LLHost;
class LLUUID;
@@ -100,15 +98,10 @@ public:
// This method needs to be called from time to time to send out
// requests.
void processPending();
- void setAgentURL(const std::string& url);
- void setGroupURL(const std::string& url);
-
+
// Expire entries created more than "secs" seconds ago.
void deleteEntriesOlderThan(S32 secs);
- //send the information retrived from backbone
- void sendAgentNames(const LLUUID& id, std::string& first, std::string& last);
- void sendGroupNames(const LLUUID& id, std::string& name);
// Debugging
void dump(); // Dumps the contents of the cache
void dumpStats(); // Dumps the sizes of the cache and associated queues.
@@ -119,9 +112,10 @@ private:
class Impl;
Impl& impl;
-
};
+
+
extern LLCacheName* gCacheName;
#endif