diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index bae86672c..fb9383ecb 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -57,6 +57,8 @@ static LLRegisterWidget r("scroll_list"); +LLMenuGL* sScrollListMenus[1] = {}; // List menus that recur, such as general avatars or groups menus + // local structures & classes. struct SortScrollListItem { @@ -2552,7 +2554,15 @@ void LLScrollListCtrl::setScrollListParameters(LLXMLNodePtr node) node->getAttribute_bool("mouse_wheel_opaque", mMouseWheelOpaque); } - if (node->hasAttribute("menu_file")) + if (node->hasAttribute("menu_num")) + { + // Some scroll lists use common menus identified by number + // 0 is menu_avs_list.xml, 1 will be for groups, 2 could be for lists of objects + S32 menu_num; + node->getAttributeS32("menu_num", menu_num); + mPopupMenu = sScrollListMenus[menu_num]; + } + else if (node->hasAttribute("menu_file")) { std::string menu_file; node->getAttributeString("menu_file", menu_file); diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 41f172981..fbcc7c4d4 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -574,9 +574,10 @@ set(viewer_SOURCE_FILES noise.cpp pipeline.cpp qtoolalign.cpp + rlvactions.cpp rlvcommon.cpp rlvextensions.cpp - rlvfloaterbehaviour.cpp + rlvfloaters.cpp rlvhandler.cpp rlvhelper.cpp rlvinventory.cpp @@ -1100,10 +1101,11 @@ set(viewer_HEADER_FILES noise.h pipeline.h qtoolalign.h + rlvactions.h rlvcommon.h rlvdefines.h rlvextensions.h - rlvfloaterbehaviour.h + rlvfloaters.h rlvhandler.h rlvhelper.h rlvinventory.h diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index eceee5233..ce0c3fe93 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -990,6 +990,32 @@ Found in Advanced->Rendering->Info Displays Value + ScriptMessageAPI + + Comment + Channel used for interaction with the Script Message API + Persist + 1 + Type + S32 + Value + 0 + IsCOA + 1 + + ScriptMessageAPIKey + + Comment + Key to encode messages sent to the Script Message API + Persist + 1 + Type + String + Value + Enter Key Here + IsCOA + 1 + UseConciseIMButtons Comment diff --git a/indra/newview/app_settings/settings_rlv.xml b/indra/newview/app_settings/settings_rlv.xml index 7dd83af41..09b3d15fd 100644 --- a/indra/newview/app_settings/settings_rlv.xml +++ b/indra/newview/app_settings/settings_rlv.xml @@ -57,17 +57,6 @@ Value 0 - RestrainedLoveOffsetAvatarZ - - Comment - Offset the avatar. - Persist - 1 - Type - F32 - Value - 0.0 - RestrainedLoveReplaceWhenFolderBeginsWith Comment @@ -222,17 +211,6 @@ Value 0 - WarnFirstRLVGiveToRLV - - Comment - Enables FirstRLVGiveToRLV warning dialog - Persist - 1 - Type - Boolean - Value - 1 - ForceInitialCOFDelay Comment diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 78c5c666e..973466967 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -103,10 +103,11 @@ #include "lluictrlfactory.h" //For LLUICtrlFactory::getLayeredXMLNode -// [RLVa:KB] - Checked: 2010-09-27 (RLVa-1.1.3b) +// [RLVa:KB] - Checked: 2011-11-04 (RLVa-1.4.4a) +#include "rlvactions.h" #include "rlvhandler.h" -#include "rlvinventory.h" -#include "llattachmentsmgr.h" +#include "rlvhelper.h" +#include "rlvui.h" // [/RLVa:KB] #include "NACLantispam.h" // for NaCl Antispam Registry @@ -420,6 +421,7 @@ LLAgent::LLAgent() : mNextFidgetTime(0.f), mCurrentFidget(0), + mCrouch(false), mFirstLogin(FALSE), mGenderChosen(FALSE), mAppearanceSerialNum(0), @@ -639,13 +641,14 @@ void LLAgent::moveUp(S32 direction) if (direction > 0) { setControlFlags(AGENT_CONTROL_UP_POS | AGENT_CONTROL_FAST_UP); + mCrouch = false; } else if (direction < 0) { setControlFlags(AGENT_CONTROL_UP_NEG | AGENT_CONTROL_FAST_UP); } - if (!isCrouch) camera_reset_on_motion(); + if (!mCrouch) camera_reset_on_motion(); } //----------------------------------------------------------------------------- @@ -687,6 +690,11 @@ void LLAgent::movePitch(F32 mag) } } +bool LLAgent::isCrouching() const +{ + return mCrouch && !getFlying(); // Never crouch when flying +} + // Does this parcel allow you to fly? BOOL LLAgent::canFly() @@ -770,6 +778,7 @@ void LLAgent::setFlying(BOOL fly) { LLViewerStats::getInstance()->incStat(LLViewerStats::ST_FLY_COUNT); } + mCrouch = false; setControlFlags(AGENT_CONTROL_FLY); } else @@ -818,17 +827,20 @@ void LLAgent::standUp() // setControlFlags(AGENT_CONTROL_STAND_UP); // [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Added: RLVa-1.2.0a // RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking - if ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand()) ) + if ( (!rlv_handler_t::isEnabled()) || (RlvActions::canStand()) ) { setControlFlags(AGENT_CONTROL_STAND_UP); } // [/RLVa:KB] } + void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) { llinfos << "called" << llendl; + + // Old-style appearance entering a server-bake region. if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) @@ -971,7 +983,6 @@ const LLHost& LLAgent::getRegionHost() const } } - //----------------------------------------------------------------------------- // inPrelude() //----------------------------------------------------------------------------- @@ -1148,7 +1159,7 @@ void LLAgent::sitDown() // setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); // [RLVa:KB] - Checked: 2010-08-28 (RLVa-1.2.1a) | Added: RLVa-1.2.1a // RELEASE-RLVa: [SL-2.0.0] Check this function's callers since usually they require explicit blocking - if ( (!rlv_handler_t::isEnabled()) || ((gRlvHandler.canStand()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) + if ( (!rlv_handler_t::isEnabled()) || ((RlvActions::canStand()) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) { setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } @@ -4330,7 +4341,7 @@ void LLAgent::teleportViaLocationLookAt(const LLVector3d& pos_global) // [RLVa:KB] - Checked: 2010-10-07 (RLVa-1.2.1f) | Added: RLVa-1.2.1f // RELEASE-RLVa: [SL-2.2.0] Make sure this isn't used for anything except double-click teleporting if ( (rlv_handler_t::isEnabled()) && (!RlvUtil::isForceTp()) && - ((gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) || (!gRlvHandler.canStand())) ) + ((gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) || (!RlvActions::canStand())) ) { RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_TELEPORT); return; diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 26501953a..a66b375f4 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -302,6 +302,15 @@ private: F32 mNextFidgetTime; S32 mCurrentFidget; + //-------------------------------------------------------------------- + // Crouch + //-------------------------------------------------------------------- +public: + bool isCrouching() const; + void toggleCrouch() { mCrouch = !mCrouch; } +private: + bool mCrouch; + //-------------------------------------------------------------------- // Fly //-------------------------------------------------------------------- diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 9416febb2..9b71c31d8 100644 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -583,7 +583,7 @@ public: void onWearableAssetFetch(LLViewerWearable *wearable); void onAllComplete(); -// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0) bool pollStopped(); // [/SL:KB] @@ -670,7 +670,7 @@ void LLWearableHoldingPattern::eraseTypeToRecover(LLWearableType::EType type) mTypesToRecover.erase(type); } -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-06-19 (Catznip-3.0.0a) | Added: Catznip-2.1.2a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-06-19 (Catznip-2.1) //void LLWearableHoldingPattern::setObjItems(const LLInventoryModel::item_array_t& items) //{ // mObjItems = items; @@ -780,10 +780,11 @@ void LLWearableHoldingPattern::onAllComplete() LL_INFOS("Avatar") << self_av_string() << "Updating agent wearables with " << mResolved << " wearable items " << LL_ENDL; LLAppearanceMgr::instance().updateAgentWearables(this, false); -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-03-22 (Catznip-3.0.0a) | Added: Catznip-2.1.2a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-03-22 (Catznip-2.1) // // Update attachments to match those requested. // if (isAgentAvatarValid()) // { +// LL_DEBUGS("Avatar") << self_av_string() << "Updating " << mObjItems.count() << " attachments" << LL_ENDL; // llinfos << "Updating " << mObjItems.count() << " attachments" << llendl; // LLAgentWearables::userUpdateAttachments(mObjItems); // } @@ -821,7 +822,7 @@ bool LLWearableHoldingPattern::pollFetchCompletion() // runway skip here? llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; -// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0) // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this)); return true; @@ -897,7 +898,7 @@ void recovered_item_cb(const LLUUID& item_id, LLWearableType::EType type, LLView // runway skip here? llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; -// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0) // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves return; // [/SL:KB] @@ -971,7 +972,7 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables() } } -// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0) bool LLWearableHoldingPattern::pollStopped() { // We have to keep on polling until we're sure that all callbacks have completed or they'll cause a crash @@ -991,7 +992,7 @@ bool LLWearableHoldingPattern::pollMissingWearables() // runway skip here? llwarns << self_av_string() << "skipping because LLWearableHolding pattern is invalid (superceded by later outfit request)" << llendl; -// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-3.0.0a) | Added: Catznip-2.0.0a +// [SL:KB] - Patch: Appearance-COFCorruption | Checked: 2010-04-14 (Catznip-2.0) // If we were signalled to stop then we shouldn't do anything else except poll for when it's safe to delete ourselves doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollStopped, this)); return true; @@ -1386,7 +1387,7 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up if (gInventory.isObjectDescendentOf(item_to_wear->getUUID(), gInventory.getLibraryRootFolderID())) { - LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(&wear_on_avatar_cb,_1,replace)); + LLPointer cb = new LLBoostFuncInventoryCallback(boost::bind(wear_on_avatar_cb,_1,replace)); copy_inventory_item(gAgent.getID(), item_to_wear->getPermissions().getOwner(), item_to_wear->getUUID(), LLUUID::null, std::string(), cb); return false; } @@ -1744,7 +1745,7 @@ bool LLAppearanceMgr::getCanReplaceCOF(const LLUUID& outfit_cat_id) // Check whether it's the base outfit. // if (outfit_cat_id.isNull() || outfit_cat_id == getBaseOutfitUUID()) -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-21 (Catznip-3.0.0a) | Added: Catznip-2.1.2d +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-09-21 (Catznip-2.1) if ( (outfit_cat_id.isNull()) || ((outfit_cat_id == getBaseOutfitUUID()) && (!isOutfitDirty())) ) // [/SL:KB] { @@ -1798,8 +1799,19 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin continue; if (item->getIsLinkType()) { +#if 0 + if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) + { + llinfos << "preserved item" << llendl; + } + else + { + gInventory.purgeObject(item->getUUID()); + } +#else gInventory.purgeObject(item->getUUID()); } +#endif } } @@ -1892,9 +1904,8 @@ void LLAppearanceMgr::filterWearableItems( if (size <= 0) continue; // S32 start_index = llmax(0,size-max_per_type); -// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-05-11 (Catznip-3.0.0a) | Added: Catznip-2.0.0h - S32 start_index = - llmax(0, size - ((LLAssetType::AT_BODYPART == LLWearableType::getAssetType((LLWearableType::EType)i)) ? 1 : max_per_type)); +// [SL:KB] - Patch: Appearance-Misc | Checked: 2010-05-11 (Catznip-2.0) + S32 start_index = llmax(0, size - ((LLAssetType::AT_BODYPART == LLWearableType::getAssetType((LLWearableType::EType)i)) ? 1 : max_per_type)); // [/SL:KB[ for (S32 j = start_index; jgetName() : "[UNKNOWN]") << llendl; +// LL_INFOS("Avatar") << self_av_string() << "starting, cat '" << (pcat ? pcat->getName() : "[UNKNOWN]") << "'" << LL_ENDL; // [RLVa:KB] - Checked: 2010-03-26 (RLVa-1.2.0b) | Added: RLVa-1.2.0b // RELEASE-RLVa: [SL-2.0.0] If pcat ever gets used for anything further down the beta we'll know about it llinfos << "starting" << llendl; @@ -2220,8 +2231,6 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo { gAgentWearables.setWearableOutfit(items, wearables, !append); } - -// dec_busy_count(); } static void remove_non_link_items(LLInventoryModel::item_array_t &items) @@ -2334,7 +2343,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); selfStartPhase("update_appearance_from_cof"); - LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; + LL_DEBUGS("Avatar") << self_av_string() << "starting" << LL_ENDL; //checking integrity of the COF in terms of ordering of wearables, //checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state) @@ -2372,7 +2381,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) remove_non_link_items(wear_items); remove_non_link_items(obj_items); remove_non_link_items(gest_items); -// [SL:KB] - Patch: Apperance-Misc | Checked: 2010-11-24 (Catznip-3.0.0a) | Added: Catzip-2.4.0f +// [SL:KB] - Patch: Apperance-Misc | Checked: 2010-11-24 (Catznip-2.4) // Since we're following folder links we might have picked up new duplicates, or exceeded MAX_CLOTHING_PER_TYPE removeDuplicateItems(wear_items); removeDuplicateItems(obj_items); @@ -2387,7 +2396,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) dumpItemArray(wear_items,"asset_dump: wear_item"); dumpItemArray(obj_items,"asset_dump: obj_item"); -// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-3.0.0a) | Added: Catznip-2.2.0a +// [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2) // Update attachments to match those requested. if (isAgentAvatarValid()) { @@ -2704,7 +2713,6 @@ void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* catego void LLAppearanceMgr::wearOutfitByName(const std::string& name) { LL_INFOS("Avatar") << self_av_string() << "Wearing category " << name << LL_ENDL; - //inc_busy_count(); LLInventoryModel::cat_array_t cat_array; LLInventoryModel::item_array_t item_array; @@ -3487,7 +3495,7 @@ public: // Error /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { - llwarns << "appearance update request failed, status: " << status << " reason: " << reason << llendl; + llwarns << "appearance update request failed, status: " << status << " reason: " << reason << " code: " << content["code"].asInteger() << " error: \"" << content["error"].asString() << "\"" << llendl; LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; onFailure(status); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 32501de62..eb1a28576 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1220,7 +1220,7 @@ bool LLAppViewer::mainLoop() { joystick->scanJoystick(); gKeyboard->scanKeyboard(); - if(isCrouch) + if (gAgent.isCrouching()) { gAgent.moveUp(-1); } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 42f2e73d8..d9c5e9153 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -52,8 +52,9 @@ #include "llslurl.h" // IDEVO #include "llavatarname.h" #include "llagentui.h" -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h -#include "rlvhandler.h" +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] #include "llviewerwindow.h" @@ -182,16 +183,12 @@ void LLAvatarActions::startIM(const LLUUID& id) if (id.isNull() || gAgentID == id) return; -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(id)) && (!RlvActions::hasOpenP2PSession(id)) ) { - LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); - if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) - { - make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); - return; - } + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); + return; } // [/RLVa:KB] @@ -234,16 +231,12 @@ void LLAvatarActions::startCall(const LLUUID& id) return; } -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(id)) && (!RlvActions::hasOpenP2PSession(id)) ) { - LLUUID idSession = gIMMgr->computeSessionID(IM_NOTHING_SPECIAL, id); - if ( (idSession.notNull()) && (!gIMMgr->hasSession(idSession)) ) - { - make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); - return; - } + make_ui_sound("UISndInvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("agent", id, "completename").getSLURLString())); + return; } // [/RLVa:KB] @@ -262,12 +255,12 @@ void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids) LLDynamicArray id_array; for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) const LLUUID& idAgent = *it; - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + if (!RlvActions::canStartIM(idAgent)) { make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); return; } id_array.push_back(idAgent); @@ -315,12 +308,12 @@ void LLAvatarActions::startConference(const uuid_vec_t& ids) { for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it) { -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) const LLUUID& idAgent = *it; - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(idAgent)) ) + if (!RlvActions::canStartIM(idAgent)) { make_ui_sound("UISndInvalidOp"); - RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF, LLSD().with("RECIPIENT", LLSLURL("agent", idAgent, "completename").getSLURLString())); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); return; } // [/RLVa:KB] diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index dec0a2ef7..f503fa3ba 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -37,6 +37,7 @@ #include "llviewerregion.h" // getCapability() #include "llworld.h" // [RLVa:KB] - Checked: 2010-06-04 (RLVa-1.2.2a) +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -549,8 +550,8 @@ BOOL LLFloaterAvatarPicker::handleDragAndDrop(S32 x, S32 y, MASK mask, if (dest_agent_id.notNull() && dest_agent_id != gAgentID) { // if (drop) -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (drop) && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStartIM(dest_agent_id)) ) ) +// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0) + if ( (drop) && (RlvActions::canStartIM(dest_agent_id)) ) // [/RLVa:KB] { // Start up IM before give the item diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 60a4a6caf..da27ac259 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -41,8 +41,10 @@ #include "llviewermessage.h" #include "groupchatlistener.h" #include "hippolimits.h" // for getMaxAgentGroups -// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f) +// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0) #include "llslurl.h" +#include "rlvactions.h" +#include "rlvcommon.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -142,8 +144,8 @@ void LLGroupActions::startCall(const LLUUID& group_id) return; } -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(group_id)) && (!RlvActions::hasOpenGroupSession(group_id)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); @@ -398,8 +400,8 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id) { if (group_id.isNull()) return LLUUID::null; -// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) ) +// [RLVa:KB] - Checked: 2013-05-09 (RLVa-1.4.9) + if ( (!RlvActions::canStartIM(group_id)) && (!RlvActions::hasOpenGroupSession(group_id)) ) { make_ui_sound("UISndInvalidOp"); RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString())); diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index eaef2534b..cc42294fd 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -2049,7 +2049,7 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) for ( ; member_iter_start != member_iter_end; ++member_iter_start) { // Reset defaults - online_status = "unknown"; + online_status = LLTrans::getString("group_member_status_unknown"); title = titles[0].asString(); contribution = 0; member_powers = default_powers; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index abae430f6..f97d320a2 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -62,8 +62,9 @@ #include "boost/algorithm/string.hpp" -// [RLVa:KB] -#include "rlvhandler.h" +// [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9) +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] class AIHTTPTimeoutPolicy; @@ -963,6 +964,8 @@ void LLFloaterIMPanel::addDynamics(LLComboBox* flyout) //flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9); } +void copy_profile_uri(const LLUUID& id, bool group = false); + void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) { if (value.isUndefined()) @@ -977,6 +980,7 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) else if (option == 3) LLAvatarActions::teleportRequest(mOtherParticipantUUID); else if (option == 4) LLAvatarActions::pay(mOtherParticipantUUID); else if (option == 5) LLAvatarActions::inviteToGroup(mOtherParticipantUUID); + else if (option == -1) copy_profile_uri(mOtherParticipantUUID); else if (option >= 6) // Options that use dynamic items { // First remove them all @@ -1142,6 +1146,7 @@ void deliver_message(const std::string& utf8_text, bool convert_roleplay_text(std::string& text); // Returns true if text is an action +// Singu Note: LLFloaterIMSession::sendMsg void LLFloaterIMPanel::onSendMsg() { if (!gAgent.isGodlike() @@ -1164,17 +1169,18 @@ void LLFloaterIMPanel::onSendMsg() bool action = convert_roleplay_text(utf8_text); if (!action && mRPMode) utf8_text = "((" + utf8_text + "))"; -// [RLVa:KB] - Checked: 2011-09-17 (RLVa-1.1.4b) | Modified: RLVa-1.1.4b - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) ) + +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) ) { bool fRlvFilter = false; switch (mSessionType) { case P2P_SESSION: // One-on-one IM - fRlvFilter = !gRlvHandler.canSendIM(mOtherParticipantUUID); + fRlvFilter = !RlvActions::canSendIM(mOtherParticipantUUID); break; case GROUP_SESSION: // Group chat - fRlvFilter = !gRlvHandler.canSendIM(mSessionUUID); + fRlvFilter = !RlvActions::canSendIM(mSessionUUID); break; case ADHOC_SESSION: // Conference chat: allow if all participants can be sent an IM { @@ -1190,7 +1196,7 @@ void LLFloaterIMPanel::onSendMsg() itSpeaker != speakers.end(); ++itSpeaker) { const LLSpeaker* pSpeaker = *itSpeaker; - if ( (gAgentID != pSpeaker->mID) && (!gRlvHandler.canSendIM(pSpeaker->mID)) ) + if ( (gAgentID != pSpeaker->mID) && (!RlvActions::canSendIM(pSpeaker->mID)) ) { fRlvFilter = true; break; @@ -1204,7 +1210,9 @@ void LLFloaterIMPanel::onSendMsg() } if (fRlvFilter) + { utf8_text = RlvStrings::getString(RLV_STRING_BLOCKED_SENDIM); + } } // [/RLVa:KB] diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 48ae523b7..ec1d74946 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -55,8 +55,9 @@ #include "llvoavatar.h" // For mIdleTimer reset #include "llviewerregion.h" -// [RLVa:KB] -#include "rlvhandler.h" +// [RLVa:KB] - Checked: 2013-05-10 (RLVa-1.4.9) +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] class AIHTTPTimeoutPolicy; @@ -86,7 +87,7 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_ return gSavedSettings.getColor4("AscentLindenColor"); // [RLVa:LF] Chat colors would identify names, don't use them in local chat if restricted - if (local_chat && rlv_handler_t::isEnabled() && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + if (local_chat && RlvActions::hasBehaviour(RLV_BHVR_SHOWNAMES)) return gSavedSettings.getColor4("AgentChatColor"); static const LLCachedControl color_friend_chat("ColorFriendChat"); @@ -104,11 +105,6 @@ LLColor4 agent_chat_color(const LLUUID& id, const std::string& name, bool local_ return local_chat ? gSavedSettings.getColor4("AgentChatColor") : gSavedSettings.getColor("IMChatColor"); } -// returns true if a should appear before b -//static BOOL group_dictionary_sort( LLGroupData* a, LLGroupData* b ) -//{ -// return (LLStringUtil::compareDict( a->mName, b->mName ) < 0); -//} class LLViewerChatterBoxInvitationAcceptResponder : public LLHTTPClient::ResponderWithResult { @@ -1492,15 +1488,15 @@ public: } bool group = gAgent.isInGroup(session_id); -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) ) +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + if ( (RlvActions::hasBehaviour(RLV_BHVR_RECVIM)) || (RlvActions::hasBehaviour(RLV_BHVR_RECVIMFROM)) ) { - if (group) // Group chat: don't accept the invite if not an exception + if (group) { - if (!gRlvHandler.canReceiveIM(session_id)) + if (!RlvActions::canReceiveIM(session_id)) return; } - else if (!gRlvHandler.canReceiveIM(from_id)) // Conference chat: don't block; censor if not an exception + else if (!RlvActions::canReceiveIM(from_id)) { message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); } diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index a02de1998..bb69789b5 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -49,6 +49,10 @@ #include "lltrans.h" #include "llvoavatarself.h" #include "llnotifications.h" +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) +#include "rlvactions.h" +#include "rlvcommon.h" +// [/RLVa:KB] extern LLUUID gAgentID; @@ -455,6 +459,10 @@ class LLBeginIMSession : public inventory_panel_listener_t LLDynamicArray members; EInstantMessage type = IM_SESSION_CONFERENCE_START; +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + bool fRlvCanStartIM = true; +// [/RLVa:KB] + for (std::set::const_iterator iter = selected_items.begin(); iter != selected_items.end(); iter++) { @@ -493,6 +501,9 @@ class LLBeginIMSession : public inventory_panel_listener_t id = item_array.get(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) { +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + fRlvCanStartIM &= RlvActions::canStartIM(id); +// [RLVa:KB] members.put(id); } } @@ -515,6 +526,9 @@ class LLBeginIMSession : public inventory_panel_listener_t if(at.isBuddyOnline(id)) { +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + fRlvCanStartIM &= RlvActions::canStartIM(id); +// [RLVa:KB] members.put(id); } } @@ -526,6 +540,15 @@ class LLBeginIMSession : public inventory_panel_listener_t // the session_id is randomly generated UUID which will be replaced later // with a server side generated number +// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9) + if (!fRlvCanStartIM) + { + make_ui_sound("UISndIvalidOp"); + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF); + return true; + } +// [/RLVa:KB] + if (name.empty()) { name = llformat("Session %d", session_num++); diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp index 9e4ef15cc..92ce2545f 100644 --- a/indra/newview/llpanelgroup.cpp +++ b/indra/newview/llpanelgroup.cpp @@ -129,10 +129,7 @@ void LLPanelGroupTab::handleClickHelp() } } -static void copy_group_profile_uri(const LLUUID& id) -{ - gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring("secondlife:///app/group/"+id.asString()+"/about")); -} +void copy_profile_uri(const LLUUID& id, bool group); LLPanelGroup::LLPanelGroup(const LLUUID& group_id) : LLPanel("PanelGroup", LLRect(), FALSE), @@ -163,7 +160,7 @@ LLPanelGroup::LLPanelGroup(const LLUUID& group_id) LLGroupMgr::getInstance()->addObserver(this); - mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_group_profile_uri, boost::ref(mID))); + mCommitCallbackRegistrar.add("Group.CopyURI", boost::bind(copy_profile_uri, boost::ref(mID), true)); // Pass on construction of this panel to the control factory. LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap()); } diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp index 2b1bbf804..5b58e6b76 100644 --- a/indra/newview/llpanelgroupgeneral.cpp +++ b/indra/newview/llpanelgroupgeneral.cpp @@ -828,6 +828,8 @@ void LLPanelGroupGeneral::updateMembers() } } +bool is_online_status_string(const std::string& status); + void LLPanelGroupGeneral::addMember(LLGroupMemberData* member) { // Owners show up in bold. @@ -845,9 +847,8 @@ void LLPanelGroupGeneral::addMember(LLGroupMemberData* member) item_params.columns.add().column("title").value(member->getTitle()).font/*.name*/("SANSSERIF_SMALL").font_style(style); static const LLCachedControl format(gSavedSettings, "ShortDateFormat"); - static const std::string online(LLTrans::getString("group_member_status_online")); item_params.columns.add().column("online").value(member->getOnlineStatus()) - .format(format).type(member->getOnlineStatus() == online ? "text" : "date") + .format(format).type(is_online_status_string(member->getOnlineStatus()) ? "text" : "date") .font/*.name*/("SANSSERIF_SMALL").font_style(style); /*LLScrollListItem* member_row =*/ mListVisibleMembers->addNameItemRow(item_params); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index d713ff9e8..e38bda37b 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1523,6 +1523,14 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc) } } +bool is_online_status_string(const std::string& status) +{ + static const std::string online(LLTrans::getString("group_member_status_online")); + if (status == online) return true; + static const std::string unknown(LLTrans::getString("group_member_status_unknown")); + return status == unknown; +} + void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) { if (!data) return; @@ -1538,9 +1546,8 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) .font/*.name*/("SANSSERIF_SMALL")/*.style("NORMAL")*/; static const LLCachedControl format(gSavedSettings, "ShortDateFormat"); - static const std::string online(LLTrans::getString("group_member_status_online")); item_params.columns.add().column("online").value(data->getOnlineStatus()) - .format(format).type(data->getOnlineStatus() == online ? "text" : "date") + .format(format).type(is_online_status_string(data->getOnlineStatus()) ? "text" : "date") .font/*.name*/("SANSSERIF_SMALL")/*.style("NORMAL")*/; mMembersList->addNameItemRow(item_params); diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index f0a950b40..6f0cdf10c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -159,32 +159,22 @@ LLLoginRefreshHandler gLoginRefreshHandler; //--------------------------------------------------------------------------- // Public methods //--------------------------------------------------------------------------- -LLPanelLogin::LLPanelLogin(const LLRect &rect, - void (*callback)(S32 option, void* user_data), - void *cb_data) -: LLPanel(std::string("panel_login"), LLRect(0,600,800,0), FALSE), // not bordered - mLogoImage(), - mCallback(callback), - mCallbackData(cb_data) +LLPanelLogin::LLPanelLogin(const LLRect& rect) +: LLPanel(std::string("panel_login"), rect, FALSE), // not bordered + mLogoImage(LLUI::getUIImage("startup_logo.j2c")) { setFocusRoot(TRUE); setBackgroundVisible(FALSE); setBackgroundOpaque(TRUE); - gViewerWindow->abortShowProgress(); //Kill previous instance. It might still be alive, and if so, its probably pending - //deletion via the progressviews idle callback. Kill it now and unregister said idle callback. - LLPanelLogin::sInstance = this; // add to front so we are the bottom-most child gViewerWindow->getRootView()->addChildInBack(this); - // Logo - mLogoImage = LLUI::getUIImage("startup_logo.j2c"); - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_login.xml"); - + reshape(rect.getWidth(), rect.getHeight()); LLComboBox* username_combo(getChild("username_combo")); @@ -243,12 +233,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, LLPanelLogin::onUpdateStartSLURL(start_slurl); // updates grid if needed } - childSetAction("connect_btn", onClickConnect, this); - setDefaultBtn("connect_btn"); // Also set default button for subpanels, otherwise hitting enter in text entry fields won't login { LLButton* connect_btn(findChild("connect_btn")); + connect_btn->setCommitCallback(boost::bind(&LLPanelLogin::onClickConnect, this)); + setDefaultBtn(connect_btn); findChild("name_panel")->setDefaultBtn(connect_btn); findChild("password_panel")->setDefaultBtn(connect_btn); findChild("grids_panel")->setDefaultBtn(connect_btn); @@ -287,6 +277,24 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect, refreshLoginPage(); gHippoGridManager->setCurrentGridChangeCallback(boost::bind(&LLPanelLogin::onCurGridChange,this,_1,_2)); + + // Load login history + std::string login_hist_filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "saved_logins_sg2.xml"); + mLoginHistoryData = LLSavedLogins::loadFile(login_hist_filepath); + + const LLSavedLoginsList& saved_login_entries(mLoginHistoryData.getEntries()); + for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin(); + i != saved_login_entries.rend(); ++i) + { + LLSD e = i->asLLSD(); + if (e.isMap() && gHippoGridManager->getGrid(i->getGrid())) + username_combo->add(getDisplayString(*i), e); + } + + if (saved_login_entries.size() > 0) + { + setFields(*saved_login_entries.rbegin()); + } } void LLPanelLogin::setSiteIsAlive( bool alive ) @@ -355,24 +363,6 @@ LLPanelLogin::~LLPanelLogin() } } -void LLPanelLogin::setLoginHistory(LLSavedLogins const& login_history) -{ - sInstance->mLoginHistoryData = login_history; - - LLComboBox* login_combo = sInstance->getChild("username_combo"); - llassert(login_combo); - login_combo->clear(); - - LLSavedLoginsList const& saved_login_entries(login_history.getEntries()); - for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin(); - i != saved_login_entries.rend(); ++i) - { - LLSD e = i->asLLSD(); - if (e.isMap() && gHippoGridManager->getGrid(i->getGrid())) - login_combo->add(getDisplayString(*i), e); - } -} - // virtual void LLPanelLogin::draw() { @@ -449,12 +439,6 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) } #endif - if (KEY_RETURN == key && MASK_NONE == mask) - { - // let the panel handle UICtrl processing: calls onClickConnect() - return LLPanel::handleKeyHere(key, mask); - } - return LLPanel::handleKeyHere(key, mask); } @@ -514,11 +498,10 @@ void LLPanelLogin::giveFocus() // static -void LLPanelLogin::show(const LLRect &rect, - void (*callback)(S32 option, void* user_data), - void* callback_data) +void LLPanelLogin::show() { - new LLPanelLogin(rect, callback, callback_data); + if (sInstance) sInstance->setVisible(true); + else new LLPanelLogin(gViewerWindow->getVirtualWindowRect()); if( !gFocusMgr.getKeyboardFocus() ) { @@ -892,28 +875,24 @@ bool LLPanelLogin::getRememberLogin() //--------------------------------------------------------------------------- // static -void LLPanelLogin::onClickConnect(void *) +void LLPanelLogin::onClickConnect() { - if (sInstance && sInstance->mCallback) + // JC - Make sure the fields all get committed. + gFocusMgr.setKeyboardFocus(NULL); + + std::string first, last, password; + if (nameSplit(getChild("username_combo")->getTextEntry(), first, last)) { - - // JC - Make sure the fields all get committed. - gFocusMgr.setKeyboardFocus(NULL); - - std::string first, last, password; - if (nameSplit(sInstance->getChild("username_combo")->getTextEntry(), first, last)) - { - // has both first and last name typed - sInstance->mCallback(0, sInstance->mCallbackData); - } - else - { - if (gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()) { - LLNotificationsUtil::add("MustHaveAccountToLogInNoLinks"); - } else { - LLNotificationsUtil::add("MustHaveAccountToLogIn", LLSD(), LLSD(), - LLPanelLogin::newAccountAlertCallback); - } + // has both first and last name typed + LLStartUp::setStartupState(STATE_LOGIN_CLEANUP); + } + else + { + if (gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()) { + LLNotificationsUtil::add("MustHaveAccountToLogInNoLinks"); + } else { + LLNotificationsUtil::add("MustHaveAccountToLogIn", LLSD(), LLSD(), + LLPanelLogin::newAccountAlertCallback); } } } diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index b1a7ff935..05c4c3b18 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -49,18 +49,15 @@ class LLPanelLogin: { LOG_CLASS(LLPanelLogin); public: - LLPanelLogin(const LLRect &rect, - void (*callback)(S32 option, void* user_data), - void *callback_data); + LLPanelLogin(const LLRect& rect = LLRect()); ~LLPanelLogin(); virtual BOOL handleKeyHere(KEY key, MASK mask); virtual void draw(); virtual void setFocus( BOOL b ); - static void show(const LLRect &rect, - void (*callback)(S32 option, void* user_data), - void* callback_data); + static void show(); + static void hide() { if (sInstance) sInstance->setVisible(false); } // Remember password checkbox is set via gSavedSettings "RememberPassword" @@ -69,7 +66,6 @@ public: * @param firstname First name value. * @param lastname Last name value. * @param password Password, as plaintext or munged. - * @param is_secondlife True if First/Last refer to a SecondLife(tm) account. */ static void setFields(const std::string& firstname, const std::string& lastname, const std::string& password); @@ -110,7 +106,7 @@ private: void reshapeBrowser(); void onLocationSLURL(); - static void onClickConnect(void*); + void onClickConnect(); static void onClickNewAccount(); static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response); static void onClickGrids(void*); @@ -124,10 +120,6 @@ private: static void clearPassword(); public: - /** - * @brief Set the login history data. - */ - static void setLoginHistory(LLSavedLogins const& login_history); /** * @brief Returns the login history data. @@ -144,14 +136,9 @@ public: */ static bool getRememberLogin(); - //static void selectFirstElement(void); - private: LLPointer mLogoImage; - void (*mCallback)(S32 option, void *userdata); - void* mCallbackData; - std::string mIncomingPassword; std::string mMungedPassword; diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 77363270a..1cf09178e 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -552,6 +552,8 @@ void LLPanelObject::getState( ) mBtnCopySize->setEnabled( enable_scale ); mBtnPasteSize->setEnabled( enable_scale ); mBtnPasteSizeClip->setEnabled( enable_scale ); + mCtrlPosX->setMaxValue(objectp->getRegion()->getWidth()); + mCtrlPosY->setMaxValue(objectp->getRegion()->getWidth()); // Singu TODO: VarRegions, getLength() mCtrlPosZ->setMaxValue(gHippoLimits->getMaxHeight()); mCtrlScaleX->setMaxValue(gHippoLimits->getMaxPrimScale()); mCtrlScaleY->setMaxValue(gHippoLimits->getMaxPrimScale()); diff --git a/indra/newview/llprogressview.cpp b/indra/newview/llprogressview.cpp index cbaa5d47e..23981e565 100644 --- a/indra/newview/llprogressview.cpp +++ b/indra/newview/llprogressview.cpp @@ -135,13 +135,6 @@ void LLProgressView::revealIntroPanel() gIdleCallbacks.addFunction(onIdle, this); } -void LLProgressView::abortShowProgress() -{ - mFadeFromLoginTimer.stop(); - LLPanelLogin::close(); - gIdleCallbacks.deleteFunction(onIdle, this); -} - void LLProgressView::setStartupComplete() { mStartupComplete = true; @@ -334,7 +327,7 @@ void LLProgressView::onIdle(void* user_data) self->mFadeFromLoginTimer.getElapsedTimeF32() > FADE_TO_WORLD_TIME) { self->mFadeFromLoginTimer.stop(); - LLPanelLogin::close(); + LLPanelLogin::hide(); // Nothing to do anymore. gIdleCallbacks.deleteFunction(onIdle, user_data); diff --git a/indra/newview/llprogressview.h b/indra/newview/llprogressview.h index 816305efd..bff970e29 100644 --- a/indra/newview/llprogressview.h +++ b/indra/newview/llprogressview.h @@ -62,7 +62,6 @@ public: void setMessage(const std::string& msg); void revealIntroPanel(); - void abortShowProgress(); void setStartupComplete(); diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index f16409e32..f655834c1 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -94,6 +94,7 @@ #include "hippogridmanager.h" // [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvactions.h" #include "rlvhandler.h" // [/RLVa:KB] @@ -661,7 +662,7 @@ bool LLSelectMgr::enableLinkObjects() } } // [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g - if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) ) + if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!RlvActions::canStand())) ) { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); @@ -683,7 +684,7 @@ bool LLSelectMgr::enableUnlinkObjects() !first_editable_object->isAttachment() && !first_editable_object->isPermanentEnforced() && ((root_object == NULL) || !root_object->isPermanentEnforced()); // [RLVa:KB] - Checked: 2011-03-19 (RLVa-1.3.0f) | Modified: RLVa-0.2.0g - if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand())) ) + if ( (new_value) && ((rlv_handler_t::isEnabled()) && (!RlvActions::canStand())) ) { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 0cf590cd8..2077ccfec 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -291,8 +291,7 @@ boost::scoped_ptr LLStartUp::sPhases(new LLViewerStats: // local function declaration // -void login_show(LLSavedLogins const& saved_logins); -void login_callback(S32 option, void* userdata); +void login_show(); void show_first_run_dialog(); bool first_run_dialog_callback(const LLSD& notification, const LLSD& response); void set_startup_status(const F32 frac, const std::string& string, const std::string& msg); @@ -882,24 +881,17 @@ bool idle_startup() gViewerWindow->setShowProgress(FALSE); display_startup(); - // Load login history - std::string login_hist_filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "saved_logins_sg2.xml"); - LLSavedLogins login_history = LLSavedLogins::loadFile(login_hist_filepath); - display_startup(); - // Show the login dialog. - login_show(login_history); + login_show(); display_startup(); - if (login_history.size() > 0) - { - LLPanelLogin::setFields(*login_history.getEntries().rbegin()); - } - else + static bool sSetFields(LLPanelLogin::getLoginHistory().size() > 0); // If there were no entries to be loaded, use what's available + if (!sSetFields) { LLPanelLogin::setFields(firstname, lastname, password); + sSetFields = true; // Never reset the fields again! + display_startup(); + LLPanelLogin::giveFocus(); } - display_startup(); - LLPanelLogin::giveFocus(); gSavedSettings.setBOOL("FirstRunThisInstall", FALSE); @@ -1416,6 +1408,7 @@ bool idle_startup() // Yay, login! successful_login = true; Debug(if (gCurlIo) dc::curlio.off()); // Login succeeded: restore dc::curlio to original state. + LLPanelLogin::close(); // Singu Note: Actually destroy the login panel here, otherwise user interaction gets lost upon failed login. } else if(login_response == "indeterminate") { @@ -2712,59 +2705,17 @@ bool idle_startup() // local function definition // -void login_show(LLSavedLogins const& saved_logins) +void login_show() { LL_INFOS("AppInit") << "Initializing Login Screen" << LL_ENDL; // This creates the LLPanelLogin instance. - LLPanelLogin::show( gViewerWindow->getVirtualWindowRect(), - login_callback, NULL ); - - // Now that the LLPanelLogin instance is created, - // store the login history there. - LLPanelLogin::setLoginHistory(saved_logins); + LLPanelLogin::show(); // UI textures have been previously loaded in doPreloadImages() } -// Callback for when login screen is closed. Option 0 = connect, option 1 = quit. -void login_callback(S32 option, void *userdata) -{ - const S32 CONNECT_OPTION = 0; - const S32 QUIT_OPTION = 1; - - if (CONNECT_OPTION == option) - { - LLStartUp::setStartupState( STATE_LOGIN_CLEANUP ); - return; - } - else if (QUIT_OPTION == option) - { - // Make sure we don't save the password if the user is trying to clear it. - std::string first, last, password; - LLPanelLogin::getFields(&first, &last, &password); - if (!gSavedSettings.getBOOL("RememberPassword")) - { - // turn off the setting and write out to disk - gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile") , TRUE ); - } - - // Next iteration through main loop should shut down the app cleanly. - LLAppViewer::instance()->userQuit(); - - if (LLAppViewer::instance()->quitRequested()) - { - LLPanelLogin::close(); - } - return; - } - else - { - LL_WARNS("AppInit") << "Unknown login button clicked" << LL_ENDL; - } -} - // static std::string LLStartUp::loadPasswordFromDisk() diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 1bfc7ca9e..602aa594b 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -95,7 +95,8 @@ #include "hippogridmanager.h" // [RLVa:KB] -#include "rlvhandler.h" +#include "rlvactions.h" +#include "rlvcommon.h" // [/RLVa:KB] // @@ -595,7 +596,7 @@ void LLStatusBar::refresh() } // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) | Modified: RLVa-1.0.0a - if ( (region) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) // region == NULL if we lose our connection to the grid + if ( (region) && (RlvActions::hasBehaviour(RLV_BHVR_SHOWLOC)) ) // region == NULL if we lose our connection to the grid { location_name = llformat("%s (%s) - %s", RlvStrings::getString(RLV_STRING_HIDDEN_REGION).c_str(), region->getSimAccessString().c_str(), @@ -923,7 +924,7 @@ static void onClickScripts(void*) static void onClickBuyLand(void*) { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + if (RlvActions::isRlvEnabled() && RlvActions::hasBehaviour(RLV_BHVR_SHOWLOC)) { return; } diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 3f3470e04..1f6ae81cf 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -780,7 +780,11 @@ void LLToolCompGun::handleSelect() void LLToolCompGun::handleDeselect() { LLToolComposite::handleDeselect(); - LLViewerCamera::getInstance()->loadDefaultFOV(); // Singu Note: Load Default FOV in case we were zoomed in + if (mRightMouseButton || mTimerFOV.getStarted()) // Singu Note: Load Default FOV if we were zoomed in + { + LLViewerCamera::getInstance()->loadDefaultFOV(); + mRightMouseButton = false; + } setMouseCapture(FALSE); } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 1c8b3b629..8c899a4ae 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -61,14 +61,11 @@ const F32 YAW_NUDGE_RATE = 0.05f; // fraction of normal speed LLViewerKeyboard gViewerKeyboard; -bool isCrouch = false; //Shouldn't start crouched. - void agent_jump( EKeystate s ) { if( KEYSTATE_UP == s ) return; F32 time = gKeyboard->getCurKeyElapsedTime(); S32 frame_count = llround(gKeyboard->getCurKeyElapsedFrameCount()); - isCrouch = false; if( time < FLY_TIME || frame_count <= FLY_FRAMES || gAgent.upGrabbed() @@ -86,18 +83,17 @@ void agent_toggle_down( EKeystate s ) { if(KEYSTATE_UP == s) return; - gAgent.moveUp(-1); if(KEYSTATE_DOWN == s && !gAgent.getFlying() && gSavedSettings.getBOOL("SGShiftCrouchToggle")) { - isCrouch = !isCrouch; + gAgent.toggleCrouch(); } + gAgent.moveUp(-1); } void agent_push_down( EKeystate s ) { if( KEYSTATE_UP == s ) return; gAgent.moveUp(-1); - isCrouch = false; } static void agent_handle_doubletap_run(EKeystate s, LLAgent::EDoubleTapRunMode mode) @@ -247,7 +243,6 @@ void agent_toggle_fly( EKeystate s ) if (KEYSTATE_DOWN == s ) { gAgent.toggleFlying(); - isCrouch = false; } } diff --git a/indra/newview/llviewerkeyboard.h b/indra/newview/llviewerkeyboard.h index e3ef315b5..2be702fee 100644 --- a/indra/newview/llviewerkeyboard.h +++ b/indra/newview/llviewerkeyboard.h @@ -93,6 +93,5 @@ protected: }; extern LLViewerKeyboard gViewerKeyboard; -extern bool isCrouch; void agent_push_forward(EKeystate s); #endif // LL_LLVIEWERKEYBOARD_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ca85a2ac2..ba83afd25 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -207,9 +207,10 @@ void init_debug_rendering_menu(LLMenuGL* menu); void init_debug_ui_menu(LLMenuGL* menu); void init_debug_xui_menu(LLMenuGL* menu); void init_debug_avatar_menu(LLMenuGL* menu); -// [RLVa:KB] +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) +#include "rlvactions.h" #include "rlvhandler.h" -#include "rlvfloaterbehaviour.h" +#include "rlvfloaters.h" #include "rlvlocks.h" void init_debug_rlva_menu(LLMenuGL* menu); // [/RLVa:KB] @@ -239,6 +240,7 @@ extern BOOL gDebugTextEditorTips; extern BOOL gShowOverlayTitle; extern BOOL gOcclusionCull; extern AIHTTPView* gHttpView; +extern LLMenuGL* sScrollListMenus[1]; // // Globals // @@ -520,6 +522,10 @@ void region_change(); void parse_simulator_features(); void custom_selected(void* user_data); + +void advanced_toggle_wireframe(void*); +BOOL advanced_check_wireframe(void*); + void reset_vertex_buffers(void *user_data) { gPipeline.clearRebuildGroups(); @@ -781,6 +787,10 @@ void init_menus() gMenuHolder->addChild(gLoginMenuBarView); + // Singu Note: Initialize common ScrollListMenus here + sScrollListMenus[0] = LLUICtrlFactory::getInstance()->buildMenu("menu_avs_list.xml", gMenuHolder); + //sScrollListMenus[1] = LLUICtrlFactory::getInstance()->buildMenu("menu_groups_list.xml"); // Singu TODO + LLView* ins = gMenuBarView->getChildView("insert_world", true, false); ins->setVisible(false); ins = gMenuBarView->getChildView("insert_agent", true, false); @@ -960,15 +970,13 @@ void init_client_menu(LLMenuGL* menu) menu->addChild(sub_menu); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.1b | OK - #ifdef RLV_ADVANCED_MENU - sub_menu = new LLMenuGL("RLVa Embedded"); - init_debug_rlva_menu(sub_menu); - menu->addChild(sub_menu); - // Top Level Menu as well - sub_menu = new LLMenuGL("RLVa Main"); - init_debug_rlva_menu(sub_menu); - gMenuBarView->addChild(sub_menu); - #endif // RLV_ADVANCED_MENU + sub_menu = new LLMenuGL("RLVa Embedded"); + init_debug_rlva_menu(sub_menu); + menu->addChild(sub_menu); + // Top Level Menu as well + sub_menu = new LLMenuGL("RLVa Main"); + init_debug_rlva_menu(sub_menu); + gMenuBarView->addChild(sub_menu); // [/RLVa:KB] sub_menu = new LLMenuGL("UI"); @@ -1095,10 +1103,8 @@ void init_client_menu(LLMenuGL* menu) (void*)"ShowConsoleWindow")); // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-1.0.0e | OK - #ifdef RLV_ADVANCED_TOGGLE_RLVA - if (gSavedSettings.controlExists(RLV_SETTING_MAIN)) - menu->addChild(new LLMenuItemCheckGL("RestrainedLove API", &rlvMenuToggleEnabled, NULL, &rlvMenuCheckEnabled, NULL)); - #endif // RLV_ADVANCED_TOGGLE_RLVA + if (gSavedSettings.controlExists(RLV_SETTING_MAIN)) + menu->addChild(new LLMenuItemCheckGL("RestrainedLove API", &rlvMenuToggleEnabled, NULL, &rlvMenuCheckEnabled, NULL)); // [/RLVa:KB] if(gSavedSettings.getBOOL("QAMode")) @@ -1469,8 +1475,7 @@ void init_debug_rendering_menu(LLMenuGL* menu) menu->addChild(new LLMenuItemCallGL("Selected Texture Info", handle_selected_texture_info, NULL, NULL, 'T', MASK_CONTROL|MASK_SHIFT|MASK_ALT)); //menu->addChild(new LLMenuItemCallGL("Dump Image List", handle_dump_image_list, NULL, NULL, 'I', MASK_CONTROL|MASK_SHIFT)); - menu->addChild(new LLMenuItemToggleGL("Wireframe", &gUseWireframe, - 'R', MASK_CONTROL|MASK_SHIFT)); + menu->addChild(new LLMenuItemCheckGL("Wireframe", advanced_toggle_wireframe, NULL, advanced_check_wireframe, NULL, 'R', MASK_CONTROL|MASK_SHIFT)); LLMenuItemCheckGL* item; item = new LLMenuItemCheckGL("Object-Object Occlusion", menu_toggle_control, NULL, menu_check_control, (void*)"UseOcclusion", 'O', MASK_CONTROL|MASK_SHIFT); @@ -1634,16 +1639,14 @@ void init_debug_rlva_menu(LLMenuGL* menu) menu->addChild(new LLMenuItemCheckGL("Enable Shared Wear", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_ENABLESHAREDWEAR)); menu->addSeparator(); - #ifdef RLV_EXTENSION_HIDELOCKED - if ( (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDLAYER)) && - (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDATTACH)) ) - { - menu->addChild(new LLMenuItemCheckGL("Hide Locked Layers", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDLAYER)); - menu->addChild(new LLMenuItemCheckGL("Hide Locked Attachments", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDATTACH)); - //sub_menu->addChild(new LLMenuItemToggleGL("Hide locked inventory", &rlv_handler_t::fHideLockedInventory)); - menu->addSeparator(); - } - #endif // RLV_EXTENSION_HIDELOCKED + if ( (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDLAYER)) && + (gSavedSettings.controlExists(RLV_SETTING_HIDELOCKEDATTACH)) ) + { + menu->addChild(new LLMenuItemCheckGL("Hide Locked Layers", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDLAYER)); + menu->addChild(new LLMenuItemCheckGL("Hide Locked Attachments", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_HIDELOCKEDATTACH)); + //sub_menu->addChild(new LLMenuItemToggleGL("Hide locked inventory", &rlv_handler_t::fHideLockedInventory)); + menu->addSeparator(); + } if (gSavedSettings.controlExists(RLV_SETTING_FORBIDGIVETORLV)) menu->addChild(new LLMenuItemCheckGL("Forbid Give to #RLV", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_FORBIDGIVETORLV)); @@ -1651,11 +1654,9 @@ void init_debug_rlva_menu(LLMenuGL* menu) menu->addChild(new LLMenuItemCheckGL("Show Name Tags", menu_toggle_control, NULL, menu_check_control, (void*)RLV_SETTING_SHOWNAMETAGS)); menu->addSeparator(); - #ifdef RLV_EXTENSION_FLOATER_RESTRICTIONS - // TODO-RLVa: figure out a way to tell if floater_rlv_behaviour.xml exists - menu->addChild(new LLMenuItemCheckGL("Restrictions...", &RlvFloaterBehaviours::toggle, NULL, &RlvFloaterBehaviours::visible, NULL)); - menu->addChild(new LLMenuItemCheckGL("Locks...", &RlvFloaterLocks::toggle, NULL, &RlvFloaterLocks::visible, NULL)); - #endif // RLV_EXTENSION_FLOATER_RESTRICTIONS + menu->addChild(new LLMenuItemCheckGL("Restrictions...", &RlvFloaterBehaviours::toggle, NULL, &RlvFloaterBehaviours::visible, NULL)); + menu->addChild(new LLMenuItemCheckGL("Locks...", &RlvFloaterLocks::toggle, NULL, &RlvFloaterLocks::visible, NULL)); + menu->addChild(new LLMenuItemCheckGL("Strings...", &RlvFloaterStrings::toggle, NULL, &RlvFloaterStrings::visible, NULL)); } // [/RLVa:KB] @@ -1733,6 +1734,46 @@ void init_server_menu(LLMenuGL* menu) menu->createJumpKeys(); } +////////////////////// +// TOGGLE WIREFRAME // +////////////////////// + +/* +class LLAdvancedToggleWireframe : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) +*/ + void advanced_toggle_wireframe(void*) + { +// [RLVa:KB] - Checked: 2013-05-11 (RLVa-1.4.9) + bool fRlvBlockWireframe = gRlvAttachmentLocks.hasLockedHUD(); + if ( (!gUseWireframe) && (fRlvBlockWireframe) ) + { + RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_WIREFRAME); + } + gUseWireframe = (!gUseWireframe) && (!fRlvBlockWireframe); +// [/RLVa:KB] +// gUseWireframe = !(gUseWireframe); +// gWindowResized = TRUE; // Singu Note: We don't use this (yet?) + LLPipeline::updateRenderDeferred(); + gPipeline.resetVertexBuffers(); +// return true; + } +/* +}; + +class LLAdvancedCheckWireframe : public view_listener_t +{ + bool handleEvent(const LLSD& userdata) +*/ + BOOL advanced_check_wireframe(void*) + { + bool new_value = gUseWireframe; + return new_value; + } +//}; + + //----------------------------------------------------------------------------- // cleanup_menus() //----------------------------------------------------------------------------- @@ -3978,7 +4019,7 @@ class LLLandSit : public view_listener_t bool handleEvent(LLPointer event, const LLSD& userdata) { // [RLVa:KB] - Checked: 2010-09-28 (RLVa-1.2.1f) | Modified: RLVa-1.2.1f - if ( (rlv_handler_t::isEnabled()) && ((!gRlvHandler.canStand()) || (gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) + if ( (rlv_handler_t::isEnabled()) && ((!RlvActions::canStand()) || (gRlvHandler.hasBehaviour(RLV_BHVR_SIT))) ) return true; // [/RLVa:KB] @@ -4674,7 +4715,7 @@ void handle_take_copy() if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; // [RLVa:KB] - Checked: 2010-03-07 (RLVa-1.2.0c) | Modified: RLVa-1.2.0a - if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStand()) ) + if ( (rlv_handler_t::isEnabled()) && (!RlvActions::canStand()) ) { // Allow only if the avie isn't sitting on any of the selected objects LLObjectSelectionHandle hSel = LLSelectMgr::getInstance()->getSelection(); @@ -6283,7 +6324,7 @@ bool enable_object_stand_up() // 'Object Stand Up' menu item is enabled when agent is sitting on selection // return sitting_on_selection(); // [RLVa:KB] - Checked: 2010-07-24 (RLVa-1.2.0g) | Added: RLVa-1.2.0g - return sitting_on_selection() && ( (!rlv_handler_t::isEnabled()) || (gRlvHandler.canStand()) ); + return sitting_on_selection() && ( (!rlv_handler_t::isEnabled()) || (RlvActions::canStand()) ); // [/RLVa:KB] } @@ -9284,6 +9325,18 @@ const uuid_vec_t get_focused_list_ids_selected() return uuid_vec_t(); } +const LLWString get_slurl_for(const LLUUID& id, bool group) +{ + std::string str("secondlife:///app/"); + str += group ? "group/" : "agent/"; + return utf8str_to_wstring(str + id.asString() + "/about"); +} + +void copy_profile_uri(const LLUUID& id, bool group) +{ + gViewerWindow->getWindow()->copyTextToClipboard(get_slurl_for(id, group)); +} + class ListEnableAnySelected : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9371,6 +9424,15 @@ class ListVisibleWebProfile : public view_listener_t } }; +class ListCopySLURL : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + copy_profile_uri(get_focused_list_id_selected(), false); + return true; + } +}; + class ListCopyUUIDs : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9898,6 +9960,7 @@ void initialize_menus() addMenu(new ListEnableMute(), "List.EnableMute"); addMenu(new ListEnableOfferTeleport(), "List.EnableOfferTeleport"); addMenu(new ListVisibleWebProfile(), "List.VisibleWebProfile"); + addMenu(new ListCopySLURL(), "List.CopySLURL"); addMenu(new ListCopyUUIDs(), "List.CopyUUIDs"); addMenu(new ListInviteToGroup(), "List.InviteToGroup"); addMenu(new ListOfferTeleport(), "List.OfferTeleport"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a27bbedb4..7a3893e31 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -38,6 +38,7 @@ #include "llaudioengine.h" #include "llavataractions.h" #include "llavatarnamecache.h" +#include "llbase64.h" #include "../lscript/lscript_byteformat.h" //Need LSCRIPTRunTimePermissionBits and SCRIPT_PERMISSION_* #include "lleconomy.h" #include "llfocusmgr.h" @@ -111,7 +112,7 @@ #include "llviewerregion.h" // [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0a) -#include "llfloateravatarinfo.h" // Checked: 2009-07-08 (RLVa-1.0.0e) +#include "rlvactions.h" #include "rlvhandler.h" #include "rlvinventory.h" #include "rlvui.h" @@ -1628,6 +1629,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& args["[NAME]"] = mFromName; LLFloaterChat::addChatHistory(LLTrans::getString("InvOfferAcceptSilent", args)); } + break; case IOR_BUSY: @@ -1688,7 +1690,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& } if (busy && (!mFromGroup && !mFromObject)) { - busy_message(msg,mFromID); + send_do_not_disturb_message(msg,mFromID); } break; } @@ -1706,6 +1708,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& return false; } +void script_msg_api(const std::string& msg); bool is_spam_filtered(const EInstantMessage& dialog, bool is_friend, bool is_owned_by_me) { // First, check the master filter @@ -1775,6 +1778,8 @@ void inventory_offer_handler(LLOfferInfo* info) return; } + if (!info->mFromGroup) script_msg_api(info->mFromID.asString() + ", 1"); + // If the user wants to, accept all offers of any kind if (gSavedSettings.getBOOL("AutoAcceptAllNewInventory")) { @@ -2246,7 +2251,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) llinfos << "RegionID: " << region_id.asString() << llendl; // - BOOL is_busy = gAgent.getBusy(); + BOOL is_do_not_disturb = gAgent.getBusy(); BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat) // object IMs contain sender object id in session_id (STORM-1209) || dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id); @@ -2315,7 +2320,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // do nothing -- don't distract newbies in // Prelude with global IMs } -// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0a) | Modified: RLVa-1.4.0a +// [RLVa:KB] - Checked: 2011-05-28 (RLVa-1.4.0) else if ( (rlv_handler_t::isEnabled()) && (offline == IM_ONLINE) && ("@version" == message) && (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) ) { @@ -2325,25 +2330,35 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) gIMMgr->processIMTypingStop(im_info); } // [/RLVa:KB] -// else if (offline == IM_ONLINE && !is_linden && !is_muted && is_busy && name != SYSTEM_FROM) -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - else if ( (offline == IM_ONLINE && !is_linden && !is_muted && is_busy && name != SYSTEM_FROM) && (gRlvHandler.canReceiveIM(from_id)) ) +// else if (offline == IM_ONLINE +// && is_do_not_disturb +// && !is_muted // Singu Note: Never if muted +// && from_id.notNull() //not a system message +// && to_id.notNull()) //not global message +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + else if (offline == IM_ONLINE + && is_do_not_disturb + && !is_muted // Singu Note: Never if muted + && from_id.notNull() //not a system message + && to_id.notNull() //not global message + && RlvActions::canReceiveIM(from_id)) // [/RLVa:KB] { - // return a standard "busy" message, but only do it to online IM + // return a standard "do not disturb" message, but only do it to online IM // (i.e. not other auto responses and not store-and-forward IM) if (!gIMMgr->hasSession(session_id) || gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat")) { // if the user wants to repeat responses over and over or // if there is not a panel for this conversation (i.e. it is a new IM conversation // initiated by the other party) then... - if (to_id.notNull()) busy_message(msg, from_id); + send_do_not_disturb_message(msg, from_id, session_id); } // now store incoming IM in chat history buffer = separator_string + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + script_msg_api(from_id.asString() + ", 0"); // add to IM panel, but do not bother the user gIMMgr->addMessage( session_id, @@ -2361,9 +2376,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset); LLFloaterChat::addChat(chat, true, true); } -// else if (to_id.notNull() && offline == IM_ONLINE && !is_linden && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && name != SYSTEM_FROM) -// [RLVa:LF] - Same as above: Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - else if (to_id.notNull() && offline == IM_ONLINE && !is_linden && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && name != SYSTEM_FROM && gRlvHandler.canReceiveIM(from_id)) +// else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull()) +// [RLVa:LF] - Same as above: Checked: 2010-11-30 (RLVa-1.3.0) + else if (offline == IM_ONLINE && (is_autorespond || is_autorespond_nonfriends || is_autorespond_muted) && from_id.notNull() && to_id.notNull() && RlvActions::canReceiveIM(from_id) && RlvActions::canSendIM(from_id)) // [/RLVa:LF] { // now store incoming IM in chat history @@ -2371,6 +2386,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) buffer = separator_string + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + if (!is_muted) script_msg_api(from_id.asString() + ", 0"); bool send_autoresponse = !gIMMgr->hasSession(session_id) || gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat"); // add to IM panel, but do not bother the user @@ -2475,16 +2491,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) mute_im = true; } -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - // Don't block offline IMs, or IMs from Lindens - if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!is_linden) && (!gRlvHandler.canReceiveIM(from_id)) ) - { - if (!mute_im) - RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id); - message = message.substr(0, message_offset) + RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); - } -// [/RLVa:KB] - std::string saved; if(offline == IM_OFFLINE) { @@ -2492,6 +2498,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); saved = LLTrans::getString("Saved_message", args); } + else if (!mute_im) script_msg_api(from_id.asString() + ", 0"); buffer = separator_string + saved + message.substr(message_offset); LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; @@ -2510,6 +2517,17 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) mute_im = true; } */ + +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + // Don't block offline IMs, or IMs from Lindens + if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!is_linden) ) + { + if (!mute_im) + RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id); + message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); + } +// [/RLVa:KB] + if (!mute_im || is_linden) { gIMMgr->addMessage( @@ -2562,7 +2580,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_TYPING_START: { // Don't announce that someone has started messaging, if they're muted or when in busy mode - if (!is_muted && (!accept_im_from_only_friend || is_friend) && !is_busy && !gIMMgr->hasSession(computed_session_id) && gSavedSettings.getBOOL("AscentInstantMessageAnnounceIncoming")) + if (!is_muted && (!accept_im_from_only_friend || is_friend) && !is_do_not_disturb && !gIMMgr->hasSession(computed_session_id) && gSavedSettings.getBOOL("AscentInstantMessageAnnounceIncoming")) { std::string pns_name; if (!LLAvatarNameCache::getPNSName(from_id, pns_name)) pns_name = name; @@ -2579,6 +2597,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) position, false); + // This block is very similar to the one above, but is necessary, since a session is opened to announce incoming message.. // In order to prevent doubling up on the first response, We neglect to send this if Repeat for each message is on. if ((is_autorespond_nonfriends || is_autorespond) && !gSavedPerAccountSettings.getBOOL("AscentInstantMessageResponseRepeat")) @@ -2622,6 +2641,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } LLPointer im_info = new LLIMInfo(gMessageSystem); gIMMgr->processIMTypingStart(im_info); + script_msg_api(from_id.asString() + ", 4"); } break; @@ -2629,6 +2649,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) { LLPointer im_info = new LLIMInfo(gMessageSystem); gIMMgr->processIMTypingStop(im_info); + script_msg_api(from_id.asString() + ", 5"); } break; @@ -2737,7 +2758,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["sender_name"] = name; payload["group_id"] = group_id; payload["inventory_name"] = item_name; - payload["inventory_offer"] = info ? info->asLLSD() : LLSD(); + if(info && info->asLLSD()) + { + payload["inventory_offer"] = info->asLLSD(); + } LLSD args; args["SUBJECT"] = subj; @@ -2758,12 +2782,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) break; case IM_GROUP_INVITATION: { - //if (!is_linden && (is_busy || is_muted)) + //if (is_do_not_disturb || is_muted) if (is_muted) return; - if (is_busy) + if (is_do_not_disturb) { LLMessageSystem *msg = gMessageSystem; - busy_message(msg,from_id); + send_do_not_disturb_message(msg,from_id); } else { @@ -2850,7 +2874,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) info->mFromName = name; info->mDesc = message; info->mHost = msg->getSender(); - //if (((is_busy && !is_owned_by_me) || is_muted)) + //if (((is_do_not_disturb && !is_owned_by_me) || is_muted)) if (is_muted) { // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331) @@ -2862,9 +2886,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) info->forceResponse(IOR_DECLINE); } /* Singu Note: Handle this inside inventory_offer_handler so if the user wants to autoaccept offers, they can while busy. - else if (is_busy && dialog != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565) + // old logic: busy mode must not affect interaction with objects (STORM-565) + // new logic: inventory offers from in-world objects should be auto-declined (CHUI-519) + // Singu Note: We should use old logic + else if (is_do_not_disturb && dialog != IM_TASK_INVENTORY_OFFERED) // busy mode must not affect interaction with objects (STORM-565) { - // Until throttling is implemented, busy mode should reject inventory instead of silently + // Until throttling is implemented, do not disturb mode should reject inventory instead of silently // accepting it. SEE SL-39554 info->forceResponse(IOR_DECLINE); } @@ -2920,7 +2947,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_SESSION_SEND: { - if (!is_linden && is_busy) + if (!is_linden && is_do_not_disturb) { return; } @@ -2938,16 +2965,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) return; } - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) ) + if (from_id != gAgentID && (gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM) || gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM))) { switch (pIMFloater->getSessionType()) { case LLFloaterIMPanel::GROUP_SESSION: // Group chat - if ( (from_id != gAgent.getID()) && (!gRlvHandler.canReceiveIM(session_id)) ) + if (!RlvActions::canReceiveIM(session_id)) return; break; case LLFloaterIMPanel::ADHOC_SESSION: // Conference chat - if ( (from_id != gAgent.getID()) && (!gRlvHandler.canReceiveIM(from_id)) ) + if (!RlvActions::canReceiveIM(from_id)) message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM); break; default: @@ -2996,7 +3023,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_FROM_TASK: { - if (is_busy && !is_owned_by_me) + if (is_do_not_disturb && !is_owned_by_me) { return; } @@ -3004,7 +3031,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromName = name; // Build a link to open the object IM info window. - std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size); + std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1); if (session_id.notNull()) { @@ -3032,6 +3059,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) chat.mFromID = LLUUID::null; chat.mSourceType = CHAT_SOURCE_SYSTEM; } + else script_msg_api(chat.mFromID.asString() + ", 6"); // IDEVO Some messages have embedded resident names message = clean_name_from_task_im(message, from_group); @@ -3075,8 +3103,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) LLFloaterChat::addChat(chat, FALSE, FALSE); } break; + case IM_FROM_TASK_AS_ALERT: - if (is_busy && !is_owned_by_me) + if (is_do_not_disturb && !is_owned_by_me) { return; } @@ -3090,38 +3119,35 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) case IM_BUSY_AUTO_RESPONSE: if (is_muted) { - LL_DEBUGS("Messaging") << "Ignoring busy response from " << from_id << LL_ENDL; + LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL; return; } else { - // TODO: after LLTrans hits release, get "busy response" into translatable file - buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.substr(message_offset).c_str()); - gIMMgr->addMessage(session_id, from_id, name, buffer); + gIMMgr->addMessage(session_id, from_id, name, message); } break; case IM_LURE_USER: case IM_TELEPORT_REQUEST: { -// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c - // If the lure sender is a specific @accepttp exception they will override muted and busy status - bool fRlvSummon = (rlv_handler_t::isEnabled()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, from_id)); +// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9) + // If we auto-accept the offer/request then this will override DnD status (but we'll still let the other party know later) + bool fRlvAutoAccept = (rlv_handler_t::isEnabled()) && + ( ((IM_LURE_USER == dialog) && (RlvActions::autoAcceptTeleportOffer(from_id))) || + ((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) ); // [/RLVa:KB] -// if (is_muted) -// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c - if ( (is_muted) && (!fRlvSummon) ) -// [/RLVa:KB] + if (is_muted) { return; } -// else if (is_busy) -// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c - else if ( (is_busy) && (!fRlvSummon) ) +// else if (is_do_not_disturb) +// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9) + else if ( (is_do_not_disturb) && (!fRlvAutoAccept) ) // [/RLVa:KB] { - busy_message(msg,from_id); + send_do_not_disturb_message(msg, from_id); } else { @@ -3178,19 +3204,20 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } } -// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c +// [RLVa:KB] - Checked: 2013-11-08 (RLVa-1.4.9) if (rlv_handler_t::isEnabled()) { - if (IM_TELEPORT_REQUEST != dialog && !gRlvHandler.canTeleportViaLure(from_id)) + if ( ((IM_LURE_USER == dialog) && (!RlvActions::canAcceptTpOffer(from_id))) || + ((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) ) { - RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLURE_REMOTE)); - if (is_busy) - busy_message(msg,from_id); + RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLUREREQ_REMOTE)); + if (is_do_not_disturb) + send_do_not_disturb_message(msg, from_id); return; } - // Censor lure message if: 1) restricted from receiving IMs from the sender, or 2) @showloc=n restricted - if ( (!gRlvHandler.canReceiveIM(from_id)) || (IM_TELEPORT_REQUEST != dialog && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) + // Censor lure message if: 1) restricted from receiving IMs from the sender, or 2) teleport offer and @showloc=n restricted + if ( (!RlvActions::canReceiveIM(from_id)) || ((IM_LURE_USER == dialog) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))) ) { message = RlvStrings::getString(RLV_STRING_HIDDEN); } @@ -3209,17 +3236,26 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["lure_id"] = session_id; payload["godlike"] = FALSE; payload["region_maturity"] = region_access; - //LLNotificationsUtil::add("TeleportOffered", args, payload); -// [RLVa:KB] - Checked: 2010-12-11 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c - if ( IM_TELEPORT_REQUEST != dialog && (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)) || (fRlvSummon)) ) + /* Singu TODO: Figure if we should use these + if (!canUserAccessDstRegion) { - gRlvHandler.setCanCancelTp(false); - if (is_busy) - busy_message(msg,from_id); - LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0); + LLNotification::Params params("TeleportOffered_MaturityBlocked"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add( params, from_id, false); + send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id); + send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id); + } + else if (doesUserRequireMaturityIncrease) + { + LLNotification::Params params("TeleportOffered_MaturityExceeded"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add( params, from_id, false); } else + */ { /* Singu Note: No default constructor for LLNotification::Params LLNotification::Params params; @@ -3238,14 +3274,29 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) params.substitutions = args; params.payload = payload; - LLNotifications::instance().add(params); - // - if (IM_LURE_USER == dialog) - gAgent.showLureDestination(name, region_handle, pos.mV[VX], pos.mV[VY], pos.mV[VZ]); - // - } + +// [RLVa:KB] - Checked: 20103-11-08 (RLVa-1.4.9) + if ( (rlv_handler_t::isEnabled()) && (fRlvAutoAccept) ) + { + if (IM_LURE_USER == dialog) + gRlvHandler.setCanCancelTp(false); + if (is_do_not_disturb) + send_do_not_disturb_message(msg, from_id); + LLNotifications::instance().forceResponse(LLNotification::Params(params.name).payload(payload), 0); + } + else + { + LLNotifications::instance().add(params); + + // + if (IM_LURE_USER == dialog) + gAgent.showLureDestination(name, region_handle, pos.mV[VX], pos.mV[VY], pos.mV[VZ]); + script_msg_api(from_id.asString().append(IM_LURE_USER == dialog ? ", 2" : ", 3")); + // + } // [/RLVa:KB] - //LLNotificationsUtil::add("TeleportOffered", args, payload); +// LLNotifications::instance().add(params); + } } } break; @@ -3355,17 +3406,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["online"] = (offline == IM_ONLINE); payload["sender"] = msg->getSender().getIPandPort(); - if (!is_muted && is_busy) - { - busy_message(msg, from_id); - LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); - } - else if (is_muted) + if (is_muted) { LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); } else { + if (is_do_not_disturb) + { + send_do_not_disturb_message(msg, from_id); + } args["[NAME]"] = name; if(message.empty()) { @@ -3395,12 +3445,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) args["NAME"] = name; LLSD payload; payload["from_id"] = from_id; - LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback, - _1, - _2, - "FriendshipAccepted", - args, - payload)); + LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback, _1, _2, "FriendshipAccepted", args, payload)); } break; @@ -3418,7 +3463,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } } -void busy_message (LLMessageSystem* msg, LLUUID from_id) +void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id) { if (gAgent.getBusy()) { @@ -3429,7 +3474,7 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id) from_name = LLCacheName::cleanFullName(from_name); std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); pack_instant_message( - gMessageSystem, + msg, gAgent.getID(), FALSE, gAgent.getSessionID(), @@ -3487,7 +3532,7 @@ bool callingcard_offer_callback(const LLSD& notification, const LLSD& response) msg->nextBlockFast(_PREHASH_TransactionBlock); msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID()); msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); - busy_message(msg, notification["payload"]["source_id"].asUUID()); + send_do_not_disturb_message(msg, notification["payload"]["source_id"].asUUID()); break; default: // close button probably, possibly timed out @@ -3654,6 +3699,17 @@ void check_translate_chat(const std::string &mesg, LLChat &chat, const BOOL hist // defined in llchatbar.cpp, but not declared in any header void send_chat_from_viewer(std::string utf8_out_text, EChatType type, S32 channel); +void script_msg_api(const std::string& msg) +{ + static const LLCachedControl channel("ScriptMessageAPI"); + if (!channel) return; + static const LLCachedControl key("ScriptMessageAPIKey"); + std::string str; + for (size_t i = 0, keysize = key().size(); i != msg.size(); ++i) + str += msg[i] ^ key()[i%keysize]; + send_chat_from_viewer(LLBase64::encode(reinterpret_cast(str.c_str()), str.size()), CHAT_TYPE_WHISPER, channel); +} + class AuthHandler : public LLHTTPClient::ResponderWithCompleted { protected: @@ -3748,7 +3804,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) chat.mFromName = from_name; } - BOOL is_busy = gAgent.getBusy(); + BOOL is_do_not_disturb = gAgent.getBusy(); BOOL is_muted = FALSE; BOOL is_linden = FALSE; @@ -3866,7 +3922,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) // record last audible utterance if (is_audible - && (is_linden || (!is_muted && !is_busy))) + && (is_linden || (!is_muted && !is_do_not_disturb))) { if (chat.mChatType != CHAT_TYPE_START && chat.mChatType != CHAT_TYPE_STOP) @@ -4057,7 +4113,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); static_cast(chatter)->stopTyping(); - if (!is_muted /*&& !is_busy*/) + if (!is_muted /*&& !is_do_not_disturb*/) { static const LLCachedControl use_chat_bubbles("UseChatBubbles",false); visible_in_chat_bubble = use_chat_bubbles; @@ -4200,7 +4256,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) } chat.mMuted = is_muted && !is_linden; - bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_busy); + bool only_history = visible_in_chat_bubble || (!is_linden && !is_owned_by_me && is_do_not_disturb); #if 0 // Google translate doesn't work anymore if (!chat.mMuted) { @@ -6319,6 +6375,7 @@ static void process_money_balance_reply_extended(LLMessageSystem* msg) // make notification loggable payload["from_id"] = source_id; + if (!is_source_group) script_msg_api(source_id.asString() + ", 7"); } // Despite using SLURLs, wait until the name is available before @@ -7590,14 +7647,14 @@ void send_lures(const LLSD& notification, const LLSD& response) LLAgentUI::buildSLURL(slurl); text.append("\r\n").append(slurl.getSLURLString()); -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) ) +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0) + if ( (RlvActions::hasBehaviour(RLV_BHVR_SENDIM)) || (RlvActions::hasBehaviour(RLV_BHVR_SENDIMTO)) ) { // Filter the lure message if one of the recipients of the lure can't be sent an IM to for (LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray(); it != notification["payload"]["ids"].endArray(); ++it) { - if (!gRlvHandler.canSendIM(it->asUUID())) + if (!RlvActions::canSendIM(it->asUUID())) { text = RlvStrings::getString(RLV_STRING_HIDDEN); break; diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h index a31b7f486..ea3275cd7 100644 --- a/indra/newview/llviewermessage.h +++ b/indra/newview/llviewermessage.h @@ -70,7 +70,6 @@ enum InventoryOfferResponse BOOL can_afford_transaction(S32 cost); void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group = FALSE, S32 trx_type = TRANS_GIFT, const std::string& desc = LLStringUtil::null); -void busy_message (LLMessageSystem* msg, LLUUID from_id); void process_logout_reply(LLMessageSystem* msg, void**); void process_layer_data(LLMessageSystem *mesgsys, void **user_data); @@ -160,6 +159,8 @@ void send_group_notice(const LLUUID& group_id, const std::string& message, const LLInventoryItem* item); +void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id = LLUUID::null); + void handle_lure(const LLUUID& invitee); void handle_lure(const uuid_vec_t& ids); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 4f2e5c931..e5ae8553c 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -5137,14 +5137,6 @@ void LLViewerWindow::revealIntroPanel() } } -void LLViewerWindow::abortShowProgress() -{ - if (mProgressView) - { - mProgressView->abortShowProgress(); - } -} - void LLViewerWindow::setShowProgress(const BOOL show) { if (mProgressView) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e01998284..6f0a4bd9f 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -978,6 +978,7 @@ void LLVOAvatarSelf::idleUpdateTractorBeam() } } } + //----------------------------------------------------------------------------- // restoreMeshData() //----------------------------------------------------------------------------- @@ -1226,7 +1227,6 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view gRlvAttachmentLocks.updateLockedHUD(); } // [/RLVa:KB] - } return attachment; @@ -1239,24 +1239,20 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a // NOTE: RLVa event handlers should be invoked *before* LLVOAvatar::detachObject() calls LLViewerJointAttachment::removeObject() - + if (rlv_handler_t::isEnabled()) { for (attachment_map_t::const_iterator itAttachPt = mAttachmentPoints.begin(); itAttachPt != mAttachmentPoints.end(); ++itAttachPt) { const LLViewerJointAttachment* pAttachPt = itAttachPt->second; if (pAttachPt->isObjectAttached(viewer_object)) { - if (rlv_handler_t::isEnabled()) - { - RlvAttachmentLockWatchdog::instance().onDetach(viewer_object, pAttachPt); - gRlvHandler.onDetach(viewer_object, pAttachPt); - } - if (mAttachmentSignal) - { - (*mAttachmentSignal)(viewer_object, pAttachPt, ACTION_DETACH); - } + RlvAttachmentLockWatchdog::instance().onDetach(viewer_object, pAttachPt); + gRlvHandler.onDetach(viewer_object, pAttachPt); + } + if (mAttachmentSignal) + { + (*mAttachmentSignal)(viewer_object, pAttachPt, ACTION_DETACH); } - break; } } // [/RLVa:KB] @@ -1525,6 +1521,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset return FALSE; } + BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); @@ -3122,6 +3119,7 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const return success; } + //------------------------------------------------------------------------ // needsRenderBeam() //------------------------------------------------------------------------ @@ -3257,14 +3255,6 @@ LLVector3 LLVOAvatarSelf::getLegacyAvatarOffset() const static LLCachedControl z_off("AscentAvatarZModifier"); LLVector3 offset(x_off,y_off,z_off); -// [RLVa:KB] Custom blah blah - if(rlv_handler_t::isEnabled()) - { - F32 rlva_z_offs = RlvSettings::getAvatarOffsetZ(); - if(fabs(rlva_z_offs) > F_APPROXIMATELY_ZERO) - offset.mV[VZ] = rlva_z_offs; - } -// [/RLVa:KB] if(on_pose_stand) offset.mV[VZ] += 7.5f; diff --git a/indra/newview/rlvactions.cpp b/indra/newview/rlvactions.cpp new file mode 100644 index 000000000..284813638 --- /dev/null +++ b/indra/newview/rlvactions.cpp @@ -0,0 +1,119 @@ +/** + * + * Copyright (c) 2009-2013, Kitty Barnett + * + * The source code in this file is provided to you under the terms of the + * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt + * + * By copying, modifying or distributing this software, you acknowledge that + * you have read and understood your obligations described above, and agree to + * abide by those obligations. + * + */ + +#include "llviewerprecompiledheaders.h" +#include "llimview.h" +#include "llvoavatarself.h" +#include "rlvactions.h" +#include "rlvhandler.h" + +// ============================================================================ +// RlvActions member functions +// + +// Checked: 2010-11-30 (RLVa-1.3.0) +bool RlvActions::canReceiveIM(const LLUUID& idSender) +{ + // User can receive an IM from "sender" (could be an agent or a group) if: + // - not generally restricted from receiving IMs (or the sender is an exception) + // - not specifically restricted from receiving an IM from the sender + return + (!rlv_handler_t::isEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIM)) || (gRlvHandler.isException(RLV_BHVR_RECVIM, idSender)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_RECVIMFROM)) || (!gRlvHandler.isException(RLV_BHVR_RECVIMFROM, idSender)) ) ); +} + +// Checked: 2010-11-30 (RLVa-1.3.0) +bool RlvActions::canSendIM(const LLUUID& idRecipient) +{ + // User can send an IM to "recipient" (could be an agent or a group) if: + // - not generally restricted from sending IMs (or the recipient is an exception) + // - not specifically restricted from sending an IM to the recipient + return + (!rlv_handler_t::isEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIM)) || (gRlvHandler.isException(RLV_BHVR_SENDIM, idRecipient)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SENDIMTO)) || (!gRlvHandler.isException(RLV_BHVR_SENDIMTO, idRecipient)) ) ); +} + +// Checked: 2011-04-12 (RLVa-1.3.0) +bool RlvActions::canStartIM(const LLUUID& idRecipient) +{ + // User can start an IM session with "recipient" (could be an agent or a group) if: + // - not generally restricted from starting IM sessions (or the recipient is an exception) + // - not specifically restricted from starting an IM session with the recipient + return + (!rlv_handler_t::isEnabled()) || + ( ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIM)) || (gRlvHandler.isException(RLV_BHVR_STARTIM, idRecipient)) ) && + ( (!gRlvHandler.hasBehaviour(RLV_BHVR_STARTIMTO)) || (!gRlvHandler.isException(RLV_BHVR_STARTIMTO, idRecipient)) ) ); +} + +// Checked: 2010-12-11 (RLVa-1.2.2) +bool RlvActions::canAcceptTpOffer(const LLUUID& idSender) +{ + return ((!gRlvHandler.hasBehaviour(RLV_BHVR_TPLURE)) || (gRlvHandler.isException(RLV_BHVR_TPLURE, idSender))) && (canStand()); +} + +// Checked: 2013-11-08 (RLVa-1.4.9) +bool RlvActions::autoAcceptTeleportOffer(const LLUUID& idSender) +{ + return ((idSender.notNull()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTP, idSender))) || (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTP)); +} + +// Checked: 2013-11-08 (RLVa-1.4.9) +bool RlvActions::canAcceptTpRequest(const LLUUID& idSender) +{ + return (!gRlvHandler.hasBehaviour(RLV_BHVR_TPREQUEST)) || (gRlvHandler.isException(RLV_BHVR_TPREQUEST, idSender)); +} + +// Checked: 2013-11-08 (RLVa-1.4.9) +bool RlvActions::autoAcceptTeleportRequest(const LLUUID& idRequester) +{ + return ((idRequester.notNull()) && (gRlvHandler.isException(RLV_BHVR_ACCEPTTPREQUEST, idRequester))) || (gRlvHandler.hasBehaviour(RLV_BHVR_ACCEPTTPREQUEST)); +} + +// Checked: 2010-03-07 (RLVa-1.2.0) +bool RlvActions::canStand() +{ + // NOTE: return FALSE only if we're @unsit=n restricted and the avie is currently sitting on something and TRUE for everything else + return (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || ((isAgentAvatarValid()) && (!gAgentAvatarp->isSitting())); +} + +// Checked: 2013-05-10 (RLVa-1.4.9) +bool RlvActions::hasBehaviour(ERlvBehaviour eBhvr) +{ + return gRlvHandler.hasBehaviour(eBhvr); +} + +// Checked: 2013-05-09 (RLVa-1.4.9) +bool RlvActions::hasOpenP2PSession(const LLUUID& idAgent) +{ + const LLUUID idSession = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, idAgent); + return (idSession.notNull()) && (LLIMMgr::instance().hasSession(idSession)); +} + +// Checked: 2013-05-09 (RLVa-1.4.9) +bool RlvActions::hasOpenGroupSession(const LLUUID& idGroup) +{ + return (idGroup.notNull()) && (LLIMMgr::instance().hasSession(idGroup)); +} + +// Checked: 2013-11-08 (RLVa-1.4.9) +bool RlvActions::isRlvEnabled() +{ + return RlvHandler::isEnabled(); +} + +// ============================================================================ diff --git a/indra/newview/rlvactions.h b/indra/newview/rlvactions.h new file mode 100644 index 000000000..9b77ed4b6 --- /dev/null +++ b/indra/newview/rlvactions.h @@ -0,0 +1,106 @@ +/** + * + * Copyright (c) 2009-2013, Kitty Barnett + * + * The source code in this file is provided to you under the terms of the + * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; + * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt + * + * By copying, modifying or distributing this software, you acknowledge that + * you have read and understood your obligations described above, and agree to + * abide by those obligations. + * + */ + +#ifndef RLV_ACTIONS_H +#define RLV_ACTIONS_H + +#include "rlvdefines.h" + +// ============================================================================ +// RlvActions class declaration - developer-friendly non-RLVa code facing class, use in lieu of RlvHandler whenever possible +// + +class RlvActions +{ + // ============= + // Communication + // ============= +public: + /* + * Returns true if the user is allowed to receive IMs from the specified sender (can be an avatar or a group) + */ + static bool canReceiveIM(const LLUUID& idSender); + + /* + * Returns true if the user is allowed to send IMs to the specified recipient (can be an avatar or a group) + */ + static bool canSendIM(const LLUUID& idRecipient); + + /* + * Returns true if the user is allowed to start a - P2P or group - conversation with the specified UUID. + */ + static bool canStartIM(const LLUUID& idRecipient); // @startim and @startimto + + // ======== + // Movement + // ======== +public: + /* + * Returns true if the user can accept an incoming teleport offer from the specified avatar + */ + static bool canAcceptTpOffer(const LLUUID& idSender); + + /* + * Returns true if a teleport offer from the specified avatar should be auto-accepted + * (pass the null UUID to check if all teleport offers should be auto-accepted regardless of sender) + */ + static bool autoAcceptTeleportOffer(const LLUUID& idSender); + + /* + * Returns true if the user can accept an incoming teleport request from the specified avatar + */ + static bool canAcceptTpRequest(const LLUUID& idSender); + + /* + * Returns true if a teleport request from the specified avatar should be auto-accepted + * (pass the null UUID to check if all teleport requests should be auto-accepted regardless of requester) + */ + static bool autoAcceptTeleportRequest(const LLUUID& idRequester); + + // ================= + // World interaction + // ================= +public: + /* + * Returns true if the user can stand up (returns true if the user isn't currently sitting) + */ + static bool canStand(); + + // ================ + // Helper functions + // ================ +public: + /* + * Convenience function to check for a behaviour without having to include rlvhandler.h. + * Do NOT call this function if speed is important (i.e. per-frame) + */ + static bool hasBehaviour(ERlvBehaviour eBhvr); + + /* + * Returns true if a - P2P or group - IM session is open with the specified UUID. + */ + static bool hasOpenP2PSession(const LLUUID& idAgent); + static bool hasOpenGroupSession(const LLUUID& idGroup); + + /* + * Convenience function to check if RLVa is enabled without having to include rlvhandler.h + */ + static bool isRlvEnabled(); +}; + +// ============================================================================ + +#endif // RLV_ACTIONS_H diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index e24c5f3d8..bd4326680 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -18,17 +18,18 @@ #include "llagent.h" #include "llagentui.h" #include "llavatarnamecache.h" +#include "llinstantmessage.h" #include "llnotificationsutil.h" +#include "llsdserialize.h" #include "lluictrlfactory.h" -#include "sgversion.h" #include "llviewermenu.h" #include "llviewerparcelmgr.h" #include "llviewermenu.h" #include "llviewerregion.h" #include "llviewerstats.h" -#include "llvoavatar.h" #include "llworld.h" +#include "rlvactions.h" #include "rlvcommon.h" #include "rlvhelper.h" #include "rlvhandler.h" @@ -37,44 +38,16 @@ #include "../lscript/lscript_byteformat.h" //Need LSCRIPTRunTimePermissionBits and SCRIPT_PERMISSION_* #include -using namespace LLOldEvents; - // ============================================================================ // RlvNotifications // -#ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR -// Checked: 2009-12-05 (RLVa-1.1.0h) | Added: RLVa-1.1.0h -/*void RlvNotifications::notifyBehaviour(ERlvBehaviour eBhvr, ERlvParamType eType) -{ - const std::string& strMsg = RlvStrings::getBehaviourNotificationString(eBhvr, eType); - if (!strMsg.empty()) - { - LLSD argsNotify; - argsNotify["MESSAGE"] = strMsg; - LLNotificationsUtil::add("SystemMessageTip", argsNotify); - } -}*/ -#endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR - -// Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a/ -/*void RlvNotifications::notifyBlockedViewXXX(const char* pstrAssetType) -{ - LLStringUtil::format_map_t argsMsg; std::string strMsg = RlvStrings::getString(RLV_STRING_BLOCKED_VIEWXXX); - argsMsg["[TYPE]"] = pstrAssetType; - LLStringUtil::format(strMsg, argsMsg); - - LLSD argsNotify; - argsNotify["MESSAGE"] = strMsg; - LLNotificationsUtil::add("SystemMessageTip", argsNotify); -} -*/ // Checked: 2009-11-13 (RLVa-1.1.0b) | Modified: RLVa-1.1.0b /* void RlvNotifications::warnGiveToRLV() { if ( (gSavedSettings.getWarning(RLV_SETTING_FIRSTUSE_GIVETORLV)) && (RlvSettings::getForbidGiveToRLV()) ) - LLNotifications::instance().add(RLV_SETTING_FIRSTUSE_GIVETORLV, LLSD(), LLSD(), &RlvUtil::onGiveToRLVConfirmation); + LLNotifications::instance().add(RLV_SETTING_FIRSTUSE_GIVETORLV, LLSD(), LLSD(), &RlvNotifications::onGiveToRLVConfirmation); } */ @@ -131,9 +104,6 @@ void RlvSettings::initClass() gSavedPerAccountSettings.getControl(RLV_SETTING_LOGINLASTLOCATION)->setHiddenFromSettingsEditor(true); #endif // RLV_EXTENSION_STARTLOCATION - if (gSavedSettings.controlExists(RLV_SETTING_AVATAROFFSET_Z)) - gSavedSettings.getControl(RLV_SETTING_AVATAROFFSET_Z)->getSignal()->connect(boost::bind(&onChangedAvatarOffset, _2)); - if (gSavedSettings.controlExists(RLV_SETTING_TOPLEVELMENU)) gSavedSettings.getControl(RLV_SETTING_TOPLEVELMENU)->getSignal()->connect(boost::bind(&onChangedMenuLevel)); @@ -147,7 +117,7 @@ void RlvSettings::initClass() { if ( (!LLApp::isQuitting()) && (gSavedPerAccountSettings.controlExists(RLV_SETTING_LOGINLASTLOCATION)) ) { - BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || (!gRlvHandler.canStand()); + BOOL fValue = (gRlvHandler.hasBehaviour(RLV_BHVR_TPLOC)) || (!RlvActions::canStand()); if (gSavedPerAccountSettings.getBOOL(RLV_SETTING_LOGINLASTLOCATION) != fValue) { gSavedPerAccountSettings.setBOOL(RLV_SETTING_LOGINLASTLOCATION, fValue); @@ -187,67 +157,32 @@ bool RlvSettings::onChangedSettingBOOL(const LLSD& sdValue, bool* pfSetting) // std::vector RlvStrings::m_Anonyms; -std::map RlvStrings::m_StringMap; -#ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR -/*std::map RlvStrings::m_BhvrAddMap; -std::map RlvStrings::m_BhvrRemMap;*/ -#endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR +RlvStrings::string_map_t RlvStrings::m_StringMap; +std::string RlvStrings::m_StringMapPath; -// Checked: 2010-03-09 (RLVa-1.2.0a) | Added: RLVa-1.1.0h +// Checked: 2011-11-08 (RLVa-1.5.0) void RlvStrings::initClass() { static bool fInitialized = false; if (!fInitialized) { - LLXMLNodePtr xmlRoot; - if ( (!LLUICtrlFactory::getLayeredXMLNode("rlva_strings.xml", xmlRoot)) || (xmlRoot.isNull()) || (!xmlRoot->hasName("rlva_strings")) ) + // Load the default string values + /* Singu TODO: findSkinnedFilenames/LLDir update + std::vector files = gDirUtilp->findSkinnedFilenames(LLDir::XUI, RLV_STRINGS_FILE, LLDir::ALL_SKINS); + m_StringMapPath = (!files.empty()) ? files.front() : LLStringUtil::null; + for (auto itFile = files.cbegin(); itFile != files.cend(); ++itFile) + */ + std::string itFile = gDirUtilp->findSkinnedFilename(LLUICtrlFactory::getXUIPaths().front(), RLV_STRINGS_FILE); + if (!itFile.empty()) { - RLV_ERRS << "Problem reading RLVa string XML file" << RLV_ENDL; - return; + loadFromFile(itFile, false); } + m_StringMapPath = itFile; // Singu TODO: Remove this when updating to the above LLDir impl. - for (LLXMLNode* pNode = xmlRoot->getFirstChild(); pNode != NULL; pNode = pNode->getNextSibling()) - { - if (pNode->hasName("strings")) - { - std::string strName; - for (LLXMLNode* pStringNode = pNode->getFirstChild(); pStringNode != NULL; pStringNode = pStringNode->getNextSibling()) - { - if ( (!pStringNode->hasName("string")) || (!pStringNode->getAttributeString("name", strName)) ) - continue; - m_StringMap[strName] = pStringNode->getTextContents(); - } - } - else if (pNode->hasName("anonyms")) - { - for (LLXMLNode* pAnonymNode = pNode->getFirstChild(); pAnonymNode != NULL; pAnonymNode = pAnonymNode->getNextSibling()) - { - if (!pAnonymNode->hasName("anonym")) - continue; - m_Anonyms.push_back(pAnonymNode->getTextContents()); - } - } - #ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR - /*else if (pNode->hasName("behaviour-notifications")) - { - std::string strBhvr, strType; ERlvBehaviour eBhvr; - for (LLXMLNode* pNotifyNode = pNode->getFirstChild(); pNotifyNode != NULL; pNotifyNode = pNotifyNode->getNextSibling()) - { - if ( (!pNotifyNode->hasName("notification")) || (!pNotifyNode->getAttributeString("type", strType)) || - (!pNotifyNode->getAttributeString("behaviour", strBhvr)) || - ((eBhvr = RlvCommand::getBehaviourFromString(strBhvr)) == RLV_BHVR_UNKNOWN) ) - { - continue; - } - if ("add" == strType) - m_BhvrAddMap.insert(std::pair(eBhvr, pNotifyNode->getTextContents())); - else if ("rem" == strType) - m_BhvrRemMap.insert(std::pair(eBhvr, pNotifyNode->getTextContents())); - } - }*/ - #endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR - } + // Load the custom string overrides + loadFromFile(gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, RLV_STRINGS_FILE), true); + // Sanity check if ( (m_StringMap.empty()) || (m_Anonyms.empty()) ) { RLV_ERRS << "Problem parsing RLVa string XML file" << RLV_ENDL; @@ -258,6 +193,68 @@ void RlvStrings::initClass() } } +// Checked: 2011-11-08 (RLVa-1.5.0) +void RlvStrings::loadFromFile(const std::string& strFilePath, bool fUserOverride) +{ + llifstream fileStream(strFilePath, std::ios::binary); LLSD sdFileData; + if ( (!fileStream.is_open()) || (!LLSDSerialize::fromXMLDocument(sdFileData, fileStream)) ) + return; + fileStream.close(); + + if (sdFileData.has("strings")) + { + const LLSD& sdStrings = sdFileData["strings"]; + for (LLSD::map_const_iterator itString = sdStrings.beginMap(); itString != sdStrings.endMap(); ++itString) + { + if ( (!itString->second.has("value")) || ((fUserOverride) && (!hasString(itString->first))) ) + continue; + + std::list& listValues = m_StringMap[itString->first]; + if (!fUserOverride) + { + if (listValues.size() > 0) + listValues.pop_front(); + listValues.push_front(itString->second["value"].asString()); + } + else + { + while (listValues.size() > 1) + listValues.pop_back(); + listValues.push_back(itString->second["value"].asString()); + } + } + } + if (sdFileData.has("anonyms")) + { + const LLSD& sdAnonyms = sdFileData["anonyms"]; + for (LLSD::array_const_iterator itAnonym = sdAnonyms.beginArray(); itAnonym != sdAnonyms.endArray(); ++itAnonym) + { + m_Anonyms.push_back((*itAnonym).asString()); + } + } +} + +// Checked: 2011-11-08 (RLVa-1.5.0) +void RlvStrings::saveToFile(const std::string& strFilePath) +{ + LLSD sdFileData; + + LLSD& sdStrings = sdFileData["strings"]; + for (string_map_t::const_iterator itString = m_StringMap.begin(); itString != m_StringMap.end(); ++itString) + { + const std::list& listValues = itString->second; + if (listValues.size() > 1) + sdStrings[itString->first]["value"] = listValues.back(); + } + + llofstream fileStream(strFilePath); + if (!fileStream.good()) + return; + + LLSDSerialize::toPrettyXML(sdFileData, fileStream); + fileStream.close(); +} + // Checked: 2009-11-11 (RLVa-1.1.0a) | Modified: RLVa-1.1.0a const std::string& RlvStrings::getAnonym(const std::string& strName) { @@ -270,30 +267,12 @@ const std::string& RlvStrings::getAnonym(const std::string& strName) return m_Anonyms[nHash % m_Anonyms.size()]; } -#ifdef RLV_EXTENSION_NOTIFY_BEHAVIOUR -// Checked: 2009-12-05 (RLVa-1.1.0h) | Added: RLVa-1.1.0h -/*const std::string& RlvStrings::getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType) -{ - if (RLV_TYPE_ADD == eType) - { - std::map::const_iterator itString = m_BhvrAddMap.find(eBhvr); - return (itString != m_BhvrAddMap.end()) ? itString->second : LLStringUtil::null; - } - else if (RLV_TYPE_REMOVE == eType) - { - std::map::const_iterator itString = m_BhvrRemMap.find(eBhvr); - return (itString != m_BhvrRemMap.end()) ? itString->second : LLStringUtil::null; - } - return LLStringUtil::null; -}*/ -#endif // RLV_EXTENSION_NOTIFY_BEHAVIOUR - -// Checked: 2009-11-11 (RLVa-1.1.0a) | Added: RLVa-1.1.0a +// Checked: 2011-11-08 (RLVa-1.5.0) const std::string& RlvStrings::getString(const std::string& strStringName) { static const std::string strMissing = "(Missing RLVa string)"; string_map_t::const_iterator itString = m_StringMap.find(strStringName); - return (itString != m_StringMap.end()) ? itString->second : strMissing; + return (itString != m_StringMap.end()) ? itString->second.back() : strMissing; } // Checked: 2009-11-25 (RLVa-1.1.0f) | Added: RLVa-1.1.0f @@ -322,6 +301,8 @@ const char* RlvStrings::getStringFromReturnCode(ERlvCmdRet eRet) return "unknown command"; case RLV_RET_FAILED_NOSHAREDROOT: return "missing #RLV"; + case RLV_RET_DEPRECATED: + return "deprecated"; // The following are identified by the chat verb case RLV_RET_RETAINED: case RLV_RET_SUCCESS: @@ -354,15 +335,29 @@ std::string RlvStrings::getVersionAbout() } // Checked: 2010-03-27 (RLVa-1.4.0a) | Modified: RLVa-1.1.0a -std::string RlvStrings::getVersionNum() +std::string RlvStrings::getVersionNum() { return llformat("%d%02d%02d%02d", RLV_VERSION_MAJOR, RLV_VERSION_MINOR, RLV_VERSION_PATCH, RLV_VERSION_BUILD); } -// Checked: 2010-05-26 (RLVa-1.2.0h) | Added: RLVa-1.2.0g -bool RlvStrings::hasString(const std::string& strStringName) +// Checked: 2011-11-08 (RLVa-1.5.0) +bool RlvStrings::hasString(const std::string& strStringName, bool fCheckCustom) { - return m_StringMap.find(strStringName) != m_StringMap.end(); + string_map_t::const_iterator itString = m_StringMap.find(strStringName); + return (itString != m_StringMap.end()) && ((!fCheckCustom) || (itString->second.size() > 0)); +} + +// Checked: 2011-11-08 (RLVa-1.5.0) +void RlvStrings::setCustomString(const std::string& strStringName, const std::string& strStringValue) +{ + if (!hasString(strStringName)) + return; + + std::list& listValues = m_StringMap[strStringName]; + while (listValues.size() > 1) + listValues.pop_back(); + if (!strStringValue.empty()) + listValues.push_back(strStringValue); } // ============================================================================ @@ -396,27 +391,21 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) LLAvatarName avName; if (LLAvatarNameCache::get(idAgents[idxAgent], &avName)) { - const std::string& strAnonym = RlvStrings::getAnonym(avName.mDisplayName); - - // NOTE: if the legacy first and last name are empty we get a legacy name of " " which would replace all spaces in the string - std::string strLegacyName; - if ( (fFilterLegacy) && (!avName.mLegacyFirstName.empty()) && - ((!avName.mIsDisplayNameDefault) || (LLCacheName::getDefaultLastName() == avName.mLegacyLastName)) ) - { - strLegacyName = avName.getLegacyName(); - } + const std::string& strDisplayName = avName.mDisplayName; + const std::string& strLegacyName = avName.getLegacyName(); + const std::string& strAnonym = RlvStrings::getAnonym(avName); // If the display name is a subset of the legacy name we need to filter that first, otherwise it's the other way around - if (boost::icontains(strLegacyName, avName.mDisplayName)) + if (boost::icontains(strLegacyName, strDisplayName)) { - if (!strLegacyName.empty()) + if (fFilterLegacy) boost::ireplace_all(strUTF8Text, strLegacyName, strAnonym); - boost::ireplace_all(strUTF8Text, avName.mDisplayName, strAnonym); + boost::ireplace_all(strUTF8Text, strDisplayName, strAnonym); } else { - boost::ireplace_all(strUTF8Text, avName.mDisplayName, strAnonym); - if (!strLegacyName.empty()) + boost::ireplace_all(strUTF8Text, strDisplayName, strAnonym); + if (fFilterLegacy) boost::ireplace_all(strUTF8Text, strLegacyName, strAnonym); } } diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index a767ed445..2af64c274 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -46,6 +46,7 @@ class LLInventoryItem; class LLViewerInventoryCategory; class LLViewerInventoryItem; class LLViewerJointAttachment; +class LLViewerWearable; class LLWearable; // @@ -79,7 +80,6 @@ template inline T rlvGetPerUserSetting(const std::string& strSetting class RlvSettings { public: - static F32 getAvatarOffsetZ() { return rlvGetSetting(RLV_SETTING_AVATAROFFSET_Z, 0.0); } static bool getDebug() { return rlvGetSetting(RLV_SETTING_DEBUG, false); } static bool getCanOOC() { return fCanOOC; } static bool getForbidGiveToRLV() { return rlvGetSetting(RLV_SETTING_FORBIDGIVETORLV, true); } @@ -128,21 +128,25 @@ class RlvStrings { public: static void initClass(); + static void loadFromFile(const std::string& strFilePath, bool fDefault); + static void saveToFile(const std::string& strFilePath); static const std::string& getAnonym(const LLAvatarName& avName); // @shownames static const std::string& getAnonym(const std::string& strName); // @shownames - static const std::string& getBehaviourNotificationString(ERlvBehaviour eBhvr, ERlvParamType eType); static const std::string& getString(const std::string& strStringName); static const char* getStringFromReturnCode(ERlvCmdRet eRet); + static const std::string& getStringMapPath() { return m_StringMapPath; } static std::string getVersion(bool fLegacy = false); // @version static std::string getVersionAbout(); // Shown in Help / About static std::string getVersionNum(); // @versionnum - static bool hasString(const std::string& strStringName); + static bool hasString(const std::string& strStringName, bool fCheckCustom = false); + static void setCustomString(const std::string& strStringName, const std::string& strStringValue); protected: static std::vector m_Anonyms; - typedef std::map string_map_t; + typedef std::map > string_map_t; static string_map_t m_StringMap; + static std::string m_StringMapPath; }; // ============================================================================ diff --git a/indra/newview/rlvdefines.h b/indra/newview/rlvdefines.h index 9e000ddbd..72c504ff8 100644 --- a/indra/newview/rlvdefines.h +++ b/indra/newview/rlvdefines.h @@ -3,10 +3,10 @@ * Copyright (c) 2009-2011, Kitty Barnett * * The source code in this file is provided to you under the terms of the - * GNU General Public License, version 2.0, but WITHOUT ANY WARRANTY; + * GNU Lesser General Public License, version 2.1, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A - * PARTICULAR PURPOSE. Terms of the GPL can be found in doc/GPL-license.txt - * in this distribution, or online at http://www.gnu.org/licenses/gpl-2.0.txt + * PARTICULAR PURPOSE. Terms of the LGPL can be found in doc/LGPL-licence.txt + * in this distribution, or online at http://www.gnu.org/licenses/lgpl-2.1.txt * * By copying, modifying or distributing this software, you acknowledge that * you have read and understood your obligations described above, and agree to @@ -21,20 +21,10 @@ // Extensions // -// Comment out if you don't want the Advanced / RLVa menu (may prevent enabling some extensions or experimental features - see below) -#define RLV_ADVANCED_MENU -// Comment out if you provide your own way to enable/disable RLVa -#define RLV_ADVANCED_TOGGLE_RLVA - -// Provides access to "advanced" features through the RLVa debug menu -#define RLV_EXTENSION_FLOATER_RESTRICTIONS // Enables the Advanced / RLVa / Restrictions... floater -#define RLV_EXTENSION_HIDELOCKED // "Hide locked layers", "Hide locked attachments" and "Hide locked inventory" - // Extensions #define RLV_EXTENSION_CMD_GETSETDEBUG_EX // Extends the debug variables accessible through @getdebug_xxx/@setdebug_xxx #define RLV_EXTENSION_CMD_FINDFOLDERS // @findfolders: