From 96e459256410cd18f1506f7e0b2118955ea65b81 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Sat, 14 Oct 2023 01:24:39 +0200 Subject: SL-20163 Delete LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate --- indra/newview/llavatarpropertiesprocessor.cpp | 36 --------------------------- 1 file changed, 36 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index dd0d06a8c8..1d08e158af 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -211,42 +211,6 @@ void LLAvatarPropertiesProcessor::sendAvatarClassifiedsRequest(const LLUUID& ava sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest"); } -void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props) -{ - if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null)) - { - LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL; - return; - } - - LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL; - - // This value is required by sendAvatarPropertiesUpdate method. - //A profile should never be mature. (From the original code) - BOOL mature = FALSE; - - LLMessageSystem *msg = gMessageSystem; - - msg->newMessageFast (_PREHASH_AvatarPropertiesUpdate); - msg->nextBlockFast (_PREHASH_AgentData); - msg->addUUIDFast (_PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast (_PREHASH_SessionID, gAgent.getSessionID() ); - msg->nextBlockFast (_PREHASH_PropertiesData); - - msg->addUUIDFast (_PREHASH_ImageID, avatar_props->image_id); - msg->addUUIDFast (_PREHASH_FLImageID, avatar_props->fl_image_id); - msg->addStringFast (_PREHASH_AboutText, avatar_props->about_text); - msg->addStringFast (_PREHASH_FLAboutText, avatar_props->fl_about_text); - - msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish); - msg->addBOOL(_PREHASH_MaturePublish, mature); - msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url); - - gAgent.sendReliableMessage(); -} - - - //static std::string LLAvatarPropertiesProcessor::accountType(const LLAvatarData* avatar_data) { -- cgit v1.2.3 From 633865320aee0b2e1c615f2d5a772e5ddc3d9ae2 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 17 Oct 2023 12:01:03 +0200 Subject: SL-20163 Rename hide_sl_age to hide_age --- indra/newview/llavatarpropertiesprocessor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 1d08e158af..f43ada7abc 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -298,7 +298,10 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur || !result.has("id") || agent_id != result["id"].asUUID()) { - LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << agent_id << LL_ENDL; + LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << agent_id + << (!status ? " (no HTTP status)" : !result.has("id") ? " (no result.id)" : + std::string(" (result.id=") + result["id"].asUUID().asString() + ")") + << LL_ENDL; LLAvatarPropertiesProcessor* self = getInstance(); self->removePendingRequest(agent_id, APT_PROPERTIES); self->removePendingRequest(agent_id, APT_PICKS); @@ -320,6 +323,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur 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(); + avatar_data.hide_age = result["hide_age"].asBoolean(); avatar_data.profile_url = getProfileURL(agent_id.asString()); avatar_data.flags = 0; -- cgit v1.2.3 From bae25942a7bee6540c252b0a449a0882859c8822 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 14 Oct 2023 02:38:49 +0300 Subject: SL-20163 Fix missing flags Just in case, this is not fully in use yet, mostly because requests for avatar icons will become very heavy due all that additional info --- indra/newview/llavatarpropertiesprocessor.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index f43ada7abc..11609affcf 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -325,9 +325,35 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.born_on = result["member_since"].asDate(); avatar_data.hide_age = result["hide_age"].asBoolean(); avatar_data.profile_url = getProfileURL(agent_id.asString()); + avatar_data.customer_type = result["customer_type"].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(); + } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending -- cgit v1.2.3 From 537cb9117125f621f34b4d44e3f16a9c8c30313c Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 19 Oct 2023 20:44:58 +0200 Subject: SL-20163 Rework add/remove observers in LLAvatarPropertiesProcessor --- indra/newview/llavatarpropertiesprocessor.cpp | 48 +++++++++++++-------------- 1 file changed, 23 insertions(+), 25 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 11609affcf..cc5fa949af 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -52,24 +52,23 @@ LLAvatarPropertiesProcessor::~LLAvatarPropertiesProcessor() void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) { + if (!observer) + return; + // Check if that observer is already in mObservers for that avatar_id - observer_multimap_t::iterator it; + using pair = std::pair; + observer_multimap_t::iterator begin = mObservers.begin(); + observer_multimap_t::iterator end = mObservers.end(); + observer_multimap_t::iterator it = std::find_if(begin, end, [&](const pair& p) + { + return p.first == avatar_id && p.second == observer; + }); // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE - it = mObservers.find(avatar_id); - while (it != mObservers.end()) + if (it == end) { - if (it->second == observer) - { - return; - } - else - { - ++it; - } + mObservers.insert(pair(avatar_id, observer)); } - - mObservers.insert(std::pair(avatar_id, observer)); } void LLAvatarPropertiesProcessor::removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) @@ -79,19 +78,18 @@ void LLAvatarPropertiesProcessor::removeObserver(const LLUUID& avatar_id, LLAvat return; } - observer_multimap_t::iterator it; - it = mObservers.find(avatar_id); - while (it != mObservers.end()) - { - if (it->second == observer) - { - mObservers.erase(it); - break; - } - else + // Check if that observer is in mObservers for that avatar_id + using pair = std::pair; + observer_multimap_t::iterator begin = mObservers.begin(); + observer_multimap_t::iterator end = mObservers.end(); + observer_multimap_t::iterator it = std::find_if(begin, end, [&](const pair& p) { - ++it; - } + return p.first == avatar_id && p.second == observer; + }); + + if (it != end) + { + mObservers.erase(it); } } -- cgit v1.2.3 From b83b4e08482fc2d1aa635aa20a9ffadf21fa17bc Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 19 Oct 2023 20:58:35 +0200 Subject: SL-20163 Rework hide_age in processAvatarPropertiesReply() --- indra/newview/llavatarpropertiesprocessor.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index cc5fa949af..8be5d370b3 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -426,24 +426,25 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url); msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); - LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); + // Since field 'hide_age' is not supported by msg system we'd better hide the age here + avatar_data.hide_age = TRUE; avatar_data.caption_index = 0; S32 charter_member_size = 0; charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember); - if(1 == charter_member_size) + if (1 == charter_member_size) { msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1); } - else if(1 < charter_member_size) + else if (1 < charter_member_size) { msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text); } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES); - self->notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES); + self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES); } void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) @@ -619,7 +620,7 @@ void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); } -void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type) +void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, EAvatarProcessorType type) { // Copy the map (because observers may delete themselves when updated?) LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers; @@ -633,7 +634,7 @@ void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id,void* data, E const LLUUID &agent_id = oi->first; if (agent_id == id || agent_id.isNull()) { - oi->second->processProperties(data,type); + oi->second->processProperties(data, type); } } } -- cgit v1.2.3 From 702e4c7dc1a383f83a0324e97b087efef82e9248 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Thu, 19 Oct 2023 18:25:23 +0200 Subject: SL-20163 Rework LLAvatarPropertiesProcessor::sendRequest() --- indra/newview/llavatarpropertiesprocessor.cpp | 240 +++++++++++++------------- 1 file changed, 117 insertions(+), 123 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 8be5d370b3..9d3bc7cabe 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -114,32 +114,32 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr return; } - std::string cap; - - switch (type) + // Try to send HTTP request if cap_url is available + if (type == APT_PROPERTIES || type == APT_PICKS || type == APT_GROUPS || type == APT_NOTES) { - case APT_PROPERTIES: - // indicate we're going to make a request - sendAvatarPropertiesRequestMessage(avatar_id); - // can use getRegionCapability("AgentProfile"), but it is heavy - // initAgentProfileCapRequest(avatar_id, cap); - break; - case APT_PICKS: - case APT_GROUPS: - case APT_NOTES: - if (cap.empty()) + std::string cap_url(gAgent.getRegionCapability("AgentProfile")); + if (!cap_url.empty()) { - // indicate we're going to make a request - sendGenericRequest(avatar_id, type, method); + initAgentProfileCapRequest(avatar_id, cap_url, type); + return; } - else + + // Don't sent UDP request for APT_PROPERTIES + if (type == APT_PROPERTIES) { - initAgentProfileCapRequest(avatar_id, cap); + LL_WARNS() << "No cap_url for APT_PROPERTIES, request is not sent" << LL_ENDL; + return; } - break; - default: + } + + // Send UDP request + if (type == APT_PROPERTIES_LEGACY) + { + sendAvatarPropertiesRequestMessage(avatar_id); + } + else + { sendGenericRequest(avatar_id, type, method); - break; } } @@ -155,7 +155,7 @@ void LLAvatarPropertiesProcessor::sendGenericRequest(const LLUUID& avatar_id, EA void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequestMessage(const LLUUID& avatar_id) { - addPendingRequest(avatar_id, APT_PROPERTIES); + addPendingRequest(avatar_id, APT_PROPERTIES_LEGACY); LLMessageSystem *msg = gMessageSystem; @@ -167,19 +167,16 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequestMessage(const LLUUI gAgent.sendReliableMessage(); } -void LLAvatarPropertiesProcessor::initAgentProfileCapRequest(const LLUUID& avatar_id, const std::string& cap_url) +void LLAvatarPropertiesProcessor::initAgentProfileCapRequest(const LLUUID& avatar_id, const std::string& cap_url, EAvatarProcessorType type) { - addPendingRequest(avatar_id, APT_PROPERTIES); - addPendingRequest(avatar_id, APT_PICKS); - addPendingRequest(avatar_id, APT_GROUPS); - addPendingRequest(avatar_id, APT_NOTES); + addPendingRequest(avatar_id, type); LLCoros::instance().launch("requestAgentUserInfoCoro", - boost::bind(requestAvatarPropertiesCoro, cap_url, avatar_id)); + [cap_url, avatar_id, type]() { requestAvatarPropertiesCoro(cap_url, avatar_id, type); }); } -void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id) +void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id, bool use_cap) { - sendRequest(avatar_id, APT_PROPERTIES, "AvatarPropertiesRequest"); + sendRequest(avatar_id, use_cap ? APT_PROPERTIES : APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); } void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id) @@ -274,7 +271,7 @@ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avata } // static -void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id) +void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id, EAvatarProcessorType type) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -289,6 +286,9 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); + // Response is being processed, no longer pending is required + getInstance()->removePendingRequest(agent_id, type); + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -300,114 +300,108 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur << (!status ? " (no HTTP status)" : !result.has("id") ? " (no result.id)" : std::string(" (result.id=") + result["id"].asUUID().asString() + ")") << LL_ENDL; - LLAvatarPropertiesProcessor* self = getInstance(); - self->removePendingRequest(agent_id, APT_PROPERTIES); - self->removePendingRequest(agent_id, APT_PICKS); - self->removePendingRequest(agent_id, APT_GROUPS); - self->removePendingRequest(agent_id, APT_NOTES); return; } - // Avatar Data - - LLAvatarData avatar_data; - std::string birth_date; - - avatar_data.agent_id = agent_id; - avatar_data.avatar_id = agent_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(); - avatar_data.hide_age = result["hide_age"].asBoolean(); - avatar_data.profile_url = getProfileURL(agent_id.asString()); - avatar_data.customer_type = result["customer_type"].asString(); - - avatar_data.flags = 0; - if (result["online"].asBoolean()) - { - avatar_data.flags |= AVATAR_ONLINE; - } - if (result["allow_publish"].asBoolean()) + if (type == APT_PROPERTIES) { - avatar_data.flags |= AVATAR_ALLOW_PUBLISH; - } - if (result["identified"].asBoolean()) - { - avatar_data.flags |= AVATAR_IDENTIFIED; - } - if (result["transacted"].asBoolean()) - { - avatar_data.flags |= AVATAR_TRANSACTED; - } + LLAvatarData avatar_data; + + std::string birth_date; + + avatar_data.agent_id = agent_id; + avatar_data.avatar_id = agent_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(agent_id.asString()); + avatar_data.customer_type = result["customer_type"].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(); + 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(); + } + + getInstance()->notifyObservers(agent_id, &avatar_data, type); } - else if (result.has("caption")) + else if (type == APT_PICKS) { - avatar_data.caption_text = result["caption"].asString(); - } - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(agent_id, APT_PROPERTIES); - self->notifyObservers(agent_id, &avatar_data, APT_PROPERTIES); + LLAvatarPicks avatar_picks; - // Picks + avatar_picks.agent_id = agent_id; // Not in use? + avatar_picks.target_id = agent_id; - LLSD picks_array = result["picks"]; - LLAvatarPicks avatar_picks; - avatar_picks.agent_id = agent_id; // Not in use? - avatar_picks.target_id = agent_id; + 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()); + } - 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()); + getInstance()->notifyObservers(agent_id, &avatar_picks, type); } + else if (type == APT_GROUPS) + { + LLAvatarGroups avatar_groups; - // Request processed, no longer pending - self->removePendingRequest(agent_id, APT_PICKS); - self->notifyObservers(agent_id, &avatar_picks, APT_PICKS); - - // Groups + avatar_groups.agent_id = agent_id; // Not in use? + avatar_groups.avatar_id = agent_id; // target_id - LLSD groups_array = result["groups"]; - LLAvatarGroups avatar_groups; - avatar_groups.agent_id = agent_id; // Not in use? - avatar_groups.avatar_id = agent_id; // target_id + LLSD groups_array = result["groups"]; + for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) + { + const LLSD& group_info = *it; + LLAvatarGroups::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_groups.group_list.push_back(group_data); + } - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarGroups::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_groups.group_list.push_back(group_data); + getInstance()->notifyObservers(agent_id, &avatar_groups, type); } + else if (type == APT_NOTES) + { + LLAvatarNotes avatar_notes; - self->removePendingRequest(agent_id, APT_GROUPS); - self->notifyObservers(agent_id, &avatar_groups, APT_GROUPS); - - // Notes - LLAvatarNotes avatar_notes; - - avatar_notes.agent_id = agent_id; - avatar_notes.target_id = agent_id; - avatar_notes.notes = result["notes"].asString(); + avatar_notes.agent_id = agent_id; + avatar_notes.target_id = agent_id; + avatar_notes.notes = result["notes"].asString(); - // Request processed, no longer pending - self->removePendingRequest(agent_id, APT_NOTES); - self->notifyObservers(agent_id, &avatar_notes, APT_NOTES); + getInstance()->notifyObservers(agent_id, &avatar_notes, type); + } } void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) @@ -443,8 +437,8 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending - self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES); - self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES); + self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES_LEGACY); + self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES_LEGACY); } void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) -- cgit v1.2.3 From 2be809d98ddb3f54e91faefbc9593804184273e4 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Oct 2023 16:13:10 +0200 Subject: Fill agent_id fields in LLAvatarData correctly when using capability for avatar properties request --- indra/newview/llavatarpropertiesprocessor.cpp | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 9d3bc7cabe..fc15b0f8c3 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -271,7 +271,7 @@ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avata } // static -void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID agent_id, EAvatarProcessorType type) +void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t @@ -282,21 +282,21 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setFollowRedirects(true); - std::string finalUrl = cap_url + "/" + agent_id.asString(); + std::string finalUrl = cap_url + "/" + avatar_id.asString(); LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); // Response is being processed, no longer pending is required - getInstance()->removePendingRequest(agent_id, type); + getInstance()->removePendingRequest(avatar_id, type); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); if (!status || !result.has("id") - || agent_id != result["id"].asUUID()) + || avatar_id != result["id"].asUUID()) { - LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << agent_id + LL_WARNS("AvatarProperties") << "Failed to get agent information for id " << avatar_id << (!status ? " (no HTTP status)" : !result.has("id") ? " (no result.id)" : std::string(" (result.id=") + result["id"].asUUID().asString() + ")") << LL_ENDL; @@ -309,8 +309,8 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur std::string birth_date; - avatar_data.agent_id = agent_id; - avatar_data.avatar_id = agent_id; + 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(); @@ -320,7 +320,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur // 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(agent_id.asString()); + avatar_data.profile_url = getProfileURL(avatar_id.asString()); avatar_data.customer_type = result["customer_type"].asString(); avatar_data.flags = 0; @@ -351,14 +351,14 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.caption_text = result["caption"].asString(); } - getInstance()->notifyObservers(agent_id, &avatar_data, type); + getInstance()->notifyObservers(avatar_id, &avatar_data, type); } else if (type == APT_PICKS) { LLAvatarPicks avatar_picks; - avatar_picks.agent_id = agent_id; // Not in use? - avatar_picks.target_id = agent_id; + avatar_picks.agent_id = gAgentID; // Not in use? + avatar_picks.target_id = avatar_id; LLSD picks_array = result["picks"]; for (LLSD::array_const_iterator it = picks_array.beginArray(); it != picks_array.endArray(); ++it) @@ -367,14 +367,14 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_picks.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); } - getInstance()->notifyObservers(agent_id, &avatar_picks, type); + getInstance()->notifyObservers(avatar_id, &avatar_picks, type); } else if (type == APT_GROUPS) { LLAvatarGroups avatar_groups; - avatar_groups.agent_id = agent_id; // Not in use? - avatar_groups.avatar_id = agent_id; // target_id + avatar_groups.agent_id = gAgentID; // Not in use? + avatar_groups.avatar_id = avatar_id; // target_id LLSD groups_array = result["groups"]; for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) @@ -390,17 +390,17 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_groups.group_list.push_back(group_data); } - getInstance()->notifyObservers(agent_id, &avatar_groups, type); + getInstance()->notifyObservers(avatar_id, &avatar_groups, type); } else if (type == APT_NOTES) { LLAvatarNotes avatar_notes; - avatar_notes.agent_id = agent_id; - avatar_notes.target_id = agent_id; + avatar_notes.agent_id = gAgentID; + avatar_notes.target_id = avatar_id; avatar_notes.notes = result["notes"].asString(); - getInstance()->notifyObservers(agent_id, &avatar_notes, type); + getInstance()->notifyObservers(avatar_id, &avatar_notes, type); } } -- cgit v1.2.3 From 9bfb2b57c9df1822d66751865da172c128fdfe6a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Oct 2023 16:37:24 +0200 Subject: Add some optimizations and modern C++ while already touching LLAvatarPropertiesProcessor --- indra/newview/llavatarpropertiesprocessor.cpp | 94 +++++++++++++-------------- 1 file changed, 45 insertions(+), 49 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index fc15b0f8c3..c787954e2b 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -67,7 +67,7 @@ void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarP // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE if (it == end) { - mObservers.insert(pair(avatar_id, observer)); + mObservers.emplace(avatar_id, observer); } } @@ -117,8 +117,7 @@ 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 || type == APT_GROUPS || type == APT_NOTES) { - std::string cap_url(gAgent.getRegionCapability("AgentProfile")); - if (!cap_url.empty()) + if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty()) { initAgentProfileCapRequest(avatar_id, cap_url, type); return; @@ -148,8 +147,7 @@ void LLAvatarPropertiesProcessor::sendGenericRequest(const LLUUID& avatar_id, EA // indicate we're going to make a request addPendingRequest(avatar_id, type); - std::vector strings; - strings.push_back(avatar_id.asString()); + std::vector strings{ avatar_id.asString() }; send_generic_message(method, strings); } @@ -161,8 +159,8 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequestMessage(const LLUUI msg->newMessageFast(_PREHASH_AvatarPropertiesRequest); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, gAgentID); + msg->addUUIDFast(_PREHASH_SessionID, gAgentSessionID); msg->addUUIDFast(_PREHASH_AvatarID, avatar_id); gAgent.sendReliableMessage(); } @@ -230,19 +228,21 @@ std::string LLAvatarPropertiesProcessor::accountType(const LLAvatarData* avatar_ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_data) { // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return ""; + if (!avatar_data->caption_text.empty()) + return ""; // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return ""; + constexpr S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) + return ""; - BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED); - BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED); + bool transacted = (avatar_data->flags & AVATAR_TRANSACTED); + bool identified = (avatar_data->flags & AVATAR_IDENTIFIED); // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); const char* payment_text; - if(transacted) + if (transacted) { payment_text = "PaymentInfoUsed"; } @@ -261,11 +261,13 @@ std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avatar_data) { // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return true; + if (!avatar_data->caption_text.empty()) + return true; // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true; + constexpr S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) + return true; return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED)); } @@ -422,7 +424,7 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); // Since field 'hide_age' is not supported by msg system we'd better hide the age here - avatar_data.hide_age = TRUE; + avatar_data.hide_age = true; avatar_data.caption_index = 0; S32 charter_member_size = 0; @@ -484,7 +486,7 @@ void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n); msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n); - classifieds.classifieds_list.push_back(data); + classifieds.classifieds_list.emplace_back(data); } LLAvatarPropertiesProcessor* self = getInstance(); @@ -551,7 +553,7 @@ void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - avatar_picks.picks_list.push_back(std::make_pair(pick_id,pick_name)); + avatar_picks.picks_list.emplace_back(std::make_pair(pick_id,pick_name)); } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending @@ -606,7 +608,7 @@ void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); - avatar_groups.group_list.push_back(group_data); + avatar_groups.group_list.emplace_back(group_data); } LLAvatarPropertiesProcessor* self = getInstance(); @@ -619,16 +621,13 @@ void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, // Copy the map (because observers may delete themselves when updated?) LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers; - observer_multimap_t::iterator oi = observers.begin(); - observer_multimap_t::iterator end = observers.end(); - for (; oi != end; ++oi) + for (const auto& [agent_id, observer] : observers) { // only notify observers for the same agent, or if the observer // didn't know the agent ID and passed a NULL id. - const LLUUID &agent_id = oi->first; if (agent_id == id || agent_id.isNull()) { - oi->second->processProperties(data, type); + observer->processProperties(data, type); } } } @@ -642,8 +641,8 @@ void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 // setup message header msg->newMessageFast(_PREHASH_GrantUserRights); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_Rights); msg->addUUID(_PREHASH_AgentRelated, avatar_id); @@ -662,8 +661,8 @@ void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std:: // setup message header msg->newMessageFast(_PREHASH_AvatarNotesUpdate); msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlockFast(_PREHASH_Data); msg->addUUID(_PREHASH_TargetID, avatar_id); @@ -679,8 +678,8 @@ void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_PickDelete); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_PickID, pick_id); gAgent.sendReliableMessage(); @@ -696,8 +695,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ msg->newMessage(_PREHASH_ClassifiedDelete); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, classified_id); @@ -708,16 +707,14 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data) { if(!interests_data) - { return; - } LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_AvatarInterestsUpdate); msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() ); + msg->addUUIDFast( _PREHASH_AgentID, gAgentID ); + msg->addUUIDFast( _PREHASH_SessionID, gAgentSessionID ); msg->nextBlockFast( _PREHASH_PropertiesData); msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); @@ -730,14 +727,15 @@ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { - if (!new_pick) return; + if (!new_pick) + return; LLMessageSystem* msg = gMessageSystem; msg->newMessage(_PREHASH_PickInfoUpdate); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_PickID, new_pick->pick_id); @@ -774,8 +772,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassif msg->newMessage(_PREHASH_ClassifiedInfoUpdate); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id); @@ -796,9 +794,7 @@ void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, { // Must ask for a pick based on the creator id because // the pick database is distributed to the inventory cluster. JC - std::vector request_params; - request_params.push_back(creator_id.asString() ); - request_params.push_back(pick_id.asString() ); + std::vector request_params{ creator_id.asString(), pick_id.asString() }; send_generic_message("pickinforequest", request_params); } @@ -809,8 +805,8 @@ void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& classi msg->newMessage(_PREHASH_ClassifiedInfoRequest); msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgentID); + msg->addUUID(_PREHASH_SessionID, gAgentSessionID); msg->nextBlock(_PREHASH_Data); msg->addUUID(_PREHASH_ClassifiedID, classified_id); @@ -827,7 +823,7 @@ bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAva if (it == mRequestTimestamps.end()) return false; // We found a request, check if it has timed out - U32 now = time(NULL); + U32 now = time(nullptr); const U32 REQUEST_EXPIRE_SECS = 5; U32 expires = it->second + REQUEST_EXPIRE_SECS; @@ -841,7 +837,7 @@ bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAva void LLAvatarPropertiesProcessor::addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { timestamp_map_t::key_type key = std::make_pair(avatar_id, type); - U32 now = time(NULL); + U32 now = time(nullptr); // Add or update existing (expired) request mRequestTimestamps[ key ] = now; } -- cgit v1.2.3 From 1f27d2b62316c1d1f8fc527c0d9f2a634a0bdd8e Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 23 Oct 2023 16:42:19 +0200 Subject: Remove unnecessary make_pair call --- indra/newview/llavatarpropertiesprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index c787954e2b..49a4a5b65c 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -553,7 +553,7 @@ void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - avatar_picks.picks_list.emplace_back(std::make_pair(pick_id,pick_name)); + avatar_picks.picks_list.emplace_back(pick_id, pick_name); } LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending -- cgit v1.2.3 From d4087fce7b36625259576d5964c5a8dd8e93d707 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 21 Oct 2023 00:07:40 +0300 Subject: SL-20513 Cleanup LLAvatarPropertiesProcessor #1 --- indra/newview/llavatarpropertiesprocessor.cpp | 176 ++++---------------------- 1 file changed, 22 insertions(+), 154 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 49a4a5b65c..472cf8b8d5 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -115,7 +115,7 @@ 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 || type == APT_GROUPS || type == APT_NOTES) + if (type == APT_PROPERTIES || type == APT_PICKS) { if (std::string cap_url(gAgent.getRegionCapability("AgentProfile")); !cap_url.empty()) { @@ -172,24 +172,19 @@ void LLAvatarPropertiesProcessor::initAgentProfileCapRequest(const LLUUID& avata [cap_url, avatar_id, type]() { requestAvatarPropertiesCoro(cap_url, avatar_id, type); }); } -void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id, bool use_cap) +void LLAvatarPropertiesProcessor::sendAvatarPropertiesRequest(const LLUUID& avatar_id) { - sendRequest(avatar_id, use_cap ? APT_PROPERTIES : APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); + sendRequest(avatar_id, APT_PROPERTIES, "AvatarPropertiesRequest"); } -void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id) -{ - sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest"); -} - -void LLAvatarPropertiesProcessor::sendAvatarNotesRequest(const LLUUID& avatar_id) +void LLAvatarPropertiesProcessor::sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest"); + sendRequest(avatar_id, APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); } -void LLAvatarPropertiesProcessor::sendAvatarGroupsRequest(const LLUUID& avatar_id) +void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest"); + sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest"); } void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id) @@ -324,6 +319,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur 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()) @@ -353,6 +349,20 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur 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); } else if (type == APT_PICKS) @@ -371,39 +381,6 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur getInstance()->notifyObservers(avatar_id, &avatar_picks, type); } - else if (type == APT_GROUPS) - { - LLAvatarGroups avatar_groups; - - avatar_groups.agent_id = gAgentID; // Not in use? - avatar_groups.avatar_id = avatar_id; // target_id - - LLSD groups_array = result["groups"]; - for (LLSD::array_const_iterator it = groups_array.beginArray(); it != groups_array.endArray(); ++it) - { - const LLSD& group_info = *it; - LLAvatarGroups::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_groups.group_list.push_back(group_data); - } - - getInstance()->notifyObservers(avatar_id, &avatar_groups, type); - } - else if (type == APT_NOTES) - { - LLAvatarNotes avatar_notes; - - avatar_notes.agent_id = gAgentID; - avatar_notes.target_id = avatar_id; - avatar_notes.notes = result["notes"].asString(); - - getInstance()->notifyObservers(avatar_id, &avatar_notes, type); - } } void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) @@ -443,33 +420,6 @@ void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES_LEGACY); } -void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) -{ -/* - AvatarInterestsReply is automatically sent by the server in response to the - AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message). - If the interests panel is no longer part of the design (?) we should just register the message - to a handler function that does nothing. - That will suppress the warnings and be compatible with old server versions. - WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply -*/ - - LLInterestsData interests_data; - - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, interests_data.agent_id ); - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, interests_data.avatar_id ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask ); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_WantToText, interests_data.want_to_text ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask ); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_SkillsText, interests_data.skills_text ); - msg->getString( _PREHASH_PropertiesData, _PREHASH_LanguagesText, interests_data.languages_text ); - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(interests_data.avatar_id, APT_INTERESTS_INFO); - self->notifyObservers(interests_data.avatar_id, &interests_data, APT_INTERESTS_INFO); -} - void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**) { LLAvatarClassifieds classifieds; @@ -523,21 +473,6 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } - -void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) -{ - LLAvatarNotes avatar_notes; - - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id); - msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id); - msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes); - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(avatar_notes.target_id, APT_NOTES); - self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES); -} - void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**) { LLAvatarPicks avatar_picks; @@ -591,31 +526,6 @@ void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, voi self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO); } -void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**) -{ - LLAvatarGroups avatar_groups; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id ); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id ); - - S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); - for(S32 i = 0; i < group_count; ++i) - { - LLAvatarGroups::LLGroupData group_data; - - msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); - - avatar_groups.group_list.emplace_back(group_data); - } - - LLAvatarPropertiesProcessor* self = getInstance(); - self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS); - self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); -} - void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, EAvatarProcessorType type) { // Copy the map (because observers may delete themselves when updated?) @@ -652,27 +562,6 @@ void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 } } -void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std::string notes) -{ - if(!avatar_id.isNull()) - { - LLMessageSystem* msg = gMessageSystem; - - // setup message header - msg->newMessageFast(_PREHASH_AvatarNotesUpdate); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgentID); - msg->addUUID(_PREHASH_SessionID, gAgentSessionID); - - msg->nextBlockFast(_PREHASH_Data); - msg->addUUID(_PREHASH_TargetID, avatar_id); - msg->addString(_PREHASH_Notes, notes); - - gAgent.sendReliableMessage(); - } -} - - void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) { LLMessageSystem* msg = gMessageSystem; @@ -704,27 +593,6 @@ void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_ gAgent.sendReliableMessage(); } -void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data) -{ - if(!interests_data) - return; - - LLMessageSystem* msg = gMessageSystem; - - msg->newMessage(_PREHASH_AvatarInterestsUpdate); - msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgentID ); - msg->addUUIDFast( _PREHASH_SessionID, gAgentSessionID ); - msg->nextBlockFast( _PREHASH_PropertiesData); - msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); - msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); - msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask); - msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text); - msg->addString( _PREHASH_LanguagesText, interests_data->languages_text); - - gAgent.sendReliableMessage(); -} - void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { if (!new_pick) -- cgit v1.2.3 From f54d0329f32081883704cc2694871600f896006b Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 24 Oct 2023 00:14:21 +0300 Subject: SL-20513 Cleanup LLAvatarPropertiesProcessor #2 --- indra/newview/llavatarpropertiesprocessor.cpp | 183 ++++++++++---------------- 1 file changed, 72 insertions(+), 111 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') 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; -- cgit v1.2.3 From 62f864c04539b0db7069d75f471778b9b77d5b9e Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Thu, 26 Oct 2023 22:59:54 +0300 Subject: SL-20513 Fix using wrong data struct #4 --- indra/newview/llavatarpropertiesprocessor.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 5b28e9f4c6..e5e9d817c9 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -369,7 +369,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**) { - LLAvatarData avatar_data; + LLAvatarLegacyData avatar_data; std::string birth_date; msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id); @@ -385,7 +385,6 @@ void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSy LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); // Since field 'hide_age' is not supported by msg system we'd better hide the age here - avatar_data.hide_age = true; avatar_data.caption_index = 0; S32 charter_member_size = 0; -- cgit v1.2.3 From 85c4ea76b9a3193dd338bca5c571b84bebf6b38c Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Mon, 6 Nov 2023 17:13:51 +0100 Subject: SL-20163 Allow residents to hide exact join date on profiles (check server support) --- indra/newview/llavatarpropertiesprocessor.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index e5e9d817c9..bed8887ce1 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -264,6 +264,8 @@ bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avata // static void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_url, LLUUID avatar_id, EAvatarProcessorType type) { + LLAvatarPropertiesProcessor& inst = instance(); + LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestAvatarPropertiesCoro", httpPolicy)); @@ -278,7 +280,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur LLSD result = httpAdapter->getAndSuspend(httpRequest, finalUrl, httpOpts, httpHeaders); // Response is being processed, no longer pending is required - getInstance()->removePendingRequest(avatar_id, type); + inst.removePendingRequest(avatar_id, type); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); @@ -308,7 +310,8 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur 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(); + inst.mIsHideAgeSupportedByServer = result.has("hide_age"); + avatar_data.hide_age = inst.isHideAgeSupportedByServer() && 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(); @@ -364,7 +367,7 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur avatar_data.picks_list.emplace_back(pick_data["id"].asUUID(), pick_data["name"].asString()); } - getInstance()->notifyObservers(avatar_id, &avatar_data, type); + inst.notifyObservers(avatar_id, &avatar_data, type); } void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSystem* msg, void**) @@ -384,7 +387,6 @@ void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSy msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); - // Since field 'hide_age' is not supported by msg system we'd better hide the age here avatar_data.caption_index = 0; S32 charter_member_size = 0; -- cgit v1.2.3 From bc29431ab2f500ba588edaeee34ba2328db199aa Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 24 Apr 2024 21:18:14 +0300 Subject: viewer#1309 Handle deprecated avatar properties messages since server still sends those in some cases --- indra/newview/llavatarpropertiesprocessor.cpp | 42 +++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index bed8887ce1..bf1080b6cd 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -405,6 +405,18 @@ void LLAvatarPropertiesProcessor::processAvatarLegacyPropertiesReply(LLMessageSy self->notifyObservers(avatar_data.avatar_id, &avatar_data, APT_PROPERTIES_LEGACY); } +void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) +{ +/* + AvatarInterestsReply is automatically sent by the server in response to the + AvatarPropertiesRequest (in addition to the AvatarPropertiesReply message). + If the interests panel is no longer part of the design (?) we should just register the message + to a handler function that does nothing. + That will suppress the warnings and be compatible with old server versions. + WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply +*/ +} + void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**) { LLAvatarClassifieds classifieds; @@ -458,6 +470,22 @@ void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* ms self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } + +void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) +{ + // Deprecated, new "AgentProfile" allows larger notes +} + +void LLAvatarPropertiesProcessor::processAvatarPicksReply(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + LLUUID target_id; + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, target_id); + + LL_DEBUGS("AvatarProperties") << "Received AvatarPicksReply for " << target_id << LL_ENDL; +} + void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, void**) { LLPickData pick_data; @@ -488,6 +516,20 @@ void LLAvatarPropertiesProcessor::processPickInfoReply(LLMessageSystem* msg, voi self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO); } +void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**) +{ + /* + AvatarGroupsReply is automatically sent by the server in response to the + AvatarPropertiesRequest in addition to the AvatarPropertiesReply message. + */ + LLUUID agent_id; + LLUUID avatar_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_id); + + LL_DEBUGS("AvatarProperties") << "Received AvatarGroupsReply for " << avatar_id << LL_ENDL; +} + void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id, void* data, EAvatarProcessorType type) { // Copy the map (because observers may delete themselves when updated?) -- cgit v1.2.3 From 1b68f71348ecf3983b76b40d7940da8377f049b7 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 29 Apr 2024 07:43:28 +0300 Subject: #824 Process source files in bulk: replace tabs with spaces, convert CRLF to LF, and trim trailing whitespaces as needed --- indra/newview/llavatarpropertiesprocessor.cpp | 812 +++++++++++++------------- 1 file changed, 406 insertions(+), 406 deletions(-) (limited to 'indra/newview/llavatarpropertiesprocessor.cpp') diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index dd0d06a8c8..f28cb6147e 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -1,25 +1,25 @@ -/** +/** * @file llavatarpropertiesprocessor.cpp * @brief LLAvatarPropertiesProcessor class implementation * * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -39,7 +39,7 @@ #include "llavataractions.h" // for getProfileUrl #include "lldate.h" #include "lltrans.h" -#include "llui.h" // LLUI::getLanguage() +#include "llui.h" // LLUI::getLanguage() #include "message.h" LLAvatarPropertiesProcessor::LLAvatarPropertiesProcessor() @@ -52,47 +52,47 @@ LLAvatarPropertiesProcessor::~LLAvatarPropertiesProcessor() void LLAvatarPropertiesProcessor::addObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) { - // Check if that observer is already in mObservers for that avatar_id - observer_multimap_t::iterator it; + // Check if that observer is already in mObservers for that avatar_id + observer_multimap_t::iterator it; - // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE - it = mObservers.find(avatar_id); - while (it != mObservers.end()) - { - if (it->second == observer) - { - return; - } - else - { - ++it; - } - } + // IAN BUG this should update the observer's UUID if this is a dupe - sent to PE + it = mObservers.find(avatar_id); + while (it != mObservers.end()) + { + if (it->second == observer) + { + return; + } + else + { + ++it; + } + } - mObservers.insert(std::pair(avatar_id, observer)); + mObservers.insert(std::pair(avatar_id, observer)); } void LLAvatarPropertiesProcessor::removeObserver(const LLUUID& avatar_id, LLAvatarPropertiesObserver* observer) { - if (!observer) - { - return; - } - - observer_multimap_t::iterator it; - it = mObservers.find(avatar_id); - while (it != mObservers.end()) - { - if (it->second == observer) - { - mObservers.erase(it); - break; - } - else - { - ++it; - } - } + if (!observer) + { + return; + } + + observer_multimap_t::iterator it; + it = mObservers.find(avatar_id); + while (it != mObservers.end()) + { + if (it->second == observer) + { + mObservers.erase(it); + break; + } + else + { + ++it; + } + } } void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarProcessorType type, const std::string &method) @@ -109,12 +109,12 @@ void LLAvatarPropertiesProcessor::sendRequest(const LLUUID& avatar_id, EAvatarPr return; } - // Suppress duplicate requests while waiting for a response from the network - if (isPendingRequest(avatar_id, type)) - { - // waiting for a response, don't re-request - return; - } + // Suppress duplicate requests while waiting for a response from the network + if (isPendingRequest(avatar_id, type)) + { + // waiting for a response, don't re-request + return; + } std::string cap; @@ -191,58 +191,58 @@ void LLAvatarPropertiesProcessor::sendAvatarPicksRequest(const LLUUID& avatar_id void LLAvatarPropertiesProcessor::sendAvatarNotesRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest"); + sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest"); } void LLAvatarPropertiesProcessor::sendAvatarGroupsRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest"); + sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest"); } void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest"); - // No response expected. - removePendingRequest(avatar_id, APT_TEXTURES); + sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest"); + // No response expected. + removePendingRequest(avatar_id, APT_TEXTURES); } void LLAvatarPropertiesProcessor::sendAvatarClassifiedsRequest(const LLUUID& avatar_id) { - sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest"); + sendGenericRequest(avatar_id, APT_CLASSIFIEDS, "avatarclassifiedsrequest"); } void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* avatar_props) { - if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null)) - { - LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL; - return; - } + if (!gAgent.isInitialized() || (gAgent.getID() == LLUUID::null)) + { + LL_WARNS() << "Sending avatarinfo update DENIED - invalid agent" << LL_ENDL; + return; + } - LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL; + LL_WARNS() << "Sending avatarinfo update. This trims profile descriptions!!!" << LL_ENDL; - // This value is required by sendAvatarPropertiesUpdate method. - //A profile should never be mature. (From the original code) - BOOL mature = FALSE; + // This value is required by sendAvatarPropertiesUpdate method. + //A profile should never be mature. (From the original code) + BOOL mature = FALSE; - LLMessageSystem *msg = gMessageSystem; + LLMessageSystem *msg = gMessageSystem; - msg->newMessageFast (_PREHASH_AvatarPropertiesUpdate); - msg->nextBlockFast (_PREHASH_AgentData); - msg->addUUIDFast (_PREHASH_AgentID, gAgent.getID() ); - msg->addUUIDFast (_PREHASH_SessionID, gAgent.getSessionID() ); - msg->nextBlockFast (_PREHASH_PropertiesData); + msg->newMessageFast (_PREHASH_AvatarPropertiesUpdate); + msg->nextBlockFast (_PREHASH_AgentData); + msg->addUUIDFast (_PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast (_PREHASH_SessionID, gAgent.getSessionID() ); + msg->nextBlockFast (_PREHASH_PropertiesData); - msg->addUUIDFast (_PREHASH_ImageID, avatar_props->image_id); - msg->addUUIDFast (_PREHASH_FLImageID, avatar_props->fl_image_id); - msg->addStringFast (_PREHASH_AboutText, avatar_props->about_text); - msg->addStringFast (_PREHASH_FLAboutText, avatar_props->fl_about_text); + msg->addUUIDFast (_PREHASH_ImageID, avatar_props->image_id); + msg->addUUIDFast (_PREHASH_FLImageID, avatar_props->fl_image_id); + msg->addStringFast (_PREHASH_AboutText, avatar_props->about_text); + msg->addStringFast (_PREHASH_FLAboutText, avatar_props->fl_about_text); - msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish); - msg->addBOOL(_PREHASH_MaturePublish, mature); - msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url); + msg->addBOOL(_PREHASH_AllowPublish, avatar_props->allow_publish); + msg->addBOOL(_PREHASH_MaturePublish, mature); + msg->addString(_PREHASH_ProfileURL, avatar_props->profile_url); - gAgent.sendReliableMessage(); + gAgent.sendReliableMessage(); } @@ -250,65 +250,65 @@ void LLAvatarPropertiesProcessor::sendAvatarPropertiesUpdate(const LLAvatarData* //static std::string LLAvatarPropertiesProcessor::accountType(const LLAvatarData* avatar_data) { - // If you have a special account, like M Linden ("El Jefe!") - // return an untranslated "special" string - if (!avatar_data->caption_text.empty()) - { - return avatar_data->caption_text; - } - const char* const ACCT_TYPE[] = { - "AcctTypeResident", - "AcctTypeTrial", - "AcctTypeCharterMember", - "AcctTypeEmployee" - }; - U8 caption_max = (U8)LL_ARRAY_SIZE(ACCT_TYPE)-1; - U8 caption_index = llclamp(avatar_data->caption_index, (U8)0, caption_max); - return LLTrans::getString(ACCT_TYPE[caption_index]); + // If you have a special account, like M Linden ("El Jefe!") + // return an untranslated "special" string + if (!avatar_data->caption_text.empty()) + { + return avatar_data->caption_text; + } + const char* const ACCT_TYPE[] = { + "AcctTypeResident", + "AcctTypeTrial", + "AcctTypeCharterMember", + "AcctTypeEmployee" + }; + U8 caption_max = (U8)LL_ARRAY_SIZE(ACCT_TYPE)-1; + U8 caption_index = llclamp(avatar_data->caption_index, (U8)0, caption_max); + return LLTrans::getString(ACCT_TYPE[caption_index]); } //static std::string LLAvatarPropertiesProcessor::paymentInfo(const LLAvatarData* avatar_data) { - // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return ""; - - // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return ""; - - BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED); - BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED); - // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations - //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); - - const char* payment_text; - if(transacted) - { - payment_text = "PaymentInfoUsed"; - } - else if (identified) - { - payment_text = "PaymentInfoOnFile"; - } - else - { - payment_text = "NoPaymentInfoOnFile"; - } - return LLTrans::getString(payment_text); + // Special accounts like M Linden don't have payment info revealed. + if (!avatar_data->caption_text.empty()) return ""; + + // Linden employees don't have payment info revealed + const S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return ""; + + BOOL transacted = (avatar_data->flags & AVATAR_TRANSACTED); + BOOL identified = (avatar_data->flags & AVATAR_IDENTIFIED); + // Not currently getting set in dataserver/lldataavatar.cpp for privacy considerations + //BOOL age_verified = (avatar_data->flags & AVATAR_AGEVERIFIED); + + const char* payment_text; + if(transacted) + { + payment_text = "PaymentInfoUsed"; + } + else if (identified) + { + payment_text = "PaymentInfoOnFile"; + } + else + { + payment_text = "NoPaymentInfoOnFile"; + } + return LLTrans::getString(payment_text); } //static bool LLAvatarPropertiesProcessor::hasPaymentInfoOnFile(const LLAvatarData* avatar_data) { - // Special accounts like M Linden don't have payment info revealed. - if (!avatar_data->caption_text.empty()) return true; + // Special accounts like M Linden don't have payment info revealed. + if (!avatar_data->caption_text.empty()) return true; - // Linden employees don't have payment info revealed - const S32 LINDEN_EMPLOYEE_INDEX = 3; - if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true; + // Linden employees don't have payment info revealed + const S32 LINDEN_EMPLOYEE_INDEX = 3; + if (avatar_data->caption_index == LINDEN_EMPLOYEE_INDEX) return true; - return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED)); + return ((avatar_data->flags & AVATAR_TRANSACTED) || (avatar_data->flags & AVATAR_IDENTIFIED)); } // static @@ -420,61 +420,61 @@ void LLAvatarPropertiesProcessor::requestAvatarPropertiesCoro(std::string cap_ur void LLAvatarPropertiesProcessor::processAvatarPropertiesReply(LLMessageSystem* msg, void**) { - LLAvatarData avatar_data; - std::string birth_date; - - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id); - msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id); - msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, avatar_data.image_id); - msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, avatar_data.fl_image_id); - msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text); - msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, birth_date); - msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); - - - LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); - avatar_data.caption_index = 0; - - S32 charter_member_size = 0; - charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember); - if(1 == charter_member_size) - { - msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1); - } - else if(1 < charter_member_size) - { - msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text); - } - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES); - self->notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES); + LLAvatarData avatar_data; + std::string birth_date; + + msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, avatar_data.agent_id); + msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, avatar_data.avatar_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_ImageID, avatar_data.image_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_FLImageID, avatar_data.fl_image_id); + msg->getUUIDFast( _PREHASH_PropertiesData, _PREHASH_PartnerID, avatar_data.partner_id); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_AboutText, avatar_data.about_text); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_FLAboutText, avatar_data.fl_about_text); + msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_BornOn, birth_date); + msg->getString( _PREHASH_PropertiesData, _PREHASH_ProfileURL, avatar_data.profile_url); + msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_Flags, avatar_data.flags); + + + LLDateUtil::dateFromPDTString(avatar_data.born_on, birth_date); + avatar_data.caption_index = 0; + + S32 charter_member_size = 0; + charter_member_size = msg->getSize(_PREHASH_PropertiesData, _PREHASH_CharterMember); + if(1 == charter_member_size) + { + msg->getBinaryData(_PREHASH_PropertiesData, _PREHASH_CharterMember, &avatar_data.caption_index, 1); + } + else if(1 < charter_member_size) + { + msg->getString(_PREHASH_PropertiesData, _PREHASH_CharterMember, avatar_data.caption_text); + } + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(avatar_data.avatar_id, APT_PROPERTIES); + self->notifyObservers(avatar_data.avatar_id,&avatar_data,APT_PROPERTIES); } void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* msg, void**) { /* - AvatarInterestsReply is automatically sent by the server in response to the - AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message). - If the interests panel is no longer part of the design (?) we should just register the message - to a handler function that does nothing. - That will suppress the warnings and be compatible with old server versions. - WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply + AvatarInterestsReply is automatically sent by the server in response to the + AvatarPropertiesRequest sent when the panel is opened (in addition to the AvatarPropertiesReply message). + If the interests panel is no longer part of the design (?) we should just register the message + to a handler function that does nothing. + That will suppress the warnings and be compatible with old server versions. + WARNING: LLTemplateMessageReader::decodeData: Message from 216.82.37.237:13000 with no handler function received: AvatarInterestsReply */ LLInterestsData interests_data; - + msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AgentID, interests_data.agent_id ); msg->getUUIDFast( _PREHASH_AgentData, _PREHASH_AvatarID, interests_data.avatar_id ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask ); + msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_WantToMask, interests_data.want_to_mask ); msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_WantToText, interests_data.want_to_text ); - msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask ); + msg->getU32Fast( _PREHASH_PropertiesData, _PREHASH_SkillsMask, interests_data.skills_mask ); msg->getStringFast( _PREHASH_PropertiesData, _PREHASH_SkillsText, interests_data.skills_text ); msg->getString( _PREHASH_PropertiesData, _PREHASH_LanguagesText, interests_data.languages_text ); - + LLAvatarPropertiesProcessor* self = getInstance(); // Request processed, no longer pending self->removePendingRequest(interests_data.avatar_id, APT_INTERESTS_INFO); @@ -483,239 +483,239 @@ void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* m void LLAvatarPropertiesProcessor::processAvatarClassifiedsReply(LLMessageSystem* msg, void**) { - LLAvatarClassifieds classifieds; + LLAvatarClassifieds classifieds; - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, classifieds.agent_id); - msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, classifieds.target_id); + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, classifieds.agent_id); + msg->getUUID(_PREHASH_AgentData, _PREHASH_TargetID, classifieds.target_id); - S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data); + S32 block_count = msg->getNumberOfBlocks(_PREHASH_Data); - for(int n = 0; n < block_count; ++n) - { - LLAvatarClassifieds::classified_data data; + for(int n = 0; n < block_count; ++n) + { + LLAvatarClassifieds::classified_data data; - msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n); - msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n); + msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, data.classified_id, n); + msg->getString(_PREHASH_Data, _PREHASH_Name, data.name, n); - classifieds.classifieds_list.push_back(data); - } + classifieds.classifieds_list.push_back(data); + } - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(classifieds.target_id, APT_CLASSIFIEDS); - self->notifyObservers(classifieds.target_id,&classifieds,APT_CLASSIFIEDS); + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(classifieds.target_id, APT_CLASSIFIEDS); + self->notifyObservers(classifieds.target_id,&classifieds,APT_CLASSIFIEDS); } void LLAvatarPropertiesProcessor::processClassifiedInfoReply(LLMessageSystem* msg, void**) { - LLAvatarClassifiedInfo c_info; - - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, c_info.agent_id); + LLAvatarClassifiedInfo c_info; + + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, c_info.agent_id); + + msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, c_info.classified_id); + msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, c_info.creator_id); + msg->getU32(_PREHASH_Data, _PREHASH_CreationDate, c_info.creation_date); + msg->getU32(_PREHASH_Data, _PREHASH_ExpirationDate, c_info.expiration_date); + msg->getU32(_PREHASH_Data, _PREHASH_Category, c_info.category); + msg->getString(_PREHASH_Data, _PREHASH_Name, c_info.name); + msg->getString(_PREHASH_Data, _PREHASH_Desc, c_info.description); + msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, c_info.parcel_id); + msg->getU32(_PREHASH_Data, _PREHASH_ParentEstate, c_info.parent_estate); + msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, c_info.snapshot_id); + msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name); + msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global); + msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name); + msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.flags); + msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing); - msg->getUUID(_PREHASH_Data, _PREHASH_ClassifiedID, c_info.classified_id); - msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, c_info.creator_id); - msg->getU32(_PREHASH_Data, _PREHASH_CreationDate, c_info.creation_date); - msg->getU32(_PREHASH_Data, _PREHASH_ExpirationDate, c_info.expiration_date); - msg->getU32(_PREHASH_Data, _PREHASH_Category, c_info.category); - msg->getString(_PREHASH_Data, _PREHASH_Name, c_info.name); - msg->getString(_PREHASH_Data, _PREHASH_Desc, c_info.description); - msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, c_info.parcel_id); - msg->getU32(_PREHASH_Data, _PREHASH_ParentEstate, c_info.parent_estate); - msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, c_info.snapshot_id); - msg->getString(_PREHASH_Data, _PREHASH_SimName, c_info.sim_name); - msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, c_info.pos_global); - msg->getString(_PREHASH_Data, _PREHASH_ParcelName, c_info.parcel_name); - msg->getU8(_PREHASH_Data, _PREHASH_ClassifiedFlags, c_info.flags); - msg->getS32(_PREHASH_Data, _PREHASH_PriceForListing, c_info.price_for_listing); - - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO); - self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(c_info.creator_id, APT_CLASSIFIED_INFO); + self->notifyObservers(c_info.creator_id, &c_info, APT_CLASSIFIED_INFO); } void LLAvatarPropertiesProcessor::processAvatarNotesReply(LLMessageSystem* msg, void**) { - LLAvatarNotes avatar_notes; + LLAvatarNotes avatar_notes; - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id); - msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id); - msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes); + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, avatar_notes.agent_id); + msg->getUUID(_PREHASH_Data, _PREHASH_TargetID, avatar_notes.target_id); + msg->getString(_PREHASH_Data, _PREHASH_Notes, avatar_notes.notes); - LLAvatarPropertiesProcessor* self = getInstance(); - // Request processed, no longer pending - self->removePendingRequest(avatar_notes.target_id, APT_NOTES); - self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES); + LLAvatarPropertiesProcessor* self = getInstance(); + // Request processed, no longer pending + self->removePendingRequest(avatar_notes.target_id, APT_NOTES); + self->notifyObservers(avatar_notes.target_id,&avatar_notes,APT_NOTES); } 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); + 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; + 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); + msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_id, block); + msg->getString(_PREHASH_Data, _PREHASH_PickName, pick_name, block); - avatar_picks.picks_list.push_back(std::make_pair(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); + avatar_picks.picks_list.push_back(std::make_pair(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; + LLPickData pick_data; - // Extract the agent id and verify the message is for this - // client. - msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, pick_data.agent_id ); - msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_data.pick_id); - msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, pick_data.creator_id); + // Extract the agent id and verify the message is for this + // client. + msg->getUUID(_PREHASH_AgentData, _PREHASH_AgentID, pick_data.agent_id ); + msg->getUUID(_PREHASH_Data, _PREHASH_PickID, pick_data.pick_id); + msg->getUUID(_PREHASH_Data, _PREHASH_CreatorID, pick_data.creator_id); - // ** top_pick should be deleted, not being used anymore - angela - msg->getBOOL(_PREHASH_Data, _PREHASH_TopPick, pick_data.top_pick); - msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, pick_data.parcel_id); - msg->getString(_PREHASH_Data, _PREHASH_Name, pick_data.name); - msg->getString(_PREHASH_Data, _PREHASH_Desc, pick_data.desc); - msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, pick_data.snapshot_id); + // ** top_pick should be deleted, not being used anymore - angela + msg->getBOOL(_PREHASH_Data, _PREHASH_TopPick, pick_data.top_pick); + msg->getUUID(_PREHASH_Data, _PREHASH_ParcelID, pick_data.parcel_id); + msg->getString(_PREHASH_Data, _PREHASH_Name, pick_data.name); + msg->getString(_PREHASH_Data, _PREHASH_Desc, pick_data.desc); + msg->getUUID(_PREHASH_Data, _PREHASH_SnapshotID, pick_data.snapshot_id); - msg->getString(_PREHASH_Data, _PREHASH_User, pick_data.user_name); - msg->getString(_PREHASH_Data, _PREHASH_OriginalName, pick_data.original_name); - msg->getString(_PREHASH_Data, _PREHASH_SimName, pick_data.sim_name); - msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, pick_data.pos_global); + msg->getString(_PREHASH_Data, _PREHASH_User, pick_data.user_name); + msg->getString(_PREHASH_Data, _PREHASH_OriginalName, pick_data.original_name); + msg->getString(_PREHASH_Data, _PREHASH_SimName, pick_data.sim_name); + msg->getVector3d(_PREHASH_Data, _PREHASH_PosGlobal, pick_data.pos_global); - msg->getS32(_PREHASH_Data, _PREHASH_SortOrder, pick_data.sort_order); - msg->getBOOL(_PREHASH_Data, _PREHASH_Enabled, pick_data.enabled); + msg->getS32(_PREHASH_Data, _PREHASH_SortOrder, pick_data.sort_order); + msg->getBOOL(_PREHASH_Data, _PREHASH_Enabled, pick_data.enabled); - LLAvatarPropertiesProcessor* self = getInstance(); - // don't need to remove pending request as we don't track pick info - self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO); + LLAvatarPropertiesProcessor* self = getInstance(); + // don't need to remove pending request as we don't track pick info + self->notifyObservers(pick_data.creator_id, &pick_data, APT_PICK_INFO); } void LLAvatarPropertiesProcessor::processAvatarGroupsReply(LLMessageSystem* msg, void**) { - LLAvatarGroups avatar_groups; - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id ); - msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id ); + LLAvatarGroups avatar_groups; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, avatar_groups.agent_id ); + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AvatarID, avatar_groups.avatar_id ); - S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); - for(S32 i = 0; i < group_count; ++i) - { - LLAvatarGroups::LLGroupData group_data; + S32 group_count = msg->getNumberOfBlocksFast(_PREHASH_GroupData); + for(S32 i = 0; i < group_count; ++i) + { + LLAvatarGroups::LLGroupData group_data; - msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i ); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i); - msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); - msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); + msg->getU64( _PREHASH_GroupData, _PREHASH_GroupPowers, group_data.group_powers, i ); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupTitle, group_data.group_title, i ); + msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupID, group_data.group_id, i); + msg->getStringFast(_PREHASH_GroupData, _PREHASH_GroupName, group_data.group_name, i ); + msg->getUUIDFast( _PREHASH_GroupData, _PREHASH_GroupInsigniaID, group_data.group_insignia_id, i ); - avatar_groups.group_list.push_back(group_data); - } + avatar_groups.group_list.push_back(group_data); + } - LLAvatarPropertiesProcessor* self = getInstance(); - self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS); - self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); + LLAvatarPropertiesProcessor* self = getInstance(); + self->removePendingRequest(avatar_groups.avatar_id, APT_GROUPS); + self->notifyObservers(avatar_groups.avatar_id,&avatar_groups,APT_GROUPS); } void LLAvatarPropertiesProcessor::notifyObservers(const LLUUID& id,void* data, EAvatarProcessorType type) { - // Copy the map (because observers may delete themselves when updated?) - LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers; + // Copy the map (because observers may delete themselves when updated?) + LLAvatarPropertiesProcessor::observer_multimap_t observers = mObservers; - observer_multimap_t::iterator oi = observers.begin(); - observer_multimap_t::iterator end = observers.end(); - for (; oi != end; ++oi) - { - // only notify observers for the same agent, or if the observer - // didn't know the agent ID and passed a NULL id. - const LLUUID &agent_id = oi->first; - if (agent_id == id || agent_id.isNull()) - { - oi->second->processProperties(data,type); - } - } + observer_multimap_t::iterator oi = observers.begin(); + observer_multimap_t::iterator end = observers.end(); + for (; oi != end; ++oi) + { + // only notify observers for the same agent, or if the observer + // didn't know the agent ID and passed a NULL id. + const LLUUID &agent_id = oi->first; + if (agent_id == id || agent_id.isNull()) + { + oi->second->processProperties(data,type); + } + } } void LLAvatarPropertiesProcessor::sendFriendRights(const LLUUID& avatar_id, S32 rights) { - if(!avatar_id.isNull()) - { - LLMessageSystem* msg = gMessageSystem; + if(!avatar_id.isNull()) + { + LLMessageSystem* msg = gMessageSystem; - // setup message header - msg->newMessageFast(_PREHASH_GrantUserRights); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + // setup message header + msg->newMessageFast(_PREHASH_GrantUserRights); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Rights); - msg->addUUID(_PREHASH_AgentRelated, avatar_id); - msg->addS32(_PREHASH_RelatedRights, rights); + msg->nextBlockFast(_PREHASH_Rights); + msg->addUUID(_PREHASH_AgentRelated, avatar_id); + msg->addS32(_PREHASH_RelatedRights, rights); - gAgent.sendReliableMessage(); - } + gAgent.sendReliableMessage(); + } } void LLAvatarPropertiesProcessor::sendNotes(const LLUUID& avatar_id, const std::string notes) { - if(!avatar_id.isNull()) - { - LLMessageSystem* msg = gMessageSystem; + if(!avatar_id.isNull()) + { + LLMessageSystem* msg = gMessageSystem; - // setup message header - msg->newMessageFast(_PREHASH_AvatarNotesUpdate); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + // setup message header + msg->newMessageFast(_PREHASH_AvatarNotesUpdate); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlockFast(_PREHASH_Data); - msg->addUUID(_PREHASH_TargetID, avatar_id); - msg->addString(_PREHASH_Notes, notes); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUID(_PREHASH_TargetID, avatar_id); + msg->addString(_PREHASH_Notes, notes); - gAgent.sendReliableMessage(); - } + gAgent.sendReliableMessage(); + } } void LLAvatarPropertiesProcessor::sendPickDelete( const LLUUID& pick_id ) { - LLMessageSystem* msg = gMessageSystem; - msg->newMessage(_PREHASH_PickDelete); - msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock(_PREHASH_Data); - msg->addUUID(_PREHASH_PickID, pick_id); - gAgent.sendReliableMessage(); + LLMessageSystem* msg = gMessageSystem; + msg->newMessage(_PREHASH_PickDelete); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_PickID, pick_id); + gAgent.sendReliableMessage(); - LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); - LLAgentPicksInfo::getInstance()->decrementNumberOfPicks(); + LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); + LLAgentPicksInfo::getInstance()->decrementNumberOfPicks(); } void LLAvatarPropertiesProcessor::sendClassifiedDelete(const LLUUID& classified_id) { - LLMessageSystem* msg = gMessageSystem; + LLMessageSystem* msg = gMessageSystem; - msg->newMessage(_PREHASH_ClassifiedDelete); + msg->newMessage(_PREHASH_ClassifiedDelete); - msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock(_PREHASH_Data); - msg->addUUID(_PREHASH_ClassifiedID, classified_id); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, classified_id); - gAgent.sendReliableMessage(); + gAgent.sendReliableMessage(); } void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* interests_data) @@ -729,138 +729,138 @@ void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLInterestsData* msg->newMessage(_PREHASH_AvatarInterestsUpdate); msg->nextBlockFast( _PREHASH_AgentData); - msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); + msg->addUUIDFast( _PREHASH_AgentID, gAgent.getID() ); msg->addUUIDFast( _PREHASH_SessionID, gAgent.getSessionID() ); msg->nextBlockFast( _PREHASH_PropertiesData); - msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); - msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); - msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask); - msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text); + msg->addU32Fast( _PREHASH_WantToMask, interests_data->want_to_mask); + msg->addStringFast( _PREHASH_WantToText, interests_data->want_to_text); + msg->addU32Fast( _PREHASH_SkillsMask, interests_data->skills_mask); + msg->addStringFast( _PREHASH_SkillsText, interests_data->skills_text); msg->addString( _PREHASH_LanguagesText, interests_data->languages_text); - + gAgent.sendReliableMessage(); } void LLAvatarPropertiesProcessor::sendPickInfoUpdate(const LLPickData* new_pick) { - if (!new_pick) return; + if (!new_pick) return; - LLMessageSystem* msg = gMessageSystem; + LLMessageSystem* msg = gMessageSystem; - msg->newMessage(_PREHASH_PickInfoUpdate); - msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->newMessage(_PREHASH_PickInfoUpdate); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock(_PREHASH_Data); - msg->addUUID(_PREHASH_PickID, new_pick->pick_id); - msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_PickID, new_pick->pick_id); + msg->addUUID(_PREHASH_CreatorID, new_pick->creator_id); - //legacy var need to be deleted - msg->addBOOL(_PREHASH_TopPick, FALSE); + //legacy var need to be deleted + msg->addBOOL(_PREHASH_TopPick, FALSE); - // fills in on simulator if null - msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id); - msg->addString(_PREHASH_Name, new_pick->name); - msg->addString(_PREHASH_Desc, new_pick->desc); - msg->addUUID(_PREHASH_SnapshotID, new_pick->snapshot_id); - msg->addVector3d(_PREHASH_PosGlobal, new_pick->pos_global); + // fills in on simulator if null + msg->addUUID(_PREHASH_ParcelID, new_pick->parcel_id); + msg->addString(_PREHASH_Name, new_pick->name); + msg->addString(_PREHASH_Desc, new_pick->desc); + msg->addUUID(_PREHASH_SnapshotID, new_pick->snapshot_id); + msg->addVector3d(_PREHASH_PosGlobal, new_pick->pos_global); - // Only top picks have a sort order - msg->addS32(_PREHASH_SortOrder, 0); + // Only top picks have a sort order + msg->addS32(_PREHASH_SortOrder, 0); - msg->addBOOL(_PREHASH_Enabled, new_pick->enabled); - gAgent.sendReliableMessage(); + msg->addBOOL(_PREHASH_Enabled, new_pick->enabled); + gAgent.sendReliableMessage(); - LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); + LLAgentPicksInfo::getInstance()->requestNumberOfPicks(); } void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data) { - if(!c_data) - { - return; - } + if(!c_data) + { + return; + } - LLMessageSystem* msg = gMessageSystem; + LLMessageSystem* msg = gMessageSystem; - msg->newMessage(_PREHASH_ClassifiedInfoUpdate); + msg->newMessage(_PREHASH_ClassifiedInfoUpdate); - msg->nextBlock(_PREHASH_AgentData); - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlock(_PREHASH_AgentData); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock(_PREHASH_Data); - msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id); - msg->addU32(_PREHASH_Category, c_data->category); - msg->addString(_PREHASH_Name, c_data->name); - msg->addString(_PREHASH_Desc, c_data->description); - msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id); - msg->addU32(_PREHASH_ParentEstate, 0); - msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id); - msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global); - msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags); - msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, c_data->classified_id); + msg->addU32(_PREHASH_Category, c_data->category); + msg->addString(_PREHASH_Name, c_data->name); + msg->addString(_PREHASH_Desc, c_data->description); + msg->addUUID(_PREHASH_ParcelID, c_data->parcel_id); + msg->addU32(_PREHASH_ParentEstate, 0); + msg->addUUID(_PREHASH_SnapshotID, c_data->snapshot_id); + msg->addVector3d(_PREHASH_PosGlobal, c_data->pos_global); + msg->addU8(_PREHASH_ClassifiedFlags, c_data->flags); + msg->addS32(_PREHASH_PriceForListing, c_data->price_for_listing); - gAgent.sendReliableMessage(); + gAgent.sendReliableMessage(); } void LLAvatarPropertiesProcessor::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id) { - // Must ask for a pick based on the creator id because - // the pick database is distributed to the inventory cluster. JC - std::vector request_params; - request_params.push_back(creator_id.asString() ); - request_params.push_back(pick_id.asString() ); - send_generic_message("pickinforequest", request_params); + // Must ask for a pick based on the creator id because + // the pick database is distributed to the inventory cluster. JC + std::vector request_params; + request_params.push_back(creator_id.asString() ); + request_params.push_back(pick_id.asString() ); + send_generic_message("pickinforequest", request_params); } void LLAvatarPropertiesProcessor::sendClassifiedInfoRequest(const LLUUID& classified_id) { - LLMessageSystem* msg = gMessageSystem; + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage(_PREHASH_ClassifiedInfoRequest); + msg->nextBlock(_PREHASH_AgentData); - msg->newMessage(_PREHASH_ClassifiedInfoRequest); - msg->nextBlock(_PREHASH_AgentData); - - msg->addUUID(_PREHASH_AgentID, gAgent.getID()); - msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUID(_PREHASH_AgentID, gAgent.getID()); + msg->addUUID(_PREHASH_SessionID, gAgent.getSessionID()); - msg->nextBlock(_PREHASH_Data); - msg->addUUID(_PREHASH_ClassifiedID, classified_id); + msg->nextBlock(_PREHASH_Data); + msg->addUUID(_PREHASH_ClassifiedID, classified_id); - gAgent.sendReliableMessage(); + gAgent.sendReliableMessage(); } bool LLAvatarPropertiesProcessor::isPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { - timestamp_map_t::key_type key = std::make_pair(avatar_id, type); - timestamp_map_t::iterator it = mRequestTimestamps.find(key); + timestamp_map_t::key_type key = std::make_pair(avatar_id, type); + timestamp_map_t::iterator it = mRequestTimestamps.find(key); - // Is this a new request? - if (it == mRequestTimestamps.end()) return false; + // Is this a new request? + if (it == mRequestTimestamps.end()) return false; - // We found a request, check if it has timed out - U32 now = time(NULL); - const U32 REQUEST_EXPIRE_SECS = 5; - U32 expires = it->second + REQUEST_EXPIRE_SECS; + // We found a request, check if it has timed out + U32 now = time(NULL); + const U32 REQUEST_EXPIRE_SECS = 5; + U32 expires = it->second + REQUEST_EXPIRE_SECS; - // Request is still pending if it hasn't expired yet - // *NOTE: Expired requests will accumulate in this map, but they are rare, - // the data is small, and they will be updated if the same data is - // re-requested - return (now < expires); + // Request is still pending if it hasn't expired yet + // *NOTE: Expired requests will accumulate in this map, but they are rare, + // the data is small, and they will be updated if the same data is + // re-requested + return (now < expires); } void LLAvatarPropertiesProcessor::addPendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { - timestamp_map_t::key_type key = std::make_pair(avatar_id, type); - U32 now = time(NULL); - // Add or update existing (expired) request - mRequestTimestamps[ key ] = now; + timestamp_map_t::key_type key = std::make_pair(avatar_id, type); + U32 now = time(NULL); + // Add or update existing (expired) request + mRequestTimestamps[ key ] = now; } void LLAvatarPropertiesProcessor::removePendingRequest(const LLUUID& avatar_id, EAvatarProcessorType type) { - timestamp_map_t::key_type key = std::make_pair(avatar_id, type); - mRequestTimestamps.erase(key); + timestamp_map_t::key_type key = std::make_pair(avatar_id, type); + mRequestTimestamps.erase(key); } -- cgit v1.2.3