summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2023-10-24 00:14:21 +0300
committerakleshchev <117672381+akleshchev@users.noreply.github.com>2023-10-25 19:13:21 +0300
commitf54d0329f32081883704cc2694871600f896006b (patch)
treed07b710d11e2f69402ee17fc8ff761aed16d670e /indra
parentd4087fce7b36625259576d5964c5a8dd8e93d707 (diff)
SL-20513 Cleanup LLAvatarPropertiesProcessor #2
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llagentpicksinfo.cpp12
-rw-r--r--indra/newview/llagentpicksinfo.h4
-rw-r--r--indra/newview/llavatarpropertiesprocessor.cpp183
-rw-r--r--indra/newview/llavatarpropertiesprocessor.h21
-rw-r--r--indra/newview/llpanelprofile.cpp25
-rw-r--r--indra/newview/llpanelprofilepicks.cpp12
-rw-r--r--indra/newview/llpanelprofilepicks.h2
-rw-r--r--indra/newview/llstartup.cpp4
8 files changed, 105 insertions, 158 deletions
diff --git a/indra/newview/llagentpicksinfo.cpp b/indra/newview/llagentpicksinfo.cpp
index 799060eeab..0b72f1ee4d 100644
--- a/indra/newview/llagentpicksinfo.cpp
+++ b/indra/newview/llagentpicksinfo.cpp
@@ -49,10 +49,10 @@ public:
void sendAgentPicksRequest()
{
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(gAgent.getID());
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(gAgent.getID());
}
- typedef boost::function<void(LLAvatarPicks*)> server_respond_callback_t;
+ typedef boost::function<void(LLAvatarData*)> server_respond_callback_t;
void setServerRespondCallback(const server_respond_callback_t& cb)
{
@@ -61,10 +61,10 @@ public:
virtual void processProperties(void* data, EAvatarProcessorType type)
{
- if(APT_PICKS == type)
+ if(APT_PROPERTIES == type)
{
- LLAvatarPicks* picks = static_cast<LLAvatarPicks*>(data);
- if(picks && gAgent.getID() == picks->target_id)
+ LLAvatarData* picks = static_cast<LLAvatarData*>(data);
+ if(picks && gAgent.getID() == picks->avatar_id)
{
if(mServerRespondCallback)
{
@@ -115,7 +115,7 @@ bool LLAgentPicksInfo::isPickLimitReached()
return getNumberOfPicks() >= getMaxNumberOfPicks();
}
-void LLAgentPicksInfo::onServerRespond(LLAvatarPicks* picks)
+void LLAgentPicksInfo::onServerRespond(LLAvatarData* picks)
{
if(!picks)
{
diff --git a/indra/newview/llagentpicksinfo.h b/indra/newview/llagentpicksinfo.h
index 21df036cb7..56e7bd0775 100644
--- a/indra/newview/llagentpicksinfo.h
+++ b/indra/newview/llagentpicksinfo.h
@@ -29,7 +29,7 @@
#include "llsingleton.h"
-struct LLAvatarPicks;
+struct LLAvatarData;
/**
* Class that provides information about Agent Picks
@@ -74,7 +74,7 @@ public:
void decrementNumberOfPicks() { --mNumberOfPicks; }
- void onServerRespond(LLAvatarPicks* picks);
+ void onServerRespond(LLAvatarData* picks);
private:
diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp
index 472cf8b8d5..5b28e9f4c6 100644
--- a/indra/newview/llavatarpropertiesprocessor.cpp
+++ b/indra/newview/llavatarpropertiesprocessor.cpp
@@ -115,20 +115,19 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr
}
// Try to send HTTP request if cap_url is available
- if (type == APT_PROPERTIES || type == APT_PICKS)
+ if (type == APT_PROPERTIES)
{
- if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty())
+ std::string cap_url = gAgent.getRegionCapability("AgentProfile");
+ if (!cap_url.empty())
{
initAgentProfileCapRequest(avatar_id, cap_url, type);
- return;
}
-
- // Don't sent UDP request for APT_PROPERTIES
- if (type == APT_PROPERTIES)
+ else
{
- LL_WARNS() << "No cap_url for APT_PROPERTIES, request is not sent" << LL_ENDL;
- return;
+ // Don't sent UDP request for APT_PROPERTIES
+ LL_WARNS() << "No cap_url for APT_PROPERTIES, request for " << avatar_id << " is not sent" << LL_ENDL;
}
+ return;
}
// Send UDP request
@@ -182,11 +181,6 @@ void LLAvatarPropertiesProcessor::sendAvatarLegacyPropertiesRequest(const LLUUID
sendRequest(avatar_id, APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest");
}
-void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id)
-{
- sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest");
-}
-
void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id)
{
sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest");
@@ -300,90 +294,80 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur
return;
}
- if (type == APT_PROPERTIES)
+ LLAvatarData avatar_data;
+
+ std::string birth_date;
+
+ avatar_data.agent_id = gAgentID;
+ avatar_data.avatar_id = avatar_id;
+ avatar_data.image_id = result["sl_image_id"].asUUID();
+ avatar_data.fl_image_id = result["fl_image_id"].asUUID();
+ avatar_data.partner_id = result["partner_id"].asUUID();
+ avatar_data.about_text = result["sl_about_text"].asString();
+ avatar_data.fl_about_text = result["fl_about_text"].asString();
+ avatar_data.born_on = result["member_since"].asDate();
+ // TODO: SL-20163 Remove the "has" check when SRV-684 is done
+ // and the field "hide_age" is included to the http response
+ avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean();
+ avatar_data.profile_url = getProfileURL(avatar_id.asString());
+ avatar_data.customer_type = result["customer_type"].asString();
+ avatar_data.notes = result["notes"].asString();
+
+ avatar_data.flags = 0;
+ if (result["online"].asBoolean())
{
- LLAvatarData avatar_data;
-
- std::string birth_date;
-
- avatar_data.agent_id = gAgentID;
- avatar_data.avatar_id = avatar_id;
- avatar_data.image_id = result["sl_image_id"].asUUID();
- avatar_data.fl_image_id = result["fl_image_id"].asUUID();
- avatar_data.partner_id = result["partner_id"].asUUID();
- avatar_data.about_text = result["sl_about_text"].asString();
- avatar_data.fl_about_text = result["fl_about_text"].asString();
- avatar_data.born_on = result["member_since"].asDate();
- // TODO: SL-20163 Remove the "has" check when SRV-684 is done
- // and the field "hide_age" is included to the http response
- avatar_data.hide_age = !result.has("hide_age") || result["hide_age"].asBoolean();
- avatar_data.profile_url = getProfileURL(avatar_id.asString());
- avatar_data.customer_type = result["customer_type"].asString();
- avatar_data.notes = result["notes"].asString();
-
- avatar_data.flags = 0;
- if (result["online"].asBoolean())
- {
- avatar_data.flags |= AVATAR_ONLINE;
- }
- if (result["allow_publish"].asBoolean())
- {
- avatar_data.flags |= AVATAR_ALLOW_PUBLISH;
- }
- if (result["identified"].asBoolean())
- {
- avatar_data.flags |= AVATAR_IDENTIFIED;
- }
- if (result["transacted"].asBoolean())
- {
- avatar_data.flags |= AVATAR_TRANSACTED;
- }
-
- avatar_data.caption_index = 0;
- if (result.has("charter_member")) // won't be present if "caption" is set
- {
- avatar_data.caption_index = result["charter_member"].asInteger();
- }
- else if (result.has("caption"))
- {
- avatar_data.caption_text = result["caption"].asString();
- }
-
- LLSD groups_array = result["groups"];
- for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it)
- {
- const LLSD& group_info = *it;
- LLAvatarData::LLGroupData group_data;
- group_data.group_powers = 0; // Not in use?
- group_data.group_title = group_info["name"].asString(); // Missing data, not in use?
- group_data.group_id = group_info["id"].asUUID();
- group_data.group_name = group_info["name"].asString();
- group_data.group_insignia_id = group_info["image_id"].asUUID();
-
- avatar_data.group_list.push_back(group_data);
- }
-
- getInstance()->notifyObservers(avatar_id, &avatar_data, type);
+ avatar_data.flags |= AVATAR_ONLINE;
+ }
+ if (result["allow_publish"].asBoolean())
+ {
+ avatar_data.flags |= AVATAR_ALLOW_PUBLISH;
+ }
+ if (result["identified"].asBoolean())
+ {
+ avatar_data.flags |= AVATAR_IDENTIFIED;
}
- else if (type == APT_PICKS)
+ if (result["transacted"].asBoolean())
{
- LLAvatarPicks avatar_picks;
+ avatar_data.flags |= AVATAR_TRANSACTED;
+ }
- avatar_picks.agent_id = gAgentID; // Not in use?
- avatar_picks.target_id = avatar_id;
+ avatar_data.caption_index = 0;
+ if (result.has("charter_member")) // won't be present if "caption" is set
+ {
+ avatar_data.caption_index = result["charter_member"].asInteger();
+ }
+ else if (result.has("caption"))
+ {
+ avatar_data.caption_text = result["caption"].asString();
+ }
- LLSD picks_array = result["picks"];
- for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it)
- {
- const LLSD& pick_data = *it;
- avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString());
- }
+ // Groups
+ LLSD groups_array = result["groups"];
+ for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it)
+ {
+ const LLSD& group_info = *it;
+ LLAvatarData::LLGroupData group_data;
+ group_data.group_powers = 0; // Not in use?
+ group_data.group_title = group_info["name"].asString(); // Missing data, not in use?
+ group_data.group_id = group_info["id"].asUUID();
+ group_data.group_name = group_info["name"].asString();
+ group_data.group_insignia_id = group_info["image_id"].asUUID();
+
+ avatar_data.group_list.push_back(group_data);
+ }
- getInstance()->notifyObservers(avatar_id, &avatar_picks, type);
+ // Picks
+ LLSD picks_array = result["picks"];
+ for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it)
+ {
+ const LLSD& pick_data = *it;
+ avatar_data.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString());
}
+
+ getInstance()->notifyObservers(avatar_id, &avatar_data, type);
}
-void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**)
+void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**)
{
LLAvatarData avatar_data;
std::string birth_date;
@@ -473,29 +457,6 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms
self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO);
}
-void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**)
-{
- LLAvatarPicks avatar_picks;
- msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_picks.agent_id);
- msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, avatar_picks.target_id);
-
- S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data);
- for (int block = 0; block < block_count; ++block)
- {
- LLUUID pick_id;
- std::string pick_name;
-
- msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block);
- msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block);
-
- avatar_picks.picks_list.emplace_back(pick_id, pick_name);
- }
- LLAvatarPropertiesProcessor* self = getInstance();
- // Request processed, no longer pending
- self->removePendingRequest(avatar_picks.target_id, APT_PICKS);
- self->notifyObservers(avatar_picks.target_id,&avatar_picks,APT_PICKS);
-}
-
void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, void**)
{
LLPickData pick_data;
diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h
index 2bf8e879bd..1bf07704a9 100644
--- a/indra/newview/llavatarpropertiesprocessor.h
+++ b/indra/newview/llavatarpropertiesprocessor.h
@@ -52,7 +52,6 @@ enum EAvatarProcessorType
{
APT_PROPERTIES_LEGACY, // APT_PROPERTIES via udp request (Truncates data!!!)
APT_PROPERTIES, // APT_PROPERTIES via http request
- APT_PICKS,
APT_PICK_INFO,
APT_TEXTURES,
APT_CLASSIFIEDS,
@@ -102,6 +101,10 @@ struct LLAvatarData
struct LLGroupData;
typedef std::list<LLGroupData> group_list_t;
group_list_t group_list;
+
+ typedef std::pair<LLUUID, std::string> pick_data_t;
+ typedef std::list< pick_data_t> picks_list_t;
+ picks_list_t picks_list;
};
struct LLAvatarData::LLGroupData
@@ -114,16 +117,6 @@ struct LLAvatarData::LLGroupData
LLUUID group_insignia_id;
};
-struct LLAvatarPicks
-{
- LLUUID agent_id;
- LLUUID target_id; //target id
-
- typedef std::pair<LLUUID,std::string> pick_data_t;
- typedef std::list< pick_data_t> picks_list_t;
- picks_list_t picks_list;
-};
-
struct LLPickData
{
LLUUID agent_id;
@@ -206,7 +199,6 @@ public:
// suppressed while waiting for a response from the network.
void sendAvatarPropertiesRequest(const LLUUID& avatar_id);
void sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id);
- void sendAvatarPicksRequest(const LLUUID& avatar_id);
void sendAvatarTexturesRequest(const LLUUID& avatar_id);
void sendAvatarClassifiedsRequest(const LLUUID& avatar_id);
@@ -238,14 +230,13 @@ public:
static void requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type);
- static void processAvatarPropertiesReply(LLMessageSystem* msg, void**);
+ // Processing of UDP variant of properties, truncates certain fields!
+ static void processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**);
static void processAvatarClassifiedsReply(LLMessageSystem* msg, void**);
static void processClassifiedInfoReply(LLMessageSystem* msg, void**);
- static void processAvatarPicksReply(LLMessageSystem* msg, void**);
-
static void processPickInfoReply(LLMessageSystem* msg, void**);
protected:
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index ba5f6e2e09..7cd58ff6f4 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -211,6 +211,15 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
avatar_data->group_list.push_back(group_data);
}
+ // Picks
+ LLSD picks_array = result["picks"];
+
+ for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it)
+ {
+ const LLSD& pick_data = *it;
+ avatar_data->picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString());
+ }
+
panel = floater_profile->findChild<LLPanel>(PANEL_SECONDLIFE, TRUE);
LLPanelProfileSecondLife *panel_sl = dynamic_cast<LLPanelProfileSecondLife*>(panel);
if (panel_sl)
@@ -239,25 +248,13 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id)
panel_notes->processProperties(avatar_data);
}
- // Picks
- LLSD picks_array = result["picks"];
- LLAvatarPicks avatar_picks;
- avatar_picks.agent_id = agent_id; // Not in use?
- avatar_picks.target_id = agent_id;
-
- for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it)
- {
- const LLSD& pick_data = *it;
- avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString());
- }
-
panel = floater_profile->findChild<LLPanel>(PANEL_PICKS, TRUE);
LLPanelProfilePicks *panel_picks = dynamic_cast<LLPanelProfilePicks*>(panel);
if (panel_picks)
{
// Refresh pick limit before processing
- LLAgentPicksInfo::getInstance()->onServerRespond(&avatar_picks);
- panel_picks->processProperties(&avatar_picks);
+ LLAgentPicksInfo::getInstance()->onServerRespond(avatar_data);
+ panel_picks->processProperties(avatar_data);
}
}
diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp
index fa42199089..f49ed2d644 100644
--- a/indra/newview/llpanelprofilepicks.cpp
+++ b/indra/newview/llpanelprofilepicks.cpp
@@ -289,17 +289,17 @@ void LLPanelProfilePicks::callbackDeletePick(const LLSD& notification, const LLS
void LLPanelProfilePicks::processProperties(void* data, EAvatarProcessorType type)
{
- if (APT_PICKS == type)
+ if (APT_PROPERTIES == type)
{
- LLAvatarPicks* avatar_picks = static_cast<LLAvatarPicks*>(data);
- if (avatar_picks && getAvatarId() == avatar_picks->target_id)
+ LLAvatarData* avatar_picks = static_cast<LLAvatarData*>(data);
+ if (avatar_picks && getAvatarId() == avatar_picks->avatar_id)
{
processProperties(avatar_picks);
}
}
}
-void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks)
+void LLPanelProfilePicks::processProperties(const LLAvatarData* avatar_picks)
{
LLUUID selected_id = mPickToSelectOnLoad;
bool has_selection = false;
@@ -317,7 +317,7 @@ void LLPanelProfilePicks::processProperties(const LLAvatarPicks* avatar_picks)
mTabContainer->deleteAllTabs();
- LLAvatarPicks::picks_list_t::const_iterator it = avatar_picks->picks_list.begin();
+ LLAvatarData::picks_list_t::const_iterator it = avatar_picks->picks_list.begin();
for (; avatar_picks->picks_list.end() != it; ++it)
{
LLUUID pick_id = it->first;
@@ -421,7 +421,7 @@ void LLPanelProfilePicks::updateData()
{
setIsLoading();
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(avatar_id);
+ LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(avatar_id);
}
if (!getIsLoaded())
{
diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h
index f84463cc9b..fc29a9de0f 100644
--- a/indra/newview/llpanelprofilepicks.h
+++ b/indra/newview/llpanelprofilepicks.h
@@ -58,7 +58,7 @@ public:
void selectPick(const LLUUID& pick_id);
void processProperties(void* data, EAvatarProcessorType type) override;
- void processProperties(const LLAvatarPicks* avatar_picks);
+ void processProperties(const LLAvatarData* avatar_picks);
void resetData() override;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index cccd16a77e..916848ff5f 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2656,9 +2656,7 @@ void register_viewer_callbacks(LLMessageSystem* msg)
LLViewerParcelMgr::processParcelDwellReply);
msg->setHandlerFunc("AvatarPropertiesReply",
- &LLAvatarPropertiesProcessor::processAvatarPropertiesReply);
- msg->setHandlerFunc("AvatarPicksReply",
- &LLAvatarPropertiesProcessor::processAvatarPicksReply);
+ &LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply);
msg->setHandlerFunc("AvatarClassifiedReply",
&LLAvatarPropertiesProcessor::processAvatarClassifiedsReply);