diff --git a/indra/newview/llavatarpropertiesprocessor.cpp b/indra/newview/llavatarpropertiesprocessor.cpp index 715649e8443917fe7e9924aaee3b4a15267d7548..322ccde9c040d96c5adeb4be72d750ab7d2b0d68 100644 --- a/indra/newview/llavatarpropertiesprocessor.cpp +++ b/indra/newview/llavatarpropertiesprocessor.cpp @@ -181,6 +181,21 @@ void LLAvatarPropertiesProcessor::sendAvatarLegacyPropertiesRequest(const LLUUID sendRequest(avatar_id, APT_PROPERTIES_LEGACY, "AvatarPropertiesRequest"); } +void LLAvatarPropertiesProcessor::sendAvatarLegacyPicksRequest(const LLUUID& avatar_id) +{ + sendGenericRequest(avatar_id, APT_PICKS, "avatarpicksrequest"); +} + +void LLAvatarPropertiesProcessor::sendAvatarLegacyNotesRequest(const LLUUID& avatar_id) +{ + sendGenericRequest(avatar_id, APT_NOTES, "avatarnotesrequest"); +} + +void LLAvatarPropertiesProcessor::sendAvatarLegacyGroupsRequest(const LLUUID& avatar_id) +{ + sendGenericRequest(avatar_id, APT_GROUPS, "avatargroupsrequest"); +} + void LLAvatarPropertiesProcessor::sendAvatarTexturesRequest(const LLUUID& avatar_id) { sendGenericRequest(avatar_id, APT_TEXTURES, "avatartexturesrequest"); @@ -311,7 +326,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 inst.mIsHideAgeSupportedByServer = result.has("hide_age"); - avatar_data.hide_age = inst.isHideAgeSupportedByServer() && result["hide_age"].asBoolean(); + 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(); @@ -415,6 +430,21 @@ void LLAvatarPropertiesProcessor::processAvatarInterestsReply(LLMessageSystem* m 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 */ + + LLLegacyInterestsData 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**) @@ -664,6 +694,27 @@ void LLAvatarPropertiesProcessor::sendClassifiedInfoUpdate(const LLAvatarClassif gAgent.sendReliableMessage(); } +void LLAvatarPropertiesProcessor::sendInterestsInfoUpdate(const LLLegacyInterestsData* 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::sendPickInfoRequest(const LLUUID& creator_id, const LLUUID& pick_id) { // Must ask for a pick based on the creator id because diff --git a/indra/newview/llavatarpropertiesprocessor.h b/indra/newview/llavatarpropertiesprocessor.h index c73cc69e624f1921a0039fd3d6b1b0213c1560ca..594d6a1e06e5d7588dd2866dce13f91a93fb57d5 100644 --- a/indra/newview/llavatarpropertiesprocessor.h +++ b/indra/newview/llavatarpropertiesprocessor.h @@ -58,7 +58,8 @@ enum EAvatarProcessorType APT_PICK_INFO, APT_TEXTURES, APT_CLASSIFIEDS, - APT_CLASSIFIED_INFO + APT_CLASSIFIED_INFO, + APT_INTERESTS_INFO // legacy support. don't be lazy and keep this. :O) }; // legacy data is supposed to match AvatarPropertiesReply, @@ -83,6 +84,18 @@ struct LLAvatarLegacyData U32 flags; }; +// Don't belete my sexy InterestsData. +struct LLLegacyInterestsData +{ + LLUUID agent_id; + LLUUID avatar_id; // target id + U32 want_to_mask; + std::string want_to_text; + U32 skills_mask; + std::string skills_text; + std::string languages_text; +}; + struct LLAvatarData { LLUUID agent_id; @@ -259,6 +272,9 @@ class LLAvatarPropertiesProcessor // suppressed while waiting for a response from the network. void sendAvatarPropertiesRequest(const LLUUID& avatar_id); void sendAvatarLegacyPropertiesRequest(const LLUUID& avatar_id); + void sendAvatarLegacyPicksRequest(const LLUUID& avatar_id); + void sendAvatarLegacyNotesRequest(const LLUUID& avatar_id); + void sendAvatarLegacyGroupsRequest(const LLUUID& avatar_id); void sendAvatarTexturesRequest(const LLUUID& avatar_id); void sendAvatarClassifiedsRequest(const LLUUID& avatar_id); @@ -271,6 +287,8 @@ class LLAvatarPropertiesProcessor void sendClassifiedInfoUpdate(const LLAvatarClassifiedInfo* c_data); + void sendInterestsInfoUpdate(const LLLegacyInterestsData* interests_data); + void sendFriendRights(const LLUUID& avatar_id, S32 rights); void sendPickDelete(const LLUUID& pick_id); diff --git a/indra/newview/llpanelprofilelegacy.cpp b/indra/newview/llpanelprofilelegacy.cpp index de6167984017908e9b8af14a5766c9fea5ec6b1d..cdb1128cdf3b028947432e5dfd007fad17db0e05 100644 --- a/indra/newview/llpanelprofilelegacy.cpp +++ b/indra/newview/llpanelprofilelegacy.cpp @@ -2,7 +2,7 @@ * @file llpanelprofilelegacy.cpp * @brief Legacy protocol avatar profile panel * - * Copyright (c) 2014-2022, Cinder Roxley <cinder@sdf.org> + * Copyright (c) 2014-2024, Cinder Roxley <cinder@sdf.org> * * Permission is hereby granted, free of charge, to any person or organization * obtaining a copy of the software and accompanying documentation covered by @@ -513,8 +513,12 @@ void LLPanelProfileLegacy::processProperties(void* data, EAvatarProcessorType ty showTab("avatar_groups_tab", !pData->group_list.empty()); break; } - // These are handled by their respective panels case APT_PICKS: + { + mPanelPicks->processProperties(data, APT_PICKS); + break; + } + // These are handled by their respective panels case APT_CLASSIFIEDS: case APT_PICK_INFO: case APT_CLASSIFIED_INFO: @@ -874,33 +878,31 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::updateData() void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EAvatarProcessorType type) { - if (APT_PICKS == type) + if (APT_PROPERTIES == type) + { + LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data); + if (!avatar_data || getAvatarId() != avatar_data->avatar_id) { return; } + if (getAvatarId() == gAgentID) + { + LLAgentPicksInfo::getInstance()->onServerRespond(avatar_data); + } + mPicksList->clear(); + for (const LLAvatarPicks::pick_data_t& pick : avatar_data->picks_list) + { + LL_INFOS() << "Porcessing pick " << pick.second << LL_ENDL; + processPick(pick); + } + showAccordion("tab_picks", mPicksList->size()); + } + // LEGACY CODE, OH SCARY SO HARD TO MAINE TAINE + else if (APT_PICKS == type) { mPicksList->clear(); LLAvatarPicks* avatar_picks = static_cast<LLAvatarPicks*>(data); if (!avatar_picks || getAvatarId() != avatar_picks->target_id) return; for (const LLAvatarPicks::pick_data_t& pick: avatar_picks->picks_list) { - const LLUUID pick_id = pick.first; - const std::string pick_name = pick.second; - - LLPickItem* picture = LLPickItem::create(); - picture->childSetAction("info_chevron", boost::bind(&LLPanelProfilePicks::onClickInfo, this)); - picture->setPickName(pick_name); - picture->setPickId(pick_id); - picture->setCreatorId(getAvatarId()); - - LLAvatarPropertiesProcessor::instance().addObserver(getAvatarId(), picture); - picture->update(); - - LLSD pick_value = LLSD(); - pick_value.insert(PICK_ID, pick_id); - pick_value.insert(PICK_NAME, pick_name); - pick_value.insert(PICK_CREATOR_ID, getAvatarId()); - - mPicksList->addItem(picture, pick_value); - picture->setMouseUpCallback(boost::bind(&LLPanelProfilePicks::updateButtons, this)); - picture->setRightMouseUpCallback(boost::bind(&LLPanelProfilePicks::onRightMouseUpItem, this, _1, _2, _3, _4)); + processPick(pick); } showAccordion("tab_picks", mPicksList->size()); } @@ -931,6 +933,30 @@ void LLPanelProfileLegacy::LLPanelProfilePicks::processProperties(void* data, EA updateButtons(); } +void LLPanelProfileLegacy::LLPanelProfilePicks::processPick(LLAvatarData::pick_data_t const& pick) +{ + const LLUUID pick_id = pick.first; + const std::string pick_name = pick.second; + + LLPickItem* picture = LLPickItem::create(); + picture->childSetAction("info_chevron", boost::bind(&LLPanelProfilePicks::onClickInfo, this)); + picture->setPickName(pick_name); + picture->setPickId(pick_id); + picture->setCreatorId(getAvatarId()); + + LLAvatarPropertiesProcessor::instance().addObserver(getAvatarId(), picture); + picture->update(); + + LLSD pick_value = LLSD(); + pick_value.insert(PICK_ID, pick_id); + pick_value.insert(PICK_NAME, pick_name); + pick_value.insert(PICK_CREATOR_ID, getAvatarId()); + + mPicksList->addItem(picture, pick_value); + picture->setMouseUpCallback(boost::bind(&LLPanelProfilePicks::updateButtons, this)); + picture->setRightMouseUpCallback(boost::bind(&LLPanelProfilePicks::onRightMouseUpItem, this, _1, _2, _3, _4)); +} + void LLPanelProfileLegacy::LLPanelProfilePicks::showAccordion(const std::string& name, bool show) { getChild<LLAccordionCtrlTab>(name)->setVisible(show); diff --git a/indra/newview/llpanelprofilelegacy.h b/indra/newview/llpanelprofilelegacy.h index 9c30519ab5c49af4e66117e632c30fce82f73a80..d81a86af3adfc7bef890908762cbe8edda46bbe3 100644 --- a/indra/newview/llpanelprofilelegacy.h +++ b/indra/newview/llpanelprofilelegacy.h @@ -2,7 +2,7 @@ * @file llpanelprofilelegacy.h * @brief Legacy protocol avatar profile panel * - * Copyright (c) 2014-2022, Cinder Roxley <cinder@sdf.org> + * Copyright (c) 2014-2024, Cinder Roxley <cinder@sdf.org> * * Permission is hereby granted, free of charge, to any person or organization * obtaining a copy of the software and accompanying documentation covered by @@ -128,6 +128,7 @@ class LLPanelProfileLegacy final : public LLPanelProfileLegacyTab private: void updateData() override; void processProperties(void* data, EAvatarProcessorType type) override; + void processPick(LLAvatarData::pick_data_t const& pick); void resetControls() override {}; void showAccordion(const std::string& name, bool show); void setProfilePanel(LLPanelProfileLegacy* profile_panel);