From d4a799a1a8ce11a808c97d73c03f16d3b3e41597 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 27 May 2022 17:55:04 +0300 Subject: SL-15312 Online status --- indra/newview/llpanelprofile.cpp | 55 ++++++----- indra/newview/llpanelprofile.h | 4 +- .../textures/icons/Profile_Friend_Offline.png | Bin 0 -> 208 bytes .../textures/icons/Profile_Friend_Online.png | Bin 0 -> 189 bytes indra/newview/skins/default/textures/textures.xml | 2 + .../default/xui/en/panel_profile_secondlife.xml | 108 +++++++++++++++++++-- 6 files changed, 128 insertions(+), 41 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png create mode 100644 indra/newview/skins/default/textures/icons/Profile_Friend_Online.png (limited to 'indra/newview') diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 38308f2498..8a07315035 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -946,12 +946,13 @@ void LLPanelProfileSecondLife::resetData() void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avatar_data) { LLUUID avatar_id = getAvatarId(); - if (!LLAvatarActions::isFriend(avatar_id) && !getSelfProfile()) + const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); + if (relationship != NULL && !getSelfProfile()) { // subscribe observer to get online status. Request will be sent by LLPanelProfileSecondLife itself. // do not subscribe for friend avatar because online status can be wrong overridden // via LLAvatarData::flags if Preferences: "Only Friends & Groups can see when I am online" is set. - processOnlineStatus(avatar_data->flags & AVATAR_ONLINE); + processOnlineStatus(relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS), avatar_data->flags & AVATAR_ONLINE); } fillCommonData(avatar_data); @@ -1141,6 +1142,10 @@ void LLPanelProfileSecondLife::fillRightsData() } childSetVisible("permissions_panel", NULL != relation); + childSetVisible("spacer_layout", NULL == relation); + childSetVisible("frind_layout", NULL != relation); + childSetVisible("online_layout", false); + childSetVisible("offline_layout", false); } void LLPanelProfileSecondLife::onImageLoaded(BOOL success, LLViewerFetchedTexture *imagep) @@ -1188,10 +1193,7 @@ void LLPanelProfileSecondLife::onImageLoaded(BOOL success, // virtual, called by LLAvatarTracker void LLPanelProfileSecondLife::changed(U32 mask) { - if (mask & LLFriendObserver::ONLINE) - { - updateOnlineStatus(); - } + updateOnlineStatus(); if (mask != LLFriendObserver::ONLINE) { fillRightsData(); @@ -1227,35 +1229,32 @@ void LLPanelProfileSecondLife::setAvatarId(const LLUUID& avatar_id) } } -bool LLPanelProfileSecondLife::isGrantedToSeeOnlineStatus() -{ - // set text box visible to show online status for non-friends who has not set in Preferences - // "Only Friends & Groups can see when I am online" - if (!LLAvatarActions::isFriend(getAvatarId())) - { - return true; - } - - // *NOTE: GRANT_ONLINE_STATUS is always set to false while changing any other status. - // When avatar disallow me to see her online status processOfflineNotification Message is received by the viewer - // see comments for ChangeUserRights template message. EXT-453. - // If GRANT_ONLINE_STATUS flag is changed it will be applied when viewer restarts. EXT-3880 - const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - return relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS); -} - // method was disabled according to EXT-2022. Re-enabled & improved according to EXT-3880 void LLPanelProfileSecondLife::updateOnlineStatus() { - if (!LLAvatarActions::isFriend(getAvatarId())) return; - // For friend let check if he allowed me to see his status const LLRelationship* relationship = LLAvatarTracker::instance().getBuddyInfo(getAvatarId()); - bool online = relationship->isOnline(); - processOnlineStatus(online); + if (relationship != NULL) + { + // For friend let check if he allowed me to see his status + bool online = relationship->isOnline(); + bool perm_granted = relationship->isRightGrantedFrom(LLRelationship::GRANT_ONLINE_STATUS); + processOnlineStatus(perm_granted, online); + } + else + { + childSetVisible("spacer_layout", true); + childSetVisible("frind_layout", false); + childSetVisible("online_layout", false); + childSetVisible("offline_layout", false); + } } -void LLPanelProfileSecondLife::processOnlineStatus(bool online) +void LLPanelProfileSecondLife::processOnlineStatus(bool show_online, bool online) { + childSetVisible("spacer_layout", false); + childSetVisible("frind_layout", true); + childSetVisible("online_layout", online && show_online); + childSetVisible("offline_layout", !online && show_online); } void LLPanelProfileSecondLife::setLoaded() diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index b53a892ba6..cf3b6c0eb1 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -147,8 +147,6 @@ protected: BOOL final, void* userdata); - bool isGrantedToSeeOnlineStatus(); - /** * Displays avatar's online status if possible. * @@ -162,7 +160,7 @@ protected: * - Else: Offline */ void updateOnlineStatus(); - void processOnlineStatus(bool online); + void processOnlineStatus(bool show_online, bool online); private: /*virtual*/ void setLoaded(); diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png new file mode 100644 index 0000000000..aeba6b70f7 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Profile_Friend_Offline.png differ diff --git a/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png b/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png new file mode 100644 index 0000000000..d668fd8dfa Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Profile_Friend_Online.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 02d48bb0d6..a21099ca9b 100644 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -510,6 +510,8 @@ with the same filename but different name + + diff --git a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml index 56cf673e19..853e782de1 100644 --- a/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml +++ b/indra/newview/skins/default/xui/en/panel_profile_secondlife.xml @@ -123,10 +123,11 @@ Account: [ACCTTYPE] top_pad="0" left_delta="0" right="-1" - height="64" + height="80" follows="left|top|right" layout="topleft" animate="false" + border_size="0" orientation="vertical"> - + + + + + + + + + + + + +