diff options
Diffstat (limited to 'indra')
153 files changed, 9804 insertions, 7421 deletions
diff --git a/indra/integration_tests/CMakeLists.txt b/indra/integration_tests/CMakeLists.txt index 67e8fbf1f2..5935f23fe9 100644 --- a/indra/integration_tests/CMakeLists.txt +++ b/indra/integration_tests/CMakeLists.txt @@ -1,3 +1,4 @@ # -*- cmake -*- add_subdirectory(llui_libtest) +add_subdirectory(llimage_libtest) diff --git a/indra/integration_tests/llimage_libtest/CMakeLists.txt b/indra/integration_tests/llimage_libtest/CMakeLists.txt new file mode 100644 index 0000000000..f59440be6b --- /dev/null +++ b/indra/integration_tests/llimage_libtest/CMakeLists.txt @@ -0,0 +1,131 @@ +# -*- cmake -*- + +# Integration tests of the llimage library (JPEG2000, PNG, jpeg, etc... images reading and writing) + +project (llimage_libtest) + +include(00-Common) +include(LLCommon) +include(Linking) +include(LLSharedLibs) +include(LLImage) +include(LLImageJ2COJ) +include(LLKDU) +include(LLMath) +include(LLVFS) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLVFS_INCLUDE_DIRS} + ${LLIMAGE_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ) + +set(llimage_libtest_SOURCE_FILES + llimage_libtest.cpp + ) + +set(llimage_libtest_HEADER_FILES + CMakeLists.txt + llimage_libtest.h + ) + +set_source_files_properties(${llimage_libtest_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND llimage_libtest_SOURCE_FILES ${llimage_libtest_HEADER_FILES}) + +add_executable(llimage_libtest + WIN32 + MACOSX_BUNDLE + ${llimage_libtest_SOURCE_FILES} +) + +set_target_properties(llimage_libtest + PROPERTIES + WIN32_EXECUTABLE + FALSE +) + +# OS-specific libraries +if (DARWIN) + include(CMakeFindFrameworks) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + set(OS_LIBRARIES ${COREFOUNDATION_LIBRARY}) +elseif (WINDOWS) +# set(OS_LIBRARIES) +elseif (LINUX) +# set(OS_LIBRARIES) +else (DARWIN) + message(FATAL_ERROR "Unknown platform") +endif (DARWIN) + +# Libraries on which this application depends on +# Sort by high-level to low-level +target_link_libraries(llimage_libtest + ${LLCOMMON_LIBRARIES} + ${LLVFS_LIBRARIES} + ${LLIMAGE_LIBRARIES} + ${LLKDU_LIBRARIES} + ${KDU_LIBRARY} + ${LLIMAGEJ2COJ_LIBRARIES} + ${OS_LIBRARIES} + ) + +if (DARWIN) + # Path inside the app bundle where we'll need to copy libraries + set(LLIMAGE_LIBTEST_DESTINATION_DIR + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/llimage_libtest.app/Contents/Resources + ) + # Create the Contents/Resources directory + add_custom_command( + TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} + ARGS + -E + make_directory + ${LLIMAGE_LIBTEST_DESTINATION_DIR} + COMMENT "Creating Resources directory in app bundle." + ) +else (DARWIN) + set(LLIMAGE_LIBTEST_DESTINATION_DIR + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ + ) +endif (DARWIN) + +get_target_property(BUILT_LLCOMMON llcommon LOCATION) +add_custom_command(TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${BUILT_LLCOMMON} ${LLIMAGE_LIBTEST_DESTINATION_DIR} + DEPENDS ${BUILT_LLCOMMON} +) + +if (DARWIN) + # Copy the required libraries to the package app + add_custom_command(TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} + DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libapr-1.0.3.7.dylib + ) + add_custom_command(TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} + DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libaprutil-1.0.3.8.dylib + ) + add_custom_command(TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} + DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexception_handler.dylib + ) + add_custom_command(TARGET llimage_libtest POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib ${LLIMAGE_LIBTEST_DESTINATION_DIR} + DEPENDS ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libexpat.0.5.0.dylib + ) +endif (DARWIN) + +if (WINDOWS) + # Check indra/test_apps/llplugintest/CMakeLists.txt for an example of what to copy over for Windows and how +endif (WINDOWS) + +# Ensure people working on the viewer don't break this library +# *NOTE: This could be removed, or only built by TeamCity, if the build +# and link times become too long. +add_dependencies(viewer llimage_libtest) + +ll_deploy_sharedlibs_command(llimage_libtest) diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.cpp b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp new file mode 100644 index 0000000000..365f5f758c --- /dev/null +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.cpp @@ -0,0 +1,437 @@ +/** + * @file llimage_libtest.cpp + * @author Merov Linden + * @brief Integration test for the llimage library + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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 "llpointer.h" +#include "lltimer.h" + +#include "llimage_libtest.h" + +// Linden library includes +#include "llimage.h" +#include "llimagejpeg.h" +#include "llimagepng.h" +#include "llimagebmp.h" +#include "llimagetga.h" +#include "llimagej2c.h" +#include "lldir.h" + +// system libraries +#include <iostream> + +// doc string provided when invoking the program with --help +static const char USAGE[] = "\n" +"usage:\tllimage_libtest [options]\n" +"\n" +" -h, --help\n" +" Print this help\n" +" -i, --input <file1 .. file2>\n" +" List of image files to load and convert. Patterns with wild cards can be used.\n" +" -o, --output <file1 .. file2> OR <type>\n" +" List of image files to create (assumes same order as for input files)\n" +" OR 3 letters file type extension to convert each input file into.\n" +" -log, --logmetrics <metric>\n" +" Log performance data for <metric>. Results in <metric>.slp\n" +" Note: so far, only ImageCompressionTester has been tested.\n" +" -r, --analyzeperformance\n" +" Create a report comparing <metric>_baseline.slp with current <metric>.slp\n" +" Results in <metric>_report.csv" +" -s, --image-stats\n" +" Output stats for each input and output image.\n" +"\n"; + +// true when all image loading is done. Used by metric logging thread to know when to stop the thread. +static bool sAllDone = false; + +// Create an empty formatted image instance of the correct type from the filename +LLPointer<LLImageFormatted> create_image(const std::string &filename) +{ + std::string exten = gDirUtilp->getExtension(filename); + U32 codec = LLImageBase::getCodecFromExtension(exten); + + LLPointer<LLImageFormatted> image; + switch (codec) + { + case IMG_CODEC_BMP: + image = new LLImageBMP(); + break; + case IMG_CODEC_TGA: + image = new LLImageTGA(); + break; + case IMG_CODEC_JPEG: + image = new LLImageJPEG(); + break; + case IMG_CODEC_J2C: + image = new LLImageJ2C(); + break; + case IMG_CODEC_PNG: + image = new LLImagePNG(); + break; + default: + return NULL; + } + + return image; +} + +void output_image_stats(LLPointer<LLImageFormatted> image, const std::string &filename) +{ + // Print out some statistical data on the image + std::cout << "Image stats for : " << filename << ", extension : " << image->getExtension() << std::endl; + + std::cout << " with : " << (int)(image->getWidth()) << ", height : " << (int)(image->getHeight()) << std::endl; + std::cout << " comp : " << (int)(image->getComponents()) << ", levels : " << (int)(image->getDiscardLevel()) << std::endl; + std::cout << " head : " << (int)(image->calcHeaderSize()) << ", data : " << (int)(image->getDataSize()) << std::endl; + + return; +} + +// Load an image from file and return a raw (decompressed) instance of its data +LLPointer<LLImageRaw> load_image(const std::string &src_filename, bool output_stats) +{ + LLPointer<LLImageFormatted> image = create_image(src_filename); + + if (!image->load(src_filename)) + { + return NULL; + } + + if( (image->getComponents() != 3) && (image->getComponents() != 4) ) + { + std::cout << "Image files with less than 3 or more than 4 components are not supported\n"; + return NULL; + } + + if (output_stats) + { + output_image_stats(image, src_filename); + } + + LLPointer<LLImageRaw> raw_image = new LLImageRaw; + if (!image->decode(raw_image, 0.0f)) + { + return NULL; + } + + return raw_image; +} + +// Save a raw image instance into a file +bool save_image(const std::string &dest_filename, LLPointer<LLImageRaw> raw_image, bool output_stats) +{ + LLPointer<LLImageFormatted> image = create_image(dest_filename); + + if (!image->encode(raw_image, 0.0f)) + { + return false; + } + + if (output_stats) + { + output_image_stats(image, dest_filename); + } + + return image->save(dest_filename); +} + +void store_input_file(std::list<std::string> &input_filenames, const std::string &path) +{ + // Break the incoming path in its components + std::string dir = gDirUtilp->getDirName(path); + std::string name = gDirUtilp->getBaseFileName(path); + std::string exten = gDirUtilp->getExtension(path); + + // std::cout << "store_input_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl; + + // If extension is not an image type or "*", exit + // Note: we don't support complex patterns for the extension like "j??" + // Note: on most shells, the pattern expansion is done by the shell so that pattern matching limitation is actually not a problem + if ((exten.compare("*") != 0) && (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID)) + { + return; + } + + if ((name.find('*') != -1) || ((name.find('?') != -1))) + { + // If file name is a pattern, iterate to get each file name and store + std::string next_name; + while (gDirUtilp->getNextFileInDir(dir,name,next_name)) + { + std::string file_name = dir + gDirUtilp->getDirDelimiter() + next_name; + input_filenames.push_back(file_name); + } + } + else + { + // Verify that the file does exist before storing + if (gDirUtilp->fileExists(path)) + { + input_filenames.push_back(path); + } + else + { + std::cout << "store_input_file : the file " << path << " could not be found" << std::endl; + } + } +} + +void store_output_file(std::list<std::string> &output_filenames, std::list<std::string> &input_filenames, const std::string &path) +{ + // Break the incoming path in its components + std::string dir = gDirUtilp->getDirName(path); + std::string name = gDirUtilp->getBaseFileName(path); + std::string exten = gDirUtilp->getExtension(path); + + // std::cout << "store_output_file : " << path << ", dir : " << dir << ", name : " << name << ", exten : " << exten << std::endl; + + if (dir.empty() && exten.empty()) + { + // If dir and exten are empty, we interpret the name as a file extension type name and will iterate through input list to populate the output list + exten = name; + // Make sure the extension is an image type + if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID) + { + return; + } + std::string delim = gDirUtilp->getDirDelimiter(); + std::list<std::string>::iterator in_file = input_filenames.begin(); + std::list<std::string>::iterator end = input_filenames.end(); + for (; in_file != end; ++in_file) + { + dir = gDirUtilp->getDirName(*in_file); + name = gDirUtilp->getBaseFileName(*in_file,true); + std::string file_name; + if (!dir.empty()) + { + file_name = dir + delim + name + "." + exten; + } + else + { + file_name = name + "." + exten; + } + output_filenames.push_back(file_name); + } + } + else + { + // Make sure the extension is an image type + if (LLImageBase::getCodecFromExtension(exten) == IMG_CODEC_INVALID) + { + return; + } + // Store the path + output_filenames.push_back(path); + } +} + +// Holds the metric gathering output in a thread safe way +class LogThread : public LLThread +{ +public: + std::string mFile; + + LogThread(std::string& test_name) : LLThread("llimage_libtest log") + { + std::string file_name = test_name + std::string(".slp"); + mFile = file_name; + } + + void run() + { + std::ofstream os(mFile.c_str()); + + while (!sAllDone) + { + LLFastTimer::writeLog(os); + os.flush(); + ms_sleep(32); + } + LLFastTimer::writeLog(os); + os.flush(); + os.close(); + } +}; + +int main(int argc, char** argv) +{ + // List of input and output files + std::list<std::string> input_filenames; + std::list<std::string> output_filenames; + bool analyze_performance = false; + bool image_stats = false; + + // Init whatever is necessary + ll_init_apr(); + LLImage::initClass(); + LogThread* fast_timer_log_thread = NULL; // For performance and metric gathering + + // Analyze command line arguments + for (int arg = 1; arg < argc; ++arg) + { + if (!strcmp(argv[arg], "--help") || !strcmp(argv[arg], "-h")) + { + // Send the usage to standard out + std::cout << USAGE << std::endl; + return 0; + } + else if ((!strcmp(argv[arg], "--input") || !strcmp(argv[arg], "-i")) && arg < argc-1) + { + std::string file_name = argv[arg+1]; + while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument + { + // std::cout << "input file name : " << file_name << std::endl; + store_input_file(input_filenames, file_name); + arg += 1; // Skip that arg now we know it's a file name + if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list + break; + file_name = argv[arg+1]; // Next argument and loop over + } + } + else if ((!strcmp(argv[arg], "--output") || !strcmp(argv[arg], "-o")) && arg < argc-1) + { + std::string file_name = argv[arg+1]; + while (file_name[0] != '-') // if arg starts with '-', we consider it's not a file name but some other argument + { + // std::cout << "output file name : " << file_name << std::endl; + store_output_file(output_filenames, input_filenames, file_name); + arg += 1; // Skip that arg now we know it's a file name + if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list + break; + file_name = argv[arg+1]; // Next argument and loop over + } + } + else if (!strcmp(argv[arg], "--logmetrics") || !strcmp(argv[arg], "-log")) + { + // '--logmetrics' needs to be specified with a named test metric argument + // Note: for the moment, only ImageCompressionTester has been tested + std::string test_name; + if ((arg + 1) < argc) + { + test_name = argv[arg+1]; + } + if (((arg + 1) >= argc) || (test_name[0] == '-')) + { + // We don't have an argument left in the arg list or the next argument is another option + std::cout << "No --logmetrics argument given, no perf data will be gathered" << std::endl; + } + else + { + LLFastTimer::sMetricLog = TRUE; + LLFastTimer::sLogName = test_name; + arg += 1; // Skip that arg now we know it's a valid test name + if ((arg + 1) == argc) // Break out of the loop if we reach the end of the arg list + break; + } + } + else if (!strcmp(argv[arg], "--analyzeperformance") || !strcmp(argv[arg], "-r")) + { + analyze_performance = true; + } + else if (!strcmp(argv[arg], "--image-stats") || !strcmp(argv[arg], "-s")) + { + image_stats = true; + } + } + + // Check arguments consistency. Exit with proper message if inconsistent. + if (input_filenames.size() == 0) + { + std::cout << "No input file, nothing to do -> exit" << std::endl; + return 0; + } + if (analyze_performance && !LLFastTimer::sMetricLog) + { + std::cout << "Cannot create perf report if no perf gathered (i.e. use argument -log <perf> with -r) -> exit" << std::endl; + return 0; + } + + + // Create the logging thread if required + if (LLFastTimer::sMetricLog) + { + LLFastTimer::sLogLock = new LLMutex(NULL); + fast_timer_log_thread = new LogThread(LLFastTimer::sLogName); + fast_timer_log_thread->start(); + } + + // Perform action on each input file + std::list<std::string>::iterator in_file = input_filenames.begin(); + std::list<std::string>::iterator out_file = output_filenames.begin(); + std::list<std::string>::iterator in_end = input_filenames.end(); + std::list<std::string>::iterator out_end = output_filenames.end(); + for (; in_file != in_end; ++in_file) + { + // Load file + LLPointer<LLImageRaw> raw_image = load_image(*in_file, image_stats); + if (!raw_image) + { + std::cout << "Error: Image " << *in_file << " could not be loaded" << std::endl; + continue; + } + + // Save file + if (out_file != out_end) + { + if (!save_image(*out_file, raw_image, image_stats)) + { + std::cout << "Error: Image " << *out_file << " could not be saved" << std::endl; + } + else + { + std::cout << *in_file << " -> " << *out_file << std::endl; + } + ++out_file; + } + } + + // Stop the perf gathering system if needed + if (LLFastTimer::sMetricLog) + { + LLMetricPerformanceTesterBasic::deleteTester(LLFastTimer::sLogName); + sAllDone = true; + } + + // Output perf data if requested by user + if (analyze_performance) + { + std::cout << "Analyzing performance" << std::endl; + + std::string baseline_name = LLFastTimer::sLogName + "_baseline.slp"; + std::string current_name = LLFastTimer::sLogName + ".slp"; + std::string report_name = LLFastTimer::sLogName + "_report.csv"; + + LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline_name, current_name, report_name); + } + + // Cleanup and exit + LLImage::cleanupClass(); + if (fast_timer_log_thread) + { + fast_timer_log_thread->shutdown(); + } + + return 0; +} diff --git a/indra/integration_tests/llimage_libtest/llimage_libtest.h b/indra/integration_tests/llimage_libtest/llimage_libtest.h new file mode 100644 index 0000000000..63f3d46b50 --- /dev/null +++ b/indra/integration_tests/llimage_libtest/llimage_libtest.h @@ -0,0 +1,29 @@ +/** + * @file llimage_libtest.h + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ +#ifndef LLIMAGE_LIBTEST_H +#define LLIMAGE_LIBTEST_H + + +#endif diff --git a/indra/llcommon/llmetricperformancetester.cpp b/indra/llcommon/llmetricperformancetester.cpp index 5fa3a5ea07..41d3eb0bf3 100644 --- a/indra/llcommon/llmetricperformancetester.cpp +++ b/indra/llcommon/llmetricperformancetester.cpp @@ -63,7 +63,18 @@ BOOL LLMetricPerformanceTesterBasic::addTester(LLMetricPerformanceTesterBasic* t sTesterMap.insert(std::make_pair(name, tester)); return TRUE; } - + +/*static*/ +void LLMetricPerformanceTesterBasic::deleteTester(std::string name) +{ + name_tester_map_t::iterator tester = sTesterMap.find(name); + if (tester != sTesterMap.end()) + { + delete tester->second; + sTesterMap.erase(tester); + } +} + /*static*/ LLMetricPerformanceTesterBasic* LLMetricPerformanceTesterBasic::getTester(std::string name) { @@ -83,7 +94,78 @@ BOOL LLMetricPerformanceTesterBasic::isMetricLogRequested(std::string name) return (LLFastTimer::sMetricLog && ((LLFastTimer::sLogName == name) || (LLFastTimer::sLogName == DEFAULT_METRIC_NAME))); } +/*static*/ +LLSD LLMetricPerformanceTesterBasic::analyzeMetricPerformanceLog(std::istream& is) +{ + LLSD ret; + LLSD cur; + + while (!is.eof() && LLSDSerialize::fromXML(cur, is)) + { + for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) + { + std::string label = iter->first; + + LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ; + if(tester) + { + ret[label]["Name"] = iter->second["Name"] ; + + S32 num_of_metrics = tester->getNumberOfMetrics() ; + for(S32 index = 0 ; index < num_of_metrics ; index++) + { + ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; + } + } + } + } + + return ret; +} + +/*static*/ +void LLMetricPerformanceTesterBasic::doAnalysisMetrics(std::string baseline, std::string target, std::string output) +{ + if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) + { + return ; + } + + // Open baseline and current target, exit if one is inexistent + std::ifstream base_is(baseline.c_str()); + std::ifstream target_is(target.c_str()); + if (!base_is.is_open() || !target_is.is_open()) + { + llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; + base_is.close(); + target_is.close(); + return; + } + //analyze baseline + LLSD base = analyzeMetricPerformanceLog(base_is); + base_is.close(); + + //analyze current + LLSD current = analyzeMetricPerformanceLog(target_is); + target_is.close(); + + //output comparision + std::ofstream os(output.c_str()); + + os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; + for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; + iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter) + { + LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ; + tester->analyzePerformance(&os, &base, ¤t) ; + } + + os.flush(); + os.close(); +} + + //---------------------------------------------------------------------------------------------- // LLMetricPerformanceTesterBasic : Tester instance methods //---------------------------------------------------------------------------------------------- diff --git a/indra/llcommon/llmetricperformancetester.h b/indra/llcommon/llmetricperformancetester.h index 1372f48dcf..1a18cdf36f 100644 --- a/indra/llcommon/llmetricperformancetester.h +++ b/indra/llcommon/llmetricperformancetester.h @@ -62,6 +62,8 @@ public: */ virtual void analyzePerformance(std::ofstream* os, LLSD* base, LLSD* current) ; + static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; + /** * @return Returns the number of the test metrics in this tester instance. */ @@ -116,6 +118,7 @@ protected: private: void preOutputTestResults(LLSD* sd) ; void postOutputTestResults(LLSD* sd) ; + static LLSD analyzeMetricPerformanceLog(std::istream& is) ; std::string mName ; // Name of this tester instance S32 mCount ; // Current record count @@ -135,6 +138,12 @@ public: static LLMetricPerformanceTesterBasic* getTester(std::string name) ; /** + * @return Delete the named tester from the list + * @param[in] name - Name of the tester instance to delete. + */ + static void deleteTester(std::string name); + + /** * @return Returns TRUE if that metric *or* the default catch all metric has been requested to be logged * @param[in] name - Name of the tester queried. */ diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 7d5afe92dc..488ec5b239 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -29,7 +29,7 @@ const S32 LL_VERSION_MAJOR = 2; const S32 LL_VERSION_MINOR = 6; -const S32 LL_VERSION_PATCH = 0; +const S32 LL_VERSION_PATCH = 3; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Developer"; diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 825b9aab1a..18444f3934 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -266,13 +266,13 @@ public: // subclasses must return a prefered file extension (lowercase without a leading dot) virtual std::string getExtension() = 0; // calcHeaderSize() returns the maximum size of header; - // 0 indicates we don't know have a header and have to lead the entire file + // 0 indicates we don't have a header and have to read the entire file virtual S32 calcHeaderSize() { return 0; }; // calcDataSize() returns how many bytes to read to load discard_level (including header) virtual S32 calcDataSize(S32 discard_level); // calcDiscardLevelBytes() returns the smallest valid discard level based on the number of input bytes virtual S32 calcDiscardLevelBytes(S32 bytes); - // getRawDiscardLevel()by default returns mDiscardLevel, but may be overridden (LLImageJ2C) + // getRawDiscardLevel() by default returns mDiscardLevel, but may be overridden (LLImageJ2C) virtual S8 getRawDiscardLevel() { return mDiscardLevel; } BOOL load(const std::string& filename); diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index cb2a85fa91..80fec7f8a0 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -474,6 +474,7 @@ LLImageCompressionTester::LLImageCompressionTester() : LLMetricPerformanceTester LLImageCompressionTester::~LLImageCompressionTester() { + outputTestResults(); LLImageJ2C::sTesterp = NULL; } diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp index 35e0d9d890..d19e33ea55 100644 --- a/indra/llui/llfloater.cpp +++ b/indra/llui/llfloater.cpp @@ -2869,7 +2869,7 @@ void LLFloater::initFromParams(const LLFloater::Params& p) // close callback if (p.close_callback.isProvided()) { - mCloseSignal.connect(initCommitCallback(p.close_callback)); + setCloseCallback(initCommitCallback(p.close_callback)); } } @@ -2879,6 +2879,11 @@ boost::signals2::connection LLFloater::setMinimizeCallback( const commit_signal_ return mMinimizeSignal->connect(cb); } +boost::signals2::connection LLFloater::setCloseCallback( const commit_signal_t::slot_type& cb ) +{ + return mCloseSignal.connect(cb); +} + LLFastTimer::DeclareTimer POST_BUILD("Floater Post Build"); bool LLFloater::initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node) diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h index 0e83b80c89..5b7b020881 100644 --- a/indra/llui/llfloater.h +++ b/indra/llui/llfloater.h @@ -144,6 +144,7 @@ public: bool buildFromFile(const std::string &filename, LLXMLNodePtr output_node = NULL); boost::signals2::connection setMinimizeCallback( const commit_signal_t::slot_type& cb ); + boost::signals2::connection setCloseCallback( const commit_signal_t::slot_type& cb ); void initFromParams(const LLFloater::Params& p); bool initFloaterXML(LLXMLNodePtr node, LLView *parent, const std::string& filename, LLXMLNodePtr output_node = NULL); diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp index 32d7be377a..f0374de98f 100644 --- a/indra/llui/llmenugl.cpp +++ b/indra/llui/llmenugl.cpp @@ -1936,9 +1936,15 @@ bool LLMenuGL::scrollItems(EScrollingDirection direction) { item_list_t::reverse_iterator first_visible_item_iter = mItems.rend(); + // Need to scroll through number of actual existing items in menu. + // Otherwise viewer will hang for a time needed to scroll U32_MAX + // times in std::advance(). STORM-659. + size_t nitems = mItems.size(); + U32 scrollable_items = nitems < mMaxScrollableItems ? nitems : mMaxScrollableItems; + // Advance by mMaxScrollableItems back from the end of the list // to make the last item visible. - std::advance(first_visible_item_iter, mMaxScrollableItems); + std::advance(first_visible_item_iter, scrollable_items); mFirstVisibleItem = *first_visible_item_iter; break; } diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml index 89fd4e5935..17d3d3c9c5 100644 --- a/indra/newview/app_settings/ignorable_dialogs.xml +++ b/indra/newview/app_settings/ignorable_dialogs.xml @@ -122,7 +122,17 @@ <key>Value</key> <integer>1</integer> </map> - + <key>FirstSpeak</key> + <map> + <key>Comment</key> + <string>Shows hint for Speak button</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> <key>FirstSit</key> <map> <key>Comment</key> diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index f0e28d4ae3..14f1b3c4ba 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -12102,6 +12102,17 @@ <key>Value</key> <real>0.40000000596</real> </map> + <key>moapbeacon</key> + <map> + <key>Comment</key> + <string>Beacon / Highlight media on a prim sources</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>particlesbeacon</key> <map> <key>Comment</key> diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp index 1fb83fe567..0371b7be71 100644 --- a/indra/newview/llbottomtray.cpp +++ b/indra/newview/llbottomtray.cpp @@ -55,6 +55,7 @@ #include "llviewerwindow.h" #include "llsdserialize.h" +#include "llfirstuse.h" // Distance from mouse down on which drag'n'drop should be started. #define DRAG_START_DISTANCE 3 @@ -381,7 +382,12 @@ void LLBottomTray::onChange(EStatusType status, const std::string &channelURI, b // skipped to avoid button blinking if (status != STATUS_JOINING && status!= STATUS_LEFT_CHANNEL) { - mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking()); + bool voice_status = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); + mSpeakBtn->setFlyoutBtnEnabled(voice_status); + if (voice_status) + { + LLFirstUse::speak(true); + } } } @@ -561,6 +567,7 @@ BOOL LLBottomTray::postBuild() mSpeakPanel = getChild<LLPanel>("speak_panel"); mSpeakBtn = getChild<LLSpeakButton>("talk"); + LLHints::registerHintTarget("speak_btn", mSpeakBtn->getHandle()); // Both parts of speak button should be initially disabled because // it takes some time between logging in to world and connecting to voice channel. diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index 328c326278..945a760d05 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -50,6 +50,7 @@ #include "llviewerwindow.h" #include "llvoicechannel.h" #include "llviewerparcelmgr.h" +#include "llfirstuse.h" static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids); void reshape_floater(LLCallFloater* floater, S32 delta_height); @@ -170,13 +171,13 @@ BOOL LLCallFloater::postBuild() updateTransparency(TT_ACTIVE); // force using active floater transparency (STORM-730) updateSession(); - return TRUE; } // virtual void LLCallFloater::onOpen(const LLSD& /*key*/) { + LLFirstUse::speak(false); } // virtual diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index d4ec377e03..c0c9ea1451 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -793,21 +793,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull()) { // for object IMs, create a secondlife:///app/objectim SLapp - std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); - url += "?name=" + chat.mFromName; - url += "&owner=" + chat.mOwnerID.asString(); - - std::string slurl = args["slurl"].asString(); - if (slurl.empty()) - { - LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); - if(region) - { - LLSLURL region_slurl(region->getName(), chat.mPosAgent); - slurl = region_slurl.getLocationString(); - } - } - url += "&slurl=" + LLURI::escape(slurl); + std::string url = LLViewerChat::getSenderSLURL(chat, args); // set the link for the object name to be the objectim SLapp // (don't let object names with hyperlinks override our objectim Url) diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 899e0431e7..8584885bc9 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -213,17 +213,6 @@ void LLNearbyChatToastPanel::init(LLSD& notification) { LLStyle::Params style_params_name; - std::string href; - - if (mSourceType == CHAT_SOURCE_AGENT) - { - href = LLSLURL("agent", mFromID, "about").getSLURLString(); - } - else - { - href = LLSLURL("object", mFromID, "inspect").getSLURLString(); - } - LLColor4 user_name_color = LLUIColorTable::instance().getColor("HTMLLinkColor"); style_params_name.color(user_name_color); @@ -232,7 +221,7 @@ void LLNearbyChatToastPanel::init(LLSD& notification) style_params_name.font.name(font_name); style_params_name.font.size(font_style_size); - style_params_name.link_href = href; + style_params_name.link_href = notification["sender_slurl"].asString(); style_params_name.is_link = true; msg_text->appendText(str_sender, FALSE, style_params_name); diff --git a/indra/newview/llexternaleditor.cpp b/indra/newview/llexternaleditor.cpp index 54968841ab..ed1d7e860a 100644 --- a/indra/newview/llexternaleditor.cpp +++ b/indra/newview/llexternaleditor.cpp @@ -27,6 +27,7 @@ #include "llviewerprecompiledheaders.h" #include "llexternaleditor.h" +#include "lltrans.h" #include "llui.h" // static @@ -35,13 +36,13 @@ const std::string LLExternalEditor::sFilenameMarker = "%s"; // static const std::string LLExternalEditor::sSetting = "ExternalEditor"; -bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& override) +LLExternalEditor::EErrorCode LLExternalEditor::setCommand(const std::string& env_var, const std::string& override) { std::string cmd = findCommand(env_var, override); if (cmd.empty()) { - llwarns << "Empty editor command" << llendl; - return false; + llwarns << "Editor command is empty or not set" << llendl; + return EC_NOT_SPECIFIED; } // Add the filename marker if missing. @@ -55,7 +56,7 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& if (tokenize(tokens, cmd) < 2) // 2 = bin + at least one arg (%s) { llwarns << "Error parsing editor command" << llendl; - return false; + return EC_PARSE_ERROR; } // Check executable for existence. @@ -63,7 +64,7 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& if (!LLFile::isfile(bin_path)) { llwarns << "Editor binary [" << bin_path << "] not found" << llendl; - return false; + return EC_BINARY_NOT_FOUND; } // Save command. @@ -76,16 +77,16 @@ bool LLExternalEditor::setCommand(const std::string& env_var, const std::string& } llinfos << "Setting command [" << bin_path << " " << mArgs << "]" << llendl; - return true; + return EC_SUCCESS; } -bool LLExternalEditor::run(const std::string& file_path) +LLExternalEditor::EErrorCode LLExternalEditor::run(const std::string& file_path) { std::string args = mArgs; if (mProcess.getExecutable().empty() || args.empty()) { llwarns << "Editor command not set" << llendl; - return false; + return EC_NOT_SPECIFIED; } // Substitute the filename marker in the command with the actual passed file name. @@ -111,7 +112,22 @@ bool LLExternalEditor::run(const std::string& file_path) mProcess.orphan(); } - return result == 0; + return result == 0 ? EC_SUCCESS : EC_FAILED_TO_RUN; +} + +// static +std::string LLExternalEditor::getErrorMessage(EErrorCode code) +{ + switch (code) + { + case EC_SUCCESS: return LLTrans::getString("ok"); + case EC_NOT_SPECIFIED: return LLTrans::getString("ExternalEditorNotSet"); + case EC_PARSE_ERROR: return LLTrans::getString("ExternalEditorCommandParseError"); + case EC_BINARY_NOT_FOUND: return LLTrans::getString("ExternalEditorNotFound"); + case EC_FAILED_TO_RUN: return LLTrans::getString("ExternalEditorFailedToRun"); + } + + return LLTrans::getString("Unknown"); } // static diff --git a/indra/newview/llexternaleditor.h b/indra/newview/llexternaleditor.h index 6ea210d5e2..ef5db56c6e 100644 --- a/indra/newview/llexternaleditor.h +++ b/indra/newview/llexternaleditor.h @@ -42,6 +42,14 @@ class LLExternalEditor public: + typedef enum e_error_code { + EC_SUCCESS, /// No error. + EC_NOT_SPECIFIED, /// Editor path not specified. + EC_PARSE_ERROR, /// Editor command parsing error. + EC_BINARY_NOT_FOUND, /// Could find the editor binary (missing or not quoted). + EC_FAILED_TO_RUN, /// Could not execute the editor binary. + } EErrorCode; + /** * Set editor command. * @@ -51,19 +59,25 @@ public: * First tries the override, then a predefined setting (sSetting), * then the environment variable. * - * @return Command if found, empty string otherwise. + * @return EC_SUCCESS if command is valid and refers to an existing executable, + * EC_NOT_SPECIFIED or EC_FAILED_TO_RUNan on error. * * @see sSetting */ - bool setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null); + EErrorCode setCommand(const std::string& env_var, const std::string& override = LLStringUtil::null); /** * Run the editor with the given file. * * @param file_path File to edit. - * @return true on success, false on error. + * @return EC_SUCCESS on success, error code on error. + */ + EErrorCode run(const std::string& file_path); + + /** + * Get a meaningful error message for the given status code. */ - bool run(const std::string& file_path); + static std::string getErrorMessage(EErrorCode code); private: diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp index 92a3b9b2f5..279904b740 100644 --- a/indra/newview/llfasttimerview.cpp +++ b/indra/newview/llfasttimerview.cpp @@ -1149,36 +1149,6 @@ void LLFastTimerView::doAnalysisDefault(std::string baseline, std::string target os.close(); } -//------------------------- -//static -LLSD LLFastTimerView::analyzeMetricPerformanceLog(std::istream& is) -{ - LLSD ret; - LLSD cur; - - while (!is.eof() && LLSDSerialize::fromXML(cur, is)) - { - for (LLSD::map_iterator iter = cur.beginMap(); iter != cur.endMap(); ++iter) - { - std::string label = iter->first; - - LLMetricPerformanceTesterBasic* tester = LLMetricPerformanceTesterBasic::getTester(iter->second["Name"].asString()) ; - if(tester) - { - ret[label]["Name"] = iter->second["Name"] ; - - S32 num_of_metrics = tester->getNumberOfMetrics() ; - for(S32 index = 0 ; index < num_of_metrics ; index++) - { - ret[label][ tester->getMetricName(index) ] = iter->second[ tester->getMetricName(index) ] ; - } - } - } - } - - return ret; -} - //static void LLFastTimerView::outputAllMetrics() { @@ -1194,48 +1164,6 @@ void LLFastTimerView::outputAllMetrics() } //static -void LLFastTimerView::doAnalysisMetrics(std::string baseline, std::string target, std::string output) -{ - if(!LLMetricPerformanceTesterBasic::hasMetricPerformanceTesters()) - { - return ; - } - - // Open baseline and current target, exit if one is inexistent - std::ifstream base_is(baseline.c_str()); - std::ifstream target_is(target.c_str()); - if (!base_is.is_open() || !target_is.is_open()) - { - llwarns << "'-analyzeperformance' error : baseline or current target file inexistent" << llendl; - base_is.close(); - target_is.close(); - return; - } - - //analyze baseline - LLSD base = analyzeMetricPerformanceLog(base_is); - base_is.close(); - - //analyze current - LLSD current = analyzeMetricPerformanceLog(target_is); - target_is.close(); - - //output comparision - std::ofstream os(output.c_str()); - - os << "Label, Metric, Base(B), Target(T), Diff(T-B), Percentage(100*T/B)\n"; - for(LLMetricPerformanceTesterBasic::name_tester_map_t::iterator iter = LLMetricPerformanceTesterBasic::sTesterMap.begin() ; - iter != LLMetricPerformanceTesterBasic::sTesterMap.end() ; ++iter) - { - LLMetricPerformanceTesterBasic* tester = ((LLMetricPerformanceTesterBasic*)iter->second) ; - tester->analyzePerformance(&os, &base, ¤t) ; - } - - os.flush(); - os.close(); -} - -//static void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std::string output) { if(LLFastTimer::sLog) @@ -1246,7 +1174,7 @@ void LLFastTimerView::doAnalysis(std::string baseline, std::string target, std:: if(LLFastTimer::sMetricLog) { - doAnalysisMetrics(baseline, target, output) ; + LLMetricPerformanceTesterBasic::doAnalysisMetrics(baseline, target, output) ; return ; } } diff --git a/indra/newview/llfasttimerview.h b/indra/newview/llfasttimerview.h index 1a54a53f09..b40d7ffc1a 100644 --- a/indra/newview/llfasttimerview.h +++ b/indra/newview/llfasttimerview.h @@ -42,8 +42,6 @@ public: private: static void doAnalysisDefault(std::string baseline, std::string target, std::string output) ; - static void doAnalysisMetrics(std::string baseline, std::string target, std::string output) ; - static LLSD analyzeMetricPerformanceLog(std::istream& is) ; static LLSD analyzePerformanceLogDefault(std::istream& is) ; public: diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index e319418def..d63685e1af 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -78,6 +78,12 @@ void LLFirstUse::otherAvatarChatFirst(bool enable) } // static +void LLFirstUse::speak(bool enable) +{ + firstUseNotification("FirstSpeak", enable, "HintSpeak", LLSD(), LLSD().with("target", "speak_btn").with("direction", "top")); +} + +// static void LLFirstUse::sit(bool enable) { firstUseNotification("FirstSit", enable, "HintSit", LLSD(), LLSD().with("target", "stand_btn").with("direction", "top")); diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h index 42b2ec0c60..4c8c9d3cde 100644 --- a/indra/newview/llfirstuse.h +++ b/indra/newview/llfirstuse.h @@ -68,6 +68,8 @@ object or from inventory. 13. First time you open the debug menus (ctrl-alt-shift D) 14. First time you create/edit a sculpted prim. + +15. Explanation of Speak&flyout buttons. */ class LLNotification; @@ -85,6 +87,7 @@ public: static void resetFirstUse(); static void otherAvatarChatFirst(bool enable = true); + static void speak(bool enable = true); static void sit(bool enable = true); static void notUsingDestinationGuide(bool enable = true); static void notUsingSidePanel(bool enable = true); diff --git a/indra/newview/llfloaterbeacons.cpp b/indra/newview/llfloaterbeacons.cpp index e24df948c4..316294a477 100644 --- a/indra/newview/llfloaterbeacons.cpp +++ b/indra/newview/llfloaterbeacons.cpp @@ -48,6 +48,7 @@ LLFloaterBeacons::LLFloaterBeacons(const LLSD& seed) LLPipeline::setRenderParticleBeacons( gSavedSettings.getBOOL("particlesbeacon")); LLPipeline::setRenderHighlights( gSavedSettings.getBOOL("renderhighlights")); LLPipeline::setRenderBeacons( gSavedSettings.getBOOL("renderbeacons")); + LLPipeline::setRenderMOAPBeacons( gSavedSettings.getBOOL("moapbeacon")); mCommitCallbackRegistrar.add("Beacons.UICheck", boost::bind(&LLFloaterBeacons::onClickUICheck, this,_1)); } @@ -96,6 +97,7 @@ void LLFloaterBeacons::onClickUICheck(LLUICtrl *ctrl) else if(name == "physical") LLPipeline::setRenderPhysicalBeacons(check->get()); else if(name == "sounds") LLPipeline::setRenderSoundBeacons(check->get()); else if(name == "particles") LLPipeline::setRenderParticleBeacons(check->get()); + else if(name == "moapbeacon") LLPipeline::setRenderMOAPBeacons(check->get()); else if(name == "highlights") { LLPipeline::toggleRenderHighlights(NULL); diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp index 45d1cc2b53..641e64247b 100644 --- a/indra/newview/llfloatermap.cpp +++ b/indra/newview/llfloatermap.cpp @@ -42,7 +42,6 @@ #include "llviewercamera.h" #include "lldraghandle.h" #include "lltextbox.h" -#include "llviewermenu.h" #include "llfloaterworldmap.h" #include "llagent.h" @@ -63,7 +62,6 @@ const S32 MAP_PADDING_BOTTOM = 0; LLFloaterMap::LLFloaterMap(const LLSD& key) : LLFloater(key), - mPopupMenu(NULL), mTextBoxEast(NULL), mTextBoxNorth(NULL), mTextBoxWest(NULL), @@ -102,17 +100,6 @@ BOOL LLFloaterMap::postBuild() mTextBoxSouthWest = getChild<LLTextBox> ("floater_map_southwest"); mTextBoxNorthWest = getChild<LLTextBox> ("floater_map_northwest"); - LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; - - registrar.add("Minimap.Zoom", boost::bind(&LLFloaterMap::handleZoom, this, _2)); - registrar.add("Minimap.Tracker", boost::bind(&LLFloaterMap::handleStopTracking, this, _2)); - - mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if (mPopupMenu && !LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", false); - } - stretchMiniMap(getRect().getWidth() - MAP_PADDING_LEFT - MAP_PADDING_RIGHT ,getRect().getHeight() - MAP_PADDING_TOP - MAP_PADDING_BOTTOM); @@ -163,17 +150,6 @@ BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask) return TRUE; } -BOOL LLFloaterMap::handleRightMouseDown(S32 x, S32 y, MASK mask) -{ - if (mPopupMenu) - { - mPopupMenu->buildDrawLabels(); - mPopupMenu->updateParent(LLMenuGL::sMenuContainer); - LLMenuGL::showPopup(this, mPopupMenu, x, y); - } - return TRUE; -} - void LLFloaterMap::setDirectionPos( LLTextBox* text_box, F32 rotation ) { // Rotation is in radians. @@ -244,11 +220,6 @@ void LLFloaterMap::draw() getDragHandle()->setMouseOpaque(TRUE); } - if (LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", true); - } - LLFloater::draw(); } @@ -315,14 +286,6 @@ void LLFloaterMap::handleZoom(const LLSD& userdata) } } -void LLFloaterMap::handleStopTracking (const LLSD& userdata) -{ - if (mPopupMenu) - { - mPopupMenu->setItemEnabled ("Stop Tracking", false); - LLTracker::stopTracking ((void*)LLTracker::isTracking(NULL)); - } -} void LLFloaterMap::setMinimized(BOOL b) { LLFloater::setMinimized(b); diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h index 4cbb48fb3e..5cf66a594b 100644 --- a/indra/newview/llfloatermap.h +++ b/indra/newview/llfloatermap.h @@ -29,7 +29,6 @@ #include "llfloater.h" -class LLMenuGL; class LLNetMap; class LLTextBox; @@ -44,7 +43,6 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ BOOL handleDoubleClick( S32 x, S32 y, MASK mask ); - /*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask ); /*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); /*virtual*/ void draw(); /*virtual*/ void onFocusLost(); @@ -54,14 +52,11 @@ public: private: void handleZoom(const LLSD& userdata); - void handleStopTracking (const LLSD& userdata); void setDirectionPos( LLTextBox* text_box, F32 rotation ); void updateMinorDirections(); void stretchMiniMap(S32 width,S32 height); - LLMenuGL* mPopupMenu; - LLTextBox* mTextBoxEast; LLTextBox* mTextBoxNorth; LLTextBox* mTextBoxWest; diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 2aaf403d5f..19f6038b56 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -185,7 +185,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) have_extended_data = true; msg->getU32("DataExtended", "TimeStamp", time_stamp, block); msg->getF32("DataExtended", "MonoScore", mono_score, block); - msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block); + msg->getS32("DataExtended", "PublicURLs", public_urls, block); } LLSD element; diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp index 11b3379814..0d8601410a 100644 --- a/indra/newview/llfloateruipreview.cpp +++ b/indra/newview/llfloateruipreview.cpp @@ -1037,18 +1037,29 @@ void LLFloaterUIPreview::onClickEditFloater() cmd_override = bin + " " + args; } } - if (!mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override)) + + LLExternalEditor::EErrorCode status = mExternalEditor.setCommand("LL_XUI_EDITOR", cmd_override); + if (status != LLExternalEditor::EC_SUCCESS) { - std::string warning = "Select an editor by setting the environment variable LL_XUI_EDITOR " - "or the ExternalEditor setting or specifying its path in the \"Editor Path\" field."; + std::string warning; + + if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error. + { + warning = getString("ExternalEditorNotSet"); + } + else + { + warning = LLExternalEditor::getErrorMessage(status); + } + popupAndPrintWarning(warning); return; } // Run the editor. - if (!mExternalEditor.run(file_path)) + if (mExternalEditor.run(file_path) != LLExternalEditor::EC_SUCCESS) { - popupAndPrintWarning("Failed to run editor"); + popupAndPrintWarning(LLExternalEditor::getErrorMessage(status)); return; } } diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp index 70e789f490..11401d6c68 100644 --- a/indra/newview/llfriendcard.cpp +++ b/indra/newview/llfriendcard.cpp @@ -96,6 +96,36 @@ const LLUUID& get_folder_uuid(const LLUUID& parentFolderUUID, LLInventoryCollect } /** + * Class LLFindAgentCallingCard + * + * An inventory collector functor for checking that agent's own calling card + * exists within the Calling Cards category and its sub-folders. + */ +class LLFindAgentCallingCard : public LLInventoryCollectFunctor +{ +public: + LLFindAgentCallingCard() : mIsAgentCallingCardFound(false) {} + virtual ~LLFindAgentCallingCard() {} + virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item); + bool isAgentCallingCardFound() { return mIsAgentCallingCardFound; } + +private: + bool mIsAgentCallingCardFound; +}; + +bool LLFindAgentCallingCard::operator()(LLInventoryCategory* cat, LLInventoryItem* item) +{ + if (mIsAgentCallingCardFound) return true; + + if (item && item->getType() == LLAssetType::AT_CALLINGCARD && item->getCreatorUUID() == gAgentID) + { + mIsAgentCallingCardFound = true; + } + + return mIsAgentCallingCardFound; +} + +/** * Class for fetching initial friend cards data * * Implemented to fix an issue when Inventory folders are in incomplete state. @@ -449,32 +479,22 @@ void LLFriendCardsManager::syncFriendsFolder() LLAvatarTracker::instance().copyBuddyList(all_buddies); // 1. Check if own calling card exists + const LLUUID calling_cards_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; - - LLUUID friends_all_folder_id = findFriendAllSubfolderUUIDImpl(); - gInventory.collectDescendents(friends_all_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH); - - bool own_callingcard_found = false; - LLInventoryModel::item_array_t::const_iterator it; - for (it = items.begin(); it != items.end(); ++it) - { - if ((*it)->getCreatorUUID() == gAgentID) - { - own_callingcard_found = true; - break; - } - } + LLFindAgentCallingCard collector; + gInventory.collectDescendentsIf(calling_cards_folder_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, collector); // Create own calling card if it was not found in Friends/All folder - if (!own_callingcard_found) + if (!collector.isAgentCallingCardFound()) { LLAvatarName av_name; LLAvatarNameCache::get( gAgentID, &av_name ); create_inventory_item(gAgentID, gAgent.getSessionID(), - friends_all_folder_id, + calling_cards_folder_id, LLTransactionID::tnull, av_name.getCompleteName(), gAgentID.asString(), diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp index 836ae9a0cf..162e465fef 100644 --- a/indra/newview/llnearbychatbar.cpp +++ b/indra/newview/llnearbychatbar.cpp @@ -157,6 +157,16 @@ BOOL LLGestureComboList::handleKeyHere(KEY key, MASK mask) return handled; } +void LLGestureComboList::draw() +{ + LLUICtrl::draw(); + + if(mButton->getToggleState()) + { + showList(); + } +} + void LLGestureComboList::showList() { LLRect rect = mList->getRect(); @@ -180,6 +190,7 @@ void LLGestureComboList::showList() // Show the list and push the button down mButton->setToggleState(TRUE); mList->setVisible(TRUE); + sendChildToFront(mList); LLUI::addPopup(mList); } diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h index 033d1dd5a2..96ab45071b 100644 --- a/indra/newview/llnearbychatbar.h +++ b/indra/newview/llnearbychatbar.h @@ -72,6 +72,8 @@ public: virtual void hideList(); virtual BOOL handleKeyHere(KEY key, MASK mask); + virtual void draw(); + S32 getCurrentIndex() const; void onItemSelected(const LLSD& data); void sortByName(bool ascending = true); diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index de5439e4e0..0d9daeb44e 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -558,6 +558,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) } */ + // Add a nearby chat toast. LLUUID id; id.generate(); @@ -583,6 +584,10 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, const LLSD &args) notification["text_color"] = r_color_name; notification["color_alpha"] = r_color_alpha; notification["font_size"] = (S32)LLViewerChat::getChatFontSize() ; + + // Pass sender info so that it can be rendered properly (STORM-1021). + notification["sender_slurl"] = LLViewerChat::getSenderSLURL(chat_msg, args); + channel->addNotification(notification); } diff --git a/indra/newview/llnetmap.cpp b/indra/newview/llnetmap.cpp index e29078c545..981b4dbee3 100644 --- a/indra/newview/llnetmap.cpp +++ b/indra/newview/llnetmap.cpp @@ -112,10 +112,6 @@ BOOL LLNetMap::postBuild() registrar.add("Minimap.Tracker", boost::bind(&LLNetMap::handleStopTracking, this, _2)); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_mini_map.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - if (mPopupMenu && !LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", false); - } return TRUE; } @@ -510,13 +506,6 @@ void LLNetMap::draw() gGL.popUIMatrix(); LLUICtrl::draw(); - - if (LLTracker::isTracking(0)) - { - mPopupMenu->setItemEnabled ("Stop Tracking", true); - } - - } void LLNetMap::reshape(S32 width, S32 height, BOOL called_from_parent) @@ -886,6 +875,7 @@ BOOL LLNetMap::handleRightMouseDown(S32 x, S32 y, MASK mask) { mPopupMenu->buildDrawLabels(); mPopupMenu->updateParent(LLMenuGL::sMenuContainer); + mPopupMenu->setItemEnabled("Stop Tracking", LLTracker::isTracking(0)); LLMenuGL::showPopup(this, mPopupMenu, x, y); } return TRUE; diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp index 22ff362b5a..b19bf5d234 100644 --- a/indra/newview/llpreviewscript.cpp +++ b/indra/newview/llpreviewscript.cpp @@ -956,16 +956,31 @@ void LLScriptEdCore::openInExternalEditor() // Open it in external editor. { LLExternalEditor ed; + LLExternalEditor::EErrorCode status; + std::string msg; - if (!ed.setCommand("LL_SCRIPT_EDITOR")) + status = ed.setCommand("LL_SCRIPT_EDITOR"); + if (status != LLExternalEditor::EC_SUCCESS) { - std::string msg = "Select an editor by setting the environment variable LL_SCRIPT_EDITOR " - "or the ExternalEditor setting"; // *TODO: localize + if (status == LLExternalEditor::EC_NOT_SPECIFIED) // Use custom message for this error. + { + msg = getString("external_editor_not_set"); + } + else + { + msg = LLExternalEditor::getErrorMessage(status); + } + LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg)); return; } - ed.run(filename); + status = ed.run(filename); + if (status != LLExternalEditor::EC_SUCCESS) + { + msg = LLExternalEditor::getErrorMessage(status); + LLNotificationsUtil::add("GenericAlert", LLSD().with("MESSAGE", msg)); + } } } diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 8aaa7f0e13..fcd200d24a 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -96,6 +96,7 @@ bool LLSideTray::instanceCreated () class LLSideTrayTab: public LLPanel { + LOG_CLASS(LLSideTrayTab); friend class LLUICtrlFactory; friend class LLSideTray; public: @@ -122,6 +123,8 @@ protected: void undock(LLFloater* floater_tab); LLSideTray* getSideTray(); + + void onFloaterClose(LLSD::Boolean app_quitting); public: virtual ~LLSideTrayTab(); @@ -140,6 +143,8 @@ public: void onOpen (const LLSD& key); void toggleTabDocked(); + void setDocked(bool dock); + bool isDocked() const; BOOL handleScrollWheel(S32 x, S32 y, S32 clicks); @@ -151,6 +156,7 @@ private: std::string mDescription; LLView* mMainPanel; + boost::signals2::connection mFloaterCloseConn; }; LLSideTrayTab::LLSideTrayTab(const Params& p) @@ -271,6 +277,35 @@ void LLSideTrayTab::toggleTabDocked() LLFloaterReg::toggleInstance("side_bar_tab", tab_name); } +// Same as toggleTabDocked() apart from making sure that we do exactly what we want. +void LLSideTrayTab::setDocked(bool dock) +{ + if (isDocked() == dock) + { + llwarns << "Tab " << getName() << " is already " << (dock ? "docked" : "undocked") << llendl; + return; + } + + toggleTabDocked(); +} + +bool LLSideTrayTab::isDocked() const +{ + return dynamic_cast<LLSideTray*>(getParent()) != NULL; +} + +void LLSideTrayTab::onFloaterClose(LLSD::Boolean app_quitting) +{ + // If user presses Ctrl-Shift-W, handle that gracefully by docking all + // undocked tabs before their floaters get destroyed (STORM-1016). + + // Don't dock on quit for the current dock state to be correctly saved. + if (app_quitting) return; + + lldebugs << "Forcibly docking tab " << getName() << llendl; + setDocked(true); +} + BOOL LLSideTrayTab::handleScrollWheel(S32 x, S32 y, S32 clicks) { // Let children handle the event @@ -294,6 +329,7 @@ void LLSideTrayTab::dock(LLFloater* floater_tab) return; } + mFloaterCloseConn.disconnect(); setRect(side_tray->getLocalRect()); reshape(getRect().getWidth(), getRect().getHeight()); @@ -342,6 +378,7 @@ void LLSideTrayTab::undock(LLFloater* floater_tab) } floater_tab->addChild(this); + mFloaterCloseConn = floater_tab->setCloseCallback(boost::bind(&LLSideTrayTab::onFloaterClose, this, _2)); floater_tab->setTitle(mTabTitle); floater_tab->setName(getName()); @@ -649,7 +686,7 @@ LLPanel* LLSideTray::openChildPanel(LLSideTrayTab* tab, const std::string& panel LLFloater* floater_tab = LLFloaterReg::getInstance("side_bar_tab", tab_name); if (!floater_tab) return NULL; - floater_tab->openFloater(panel_name); + floater_tab->openFloater(tab_name); } LLSideTrayPanelContainer* container = dynamic_cast<LLSideTrayPanelContainer*>(view->getParent()); diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp index c76ecae4a2..d52e0a6c86 100644 --- a/indra/newview/llspeakbutton.cpp +++ b/indra/newview/llspeakbutton.cpp @@ -38,6 +38,7 @@ #include "llspeakbutton.h" #include "llbottomtray.h" +#include "llfirstuse.h" static LLDefaultChildRegistry::Register<LLSpeakButton> t1("talk_button"); @@ -176,6 +177,7 @@ void LLSpeakButton::onMouseDown_SpeakBtn() { bool down = true; LLVoiceClient::getInstance()->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk + LLFirstUse::speak(false); } void LLSpeakButton::onMouseUp_SpeakBtn() { diff --git a/indra/newview/lltracker.h b/indra/newview/lltracker.h index c0c154abe8..8e916af315 100644 --- a/indra/newview/lltracker.h +++ b/indra/newview/lltracker.h @@ -75,7 +75,7 @@ public: // these are static so that they can be used a callbacks static ETrackingStatus getTrackingStatus() { return instance()->mTrackingStatus; } static ETrackingLocationType getTrackedLocationType() { return instance()->mTrackingLocationType; } - static BOOL isTracking(void*) { return (BOOL) instance()->mTrackingStatus; } + static BOOL isTracking(void*) { return instance()->mTrackingStatus != TRACKING_NOTHING; } static void stopTracking(void*); static void clearFocus(); diff --git a/indra/newview/llviewerchat.cpp b/indra/newview/llviewerchat.cpp index 0af850a46b..286b16bab2 100644 --- a/indra/newview/llviewerchat.cpp +++ b/indra/newview/llviewerchat.cpp @@ -31,6 +31,8 @@ #include "llagent.h" // gAgent #include "lluicolortable.h" #include "llviewercontrol.h" // gSavedSettings +#include "llviewerregion.h" +#include "llworld.h" #include "llinstantmessage.h" //SYSTEM_FROM // LLViewerChat @@ -214,3 +216,43 @@ void LLViewerChat::formatChatMsg(const LLChat& chat, std::string& formated_msg) } +//static +std::string LLViewerChat::getSenderSLURL(const LLChat& chat, const LLSD& args) +{ + switch (chat.mSourceType) + { + case CHAT_SOURCE_AGENT: + return LLSLURL("agent", chat.mFromID, "about").getSLURLString(); + + case CHAT_SOURCE_OBJECT: + return getObjectImSLURL(chat, args); + + default: + llwarns << "Getting SLURL for an unsupported sender type: " << chat.mSourceType << llendl; + } + + return LLStringUtil::null; +} + +//static +std::string LLViewerChat::getObjectImSLURL(const LLChat& chat, const LLSD& args) +{ + std::string url = LLSLURL("objectim", chat.mFromID, "").getSLURLString(); + url += "?name=" + chat.mFromName; + url += "&owner=" + chat.mOwnerID.asString(); + + std::string slurl = args["slurl"].asString(); + if (slurl.empty()) + { + LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent); + if(region) + { + LLSLURL region_slurl(region->getName(), chat.mPosAgent); + slurl = region_slurl.getLocationString(); + } + } + + url += "&slurl=" + LLURI::escape(slurl); + + return url; +} diff --git a/indra/newview/llviewerchat.h b/indra/newview/llviewerchat.h index a9f9a98960..0f15d29f04 100644 --- a/indra/newview/llviewerchat.h +++ b/indra/newview/llviewerchat.h @@ -40,6 +40,10 @@ public: static LLFontGL* getChatFont(); static S32 getChatFontSize(); static void formatChatMsg(const LLChat& chat, std::string& formated_msg); + static std::string getSenderSLURL(const LLChat& chat, const LLSD& args); + +private: + static std::string getObjectImSLURL(const LLChat& chat, const LLSD& args); }; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ec72df79d1..7c8f363f11 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -7338,6 +7338,11 @@ class LLViewToggleBeacon : public view_listener_t LLPipeline::toggleRenderPhysicalBeacons(NULL); gSavedSettings.setBOOL( "physicalbeacon", LLPipeline::getRenderPhysicalBeacons(NULL) ); } + else if (beacon == "moapbeacon") + { + LLPipeline::toggleRenderMOAPBeacons(NULL); + gSavedSettings.setBOOL( "moapbeacon", LLPipeline::getRenderMOAPBeacons(NULL) ); + } else if (beacon == "soundsbeacon") { LLPipeline::toggleRenderSoundBeacons(NULL); @@ -7397,6 +7402,11 @@ class LLViewCheckBeaconEnabled : public view_listener_t new_value = gSavedSettings.getBOOL( "scriptsbeacon"); LLPipeline::setRenderScriptedBeacons(new_value); } + else if (beacon == "moapbeacon") + { + new_value = gSavedSettings.getBOOL( "moapbeacon"); + LLPipeline::setRenderMOAPBeacons(new_value); + } else if (beacon == "physicalbeacon") { new_value = gSavedSettings.getBOOL( "physicalbeacon"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 615e2a14ed..8b52d478e6 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -1,6908 +1,6908 @@ -/**
- * @file llviewermessage.cpp
- * @brief Dumping ground for viewer-side message system callbacks.
- *
- * $LicenseInfo:firstyear=2002&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 "llviewerprecompiledheaders.h"
-#include "llviewermessage.h"
-#include "boost/lexical_cast.hpp"
-
-// Linden libraries
-#include "llanimationstates.h"
-#include "llaudioengine.h"
-#include "llavataractions.h"
-#include "llavatarnamecache.h" // IDEVO HACK
-#include "lscript_byteformat.h"
-#include "lleconomy.h"
-#include "lleventtimer.h"
-#include "llfloaterreg.h"
-#include "llfollowcamparams.h"
-#include "llinventorydefines.h"
-#include "lllslconstants.h"
-#include "llregionhandle.h"
-#include "llsdserialize.h"
-#include "llteleportflags.h"
-#include "lltransactionflags.h"
-#include "llvfile.h"
-#include "llvfs.h"
-#include "llxfermanager.h"
-#include "mean_collision_data.h"
-
-#include "llagent.h"
-#include "llagentcamera.h"
-#include "llcallingcard.h"
-#include "llbuycurrencyhtml.h"
-#include "llfirstuse.h"
-#include "llfloaterbuyland.h"
-#include "llfloaterland.h"
-#include "llfloaterregioninfo.h"
-#include "llfloaterlandholdings.h"
-#include "llfloaterpostcard.h"
-#include "llfloaterpreference.h"
-#include "llhudeffecttrail.h"
-#include "llhudmanager.h"
-#include "llinventoryfunctions.h"
-#include "llinventoryobserver.h"
-#include "llinventorypanel.h"
-#include "llnearbychat.h"
-#include "llnotifications.h"
-#include "llnotificationsutil.h"
-#include "llpanelgrouplandmoney.h"
-#include "llrecentpeople.h"
-#include "llscriptfloater.h"
-#include "llselectmgr.h"
-#include "llsidetray.h"
-#include "llstartup.h"
-#include "llsky.h"
-#include "llslurl.h"
-#include "llstatenums.h"
-#include "llstatusbar.h"
-#include "llimview.h"
-#include "llspeakers.h"
-#include "lltrans.h"
-#include "lltranslate.h"
-#include "llviewerfoldertype.h"
-#include "llvoavatar.h" // IDEVO HACK
-#include "lluri.h"
-#include "llviewergenericmessage.h"
-#include "llviewermenu.h"
-#include "llviewerjoystick.h"
-#include "llviewerobjectlist.h"
-#include "llviewerparcelmgr.h"
-#include "llviewerstats.h"
-#include "llviewertexteditor.h"
-#include "llviewerthrottle.h"
-#include "llviewerwindow.h"
-#include "llvlmanager.h"
-#include "llvoavatarself.h"
-#include "llvotextbubble.h"
-#include "llworld.h"
-#include "pipeline.h"
-#include "llfloaterworldmap.h"
-#include "llviewerdisplay.h"
-#include "llkeythrottle.h"
-#include "llgroupactions.h"
-#include "llagentui.h"
-#include "llpanelblockedlist.h"
-#include "llpanelplaceprofile.h"
-
-#include <boost/algorithm/string/split.hpp> //
-#include <boost/regex.hpp>
-
-#include "llnotificationmanager.h" //
-
-#if LL_MSVC
-// disable boost::lexical_cast warning
-#pragma warning (disable:4702)
-#endif
-
-//
-// Constants
-//
-const F32 BIRD_AUDIBLE_RADIUS = 32.0f;
-const F32 SIT_DISTANCE_FROM_TARGET = 0.25f;
-static const F32 LOGOUT_REPLY_TIME = 3.f; // Wait this long after LogoutReply before quitting.
-
-// Determine how quickly residents' scripts can issue question dialogs
-// Allow bursts of up to 5 dialogs in 10 seconds. 10*2=20 seconds recovery if throttle kicks in
-static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests
-static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds
-
-extern BOOL gDebugClicks;
-
-// function prototypes
-bool check_offer_throttle(const std::string& from_name, bool check_only);
-static void process_money_balance_reply_extended(LLMessageSystem* msg);
-
-//inventory offer throttle globals
-LLFrameTimer gThrottleTimer;
-const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period
-const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds
-
-//script permissions
-const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] =
- {
- "ScriptTakeMoney",
- "ActOnControlInputs",
- "RemapControlInputs",
- "AnimateYourAvatar",
- "AttachToYourAvatar",
- "ReleaseOwnership",
- "LinkAndDelink",
- "AddAndRemoveJoints",
- "ChangePermissions",
- "TrackYourCamera",
- "ControlYourCamera"
- };
-
-const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] =
-{
- TRUE, // ScriptTakeMoney,
- FALSE, // ActOnControlInputs
- FALSE, // RemapControlInputs
- FALSE, // AnimateYourAvatar
- FALSE, // AttachToYourAvatar
- FALSE, // ReleaseOwnership,
- FALSE, // LinkAndDelink,
- FALSE, // AddAndRemoveJoints
- FALSE, // ChangePermissions
- FALSE, // TrackYourCamera,
- FALSE // ControlYourCamera
-};
-
-bool friendship_offer_callback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLMessageSystem* msg = gMessageSystem;
- const LLSD& payload = notification["payload"];
-
- // add friend to recent people list
- LLRecentPeople::instance().add(payload["from_id"]);
-
- switch(option)
- {
- case 0:
- {
- // accept
- LLAvatarTracker::formFriendship(payload["from_id"]);
-
- const LLUUID fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
-
- // This will also trigger an onlinenotification if the user is online
- msg->newMessageFast(_PREHASH_AcceptFriendship);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, payload["session_id"]);
- msg->nextBlockFast(_PREHASH_FolderData);
- msg->addUUIDFast(_PREHASH_FolderID, fid);
- msg->sendReliable(LLHost(payload["sender"].asString()));
-
- LLSD payload = notification["payload"];
- payload["SUPPRESS_TOAST"] = true;
- LLNotificationsUtil::add("FriendshipAcceptedByMe",
- notification["substitutions"], payload);
- break;
- }
- case 1: // Decline
- {
- LLSD payload = notification["payload"];
- payload["SUPPRESS_TOAST"] = true;
- LLNotificationsUtil::add("FriendshipDeclinedByMe",
- notification["substitutions"], payload);
- }
- // fall-through
- case 2: // Send IM - decline and start IM session
- {
- // decline
- // We no longer notify other viewers, but we DO still send
- // the rejection to the simulator to delete the pending userop.
- msg->newMessageFast(_PREHASH_DeclineFriendship);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, payload["session_id"]);
- msg->sendReliable(LLHost(payload["sender"].asString()));
-
- // start IM session
- if(2 == option)
- {
- LLAvatarActions::startIM(payload["from_id"].asUUID());
- }
- }
- default:
- // close button probably, possibly timed out
- break;
- }
-
- return false;
-}
-static LLNotificationFunctorRegistration friendship_offer_callback_reg("OfferFriendship", friendship_offer_callback);
-static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("OfferFriendshipNoMessage", friendship_offer_callback);
-
-//const char BUSY_AUTO_RESPONSE[] = "The Resident you messaged is in 'busy mode' which means they have "
-// "requested not to be disturbed. Your message will still be shown in their IM "
-// "panel for later viewing.";
-
-//
-// Functions
-//
-
-void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group,
- S32 trx_type, const std::string& desc)
-{
- if(0 == amount || !region) return;
- amount = abs(amount);
- LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL;
- if(can_afford_transaction(amount))
- {
-// gStatusBar->debitBalance(amount);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_MoneyTransferRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MoneyData);
- msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_DestID, uuid);
- msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(FALSE, is_group));
- msg->addS32Fast(_PREHASH_Amount, amount);
- msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY);
- msg->addS32Fast(_PREHASH_TransactionType, trx_type );
- msg->addStringFast(_PREHASH_Description, desc);
- msg->sendReliable(region->getHost());
- }
- else
- {
- LLStringUtil::format_map_t args;
- args["AMOUNT"] = llformat("%d", amount);
- LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount );
- }
-}
-
-void send_complete_agent_movement(const LLHost& sim_host)
-{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_CompleteAgentMovement);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode);
- msg->sendReliable(sim_host);
-}
-
-void process_logout_reply(LLMessageSystem* msg, void**)
-{
- // The server has told us it's ok to quit.
- LL_DEBUGS("Messaging") << "process_logout_reply" << LL_ENDL;
-
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- LLUUID session_id;
- msg->getUUID("AgentData", "SessionID", session_id);
- if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID()))
- {
- LL_WARNS("Messaging") << "Bogus Logout Reply" << LL_ENDL;
- }
-
- LLInventoryModel::update_map_t parents;
- S32 count = msg->getNumberOfBlocksFast( _PREHASH_InventoryData );
- for(S32 i = 0; i < count; ++i)
- {
- LLUUID item_id;
- msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i);
-
- if( (1 == count) && item_id.isNull() )
- {
- // Detect dummy item. Indicates an empty list.
- break;
- }
-
- // We do not need to track the asset ids, just account for an
- // updated inventory version.
- LL_INFOS("Messaging") << "process_logout_reply itemID=" << item_id << LL_ENDL;
- LLInventoryItem* item = gInventory.getItem( item_id );
- if( item )
- {
- parents[item->getParentUUID()] = 0;
- gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id);
- }
- else
- {
- LL_INFOS("Messaging") << "process_logout_reply item not found: " << item_id << LL_ENDL;
- }
- }
- LLAppViewer::instance()->forceQuit();
-}
-
-void process_layer_data(LLMessageSystem *mesgsys, void **user_data)
-{
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender());
-
- if (!regionp || gNoRender)
- {
- return;
- }
-
-
- S32 size;
- S8 type;
-
- mesgsys->getS8Fast(_PREHASH_LayerID, _PREHASH_Type, type);
- size = mesgsys->getSizeFast(_PREHASH_LayerData, _PREHASH_Data);
- if (0 == size)
- {
- LL_WARNS("Messaging") << "Layer data has zero size." << LL_ENDL;
- return;
- }
- if (size < 0)
- {
- // getSizeFast() is probably trying to tell us about an error
- LL_WARNS("Messaging") << "getSizeFast() returned negative result: "
- << size
- << LL_ENDL;
- return;
- }
- U8 *datap = new U8[size];
- mesgsys->getBinaryDataFast(_PREHASH_LayerData, _PREHASH_Data, datap, size);
- LLVLData *vl_datap = new LLVLData(regionp, type, datap, size);
- if (mesgsys->getReceiveCompressedSize())
- {
- gVLManager.addLayerData(vl_datap, mesgsys->getReceiveCompressedSize());
- }
- else
- {
- gVLManager.addLayerData(vl_datap, mesgsys->getReceiveSize());
- }
-}
-
-// S32 exported_object_count = 0;
-// S32 exported_image_count = 0;
-// S32 current_object_count = 0;
-// S32 current_image_count = 0;
-
-// extern LLNotifyBox *gExporterNotify;
-// extern LLUUID gExporterRequestID;
-// extern std::string gExportDirectory;
-
-// extern LLUploadDialog *gExportDialog;
-
-// std::string gExportedFile;
-
-// std::map<LLUUID, std::string> gImageChecksums;
-
-// void export_complete()
-// {
-// LLUploadDialog::modalUploadFinished();
-// gExporterRequestID.setNull();
-// gExportDirectory = "";
-
-// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */
-// fseek(fXML, 0, SEEK_END);
-// long length = ftell(fXML);
-// fseek(fXML, 0, SEEK_SET);
-// U8 *buffer = new U8[length + 1];
-// size_t nread = fread(buffer, 1, length, fXML);
-// if (nread < (size_t) length)
-// {
-// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
-// }
-// buffer[nread] = '\0';
-// fclose(fXML);
-
-// char *pos = (char *)buffer;
-// while ((pos = strstr(pos+1, "<sl:image ")) != 0)
-// {
-// char *pos_check = strstr(pos, "checksum=\"");
-
-// if (pos_check)
-// {
-// char *pos_uuid = strstr(pos_check, "\">");
-
-// if (pos_uuid)
-// {
-// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */
-// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */
-// image_uuid_str[UUID_STR_SIZE-1] = 0;
-
-// LLUUID image_uuid(image_uuid_str);
-
-// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL;
-
-// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid);
-// if (itor != gImageChecksums.end())
-// {
-// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL;
-// if (!itor->second.empty())
-// {
-// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */
-// }
-// }
-// }
-// }
-// }
-
-// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */
-// if (fwrite(buffer, 1, length, fXMLOut) != length)
-// {
-// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
-// }
-// fclose(fXMLOut);
-
-// delete [] buffer;
-// }
-
-
-// void exported_item_complete(const LLTSCode status, void *user_data)
-// {
-// //std::string *filename = (std::string *)user_data;
-
-// if (status < LLTS_OK)
-// {
-// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL;
-// }
-// else
-// {
-// ++current_object_count;
-// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
-// {
-// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL;
-
-// export_complete();
-// }
-// else
-// {
-// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
-// }
-// }
-// }
-
-// struct exported_image_info
-// {
-// LLUUID image_id;
-// std::string filename;
-// U32 image_num;
-// };
-
-// void exported_j2c_complete(const LLTSCode status, void *user_data)
-// {
-// exported_image_info *info = (exported_image_info *)user_data;
-// LLUUID image_id = info->image_id;
-// U32 image_num = info->image_num;
-// std::string filename = info->filename;
-// delete info;
-
-// if (status < LLTS_OK)
-// {
-// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL;
-// }
-// else
-// {
-// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */
-// if (fIn)
-// {
-// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C;
-// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA;
-
-// fseek(fIn, 0, SEEK_END);
-// S32 length = ftell(fIn);
-// fseek(fIn, 0, SEEK_SET);
-// U8 *buffer = ImageUtility->allocateData(length);
-// if (fread(buffer, 1, length, fIn) != length)
-// {
-// LL_WARNS("Messaging") << "Short read" << LL_ENDL;
-// }
-// fclose(fIn);
-// LLFile::remove(filename);
-
-// // Convert to TGA
-// LLPointer<LLImageRaw> image = new LLImageRaw();
-
-// ImageUtility->updateData();
-// ImageUtility->decode(image, 100000.0f);
-
-// TargaUtility->encode(image);
-// U8 *data = TargaUtility->getData();
-// S32 data_size = TargaUtility->getDataSize();
-
-// std::string file_path = gDirUtilp->getDirName(filename);
-
-// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename;
-// //S32 name_len = output_file.length();
-// //strcpy(&output_file[name_len-3], "tga");
-// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */
-// char md5_hash_string[33]; /* Flawfinder: ignore */
-// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */
-// if (fOut)
-// {
-// if (fwrite(data, 1, data_size, fOut) != data_size)
-// {
-// LL_WARNS("Messaging") << "Short write" << LL_ENDL;
-// }
-// fseek(fOut, 0, SEEK_SET);
-// fclose(fOut);
-// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */
-// LLMD5 my_md5_hash(fOut);
-// my_md5_hash.hex_digest(md5_hash_string);
-// }
-
-// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string));
-// }
-// }
-
-// ++current_image_count;
-// if (current_image_count == exported_image_count && current_object_count == exported_object_count)
-// {
-// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL;
-// export_complete();
-// }
-// else
-// {
-// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count));
-// }
-//}
-
-void process_derez_ack(LLMessageSystem*, void**)
-{
- if(gViewerWindow) gViewerWindow->getWindow()->decBusyCount();
-}
-
-void process_places_reply(LLMessageSystem* msg, void** data)
-{
- LLUUID query_id;
-
- msg->getUUID("AgentData", "QueryID", query_id);
- if (query_id.isNull())
- {
- LLFloaterLandHoldings::processPlacesReply(msg, data);
- }
- else if(gAgent.isInGroup(query_id))
- {
- LLPanelGroupLandMoney::processPlacesReply(msg, data);
- }
- else
- {
- LL_WARNS("Messaging") << "Got invalid PlacesReply message" << LL_ENDL;
- }
-}
-
-void send_sound_trigger(const LLUUID& sound_id, F32 gain)
-{
- if (sound_id.isNull() || gAgent.getRegion() == NULL)
- {
- // disconnected agent or zero guids don't get sent (no sound)
- return;
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_SoundTrigger);
- msg->nextBlockFast(_PREHASH_SoundData);
- msg->addUUIDFast(_PREHASH_SoundID, sound_id);
- // Client untrusted, ids set on sim
- msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null );
- msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null );
- msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null );
-
- msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle());
-
- LLVector3 position = gAgent.getPositionAgent();
- msg->addVector3Fast(_PREHASH_Position, position);
- msg->addF32Fast(_PREHASH_Gain, gain);
-
- gAgent.sendMessage();
-}
-
-bool join_group_response(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- BOOL delete_context_data = TRUE;
- bool accept_invite = false;
-
- LLUUID group_id = notification["payload"]["group_id"].asUUID();
- LLUUID transaction_id = notification["payload"]["transaction_id"].asUUID();
- std::string name = notification["payload"]["name"].asString();
- std::string message = notification["payload"]["message"].asString();
- S32 fee = notification["payload"]["fee"].asInteger();
-
- if (option == 2 && !group_id.isNull())
- {
- LLGroupActions::show(group_id);
- LLSD args;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("JoinGroup", args, notification["payload"]);
- return false;
- }
- if(option == 0 && !group_id.isNull())
- {
- // check for promotion or demotion.
- S32 max_groups = gMaxAgentGroups;
- if(gAgent.isInGroup(group_id)) ++max_groups;
-
- if(gAgent.mGroups.count() < max_groups)
- {
- accept_invite = true;
- }
- else
- {
- delete_context_data = FALSE;
- LLSD args;
- args["NAME"] = name;
- LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]);
- }
- }
-
- if (accept_invite)
- {
- // If there is a fee to join this group, make
- // sure the user is sure they want to join.
- if (fee > 0)
- {
- delete_context_data = FALSE;
- LLSD args;
- args["COST"] = llformat("%d", fee);
- // Set the fee for next time to 0, so that we don't keep
- // asking about a fee.
- LLSD next_payload = notification["payload"];
- next_payload["fee"] = 0;
- LLNotificationsUtil::add("JoinGroupCanAfford",
- args,
- next_payload);
- }
- else
- {
- send_improved_im(group_id,
- std::string("name"),
- std::string("message"),
- IM_ONLINE,
- IM_GROUP_INVITATION_ACCEPT,
- transaction_id);
- }
- }
- else
- {
- send_improved_im(group_id,
- std::string("name"),
- std::string("message"),
- IM_ONLINE,
- IM_GROUP_INVITATION_DECLINE,
- transaction_id);
- }
-
- return false;
-}
-
-static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel)
-{
- if (NULL == inventory_panel) return;
-
- for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
- item_iter != items.end();
- ++item_iter)
- {
- const LLUUID& item_id = (*item_iter);
- if(!highlight_offered_object(item_id))
- {
- continue;
- }
-
- LLInventoryItem* item = gInventory.getItem(item_id);
- llassert(item);
- if (!item) {
- continue;
- }
-
- LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id << LL_ENDL;
- LLFolderView* fv = inventory_panel->getRootFolder();
- if (fv)
- {
- LLFolderViewItem* fv_item = fv->getItemByID(item_id);
- if (fv_item)
- {
- LLFolderViewItem* fv_folder = fv_item->getParentFolder();
- if (fv_folder)
- {
- // Parent folders can be different in case of 2 consecutive drag and drop
- // operations when the second one is started before the first one completes.
- LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL;
- fv_folder->setOpen(TRUE);
- if (fv_folder->isSelected())
- {
- fv->changeSelection(fv_folder, FALSE);
- }
- }
- fv->changeSelection(fv_item, TRUE);
- }
- }
- }
-}
-
-static LLNotificationFunctorRegistration jgr_1("JoinGroup", join_group_response);
-static LLNotificationFunctorRegistration jgr_2("JoinedTooManyGroupsMember", join_group_response);
-static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_response);
-
-
-//-----------------------------------------------------------------------------
-// Instant Message
-//-----------------------------------------------------------------------------
-class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
-{
-public:
- LLOpenAgentOffer(const LLUUID& object_id,
- const std::string& from_name) :
- LLInventoryFetchItemsObserver(object_id),
- mFromName(from_name) {}
- /*virtual*/ void startFetch()
- {
- for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
- {
- LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
- if (cat)
- {
- mComplete.push_back((*it));
- }
- }
- LLInventoryFetchItemsObserver::startFetch();
- }
- /*virtual*/ void done()
- {
- open_inventory_offer(mComplete, mFromName);
- gInventory.removeObserver(this);
- delete this;
- }
-private:
- std::string mFromName;
-};
-
-/**
- * Class to observe adding of new items moved from the world to user's inventory to select them in inventory.
- *
- * We can't create it each time items are moved because "drop" event is sent separately for each
- * element even while multi-dragging. We have to have the only instance of the observer. See EXT-4347.
- */
-class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetObserver
-{
-public:
- LLViewerInventoryMoveFromWorldObserver()
- : LLInventoryAddItemByAssetObserver()
- , mActivePanel(NULL)
- {
-
- }
-
- void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; }
-
-private:
- /*virtual */void onAssetAdded(const LLUUID& asset_id)
- {
- // Store active Inventory panel.
- mActivePanel = LLInventoryPanel::getActiveInventoryPanel();
-
- // Store selected items (without destination folder)
- mSelectedItems.clear();
- if (mActivePanel)
- {
- mSelectedItems = mActivePanel->getRootFolder()->getSelectionList();
- }
- mSelectedItems.erase(mMoveIntoFolderID);
- }
-
- /**
- * Selects added inventory items watched by their Asset UUIDs if selection was not changed since
- * all items were started to watch (dropped into a folder).
- */
- void done()
- {
- // if selection is not changed since watch started lets hightlight new items.
- if (mActivePanel && !isSelectionChanged())
- {
- LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL;
- mActivePanel->clearSelection();
- highlight_inventory_items_in_panel(mAddedItems, mActivePanel);
- }
- }
-
- /**
- * Returns true if selected inventory items were changed since moved inventory items were started to watch.
- */
- bool isSelectionChanged()
- {
- const LLInventoryPanel * const current_active_panel = LLInventoryPanel::getActiveInventoryPanel();
-
- if (NULL == mActivePanel || current_active_panel != mActivePanel)
- {
- return true;
- }
-
- // get selected items (without destination folder)
- selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList();
- selected_items.erase(mMoveIntoFolderID);
-
- // compare stored & current sets of selected items
- selected_items_t different_items;
- std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(),
- selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin()));
-
- LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size()
- << ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL;
-
- return different_items.size() > 0;
- }
-
- LLInventoryPanel *mActivePanel;
- typedef std::set<LLUUID> selected_items_t;
- selected_items_t mSelectedItems;
-
- /**
- * UUID of FolderViewFolder into which watched items are moved.
- *
- * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped).
- *
- * If mouse is moved out it set unselected and number of selected items is changed
- * even if selected items in Inventory stay the same.
- * So, it is used to update stored selection list.
- *
- * @see onAssetAdded()
- * @see isSelectionChanged()
- */
- LLUUID mMoveIntoFolderID;
-};
-
-LLViewerInventoryMoveFromWorldObserver* gInventoryMoveObserver = NULL;
-
-void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid)
-{
- start_new_inventory_observer();
-
- gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid);
- gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID());
-}
-
-//unlike the FetchObserver for AgentOffer, we only make one
-//instance of the AddedObserver for TaskOffers
-//and it never dies. We do this because we don't know the UUID of
-//task offers until they are accepted, so we don't wouldn't
-//know what to watch for, so instead we just watch for all additions.
-class LLOpenTaskOffer : public LLInventoryAddedObserver
-{
-protected:
- /*virtual*/ void done()
- {
- for (uuid_vec_t::iterator it = mAdded.begin(); it != mAdded.end();)
- {
- const LLUUID& item_uuid = *it;
- bool was_moved = false;
- LLInventoryObject* added_object = gInventory.getObject(item_uuid);
- if (added_object)
- {
- // cast to item to get Asset UUID
- LLInventoryItem* added_item = dynamic_cast<LLInventoryItem*>(added_object);
- if (added_item)
- {
- const LLUUID& asset_uuid = added_item->getAssetUUID();
- if (gInventoryMoveObserver->isAssetWatched(asset_uuid))
- {
- LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL;
- was_moved = true;
- }
- }
- }
-
- if (was_moved)
- {
- it = mAdded.erase(it);
- }
- else ++it;
- }
-
- open_inventory_offer(mAdded, "");
- mAdded.clear();
- }
- };
-
-class LLOpenTaskGroupOffer : public LLInventoryAddedObserver
-{
-protected:
- /*virtual*/ void done()
- {
- open_inventory_offer(mAdded, "group_offer");
- mAdded.clear();
- gInventory.removeObserver(this);
- delete this;
- }
-};
-
-//one global instance to bind them
-LLOpenTaskOffer* gNewInventoryObserver=NULL;
-
-class LLNewInventoryHintObserver : public LLInventoryAddedObserver
-{
-protected:
- /*virtual*/ void done()
- {
- LLFirstUse::newInventory();
- }
-};
-
-void start_new_inventory_observer()
-{
- if (!gNewInventoryObserver) //task offer observer
- {
- // Observer is deleted by gInventory
- gNewInventoryObserver = new LLOpenTaskOffer;
- gInventory.addObserver(gNewInventoryObserver);
- }
-
- if (!gInventoryMoveObserver) //inventory move from the world observer
- {
- // Observer is deleted by gInventory
- gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver;
- gInventory.addObserver(gInventoryMoveObserver);
- }
-
- gInventory.addObserver(new LLNewInventoryHintObserver());
-}
-
-class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver
-{
- LOG_CLASS(LLDiscardAgentOffer);
-public:
- LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) :
- LLInventoryFetchItemsObserver(object_id),
- mFolderID(folder_id),
- mObjectID(object_id) {}
- virtual ~LLDiscardAgentOffer() {}
- virtual void done()
- {
- LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL;
- const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
- bool notify = false;
- if(trash_id.notNull() && mObjectID.notNull())
- {
- LLInventoryModel::update_list_t update;
- LLInventoryModel::LLCategoryUpdate old_folder(mFolderID, -1);
- update.push_back(old_folder);
- LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1);
- update.push_back(new_folder);
- gInventory.accountForUpdate(update);
- gInventory.moveObject(mObjectID, trash_id);
- LLInventoryObject* obj = gInventory.getObject(mObjectID);
- if(obj)
- {
- // no need to restamp since this is already a freshly
- // stamped item.
- obj->updateParentOnServer(FALSE);
- notify = true;
- }
- }
- else
- {
- LL_WARNS("Messaging") << "DiscardAgentOffer unable to find: "
- << (trash_id.isNull() ? "trash " : "")
- << (mObjectID.isNull() ? "object" : "") << LL_ENDL;
- }
- gInventory.removeObserver(this);
- if(notify)
- {
- gInventory.notifyObservers();
- }
- delete this;
- }
-protected:
- LLUUID mFolderID;
- LLUUID mObjectID;
-};
-
-
-//Returns TRUE if we are OK, FALSE if we are throttled
-//Set check_only true if you want to know the throttle status
-//without registering a hit
-bool check_offer_throttle(const std::string& from_name, bool check_only)
-{
- static U32 throttle_count;
- static bool throttle_logged;
- LLChat chat;
- std::string log_message;
-
- if (!gSavedSettings.getBOOL("ShowNewInventory"))
- return false;
-
- if (check_only)
- {
- return gThrottleTimer.hasExpired();
- }
-
- if(gThrottleTimer.checkExpirationAndReset(OFFER_THROTTLE_TIME))
- {
- LL_DEBUGS("Messaging") << "Throttle Expired" << LL_ENDL;
- throttle_count=1;
- throttle_logged=false;
- return true;
- }
- else //has not expired
- {
- LL_DEBUGS("Messaging") << "Throttle Not Expired, Count: " << throttle_count << LL_ENDL;
- // When downloading the initial inventory we get a lot of new items
- // coming in and can't tell that from spam.
- if (LLStartUp::getStartupState() >= STATE_STARTED
- && throttle_count >= OFFER_THROTTLE_MAX_COUNT)
- {
- if (!throttle_logged)
- {
- // Use the name of the last item giver, who is probably the person
- // spamming you.
-
- LLStringUtil::format_map_t arg;
- std::string log_msg;
- std::ostringstream time ;
- time<<OFFER_THROTTLE_TIME;
-
- arg["APP_NAME"] = LLAppViewer::instance()->getSecondLifeTitle();
- arg["TIME"] = time.str();
-
- if (!from_name.empty())
- {
- arg["FROM_NAME"] = from_name;
- log_msg = LLTrans::getString("ItemsComingInTooFastFrom", arg);
- }
- else
- {
- log_msg = LLTrans::getString("ItemsComingInTooFast", arg);
- }
-
- //this is kinda important, so actually put it on screen
- LLSD args;
- args["MESSAGE"] = log_msg;
- LLNotificationsUtil::add("SystemMessage", args);
-
- throttle_logged=true;
- }
- return false;
- }
- else
- {
- throttle_count++;
- return true;
- }
- }
-}
-
-void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name)
-{
- for (uuid_vec_t::const_iterator obj_iter = objects.begin();
- obj_iter != objects.end();
- ++obj_iter)
- {
- const LLUUID& obj_id = (*obj_iter);
- if(!highlight_offered_object(obj_id))
- {
- continue;
- }
-
- const LLInventoryObject *obj = gInventory.getObject(obj_id);
- if (!obj)
- {
- llwarns << "Cannot find object [ itemID:" << obj_id << " ] to open." << llendl;
- continue;
- }
-
- const LLAssetType::EType asset_type = obj->getActualType();
-
- // Either an inventory item or a category.
- const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj);
- if (item)
- {
- ////////////////////////////////////////////////////////////////////////////////
- // Special handling for various types.
- if (check_offer_throttle(from_name, false)) // If we are throttled, don't display
- {
- LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL;
- // If we opened this ourselves, focus it
- const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO;
- switch(asset_type)
- {
- case LLAssetType::AT_NOTECARD:
- {
- LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus);
- break;
- }
- case LLAssetType::AT_LANDMARK:
- {
- LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID());
- if ("inventory_handler" == from_name)
- {
- //we have to filter inventory_handler messages to avoid notification displaying
- LLSideTray::getInstance()->showPanel("panel_places",
- LLSD().with("type", "landmark").with("id", item->getUUID()));
- }
- else if("group_offer" == from_name)
- {
- // "group_offer" is passed by LLOpenTaskGroupOffer
- // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done().
- LLSD args;
- args["type"] = "landmark";
- args["id"] = obj_id;
- LLSideTray::getInstance()->showPanel("panel_places", args);
-
- continue;
- }
- else if(from_name.empty())
- {
- std::string folder_name;
- if (parent_folder)
- {
- // Localize folder name.
- // *TODO: share this code?
- folder_name = parent_folder->getName();
- if (LLFolderType::lookupIsProtectedType(parent_folder->getPreferredType()))
- {
- LLTrans::findString(folder_name, "InvFolder " + folder_name);
- }
- }
- else
- {
- folder_name = LLTrans::getString("Unknown");
- }
-
- // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added.
- LLSD args;
- args["LANDMARK_NAME"] = item->getName();
- args["FOLDER_NAME"] = folder_name;
- LLNotificationsUtil::add("LandmarkCreated", args);
- }
- }
- break;
- case LLAssetType::AT_TEXTURE:
- {
- LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus);
- break;
- }
- case LLAssetType::AT_ANIMATION:
- LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus);
- break;
- case LLAssetType::AT_SCRIPT:
- LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus);
- break;
- case LLAssetType::AT_SOUND:
- LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus);
- break;
- default:
- break;
- }
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Highlight item
- const BOOL auto_open =
- gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false
- !from_name.empty(); // don't open if it's not from anyone.
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
- if(active_panel)
- {
- LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL;
- LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
- active_panel->setSelection(obj_id, TAKE_FOCUS_NO);
- gFocusMgr.setKeyboardFocus(focus_ctrl);
- }
- }
-}
-
-bool highlight_offered_object(const LLUUID& obj_id)
-{
- const LLInventoryObject* obj = gInventory.getObject(obj_id);
- if(!obj)
- {
- LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL;
- return false;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Don't highlight if it's in certain "quiet" folders which don't need UI
- // notification (e.g. trash, cof, lost-and-found).
- if(!gAgent.getAFK())
- {
- const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id);
- if (parent)
- {
- const LLFolderType::EType parent_type = parent->getPreferredType();
- if (LLViewerFolderType::lookupIsQuietType(parent_type))
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-void inventory_offer_mute_callback(const LLUUID& blocked_id,
- const std::string& full_name,
- bool is_group,
- boost::shared_ptr<LLNotificationResponderInterface> offer_ptr)
-{
- LLOfferInfo* offer = dynamic_cast<LLOfferInfo*>(offer_ptr.get());
-
- std::string from_name = full_name;
- LLMute::EType type;
- if (is_group)
- {
- type = LLMute::GROUP;
- }
- else if(offer && offer->mFromObject)
- {
- //we have to block object by name because blocked_id is an id of owner
- type = LLMute::BY_NAME;
- }
- else
- {
- type = LLMute::AGENT;
- }
-
- // id should be null for BY_NAME mute, see LLMuteList::add for details
- LLMute mute(type == LLMute::BY_NAME ? LLUUID::null : blocked_id, from_name, type);
- if (LLMuteList::getInstance()->add(mute))
- {
- LLPanelBlockedList::showPanelAndSelect(blocked_id);
- }
-
- // purge the message queue of any previously queued inventory offers from the same source.
- class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher
- {
- public:
- OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
- bool matches(const LLNotificationPtr notification) const
- {
- if(notification->getName() == "ObjectGiveItem"
- || notification->getName() == "UserGiveItem")
- {
- return (notification->getPayload()["from_id"].asUUID() == blocked_id);
- }
- return FALSE;
- }
- private:
- const LLUUID& blocked_id;
- };
-
- LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID(
- gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id));
-}
-
-LLOfferInfo::LLOfferInfo()
- : LLNotificationResponderInterface()
- , mFromGroup(FALSE)
- , mFromObject(FALSE)
- , mIM(IM_NOTHING_SPECIAL)
- , mType(LLAssetType::AT_NONE)
- , mPersist(false)
-{
-}
-
-LLOfferInfo::LLOfferInfo(const LLSD& sd)
-{
- mIM = (EInstantMessage)sd["im_type"].asInteger();
- mFromID = sd["from_id"].asUUID();
- mFromGroup = sd["from_group"].asBoolean();
- mFromObject = sd["from_object"].asBoolean();
- mTransactionID = sd["transaction_id"].asUUID();
- mFolderID = sd["folder_id"].asUUID();
- mObjectID = sd["object_id"].asUUID();
- mType = LLAssetType::lookup(sd["type"].asString().c_str());
- mFromName = sd["from_name"].asString();
- mDesc = sd["description"].asString();
- mHost = LLHost(sd["sender"].asString());
- mPersist = sd["persist"].asBoolean();
-}
-
-LLOfferInfo::LLOfferInfo(const LLOfferInfo& info)
-{
- mIM = info.mIM;
- mFromID = info.mFromID;
- mFromGroup = info.mFromGroup;
- mFromObject = info.mFromObject;
- mTransactionID = info.mTransactionID;
- mFolderID = info.mFolderID;
- mObjectID = info.mObjectID;
- mType = info.mType;
- mFromName = info.mFromName;
- mDesc = info.mDesc;
- mHost = info.mHost;
- mPersist = info.mPersist;
-}
-
-LLSD LLOfferInfo::asLLSD()
-{
- LLSD sd;
- sd["im_type"] = mIM;
- sd["from_id"] = mFromID;
- sd["from_group"] = mFromGroup;
- sd["from_object"] = mFromObject;
- sd["transaction_id"] = mTransactionID;
- sd["folder_id"] = mFolderID;
- sd["object_id"] = mObjectID;
- sd["type"] = LLAssetType::lookup(mType);
- sd["from_name"] = mFromName;
- sd["description"] = mDesc;
- sd["sender"] = mHost.getIPandPort();
- sd["persist"] = mPersist;
- return sd;
-}
-
-void LLOfferInfo::fromLLSD(const LLSD& params)
-{
- *this = params;
-}
-
-void LLOfferInfo::send_auto_receive_response(void)
-{
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
- msg->addUUIDFast(_PREHASH_ToAgentID, mFromID);
- msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
- msg->addUUIDFast(_PREHASH_ID, mTransactionID);
- msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
- std::string name;
- LLAgentUI::buildFullname(name);
- msg->addStringFast(_PREHASH_FromAgentName, name);
- msg->addStringFast(_PREHASH_Message, "");
- msg->addU32Fast(_PREHASH_ParentEstateID, 0);
- msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
- msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
-
- // Auto Receive Message. The math for the dialog works, because the accept
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 1 greater than the offer integer value.
- // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
- // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
- msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData),
- sizeof(mFolderID.mData));
- // send the message
- msg->sendReliable(mHost);
-
- if(IM_INVENTORY_OFFERED == mIM)
- {
- // add buddy to recent people list
- LLRecentPeople::instance().add(mFromID);
- }
-}
-
-void LLOfferInfo::handleRespond(const LLSD& notification, const LLSD& response)
-{
- initRespondFunctionMap();
-
- const std::string name = notification["name"].asString();
- if(mRespondFunctions.find(name) == mRespondFunctions.end())
- {
- llwarns << "Unexpected notification name : " << name << llendl;
- llassert(!"Unexpected notification name");
- return;
- }
-
- mRespondFunctions[name](notification, response);
-}
-
-bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response)
-{
- LLChat chat;
- std::string log_message;
- S32 button = LLNotificationsUtil::getSelectedOption(notification, response);
-
- LLInventoryObserver* opener = NULL;
- LLViewerInventoryCategory* catp = NULL;
- catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID);
- LLViewerInventoryItem* itemp = NULL;
- if(!catp)
- {
- itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID);
- }
-
- // For muting, we need to add the mute, then decline the offer.
- // This must be done here because:
- // * callback may be called immediately,
- // * adding the mute sends a message,
- // * we can't build two messages at once.
- if (2 == button) // Block
- {
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
- llassert(notification_ptr != NULL);
- if (notification_ptr != NULL)
- {
- gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
- }
- }
-
- std::string from_string; // Used in the pop-up.
- std::string chatHistory_string; // Used in chat history.
-
- // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here:
- from_string = chatHistory_string = mFromName;
-
- bool busy=FALSE;
-
- switch(button)
- {
- case IOR_SHOW:
- // we will want to open this item when it comes back.
- LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
- << LL_ENDL;
- switch (mIM)
- {
- case IM_INVENTORY_OFFERED:
- {
- // This is an offer from an agent. In this case, the back
- // end has already copied the items into your inventory,
- // so we can fetch it out of our inventory.
- if (gSavedSettings.getBOOL("ShowOfferedInventory"))
- {
- LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string);
- open_agent_offer->startFetch();
- if(catp || (itemp && itemp->isFinished()))
- {
- open_agent_offer->done();
- }
- else
- {
- opener = open_agent_offer;
- }
- }
- }
- break;
- case IM_GROUP_NOTICE:
- opener = new LLOpenTaskGroupOffer;
- send_auto_receive_response();
- break;
- case IM_TASK_INVENTORY_OFFERED:
- case IM_GROUP_NOTICE_REQUESTED:
- // This is an offer from a task or group.
- // We don't use a new instance of an opener
- // We instead use the singular observer gOpenTaskOffer
- // Since it already exists, we don't need to actually do anything
- break;
- default:
- LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
- break;
- }
- break;
- // end switch (mIM)
-
- case IOR_ACCEPT:
- //don't spam them if they are getting flooded
- if (check_offer_throttle(mFromName, true))
- {
- log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
- LLSD args;
- args["MESSAGE"] = log_message;
- LLNotificationsUtil::add("SystemMessage", args);
- }
- break;
-
- case IOR_BUSY:
- //Busy falls through to decline. Says to make busy message.
- busy=TRUE;
- case IOR_MUTE:
- // MUTE falls through to decline
- case IOR_DECLINE:
- {
- {
- LLStringUtil::format_map_t log_message_args;
- log_message_args["DESC"] = mDesc;
- log_message_args["NAME"] = mFromName;
- log_message = LLTrans::getString("InvOfferDecline", log_message_args);
- }
- chat.mText = log_message;
- if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269
- {
- chat.mMuted = TRUE;
- }
-
- // *NOTE dzaporozhan
- // Disabled logging to old chat floater to fix crash in group notices - EXT-4149
- // LLFloaterChat::addChatHistory(chat);
-
- LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
- discard_agent_offer->startFetch();
- if (catp || (itemp && itemp->isFinished()))
- {
- discard_agent_offer->done();
- }
- else
- {
- opener = discard_agent_offer;
- }
-
-
- if (busy && (!mFromGroup && !mFromObject))
- {
- busy_message(gMessageSystem, mFromID);
- }
- break;
- }
- default:
- // close button probably
- // The item has already been fetched and is in your inventory, we simply won't highlight it
- // OR delete it if the notification gets killed, since we don't want that to be a vector for
- // losing inventory offers.
- break;
- }
-
- if(opener)
- {
- gInventory.addObserver(opener);
- }
-
- if(!mPersist)
- {
- delete this;
- }
- return false;
-}
-
-bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD& response)
-{
- LLChat chat;
- std::string log_message;
- S32 button = LLNotification::getSelectedOption(notification, response);
-
- // For muting, we need to add the mute, then decline the offer.
- // This must be done here because:
- // * callback may be called immediately,
- // * adding the mute sends a message,
- // * we can't build two messages at once.
- if (2 == button)
- {
- LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID());
-
- llassert(notification_ptr != NULL);
- if (notification_ptr != NULL)
- {
- gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr()));
- }
- }
-
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ImprovedInstantMessage);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_MessageBlock);
- msg->addBOOLFast(_PREHASH_FromGroup, FALSE);
- msg->addUUIDFast(_PREHASH_ToAgentID, mFromID);
- msg->addU8Fast(_PREHASH_Offline, IM_ONLINE);
- msg->addUUIDFast(_PREHASH_ID, mTransactionID);
- msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary
- std::string name;
- LLAgentUI::buildFullname(name);
- msg->addStringFast(_PREHASH_FromAgentName, name);
- msg->addStringFast(_PREHASH_Message, "");
- msg->addU32Fast(_PREHASH_ParentEstateID, 0);
- msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null);
- msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent());
- LLInventoryObserver* opener = NULL;
-
- std::string from_string; // Used in the pop-up.
- std::string chatHistory_string; // Used in chat history.
- if (mFromObject == TRUE)
- {
- if (mFromGroup)
- {
- std::string group_name;
- if (gCacheName->getGroupName(mFromID, group_name))
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup")
- + " "+ "'" + group_name + "'";
-
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup")
- + " " + group_name + "'";
- }
- else
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'"
- + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup");
- }
- }
- else
- {
- std::string full_name;
- if (gCacheName->getFullName(mFromID, full_name))
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName
- + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + full_name;
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + full_name;
- }
- else
- {
- from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'")
- + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser");
- chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser");
- }
- }
- }
- else
- {
- from_string = chatHistory_string = mFromName;
- }
-
- bool busy=FALSE;
-
- switch(button)
- {
- case IOR_ACCEPT:
- // ACCEPT. The math for the dialog works, because the accept
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 1 greater than the offer integer value.
- // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED,
- // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED
- msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData),
- sizeof(mFolderID.mData));
- // send the message
- msg->sendReliable(mHost);
-
- //don't spam them if they are getting flooded
- if (check_offer_throttle(mFromName, true))
- {
- log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString(".");
- LLSD args;
- args["MESSAGE"] = log_message;
- LLNotificationsUtil::add("SystemMessage", args);
- }
-
- // we will want to open this item when it comes back.
- LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID
- << LL_ENDL;
- switch (mIM)
- {
- case IM_TASK_INVENTORY_OFFERED:
- case IM_GROUP_NOTICE:
- case IM_GROUP_NOTICE_REQUESTED:
- {
- // This is an offer from a task or group.
- // We don't use a new instance of an opener
- // We instead use the singular observer gOpenTaskOffer
- // Since it already exists, we don't need to actually do anything
- }
- break;
- default:
- LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL;
- break;
- } // end switch (mIM)
- break;
-
- case IOR_BUSY:
- //Busy falls through to decline. Says to make busy message.
- busy=TRUE;
- case IOR_MUTE:
- // MUTE falls through to decline
- case IOR_DECLINE:
- // DECLINE. The math for the dialog works, because the decline
- // for inventory_offered, task_inventory_offer or
- // group_notice_inventory is 2 greater than the offer integer value.
- // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED,
- // or IM_GROUP_NOTICE_INVENTORY_DECLINED
- default:
- // close button probably (or any of the fall-throughs from above)
- msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2));
- msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
- // send the message
- msg->sendReliable(mHost);
-
- if (gSavedSettings.getBOOL("LogInventoryDecline"))
- {
- LLStringUtil::format_map_t log_message_args;
- log_message_args["DESC"] = mDesc;
- log_message_args["NAME"] = mFromName;
- log_message = LLTrans::getString("InvOfferDecline", log_message_args);
-
- LLSD args;
- args["MESSAGE"] = log_message;
- LLNotificationsUtil::add("SystemMessage", args);
- }
-
- if (busy && (!mFromGroup && !mFromObject))
- {
- busy_message(msg,mFromID);
- }
- break;
- }
-
- if(opener)
- {
- gInventory.addObserver(opener);
- }
-
- if(!mPersist)
- {
- delete this;
- }
- return false;
-}
-
-class LLPostponedOfferNotification: public LLPostponedNotification
-{
-protected:
- /* virtual */
- void modifyNotificationParams()
- {
- LLSD substitutions = mParams.substitutions;
- substitutions["NAME"] = mName;
- mParams.substitutions = substitutions;
- }
-};
-
-void LLOfferInfo::initRespondFunctionMap()
-{
- if(mRespondFunctions.empty())
- {
- mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2);
- mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2);
- }
-}
-
-void inventory_offer_handler(LLOfferInfo* info)
-{
- //Until throttling is implmented, busy mode should reject inventory instead of silently
- //accepting it. SEE SL-39554
- if (gAgent.getBusy())
- {
- info->forceResponse(IOR_BUSY);
- return;
- }
-
- //If muted, don't even go through the messaging stuff. Just curtail the offer here.
- if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName))
- {
- info->forceResponse(IOR_MUTE);
- return;
- }
-
- // Avoid the Accept/Discard dialog if the user so desires. JC
- if (gSavedSettings.getBOOL("AutoAcceptNewInventory")
- && (info->mType == LLAssetType::AT_NOTECARD
- || info->mType == LLAssetType::AT_LANDMARK
- || info->mType == LLAssetType::AT_TEXTURE))
- {
- // For certain types, just accept the items into the inventory,
- // and possibly open them on receipt depending upon "ShowNewInventory".
- info->forceResponse(IOR_ACCEPT);
- return;
- }
-
- // Strip any SLURL from the message display. (DEV-2754)
- std::string msg = info->mDesc;
- int indx = msg.find(" ( http://slurl.com/secondlife/");
- if(indx == std::string::npos)
- {
- // try to find new slurl host
- indx = msg.find(" ( http://maps.secondlife.com/secondlife/");
- }
- if(indx >= 0)
- {
- LLStringUtil::truncate(msg, indx);
- }
-
- LLSD args;
- args["[OBJECTNAME]"] = msg;
-
- LLSD payload;
-
- // must protect against a NULL return from lookupHumanReadable()
- std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType));
- if (!typestr.empty())
- {
- // human readable matches string name from strings.xml
- // lets get asset type localized name
- args["OBJECTTYPE"] = LLTrans::getString(typestr);
- }
- else
- {
- LL_WARNS("Messaging") << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << LL_ENDL;
- args["OBJECTTYPE"] = "";
-
- // This seems safest, rather than propagating bogosity
- LL_WARNS("Messaging") << "Forcing an inventory-decline for probably-bad asset type." << LL_ENDL;
- info->forceResponse(IOR_DECLINE);
- return;
- }
-
- // If mObjectID is null then generate the object_id based on msg to prevent
- // multiple creation of chiclets for same object.
- LLUUID object_id = info->mObjectID;
- if (object_id.isNull())
- object_id.generate(msg);
-
- payload["from_id"] = info->mFromID;
- // Needed by LLScriptFloaterManager to bind original notification with
- // faked for toast one.
- payload["object_id"] = object_id;
- // Flag indicating that this notification is faked for toast.
- payload["give_inventory_notification"] = FALSE;
- args["OBJECTFROMNAME"] = info->mFromName;
- args["NAME"] = info->mFromName;
- if (info->mFromGroup)
- {
- args["NAME_SLURL"] = LLSLURL("group", info->mFromID, "about").getSLURLString();
- }
- else
- {
- args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
- }
- std::string verb = "select?name=" + LLURI::escape(msg);
- args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
-
- LLNotification::Params p("ObjectGiveItem");
-
- // Object -> Agent Inventory Offer
- if (info->mFromObject)
- {
- // Inventory Slurls don't currently work for non agent transfers, so only display the object name.
- args["ITEM_SLURL"] = msg;
- // Note: sets inventory_task_offer_callback as the callback
- p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
- info->mPersist = true;
- p.name = "ObjectGiveItem";
- // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
- LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
- }
- else // Agent -> Agent Inventory Offer
- {
- p.responder = info;
- // Note: sets inventory_offer_callback as the callback
- // *TODO fix memory leak
- // inventory_offer_callback() is not invoked if user received notification and
- // closes viewer(without responding the notification)
- p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
- info->mPersist = true;
- p.name = "UserGiveItem";
-
- // Prefetch the item into your local inventory.
- LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
- fetch_item->startFetch();
- if(fetch_item->isFinished())
- {
- fetch_item->done();
- }
- else
- {
- gInventory.addObserver(fetch_item);
- }
-
- // In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages).
- info->send_auto_receive_response();
-
- // Inform user that there is a script floater via toast system
- {
- payload["give_inventory_notification"] = TRUE;
- p.payload = payload;
- LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false);
- }
- }
-
- LLFirstUse::newInventory();
-}
-
-bool lure_callback(const LLSD& notification, const LLSD& response)
-{
- S32 option = 0;
- if (response.isInteger())
- {
- option = response.asInteger();
- }
- else
- {
- option = LLNotificationsUtil::getSelectedOption(notification, response);
- }
-
- LLUUID from_id = notification["payload"]["from_id"].asUUID();
- LLUUID lure_id = notification["payload"]["lure_id"].asUUID();
- BOOL godlike = notification["payload"]["godlike"].asBoolean();
-
- switch(option)
- {
- case 0:
- {
- // accept
- gAgent.teleportViaLure(lure_id, godlike);
- }
- break;
- case 1:
- default:
- // decline
- send_simple_im(from_id,
- LLStringUtil::null,
- IM_LURE_DECLINED,
- lure_id);
- break;
- }
- return false;
-}
-static LLNotificationFunctorRegistration lure_callback_reg("TeleportOffered", lure_callback);
-
-bool goto_url_callback(const LLSD& notification, const LLSD& response)
-{
- std::string url = notification["payload"]["url"].asString();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if(1 == option)
- {
- LLWeb::loadURL(url);
- }
- return false;
-}
-static LLNotificationFunctorRegistration goto_url_callback_reg("GotoURL", goto_url_callback);
-
-bool inspect_remote_object_callback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option)
- {
- LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]);
- }
- return false;
-}
-static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback);
-
-class LLPostponedServerObjectNotification: public LLPostponedNotification
-{
-protected:
- /* virtual */
- void modifyNotificationParams()
- {
- LLSD payload = mParams.payload;
- mParams.payload = payload;
- }
-};
-
-static bool parse_lure_bucket(const std::string& bucket,
- U64& region_handle,
- LLVector3& pos,
- LLVector3& look_at,
- U8& region_access)
-{
- // tokenize the bucket
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
- tokenizer tokens(bucket, sep);
- tokenizer::iterator iter = tokens.begin();
-
- S32 gx,gy,rx,ry,rz,lx,ly,lz;
- try
- {
- gx = boost::lexical_cast<S32>((*(iter)).c_str());
- gy = boost::lexical_cast<S32>((*(++iter)).c_str());
- rx = boost::lexical_cast<S32>((*(++iter)).c_str());
- ry = boost::lexical_cast<S32>((*(++iter)).c_str());
- rz = boost::lexical_cast<S32>((*(++iter)).c_str());
- lx = boost::lexical_cast<S32>((*(++iter)).c_str());
- ly = boost::lexical_cast<S32>((*(++iter)).c_str());
- lz = boost::lexical_cast<S32>((*(++iter)).c_str());
- }
- catch( boost::bad_lexical_cast& )
- {
- LL_WARNS("parse_lure_bucket")
- << "Couldn't parse lure bucket."
- << LL_ENDL;
- return false;
- }
- // Grab region access
- region_access = SIM_ACCESS_MIN;
- if (++iter != tokens.end())
- {
- std::string access_str((*iter).c_str());
- LLStringUtil::trim(access_str);
- if ( access_str == "A" )
- {
- region_access = SIM_ACCESS_ADULT;
- }
- else if ( access_str == "M" )
- {
- region_access = SIM_ACCESS_MATURE;
- }
- else if ( access_str == "PG" )
- {
- region_access = SIM_ACCESS_PG;
- }
- }
-
- pos.setVec((F32)rx, (F32)ry, (F32)rz);
- look_at.setVec((F32)lx, (F32)ly, (F32)lz);
-
- region_handle = to_region_handle(gx, gy);
- return true;
-}
-
-// Strip out "Resident" for display, but only if the message came from a user
-// (rather than a script)
-static std::string clean_name_from_im(const std::string& name, EInstantMessage type)
-{
- switch(type)
- {
- case IM_NOTHING_SPECIAL:
- case IM_MESSAGEBOX:
- case IM_GROUP_INVITATION:
- case IM_INVENTORY_OFFERED:
- case IM_INVENTORY_ACCEPTED:
- case IM_INVENTORY_DECLINED:
- case IM_GROUP_VOTE:
- case IM_GROUP_MESSAGE_DEPRECATED:
- //IM_TASK_INVENTORY_OFFERED
- //IM_TASK_INVENTORY_ACCEPTED
- //IM_TASK_INVENTORY_DECLINED
- case IM_NEW_USER_DEFAULT:
- case IM_SESSION_INVITE:
- case IM_SESSION_P2P_INVITE:
- case IM_SESSION_GROUP_START:
- case IM_SESSION_CONFERENCE_START:
- case IM_SESSION_SEND:
- case IM_SESSION_LEAVE:
- //IM_FROM_TASK
- case IM_BUSY_AUTO_RESPONSE:
- case IM_CONSOLE_AND_CHAT_HISTORY:
- case IM_LURE_USER:
- case IM_LURE_ACCEPTED:
- case IM_LURE_DECLINED:
- case IM_GODLIKE_LURE_USER:
- case IM_YET_TO_BE_USED:
- case IM_GROUP_ELECTION_DEPRECATED:
- //IM_GOTO_URL
- //IM_FROM_TASK_AS_ALERT
- case IM_GROUP_NOTICE:
- case IM_GROUP_NOTICE_INVENTORY_ACCEPTED:
- case IM_GROUP_NOTICE_INVENTORY_DECLINED:
- case IM_GROUP_INVITATION_ACCEPT:
- case IM_GROUP_INVITATION_DECLINE:
- case IM_GROUP_NOTICE_REQUESTED:
- case IM_FRIENDSHIP_OFFERED:
- case IM_FRIENDSHIP_ACCEPTED:
- case IM_FRIENDSHIP_DECLINED_DEPRECATED:
- //IM_TYPING_START
- //IM_TYPING_STOP
- return LLCacheName::cleanFullName(name);
- default:
- return name;
- }
-}
-
-static std::string clean_name_from_task_im(const std::string& msg,
- BOOL from_group)
-{
- boost::smatch match;
- static const boost::regex returned_exp(
- "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)");
- if (boost::regex_match(msg, match, returned_exp))
- {
- // match objects are 1-based for groups
- std::string final = match[1].str();
- std::string name = match[2].str();
- // Don't try to clean up group names
- if (!from_group)
- {
- if (LLAvatarNameCache::useDisplayNames())
- {
- // ...just convert to username
- final += LLCacheName::buildUsername(name);
- }
- else
- {
- // ...strip out legacy "Resident" name
- final += LLCacheName::cleanFullName(name);
- }
- }
- final += match[3].str();
- return final;
- }
- return msg;
-}
-
-void notification_display_name_callback(const LLUUID& id,
- const LLAvatarName& av_name,
- const std::string& name,
- LLSD& substitutions,
- const LLSD& payload)
-{
- substitutions["NAME"] = av_name.mDisplayName;
- LLNotificationsUtil::add(name, substitutions, payload);
-}
-
-class LLPostponedIMSystemTipNotification: public LLPostponedNotification
-{
-protected:
- /* virtual */
- void modifyNotificationParams()
- {
- LLSD payload = mParams.payload;
- payload["SESSION_NAME"] = mName;
- mParams.payload = payload;
- }
-
-};
-
-// Callback for name resolution of a god/estate message
-void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message)
-{
- LLSD args;
- args["NAME"] = av_name.getCompleteName();
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("GodMessage", args);
-
- // Treat like a system message and put in chat history.
- chat.mText = av_name.getCompleteName() + ": " + message;
-
- LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
- if(nearby_chat)
- {
- nearby_chat->addMessage(chat);
- }
-
-}
-
-void process_improved_im(LLMessageSystem *msg, void **user_data)
-{
- if (gNoRender)
- {
- return;
- }
- LLUUID from_id;
- BOOL from_group;
- LLUUID to_id;
- U8 offline;
- U8 d = 0;
- LLUUID session_id;
- U32 timestamp;
- std::string name;
- std::string message;
- U32 parent_estate_id = 0;
- LLUUID region_id;
- LLVector3 position;
- U8 binary_bucket[MTUBYTES];
- S32 binary_bucket_size;
- LLChat chat;
- std::string buffer;
-
- // *TODO: Translate - need to fix the full name to first/last (maybe)
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id);
- msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group);
- msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id);
- msg->getU8Fast( _PREHASH_MessageBlock, _PREHASH_Offline, offline);
- msg->getU8Fast( _PREHASH_MessageBlock, _PREHASH_Dialog, d);
- msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id);
- msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, timestamp);
- //msg->getData("MessageBlock", "Count", &count);
- msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name);
- msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
- msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id);
- msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id);
- msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position);
- msg->getBinaryDataFast( _PREHASH_MessageBlock, _PREHASH_BinaryBucket, binary_bucket, 0, 0, MTUBYTES);
- binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket);
- EInstantMessage dialog = (EInstantMessage)d;
-
- // make sure that we don't have an empty or all-whitespace name
- LLStringUtil::trim(name);
- if (name.empty())
- {
- name = LLTrans::getString("Unnamed");
- }
- // IDEVO convert new-style "Resident" names for display
- name = clean_name_from_im(name, dialog);
-
- BOOL is_busy = gAgent.getBusy();
- BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat);
- BOOL is_linden = LLMuteList::getInstance()->isLinden(name);
- BOOL is_owned_by_me = FALSE;
- BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true;
- BOOL accept_im_from_only_friend = gSavedSettings.getBOOL("VoiceCallsFriendsOnly");
-
- chat.mMuted = is_muted && !is_linden;
- chat.mFromID = from_id;
- chat.mFromName = name;
- chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
-
- LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
- if (source)
- {
- is_owned_by_me = source->permYouOwner();
- }
-
- std::string separator_string(": ");
-
- LLSD args;
- LLSD payload;
- LLNotification::Params params;
-
- switch(dialog)
- {
- case IM_CONSOLE_AND_CHAT_HISTORY:
- args["MESSAGE"] = message;
- payload["from_id"] = from_id;
-
- params.name = "IMSystemMessageTip";
- params.substitutions = args;
- params.payload = payload;
- LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false);
- break;
-
- case IM_NOTHING_SPECIAL:
- // Don't show dialog, just do IM
- if (!gAgent.isGodlike()
- && gAgent.getRegion()->isPrelude()
- && to_id.isNull() )
- {
- // do nothing -- don't distract newbies in
- // Prelude with global IMs
- }
- else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM)
- {
- // return a standard "busy" message, but only do it to online IM
- // (i.e. not other auto responses and not store-and-forward IM)
- if (!gIMMgr->hasSession(session_id))
- {
- // if there is not a panel for this conversation (i.e. it is a new IM conversation
- // initiated by the other party) then...
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
- std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- from_id,
- my_name,
- response,
- IM_ONLINE,
- IM_BUSY_AUTO_RESPONSE,
- session_id);
- gAgent.sendReliableMessage();
- }
-
- // now store incoming IM in chat history
-
- buffer = message;
-
- LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
-
- // add to IM panel, but do not bother the user
- gIMMgr->addMessage(
- session_id,
- from_id,
- name,
- buffer,
- LLStringUtil::null,
- dialog,
- parent_estate_id,
- region_id,
- position,
- true);
- }
- else if (from_id.isNull())
- {
- LLSD args;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("SystemMessage", args);
- }
- else if (to_id.isNull())
- {
- // Message to everyone from GOD, look up the fullname since
- // server always slams name to legacy names
- LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message));
- }
- else
- {
- // standard message, not from system
- std::string saved;
- if(offline == IM_OFFLINE)
- {
- LLStringUtil::format_map_t args;
- args["[LONG_TIMESTAMP]"] = formatted_time(timestamp);
- saved = LLTrans::getString("Saved_message", args);
- }
- buffer = saved + message;
-
- LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
-
- bool mute_im = is_muted;
- if(accept_im_from_only_friend&&!is_friend)
- {
- mute_im = true;
- }
- if (!mute_im || is_linden)
- {
- gIMMgr->addMessage(
- session_id,
- from_id,
- name,
- buffer,
- LLStringUtil::null,
- dialog,
- parent_estate_id,
- region_id,
- position,
- true);
- }
- else
- {
- /*
- EXT-5099
- currently there is no way to store in history only...
- using LLNotificationsUtil::add will add message to Nearby Chat
-
- // muted user, so don't start an IM session, just record line in chat
- // history. Pretend the chat is from a local agent,
- // so it will go into the history but not be shown on screen.
-
- LLSD args;
- args["MESSAGE"] = buffer;
- LLNotificationsUtil::add("SystemMessageTip", args);
- */
- }
- }
- break;
-
- case IM_TYPING_START:
- {
- LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
- gIMMgr->processIMTypingStart(im_info);
- }
- break;
-
- case IM_TYPING_STOP:
- {
- LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
- gIMMgr->processIMTypingStop(im_info);
- }
- break;
-
- case IM_MESSAGEBOX:
- {
- // This is a block, modeless dialog.
- //*TODO: Translate
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("SystemMessageTip", args);
- }
- break;
- case IM_GROUP_NOTICE:
- case IM_GROUP_NOTICE_REQUESTED:
- {
- LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
- // Read the binary bucket for more information.
- struct notice_bucket_header_t
- {
- U8 has_inventory;
- U8 asset_type;
- LLUUID group_id;
- };
- struct notice_bucket_full_t
- {
- struct notice_bucket_header_t header;
- U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
- }* notice_bin_bucket;
-
- // Make sure the binary bucket is big enough to hold the header
- // and a null terminated item name.
- if ( (binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
- || (binary_bucket[binary_bucket_size - 1] != '\0') )
- {
- LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
- break;
- }
-
- notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
- U8 has_inventory = notice_bin_bucket->header.has_inventory;
- U8 asset_type = notice_bin_bucket->header.asset_type;
- LLUUID group_id = notice_bin_bucket->header.group_id;
- std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name);
-
- // If there is inventory, give the user the inventory offer.
- LLOfferInfo* info = NULL;
-
- if (has_inventory)
- {
- info = new LLOfferInfo();
-
- info->mIM = IM_GROUP_NOTICE;
- info->mFromID = from_id;
- info->mFromGroup = from_group;
- info->mTransactionID = session_id;
- info->mType = (LLAssetType::EType) asset_type;
- info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
- std::string from_name;
-
- from_name += "A group member named ";
- from_name += name;
-
- info->mFromName = from_name;
- info->mDesc = item_name;
- info->mHost = msg->getSender();
- }
-
- std::string str(message);
-
- // Tokenize the string.
- // TODO: Support escaped tokens ("||" -> "|")
- typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
- boost::char_separator<char> sep("|","",boost::keep_empty_tokens);
- tokenizer tokens(str, sep);
- tokenizer::iterator iter = tokens.begin();
-
- std::string subj(*iter++);
- std::string mes(*iter++);
-
- // Send the notification down the new path.
- // For requested notices, we don't want to send the popups.
- if (dialog != IM_GROUP_NOTICE_REQUESTED)
- {
- payload["subject"] = subj;
- payload["message"] = mes;
- payload["sender_name"] = name;
- payload["group_id"] = group_id;
- payload["inventory_name"] = item_name;
- payload["inventory_offer"] = info ? info->asLLSD() : LLSD();
-
- LLSD args;
- args["SUBJECT"] = subj;
- args["MESSAGE"] = mes;
- LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(timestamp));
- }
-
- // Also send down the old path for now.
- if (IM_GROUP_NOTICE_REQUESTED == dialog)
- {
-
- LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info);
- }
- else
- {
- delete info;
- }
- }
- break;
- case IM_GROUP_INVITATION:
- {
- //if (!is_linden && (is_busy || is_muted))
- if ((is_busy || is_muted))
- {
- LLMessageSystem *msg = gMessageSystem;
- busy_message(msg,from_id);
- }
- else
- {
- LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL;
- // Read the binary bucket for more information.
- struct invite_bucket_t
- {
- S32 membership_fee;
- LLUUID role_id;
- }* invite_bucket;
-
- // Make sure the binary bucket is the correct size.
- if (binary_bucket_size != sizeof(invite_bucket_t))
- {
- LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL;
- break;
- }
-
- invite_bucket = (struct invite_bucket_t*) &binary_bucket[0];
- S32 membership_fee = ntohl(invite_bucket->membership_fee);
-
- LLSD payload;
- payload["transaction_id"] = session_id;
- payload["group_id"] = from_id;
- payload["name"] = name;
- payload["message"] = message;
- payload["fee"] = membership_fee;
-
- LLSD args;
- args["MESSAGE"] = message;
- // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
- LLNotificationsUtil::add("JoinGroup", args, payload);
- }
- }
- break;
-
- case IM_INVENTORY_OFFERED:
- case IM_TASK_INVENTORY_OFFERED:
- // Someone has offered us some inventory.
- {
- LLOfferInfo* info = new LLOfferInfo;
- if (IM_INVENTORY_OFFERED == dialog)
- {
- struct offer_agent_bucket_t
- {
- S8 asset_type;
- LLUUID object_id;
- }* bucketp;
-
- if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
- {
- LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL;
- delete info;
- break;
- }
- bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
- info->mType = (LLAssetType::EType) bucketp->asset_type;
- info->mObjectID = bucketp->object_id;
- }
- else
- {
- if (sizeof(S8) != binary_bucket_size)
- {
- LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL;
- delete info;
- break;
- }
- info->mType = (LLAssetType::EType) binary_bucket[0];
- info->mObjectID = LLUUID::null;
- }
-
- info->mIM = dialog;
- info->mFromID = from_id;
- info->mFromGroup = from_group;
- info->mTransactionID = session_id;
- info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
-
- if (dialog == IM_TASK_INVENTORY_OFFERED)
- {
- info->mFromObject = TRUE;
- }
- else
- {
- info->mFromObject = FALSE;
- }
- info->mFromName = name;
- info->mDesc = message;
- info->mHost = msg->getSender();
- //if (((is_busy && !is_owned_by_me) || is_muted))
- if (is_muted)
- {
- // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
- LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
- fetch_item->startFetch();
- delete fetch_item;
-
- // Same as closing window
- info->forceResponse(IOR_DECLINE);
- }
- else
- {
- inventory_offer_handler(info);
- }
- }
- break;
-
- case IM_INVENTORY_ACCEPTED:
- {
- args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
- LLSD payload;
- payload["from_id"] = from_id;
- LLNotificationsUtil::add("InventoryAccepted", args, payload);
- break;
- }
- case IM_INVENTORY_DECLINED:
- {
- args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
- LLSD payload;
- payload["from_id"] = from_id;
- LLNotificationsUtil::add("InventoryDeclined", args, payload);
- break;
- }
- // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856
- case IM_GROUP_VOTE:
- {
- LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL;
- }
- break;
-
- case IM_GROUP_ELECTION_DEPRECATED:
- {
- LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL;
- }
- break;
-
- case IM_SESSION_SEND:
- {
- if (!is_linden && is_busy)
- {
- return;
- }
-
- // Only show messages if we have a session open (which
- // should happen after you get an "invitation"
- if ( !gIMMgr->hasSession(session_id) )
- {
- return;
- }
-
- // standard message, not from system
- std::string saved;
- if(offline == IM_OFFLINE)
- {
- saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str());
- }
- buffer = saved + message;
- BOOL is_this_agent = FALSE;
- if(from_id == gAgentID)
- {
- is_this_agent = TRUE;
- }
- gIMMgr->addMessage(
- session_id,
- from_id,
- name,
- buffer,
- ll_safe_string((char*)binary_bucket),
- IM_SESSION_INVITE,
- parent_estate_id,
- region_id,
- position,
- true);
- }
- break;
-
- case IM_FROM_TASK:
- {
- if (is_busy && !is_owned_by_me)
- {
- return;
- }
-
- // Build a link to open the object IM info window.
- std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1);
-
- if (session_id.notNull())
- {
- chat.mFromID = session_id;
- }
- else
- {
- // This message originated on a region without the updated code for task id and slurl information.
- // We just need a unique ID for this object that isn't the owner ID.
- // If it is the owner ID it will overwrite the style that contains the link to that owner's profile.
- // This isn't ideal - it will make 1 style for all objects owned by the the same person/group.
- // This works because the only thing we can really do in this case is show the owner name and link to their profile.
- chat.mFromID = from_id ^ gAgent.getSessionID();
- }
-
- chat.mSourceType = CHAT_SOURCE_OBJECT;
-
- if(SYSTEM_FROM == name)
- {
- // System's UUID is NULL (fixes EXT-4766)
- chat.mFromID = LLUUID::null;
- chat.mSourceType = CHAT_SOURCE_SYSTEM;
- }
-
- // IDEVO Some messages have embedded resident names
- message = clean_name_from_task_im(message, from_group);
-
- LLSD query_string;
- query_string["owner"] = from_id;
- query_string["slurl"] = location;
- query_string["name"] = name;
- if (from_group)
- {
- query_string["groupowned"] = "true";
- }
-
- chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
- chat.mText = message;
-
- // Note: lie to Nearby Chat, pretending that this is NOT an IM, because
- // IMs from obejcts don't open IM sessions.
- LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
- if(SYSTEM_FROM != name && nearby_chat)
- {
- chat.mOwnerID = from_id;
- LLSD args;
- args["slurl"] = location;
- args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
-
- // Look for IRC-style emotes here so object name formatting is correct
- std::string prefix = message.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- chat.mChatStyle = CHAT_STYLE_IRC;
- }
-
- LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
- }
-
-
- //Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590)
- if (SYSTEM_FROM != name) break;
-
- LLSD substitutions;
- substitutions["NAME"] = name;
- substitutions["MSG"] = message;
-
- LLSD payload;
- payload["object_id"] = session_id;
- payload["owner_id"] = from_id;
- payload["from_id"] = from_id;
- payload["slurl"] = location;
- payload["name"] = name;
- std::string session_name;
- if (from_group)
- {
- payload["group_owned"] = "true";
- }
-
- LLNotification::Params params("ServerObjectMessage");
- params.substitutions = substitutions;
- params.payload = payload;
-
- LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, from_group);
- }
- break;
- case IM_FROM_TASK_AS_ALERT:
- if (is_busy && !is_owned_by_me)
- {
- return;
- }
- {
- // Construct a viewer alert for this message.
- args["NAME"] = name;
- args["MESSAGE"] = message;
- LLNotificationsUtil::add("ObjectMessage", args);
- }
- break;
- case IM_BUSY_AUTO_RESPONSE:
- if (is_muted)
- {
- LL_DEBUGS("Messaging") << "Ignoring busy response from " << from_id << LL_ENDL;
- return;
- }
- else
- {
- // TODO: after LLTrans hits release, get "busy response" into translatable file
- buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.c_str());
- gIMMgr->addMessage(session_id, from_id, name, buffer);
- }
- break;
-
- case IM_LURE_USER:
- {
- if (is_muted)
- {
- return;
- }
- else if (is_busy)
- {
- busy_message(msg,from_id);
- }
- else
- {
- LLVector3 pos, look_at;
- U64 region_handle;
- U8 region_access = SIM_ACCESS_MIN;
- std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
- std::string region_access_str = LLStringUtil::null;
- std::string region_access_icn = LLStringUtil::null;
-
- if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
- {
- region_access_str = LLViewerRegion::accessToString(region_access);
- region_access_icn = LLViewerRegion::getAccessIcon(region_access);
- }
-
- LLSD args;
- // *TODO: Translate -> [FIRST] [LAST] (maybe)
- args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
- args["MESSAGE"] = message;
- args["MATURITY_STR"] = region_access_str;
- args["MATURITY_ICON"] = region_access_icn;
- LLSD payload;
- payload["from_id"] = from_id;
- payload["lure_id"] = session_id;
- payload["godlike"] = FALSE;
-
- LLNotification::Params params("TeleportOffered");
- params.substitutions = args;
- params.payload = payload;
- LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false);
- }
- }
- break;
-
- case IM_GODLIKE_LURE_USER:
- {
- LLSD payload;
- payload["from_id"] = from_id;
- payload["lure_id"] = session_id;
- payload["godlike"] = TRUE;
- // do not show a message box, because you're about to be
- // teleported.
- LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0);
- }
- break;
-
- case IM_GOTO_URL:
- {
- LLSD args;
- // n.b. this is for URLs sent by the system, not for
- // URLs sent by scripts (i.e. llLoadURL)
- if (binary_bucket_size <= 0)
- {
- LL_WARNS("Messaging") << "bad binary_bucket_size: "
- << binary_bucket_size
- << " - aborting function." << LL_ENDL;
- return;
- }
-
- std::string url;
-
- url.assign((char*)binary_bucket, binary_bucket_size-1);
- args["MESSAGE"] = message;
- args["URL"] = url;
- LLSD payload;
- payload["url"] = url;
- LLNotificationsUtil::add("GotoURL", args, payload );
- }
- break;
-
- case IM_FRIENDSHIP_OFFERED:
- {
- LLSD payload;
- payload["from_id"] = from_id;
- payload["session_id"] = session_id;;
- payload["online"] = (offline == IM_ONLINE);
- payload["sender"] = msg->getSender().getIPandPort();
-
- if (is_busy)
- {
- busy_message(msg, from_id);
- LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
- }
- else if (is_muted)
- {
- LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
- }
- else
- {
- args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
- if(message.empty())
- {
- //support for frienship offers from clients before July 2008
- LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload);
- }
- else
- {
- args["[MESSAGE]"] = message;
- LLNotification::Params params("OfferFriendship");
- params.substitutions = args;
- params.payload = payload;
- LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false);
- }
- }
- }
- break;
-
- case IM_FRIENDSHIP_ACCEPTED:
- {
- // In the case of an offline IM, the formFriendship() may be extraneous
- // as the database should already include the relationship. But it
- // doesn't hurt for dupes.
- LLAvatarTracker::formFriendship(from_id);
-
- std::vector<std::string> strings;
- strings.push_back(from_id.asString());
- send_generic_message("requestonlinenotification", strings);
-
- args["NAME"] = name;
- LLSD payload;
- payload["from_id"] = from_id;
- LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback,
- _1,
- _2,
- "FriendshipAccepted",
- args,
- payload));
- }
- break;
-
- case IM_FRIENDSHIP_DECLINED_DEPRECATED:
- default:
- LL_WARNS("Messaging") << "Instant message calling for unknown dialog "
- << (S32)dialog << LL_ENDL;
- break;
- }
-
- LLWindow* viewer_window = gViewerWindow->getWindow();
- if (viewer_window && viewer_window->getMinimized())
- {
- viewer_window->flashIcon(5.f);
- }
-}
-
-void busy_message (LLMessageSystem* msg, LLUUID from_id)
-{
- if (gAgent.getBusy())
- {
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
- std::string response = gSavedPerAccountSettings.getString("BusyModeResponse");
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- from_id,
- my_name,
- response,
- IM_ONLINE,
- IM_BUSY_AUTO_RESPONSE);
- gAgent.sendReliableMessage();
- }
-}
-
-bool callingcard_offer_callback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLUUID fid;
- LLUUID from_id;
- LLMessageSystem* msg = gMessageSystem;
- switch(option)
- {
- case 0:
- // accept
- msg->newMessageFast(_PREHASH_AcceptCallingCard);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
- fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- msg->nextBlockFast(_PREHASH_FolderData);
- msg->addUUIDFast(_PREHASH_FolderID, fid);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- break;
- case 1:
- // decline
- msg->newMessageFast(_PREHASH_DeclineCallingCard);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_TransactionBlock);
- msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID());
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- busy_message(msg, notification["payload"]["source_id"].asUUID());
- break;
- default:
- // close button probably, possibly timed out
- break;
- }
-
- return false;
-}
-static LLNotificationFunctorRegistration callingcard_offer_cb_reg("OfferCallingCard", callingcard_offer_callback);
-
-void process_offer_callingcard(LLMessageSystem* msg, void**)
-{
- // someone has offered to form a friendship
- LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL;
-
- LLUUID source_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id);
- LLUUID tid;
- msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid);
-
- LLSD payload;
- payload["transaction_id"] = tid;
- payload["source_id"] = source_id;
- payload["sender"] = msg->getSender().getIPandPort();
-
- LLViewerObject* source = gObjectList.findObject(source_id);
- LLSD args;
- std::string source_name;
- if(source && source->isAvatar())
- {
- LLNameValue* nvfirst = source->getNVPair("FirstName");
- LLNameValue* nvlast = source->getNVPair("LastName");
- if (nvfirst && nvlast)
- {
- source_name = LLCacheName::buildFullName(
- nvfirst->getString(), nvlast->getString());
- }
- }
-
- if(!source_name.empty())
- {
- if (gAgent.getBusy()
- || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat))
- {
- // automatically decline offer
- LLNotifications::instance().forceResponse(LLNotification::Params("OfferCallingCard").payload(payload), 1);
- }
- else
- {
- args["NAME"] = source_name;
- LLNotificationsUtil::add("OfferCallingCard", args, payload);
- }
- }
- else
- {
- LL_WARNS("Messaging") << "Calling card offer from an unknown source." << LL_ENDL;
- }
-}
-
-void process_accept_callingcard(LLMessageSystem* msg, void**)
-{
- LLNotificationsUtil::add("CallingCardAccepted");
-}
-
-void process_decline_callingcard(LLMessageSystem* msg, void**)
-{
- LLNotificationsUtil::add("CallingCardDeclined");
-}
-
-class ChatTranslationReceiver : public LLTranslate::TranslationReceiver
-{
-public :
- ChatTranslationReceiver(const std::string &from_lang, const std::string &to_lang, const std::string &mesg,
- const LLChat &chat, const LLSD &toast_args)
- : LLTranslate::TranslationReceiver(from_lang, to_lang),
- m_chat(chat),
- m_toastArgs(toast_args),
- m_origMesg(mesg)
- {
- }
-
- static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args)
- {
- return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args));
- }
-
-protected:
- void handleResponse(const std::string &translation, const std::string &detected_language)
- {
- // filter out non-interesting responeses
- if ( !translation.empty()
- && (m_toLang != detected_language)
- && (LLStringUtil::compareInsensitive(translation, m_origMesg) != 0) )
- {
- m_chat.mText += " (" + translation + ")";
- }
-
- LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs);
- }
-
- void handleFailure()
- {
- LLTranslate::TranslationReceiver::handleFailure();
- m_chat.mText += " (?)";
-
- LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs);
- }
-
-private:
- LLChat m_chat;
- std::string m_origMesg;
- LLSD m_toastArgs;
-};
-void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
-{
- LLChat chat;
- std::string mesg;
- std::string from_name;
- U8 source_temp;
- U8 type_temp;
- U8 audible_temp;
- LLColor4 color(1.0f, 1.0f, 1.0f, 1.0f);
- LLUUID from_id;
- LLUUID owner_id;
- BOOL is_owned_by_me = FALSE;
- LLViewerObject* chatter;
-
- msg->getString("ChatData", "FromName", from_name);
-
- msg->getUUID("ChatData", "SourceID", from_id);
- chat.mFromID = from_id;
-
- // Object owner for objects
- msg->getUUID("ChatData", "OwnerID", owner_id);
-
- msg->getU8Fast(_PREHASH_ChatData, _PREHASH_SourceType, source_temp);
- chat.mSourceType = (EChatSourceType)source_temp;
-
- msg->getU8("ChatData", "ChatType", type_temp);
- chat.mChatType = (EChatType)type_temp;
-
- msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp);
- chat.mAudible = (EChatAudible)audible_temp;
-
- chat.mTime = LLFrameTimer::getElapsedSeconds();
-
- // IDEVO Correct for new-style "Resident" names
- if (chat.mSourceType == CHAT_SOURCE_AGENT)
- {
- // I don't know if it's OK to change this here, if
- // anything downstream does lookups by name, for instance
-
- LLAvatarName av_name;
- if (LLAvatarNameCache::get(from_id, &av_name))
- {
- chat.mFromName = av_name.mDisplayName;
- }
- else
- {
- chat.mFromName = LLCacheName::cleanFullName(from_name);
- }
- }
- else
- {
- chat.mFromName = from_name;
- }
-
- BOOL is_busy = gAgent.getBusy();
-
- BOOL is_muted = FALSE;
- BOOL is_linden = FALSE;
- is_muted = LLMuteList::getInstance()->isMuted(
- from_id,
- from_name,
- LLMute::flagTextChat)
- || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat);
- is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
- LLMuteList::getInstance()->isLinden(from_name);
-
- BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible);
- chatter = gObjectList.findObject(from_id);
- if (chatter)
- {
- chat.mPosAgent = chatter->getPositionAgent();
-
- // Make swirly things only for talking objects. (not script debug messages, though)
- if (chat.mSourceType == CHAT_SOURCE_OBJECT
- && chat.mChatType != CHAT_TYPE_DEBUG_MSG
- && gSavedSettings.getBOOL("EffectScriptChatParticles") )
- {
- LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent());
- psc->setSourceObject(chatter);
- psc->setColor(color);
- //We set the particles to be owned by the object's owner,
- //just in case they should be muted by the mute list
- psc->setOwnerUUID(owner_id);
- LLViewerPartSim::getInstance()->addPartSource(psc);
- }
-
- // record last audible utterance
- if (is_audible
- && (is_linden || (!is_muted && !is_busy)))
- {
- if (chat.mChatType != CHAT_TYPE_START
- && chat.mChatType != CHAT_TYPE_STOP)
- {
- gAgent.heardChat(chat.mFromID);
- }
- }
-
- is_owned_by_me = chatter->permYouOwner();
- }
-
- if (is_audible)
- {
- BOOL visible_in_chat_bubble = FALSE;
- std::string verb;
-
- color.setVec(1.f,1.f,1.f,1.f);
- msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg);
-
- BOOL ircstyle = FALSE;
-
- // Look for IRC-style emotes here so chatbubbles work
- std::string prefix = mesg.substr(0, 4);
- if (prefix == "/me " || prefix == "/me'")
- {
- ircstyle = TRUE;
- }
- chat.mText = mesg;
-
- // Look for the start of typing so we can put "..." in the bubbles.
- if (CHAT_TYPE_START == chat.mChatType)
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE);
-
- // Might not have the avatar constructed yet, eg on login.
- if (chatter && chatter->isAvatar())
- {
- ((LLVOAvatar*)chatter)->startTyping();
- }
- return;
- }
- else if (CHAT_TYPE_STOP == chat.mChatType)
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
-
- // Might not have the avatar constructed yet, eg on login.
- if (chatter && chatter->isAvatar())
- {
- ((LLVOAvatar*)chatter)->stopTyping();
- }
- return;
- }
-
- // Look for IRC-style emotes
- if (ircstyle)
- {
- // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656
- chat.mChatStyle = CHAT_STYLE_IRC;
-
- // Do nothing, ircstyle is fixed above for chat bubbles
- }
- else
- {
- switch(chat.mChatType)
- {
- case CHAT_TYPE_WHISPER:
- verb = LLTrans::getString("whisper") + " ";
- break;
- case CHAT_TYPE_DEBUG_MSG:
- case CHAT_TYPE_OWNER:
- case CHAT_TYPE_NORMAL:
- verb = "";
- break;
- case CHAT_TYPE_SHOUT:
- verb = LLTrans::getString("shout") + " ";
- break;
- case CHAT_TYPE_START:
- case CHAT_TYPE_STOP:
- LL_WARNS("Messaging") << "Got chat type start/stop in main chat processing." << LL_ENDL;
- break;
- default:
- LL_WARNS("Messaging") << "Unknown type " << chat.mChatType << " in chat!" << LL_ENDL;
- verb = "";
- break;
- }
-
-
- chat.mText = "";
- chat.mText += verb;
- chat.mText += mesg;
- }
-
- // We have a real utterance now, so can stop showing "..." and proceed.
- if (chatter && chatter->isAvatar())
- {
- LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE);
- ((LLVOAvatar*)chatter)->stopTyping();
-
- if (!is_muted && !is_busy)
- {
- visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles");
- std::string formated_msg = "";
- LLViewerChat::formatChatMsg(chat, formated_msg);
- LLChat chat_bubble = chat;
- chat_bubble.mText = formated_msg;
- ((LLVOAvatar*)chatter)->addChat(chat_bubble);
- }
- }
-
- if (chatter)
- {
- chat.mPosAgent = chatter->getPositionAgent();
- }
-
- // truth table:
- // LINDEN BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY
- // F F F F * Yes Yes
- // F F F T * Yes Yes
- // F F T F * No No
- // F F T T * No No
- // F T F F * No Yes
- // F T F T * Yes Yes
- // F T T F * No No
- // F T T T * No No
- // T * * * F Yes Yes
-
- chat.mMuted = is_muted && !is_linden;
-
- // pass owner_id to chat so that we can display the remote
- // object inspect for an object that is chatting with you
- LLSD args;
- args["type"] = LLNotificationsUI::NT_NEARBYCHAT;
- chat.mOwnerID = owner_id;
-
- if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM)
- {
- if (chat.mChatStyle == CHAT_STYLE_IRC)
- {
- mesg = mesg.substr(4, std::string::npos);
- }
- const std::string from_lang = ""; // leave empty to trigger autodetect
- const std::string to_lang = LLTranslate::getTranslateLanguage();
-
- LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args);
- LLTranslate::translateMessage(result, from_lang, to_lang, mesg);
- }
- else
- {
- LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
- }
- }
-}
-
-
-// Simulator we're on is informing the viewer that the agent
-// is starting to teleport (perhaps to another sim, perhaps to the
-// same sim). If we initiated the teleport process by sending some kind
-// of TeleportRequest, then this info is redundant, but if the sim
-// initiated the teleport (via a script call, being killed, etc.)
-// then this info is news to us.
-void process_teleport_start(LLMessageSystem *msg, void**)
-{
- // on teleport, don't tell them about destination guide anymore
- LLFirstUse::notUsingDestinationGuide(false);
- U32 teleport_flags = 0x0;
- msg->getU32("Info", "TeleportFlags", teleport_flags);
-
- LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL;
-
- if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
- }
- else
- {
- gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
- }
-
- // Freeze the UI and show progress bar
- // Note: could add data here to differentiate between normal teleport and death.
-
- if( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
- {
- gTeleportDisplay = TRUE;
- gAgent.setTeleportState( LLAgent::TELEPORT_START );
- make_ui_sound("UISndTeleportOut");
-
- LL_INFOS("Messaging") << "Teleport initiated by remote TeleportStart message with TeleportFlags: " << teleport_flags << LL_ENDL;
- // Don't call LLFirstUse::useTeleport here because this could be
- // due to being killed, which would send you home, not to a Telehub
- }
-}
-
-void process_teleport_progress(LLMessageSystem* msg, void**)
-{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- if((gAgent.getID() != agent_id)
- || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE))
- {
- LL_WARNS("Messaging") << "Unexpected teleport progress message." << LL_ENDL;
- return;
- }
- U32 teleport_flags = 0x0;
- msg->getU32("Info", "TeleportFlags", teleport_flags);
- if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL)
- {
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
- }
- else
- {
- gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel"));
- }
- std::string buffer;
- msg->getString("Info", "Message", buffer);
- LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL;
-
- //Sorta hacky...default to using simulator raw messages
- //if we don't find the coresponding mapping in our progress mappings
- std::string message = buffer;
-
- if (LLAgent::sTeleportProgressMessages.find(buffer) !=
- LLAgent::sTeleportProgressMessages.end() )
- {
- message = LLAgent::sTeleportProgressMessages[buffer];
- }
-
- gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages[message]);
-}
-
-class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver
-{
-public:
- LLFetchInWelcomeArea(const uuid_vec_t &ids) :
- LLInventoryFetchDescendentsObserver(ids)
- {}
- virtual void done()
- {
- LLIsType is_landmark(LLAssetType::AT_LANDMARK);
- LLIsType is_card(LLAssetType::AT_CALLINGCARD);
-
- LLInventoryModel::cat_array_t card_cats;
- LLInventoryModel::item_array_t card_items;
- LLInventoryModel::cat_array_t land_cats;
- LLInventoryModel::item_array_t land_items;
-
- uuid_vec_t::iterator it = mComplete.begin();
- uuid_vec_t::iterator end = mComplete.end();
- for(; it != end; ++it)
- {
- gInventory.collectDescendentsIf(
- (*it),
- land_cats,
- land_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_landmark);
- gInventory.collectDescendentsIf(
- (*it),
- card_cats,
- card_items,
- LLInventoryModel::EXCLUDE_TRASH,
- is_card);
- }
- LLSD args;
- if ( land_items.count() > 0 )
- { // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory
- S32 random_land = ll_rand( land_items.count() - 1 );
- args["NAME"] = land_items[random_land]->getName();
- LLNotificationsUtil::add("TeleportToLandmark",args);
- }
- if ( card_items.count() > 0 )
- { // Show notification that they can now contact people. Use a random calling card from the inventory
- S32 random_card = ll_rand( card_items.count() - 1 );
- args["NAME"] = card_items[random_card]->getName();
- LLNotificationsUtil::add("TeleportToPerson",args);
- }
-
- gInventory.removeObserver(this);
- delete this;
- }
-};
-
-
-
-class LLPostTeleportNotifiers : public LLEventTimer
-{
-public:
- LLPostTeleportNotifiers();
- virtual ~LLPostTeleportNotifiers();
-
- //function to be called at the supplied frequency
- virtual BOOL tick();
-};
-
-LLPostTeleportNotifiers::LLPostTeleportNotifiers() : LLEventTimer( 2.0 )
-{
-};
-
-LLPostTeleportNotifiers::~LLPostTeleportNotifiers()
-{
-}
-
-BOOL LLPostTeleportNotifiers::tick()
-{
- BOOL all_done = FALSE;
- if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
- {
- // get callingcards and landmarks available to the user arriving.
- uuid_vec_t folders;
- const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
- if(callingcard_id.notNull())
- folders.push_back(callingcard_id);
- const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
- if(folder_id.notNull())
- folders.push_back(folder_id);
- if(!folders.empty())
- {
- LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders);
- fetcher->startFetch();
- if(fetcher->isFinished())
- {
- fetcher->done();
- }
- else
- {
- gInventory.addObserver(fetcher);
- }
- }
- all_done = TRUE;
- }
-
- return all_done;
-}
-
-
-
-// Teleport notification from the simulator
-// We're going to pretend to be a new agent
-void process_teleport_finish(LLMessageSystem* msg, void**)
-{
- LL_DEBUGS("Messaging") << "Got teleport location message" << LL_ENDL;
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL;
- return;
- }
-
- // Teleport is finished; it can't be cancelled now.
- gViewerWindow->setProgressCancelButtonVisible(FALSE);
-
- // Do teleport effect for where you're leaving
- // VEFFECT: TeleportStart
- LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
-
- U32 location_id;
- U32 sim_ip;
- U16 sim_port;
- LLVector3 pos, look_at;
- U64 region_handle;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
- msg->getIPAddrFast(_PREHASH_Info, _PREHASH_SimIP, sim_ip);
- msg->getIPPortFast(_PREHASH_Info, _PREHASH_SimPort, sim_port);
- //msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
- //msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
- msg->getU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle);
- U32 teleport_flags;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
-
-
- std::string seedCap;
- msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap);
-
- // update home location if we are teleporting out of prelude - specific to teleporting to welcome area
- if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET)
- && (!gAgent.isGodlike()))
- {
- gAgent.setHomePosRegion(region_handle, pos);
-
- // Create a timer that will send notices when teleporting is all finished. Since this is
- // based on the LLEventTimer class, it will be managed by that class and not orphaned or leaked.
- new LLPostTeleportNotifiers();
- }
-
- LLHost sim_host(sim_ip, sim_port);
-
- // Viewer trusts the simulator.
- gMessageSystem->enableCircuit(sim_host, TRUE);
- LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
-
-/*
- // send camera update to new region
- gAgentCamera.updateCamera();
-
- // likewise make sure the camera is behind the avatar
- gAgentCamera.resetView(TRUE);
- LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal());
- gAgent.setRegion(regionp);
- gObjectList.shiftObjects(shift_vector);
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->clearChatText();
- gAgentCamera.slamLookAt(look_at);
- }
- gAgent.setPositionAgent(pos);
- gAssetStorage->setUpstream(sim);
- gCacheName->setUpstream(sim);
-*/
-
- // now, use the circuit info to tell simulator about us!
- LL_INFOS("Messaging") << "process_teleport_finish() Enabling "
- << sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL;
- msg->newMessageFast(_PREHASH_UseCircuitCode);
- msg->nextBlockFast(_PREHASH_CircuitCode);
- msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_ID, gAgent.getID());
- msg->sendReliable(sim_host);
-
- send_complete_agent_movement(sim_host);
- gAgent.setTeleportState( LLAgent::TELEPORT_MOVING );
- gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]);
-
- regionp->setSeedCapability(seedCap);
-
- // Don't send camera updates to the new region until we're
- // actually there...
-
-
- // Now do teleport effect for where you're going.
- // VEFFECT: TeleportEnd
- effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE);
- effectp->setPositionGlobal(gAgent.getPositionGlobal());
-
- effectp->setColor(LLColor4U(gAgent.getEffectColor()));
- LLHUDManager::getInstance()->sendEffects();
-
-// gTeleportDisplay = TRUE;
-// gTeleportDisplayTimer.reset();
-// gViewerWindow->setShowProgress(TRUE);
-}
-
-// stuff we have to do every time we get an AvatarInitComplete from a sim
-/*
-void process_avatar_init_complete(LLMessageSystem* msg, void**)
-{
- LLVector3 agent_pos;
- msg->getVector3Fast(_PREHASH_AvatarData, _PREHASH_Position, agent_pos);
- agent_movement_complete(msg->getSender(), agent_pos);
-}
-*/
-
-void process_agent_movement_complete(LLMessageSystem* msg, void**)
-{
- gAgentMovementCompleted = true;
-
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
- {
- LL_WARNS("Messaging") << "Incorrect id in process_agent_movement_complete()"
- << LL_ENDL;
- return;
- }
-
- LL_DEBUGS("Messaging") << "process_agent_movement_complete()" << LL_ENDL;
-
- // *TODO: check timestamp to make sure the movement compleation
- // makes sense.
- LLVector3 agent_pos;
- msg->getVector3Fast(_PREHASH_Data, _PREHASH_Position, agent_pos);
- LLVector3 look_at;
- msg->getVector3Fast(_PREHASH_Data, _PREHASH_LookAt, look_at);
- U64 region_handle;
- msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle);
-
- std::string version_channel;
- msg->getString("SimData", "ChannelVersion", version_channel);
-
- if (!isAgentAvatarValid())
- {
- // Could happen if you were immediately god-teleported away on login,
- // maybe other cases. Continue, but warn.
- LL_WARNS("Messaging") << "agent_movement_complete() with NULL avatarp." << LL_ENDL;
- }
-
- F32 x, y;
- from_region_handle(region_handle, &x, &y);
- LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle);
- if (!regionp)
- {
- if (gAgent.getRegion())
- {
- LL_WARNS("Messaging") << "current region " << gAgent.getRegion()->getOriginGlobal() << LL_ENDL;
- }
-
- LL_WARNS("Messaging") << "Agent being sent to invalid home region: "
- << x << ":" << y
- << " current pos " << gAgent.getPositionGlobal()
- << LL_ENDL;
- LLAppViewer::instance()->forceDisconnect(LLTrans::getString("SentToInvalidRegion"));
- return;
-
- }
-
- LL_INFOS("Messaging") << "Changing home region to " << x << ":" << y << LL_ENDL;
-
- // set our upstream host the new simulator and shuffle things as
- // appropriate.
- LLVector3 shift_vector = regionp->getPosRegionFromGlobal(
- gAgent.getRegion()->getOriginGlobal());
- gAgent.setRegion(regionp);
- gObjectList.shiftObjects(shift_vector);
- gAssetStorage->setUpstream(msg->getSender());
- gCacheName->setUpstream(msg->getSender());
- gViewerThrottle.sendToSim();
- gViewerWindow->sendShapeToSim();
-
- bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING;
-
- if( is_teleport )
- {
- if (gAgent.getTeleportKeepsLookAt())
- {
- // *NOTE: the LookAt data we get from the sim here doesn't
- // seem to be useful, so get it from the camera instead
- look_at = LLViewerCamera::getInstance()->getAtAxis();
- }
- // Force the camera back onto the agent, don't animate.
- gAgentCamera.setFocusOnAvatar(TRUE, FALSE);
- gAgentCamera.slamLookAt(look_at);
- gAgentCamera.updateCamera();
-
- gAgent.setTeleportState( LLAgent::TELEPORT_START_ARRIVAL );
-
- // set the appearance on teleport since the new sim does not
- // know what you look like.
- gAgent.sendAgentSetAppearance();
-
- if (isAgentAvatarValid())
- {
- // Chat the "back" SLURL. (DEV-4907)
-
- LLSLURL slurl;
- gAgent.getTeleportSourceSLURL(slurl);
- LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString());
- std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"];
- LLStringUtil::format(completed_from, substitution);
-
- LLSD args;
- args["MESSAGE"] = completed_from;
- LLNotificationsUtil::add("SystemMessageTip", args);
-
- // Set the new position
- gAgentAvatarp->setPositionAgent(agent_pos);
- gAgentAvatarp->clearChat();
- gAgentAvatarp->slamPosition();
- }
- }
- else
- {
- // This is initial log-in or a region crossing
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
-
- if(LLStartUp::getStartupState() < STATE_STARTED)
- { // This is initial log-in, not a region crossing:
- // Set the camera looking ahead of the AV so send_agent_update() below
- // will report the correct location to the server.
- LLVector3 look_at_point = look_at;
- look_at_point = agent_pos + look_at_point.rotVec(gAgent.getQuat());
-
- static LLVector3 up_direction(0.0f, 0.0f, 1.0f);
- LLViewerCamera::getInstance()->lookAt(agent_pos, look_at_point, up_direction);
- }
- }
-
- if ( LLTracker::isTracking(NULL) )
- {
- // Check distance to beacon, if < 5m, remove beacon
- LLVector3d beacon_pos = LLTracker::getTrackedPositionGlobal();
- LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0);
- if (beacon_dir.magVecSquared() < 25.f)
- {
- LLTracker::stopTracking(NULL);
- }
- else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() )
- {
- //look at the beacon
- LLVector3 global_agent_pos = agent_pos;
- global_agent_pos[0] += x;
- global_agent_pos[1] += y;
- look_at = (LLVector3)beacon_pos - global_agent_pos;
- look_at.normVec();
- gAgentCamera.slamLookAt(look_at);
- }
- }
-
- // TODO: Put back a check for flying status! DK 12/19/05
- // Sim tells us whether the new position is off the ground
- /*
- if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
- {
- gAgent.setFlying(TRUE);
- }
- else
- {
- gAgent.setFlying(FALSE);
- }
- */
-
- send_agent_update(TRUE, TRUE);
-
- if (gAgent.getRegion()->getBlockFly())
- {
- gAgent.setFlying(gAgent.canFly());
- }
-
- // force simulator to recognize busy state
- if (gAgent.getBusy())
- {
- gAgent.setBusy();
- }
- else
- {
- gAgent.clearBusy();
- }
-
- if (isAgentAvatarValid())
- {
- gAgentAvatarp->mFootPlane.clearVec();
- }
-
- // send walk-vs-run status
- gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun());
-
- // If the server version has changed, display an info box and offer
- // to display the release notes, unless this is the initial log in.
- if (gLastVersionChannel == version_channel)
- {
- return;
- }
-
- gLastVersionChannel = version_channel;
-}
-
-void process_crossed_region(LLMessageSystem* msg, void**)
-{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id))
- {
- LL_WARNS("Messaging") << "Incorrect id in process_crossed_region()"
- << LL_ENDL;
- return;
- }
- LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL;
- gAgentAvatarp->resetRegionCrossingTimer();
-
- U32 sim_ip;
- msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip);
- U16 sim_port;
- msg->getIPPortFast(_PREHASH_RegionData, _PREHASH_SimPort, sim_port);
- LLHost sim_host(sim_ip, sim_port);
- U64 region_handle;
- msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
-
- std::string seedCap;
- msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap);
-
- send_complete_agent_movement(sim_host);
-
- LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host);
- regionp->setSeedCapability(seedCap);
-}
-
-
-
-// Sends avatar and camera information to simulator.
-// Sent roughly once per frame, or 20 times per second, whichever is less often
-
-const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less than this we need to update head_rot
-const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot
- // between these values we delay the updates (but no more than one second)
-
-static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE_SEND("Send Message");
-
-void send_agent_update(BOOL force_send, BOOL send_reliable)
-{
- if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE)
- {
- // We don't care if they want to send an agent update, they're not allowed to until the simulator
- // that's the target is ready to receive them (after avatar_init_complete is received)
- return;
- }
-
- // We have already requested to log out. Don't send agent updates.
- if(LLAppViewer::instance()->logoutRequestSent())
- {
- return;
- }
-
- // no region to send update to
- if(gAgent.getRegion() == NULL)
- {
- return;
- }
-
- const F32 TRANSLATE_THRESHOLD = 0.01f;
-
- // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation
- // Plus, there is an extra 0.5 in the mix since the perpendicular between last_camera_at and getAtAxis() bisects cam_rot_change
- // Thus, we're actually testing against 0.2 degrees
- const F32 ROTATION_THRESHOLD = 0.1f * 2.f*F_PI/360.f; // Rotation thresh 0.2 deg, see note above
-
- const U8 DUP_MSGS = 1; // HACK! number of times to repeat data on motionless agent
-
- // Store data on last sent update so that if no changes, no send
- static LLVector3 last_camera_pos_agent,
- last_camera_at,
- last_camera_left,
- last_camera_up;
-
- static LLVector3 cam_center_chg,
- cam_rot_chg;
-
- static LLQuaternion last_head_rot;
- static U32 last_control_flags = 0;
- static U8 last_render_state;
- static U8 duplicate_count = 0;
- static F32 head_rot_chg = 1.0;
- static U8 last_flags;
-
- LLMessageSystem *msg = gMessageSystem;
- LLVector3 camera_pos_agent; // local to avatar's region
- U8 render_state;
-
- LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion();
- LLQuaternion head_rotation = gAgent.getHeadRotation();
-
- camera_pos_agent = gAgentCamera.getCameraPositionAgent();
-
- render_state = gAgent.getRenderState();
-
- U32 control_flag_change = 0;
- U8 flag_change = 0;
-
- cam_center_chg = last_camera_pos_agent - camera_pos_agent;
- cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis();
-
- // If a modifier key is held down, turn off
- // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't
- // trigger a control event.
- U32 control_flags = gAgent.getControlFlags();
- MASK key_mask = gKeyboard->currentMask(TRUE);
- if (key_mask & MASK_ALT || key_mask & MASK_CONTROL)
- {
- control_flags &= ~( AGENT_CONTROL_LBUTTON_DOWN |
- AGENT_CONTROL_ML_LBUTTON_DOWN );
- control_flags |= AGENT_CONTROL_LBUTTON_UP |
- AGENT_CONTROL_ML_LBUTTON_UP ;
- }
-
- control_flag_change = last_control_flags ^ control_flags;
-
- U8 flags = AU_FLAGS_NONE;
- if (gAgent.isGroupTitleHidden())
- {
- flags |= AU_FLAGS_HIDETITLE;
- }
- if (gAgent.getAutoPilot())
- {
- flags |= AU_FLAGS_CLIENT_AUTOPILOT;
- }
-
- flag_change = last_flags ^ flags;
-
- head_rot_chg = dot(last_head_rot, head_rotation);
-
- if (force_send ||
- (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) ||
- (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) ||
- (last_render_state != render_state) ||
- (cam_rot_chg.magVec() > ROTATION_THRESHOLD) ||
- control_flag_change != 0 ||
- flag_change != 0)
- {
-/*
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT)
- {
- //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL;
- LL_INFOS("Messaging") << "head_rot_chg = " << head_rot_chg << LL_ENDL;
- }
- if (cam_rot_chg.magVec() > ROTATION_THRESHOLD)
- {
- LL_INFOS("Messaging") << "cam rot " << cam_rot_chg.magVec() << LL_ENDL;
- }
- if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD)
- {
- LL_INFOS("Messaging") << "cam center " << cam_center_chg.magVec() << LL_ENDL;
- }
-// if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD)
-// {
-// LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL;
-// }
- if (control_flag_change)
- {
- LL_INFOS("Messaging") << "dcf = " << control_flag_change << LL_ENDL;
- }
-*/
-
- duplicate_count = 0;
- }
- else
- {
- duplicate_count++;
-
- if (head_rot_chg < MAX_HEAD_ROT_QDOT && duplicate_count < AGENT_UPDATES_PER_SECOND)
- {
- // The head_rotation is sent for updating things like attached guns.
- // We only trigger a new update when head_rotation deviates beyond
- // some threshold from the last update, however this can break fine
- // adjustments when trying to aim an attached gun, so what we do here
- // (where we would normally skip sending an update when nothing has changed)
- // is gradually reduce the threshold to allow a better update to
- // eventually get sent... should update to within 0.5 degrees in less
- // than a second.
- if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT + (MAX_HEAD_ROT_QDOT - THRESHOLD_HEAD_ROT_QDOT) * duplicate_count / AGENT_UPDATES_PER_SECOND)
- {
- duplicate_count = 0;
- }
- else
- {
- return;
- }
- }
- else
- {
- return;
- }
- }
-
- if (duplicate_count < DUP_MSGS && !gDisconnected)
- {
- LLFastTimer t(FTM_AGENT_UPDATE_SEND);
- // Build the message
- msg->newMessageFast(_PREHASH_AgentUpdate);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->addQuatFast(_PREHASH_BodyRotation, body_rotation);
- msg->addQuatFast(_PREHASH_HeadRotation, head_rotation);
- msg->addU8Fast(_PREHASH_State, render_state);
- msg->addU8Fast(_PREHASH_Flags, flags);
-
-// if (camera_pos_agent.mV[VY] > 255.f)
-// {
-// LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL;
-// }
-
- msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent);
- msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis());
- msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis());
- msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis());
- msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance);
-
- msg->addU32Fast(_PREHASH_ControlFlags, control_flags);
-
- if (gDebugClicks)
- {
- if (control_flags & AGENT_CONTROL_LBUTTON_DOWN)
- {
- LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL;
- }
-
- if (control_flags & AGENT_CONTROL_LBUTTON_UP)
- {
- LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL;
- }
- }
-
- gAgent.enableControlFlagReset();
-
- if (!send_reliable)
- {
- gAgent.sendMessage();
- }
- else
- {
- gAgent.sendReliableMessage();
- }
-
-// LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL;
-
- // Copy the old data
- last_head_rot = head_rotation;
- last_render_state = render_state;
- last_camera_pos_agent = camera_pos_agent;
- last_camera_at = LLViewerCamera::getInstance()->getAtAxis();
- last_camera_left = LLViewerCamera::getInstance()->getLeftAxis();
- last_camera_up = LLViewerCamera::getInstance()->getUpAxis();
- last_control_flags = control_flags;
- last_flags = flags;
- }
-}
-
-
-
-// *TODO: Remove this dependency, or figure out a better way to handle
-// this hack.
-extern U32 gObjectBits;
-
-void process_object_update(LLMessageSystem *mesgsys, void **user_data)
-{
- LLMemType mt(LLMemType::MTYPE_OBJECT);
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
- }
- else
- {
- gObjectBits += mesgsys->getReceiveSize() * 8;
- }
-
- // Update the object...
- gObjectList.processObjectUpdate(mesgsys, user_data, OUT_FULL);
-}
-
-void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data)
-{
- LLMemType mt(LLMemType::MTYPE_OBJECT);
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
- }
- else
- {
- gObjectBits += mesgsys->getReceiveSize() * 8;
- }
-
- // Update the object...
- gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_FULL_COMPRESSED);
-}
-
-void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data)
-{
- LLMemType mt(LLMemType::MTYPE_OBJECT);
- // Update the data counters
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
- }
- else
- {
- gObjectBits += mesgsys->getReceiveSize() * 8;
- }
-
- // Update the object...
- gObjectList.processCachedObjectUpdate(mesgsys, user_data, OUT_FULL_CACHED);
-}
-
-
-void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_data)
-{
- LLMemType mt(LLMemType::MTYPE_OBJECT);
- if (mesgsys->getReceiveCompressedSize())
- {
- gObjectBits += mesgsys->getReceiveCompressedSize() * 8;
- }
- else
- {
- gObjectBits += mesgsys->getReceiveSize() * 8;
- }
-
- gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED);
-}
-
-static LLFastTimer::DeclareTimer FTM_PROCESS_OBJECTS("Process Objects");
-
-
-void process_kill_object(LLMessageSystem *mesgsys, void **user_data)
-{
- LLFastTimer t(FTM_PROCESS_OBJECTS);
-
- LLUUID id;
- U32 local_id;
- S32 i;
- S32 num_objects;
-
- num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData);
-
- for (i = 0; i < num_objects; i++)
- {
- mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i);
-
- LLViewerObjectList::getUUIDFromLocal(id,
- local_id,
- gMessageSystem->getSenderIP(),
- gMessageSystem->getSenderPort());
- if (id == LLUUID::null)
- {
- LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL;
- gObjectList.mNumUnknownKills++;
- continue;
- }
- else
- {
- LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL;
- }
-
- LLSelectMgr::getInstance()->removeObjectFromSelections(id);
-
- // ...don't kill the avatar
- if (!(id == gAgentID))
- {
- LLViewerObject *objectp = gObjectList.findObject(id);
- if (objectp)
- {
- // Display green bubble on kill
- if ( gShowObjectUpdates )
- {
- LLViewerObject* newobject;
- newobject = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, objectp->getRegion());
-
- LLVOTextBubble* bubble = (LLVOTextBubble*) newobject;
-
- bubble->mColor.setVec(0.f, 1.f, 0.f, 1.f);
- bubble->setScale( 2.0f * bubble->getScale() );
- bubble->setPositionGlobal(objectp->getPositionGlobal());
- gPipeline.addObject(bubble);
- }
-
- // Do the kill
- gObjectList.killObject(objectp);
- }
- else
- {
- LL_WARNS("Messaging") << "Object in UUID lookup, but not on object list in kill!" << LL_ENDL;
- gObjectList.mNumUnknownKills++;
- }
- }
- }
-}
-
-void process_time_synch(LLMessageSystem *mesgsys, void **user_data)
-{
- LLVector3 sun_direction;
- LLVector3 sun_ang_velocity;
- F32 phase;
- U64 space_time_usec;
-
- U32 seconds_per_day;
- U32 seconds_per_year;
-
- // "SimulatorViewerTimeMessage"
- mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec);
- mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, seconds_per_day);
- mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, seconds_per_year);
-
- // This should eventually be moved to an "UpdateHeavenlyBodies" message
- mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase);
- mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction);
- mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity);
-
- LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec);
-
- //LL_DEBUGS("Messaging") << "time_synch() - " << sun_direction << ", " << sun_ang_velocity
- // << ", " << phase << LL_ENDL;
-
- gSky.setSunPhase(phase);
- gSky.setSunTargetDirection(sun_direction, sun_ang_velocity);
- if (!gNoRender && !(gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || gSky.getOverrideSun()))
- {
- gSky.setSunDirection(sun_direction, sun_ang_velocity);
- }
-}
-
-void process_sound_trigger(LLMessageSystem *msg, void **)
-{
- if (!gAudiop) return;
-
- U64 region_handle = 0;
- F32 gain = 0;
- LLUUID sound_id;
- LLUUID owner_id;
- LLUUID object_id;
- LLUUID parent_id;
- LLVector3 pos_local;
-
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id);
- msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle);
- msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local);
- msg->getF32Fast(_PREHASH_SoundData, _PREHASH_Gain, gain);
-
- // adjust sound location to true global coords
- LLVector3d pos_global = from_region_handle(region_handle);
- pos_global.mdV[VX] += pos_local.mV[VX];
- pos_global.mdV[VY] += pos_local.mV[VY];
- pos_global.mdV[VZ] += pos_local.mV[VZ];
-
- // Don't play a trigger sound if you can't hear it due
- // to parcel "local audio only" settings.
- if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return;
-
- // Don't play sounds triggered by someone you muted.
- if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
-
- // Don't play sounds from an object you muted
- if (LLMuteList::getInstance()->isMuted(object_id)) return;
-
- // Don't play sounds from an object whose parent you muted
- if (parent_id.notNull()
- && LLMuteList::getInstance()->isMuted(parent_id))
- {
- return;
- }
-
- // Don't play sounds from a region with maturity above current agent maturity
- if( !gAgent.canAccessMaturityInRegion( region_handle ) )
- {
- return;
- }
-
- gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global);
-}
-
-void process_preload_sound(LLMessageSystem *msg, void **user_data)
-{
- if (!gAudiop)
- {
- return;
- }
-
- LLUUID sound_id;
- LLUUID object_id;
- LLUUID owner_id;
-
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
-
- LLViewerObject *objectp = gObjectList.findObject(object_id);
- if (!objectp) return;
-
- if (LLMuteList::getInstance()->isMuted(object_id)) return;
- if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
-
- LLAudioSource *sourcep = objectp->getAudioSource(owner_id);
- if (!sourcep) return;
-
- LLAudioData *datap = gAudiop->getAudioData(sound_id);
-
- // Note that I don't actually do any loading of the
- // audio data into a buffer at this point, as it won't actually
- // help us out.
-
- // Don't play sounds from a region with maturity above current agent maturity
- LLVector3d pos_global = objectp->getPositionGlobal();
- if (gAgent.canAccessMaturityAtGlobal(pos_global))
- {
- // Add audioData starts a transfer internally.
- sourcep->addAudioData(datap, FALSE);
-}
-}
-
-void process_attached_sound(LLMessageSystem *msg, void **user_data)
-{
- F32 gain = 0;
- LLUUID sound_id;
- LLUUID object_id;
- LLUUID owner_id;
- U8 flags;
-
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id);
- msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id);
- msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
- msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags);
-
- LLViewerObject *objectp = gObjectList.findObject(object_id);
- if (!objectp)
- {
- // we don't know about this object, just bail
- return;
- }
-
- if (LLMuteList::getInstance()->isMuted(object_id)) return;
-
- if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return;
-
-
- // Don't play sounds from a region with maturity above current agent maturity
- LLVector3d pos = objectp->getPositionGlobal();
- if( !gAgent.canAccessMaturityAtGlobal(pos) )
- {
- return;
- }
-
- objectp->setAttachedSound(sound_id, owner_id, gain, flags);
-}
-
-
-void process_attached_sound_gain_change(LLMessageSystem *mesgsys, void **user_data)
-{
- F32 gain = 0;
- LLUUID object_guid;
- LLViewerObject *objectp = NULL;
-
- mesgsys->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_guid);
-
- if (!((objectp = gObjectList.findObject(object_guid))))
- {
- // we don't know about this object, just bail
- return;
- }
-
- mesgsys->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain);
-
- objectp->adjustAudioGain(gain);
-}
-
-
-void process_health_message(LLMessageSystem *mesgsys, void **user_data)
-{
- F32 health;
-
- mesgsys->getF32Fast(_PREHASH_HealthData, _PREHASH_Health, health);
-
- if (gStatusBar)
- {
- gStatusBar->setHealth((S32)health);
- }
-}
-
-
-void process_sim_stats(LLMessageSystem *msg, void **user_data)
-{
- S32 count = msg->getNumberOfBlocks("Stat");
- for (S32 i = 0; i < count; ++i)
- {
- U32 stat_id;
- F32 stat_value;
- msg->getU32("Stat", "StatID", stat_id, i);
- msg->getF32("Stat", "StatValue", stat_value, i);
- switch (stat_id)
- {
- case LL_SIM_STAT_TIME_DILATION:
- LLViewerStats::getInstance()->mSimTimeDilation.addValue(stat_value);
- break;
- case LL_SIM_STAT_FPS:
- LLViewerStats::getInstance()->mSimFPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_PHYSFPS:
- LLViewerStats::getInstance()->mSimPhysicsFPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_AGENTUPS:
- LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_FRAMEMS:
- LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_NETMS:
- LLViewerStats::getInstance()->mSimNetMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMOTHERMS:
- LLViewerStats::getInstance()->mSimSimOtherMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMPHYSICSMS:
- LLViewerStats::getInstance()->mSimSimPhysicsMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_AGENTMS:
- LLViewerStats::getInstance()->mSimAgentMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_IMAGESMS:
- LLViewerStats::getInstance()->mSimImagesMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SCRIPTMS:
- LLViewerStats::getInstance()->mSimScriptMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_NUMTASKS:
- LLViewerStats::getInstance()->mSimObjects.addValue(stat_value);
- break;
- case LL_SIM_STAT_NUMTASKSACTIVE:
- LLViewerStats::getInstance()->mSimActiveObjects.addValue(stat_value);
- break;
- case LL_SIM_STAT_NUMAGENTMAIN:
- LLViewerStats::getInstance()->mSimMainAgents.addValue(stat_value);
- break;
- case LL_SIM_STAT_NUMAGENTCHILD:
- LLViewerStats::getInstance()->mSimChildAgents.addValue(stat_value);
- break;
- case LL_SIM_STAT_NUMSCRIPTSACTIVE:
- LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value);
- break;
- case LL_SIM_STAT_SCRIPT_EPS:
- LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_INPPS:
- LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_OUTPPS:
- LLViewerStats::getInstance()->mSimOutPPS.addValue(stat_value);
- break;
- case LL_SIM_STAT_PENDING_DOWNLOADS:
- LLViewerStats::getInstance()->mSimPendingDownloads.addValue(stat_value);
- break;
- case LL_SIM_STAT_PENDING_UPLOADS:
- LLViewerStats::getInstance()->mSimPendingUploads.addValue(stat_value);
- break;
- case LL_SIM_STAT_PENDING_LOCAL_UPLOADS:
- LLViewerStats::getInstance()->mSimPendingLocalUploads.addValue(stat_value);
- break;
- case LL_SIM_STAT_TOTAL_UNACKED_BYTES:
- LLViewerStats::getInstance()->mSimTotalUnackedBytes.addValue(stat_value / 1024.f);
- break;
- case LL_SIM_STAT_PHYSICS_PINNED_TASKS:
- LLViewerStats::getInstance()->mPhysicsPinnedTasks.addValue(stat_value);
- break;
- case LL_SIM_STAT_PHYSICS_LOD_TASKS:
- LLViewerStats::getInstance()->mPhysicsLODTasks.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMPHYSICSSTEPMS:
- LLViewerStats::getInstance()->mSimSimPhysicsStepMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMPHYSICSSHAPEMS:
- LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMPHYSICSOTHERMS:
- LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMPHYSICSMEMORY:
- LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMSPARETIME:
- LLViewerStats::getInstance()->mSimSpareMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_SIMSLEEPTIME:
- LLViewerStats::getInstance()->mSimSleepMsec.addValue(stat_value);
- break;
- case LL_SIM_STAT_IOPUMPTIME:
- LLViewerStats::getInstance()->mSimPumpIOMsec.addValue(stat_value);
- break;
- default:
- // Used to be a commented out warning.
- LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL;
- break;
- }
- }
-
- /*
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation);
- LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation);
-
- // Process information
- // { CpuUsage F32 }
- // { SimMemTotal F32 }
- // { SimMemRSS F32 }
- // { ProcessUptime F32 }
- F32 cpu_usage;
- F32 sim_mem_total;
- F32 sim_mem_rss;
- F32 process_uptime;
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_CpuUsage, cpu_usage);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss);
- msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime);
- LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage);
- LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total);
- LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss);
- */
-
- //
- // Various hacks that aren't statistics, but are being handled here.
- //
- U32 max_tasks_per_region;
- U32 region_flags;
- msg->getU32("Region", "ObjectCapacity", max_tasks_per_region);
- msg->getU32("Region", "RegionFlags", region_flags);
-
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- BOOL was_flying = gAgent.getFlying();
- regionp->setRegionFlags(region_flags);
- regionp->setMaxTasks(max_tasks_per_region);
- // HACK: This makes agents drop from the sky if the region is
- // set to no fly while people are still in the sim.
- if (was_flying && regionp->getBlockFly())
- {
- gAgent.setFlying(gAgent.canFly());
- }
- }
-}
-
-
-
-void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
-{
- LLUUID animation_id;
- LLUUID uuid;
- S32 anim_sequence_id;
- LLVOAvatar *avatarp;
-
- mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
-
- //clear animation flags
- avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
-
- if (!avatarp)
- {
- // no agent by this ID...error?
- LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL;
- return;
- }
-
- S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList);
- S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList);
-
- avatarp->mSignaledAnimations.clear();
-
- if (avatarp->isSelf())
- {
- LLUUID object_id;
-
- for( S32 i = 0; i < num_blocks; i++ )
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
- mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
-
- LL_DEBUGS("Messaging") << "Anim sequence ID: " << anim_sequence_id << LL_ENDL;
-
- avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
-
- // *HACK: Disabling flying mode if it has been enabled shortly before the agent
- // stand up animation is signaled. In this case we don't get a signal to start
- // flying animation from server, the AGENT_CONTROL_FLY flag remains set but the
- // avatar does not play flying animation, so we switch flying mode off.
- // See LLAgent::setFlying(). This may cause "Stop Flying" button to blink.
- // See EXT-2781.
- if (animation_id == ANIM_AGENT_STANDUP && gAgent.getFlying())
- {
- gAgent.setFlying(FALSE);
- }
-
- if (i < num_source_blocks)
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationSourceList, _PREHASH_ObjectID, object_id, i);
-
- LLViewerObject* object = gObjectList.findObject(object_id);
- if (object)
- {
- object->mFlags |= FLAGS_ANIM_SOURCE;
-
- BOOL anim_found = FALSE;
- LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id);
- for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it)
- {
- if (anim_it->second == animation_id)
- {
- anim_found = TRUE;
- break;
- }
- }
-
- if (!anim_found)
- {
- avatarp->mAnimationSources.insert(LLVOAvatar::AnimationSourceMap::value_type(object_id, animation_id));
- }
- }
- }
- }
- }
- else
- {
- for( S32 i = 0; i < num_blocks; i++ )
- {
- mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i);
- mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i);
- avatarp->mSignaledAnimations[animation_id] = anim_sequence_id;
- }
- }
-
- if (num_blocks)
- {
- avatarp->processAnimationStateChanges();
- }
-}
-
-void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data)
-{
- LLUUID uuid;
- mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
-
- LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
- if (avatarp)
- {
- avatarp->processAvatarAppearance( mesgsys );
- }
- else
- {
- LL_WARNS("Messaging") << "avatar_appearance sent for unknown avatar " << uuid << LL_ENDL;
- }
-}
-
-void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data)
-{
- LLVector4 cameraCollidePlane;
- mesgsys->getVector4Fast(_PREHASH_CameraCollidePlane, _PREHASH_Plane, cameraCollidePlane);
-
- gAgentCamera.setCameraCollidePlane(cameraCollidePlane);
-}
-
-void near_sit_object(BOOL success, void *data)
-{
- if (success)
- {
- // Send message to sit on object
- gMessageSystem->newMessageFast(_PREHASH_AgentSit);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gAgent.sendReliableMessage();
- }
-}
-
-void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
-{
- LLVector3 sitPosition;
- LLQuaternion sitRotation;
- LLUUID sitObjectID;
- BOOL use_autopilot;
- mesgsys->getUUIDFast(_PREHASH_SitObject, _PREHASH_ID, sitObjectID);
- mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_AutoPilot, use_autopilot);
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_SitPosition, sitPosition);
- mesgsys->getQuatFast(_PREHASH_SitTransform, _PREHASH_SitRotation, sitRotation);
- LLVector3 camera_eye;
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraEyeOffset, camera_eye);
- LLVector3 camera_at;
- mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraAtOffset, camera_at);
- BOOL force_mouselook;
- mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
-
- if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
- {
- gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
- }
-
- gAgentCamera.setForceMouselook(force_mouselook);
- // Forcing turning off flying here to prevent flying after pressing "Stand"
- // to stand up from an object. See EXT-1655.
- gAgent.setFlying(FALSE);
-
- LLViewerObject* object = gObjectList.findObject(sitObjectID);
- if (object)
- {
- LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
- if (!use_autopilot || isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot())
- {
- //we're already sitting on this object, so don't autopilot
- }
- else
- {
- gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(sit_spot), "Sit", &sitRotation, near_sit_object, NULL, 0.5f);
- }
- }
- else
- {
- LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL;
- }
-}
-
-void process_clear_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data)
-{
- LLUUID source_id;
-
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
-
- LLFollowCamMgr::removeFollowCamParams(source_id);
-}
-
-void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data)
-{
- S32 type;
- F32 value;
- bool settingPosition = false;
- bool settingFocus = false;
- bool settingFocusOffset = false;
- LLVector3 position;
- LLVector3 focus;
- LLVector3 focus_offset;
-
- LLUUID source_id;
-
- mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id);
-
- LLViewerObject* objectp = gObjectList.findObject(source_id);
- if (objectp)
- {
- objectp->mFlags |= FLAGS_CAMERA_SOURCE;
- }
-
- S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty");
- for (S32 block_index = 0; block_index < num_objects; block_index++)
- {
- mesgsys->getS32("CameraProperty", "Type", type, block_index);
- mesgsys->getF32("CameraProperty", "Value", value, block_index);
- switch(type)
- {
- case FOLLOWCAM_PITCH:
- LLFollowCamMgr::setPitch(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_OFFSET_X:
- focus_offset.mV[VX] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_FOCUS_OFFSET_Y:
- focus_offset.mV[VY] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_FOCUS_OFFSET_Z:
- focus_offset.mV[VZ] = value;
- settingFocusOffset = true;
- break;
- case FOLLOWCAM_POSITION_LAG:
- LLFollowCamMgr::setPositionLag(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_LAG:
- LLFollowCamMgr::setFocusLag(source_id, value);
- break;
- case FOLLOWCAM_DISTANCE:
- LLFollowCamMgr::setDistance(source_id, value);
- break;
- case FOLLOWCAM_BEHINDNESS_ANGLE:
- LLFollowCamMgr::setBehindnessAngle(source_id, value);
- break;
- case FOLLOWCAM_BEHINDNESS_LAG:
- LLFollowCamMgr::setBehindnessLag(source_id, value);
- break;
- case FOLLOWCAM_POSITION_THRESHOLD:
- LLFollowCamMgr::setPositionThreshold(source_id, value);
- break;
- case FOLLOWCAM_FOCUS_THRESHOLD:
- LLFollowCamMgr::setFocusThreshold(source_id, value);
- break;
- case FOLLOWCAM_ACTIVE:
- //if 1, set using followcam,.
- LLFollowCamMgr::setCameraActive(source_id, value != 0.f);
- break;
- case FOLLOWCAM_POSITION_X:
- settingPosition = true;
- position.mV[ 0 ] = value;
- break;
- case FOLLOWCAM_POSITION_Y:
- settingPosition = true;
- position.mV[ 1 ] = value;
- break;
- case FOLLOWCAM_POSITION_Z:
- settingPosition = true;
- position.mV[ 2 ] = value;
- break;
- case FOLLOWCAM_FOCUS_X:
- settingFocus = true;
- focus.mV[ 0 ] = value;
- break;
- case FOLLOWCAM_FOCUS_Y:
- settingFocus = true;
- focus.mV[ 1 ] = value;
- break;
- case FOLLOWCAM_FOCUS_Z:
- settingFocus = true;
- focus.mV[ 2 ] = value;
- break;
- case FOLLOWCAM_POSITION_LOCKED:
- LLFollowCamMgr::setPositionLocked(source_id, value != 0.f);
- break;
- case FOLLOWCAM_FOCUS_LOCKED:
- LLFollowCamMgr::setFocusLocked(source_id, value != 0.f);
- break;
-
- default:
- break;
- }
- }
-
- if ( settingPosition )
- {
- LLFollowCamMgr::setPosition(source_id, position);
- }
- if ( settingFocus )
- {
- LLFollowCamMgr::setFocus(source_id, focus);
- }
- if ( settingFocusOffset )
- {
- LLFollowCamMgr::setFocusOffset(source_id, focus_offset);
- }
-}
-//end Ventrella
-
-
-// Culled from newsim lltask.cpp
-void process_name_value(LLMessageSystem *mesgsys, void **user_data)
-{
- std::string temp_str;
- LLUUID id;
- S32 i, num_blocks;
-
- mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
-
- LLViewerObject* object = gObjectList.findObject(id);
-
- if (object)
- {
- num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
- for (i = 0; i < num_blocks; i++)
- {
- mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
- LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL;
- object->addNVPair(temp_str);
- }
- }
- else
- {
- LL_INFOS("Messaging") << "Can't find object " << id << " to add name value pair" << LL_ENDL;
- }
-}
-
-void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data)
-{
- std::string temp_str;
- LLUUID id;
- S32 i, num_blocks;
-
- mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id);
-
- LLViewerObject* object = gObjectList.findObject(id);
-
- if (object)
- {
- num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData);
- for (i = 0; i < num_blocks; i++)
- {
- mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i);
- LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL;
- object->removeNVPair(temp_str);
- }
- }
- else
- {
- LL_INFOS("Messaging") << "Can't find object " << id << " to remove name value pair" << LL_ENDL;
- }
-}
-
-void process_kick_user(LLMessageSystem *msg, void** /*user_data*/)
-{
- std::string message;
-
- msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message);
-
- LLAppViewer::instance()->forceDisconnect(message);
-}
-
-
-/*
-void process_user_list_reply(LLMessageSystem *msg, void **user_data)
-{
- LLUserList::processUserListReply(msg, user_data);
- return;
- char firstname[MAX_STRING+1];
- char lastname[MAX_STRING+1];
- U8 status;
- S32 user_count;
-
- user_count = msg->getNumberOfBlocks("UserBlock");
-
- for (S32 i = 0; i < user_count; i++)
- {
- msg->getData("UserBlock", i, "FirstName", firstname);
- msg->getData("UserBlock", i, "LastName", lastname);
- msg->getData("UserBlock", i, "Status", &status);
-
- if (status & 0x01)
- {
- dialog_friends_add_friend(buffer, TRUE);
- }
- else
- {
- dialog_friends_add_friend(buffer, FALSE);
- }
- }
-
- dialog_friends_done_adding();
-}
-*/
-
-// this is not handled in processUpdateMessage
-/*
-void process_time_dilation(LLMessageSystem *msg, void **user_data)
-{
- // get the time_dilation
- U16 foo;
- msg->getData("TimeDilation", "TimeDilation", &foo);
- F32 time_dilation = ((F32) foo) / 65535.f;
-
- // get the pointer to the right region
- U32 ip = msg->getSenderIP();
- U32 port = msg->getSenderPort();
- LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port);
- if (regionp)
- {
- regionp->setTimeDilation(time_dilation);
- }
-}
-*/
-
-
-void process_money_balance_reply( LLMessageSystem* msg, void** )
-{
- S32 balance = 0;
- S32 credit = 0;
- S32 committed = 0;
- std::string desc;
- LLUUID tid;
-
- msg->getUUID("MoneyData", "TransactionID", tid);
- msg->getS32("MoneyData", "MoneyBalance", balance);
- msg->getS32("MoneyData", "SquareMetersCredit", credit);
- msg->getS32("MoneyData", "SquareMetersCommitted", committed);
- msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc);
- LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " "
- << committed << LL_ENDL;
-
- if (gStatusBar)
- {
- gStatusBar->setBalance(balance);
- gStatusBar->setLandCredit(credit);
- gStatusBar->setLandCommitted(committed);
- }
-
- if (desc.empty()
- || !gSavedSettings.getBOOL("NotifyMoneyChange"))
- {
- // ...nothing to display
- return;
- }
-
- // Suppress duplicate messages about the same transaction
- static std::deque<LLUUID> recent;
- if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend())
- {
- return;
- }
-
- // Once the 'recent' container gets large enough, chop some
- // off the beginning.
- const U32 MAX_LOOKBACK = 30;
- const S32 POP_FRONT_SIZE = 12;
- if(recent.size() > MAX_LOOKBACK)
- {
- LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL;
- recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE);
- }
- //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL;
- recent.push_back(tid);
-
- if (msg->has("TransactionInfo"))
- {
- // ...message has extended info for localization
- process_money_balance_reply_extended(msg);
- }
- else
- {
- // Only old dev grids will not supply the TransactionInfo block,
- // so we can just use the hard-coded English string.
- LLSD args;
- args["MESSAGE"] = desc;
- LLNotificationsUtil::add("SystemMessage", args);
- }
-}
-
-static std::string reason_from_transaction_type(S32 transaction_type,
- const std::string& item_desc)
-{
- // *NOTE: The keys for the reason strings are unusual because
- // an earlier version of the code used English language strings
- // extracted from hard-coded server English descriptions.
- // Keeping them so we don't have to re-localize them.
- switch (transaction_type)
- {
- case TRANS_OBJECT_SALE:
- {
- LLStringUtil::format_map_t arg;
- arg["ITEM"] = item_desc;
- return LLTrans::getString("for item", arg);
- }
- case TRANS_LAND_SALE:
- return LLTrans::getString("for a parcel of land");
-
- case TRANS_LAND_PASS_SALE:
- return LLTrans::getString("for a land access pass");
-
- case TRANS_GROUP_LAND_DEED:
- return LLTrans::getString("for deeding land");
-
- case TRANS_GROUP_CREATE:
- return LLTrans::getString("to create a group");
-
- case TRANS_GROUP_JOIN:
- return LLTrans::getString("to join a group");
-
- case TRANS_UPLOAD_CHARGE:
- return LLTrans::getString("to upload");
-
- case TRANS_CLASSIFIED_CHARGE:
- return LLTrans::getString("to publish a classified ad");
-
- // These have no reason to display, but are expected and should not
- // generate warnings
- case TRANS_GIFT:
- case TRANS_PAY_OBJECT:
- case TRANS_OBJECT_PAYS:
- return std::string();
-
- default:
- llwarns << "Unknown transaction type "
- << transaction_type << llendl;
- return std::string();
- }
-}
-
-static void money_balance_group_notify(const LLUUID& group_id,
- const std::string& name,
- bool is_group,
- std::string notification,
- LLSD args,
- LLSD payload)
-{
- // Message uses name SLURLs, don't actually have to substitute in
- // the name. We're just making sure it's available.
- // Notification is either PaymentReceived or PaymentSent
- LLNotificationsUtil::add(notification, args, payload);
-}
-
-static void money_balance_avatar_notify(const LLUUID& agent_id,
- const LLAvatarName& av_name,
- std::string notification,
- LLSD args,
- LLSD payload)
-{
- // Message uses name SLURLs, don't actually have to substitute in
- // the name. We're just making sure it's available.
- // Notification is either PaymentReceived or PaymentSent
- LLNotificationsUtil::add(notification, args, payload);
-}
-
-static void process_money_balance_reply_extended(LLMessageSystem* msg)
-{
- // Added in server 1.40 and viewer 2.1, support for localization
- // and agent ids for name lookup.
- S32 transaction_type = 0;
- LLUUID source_id;
- BOOL is_source_group = FALSE;
- LLUUID dest_id;
- BOOL is_dest_group = FALSE;
- S32 amount = 0;
- std::string item_description;
-
- msg->getS32("TransactionInfo", "TransactionType", transaction_type);
- msg->getUUID("TransactionInfo", "SourceID", source_id);
- msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group);
- msg->getUUID("TransactionInfo", "DestID", dest_id);
- msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group);
- msg->getS32("TransactionInfo", "Amount", amount);
- msg->getString("TransactionInfo", "ItemDescription", item_description);
- LL_INFOS("Money") << "MoneyBalanceReply source " << source_id
- << " dest " << dest_id
- << " type " << transaction_type
- << " item " << item_description << LL_ENDL;
-
- if (source_id.isNull() && dest_id.isNull())
- {
- // this is a pure balance update, no notification required
- return;
- }
-
- std::string source_slurl;
- if (is_source_group)
- {
- source_slurl =
- LLSLURL( "group", source_id, "inspect").getSLURLString();
- }
- else
- {
- source_slurl =
- LLSLURL( "agent", source_id, "completename").getSLURLString();
- }
-
- std::string dest_slurl;
- if (is_dest_group)
- {
- dest_slurl =
- LLSLURL( "group", dest_id, "inspect").getSLURLString();
- }
- else
- {
- dest_slurl =
- LLSLURL( "agent", dest_id, "completename").getSLURLString();
- }
-
- std::string reason =
- reason_from_transaction_type(transaction_type, item_description);
-
- LLStringUtil::format_map_t args;
- args["REASON"] = reason; // could be empty
- args["AMOUNT"] = llformat("%d", amount);
-
- // Need to delay until name looked up, so need to know whether or not
- // is group
- bool is_name_group = false;
- LLUUID name_id;
- std::string message;
- std::string notification;
- LLSD final_args;
- LLSD payload;
-
- bool you_paid_someone = (source_id == gAgentID);
- if (you_paid_someone)
- {
- args["NAME"] = dest_slurl;
- is_name_group = is_dest_group;
- name_id = dest_id;
- if (!reason.empty())
- {
- if (dest_id.notNull())
- {
- message = LLTrans::getString("you_paid_ldollars", args);
- }
- else
- {
- // transaction fee to the system, eg, to create a group
- message = LLTrans::getString("you_paid_ldollars_no_name", args);
- }
- }
- else
- {
- if (dest_id.notNull())
- {
- message = LLTrans::getString("you_paid_ldollars_no_reason", args);
- }
- else
- {
- // no target, no reason, you just paid money
- message = LLTrans::getString("you_paid_ldollars_no_info", args);
- }
- }
- final_args["MESSAGE"] = message;
- notification = "PaymentSent";
- }
- else {
- // ...someone paid you
- args["NAME"] = source_slurl;
- is_name_group = is_source_group;
- name_id = source_id;
- if (!reason.empty())
- {
- message = LLTrans::getString("paid_you_ldollars", args);
- }
- else {
- message = LLTrans::getString("paid_you_ldollars_no_reason", args);
- }
- final_args["MESSAGE"] = message;
-
- // make notification loggable
- payload["from_id"] = source_id;
- notification = "PaymentReceived";
- }
-
- // Despite using SLURLs, wait until the name is available before
- // showing the notification, otherwise the UI layout is strange and
- // the user sees a "Loading..." message
- if (is_name_group)
- {
- gCacheName->getGroup(name_id,
- boost::bind(&money_balance_group_notify,
- _1, _2, _3,
- notification, final_args, payload));
- }
- else {
- LLAvatarNameCache::get(name_id,
- boost::bind(&money_balance_avatar_notify,
- _1, _2,
- notification, final_args, payload));
- }
-}
-
-
-
-bool handle_special_notification_callback(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (0 == option)
- {
- // set the preference to the maturity of the region we're calling
- int preferredMaturity = notification["payload"]["_region_access"].asInteger();
- gSavedSettings.setU32("PreferredMaturity", preferredMaturity);
- gAgent.sendMaturityPreferenceToServer(preferredMaturity);
-
- // notify user that the maturity preference has been changed
- LLSD args;
- args["RATING"] = LLViewerRegion::accessToString(preferredMaturity);
- LLNotificationsUtil::add("PreferredMaturityChanged", args);
- }
-
- return false;
-}
-
-// some of the server notifications need special handling. This is where we do that.
-bool handle_special_notification(std::string notificationID, LLSD& llsdBlock)
-{
- int regionAccess = llsdBlock["_region_access"].asInteger();
- llsdBlock["REGIONMATURITY"] = LLViewerRegion::accessToString(regionAccess);
-
- // we're going to throw the LLSD in there in case anyone ever wants to use it
- LLNotificationsUtil::add(notificationID+"_Notify", llsdBlock);
-
- if (regionAccess == SIM_ACCESS_MATURE)
- {
- if (gAgent.isTeen())
- {
- LLNotificationsUtil::add(notificationID+"_KB", llsdBlock);
- return true;
- }
- else if (gAgent.prefersPG())
- {
- LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
- return true;
- }
- }
- else if (regionAccess == SIM_ACCESS_ADULT)
- {
- if (!gAgent.isAdult())
- {
- LLNotificationsUtil::add(notificationID+"_KB", llsdBlock);
- return true;
- }
- else if (gAgent.prefersPG() || gAgent.prefersMature())
- {
- LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback);
- return true;
- }
- }
- return false;
-}
-
-bool attempt_standard_notification(LLMessageSystem* msgsystem)
-{
- // if we have additional alert data
- if (msgsystem->has(_PREHASH_AlertInfo) && msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0)
- {
- // notification was specified using the new mechanism, so we can just handle it here
- std::string notificationID;
- std::string llsdRaw;
- LLSD llsdBlock;
- msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID);
- msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsdRaw);
- if (llsdRaw.length())
- {
- std::istringstream llsdData(llsdRaw);
- if (!LLSDSerialize::deserialize(llsdBlock, llsdData, llsdRaw.length()))
- {
- llwarns << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << llendl;
- }
- }
-
- if (
- (notificationID == "RegionEntryAccessBlocked") ||
- (notificationID == "LandClaimAccessBlocked") ||
- (notificationID == "LandBuyAccessBlocked")
- )
- {
- /*---------------------------------------------------------------------
- (Commented so a grep will find the notification strings, since
- we construct them on the fly; if you add additional notifications,
- please update the comment.)
-
- Could throw any of the following notifications:
-
- RegionEntryAccessBlocked
- RegionEntryAccessBlocked_Notify
- RegionEntryAccessBlocked_Change
- RegionEntryAccessBlocked_KB
- LandClaimAccessBlocked
- LandClaimAccessBlocked_Notify
- LandClaimAccessBlocked_Change
- LandClaimAccessBlocked_KB
- LandBuyAccessBlocked
- LandBuyAccessBlocked_Notify
- LandBuyAccessBlocked_Change
- LandBuyAccessBlocked_KB
-
- -----------------------------------------------------------------------*/
- if (handle_special_notification(notificationID, llsdBlock))
- {
- return true;
- }
- }
-
- LLNotificationsUtil::add(notificationID, llsdBlock);
- return true;
- }
- return false;
-}
-
-
-void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data)
-{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- if (!attempt_standard_notification(msgsystem))
- {
- BOOL modal = FALSE;
- msgsystem->getBOOL("AlertData", "Modal", modal);
- std::string buffer;
- msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer);
- process_alert_core(buffer, modal);
- }
-}
-
-// The only difference between this routine and the previous is the fact that
-// for this routine, the modal parameter is always false. Sadly, for the message
-// handled by this routine, there is no "Modal" parameter on the message, and
-// there's no API to tell if a message has the given parameter or not.
-// So we can't handle the messages with the same handler.
-void process_alert_message(LLMessageSystem *msgsystem, void **user_data)
-{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- if (!attempt_standard_notification(msgsystem))
- {
- BOOL modal = FALSE;
- std::string buffer;
- msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer);
- process_alert_core(buffer, modal);
- }
-}
-
-void process_alert_core(const std::string& message, BOOL modal)
-{
- // HACK -- handle callbacks for specific alerts. It also is localized in notifications.xml
- if ( message == "You died and have been teleported to your home location")
- {
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT);
- }
- else if( message == "Home position set." )
- {
- // save the home location image to disk
- std::string snap_filename = gDirUtilp->getLindenUserDir();
- snap_filename += gDirUtilp->getDirDelimiter();
- snap_filename += SCREEN_HOME_FILENAME;
- gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE);
- }
-
- const std::string ALERT_PREFIX("ALERT: ");
- const std::string NOTIFY_PREFIX("NOTIFY: ");
- if (message.find(ALERT_PREFIX) == 0)
- {
- // Allow the server to spawn a named alert so that server alerts can be
- // translated out of English.
- std::string alert_name(message.substr(ALERT_PREFIX.length()));
- LLNotificationsUtil::add(alert_name);
- }
- else if (message.find(NOTIFY_PREFIX) == 0)
- {
- // Allow the server to spawn a named notification so that server notifications can be
- // translated out of English.
- std::string notify_name(message.substr(NOTIFY_PREFIX.length()));
- LLNotificationsUtil::add(notify_name);
- }
- else if (message[0] == '/')
- {
- // System message is important, show in upper-right box not tip
- std::string text(message.substr(1));
- LLSD args;
- if (text.substr(0,17) == "RESTART_X_MINUTES")
- {
- S32 mins = 0;
- LLStringUtil::convertToS32(text.substr(18), mins);
- args["MINUTES"] = llformat("%d",mins);
- LLNotificationsUtil::add("RegionRestartMinutes", args);
- }
- else if (text.substr(0,17) == "RESTART_X_SECONDS")
- {
- S32 secs = 0;
- LLStringUtil::convertToS32(text.substr(18), secs);
- args["SECONDS"] = llformat("%d",secs);
- LLNotificationsUtil::add("RegionRestartSeconds", args);
- }
- else
- {
- std::string new_msg =LLNotifications::instance().getGlobalString(text);
- args["MESSAGE"] = new_msg;
- LLNotificationsUtil::add("SystemMessage", args);
- }
- }
- else if (modal)
- {
- LLSD args;
- std::string new_msg =LLNotifications::instance().getGlobalString(message);
- args["ERROR_MESSAGE"] = new_msg;
- LLNotificationsUtil::add("ErrorMessage", args);
- }
- else
- {
- LLSD args;
- std::string new_msg =LLNotifications::instance().getGlobalString(message);
- args["MESSAGE"] = new_msg;
- LLNotificationsUtil::add("SystemMessageTip", args);
- }
-}
-
-mean_collision_list_t gMeanCollisionList;
-time_t gLastDisplayedTime = 0;
-
-void handle_show_mean_events(void *)
-{
- if (gNoRender)
- {
- return;
- }
- LLFloaterReg::showInstance("bumps");
- //LLFloaterBump::showInstance();
-}
-
-void mean_name_callback(const LLUUID &id, const std::string& full_name, bool is_group)
-{
- if (gNoRender)
- {
- return;
- }
-
- static const U32 max_collision_list_size = 20;
- if (gMeanCollisionList.size() > max_collision_list_size)
- {
- mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- for (U32 i=0; i<max_collision_list_size; i++) iter++;
- for_each(iter, gMeanCollisionList.end(), DeletePointer());
- gMeanCollisionList.erase(iter, gMeanCollisionList.end());
- }
-
- for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- iter != gMeanCollisionList.end(); ++iter)
- {
- LLMeanCollisionData *mcd = *iter;
- if (mcd->mPerp == id)
- {
- mcd->mFullName = full_name;
- }
- }
-}
-
-void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **user_data)
-{
- if (gAgent.inPrelude())
- {
- // In prelude, bumping is OK. This dialog is rather confusing to
- // newbies, so we don't show it. Drop the packet on the floor.
- return;
- }
-
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
-
- LLUUID perp;
- U32 time;
- U8 u8type;
- EMeanCollisionType type;
- F32 mag;
-
- S32 i, num = msgsystem->getNumberOfBlocks(_PREHASH_MeanCollision);
-
- for (i = 0; i < num; i++)
- {
- msgsystem->getUUIDFast(_PREHASH_MeanCollision, _PREHASH_Perp, perp);
- msgsystem->getU32Fast(_PREHASH_MeanCollision, _PREHASH_Time, time);
- msgsystem->getF32Fast(_PREHASH_MeanCollision, _PREHASH_Mag, mag);
- msgsystem->getU8Fast(_PREHASH_MeanCollision, _PREHASH_Type, u8type);
-
- type = (EMeanCollisionType)u8type;
-
- BOOL b_found = FALSE;
-
- for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin();
- iter != gMeanCollisionList.end(); ++iter)
- {
- LLMeanCollisionData *mcd = *iter;
- if ((mcd->mPerp == perp) && (mcd->mType == type))
- {
- mcd->mTime = time;
- mcd->mMag = mag;
- b_found = TRUE;
- break;
- }
- }
-
- if (!b_found)
- {
- LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag);
- gMeanCollisionList.push_front(mcd);
- gCacheName->get(perp, false, boost::bind(&mean_name_callback, _1, _2, _3));
- }
- }
-}
-
-void process_frozen_message(LLMessageSystem *msgsystem, void **user_data)
-{
- // make sure the cursor is back to the usual default since the
- // alert is probably due to some kind of error.
- gViewerWindow->getWindow()->resetBusyCount();
- BOOL b_frozen;
-
- msgsystem->getBOOL("FrozenData", "Data", b_frozen);
-
- // TODO: make being frozen change view
- if (b_frozen)
- {
- }
- else
- {
- }
-}
-
-// do some extra stuff once we get our economy data
-void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
-{
- LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance());
-
- S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
-
- LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL;
-
- gMenuHolder->getChild<LLUICtrl>("Upload Image")->setLabelArg("[COST]", llformat("%d", upload_cost));
- gMenuHolder->getChild<LLUICtrl>("Upload Sound")->setLabelArg("[COST]", llformat("%d", upload_cost));
- gMenuHolder->getChild<LLUICtrl>("Upload Animation")->setLabelArg("[COST]", llformat("%d", upload_cost));
- gMenuHolder->getChild<LLUICtrl>("Bulk Upload")->setLabelArg("[COST]", llformat("%d", upload_cost));
-}
-
-void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted)
-{
- // only continue if at least some permissions were requested
- if (orig_questions)
- {
- // check to see if the person we are asking
-
- // "'[OBJECTNAME]', an object owned by '[OWNERNAME]',
- // located in [REGIONNAME] at [REGIONPOS],
- // has been <granted|denied> permission to: [PERMISSIONS]."
-
- LLUIString notice(LLTrans::getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied"));
-
- // always include the object name and owner name
- notice.setArg("[OBJECTNAME]", notification["payload"]["object_name"].asString());
- notice.setArg("[OWNERNAME]", notification["payload"]["owner_name"].asString());
-
- // try to lookup viewerobject that corresponds to the object that
- // requested permissions (here, taskid->requesting object id)
- BOOL foundpos = FALSE;
- LLViewerObject* viewobj = gObjectList.findObject(notification["payload"]["task_id"].asUUID());
- if (viewobj)
- {
- // found the viewerobject, get it's position in its region
- LLVector3 objpos(viewobj->getPosition());
-
- // try to lookup the name of the region the object is in
- LLViewerRegion* viewregion = viewobj->getRegion();
- if (viewregion)
- {
- // got the region, so include the region and 3d coordinates of the object
- notice.setArg("[REGIONNAME]", viewregion->getName());
- std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]);
- notice.setArg("[REGIONPOS]", formatpos);
-
- foundpos = TRUE;
- }
- }
-
- if (!foundpos)
- {
- // unable to determine location of the object
- notice.setArg("[REGIONNAME]", "(unknown region)");
- notice.setArg("[REGIONPOS]", "(unknown position)");
- }
-
- // check each permission that was requested, and list each
- // permission that has been flagged as a caution permission
- BOOL caution = FALSE;
- S32 count = 0;
- std::string perms;
- for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++)
- {
- if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && SCRIPT_QUESTION_IS_CAUTION[i])
- {
- count++;
- caution = TRUE;
-
- // add a comma before the permission description if it is not the first permission
- // added to the list or the last permission to check
- if ((count > 1) && (i < SCRIPT_PERMISSION_EOF))
- {
- perms.append(", ");
- }
-
- perms.append(LLTrans::getString(SCRIPT_QUESTIONS[i]));
- }
- }
-
- notice.setArg("[PERMISSIONS]", perms);
-
- // log a chat message as long as at least one requested permission
- // is a caution permission
- if (caution)
- {
- LLChat chat(notice.getString());
- // LLFloaterChat::addChat(chat, FALSE, FALSE);
- }
- }
-}
-
-bool script_question_cb(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- LLMessageSystem *msg = gMessageSystem;
- S32 orig = notification["payload"]["questions"].asInteger();
- S32 new_questions = orig;
-
- // check whether permissions were granted or denied
- BOOL allowed = TRUE;
- // the "yes/accept" button is the first button in the template, making it button 0
- // if any other button was clicked, the permissions were denied
- if (option != 0)
- {
- new_questions = 0;
- allowed = FALSE;
- }
-
- LLUUID task_id = notification["payload"]["task_id"].asUUID();
- LLUUID item_id = notification["payload"]["item_id"].asUUID();
-
- // reply with the permissions granted or denied
- msg->newMessageFast(_PREHASH_ScriptAnswerYes);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Data);
- msg->addUUIDFast(_PREHASH_TaskID, task_id);
- msg->addUUIDFast(_PREHASH_ItemID, item_id);
- msg->addS32Fast(_PREHASH_Questions, new_questions);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
-
- // only log a chat message if caution prompts are enabled
- if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
- {
- // log a chat message, if appropriate
- notify_cautioned_script_question(notification, response, orig, allowed);
- }
-
- if ( response["Mute"] ) // mute
- {
- LLMuteList::getInstance()->add(LLMute(item_id, notification["payload"]["object_name"].asString(), LLMute::OBJECT));
-
- // purge the message queue of any previously queued requests from the same source. DEV-4879
- class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher
- {
- public:
- OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {}
- bool matches(const LLNotificationPtr notification) const
- {
- if (notification->getName() == "ScriptQuestionCaution"
- || notification->getName() == "ScriptQuestion")
- {
- return (notification->getPayload()["item_id"].asUUID() == blocked_id);
- }
- return false;
- }
- private:
- const LLUUID& blocked_id;
- };
-
- LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID(
- gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(item_id));
- }
-
- if (response["Details"])
- {
- // respawn notification...
- LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]);
-
- // ...with description on top
- LLNotificationsUtil::add("DebitPermissionDetails");
- }
- return false;
-}
-static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb);
-static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb);
-
-void process_script_question(LLMessageSystem *msg, void **user_data)
-{
- // *TODO: Translate owner name -> [FIRST] [LAST]
-
- LLHost sender = msg->getSender();
-
- LLUUID taskid;
- LLUUID itemid;
- S32 questions;
- std::string object_name;
- std::string owner_name;
-
- // taskid -> object key of object requesting permissions
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid );
- // itemid -> script asset key of script requesting permissions
- msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid );
- msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name);
- msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name);
- msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions );
-
- // Special case. If the objects are owned by this agent, throttle per-object instead
- // of per-owner. It's common for residents to reset a ton of scripts that re-request
- // permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa,
- // so we'll reuse the same namespace for both throttle types.
- std::string throttle_name = owner_name;
- std::string self_name;
- LLAgentUI::buildFullname( self_name );
- if( owner_name == self_name )
- {
- throttle_name = taskid.getString();
- }
-
- // don't display permission requests if this object is muted
- if (LLMuteList::getInstance()->isMuted(taskid)) return;
-
- // throttle excessive requests from any specific user's scripts
- typedef LLKeyThrottle<std::string> LLStringThrottle;
- static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL );
-
- switch (question_throttle.noteAction(throttle_name))
- {
- case LLStringThrottle::THROTTLE_NEWLY_BLOCKED:
- LL_INFOS("Messaging") << "process_script_question throttled"
- << " owner_name:" << owner_name
- << LL_ENDL;
- // Fall through
-
- case LLStringThrottle::THROTTLE_BLOCKED:
- // Escape altogether until we recover
- return;
-
- case LLStringThrottle::THROTTLE_OK:
- break;
- }
-
- std::string script_question;
- if (questions)
- {
- BOOL caution = FALSE;
- S32 count = 0;
- LLSD args;
- args["OBJECTNAME"] = object_name;
- args["NAME"] = LLCacheName::cleanFullName(owner_name);
-
- // check the received permission flags against each permission
- for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++)
- {
- if (questions & LSCRIPTRunTimePermissionBits[i])
- {
- count++;
- script_question += " " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n";
-
- // check whether permission question should cause special caution dialog
- caution |= (SCRIPT_QUESTION_IS_CAUTION[i]);
- }
- }
- args["QUESTIONS"] = script_question;
-
- LLSD payload;
- payload["task_id"] = taskid;
- payload["item_id"] = itemid;
- payload["sender"] = sender.getIPandPort();
- payload["questions"] = questions;
- payload["object_name"] = object_name;
- payload["owner_name"] = owner_name;
-
- // check whether cautions are even enabled or not
- if (gSavedSettings.getBOOL("PermissionsCautionEnabled"))
- {
- // display the caution permissions prompt
- LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload);
- }
- else
- {
- // fall back to default behavior if cautions are entirely disabled
- LLNotificationsUtil::add("ScriptQuestion", args, payload);
- }
-
- }
-}
-
-
-void process_derez_container(LLMessageSystem *msg, void**)
-{
- LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL;
-}
-
-void container_inventory_arrived(LLViewerObject* object,
- LLInventoryObject::object_list_t* inventory,
- S32 serial_num,
- void* data)
-{
- LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL;
- if( gAgentCamera.cameraMouselook() )
- {
- gAgentCamera.changeCameraToDefault();
- }
-
- LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
-
- if (inventory->size() > 2)
- {
- // create a new inventory category to put this in
- LLUUID cat_id;
- cat_id = gInventory.createNewCategory(gInventory.getRootFolderID(),
- LLFolderType::FT_NONE,
- LLTrans::getString("AcquiredItems"));
-
- LLInventoryObject::object_list_t::const_iterator it = inventory->begin();
- LLInventoryObject::object_list_t::const_iterator end = inventory->end();
- for ( ; it != end; ++it)
- {
- if ((*it)->getType() != LLAssetType::AT_CATEGORY)
- {
- LLInventoryObject* obj = (LLInventoryObject*)(*it);
- LLInventoryItem* item = (LLInventoryItem*)(obj);
- LLUUID item_id;
- item_id.generate();
- time_t creation_date_utc = time_corrected();
- LLPointer<LLViewerInventoryItem> new_item
- = new LLViewerInventoryItem(item_id,
- cat_id,
- item->getPermissions(),
- item->getAssetUUID(),
- item->getType(),
- item->getInventoryType(),
- item->getName(),
- item->getDescription(),
- LLSaleInfo::DEFAULT,
- item->getFlags(),
- creation_date_utc);
- new_item->updateServer(TRUE);
- gInventory.updateItem(new_item);
- }
- }
- gInventory.notifyObservers();
- if(active_panel)
- {
- active_panel->setSelection(cat_id, TAKE_FOCUS_NO);
- }
- }
- else if (inventory->size() == 2)
- {
- // we're going to get one fake root category as well as the
- // one actual object
- LLInventoryObject::object_list_t::iterator it = inventory->begin();
-
- if ((*it)->getType() == LLAssetType::AT_CATEGORY)
- {
- ++it;
- }
-
- LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it));
- const LLUUID category = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType()));
-
- LLUUID item_id;
- item_id.generate();
- time_t creation_date_utc = time_corrected();
- LLPointer<LLViewerInventoryItem> new_item
- = new LLViewerInventoryItem(item_id, category,
- item->getPermissions(),
- item->getAssetUUID(),
- item->getType(),
- item->getInventoryType(),
- item->getName(),
- item->getDescription(),
- LLSaleInfo::DEFAULT,
- item->getFlags(),
- creation_date_utc);
- new_item->updateServer(TRUE);
- gInventory.updateItem(new_item);
- gInventory.notifyObservers();
- if(active_panel)
- {
- active_panel->setSelection(item_id, TAKE_FOCUS_NO);
- }
- }
-
- // we've got the inventory, now delete this object if this was a take
- BOOL delete_object = (BOOL)(intptr_t)data;
- LLViewerRegion *region = gAgent.getRegion();
- if (delete_object && region)
- {
- gMessageSystem->newMessageFast(_PREHASH_ObjectDelete);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- const U8 NO_FORCE = 0;
- gMessageSystem->addU8Fast(_PREHASH_Force, NO_FORCE);
- gMessageSystem->nextBlockFast(_PREHASH_ObjectData);
- gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID());
- gMessageSystem->sendReliable(region->getHost());
- }
-}
-
-// method to format the time.
-std::string formatted_time(const time_t& the_time)
-{
- std::string dateStr = "["+LLTrans::getString("LTimeWeek")+"] ["
- +LLTrans::getString("LTimeMonth")+"] ["
- +LLTrans::getString("LTimeDay")+"] ["
- +LLTrans::getString("LTimeHour")+"]:["
- +LLTrans::getString("LTimeMin")+"]:["
- +LLTrans::getString("LTimeSec")+"] ["
- +LLTrans::getString("LTimeYear")+"]";
-
- LLSD substitution;
- substitution["datetime"] = (S32) the_time;
- LLStringUtil::format (dateStr, substitution);
- return dateStr;
-}
-
-
-void process_teleport_failed(LLMessageSystem *msg, void**)
-{
- std::string reason;
- std::string big_reason;
- LLSD args;
-
- // if we have additional alert data
- 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];
- 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;
- }
-
- LLSD llsd_block;
- std::string llsd_raw;
- msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsd_raw);
- if (llsd_raw.length())
- {
- std::istringstream llsd_data(llsd_raw);
- if (!LLSDSerialize::deserialize(llsd_block, llsd_data, llsd_raw.length()))
- {
- llwarns << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << llendl;
- }
- else
- {
- // change notification name in this special case
- if (handle_special_notification("RegionEntryAccessBlocked", llsd_block))
- {
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
- return;
- }
- }
- }
-
- }
- else
- {
- msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason);
-
- big_reason = LLAgent::sTeleportErrorMessages[reason];
- 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;
- }
- }
-
- LLNotificationsUtil::add("CouldNotTeleportReason", args);
-
- // Let the interested parties know that teleport failed.
- LLViewerParcelMgr::getInstance()->onTeleportFailed();
-
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
-}
-
-void process_teleport_local(LLMessageSystem *msg,void**)
-{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL;
- return;
- }
-
- U32 location_id;
- LLVector3 pos, look_at;
- U32 teleport_flags;
- msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id);
- msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos);
- msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at);
- msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags);
-
- if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE )
- {
- if( gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL )
- {
- // To prevent TeleportStart messages re-activating the progress screen right
- // after tp, keep the teleport state and let progress screen clear it after a short delay
- // (progress screen is active but not visible) *TODO: remove when SVC-5290 is fixed
- gTeleportDisplayTimer.reset();
- gTeleportDisplay = TRUE;
- }
- else
- {
- gAgent.setTeleportState( LLAgent::TELEPORT_NONE );
- }
- }
-
- // Sim tells us whether the new position is off the ground
- if (teleport_flags & TELEPORT_FLAGS_IS_FLYING)
- {
- gAgent.setFlying(TRUE);
- }
- else
- {
- gAgent.setFlying(FALSE);
- }
-
- gAgent.setPositionAgent(pos);
- gAgentCamera.slamLookAt(look_at);
-
- if ( !(gAgent.getTeleportKeepsLookAt() && LLViewerJoystick::getInstance()->getOverrideCamera()) )
- {
- gAgentCamera.resetView(TRUE, TRUE);
- }
-
- // send camera update to new region
- gAgentCamera.updateCamera();
-
- send_agent_update(TRUE, TRUE);
-
- // Let the interested parties know we've teleported.
- // Vadim *HACK: Agent position seems to get reset (to render position?)
- // on each frame, so we have to pass the new position manually.
- LLViewerParcelMgr::getInstance()->onTeleportFinished(true, gAgent.getPosGlobalFromAgent(pos));
-}
-
-void send_simple_im(const LLUUID& to_id,
- const std::string& message,
- EInstantMessage dialog,
- const LLUUID& id)
-{
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
- send_improved_im(to_id,
- my_name,
- message,
- IM_ONLINE,
- dialog,
- id,
- NO_TIMESTAMP,
- (U8*)EMPTY_BINARY_BUCKET,
- EMPTY_BINARY_BUCKET_SIZE);
-}
-
-void send_group_notice(const LLUUID& group_id,
- const std::string& subject,
- const std::string& message,
- const LLInventoryItem* item)
-{
- // Put this notice into an instant message form.
- // This will mean converting the item to a binary bucket,
- // and the subject/message into a single field.
- std::string my_name;
- LLAgentUI::buildFullname(my_name);
-
- // Combine subject + message into a single string.
- std::ostringstream subject_and_message;
- // TODO: turn all existing |'s into ||'s in subject and message.
- subject_and_message << subject << "|" << message;
-
- // Create an empty binary bucket.
- U8 bin_bucket[MAX_INVENTORY_BUFFER_SIZE];
- U8* bucket_to_send = bin_bucket;
- bin_bucket[0] = '\0';
- S32 bin_bucket_size = EMPTY_BINARY_BUCKET_SIZE;
- // If there is an item being sent, pack it into the binary bucket.
- if (item)
- {
- LLSD item_def;
- item_def["item_id"] = item->getUUID();
- item_def["owner_id"] = item->getPermissions().getOwner();
- std::ostringstream ostr;
- LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML);
- bin_bucket_size = ostr.str().copy(
- (char*)bin_bucket, ostr.str().size());
- bin_bucket[bin_bucket_size] = '\0';
- }
- else
- {
- bucket_to_send = (U8*) EMPTY_BINARY_BUCKET;
- }
-
-
- send_improved_im(
- group_id,
- my_name,
- subject_and_message.str(),
- IM_ONLINE,
- IM_GROUP_NOTICE,
- LLUUID::null,
- NO_TIMESTAMP,
- bucket_to_send,
- bin_bucket_size);
-}
-
-bool handle_lure_callback(const LLSD& notification, const LLSD& response)
-{
- std::string text = response["message"].asString();
- LLSLURL slurl;
- LLAgentUI::buildSLURL(slurl);
- text.append("\r\n").append(slurl.getSLURLString());
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if(0 == option)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_StartLure);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_Info);
- msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in.
- msg->addStringFast(_PREHASH_Message, text);
- for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray();
- it != notification["payload"]["ids"].endArray();
- ++it)
- {
- LLUUID target_id = it->asUUID();
-
- msg->nextBlockFast(_PREHASH_TargetData);
- msg->addUUIDFast(_PREHASH_TargetID, target_id);
-
- // Record the offer.
- {
- std::string target_name;
- gCacheName->getFullName(target_id, target_name); // for im log filenames
- LLSD args;
- args["TO_NAME"] = LLSLURL("agent", target_id, "displayname").getSLURLString();;
-
- LLSD payload;
-
- //*TODO please rewrite all keys to the same case, lower or upper
- payload["from_id"] = target_id;
- payload["SUPPRESS_TOAST"] = true;
- LLNotificationsUtil::add("TeleportOfferSent", args, payload);
-
- // Add the recepient to the recent people list.
- LLRecentPeople::instance().add(target_id);
- }
- }
- gAgent.sendReliableMessage();
- }
-
- return false;
-}
-
-void handle_lure(const LLUUID& invitee)
-{
- LLDynamicArray<LLUUID> ids;
- ids.push_back(invitee);
- handle_lure(ids);
-}
-
-// Prompt for a message to the invited user.
-void handle_lure(const uuid_vec_t& ids)
-{
- if (ids.empty()) return;
-
- if (!gAgent.getRegion()) return;
-
- LLSD edit_args;
- edit_args["REGION"] = gAgent.getRegion()->getName();
-
- LLSD payload;
- for (LLDynamicArray<LLUUID>::const_iterator it = ids.begin();
- it != ids.end();
- ++it)
- {
- payload["ids"].append(*it);
- }
- if (gAgent.isGodlike())
- {
- LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback);
- }
- else
- {
- LLNotificationsUtil::add("OfferTeleport", edit_args, payload, handle_lure_callback);
- }
-}
-
-
-void send_improved_im(const LLUUID& to_id,
- const std::string& name,
- const std::string& message,
- U8 offline,
- EInstantMessage dialog,
- const LLUUID& id,
- U32 timestamp,
- const U8* binary_bucket,
- S32 binary_bucket_size)
-{
- pack_instant_message(
- gMessageSystem,
- gAgent.getID(),
- FALSE,
- gAgent.getSessionID(),
- to_id,
- name,
- message,
- offline,
- dialog,
- id,
- 0,
- LLUUID::null,
- gAgent.getPositionAgent(),
- timestamp,
- binary_bucket,
- binary_bucket_size);
- gAgent.sendReliableMessage();
-}
-
-
-void send_places_query(const LLUUID& query_id,
- const LLUUID& trans_id,
- const std::string& query_text,
- U32 query_flags,
- S32 category,
- const std::string& sim_name)
-{
- LLMessageSystem* msg = gMessageSystem;
-
- msg->newMessage("PlacesQuery");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUID("QueryID", query_id);
- msg->nextBlock("TransactionData");
- msg->addUUID("TransactionID", trans_id);
- msg->nextBlock("QueryData");
- msg->addString("QueryText", query_text);
- msg->addU32("QueryFlags", query_flags);
- msg->addS8("Category", (S8)category);
- msg->addString("SimName", sim_name);
- gAgent.sendReliableMessage();
-}
-
-
-void process_user_info_reply(LLMessageSystem* msg, void**)
-{
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- if(agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "process_user_info_reply - "
- << "wrong agent id." << LL_ENDL;
- }
-
- BOOL im_via_email;
- msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email);
- std::string email;
- msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email);
- std::string dir_visibility;
- msg->getString( "UserData", "DirectoryVisibility", dir_visibility);
-
- LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email);
- LLFloaterPostcard::updateUserInfo(email);
-}
-
-
-//---------------------------------------------------------------------------
-// Script Dialog
-//---------------------------------------------------------------------------
-
-const S32 SCRIPT_DIALOG_MAX_BUTTONS = 12;
-const S32 SCRIPT_DIALOG_BUTTON_STR_SIZE = 24;
-const S32 SCRIPT_DIALOG_MAX_MESSAGE_SIZE = 512;
-const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n";
-
-bool callback_script_dialog(const LLSD& notification, const LLSD& response)
-{
- LLNotificationForm form(notification["form"]);
-
- std::string rtn_text;
- S32 button_idx;
- button_idx = LLNotification::getSelectedOption(notification, response);
- if (response[TEXTBOX_MAGIC_TOKEN].isDefined())
- {
- if (response[TEXTBOX_MAGIC_TOKEN].isString())
- rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString();
- else
- rtn_text.clear(); // bool marks empty string
- }
- else
- {
- rtn_text = LLNotification::getSelectedOptionName(response);
- }
-
- // Didn't click "Ignore"
- if (button_idx != -1)
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("ScriptDialogReply");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("ObjectID", notification["payload"]["object_id"].asUUID());
- msg->addS32("ChatChannel", notification["payload"]["chat_channel"].asInteger());
- msg->addS32("ButtonIndex", button_idx);
- msg->addString("ButtonLabel", rtn_text);
- msg->sendReliable(LLHost(notification["payload"]["sender"].asString()));
- }
-
- return false;
-}
-static LLNotificationFunctorRegistration callback_script_dialog_reg_1("ScriptDialog", callback_script_dialog);
-static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDialogGroup", callback_script_dialog);
-
-void process_script_dialog(LLMessageSystem* msg, void**)
-{
- S32 i;
- LLSD payload;
-
- LLUUID object_id;
- msg->getUUID("Data", "ObjectID", object_id);
-
- if (LLMuteList::getInstance()->isMuted(object_id))
- {
- return;
- }
-
- std::string message;
- std::string first_name;
- std::string last_name;
- std::string title;
-
- S32 chat_channel;
- msg->getString("Data", "FirstName", first_name);
- msg->getString("Data", "LastName", last_name);
- msg->getString("Data", "ObjectName", title);
- msg->getString("Data", "Message", message);
- msg->getS32("Data", "ChatChannel", chat_channel);
-
- // unused for now
- LLUUID image_id;
- msg->getUUID("Data", "ImageID", image_id);
-
- payload["sender"] = msg->getSender().getIPandPort();
- payload["object_id"] = object_id;
- payload["chat_channel"] = chat_channel;
-
- // build up custom form
- S32 button_count = msg->getNumberOfBlocks("Buttons");
- if (button_count > SCRIPT_DIALOG_MAX_BUTTONS)
- {
- llwarns << "Too many script dialog buttons - omitting some" << llendl;
- button_count = SCRIPT_DIALOG_MAX_BUTTONS;
- }
-
- LLNotificationForm form;
- for (i = 0; i < button_count; i++)
- {
- std::string tdesc;
- msg->getString("Buttons", "ButtonLabel", tdesc, i);
- form.addElement("button", std::string(tdesc));
- }
-
- LLSD args;
- args["TITLE"] = title;
- args["MESSAGE"] = message;
- LLNotificationPtr notification;
- if (!first_name.empty())
- {
- args["NAME"] = LLCacheName::buildFullName(first_name, last_name);
- notification = LLNotifications::instance().add(
- LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD()));
- }
- else
- {
- args["GROUPNAME"] = last_name;
- notification = LLNotifications::instance().add(
- LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD()));
- }
-}
-
-//---------------------------------------------------------------------------
-
-
-std::vector<LLSD> gLoadUrlList;
-
-bool callback_load_url(const LLSD& notification, const LLSD& response)
-{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
- if (0 == option)
- {
- LLWeb::loadURL(notification["payload"]["url"].asString());
- }
-
- return false;
-}
-static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", callback_load_url);
-
-
-// We've got the name of the person who owns the object hurling the url.
-// Display confirmation dialog.
-void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool is_group)
-{
- std::vector<LLSD>::iterator it;
- for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); )
- {
- LLSD load_url_info = *it;
- if (load_url_info["owner_id"].asUUID() == id)
- {
- it = gLoadUrlList.erase(it);
-
- std::string owner_name;
- if (is_group)
- {
- owner_name = full_name + LLTrans::getString("Group");
- }
- else
- {
- owner_name = full_name;
- }
-
- // For legacy name-only mutes.
- if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name))
- {
- continue;
- }
- LLSD args;
- args["URL"] = load_url_info["url"].asString();
- args["MESSAGE"] = load_url_info["message"].asString();;
- args["OBJECTNAME"] = load_url_info["object_name"].asString();
- args["NAME"] = owner_name;
-
- LLNotificationsUtil::add("LoadWebPage", args, load_url_info);
- }
- else
- {
- ++it;
- }
- }
-}
-
-void process_load_url(LLMessageSystem* msg, void**)
-{
- LLUUID object_id;
- LLUUID owner_id;
- BOOL owner_is_group;
- char object_name[256]; /* Flawfinder: ignore */
- char message[256]; /* Flawfinder: ignore */
- char url[256]; /* Flawfinder: ignore */
-
- msg->getString("Data", "ObjectName", 256, object_name);
- msg->getUUID( "Data", "ObjectID", object_id);
- msg->getUUID( "Data", "OwnerID", owner_id);
- msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group);
- msg->getString("Data", "Message", 256, message);
- msg->getString("Data", "URL", 256, url);
-
- LLSD payload;
- payload["object_id"] = object_id;
- payload["owner_id"] = owner_id;
- payload["owner_is_group"] = owner_is_group;
- payload["object_name"] = object_name;
- payload["message"] = message;
- payload["url"] = url;
-
- // URL is safety checked in load_url above
-
- // Check if object or owner is muted
- if (LLMuteList::getInstance()->isMuted(object_id, object_name) ||
- LLMuteList::getInstance()->isMuted(owner_id))
- {
- LL_INFOS("Messaging")<<"Ignoring load_url from muted object/owner."<<LL_ENDL;
- return;
- }
-
- // Add to list of pending name lookups
- gLoadUrlList.push_back(payload);
-
- gCacheName->get(owner_id, owner_is_group,
- boost::bind(&callback_load_url_name, _1, _2, _3));
-}
-
-
-void callback_download_complete(void** data, S32 result, LLExtStat ext_status)
-{
- std::string* filepath = (std::string*)data;
- LLSD args;
- args["DOWNLOAD_PATH"] = *filepath;
- LLNotificationsUtil::add("FinishedRawDownload", args);
- delete filepath;
-}
-
-
-void process_initiate_download(LLMessageSystem* msg, void**)
-{
- LLUUID agent_id;
- msg->getUUID("AgentData", "AgentID", agent_id);
- if (agent_id != gAgent.getID())
- {
- LL_WARNS("Messaging") << "Initiate download for wrong agent" << LL_ENDL;
- return;
- }
-
- std::string sim_filename;
- std::string viewer_filename;
- msg->getString("FileData", "SimFilename", sim_filename);
- msg->getString("FileData", "ViewerFilename", viewer_filename);
-
- if (!gXferManager->validateFileForRequest(viewer_filename))
- {
- llwarns << "SECURITY: Unauthorized download to local file " << viewer_filename << llendl;
- return;
- }
- gXferManager->requestFile(viewer_filename,
- sim_filename,
- LL_PATH_NONE,
- msg->getSender(),
- FALSE, // don't delete remote
- callback_download_complete,
- (void**)new std::string(viewer_filename));
-}
-
-
-void process_script_teleport_request(LLMessageSystem* msg, void**)
-{
- if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return;
-
- std::string object_name;
- std::string sim_name;
- LLVector3 pos;
- LLVector3 look_at;
-
- msg->getString("Data", "ObjectName", object_name);
- msg->getString("Data", "SimName", sim_name);
- msg->getVector3("Data", "SimPosition", pos);
- msg->getVector3("Data", "LookAt", look_at);
-
- LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance();
- if(instance)
- {
- instance->trackURL(
- sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]);
- LLFloaterReg::showInstance("world_map", "center");
- }
-
- // remove above two lines and replace with below line
- // to re-enable parcel browser for llMapDestination()
- // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE);
-
-}
-
-void process_covenant_reply(LLMessageSystem* msg, void**)
-{
- LLUUID covenant_id, estate_owner_id;
- std::string estate_name;
- U32 covenant_timestamp;
- msg->getUUID("Data", "CovenantID", covenant_id);
- msg->getU32("Data", "CovenantTimestamp", covenant_timestamp);
- msg->getString("Data", "EstateName", estate_name);
- msg->getUUID("Data", "EstateOwnerID", estate_owner_id);
-
- LLPanelEstateCovenant::updateEstateName(estate_name);
- LLPanelLandCovenant::updateEstateName(estate_name);
- LLFloaterBuyLand::updateEstateName(estate_name);
-
- std::string owner_name =
- LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
- LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
- LLPanelLandCovenant::updateEstateOwnerName(owner_name);
- LLFloaterBuyLand::updateEstateOwnerName(owner_name);
-
- LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile");
- if (panel)
- {
- panel->updateEstateName(estate_name);
- panel->updateEstateOwnerName(owner_name);
- }
-
- // standard message, not from system
- std::string last_modified;
- if (covenant_timestamp == 0)
- {
- last_modified = LLTrans::getString("covenant_last_modified")+LLTrans::getString("never_text");
- }
- else
- {
- last_modified = LLTrans::getString("covenant_last_modified")+"["
- +LLTrans::getString("LTimeWeek")+"] ["
- +LLTrans::getString("LTimeMonth")+"] ["
- +LLTrans::getString("LTimeDay")+"] ["
- +LLTrans::getString("LTimeHour")+"]:["
- +LLTrans::getString("LTimeMin")+"]:["
- +LLTrans::getString("LTimeSec")+"] ["
- +LLTrans::getString("LTimeYear")+"]";
- LLSD substitution;
- substitution["datetime"] = (S32) covenant_timestamp;
- LLStringUtil::format (last_modified, substitution);
- }
-
- LLPanelEstateCovenant::updateLastModified(last_modified);
- LLPanelLandCovenant::updateLastModified(last_modified);
- LLFloaterBuyLand::updateLastModified(last_modified);
-
- // load the actual covenant asset data
- const BOOL high_priority = TRUE;
- if (covenant_id.notNull())
- {
- gAssetStorage->getEstateAsset(gAgent.getRegionHost(),
- gAgent.getID(),
- gAgent.getSessionID(),
- covenant_id,
- LLAssetType::AT_NOTECARD,
- ET_Covenant,
- onCovenantLoadComplete,
- NULL,
- high_priority);
- }
- else
- {
- std::string covenant_text;
- if (estate_owner_id.isNull())
- {
- // mainland
- covenant_text = LLTrans::getString("RegionNoCovenant");
- }
- else
- {
- covenant_text = LLTrans::getString("RegionNoCovenantOtherOwner");
- }
- LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id);
- LLPanelLandCovenant::updateCovenantText(covenant_text);
- LLFloaterBuyLand::updateCovenantText(covenant_text, covenant_id);
- if (panel)
- {
- panel->updateCovenantText(covenant_text);
- }
- }
-}
-
-void onCovenantLoadComplete(LLVFS *vfs,
- const LLUUID& asset_uuid,
- LLAssetType::EType type,
- void* user_data, S32 status, LLExtStat ext_status)
-{
- LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL;
- std::string covenant_text;
- if(0 == status)
- {
- LLVFile file(vfs, asset_uuid, type, LLVFile::READ);
-
- S32 file_length = file.getSize();
-
- std::vector<char> buffer(file_length+1);
- file.read((U8*)&buffer[0], file_length);
- // put a EOS at the end
- buffer[file_length] = '\0';
-
- if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) )
- {
- LLViewerTextEditor::Params params;
- params.name("temp");
- params.max_text_length(file_length+1);
- LLViewerTextEditor * editor = LLUICtrlFactory::create<LLViewerTextEditor> (params);
- if( !editor->importBuffer( &buffer[0], file_length+1 ) )
- {
- LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL;
- covenant_text = "Problem importing estate covenant.";
- }
- else
- {
- // Version 0 (just text, doesn't include version number)
- covenant_text = editor->getText();
- }
- delete editor;
- }
- else
- {
- LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL;
- covenant_text = "Problem importing estate covenant: Covenant file format error.";
- }
- }
- else
- {
- LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED );
-
- if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status ||
- LL_ERR_FILE_EMPTY == status)
- {
- covenant_text = "Estate covenant notecard is missing from database.";
- }
- else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
- {
- covenant_text = "Insufficient permissions to view estate covenant.";
- }
- else
- {
- covenant_text = "Unable to load estate covenant at this time.";
- }
-
- LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL;
- }
- LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid);
- LLPanelLandCovenant::updateCovenantText(covenant_text);
- LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid);
-
- LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile");
- if (panel)
- {
- panel->updateCovenantText(covenant_text);
- }
-}
-
-
-void process_feature_disabled_message(LLMessageSystem* msg, void**)
-{
- // Handle Blacklisted feature simulator response...
- LLUUID agentID;
- LLUUID transactionID;
- std::string messageText;
- msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0);
- msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID);
- msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID);
-
- LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL;
-}
-
-// ------------------------------------------------------------
-// Message system exception callbacks
-// ------------------------------------------------------------
-
-void invalid_message_callback(LLMessageSystem* msg,
- void*,
- EMessageException exception)
-{
- LLAppViewer::instance()->badNetworkHandler();
-}
-
-// Please do not add more message handlers here. This file is huge.
-// Put them in a file related to the functionality you are implementing.
-
-void LLOfferInfo::forceResponse(InventoryOfferResponse response)
-{
- LLNotification::Params params("UserGiveItem");
- params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2));
- LLNotifications::instance().forceResponse(params, response);
-}
-
+/** + * @file llviewermessage.cpp + * @brief Dumping ground for viewer-side message system callbacks. + * + * $LicenseInfo:firstyear=2002&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 "llviewerprecompiledheaders.h" +#include "llviewermessage.h" +#include "boost/lexical_cast.hpp" + +// Linden libraries +#include "llanimationstates.h" +#include "llaudioengine.h" +#include "llavataractions.h" +#include "llavatarnamecache.h" // IDEVO HACK +#include "lscript_byteformat.h" +#include "lleconomy.h" +#include "lleventtimer.h" +#include "llfloaterreg.h" +#include "llfollowcamparams.h" +#include "llinventorydefines.h" +#include "lllslconstants.h" +#include "llregionhandle.h" +#include "llsdserialize.h" +#include "llteleportflags.h" +#include "lltransactionflags.h" +#include "llvfile.h" +#include "llvfs.h" +#include "llxfermanager.h" +#include "mean_collision_data.h" + +#include "llagent.h" +#include "llagentcamera.h" +#include "llcallingcard.h" +#include "llbuycurrencyhtml.h" +#include "llfirstuse.h" +#include "llfloaterbuyland.h" +#include "llfloaterland.h" +#include "llfloaterregioninfo.h" +#include "llfloaterlandholdings.h" +#include "llfloaterpostcard.h" +#include "llfloaterpreference.h" +#include "llhudeffecttrail.h" +#include "llhudmanager.h" +#include "llinventoryfunctions.h" +#include "llinventoryobserver.h" +#include "llinventorypanel.h" +#include "llnearbychat.h" +#include "llnotifications.h" +#include "llnotificationsutil.h" +#include "llpanelgrouplandmoney.h" +#include "llrecentpeople.h" +#include "llscriptfloater.h" +#include "llselectmgr.h" +#include "llsidetray.h" +#include "llstartup.h" +#include "llsky.h" +#include "llslurl.h" +#include "llstatenums.h" +#include "llstatusbar.h" +#include "llimview.h" +#include "llspeakers.h" +#include "lltrans.h" +#include "lltranslate.h" +#include "llviewerfoldertype.h" +#include "llvoavatar.h" // IDEVO HACK +#include "lluri.h" +#include "llviewergenericmessage.h" +#include "llviewermenu.h" +#include "llviewerjoystick.h" +#include "llviewerobjectlist.h" +#include "llviewerparcelmgr.h" +#include "llviewerstats.h" +#include "llviewertexteditor.h" +#include "llviewerthrottle.h" +#include "llviewerwindow.h" +#include "llvlmanager.h" +#include "llvoavatarself.h" +#include "llvotextbubble.h" +#include "llworld.h" +#include "pipeline.h" +#include "llfloaterworldmap.h" +#include "llviewerdisplay.h" +#include "llkeythrottle.h" +#include "llgroupactions.h" +#include "llagentui.h" +#include "llpanelblockedlist.h" +#include "llpanelplaceprofile.h" + +#include <boost/algorithm/string/split.hpp> // +#include <boost/regex.hpp> + +#include "llnotificationmanager.h" // + +#if LL_MSVC +// disable boost::lexical_cast warning +#pragma warning (disable:4702) +#endif + +// +// Constants +// +const F32 BIRD_AUDIBLE_RADIUS = 32.0f; +const F32 SIT_DISTANCE_FROM_TARGET = 0.25f; +static const F32 LOGOUT_REPLY_TIME = 3.f; // Wait this long after LogoutReply before quitting. + +// Determine how quickly residents' scripts can issue question dialogs +// Allow bursts of up to 5 dialogs in 10 seconds. 10*2=20 seconds recovery if throttle kicks in +static const U32 LLREQUEST_PERMISSION_THROTTLE_LIMIT = 5; // requests +static const F32 LLREQUEST_PERMISSION_THROTTLE_INTERVAL = 10.0f; // seconds + +extern BOOL gDebugClicks; + +// function prototypes +bool check_offer_throttle(const std::string& from_name, bool check_only); +static void process_money_balance_reply_extended(LLMessageSystem* msg); + +//inventory offer throttle globals +LLFrameTimer gThrottleTimer; +const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period +const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds + +//script permissions +const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = + { + "ScriptTakeMoney", + "ActOnControlInputs", + "RemapControlInputs", + "AnimateYourAvatar", + "AttachToYourAvatar", + "ReleaseOwnership", + "LinkAndDelink", + "AddAndRemoveJoints", + "ChangePermissions", + "TrackYourCamera", + "ControlYourCamera" + }; + +const BOOL SCRIPT_QUESTION_IS_CAUTION[SCRIPT_PERMISSION_EOF] = +{ + TRUE, // ScriptTakeMoney, + FALSE, // ActOnControlInputs + FALSE, // RemapControlInputs + FALSE, // AnimateYourAvatar + FALSE, // AttachToYourAvatar + FALSE, // ReleaseOwnership, + FALSE, // LinkAndDelink, + FALSE, // AddAndRemoveJoints + FALSE, // ChangePermissions + FALSE, // TrackYourCamera, + FALSE // ControlYourCamera +}; + +bool friendship_offer_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLMessageSystem* msg = gMessageSystem; + const LLSD& payload = notification["payload"]; + + // add friend to recent people list + LLRecentPeople::instance().add(payload["from_id"]); + + switch(option) + { + case 0: + { + // accept + LLAvatarTracker::formFriendship(payload["from_id"]); + + const LLUUID fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + + // This will also trigger an onlinenotification if the user is online + msg->newMessageFast(_PREHASH_AcceptFriendship); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_TransactionBlock); + msg->addUUIDFast(_PREHASH_TransactionID, payload["session_id"]); + msg->nextBlockFast(_PREHASH_FolderData); + msg->addUUIDFast(_PREHASH_FolderID, fid); + msg->sendReliable(LLHost(payload["sender"].asString())); + + LLSD payload = notification["payload"]; + payload["SUPPRESS_TOAST"] = true; + LLNotificationsUtil::add("FriendshipAcceptedByMe", + notification["substitutions"], payload); + break; + } + case 1: // Decline + { + LLSD payload = notification["payload"]; + payload["SUPPRESS_TOAST"] = true; + LLNotificationsUtil::add("FriendshipDeclinedByMe", + notification["substitutions"], payload); + } + // fall-through + case 2: // Send IM - decline and start IM session + { + // decline + // We no longer notify other viewers, but we DO still send + // the rejection to the simulator to delete the pending userop. + msg->newMessageFast(_PREHASH_DeclineFriendship); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_TransactionBlock); + msg->addUUIDFast(_PREHASH_TransactionID, payload["session_id"]); + msg->sendReliable(LLHost(payload["sender"].asString())); + + // start IM session + if(2 == option) + { + LLAvatarActions::startIM(payload["from_id"].asUUID()); + } + } + default: + // close button probably, possibly timed out + break; + } + + return false; +} +static LLNotificationFunctorRegistration friendship_offer_callback_reg("OfferFriendship", friendship_offer_callback); +static LLNotificationFunctorRegistration friendship_offer_callback_reg_nm("OfferFriendshipNoMessage", friendship_offer_callback); + +//const char BUSY_AUTO_RESPONSE[] = "The Resident you messaged is in 'busy mode' which means they have " +// "requested not to be disturbed. Your message will still be shown in their IM " +// "panel for later viewing."; + +// +// Functions +// + +void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, + S32 trx_type, const std::string& desc) +{ + if(0 == amount || !region) return; + amount = abs(amount); + LL_INFOS("Messaging") << "give_money(" << uuid << "," << amount << ")"<< LL_ENDL; + if(can_afford_transaction(amount)) + { +// gStatusBar->debitBalance(amount); + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_MoneyTransferRequest); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MoneyData); + msg->addUUIDFast(_PREHASH_SourceID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_DestID, uuid); + msg->addU8Fast(_PREHASH_Flags, pack_transaction_flags(FALSE, is_group)); + msg->addS32Fast(_PREHASH_Amount, amount); + msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); + msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); + msg->addS32Fast(_PREHASH_TransactionType, trx_type ); + msg->addStringFast(_PREHASH_Description, desc); + msg->sendReliable(region->getHost()); + } + else + { + LLStringUtil::format_map_t args; + args["AMOUNT"] = llformat("%d", amount); + LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount ); + } +} + +void send_complete_agent_movement(const LLHost& sim_host) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_CompleteAgentMovement); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addU32Fast(_PREHASH_CircuitCode, msg->mOurCircuitCode); + msg->sendReliable(sim_host); +} + +void process_logout_reply(LLMessageSystem* msg, void**) +{ + // The server has told us it's ok to quit. + LL_DEBUGS("Messaging") << "process_logout_reply" << LL_ENDL; + + LLUUID agent_id; + msg->getUUID("AgentData", "AgentID", agent_id); + LLUUID session_id; + msg->getUUID("AgentData", "SessionID", session_id); + if((agent_id != gAgent.getID()) || (session_id != gAgent.getSessionID())) + { + LL_WARNS("Messaging") << "Bogus Logout Reply" << LL_ENDL; + } + + LLInventoryModel::update_map_t parents; + S32 count = msg->getNumberOfBlocksFast( _PREHASH_InventoryData ); + for(S32 i = 0; i < count; ++i) + { + LLUUID item_id; + msg->getUUIDFast(_PREHASH_InventoryData, _PREHASH_ItemID, item_id, i); + + if( (1 == count) && item_id.isNull() ) + { + // Detect dummy item. Indicates an empty list. + break; + } + + // We do not need to track the asset ids, just account for an + // updated inventory version. + LL_INFOS("Messaging") << "process_logout_reply itemID=" << item_id << LL_ENDL; + LLInventoryItem* item = gInventory.getItem( item_id ); + if( item ) + { + parents[item->getParentUUID()] = 0; + gInventory.addChangedMask(LLInventoryObserver::INTERNAL, item_id); + } + else + { + LL_INFOS("Messaging") << "process_logout_reply item not found: " << item_id << LL_ENDL; + } + } + LLAppViewer::instance()->forceQuit(); +} + +void process_layer_data(LLMessageSystem *mesgsys, void **user_data) +{ + LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(mesgsys->getSender()); + + if (!regionp || gNoRender) + { + return; + } + + + S32 size; + S8 type; + + mesgsys->getS8Fast(_PREHASH_LayerID, _PREHASH_Type, type); + size = mesgsys->getSizeFast(_PREHASH_LayerData, _PREHASH_Data); + if (0 == size) + { + LL_WARNS("Messaging") << "Layer data has zero size." << LL_ENDL; + return; + } + if (size < 0) + { + // getSizeFast() is probably trying to tell us about an error + LL_WARNS("Messaging") << "getSizeFast() returned negative result: " + << size + << LL_ENDL; + return; + } + U8 *datap = new U8[size]; + mesgsys->getBinaryDataFast(_PREHASH_LayerData, _PREHASH_Data, datap, size); + LLVLData *vl_datap = new LLVLData(regionp, type, datap, size); + if (mesgsys->getReceiveCompressedSize()) + { + gVLManager.addLayerData(vl_datap, mesgsys->getReceiveCompressedSize()); + } + else + { + gVLManager.addLayerData(vl_datap, mesgsys->getReceiveSize()); + } +} + +// S32 exported_object_count = 0; +// S32 exported_image_count = 0; +// S32 current_object_count = 0; +// S32 current_image_count = 0; + +// extern LLNotifyBox *gExporterNotify; +// extern LLUUID gExporterRequestID; +// extern std::string gExportDirectory; + +// extern LLUploadDialog *gExportDialog; + +// std::string gExportedFile; + +// std::map<LLUUID, std::string> gImageChecksums; + +// void export_complete() +// { +// LLUploadDialog::modalUploadFinished(); +// gExporterRequestID.setNull(); +// gExportDirectory = ""; + +// LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */ +// fseek(fXML, 0, SEEK_END); +// long length = ftell(fXML); +// fseek(fXML, 0, SEEK_SET); +// U8 *buffer = new U8[length + 1]; +// size_t nread = fread(buffer, 1, length, fXML); +// if (nread < (size_t) length) +// { +// LL_WARNS("Messaging") << "Short read" << LL_ENDL; +// } +// buffer[nread] = '\0'; +// fclose(fXML); + +// char *pos = (char *)buffer; +// while ((pos = strstr(pos+1, "<sl:image ")) != 0) +// { +// char *pos_check = strstr(pos, "checksum=\""); + +// if (pos_check) +// { +// char *pos_uuid = strstr(pos_check, "\">"); + +// if (pos_uuid) +// { +// char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ +// memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ +// image_uuid_str[UUID_STR_SIZE-1] = 0; + +// LLUUID image_uuid(image_uuid_str); + +// LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; + +// std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid); +// if (itor != gImageChecksums.end()) +// { +// LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; +// if (!itor->second.empty()) +// { +// memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ +// } +// } +// } +// } +// } + +// LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */ +// if (fwrite(buffer, 1, length, fXMLOut) != length) +// { +// LL_WARNS("Messaging") << "Short write" << LL_ENDL; +// } +// fclose(fXMLOut); + +// delete [] buffer; +// } + + +// void exported_item_complete(const LLTSCode status, void *user_data) +// { +// //std::string *filename = (std::string *)user_data; + +// if (status < LLTS_OK) +// { +// LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; +// } +// else +// { +// ++current_object_count; +// if (current_image_count == exported_image_count && current_object_count == exported_object_count) +// { +// LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; + +// export_complete(); +// } +// else +// { +// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); +// } +// } +// } + +// struct exported_image_info +// { +// LLUUID image_id; +// std::string filename; +// U32 image_num; +// }; + +// void exported_j2c_complete(const LLTSCode status, void *user_data) +// { +// exported_image_info *info = (exported_image_info *)user_data; +// LLUUID image_id = info->image_id; +// U32 image_num = info->image_num; +// std::string filename = info->filename; +// delete info; + +// if (status < LLTS_OK) +// { +// LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; +// } +// else +// { +// LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ +// if (fIn) +// { +// LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; +// LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; + +// fseek(fIn, 0, SEEK_END); +// S32 length = ftell(fIn); +// fseek(fIn, 0, SEEK_SET); +// U8 *buffer = ImageUtility->allocateData(length); +// if (fread(buffer, 1, length, fIn) != length) +// { +// LL_WARNS("Messaging") << "Short read" << LL_ENDL; +// } +// fclose(fIn); +// LLFile::remove(filename); + +// // Convert to TGA +// LLPointer<LLImageRaw> image = new LLImageRaw(); + +// ImageUtility->updateData(); +// ImageUtility->decode(image, 100000.0f); + +// TargaUtility->encode(image); +// U8 *data = TargaUtility->getData(); +// S32 data_size = TargaUtility->getDataSize(); + +// std::string file_path = gDirUtilp->getDirName(filename); + +// std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename; +// //S32 name_len = output_file.length(); +// //strcpy(&output_file[name_len-3], "tga"); +// LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */ +// char md5_hash_string[33]; /* Flawfinder: ignore */ +// strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ +// if (fOut) +// { +// if (fwrite(data, 1, data_size, fOut) != data_size) +// { +// LL_WARNS("Messaging") << "Short write" << LL_ENDL; +// } +// fseek(fOut, 0, SEEK_SET); +// fclose(fOut); +// fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */ +// LLMD5 my_md5_hash(fOut); +// my_md5_hash.hex_digest(md5_hash_string); +// } + +// gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string)); +// } +// } + +// ++current_image_count; +// if (current_image_count == exported_image_count && current_object_count == exported_object_count) +// { +// LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; +// export_complete(); +// } +// else +// { +// gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); +// } +//} + +void process_derez_ack(LLMessageSystem*, void**) +{ + if(gViewerWindow) gViewerWindow->getWindow()->decBusyCount(); +} + +void process_places_reply(LLMessageSystem* msg, void** data) +{ + LLUUID query_id; + + msg->getUUID("AgentData", "QueryID", query_id); + if (query_id.isNull()) + { + LLFloaterLandHoldings::processPlacesReply(msg, data); + } + else if(gAgent.isInGroup(query_id)) + { + LLPanelGroupLandMoney::processPlacesReply(msg, data); + } + else + { + LL_WARNS("Messaging") << "Got invalid PlacesReply message" << LL_ENDL; + } +} + +void send_sound_trigger(const LLUUID& sound_id, F32 gain) +{ + if (sound_id.isNull() || gAgent.getRegion() == NULL) + { + // disconnected agent or zero guids don't get sent (no sound) + return; + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_SoundTrigger); + msg->nextBlockFast(_PREHASH_SoundData); + msg->addUUIDFast(_PREHASH_SoundID, sound_id); + // Client untrusted, ids set on sim + msg->addUUIDFast(_PREHASH_OwnerID, LLUUID::null ); + msg->addUUIDFast(_PREHASH_ObjectID, LLUUID::null ); + msg->addUUIDFast(_PREHASH_ParentID, LLUUID::null ); + + msg->addU64Fast(_PREHASH_Handle, gAgent.getRegion()->getHandle()); + + LLVector3 position = gAgent.getPositionAgent(); + msg->addVector3Fast(_PREHASH_Position, position); + msg->addF32Fast(_PREHASH_Gain, gain); + + gAgent.sendMessage(); +} + +bool join_group_response(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + BOOL delete_context_data = TRUE; + bool accept_invite = false; + + LLUUID group_id = notification["payload"]["group_id"].asUUID(); + LLUUID transaction_id = notification["payload"]["transaction_id"].asUUID(); + std::string name = notification["payload"]["name"].asString(); + std::string message = notification["payload"]["message"].asString(); + S32 fee = notification["payload"]["fee"].asInteger(); + + if (option == 2 && !group_id.isNull()) + { + LLGroupActions::show(group_id); + LLSD args; + args["MESSAGE"] = message; + LLNotificationsUtil::add("JoinGroup", args, notification["payload"]); + return false; + } + if(option == 0 && !group_id.isNull()) + { + // check for promotion or demotion. + S32 max_groups = gMaxAgentGroups; + if(gAgent.isInGroup(group_id)) ++max_groups; + + if(gAgent.mGroups.count() < max_groups) + { + accept_invite = true; + } + else + { + delete_context_data = FALSE; + LLSD args; + args["NAME"] = name; + LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]); + } + } + + if (accept_invite) + { + // If there is a fee to join this group, make + // sure the user is sure they want to join. + if (fee > 0) + { + delete_context_data = FALSE; + LLSD args; + args["COST"] = llformat("%d", fee); + // Set the fee for next time to 0, so that we don't keep + // asking about a fee. + LLSD next_payload = notification["payload"]; + next_payload["fee"] = 0; + LLNotificationsUtil::add("JoinGroupCanAfford", + args, + next_payload); + } + else + { + send_improved_im(group_id, + std::string("name"), + std::string("message"), + IM_ONLINE, + IM_GROUP_INVITATION_ACCEPT, + transaction_id); + } + } + else + { + send_improved_im(group_id, + std::string("name"), + std::string("message"), + IM_ONLINE, + IM_GROUP_INVITATION_DECLINE, + transaction_id); + } + + return false; +} + +static void highlight_inventory_items_in_panel(const std::vector<LLUUID>& items, LLInventoryPanel *inventory_panel) +{ + if (NULL == inventory_panel) return; + + for (std::vector<LLUUID>::const_iterator item_iter = items.begin(); + item_iter != items.end(); + ++item_iter) + { + const LLUUID& item_id = (*item_iter); + if(!highlight_offered_object(item_id)) + { + continue; + } + + LLInventoryItem* item = gInventory.getItem(item_id); + llassert(item); + if (!item) { + continue; + } + + LL_DEBUGS("Inventory_Move") << "Highlighting inventory item: " << item->getName() << ", " << item_id << LL_ENDL; + LLFolderView* fv = inventory_panel->getRootFolder(); + if (fv) + { + LLFolderViewItem* fv_item = fv->getItemByID(item_id); + if (fv_item) + { + LLFolderViewItem* fv_folder = fv_item->getParentFolder(); + if (fv_folder) + { + // Parent folders can be different in case of 2 consecutive drag and drop + // operations when the second one is started before the first one completes. + LL_DEBUGS("Inventory_Move") << "Open folder: " << fv_folder->getName() << LL_ENDL; + fv_folder->setOpen(TRUE); + if (fv_folder->isSelected()) + { + fv->changeSelection(fv_folder, FALSE); + } + } + fv->changeSelection(fv_item, TRUE); + } + } + } +} + +static LLNotificationFunctorRegistration jgr_1("JoinGroup", join_group_response); +static LLNotificationFunctorRegistration jgr_2("JoinedTooManyGroupsMember", join_group_response); +static LLNotificationFunctorRegistration jgr_3("JoinGroupCanAfford", join_group_response); + + +//----------------------------------------------------------------------------- +// Instant Message +//----------------------------------------------------------------------------- +class LLOpenAgentOffer : public LLInventoryFetchItemsObserver +{ +public: + LLOpenAgentOffer(const LLUUID& object_id, + const std::string& from_name) : + LLInventoryFetchItemsObserver(object_id), + mFromName(from_name) {} + /*virtual*/ void startFetch() + { + for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it) + { + LLViewerInventoryCategory* cat = gInventory.getCategory(*it); + if (cat) + { + mComplete.push_back((*it)); + } + } + LLInventoryFetchItemsObserver::startFetch(); + } + /*virtual*/ void done() + { + open_inventory_offer(mComplete, mFromName); + gInventory.removeObserver(this); + delete this; + } +private: + std::string mFromName; +}; + +/** + * Class to observe adding of new items moved from the world to user's inventory to select them in inventory. + * + * We can't create it each time items are moved because "drop" event is sent separately for each + * element even while multi-dragging. We have to have the only instance of the observer. See EXT-4347. + */ +class LLViewerInventoryMoveFromWorldObserver : public LLInventoryAddItemByAssetObserver +{ +public: + LLViewerInventoryMoveFromWorldObserver() + : LLInventoryAddItemByAssetObserver() + , mActivePanel(NULL) + { + + } + + void setMoveIntoFolderID(const LLUUID& into_folder_uuid) {mMoveIntoFolderID = into_folder_uuid; } + +private: + /*virtual */void onAssetAdded(const LLUUID& asset_id) + { + // Store active Inventory panel. + mActivePanel = LLInventoryPanel::getActiveInventoryPanel(); + + // Store selected items (without destination folder) + mSelectedItems.clear(); + if (mActivePanel) + { + mSelectedItems = mActivePanel->getRootFolder()->getSelectionList(); + } + mSelectedItems.erase(mMoveIntoFolderID); + } + + /** + * Selects added inventory items watched by their Asset UUIDs if selection was not changed since + * all items were started to watch (dropped into a folder). + */ + void done() + { + // if selection is not changed since watch started lets hightlight new items. + if (mActivePanel && !isSelectionChanged()) + { + LL_DEBUGS("Inventory_Move") << "Selecting new items..." << LL_ENDL; + mActivePanel->clearSelection(); + highlight_inventory_items_in_panel(mAddedItems, mActivePanel); + } + } + + /** + * Returns true if selected inventory items were changed since moved inventory items were started to watch. + */ + bool isSelectionChanged() + { + const LLInventoryPanel * const current_active_panel = LLInventoryPanel::getActiveInventoryPanel(); + + if (NULL == mActivePanel || current_active_panel != mActivePanel) + { + return true; + } + + // get selected items (without destination folder) + selected_items_t selected_items = mActivePanel->getRootFolder()->getSelectionList(); + selected_items.erase(mMoveIntoFolderID); + + // compare stored & current sets of selected items + selected_items_t different_items; + std::set_symmetric_difference(mSelectedItems.begin(), mSelectedItems.end(), + selected_items.begin(), selected_items.end(), std::inserter(different_items, different_items.begin())); + + LL_DEBUGS("Inventory_Move") << "Selected firstly: " << mSelectedItems.size() + << ", now: " << selected_items.size() << ", difference: " << different_items.size() << LL_ENDL; + + return different_items.size() > 0; + } + + LLInventoryPanel *mActivePanel; + typedef std::set<LLUUID> selected_items_t; + selected_items_t mSelectedItems; + + /** + * UUID of FolderViewFolder into which watched items are moved. + * + * Destination FolderViewFolder becomes selected while mouse hovering (when dragged items are dropped). + * + * If mouse is moved out it set unselected and number of selected items is changed + * even if selected items in Inventory stay the same. + * So, it is used to update stored selection list. + * + * @see onAssetAdded() + * @see isSelectionChanged() + */ + LLUUID mMoveIntoFolderID; +}; + +LLViewerInventoryMoveFromWorldObserver* gInventoryMoveObserver = NULL; + +void set_dad_inventory_item(LLInventoryItem* inv_item, const LLUUID& into_folder_uuid) +{ + start_new_inventory_observer(); + + gInventoryMoveObserver->setMoveIntoFolderID(into_folder_uuid); + gInventoryMoveObserver->watchAsset(inv_item->getAssetUUID()); +} + +//unlike the FetchObserver for AgentOffer, we only make one +//instance of the AddedObserver for TaskOffers +//and it never dies. We do this because we don't know the UUID of +//task offers until they are accepted, so we don't wouldn't +//know what to watch for, so instead we just watch for all additions. +class LLOpenTaskOffer : public LLInventoryAddedObserver +{ +protected: + /*virtual*/ void done() + { + for (uuid_vec_t::iterator it = mAdded.begin(); it != mAdded.end();) + { + const LLUUID& item_uuid = *it; + bool was_moved = false; + LLInventoryObject* added_object = gInventory.getObject(item_uuid); + if (added_object) + { + // cast to item to get Asset UUID + LLInventoryItem* added_item = dynamic_cast<LLInventoryItem*>(added_object); + if (added_item) + { + const LLUUID& asset_uuid = added_item->getAssetUUID(); + if (gInventoryMoveObserver->isAssetWatched(asset_uuid)) + { + LL_DEBUGS("Inventory_Move") << "Found asset UUID: " << asset_uuid << LL_ENDL; + was_moved = true; + } + } + } + + if (was_moved) + { + it = mAdded.erase(it); + } + else ++it; + } + + open_inventory_offer(mAdded, ""); + mAdded.clear(); + } + }; + +class LLOpenTaskGroupOffer : public LLInventoryAddedObserver +{ +protected: + /*virtual*/ void done() + { + open_inventory_offer(mAdded, "group_offer"); + mAdded.clear(); + gInventory.removeObserver(this); + delete this; + } +}; + +//one global instance to bind them +LLOpenTaskOffer* gNewInventoryObserver=NULL; + +class LLNewInventoryHintObserver : public LLInventoryAddedObserver +{ +protected: + /*virtual*/ void done() + { + LLFirstUse::newInventory(); + } +}; + +void start_new_inventory_observer() +{ + if (!gNewInventoryObserver) //task offer observer + { + // Observer is deleted by gInventory + gNewInventoryObserver = new LLOpenTaskOffer; + gInventory.addObserver(gNewInventoryObserver); + } + + if (!gInventoryMoveObserver) //inventory move from the world observer + { + // Observer is deleted by gInventory + gInventoryMoveObserver = new LLViewerInventoryMoveFromWorldObserver; + gInventory.addObserver(gInventoryMoveObserver); + } + + gInventory.addObserver(new LLNewInventoryHintObserver()); +} + +class LLDiscardAgentOffer : public LLInventoryFetchItemsObserver +{ + LOG_CLASS(LLDiscardAgentOffer); +public: + LLDiscardAgentOffer(const LLUUID& folder_id, const LLUUID& object_id) : + LLInventoryFetchItemsObserver(object_id), + mFolderID(folder_id), + mObjectID(object_id) {} + virtual ~LLDiscardAgentOffer() {} + virtual void done() + { + LL_DEBUGS("Messaging") << "LLDiscardAgentOffer::done()" << LL_ENDL; + const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); + bool notify = false; + if(trash_id.notNull() && mObjectID.notNull()) + { + LLInventoryModel::update_list_t update; + LLInventoryModel::LLCategoryUpdate old_folder(mFolderID, -1); + update.push_back(old_folder); + LLInventoryModel::LLCategoryUpdate new_folder(trash_id, 1); + update.push_back(new_folder); + gInventory.accountForUpdate(update); + gInventory.moveObject(mObjectID, trash_id); + LLInventoryObject* obj = gInventory.getObject(mObjectID); + if(obj) + { + // no need to restamp since this is already a freshly + // stamped item. + obj->updateParentOnServer(FALSE); + notify = true; + } + } + else + { + LL_WARNS("Messaging") << "DiscardAgentOffer unable to find: " + << (trash_id.isNull() ? "trash " : "") + << (mObjectID.isNull() ? "object" : "") << LL_ENDL; + } + gInventory.removeObserver(this); + if(notify) + { + gInventory.notifyObservers(); + } + delete this; + } +protected: + LLUUID mFolderID; + LLUUID mObjectID; +}; + + +//Returns TRUE if we are OK, FALSE if we are throttled +//Set check_only true if you want to know the throttle status +//without registering a hit +bool check_offer_throttle(const std::string& from_name, bool check_only) +{ + static U32 throttle_count; + static bool throttle_logged; + LLChat chat; + std::string log_message; + + if (!gSavedSettings.getBOOL("ShowNewInventory")) + return false; + + if (check_only) + { + return gThrottleTimer.hasExpired(); + } + + if(gThrottleTimer.checkExpirationAndReset(OFFER_THROTTLE_TIME)) + { + LL_DEBUGS("Messaging") << "Throttle Expired" << LL_ENDL; + throttle_count=1; + throttle_logged=false; + return true; + } + else //has not expired + { + LL_DEBUGS("Messaging") << "Throttle Not Expired, Count: " << throttle_count << LL_ENDL; + // When downloading the initial inventory we get a lot of new items + // coming in and can't tell that from spam. + if (LLStartUp::getStartupState() >= STATE_STARTED + && throttle_count >= OFFER_THROTTLE_MAX_COUNT) + { + if (!throttle_logged) + { + // Use the name of the last item giver, who is probably the person + // spamming you. + + LLStringUtil::format_map_t arg; + std::string log_msg; + std::ostringstream time ; + time<<OFFER_THROTTLE_TIME; + + arg["APP_NAME"] = LLAppViewer::instance()->getSecondLifeTitle(); + arg["TIME"] = time.str(); + + if (!from_name.empty()) + { + arg["FROM_NAME"] = from_name; + log_msg = LLTrans::getString("ItemsComingInTooFastFrom", arg); + } + else + { + log_msg = LLTrans::getString("ItemsComingInTooFast", arg); + } + + //this is kinda important, so actually put it on screen + LLSD args; + args["MESSAGE"] = log_msg; + LLNotificationsUtil::add("SystemMessage", args); + + throttle_logged=true; + } + return false; + } + else + { + throttle_count++; + return true; + } + } +} + +void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_name) +{ + for (uuid_vec_t::const_iterator obj_iter = objects.begin(); + obj_iter != objects.end(); + ++obj_iter) + { + const LLUUID& obj_id = (*obj_iter); + if(!highlight_offered_object(obj_id)) + { + continue; + } + + const LLInventoryObject *obj = gInventory.getObject(obj_id); + if (!obj) + { + llwarns << "Cannot find object [ itemID:" << obj_id << " ] to open." << llendl; + continue; + } + + const LLAssetType::EType asset_type = obj->getActualType(); + + // Either an inventory item or a category. + const LLInventoryItem* item = dynamic_cast<const LLInventoryItem*>(obj); + if (item) + { + //////////////////////////////////////////////////////////////////////////////// + // Special handling for various types. + if (check_offer_throttle(from_name, false)) // If we are throttled, don't display + { + LL_DEBUGS("Messaging") << "Highlighting inventory item: " << item->getUUID() << LL_ENDL; + // If we opened this ourselves, focus it + const BOOL take_focus = from_name.empty() ? TAKE_FOCUS_YES : TAKE_FOCUS_NO; + switch(asset_type) + { + case LLAssetType::AT_NOTECARD: + { + LLFloaterReg::showInstance("preview_notecard", LLSD(obj_id), take_focus); + break; + } + case LLAssetType::AT_LANDMARK: + { + LLInventoryCategory* parent_folder = gInventory.getCategory(item->getParentUUID()); + if ("inventory_handler" == from_name) + { + //we have to filter inventory_handler messages to avoid notification displaying + LLSideTray::getInstance()->showPanel("panel_places", + LLSD().with("type", "landmark").with("id", item->getUUID())); + } + else if("group_offer" == from_name) + { + // "group_offer" is passed by LLOpenTaskGroupOffer + // Notification about added landmark will be generated under the "from_name.empty()" called from LLOpenTaskOffer::done(). + LLSD args; + args["type"] = "landmark"; + args["id"] = obj_id; + LLSideTray::getInstance()->showPanel("panel_places", args); + + continue; + } + else if(from_name.empty()) + { + std::string folder_name; + if (parent_folder) + { + // Localize folder name. + // *TODO: share this code? + folder_name = parent_folder->getName(); + if (LLFolderType::lookupIsProtectedType(parent_folder->getPreferredType())) + { + LLTrans::findString(folder_name, "InvFolder " + folder_name); + } + } + else + { + folder_name = LLTrans::getString("Unknown"); + } + + // we receive a message from LLOpenTaskOffer, it mean that new landmark has been added. + LLSD args; + args["LANDMARK_NAME"] = item->getName(); + args["FOLDER_NAME"] = folder_name; + LLNotificationsUtil::add("LandmarkCreated", args); + } + } + break; + case LLAssetType::AT_TEXTURE: + { + LLFloaterReg::showInstance("preview_texture", LLSD(obj_id), take_focus); + break; + } + case LLAssetType::AT_ANIMATION: + LLFloaterReg::showInstance("preview_anim", LLSD(obj_id), take_focus); + break; + case LLAssetType::AT_SCRIPT: + LLFloaterReg::showInstance("preview_script", LLSD(obj_id), take_focus); + break; + case LLAssetType::AT_SOUND: + LLFloaterReg::showInstance("preview_sound", LLSD(obj_id), take_focus); + break; + default: + break; + } + } + } + + //////////////////////////////////////////////////////////////////////////////// + // Highlight item + const BOOL auto_open = + gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false + !from_name.empty(); // don't open if it's not from anyone. + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open); + if(active_panel) + { + LL_DEBUGS("Messaging") << "Highlighting" << obj_id << LL_ENDL; + LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus(); + active_panel->setSelection(obj_id, TAKE_FOCUS_NO); + gFocusMgr.setKeyboardFocus(focus_ctrl); + } + } +} + +bool highlight_offered_object(const LLUUID& obj_id) +{ + const LLInventoryObject* obj = gInventory.getObject(obj_id); + if(!obj) + { + LL_WARNS("Messaging") << "Unable to show inventory item: " << obj_id << LL_ENDL; + return false; + } + + //////////////////////////////////////////////////////////////////////////////// + // Don't highlight if it's in certain "quiet" folders which don't need UI + // notification (e.g. trash, cof, lost-and-found). + if(!gAgent.getAFK()) + { + const LLViewerInventoryCategory *parent = gInventory.getFirstNondefaultParent(obj_id); + if (parent) + { + const LLFolderType::EType parent_type = parent->getPreferredType(); + if (LLViewerFolderType::lookupIsQuietType(parent_type)) + { + return false; + } + } + } + + return true; +} + +void inventory_offer_mute_callback(const LLUUID& blocked_id, + const std::string& full_name, + bool is_group, + boost::shared_ptr<LLNotificationResponderInterface> offer_ptr) +{ + LLOfferInfo* offer = dynamic_cast<LLOfferInfo*>(offer_ptr.get()); + + std::string from_name = full_name; + LLMute::EType type; + if (is_group) + { + type = LLMute::GROUP; + } + else if(offer && offer->mFromObject) + { + //we have to block object by name because blocked_id is an id of owner + type = LLMute::BY_NAME; + } + else + { + type = LLMute::AGENT; + } + + // id should be null for BY_NAME mute, see LLMuteList::add for details + LLMute mute(type == LLMute::BY_NAME ? LLUUID::null : blocked_id, from_name, type); + if (LLMuteList::getInstance()->add(mute)) + { + LLPanelBlockedList::showPanelAndSelect(blocked_id); + } + + // purge the message queue of any previously queued inventory offers from the same source. + class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher + { + public: + OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} + bool matches(const LLNotificationPtr notification) const + { + if(notification->getName() == "ObjectGiveItem" + || notification->getName() == "UserGiveItem") + { + return (notification->getPayload()["from_id"].asUUID() == blocked_id); + } + return FALSE; + } + private: + const LLUUID& blocked_id; + }; + + LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID( + gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(blocked_id)); +} + +LLOfferInfo::LLOfferInfo() + : LLNotificationResponderInterface() + , mFromGroup(FALSE) + , mFromObject(FALSE) + , mIM(IM_NOTHING_SPECIAL) + , mType(LLAssetType::AT_NONE) + , mPersist(false) +{ +} + +LLOfferInfo::LLOfferInfo(const LLSD& sd) +{ + mIM = (EInstantMessage)sd["im_type"].asInteger(); + mFromID = sd["from_id"].asUUID(); + mFromGroup = sd["from_group"].asBoolean(); + mFromObject = sd["from_object"].asBoolean(); + mTransactionID = sd["transaction_id"].asUUID(); + mFolderID = sd["folder_id"].asUUID(); + mObjectID = sd["object_id"].asUUID(); + mType = LLAssetType::lookup(sd["type"].asString().c_str()); + mFromName = sd["from_name"].asString(); + mDesc = sd["description"].asString(); + mHost = LLHost(sd["sender"].asString()); + mPersist = sd["persist"].asBoolean(); +} + +LLOfferInfo::LLOfferInfo(const LLOfferInfo& info) +{ + mIM = info.mIM; + mFromID = info.mFromID; + mFromGroup = info.mFromGroup; + mFromObject = info.mFromObject; + mTransactionID = info.mTransactionID; + mFolderID = info.mFolderID; + mObjectID = info.mObjectID; + mType = info.mType; + mFromName = info.mFromName; + mDesc = info.mDesc; + mHost = info.mHost; + mPersist = info.mPersist; +} + +LLSD LLOfferInfo::asLLSD() +{ + LLSD sd; + sd["im_type"] = mIM; + sd["from_id"] = mFromID; + sd["from_group"] = mFromGroup; + sd["from_object"] = mFromObject; + sd["transaction_id"] = mTransactionID; + sd["folder_id"] = mFolderID; + sd["object_id"] = mObjectID; + sd["type"] = LLAssetType::lookup(mType); + sd["from_name"] = mFromName; + sd["description"] = mDesc; + sd["sender"] = mHost.getIPandPort(); + sd["persist"] = mPersist; + return sd; +} + +void LLOfferInfo::fromLLSD(const LLSD& params) +{ + *this = params; +} + +void LLOfferInfo::send_auto_receive_response(void) +{ + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ImprovedInstantMessage); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MessageBlock); + msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addUUIDFast(_PREHASH_ToAgentID, mFromID); + msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); + msg->addUUIDFast(_PREHASH_ID, mTransactionID); + msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary + std::string name; + LLAgentUI::buildFullname(name); + msg->addStringFast(_PREHASH_FromAgentName, name); + msg->addStringFast(_PREHASH_Message, ""); + msg->addU32Fast(_PREHASH_ParentEstateID, 0); + msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); + msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); + + // Auto Receive Message. The math for the dialog works, because the accept + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 1 greater than the offer integer value. + // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED, + // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData), + sizeof(mFolderID.mData)); + // send the message + msg->sendReliable(mHost); + + if(IM_INVENTORY_OFFERED == mIM) + { + // add buddy to recent people list + LLRecentPeople::instance().add(mFromID); + } +} + +void LLOfferInfo::handleRespond(const LLSD& notification, const LLSD& response) +{ + initRespondFunctionMap(); + + const std::string name = notification["name"].asString(); + if(mRespondFunctions.find(name) == mRespondFunctions.end()) + { + llwarns << "Unexpected notification name : " << name << llendl; + llassert(!"Unexpected notification name"); + return; + } + + mRespondFunctions[name](notification, response); +} + +bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD& response) +{ + LLChat chat; + std::string log_message; + S32 button = LLNotificationsUtil::getSelectedOption(notification, response); + + LLInventoryObserver* opener = NULL; + LLViewerInventoryCategory* catp = NULL; + catp = (LLViewerInventoryCategory*)gInventory.getCategory(mObjectID); + LLViewerInventoryItem* itemp = NULL; + if(!catp) + { + itemp = (LLViewerInventoryItem*)gInventory.getItem(mObjectID); + } + + // For muting, we need to add the mute, then decline the offer. + // This must be done here because: + // * callback may be called immediately, + // * adding the mute sends a message, + // * we can't build two messages at once. + if (2 == button) // Block + { + LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID()); + + llassert(notification_ptr != NULL); + if (notification_ptr != NULL) + { + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr())); + } + } + + std::string from_string; // Used in the pop-up. + std::string chatHistory_string; // Used in chat history. + + // TODO: when task inventory offers can also be handled the new way, migrate the code that sets these strings here: + from_string = chatHistory_string = mFromName; + + bool busy=FALSE; + + switch(button) + { + case IOR_SHOW: + // we will want to open this item when it comes back. + LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID + << LL_ENDL; + switch (mIM) + { + case IM_INVENTORY_OFFERED: + { + // This is an offer from an agent. In this case, the back + // end has already copied the items into your inventory, + // so we can fetch it out of our inventory. + if (gSavedSettings.getBOOL("ShowOfferedInventory")) + { + LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(mObjectID, from_string); + open_agent_offer->startFetch(); + if(catp || (itemp && itemp->isFinished())) + { + open_agent_offer->done(); + } + else + { + opener = open_agent_offer; + } + } + } + break; + case IM_GROUP_NOTICE: + opener = new LLOpenTaskGroupOffer; + send_auto_receive_response(); + break; + case IM_TASK_INVENTORY_OFFERED: + case IM_GROUP_NOTICE_REQUESTED: + // This is an offer from a task or group. + // We don't use a new instance of an opener + // We instead use the singular observer gOpenTaskOffer + // Since it already exists, we don't need to actually do anything + break; + default: + LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL; + break; + } + break; + // end switch (mIM) + + case IOR_ACCEPT: + //don't spam them if they are getting flooded + if (check_offer_throttle(mFromName, true)) + { + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); + LLSD args; + args["MESSAGE"] = log_message; + LLNotificationsUtil::add("SystemMessage", args); + } + break; + + case IOR_BUSY: + //Busy falls through to decline. Says to make busy message. + busy=TRUE; + case IOR_MUTE: + // MUTE falls through to decline + case IOR_DECLINE: + { + { + LLStringUtil::format_map_t log_message_args; + log_message_args["DESC"] = mDesc; + log_message_args["NAME"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); + } + chat.mText = log_message; + if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) ) // muting for SL-42269 + { + chat.mMuted = TRUE; + } + + // *NOTE dzaporozhan + // Disabled logging to old chat floater to fix crash in group notices - EXT-4149 + // LLFloaterChat::addChatHistory(chat); + + LLDiscardAgentOffer* discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID); + discard_agent_offer->startFetch(); + if (catp || (itemp && itemp->isFinished())) + { + discard_agent_offer->done(); + } + else + { + opener = discard_agent_offer; + } + + + if (busy && (!mFromGroup && !mFromObject)) + { + busy_message(gMessageSystem, mFromID); + } + break; + } + default: + // close button probably + // The item has already been fetched and is in your inventory, we simply won't highlight it + // OR delete it if the notification gets killed, since we don't want that to be a vector for + // losing inventory offers. + break; + } + + if(opener) + { + gInventory.addObserver(opener); + } + + if(!mPersist) + { + delete this; + } + return false; +} + +bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const LLSD& response) +{ + LLChat chat; + std::string log_message; + S32 button = LLNotification::getSelectedOption(notification, response); + + // For muting, we need to add the mute, then decline the offer. + // This must be done here because: + // * callback may be called immediately, + // * adding the mute sends a message, + // * we can't build two messages at once. + if (2 == button) + { + LLNotificationPtr notification_ptr = LLNotifications::instance().find(notification["id"].asUUID()); + + llassert(notification_ptr != NULL); + if (notification_ptr != NULL) + { + gCacheName->get(mFromID, mFromGroup, boost::bind(&inventory_offer_mute_callback,_1,_2,_3,notification_ptr->getResponderPtr())); + } + } + + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_ImprovedInstantMessage); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_MessageBlock); + msg->addBOOLFast(_PREHASH_FromGroup, FALSE); + msg->addUUIDFast(_PREHASH_ToAgentID, mFromID); + msg->addU8Fast(_PREHASH_Offline, IM_ONLINE); + msg->addUUIDFast(_PREHASH_ID, mTransactionID); + msg->addU32Fast(_PREHASH_Timestamp, NO_TIMESTAMP); // no timestamp necessary + std::string name; + LLAgentUI::buildFullname(name); + msg->addStringFast(_PREHASH_FromAgentName, name); + msg->addStringFast(_PREHASH_Message, ""); + msg->addU32Fast(_PREHASH_ParentEstateID, 0); + msg->addUUIDFast(_PREHASH_RegionID, LLUUID::null); + msg->addVector3Fast(_PREHASH_Position, gAgent.getPositionAgent()); + LLInventoryObserver* opener = NULL; + + std::string from_string; // Used in the pop-up. + std::string chatHistory_string; // Used in chat history. + if (mFromObject == TRUE) + { + if (mFromGroup) + { + std::string group_name; + if (gCacheName->getGroupName(mFromID, group_name)) + { + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" + + mFromName + LLTrans::getString("'") +" " + LLTrans::getString("InvOfferOwnedByGroup") + + " "+ "'" + group_name + "'"; + + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByGroup") + + " " + group_name + "'"; + } + else + { + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+"'" + + mFromName +"'"+ " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownGroup"); + } + } + else + { + std::string full_name; + if (gCacheName->getFullName(mFromID, full_name)) + { + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+ LLTrans::getString("'") + mFromName + + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedBy") + full_name; + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedBy") + " " + full_name; + } + else + { + from_string = LLTrans::getString("InvOfferAnObjectNamed") + " "+LLTrans::getString("'") + + mFromName + LLTrans::getString("'")+" " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + chatHistory_string = mFromName + " " + LLTrans::getString("InvOfferOwnedByUnknownUser"); + } + } + } + else + { + from_string = chatHistory_string = mFromName; + } + + bool busy=FALSE; + + switch(button) + { + case IOR_ACCEPT: + // ACCEPT. The math for the dialog works, because the accept + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 1 greater than the offer integer value. + // Generates IM_INVENTORY_ACCEPTED, IM_TASK_INVENTORY_ACCEPTED, + // or IM_GROUP_NOTICE_INVENTORY_ACCEPTED + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 1)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, &(mFolderID.mData), + sizeof(mFolderID.mData)); + // send the message + msg->sendReliable(mHost); + + //don't spam them if they are getting flooded + if (check_offer_throttle(mFromName, true)) + { + log_message = chatHistory_string + " " + LLTrans::getString("InvOfferGaveYou") + " " + mDesc + LLTrans::getString("."); + LLSD args; + args["MESSAGE"] = log_message; + LLNotificationsUtil::add("SystemMessage", args); + } + + // we will want to open this item when it comes back. + LL_DEBUGS("Messaging") << "Initializing an opener for tid: " << mTransactionID + << LL_ENDL; + switch (mIM) + { + case IM_TASK_INVENTORY_OFFERED: + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_REQUESTED: + { + // This is an offer from a task or group. + // We don't use a new instance of an opener + // We instead use the singular observer gOpenTaskOffer + // Since it already exists, we don't need to actually do anything + } + break; + default: + LL_WARNS("Messaging") << "inventory_offer_callback: unknown offer type" << LL_ENDL; + break; + } // end switch (mIM) + break; + + case IOR_BUSY: + //Busy falls through to decline. Says to make busy message. + busy=TRUE; + case IOR_MUTE: + // MUTE falls through to decline + case IOR_DECLINE: + // DECLINE. The math for the dialog works, because the decline + // for inventory_offered, task_inventory_offer or + // group_notice_inventory is 2 greater than the offer integer value. + // Generates IM_INVENTORY_DECLINED, IM_TASK_INVENTORY_DECLINED, + // or IM_GROUP_NOTICE_INVENTORY_DECLINED + default: + // close button probably (or any of the fall-throughs from above) + msg->addU8Fast(_PREHASH_Dialog, (U8)(mIM + 2)); + msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE); + // send the message + msg->sendReliable(mHost); + + if (gSavedSettings.getBOOL("LogInventoryDecline")) + { + LLStringUtil::format_map_t log_message_args; + log_message_args["DESC"] = mDesc; + log_message_args["NAME"] = mFromName; + log_message = LLTrans::getString("InvOfferDecline", log_message_args); + + LLSD args; + args["MESSAGE"] = log_message; + LLNotificationsUtil::add("SystemMessage", args); + } + + if (busy && (!mFromGroup && !mFromObject)) + { + busy_message(msg,mFromID); + } + break; + } + + if(opener) + { + gInventory.addObserver(opener); + } + + if(!mPersist) + { + delete this; + } + return false; +} + +class LLPostponedOfferNotification: public LLPostponedNotification +{ +protected: + /* virtual */ + void modifyNotificationParams() + { + LLSD substitutions = mParams.substitutions; + substitutions["NAME"] = mName; + mParams.substitutions = substitutions; + } +}; + +void LLOfferInfo::initRespondFunctionMap() +{ + if(mRespondFunctions.empty()) + { + mRespondFunctions["ObjectGiveItem"] = boost::bind(&LLOfferInfo::inventory_task_offer_callback, this, _1, _2); + mRespondFunctions["UserGiveItem"] = boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2); + } +} + +void inventory_offer_handler(LLOfferInfo* info) +{ + //Until throttling is implmented, busy mode should reject inventory instead of silently + //accepting it. SEE SL-39554 + if (gAgent.getBusy()) + { + info->forceResponse(IOR_BUSY); + return; + } + + //If muted, don't even go through the messaging stuff. Just curtail the offer here. + if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName)) + { + info->forceResponse(IOR_MUTE); + return; + } + + // Avoid the Accept/Discard dialog if the user so desires. JC + if (gSavedSettings.getBOOL("AutoAcceptNewInventory") + && (info->mType == LLAssetType::AT_NOTECARD + || info->mType == LLAssetType::AT_LANDMARK + || info->mType == LLAssetType::AT_TEXTURE)) + { + // For certain types, just accept the items into the inventory, + // and possibly open them on receipt depending upon "ShowNewInventory". + info->forceResponse(IOR_ACCEPT); + return; + } + + // Strip any SLURL from the message display. (DEV-2754) + std::string msg = info->mDesc; + int indx = msg.find(" ( http://slurl.com/secondlife/"); + if(indx == std::string::npos) + { + // try to find new slurl host + indx = msg.find(" ( http://maps.secondlife.com/secondlife/"); + } + if(indx >= 0) + { + LLStringUtil::truncate(msg, indx); + } + + LLSD args; + args["[OBJECTNAME]"] = msg; + + LLSD payload; + + // must protect against a NULL return from lookupHumanReadable() + std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType)); + if (!typestr.empty()) + { + // human readable matches string name from strings.xml + // lets get asset type localized name + args["OBJECTTYPE"] = LLTrans::getString(typestr); + } + else + { + LL_WARNS("Messaging") << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << LL_ENDL; + args["OBJECTTYPE"] = ""; + + // This seems safest, rather than propagating bogosity + LL_WARNS("Messaging") << "Forcing an inventory-decline for probably-bad asset type." << LL_ENDL; + info->forceResponse(IOR_DECLINE); + return; + } + + // If mObjectID is null then generate the object_id based on msg to prevent + // multiple creation of chiclets for same object. + LLUUID object_id = info->mObjectID; + if (object_id.isNull()) + object_id.generate(msg); + + payload["from_id"] = info->mFromID; + // Needed by LLScriptFloaterManager to bind original notification with + // faked for toast one. + payload["object_id"] = object_id; + // Flag indicating that this notification is faked for toast. + payload["give_inventory_notification"] = FALSE; + args["OBJECTFROMNAME"] = info->mFromName; + args["NAME"] = info->mFromName; + if (info->mFromGroup) + { + args["NAME_SLURL"] = LLSLURL("group", info->mFromID, "about").getSLURLString(); + } + else + { + args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString(); + } + std::string verb = "select?name=" + LLURI::escape(msg); + args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString(); + + LLNotification::Params p("ObjectGiveItem"); + + // Object -> Agent Inventory Offer + if (info->mFromObject) + { + // Inventory Slurls don't currently work for non agent transfers, so only display the object name. + args["ITEM_SLURL"] = msg; + // Note: sets inventory_task_offer_callback as the callback + p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info)); + info->mPersist = true; + p.name = "ObjectGiveItem"; + // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory. + LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE); + } + else // Agent -> Agent Inventory Offer + { + p.responder = info; + // Note: sets inventory_offer_callback as the callback + // *TODO fix memory leak + // inventory_offer_callback() is not invoked if user received notification and + // closes viewer(without responding the notification) + p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info)); + info->mPersist = true; + p.name = "UserGiveItem"; + + // Prefetch the item into your local inventory. + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); + fetch_item->startFetch(); + if(fetch_item->isFinished()) + { + fetch_item->done(); + } + else + { + gInventory.addObserver(fetch_item); + } + + // In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages). + info->send_auto_receive_response(); + + // Inform user that there is a script floater via toast system + { + payload["give_inventory_notification"] = TRUE; + p.payload = payload; + LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false); + } + } + + LLFirstUse::newInventory(); +} + +bool lure_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = 0; + if (response.isInteger()) + { + option = response.asInteger(); + } + else + { + option = LLNotificationsUtil::getSelectedOption(notification, response); + } + + LLUUID from_id = notification["payload"]["from_id"].asUUID(); + LLUUID lure_id = notification["payload"]["lure_id"].asUUID(); + BOOL godlike = notification["payload"]["godlike"].asBoolean(); + + switch(option) + { + case 0: + { + // accept + gAgent.teleportViaLure(lure_id, godlike); + } + break; + case 1: + default: + // decline + send_simple_im(from_id, + LLStringUtil::null, + IM_LURE_DECLINED, + lure_id); + break; + } + return false; +} +static LLNotificationFunctorRegistration lure_callback_reg("TeleportOffered", lure_callback); + +bool goto_url_callback(const LLSD& notification, const LLSD& response) +{ + std::string url = notification["payload"]["url"].asString(); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if(1 == option) + { + LLWeb::loadURL(url); + } + return false; +} +static LLNotificationFunctorRegistration goto_url_callback_reg("GotoURL", goto_url_callback); + +bool inspect_remote_object_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + if (0 == option) + { + LLFloaterReg::showInstance("inspect_remote_object", notification["payload"]); + } + return false; +} +static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback); + +class LLPostponedServerObjectNotification: public LLPostponedNotification +{ +protected: + /* virtual */ + void modifyNotificationParams() + { + LLSD payload = mParams.payload; + mParams.payload = payload; + } +}; + +static bool parse_lure_bucket(const std::string& bucket, + U64& region_handle, + LLVector3& pos, + LLVector3& look_at, + U8& region_access) +{ + // tokenize the bucket + typedef boost::tokenizer<boost::char_separator<char> > tokenizer; + boost::char_separator<char> sep("|", "", boost::keep_empty_tokens); + tokenizer tokens(bucket, sep); + tokenizer::iterator iter = tokens.begin(); + + S32 gx,gy,rx,ry,rz,lx,ly,lz; + try + { + gx = boost::lexical_cast<S32>((*(iter)).c_str()); + gy = boost::lexical_cast<S32>((*(++iter)).c_str()); + rx = boost::lexical_cast<S32>((*(++iter)).c_str()); + ry = boost::lexical_cast<S32>((*(++iter)).c_str()); + rz = boost::lexical_cast<S32>((*(++iter)).c_str()); + lx = boost::lexical_cast<S32>((*(++iter)).c_str()); + ly = boost::lexical_cast<S32>((*(++iter)).c_str()); + lz = boost::lexical_cast<S32>((*(++iter)).c_str()); + } + catch( boost::bad_lexical_cast& ) + { + LL_WARNS("parse_lure_bucket") + << "Couldn't parse lure bucket." + << LL_ENDL; + return false; + } + // Grab region access + region_access = SIM_ACCESS_MIN; + if (++iter != tokens.end()) + { + std::string access_str((*iter).c_str()); + LLStringUtil::trim(access_str); + if ( access_str == "A" ) + { + region_access = SIM_ACCESS_ADULT; + } + else if ( access_str == "M" ) + { + region_access = SIM_ACCESS_MATURE; + } + else if ( access_str == "PG" ) + { + region_access = SIM_ACCESS_PG; + } + } + + pos.setVec((F32)rx, (F32)ry, (F32)rz); + look_at.setVec((F32)lx, (F32)ly, (F32)lz); + + region_handle = to_region_handle(gx, gy); + return true; +} + +// Strip out "Resident" for display, but only if the message came from a user +// (rather than a script) +static std::string clean_name_from_im(const std::string& name, EInstantMessage type) +{ + switch(type) + { + case IM_NOTHING_SPECIAL: + case IM_MESSAGEBOX: + case IM_GROUP_INVITATION: + case IM_INVENTORY_OFFERED: + case IM_INVENTORY_ACCEPTED: + case IM_INVENTORY_DECLINED: + case IM_GROUP_VOTE: + case IM_GROUP_MESSAGE_DEPRECATED: + //IM_TASK_INVENTORY_OFFERED + //IM_TASK_INVENTORY_ACCEPTED + //IM_TASK_INVENTORY_DECLINED + case IM_NEW_USER_DEFAULT: + case IM_SESSION_INVITE: + case IM_SESSION_P2P_INVITE: + case IM_SESSION_GROUP_START: + case IM_SESSION_CONFERENCE_START: + case IM_SESSION_SEND: + case IM_SESSION_LEAVE: + //IM_FROM_TASK + case IM_BUSY_AUTO_RESPONSE: + case IM_CONSOLE_AND_CHAT_HISTORY: + case IM_LURE_USER: + case IM_LURE_ACCEPTED: + case IM_LURE_DECLINED: + case IM_GODLIKE_LURE_USER: + case IM_YET_TO_BE_USED: + case IM_GROUP_ELECTION_DEPRECATED: + //IM_GOTO_URL + //IM_FROM_TASK_AS_ALERT + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_INVENTORY_ACCEPTED: + case IM_GROUP_NOTICE_INVENTORY_DECLINED: + case IM_GROUP_INVITATION_ACCEPT: + case IM_GROUP_INVITATION_DECLINE: + case IM_GROUP_NOTICE_REQUESTED: + case IM_FRIENDSHIP_OFFERED: + case IM_FRIENDSHIP_ACCEPTED: + case IM_FRIENDSHIP_DECLINED_DEPRECATED: + //IM_TYPING_START + //IM_TYPING_STOP + return LLCacheName::cleanFullName(name); + default: + return name; + } +} + +static std::string clean_name_from_task_im(const std::string& msg, + BOOL from_group) +{ + boost::smatch match; + static const boost::regex returned_exp( + "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)"); + if (boost::regex_match(msg, match, returned_exp)) + { + // match objects are 1-based for groups + std::string final = match[1].str(); + std::string name = match[2].str(); + // Don't try to clean up group names + if (!from_group) + { + if (LLAvatarNameCache::useDisplayNames()) + { + // ...just convert to username + final += LLCacheName::buildUsername(name); + } + else + { + // ...strip out legacy "Resident" name + final += LLCacheName::cleanFullName(name); + } + } + final += match[3].str(); + return final; + } + return msg; +} + +void notification_display_name_callback(const LLUUID& id, + const LLAvatarName& av_name, + const std::string& name, + LLSD& substitutions, + const LLSD& payload) +{ + substitutions["NAME"] = av_name.mDisplayName; + LLNotificationsUtil::add(name, substitutions, payload); +} + +class LLPostponedIMSystemTipNotification: public LLPostponedNotification +{ +protected: + /* virtual */ + void modifyNotificationParams() + { + LLSD payload = mParams.payload; + payload["SESSION_NAME"] = mName; + mParams.payload = payload; + } + +}; + +// Callback for name resolution of a god/estate message +void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message) +{ + LLSD args; + args["NAME"] = av_name.getCompleteName(); + args["MESSAGE"] = message; + LLNotificationsUtil::add("GodMessage", args); + + // Treat like a system message and put in chat history. + chat.mText = av_name.getCompleteName() + ": " + message; + + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + if(nearby_chat) + { + nearby_chat->addMessage(chat); + } + +} + +void process_improved_im(LLMessageSystem *msg, void **user_data) +{ + if (gNoRender) + { + return; + } + LLUUID from_id; + BOOL from_group; + LLUUID to_id; + U8 offline; + U8 d = 0; + LLUUID session_id; + U32 timestamp; + std::string name; + std::string message; + U32 parent_estate_id = 0; + LLUUID region_id; + LLVector3 position; + U8 binary_bucket[MTUBYTES]; + S32 binary_bucket_size; + LLChat chat; + std::string buffer; + + // *TODO: Translate - need to fix the full name to first/last (maybe) + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id); + msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group); + msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id); + msg->getU8Fast( _PREHASH_MessageBlock, _PREHASH_Offline, offline); + msg->getU8Fast( _PREHASH_MessageBlock, _PREHASH_Dialog, d); + msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); + msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, timestamp); + //msg->getData("MessageBlock", "Count", &count); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); + msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message); + msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); + msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); + msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); + msg->getBinaryDataFast( _PREHASH_MessageBlock, _PREHASH_BinaryBucket, binary_bucket, 0, 0, MTUBYTES); + binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket); + EInstantMessage dialog = (EInstantMessage)d; + + // make sure that we don't have an empty or all-whitespace name + LLStringUtil::trim(name); + if (name.empty()) + { + name = LLTrans::getString("Unnamed"); + } + // IDEVO convert new-style "Resident" names for display + name = clean_name_from_im(name, dialog); + + BOOL is_busy = gAgent.getBusy(); + BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat); + BOOL is_linden = LLMuteList::getInstance()->isLinden(name); + BOOL is_owned_by_me = FALSE; + BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true; + BOOL accept_im_from_only_friend = gSavedSettings.getBOOL("VoiceCallsFriendsOnly"); + + chat.mMuted = is_muted && !is_linden; + chat.mFromID = from_id; + chat.mFromName = name; + chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; + + LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. + if (source) + { + is_owned_by_me = source->permYouOwner(); + } + + std::string separator_string(": "); + + LLSD args; + LLSD payload; + LLNotification::Params params; + + switch(dialog) + { + case IM_CONSOLE_AND_CHAT_HISTORY: + args["MESSAGE"] = message; + payload["from_id"] = from_id; + + params.name = "IMSystemMessageTip"; + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false); + break; + + case IM_NOTHING_SPECIAL: + // Don't show dialog, just do IM + if (!gAgent.isGodlike() + && gAgent.getRegion()->isPrelude() + && to_id.isNull() ) + { + // do nothing -- don't distract newbies in + // Prelude with global IMs + } + else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) + { + // return a standard "busy" message, but only do it to online IM + // (i.e. not other auto responses and not store-and-forward IM) + if (!gIMMgr->hasSession(session_id)) + { + // if there is not a panel for this conversation (i.e. it is a new IM conversation + // initiated by the other party) then... + std::string my_name; + LLAgentUI::buildFullname(my_name); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); + pack_instant_message( + gMessageSystem, + gAgent.getID(), + FALSE, + gAgent.getSessionID(), + from_id, + my_name, + response, + IM_ONLINE, + IM_BUSY_AUTO_RESPONSE, + session_id); + gAgent.sendReliableMessage(); + } + + // now store incoming IM in chat history + + buffer = message; + + LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + + // add to IM panel, but do not bother the user + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + LLStringUtil::null, + dialog, + parent_estate_id, + region_id, + position, + true); + } + else if (from_id.isNull()) + { + LLSD args; + args["MESSAGE"] = message; + LLNotificationsUtil::add("SystemMessage", args); + } + else if (to_id.isNull()) + { + // Message to everyone from GOD, look up the fullname since + // server always slams name to legacy names + LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message)); + } + else + { + // standard message, not from system + std::string saved; + if(offline == IM_OFFLINE) + { + LLStringUtil::format_map_t args; + args["[LONG_TIMESTAMP]"] = formatted_time(timestamp); + saved = LLTrans::getString("Saved_message", args); + } + buffer = saved + message; + + LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; + + bool mute_im = is_muted; + if(accept_im_from_only_friend&&!is_friend) + { + mute_im = true; + } + if (!mute_im || is_linden) + { + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + LLStringUtil::null, + dialog, + parent_estate_id, + region_id, + position, + true); + } + else + { + /* + EXT-5099 + currently there is no way to store in history only... + using LLNotificationsUtil::add will add message to Nearby Chat + + // muted user, so don't start an IM session, just record line in chat + // history. Pretend the chat is from a local agent, + // so it will go into the history but not be shown on screen. + + LLSD args; + args["MESSAGE"] = buffer; + LLNotificationsUtil::add("SystemMessageTip", args); + */ + } + } + break; + + case IM_TYPING_START: + { + LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem); + gIMMgr->processIMTypingStart(im_info); + } + break; + + case IM_TYPING_STOP: + { + LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem); + gIMMgr->processIMTypingStop(im_info); + } + break; + + case IM_MESSAGEBOX: + { + // This is a block, modeless dialog. + //*TODO: Translate + args["MESSAGE"] = message; + LLNotificationsUtil::add("SystemMessageTip", args); + } + break; + case IM_GROUP_NOTICE: + case IM_GROUP_NOTICE_REQUESTED: + { + LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL; + // Read the binary bucket for more information. + struct notice_bucket_header_t + { + U8 has_inventory; + U8 asset_type; + LLUUID group_id; + }; + struct notice_bucket_full_t + { + struct notice_bucket_header_t header; + U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE]; + }* notice_bin_bucket; + + // Make sure the binary bucket is big enough to hold the header + // and a null terminated item name. + if ( (binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8)))) + || (binary_bucket[binary_bucket_size - 1] != '\0') ) + { + LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL; + break; + } + + notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0]; + U8 has_inventory = notice_bin_bucket->header.has_inventory; + U8 asset_type = notice_bin_bucket->header.asset_type; + LLUUID group_id = notice_bin_bucket->header.group_id; + std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name); + + // If there is inventory, give the user the inventory offer. + LLOfferInfo* info = NULL; + + if (has_inventory) + { + info = new LLOfferInfo(); + + info->mIM = IM_GROUP_NOTICE; + info->mFromID = from_id; + info->mFromGroup = from_group; + info->mTransactionID = session_id; + info->mType = (LLAssetType::EType) asset_type; + info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType)); + std::string from_name; + + from_name += "A group member named "; + from_name += name; + + info->mFromName = from_name; + info->mDesc = item_name; + info->mHost = msg->getSender(); + } + + std::string str(message); + + // Tokenize the string. + // TODO: Support escaped tokens ("||" -> "|") + typedef boost::tokenizer<boost::char_separator<char> > tokenizer; + boost::char_separator<char> sep("|","",boost::keep_empty_tokens); + tokenizer tokens(str, sep); + tokenizer::iterator iter = tokens.begin(); + + std::string subj(*iter++); + std::string mes(*iter++); + + // Send the notification down the new path. + // For requested notices, we don't want to send the popups. + if (dialog != IM_GROUP_NOTICE_REQUESTED) + { + payload["subject"] = subj; + payload["message"] = mes; + payload["sender_name"] = name; + payload["group_id"] = group_id; + payload["inventory_name"] = item_name; + payload["inventory_offer"] = info ? info->asLLSD() : LLSD(); + + LLSD args; + args["SUBJECT"] = subj; + args["MESSAGE"] = mes; + LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(timestamp)); + } + + // Also send down the old path for now. + if (IM_GROUP_NOTICE_REQUESTED == dialog) + { + + LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info); + } + else + { + delete info; + } + } + break; + case IM_GROUP_INVITATION: + { + //if (!is_linden && (is_busy || is_muted)) + if ((is_busy || is_muted)) + { + LLMessageSystem *msg = gMessageSystem; + busy_message(msg,from_id); + } + else + { + LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL; + // Read the binary bucket for more information. + struct invite_bucket_t + { + S32 membership_fee; + LLUUID role_id; + }* invite_bucket; + + // Make sure the binary bucket is the correct size. + if (binary_bucket_size != sizeof(invite_bucket_t)) + { + LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL; + break; + } + + invite_bucket = (struct invite_bucket_t*) &binary_bucket[0]; + S32 membership_fee = ntohl(invite_bucket->membership_fee); + + LLSD payload; + payload["transaction_id"] = session_id; + payload["group_id"] = from_id; + payload["name"] = name; + payload["message"] = message; + payload["fee"] = membership_fee; + + LLSD args; + args["MESSAGE"] = message; + // we shouldn't pass callback functor since it is registered in LLFunctorRegistration + LLNotificationsUtil::add("JoinGroup", args, payload); + } + } + break; + + case IM_INVENTORY_OFFERED: + case IM_TASK_INVENTORY_OFFERED: + // Someone has offered us some inventory. + { + LLOfferInfo* info = new LLOfferInfo; + if (IM_INVENTORY_OFFERED == dialog) + { + struct offer_agent_bucket_t + { + S8 asset_type; + LLUUID object_id; + }* bucketp; + + if (sizeof(offer_agent_bucket_t) != binary_bucket_size) + { + LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL; + delete info; + break; + } + bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0]; + info->mType = (LLAssetType::EType) bucketp->asset_type; + info->mObjectID = bucketp->object_id; + } + else + { + if (sizeof(S8) != binary_bucket_size) + { + LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL; + delete info; + break; + } + info->mType = (LLAssetType::EType) binary_bucket[0]; + info->mObjectID = LLUUID::null; + } + + info->mIM = dialog; + info->mFromID = from_id; + info->mFromGroup = from_group; + info->mTransactionID = session_id; + info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType)); + + if (dialog == IM_TASK_INVENTORY_OFFERED) + { + info->mFromObject = TRUE; + } + else + { + info->mFromObject = FALSE; + } + info->mFromName = name; + info->mDesc = message; + info->mHost = msg->getSender(); + //if (((is_busy && !is_owned_by_me) || is_muted)) + if (is_muted) + { + // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331) + LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID); + fetch_item->startFetch(); + delete fetch_item; + + // Same as closing window + info->forceResponse(IOR_DECLINE); + } + else + { + inventory_offer_handler(info); + } + } + break; + + case IM_INVENTORY_ACCEPTED: + { + args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("InventoryAccepted", args, payload); + break; + } + case IM_INVENTORY_DECLINED: + { + args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();; + LLSD payload; + payload["from_id"] = from_id; + LLNotificationsUtil::add("InventoryDeclined", args, payload); + break; + } + // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856 + case IM_GROUP_VOTE: + { + LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL; + } + break; + + case IM_GROUP_ELECTION_DEPRECATED: + { + LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL; + } + break; + + case IM_SESSION_SEND: + { + if (!is_linden && is_busy) + { + return; + } + + // Only show messages if we have a session open (which + // should happen after you get an "invitation" + if ( !gIMMgr->hasSession(session_id) ) + { + return; + } + + // standard message, not from system + std::string saved; + if(offline == IM_OFFLINE) + { + saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); + } + buffer = saved + message; + BOOL is_this_agent = FALSE; + if(from_id == gAgentID) + { + is_this_agent = TRUE; + } + gIMMgr->addMessage( + session_id, + from_id, + name, + buffer, + ll_safe_string((char*)binary_bucket), + IM_SESSION_INVITE, + parent_estate_id, + region_id, + position, + true); + } + break; + + case IM_FROM_TASK: + { + if (is_busy && !is_owned_by_me) + { + return; + } + + // Build a link to open the object IM info window. + std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1); + + if (session_id.notNull()) + { + chat.mFromID = session_id; + } + else + { + // This message originated on a region without the updated code for task id and slurl information. + // We just need a unique ID for this object that isn't the owner ID. + // If it is the owner ID it will overwrite the style that contains the link to that owner's profile. + // This isn't ideal - it will make 1 style for all objects owned by the the same person/group. + // This works because the only thing we can really do in this case is show the owner name and link to their profile. + chat.mFromID = from_id ^ gAgent.getSessionID(); + } + + chat.mSourceType = CHAT_SOURCE_OBJECT; + + if(SYSTEM_FROM == name) + { + // System's UUID is NULL (fixes EXT-4766) + chat.mFromID = LLUUID::null; + chat.mSourceType = CHAT_SOURCE_SYSTEM; + } + + // IDEVO Some messages have embedded resident names + message = clean_name_from_task_im(message, from_group); + + LLSD query_string; + query_string["owner"] = from_id; + query_string["slurl"] = location; + query_string["name"] = name; + if (from_group) + { + query_string["groupowned"] = "true"; + } + + chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString(); + chat.mText = message; + + // Note: lie to Nearby Chat, pretending that this is NOT an IM, because + // IMs from obejcts don't open IM sessions. + LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD()); + if(SYSTEM_FROM != name && nearby_chat) + { + chat.mOwnerID = from_id; + LLSD args; + args["slurl"] = location; + args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + + // Look for IRC-style emotes here so object name formatting is correct + std::string prefix = message.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + chat.mChatStyle = CHAT_STYLE_IRC; + } + + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + } + + + //Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590) + if (SYSTEM_FROM != name) break; + + LLSD substitutions; + substitutions["NAME"] = name; + substitutions["MSG"] = message; + + LLSD payload; + payload["object_id"] = session_id; + payload["owner_id"] = from_id; + payload["from_id"] = from_id; + payload["slurl"] = location; + payload["name"] = name; + std::string session_name; + if (from_group) + { + payload["group_owned"] = "true"; + } + + LLNotification::Params params("ServerObjectMessage"); + params.substitutions = substitutions; + params.payload = payload; + + LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, from_group); + } + break; + case IM_FROM_TASK_AS_ALERT: + if (is_busy && !is_owned_by_me) + { + return; + } + { + // Construct a viewer alert for this message. + args["NAME"] = name; + args["MESSAGE"] = message; + LLNotificationsUtil::add("ObjectMessage", args); + } + break; + case IM_BUSY_AUTO_RESPONSE: + if (is_muted) + { + LL_DEBUGS("Messaging") << "Ignoring busy response from " << from_id << LL_ENDL; + return; + } + else + { + // TODO: after LLTrans hits release, get "busy response" into translatable file + buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.c_str()); + gIMMgr->addMessage(session_id, from_id, name, buffer); + } + break; + + case IM_LURE_USER: + { + if (is_muted) + { + return; + } + else if (is_busy) + { + busy_message(msg,from_id); + } + else + { + LLVector3 pos, look_at; + U64 region_handle; + U8 region_access = SIM_ACCESS_MIN; + std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size); + std::string region_access_str = LLStringUtil::null; + std::string region_access_icn = LLStringUtil::null; + + if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access)) + { + region_access_str = LLViewerRegion::accessToString(region_access); + region_access_icn = LLViewerRegion::getAccessIcon(region_access); + } + + LLSD args; + // *TODO: Translate -> [FIRST] [LAST] (maybe) + args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); + args["MESSAGE"] = message; + args["MATURITY_STR"] = region_access_str; + args["MATURITY_ICON"] = region_access_icn; + LLSD payload; + payload["from_id"] = from_id; + payload["lure_id"] = session_id; + payload["godlike"] = FALSE; + + LLNotification::Params params("TeleportOffered"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false); + } + } + break; + + case IM_GODLIKE_LURE_USER: + { + LLSD payload; + payload["from_id"] = from_id; + payload["lure_id"] = session_id; + payload["godlike"] = TRUE; + // do not show a message box, because you're about to be + // teleported. + LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0); + } + break; + + case IM_GOTO_URL: + { + LLSD args; + // n.b. this is for URLs sent by the system, not for + // URLs sent by scripts (i.e. llLoadURL) + if (binary_bucket_size <= 0) + { + LL_WARNS("Messaging") << "bad binary_bucket_size: " + << binary_bucket_size + << " - aborting function." << LL_ENDL; + return; + } + + std::string url; + + url.assign((char*)binary_bucket, binary_bucket_size-1); + args["MESSAGE"] = message; + args["URL"] = url; + LLSD payload; + payload["url"] = url; + LLNotificationsUtil::add("GotoURL", args, payload ); + } + break; + + case IM_FRIENDSHIP_OFFERED: + { + LLSD payload; + payload["from_id"] = from_id; + payload["session_id"] = session_id;; + payload["online"] = (offline == IM_ONLINE); + payload["sender"] = msg->getSender().getIPandPort(); + + if (is_busy) + { + busy_message(msg, from_id); + LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); + } + else if (is_muted) + { + LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1); + } + else + { + args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString(); + if(message.empty()) + { + //support for frienship offers from clients before July 2008 + LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload); + } + else + { + args["[MESSAGE]"] = message; + LLNotification::Params params("OfferFriendship"); + params.substitutions = args; + params.payload = payload; + LLPostponedNotification::add<LLPostponedOfferNotification>( params, from_id, false); + } + } + } + break; + + case IM_FRIENDSHIP_ACCEPTED: + { + // In the case of an offline IM, the formFriendship() may be extraneous + // as the database should already include the relationship. But it + // doesn't hurt for dupes. + LLAvatarTracker::formFriendship(from_id); + + std::vector<std::string> strings; + strings.push_back(from_id.asString()); + send_generic_message("requestonlinenotification", strings); + + args["NAME"] = name; + LLSD payload; + payload["from_id"] = from_id; + LLAvatarNameCache::get(from_id, boost::bind(¬ification_display_name_callback, + _1, + _2, + "FriendshipAccepted", + args, + payload)); + } + break; + + case IM_FRIENDSHIP_DECLINED_DEPRECATED: + default: + LL_WARNS("Messaging") << "Instant message calling for unknown dialog " + << (S32)dialog << LL_ENDL; + break; + } + + LLWindow* viewer_window = gViewerWindow->getWindow(); + if (viewer_window && viewer_window->getMinimized()) + { + viewer_window->flashIcon(5.f); + } +} + +void busy_message (LLMessageSystem* msg, LLUUID from_id) +{ + if (gAgent.getBusy()) + { + std::string my_name; + LLAgentUI::buildFullname(my_name); + std::string response = gSavedPerAccountSettings.getString("BusyModeResponse"); + pack_instant_message( + gMessageSystem, + gAgent.getID(), + FALSE, + gAgent.getSessionID(), + from_id, + my_name, + response, + IM_ONLINE, + IM_BUSY_AUTO_RESPONSE); + gAgent.sendReliableMessage(); + } +} + +bool callingcard_offer_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLUUID fid; + LLUUID from_id; + LLMessageSystem* msg = gMessageSystem; + switch(option) + { + case 0: + // accept + msg->newMessageFast(_PREHASH_AcceptCallingCard); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_TransactionBlock); + msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID()); + fid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + msg->nextBlockFast(_PREHASH_FolderData); + msg->addUUIDFast(_PREHASH_FolderID, fid); + msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); + break; + case 1: + // decline + msg->newMessageFast(_PREHASH_DeclineCallingCard); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_TransactionBlock); + msg->addUUIDFast(_PREHASH_TransactionID, notification["payload"]["transaction_id"].asUUID()); + msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); + busy_message(msg, notification["payload"]["source_id"].asUUID()); + break; + default: + // close button probably, possibly timed out + break; + } + + return false; +} +static LLNotificationFunctorRegistration callingcard_offer_cb_reg("OfferCallingCard", callingcard_offer_callback); + +void process_offer_callingcard(LLMessageSystem* msg, void**) +{ + // someone has offered to form a friendship + LL_DEBUGS("Messaging") << "callingcard offer" << LL_ENDL; + + LLUUID source_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, source_id); + LLUUID tid; + msg->getUUIDFast(_PREHASH_AgentBlock, _PREHASH_TransactionID, tid); + + LLSD payload; + payload["transaction_id"] = tid; + payload["source_id"] = source_id; + payload["sender"] = msg->getSender().getIPandPort(); + + LLViewerObject* source = gObjectList.findObject(source_id); + LLSD args; + std::string source_name; + if(source && source->isAvatar()) + { + LLNameValue* nvfirst = source->getNVPair("FirstName"); + LLNameValue* nvlast = source->getNVPair("LastName"); + if (nvfirst && nvlast) + { + source_name = LLCacheName::buildFullName( + nvfirst->getString(), nvlast->getString()); + } + } + + if(!source_name.empty()) + { + if (gAgent.getBusy() + || LLMuteList::getInstance()->isMuted(source_id, source_name, LLMute::flagTextChat)) + { + // automatically decline offer + LLNotifications::instance().forceResponse(LLNotification::Params("OfferCallingCard").payload(payload), 1); + } + else + { + args["NAME"] = source_name; + LLNotificationsUtil::add("OfferCallingCard", args, payload); + } + } + else + { + LL_WARNS("Messaging") << "Calling card offer from an unknown source." << LL_ENDL; + } +} + +void process_accept_callingcard(LLMessageSystem* msg, void**) +{ + LLNotificationsUtil::add("CallingCardAccepted"); +} + +void process_decline_callingcard(LLMessageSystem* msg, void**) +{ + LLNotificationsUtil::add("CallingCardDeclined"); +} + +class ChatTranslationReceiver : public LLTranslate::TranslationReceiver +{ +public : + ChatTranslationReceiver(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, + const LLChat &chat, const LLSD &toast_args) + : LLTranslate::TranslationReceiver(from_lang, to_lang), + m_chat(chat), + m_toastArgs(toast_args), + m_origMesg(mesg) + { + } + + static boost::intrusive_ptr<ChatTranslationReceiver> build(const std::string &from_lang, const std::string &to_lang, const std::string &mesg, const LLChat &chat, const LLSD &toast_args) + { + return boost::intrusive_ptr<ChatTranslationReceiver>(new ChatTranslationReceiver(from_lang, to_lang, mesg, chat, toast_args)); + } + +protected: + void handleResponse(const std::string &translation, const std::string &detected_language) + { + // filter out non-interesting responeses + if ( !translation.empty() + && (m_toLang != detected_language) + && (LLStringUtil::compareInsensitive(translation, m_origMesg) != 0) ) + { + m_chat.mText += " (" + translation + ")"; + } + + LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs); + } + + void handleFailure() + { + LLTranslate::TranslationReceiver::handleFailure(); + m_chat.mText += " (?)"; + + LLNotificationsUI::LLNotificationManager::instance().onChat(m_chat, m_toastArgs); + } + +private: + LLChat m_chat; + std::string m_origMesg; + LLSD m_toastArgs; +}; +void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) +{ + LLChat chat; + std::string mesg; + std::string from_name; + U8 source_temp; + U8 type_temp; + U8 audible_temp; + LLColor4 color(1.0f, 1.0f, 1.0f, 1.0f); + LLUUID from_id; + LLUUID owner_id; + BOOL is_owned_by_me = FALSE; + LLViewerObject* chatter; + + msg->getString("ChatData", "FromName", from_name); + + msg->getUUID("ChatData", "SourceID", from_id); + chat.mFromID = from_id; + + // Object owner for objects + msg->getUUID("ChatData", "OwnerID", owner_id); + + msg->getU8Fast(_PREHASH_ChatData, _PREHASH_SourceType, source_temp); + chat.mSourceType = (EChatSourceType)source_temp; + + msg->getU8("ChatData", "ChatType", type_temp); + chat.mChatType = (EChatType)type_temp; + + msg->getU8Fast(_PREHASH_ChatData, _PREHASH_Audible, audible_temp); + chat.mAudible = (EChatAudible)audible_temp; + + chat.mTime = LLFrameTimer::getElapsedSeconds(); + + // IDEVO Correct for new-style "Resident" names + if (chat.mSourceType == CHAT_SOURCE_AGENT) + { + // I don't know if it's OK to change this here, if + // anything downstream does lookups by name, for instance + + LLAvatarName av_name; + if (LLAvatarNameCache::get(from_id, &av_name)) + { + chat.mFromName = av_name.mDisplayName; + } + else + { + chat.mFromName = LLCacheName::cleanFullName(from_name); + } + } + else + { + chat.mFromName = from_name; + } + + BOOL is_busy = gAgent.getBusy(); + + BOOL is_muted = FALSE; + BOOL is_linden = FALSE; + is_muted = LLMuteList::getInstance()->isMuted( + from_id, + from_name, + LLMute::flagTextChat) + || LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagTextChat); + is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT && + LLMuteList::getInstance()->isLinden(from_name); + + BOOL is_audible = (CHAT_AUDIBLE_FULLY == chat.mAudible); + chatter = gObjectList.findObject(from_id); + if (chatter) + { + chat.mPosAgent = chatter->getPositionAgent(); + + // Make swirly things only for talking objects. (not script debug messages, though) + if (chat.mSourceType == CHAT_SOURCE_OBJECT + && chat.mChatType != CHAT_TYPE_DEBUG_MSG + && gSavedSettings.getBOOL("EffectScriptChatParticles") ) + { + LLPointer<LLViewerPartSourceChat> psc = new LLViewerPartSourceChat(chatter->getPositionAgent()); + psc->setSourceObject(chatter); + psc->setColor(color); + //We set the particles to be owned by the object's owner, + //just in case they should be muted by the mute list + psc->setOwnerUUID(owner_id); + LLViewerPartSim::getInstance()->addPartSource(psc); + } + + // record last audible utterance + if (is_audible + && (is_linden || (!is_muted && !is_busy))) + { + if (chat.mChatType != CHAT_TYPE_START + && chat.mChatType != CHAT_TYPE_STOP) + { + gAgent.heardChat(chat.mFromID); + } + } + + is_owned_by_me = chatter->permYouOwner(); + } + + if (is_audible) + { + BOOL visible_in_chat_bubble = FALSE; + std::string verb; + + color.setVec(1.f,1.f,1.f,1.f); + msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); + + BOOL ircstyle = FALSE; + + // Look for IRC-style emotes here so chatbubbles work + std::string prefix = mesg.substr(0, 4); + if (prefix == "/me " || prefix == "/me'") + { + ircstyle = TRUE; + } + chat.mText = mesg; + + // Look for the start of typing so we can put "..." in the bubbles. + if (CHAT_TYPE_START == chat.mChatType) + { + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, TRUE); + + // Might not have the avatar constructed yet, eg on login. + if (chatter && chatter->isAvatar()) + { + ((LLVOAvatar*)chatter)->startTyping(); + } + return; + } + else if (CHAT_TYPE_STOP == chat.mChatType) + { + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + + // Might not have the avatar constructed yet, eg on login. + if (chatter && chatter->isAvatar()) + { + ((LLVOAvatar*)chatter)->stopTyping(); + } + return; + } + + // Look for IRC-style emotes + if (ircstyle) + { + // set CHAT_STYLE_IRC to avoid adding Avatar Name as author of message. See EXT-656 + chat.mChatStyle = CHAT_STYLE_IRC; + + // Do nothing, ircstyle is fixed above for chat bubbles + } + else + { + switch(chat.mChatType) + { + case CHAT_TYPE_WHISPER: + verb = LLTrans::getString("whisper") + " "; + break; + case CHAT_TYPE_DEBUG_MSG: + case CHAT_TYPE_OWNER: + case CHAT_TYPE_NORMAL: + verb = ""; + break; + case CHAT_TYPE_SHOUT: + verb = LLTrans::getString("shout") + " "; + break; + case CHAT_TYPE_START: + case CHAT_TYPE_STOP: + LL_WARNS("Messaging") << "Got chat type start/stop in main chat processing." << LL_ENDL; + break; + default: + LL_WARNS("Messaging") << "Unknown type " << chat.mChatType << " in chat!" << LL_ENDL; + verb = ""; + break; + } + + + chat.mText = ""; + chat.mText += verb; + chat.mText += mesg; + } + + // We have a real utterance now, so can stop showing "..." and proceed. + if (chatter && chatter->isAvatar()) + { + LLLocalSpeakerMgr::getInstance()->setSpeakerTyping(from_id, FALSE); + ((LLVOAvatar*)chatter)->stopTyping(); + + if (!is_muted && !is_busy) + { + visible_in_chat_bubble = gSavedSettings.getBOOL("UseChatBubbles"); + std::string formated_msg = ""; + LLViewerChat::formatChatMsg(chat, formated_msg); + LLChat chat_bubble = chat; + chat_bubble.mText = formated_msg; + ((LLVOAvatar*)chatter)->addChat(chat_bubble); + } + } + + if (chatter) + { + chat.mPosAgent = chatter->getPositionAgent(); + } + + // truth table: + // LINDEN BUSY MUTED OWNED_BY_YOU TASK DISPLAY STORE IN HISTORY + // F F F F * Yes Yes + // F F F T * Yes Yes + // F F T F * No No + // F F T T * No No + // F T F F * No Yes + // F T F T * Yes Yes + // F T T F * No No + // F T T T * No No + // T * * * F Yes Yes + + chat.mMuted = is_muted && !is_linden; + + // pass owner_id to chat so that we can display the remote + // object inspect for an object that is chatting with you + LLSD args; + args["type"] = LLNotificationsUI::NT_NEARBYCHAT; + chat.mOwnerID = owner_id; + + if (gSavedSettings.getBOOL("TranslateChat") && chat.mSourceType != CHAT_SOURCE_SYSTEM) + { + if (chat.mChatStyle == CHAT_STYLE_IRC) + { + mesg = mesg.substr(4, std::string::npos); + } + const std::string from_lang = ""; // leave empty to trigger autodetect + const std::string to_lang = LLTranslate::getTranslateLanguage(); + + LLHTTPClient::ResponderPtr result = ChatTranslationReceiver::build(from_lang, to_lang, mesg, chat, args); + LLTranslate::translateMessage(result, from_lang, to_lang, mesg); + } + else + { + LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args); + } + } +} + + +// Simulator we're on is informing the viewer that the agent +// is starting to teleport (perhaps to another sim, perhaps to the +// same sim). If we initiated the teleport process by sending some kind +// of TeleportRequest, then this info is redundant, but if the sim +// initiated the teleport (via a script call, being killed, etc.) +// then this info is news to us. +void process_teleport_start(LLMessageSystem *msg, void**) +{ + // on teleport, don't tell them about destination guide anymore + LLFirstUse::notUsingDestinationGuide(false); + U32 teleport_flags = 0x0; + msg->getU32("Info", "TeleportFlags", teleport_flags); + + LL_DEBUGS("Messaging") << "Got TeleportStart with TeleportFlags=" << teleport_flags << ". gTeleportDisplay: " << gTeleportDisplay << ", gAgent.mTeleportState: " << gAgent.getTeleportState() << LL_ENDL; + + if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) + { + gViewerWindow->setProgressCancelButtonVisible(FALSE); + } + else + { + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); + } + + // Freeze the UI and show progress bar + // Note: could add data here to differentiate between normal teleport and death. + + if( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) + { + gTeleportDisplay = TRUE; + gAgent.setTeleportState( LLAgent::TELEPORT_START ); + make_ui_sound("UISndTeleportOut"); + + LL_INFOS("Messaging") << "Teleport initiated by remote TeleportStart message with TeleportFlags: " << teleport_flags << LL_ENDL; + // Don't call LLFirstUse::useTeleport here because this could be + // due to being killed, which would send you home, not to a Telehub + } +} + +void process_teleport_progress(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + msg->getUUID("AgentData", "AgentID", agent_id); + if((gAgent.getID() != agent_id) + || (gAgent.getTeleportState() == LLAgent::TELEPORT_NONE)) + { + LL_WARNS("Messaging") << "Unexpected teleport progress message." << LL_ENDL; + return; + } + U32 teleport_flags = 0x0; + msg->getU32("Info", "TeleportFlags", teleport_flags); + if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) + { + gViewerWindow->setProgressCancelButtonVisible(FALSE); + } + else + { + gViewerWindow->setProgressCancelButtonVisible(TRUE, LLTrans::getString("Cancel")); + } + std::string buffer; + msg->getString("Info", "Message", buffer); + LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL; + + //Sorta hacky...default to using simulator raw messages + //if we don't find the coresponding mapping in our progress mappings + std::string message = buffer; + + if (LLAgent::sTeleportProgressMessages.find(buffer) != + LLAgent::sTeleportProgressMessages.end() ) + { + message = LLAgent::sTeleportProgressMessages[buffer]; + } + + gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages[message]); +} + +class LLFetchInWelcomeArea : public LLInventoryFetchDescendentsObserver +{ +public: + LLFetchInWelcomeArea(const uuid_vec_t &ids) : + LLInventoryFetchDescendentsObserver(ids) + {} + virtual void done() + { + LLIsType is_landmark(LLAssetType::AT_LANDMARK); + LLIsType is_card(LLAssetType::AT_CALLINGCARD); + + LLInventoryModel::cat_array_t card_cats; + LLInventoryModel::item_array_t card_items; + LLInventoryModel::cat_array_t land_cats; + LLInventoryModel::item_array_t land_items; + + uuid_vec_t::iterator it = mComplete.begin(); + uuid_vec_t::iterator end = mComplete.end(); + for(; it != end; ++it) + { + gInventory.collectDescendentsIf( + (*it), + land_cats, + land_items, + LLInventoryModel::EXCLUDE_TRASH, + is_landmark); + gInventory.collectDescendentsIf( + (*it), + card_cats, + card_items, + LLInventoryModel::EXCLUDE_TRASH, + is_card); + } + LLSD args; + if ( land_items.count() > 0 ) + { // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory + S32 random_land = ll_rand( land_items.count() - 1 ); + args["NAME"] = land_items[random_land]->getName(); + LLNotificationsUtil::add("TeleportToLandmark",args); + } + if ( card_items.count() > 0 ) + { // Show notification that they can now contact people. Use a random calling card from the inventory + S32 random_card = ll_rand( card_items.count() - 1 ); + args["NAME"] = card_items[random_card]->getName(); + LLNotificationsUtil::add("TeleportToPerson",args); + } + + gInventory.removeObserver(this); + delete this; + } +}; + + + +class LLPostTeleportNotifiers : public LLEventTimer +{ +public: + LLPostTeleportNotifiers(); + virtual ~LLPostTeleportNotifiers(); + + //function to be called at the supplied frequency + virtual BOOL tick(); +}; + +LLPostTeleportNotifiers::LLPostTeleportNotifiers() : LLEventTimer( 2.0 ) +{ +}; + +LLPostTeleportNotifiers::~LLPostTeleportNotifiers() +{ +} + +BOOL LLPostTeleportNotifiers::tick() +{ + BOOL all_done = FALSE; + if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE ) + { + // get callingcards and landmarks available to the user arriving. + uuid_vec_t folders; + const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD); + if(callingcard_id.notNull()) + folders.push_back(callingcard_id); + const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK); + if(folder_id.notNull()) + folders.push_back(folder_id); + if(!folders.empty()) + { + LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea(folders); + fetcher->startFetch(); + if(fetcher->isFinished()) + { + fetcher->done(); + } + else + { + gInventory.addObserver(fetcher); + } + } + all_done = TRUE; + } + + return all_done; +} + + + +// Teleport notification from the simulator +// We're going to pretend to be a new agent +void process_teleport_finish(LLMessageSystem* msg, void**) +{ + LL_DEBUGS("Messaging") << "Got teleport location message" << LL_ENDL; + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id); + if (agent_id != gAgent.getID()) + { + LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL; + return; + } + + // Teleport is finished; it can't be cancelled now. + gViewerWindow->setProgressCancelButtonVisible(FALSE); + + // Do teleport effect for where you're leaving + // VEFFECT: TeleportStart + LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp->setPositionGlobal(gAgent.getPositionGlobal()); + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + LLHUDManager::getInstance()->sendEffects(); + + U32 location_id; + U32 sim_ip; + U16 sim_port; + LLVector3 pos, look_at; + U64 region_handle; + msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id); + msg->getIPAddrFast(_PREHASH_Info, _PREHASH_SimIP, sim_ip); + msg->getIPPortFast(_PREHASH_Info, _PREHASH_SimPort, sim_port); + //msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos); + //msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at); + msg->getU64Fast(_PREHASH_Info, _PREHASH_RegionHandle, region_handle); + U32 teleport_flags; + msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); + + + std::string seedCap; + msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); + + // update home location if we are teleporting out of prelude - specific to teleporting to welcome area + if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET) + && (!gAgent.isGodlike())) + { + gAgent.setHomePosRegion(region_handle, pos); + + // Create a timer that will send notices when teleporting is all finished. Since this is + // based on the LLEventTimer class, it will be managed by that class and not orphaned or leaked. + new LLPostTeleportNotifiers(); + } + + LLHost sim_host(sim_ip, sim_port); + + // Viewer trusts the simulator. + gMessageSystem->enableCircuit(sim_host, TRUE); + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + +/* + // send camera update to new region + gAgentCamera.updateCamera(); + + // likewise make sure the camera is behind the avatar + gAgentCamera.resetView(TRUE); + LLVector3 shift_vector = regionp->getPosRegionFromGlobal(gAgent.getRegion()->getOriginGlobal()); + gAgent.setRegion(regionp); + gObjectList.shiftObjects(shift_vector); + + if (isAgentAvatarValid()) + { + gAgentAvatarp->clearChatText(); + gAgentCamera.slamLookAt(look_at); + } + gAgent.setPositionAgent(pos); + gAssetStorage->setUpstream(sim); + gCacheName->setUpstream(sim); +*/ + + // now, use the circuit info to tell simulator about us! + LL_INFOS("Messaging") << "process_teleport_finish() Enabling " + << sim_host << " with code " << msg->mOurCircuitCode << LL_ENDL; + msg->newMessageFast(_PREHASH_UseCircuitCode); + msg->nextBlockFast(_PREHASH_CircuitCode); + msg->addU32Fast(_PREHASH_Code, msg->getOurCircuitCode()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_ID, gAgent.getID()); + msg->sendReliable(sim_host); + + send_complete_agent_movement(sim_host); + gAgent.setTeleportState( LLAgent::TELEPORT_MOVING ); + gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]); + + regionp->setSeedCapability(seedCap); + + // Don't send camera updates to the new region until we're + // actually there... + + + // Now do teleport effect for where you're going. + // VEFFECT: TeleportEnd + effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); + effectp->setPositionGlobal(gAgent.getPositionGlobal()); + + effectp->setColor(LLColor4U(gAgent.getEffectColor())); + LLHUDManager::getInstance()->sendEffects(); + +// gTeleportDisplay = TRUE; +// gTeleportDisplayTimer.reset(); +// gViewerWindow->setShowProgress(TRUE); +} + +// stuff we have to do every time we get an AvatarInitComplete from a sim +/* +void process_avatar_init_complete(LLMessageSystem* msg, void**) +{ + LLVector3 agent_pos; + msg->getVector3Fast(_PREHASH_AvatarData, _PREHASH_Position, agent_pos); + agent_movement_complete(msg->getSender(), agent_pos); +} +*/ + +void process_agent_movement_complete(LLMessageSystem* msg, void**) +{ + gAgentMovementCompleted = true; + + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + LLUUID session_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); + if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id)) + { + LL_WARNS("Messaging") << "Incorrect id in process_agent_movement_complete()" + << LL_ENDL; + return; + } + + LL_DEBUGS("Messaging") << "process_agent_movement_complete()" << LL_ENDL; + + // *TODO: check timestamp to make sure the movement compleation + // makes sense. + LLVector3 agent_pos; + msg->getVector3Fast(_PREHASH_Data, _PREHASH_Position, agent_pos); + LLVector3 look_at; + msg->getVector3Fast(_PREHASH_Data, _PREHASH_LookAt, look_at); + U64 region_handle; + msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle); + + std::string version_channel; + msg->getString("SimData", "ChannelVersion", version_channel); + + if (!isAgentAvatarValid()) + { + // Could happen if you were immediately god-teleported away on login, + // maybe other cases. Continue, but warn. + LL_WARNS("Messaging") << "agent_movement_complete() with NULL avatarp." << LL_ENDL; + } + + F32 x, y; + from_region_handle(region_handle, &x, &y); + LLViewerRegion* regionp = LLWorld::getInstance()->getRegionFromHandle(region_handle); + if (!regionp) + { + if (gAgent.getRegion()) + { + LL_WARNS("Messaging") << "current region " << gAgent.getRegion()->getOriginGlobal() << LL_ENDL; + } + + LL_WARNS("Messaging") << "Agent being sent to invalid home region: " + << x << ":" << y + << " current pos " << gAgent.getPositionGlobal() + << LL_ENDL; + LLAppViewer::instance()->forceDisconnect(LLTrans::getString("SentToInvalidRegion")); + return; + + } + + LL_INFOS("Messaging") << "Changing home region to " << x << ":" << y << LL_ENDL; + + // set our upstream host the new simulator and shuffle things as + // appropriate. + LLVector3 shift_vector = regionp->getPosRegionFromGlobal( + gAgent.getRegion()->getOriginGlobal()); + gAgent.setRegion(regionp); + gObjectList.shiftObjects(shift_vector); + gAssetStorage->setUpstream(msg->getSender()); + gCacheName->setUpstream(msg->getSender()); + gViewerThrottle.sendToSim(); + gViewerWindow->sendShapeToSim(); + + bool is_teleport = gAgent.getTeleportState() == LLAgent::TELEPORT_MOVING; + + if( is_teleport ) + { + if (gAgent.getTeleportKeepsLookAt()) + { + // *NOTE: the LookAt data we get from the sim here doesn't + // seem to be useful, so get it from the camera instead + look_at = LLViewerCamera::getInstance()->getAtAxis(); + } + // Force the camera back onto the agent, don't animate. + gAgentCamera.setFocusOnAvatar(TRUE, FALSE); + gAgentCamera.slamLookAt(look_at); + gAgentCamera.updateCamera(); + + gAgent.setTeleportState( LLAgent::TELEPORT_START_ARRIVAL ); + + // set the appearance on teleport since the new sim does not + // know what you look like. + gAgent.sendAgentSetAppearance(); + + if (isAgentAvatarValid()) + { + // Chat the "back" SLURL. (DEV-4907) + + LLSLURL slurl; + gAgent.getTeleportSourceSLURL(slurl); + LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString()); + std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"]; + LLStringUtil::format(completed_from, substitution); + + LLSD args; + args["MESSAGE"] = completed_from; + LLNotificationsUtil::add("SystemMessageTip", args); + + // Set the new position + gAgentAvatarp->setPositionAgent(agent_pos); + gAgentAvatarp->clearChat(); + gAgentAvatarp->slamPosition(); + } + } + else + { + // This is initial log-in or a region crossing + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + + if(LLStartUp::getStartupState() < STATE_STARTED) + { // This is initial log-in, not a region crossing: + // Set the camera looking ahead of the AV so send_agent_update() below + // will report the correct location to the server. + LLVector3 look_at_point = look_at; + look_at_point = agent_pos + look_at_point.rotVec(gAgent.getQuat()); + + static LLVector3 up_direction(0.0f, 0.0f, 1.0f); + LLViewerCamera::getInstance()->lookAt(agent_pos, look_at_point, up_direction); + } + } + + if ( LLTracker::isTracking(NULL) ) + { + // Check distance to beacon, if < 5m, remove beacon + LLVector3d beacon_pos = LLTracker::getTrackedPositionGlobal(); + LLVector3 beacon_dir(agent_pos.mV[VX] - (F32)fmod(beacon_pos.mdV[VX], 256.0), agent_pos.mV[VY] - (F32)fmod(beacon_pos.mdV[VY], 256.0), 0); + if (beacon_dir.magVecSquared() < 25.f) + { + LLTracker::stopTracking(NULL); + } + else if ( is_teleport && !gAgent.getTeleportKeepsLookAt() ) + { + //look at the beacon + LLVector3 global_agent_pos = agent_pos; + global_agent_pos[0] += x; + global_agent_pos[1] += y; + look_at = (LLVector3)beacon_pos - global_agent_pos; + look_at.normVec(); + gAgentCamera.slamLookAt(look_at); + } + } + + // TODO: Put back a check for flying status! DK 12/19/05 + // Sim tells us whether the new position is off the ground + /* + if (teleport_flags & TELEPORT_FLAGS_IS_FLYING) + { + gAgent.setFlying(TRUE); + } + else + { + gAgent.setFlying(FALSE); + } + */ + + send_agent_update(TRUE, TRUE); + + if (gAgent.getRegion()->getBlockFly()) + { + gAgent.setFlying(gAgent.canFly()); + } + + // force simulator to recognize busy state + if (gAgent.getBusy()) + { + gAgent.setBusy(); + } + else + { + gAgent.clearBusy(); + } + + if (isAgentAvatarValid()) + { + gAgentAvatarp->mFootPlane.clearVec(); + } + + // send walk-vs-run status + gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); + + // If the server version has changed, display an info box and offer + // to display the release notes, unless this is the initial log in. + if (gLastVersionChannel == version_channel) + { + return; + } + + gLastVersionChannel = version_channel; +} + +void process_crossed_region(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + LLUUID session_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id); + if((gAgent.getID() != agent_id) || (gAgent.getSessionID() != session_id)) + { + LL_WARNS("Messaging") << "Incorrect id in process_crossed_region()" + << LL_ENDL; + return; + } + LL_INFOS("Messaging") << "process_crossed_region()" << LL_ENDL; + gAgentAvatarp->resetRegionCrossingTimer(); + + U32 sim_ip; + msg->getIPAddrFast(_PREHASH_RegionData, _PREHASH_SimIP, sim_ip); + U16 sim_port; + msg->getIPPortFast(_PREHASH_RegionData, _PREHASH_SimPort, sim_port); + LLHost sim_host(sim_ip, sim_port); + U64 region_handle; + msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); + + std::string seedCap; + msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); + + send_complete_agent_movement(sim_host); + + LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); + regionp->setSeedCapability(seedCap); +} + + + +// Sends avatar and camera information to simulator. +// Sent roughly once per frame, or 20 times per second, whichever is less often + +const F32 THRESHOLD_HEAD_ROT_QDOT = 0.9997f; // ~= 2.5 degrees -- if its less than this we need to update head_rot +const F32 MAX_HEAD_ROT_QDOT = 0.99999f; // ~= 0.5 degrees -- if its greater than this then no need to update head_rot + // between these values we delay the updates (but no more than one second) + +static LLFastTimer::DeclareTimer FTM_AGENT_UPDATE_SEND("Send Message"); + +void send_agent_update(BOOL force_send, BOOL send_reliable) +{ + if (gAgent.getTeleportState() != LLAgent::TELEPORT_NONE) + { + // We don't care if they want to send an agent update, they're not allowed to until the simulator + // that's the target is ready to receive them (after avatar_init_complete is received) + return; + } + + // We have already requested to log out. Don't send agent updates. + if(LLAppViewer::instance()->logoutRequestSent()) + { + return; + } + + // no region to send update to + if(gAgent.getRegion() == NULL) + { + return; + } + + const F32 TRANSLATE_THRESHOLD = 0.01f; + + // NOTA BENE: This is (intentionally?) using the small angle sine approximation to test for rotation + // Plus, there is an extra 0.5 in the mix since the perpendicular between last_camera_at and getAtAxis() bisects cam_rot_change + // Thus, we're actually testing against 0.2 degrees + const F32 ROTATION_THRESHOLD = 0.1f * 2.f*F_PI/360.f; // Rotation thresh 0.2 deg, see note above + + const U8 DUP_MSGS = 1; // HACK! number of times to repeat data on motionless agent + + // Store data on last sent update so that if no changes, no send + static LLVector3 last_camera_pos_agent, + last_camera_at, + last_camera_left, + last_camera_up; + + static LLVector3 cam_center_chg, + cam_rot_chg; + + static LLQuaternion last_head_rot; + static U32 last_control_flags = 0; + static U8 last_render_state; + static U8 duplicate_count = 0; + static F32 head_rot_chg = 1.0; + static U8 last_flags; + + LLMessageSystem *msg = gMessageSystem; + LLVector3 camera_pos_agent; // local to avatar's region + U8 render_state; + + LLQuaternion body_rotation = gAgent.getFrameAgent().getQuaternion(); + LLQuaternion head_rotation = gAgent.getHeadRotation(); + + camera_pos_agent = gAgentCamera.getCameraPositionAgent(); + + render_state = gAgent.getRenderState(); + + U32 control_flag_change = 0; + U8 flag_change = 0; + + cam_center_chg = last_camera_pos_agent - camera_pos_agent; + cam_rot_chg = last_camera_at - LLViewerCamera::getInstance()->getAtAxis(); + + // If a modifier key is held down, turn off + // LBUTTON and ML_LBUTTON so that using the camera (alt-key) doesn't + // trigger a control event. + U32 control_flags = gAgent.getControlFlags(); + MASK key_mask = gKeyboard->currentMask(TRUE); + if (key_mask & MASK_ALT || key_mask & MASK_CONTROL) + { + control_flags &= ~( AGENT_CONTROL_LBUTTON_DOWN | + AGENT_CONTROL_ML_LBUTTON_DOWN ); + control_flags |= AGENT_CONTROL_LBUTTON_UP | + AGENT_CONTROL_ML_LBUTTON_UP ; + } + + control_flag_change = last_control_flags ^ control_flags; + + U8 flags = AU_FLAGS_NONE; + if (gAgent.isGroupTitleHidden()) + { + flags |= AU_FLAGS_HIDETITLE; + } + if (gAgent.getAutoPilot()) + { + flags |= AU_FLAGS_CLIENT_AUTOPILOT; + } + + flag_change = last_flags ^ flags; + + head_rot_chg = dot(last_head_rot, head_rotation); + + if (force_send || + (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) || + (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) || + (last_render_state != render_state) || + (cam_rot_chg.magVec() > ROTATION_THRESHOLD) || + control_flag_change != 0 || + flag_change != 0) + { +/* + if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT) + { + //LL_INFOS("Messaging") << "head rot " << head_rotation << LL_ENDL; + LL_INFOS("Messaging") << "head_rot_chg = " << head_rot_chg << LL_ENDL; + } + if (cam_rot_chg.magVec() > ROTATION_THRESHOLD) + { + LL_INFOS("Messaging") << "cam rot " << cam_rot_chg.magVec() << LL_ENDL; + } + if (cam_center_chg.magVec() > TRANSLATE_THRESHOLD) + { + LL_INFOS("Messaging") << "cam center " << cam_center_chg.magVec() << LL_ENDL; + } +// if (drag_delta_chg.magVec() > TRANSLATE_THRESHOLD) +// { +// LL_INFOS("Messaging") << "drag delta " << drag_delta_chg.magVec() << LL_ENDL; +// } + if (control_flag_change) + { + LL_INFOS("Messaging") << "dcf = " << control_flag_change << LL_ENDL; + } +*/ + + duplicate_count = 0; + } + else + { + duplicate_count++; + + if (head_rot_chg < MAX_HEAD_ROT_QDOT && duplicate_count < AGENT_UPDATES_PER_SECOND) + { + // The head_rotation is sent for updating things like attached guns. + // We only trigger a new update when head_rotation deviates beyond + // some threshold from the last update, however this can break fine + // adjustments when trying to aim an attached gun, so what we do here + // (where we would normally skip sending an update when nothing has changed) + // is gradually reduce the threshold to allow a better update to + // eventually get sent... should update to within 0.5 degrees in less + // than a second. + if (head_rot_chg < THRESHOLD_HEAD_ROT_QDOT + (MAX_HEAD_ROT_QDOT - THRESHOLD_HEAD_ROT_QDOT) * duplicate_count / AGENT_UPDATES_PER_SECOND) + { + duplicate_count = 0; + } + else + { + return; + } + } + else + { + return; + } + } + + if (duplicate_count < DUP_MSGS && !gDisconnected) + { + LLFastTimer t(FTM_AGENT_UPDATE_SEND); + // Build the message + msg->newMessageFast(_PREHASH_AgentUpdate); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addQuatFast(_PREHASH_BodyRotation, body_rotation); + msg->addQuatFast(_PREHASH_HeadRotation, head_rotation); + msg->addU8Fast(_PREHASH_State, render_state); + msg->addU8Fast(_PREHASH_Flags, flags); + +// if (camera_pos_agent.mV[VY] > 255.f) +// { +// LL_INFOS("Messaging") << "Sending camera center " << camera_pos_agent << LL_ENDL; +// } + + msg->addVector3Fast(_PREHASH_CameraCenter, camera_pos_agent); + msg->addVector3Fast(_PREHASH_CameraAtAxis, LLViewerCamera::getInstance()->getAtAxis()); + msg->addVector3Fast(_PREHASH_CameraLeftAxis, LLViewerCamera::getInstance()->getLeftAxis()); + msg->addVector3Fast(_PREHASH_CameraUpAxis, LLViewerCamera::getInstance()->getUpAxis()); + msg->addF32Fast(_PREHASH_Far, gAgentCamera.mDrawDistance); + + msg->addU32Fast(_PREHASH_ControlFlags, control_flags); + + if (gDebugClicks) + { + if (control_flags & AGENT_CONTROL_LBUTTON_DOWN) + { + LL_INFOS("Messaging") << "AgentUpdate left button down" << LL_ENDL; + } + + if (control_flags & AGENT_CONTROL_LBUTTON_UP) + { + LL_INFOS("Messaging") << "AgentUpdate left button up" << LL_ENDL; + } + } + + gAgent.enableControlFlagReset(); + + if (!send_reliable) + { + gAgent.sendMessage(); + } + else + { + gAgent.sendReliableMessage(); + } + +// LL_DEBUGS("Messaging") << "agent " << avatar_pos_agent << " cam " << camera_pos_agent << LL_ENDL; + + // Copy the old data + last_head_rot = head_rotation; + last_render_state = render_state; + last_camera_pos_agent = camera_pos_agent; + last_camera_at = LLViewerCamera::getInstance()->getAtAxis(); + last_camera_left = LLViewerCamera::getInstance()->getLeftAxis(); + last_camera_up = LLViewerCamera::getInstance()->getUpAxis(); + last_control_flags = control_flags; + last_flags = flags; + } +} + + + +// *TODO: Remove this dependency, or figure out a better way to handle +// this hack. +extern U32 gObjectBits; + +void process_object_update(LLMessageSystem *mesgsys, void **user_data) +{ + LLMemType mt(LLMemType::MTYPE_OBJECT); + // Update the data counters + if (mesgsys->getReceiveCompressedSize()) + { + gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + } + else + { + gObjectBits += mesgsys->getReceiveSize() * 8; + } + + // Update the object... + gObjectList.processObjectUpdate(mesgsys, user_data, OUT_FULL); +} + +void process_compressed_object_update(LLMessageSystem *mesgsys, void **user_data) +{ + LLMemType mt(LLMemType::MTYPE_OBJECT); + // Update the data counters + if (mesgsys->getReceiveCompressedSize()) + { + gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + } + else + { + gObjectBits += mesgsys->getReceiveSize() * 8; + } + + // Update the object... + gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_FULL_COMPRESSED); +} + +void process_cached_object_update(LLMessageSystem *mesgsys, void **user_data) +{ + LLMemType mt(LLMemType::MTYPE_OBJECT); + // Update the data counters + if (mesgsys->getReceiveCompressedSize()) + { + gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + } + else + { + gObjectBits += mesgsys->getReceiveSize() * 8; + } + + // Update the object... + gObjectList.processCachedObjectUpdate(mesgsys, user_data, OUT_FULL_CACHED); +} + + +void process_terse_object_update_improved(LLMessageSystem *mesgsys, void **user_data) +{ + LLMemType mt(LLMemType::MTYPE_OBJECT); + if (mesgsys->getReceiveCompressedSize()) + { + gObjectBits += mesgsys->getReceiveCompressedSize() * 8; + } + else + { + gObjectBits += mesgsys->getReceiveSize() * 8; + } + + gObjectList.processCompressedObjectUpdate(mesgsys, user_data, OUT_TERSE_IMPROVED); +} + +static LLFastTimer::DeclareTimer FTM_PROCESS_OBJECTS("Process Objects"); + + +void process_kill_object(LLMessageSystem *mesgsys, void **user_data) +{ + LLFastTimer t(FTM_PROCESS_OBJECTS); + + LLUUID id; + U32 local_id; + S32 i; + S32 num_objects; + + num_objects = mesgsys->getNumberOfBlocksFast(_PREHASH_ObjectData); + + for (i = 0; i < num_objects; i++) + { + mesgsys->getU32Fast(_PREHASH_ObjectData, _PREHASH_ID, local_id, i); + + LLViewerObjectList::getUUIDFromLocal(id, + local_id, + gMessageSystem->getSenderIP(), + gMessageSystem->getSenderPort()); + if (id == LLUUID::null) + { + LL_DEBUGS("Messaging") << "Unknown kill for local " << local_id << LL_ENDL; + gObjectList.mNumUnknownKills++; + continue; + } + else + { + LL_DEBUGS("Messaging") << "Kill message for local " << local_id << LL_ENDL; + } + + LLSelectMgr::getInstance()->removeObjectFromSelections(id); + + // ...don't kill the avatar + if (!(id == gAgentID)) + { + LLViewerObject *objectp = gObjectList.findObject(id); + if (objectp) + { + // Display green bubble on kill + if ( gShowObjectUpdates ) + { + LLViewerObject* newobject; + newobject = gObjectList.createObjectViewer(LL_PCODE_LEGACY_TEXT_BUBBLE, objectp->getRegion()); + + LLVOTextBubble* bubble = (LLVOTextBubble*) newobject; + + bubble->mColor.setVec(0.f, 1.f, 0.f, 1.f); + bubble->setScale( 2.0f * bubble->getScale() ); + bubble->setPositionGlobal(objectp->getPositionGlobal()); + gPipeline.addObject(bubble); + } + + // Do the kill + gObjectList.killObject(objectp); + } + else + { + LL_WARNS("Messaging") << "Object in UUID lookup, but not on object list in kill!" << LL_ENDL; + gObjectList.mNumUnknownKills++; + } + } + } +} + +void process_time_synch(LLMessageSystem *mesgsys, void **user_data) +{ + LLVector3 sun_direction; + LLVector3 sun_ang_velocity; + F32 phase; + U64 space_time_usec; + + U32 seconds_per_day; + U32 seconds_per_year; + + // "SimulatorViewerTimeMessage" + mesgsys->getU64Fast(_PREHASH_TimeInfo, _PREHASH_UsecSinceStart, space_time_usec); + mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerDay, seconds_per_day); + mesgsys->getU32Fast(_PREHASH_TimeInfo, _PREHASH_SecPerYear, seconds_per_year); + + // This should eventually be moved to an "UpdateHeavenlyBodies" message + mesgsys->getF32Fast(_PREHASH_TimeInfo, _PREHASH_SunPhase, phase); + mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunDirection, sun_direction); + mesgsys->getVector3Fast(_PREHASH_TimeInfo, _PREHASH_SunAngVelocity, sun_ang_velocity); + + LLWorld::getInstance()->setSpaceTimeUSec(space_time_usec); + + //LL_DEBUGS("Messaging") << "time_synch() - " << sun_direction << ", " << sun_ang_velocity + // << ", " << phase << LL_ENDL; + + gSky.setSunPhase(phase); + gSky.setSunTargetDirection(sun_direction, sun_ang_velocity); + if (!gNoRender && !(gSavedSettings.getBOOL("SkyOverrideSimSunPosition") || gSky.getOverrideSun())) + { + gSky.setSunDirection(sun_direction, sun_ang_velocity); + } +} + +void process_sound_trigger(LLMessageSystem *msg, void **) +{ + if (!gAudiop) return; + + U64 region_handle = 0; + F32 gain = 0; + LLUUID sound_id; + LLUUID owner_id; + LLUUID object_id; + LLUUID parent_id; + LLVector3 pos_local; + + msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_SoundID, sound_id); + msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_OwnerID, owner_id); + msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ObjectID, object_id); + msg->getUUIDFast(_PREHASH_SoundData, _PREHASH_ParentID, parent_id); + msg->getU64Fast(_PREHASH_SoundData, _PREHASH_Handle, region_handle); + msg->getVector3Fast(_PREHASH_SoundData, _PREHASH_Position, pos_local); + msg->getF32Fast(_PREHASH_SoundData, _PREHASH_Gain, gain); + + // adjust sound location to true global coords + LLVector3d pos_global = from_region_handle(region_handle); + pos_global.mdV[VX] += pos_local.mV[VX]; + pos_global.mdV[VY] += pos_local.mV[VY]; + pos_global.mdV[VZ] += pos_local.mV[VZ]; + + // Don't play a trigger sound if you can't hear it due + // to parcel "local audio only" settings. + if (!LLViewerParcelMgr::getInstance()->canHearSound(pos_global)) return; + + // Don't play sounds triggered by someone you muted. + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; + + // Don't play sounds from an object you muted + if (LLMuteList::getInstance()->isMuted(object_id)) return; + + // Don't play sounds from an object whose parent you muted + if (parent_id.notNull() + && LLMuteList::getInstance()->isMuted(parent_id)) + { + return; + } + + // Don't play sounds from a region with maturity above current agent maturity + if( !gAgent.canAccessMaturityInRegion( region_handle ) ) + { + return; + } + + gAudiop->triggerSound(sound_id, owner_id, gain, LLAudioEngine::AUDIO_TYPE_SFX, pos_global); +} + +void process_preload_sound(LLMessageSystem *msg, void **user_data) +{ + if (!gAudiop) + { + return; + } + + LLUUID sound_id; + LLUUID object_id; + LLUUID owner_id; + + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id); + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); + + LLViewerObject *objectp = gObjectList.findObject(object_id); + if (!objectp) return; + + if (LLMuteList::getInstance()->isMuted(object_id)) return; + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; + + LLAudioSource *sourcep = objectp->getAudioSource(owner_id); + if (!sourcep) return; + + LLAudioData *datap = gAudiop->getAudioData(sound_id); + + // Note that I don't actually do any loading of the + // audio data into a buffer at this point, as it won't actually + // help us out. + + // Don't play sounds from a region with maturity above current agent maturity + LLVector3d pos_global = objectp->getPositionGlobal(); + if (gAgent.canAccessMaturityAtGlobal(pos_global)) + { + // Add audioData starts a transfer internally. + sourcep->addAudioData(datap, FALSE); +} +} + +void process_attached_sound(LLMessageSystem *msg, void **user_data) +{ + F32 gain = 0; + LLUUID sound_id; + LLUUID object_id; + LLUUID owner_id; + U8 flags; + + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_SoundID, sound_id); + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_id); + msg->getUUIDFast(_PREHASH_DataBlock, _PREHASH_OwnerID, owner_id); + msg->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain); + msg->getU8Fast(_PREHASH_DataBlock, _PREHASH_Flags, flags); + + LLViewerObject *objectp = gObjectList.findObject(object_id); + if (!objectp) + { + // we don't know about this object, just bail + return; + } + + if (LLMuteList::getInstance()->isMuted(object_id)) return; + + if (LLMuteList::getInstance()->isMuted(owner_id, LLMute::flagObjectSounds)) return; + + + // Don't play sounds from a region with maturity above current agent maturity + LLVector3d pos = objectp->getPositionGlobal(); + if( !gAgent.canAccessMaturityAtGlobal(pos) ) + { + return; + } + + objectp->setAttachedSound(sound_id, owner_id, gain, flags); +} + + +void process_attached_sound_gain_change(LLMessageSystem *mesgsys, void **user_data) +{ + F32 gain = 0; + LLUUID object_guid; + LLViewerObject *objectp = NULL; + + mesgsys->getUUIDFast(_PREHASH_DataBlock, _PREHASH_ObjectID, object_guid); + + if (!((objectp = gObjectList.findObject(object_guid)))) + { + // we don't know about this object, just bail + return; + } + + mesgsys->getF32Fast(_PREHASH_DataBlock, _PREHASH_Gain, gain); + + objectp->adjustAudioGain(gain); +} + + +void process_health_message(LLMessageSystem *mesgsys, void **user_data) +{ + F32 health; + + mesgsys->getF32Fast(_PREHASH_HealthData, _PREHASH_Health, health); + + if (gStatusBar) + { + gStatusBar->setHealth((S32)health); + } +} + + +void process_sim_stats(LLMessageSystem *msg, void **user_data) +{ + S32 count = msg->getNumberOfBlocks("Stat"); + for (S32 i = 0; i < count; ++i) + { + U32 stat_id; + F32 stat_value; + msg->getU32("Stat", "StatID", stat_id, i); + msg->getF32("Stat", "StatValue", stat_value, i); + switch (stat_id) + { + case LL_SIM_STAT_TIME_DILATION: + LLViewerStats::getInstance()->mSimTimeDilation.addValue(stat_value); + break; + case LL_SIM_STAT_FPS: + LLViewerStats::getInstance()->mSimFPS.addValue(stat_value); + break; + case LL_SIM_STAT_PHYSFPS: + LLViewerStats::getInstance()->mSimPhysicsFPS.addValue(stat_value); + break; + case LL_SIM_STAT_AGENTUPS: + LLViewerStats::getInstance()->mSimAgentUPS.addValue(stat_value); + break; + case LL_SIM_STAT_FRAMEMS: + LLViewerStats::getInstance()->mSimFrameMsec.addValue(stat_value); + break; + case LL_SIM_STAT_NETMS: + LLViewerStats::getInstance()->mSimNetMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMOTHERMS: + LLViewerStats::getInstance()->mSimSimOtherMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMPHYSICSMS: + LLViewerStats::getInstance()->mSimSimPhysicsMsec.addValue(stat_value); + break; + case LL_SIM_STAT_AGENTMS: + LLViewerStats::getInstance()->mSimAgentMsec.addValue(stat_value); + break; + case LL_SIM_STAT_IMAGESMS: + LLViewerStats::getInstance()->mSimImagesMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SCRIPTMS: + LLViewerStats::getInstance()->mSimScriptMsec.addValue(stat_value); + break; + case LL_SIM_STAT_NUMTASKS: + LLViewerStats::getInstance()->mSimObjects.addValue(stat_value); + break; + case LL_SIM_STAT_NUMTASKSACTIVE: + LLViewerStats::getInstance()->mSimActiveObjects.addValue(stat_value); + break; + case LL_SIM_STAT_NUMAGENTMAIN: + LLViewerStats::getInstance()->mSimMainAgents.addValue(stat_value); + break; + case LL_SIM_STAT_NUMAGENTCHILD: + LLViewerStats::getInstance()->mSimChildAgents.addValue(stat_value); + break; + case LL_SIM_STAT_NUMSCRIPTSACTIVE: + LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); + break; + case LL_SIM_STAT_SCRIPT_EPS: + LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value); + break; + case LL_SIM_STAT_INPPS: + LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); + break; + case LL_SIM_STAT_OUTPPS: + LLViewerStats::getInstance()->mSimOutPPS.addValue(stat_value); + break; + case LL_SIM_STAT_PENDING_DOWNLOADS: + LLViewerStats::getInstance()->mSimPendingDownloads.addValue(stat_value); + break; + case LL_SIM_STAT_PENDING_UPLOADS: + LLViewerStats::getInstance()->mSimPendingUploads.addValue(stat_value); + break; + case LL_SIM_STAT_PENDING_LOCAL_UPLOADS: + LLViewerStats::getInstance()->mSimPendingLocalUploads.addValue(stat_value); + break; + case LL_SIM_STAT_TOTAL_UNACKED_BYTES: + LLViewerStats::getInstance()->mSimTotalUnackedBytes.addValue(stat_value / 1024.f); + break; + case LL_SIM_STAT_PHYSICS_PINNED_TASKS: + LLViewerStats::getInstance()->mPhysicsPinnedTasks.addValue(stat_value); + break; + case LL_SIM_STAT_PHYSICS_LOD_TASKS: + LLViewerStats::getInstance()->mPhysicsLODTasks.addValue(stat_value); + break; + case LL_SIM_STAT_SIMPHYSICSSTEPMS: + LLViewerStats::getInstance()->mSimSimPhysicsStepMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMPHYSICSSHAPEMS: + LLViewerStats::getInstance()->mSimSimPhysicsShapeUpdateMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMPHYSICSOTHERMS: + LLViewerStats::getInstance()->mSimSimPhysicsOtherMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMPHYSICSMEMORY: + LLViewerStats::getInstance()->mPhysicsMemoryAllocated.addValue(stat_value); + break; + case LL_SIM_STAT_SIMSPARETIME: + LLViewerStats::getInstance()->mSimSpareMsec.addValue(stat_value); + break; + case LL_SIM_STAT_SIMSLEEPTIME: + LLViewerStats::getInstance()->mSimSleepMsec.addValue(stat_value); + break; + case LL_SIM_STAT_IOPUMPTIME: + LLViewerStats::getInstance()->mSimPumpIOMsec.addValue(stat_value); + break; + default: + // Used to be a commented out warning. + LL_DEBUGS("Messaging") << "Unknown stat id" << stat_id << LL_ENDL; + break; + } + } + + /* + msg->getF32Fast(_PREHASH_Statistics, _PREHASH_PhysicsTimeDilation, time_dilation); + LLViewerStats::getInstance()->mSimTDStat.addValue(time_dilation); + + // Process information + // { CpuUsage F32 } + // { SimMemTotal F32 } + // { SimMemRSS F32 } + // { ProcessUptime F32 } + F32 cpu_usage; + F32 sim_mem_total; + F32 sim_mem_rss; + F32 process_uptime; + msg->getF32Fast(_PREHASH_Statistics, _PREHASH_CpuUsage, cpu_usage); + msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemTotal, sim_mem_total); + msg->getF32Fast(_PREHASH_Statistics, _PREHASH_SimMemRSS, sim_mem_rss); + msg->getF32Fast(_PREHASH_Statistics, _PREHASH_ProcessUptime, process_uptime); + LLViewerStats::getInstance()->mSimCPUUsageStat.addValue(cpu_usage); + LLViewerStats::getInstance()->mSimMemTotalStat.addValue(sim_mem_total); + LLViewerStats::getInstance()->mSimMemRSSStat.addValue(sim_mem_rss); + */ + + // + // Various hacks that aren't statistics, but are being handled here. + // + U32 max_tasks_per_region; + U32 region_flags; + msg->getU32("Region", "ObjectCapacity", max_tasks_per_region); + msg->getU32("Region", "RegionFlags", region_flags); + + LLViewerRegion* regionp = gAgent.getRegion(); + if (regionp) + { + BOOL was_flying = gAgent.getFlying(); + regionp->setRegionFlags(region_flags); + regionp->setMaxTasks(max_tasks_per_region); + // HACK: This makes agents drop from the sky if the region is + // set to no fly while people are still in the sim. + if (was_flying && regionp->getBlockFly()) + { + gAgent.setFlying(gAgent.canFly()); + } + } +} + + + +void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data) +{ + LLUUID animation_id; + LLUUID uuid; + S32 anim_sequence_id; + LLVOAvatar *avatarp; + + mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); + + //clear animation flags + avatarp = (LLVOAvatar *)gObjectList.findObject(uuid); + + if (!avatarp) + { + // no agent by this ID...error? + LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL; + return; + } + + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationList); + S32 num_source_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_AnimationSourceList); + + avatarp->mSignaledAnimations.clear(); + + if (avatarp->isSelf()) + { + LLUUID object_id; + + for( S32 i = 0; i < num_blocks; i++ ) + { + mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); + mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); + + LL_DEBUGS("Messaging") << "Anim sequence ID: " << anim_sequence_id << LL_ENDL; + + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + + // *HACK: Disabling flying mode if it has been enabled shortly before the agent + // stand up animation is signaled. In this case we don't get a signal to start + // flying animation from server, the AGENT_CONTROL_FLY flag remains set but the + // avatar does not play flying animation, so we switch flying mode off. + // See LLAgent::setFlying(). This may cause "Stop Flying" button to blink. + // See EXT-2781. + if (animation_id == ANIM_AGENT_STANDUP && gAgent.getFlying()) + { + gAgent.setFlying(FALSE); + } + + if (i < num_source_blocks) + { + mesgsys->getUUIDFast(_PREHASH_AnimationSourceList, _PREHASH_ObjectID, object_id, i); + + LLViewerObject* object = gObjectList.findObject(object_id); + if (object) + { + object->mFlags |= FLAGS_ANIM_SOURCE; + + BOOL anim_found = FALSE; + LLVOAvatar::AnimSourceIterator anim_it = avatarp->mAnimationSources.find(object_id); + for (;anim_it != avatarp->mAnimationSources.end(); ++anim_it) + { + if (anim_it->second == animation_id) + { + anim_found = TRUE; + break; + } + } + + if (!anim_found) + { + avatarp->mAnimationSources.insert(LLVOAvatar::AnimationSourceMap::value_type(object_id, animation_id)); + } + } + } + } + } + else + { + for( S32 i = 0; i < num_blocks; i++ ) + { + mesgsys->getUUIDFast(_PREHASH_AnimationList, _PREHASH_AnimID, animation_id, i); + mesgsys->getS32Fast(_PREHASH_AnimationList, _PREHASH_AnimSequenceID, anim_sequence_id, i); + avatarp->mSignaledAnimations[animation_id] = anim_sequence_id; + } + } + + if (num_blocks) + { + avatarp->processAnimationStateChanges(); + } +} + +void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data) +{ + LLUUID uuid; + mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid); + + LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid); + if (avatarp) + { + avatarp->processAvatarAppearance( mesgsys ); + } + else + { + LL_WARNS("Messaging") << "avatar_appearance sent for unknown avatar " << uuid << LL_ENDL; + } +} + +void process_camera_constraint(LLMessageSystem *mesgsys, void **user_data) +{ + LLVector4 cameraCollidePlane; + mesgsys->getVector4Fast(_PREHASH_CameraCollidePlane, _PREHASH_Plane, cameraCollidePlane); + + gAgentCamera.setCameraCollidePlane(cameraCollidePlane); +} + +void near_sit_object(BOOL success, void *data) +{ + if (success) + { + // Send message to sit on object + gMessageSystem->newMessageFast(_PREHASH_AgentSit); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + gAgent.sendReliableMessage(); + } +} + +void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) +{ + LLVector3 sitPosition; + LLQuaternion sitRotation; + LLUUID sitObjectID; + BOOL use_autopilot; + mesgsys->getUUIDFast(_PREHASH_SitObject, _PREHASH_ID, sitObjectID); + mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_AutoPilot, use_autopilot); + mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_SitPosition, sitPosition); + mesgsys->getQuatFast(_PREHASH_SitTransform, _PREHASH_SitRotation, sitRotation); + LLVector3 camera_eye; + mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraEyeOffset, camera_eye); + LLVector3 camera_at; + mesgsys->getVector3Fast(_PREHASH_SitTransform, _PREHASH_CameraAtOffset, camera_at); + BOOL force_mouselook; + mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook); + + if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > 0.0001f) + { + gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at); + } + + gAgentCamera.setForceMouselook(force_mouselook); + // Forcing turning off flying here to prevent flying after pressing "Stand" + // to stand up from an object. See EXT-1655. + gAgent.setFlying(FALSE); + + LLViewerObject* object = gObjectList.findObject(sitObjectID); + if (object) + { + LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation()); + if (!use_autopilot || isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot()) + { + //we're already sitting on this object, so don't autopilot + } + else + { + gAgent.startAutoPilotGlobal(gAgent.getPosGlobalFromAgent(sit_spot), "Sit", &sitRotation, near_sit_object, NULL, 0.5f); + } + } + else + { + LL_WARNS("Messaging") << "Received sit approval for unknown object " << sitObjectID << LL_ENDL; + } +} + +void process_clear_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data) +{ + LLUUID source_id; + + mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id); + + LLFollowCamMgr::removeFollowCamParams(source_id); +} + +void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data) +{ + S32 type; + F32 value; + bool settingPosition = false; + bool settingFocus = false; + bool settingFocusOffset = false; + LLVector3 position; + LLVector3 focus; + LLVector3 focus_offset; + + LLUUID source_id; + + mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id); + + LLViewerObject* objectp = gObjectList.findObject(source_id); + if (objectp) + { + objectp->mFlags |= FLAGS_CAMERA_SOURCE; + } + + S32 num_objects = mesgsys->getNumberOfBlocks("CameraProperty"); + for (S32 block_index = 0; block_index < num_objects; block_index++) + { + mesgsys->getS32("CameraProperty", "Type", type, block_index); + mesgsys->getF32("CameraProperty", "Value", value, block_index); + switch(type) + { + case FOLLOWCAM_PITCH: + LLFollowCamMgr::setPitch(source_id, value); + break; + case FOLLOWCAM_FOCUS_OFFSET_X: + focus_offset.mV[VX] = value; + settingFocusOffset = true; + break; + case FOLLOWCAM_FOCUS_OFFSET_Y: + focus_offset.mV[VY] = value; + settingFocusOffset = true; + break; + case FOLLOWCAM_FOCUS_OFFSET_Z: + focus_offset.mV[VZ] = value; + settingFocusOffset = true; + break; + case FOLLOWCAM_POSITION_LAG: + LLFollowCamMgr::setPositionLag(source_id, value); + break; + case FOLLOWCAM_FOCUS_LAG: + LLFollowCamMgr::setFocusLag(source_id, value); + break; + case FOLLOWCAM_DISTANCE: + LLFollowCamMgr::setDistance(source_id, value); + break; + case FOLLOWCAM_BEHINDNESS_ANGLE: + LLFollowCamMgr::setBehindnessAngle(source_id, value); + break; + case FOLLOWCAM_BEHINDNESS_LAG: + LLFollowCamMgr::setBehindnessLag(source_id, value); + break; + case FOLLOWCAM_POSITION_THRESHOLD: + LLFollowCamMgr::setPositionThreshold(source_id, value); + break; + case FOLLOWCAM_FOCUS_THRESHOLD: + LLFollowCamMgr::setFocusThreshold(source_id, value); + break; + case FOLLOWCAM_ACTIVE: + //if 1, set using followcam,. + LLFollowCamMgr::setCameraActive(source_id, value != 0.f); + break; + case FOLLOWCAM_POSITION_X: + settingPosition = true; + position.mV[ 0 ] = value; + break; + case FOLLOWCAM_POSITION_Y: + settingPosition = true; + position.mV[ 1 ] = value; + break; + case FOLLOWCAM_POSITION_Z: + settingPosition = true; + position.mV[ 2 ] = value; + break; + case FOLLOWCAM_FOCUS_X: + settingFocus = true; + focus.mV[ 0 ] = value; + break; + case FOLLOWCAM_FOCUS_Y: + settingFocus = true; + focus.mV[ 1 ] = value; + break; + case FOLLOWCAM_FOCUS_Z: + settingFocus = true; + focus.mV[ 2 ] = value; + break; + case FOLLOWCAM_POSITION_LOCKED: + LLFollowCamMgr::setPositionLocked(source_id, value != 0.f); + break; + case FOLLOWCAM_FOCUS_LOCKED: + LLFollowCamMgr::setFocusLocked(source_id, value != 0.f); + break; + + default: + break; + } + } + + if ( settingPosition ) + { + LLFollowCamMgr::setPosition(source_id, position); + } + if ( settingFocus ) + { + LLFollowCamMgr::setFocus(source_id, focus); + } + if ( settingFocusOffset ) + { + LLFollowCamMgr::setFocusOffset(source_id, focus_offset); + } +} +//end Ventrella + + +// Culled from newsim lltask.cpp +void process_name_value(LLMessageSystem *mesgsys, void **user_data) +{ + std::string temp_str; + LLUUID id; + S32 i, num_blocks; + + mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id); + + LLViewerObject* object = gObjectList.findObject(id); + + if (object) + { + num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); + for (i = 0; i < num_blocks; i++) + { + mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); + LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL; + object->addNVPair(temp_str); + } + } + else + { + LL_INFOS("Messaging") << "Can't find object " << id << " to add name value pair" << LL_ENDL; + } +} + +void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) +{ + std::string temp_str; + LLUUID id; + S32 i, num_blocks; + + mesgsys->getUUIDFast(_PREHASH_TaskData, _PREHASH_ID, id); + + LLViewerObject* object = gObjectList.findObject(id); + + if (object) + { + num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); + for (i = 0; i < num_blocks; i++) + { + mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); + LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL; + object->removeNVPair(temp_str); + } + } + else + { + LL_INFOS("Messaging") << "Can't find object " << id << " to remove name value pair" << LL_ENDL; + } +} + +void process_kick_user(LLMessageSystem *msg, void** /*user_data*/) +{ + std::string message; + + msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message); + + LLAppViewer::instance()->forceDisconnect(message); +} + + +/* +void process_user_list_reply(LLMessageSystem *msg, void **user_data) +{ + LLUserList::processUserListReply(msg, user_data); + return; + char firstname[MAX_STRING+1]; + char lastname[MAX_STRING+1]; + U8 status; + S32 user_count; + + user_count = msg->getNumberOfBlocks("UserBlock"); + + for (S32 i = 0; i < user_count; i++) + { + msg->getData("UserBlock", i, "FirstName", firstname); + msg->getData("UserBlock", i, "LastName", lastname); + msg->getData("UserBlock", i, "Status", &status); + + if (status & 0x01) + { + dialog_friends_add_friend(buffer, TRUE); + } + else + { + dialog_friends_add_friend(buffer, FALSE); + } + } + + dialog_friends_done_adding(); +} +*/ + +// this is not handled in processUpdateMessage +/* +void process_time_dilation(LLMessageSystem *msg, void **user_data) +{ + // get the time_dilation + U16 foo; + msg->getData("TimeDilation", "TimeDilation", &foo); + F32 time_dilation = ((F32) foo) / 65535.f; + + // get the pointer to the right region + U32 ip = msg->getSenderIP(); + U32 port = msg->getSenderPort(); + LLViewerRegion *regionp = LLWorld::getInstance()->getRegion(ip, port); + if (regionp) + { + regionp->setTimeDilation(time_dilation); + } +} +*/ + + +void process_money_balance_reply( LLMessageSystem* msg, void** ) +{ + S32 balance = 0; + S32 credit = 0; + S32 committed = 0; + std::string desc; + LLUUID tid; + + msg->getUUID("MoneyData", "TransactionID", tid); + msg->getS32("MoneyData", "MoneyBalance", balance); + msg->getS32("MoneyData", "SquareMetersCredit", credit); + msg->getS32("MoneyData", "SquareMetersCommitted", committed); + msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc); + LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " + << committed << LL_ENDL; + + if (gStatusBar) + { + gStatusBar->setBalance(balance); + gStatusBar->setLandCredit(credit); + gStatusBar->setLandCommitted(committed); + } + + if (desc.empty() + || !gSavedSettings.getBOOL("NotifyMoneyChange")) + { + // ...nothing to display + return; + } + + // Suppress duplicate messages about the same transaction + static std::deque<LLUUID> recent; + if (std::find(recent.rbegin(), recent.rend(), tid) != recent.rend()) + { + return; + } + + // Once the 'recent' container gets large enough, chop some + // off the beginning. + const U32 MAX_LOOKBACK = 30; + const S32 POP_FRONT_SIZE = 12; + if(recent.size() > MAX_LOOKBACK) + { + LL_DEBUGS("Messaging") << "Removing oldest transaction records" << LL_ENDL; + recent.erase(recent.begin(), recent.begin() + POP_FRONT_SIZE); + } + //LL_DEBUGS("Messaging") << "Pushing back transaction " << tid << LL_ENDL; + recent.push_back(tid); + + if (msg->has("TransactionInfo")) + { + // ...message has extended info for localization + process_money_balance_reply_extended(msg); + } + else + { + // Only old dev grids will not supply the TransactionInfo block, + // so we can just use the hard-coded English string. + LLSD args; + args["MESSAGE"] = desc; + LLNotificationsUtil::add("SystemMessage", args); + } +} + +static std::string reason_from_transaction_type(S32 transaction_type, + const std::string& item_desc) +{ + // *NOTE: The keys for the reason strings are unusual because + // an earlier version of the code used English language strings + // extracted from hard-coded server English descriptions. + // Keeping them so we don't have to re-localize them. + switch (transaction_type) + { + case TRANS_OBJECT_SALE: + { + LLStringUtil::format_map_t arg; + arg["ITEM"] = item_desc; + return LLTrans::getString("for item", arg); + } + case TRANS_LAND_SALE: + return LLTrans::getString("for a parcel of land"); + + case TRANS_LAND_PASS_SALE: + return LLTrans::getString("for a land access pass"); + + case TRANS_GROUP_LAND_DEED: + return LLTrans::getString("for deeding land"); + + case TRANS_GROUP_CREATE: + return LLTrans::getString("to create a group"); + + case TRANS_GROUP_JOIN: + return LLTrans::getString("to join a group"); + + case TRANS_UPLOAD_CHARGE: + return LLTrans::getString("to upload"); + + case TRANS_CLASSIFIED_CHARGE: + return LLTrans::getString("to publish a classified ad"); + + // These have no reason to display, but are expected and should not + // generate warnings + case TRANS_GIFT: + case TRANS_PAY_OBJECT: + case TRANS_OBJECT_PAYS: + return std::string(); + + default: + llwarns << "Unknown transaction type " + << transaction_type << llendl; + return std::string(); + } +} + +static void money_balance_group_notify(const LLUUID& group_id, + const std::string& name, + bool is_group, + std::string notification, + LLSD args, + LLSD payload) +{ + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); +} + +static void money_balance_avatar_notify(const LLUUID& agent_id, + const LLAvatarName& av_name, + std::string notification, + LLSD args, + LLSD payload) +{ + // Message uses name SLURLs, don't actually have to substitute in + // the name. We're just making sure it's available. + // Notification is either PaymentReceived or PaymentSent + LLNotificationsUtil::add(notification, args, payload); +} + +static void process_money_balance_reply_extended(LLMessageSystem* msg) +{ + // Added in server 1.40 and viewer 2.1, support for localization + // and agent ids for name lookup. + S32 transaction_type = 0; + LLUUID source_id; + BOOL is_source_group = FALSE; + LLUUID dest_id; + BOOL is_dest_group = FALSE; + S32 amount = 0; + std::string item_description; + + msg->getS32("TransactionInfo", "TransactionType", transaction_type); + msg->getUUID("TransactionInfo", "SourceID", source_id); + msg->getBOOL("TransactionInfo", "IsSourceGroup", is_source_group); + msg->getUUID("TransactionInfo", "DestID", dest_id); + msg->getBOOL("TransactionInfo", "IsDestGroup", is_dest_group); + msg->getS32("TransactionInfo", "Amount", amount); + msg->getString("TransactionInfo", "ItemDescription", item_description); + LL_INFOS("Money") << "MoneyBalanceReply source " << source_id + << " dest " << dest_id + << " type " << transaction_type + << " item " << item_description << LL_ENDL; + + if (source_id.isNull() && dest_id.isNull()) + { + // this is a pure balance update, no notification required + return; + } + + std::string source_slurl; + if (is_source_group) + { + source_slurl = + LLSLURL( "group", source_id, "inspect").getSLURLString(); + } + else + { + source_slurl = + LLSLURL( "agent", source_id, "completename").getSLURLString(); + } + + std::string dest_slurl; + if (is_dest_group) + { + dest_slurl = + LLSLURL( "group", dest_id, "inspect").getSLURLString(); + } + else + { + dest_slurl = + LLSLURL( "agent", dest_id, "completename").getSLURLString(); + } + + std::string reason = + reason_from_transaction_type(transaction_type, item_description); + + LLStringUtil::format_map_t args; + args["REASON"] = reason; // could be empty + args["AMOUNT"] = llformat("%d", amount); + + // Need to delay until name looked up, so need to know whether or not + // is group + bool is_name_group = false; + LLUUID name_id; + std::string message; + std::string notification; + LLSD final_args; + LLSD payload; + + bool you_paid_someone = (source_id == gAgentID); + if (you_paid_someone) + { + args["NAME"] = dest_slurl; + is_name_group = is_dest_group; + name_id = dest_id; + if (!reason.empty()) + { + if (dest_id.notNull()) + { + message = LLTrans::getString("you_paid_ldollars", args); + } + else + { + // transaction fee to the system, eg, to create a group + message = LLTrans::getString("you_paid_ldollars_no_name", args); + } + } + else + { + if (dest_id.notNull()) + { + message = LLTrans::getString("you_paid_ldollars_no_reason", args); + } + else + { + // no target, no reason, you just paid money + message = LLTrans::getString("you_paid_ldollars_no_info", args); + } + } + final_args["MESSAGE"] = message; + notification = "PaymentSent"; + } + else { + // ...someone paid you + args["NAME"] = source_slurl; + is_name_group = is_source_group; + name_id = source_id; + if (!reason.empty()) + { + message = LLTrans::getString("paid_you_ldollars", args); + } + else { + message = LLTrans::getString("paid_you_ldollars_no_reason", args); + } + final_args["MESSAGE"] = message; + + // make notification loggable + payload["from_id"] = source_id; + notification = "PaymentReceived"; + } + + // Despite using SLURLs, wait until the name is available before + // showing the notification, otherwise the UI layout is strange and + // the user sees a "Loading..." message + if (is_name_group) + { + gCacheName->getGroup(name_id, + boost::bind(&money_balance_group_notify, + _1, _2, _3, + notification, final_args, payload)); + } + else { + LLAvatarNameCache::get(name_id, + boost::bind(&money_balance_avatar_notify, + _1, _2, + notification, final_args, payload)); + } +} + + + +bool handle_special_notification_callback(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (0 == option) + { + // set the preference to the maturity of the region we're calling + int preferredMaturity = notification["payload"]["_region_access"].asInteger(); + gSavedSettings.setU32("PreferredMaturity", preferredMaturity); + gAgent.sendMaturityPreferenceToServer(preferredMaturity); + + // notify user that the maturity preference has been changed + LLSD args; + args["RATING"] = LLViewerRegion::accessToString(preferredMaturity); + LLNotificationsUtil::add("PreferredMaturityChanged", args); + } + + return false; +} + +// some of the server notifications need special handling. This is where we do that. +bool handle_special_notification(std::string notificationID, LLSD& llsdBlock) +{ + int regionAccess = llsdBlock["_region_access"].asInteger(); + llsdBlock["REGIONMATURITY"] = LLViewerRegion::accessToString(regionAccess); + + // we're going to throw the LLSD in there in case anyone ever wants to use it + LLNotificationsUtil::add(notificationID+"_Notify", llsdBlock); + + if (regionAccess == SIM_ACCESS_MATURE) + { + if (gAgent.isTeen()) + { + LLNotificationsUtil::add(notificationID+"_KB", llsdBlock); + return true; + } + else if (gAgent.prefersPG()) + { + LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback); + return true; + } + } + else if (regionAccess == SIM_ACCESS_ADULT) + { + if (!gAgent.isAdult()) + { + LLNotificationsUtil::add(notificationID+"_KB", llsdBlock); + return true; + } + else if (gAgent.prefersPG() || gAgent.prefersMature()) + { + LLNotificationsUtil::add(notificationID+"_Change", llsdBlock, llsdBlock, handle_special_notification_callback); + return true; + } + } + return false; +} + +bool attempt_standard_notification(LLMessageSystem* msgsystem) +{ + // if we have additional alert data + if (msgsystem->has(_PREHASH_AlertInfo) && msgsystem->getNumberOfBlocksFast(_PREHASH_AlertInfo) > 0) + { + // notification was specified using the new mechanism, so we can just handle it here + std::string notificationID; + std::string llsdRaw; + LLSD llsdBlock; + msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_Message, notificationID); + msgsystem->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsdRaw); + if (llsdRaw.length()) + { + std::istringstream llsdData(llsdRaw); + if (!LLSDSerialize::deserialize(llsdBlock, llsdData, llsdRaw.length())) + { + llwarns << "attempt_standard_notification: Attempted to read notification parameter data into LLSD but failed:" << llsdRaw << llendl; + } + } + + if ( + (notificationID == "RegionEntryAccessBlocked") || + (notificationID == "LandClaimAccessBlocked") || + (notificationID == "LandBuyAccessBlocked") + ) + { + /*--------------------------------------------------------------------- + (Commented so a grep will find the notification strings, since + we construct them on the fly; if you add additional notifications, + please update the comment.) + + Could throw any of the following notifications: + + RegionEntryAccessBlocked + RegionEntryAccessBlocked_Notify + RegionEntryAccessBlocked_Change + RegionEntryAccessBlocked_KB + LandClaimAccessBlocked + LandClaimAccessBlocked_Notify + LandClaimAccessBlocked_Change + LandClaimAccessBlocked_KB + LandBuyAccessBlocked + LandBuyAccessBlocked_Notify + LandBuyAccessBlocked_Change + LandBuyAccessBlocked_KB + + -----------------------------------------------------------------------*/ + if (handle_special_notification(notificationID, llsdBlock)) + { + return true; + } + } + + LLNotificationsUtil::add(notificationID, llsdBlock); + return true; + } + return false; +} + + +void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) +{ + // make sure the cursor is back to the usual default since the + // alert is probably due to some kind of error. + gViewerWindow->getWindow()->resetBusyCount(); + + if (!attempt_standard_notification(msgsystem)) + { + BOOL modal = FALSE; + msgsystem->getBOOL("AlertData", "Modal", modal); + std::string buffer; + msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); + process_alert_core(buffer, modal); + } +} + +// The only difference between this routine and the previous is the fact that +// for this routine, the modal parameter is always false. Sadly, for the message +// handled by this routine, there is no "Modal" parameter on the message, and +// there's no API to tell if a message has the given parameter or not. +// So we can't handle the messages with the same handler. +void process_alert_message(LLMessageSystem *msgsystem, void **user_data) +{ + // make sure the cursor is back to the usual default since the + // alert is probably due to some kind of error. + gViewerWindow->getWindow()->resetBusyCount(); + + if (!attempt_standard_notification(msgsystem)) + { + BOOL modal = FALSE; + std::string buffer; + msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); + process_alert_core(buffer, modal); + } +} + +void process_alert_core(const std::string& message, BOOL modal) +{ + // HACK -- handle callbacks for specific alerts. It also is localized in notifications.xml + if ( message == "You died and have been teleported to your home location") + { + LLViewerStats::getInstance()->incStat(LLViewerStats::ST_KILLED_COUNT); + } + else if( message == "Home position set." ) + { + // save the home location image to disk + std::string snap_filename = gDirUtilp->getLindenUserDir(); + snap_filename += gDirUtilp->getDirDelimiter(); + snap_filename += SCREEN_HOME_FILENAME; + gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw(), FALSE, FALSE); + } + + const std::string ALERT_PREFIX("ALERT: "); + const std::string NOTIFY_PREFIX("NOTIFY: "); + if (message.find(ALERT_PREFIX) == 0) + { + // Allow the server to spawn a named alert so that server alerts can be + // translated out of English. + std::string alert_name(message.substr(ALERT_PREFIX.length())); + LLNotificationsUtil::add(alert_name); + } + else if (message.find(NOTIFY_PREFIX) == 0) + { + // Allow the server to spawn a named notification so that server notifications can be + // translated out of English. + std::string notify_name(message.substr(NOTIFY_PREFIX.length())); + LLNotificationsUtil::add(notify_name); + } + else if (message[0] == '/') + { + // System message is important, show in upper-right box not tip + std::string text(message.substr(1)); + LLSD args; + if (text.substr(0,17) == "RESTART_X_MINUTES") + { + S32 mins = 0; + LLStringUtil::convertToS32(text.substr(18), mins); + args["MINUTES"] = llformat("%d",mins); + LLNotificationsUtil::add("RegionRestartMinutes", args); + } + else if (text.substr(0,17) == "RESTART_X_SECONDS") + { + S32 secs = 0; + LLStringUtil::convertToS32(text.substr(18), secs); + args["SECONDS"] = llformat("%d",secs); + LLNotificationsUtil::add("RegionRestartSeconds", args); + } + else + { + std::string new_msg =LLNotifications::instance().getGlobalString(text); + args["MESSAGE"] = new_msg; + LLNotificationsUtil::add("SystemMessage", args); + } + } + else if (modal) + { + LLSD args; + std::string new_msg =LLNotifications::instance().getGlobalString(message); + args["ERROR_MESSAGE"] = new_msg; + LLNotificationsUtil::add("ErrorMessage", args); + } + else + { + LLSD args; + std::string new_msg =LLNotifications::instance().getGlobalString(message); + args["MESSAGE"] = new_msg; + LLNotificationsUtil::add("SystemMessageTip", args); + } +} + +mean_collision_list_t gMeanCollisionList; +time_t gLastDisplayedTime = 0; + +void handle_show_mean_events(void *) +{ + if (gNoRender) + { + return; + } + LLFloaterReg::showInstance("bumps"); + //LLFloaterBump::showInstance(); +} + +void mean_name_callback(const LLUUID &id, const std::string& full_name, bool is_group) +{ + if (gNoRender) + { + return; + } + + static const U32 max_collision_list_size = 20; + if (gMeanCollisionList.size() > max_collision_list_size) + { + mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); + for (U32 i=0; i<max_collision_list_size; i++) iter++; + for_each(iter, gMeanCollisionList.end(), DeletePointer()); + gMeanCollisionList.erase(iter, gMeanCollisionList.end()); + } + + for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); + iter != gMeanCollisionList.end(); ++iter) + { + LLMeanCollisionData *mcd = *iter; + if (mcd->mPerp == id) + { + mcd->mFullName = full_name; + } + } +} + +void process_mean_collision_alert_message(LLMessageSystem *msgsystem, void **user_data) +{ + if (gAgent.inPrelude()) + { + // In prelude, bumping is OK. This dialog is rather confusing to + // newbies, so we don't show it. Drop the packet on the floor. + return; + } + + // make sure the cursor is back to the usual default since the + // alert is probably due to some kind of error. + gViewerWindow->getWindow()->resetBusyCount(); + + LLUUID perp; + U32 time; + U8 u8type; + EMeanCollisionType type; + F32 mag; + + S32 i, num = msgsystem->getNumberOfBlocks(_PREHASH_MeanCollision); + + for (i = 0; i < num; i++) + { + msgsystem->getUUIDFast(_PREHASH_MeanCollision, _PREHASH_Perp, perp); + msgsystem->getU32Fast(_PREHASH_MeanCollision, _PREHASH_Time, time); + msgsystem->getF32Fast(_PREHASH_MeanCollision, _PREHASH_Mag, mag); + msgsystem->getU8Fast(_PREHASH_MeanCollision, _PREHASH_Type, u8type); + + type = (EMeanCollisionType)u8type; + + BOOL b_found = FALSE; + + for (mean_collision_list_t::iterator iter = gMeanCollisionList.begin(); + iter != gMeanCollisionList.end(); ++iter) + { + LLMeanCollisionData *mcd = *iter; + if ((mcd->mPerp == perp) && (mcd->mType == type)) + { + mcd->mTime = time; + mcd->mMag = mag; + b_found = TRUE; + break; + } + } + + if (!b_found) + { + LLMeanCollisionData *mcd = new LLMeanCollisionData(gAgentID, perp, time, type, mag); + gMeanCollisionList.push_front(mcd); + gCacheName->get(perp, false, boost::bind(&mean_name_callback, _1, _2, _3)); + } + } +} + +void process_frozen_message(LLMessageSystem *msgsystem, void **user_data) +{ + // make sure the cursor is back to the usual default since the + // alert is probably due to some kind of error. + gViewerWindow->getWindow()->resetBusyCount(); + BOOL b_frozen; + + msgsystem->getBOOL("FrozenData", "Data", b_frozen); + + // TODO: make being frozen change view + if (b_frozen) + { + } + else + { + } +} + +// do some extra stuff once we get our economy data +void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) +{ + LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance()); + + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + + LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL; + + gMenuHolder->getChild<LLUICtrl>("Upload Image")->setLabelArg("[COST]", llformat("%d", upload_cost)); + gMenuHolder->getChild<LLUICtrl>("Upload Sound")->setLabelArg("[COST]", llformat("%d", upload_cost)); + gMenuHolder->getChild<LLUICtrl>("Upload Animation")->setLabelArg("[COST]", llformat("%d", upload_cost)); + gMenuHolder->getChild<LLUICtrl>("Bulk Upload")->setLabelArg("[COST]", llformat("%d", upload_cost)); +} + +void notify_cautioned_script_question(const LLSD& notification, const LLSD& response, S32 orig_questions, BOOL granted) +{ + // only continue if at least some permissions were requested + if (orig_questions) + { + // check to see if the person we are asking + + // "'[OBJECTNAME]', an object owned by '[OWNERNAME]', + // located in [REGIONNAME] at [REGIONPOS], + // has been <granted|denied> permission to: [PERMISSIONS]." + + LLUIString notice(LLTrans::getString(granted ? "ScriptQuestionCautionChatGranted" : "ScriptQuestionCautionChatDenied")); + + // always include the object name and owner name + notice.setArg("[OBJECTNAME]", notification["payload"]["object_name"].asString()); + notice.setArg("[OWNERNAME]", notification["payload"]["owner_name"].asString()); + + // try to lookup viewerobject that corresponds to the object that + // requested permissions (here, taskid->requesting object id) + BOOL foundpos = FALSE; + LLViewerObject* viewobj = gObjectList.findObject(notification["payload"]["task_id"].asUUID()); + if (viewobj) + { + // found the viewerobject, get it's position in its region + LLVector3 objpos(viewobj->getPosition()); + + // try to lookup the name of the region the object is in + LLViewerRegion* viewregion = viewobj->getRegion(); + if (viewregion) + { + // got the region, so include the region and 3d coordinates of the object + notice.setArg("[REGIONNAME]", viewregion->getName()); + std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); + notice.setArg("[REGIONPOS]", formatpos); + + foundpos = TRUE; + } + } + + if (!foundpos) + { + // unable to determine location of the object + notice.setArg("[REGIONNAME]", "(unknown region)"); + notice.setArg("[REGIONPOS]", "(unknown position)"); + } + + // check each permission that was requested, and list each + // permission that has been flagged as a caution permission + BOOL caution = FALSE; + S32 count = 0; + std::string perms; + for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) + { + if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && SCRIPT_QUESTION_IS_CAUTION[i]) + { + count++; + caution = TRUE; + + // add a comma before the permission description if it is not the first permission + // added to the list or the last permission to check + if ((count > 1) && (i < SCRIPT_PERMISSION_EOF)) + { + perms.append(", "); + } + + perms.append(LLTrans::getString(SCRIPT_QUESTIONS[i])); + } + } + + notice.setArg("[PERMISSIONS]", perms); + + // log a chat message as long as at least one requested permission + // is a caution permission + if (caution) + { + LLChat chat(notice.getString()); + // LLFloaterChat::addChat(chat, FALSE, FALSE); + } + } +} + +bool script_question_cb(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLMessageSystem *msg = gMessageSystem; + S32 orig = notification["payload"]["questions"].asInteger(); + S32 new_questions = orig; + + // check whether permissions were granted or denied + BOOL allowed = TRUE; + // the "yes/accept" button is the first button in the template, making it button 0 + // if any other button was clicked, the permissions were denied + if (option != 0) + { + new_questions = 0; + allowed = FALSE; + } + + LLUUID task_id = notification["payload"]["task_id"].asUUID(); + LLUUID item_id = notification["payload"]["item_id"].asUUID(); + + // reply with the permissions granted or denied + msg->newMessageFast(_PREHASH_ScriptAnswerYes); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Data); + msg->addUUIDFast(_PREHASH_TaskID, task_id); + msg->addUUIDFast(_PREHASH_ItemID, item_id); + msg->addS32Fast(_PREHASH_Questions, new_questions); + msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); + + // only log a chat message if caution prompts are enabled + if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) + { + // log a chat message, if appropriate + notify_cautioned_script_question(notification, response, orig, allowed); + } + + if ( response["Mute"] ) // mute + { + LLMuteList::getInstance()->add(LLMute(item_id, notification["payload"]["object_name"].asString(), LLMute::OBJECT)); + + // purge the message queue of any previously queued requests from the same source. DEV-4879 + class OfferMatcher : public LLNotificationsUI::LLScreenChannel::Matcher + { + public: + OfferMatcher(const LLUUID& to_block) : blocked_id(to_block) {} + bool matches(const LLNotificationPtr notification) const + { + if (notification->getName() == "ScriptQuestionCaution" + || notification->getName() == "ScriptQuestion") + { + return (notification->getPayload()["item_id"].asUUID() == blocked_id); + } + return false; + } + private: + const LLUUID& blocked_id; + }; + + LLNotificationsUI::LLChannelManager::getInstance()->killToastsFromChannel(LLUUID( + gSavedSettings.getString("NotificationChannelUUID")), OfferMatcher(item_id)); + } + + if (response["Details"]) + { + // respawn notification... + LLNotificationsUtil::add(notification["name"], notification["substitutions"], notification["payload"]); + + // ...with description on top + LLNotificationsUtil::add("DebitPermissionDetails"); + } + return false; +} +static LLNotificationFunctorRegistration script_question_cb_reg_1("ScriptQuestion", script_question_cb); +static LLNotificationFunctorRegistration script_question_cb_reg_2("ScriptQuestionCaution", script_question_cb); + +void process_script_question(LLMessageSystem *msg, void **user_data) +{ + // *TODO: Translate owner name -> [FIRST] [LAST] + + LLHost sender = msg->getSender(); + + LLUUID taskid; + LLUUID itemid; + S32 questions; + std::string object_name; + std::string owner_name; + + // taskid -> object key of object requesting permissions + msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); + // itemid -> script asset key of script requesting permissions + msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); + msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name); + msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); + msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); + + // Special case. If the objects are owned by this agent, throttle per-object instead + // of per-owner. It's common for residents to reset a ton of scripts that re-request + // permissions, as with tier boxes. UUIDs can't be valid agent names and vice-versa, + // so we'll reuse the same namespace for both throttle types. + std::string throttle_name = owner_name; + std::string self_name; + LLAgentUI::buildFullname( self_name ); + if( owner_name == self_name ) + { + throttle_name = taskid.getString(); + } + + // don't display permission requests if this object is muted + if (LLMuteList::getInstance()->isMuted(taskid)) return; + + // throttle excessive requests from any specific user's scripts + typedef LLKeyThrottle<std::string> LLStringThrottle; + static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); + + switch (question_throttle.noteAction(throttle_name)) + { + case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: + LL_INFOS("Messaging") << "process_script_question throttled" + << " owner_name:" << owner_name + << LL_ENDL; + // Fall through + + case LLStringThrottle::THROTTLE_BLOCKED: + // Escape altogether until we recover + return; + + case LLStringThrottle::THROTTLE_OK: + break; + } + + std::string script_question; + if (questions) + { + BOOL caution = FALSE; + S32 count = 0; + LLSD args; + args["OBJECTNAME"] = object_name; + args["NAME"] = LLCacheName::cleanFullName(owner_name); + + // check the received permission flags against each permission + for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) + { + if (questions & LSCRIPTRunTimePermissionBits[i]) + { + count++; + script_question += " " + LLTrans::getString(SCRIPT_QUESTIONS[i]) + "\n"; + + // check whether permission question should cause special caution dialog + caution |= (SCRIPT_QUESTION_IS_CAUTION[i]); + } + } + args["QUESTIONS"] = script_question; + + LLSD payload; + payload["task_id"] = taskid; + payload["item_id"] = itemid; + payload["sender"] = sender.getIPandPort(); + payload["questions"] = questions; + payload["object_name"] = object_name; + payload["owner_name"] = owner_name; + + // check whether cautions are even enabled or not + if (gSavedSettings.getBOOL("PermissionsCautionEnabled")) + { + // display the caution permissions prompt + LLNotificationsUtil::add(caution ? "ScriptQuestionCaution" : "ScriptQuestion", args, payload); + } + else + { + // fall back to default behavior if cautions are entirely disabled + LLNotificationsUtil::add("ScriptQuestion", args, payload); + } + + } +} + + +void process_derez_container(LLMessageSystem *msg, void**) +{ + LL_WARNS("Messaging") << "call to deprecated process_derez_container" << LL_ENDL; +} + +void container_inventory_arrived(LLViewerObject* object, + LLInventoryObject::object_list_t* inventory, + S32 serial_num, + void* data) +{ + LL_DEBUGS("Messaging") << "container_inventory_arrived()" << LL_ENDL; + if( gAgentCamera.cameraMouselook() ) + { + gAgentCamera.changeCameraToDefault(); + } + + LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(); + + if (inventory->size() > 2) + { + // create a new inventory category to put this in + LLUUID cat_id; + cat_id = gInventory.createNewCategory(gInventory.getRootFolderID(), + LLFolderType::FT_NONE, + LLTrans::getString("AcquiredItems")); + + LLInventoryObject::object_list_t::const_iterator it = inventory->begin(); + LLInventoryObject::object_list_t::const_iterator end = inventory->end(); + for ( ; it != end; ++it) + { + if ((*it)->getType() != LLAssetType::AT_CATEGORY) + { + LLInventoryObject* obj = (LLInventoryObject*)(*it); + LLInventoryItem* item = (LLInventoryItem*)(obj); + LLUUID item_id; + item_id.generate(); + time_t creation_date_utc = time_corrected(); + LLPointer<LLViewerInventoryItem> new_item + = new LLViewerInventoryItem(item_id, + cat_id, + item->getPermissions(), + item->getAssetUUID(), + item->getType(), + item->getInventoryType(), + item->getName(), + item->getDescription(), + LLSaleInfo::DEFAULT, + item->getFlags(), + creation_date_utc); + new_item->updateServer(TRUE); + gInventory.updateItem(new_item); + } + } + gInventory.notifyObservers(); + if(active_panel) + { + active_panel->setSelection(cat_id, TAKE_FOCUS_NO); + } + } + else if (inventory->size() == 2) + { + // we're going to get one fake root category as well as the + // one actual object + LLInventoryObject::object_list_t::iterator it = inventory->begin(); + + if ((*it)->getType() == LLAssetType::AT_CATEGORY) + { + ++it; + } + + LLInventoryItem* item = (LLInventoryItem*)((LLInventoryObject*)(*it)); + const LLUUID category = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(item->getType())); + + LLUUID item_id; + item_id.generate(); + time_t creation_date_utc = time_corrected(); + LLPointer<LLViewerInventoryItem> new_item + = new LLViewerInventoryItem(item_id, category, + item->getPermissions(), + item->getAssetUUID(), + item->getType(), + item->getInventoryType(), + item->getName(), + item->getDescription(), + LLSaleInfo::DEFAULT, + item->getFlags(), + creation_date_utc); + new_item->updateServer(TRUE); + gInventory.updateItem(new_item); + gInventory.notifyObservers(); + if(active_panel) + { + active_panel->setSelection(item_id, TAKE_FOCUS_NO); + } + } + + // we've got the inventory, now delete this object if this was a take + BOOL delete_object = (BOOL)(intptr_t)data; + LLViewerRegion *region = gAgent.getRegion(); + if (delete_object && region) + { + gMessageSystem->newMessageFast(_PREHASH_ObjectDelete); + gMessageSystem->nextBlockFast(_PREHASH_AgentData); + gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + const U8 NO_FORCE = 0; + gMessageSystem->addU8Fast(_PREHASH_Force, NO_FORCE); + gMessageSystem->nextBlockFast(_PREHASH_ObjectData); + gMessageSystem->addU32Fast(_PREHASH_ObjectLocalID, object->getLocalID()); + gMessageSystem->sendReliable(region->getHost()); + } +} + +// method to format the time. +std::string formatted_time(const time_t& the_time) +{ + std::string dateStr = "["+LLTrans::getString("LTimeWeek")+"] [" + +LLTrans::getString("LTimeMonth")+"] [" + +LLTrans::getString("LTimeDay")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+"]:[" + +LLTrans::getString("LTimeSec")+"] [" + +LLTrans::getString("LTimeYear")+"]"; + + LLSD substitution; + substitution["datetime"] = (S32) the_time; + LLStringUtil::format (dateStr, substitution); + return dateStr; +} + + +void process_teleport_failed(LLMessageSystem *msg, void**) +{ + std::string reason; + std::string big_reason; + LLSD args; + + // if we have additional alert data + 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]; + 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; + } + + LLSD llsd_block; + std::string llsd_raw; + msg->getStringFast(_PREHASH_AlertInfo, _PREHASH_ExtraParams, llsd_raw); + if (llsd_raw.length()) + { + std::istringstream llsd_data(llsd_raw); + if (!LLSDSerialize::deserialize(llsd_block, llsd_data, llsd_raw.length())) + { + llwarns << "process_teleport_failed: Attempted to read alert parameter data into LLSD but failed:" << llsd_raw << llendl; + } + else + { + // change notification name in this special case + if (handle_special_notification("RegionEntryAccessBlocked", llsd_block)) + { + if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE ) + { + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + } + return; + } + } + } + + } + else + { + msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason); + + big_reason = LLAgent::sTeleportErrorMessages[reason]; + 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; + } + } + + LLNotificationsUtil::add("CouldNotTeleportReason", args); + + // Let the interested parties know that teleport failed. + LLViewerParcelMgr::getInstance()->onTeleportFailed(); + + if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE ) + { + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + } +} + +void process_teleport_local(LLMessageSystem *msg,void**) +{ + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_Info, _PREHASH_AgentID, agent_id); + if (agent_id != gAgent.getID()) + { + LL_WARNS("Messaging") << "Got teleport notification for wrong agent!" << LL_ENDL; + return; + } + + U32 location_id; + LLVector3 pos, look_at; + U32 teleport_flags; + msg->getU32Fast(_PREHASH_Info, _PREHASH_LocationID, location_id); + msg->getVector3Fast(_PREHASH_Info, _PREHASH_Position, pos); + msg->getVector3Fast(_PREHASH_Info, _PREHASH_LookAt, look_at); + msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); + + if( gAgent.getTeleportState() != LLAgent::TELEPORT_NONE ) + { + if( gAgent.getTeleportState() == LLAgent::TELEPORT_LOCAL ) + { + // To prevent TeleportStart messages re-activating the progress screen right + // after tp, keep the teleport state and let progress screen clear it after a short delay + // (progress screen is active but not visible) *TODO: remove when SVC-5290 is fixed + gTeleportDisplayTimer.reset(); + gTeleportDisplay = TRUE; + } + else + { + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + } + } + + // Sim tells us whether the new position is off the ground + if (teleport_flags & TELEPORT_FLAGS_IS_FLYING) + { + gAgent.setFlying(TRUE); + } + else + { + gAgent.setFlying(FALSE); + } + + gAgent.setPositionAgent(pos); + gAgentCamera.slamLookAt(look_at); + + if ( !(gAgent.getTeleportKeepsLookAt() && LLViewerJoystick::getInstance()->getOverrideCamera()) ) + { + gAgentCamera.resetView(TRUE, TRUE); + } + + // send camera update to new region + gAgentCamera.updateCamera(); + + send_agent_update(TRUE, TRUE); + + // Let the interested parties know we've teleported. + // Vadim *HACK: Agent position seems to get reset (to render position?) + // on each frame, so we have to pass the new position manually. + LLViewerParcelMgr::getInstance()->onTeleportFinished(true, gAgent.getPosGlobalFromAgent(pos)); +} + +void send_simple_im(const LLUUID& to_id, + const std::string& message, + EInstantMessage dialog, + const LLUUID& id) +{ + std::string my_name; + LLAgentUI::buildFullname(my_name); + send_improved_im(to_id, + my_name, + message, + IM_ONLINE, + dialog, + id, + NO_TIMESTAMP, + (U8*)EMPTY_BINARY_BUCKET, + EMPTY_BINARY_BUCKET_SIZE); +} + +void send_group_notice(const LLUUID& group_id, + const std::string& subject, + const std::string& message, + const LLInventoryItem* item) +{ + // Put this notice into an instant message form. + // This will mean converting the item to a binary bucket, + // and the subject/message into a single field. + std::string my_name; + LLAgentUI::buildFullname(my_name); + + // Combine subject + message into a single string. + std::ostringstream subject_and_message; + // TODO: turn all existing |'s into ||'s in subject and message. + subject_and_message << subject << "|" << message; + + // Create an empty binary bucket. + U8 bin_bucket[MAX_INVENTORY_BUFFER_SIZE]; + U8* bucket_to_send = bin_bucket; + bin_bucket[0] = '\0'; + S32 bin_bucket_size = EMPTY_BINARY_BUCKET_SIZE; + // If there is an item being sent, pack it into the binary bucket. + if (item) + { + LLSD item_def; + item_def["item_id"] = item->getUUID(); + item_def["owner_id"] = item->getPermissions().getOwner(); + std::ostringstream ostr; + LLSDSerialize::serialize(item_def, ostr, LLSDSerialize::LLSD_XML); + bin_bucket_size = ostr.str().copy( + (char*)bin_bucket, ostr.str().size()); + bin_bucket[bin_bucket_size] = '\0'; + } + else + { + bucket_to_send = (U8*) EMPTY_BINARY_BUCKET; + } + + + send_improved_im( + group_id, + my_name, + subject_and_message.str(), + IM_ONLINE, + IM_GROUP_NOTICE, + LLUUID::null, + NO_TIMESTAMP, + bucket_to_send, + bin_bucket_size); +} + +bool handle_lure_callback(const LLSD& notification, const LLSD& response) +{ + std::string text = response["message"].asString(); + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + text.append("\r\n").append(slurl.getSLURLString()); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if(0 == option) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessageFast(_PREHASH_StartLure); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->nextBlockFast(_PREHASH_Info); + msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. + msg->addStringFast(_PREHASH_Message, text); + for(LLSD::array_const_iterator it = notification["payload"]["ids"].beginArray(); + it != notification["payload"]["ids"].endArray(); + ++it) + { + LLUUID target_id = it->asUUID(); + + msg->nextBlockFast(_PREHASH_TargetData); + msg->addUUIDFast(_PREHASH_TargetID, target_id); + + // Record the offer. + { + std::string target_name; + gCacheName->getFullName(target_id, target_name); // for im log filenames + LLSD args; + args["TO_NAME"] = LLSLURL("agent", target_id, "displayname").getSLURLString();; + + LLSD payload; + + //*TODO please rewrite all keys to the same case, lower or upper + payload["from_id"] = target_id; + payload["SUPPRESS_TOAST"] = true; + LLNotificationsUtil::add("TeleportOfferSent", args, payload); + + // Add the recepient to the recent people list. + LLRecentPeople::instance().add(target_id); + } + } + gAgent.sendReliableMessage(); + } + + return false; +} + +void handle_lure(const LLUUID& invitee) +{ + LLDynamicArray<LLUUID> ids; + ids.push_back(invitee); + handle_lure(ids); +} + +// Prompt for a message to the invited user. +void handle_lure(const uuid_vec_t& ids) +{ + if (ids.empty()) return; + + if (!gAgent.getRegion()) return; + + LLSD edit_args; + edit_args["REGION"] = gAgent.getRegion()->getName(); + + LLSD payload; + for (LLDynamicArray<LLUUID>::const_iterator it = ids.begin(); + it != ids.end(); + ++it) + { + payload["ids"].append(*it); + } + if (gAgent.isGodlike()) + { + LLNotificationsUtil::add("OfferTeleportFromGod", edit_args, payload, handle_lure_callback); + } + else + { + LLNotificationsUtil::add("OfferTeleport", edit_args, payload, handle_lure_callback); + } +} + + +void send_improved_im(const LLUUID& to_id, + const std::string& name, + const std::string& message, + U8 offline, + EInstantMessage dialog, + const LLUUID& id, + U32 timestamp, + const U8* binary_bucket, + S32 binary_bucket_size) +{ + pack_instant_message( + gMessageSystem, + gAgent.getID(), + FALSE, + gAgent.getSessionID(), + to_id, + name, + message, + offline, + dialog, + id, + 0, + LLUUID::null, + gAgent.getPositionAgent(), + timestamp, + binary_bucket, + binary_bucket_size); + gAgent.sendReliableMessage(); +} + + +void send_places_query(const LLUUID& query_id, + const LLUUID& trans_id, + const std::string& query_text, + U32 query_flags, + S32 category, + const std::string& sim_name) +{ + LLMessageSystem* msg = gMessageSystem; + + msg->newMessage("PlacesQuery"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->addUUID("QueryID", query_id); + msg->nextBlock("TransactionData"); + msg->addUUID("TransactionID", trans_id); + msg->nextBlock("QueryData"); + msg->addString("QueryText", query_text); + msg->addU32("QueryFlags", query_flags); + msg->addS8("Category", (S8)category); + msg->addString("SimName", sim_name); + gAgent.sendReliableMessage(); +} + + +void process_user_info_reply(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); + if(agent_id != gAgent.getID()) + { + LL_WARNS("Messaging") << "process_user_info_reply - " + << "wrong agent id." << LL_ENDL; + } + + BOOL im_via_email; + msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email); + std::string email; + msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email); + std::string dir_visibility; + msg->getString( "UserData", "DirectoryVisibility", dir_visibility); + + LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email); + LLFloaterPostcard::updateUserInfo(email); +} + + +//--------------------------------------------------------------------------- +// Script Dialog +//--------------------------------------------------------------------------- + +const S32 SCRIPT_DIALOG_MAX_BUTTONS = 12; +const S32 SCRIPT_DIALOG_BUTTON_STR_SIZE = 24; +const S32 SCRIPT_DIALOG_MAX_MESSAGE_SIZE = 512; +const char* SCRIPT_DIALOG_HEADER = "Script Dialog:\n"; + +bool callback_script_dialog(const LLSD& notification, const LLSD& response) +{ + LLNotificationForm form(notification["form"]); + + std::string rtn_text; + S32 button_idx; + button_idx = LLNotification::getSelectedOption(notification, response); + if (response[TEXTBOX_MAGIC_TOKEN].isDefined()) + { + if (response[TEXTBOX_MAGIC_TOKEN].isString()) + rtn_text = response[TEXTBOX_MAGIC_TOKEN].asString(); + else + rtn_text.clear(); // bool marks empty string + } + else + { + rtn_text = LLNotification::getSelectedOptionName(response); + } + + // Didn't click "Ignore" + if (button_idx != -1) + { + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("ScriptDialogReply"); + msg->nextBlock("AgentData"); + msg->addUUID("AgentID", gAgent.getID()); + msg->addUUID("SessionID", gAgent.getSessionID()); + msg->nextBlock("Data"); + msg->addUUID("ObjectID", notification["payload"]["object_id"].asUUID()); + msg->addS32("ChatChannel", notification["payload"]["chat_channel"].asInteger()); + msg->addS32("ButtonIndex", button_idx); + msg->addString("ButtonLabel", rtn_text); + msg->sendReliable(LLHost(notification["payload"]["sender"].asString())); + } + + return false; +} +static LLNotificationFunctorRegistration callback_script_dialog_reg_1("ScriptDialog", callback_script_dialog); +static LLNotificationFunctorRegistration callback_script_dialog_reg_2("ScriptDialogGroup", callback_script_dialog); + +void process_script_dialog(LLMessageSystem* msg, void**) +{ + S32 i; + LLSD payload; + + LLUUID object_id; + msg->getUUID("Data", "ObjectID", object_id); + + if (LLMuteList::getInstance()->isMuted(object_id)) + { + return; + } + + std::string message; + std::string first_name; + std::string last_name; + std::string title; + + S32 chat_channel; + msg->getString("Data", "FirstName", first_name); + msg->getString("Data", "LastName", last_name); + msg->getString("Data", "ObjectName", title); + msg->getString("Data", "Message", message); + msg->getS32("Data", "ChatChannel", chat_channel); + + // unused for now + LLUUID image_id; + msg->getUUID("Data", "ImageID", image_id); + + payload["sender"] = msg->getSender().getIPandPort(); + payload["object_id"] = object_id; + payload["chat_channel"] = chat_channel; + + // build up custom form + S32 button_count = msg->getNumberOfBlocks("Buttons"); + if (button_count > SCRIPT_DIALOG_MAX_BUTTONS) + { + llwarns << "Too many script dialog buttons - omitting some" << llendl; + button_count = SCRIPT_DIALOG_MAX_BUTTONS; + } + + LLNotificationForm form; + for (i = 0; i < button_count; i++) + { + std::string tdesc; + msg->getString("Buttons", "ButtonLabel", tdesc, i); + form.addElement("button", std::string(tdesc)); + } + + LLSD args; + args["TITLE"] = title; + args["MESSAGE"] = message; + LLNotificationPtr notification; + if (!first_name.empty()) + { + args["NAME"] = LLCacheName::buildFullName(first_name, last_name); + notification = LLNotifications::instance().add( + LLNotification::Params("ScriptDialog").substitutions(args).payload(payload).form_elements(form.asLLSD())); + } + else + { + args["GROUPNAME"] = last_name; + notification = LLNotifications::instance().add( + LLNotification::Params("ScriptDialogGroup").substitutions(args).payload(payload).form_elements(form.asLLSD())); + } +} + +//--------------------------------------------------------------------------- + + +std::vector<LLSD> gLoadUrlList; + +bool callback_load_url(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + + if (0 == option) + { + LLWeb::loadURL(notification["payload"]["url"].asString()); + } + + return false; +} +static LLNotificationFunctorRegistration callback_load_url_reg("LoadWebPage", callback_load_url); + + +// We've got the name of the person who owns the object hurling the url. +// Display confirmation dialog. +void callback_load_url_name(const LLUUID& id, const std::string& full_name, bool is_group) +{ + std::vector<LLSD>::iterator it; + for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) + { + LLSD load_url_info = *it; + if (load_url_info["owner_id"].asUUID() == id) + { + it = gLoadUrlList.erase(it); + + std::string owner_name; + if (is_group) + { + owner_name = full_name + LLTrans::getString("Group"); + } + else + { + owner_name = full_name; + } + + // For legacy name-only mutes. + if (LLMuteList::getInstance()->isMuted(LLUUID::null, owner_name)) + { + continue; + } + LLSD args; + args["URL"] = load_url_info["url"].asString(); + args["MESSAGE"] = load_url_info["message"].asString();; + args["OBJECTNAME"] = load_url_info["object_name"].asString(); + args["NAME"] = owner_name; + + LLNotificationsUtil::add("LoadWebPage", args, load_url_info); + } + else + { + ++it; + } + } +} + +void process_load_url(LLMessageSystem* msg, void**) +{ + LLUUID object_id; + LLUUID owner_id; + BOOL owner_is_group; + char object_name[256]; /* Flawfinder: ignore */ + char message[256]; /* Flawfinder: ignore */ + char url[256]; /* Flawfinder: ignore */ + + msg->getString("Data", "ObjectName", 256, object_name); + msg->getUUID( "Data", "ObjectID", object_id); + msg->getUUID( "Data", "OwnerID", owner_id); + msg->getBOOL( "Data", "OwnerIsGroup", owner_is_group); + msg->getString("Data", "Message", 256, message); + msg->getString("Data", "URL", 256, url); + + LLSD payload; + payload["object_id"] = object_id; + payload["owner_id"] = owner_id; + payload["owner_is_group"] = owner_is_group; + payload["object_name"] = object_name; + payload["message"] = message; + payload["url"] = url; + + // URL is safety checked in load_url above + + // Check if object or owner is muted + if (LLMuteList::getInstance()->isMuted(object_id, object_name) || + LLMuteList::getInstance()->isMuted(owner_id)) + { + LL_INFOS("Messaging")<<"Ignoring load_url from muted object/owner."<<LL_ENDL; + return; + } + + // Add to list of pending name lookups + gLoadUrlList.push_back(payload); + + gCacheName->get(owner_id, owner_is_group, + boost::bind(&callback_load_url_name, _1, _2, _3)); +} + + +void callback_download_complete(void** data, S32 result, LLExtStat ext_status) +{ + std::string* filepath = (std::string*)data; + LLSD args; + args["DOWNLOAD_PATH"] = *filepath; + LLNotificationsUtil::add("FinishedRawDownload", args); + delete filepath; +} + + +void process_initiate_download(LLMessageSystem* msg, void**) +{ + LLUUID agent_id; + msg->getUUID("AgentData", "AgentID", agent_id); + if (agent_id != gAgent.getID()) + { + LL_WARNS("Messaging") << "Initiate download for wrong agent" << LL_ENDL; + return; + } + + std::string sim_filename; + std::string viewer_filename; + msg->getString("FileData", "SimFilename", sim_filename); + msg->getString("FileData", "ViewerFilename", viewer_filename); + + if (!gXferManager->validateFileForRequest(viewer_filename)) + { + llwarns << "SECURITY: Unauthorized download to local file " << viewer_filename << llendl; + return; + } + gXferManager->requestFile(viewer_filename, + sim_filename, + LL_PATH_NONE, + msg->getSender(), + FALSE, // don't delete remote + callback_download_complete, + (void**)new std::string(viewer_filename)); +} + + +void process_script_teleport_request(LLMessageSystem* msg, void**) +{ + if (!gSavedSettings.getBOOL("ScriptsCanShowUI")) return; + + std::string object_name; + std::string sim_name; + LLVector3 pos; + LLVector3 look_at; + + msg->getString("Data", "ObjectName", object_name); + msg->getString("Data", "SimName", sim_name); + msg->getVector3("Data", "SimPosition", pos); + msg->getVector3("Data", "LookAt", look_at); + + LLFloaterWorldMap* instance = LLFloaterWorldMap::getInstance(); + if(instance) + { + instance->trackURL( + sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]); + LLFloaterReg::showInstance("world_map", "center"); + } + + // remove above two lines and replace with below line + // to re-enable parcel browser for llMapDestination() + // LLURLDispatcher::dispatch(LLSLURL::buildSLURL(sim_name, (S32)pos.mV[VX], (S32)pos.mV[VY], (S32)pos.mV[VZ]), FALSE); + +} + +void process_covenant_reply(LLMessageSystem* msg, void**) +{ + LLUUID covenant_id, estate_owner_id; + std::string estate_name; + U32 covenant_timestamp; + msg->getUUID("Data", "CovenantID", covenant_id); + msg->getU32("Data", "CovenantTimestamp", covenant_timestamp); + msg->getString("Data", "EstateName", estate_name); + msg->getUUID("Data", "EstateOwnerID", estate_owner_id); + + LLPanelEstateCovenant::updateEstateName(estate_name); + LLPanelLandCovenant::updateEstateName(estate_name); + LLFloaterBuyLand::updateEstateName(estate_name); + + std::string owner_name = + LLSLURL("agent", estate_owner_id, "inspect").getSLURLString(); + LLPanelEstateCovenant::updateEstateOwnerName(owner_name); + LLPanelLandCovenant::updateEstateOwnerName(owner_name); + LLFloaterBuyLand::updateEstateOwnerName(owner_name); + + LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile"); + if (panel) + { + panel->updateEstateName(estate_name); + panel->updateEstateOwnerName(owner_name); + } + + // standard message, not from system + std::string last_modified; + if (covenant_timestamp == 0) + { + last_modified = LLTrans::getString("covenant_last_modified")+LLTrans::getString("never_text"); + } + else + { + last_modified = LLTrans::getString("covenant_last_modified")+"[" + +LLTrans::getString("LTimeWeek")+"] [" + +LLTrans::getString("LTimeMonth")+"] [" + +LLTrans::getString("LTimeDay")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+"]:[" + +LLTrans::getString("LTimeSec")+"] [" + +LLTrans::getString("LTimeYear")+"]"; + LLSD substitution; + substitution["datetime"] = (S32) covenant_timestamp; + LLStringUtil::format (last_modified, substitution); + } + + LLPanelEstateCovenant::updateLastModified(last_modified); + LLPanelLandCovenant::updateLastModified(last_modified); + LLFloaterBuyLand::updateLastModified(last_modified); + + // load the actual covenant asset data + const BOOL high_priority = TRUE; + if (covenant_id.notNull()) + { + gAssetStorage->getEstateAsset(gAgent.getRegionHost(), + gAgent.getID(), + gAgent.getSessionID(), + covenant_id, + LLAssetType::AT_NOTECARD, + ET_Covenant, + onCovenantLoadComplete, + NULL, + high_priority); + } + else + { + std::string covenant_text; + if (estate_owner_id.isNull()) + { + // mainland + covenant_text = LLTrans::getString("RegionNoCovenant"); + } + else + { + covenant_text = LLTrans::getString("RegionNoCovenantOtherOwner"); + } + LLPanelEstateCovenant::updateCovenantText(covenant_text, covenant_id); + LLPanelLandCovenant::updateCovenantText(covenant_text); + LLFloaterBuyLand::updateCovenantText(covenant_text, covenant_id); + if (panel) + { + panel->updateCovenantText(covenant_text); + } + } +} + +void onCovenantLoadComplete(LLVFS *vfs, + const LLUUID& asset_uuid, + LLAssetType::EType type, + void* user_data, S32 status, LLExtStat ext_status) +{ + LL_DEBUGS("Messaging") << "onCovenantLoadComplete()" << LL_ENDL; + std::string covenant_text; + if(0 == status) + { + LLVFile file(vfs, asset_uuid, type, LLVFile::READ); + + S32 file_length = file.getSize(); + + std::vector<char> buffer(file_length+1); + file.read((U8*)&buffer[0], file_length); + // put a EOS at the end + buffer[file_length] = '\0'; + + if( (file_length > 19) && !strncmp( &buffer[0], "Linden text version", 19 ) ) + { + LLViewerTextEditor::Params params; + params.name("temp"); + params.max_text_length(file_length+1); + LLViewerTextEditor * editor = LLUICtrlFactory::create<LLViewerTextEditor> (params); + if( !editor->importBuffer( &buffer[0], file_length+1 ) ) + { + LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; + covenant_text = "Problem importing estate covenant."; + } + else + { + // Version 0 (just text, doesn't include version number) + covenant_text = editor->getText(); + } + delete editor; + } + else + { + LL_WARNS("Messaging") << "Problem importing estate covenant: Covenant file format error." << LL_ENDL; + covenant_text = "Problem importing estate covenant: Covenant file format error."; + } + } + else + { + LLViewerStats::getInstance()->incStat( LLViewerStats::ST_DOWNLOAD_FAILED ); + + if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status || + LL_ERR_FILE_EMPTY == status) + { + covenant_text = "Estate covenant notecard is missing from database."; + } + else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status) + { + covenant_text = "Insufficient permissions to view estate covenant."; + } + else + { + covenant_text = "Unable to load estate covenant at this time."; + } + + LL_WARNS("Messaging") << "Problem loading notecard: " << status << LL_ENDL; + } + LLPanelEstateCovenant::updateCovenantText(covenant_text, asset_uuid); + LLPanelLandCovenant::updateCovenantText(covenant_text); + LLFloaterBuyLand::updateCovenantText(covenant_text, asset_uuid); + + LLPanelPlaceProfile* panel = LLSideTray::getInstance()->getPanel<LLPanelPlaceProfile>("panel_place_profile"); + if (panel) + { + panel->updateCovenantText(covenant_text); + } +} + + +void process_feature_disabled_message(LLMessageSystem* msg, void**) +{ + // Handle Blacklisted feature simulator response... + LLUUID agentID; + LLUUID transactionID; + std::string messageText; + msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0); + msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID); + msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID); + + LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL; +} + +// ------------------------------------------------------------ +// Message system exception callbacks +// ------------------------------------------------------------ + +void invalid_message_callback(LLMessageSystem* msg, + void*, + EMessageException exception) +{ + LLAppViewer::instance()->badNetworkHandler(); +} + +// Please do not add more message handlers here. This file is huge. +// Put them in a file related to the functionality you are implementing. + +void LLOfferInfo::forceResponse(InventoryOfferResponse response) +{ + LLNotification::Params params("UserGiveItem"); + params.functor.function(boost::bind(&LLOfferInfo::inventory_offer_callback, this, _1, _2)); + LLNotifications::instance().forceResponse(params, response); +} + diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index aa83bcb68b..8e049e76df 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -572,21 +572,30 @@ public: // only display these messages if we are actually rendering beacons at this moment if (LLPipeline::getRenderBeacons(NULL) && LLFloaterReg::instanceVisible("beacons")) { - if (LLPipeline::getRenderParticleBeacons(NULL)) + if (LLPipeline::getRenderMOAPBeacons(NULL)) { - addText(xpos, ypos, beacon_particle); + addText(xpos, ypos, "Viewing media beacons (white)"); ypos += y_inc; } + if (LLPipeline::toggleRenderTypeControlNegated((void*)LLPipeline::RENDER_TYPE_PARTICLES)) { addText(xpos, ypos, particle_hiding); ypos += y_inc; } - if (LLPipeline::getRenderPhysicalBeacons(NULL)) + + if (LLPipeline::getRenderParticleBeacons(NULL)) + { + addText(xpos, ypos, "Viewing particle beacons (blue)"); + ypos += y_inc; + } + + if (LLPipeline::getRenderSoundBeacons(NULL)) { - addText(xpos, ypos, beacon_physical); + addText(xpos, ypos, "Viewing sound beacons (yellow)"); ypos += y_inc; } + if (LLPipeline::getRenderScriptedBeacons(NULL)) { addText(xpos, ypos, beacon_scripted); @@ -598,9 +607,10 @@ public: addText(xpos, ypos, beacon_scripted_touch); ypos += y_inc; } - if (LLPipeline::getRenderSoundBeacons(NULL)) + + if (LLPipeline::getRenderPhysicalBeacons(NULL)) { - addText(xpos, ypos, beacon_sound); + addText(xpos, ypos, "Viewing physical object beacons (green)"); ypos += y_inc; } } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 65fdc12f0a..58dc90ccd9 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -253,6 +253,7 @@ S32 LLPipeline::sCompiles = 0; BOOL LLPipeline::sPickAvatar = TRUE; BOOL LLPipeline::sDynamicLOD = TRUE; BOOL LLPipeline::sShowHUDAttachments = TRUE; +BOOL LLPipeline::sRenderMOAPBeacons = FALSE; BOOL LLPipeline::sRenderPhysicalBeacons = TRUE; BOOL LLPipeline::sRenderScriptedBeacons = FALSE; BOOL LLPipeline::sRenderScriptedTouchBeacons = TRUE; @@ -2510,6 +2511,42 @@ void renderPhysicalBeacons(LLDrawable* drawablep) } } +void renderMOAPBeacons(LLDrawable* drawablep) +{ + LLViewerObject *vobj = drawablep->getVObj(); + + if(!vobj || vobj->isAvatar()) + return; + + BOOL beacon=FALSE; + U8 tecount=vobj->getNumTEs(); + for(int x=0;x<tecount;x++) + { + if(vobj->getTE(x)->hasMedia()) + { + beacon=TRUE; + break; + } + } + if(beacon==TRUE) + { + if (gPipeline.sRenderBeacons) + { + gObjectList.addDebugBeacon(vobj->getPositionAgent(), "", LLColor4(1.f, 1.f, 1.f, 0.5f), LLColor4(1.f, 1.f, 1.f, 0.5f), gSavedSettings.getS32("DebugBeaconLineWidth")); + } + + if (gPipeline.sRenderHighlight) + { + S32 face_id; + S32 count = drawablep->getNumFaces(); + for (face_id = 0; face_id < count; face_id++) + { + gPipeline.mHighlightFaces.push_back(drawablep->getFace(face_id) ); + } + } + } +} + void renderParticleBeacons(LLDrawable* drawablep) { // Look for attachments, objects, etc. @@ -2715,6 +2752,11 @@ void LLPipeline::postSort(LLCamera& camera) forAllVisibleDrawables(renderPhysicalBeacons); } + if(sRenderMOAPBeacons) + { + forAllVisibleDrawables(renderMOAPBeacons); + } + if (sRenderParticleBeacons) { forAllVisibleDrawables(renderParticleBeacons); @@ -4938,6 +4980,24 @@ BOOL LLPipeline::getRenderScriptedTouchBeacons(void*) } // static +void LLPipeline::setRenderMOAPBeacons(BOOL val) +{ + sRenderMOAPBeacons = val; +} + +// static +void LLPipeline::toggleRenderMOAPBeacons(void*) +{ + sRenderMOAPBeacons = !sRenderMOAPBeacons; +} + +// static +BOOL LLPipeline::getRenderMOAPBeacons(void*) +{ + return sRenderMOAPBeacons; +} + +// static void LLPipeline::setRenderPhysicalBeacons(BOOL val) { sRenderPhysicalBeacons = val; diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index e99b0d71e3..92ae40ebb0 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -312,6 +312,10 @@ public: static void toggleRenderSoundBeacons(void* data); static BOOL getRenderSoundBeacons(void* data); + static void setRenderMOAPBeacons(BOOL val); + static void toggleRenderMOAPBeacons(void * data); + static BOOL getRenderMOAPBeacons(void * data); + static void setRenderPhysicalBeacons(BOOL val); static void toggleRenderPhysicalBeacons(void* data); static BOOL getRenderPhysicalBeacons(void* data); @@ -698,6 +702,7 @@ protected: S32 mLightingDetail; static BOOL sRenderPhysicalBeacons; + static BOOL sRenderMOAPBeacons; static BOOL sRenderScriptedTouchBeacons; static BOOL sRenderScriptedBeacons; static BOOL sRenderParticleBeacons; diff --git a/indra/newview/skins/default/xui/de/floater_about_land.xml b/indra/newview/skins/default/xui/de/floater_about_land.xml index 8783b52013..2d8459479a 100644 --- a/indra/newview/skins/default/xui/de/floater_about_land.xml +++ b/indra/newview/skins/default/xui/de/floater_about_land.xml @@ -348,6 +348,7 @@ Nur große Parzellen können in der Suche aufgeführt werden. <combo_box.item label="Parks und Natur" name="item9"/> <combo_box.item label="Wohngebiet" name="item10"/> <combo_box.item label="Shopping" name="item11"/> + <combo_box.item label="Vermietung" name="item13"/> <combo_box.item label="Sonstige" name="item12"/> </combo_box> <combo_box name="land category"> @@ -362,6 +363,7 @@ Nur große Parzellen können in der Suche aufgeführt werden. <combo_box.item label="Parks und Natur" name="item9"/> <combo_box.item label="Wohngebiet" name="item10"/> <combo_box.item label="Shopping" name="item11"/> + <combo_box.item label="Vermietung" name="item13"/> <combo_box.item label="Sonstige" name="item12"/> </combo_box> <check_box label="Moderater Inhalt" name="MatureCheck" tool_tip=""/> @@ -437,7 +439,7 @@ Nur große Parzellen können in der Suche aufgeführt werden. (Durch Grundbesitz festgelegt) </panel.string> <panel.string name="allow_public_access"> - Öffentlichen Zugang erlauben ([MATURITY]) + Öffentlichen Zugang erlauben ([MATURITY]) (Hinweis: Bei Deaktivierung dieser Option werden Bannlinien generiert) </panel.string> <panel.string name="estate_override"> Eine oder mehrere dieser Optionen gelten auf Grundbesitzebene diff --git a/indra/newview/skins/default/xui/de/floater_map.xml b/indra/newview/skins/default/xui/de/floater_map.xml index 217a641dec..f6d9db8d53 100644 --- a/indra/newview/skins/default/xui/de/floater_map.xml +++ b/indra/newview/skins/default/xui/de/floater_map.xml @@ -1,32 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <floater name="Map" title=""> - <floater.string name="mini_map_north"> - N - </floater.string> - <floater.string name="mini_map_east"> - O - </floater.string> - <floater.string name="mini_map_west"> - W - </floater.string> - <floater.string name="mini_map_south"> - S - </floater.string> - <floater.string name="mini_map_southeast"> - SO - </floater.string> - <floater.string name="mini_map_northeast"> - NO - </floater.string> - <floater.string name="mini_map_southwest"> - SW - </floater.string> - <floater.string name="mini_map_northwest"> - NW - </floater.string> <floater.string name="ToolTipMsg"> [REGION](Doppelklicken, um Karte zu öffnen; Umschalt-Taste gedrückt halten und ziehen, um zu schwenken) </floater.string> + <floater.string name="AltToolTipMsg"> + [REGION](Doppelklicken, um zu teleportieren; Umschalttaste gedrückt halten und ziehen, um zu schwenken) + </floater.string> <floater.string name="mini_map_caption"> MINI-KARTE </floater.string> diff --git a/indra/newview/skins/default/xui/de/floater_tools.xml b/indra/newview/skins/default/xui/de/floater_tools.xml index d201fc327c..d95d674df2 100644 --- a/indra/newview/skins/default/xui/de/floater_tools.xml +++ b/indra/newview/skins/default/xui/de/floater_tools.xml @@ -64,6 +64,8 @@ <radio_item label="Fläche auswählen" name="radio select face"/> </radio_group> <check_box label="Verknüpfte Teile bearbeiten" name="checkbox edit linked parts"/> + <button label="Link" name="link_btn"/> + <button label="Verknüpfung auflösen" name="unlink_btn"/> <text name="RenderingCost" tool_tip="Zeigt die errechneten Wiedergabekosten für dieses Objekt"> þ: [COUNT] </text> diff --git a/indra/newview/skins/default/xui/de/menu_attachment_self.xml b/indra/newview/skins/default/xui/de/menu_attachment_self.xml index 644fc68ba4..325d52a22e 100644 --- a/indra/newview/skins/default/xui/de/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/de/menu_attachment_self.xml @@ -5,7 +5,7 @@ <menu_item_call label="Abnehmen" name="Detach"/> <menu_item_call label="Hinsetzen" name="Sit Down Here"/> <menu_item_call label="Aufstehen" name="Stand Up"/> - <menu_item_call label="Outfit ändern" name="Change Outfit"/> + <menu_item_call label="Mein Aussehen" name="Change Outfit"/> <menu_item_call label="Mein Outfit bearbeiten" name="Edit Outfit"/> <menu_item_call label="Meine Form bearbeiten" name="Edit My Shape"/> <menu_item_call label="Meine Freunde" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/de/menu_avatar_self.xml b/indra/newview/skins/default/xui/de/menu_avatar_self.xml index 582c76ac94..40557b7ad8 100644 --- a/indra/newview/skins/default/xui/de/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/de/menu_avatar_self.xml @@ -21,7 +21,7 @@ <context_menu label="Abnehmen" name="Object Detach"/> <menu_item_call label="Alles abnehmen" name="Detach All"/> </context_menu> - <menu_item_call label="Outfit ändern" name="Chenge Outfit"/> + <menu_item_call label="Mein Aussehen" name="Chenge Outfit"/> <menu_item_call label="Mein Outfit bearbeiten" name="Edit Outfit"/> <menu_item_call label="Meine Form bearbeiten" name="Edit My Shape"/> <menu_item_call label="Meine Freunde" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/de/menu_bottomtray.xml b/indra/newview/skins/default/xui/de/menu_bottomtray.xml index 6c4308286a..660cd2eaf3 100644 --- a/indra/newview/skins/default/xui/de/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/de/menu_bottomtray.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <menu name="hide_camera_move_controls_menu"> + <menu_item_check label="Voice aktiviert" name="EnableVoiceChat"/> <menu_item_check label="Schaltfläche Gesten" name="ShowGestureButton"/> <menu_item_check label="Schaltfläche Bewegungssteuerung" name="ShowMoveButton"/> <menu_item_check label="Schaltfläche Ansicht" name="ShowCameraButton"/> <menu_item_check label="Schaltfläche Foto" name="ShowSnapshotButton"/> - <menu_item_check label="Schaltfläche „Seitenleiste“" name="ShowSidebarButton"/> <menu_item_check label="Schaltfläche „Bauen“" name="ShowBuildButton"/> <menu_item_check label="Schaltfläche „Suchen“" name="ShowSearchButton"/> <menu_item_check label="Schaltfläche „Karte“" name="ShowWorldMapButton"/> diff --git a/indra/newview/skins/default/xui/de/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/de/menu_inspect_avatar_gear.xml index edad34a1d5..641a0ceebe 100644 --- a/indra/newview/skins/default/xui/de/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/de/menu_inspect_avatar_gear.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> +<toggleable_menu name="Gear Menu"> <menu_item_call label="Profil anzeigen" name="view_profile"/> <menu_item_call label="Freund hinzufügen" name="add_friend"/> <menu_item_call label="IM" name="im"/> @@ -11,9 +11,11 @@ <menu_item_call label="Melden" name="report"/> <menu_item_call label="Einfrieren" name="freeze"/> <menu_item_call label="Hinauswerfen" name="eject"/> + <menu_item_call label="Hinauswerfen" name="kick"/> + <menu_item_call label="CSR" name="csr"/> <menu_item_call label="Fehler in Texturen beseitigen" name="debug"/> <menu_item_call label="Auf Karte anzeigen" name="find_on_map"/> <menu_item_call label="Hineinzoomen" name="zoom_in"/> <menu_item_call label="Bezahlen" name="pay"/> <menu_item_call label="Teilen" name="share"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/de/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/de/menu_inspect_self_gear.xml index 851a96cc09..5979194bfb 100644 --- a/indra/newview/skins/default/xui/de/menu_inspect_self_gear.xml +++ b/indra/newview/skins/default/xui/de/menu_inspect_self_gear.xml @@ -1,10 +1,31 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="Hinsetzen" name="sit_down_here"/> - <menu_item_call label="Aufstehen" name="stand_up"/> - <menu_item_call label="Outfit ändern" name="change_outfit"/> - <menu_item_call label="Mein Profil" name="my_profile"/> - <menu_item_call label="Meine Freunde" name="my_friends"/> - <menu_item_call label="Meine Gruppen" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Gear Menu"> + <menu_item_call label="Hinsetzen" name="Sit Down Here"/> + <menu_item_call label="Aufstehen" name="Stand Up"/> + <context_menu label="Ausziehen" name="Take Off >"> + <context_menu label="Kleidung" name="Clothes >"> + <menu_item_call label="Hemd" name="Shirt"/> + <menu_item_call label="Hose" name="Pants"/> + <menu_item_call label="Rock" name="Skirt"/> + <menu_item_call label="Schuhe" name="Shoes"/> + <menu_item_call label="Strümpfe" name="Socks"/> + <menu_item_call label="Jacke" name="Jacket"/> + <menu_item_call label="Handschuhe" name="Gloves"/> + <menu_item_call label="Unterhemd" name="Self Undershirt"/> + <menu_item_call label="Unterhose" name="Self Underpants"/> + <menu_item_call label="Tätowierung" name="Self Tattoo"/> + <menu_item_call label="Alpha" name="Self Alpha"/> + <menu_item_call label="Alle Kleider" name="All Clothes"/> + </context_menu> + <context_menu label="HUD" name="Object Detach HUD"/> + <context_menu label="Abnehmen" name="Object Detach"/> + <menu_item_call label="Alles abnehmen" name="Detach All"/> + </context_menu> + <menu_item_call label="Outfit ändern" name="Chenge Outfit"/> + <menu_item_call label="Mein Outfit bearbeiten" name="Edit Outfit"/> + <menu_item_call label="Meine Form bearbeiten" name="Edit My Shape"/> + <menu_item_call label="Meine Freunde" name="Friends..."/> + <menu_item_call label="Meine Gruppen" name="Groups..."/> + <menu_item_call label="Mein Profil" name="Profile..."/> <menu_item_call label="Fehler in Texturen beseitigen" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/de/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/de/menu_inventory_gear_default.xml index df86a5cf71..48dec3e856 100644 --- a/indra/newview/skins/default/xui/de/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/de/menu_inventory_gear_default.xml @@ -3,6 +3,7 @@ <menu_item_call label="Neues Inventar-Fenster" name="new_window"/> <menu_item_check label="Nach Name sortieren" name="sort_by_name"/> <menu_item_check label="Nach aktuellesten Objekten sortieren" name="sort_by_recent"/> + <menu_item_check label="Ordner immer nach Namen sortieren" name="sort_folders_by_name"/> <menu_item_check label="Systemordner nach oben" name="sort_system_folders_to_top"/> <menu_item_call label="Filter anzeigen" name="show_filters"/> <menu_item_call label="Filter zurücksetzen" name="reset_filters"/> diff --git a/indra/newview/skins/default/xui/de/menu_object.xml b/indra/newview/skins/default/xui/de/menu_object.xml index 19057d4228..412bd3ac04 100644 --- a/indra/newview/skins/default/xui/de/menu_object.xml +++ b/indra/newview/skins/default/xui/de/menu_object.xml @@ -16,14 +16,14 @@ <context_menu label="Anhängen" name="Object Attach"/> <context_menu label="HUD anhängen" name="Object Attach HUD"/> </context_menu> - <context_menu label="Entfernen" name="Remove"> + <context_menu label="Verwalten" name="Remove"> <menu_item_call label="Missbrauch melden" name="Report Abuse..."/> <menu_item_call label="Ignorieren" name="Object Mute"/> <menu_item_call label="Zurückgeben" name="Return..."/> - <menu_item_call label="Löschen" name="Delete"/> </context_menu> <menu_item_call label="Nehmen" name="Pie Object Take"/> <menu_item_call label="Kopie nehmen" name="Take Copy"/> <menu_item_call label="Bezahlen" name="Pay..."/> <menu_item_call label="Kaufen" name="Buy..."/> + <menu_item_call label="Löschen" name="Delete"/> </context_menu> diff --git a/indra/newview/skins/default/xui/de/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/de/menu_places_gear_folder.xml index 132d3f6466..892f075d3c 100644 --- a/indra/newview/skins/default/xui/de/menu_places_gear_folder.xml +++ b/indra/newview/skins/default/xui/de/menu_places_gear_folder.xml @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_folder_gear"> +<toggleable_menu name="menu_folder_gear"> <menu_item_call label="Landmarke hinzufügen" name="add_landmark"/> <menu_item_call label="Ordner hinzufügen" name="add_folder"/> + <menu_item_call label="Objekt wiederherstellen" name="restore_item"/> <menu_item_call label="Ausschneiden" name="cut"/> <menu_item_call label="Kopieren" name="copy_folder"/> <menu_item_call label="Einfügen" name="paste"/> @@ -12,4 +13,4 @@ <menu_item_call label="Alle Ordner aufklappen" name="expand_all"/> <menu_item_call label="Alle Ordner schließen" name="collapse_all"/> <menu_item_check label="Nach Datum sortieren" name="sort_by_date"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/de/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/de/menu_places_gear_landmark.xml index 6af4d644af..8955f797a2 100644 --- a/indra/newview/skins/default/xui/de/menu_places_gear_landmark.xml +++ b/indra/newview/skins/default/xui/de/menu_places_gear_landmark.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_ladmark_gear"> +<toggleable_menu name="menu_ladmark_gear"> <menu_item_call label="Teleportieren" name="teleport"/> <menu_item_call label="Weitere Informationen" name="more_info"/> <menu_item_call label="Auf Karte zeigen" name="show_on_map"/> <menu_item_call label="Landmarke hinzufügen" name="add_landmark"/> <menu_item_call label="Ordner hinzufügen" name="add_folder"/> + <menu_item_call label="Objekt wiederherstellen" name="restore_item"/> <menu_item_call label="Ausschneiden" name="cut"/> <menu_item_call label="Landmarke kopieren" name="copy_landmark"/> <menu_item_call label="SLurl kopieren" name="copy_slurl"/> @@ -15,4 +16,4 @@ <menu_item_call label="Alle Ordner schließen" name="collapse_all"/> <menu_item_check label="Nach Datum sortieren" name="sort_by_date"/> <menu_item_call label="Auswahl erstellen" name="create_pick"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/de/menu_viewer.xml b/indra/newview/skins/default/xui/de/menu_viewer.xml index 4a043e1233..17bcb013cc 100644 --- a/indra/newview/skins/default/xui/de/menu_viewer.xml +++ b/indra/newview/skins/default/xui/de/menu_viewer.xml @@ -7,7 +7,7 @@ </menu_item_call> <menu_item_call label="L$ kaufen" name="Buy and Sell L$"/> <menu_item_call label="Mein Profil" name="Profile"/> - <menu_item_call label="Outfit ändern" name="ChangeOutfit"/> + <menu_item_call label="Mein Aussehen" name="ChangeOutfit"/> <menu_item_check label="Mein Inventar" name="Inventory"/> <menu_item_check label="Mein Inventar" name="ShowSidetrayInventory"/> <menu_item_check label="Meine Gesten" name="Gestures"/> @@ -35,6 +35,7 @@ <menu label="Welt" name="World"> <menu_item_check label="Minikarte" name="Mini-Map"/> <menu_item_check label="Karte" name="World Map"/> + <menu_item_check label="Suchen" name="Search"/> <menu_item_call label="Foto" name="Take Snapshot"/> <menu_item_call label="Landmarke für diesen Ort setzen" name="Create Landmark Here"/> <menu label="Ortsprofil" name="Land"> @@ -228,8 +229,10 @@ <menu label="Info anzeigen" name="Display Info"> <menu_item_check label="Zeit anzeigen" name="Show Time"/> <menu_item_check label="Render-Info anzeigen" name="Show Render Info"/> + <menu_item_check label="Texturinfos anzeigen" name="Show Texture Info"/> <menu_item_check label="Matrizen anzeigen" name="Show Matrices"/> <menu_item_check label="Farbe unter Cursor anzeigen" name="Show Color Under Cursor"/> + <menu_item_check label="Speicher anzeigen" name="Show Memory"/> <menu_item_check label="Akutalisierungen an Objekten anzeigen" name="Show Updates"/> </menu> <menu label="Fehler erzwingen" name="Force Errors"> @@ -254,6 +257,7 @@ <menu_item_check label="Shadow Frusta" name="Shadow Frusta"/> <menu_item_check label="Okklusion" name="Occlusion"/> <menu_item_check label="Bündel rendern" name="Render Batches"/> + <menu_item_check label="Typ aktualisieren" name="Update Type"/> <menu_item_check label="Texture-Anim" name="Texture Anim"/> <menu_item_check label="Textur-Priorität" name="Texture Priority"/> <menu_item_check label="Texturbereich" name="Texture Area"/> diff --git a/indra/newview/skins/default/xui/de/notifications.xml b/indra/newview/skins/default/xui/de/notifications.xml index b0ad989a59..3c63c093d2 100644 --- a/indra/newview/skins/default/xui/de/notifications.xml +++ b/indra/newview/skins/default/xui/de/notifications.xml @@ -72,9 +72,9 @@ Fehlerdetails: The notification called '[_NAME]' was not found in noti <usetemplate name="okbutton" yestext="OK"/> </notification> <notification name="LoginFailedNoNetwork"> - Eine Verbindung zum [SECOND_LIFE_GRID] konnte nicht hergestellt werden. -'[DIAGNOSTIC]' -Bitte vergewissern Sie sich, dass Ihre Internetverbindung funktioniert. + Verbindung nicht möglich zum [SECOND_LIFE_GRID]. + '[DIAGNOSTIC]' +Stellen Sie sicher, dass Ihre Internetverbindung funktioniert. <usetemplate name="okbutton" yestext="OK"/> </notification> <notification name="MessageTemplateNotFound"> @@ -340,13 +340,6 @@ Sie benötigen ein Konto, um [SECOND_LIFE] betreten zu können. Möchten Sie jet <notification name="InvalidCredentialFormat"> Sie müssen entweder den Benutzernamen oder den Vor- und Nachnamen Ihres Avatars in das Feld „Benutzername“ eingeben und die Anmeldung dann erneut versuchen. </notification> - <notification name="AddClassified"> - Anzeigen werden im Suchverzeichnis im Abschnitt „Anzeigen" und auf [http://secondlife.com/community/classifieds secondlife.com] für eine Woche angezeigt. -Füllen Sie Ihre Anzeige aus und klicken Sie auf 'Veröffentlichen...', um sie zum Verzeichnis hinzuzufügen. -Sie werden gebeten für die Anzeige zu bezahlen, wenn Sie auf 'Veröffentlichen' klicken. -Wenn Sie mehr bezahlen, erscheint Ihre Anzeige weiter oben in der Liste, ebenso wenn ein Benutzer nach Ihren Suchbegriffen sucht. - <usetemplate ignoretext="So wird eine neue Anzeige erstellt" name="okcancelignore" notext="Abbrechen" yestext="OK"/> - </notification> <notification name="DeleteClassified"> Anzeige „[NAME]“ löschen? Gebühren werden nicht rückerstattet. @@ -2768,11 +2761,11 @@ Die Schaltfläche wird angezeigt, wenn genügend Platz vorhanden ist. Wählen Sie Einwohner aus, für die Sie das Objekt freigeben möchten. </notification> <notification name="ShareItemsConfirmation"> - Möchten Sie diese Objekte wirklich für andere freigeben: + Möchten Sie wirklich die folgenden Objekte: <nolink>[ITEMS]</nolink> -Für folgende Einwohner: +für folgende Einwohner freigeben: [RESIDENTS] <usetemplate name="okcancelbuttons" notext="Abbrechen" yestext="OK"/> @@ -2863,9 +2856,6 @@ Alle stummschalten? <notification label="Welt erkunden" name="HintDestinationGuide"> Im Reiseführer finden Sie Tausende von interessanten Orten. Wählen Sie einfach einen Ort aus und klicken Sie auf „Teleportieren“. </notification> - <notification label="Aussehen ändern" name="HintAvatarPicker"> - Möchten Sie einen neuen Look ausprobieren? Klicken Sie auf die Schaltfläche unten, um mehr Avatare zu sehen. - </notification> <notification label="Seitenleiste" name="HintSidePanel"> In der Seitenleiste können Sie schnell auf Ihr Inventar, Ihre Outfits, Ihre Profile u. ä. zugreifen. </notification> @@ -2903,6 +2893,38 @@ Alle stummschalten? <button name="cancel" text="Abbrechen"/> </form> </notification> + <notification label="" name="ModeChange"> + Zum Wechsel des Modus müssen Sie das Programm beenden und neu starten. + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoClassifieds"> + Die Erstellung und Bearbeitung von Anzeigen ist nur im Modus „Erweitert“ möglich. Möchten Sie das Programm beenden und den Modus wechseln? Die Modusauswahl ist auf dem Anmeldebildschirm zu finden. + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoGroupInfo"> + Die Erstellung und Bearbeitung von Gruppen ist nur im Modus „Erweitert“ möglich. Möchten Sie das Programm beenden und den Modus wechseln? Die Modusauswahl ist auf dem Anmeldebildschirm zu finden. + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoPicks"> + Die Erstellung und Bearbeitung von Auswahlen ist nur im Modus „Erweitert“ möglich. Möchten Sie das Programm beenden und den Modus wechseln? Die Modusauswahl ist auf dem Anmeldebildschirm zu finden. + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoWorldMap"> + Die Anzeige der Weltkarte ist nur im Modus „Erweitert“ möglich. Möchten Sie das Programm beenden und den Modus wechseln? Die Modusauswahl ist auf dem Anmeldebildschirm zu finden. + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoVoiceCall"> + Voice-Anrufe sind nur im Modus „Erweitert“ möglich. Möchten Sie sich abmelden und den Modus wechseln? + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoAvatarShare"> + Die Freigabe ist nur im Modus „Erweitert“ möglich. Möchten Sie sich abmelden und den Modus wechseln? + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> + <notification label="" name="NoAvatarPay"> + Die Bezahlung anderer Einwohner ist nur im Modus „Erweitert“ möglich. Möchten Sie sich abmelden und den Modus wechseln? + <usetemplate name="okcancelbuttons" notext="Nicht beenden" yestext="Beenden"/> + </notification> <global name="UnsupportedCPU"> - Ihre CPU-Geschwindigkeit entspricht nicht den Mindestanforderungen. </global> diff --git a/indra/newview/skins/default/xui/de/panel_login.xml b/indra/newview/skins/default/xui/de/panel_login.xml index 1bee6b1ead..553bd3e2ff 100644 --- a/indra/newview/skins/default/xui/de/panel_login.xml +++ b/indra/newview/skins/default/xui/de/panel_login.xml @@ -17,6 +17,13 @@ </text> <check_box label="Kennwort merken" name="remember_check"/> <button label="Anmelden" name="connect_btn"/> + <text name="mode_selection_text"> + Modus: + </text> + <combo_box name="mode_combo" tool_tip="Wählen Sie den gewünschten Modus aus. Basis: Second Life schnell und einfach erkunden und chatten. Erweitert: Zugriff auf zusätzliche Funktionen."> + <combo_box.item label="Basis" name="Basic"/> + <combo_box.item label="Erweitert" name="Advanced"/> + </combo_box> <text name="start_location_text"> Hier anfangen: </text> diff --git a/indra/newview/skins/default/xui/de/panel_nearby_media.xml b/indra/newview/skins/default/xui/de/panel_nearby_media.xml index ef66148902..90885c7192 100644 --- a/indra/newview/skins/default/xui/de/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/de/panel_nearby_media.xml @@ -19,7 +19,7 @@ <button label="Stoppen" name="all_nearby_media_disable_btn" tool_tip="Alle Medien in der Nähe ausschalten"/> <button label="Starten" name="all_nearby_media_enable_btn" tool_tip="Alle Medien in der Nähe einschalten"/> <button name="open_prefs_btn" tool_tip="Medien-Einstellungen öffnen"/> - <button label="Mehr >>" label_selected="Weniger <<" name="more_btn" tool_tip="Erweiterte Steuerung"/> + <button label="Mehr >>" label_selected="<< Weniger" name="more_btn" tool_tip="Erweiterte Steuerung"/> <button label="Mehr >>" label_selected="Weniger <<" name="less_btn" tool_tip="Erweiterte Steuerung"/> </panel> <panel name="nearby_media_panel"> diff --git a/indra/newview/skins/default/xui/de/panel_people.xml b/indra/newview/skins/default/xui/de/panel_people.xml index 99e0b933b8..004792bbf5 100644 --- a/indra/newview/skins/default/xui/de/panel_people.xml +++ b/indra/newview/skins/default/xui/de/panel_people.xml @@ -18,6 +18,8 @@ Sie suchen nach Leuten? Verwenden Sie die [secondlife:///app/worldmap Karte]. <string name="groups_filter_label" value="Nach Gruppen filtern"/> <string name="no_filtered_groups_msg" value="Sie haben nicht das Richtige gefunden? Versuchen Sie es mit der [secondlife:///app/search/groups/[SEARCH_TERM] Suche]."/> <string name="no_groups_msg" value="Suchen Sie nach Gruppen? Versuchen Sie es mit der [secondlife:///app/search/groups Suche]."/> + <string name="MiniMapToolTipMsg" value="[REGION](Doppelklicken, um Karte zu öffnen; Umschalttaste gedrückt halten und ziehen, um zu schwenken)"/> + <string name="AltMiniMapToolTipMsg" value="[REGION](Doppelklicken, um zu teleportieren; Umschalttaste gedrückt halten und ziehen, um zu schwenken)"/> <filter_editor label="Filter" name="filter_input"/> <tab_container name="tabs"> <panel label="IN DER NÄHE" name="nearby_panel"> diff --git a/indra/newview/skins/default/xui/de/panel_profile.xml b/indra/newview/skins/default/xui/de/panel_profile.xml index 938631f65d..b4c6e67108 100644 --- a/indra/newview/skins/default/xui/de/panel_profile.xml +++ b/indra/newview/skins/default/xui/de/panel_profile.xml @@ -16,6 +16,12 @@ <string name="RegisterDateFormat"> [REG_DATE] ([AGE]) </string> + <string name="name_text_args"> + [NAME] + </string> + <string name="display_name_text_args"> + [DISPLAY_NAME] + </string> <layout_stack name="layout"> <layout_panel name="profile_stack"> <scroll_container name="profile_scroll"> @@ -34,7 +40,7 @@ </text_editor> <text name="title_partner_text" value="Partner:"/> <panel name="partner_data_panel"> - <name_box initial_value="(wird in Datenbank gesucht)" name="partner_text"/> + <text initial_value="(wird in Datenbank gesucht)" name="partner_text"/> </panel> <text name="title_groups_text" value="Gruppen:"/> </panel> diff --git a/indra/newview/skins/default/xui/de/panel_script_ed.xml b/indra/newview/skins/default/xui/de/panel_script_ed.xml index 73789f06d8..adfe2a342b 100644 --- a/indra/newview/skins/default/xui/de/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/de/panel_script_ed.xml @@ -15,6 +15,9 @@ <panel.string name="Title"> Skript: [NAME] </panel.string> + <panel.string name="external_editor_not_set"> + Wählen Sie über die Umgebungsvariable „LL_SCRIPT_EDITOR“ oder die Einstellung „ExternalEditor“ einen Editor aus. + </panel.string> <menu_bar name="script_menu"> <menu label="Datei" name="File"> <menu_item_call label="Speichern" name="Save"/> diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml index 7284e40be2..0c621db6b0 100644 --- a/indra/newview/skins/default/xui/de/strings.xml +++ b/indra/newview/skins/default/xui/de/strings.xml @@ -1067,7 +1067,7 @@ <string name="PermNo"> Nein </string> - <string name="Chat" value=" Chat:"/> + <string name="Chat Message" value="Chat:"/> <string name="Sound" value=" Sound:"/> <string name="Wait" value=" --- Warten:"/> <string name="AnimFlagStop" value=" Animation stoppen:"/> @@ -1864,12 +1864,6 @@ Gültige Formate: .wav, .tga, .bmp, .jpg, .jpeg oder .bvh <string name="accel-win-shift"> Umschalt+ </string> - <string name="Esc"> - Esc - </string> - <string name="Home"> - Zuhause - </string> <string name="FileSaved"> Datei wurde gespeichert </string> @@ -1898,7 +1892,7 @@ Gültige Formate: .wav, .tga, .bmp, .jpg, .jpeg oder .bvh Rechts </string> <string name="Direction_Back"> - Hinten + Zurück </string> <string name="Direction_North"> Norden @@ -1987,6 +1981,9 @@ Gültige Formate: .wav, .tga, .bmp, .jpg, .jpeg oder .bvh <string name="Other"> Sonstige </string> + <string name="Rental"> + Vermietung + </string> <string name="Any"> Alle </string> @@ -3966,7 +3963,7 @@ Missbrauchsbericht <string name="Notices"> Mitteilungen </string> - <string name="Chat"> + <string name="Chat" value=" Chat:"> Chat </string> <string name="DeleteItems"> @@ -3978,4 +3975,348 @@ Missbrauchsbericht <string name="EmptyOutfitText"> Keine Objekte in diesem Outfit </string> + <string name="ExternalEditorNotSet"> + Wählen Sie über die Einstellung „ExternalEditor“ einen Editor aus + </string> + <string name="ExternalEditorNotFound"> + Angegebener externer Editor nicht gefunden. +Setzen Sie den Editorpfad in Anführungszeichen +(z. B. "/pfad/editor" "%s"). + </string> + <string name="ExternalEditorCommandParseError"> + Fehler beim Parsen des externen Editorbefehls. + </string> + <string name="ExternalEditorFailedToRun"> + Externer Editor konnte nicht ausgeführt werden. + </string> + <string name="Esc"> + Esc + </string> + <string name="Space"> + Space + </string> + <string name="Enter"> + Enter + </string> + <string name="Tab"> + Tab + </string> + <string name="Ins"> + Ins + </string> + <string name="Del"> + Del + </string> + <string name="Backsp"> + Backsp + </string> + <string name="Shift"> + Shift + </string> + <string name="Ctrl"> + Ctrl + </string> + <string name="Alt"> + Alt + </string> + <string name="CapsLock"> + CapsLock + </string> + <string name="Home"> + Zuhause + </string> + <string name="End"> + End + </string> + <string name="PgUp"> + PgUp + </string> + <string name="PgDn"> + PgDn + </string> + <string name="F1"> + F1 + </string> + <string name="F2"> + F2 + </string> + <string name="F3"> + F3 + </string> + <string name="F4"> + F4 + </string> + <string name="F5"> + F5 + </string> + <string name="F6"> + F6 + </string> + <string name="F7"> + F7 + </string> + <string name="F8"> + F8 + </string> + <string name="F9"> + F9 + </string> + <string name="F10"> + F10 + </string> + <string name="F11"> + F11 + </string> + <string name="F12"> + F12 + </string> + <string name="Add"> + Addieren + </string> + <string name="Subtract"> + Subtrahieren + </string> + <string name="Multiply"> + Multiplizieren + </string> + <string name="Divide"> + Dividieren + </string> + <string name="PAD_DIVIDE"> + PAD_DIVIDE + </string> + <string name="PAD_LEFT"> + PAD_LEFT + </string> + <string name="PAD_RIGHT"> + PAD_RIGHT + </string> + <string name="PAD_DOWN"> + PAD_DOWN + </string> + <string name="PAD_UP"> + PAD_UP + </string> + <string name="PAD_HOME"> + PAD_HOME + </string> + <string name="PAD_END"> + PAD_END + </string> + <string name="PAD_PGUP"> + PAD_PGUP + </string> + <string name="PAD_PGDN"> + PAD_PGDN + </string> + <string name="PAD_CENTER"> + PAD_CENTER + </string> + <string name="PAD_INS"> + PAD_INS + </string> + <string name="PAD_DEL"> + PAD_DEL + </string> + <string name="PAD_Enter"> + PAD_Enter + </string> + <string name="PAD_BUTTON0"> + PAD_BUTTON0 + </string> + <string name="PAD_BUTTON1"> + PAD_BUTTON1 + </string> + <string name="PAD_BUTTON2"> + PAD_BUTTON2 + </string> + <string name="PAD_BUTTON3"> + PAD_BUTTON3 + </string> + <string name="PAD_BUTTON4"> + PAD_BUTTON4 + </string> + <string name="PAD_BUTTON5"> + PAD_BUTTON5 + </string> + <string name="PAD_BUTTON6"> + PAD_BUTTON6 + </string> + <string name="PAD_BUTTON7"> + PAD_BUTTON7 + </string> + <string name="PAD_BUTTON8"> + PAD_BUTTON8 + </string> + <string name="PAD_BUTTON9"> + PAD_BUTTON9 + </string> + <string name="PAD_BUTTON10"> + PAD_BUTTON10 + </string> + <string name="PAD_BUTTON11"> + PAD_BUTTON11 + </string> + <string name="PAD_BUTTON12"> + PAD_BUTTON12 + </string> + <string name="PAD_BUTTON13"> + PAD_BUTTON13 + </string> + <string name="PAD_BUTTON14"> + PAD_BUTTON14 + </string> + <string name="PAD_BUTTON15"> + PAD_BUTTON15 + </string> + <string name="-"> + - + </string> + <string name="="> + = + </string> + <string name="`"> + ` + </string> + <string name=";"> + ; + </string> + <string name="["> + [ + </string> + <string name="]"> + ] + </string> + <string name="\"> + \ + </string> + <string name="0"> + 0 + </string> + <string name="1"> + 1 + </string> + <string name="2"> + 2 + </string> + <string name="3"> + 3 + </string> + <string name="4"> + 4 + </string> + <string name="5"> + 5 + </string> + <string name="6"> + 6 + </string> + <string name="7"> + 7 + </string> + <string name="8"> + 8 + </string> + <string name="9"> + 9 + </string> + <string name="A"> + A + </string> + <string name="B"> + B + </string> + <string name="C"> + C + </string> + <string name="D"> + D + </string> + <string name="E"> + E + </string> + <string name="F"> + F + </string> + <string name="G"> + G + </string> + <string name="H"> + H + </string> + <string name="I"> + I + </string> + <string name="J"> + J + </string> + <string name="K"> + K + </string> + <string name="L"> + L + </string> + <string name="M"> + M + </string> + <string name="N"> + N + </string> + <string name="O"> + O + </string> + <string name="P"> + P + </string> + <string name="Q"> + Q + </string> + <string name="R"> + R + </string> + <string name="S"> + S + </string> + <string name="T"> + T + </string> + <string name="U"> + U + </string> + <string name="V"> + V + </string> + <string name="W"> + W + </string> + <string name="X"> + X + </string> + <string name="Y"> + Y + </string> + <string name="Z"> + Z + </string> + <string name="BeaconParticle"> + Partikel-Beacons werden angezeigt (blau) + </string> + <string name="BeaconPhysical"> + Beacons für physische Objekte werden angezeigt (grün) + </string> + <string name="BeaconScripted"> + Beacons für Skriptobjekte werden angezeigt (rot) + </string> + <string name="BeaconScriptedTouch"> + Beacons für Skriptobjekte mit Berührungsfunktion werden angezeigt (rot) + </string> + <string name="BeaconSound"> + Sound-Beacons werden angezeigt (gelb) + </string> + <string name="BeaconMedia"> + Medien-Beacons werden angezeigt (weiß) + </string> + <string name="ParticleHiding"> + Partikel werden ausgeblendet + </string> </strings> diff --git a/indra/newview/skins/default/xui/en/floater_beacons.xml b/indra/newview/skins/default/xui/en/floater_beacons.xml index 4fc2b698d8..3d29356b22 100644 --- a/indra/newview/skins/default/xui/en/floater_beacons.xml +++ b/indra/newview/skins/default/xui/en/floater_beacons.xml @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <floater legacy_header_height="18" - height="225" + height="245" layout="topleft" name="beacons" help_topic="beacons" @@ -12,7 +12,7 @@ width="240"> <panel follows="left|top|right|bottom" - height="200" + height="240" layout="topleft" left="10" name="beacons_panel" @@ -133,6 +133,16 @@ <check_box.commit_callback function="Beacons.UICheck" /> </check_box> + <check_box + control_name="moapbeacon" + height="16" + left="0" + label="Media sources" + layout="topleft" + name="moapbeacon" > + <check_box.commit_callback + function="Beacons.UICheck" /> + </check_box> </panel> </floater> diff --git a/indra/newview/skins/default/xui/en/floater_ui_preview.xml b/indra/newview/skins/default/xui/en/floater_ui_preview.xml index 12c4561753..3921cfcd2c 100644 --- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml +++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml @@ -12,6 +12,10 @@ title="XUI PREVIEW TOOL" translate="false" width="750"> + <string name="ExternalEditorNotSet"> +Select an editor by setting the environment variable LL_XUI_EDITOR +or the ExternalEditor setting +or specifying its path in the "Editor Path" field.</string> <panel bottom="640" follows="left|top|right|bottom" diff --git a/indra/newview/skins/default/xui/en/menu_attachment_self.xml b/indra/newview/skins/default/xui/en/menu_attachment_self.xml index 84e81397be..b8128da358 100644 --- a/indra/newview/skins/default/xui/en/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/en/menu_attachment_self.xml @@ -68,7 +68,7 @@ name="Stand Up"> function="Self.EnableStandUp" /> </menu_item_call> <menu_item_call - label="Change Outfit" + label="My Appearance" name="Change Outfit"> <menu_item_call.on_click function="CustomizeAvatar" /> diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml index 2afa29ec10..d727294cc8 100644 --- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml @@ -193,7 +193,7 @@ </menu_item_call> </context_menu> <menu_item_call - label="Change Outfit" + label="My Appearance" layout="topleft" name="Chenge Outfit"> <menu_item_call.on_click diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml index 1b55fa4fd3..07dabe1909 100644 --- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml @@ -9,7 +9,7 @@ visible="false" width="128"> <menu_item_check - label="Voice Enabled" + label="Speak Button" layout="topleft" name="EnableVoiceChat"> <menu_item_check.on_click @@ -19,7 +19,6 @@ function="CheckControl" parameter="EnableVoiceChat" /> </menu_item_check> - <menu_item_separator/> <menu_item_check label="Gesture button" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 606ff69599..934cae93db 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -41,7 +41,7 @@ parameter="agent" /> </menu_item_call> <menu_item_call - label="Change Outfit" + label="My Appearance" name="ChangeOutfit"> <menu_item_call.on_click function="CustomizeAvatar" /> @@ -261,6 +261,17 @@ function="Floater.Toggle" parameter="world_map" /> </menu_item_check> + <menu_item_check + label="Search" + name="Search" + shortcut="control|F"> + <menu_item_check.on_check + function="Floater.Visible" + parameter="search" /> + <menu_item_check.on_click + function="Floater.Toggle" + parameter="search" /> + </menu_item_check> <menu_item_call label="Snapshot" name="Take Snapshot" diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 6ecaef1bf3..433f623273 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -821,22 +821,6 @@ You need to enter either the Username or both the First and Last name of your av <notification icon="alertmodal.tga" - name="AddClassified" - type="alertmodal"> -Classified ads appear in the 'Classified' section of the Search directory and on [http://secondlife.com/community/classifieds secondlife.com] for one week. -Fill out your ad, then click 'Publish...' to add it to the directory. -You'll be asked for a price to pay when clicking Publish. -Paying more makes your ad appear higher in the list, and also appear higher when people search for keywords. - <tag>confirm</tag> - <usetemplate - ignoretext="How to create a new Classified ad" - name="okcancelignore" - notext="Cancel" - yestext="OK"/> - </notification> - - <notification - icon="alertmodal.tga" name="DeleteClassified" type="alertmodal"> Delete classified '[NAME]'? @@ -7002,6 +6986,18 @@ Mute everyone? </notification> <notification + name="HintSpeak" + label="Speak" + type="hint" + unique="true"> +Click the Speak button to turn your microphone on and off. + +Click on the up arrow to see the voice control panel. + +Hiding the Speak button will disable the voice feature. + </notification> + + <notification name="HintDestinationGuide" label="Explore the World" type="hint" diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml index 43431ea7c1..1a00416b2a 100644 --- a/indra/newview/skins/default/xui/en/panel_people.xml +++ b/indra/newview/skins/default/xui/en/panel_people.xml @@ -76,7 +76,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M follows="all" height="383" layout="topleft" - left="5" + left="3" name="tabs" tab_group="1" tab_min_width="70" @@ -84,7 +84,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M tab_position="top" top_pad="10" halign="center" - width="317"> + width="319"> <panel background_opaque="true" background_visible="true" @@ -106,20 +106,20 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M left="3" mouse_opaque="false" name="Net Map" - width="307" + width="305" height="140" - top="0"/> + top="5"/> <avatar_list allow_select="true" follows="top|left|bottom|right" - height="216" + height="211" ignore_online_status="true" layout="topleft" left="3" multi_select="true" name="avatar_list" top="145" - width="307" /> + width="306" /> <panel background_visible="true" follows="left|right|bottom" @@ -165,7 +165,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M layout="topleft" left_pad="1" name="dummy_icon" - width="241" + width="243" /> </panel> </panel> @@ -251,7 +251,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M top_pad="1" left="0" name="bottom_panel" - width="305"> + width="308"> <layout_panel auto_resize="false" height="25" @@ -300,7 +300,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M layout="topleft" name="dummy_panel" user_resize="false" - width="212"> + width="210"> <icon follows="bottom|left|right" height="25" @@ -309,7 +309,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M left="0" top="0" name="dummy_icon" - width="211" /> + width="210" /> </layout_panel> <layout_panel auto_resize="false" @@ -471,7 +471,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M layout="topleft" left_pad="1" name="dummy_icon" - width="209" + width="212" /> </panel> </panel> @@ -506,7 +506,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M height="27" label="bottom_panel" layout="topleft" - left="0" + left="3" name="bottom_panel" top_pad="0" width="313"> @@ -544,7 +544,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M layout="topleft" left_pad="1" name="dummy_icon" - width="241" + width="244" /> </panel> </panel> diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml index 627b12cfe1..8d42024386 100644 --- a/indra/newview/skins/default/xui/en/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml @@ -28,6 +28,10 @@ name="Title"> Script: [NAME] </panel.string> + <panel.string + name="external_editor_not_set"> + Select an editor by setting the environment variable LL_SCRIPT_EDITOR or the ExternalEditor setting. + </panel.string> <menu_bar bg_visible="false" follows="left|top" diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index d0625d9755..14ea43a8f8 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -3310,6 +3310,14 @@ Abuse Report</string> <string name="DeleteItem">Delete selected item?</string> <string name="EmptyOutfitText">There are no items in this outfit</string> + + <!-- External editor status codes --> + <string name="ExternalEditorNotSet">Select an editor using the ExternalEditor setting.</string> + <string name="ExternalEditorNotFound">Cannot find the external editor you specified. +Try enclosing path to the editor with double quotes. +(e.g. "/path to my/editor" "%s")</string> + <string name="ExternalEditorCommandParseError">Error parsing the external editor command.</string> + <string name="ExternalEditorFailedToRun">External editor failed to run.</string> <!-- Key names begin --> <string name="Esc">Esc</string> diff --git a/indra/newview/skins/default/xui/es/floater_about_land.xml b/indra/newview/skins/default/xui/es/floater_about_land.xml index 3f50437c13..3df0f92842 100644 --- a/indra/newview/skins/default/xui/es/floater_about_land.xml +++ b/indra/newview/skins/default/xui/es/floater_about_land.xml @@ -215,7 +215,7 @@ Vaya al menú Mundo > Acerca del terreno o seleccione otra parcela para ver s <text name="Simulator primitive usage:"> Uso de primitivas: </text> - <text name="objects_available"> + <text name="objects_available"> [COUNT] de un máx. de [MAX] ([AVAILABLE] disponibles) </text> <text name="Primitives parcel supports:"> @@ -347,6 +347,7 @@ Sólo las parcelas más grandes pueden listarse en la búsqueda. <combo_box.item label="Parques y Naturaleza" name="item9"/> <combo_box.item label="Residencial" name="item10"/> <combo_box.item label="Compras" name="item11"/> + <combo_box.item label="Terreno en alquiler" name="item13"/> <combo_box.item label="Otra" name="item12"/> </combo_box> <combo_box name="land category"> @@ -361,6 +362,7 @@ Sólo las parcelas más grandes pueden listarse en la búsqueda. <combo_box.item label="Parques y Naturaleza" name="item9"/> <combo_box.item label="Residencial" name="item10"/> <combo_box.item label="Compras" name="item11"/> + <combo_box.item label="Terreno en alquiler" name="item13"/> <combo_box.item label="Otra" name="item12"/> </combo_box> <check_box label="Contenido 'Mature'" name="MatureCheck" tool_tip=""/> @@ -439,7 +441,7 @@ los media: (Definido por el Estado) </panel.string> <panel.string name="allow_public_access"> - Permitir el acceso público ([MATURITY]) + Permitir el acceso público ([MATURITY]) (Nota: Si no seleccionas esta opción, se crearán líneas de prohibición) </panel.string> <panel.string name="estate_override"> Una o más de esta opciones está configurada a nivel del estado diff --git a/indra/newview/skins/default/xui/es/floater_map.xml b/indra/newview/skins/default/xui/es/floater_map.xml index fa01a4a635..370b7f5053 100644 --- a/indra/newview/skins/default/xui/es/floater_map.xml +++ b/indra/newview/skins/default/xui/es/floater_map.xml @@ -3,6 +3,9 @@ <floater.string name="ToolTipMsg"> [REGIÓN](Haz doble clic para abrir el mapa y pulsa la tecla Mayús y arrastra para obtener una vista panorámica) </floater.string> + <floater.string name="AltToolTipMsg"> + [REGION](Pulsa dos veces para teleportarte, pulsa mayús y arrastra para obtener una panorámica) + </floater.string> <floater.string name="mini_map_caption"> MINIMAPA </floater.string> diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml index e2ff4a25ce..fba969f267 100644 --- a/indra/newview/skins/default/xui/es/floater_tools.xml +++ b/indra/newview/skins/default/xui/es/floater_tools.xml @@ -64,6 +64,8 @@ <radio_item label="Elegir la cara" name="radio select face"/> </radio_group> <check_box label="Editar las partes enlazadas" name="checkbox edit linked parts"/> + <button label="Enlazar" name="link_btn"/> + <button label="Desenlazar" name="unlink_btn"/> <text name="RenderingCost" tool_tip="Muestra cuánto se calcula que cuesta renderizar este objeto"> þ: [COUNT] </text> diff --git a/indra/newview/skins/default/xui/es/menu_attachment_self.xml b/indra/newview/skins/default/xui/es/menu_attachment_self.xml index ab76c92d65..0ba39378bb 100644 --- a/indra/newview/skins/default/xui/es/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/es/menu_attachment_self.xml @@ -5,7 +5,7 @@ <menu_item_call label="Quitar" name="Detach"/> <menu_item_call label="Sentarte" name="Sit Down Here"/> <menu_item_call label="Levantarme" name="Stand Up"/> - <menu_item_call label="Cambiar vestuario" name="Change Outfit"/> + <menu_item_call label="Mi apariencia" name="Change Outfit"/> <menu_item_call label="Editar mi vestuario" name="Edit Outfit"/> <menu_item_call label="Editar mi anatomía" name="Edit My Shape"/> <menu_item_call label="Mis amigos" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/es/menu_avatar_self.xml b/indra/newview/skins/default/xui/es/menu_avatar_self.xml index 50f8384b0f..a2d86d78c1 100644 --- a/indra/newview/skins/default/xui/es/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/es/menu_avatar_self.xml @@ -21,7 +21,7 @@ <context_menu label="Quitar" name="Object Detach"/> <menu_item_call label="Quitarse todo" name="Detach All"/> </context_menu> - <menu_item_call label="Cambiar vestuario" name="Chenge Outfit"/> + <menu_item_call label="Mi apariencia" name="Chenge Outfit"/> <menu_item_call label="Editar mi vestuario" name="Edit Outfit"/> <menu_item_call label="Editar mi anatomía" name="Edit My Shape"/> <menu_item_call label="Mis amigos" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/es/menu_bottomtray.xml b/indra/newview/skins/default/xui/es/menu_bottomtray.xml index 62683f3076..a16da5ae9e 100644 --- a/indra/newview/skins/default/xui/es/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/es/menu_bottomtray.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <menu name="hide_camera_move_controls_menu"> + <menu_item_check label="Voz activada" name="EnableVoiceChat"/> <menu_item_check label="Botón Gestos" name="ShowGestureButton"/> <menu_item_check label="Botón Moverse" name="ShowMoveButton"/> <menu_item_check label="Botón Vista" name="ShowCameraButton"/> <menu_item_check label="Botón Foto" name="ShowSnapshotButton"/> - <menu_item_check label="Botón Barra lateral" name="ShowSidebarButton"/> <menu_item_check label="Botón Construir" name="ShowBuildButton"/> <menu_item_check label="Botón Buscar" name="ShowSearchButton"/> <menu_item_check label="Botón Mapa" name="ShowWorldMapButton"/> diff --git a/indra/newview/skins/default/xui/es/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/es/menu_inspect_avatar_gear.xml index 236289f82a..bee4c61da2 100644 --- a/indra/newview/skins/default/xui/es/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/es/menu_inspect_avatar_gear.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> +<toggleable_menu name="Gear Menu"> <menu_item_call label="Ver el perfil" name="view_profile"/> <menu_item_call label="Añadir como amigo" name="add_friend"/> <menu_item_call label="MI" name="im"/> @@ -11,9 +11,11 @@ <menu_item_call label="Denunciar" name="report"/> <menu_item_call label="Congelar" name="freeze"/> <menu_item_call label="Expulsar" name="eject"/> + <menu_item_call label="Expulsar" name="kick"/> + <menu_item_call label="CSR" name="csr"/> <menu_item_call label="Depurar las texturas" name="debug"/> <menu_item_call label="Encontrar en el mapa" name="find_on_map"/> <menu_item_call label="Acercar el zoom" name="zoom_in"/> <menu_item_call label="Pagar" name="pay"/> <menu_item_call label="Compartir" name="share"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/es/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/es/menu_inspect_self_gear.xml index c8a1e9d9da..29ad718fdd 100644 --- a/indra/newview/skins/default/xui/es/menu_inspect_self_gear.xml +++ b/indra/newview/skins/default/xui/es/menu_inspect_self_gear.xml @@ -1,10 +1,31 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="Sentarte" name="sit_down_here"/> - <menu_item_call label="Levantarme" name="stand_up"/> - <menu_item_call label="Cambiar vestuario" name="change_outfit"/> - <menu_item_call label="Mi perfil" name="my_profile"/> - <menu_item_call label="Mis amigos" name="my_friends"/> - <menu_item_call label="Mis grupos" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Gear Menu"> + <menu_item_call label="Sentarme" name="Sit Down Here"/> + <menu_item_call label="Levantarme" name="Stand Up"/> + <context_menu label="Quitarme" name="Take Off >"> + <context_menu label="Ropas" name="Clothes >"> + <menu_item_call label="Camisa" name="Shirt"/> + <menu_item_call label="Pantalones" name="Pants"/> + <menu_item_call label="Falda" name="Skirt"/> + <menu_item_call label="Zapatos" name="Shoes"/> + <menu_item_call label="Calcetines" name="Socks"/> + <menu_item_call label="Chaqueta" name="Jacket"/> + <menu_item_call label="Guantes" name="Gloves"/> + <menu_item_call label="Camiseta" name="Self Undershirt"/> + <menu_item_call label="Ropa interior" name="Self Underpants"/> + <menu_item_call label="Tatuaje" name="Self Tattoo"/> + <menu_item_call label="Alfa" name="Self Alpha"/> + <menu_item_call label="Toda la ropa" name="All Clothes"/> + </context_menu> + <context_menu label="HUD" name="Object Detach HUD"/> + <context_menu label="Quitar" name="Object Detach"/> + <menu_item_call label="Quitarse todo" name="Detach All"/> + </context_menu> + <menu_item_call label="Cambiar vestuario" name="Chenge Outfit"/> + <menu_item_call label="Editar mi vestuario" name="Edit Outfit"/> + <menu_item_call label="Editar mi anatomía" name="Edit My Shape"/> + <menu_item_call label="Mis amigos" name="Friends..."/> + <menu_item_call label="Mis grupos" name="Groups..."/> + <menu_item_call label="Mi perfil" name="Profile..."/> <menu_item_call label="Depurar las texturas" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/es/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/es/menu_inventory_gear_default.xml index 8e498fefba..0e9644629e 100644 --- a/indra/newview/skins/default/xui/es/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/es/menu_inventory_gear_default.xml @@ -3,6 +3,7 @@ <menu_item_call label="Nueva ventana del inventario" name="new_window"/> <menu_item_check label="Ordenar alfabéticamente" name="sort_by_name"/> <menu_item_check label="Ordenar por los más recientes" name="sort_by_recent"/> + <menu_item_check label="Ordenar las carpetas siempre alfabéticamente" name="sort_folders_by_name"/> <menu_item_check label="Las carpetas del sistema, arriba" name="sort_system_folders_to_top"/> <menu_item_call label="Ver los filtros" name="show_filters"/> <menu_item_call label="Restablecer los filtros" name="reset_filters"/> diff --git a/indra/newview/skins/default/xui/es/menu_object.xml b/indra/newview/skins/default/xui/es/menu_object.xml index 06121e0c09..d8c75eaf47 100644 --- a/indra/newview/skins/default/xui/es/menu_object.xml +++ b/indra/newview/skins/default/xui/es/menu_object.xml @@ -16,14 +16,14 @@ <context_menu label="Anexar" name="Object Attach"/> <context_menu label="Anexar el HUD" name="Object Attach HUD"/> </context_menu> - <context_menu label="Quitar" name="Remove"> + <context_menu label="Gestionar" name="Remove"> <menu_item_call label="Denunciar una infracción" name="Report Abuse..."/> <menu_item_call label="Ignorar" name="Object Mute"/> <menu_item_call label="Devolver" name="Return..."/> - <menu_item_call label="Eliminar" name="Delete"/> </context_menu> <menu_item_call label="Tomar" name="Pie Object Take"/> <menu_item_call label="Coger una copia" name="Take Copy"/> <menu_item_call label="Pagar" name="Pay..."/> <menu_item_call label="Comprar" name="Buy..."/> + <menu_item_call label="Borrar" name="Delete"/> </context_menu> diff --git a/indra/newview/skins/default/xui/es/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/es/menu_places_gear_folder.xml index bf46eb58e3..4051ff4075 100644 --- a/indra/newview/skins/default/xui/es/menu_places_gear_folder.xml +++ b/indra/newview/skins/default/xui/es/menu_places_gear_folder.xml @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_folder_gear"> +<toggleable_menu name="menu_folder_gear"> <menu_item_call label="Añadir este hito" name="add_landmark"/> <menu_item_call label="Añadir una carpeta" name="add_folder"/> + <menu_item_call label="Restaurar ítem" name="restore_item"/> <menu_item_call label="Cortar" name="cut"/> <menu_item_call label="Copiar" name="copy_folder"/> <menu_item_call label="Pegar" name="paste"/> @@ -12,4 +13,4 @@ <menu_item_call label="Abrir todas las carpetas" name="expand_all"/> <menu_item_call label="Cerrar todas las carpetas" name="collapse_all"/> <menu_item_check label="Ordenar por fecha" name="sort_by_date"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/es/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/es/menu_places_gear_landmark.xml index eac85de846..c92bd19787 100644 --- a/indra/newview/skins/default/xui/es/menu_places_gear_landmark.xml +++ b/indra/newview/skins/default/xui/es/menu_places_gear_landmark.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_ladmark_gear"> +<toggleable_menu name="menu_ladmark_gear"> <menu_item_call label="Teleportar" name="teleport"/> <menu_item_call label="Más información" name="more_info"/> <menu_item_call label="Mostrar en el mapa" name="show_on_map"/> <menu_item_call label="Añadir un hito" name="add_landmark"/> <menu_item_call label="Añadir una carpeta" name="add_folder"/> + <menu_item_call label="Restaurar ítem" name="restore_item"/> <menu_item_call label="Cortar" name="cut"/> <menu_item_call label="Copiar el hito" name="copy_landmark"/> <menu_item_call label="Copiar la SLurl" name="copy_slurl"/> @@ -15,4 +16,4 @@ <menu_item_call label="Cerrar todas las carpetas" name="collapse_all"/> <menu_item_check label="Ordenar por fecha" name="sort_by_date"/> <menu_item_call label="Crear un Destacado" name="create_pick"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml index 2fe7db1041..c48203f95c 100644 --- a/indra/newview/skins/default/xui/es/menu_viewer.xml +++ b/indra/newview/skins/default/xui/es/menu_viewer.xml @@ -7,7 +7,7 @@ </menu_item_call> <menu_item_call label="Comprar L$" name="Buy and Sell L$"/> <menu_item_call label="Mi perfil" name="Profile"/> - <menu_item_call label="Cambiar vestuario" name="ChangeOutfit"/> + <menu_item_call label="Mi apariencia" name="ChangeOutfit"/> <menu_item_check label="Mi Inventario" name="Inventory"/> <menu_item_check label="Mi Inventario" name="ShowSidetrayInventory"/> <menu_item_check label="Mis gestos" name="Gestures"/> @@ -35,6 +35,7 @@ <menu label="Mundo" name="World"> <menu_item_check label="Minimapa" name="Mini-Map"/> <menu_item_check label="Mapa del mundo" name="World Map"/> + <menu_item_check label="Buscar" name="Search"/> <menu_item_call label="Foto" name="Take Snapshot"/> <menu_item_call label="Crear un hito de este sitio" name="Create Landmark Here"/> <menu label="Perfil del lugar" name="Land"> @@ -224,7 +225,9 @@ <menu label="Show Info" name="Display Info"> <menu_item_check label="Show Time" name="Show Time"/> <menu_item_check label="Show Render Info" name="Show Render Info"/> + <menu_item_check label="Mostrar información de textura" name="Show Texture Info"/> <menu_item_check label="Show Color Under Cursor" name="Show Color Under Cursor"/> + <menu_item_check label="Mostrar la memoria" name="Show Memory"/> <menu_item_check label="Show Updates to Objects" name="Show Updates"/> </menu> <menu label="Force an Error" name="Force Errors"> @@ -242,6 +245,9 @@ <menu_item_check label="Randomize Framerate" name="Randomize Framerate"/> <menu_item_check label="Frame Test" name="Frame Test"/> </menu> + <menu label="Render Metadata" name="Render Metadata"> + <menu_item_check label="Actualizar el tipo" name="Update Type"/> + </menu> <menu label="Rendering" name="Rendering"> <menu_item_check label="Axes" name="Axes"/> <menu_item_check label="Wireframe" name="Wireframe"/> diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml index 2bf36bb763..1379f710c3 100644 --- a/indra/newview/skins/default/xui/es/notifications.xml +++ b/indra/newview/skins/default/xui/es/notifications.xml @@ -73,7 +73,7 @@ Detalles del error: la notificación de nombre '[_NAME]' no se ha enco </notification> <notification name="LoginFailedNoNetwork"> No se puede conectar con [SECOND_LIFE_GRID]. -'[DIAGNOSTIC]' + '[DIAGNOSTIC]' Asegúrate de que tu conexión a Internet está funcionando adecuadamente. <usetemplate name="okbutton" yestext="OK"/> </notification> @@ -330,13 +330,6 @@ Necesitas una cuenta para acceder a [SECOND_LIFE]. ¿Te gustaría crear una ahor <notification name="InvalidCredentialFormat"> Escribe el nombre de usuario o el nombre y el apellido de tu avatar en el campo Nombre de usuario e inicia sesión otra vez. </notification> - <notification name="AddClassified"> - Los anuncios clasificados aparecen durante una semana en la sección 'Clasificados' de la búsqueda y en [http://secondlife.com/community/classifieds secondlife.com]. -Rellena tu anuncio y pulsa 'Publicar...' para añadirlo al directorio. -Cuando pulses Publicar, se te preguntará por un precio a pagar. -El pagar más hará que tu anuncio aparezca más arriba en la lista, y que también aparezca más arriba en la lista cuando la gente busque por palabras clave. - <usetemplate ignoretext="Cómo crear un anuncio clasificado nuevo." name="okcancelignore" notext="Cancelar" yestext="OK"/> - </notification> <notification name="DeleteClassified"> ¿Borrar el clasificado '[NAME]'? No se reembolsan las cuotas pagadas. @@ -2851,9 +2844,6 @@ Si lo haces, todos los residentes que se unan posteriormente a la llamada tambi <notification label="Explora el mundo" name="HintDestinationGuide"> La Guía de destinos contiene miles de nuevos lugares por descubrir. Selecciona una ubicación y elige Teleportarme para iniciar la exploración. </notification> - <notification label="Cambiar de apariencia" name="HintAvatarPicker"> - ¿Te gustaría cambiar de apariencia? Haz clic en el botón que aparece a continuación para ver más avatares. - </notification> <notification label="Panel lateral" name="HintSidePanel"> Accede de manera rápida a tu inventario, así como a tu ropa, los perfiles y el resto de la información disponible en el panel lateral. </notification> @@ -2891,6 +2881,38 @@ Si lo haces, todos los residentes que se unan posteriormente a la llamada tambi <button name="cancel" text="Cancelar"/> </form> </notification> + <notification label="" name="ModeChange"> + Para cambiar de modo tienes que salir y reiniciar. + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoClassifieds"> + La creación y edición de clasificados sólo está disponible en el modo Avanzado. ¿Quieres salir y cambiar de modo? El selector de modo se encuentra en la pantalla de inicio de sesión. + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoGroupInfo"> + La creación y edición de grupos sólo está disponible en el modo Avanzado. ¿Quieres salir y cambiar de modo? El selector de modo se encuentra en la pantalla de inicio de sesión. + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoPicks"> + La creación y edición de Destacados sólo está disponible en el modo Avanzado. ¿Quieres salir y cambiar de modo? El selector de modo se encuentra en la pantalla de inicio de sesión. + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoWorldMap"> + La visualización del mapa del mundo sólo está disponible en el modo Avanzado. ¿Quieres salir y cambiar de modo? El selector de modo se encuentra en la pantalla de inicio de sesión. + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoVoiceCall"> + Las llamadas de voz sólo están disponibles en el modo Avanzado. ¿Quieres cerrar sesión y cambiar de modo? + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoAvatarShare"> + Compartir sólo está disponible en el modo Avanzado. ¿Quieres cerrar sesión y cambiar de modo? + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> + <notification label="" name="NoAvatarPay"> + El pago a otros residentes sólo está disponible en el modo Avanzado. ¿Quieres cerrar sesión y cambiar de modo? + <usetemplate name="okcancelbuttons" notext="No salir" yestext="Salir"/> + </notification> <global name="UnsupportedCPU"> - La velocidad de tu CPU no cumple los requerimientos mínimos. </global> diff --git a/indra/newview/skins/default/xui/es/panel_landmark_info.xml b/indra/newview/skins/default/xui/es/panel_landmark_info.xml index 49a9f84cfe..1a0ac3ba79 100644 --- a/indra/newview/skins/default/xui/es/panel_landmark_info.xml +++ b/indra/newview/skins/default/xui/es/panel_landmark_info.xml @@ -19,7 +19,7 @@ [wkday,datetime,local][day,datetime,local] [mth,datetime,local] [year,datetime,local][hour,datetime,local]:[min,datetime,local]:[second,datetime,local] </string> <button name="back_btn" tool_tip="Atrás"/> - <text name="title" value="Añadir el perfil"/> + <text name="title" value="Perfil del lugar"/> <scroll_container name="place_scroll"> <panel name="scrolling_panel"> <text name="maturity_value" value="desconocido"/> diff --git a/indra/newview/skins/default/xui/es/panel_login.xml b/indra/newview/skins/default/xui/es/panel_login.xml index ada964f33e..eee1844c46 100644 --- a/indra/newview/skins/default/xui/es/panel_login.xml +++ b/indra/newview/skins/default/xui/es/panel_login.xml @@ -17,6 +17,13 @@ </text> <check_box label="Recordar la contraseña" name="remember_check"/> <button label="Iniciar sesión" name="connect_btn"/> + <text name="mode_selection_text"> + Modo: + </text> + <combo_box name="mode_combo" tool_tip="Selecciona el modo. Elige Básico para una exploración rápida y fácil y para chatear. Elige Avanzado para tener acceso a más funciones."> + <combo_box.item label="Básico" name="Basic"/> + <combo_box.item label="Avanzado" name="Advanced"/> + </combo_box> <text name="start_location_text"> Empezar en: </text> diff --git a/indra/newview/skins/default/xui/es/panel_nearby_media.xml b/indra/newview/skins/default/xui/es/panel_nearby_media.xml index f65cae6e20..8d4f9eda18 100644 --- a/indra/newview/skins/default/xui/es/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/es/panel_nearby_media.xml @@ -19,7 +19,7 @@ <button label="Parar todo" name="all_nearby_media_disable_btn" tool_tip="Apagar todos los media cercanos"/> <button label="Iniciar todo" name="all_nearby_media_enable_btn" tool_tip="Encender todos los media cercanos"/> <button name="open_prefs_btn" tool_tip="Abrir las preferencias de los media"/> - <button label="Más >>" label_selected="Menos <<" name="more_btn" tool_tip="Controles avanzados"/> + <button label="Más >>" label_selected="<< Menos" name="more_btn" tool_tip="Controles avanzados"/> <button label="Más >>" label_selected="Menos <<" name="less_btn" tool_tip="Controles avanzados"/> </panel> <panel name="nearby_media_panel"> diff --git a/indra/newview/skins/default/xui/es/panel_people.xml b/indra/newview/skins/default/xui/es/panel_people.xml index d0c80ebae5..01149e412d 100644 --- a/indra/newview/skins/default/xui/es/panel_people.xml +++ b/indra/newview/skins/default/xui/es/panel_people.xml @@ -18,6 +18,8 @@ <string name="groups_filter_label" value="Filtrar a los grupos"/> <string name="no_filtered_groups_msg" value="¿No encuentras lo que buscas? Prueba con [secondlife:///app/search/groups/[SEARCH_TERM] Buscar]."/> <string name="no_groups_msg" value="¿Buscas grupos en que participar? Prueba la [secondlife:///app/search/groups Búsqueda]."/> + <string name="MiniMapToolTipMsg" value="[REGION](Pulsa dos veces para abrir el mapa, pulsa mayús y arrastra para obtener una panorámica)"/> + <string name="AltMiniMapToolTipMsg" value="[REGION](Pulsa dos veces para teleportarte, pulsa mayús y arrastra para obtener una panorámica)"/> <filter_editor label="Filtrar" name="filter_input"/> <tab_container name="tabs"> <panel label="CERCANA" name="nearby_panel"> diff --git a/indra/newview/skins/default/xui/es/panel_place_profile.xml b/indra/newview/skins/default/xui/es/panel_place_profile.xml index 524ba2253b..3c363859a4 100644 --- a/indra/newview/skins/default/xui/es/panel_place_profile.xml +++ b/indra/newview/skins/default/xui/es/panel_place_profile.xml @@ -5,7 +5,7 @@ <string name="anyone" value="Cualquiera"/> <string name="available" value="disponible"/> <string name="allocated" value="asignados"/> - <string name="title_place" value="Añadir el perfil"/> + <string name="title_place" value="Perfil del lugar"/> <string name="title_teleport_history" value="Historial de teleportes"/> <string name="not_available" value="(No disp.)"/> <string name="unknown" value="(desconocido)"/> @@ -42,7 +42,7 @@ [wkday,datetime,local][day,datetime,local] [mth,datetime,local] [year,datetime,local][hour,datetime,local]:[min,datetime,local]:[second,datetime,local] </string> <button name="back_btn" tool_tip="Atrás"/> - <text name="title" value="Añadir el perfil"/> + <text name="title" value="Perfil del lugar"/> <scroll_container name="place_scroll"> <panel name="scrolling_panel"> <text name="owner_label" value="Propietario:"/> diff --git a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml index 67f9a929f6..0b304fe287 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml @@ -27,9 +27,9 @@ </text> <check_box label="Chats de grupo" name="EnableGroupChatPopups" tool_tip="Activa esta casilla para ver una ventana emergente cada vez que recibas un mensaje de un grupo de chat"/> <check_box label="Chats de MI" name="EnableIMChatPopups" tool_tip="Activa esta casilla para ver una ventana emergente cada vez que recibas un mensaje instantáneo"/> - <spinner label="Duración de los interlocutores favoritos en los chats:" name="nearby_toasts_lifetime"/> - <spinner label="Tiempo restante de los interlocutores favoritos en los chats:" name="nearby_toasts_fadingtime"/> - <check_box label="Utiliza la herramienta de traducción automática mientras utilizas el chat (mediante Google)" name="translate_chat_checkbox"/> + <spinner label="Duración de los interlocutores favoritos:" name="nearby_toasts_lifetime"/> + <spinner label="Tiempo de los otros interlocutores:" name="nearby_toasts_fadingtime"/> + <check_box label="Usar la traducción automática (con Google) en el chat" name="translate_chat_checkbox"/> <text name="translate_language_text"> Traducir el chat al: </text> diff --git a/indra/newview/skins/default/xui/es/panel_preferences_general.xml b/indra/newview/skins/default/xui/es/panel_preferences_general.xml index 91cf9524a3..790c7be581 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_general.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_general.xml @@ -55,7 +55,7 @@ </text> <radio_group name="inworld_typing_preference"> <radio_item label="Inicia el chat local" name="radio_start_chat" value="1"/> - <radio_item label="Se verá afectado el movimiento (por ejemplo, mediante las teclas WASD)" name="radio_move" value="0"/> + <radio_item label="Afecta al movimiento (por ejemplo, en las teclas WASD)" name="radio_move" value="0"/> </radio_group> <text name="title_afk_text"> Ausente tras: diff --git a/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml index 5eaa345c98..adc0862cf1 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml @@ -11,7 +11,7 @@ <check_box label="Sólo saben si estoy conectado mis amigos y grupos" name="online_visibility"/> <check_box label="Sólo pueden llamarme o mandarme un MI mis amigos y grupos" name="voice_call_friends_only_check"/> <check_box label="Desconectar el micrófono cuando finalicen las llamadas" name="auto_disengage_mic_check"/> - <check_box label="Mostrar mis Hitos favoritos en Inicio de sesión (mediante el menú desplegable "Empezar en")" name="favorites_on_login_check"/> + <check_box label="Mostrar mis Hitos favoritos al Inicio de sesión (menú desplegable "Empezar en")" name="favorites_on_login_check"/> <text name="Logs:"> Registros de chat: </text> diff --git a/indra/newview/skins/default/xui/es/panel_preferences_setup.xml b/indra/newview/skins/default/xui/es/panel_preferences_setup.xml index 68484645b7..9b453fd807 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_setup.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_setup.xml @@ -32,7 +32,7 @@ <check_box initial_value="true" label="Activar plugins" name="browser_plugins_enabled"/> <check_box initial_value="true" label="Aceptar las 'cookies'" name="cookies_enabled"/> <check_box initial_value="true" label="Activar Javascript" name="browser_javascript_enabled"/> - <check_box initial_value="falso" label="Permitir ventanas emergentes de navegadores de medios" name="media_popup_enabled"/> + <check_box initial_value="falso" label="Permitir las ventanas emergentes en el navegador" name="media_popup_enabled"/> <check_box initial_value="false" label="Activar web proxy" name="web_proxy_enabled"/> <text name="Proxy location"> Localización del proxy: diff --git a/indra/newview/skins/default/xui/es/panel_preferences_sound.xml b/indra/newview/skins/default/xui/es/panel_preferences_sound.xml index 6c4ab0f14f..db3659abcd 100644 --- a/indra/newview/skins/default/xui/es/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/es/panel_preferences_sound.xml @@ -9,7 +9,7 @@ <slider label="Ambiental" name="Wind Volume"/> <slider label="Efectos de sonido" name="SFX Volume"/> <slider label="Música en streaming" name="Music Volume"/> - <check_box label="Activada" name="enable_music"/> + <check_box label="Activados" name="enable_music"/> <slider label="Multimedia" name="Media Volume"/> <check_box label="Activada" name="enable_media"/> <slider label="Chat de voz" name="Voice Volume"/> diff --git a/indra/newview/skins/default/xui/es/panel_profile.xml b/indra/newview/skins/default/xui/es/panel_profile.xml index 339a1f236b..334c0541af 100644 --- a/indra/newview/skins/default/xui/es/panel_profile.xml +++ b/indra/newview/skins/default/xui/es/panel_profile.xml @@ -16,6 +16,12 @@ <string name="RegisterDateFormat"> [REG_DATE] ([AGE]) </string> + <string name="name_text_args"> + [NAME] + </string> + <string name="display_name_text_args"> + [DISPLAY_NAME] + </string> <layout_stack name="layout"> <layout_panel name="profile_stack"> <scroll_container name="profile_scroll"> @@ -30,7 +36,7 @@ <text name="title_acc_status_text" value="Estado de la cuenta:"/> <text name="title_partner_text" value="Compañero/a:"/> <panel name="partner_data_panel"> - <name_box initial_value="(obteniendo)" name="partner_text"/> + <text initial_value="(obteniendo)" name="partner_text"/> </panel> <text name="title_groups_text" value="Grupos:"/> </panel> diff --git a/indra/newview/skins/default/xui/es/panel_script_ed.xml b/indra/newview/skins/default/xui/es/panel_script_ed.xml index 5be25a286d..46952c6974 100644 --- a/indra/newview/skins/default/xui/es/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/es/panel_script_ed.xml @@ -15,6 +15,9 @@ <panel.string name="Title"> Script: [NAME] </panel.string> + <panel.string name="external_editor_not_set"> + Puedes seleccionar un editor configurando la variable de entorno LL_SCRIPT_EDITOR o mediante la configuración de ExternalEditor. + </panel.string> <menu_bar name="script_menu"> <menu label="Archivo" name="File"> <menu_item_call label="Guardar" name="Save"/> diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml index df40a2b6b4..cd1fb767c8 100644 --- a/indra/newview/skins/default/xui/es/strings.xml +++ b/indra/newview/skins/default/xui/es/strings.xml @@ -1040,7 +1040,7 @@ </string> <string name="WornOnAttachmentPoint" value="(lo llevas en: [ATTACHMENT_POINT])"/> <string name="ActiveGesture" value="[GESLABEL] (activo)"/> - <string name="Chat" value="Chat :"/> + <string name="Chat Message" value="Chat:"/> <string name="Sound" value="Sonido :"/> <string name="Wait" value="--- Espera :"/> <string name="AnimFlagStop" value="Parar la animación:"/> @@ -1822,12 +1822,6 @@ Se esperaba .wav, .tga, .bmp, .jpg, .jpeg, o .bvh <string name="accel-win-shift"> Mayús+ </string> - <string name="Esc"> - Esc - </string> - <string name="Home"> - Base - </string> <string name="FileSaved"> Archivo guardado </string> @@ -1945,6 +1939,9 @@ Se esperaba .wav, .tga, .bmp, .jpg, .jpeg, o .bvh <string name="Other"> Otra </string> + <string name="Rental"> + Terreno en alquiler + </string> <string name="Any"> Cualquiera </string> @@ -3864,7 +3861,7 @@ Denuncia de infracción <string name="Notices"> Avisos </string> - <string name="Chat"> + <string name="Chat" value="Chat :"> Chat </string> <string name="DeleteItems"> @@ -3876,4 +3873,348 @@ Denuncia de infracción <string name="EmptyOutfitText"> No hay elementos en este vestuario </string> + <string name="ExternalEditorNotSet"> + Selecciona un editor mediante la configuración de ExternalEditor. + </string> + <string name="ExternalEditorNotFound"> + No se encuentra el editor externo especificado. +Inténtalo incluyendo la ruta de acceso al editor entre comillas +(por ejemplo, "/ruta a mi/editor" "%s"). + </string> + <string name="ExternalEditorCommandParseError"> + Error al analizar el comando de editor externo. + </string> + <string name="ExternalEditorFailedToRun"> + Error al ejecutar el editor externo. + </string> + <string name="Esc"> + Esc + </string> + <string name="Space"> + Space + </string> + <string name="Enter"> + Enter + </string> + <string name="Tab"> + Tab + </string> + <string name="Ins"> + Ins + </string> + <string name="Del"> + Del + </string> + <string name="Backsp"> + Backsp + </string> + <string name="Shift"> + Shift + </string> + <string name="Ctrl"> + Ctrl + </string> + <string name="Alt"> + Alt + </string> + <string name="CapsLock"> + CapsLock + </string> + <string name="Home"> + Base + </string> + <string name="End"> + End + </string> + <string name="PgUp"> + PgUp + </string> + <string name="PgDn"> + PgDn + </string> + <string name="F1"> + F1 + </string> + <string name="F2"> + F2 + </string> + <string name="F3"> + F3 + </string> + <string name="F4"> + F4 + </string> + <string name="F5"> + F5 + </string> + <string name="F6"> + F6 + </string> + <string name="F7"> + F7 + </string> + <string name="F8"> + F8 + </string> + <string name="F9"> + F9 + </string> + <string name="F10"> + F10 + </string> + <string name="F11"> + F11 + </string> + <string name="F12"> + F12 + </string> + <string name="Add"> + Añadir + </string> + <string name="Subtract"> + Restar + </string> + <string name="Multiply"> + Multiplicar + </string> + <string name="Divide"> + Dividir + </string> + <string name="PAD_DIVIDE"> + PAD_DIVIDE + </string> + <string name="PAD_LEFT"> + PAD_LEFT + </string> + <string name="PAD_RIGHT"> + PAD_RIGHT + </string> + <string name="PAD_DOWN"> + PAD_DOWN + </string> + <string name="PAD_UP"> + PAD_UP + </string> + <string name="PAD_HOME"> + PAD_HOME + </string> + <string name="PAD_END"> + PAD_END + </string> + <string name="PAD_PGUP"> + PAD_PGUP + </string> + <string name="PAD_PGDN"> + PAD_PGDN + </string> + <string name="PAD_CENTER"> + PAD_CENTER + </string> + <string name="PAD_INS"> + PAD_INS + </string> + <string name="PAD_DEL"> + PAD_DEL + </string> + <string name="PAD_Enter"> + PAD_Enter + </string> + <string name="PAD_BUTTON0"> + PAD_BUTTON0 + </string> + <string name="PAD_BUTTON1"> + PAD_BUTTON1 + </string> + <string name="PAD_BUTTON2"> + PAD_BUTTON2 + </string> + <string name="PAD_BUTTON3"> + PAD_BUTTON3 + </string> + <string name="PAD_BUTTON4"> + PAD_BUTTON4 + </string> + <string name="PAD_BUTTON5"> + PAD_BUTTON5 + </string> + <string name="PAD_BUTTON6"> + PAD_BUTTON6 + </string> + <string name="PAD_BUTTON7"> + PAD_BUTTON7 + </string> + <string name="PAD_BUTTON8"> + PAD_BUTTON8 + </string> + <string name="PAD_BUTTON9"> + PAD_BUTTON9 + </string> + <string name="PAD_BUTTON10"> + PAD_BUTTON10 + </string> + <string name="PAD_BUTTON11"> + PAD_BUTTON11 + </string> + <string name="PAD_BUTTON12"> + PAD_BUTTON12 + </string> + <string name="PAD_BUTTON13"> + PAD_BUTTON13 + </string> + <string name="PAD_BUTTON14"> + PAD_BUTTON14 + </string> + <string name="PAD_BUTTON15"> + PAD_BUTTON15 + </string> + <string name="-"> + - + </string> + <string name="="> + = + </string> + <string name="`"> + ` + </string> + <string name=";"> + ; + </string> + <string name="["> + [ + </string> + <string name="]"> + ] + </string> + <string name="\"> + \ + </string> + <string name="0"> + 0 + </string> + <string name="1"> + 1 + </string> + <string name="2"> + 2 + </string> + <string name="3"> + 3 + </string> + <string name="4"> + 4 + </string> + <string name="5"> + 5 + </string> + <string name="6"> + 6 + </string> + <string name="7"> + 7 + </string> + <string name="8"> + 8 + </string> + <string name="9"> + 9 + </string> + <string name="A"> + A + </string> + <string name="B"> + B + </string> + <string name="C"> + C + </string> + <string name="D"> + D + </string> + <string name="E"> + E + </string> + <string name="F"> + F + </string> + <string name="G"> + G + </string> + <string name="H"> + H + </string> + <string name="I"> + I + </string> + <string name="J"> + J + </string> + <string name="K"> + K + </string> + <string name="L"> + L + </string> + <string name="M"> + M + </string> + <string name="N"> + N + </string> + <string name="O"> + O + </string> + <string name="P"> + P + </string> + <string name="Q"> + Q + </string> + <string name="R"> + R + </string> + <string name="S"> + S + </string> + <string name="T"> + T + </string> + <string name="U"> + U + </string> + <string name="V"> + V + </string> + <string name="W"> + W + </string> + <string name="X"> + X + </string> + <string name="Y"> + Y + </string> + <string name="Z"> + Z + </string> + <string name="BeaconParticle"> + Viendo balizas de partículas (azules) + </string> + <string name="BeaconPhysical"> + Viendo balizas de objetos materiales (verdes) + </string> + <string name="BeaconScripted"> + Viendo balizas de objetos con script (rojas) + </string> + <string name="BeaconScriptedTouch"> + Viendo el objeto con script con balizas de función táctil (rojas) + </string> + <string name="BeaconSound"> + Viendo balizas de sonido (amarillas) + </string> + <string name="BeaconMedia"> + Viendo balizas de medios (blancas) + </string> + <string name="ParticleHiding"> + Ocultando las partículas + </string> </strings> diff --git a/indra/newview/skins/default/xui/fr/floater_about_land.xml b/indra/newview/skins/default/xui/fr/floater_about_land.xml index 6e6409725f..a33c0344f7 100644 --- a/indra/newview/skins/default/xui/fr/floater_about_land.xml +++ b/indra/newview/skins/default/xui/fr/floater_about_land.xml @@ -248,7 +248,7 @@ ou divisé. <text name="group_objects_text"> [COUNT] </text> - <button label="Afficher" label_selected="Afficher" name="ShowGroup" /> + <button label="Afficher" label_selected="Afficher" name="ShowGroup"/> <button label="Retour" label_selected="Renvoyer..." name="ReturnGroup..." tool_tip="Renvoyer les objets à leurs propriétaires."/> <text name="Owned by others:"> Appartenant à d'autres : @@ -336,7 +336,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche. Options du terrain : </text> <check_box label="Sécurisé (pas de dégâts)" name="check safe" tool_tip="Si cette option est cochée, le terrain est sécurisé et il n'y pas de risques de dommages causés par des combats. Si elle est décochée, des dommages causés par les combats peuvent avoir lieu."/> - <check_box label="Pas de bousculades" name="PushRestrictCheck" tool_tip="Empêche l'utilisation de scripts causant des bousculades. Cette option est utile pour empêcher les comportements abusifs sur votre terrain."/> + <check_box label="Pas de bousculades" name="PushRestrictCheck" tool_tip="Empêche l'utilisation de scripts causant des bousculades. Cette option est utile pour empêcher les comportements abusifs sur votre terrain."/> <check_box label="Afficher le lieu dans la recherche (30 L$/semaine)" name="ShowDirectoryCheck" tool_tip="Afficher la parcelle dans les résultats de recherche"/> <combo_box name="land category with adult"> <combo_box.item label="Toutes catégories" name="item0"/> @@ -351,6 +351,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche. <combo_box.item label="Parcs et Nature" name="item9"/> <combo_box.item label="Résidentiel" name="item10"/> <combo_box.item label="Shopping" name="item11"/> + <combo_box.item label="Location" name="item13"/> <combo_box.item label="Autre" name="item12"/> </combo_box> <combo_box name="land category"> @@ -365,6 +366,7 @@ Seules les parcelles de grande taille peuvent apparaître dans la recherche. <combo_box.item label="Parcs et Nature" name="item9"/> <combo_box.item label="Résidentiel" name="item10"/> <combo_box.item label="Shopping" name="item11"/> + <combo_box.item label="Location" name="item13"/> <combo_box.item label="Autre" name="item12"/> </combo_box> <check_box label="Contenu Modéré" name="MatureCheck" tool_tip=""/> @@ -444,7 +446,7 @@ musique : (défini par le domaine </panel.string> <panel.string name="allow_public_access"> - Autoriser l'accès public ([MATURITY]) + Autoriser l'accès public ([MATURITY]) (Remarque : des lignes d'interdiction seront créées si cette case n'est pas cochée) </panel.string> <panel.string name="estate_override"> Au moins une de ces options est définie au niveau du domaine. diff --git a/indra/newview/skins/default/xui/fr/floater_map.xml b/indra/newview/skins/default/xui/fr/floater_map.xml index 04afe89c7b..8675fb8ef9 100644 --- a/indra/newview/skins/default/xui/fr/floater_map.xml +++ b/indra/newview/skins/default/xui/fr/floater_map.xml @@ -1,32 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <floater name="Map" title=""> - <floater.string name="mini_map_north"> - N - </floater.string> - <floater.string name="mini_map_east"> - E - </floater.string> - <floater.string name="mini_map_west"> - O - </floater.string> - <floater.string name="mini_map_south"> - S - </floater.string> - <floater.string name="mini_map_southeast"> - SE - </floater.string> - <floater.string name="mini_map_northeast"> - NE - </floater.string> - <floater.string name="mini_map_southwest"> - SO - </floater.string> - <floater.string name="mini_map_northwest"> - NO - </floater.string> <floater.string name="ToolTipMsg"> [REGION](Carte : double-clic ; Panoramique : Maj + faire glisser) </floater.string> + <floater.string name="AltToolTipMsg"> + [REGION](Téléportation : double-clic ; Panoramique : Maj + faire glisser) + </floater.string> <floater.string name="mini_map_caption"> MINI-CARTE </floater.string> diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml index 01274b4cbc..fd72e6ac15 100644 --- a/indra/newview/skins/default/xui/fr/floater_tools.xml +++ b/indra/newview/skins/default/xui/fr/floater_tools.xml @@ -64,6 +64,8 @@ <radio_item label="Choisir une face" name="radio select face"/> </radio_group> <check_box label="Modification liée" name="checkbox edit linked parts"/> + <button label="Lien" name="link_btn"/> + <button label="Annuler le lien" name="unlink_btn"/> <text name="RenderingCost" tool_tip="Affiche le coût du rendu calculé pour cet objet"> þ : [COUNT] </text> diff --git a/indra/newview/skins/default/xui/fr/menu_attachment_self.xml b/indra/newview/skins/default/xui/fr/menu_attachment_self.xml index 78198fb5a8..6af2064e44 100644 --- a/indra/newview/skins/default/xui/fr/menu_attachment_self.xml +++ b/indra/newview/skins/default/xui/fr/menu_attachment_self.xml @@ -5,7 +5,7 @@ <menu_item_call label="Détacher" name="Detach"/> <menu_item_call label="M'asseoir" name="Sit Down Here"/> <menu_item_call label="Me lever" name="Stand Up"/> - <menu_item_call label="Changer de tenue" name="Change Outfit"/> + <menu_item_call label="Mon apparence" name="Change Outfit"/> <menu_item_call label="Modifier ma tenue" name="Edit Outfit"/> <menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/> <menu_item_call label="Mes amis" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/fr/menu_avatar_self.xml b/indra/newview/skins/default/xui/fr/menu_avatar_self.xml index c7ee2e9f88..21528cd43b 100644 --- a/indra/newview/skins/default/xui/fr/menu_avatar_self.xml +++ b/indra/newview/skins/default/xui/fr/menu_avatar_self.xml @@ -21,7 +21,7 @@ <context_menu label="Détacher" name="Object Detach"/> <menu_item_call label="Tout détacher" name="Detach All"/> </context_menu> - <menu_item_call label="Changer de tenue" name="Chenge Outfit"/> + <menu_item_call label="Mon apparence" name="Chenge Outfit"/> <menu_item_call label="Modifier ma tenue" name="Edit Outfit"/> <menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/> <menu_item_call label="Mes amis" name="Friends..."/> diff --git a/indra/newview/skins/default/xui/fr/menu_bottomtray.xml b/indra/newview/skins/default/xui/fr/menu_bottomtray.xml index bfdc89c5bb..ddaea517fc 100644 --- a/indra/newview/skins/default/xui/fr/menu_bottomtray.xml +++ b/indra/newview/skins/default/xui/fr/menu_bottomtray.xml @@ -1,10 +1,10 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <menu name="hide_camera_move_controls_menu"> + <menu_item_check label="Voix activée" name="EnableVoiceChat"/> <menu_item_check label="Bouton Geste" name="ShowGestureButton"/> <menu_item_check label="Bouton Bouger" name="ShowMoveButton"/> <menu_item_check label="Bouton Affichage" name="ShowCameraButton"/> <menu_item_check label="Bouton Photo" name="ShowSnapshotButton"/> - <menu_item_check label="Bouton Panneau latéral" name="ShowSidebarButton"/> <menu_item_check label="Bouton Construire" name="ShowBuildButton"/> <menu_item_check label="Bouton Rechercher" name="ShowSearchButton"/> <menu_item_check label="Bouton Carte" name="ShowWorldMapButton"/> diff --git a/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml index 17254ff325..53f22bb44a 100644 --- a/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml +++ b/indra/newview/skins/default/xui/fr/menu_inspect_avatar_gear.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> +<toggleable_menu name="Gear Menu"> <menu_item_call label="Voir le profil" name="view_profile"/> <menu_item_call label="Devenir amis" name="add_friend"/> <menu_item_call label="IM" name="im"/> @@ -11,9 +11,11 @@ <menu_item_call label="Signaler" name="report"/> <menu_item_call label="Figer" name="freeze"/> <menu_item_call label="Expulser" name="eject"/> + <menu_item_call label="Éjecter" name="kick"/> + <menu_item_call label="Représentant de l'Assistance client" name="csr"/> <menu_item_call label="Déboguer les textures" name="debug"/> <menu_item_call label="Situer sur la carte" name="find_on_map"/> <menu_item_call label="Zoomer en avant" name="zoom_in"/> <menu_item_call label="Payer" name="pay"/> <menu_item_call label="Partager" name="share"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml index 3bc164788a..ac70df472d 100644 --- a/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml +++ b/indra/newview/skins/default/xui/fr/menu_inspect_self_gear.xml @@ -1,10 +1,31 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="M'asseoir" name="sit_down_here"/> - <menu_item_call label="Me lever" name="stand_up"/> - <menu_item_call label="Changer de tenue" name="change_outfit"/> - <menu_item_call label="Mon profil" name="my_profile"/> - <menu_item_call label="Mes amis" name="my_friends"/> - <menu_item_call label="Mes groupes" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Gear Menu"> + <menu_item_call label="M'asseoir" name="Sit Down Here"/> + <menu_item_call label="Me lever" name="Stand Up"/> + <context_menu label="Enlever" name="Take Off >"> + <context_menu label="Habits" name="Clothes >"> + <menu_item_call label="Chemise" name="Shirt"/> + <menu_item_call label="Pantalon" name="Pants"/> + <menu_item_call label="Jupe" name="Skirt"/> + <menu_item_call label="Chaussures" name="Shoes"/> + <menu_item_call label="Chaussettes" name="Socks"/> + <menu_item_call label="Veste" name="Jacket"/> + <menu_item_call label="Gants" name="Gloves"/> + <menu_item_call label="Débardeur" name="Self Undershirt"/> + <menu_item_call label="Caleçon" name="Self Underpants"/> + <menu_item_call label="Tatouage" name="Self Tattoo"/> + <menu_item_call label="Alpha" name="Self Alpha"/> + <menu_item_call label="Tous les habits" name="All Clothes"/> + </context_menu> + <context_menu label="HUD" name="Object Detach HUD"/> + <context_menu label="Détacher" name="Object Detach"/> + <menu_item_call label="Tout détacher" name="Detach All"/> + </context_menu> + <menu_item_call label="Changer de tenue" name="Chenge Outfit"/> + <menu_item_call label="Modifier ma tenue" name="Edit Outfit"/> + <menu_item_call label="Modifier ma silhouette" name="Edit My Shape"/> + <menu_item_call label="Mes amis" name="Friends..."/> + <menu_item_call label="Mes groupes" name="Groups..."/> + <menu_item_call label="Mon profil" name="Profile..."/> <menu_item_call label="Déboguer les textures" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml index f28918ae14..364872c875 100644 --- a/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml +++ b/indra/newview/skins/default/xui/fr/menu_inventory_gear_default.xml @@ -3,6 +3,7 @@ <menu_item_call label="Nouvelle fenêtre d'inventaire" name="new_window"/> <menu_item_check label="Trier par nom" name="sort_by_name"/> <menu_item_check label="Trier en commençant par le plus récent" name="sort_by_recent"/> + <menu_item_check label="Toujours trier les dossiers par nom" name="sort_folders_by_name"/> <menu_item_check label="Dossiers système en premier" name="sort_system_folders_to_top"/> <menu_item_call label="Afficher les filtres" name="show_filters"/> <menu_item_call label="Réinitialiser les filtres" name="reset_filters"/> diff --git a/indra/newview/skins/default/xui/fr/menu_object.xml b/indra/newview/skins/default/xui/fr/menu_object.xml index a50a9df4b1..c6db48a31c 100644 --- a/indra/newview/skins/default/xui/fr/menu_object.xml +++ b/indra/newview/skins/default/xui/fr/menu_object.xml @@ -16,14 +16,14 @@ <context_menu label="Attacher" name="Object Attach"/> <context_menu label="Attacher HUD" name="Object Attach HUD"/> </context_menu> - <context_menu label="Supprimer" name="Remove"> + <context_menu label="Gérer" name="Remove"> <menu_item_call label="Signaler une infraction" name="Report Abuse..."/> <menu_item_call label="Ignorer" name="Object Mute"/> <menu_item_call label="Retour" name="Return..."/> - <menu_item_call label="Supprimer" name="Delete"/> </context_menu> <menu_item_call label="Prendre" name="Pie Object Take"/> <menu_item_call label="Prendre une copie" name="Take Copy"/> <menu_item_call label="Payer" name="Pay..."/> <menu_item_call label="Acheter" name="Buy..."/> + <menu_item_call label="Supprimer" name="Delete"/> </context_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml index 3570bdec7f..3fdf3bf3c4 100644 --- a/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml +++ b/indra/newview/skins/default/xui/fr/menu_places_gear_folder.xml @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_folder_gear"> +<toggleable_menu name="menu_folder_gear"> <menu_item_call label="Ajouter un repère" name="add_landmark"/> <menu_item_call label="Ajouter un dossier" name="add_folder"/> + <menu_item_call label="Restaurer l'article" name="restore_item"/> <menu_item_call label="Couper" name="cut"/> <menu_item_call label="Copier" name="copy_folder"/> <menu_item_call label="Coller" name="paste"/> @@ -12,4 +13,4 @@ <menu_item_call label="Développer tous les dossiers" name="expand_all"/> <menu_item_call label="Réduire tous les dossiers" name="collapse_all"/> <menu_item_check label="Trier par date" name="sort_by_date"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml index 5491c1b3fc..b48f6ea693 100644 --- a/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml +++ b/indra/newview/skins/default/xui/fr/menu_places_gear_landmark.xml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> -<menu name="menu_ladmark_gear"> +<toggleable_menu name="menu_ladmark_gear"> <menu_item_call label="Téléporter" name="teleport"/> <menu_item_call label="Plus d'informations" name="more_info"/> <menu_item_call label="Voir sur la carte" name="show_on_map"/> <menu_item_call label="Ajouter un repère" name="add_landmark"/> <menu_item_call label="Ajouter un dossier" name="add_folder"/> + <menu_item_call label="Restaurer l'article" name="restore_item"/> <menu_item_call label="Couper" name="cut"/> <menu_item_call label="Copier le repère" name="copy_landmark"/> <menu_item_call label="Copier la SLurl" name="copy_slurl"/> @@ -15,4 +16,4 @@ <menu_item_call label="Réduire tous les dossiers" name="collapse_all"/> <menu_item_check label="Trier par date" name="sort_by_date"/> <menu_item_call label="Créer un favori" name="create_pick"/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml index 65a00c2e6c..ee1ab8c601 100644 --- a/indra/newview/skins/default/xui/fr/menu_viewer.xml +++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml @@ -7,7 +7,7 @@ </menu_item_call> <menu_item_call label="Acheter des L$" name="Buy and Sell L$"/> <menu_item_call label="Mon profil" name="Profile"/> - <menu_item_call label="Changer de tenue" name="ChangeOutfit"/> + <menu_item_call label="Mon apparence" name="ChangeOutfit"/> <menu_item_check label="Mon inventaire" name="Inventory"/> <menu_item_check label="Mon inventaire" name="ShowSidetrayInventory"/> <menu_item_check label="Mes gestes" name="Gestures"/> @@ -35,6 +35,7 @@ <menu label="Monde" name="World"> <menu_item_check label="Mini-carte" name="Mini-Map"/> <menu_item_check label="Carte du monde" name="World Map"/> + <menu_item_check label="Rechercher" name="Search"/> <menu_item_call label="Photo" name="Take Snapshot"/> <menu_item_call label="Créer un repère pour ce lieu" name="Create Landmark Here"/> <menu label="Profil du lieu" name="Land"> @@ -227,8 +228,10 @@ <menu label="Afficher les infos" name="Display Info"> <menu_item_check label="Afficher l'heure" name="Show Time"/> <menu_item_check label="Afficher les infos de rendu" name="Show Render Info"/> + <menu_item_check label="Afficher les infos de texture" name="Show Texture Info"/> <menu_item_check label="Afficher les matrices" name="Show Matrices"/> <menu_item_check label="Afficher la couleur sous le curseur" name="Show Color Under Cursor"/> + <menu_item_check label="Afficher la mémoire" name="Show Memory"/> <menu_item_check label="Afficher les mises à jour des objets" name="Show Updates"/> </menu> <menu label="Forcer une erreur" name="Force Errors"> @@ -253,6 +256,7 @@ <menu_item_check label="Shadow Frusta" name="Shadow Frusta"/> <menu_item_check label="Occlusion" name="Occlusion"/> <menu_item_check label="Lots de rendu" name="Render Batches"/> + <menu_item_check label="Type de mise à jour" name="Update Type"/> <menu_item_check label="Texture Anim" name="Texture Anim"/> <menu_item_check label="Priorité de la texture" name="Texture Priority"/> <menu_item_check label="Zone de texture" name="Texture Area"/> diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml index 603b8f0edc..e984ea66ed 100644 --- a/indra/newview/skins/default/xui/fr/notifications.xml +++ b/indra/newview/skins/default/xui/fr/notifications.xml @@ -73,7 +73,7 @@ Détails de l'erreur : La notification, appelée '[_NAME]', est i </notification> <notification name="LoginFailedNoNetwork"> Connexion à [SECOND_LIFE_GRID] impossible. -'[DIAGNOSTIC]' + '[DIAGNOSTIC]' Veuillez vérifier votre connexion Internet. <usetemplate name="okbutton" yestext="OK"/> </notification> @@ -332,13 +332,6 @@ Pour entrer dans [SECOND_LIFE], vous devez disposer d'un compte. Voulez-vou <notification name="InvalidCredentialFormat"> Saisissez soit le nom d'utilisateur soit à la fois le prénom et le nom de votre avatar dans le champ Nom d'utilisateur, puis connectez-vous. </notification> - <notification name="AddClassified"> - Les petites annonces sont publiées à l'onglet Petites annonces de la section Recherche et sur [http://secondlife.com/community/classifieds secondlife.com] pendant une semaine. -Rédigez votre annonce, puis cliquez sur Publier pour l'ajouter à la liste des annonces. -Au moment de cliquer sur Publier, vous serez invité à payer des frais. -Plus vous payez cher, plus votre annonce est visible dans la liste ainsi que dans les résultats de recherche de mots-clés. - <usetemplate ignoretext="Comment ajouter une nouvelle petite annonce" name="okcancelignore" notext="Annuler" yestext="OK"/> - </notification> <notification name="DeleteClassified"> Supprimer l'annonce [NAME] ? Une fois payés, les frais ne sont pas remboursables. @@ -2848,9 +2841,6 @@ Ignorer les autres ? <notification label="Explorer le monde" name="HintDestinationGuide"> Le Guide des destinations comprend des milliers d'endroits nouveaux à découvrir. Sélectionnez-en un, puis cliquez sur Téléporter pour commencer à l'explorer. </notification> - <notification label="Changer d'apparence" name="HintAvatarPicker"> - Vous souhaitez changer de look ? Cliquez sur le bouton ci-dessous pour voir plus d'avatars. - </notification> <notification label="Panneau latéral" name="HintSidePanel"> Obtenir un accès rapide à votre inventaire, à vos habits, à vos profils et bien plus encore dans le panneau latéral. </notification> @@ -2888,6 +2878,38 @@ Ignorer les autres ? <button name="cancel" text="Annuler"/> </form> </notification> + <notification label="" name="ModeChange"> + Vous devez quitter et redémarrer l'application afin de changer de mode. + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoClassifieds"> + Pour créer et modifier des petites annonces, vous devez utiliser le mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? Le sélecteur de mode se trouve sur l'écran de connexion. + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoGroupInfo"> + Pour créer et modifier des groupes, vous devez utiliser le mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? Le sélecteur de mode se trouve sur l'écran de connexion. + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoPicks"> + Pour créer et modifier des favoris, vous devez utiliser le mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? Le sélecteur de mode se trouve sur l'écran de connexion. + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoWorldMap"> + Pour afficher la carte du monde, vous devez utiliser le mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? Le sélecteur de mode se trouve sur l'écran de connexion. + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoVoiceCall"> + Les appels vocaux sont uniquement disponibles en mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoAvatarShare"> + Le partage est uniquement disponible en mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> + <notification label="" name="NoAvatarPay"> + Pour pouvoir payer d'autres résidents, vous devez utiliser le mode Avancé. Voulez-vous quitter l'application afin de changer de mode ? + <usetemplate name="okcancelbuttons" notext="Ne pas quitter" yestext="Quitter"/> + </notification> <global name="UnsupportedCPU"> - Votre processeur ne remplit pas les conditions minimum requises. </global> diff --git a/indra/newview/skins/default/xui/fr/panel_login.xml b/indra/newview/skins/default/xui/fr/panel_login.xml index ef55ba7991..e54b36644c 100644 --- a/indra/newview/skins/default/xui/fr/panel_login.xml +++ b/indra/newview/skins/default/xui/fr/panel_login.xml @@ -17,6 +17,13 @@ </text> <check_box label="Enregistrer" name="remember_check"/> <button label="Connexion" name="connect_btn"/> + <text name="mode_selection_text"> + Mode : + </text> + <combo_box name="mode_combo" tool_tip="Sélectionnez un mode. Pour une exploration facile et rapide avec chat, choisissez Basique. Pour accéder à plus de fonctionnalités, choisissez Avancé."> + <combo_box.item label="Basique" name="Basic"/> + <combo_box.item label="Avancé" name="Advanced"/> + </combo_box> <text name="start_location_text"> Lieu de départ : </text> diff --git a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml index 66bfd01a2a..7b7b67041a 100644 --- a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml +++ b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml @@ -19,7 +19,7 @@ <button label="Arrêter" name="all_nearby_media_disable_btn" tool_tip="Désactiver tous les médias près de vous"/> <button label="Lire" name="all_nearby_media_enable_btn" tool_tip="Activer tous les médias près de vous"/> <button name="open_prefs_btn" tool_tip="Ouvrir les préférences de média"/> - <button label="Plus >>" label_selected="Moins <<" name="more_btn" tool_tip="Options avancées"/> + <button label="Plus >>" label_selected="<< Moins" name="more_btn" tool_tip="Options avancées"/> <button label="Plus >>" label_selected="Moins <<" name="less_btn" tool_tip="Options avancées"/> </panel> <panel name="nearby_media_panel"> diff --git a/indra/newview/skins/default/xui/fr/panel_people.xml b/indra/newview/skins/default/xui/fr/panel_people.xml index eecbabae2b..166f04b3e4 100644 --- a/indra/newview/skins/default/xui/fr/panel_people.xml +++ b/indra/newview/skins/default/xui/fr/panel_people.xml @@ -18,6 +18,8 @@ Pour rechercher des résidents avec qui passer du temps, utilisez [secondlife:// <string name="groups_filter_label" value="Filtrer les groupes"/> <string name="no_filtered_groups_msg" value="Vous n'avez pas trouvé ce que vous cherchiez ? Essayez [secondlife:///app/search/groups/[SEARCH_TERM] Rechercher]."/> <string name="no_groups_msg" value="Vous souhaitez trouver des groupes à rejoindre ? Utilisez [secondlife:///app/search/groups Rechercher]."/> + <string name="MiniMapToolTipMsg" value="[REGION](Carte : double-clic ; Panoramique : Maj + faire glisser)"/> + <string name="AltMiniMapToolTipMsg" value="[REGION](Téléportation : double-clic ; Panoramique : Maj + faire glisser)"/> <filter_editor label="Filtre" name="filter_input"/> <tab_container name="tabs"> <panel label="PRÈS DE VOUS" name="nearby_panel"> diff --git a/indra/newview/skins/default/xui/fr/panel_profile.xml b/indra/newview/skins/default/xui/fr/panel_profile.xml index 6b611923af..9aa6fe97a1 100644 --- a/indra/newview/skins/default/xui/fr/panel_profile.xml +++ b/indra/newview/skins/default/xui/fr/panel_profile.xml @@ -16,6 +16,12 @@ <string name="RegisterDateFormat"> [REG_DATE] ([AGE]) </string> + <string name="name_text_args"> + [NAME] + </string> + <string name="display_name_text_args"> + [DISPLAY_NAME] + </string> <layout_stack name="layout"> <layout_panel name="profile_stack"> <scroll_container name="profile_scroll"> @@ -34,7 +40,7 @@ </text_editor> <text name="title_partner_text" value="Partenaire :"/> <panel name="partner_data_panel"> - <name_box initial_value="(récupération en cours)" name="partner_text"/> + <text initial_value="(récupération en cours)" name="partner_text"/> </panel> <text name="title_groups_text" value="Groupes :"/> </panel> diff --git a/indra/newview/skins/default/xui/fr/panel_script_ed.xml b/indra/newview/skins/default/xui/fr/panel_script_ed.xml index 2c86dd72b6..2b08ae56c5 100644 --- a/indra/newview/skins/default/xui/fr/panel_script_ed.xml +++ b/indra/newview/skins/default/xui/fr/panel_script_ed.xml @@ -15,6 +15,9 @@ <panel.string name="Title"> Script : [NAME] </panel.string> + <panel.string name="external_editor_not_set"> + Sélectionnez un éditeur en définissant la variable d'environnement LL_SCRIPT_EDITOR ou le paramètre ExternalEditor. + </panel.string> <menu_bar name="script_menu"> <menu label="Fichier" name="File"> <menu_item_call label="Enregistrer" name="Save"/> diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml index 74c1fd8622..a7c71dc0f0 100644 --- a/indra/newview/skins/default/xui/fr/strings.xml +++ b/indra/newview/skins/default/xui/fr/strings.xml @@ -1067,7 +1067,7 @@ <string name="PermNo"> Non </string> - <string name="Chat" value=" Chat :"/> + <string name="Chat Message" value="Chat :"/> <string name="Sound" value=" Son :"/> <string name="Wait" value=" --- Attendre :"/> <string name="AnimFlagStop" value=" Arrêter l'animation :"/> @@ -1864,12 +1864,6 @@ <string name="accel-win-shift"> Maj+ </string> - <string name="Esc"> - Échap - </string> - <string name="Home"> - Début - </string> <string name="FileSaved"> Fichier enregistré </string> @@ -1889,7 +1883,7 @@ PDT </string> <string name="Direction_Forward"> - Vers l'avant + Avant </string> <string name="Direction_Left"> Gauche @@ -1987,6 +1981,9 @@ <string name="Other"> Autre </string> + <string name="Rental"> + Location + </string> <string name="Any"> Aucun </string> @@ -3966,7 +3963,7 @@ de l'infraction signalée <string name="Notices"> Notices </string> - <string name="Chat"> + <string name="Chat" value=" Chat :"> Chat </string> <string name="DeleteItems"> @@ -3978,4 +3975,348 @@ de l'infraction signalée <string name="EmptyOutfitText"> Cette tenue ne contient aucun article. </string> + <string name="ExternalEditorNotSet"> + Sélectionnez un éditeur à l'aide du paramètre ExternalEditor. + </string> + <string name="ExternalEditorNotFound"> + Éditeur externe spécifié introuvable. +Essayez avec le chemin d'accès à l'éditeur entre guillemets doubles +(par ex. : "/chemin_accès/editor" "%s"). + </string> + <string name="ExternalEditorCommandParseError"> + Erreur lors de l'analyse de la commande d'éditeur externe. + </string> + <string name="ExternalEditorFailedToRun"> + Échec d'exécution de l'éditeur externe. + </string> + <string name="Esc"> + Échap + </string> + <string name="Space"> + Space + </string> + <string name="Enter"> + Enter + </string> + <string name="Tab"> + Tab + </string> + <string name="Ins"> + Ins + </string> + <string name="Del"> + Del + </string> + <string name="Backsp"> + Backsp + </string> + <string name="Shift"> + Shift + </string> + <string name="Ctrl"> + Ctrl + </string> + <string name="Alt"> + Alt + </string> + <string name="CapsLock"> + CapsLock + </string> + <string name="Home"> + Début + </string> + <string name="End"> + End + </string> + <string name="PgUp"> + PgUp + </string> + <string name="PgDn"> + PgDn + </string> + <string name="F1"> + F1 + </string> + <string name="F2"> + F2 + </string> + <string name="F3"> + F3 + </string> + <string name="F4"> + F4 + </string> + <string name="F5"> + F5 + </string> + <string name="F6"> + F6 + </string> + <string name="F7"> + F7 + </string> + <string name="F8"> + F8 + </string> + <string name="F9"> + F9 + </string> + <string name="F10"> + F10 + </string> + <string name="F11"> + F11 + </string> + <string name="F12"> + F12 + </string> + <string name="Add"> + Ajouter + </string> + <string name="Subtract"> + Soustraire + </string> + <string name="Multiply"> + Multiplier + </string> + <string name="Divide"> + Diviser + </string> + <string name="PAD_DIVIDE"> + PAD_DIVIDE + </string> + <string name="PAD_LEFT"> + PAD_LEFT + </string> + <string name="PAD_RIGHT"> + PAD_RIGHT + </string> + <string name="PAD_DOWN"> + PAD_DOWN + </string> + <string name="PAD_UP"> + PAD_UP + </string> + <string name="PAD_HOME"> + PAD_HOME + </string> + <string name="PAD_END"> + PAD_END + </string> + <string name="PAD_PGUP"> + PAD_PGUP + </string> + <string name="PAD_PGDN"> + PAD_PGDN + </string> + <string name="PAD_CENTER"> + PAD_CENTER + </string> + <string name="PAD_INS"> + PAD_INS + </string> + <string name="PAD_DEL"> + PAD_DEL + </string> + <string name="PAD_Enter"> + PAD_Enter + </string> + <string name="PAD_BUTTON0"> + PAD_BUTTON0 + </string> + <string name="PAD_BUTTON1"> + PAD_BUTTON1 + </string> + <string name="PAD_BUTTON2"> + PAD_BUTTON2 + </string> + <string name="PAD_BUTTON3"> + PAD_BUTTON3 + </string> + <string name="PAD_BUTTON4"> + PAD_BUTTON4 + </string> + <string name="PAD_BUTTON5"> + PAD_BUTTON5 + </string> + <string name="PAD_BUTTON6"> + PAD_BUTTON6 + </string> + <string name="PAD_BUTTON7"> + PAD_BUTTON7 + </string> + <string name="PAD_BUTTON8"> + PAD_BUTTON8 + </string> + <string name="PAD_BUTTON9"> + PAD_BUTTON9 + </string> + <string name="PAD_BUTTON10"> + PAD_BUTTON10 + </string> + <string name="PAD_BUTTON11"> + PAD_BUTTON11 + </string> + <string name="PAD_BUTTON12"> + PAD_BUTTON12 + </string> + <string name="PAD_BUTTON13"> + PAD_BUTTON13 + </string> + <string name="PAD_BUTTON14"> + PAD_BUTTON14 + </string> + <string name="PAD_BUTTON15"> + PAD_BUTTON15 + </string> + <string name="-"> + - + </string> + <string name="="> + = + </string> + <string name="`"> + ` + </string> + <string name=";"> + ; + </string> + <string name="["> + [ + </string> + <string name="]"> + ] + </string> + <string name="\"> + \ + </string> + <string name="0"> + 0 + </string> + <string name="1"> + 1 + </string> + <string name="2"> + 2 + </string> + <string name="3"> + 3 + </string> + <string name="4"> + 4 + </string> + <string name="5"> + 5 + </string> + <string name="6"> + 6 + </string> + <string name="7"> + 7 + </string> + <string name="8"> + 8 + </string> + <string name="9"> + 9 + </string> + <string name="A"> + A + </string> + <string name="B"> + B + </string> + <string name="C"> + C + </string> + <string name="D"> + D + </string> + <string name="E"> + E + </string> + <string name="F"> + F + </string> + <string name="G"> + G + </string> + <string name="H"> + H + </string> + <string name="I"> + I + </string> + <string name="J"> + J + </string> + <string name="K"> + K + </string> + <string name="L"> + L + </string> + <string name="M"> + M + </string> + <string name="N"> + N + </string> + <string name="O"> + O + </string> + <string name="P"> + P + </string> + <string name="Q"> + Q + </string> + <string name="R"> + R + </string> + <string name="S"> + S + </string> + <string name="T"> + T + </string> + <string name="U"> + U + </string> + <string name="V"> + V + </string> + <string name="W"> + W + </string> + <string name="X"> + X + </string> + <string name="Y"> + Y + </string> + <string name="Z"> + Z + </string> + <string name="BeaconParticle"> + Affichage des balises de particule (bleu) + </string> + <string name="BeaconPhysical"> + Affichage des balises d'objet physique (vert) + </string> + <string name="BeaconScripted"> + Affichage des balises d'objet scripté (rouge) + </string> + <string name="BeaconScriptedTouch"> + Affichage des balises d'objet scripté avec fonction de toucher (rouge) + </string> + <string name="BeaconSound"> + Affichage des balises de son (jaune) + </string> + <string name="BeaconMedia"> + Affichage des balises de média (blanc) + </string> + <string name="ParticleHiding"> + Masquage des particules + </string> </strings> diff --git a/indra/newview/skins/minimal/xui/de/floater_media_browser.xml b/indra/newview/skins/minimal/xui/de/floater_media_browser.xml new file mode 100644 index 0000000000..63cf4a6cba --- /dev/null +++ b/indra/newview/skins/minimal/xui/de/floater_media_browser.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_about" title="MEDIEN-BROWSER"> + <floater.string name="home_page_url"> + http://www.secondlife.com + </floater.string> + <floater.string name="support_page_url"> + http://support.secondlife.com + </floater.string> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button label="Zurück" name="back"/> + <button label="Vorwärts" name="forward"/> + <button label="Neu laden" name="reload"/> + <button label="Los" name="go"/> + </layout_panel> + <layout_panel name="time_controls"> + <button label="zurück" name="rewind"/> + <button label="anhalten" name="stop"/> + <button label="vorwärts" name="seek"/> + </layout_panel> + <layout_panel name="parcel_owner_controls"> + <button label="Aktuelle Seite an Parzelle senden" name="assign"/> + </layout_panel> + <layout_panel name="external_controls"> + <button label="In meinem Browser öffnen" name="open_browser"/> + <check_box label="Immer in meinem Browser öffnen" name="open_always"/> + <button label="Schließen" name="close"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/de/floater_web_content.xml b/indra/newview/skins/minimal/xui/de/floater_web_content.xml new file mode 100644 index 0000000000..6ab119eeab --- /dev/null +++ b/indra/newview/skins/minimal/xui/de/floater_web_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_web_content" title=""> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button name="back" tool_tip="Rückwärts"/> + <button name="forward" tool_tip="Vorwärts"/> + <button name="stop" tool_tip="Navigation stoppen"/> + <button name="reload" tool_tip="Seite neu laden"/> + <combo_box name="address" tool_tip="URL hier eingeben"/> + <icon name="media_secure_lock_flag" tool_tip="Sicheres Browsen"/> + <button name="popexternal" tool_tip="Aktuelle URL im Desktop-Browser öffnen"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml index 851a96cc09..443092319b 100644 --- a/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml +++ b/indra/newview/skins/minimal/xui/de/menu_inspect_self_gear.xml @@ -1,10 +1,8 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="Hinsetzen" name="sit_down_here"/> - <menu_item_call label="Aufstehen" name="stand_up"/> - <menu_item_call label="Outfit ändern" name="change_outfit"/> - <menu_item_call label="Mein Profil" name="my_profile"/> - <menu_item_call label="Meine Freunde" name="my_friends"/> - <menu_item_call label="Meine Gruppen" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Self Pie"> + <menu_item_call label="Hinsetzen" name="Sit Down Here"/> + <menu_item_call label="Aufstehen" name="Stand Up"/> + <menu_item_call label="Meine Freunde" name="Friends..."/> + <menu_item_call label="Mein Profil" name="Profile..."/> <menu_item_call label="Fehler in Texturen beseitigen" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/minimal/xui/de/notifications.xml b/indra/newview/skins/minimal/xui/de/notifications.xml new file mode 100644 index 0000000000..1eee1d1c9b --- /dev/null +++ b/indra/newview/skins/minimal/xui/de/notifications.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<notifications> + <notification name="UserGiveItem"> + [NAME_SLURL] bietet Ihnen [ITEM_SLURL] an. Zur Verwendung dieses Artikels müssen Sie in den erweiterten Modus umschalten, wo Sie den Artikel in Ihrem Inventar finden werden. Um in den erweiterten Modus umzuschalten, beenden Sie die Anwendung, starten Sie sie neu und ändern Sie die Moduseinstellung auf dem Anmeldebildschirm. + <form name="form"> + <button name="Show" text="Artikel behalten"/> + <button name="Discard" text="Artikel ablehnen"/> + <button name="Mute" text="Benutzer blockieren"/> + </form> + </notification> + <notification name="ObjectGiveItem"> + Ein Objekt namens <nolink>[OBJECTFROMNAME]</nolink>, das [NAME_SLURL] gehört, bietet Ihnen [ITEM_SLURL] an. Zur Verwendung dieses Artikels müssen Sie in den erweiterten Modus umschalten, wo Sie den Artikel in Ihrem Inventar finden werden. Um in den erweiterten Modus umzuschalten, beenden Sie die Anwendung, starten Sie sie neu und ändern Sie die Moduseinstellung auf dem Anmeldebildschirm. + <form name="form"> + <button name="Keep" text="Artikel behalten"/> + <button name="Discard" text="Artikel ablehnen"/> + <button name="Mute" text="Objekt blockieren"/> + </form> + </notification> +</notifications> diff --git a/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml index ea7cccbdf8..a4d80921ec 100644 --- a/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml +++ b/indra/newview/skins/minimal/xui/de/panel_bottomtray.xml @@ -11,10 +11,10 @@ <bottomtray_button label="Ansicht" name="camera_btn" tool_tip="Kamerasteuerung anzeigen/ausblenden"/> </layout_panel> <layout_panel name="avatar_and_destinations_panel"> - <radio_group name="avatar_and_destination_btns"> - <radio_item name="destination_btn" value="0"/> - <radio_item name="avatar_btn" value="1"/> - </radio_group> + <bottomtray_button label="Ziele" name="destination_btn" tool_tip="Zeigt Leutefenster an"/> + </layout_panel> + <layout_panel name="avatar_and_destinations_panel"> + <bottomtray_button label="Mein Avatar" name="avatar_btn"/> </layout_panel> <layout_panel name="people_panel"> <bottomtray_button label="Leute" name="show_people_button" tool_tip="Zeigt Leutefenster an"/> diff --git a/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml new file mode 100644 index 0000000000..81e6040f84 --- /dev/null +++ b/indra/newview/skins/minimal/xui/de/panel_group_control_panel.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel name="panel_im_control_panel"> + <layout_stack name="vertical_stack"> + <layout_panel name="end_call_btn_panel"> + <button label="Anruf beenden" name="end_call_btn"/> + </layout_panel> + <layout_panel name="voice_ctrls_btn_panel"> + <button label="Voice-Steuerung öffnen" name="voice_ctrls_btn"/> + </layout_panel> + </layout_stack> +</panel> diff --git a/indra/newview/skins/minimal/xui/de/panel_login.xml b/indra/newview/skins/minimal/xui/de/panel_login.xml index dff70d6994..2e82453aab 100644 --- a/indra/newview/skins/minimal/xui/de/panel_login.xml +++ b/indra/newview/skins/minimal/xui/de/panel_login.xml @@ -20,8 +20,8 @@ <text name="mode_selection_text"> Modus: </text> - <combo_box name="mode_combo"> - <combo_box.item label="Einfach (Standard)" name="Basic"/> + <combo_box name="mode_combo" tool_tip="Wählen Sie den gewünschten Modus aus. Basis: schnelles, einfaches Erkunden und Chatten. Erweitert: Zugriff auf zusätzliche Funktionen."> + <combo_box.item label="Basis" name="Basic"/> <combo_box.item label="Erweitert" name="Advanced"/> </combo_box> </layout_panel> diff --git a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml index eddfe41c25..cc551f7d58 100644 --- a/indra/newview/skins/minimal/xui/en/floater_help_browser.xml +++ b/indra/newview/skins/minimal/xui/en/floater_help_browser.xml @@ -8,12 +8,12 @@ min_height="360" left="645" top="10" - min_width="300" + min_width="345" name="floater_help_browser" save_rect="true" single_instance="true" title="HOW TO" - width="300"> + width="335"> <floater.string name="loading_text"> Loading... @@ -29,14 +29,14 @@ orientation="vertical" name="stack1" top="20" - width="290"> + width="325"> <layout_panel layout="topleft" left_delta="0" top_delta="0" name="external_controls" user_resize="false" - width="280"> + width="325"> <web_browser trusted_content="true" bottom="-5" @@ -46,7 +46,7 @@ name="browser" top="0" height="300" - width="280" /> + width="325" /> </layout_panel> </layout_stack> </floater> diff --git a/indra/newview/skins/minimal/xui/es/floater_media_browser.xml b/indra/newview/skins/minimal/xui/es/floater_media_browser.xml new file mode 100644 index 0000000000..a7086c2d6d --- /dev/null +++ b/indra/newview/skins/minimal/xui/es/floater_media_browser.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_about" title="EXPLORADOR DE MEDIA"> + <floater.string name="home_page_url"> + http://www.secondlife.com + </floater.string> + <floater.string name="support_page_url"> + http://support.secondlife.com + </floater.string> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button label="Atrás" name="back"/> + <button label="Adelante" name="forward"/> + <button label="Recargar" name="reload"/> + <button label="Ir" name="go"/> + </layout_panel> + <layout_panel name="time_controls"> + <button label="rebobinar" name="rewind"/> + <button label="parar" name="stop"/> + <button label="avanzar" name="seek"/> + </layout_panel> + <layout_panel name="parcel_owner_controls"> + <button label="Enviar a la parcela la página actual" name="assign"/> + </layout_panel> + <layout_panel name="external_controls"> + <button label="Abrir en mi propio navegador" name="open_browser"/> + <check_box label="Abrir siempre en mi propio navegador" name="open_always"/> + <button label="Cerrar" name="close"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/es/floater_web_content.xml b/indra/newview/skins/minimal/xui/es/floater_web_content.xml new file mode 100644 index 0000000000..b012809679 --- /dev/null +++ b/indra/newview/skins/minimal/xui/es/floater_web_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_web_content" title=""> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button name="back" tool_tip="Navegar hacia atrás"/> + <button name="forward" tool_tip="Navegar hacia adelante"/> + <button name="stop" tool_tip="Parar navegación"/> + <button name="reload" tool_tip="Recargar página"/> + <combo_box name="address" tool_tip="Escribe la URL aquí"/> + <icon name="media_secure_lock_flag" tool_tip="Navegación segura"/> + <button name="popexternal" tool_tip="Abrir la URL actual en tu explorador de escritorio"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml index c8a1e9d9da..1a49efb9d0 100644 --- a/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml +++ b/indra/newview/skins/minimal/xui/es/menu_inspect_self_gear.xml @@ -1,10 +1,8 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="Sentarte" name="sit_down_here"/> - <menu_item_call label="Levantarme" name="stand_up"/> - <menu_item_call label="Cambiar vestuario" name="change_outfit"/> - <menu_item_call label="Mi perfil" name="my_profile"/> - <menu_item_call label="Mis amigos" name="my_friends"/> - <menu_item_call label="Mis grupos" name="my_groups"/> - <menu_item_call label="Depurar las texturas" name="Debug..."/> -</menu> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Self Pie"> + <menu_item_call label="Sentarme" name="Sit Down Here"/> + <menu_item_call label="Levantarme" name="Stand Up"/> + <menu_item_call label="Mis amigos" name="Friends..."/> + <menu_item_call label="Mi perfil" name="Profile..."/> + <menu_item_call label="Depurar texturas" name="Debug..."/> +</toggleable_menu> diff --git a/indra/newview/skins/minimal/xui/es/notifications.xml b/indra/newview/skins/minimal/xui/es/notifications.xml new file mode 100644 index 0000000000..b08ebb5f76 --- /dev/null +++ b/indra/newview/skins/minimal/xui/es/notifications.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<notifications> + <notification name="UserGiveItem"> + [NAME_SLURL] te ofrece un/a [ITEM_SLURL]. Para utilizar este ítem, cambia al modo Avanzado y búscalo en el inventario. Para cambiar al modo Avanzado, sal de la aplicación, reiníciala y cambia el ajuste de modo en la pantalla de inicio de sesión. + <form name="form"> + <button name="Show" text="Conservar ítem"/> + <button name="Discard" text="Rechazar ítem"/> + <button name="Mute" text="Bloquear usuario"/> + </form> + </notification> + <notification name="ObjectGiveItem"> + Un objeto de nombre <nolink>[OBJECTFROMNAME]</nolink>, propiedad de [NAME_SLURL], te ofrece un/a [ITEM_SLURL]. Para utilizar este ítem, cambia al modo Avanzado y búscalo en el inventario. Para cambiar al modo Avanzado, sal de la aplicación, reiníciala y cambia el ajuste de modo en la pantalla de inicio de sesión. + <form name="form"> + <button name="Keep" text="Conservar ítem"/> + <button name="Discard" text="Rechazar ítem"/> + <button name="Mute" text="Bloquear objeto"/> + </form> + </notification> +</notifications> diff --git a/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml index 9ab30b5613..f782d66ae7 100644 --- a/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml +++ b/indra/newview/skins/minimal/xui/es/panel_bottomtray.xml @@ -11,10 +11,10 @@ <bottomtray_button label="Visión" name="camera_btn" tool_tip="Muestra/Oculta los controles de la cámara"/> </layout_panel> <layout_panel name="avatar_and_destinations_panel"> - <radio_group name="avatar_and_destination_btns"> - <radio_item name="destination_btn" value="0"/> - <radio_item name="avatar_btn" value="1"/> - </radio_group> + <bottomtray_button label="Destinos" name="destination_btn" tool_tip="Muestra la ventana de gente"/> + </layout_panel> + <layout_panel name="avatar_and_destinations_panel"> + <bottomtray_button label="Mi avatar" name="avatar_btn"/> </layout_panel> <layout_panel name="people_panel"> <bottomtray_button label="Gente" name="show_people_button" tool_tip="Muestra la ventana de gente"/> diff --git a/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml new file mode 100644 index 0000000000..e77156b0d4 --- /dev/null +++ b/indra/newview/skins/minimal/xui/es/panel_group_control_panel.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel name="panel_im_control_panel"> + <layout_stack name="vertical_stack"> + <layout_panel name="end_call_btn_panel"> + <button label="Colgar" name="end_call_btn"/> + </layout_panel> + <layout_panel name="voice_ctrls_btn_panel"> + <button label="Abrir los controles de la voz" name="voice_ctrls_btn"/> + </layout_panel> + </layout_stack> +</panel> diff --git a/indra/newview/skins/minimal/xui/es/panel_login.xml b/indra/newview/skins/minimal/xui/es/panel_login.xml index 161ea19b0e..689a71e277 100644 --- a/indra/newview/skins/minimal/xui/es/panel_login.xml +++ b/indra/newview/skins/minimal/xui/es/panel_login.xml @@ -20,8 +20,8 @@ <text name="mode_selection_text"> Modo: </text> - <combo_box name="mode_combo"> - <combo_box.item label="Básico (Predeterminado)" name="Basic"/> + <combo_box name="mode_combo" tool_tip="Selecciona el modo. Elige Básico para una exploración rápida y fácil y para chatear. Elige Avanzado para tener acceso a más funciones."> + <combo_box.item label="Básico" name="Basic"/> <combo_box.item label="Avanzado" name="Advanced"/> </combo_box> </layout_panel> diff --git a/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml b/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml new file mode 100644 index 0000000000..ba171c6363 --- /dev/null +++ b/indra/newview/skins/minimal/xui/fr/floater_media_browser.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_about" title="NAVIGATEUR DE MÉDIAS"> + <floater.string name="home_page_url"> + http://www.secondlife.com + </floater.string> + <floater.string name="support_page_url"> + http://support.secondlife.com + </floater.string> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button label="Préc." name="back"/> + <button label="Suiv." name="forward"/> + <button label="Recharger" name="reload"/> + <button label="OK" name="go"/> + </layout_panel> + <layout_panel name="time_controls"> + <button label="retour" name="rewind"/> + <button label="stop" name="stop"/> + <button label="avance" name="seek"/> + </layout_panel> + <layout_panel name="parcel_owner_controls"> + <button label="Envoyer la page actuelle à la parcelle" name="assign"/> + </layout_panel> + <layout_panel name="external_controls"> + <button label="Ouvrir dans mon navigateur Web" name="open_browser"/> + <check_box label="Toujours ouvrir dans mon navigateur Web" name="open_always"/> + <button label="Fermer" name="close"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/fr/floater_web_content.xml b/indra/newview/skins/minimal/xui/fr/floater_web_content.xml new file mode 100644 index 0000000000..71f44b6ec3 --- /dev/null +++ b/indra/newview/skins/minimal/xui/fr/floater_web_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_web_content" title=""> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button name="back" tool_tip="Précédente"/> + <button name="forward" tool_tip="Suivante"/> + <button name="stop" tool_tip="Arrêter"/> + <button name="reload" tool_tip="Recharger la page"/> + <combo_box name="address" tool_tip="Saisir une URL ici"/> + <icon name="media_secure_lock_flag" tool_tip="Navigation sécurisée"/> + <button name="popexternal" tool_tip="Ouvrir l'URL actuelle dans votre navigateur de bureau"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml index 3bc164788a..fd48aa4f7d 100644 --- a/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml +++ b/indra/newview/skins/minimal/xui/fr/menu_inspect_self_gear.xml @@ -1,10 +1,8 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="M'asseoir" name="sit_down_here"/> - <menu_item_call label="Me lever" name="stand_up"/> - <menu_item_call label="Changer de tenue" name="change_outfit"/> - <menu_item_call label="Mon profil" name="my_profile"/> - <menu_item_call label="Mes amis" name="my_friends"/> - <menu_item_call label="Mes groupes" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Self Pie"> + <menu_item_call label="M'asseoir" name="Sit Down Here"/> + <menu_item_call label="Me lever" name="Stand Up"/> + <menu_item_call label="Mes amis" name="Friends..."/> + <menu_item_call label="Mon profil" name="Profile..."/> <menu_item_call label="Déboguer les textures" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml b/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml index 26bd3978a9..f153ed15ae 100644 --- a/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml +++ b/indra/newview/skins/minimal/xui/fr/menu_people_nearby.xml @@ -9,5 +9,5 @@ <menu_item_call label="Partager" name="Share"/> <menu_item_call label="Payer" name="Pay"/> <menu_item_check label="Ignorer/Ne plus ignorer" name="Block/Unblock"/> - <menu_item_call label="Proposer une téléportation" name="teleport"/> + <menu_item_call label="Téléporter" name="teleport"/> </context_menu> diff --git a/indra/newview/skins/minimal/xui/fr/notifications.xml b/indra/newview/skins/minimal/xui/fr/notifications.xml new file mode 100644 index 0000000000..41dd42c39f --- /dev/null +++ b/indra/newview/skins/minimal/xui/fr/notifications.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<notifications> + <notification name="UserGiveItem"> + [NAME_SLURL] vous offre [ITEM_SLURL]. Pour utiliser cet article, vous devez passer en mode Avancé. L'article se trouve dans votre inventaire. Pour changer de mode, quittez l'application, redémarrez-la, puis sélectionnez un autre mode sur l'écran de connexion. + <form name="form"> + <button name="Show" text="Garder l'article"/> + <button name="Discard" text="Refuser l'article"/> + <button name="Mute" text="Ignorer l'utilisateur"/> + </form> + </notification> + <notification name="ObjectGiveItem"> + Un objet nommé <nolink>[OBJECTFROMNAME]</nolink> appartenant à [NAME_SLURL] vous offre [ITEM_SLURL]. Pour utiliser cet article, vous devez passer en mode Avancé. L'article se trouve dans votre inventaire. Pour changer de mode, quittez l'application, redémarrez-la, puis sélectionnez un autre mode sur l'écran de connexion. + <form name="form"> + <button name="Keep" text="Garder l'article"/> + <button name="Discard" text="Refuser l'article"/> + <button name="Mute" text="Ignorer l'objet"/> + </form> + </notification> +</notifications> diff --git a/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml index 3a01571f54..ef62901e99 100644 --- a/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml +++ b/indra/newview/skins/minimal/xui/fr/panel_bottomtray.xml @@ -11,10 +11,10 @@ <bottomtray_button label="Affichage" name="camera_btn" tool_tip="Affiche/Masque le contrôle de la caméra"/> </layout_panel> <layout_panel name="avatar_and_destinations_panel"> - <radio_group name="avatar_and_destination_btns"> - <radio_item name="destination_btn" value="0"/> - <radio_item name="avatar_btn" value="1"/> - </radio_group> + <bottomtray_button label="Destinations" name="destination_btn" tool_tip="Afficher la fenêtre des personnes."/> + </layout_panel> + <layout_panel name="avatar_and_destinations_panel"> + <bottomtray_button label="Mon avatar" name="avatar_btn"/> </layout_panel> <layout_panel name="people_panel"> <bottomtray_button label="Personnes" name="show_people_button" tool_tip="Afficher la fenêtre des personnes."/> diff --git a/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml new file mode 100644 index 0000000000..676fa1d222 --- /dev/null +++ b/indra/newview/skins/minimal/xui/fr/panel_group_control_panel.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel name="panel_im_control_panel"> + <layout_stack name="vertical_stack"> + <layout_panel name="end_call_btn_panel"> + <button label="Quitter l'appel" name="end_call_btn"/> + </layout_panel> + <layout_panel name="voice_ctrls_btn_panel"> + <button label="Ouvrir contrôles vocaux" name="voice_ctrls_btn"/> + </layout_panel> + </layout_stack> +</panel> diff --git a/indra/newview/skins/minimal/xui/fr/panel_login.xml b/indra/newview/skins/minimal/xui/fr/panel_login.xml index cb4822e96b..0869778a54 100644 --- a/indra/newview/skins/minimal/xui/fr/panel_login.xml +++ b/indra/newview/skins/minimal/xui/fr/panel_login.xml @@ -20,8 +20,8 @@ <text name="mode_selection_text"> Mode : </text> - <combo_box name="mode_combo"> - <combo_box.item label="Basique (par défaut)" name="Basic"/> + <combo_box name="mode_combo" tool_tip="Sélectionnez un mode. Pour une exploration facile et rapide avec chat, choisissez Basique. Pour accéder à plus de fonctionnalités, choisissez Avancé."> + <combo_box.item label="Basique" name="Basic"/> <combo_box.item label="Avancé" name="Advanced"/> </combo_box> </layout_panel> diff --git a/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml b/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml new file mode 100644 index 0000000000..da7428007e --- /dev/null +++ b/indra/newview/skins/minimal/xui/pt/floater_media_browser.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_about" title="NAVEGADOR DE MÍDIA"> + <floater.string name="home_page_url"> + http://www.secondlife.com + </floater.string> + <floater.string name="support_page_url"> + http://support.secondlife.com + </floater.string> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button label="Atrás" name="back"/> + <button label="Frente" name="forward"/> + <button label="Recarregar" name="reload"/> + <button label="OK" name="go"/> + </layout_panel> + <layout_panel name="time_controls"> + <button label="p/ trás" name="rewind"/> + <button label="parar" name="stop"/> + <button label="p/ frente" name="seek"/> + </layout_panel> + <layout_panel name="parcel_owner_controls"> + <button label="Enviar esta página para lote" name="assign"/> + </layout_panel> + <layout_panel name="external_controls"> + <button label="Abrir no meu navegador" name="open_browser"/> + <check_box label="Abrir sempre no meu navegador" name="open_always"/> + <button label="Fechar" name="close"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/pt/floater_web_content.xml b/indra/newview/skins/minimal/xui/pt/floater_web_content.xml new file mode 100644 index 0000000000..5101579c6f --- /dev/null +++ b/indra/newview/skins/minimal/xui/pt/floater_web_content.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<floater name="floater_web_content" title=""> + <layout_stack name="stack1"> + <layout_panel name="nav_controls"> + <button name="back" tool_tip="Navegar para trás"/> + <button name="forward" tool_tip="Navegar para frente"/> + <button name="stop" tool_tip="Parar a navegação"/> + <button name="reload" tool_tip="Recarregar página"/> + <combo_box name="address" tool_tip="Digite a URL aqui"/> + <icon name="media_secure_lock_flag" tool_tip="Navegação segura"/> + <button name="popexternal" tool_tip="Abrir a URL atual no navegador do seu computador"/> + </layout_panel> + </layout_stack> +</floater> diff --git a/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml b/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml index 7e67f4cfd4..c1f27e765d 100644 --- a/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml +++ b/indra/newview/skins/minimal/xui/pt/menu_inspect_self_gear.xml @@ -1,10 +1,8 @@ -<?xml version="1.0" encoding="utf-8"?> -<menu name="Gear Menu"> - <menu_item_call label="Sentar" name="sit_down_here"/> - <menu_item_call label="Ficar de pé" name="stand_up"/> - <menu_item_call label="Trocar de look" name="change_outfit"/> - <menu_item_call label="Meu perfil" name="my_profile"/> - <menu_item_call label="Meus amigos" name="my_friends"/> - <menu_item_call label="Meus grupos" name="my_groups"/> +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<toggleable_menu name="Self Pie"> + <menu_item_call label="Sentar" name="Sit Down Here"/> + <menu_item_call label="Ficar de pé" name="Stand Up"/> + <menu_item_call label="Meus amigos" name="Friends..."/> + <menu_item_call label="Meu perfil" name="Profile..."/> <menu_item_call label="Depurar texturas" name="Debug..."/> -</menu> +</toggleable_menu> diff --git a/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml b/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml index 7c720f262b..b446a2fe81 100644 --- a/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml +++ b/indra/newview/skins/minimal/xui/pt/menu_people_nearby.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8" standalone="yes"?> <context_menu name="Avatar Context Menu"> <menu_item_call label="Ver perfil" name="View Profile"/> - <menu_item_call label="Adicionar amigo..." name="Add Friend"/> - <menu_item_call label="Remover amigo..." name="Remove Friend"/> - <menu_item_call label="MI" name="IM"/> + <menu_item_call label="Adicionar amigo" name="Add Friend"/> + <menu_item_call label="Remover amigo" name="Remove Friend"/> + <menu_item_call label="IM" name="IM"/> <menu_item_call label="Ligar" name="Call"/> <menu_item_call label="Mapa" name="Map"/> <menu_item_call label="Compartilhar" name="Share"/> diff --git a/indra/newview/skins/minimal/xui/pt/notifications.xml b/indra/newview/skins/minimal/xui/pt/notifications.xml new file mode 100644 index 0000000000..30ba6f68bf --- /dev/null +++ b/indra/newview/skins/minimal/xui/pt/notifications.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<notifications> + <notification name="UserGiveItem"> + [NAME_SLURL] quer lhe dar [ITEM_SLURL]. Esta ação requer o modo Avançado. Passe para o modo avançado e você verá o item em seu inventário. Para passar para o modo avançado, feche e reinicialize esse aplicativo e mude o modo (indicado na tela de login). + <form name="form"> + <button name="Show" text="Guardar item"/> + <button name="Discard" text="Recusar item"/> + <button name="Mute" text="Bloquear usuário"/> + </form> + </notification> + <notification name="ObjectGiveItem"> + Um objeto chamado <nolink>[OBJECTFROMNAME]</nolink>, de [NAME_SLURL], está lhe oferecendo [ITEM_SLURL]. Esta ação requer o modo Avançado. Passe para o modo Avançado e você verá o item em seu Inventário. Para passar para o modo Avançado, feche e reinicialize esse aplicativo e mude o modo (indicado na tela de login). + <form name="form"> + <button name="Keep" text="Guardar item"/> + <button name="Discard" text="Recusar item"/> + <button name="Mute" text="Bloquear objeto"/> + </form> + </notification> +</notifications> diff --git a/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml b/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml index 243f323f09..f67823dbd8 100644 --- a/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml +++ b/indra/newview/skins/minimal/xui/pt/panel_bottomtray.xml @@ -11,10 +11,10 @@ <bottomtray_button label="Exibir" name="camera_btn" tool_tip="Mostra/oculta os controles da câmera"/> </layout_panel> <layout_panel name="avatar_and_destinations_panel"> - <radio_group name="avatar_and_destination_btns"> - <radio_item name="destination_btn" value="0"/> - <radio_item name="avatar_btn" value="1"/> - </radio_group> + <bottomtray_button label="Destinos" name="destination_btn" tool_tip="Exibe janela de pessoas"/> + </layout_panel> + <layout_panel name="avatar_and_destinations_panel"> + <bottomtray_button label="Meu avatar" name="avatar_btn"/> </layout_panel> <layout_panel name="people_panel"> <bottomtray_button label="Pessoas" name="show_people_button" tool_tip="Exibe as pessoas"/> diff --git a/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml b/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml new file mode 100644 index 0000000000..177cee28a6 --- /dev/null +++ b/indra/newview/skins/minimal/xui/pt/panel_group_control_panel.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes"?> +<panel name="panel_im_control_panel"> + <layout_stack name="vertical_stack"> + <layout_panel name="end_call_btn_panel"> + <button label="Desligar" name="end_call_btn"/> + </layout_panel> + <layout_panel name="voice_ctrls_btn_panel"> + <button label="Abrir controles de voz" name="voice_ctrls_btn"/> + </layout_panel> + </layout_stack> +</panel> diff --git a/indra/newview/skins/minimal/xui/pt/panel_login.xml b/indra/newview/skins/minimal/xui/pt/panel_login.xml index cd529b0b06..de9717874f 100644 --- a/indra/newview/skins/minimal/xui/pt/panel_login.xml +++ b/indra/newview/skins/minimal/xui/pt/panel_login.xml @@ -20,8 +20,8 @@ <text name="mode_selection_text"> Modo: </text> - <combo_box name="mode_combo"> - <combo_box.item label="Básico (padrão)" name="Basic"/> + <combo_box name="mode_combo" tool_tip="Selecione o modo. O modo Básico é mais rápido e ideal para explorar e conversar. Use o modo Avançado para acessar mais recursos."> + <combo_box.item label="Básico" name="Basic"/> <combo_box.item label="Avançado" name="Advanced"/> </combo_box> </layout_panel> |