From dae07a89dfc27a5bcbba4ef90e454a03d85351be Mon Sep 17 00:00:00 2001 From: Zi Ree Date: Fri, 23 Sep 2022 12:00:24 +0200 Subject: [PATCH] FIRE-32184: Online/Offline status not working for non-friends --- indra/newview/llpanelprofile.cpp | 64 ++++++++++++++++++- indra/newview/llpanelprofile.h | 20 ++++++ indra/newview/skins/default/colors.xml | 4 ++ .../xui/en/panel_profile_secondlife.xml | 5 ++ indra/newview/skins/vintage/colors.xml | 4 ++ .../xui/en/panel_profile_secondlife.xml | 4 ++ 6 files changed, 100 insertions(+), 1 deletion(-) diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 655d806637..499e22edd1 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -100,6 +100,8 @@ static const std::string PANEL_PROFILE_VIEW = "panel_profile_view"; static const std::string PROFILE_PROPERTIES_CAP = "AgentProfile"; static const std::string PROFILE_IMAGE_UPLOAD_CAP = "UploadAgentProfileImage"; +// FIRE-32184: Online/Offline status not working for non-friends +const U32 AVATAR_ONLINE_UNDEFINED = 0x1 << 31; ////////////////////////////////////////////////////////////////////////// @@ -164,7 +166,14 @@ void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id) avatar_data->flags = 0; - if (result["online"].asBoolean()) + // FIRE-32184: Online/Offline status not working for non-friends + // if (result["online"].asBoolean()) + if (result["online"].isUndefined()) + { + avatar_data->flags |= AVATAR_ONLINE_UNDEFINED; + } + else if (result["online"].asBoolean()) + // { avatar_data->flags |= AVATAR_ONLINE; } @@ -889,6 +898,8 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife() if (getAvatarId().notNull()) { LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this); + // FIRE-32184: Online/Offline status not working for non-friends + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), &mPropertiesObserver); } if (LLVoiceClient::instanceExists()) @@ -978,6 +989,18 @@ BOOL LLPanelProfileSecondLife::postBuild() return TRUE; } +// FIRE-32184: Online/Offline status not working for non-friends +void LLPanelProfileSecondLife::onAvatarProperties(const LLAvatarData* d) +{ + // only update the "unknown" status if they are showing as online, otherwise + // we still don't know their true status + if (d->agent_id == gAgentID && d->flags & AVATAR_ONLINE) + { + processOnlineStatus(false, true, true); + } +} +// + void LLPanelProfileSecondLife::onOpen(const LLSD& key) { LLPanelProfileTab::onOpen(key); @@ -1157,6 +1180,14 @@ void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avat gAgent.isGodlike() || relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS), (avatar_data->flags & AVATAR_ONLINE)); } + // FIRE-32184: Online/Offline status not working for non-friends + else if (avatar_data->flags & AVATAR_ONLINE_UNDEFINED) + { + // being a friend who doesn't show online status and appears online can't happen + // so this is our marker for "undefined" + processOnlineStatus(true, false, true); + } + // fillCommonData(avatar_data); @@ -1601,6 +1632,23 @@ void LLPanelProfileSecondLife::updateOnlineStatus() void LLPanelProfileSecondLife::processOnlineStatus(bool is_friend, bool show_online, bool online) { + // FIRE-32184: Online/Offline status not working for non-friends + // being a friend who doesn't show online status and appears online can't happen + // so this is our marker for "undefined" + if (is_friend && !show_online && online) + { + mStatusText->setVisible(true); + mStatusText->setValue(getString("status_unknown")); + mStatusText->setColor(LLUIColorTable::getInstance()->getColor("StatusUserUnknown")); + + mPropertiesObserver.mPanelProfile = this; + mPropertiesObserver.mRequester = gAgentID; + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), &mPropertiesObserver); + LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesRequest(getAvatarId()); + + return; + } + // // Fix LL UI/UX design accident //childSetVisible("frind_layout", is_friend); //childSetVisible("online_layout", online && show_online); @@ -3085,3 +3133,17 @@ void LLPanelProfile::createClassified() mTabContainer->selectTabPanel(mPanelClassifieds); } +// FIRE-32184: Online/Offline status not working for non-friends +FSPanelPropertiesObserver::FSPanelPropertiesObserver() : LLAvatarPropertiesObserver(), + mPanelProfile(nullptr) +{ +} + +void FSPanelPropertiesObserver::processProperties(void* data, EAvatarProcessorType type) +{ + if (type == APT_PROPERTIES && mPanelProfile) + { + mPanelProfile->onAvatarProperties(static_cast(data)); + } +} +// diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 790ac18ae4..1ff9babe8c 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -63,6 +63,20 @@ class LLPanelProfileClassifieds; class LLPanelProfilePicks; class LLViewerFetchedTexture; +// FIRE-32184: Online/Offline status not working for non-friends +class LLPanelProfileSecondLife; + +class FSPanelPropertiesObserver : public LLAvatarPropertiesObserver +{ +public: + FSPanelPropertiesObserver(); + + virtual void processProperties(void* data, EAvatarProcessorType type); + + LLUUID mRequester; + LLPanelProfileSecondLife* mPanelProfile; +}; +// /** * Panel for displaying Avatar's second life related info. @@ -109,6 +123,9 @@ public: friend void request_avatar_properties_coro(std::string cap_url, LLUUID agent_id); + // FIRE-32184: Online/Offline status not working for non-friends + void onAvatarProperties(const LLAvatarData* d); + protected: /** * Process profile related data received from server. @@ -244,6 +261,9 @@ private: boost::signals2::connection mRlvBehaviorCallbackConnection; void updateRlvRestrictions(ERlvBehaviour behavior); // + + // FIRE-32184: Online/Offline status not working for non-friends + FSPanelPropertiesObserver mPropertiesObserver; }; diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index 81a524b4c7..dfa3de05c5 100644 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1165,6 +1165,10 @@ + + Offline + + Unknown + diff --git a/indra/newview/skins/vintage/colors.xml b/indra/newview/skins/vintage/colors.xml index 9040e40f01..b31a81fd6a 100644 --- a/indra/newview/skins/vintage/colors.xml +++ b/indra/newview/skins/vintage/colors.xml @@ -253,6 +253,10 @@ + + diff --git a/indra/newview/skins/vintage/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/vintage/xui/en/panel_profile_secondlife.xml index 8a82fbe3d4..af06673954 100644 --- a/indra/newview/skins/vintage/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/vintage/xui/en/panel_profile_secondlife.xml @@ -16,6 +16,10 @@ name="status_offline"> Offline + + Unknown + [ACCTTYPE]