diff --git a/indra/cmake/PNG.cmake b/indra/cmake/PNG.cmake index 565c22cec..7312156fc 100644 --- a/indra/cmake/PNG.cmake +++ b/indra/cmake/PNG.cmake @@ -8,6 +8,7 @@ if (STANDALONE) include(FindPNG) else (STANDALONE) use_prebuilt_binary(libpng) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/) if (WINDOWS) set(PNG_LIBRARIES libpng15) elseif(DARWIN) @@ -30,8 +31,7 @@ else (STANDALONE) # set(PNG_PRELOAD_ARCHIVES -Wl,--whole-archive png16 -Wl,--no-whole-archive) set(PNG_LIBRARIES png16) - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include/libpng16) + set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/libpng16) endif () endif() - set(PNG_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include/) endif (STANDALONE) diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index ccc48860d..db4823329 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -31,7 +31,6 @@ set(llcommon_SOURCE_FILES llapr.cpp llaprpool.cpp llassettype.cpp - llavatarname.cpp llbase32.cpp llbase64.cpp llcommon.cpp @@ -56,7 +55,6 @@ set(llcommon_SOURCE_FILES llfile.cpp llfindlocale.cpp llfixedbuffer.cpp - llfoldertype.cpp llformat.cpp llframetimer.cpp llheartbeat.cpp @@ -135,7 +133,6 @@ set(llcommon_HEADER_FILES llassoclist.h llatomic.h llavatarconstants.h - llavatarname.h llbase32.h llbase64.h llboost.h @@ -177,7 +174,6 @@ set(llcommon_HEADER_FILES llfile.h llfindlocale.h llfixedbuffer.h - llfoldertype.h llformat.h llframetimer.h llhandle.h diff --git a/indra/llcommon/llavatarname.cpp b/indra/llcommon/llavatarname.cpp deleted file mode 100644 index c05ac09d5..000000000 --- a/indra/llcommon/llavatarname.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/** - * @file llavatarname.cpp - * @brief Represents name-related data for an avatar, such as the - * username/SLID ("bobsmith123" or "james.linden") and the display - * name ("James Cook") - * - * $LicenseInfo:firstyear=2010&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ -#include "linden_common.h" - -#include "llavatarname.h" - -#include "lldate.h" -#include "llsd.h" - -// Store these in pre-built std::strings to avoid memory allocations in -// LLSD map lookups -static const std::string USERNAME("username"); -static const std::string DISPLAY_NAME("display_name"); -static const std::string LEGACY_FIRST_NAME("legacy_first_name"); -static const std::string LEGACY_LAST_NAME("legacy_last_name"); -static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); -static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); -static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); - -LLAvatarName::LLAvatarName() -: mUsername(), - mDisplayName(), - mLegacyFirstName(), - mLegacyLastName(), - mIsDisplayNameDefault(false), - mIsTemporaryName(false), - mExpires(F64_MAX), - mNextUpdate(0.0) -{ } - -bool LLAvatarName::operator<(const LLAvatarName& rhs) const -{ - if (mUsername == rhs.mUsername) - return mDisplayName < rhs.mDisplayName; - else - return mUsername < rhs.mUsername; -} - -LLSD LLAvatarName::asLLSD() const -{ - LLSD sd; - sd[USERNAME] = mUsername; - sd[DISPLAY_NAME] = mDisplayName; - sd[LEGACY_FIRST_NAME] = mLegacyFirstName; - sd[LEGACY_LAST_NAME] = mLegacyLastName; - sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; - sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); - sd[DISPLAY_NAME_NEXT_UPDATE] = LLDate(mNextUpdate); - return sd; -} - -void LLAvatarName::fromLLSD(const LLSD& sd) -{ - mUsername = sd[USERNAME].asString(); - mDisplayName = sd[DISPLAY_NAME].asString(); - mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); - mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); - mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean() || mUsername == mDisplayName; - LLDate expires = sd[DISPLAY_NAME_EXPIRES]; - mExpires = expires.secondsSinceEpoch(); - LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; - mNextUpdate = next_update.secondsSinceEpoch(); -} - -std::string LLAvatarName::getCompleteName(bool linefeed) const -{ - std::string name; - if (mUsername.empty() || mIsDisplayNameDefault) - // If the display name feature is off - // OR this particular display name is defaulted (i.e. based on user name), - // then display only the easier to read instance of the person's name. - { - name = mDisplayName; - } - else - { - name = mDisplayName + (linefeed ? "\n(" : " (") + mUsername + ")"; - } - return name; -} - -std::string LLAvatarName::getLegacyName() const -{ - std::string name; - name.reserve( mLegacyFirstName.size() + 1 + mLegacyLastName.size() ); - name = mLegacyFirstName; - name += " "; - name += mLegacyLastName; - return name; -} diff --git a/indra/llcommon/lleventtimer.cpp b/indra/llcommon/lleventtimer.cpp index a29a837a8..957b502dc 100644 --- a/indra/llcommon/lleventtimer.cpp +++ b/indra/llcommon/lleventtimer.cpp @@ -65,7 +65,7 @@ LLEventTimer::~LLEventTimer() void LLEventTimer::updateClass() { std::list completed_timers; - for (instance_iter iter = beginInstances(); iter != endInstances(); ) + for (instance_iter iter = beginInstances(), iter_end = endInstances(); iter != iter_end;) { LLEventTimer& timer = *iter++; F32 et = timer.mEventTimer.getElapsedTimeF32(); diff --git a/indra/llcommon/llfasttimer_class.cpp b/indra/llcommon/llfasttimer_class.cpp index e753fe309..81726be89 100644 --- a/indra/llcommon/llfasttimer_class.cpp +++ b/indra/llcommon/llfasttimer_class.cpp @@ -345,7 +345,7 @@ LLFastTimer::DeclareTimer::DeclareTimer(const std::string& name) void LLFastTimer::updateCachedPointers() { // Update DeclareTimer::mFrameState pointers. - for (DeclareTimer::instance_iter it = DeclareTimer::beginInstances(); it != DeclareTimer::endInstances(); ++it) + for (DeclareTimer::instance_iter it = DeclareTimer::beginInstances(), it_end = DeclareTimer::endInstances(); it != it_end; ++it) { // update cached pointer it->mFrameState = &it->mTimer.getFrameState(); @@ -537,7 +537,7 @@ void LLFastTimer::NamedTimer::buildHierarchy() // set up initial tree { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end = endInstances(); it != it_end; ++it) { NamedTimer& timer = *it; if (&timer == NamedTimerFactory::instance().getRootTimer()) continue; @@ -677,7 +677,7 @@ void LLFastTimer::NamedTimer::resetFrame() LLSD sd; { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end = endInstances(); it != it_end; ++it) { NamedTimer& timer = *it; FrameState& info = timer.getFrameState(); @@ -721,7 +721,7 @@ void LLFastTimer::NamedTimer::resetFrame() // reset for next frame { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end = endInstances(); it != it_end; ++it) { NamedTimer& timer = *it; @@ -765,7 +765,7 @@ void LLFastTimer::NamedTimer::reset() // reset all history { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end = endInstances(); it != it_end; ++it) { NamedTimer& timer = *it; if (&timer != NamedTimerFactory::instance().getRootTimer()) diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 415f872b6..07241ef0b 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -133,8 +133,6 @@ void LLMemory::updateMemoryInfo() sMaxPhysicalMemInKB = U32_MAX ; sAvailPhysicalMemInKB = U32_MAX ; #endif - - return ; } // diff --git a/indra/llimage/llimagepng.cpp b/indra/llimage/llimagepng.cpp index 294f68b12..7735dc137 100644 --- a/indra/llimage/llimagepng.cpp +++ b/indra/llimage/llimagepng.cpp @@ -67,7 +67,7 @@ BOOL LLImagePNG::updateData() } LLPngWrapper::ImageInfo infop; - if (! pngWrapper.readPng(getData(), NULL, &infop)) + if (! pngWrapper.readPng(getData(), getDataSize(), NULL, &infop)) { setLastError(pngWrapper.getErrorMessage()); return FALSE; @@ -102,7 +102,7 @@ BOOL LLImagePNG::decode(LLImageRaw* raw_image, F32 decode_time) return FALSE; } - if (! pngWrapper.readPng(getData(), raw_image)) + if (! pngWrapper.readPng(getData(), getDataSize(), raw_image)) { setLastError(pngWrapper.getErrorMessage()); return FALSE; diff --git a/indra/llimage/llpngwrapper.cpp b/indra/llimage/llpngwrapper.cpp index d33aa94fd..f515076c0 100644 --- a/indra/llimage/llpngwrapper.cpp +++ b/indra/llimage/llpngwrapper.cpp @@ -93,6 +93,12 @@ void LLPngWrapper::errorHandler(png_structp png_ptr, png_const_charp msg) void LLPngWrapper::readDataCallback(png_structp png_ptr, png_bytep dest, png_size_t length) { PngDataInfo *dataInfo = (PngDataInfo *) png_get_io_ptr(png_ptr); + if (S32(dataInfo->mOffset + length) > dataInfo->mDataSize) + { + png_error(png_ptr, "Data read error. Requested data size exceeds available data size."); + return; + } + U8 *src = &dataInfo->mData[dataInfo->mOffset]; memcpy(dest, src, length); dataInfo->mOffset += static_cast(length); @@ -120,7 +126,7 @@ void LLPngWrapper::writeFlush(png_structp png_ptr) // The scanline also begins at the bottom of // the image (per SecondLife conventions) instead of at the top, so we // must assign row-pointers in "reverse" order. -BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop) +BOOL LLPngWrapper::readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop) { try { @@ -139,6 +145,7 @@ BOOL LLPngWrapper::readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop) PngDataInfo dataPtr; dataPtr.mData = src; dataPtr.mOffset = 0; + dataPtr.mDataSize = dataSize; png_set_read_fn(mReadPngPtr, &dataPtr, &readDataCallback); png_set_sig_bytes(mReadPngPtr, 0); diff --git a/indra/llimage/llpngwrapper.h b/indra/llimage/llpngwrapper.h index 397d316d0..7aeb1a09c 100644 --- a/indra/llimage/llpngwrapper.h +++ b/indra/llimage/llpngwrapper.h @@ -49,7 +49,7 @@ public: }; BOOL isValidPng(U8* src); - BOOL readPng(U8* src, LLImageRaw* rawImage, ImageInfo *infop = NULL); + BOOL readPng(U8* src, S32 dataSize, LLImageRaw* rawImage, ImageInfo *infop = NULL); BOOL writePng(const LLImageRaw* rawImage, U8* dst); U32 getFinalSize(); const std::string& getErrorMessage(); @@ -66,6 +66,7 @@ private: { U8 *mData; U32 mOffset; + S32 mDataSize; }; static void writeFlush(png_structp png_ptr); diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt index afd5de34f..f288fa496 100644 --- a/indra/llinventory/CMakeLists.txt +++ b/indra/llinventory/CMakeLists.txt @@ -18,6 +18,7 @@ include_directories( set(llinventory_SOURCE_FILES llcategory.cpp lleconomy.cpp + llfoldertype.cpp llinventory.cpp llinventorydefines.cpp llinventorytype.cpp @@ -35,6 +36,7 @@ set(llinventory_HEADER_FILES llcategory.h lleconomy.h + llfoldertype.h llinventory.h llinventorydefines.h llinventorytype.h diff --git a/indra/llcommon/llfoldertype.cpp b/indra/llinventory/llfoldertype.cpp similarity index 100% rename from indra/llcommon/llfoldertype.cpp rename to indra/llinventory/llfoldertype.cpp diff --git a/indra/llcommon/llfoldertype.h b/indra/llinventory/llfoldertype.h similarity index 98% rename from indra/llcommon/llfoldertype.h rename to indra/llinventory/llfoldertype.h index 7e7cfa2b9..421c44fea 100644 --- a/indra/llcommon/llfoldertype.h +++ b/indra/llinventory/llfoldertype.h @@ -39,7 +39,7 @@ // This class handles folder types (similar to assettype, except for folders) // and operations on those. -class LL_COMMON_API LLFolderType +class LLFolderType { public: // ! BACKWARDS COMPATIBILITY ! Folder type enums must match asset type enums. diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index 2f9963706..6523a2c9a 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -35,6 +35,7 @@ set(llmessage_SOURCE_FILES llares.cpp llareslistener.cpp llassetstorage.cpp + llavatarname.cpp llavatarnamecache.cpp llblowfishcipher.cpp llbuffer.cpp @@ -125,6 +126,7 @@ set(llmessage_HEADER_FILES llares.h llareslistener.h llassetstorage.h + llavatarname.h llavatarnamecache.h llblowfishcipher.h llbuffer.h diff --git a/indra/llmessage/aihttptimeoutpolicy.cpp b/indra/llmessage/aihttptimeoutpolicy.cpp index fbd143c30..4c71111f5 100644 --- a/indra/llmessage/aihttptimeoutpolicy.cpp +++ b/indra/llmessage/aihttptimeoutpolicy.cpp @@ -907,7 +907,6 @@ AIHTTPTimeoutPolicy const* AIHTTPTimeoutPolicy::getTimeoutPolicyByName(std::stri // Policy name Policy P(assetReportHandler); P(authHandler); -P(avatarNameResponder); P2(baseCapabilitiesComplete, transfer_18s_connect_5s); P(blockingLLSDPost); P(blockingLLSDGet); @@ -926,8 +925,6 @@ P(fetchScriptLimitsRegionSummaryResponder); P(fnPtrResponder); P(floaterPermsResponder); P2(gamingDataReceived, transfer_22s_connect_10s); -P(groupBanDataResponder); -P2(groupMemberDataResponder, transfer_300s); P2(groupProposalBallotResponder, transfer_300s); P(homeLocationResponder); P2(HTTPGetResponder, reply_15s); @@ -936,8 +933,6 @@ P(iamHereVoice); P2(inventoryModelFetchDescendentsResponder, transfer_300s); P(inventoryModelFetchItemResponder); P(lcl_responder); -P(MPImportGetResponder); -P(MPImportPostResponder); P(mapLayerResponder); P(materialsResponder); P2(maturityPreferences, transfer_30s_connect_10s); @@ -957,21 +952,16 @@ P(regionResponder); P(remoteParcelRequestResponder); P(requestAgentUpdateAppearance); P(responderIgnore); -P(sessionInviteResponder); P(setDisplayNameResponder); P2(simulatorFeaturesReceived, transfer_22s_connect_10s); -P(startConferenceChatResponder); P2(startGroupVoteResponder, transfer_300s); P(translationReceiver); P(uploadModelPremissionsResponder); -P(userReportResponder); P(verifiedDestinationResponder); P(viewerChatterBoxInvitationAcceptResponder); P(viewerMediaOpenIDResponder); P(viewerMediaWebProfileResponder); P(viewerStatsResponder); -P(vivoxVoiceAccountProvisionResponder); -P(vivoxVoiceClientCapResponder); P(voiceCallCapResponder); P(webProfileResponders); P(wholeModelFeeResponder); diff --git a/indra/llmessage/llavatarname.cpp b/indra/llmessage/llavatarname.cpp new file mode 100644 index 000000000..fdcfed161 --- /dev/null +++ b/indra/llmessage/llavatarname.cpp @@ -0,0 +1,254 @@ +/** + * @file llavatarname.cpp + * @brief Represents name-related data for an avatar, such as the + * username/SLID ("bobsmith123" or "james.linden") and the display + * name ("James Cook") + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ +#include "linden_common.h" + +#include "llavatarname.h" + +#include "llcontrol.h" // For LLCachedControl +#include "lldate.h" +#include "llframetimer.h" +#include "llsd.h" + +// Store these in pre-built std::strings to avoid memory allocations in +// LLSD map lookups +static const std::string USERNAME("username"); +static const std::string DISPLAY_NAME("display_name"); +static const std::string LEGACY_FIRST_NAME("legacy_first_name"); +static const std::string LEGACY_LAST_NAME("legacy_last_name"); +static const std::string IS_DISPLAY_NAME_DEFAULT("is_display_name_default"); +static const std::string DISPLAY_NAME_EXPIRES("display_name_expires"); +static const std::string DISPLAY_NAME_NEXT_UPDATE("display_name_next_update"); + +bool LLAvatarName::sUseDisplayNames = true; +bool LLAvatarName::sUseUsernames = true; + +// Minimum time-to-live (in seconds) for a name entry. +// Avatar name should always guarantee to expire reasonably soon by default +// so if the failure to get a valid expiration time was due to something temporary +// we will eventually request and get the right data. +const F64 MIN_ENTRY_LIFETIME = 60.0; + +LLAvatarName::LLAvatarName() +: mUsername(), + mDisplayName(), + mLegacyFirstName(), + mLegacyLastName(), + mIsDisplayNameDefault(false), + mIsTemporaryName(false), + mExpires(F64_MAX), + mNextUpdate(0.0) +{ } + +bool LLAvatarName::operator<(const LLAvatarName& rhs) const +{ + if (mUsername == rhs.mUsername) + return mDisplayName < rhs.mDisplayName; + else + return mUsername < rhs.mUsername; +} + +//static +void LLAvatarName::setUseDisplayNames(bool use) +{ + sUseDisplayNames = use; +} +//static +bool LLAvatarName::useDisplayNames() +{ + return sUseDisplayNames; +} + +void LLAvatarName::setUseUsernames(bool use) +{ + sUseUsernames = use; +} + +bool LLAvatarName::useUsernames() +{ + return sUseUsernames; +} + +LLSD LLAvatarName::asLLSD() const +{ + LLSD sd; + sd[USERNAME] = mUsername; + sd[DISPLAY_NAME] = mDisplayName; + sd[LEGACY_FIRST_NAME] = mLegacyFirstName; + sd[LEGACY_LAST_NAME] = mLegacyLastName; + sd[IS_DISPLAY_NAME_DEFAULT] = mIsDisplayNameDefault; + sd[DISPLAY_NAME_EXPIRES] = LLDate(mExpires); + sd[DISPLAY_NAME_NEXT_UPDATE] = LLDate(mNextUpdate); + return sd; +} + +void LLAvatarName::fromLLSD(const LLSD& sd) +{ + mUsername = sd[USERNAME].asString(); + mDisplayName = sd[DISPLAY_NAME].asString(); + mLegacyFirstName = sd[LEGACY_FIRST_NAME].asString(); + mLegacyLastName = sd[LEGACY_LAST_NAME].asString(); + mIsDisplayNameDefault = sd[IS_DISPLAY_NAME_DEFAULT].asBoolean() || mUsername == mDisplayName; + LLDate expires = sd[DISPLAY_NAME_EXPIRES]; + mExpires = expires.secondsSinceEpoch(); + LLDate next_update = sd[DISPLAY_NAME_NEXT_UPDATE]; + mNextUpdate = next_update.secondsSinceEpoch(); + + // Some avatars don't have explicit display names set. Force a legible display name here. + if (mDisplayName.empty()) + { + mDisplayName = mUsername; + mIsDisplayNameDefault = true; + } +} + +// Transform a string (typically provided by the legacy service) into a decent +// avatar name instance. +void LLAvatarName::fromString(const std::string& full_name) +{ + mDisplayName = full_name; + std::string::size_type index = full_name.find(' '); + if (index != std::string::npos) + { + // The name is in 2 parts (first last) + mLegacyFirstName = full_name.substr(0, index); + mLegacyLastName = full_name.substr(index+1); + if (mLegacyLastName != "Resident") + { + mUsername = mLegacyFirstName + "." + mLegacyLastName; + mDisplayName = full_name; + LLStringUtil::toLower(mUsername); + } + else + { + // Very old names do have a dummy "Resident" last name + // that we choose to hide from users. + mUsername = mLegacyFirstName; + mDisplayName = mLegacyFirstName; + } + } + else + { + mLegacyFirstName = full_name; + mLegacyLastName = ""; + mUsername = full_name; + mDisplayName = full_name; + } + mIsDisplayNameDefault = true; + mIsTemporaryName = true; + setExpires(MIN_ENTRY_LIFETIME); +} + +void LLAvatarName::setExpires(F64 expires) +{ + mExpires = LLFrameTimer::getTotalSeconds() + expires; +} + +std::string LLAvatarName::getCompleteName(bool linefeed) const +{ + std::string name; + if (sUseDisplayNames) + { + if (mUsername.empty() || mIsDisplayNameDefault) + { + // If this particular display name is defaulted (i.e. based on user name), + // then display only the easier to read instance of the person's name. + name = mDisplayName; + } + else + { + name = mDisplayName; + if (sUseUsernames) + { + name += (linefeed ? "\n(" : " (") + mUsername + ")"; + } + } + } + else + { + name = getUserName(); + } + return name; +} + +std::string LLAvatarName::getLegacyName() const +{ + if (mLegacyFirstName.empty() && mLegacyLastName.empty()) // display names disabled? + { + return mDisplayName; + } + + static const LLCachedControl show_resident("LiruShowLastNameResident", false); + if (show_resident || mLegacyLastName != "Resident") + return mLegacyFirstName + ' ' + mLegacyLastName; + return mLegacyFirstName; +} + +std::string LLAvatarName::getDisplayName() const +{ + if (sUseDisplayNames) + { + return mDisplayName; + } + else + { + return getUserName(); + } +} + +std::string LLAvatarName::getUserName() const +{ + std::string name; + if (mLegacyLastName.empty() /*|| (mLegacyLastName == "Resident")*/) // + { + if (mLegacyFirstName.empty()) + { + // If we cannot create a user name from the legacy strings, use the display name + name = mDisplayName; + } + else + { + // The last name might be empty if it defaulted to "Resident" + name = mLegacyFirstName; + } + } + else + { + name = mLegacyFirstName + " " + mLegacyLastName; + } + return name; +} + +void LLAvatarName::dump() const +{ + LL_DEBUGS("AvNameCache") << "LLAvatarName: " + << "user '" << mUsername << "' " + << "display '" << mDisplayName << "' " + << "expires in " << mExpires - LLFrameTimer::getTotalSeconds() << " seconds" + << LL_ENDL; +} + diff --git a/indra/llcommon/llavatarname.h b/indra/llmessage/llavatarname.h similarity index 55% rename from indra/llcommon/llavatarname.h rename to indra/llmessage/llavatarname.h index ee3a680e5..5902d34d8 100644 --- a/indra/llcommon/llavatarname.h +++ b/indra/llmessage/llavatarname.h @@ -30,19 +30,41 @@ #include +const S32& main_name_system(); + class LLSD; -class LL_COMMON_API LLAvatarName +class LLAvatarName { public: LLAvatarName(); bool operator<(const LLAvatarName& rhs) const; + // Conversion to and from LLSD (cache file or server response) LLSD asLLSD() const; - void fromLLSD(const LLSD& sd); + // Used only in legacy mode when the display name capability is not provided server side + // or to otherwise create a temporary valid item. + void fromString(const std::string& full_name); + + // Set the name object to become invalid in "expires" seconds from now + void setExpires(F64 expires); + + // Set and get the display name flag set by the user in preferences. + static void setUseDisplayNames(bool use); + static bool useDisplayNames(); + + static void setUseUsernames(bool use); + static bool useUsernames(); + + // A name object is valid if not temporary and not yet expired (default is expiration not checked) + bool isValidName(F64 max_unrefreshed = 0.0f) const { return !mIsTemporaryName && (mExpires >= max_unrefreshed); } + + // Return true if the name is made up from legacy or temporary data + bool isDisplayNameDefault() const { return mIsDisplayNameDefault; } + // For normal names, returns "James Linden (james.linden)" // When display names are disabled returns just "James Linden" std::string getCompleteName(bool linefeed = false) const; @@ -52,10 +74,49 @@ public: // *TODO: Eliminate this in favor of username only std::string getLegacyName() const; + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode + // Takes the display name preference into account. This is truly the name that should + // be used for all UI where an avatar name has to be used unless we truly want something else (rare) + std::string getDisplayName() const; + + // Returns "James Linden" or "bobsmith123 Resident" + // Used where we explicitely prefer or need a non UTF-8 legacy (ASCII) name + // Also used for backwards compatibility with systems like voice and muting + std::string getUserName() const; + + // Returns "james.linden" or the legacy name for very old names + std::string getAccountName() const { return mUsername; } + + // Returns name in the format desired according to name_system + std::string getNSName(const S32& name_system = main_name_system()) const + { + switch (name_system) + { + case 1 : return getCompleteName(); + case 2 : return getDisplayName(); + case 3 : return getLegacyName() + (mIsDisplayNameDefault ? "" : " (" + mDisplayName + ")"); break; + default : return getLegacyName(); + } + } + + // Debug print of the object + void dump() const; + + // Names can change, so need to keep track of when name was + // last checked. + // Unix time-from-epoch seconds for efficiency + F64 mExpires; + + // You can only change your name every N hours, so record + // when the next update is allowed + // Unix time-from-epoch seconds + F64 mNextUpdate; + +private: // "bobsmith123" or "james.linden", US-ASCII only std::string mUsername; - // "Jose' Sanchez" or "James Linden", UTF-8 encoded Unicode + // "José Sanchez" or "James Linden", UTF-8 encoded Unicode // Contains data whether or not user has explicitly set // a display name; may duplicate their username. std::string mDisplayName; @@ -81,15 +142,12 @@ public: // shown in UI, but are not serialized. bool mIsTemporaryName; - // Names can change, so need to keep track of when name was - // last checked. - // Unix time-from-epoch seconds for efficiency - F64 mExpires; - - // You can only change your name every N hours, so record - // when the next update is allowed - // Unix time-from-epoch seconds - F64 mNextUpdate; + // Global flag indicating if display name should be used or not + // This will affect the output of the high level "get" methods + static bool sUseDisplayNames; + + // Flag indicating if username should be shown after display name or not + static bool sUseUsernames; }; #endif diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index d6aca358e..83e376858 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -44,10 +44,6 @@ namespace LLAvatarNameCache { use_display_name_signal_t mUseDisplayNamesSignal; - // Manual override for display names - can disable even if the region - // supports it. - bool sUseDisplayNames = true; - // [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c // RLVa override for display names bool sForceDisplayNames = false; @@ -57,18 +53,22 @@ namespace LLAvatarNameCache // current region supports display names. bool sRunning = false; + // Use the People API (modern) for fetching name if true. Use the old legacy protocol if false. + // For testing, there's a UsePeopleAPI setting that can be flipped (must restart viewer). + bool sUsePeopleAPI = true; + // Base lookup URL for name service. // On simulator, loaded from indra.xml // On viewer, usually a simulator capability (at People API team's request) // Includes the trailing slash, like "http://pdp60.lindenlab.com:8000/agents/" std::string sNameLookupURL; - // accumulated agent IDs for next query against service + // Accumulated agent IDs for next query against service typedef std::set ask_queue_t; ask_queue_t sAskQueue; - // agent IDs that have been requested, but with no reply - // maps agent ID to frame time request was made + // Agent IDs that have been requested, but with no reply. + // Maps agent ID to frame time request was made. typedef std::map pending_queue_t; pending_queue_t sPendingQueue; @@ -79,21 +79,21 @@ namespace LLAvatarNameCache typedef std::map signal_map_t; signal_map_t sSignalMap; - // names we know about + // The cache at last, i.e. avatar names we know about. typedef std::map cache_t; cache_t sCache; - // Send bulk lookup requests a few times a second at most - // only need per-frame timing resolution + // Send bulk lookup requests a few times a second at most. + // Only need per-frame timing resolution. LLFrameTimer sRequestTimer; - /// Maximum time an unrefreshed cache entry is allowed + // Maximum time an unrefreshed cache entry is allowed. const F64 MAX_UNREFRESHED_TIME = 20.0 * 60.0; - /// Time when unrefreshed cached names were checked last + // Time when unrefreshed cached names were checked last. static F64 sLastExpireCheck; - /// Time-to-live for a temp cache entry. + // Time-to-live for a temp cache entry. const F64 TEMP_CACHE_ENTRY_LIFETIME = 60.0; //----------------------------------------------------------------------- @@ -101,26 +101,21 @@ namespace LLAvatarNameCache //----------------------------------------------------------------------- // Handle name response off network. - // Optionally skip adding to cache, used when this is a fallback to the - // legacy name system. void processName(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool add_to_cache); + const LLAvatarName& av_name); void requestNamesViaCapability(); - // Legacy name system callback + // Legacy name system callbacks void legacyNameCallback(const LLUUID& agent_id, const std::string& full_name, - bool is_group - ); + bool is_group); + void legacyNameFetch(const LLUUID& agent_id, + const std::string& full_name, + bool is_group); void requestNamesViaLegacy(); - // Fill in an LLAvatarName with the legacy name data - void buildLegacyName(const std::string& full_name, - LLAvatarName* av_name); - // Do a single callback to a given slot void fireSignal(const LLUUID& agent_id, const callback_slot_t& slot, @@ -174,31 +169,37 @@ namespace LLAvatarNameCache */ -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy avatarNameResponder_timeout; - class LLAvatarNameResponder : public LLHTTPClient::ResponderWithResult { + LOG_CLASS(LLAvatarNameResponder); private: // need to store agent ids that are part of this request in case of // an error, so we can flag them as unavailable std::vector mAgentIDs; // Need the headers to look up Expires: and Retry-After: - virtual bool needsHeaders(void) const { return true; } - + /*virtual*/ bool needsHeaders() const { return true; } + /*virtual*/ char const* getName() const { return "LLAvatarNameResponder"; } + public: LLAvatarNameResponder(const std::vector& agent_ids) : mAgentIDs(agent_ids) { } - /*virtual*/ void httpSuccess(void) +protected: + /*virtual*/ void httpSuccess() { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } // Pull expiration out of headers if available - F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(mReceivedHeaders); + F64 expires = LLAvatarNameCache::nameExpirationFromHeaders(getResponseHeaders()); F64 now = LLFrameTimer::getTotalSeconds(); - LLSD agents = mContent["agents"]; + const LLSD& agents = content["agents"]; LLSD::array_const_iterator it = agents.beginArray(); for ( ; it != agents.endArray(); ++it) { @@ -211,24 +212,15 @@ public: // Use expiration time from header av_name.mExpires = expires; - // Some avatars don't have explicit display names set - if (av_name.mDisplayName.empty()) - { - av_name.mDisplayName = av_name.mUsername; - } - - LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << " " - << "user '" << av_name.mUsername << "' " - << "display '" << av_name.mDisplayName << "' " - << "expires in " << expires - now << " seconds" - << LL_ENDL; + LL_DEBUGS("AvNameCache") << "LLAvatarNameResponder::result for " << agent_id << LL_ENDL; + av_name.dump(); // cache it and fire signals - LLAvatarNameCache::processName(agent_id, av_name, true); + LLAvatarNameCache::processName(agent_id, av_name); } // Same logic as error response case - LLSD unresolved_agents = mContent["bad_ids"]; + const LLSD& unresolved_agents = content["bad_ids"]; S32 num_unresolved = unresolved_agents.size(); if (num_unresolved > 0) { @@ -252,14 +244,13 @@ public: << LL_ENDL; } - /*virtual*/ void httpFailure(void) + /*virtual*/ void httpFailure() { // If there's an error, it might be caused by PeopleApi, // or when loading textures on startup and using a very slow // network, this query may time out. // What we should do depends on whether or not we have a cached name - LL_WARNS("AvNameCache") << "LLAvatarNameResponder::httpFailure " << mStatus << " " << mReason - << LL_ENDL; + LL_WARNS("AvNameCache") << dumpResponse() << LL_ENDL; // Add dummy records for any agent IDs in this request that we do not have cached already std::vector::const_iterator it = mAgentIDs.begin(); @@ -269,9 +260,6 @@ public: LLAvatarNameCache::handleAgentError(agent_id); } } - - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return avatarNameResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLAvatarNameResponder"; } }; // Provide some fallback for agents that return errors @@ -284,48 +272,34 @@ void LLAvatarNameCache::handleAgentError(const LLUUID& agent_id) LL_WARNS("AvNameCache") << "LLAvatarNameCache get legacy for agent " << agent_id << LL_ENDL; gCacheName->get(agent_id, false, // legacy compatibility - boost::bind(&LLAvatarNameCache::legacyNameCallback, - _1, _2, _3)); + boost::bind(&LLAvatarNameCache::legacyNameFetch, _1, _2, _3)); } else { - // we have a chached (but probably expired) entry - since that would have + // we have a cached (but probably expired) entry - since that would have // been returned by the get method, there is no need to signal anyone // Clear this agent from the pending list LLAvatarNameCache::sPendingQueue.erase(agent_id); LLAvatarName& av_name = existing->second; - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " - << agent_id - << "user '" << av_name.mUsername << "' " - << "display '" << av_name.mDisplayName << "' " - << "expires in " << av_name.mExpires - LLFrameTimer::getTotalSeconds() << " seconds" - << LL_ENDL; - av_name.mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; // reset expiry time so we don't constantly rerequest. + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache use cache for agent " << agent_id << LL_ENDL; + av_name.dump(); + + // Reset expiry time so we don't constantly rerequest. + av_name.setExpires(TEMP_CACHE_ENTRY_LIFETIME); } } -void LLAvatarNameCache::processName(const LLUUID& agent_id, - const LLAvatarName& av_name, - bool add_to_cache) +void LLAvatarNameCache::processName(const LLUUID& agent_id, const LLAvatarName& av_name) { - if (add_to_cache) - { - // sCache[agent_id] = av_name; - // [SL:KB] - Patch: Agent-DisplayNames | Checked: 2010-12-28 (Catznip-2.4.0h) | Added: Catznip-2.4.0h - // Don't replace existing entries with dummies - cache_t::iterator itName = (av_name.mIsTemporaryName) ? sCache.find(agent_id) : sCache.end(); - if (sCache.end() != itName) - itName->second.mExpires = av_name.mExpires; - else - sCache[agent_id] = av_name; - // [/SL:KB] - } + // Add to the cache + sCache[agent_id] = av_name; + // Suppress request from the queue sPendingQueue.erase(agent_id); - // signal everyone waiting on this name + // Signal everyone waiting on this name signal_map_t::iterator sig_it = sSignalMap.find(agent_id); if (sig_it != sSignalMap.end()) { @@ -356,7 +330,6 @@ void LLAvatarNameCache::requestNamesViaCapability() std::vector agent_ids; agent_ids.reserve(128); - U32 id_total = sAskQueue.size(); U32 ids = 0; ask_queue_t::const_iterator it; while(!sAskQueue.empty()) @@ -393,7 +366,7 @@ void LLAvatarNameCache::requestNamesViaCapability() if (!url.empty()) { LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaCapability requested " - << ids << "/" << id_total << "ids " + << ids << " ids" << LL_ENDL; LLHTTPClient::get(url, new LLAvatarNameResponder(agent_ids)); } @@ -403,22 +376,33 @@ void LLAvatarNameCache::legacyNameCallback(const LLUUID& agent_id, const std::string& full_name, bool is_group) { - // Construct a dummy record for this name. By convention, SLID is blank - // Never expires, but not written to disk, so lasts until end of session. - LLAvatarName av_name; - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameCallback " + // Put the received data in the cache + legacyNameFetch(agent_id, full_name, is_group); + + // Retrieve the name and set it to never (or almost never...) expire: when we are using the legacy + // protocol, we do not get an expiration date for each name and there's no reason to ask the + // data again and again so we set the expiration time to the largest value admissible. + std::map::iterator av_record = sCache.find(agent_id); + LLAvatarName& av_name = av_record->second; + av_name.setExpires(MAX_UNREFRESHED_TIME); +} + +void LLAvatarNameCache::legacyNameFetch(const LLUUID& agent_id, + const std::string& full_name, + bool is_group) +{ + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::legacyNameFetch " << "agent " << agent_id << " " << "full name '" << full_name << "'" << ( is_group ? " [group]" : "" ) << LL_ENDL; - buildLegacyName(full_name, &av_name); - // Add to cache, because if we don't we'll keep rerequesting the - // same record forever. buildLegacyName should always guarantee - // that these records expire reasonably soon - // (in TEMP_CACHE_ENTRY_LIFETIME seconds), so if the failure was due - // to something temporary we will eventually request and get the right data. - processName(agent_id, av_name, true); + // Construct an av_name record from this name. + LLAvatarName av_name; + av_name.fromString(full_name); + + // Add to cache: we're still using the new cache even if we're using the old (legacy) protocol. + processName(agent_id, av_name); } void LLAvatarNameCache::requestNamesViaLegacy() @@ -440,25 +424,28 @@ void LLAvatarNameCache::requestNamesViaLegacy() LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::requestNamesViaLegacy agent " << agent_id << LL_ENDL; gCacheName->get(agent_id, false, // legacy compatibility - boost::bind(&LLAvatarNameCache::legacyNameCallback, - _1, _2, _3)); + boost::bind(&LLAvatarNameCache::legacyNameCallback, _1, _2, _3)); } } -void LLAvatarNameCache::initClass(bool running) +void LLAvatarNameCache::initClass(bool running, bool usePeopleAPI) { sRunning = running; + sUsePeopleAPI = usePeopleAPI; } void LLAvatarNameCache::cleanupClass() { + sCache.clear(); } void LLAvatarNameCache::importFile(std::istream& istr) { LLSD data; - S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr); - if (parse_count < 1) return; + if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr)) + { + return; + } // by convention LLSD storage is a map // we only store one entry in the map @@ -490,7 +477,7 @@ void LLAvatarNameCache::exportFile(std::ostream& ostr) const LLUUID& agent_id = it->first; const LLAvatarName& av_name = it->second; // Do not write temporary or expired entries to the stored cache - if (!av_name.mIsTemporaryName && av_name.mExpires >= max_unrefreshed) + if (av_name.isValidName(max_unrefreshed)) { // key must be a string agents[agent_id.asString()] = av_name.asLLSD(); @@ -511,6 +498,11 @@ bool LLAvatarNameCache::hasNameLookupURL() return !sNameLookupURL.empty(); } +bool LLAvatarNameCache::usePeopleAPI() +{ + return hasNameLookupURL() && sUsePeopleAPI; +} + void LLAvatarNameCache::idle() { // By convention, start running at first idle() call @@ -527,13 +519,12 @@ void LLAvatarNameCache::idle() if (!sAskQueue.empty()) { - if (useDisplayNames()) + if (usePeopleAPI()) { requestNamesViaCapability(); } else { - // ...fall back to legacy name cache system requestNamesViaLegacy(); } } @@ -541,7 +532,7 @@ void LLAvatarNameCache::idle() if (sAskQueue.empty()) { // cleared the list, reset the request timer. - sRequestTimer.reset(SECS_BETWEEN_REQUESTS); + sRequestTimer.resetWithExpiry(SECS_BETWEEN_REQUESTS); } // erase anything that has not been refreshed for more than MAX_UNREFRESHED_TIME @@ -577,9 +568,8 @@ void LLAvatarNameCache::eraseUnrefreshed() const LLAvatarName& av_name = it->second; if (av_name.mExpires < max_unrefreshed) { - const LLUUID& agent_id = it->first; - LL_DEBUGS("AvNameCache") << agent_id - << " user '" << av_name.mUsername << "' " + LL_DEBUGS("AvNameCache") << it->first + << " user '" << av_name.getAccountName() << "' " << "expired " << now - av_name.mExpires << " secs ago" << LL_ENDL; sCache.erase(it++); @@ -593,29 +583,6 @@ void LLAvatarNameCache::eraseUnrefreshed() } } -void LLAvatarNameCache::buildLegacyName(const std::string& full_name, - LLAvatarName* av_name) -{ - llassert(av_name); - av_name->mUsername = ""; - av_name->mDisplayName = full_name; - av_name->mIsDisplayNameDefault = true; - av_name->mIsTemporaryName = true; - av_name->mExpires = LLFrameTimer::getTotalSeconds() + TEMP_CACHE_ENTRY_LIFETIME; - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::buildLegacyName " - << full_name - << LL_ENDL; - - // [Ansariel/Henri] - // Why ain't those set? In case of disabled display names - // we would have to parse LLAvatarName::mDisplayName to get - // first and lastname if we need them. So do it already here - // for convenience. - std::istringstream fname(full_name); - fname >> av_name->mLegacyFirstName >> av_name->mLegacyLastName; - // [/Ansariel/Henri] -} - // fills in av_name if it has it in the cache, even if expired (can check expiry time) // returns bool specifying if av_name was filled, false otherwise bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) @@ -623,36 +590,32 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) if (sRunning) { // ...only do immediate lookups when cache is running - if (useDisplayNames()) + std::map::iterator it = sCache.find(agent_id); + if (it != sCache.end()) { - // ...use display names cache - std::map::iterator it = sCache.find(agent_id); - if (it != sCache.end()) - { - *av_name = it->second; + *av_name = it->second; - // re-request name if entry is expired - if (av_name->mExpires < LLFrameTimer::getTotalSeconds()) + // re-request name if entry is expired + if (av_name->mExpires < LLFrameTimer::getTotalSeconds()) + { + if (!isRequestPending(agent_id)) { - if (!isRequestPending(agent_id)) - { - LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " - << "refresh agent " << agent_id - << LL_ENDL; - sAskQueue.insert(agent_id); - } + LL_DEBUGS("AvNameCache") << "LLAvatarNameCache::get " + << "refresh agent " << agent_id + << LL_ENDL; + sAskQueue.insert(agent_id); } - - return true; } + + return true; } - else + else if (!usePeopleAPI()) { - // ...use legacy names cache std::string full_name; if (gCacheName->getFullName(agent_id, full_name)) { - buildLegacyName(full_name, av_name); + av_name->fromString(full_name); + sCache[agent_id] = *av_name; return true; } } @@ -669,35 +632,22 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name) return false; } -const S32& LLAvatarNameCache::phoenix_name_system() +const S32& main_name_system() { static const LLCachedControl name_system("PhoenixNameSystem", 0); return name_system; } -// Return true when name has been set to Phoenix Name System Name, if not return false. -bool LLAvatarNameCache::getPNSName(const LLUUID& agent_id, std::string& name, const S32& name_system) +// Return true when name has been set to Name System Name, if not return false. +bool LLAvatarNameCache::getNSName(const LLUUID& agent_id, std::string& name, const S32& name_system) { LLAvatarName avatar_name; if (get(agent_id, &avatar_name)) - getPNSName(avatar_name, name, name_system); + name = avatar_name.getNSName(name_system); else return false; return true; } -// get() with callback compatible version of getPNSName -void LLAvatarNameCache::getPNSName(const LLAvatarName& avatar_name, std::string& name, const S32& name_system) -{ - switch (name_system) - { - case 0 : name = avatar_name.getLegacyName(); break; - case 1 : name = avatar_name.getCompleteName(); break; - case 2 : name = avatar_name.mDisplayName; break; - case 3 : name = avatar_name.getLegacyName() + (avatar_name.mIsDisplayNameDefault ? "" : " (" + avatar_name.mDisplayName + ")"); break; - default : name = avatar_name.getLegacyName(); break; - } -} - void LLAvatarNameCache::fireSignal(const LLUUID& agent_id, const callback_slot_t& slot, const LLAvatarName& av_name) @@ -714,30 +664,14 @@ LLAvatarNameCache::callback_connection_t LLAvatarNameCache::get(const LLUUID& ag if (sRunning) { // ...only do immediate lookups when cache is running - if (useDisplayNames()) + std::map::iterator it = sCache.find(agent_id); + if (it != sCache.end()) { - // ...use new cache - std::map::iterator it = sCache.find(agent_id); - if (it != sCache.end()) + const LLAvatarName& av_name = it->second; + + if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) { - const LLAvatarName& av_name = it->second; - - if (av_name.mExpires > LLFrameTimer::getTotalSeconds()) - { - // ...name already exists in cache, fire callback now - fireSignal(agent_id, slot, av_name); - return connection; - } - } - } - else - { - // ...use old name system - std::string full_name; - if (gCacheName->getFullName(agent_id, full_name)) - { - LLAvatarName av_name; - buildLegacyName(full_name, &av_name); + // ...name already exists in cache, fire callback now fireSignal(agent_id, slot, av_name); return connection; } @@ -778,7 +712,7 @@ bool LLAvatarNameCache::getForceDisplayNames() void LLAvatarNameCache::setForceDisplayNames(bool force) { sForceDisplayNames = force; - if ( (!sUseDisplayNames) && (force) ) + if ( (!LLAvatarName::useDisplayNames()) && (force) ) { setUseDisplayNames(true); } @@ -791,21 +725,20 @@ void LLAvatarNameCache::setUseDisplayNames(bool use) // We need to force the use of the "display names" cache when @shownames=n restricted (and disallow toggling it) use |= getForceDisplayNames(); // [/RLVa:KB] - if (use != sUseDisplayNames) + if (use != LLAvatarName::useDisplayNames()) { - sUseDisplayNames = use; - LL_DEBUGS("AvNameCache") << "Display names are now: " << (use ? "on" : "off") << LL_ENDL; - // flush our cache - sCache.clear(); - + LLAvatarName::setUseDisplayNames(use); mUseDisplayNamesSignal(); } } -bool LLAvatarNameCache::useDisplayNames() +void LLAvatarNameCache::setUseUsernames(bool use) { - // Must be both manually set on and able to look up names. - return sUseDisplayNames && !sNameLookupURL.empty(); + if (use != LLAvatarName::useUsernames()) + { + LLAvatarName::setUseUsernames(use); + mUseDisplayNamesSignal(); + } } void LLAvatarNameCache::erase(const LLUUID& agent_id) @@ -839,6 +772,7 @@ bool LLAvatarNameCache::expirationFromCacheControl(AIHTTPReceivedHeaders const& { bool fromCacheControl = false; F64 now = LLFrameTimer::getTotalSeconds(); + // Allow the header to override the default std::string cache_control; if (headers.getFirstValue("cache-control", cache_control)) diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h index f98988769..e80b3d010 100644 --- a/indra/llmessage/llavatarnamecache.h +++ b/indra/llmessage/llavatarnamecache.h @@ -32,46 +32,41 @@ #include -class LLUUID; class AIHTTPReceivedHeaders; +class LLUUID; namespace LLAvatarNameCache { - typedef boost::signals2::signal use_display_name_signal_t; // Until the cache is set running, immediate lookups will fail and // async lookups will be queued. This allows us to block requests // until we know if the first region supports display names. - void initClass(bool running); + void initClass(bool running, bool usePeopleAPI); void cleanupClass(); + // Import/export the name cache to file. void importFile(std::istream& istr); void exportFile(std::ostream& ostr); - // On the viewer, usually a simulator capabilitity - // If empty, name cache will fall back to using legacy name - // lookup system + // On the viewer, usually a simulator capabilitity. + // If empty, name cache will fall back to using legacy name lookup system. void setNameLookupURL(const std::string& name_lookup_url); - // Do we have a valid lookup URL, hence are we trying to use the - // new display name lookup system? + // Do we have a valid lookup URL, i.e. are we trying to use the + // more recent display name lookup system? bool hasNameLookupURL(); + bool usePeopleAPI(); // Periodically makes a batch request for display names not already in - // cache. Call once per frame. + // cache. Called once per frame. void idle(); // If name is in cache, returns true and fills in provided LLAvatarName - // otherwise returns false + // otherwise returns false. bool get(const LLUUID& agent_id, LLAvatarName *av_name); - const S32& phoenix_name_system(); - // If get() succeeds, returns true and fills in name string - // via void function below, otherwise returns false - bool getPNSName(const LLUUID& agent_id, std::string& name, const S32& name_system = phoenix_name_system()); - // Perform a filling of name string according to Phoenix Name System, - // when we have an LLAvatarName already. - void getPNSName(const LLAvatarName& avatar_name, std::string& name, const S32& name_system = phoenix_name_system()); + // If get() succeeds, returns true and fills in name string via void function below, otherwise returns false + bool getNSName(const LLUUID& agent_id, std::string& name, const S32& name_system = main_name_system()); // Callback types for get() below typedef boost::signals2::signal< @@ -80,29 +75,29 @@ namespace LLAvatarNameCache typedef callback_signal_t::slot_type callback_slot_t; typedef boost::signals2::connection callback_connection_t; - // Fetches name information and calls callback. - // If name information is in cache, callback will be called immediately. + // Fetches name information and calls callbacks. + // If name information is in cache, callbacks will be called immediately. callback_connection_t get(const LLUUID& agent_id, callback_slot_t slot); - // Allow display names to be explicitly disabled for testing. + // Set display name: flips the switch and triggers the callbacks. void setUseDisplayNames(bool use); - bool useDisplayNames(); // [RLVa:KB] - Checked: 2010-12-08 (RLVa-1.4.0a) | Added: RLVa-1.2.2c bool getForceDisplayNames(); void setForceDisplayNames(bool force); // [/RLVa:KB] - void erase(const LLUUID& agent_id); - - /// Provide some fallback for agents that return errors - void handleAgentError(const LLUUID& agent_id); + void setUseUsernames(bool use); void insert(const LLUUID& agent_id, const LLAvatarName& av_name); + void erase(const LLUUID& agent_id); + + /// Provide some fallback for agents that return errors. + void handleAgentError(const LLUUID& agent_id); // Compute name expiration time from HTTP Cache-Control header, // or return default value, in seconds from epoch. - F64 nameExpirationFromHeaders(AIHTTPReceivedHeaders const& headers); + F64 nameExpirationFromHeaders(const AIHTTPReceivedHeaders& headers); void addUseDisplayNamesCallback(const use_display_name_signal_t::slot_type& cb); } diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index e14993dcf..180db3a4b 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -279,7 +279,9 @@ LLCacheName::Impl::Impl(LLMessageSystem* msg) LLCacheName::Impl::~Impl() { for_each(mCache.begin(), mCache.end(), DeletePairedPointer()); + mCache.clear(); for_each(mReplyQueue.begin(), mReplyQueue.end(), DeletePointer()); + mReplyQueue.clear(); } boost::signals2::connection LLCacheName::Impl::addPending(const LLUUID& id, const LLCacheNameCallback& callback) @@ -309,8 +311,10 @@ boost::signals2::connection LLCacheName::addObserver(const LLCacheNameCallback& bool LLCacheName::importFile(std::istream& istr) { LLSD data; - if(LLSDSerialize::fromXMLDocument(data, istr) < 1) + if(LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr)) + { return false; + } // We'll expire entries more than a week old U32 now = (U32)time(NULL); @@ -527,6 +531,7 @@ std::string LLCacheName::cleanFullName(const std::string& full_name) } //static +// Transform hard-coded name provided by server to a more legible username std::string LLCacheName::buildUsername(const std::string& full_name) { // rare, but handle hard-coded error names returned from server @@ -553,8 +558,9 @@ std::string LLCacheName::buildUsername(const std::string& full_name) return username; } - // if the input wasn't a correctly formatted legacy name just return it unchanged - return full_name; + // if the input wasn't a correctly formatted legacy name, just return it + // cleaned up from a potential terminal "Resident" + return cleanFullName(full_name); } //static @@ -562,13 +568,13 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) { //boost::regexp was showing up in the crashreporter, so doing //painfully manual parsing using substr. LF - S32 open_paren = complete_name.rfind(" ("); - S32 close_paren = complete_name.rfind(')'); + size_t open_paren = complete_name.rfind(" ("); + size_t close_paren = complete_name.rfind(')'); if (open_paren != std::string::npos && close_paren == complete_name.length()-1) { - S32 length = close_paren - open_paren - 2; + size_t length = llmax(close_paren - open_paren - 2, (size_t)0); std::string legacy_name = complete_name.substr(open_paren+2, length); if (legacy_name.length() > 0) @@ -577,7 +583,7 @@ std::string LLCacheName::buildLegacyName(const std::string& complete_name) LLStringUtil::toUpper(cap_letter); legacy_name = cap_letter + legacy_name.substr(1); - S32 separator = legacy_name.find('.'); + size_t separator = legacy_name.find('.'); if (separator != std::string::npos) { @@ -668,32 +674,18 @@ boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, ol // bool LLCacheName::getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group) { - if(id.isNull()) + if (id.notNull()) + if (LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id)) { - fullname = ""; - return false; - } - - LLCacheNameEntry* entry = get_ptr_in_map(impl.mCache, id ); - if (entry) - { - if (entry->mIsGroup) - { - fullname = entry->mGroupName; - } - else - { - fullname = entry->mFirstName + " " + entry->mLastName; - } - is_group = entry->mIsGroup; + fullname = (is_group = entry->mIsGroup) ? entry->mGroupName : entry->mFirstName + " " + entry->mLastName; return true; } + fullname = ""; return false; } // - void LLCacheName::processPending() { const F32 SECS_BETWEEN_PROCESS = 0.1f; @@ -705,7 +697,7 @@ void LLCacheName::processPending() if(!impl.mUpstreamHost.isOk()) { lldebugs << "LLCacheName::processPending() - bad upstream host." - << llendl; + << LL_ENDL; return; } @@ -756,7 +748,7 @@ void LLCacheName::dump() << iter->first << " = (group) " << entry->mGroupName << " @ " << entry->mCreateTime - << llendl; + << LL_ENDL; } else { @@ -764,7 +756,7 @@ void LLCacheName::dump() << iter->first << " = " << buildFullName(entry->mFirstName, entry->mLastName) << " @ " << entry->mCreateTime - << llendl; + << LL_ENDL; } } } @@ -778,7 +770,7 @@ void LLCacheName::dumpStats() << " Pending=" << impl.mPendingQueue.size() << " Reply=" << impl.mReplyQueue.size() // << " Observers=" << impl.mSignal.size() - << llendl; + << LL_ENDL; } void LLCacheName::clear() @@ -935,7 +927,7 @@ void LLCacheName::Impl::processUUIDRequest(LLMessageSystem* msg, bool isGroup) << (isGroup ? "group" : "user") << " name, " << "but found " << (entry->mIsGroup ? "group" : "user") - << ": " << id << llendl; + << ": " << id << LL_ENDL; } else { diff --git a/indra/llmessage/llcachename.h b/indra/llmessage/llcachename.h index 4c96ba0d3..9acd76221 100644 --- a/indra/llmessage/llcachename.h +++ b/indra/llmessage/llcachename.h @@ -40,7 +40,7 @@ typedef boost::signals2::signal LLCacheNameSignal; typedef LLCacheNameSignal::slot_type LLCacheNameCallback; -// Old callback with user data for compatability +// Old callback with user data for compatibility typedef void (*old_callback_t)(const LLUUID&, const std::string&, bool, void*); // Here's the theory: @@ -107,7 +107,7 @@ public: // otherwise, will request the data, and will call the callback when // available. There is no garuntee the callback will ever be called. boost::signals2::connection get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback); - + // bool getIfThere(const LLUUID& id, std::string& fullname, BOOL& is_group); // diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index bc208281d..6db165125 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -722,6 +722,11 @@ void LLHTTPClient::put(std::string const& url, LLSD const& body, ResponderPtr re request(url, HTTP_PUT, new LLSDInjector(body), responder, headers, NULL/*,*/ DEBUG_CURLIO_PARAM(debug), no_keep_alive, no_does_authentication, no_allow_compressed_reply); } +void LLHTTPClient::putRaw(const std::string& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug)) +{ + request(url, HTTP_PUT, new RawInjector(data, size), responder, headers, NULL/*,*/ DEBUG_CURLIO_PARAM(debug), no_keep_alive, no_does_authentication, no_allow_compressed_reply); +} + void LLHTTPClient::post(std::string const& url, LLSD const& body, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug), EKeepAlive keepalive, AIStateMachine* parent, AIStateMachine::state_type new_parent_state) { request(url, HTTP_POST, new LLSDInjector(body), responder, headers, NULL/*,*/ DEBUG_CURLIO_PARAM(debug), keepalive, no_does_authentication, allow_compressed_reply, parent, new_parent_state); diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index b0fdd53f3..bd24111f0 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -491,6 +491,10 @@ public: static void put(std::string const& url, LLSD const& body, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) { AIHTTPHeaders headers; put(url, body, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } + static void putRaw(const std::string& url, const char* data, S32 size, ResponderPtr responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); + static void putRaw(const std::string& url, const char* data, S32 size, ResponderPtr responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) + { AIHTTPHeaders headers; putRaw(url, data, size, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } + static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder, AIHTTPHeaders& headers/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)); static void getHeaderOnly(std::string const& url, ResponderHeadersOnly* responder/*,*/ DEBUG_CURLIO_PARAM(EDebugCurl debug = debug_off)) { AIHTTPHeaders headers; getHeaderOnly(url, responder, headers/*,*/ DEBUG_CURLIO_PARAM(debug)); } diff --git a/indra/llplugin/slplugin/slplugin.cpp b/indra/llplugin/slplugin/slplugin.cpp index 1c11b30e1..49c3c2ed9 100644 --- a/indra/llplugin/slplugin/slplugin.cpp +++ b/indra/llplugin/slplugin/slplugin.cpp @@ -91,45 +91,35 @@ LONG WINAPI myWin32ExceptionHandler( struct _EXCEPTION_POINTERS* exception_infop return EXCEPTION_EXECUTE_HANDLER; } -// Taken from : http://blog.kalmbachnet.de/?postid=75 -// The MSVC 2005 CRT forces the call of the default-debugger (normally Dr.Watson) +// Taken from : http://blog.kalmbach-software.de/2013/05/23/improvedpreventsetunhandledexceptionfilter/ +// The MSVC 2005 and above CRT forces the call of the default-debugger (normally Dr.Watson) // even with the other exception handling code. This (terrifying) piece of code // patches things so that doesn't happen. -LPTOP_LEVEL_EXCEPTION_FILTER WINAPI MyDummySetUnhandledExceptionFilter( - LPTOP_LEVEL_EXCEPTION_FILTER lpTopLevelExceptionFilter ) +static BOOL PreventSetUnhandledExceptionFilter() { - return NULL; -} + HMODULE hKernel32 = LoadLibrary(TEXT("kernel32.dll")); + if (hKernel32 == NULL) return FALSE; + void *pOrgEntry = GetProcAddress(hKernel32, "SetUnhandledExceptionFilter"); + if (pOrgEntry == NULL) return FALSE; -BOOL PreventSetUnhandledExceptionFilter() -{ -// WARNING: This won't work on 64-bit Windows systems so we turn it off it. -// It should work for any flavor of 32-bit Windows we care about. -// If it's off, sometimes you will see an OS message when a plugin crashes -#ifndef _WIN64 - HMODULE hKernel32 = LoadLibraryA( "kernel32.dll" ); - if ( NULL == hKernel32 ) - return FALSE; - - void *pOrgEntry = GetProcAddress( hKernel32, "SetUnhandledExceptionFilter" ); - if( NULL == pOrgEntry ) - return FALSE; - - unsigned char newJump[ 100 ]; - DWORD dwOrgEntryAddr = (DWORD)pOrgEntry; - dwOrgEntryAddr += 5; // add 5 for 5 op-codes for jmp far - void *pNewFunc = &MyDummySetUnhandledExceptionFilter; - DWORD dwNewEntryAddr = (DWORD) pNewFunc; - DWORD dwRelativeAddr = dwNewEntryAddr - dwOrgEntryAddr; - - newJump[ 0 ] = 0xE9; // JMP absolute - memcpy( &newJump[ 1 ], &dwRelativeAddr, sizeof( pNewFunc ) ); - SIZE_T bytesWritten; - BOOL bRet = WriteProcessMemory( GetCurrentProcess(), pOrgEntry, newJump, sizeof( pNewFunc ) + 1, &bytesWritten ); - return bRet; +#ifdef _M_IX86 + // Code for x86: + // 33 C0 xor eax,eax + // C2 04 00 ret 4 + unsigned char szExecute[] = { 0x33, 0xC0, 0xC2, 0x04, 0x00 }; +#elif _M_X64 + // 33 C0 xor eax,eax + // C3 ret + unsigned char szExecute[] = { 0x33, 0xC0, 0xC3 }; #else - return FALSE; +#error "The following code only works for x86 and x64!" #endif + + DWORD oldProtect; + BOOL bRet = VirtualProtect(pOrgEntry, sizeof(szExecute), PAGE_EXECUTE_READWRITE, &oldProtect); + memcpy(pOrgEntry, szExecute, sizeof(szExecute)); + VirtualProtect(pOrgEntry, sizeof(szExecute), oldProtect, &oldProtect); + return bRet; } //////////////////////////////////////////////////////////////////////////////// diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp index 1471ccfb3..73a5e76af 100644 --- a/indra/llrender/llgl.cpp +++ b/indra/llrender/llgl.cpp @@ -2320,7 +2320,7 @@ void LLGLNamePool::release(GLuint name) //static void LLGLNamePool::upkeepPools() { - for (tracker_t::instance_iter iter = beginInstances(); iter != endInstances(); ++iter) + for (tracker_t::instance_iter iter = beginInstances(), iter_end = endInstances(); iter != iter_end; ++iter) { LLGLNamePool & pool = *iter; pool.upkeep(); @@ -2330,7 +2330,7 @@ void LLGLNamePool::upkeepPools() //static void LLGLNamePool::cleanupPools() { - for (tracker_t::instance_iter iter = beginInstances(); iter != endInstances(); ++iter) + for (tracker_t::instance_iter iter = beginInstances(), iter_end = endInstances(); iter != iter_end; ++iter) { LLGLNamePool & pool = *iter; pool.cleanup(); diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 08ddc3c96..61eb8cae8 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -160,6 +160,9 @@ LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory * LLComboBox* combo_box = new LLComboBox("combo_box", rect, label); combo_box->setAllowTextEntry(allow_text_entry, max_chars); + if (LLFontGL* font = selectFont(node)) + combo_box->mButton->setFont(font); + const std::string& contents = node->getValue(); if (contents.find_first_not_of(" \n\t") != contents.npos) diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index c8be07f43..e3da1a9d6 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -1498,23 +1498,8 @@ void LLFloater::draw() } else { - // draw children - LLView* focused_child = dynamic_cast(gFocusMgr.getKeyboardFocus()); - BOOL focused_child_visible = FALSE; - if (focused_child && focused_child->getParent() == this) - { - focused_child_visible = focused_child->getVisible(); - focused_child->setVisible(FALSE); - } - // don't call LLPanel::draw() since we've implemented custom background rendering LLView::draw(); - - if (focused_child_visible) - { - focused_child->setVisible(TRUE); - } - drawChild(focused_child); } if( isBackgroundVisible() ) diff --git a/indra/llui/llflyoutbutton.cpp b/indra/llui/llflyoutbutton.cpp index b45cdda3b..1290f6b62 100644 --- a/indra/llui/llflyoutbutton.cpp +++ b/indra/llui/llflyoutbutton.cpp @@ -107,6 +107,9 @@ LLView* LLFlyoutButton::fromXML(LLXMLNodePtr node, LLView* parent, LLUICtrlFacto flyout_button->mListPosition = ABOVE; } + if (LLFontGL* font = selectFont(node)) + flyout_button->mActionButton->setFont(font); + flyout_button->initFromXML(node, parent); for (LLXMLNodePtr child = node->getFirstChild(); child.notNull(); child = child->getNextSibling()) diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp index 83e532a65..db3921460 100644 --- a/indra/llui/lllayoutstack.cpp +++ b/indra/llui/lllayoutstack.cpp @@ -534,7 +534,7 @@ void LLLayoutStack::createResizeBar(LLLayoutPanel* panelp) //static void LLLayoutStack::updateClass() { - for (instance_iter it = beginInstances(); it != endInstances(); ++it) + for (instance_iter it = beginInstances(), it_end(endInstances()); it != it_end; ++it) { it->updateLayout(); it->mAnimatedThisFrame = false; diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp index d4c83d674..9e83b9bd6 100644 --- a/indra/llui/llurlentry.cpp +++ b/indra/llui/llurlentry.cpp @@ -340,7 +340,8 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about // -LLUrlEntryAgent::LLUrlEntryAgent() +LLUrlEntryAgent::LLUrlEntryAgent() : + mAvatarNameCacheConnection() { mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+", boost::regex::perl|boost::regex::icase); @@ -371,6 +372,8 @@ void LLUrlEntryAgent::callObservers(const std::string &id, void LLUrlEntryAgent::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + std::string label = av_name.getCompleteName(); // received the agent name from the server - tell our observers @@ -456,9 +459,11 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa } else { - LLAvatarNameCache::get(agent_id, - boost::bind(&LLUrlEntryAgent::onAvatarNameCache, - this, _1, _2)); + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } @@ -499,6 +504,10 @@ std::string localize_slapp_label(const std::string& url, const std::string& full { return LLTrans::getString("SLappAgentRequestFriend") + " " + full_name; } + if (LLStringUtil::endsWith(url, "/removefriend")) + { + return LLTrans::getString("SLappAgentRemoveFriend") + " " + full_name; + } return full_name; } @@ -515,12 +524,15 @@ std::string LLUrlEntryAgent::getIcon(const std::string &url) // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username) // x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/(completename|displayname|username) // -LLUrlEntryAgentName::LLUrlEntryAgentName() +LLUrlEntryAgentName::LLUrlEntryAgentName() : + mAvatarNameCacheConnection() {} void LLUrlEntryAgentName::onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name) { + mAvatarNameCacheConnection.disconnect(); + std::string label = getName(av_name); // received the agent name from the server - tell our observers callObservers(id.asString(), label, mIcon); @@ -554,9 +566,11 @@ std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLab } else { - LLAvatarNameCache::get(agent_id, - boost::bind(&LLUrlEntryAgentCompleteName::onAvatarNameCache, - this, _1, _2)); + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgentName::onAvatarNameCache, this, _1, _2)); addObserver(agent_id_string, url, cb); return LLTrans::getString("LoadingData"); } @@ -597,7 +611,7 @@ LLUrlEntryAgentDisplayName::LLUrlEntryAgentDisplayName() std::string LLUrlEntryAgentDisplayName::getName(const LLAvatarName& avatar_name) { - return avatar_name.mDisplayName; + return avatar_name.getDisplayName(); } // @@ -613,7 +627,7 @@ LLUrlEntryAgentUserName::LLUrlEntryAgentUserName() std::string LLUrlEntryAgentUserName::getName(const LLAvatarName& avatar_name) { - return avatar_name.mUsername.empty() ? avatar_name.getLegacyName() : avatar_name.mUsername; + return avatar_name.getAccountName(); } // @@ -1053,7 +1067,8 @@ LLUrlEntrySLLabel::LLUrlEntrySLLabel() std::string LLUrlEntrySLLabel::getLabel(const std::string &url, const LLUrlLabelCallback &cb) { - return getLabelFromWikiLink(url); + std::string label = getLabelFromWikiLink(url); + return (!LLUrlRegistry::instance().hasUrl(label)) ? label : getUrl(url); } std::string LLUrlEntrySLLabel::getUrl(const std::string &string) const diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h index 0e2f4038f..e52fe8040 100644 --- a/indra/llui/llurlentry.h +++ b/indra/llui/llurlentry.h @@ -32,6 +32,7 @@ #include "lluicolor.h" #include "llstyle.h" +#include "llavatarname.h" #include "llhost.h" // for resolving parcel name by parcel id #include @@ -93,7 +94,7 @@ public: virtual std::string getLocation(const std::string &url) const { return ""; } /// Should this link text be underlined only when mouse is hovered over it? - virtual bool underlineOnHoverOnly(const std::string &string) const { return false; } + virtual bool underlineOnHoverOnly(const std::string &string) const { return true; } // virtual LLUUID getID(const std::string &string) const { return LLUUID::null; } @@ -171,6 +172,13 @@ class LLUrlEntryAgent : public LLUrlEntryBase { public: LLUrlEntryAgent(); + ~LLUrlEntryAgent() + { + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + } /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); /*virtual*/ std::string getIcon(const std::string &url); /*virtual*/ std::string getTooltip(const std::string &string) const; @@ -181,6 +189,7 @@ protected: /*virtual*/ void callObservers(const std::string &id, const std::string &label, const std::string& icon); private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); + boost::signals2::connection mAvatarNameCacheConnection; }; /// @@ -192,6 +201,13 @@ class LLUrlEntryAgentName : public LLUrlEntryBase, public boost::signals2::track { public: LLUrlEntryAgentName(); + ~LLUrlEntryAgentName() + { + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + } /*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb); //*virtual*/ LLStyle::Params getStyle() const; protected: @@ -199,6 +215,7 @@ protected: virtual std::string getName(const LLAvatarName& avatar_name) = 0; private: void onAvatarNameCache(const LLUUID& id, const LLAvatarName& av_name); + boost::signals2::connection mAvatarNameCacheConnection; }; diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 633294259..81e21494c 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9900,17 +9900,6 @@ This should be as low as possible, but too low may break functionality Value 0 - LegacyMultiAttachmentSupport - - Comment - Converts legacy "secondary attachment points" to multi-attachments for other avatars - Persist - 1 - Type - Boolean - Value - 1 - LimitDragDistance Comment @@ -16785,6 +16774,17 @@ This should be as low as possible, but too low may break functionality Value 0 + UsePeopleAPI + + Comment + Use the people API cap for avatar name fetching, use old legacy protocol if false. Requires restart. + Persist + 1 + Type + Boolean + Value + 1 + UseStartScreen Comment diff --git a/indra/newview/chatbar_as_cmdline.cpp b/indra/newview/chatbar_as_cmdline.cpp index ddbfca284..3eda4098f 100644 --- a/indra/newview/chatbar_as_cmdline.cpp +++ b/indra/newview/chatbar_as_cmdline.cpp @@ -219,9 +219,7 @@ struct ProfCtrlListAccum : public LLControlGroup::ApplyFunctor #endif //PROF_CTRL_CALLS void spew_key_to_name(const LLUUID& targetKey, const LLAvatarName& av_name) { - std::string object_name; - LLAvatarNameCache::getPNSName(av_name, object_name); - cmdline_printchat(llformat("%s: %s", targetKey.asString().c_str(), object_name.c_str())); + cmdline_printchat(llformat("%s: %s", targetKey.asString().c_str(), av_name.getNSName().c_str())); } bool cmd_line_chat(std::string revised_text, EChatType type) { @@ -525,37 +523,24 @@ LLUUID cmdline_partial_name2key(std::string partial_name) std::string av_name; LLStringUtil::toLower(partial_name); LLWorld::getInstance()->getAvatars(&avatars); - typedef std::vector::const_iterator av_iter; bool has_avatarlist = LLFloaterAvatarList::instanceExists(); - if(has_avatarlist) + if (has_avatarlist) LLFloaterAvatarList::getInstance()->updateAvatarList(); - for(av_iter i = avatars.begin(); i != avatars.end(); ++i) + for(std::vector::const_iterator i = avatars.begin(); i != avatars.end(); ++i) { - if(has_avatarlist) - { - LLAvatarListEntry* entry = LLFloaterAvatarList::getInstance()->getAvatarEntry(*i); - if(entry) - { - av_name = entry->getName(); - } - } - if (av_name.empty() && !gCacheName->getFullName(*i, av_name)) - { - LLVOAvatar *avatarp = gObjectList.findAvatar(*i); - if(avatarp) - { - av_name = avatarp->getFullname(); - } - } + if (LLAvatarListEntry* entry = has_avatarlist ? LLFloaterAvatarList::instance().getAvatarEntry(*i) : NULL) + av_name = entry->getName(); + else if (gCacheName->getFullName(*i, av_name)); + else if (LLVOAvatar* avatarp = gObjectList.findAvatar(*i)) + av_name = avatarp->getFullname(); + else + continue; LLStringUtil::toLower(av_name); - if(strstr(av_name.c_str(), partial_name.c_str())) - { + if (av_name.find(partial_name) != std::string::npos) return *i; - } } return LLUUID::null; } - void cmdline_tp2name(std::string target) diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi index 33549a02b..5ec4a4274 100644 --- a/indra/newview/installers/windows/installer_template.nsi +++ b/indra/newview/installers/windows/installer_template.nsi @@ -562,6 +562,7 @@ RMDir "$SMPROGRAMS\$INSTSHORTCUT" Delete "$DESKTOP\$INSTSHORTCUT.lnk" Delete "$INSTDIR\$INSTSHORTCUT.lnk" +Delete "$INSTDIR\$INSTSHORTCUT Portable.lnk" Delete "$INSTDIR\Uninstall $INSTSHORTCUT.lnk" ; Clean up cache and log files. diff --git a/indra/newview/lffloaterinvpanel.cpp b/indra/newview/lffloaterinvpanel.cpp index 31d144673..5fde1fa10 100644 --- a/indra/newview/lffloaterinvpanel.cpp +++ b/indra/newview/lffloaterinvpanel.cpp @@ -59,7 +59,7 @@ void LFFloaterInvPanel::closeAll() { // We must make a copy first, because LLInstanceTracker doesn't allow destruction while having iterators to it. std::vector cache; - for (instance_iter i = beginInstances(); i != endInstances(); ++i) + for (instance_iter i = beginInstances(), end(endInstances()); i != end; ++i) { cache.push_back(&*i); } diff --git a/indra/newview/lfsimfeaturehandler.cpp b/indra/newview/lfsimfeaturehandler.cpp index 83b17125d..a92a1645f 100644 --- a/indra/newview/lfsimfeaturehandler.cpp +++ b/indra/newview/lfsimfeaturehandler.cpp @@ -21,6 +21,7 @@ #include "llagent.h" #include "llviewerregion.h" +#include "llmutelist.h" #include "hippogridmanager.h" LFSimFeatureHandler::LFSimFeatureHandler() @@ -33,6 +34,7 @@ LFSimFeatureHandler::LFSimFeatureHandler() { if (!gHippoGridManager->getCurrentGrid()->isSecondLife()) // Remove this line if we ever handle SecondLife sim features gAgent.addRegionChangedCallback(boost::bind(&LFSimFeatureHandler::handleRegionChange, this)); + LLMuteList::instance().mGodLastNames.insert("Linden"); } ExportPolicy LFSimFeatureHandler::exportPolicy() const @@ -108,5 +110,33 @@ void LFSimFeatureHandler::setSupportedFeatures() mShoutRange.reset(); mWhisperRange.reset(); } + + LLMuteList& mute_list(LLMuteList::instance()); + mute_list.mGodLastNames.clear(); + mute_list.mGodFullNames.clear(); + + if (info.has("god_names")) + { + const LLSD& god_names(info["god_names"]); + if (god_names.has("last_names")) + { + const LLSD& last_names(god_names["last_names"]); + + for (LLSD::array_const_iterator it = last_names.beginArray(); it != last_names.endArray(); ++it) + mute_list.mGodLastNames.insert((*it).asString()); + } + + if (god_names.has("full_names")) + { + const LLSD& full_names(god_names["full_names"]); + + for (LLSD::array_const_iterator it = full_names.beginArray(); it != full_names.endArray(); ++it) + mute_list.mGodFullNames.insert((*it).asString()); + } + } + else + { + mute_list.mGodLastNames.insert("Linden"); + } } } diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 1282ba0cc..963a546a0 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -131,10 +131,10 @@ void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids) if(ids.size() == 1) { LLUUID agent_id = ids[0]; - std::string av_name; - if(LLAvatarNameCache::getPNSName(agent_id, av_name)) + LLAvatarName av_name; + if(LLAvatarNameCache::get(agent_id, &av_name)) { - args["NAME"] = av_name; + args["NAME"] = av_name.getNSName(); } msgType = "RemoveFromFriends"; @@ -354,19 +354,11 @@ static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarNa } else { - std::string username = av_name.mUsername; - if (username.empty()) - { - username = LLCacheName::buildUsername(av_name.mDisplayName); - } - - llinfos << "opening web profile for " << username << llendl; - std::string url = getProfileURL(username); + std::string url = getProfileURL(av_name.getAccountName()); // PROFILES: open in webkit window LLFloaterWebContent::Params p; - p.url(url). - id(agent_id.asString()); + p.url(url).id(agent_id.asString()); LLFloaterWebProfile::showInstance(get_profile_floater_name(agent_id), p); } } @@ -423,14 +415,14 @@ void LLAvatarActions::hideProfile(const LLUUID& id) // static void LLAvatarActions::showOnMap(const LLUUID& id) { - std::string av_name; - if (!LLAvatarNameCache::getPNSName(id, av_name)) + LLAvatarName av_name; + if (!LLAvatarNameCache::get(id, &av_name)) { LLAvatarNameCache::get(id, boost::bind(&LLAvatarActions::showOnMap, id)); return; } - gFloaterWorldMap->trackAvatar(id, av_name); + gFloaterWorldMap->trackAvatar(id, av_name.getNSName()); LLFloaterWorldMap::show(true); } @@ -519,7 +511,7 @@ void LLAvatarActions::on_avatar_name_cache_teleport_request(const LLUUID& id, co name = RlvStrings::getAnonym(av_name.getLegacyName()); else // [RLVa:KB] - LLAvatarNameCache::getPNSName(av_name, name); + name = av_name.getNSName(); notification["NAME"] = name; LLSD payload; @@ -841,7 +833,7 @@ void LLAvatarActions::buildResidentsString(std::vector avatar_name const std::string& separator = LLTrans::getString("words_separator"); for (std::vector::const_iterator it = avatar_names.begin(); ; ) { - residents_string.append((*it).getCompleteName()); + residents_string.append((*it).getNSName()); if (++it == avatar_names.end()) { break; diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp index 91bc47e7b..2c0fc697f 100644 --- a/indra/newview/llcallingcard.cpp +++ b/indra/newview/llcallingcard.cpp @@ -38,35 +38,29 @@ #include "llcallingcard.h" -#include #include -//#include #include "indra_constants.h" -#include "llcachename.h" +//#include "llcachename.h" #include "llstl.h" #include "lltimer.h" #include "lluuid.h" #include "message.h" #include "llagent.h" -#include "llbutton.h" -//#include "llinventory.h" -#include "llinventorymodel.h" +#include "llavatarnamecache.h" #include "llinventoryobserver.h" +#include "llinventorymodel.h" #include "llnotifications.h" -#include "llnotificationsutil.h" #include "llresmgr.h" #include "llimview.h" +#include "lltrans.h" #include "llviewercontrol.h" -#include "llviewernetwork.h" #include "llviewerobjectlist.h" -#include "llviewerwindow.h" #include "llvoavatar.h" +#include "llavataractions.h" #include "llimview.h" #include "llimpanel.h" -#include "llavatarname.h" -#include "llavatarnamecache.h" ///---------------------------------------------------------------------------- /// Local function declarations, constants, enums, and typedefs @@ -111,8 +105,6 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, LLAvatarTracker::LLAvatarTracker() : mTrackingData(NULL), mTrackedAgentValid(false), - //mInventory(NULL), - //mInventoryObserver(NULL), mModifyMask(0x0) { } @@ -121,7 +113,9 @@ LLAvatarTracker::~LLAvatarTracker() { deleteTrackingData(); std::for_each(mObservers.begin(), mObservers.end(), DeletePointer()); + mObservers.clear(); std::for_each(mBuddyInfo.begin(), mBuddyInfo.end(), DeletePairedPointer()); + mBuddyInfo.clear(); } void LLAvatarTracker::track(const LLUUID& avatar_id, const std::string& name) @@ -184,13 +178,13 @@ LLVector3d LLAvatarTracker::getGlobalPos() if(!mTrackedAgentValid || !mTrackingData) return LLVector3d(); LLVector3d global_pos; - LLVOAvatar* avatarp = gObjectList.findAvatar(mTrackingData->mAvatarID); - if(avatarp && !avatarp->isDead()) + LLVOAvatar* av = gObjectList.findAvatar(mTrackingData->mAvatarID); + if(av && !av->isDead()) { - global_pos = avatarp->getPositionGlobal(); + global_pos = av->getPositionGlobal(); // HACK - for making the tracker point above the avatar's head // rather than its groin - global_pos.mdV[VZ] += 0.7f * (avatarp->mBodySize.mV[VZ] + avatarp->mAvatarOffset.mV[VZ]); + global_pos.mdV[VZ] += 0.7f * (av->mBodySize.mV[VZ] + av->mAvatarOffset.mV[VZ]); mTrackingData->mGlobalPositionEstimate = global_pos; } @@ -210,10 +204,10 @@ void LLAvatarTracker::getDegreesAndDist(F32& rot, LLVector3d global_pos; - LLVOAvatar* avatarp = gObjectList.findAvatar(mTrackingData->mAvatarID); - if(avatarp && !avatarp->isDead()) + LLViewerObject* object = gObjectList.findObject(mTrackingData->mAvatarID); + if(object && !object->isDead()) { - global_pos = avatarp->getPositionGlobal(); + global_pos = object->getPositionGlobal(); mTrackingData->mGlobalPositionEstimate = global_pos; } else @@ -272,7 +266,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) << ", " << (mBuddyInfo[agent_id]->isOnline() ? "Online" : "Offline") << ", TO: " << mBuddyInfo[agent_id]->getRightsGrantedTo() << ", FROM: " << mBuddyInfo[agent_id]->getRightsGrantedFrom() - << llendl; + << LL_ENDL; } else { @@ -282,7 +276,7 @@ S32 LLAvatarTracker::addBuddyList(const LLAvatarTracker::buddy_map_t& buds) << " [" << (e_r->isOnline() ? "Online" : "Offline") << "->" << (n_r->isOnline() ? "Online" : "Offline") << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo() << ", " << e_r->getRightsGrantedTo() << "->" << n_r->getRightsGrantedTo() - << "]" << llendl; + << "]" << LL_ENDL; } } notifyObservers(); @@ -315,6 +309,7 @@ void LLAvatarTracker::terminateBuddy(const LLUUID& id) msg->nextBlock("ExBlock"); msg->addUUID("OtherID", id); gAgent.sendReliableMessage(); + addChangedMask(LLFriendObserver::REMOVE, id); delete buddy; } @@ -345,7 +340,7 @@ void LLAvatarTracker::setBuddyOnline(const LLUUID& id, bool is_online) else { llwarns << "!! No buddy info found for " << id - << ", setting to " << (is_online ? "Online" : "Offline") << llendl; + << ", setting to " << (is_online ? "Online" : "Offline") << LL_ENDL; } } @@ -462,7 +457,7 @@ void LLAvatarTracker::findAgent() msg->nextBlockFast(_PREHASH_AgentBlock); msg->addUUIDFast(_PREHASH_Hunter, gAgentID); msg->addUUIDFast(_PREHASH_Prey, mTrackingData->mAvatarID); - msg->addU32Fast(_PREHASH_SpaceIP, 0); // will get filled in by simulator + msg->addIPAddrFast(_PREHASH_SpaceIP, 0); // will get filled in by simulator // msg->nextBlockFast(_PREHASH_LocationBlock); const F64 NO_LOCATION = 0.0; msg->addF64Fast(_PREHASH_GlobalX, NO_LOCATION); @@ -640,20 +635,40 @@ void LLAvatarTracker::processChange(LLMessageSystem* msg) { std::string fullname; LLSD args; - if (LLAvatarNameCache::getPNSName(agent_id, fullname)) + if (LLAvatarNameCache::getNSName(agent_id, fullname)) args["NAME"] = fullname; LLSD payload; payload["from_id"] = agent_id; if(LLRelationship::GRANT_MODIFY_OBJECTS & new_rights) { - LLNotificationsUtil::add("GrantedModifyRights",args, payload); + LLNotifications::instance().add("GrantedModifyRights",args, payload); } else { - LLNotificationsUtil::add("RevokedModifyRights",args, payload); + LLNotifications::instance().add("RevokedModifyRights",args, payload); } } + // + if ((mBuddyInfo[agent_id]->getRightsGrantedFrom() ^ new_rights) & LLRelationship::GRANT_MAP_LOCATION) + { + std::string fullname; + LLSD args; + if (LLAvatarNameCache::getNSName(agent_id, fullname)) + args["NAME"] = fullname; + + LLSD payload; + payload["from_id"] = agent_id; + if (LLRelationship::GRANT_MAP_LOCATION & new_rights) + { + LLNotifications::instance().add("GrantedMapRights", args, payload); + } + else + { + LLNotifications::instance().add("RevokedMapRights", args, payload); + } + } + // (mBuddyInfo[agent_id])->setRightsFrom(new_rights); } } @@ -697,7 +712,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) else { llwarns << "Received online notification for unknown buddy: " - << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << llendl; + << agent_id << " is " << (online ? "ONLINE" : "OFFLINE") << LL_ENDL; } if(tracking_id == agent_id) @@ -711,9 +726,7 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online) if(chat_notify) { // Look up the name of this agent for the notification - LLAvatarNameCache::get(agent_id, - boost::bind(&on_avatar_name_cache_notify, - _1, _2, online, payload)); + LLAvatarNameCache::get(agent_id,boost::bind(&on_avatar_name_cache_notify,_1, _2, online, payload)); } mModifyMask |= LLFriendObserver::ONLINE; @@ -729,22 +742,33 @@ static void on_avatar_name_cache_notify(const LLUUID& agent_id, { // Popup a notify box with online status of this agent // Use display name only because this user is your friend - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); LLSD args; - args["NAME"] = name; + args["NAME"] = av_name.getNSName(); + args["STATUS"] = online ? LLTrans::getString("OnlineStatus") : LLTrans::getString("OfflineStatus"); // Popup a notify box with online status of this agent - LLNotificationPtr notification = LLNotificationsUtil::add(online ? "FriendOnline" : "FriendOffline", args, payload); + LLNotificationPtr notification; + if (online) + { + notification = + LLNotifications::instance().add("FriendOnlineOffline", + args, + payload, + boost::bind(&LLAvatarActions::startIM, agent_id)); + } + else + { + notification = + LLNotifications::instance().add("FriendOnlineOffline", args, payload); + } // If there's an open IM session with this agent, send a notification there too. LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id); - LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id); - if (floater) + if (LLFloaterIMPanel* floater = gIMMgr->findFloaterBySession(session_id)) { - std::string notifyMsg = notification->getMessage(); - if (!notifyMsg.empty()) - floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor")); + std::string notify_msg = notification->getMessage(); + if (!notify_msg.empty()) + floater->addHistoryLine(notify_msg, gSavedSettings.getColor4("SystemChatColor")); } } @@ -812,7 +836,7 @@ void LLTrackingData::agentFound(const LLUUID& prey, if(prey != mAvatarID) { llwarns << "LLTrackingData::agentFound() - found " << prey - << " but looking for " << mAvatarID << llendl; + << " but looking for " << mAvatarID << LL_ENDL; } mHaveInfo = true; mAgentGone.setTimerExpirySec(OFFLINE_SECONDS); @@ -821,8 +845,8 @@ void LLTrackingData::agentFound(const LLUUID& prey, bool LLTrackingData::haveTrackingInfo() { - LLVOAvatar* avatarp = gObjectList.findAvatar(mAvatarID); - if(avatarp && !avatarp->isDead()) + LLViewerObject* object = gObjectList.findObject(mAvatarID); + if(object && !object->isDead()) { mCoarseLocationTimer.checkExpirationAndReset(COARSE_FREQUENCY); mUpdateTimer.setTimerExpirySec(FIND_FREQUENCY); @@ -876,7 +900,7 @@ bool LLCollectMappableBuddies::operator()(const LLUUID& buddy_id, LLRelationship { LLAvatarName av_name; LLAvatarNameCache::get( buddy_id, &av_name); - buddy_map_t::value_type value(av_name.mDisplayName, buddy_id); + buddy_map_t::value_type value(av_name.getDisplayName(), buddy_id); if(buddy->isOnline() && buddy->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)) { mMappable.insert(value); @@ -898,7 +922,9 @@ bool LLCollectOnlineBuddies::operator()(const LLUUID& buddy_id, LLRelationship* const S32& friend_name_system(); bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* buddy) { - LLAvatarNameCache::getPNSName(buddy_id, mFullName, friend_name_system()); + LLAvatarName av_name; + LLAvatarNameCache::get(buddy_id, &av_name); + mFullName = av_name.getNSName(friend_name_system()); buddy_map_t::value_type value(mFullName, buddy_id); if(buddy->isOnline()) { @@ -910,5 +936,3 @@ bool LLCollectAllBuddies::operator()(const LLUUID& buddy_id, LLRelationship* bud } return true; } - - diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index c016b8da6..97343d792 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -41,8 +41,20 @@ LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env std::string cmd = findCommand(env_var, override); if (cmd.empty()) { - llwarns << "Editor command is empty or not set" << llendl; - return EC_NOT_SPECIFIED; +#if LL_WINDOWS + cmd = getenv("COMSPEC") + std::string(" /C START \"%s\""); +#elif LL_DARWIN + cmd = "/usr/bin/open \"%s\""; +#elif LL_LINUX + // xdg-open might not actually be installed on all distros, but it's our best bet. + cmd = "/usr/bin/xdg-open \"%s\""; +#endif + cmd = findCommand(LLStringUtil::null, cmd); + if (cmd.empty()) + { + llwarns << "Failed to find generic open handler." << llendl; + return EC_NOT_SPECIFIED; + } } // Add the filename marker if missing. diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp index 56060da2b..b2b7e71aa 100644 --- a/indra/newview/llfloaterabout.cpp +++ b/indra/newview/llfloaterabout.cpp @@ -170,12 +170,6 @@ LLFloaterAbout::LLFloaterAbout() LLViewerRegion* region = gAgent.getRegion(); if (region) { - LLStyleSP server_link_style(new LLStyle); - server_link_style->setVisible(true); - server_link_style->setFontName(LLStringUtil::null); - server_link_style->setLinkHREF(region->getCapability("ServerReleaseNotes")); - server_link_style->setColor(gSavedSettings.getColor4("HTMLLinkColor")); - // [RLVa:KB] - Checked: 2014-02-24 (RLVa-1.4.10) if (RlvActions::canShowLocation()) { @@ -209,7 +203,14 @@ LLFloaterAbout::LLFloaterAbout() support.append("\n"); support_widget->appendColoredText(support, FALSE, FALSE, gColors.getColor("TextFgReadOnlyColor")); - support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); + + const std::string url(region->getCapability("ServerReleaseNotes")); + if (!url.empty()) + { + LLStyleSP server_link_style(new LLStyle(*viewer_link_style)); + server_link_style->setLinkHREF(url); + support_widget->appendStyledText(LLTrans::getString("ReleaseNotes"), false, false, server_link_style); + } support = "\n\n"; } diff --git a/indra/newview/llfloateravatarlist.cpp b/indra/newview/llfloateravatarlist.cpp index 6b47c2680..51f7728a7 100644 --- a/indra/newview/llfloateravatarlist.cpp +++ b/indra/newview/llfloateravatarlist.cpp @@ -546,7 +546,7 @@ void LLFloaterAvatarList::updateAvatarList() const LLUUID& avid = avatar_ids[i]; std::string name; static const LLCachedControl namesystem("RadarNameSystem"); - if (!LLAvatarNameCache::getPNSName(avid, name, namesystem)) continue; //prevent (Loading...) + if (!LLAvatarNameCache::getNSName(avid, name, namesystem)) continue; //prevent (Loading...) LLVector3d position = positions[i]; @@ -622,9 +622,8 @@ void LLFloaterAvatarList::expireAvatarList() for(av_list_t::iterator it = mAvatars.begin(); it != mAvatars.end();) { LLAvatarListEntry* entry = it->get(); - if (!entry->isDead()) + if (entry->getAlive() && !entry->isDead()) { - entry->getAlive(); ++it; } else diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp index 389acdbe0..3c9ad33a9 100644 --- a/indra/newview/llfloateravatarpicker.cpp +++ b/indra/newview/llfloateravatarpicker.cpp @@ -53,6 +53,7 @@ #include "lldraghandle.h" #include "message.h" +//#include "llsdserialize.h" //put it back as a member once the legacy path is out? static std::map sAvatarNameMap; @@ -333,9 +334,9 @@ void LLFloaterAvatarPicker::populateNearMe() else { element["columns"][0]["column"] = "name"; - element["columns"][0]["value"] = av_name.mDisplayName; + element["columns"][0]["value"] = av_name.getDisplayName(); element["columns"][1]["column"] = "username"; - element["columns"][1]["value"] = av_name.mUsername; + element["columns"][1]["value"] = av_name.getUserName(); sAvatarNameMap[av] = av_name; } @@ -514,7 +515,6 @@ protected: else { llwarns << "avatar picker failed " << dumpResponse() << LL_ENDL; - } } @@ -670,8 +670,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* // Not for us if (agent_id != gAgent.getID()) return; - if (!instanceExists()) return; - LLFloaterAvatarPicker* floater = getInstance(); + LLFloaterAvatarPicker* floater = instanceExists() ? getInstance() : NULL; // floater is closed or these are not results from our last request if (NULL == floater || query_id != floater->mQueryID) @@ -713,9 +712,7 @@ void LLFloaterAvatarPicker::processAvatarPickerReply(LLMessageSystem* msg, void* found_one = TRUE; LLAvatarName av_name; - av_name.mLegacyFirstName = first_name; - av_name.mLegacyLastName = last_name; - av_name.mDisplayName = avatar_name; + av_name.fromString(avatar_name); const LLUUID& agent_id = avatar_id; sAvatarNameMap[agent_id] = av_name; diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp index 664cdd19d..01d39f0f5 100644 --- a/indra/newview/llfloaterchat.cpp +++ b/indra/newview/llfloaterchat.cpp @@ -75,6 +75,7 @@ // LLColor4 agent_chat_color(const LLUUID& id, const std::string&, bool local_chat = true); LLColor4 get_text_color(const LLChat& chat, bool from_im = false); +void show_log_browser(const std::string&, const std::string&); // // Member Functions @@ -89,12 +90,10 @@ LLFloaterChat::LLFloaterChat(const LLSD& seed) // do not automatically open singleton floaters (as result of getInstance()) LLUICtrlFactory::getInstance()->buildFloater(this, "floater_chat_history.xml", &getFactoryMap(), /*no_open =*/false); - childSetCommitCallback("show mutes",onClickToggleShowMute,this); //show mutes - //childSetCommitCallback("translate chat",onClickToggleTranslateChat,this); - //childSetValue("translate chat", gSavedSettings.getBOOL("TranslateChat")); - childSetVisible("Chat History Editor with mute",FALSE); - childSetAction("toggle_active_speakers_btn", onClickToggleActiveSpeakers, this); - childSetAction("chat_history_open", onClickChatHistoryOpen, this); + LLTextEditor* history_editor_with_mute = getChild("Chat History Editor with mute"); + getChild("show mutes")->setCommitCallback(boost::bind(&LLFloaterChat::onClickToggleShowMute, this, _2, getChild("Chat History Editor"), history_editor_with_mute)); + history_editor_with_mute->setVisible(false); + getChild("chat_history_open")->setCommitCallback(boost::bind(show_log_browser, "chat", "chat")); } LLFloaterChat::~LLFloaterChat() @@ -104,16 +103,7 @@ LLFloaterChat::~LLFloaterChat() void LLFloaterChat::draw() { - // enable say and shout only when text available - - mToggleActiveSpeakersBtn->setValue(mPanel->getVisible()); - - LLChatBar* chat_barp = mChatPanel; - if (chat_barp) - { - chat_barp->refresh(); - } - + mChatPanel->refresh(); mPanel->refreshSpeakers(); LLFloater::draw(); } @@ -122,22 +112,12 @@ BOOL LLFloaterChat::postBuild() { mPanel = getChild("active_speakers_panel"); - LLChatBar* chat_barp = getChild("chat_panel", TRUE); - if (chat_barp) - { - chat_barp->setGestureCombo(getChild( "Gesture")); - } - - mToggleActiveSpeakersBtn.connect(this,"toggle_active_speakers_btn"); + getChild("toggle_active_speakers_btn")->setCommitCallback(boost::bind(&LLFloaterChat::onClickToggleActiveSpeakers, this, _2)); mChatPanel.connect(this,"chat_panel"); + mChatPanel->setGestureCombo(getChild( "Gesture")); return TRUE; } -void LLFloaterChat::onOpen() -{ - gSavedSettings.setBOOL("ShowChatHistory", true); -} - // public virtual void LLFloaterChat::onClose(bool app_quitting) { @@ -169,8 +149,7 @@ void LLFloaterChat::onFocusReceived() if (getVisible() && chat_editor->getVisible()) { gFocusMgr.setKeyboardFocus(chat_editor); - - chat_editor->setFocus(TRUE); + chat_editor->setFocus(true); } LLFloater::onFocusReceived(); @@ -213,10 +192,14 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& chat.mURL = llformat("secondlife:///app/agent/%s/about",chat.mFromID.asString().c_str()); } - if(chat.mSourceType == CHAT_SOURCE_OBJECT && !chat.mFromName.length()) + if (chat.mSourceType == CHAT_SOURCE_OBJECT) { - chat.mFromName = LLTrans::getString("Unnamed"); - line = chat.mFromName + line; + LLStringUtil::trim(chat.mFromName); + if (!chat.mFromName.length()) + { + chat.mFromName = LLTrans::getString("Unnamed"); + line = chat.mFromName + line; + } } static const LLCachedControl italicize("LiruItalicizeActions"); @@ -227,7 +210,7 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& { std::string start_line = line.substr(0, chat.mFromName.length() + 1); line = line.substr(chat.mFromName.length() + 1); - LLStyleSP sourceStyle = LLStyleMap::instance().lookup(chat.mFromID,chat.mURL); + LLStyleSP sourceStyle = LLStyleMap::instance().lookup(chat.mFromID, chat.mURL); sourceStyle->mItalic = is_irc; edit->appendStyledText(start_line, false, prepend_newline, sourceStyle); prepend_newline = false; @@ -240,13 +223,13 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4& void log_chat_text(const LLChat& chat) { - std::string histstr; - if (gSavedPerAccountSettings.getBOOL("LogChatTimestamp")) - histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + chat.mText; - else - histstr = chat.mText; + std::string histstr; + if (gSavedPerAccountSettings.getBOOL("LogChatTimestamp")) + histstr = LLLogChat::timestamp(gSavedPerAccountSettings.getBOOL("LogTimestampDate")) + chat.mText; + else + histstr = chat.mText; - LLLogChat::saveHistory(std::string("chat"),histstr); + LLLogChat::saveHistory(std::string("chat"), histstr); } // static void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) @@ -275,7 +258,7 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) } // [/RLVa:KB] - if ( gSavedPerAccountSettings.getBOOL("LogChat") && log_to_file) + if (gSavedPerAccountSettings.getBOOL("LogChat") && log_to_file) { log_chat_text(chat); } @@ -298,8 +281,8 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file) // could flash the chat button in the status bar here. JC LLFloaterChat* chat_floater = LLFloaterChat::getInstance(LLSD()); - LLViewerTextEditor* history_editor = chat_floater->getChild("Chat History Editor"); - LLViewerTextEditor* history_editor_with_mute = chat_floater->getChild("Chat History Editor with mute"); + LLViewerTextEditor* history_editor = chat_floater->getChild("Chat History Editor"); + LLViewerTextEditor* history_editor_with_mute = chat_floater->getChild("Chat History Editor with mute"); history_editor->setParseHTML(TRUE); history_editor_with_mute->setParseHTML(TRUE); @@ -347,72 +330,12 @@ void LLFloaterChat::setHistoryCursorAndScrollToEnd() } -//static -void LLFloaterChat::onClickMute(void *data) -{ - LLFloaterChat* self = (LLFloaterChat*)data; - - LLComboBox* chatter_combo = self->getChild("chatter combobox"); - - const std::string& name = chatter_combo->getSimple(); - LLUUID id = chatter_combo->getCurrentID(); - - if (name.empty()) return; - - LLMute mute(id); - mute.setFromDisplayName(name); - LLMuteList::getInstance()->add(mute); - - LLFloaterMute::showInstance(); -} - //static -void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data) +void LLFloaterChat::onClickToggleShowMute(bool show_mute, LLTextEditor* history_editor, LLTextEditor* history_editor_with_mute) { - LLFloaterChat* floater = (LLFloaterChat*)data; - - - //LLCheckBoxCtrl* - BOOL show_mute = floater->getChild("show mutes")->get(); - LLViewerTextEditor* history_editor = floater->getChild("Chat History Editor"); - LLViewerTextEditor* history_editor_with_mute = floater->getChild("Chat History Editor with mute"); - - if (!history_editor || !history_editor_with_mute) - return; - - //BOOL show_mute = floater->mShowMuteCheckBox->get(); - if (show_mute) - { - history_editor->setVisible(FALSE); - history_editor_with_mute->setVisible(TRUE); - history_editor_with_mute->setCursorAndScrollToEnd(); - } - else - { - history_editor->setVisible(TRUE); - history_editor_with_mute->setVisible(FALSE); - history_editor->setCursorAndScrollToEnd(); - } -} - -// Update the "TranslateChat" pref after "translate chat" checkbox is toggled in -// the "Local Chat" floater. -//static -void LLFloaterChat::onClickToggleTranslateChat(LLUICtrl* caller, void *data) -{ - LLFloaterChat* floater = (LLFloaterChat*)data; - - BOOL translate_chat = floater->getChild("translate chat")->get(); - gSavedSettings.setBOOL("TranslateChat", translate_chat); -} - -// Update the "translate chat" checkbox after the "TranslateChat" pref is set in -// some other place (e.g. prefs dialog). -//static -void LLFloaterChat::updateSettings() -{ - BOOL translate_chat = gSavedSettings.getBOOL("TranslateChat"); - LLFloaterChat::getInstance(LLSD())->getChild("translate chat")->set(translate_chat); + history_editor->setVisible(!show_mute); + history_editor_with_mute->setVisible(show_mute); + (show_mute ? history_editor_with_mute : history_editor)->setCursorAndScrollToEnd(); } // Put a line of chat in all the right places @@ -596,24 +519,24 @@ LLColor4 get_text_color(const LLChat& chat, bool from_im) //static void LLFloaterChat::loadHistory() { - LLLogChat::loadHistory(std::string("chat"), &chatFromLogFile, (void *)LLFloaterChat::getInstance(LLSD())); + LLLogChat::loadHistory("chat", &chatFromLogFile, (void*)LLFloaterChat::getInstance()); } //static -void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type , std::string line, void* userdata) +void LLFloaterChat::chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata) { switch (type) { case LLLogChat::LOG_EMPTY: + if (gSavedPerAccountSettings.getBOOL("LogChat")) + addChatHistory(static_cast(userdata)->getString("IM_logging_string"), false); + break; case LLLogChat::LOG_END: - // *TODO: nice message from XML file here + if (gSavedPerAccountSettings.getBOOL("LogChat")) + addChatHistory(static_cast(userdata)->getString("IM_end_log_string"), false); break; case LLLogChat::LOG_LINE: - { - LLChat chat; - chat.mText = line; - addChatHistory(chat, FALSE); - } + addChatHistory(line, FALSE); break; default: // nothing @@ -630,29 +553,18 @@ void* LLFloaterChat::createSpeakersPanel(void* data) //static void* LLFloaterChat::createChatPanel(void* data) { - LLChatBar* chatp = new LLChatBar(); - return chatp; + return new LLChatBar; } // static -void LLFloaterChat::onClickToggleActiveSpeakers(void* userdata) +void LLFloaterChat::onClickToggleActiveSpeakers(const LLSD& val) { - LLFloaterChat* self = (LLFloaterChat*)userdata; - // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - self->childSetVisible("active_speakers_panel", - (!self->childIsVisible("active_speakers_panel")) && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) ); + mPanel->setVisible(val && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); // [/RLVa:KB] - //self->childSetVisible("active_speakers_panel", !self->childIsVisible("active_speakers_panel")); + //mPanel->setVisible(val); } -void show_log_browser(const std::string& name = "chat", const std::string& id = "chat"); - -// static -void LLFloaterChat::onClickChatHistoryOpen(void* userdata) -{ - show_log_browser(); -} //static bool LLFloaterChat::visible(LLFloater* instance, const LLSD& key) diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h index dcad5f632..3af635356 100644 --- a/indra/newview/llfloaterchat.h +++ b/indra/newview/llfloaterchat.h @@ -40,17 +40,9 @@ #include "llfloater.h" #include "lllogchat.h" -class LLButton; class LLChat; -class LLComboBox; -class LLLineEditor; -class LLViewerTextEditor; -class LLMessageSystem; -class LLUUID; -class LLCheckBoxCtrl; -class LLParticipantList; -class LLLogChat; class LLChatBar; +class LLParticipantList; class LLFloaterChat : public LLFloater, public LLUISingleton @@ -61,13 +53,11 @@ public: virtual void draw(); virtual BOOL postBuild(); - virtual void onOpen(); virtual void onClose(bool app_quitting); virtual void onFocusReceived(); virtual void handleVisibilityChange(BOOL cur_visibility); virtual void setMinimized(BOOL); void updateConsoleVisibility(); - void updateSettings(); static void setHistoryCursorAndScrollToEnd(); @@ -80,12 +70,9 @@ public: static void triggerAlerts(const std::string& text); - static void onClickMute(void *data); - static void onClickToggleShowMute(LLUICtrl* caller, void *data); - static void onClickToggleTranslateChat(LLUICtrl* caller, void *data); - static void onClickToggleActiveSpeakers(void* userdata); - static void onClickChatHistoryOpen(void* userdata); - static void chatFromLogFile(LLLogChat::ELogLineType type,std::string line, void* userdata); + void onClickToggleShowMute(bool show_mute, class LLTextEditor* history_editor, LLTextEditor* history_editor_with_mute); + void onClickToggleActiveSpeakers(const LLSD& val); + static void chatFromLogFile(LLLogChat::ELogLineType type, std::string line, void* userdata); static void loadHistory(); static void* createSpeakersPanel(void* data); static void* createChatPanel(void* data); @@ -100,7 +87,6 @@ public: BOOL focusFirstItem(BOOL prefer_text_fields = FALSE, BOOL focus_flash = TRUE ); - CachedUICtrl mToggleActiveSpeakersBtn; CachedUICtrl mChatPanel; }; diff --git a/indra/newview/llfloatercustomize.cpp b/indra/newview/llfloatercustomize.cpp index 30cf75dc9..026dfeb40 100644 --- a/indra/newview/llfloatercustomize.cpp +++ b/indra/newview/llfloatercustomize.cpp @@ -38,6 +38,7 @@ #include "llagentcamera.h" #include "llagentwearables.h" #include "llappearancemgr.h" +#include "llflyoutbutton.h" #include "llmakeoutfitdialog.h" #include "llmorphview.h" #include "llnotificationsutil.h" @@ -154,11 +155,9 @@ LLFloaterCustomize::~LLFloaterCustomize() // virtual BOOL LLFloaterCustomize::postBuild() { - mMakeOutfitBtn = getChild("Make Outfit"); - getChild("Make Outfit")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnMakeOutfit, this)); - mSaveOutfitBtn = getChild("Save Outfit"); - mSaveOutfitBtn->setCommitCallback(boost::bind(&LLAppearanceMgr::updateBaseOutfit, LLAppearanceMgr::getInstance())); - refreshCurrentOutfitName(); // Initialize tooltip for save outfit button + mMakeOutfitBtn = getChild("Make Outfit"); + mMakeOutfitBtn->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnMakeOutfit, this, _2)); + refreshCurrentOutfitName(); // Initialize flyout list entry for save outfit getChild("Ok")->setCommitCallback(boost::bind(&LLFloaterCustomize::onBtnOk, this)); getChild("Cancel")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); @@ -201,11 +200,11 @@ BOOL LLFloaterCustomize::postBuild() void LLFloaterCustomize::refreshCurrentOutfitName(const std::string& name) { // Set current outfit status (wearing/unsaved). - bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + //bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); //std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); //mOutfitStatus->setText(cof_status_str); - mSaveOutfitBtn->setEnabled(dirty); // No use saving unless dirty + mMakeOutfitBtn->remove(0); if (name.empty()) { std::string outfit_name; @@ -214,22 +213,21 @@ void LLFloaterCustomize::refreshCurrentOutfitName(const std::string& name) //mCurrentLookName->setText(outfit_name); LLStringUtil::format_map_t args; args["[OUTFIT]"] = outfit_name; - mSaveOutfitBtn->setToolTip(getString("Save changes to", args)); + mMakeOutfitBtn->add(getString("Save changes to", args), LLSD(true)); return; } std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; //mCurrentLookName->setText(getString(string_name)); - mSaveOutfitBtn->setToolTip(getString(string_name)); + mMakeOutfitBtn->add(getString(string_name), LLSD()); //mOpenOutfitBtn->setEnabled(FALSE); - mSaveOutfitBtn->setEnabled(false); // Can't save right now } else { //mCurrentLookName->setText(name); LLStringUtil::format_map_t args; args["[OUTFIT]"] = name; - mSaveOutfitBtn->setToolTip(getString("Save changes to", args)); + mMakeOutfitBtn->add(getString("Save changes to", args), LLSD(true)); // Can't just call update verbs since the folder link may not have been created yet. //mOpenOutfitBtn->setEnabled(TRUE); } @@ -539,9 +537,12 @@ void LLFloaterCustomize::onBtnOk() close(false); } -void LLFloaterCustomize::onBtnMakeOutfit() +void LLFloaterCustomize::onBtnMakeOutfit(const LLSD& val) { - new LLMakeOutfitDialog(true); // LLMakeOutfitDialog deletes itself. + if (val && LLAppearanceMgr::instance().isOutfitDirty()) // No use saving unless dirty + LLAppearanceMgr::instance().updateBaseOutfit(); + else + new LLMakeOutfitDialog(true); // LLMakeOutfitDialog deletes itself. } //////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llfloatercustomize.h b/indra/newview/llfloatercustomize.h index c7246e5fc..dfe669470 100644 --- a/indra/newview/llfloatercustomize.h +++ b/indra/newview/llfloatercustomize.h @@ -99,7 +99,7 @@ public: private: // Callbacks void onBtnOk(); - void onBtnMakeOutfit(); + void onBtnMakeOutfit(const LLSD& val); void onBtnImport(); void onBtnImport_continued(AIFilePicker* filepicker); void onBtnExport(); @@ -120,7 +120,7 @@ private: LLScrollingPanelList* mScrollingPanelList; LLScrollContainer* mScrollContainer; LLView *mMetricHeight, *mImperialHeight; - LLUICtrl *mMakeOutfitBtn, *mSaveOutfitBtn; + class LLFlyoutButton* mMakeOutfitBtn; LLTabContainer* mTabContainer; LLPointer mResetParams; diff --git a/indra/newview/llfloaterdisplayname.cpp b/indra/newview/llfloaterdisplayname.cpp index a00cfb8bf..3aca56f75 100644 --- a/indra/newview/llfloaterdisplayname.cpp +++ b/indra/newview/llfloaterdisplayname.cpp @@ -40,53 +40,12 @@ #include "llagent.h" -LLFloaterDisplayName* LLFloaterDisplayName::sInstance = NULL; - -LLFloaterDisplayName::LLFloaterDisplayName() +LLFloaterDisplayName::LLFloaterDisplayName(const LLSD&) : LLFloater(std::string("Display Names Floater")) { - LLFloaterDisplayName::sInstance = this; + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_display_name.xml"); } -// virtual -LLFloaterDisplayName::~LLFloaterDisplayName() -{ - - LLFloaterDisplayName::sInstance = NULL; - -} - -BOOL LLFloaterDisplayName::postBuild() -{ - childSetAction("reset_btn", onReset, this); - childSetAction("cancel_btn", onCancel, this); - childSetAction("save_btn", onSave, this); - - center(); - - return TRUE; -} - -void LLFloaterDisplayName::show() -{ - if (LLFloaterDisplayName::sInstance) - { - LLFloaterDisplayName::sInstance->open(); /*Flawfinder: ignore*/ - return; - } - - - LLFloaterDisplayName *self = new LLFloaterDisplayName(); - - // Builds and adds to gFloaterView - LLUICtrlFactory::getInstance()->buildFloater(self, "floater_display_name.xml"); - - // Fix up rectangle - - self->open(); /*Flawfinder: ignore*/ -} - - void LLFloaterDisplayName::onOpen() { getChild("display_name_editor")->clear(); @@ -112,16 +71,10 @@ void LLFloaterDisplayName::onOpen() std::string hour = next_update_local.asString().substr(11,2); std::string minute = next_update_local.asString().substr(14,2); std::string second = next_update_local.asString().substr(17,2); - std::string next_update_string_date = - llformat("%s/%s/%s",year.c_str(),month.c_str(), - day.c_str()); - std::string next_update_string_time = - llformat("%s:%s:%s",hour.c_str(),minute.c_str(), - second.c_str()); - getChild("lockout_text")->setTextArg("[DATE]", - next_update_string_date); - getChild("lockout_text")->setTextArg("[TIME]", - next_update_string_time); + std::string next_update_string_date = llformat("%s/%s/%s",year.c_str(),month.c_str(), day.c_str()); + std::string next_update_string_time = llformat("%s:%s:%s",hour.c_str(),minute.c_str(), second.c_str()); + getChild("lockout_text")->setTextArg("[DATE]", next_update_string_date); + getChild("lockout_text")->setTextArg("[TIME]", next_update_string_time); getChild("lockout_text")->setVisible(true); getChild("save_btn")->setEnabled(false); getChild("display_name_editor")->setEnabled(false); @@ -139,6 +92,16 @@ void LLFloaterDisplayName::onOpen() } } +BOOL LLFloaterDisplayName::postBuild() +{ + getChild("reset_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onReset, this)); + getChild("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onCancel, this)); + getChild("save_btn")->setCommitCallback(boost::bind(&LLFloaterDisplayName::onSave, this)); + + center(); + + return TRUE; +} void LLFloaterDisplayName::onCacheSetName(bool success, const std::string& reason, @@ -151,10 +114,6 @@ void LLFloaterDisplayName::onCacheSetName(bool success, LLSD args; args["DISPLAY_NAME"] = content["display_name"]; LLNotificationsUtil::add("SetDisplayNameSuccess", args); - - // Re-fetch my name, as it may have been sanitized by the service - //LLAvatarNameCache::get(getAvatarId(), - // boost::bind(&LLPanelMyProfileEdit::onNameCache, this, _1, _2)); return; } @@ -167,7 +126,7 @@ void LLFloaterDisplayName::onCacheSetName(bool success, if (!error_tag.empty() && LLNotificationTemplates::getInstance()->templateExists(error_tag)) { - LLNotifications::instance().add(error_tag); + LLNotificationsUtil::add(error_tag); return; } @@ -186,34 +145,30 @@ void LLFloaterDisplayName::onCacheSetName(bool success, LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); } -void LLFloaterDisplayName::onCancel(void* data) +void LLFloaterDisplayName::onCancel() { - LLFloaterDisplayName* self = (LLFloaterDisplayName*)data; - self->setVisible(false); + setVisible(false); } -void LLFloaterDisplayName::onReset(void* data) +void LLFloaterDisplayName::onReset() { - LLFloaterDisplayName* self = (LLFloaterDisplayName*)data; - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarNameCache::hasNameLookupURL()) { - LLViewerDisplayName::set("", - boost::bind(&LLFloaterDisplayName::onCacheSetName, self, _1, _2, _3)); + LLViewerDisplayName::set("", boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); } else { LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); } - self->setVisible(false); + setVisible(false); } -void LLFloaterDisplayName::onSave(void* data) +void LLFloaterDisplayName::onSave() { - LLFloaterDisplayName* self = (LLFloaterDisplayName*)data; - std::string display_name_utf8 = self->getChild("display_name_editor")->getValue().asString(); - std::string display_name_confirm = self->getChild("display_name_confirm")->getValue().asString(); + std::string display_name_utf8 = getChild("display_name_editor")->getValue().asString(); + std::string display_name_confirm = getChild("display_name_confirm")->getValue().asString(); if (display_name_utf8.compare(display_name_confirm)) { @@ -231,17 +186,16 @@ void LLFloaterDisplayName::onSave(void* data) return; } - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarNameCache::hasNameLookupURL()) { - LLViewerDisplayName::set(display_name_utf8, - boost::bind(&LLFloaterDisplayName::onCacheSetName, self, _1, _2, _3)); + LLViewerDisplayName::set(display_name_utf8, boost::bind(&LLFloaterDisplayName::onCacheSetName, this, _1, _2, _3)); } else { LLNotificationsUtil::add("SetDisplayNameFailedGeneric"); } - self->setVisible(false); + setVisible(false); } diff --git a/indra/newview/llfloaterdisplayname.h b/indra/newview/llfloaterdisplayname.h index 2d6bbf198..0e642706b 100644 --- a/indra/newview/llfloaterdisplayname.h +++ b/indra/newview/llfloaterdisplayname.h @@ -28,24 +28,21 @@ class LLFloaterDisplayName : public LLFloater +, public LLFloaterSingleton { public: - LLFloaterDisplayName(); - virtual ~LLFloaterDisplayName(); + LLFloaterDisplayName(const LLSD&); + virtual ~LLFloaterDisplayName() { } /*virtual*/ BOOL postBuild(); - static void onSave(void* data); - static void onReset(void* data); - static void onCancel(void* data); - static void show(); + void onSave(); + void onReset(); + void onCancel(); /*virtual*/ void onOpen(); private: void onCacheSetName(bool success, const std::string& reason, const LLSD& content); -protected: - static LLFloaterDisplayName* sInstance; - }; diff --git a/indra/newview/llfloaterfriends.cpp b/indra/newview/llfloaterfriends.cpp index 14a684bbe..c28993742 100644 --- a/indra/newview/llfloaterfriends.cpp +++ b/indra/newview/llfloaterfriends.cpp @@ -330,9 +330,7 @@ const S32& friend_name_system() static void update_friend_item(LLScrollListItem* item, const LLAvatarName& avname) { - std::string name; - LLAvatarNameCache::getPNSName(avname, name, friend_name_system()); - item->getColumn(1)->setValue(name); + item->getColumn(1)->setValue(avname.getNSName(friend_name_system())); } void LLPanelFriends::addFriend(const LLUUID& agent_id) @@ -343,7 +341,7 @@ void LLPanelFriends::addFriend(const LLUUID& agent_id) bool isOnline = relation_info->isOnline(); std::string fullname; - bool have_name = LLAvatarNameCache::getPNSName(agent_id, fullname, friend_name_system()); + bool have_name = LLAvatarNameCache::getNSName(agent_id, fullname, friend_name_system()); if (!have_name) gCacheName->getFullName(agent_id, fullname); LLScrollListItem::Params element; @@ -353,7 +351,6 @@ void LLPanelFriends::addFriend(const LLUUID& agent_id) static const LLCachedControl sDefaultColor(gColors, "DefaultListText"); static const LLCachedControl sMutedColor("AscentMutedColor"); friend_column.color(LLAvatarActions::isBlocked(agent_id) ? sMutedColor : sDefaultColor); - element.columns.add(friend_column); LLScrollListCell::Params cell; cell.column("icon_online_status").type("icon"); @@ -417,7 +414,7 @@ void LLPanelFriends::updateFriendItem(const LLUUID& agent_id, const LLRelationsh bool isOnline = info->isOnline(); std::string fullname; - if (LLAvatarNameCache::getPNSName(agent_id, fullname, friend_name_system())) + if (LLAvatarNameCache::getNSName(agent_id, fullname, friend_name_system())) { itemp->getColumn(LIST_FRIEND_UPDATE_GEN)->setValue(info->getChangeSerialNum()); } @@ -847,7 +844,7 @@ void LLPanelFriends::confirmModifyRights(rights_map_t& rights, EGrantRevoke comm { LLSD args; std::string fullname; - if (LLAvatarNameCache::getPNSName(rights.begin()->first, fullname, friend_name_system())) + if (LLAvatarNameCache::getNSName(rights.begin()->first, fullname, friend_name_system())) args["NAME"] = fullname; LLNotificationsUtil::add(command == GRANT ? "GrantModifyRights" : "RevokeModifyRights", diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 8be4611bf..5367bcc6d 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -182,20 +182,27 @@ LLPanelGroups::~LLPanelGroups() gAgent.removeListener(this); } +void LLPanelGroups::setTexts() +{ + LLUICtrl* ctrl(getChild("groupcount")); + size_t count(gAgent.mGroups.size()); + ctrl->setTextArg("[COUNT]", llformat("%d", count)); + int maxgroups(gHippoLimits->getMaxAgentGroups()); + ctrl->setTextArg("[MAX]", llformat("%d", maxgroups)); + ctrl->setTextArg("[LEFT]", llformat("%d", maxgroups - count)); +} + // clear the group list, and get a fresh set of info. void LLPanelGroups::reset() { - getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d", gHippoLimits->getMaxAgentGroups())); - + setTexts(); init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); } BOOL LLPanelGroups::postBuild() { - getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.size())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gHippoLimits->getMaxAgentGroups())); + setTexts(); LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llfloatergroups.h b/indra/newview/llfloatergroups.h index 8af8e03c3..229b75754 100644 --- a/indra/newview/llfloatergroups.h +++ b/indra/newview/llfloatergroups.h @@ -106,6 +106,9 @@ protected: // initialize based on the type BOOL postBuild(); + // set the text displays + void setTexts(); + // highlight_id is a group id to highlight void enableButtons(); diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index 5bf957992..7ab55de5d 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -239,54 +239,57 @@ void LLFloaterInspect::refresh() // actual name and set a placeholder. if (LLAvatarNameCache::get(idOwner, &av_name)) { -// owner_name = av_name.getCompleteName(); +// owner_name = av_name.getNSName(); // [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a bool fRlvFilterOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idOwner != gAgent.getID()) && (!obj->mPermissions->isGroupOwned()); - owner_name = (!fRlvFilterOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); + owner_name = (!fRlvFilterOwner) ? av_name.getNSName() : RlvStrings::getAnonym(av_name); // [/RLVa:KB] } else { owner_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::dirty, this)); - } - - if (LLAvatarNameCache::get(idCreator, &av_name)) - { -// creator_name = av_name.getCompleteName(); -// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a - const LLUUID& idCreator = obj->mPermissions->getCreator(); - LLAvatarNameCache::get(idCreator, &av_name); - bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idCreator != gAgent.getID()) && - ( (obj->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator)) ); - creator_name = (!fRlvFilterCreator) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); -// [/RLVa:KB] - } - else - { - creator_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::dirty, this)); + if (mOwnerNameCacheConnection.find(idOwner) == mOwnerNameCacheConnection.end()) + mOwnerNameCacheConnection.emplace(idOwner, LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetOwnerNameCallback, this, _1))); } // if (LLAvatarNameCache::get(idLastOwner, &av_name)) { -// last_owner_name = av_name.getCompleteName(); +// last_owner_name = av_name.getNSName(); // [RLVa:LF] - Copied from the above creator check Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a LLAvatarNameCache::get(idLastOwner, &av_name); - bool fRlvFilterLastOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idLastOwner != gAgent.getID()) && - ( (obj->mPermissions->getOwner() == idLastOwner) || (RlvUtil::isNearbyAgent(idLastOwner)) ); - last_owner_name = (!fRlvFilterLastOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); + bool fRlvFilterLastOwner = gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && idLastOwner != gAgent.getID() && + (obj->mPermissions->getOwner() == idLastOwner || RlvUtil::isNearbyAgent(idLastOwner)); + last_owner_name = (!fRlvFilterLastOwner) ? av_name.getNSName() : RlvStrings::getAnonym(av_name); // [/RLVa:LF] } else { last_owner_name = LLTrans::getString("RetrievingData"); - LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::dirty, this)); + if (mLastOwnerNameCacheConnection.find(idLastOwner) == mLastOwnerNameCacheConnection.end()) + mLastOwnerNameCacheConnection.emplace(idLastOwner, LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::onGetLastOwnerNameCallback, this, _1))); } // + if (LLAvatarNameCache::get(idCreator, &av_name)) + { +// creator_name = av_name.getNSName(); +// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + const LLUUID& idCreator = obj->mPermissions->getCreator(); + LLAvatarNameCache::get(idCreator, &av_name); + bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idCreator != gAgent.getID()) && + ( (obj->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator)) ); + creator_name = (!fRlvFilterCreator) ? av_name.getNSName() : RlvStrings::getAnonym(av_name); +// [/RLVa:KB] + } + else + { + creator_name = LLTrans::getString("RetrievingData"); + if (mCreatorNameCacheConnection.find(idCreator) == mCreatorNameCacheConnection.end()) + mCreatorNameCacheConnection.emplace(idCreator, LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetCreatorNameCallback, this, _1))); + } + row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; @@ -321,8 +324,8 @@ void LLFloaterInspect::refresh() row["columns"][5]["value"] = llformat("%d",obj->getObject()->getNumVertices()); // inventory silliness S32 scripts,total_inv; - std::map >::iterator itr = mInventoryNums.find(obj->getObject()->getID()); - if(itr != mInventoryNums.end()) + std::map >::iterator itr = mInventoryNums.find(obj->getObject()->getID()); + if (itr != mInventoryNums.end()) { scripts = itr->second.first; total_inv = itr->second.second; @@ -331,10 +334,10 @@ void LLFloaterInspect::refresh() { scripts = 0; total_inv = 0; - if(std::find(mQueue.begin(),mQueue.end(),obj->getObject()->getID()) == mQueue.end()) + if (std::find(mQueue.begin(),mQueue.end(),obj->getObject()->getID()) == mQueue.end()) { mQueue.push_back(obj->getObject()->getID()); - registerVOInventoryListener(obj->getObject(),NULL); + registerVOInventoryListener(obj->getObject(), NULL); requestVOInventory(); } } @@ -365,23 +368,19 @@ void LLFloaterInspect::refresh() } // -void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, LLInventoryObject::object_list_t* inv, S32, void* q_id) +void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, LLInventoryObject::object_list_t* inv, S32, void*) { std::vector::iterator iter = std::find(mQueue.begin(),mQueue.end(),viewer_object->getID()); - if (viewer_object && inv && iter != mQueue.end() ) + if (viewer_object && inv && iter != mQueue.end()) { - S32 scripts = 0; + U32 scripts = 0; LLInventoryObject::object_list_t::const_iterator end = inv->end(); for (LLInventoryObject::object_list_t::const_iterator it = inv->begin(); it != end; ++it) - { - if((*it)->getType() == LLAssetType::AT_LSL_TEXT) - { + if ((*it)->getType() == LLAssetType::AT_LSL_TEXT) ++scripts; - } - } mInventoryNums[viewer_object->getID()] = std::make_pair(scripts,inv->size()); mQueue.erase(iter); - mDirty = TRUE; + setDirty(); } } // @@ -401,6 +400,24 @@ void LLFloaterInspect::dirty() setDirty(); } +void LLFloaterInspect::onGetOwnerNameCallback(const LLUUID& id) +{ + mOwnerNameCacheConnection.erase(id); + setDirty(); +} + +void LLFloaterInspect::onGetLastOwnerNameCallback(const LLUUID& id) +{ + mLastOwnerNameCacheConnection.erase(id); + setDirty(); +} + +void LLFloaterInspect::onGetCreatorNameCallback(const LLUUID& id) +{ + mCreatorNameCacheConnection.erase(id); + setDirty(); +} + void LLFloaterInspect::draw() { if (mDirty) diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 5e19d8df3..c60b116d7 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -38,6 +38,7 @@ #include "llavatarname.h" #include "llfloater.h" #include "llvoinventorylistener.h" +#include //class LLTool; class LLObjectSelection; @@ -72,14 +73,21 @@ protected: // private: - LLFloaterInspect(const LLSD&); + void onGetOwnerNameCallback(const LLUUID& id); + void onGetLastOwnerNameCallback(const LLUUID& id); // + void onGetCreatorNameCallback(const LLUUID& id); + + LLFloaterInspect(const LLSD& key); virtual ~LLFloaterInspect(void); LLSafeHandle mObjectSelection; // - std::map > mInventoryNums; // + std::map > mInventoryNums; // std::vector mQueue; // + boost::container::map mOwnerNameCacheConnection; + boost::container::map mLastOwnerNameCacheConnection; // + boost::container::map mCreatorNameCacheConnection; }; #endif //LL_LLFLOATERINSPECT_H diff --git a/indra/newview/llfloaterobjectiminfo.cpp b/indra/newview/llfloaterobjectiminfo.cpp index 5d433bca6..ce65e8d8c 100644 --- a/indra/newview/llfloaterobjectiminfo.cpp +++ b/indra/newview/llfloaterobjectiminfo.cpp @@ -58,32 +58,37 @@ // LLFloaterObjectIMInfo LLFloaterObjectIMInfo::LLFloaterObjectIMInfo(const LLSD& seed) -: mObjectID(), mName(), mSLurl(), mOwnerID(), mGroupOwned(false) +: mName(), mSLurl(), mOwnerID(), mGroupOwned(false) { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_object_im_info.xml"); - if (getRect().mLeft == 0 - && getRect().mBottom == 0) - { + if (!getRect().mLeft && !getRect().mBottom) center(); - } } -BOOL LLFloaterObjectIMInfo::postBuild(void) +static void show_avatar_profile(const LLUUID& id) { - childSetAction("Mute",onClickMute,this); - childSetActionTextbox("OwnerName",onClickOwner, this); - childSetActionTextbox("Slurl",onClickMap, this); +// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g + if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) || !RlvUtil::isNearbyAgent(id)) + return; +// [/RLVa:KB] + LLAvatarActions::showProfile(id); +} + +BOOL LLFloaterObjectIMInfo::postBuild() +{ + getChild("Mute")->setCommitCallback(boost::bind(&LLFloaterObjectIMInfo::onClickMute, this)); + getChild("OwnerName")->setClickedCallback(boost::bind(boost::ref(mGroupOwned) ? boost::bind(LLGroupActions::show, boost::ref(mOwnerID)) : boost::bind(show_avatar_profile, boost::ref(mOwnerID)))); + getChild("Slurl")->setClickedCallback(boost::bind(LLUrlAction::showLocationOnMap, "secondlife://" + static_cast(boost::ref(mSLurl)))); return true; } -void LLFloaterObjectIMInfo::update(LLSD& data) +void LLFloaterObjectIMInfo::update(const LLSD& data) { // Extract appropriate object information from input LLSD // (Eventually, it might be nice to query server for details // rather than require caller to pass in the information.) - mObjectID = data["object_id"].asUUID(); mName = data["name"].asString(); mOwnerID = data["owner_id"].asUUID(); mGroupOwned = data["group_owned"].asBoolean(); @@ -100,7 +105,8 @@ void LLFloaterObjectIMInfo::update(LLSD& data) childSetText("ObjectName",mName); childSetText("Slurl",mSLurl); - childSetText("OwnerName",std::string("")); + childSetText("OwnerName", LLStringUtil::null); + getChildView("ObjectID")->setValue(data["object_id"].asUUID()); // bool my_object = (owner_id == gAgentID); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g @@ -108,77 +114,43 @@ void LLFloaterObjectIMInfo::update(LLSD& data) // [/RLVa:KB] childSetEnabled("Mute",!my_object); - if (gCacheName) gCacheName->get(mOwnerID,mGroupOwned,boost::bind(&LLFloaterObjectIMInfo::nameCallback,this,_1,_2,_3)); + if (gCacheName) + gCacheName->get(mOwnerID, mGroupOwned, boost::bind(&LLFloaterObjectIMInfo::nameCallback, this, _2)); } -//static -void LLFloaterObjectIMInfo::onClickMap(void* data) +void LLFloaterObjectIMInfo::onClickMute() { - LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; - - std::string url = "secondlife://" + self->mSLurl; - LLUrlAction::showLocationOnMap(url); -} - -//static -void LLFloaterObjectIMInfo::onClickOwner(void* data) -{ - LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; - if (self->mGroupOwned) - { - LLGroupActions::show(self->mOwnerID); - } -// else // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g - else if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) || (!RlvUtil::isNearbyAgent(self->mOwnerID)) ) -// [/RLVa:KB] - { - LLAvatarActions::showProfile(self->mOwnerID); - } -} - -//static -void LLFloaterObjectIMInfo::onClickMute(void* data) -{ - LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data; - - LLMute::EType mute_type = (self->mGroupOwned) ? LLMute::GROUP : LLMute::AGENT; -// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g - if ( (LLMute::GROUP != mute_type) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(self->mOwnerID)) ) - { + if (!mGroupOwned && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && RlvUtil::isNearbyAgent(mOwnerID)) return; - } // [/RLVa:KB] - LLMute mute(self->mOwnerID, self->mName, mute_type); - LLMuteList::getInstance()->add(mute); + LLMuteList::instance().add(LLMute(mOwnerID, mName, mGroupOwned ? LLMute::GROUP : LLMute::AGENT)); LLFloaterMute::showInstance(); - self->close(); + close(); } //static -void LLFloaterObjectIMInfo::nameCallback(const LLUUID& id, const std::string& full_name, bool is_group) +void LLFloaterObjectIMInfo::nameCallback(const std::string& full_name) { - mName = full_name; + childSetText("OwnerName", mName = // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g - if ( (!is_group) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (RlvUtil::isNearbyAgent(id)) ) - { - mName = RlvStrings::getAnonym(mName); - } + (!mGroupOwned && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) && RlvUtil::isNearbyAgent(mOwnerID)) ? RlvStrings::getAnonym(mName) : // [/RLVa:KB] - - childSetText("OwnerName", mName); + full_name); } //////////////////////////////////////////////////////////////////////////// -// LLObjectIMInfoHandler +// LLObjectIMHandler //moved to llchathistory.cpp in v2 -class LLObjectIMInfoHandler : public LLCommandHandler +// support for secondlife:///app/objectim/{UUID}/ SLapps +class LLObjectIMHandler : public LLCommandHandler { public: - LLObjectIMInfoHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) { } + // requests will be throttled from a non-trusted browser + LLObjectIMHandler() : LLCommandHandler("objectim", UNTRUSTED_THROTTLE) { } - bool handle(const LLSD& params, const LLSD& query_map,LLMediaCtrl* web) + bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web) { if (params.size() < 1) { @@ -197,12 +169,8 @@ public: payload["name"] = query_map["name"]; payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]); payload["group_owned"] = query_map["groupowned"]; - LLFloaterObjectIMInfo::showInstance()->update(payload); - return true; } }; - -// Creating the object registers with the dispatcher. -LLObjectIMInfoHandler gObjectIMHandler; +LLObjectIMHandler gObjectIMHandler; diff --git a/indra/newview/llfloaterobjectiminfo.h b/indra/newview/llfloaterobjectiminfo.h index 58377c009..31ff8c162 100644 --- a/indra/newview/llfloaterobjectiminfo.h +++ b/indra/newview/llfloaterobjectiminfo.h @@ -41,19 +41,16 @@ public: LLFloaterObjectIMInfo(const LLSD& sd); virtual ~LLFloaterObjectIMInfo() { }; - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); - void update(LLSD& payload); + void update(const LLSD& payload); // UI Handlers - static void onClickMap(void* data); - static void onClickOwner(void* data); - static void onClickMute(void* data); + void onClickMute(); - void nameCallback(const LLUUID& id, const std::string& full_name, bool is_group); + void nameCallback(const std::string& full_name); private: - LLUUID mObjectID; LLUUID mOwnerID; std::string mSLurl; std::string mName; diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp index 46b67d1de..f2d82c881 100644 --- a/indra/newview/llfloaterproperties.cpp +++ b/indra/newview/llfloaterproperties.cpp @@ -981,7 +981,7 @@ void LLFloaterProperties::closeByID(const LLUUID& item_id, const LLUUID &object_ //static void LLFloaterProperties::dirtyAll() { - for(instance_iter it = beginInstances();it!=endInstances();++it) + for(instance_iter it = beginInstances(), it_end(endInstances()); it != it_end; ++it) { it->dirty(); } diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 23db2f4e8..e6a6b0316 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1303,7 +1303,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) if(texture_ctrl) { lldebugs << "Detail Texture " << i << ": " - << compp->getDetailTextureID(i) << llendl; + << compp->getDetailTextureID(i) << LL_ENDL; LLUUID tmp_id(compp->getDetailTextureID(i)); texture_ctrl->setImageAssetID(tmp_id); } @@ -2260,7 +2260,7 @@ void LLPanelEstateInfo::refreshFromEstate() const LLEstateInfoModel& estate_info = LLEstateInfoModel::instance(); getChild("estate_name")->setValue(estate_info.getName()); - LLAvatarNameCache::get(estate_info.getOwnerID(), boost::bind(&LLPanelEstateInfo::setOwnerPNSName, this, _1, _2)); + LLAvatarNameCache::get(estate_info.getOwnerID(), boost::bind(&LLPanelEstateInfo::setOwnerName, this, boost::bind(&LLAvatarName::getNSName, _2, main_name_system()))); getChild("externally_visible_check")->setValue(estate_info.getIsExternallyVisible()); getChild("voice_chat_check")->setValue(estate_info.getAllowVoiceChat()); @@ -2425,13 +2425,6 @@ void LLPanelEstateInfo::setOwnerName(const std::string& name) getChild("estate_owner")->setValue(LLSD(name)); } -void LLPanelEstateInfo::setOwnerPNSName(const LLUUID& agent_id, const LLAvatarName& av_name) -{ - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - setOwnerName(name); -} - void LLPanelEstateInfo::clearAccessLists() { LLNameListCtrl* name_list = getChild("allowed_avatar_name_list"); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 128deaebe..beb6893e1 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -322,7 +322,6 @@ public: const std::string getOwnerName() const; void setOwnerName(const std::string& name); - void setOwnerPNSName(const LLUUID& agent_id, const LLAvatarName& av_name); protected: virtual BOOL sendUpdate(); diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp index 19cc09f55..08cef05d7 100644 --- a/indra/newview/llfloaterreporter.cpp +++ b/indra/newview/llfloaterreporter.cpp @@ -52,7 +52,6 @@ // viewer project includes #include "llagent.h" -#include "llagentui.h" #include "llbutton.h" #include "lltexturectrl.h" #include "llscrolllistctrl.h" @@ -80,14 +79,12 @@ #include "llviewernetwork.h" #include "llassetuploadresponders.h" +#include "llagentui.h" #include "lltrans.h" const U32 INCLUDE_SCREENSHOT = 0x01 << 0; -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy userReportResponder_timeout; - //----------------------------------------------------------------------------- // Globals //----------------------------------------------------------------------------- @@ -106,7 +103,8 @@ LLFloaterReporter::LLFloaterReporter() mPicking( FALSE), mPosition(), mCopyrightWarningSeen( FALSE ), - mResourceDatap(new LLResourceData()) + mResourceDatap(new LLResourceData()), + mAvatarNameCacheConnection() { LLUICtrlFactory::getInstance()->buildFloater(this, "floater_report_abuse.xml"); } @@ -174,6 +172,7 @@ BOOL LLFloaterReporter::postBuild() pick_btn->setImages(std::string("UIImgFaceUUID"), std::string("UIImgFaceSelectedUUID") ); childSetAction("pick_btn", onClickObjPicker, this); + childSetAction("select_abuser", boost::bind(&LLFloaterReporter::onClickSelectAbuser, this)); childSetAction("send_btn", onClickSend, this); @@ -190,6 +189,11 @@ BOOL LLFloaterReporter::postBuild() // virtual LLFloaterReporter::~LLFloaterReporter() { + if (mAvatarNameCacheConnection.connected()) + { + mAvatarNameCacheConnection.disconnect(); + } + // child views automatically deleted mObjectID = LLUUID::null; @@ -254,14 +258,6 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id) if (regionp) { getChild("sim_field")->setValue(regionp->getName()); -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) -/* - if ( (rlv_handler_t::isEnabled()) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ) - { - childSetText("sim_field", RlvStrings::getString(RLV_STRING_HIDDEN_REGION)); - } -*/ -// [/RLVa:KB] LLVector3d global_pos; global_pos.setVec(objectp->getPositionRegion()); setPosBox(global_pos); @@ -315,26 +311,25 @@ void LLFloaterReporter::callbackAvatarID(const uuid_vec_t& ids, const std::vecto void LLFloaterReporter::setFromAvatarID(const LLUUID& avatar_id) { mAbuserID = mObjectID = avatar_id; - std::string avatar_link; - if (LLAvatarNameCache::getPNSName(avatar_id, avatar_link)) + if (mAvatarNameCacheConnection.connected()) { - getChild("owner_name")->setValue(avatar_link); - getChild("object_name")->setValue(avatar_link); - getChild("abuser_name_edit")->setValue(avatar_link); - return; + mAvatarNameCacheConnection.disconnect(); } - - LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterReporter::onAvatarNameCache, this, _1, _2)); + mAvatarNameCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLFloaterReporter::onAvatarNameCache, this, _1, _2)); } void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name) { - std::string avatar_link; - LLAvatarNameCache::getPNSName(av_name, avatar_link); - getChild("owner_name")->setValue(avatar_link); - getChild("object_name")->setValue(avatar_link); - getChild("abuser_name_edit")->setValue(avatar_link); + mAvatarNameCacheConnection.disconnect(); + + if (mObjectID == avatar_id) + { + mOwnerName = av_name.getNSName(); + getChild("owner_name")->setValue(av_name.getNSName()); + getChild("object_name")->setValue(av_name.getNSName()); + getChild("abuser_name_edit")->setValue(av_name.getNSName()); + } } @@ -472,7 +467,6 @@ void LLFloaterReporter::showFromMenu(EReportType report_type) } } - // static void LLFloaterReporter::show(const LLUUID& object_id, const std::string& avatar_name) { @@ -598,6 +592,7 @@ LLSD LLFloaterReporter::gatherReport() const char* platform = "Lnx"; #elif LL_SOLARIS const char* platform = "Sol"; + const char* short_platform = "O:S"; #else const char* platform = "???"; #endif @@ -718,23 +713,24 @@ public: /*virtual*/ char const* getName(void) const { return "LLUserReportScreenshotResponder"; } }; -class LLUserReportResponder : public LLHTTPClient::ResponderWithResult +class LLUserReportResponder : public LLHTTPClient::ResponderWithCompleted { + LOG_CLASS(LLUserReportResponder); public: LLUserReportResponder() { } - /*virtual*/ void httpFailure(void) - { - // *TODO do some user messaging here - LLUploadDialog::modalUploadFinished(); - } - /*virtual*/ void httpSuccess(void) +private: + void httpCompleted() { + if (!isGoodStatus(mStatus)) + { + // *TODO do some user messaging here + LL_WARNS("UserReport") << dumpResponse() << LL_ENDL; + } // we don't care about what the server returns LLUploadDialog::modalUploadFinished(); } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return userReportResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLUserReportResponder"; } + char const* getName() const { return "LLUserReportResponder"; } }; void LLFloaterReporter::sendReportViaCaps(std::string url, std::string sshot_url, const LLSD& report) diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h index 1b10ed671..71f478e52 100644 --- a/indra/newview/llfloaterreporter.h +++ b/indra/newview/llfloaterreporter.h @@ -141,6 +141,7 @@ private: std::list mMCDList; std::string mDefaultSummary; LLResourceData* mResourceDatap; + boost::signals2::connection mAvatarNameCacheConnection; }; #endif diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp index 9451908c7..0da418021 100644 --- a/indra/newview/llfloaterscriptlimits.cpp +++ b/indra/newview/llfloaterscriptlimits.cpp @@ -184,27 +184,33 @@ void LLPanelScriptLimitsInfo::updateChild(LLUICtrl* child_ctr) // Responders ///---------------------------------------------------------------------------- -void fetchScriptLimitsRegionInfoResponder::httpSuccess(void) +void fetchScriptLimitsRegionInfoResponder::httpSuccess() { + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } //we don't need to test with a fake response here (shouldn't anyway) #ifdef DUMP_REPLIES_TO_LLINFOS - LLSDNotationStreamer notation_streamer(mContent); + LLSDNotationStreamer notation_streamer(content); std::ostringstream nice_llsd; nice_llsd << notation_streamer; OSMessageBox(nice_llsd.str(), "main cap response:", 0); - llinfos << "main cap response:" << mContent << llendl; + llinfos << "main cap response:" << content << LL_ENDL; #endif // at this point we have an llsd which should contain ether one or two urls to the services we want. // first we look for the details service: - if(mContent.has("ScriptResourceDetails")) + if(content.has("ScriptResourceDetails")) { - LLHTTPClient::get(mContent["ScriptResourceDetails"], new fetchScriptLimitsRegionDetailsResponder(mInfo)); + LLHTTPClient::get(content["ScriptResourceDetails"], new fetchScriptLimitsRegionDetailsResponder(mInfo)); } else { @@ -216,19 +222,20 @@ void fetchScriptLimitsRegionInfoResponder::httpSuccess(void) } // then the summary service: - if(mContent.has("ScriptResourceSummary")) + if(content.has("ScriptResourceSummary")) { - LLHTTPClient::get(mContent["ScriptResourceSummary"], new fetchScriptLimitsRegionSummaryResponder(mInfo)); + LLHTTPClient::get(content["ScriptResourceSummary"], new fetchScriptLimitsRegionSummaryResponder(mInfo)); } } -void fetchScriptLimitsRegionInfoResponder::httpFailure(void) +void fetchScriptLimitsRegionInfoResponder::httpFailure() { - llwarns << "fetchScriptLimitsRegionInfoResponder error [status:" << mStatus << "]: " << mReason << llendl; + llwarns << dumpResponse() << LL_ENDL; } -void fetchScriptLimitsRegionSummaryResponder::httpSuccess(void) +void fetchScriptLimitsRegionSummaryResponder::httpSuccess() { + const LLSD& content_ref = getContent(); #ifdef USE_FAKE_RESPONSES LLSD fake_content; @@ -265,10 +272,16 @@ void fetchScriptLimitsRegionSummaryResponder::httpSuccess(void) #else - const LLSD& content = mContent; + const LLSD& content = content_ref; #endif + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } + #ifdef DUMP_REPLIES_TO_LLINFOS @@ -309,13 +322,14 @@ void fetchScriptLimitsRegionSummaryResponder::httpSuccess(void) } } -void fetchScriptLimitsRegionSummaryResponder::httpFailure(void) +void fetchScriptLimitsRegionSummaryResponder::httpFailure() { - llwarns << "fetchScriptLimitsRegionSummaryResponder error [status:" << mStatus << "]: " << mReason << llendl; + llwarns << dumpResponse() << LL_ENDL; } -void fetchScriptLimitsRegionDetailsResponder::httpSuccess(void) +void fetchScriptLimitsRegionDetailsResponder::httpSuccess() { + const LLSD& content_ref = getContent(); #ifdef USE_FAKE_RESPONSES /* Updated detail service, ** denotes field added: @@ -374,10 +388,16 @@ result (map) #else - const LLSD& content = mContent; + const LLSD& content = content_ref; #endif + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } + #ifdef DUMP_REPLIES_TO_LLINFOS LLSDNotationStreamer notation_streamer(content); @@ -418,13 +438,14 @@ result (map) } } -void fetchScriptLimitsRegionDetailsResponder::httpFailure(void) +void fetchScriptLimitsRegionDetailsResponder::httpFailure() { - llwarns << "fetchScriptLimitsRegionDetailsResponder error [status:" << mStatus << "]: " << mReason << llendl; + llwarns << dumpResponse() << LL_ENDL; } -void fetchScriptLimitsAttachmentInfoResponder::httpSuccess(void) +void fetchScriptLimitsAttachmentInfoResponder::httpSuccess() { + const LLSD& content_ref = getContent(); #ifdef USE_FAKE_RESPONSES @@ -456,16 +477,22 @@ void fetchScriptLimitsAttachmentInfoResponder::httpSuccess(void) summary["used"] = used; fake_content["summary"] = summary; - fake_content["attachments"] = mContent["attachments"]; + fake_content["attachments"] = content_ref["attachments"]; const LLSD& content = fake_content; #else - const LLSD& content = mContent; + const LLSD& content = content_ref; #endif + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } + #ifdef DUMP_REPLIES_TO_LLINFOS LLSDNotationStreamer notation_streamer(content); @@ -514,9 +541,9 @@ void fetchScriptLimitsAttachmentInfoResponder::httpSuccess(void) } } -void fetchScriptLimitsAttachmentInfoResponder::httpFailure(void) +void fetchScriptLimitsAttachmentInfoResponder::httpFailure() { - llwarns << "fetchScriptLimitsAttachmentInfoResponder error [status:" << mStatus << "]: " << mReason << llendl; + llwarns << dumpResponse() << LL_ENDL; } ///---------------------------------------------------------------------------- @@ -604,7 +631,7 @@ void LLPanelScriptLimitsRegionMemory::onNameCache( } std::string name; - LLAvatarNameCache::getPNSName(id, name); + LLAvatarNameCache::getNSName(id, name); std::vector::iterator id_itor; for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor) @@ -706,7 +733,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) } else { - name_is_cached = LLAvatarNameCache::getPNSName(owner_id, owner_buf); // username + name_is_cached = LLAvatarNameCache::getNSName(owner_id, owner_buf); // username } if(!name_is_cached) { @@ -720,30 +747,39 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content) } } - LLSD item_params; - item_params["id"] = task_id; + LLScrollListItem::Params item_params; + item_params.value = task_id; - item_params["columns"][0]["column"] = "size"; - item_params["columns"][0]["value"] = size; + LLScrollListCell::Params cell_params; + //cell_params.font = LLFontGL::getFontSansSerif(); - item_params["columns"][1]["column"] = "urls"; - item_params["columns"][1]["value"] = urls; + cell_params.column = "size"; + cell_params.value = size; + item_params.columns.add(cell_params); - item_params["columns"][2]["column"] = "name"; - item_params["columns"][2]["value"] = name_buf; + cell_params.column = "urls"; + cell_params.value = urls; + item_params.columns.add(cell_params); - item_params["columns"][3]["column"] = "owner"; - item_params["columns"][3]["value"] = owner_buf; + cell_params.column = "name"; + cell_params.value = name_buf; + item_params.columns.add(cell_params); - item_params["columns"][4]["column"] = "parcel"; - item_params["columns"][4]["value"] = parcel_name; + cell_params.column = "owner"; + cell_params.value = owner_buf; + item_params.columns.add(cell_params); - item_params["columns"][5]["column"] = "location"; - item_params["columns"][5]["value"] = has_locations + cell_params.column = "parcel"; + cell_params.value = parcel_name; + item_params.columns.add(cell_params); + + cell_params.column = "location"; + cell_params.value = has_locations ? llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z) : ""; + item_params.columns.add(cell_params); - list->addElement(item_params); + list->addRow(item_params); LLSD element; element["owner_id"] = owner_id; @@ -878,13 +914,17 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() } LLParcel* parcel = instance->getCurrentSelectedParcel(); LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion(); - if (!parcel) //Pretend we have the parcel we're on selected. + + LLUUID current_region_id = gAgent.getRegion()->getRegionID(); + + // Fall back to the parcel we're on if none is selected. + // Fixes parcel script info intermittently working and broken in toolbar button. + if (!parcel) { parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); region = gAgent.getRegion(); } - - LLUUID current_region_id = gAgent.getRegion()->getRegionID(); + // if ((region) && (parcel)) { @@ -921,7 +961,7 @@ BOOL LLPanelScriptLimitsRegionMemory::StartRequestChain() { llwarns << "Can't get parcel info for script information request" << region_id << ". Region: " << region->getName() - << " does not support RemoteParcelRequest" << llendl; + << " does not support RemoteParcelRequest" << LL_ENDL; std::string msg_waiting = LLTrans::getString("ScriptLimitsRequestError"); getChild("loading_text")->setValue(LLSD(msg_waiting)); diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp index e621a2e40..7c60e75ac 100644 --- a/indra/newview/llfloatertools.cpp +++ b/indra/newview/llfloatertools.cpp @@ -545,7 +545,8 @@ void LLFloaterTools::refresh() // Added in Link Num value -HgB S32 prim_count = LLSelectMgr::getInstance()->getEditSelection()->getObjectCount(); std::string value_string; - if ((prim_count == 1) && gSavedSettings.getBOOL("EditLinkedParts")) //Selecting a single prim in "Edit Linked" mode, show link number + bool edit_linked(gSavedSettings.getBOOL("EditLinkedParts")); + if (edit_linked && prim_count == 1) //Selecting a single prim in "Edit Linked" mode, show link number { link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost(); childSetTextArg("link_num_obj_count", "[DESC]", std::string("Link number:")); @@ -573,6 +574,12 @@ void LLFloaterTools::refresh() } } } + else if (edit_linked) + { + childSetTextArg("link_num_obj_count", "[DESC]", std::string("Selected prims:")); + LLResMgr::getInstance()->getIntegerString(value_string, prim_count); + link_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectCost(); + } else { childSetTextArg("link_num_obj_count", "[DESC]", std::string("Selected objects:")); @@ -606,7 +613,7 @@ void LLFloaterTools::refresh() LLStringUtil::format_map_t selection_args; selection_args["OBJ_COUNT"] = llformat("%.1d", prim_count); - selection_args["LAND_IMPACT"] = llformat("%.1d", (S32)link_cost); + selection_args["LAND_IMPACT"] = llformat(edit_linked ? "%.2f" : "%.0f", link_cost); std::ostringstream selection_info; diff --git a/indra/newview/llfloaterwebcontent.cpp b/indra/newview/llfloaterwebcontent.cpp index a8f27731b..98485b755 100644 --- a/indra/newview/llfloaterwebcontent.cpp +++ b/indra/newview/llfloaterwebcontent.cpp @@ -149,8 +149,7 @@ void LLFloaterWebContent::showInstance(const std::string& window_class, Params& LLSD key = p; - instance_iter it = beginInstances(); - for(;it!=endInstances();++it) + for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it) { if(it->mKey["window_class"].asString() == window_class) { @@ -255,8 +254,7 @@ void LLFloaterWebContent::preCreate(LLFloaterWebContent::Params& p) std::vector instances; instances.reserve(instanceCount()); - instance_iter it = beginInstances(); - for(;it!=endInstances();++it) + for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end;++it) { if(it->mKey["window_class"].asString() == p.window_class.getValue()) instances.push_back(&*it); diff --git a/indra/newview/llfloaterwebprofile.cpp b/indra/newview/llfloaterwebprofile.cpp index c506c72fa..31037c20c 100644 --- a/indra/newview/llfloaterwebprofile.cpp +++ b/indra/newview/llfloaterwebprofile.cpp @@ -68,8 +68,7 @@ void LLFloaterWebProfile::showInstance(const std::string& window_class, Params& LLSD key = p; - instance_iter it = beginInstances(); - for(;it!=endInstances();++it) + for(instance_iter it(beginInstances()), it_end(endInstances()); it != it_end; ++it) { if(it->mKey["window_class"].asString() == window_class) { diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h index 62c7a67ec..3c942352d 100644 --- a/indra/newview/llfoldervieweventlistener.h +++ b/indra/newview/llfoldervieweventlistener.h @@ -57,7 +57,7 @@ public: virtual PermissionMask getPermissionMask() const = 0; virtual LLFolderType::EType getPreferredType() const = 0; virtual LLPointer getIcon() const = 0; - virtual LLPointer getOpenIcon() const { return getIcon(); } + virtual LLPointer getIconOpen() const { return getIcon(); } virtual LLFontGL::StyleFlags getLabelStyle() const = 0; virtual std::string getLabelSuffix() const = 0; virtual void openItem( void ) = 0; diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 1acafb160..524763f98 100644 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -537,7 +537,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, // Already recorded this change? Weird. llinfos << "Received duplicate change for " << " role: " << role_id << " member " << member_id - << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << llendl; + << " change " << (rmc == RMC_ADD ? "ADD" : "REMOVE") << LL_ENDL; } else { @@ -783,9 +783,12 @@ void LLGroupMgrGroupData::sendRoleChanges() break; } case RC_UPDATE_ALL: + // fall through case RC_UPDATE_POWERS: need_power_recalc = true; + // fall through case RC_UPDATE_DATA: + // fall through default: { LLGroupRoleData* group_role_data = (*role_it).second; @@ -1201,6 +1204,8 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) name = LLTrans::getString("group_role_owners"); } + + lldebugs << "Adding role data: " << name << " {" << role_id << "}" << llendl; LLGroupRoleData* rd = new LLGroupRoleData(role_id,name,title,desc,powers,member_count); group_datap->mRoles[role_id] = rd; @@ -1474,7 +1479,7 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data) } else { - // *TODO:translate + // *TODO: Translate LLSD args; args["MESSAGE"] = message; LLNotificationsUtil::add("UnableToCreateGroup", args); @@ -1617,6 +1622,7 @@ void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) } } + void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) { lldebugs << "LLGroupMgr::sendGroupRoleDataRequest" << llendl; @@ -1652,7 +1658,7 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) // *TODO: KLW FIXME: Should we start a member or role data request? llinfos << " Pending: " << (group_datap->mPendingRoleMemberRequest ? "Y" : "N") << " MemberDataComplete: " << (group_datap->mMemberDataComplete ? "Y" : "N") - << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << llendl; + << " RoleDataComplete: " << (group_datap->mRoleDataComplete ? "Y" : "N") << LL_ENDL; group_datap->mPendingRoleMemberRequest = TRUE; return; } @@ -1885,8 +1891,6 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, bool start_message = true; LLMessageSystem* msg = gMessageSystem; - - LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id); if (!group_datap) return; @@ -1952,10 +1956,6 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, } -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy groupBanDataResponder_timeout; -extern AIHTTPTimeoutPolicy groupMemberDataResponder_timeout; - // Responder class for capability group management class GroupBanDataResponder : public LLHTTPClient::ResponderWithResult { @@ -1964,8 +1964,7 @@ public: virtual ~GroupBanDataResponder() {} virtual void httpSuccess(); virtual void httpFailure(); - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupBanDataResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "GroupBanDataResponder"; } + virtual char const* getName() const { return "GroupBanDataResponder"; } private: LLUUID mGroupID; BOOL mForceRefresh; @@ -1984,18 +1983,14 @@ void GroupBanDataResponder::httpFailure() void GroupBanDataResponder::httpSuccess() { - if (mContent.size()) + if (mContent.has("ban_list")) { - if (mContent.has("ban_list")) - { - // group ban data received - LLGroupMgr::processGroupBanRequest(mContent); - mForceRefresh = false; - } + // group ban data received + LLGroupMgr::processGroupBanRequest(mContent); } - if (mForceRefresh) + else if (mForceRefresh) { - // no ban data received, refreshing data successful operation + // no ban data received, refreshing data after successful operation LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); } } @@ -2097,25 +2092,34 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) // Responder class for capability group management class GroupMemberDataResponder : public LLHTTPClient::ResponderWithResult { + LOG_CLASS(GroupMemberDataResponder); public: GroupMemberDataResponder() {} virtual ~GroupMemberDataResponder() {} - /*virtual*/ void httpSuccess(void); - /*virtual*/ void httpFailure(void); - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return groupMemberDataResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "GroupMemberDataResponder"; } + private: + /* virtual */ void httpSuccess(); + /* virtual */ void httpFailure(); + /* virtual */ char const* getName() const { return "GroupMemberDataResponder"; } + LLSD mMemberData; }; -void GroupMemberDataResponder::httpFailure(void) +void GroupMemberDataResponder::httpFailure() { - LL_WARNS("GrpMgr") << "Error receiving group member data." << LL_ENDL; + LL_WARNS("GrpMgr") << "Error receiving group member data " + << dumpResponse() << LL_ENDL; } -void GroupMemberDataResponder::httpSuccess(void) +void GroupMemberDataResponder::httpSuccess() { - LLGroupMgr::processCapGroupMembersRequest(mContent); + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } + LLGroupMgr::processCapGroupMembersRequest(content); } @@ -2164,6 +2168,7 @@ void LLGroupMgr::sendCapGroupMembersRequest(const LLUUID& group_id) mLastGroupMembersRequestFrame = gFrameCount; } + // static void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) { @@ -2274,10 +2279,12 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) // I'm going to be dumb and just call services I most likely don't need // with the thought being that the system might need it to be done. // - // TODO: Refactor to reduce multiple calls for data we already have. + // TODO: + // Refactor to reduce multiple calls for data we already have. if (group_datap->mTitles.size() < 1) LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id); + group_datap->mMemberDataComplete = true; group_datap->mMemberRequestID.setNull(); // Make the role-member data request @@ -2289,8 +2296,10 @@ void LLGroupMgr::processCapGroupMembersRequest(const LLSD& content) group_datap->mChanged = TRUE; LLGroupMgr::getInstance()->notifyObservers(GC_MEMBER_DATA); + } + void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) { lldebugs << "LLGroupMgr::sendGroupRoleChanges" << llendl; diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index bf40bbcaa..20c637112 100644 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -49,6 +49,8 @@ enum LLGroupChange GC_ALL }; +const U32 GB_MAX_BANNED_AGENTS = 500; + class LLGroupMgrObserver { public: @@ -262,7 +264,7 @@ public: const LLUUID& getMemberVersion() const { return mMemberVersion; } void clearBanList() { mBanList.clear(); } - void getBanList(const LLUUID& ban_i, const LLGroupBanData& ban_data = LLGroupBanData()); + void getBanList(const LLUUID& group_id, LLGroupBanData& ban_data); const LLGroupBanData& getBanEntry(const LLUUID& ban_id) { return mBanList[ban_id]; } void createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data = LLGroupBanData()); diff --git a/indra/newview/llhoverview.cpp b/indra/newview/llhoverview.cpp index e35848d78..1e8ecbcc3 100644 --- a/indra/newview/llhoverview.cpp +++ b/indra/newview/llhoverview.cpp @@ -285,7 +285,7 @@ void LLHoverView::updateText() { // [/RLVa:KB] std::string complete_name; - if (!LLAvatarNameCache::getPNSName(hit_object->getID(), complete_name)) + if (!LLAvatarNameCache::getNSName(hit_object->getID(), complete_name)) complete_name = firstname->getString() + std::string(" ") + lastname->getString(); if (title) @@ -408,7 +408,7 @@ void LLHoverView::updateText() { line.append(LLTrans::getString("TooltipPublic")); } - else if(LLAvatarNameCache::getPNSName(owner, name)) + else if (LLAvatarNameCache::getNSName(owner, name)) { // [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index d653c8283..3efb9299a 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -550,7 +550,7 @@ void LLHUDEffectLookAt::render() static const LLCachedControl lookAtNames("LookAtNameSystem"); if (lookAtNames < 0) return; std::string text; - if (!LLAvatarNameCache::getPNSName(static_cast(mSourceObject.get())->getID(), text, lookAtNames)) return; + if (!LLAvatarNameCache::getNSName(static_cast(mSourceObject.get())->getID(), text, lookAtNames)) return; if (text.length() > 9 && 0 == text.compare(text.length() - 9, 9, " Resident")) text.erase(text.length() - 9); LLVector3 offset = gAgentCamera.getCameraPositionAgent() - target; diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index ccc13b61c..802fc7608 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -69,7 +69,6 @@ // [/RLVa:KB] class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy startConferenceChatResponder_timeout; extern AIHTTPTimeoutPolicy sessionInviteResponder_timeout; // @@ -172,7 +171,7 @@ public: mAgents = agents_to_invite; } - /*virtual*/ void httpFailure(void) + /*virtual*/ void httpFailure() { //try an "old school" way. if ( mStatus == 400 ) @@ -191,9 +190,7 @@ public: //and it is not worth the effort switching over all //the possible different language translations } - - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return startConferenceChatResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLStartConferenceChatResponder"; } + /*virtual*/ char const* getName() const { return "LLStartConferenceChatResponder"; } private: LLUUID mTempSessionID; @@ -347,6 +344,7 @@ LLFloaterIMPanel::LLFloaterIMPanel( case IM_SESSION_P2P_INVITE: mVoiceChannel = new LLVoiceChannelP2P(mSessionUUID, mLogLabel, mOtherParticipantUUID); LLAvatarTracker::instance().addParticularFriendObserver(mOtherParticipantUUID, this); + LLMuteList::instance().addObserver(this); mDing = gSavedSettings.getBOOL("LiruNewMessageSoundIMsOn"); break; default: @@ -401,11 +399,9 @@ LLFloaterIMPanel::LLFloaterIMPanel( void LLFloaterIMPanel::onAvatarNameLookup(const LLAvatarName& avatar_name) { - std::string title; - LLAvatarNameCache::getPNSName(avatar_name, title); - setTitle(title); + setTitle(avatar_name.getNSName()); const S32& ns(gSavedSettings.getS32("IMNameSystem")); - LLAvatarNameCache::getPNSName(avatar_name, title, ns); + std::string title(avatar_name.getNSName(ns)); if (!ns || ns == 3) // Remove Resident, if applicable. { size_t pos(title.find(" Resident")); @@ -420,6 +416,7 @@ void LLFloaterIMPanel::onAvatarNameLookup(const LLAvatarName& avatar_name) LLFloaterIMPanel::~LLFloaterIMPanel() { LLAvatarTracker::instance().removeParticularFriendObserver(mOtherParticipantUUID, this); + LLMuteList::instance().removeObserver(this); delete mSpeakers; mSpeakers = NULL; @@ -465,6 +462,13 @@ void LLFloaterIMPanel::changed(U32 mask) */ } +// virtual +void LLFloaterIMPanel::onChangeDetailed(const LLMute& mute) +{ + if (mute.mID == mOtherParticipantUUID) + rebuildDynamics(getChild("instant_message_flyout")); +} + // virtual BOOL LLFloaterIMPanel::postBuild() { @@ -640,20 +644,14 @@ void LLFloaterIMPanel::draw() class LLSessionInviteResponder : public LLHTTPClient::ResponderIgnoreBody { public: - LLSessionInviteResponder(const LLUUID& session_id) - { - mSessionID = session_id; - } + LLSessionInviteResponder(const LLUUID& session_id) : mSessionID(session_id) {} - /*virtual*/ void httpFailure(void) + /*virtual*/ void httpFailure() { - llwarns << "Error inviting all agents to session [status:" - << mStatus << "]: " << mReason << llendl; + llwarns << "Error inviting all agents to session [status:" << mStatus << "]: " << mReason << llendl; //throw something back to the viewer here? } - - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return sessionInviteResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLSessionInviteResponder"; } + /*virtual*/ char const* getName() const { return "LLSessionInviteResponder"; } private: LLUUID mSessionID; @@ -705,38 +703,38 @@ bool LLFloaterIMPanel::inviteToSession(const LLDynamicArray& ids) void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incolor, bool log_to_file, const LLUUID& source, const std::string& name) { - static const LLCachedControl mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false); - static const LLCachedControl mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f)); - - if (gAgentID != source) + bool is_agent(gAgentID == source), from_user(source.notNull()); + if (!is_agent) { + static const LLCachedControl mKeywordsChangeColor(gSavedPerAccountSettings, "KeywordsChangeColor", false); if (mKeywordsChangeColor) { if (AscentKeyword::hasKeyword(utf8msg, 2)) { + static const LLCachedControl mKeywordsColor(gSavedPerAccountSettings, "KeywordsColor", LLColor4(1.f, 1.f, 1.f, 1.f)); incolor = mKeywordsColor; } } - if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus())) + bool focused(hasFocus()); + if (mDing && (!focused || !gFocusMgr.getAppHasFocus())) { static const LLCachedControl ding("LiruNewMessageSound"); static const LLCachedControl dong("LiruNewMessageSoundForSystemMessages"); - LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong)); + LLUI::sAudioCallback(LLUUID(from_user ? ding : dong)); } - } - const LLColor4& color = incolor; - // start tab flashing when receiving im for background session from user - if (source.notNull()) - { - LLMultiFloater* hostp = getHost(); - if( !isInVisibleChain() - && hostp - && source != gAgentID) + // start tab flashing when receiving im for background session from user + if (from_user) { - hostp->setFloaterFlashing(this, TRUE); + bool invisible(!isInVisibleChain()); + LLMultiFloater* host = getHost(); + if (invisible && host) + host->setFloaterFlashing(this, true); + if (invisible || (!host && focused)) + ++mNumUnreadMessages; } + } // Now we're adding the actual line of text, so erase the @@ -760,15 +758,15 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if (name == SYSTEM_FROM) { - mHistoryEditor->appendColoredText(name,false,prepend_newline,color); + mHistoryEditor->appendColoredText(name,false,prepend_newline,incolor); } else { // IRC style text starts with a colon here; empty names and system messages aren't irc style. static const LLCachedControl italicize("LiruItalicizeActions"); is_irc = italicize && utf8msg[0] != ':'; - if (source.notNull()) - LLAvatarNameCache::getPNSName(source, show_name); + if (from_user) + LLAvatarNameCache::getNSName(source, show_name); // Convert the name to a hotlink and add to message. LLStyleSP source_style = LLStyleMap::instance().lookupAgent(source); source_style->mItalic = is_irc; @@ -780,9 +778,9 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol // Append the chat message in style { LLStyleSP style(new LLStyle); - style->setColor(color); + style->setColor(incolor); style->mItalic = is_irc; - style->mBold = gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source); + style->mBold = from_user && gSavedSettings.getBOOL("SingularityBoldGroupModerator") && isModerator(source); mHistoryEditor->appendStyledText(utf8msg, false, prepend_newline, style); } @@ -803,13 +801,8 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol // [/Ansariel: Display name support] } - if (source.notNull()) + if (from_user) { - if (!isInVisibleChain() || (!hasFocus() && getParent() == gFloaterView)) - { - mNumUnreadMessages++; - } - mSpeakers->speakerChatted(source); mSpeakers->setSpeakerTyping(source, FALSE); } @@ -962,7 +955,7 @@ void LLFloaterIMPanel::removeDynamics(LLComboBox* flyout) flyout->remove(mDing ? getString("ding on") : getString("ding off")); flyout->remove(mRPMode ? getString("rp mode on") : getString("rp mode off")); flyout->remove(LLAvatarActions::isFriend(mOtherParticipantUUID) ? getString("remove friend") : getString("add friend")); - //flyout->remove(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute")); + flyout->remove(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute")); } void LLFloaterIMPanel::addDynamics(LLComboBox* flyout) @@ -970,7 +963,7 @@ void LLFloaterIMPanel::addDynamics(LLComboBox* flyout) flyout->add(mDing ? getString("ding on") : getString("ding off"), 6); flyout->add(mRPMode ? getString("rp mode on") : getString("rp mode off"), 7); flyout->add(LLAvatarActions::isFriend(mOtherParticipantUUID) ? getString("remove friend") : getString("add friend"), 8); - //flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9); + flyout->add(LLAvatarActions::isBlocked(mOtherParticipantUUID) ? getString("unmute") : getString("mute"), 9); } void copy_profile_uri(const LLUUID& id, bool group = false); @@ -999,7 +992,7 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) if (option == 6) mDing = !mDing; else if (option == 7) mRPMode = !mRPMode; else if (option == 8) LLAvatarActions::isFriend(mOtherParticipantUUID) ? LLAvatarActions::removeFriendDialog(mOtherParticipantUUID) : LLAvatarActions::requestFriendshipDialog(mOtherParticipantUUID); - //else if (option == 9) LLAvatarActions::toggleBlock(mOtherParticipantUUID); + else if (option == 9) LLAvatarActions::toggleBlock(mOtherParticipantUUID); // Last add them back addDynamics(flyout); @@ -1008,15 +1001,19 @@ void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) void show_log_browser(const std::string& name, const std::string& id) { -#if LL_WINDOWS || LL_DARWIN // Singu TODO: Linux? + const std::string file(LLLogChat::makeLogFileName(name)); if (gSavedSettings.getBOOL("LiruLegacyLogLaunch")) { - gViewerWindow->getWindow()->ShellEx(LLLogChat::makeLogFileName(name)); +#if LL_WINDOWS || LL_DARWIN + gViewerWindow->getWindow()->ShellEx(file); +#elif LL_LINUX + // xdg-open might not actually be installed on all distros, but it's our best bet. + if (!std::system(("/usr/bin/xdg-open \"" + file +'"').c_str())) // 0 = success, otherwise fallback on internal browser. +#endif return; } -#endif LLFloaterWebContent::Params p; - p.url("file:///" + LLLogChat::makeLogFileName(name)); + p.url("file:///" + file); p.id(id); p.show_chrome(false); p.trusted_content(true); @@ -1434,7 +1431,7 @@ void LLFloaterIMPanel::processIMTyping(const LLIMInfo* im_info, bool typing) { // other user started typing std::string name; - if (!LLAvatarNameCache::getPNSName(im_info->mFromID, name)) name = im_info->mName; + if (!LLAvatarNameCache::getNSName(im_info->mFromID, name)) name = im_info->mName; addTypingIndicator(name); } else diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index bee650d7b..83bfcd815 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -35,6 +35,7 @@ #include "llcallingcard.h" #include "llfloater.h" #include "lllogchat.h" +#include "llmutelist.h" class LLAvatarName; class LLIMSpeakerMgr; @@ -46,7 +47,7 @@ class LLParticipantList; class LLViewerTextEditor; class LLVoiceChannel; -class LLFloaterIMPanel : public LLFloater, public LLFriendObserver +class LLFloaterIMPanel : public LLFloater, public LLFriendObserver, public LLMuteListObserver { public: @@ -65,6 +66,8 @@ public: void onAvatarNameLookup(const LLAvatarName& avatar_name); /*virtual*/ void changed(U32 mask); // From LLFriendObserver, check friend status + /*virtual*/ void onChange() {} + /*virtual*/ void onChangeDetailed(const LLMute& mute); // From LLMuteListObserver, check for mute status changes for OtherParticipant /*virtual*/ BOOL postBuild(); // Check typing timeout timer. diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ac24627c5..31b562e31 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -480,7 +480,13 @@ void LLIMMgr::addMessage( } // now add message to floater - const LLColor4& color = agent_chat_color(other_participant_id, from, false); + LLColor4 color = agent_chat_color(other_participant_id, from, false); + if (dialog == IM_BUSY_AUTO_RESPONSE) + { + color *= .75f; + color += LLColor4::transparent*.25f; + } + if ( !link_name ) { floater->addHistoryLine(msg,color); // No name to prepend, so just add the message normally @@ -1091,7 +1097,7 @@ void LLIMMgr::noteOfflineUsers( std::string full_name; if (info && !info->isOnline() - && LLAvatarNameCache::getPNSName(ids.get(i), full_name)) + && LLAvatarNameCache::getNSName(ids.get(i), full_name)) { LLUIString offline = LLTrans::getString("offline_message"); offline.setArg("[NAME]", full_name); diff --git a/indra/newview/llinventoryactions.cpp b/indra/newview/llinventoryactions.cpp index 20fe180d7..999a542a5 100644 --- a/indra/newview/llinventoryactions.cpp +++ b/indra/newview/llinventoryactions.cpp @@ -60,11 +60,16 @@ extern LLUUID gAgentID; using namespace LLOldEvents; +namespace LLInventoryAction +{ + bool doToSelected(LLFolderView* folder, std::string action); +} + typedef LLMemberListener object_inventory_listener_t; typedef LLMemberListener inventory_listener_t; typedef LLMemberListener inventory_panel_listener_t; -bool doToSelected(LLFolderView* folder, std::string action) +bool LLInventoryAction::doToSelected(LLFolderView* folder, std::string action) { LLInventoryModel* model = &gInventory; if ("rename" == action) @@ -136,7 +141,7 @@ class LLDoToSelectedPanel : public object_inventory_listener_t LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, userdata.asString()); + return LLInventoryAction::doToSelected(folder, userdata.asString()); } }; @@ -148,7 +153,7 @@ class LLDoToSelectedFloater : public inventory_listener_t LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, userdata.asString()); + return LLInventoryAction::doToSelected(folder, userdata.asString()); } }; @@ -160,7 +165,7 @@ class LLDoToSelected : public inventory_panel_listener_t LLFolderView* folder = panel->getRootFolder(); if(!folder) return true; - return doToSelected(folder, userdata.asString()); + return LLInventoryAction::doToSelected(folder, userdata.asString()); } }; diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 368bb3284..a5ababe30 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -3008,7 +3008,7 @@ LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type) return LLUI::getUIImage(LLViewerFolderType::lookupIconName(preferred_type, FALSE)); } -LLUIImagePtr LLFolderBridge::getOpenIcon() const +LLUIImagePtr LLFolderBridge::getIconOpen() const { return LLUI::getUIImage(LLViewerFolderType::lookupIconName(getPreferredType(), TRUE)); diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index d5d604cd8..3329f14f9 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -255,7 +255,7 @@ public: virtual LLFolderType::EType getPreferredType() const; virtual LLUIImagePtr getIcon() const; - virtual LLUIImagePtr getOpenIcon() const; + virtual LLUIImagePtr getIconOpen() const; static LLUIImagePtr getIcon(LLFolderType::EType preferred_type); virtual BOOL renameItem(const std::string& new_name); diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 9adffa9ef..aa74c4f1a 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -705,7 +705,7 @@ LLFolderViewFolder * LLInventoryPanel::createFolderViewFolder(LLInvFVBridge * br return new LLFolderViewFolder( bridge->getDisplayName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), LLUI::getUIImage("inv_link_overlay.tga"), mFolderRoot.get(), bridge); @@ -716,7 +716,7 @@ LLFolderViewItem * LLInventoryPanel::createFolderViewItem(LLInvFVBridge * bridge return new LLFolderViewItem( bridge->getDisplayName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), LLUI::getUIImage("inv_link_overlay.tga"), bridge->getCreationDate(), mFolderRoot.get(), diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index 3fc5a166e..0870e3c48 100644 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -120,9 +120,6 @@ LLSD getMarketplaceStringSubstitutions() return marketplace_sub_map; } -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy MPImportGetResponder_timeout; -extern AIHTTPTimeoutPolicy MPImportPostResponder_timeout; namespace LLMarketplaceImport { @@ -194,7 +191,6 @@ namespace LLMarketplaceImport sImportId = mContent; } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportPostResponder_timeout; } /*virtual*/ char const* getName(void) const { return "LLImportPostResponder"; } }; @@ -254,7 +250,6 @@ namespace LLMarketplaceImport sImportResults = mContent; } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return MPImportGetResponder_timeout; } /*virtual*/ char const* getName(void) const { return "LLImportGetResponder"; } }; diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp index 80ed404d3..e4bbcec50 100644 --- a/indra/newview/llmediactrl.cpp +++ b/indra/newview/llmediactrl.cpp @@ -565,9 +565,12 @@ void LLMediaCtrl::navigateTo( std::string url_in, std::string mime_type) if (ensureMediaSourceExists()) { - mCurrentNavUrl = url_in; - mMediaSource->setSize(mTextureWidth, mTextureHeight); - mMediaSource->navigateTo(url_in, mime_type, mime_type.empty()); + if (mCurrentNavUrl != url_in) + { + mCurrentNavUrl = url_in; + mMediaSource->setSize(mTextureWidth, mTextureHeight); + mMediaSource->navigateTo(url_in, mime_type, mime_type.empty()); + } } } @@ -970,6 +973,7 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event) case MEDIA_EVENT_LOCATION_CHANGED: { LL_DEBUGS("Media") << "Media event: MEDIA_EVENT_LOCATION_CHANGED, new uri is: " << self->getLocation() << LL_ENDL; + mCurrentNavUrl = self->getLocation(); }; break; diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp index 6183c6942..fdd533257 100644 --- a/indra/newview/llmenucommands.cpp +++ b/indra/newview/llmenucommands.cpp @@ -116,12 +116,6 @@ // [/RLVa:LF] #include "shfloatermediaticker.h" -void handle_chat() -{ - // give focus to chatbar if it's open but not focused - static const LLCachedControl chat_visible("ChatVisible",true); - (chat_visible && gFocusMgr.childHasKeyboardFocus(gChatBar)) ? LLChatBar::stopChat() : LLChatBar::startChat(NULL); -} void handle_debug_avatar_textures(void*); template void handle_singleton_toggle(void*); void show_outfit_dialog() { new LLMakeOutfitDialog(false); } @@ -177,12 +171,10 @@ struct MenuFloaterDict : public LLSingleton registerFloater("build", boost::bind(toggle_build)); registerFloater("buy currency", boost::bind(LLFloaterBuyCurrency::buyCurrency)); registerFloater("buy land", boost::bind(&LLViewerParcelMgr::startBuyLand, boost::bind(LLViewerParcelMgr::getInstance), false)); - registerFloater("chatbar", boost::bind(handle_chat)); registerFloater("complaint reporter", boost::bind(LLFloaterReporter::showFromMenu, COMPLAINT_REPORT)); registerFloater("DayCycle", boost::bind(LLFloaterDayCycle::show), boost::bind(LLFloaterDayCycle::isOpen)); registerFloater("debug avatar", boost::bind(handle_debug_avatar_textures, (void*)NULL)); registerFloater("debug settings", boost::bind(handle_singleton_toggle, (void*)NULL)); - registerFloater("displayname", boost::bind(LLFloaterDisplayName::show)); registerFloater("edit ui", boost::bind(LLFloaterEditUI::show, (void*)NULL)); registerFloater("EnvSettings", boost::bind(LLFloaterEnvSettings::show), boost::bind(LLFloaterEnvSettings::isOpen)); registerFloater("fly", boost::bind(LLAgent::toggleFlying)); @@ -229,6 +221,7 @@ struct MenuFloaterDict : public LLSingleton registerFloater ("chat history"); registerFloater ("communicate"); registerFloater ("destinations"); + registerFloater ("displayname"); registerFloater ("friends", 0); registerFloater ("gestures"); registerFloater ("groups", 1); diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index 723a9cc94..20386623b 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -50,6 +50,8 @@ #include "llmutelist.h" +#include "pipeline.h" + #include #include "lldispatcher.h" @@ -62,9 +64,8 @@ #include "llimpanel.h" #include "llimview.h" #include "llnotifications.h" -#include "lluistring.h" -#include "llviewerobject.h" #include "llviewerobjectlist.h" +#include "lltrans.h" namespace { @@ -105,12 +106,6 @@ static LLDispatchEmptyMuteList sDispatchEmptyMuteList; //----------------------------------------------------------------------------- // LLMute() //----------------------------------------------------------------------------- -const char BY_NAME_SUFFIX[] = " (by name)"; -const char AGENT_SUFFIX[] = " (resident)"; -const char OBJECT_SUFFIX[] = " (object)"; -const char GROUP_SUFFIX[] = " (group)"; -const char EXTERNAL_SUFFIX[] = " (avaline)"; - LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) : mID(id), @@ -136,79 +131,29 @@ LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags) } -std::string LLMute::getDisplayName() const +std::string LLMute::getDisplayType() const { - std::string name_with_suffix = mName; switch (mType) { case BY_NAME: default: - name_with_suffix += BY_NAME_SUFFIX; + return LLTrans::getString("MuteByName"); break; case AGENT: - name_with_suffix += AGENT_SUFFIX; + return LLTrans::getString("MuteAgent"); break; case OBJECT: - name_with_suffix += OBJECT_SUFFIX; + return LLTrans::getString("MuteObject"); break; case GROUP: - name_with_suffix += GROUP_SUFFIX; + return LLTrans::getString("MuteGroup"); break; case EXTERNAL: - name_with_suffix += EXTERNAL_SUFFIX; + return LLTrans::getString("MuteExternal"); break; } - return name_with_suffix; } -void LLMute::setFromDisplayName(const std::string& display_name) -{ - size_t pos = 0; - mName = display_name; - - pos = mName.rfind(GROUP_SUFFIX); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = GROUP; - return; - } - - pos = mName.rfind(OBJECT_SUFFIX); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = OBJECT; - return; - } - - pos = mName.rfind(AGENT_SUFFIX); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = AGENT; - return; - } - - pos = mName.rfind(BY_NAME_SUFFIX); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = BY_NAME; - return; - } - - pos = mName.rfind(EXTERNAL_SUFFIX); - if (pos != std::string::npos) - { - mName.erase(pos); - mType = EXTERNAL; - return; - } - - llwarns << "Unable to set mute from display name " << display_name << llendl; - return; -} /* static */ LLMuteList* LLMuteList::getInstance() @@ -232,9 +177,6 @@ LLMuteList::LLMuteList() : mIsLoaded(FALSE) { gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); - - checkNewRegion(); - gAgent.addRegionChangedCallback(boost::bind(&LLMuteList::checkNewRegion, this)); } //----------------------------------------------------------------------------- @@ -327,6 +269,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) llinfos << "Muting by name " << mute.mName << llendl; updateAdd(mute); notifyObservers(); + notifyObserversDetailed(mute); return TRUE; } else @@ -375,6 +318,7 @@ BOOL LLMuteList::add(const LLMute& mute, U32 flags) llinfos << "Muting " << localmute.mName << " id " << localmute.mID << " flags " << localmute.mFlags << llendl; updateAdd(localmute); notifyObservers(); + notifyObserversDetailed(localmute); if(!(localmute.mFlags & LLMute::flagParticles)) { //Kill all particle systems owned by muted task @@ -472,19 +416,23 @@ BOOL LLMuteList::remove(const LLMute& mute, U32 flags) } // Must be after erase. + notifyObserversDetailed(localmute); setLoaded(); // why is this here? -MG } - - // Clean up any legacy mutes - string_set_t::iterator legacy_it = mLegacyMutes.find(mute.mName); - if (legacy_it != mLegacyMutes.end()) + else { - // Database representation of legacy mute is UUID null. - LLMute mute(LLUUID::null, *legacy_it, LLMute::BY_NAME); - updateRemove(mute); - mLegacyMutes.erase(legacy_it); - // Must be after erase. - setLoaded(); // why is this here? -MG + // Clean up any legacy mutes + string_set_t::iterator legacy_it = mLegacyMutes.find(mute.mName); + if (legacy_it != mLegacyMutes.end()) + { + // Database representation of legacy mute is UUID null. + LLMute mute(LLUUID::null, *legacy_it, LLMute::BY_NAME); + updateRemove(mute); + mLegacyMutes.erase(legacy_it); + // Must be after erase. + notifyObserversDetailed(mute); + setLoaded(); // why is this here? -MG + } } return found; @@ -537,15 +485,13 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& full_na if (reason == LLMuteList::AR_IM) { - LLFloaterIMPanel *timp = gIMMgr->findFloaterBySession(agent_id); - if (timp) + if (LLFloaterIMPanel* timp = gIMMgr->findFloaterBySession(agent_id)) { timp->addHistoryLine(message); } } - LLChat auto_chat(message); - LLFloaterChat::addChat(auto_chat, FALSE, FALSE); + LLFloaterChat::addChat(message, FALSE, FALSE); } } @@ -701,14 +647,10 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c LLViewerObject* mute_object = get_object_to_mute_from_id(id); LLUUID id_to_check = (mute_object) ? mute_object->getID() : id; + if (id_to_check == gAgentID) return false; // Can't mute self. + // don't need name or type for lookup LLMute mute(id_to_check); - // Can't mute self. - if (mute.mID == gAgent.getID() && !mute_object) - { - getInstance()->remove(mute); - return false; - } mute_set_t::const_iterator mute_it = mMutes.find(mute); if (mute_it != mMutes.end()) { @@ -721,7 +663,8 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c } // empty names can't be legacy-muted - if (name.empty()) return FALSE; + bool avatar = mute_object && mute_object->isAvatar(); + if (name.empty() || avatar) return FALSE; // Look in legacy pile string_set_t::const_iterator legacy_it = mLegacyMutes.find(name); @@ -849,52 +792,15 @@ void LLMuteList::notifyObservers() } } -void LLMuteList::checkNewRegion() +void LLMuteList::notifyObserversDetailed(const LLMute& mute) { - LLViewerRegion* regionp = gAgent.getRegion(); - if (!regionp) return; - - if (regionp->getFeaturesReceived()) + for (observer_set_t::iterator it = mObservers.begin(); + it != mObservers.end(); + ) { - parseSimulatorFeatures(); - } - else - { - regionp->setFeaturesReceivedCallback(boost::bind(&LLMuteList::parseSimulatorFeatures, this)); - } -} - -void LLMuteList::parseSimulatorFeatures() -{ - LLViewerRegion* regionp = gAgent.getRegion(); - if (!regionp) return; - - LLSD info; - regionp->getSimulatorFeatures(info); - - mGodLastNames.clear(); - mGodFullNames.clear(); - - if (info.has("god_names")) - { - if (info["god_names"].has("last_names")) - { - LLSD godNames = info["god_names"]["last_names"]; - - for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it) - mGodLastNames.insert((*godNames_it).asString()); - } - - if (info["god_names"].has("full_names")) - { - LLSD godNames = info["god_names"]["full_names"]; - - for (LLSD::array_iterator godNames_it = godNames.beginArray(); godNames_it != godNames.endArray(); ++godNames_it) - mGodFullNames.insert((*godNames_it).asString()); - } - } - else // Just use Linden - { - mGodLastNames.insert("Linden"); + LLMuteListObserver* observer = *it; + observer->onChangeDetailed(mute); + // In case onChange() deleted an entry. + it = mObservers.upper_bound(observer); } } diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index cbf78e25a..da8620eac 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -64,18 +64,12 @@ public: LLMute(const LLUUID& id, const std::string& name = std::string(), EType type = BY_NAME, U32 flags = 0); - // Returns name + suffix based on type - // For example: "James Tester (resident)" - std::string getDisplayName() const; - - // Converts a UI name into just the agent or object name - // For example: "James Tester (resident)" sets the name to "James Tester" - // and the type to AGENT. - void setFromDisplayName(const std::string& display_name); + // Returns localized type name of muted item + std::string getDisplayType() const; public: LLUUID mID; // agent or object id - std::string mName; // agent or object name + std::string mName; // agent or object name, does not store last name "Resident" EType mType; // needed for UI display of existing mutes U32 mFlags; // flags pertaining to this mute entry }; @@ -119,6 +113,9 @@ public: BOOL isLinden(const std::string& name) const; bool isLinden(const LLUUID& id) const; + // Quick way to check if LLMute is in the set + bool hasMute(const LLMute& mute) const { return mMutes.find(mute) != mMutes.end(); } + BOOL isLoaded() const { return mIsLoaded; } std::vector getMutes() const; @@ -135,6 +132,7 @@ private: void setLoaded(); void notifyObservers(); + void notifyObserversDetailed(const LLMute &mute); void updateAdd(const LLMute& mute); void updateRemove(const LLMute& mute); @@ -145,9 +143,6 @@ private: static void onFileMuteList(void** user_data, S32 code, LLExtStat ext_status); - void checkNewRegion(); - void parseSimulatorFeatures(); - private: struct compare_by_name { @@ -182,6 +177,7 @@ private: friend class LLDispatchEmptyMuteList; + friend class LFSimFeatureHandler; std::set mGodLastNames; std::set mGodFullNames; }; @@ -191,6 +187,7 @@ class LLMuteListObserver public: virtual ~LLMuteListObserver() { } virtual void onChange() = 0; + virtual void onChangeDetailed(const LLMute& ) { } }; diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp index 2e34271a1..6536ed2c8 100644 --- a/indra/newview/llnamelistctrl.cpp +++ b/indra/newview/llnamelistctrl.cpp @@ -189,7 +189,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow( } else if (LLAvatarNameCache::get(id, &av_name)) { - LLAvatarNameCache::getPNSName(av_name, fullname, mNameSystem); + fullname = av_name.getNSName(mNameSystem); } else { @@ -287,7 +287,7 @@ void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id, } std::string name; - LLAvatarNameCache::getPNSName(av_name, name, mNameSystem); + name = av_name.getNSName(mNameSystem); // Append optional suffix. if (!suffix.empty()) diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index 93b204759..84b491949 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -329,14 +329,15 @@ void LLNetMap::draw() F32 relative_x = (rel_region_pos.mV[0] / region_width) * mScale; F32 relative_y = (rel_region_pos.mV[1] / region_width) * mScale; + const F32 real_width(regionp->getWidth()); // Background region rectangle. F32 bottom = relative_y; F32 left = relative_x; // Aurora Sim //F32 top = bottom + mScale ; //F32 right = left + mScale ; - F32 top = bottom + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; - F32 right = left + (regionp->getWidth() / REGION_WIDTH_METERS) * mScale ; + F32 top = bottom + (real_width / REGION_WIDTH_METERS) * mScale ; + F32 right = left + (real_width / REGION_WIDTH_METERS) * mScale ; // Aurora Sim if (regionp == region) gGL.color4fv(this_region_color().mV); @@ -349,23 +350,34 @@ void LLNetMap::draw() if (s_fUseWorldMapTextures) { - LLViewerTexture* pRegionImage = regionp->getWorldMapTile(); - if ( (pRegionImage) && (pRegionImage->hasGLTexture()) ) - { - gGL.getTexUnit(0)->bind(pRegionImage); - gGL.begin(LLRender::QUADS); - gGL.texCoord2f(0.f, 1.f); - gGL.vertex2f(left, top); - gGL.texCoord2f(0.f, 0.f); - gGL.vertex2f(left, bottom); - gGL.texCoord2f(1.f, 0.f); - gGL.vertex2f(right, bottom); - gGL.texCoord2f(1.f, 1.f); - gGL.vertex2f(right, top); - gGL.end(); + const LLViewerRegion::tex_matrix_t& tiles(regionp->getWorldMapTiles()); - pRegionImage->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE); - fRenderTerrain = false; + for (S32 i(0), scaled_width(real_width/region_width), square_width(scaled_width*scaled_width); i < square_width; ++i) + { + const F32 y(i/scaled_width); + const F32 x(i - y*scaled_width); + const F32 local_left(left + x*mScale); + const F32 local_right(local_left + mScale); + const F32 local_bottom(bottom + y*mScale); + const F32 local_top(local_bottom + mScale); + LLViewerTexture* pRegionImage = tiles[x*scaled_width+y]; + if (pRegionImage && pRegionImage->hasGLTexture()) + { + gGL.getTexUnit(0)->bind(pRegionImage); + gGL.begin(LLRender::QUADS); + gGL.texCoord2f(0.f, 1.f); + gGL.vertex2f(local_left, local_top); + gGL.texCoord2f(0.f, 0.f); + gGL.vertex2f(local_left, local_bottom); + gGL.texCoord2f(1.f, 0.f); + gGL.vertex2f(local_right, local_bottom); + gGL.texCoord2f(1.f, 1.f); + gGL.vertex2f(local_right, local_top); + gGL.end(); + + pRegionImage->setBoostLevel(LLViewerTexture::BOOST_MAP_VISIBLE); + fRenderTerrain = false; + } } } // [/SL:KB] @@ -952,7 +964,7 @@ BOOL LLNetMap::handleToolTip( S32 x, S32 y, std::string& tool_tip, LLRect* stick LLVector3d targetPosition = (*current).second; std::string fullName; - if (targetUUID.notNull() && LLAvatarNameCache::getPNSName(targetUUID, fullName)) + if (targetUUID.notNull() && LLAvatarNameCache::getNSName(targetUUID, fullName)) { //tool_tip.append(fullName); // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Modified: RLVa-0.2.0b @@ -1143,17 +1155,18 @@ void LLNetMap::renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const // // Draw the north and east region borders // - const S32 borderY = originY + llround(REGION_WIDTH_METERS * mObjectMapTPM); + const F32 real_width(pRegion->getWidth()); + const S32 borderY = originY + llround(real_width * mObjectMapTPM); if ( (borderY >= 0) && (borderY < imgHeight) ) { - S32 curX = llclamp(originX, 0, imgWidth), endX = llclamp(originX + llround(REGION_WIDTH_METERS * mObjectMapTPM), 0, imgWidth - 1); + S32 curX = llclamp(originX, 0, imgWidth), endX = llclamp(originX + llround(real_width * mObjectMapTPM), 0, imgWidth - 1); for (; curX <= endX; curX++) pTextureData[borderY * imgWidth + curX] = clrOverlay.mAll; } - const S32 borderX = originX + llround(REGION_WIDTH_METERS * mObjectMapTPM); + const S32 borderX = originX + llround(real_width * mObjectMapTPM); if ( (borderX >= 0) && (borderX < imgWidth) ) { - S32 curY = llclamp(originY, 0, imgHeight), endY = llclamp(originY + llround(REGION_WIDTH_METERS * mObjectMapTPM), 0, imgHeight - 1); + S32 curY = llclamp(originY, 0, imgHeight), endY = llclamp(originY + llround(real_width * mObjectMapTPM), 0, imgHeight - 1); for (; curY <= endY; curY++) pTextureData[curY * imgWidth + borderX] = clrOverlay.mAll; } @@ -1162,7 +1175,7 @@ void LLNetMap::renderPropertyLinesForRegion(const LLViewerRegion* pRegion, const // Render parcel lines // static const F32 GRID_STEP = PARCEL_GRID_STEP_METERS; - static const S32 GRIDS_PER_EDGE = REGION_WIDTH_METERS / GRID_STEP; + static const S32 GRIDS_PER_EDGE = real_width / GRID_STEP; const U8* pOwnership = pRegion->getParcelOverlay()->getOwnership(); const U8* pCollision = (pRegion->getHandle() == LLViewerParcelMgr::instance().getCollisionRegionHandle()) ? LLViewerParcelMgr::instance().getCollisionBitmap() : NULL; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index f8cecab8c..c8483f591 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -96,20 +96,24 @@ LLPanelAvatarTab::LLPanelAvatarTab(const std::string& name, const LLRect &rect, void LLPanelAvatarTab::setAvatarID(const LLUUID& avatar_id) { - if(mAvatarID != avatar_id) + if (mAvatarID != avatar_id) { - if(mAvatarID.notNull()) + if (mAvatarID.notNull()) LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); mAvatarID = avatar_id; - if(mAvatarID.notNull()) + if (mAvatarID.notNull()) + { LLAvatarPropertiesProcessor::getInstance()->addObserver(mAvatarID, this); + if (LLUICtrl* ctrl = findChild("Mute")) + ctrl->setValue(LLMuteList::instance().isMuted(mAvatarID)); + } } } // virtual LLPanelAvatarTab::~LLPanelAvatarTab() { - if(mAvatarID.notNull()) + if (mAvatarID.notNull()) LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); } @@ -117,7 +121,6 @@ LLPanelAvatarTab::~LLPanelAvatarTab() void LLPanelAvatarTab::draw() { refresh(); - LLPanel::draw(); } @@ -130,22 +133,23 @@ LLPanelAvatarSecondLife::LLPanelAvatarSecondLife(const std::string& name, : LLPanelAvatarTab(name, rect, panel_avatar), mPartnerID() { + LLMuteList::instance().addObserver(this); +} + +LLPanelAvatarSecondLife::~LLPanelAvatarSecondLife() +{ + mCacheConnection.disconnect(); + LLMuteList::instance().removeObserver(this); } void LLPanelAvatarSecondLife::refresh() { - updatePartnerName(); } -void LLPanelAvatarSecondLife::updatePartnerName() +void LLPanelAvatarSecondLife::updatePartnerName(const LLAvatarName& name) { - if (mPartnerID.notNull()) - { - std::string name; - if (LLAvatarNameCache::getPNSName(mPartnerID, name)) - childSetTextArg("partner_edit", "[NAME]", name); - childSetEnabled("partner_info", TRUE); - } + mCacheConnection.disconnect(); + childSetTextArg("partner_edit", "[NAME]", name.getNSName()); } //----------------------------------------------------------------------------- @@ -155,24 +159,15 @@ void LLPanelAvatarSecondLife::updatePartnerName() //----------------------------------------------------------------------------- void LLPanelAvatarSecondLife::clearControls() { - LLTextureCtrl* image_ctrl = getChild("img"); - if(image_ctrl) - { - image_ctrl->setImageAssetID(LLUUID::null); - } - childSetValue("about", ""); - childSetValue("born", ""); - childSetValue("acct", ""); + getChild("img")->setImageAssetID(LLUUID::null); + childSetValue("about", LLStringUtil::null); + childSetValue("born", LLStringUtil::null); + childSetValue("acct", LLStringUtil::null); childSetTextArg("partner_edit", "[NAME]", LLStringUtil::null); - mPartnerID = LLUUID::null; - - LLScrollListCtrl* group_list = getChild("groups"); - if(group_list) - { - group_list->deleteAllItems(); - } + + getChild("groups")->deleteAllItems(); } // virtual @@ -196,7 +191,7 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType { using namespace boost::gregorian; int year, month, day; - sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d",&month,&day,&year); + sscanf(pAvatarData->born_on.c_str(),"%d/%d/%d", &month, &day, &year); std::ostringstream born_on; born_on << pAvatarData->born_on << " (" << day_clock::local_day() - date(year, month, day) << ")"; childSetValue("born", born_on.str()); @@ -206,20 +201,21 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType childSetValue("allow_publish", allow_publish); setPartnerID(pAvatarData->partner_id); - updatePartnerName(); + if (mPartnerID.notNull()) + { + mCacheConnection.disconnect(); + mCacheConnection = LLAvatarNameCache::get(mPartnerID, boost::bind(&LLPanelAvatarSecondLife::updatePartnerName, this, _2)); + childSetEnabled("partner_info", TRUE); + } } } - else if(type == APT_GROUPS) + else if (type == APT_GROUPS) { - const LLAvatarGroups* pAvatarGroups = static_cast( data ); - if(pAvatarGroups && pAvatarGroups->avatar_id == mAvatarID && pAvatarGroups->avatar_id.notNull()) + const LLAvatarGroups* pAvatarGroups = static_cast(data); + if (pAvatarGroups && pAvatarGroups->avatar_id == mAvatarID && pAvatarGroups->avatar_id.notNull()) { - LLScrollListCtrl* group_list = getChild("groups"); -// if(group_list) -// { -// group_list->deleteAllItems(); -// } - if (0 == pAvatarGroups->group_list.size()) + LLScrollListCtrl* group_list = getChild("groups"); + if (!pAvatarGroups->group_list.size()) { group_list->setCommentText(getString("None")); } @@ -229,55 +225,38 @@ void LLPanelAvatarSecondLife::processProperties(void* data, EAvatarProcessorType { // Is this really necessary? Remove existing entry if it exists. // TODO: clear the whole list when a request for data is made - if (group_list) - { - S32 index = group_list->getItemIndex(it->group_id); - if ( index >= 0 ) - { - group_list->deleteSingleItem(index); - } - } + S32 index = group_list->getItemIndex(it->group_id); + if (index >= 0) + group_list->deleteSingleItem(index); - LLSD row; - row["id"] = it->group_id; - row["columns"][0]["value"] = it->group_id.notNull() ? it->group_name : ""; - row["columns"][0]["font"] = "SANSSERIF_SMALL"; - LLGroupData *group_data = NULL; + LLScrollListItem::Params row; + row.value(it->group_id); + std::string font_style("NORMAL"); // Set normal color if not found or if group is visible in profile if (pAvatarGroups->avatar_id == pAvatarGroups->agent_id) // own avatar - { - // Search for this group in the agent's groups list - LLDynamicArray::iterator i; - - for (i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); i++) - { + for (LLDynamicArray::iterator i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); ++i) // Search for this group in the agent's groups list if (i->mID == it->group_id) { - group_data = &*i; + if (i->mListInProfile) + font_style = "BOLD"; break; } - } - // Set normal color if not found or if group is visible in profile - if (group_data) - { - std::string font_style = group_data->mListInProfile ? "BOLD" : "NORMAL"; - if(group_data->mID == gAgent.getGroupID()) - font_style.append("|ITALIC"); - row["columns"][0]["font-style"] = font_style; - } - else - row["columns"][0]["font-style"] = "NORMAL"; - } - - if (group_list) - { - group_list->addElement(row,ADD_SORTED); - } + + if (it->group_id == gAgent.getGroupID()) + font_style.append("|ITALIC"); + row.columns.add(LLScrollListCell::Params().value(it->group_id.notNull() ? it->group_name : "").font("SANSSERIF_SMALL").font_style(font_style)); + group_list->addRow(row,ADD_SORTED); } } } } +void LLPanelAvatarSecondLife::onChangeDetailed(const LLMute& mute) +{ + if (mute.mID != mAvatarID) return; + getChild("Mute")->setValue(LLMuteList::instance().hasMute(mute)); +} + //----------------------------------------------------------------------------- // enableControls() //----------------------------------------------------------------------------- @@ -298,138 +277,79 @@ void LLPanelAvatarSecondLife::enableControls(BOOL self) childSetEnabled("?", self); } -// static -void LLPanelAvatarFirstLife::onClickImage(void* data) +void LLPanelAvatarFirstLife::onClickImage() { - LLPanelAvatarFirstLife* self = (LLPanelAvatarFirstLife*)data; - - LLTextureCtrl* image_ctrl = self->getChild("img"); - if(image_ctrl) - { - LLUUID mUUID = image_ctrl->getImageAssetID(); - llinfos << "LLPanelAvatarFirstLife::onClickImage" << llendl; - if(!LLPreview::show(mUUID)) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); - rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border. - LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", - rect, - std::string("Profile First Life Picture"), - mUUID); - preview->setFocus(TRUE); - //preview->mIsCopyable=FALSE; - //preview->canSaveAs - } - + const LLUUID& id(getChild("img")->getImageAssetID()); + llinfos << "LLPanelAvatarFirstLife::onClickImage" << llendl; + if (!LLPreview::show(id)) + { + // There isn't one, so make a new preview + S32 left, top; + gFloaterView->getNewFloaterPosition(&left, &top); + LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); + rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border. + LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", + rect, + std::string("Profile First Life Picture"), + id); + preview->setFocus(TRUE); + //preview->mIsCopyable=FALSE; + //preview->canSaveAs } } // virtual void LLPanelAvatarFirstLife::processProperties(void* data, EAvatarProcessorType type) { - if(type == APT_PROPERTIES) + if (type == APT_PROPERTIES) { - const LLAvatarData* pAvatarData = static_cast( data ); + const LLAvatarData* pAvatarData = static_cast(data); if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id != LLUUID::null)) { // Teens don't get these - childSetValue("about", pAvatarData->fl_about_text); + getChildView("about")->setValue(pAvatarData->fl_about_text); getChild("img")->setImageAssetID(pAvatarData->fl_image_id); } } } -// static -void LLPanelAvatarSecondLife::onClickImage(void* data) +void LLPanelAvatarSecondLife::onClickImage() { - LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - LLNameEditor* name_ctrl = self->getChild("dnname"); - if(name_ctrl) + const LLUUID& id = getChild("img")->getImageAssetID(); + llinfos << "LLPanelAvatarSecondLife::onClickImage" << llendl; + if (!LLPreview::show(id)) { - std::string name_text = name_ctrl->getText(); - - LLTextureCtrl* image_ctrl = self->getChild("img"); - if(image_ctrl) - { - LLUUID mUUID = image_ctrl->getImageAssetID(); - llinfos << "LLPanelAvatarSecondLife::onClickImage" << llendl; - if(!LLPreview::show(mUUID)) - { - // There isn't one, so make a new preview - S32 left, top; - gFloaterView->getNewFloaterPosition(&left, &top); - LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); - rect.translate( left - rect.mLeft, rect.mTop - top ); // Changed to avoid textures being sunken below the window border. - LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", - rect, - std::string("Profile Picture: ") + name_text, - mUUID - ); - preview->setFocus(TRUE); - - //preview->mIsCopyable=FALSE; - } - /*open_texture(LLUUID::null,//image_ctrl->getImageAssetID(), - std::string("Profile Picture: ") + - name_text+ - "and image id is "+ - image_ctrl->getImageAssetID().asString() - , FALSE, image_ctrl->getImageAssetID(), TRUE);*/ - } - } - - -} - -// static -void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data) -{ - LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data; - - LLScrollListCtrl* group_list = self->getChild("groups"); - if(group_list) - { - LLScrollListItem* item = group_list->getFirstSelected(); - if (item) - { - LLGroupActions::show(item->getUUID()); - } + // There isn't one, so make a new preview + S32 left, top; + gFloaterView->getNewFloaterPosition(&left, &top); + LLRect rect = gSavedSettings.getRect("PreviewTextureRect"); + rect.translate(left - rect.mLeft, rect.mTop - top); // Changed to avoid textures being sunken below the window border. + LLPreviewTexture* preview = new LLPreviewTexture("preview task texture", + rect, + std::string("Profile Picture: ") + getChild("dnname")->getText(), + id); + preview->setFocus(TRUE); + //preview->mIsCopyable=FALSE; + /*open_texture(LLUUID::null,//id, + std::string("Profile Picture: ") + getChild("dnname")->getText() + "and image id is " + id.asString() + , FALSE, id, TRUE);*/ } } -// static -void LLPanelAvatarSecondLife::onClickPublishHelp(void *) +void LLPanelAvatarSecondLife::onDoubleClickGroup() { - LLNotificationsUtil::add("ClickPublishHelpAvatar"); -} - -// static -void LLPanelAvatarSecondLife::onClickPartnerHelp(void *) -{ - LLNotificationsUtil::add("ClickPartnerHelpAvatar", LLSD(), LLSD(), onClickPartnerHelpLoadURL); + if (LLScrollListItem* item = getChild("groups")->getFirstSelected()) + LLGroupActions::show(item->getUUID()); } // static bool LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); - if (option == 0) - { + if (!LLNotification::getSelectedOption(notification, response)) LLWeb::loadURL("http://secondlife.com/partner"); - } return false; } -// static -void LLPanelAvatarSecondLife::onClickPartnerInfo(void *data) -{ - LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*) data; - LLAvatarActions::showProfile(self->mPartnerID); -} - //----------------------------------------------------------------------------- // LLPanelAvatarFirstLife() //----------------------------------------------------------------------------- @@ -450,15 +370,19 @@ void LLPanelAvatarFirstLife::enableControls(BOOL self) // postBuild //----------------------------------------------------------------------------- -BOOL LLPanelAvatarSecondLife::postBuild(void) +static void show_partner_help() { LLNotificationsUtil::add("ClickPartnerHelpAvatar", LLSD(), LLSD(), boost::bind(LLPanelAvatarSecondLife::onClickPartnerHelpLoadURL, _1, _2)); } +BOOL LLPanelAvatarSecondLife::postBuild() { childSetEnabled("born", FALSE); childSetEnabled("partner_edit", FALSE); - childSetAction("partner_help",onClickPartnerHelp,this); - childSetAction("partner_info", onClickPartnerInfo, this); - childSetEnabled("partner_info", mPartnerID.notNull()); - - childSetAction("?",onClickPublishHelp,this); + getChild("partner_help")->setCommitCallback(boost::bind(show_partner_help)); + if (LLUICtrl* ctrl = getChild("partner_info")) + { + ctrl->setCommitCallback(boost::bind(LLAvatarActions::showProfile, boost::ref(mPartnerID), false)); + ctrl->setEnabled(mPartnerID.notNull()); + } + + childSetAction("?", boost::bind(LLNotificationsUtil::add, "ClickPublishHelpAvatar")); LLPanelAvatar* pa = getPanelAvatar(); enableControls(pa->getAvatarID() == gAgentID); @@ -477,55 +401,57 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) getChild("Add Friend...")->setCommitCallback(boost::bind(LLAvatarActions::requestFriendshipDialog, boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("Pay...")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLPanelAvatar::getAvatarID, pa))); - getChild("Mute")->setCommitCallback(boost::bind(LLAvatarActions::toggleBlock, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + if (LLUICtrl* ctrl = findChild("Mute")) + { + ctrl->setCommitCallback(boost::bind(LLAvatarActions::toggleBlock, boost::bind(&LLPanelAvatar::getAvatarID, pa))); + ctrl->setValue(LLMuteList::instance().isMuted(mAvatarID)); + } getChild("Offer Teleport...")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("groups")->setDoubleClickCallback(boost::bind(&LLPanelAvatarSecondLife::onDoubleClickGroup,this)); - childSetAction("bigimg", onClickImage, this); + getChild("bigimg")->setCommitCallback(boost::bind(&LLPanelAvatarSecondLife::onClickImage, this)); getChild("img")->setFallbackImageName("default_profile_picture.j2c"); return TRUE; } -BOOL LLPanelAvatarFirstLife::postBuild(void) +BOOL LLPanelAvatarFirstLife::postBuild() { BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); enableControls(own_avatar); getChild("img")->setFallbackImageName("default_profile_picture.j2c"); - childSetAction("flbigimg", onClickImage, this); + getChild("flbigimg")->setCommitCallback(boost::bind(&LLPanelAvatarFirstLife::onClickImage, this)); return TRUE; } -BOOL LLPanelAvatarNotes::postBuild(void) +BOOL LLPanelAvatarNotes::postBuild() { - getChild("notes edit")->setCommitCallback(boost::bind(&LLPanelAvatar::sendAvatarNotesUpdate, getPanelAvatar())); - - LLTextEditor* te = getChild("notes edit"); - if(te) te->setCommitOnFocusLost(TRUE); + LLTextEditor* te(getChild("notes edit")); + te->setCommitCallback(boost::bind(&LLPanelAvatar::sendAvatarNotesUpdate, getPanelAvatar())); + te->setCommitOnFocusLost(true); return TRUE; } -BOOL LLPanelAvatarWeb::postBuild(void) +BOOL LLPanelAvatarWeb::postBuild() { LLLineEditor* url_edit = getChild("url_edit"); - url_edit->setKeystrokeCallback(boost::bind(&LLPanelAvatarWeb::onURLKeystroke,this,_1)); - url_edit->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitURL,this,_2)); + LLUICtrl* loadctrl = getChild("load"); - getChild("load")->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitLoad, this, _2)); + url_edit->setKeystrokeCallback(boost::bind(&LLView::setEnabled, loadctrl, boost::bind(&std::string::length, boost::bind(&LLLineEditor::getText, _1)))); + url_edit->setCommitCallback(boost::bind(&LLPanelAvatarWeb::load, this, boost::bind(&LLSD::asString, _2))); - childSetAction("web_profile_help",onClickWebProfileHelp,this); + loadctrl->setCommitCallback(boost::bind(&LLPanelAvatarWeb::onCommitLoad, this, _2)); + + getChild("web_profile_help")->setCommitCallback(boost::bind(LLNotificationsUtil::add, "ClickWebProfileHelpAvatar")); mWebBrowser = getChild("profile_html"); mWebBrowser->addObserver(this); - // links open in internally - //mWebBrowser->setOpenInExternalBrowser( false ); - return TRUE; } @@ -542,21 +468,27 @@ void LLPanelAvatarWeb::processProperties(void* data, EAvatarProcessorType type) } } -BOOL LLPanelAvatarClassified::postBuild(void) +BOOL LLPanelAvatarClassified::postBuild() { - childSetAction("New...",onClickNew,this); - childSetAction("Delete...",onClickDelete,this); + getChild("New...")->setCommitCallback(boost::bind(&LLPanelAvatarClassified::onClickNew, this)); + getChild("Delete...")->setCommitCallback(boost::bind(&LLPanelAvatarClassified::onClickDelete, this)); + // *HACK: Don't allow making new classifieds from inside the directory. + // The logic for save/don't save when closing is too hairy, and the + // directory is conceptually read-only. JC + for (LLView* view = this; !mInDirectory && view; view = view->getParent()) + if (view->getName() == "directory") + mInDirectory = true; return TRUE; } -BOOL LLPanelAvatarPicks::postBuild(void) +BOOL LLPanelAvatarPicks::postBuild() { - childSetAction("New...",onClickNew,this); - childSetAction("Delete...",onClickDelete,this); + getChild("New...")->setCommitCallback(boost::bind(&LLPanelAvatarPicks::onClickNew, this)); + getChild("Delete...")->setCommitCallback(boost::bind(&LLPanelAvatarPicks::onClickDelete, this)); //For pick import and export - RK - childSetAction("Import...",onClickImport,this); - childSetAction("Export...",onClickExport,this); + getChild("Import...")->setCommitCallback(boost::bind(&LLPanelAvatarPicks::onClickImport, this)); + getChild("Export...")->setCommitCallback(boost::bind(&LLPanelAvatarPicks::onClickExport, this)); return TRUE; } @@ -618,15 +550,15 @@ LLPanelAvatarWeb::~LLPanelAvatarWeb() if ( mWebBrowser ) { mWebBrowser->remObserver( this ); - }; + } } void LLPanelAvatarWeb::refresh() { - if (mNavigateTo != "") + if (!mNavigateTo.empty()) { llinfos << "Loading " << mNavigateTo << llendl; - mWebBrowser->navigateTo( mNavigateTo ); + mWebBrowser->navigateTo(mNavigateTo); mNavigateTo = ""; } } @@ -644,45 +576,29 @@ void LLPanelAvatarWeb::setWebURL(std::string url) bool changed_url = (mHome != url); mHome = url; - bool have_url = !mHome.empty(); childSetText("url_edit", mHome); childSetEnabled("load", mHome.length() > 0); - if (have_url - && gSavedSettings.getBOOL("AutoLoadWebProfiles")) + if (!mHome.empty() && gSavedSettings.getBOOL("AutoLoadWebProfiles")) { if (changed_url) { load(mHome); } + childSetVisible("status_text", getPanelAvatar()->getAvatarID() != gAgentID); } else { - childSetVisible("profile_html",false); + childSetVisible("profile_html", false); childSetVisible("status_text", false); } - BOOL own_avatar = (getPanelAvatar()->getAvatarID() == gAgent.getID() ); - childSetVisible("status_text",!own_avatar && !mHome.empty()); } - -void LLPanelAvatarWeb::onCommitURL(const LLSD& value) -{ - load(value.asString()); -} - -// static -void LLPanelAvatarWeb::onClickWebProfileHelp(void *) -{ - LLNotificationsUtil::add("ClickWebProfileHelpAvatar"); -} - -void LLPanelAvatarWeb::load(std::string url) +void LLPanelAvatarWeb::load(const std::string& url) { bool have_url = (!url.empty()); - childSetVisible("profile_html", have_url); childSetVisible("status_text", have_url); childSetText("status_text", LLStringUtil::null); @@ -693,34 +609,21 @@ void LLPanelAvatarWeb::load(std::string url) } } -void LLPanelAvatarWeb::onURLKeystroke(LLLineEditor* editor) -{ - LLSD::String url = editor->getText(); - childSetEnabled("load", url.length() > 0); - return; -} - void LLPanelAvatarWeb::onCommitLoad(const LLSD& value) { - LLSD::String valstr = value.asString(); - LLSD::String urlstr = childGetText("url_edit"); - if (valstr == "") // load url string into browser panel + const std::string& valstr(value.asString()); + if (valstr.empty()) // load url string into browser panel { - load(urlstr); + load(childGetText("url_edit")); } else if (valstr == "open") // open in user's external browser { - if (!urlstr.empty()) - { - LLWeb::loadURLExternal(urlstr); - } + const std::string& urlstr(childGetText("url_edit")); + if (!urlstr.empty()) LLWeb::loadURLExternal(urlstr); } else if (valstr == "home") // reload profile owner's home page { - if (!mHome.empty()) - { - load(mHome); - } + if (!mHome.empty()) load(mHome); } } @@ -731,13 +634,13 @@ void LLPanelAvatarWeb::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent ev switch(event) { case MEDIA_EVENT_STATUS_TEXT_CHANGED: - childSetText("status_text", self->getStatusText() ); + childSetText("status_text", self->getStatusText()); break; - + case MEDIA_EVENT_LOCATION_CHANGED: - childSetText("url_edit", self->getLocation() ); + childSetText("url_edit", self->getLocation()); break; - + default: // Having a default case makes the compiler happy. break; @@ -760,37 +663,35 @@ LLPanelAvatarAdvanced::LLPanelAvatarAdvanced(const std::string& name, void LLPanelAvatarAdvanced::enableControls(BOOL self) { - S32 t; - for(t=0;tsetEnabled(self); - } - for(t=0;tsetEnabled(self); - } - - if (mWantToEdit) mWantToEdit->setEnabled(self); - if (mSkillsEdit) mSkillsEdit->setEnabled(self); - childSetEnabled("languages_edit",self); + for(S32 t(0); t < mWantToCount; ++t) + if (mWantToCheck[t]) + mWantToCheck[t]->setEnabled(self); + for(S32 t(0); t < mSkillsCount; ++t) + if (mSkillsCheck[t]) + mSkillsCheck[t]->setEnabled(self); + if (mWantToEdit) + mWantToEdit->setEnabled(self); + if (mSkillsEdit) + mSkillsEdit->setEnabled(self); + childSetEnabled("languages_edit", self); } void LLPanelAvatarAdvanced::setWantSkills(U32 want_to_mask, const std::string& want_to_text, U32 skills_mask, const std::string& skills_text, const std::string& languages_text) { - for(int id =0;idset( want_to_mask & 1<set(want_to_mask & 1<set( skills_mask & 1<set(skills_mask & 1<setText( want_to_text ); - mSkillsEdit->setText( skills_text ); + mWantToEdit->setText(want_to_text); + mSkillsEdit->setText(skills_text); } childSetText("languages_edit",languages_text); @@ -803,30 +704,22 @@ void LLPanelAvatarAdvanced::getWantSkills(U32* want_to_mask, std::string& want_t if (want_to_mask) { *want_to_mask = 0; - for(int t=0;tget()) + for(S32 t = 0; t < mWantToCount; ++t) + if (mWantToCheck[t]->get()) *want_to_mask |= 1<get()) *skills_mask |= 1<getText(); - } if (mSkillsEdit) - { skills_text = mSkillsEdit->getText(); - } languages_text = childGetText("languages_edit"); } @@ -850,8 +743,9 @@ void LLPanelAvatarNotes::refresh() void LLPanelAvatarNotes::clearControls() { - childSetText("notes edit", getString("Loading")); - childSetEnabled("notes edit", false); + LLView* view(getChildView("notes edit")); + view->setValue(getString("Loading")); + view->setEnabled(false); } @@ -861,45 +755,12 @@ void LLPanelAvatarNotes::clearControls() LLPanelAvatarClassified::LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar) : LLPanelAvatarTab(name, rect, panel_avatar) +, mInDirectory(false) { } - void LLPanelAvatarClassified::refresh() { - BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - - LLTabContainer* tabs = getChild("classified tab"); - - S32 tab_count = tabs ? tabs->getTabCount() : 0; - - bool allow_new = tab_count < MAX_CLASSIFIEDS; -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - allow_new &= !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); -// [/RLVa:KB] - bool allow_delete = (tab_count > 0); - bool show_help = (tab_count == 0); - - // *HACK: Don't allow making new classifieds from inside the directory. - // The logic for save/don't save when closing is too hairy, and the - // directory is conceptually read-only. JC - bool in_directory = false; - LLView* view = this; - while (view) - { - if (view->getName() == "directory") - { - in_directory = true; - break; - } - view = view->getParent(); - } - childSetEnabled("New...", self && !in_directory && allow_new); - childSetVisible("New...", !in_directory); - childSetEnabled("Delete...", self && !in_directory && allow_delete); - childSetVisible("Delete...", !in_directory); - childSetVisible("classified tab",!show_help); - if (!isDataRequested()) { LLAvatarPropertiesProcessor::getInstance()->sendAvatarClassifiedsRequest(mAvatarID); @@ -924,19 +785,10 @@ BOOL LLPanelAvatarClassified::canClose() BOOL LLPanelAvatarClassified::titleIsValid() { - LLTabContainer* tabs = getChild("classified tab"); - if ( tabs ) - { - LLPanelClassifiedInfo* panel = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); - if ( panel ) - { - if ( ! panel->titleIsValid() ) - { + if (LLTabContainer* tabs = getChild("classified tab")) + if (LLPanelClassifiedInfo* panel = (LLPanelClassifiedInfo*)tabs->getCurrentPanel()) + if (!panel->titleIsValid()) return FALSE; - }; - }; - }; - return TRUE; } @@ -953,12 +805,7 @@ void LLPanelAvatarClassified::apply() void LLPanelAvatarClassified::deleteClassifiedPanels() { - LLTabContainer* tabs = getChild("classified tab"); - if (tabs) - { - tabs->deleteAllTabs(); - } - + getChild("classified tab")->deleteAllTabs(); childSetVisible("New...", false); childSetVisible("Delete...", false); childSetVisible("loading_text", true); @@ -967,13 +814,13 @@ void LLPanelAvatarClassified::deleteClassifiedPanels() // virtual void LLPanelAvatarClassified::processProperties(void* data, EAvatarProcessorType type) { - if(type == APT_CLASSIFIEDS) + if (type == APT_CLASSIFIEDS) { LLAvatarClassifieds* c_info = static_cast(data); - if(c_info && mAvatarID == c_info->target_id) + if (c_info && mAvatarID == c_info->target_id) { LLTabContainer* tabs = getChild("classified tab"); - + for(LLAvatarClassifieds::classifieds_list_t::iterator it = c_info->classifieds_list.begin(); it != c_info->classifieds_list.end(); ++it) { @@ -985,22 +832,27 @@ void LLPanelAvatarClassified::processProperties(void* data, EAvatarProcessorType panel_classified->markForServerRequest(); // The button should automatically truncate long names for us - if(tabs) - { - tabs->addTabPanel(panel_classified, it->name); - } + tabs->addTabPanel(panel_classified, it->name); } // Make sure somebody is highlighted. This works even if there // are no tabs in the container. - if(tabs) - { - tabs->selectFirstTab(); - } + tabs->selectFirstTab(); - childSetVisible("New...", true); - childSetVisible("Delete...", true); - childSetVisible("loading_text", false); + bool self = gAgentID == mAvatarID; + S32 tab_count = tabs->getTabCount(); + bool allow_new = tab_count < MAX_CLASSIFIEDS +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); +// [/RLVa:KB] + LLView* view(getChildView("New...")); + view->setEnabled(self && !mInDirectory && allow_new); + view->setVisible(!mInDirectory); + view = getChildView("Delete..."); + view->setEnabled(self && !mInDirectory && tab_count); + view->setVisible(!mInDirectory); + view = getChildView("loading_text"); + view->setVisible(false); } } } @@ -1008,82 +860,63 @@ void LLPanelAvatarClassified::processProperties(void* data, EAvatarProcessorType // Create a new classified panel. It will automatically handle generating // its own id when it's time to save. // static -void LLPanelAvatarClassified::onClickNew(void* data) +void LLPanelAvatarClassified::onClickNew() { // [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-04 (RLVa-1.0.0a) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { - return; - } + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) return; // [/RLVa:KB] - LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - - LLNotificationsUtil::add("AddClassified", LLSD(), LLSD(), boost::bind(&LLPanelAvatarClassified::callbackNew, self, _1, _2)); + LLNotificationsUtil::add("AddClassified", LLSD(), LLSD(), boost::bind(&LLPanelAvatarClassified::callbackNew, this, _1, _2)); } bool LLPanelAvatarClassified::callbackNew(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); - if (0 == option) - { - LLPanelClassifiedInfo* panel_classified = new LLPanelClassifiedInfo(false, false); - panel_classified->initNewClassified(); - LLTabContainer* tabs = getChild("classified tab"); - if(tabs) - { - tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); - tabs->selectLastTab(); - } - } - return false; + if (LLNotification::getSelectedOption(notification, response)) + return false; + LLPanelClassifiedInfo* panel_classified = new LLPanelClassifiedInfo(false, false); + panel_classified->initNewClassified(); + LLTabContainer* tabs = getChild("classified tab"); + tabs->addTabPanel(panel_classified, panel_classified->getClassifiedName()); + tabs->selectLastTab(); + bool allow_new = tabs->getTabCount() < MAX_CLASSIFIEDS +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC); +// [/RLVa:KB] + childSetEnabled("New...", allow_new); + childSetEnabled("Delete...", true); + return true; } // static -void LLPanelAvatarClassified::onClickDelete(void* data) +void LLPanelAvatarClassified::onClickDelete() { - LLPanelAvatarClassified* self = (LLPanelAvatarClassified*)data; - - LLTabContainer* tabs = self->getChild("classified tab"); - LLPanelClassifiedInfo* panel_classified = NULL; - if(tabs) - { - panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); - } + LLTabContainer* tabs = getChild("classified tab"); + LLPanelClassifiedInfo* panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); if (!panel_classified) return; LLSD args; args["NAME"] = panel_classified->getClassifiedName(); - LLNotificationsUtil::add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelAvatarClassified::callbackDelete, self, _1, _2)); - + LLNotificationsUtil::add("DeleteClassified", args, LLSD(), boost::bind(&LLPanelAvatarClassified::callbackDelete, this, _1, _2)); } -bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response) +bool LLPanelAvatarClassified::callbackDelete(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + if (LLNotification::getSelectedOption(notification, response)) + return false; LLTabContainer* tabs = getChild("classified tab"); - LLPanelClassifiedInfo* panel_classified=NULL; - if(tabs) - { - panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); - } + LLPanelClassifiedInfo* panel_classified = (LLPanelClassifiedInfo*)tabs->getCurrentPanel(); if (!panel_classified) return false; - if (0 == option) - { - LLAvatarPropertiesProcessor::getInstance()->sendClassifiedDelete(panel_classified->getClassifiedID()); - - if(tabs) - { - tabs->removeTabPanel(panel_classified); - } - delete panel_classified; - panel_classified = NULL; - } - return false; + LLAvatarPropertiesProcessor::getInstance()->sendClassifiedDelete(panel_classified->getClassifiedID()); + tabs->removeTabPanel(panel_classified); + delete panel_classified; + panel_classified = NULL; + childSetEnabled("New...", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + childSetEnabled("Delete...", tabs->getTabCount()); + return true; } @@ -1100,22 +933,6 @@ LLPanelAvatarPicks::LLPanelAvatarPicks(const std::string& name, void LLPanelAvatarPicks::refresh() { - BOOL self = (gAgent.getID() == getPanelAvatar()->getAvatarID()); - LLTabContainer* tabs = getChild("picks tab"); - S32 tab_count = tabs ? tabs->getTabCount() : 0; -// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) - childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS && (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) ); -// [/RLVa:KB] - //childSetEnabled("New...", self && tab_count < MAX_AVATAR_PICKS); - childSetEnabled("Delete...", self && tab_count > 0); - childSetVisible("New...", self && getPanelAvatar()->isEditable()); - childSetVisible("Delete...", self && getPanelAvatar()->isEditable()); - - //For pick import/export - RK - childSetVisible("Import...", self && getPanelAvatar()->isEditable()); - childSetEnabled("Export...", self && tab_count > 0); - childSetVisible("Export...", self && getPanelAvatar()->isEditable()); - if (!isDataRequested()) { LLAvatarPropertiesProcessor::getInstance()->sendAvatarPicksRequest(mAvatarID); @@ -1126,11 +943,7 @@ void LLPanelAvatarPicks::refresh() void LLPanelAvatarPicks::deletePickPanels() { - LLTabContainer* tabs = getChild("picks tab"); - if(tabs) - { - tabs->deleteAllTabs(); - } + getChild("picks tab")->deleteAllTabs(); childSetVisible("New...", false); childSetVisible("Delete...", false); @@ -1145,14 +958,14 @@ void LLPanelAvatarPicks::deletePickPanels() // virtual void LLPanelAvatarPicks::processProperties(void* data, EAvatarProcessorType type) { - if(type == APT_PICKS) + if (type == APT_PICKS) { LLAvatarPicks* picks = static_cast(data); //llassert_always(picks->target_id != gAgent.getID()); //llassert_always(mAvatarID != gAgent.getID()); - if(picks && mAvatarID == picks->target_id) + if (picks && mAvatarID == picks->target_id) { LLTabContainer* tabs = getChild("picks tab"); @@ -1160,7 +973,8 @@ void LLPanelAvatarPicks::processProperties(void* data, EAvatarProcessorType type // number of new panels. deletePickPanels(); - for(LLAvatarPicks::picks_list_t::iterator it = picks->picks_list.begin(); + bool self(gAgentID == mAvatarID); + for (LLAvatarPicks::picks_list_t::iterator it = picks->picks_list.begin(); it != picks->picks_list.end(); ++it) { LLPanelPick* panel_pick = new LLPanelPick(); @@ -1171,61 +985,66 @@ void LLPanelAvatarPicks::processProperties(void* data, EAvatarProcessorType type panel_pick->markForServerRequest(); // The button should automatically truncate long names for us - if(tabs) - { - llinfos << "Adding tab for " << mAvatarID << " " << ((mAvatarID == gAgent.getID()) ? "Self" : "Other") << ": '" << it->second << "'" << llendl; - tabs->addTabPanel(panel_pick, it->second); - } + llinfos << "Adding tab for " << mAvatarID << " " << (self ? "Self" : "Other") << ": '" << it->second << "'" << llendl; + tabs->addTabPanel(panel_pick, it->second); } // Make sure somebody is highlighted. This works even if there // are no tabs in the container. - if(tabs) - { - tabs->selectFirstTab(); - } + tabs->selectFirstTab(); + bool edit(getPanelAvatar()->isEditable()); + S32 tab_count = tabs->getTabCount(); + LLView* view = getChildView("New..."); + view->setEnabled(self && tab_count < MAX_AVATAR_PICKS +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); +// [/RLVa:KB] + view->setVisible(self && edit); + view = getChildView("Delete..."); + view->setEnabled(self && tab_count); + view->setVisible(self && edit); + + //For pick import/export - RK + view = getChildView("Import..."); + view->setVisible(self && edit); + view->setEnabled(tab_count < MAX_AVATAR_PICKS); + view = getChildView("Export..."); + view->setEnabled(self && tab_count); + view->setVisible(self); - childSetVisible("New...", true); - childSetVisible("Delete...", true); childSetVisible("loading_text", false); - - //For pick import and export - RK - childSetVisible("Import...", true); - childSetVisible("Export...", true); } } } // Create a new pick panel. It will automatically handle generating // its own id when it's time to save. -// static -void LLPanelAvatarPicks::onClickNew(void* data) +void LLPanelAvatarPicks::onClickNew() { // [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) - { return; - } // [/RLVa:KB] - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLPanelPick* panel_pick = new LLPanelPick(); - LLTabContainer* tabs = self->getChild("picks tab"); + LLPanelPick* panel_pick = new LLPanelPick; + LLTabContainer* tabs = getChild("picks tab"); panel_pick->initNewPick(); - if(tabs) - { - tabs->addTabPanel(panel_pick, panel_pick->getPickName()); - tabs->selectLastTab(); - } + tabs->addTabPanel(panel_pick, panel_pick->getPickName()); + tabs->selectLastTab(); + S32 tab_count = tabs->getTabCount(); + getChildView("New...")->setEnabled(tab_count < MAX_AVATAR_PICKS +// [RLVa:KB] - Checked: 2009-07-04 (RLVa-1.0.0a) + && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); +// [/RLVa:KB] + getChildView("Delete...")->setEnabled(true); + getChildView("Import...")->setEnabled(tab_count < MAX_AVATAR_PICKS); } //Pick import and export - RK -// static -void LLPanelAvatarPicks::onClickImport(void* data) +void LLPanelAvatarPicks::onClickImport() { - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - self->mPanelPick = new LLPanelPick(); - self->mPanelPick->importNewPick(&LLPanelAvatarPicks::onClickImport_continued, data); + mPanelPick = new LLPanelPick; + mPanelPick->importNewPick(&LLPanelAvatarPicks::onClickImport_continued, this); } // static @@ -1233,84 +1052,72 @@ void LLPanelAvatarPicks::onClickImport_continued(void* data, bool import) { LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; LLTabContainer* tabs = self->getChild("picks tab"); - if(tabs && import && self->mPanelPick) + if (import && self->mPanelPick) { tabs->addTabPanel(self->mPanelPick, self->mPanelPick->getPickName()); tabs->selectLastTab(); + self->childSetEnabled("New...", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + self->childSetEnabled("Delete...", false); + self->childSetEnabled("Import...", tabs->getTabCount() < MAX_AVATAR_PICKS); } } -// static -void LLPanelAvatarPicks::onClickExport(void* data) +void LLPanelAvatarPicks::onClickExport() { - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainer* tabs = self->getChild("picks tab"); - LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; - + LLPanelPick* panel_pick = (LLPanelPick*)getChild("picks tab")->getCurrentPanel(); if (!panel_pick) return; panel_pick->exportPick(); } - -// static -void LLPanelAvatarPicks::onClickDelete(void* data) +void LLPanelAvatarPicks::onClickDelete() { - LLPanelAvatarPicks* self = (LLPanelAvatarPicks*)data; - LLTabContainer* tabs = self->getChild("picks tab"); - LLPanelPick* panel_pick = tabs?(LLPanelPick*)tabs->getCurrentPanel():NULL; - + LLPanelPick* panel_pick = (LLPanelPick*)getChild("picks tab")->getCurrentPanel(); if (!panel_pick) return; LLSD args; args["PICK"] = panel_pick->getPickName(); LLNotificationsUtil::add("DeleteAvatarPick", args, LLSD(), - boost::bind(&LLPanelAvatarPicks::callbackDelete, self, _1, _2)); + boost::bind(&LLPanelAvatarPicks::callbackDelete, this, _1, _2)); } - -// static bool LLPanelAvatarPicks::callbackDelete(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + if (LLNotification::getSelectedOption(notification, response)) + return false; LLTabContainer* tabs = getChild("picks tab"); - LLPanelPick* panel_pick = tabs ? (LLPanelPick*)tabs->getCurrentPanel() : NULL; - LLMessageSystem* msg = gMessageSystem; - + LLPanelPick* panel_pick = (LLPanelPick*)tabs->getCurrentPanel(); if (!panel_pick) return false; - if (0 == option) - { - // If the viewer has a hacked god-mode, then this call will - // fail. - if(gAgent.isGodlike()) - { - msg->newMessage("PickGodDelete"); - msg->nextBlock("AgentData"); - msg->addUUID("AgentID", gAgent.getID()); - msg->addUUID("SessionID", gAgent.getSessionID()); - msg->nextBlock("Data"); - msg->addUUID("PickID", panel_pick->getPickID()); - // *HACK: We need to send the pick's creator id to accomplish - // the delete, and we don't use the query id for anything. JC - msg->addUUID( "QueryID", panel_pick->getPickCreatorID() ); - gAgent.sendReliableMessage(); - } - else - { - LLAvatarPropertiesProcessor::getInstance()->sendPickDelete(panel_pick->getPickID()); - } - + LLMessageSystem* msg = gMessageSystem; - if(tabs) - { - tabs->removeTabPanel(panel_pick); - } - delete panel_pick; - panel_pick = NULL; + // If the viewer has a hacked god-mode, then this call will fail. + if (gAgent.isGodlike()) + { + msg->newMessage("PickGodDelete"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgentID); + msg->addUUID("SessionID", gAgentSessionID); + msg->nextBlock("Data"); + msg->addUUID("PickID", panel_pick->getPickID()); + // *HACK: We need to send the pick's creator id to accomplish + // the delete, and we don't use the query id for anything. JC + msg->addUUID( "QueryID", panel_pick->getPickCreatorID() ); + gAgent.sendReliableMessage(); } - return false; + else + { + LLAvatarPropertiesProcessor::getInstance()->sendPickDelete(panel_pick->getPickID()); + } + + tabs->removeTabPanel(panel_pick); + delete panel_pick; + panel_pick = NULL; + childSetEnabled("New...", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)); + childSetEnabled("Delete...", tabs->getTabCount()); + childSetEnabled("Import...", true); + return true; } @@ -1356,20 +1163,31 @@ LLPanelAvatar::LLPanelAvatar( selectTab(0); } -BOOL LLPanelAvatar::postBuild(void) +BOOL LLPanelAvatar::postBuild() { mTab = getChild("tab"); - getChild("Kick")->setCommitCallback(boost::bind(LLAvatarActions::kick, boost::bind(&LLPanelAvatar::getAvatarID, this))); - getChild("Freeze")->setCommitCallback(boost::bind(LLAvatarActions::freeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); - getChild("Unfreeze")->setCommitCallback(boost::bind(LLAvatarActions::unfreeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); - getChild("csr_btn")->setCommitCallback(boost::bind(LLAvatarActions::csr, boost::bind(&LLPanelAvatar::getAvatarID, this))); - childSetAction("OK", onClickOK, this); - childSetAction("Cancel", onClickCancel, this); - - childSetAction("copy_key",onClickGetKey,this); + LLUICtrl* ctrl = getChild("Kick"); + ctrl->setCommitCallback(boost::bind(LLAvatarActions::kick, boost::bind(&LLPanelAvatar::getAvatarID, this))); + ctrl->setVisible(false); + ctrl->setEnabled(false); + ctrl = getChild("Freeze"); + ctrl->setCommitCallback(boost::bind(LLAvatarActions::freeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + ctrl->setVisible(false); + ctrl->setEnabled(false); + ctrl = getChild("Unfreeze"); + ctrl->setCommitCallback(boost::bind(LLAvatarActions::unfreeze, boost::bind(&LLPanelAvatar::getAvatarID, this))); + ctrl->setVisible(false); + ctrl->setEnabled(false); + ctrl = getChild("csr_btn"); + ctrl->setCommitCallback(boost::bind(LLAvatarActions::csr, boost::bind(&LLPanelAvatar::getAvatarID, this))); + ctrl->setVisible(false); + ctrl->setEnabled(false); + getChild("OK")->setCommitCallback(boost::bind(&LLPanelAvatar::onClickOK, this)); + getChild("Cancel")->setCommitCallback(boost::bind(&LLPanelAvatar::onClickCancel, this)); + getChild("copy_flyout")->setCommitCallback(boost::bind(&LLPanelAvatar::onClickCopy, this, _2)); getChildView("web_profile")->setVisible(!gSavedSettings.getString("WebProfileURL").empty()); - if(mTab && !sAllowFirstLife) + if (mTab && !sAllowFirstLife) { LLPanel* panel = mTab->getPanelByName("1st Life"); if (panel) mTab->removeTabPanel(panel); @@ -1377,19 +1195,11 @@ BOOL LLPanelAvatar::postBuild(void) panel = mTab->getPanelByName("WebProfile"); if (panel) mTab->removeTabPanel(panel); } - childSetVisible("Kick",FALSE); - childSetEnabled("Kick",FALSE); - childSetVisible("Freeze",FALSE); - childSetEnabled("Freeze",FALSE); - childSetVisible("Unfreeze",FALSE); - childSetEnabled("Unfreeze",FALSE); - childSetVisible("csr_btn", FALSE); - childSetEnabled("csr_btn", FALSE); //This text never changes. We simply toggle visibility. - childSetVisible("online_yes", FALSE); - childSetColor("online_yes",LLColor4::green); - childSetValue("online_yes","Currently Online"); + ctrl = getChild("online_yes"); + ctrl->setVisible(false); + ctrl->setColor(LLColor4::green); return TRUE; } @@ -1397,8 +1207,9 @@ BOOL LLPanelAvatar::postBuild(void) LLPanelAvatar::~LLPanelAvatar() { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID,this); + LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); sAllPanels.remove(this); + mCacheConnection.disconnect(); } @@ -1413,64 +1224,38 @@ void LLPanelAvatar::setOnlineStatus(EOnlineStatus online_status) // If they are a friend, we may know the truth! if ((ONLINE_STATUS_YES != online_status) && mIsFriend - && (LLAvatarTracker::instance().isBuddyOnline( mAvatarID ))) + && LLAvatarTracker::instance().isBuddyOnline(mAvatarID)) { online_status = ONLINE_STATUS_YES; } - - if(mPanelSecondLife) - mPanelSecondLife->childSetVisible("online_yes", online_status == ONLINE_STATUS_YES); + if(mPanelSecondLife) + mPanelSecondLife->childSetVisible("online_yes", online_status == ONLINE_STATUS_YES); + + LLView* offer_tp(getChildView("Offer Teleport...")); + LLView* map_stalk(getChildView("Find on Map")); // Since setOnlineStatus gets called after setAvatarID // need to make sure that "Offer Teleport" doesn't get set // to TRUE again for yourself - if (mAvatarID != gAgent.getID()) + if (mAvatarID != gAgentID) { - childSetVisible("Offer Teleport...",TRUE); - childSetVisible("Find on Map", true); - } + offer_tp->setVisible(true); + map_stalk->setVisible(true); - BOOL in_prelude = gAgent.inPrelude(); - if(gAgent.isGodlike()) - { - childSetEnabled("Offer Teleport...", TRUE); - childSetToolTip("Offer Teleport...", getString("TeleportGod")); - } - else if (in_prelude) - { - childSetEnabled("Offer Teleport...",FALSE); - childSetToolTip("Offer Teleport...", getString("TeleportPrelude")); - } - else - { - childSetEnabled("Offer Teleport...", TRUE /*(online_status == ONLINE_STATUS_YES)*/); - childSetToolTip("Offer Teleport...", getString("TeleportNormal")); - } - - // Note: we don't always know online status, so always allow gods to try to track - childSetEnabled("Find on Map", gAgent.isGodlike() || is_agent_mappable(mAvatarID)); - if (!mIsFriend) - { - childSetToolTip("Find on Map", getString("ShowOnMapNonFriend")); - } - else if (ONLINE_STATUS_YES != online_status) - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOffline")); - } - else - { - childSetToolTip("Find on Map", getString("ShowOnMapFriendOnline")); + bool prelude(gAgent.inPrelude()); + bool godlike(gAgent.isGodlike()); + offer_tp->setEnabled(!prelude /*(&& online_status == ONLINE_STATUS_YES)*/); + offer_tp->setToolTip(godlike ? getString("TeleportGod") : prelude ? getString("TeleportPrelude") : getString("TeleportNormal")); + // Note: we don't always know online status, so always allow gods to try to track + map_stalk->setEnabled(godlike || is_agent_mappable(mAvatarID)); + map_stalk->setToolTip(!mIsFriend ? getString("ShowOnMapNonFriend") : (ONLINE_STATUS_YES != online_status) ? getString("ShowOnMapFriendOffline") : getString("ShowOnMapFriendOnline")); } } void LLPanelAvatar::onAvatarNameResponse(const LLUUID& agent_id, const LLAvatarName& av_name) { - std::string name; - if (gSavedSettings.getBOOL("SinguCompleteNameProfiles")) - name = av_name.getCompleteName(); - else - LLAvatarNameCache::getPNSName(av_name, name); - getChild("dnname")->setText(name); + mCacheConnection.disconnect(); + getChild("dnname")->setText(gSavedSettings.getBOOL("SinguCompleteNameProfiles") ? av_name.getCompleteName() : av_name.getNSName()); } void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) @@ -1481,10 +1266,8 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) if (avatar_id != mAvatarID) { //avatar_changed = TRUE; - if(mAvatarID.notNull()) - { + if (mAvatarID.notNull()) LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarID, this); - } mAvatarID = avatar_id; } @@ -1496,7 +1279,7 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) // setOnlineStatus uses mIsFriend setOnlineStatus(ONLINE_STATUS_NO); - BOOL own_avatar = (mAvatarID == gAgent.getID() ); + bool own_avatar(mAvatarID == gAgentID); for(std::list::iterator it=mAvatarPanelList.begin();it!=mAvatarPanelList.end();++it) { @@ -1512,113 +1295,89 @@ void LLPanelAvatar::setAvatarID(const LLUUID &avatar_id) if (LLDropTarget* drop_target = findChild("drop_target_rect")) drop_target->setEntityID(mAvatarID); - LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); + mCacheConnection.disconnect(); + mCacheConnection = LLAvatarNameCache::get(avatar_id, boost::bind(&LLPanelAvatar::onAvatarNameResponse, this, _1, _2)); LLNameEditor* key_edit = getChild("avatar_key"); - if(key_edit) - { + if (key_edit) key_edit->setText(mAvatarID.asString()); - } -// if (avatar_changed) + + // While we're waiting for data off the network, clear out the old data. + if (mPanelSecondLife) + mPanelSecondLife->clearControls(); + if (mPanelPicks) + mPanelPicks->deletePickPanels(); + if (mPanelPicks) + mPanelPicks->setDataRequested(false); + if (mPanelClassified) + mPanelClassified->deleteClassifiedPanels(); + if (mPanelClassified) + mPanelClassified->setDataRequested(false); + if (mPanelNotes) + mPanelNotes->clearControls(); + if (mPanelNotes) + mPanelNotes->setDataRequested(false); + mHaveNotes = false; + mLastNotes.clear(); + + // Request just the first two pages of data. The picks, + // classifieds, and notes will be requested when that panel + // is made visible. JC + sendAvatarPropertiesRequest(); + + LLView* view(getChildView("OK")); + view->setVisible(own_avatar && mAllowEdit); + view->setEnabled(false); // OK button disabled until properties data arrives + view = getChildView("Cancel"); + view->setVisible(own_avatar && mAllowEdit); + view->setEnabled(own_avatar && mAllowEdit); + view = getChildView("Instant Message..."); + view->setVisible(!own_avatar); + view->setEnabled(false); + view = getChildView("GroupInvite_Button"); + view->setVisible(!own_avatar); + view->setEnabled(false); + view = getChildView("Mute"); + view->setVisible(!own_avatar); + view->setEnabled(false); + if (own_avatar) { - // While we're waiting for data off the network, clear out the - // old data. - if(mPanelSecondLife) mPanelSecondLife->clearControls(); - - if(mPanelPicks) mPanelPicks->deletePickPanels(); - if(mPanelPicks) mPanelPicks->setDataRequested(false); - - if(mPanelClassified) mPanelClassified->deleteClassifiedPanels(); - if(mPanelClassified) mPanelClassified->setDataRequested(false); - - if(mPanelNotes) mPanelNotes->clearControls(); - if(mPanelNotes) mPanelNotes->setDataRequested(false); - mHaveNotes = false; - mLastNotes.clear(); - - // Request just the first two pages of data. The picks, - // classifieds, and notes will be requested when that panel - // is made visible. JC - sendAvatarPropertiesRequest(); - - if (own_avatar) - { - if (mAllowEdit) - { - // OK button disabled until properties data arrives - childSetVisible("OK", true); - childSetEnabled("OK", false); - childSetVisible("Cancel",TRUE); - childSetEnabled("Cancel",TRUE); - } - else - { - childSetVisible("OK",FALSE); - childSetEnabled("OK",FALSE); - childSetVisible("Cancel",FALSE); - childSetEnabled("Cancel",FALSE); - } - childSetVisible("Instant Message...",FALSE); - childSetEnabled("Instant Message...",FALSE); - childSetVisible("GroupInvite_Button",FALSE); - childSetEnabled("GroupInvite_Button",FALSE); - childSetVisible("Mute",FALSE); - childSetEnabled("Mute",FALSE); - childSetVisible("Offer Teleport...",FALSE); - childSetEnabled("Offer Teleport...",FALSE); - childSetVisible("Find on Map",FALSE); - childSetEnabled("Find on Map",FALSE); - childSetVisible("Add Friend...",FALSE); - childSetEnabled("Add Friend...",FALSE); - childSetVisible("Pay...",FALSE); - childSetEnabled("Pay...",FALSE); - } - else - { - childSetVisible("OK",FALSE); - childSetEnabled("OK",FALSE); - - childSetVisible("Cancel",FALSE); - childSetEnabled("Cancel",FALSE); - - childSetVisible("Instant Message...",TRUE); - childSetEnabled("Instant Message...",FALSE); - childSetVisible("GroupInvite_Button",TRUE); - childSetEnabled("GroupInvite_Button",FALSE); - childSetVisible("Mute",TRUE); - childSetEnabled("Mute",FALSE); - - childSetVisible("Add Friend...", true); - childSetEnabled("Add Friend...", !mIsFriend); - childSetVisible("Pay...",TRUE); - childSetEnabled("Pay...",FALSE); - } - LLNameEditor* avatar_key = getChild("avatar_key"); - if (avatar_key) - { - avatar_key->setText(avatar_id.asString()); - } + view = getChildView("Offer Teleport..."); + view->setVisible(false); + view->setEnabled(false); + view = getChildView("Find on Map"); + view->setVisible(false); + view->setEnabled(false); } - + view = getChildView("Add Friend..."); + view->setVisible(!own_avatar); + view->setEnabled(!own_avatar && !mIsFriend); + view = getChildView("Pay..."); + view->setVisible(!own_avatar); + view->setEnabled(false); + + getChild("avatar_key")->setText(avatar_id.asString()); + bool is_god = gAgent.isGodlike(); - childSetVisible("Kick", is_god); - childSetEnabled("Kick", is_god); - childSetVisible("Freeze", is_god); - childSetEnabled("Freeze", is_god); - childSetVisible("Unfreeze", is_god); - childSetEnabled("Unfreeze", is_god); - childSetVisible("csr_btn", is_god); - childSetEnabled("csr_btn", is_god); + view = getChildView("Kick"); + view->setVisible(is_god); + view->setEnabled(is_god); + view = getChildView("Freeze"); + view->setVisible(is_god); + view->setEnabled(is_god); + view = getChildView("Unfreeze"); + view->setVisible(is_god); + view->setEnabled(is_god); + view = getChildView("csr_btn"); + view->setVisible(is_god); + view->setEnabled(is_god); } void LLPanelAvatar::resetGroupList() { // only get these updates asynchronously via the group floater, which works on the agent only - if (mAvatarID != gAgent.getID()) - { - return; - } + if (mAvatarID != gAgentID) return; if (mPanelSecondLife) { @@ -1632,41 +1391,26 @@ void LLPanelAvatar::resetGroupList() group_list->deleteAllItems(); S32 count = gAgent.mGroups.size(); - LLUUID id; - for(S32 i = 0; i < count; ++i) { LLGroupData group_data = gAgent.mGroups[i]; - id = group_data.mID; - std::string group_string; - /* Show group title? DUMMY_POWER for Don Grep - if(group_data.mOfficer) - { - group_string = "Officer of "; - } - else - { - group_string = "Member of "; - } - */ - group_string += group_data.mName; - LLSD row; - - row["id"] = id ; - row["columns"][0]["value"] = group_string; - row["columns"][0]["font"] = "SANSSERIF_SMALL"; + const LLUUID& id(group_data.mID); + LLScrollListItem::Params row; + row.value(id); std::string font_style = group_data.mListInProfile ? "BOLD" : "NORMAL"; - if(group_data.mID == gAgent.getGroupID()) + if (id == gAgent.getGroupID()) font_style.append("|ITALIC"); - row["columns"][0]["font-style"] = font_style; - row["columns"][0]["width"] = 0; - group_list->addElement(row,ADD_SORTED); + /* Show group title? DUMMY_POWER for Don Grep + (group_data.mOfficer ? "Officer of " : "Member of ") + group_data.mName; + */ + row.columns.add(LLScrollListCell::Params().value(group_data.mName).font("SANSSERIF_SMALL").font_style(font_style).width(0)); + group_list->addRow(row, ADD_SORTED); } - if(selected_id.notNull()) + if (selected_id.notNull()) group_list->selectByValue(selected_id); - if(selected_idx!=group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless. + if (selected_idx != group_list->getFirstSelectedIndex()) //if index changed then our stored pos is pointless. group_list->scrollToShowSelected(); else group_list->setScrollPos(scroll_pos); @@ -1674,76 +1418,45 @@ void LLPanelAvatar::resetGroupList() } } -//static -void LLPanelAvatar::onClickGetKey(void *userdata) +void LLPanelAvatar::onClickCopy(const LLSD& val) { - LLPanelAvatar* self = (LLPanelAvatar*)userdata; - LLUUID agent_id = self->getAvatarID(); - - llinfos << "Copy agent id: " << agent_id << llendl; - - gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); + if (val.isUndefined()) + { + llinfos << "Copy agent id: " << mAvatarID << llendl; + gViewerWindow->getWindow()->copyTextToClipboard(utf8str_to_wstring(mAvatarID.asString())); + } + else + { + void copy_profile_uri(const LLUUID& id, bool group = false); + copy_profile_uri(mAvatarID); + } } -// static -void LLPanelAvatar::onClickOK(void *userdata) +void LLPanelAvatar::onClickOK() { - LLPanelAvatar *self = (LLPanelAvatar *)userdata; - // JC: Only save the data if we actually got the original // properties. Otherwise we might save blanks into // the database. - if (self - && self->mHaveProperties) + if (mHaveProperties) { - self->sendAvatarPropertiesUpdate(); + sendAvatarPropertiesUpdate(); - LLTabContainer* tabs = self->getChild("tab"); - if ( tabs->getCurrentPanel() != self->mPanelClassified ) + if (mTab->getCurrentPanel() != mPanelClassified || mPanelClassified->titleIsValid()) { - self->mPanelClassified->apply(); + mPanelClassified->apply(); - LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID); - if (infop) - { + if (LLFloaterAvatarInfo* infop = LLFloaterAvatarInfo::getInstance(mAvatarID)) infop->close(); - } - } - else - { - if ( self->mPanelClassified->titleIsValid() ) - { - self->mPanelClassified->apply(); - - LLFloaterAvatarInfo *infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID); - if (infop) - { - infop->close(); - } - } } } } -// static -void LLPanelAvatar::onClickCancel(void *userdata) +void LLPanelAvatar::onClickCancel() { - LLPanelAvatar *self = (LLPanelAvatar *)userdata; - - if (self) - { - LLFloaterAvatarInfo *infop; - if ((infop = LLFloaterAvatarInfo::getInstance(self->mAvatarID))) - { - infop->close(); - } - else - { - // We're in the Search directory and are cancelling an edit - // to our own profile, so reset. - self->sendAvatarPropertiesRequest(); - } - } + if (LLFloaterAvatarInfo* infop = LLFloaterAvatarInfo::getInstance(mAvatarID)) + infop->close(); + else // We're in the Search directory and are cancelling an edit to our own profile, so reset. + sendAvatarPropertiesRequest(); } @@ -1758,25 +1471,17 @@ void LLPanelAvatar::sendAvatarNotesUpdate() { std::string notes = mPanelNotes->childGetValue("notes edit").asString(); - if (!mHaveNotes - && (notes.empty() || notes == getString("Loading"))) - { - // no notes from server and no user updates + if (!mHaveNotes && (notes.empty() || notes == getString("Loading")) || // no notes from server and no user updates + notes == mLastNotes) // Avatar notes unchanged return; - } - if (notes == mLastNotes) - { - // Avatar notes unchanged - return; - } - LLAvatarPropertiesProcessor::getInstance()->sendNotes(mAvatarID,notes); + LLAvatarPropertiesProcessor::instance().sendNotes(mAvatarID, notes); } // virtual void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) { - if(type == APT_PROPERTIES) + if (type == APT_PROPERTIES) { const LLAvatarData* pAvatarData = static_cast( data ); if (pAvatarData && (mAvatarID == pAvatarData->avatar_id) && (pAvatarData->avatar_id.notNull())) @@ -1797,18 +1502,11 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) t.tm_hour = t.tm_min = t.tm_sec = 0; timeStructToFormattedString(&t, gSavedSettings.getString("ShortDateFormat"), born_on); }*/ - - - bool online = (pAvatarData->flags & AVATAR_ONLINE); - - EOnlineStatus online_status = (online) ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; - - setOnlineStatus(online_status); - + setOnlineStatus(pAvatarData->flags & AVATAR_ONLINE ? ONLINE_STATUS_YES : ONLINE_STATUS_NO); childSetValue("about", pAvatarData->about_text); } } - else if(type == APT_NOTES) + else if (type == APT_NOTES) { const LLAvatarNotes* pAvatarNotes = static_cast( data ); if (pAvatarNotes && (mAvatarID == pAvatarNotes->target_id) && (pAvatarNotes->target_id != LLUUID::null)) @@ -1825,45 +1523,19 @@ void LLPanelAvatar::processProperties(void* data, EAvatarProcessorType type) // Otherwise you will write blanks back into the database. void LLPanelAvatar::enableOKIfReady() { - if(mHaveProperties && childIsVisible("OK")) - { - childSetEnabled("OK", TRUE); - } - else - { - childSetEnabled("OK", FALSE); - } + LLView* OK(getChildView("OK")); + OK->setEnabled(mHaveProperties && OK->getVisible()); } void LLPanelAvatar::sendAvatarPropertiesUpdate() { llinfos << "Sending avatarinfo update" << llendl; - BOOL allow_publish = FALSE; - if (LLPanelAvatar::sAllowFirstLife) - { - allow_publish = childGetValue("allow_publish"); - } - - LLUUID first_life_image_id; - std::string first_life_about_text; - if (mPanelFirstLife) - { - first_life_about_text = mPanelFirstLife->childGetValue("about").asString(); - LLTextureCtrl* image_ctrl = mPanelFirstLife->getChild("img"); - if(image_ctrl) - { - first_life_image_id = image_ctrl->getImageAssetID(); - } - } - - std::string about_text = mPanelSecondLife->childGetValue("about").asString(); - LLAvatarData avatar_data; avatar_data.image_id = mPanelSecondLife->getChild("img")->getImageAssetID(); - avatar_data.fl_image_id = first_life_image_id; - avatar_data.about_text = about_text; - avatar_data.fl_about_text = first_life_about_text; - avatar_data.allow_publish = allow_publish; + avatar_data.fl_image_id = mPanelFirstLife ? mPanelFirstLife->getChild("img")->getImageAssetID() : LLUUID::null; + avatar_data.about_text = mPanelSecondLife->childGetValue("about").asString(); + avatar_data.fl_about_text = mPanelFirstLife ? mPanelFirstLife->childGetValue("about").asString() : LLStringUtil::null; + avatar_data.allow_publish = sAllowFirstLife && childGetValue("allow_publish"); avatar_data.profile_url = mPanelWeb->childGetText("url_edit"); LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&avatar_data); @@ -1877,73 +1549,64 @@ void LLPanelAvatar::sendAvatarPropertiesUpdate() void LLPanelAvatar::selectTab(S32 tabnum) { - if(mTab) - { - mTab->selectTab(tabnum); - } + if (mTab) mTab->selectTab(tabnum); } void LLPanelAvatar::selectTabByName(std::string tab_name) { - if (mTab) - { - if (tab_name.empty()) - { - mTab->selectFirstTab(); - } - else - { - mTab->selectTabByName(tab_name); - } - } + if (!mTab) return; + if (tab_name.empty()) + mTab->selectFirstTab(); + else + mTab->selectTabByName(tab_name); } -void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) +void* LLPanelAvatar::createPanelAvatarSecondLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelSecondLife = new LLPanelAvatarSecondLife(std::string("2nd Life"),LLRect(),self); + self->mPanelSecondLife = new LLPanelAvatarSecondLife("2nd Life", LLRect(), self); return self->mPanelSecondLife; } -void* LLPanelAvatar::createPanelAvatarWeb(void* data) +void* LLPanelAvatar::createPanelAvatarWeb(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelWeb = new LLPanelAvatarWeb(std::string("Web"),LLRect(),self); + self->mPanelWeb = new LLPanelAvatarWeb("Web",LLRect(),self); return self->mPanelWeb; } -void* LLPanelAvatar::createPanelAvatarInterests(void* data) +void* LLPanelAvatar::createPanelAvatarInterests(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelAdvanced = new LLPanelAvatarAdvanced(std::string("Interests"),LLRect(),self); + self->mPanelAdvanced = new LLPanelAvatarAdvanced("Interests", LLRect(), self); return self->mPanelAdvanced; } -void* LLPanelAvatar::createPanelAvatarPicks(void* data) +void* LLPanelAvatar::createPanelAvatarPicks(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelPicks = new LLPanelAvatarPicks(std::string("Picks"),LLRect(),self); + self->mPanelPicks = new LLPanelAvatarPicks("Picks", LLRect(), self); return self->mPanelPicks; } -void* LLPanelAvatar::createPanelAvatarClassified(void* data) +void* LLPanelAvatar::createPanelAvatarClassified(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelClassified = new LLPanelAvatarClassified(std::string("Classified"),LLRect(),self); + self->mPanelClassified = new LLPanelAvatarClassified("Classified", LLRect(), self); return self->mPanelClassified; } -void* LLPanelAvatar::createPanelAvatarFirstLife(void* data) +void* LLPanelAvatar::createPanelAvatarFirstLife(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelFirstLife = new LLPanelAvatarFirstLife(std::string("1st Life"), LLRect(), self); + self->mPanelFirstLife = new LLPanelAvatarFirstLife("1st Life", LLRect(), self); return self->mPanelFirstLife; } -void* LLPanelAvatar::createPanelAvatarNotes(void* data) +void* LLPanelAvatar::createPanelAvatarNotes(void* data) { LLPanelAvatar* self = (LLPanelAvatar*)data; - self->mPanelNotes = new LLPanelAvatarNotes(std::string("My Notes"),LLRect(),self); + self->mPanelNotes = new LLPanelAvatarNotes("My Notes", LLRect(),self); return self->mPanelNotes; } diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index a7c18e796..89cf3b5dc 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -38,6 +38,7 @@ #include "lluuid.h" #include "llmediactrl.h" #include "llavatarpropertiesprocessor.h" +#include "llmutelist.h" class LLAvatarName; class LLCheckBoxCtrl; @@ -88,12 +89,10 @@ class LLPanelAvatarFirstLife : public LLPanelAvatarTab public: LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar); - /*virtual*/ BOOL postBuild(void); - + /*virtual*/ BOOL postBuild(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - static void onClickImage( void *userdata); - + void onClickImage(); void enableControls(BOOL own_avatar); }; @@ -101,33 +100,35 @@ public: class LLPanelAvatarSecondLife : public LLPanelAvatarTab +, public LLMuteListObserver { public: LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar ); + ~LLPanelAvatarSecondLife(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); /*virtual*/ void refresh(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); + /*virtual*/ void onChange() {} + /*virtual*/ void onChangeDetailed(const LLMute& mute); - static void onClickImage( void *userdata); - static void onClickFriends( void *userdata); - static void onDoubleClickGroup(void* userdata); - static void onClickPublishHelp(void *userdata); - static void onClickPartnerHelp(void *userdata); + void onClickImage(); + void onClickFriends(); + void onDoubleClickGroup(); static bool onClickPartnerHelpLoadURL(const LLSD& notification, const LLSD& response); - static void onClickPartnerInfo(void *userdata); // Clear out the controls anticipating new network data. void clearControls(); void enableControls(BOOL own_avatar); void updateOnlineText(BOOL online, BOOL have_calling_card); - void updatePartnerName(); + void updatePartnerName(const LLAvatarName& name); void setPartnerID(LLUUID id) { mPartnerID = id; } private: LLUUID mPartnerID; + boost::signals2::connection mCacheConnection; }; @@ -139,7 +140,7 @@ class LLPanelAvatarWeb : public: LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); /*virtual*/ ~LLPanelAvatarWeb(); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); /*virtual*/ void refresh(); @@ -149,11 +150,8 @@ public: void setWebURL(std::string url); - void load(std::string url); - void onURLKeystroke(LLLineEditor* editor); + void load(const std::string& url); void onCommitLoad(const LLSD& value); - void onCommitURL(const LLSD& value); - static void onClickWebProfileHelp(void *); // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); @@ -170,7 +168,7 @@ class LLPanelAvatarAdvanced : public LLPanelAvatarTab public: LLPanelAvatarAdvanced(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); @@ -197,7 +195,7 @@ class LLPanelAvatarNotes : public LLPanelAvatarTab public: LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); /*virtual*/ void refresh(); @@ -212,7 +210,7 @@ class LLPanelAvatarClassified : public LLPanelAvatarTab public: LLPanelAvatarClassified(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar); - /*virtual*/ BOOL postBuild(void); + /*virtual*/ BOOL postBuild(); /*virtual*/ void refresh(); @@ -230,11 +228,13 @@ public: void deleteClassifiedPanels(); private: - static void onClickNew(void* data); - static void onClickDelete(void* data); + void onClickNew(); + void onClickDelete(); bool callbackDelete(const LLSD& notification, const LLSD& response); bool callbackNew(const LLSD& notification, const LLSD& response); + + bool mInDirectory; }; @@ -253,13 +253,13 @@ public: void deletePickPanels(); private: - static void onClickNew(void* data); - static void onClickDelete(void* data); + void onClickNew(); + void onClickDelete(); //Pick import and export - RK - static void onClickImport(void* data); + void onClickImport(); static void onClickImport_continued(void* self, bool import); - static void onClickExport(void* data); + void onClickExport(); bool callbackDelete(const LLSD& notification, const LLSD& response); @@ -310,12 +310,12 @@ public: void selectTab(S32 tabnum); void selectTabByName(std::string tab_name); - BOOL haveData() { return mHaveProperties && mHaveStatistics; } - BOOL isEditable() const { return mAllowEdit; } + bool haveData() const { return mHaveProperties && mHaveStatistics; } + bool isEditable() const { return mAllowEdit; } - static void onClickGetKey(void *userdata); - static void onClickOK( void *userdata); - static void onClickCancel( void *userdata); + void onClickCopy(const LLSD& val); + void onClickOK(); + void onClickCancel(); private: void enableOKIfReady(); @@ -347,15 +347,16 @@ public: private: LLUUID mAvatarID; // for which avatar is this window? - BOOL mIsFriend; // Are we friends? - BOOL mHaveProperties; - BOOL mHaveStatistics; + bool mIsFriend; // Are we friends? + bool mHaveProperties; + bool mHaveStatistics; // only update note if data received from database and // note is changed from database version bool mHaveNotes; std::string mLastNotes; LLTabContainer* mTab; - BOOL mAllowEdit; + bool mAllowEdit; + boost::signals2::connection mCacheConnection; typedef std::list panel_list_t; static panel_list_t sAllPanels; diff --git a/indra/newview/llpaneldisplay.cpp b/indra/newview/llpaneldisplay.cpp index 1d4e23ded..1f979caab 100644 --- a/indra/newview/llpaneldisplay.cpp +++ b/indra/newview/llpaneldisplay.cpp @@ -407,6 +407,7 @@ void LLPanelDisplay::refresh() mAvatarVP = gSavedSettings.getBOOL("RenderAvatarVP"); mDeferred = gSavedSettings.getBOOL("RenderDeferred"); mDeferredDoF = gSavedSettings.getBOOL("RenderDepthOfField"); + mDeferredSSAO = gSavedSettings.getBOOL("RenderDeferredSSAO"); // combo boxes mReflectionDetail = gSavedSettings.getS32("RenderReflectionDetail"); @@ -672,6 +673,7 @@ void LLPanelDisplay::cancel() gSavedSettings.setBOOL("RenderAvatarVP", mAvatarVP); gSavedSettings.setBOOL("RenderDeferred", mDeferred); gSavedSettings.setBOOL("RenderDepthOfField", mDeferredDoF); + gSavedSettings.setBOOL("RenderDeferredSSAO", mDeferredSSAO); gSavedSettings.setS32("RenderReflectionDetail", mReflectionDetail); gSavedSettings.setS32("RenderShadowDetail", mShadowDetail); diff --git a/indra/newview/llpaneldisplay.h b/indra/newview/llpaneldisplay.h index 688757f9a..3c91d665d 100644 --- a/indra/newview/llpaneldisplay.h +++ b/indra/newview/llpaneldisplay.h @@ -125,6 +125,7 @@ protected: BOOL mWindLight; BOOL mDeferred; BOOL mDeferredDoF; + bool mDeferredSSAO; BOOL mAvatarVP; S32 mReflectionDetail; diff --git a/indra/newview/llpanelgroupbulk.cpp b/indra/newview/llpanelgroupbulk.cpp index c6e290963..6b5b4123f 100644 --- a/indra/newview/llpanelgroupbulk.cpp +++ b/indra/newview/llpanelgroupbulk.cpp @@ -159,9 +159,7 @@ void LLPanelGroupBulkImpl::onAvatarNameCache(const LLUUID& agent_id, const LLAva std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(agent_id); - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - names.push_back(name); + names.push_back(av_name.getNSName()); addUsers(names, agent_ids); } @@ -351,9 +349,7 @@ void LLPanelGroupBulk::addUserCallback(const LLUUID& id, const LLAvatarName& av_ std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(id); - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - names.push_back(name); + names.push_back(av_name.getNSName()); mImplementation->addUsers(names, agent_ids); } @@ -411,9 +407,7 @@ void LLPanelGroupBulk::addUsers(uuid_vec_t& agent_ids) } else { - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - names.push_back(name); + names.push_back(av_name.getNSName()); } } } diff --git a/indra/newview/llpanelgroupbulk.h b/indra/newview/llpanelgroupbulk.h index d03e4fca2..4c8081b73 100644 --- a/indra/newview/llpanelgroupbulk.h +++ b/indra/newview/llpanelgroupbulk.h @@ -71,3 +71,4 @@ protected: }; #endif // LL_LLPANELGROUPBULK_H + diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index 1899689d7..5915d355f 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -31,6 +31,7 @@ #include "llagent.h" #include "llavatarnamecache.h" +#include "llavataractions.h" #include "llfloateravatarpicker.h" #include "llbutton.h" #include "llcallingcard.h" @@ -101,6 +102,9 @@ BOOL LLPanelGroupBulkBan::postBuild() } mImplementation->mTooManySelected = getString("ban_selection_too_large"); + mImplementation->mBanNotPermitted = getString("ban_not_permitted"); + mImplementation->mBanLimitFail = getString("ban_limit_fail"); + mImplementation->mCannotBanYourself = getString("cant_ban_yourself"); update(); return TRUE; @@ -108,6 +112,25 @@ BOOL LLPanelGroupBulkBan::postBuild() void LLPanelGroupBulkBan::submit() { + if (!gAgent.hasPowerInGroup(mImplementation->mGroupID, GP_GROUP_BAN_ACCESS)) + { + // Fail! Agent no longer have ban rights. Permissions could have changed after button was pressed. + LLSD msg; + msg["MESSAGE"] = mImplementation->mBanNotPermitted; + LLNotificationsUtil::add("GenericAlert", msg); + (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); + return; + } + LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); + if (group_datap && group_datap->mBanList.size() >= GB_MAX_BANNED_AGENTS) + { + // Fail! Size limit exceeded. List could have updated after button was pressed. + LLSD msg; + msg["MESSAGE"] = mImplementation->mBanLimitFail; + LLNotificationsUtil::add("GenericAlert", msg); + (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); + return; + } std::vector banned_agent_list; std::vector agents = mImplementation->mBulkAgentList->getAllData(); std::vector::iterator iter = agents.begin(); @@ -117,8 +140,8 @@ void LLPanelGroupBulkBan::submit() banned_agent_list.push_back(agent->getUUID()); } - const S32 MAX_GROUP_BANS = 100; // Max invites per request. 100 to match server cap. - if (banned_agent_list.size() > MAX_GROUP_BANS) + const S32 MAX_BANS_PER_REQUEST = 100; // Max bans per request. 100 to match server cap. + if (banned_agent_list.size() > MAX_BANS_PER_REQUEST) { // Fail! LLSD msg; @@ -128,33 +151,100 @@ void LLPanelGroupBulkBan::submit() return; } - LLGroupMgrGroupData * group_datap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); + // remove already banned users and yourself from request. + std::vector banned_avatar_names; + std::vector out_of_limit_names; + bool banning_self = FALSE; + std::vector::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), gAgent.getID()); + if (conflict != banned_agent_list.end()) + { + banned_agent_list.erase(conflict); + banning_self = TRUE; + } if (group_datap) { BOOST_FOREACH(const LLGroupMgrGroupData::ban_list_t::value_type& group_ban_pair, group_datap->mBanList) { const LLUUID& group_ban_agent_id = group_ban_pair.first; - if (std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id) != banned_agent_list.end()) + std::vector::iterator conflict = std::find(banned_agent_list.begin(), banned_agent_list.end(), group_ban_agent_id); + if (conflict != banned_agent_list.end()) { - // Fail! - std::string av_name; - LLAvatarNameCache::getPNSName(group_ban_agent_id, av_name); + LLAvatarName av_name; + LLAvatarNameCache::get(group_ban_agent_id, &av_name); + banned_avatar_names.push_back(av_name); - LLStringUtil::format_map_t string_args; - string_args["[RESIDENT]"] = av_name; - - LLSD msg; - msg["MESSAGE"] = getString("already_banned", string_args); - LLNotificationsUtil::add("GenericAlert", msg); - (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); - return; + banned_agent_list.erase(conflict); + if (banned_agent_list.size() == 0) + { + break; + } } } + // this check should always be the last one before we send the request. + // Otherwise we have a possibility of cutting more then we need to. + if (banned_agent_list.size() > GB_MAX_BANNED_AGENTS - group_datap->mBanList.size()) + { + std::vector::iterator exeedes_limit = banned_agent_list.begin() + GB_MAX_BANNED_AGENTS - group_datap->mBanList.size(); + for (std::vector::iterator itor = exeedes_limit ; + itor != banned_agent_list.end(); ++itor) + { + LLAvatarName av_name; + LLAvatarNameCache::get(*itor, &av_name); + out_of_limit_names.push_back(av_name); + } + banned_agent_list.erase(exeedes_limit,banned_agent_list.end()); + } } - LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE | LLGroupMgr::BAN_UPDATE, banned_agent_list); - LLGroupMgr::getInstance()->sendGroupMemberEjects(mImplementation->mGroupID, banned_agent_list); + // sending request and ejecting members + if (banned_agent_list.size() != 0) + { + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE | LLGroupMgr::BAN_UPDATE, banned_agent_list); + LLGroupMgr::getInstance()->sendGroupMemberEjects(mImplementation->mGroupID, banned_agent_list); + } + + // building notification + if (banned_avatar_names.size() > 0 || banning_self || out_of_limit_names.size() > 0) + { + std::string reasons; + if(banned_avatar_names.size() > 0) + { + reasons = "\n " + buildResidentsArgument(banned_avatar_names, "residents_already_banned"); + } + + if(banning_self) + { + reasons += "\n " + mImplementation->mCannotBanYourself; + } + + if(out_of_limit_names.size() > 0) + { + reasons += "\n " + buildResidentsArgument(out_of_limit_names, "ban_limit_reached"); + } + + LLStringUtil::format_map_t msg_args; + msg_args["[REASONS]"] = reasons; + LLSD msg; + if (banned_agent_list.size() == 0) + { + msg["MESSAGE"] = getString("ban_failed", msg_args); + } + else + { + msg["MESSAGE"] = getString("partial_ban", msg_args); + } + LLNotificationsUtil::add("GenericAlert", msg); + } //then close (*(mImplementation->mCloseCallback))(mImplementation->mCloseCallbackUserData); } + +std::string LLPanelGroupBulkBan::buildResidentsArgument(std::vector avatar_names, const std::string &format) +{ + std::string names_string; + LLAvatarActions::buildResidentsString(avatar_names, names_string); + LLStringUtil::format_map_t args; + args["[RESIDENTS]"] = names_string; + return getString(format, args); +} diff --git a/indra/newview/llpanelgroupbulkban.h b/indra/newview/llpanelgroupbulkban.h index a4c071230..150bb43c7 100644 --- a/indra/newview/llpanelgroupbulkban.h +++ b/indra/newview/llpanelgroupbulkban.h @@ -40,7 +40,10 @@ public: virtual BOOL postBuild(); + //static void callbackClickSubmit(void* userdata); virtual void submit(); +private: + std::string buildResidentsArgument(std::vector avatar_names, const std::string &format); }; #endif // LL_LLPANELGROUPBULKBAN_H diff --git a/indra/newview/llpanelgroupbulkimpl.h b/indra/newview/llpanelgroupbulkimpl.h index 154b4cecf..235eeb8f9 100644 --- a/indra/newview/llpanelgroupbulkimpl.h +++ b/indra/newview/llpanelgroupbulkimpl.h @@ -74,6 +74,9 @@ public: std::string mLoadingText; std::string mTooManySelected; + std::string mBanNotPermitted; + std::string mBanLimitFail; + std::string mCannotBanYourself; std::set mInviteeIDs; @@ -94,3 +97,4 @@ public: }; #endif // LL_LLPANELGROUPBULKIMPL_H + diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index 5ae135380..122136654 100644 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -51,6 +51,8 @@ #include "lluictrlfactory.h" #include "llviewerwindow.h" +#include + class LLPanelGroupInvite::impl : public boost::signals2::trackable { public: @@ -69,7 +71,7 @@ public: static void callbackClickAdd(void* userdata); static void callbackClickRemove(void* userdata); static void callbackSelect(LLUICtrl* ctrl, void* userdata); - void callbackAddUsers(const uuid_vec_t& agent_idsa); + void callbackAddUsers(const uuid_vec_t& agent_ids); void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name); @@ -93,6 +95,8 @@ public: void (*mCloseCallback)(void* data); void* mCloseCallbackUserData; + + std::map mAvatarNameCacheConnection; }; @@ -106,14 +110,20 @@ LLPanelGroupInvite::impl::impl(const LLUUID& group_id): mGroupName( NULL ), mConfirmedOwnerInvite( false ), mCloseCallback( NULL ), - mCloseCallbackUserData( NULL ) + mCloseCallbackUserData( NULL ), + mAvatarNameCacheConnection() { } LLPanelGroupInvite::impl::~impl() { + for (std::map::const_iterator it = mAvatarNameCacheConnection.begin(); it != mAvatarNameCacheConnection.end(); ++it) + if ((*it).second.connected()) + (*it).second.disconnect(); } +const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap. + void LLPanelGroupInvite::impl::addUsers(const std::vector& names, const uuid_vec_t& agent_ids) { @@ -191,7 +201,6 @@ void LLPanelGroupInvite::impl::submitInvitations() role_member_pairs[item->getUUID()] = role_id; } - const S32 MAX_GROUP_INVITES = 100; // Max invites per request. 100 to match server cap. if (role_member_pairs.size() > MAX_GROUP_INVITES) { // Fail! @@ -381,7 +390,12 @@ void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids) std::vector names; for (S32 i = 0; i < (S32)agent_ids.size(); i++) { - LLAvatarNameCache::get(agent_ids[i], + const LLUUID& id(agent_ids[i]); + if (mAvatarNameCacheConnection[id].connected()) + { + mAvatarNameCacheConnection[id].disconnect(); + } + mAvatarNameCacheConnection[id] = LLAvatarNameCache::get(id, boost::bind(&LLPanelGroupInvite::impl::onAvatarNameCache, this, _1, _2)); } } @@ -389,6 +403,10 @@ void LLPanelGroupInvite::impl::callbackAddUsers(const uuid_vec_t& agent_ids) void LLPanelGroupInvite::impl::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { + if (mAvatarNameCacheConnection[agent_id].connected()) + { + mAvatarNameCacheConnection[agent_id].disconnect(); + } std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(agent_id); @@ -476,9 +494,7 @@ void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids) } else { - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - names.push_back(name); + names.push_back(av_name.getNSName()); } } } @@ -491,9 +507,7 @@ void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const LLAvatarName& a std::vector names; uuid_vec_t agent_ids; agent_ids.push_back(id); - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - names.push_back(name); + names.push_back(av_name.getNSName()); mImplementation->addUsers(names, agent_ids); } diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index d9afd5b04..6ceb330c1 100644 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -74,7 +74,7 @@ bool agentCanAddToRole(const LLUUID& group_id, if (!gdatap) { llwarns << "agentCanAddToRole " - << "-- No group data!" << llendl; + << "-- No group data!" << LL_ENDL; return false; } @@ -783,7 +783,7 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl, // Regardless of whether or not this ability is allowed by all or some, we want to prevent // the group managers from accidentally disabling either of the two additional abilities - // tied with GP_GROUP_BAN_ACCESS + // tied with GP_GROUP_BAN_ACCESS. if ( (allowed_by_all & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS || (allowed_by_some & GP_GROUP_BAN_ACCESS) == GP_GROUP_BAN_ACCESS) { @@ -1218,7 +1218,7 @@ void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, c { LLSD args; std::string av_name; - LLAvatarNameCache::getPNSName(*i, av_name); + LLAvatarNameCache::getNSName(*i, av_name); args["AVATAR_NAME"] = av_name; args["GROUP_NAME"] = group_data->mName; @@ -1699,6 +1699,12 @@ void LLPanelGroupMembersSubTab::addMemberToList(LLGroupMemberData* data) mHasMatch = TRUE; } +const S32& group_member_name_system() +{ + static const LLCachedControl name_system("GroupMembersNameSystem", 0); + return name_system; +} + void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemberData* member, const LLAvatarName& av_name, const LLUUID& av_id) { avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(av_id); @@ -1720,9 +1726,8 @@ void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, LLGroupMemb } // trying to avoid unnecessary hash lookups - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); // Singu Note: Diverge from LL Viewer and filter by name displayed - if (matchesSearchFilter(name)) + // Singu Note: Diverge from LL Viewer and filter by name displayed + if (matchesSearchFilter(av_name.getNSName(group_member_name_system()))) { addMemberToList(member); if(!mMembersList->getEnabled()) @@ -1771,11 +1776,11 @@ void LLPanelGroupMembersSubTab::updateMembers() continue; // Do filtering on name if it is already in the cache. - // Singu Note: Diverge from LL Viewer and filter by name displayed - std::string fullname; - if (LLAvatarNameCache::getPNSName(mMemberProgress->first, fullname)) + LLAvatarName av_name; + if (LLAvatarNameCache::get(mMemberProgress->first, &av_name)) { - if (matchesSearchFilter(fullname)) + // Singu Note: Diverge from LL Viewer and filter by name displayed + if (matchesSearchFilter(av_name.getNSName(group_member_name_system()))) { addMemberToList(mMemberProgress->second); } diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index 74712a649..572a35145 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -92,48 +92,43 @@ const S32 BLACK_BORDER_HEIGHT = 160; const S32 MAX_PASSWORD = 16; -LLPanelLogin *LLPanelLogin::sInstance = NULL; -BOOL LLPanelLogin::sCapslockDidNotification = FALSE; +LLPanelLogin* LLPanelLogin::sInstance = NULL; -static bool nameSplit(const std::string& full, std::string& first, std::string& last) { +static bool nameSplit(const std::string& full, std::string& first, std::string& last) +{ std::vector fragments; boost::algorithm::split(fragments, full, boost::is_any_of(" .")); if (!fragments.size() || !fragments[0].length()) return false; first = fragments[0]; - if (fragments.size() == 1) - { - if (gHippoGridManager->getCurrentGrid()->isAurora()) - last = ""; - else - last = "Resident"; - } - else - last = fragments[1]; + last = (fragments.size() == 1) ? + gHippoGridManager->getCurrentGrid()->isAurora() ? "" : "Resident" : + fragments[1]; return (fragments.size() <= 2); } -static std::string nameJoin(const std::string& first,const std::string& last, bool strip_resident) { +static std::string nameJoin(const std::string& first,const std::string& last, bool strip_resident) +{ if (last.empty() || (strip_resident && boost::algorithm::iequals(last, "Resident"))) return first; - else { - if(std::islower(last[0])) - return first + "." + last; - else - return first + " " + last; - } + else if (std::islower(last[0])) + return first + "." + last; + else + return first + " " + last; } -static std::string getDisplayString(const std::string& first, const std::string& last, const std::string& grid, bool is_secondlife) { +static std::string getDisplayString(const std::string& first, const std::string& last, const std::string& grid, bool is_secondlife) +{ //grid comes via LLSavedLoginEntry, which uses full grid names, not nicks - if(grid == gHippoGridManager->getDefaultGridName()) + if (grid == gHippoGridManager->getDefaultGridName()) return nameJoin(first, last, is_secondlife); else return nameJoin(first, last, is_secondlife) + " (" + grid + ")"; } -static std::string getDisplayString(const LLSavedLoginEntry& entry) { +static std::string getDisplayString(const LLSavedLoginEntry& entry) +{ return getDisplayString(entry.getFirstName(), entry.getLastName(), entry.getGrid(), entry.isSecondLife()); } @@ -176,18 +171,18 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) reshape(rect.getWidth(), rect.getHeight()); LLComboBox* username_combo(getChild("username_combo")); - username_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _1, this)); + username_combo->setCommitCallback(boost::bind(LLPanelLogin::onSelectLoginEntry, _2)); username_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onLoginComboLostFocus, this, username_combo)); username_combo->setPrevalidate(LLLineEditor::prevalidatePrintableNotPipe); username_combo->setSuppressTentative(true); username_combo->setSuppressAutoComplete(true); - childSetCommitCallback("remember_name_check", onNameCheckChanged); + getChild("remember_name_check")->setCommitCallback(boost::bind(&LLPanelLogin::onNameCheckChanged, this, _2)); LLLineEditor* password_edit(getChild("password_edit")); - password_edit->setKeystrokeCallback(onPassKey); + password_edit->setKeystrokeCallback(boost::bind(LLPanelLogin::onPassKey)); // STEAM-14: When user presses Enter with this field in focus, initiate login - password_edit->setCommitCallback(mungePassword, this); + password_edit->setCommitCallback(boost::bind(&LLPanelLogin::mungePassword, this, _2)); password_edit->setDrawAsterixes(TRUE); getChild("remove_login")->setCommitCallback(boost::bind(&LLPanelLogin::confirmDelete, this)); @@ -203,7 +198,7 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) location_combo->setAllowTextEntry(TRUE, 128, FALSE); location_combo->setFocusLostCallback( boost::bind(&LLPanelLogin::onLocationSLURL, this) ); - LLComboBox *server_choice_combo = getChild("grids_combo"); + LLComboBox* server_choice_combo = getChild("grids_combo"); server_choice_combo->setCommitCallback(boost::bind(&LLPanelLogin::onSelectGrid, _1)); server_choice_combo->setFocusLostCallback(boost::bind(&LLPanelLogin::onSelectGrid, server_choice_combo)); @@ -211,7 +206,7 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) updateGridCombo(); LLSLURL start_slurl(LLStartUp::getStartSLURL()); - if ( !start_slurl.isSpatial() ) // has a start been established by the command line or NextLoginLocation ? + if (!start_slurl.isSpatial()) // has a start been established by the command line or NextLoginLocation ? { // no, so get the preference setting std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); @@ -246,7 +241,7 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) findChild("login_html")->setDefaultBtn(connect_btn); } - childSetAction("grids_btn", onClickGrids, this); + getChild("grids_btn")->setCommitCallback(boost::bind(LLPanelLogin::onClickGrids)); std::string channel = gVersionChannel; @@ -258,7 +253,7 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) LLTextBox* channel_text = getChild("channel_text"); channel_text->setTextArg("[CHANNEL]", channel); // though not displayed channel_text->setTextArg("[VERSION]", version); - channel_text->setClickedCallback(boost::bind(&LLPanelLogin::onClickVersion,(void*)NULL)); + channel_text->setClickedCallback(boost::bind(LLFloaterAbout::show,(void*)NULL)); LLTextBox* forgot_password_text = getChild("forgot_password_text"); forgot_password_text->setClickedCallback(boost::bind(&onClickForgotPassword)); @@ -286,7 +281,7 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) for (LLSavedLoginsList::const_reverse_iterator i = saved_login_entries.rbegin(); i != saved_login_entries.rend(); ++i) { - LLSD e = i->asLLSD(); + const LLSD& e = i->asLLSD(); if (e.isMap() && gHippoGridManager->getGrid(i->getGrid())) username_combo->add(getDisplayString(*i), e); } @@ -297,44 +292,27 @@ LLPanelLogin::LLPanelLogin(const LLRect& rect) } } -void LLPanelLogin::setSiteIsAlive( bool alive ) +void LLPanelLogin::setSiteIsAlive(bool alive) { - LLMediaCtrl* web_browser = getChild("login_html"); - // if the contents of the site was retrieved - if ( alive ) + if (LLMediaCtrl* web_browser = getChild("login_html")) { - if ( web_browser ) - { + if (alive) // if the contents of the site was retrieved loadLoginPage(); - - web_browser->setVisible(true); - } - } - else - // the site is not available (missing page, server down, other badness) - { - if ( web_browser ) - { - // hide browser control (revealing default one) - web_browser->setVisible( FALSE ); + else // the site is not available (missing page, server down, other badness) web_browser->navigateTo( "data:text/html,%3Chtml%3E%3Cbody%20bgcolor=%22#000000%22%3E%3C/body%3E%3C/html%3E", "text/html" ); - } + web_browser->setVisible(alive); } } -void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data) +void LLPanelLogin::mungePassword(const std::string& password) { - LLPanelLogin* self = (LLPanelLogin*)user_data; - LLLineEditor* editor = (LLLineEditor*)caller; - std::string password = editor->getText(); - // Re-md5 if we've changed at all - if (password != self->mIncomingPassword) + if (password != mIncomingPassword) { LLMD5 pass((unsigned char *)password.c_str()); char munged_password[MD5HEX_STR_SIZE]; pass.hex_digest(munged_password); - self->mMungedPassword = munged_password; + mMungedPassword = munged_password; } } @@ -359,10 +337,8 @@ LLPanelLogin::~LLPanelLogin() LLSavedLogins::saveFile(mLoginHistoryData, login_hist_filepath); LLPanelLogin::sInstance = NULL; - if ( gFocusMgr.getDefaultKeyboardFocus() == this ) - { + if (gFocusMgr.getDefaultKeyboardFocus() == this) gFocusMgr.setDefaultKeyboardFocus(NULL); - } } // virtual @@ -411,25 +387,11 @@ BOOL LLPanelLogin::handleKeyHere(KEY key, MASK mask) return TRUE; } - if (('P' == key) && (MASK_CONTROL == mask)) - { - LLFloaterPreference::show(NULL); - return TRUE; - } - if (('T' == key) && (MASK_CONTROL == mask)) { new LLFloaterSimple("floater_test.xml"); return TRUE; } - - //Singu TODO: Re-implement f1 help. - /*if ( KEY_F1 == key ) - { - llinfos << "Spawning HTML help window" << llendl; - gViewerHtmlHelp.show(); - return TRUE; - }*/ # if !LL_RELEASE_FOR_DOWNLOAD if ( KEY_F2 == key ) @@ -601,9 +563,7 @@ void LLPanelLogin::setFields(const LLSavedLoginEntry& entry, bool takeFocus) } // static -void LLPanelLogin::getFields(std::string *firstname, - std::string *lastname, - std::string *password) +void LLPanelLogin::getFields(std::string& firstname, std::string& lastname, std::string& password) { if (!sInstance) { @@ -611,11 +571,11 @@ void LLPanelLogin::getFields(std::string *firstname, return; } - nameSplit(sInstance->getChild("username_combo")->getTextEntry(), *firstname, *lastname); - LLStringUtil::trim(*firstname); - LLStringUtil::trim(*lastname); + nameSplit(sInstance->getChild("username_combo")->getTextEntry(), firstname, lastname); + LLStringUtil::trim(firstname); + LLStringUtil::trim(lastname); - *password = sInstance->mMungedPassword; + password = sInstance->mMungedPassword; } // static @@ -649,9 +609,6 @@ void LLPanelLogin::updateLocationSelectorsVisibility() // [/RLVa:KB] sInstance->getChildView("location_panel")->setVisible(show_start); - - bool show_server = gSavedSettings.getBOOL("ForceShowGrid"); - sInstance->getChildView("grids_panel")->setVisible(show_server); } } @@ -674,19 +631,19 @@ void LLPanelLogin::onUpdateStartSLURL(const LLSLURL& new_start_slurl) * and the grid selector to match the new value. */ enum LLSLURL::SLURL_TYPE new_slurl_type = new_start_slurl.getType(); - switch ( new_slurl_type ) + switch (new_slurl_type) { case LLSLURL::LOCATION: { - location_combo->setCurrentByIndex( 2 ); + location_combo->setCurrentByIndex(2); location_combo->setTextEntry(new_start_slurl.getLocationString()); } break; case LLSLURL::HOME_LOCATION: - location_combo->setCurrentByIndex( 0 ); // home location + location_combo->setCurrentByIndex(0); // home location break; case LLSLURL::LAST_LOCATION: - location_combo->setCurrentByIndex( 1 ); // last location + location_combo->setCurrentByIndex(1); // last location break; default: LL_WARNS("AppInit")<<"invalid login slurl, using home"<getParent()->removeChild( LLPanelLogin::sInstance ); - + sInstance->getParent()->removeChild(sInstance); delete sInstance; sInstance = NULL; } @@ -719,27 +675,21 @@ void LLPanelLogin::close() void LLPanelLogin::setAlwaysRefresh(bool refresh) { if (sInstance && LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP) - { - LLMediaCtrl* web_browser = sInstance->getChild("login_html"); - - if (web_browser) - { + if (LLMediaCtrl* web_browser = sInstance->getChild("login_html")) web_browser->setAlwaysRefresh(refresh); - } - } } void LLPanelLogin::updateGridCombo() { - const std::string &defaultGrid = gHippoGridManager->getDefaultGridName(); + const std::string& defaultGrid = gHippoGridManager->getDefaultGridName(); - LLComboBox *grids = getChild("grids_combo"); + LLComboBox* grids = getChild("grids_combo"); std::string top_entry; grids->removeall(); - const HippoGridInfo *curGrid = gHippoGridManager->getCurrentGrid(); - const HippoGridInfo *defGrid = gHippoGridManager->getGrid(defaultGrid); + const HippoGridInfo* curGrid = gHippoGridManager->getCurrentGrid(); + const HippoGridInfo* defGrid = gHippoGridManager->getGrid(defaultGrid); S32 idx(-1); HippoGridManager::GridIterator it, end = gHippoGridManager->endGrid(); @@ -755,14 +705,14 @@ void LLPanelLogin::updateGridCombo() { if (defGrid) { - grids->add(defGrid->getGridName(),ADD_TOP); + grids->add(defGrid->getGridName(), ADD_TOP); ++idx; } grids->setCurrentByIndex(idx); } else { - grids->setLabel(LLStringExplicit("")); // LLComboBox::removeall() does not clear the label + grids->setLabel(LLStringUtil::null); // LLComboBox::removeall() does not clear the label } } @@ -800,7 +750,8 @@ void LLPanelLogin::loadLoginPage() // Grid - if (gHippoGridManager->getCurrentGrid()->isSecondLife()) { + if (gHippoGridManager->getCurrentGrid()->isSecondLife()) + { // find second life grid from login URI // yes, this is heuristic, but hey, it is just to get the right login page... std::string tmp = gHippoGridManager->getCurrentGrid()->getLoginUri(); @@ -827,7 +778,7 @@ void LLPanelLogin::loadLoginPage() // add OS info params["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple(); - + // Make an LLURI with this augmented info LLURI login_uri(LLURI::buildHTTP(login_page.authority(), login_page.path(), @@ -855,67 +806,33 @@ void LLPanelLogin::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev { } - -bool LLPanelLogin::getRememberLogin() -{ - bool remember = false; - - if (sInstance) - { - LLCheckBoxCtrl* remember_login = sInstance->getChild("remember_name_check"); - if (remember_login) - { - remember = remember_login->getValue().asBoolean(); - } - } - else - { - llwarns << "Attempted to query rememberLogin with no login view shown" << llendl; - } - - return remember; -} - //--------------------------------------------------------------------------- // Protected methods //--------------------------------------------------------------------------- -// static void LLPanelLogin::onClickConnect() { // JC - Make sure the fields all get committed. gFocusMgr.setKeyboardFocus(NULL); - std::string first, last, password; + std::string first, last; if (nameSplit(getChild("username_combo")->getTextEntry(), first, last)) - { - // has both first and last name typed LLStartUp::setStartupState(STATE_LOGIN_CLEANUP); - } + else if (gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()) + LLNotificationsUtil::add("MustHaveAccountToLogInNoLinks"); else - { - if (gHippoGridManager->getCurrentGrid()->getRegisterUrl().empty()) { - LLNotificationsUtil::add("MustHaveAccountToLogInNoLinks"); - } else { - LLNotificationsUtil::add("MustHaveAccountToLogIn", LLSD(), LLSD(), - LLPanelLogin::newAccountAlertCallback); - } - } + LLNotificationsUtil::add("MustHaveAccountToLogIn", LLSD(), LLSD(), + LLPanelLogin::newAccountAlertCallback); } // static bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); - if (0 == option) + if (0 == LLNotification::getSelectedOption(notification, response)) { llinfos << "Going to account creation URL" << llendl; - LLWeb::loadURLExternal( CREATE_ACCOUNT_URL ); - } - else - { - sInstance->setFocus(TRUE); + LLWeb::loadURLExternal(CREATE_ACCOUNT_URL); } return false; } @@ -924,18 +841,20 @@ bool LLPanelLogin::newAccountAlertCallback(const LLSD& notification, const LLSD& // static void LLPanelLogin::onClickNewAccount() { - const std::string &url = gHippoGridManager->getCurrentGrid()->getRegisterUrl(); - if (!url.empty()) { + const std::string& url = gHippoGridManager->getCurrentGrid()->getRegisterUrl(); + if (!url.empty()) + { llinfos << "Going to account creation URL." << llendl; LLWeb::loadURLExternal(url); - } else { + } + else + { llinfos << "Account creation URL is empty." << llendl; - sInstance->setFocus(TRUE); } } // static -void LLPanelLogin::onClickGrids(void*) +void LLPanelLogin::onClickGrids() { //LLFloaterPreference::overrideLastTab(LLPreferenceCore::TAB_GRIDS); LLFloaterPreference::show(NULL); @@ -943,39 +862,30 @@ void LLPanelLogin::onClickGrids(void*) } // static -void LLPanelLogin::onClickVersion(void*) -{ - LLFloaterAbout::show(NULL); -} - -//static void LLPanelLogin::onClickForgotPassword() { - if (sInstance ) - { - const std::string &url = gHippoGridManager->getCurrentGrid()->getPasswordUrl(); - if (!url.empty()) { - LLWeb::loadURLExternal(url); - } else { - llwarns << "Link for 'forgotton password' not set." << llendl; - } - } + const std::string& url = gHippoGridManager->getCurrentGrid()->getPasswordUrl(); + if (!url.empty()) + LLWeb::loadURLExternal(url); + else + llwarns << "Link for 'forgotton password' not set." << llendl; } // static -void LLPanelLogin::onPassKey(LLLineEditor* caller) +void LLPanelLogin::onPassKey() { - if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE) + static bool sCapslockDidNotification = false; + if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == false) { LLNotificationsUtil::add("CapsKeyOn"); - sCapslockDidNotification = TRUE; + sCapslockDidNotification = true; } } void LLPanelLogin::onCurGridChange(HippoGridInfo* new_grid, HippoGridInfo* old_grid) { refreshLoginPage(); - if(old_grid != new_grid) //Changed grid? Reset the location combobox + if (old_grid != new_grid) //Changed grid? Reset the location combobox { std::string defaultStartLocation = gSavedSettings.getString("LoginLocation"); LLSLURL defaultStart(defaultStartLocation); @@ -1074,66 +984,39 @@ void LLPanelLogin::onLocationSLURL() } //Special handling of name combobox. Facilitates grid-changing by account selection. -// static -void LLPanelLogin::onSelectLoginEntry(LLUICtrl* ctrl, void* data) +void LLPanelLogin::onSelectLoginEntry(const LLSD& selected_entry) { - if (sInstance) - { - LLComboBox* combo = sInstance->getChild("username_combo"); - if (ctrl == combo) - { - LLSD selected_entry = combo->getSelectedValue(); - if (!selected_entry.isUndefined()) - { - LLSavedLoginEntry entry(selected_entry); - setFields(entry); - } - // This stops the automatic matching of the first name to a selected grid. - LLViewerLogin::getInstance()->setNameEditted(true); - } - } + if (selected_entry.isMap()) + setFields(LLSavedLoginEntry(selected_entry)); + // This stops the automatic matching of the first name to a selected grid. + LLViewerLogin::getInstance()->setNameEditted(true); } void LLPanelLogin::onLoginComboLostFocus(LLComboBox* combo_box) { - if(combo_box->isTextDirty()) + if (combo_box->isTextDirty()) { - clearPassword(); + childSetText("password_edit", mIncomingPassword = mMungedPassword = LLStringUtil::null); combo_box->resetTextDirty(); } } -// static -void LLPanelLogin::onNameCheckChanged(LLUICtrl* ctrl, void* data) +void LLPanelLogin::onNameCheckChanged(const LLSD& value) { - if (sInstance) + if (LLCheckBoxCtrl* remember_pass_check = findChild("remember_check")) { - LLCheckBoxCtrl* remember_login_check = sInstance->getChild("remember_name_check"); - LLCheckBoxCtrl* remember_pass_check = sInstance->getChild("remember_check"); - if (remember_login_check && remember_pass_check) + if (value.asBoolean()) { - if (remember_login_check->getValue().asBoolean()) - { - remember_pass_check->setEnabled(true); - } - else - { - remember_pass_check->setValue(LLSD(false)); - remember_pass_check->setEnabled(false); - } + remember_pass_check->setEnabled(true); + } + else + { + remember_pass_check->setValue(LLSD(false)); + remember_pass_check->setEnabled(false); } } } -// static -void LLPanelLogin::clearPassword() -{ - std::string blank; - sInstance->childSetText("password_edit", blank); - sInstance->mIncomingPassword = blank; - sInstance->mMungedPassword = blank; -} - void LLPanelLogin::confirmDelete() { LLNotificationsUtil::add("ConfirmDeleteUser", LLSD(), LLSD(), boost::bind(&LLPanelLogin::removeLogin, this, boost::bind(LLNotificationsUtil::getSelectedOption, _1, _2))); diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 35c3f5890..661bc6df0 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -76,7 +76,7 @@ public: */ static void setFields(const LLSavedLoginEntry& entry, bool takeFocus = true); - static void getFields(std::string *firstname, std::string *lastname, std::string *password); + static void getFields(std::string& firstname, std::string& lastname, std::string& password); static void setLocation(const LLSLURL& slurl); @@ -94,8 +94,8 @@ public: static void refreshLoginPage(); static void giveFocus(); static void setAlwaysRefresh(bool refresh); - static void mungePassword(LLUICtrl* caller, void* user_data); - + void mungePassword(const std::string& password); + // inherited from LLViewerMediaObserver /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event); @@ -109,15 +109,13 @@ private: void onClickConnect(); static void onClickNewAccount(); static bool newAccountAlertCallback(const LLSD& notification, const LLSD& response); - static void onClickGrids(void*); + static void onClickGrids(); static void onSelectGrid(LLUICtrl *ctrl); - static void onClickVersion(void*); static void onClickForgotPassword(); - static void onPassKey(LLLineEditor* caller); - static void onSelectLoginEntry(LLUICtrl*, void*); + static void onPassKey(); + static void onSelectLoginEntry(const LLSD& selected_entry); void onLoginComboLostFocus(LLComboBox* combo_box); - static void onNameCheckChanged(LLUICtrl* ctrl, void* data); - static void clearPassword(); + void onNameCheckChanged(const LLSD& value); void confirmDelete(); void removeLogin(bool knot); @@ -132,12 +130,6 @@ public: return (sInstance ? sInstance->mLoginHistoryData : LLSavedLogins()); } - /** - * @brief Returns the state of the "remember resident name" checkbox if it exists. - * @return Checkbox state, or false if the instance is not instantiated. - */ - static bool getRememberLogin(); - private: LLPointer mLogoImage; @@ -145,7 +137,6 @@ private: std::string mMungedPassword; static LLPanelLogin* sInstance; - static BOOL sCapslockDidNotification; LLSavedLogins mLoginHistoryData; }; diff --git a/indra/newview/llpanelmarketplaceoutboxinventory.cpp b/indra/newview/llpanelmarketplaceoutboxinventory.cpp index 2a19fea07..090c32a81 100644 --- a/indra/newview/llpanelmarketplaceoutboxinventory.cpp +++ b/indra/newview/llpanelmarketplaceoutboxinventory.cpp @@ -91,7 +91,7 @@ LLFolderViewFolder * LLOutboxInventoryPanel::createFolderViewFolder(LLInvFVBridg return new LLOutboxFolderViewFolder( bridge->getDisplayName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), LLUI::getUIImage("inv_link_overlay.tga"), mFolderRoot.get(), bridge); @@ -102,7 +102,7 @@ LLFolderViewItem * LLOutboxInventoryPanel::createFolderViewItem(LLInvFVBridge * return new LLOutboxFolderViewItem( bridge->getDisplayName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), LLUI::getUIImage("inv_link_overlay.tga"), bridge->getCreationDate(), mFolderRoot.get(), diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index 95bbf36fc..1b764998c 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -1821,7 +1821,7 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root LLFolderViewFolder* new_folder = NULL; new_folder = new LLFolderViewFolder(inventory_root->getName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), NULL, mFolders, bridge); @@ -1860,7 +1860,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li { view = new LLFolderViewFolder(obj->getName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), NULL, mFolders, bridge); @@ -1871,7 +1871,7 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li { view = new LLFolderViewItem(obj->getName(), bridge->getIcon(), - bridge->getOpenIcon(), + bridge->getIconOpen(), NULL, bridge->getCreationDate(), mFolders, diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp index de4598d15..17480e870 100644 --- a/indra/newview/llpreview.cpp +++ b/indra/newview/llpreview.cpp @@ -262,15 +262,13 @@ void LLPreview::draw() { mDirty = FALSE; const LLViewerInventoryItem *item = getItem(); - if (item) - { - refreshFromItem(item); - } + refreshFromItem(item); } } void LLPreview::refreshFromItem(const LLInventoryItem* item) { + if (!item) return; setTitle(llformat("%s: %s",getTitleName(),item->getName().c_str())); childSetText("desc",item->getDescription()); diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index 9c8182cef..3cacdce81 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -3347,51 +3347,71 @@ void renderPhysicsShapes(LLSpatialGroup* group) for (LLSpatialGroup::OctreeNode::const_element_iter i = group->getDataBegin(); i != group->getDataEnd(); ++i) { LLDrawable* drawable = *i; - LLVOVolume* volume = drawable->getVOVolume(); - if (volume && !volume->isAttachment() && volume->getPhysicsShapeType() != LLViewerObject::PHYSICS_SHAPE_NONE ) + if (!drawable) { - if (!group->mSpatialPartition->isBridge()) + continue; + } + + if (drawable->isSpatialBridge()) + { + LLSpatialBridge* bridge = drawable->asPartition()->asBridge(); + + if (bridge) { gGL.pushMatrix(); - LLVector3 trans = drawable->getRegion()->getOriginAgent(); - gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); - renderPhysicsShape(drawable, volume); + gGL.multMatrix(bridge->mDrawable->getRenderMatrix()); + bridge->renderPhysicsShapes(); gGL.popMatrix(); } - else - { - renderPhysicsShape(drawable, volume); - } } else { - LLViewerObject* object = drawable->getVObj(); - if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) + LLVOVolume* volume = drawable->getVOVolume(); + if (volume && !volume->isAttachment() && volume->getPhysicsShapeType() != LLViewerObject::PHYSICS_SHAPE_NONE ) { - gGL.pushMatrix(); - gGL.multMatrix(object->getRegion()->mRenderMatrix); - //push face vertices for terrain - for (S32 i = 0; i < drawable->getNumFaces(); ++i) + if (!group->mSpatialPartition->isBridge()) { - LLFace* face = drawable->getFace(i); - if (face) + gGL.pushMatrix(); + LLVector3 trans = drawable->getRegion()->getOriginAgent(); + gGL.translatef(trans.mV[0], trans.mV[1], trans.mV[2]); + renderPhysicsShape(drawable, volume); + gGL.popMatrix(); + } + else + { + renderPhysicsShape(drawable, volume); + } + } + else + { + LLViewerObject* object = drawable->getVObj(); + if (object && object->getPCode() == LLViewerObject::LL_VO_SURFACE_PATCH) + { + gGL.pushMatrix(); + gGL.multMatrix(object->getRegion()->mRenderMatrix); + //push face vertices for terrain + for (S32 i = 0; i < drawable->getNumFaces(); ++i) { - LLVertexBuffer* buff = face->getVertexBuffer(); - if (buff) + LLFace* face = drawable->getFace(i); + if (face) { - glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); + LLVertexBuffer* buff = face->getVertexBuffer(); + if (buff) + { + glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); - buff->setBuffer(LLVertexBuffer::MAP_VERTEX); - gGL.diffuseColor3f(0.2f, 0.5f, 0.3f); - buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); + buff->setBuffer(LLVertexBuffer::MAP_VERTEX); + gGL.diffuseColor3f(0.2f, 0.5f, 0.3f); + buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); - gGL.diffuseColor3f(0.2f, 1.f, 0.3f); - glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); + gGL.diffuseColor3f(0.2f, 1.f, 0.3f); + glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); + buff->draw(LLRender::TRIANGLES, buff->getNumIndices(), 0); + } } } + gGL.popMatrix(); } - gGL.popMatrix(); } } } diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp index 2d0501ff5..c1a497e39 100644 --- a/indra/newview/llspeakers.cpp +++ b/indra/newview/llspeakers.cpp @@ -92,7 +92,7 @@ void LLSpeaker::onNameCache(const LLAvatarName& full_name) if (!name_system) mDisplayName = gCacheName->cleanFullName(full_name.getLegacyName()); else - LLAvatarNameCache::getPNSName(full_name, mDisplayName, name_system); + mDisplayName = full_name.getNSName(name_system); } bool LLSpeaker::isInVoiceChannel() diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 3621179de..1448681ce 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -838,6 +838,7 @@ bool idle_startup() firstname = gSavedSettings.getString("FirstName"); lastname = gSavedSettings.getString("LastName"); password = LLStartUp::loadPasswordFromDisk(); + gSavedSettings.setBOOL("RememberName", true); gSavedSettings.setBOOL("RememberPassword", TRUE); show_connect_box = false; @@ -1002,7 +1003,7 @@ bool idle_startup() { // TODO if not use viewer auth // Load all the name information out of the login view - LLPanelLogin::getFields(&firstname, &lastname, &password); + LLPanelLogin::getFields(firstname, lastname, password); // end TODO // HACK: Try to make not jump on login @@ -1013,8 +1014,6 @@ bool idle_startup() { gSavedSettings.setString("FirstName", firstname); gSavedSettings.setString("LastName", lastname); - if (!gSavedSettings.controlExists("RememberLogin")) gSavedSettings.declareBOOL("RememberLogin", false, "Remember login", false); - gSavedSettings.setBOOL("RememberLogin", LLPanelLogin::getRememberLogin()); LL_INFOS("AppInit") << "Attempting login as: " << firstname << " " << lastname << LL_ENDL; gDebugInfo["LoginName"] = firstname + " " + lastname; @@ -3524,10 +3523,10 @@ void LLStartUp::initNameCache() // Start cache in not-running state until we figure out if we have // capabilities for display name lookup - LLAvatarNameCache::initClass(false); S32 phoenix_name_system = gSavedSettings.getS32("PhoenixNameSystem"); - if(phoenix_name_system <= 0 || phoenix_name_system > 3) LLAvatarNameCache::setUseDisplayNames(false); - else LLAvatarNameCache::setUseDisplayNames(true); + LLAvatarNameCache::initClass(false, gSavedSettings.getBOOL("UsePeopleAPI")); + LLAvatarNameCache::setUseDisplayNames(phoenix_name_system > 0 && phoenix_name_system < 4); + LLAvatarNameCache::setUseUsernames(!phoenix_name_system || phoenix_name_system == 1 || phoenix_name_system == 3); } void LLStartUp::cleanupNameCache() @@ -3945,7 +3944,7 @@ bool process_login_success_response(std::string& password, U32& first_sim_size_x LLSavedLogins history_data = LLSavedLogins::loadFile(history_file); std::string grid_name = gHippoGridManager->getConnectedGrid()->getGridName(); history_data.deleteEntry(firstname, lastname, grid_name); - if (gSavedSettings.getBOOL("RememberLogin")) + if (gSavedSettings.getBOOL("RememberName")) { LLSavedLoginEntry login_entry(firstname, lastname, password, grid_name); history_data.addEntry(login_entry); diff --git a/indra/newview/lltool.cpp b/indra/newview/lltool.cpp index 0740fc38b..ca1939d67 100644 --- a/indra/newview/lltool.cpp +++ b/indra/newview/lltool.cpp @@ -89,7 +89,7 @@ BOOL LLTool::handleMouseDown(S32 x, S32 y, MASK mask) llinfos << "LLTool left mouse down" << llendl; } // by default, didn't handle it - // llinfos << "LLTool::handleMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleMouseDown" << LL_ENDL; gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_DOWN); return TRUE; } @@ -101,7 +101,7 @@ BOOL LLTool::handleMouseUp(S32 x, S32 y, MASK mask) llinfos << "LLTool left mouse up" << llendl; } // by default, didn't handle it - // llinfos << "LLTool::handleMouseUp" << llendl; + // LL_INFOS() << "LLTool::handleMouseUp" << LL_ENDL; gAgent.setControlFlags(AGENT_CONTROL_LBUTTON_UP); return TRUE; } @@ -117,13 +117,13 @@ BOOL LLTool::handleHover(S32 x, S32 y, MASK mask) BOOL LLTool::handleScrollWheel(S32 x, S32 y, S32 clicks) { // by default, didn't handle it - // llinfos << "LLTool::handleScrollWheel" << llendl; + // LL_INFOS() << "LLTool::handleScrollWheel" << LL_ENDL; return FALSE; } BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) { - // llinfos << "LLTool::handleDoubleClick" << llendl; + // LL_INFOS() << "LLTool::handleDoubleClick" << LL_ENDL; // by default, pretend it's a left click return FALSE; } @@ -131,35 +131,35 @@ BOOL LLTool::handleDoubleClick(S32 x,S32 y,MASK mask) BOOL LLTool::handleRightMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleRightMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleRightMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleRightMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleRightMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleMiddleMouseDown(S32 x,S32 y,MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleMiddleMouseDown" << llendl; + // LL_INFOS() << "LLTool::handleMiddleMouseDown" << LL_ENDL; return FALSE; } BOOL LLTool::handleMiddleMouseUp(S32 x, S32 y, MASK mask) { // by default, didn't handle it - // llinfos << "LLTool::handleMiddleMouseUp" << llendl; + // LL_INFOS() << "LLTool::handleMiddleMouseUp" << LL_ENDL; return FALSE; } BOOL LLTool::handleToolTip(S32 x, S32 y, std::string& msg, LLRect* sticky_rect_screen) { // by default, didn't handle it - // llinfos << "LLTool::handleToolTip" << llendl; + // LL_INFOS() << "LLTool::handleToolTip" << LL_ENDL; return FALSE; } @@ -197,9 +197,11 @@ LLTool* LLTool::getOverrideTool(MASK mask) { return NULL; } - if (mask & MASK_ALT) { - return LLToolCamera::getInstance(); + if (mask & MASK_ALT) + { + return LLToolCamera::getInstance(); + } } return NULL; } diff --git a/indra/newview/lltool.h b/indra/newview/lltool.h index 3fec2c8e8..d9f7af4db 100644 --- a/indra/newview/lltool.h +++ b/indra/newview/lltool.h @@ -45,7 +45,7 @@ class LLView; class LLPanel; class LLTool -: public LLMouseHandler +: public LLMouseHandler, public LLThreadSafeRefCount { public: LLTool( const std::string& name, LLToolComposite* composite = NULL ); diff --git a/indra/newview/lltoolbrush.cpp b/indra/newview/lltoolbrush.cpp index c3f2593c4..5049b0644 100644 --- a/indra/newview/lltoolbrush.cpp +++ b/indra/newview/lltoolbrush.cpp @@ -59,7 +59,7 @@ #include "llworld.h" #include "llappviewer.h" #include "llparcel.h" - +#include "roles_constants.h" #include "llglheaders.h" const std::string REGION_BLOCKS_TERRAFORM_MSG = "This region does not allow terraforming.\n" @@ -246,9 +246,9 @@ void LLToolBrushLand::modifyLandInSelectionGlobal() iter != mLastAffectedRegions.end(); ++iter) { LLViewerRegion* regionp = *iter; - if (!canTerraform(regionp)) + if (!canTerraformRegion(regionp)) { - alertNoTerraform(regionp); + alertNoTerraformRegion(regionp); return; } } @@ -383,12 +383,17 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) LLRegionPosition region_position( spot ); LLViewerRegion* regionp = region_position.getRegion(); - if (!canTerraform(regionp)) + if (!canTerraformRegion(regionp)) { - alertNoTerraform(regionp); + alertNoTerraformRegion(regionp); return TRUE; } + if (!canTerraformParcel(regionp)) + { + alertNoTerraformParcel(); + } + LLVector3 pos_region = region_position.getPositionRegion(); U32 grids = regionp->getLand().mGridsPerEdge; S32 i = llclamp( (S32)pos_region.mV[VX], 0, (S32)grids ); @@ -408,13 +413,23 @@ BOOL LLToolBrushLand::handleMouseDown(S32 x, S32 y, MASK mask) BOOL LLToolBrushLand::handleHover( S32 x, S32 y, MASK mask ) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolBrushLand (" + LL_DEBUGS("UserInput") << "hover handled by LLToolBrushLand (" << (hasMouseCapture() ? "active":"inactive") - << ")" << llendl; + << ")" << LL_ENDL; mMouseX = x; mMouseY = y; mGotHover = TRUE; gViewerWindow->getWindow()->setCursor(UI_CURSOR_TOOLLAND); + + LLVector3d spot; + if (gViewerWindow->mousePointOnLandGlobal(mMouseX, mMouseY, &spot)) + { + + spot.mdV[VX] = floor( spot.mdV[VX] + 0.5 ); + spot.mdV[VY] = floor( spot.mdV[VY] + 0.5 ); + + LLViewerParcelMgr::getInstance()->setHoverParcel(spot); + } return TRUE; } @@ -463,7 +478,7 @@ void LLToolBrushLand::render() { if(mGotHover) { - //llinfos << "LLToolBrushLand::render()" << llendl; + //LL_INFOS() << "LLToolBrushLand::render()" << LL_ENDL; LLVector3d spot; if(gViewerWindow->mousePointOnLandGlobal(mMouseX, mMouseY, &spot)) { @@ -660,7 +675,7 @@ void LLToolBrushLand::redo() }*/ // static -bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const +bool LLToolBrushLand::canTerraformRegion(LLViewerRegion* regionp) const { if (!regionp) return false; if (regionp->canManageEstate()) return true; @@ -668,7 +683,22 @@ bool LLToolBrushLand::canTerraform(LLViewerRegion* regionp) const } // static -void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp) +bool LLToolBrushLand::canTerraformParcel(LLViewerRegion* regionp) const +{ + LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel(); + bool is_terraform_allowed = false; + if (selected_parcel) + { + BOOL owner_release = LLViewerParcelMgr::isParcelOwnedByAgent(selected_parcel, GP_LAND_ALLOW_EDIT_LAND); + is_terraform_allowed = ( gAgent.canManageEstate() || (selected_parcel->getOwnerID() == regionp->getOwner()) || owner_release); + } + + return is_terraform_allowed; +} + + +// static +void LLToolBrushLand::alertNoTerraformRegion(LLViewerRegion* regionp) { if (!regionp) return; @@ -678,6 +708,19 @@ void LLToolBrushLand::alertNoTerraform(LLViewerRegion* regionp) } +// static +void LLToolBrushLand::alertNoTerraformParcel() +{ + LLParcel* selected_parcel = LLViewerParcelMgr::getInstance()->getHoverParcel(); + if (selected_parcel) + { + LLSD args; + args["PARCEL"] = selected_parcel->getName(); + LLNotificationsUtil::add("ParcelNoTerraforming", args); + } + +} + ///============================================================================ /// Local function definitions ///============================================================================ diff --git a/indra/newview/lltoolbrush.h b/indra/newview/lltoolbrush.h index fca275aa4..6aeea35b2 100644 --- a/indra/newview/lltoolbrush.h +++ b/indra/newview/lltoolbrush.h @@ -2,31 +2,25 @@ * @file lltoolbrush.h * @brief toolbrush class header file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * 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. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -87,10 +81,14 @@ protected: const LLVector3& pos_world); // Does region allow terraform, or are we a god? - bool canTerraform(LLViewerRegion* regionp) const; + bool canTerraformRegion(LLViewerRegion* regionp) const; + + bool canTerraformParcel(LLViewerRegion* regionp) const; // Modal dialog that you can't terraform the region - void alertNoTerraform(LLViewerRegion* regionp); + void alertNoTerraformRegion(LLViewerRegion* regionp); + + void alertNoTerraformParcel(); protected: F32 mStartingZ; diff --git a/indra/newview/lltoolcomp.cpp b/indra/newview/lltoolcomp.cpp index 85cc032a3..ea2ec627d 100644 --- a/indra/newview/lltoolcomp.cpp +++ b/indra/newview/lltoolcomp.cpp @@ -43,7 +43,6 @@ #include "lltoolmgr.h" #include "lltoolselectrect.h" #include "lltoolplacer.h" -#include "llviewercamera.h" // #include "llviewermenu.h" #include "llviewerobject.h" #include "llviewerwindow.h" @@ -51,7 +50,7 @@ #include "llagentcamera.h" #include "llfloatertools.h" #include "llviewercontrol.h" - +#include "llviewercamera.h" const S32 BUTTON_HEIGHT = 16; const S32 BUTTON_WIDTH_SMALL = 32; @@ -62,7 +61,7 @@ extern LLControlGroup gSavedSettings; // we use this in various places instead of NULL -static LLTool* sNullTool = new LLTool(std::string("null"), NULL); +static LLPointer sNullTool(new LLTool(std::string("null"), NULL)); //----------------------------------------------------------------------- // LLToolComposite @@ -129,12 +128,20 @@ void LLToolComposite::handleSelect() mSelected = TRUE; } +void LLToolComposite::handleDeselect() +{ + mCur->handleDeselect(); + mCur = mDefault; + mSelected = FALSE; +} + //---------------------------------------------------------------------------- // LLToolCompInspect //---------------------------------------------------------------------------- LLToolCompInspect::LLToolCompInspect() -: LLToolComposite(std::string("Inspect")) +: LLToolComposite(std::string("Inspect")), + mIsToolCameraActive(FALSE) { mSelectRect = new LLToolSelectRect(this); mDefault = mSelectRect; @@ -149,37 +156,49 @@ LLToolCompInspect::~LLToolCompInspect() BOOL LLToolCompInspect::handleMouseDown(S32 x, S32 y, MASK mask) { - mMouseDown = TRUE; - gViewerWindow->pickAsync(x, y, mask, pickCallback); - return TRUE; + BOOL handled = FALSE; + + if (mCur == LLToolCamera::getInstance()) + { + handled = mCur->handleMouseDown(x, y, mask); + } + else + { + mMouseDown = TRUE; + gViewerWindow->pickAsync(x, y, mask, pickCallback); + handled = TRUE; + } + + return handled; +} + +BOOL LLToolCompInspect::handleMouseUp(S32 x, S32 y, MASK mask) +{ + BOOL handled = LLToolComposite::handleMouseUp(x, y, mask); + mIsToolCameraActive = getCurrentTool() == LLToolCamera::getInstance(); + return handled; } void LLToolCompInspect::pickCallback(const LLPickInfo& pick_info) { LLViewerObject* hit_obj = pick_info.getObject(); + LLToolCompInspect* tool_inspectp = LLToolCompInspect::getInstance(); - if (!LLToolCompInspect::getInstance()->mMouseDown) + if (!tool_inspectp->mMouseDown) { // fast click on object, but mouse is already up...just do select - LLToolCompInspect::getInstance()->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); + tool_inspectp->mSelectRect->handleObjectSelection(pick_info, gSavedSettings.getBOOL("EditLinkedParts"), FALSE); return; } - if( hit_obj ) - { - if (LLSelectMgr::getInstance()->getSelection()->getObjectCount()) - { - LLEditMenuHandler::gEditMenuHandler = LLSelectMgr::getInstance(); - } - LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); - LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info ); + LLSelectMgr* mgr_selectp = LLSelectMgr::getInstance(); + if (hit_obj && mgr_selectp->getSelection()->getObjectCount()) { + LLEditMenuHandler::gEditMenuHandler = mgr_selectp; + } - } - else - { - LLToolCompInspect::getInstance()->setCurrentTool( LLToolCompInspect::getInstance()->mSelectRect ); - LLToolCompInspect::getInstance()->mSelectRect->handlePick( pick_info ); - } + tool_inspectp->setCurrentTool( tool_inspectp->mSelectRect ); + tool_inspectp->mIsToolCameraActive = FALSE; + tool_inspectp->mSelectRect->handlePick( pick_info ); } BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask) @@ -187,6 +206,39 @@ BOOL LLToolCompInspect::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } +BOOL LLToolCompInspect::handleKey(KEY key, MASK mask) +{ + BOOL handled = FALSE; + + if(KEY_ALT == key) + { + setCurrentTool(LLToolCamera::getInstance()); + mIsToolCameraActive = TRUE; + handled = TRUE; + } + else + { + handled = LLToolComposite::handleKey(key, mask); + } + + return handled; +} + +void LLToolCompInspect::onMouseCaptureLost() +{ + LLToolComposite::onMouseCaptureLost(); + mIsToolCameraActive = FALSE; +} + +void LLToolCompInspect::keyUp(KEY key, MASK mask) +{ + if (KEY_ALT == key && mCur == LLToolCamera::getInstance()) + { + setCurrentTool(mDefault); + mIsToolCameraActive = FALSE; + } +} + //---------------------------------------------------------------------------- // LLToolCompTranslate //---------------------------------------------------------------------------- @@ -400,6 +452,7 @@ LLTool* LLToolCompScale::getOverrideTool(MASK mask) { return LLToolCompRotate::getInstance(); } + return LLToolComposite::getOverrideTool(mask); } @@ -411,7 +464,6 @@ BOOL LLToolCompScale::handleDoubleClick(S32 x, S32 y, MASK mask) // You should already have an object selected from the mousedown. // If so, show its properties gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); - //gBuildView->setPropertiesPanelOpen(TRUE); return TRUE; } else @@ -609,7 +661,6 @@ BOOL LLToolCompRotate::handleDoubleClick(S32 x, S32 y, MASK mask) // You should already have an object selected from the mousedown. // If so, show its properties gFloaterTools->showPanel(LLFloaterTools::PANEL_CONTENTS); - //gBuildView->setPropertiesPanelOpen(TRUE); return TRUE; } else @@ -638,7 +689,7 @@ void LLToolCompRotate::render() LLToolCompGun::LLToolCompGun() : LLToolComposite(std::string("Mouselook")) - , mMenuShown(false), mTimerFOV(), mOriginalFOV(), mStartFOV(), mTargetFOV() // + , mMenuShown(false), mTimerFOV(), mOriginalFOV(), mStartFOV(), mTargetFOV() { mGun = new LLToolGun(this); mGrab = new LLToolGrab(this); @@ -647,11 +698,10 @@ LLToolCompGun::LLToolCompGun() setCurrentTool(mGun); mDefault = mGun; - // mTimerFOV.stop(); - // } + LLToolCompGun::~LLToolCompGun() { delete mGun; @@ -665,6 +715,45 @@ LLToolCompGun::~LLToolCompGun() mNull = NULL; } +BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) +{ + // if the left button is grabbed, don't put up the pie menu + if (gAgent.leftButtonGrabbed()) + { + gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); + return FALSE; + } + + // On mousedown, start grabbing + gGrabTransientTool = this; + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); + + return LLToolGrab::getInstance()->handleMouseDown(x, y, mask); +} + +BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) +{ + gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP); + setCurrentTool( (LLTool*) mGun ); + return TRUE; +} + +BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) +{ + // if the left button is grabbed, don't put up the pie menu + if (gAgent.leftButtonGrabbed()) + { + gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); + return FALSE; + } + + // On mousedown, start grabbing + gGrabTransientTool = this; + LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); + + return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask); +} + BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) { // *NOTE: This hack is here to make mouselook kick in again after @@ -700,48 +789,45 @@ BOOL LLToolCompGun::handleHover(S32 x, S32 y, MASK mask) return TRUE; } - -BOOL LLToolCompGun::handleMouseDown(S32 x, S32 y, MASK mask) -{ - // if the left button is grabbed, don't put up the pie menu - if (gAgent.leftButtonGrabbed()) - { - gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); - return FALSE; - } - - // On mousedown, start grabbing - gGrabTransientTool = this; - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); - - return LLToolGrab::getInstance()->handleMouseDown(x, y, mask); -} - - -BOOL LLToolCompGun::handleDoubleClick(S32 x, S32 y, MASK mask) -{ - // if the left button is grabbed, don't put up the pie menu - if (gAgent.leftButtonGrabbed()) - { - gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_DOWN); - return FALSE; - } - - // On mousedown, start grabbing - gGrabTransientTool = this; - LLToolMgr::getInstance()->getCurrentToolset()->selectTool( (LLTool*) mGrab ); - - return LLToolGrab::getInstance()->handleDoubleClick(x, y, mask); -} - -/* Singu Note: Moved to bottom, upstream is Exodus BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) -*/ - -BOOL LLToolCompGun::handleMouseUp(S32 x, S32 y, MASK mask) { - gAgent.setControlFlags(AGENT_CONTROL_ML_LBUTTON_UP); - setCurrentTool( (LLTool*) mGun ); + // Singu Note: Beware the alt-click menu + if (gSavedSettings.getBOOL("LiruMouselookMenu") && mask & MASK_ALT) + { + mMenuShown = true; + return false; + } + + LLViewerCamera& cam(LLViewerCamera::instance()); + if (!mTimerFOV.getStarted()) + { + mStartFOV = cam.getAndSaveDefaultFOV(); + mOriginalFOV = mStartFOV; + } + else mStartFOV = cam.getDefaultFOV(); + + mTargetFOV = gSavedSettings.getF32("ExodusAlternativeFOV"); + gSavedSettings.getBOOL("LiruMouselookInstantZoom") ? cam.setDefaultFOV(mTargetFOV) : mTimerFOV.start(); + cam.mSavedFOVLoaded = false; + + return TRUE; +} + +BOOL LLToolCompGun::handleRightMouseUp(S32 x, S32 y, MASK mask) +{ + // Singu Note: Beware the alt-click menu + if (mMenuShown) + { + mMenuShown = false; + return LLToolComposite::handleRightMouseUp(x, y, mask); + } + + LLViewerCamera& cam(LLViewerCamera::instance()); + mStartFOV = cam.getDefaultFOV(); + mTargetFOV = mOriginalFOV; + gSavedSettings.getBOOL("LiruMouselookInstantZoom") ? cam.setDefaultFOV(mTargetFOV) : mTimerFOV.start(); + cam.mSavedFOVLoaded = false; + return TRUE; } @@ -771,49 +857,6 @@ void LLToolCompGun::handleDeselect() setMouseCapture(FALSE); } -// - -BOOL LLToolCompGun::handleRightMouseUp(S32 x, S32 y, MASK mask) -{ - // Singu Note: Beware the alt-click menu - if (mMenuShown) - { - mMenuShown = false; - return LLToolComposite::handleRightMouseUp(x, y, mask); - } - - LLViewerCamera& cam(LLViewerCamera::instance()); - mStartFOV = cam.getDefaultFOV(); - mTargetFOV = mOriginalFOV; - gSavedSettings.getBOOL("LiruMouselookInstantZoom") ? cam.setDefaultFOV(mTargetFOV) : mTimerFOV.start(); - cam.mSavedFOVLoaded = false; - - return TRUE; -} - -BOOL LLToolCompGun::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - // Singu Note: Beware the alt-click menu - if (gSavedSettings.getBOOL("LiruMouselookMenu") && mask & MASK_ALT) - { - mMenuShown = true; - return false; - } - - LLViewerCamera& cam(LLViewerCamera::instance()); - if (!mTimerFOV.getStarted()) - { - mStartFOV = cam.getAndSaveDefaultFOV(); - mOriginalFOV = mStartFOV; - } - else mStartFOV = cam.getDefaultFOV(); - - mTargetFOV = gSavedSettings.getF32("ExodusAlternativeFOV"); - gSavedSettings.getBOOL("LiruMouselookInstantZoom") ? cam.setDefaultFOV(mTargetFOV) : mTimerFOV.start(); - cam.mSavedFOVLoaded = false; - - return TRUE; -} BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) { @@ -829,16 +872,19 @@ BOOL LLToolCompGun::handleScrollWheel(S32 x, S32 y, S32 clicks) llclamp(mTargetFOV -= (0.05f * -clicks), 0.1f, 3.0f) ); - gSavedSettings.getBOOL("LiruMouselookInstantZoom") ? cam.setDefaultFOV(mTargetFOV) : mTimerFOV.start(); + if (gSavedSettings.getBOOL("LiruMouselookInstantZoom")) + cam.setDefaultFOV(mTargetFOV); + else + mTimerFOV.start(); cam.mSavedFOVLoaded = false; } - else if (clicks > 0) gAgentCamera.changeCameraToDefault(); - + else if (clicks > 0) + { + gAgentCamera.changeCameraToDefault(); + } return TRUE; } -// Zoom related stuff... - void LLToolCompGun::draw() { if (mTimerFOV.getStarted()) @@ -857,7 +903,5 @@ void LLToolCompGun::draw() } else mTimerFOV.stop(); } - LLToolComposite::draw(); // Singu Note: We call parent here, instead of being clueless and adding to LLViewerWindow::draw for crosshairs and such + LLToolComposite::draw(); } - -// diff --git a/indra/newview/lltoolcomp.h b/indra/newview/lltoolcomp.h index c1169f0ec..20485e3e0 100644 --- a/indra/newview/lltoolcomp.h +++ b/indra/newview/lltoolcomp.h @@ -62,7 +62,7 @@ public: virtual BOOL clipMouseWhenDown() { return mCur->clipMouseWhenDown(); } virtual void handleSelect(); - virtual void handleDeselect() { mCur->handleDeselect(); mCur = mDefault; mSelected = FALSE; } + virtual void handleDeselect(); virtual void render() { mCur->render(); } virtual void draw() { mCur->draw(); } @@ -78,9 +78,10 @@ public: { mCur->localPointToScreen(local_x, local_y, screen_x, screen_y); } BOOL isSelecting(); + LLTool* getCurrentTool() { return mCur; } + protected: void setCurrentTool( LLTool* new_tool ); - LLTool* getCurrentTool() { return mCur; } // In hover handler, call this to auto-switch tools void setToolFromMask( MASK mask, LLTool *normal ); @@ -108,9 +109,18 @@ public: // Overridden from LLToolComposite virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleKey(KEY key, MASK mask); + virtual void onMouseCaptureLost(); + void keyUp(KEY key, MASK mask); static void pickCallback(const LLPickInfo& pick_info); + + BOOL isToolCameraActive() const { return mIsToolCameraActive; } + +private: + BOOL mIsToolCameraActive; }; //----------------------------------------------------------------------- @@ -213,15 +223,15 @@ public: LLToolCompGun(); virtual ~LLToolCompGun(); - virtual void draw(); // + virtual void draw(); // Overridden from LLToolComposite - virtual BOOL handleHover(S32 x, S32 y, MASK mask); virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); - virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); - virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask); + virtual BOOL handleDoubleClick(S32 x, S32 y, MASK mask); + virtual BOOL handleHover(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseDown(S32 x, S32 y, MASK mask); + virtual BOOL handleRightMouseUp(S32 x, S32 y, MASK mask); virtual BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); virtual void onMouseCaptureLost(); virtual void handleSelect(); @@ -233,12 +243,12 @@ protected: LLToolGrab* mGrab; LLTool* mNull; - // private: bool mMenuShown; LLTimer mTimerFOV; - F32 mOriginalFOV, mStartFOV, mTargetFOV; - // + F32 mOriginalFOV, + mStartFOV, + mTargetFOV; }; diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 2cdfd172a..2f2a32149 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -313,6 +313,7 @@ BOOL LLToolCamera::handleMouseUp(S32 x, S32 y, MASK mask) return TRUE; } + BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) { if (gViewerWindow->getRightMouseDown()) @@ -343,7 +344,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) { if (!mValidClickPoint) { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [invalid point]" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [invalid point]" << LL_ENDL; gViewerWindow->setCursor(UI_CURSOR_NO); gViewerWindow->showCursor(); return TRUE; @@ -370,7 +371,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolFocus [active]" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolFocus [active]" << LL_ENDL; } else if ( gCameraBtnPan || mask == MASK_PAN || @@ -398,7 +399,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPan" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolPan" << LL_ENDL; } else if (gCameraBtnZoom) { @@ -430,7 +431,7 @@ BOOL LLToolCamera::handleHover(S32 x, S32 y, MASK mask) gViewerWindow->moveCursorToCenter(); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolZoom" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolZoom" << LL_ENDL; } } diff --git a/indra/newview/lltoolmgr.cpp b/indra/newview/lltoolmgr.cpp index 542256af0..ad7160788 100644 --- a/indra/newview/lltoolmgr.cpp +++ b/indra/newview/lltoolmgr.cpp @@ -36,6 +36,7 @@ #include "llfirstuse.h" // tools and manipulators +#include "llfloaterinspect.h" #include "lltool.h" #include "llmanipscale.h" #include "llselectmgr.h" @@ -55,8 +56,6 @@ #include "llagent.h" #include "llagentcamera.h" #include "llviewercontrol.h" -#include "llmemberlistener.h" -#include "llevent.h" #include "llviewerjoystick.h" #include "llviewermenu.h" #include "llviewerparcelmgr.h" @@ -77,24 +76,6 @@ LLToolset* gFaceEditToolset = NULL; ///////////////////////////////////////////////////// // LLToolMgr -class LLViewBuildMode : public LLMemberListener -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - LLToolMgr::getInstance()->toggleBuildMode(); - return true; - } -}; -class LLViewCheckBuildMode : public LLMemberListener -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - bool new_value = LLToolMgr::getInstance()->inEdit(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } -}; - LLToolMgr::LLToolMgr() : mBaseTool(NULL), @@ -112,14 +93,8 @@ LLToolMgr::LLToolMgr() // gLandToolset = new LLToolset("Land"); gMouselookToolset = new LLToolset("MouseLook"); gFaceEditToolset = new LLToolset("FaceEdit"); -} - -void LLToolMgr::initMenu(std::vector > >& menu_list) -{ - menu_list.push_back(new LLViewBuildMode()); - menu_list.back()->registerListener(gMenuHolder, "View.BuildMode"); - menu_list.push_back(new LLViewCheckBuildMode()); - menu_list.back()->registerListener(gMenuHolder, "View.CheckBuildMode"); + gMouselookToolset->setShowFloaterTools(false); + gFaceEditToolset->setShowFloaterTools(false); } void LLToolMgr::initTools() @@ -249,7 +224,19 @@ LLTool* LLToolMgr::getCurrentTool() } if (cur_tool) { - cur_tool->handleSelect(); + if (LLToolCompInspect::getInstance()->isToolCameraActive() + && prev_tool == LLToolCamera::getInstance() + && cur_tool == LLToolPie::getInstance()) + { + if (LLFloaterInspect::instanceVisible()) + { + setTransientTool(LLToolCompInspect::getInstance()); + } + } + else + { + cur_tool->handleSelect(); + } } } diff --git a/indra/newview/lltoolmgr.h b/indra/newview/lltoolmgr.h index 31a481b17..c2a18ccb9 100644 --- a/indra/newview/lltoolmgr.h +++ b/indra/newview/lltoolmgr.h @@ -35,11 +35,8 @@ #include "llkeyboard.h" -#include "llmemberlistener.h" - class LLTool; class LLToolset; -class LLView; // Key bindings for common operations const MASK MASK_VERTICAL = MASK_CONTROL; @@ -55,8 +52,6 @@ public: LLToolMgr(); ~LLToolMgr(); - void initMenu(std::vector > >& menu_list); - // Must be called after gSavedSettings set up. void initTools(); @@ -100,7 +95,7 @@ protected: class LLToolset { public: - LLToolset(const char *name) : mSelectedTool(NULL), mName(name) {} + LLToolset(const char* name) : mSelectedTool(NULL), mName(name), mIsShowFloaterTools(true) {} LLTool* getSelectedTool() { return mSelectedTool; } @@ -116,12 +111,16 @@ public: BOOL isToolSelected( S32 index ); + void setShowFloaterTools(bool pShowFloaterTools) {mIsShowFloaterTools = pShowFloaterTools;}; + bool isShowFloaterTools() const {return mIsShowFloaterTools;}; const char* getName() const {return mName;} + protected: const char* mName; LLTool* mSelectedTool; typedef std::vector tool_list_t; tool_list_t mToolList; + bool mIsShowFloaterTools; }; // Globals diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 06509dc95..1b112943f 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -128,9 +128,10 @@ BOOL LLToolPie::handleRightMouseDown(S32 x, S32 y, MASK mask) mPick.mKeyMask = mask; // claim not handled so UI focus stays same - - handleRightClickPick(); - + if (gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK || gSavedSettings.getBOOL("LiruMouselookMenu")) + { + handleRightClickPick(); + } return FALSE; } @@ -375,7 +376,7 @@ BOOL LLToolPie::handleLeftClickPick() } object = (LLViewerObject*)object->getParent(); } - if (object && object == gAgentAvatarp && !gSavedSettings.getBOOL("ClickToWalk")) + if (object && object == gAgentAvatarp /*&& gSavedSettings.getBOOL("ClickToWalk")*/) { // we left clicked on avatar, switch to focus mode mMouseButtonDown = false; @@ -818,7 +819,8 @@ void LLToolPie::handleDeselect() LLTool* LLToolPie::getOverrideTool(MASK mask) { - if (gSavedSettings.getBOOL("EnableGrab")) + static LLCachedControl enable_grab(gSavedSettings, "EnableGrab", true); + if (enable_grab) { if (mask == MASK_CONTROL) { @@ -956,7 +958,7 @@ bool LLToolPie::handleMediaHover(const LLPickInfo& pick) LLPointer objectp = pick.getObject(); - // Early out cases. Must clear mouse over media focus flag + // Early out cases. Must clear media hover. // did not hit an object or did not hit a valid face if ( objectp.isNull() || pick.mObjectFace < 0 || @@ -1230,8 +1232,12 @@ BOOL LLToolPie::handleRightClickPick() void LLToolPie::showVisualContextMenuEffect() { // - if (gSavedSettings.getBOOL("DisablePointAtAndBeam")) return; + if (gSavedSettings.getBOOL("DisablePointAtAndBeam")) + { + return; + } // + // VEFFECT: ShowPie LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_SPHERE, TRUE); effectp->setPositionGlobal(mPick.mPosGlobal); diff --git a/indra/newview/lltoolselect.h b/indra/newview/lltoolselect.h index 37f28ccc7..4d7606ec2 100644 --- a/indra/newview/lltoolselect.h +++ b/indra/newview/lltoolselect.h @@ -2,31 +2,25 @@ * @file lltoolselect.h * @brief LLToolSelect class header file * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -40,7 +34,7 @@ class LLObjectSelection; -class LLToolSelect : public LLTool, public LLSingleton +class LLToolSelect : public LLTool { public: LLToolSelect( LLToolComposite* composite ); diff --git a/indra/newview/lltoolselectrect.cpp b/indra/newview/lltoolselectrect.cpp index f57820afd..07f0cae82 100644 --- a/indra/newview/lltoolselectrect.cpp +++ b/indra/newview/lltoolselectrect.cpp @@ -38,7 +38,6 @@ // Library includes #include "llgl.h" #include "llrender.h" -#include "lldarray.h" // Viewer includes #include "llviewercontrol.h" @@ -152,11 +151,11 @@ BOOL LLToolSelectRect::handleHover(S32 x, S32 y, MASK mask) return LLToolSelect::handleHover(x, y, mask); } - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (active)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (active)" << LL_ENDL; } else { - lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolSelectRect (inactive)" << llendl; + LL_DEBUGS("UserInput") << "hover handled by LLToolSelectRect (inactive)" << LL_ENDL; } gViewerWindow->getWindow()->setCursor(UI_CURSOR_ARROW); diff --git a/indra/newview/lltoolselectrect.h b/indra/newview/lltoolselectrect.h index e79489795..00d774b21 100644 --- a/indra/newview/lltoolselectrect.h +++ b/indra/newview/lltoolselectrect.h @@ -2,31 +2,25 @@ * @file lltoolselectrect.h * @brief A tool to select multiple objects with a screen-space rectangle. * - * $LicenseInfo:firstyear=2001&license=viewergpl$ - * - * Copyright (c) 2001-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * 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. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index ef609c4a9..a8e8c2379 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -77,7 +77,6 @@ #include "llworldmapview.h" #include "llnetmap.h" #include "llrender.h" -#include "llfloaterchat.h" #include "aistatemachine.h" #include "aithreadsafe.h" #include "lldrawpoolbump.h" @@ -585,18 +584,6 @@ bool handleVelocityInterpolate(const LLSD& newvalue) return true; } -bool handleTranslateChatPrefsChanged(const LLSD& newvalue) -{ - LLFloaterChat* floaterp = LLFloaterChat::getInstance(); - - if(floaterp) - { - // update "translate chat" pref in "Local Chat" floater - floaterp->updateSettings(); - } - return true; -} - bool handleCloudSettingsChanged(const LLSD& newvalue) { bool bCloudsEnabled = gSavedSettings.getBOOL("CloudsEnabled"); @@ -795,7 +782,6 @@ void settings_setup_listeners() gSavedSettings.getControl("AudioLevelMic")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); gSavedSettings.getControl("LipSyncEnabled")->getSignal()->connect(boost::bind(&handleVoiceClientPrefsChanged, _2)); gSavedSettings.getControl("VelocityInterpolate")->getSignal()->connect(boost::bind(&handleVelocityInterpolate, _2)); - gSavedSettings.getControl("TranslateChat")->getSignal()->connect(boost::bind(&handleTranslateChatPrefsChanged, _2)); gSavedSettings.getControl("StateMachineMaxTime")->getSignal()->connect(boost::bind(&handleStateMachineMaxTimeChanged, _2)); gSavedSettings.getControl("CloudsEnabled")->getSignal()->connect(boost::bind(&handleCloudSettingsChanged, _2)); diff --git a/indra/newview/llviewerdisplayname.cpp b/indra/newview/llviewerdisplayname.cpp index 26ef02e77..27da1e0ba 100644 --- a/indra/newview/llviewerdisplayname.cpp +++ b/indra/newview/llviewerdisplayname.cpp @@ -40,9 +40,6 @@ #include "llnotificationsutil.h" #include "llui.h" // getLanguage() -class AIHTTPTimeoutPolicy; -extern AIHTTPTimeoutPolicy setDisplayNameResponder_timeout; - namespace LLViewerDisplayName { // Fired when viewer receives server response to display name change @@ -56,19 +53,21 @@ namespace LLViewerDisplayName sNameChangedSignal.connect(cb); } + void doNothing() { } } class LLSetDisplayNameResponder : public LLHTTPClient::ResponderIgnoreBody { -public: + LOG_CLASS(LLSetDisplayNameResponder); +private: // only care about errors - /*virtual*/ void httpFailure(void) + /*virtual*/ void httpFailure() { + llwarns << dumpResponse() << LL_ENDL; LLViewerDisplayName::sSetDisplayNameSignal(false, "", LLSD()); LLViewerDisplayName::sSetDisplayNameSignal.disconnect_all_slots(); } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return setDisplayNameResponder_timeout; } /*virtual*/ char const* getName(void) const { return "LLSetDisplayNameResponder"; } }; @@ -102,7 +101,7 @@ void LLViewerDisplayName::set(const std::string& display_name, const set_name_sl // People API expects array of [ "old value", "new value" ] LLSD change_array = LLSD::emptyArray(); - change_array.append(av_name.mDisplayName); + change_array.append(av_name.getDisplayName()); change_array.append(display_name); llinfos << "Set name POST to " << cap_url << llendl; @@ -130,7 +129,7 @@ public: LLSD body = input["body"]; S32 status = body["status"].asInteger(); - bool success = (status == 200); + bool success = (status == HTTP_OK); std::string reason = body["reason"].asString(); LLSD content = body["content"]; @@ -139,14 +138,14 @@ public: // If viewer's concept of display name is out-of-date, the set request // will fail with 409 Conflict. If that happens, fetch up-to-date // name information. - if (status == 409) + if (status == HTTP_CONFLICT) { LLUUID agent_id = gAgent.getID(); // Flush stale data LLAvatarNameCache::erase( agent_id ); - // Queue request for new data - LLAvatarName ignored; - LLAvatarNameCache::get( agent_id, &ignored ); + // Queue request for new data: nothing to do on callback though... + // Note: no need to disconnect the callback as it never gets out of scope + LLAvatarNameCache::get(agent_id, boost::bind(&LLViewerDisplayName::doNothing)); // Kill name tag, as it is wrong LLVOAvatar::invalidateNameTag( agent_id ); } @@ -160,7 +159,6 @@ public: class LLDisplayNameUpdate : public LLHTTPNode { - /*virtual*/ void post( LLHTTPNode::ResponsePtr response, const LLSD& context, @@ -178,14 +176,15 @@ class LLDisplayNameUpdate : public LLHTTPNode llinfos << "name-update now " << LLDate::now() << " next_update " << LLDate(av_name.mNextUpdate) - << llendl; + << LL_ENDL; // Name expiration time may be provided in headers, or we may use a // default value // *TODO: get actual headers out of ResponsePtr //LLSD headers = response->mHeaders; + AIHTTPReceivedHeaders headers; av_name.mExpires = - LLAvatarNameCache::nameExpirationFromHeaders(AIHTTPReceivedHeaders()); + LLAvatarNameCache::nameExpirationFromHeaders(headers); LLAvatarNameCache::insert(agent_id, av_name); @@ -196,8 +195,8 @@ class LLDisplayNameUpdate : public LLHTTPNode { LLSD args; args["OLD_NAME"] = old_display_name; - args["SLID"] = av_name.mUsername; - args["NEW_NAME"] = av_name.mDisplayName; + args["SLID"] = av_name.getUserName(); + args["NEW_NAME"] = av_name.getDisplayName(); LLNotificationsUtil::add("DisplayNameUpdate", args); } if (agent_id == gAgent.getID()) @@ -214,4 +213,3 @@ LLHTTPRegistration LLHTTPRegistration gHTTPRegistrationMessageDisplayNameUpdate( "/message/DisplayNameUpdate"); - diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp index 2050c3983..3c274ff33 100644 --- a/indra/newview/llviewermedia.cpp +++ b/indra/newview/llviewermedia.cpp @@ -51,6 +51,7 @@ #include "llkeyboard.h" #include "llmarketplacefunctions.h" #include "llmediaentry.h" +#include "llmenugl.h" #include "llmimetypes.h" #include "llmutelist.h" #include "llnotifications.h" @@ -2753,25 +2754,28 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask) // Menu keys should be handled by the menu system and not passed to UI elements, but this is how LLTextEditor and LLLineEditor do it... if( MASK_CONTROL & mask ) { - if( 'C' == key ) + if('C' == key) { plugin->copy(); result = true; } - else - if( 'V' == key ) + else if('V' == key) { plugin->paste(); result = true; } - else - if( 'X' == key ) + else if('X' == key) { plugin->cut(); result = true; } } - + + // Singu Note: At the very least, let's allow the login menu to function + extern LLMenuBarGL* gLoginMenuBarView; + if (gLoginMenuBarView && gLoginMenuBarView->getVisible() && gLoginMenuBarView->handleAcceleratorKey(key, mask)) + return true; + if(!result) { diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 444247924..5ad5d60c4 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3811,12 +3811,11 @@ class LLEditEnableCustomizeAvatar : public view_listener_t class LLEditEnableChangeDisplayname : public view_listener_t { - bool handleEvent(LLPointer event, const LLSD& userdata) - { - bool new_value = LLAvatarNameCache::useDisplayNames(); - gMenuHolder->findControl(userdata["control"].asString())->setValue(new_value); - return true; - } + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(LLAvatarName::useDisplayNames()); + return true; + } }; bool is_object_sittable() @@ -8868,6 +8867,15 @@ class SinguVisibleDebugConsole : public view_listener_t } }; +class VisibleSecondLife : public view_listener_t +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(gHippoGridManager->getCurrentGrid()->isSecondLife()); + return true; + } +}; + class VisibleNotSecondLife : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -9528,6 +9536,7 @@ void initialize_menus() } // [/RLVa:KB] + addMenu(new VisibleSecondLife(), "VisibleSecondLife"); addMenu(new VisibleNotSecondLife(), "VisibleNotSecondLife"); // List-bound menus @@ -9565,7 +9574,24 @@ void initialize_menus() add_radar_listeners(); - LLToolMgr::getInstance()->initMenu(sMenus); + class LLViewBuildMode : public view_listener_t + { + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLToolMgr::getInstance()->toggleBuildMode(); + return true; + } + }; + class LLViewCheckBuildMode : public view_listener_t + { + bool handleEvent(LLPointer event, const LLSD& userdata) + { + gMenuHolder->findControl(userdata["control"].asString())->setValue(LLToolMgr::getInstance()->inEdit()); + return true; + } + }; + addMenu(new LLViewBuildMode(), "View.BuildMode"); + addMenu(new LLViewCheckBuildMode(), "View.CheckBuildMode"); } void region_change() diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 396fe12d5..9485a7712 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2096,7 +2096,7 @@ static std::string clean_name_from_task_im(const std::string& msg, // Don't try to clean up group names if (!from_group) { - if (LLAvatarNameCache::useDisplayNames()) + if (LLAvatarName::useDisplayNames()) { // ...just convert to username final += LLCacheName::buildUsername(name); @@ -2119,22 +2119,20 @@ void notification_display_name_callback(const LLUUID& id, LLSD& substitutions, const LLSD& payload) { - substitutions["NAME"] = av_name.mDisplayName; + substitutions["NAME"] = av_name.getDisplayName(); LLNotificationsUtil::add(name, substitutions, payload); } // Callback for name resolution of a god/estate message void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message) { - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); LLSD args; - args["NAME"] = name; + args["NAME"] = av_name.getNSName(); args["MESSAGE"] = message; LLNotificationsUtil::add("GodMessage", args); // Treat like a system message and put in chat history. - chat.mText = name + ": " + message; + chat.mText = av_name.getNSName() + ": " + message; // Claim to be from a local agent so it doesn't go into console. LLFloaterChat::addChat(chat, false, true); @@ -2155,7 +2153,7 @@ std::string replace_wildcards(std::string autoresponse, const LLUUID& id, const // Add in their display name LLAvatarName av_name; - boost::algorithm::replace_all(autoresponse, "#d", LLAvatarNameCache::get(id, &av_name) ? av_name.mDisplayName : name); + boost::algorithm::replace_all(autoresponse, "#d", LLAvatarNameCache::get(id, &av_name) ? av_name.getDisplayName() : name); if (!isAgentAvatarValid()) return autoresponse; // Add in idle time @@ -2453,11 +2451,11 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) session_id); gAgent.sendReliableMessage(); - std::string pns_name; - if (!LLAvatarNameCache::getPNSName(from_id, pns_name)) pns_name = name; + LLAvatarName av_name; + std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name; if (show_autoresponded) { - gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + pns_name); + gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); } if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) { @@ -2465,7 +2463,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (show_autoresponded) { gIMMgr->addMessage(computed_session_id, from_id, name, - llformat("%s %s \"%s\"", pns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); + llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); } } } @@ -2584,14 +2582,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // 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_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; + LLAvatarName av_name; + std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : name; gIMMgr->addMessage( computed_session_id, from_id, name, - llformat("%s ", pns_name.c_str()) + LLTrans::getString("IM_announce_incoming"), + llformat("%s ", ns_name.c_str()) + LLTrans::getString("IM_announce_incoming"), name, IM_NOTHING_SPECIAL, parent_estate_id, @@ -2628,7 +2626,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (show_autoresponded) { - gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + pns_name); + gIMMgr->addMessage(session_id, from_id, name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); } if (LLViewerInventoryItem* item = gInventory.getItem(itemid)) { @@ -2636,7 +2634,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) if (show_autoresponded) { gIMMgr->addMessage(computed_session_id, from_id, name, - llformat("%s %s \"%s\"", pns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); + llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); } } } @@ -3126,7 +3124,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) } else { - gIMMgr->addMessage(session_id, from_id, name, message); + gIMMgr->addMessage(session_id, from_id, name, separator_string + message.substr(message_offset), name, dialog, parent_estate_id, region_id, position, true); } break; @@ -3486,11 +3484,11 @@ void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, c IM_ONLINE, IM_BUSY_AUTO_RESPONSE); gAgent.sendReliableMessage(); - std::string pns_name; - if (!LLAvatarNameCache::getPNSName(from_id, pns_name)) pns_name = from_name; + LLAvatarName av_name; + std::string ns_name = LLAvatarNameCache::get(from_id, &av_name) ? av_name.getNSName() : from_name; LLUUID session_id; msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); - if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, from_name, LLTrans::getString("IM_autoresponded_to") + " " + pns_name); + if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) gIMMgr->addMessage(session_id, from_id, from_name, LLTrans::getString("IM_autoresponded_to") + " " + ns_name); if (!gSavedPerAccountSettings.getBOOL("BusyModeResponseItem")) return; // Not sending an item, finished if (LLViewerInventoryItem* item = gInventory.getItem(static_cast(gSavedPerAccountSettings.getString("BusyModeResponseItemID")))) { @@ -3499,7 +3497,7 @@ void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, c LLUUID computed_session_id = LLIMMgr::computeSessionID(static_cast(d), from_id); LLGiveInventory::doGiveInventoryItem(from_id, item, computed_session_id); if (gSavedPerAccountSettings.getBOOL("BusyModeResponseShow")) - gIMMgr->addMessage(computed_session_id, from_id, from_name, llformat("%s %s \"%s\"", pns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); + gIMMgr->addMessage(computed_session_id, from_id, from_name, llformat("%s %s \"%s\"", ns_name.c_str(), LLTrans::getString("IM_autoresponse_sent_item").c_str(), item->getName().c_str())); } } } @@ -3794,7 +3792,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) LLAvatarName av_name; if (LLAvatarNameCache::get(from_id, &av_name)) { - chat.mFromName = av_name.mDisplayName; + chat.mFromName = av_name.getDisplayName(); } else { @@ -3941,9 +3939,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) is_owned_by_me = chatter->permYouOwner(); } + else is_owned_by_me = owner_id == gAgentID; U32 links_for_chatting_objects = gSavedSettings.getU32("LinksForChattingObjects"); - if (links_for_chatting_objects != 0 && chatter && chat.mSourceType == CHAT_SOURCE_OBJECT && + if (links_for_chatting_objects != 0 /*&& chatter*/ && chat.mSourceType == CHAT_SOURCE_OBJECT && (!is_owned_by_me || links_for_chatting_objects == 2) // [RLVa:KB] && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) @@ -3958,13 +3957,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) ) // [/RLVa:KB] { + // Fallback on the owner, if the chatter isn't present, lastly use the agent's region at the origin. + const LLViewerObject* obj(chatter ? chatter : gObjectList.findObject(owner_id)); // Compute the object SLURL. - LLVector3 pos = chatter->getPositionRegion(); + LLVector3 pos = obj ? obj->getPositionRegion() : LLVector3::zero; S32 x = llround((F32)fmod((F64)pos.mV[VX], (F64)REGION_WIDTH_METERS)); S32 y = llround((F32)fmod((F64)pos.mV[VY], (F64)REGION_WIDTH_METERS)); S32 z = llround((F32)pos.mV[VZ]); std::ostringstream location; - location << chatter->getRegion()->getName() << "/" << x << "/" << y << "/" << z; + location << (obj ? obj->getRegion() : gAgent.getRegion())->getName() << "/" << x << "/" << y << "/" << z; + if (chatter != obj) location << "?owner_not_object"; query_string["slurl"] = location.str(); } @@ -3997,7 +3999,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if (chatter && chatter->isAvatar()) { - if (LLAvatarNameCache::getPNSName(from_id, from_name)) + if (LLAvatarNameCache::getNSName(from_id, from_name)) chat.mFromName = from_name; } @@ -4518,11 +4520,14 @@ void process_teleport_finish(LLMessageSystem* msg, void**) // Viewer trusts the simulator. gMessageSystem->enableCircuit(sim_host, TRUE); // Aurora Sim - U32 region_size_x = 256; - msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeX, region_size_x); - U32 region_size_y = 256; - msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeY, region_size_y); - LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) + { + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeX, region_size_x); + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_Info, _PREHASH_RegionSizeY, region_size_y); + LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + } // Aurora Sim LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); @@ -4850,11 +4855,14 @@ void process_crossed_region(LLMessageSystem* msg, void**) send_complete_agent_movement(sim_host); // Aurora Sim - U32 region_size_x = 256; - msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeX, region_size_x); - U32 region_size_y = 256; - msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeY, region_size_y); - LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) + { + U32 region_size_x = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeX, region_size_x); + U32 region_size_y = 256; + msg->getU32(_PREHASH_RegionData, _PREHASH_RegionSizeY, region_size_y); + LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + } // Aurora Sim LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); regionp->setSeedCapability(seedCap); @@ -6275,15 +6283,14 @@ static void money_balance_avatar_notify(const LLUUID& agent_id, { bool no_transaction_clutter = gSavedSettings.getBOOL("LiruNoTransactionClutter"); std::string notification = no_transaction_clutter ? "Payment" : "SystemMessage"; - std::string name; - LLAvatarNameCache::getPNSName(av_name,name); - args["NAME"] = name; + args["NAME"] = av_name.getNSName(); LLSD msg_args; msg_args["MESSAGE"] = LLTrans::getString(message,args); LLNotificationsUtil::add(notification,msg_args,payload); if (!no_transaction_clutter) LLFloaterChat::addChat(msg_args["MESSAGE"].asString()); // Alerts won't automatically log to chat. } + static void process_money_balance_reply_extended(LLMessageSystem* msg) { // Added in server 1.40 and viewer 2.1, support for localization @@ -6500,83 +6507,101 @@ bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) } // some of the server notifications need special handling. This is where we do that. -bool handle_teleport_access_blocked(LLSD& llsdBlock) +bool handle_teleport_access_blocked(LLSD& llsdBlock, const std::string & notificationID, const std::string & defaultMessage) { - std::string notificationID("TeleportEntryAccessBlocked"); U8 regionAccess = static_cast(llsdBlock["_region_access"].asInteger()); std::string regionMaturity = LLViewerRegion::accessToString(regionAccess); LLStringUtil::toLower(regionMaturity); llsdBlock["REGIONMATURITY"] = regionMaturity; bool returnValue = false; - LLNotificationPtr maturityLevelNotification; - std::string notifySuffix = "_Notify"; - if (regionAccess == SIM_ACCESS_MATURE) - { - if (gAgent.isTeen()) - { - gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock); - returnValue = true; + LLNotificationPtr tp_failure_notification; + std::string notifySuffix; - notifySuffix = "_NotifyAdultsOnly"; - } - else if (gAgent.prefersPG()) + if (notificationID == std::string("TeleportEntryAccessBlocked")) + { + notifySuffix = "_Notify"; + if (regionAccess == SIM_ACCESS_MATURE) { - if (gAgent.hasRestartableFailedTeleportRequest()) + if (gAgent.isTeen()) { - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + gAgent.clearTeleportRequest(); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock); returnValue = true; + + notifySuffix = "_NotifyAdultsOnly"; + } + else if (gAgent.prefersPG()) + { + if (gAgent.hasRestartableFailedTeleportRequest()) + { + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + returnValue = true; + } + else + { + gAgent.clearTeleportRequest(); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + returnValue = true; + } } else { gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); returnValue = true; } } - else + else if (regionAccess == SIM_ACCESS_ADULT) { - gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); - returnValue = true; - } - } - else if (regionAccess == SIM_ACCESS_ADULT) - { - if (!gAgent.isAdult()) - { - gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock); - returnValue = true; - - notifySuffix = "_NotifyAdultsOnly"; - } - else if (gAgent.prefersPG() || gAgent.prefersMature()) - { - if (gAgent.hasRestartableFailedTeleportRequest()) + if (!gAgent.isAdult()) { - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + gAgent.clearTeleportRequest(); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_AdultsOnlyContent", llsdBlock); returnValue = true; + + notifySuffix = "_NotifyAdultsOnly"; + } + else if (gAgent.prefersPG() || gAgent.prefersMature()) + { + if (gAgent.hasRestartableFailedTeleportRequest()) + { + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_ChangeAndReTeleport", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_and_reteleport_callback); + returnValue = true; + } + else + { + gAgent.clearTeleportRequest(); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + returnValue = true; + } } else { gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); + tp_failure_notification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); returnValue = true; } } + } // End of special handling for "TeleportEntryAccessBlocked" + else + { // Normal case, no message munging + gAgent.clearTeleportRequest(); + if (LLNotificationTemplates::getInstance()->templateExists(notificationID)) + { + tp_failure_notification = LLNotificationsUtil::add(notificationID, llsdBlock, llsdBlock); + } else { - gAgent.clearTeleportRequest(); - maturityLevelNotification = LLNotificationsUtil::add(notificationID+"_PreferencesOutOfSync", llsdBlock, llsdBlock, handle_prompt_for_maturity_level_change_callback); - returnValue = true; + llsdBlock["MESSAGE"] = defaultMessage; + tp_failure_notification = LLNotificationsUtil::add("GenericAlertOK", llsdBlock); } + returnValue = true; } - if ((maturityLevelNotification == NULL) || maturityLevelNotification->isIgnored()) + if ((tp_failure_notification == NULL) || tp_failure_notification->isIgnored()) { - // Given a simple notification if no maturityLevelNotification is set or it is ignore + // Given a simple notification if no tp_failure_notification is set or it is ignore LLNotificationsUtil::add(notificationID + notifySuffix, llsdBlock); } @@ -6942,8 +6967,7 @@ void chat_mean_collision(const LLUUID& id, const LLAvatarName& avname, const EMe args["ACT"] = LLTrans::getString("physical_object_collide"); else return; // How did we get here? I used to know you so well. - std::string name; - LLAvatarNameCache::getPNSName(avname, name); + const std::string name(avname.getNSName()); args["NAME"] = name; args["MAG"] = llformat("%f", mag); LLChat chat(LLTrans::getString("BumpedYou", args)); @@ -7237,6 +7261,7 @@ bool script_question_cb(const LLSD& notification, const LLSD& response) return false; } + static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb); static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb); @@ -7384,7 +7409,6 @@ void process_script_question(LLMessageSystem *msg, void **user_data) // fall back to default behavior if cautions are entirely disabled LLNotificationsUtil::add("ScriptQuestion", args, payload); } - } } @@ -7516,8 +7540,8 @@ std::string formatted_time(const time_t& the_time) void process_teleport_failed(LLMessageSystem *msg, void**) { - std::string reason; - std::string big_reason; + std::string message_id; // Tag from server, like "RegionEntryAccessBlocked" + std::string big_reason; // Actual message to display LLSD args; // Let the interested parties know that teleport failed. @@ -7527,16 +7551,16 @@ void process_teleport_failed(LLMessageSystem *msg, void**) if (msg->has(_PREHASH_AlertInfo) && msg->getSizeFast(_PREHASH_AlertInfo, _PREHASH_Message) > 0) { // Get the message ID - msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, reason); - big_reason = LLAgent::sTeleportErrorMessages[reason]; + msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, message_id); + big_reason = LLAgent::sTeleportErrorMessages[message_id]; if ( big_reason.size() > 0 ) { // Substitute verbose reason from the local map args["REASON"] = big_reason; } else { // Nothing found in the map - use what the server returned in the original message block - msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason); - args["REASON"] = reason; + msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, big_reason); + args["REASON"] = big_reason; } LLSD llsd_block; @@ -7552,7 +7576,7 @@ void process_teleport_failed(LLMessageSystem *msg, void**) else { // change notification name in this special case - if (handle_teleport_access_blocked(llsd_block)) + if (handle_teleport_access_blocked(llsd_block, message_id, args["REASON"])) { if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE ) { @@ -7565,17 +7589,17 @@ void process_teleport_failed(LLMessageSystem *msg, void**) } else - { - msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason); + { // Extra message payload not found - use what the simulator sent + msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, message_id); - big_reason = LLAgent::sTeleportErrorMessages[reason]; + big_reason = LLAgent::sTeleportErrorMessages[message_id]; if ( big_reason.size() > 0 ) { // Substitute verbose reason from the local map args["REASON"] = big_reason; } else { // Nothing found in the map - use what the server returned - args["REASON"] = reason; + args["REASON"] = message_id; } } @@ -7621,9 +7645,8 @@ void process_teleport_local(LLMessageSystem *msg,void**) } } - static LLCachedControl fly_after_tp(gSavedSettings, "LiruFlyAfterTeleport"); // Sim tells us whether the new position is off the ground - if (fly_after_tp || (teleport_flags & TELEPORT_FLAGS_IS_FLYING)) + if (teleport_flags & TELEPORT_FLAGS_IS_FLYING || gSavedSettings.getBOOL("LiruFlyAfterTeleport")) { gAgent.setFlying(TRUE); } @@ -7759,6 +7782,7 @@ void send_lures(const LLSD& notification, const LLSD& response) msg->nextBlockFast(_PREHASH_TargetData); msg->addUUIDFast(_PREHASH_TargetID, target_id); + // Record the offer. if (notification["payload"]["ids"].size() < 10) // Singu Note: Do NOT spam chat! { @@ -7767,14 +7791,13 @@ void send_lures(const LLSD& notification, const LLSD& response) // [/RLVa:KB] std::string target_name; gCacheName->getFullName(target_id, target_name); // for im log filenames - LLSD args; // [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6) if (fRlvHideName) target_name = RlvStrings::getAnonym(target_name); else // [/RLVa:KB] - LLAvatarNameCache::getPNSName(target_id, target_name); + LLAvatarNameCache::getNSName(target_id, target_name); args["TO_NAME"] = target_name; LLSD payload; @@ -8411,9 +8434,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) void callbackCacheEstateOwnerName(const LLUUID& id, const LLAvatarName& av_name) { - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - + const std::string name(av_name.getNSName()); LLPanelEstateCovenant::updateEstateOwnerName(name); LLPanelLandCovenant::updateEstateOwnerName(name); LLPanelEstateInfo::updateEstateOwnerName(name); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 799513e93..4a75bc8fc 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -433,11 +433,8 @@ LLViewerRegion::~LLViewerRegion() mImpl = NULL; // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) - if (mWorldMapTile) - { - mWorldMapTile->setBoostLevel(LLViewerTexture::BOOST_NONE); - mWorldMapTile = NULL; - } + for (tex_matrix_t::iterator i = mWorldMapTiles.begin(), iend = mWorldMapTiles.end(); i != iend; ++i) + (*i)->setBoostLevel(LLViewerTexture::BOOST_NONE); // [/SL:KB] } @@ -1105,20 +1102,32 @@ F32 LLViewerRegion::getLandHeightRegion(const LLVector3& region_pos) } // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) -LLViewerTexture* LLViewerRegion::getWorldMapTile() const +const LLViewerRegion::tex_matrix_t& LLViewerRegion::getWorldMapTiles() const { - if (!mWorldMapTile) + if (mWorldMapTiles.empty()) { U32 gridX, gridY; grid_from_region_handle(mHandle, &gridX, &gridY); // Singu Note: We must obey the override on certain grids! std::string simOverrideMap = LFSimFeatureHandler::instance().mapServerURL(); - std::string strImgURL = (simOverrideMap.empty() ? gSavedSettings.getString("MapServerURL") : simOverrideMap) + llformat("map-1-%d-%d-objects.jpg", gridX, gridY); - - mWorldMapTile = LLViewerTextureManager::getFetchedTextureFromUrl(strImgURL, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mWorldMapTile->setBoostLevel(LLViewerTexture::BOOST_MAP); + std::string strImgURL = (simOverrideMap.empty() ? gSavedSettings.getString("MapServerURL") : simOverrideMap) + "map-1-"; + U32 totalX(getWidth()/REGION_WIDTH_U32); + if (!totalX) ++totalX; // If this region is too small, still get an image. + /* TODO: Nonsquare regions? + U32 totalY(getLength()/REGION_WIDTH_U32); + if (!totalY) ++totalY; // If this region is too small, still get an image. + */ + const U32 totalY(totalX); + mWorldMapTiles.reserve(totalX*totalY); + for (U32 x = 0; x != totalX; ++x) + for (U32 y = 0; y != totalY; ++y) + { + LLPointer tex(LLViewerTextureManager::getFetchedTextureFromUrl(strImgURL+llformat("%d-%d-objects.jpg", gridX + x, gridY + y), TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + mWorldMapTiles.push_back(tex); + tex->setBoostLevel(LLViewerTexture::BOOST_MAP); + } } - return mWorldMapTile; + return mWorldMapTiles; } // [/SL:KB] diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h index a2ef35c92..cfaef5ebc 100644 --- a/indra/newview/llviewerregion.h +++ b/indra/newview/llviewerregion.h @@ -160,7 +160,8 @@ public: // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-06-20 (Catznip-3.3.0) bool isAlive() const; // can become false if circuit disconnects - LLViewerTexture* getWorldMapTile() const; + typedef std::vector > tex_matrix_t; + const tex_matrix_t& getWorldMapTiles() const; // [/SL:KB] void setWaterHeight(F32 water_level); @@ -474,7 +475,7 @@ private: LLDynamicArray mCacheMissCRC; // [SL:KB] - Patch: World-MinimapOverlay | Checked: 2012-07-26 (Catznip-3.3) - mutable LLPointer mWorldMapTile; + mutable tex_matrix_t mWorldMapTiles; // [/SL:KB] bool mAlive; // can become false if circuit disconnects diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 5530628c9..d87a94c9f 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -1373,6 +1373,13 @@ BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) // Let the voice chat code check for its PTT key. Note that this never affects event processing. LLVoiceClient::getInstance()->keyUp(key, mask); + // Let the inspect tool code check for ALT key to set LLToolSelectRect active instead LLToolCamera + LLToolCompInspect * tool_inspectp = LLToolCompInspect::getInstance(); + if (LLToolMgr::getInstance()->getCurrentTool() == tool_inspectp) + { + tool_inspectp->keyUp(key, mask); + } + return FALSE; } @@ -1380,7 +1387,7 @@ BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key, MASK mask) void LLViewerWindow::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) { LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true); - return gViewerKeyboard.scanKey(key, key_down, key_up, key_level); + gViewerKeyboard.scanKey(key, key_down, key_up, key_level); } @@ -1665,7 +1672,7 @@ LLViewerWindow::LLViewerWindow( { LLSplashScreen::update(LLTrans::getString("StartupRequireDriverUpdate")); - LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << llendl ; + LL_WARNS("Window") << "Failed to create window, to be shutting Down, be sure your graphics driver is updated." << LL_ENDL ; ms_sleep(5000) ; //wait for 5 seconds. @@ -3366,10 +3373,8 @@ void LLViewerWindow::updateLayout() || (tool != LLToolPie::getInstance() // not default tool && tool != LLToolCompGun::getInstance() // not coming out of mouselook && !suppress_toolbox // not override in third person - && LLToolMgr::getInstance()->getCurrentToolset() != gFaceEditToolset // not special mode - && LLToolMgr::getInstance()->getCurrentToolset() != gMouselookToolset + && LLToolMgr::getInstance()->getCurrentToolset()->isShowFloaterTools() && (!captor || dynamic_cast(captor) != NULL))) // not dragging - { // Force floater tools to be visible (unless minimized) if (!gFloaterTools->getVisible()) @@ -3406,7 +3411,7 @@ void LLViewerWindow::updateLayout() } // Update rectangles for the various toolbars - if (gOverlayBar && gNotifyBoxView && gConsole && gToolBar && gHUDView) + if (gOverlayBar && gNotifyBoxView && gToolBar && gHUDView) { LLRect bar_rect(-1, STATUS_BAR_HEIGHT, getWindowWidth()+1, -1); @@ -3456,10 +3461,13 @@ void LLViewerWindow::updateLayout() { gFloaterView->setSnapOffsetBottom(0); } + } - // Always update console + // Always update console + if (gConsole) + { LLRect console_rect = getChatConsoleRect(); - console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad(); + if (gHUDView) console_rect.mBottom = gHUDView->getRect().mBottom + getChatConsoleBottomPad(); gConsole->reshape(console_rect.getWidth(), console_rect.getHeight()); gConsole->setRect(console_rect); } @@ -3559,6 +3567,7 @@ void LLViewerWindow::updateKeyboardFocus() cur_focus->focusFirstItem(); } } + // last ditch force of edit menu to selection manager if (LLEditMenuHandler::gEditMenuHandler == NULL && LLSelectMgr::getInstance()->getSelection()->getObjectCount()) { @@ -3597,6 +3606,7 @@ void LLViewerWindow::saveLastMouse(const LLCoordGL &point) { // Store last mouse location. // If mouse leaves window, pretend last point was on edge of window + if (point.mX < 0) { mCurrentMousePoint.mX = 0; @@ -3886,6 +3896,8 @@ void LLViewerWindow::schedulePick(LLPickInfo& pick_info) mPicks.push_back(pick_info); // delay further event processing until we receive results of pick + // only do this for async picks so that handleMouseUp won't be called + // until the pick triggered in handleMouseDown has been processed, for example mWindow->delayInputProcessing(); } @@ -3963,6 +3975,7 @@ LLHUDIcon* LLViewerWindow::cursorIntersectIcon(S32 mouse_x, S32 mouse_y, F32 dep } // world coordinates of mouse + // VECTORIZE THIS LLVector3 mouse_direction_global = mouseDirectionGlobal(x,y); LLVector3 mouse_point_global = LLViewerCamera::getInstance()->getOrigin(); LLVector3 mouse_world_start = mouse_point_global; @@ -4258,7 +4271,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d S32 grids_per_edge = (S32) regionp->getLand().mGridsPerEdge; if ((i >= grids_per_edge) || (j >= grids_per_edge)) { - //llinfos << "LLViewerWindow::mousePointOnLand probe_point is out of region" << llendl; + //LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL; continue; } @@ -4305,7 +4318,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d j = (S32) (local_probe_point.mV[VY]/regionp->getLand().getMetersPerGrid()); if ((i >= regionp->getLand().mGridsPerEdge) || (j >= regionp->getLand().mGridsPerEdge)) { - // llinfos << "LLViewerWindow::mousePointOnLand probe_point is out of region" << llendl; + // LL_INFOS() << "LLViewerWindow::mousePointOnLand probe_point is out of region" << LL_ENDL; continue; } land_z = regionp->getLand().mSurfaceZ[ i + j * (regionp->getLand().mGridsPerEdge) ]; @@ -4313,7 +4326,7 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d land_z = regionp->getLand().resolveHeightRegion(probe_point_region); - //llinfos << "mousePointOnLand refine z " << land_z << llendl; + //LL_INFOS() << "mousePointOnLand refine z " << land_z << LL_ENDL; if (probe_point_region.mV[VZ] < land_z) { @@ -4739,7 +4752,9 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, S32 original_width = 0; S32 original_height = 0; bool reset_deferred = false; + LLRenderTarget scratch_space; + if ((image_width > window_width || image_height > window_height) && LLPipeline::sRenderDeferred && !show_ui) { if (scratch_space.allocate(image_width, image_height, GL_RGBA, true, true)) @@ -4955,6 +4970,7 @@ bool LLViewerWindow::rawRawSnapshot(LLImageRaw *raw, LLHUDObject::reshapeAll(); } + setCursor(UI_CURSOR_ARROW); if (do_rebuild) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 443a631ba..82584ef15 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3380,10 +3380,10 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // LLFontGL::getFontSansSerifSmall()); } - // On SecondLife we can take a shortcut through getPNSName, which will strip out Resident + // On SecondLife we can take a shortcut through getNSName, which will strip out Resident if (gHippoGridManager->getConnectedGrid()->isSecondLife()) { - if (!LLAvatarNameCache::getPNSName(getID(), firstnameText)) + if (!LLAvatarNameCache::getNSName(getID(), firstnameText)) { // ...call this function back when the name arrives and force a rebuild LLAvatarNameCache::get(getID(), boost::bind(&LLVOAvatar::clearNameTag, this)); @@ -3404,7 +3404,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) bool show_display_names = phoenix_name_system > 0 || phoenix_name_system < 4; bool show_usernames = phoenix_name_system != 2; - if (show_display_names && LLAvatarNameCache::useDisplayNames()) + if (show_display_names && LLAvatarName::useDisplayNames()) { LLAvatarName av_name; if (!LLAvatarNameCache::get(getID(), &av_name)) @@ -3422,22 +3422,21 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name) // Might be blank if name not available yet, that's OK if (show_display_names) { - firstnameText = phoenix_name_system == 3 ? av_name.mUsername : av_name.mDisplayName; //Defer for later formatting - //addNameTagLine(av_name.mDisplayName, name_tag_color, LLFontGL::NORMAL, + firstnameText = phoenix_name_system == 3 ? av_name.getUserName() : av_name.getDisplayName(); //Defer for later formatting + //addNameTagLine(av_name.getDisplayName(), name_tag_color, LLFontGL::NORMAL, // LLFontGL::getFontSansSerif()); } // Suppress SLID display if display name matches exactly (ugh) - if (show_usernames && !av_name.mIsDisplayNameDefault && !av_name.mUsername.empty()) + if (show_usernames && !av_name.isDisplayNameDefault()) { firstnameText.push_back(' '); firstnameText.push_back('('); - firstnameText.append(phoenix_name_system == 3 ? av_name.mDisplayName : av_name.mUsername); //Defer for later formatting + firstnameText.append(phoenix_name_system == 3 ? av_name.getDisplayName() : av_name.getAccountName()); //Defer for later formatting firstnameText.push_back(')'); // *HACK: Desaturate the color //LLColor4 username_color = name_tag_color * 0.83f; - //nameText=av_name.mUsername; - //addNameTagLine(av_name.mUsername, username_color, LLFontGL::NORMAL, - //LLFontGL::getFontSansSerifSmall()); + //addNameTagLine(av_name.getUserName(), username_color, LLFontGL::NORMAL, + // LLFontGL::getFontSansSerifSmall()); } // [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a } @@ -3724,11 +3723,11 @@ LLColor4 LLVOAvatar::getNameTagColor(bool is_friend) static const LLCachedControl avatar_name_color(gColors,"AvatarNameColor",LLColor4(LLColor4U(251, 175, 93, 255)) ); return avatar_name_color; } - /*else if (LLAvatarNameCache::useDisplayNames()) + /*else if (LLAvatarName::useDisplayNames()) { // ...color based on whether username "matches" a computed display name LLAvatarName av_name; - if (LLAvatarNameCache::get(getID(), &av_name) && av_name.mIsDisplayNameDefault) + if (LLAvatarNameCache::get(getID(), &av_name) && av_name.isDisplayNameDefault()) { color_name = "NameTagMatch"; } @@ -5656,7 +5655,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL if (announce_snapshots) { std::string name; - LLAvatarNameCache::getPNSName(mID, name); + LLAvatarNameCache::getNSName(mID, name); LLChat chat; chat.mFromName = name; chat.mText = name + " " + LLTrans::getString("took_a_snapshot") + "."; @@ -6425,19 +6424,32 @@ LLViewerJointAttachment* LLVOAvatar::getTargetAttachmentPoint(LLViewerObject* vi if (!attachment) { - llwarns << "Object attachment point invalid: " << attachmentID << llendl; + llwarns << "Object attachment point invalid: " << attachmentID + << " trying to use 1 (chest)" + << LL_ENDL; + if (isSelf() && attachmentID == 127 && gSavedSettings.getBOOL("SGDetachBridge")) { llinfos << "Bridge detected! detaching" << llendl; sDetachBridgeConnection = gAgentAvatarp->setAttachmentCallback(boost::bind(detach_bridge, _1, viewer_object)); } -// attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest) -// [SL:KB] - Patch: Appearance-LegacyMultiAttachment | Checked: 2010-08-28 (Catznip-2.2.0a) | Added: Catznip2.1.2a - S32 idxAttachPt = 1; - if ( (!isSelf()) && (gSavedSettings.getBOOL("LegacyMultiAttachmentSupport")) && (attachmentID > 38) && (attachmentID <= 68) ) - idxAttachPt = attachmentID - 38; - attachment = get_if_there(mAttachmentPoints, idxAttachPt, (LLViewerJointAttachment*)NULL); -// [/SL:KB] + attachment = get_if_there(mAttachmentPoints, 1, (LLViewerJointAttachment*)NULL); // Arbitrary using 1 (chest) + if (attachment) + { + llwarns << "Object attachment point invalid: " << attachmentID + << " on object " << viewer_object->getID() + << " attachment item " << viewer_object->getAttachmentItemID() + << " falling back to 1 (chest)" + << LL_ENDL; + } + else + { + llwarns << "Object attachment point invalid: " << attachmentID + << " on object " << viewer_object->getID() + << " attachment item " << viewer_object->getAttachmentItemID() + << "Unable to use fallback attachment point 1 (chest)" + << LL_ENDL; + } } return attachment; @@ -6521,7 +6533,7 @@ void LLVOAvatar::lazyAttach() llwarns << "attachObject() failed for " << cur_attachment->getID() << " item " << cur_attachment->getAttachmentItemID() - << llendl; + << LL_ENDL; // MAINT-3312 backout //still_pending.push_back(cur_attachment); } @@ -6826,9 +6838,6 @@ BOOL LLVOAvatar::isWearingWearableType(LLWearableType::EType type) const break; // Do nothing } - /* switch(type) - case LLWearableType::WT_SHIRT: - indicator_te = TEX_UPPER_SHIRT; */ for (LLAvatarAppearanceDictionary::Textures::const_iterator tex_iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); tex_iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); ++tex_iter) @@ -7277,9 +7286,7 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) LLAvatarJointMesh* mesh = (*iter); if (mesh) { - { - mesh->setColor(color); - } + mesh->setColor(color); } } } diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 2c892af3f..b4cc3e1fa 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -61,9 +61,6 @@ // for base64 decoding #include "apr_base64.h" -extern AIHTTPTimeoutPolicy vivoxVoiceAccountProvisionResponder_timeout; -extern AIHTTPTimeoutPolicy vivoxVoiceClientCapResponder_timeout; - #define USE_SESSION_GROUPS 0 const F32 VOLUME_SCALE_VIVOX = 0.01f; @@ -116,17 +113,19 @@ static int scale_speaker_volume(float volume) class LLVivoxVoiceAccountProvisionResponder : public LLHTTPClient::ResponderWithResult { + LOG_CLASS(LLVivoxVoiceAccountProvisionResponder); public: LLVivoxVoiceAccountProvisionResponder(int retries) { mRetries = retries; } - /*virtual*/ void httpFailure(void) +private: + /* virtual */ void httpFailure() { LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, " << ( (mRetries > 0) ? "retrying" : "too many retries (giving up)" ) - << mStatus << "]: " << mReason << LL_ENDL; + << " " << dumpResponse() << LL_ENDL; if ( mRetries > 0 ) { @@ -138,30 +137,33 @@ public: } } - /*virtual*/ void httpSuccess(void) + /* virtual */ void httpSuccess() { - std::string voice_sip_uri_hostname; std::string voice_account_server_uri; - LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(mContent) << LL_ENDL; + LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << dumpResponse() << LL_ENDL; - if(mContent.has("voice_sip_uri_hostname")) - voice_sip_uri_hostname = mContent["voice_sip_uri_hostname"].asString(); + const LLSD& content = getContent(); + if (!content.isMap()) + { + failureResult(HTTP_INTERNAL_ERROR_OTHER, "Malformed response contents", content); + return; + } + if(content.has("voice_sip_uri_hostname")) + voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString(); // this key is actually misnamed -- it will be an entire URI, not just a hostname. - if(mContent.has("voice_account_server_name")) - voice_account_server_uri = mContent["voice_account_server_name"].asString(); + if(content.has("voice_account_server_name")) + voice_account_server_uri = content["voice_account_server_name"].asString(); LLVivoxVoiceClient::getInstance()->login( - mContent["username"].asString(), - mContent["password"].asString(), + content["username"].asString(), + content["password"].asString(), voice_sip_uri_hostname, voice_account_server_uri); - } - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return vivoxVoiceAccountProvisionResponder_timeout; } /*virtual*/ char const* getName(void) const { return "LLVivoxVoiceAccountProvisionResponder"; } private: @@ -185,37 +187,38 @@ static bool sMuteListListener_listening = false; class LLVivoxVoiceClientCapResponder : public LLHTTPClient::ResponderWithResult { + LOG_CLASS(LLVivoxVoiceClientCapResponder); public: LLVivoxVoiceClientCapResponder(LLVivoxVoiceClient::state requesting_state) : mRequestingState(requesting_state) {}; - /*virtual*/ void httpFailure(void); - /*virtual*/ void httpSuccess(void); - /*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return vivoxVoiceClientCapResponder_timeout; } - /*virtual*/ char const* getName(void) const { return "LLVivoxVoiceClientCapResponder"; } - private: + // called with bad status codes + /*virtual*/ void httpFailure(); + /*virtual*/ void httpSuccess(); + /*virtual*/ char const* getName() const { return "LLVivoxVoiceClientCapResponder"; } + LLVivoxVoiceClient::state mRequestingState; // state }; -void LLVivoxVoiceClientCapResponder::httpFailure(void) +void LLVivoxVoiceClientCapResponder::httpFailure() { - LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder error [status:" - << mStatus << "]: " << mReason << LL_ENDL; + LL_WARNS("Voice") << dumpResponse() << LL_ENDL; LLVivoxVoiceClient::getInstance()->sessionTerminate(); } -void LLVivoxVoiceClientCapResponder::httpSuccess(void) +void LLVivoxVoiceClientCapResponder::httpSuccess() { LLSD::map_const_iterator iter; - LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(mContent) << LL_ENDL; + LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << dumpResponse() << LL_ENDL; std::string uri; std::string credentials; - if ( mContent.has("voice_credentials") ) + const LLSD& content = getContent(); + if ( content.has("voice_credentials") ) { - LLSD voice_credentials = mContent["voice_credentials"]; + LLSD voice_credentials = content["voice_credentials"]; if ( voice_credentials.has("channel_uri") ) { uri = voice_credentials["channel_uri"].asString(); @@ -504,14 +507,22 @@ bool LLVivoxVoiceClient::writeString(const std::string &str) void LLVivoxVoiceClient::connectorCreate() { std::ostringstream stream; - std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); std::string loglevel = "0"; // Transition to stateConnectorStarted when the connector handle comes back. setState(stateConnectorStarting); - std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel"); + std::string logpath = gSavedSettings.getString("VivoxLogDirectory"); + if (logpath.empty()) + { + logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); + } + if (LLStringUtil::endsWith(logpath, gDirUtilp->getDirDelimiter())) + { + logpath.resize(logpath.size()-1); + } + std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel"); if(savedLogLevel != "0") { LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL; @@ -819,12 +830,13 @@ void LLVivoxVoiceClient::stateMachine() // using glib first. char *voice_path = g_find_program_in_path ("SLVoice"); std::string exe_path; - if (voice_path) { + if (voice_path) + { exe_path = llformat("%s", voice_path); free(voice_path); - } else { - exe_path = gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + "SLVoice"; } + else + exe_path = gDirUtilp->getExecutableDir() + gDirUtilp->getDirDelimiter() + "SLVoice"; #else // *FIX:Mani - Using the executable dir instead // of mAppRODataDir, the working directory from which the app @@ -866,13 +878,18 @@ void LLVivoxVoiceClient::stateMachine() #else args += loglevel; #endif - args += " -lf "; std::string log_folder = gSavedSettings.getString("VivoxLogDirectory"); + if (log_folder.empty()) { log_folder = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, ""); } - args += "logfolder"; + if (LLStringUtil::endsWith(log_folder, gDirUtilp->getDirDelimiter())) + { + log_folder.resize(log_folder.size()-1); + } + args += " -lf "; + args += '"' + log_folder + '"'; // Singu Note: omit shutdown timeout for Linux, as we are using 2.x version of the SDK there // Singu TODO: Remove this when the Vivox SDK 4.x is working on Linux @@ -2818,7 +2835,7 @@ void LLVivoxVoiceClient::loginResponse(int statusCode, std::string &statusString // Status code of 20200 means "bad password". We may want to special-case that at some point. - if ( statusCode == 401 ) + if ( statusCode == HTTP_UNAUTHORIZED ) { // Login failure which is probably caused by the delay after a user's password being updated. LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL; @@ -3320,7 +3337,7 @@ void LLVivoxVoiceClient::mediaStreamUpdatedEvent( switch(statusCode) { case 0: - case 200: + case HTTP_OK: // generic success // Don't change the saved error code (it may have been set elsewhere) break; @@ -5516,9 +5533,10 @@ void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::ESta { switch(mAudioSession->mErrorStatusCode) { - case 404: // NOT_FOUND + case HTTP_NOT_FOUND: // NOT_FOUND + // *TODO: Should this be 503? case 480: // TEMPORARILY_UNAVAILABLE - case 408: // REQUEST_TIMEOUT + case HTTP_REQUEST_TIME_OUT: // REQUEST_TIMEOUT // call failed because other user was not available // treat this as an error case status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE; @@ -5597,7 +5615,7 @@ void LLVivoxVoiceClient::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name) { mAvatarNameCacheConnection.disconnect(); - std::string display_name = av_name.mDisplayName; + std::string display_name = av_name.getDisplayName(); avatarNameResolved(agent_id, display_name); } diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp index 8e1b1e4be..a52bf2d53 100644 --- a/indra/newview/llworld.cpp +++ b/indra/newview/llworld.cpp @@ -62,6 +62,7 @@ #include "pipeline.h" #include "llappviewer.h" // for do_disconnect() #include "llpacketring.h" +#include "hippogridmanager.h" #include #include @@ -136,7 +137,7 @@ void LLWorld::destroyClass() { mHoleWaterObjects.clear(); gObjectList.destroy(); - for(region_list_t::iterator region_it = mRegionList.begin(); region_it != mRegionList.end(); ) + for(region_list_t::iterator region_it = mRegionList.begin(), region_it_end(mRegionList.end()); region_it != region_it_end; ) { LLViewerRegion* region_to_delete = *region_it++; removeRegion(region_to_delete->getHost()); @@ -313,8 +314,8 @@ void LLWorld::removeRegion(const LLHost &host) if (regionp == gAgent.getRegion()) { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* reg = *iter; llwarns << "RegionDump: " << reg->getName() @@ -360,8 +361,8 @@ void LLWorld::removeRegion(const LLHost &host) LLViewerRegion* LLWorld::getRegion(const LLHost &host) { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; if (regionp->getHost() == host) @@ -379,8 +380,8 @@ LLViewerRegion* LLWorld::getRegionFromPosAgent(const LLVector3 &pos) LLViewerRegion* LLWorld::getRegionFromPosGlobal(const LLVector3d &pos) { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end = mRegionList.end(); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; if (regionp->pointInRegionGlobal(pos)) @@ -468,8 +469,8 @@ LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle) from_region_handle(handle, &x, &y); // Aurora Sim - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; // Aurora Sim @@ -490,8 +491,8 @@ LLViewerRegion* LLWorld::getRegionFromHandle(const U64 &handle) LLViewerRegion* LLWorld::getRegionFromID(const LLUUID& region_id) { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; if (regionp->getRegionID() == region_id) @@ -517,8 +518,8 @@ void LLWorld::updateAgentOffset(const LLVector3d &offset_global) BOOL LLWorld::positionRegionValidGlobal(const LLVector3d &pos_global) { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; if (regionp->pointInRegionGlobal(pos_global)) @@ -687,8 +688,8 @@ void LLWorld::updateVisibilities() F32 cur_far_clip = LLViewerCamera::getInstance()->getFar(); // Go through the culled list and check for visible regions (region is visible if land is visible) - for (region_list_t::iterator iter = mCulledRegionList.begin(); - iter != mCulledRegionList.end(); ) + for (region_list_t::iterator iter = mCulledRegionList.begin(), iter_end(mCulledRegionList.end()); + iter != iter_end; ) { region_list_t::iterator curiter = iter++; LLViewerRegion* regionp = *curiter; @@ -706,8 +707,8 @@ void LLWorld::updateVisibilities() } // Update all of the visible regions - for (region_list_t::iterator iter = mVisibleRegionList.begin(); - iter != mVisibleRegionList.end(); ) + for (region_list_t::iterator iter = mVisibleRegionList.begin(), iter_end(mVisibleRegionList.end()); + iter != iter_end; ) { region_list_t::iterator curiter = iter++; LLViewerRegion* regionp = *curiter; @@ -748,8 +749,8 @@ void LLWorld::updateRegions(F32 max_update_time) BOOL did_one = FALSE; // Perform idle time updates for the regions (and associated surfaces) - for (region_list_t::iterator iter = mActiveRegionList.begin()/*mRegionList.begin()*/; - iter != mActiveRegionList.end()/*mRegionList.end()*/; ++iter) + for (region_list_t::iterator iter = mActiveRegionList.begin()/*mRegionList.begin()*/, iter_end(mActiveRegionList.end()/*mRegionList.end()*/); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; F32 max_time = max_update_time - update_timer.getElapsedTimeF32(); @@ -789,8 +790,9 @@ void LLWorld::updateClouds(const F32 dt) { // Update all the cloud puff positions, and timer based stuff // such as death decay + region_list_t::iterator iter_end(mActiveRegionList.end()); for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffs(dt); @@ -798,7 +800,7 @@ void LLWorld::updateClouds(const F32 dt) // Reshuffle who owns which puffs for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffOwnership(); @@ -806,7 +808,7 @@ void LLWorld::updateClouds(const F32 dt) // Add new puffs for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->mCloudLayer.updatePuffCount(); @@ -820,8 +822,8 @@ LLCloudGroup* LLWorld::findCloudGroup(const LLCloudPuff &puff) { // Update all the cloud puff positions, and timer based stuff // such as death decay - for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + for (region_list_t::iterator iter = mActiveRegionList.begin(), iter_end(mActiveRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; LLCloudGroup *groupp = regionp->mCloudLayer.findCloudGroup(puff); @@ -841,8 +843,8 @@ void LLWorld::renderPropertyLines() S32 region_count = 0; S32 vertex_count = 0; - for (region_list_t::iterator iter = mVisibleRegionList.begin(); - iter != mVisibleRegionList.end(); ++iter) + for (region_list_t::iterator iter = mVisibleRegionList.begin(), iter_end(mVisibleRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; region_count++; @@ -856,8 +858,8 @@ void LLWorld::updateNetStats() F32 bits = 0.f; U32 packets = 0; - for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + for (region_list_t::iterator iter = mActiveRegionList.begin(), iter_end(mActiveRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->updateNetStats(); @@ -898,8 +900,8 @@ void LLWorld::printPacketsLost() llinfos << "----------" << llendl; LLCircuitData *cdp = NULL; - for (region_list_t::iterator iter = mActiveRegionList.begin(); - iter != mActiveRegionList.end(); ++iter) + for (region_list_t::iterator iter = mActiveRegionList.begin(), iter_end(mActiveRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; cdp = gMessageSystem->mCircuitInfo.findCircuit(regionp->getHost()); @@ -949,7 +951,7 @@ void LLWorld::setLandFarClip(const F32 far_clip) // a (possibly) new water height. Update it in our local copy. void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_height) { - for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); iter != iter_end; ++iter) { if ((*iter)->getName() == sim_name) { @@ -1188,7 +1190,7 @@ void LLWorld::updateWaterObjects() llinfos << "Water height used for Hole and Edge water objects: " << water_height << llendl; // Update all Region water objects. - for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; LLVOWater* waterp = regionp->getLand().getWaterObj(); @@ -1303,8 +1305,8 @@ U64 LLWorld::getSpaceTimeUSec() const void LLWorld::requestCacheMisses() { - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->requestCacheMisses(); @@ -1314,8 +1316,8 @@ void LLWorld::requestCacheMisses() void LLWorld::getInfo(LLSD& info) { LLSD region_info; - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; regionp->getInfo(region_info); @@ -1326,8 +1328,8 @@ void LLWorld::getInfo(LLSD& info) void LLWorld::disconnectRegions() { LLMessageSystem* msg = gMessageSystem; - for (region_list_t::iterator iter = mRegionList.begin(); - iter != mRegionList.end(); ++iter) + for (region_list_t::iterator iter = mRegionList.begin(), iter_end(mRegionList.end()); + iter != iter_end; ++iter) { LLViewerRegion* regionp = *iter; if (regionp == gAgent.getRegion()) @@ -1376,11 +1378,14 @@ void process_enable_simulator(LLMessageSystem *msg, void **user_data) // Viewer trusts the simulator. msg->enableCircuit(sim, TRUE); // Aurora Sim - U32 region_size_x = 256; - msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeX, region_size_x); - U32 region_size_y = 256; - msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeY, region_size_y); - LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + if (!gHippoGridManager->getConnectedGrid()->isSecondLife()) + { + U32 region_size_x = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeX, region_size_x); + U32 region_size_y = 256; + msg->getU32Fast(_PREHASH_SimulatorInfo, _PREHASH_RegionSizeY, region_size_y); + LLWorld::getInstance()->setRegionSize(region_size_x, region_size_y); + } // Aurora Sim LLWorld::getInstance()->addRegion(handle, sim); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 3afd7bc47..3c41658b9 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -4640,18 +4640,6 @@ void LLPipeline::renderPhysicsDisplay() } } - for (LLCullResult::bridge_iterator i = sCull->beginVisibleBridge(); i != sCull->endVisibleBridge(); ++i) - { - LLSpatialBridge* bridge = *i; - if (!bridge->isDead() && hasRenderType(bridge->mDrawableType)) - { - gGL.pushMatrix(); - gGL.multMatrix(bridge->mDrawable->getRenderMatrix()); - bridge->renderPhysicsShapes(); - gGL.popMatrix(); - } - } - gGL.flush(); if (LLGLSLShader::sNoFixedFunction) diff --git a/indra/newview/rlvcommon.cpp b/indra/newview/rlvcommon.cpp index 5ee7bfba6..3c527118d 100644 --- a/indra/newview/rlvcommon.cpp +++ b/indra/newview/rlvcommon.cpp @@ -398,7 +398,7 @@ void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy) LLAvatarName avName; if (LLAvatarNameCache::get(idAgents[idxAgent], &avName)) { - const std::string& strDisplayName = escape_for_regex(avName.mDisplayName); + const std::string& strDisplayName = escape_for_regex(avName.getDisplayName()); bool fFilterDisplay = (strDisplayName.length() > 2); const std::string& strLegacyName = avName.getLegacyName(); fFilterLegacy &= (strLegacyName.length() > 2); diff --git a/indra/newview/rlvcommon.h b/indra/newview/rlvcommon.h index a4411f146..ef7d90ea6 100644 --- a/indra/newview/rlvcommon.h +++ b/indra/newview/rlvcommon.h @@ -296,7 +296,7 @@ template struct RlvPredValuesEqual // Checked: 2010-10-31 (RLVa-1.2.2a) | Added: RLVa-1.2.2a inline const std::string& RlvStrings::getAnonym(const LLAvatarName& avName) { - return getAnonym(avName.mDisplayName); + return getAnonym(avName.getDisplayName()); } // Checked: 2010-03-26 (RLVa-1.2.0b) | Modified: RLVa-1.0.2a diff --git a/indra/newview/rlvfloaters.cpp b/indra/newview/rlvfloaters.cpp index d409d08ba..8c0ebe1e0 100644 --- a/indra/newview/rlvfloaters.cpp +++ b/indra/newview/rlvfloaters.cpp @@ -243,7 +243,7 @@ void RlvFloaterBehaviours::onBtnCopyToClipboard() if (gObjectList.findObject(idOption)) strOption = rlvGetItemNameFromObjID(idOption, true); else if (LLAvatarNameCache::get(idOption, &avName)) - strOption = (!avName.mUsername.empty()) ? avName.mUsername : avName.mDisplayName; + strOption = (!avName.getAccountName().empty()) ? avName.getAccountName() : avName.getDisplayName(); else if (!gCacheName->getGroupName(idOption, strOption)) strOption = itCmd->getOption(); } @@ -321,7 +321,7 @@ void RlvFloaterBehaviours::refreshAll() } else if (LLAvatarNameCache::get(idOption, &avName)) { - strOption = (!avName.mUsername.empty()) ? avName.mUsername : avName.mDisplayName; + strOption = (!avName.getAccountName().empty()) ? avName.getAccountName() : avName.getDisplayName(); } else if (!gCacheName->getGroupName(idOption, strOption)) { diff --git a/indra/newview/scriptcounter.cpp b/indra/newview/scriptcounter.cpp index f8d2aafd4..61219980b 100644 --- a/indra/newview/scriptcounter.cpp +++ b/indra/newview/scriptcounter.cpp @@ -48,9 +48,7 @@ namespace { void countedScriptsOnAvatar(LLStringUtil::format_map_t args, const LLAvatarName& av_name) { - std::string name; - LLAvatarNameCache::getPNSName(av_name, name); - args["NAME"] = name; + args["NAME"] = av_name.getNSName(); cmdline_printchat(LLTrans::getString("ScriptCountAvatar", args)); } } diff --git a/indra/newview/skins/default/xui/de/floater_customize.xml b/indra/newview/skins/default/xui/de/floater_customize.xml index 31300981a..1c5316b1f 100644 --- a/indra/newview/skins/default/xui/de/floater_customize.xml +++ b/indra/newview/skins/default/xui/de/floater_customize.xml @@ -398,8 +398,7 @@ und dieses anziehen. + +