bool LLPanelAvatarProfile::enableShowOnMap() { bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); bool enable_map_btn = (is_buddy_online && is_agent_mappable(getAvatarId())) || gAgent.isGodlike(); return enable_map_btn; }
void add_map_option(LLComboBox& flyout, const std::string& map, const LLUUID& id, U8& did) { flyout.remove(map); if (is_agent_mappable(id) && LLAvatarTracker::instance().isBuddyOnline(id)) { flyout.add(map, -2); did |= 0x02; // Added map, needs rebuild. } did |= 0x01; // Checked map }
void LLPanelProfileTab::updateButtons() { bool is_buddy_online = LLAvatarTracker::instance().isBuddyOnline(getAvatarId()); if(LLAvatarActions::isFriend(getAvatarId())) { childSetEnabled("teleport", is_buddy_online); } else { childSetEnabled("teleport", true); } bool enable_map_btn = (is_buddy_online && is_agent_mappable(getAvatarId())) || gAgent.isGodlike(); childSetEnabled("show_on_map_btn", enable_map_btn); }
bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); // Note: can_block and can_delete is used only for one person selected menu // so we don't need to go over all uuids. if (item == std::string("can_block")) { const LLUUID& id = mUUIDs.front(); return LLAvatarActions::canBlock(id); } else if (item == std::string("can_add")) { // We can add friends if: // - there are selected people // - and there are no friends among selection yet. //EXT-7389 - disable for more than 1 if(mUUIDs.size() > 1) { return false; } bool result = (mUUIDs.size() > 0); uuid_vec_t::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); for (;id != uuids_end; ++id) { if ( LLAvatarActions::isFriend(*id) ) { result = false; break; } } return result; } else if (item == std::string("can_delete")) { // We can remove friends if: // - there are selected people // - and there are only friends among selection. bool result = (mUUIDs.size() > 0); uuid_vec_t::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); for (;id != uuids_end; ++id) { if ( !LLAvatarActions::isFriend(*id) ) { result = false; break; } } return result; } else if (item == std::string("can_call")) { return LLAvatarActions::canCall(); } else if (item == std::string("can_show_on_map")) { const LLUUID& id = mUUIDs.front(); return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) || gAgent.isGodlike(); } // <FS> Prevent teleport button from being disabled when someone on your // friends list logs out but is still in the region and you have // multiple people selected. //else if(item == std::string("can_offer_teleport")) //{ // return LLAvatarActions::canOfferTeleport(mUUIDs); //} // </FS> return false; }
bool NearbyMenu::enableContextMenuItem(const LLSD& userdata) { std::string item = userdata.asString(); // Note: can_block and can_delete is used only for one person selected menu // so we don't need to go over all uuids. if (item == std::string("can_block")) { const LLUUID& id = mUUIDs.front(); return LLAvatarActions::canBlock(id); } else if (item == std::string("can_add")) { // We can add friends if: // - there are selected people // - and there are no friends among selection yet. bool result = (mUUIDs.size() > 0); std::vector<LLUUID>::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); for (;id != uuids_end; ++id) { if ( LLAvatarActions::isFriend(*id) ) { result = false; break; } } return result; } else if (item == std::string("can_delete")) { // We can remove friends if: // - there are selected people // - and there are only friends among selection. bool result = (mUUIDs.size() > 0); std::vector<LLUUID>::const_iterator id = mUUIDs.begin(), uuids_end = mUUIDs.end(); for (;id != uuids_end; ++id) { if ( !LLAvatarActions::isFriend(*id) ) { result = false; break; } } return result; } else if (item == std::string("can_call")) { return LLAvatarActions::canCall(); } else if (item == std::string("can_show_on_map")) { const LLUUID& id = mUUIDs.front(); return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id)) || gAgent.isGodlike(); } return false; }
bool LLInspectAvatar::onVisibleFindOnMap() { return gAgent.isGodlike() || is_agent_mappable(mAvatarID); }
void PanelRadar::updateButtonStates() { static bool enable = false; static bool enable_unmute = false; static bool enable_track = false; static bool enable_estate = false; static bool enable_friend = false; static bool enable_cam = false; if (mRadarTabs->getCurrentPanelIndex() == 0) // Avatar tab { mRadarList->setDoubleClickCallback(onClickIM); } else // Estate tab { mRadarList->setDoubleClickCallback(onClickCam); } if (hasFocus() && mSelectedAvatar.notNull()) { enable = visibleItemsSelected(); enable_estate = isKickable(mSelectedAvatar); enable_unmute = LLMuteList::getInstance()->isMuted(mSelectedAvatar); enable_track = gAgent.isGodlike() || is_agent_mappable(mSelectedAvatar); enable_friend = !is_agent_friend(mSelectedAvatar); enable_cam = mSelectedDistance >= 0 && mSelectedDistance <= gSavedSettings.getF32("NearMeRange"); } else { mRadarList->deselect(); enable = false; enable_estate = false; enable_unmute = false; enable_track = false; enable_friend = false; enable_cam = false; } childSetEnabled("im_btn", enable); childSetEnabled("profile_btn", enable); childSetEnabled("offer_teleport_btn", enable); childSetEnabled("teleport_btn", enable); childSetEnabled("track_btn", enable_track); childSetEnabled("invite_btn", enable); childSetEnabled("add_btn", enable); childSetEnabled("cam_btn", enable_cam); childSetEnabled("freeze_btn", enable_estate); childSetEnabled("eject_btn", enable_estate); childSetEnabled("ban_btn", enable_estate); childSetEnabled("mute_btn", enable); childSetEnabled("ar_btn", enable); //childSetEnabled("estate_eject_btn", enable_estate); //childSetEnabled("estate_ban_btn", enable_estate); if (enable_unmute) { childSetVisible("mute_btn", false); childSetEnabled("unmute_btn", true); childSetVisible("unmute_btn", true); } else { childSetVisible("mute_btn", true); childSetVisible("unmute_btn", false); } // [RLVa:KB] - Imprudence-1.2.0 // Bit clumsy, but this way the RLV stuff is in its own separate // block and keeps the code above clean - Kitty if ( (rlv_handler_t::isEnabled()) && (mSelectedAvatar.notNull()) ) { if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) { childSetEnabled("im_btn", false); childSetEnabled("profile_btn", false); childSetEnabled("invite_btn", false); childSetEnabled("add_btn", false); childSetEnabled("mute_btn", false); childSetEnabled("unmute_btn", false); childSetEnabled("cam_btn", false); childSetEnabled("teleport_btn", false); } // Even though the avie is in the same sim (so they already know // where we are) the tp would just get blocked by different code // so it's actually less confusing to the user if we just disable // the teleport button here so they'll at least have a visual cue BOOL rlv_enable_tp = (!gRlvHandler.hasBehaviour(RLV_BHVR_TPLURE)) || (gRlvHandler.isException(RLV_BHVR_TPLURE, mSelectedAvatar)); if ( (rlv_enable_tp) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) { const LLRelationship* pBuddyInfo = LLAvatarTracker::instance().getBuddyInfo(mSelectedAvatar); if ( ((!pBuddyInfo) || (!pBuddyInfo->isOnline()) || (!pBuddyInfo->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION))) ) rlv_enable_tp = FALSE; } childSetEnabled("offer_teleport_btn", rlv_enable_tp); } // [/RLVa:KB] }
// virtual BOOL LLFloaterIMPanel::postBuild() { requires<LLLineEditor>("chat_editor"); requires<LLTextEditor>("im_history"); if (checkRequirements()) { setTitle(mLogLabel); if (mSessionType == P2P_SESSION && LLVoiceClient::getInstance()->isParticipantAvatar(mSessionUUID)) LLAvatarNameCache::get(mOtherParticipantUUID, boost::bind(&LLFloaterIMPanel::onAvatarNameLookup, this, _2)); mInputEditor = getChild<LLLineEditor>("chat_editor"); mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); mInputEditor->setFocusReceivedCallback( boost::bind(&LLFloaterIMPanel::onInputEditorFocusReceived, this) ); mInputEditor->setFocusLostCallback(boost::bind(&LLFloaterIMPanel::setTyping, this, false)); mInputEditor->setKeystrokeCallback( boost::bind(&LLFloaterIMPanel::onInputEditorKeystroke, this, _1) ); mInputEditor->setCommitCallback( boost::bind(&LLFloaterIMPanel::onSendMsg,this) ); mInputEditor->setCommitOnFocusLost( FALSE ); mInputEditor->setRevertOnEsc( FALSE ); mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); mInputEditor->setPassDelete( TRUE ); if (LLComboBox* flyout = findChild<LLComboBox>("instant_message_flyout")) { flyout->setCommitCallback(boost::bind(&LLFloaterIMPanel::onFlyoutCommit, this, flyout, _2)); if (is_agent_mappable(mOtherParticipantUUID)) flyout->add(getString("find on map"), -2); addDynamics(flyout); } if (LLUICtrl* ctrl = findChild<LLUICtrl>("tp_btn")) ctrl->setCommitCallback(boost::bind(static_cast<void(*)(const LLUUID&)>(LLAvatarActions::offerTeleport), mOtherParticipantUUID)); if (LLUICtrl* ctrl = findChild<LLUICtrl>("pay_btn")) ctrl->setCommitCallback(boost::bind(LLAvatarActions::pay, mOtherParticipantUUID)); if (LLButton* btn = findChild<LLButton>("group_info_btn")) btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID)); if (LLUICtrl* ctrl = findChild<LLUICtrl>("history_btn")) ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickHistory, this)); getChild<LLButton>("start_call_btn")->setCommitCallback(boost::bind(&LLIMMgr::startCall, gIMMgr, boost::ref(mSessionUUID), LLVoiceChannel::OUTGOING_CALL)); getChild<LLButton>("end_call_btn")->setCommitCallback(boost::bind(&LLIMMgr::endCall, gIMMgr, boost::ref(mSessionUUID))); getChild<LLButton>("send_btn")->setCommitCallback(boost::bind(&LLFloaterIMPanel::onSendMsg,this)); if (LLButton* btn = findChild<LLButton>("toggle_active_speakers_btn")) btn->setCommitCallback(boost::bind(&LLView::setVisible, getChildView("active_speakers_panel"), _2)); mHistoryEditor = getChild<LLViewerTextEditor>("im_history"); mHistoryEditor->setParseHTML(TRUE); mHistoryEditor->setParseHighlights(TRUE); sTitleString = getString("title_string"); sTypingStartString = getString("typing_start_string"); sSessionStartString = getString("session_start_string"); if (mSpeakerPanel) { mSpeakerPanel->refreshSpeakers(); } if (mSessionType == P2P_SESSION) { getChild<LLUICtrl>("mute_btn")->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickMuteVoice, this)); getChild<LLUICtrl>("speaker_volume")->setCommitCallback(boost::bind(&LLVoiceClient::setUserVolume, LLVoiceClient::getInstance(), mOtherParticipantUUID, _2)); } setDefaultBtn("send_btn"); mVolumeSlider.connect(this,"speaker_volume"); mEndCallBtn.connect(this,"end_call_btn"); mStartCallBtn.connect(this,"start_call_btn"); mSendBtn.connect(this,"send_btn"); mMuteBtn.connect(this,"mute_btn"); return TRUE; } return FALSE; }