Avatar picker requests are routed via sim capability

master
James Cook 2010-04-20 14:52:09 -07:00
parent d373dc8782
commit 6d1e44b033
5 changed files with 39 additions and 17 deletions

View File

@ -180,3 +180,8 @@ std::string LLDateUtil::ageFromDateISO(const std::string& date_string)
{
return ageFromDateISO(date_string, LLDate::now());
}
std::string LLDateUtil::ageFromDate(S32 year, S32 month, S32 day)
{
return age_from_date(year, month, day, LLDate::now());
}

View File

@ -50,6 +50,8 @@ namespace LLDateUtil
// Calls the above with LLDate::now()
std::string ageFromDateISO(const std::string& date_string);
std::string ageFromDate(S32 year, S32 month, S32 day);
}
#endif

View File

@ -36,10 +36,12 @@
// Viewer includes
#include "llagent.h"
#include "llcallingcard.h"
#include "lldateutil.h" // IDEVO
#include "lldate.h" // split()
#include "lldateutil.h" // ageFromDate()
#include "llfocusmgr.h"
#include "llfloaterreg.h"
#include "llviewercontrol.h"
#include "llviewerregion.h" // getCapability()
#include "llworld.h"
// Linden libraries
@ -371,12 +373,26 @@ void LLFloaterAvatarPicker::find()
std::string text = childGetValue("Edit").asString();
mQueryID.generate();
// IDEVO
if (LLAvatarNameCache::useDisplayNames())
std::string url;
url.reserve(128); // avoid a memory allocation or two
LLViewerRegion* region = gAgent.getRegion();
url = region->getCapability("AvatarPickerSearch");
// Prefer use of capabilities to search on both SLID and display name
// but allow display name search to be manually turned off for test
if (!url.empty()
&& LLAvatarNameCache::useDisplayNames())
{
std::string url = "http://pdp15.lindenlab.com:8050/my-service/agent/search/";
// capability urls don't end in '/', but we need one to parse
// query parameters correctly
if (url.size() > 0 && url[url.size()-1] != '/')
{
url += "/";
}
url += "?name=";
url += LLURI::escape(text);
url += "/";
llinfos << "JAMESDEBUG picker " << url << llendl;
LLHTTPClient::get(url, new LLAvatarPickerResponder(mQueryID));
}
else
@ -483,7 +499,8 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD&
LLScrollListCtrl* search_results = getChild<LLScrollListCtrl>("SearchResults");
if (content.size() == 0)
LLSD agents = content["agents"];
if (agents.size() == 0)
{
LLStringUtil::format_map_t map;
map["[TEXT]"] = childGetText("Edit");
@ -501,8 +518,8 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD&
search_results->deleteAllItems();
LLSD item;
LLSD::array_const_iterator it = content.beginArray();
for ( ; it != content.endArray(); ++it)
LLSD::array_const_iterator it = agents.beginArray();
for ( ; it != agents.endArray(); ++it)
{
const LLSD& row = *it;
item["id"] = row["agent_id"];
@ -510,12 +527,13 @@ void LLFloaterAvatarPicker::processResponse(const LLUUID& query_id, const LLSD&
columns[0]["column"] = "name";
columns[0]["value"] = row["display_name"];
columns[1]["column"] = "slid";
columns[1]["value"] = row["slid"];
std::string born_on = row["born_on"].asString();
columns[1]["value"] = row["sl_id"];
LLDate account_created = row["account_created"].asDate();
S32 year, month, day;
account_created.split(&year, &month, &day);
std::string age = LLDateUtil::ageFromDate(year, month, day);
columns[2]["column"] = "age";
columns[2]["value"] = LLDateUtil::ageFromDateISO(born_on);
columns[3]["column"] = "profile";
columns[3]["value"] = row["profile"];
columns[2]["value"] = age;
search_results->addElement(item);
}

View File

@ -1466,6 +1466,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
LLSD capabilityNames = LLSD::emptyArray();
capabilityNames.append("AttachmentResources");
capabilityNames.append("AvatarPickerSearch");
capabilityNames.append("ChatSessionRequest");
capabilityNames.append("CopyInventoryFromNotecard");
capabilityNames.append("DispatchRegionInfo");

View File

@ -104,10 +104,6 @@
label="Age"
name="age"
width="100" />
<columns
label="Profile"
name="profile"
width="100" />
</scroll_list>
</panel>
<panel