Commit d1cbb53a authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Small friend check code cleanup

parent f0662e51
......@@ -1276,7 +1276,7 @@ void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::stri
//static
bool LLAvatarActions::isFriend(const LLUUID& id)
{
return (nullptr != LLAvatarTracker::instance().getBuddyInfo(id) );
return LLAvatarTracker::instance().isBuddy(id);
}
// static
......
......@@ -473,7 +473,7 @@ void LLAvatarTracker::notifyObservers()
friend_observer->changed(mModifyMask);
}
for (auto buddy_id : mChangedBuddyIDs)
for (const auto& buddy_id : mChangedBuddyIDs)
{
notifyParticularFriendObservers(buddy_id);
}
......
......@@ -509,7 +509,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
// object IMs contain sender object id in session_id (STORM-1209)
|| (dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id));
bool is_owned_by_me = false;
bool is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == nullptr) ? false : true;
bool is_friend = LLAvatarTracker::instance().isBuddy(from_id);
bool accept_im_from_only_friend = gSavedSettings.getBOOL("VoiceCallsFriendsOnly");
bool is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
LLMuteList::getInstance()->isLinden(name);
......@@ -1389,7 +1389,7 @@ void LLIMProcessing::processNewMessage(LLUUID from_id,
{
return;
}
else if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL))
else if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && !LLAvatarTracker::instance().isBuddy(from_id))
{
return;
}
......
......@@ -2695,7 +2695,7 @@ void LLIMMgr::addMessage(
if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && !from_linden)
{
// Evaluate if we need to skip this message when that setting is true (default is false)
skip_message = (LLAvatarTracker::instance().getBuddyInfo(other_participant_id) == nullptr); // Skip non friends...
skip_message = !LLAvatarTracker::instance().isBuddy(other_participant_id); // Skip non friends...
skip_message &= !(other_participant_id == gAgentID); // You are your best friend... Don't skip yourself
}
......@@ -3100,7 +3100,7 @@ void LLIMMgr::inviteToSession(
if (voice_invite)
{
bool isRejectGroupCall = (gSavedSettings.getBOOL("VoiceCallsRejectGroup") && (notify_box_type == "VoiceInviteGroup"));
bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(caller_id) == nullptr));
bool isRejectNonFriendCall = (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && !LLAvatarTracker::instance().isBuddy(caller_id));
if (isRejectGroupCall || isRejectNonFriendCall || gAgent.isDoNotDisturb())
{
if (gAgent.isDoNotDisturb() && !isRejectGroupCall && !isRejectNonFriendCall)
......
......@@ -918,14 +918,14 @@ void LLPanelPeople::updateButtons()
if (item_selected)
{
selected_id = selected_uuids.front();
is_friend = LLAvatarTracker::instance().getBuddyInfo(selected_id) != nullptr;
is_friend = LLAvatarTracker::instance().isBuddy(selected_id);
is_self = gAgent.getID() == selected_id;
}
else if (multiple_selected)
{
for (uuid_vec_t::const_iterator itr = selected_uuids.begin(); itr != selected_uuids.end(); ++itr)
{
if (LLAvatarTracker::instance().getBuddyInfo(*itr) != nullptr)
if (LLAvatarTracker::instance().isBuddy(*itr))
{
is_friend = true;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment