FIRE-32184: Online/Offline status not working for non-friends

master
Zi Ree 2022-09-23 12:00:24 +02:00
parent 76e4c916e5
commit dae07a89df
6 changed files with 100 additions and 1 deletions

View File

@ -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";
// <FS:Zi> 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())
// <FS:Zi> 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())
// </FS:Zi>
{
avatar_data->flags |= AVATAR_ONLINE;
}
@ -889,6 +898,8 @@ LLPanelProfileSecondLife::~LLPanelProfileSecondLife()
if (getAvatarId().notNull())
{
LLAvatarTracker::instance().removeParticularFriendObserver(getAvatarId(), this);
// <FS:Zi> 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;
}
// <FS:Zi> 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);
}
}
// </FS:Zi>
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));
}
// <FS:Zi> 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);
}
// </FS:Zi>
fillCommonData(avatar_data);
@ -1601,6 +1632,23 @@ void LLPanelProfileSecondLife::updateOnlineStatus()
void LLPanelProfileSecondLife::processOnlineStatus(bool is_friend, bool show_online, bool online)
{
// <FS:Zi> 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;
}
// </FS:Zi>
// <FS:Ansariel> 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);
}
// <FS:Zi> 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<const LLAvatarData*>(data));
}
}
// </FS:Zi>

View File

@ -63,6 +63,20 @@ class LLPanelProfileClassifieds;
class LLPanelProfilePicks;
class LLViewerFetchedTexture;
// <FS:Zi> 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;
};
// </FS:Zi>
/**
* 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);
// <FS:Zi> 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);
// </FS:Ansariel>
// <FS:Zi> FIRE-32184: Online/Offline status not working for non-friends
FSPanelPropertiesObserver mPropertiesObserver;
};

View File

@ -1165,6 +1165,10 @@
<color
name="StatusUserOffline"
reference="BrightRed" />
<!-- for legacy profiles -->
<color
name="StatusUserUnknown"
reference="White" />
<!-- Groups visible in profiles -->
<color

View File

@ -19,6 +19,11 @@
>
Offline
</string>
<string
name="status_unknown"
>
Unknown
</string>
<string
name="CaptionTextAcctInfo"
>

View File

@ -253,6 +253,10 @@
<color
name="StatusUserOffline"
reference="LabelDisabledColor" />
<!-- for legacy profiles -->
<color
name="StatusUserUnknown"
reference="EmphasisColor" />
<color
name="ChatTimestampColor"
value="0.5 0.5 0.5 1.0" />

View File

@ -16,6 +16,10 @@
name="status_offline">
Offline
</string>
<string
name="status_unknown">
Unknown
</string>
<string
name="CaptionTextAcctInfo">
[ACCTTYPE]