From 1a9d19d95527d717b89d4ebf45af81824fcbdf44 Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxie@lindenlab.com>
Date: Fri, 3 Jul 2009 01:05:27 +0000
Subject: Initial secapi merge

svn merge -c112450  svn+ssh://svn.lindenlab.com/svn/linden/branches/giab-viewer/giab-viewer-1 giab-viewer-1-23

svn merge -c112913  svn+ssh://svn.lindenlab.com/svn/linden/branches/giab-viewer/giab-viewer-1 giab-viewer-1-23
---
 indra/newview/CMakeLists.txt         |  10 +
 indra/newview/llsecapi.cpp           |  69 +++++
 indra/newview/llsecapi.h             | 232 +++++++++++++++++
 indra/newview/llsechandler_basic.cpp | 490 +++++++++++++++++++++++++++++++++++
 indra/newview/llsechandler_basic.h   | 116 +++++++++
 5 files changed, 917 insertions(+)
 create mode 100644 indra/newview/llsecapi.cpp
 create mode 100644 indra/newview/llsecapi.h
 create mode 100644 indra/newview/llsechandler_basic.cpp
 create mode 100644 indra/newview/llsechandler_basic.h

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 62cb8380c0..9430bb1d56 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -7,6 +7,7 @@ include(Boost)
 include(BuildVersion)
 include(DBusGlib)
 include(DirectX)
+include(OpenSSL)
 include(ELFIO)
 include(FMOD)
 include(OPENAL)
@@ -372,6 +373,8 @@ set(viewer_SOURCE_FILES
     llscrollingpanelparam.cpp
     llsearchcombobox.cpp
     llsearchhistory.cpp
+    llsecapi.cpp
+    llsechandler_basic.cpp
     llselectmgr.cpp
     llsidepanelappearance.cpp
     llsidepanelinventory.cpp
@@ -875,6 +878,8 @@ set(viewer_HEADER_FILES
     llscrollingpanelparam.h
     llsearchcombobox.h
     llsearchhistory.h
+    llsecapi.h
+    llsechandler_basic.h
     llselectmgr.h
     llsidepanelappearance.h
     llsidepanelinventory.h
@@ -1618,6 +1623,8 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${WINDOWS_LIBRARIES}
     ${XMLRPCEPI_LIBRARIES}
     ${ELFIO_LIBRARIES}
+    ${OPENSSL_LIBRARIES}
+    ${CRYPTO_LIBRARIES}
     ${LLLOGIN_LIBRARIES}
     ${GOOGLE_PERFTOOLS_LIBRARIES}
     )
@@ -1803,6 +1810,9 @@ if (LL_TESTS)
   #ADD_VIEWER_BUILD_TEST(lltextureinfo viewer)
   #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer)
   #ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer)
+  #ADD_COMM_BUILD_TEST(llsecapi viewer "" llviewerprecompiledheaders.cpp llsechandler_basic.cpp)
+  #ADD_VIEWER_COMM_BUILD_TEST(llsechandler_basic viewer "")
+
 endif (LL_TESTS)
 
 
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
new file mode 100644
index 0000000000..c2cfde0dc7
--- /dev/null
+++ b/indra/newview/llsecapi.cpp
@@ -0,0 +1,69 @@
+/** 
+ * @file llsecapi.cpp
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llsecapi.h"
+#include "llsechandler_basic.h"
+#include <map>
+
+
+std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap;
+
+
+void initializeSecHandler()
+{
+	gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
+}
+// start using a given security api handler.  If the string is empty
+// the default is used
+LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type)
+{
+	if (gHandlerMap.find(handler_type) != gHandlerMap.end())
+	{
+		return gHandlerMap[handler_type];
+	}
+	else
+	{
+		return LLPointer<LLSecAPIHandler>(NULL);
+	}
+}
+// register a handler
+void registerSecHandler(const std::string& handler_type, 
+						LLPointer<LLSecAPIHandler>& handler)
+{
+	gHandlerMap[handler_type] = handler;
+}
+
+
+
+
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
new file mode 100644
index 0000000000..743d3d6770
--- /dev/null
+++ b/indra/newview/llsecapi.h
@@ -0,0 +1,232 @@
+/** 
+ * @file llsecapi.h
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LLSECAPI_H
+#define LLSECAPI_H
+#include <vector>
+#include <openssl/x509.h>
+
+// All error handling is via exceptions.
+
+
+#define CERT_SUBJECT_NAME "subject_name"
+#define CERT_ISSUER_NAME "issuer_name"
+		
+#define  CERT_SUBJECT_NAME_STRING "subject_name_string"
+#define CERT_ISSUER_NAME_STRING "issuer_name_string"
+		
+#define CERT_SERIAL_NUMBER "serial_number"
+		
+#define CERT_VALID_FROM "valid_from"
+#define CERT_VALID_TO "valid_to"
+#define CERT_SHA1_DIGEST "sha1_digest"
+#define CERT_MD5_DIGEST "md5_digest"
+
+#define BASIC_SECHANDLER "BASIC_SECHANDLER"
+
+
+// All error handling is via exceptions.
+
+class LLCertException
+{
+public:
+	LLCertException(const char* msg)
+	{
+		llerrs << "Certificate Error: " << msg << llendl;
+		mMsg = std::string(msg);
+	}
+protected:
+	std::string mMsg;
+};
+
+class LLProtectedDataException
+{
+public:
+	LLProtectedDataException(const char *msg) 
+	{
+		llerrs << "Certificate Error: " << msg << llendl;
+		mMsg = std::string(msg);
+	}
+protected:
+	std::string mMsg;
+};
+
+// class LLCertificate
+// parent class providing an interface for certifiate.
+// LLCertificates are considered unmodifiable
+// Certificates are pulled out of stores, or created via
+// factory calls
+class LLCertificate : public LLRefCount
+{
+	LOG_CLASS(LLCertificate);
+public:
+	LLCertificate() {}
+	
+	virtual ~LLCertificate() {}
+	
+	// return a PEM encoded certificate.  The encoding
+	// includes the -----BEGIN CERTIFICATE----- and end certificate elements
+	virtual std::string getPem()=0; 
+	
+	// return a DER encoded certificate
+	virtual std::vector<U8> getBinary()=0;  
+	
+	// return an LLSD object containing information about the certificate
+	// such as its name, signature, expiry time, serial number
+	virtual LLSD getLLSD()=0; 
+	
+	// return an openSSL X509 struct for the certificate
+	virtual X509* getOpenSSLX509()=0;
+
+};
+
+
+// class LLCertificateChain
+// Class representing a chain of certificates in order, with the 
+// 0th element being the CA
+class LLCertificateChain : public LLRefCount
+{
+	LOG_CLASS(LLCertificateChain);
+	static const int VT_SSL = 0;
+	static const int VT_AGENT_DOMAIN = 1;
+	static const int VT_GRID_DOMAIN = 1;
+	
+public:
+	LLCertificateChain() {}
+	
+	virtual ~LLCertificateChain() {}
+	
+	virtual X509_STORE getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
+	// for this store
+	
+	virtual void appendCert(const LLCertificate& cert)=0;  // append a cert to the end 
+	//of the chain
+	
+	virtual LLPointer<LLCertificate>& operator [](int index)=0; // retrieve a certificate 
+	// from the chain by index
+	// -1 == end of chain
+	
+	virtual int len() const =0;  // return number of certificates in the chain
+	
+	// validate a certificate chain given the params.
+	// validation type indicates whether it's simply an SSL cert, or 
+	// something more specific
+	virtual bool validate(int validation_type, 
+						  const LLSD& validation_params) const =0;
+};
+
+
+// class LLCertificateStore
+// represents a store of certificates, typically a store of root CA
+// certificates.  The store can be persisted, and can be used to validate
+// a cert chain
+//
+class LLCertificateStore : public LLRefCount
+{
+public:
+	LLCertificateStore() {}
+	virtual ~LLCertificateStore() {}
+	
+	virtual X509_STORE getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
+	// for this store
+	
+	// add a copy of a cert to the store
+	virtual void  append(const LLCertificate& cert)=0;
+	
+	// add a copy of a cert to the store
+	virtual void insert(const int index, const LLCertificate& cert)=0;
+	
+	// remove a certificate from the store
+	virtual void remove(int index)=0;
+	
+	// return a certificate at the index
+	virtual LLPointer<LLCertificate>& operator[](int index)=0;
+	// return the number of certs in the store
+	virtual int len() const =0;
+	
+	// load the store from a persisted location
+	virtual void load(const std::string& store_id)=0;
+	
+	// persist the store
+	virtual void save()=0;
+	
+	// return the store id
+	virtual std::string storeId()=0;
+	
+	// validate a cert chain
+	virtual bool validate(const LLCertificateChain& cert_chain) const=0;
+};
+
+
+// LLSecAPIHandler Class
+// Interface handler class for the various security storage handlers.
+class LLSecAPIHandler : public LLRefCount
+{
+public:
+	
+	LLSecAPIHandler() {}
+	virtual ~LLSecAPIHandler() {}
+	
+	// instantiate a certificate from a pem string
+	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
+	
+	
+	// instiate a certificate from an openssl X509 structure
+	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
+	
+	// instantiate a chain from an X509_STORE_CTX
+	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain)=0;
+	
+	// instantiate a cert store given it's id.  if a persisted version
+	// exists, it'll be loaded.  If not, one will be created (but not
+	// persisted)
+	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)=0;
+	
+	// persist data in a protected store
+	virtual void setProtectedData(const std::string& data_type,
+								  const std::string& data_id,
+								  const LLSD& data)=0;
+	
+	// retrieve protected data
+	virtual LLSD getProtectedData(const std::string& data_type,
+								  const std::string& data_id)=0;
+};
+
+void secHandlerInitialize();
+				
+// retrieve a security api depending on the api type
+LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
+
+void registerSecHandler(const std::string& handler_type, 
+						LLPointer<LLSecAPIHandler>& handler);
+
+#endif // LL_SECAPI_H
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
new file mode 100644
index 0000000000..ab6bf034f1
--- /dev/null
+++ b/indra/newview/llsechandler_basic.cpp
@@ -0,0 +1,490 @@
+/** 
+ * @file llsechandler_basic.cpp
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2003&license=viewergpl$
+ * 
+ * Copyright (c) 2003-2000, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+#include "llsecapi.h"
+#include "llsechandler_basic.h"
+#include "llsdserialize.h"
+#include "llfile.h"
+#include "lldir.h"
+#include <vector>
+#include <ios>
+#include <openssl/x509.h>
+#include <openssl/pem.h>
+#include <openssl/asn1.h>
+#include <openssl/rand.h>
+#include <iostream>
+#include <iomanip>
+#include <time.h>
+
+// 128 bits of salt data...
+#define STORE_SALT_SIZE 16 
+#define BUFFER_READ_SIZE 256
+
+
+LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert) 
+{
+	
+	// BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
+	// so we need to cast it.
+	BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
+	
+	mCert = NULL;
+	PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
+	BIO_free(pem_bio);
+	if (!mCert)
+	{
+		throw LLCertException("Error parsing certificate");
+	}
+}
+
+
+LLBasicCertificate::LLBasicCertificate(X509* pCert) 
+{
+	if (!pCert || !pCert->cert_info)
+	{
+		throw LLCertException("Invalid certificate");
+	}	
+	mCert = X509_dup(pCert);
+}
+
+LLBasicCertificate::~LLBasicCertificate() 
+{
+
+	X509_free(mCert);
+}
+
+//
+// retrieve the pem using the openssl functionality
+std::string LLBasicCertificate::getPem()
+{ 
+	char * pem_bio_chars = NULL;
+	// a BIO is the equivalent of a 'std::stream', and
+	// can be a file, mem stream, whatever.  Grab a memory based
+	// BIO for the result
+	BIO *pem_bio = BIO_new(BIO_s_mem());
+	if (!pem_bio)
+	{
+		throw LLCertException("couldn't allocate memory buffer");		
+	}
+	PEM_write_bio_X509(pem_bio, mCert);
+	int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
+	std::string result = std::string(pem_bio_chars, length);
+	BIO_free(pem_bio);
+	return result;
+}
+
+// get the DER encoding for the cert
+// DER is a binary encoding format for certs...
+std::vector<U8> LLBasicCertificate::getBinary()
+{ 
+	U8 * der_bio_data = NULL;
+	// get a memory bio 
+	BIO *der_bio = BIO_new(BIO_s_mem());
+	if (!der_bio)
+	{
+		throw LLCertException("couldn't allocate memory buffer");		
+	}
+	i2d_X509_bio(der_bio, mCert);
+	int length = BIO_get_mem_data(der_bio, &der_bio_data);
+	std::vector<U8> result(length);
+	// vectors are guranteed to be a contiguous chunk of memory.
+	memcpy(&result[0], der_bio_data,  length);
+	BIO_free(der_bio);
+	return result;
+}
+
+
+LLSD LLBasicCertificate::getLLSD()
+{ 
+	LLSD result;
+
+	// call the various helpers to build the LLSD
+	result[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
+	result[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
+	result[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
+	result[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
+	ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
+	if (sn != NULL)
+	{
+		result[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
+	}
+	
+	result[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
+	result[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
+	result[CERT_SHA1_DIGEST] = cert_get_digest("sha1", mCert);
+	result[CERT_MD5_DIGEST] = cert_get_digest("md5", mCert);
+
+
+
+	return result; 
+}
+
+X509* LLBasicCertificate::getOpenSSLX509()
+{ 
+	return X509_dup(mCert); 
+}  
+
+// generate a single string containing the subject or issuer
+// name of the cert.
+std::string cert_string_name_from_X509_NAME(X509_NAME* name)
+{
+	char * name_bio_chars = NULL;
+	// get a memory bio
+	BIO *name_bio = BIO_new(BIO_s_mem());
+	// stream the name into the bio.  The name will be in the 'short name' format
+	X509_NAME_print_ex(name_bio, name, 0, XN_FLAG_RFC2253);
+	int length = BIO_get_mem_data(name_bio, &name_bio_chars);
+	std::string result = std::string(name_bio_chars, length);
+	BIO_free(name_bio);
+	return result;
+}
+
+// generate an LLSD from a certificate name (issuer or subject name).  
+// the name will be strings indexed by the 'long form'
+LLSD cert_name_from_X509_NAME(X509_NAME* name)
+{
+	LLSD result = LLSD::emptyMap();
+	int name_entries = X509_NAME_entry_count(name);
+	for (int entry_index=0; entry_index < name_entries; entry_index++) 
+	{
+		char buffer[32];
+		X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index);
+		
+		std::string name_value = std::string((const char*)M_ASN1_STRING_data(X509_NAME_ENTRY_get_data(entry)), 
+											 M_ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry)));
+
+		ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry);		
+		OBJ_obj2txt(buffer, sizeof(buffer), name_obj, 0);
+		std::string obj_buffer_str = std::string(buffer);
+		result[obj_buffer_str] = name_value;
+	}
+	
+	return result;
+}
+
+// Generate a string from an ASN1 integer.  ASN1 Integers are
+// bignums, so they can be 'infinitely' long, therefore we
+// cannot simply use a conversion to U64 or something.
+// We retrieve as a readable string for UI
+
+std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
+{
+	BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
+	char * ascii_bn = BN_bn2hex(bn);
+
+	BN_free(bn);
+
+	std::string result(ascii_bn);
+	OPENSSL_free(ascii_bn);
+	return result;
+}
+
+// retrieve a date structure from an ASN1 time, for 
+// validity checking.
+LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
+{
+	
+	struct tm timestruct = {0};
+	int i = asn1_time->length;
+	
+	if (i < 10)
+		throw LLCertException("invalid certificate time value");
+	
+	// convert the date from the ASN1 time (which is a string in ZULU time), to
+	// a timeval.
+	timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
+	
+	/* Deal with Year 2000 */
+	if (timestruct.tm_year < 70)
+		timestruct.tm_year += 100;
+	
+	timestruct.tm_mon = (asn1_time->data[2]-'0') * 10 + (asn1_time->data[3]-'0') - 1;
+	timestruct.tm_mday = (asn1_time->data[4]-'0') * 10 + (asn1_time->data[5]-'0');
+	timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
+	timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
+	timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
+	
+	return LLDate((F64)mktime(&timestruct));
+}
+
+// Generate a string containing a digest.  The digest time is 'ssh1' or
+// 'md5', and the resulting string is of the form "aa:12:5c:' and so on
+std::string cert_get_digest(const std::string& digest_type, X509 *cert)
+{
+	unsigned char digest_data[1024];
+	unsigned int len = 1024;
+	std::stringstream result;
+	const EVP_MD* digest = NULL;
+	OpenSSL_add_all_digests();
+	// we could use EVP_get_digestbyname, but that requires initializer code which
+	// would require us to complicate things by plumbing it into the system.
+	if (digest_type == "md5")
+	{
+		digest = EVP_md5();
+	}
+	else if (digest_type == "sha1")
+	{
+		digest = EVP_sha1();
+	}
+	else
+	{
+		throw LLCertException("Invalid digest");
+	}
+
+	X509_digest(cert, digest, digest_data, &len);
+	result << std::hex << std::setprecision(2);
+	for (unsigned int i=0; i < len; i++)
+	{
+		if (i != 0) 
+		{
+			result << ":";
+		}
+		result  << std::setfill('0') << std::setw(2) << (int)digest_data[i];
+	}
+	return result.str();
+}
+
+
+// LLSecAPIBasicHandler Class
+// Interface handler class for the various security storage handlers.
+
+// We read the file on construction, and write it on destruction.  This
+// means multiple processes cannot modify the datastore.
+LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file)
+{
+	mProtectedDataFilename = protected_data_file;
+	mProtectedDataMap = LLSD::emptyMap();
+	_readProtectedData();
+}
+
+LLSecAPIBasicHandler::LLSecAPIBasicHandler()
+{
+	std::string mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+														  "bin_conf.dat");
+
+	mProtectedDataMap = LLSD::emptyMap();
+	_readProtectedData();
+}
+
+LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
+{
+	_writeProtectedData();
+}
+
+void LLSecAPIBasicHandler::_readProtectedData()
+{	
+	// attempt to load the file into our map
+	LLPointer<LLSDParser> parser = new LLSDXMLParser();
+	
+	llifstream protected_data_stream(mProtectedDataFilename.c_str(), 
+									llifstream::binary);
+	if (!protected_data_stream.fail()) {
+		int offset;
+		U8 salt[STORE_SALT_SIZE];
+		U8 buffer[BUFFER_READ_SIZE];
+		U8 decrypted_buffer[BUFFER_READ_SIZE];
+		int decrypted_length;		
+		
+
+		// read in the salt and key
+		protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
+		offset = 0;
+		if (protected_data_stream.gcount() < STORE_SALT_SIZE)
+		{
+			throw LLProtectedDataException("Corrupt Protected Data Store");
+		}
+		
+		// totally lame.  As we're not using the OS level protected data, we need to
+		// at least obfuscate the data.  We do this by using a salt stored at the head of the file
+		// to encrypt the data, therefore obfuscating it from someone using simple existing tools.
+		// It would be better to use the password, but as this store
+		// will be used to store the SL password when the user decides to have SL remember it, 
+		// so we can't use that.  OS-dependent store implementations will use the OS password/storage 
+		// mechanisms and are considered to be more secure.
+		// We've a strong intent to move to OS dependent protected data stores.
+		
+
+		// read in the rest of the file.
+		EVP_CIPHER_CTX ctx;
+		EVP_CIPHER_CTX_init(&ctx);
+		EVP_DecryptInit(&ctx, EVP_rc4(), salt, NULL);
+		// allocate memory:
+		std::string decrypted_data;	
+		
+		while(protected_data_stream.good()) {
+			// read data as a block:
+			protected_data_stream.read((char *)buffer, BUFFER_READ_SIZE);
+			
+			EVP_DecryptUpdate(&ctx, decrypted_buffer, &decrypted_length, 
+							  buffer, protected_data_stream.gcount());
+			decrypted_data.append((const char *)decrypted_buffer, protected_data_stream.gcount());
+		}
+		
+		// RC4 is a stream cipher, so we don't bother to EVP_DecryptFinal, as there is
+		// no block padding.
+		EVP_CIPHER_CTX_cleanup(&ctx);
+		std::istringstream parse_stream(decrypted_data);
+		if (parser->parse(parse_stream, mProtectedDataMap, 
+						  LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
+		{
+			throw LLProtectedDataException("Corrupt Protected Data Store");
+		}
+	}
+}
+
+void LLSecAPIBasicHandler::_writeProtectedData()
+{	
+	std::ostringstream formatted_data_ostream;
+	U8 salt[STORE_SALT_SIZE];
+	U8 buffer[BUFFER_READ_SIZE];
+	U8 encrypted_buffer[BUFFER_READ_SIZE];
+	
+	if(mProtectedDataMap.isUndefined())
+	{
+		LLFile::remove(mProtectedDataFilename);
+		return;
+	}
+	// create a string with the formatted data.
+	LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
+	
+	std::istringstream formatted_data_istream(formatted_data_ostream.str());
+	// generate the seed
+	RAND_bytes(salt, STORE_SALT_SIZE);
+	
+	// write to a temp file so we don't clobber the initial file if there is
+	// an error.
+	std::string tmp_filename = mProtectedDataFilename + ".tmp";
+	
+	llofstream protected_data_stream(tmp_filename.c_str(), 
+										llofstream::binary);
+	try
+	{
+		
+		EVP_CIPHER_CTX ctx;
+		EVP_CIPHER_CTX_init(&ctx);
+		EVP_EncryptInit(&ctx, EVP_rc4(), salt, NULL);
+		protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);	
+		while (formatted_data_istream.good())
+		{
+			formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
+			if(formatted_data_istream.gcount() == 0)
+			{
+				break;
+			}
+			int encrypted_length;
+			EVP_EncryptUpdate(&ctx, encrypted_buffer, &encrypted_length, 
+						  buffer, formatted_data_istream.gcount());
+			protected_data_stream.write((const char *)encrypted_buffer, encrypted_length);
+		}
+		
+		// no EVP_EncrypteFinal, as this is a stream cipher
+		EVP_CIPHER_CTX_cleanup(&ctx);
+
+		protected_data_stream.close();
+	}
+	catch (...)
+	{
+		// it's good practice to clean up any secure information on error
+		// (even though this file isn't really secure.  Perhaps in the future
+		// it may be, however.
+		LLFile::remove(tmp_filename);
+		throw LLProtectedDataException("Error writing Protected Data Store");
+	}
+
+	// move the temporary file to the specified file location.
+	if((LLFile::remove(mProtectedDataFilename) != 0) || 
+	   (LLFile::rename(tmp_filename, mProtectedDataFilename)))
+	{
+		LLFile::remove(tmp_filename);
+		throw LLProtectedDataException("Could not overwrite protected data store");
+	}
+}
+		
+// instantiate a certificate from a pem string
+LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert)
+{
+	LLPointer<LLCertificate> result = new LLBasicCertificate(pem_cert);
+	return result;
+}
+		
+
+		
+// instiate a certificate from an openssl X509 structure
+LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert)
+{
+	LLPointer<LLCertificate> result = new LLBasicCertificate(openssl_cert);
+	return result;		
+}
+		
+// instantiate a chain from an X509_STORE_CTX
+LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain)
+{
+	LLPointer<LLCertificateChain> result = NULL;
+	return result;
+}
+		
+// instantiate a cert store given it's id.  if a persisted version
+// exists, it'll be loaded.  If not, one will be created (but not
+// persisted)
+LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id)
+{
+	LLPointer<LLCertificateStore> result;
+	return result;
+}
+		
+// retrieve protected data
+LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
+											const std::string& data_id)
+{
+	if (mProtectedDataMap.has(data_type) && 
+		mProtectedDataMap[data_type].isMap() && 
+		mProtectedDataMap[data_type].has(data_id))
+	{
+		return mProtectedDataMap[data_type][data_id];
+	}
+																				
+	return LLSD();
+}
+
+// persist data in a protected store
+void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type,
+									  const std::string& data_id,
+									  const LLSD& data)
+{
+	if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
+		mProtectedDataMap[data_type] = LLSD::emptyMap();
+	}
+	
+	mProtectedDataMap[data_type][data_id] = data; 
+}
\ No newline at end of file
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
new file mode 100644
index 0000000000..0ec6938583
--- /dev/null
+++ b/indra/newview/llsechandler_basic.h
@@ -0,0 +1,116 @@
+/** 
+ * @file llsechandler_basic.h
+ * @brief Security API for services such as certificate handling
+ * secure local storage, etc.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LLSECHANDLER_BASIC
+#define LLSECHANDLER_BASIC
+
+#include "llsecapi.h"
+#include <vector>
+#include <openssl/x509.h>
+
+// helpers
+extern LLSD cert_name_from_X509_NAME(X509_NAME* name);
+extern std::string cert_string_name_from_X509_NAME(X509_NAME* name);
+extern std::string cert_string_from_asn1_integer(ASN1_INTEGER* value);
+extern LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time);
+extern std::string cert_get_digest(const std::string& digest_type, X509 *cert);
+
+
+// class LLCertificate
+// 
+class LLBasicCertificate : public LLCertificate
+{
+public:		
+	LOG_CLASS(LLBasicCertificate);
+
+	LLBasicCertificate(const std::string& pem_cert);
+	LLBasicCertificate(X509* openSSLX509);
+	
+	virtual ~LLBasicCertificate();
+	
+	virtual std::string getPem();
+	virtual std::vector<U8> getBinary();
+	virtual LLSD getLLSD();
+
+	virtual X509* getOpenSSLX509();
+protected:
+	// certificates are stored as X509 objects, as validation and
+	// other functionality is via openssl
+	X509* mCert;
+};
+
+// LLSecAPIBasicHandler Class
+// Interface handler class for the various security storage handlers.
+class LLSecAPIBasicHandler : public LLSecAPIHandler
+{
+public:
+	
+	LLSecAPIBasicHandler(const std::string& protected_data_filename);
+	LLSecAPIBasicHandler();
+	
+	virtual ~LLSecAPIBasicHandler();
+	
+	// instantiate a certificate from a pem string
+	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert);
+	
+	
+	// instiate a certificate from an openssl X509 structure
+	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert);
+	
+	// instantiate a chain from an X509_STORE_CTX
+	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain);
+	
+	// instantiate a cert store given it's id.  if a persisted version
+	// exists, it'll be loaded.  If not, one will be created (but not
+	// persisted)
+	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id);
+	
+	// persist data in a protected store
+	virtual void setProtectedData(const std::string& data_type,
+								  const std::string& data_id,
+								  const LLSD& data);
+	
+	// retrieve protected data
+	virtual LLSD getProtectedData(const std::string& data_type,
+								  const std::string& data_id);
+protected:
+	void _readProtectedData();
+	void _writeProtectedData();
+	
+	std::string mProtectedDataFilename;
+	LLSD mProtectedDataMap;
+};
+
+#endif // LLSECHANDLER_BASIC
+
+
+
-- 
cgit v1.2.3


From fe71dd340ab396b93bde45df438041af5d85fd47 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 1 Feb 2010 15:10:19 -0800
Subject: Merge giab-viewer-trunk 2497, general merge of more secapi stuff as
 well as certificate handling stuff. Grid manager as well

---
 indra/llmessage/llares.cpp                         |   1 +
 indra/llvfs/lldir.cpp                              |  39 +-
 indra/llvfs/lldir.h                                |   4 +-
 indra/newview/CMakeLists.txt                       |  18 +-
 indra/newview/app_settings/logcontrol.xml          |   8 +-
 indra/newview/app_settings/settings.xml            |  24 +-
 indra/newview/llappviewer.cpp                      |  54 +-
 indra/newview/llappviewer.h                        |   1 -
 indra/newview/llcurrencyuimanager.cpp              |   2 +-
 indra/newview/llfloaterbuyland.cpp                 |   2 +-
 indra/newview/llfloaterreporter.cpp                |   2 +-
 indra/newview/llloginhandler.cpp                   | 196 +++---
 indra/newview/llloginhandler.h                     |  11 +-
 indra/newview/lllogininstance.cpp                  |  27 +-
 indra/newview/lllogininstance.h                    |   7 +-
 indra/newview/llpanellogin.cpp                     | 314 +++++-----
 indra/newview/llpanellogin.h                       |  14 +-
 indra/newview/llsecapi.cpp                         |  32 +-
 indra/newview/llsecapi.h                           |  68 +-
 indra/newview/llsechandler_basic.cpp               | 284 ++++++++-
 indra/newview/llsechandler_basic.h                 |  80 ++-
 indra/newview/llstartup.cpp                        | 351 +++--------
 indra/newview/llstartup.h                          |   8 -
 indra/newview/llviewermenu.cpp                     |  16 +-
 indra/newview/llviewernetwork.cpp                  | 683 ++++++++++++++-------
 indra/newview/llviewernetwork.h                    | 181 ++++--
 indra/newview/llviewerobject.cpp                   |  12 +-
 indra/newview/llviewerstats.cpp                    |   6 +-
 indra/newview/llviewerwindow.cpp                   |   8 +-
 indra/newview/llvoiceclient.cpp                    |  13 +-
 indra/newview/llvoiceclient.h                      |   6 +-
 indra/newview/llweb.cpp                            |   2 +-
 indra/newview/skins/default/xui/en/panel_login.xml |  55 +-
 indra/newview/tests/lllogininstance_test.cpp       | 107 +++-
 indra/newview/tests/llsechandler_basic_test.cpp    | 456 ++++++++++++++
 indra/newview/tests/llviewernetwork_test.cpp       | 446 ++++++++++++++
 indra/viewer_components/login/lllogin.cpp          |  37 +-
 37 files changed, 2479 insertions(+), 1096 deletions(-)
 create mode 100644 indra/newview/tests/llsechandler_basic_test.cpp
 create mode 100644 indra/newview/tests/llviewernetwork_test.cpp

(limited to 'indra')

diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index 104629c157..db7ac2f154 100644
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -171,6 +171,7 @@ void LLAres::rewriteURI(const std::string &uri, UriRewriteResponder *resp)
 	resp->mUri = LLURI(uri);
 	search("_" + resp->mUri.scheme() + "._tcp." + resp->mUri.hostName(),
 		   RES_SRV, resp);
+	llinfos << "Rewritten " << uri << llendl;
 }
 
 LLQueryResponder::LLQueryResponder()
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index b2b17fdd56..296d827a20 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -555,26 +555,23 @@ std::string LLDir::getForbiddenFileChars()
 	return "\\/:*?\"<>|";
 }
 
-void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
+void LLDir::setLindenUserDir(const std::string &username)
 {
 	// if both first and last aren't set, assume we're grabbing the cached dir
-	if (!first.empty() && !last.empty())
+	if (!username.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string firstlower(first);
-		LLStringUtil::toLower(firstlower);
-		std::string lastlower(last);
-		LLStringUtil::toLower(lastlower);
+		std::string userlower(username);
+		LLStringUtil::toLower(userlower);
+		LLStringUtil::replaceChar(userlower, ' ', '_');
 		mLindenUserDir = getOSUserAppDir();
 		mLindenUserDir += mDirDelimiter;
-		mLindenUserDir += firstlower;
-		mLindenUserDir += "_";
-		mLindenUserDir += lastlower;
+		mLindenUserDir += userlower;
 	}
 	else
 	{
-		llerrs << "Invalid name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
+		llerrs << "NULL name for LLDir::setLindenUserDir" << llendl;
 	}
 
 	dumpCurrentDirectories();	
@@ -592,27 +589,25 @@ void LLDir::setChatLogsDir(const std::string &path)
 	}
 }
 
-void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last)
+void LLDir::setPerAccountChatLogsDir(const std::string &username)
 {
 	// if both first and last aren't set, assume we're grabbing the cached dir
-	if (!first.empty() && !last.empty())
+	if (!username.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string firstlower(first);
-		LLStringUtil::toLower(firstlower);
-		std::string lastlower(last);
-		LLStringUtil::toLower(lastlower);
-		mPerAccountChatLogsDir = getChatLogsDir();
-		mPerAccountChatLogsDir += mDirDelimiter;
-		mPerAccountChatLogsDir += firstlower;
-		mPerAccountChatLogsDir += "_";
-		mPerAccountChatLogsDir += lastlower;
+		std::string userlower(username);
+		LLStringUtil::toLower(userlower);
+		LLStringUtil::replaceChar(userlower, ' ', '_');
+		mLindenUserDir = getChatLogsDir();
+		mLindenUserDir += mDirDelimiter;
+		mLindenUserDir += userlower;
 	}
 	else
 	{
-		llwarns << "Invalid name for LLDir::setPerAccountChatLogsDir" << llendl;
+		llerrs << "NULL name for LLDir::setPerAccountChatLogsDir" << llendl;
 	}
+	
 }
 
 void LLDir::setSkinFolder(const std::string &skin_folder)
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 206e3223e3..9c1e992eca 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -137,8 +137,8 @@ class LLDir
 	static std::string getForbiddenFileChars();
 
 	virtual void setChatLogsDir(const std::string &path);		// Set the chat logs dir to this user's dir
-	virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);		// Set the per user chat log directory.
-	virtual void setLindenUserDir(const std::string &first, const std::string &last);		// Set the linden user dir to this user's dir
+	virtual void setPerAccountChatLogsDir(const std::string &username);		// Set the per user chat log directory.
+	virtual void setLindenUserDir(const std::string &username);		// Set the linden user dir to this user's dir
 	virtual void setSkinFolder(const std::string &skin_folder);
 	virtual bool setCacheDir(const std::string &path);
 
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 9430bb1d56..4be6fb940e 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1407,11 +1407,11 @@ if (WINDOWS)
       # Note the need to specify multiple names explicitly.
       set(GOOGLE_PERF_TOOLS_SOURCE
         ${SHARED_LIB_STAGING_DIR}/Release/libtcmalloc_minimal.dll
-	${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
-	${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
-	)
-    endif(USE_GOOGLE_PERFTOOLS)
-	  
+        ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
+        ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
+        )
+     endif(USE_GOOGLE_PERFTOOLS)
+ 
 
     set(COPY_INPUT_DEPENDECIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
@@ -1504,11 +1504,11 @@ if (WINDOWS)
         --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
         --grid=${GRID}
         --source=${CMAKE_CURRENT_SOURCE_DIR}
-	--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
+        --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
       DEPENDS 
-	${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-	stage_third_party_libs
-	${COPY_INPUT_DEPENDECIES}
+        ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+        stage_third_party_libs
+        ${COPY_INPUT_DEPENDECIES}
       COMMENT "Performing viewer_manifest copy"
       )
     
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index d7bb64ce8a..0eb98e3311 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -20,11 +20,7 @@
 					<key>tags</key>
 						<array>
 							<string>AppInit</string>
-							<string>SystemInfo</string>
-							<string>TextureCache</string>
-							<string>AppCache</string>
-							<string>Window</string>
-							<string>RenderInit</string>
+							<string>LLLogin</string>
 						</array>
 				</map>
 				<map>
@@ -40,6 +36,8 @@
 						</array>
 					<key>tags</key>
 						<array>
+							<string>AppInit</string>
+							<string>LLLogin</string>
 						</array>
 				</map>
 			</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 7d98a4b6ce..75ee389750 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1629,6 +1629,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>CurrentGrid</key>
+    <map>
+      <key>Comment</key>
+      <string>Currently Selected Grid</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string></string>
+    </map>
     <key>CustomServer</key>
     <map>
       <key>Comment</key>
@@ -3420,7 +3431,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>ForceMandatoryUpdate</key>
     <map>
@@ -7594,6 +7605,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>SecondLifeEnterprise</key>
+    <map>
+      <key>Comment</key>
+      <string>Enables Second Life Enterprise features</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>	
     <key>SelectMovableOnly</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index fb1bded795..cc32346441 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -191,6 +191,9 @@
 #include "llparcel.h"
 #include "llavatariconctrl.h"
 
+// Include for security api initialization
+#include "llsecapi.h"
+
 // *FIX: These extern globals should be cleaned up.
 // The globals either represent state/config/resource-storage of either 
 // this app, or another 'component' of the viewer. App globals should be 
@@ -506,35 +509,6 @@ public:
 	}
 };
 
-void LLAppViewer::initGridChoice()
-{
-	// Load	up the initial grid	choice from:
-	//	- hard coded defaults...
-	//	- command line settings...
-	//	- if dev build,	persisted settings...
-
-	// Set the "grid choice", this is specified	by command line.
-	std::string	grid_choice	= gSavedSettings.getString("CmdLineGridChoice");
-	LLViewerLogin::getInstance()->setGridChoice(grid_choice);
-
-	// Load last server choice by default 
-	// ignored if the command line grid	choice has been	set
-	if(grid_choice.empty())
-	{
-		S32	server = gSavedSettings.getS32("ServerChoice");
-		server = llclamp(server, 0,	(S32)GRID_INFO_COUNT - 1);
-		if(server == GRID_INFO_OTHER)
-		{
-			std::string custom_server = gSavedSettings.getString("CustomServer");
-			LLViewerLogin::getInstance()->setGridChoice(custom_server);
-		}
-		else if(server != (S32)GRID_INFO_NONE)
-		{
-			LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
-		}
-	}
-}
-
 //virtual
 bool LLAppViewer::initSLURLHandler()
 {
@@ -646,7 +620,7 @@ bool LLAppViewer::init()
     LLCurl::initClass();
 
     initThreads();
-
+    initializeSecHandler();
     writeSystemInfo();
 
 	// Build a string representing the current version number.
@@ -776,10 +750,6 @@ bool LLAppViewer::init()
 		return false;
 	}
 
-	// Always fetch the Ethernet MAC address, needed both for login
-	// and password load.
-	LLUUID::getNodeID(gMACAddress);
-
 	// Prepare for out-of-memory situations, during which we will crash on
 	// purpose and save a dump.
 #if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
@@ -1462,13 +1432,6 @@ bool LLAppViewer::cleanup()
 
 	llinfos << "Saving Data" << llendflush;
 	
-	// Quitting with "Remember Password" turned off should always stomp your
-	// saved password, whether or not you successfully logged in.  JC
-	if (!gSavedSettings.getBOOL("RememberPassword"))
-	{
-		LLStartUp::deletePasswordFromDisk();
-	}
-	
 	// Store the time of our current logoff
 	gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
 
@@ -2022,7 +1985,6 @@ bool LLAppViewer::initConfiguration()
         }
     }
 
-    initGridChoice();
 
 	// If we have specified crash on startup, set the global so we'll trigger the crash at the right time
 	if(clp.hasOption("crashonstartup"))
@@ -2511,7 +2473,7 @@ void LLAppViewer::writeSystemInfo()
 
 	// The user is not logged on yet, but record the current grid choice login url
 	// which may have been the intended grid. This can b
-	gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
+	gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
 
 	// *FIX:Mani - move this ddown in llappviewerwin32
 #ifdef LL_WINDOWS
@@ -2678,10 +2640,10 @@ void LLAppViewer::handleViewerCrash()
 		gMessageSystem->stopLogging();
 	}
 
-	LLWorld::getInstance()->getInfo(gDebugInfo);
+	//LLWorld::getInstance()->getInfo(gDebugInfo);
 
 	// Close the debug file
-	pApp->writeDebugInfo();
+	//pApp->writeDebugInfo();
 
 	LLError::logToFile("");
 
@@ -4271,7 +4233,7 @@ void LLAppViewer::launchUpdater()
 #endif
 	// *TODO change userserver to be grid on both viewer and sim, since
 	// userserver no longer exists.
-	query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
+	query_map["userserver"] = LLGridManager::getInstance()->getGridLabel();
 	query_map["channel"] = gSavedSettings.getString("VersionChannelName");
 	// *TODO constantize this guy
 	// *NOTE: This URL is also used in win_setup/lldownloader.cpp
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 40e74061b5..870d47aa79 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -186,7 +186,6 @@ private:
 
 	bool initThreads(); // Initialize viewer threads, return false on failure.
 	bool initConfiguration(); // Initialize settings from the command line/config file.
-	void initGridChoice();
 
 	bool initCache(); // Initialize local client cache.
 
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index 00c05445e1..207270c0ad 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -284,7 +284,7 @@ void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
 	static std::string transactionURI;
 	if (transactionURI.empty())
 	{
-		transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php";
+		transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
 	}
 
 	delete mTransaction;
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 9b88923e7e..10a4908f3a 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -837,7 +837,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCVa
 	static std::string transaction_uri;
 	if (transaction_uri.empty())
 	{
-		transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php";
+		transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
 	}
 	
 	const char* method;
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index e0f2fca580..a52fe131cd 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -545,7 +545,7 @@ LLSD LLFloaterReporter::gatherReport()
 	mCopyrightWarningSeen = FALSE;
 
 	std::ostringstream summary;
-	if (!LLViewerLogin::getInstance()->isInProductionGrid())
+	if (!LLGridManager::getInstance()->isInProductionGrid())
 	{
 		summary << "Preview ";
 	}
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 1be3430e07..7d43f6a8cc 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -35,12 +35,13 @@
 #include "llloginhandler.h"
 
 // viewer includes
+#include "llsecapi.h"
 #include "llpanellogin.h"			// save_password_to_disk()
 #include "llstartup.h"				// getStartupState()
 #include "llurlsimstring.h"
 #include "llviewercontrol.h"		// gSavedSettings
 #include "llviewernetwork.h"		// EGridInfo
-#include "llviewerwindow.h"			// getWindow()
+#include "llviewerwindow.h"                    // getWindow()
 
 // library includes
 #include "llmd5.h"
@@ -59,109 +60,28 @@ bool LLLoginHandler::parseDirectLogin(std::string url)
 	LLURI uri(url);
 	parse(uri.queryMap());
 
-	if (/*mWebLoginKey.isNull() ||*/
-		mFirstName.empty() ||
-		mLastName.empty())
-	{
-		return false;
-	}
-	else
-	{
-		return true;
-	}
+	// NOTE: Need to add direct login as per identity evolution
+	return true;
 }
 
-
 void LLLoginHandler::parse(const LLSD& queryMap)
 {
-	//mWebLoginKey = queryMap["web_login_key"].asUUID();
-	mFirstName = queryMap["first_name"].asString();
-	mLastName = queryMap["last_name"].asString();
 	
-	EGridInfo grid_choice = GRID_INFO_NONE;
-	if (queryMap["grid"].asString() == "aditi")
-	{
-		grid_choice = GRID_INFO_ADITI;
-	}
-	else if (queryMap["grid"].asString() == "agni")
-	{
-		grid_choice = GRID_INFO_AGNI;
-	}
-	else if (queryMap["grid"].asString() == "siva")
-	{
-		grid_choice = GRID_INFO_SIVA;
-	}
-	else if (queryMap["grid"].asString() == "damballah")
-	{
-		grid_choice = GRID_INFO_DAMBALLAH;
-	}
-	else if (queryMap["grid"].asString() == "durga")
+	if (queryMap.has("grid"))
 	{
-		grid_choice = GRID_INFO_DURGA;
+		LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
 	}
-	else if (queryMap["grid"].asString() == "shakti")
-	{
-		grid_choice = GRID_INFO_SHAKTI;
-	}
-	else if (queryMap["grid"].asString() == "soma")
-	{
-		grid_choice = GRID_INFO_SOMA;
-	}
-	else if (queryMap["grid"].asString() == "ganga")
-	{
-		grid_choice = GRID_INFO_GANGA;
-	}
-	else if (queryMap["grid"].asString() == "vaak")
-	{
-		grid_choice = GRID_INFO_VAAK;
-	}
-	else if (queryMap["grid"].asString() == "uma")
-	{
-		grid_choice = GRID_INFO_UMA;
-	}
-	else if (queryMap["grid"].asString() == "mohini")
-	{
-		grid_choice = GRID_INFO_MOHINI;
-	}
-	else if (queryMap["grid"].asString() == "yami")
-	{
-		grid_choice = GRID_INFO_YAMI;
-	}
-	else if (queryMap["grid"].asString() == "nandi")
-	{
-		grid_choice = GRID_INFO_NANDI;
-	}
-	else if (queryMap["grid"].asString() == "mitra")
-	{
-		grid_choice = GRID_INFO_MITRA;
-	}
-	else if (queryMap["grid"].asString() == "radha")
-	{
-		grid_choice = GRID_INFO_RADHA;
-	}
-	else if (queryMap["grid"].asString() == "ravi")
-	{
-		grid_choice = GRID_INFO_RAVI;
-	}
-	else if (queryMap["grid"].asString() == "aruna")
-	{
-		grid_choice = GRID_INFO_ARUNA;
-	}
-
-	if(grid_choice != GRID_INFO_NONE)
-	{
-		LLViewerLogin::getInstance()->setGridChoice(grid_choice);
-	}
-
+	
+	
 	std::string startLocation = queryMap["location"].asString();
-
+	
 	if (startLocation == "specify")
 	{
-		LLURLSimString::setString(queryMap["region"].asString());
+	  LLURLSimString::setString(queryMap["region"].asString());
 	}
-	else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out)
+	else if (!startLocation.empty())
 	{
-		LLURLSimString::setString(startLocation);
+	  LLURLSimString::setString(startLocation);
 	}
 }
 
@@ -212,40 +132,68 @@ bool LLLoginHandler::handle(const LLSD& tokens,
 		return true;
 	}
 	
-	std::string password = query_map["password"].asString();
-
-	if (!password.empty())
+	if  (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page         
 	{
-		gSavedSettings.setBOOL("RememberPassword", TRUE);
-
-		if (password.substr(0,3) != "$1$")
-		{
-			LLMD5 pass((unsigned char*)password.c_str());
-			char md5pass[33];		/* Flawfinder: ignore */
-			pass.hex_digest(md5pass);
-			std::string hashed_password = ll_safe_string(md5pass, 32);
-			LLStartUp::savePasswordToDisk(hashed_password);
-		}
+	  // as the login page may change from grid to grid, as well as
+	  // things like username/password/etc, we simply refresh the
+	  // login page to make sure everything is set up correctly
+	  LLPanelLogin::loadLoginPage();
+	  LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
 	}
-			
+	return true;
+}
+
+
 
-	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page
+//  Initialize the credentials                                                                                              
+// If the passed in URL contains login info, parse                                                                          
+// that into a credential and web login key.  Otherwise                                                                     
+// check the command line.  If the command line                                                                             
+// does not contain any login creds, load the last saved                                                                    
+// ones from the protected credential store.                                                                                
+// This always returns with a credential structure set in the                                                               
+// login handler                                                                                                            
+LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo(const std::string& url)                                         
+{                                                                                                                           
+	LLURI uri(url);                                                                                                      
+	LLPointer<LLCredential> result = NULL;                                                                               
+	parse(uri.queryMap());                                                                                               
+	// we weren't able to parse login info from the slurl,                                                               
+	// so try to load it from the UserLoginInfo                                                                          
+	result = loadSavedUserLoginInfo();                                                                                   
+	if (result.isNull())                                                                                                 
+	{                                                                                                                    
+		result =  gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGridName());                       
+	}                                                                                                                    
+	
+	return result;                                                                                                       
+} 
+
+
+LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
+{
+  // load the saved user login info into a LLCredential.
+  // perhaps this should be moved.
+	LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
+	if (cmd_line_login.size() == 3) 
 	{
-		if (!mFirstName.empty() || !mLastName.empty())
-		{
-			// Fill in the name, and maybe the password
-			LLPanelLogin::setFields(mFirstName, mLastName, password);
-		}
-
-		//if (mWebLoginKey.isNull())
-		//{
-		//	LLPanelLogin::loadLoginPage();
-		//}
-		//else
-		//{
-		//	LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-		//}
-		LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-	}
-	return true;
+	
+		LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
+		char md5pass[33];               /* Flawfinder: ignore */
+		pass.hex_digest(md5pass);
+		LLSD identifier = LLSD::emptyMap();
+		identifier["type"] = "agent";
+		identifier["first_name"] = cmd_line_login[0];
+		identifier["last_name"] = cmd_line_login[1];
+		
+		LLSD authenticator = LLSD::emptyMap();
+		authenticator["type"] = "hash";
+		authenticator["algorithm"] = "md5";
+		authenticator["secret"] = md5pass;
+		// yuck, we'll fix this with mani's changes.
+		gSavedSettings.setBOOL("AutoLogin", TRUE);
+		return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGridName(), 
+													   identifier, authenticator);
+	}
+	return NULL;
 }
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index ac4648761b..ec2459c835 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -34,6 +34,7 @@
 #define LLLOGINHANDLER_H
 
 #include "llcommandhandler.h"
+#include "llsecapi.h"
 
 class LLLoginHandler : public LLCommandHandler
 {
@@ -46,19 +47,15 @@ class LLLoginHandler : public LLCommandHandler
 	// secondlife:///app/login?first=Bob&last=Dobbs
 	bool parseDirectLogin(std::string url);
 
-	std::string getFirstName() const { return mFirstName; }
-	std::string getLastName() const { return mLastName; }
-
 	// Web-based login unsupported
 	//LLUUID getWebLoginKey() const { return mWebLoginKey; }
 
+	LLPointer<LLCredential> loadSavedUserLoginInfo();  
+	LLPointer<LLCredential> initializeLoginInfo(const std::string& url);
+
 private:
 	void parse(const LLSD& queryMap);
 
-private:
-	std::string mFirstName;
-	std::string mLastName;
-	//LLUUID mWebLoginKey;
 };
 
 extern LLLoginHandler gLoginHandler;
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 24c72c65ce..bb45cc93ea 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -55,6 +55,7 @@
 #if LL_LINUX || LL_SOLARIS
 #include "lltrans.h"
 #endif
+#include "llsecapi.h"
 
 static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
 static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
@@ -83,14 +84,14 @@ LLLoginInstance::~LLLoginInstance()
 {
 }
 
-void LLLoginInstance::connect(const LLSD& credentials)
+void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
 {
 	std::vector<std::string> uris;
-	LLViewerLogin::getInstance()->getLoginURIs(uris);
+	LLGridManager::getInstance()->getLoginURIs(uris);
 	connect(uris.front(), credentials);
 }
 
-void LLLoginInstance::connect(const std::string& uri, const LLSD& credentials)
+void LLLoginInstance::connect(const std::string& uri, LLPointer<LLCredential> credentials)
 {
 	mAttemptComplete = false; // Reset attempt complete at this point!
 	constructAuthParams(credentials);
@@ -102,7 +103,7 @@ void LLLoginInstance::reconnect()
 	// Sort of like connect, only using the pre-existing
 	// request params.
 	std::vector<std::string> uris;
-	LLViewerLogin::getInstance()->getLoginURIs(uris);
+	LLGridManager::getInstance()->getLoginURIs(uris);
 	mLoginModule->connect(uris.front(), mRequestData);
 }
 
@@ -118,7 +119,7 @@ LLSD LLLoginInstance::getResponse()
 	return mResponseData; 
 }
 
-void LLLoginInstance::constructAuthParams(const LLSD& credentials)
+void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credential)
 {
 	// Set up auth request options.
 //#define LL_MINIMIAL_REQUESTED_OPTIONS
@@ -155,20 +156,18 @@ void LLLoginInstance::constructAuthParams(const LLSD& credentials)
 		gSavedSettings.setBOOL("UseDebugMenus", TRUE);
 		requested_options.append("god-connect");
 	}
+	
+	// (re)initialize the request params with creds.
+	LLSD request_params = user_credential->getLoginParams();
 
 	char hashed_mac_string[MD5HEX_STR_SIZE];		/* Flawfinder: ignore */
 	LLMD5 hashed_mac;
-	hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
+	unsigned char MACAddress[MAC_ADDRESS_BYTES];
+	LLUUID::getNodeID(MACAddress);	
+	hashed_mac.update( MACAddress, MAC_ADDRESS_BYTES );
 	hashed_mac.finalize();
 	hashed_mac.hex_digest(hashed_mac_string);
-
-	// prepend "$1$" to the password to indicate its the md5'd version.
-	std::string dpasswd("$1$");
-	dpasswd.append(credentials["passwd"].asString());
-
-	// (re)initialize the request params with creds.
-	LLSD request_params(credentials);
-	request_params["passwd"] = dpasswd;
+	
 	request_params["start"] = construct_start_string();
 	request_params["skipoptional"] = mSkipOptionalUpdate;
 	request_params["agree_to_tos"] = false; // Always false here. Set true in 
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index c8704eddb4..44271bb75e 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -36,6 +36,7 @@
 #include "lleventdispatcher.h"
 #include <boost/scoped_ptr.hpp>
 #include <boost/function.hpp>
+#include "llsecapi.h"
 class LLLogin;
 class LLEventStream;
 class LLNotificationsInterface;
@@ -48,8 +49,8 @@ public:
 	LLLoginInstance();
 	~LLLoginInstance();
 
-	void connect(const LLSD& credential); // Connect to the current grid choice.
-	void connect(const std::string& uri, const LLSD& credential);	// Connect to the given uri.
+	void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
+	void connect(const std::string& uri, LLPointer<LLCredential> credentials);	// Connect to the given uri.
 	void reconnect(); // reconnect using the current credentials.
 	void disconnect();
 
@@ -81,7 +82,7 @@ public:
 	void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; }
 
 private:
-	void constructAuthParams(const LLSD& credentials); 
+	void constructAuthParams(LLPointer<LLCredential> user_credentials);
 	void updateApp(bool mandatory, const std::string& message);
 	bool updateDialogCallback(const LLSD& notification, const LLSD& response);
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 87d101b00f..6978d05389 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -51,6 +51,7 @@
 #include "llfocusmgr.h"
 #include "lllineeditor.h"
 #include "llnotificationsutil.h"
+#include "llsecapi.h"
 #include "llstartup.h"
 #include "lltextbox.h"
 #include "llui.h"
@@ -77,6 +78,7 @@
 #pragma warning(disable: 4355)      // 'this' used in initializer list
 #endif  // LL_WINDOWS
 
+#include "llsdserialize.h"
 #define USE_VIEWER_AUTH 0
 
 const S32 BLACK_BORDER_HEIGHT = 160;
@@ -187,6 +189,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 		delete LLPanelLogin::sInstance;
 	}
 
+	mPasswordModified = FALSE;
 	LLPanelLogin::sInstance = this;
 
 	// add to front so we are the bottom-most child
@@ -213,10 +216,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	}
 
 #if !USE_VIEWER_AUTH
-	childSetPrevalidate("first_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
-	childSetPrevalidate("last_name_edit", LLLineEditor::prevalidateASCIIPrintableNoSpace);
-
-	childSetCommitCallback("password_edit", mungePassword, this);
+	childSetPrevalidate("username_edit", LLLineEditor::prevalidateASCIIPrintableNoPipe);
 	getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
 
 	// change z sort of clickable text to be behind buttons
@@ -248,6 +248,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
 	server_choice_combo->setCommitCallback(onSelectServer, NULL);
 	server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1));
+	updateServerCombo();
 
 	childSetAction("connect_btn", onClickConnect, this);
 
@@ -303,12 +304,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 
 	// kick off a request to grab the url manually
 	gResponsePtr = LLIamHereLogin::build( this );
-	std::string login_page = gSavedSettings.getString("LoginPage");
-	if (login_page.empty())
-	{
-		login_page = getString( "real_url" );
-	}
-	LLHTTPClient::head( login_page, gResponsePtr );
+
+	LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
 
 #if !USE_VIEWER_AUTH
 	// Initialize visibility (and don't force visibility - use prefs)
@@ -377,21 +374,6 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
 	}
 }
 
-void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
-{
-	LLPanelLogin* self = (LLPanelLogin*)user_data;
-	LLLineEditor* editor = (LLLineEditor*)caller;
-	std::string password = editor->getText();
-
-	// Re-md5 if we've changed at all
-	if (password != self->mIncomingPassword)
-	{
-		LLMD5 pass((unsigned char *)password.c_str());
-		char munged_password[MD5HEX_STR_SIZE];
-		pass.hex_digest(munged_password);
-		self->mMungedPassword = munged_password;
-	}
-}
 
 LLPanelLogin::~LLPanelLogin()
 {
@@ -498,14 +480,14 @@ void LLPanelLogin::giveFocus()
 	if( sInstance )
 	{
 		// Grab focus and move cursor to first blank input field
-		std::string first = sInstance->childGetText("first_name_edit");
+		std::string username = sInstance->childGetText("username_edit");
 		std::string pass = sInstance->childGetText("password_edit");
 
-		BOOL have_first = !first.empty();
+		BOOL have_username = !username.empty();
 		BOOL have_pass = !pass.empty();
 
 		LLLineEditor* edit = NULL;
-		if (have_first && !have_pass)
+		if (have_username && !have_pass)
 		{
 			// User saved his name but not his password.  Move
 			// focus to password field.
@@ -514,7 +496,7 @@ void LLPanelLogin::giveFocus()
 		else
 		{
 			// User doesn't have a name, so start there.
-			edit = sInstance->getChild<LLLineEditor>("first_name_edit");
+			edit = sInstance->getChild<LLLineEditor>("username_edit");
 		}
 
 		if (edit)
@@ -559,77 +541,120 @@ void LLPanelLogin::show(const LLRect &rect,
 }
 
 // static
-void LLPanelLogin::setFields(const std::string& firstname,
-			     const std::string& lastname,
-			     const std::string& password)
+void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
+							 BOOL remember)
 {
 	if (!sInstance)
 	{
 		llwarns << "Attempted fillFields with no login view shown" << llendl;
 		return;
 	}
+	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
 
-	sInstance->childSetText("first_name_edit", firstname);
-	sInstance->childSetText("last_name_edit", lastname);
-
-	// Max "actual" password length is 16 characters.
-	// Hex digests are always 32 characters.
-	if (password.length() == 32)
+	LLSD identifier = credential->getIdentifier();
+	if((std::string)identifier["type"] == "agent") 
+	{
+		sInstance->childSetText("username_edit", (std::string)identifier["first_name"] + " " + 
+								(std::string)identifier["last_name"]);	
+	}
+	else if((std::string)identifier["type"] == "account")
+	{
+		sInstance->childSetText("username_edit", (std::string)identifier["account_name"]);		
+	}
+	else
+	{
+	  sInstance->childSetText("username_edit", std::string());	
+	}
+	// if the password exists in the credential, set the password field with
+	// a filler to get some stars
+	LLSD authenticator = credential->getAuthenticator();
+	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
+	if(authenticator.isMap() && 
+	   authenticator.has("secret") && 
+	   (authenticator["secret"].asString().size() > 0))
 	{
+		
 		// This is a MD5 hex digest of a password.
 		// We don't actually use the password input field, 
 		// fill it with MAX_PASSWORD characters so we get a 
 		// nice row of asterixes.
 		const std::string filler("123456789!123456");
-		sInstance->childSetText("password_edit", filler);
-		sInstance->mIncomingPassword = filler;
-		sInstance->mMungedPassword = password;
+		sInstance->childSetText("password_edit", std::string("123456789!123456"));
 	}
 	else
 	{
-		// this is a normal text password
-		sInstance->childSetText("password_edit", password);
-		sInstance->mIncomingPassword = password;
-		LLMD5 pass((unsigned char *)password.c_str());
-		char munged_password[MD5HEX_STR_SIZE];
-		pass.hex_digest(munged_password);
-		sInstance->mMungedPassword = munged_password;
+		sInstance->childSetText("password_edit", std::string());		
 	}
+	sInstance->childSetValue("remember_check", remember);
 }
 
 
 // static
-void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
+void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
+							 BOOL &remember)
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted addServer with no login view shown" << llendl;
+		llwarns << "Attempted getFields with no login view shown" << llendl;
 		return;
 	}
+	
+	// load the credential so we can pass back the stored password or hash if the user did
+	// not modify the password field.
+	
+	credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGridName());
 
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-	combo->add(server, LLSD(domain_name) );
-	combo->setCurrentByIndex(0);
-}
-
-// static
-void LLPanelLogin::getFields(std::string *firstname,
-			     std::string *lastname,
-			     std::string *password)
-{
-	if (!sInstance)
+	LLSD identifier = LLSD::emptyMap();
+	LLSD authenticator = LLSD::emptyMap();
+	
+	if(credential.notNull())
 	{
-		llwarns << "Attempted getFields with no login view shown" << llendl;
-		return;
+		authenticator = credential->getAuthenticator();
 	}
 
-	*firstname = sInstance->childGetText("first_name_edit");
-	LLStringUtil::trim(*firstname);
-
-	*lastname = sInstance->childGetText("last_name_edit");
-	LLStringUtil::trim(*lastname);
+	std::string username = sInstance->childGetText("username_edit");
+	LLStringUtil::trim(username);
+	std::string password = sInstance->childGetText("password_edit");
 
-	*password = sInstance->mMungedPassword;
+	LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
+	// determine if the username is a first/last form or not.
+	size_t separator_index = username.find_first_of(' ');
+	if (separator_index == username.npos)
+	{
+		LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
+		// single username, so this is a 'clear' identifier
+		identifier["type"] = "account";
+		identifier["account_name"] = username;
+		
+		if (LLPanelLogin::sInstance->mPasswordModified)
+		{
+			authenticator = LLSD::emptyMap();
+			// password is plaintext
+			authenticator["type"] = "clear";
+			authenticator["secret"] = password;
+		}
+	}
+	else if (separator_index == username.find_last_of(' '))
+	{
+		LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
+		// traditional firstname / lastname
+		identifier["type"] = "agent";
+		identifier["first_name"] = username.substr(0, separator_index);
+		identifier["last_name"] = username.substr(separator_index+1, username.npos);
+		
+		if (LLPanelLogin::sInstance->mPasswordModified)
+		{
+			authenticator = LLSD::emptyMap();
+			authenticator["type"] = "hash";
+			authenticator["algorithm"] = "md5";
+			LLMD5 pass((const U8 *)password.c_str());
+			char md5pass[33];               /* Flawfinder: ignore */
+			pass.hex_digest(md5pass);
+			authenticator["secret"] = md5pass;
+		}
+	}
+	credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGridName(), identifier, authenticator);
+	remember = sInstance->childGetValue("remember_check");
 }
 
 // static
@@ -682,6 +707,7 @@ void LLPanelLogin::refreshLocation( bool force_visible )
 	sInstance->childSetVisible("start_location_combo", show_start);
 	sInstance->childSetVisible("start_location_text", show_start);
 
+	// should be true for enterprise viewer
 	BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
 	sInstance->childSetVisible("server_combo", show_server);
 
@@ -721,15 +747,12 @@ void LLPanelLogin::loadLoginPage()
 	
 	std::ostringstream oStr;
 
-	std::string login_page = gSavedSettings.getString("LoginPage");
-	if (login_page.empty())
-	{
-		login_page = sInstance->getString( "real_url" );
-	}
+	std::string login_page = LLGridManager::getInstance()->getLoginPage();
 	oStr << login_page;
 	
 	// Use the right delimeter depending on how LLURI parses the URL
 	LLURI login_page_uri = LLURI(login_page);
+	
 	std::string first_query_delimiter = "&";
 	if (login_page_uri.queryMap().size() == 0)
 	{
@@ -761,11 +784,10 @@ void LLPanelLogin::loadLoginPage()
 	curl_free(curl_version);
 
 	// Grid
-	char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
+	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLabel().c_str(), 0);
 	oStr << "&grid=" << curl_grid;
 	curl_free(curl_grid);
-
-	gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
+	gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
 	gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
 
 
@@ -790,30 +812,20 @@ void LLPanelLogin::loadLoginPage()
 		location = gSavedSettings.getString("LoginLocation");
 	}
 	
-	std::string firstname, lastname;
+	std::string username;
 
     if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
     {
         LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-		firstname = cmd_line_login[0].asString();
-		lastname = cmd_line_login[1].asString();
+		username = cmd_line_login[0].asString() + " " + cmd_line_login[1];
         password = cmd_line_login[2].asString();
     }
     	
-	if (firstname.empty())
-	{
-		firstname = gSavedSettings.getString("FirstName");
-	}
-	
-	if (lastname.empty())
-	{
-		lastname = gSavedSettings.getString("LastName");
-	}
 	
 	char* curl_region = curl_escape(region.c_str(), 0);
 
-	oStr <<"firstname=" << firstname <<
-		"&lastname=" << lastname << "&location=" << location <<	"&region=" << curl_region;
+	oStr <<"username=" << username <<
+		 "&location=" << location <<	"&region=" << curl_region;
 	
 	curl_free(curl_region);
 
@@ -896,34 +908,33 @@ void LLPanelLogin::onClickConnect(void *)
 		// JC - Make sure the fields all get committed.
 		sInstance->setFocus(FALSE);
 
-		std::string first = sInstance->childGetText("first_name_edit");
-		std::string last  = sInstance->childGetText("last_name_edit");
-		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-		std::string combo_text = combo->getSimple();
-		
-		bool has_first_and_last = !(first.empty() || last.empty());
-		bool has_location = false;
-
-		if(combo_text=="<Type region name>" || combo_text =="")
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+		LLSD combo_val = combo->getSelectedValue();
+		if (combo_val.isUndefined())
 		{
-			// *NOTE: Mani - Location field is not always committed by this point!
-			// This may be duplicate work, but better than not doing the work!
-			LLURLSimString::sInstance.setString("");
+			combo_val = combo->getValue();
 		}
-		else 
+		if(combo_val.isUndefined())
+		{
+			LLNotificationsUtil::add("StartRegionEmpty");
+			return;
+		}		
+		try
 		{
-			// *NOTE: Mani - Location field is not always committed by this point!
-			LLURLSimString::sInstance.setString(combo_text);
-			has_location = true;
+			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
 		}
-
-		if(!has_first_and_last)
+		catch (LLInvalidGridName ex)
 		{
-			LLNotificationsUtil::add("MustHaveAccountToLogIn");
+			LLSD args;
+			args["GRID"] = combo_val.asString();
+			LLNotificationsUtil::add("InvalidGrid", args);
+			return;
 		}
-		else if(!has_location)
+		
+		std::string username = sInstance->childGetText("username_edit");
+		if(username.empty())
 		{
-			LLNotificationsUtil::add("StartRegionEmpty");
+			LLNotificationsUtil::add("MustHaveAccountToLogIn");
 		}
 		else
 		{
@@ -986,6 +997,8 @@ void LLPanelLogin::onClickHelp(void*)
 // static
 void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 {
+	LLPanelLogin *This = (LLPanelLogin *) user_data;
+	This->mPasswordModified = TRUE;
 	if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
 	{
 		LLNotificationsUtil::add("CapsKeyOn");
@@ -993,6 +1006,34 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 	}
 }
 
+void LLPanelLogin::updateServerCombo()
+{
+	// We add all of the possible values, sorted, and then add a bar and the current value at the top
+	LLGridManager* viewer_login = LLGridManager::getInstance();
+	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");	
+	server_choice_combo->removeall();
+	std::map<std::string, std::string> known_grids = viewer_login->getKnownGrids();
+	for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
+		 grid_choice != known_grids.end();
+		 grid_choice++)
+		{
+			//if (!grid_choice->first.empty())
+			{
+				LL_INFOS("Credentials") << "adding " << grid_choice->second << ":" << grid_choice->first << LL_ENDL;
+				server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
+			}
+		}
+	
+	server_choice_combo->addSeparator(ADD_TOP);
+	
+	LL_INFOS("Credentials") << "adding top grid choice by " << viewer_login->getGridLabel() << LL_ENDL;
+	server_choice_combo->add(viewer_login->getGridLabel(), 
+							 viewer_login->getGridName(), 
+							 ADD_TOP);	
+	
+	server_choice_combo->selectFirstItem();	
+}
+
 // static
 void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 {
@@ -1002,45 +1043,34 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 
 	// The user twiddled with the grid choice ui.
 	// apply the selection to the grid setting.
-	std::string grid_label;
-	S32 grid_index;
+	LLPointer<LLCredential> credential;
+	BOOL remember = FALSE;
 
 	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-	LLSD combo_val = combo->getValue();
-
-	if (LLSD::TypeInteger == combo_val.type())
-	{
-		grid_index = combo->getValue().asInteger();
-
-		if ((S32)GRID_INFO_OTHER == grid_index)
-		{
-			// This happens if the user specifies a custom grid
-			// via command line.
-			grid_label = combo->getSimple();
-		}
-	}
-	else
+	LLSD combo_val = combo->getSelectedValue();
+	if (combo_val.isUndefined())
 	{
-		// no valid selection, return other
-		grid_index = (S32)GRID_INFO_OTHER;
-		grid_label = combo_val.asString();
+	  combo_val = combo->getValue();
 	}
 
-	// This new seelction will override preset uris
+	// This new selection will override preset uris
 	// from the command line.
-	LLViewerLogin* vl = LLViewerLogin::getInstance();
-	vl->resetURIs();
-	if(grid_index != GRID_INFO_OTHER)
-	{
-		vl->setGridChoice((EGridInfo)grid_index);
-	}
-	else
-	{
-		vl->setGridChoice(grid_label);
-	}
+
+	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+	updateServerCombo();
 
 	// grid changed so show new splash screen (possibly)
 	loadLoginPage();
+	
+	// if they've selected another grid, we should load the credentials
+	// for that grid and set them to the UI.
+	credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGridName());
+	
+
+	remember = sInstance->childGetValue("remember_check");
+	sInstance->setFields(credential, remember);
+
+	LL_INFOS("Credentials") << "Grid changed to:" << LLGridManager::getInstance()->getGridName() << LL_ENDL;
 }
 
 void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 97350ce5c7..d33aa2d550 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -37,6 +37,7 @@
 #include "llpointer.h"			// LLPointer<>
 #include "llmediactrl.h"	// LLMediaCtrlObserver
 #include <boost/scoped_ptr.hpp>
+#include "llsecapi.h"
 
 class LLLineEditor;
 class LLUIImage;
@@ -65,15 +66,11 @@ public:
 		void (*callback)(S32 option, void* user_data), 
 		void* callback_data);
 
-	// Remember password checkbox is set via gSavedSettings "RememberPassword"
-	static void setFields(const std::string& firstname, const std::string& lastname, 
-		const std::string& password);
+	static void setFields(LLPointer<LLCredential> credential, BOOL remember);
 
-	static void addServer(const std::string& server, S32 domain_name);
 	static void refreshLocation( bool force_visible );
 
-	static void getFields(std::string *firstname, std::string *lastname,
-						  std::string *password);
+	static void getFields(LLPointer<LLCredential>& credential, BOOL& remember);
 
 	static BOOL isGridComboDirty();
 	static void getLocation(std::string &location);
@@ -85,7 +82,6 @@ public:
 	static void loadLoginPage();	
 	static void giveFocus();
 	static void setAlwaysRefresh(bool refresh); 
-	static void mungePassword(LLUICtrl* caller, void* user_data);
 	
 	// inherited from LLViewerMediaObserver
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
@@ -102,6 +98,7 @@ private:
 	static void onPassKey(LLLineEditor* caller, void* user_data);
 	static void onSelectServer(LLUICtrl*, void*);
 	static void onServerComboLostFocus(LLFocusableElement*);
+	static void updateServerCombo();
 	
 private:
 	LLPointer<LLUIImage> mLogoImage;
@@ -110,8 +107,7 @@ private:
 	void			(*mCallback)(S32 option, void *userdata);
 	void*			mCallbackData;
 
-	std::string mIncomingPassword;
-	std::string mMungedPassword;
+	BOOL            mPasswordModified;
 
 	static LLPanelLogin* sInstance;
 	static BOOL		sCapslockDidNotification;
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index c2cfde0dc7..cdf4a3fe01 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -38,11 +38,17 @@
 
 
 std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap;
-
+LLPointer<LLSecAPIHandler> gSecAPIHandler;
 
 void initializeSecHandler()
 {
 	gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
+	
+	// Currently, we only have the Basic handler, so we can point the main sechandler
+	// pointer to the basic handler.  Later, we'll create a wrapper handler that
+	// selects the appropriate sechandler as needed, for instance choosing the
+	// mac keyring handler, with fallback to the basic sechandler
+	gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
 }
 // start using a given security api handler.  If the string is empty
 // the default is used
@@ -64,6 +70,28 @@ void registerSecHandler(const std::string& handler_type,
 	gHandlerMap[handler_type] = handler;
 }
 
+std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
+{
+	return s << (std::string)cred;
+}
 
 
-
+LLSD LLCredential::getLoginParams()
+{
+	LLSD result = LLSD::emptyMap();
+	if (mIdentifier["type"].asString() == "agent")
+	{
+		// legacy credential
+		result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
+		result["first"] = mIdentifier["first_name"];
+		result["last"] = mIdentifier["last_name"];
+	
+	}
+	else if (mIdentifier["type"].asString() == "account")
+	{
+		result["username"] = mIdentifier["username"];
+		result["passwd"] = mAuthenticator["secret"];
+                                    
+	}
+	return result;
+}
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 743d3d6770..d456ca95b1 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -34,6 +34,7 @@
 #define LLSECAPI_H
 #include <vector>
 #include <openssl/x509.h>
+#include <ostream>
 
 // All error handling is via exceptions.
 
@@ -156,7 +157,7 @@ public:
 	LLCertificateStore() {}
 	virtual ~LLCertificateStore() {}
 	
-	virtual X509_STORE getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
+	virtual X509_STORE* getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
 	// for this store
 	
 	// add a copy of a cert to the store
@@ -169,7 +170,8 @@ public:
 	virtual void remove(int index)=0;
 	
 	// return a certificate at the index
-	virtual LLPointer<LLCertificate>& operator[](int index)=0;
+	virtual LLPointer<LLCertificate> operator[](int index)=0;
+	
 	// return the number of certs in the store
 	virtual int len() const =0;
 	
@@ -186,6 +188,49 @@ public:
 	virtual bool validate(const LLCertificateChain& cert_chain) const=0;
 };
 
+//
+// LLCredential - interface for credentials providing the following functionality:
+// * persistance of credential information based on grid (for saving username/password)
+// * serialization to an OGP identifier/authenticator pair
+// 
+class LLCredential  : public LLRefCount
+{
+public:
+	
+	LLCredential() {}
+	
+	LLCredential(const std::string& grid)
+	{
+		mGrid = grid;
+		mIdentifier = LLSD::emptyMap();
+		mAuthenticator = LLSD::emptyMap();
+	}
+	
+	virtual ~LLCredential() {}
+	
+	virtual void setCredentialData(const LLSD& identifier, const LLSD& authenticator) 
+	{ 
+		mIdentifier = identifier;
+		mAuthenticator = authenticator;
+	}
+	virtual LLSD getIdentifier() { return mIdentifier; }
+	virtual LLSD getAuthenticator() { return mAuthenticator; }
+	virtual LLSD getLoginParams();
+	virtual std::string getGrid() { return mGrid; }
+	
+
+	virtual void clearAuthenticator() { mAuthenticator = LLSD(); } 
+	virtual std::string userID() const { return std::string("unknown");}
+	virtual std::string asString() const { return std::string("unknown");}
+	operator std::string() const { return asString(); }
+protected:
+	LLSD mIdentifier;
+	LLSD mAuthenticator;
+	std::string mGrid;
+};
+
+std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
+
 
 // LLSecAPIHandler Class
 // Interface handler class for the various security storage handlers.
@@ -219,9 +264,24 @@ public:
 	// retrieve protected data
 	virtual LLSD getProtectedData(const std::string& data_type,
 								  const std::string& data_id)=0;
+	
+	// delete a protected data item from the store
+	virtual void deleteProtectedData(const std::string& data_type,
+									 const std::string& data_id)=0;
+	
+	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+													 const LLSD& identifier, 
+													 const LLSD& authenticator)=0;
+	
+	virtual LLPointer<LLCredential> loadCredential(const std::string& grid)=0;
+	
+	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)=0;
+	
+	virtual void deleteCredential(LLPointer<LLCredential> cred)=0;
+	
 };
 
-void secHandlerInitialize();
+void initializeSecHandler();
 				
 // retrieve a security api depending on the api type
 LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
@@ -229,4 +289,6 @@ LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
 void registerSecHandler(const std::string& handler_type, 
 						LLPointer<LLSecAPIHandler>& handler);
 
+extern LLPointer<LLSecAPIHandler> gSecAPIHandler;
+
 #endif // LL_SECAPI_H
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index ab6bf034f1..4180f578b9 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -35,8 +35,11 @@
 #include "llsecapi.h"
 #include "llsechandler_basic.h"
 #include "llsdserialize.h"
+#include "llviewernetwork.h"
+#include "llxorcipher.h"
 #include "llfile.h"
 #include "lldir.h"
+#include "llviewercontrol.h"
 #include <vector>
 #include <ios>
 #include <openssl/x509.h>
@@ -276,22 +279,94 @@ std::string cert_get_digest(const std::string& digest_type, X509 *cert)
 }
 
 
+//
+// LLBasicCertificateStore
+// 
+LLBasicCertificateStore::LLBasicCertificateStore(const std::string& filename)
+{
+}
+LLBasicCertificateStore::LLBasicCertificateStore(const X509_STORE* store)
+{
+}
+
+LLBasicCertificateStore::~LLBasicCertificateStore()
+{
+}
+
+		
+X509_STORE* LLBasicCertificateStore::getOpenSSLX509Store()
+{
+	return NULL;
+}
+		
+		// add a copy of a cert to the store
+void  LLBasicCertificateStore::append(const LLCertificate& cert)
+{
+}
+		
+		// add a copy of a cert to the store
+void LLBasicCertificateStore::insert(const int index, const LLCertificate& cert)
+{
+}
+		
+		// remove a certificate from the store
+void LLBasicCertificateStore::remove(int index)
+{
+}
+		
+		// return a certificate at the index
+LLPointer<LLCertificate> LLBasicCertificateStore::operator[](int index)
+{
+	LLPointer<LLCertificate> result = NULL;
+	return result;
+}
+		// return the number of certs in the store
+int LLBasicCertificateStore::len() const
+{
+	return 0;
+}
+		
+		// load the store from a persisted location
+void LLBasicCertificateStore::load(const std::string& store_id)
+{
+}
+		
+		// persist the store
+void LLBasicCertificateStore::save()
+{
+}
+		
+		// return the store id
+std::string LLBasicCertificateStore::storeId()
+{
+	return std::string("");
+}
+		
+		// validate a cert chain
+bool LLBasicCertificateStore::validate(const LLCertificateChain& cert_chain) const
+{
+	return FALSE;
+}
+
 // LLSecAPIBasicHandler Class
 // Interface handler class for the various security storage handlers.
 
 // We read the file on construction, and write it on destruction.  This
 // means multiple processes cannot modify the datastore.
-LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file)
+LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file,
+										   const std::string& legacy_password_path)
 {
 	mProtectedDataFilename = protected_data_file;
 	mProtectedDataMap = LLSD::emptyMap();
+	mLegacyPasswordPath = legacy_password_path;
 	_readProtectedData();
 }
 
 LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 {
-	std::string mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-														  "bin_conf.dat");
+	mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+															"bin_conf.dat");
+	mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
 
 	mProtectedDataMap = LLSD::emptyMap();
 	_readProtectedData();
@@ -306,7 +381,6 @@ void LLSecAPIBasicHandler::_readProtectedData()
 {	
 	// attempt to load the file into our map
 	LLPointer<LLSDParser> parser = new LLSDXMLParser();
-	
 	llifstream protected_data_stream(mProtectedDataFilename.c_str(), 
 									llifstream::binary);
 	if (!protected_data_stream.fail()) {
@@ -314,21 +388,27 @@ void LLSecAPIBasicHandler::_readProtectedData()
 		U8 salt[STORE_SALT_SIZE];
 		U8 buffer[BUFFER_READ_SIZE];
 		U8 decrypted_buffer[BUFFER_READ_SIZE];
-		int decrypted_length;		
-		
+		int decrypted_length;	
+		unsigned char MACAddress[MAC_ADDRESS_BYTES];
+		LLUUID::getNodeID(MACAddress);
+		LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
 
 		// read in the salt and key
 		protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
 		offset = 0;
 		if (protected_data_stream.gcount() < STORE_SALT_SIZE)
 		{
-			throw LLProtectedDataException("Corrupt Protected Data Store");
+			throw LLProtectedDataException("Corrupt Protected Data Store1");
 		}
-		
+
+		cipher.decrypt(salt, STORE_SALT_SIZE);		
+
 		// totally lame.  As we're not using the OS level protected data, we need to
 		// at least obfuscate the data.  We do this by using a salt stored at the head of the file
 		// to encrypt the data, therefore obfuscating it from someone using simple existing tools.
-		// It would be better to use the password, but as this store
+		// We do include the MAC address as part of the obfuscation, which would require an
+		// attacker to get the MAC address as well as the protected store, which improves things
+		// somewhat.  It would be better to use the password, but as this store
 		// will be used to store the SL password when the user decides to have SL remember it, 
 		// so we can't use that.  OS-dependent store implementations will use the OS password/storage 
 		// mechanisms and are considered to be more secure.
@@ -369,6 +449,7 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	U8 salt[STORE_SALT_SIZE];
 	U8 buffer[BUFFER_READ_SIZE];
 	U8 encrypted_buffer[BUFFER_READ_SIZE];
+
 	
 	if(mProtectedDataMap.isUndefined())
 	{
@@ -377,10 +458,10 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	}
 	// create a string with the formatted data.
 	LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
-	
 	std::istringstream formatted_data_istream(formatted_data_ostream.str());
 	// generate the seed
 	RAND_bytes(salt, STORE_SALT_SIZE);
+
 	
 	// write to a temp file so we don't clobber the initial file if there is
 	// an error.
@@ -394,7 +475,12 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 		EVP_CIPHER_CTX ctx;
 		EVP_CIPHER_CTX_init(&ctx);
 		EVP_EncryptInit(&ctx, EVP_rc4(), salt, NULL);
-		protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);	
+		unsigned char MACAddress[MAC_ADDRESS_BYTES];
+		LLUUID::getNodeID(MACAddress);
+		LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
+		cipher.encrypt(salt, STORE_SALT_SIZE);
+		protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
+
 		while (formatted_data_istream.good())
 		{
 			formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
@@ -423,7 +509,8 @@ void LLSecAPIBasicHandler::_writeProtectedData()
 	}
 
 	// move the temporary file to the specified file location.
-	if((LLFile::remove(mProtectedDataFilename) != 0) || 
+	if((((LLFile::isfile(mProtectedDataFilename) != 0) && 
+		 (LLFile::remove(mProtectedDataFilename) != 0))) || 
 	   (LLFile::rename(tmp_filename, mProtectedDataFilename)))
 	{
 		LLFile::remove(tmp_filename);
@@ -477,14 +564,181 @@ LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
 	return LLSD();
 }
 
+void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type,
+											   const std::string& data_id)
+{
+	if (mProtectedDataMap.has(data_type) &&
+		mProtectedDataMap[data_type].isMap() &&
+		mProtectedDataMap[data_type].has(data_id))
+		{
+			mProtectedDataMap[data_type].erase(data_id);
+		}
+}
+
+
+//
 // persist data in a protected store
+//
 void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type,
-									  const std::string& data_id,
-									  const LLSD& data)
+											const std::string& data_id,
+											const LLSD& data)
 {
 	if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
 		mProtectedDataMap[data_type] = LLSD::emptyMap();
 	}
 	
 	mProtectedDataMap[data_type][data_id] = data; 
-}
\ No newline at end of file
+}
+
+//
+// Create a credential object from an identifier and authenticator.  credentials are
+// per grid.
+LLPointer<LLCredential> LLSecAPIBasicHandler::createCredential(const std::string& grid,
+															   const LLSD& identifier, 
+															   const LLSD& authenticator)
+{
+	LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+	result->setCredentialData(identifier, authenticator);
+	return result;
+}
+
+// Load a credential from the credential store, given the grid
+LLPointer<LLCredential> LLSecAPIBasicHandler::loadCredential(const std::string& grid)
+{
+	LLSD credential = getProtectedData("credential", grid);
+	LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
+	if(credential.isMap() && 
+	   credential.has("identifier"))
+	{
+
+		LLSD identifier = credential["identifier"];
+		LLSD authenticator;
+		if (credential.has("authenticator"))
+		{
+			authenticator = credential["authenticator"];
+		}
+		result->setCredentialData(identifier, authenticator);
+	}
+	else
+	{
+		// credential was not in protected storage, so pull the credential
+		// from the legacy store.
+		std::string first_name = gSavedSettings.getString("FirstName");
+		std::string last_name = gSavedSettings.getString("LastName");
+		
+		if ((first_name != "") &&
+			(last_name != ""))
+		{
+			LLSD identifier = LLSD::emptyMap();
+			LLSD authenticator;
+			identifier["type"] = "agent";
+			identifier["first_name"] = first_name;
+			identifier["last_name"] = last_name;
+			
+			std::string legacy_password = _legacyLoadPassword();
+			if (legacy_password.length() > 0)
+			{
+				authenticator = LLSD::emptyMap();
+				authenticator["type"] = "hash";
+				authenticator["algorithm"] = "md5";
+				authenticator["secret"] = legacy_password;
+			}
+			result->setCredentialData(identifier, authenticator);
+		}		
+	}
+	return result;
+}
+
+// Save the credential to the credential store.  Save the authenticator also if requested.
+// That feature is used to implement the 'remember password' functionality.
+void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)
+{
+	LLSD credential = LLSD::emptyMap();
+	credential["identifier"] = cred->getIdentifier(); 
+	if (save_authenticator) 
+	{
+		credential["authenticator"] = cred->getAuthenticator();
+	}
+	LL_INFOS("Credentials") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
+	setProtectedData("credential", cred->getGrid(), credential);
+	//*TODO: If we're saving Agni credentials, should we write the
+	// credentials to the legacy password.dat/etc?
+}
+
+// Remove a credential from the credential store.
+void LLSecAPIBasicHandler::deleteCredential(LLPointer<LLCredential> cred)
+{
+	LLSD undefVal;
+	deleteProtectedData("credential", cred->getGrid());
+	cred->setCredentialData(undefVal, undefVal);
+}
+
+// load the legacy hash for agni, and decrypt it given the 
+// mac address
+std::string LLSecAPIBasicHandler::_legacyLoadPassword()
+{
+	const S32 HASHED_LENGTH = 32;	
+	std::vector<U8> buffer(HASHED_LENGTH);
+	llifstream password_file(mLegacyPasswordPath, llifstream::binary);
+	
+	if(password_file.fail())
+	{
+		return std::string("");
+	}
+	
+	password_file.read((char*)&buffer[0], buffer.size());
+	if(password_file.gcount() != buffer.size())
+	{
+		return std::string("");
+	}
+	
+	// Decipher with MAC address
+	unsigned char MACAddress[MAC_ADDRESS_BYTES];
+	LLUUID::getNodeID(MACAddress);
+	LLXORCipher cipher(MACAddress, 6);
+	cipher.decrypt(&buffer[0], buffer.size());
+	
+	return std::string((const char*)&buffer[0], buffer.size());
+}
+
+
+// return an identifier for the user
+std::string LLSecAPIBasicCredential::userID() const
+{
+	if (!mIdentifier.isMap())
+	{
+		return mGrid + "(null)";
+	}
+	else if ((std::string)mIdentifier["type"] == "agent")
+	{
+		return  (std::string)mIdentifier["first_name"] + "_" + (std::string)mIdentifier["last_name"];
+	}
+	else if ((std::string)mIdentifier["type"] == "account")
+	{
+		return (std::string)mIdentifier["account_name"];
+	}
+
+	return "unknown";
+
+}
+
+// return a printable user identifier
+std::string LLSecAPIBasicCredential::asString() const
+{
+	if (!mIdentifier.isMap())
+	{
+		return mGrid + ":(null)";
+	}
+	else if ((std::string)mIdentifier["type"] == "agent")
+	{
+		return mGrid + ":" + (std::string)mIdentifier["first_name"] + " " + (std::string)mIdentifier["last_name"];
+	}
+	else if ((std::string)mIdentifier["type"] == "account")
+	{
+		return mGrid + ":" + (std::string)mIdentifier["account_name"];
+	}
+
+	return mGrid + ":(unknown type)";
+}
+
+
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
index 0ec6938583..5d81b6e190 100644
--- a/indra/newview/llsechandler_basic.h
+++ b/indra/newview/llsechandler_basic.h
@@ -68,13 +68,69 @@ protected:
 	X509* mCert;
 };
 
+// class LLCertificateStore
+// represents a store of certificates, typically a store of root CA
+// certificates.  The store can be persisted, and can be used to validate
+// a cert chain
+//
+class LLBasicCertificateStore : public LLCertificateStore
+{
+public:
+	LLBasicCertificateStore(const std::string& filename);
+	LLBasicCertificateStore(const X509_STORE* store);
+	virtual ~LLBasicCertificateStore();
+	
+	virtual X509_STORE* getOpenSSLX509Store();  // return an openssl X509_STORE  
+	// for this store
+	
+	// add a copy of a cert to the store
+	virtual void  append(const LLCertificate& cert);
+	
+	// add a copy of a cert to the store
+	virtual void insert(const int index, const LLCertificate& cert);
+	
+	// remove a certificate from the store
+	virtual void remove(int index);
+	
+	// return a certificate at the index
+	virtual LLPointer<LLCertificate> operator[](int index);
+	// return the number of certs in the store
+	virtual int len() const;
+	
+	// load the store from a persisted location
+	virtual void load(const std::string& store_id);
+	
+	// persist the store
+	virtual void save();
+	
+	// return the store id
+	virtual std::string storeId();
+	
+	// validate a cert chain
+	virtual bool validate(const LLCertificateChain& cert_chain) const;
+};
+
+// LLSecAPIBasicCredential class
+class LLSecAPIBasicCredential : public LLCredential
+{
+public:
+	LLSecAPIBasicCredential(const std::string& grid) : LLCredential(grid) {} 
+	virtual ~LLSecAPIBasicCredential() {}
+	// return a value representing the user id, (could be guid, name, whatever)
+	virtual std::string userID() const;	
+	
+	// printible string identifying the credential.
+	virtual std::string asString() const;
+};
+
 // LLSecAPIBasicHandler Class
 // Interface handler class for the various security storage handlers.
 class LLSecAPIBasicHandler : public LLSecAPIHandler
 {
 public:
 	
-	LLSecAPIBasicHandler(const std::string& protected_data_filename);
+	LLSecAPIBasicHandler(const std::string& protected_data_filename,
+						 const std::string& legacy_password_path);
 	LLSecAPIBasicHandler();
 	
 	virtual ~LLSecAPIBasicHandler();
@@ -102,12 +158,32 @@ public:
 	// retrieve protected data
 	virtual LLSD getProtectedData(const std::string& data_type,
 								  const std::string& data_id);
+	
+	// delete a protected data item from the store
+	virtual void deleteProtectedData(const std::string& data_type,
+									 const std::string& data_id);
+	
+	// credential management routines
+	
+	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+													 const LLSD& identifier, 
+													 const LLSD& authenticator);
+	
+	virtual LLPointer<LLCredential> loadCredential(const std::string& grid);
+
+	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator);
+	
+	virtual void deleteCredential(LLPointer<LLCredential> cred);
+	
 protected:
 	void _readProtectedData();
 	void _writeProtectedData();
-	
+	std::string _legacyLoadPassword();
+
 	std::string mProtectedDataFilename;
 	LLSD mProtectedDataMap;
+	
+	std::string mLegacyPasswordPath;
 };
 
 #endif // LLSECHANDLER_BASIC
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 99fa271b78..dd991c8eff 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -230,10 +230,9 @@ static bool gUseCircuitCallbackCalled = false;
 
 EStartupState LLStartUp::gStartupState = STATE_FIRST;
 
-// *NOTE:Mani - to reconcile with giab changes...
-static std::string gFirstname;
-static std::string gLastname;
-static std::string gPassword;
+static LLPointer<LLCredential> gUserCredential;
+static std::string gDisplayName;
+static BOOL gRememberPassword = TRUE;     
 
 static U64 gFirstSimHandle = 0;
 static LLHost gFirstSim;
@@ -250,7 +249,6 @@ boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener(
 
 void login_show();
 void login_callback(S32 option, void* userdata);
-bool is_hex_string(U8* str, S32 len);
 void show_first_run_dialog();
 bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
 void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
@@ -716,69 +714,25 @@ bool idle_startup()
 		//
 		// Log on to system
 		//
-		if (!LLStartUp::sSLURLCommand.empty())
-		{
-			// this might be a secondlife:///app/login URL
-			gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand);
-		}
-		if (!gLoginHandler.getFirstName().empty()
-			|| !gLoginHandler.getLastName().empty()
-			/*|| !gLoginHandler.getWebLoginKey().isNull()*/ )
-		{
-			// We have at least some login information on a SLURL
-			gFirstname = gLoginHandler.getFirstName();
-			gLastname = gLoginHandler.getLastName();
-			LL_DEBUGS("LLStartup") << "STATE_FIRST: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-
-			// Show the login screen if we don't have everything
-			show_connect_box = 
-				gFirstname.empty() || gLastname.empty();
-		}
-        else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
-        {
-            LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-			gFirstname = cmd_line_login[0].asString();
-			gLastname = cmd_line_login[1].asString();
-			LL_DEBUGS("LLStartup") << "Setting gFirstname, gLastname from gSavedSettings(\"UserLoginInfo\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-
-			LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
-			char md5pass[33];               /* Flawfinder: ignore */
-			pass.hex_digest(md5pass);
-			gPassword = md5pass;
-			
-#ifdef USE_VIEWER_AUTH
-			show_connect_box = true;
-#else
-			show_connect_box = false;
-#endif
-			gSavedSettings.setBOOL("AutoLogin", TRUE);
-        }
-		else if (gSavedSettings.getBOOL("AutoLogin"))
-		{
-			gFirstname = gSavedSettings.getString("FirstName");
-			gLastname = gSavedSettings.getString("LastName");
-			LL_DEBUGS("LLStartup") << "AutoLogin: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-			gPassword = LLStartUp::loadPasswordFromDisk();
-			gSavedSettings.setBOOL("RememberPassword", TRUE);
-			
-#ifdef USE_VIEWER_AUTH
-			show_connect_box = true;
-#else
-			show_connect_box = false;
-#endif
+		if (gUserCredential.isNull())
+		{
+			gUserCredential = gLoginHandler.initializeLoginInfo(LLStartUp::sSLURLCommand);
 		}
-		else
+		if (gUserCredential.isNull())
 		{
-			// if not automatically logging in, display login dialog
-			// a valid grid is selected
-			gFirstname = gSavedSettings.getString("FirstName");
-			gLastname = gSavedSettings.getString("LastName");
-			LL_DEBUGS("LLStartup") << "normal login: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-			gPassword = LLStartUp::loadPasswordFromDisk();
-			show_connect_box = true;
+			show_connect_box = TRUE;
+		}
+		else if (gSavedSettings.getBOOL("AutoLogin"))  
+		{
+			gRememberPassword = TRUE;
+			gSavedSettings.setBOOL("RememberPassword", TRUE);                                                      
+			show_connect_box = false;    			
+		}
+		else 
+		{
+			gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
+			show_connect_box = TRUE;
 		}
-
-
 		// Go to the next startup state
 		LLStartUp::setStartupState( STATE_BROWSER_INIT );
 		return FALSE;
@@ -810,8 +764,10 @@ bool idle_startup()
 			// Load all the name information out of the login view
 			// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
 			// show the login view until login_show() is called below.  
-			// LLPanelLogin::getFields(gFirstname, gLastname, gPassword);
-
+			if (gUserCredential.isNull())                                                                          
+			{                                                                                                      
+				gUserCredential = gLoginHandler.initializeLoginInfo(LLStartUp::sSLURLCommand);                 
+			}     
 			if (gNoRender)
 			{
 				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
@@ -822,8 +778,10 @@ bool idle_startup()
 			// Show the login dialog
 			login_show();
 			// connect dialog is already shown, so fill in the names
-			LLPanelLogin::setFields( gFirstname, gLastname, gPassword);
-
+			if (gUserCredential.notNull())                                                                         
+			{                                                                                                      
+				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
+			}     
 			LLPanelLogin::giveFocus();
 
 			gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
@@ -890,36 +848,32 @@ bool idle_startup()
 		// DEV-42215: Make sure they're not empty -- gFirstname and gLastname
 		// might already have been set from gSavedSettings, and it's too bad
 		// to overwrite valid values with empty strings.
-		if (! gLoginHandler.getFirstName().empty() && ! gLoginHandler.getLastName().empty())
-		{
-			gFirstname = gLoginHandler.getFirstName();
-			gLastname = gLoginHandler.getLastName();
-			LL_DEBUGS("LLStartup") << "STATE_LOGIN_CLEANUP: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
-		}
 
 		if (show_connect_box)
 		{
 			// TODO if not use viewer auth
 			// Load all the name information out of the login view
-			LLPanelLogin::getFields(&gFirstname, &gLastname, &gPassword);
+			LLPanelLogin::getFields(gUserCredential, gRememberPassword); 
 			// end TODO
 	 
 			// HACK: Try to make not jump on login
 			gKeyboard->resetKeys();
 		}
 
-		if (!gFirstname.empty() && !gLastname.empty())
-		{
-			gSavedSettings.setString("FirstName", gFirstname);
-			gSavedSettings.setString("LastName", gLastname);
-
-			LL_INFOS("AppInit") << "Attempting login as: " << gFirstname << " " << gLastname << LL_ENDL;
-			gDebugInfo["LoginName"] = gFirstname + " " + gLastname;	
+		// save the credentials                                                                                        
+		std::string userid = "unknown";                                                                                
+		if(gUserCredential.notNull())                                                                                  
+		{  
+			userid = gUserCredential->userID();                                                                    
+			gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);  
 		}
-
+		gSavedSettings.setBOOL("RememberPassword", gRememberPassword);                                                 
+		LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;                                           
+		gDebugInfo["LoginName"] = userid;                                                                              
+         
 		// create necessary directories
 		// *FIX: these mkdir's should error check
-		gDirUtilp->setLindenUserDir(gFirstname, gLastname);
+		gDirUtilp->setPerAccountChatLogsDir(userid);  
     	LLFile::mkdir(gDirUtilp->getLindenUserDir());
 
         // Set PerAccountSettingsFile to the default value.
@@ -952,8 +906,6 @@ bool idle_startup()
 		{
 			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
 		}
-		
-		gDirUtilp->setPerAccountChatLogsDir(gFirstname, gLastname);
 
 		LLFile::mkdir(gDirUtilp->getChatLogsDir());
 		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
@@ -1052,7 +1004,7 @@ bool idle_startup()
 
 	if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
 	{
-		gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
+		gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
 
 		// Update progress status and the display loop.
 		auth_desc = LLTrans::getString("LoginInProgress");
@@ -1076,11 +1028,7 @@ bool idle_startup()
 
 		// This call to LLLoginInstance::connect() starts the 
 		// authentication process.
-		LLSD credentials;
-		credentials["first"] = gFirstname;
-		credentials["last"] = gLastname;
-		credentials["passwd"] = gPassword;
-		login->connect(credentials);
+		login->connect(gUserCredential);
 
 		LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
 		return FALSE;
@@ -1128,8 +1076,8 @@ bool idle_startup()
 			if(reason_response == "key")
 			{
 				// Couldn't login because user/password is wrong
-				// Clear the password
-				gPassword = "";
+				// Clear the credential
+				gUserCredential->clearAuthenticator();
 			}
 
 			if(reason_response == "update" 
@@ -1166,7 +1114,8 @@ bool idle_startup()
 			if(process_login_success_response())
 			{
 				// Pass the user information to the voice chat server interface.
-				gVoiceClient->userAuthorized(gFirstname, gLastname, gAgentID);
+				gVoiceClient->userAuthorized(gUserCredential->userID(), gAgentID);
+				LLGridManager::getInstance()->setFavorite(); 
 				LLStartUp::setStartupState( STATE_WORLD_INIT);
 			}
 			else
@@ -2115,20 +2064,9 @@ void login_show()
 #endif
 
 	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
-						bUseDebugLogin,
+						bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
 						login_callback, NULL );
 
-	// UI textures have been previously loaded in doPreloadImages()
-	
-	LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
-
-	LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel(), LLViewerLogin::getInstance()->getGridChoice());
-
-	LLViewerLogin* vl = LLViewerLogin::getInstance();
-	for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index)
-	{
-		LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index), grid_index);
-	}
 }
 
 // Callback for when login screen is closed.  Option 0 = connect, option 1 = quit.
@@ -2144,9 +2082,6 @@ void login_callback(S32 option, void *userdata)
 	}
 	else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
 	{
-		// Make sure we don't save the password if the user is trying to clear it.
-		std::string first, last, password;
-		LLPanelLogin::getFields(&first, &last, &password);
 		if (!gSavedSettings.getBOOL("RememberPassword"))
 		{
 			// turn off the setting and write out to disk
@@ -2169,142 +2104,6 @@ void login_callback(S32 option, void *userdata)
 	}
 }
 
-
-// static
-std::string LLStartUp::loadPasswordFromDisk()
-{
-	// Only load password if we also intend to save it (otherwise the user
-	// wonders what we're doing behind his back).  JC
-	BOOL remember_password = gSavedSettings.getBOOL("RememberPassword");
-	if (!remember_password)
-	{
-		return std::string("");
-	}
-
-	std::string hashed_password("");
-
-	// Look for legacy "marker" password from settings.ini
-	hashed_password = gSavedSettings.getString("Marker");
-	if (!hashed_password.empty())
-	{
-		// Stomp the Marker entry.
-		gSavedSettings.setString("Marker", "");
-
-		// Return that password.
-		return hashed_password;
-	}
-
-	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-													   "password.dat");
-	LLFILE* fp = LLFile::fopen(filepath, "rb");		/* Flawfinder: ignore */
-	if (!fp)
-	{
-		return hashed_password;
-	}
-
-	// UUID is 16 bytes, written into ASCII is 32 characters
-	// without trailing \0
-	const S32 HASHED_LENGTH = 32;
-	U8 buffer[HASHED_LENGTH+1];
-
-	if (1 != fread(buffer, HASHED_LENGTH, 1, fp))
-	{
-		return hashed_password;
-	}
-
-	fclose(fp);
-
-	// Decipher with MAC address
-	LLXORCipher cipher(gMACAddress, 6);
-	cipher.decrypt(buffer, HASHED_LENGTH);
-
-	buffer[HASHED_LENGTH] = '\0';
-
-	// Check to see if the mac address generated a bad hashed
-	// password. It should be a hex-string or else the mac adress has
-	// changed. This is a security feature to make sure that if you
-	// get someone's password.dat file, you cannot hack their account.
-	if(is_hex_string(buffer, HASHED_LENGTH))
-	{
-		hashed_password.assign((char*)buffer);
-	}
-
-	return hashed_password;
-}
-
-
-// static
-void LLStartUp::savePasswordToDisk(const std::string& hashed_password)
-{
-	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-													   "password.dat");
-	LLFILE* fp = LLFile::fopen(filepath, "wb");		/* Flawfinder: ignore */
-	if (!fp)
-	{
-		return;
-	}
-
-	// Encipher with MAC address
-	const S32 HASHED_LENGTH = 32;
-	U8 buffer[HASHED_LENGTH+1];
-
-	LLStringUtil::copy((char*)buffer, hashed_password.c_str(), HASHED_LENGTH+1);
-
-	LLXORCipher cipher(gMACAddress, 6);
-	cipher.encrypt(buffer, HASHED_LENGTH);
-
-	if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
-	{
-		LL_WARNS("AppInit") << "Short write" << LL_ENDL;
-	}
-
-	fclose(fp);
-}
-
-
-// static
-void LLStartUp::deletePasswordFromDisk()
-{
-	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-														  "password.dat");
-	LLFile::remove(filepath);
-}
-
-
-bool is_hex_string(U8* str, S32 len)
-{
-	bool rv = true;
-	U8* c = str;
-	while(rv && len--)
-	{
-		switch(*c)
-		{
-		case '0':
-		case '1':
-		case '2':
-		case '3':
-		case '4':
-		case '5':
-		case '6':
-		case '7':
-		case '8':
-		case '9':
-		case 'a':
-		case 'b':
-		case 'c':
-		case 'd':
-		case 'e':
-		case 'f':
-			++c;
-			break;
-		default:
-			rv = false;
-			break;
-		}
-	}
-	return rv;
-}
-
 void show_first_run_dialog()
 {
 	LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
@@ -2881,33 +2680,45 @@ bool process_login_success_response()
 	text = response["secure_session_id"].asString();
 	if(!text.empty()) gAgent.mSecureSessionID.set(text);
 
-	text = response["first_name"].asString();
-	if(!text.empty()) 
-	{
-		// Remove quotes from string.  Login.cgi sends these to force
-		// names that look like numbers into strings.
-		gFirstname.assign(text);
-		LLStringUtil::replaceChar(gFirstname, '"', ' ');
-		LLStringUtil::trim(gFirstname);
-	}
-	text = response["last_name"].asString();
-	if(!text.empty()) 
+	// if the response contains a display name, use that,
+	// otherwise if the response contains a first and/or last name,
+	// use those.  Otherwise use the credential identifier
+
+	gDisplayName = "";
+	if (response.has("display_name"))
 	{
-		gLastname.assign(text);
+		gDisplayName.assign(response["display_name"].asString());
+		if(!gDisplayName.empty())
+		{
+			// Remove quotes from string.  Login.cgi sends these to force
+			// names that look like numbers into strings.
+			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+			LLStringUtil::trim(gDisplayName);
+		}
 	}
-	gSavedSettings.setString("FirstName", gFirstname);
-	gSavedSettings.setString("LastName", gLastname);
-
-	if (gSavedSettings.getBOOL("RememberPassword"))
+	if(gDisplayName.empty())
 	{
-		// Successful login means the password is valid, so save it.
-		LLStartUp::savePasswordToDisk(gPassword);
+		if(response.has("first_name"))
+		{
+			gDisplayName.assign(response["first_name"].asString());
+			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
+			LLStringUtil::trim(gDisplayName);
+		}
+		if(response.has("last_name"))
+		{
+			text.assign(response["last_name"].asString());
+			LLStringUtil::replaceChar(text, '"', ' ');
+			LLStringUtil::trim(text);
+			if(!gDisplayName.empty())
+			{
+				gDisplayName += " ";
+			}
+			gDisplayName += text;
+		}
 	}
-	else
+	if(gDisplayName.empty())
 	{
-		// Don't leave password from previous session sitting around
-		// during this login session.
-		LLStartUp::deletePasswordFromDisk();
+		gDisplayName.assign(gUserCredential->asString());
 	}
 
 	// this is their actual ability to access content
@@ -3108,7 +2919,7 @@ bool process_login_success_response()
 
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
-	// in place.  Don't delete/clear user_credentials until then.
+	// in place.  Don't delete/clear gUserCredentials until then.
 	if(gAgentID.notNull()
 	   && gAgentSessionID.notNull()
 	   && gMessageSystem->mOurCircuitCode
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 92fe9521d3..28bc7fcd2a 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -101,14 +101,6 @@ public:
 	static void loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name );
 
-	// Load MD5 of user's password from local disk file.
-	static std::string loadPasswordFromDisk();
-	
-	// Record MD5 of user's password for subsequent login.
-	static void savePasswordToDisk(const std::string& hashed_password);
-	
-	// Delete the saved password local disk file.
-	static void deletePasswordFromDisk();
 	
 	static bool dispatchURL();
 		// if we have a SLURL or sim string ("Ahern/123/45") that started
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 1bff04352c..00f4454fab 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -424,7 +424,7 @@ void init_menus()
 	gPopupMenuView->setBackgroundColor( color );
 
 	// If we are not in production, use a different color to make it apparent.
-	if (LLViewerLogin::getInstance()->isInProductionGrid())
+	if (LLGridManager::getInstance()->isInProductionGrid())
 	{
 		color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
 	}
@@ -439,7 +439,7 @@ void init_menus()
 	gMenuHolder->addChild(gMenuBarView);
   
     gViewerWindow->setMenuBackgroundColor(false, 
-        LLViewerLogin::getInstance()->isInProductionGrid());
+        LLGridManager::getInstance()->isInProductionGrid());
 
 	// Assume L$10 for now, the server will tell us the real cost at login
 	// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
@@ -3415,7 +3415,7 @@ void set_god_level(U8 god_level)
         if(gViewerWindow)
         {
             gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
-            LLViewerLogin::getInstance()->isInProductionGrid());
+            LLGridManager::getInstance()->isInProductionGrid());
         }
     
         LLSD args;
@@ -3455,7 +3455,7 @@ BOOL check_toggle_hacked_godmode(void*)
 
 bool enable_toggle_hacked_godmode(void*)
 {
-  return !LLViewerLogin::getInstance()->isInProductionGrid();
+  return !LLGridManager::getInstance()->isInProductionGrid();
 }
 #endif
 
@@ -4320,7 +4320,7 @@ BOOL enable_take()
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid() 
+		if (!LLGridManager::getInstance()->isInProductionGrid() 
             && gAgent.isGodlike())
 		{
 			return TRUE;
@@ -4947,7 +4947,7 @@ bool enable_object_delete()
 	TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	(!LLViewerLogin::getInstance()->isInProductionGrid()
+	(!LLGridManager::getInstance()->isInProductionGrid()
      && gAgent.isGodlike()) ||
 # endif
 	LLSelectMgr::getInstance()->canDoDelete();
@@ -6556,7 +6556,7 @@ bool enable_object_take_copy()
 		all_valid = true;
 #ifndef HACKED_GODLIKE_VIEWER
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (LLViewerLogin::getInstance()->isInProductionGrid()
+		if (LLGridManager::getInstance()->isInProductionGrid()
             || !gAgent.isGodlike())
 # endif
 		{
@@ -6618,7 +6618,7 @@ BOOL enable_save_into_inventory(void*)
 	return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	if (!LLViewerLogin::getInstance()->isInProductionGrid()
+	if (!LLGridManager::getInstance()->isInProductionGrid()
         && gAgent.isGodlike())
 	{
 		return TRUE;
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index d7b55d7e97..fcfaf1eef2 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2009, Linden Research, Inc.
+ * Copyright (c) 2006-2007, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,13 +13,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -34,302 +33,462 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llviewernetwork.h"
+#include "llviewercontrol.h"
+#include "llsdserialize.h"
+#include "llweb.h"
 
-#include "llevents.h"
-#include "net.h"
+                                                            
+const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/";
 
-#include "llviewercontrol.h"
-#include "lllogin.h"
+const char* SYSTEM_GRID_SLURL_BASE = "http://slurl.com/secondlife/";
+const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
 
-struct LLGridData
-{
-	const char* mLabel;
-	const char* mName;
-	const char* mLoginURI;
-	const char* mHelperURI;
-};
+const char* DEFAULT_SLURL_BASE = "https://%s/region/";
+const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
 
-static LLGridData gGridInfo[GRID_INFO_COUNT] = 
+LLGridManager::LLGridManager()
 {
-	{ "None", "", "", ""},
-	{ "Aditi", 
-	  "util.aditi.lindenlab.com", 
-	  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
-	  "http://aditi-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Agni", 
-	  "util.agni.lindenlab.com", 
-	  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
-	  "https://secondlife.com/helpers/" },
-	{ "Aruna",
-	  "util.aruna.lindenlab.com",
-	  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
-	  "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Bharati",
-	  "util.bharati.lindenlab.com",
-	  "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",
-	  "http://bharati-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Chandra",
-	  "util.chandra.lindenlab.com",
-	  "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",
-	  "http://chandra-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Damballah",
-	  "util.damballah.lindenlab.com",
-	  "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",
-	  "http://damballah-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Danu",
-	  "util.danu.lindenlab.com",
-	  "https://login.danu.lindenlab.com/cgi-bin/login.cgi",
-	  "http://danu-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Durga",
-	  "util.durga.lindenlab.com",
-	  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
-	  "http://durga-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Ganga",
-	  "util.ganga.lindenlab.com",
-	  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
-	  "http://ganga-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Mitra",
-	  "util.mitra.lindenlab.com",
-	  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
-	  "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Mohini",
-	  "util.mohini.lindenlab.com",
-	  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
-	  "http://mohini-secondlife.webdev.lindenlab.com/helpers/" },
-  	{ "Nandi",
-	  "util.nandi.lindenlab.com",
-	  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
-	  "http://nandi-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Parvati",
-	  "util.parvati.lindenlab.com",
-	  "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",
-	  "http://parvati-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Radha",
-	  "util.radha.lindenlab.com",
-	  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
-	  "http://radha-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Ravi",
-	  "util.ravi.lindenlab.com",
-	  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
-	  "http://ravi-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Siva", 
-	  "util.siva.lindenlab.com",
-	  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
-	  "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Shakti",
-	  "util.shakti.lindenlab.com",
-	  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
-	  "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Skanda",
-	  "util.skanda.lindenlab.com",
-	  "https://login.skanda.lindenlab.com/cgi-bin/login.cgi",
-	  "http://skanda-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Soma",
-	  "util.soma.lindenlab.com",
-	  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
-	  "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Uma",
-	  "util.uma.lindenlab.com",
-	  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
-	  "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Vaak",
-	  "util.vaak.lindenlab.com",
-	  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
-	  "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Yami",
-	  "util.yami.lindenlab.com",
-	  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
-	  "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
-	{ "Local", 
-	  "localhost", 
-	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
-	  "" },
-	{ "Other", 
-	  "", 
-	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
-	  "" }
-};
-
-const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI;
-
-
-unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
-
-LLViewerLogin::LLViewerLogin() :
-	mGridChoice(DEFAULT_GRID_CHOICE)
+	// by default, we use the 'grids.xml' file in the user settings directory
+	// this file is an LLSD file containing multiple grid definitions.
+	// This file does not contain definitions for secondlife.com grids,
+	// as that would be a security issue when they are overwritten by
+	// an attacker.  Don't want someone snagging a password.
+	std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+														   "grids.xml");
+	initialize(grid_file);
+	
+}
+
+
+LLGridManager::LLGridManager(const std::string& grid_file)
 {
+	// initialize with an explicity grid file for testing.
+	initialize(grid_file);
 }
 
- LLViewerLogin::~LLViewerLogin() 
- {
- }
+//
+// LLGridManager - class for managing the list of known grids, and the current
+// selection
+//
+
+
+//
+// LLGridManager::initialze - initialize the list of known grids based
+// on the fixed list of linden grids (fixed for security reasons)
+// the grids.xml file
+// and the command line.
+void LLGridManager::initialize(const std::string& grid_file)
+{
+	// default grid list.
+	// Don't move to a modifiable file for security reasons,
+	mGridName.clear() ;
+	// set to undefined
+	mGridList = LLSD();
+	mGridFile = grid_file;
+	// as we don't want an attacker to override our grid list
+	// to point the default grid to an invalid grid
+	addSystemGrid("None", "", "", "", DEFAULT_LOGIN_PAGE);
+	
+
+
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+  	addSystemGrid("Agni",                                                                                             
+				  MAINGRID,                                               
+				  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",                    
+				  "https://secondlife.com/helpers/",     
+				  DEFAULT_LOGIN_PAGE);
+#else
+	addSystemGrid("Secondlife.com",                                                                                             
+				  MAINGRID,                                               
+				  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",                    
+				  "https://secondlife.com/helpers/",     
+				  DEFAULT_LOGIN_PAGE,
+				  "Agni");
+#endif // LL_RELEASE_FOR_DOWNLOAD	
+	addSystemGrid("Aditi",                                                                                             
+				  "util.aditi.lindenlab.com",                                              
+				  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://aditi-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Aruna",                                                                                            
+				  "util.aruna.lindenlab.com",                                              
+				  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://aruna-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Durga",                                                                                            
+				  "util.durga.lindenlab.com",                                              
+				  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://durga-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Ganga",                                                                                            
+				  "util.ganga.lindenlab.com",                                              
+				  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://ganga-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Mitra",                                                                                            
+				  "util.mitra.lindenlab.com",                                              
+				  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://mitra-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Mohini",                                                                                           
+				  "util.mohini.lindenlab.com",                                             
+				  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",                  
+				  "http://mohini-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Nandi",                                                                                            
+				  "util.nandi.lindenlab.com",                                              
+				  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://nandi-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Radha",                                                                                            
+				  "util.radha.lindenlab.com",                                              
+				  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",                   
+				  "http://radha-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Ravi",                                                                                             
+				  "util.ravi.lindenlab.com",                                               
+				  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",                    
+				  "http://ravi-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Siva",                                                                                             
+				  "util.siva.lindenlab.com",                                               
+				  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",                    
+				  "http://siva-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Shakti",                                                                                           
+				  "util.shakti.lindenlab.com",                                             
+				  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",                  
+				  "http://shakti-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Soma",                                                                                             
+				  "util.soma.lindenlab.com",                                               
+				  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",                    
+				  "http://soma-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	
+	addSystemGrid("Uma",                                                                                              
+				  "util.uma.lindenlab.com",                                                
+				  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",                     
+				  "http://uma-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Vaak",                                                                                             
+				  "util.vaak.lindenlab.com",                                               
+				  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",                    
+				  "http://vaak-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Yami",                                                                                             
+				  "util.yami.lindenlab.com",                                               
+				  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",                    
+				  "http://yami-secondlife.webdev.lindenlab.com/helpers/",
+				  DEFAULT_LOGIN_PAGE);
+	addSystemGrid("Local (Linden)",                                                                                    
+				  "localhost",                                                             
+				  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",                     
+				  "",
+				  DEFAULT_LOGIN_PAGE); 
+
+	
+	LLSD other_grids;
+	llifstream llsd_xml;
+	if (!grid_file.empty())
+	{
+		llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
 
-void LLViewerLogin::setGridChoice(EGridInfo grid)
-{	
-	if(grid < 0 || grid >= GRID_INFO_COUNT)
+		// parse through the gridfile, inserting grids into the list unless
+		// they overwrite a linden grid.
+		if( llsd_xml.is_open()) 
+		{
+			LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
+			if(other_grids.isMap())
+			{
+				for(LLSD::map_iterator grid_itr = other_grids.beginMap(); 
+					grid_itr != other_grids.endMap();
+					++grid_itr)
+				{
+					LLSD::String key_name = grid_itr->first;
+					LLSD grid = grid_itr->second;
+					// TODO:  Make sure gridfile specified label is not 
+					// a system grid label
+					LL_INFOS("GridManager") << "reading: " << key_name << LL_ENDL;
+					if (mGridList.has(key_name) &&
+						mGridList[key_name].has(GRID_IS_SYSTEM_GRID_VALUE))
+					{
+						LL_INFOS("GridManager") << "Cannot override grid " << key_name << " as it's a system grid" << LL_ENDL;
+						// If the system grid does exist in the grids file, and it's marked as a favorite, set it as a favorite.
+						if(grid_itr->second.has(GRID_IS_FAVORITE_VALUE) && grid_itr->second[GRID_IS_FAVORITE_VALUE].asBoolean() )
+						{
+							mGridList[key_name][GRID_IS_FAVORITE_VALUE] = TRUE;
+						}
+					}
+					else
+					{
+						try
+						{
+							addGrid(grid);
+							LL_INFOS("GridManager") << "Added grid: " << key_name << LL_ENDL;
+						}
+						catch (...)
+						{
+						}
+					}
+				}
+				llsd_xml.close();
+			}	
+		}     
+	}
+	
+	// load a grid from the command line.
+	// if the actual grid name is specified from the command line,
+	// set it as the 'selected' grid.
+	LLSD cmd_line_grid = gSavedSettings.getString("CmdLineGridChoice");
+	if (gSavedSettings.controlExists("CmdLineGridChoice"))
 	{
-		llerrs << "Invalid grid index specified." << llendl;
+		mGridName = gSavedSettings.getString("CmdLineGridChoice");
+		LL_INFOS("GridManager") << "Grid Name: " << mGridName << LL_ENDL;		
 	}
+	
+	// If a command line login URI was passed in, so we should add the command
+	// line grid to the list of grids
 
-	if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid)
+	LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI");
+	if (cmd_line_login_uri.isString())
 	{
-		mGridChoice = grid;
-		if(GRID_INFO_LOCAL == mGridChoice)
+		LL_INFOS("GridManager") << "adding cmd line login uri" << LL_ENDL;
+		// grab the other related URI values
+		std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
+		std::string cmd_line_login_page = gSavedSettings.getString("LoginPage");
+		
+		// we've a cmd line login, so add a grid for the command line,
+		// overwriting any existing grids
+		LLSD grid = LLSD::emptyMap();
+		grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+		grid[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri);
+		LL_INFOS("GridManager") << "cmd line login uri: " << cmd_line_login_uri.asString() << LL_ENDL;
+		LLURI uri(cmd_line_login_uri.asString());
+		if (mGridName.empty())
 		{
-			mGridName = LOOPBACK_ADDRESS_STRING;
+			// if a grid name was not passed in via the command line,
+			// then set the grid name based on the hostname of the 
+			// login uri
+			mGridName = uri.hostName();
 		}
-		else if(GRID_INFO_OTHER == mGridChoice)
+
+		grid[GRID_NAME_VALUE] = mGridName;
+
+		if (mGridList.has(mGridName) && mGridList[mGridName].has(GRID_LABEL_VALUE))
 		{
-			// *FIX:Mani - could this possibly be valid?
-			mGridName = "other"; 
+			grid[GRID_LABEL_VALUE] = mGridList[mGridName][GRID_LABEL_VALUE];
 		}
 		else
 		{
-			mGridName = gGridInfo[mGridChoice].mLabel;
+			grid[GRID_LABEL_VALUE] = mGridName;			
+		}
+		if(!cmd_line_helper_uri.empty())
+		{
+			grid[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri;
+		}
+
+		if(!cmd_line_login_page.empty())
+		{
+			grid[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page;
+		}
+		// if the login page, helper URI value, and so on are not specified,
+		// add grid will generate them.
+
+		// Also, we will override a system grid if values are passed in via the command
+		// line, for testing.  These values will not be remembered though.
+		if (mGridList.has(mGridName) && mGridList[mGridName].has(GRID_IS_SYSTEM_GRID_VALUE))
+		{
+			grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
 		}
+		addGrid(grid);
+	}
+	
+	// if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
+	if (mGridName.empty())
+	{
 
-		gSavedSettings.setS32("ServerChoice", mGridChoice);
-		gSavedSettings.setString("CustomServer", "");
+		mGridName = gSavedSettings.getString("CurrentGrid");
 	}
-}
 
-void LLViewerLogin::setGridChoice(const std::string& grid_name)
-{
-	// Set the grid choice based on a string.
-	// The string can be:
-	// - a grid label from the gGridInfo table 
-	// - an ip address
-    if(!grid_name.empty())
-    {
-        // find the grid choice from the user setting.
-        int grid_index = GRID_INFO_NONE; 
-        for(;grid_index < GRID_INFO_OTHER; ++grid_index)
-        {
-            if(0 == LLStringUtil::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name))
-            {
-				// Founding a matching label in the list...
-				setGridChoice((EGridInfo)grid_index);
-				break;
-            }
-        }
-
-        if(GRID_INFO_OTHER == grid_index)
-        {
-            // *FIX:MEP Can and should we validate that this is an IP address?
-            mGridChoice = GRID_INFO_OTHER;
-            mGridName = grid_name;
-			gSavedSettings.setS32("ServerChoice", mGridChoice);
-			gSavedSettings.setString("CustomServer", mGridName);
-        }
-    }
+	if (mGridName.empty() || !mGridList.has(mGridName))
+	{
+		// the grid name was empty, or the grid isn't actually in the list, then set it to the
+		// appropriate default.
+		LL_INFOS("GridManager") << "Resetting grid as grid name " << mGridName << " is not in the list" << LL_ENDL;
+#if LL_RELEASE_FOR_DOWNLOAD
+		mGridName = MAINGRID;
+#else
+		mGridName = "";
+#endif
+	}
+	LL_INFOS("GridManager") << "Selected grid is " << mGridName << LL_ENDL;		
+	gSavedSettings.setString("CurrentGrid", mGridName);
+
 }
 
-void LLViewerLogin::resetURIs()
+LLGridManager::~LLGridManager()
 {
-    // Clear URIs when picking a new server
-	gSavedSettings.setLLSD("CmdLineLoginURI", LLSD::emptyArray());
-	gSavedSettings.setString("CmdLineHelperURI", "");
+	saveFavorites();
 }
 
-EGridInfo LLViewerLogin::getGridChoice() const
+//
+// LLGridManager::addGrid - add a grid to the grid list, populating the needed values
+// if they're not populated yet.
+//
+
+void LLGridManager::addGrid(LLSD& grid_data)
 {
-	return mGridChoice;
+	if (grid_data.isMap() && grid_data.has(GRID_NAME_VALUE))
+	{
+		std::string grid_name = utf8str_tolower(grid_data[GRID_NAME_VALUE]);
+
+		// grid_name should be in the form of a dns address
+		if (!grid_name.empty() &&
+			grid_name.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
+		{
+			printf("grid name: %s", grid_name.c_str());
+			throw LLInvalidGridName(grid_name);
+		}
+		
+		// populate the other values if they don't exist
+		if (!grid_data.has(GRID_LABEL_VALUE)) 
+		{
+			grid_data[GRID_LABEL_VALUE] = grid_name;
+		}
+		if (!grid_data.has(GRID_ID_VALUE))
+		{
+			grid_data[GRID_ID_VALUE] = grid_name;
+		}
+		
+		// if the grid data doesn't include any of the URIs, then 
+		// generate them from the grid_name, which should be a dns address
+		if (!grid_data.has(GRID_LOGIN_URI_VALUE)) 
+		{
+			grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+			grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") + 
+													grid_name + "/cgi-bin/login.cgi");
+		}
+		// Populate to the default values
+		if (!grid_data.has(GRID_LOGIN_PAGE_VALUE)) 
+		{
+			grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid_name + "/app/login/";
+		}		
+		if (!grid_data.has(GRID_HELPER_URI_VALUE)) 
+		{
+			grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid_name + "/helpers/";
+		}		
+		LL_INFOS("GridManager") << "ADDING: " << grid_name << LL_ENDL;
+		mGridList[grid_name] = grid_data;		
+	}
 }
 
-std::string LLViewerLogin::getGridLabel() const
+//
+// LLGridManager::addSystemGrid - helper for adding a system grid.
+void LLGridManager::addSystemGrid(const std::string& label, 
+								  const std::string& name, 
+								  const std::string& login, 
+								  const std::string& helper,
+								  const std::string& login_page,
+								  const std::string& login_id)
 {
-	if(mGridChoice == GRID_INFO_NONE)
+	LLSD grid = LLSD::emptyMap();
+	grid[GRID_NAME_VALUE] = name;
+	grid[GRID_LABEL_VALUE] = label;
+	grid[GRID_HELPER_URI_VALUE] = helper;
+	grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
+	grid[GRID_LOGIN_URI_VALUE].append(login);
+	grid[GRID_LOGIN_PAGE_VALUE] = login_page;
+	grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
+	grid[GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE] = GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT;
+	grid[GRID_SLURL_BASE] = SYSTEM_GRID_SLURL_BASE;
+	grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
+	if (login_id.empty())
 	{
-		return "None";
+		grid[GRID_ID_VALUE] = name;
 	}
-	else if(mGridChoice < GRID_INFO_OTHER)
+	else
 	{
-		return gGridInfo[mGridChoice].mLabel;
+		grid[GRID_ID_VALUE] = login_id;
 	}
-
-	return mGridName;
-}
-
-std::string LLViewerLogin::getKnownGridLabel(EGridInfo grid_index) const
-{
-	if(grid_index > GRID_INFO_NONE && grid_index < GRID_INFO_OTHER)
+	
+	// only add the system grids beyond agni to the visible list
+	// if we're building a debug version.
+	if (name == std::string(MAINGRID))
 	{
-		return gGridInfo[grid_index].mLabel;
+		grid[GRID_IS_FAVORITE_VALUE] = TRUE;		
 	}
-	return gGridInfo[GRID_INFO_NONE].mLabel;
+	addGrid(grid);
 }
 
-void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
+// return a list of grid name -> grid label mappings for UI purposes
+std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
 {
-	// return the login uri set on the command line.
-	LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
-	if(c)
+	std::map<std::string, std::string> result;
+	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+		grid_iter != mGridList.endMap();
+		grid_iter++) 
 	{
-		LLSD v = c->getValue();
-		if(v.isArray())
+		if(!favorite_only || grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
 		{
-			for(LLSD::array_const_iterator itr = v.beginArray();
-				itr != v.endArray(); ++itr)
-			{
-				std::string uri = itr->asString();
-				if(!uri.empty())
-				{
-					uris.push_back(uri);
-				}
-			}
-		}
-		else
-		{
-			std::string uri = v.asString();
-			if(!uri.empty())
-			{
-				uris.push_back(uri);
-			}
+			result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
 		}
 	}
 
-	// If there was no command line uri...
-	if(uris.empty())
+	return result;
+}
+
+void LLGridManager::setGridChoice(const std::string& grid_name)
+{
+	// Set the grid choice based on a string.
+	// The string can be:
+	// - a grid label from the gGridInfo table 
+	// - a hostname
+	// - an ip address
+
+	// loop through.  We could do just a hash lookup but we also want to match
+	// on label
+	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+		grid_iter != mGridList.endMap();
+		grid_iter++) 
 	{
-		// If its a known grid choice, get the uri from the table,
-		// else try the grid name.
-		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+		if((grid_name == grid_iter->first) || 
+		   (grid_name == grid_iter->second[GRID_LABEL_VALUE].asString()))
 		{
-			uris.push_back(gGridInfo[mGridChoice].mLoginURI);
-		}
-		else
-		{
-			uris.push_back(mGridName);
+			mGridName = grid_iter->second[GRID_NAME_VALUE].asString();
+			gSavedSettings.setString("CurrentGrid", grid_iter->second[GRID_NAME_VALUE]);			
+			return; 
+
 		}
 	}
+	LLSD grid = LLSD::emptyMap();
+	grid[GRID_NAME_VALUE] = grid_name;
+	addGrid(grid);
+	mGridName = grid_name;
+	gSavedSettings.setString("CurrentGrid", grid_name);
 }
 
-std::string LLViewerLogin::getHelperURI() const
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
 {
-	std::string helper_uri = gSavedSettings.getString("CmdLineHelperURI");
-	if (helper_uri.empty())
+	uris.clear();
+	for (LLSD::array_iterator llsd_uri = mGridList[mGridName][GRID_LOGIN_URI_VALUE].beginArray();
+		 llsd_uri != mGridList[mGridName][GRID_LOGIN_URI_VALUE].endArray();
+		 llsd_uri++)
 	{
-		// grab URI from selected grid
-		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
-		{
-			helper_uri = gGridInfo[mGridChoice].mHelperURI;
-		}
-
-		if (helper_uri.empty())
-		{
-			// what do we do with unnamed/miscellaneous grids?
-			// for now, operations that rely on the helper URI (currency/land purchasing) will fail
-		}
+		uris.push_back(llsd_uri->asString());
 	}
-	return helper_uri;
 }
 
-bool LLViewerLogin::isInProductionGrid()
+bool LLGridManager::isInProductionGrid()
 {
 	// *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
 	// but it seems that loginURI trumps that.
 	std::vector<std::string> uris;
 	getLoginURIs(uris);
+	if (uris.size() < 1)
+	{
+		return 1;
+	}
 	LLStringUtil::toLower(uris[0]);
 	if((uris[0].find("agni") != std::string::npos))
 	{
@@ -338,3 +497,51 @@ bool LLViewerLogin::isInProductionGrid()
 
 	return false;
 }
+
+void LLGridManager::saveFavorites()
+{
+	// filter out just those marked as favorites
+	LLSD output_grid_list = LLSD::emptyMap();
+	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+		grid_iter != mGridList.endMap();
+		grid_iter++)
+	{
+		if(grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
+		{
+			output_grid_list[grid_iter->first] = grid_iter->second;
+		}
+	}       
+	llofstream llsd_xml;
+	llsd_xml.open( mGridFile.c_str(), std::ios::out | std::ios::binary);	
+	LLSDSerialize::toPrettyXML(output_grid_list, llsd_xml);
+	llsd_xml.close();
+}
+
+
+// build a slurl for the given region within the selected grid
+std::string LLGridManager::getSLURLBase(const std::string& grid_name)
+{
+	std::string grid_base;
+	if(mGridList.has(grid_name) && mGridList[grid_name].has(GRID_SLURL_BASE))
+	{
+		return mGridList[grid_name][GRID_SLURL_BASE].asString();
+	}
+	else
+	{
+		return  llformat(DEFAULT_SLURL_BASE, grid_name.c_str());
+	}
+}
+
+// build a slurl for the given region within the selected grid
+std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
+{
+	std::string grid_base;
+	if(mGridList.has(grid_name) && mGridList[grid_name].has(GRID_APP_SLURL_BASE))
+	{
+		return mGridList[grid_name][GRID_APP_SLURL_BASE].asString();
+	}
+	else
+	{
+		return  llformat(DEFAULT_APP_SLURL_BASE, grid_name.c_str());
+	}
+}
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index edae6dc47b..7b3ce9c499 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2009, Linden Research, Inc.
+ * Copyright (c) 2006-2007, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,13 +13,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -33,83 +32,137 @@
 
 #ifndef LL_LLVIEWERNETWORK_H
 #define LL_LLVIEWERNETWORK_H
+                                                                                                       
+extern const char* DEFAULT_LOGIN_PAGE;
+      
+#define GRID_NAME_VALUE "name"
+#define GRID_LABEL_VALUE "label"
+#define GRID_ID_VALUE "grid_login_id"
+#define GRID_LOGIN_URI_VALUE "login_uri"
+#define GRID_HELPER_URI_VALUE "helper_uri"
+#define GRID_LOGIN_PAGE_VALUE "login_page"
+#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
+#define GRID_IS_FAVORITE_VALUE "favorite"
+#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE "credential_type"
+#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT "agent"
+#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_ACCOUNT "account"
+#define MAINGRID "util.agni.lindenlab.com"
 
-#include <boost/scoped_ptr.hpp>
+// defines slurl formats associated with various grids.
+// we need to continue to support existing forms, as slurls
+// are shared between viewers that may not understand newer
+// forms.
+#define GRID_SLURL_BASE "slurl_base"
+#define GRID_APP_SLURL_BASE "app_slurl_base"
 
-class LLHost;
-class LLLogin;
-
-enum EGridInfo
+class LLInvalidGridName
 {
-	GRID_INFO_NONE,
-	GRID_INFO_ADITI,
-	GRID_INFO_AGNI,
-	GRID_INFO_ARUNA,
-	GRID_INFO_BHARATI,
-	GRID_INFO_CHANDRA,
-	GRID_INFO_DAMBALLAH,
-	GRID_INFO_DANU,
-	GRID_INFO_DURGA,
-	GRID_INFO_GANGA,
-	GRID_INFO_MITRA,
-	GRID_INFO_MOHINI,
-	GRID_INFO_NANDI,
-	GRID_INFO_PARVATI,
-	GRID_INFO_RADHA,
-	GRID_INFO_RAVI,
-	GRID_INFO_SIVA,
-	GRID_INFO_SHAKTI,
-	GRID_INFO_SKANDA,
-	GRID_INFO_SOMA,
-	GRID_INFO_UMA,
-	GRID_INFO_VAAK,
-	GRID_INFO_YAMI,
-	GRID_INFO_LOCAL,
-	GRID_INFO_OTHER, // IP address set via command line option
-	GRID_INFO_COUNT
+public:
+	LLInvalidGridName(std::string grid_name) : mGridName(grid_name)
+	{
+	}
+protected:
+	std::string mGridName;
 };
 
+
 /**
- * @brief A class to manage the viewer's login state.
+ * @brief A class to manage the grids available to the viewer
+ * including persistance.  This class also maintains the currently
+ * selected grid.
  * 
  **/
-class LLViewerLogin : public LLSingleton<LLViewerLogin>
+class LLGridManager : public LLSingleton<LLGridManager>
 {
 public:
-	LLViewerLogin();
-	~LLViewerLogin();
-
-	void setGridChoice(EGridInfo grid);
-	void setGridChoice(const std::string& grid_name);
-	void resetURIs();
+	
+	// when the grid manager is instantiated, the default grids are automatically
+	// loaded, and the grids favorites list is loaded from the xml file.
+	LLGridManager(const std::string& grid_file);
+	LLGridManager();
+	~LLGridManager();
+	
+	void initialize(const std::string& grid_file);
+	// grid list management
+	
+	// add a grid to the list of grids
+	void addGrid(LLSD& grid_info);	
 
-	/**
-	* @brief Get the enumeration of the grid choice.
-	* Should only return values > 0 && < GRID_INFO_COUNT
-	**/
-	EGridInfo getGridChoice() const;
-
-	/**
-	* @brief Get a readable label for the grid choice.
-	* Returns the readable name for the grid choice. 
-	* If the grid is 'other', returns something
-	* the string used to specifiy the grid.
-	**/
-	std::string getGridLabel() const; 
-
-	std::string getKnownGridLabel(EGridInfo grid_index) const; 
-
-	void getLoginURIs(std::vector<std::string>& uris) const;
-	std::string getHelperURI() const;
+	// retrieve a map of grid-name <-> label
+	// by default only return the user visible grids
+	std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE);
+	
+	LLSD getGridInfo(const std::string& grid_name)
+	{
+		if(mGridList.has(grid_name))
+		{
+			return mGridList[grid_name];
+		}
+		else
+		{
+			return LLSD();
+		}
+	}
+	
+	// current grid management
 
+	// select a given grid as the current grid.  If the grid
+	// is not a known grid, then it's assumed to be a dns name for the
+	// grid, and the various URIs will be automatically generated.
+	void setGridChoice(const std::string& grid_name);
+	
+	
+	std::string getGridLabel() 
+	{ 
+		return mGridList[mGridName][GRID_LABEL_VALUE]; 
+	} 	
+	std::string getGridName() const { return mGridName; }
+	void getLoginURIs(std::vector<std::string>& uris);
+	std::string getHelperURI() {return mGridList[mGridName][GRID_HELPER_URI_VALUE];}
+	std::string getLoginPage() {return mGridList[mGridName][GRID_LOGIN_PAGE_VALUE];}
+	std::string getGridID() { return mGridList[mGridName][GRID_ID_VALUE]; }	
+	std::string getLoginPage(const std::string& grid_name) { return mGridList[grid_name][GRID_LOGIN_PAGE_VALUE]; }
+	
+	// build a slurl for the given region within the selected grid
+	std::string getSLURLBase(const std::string& grid_name);
+	std::string getSLURLBase() { return getSLURLBase(mGridName); }
+	
+	std::string getAppSLURLBase(const std::string& grid_name);
+	std::string getAppSLURLBase() { return getAppSLURLBase(mGridName); }	
+	
+	LLSD getGridInfo() { return mGridList[mGridName]; }
+	
+	bool isSystemGrid(const std::string& grid) 
+	{ 
+		return mGridList.has(grid) &&
+		      mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) && 
+	           mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean(); 
+	}
+	bool isSystemGrid() { return isSystemGrid(mGridName); }
+	// Mark this grid as a favorite that should be persisited on 'save'
+	// this is currently used to persist a grid after a successful login
+	void setFavorite() { mGridList[mGridName][GRID_IS_FAVORITE_VALUE] = TRUE; }
+	
 	bool isInProductionGrid();
+	void saveFavorites();
+	void clearFavorites();
+
+protected:
 
-private:
-	EGridInfo mGridChoice;
+	// helper function for adding the predefined grids
+	void addSystemGrid(const std::string& label, 
+					   const std::string& name, 
+					   const std::string& login, 
+					   const std::string& helper,
+					   const std::string& login_page,
+					   const std::string& login_id = "");	
+	
+	
 	std::string mGridName;
+	std::string mGridFile;
+	LLSD mGridList;
 };
 
 const S32 MAC_ADDRESS_BYTES = 6;
-extern unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
 
 #endif
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 3c79045cc5..ce7b45bc11 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4705,7 +4705,7 @@ BOOL LLViewerObject::permYouOwner() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4742,7 +4742,7 @@ BOOL LLViewerObject::permOwnerModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4766,7 +4766,7 @@ BOOL LLViewerObject::permModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4790,7 +4790,7 @@ BOOL LLViewerObject::permCopy() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4814,7 +4814,7 @@ BOOL LLViewerObject::permMove() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4838,7 +4838,7 @@ BOOL LLViewerObject::permTransfer() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLViewerLogin::getInstance()->isInProductionGrid()
+		if (!LLGridManager::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 8059f866ba..3f9a10a4a6 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -767,9 +767,11 @@ void send_stats()
 	system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
 	system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	system["cpu"] = gSysCPU.getCPUString();
+	unsigned char MACAddress[MAC_ADDRESS_BYTES];
+	LLUUID::getNodeID(MACAddress);
 	std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
-											gMACAddress[0],gMACAddress[1],gMACAddress[2],
-											gMACAddress[3],gMACAddress[4],gMACAddress[5]);
+											MACAddress[0],MACAddress[1],MACAddress[2],
+											MACAddress[3],MACAddress[4],MACAddress[5]);
 	system["mac_address"] = macAddressString;
 	system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
 	std::string gpu_desc = llformat(
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 83cbc8a1f9..f8e08dbf7d 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1815,7 +1815,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
 
 		// ...and set the menu color appropriately.
 		setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT, 
-			LLViewerLogin::getInstance()->isInProductionGrid());
+			LLGridManager::getInstance()->isInProductionGrid());
 	}
         
 	if ( gStatusBar )
@@ -1836,15 +1836,15 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
     LLSD args;
     LLColor4 new_bg_color;
 
-    if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
+    if(god_mode && LLGridManager::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
     }
-    else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+    else if(god_mode && !LLGridManager::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
     }
-    else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
+    else if(!god_mode && !LLGridManager::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
     }
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 423c46e14c..fc264a6fcf 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1327,18 +1327,11 @@ void LLVoiceClient::connectorShutdown()
 	}
 }
 
-void LLVoiceClient::userAuthorized(const std::string& firstName, const std::string& lastName, const LLUUID &agentID)
+void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
 {
-	mAccountFirstName = firstName;
-	mAccountLastName = lastName;
+	LL_INFOS("Voice") << "name \"" << user_id << "\" , ID " << agentID << LL_ENDL;
 
-	mAccountDisplayName = firstName;
-	mAccountDisplayName += " ";
-	mAccountDisplayName += lastName;
-
-	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
-
-	sConnectingToAgni = LLViewerLogin::getInstance()->isInProductionGrid();
+	sConnectingToAgni = LLGridManager::getInstance()->isInProductionGrid();
 
 	mAccountName = nameFromID(agentID);
 }
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 724179847d..075834f7e0 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -428,10 +428,8 @@ static	void updatePosition(void);
 		void connectorShutdown();
 
 		void requestVoiceAccountProvision(S32 retries = 3);
-		void userAuthorized(
-			const std::string& firstName,
-			const std::string& lastName,
-			const LLUUID &agentID);
+	void userAuthorized(const std::string& user_id,
+						const LLUUID &agentID);
 		void login(
 			const std::string& account_name,
 			const std::string& password,
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 7866f735c5..45b4d3cad3 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -146,7 +146,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
 	substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
 	substitution["CHANNEL"] = LLVersionInfo::getChannel();
 	substitution["LANGUAGE"] = LLUI::getLanguage();
-	substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel();
+	substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
 	substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	substitution["SESSION_ID"] = gAgent.getSessionID();
 
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 6187b8f1e2..6b6013a6ee 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -47,19 +47,19 @@ auto_resize="false"
 follows="left|bottom"
 name="login"
 layout="topleft"
-width="695"
-min_width="695"
+width="775"
+min_width="775"
 user_resize="false"
 height="80">
 <text
 follows="left|bottom"
 font="SansSerifSmall"
 height="16"
-name="first_name_text"
+name="username_text"
 top="20"
 left="20"
 width="150">
-First name:
+Username:
 </text>
 <line_editor
 follows="left|bottom"
@@ -68,31 +68,11 @@ height="22"
 label="First"
 left_delta="0"
 max_length="31"
-name="first_name_edit"
+name="username_edit"
 select_on_focus="true"
-tool_tip="[SECOND_LIFE] First Name"
+tool_tip="[SECOND_LIFE] Username"
 top_pad="0"
-   width="135" />
-  <text
-   follows="left|bottom"
-   font="SansSerifSmall"
-   height="16"
-   left_pad="8"
-   name="last_name_text"
-   top="20"
-   width="150">
-    Last name:   </text>
-<line_editor
-follows="left|bottom"
-handle_edit_keys_directly="true"
-height="22"
-label="Last"
-max_length="31"
-name="last_name_edit"
-select_on_focus="true"
-tool_tip="[SECOND_LIFE] Last Name"
-  top_pad="0"
-  width="135" />
+width="150" />
 <text
 follows="left|bottom"
 font="SansSerifSmall"
@@ -152,18 +132,7 @@ name="MyHome"
 label="&lt;Type region name&gt;"
 name="Typeregionname"   value="" />
 </combo_box>
-<combo_box
-allow_text_entry="true"
-font="SansSerifSmall"
-   follows="left|right|bottom"
-   height="23"
-layout="topleft"
-top_pad="2"
-name="server_combo"
-width="135"
-  visible="false" />
 <button
-  follows="left|bottom"
   height="23"
   image_unselected="PushButton_On"
   image_selected="PushButton_On_Selected"
@@ -174,6 +143,16 @@ width="135"
   name="connect_btn"
   top="35"
   width="90" />
+<combo_box
+follows="left|bottom"
+allow_text_entry="true"
+font="SansSerifSmall"
+height="23"
+name="server_combo"
+left_pad="15"
+width="200"
+max_chars="255"
+visible="false" />
 </layout_panel>
 <layout_panel
 follows="right|bottom"
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 7b28a3b72c..9222882f5f 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -10,7 +10,10 @@
 // Precompiled header
 #include "../llviewerprecompiledheaders.h"
 // Own header
+#include "../llsecapi.h"
+#include "../llviewernetwork.h"
 #include "../lllogininstance.h"
+
 // STL headers
 // std headers
 // external library headers
@@ -54,17 +57,69 @@ void LLLogin::disconnect()
 	gDisconnectCalled = true;
 }
 
+LLSD LLCredential::getLoginParams()
+{
+	LLSD result = LLSD::emptyMap();
+
+	// legacy credential
+	result["passwd"] = "$1$testpasssd";
+	result["first"] = "myfirst";
+	result["last"] ="mylast";
+	return result;
+}
+
 //-----------------------------------------------------------------------------
 #include "../llviewernetwork.h"
-unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {'1','2','3','4','5','6'};		/* Flawfinder: ignore */
 
-LLViewerLogin::LLViewerLogin() {}
-LLViewerLogin::~LLViewerLogin() {}
-void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const 
+LLGridManager::~LLGridManager()
+{
+}
+
+void LLGridManager::addGrid(LLSD& grid_data)
+{
+}
+LLGridManager::LLGridManager()
+{	
+}
+
+void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
 {
 	uris.push_back(VIEWERLOGIN_URI);
 }
-std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; }
+
+void LLGridManager::addSystemGrid(const std::string& label, 
+								  const std::string& name, 
+								  const std::string& login, 
+								  const std::string& helper,
+								  const std::string& login_page,
+								  const std::string& login_id)
+{
+}
+std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+{
+	std::map<std::string, std::string> result;
+	return result;
+}
+
+void LLGridManager::setGridChoice(const std::string& grid_name)
+{
+}
+
+bool LLGridManager::isInProductionGrid()
+{
+	return false;
+}
+
+void LLGridManager::saveFavorites()
+{}
+std::string LLGridManager::getSLURLBase(const std::string& grid_name)
+{
+	return "myslurl";
+}
+std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
+{
+	return "myappslurl";
+}
 
 //-----------------------------------------------------------------------------
 #include "../llviewercontrol.h"
@@ -197,15 +252,29 @@ namespace tut
 			gSavedSettings.declareString("NextLoginLocation", "", "", FALSE);
 			gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE);
 
-			credentials["first"] = "testfirst";
-			credentials["last"] = "testlast";
-			credentials["passwd"] = "testpass";
+			LLSD authenticator = LLSD::emptyMap();
+			LLSD identifier = LLSD::emptyMap();
+			identifier["type"] = "agent";
+			identifier["first_name"] = "testfirst";
+			identifier["last_name"] = "testlast";
+			authenticator["passwd"] = "testpass";
+			agentCredential = new LLCredential();
+			agentCredential->setCredentialData(identifier, authenticator);
+			
+			authenticator = LLSD::emptyMap();
+			identifier = LLSD::emptyMap();
+			identifier["type"] = "account";
+			identifier["username"] = "testuser";
+			authenticator["secret"] = "testsecret";
+			accountCredential = new LLCredential();
+			accountCredential->setCredentialData(identifier, authenticator);			
 
 			logininstance->setNotificationsInterface(&notifications);
 		}
 
 		LLLoginInstance* logininstance;
-		LLSD credentials;
+		LLPointer<LLCredential> agentCredential;
+		LLPointer<LLCredential> accountCredential;
 		MockNotifications notifications;
     };
 
@@ -219,7 +288,7 @@ namespace tut
 		set_test_name("Test Simple Success And Disconnect");
 
 		// Test default connect.
-		logininstance->connect(credentials);
+		logininstance->connect(agentCredential);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -260,7 +329,7 @@ namespace tut
 		const std::string test_uri = "testing-uri";
 
 		// Test default connect.
-		logininstance->connect(test_uri, credentials);
+		logininstance->connect(test_uri, agentCredential);
 
 		// connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
 		ensure_equals("Default connect uri", gLoginURI, "testing-uri"); 
@@ -282,7 +351,7 @@ namespace tut
 		ensure("No TOS, failed auth", logininstance->authFailure());
 
 		// Start again.
-		logininstance->connect(test_uri, credentials);
+		logininstance->connect(test_uri, agentCredential);
 		gTestPump.post(response); // Fail for tos again.
 		gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
 		ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
@@ -294,11 +363,11 @@ namespace tut
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
 
-		logininstance->connect(test_uri, credentials);
+		logininstance->connect(test_uri, agentCredential);
 		ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
 
 		// Critical Message failure response.
-		logininstance->connect(test_uri, credentials);
+		logininstance->connect(test_uri, agentCredential);
 		response["data"]["reason"] = "critical"; // Change response to "critical message"
 		gTestPump.post(response);
 
@@ -312,7 +381,7 @@ namespace tut
 		response["data"]["reason"] = "key"; // bad creds.
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
-		logininstance->connect(test_uri, credentials);
+		logininstance->connect(test_uri, agentCredential);
 		ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
 	}
 
@@ -323,7 +392,7 @@ namespace tut
 
 		// Part 1 - Mandatory Update, with User accepts response.
 		// Test connect with update needed.
-		logininstance->connect(credentials);
+		logininstance->connect(agentCredential);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -349,7 +418,7 @@ namespace tut
 		set_test_name("Test Mandatory Update User Decline");
 
 		// Test connect with update needed.
-		logininstance->connect(credentials);
+		logininstance->connect(agentCredential);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -375,7 +444,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(credentials);
+		logininstance->connect(agentCredential);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -401,7 +470,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(credentials);
+		logininstance->connect(agentCredential);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
new file mode 100644
index 0000000000..a5554d55a5
--- /dev/null
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -0,0 +1,456 @@
+/** 
+ * @file llsechandler_basic_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the 'basic' sec handler functions
+ *
+ * $LicenseInfo:firstyear=2005&license=viewergpl$
+ * 
+ * Copyright (c) 2005-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../test/lltut.h"
+#include "../llsecapi.h"
+#include "../llsechandler_basic.h"
+#include "../../llxml/llcontrol.h"
+#include "../llviewernetwork.h"
+#include "lluuid.h"
+#include "llxorcipher.h"
+#include "apr_base64.h"
+#include <vector>
+#include <ios>
+#include <llsdserialize.h>
+#include <openssl/pem.h>
+#include "llxorcipher.h"
+
+LLControlGroup gSavedSettings;
+unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+	// Test wrapper declaration : wrapping nothing for the moment
+	struct sechandler_basic_test
+	{
+		std::string mPemTestCert;
+		std::string mDerFormat;
+		X509 *mX509TestCert;
+		LLBasicCertificate* mTestCert;
+
+		sechandler_basic_test()
+		{
+			LLFile::remove("test_password.dat");
+			LLFile::remove("sechandler_settings.tmp");			
+			mPemTestCert = "-----BEGIN CERTIFICATE-----\n"
+"MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIx\n"
+"EzARBgNVBAoTCklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25h\n"
+"bCBkZSBUZWNub2xvZ2lhIGRhIEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJy\n"
+"YXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UEAxMoQXV0b3JpZGFkZSBDZXJ0aWZp\n"
+"Y2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4MDBaFw0xMTExMzAy\n"
+"MzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsG\n"
+"A1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3Jt\n"
+"YWNhbyAtIElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYD\n"
+"VQQDEyhBdXRvcmlkYWRlIENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIB\n"
+"IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVA\n"
+"isamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma/3pUpgcfNAj0vYm5gsyj\n"
+"Qo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt4CyNrY50\n"
+"QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYt\n"
+"bRhFboUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbUR\n"
+"yEeNvZneVRKAAU6ouwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwID\n"
+"AQABo4HSMIHPME4GA1UdIARHMEUwQwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0\n"
+"cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQQ2FjcmFpei5wZGYwPQYDVR0f\n"
+"BDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0xDUmFj\n"
+"cmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB\n"
+"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1\n"
+"U/hgIh6OcgLAfiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGl\n"
+"YjJe+9zd+izPRbBqXPVQA34EXcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75Fos\n"
+"SzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQfS//JYeIc7Fue2JNLd00UOSMMaiK/\n"
+"t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr1ME7a55lFEnSeT0u\n"
+"mlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5nmPb\n"
+"K+9A46sd33oqK8n8\n"
+"-----END CERTIFICATE-----\n"
+"";
+			mDerFormat = "MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIxEzARBgNVBAoT"
+"CklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25hbCBkZSBUZWNub2xvZ2lhIGRh"
+"IEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJyYXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UE"
+"AxMoQXV0b3JpZGFkZSBDZXJ0aWZpY2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4"
+"MDBaFw0xMTExMzAyMzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9"
+"MDsGA1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3JtYWNhbyAt"
+"IElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYDVQQDEyhBdXRvcmlkYWRl"
+"IENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB"
+"CgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVAisamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma"
+"/3pUpgcfNAj0vYm5gsyjQo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt"
+"4CyNrY50QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYtbRhF"
+"boUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbURyEeNvZneVRKAAU6o"
+"uwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwIDAQABo4HSMIHPME4GA1UdIARHMEUw"
+"QwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQ"
+"Q2FjcmFpei5wZGYwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292"
+"LmJyL0xDUmFjcmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB"
+"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1U/hgIh6OcgLA"
+"fiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGlYjJe+9zd+izPRbBqXPVQA34E"
+"Xcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75FosSzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQf"
+"S//JYeIc7Fue2JNLd00UOSMMaiK/t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr"
+"1ME7a55lFEnSeT0umlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5"
+"nmPbK+9A46sd33oqK8n8";
+			
+			mTestCert = new LLBasicCertificate(mPemTestCert);
+			
+			gSavedSettings.cleanup();
+			gSavedSettings.declareString("FirstName", "", "", FALSE);
+			gSavedSettings.declareString("LastName", "", "", FALSE);
+			mX509TestCert = NULL;
+			BIO * validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
+			
+			PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
+			BIO_free(validation_bio);
+
+		}
+		~sechandler_basic_test()
+		{
+			LLFile::remove("test_password.dat");
+			LLFile::remove("sechandler_settings.tmp");
+			delete mTestCert;
+			X509_free(mX509TestCert);
+		}
+	};
+	
+	// Tut templating thingamagic: test group, object and test instance
+	typedef test_group<sechandler_basic_test> sechandler_basic_test_factory;
+	typedef sechandler_basic_test_factory::object sechandler_basic_test_object;
+	tut::sechandler_basic_test_factory tut_test("llsechandler_basic");
+	
+	// ---------------------------------------------------------------------------------------
+	// Test functions 
+	// ---------------------------------------------------------------------------------------
+	// test cert data retrieval
+	template<> template<>
+	void sechandler_basic_test_object::test<1>()
+	
+	{
+
+		char buffer[4096];
+
+		ensure_equals("Resultant pem is correct",
+			   mPemTestCert, mTestCert->getPem());
+		std::vector<U8> binary_cert = mTestCert->getBinary();
+
+		apr_base64_encode(buffer, (const char *)&binary_cert[0], binary_cert.size());
+		
+		ensure_equals("Der Format is correct", memcmp(buffer, mDerFormat.c_str(), mDerFormat.length()), 0);
+		
+		LLSD llsd_cert = mTestCert->getLLSD();
+		std::ostringstream llsd_value;
+		llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
+		std::string llsd_cert_str = llsd_value.str();
+		ensure_equals("Issuer Name/commonName", 
+			   (std::string)llsd_cert["issuer_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
+		ensure_equals("Issure Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "BR");
+		ensure_equals("Issuer Name/localityName", (std::string)llsd_cert["issuer_name"]["localityName"], "Brasilia");
+		ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "ICP-Brasil");
+		ensure_equals("IssuerName/org unit", 
+			   (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
+		ensure_equals("IssuerName/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "DF");
+		ensure_equals("Issuer name string", 
+			   (std::string)llsd_cert["issuer_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
+															   "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
+		ensure_equals("subject Name/commonName", 
+			   (std::string)llsd_cert["subject_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
+		ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "BR");
+		ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "Brasilia");
+		ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "ICP-Brasil");
+		ensure_equals("subjectName/org unit", 
+			   (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
+		ensure_equals("subjectName/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "DF");
+		ensure_equals("subject name string", 
+			   (std::string)llsd_cert["subject_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
+			                                                    "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
+		
+		ensure_equals("md5 digest", (std::string)llsd_cert["md5_digest"], "96:89:7d:61:d1:55:2b:27:e2:5a:39:b4:2a:6c:44:6f");
+		ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "04");
+		// sha1 digest is giving a weird value, and I've no idea why...feh
+		//ensure_equals("sha1 digest", (std::string)llsd_cert["sha1_digest"], "8e:fd:ca:bc:93:e6:1e:92:5d:4d:1d:ed:18:1a:43:20:a4:67:a1:39");
+		ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2001-11-30T20:58:00Z");
+		ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2011-12-01T07:59:00Z");
+		
+		ensure("x509 is equal", !X509_cmp(mX509TestCert, mTestCert->getOpenSSLX509()));
+	}
+
+	
+	// test protected data
+	template<> template<>
+	void sechandler_basic_test_object::test<2>()
+
+	{
+		unsigned char MACAddress[MAC_ADDRESS_BYTES];
+		LLUUID::getNodeID(MACAddress);
+		
+		std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u"
+		"GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO"
+		"nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq"
+		"4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr"
+		"82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA==";
+		
+		std::vector<U8> binary_data(apr_base64_decode_len(protected_data.c_str()));
+		apr_base64_decode_binary(&binary_data[0], protected_data.c_str());
+
+		LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+		cipher.decrypt(&binary_data[0], 16);
+		LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
+		cipher2.encrypt(&binary_data[0], 16);
+		std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary);
+		temp_file.write((const char *)&binary_data[0], binary_data.size());
+		temp_file.close();
+
+		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
+																		   "test_password.dat");
+		// data retrieval for existing data
+		LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
+
+
+		ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1");
+		ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2");
+		ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1");
+		
+		// data storage
+		LLSD store_data = LLSD::emptyMap();
+		store_data["store_data1"] = "test_store_data1";
+		store_data["store_data2"] = 27;
+		store_data["store_data3"] = LLSD::emptyMap();
+		store_data["store_data3"]["subelem1"] = "test_subelem1";
+		
+		handler->setProtectedData("test_data_type", "test_data_id1", store_data);
+		data = handler->getProtectedData("test_data_type", "test_data_id");
+		
+		data = handler->getProtectedData("test_data_type", "test_data_id");
+		// verify no overwrite of existing data
+		ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1");
+		ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2");
+		ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1");
+		
+		// verify written data is good
+		data = handler->getProtectedData("test_data_type", "test_data_id1");
+		ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1");
+		ensure_equals("verify stored data2", (int)data["store_data2"], 27);
+		ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+		
+		// verify overwrite works
+		handler->setProtectedData("test_data_type", "test_data_id", store_data);	
+		data = handler->getProtectedData("test_data_type", "test_data_id");
+		ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1");
+		ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27);
+		ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
+		
+		// verify other datatype doesn't conflict
+		store_data["store_data3"] = "test_store_data3";
+		store_data["store_data4"] = 28;
+		store_data["store_data5"] = LLSD::emptyMap();
+		store_data["store_data5"]["subelem2"] = "test_subelem2";
+		
+		handler->setProtectedData("test_data_type1", "test_data_id", store_data);	
+		data = handler->getProtectedData("test_data_type1", "test_data_id");
+		ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3");
+		ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28);
+		ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2");	
+		
+		// test data not found
+
+		data = handler->getProtectedData("test_data_type1", "test_data_not_found");
+		ensure("not found", data.isUndefined());
+
+		// cause a 'write' by using 'LLPointer' to delete then instantiate a handler
+		handler = NULL;
+		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+
+		data = handler->getProtectedData("test_data_type1", "test_data_id");
+		ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
+		ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28);
+		ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2");	
+		
+		// rewrite the initial file to verify reloads
+		handler = NULL;
+		std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary);
+		temp_file2.write((const char *)&binary_data[0], binary_data.size());
+		temp_file2.close();
+		
+		// cause a 'write'
+		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		data = handler->getProtectedData("test_data_type1", "test_data_id");
+		ensure("not found", data.isUndefined());
+		
+		handler->deleteProtectedData("test_data_type", "test_data_id");
+		ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined());
+		
+		LLFile::remove("sechandler_settings.tmp");
+		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		data = handler->getProtectedData("test_data_type1", "test_data_id");
+		ensure("not found", data.isUndefined());
+		handler = NULL;
+		
+		ensure(LLFile::isfile("sechandler_settings.tmp"));
+	}
+	
+	// test credenitals
+	template<> template<>
+	void sechandler_basic_test_object::test<3>()
+	{
+		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		
+
+		LLSD my_id = LLSD::emptyMap();
+		LLSD my_authenticator = LLSD::emptyMap();
+		my_id["type"] = "test_type";
+		my_id["username"] = "testuser@lindenlab.com";
+		my_authenticator["type"] = "test_auth";
+		my_authenticator["creds"] = "12345";
+
+		// test creation of credentials		
+		LLPointer<LLCredential> my_cred = handler->createCredential("my_grid", my_id, my_authenticator);
+
+		// test retrieval of credential components
+		ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier());
+		ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator());
+		ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid());
+		
+		// test setting/overwriting of credential components
+		my_id["first_name"] = "firstname";
+		my_id.erase("username");
+		my_authenticator.erase("creds");
+		my_authenticator["hash"] = "6563245";
+		
+		my_cred->setCredentialData(my_id, my_authenticator);
+		ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier());
+		ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator());
+		ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid());		
+			
+		// test loading of a credential, that hasn't been saved, without
+		// any legacy saved credential data
+		LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid");
+		ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
+		ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));		
+		ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
+		ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type"));	
+		// test saving of a credential
+		handler->saveCredential(my_cred, true);
+
+		// test loading of a known credential
+		my_new_cred = handler->loadCredential("my_grid");
+		ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier());
+		ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator());
+		ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid());
+	
+		// test deletion of a credential
+		handler->deleteCredential(my_new_cred);
+
+		ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined());
+		ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined());
+		ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid());		
+		// load unknown cred
+		
+		my_new_cred = handler->loadCredential("my_grid");
+		ensure("deleted credential load test", my_new_cred->getIdentifier().isMap());
+		ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type"));		
+		ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap());
+		ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type"));
+		
+		// test loading of an unknown credential with legacy saved username, but without
+		// saved password
+
+		gSavedSettings.setString("FirstName", "myfirstname");
+		gSavedSettings.setString("LastName", "mylastname");
+
+		my_new_cred = handler->loadCredential("my_legacy_grid");
+		ensure_equals("legacy credential with no password: type", 
+					  (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+		ensure_equals("legacy credential with no password: first_name", 
+					  (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+		ensure_equals("legacy credential with no password: last_name",
+					  (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+		
+		ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined());
+		
+		// test loading of an unknown credential with legacy saved password and username
+
+		std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ=";		
+		int length = apr_base64_decode_len(hashed_password.c_str());
+		std::vector<char> decoded_password(length);
+		apr_base64_decode(&decoded_password[0], hashed_password.c_str());
+		unsigned char MACAddress[MAC_ADDRESS_BYTES];
+		LLUUID::getNodeID(MACAddress);
+		LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
+		cipher.decrypt((U8*)&decoded_password[0], length);
+		LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
+		cipher2.encrypt((U8*)&decoded_password[0], length);
+		llofstream password_file("test_password.dat", std::ofstream::binary);
+		password_file.write(&decoded_password[0], length); 
+		password_file.close();
+		
+		my_new_cred = handler->loadCredential("my_legacy_grid2");		
+		ensure_equals("legacy credential with password: type", 
+					  (const std::string)my_new_cred->getIdentifier()["type"], "agent");
+		ensure_equals("legacy credential with password: first_name", 
+					  (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
+		ensure_equals("legacy credential with password: last_name",
+					  (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
+		
+		LLSD legacy_authenticator = my_new_cred->getAuthenticator();
+		ensure_equals("legacy credential with password: type", 
+					  (std::string)legacy_authenticator["type"], 
+					  "hash");
+		ensure_equals("legacy credential with password: algorithm", 
+					  (std::string)legacy_authenticator["algorithm"], 
+					  "md5");	
+		ensure_equals("legacy credential with password: algorithm", 
+					  (std::string)legacy_authenticator["secret"], 
+					  "01234567890123456789012345678901");
+		
+		// test creation of credentials		
+		my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
+		// test save without saving authenticator. 		
+		handler->saveCredential(my_cred, FALSE);
+		my_new_cred = handler->loadCredential("mysavedgrid");	
+		ensure_equals("saved credential without auth", 
+					  (const std::string)my_new_cred->getIdentifier()["type"], "test_type");
+		ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
+	}
+
+
+	// test cert store
+	template<> template<>
+	void sechandler_basic_test_object::test<4>()
+	{
+		// instantiate a cert store from a file
+		llofstream certstorefile("mycertstore.pem", std::ios::out | std::ios::binary);
+
+		certstorefile << mPemTestCert;
+		certstorefile.close();
+		// LLBasicCertificateStore test_store("mycertstore.pem");
+		// X509* test_cert = test_store[0]->getOpenSSLX509();
+
+		// ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+	}
+};
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
new file mode 100644
index 0000000000..c7a6b2ad15
--- /dev/null
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -0,0 +1,446 @@
+/** 
+ * @file llviewernetwork_test.cpp
+ * @author Roxie
+ * @date 2009-03-9
+ * @brief Test the viewernetwork functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../../llxml/llcontrol.h"
+#include "llfile.h"
+
+LLControlGroup gSavedSettings;
+const char *gSampleGridFile = "<llsd><map>"
+"<key>grid1</key><map>"
+"  <key>favorite</key><integer>1</integer>"
+"  <key>helper_uri</key><string>https://helper1/helpers/</string>"
+"  <key>label</key><string>mylabel</string>"
+"  <key>login_page</key><string>loginpage</string>"
+"  <key>login_uri</key><array><string>myloginuri</string></array>"
+"  <key>name</key><string>grid1</string>"
+"  <key>visible</key><integer>1</integer>"
+"  <key>credential_type</key><string>agent</string>"
+"  <key>grid_login_id</key><string>MyGrid</string>"
+"</map>"
+"<key>util.agni.lindenlab.com</key><map>"
+"  <key>favorite</key><integer>1</integer>"
+"  <key>helper_uri</key><string>https://helper1/helpers/</string>"
+"  <key>label</key><string>mylabel</string>"
+"  <key>login_page</key><string>loginpage</string>"
+"  <key>login_uri</key><array><string>myloginuri</string></array>"
+"  <key>name</key><string>util.agni.lindenlab.com</string>"
+"</map></map></llsd>";
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+  // Test wrapper declaration : wrapping nothing for the moment
+  struct viewerNetworkTest
+	{
+		viewerNetworkTest()
+		{
+			gSavedSettings.cleanup();
+			gSavedSettings.cleanup();
+			gSavedSettings.declareString("CmdLineGridChoice", "", "", FALSE);
+			gSavedSettings.declareString("CmdLineHelperURI", "", "", FALSE);
+			gSavedSettings.declareString("LoginPage", "", "", FALSE);
+			gSavedSettings.declareString("CurrentGrid", "", "", FALSE);
+			gSavedSettings.declareLLSD("CmdLineLoginURI", LLSD(), "", FALSE);
+		}
+		~viewerNetworkTest()
+		{
+			LLFile::remove("grid_test.xml");
+		}
+	};
+	
+	// Tut templating thingamagic: test group, object and test instance
+	typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
+	typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
+	tut::viewerNetworkTestFactory tut_test("llviewernetwork");
+	
+	// ---------------------------------------------------------------------------------------
+	// Test functions 
+	// ---------------------------------------------------------------------------------------
+	// initialization without a grid file
+	template<> template<>
+	void viewerNetworkTestObject::test<1>()
+	{
+
+		LLGridManager manager("grid_test.xml");
+		// validate that some of the defaults are available.
+		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 18);
+#else // LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 2);
+#endif // LL_RELEASE_FOR_DOWNLOAD
+
+		ensure_equals("Agni has the right name and label", 
+					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
+		ensure_equals("None exists", known_grids[""], "None");
+		
+		LLSD grid = manager.getGridInfo("util.agni.lindenlab.com");
+		ensure("Grid info for agni is a map", grid.isMap());
+		ensure_equals("name is correct for agni", 
+					  grid[GRID_NAME_VALUE].asString(), std::string("util.agni.lindenlab.com"));
+#ifndef LL_RELEASE_FOR_DOWNLOAD		
+		ensure_equals("label is correct for agni", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
+#else // LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("label is correct for agni", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));		
+#endif // LL_RELEASE_FOR_DOWNLOAD
+		ensure("Login URI is an array", 
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("Agni login uri is correct", 
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
+					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+		ensure_equals("Agni helper uri is correct",
+					  grid[GRID_HELPER_URI_VALUE].asString(), 
+					  std::string("https://secondlife.com/helpers/"));
+		ensure_equals("Agni login page is correct",
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
+					  std::string("http://secondlife.com/app/login/"));
+		ensure("Agni is not a favorite",
+			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("Agni is a system grid", 
+			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+		ensure("Grid file wasn't greated as it wasn't saved", 
+			   !LLFile::isfile("grid_test.xml"));
+	}
+	
+	// initialization with a grid file
+	template<> template<>
+	void viewerNetworkTestObject::test<2>()
+	{
+		llofstream gridfile("grid_test.xml");
+		gridfile << gSampleGridFile;
+		gridfile.close();
+		
+		LLGridManager manager("grid_test.xml");
+		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("adding a grid via a grid file increases known grid size", 
+					  known_grids.size(), 19);
+#else
+		ensure_equals("adding a grid via a grid file increases known grid size", 
+					  known_grids.size(), 3);
+#endif
+		ensure_equals("Agni is still there after we've added a grid via a grid file", 
+					  known_grids["util.agni.lindenlab.com"], std::string("Agni"));
+	
+		// assure Agni doesn't get overwritten
+		LLSD grid = manager.getGridInfo("util.agni.lindenlab.com");
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("Agni grid label was not modified by grid file", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
+#else \\ LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("Agni grid label was not modified by grid file", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));
+#endif \\ LL_RELEASE_FOR_DOWNLOAD
+		
+		ensure_equals("Agni name wasn't modified by grid file",
+					  grid[GRID_NAME_VALUE].asString(), std::string("util.agni.lindenlab.com"));
+		ensure("Agni grid URI is still an array after grid file", 
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("Agni login uri still the same after grid file", 
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(),  
+					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+		ensure_equals("Agni helper uri still the same after grid file", 
+					  grid[GRID_HELPER_URI_VALUE].asString(), 
+					  std::string("https://secondlife.com/helpers/"));
+		ensure_equals("Agni login page the same after grid file", 
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
+					  std::string("http://secondlife.com/app/login/"));
+		ensure("Agni still not favorite after grid file", 
+			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("Agni system grid still set after grid file", 
+			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+		
+		ensure_equals("Grid file adds to name<->label map", 
+					  known_grids["grid1"], std::string("mylabel"));
+		grid = manager.getGridInfo("grid1");
+		ensure_equals("grid file grid name is set",
+					  grid[GRID_NAME_VALUE].asString(), std::string("grid1"));
+		ensure_equals("grid file label is set", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("mylabel"));
+		ensure("grid file login uri is an array",
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("grid file login uri is set",
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
+					  std::string("myloginuri"));
+		ensure_equals("grid file helper uri is set",
+					  grid[GRID_HELPER_URI_VALUE].asString(), 
+					  std::string("https://helper1/helpers/"));
+		ensure_equals("grid file login page is set",
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
+					  std::string("loginpage"));
+		ensure("grid file favorite is set",
+			   grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("grid file isn't a system grid",
+			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));		
+		ensure("Grid file still exists after loading", 
+			   LLFile::isfile("grid_test.xml"));
+	}
+	
+	// Initialize via command line
+	
+	template<> template<>
+	void viewerNetworkTestObject::test<3>()
+	{	
+		LLSD loginURI = std::string("https://my.login.uri/cgi-bin/login.cgi");
+		gSavedSettings.setLLSD("CmdLineLoginURI", loginURI);
+		LLGridManager manager("grid_test.xml");
+		
+		// with single login uri specified.
+		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("adding a command line grid increases known grid size", 
+					  known_grids.size(), 19);
+#else
+		ensure_equals("adding a command line grid increases known grid size", 
+					  known_grids.size(), 3);
+#endif
+		ensure_equals("Command line grid is added to the list of grids", 
+					  known_grids["my.login.uri"], std::string("my.login.uri"));
+		LLSD grid = manager.getGridInfo("my.login.uri");
+		ensure_equals("Command line grid name is set",
+					  grid[GRID_NAME_VALUE].asString(), std::string("my.login.uri"));
+		ensure_equals("Command line grid label is set", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("my.login.uri"));
+		ensure("Command line grid login uri is an array",
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("Command line grid login uri is set",
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
+					  std::string("https://my.login.uri/cgi-bin/login.cgi"));
+		ensure_equals("Command line grid helper uri is set",
+					  grid[GRID_HELPER_URI_VALUE].asString(), 
+					  std::string("https://my.login.uri/helpers/"));
+		ensure_equals("Command line grid login page is set",
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
+					  std::string("http://my.login.uri/app/login/"));
+		ensure("Command line grid favorite is set",
+			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("Command line grid isn't a system grid",
+			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));		
+		
+		// now try a command line with a custom grid identifier
+		gSavedSettings.setString("CmdLineGridChoice", "mycustomgridchoice");
+		manager = LLGridManager("grid_test.xml");
+		known_grids = manager.getKnownGrids();
+#ifndef LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("adding a command line grid with custom name increases known grid size", 
+					  known_grids.size(), 19);
+#else
+		ensure_equals("adding a command line grid with custom name inceases known grid size", 
+					  known_grids.size(), 3);
+#endif
+		ensure_equals("Custom Command line grid is added to the list of grids", 
+					  known_grids["mycustomgridchoice"], std::string("mycustomgridchoice"));
+		grid = manager.getGridInfo("mycustomgridchoice");
+		ensure_equals("Custom Command line grid name is set",
+					  grid[GRID_NAME_VALUE].asString(), std::string("mycustomgridchoice"));
+		ensure_equals("Custom Command line grid label is set", 
+					  grid[GRID_LABEL_VALUE].asString(), std::string("mycustomgridchoice"));		
+		ensure("Custom Command line grid login uri is an array",
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("Custom Command line grid login uri is set",
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
+					  std::string("https://my.login.uri/cgi-bin/login.cgi"));
+		
+		// add a helperuri
+		gSavedSettings.setString("CmdLineHelperURI", "myhelperuri");
+		manager = LLGridManager("grid_test.xml");
+		grid = manager.getGridInfo("mycustomgridchoice");		
+		ensure_equals("Validate command line helper uri", 
+					  grid[GRID_HELPER_URI_VALUE].asString(), std::string("myhelperuri"));		
+		
+		// add a login page
+		gSavedSettings.setString("LoginPage", "myloginpage");
+		manager = LLGridManager("grid_test.xml");
+		grid = manager.getGridInfo("mycustomgridchoice");		
+		ensure_equals("Validate command line helper uri", 
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(), std::string("myloginpage"));			
+	}
+	
+	// validate grid selection
+	template<> template<>
+	void viewerNetworkTestObject::test<4>()
+	{	
+		LLSD loginURI = LLSD::emptyArray();
+		LLSD grid = LLSD::emptyMap();
+		// adding a grid with simply a name will populate the values.
+		grid[GRID_NAME_VALUE] = "myaddedgrid";
+
+		loginURI.append(std::string("https://my.login.uri/cgi-bin/login.cgi"));
+		gSavedSettings.setLLSD("CmdLineLoginURI", loginURI);
+		LLGridManager manager("grid_test.xml");
+		manager.addGrid(grid);
+		manager.setGridChoice("util.agni.lindenlab.com");
+#ifndef LL_RELEASE_FOR_DOWNLOAD		
+		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("Agni"));
+#else // LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("Secondlife.com"));		
+#endif // LL_RELEASE_FOR_DOWNLOAD
+		ensure_equals("getGridName", manager.getGridName(), 
+					  std::string("util.agni.lindenlab.com"));
+		ensure_equals("getHelperURI", manager.getHelperURI(), 
+					  std::string("https://secondlife.com/helpers/"));
+		ensure_equals("getLoginPage", manager.getLoginPage(), 
+					  std::string("http://secondlife.com/app/login/"));
+		ensure_equals("getLoginPage2", manager.getLoginPage("util.agni.lindenlab.com"), 
+					  std::string("http://secondlife.com/app/login/"));
+		ensure("Is Agni a production grid", manager.isInProductionGrid());		
+		std::vector<std::string> uris;
+		manager.getLoginURIs(uris);
+		ensure_equals("getLoginURIs size", uris.size(), 1);
+		ensure_equals("getLoginURIs", uris[0], 
+					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
+		manager.setGridChoice("myaddedgrid");
+		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("myaddedgrid"));		
+		ensure("Is myaddedgrid a production grid", !manager.isInProductionGrid());
+		
+		manager.setFavorite();
+		grid = manager.getGridInfo("myaddedgrid");
+		ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE));
+	}
+	
+	// name based grid population
+	template<> template<>
+	void viewerNetworkTestObject::test<5>()
+	{
+		LLGridManager manager("grid_test.xml");
+		LLSD grid = LLSD::emptyMap();
+		// adding a grid with simply a name will populate the values.
+		grid[GRID_NAME_VALUE] = "myaddedgrid";
+		manager.addGrid(grid);
+		grid = manager.getGridInfo("myaddedgrid");
+		
+		ensure_equals("name based grid has name value", 
+					  grid[GRID_NAME_VALUE].asString(),
+					  std::string("myaddedgrid"));
+		ensure_equals("name based grid has label value", 
+					  grid[GRID_LABEL_VALUE].asString(),
+					  std::string("myaddedgrid"));
+		ensure_equals("name based grid has name value", 
+					  grid[GRID_HELPER_URI_VALUE].asString(),
+					  std::string("https://myaddedgrid/helpers/"));
+		ensure_equals("name based grid has name value", 
+					  grid[GRID_LOGIN_PAGE_VALUE].asString(),
+					  std::string("http://myaddedgrid/app/login/"));
+		ensure("name based grid has array loginuri", 
+			   grid[GRID_LOGIN_URI_VALUE].isArray());
+		ensure_equals("name based grid has single login uri value",
+			   grid[GRID_LOGIN_URI_VALUE].size(), 1);
+		ensure_equals("Name based grid login uri is correct",
+					  grid[GRID_LOGIN_URI_VALUE][0].asString(),
+					  std::string("https://myaddedgrid/cgi-bin/login.cgi"));
+		ensure("name based grid is not a favorite yet", 
+			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("name based grid does not have system setting",
+			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
+		
+		llofstream gridfile("grid_test.xml");
+		gridfile << gSampleGridFile;
+		gridfile.close();
+	}
+	
+	// persistence of the grid list with an empty gridfile.
+	template<> template<>
+	void viewerNetworkTestObject::test<6>()
+	{
+		// try with initial grid list without a grid file,
+		// without setting the grid to a saveable favorite.
+		LLGridManager manager("grid_test.xml");
+		LLSD grid = LLSD::emptyMap();
+		grid[GRID_NAME_VALUE] = std::string("mynewgridname");
+		manager.addGrid(grid);
+		manager.saveFavorites();
+		ensure("Grid file exists after saving", 
+			   LLFile::isfile("grid_test.xml"));
+		manager = LLGridManager("grid_test.xml");
+		// should not be there
+		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		ensure("New grid wasn't added to persisted list without being marked a favorite",
+					  known_grids.find(std::string("mynewgridname")) == known_grids.end());
+		
+		// mark a grid a favorite to make sure it's persisted
+		manager.addGrid(grid);
+		manager.setGridChoice("mynewgridname");
+		manager.setFavorite();
+		manager.saveFavorites();
+		ensure("Grid file exists after saving", 
+			   LLFile::isfile("grid_test.xml"));
+		manager = LLGridManager("grid_test.xml");
+		// should not be there
+		known_grids = manager.getKnownGrids();
+		ensure("New grid wasn't added to persisted list after being marked a favorite",
+					  known_grids.find(std::string("mynewgridname")) !=
+					  known_grids.end());
+	}
+	
+	// persistence of the grid file with existing gridfile
+	template<> template<>
+	void viewerNetworkTestObject::test<7>()
+	{
+		
+		llofstream gridfile("grid_test.xml");
+		gridfile << gSampleGridFile;
+		gridfile.close();
+		
+		LLGridManager manager("grid_test.xml");
+		LLSD grid = LLSD::emptyMap();
+		grid[GRID_NAME_VALUE] = std::string("mynewgridname");
+		manager.addGrid(grid);
+		manager.saveFavorites();
+		// validate we didn't lose existing favorites
+		manager = LLGridManager("grid_test.xml");
+		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		ensure("New grid wasn't added to persisted list after being marked a favorite",
+			   known_grids.find(std::string("grid1")) !=
+			   known_grids.end());
+		
+		// add a grid
+		manager.addGrid(grid);
+		manager.setGridChoice("mynewgridname");
+		manager.setFavorite();
+		manager.saveFavorites();
+		known_grids = manager.getKnownGrids();
+		ensure("New grid wasn't added to persisted list after being marked a favorite",
+			   known_grids.find(std::string("grid1")) !=
+			   known_grids.end());
+		known_grids = manager.getKnownGrids();
+		ensure("New grid wasn't added to persisted list after being marked a favorite",
+			   known_grids.find(std::string("mynewgridname")) !=
+			   known_grids.end());
+	}
+}
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index f5bda71846..7723c3ca8f 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -122,29 +122,34 @@ private:
 	LLSD mAuthResponse, mValidAuthResponse;
 };
 
-void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials)
+void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
 {
+    LL_DEBUGS("LLLogin") << " connect with  uri '" << uri << "', login_params " << login_params << LL_ENDL;
+	
     // Launch a coroutine with our login_() method. Run the coroutine until
     // its first wait; at that point, return here.
     std::string coroname = 
         LLCoros::instance().launch("LLLogin::Impl::login_",
-                                   boost::bind(&Impl::login_, this, _1, uri, credentials));
+                                   boost::bind(&Impl::login_, this, _1, uri, login_params));
 }
 
-void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credentials)
+void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params)
 {
-	LLSD printable_credentials = credentials;
-	if(printable_credentials.has("params") 
-		&& printable_credentials["params"].has("passwd")) 
+	try
 	{
-		printable_credentials["params"]["passwd"] = "*******";
-	}
+	LLSD printable_params = login_params;
+	//if(printable_params.has("params") 
+	//	&& printable_params["params"].has("passwd")) 
+	//{
+	//	printable_params["params"]["passwd"] = "*******";
+	//}
     LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self)
-                        << " with uri '" << uri << "', credentials " << printable_credentials << LL_ENDL;
+                        << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL;
 
 	// Arriving in SRVRequest state
     LLEventStream replyPump("reply", true);
     // Should be an array of one or more uri strings.
+
     LLSD rewrittenURIs;
     {
         LLEventTimeout filter(replyPump);
@@ -155,9 +160,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
 
         // *NOTE:Mani - Completely arbitrary default timeout value for SRV request.
 		F32 seconds_to_timeout = 5.0f;
-		if(credentials.has("cfg_srv_timeout"))
+		if(login_params.has("cfg_srv_timeout"))
 		{
-			seconds_to_timeout = credentials["cfg_srv_timeout"].asReal();
+			seconds_to_timeout = login_params["cfg_srv_timeout"].asReal();
 		}
 
         // If the SRV request times out (e.g. EXT-3934), simulate response: an
@@ -167,9 +172,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
 		filter.eventAfter(seconds_to_timeout, fakeResponse);
 
 		std::string srv_pump_name = "LLAres";
-		if(credentials.has("cfg_srv_pump"))
+		if(login_params.has("cfg_srv_pump"))
 		{
-			srv_pump_name = credentials["cfg_srv_pump"].asString();
+			srv_pump_name = login_params["cfg_srv_pump"].asString();
 		}
 
 		// Make request
@@ -190,7 +195,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
              urend(rewrittenURIs.endArray());
          urit != urend; ++urit)
     {
-        LLSD request(credentials);
+        LLSD request(login_params);
         request["reply"] = replyPump.getName();
         request["uri"] = *urit;
         std::string status;
@@ -289,6 +294,10 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credential
 	error_response["reason"] = mAuthResponse["status"];
 	error_response["message"] = mAuthResponse["error"];
 	sendProgressEvent("offline", "fail.login", error_response);
+	}
+	catch (...) {
+		llerrs << "login exception caught" << llendl; 
+	}
 }
 
 void LLLogin::Impl::disconnect()
-- 
cgit v1.2.3


From 9e89819d55a3b6ee7fc56f3efb36f273e4e05c83 Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxie@lindenlab.com>
Date: Wed, 8 Jul 2009 00:45:17 +0000
Subject: DEV-34822 - merge with 1.23 certificate notification code -r 118191

ignore-dead-branch
---
 indra/llmessage/llcurl.cpp                         |   9 +
 indra/llmessage/llcurl.h                           |   1 +
 indra/newview/CMakeLists.txt                       |  25 +
 indra/newview/app_settings/settings.xml            |  11 +
 indra/newview/llfloaterland.cpp                    |   1 -
 indra/newview/lllogininstance.cpp                  |   9 +
 indra/newview/llsecapi.cpp                         |   5 +
 indra/newview/llsecapi.h                           | 311 +++++--
 indra/newview/llsechandler_basic.cpp               | 913 +++++++++++++++++++--
 indra/newview/llsechandler_basic.h                 | 149 +++-
 indra/newview/llstartup.cpp                        | 163 +++-
 indra/newview/llviewernetwork.cpp                  |  16 +-
 indra/newview/llviewernetwork.h                    |   4 +-
 indra/newview/llxmlrpclistener.cpp                 |  18 +-
 indra/newview/llxmlrpctransaction.cpp              | 103 ++-
 indra/newview/llxmlrpctransaction.h                |   3 +
 .../newview/skins/default/xui/en/notifications.xml |  42 +
 indra/newview/tests/llsecapi_test.cpp              | 188 +++++
 indra/newview/tests/llsechandler_basic_test.cpp    | 625 ++++++++++++--
 indra/newview/tests/llviewernetwork_test.cpp       | 224 ++---
 indra/viewer_components/login/lllogin.cpp          |   5 +
 21 files changed, 2466 insertions(+), 359 deletions(-)
 create mode 100644 indra/newview/tests/llsecapi_test.cpp

(limited to 'indra')

diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index dc02367a62..91e11b8c0d 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -895,6 +895,15 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd
 	}
 }
 
+void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata)
+{
+	if (mEasy)
+	{
+		mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback);
+		mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata);
+	}
+}
+
 void LLCurlEasyRequest::slist_append(const char* str)
 {
 	if (mEasy)
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 1bc1767966..b6a637ae5b 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -229,6 +229,7 @@ public:
 	void setHeaderCallback(curl_header_callback callback, void* userdata);
 	void setWriteCallback(curl_write_callback callback, void* userdata);
 	void setReadCallback(curl_read_callback callback, void* userdata);
+	void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
 	void slist_append(const char* str);
 	void sendRequest(const std::string& url);
 	void requestComplete();
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 4be6fb940e..35f0a5036d 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1803,6 +1803,31 @@ if (LL_TESTS)
     "${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py"
     )
 
+  set(test_libs 
+    ${LLMESSAGE_LIBRARIES} 
+    ${WINDOWS_LIBRARIES} 
+    ${LLVFS_LIBRARIES}
+    ${LLMATH_LIBRARIES}
+    ${LLCOMMON_LIBRARIES} 
+    ${GOOGLEMOCK_LIBRARIES}
+    ${OPENSSL_LIBRARIES}
+    ${CRYPTO_LIBRARIES}
+  )
+    LL_ADD_INTEGRATION_TEST(llsechandler_basic
+     llsechandler_basic.cpp
+    "${test_libs}"
+    )
+
+  LL_ADD_INTEGRATION_TEST(llsecapi
+     llsecapi.cpp
+    "${test_libs}"
+    )
+
+  LL_ADD_INTEGRATION_TEST(llviewernetwork
+     llviewernetwork.cpp
+    "${test_libs}"
+    )
+
   #ADD_VIEWER_BUILD_TEST(llmemoryview viewer)
   #ADD_VIEWER_BUILD_TEST(llagentaccess viewer)
   #ADD_VIEWER_BUILD_TEST(llworldmap viewer)
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 75ee389750..1641ab0ce1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1275,6 +1275,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>CertStore</key>
+    <map>
+      <key>Comment</key>
+      <string>Specifies the Certificate Store for certificate trust verification</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>default</string>
+    </map>
     <key>ChatBarStealsFocus</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 598a13de15..9b6e24f251 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -42,7 +42,6 @@
 #include "llnotificationsutil.h"
 #include "llparcel.h"
 #include "message.h"
-#include "lluserauth.h"
 
 #include "llagent.h"
 #include "llbutton.h"
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index bb45cc93ea..e4b8becdd7 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -246,6 +246,15 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
 			LLSD data(LLSD::emptyMap());
 			data["message"] = message_response;
 			data["reply_pump"] = TOS_REPLY_PUMP;
+			if(response.has("error_code"))
+			{
+				data["error_code"] = response["error_code"];
+			}
+			if(response.has("certificate"))
+			{
+				data["certificate"] = response["certificate"];
+			}
+			
 			LLFloaterReg::showInstance("message_critical", data);
 			LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
 				.listen(TOS_LISTENER_NAME,
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index cdf4a3fe01..70c247c2de 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -34,6 +34,7 @@
 #include "llviewerprecompiledheaders.h"
 #include "llsecapi.h"
 #include "llsechandler_basic.h"
+#include <openssl/evp.h>
 #include <map>
 
 
@@ -42,6 +43,9 @@ LLPointer<LLSecAPIHandler> gSecAPIHandler;
 
 void initializeSecHandler()
 {
+	OpenSSL_add_all_algorithms();
+	OpenSSL_add_all_ciphers();
+	OpenSSL_add_all_digests();	
 	gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
 	
 	// Currently, we only have the Basic handler, so we can point the main sechandler
@@ -76,6 +80,7 @@ std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
 }
 
 
+
 LLSD LLCredential::getLoginParams()
 {
 	LLSD result = LLSD::emptyMap();
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index d456ca95b1..6fd12c044a 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -36,11 +36,16 @@
 #include <openssl/x509.h>
 #include <ostream>
 
+#ifdef LL_WINDOWS
+#pragma warning(disable:4250)
+#endif // LL_WINDOWS
+
 // All error handling is via exceptions.
 
 
 #define CERT_SUBJECT_NAME "subject_name"
 #define CERT_ISSUER_NAME "issuer_name"
+#define CERT_NAME_CN "commonName"
 		
 #define  CERT_SUBJECT_NAME_STRING "subject_name_string"
 #define CERT_ISSUER_NAME_STRING "issuer_name_string"
@@ -51,23 +56,62 @@
 #define CERT_VALID_TO "valid_to"
 #define CERT_SHA1_DIGEST "sha1_digest"
 #define CERT_MD5_DIGEST "md5_digest"
+#define CERT_HOSTNAME "hostname"
+#define CERT_BASIC_CONSTRAINTS "basicConstraints"
+#define CERT_BASIC_CONSTRAINTS_CA "CA"
+#define CERT_BASIC_CONSTRAINTS_PATHLEN "pathLen"
+
+#define CERT_KEY_USAGE "keyUsage"
+#define CERT_KU_DIGITAL_SIGNATURE    "digitalSignature"
+#define CERT_KU_NON_REPUDIATION      "nonRepudiation"
+#define CERT_KU_KEY_ENCIPHERMENT     "keyEncipherment"
+#define CERT_KU_DATA_ENCIPHERMENT    "dataEncipherment"
+#define CERT_KU_KEY_AGREEMENT        "keyAgreement"
+#define CERT_KU_CERT_SIGN        "certSigning"
+#define CERT_KU_CRL_SIGN             "crlSigning"
+#define CERT_KU_ENCIPHER_ONLY        "encipherOnly"
+#define CERT_KU_DECIPHER_ONLY        "decipherOnly"
 
 #define BASIC_SECHANDLER "BASIC_SECHANDLER"
+#define CERT_VALIDATION_DATE "validation_date"
+
+#define CERT_EXTENDED_KEY_USAGE "extendedKeyUsage"
+#define CERT_EKU_SERVER_AUTH SN_server_auth
+
+// validate the current time lies within 
+// the validation period of the cert
+#define VALIDATION_POLICY_TIME 1
+
+// validate that the CA, or some cert in the chain
+// lies within the certificate store
+#define VALIDATION_POLICY_TRUSTED 2
+
+// validate that the subject name of
+// the cert contains the passed in hostname
+// or validates against the hostname
+#define VALIDATION_POLICY_HOSTNAME 4
+
+
+// validate that the cert contains the SSL EKU
+#define VALIDATION_POLICY_SSL_KU 8
+
+// validate that the cert contains the SSL EKU
+#define VALIDATION_POLICY_CA_KU 16
+
+#define VALIDATION_POLICY_CA_BASIC_CONSTRAINTS 32
+
+// validate that the cert is correct for SSL
+#define VALIDATION_POLICY_SSL (VALIDATION_POLICY_TIME | \
+                               VALIDATION_POLICY_HOSTNAME | \
+                               VALIDATION_POLICY_TRUSTED | \
+                               VALIDATION_POLICY_SSL_KU | \
+                               VALIDATION_POLICY_CA_BASIC_CONSTRAINTS | \
+                               VALIDATION_POLICY_CA_KU)
+
+
 
 
-// All error handling is via exceptions.
 
-class LLCertException
-{
-public:
-	LLCertException(const char* msg)
-	{
-		llerrs << "Certificate Error: " << msg << llendl;
-		mMsg = std::string(msg);
-	}
-protected:
-	std::string mMsg;
-};
 
 class LLProtectedDataException
 {
@@ -96,53 +140,88 @@ public:
 	
 	// return a PEM encoded certificate.  The encoding
 	// includes the -----BEGIN CERTIFICATE----- and end certificate elements
-	virtual std::string getPem()=0; 
+	virtual std::string getPem() const=0; 
 	
 	// return a DER encoded certificate
-	virtual std::vector<U8> getBinary()=0;  
+	virtual std::vector<U8> getBinary() const=0;  
 	
 	// return an LLSD object containing information about the certificate
 	// such as its name, signature, expiry time, serial number
-	virtual LLSD getLLSD()=0; 
+	virtual LLSD getLLSD() const=0; 
 	
 	// return an openSSL X509 struct for the certificate
-	virtual X509* getOpenSSLX509()=0;
+	virtual X509* getOpenSSLX509() const=0;
 
 };
 
+// class LLCertificateVector
+// base class for a list of certificates.
 
-// class LLCertificateChain
-// Class representing a chain of certificates in order, with the 
-// 0th element being the CA
-class LLCertificateChain : public LLRefCount
+
+class LLCertificateVector : public LLRefCount
 {
-	LOG_CLASS(LLCertificateChain);
-	static const int VT_SSL = 0;
-	static const int VT_AGENT_DOMAIN = 1;
-	static const int VT_GRID_DOMAIN = 1;
 	
 public:
-	LLCertificateChain() {}
 	
-	virtual ~LLCertificateChain() {}
+	LLCertificateVector() {};
+	virtual ~LLCertificateVector() {};
+	
+	// base iterator implementation class, providing
+	// the functionality needed for the iterator class.
+	class iterator_impl : public LLRefCount
+	{
+	public:
+		iterator_impl() {};
+		virtual ~iterator_impl() {};
+		virtual void seek(bool incr)=0;
+		virtual LLPointer<iterator_impl> clone() const=0;
+		virtual bool equals(const LLPointer<iterator_impl>& _iter) const=0;
+		virtual LLPointer<LLCertificate> get()=0;
+	};
+	
+	// iterator class
+	class iterator
+	{
+	public:
+		iterator(LLPointer<iterator_impl> impl) : mImpl(impl) {}
+		iterator() : mImpl(NULL) {}
+		iterator(const iterator& _iter) {mImpl = _iter.mImpl->clone(); }
+		~iterator() {}
+		iterator& operator++() { if(mImpl.notNull()) mImpl->seek(true); return *this;}
+		iterator& operator--() { if(mImpl.notNull()) mImpl->seek(false); return *this;}
+		
+		iterator operator++(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(true); return result;}
+		iterator operator--(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(false); return result;}
+		LLPointer<LLCertificate> operator*() { return mImpl->get(); }		
+		
+		LLPointer<iterator_impl> mImpl;
+	protected:
+		friend bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs);
+		bool equals(const iterator& _iter) const { return mImpl->equals(_iter.mImpl); }
+	};
 	
-	virtual X509_STORE getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
-	// for this store
+	// numeric indexer
+	virtual LLPointer<LLCertificate> operator[](int)=0;
 	
-	virtual void appendCert(const LLCertificate& cert)=0;  // append a cert to the end 
-	//of the chain
+	// Iteration
+	virtual iterator begin()=0;
 	
-	virtual LLPointer<LLCertificate>& operator [](int index)=0; // retrieve a certificate 
-	// from the chain by index
-	// -1 == end of chain
+	virtual iterator end()=0;
 	
-	virtual int len() const =0;  // return number of certificates in the chain
+	// find a cert given params
+	virtual iterator find(const LLSD& params) =0;
 	
-	// validate a certificate chain given the params.
-	// validation type indicates whether it's simply an SSL cert, or 
-	// something more specific
-	virtual bool validate(int validation_type, 
-						  const LLSD& validation_params) const =0;
+	// return the number of certs in the store
+	virtual int size() const = 0;	
+	
+	// append the cert to the store.  if a copy of the cert already exists in the store, it is removed first
+	virtual void  add(LLPointer<LLCertificate> cert)=0;
+	
+	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
+	virtual void  insert(iterator location, LLPointer<LLCertificate> cert)=0;	
+	
+	// remove a certificate from the store
+	virtual LLPointer<LLCertificate> erase(iterator cert)=0;	
 };
 
 
@@ -151,43 +230,55 @@ public:
 // certificates.  The store can be persisted, and can be used to validate
 // a cert chain
 //
-class LLCertificateStore : public LLRefCount
+class LLCertificateStore : virtual public LLCertificateVector
 {
+	
 public:
+	
 	LLCertificateStore() {}
 	virtual ~LLCertificateStore() {}
 	
-	virtual X509_STORE* getOpenSSLX509Store()=0;  // return an openssl X509_STORE  
-	// for this store
-	
-	// add a copy of a cert to the store
-	virtual void  append(const LLCertificate& cert)=0;
-	
-	// add a copy of a cert to the store
-	virtual void insert(const int index, const LLCertificate& cert)=0;
-	
-	// remove a certificate from the store
-	virtual void remove(int index)=0;
-	
-	// return a certificate at the index
-	virtual LLPointer<LLCertificate> operator[](int index)=0;
-	
-	// return the number of certs in the store
-	virtual int len() const =0;
-	
-	// load the store from a persisted location
-	virtual void load(const std::string& store_id)=0;
-	
 	// persist the store
 	virtual void save()=0;
 	
 	// return the store id
-	virtual std::string storeId()=0;
+	virtual std::string storeId() const=0;
+};
+
+// class LLCertificateChain
+// Class representing a chain of certificates in order, with the 
+// first element being the child cert.
+class LLCertificateChain : virtual public LLCertificateVector
+{	
+
+public:
+	LLCertificateChain() {}
 	
-	// validate a cert chain
-	virtual bool validate(const LLCertificateChain& cert_chain) const=0;
+	virtual ~LLCertificateChain() {}
+
+	// validate a certificate chain given the params.
+	// Will throw exceptions on error
+	
+	virtual void validate(int validation_policy,
+						  LLPointer<LLCertificateStore> ca_store,
+						  const LLSD& validation_params) =0;
 };
 
+
+
+
+inline
+bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
+{
+	return _lhs.equals(_rhs);
+}
+inline
+bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
+{
+	return !(_lhs == _rhs);
+}
+
+
 //
 // LLCredential - interface for credentials providing the following functionality:
 // * persistance of credential information based on grid (for saving username/password)
@@ -232,6 +323,98 @@ protected:
 std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
 
 
+// All error handling is via exceptions.
+
+class LLCertException
+{
+public:
+	LLCertException(LLPointer<LLCertificate> cert, const char* msg)
+	{
+
+		mCert = cert;
+
+		LL_WARNS("SECAPI") << "Certificate Error: " << (std::string)msg << LL_ENDL;
+		mMsg = (std::string)msg;
+	}
+	LLPointer<LLCertificate> getCert() { return mCert; }
+	std::string getMessage() { return mMsg; }
+protected:
+	LLPointer<LLCertificate> mCert;
+	std::string mMsg;
+};
+
+class LLInvalidCertificate : public LLCertException
+{
+public:
+	LLInvalidCertificate(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalid")
+	{
+	}
+protected:
+};
+
+class LLCertValidationTrustException : public LLCertException
+{
+public:
+	LLCertValidationTrustException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertUntrusted")
+	{
+	}
+protected:
+};
+
+class LLCertValidationHostnameException : public LLCertException
+{
+public:
+	LLCertValidationHostnameException(std::string hostname,
+									  LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidHostname")
+	{
+		mHostname = hostname;
+	}
+	
+	std::string getHostname() { return mHostname; }
+protected:
+	std::string mHostname;
+};
+
+class LLCertValidationExpirationException : public LLCertException
+{
+public:
+	LLCertValidationExpirationException(LLPointer<LLCertificate> cert,
+										LLDate current_time) : LLCertException(cert, "CertExpired")
+	{
+		mTime = current_time;
+	}
+	LLDate GetTime() { return mTime; }
+protected:
+	LLDate mTime;
+};
+
+class LLCertKeyUsageValidationException : public LLCertException
+{
+public:
+	LLCertKeyUsageValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertKeyUsage")
+	{
+	}
+protected:
+};
+
+class LLCertBasicConstraintsValidationException : public LLCertException
+{
+public:
+	LLCertBasicConstraintsValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertBasicConstraints")
+	{
+	}
+protected:
+};
+
+class LLCertValidationInvalidSignatureException : public LLCertException
+{
+public:
+	LLCertValidationInvalidSignatureException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidSignature")
+	{
+	}
+protected:
+};
+
 // LLSecAPIHandler Class
 // Interface handler class for the various security storage handlers.
 class LLSecAPIHandler : public LLRefCount
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 4180f578b9..097cc395d7 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -20,7 +20,7 @@
  * in the file doc/FLOSS-exception.txt in this software distribution, or
  * online at http://secondlife.com/developers/opensource/flossexception
  * 
- * By copying, modifying or distributing this software, you acknowledge
+LLS * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
  * and agree to abide by those obligations.
  * 
@@ -42,17 +42,26 @@
 #include "llviewercontrol.h"
 #include <vector>
 #include <ios>
+#include <openssl/ossl_typ.h>
 #include <openssl/x509.h>
+#include <openssl/x509v3.h>
 #include <openssl/pem.h>
 #include <openssl/asn1.h>
 #include <openssl/rand.h>
+#include <openssl/err.h>
 #include <iostream>
 #include <iomanip>
 #include <time.h>
 
+
+
 // 128 bits of salt data...
 #define STORE_SALT_SIZE 16 
 #define BUFFER_READ_SIZE 256
+std::string cert_string_from_asn1_string(ASN1_STRING* value);
+LLSD _basic_constraints_ext(X509* cert);
+LLSD _key_usage_ext(X509* cert);
+LLSD _ext_key_usage_ext(X509* cert);
 
 
 LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert) 
@@ -61,14 +70,19 @@ LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert)
 	// BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
 	// so we need to cast it.
 	BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
-	
+	if(pem_bio == NULL)
+	{
+		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+		throw LLInvalidCertificate(this);
+	}
 	mCert = NULL;
 	PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
 	BIO_free(pem_bio);
 	if (!mCert)
 	{
-		throw LLCertException("Error parsing certificate");
+		throw LLInvalidCertificate(this);
 	}
+	_initLLSD();
 }
 
 
@@ -76,20 +90,23 @@ LLBasicCertificate::LLBasicCertificate(X509* pCert)
 {
 	if (!pCert || !pCert->cert_info)
 	{
-		throw LLCertException("Invalid certificate");
+		throw LLInvalidCertificate(this);
 	}	
 	mCert = X509_dup(pCert);
+	_initLLSD();
 }
 
 LLBasicCertificate::~LLBasicCertificate() 
 {
-
-	X509_free(mCert);
+	if(mCert)
+	{
+		X509_free(mCert);
+	}
 }
 
 //
 // retrieve the pem using the openssl functionality
-std::string LLBasicCertificate::getPem()
+std::string LLBasicCertificate::getPem() const
 { 
 	char * pem_bio_chars = NULL;
 	// a BIO is the equivalent of a 'std::stream', and
@@ -98,7 +115,8 @@ std::string LLBasicCertificate::getPem()
 	BIO *pem_bio = BIO_new(BIO_s_mem());
 	if (!pem_bio)
 	{
-		throw LLCertException("couldn't allocate memory buffer");		
+		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;		
+		return std::string();
 	}
 	PEM_write_bio_X509(pem_bio, mCert);
 	int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
@@ -109,14 +127,15 @@ std::string LLBasicCertificate::getPem()
 
 // get the DER encoding for the cert
 // DER is a binary encoding format for certs...
-std::vector<U8> LLBasicCertificate::getBinary()
+std::vector<U8> LLBasicCertificate::getBinary() const
 { 
 	U8 * der_bio_data = NULL;
 	// get a memory bio 
 	BIO *der_bio = BIO_new(BIO_s_mem());
 	if (!der_bio)
 	{
-		throw LLCertException("couldn't allocate memory buffer");		
+		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;			
+		return std::vector<U8>();
 	}
 	i2d_X509_bio(der_bio, mCert);
 	int length = BIO_get_mem_data(der_bio, &der_bio_data);
@@ -128,32 +147,131 @@ std::vector<U8> LLBasicCertificate::getBinary()
 }
 
 
-LLSD LLBasicCertificate::getLLSD()
+LLSD LLBasicCertificate::getLLSD() const
+{
+	return mLLSDInfo;
+}
+
+// Initialize the LLSD info for the certificate
+LLSD& LLBasicCertificate::_initLLSD()
 { 
-	LLSD result;
 
 	// call the various helpers to build the LLSD
-	result[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
-	result[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
-	result[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
-	result[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
+	mLLSDInfo[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
+	mLLSDInfo[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
+	mLLSDInfo[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
+	mLLSDInfo[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
 	ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
 	if (sn != NULL)
 	{
-		result[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
+		mLLSDInfo[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
 	}
 	
-	result[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
-	result[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
-	result[CERT_SHA1_DIGEST] = cert_get_digest("sha1", mCert);
-	result[CERT_MD5_DIGEST] = cert_get_digest("md5", mCert);
+	mLLSDInfo[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
+	mLLSDInfo[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
+	mLLSDInfo[CERT_SHA1_DIGEST] = cert_get_digest("sha1", mCert);
+	mLLSDInfo[CERT_MD5_DIGEST] = cert_get_digest("md5", mCert);
+	// add the known extensions
+	mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
+	mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
+	mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
+	return mLLSDInfo; 
+}
+
+// Retrieve the basic constraints info
+LLSD _basic_constraints_ext(X509* cert)
+{
+	LLSD result;
+	BASIC_CONSTRAINTS *bs = (BASIC_CONSTRAINTS *)X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
+	if(bs)
+	{
+		result = LLSD::emptyMap();
+		// Determines whether the cert can be used as a CA
+		result[CERT_BASIC_CONSTRAINTS_CA] = (bool)bs->ca;
+	
+		if(bs->pathlen) 
+		{
+			// the pathlen determines how deep a certificate chain can be from
+			// this CA
+			if((bs->pathlen->type == V_ASN1_NEG_INTEGER)
+			   || !bs->ca) 
+			{
+				result[CERT_BASIC_CONSTRAINTS_PATHLEN] = 0;
+			} 
+			else 
+			{
+				result[CERT_BASIC_CONSTRAINTS_PATHLEN] = (int)ASN1_INTEGER_get(bs->pathlen);
+			}
+		}
 
+	}
+	return result;
+}
 
+// retrieve the key usage, which specifies how the cert can be used.
+// 
+LLSD _key_usage_ext(X509* cert)
+{
+	LLSD result;
+	ASN1_STRING *usage_str = (ASN1_STRING *)X509_get_ext_d2i(cert, NID_key_usage, NULL, NULL);
+	if(usage_str)
+	{
+		result = LLSD::emptyArray();
+		long usage = 0;
+		if(usage_str->length > 0) 
+		{
+			usage = usage_str->data[0];
+			if(usage_str->length > 1)
+			{
+				usage |= usage_str->data[1] << 8;
+			}
+		}
+		ASN1_STRING_free(usage_str);
+		if(usage)
+		{
+			if(usage & KU_DIGITAL_SIGNATURE) result.append(LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE));
+			if(usage & KU_NON_REPUDIATION) result.append(LLSD((std::string)CERT_KU_NON_REPUDIATION));
+			if(usage & KU_KEY_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT));
+			if(usage & KU_DATA_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_DATA_ENCIPHERMENT));
+			if(usage & KU_KEY_AGREEMENT) result.append(LLSD((std::string)CERT_KU_KEY_AGREEMENT));
+			if(usage & KU_KEY_CERT_SIGN) result.append(LLSD((std::string)CERT_KU_CERT_SIGN));			
+			if(usage & KU_CRL_SIGN) result.append(LLSD((std::string)CERT_KU_CRL_SIGN));	
+			if(usage & KU_ENCIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_ENCIPHER_ONLY));				
+			if(usage & KU_DECIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_DECIPHER_ONLY));		
+		}
+	}
+	return result;
+}
 
-	return result; 
+// retrieve the extended key usage for the cert
+LLSD _ext_key_usage_ext(X509* cert)
+{
+	LLSD result;
+	EXTENDED_KEY_USAGE *eku = (EXTENDED_KEY_USAGE *)X509_get_ext_d2i(cert, NID_ext_key_usage, NULL, NULL);
+	if(eku)
+	{
+		result = LLSD::emptyArray();
+		while(sk_ASN1_OBJECT_num(eku))
+		{
+			ASN1_OBJECT *usage = sk_ASN1_OBJECT_pop(eku);
+			if(usage)
+			{
+				int nid = OBJ_obj2nid(usage);
+				if (nid)
+				{
+					std::string sn = OBJ_nid2sn(nid);
+					result.append(sn);
+				}
+				ASN1_OBJECT_free(usage);
+			}
+		}
+	}
+	return result;
 }
 
-X509* LLBasicCertificate::getOpenSSLX509()
+// retrieve an openssl x509 object,
+// which must be freed by X509_free
+X509* LLBasicCertificate::getOpenSSLX509() const
 { 
 	return X509_dup(mCert); 
 }  
@@ -203,13 +321,46 @@ LLSD cert_name_from_X509_NAME(X509_NAME* name)
 
 std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
 {
+	std::string result;
 	BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
-	char * ascii_bn = BN_bn2hex(bn);
+	if(bn)
+	{
+		char * ascii_bn = BN_bn2hex(bn);
 
-	BN_free(bn);
+		if(ascii_bn)
+		{
+			result = ascii_bn;
+			OPENSSL_free(ascii_bn);
+		}
+		BN_free(bn);
+	}
+	return result;
+}
+
+// Generate a string from an ASN1 integer.  ASN1 Integers are
+// bignums, so they can be 'infinitely' long, therefore we
+// cannot simply use a conversion to U64 or something.
+// We retrieve as a readable string for UI
 
-	std::string result(ascii_bn);
-	OPENSSL_free(ascii_bn);
+std::string cert_string_from_asn1_string(ASN1_STRING* value)
+{
+	char * string_bio_chars = NULL;
+	std::string result;
+	// get a memory bio
+	BIO *string_bio = BIO_new(BIO_s_mem());
+	if(!string_bio)
+	{
+		// stream the name into the bio.  The name will be in the 'short name' format
+		ASN1_STRING_print_ex(string_bio, value, ASN1_STRFLGS_RFC2253);
+		int length = BIO_get_mem_data(string_bio, &string_bio_chars);
+		result = std::string(string_bio_chars, length);
+		BIO_free(string_bio);
+	}
+	else
+	{
+		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
+	}
+	
 	return result;
 }
 
@@ -222,8 +373,9 @@ LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
 	int i = asn1_time->length;
 	
 	if (i < 10)
-		throw LLCertException("invalid certificate time value");
-	
+	{
+		return LLDate();
+	}	
 	// convert the date from the ASN1 time (which is a string in ZULU time), to
 	// a timeval.
 	timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
@@ -237,19 +389,23 @@ LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
 	timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
 	timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
 	timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
-	
-	return LLDate((F64)mktime(&timestruct));
+
+#if LL_WINDOWS
+	return LLDate((F64)_mkgmtime(&timestruct));
+#else // LL_WINDOWS
+	return LLDate((F64)timegm(&timestruct));
+#endif // LL_WINDOWS
 }
 
+													   
 // Generate a string containing a digest.  The digest time is 'ssh1' or
 // 'md5', and the resulting string is of the form "aa:12:5c:' and so on
 std::string cert_get_digest(const std::string& digest_type, X509 *cert)
 {
-	unsigned char digest_data[1024];
-	unsigned int len = 1024;
+	unsigned char digest_data[BUFFER_READ_SIZE];
+	unsigned int len = sizeof(digest_data);
 	std::stringstream result;
 	const EVP_MD* digest = NULL;
-	OpenSSL_add_all_digests();
 	// we could use EVP_get_digestbyname, but that requires initializer code which
 	// would require us to complicate things by plumbing it into the system.
 	if (digest_type == "md5")
@@ -262,7 +418,7 @@ std::string cert_get_digest(const std::string& digest_type, X509 *cert)
 	}
 	else
 	{
-		throw LLCertException("Invalid digest");
+		return std::string();
 	}
 
 	X509_digest(cert, digest, digest_data, &len);
@@ -279,75 +435,588 @@ std::string cert_get_digest(const std::string& digest_type, X509 *cert)
 }
 
 
+// class LLBasicCertificateVector
+// This class represents a list of certificates, implemented by a vector of certificate pointers.
+// it contains implementations of the virtual functions for iterators, search, add, remove, etc.
+//
+
+//  Find a certificate in the list.
+// It will find a cert that has minimally the params listed, with the values being the same
+LLBasicCertificateVector::iterator LLBasicCertificateVector::find(const LLSD& params)
+{
+	BOOL found = FALSE;
+	// loop through the entire vector comparing the values in the certs
+	// against those passed in via the params.
+	// params should be a map.  Only the items specified in the map will be
+	// checked, but they must match exactly, even if they're maps or arrays.
+	
+	for(iterator cert = begin();
+		cert != end();
+		cert++)
+	{
+
+			found= TRUE;
+		LLSD cert_info = (*cert)->getLLSD();
+			for (LLSD::map_const_iterator param = params.beginMap();
+			 param != params.endMap();
+			 param++)
+		{
+
+			if (!cert_info.has((std::string)param->first) || 
+				(!valueCompareLLSD(cert_info[(std::string)param->first], param->second)))
+			{
+				found = FALSE;
+				break;
+			}
+		}
+		if (found)
+		{
+			return (cert);
+		}
+	}
+	return end();
+}
+
+// Insert a certificate into the store.  If the certificate already 
+// exists in the store, nothing is done.
+void  LLBasicCertificateVector::insert(iterator _iter, 
+									   LLPointer<LLCertificate> cert)
+{
+	LLSD cert_info = cert->getLLSD();
+	if (cert_info.isMap() && cert_info.has(CERT_SHA1_DIGEST))
+	{
+		LLSD existing_cert_info = LLSD::emptyMap();
+		existing_cert_info[CERT_MD5_DIGEST] = cert_info[CERT_MD5_DIGEST];
+		if(find(existing_cert_info) == end())
+		{
+			BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+			mCerts.insert(basic_iter->mIter, cert);
+		}
+	}
+}
+
+// remove a certificate from the store
+LLPointer<LLCertificate> LLBasicCertificateVector::erase(iterator _iter)
+{
+	
+	if (_iter != end())
+	{
+		BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
+		LLPointer<LLCertificate> result = (*_iter);
+		mCerts.erase(basic_iter->mIter);
+		return result;
+	}
+	return NULL;
+}
+
+
 //
 // LLBasicCertificateStore
-// 
+// This class represents a store of CA certificates.  The basic implementation
+// uses a pem file such as the legacy CA.pem stored in the existing 
+// SL implementation.
 LLBasicCertificateStore::LLBasicCertificateStore(const std::string& filename)
 {
+	mFilename = filename;
+	load_from_file(filename);
 }
-LLBasicCertificateStore::LLBasicCertificateStore(const X509_STORE* store)
+
+void LLBasicCertificateStore::load_from_file(const std::string& filename)
 {
+	// scan the PEM file extracting each certificate
+	BIO* file_bio = BIO_new(BIO_s_file());
+	if(file_bio)
+	{
+		if (BIO_read_filename(file_bio, filename.c_str()) > 0)
+		{	
+			X509 *cert_x509 = NULL;
+			while((PEM_read_bio_X509(file_bio, &cert_x509, 0, NULL)) && 
+				  (cert_x509 != NULL))
+			{
+				try
+				{
+					add(new LLBasicCertificate(cert_x509));
+				}
+				catch (...)
+				{
+					LL_WARNS("SECAPI") << "Failure creating certificate from the certificate store file." << LL_ENDL;
+				}
+				X509_free(cert_x509);
+				cert_x509 = NULL;
+			}
+			BIO_free(file_bio);
+		}
+	}
+	else
+	{
+		LL_WARNS("SECAPI") << "Could not allocate a file BIO" << LL_ENDL;
+	}
 }
 
+
 LLBasicCertificateStore::~LLBasicCertificateStore()
 {
 }
 
-		
-X509_STORE* LLBasicCertificateStore::getOpenSSLX509Store()
+
+// persist the store
+void LLBasicCertificateStore::save()
 {
-	return NULL;
+	llofstream file_store(mFilename, llofstream::binary);
+	if(!file_store.fail())
+	{
+		for(iterator cert = begin();
+			cert != end();
+			cert++)
+		{
+			std::string pem = (*cert)->getPem();
+			if(!pem.empty())
+			{
+				file_store << (*cert)->getPem() << std::endl;
+			}
+		}
+		file_store.close();
+	}
+	else
+	{
+		LL_WARNS("SECAPI") << "Could not open certificate store " << mFilename << "for save" << LL_ENDL;
+	}
 }
-		
-		// add a copy of a cert to the store
-void  LLBasicCertificateStore::append(const LLCertificate& cert)
+
+// return the store id
+std::string LLBasicCertificateStore::storeId() const
 {
+	// this is the basic handler which uses the CA.pem store,
+	// so we ignore this.
+	return std::string("");
 }
-		
-		// add a copy of a cert to the store
-void LLBasicCertificateStore::insert(const int index, const LLCertificate& cert)
+
+
+//
+// LLBasicCertificateChain
+// This class represents a chain of certs, each cert being signed by the next cert
+// in the chain.  Certs must be properly signed by the parent
+LLBasicCertificateChain::LLBasicCertificateChain(const X509_STORE_CTX* store)
 {
+
+	// we're passed in a context, which contains a cert, and a blob of untrusted
+	// certificates which compose the chain.
+	if((store == NULL) || (store->cert == NULL))
+	{
+		LL_WARNS("SECAPI") << "An invalid store context was passed in when trying to create a certificate chain" << LL_ENDL;
+		return;
+	}
+	// grab the child cert
+	LLPointer<LLCertificate> current = new LLBasicCertificate(store->cert);
+
+	add(current);
+	if(store->untrusted != NULL)
+	{
+		// if there are other certs in the chain, we build up a vector
+		// of untrusted certs so we can search for the parents of each
+		// consecutive cert.
+		LLBasicCertificateVector untrusted_certs;
+		for(int i = 0; i < sk_X509_num(store->untrusted); i++)
+		{
+			LLPointer<LLCertificate> cert = new LLBasicCertificate(sk_X509_value(store->untrusted, i));
+			untrusted_certs.add(cert);
+
+		}		
+		while(untrusted_certs.size() > 0)
+		{
+			LLSD find_data = LLSD::emptyMap();
+			LLSD cert_data = current->getLLSD();
+			// we simply build the chain via subject/issuer name as the
+			// client should not have passed in multiple CA's with the same 
+			// subject name.  If they did, it'll come out in the wash during
+			// validation.
+			find_data[CERT_SUBJECT_NAME_STRING] = cert_data[CERT_ISSUER_NAME_STRING]; 
+			LLBasicCertificateVector::iterator issuer = untrusted_certs.find(find_data);
+			if (issuer != untrusted_certs.end())
+			{
+				current = untrusted_certs.erase(issuer);
+				add(current);
+			}
+			else
+			{
+				break;
+			}
+		}
+	}
 }
-		
-		// remove a certificate from the store
-void LLBasicCertificateStore::remove(int index)
+
+
+// subdomain wildcard specifiers can be divided into 3 parts
+// the part before the first *, the part after the first * but before
+// the second *, and the part after the second *.
+// It then iterates over the second for each place in the string
+// that it matches.  ie if the subdomain was testfoofoobar, and
+// the wildcard was test*foo*bar, it would match test, then
+// recursively match foofoobar and foobar
+
+bool _cert_subdomain_wildcard_match(const std::string& subdomain,
+									const std::string& wildcard)
 {
+	// split wildcard into the portion before the *, and the portion after
+
+	int wildcard_pos = wildcard.find_first_of('*');	
+	// check the case where there is no wildcard.
+	if(wildcard_pos == wildcard.npos)
+	{
+		return (subdomain == wildcard);
+	}
+	
+	// we need to match the first part of the subdomain string up to the wildcard
+	// position
+	if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos))
+	{
+		// the first portions of the strings didn't match
+		return FALSE;
+	}
+	
+	// as the portion of the wildcard string before the * matched, we need to check the
+	// portion afterwards.  Grab that portion.
+	std::string new_wildcard_string = wildcard.substr( wildcard_pos+1, wildcard.npos);
+	if(new_wildcard_string.empty())
+	{
+		// we had nothing after the *, so it's an automatic match
+		return TRUE;
+	}
+	
+	// grab the portion of the remaining wildcard string before the next '*'.  We need to find this
+	// within the remaining subdomain string. and then recursively check.
+	std::string new_wildcard_match_string = new_wildcard_string.substr(0, new_wildcard_string.find_first_of('*'));
+	
+	// grab the portion of the subdomain after the part that matched the initial wildcard portion
+	std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
+	
+	// iterate through the current subdomain, finding instances of the match string.
+	int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
+	while(sub_pos != std::string::npos)
+	{
+		new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
+		if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string))
+		{
+			return TRUE;
+		}
+		sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1);
+
+
+	}
+	// didn't find any instances of the match string that worked in the subdomain, so fail.
+	return FALSE;
 }
-		
-		// return a certificate at the index
-LLPointer<LLCertificate> LLBasicCertificateStore::operator[](int index)
+
+
+// RFC2459 does not address wildcards as part of it's name matching
+// specification, and there is no RFC specifying wildcard matching,
+// RFC2818 does a few statements about wildcard matching, but is very 
+// general.  Generally, wildcard matching is per implementation, although
+// it's pretty similar.
+// in our case, we use the '*' wildcard character only, within each
+// subdomain.  The hostname and the CN specification should have the
+// same number of subdomains.
+// We then iterate that algorithm over each subdomain.
+bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& common_name)
 {
-	LLPointer<LLCertificate> result = NULL;
-	return result;
+	std::string new_hostname = hostname;
+	std::string new_cn = common_name;
+	int subdomain_pos = new_hostname.find_first_of('.');
+	int subcn_pos = new_cn.find_first_of('.');
+	
+	while((subcn_pos != std::string::npos) && (subdomain_pos != std::string::npos))
+	{
+		// snip out the first subdomain and cn element
+
+		if(!_cert_subdomain_wildcard_match(new_hostname.substr(0, subdomain_pos),
+										   new_cn.substr(0, subcn_pos)))
+		{
+			return FALSE;
+		}
+		new_hostname = new_hostname.substr(subdomain_pos+1, std::string::npos);
+		new_cn = new_cn.substr(subcn_pos+1, std::string::npos);
+		subdomain_pos = new_hostname.find_first_of('.');
+		subcn_pos = new_cn.find_first_of('.');
+	}
+	return _cert_subdomain_wildcard_match(new_hostname, new_cn);
+
 }
-		// return the number of certs in the store
-int LLBasicCertificateStore::len() const
+
+// validate that the LLSD array in llsd_set contains the llsd_value 
+bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value)
 {
-	return 0;
+	for(LLSD::array_const_iterator set_value = llsd_set.beginArray();
+		set_value != llsd_set.endArray();
+		set_value++)
+	{
+		if(valueCompareLLSD((*set_value), llsd_value))
+		{
+			return TRUE;
+		}
+	}
+	return FALSE;
 }
-		
-		// load the store from a persisted location
-void LLBasicCertificateStore::load(const std::string& store_id)
+
+void _validateCert(int validation_policy,
+				  const LLPointer<LLCertificate> cert,
+				  const LLSD& validation_params,
+				  int depth)
 {
-}
+
+	LLSD current_cert_info = cert->getLLSD();		
+	// check basic properties exist in the cert
+	if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
+	{
+		throw LLCertException(cert, "Cert doesn't have a Subject Name");				
+	}
+	
+	if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
+	{
+		throw LLCertException(cert, "Cert doesn't have an Issuer Name");				
+	}
+	
+	// check basic properties exist in the cert
+	if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
+	{
+		throw LLCertException(cert, "Cert doesn't have an expiration period");				
+	}
+	if (!current_cert_info.has(CERT_SHA1_DIGEST))
+	{
+		throw LLCertException(cert, "No SHA1 digest");
+	}
+
+	if (validation_policy & VALIDATION_POLICY_TIME)
+	{
+
+		LLDate validation_date(time(NULL));
+		if(validation_params.has(CERT_VALIDATION_DATE))
+		{
+			validation_date = validation_params[CERT_VALIDATION_DATE];
+		}
 		
-		// persist the store
-void LLBasicCertificateStore::save()
-{
+		if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
+		   (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
+		{
+			throw LLCertValidationExpirationException(cert, validation_date);
+		}
+	}
+	if (validation_policy & VALIDATION_POLICY_SSL_KU)
+	{
+		if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+			(!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
+									   LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE))) ||
+			!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
+									  LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT)))))
+		{
+			throw LLCertKeyUsageValidationException(cert);
+		}
+		// only validate EKU if the cert has it
+		if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE) && current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray() &&	   
+		   (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE], 
+									LLSD((std::string)CERT_EKU_SERVER_AUTH))))
+		{
+			throw LLCertKeyUsageValidationException(cert);			
+		}
+	}
+	if (validation_policy & VALIDATION_POLICY_CA_KU)
+	{
+		if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
+			(!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
+									   (std::string)CERT_KU_CERT_SIGN)))
+			{
+				throw LLCertKeyUsageValidationException(cert);						
+			}
+	}
+	
+	// validate basic constraints
+	if ((validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS) &&
+		current_cert_info.has(CERT_BASIC_CONSTRAINTS) && 
+		current_cert_info[CERT_BASIC_CONSTRAINTS].isMap())
+	{
+		if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
+		   !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
+		{
+				throw LLCertBasicConstraintsValidationException(cert);
+		}
+		if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
+			((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
+			 (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
+		{
+			throw LLCertBasicConstraintsValidationException(cert);					
+		}
+	}
 }
-		
-		// return the store id
-std::string LLBasicCertificateStore::storeId()
+
+bool _verify_signature(LLPointer<LLCertificate> parent, 
+					   LLPointer<LLCertificate> child)
 {
-	return std::string("");
-}
+	bool verify_result = FALSE; 
+	LLSD cert1 = parent->getLLSD();
+	LLSD cert2 = child->getLLSD();
+	X509 *signing_cert = parent->getOpenSSLX509();
+	X509 *child_cert = child->getOpenSSLX509();
+	if((signing_cert != NULL) && (child_cert != NULL))
+	{
+		EVP_PKEY *pkey = X509_get_pubkey(signing_cert);
+		
 		
-		// validate a cert chain
-bool LLBasicCertificateStore::validate(const LLCertificateChain& cert_chain) const
+		if(pkey)
+		{
+			int verify_code = X509_verify(child_cert, pkey);
+			verify_result = ( verify_code > 0);
+			EVP_PKEY_free(pkey);
+		}
+		else
+		{
+			LL_WARNS("SECAPI") << "Could not validate the cert chain signature, as the public key of the signing cert could not be retrieved" << LL_ENDL;
+		}
+
+	}
+	else
+	{
+		LL_WARNS("SECAPI") << "Signature verification failed as there are no certs in the chain" << LL_ENDL;
+	}
+	if(child_cert)
+	{
+		X509_free(child_cert);
+	}
+	if(signing_cert)
+	{
+		X509_free(signing_cert);
+	}
+	return verify_result;
+}
+
+// validate the certificate chain against a store.
+// There are many aspects of cert validatioin policy involved in
+// trust validation.  The policies in this validation algorithm include
+// * Hostname matching for SSL certs
+// * Expiration time matching
+// * Signature validation
+// * Chain trust (is the cert chain trusted against the store)
+// * Basic constraints
+// * key usage and extended key usage
+// TODO: We should add 'authority key identifier' for chaining.
+// This algorithm doesn't simply validate the chain by itself
+// and verify the last cert is in the certificate store, or points
+// to a cert in the store.  It validates whether any cert in the chain
+// is trusted in the store, even if it's not the last one.
+void LLBasicCertificateChain::validate(int validation_policy,
+									   LLPointer<LLCertificateStore> ca_store,
+									   const LLSD& validation_params)
 {
-	return FALSE;
+
+	if(size() < 1)
+	{
+		throw LLCertException(NULL, "No certs in chain");
+	}
+	iterator current_cert = begin();
+	LLSD 	current_cert_info = (*current_cert)->getLLSD();
+	LLSD validation_date;
+	if (validation_params.has(CERT_VALIDATION_DATE))
+	{
+		validation_date = validation_params[CERT_VALIDATION_DATE];
+	}
+
+	if (validation_policy & VALIDATION_POLICY_HOSTNAME)
+	{
+		if(!validation_params.has(CERT_HOSTNAME))
+		{
+			throw LLCertException((*current_cert), "No hostname passed in for validation");			
+		}
+		if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
+		{
+			throw LLInvalidCertificate((*current_cert));				
+		}
+		
+		LL_INFOS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() << 
+		     "against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
+		if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
+										  current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
+		{
+			throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
+													(*current_cert));
+		}
+	}
+	
+
+	int depth = 0;
+	LLPointer<LLCertificate> previous_cert;
+	// loop through the cert chain, validating the current cert against the next one.
+	while(current_cert != end())
+	{
+		
+		int local_validation_policy = validation_policy;
+		if(current_cert == begin())
+		{
+			// for the child cert, we don't validate CA stuff
+			local_validation_policy &= ~(VALIDATION_POLICY_CA_KU | 
+										 VALIDATION_POLICY_CA_BASIC_CONSTRAINTS);
+		}
+		else
+		{
+			// for non-child certs, we don't validate SSL Key usage
+			local_validation_policy &= ~VALIDATION_POLICY_SSL_KU;				
+			if(!_verify_signature((*current_cert),
+								  previous_cert))
+			{
+			   throw LLCertValidationInvalidSignatureException(previous_cert);
+			}
+		}
+		_validateCert(local_validation_policy,
+					  (*current_cert),
+					  validation_params,
+					  depth);
+		
+		// look for a CA in the CA store that may belong to this chain.
+		LLSD cert_llsd = (*current_cert)->getLLSD();
+		LLSD cert_search_params = LLSD::emptyMap();		
+		// is the cert itself in the store?
+		cert_search_params[CERT_SHA1_DIGEST] = cert_llsd[CERT_SHA1_DIGEST];
+		LLCertificateStore::iterator found_store_cert = ca_store->find(cert_search_params);
+		if(found_store_cert != ca_store->end())
+		{
+			return;
+		}
+		
+		// is the parent in the cert store?
+			
+		cert_search_params = LLSD::emptyMap();
+		cert_search_params[CERT_SUBJECT_NAME_STRING] = cert_llsd[CERT_ISSUER_NAME_STRING];
+		found_store_cert = ca_store->find(cert_search_params);
+		
+		if(found_store_cert != ca_store->end())
+		{
+			LLSD foo = (*found_store_cert)->getLLSD();
+			// validate the store cert against the depth
+			_validateCert(validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS,
+						  (*found_store_cert),
+						  LLSD(),
+						  depth);
+			
+			// verify the signature of the CA
+			if(!_verify_signature((*found_store_cert),
+								  (*current_cert)))
+			{
+				throw LLCertValidationInvalidSignatureException(*current_cert);
+			}			
+			// successfully validated.
+			return;
+		}
+		previous_cert = (*current_cert);
+		current_cert++;
+			   depth++;
+	}
+	if (validation_policy & VALIDATION_POLICY_TRUSTED)
+	{
+		LLPointer<LLCertificate> untrusted_ca_cert = (*this)[size()-1];
+		// we reached the end without finding a trusted cert.
+		throw LLCertValidationTrustException((*this)[size()-1]);
+
+	}
 }
 
+
 // LLSecAPIBasicHandler Class
 // Interface handler class for the various security storage handlers.
 
@@ -369,7 +1038,39 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 	mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
 
 	mProtectedDataMap = LLSD::emptyMap();
+	
+	mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+															"bin_conf.dat");	
 	_readProtectedData();
+
+	std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+															"CA.pem");
+	// copy the CA file to a user writable location so we can manipulate it.
+	// for this provider, by using a user writable file, there is a risk that
+	// an attacking program can modify the file, but OS dependent providers
+	// will reduce that risk.
+	// by using a user file, modifications will be limited to one user if
+	// we read-only the main file
+
+
+	if (!LLFile::isfile(store_file))
+	{
+
+		std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
+		llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
+		llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
+
+		while(!ca_file.fail())
+		{
+			char buffer[BUFFER_READ_SIZE];
+			ca_file.read(buffer, sizeof(buffer));
+			copied_store_file.write(buffer, ca_file.gcount());
+		}
+		ca_file.close();
+		copied_store_file.close();
+	}
+	LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
+	mStore = new LLBasicCertificateStore(store_file);
 }
 
 LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
@@ -537,7 +1238,7 @@ LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert
 // instantiate a chain from an X509_STORE_CTX
 LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain)
 {
-	LLPointer<LLCertificateChain> result = NULL;
+	LLPointer<LLCertificateChain> result = new LLBasicCertificateChain(chain);
 	return result;
 }
 		
@@ -546,8 +1247,7 @@ LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X5
 // persisted)
 LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id)
 {
-	LLPointer<LLCertificateStore> result;
-	return result;
+	return mStore;
 }
 		
 // retrieve protected data
@@ -659,7 +1359,7 @@ void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool sav
 	{
 		credential["authenticator"] = cred->getAuthenticator();
 	}
-	LL_INFOS("Credentials") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
+	LL_INFOS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
 	setProtectedData("credential", cred->getGrid(), credential);
 	//*TODO: If we're saving Agni credentials, should we write the
 	// credentials to the legacy password.dat/etc?
@@ -742,3 +1442,64 @@ std::string LLSecAPIBasicCredential::asString() const
 }
 
 
+bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs)
+{
+	if (lhs.type() != rhs.type())
+	{
+		return FALSE;
+	}
+    if (lhs.isMap())
+	{
+		// iterate through the map, verifying the right hand side has all of the
+		// values that the left hand side has.
+		for (LLSD::map_const_iterator litt = lhs.beginMap();
+			 litt != lhs.endMap();
+			 litt++)
+		{
+			if (!rhs.has(litt->first))
+			{
+				return FALSE;
+			}
+		}
+		
+		// Now validate that the left hand side has everything the
+		// right hand side has, and that the values are equal.
+		for (LLSD::map_const_iterator ritt = rhs.beginMap();
+			 ritt != rhs.endMap();
+			 ritt++)
+		{
+			if (!lhs.has(ritt->first))
+			{
+				return FALSE;
+			}
+			if (!valueCompareLLSD(lhs[ritt->first], ritt->second))
+			{
+				return FALSE;
+			}
+		}
+		return TRUE;
+	}
+    else if (lhs.isArray())
+	{
+		LLSD::array_const_iterator ritt = rhs.beginArray();
+		// iterate through the array, comparing
+		for (LLSD::array_const_iterator litt = lhs.beginArray();
+			 litt != lhs.endArray();
+			 litt++)
+		{
+			if (!valueCompareLLSD(*ritt, *litt))
+			{
+				return FALSE;
+			}
+			ritt++;
+		}
+		
+		return (ritt == rhs.endArray());
+	}
+    else
+	{
+		// simple type, compare as string
+		return (lhs.asString() == rhs.asString());
+	}
+	
+}
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
index 5d81b6e190..e041322260 100644
--- a/indra/newview/llsechandler_basic.h
+++ b/indra/newview/llsechandler_basic.h
@@ -57,59 +57,147 @@ public:
 	
 	virtual ~LLBasicCertificate();
 	
-	virtual std::string getPem();
-	virtual std::vector<U8> getBinary();
-	virtual LLSD getLLSD();
+	virtual std::string getPem() const;
+	virtual std::vector<U8> getBinary() const;
+	virtual LLSD getLLSD() const;
 
-	virtual X509* getOpenSSLX509();
+	virtual X509* getOpenSSLX509() const;
+	
+	// set llsd elements for testing
+	void setLLSD(const std::string name, const LLSD& value) { mLLSDInfo[name] = value; }
 protected:
+
 	// certificates are stored as X509 objects, as validation and
 	// other functionality is via openssl
 	X509* mCert;
+	
+	LLSD& _initLLSD();
+	LLSD mLLSDInfo;
 };
 
-// class LLCertificateStore
-// represents a store of certificates, typically a store of root CA
-// certificates.  The store can be persisted, and can be used to validate
-// a cert chain
-//
-class LLBasicCertificateStore : public LLCertificateStore
+
+// class LLBasicCertificateVector
+// Class representing a list of certificates
+// This implementation uses a stl vector of certificates.
+class LLBasicCertificateVector : virtual public LLCertificateVector
 {
+	
 public:
-	LLBasicCertificateStore(const std::string& filename);
-	LLBasicCertificateStore(const X509_STORE* store);
-	virtual ~LLBasicCertificateStore();
+	LLBasicCertificateVector() {}
 	
-	virtual X509_STORE* getOpenSSLX509Store();  // return an openssl X509_STORE  
-	// for this store
+	virtual ~LLBasicCertificateVector() {}
 	
-	// add a copy of a cert to the store
-	virtual void  append(const LLCertificate& cert);
+	// Implementation of the basic iterator implementation.
+	// The implementation uses a vector iterator derived from 
+	// the vector in the LLBasicCertificateVector class
+	class BasicIteratorImpl : public iterator_impl
+	{
+	public:
+		BasicIteratorImpl(std::vector<LLPointer<LLCertificate> >::iterator _iter) { mIter = _iter;}
+		virtual ~BasicIteratorImpl() {};
+		// seek forward or back.  Used by the operator++/operator-- implementations
+		virtual void seek(bool incr)
+		{
+			if(incr)
+			{
+				mIter++;
+			}
+			else
+			{
+				mIter--;
+			}
+		}
+		// create a copy of the iterator implementation class, used by the iterator copy constructor
+		virtual LLPointer<iterator_impl> clone() const
+		{
+			return new BasicIteratorImpl(mIter);
+		}
+		
+		virtual bool equals(const LLPointer<iterator_impl>& _iter) const
+		{
+			const BasicIteratorImpl *rhs_iter = dynamic_cast<const BasicIteratorImpl *>(_iter.get());
+			return (mIter == rhs_iter->mIter);
+		}
+		virtual LLPointer<LLCertificate> get()
+		{
+			return *mIter;
+		}
+	protected:
+		friend class LLBasicCertificateVector;
+		std::vector<LLPointer<LLCertificate> >::iterator mIter;
+	};
 	
-	// add a copy of a cert to the store
-	virtual void insert(const int index, const LLCertificate& cert);
+	// numeric index of the vector
+	virtual LLPointer<LLCertificate> operator[](int _index) { return mCerts[_index];}
 	
-	// remove a certificate from the store
-	virtual void remove(int index);
+	// Iteration
+	virtual iterator begin() { return iterator(new BasicIteratorImpl(mCerts.begin())); }
+	
+	virtual iterator end() {  return iterator(new BasicIteratorImpl(mCerts.end())); }
+	
+	// find a cert given params
+	virtual iterator find(const LLSD& params);
 	
-	// return a certificate at the index
-	virtual LLPointer<LLCertificate> operator[](int index);
 	// return the number of certs in the store
-	virtual int len() const;
+	virtual int size() const { return mCerts.size(); }	
+	
+	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
+	virtual void  add(LLPointer<LLCertificate> cert) { insert(end(), cert); }
 	
-	// load the store from a persisted location
-	virtual void load(const std::string& store_id);
+	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
+	virtual void  insert(iterator _iter, LLPointer<LLCertificate> cert);	
+	
+	// remove a certificate from the store
+	virtual LLPointer<LLCertificate> erase(iterator _iter);
+	
+protected:
+	std::vector<LLPointer<LLCertificate> >mCerts;	
+};
+
+// class LLCertificateStore
+// represents a store of certificates, typically a store of root CA
+// certificates.  The store can be persisted, and can be used to validate
+// a cert chain
+//
+class LLBasicCertificateStore : virtual public LLBasicCertificateVector, public LLCertificateStore
+{
+public:
+	LLBasicCertificateStore(const std::string& filename);
+	void load_from_file(const std::string& filename);
+	
+	virtual ~LLBasicCertificateStore();
 	
 	// persist the store
 	virtual void save();
 	
 	// return the store id
-	virtual std::string storeId();
+	virtual std::string storeId() const;
 	
-	// validate a cert chain
-	virtual bool validate(const LLCertificateChain& cert_chain) const;
+protected:
+	std::vector<LLPointer<LLCertificate> >mCerts;
+	std::string mFilename;
 };
 
+// class LLCertificateChain
+// Class representing a chain of certificates in order, with the 
+// first element being the child cert.
+class LLBasicCertificateChain : virtual public LLBasicCertificateVector, public LLCertificateChain
+{
+	
+public:
+	LLBasicCertificateChain(const X509_STORE_CTX * store);
+	
+	virtual ~LLBasicCertificateChain() {}
+	
+	// validate a certificate chain against a certificate store, using the
+	// given validation policy.
+	virtual void validate(int validation_policy,
+						  LLPointer<LLCertificateStore> ca_store,
+						  const LLSD& validation_params);
+};
+
+
+
 // LLSecAPIBasicCredential class
 class LLSecAPIBasicCredential : public LLCredential
 {
@@ -182,10 +270,13 @@ protected:
 
 	std::string mProtectedDataFilename;
 	LLSD mProtectedDataMap;
+	LLPointer<LLBasicCertificateStore> mStore;
 	
 	std::string mLegacyPasswordPath;
 };
 
+bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs);
+
 #endif // LLSECHANDLER_BASIC
 
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index dd991c8eff..6f7a4e2f6a 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -261,6 +261,9 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response);
 void init_start_screen(S32 location_id);
 void release_start_screen();
 void reset_login();
+LLSD transform_cert_args(LLPointer<LLCertificate> cert);
+void general_cert_done(const LLSD& notification, const LLSD& response);
+void trust_cert_done(const LLSD& notification, const LLSD& response);
 void apply_udp_blacklist(const std::string& csv);
 bool process_login_success_response();
 void transition_back_to_login_panel(const std::string& emsg);
@@ -1053,10 +1056,11 @@ bool idle_startup()
 		{
 			LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
 			                      << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
+			LLSD response = LLLoginInstance::getInstance()->getResponse();
 			// Still have error conditions that may need some 
 			// sort of handling.
-			std::string reason_response = LLLoginInstance::getInstance()->getResponse("reason");
-			std::string message_response = LLLoginInstance::getInstance()->getResponse("message");
+			std::string reason_response = response["reason"];
+			std::string message_response = response["message"];
 	
 			if(!message_response.empty())
 			{
@@ -1090,18 +1094,65 @@ bool idle_startup()
 				LLLoginInstance::getInstance()->disconnect();
 				LLAppViewer::instance()->forceQuit();
 			}
-			else
+			else 
 			{
-				// Don't pop up a notification in the TOS case because
-				// LLFloaterTOS::onCancel() already scolded the user.
-				if (reason_response != "tos")
+				if (reason_response != "tos") 
 				{
-					LLSD args;
-					args["ERROR_MESSAGE"] = emsg.str();
-					LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
-					LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+					// Don't pop up a notification in the TOS case because
+					// LLFloaterTOS::onCancel() already scolded the user.
+					std::string error_code;
+					if(response.has("errorcode"))
+					{
+						error_code = response["errorcode"].asString();
+					}
+					if ((reason_response == "CURLError") && 
+						(error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") && 
+						response.has("certificate"))
+					{
+						// This was a certificate error, so grab the certificate
+						// and throw up the appropriate dialog.
+						LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
+						if(certificate)
+						{
+							LLSD args = transform_cert_args(certificate);
+
+							if(error_code == "SSL_CACERT")
+							{
+								// if we are handling an untrusted CA, throw up the dialog                             
+								// with the 'trust this CA' button.                                                    
+								LLNotificationsUtil::add("TrustCertificateError", args, response,
+														trust_cert_done);
+								
+								show_connect_box = true;
+							}
+							else
+							{
+								// the certificate exception returns a unique string for each type of exception.       
+								// we grab this string via the LLUserAuth object, and use that to grab the localized   
+								// string.                                                                             
+								args["REASON"] = LLTrans::getString(message_response);
+								
+								LLNotificationsUtil::add("GeneralCertificateError", args, response,
+														 general_cert_done);
+								
+								reset_login();
+								gSavedSettings.setBOOL("AutoLogin", FALSE);
+								show_connect_box = true;
+								
+							}
+
+						}
+					}
+					else 
+					{
+						// This wasn't a certificate error, so throw up the normal
+						// notificatioin message.
+						LLSD args;
+						args["ERROR_MESSAGE"] = emsg.str();
+						LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+						LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
+					}
 				}
-
 				//setup map of datetime strings to codes and slt & local time offset from utc
 				// *TODO: Does this need to be here?
 				LLStringOps::setupDatetimeInfo (false);
@@ -1126,6 +1177,7 @@ bool idle_startup()
 				LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
 				transition_back_to_login_panel(emsg.str());
 				show_connect_box = true;
+				return FALSE;
 			}
 		}
 		return FALSE;
@@ -2370,7 +2422,9 @@ const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit";
 const S32 OPT_CLOSED_WINDOW = -1;
 const S32 OPT_MALE = 0;
 const S32 OPT_FEMALE = 1;
-
+const S32 OPT_TRUST_CERT = 0;
+const S32 OPT_CANCEL_TRUST = 1;
+	
 bool callback_choose_gender(const LLSD& notification, const LLSD& response)
 {	
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -2633,6 +2687,91 @@ bool login_alert_done(const LLSD& notification, const LLSD& response)
 	return false;
 }
 
+// parse the certificate information into args for the 
+// certificate notifications
+LLSD transform_cert_args(LLPointer<LLCertificate> cert)
+{
+	LLSD args = LLSD::emptyMap();
+	std::string value;
+	LLSD cert_info = cert->getLLSD();
+	// convert all of the elements in the cert into                                        
+	// args for the xml dialog, so we have flexability to                                  
+	// display various parts of the cert by only modifying                                 
+	// the cert alert dialog xml.                                                          
+	for(LLSD::map_iterator iter = cert_info.beginMap();
+		iter != cert_info.endMap();
+		iter++)
+	{
+		// key usage and extended key usage                                            
+		// are actually arrays, and we want to format them as comma separated          
+		// strings, so special case those.                                             
+		LLSDSerialize::toXML(cert_info[iter->first], std::cout);
+		if((iter->first== std::string(CERT_KEY_USAGE)) |
+		   (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
+		{
+			value = "";
+			LLSD usage = cert_info[iter->first];
+			for (LLSD::array_iterator usage_iter = usage.beginArray();
+				 usage_iter != usage.endArray();
+				 usage_iter++)
+			{
+				
+				if(usage_iter != usage.beginArray())
+				{
+					value += ", ";
+				}
+				
+				value += (*usage_iter).asString();
+			}
+			
+		}
+		else
+		{
+			value = iter->second.asString();
+		}
+		
+		std::string name = iter->first;
+		std::transform(name.begin(), name.end(), name.begin(),
+					   (int(*)(int))toupper);
+		args[name.c_str()] = value;
+	}
+	return args;
+}
+
+
+// when we handle a cert error, give focus back to the login panel
+void general_cert_done(const LLSD& notification, const LLSD& response)
+{
+	LLStartUp::setStartupState( STATE_LOGIN_SHOW );			
+	LLPanelLogin::giveFocus();
+}
+
+// check to see if the user wants to trust the cert.
+// if they do, add it to the cert store and 
+void trust_cert_done(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotification::getSelectedOption(notification, response);	
+	switch(option)
+	{
+		case OPT_TRUST_CERT:
+		{
+			LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
+			LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));			
+			store->add(cert);
+			store->save();
+			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );	
+			break;
+		}
+		case OPT_CANCEL_TRUST:
+			reset_login();
+			gSavedSettings.setBOOL("AutoLogin", FALSE);			
+			LLStartUp::setStartupState( STATE_LOGIN_SHOW );				
+		default:
+			LLPanelLogin::giveFocus();
+			break;
+	}
+
+}
 
 void apply_udp_blacklist(const std::string& csv)
 {
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index fcfaf1eef2..82dc459777 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2007, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -60,12 +60,6 @@ LLGridManager::LLGridManager()
 }
 
 
-LLGridManager::LLGridManager(const std::string& grid_file)
-{
-	// initialize with an explicity grid file for testing.
-	initialize(grid_file);
-}
-
 //
 // LLGridManager - class for managing the list of known grids, and the current
 // selection
@@ -240,12 +234,8 @@ void LLGridManager::initialize(const std::string& grid_file)
 	// load a grid from the command line.
 	// if the actual grid name is specified from the command line,
 	// set it as the 'selected' grid.
-	LLSD cmd_line_grid = gSavedSettings.getString("CmdLineGridChoice");
-	if (gSavedSettings.controlExists("CmdLineGridChoice"))
-	{
-		mGridName = gSavedSettings.getString("CmdLineGridChoice");
-		LL_INFOS("GridManager") << "Grid Name: " << mGridName << LL_ENDL;		
-	}
+	mGridName = gSavedSettings.getString("CmdLineGridChoice");
+	LL_INFOS("GridManager") << "Grid Name: " << mGridName << LL_ENDL;		
 	
 	// If a command line login URI was passed in, so we should add the command
 	// line grid to the list of grids
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 7b3ce9c499..0642845d54 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2007, Linden Research, Inc.
+ * Copyright (c) 2006-2010, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -43,6 +43,7 @@ extern const char* DEFAULT_LOGIN_PAGE;
 #define GRID_LOGIN_PAGE_VALUE "login_page"
 #define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
 #define GRID_IS_FAVORITE_VALUE "favorite"
+#define GRID_IS_VISIBLE_VALUE "visible"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE "credential_type"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT "agent"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_ACCOUNT "account"
@@ -78,7 +79,6 @@ public:
 	
 	// when the grid manager is instantiated, the default grids are automatically
 	// loaded, and the grids favorites list is loaded from the xml file.
-	LLGridManager(const std::string& grid_file);
 	LLGridManager();
 	~LLGridManager();
 	
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index 15417614af..8237132ac5 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -28,6 +28,7 @@
 #include "llerror.h"
 #include "stringize.h"
 #include "llxmlrpctransaction.h"
+#include "llsecapi.h"
 
 #if LL_WINDOWS
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
@@ -356,7 +357,22 @@ public:
                                      << data["errorcode"].asString()
                                      << " (" << data["error"].asString() << ")"
                                      << LL_ENDL;
-        // In addition to CURLE_OK, LLUserAuth distinguishes different error
+		
+		switch (curlcode)
+		{
+			case CURLE_SSL_PEER_CERTIFICATE:
+			case CURLE_SSL_CACERT:
+			{
+				LLPointer<LLCertificate> error_cert(mTransaction->getErrorCert());
+				if(error_cert)
+				{
+					data["certificate"] = error_cert->getPem();
+				}
+				break;
+			}
+			default:
+				break;
+		}
         // values of 'curlcode':
         // CURLE_COULDNT_RESOLVE_HOST,
         // CURLE_SSL_PEER_CERTIFICATE,
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 70859e8ea5..da61840761 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -31,6 +31,9 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+#include <openssl/x509_vfy.h>
+#include <openssl/ssl.h>
+#include "llsecapi.h"
 
 #include "llxmlrpctransaction.h"
 #include "llxmlrpclistener.h"
@@ -176,6 +179,8 @@ public:
 
 	std::string			mResponseText;
 	XMLRPC_REQUEST		mResponse;
+	std::string         mCertStore;
+	LLPointer<LLCertificate> mErrorCert;
 	
 	Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip);
 	Impl(const std::string& uri,
@@ -190,7 +195,8 @@ public:
 
 private:
 	void init(XMLRPC_REQUEST request, bool useGzip);
-
+	static int _sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
+	static CURLcode _sslCtxFunction(CURL * curl, void *sslctx, void *param);
 	static size_t curlDownloadCallback(
 		char* data, size_t size, size_t nmemb, void* user_data);
 };
@@ -228,8 +234,74 @@ LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
     XMLRPC_RequestFree(request, 1);
 }
 
+// _sslCertVerifyCallback
+// callback called when a cert verification is requested.
+// calls SECAPI to validate the context
+int LLXMLRPCTransaction::Impl::_sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
+{
+	LLXMLRPCTransaction::Impl *transaction = (LLXMLRPCTransaction::Impl *)param;
+	LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(transaction->mCertStore);
+	LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
+	LLSD validation_params = LLSD::emptyMap();
+	LLURI uri(transaction->mURI);
+	validation_params[CERT_HOSTNAME] = uri.hostName();
+	try
+	{
+		chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
+	}
+	catch (LLCertValidationTrustException& cert_exception)
+	{
+		// this exception is is handled differently than the general cert
+		// exceptions, as we allow the user to actually add the certificate
+		// for trust.
+		// therefore we pass back a different error code
+		// NOTE: We're currently 'wired' to pass around CURL error codes.  This is
+		// somewhat clumsy, as we may run into errors that do not map directly to curl
+		// error codes.  Should be refactored with login refactoring, perhaps.
+		transaction->mCurlCode = CURLE_SSL_CACERT;
+		// set the status directly.  set curl status generates error messages and we want
+		// to use the fixed ones from the exceptions
+		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
+		// We should probably have a more generic way of passing information
+		// back to the error handlers.
+		transaction->mErrorCert = cert_exception.getCert();
+		return 0;		
+	}
+	catch (LLCertException& cert_exception)
+	{
+		transaction->mCurlCode = CURLE_SSL_PEER_CERTIFICATE;
+		// set the status directly.  set curl status generates error messages and we want
+		// to use the fixed ones from the exceptions
+		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
+		transaction->mErrorCert = cert_exception.getCert();
+		return 0;
+	}
+	catch (...)
+	{
+		// any other odd error, we just handle as a connect error.
+		transaction->mCurlCode = CURLE_SSL_CONNECT_ERROR;
+		transaction->setCurlStatus(CURLE_SSL_CONNECT_ERROR);
+		return 0;
+	}
+	return 1;
+}
 
+// _sslCtxFunction
+// Callback function called when an SSL Context is created via CURL
+// used to configure the context for custom cert validate(<, <#const & xs#>, <#T * #>, <#long #>)tion
+// based on SECAPI
 
+CURLcode LLXMLRPCTransaction::Impl::_sslCtxFunction(CURL * curl, void *sslctx, void *param)
+{
+	SSL_CTX * ctx = (SSL_CTX *) sslctx;
+	// disable any default verification for server certs
+	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+	// set the verification callback.
+	SSL_CTX_set_cert_verify_callback(ctx, _sslCertVerifyCallback, param);
+	// the calls are void
+	return CURLE_OK;
+	
+}
 
 void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 {
@@ -237,6 +309,7 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 	{
 		mCurlRequest = new LLCurlEasyRequest();
 	}
+	mErrorCert = NULL;
 	
 	if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
 	{
@@ -252,11 +325,13 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 //	mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
 	mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
 	mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
-    	BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+	BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+	mCertStore = gSavedSettings.getString("CertStore");
 	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
 	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
 	// Be a little impatient about establishing connections.
 	mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);
+	mCurlRequest->setSSLCtxCallback(_sslCtxFunction, (void *)this);
 
 	/* Setting the DNS cache timeout to -1 disables it completely.
 	   This might help with bug #503 */
@@ -342,11 +417,19 @@ bool LLXMLRPCTransaction::Impl::process()
 		{
 			if (result != CURLE_OK)
 			{
-				setCurlStatus(result);
-				llwarns << "LLXMLRPCTransaction CURL error "
-						<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
-				llwarns << "LLXMLRPCTransaction request URI: "
-						<< mURI << llendl;
+				if ((result != CURLE_SSL_PEER_CERTIFICATE) &&
+					(result != CURLE_SSL_CACERT))
+				{
+					// if we have a curl error that's not already been handled
+					// (a non cert error), then generate the error message as
+					// appropriate
+					setCurlStatus(result);
+				
+					llwarns << "LLXMLRPCTransaction CURL error "
+					<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
+					llwarns << "LLXMLRPCTransaction request URI: "
+					<< mURI << llendl;
+				}
 					
 				return true;
 			}
@@ -424,7 +507,6 @@ void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
 			case StatusComplete:
 				mStatusMessage = "(done)";
 				break;
-				
 			default:
 				// Usually this means that there's a problem with the login server,
 				// not with the client.  Direct user to status page.
@@ -540,6 +622,11 @@ std::string LLXMLRPCTransaction::statusMessage()
 	return impl.mStatusMessage;
 }
 
+LLPointer<LLCertificate> LLXMLRPCTransaction::getErrorCert()
+{
+	return impl.mErrorCert;
+}
+
 std::string LLXMLRPCTransaction::statusURI()
 {
 	return impl.mStatusURI;
diff --git a/indra/newview/llxmlrpctransaction.h b/indra/newview/llxmlrpctransaction.h
index c835423d67..8beb2e2623 100644
--- a/indra/newview/llxmlrpctransaction.h
+++ b/indra/newview/llxmlrpctransaction.h
@@ -38,6 +38,7 @@
 typedef struct _xmlrpc_request* XMLRPC_REQUEST;
 typedef struct _xmlrpc_value* XMLRPC_VALUE;
 	// foward decl of types from xmlrpc.h (this usage is type safe)
+class LLCertificate;
 
 class LLXMLRPCValue
 	// a c++ wrapper around XMLRPC_VALUE
@@ -115,6 +116,8 @@ public:
 		
 	EStatus status(int* curlCode);
 		// return status, and extended CURL code, if code isn't null
+	
+	LLPointer<LLCertificate> getErrorCert();
 	std::string statusMessage();
 		// return a message string, suitable for showing the user
 	std::string statusURI();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6d5f0bedb0..c4cbcb1dc8 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2371,6 +2371,48 @@ Please choose the male or female avatar. You can change your mind later.
      notext="Female"
      yestext="Male"/>
   </notification>
+  <notification icon="alertmodal.tga"
+		name="GeneralCertificateError"
+		type="alertmodal">
+Could not connect to the server.
+[REASON]
+
+SubjectName: [SUBJECT_NAME_STRING]
+IssuerName: [ISSUER_NAME_STRING]
+Valid From: [VALID_FROM]
+Valid To: [VALID_TO]
+MD5 Fingerprint: [SHA1_DIGEST]
+SHA1 Fingerprint: [MD5_DIGEST]
+Key Usage: [KEYUSAGE]
+Extended Key Usage: [EXTENDEDKEYUSAGE]
+Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+   </notification>
+
+  <notification icon="alertmodal.tga"
+		name="TrustCertificateError"
+		type="alertmodal">
+The certification authority for this server is not known.
+
+Certificate Information:
+SubjectName: [SUBJECT_NAME_STRING]
+IssuerName: [ISSUER_NAME_STRING]
+Valid From: [VALID_FROM]
+Valid To: [VALID_TO]
+MD5 Fingerprint: [SHA1_DIGEST]
+SHA1 Fingerprint: [MD5_DIGEST]
+Key Usage: [KEYUSAGE]
+Extended Key Usage: [EXTENDEDKEYUSAGE]
+Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
+
+Would you like to trust this authority?
+    <usetemplate
+     name="okcancelbuttons"
+     notext="Cancel"
+     yestext="Trust"/>
+  </notification>
 
   <notification
    icon="alertmodal.tga"
diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
new file mode 100644
index 0000000000..22bc47b6d3
--- /dev/null
+++ b/indra/newview/tests/llsecapi_test.cpp
@@ -0,0 +1,188 @@
+/** 
+ * @file llsecapi_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the sec api functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../llsecapi.h"
+#include "../../llxml/llcontrol.h"
+
+
+//----------------------------------------------------------------------------               
+// Mock objects for the dependencies of the code we're testing                               
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+                                   const std::string& initial_val,
+                                   const std::string& comment,
+                                   BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+std::string LLControlGroup::getString(const std::string& name)
+{
+	return "";
+}
+
+
+LLControlGroup gSavedSettings("test");
+class LLSecAPIBasicHandler : public LLSecAPIHandler
+{
+protected:
+	LLPointer<LLCertificateChain> mCertChain;
+	LLPointer<LLCertificate> mCert;
+	LLPointer<LLCertificateStore> mCertStore;
+	LLSD mLLSD;
+	
+public:
+	LLSecAPIBasicHandler() {}
+	
+	virtual ~LLSecAPIBasicHandler() {}
+	
+	// instantiate a certificate from a pem string
+	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert) 
+	{ 
+		return mCert; 
+	}
+	
+	
+	// instiate a certificate from an openssl X509 structure
+	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert) 
+	{	
+		return mCert; 
+	}
+	
+	
+	// instantiate a chain from an X509_STORE_CTX
+	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain) 
+	{ 
+		return mCertChain; 
+	}
+	
+	// instantiate a cert store given it's id.  if a persisted version
+	// exists, it'll be loaded.  If not, one will be created (but not
+	// persisted)
+	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id) 
+	{ 
+		return mCertStore; 
+	}
+	
+	// persist data in a protected store
+	virtual void setProtectedData(const std::string& data_type,
+								  const std::string& data_id,
+								  const LLSD& data) {}
+	
+	// retrieve protected data
+	virtual LLSD getProtectedData(const std::string& data_type,
+								  const std::string& data_id) 
+	{ 
+		return mLLSD;
+	}
+	
+	virtual void deleteProtectedData(const std::string& data_type,
+									 const std::string& data_id)
+	{
+	}
+	
+	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
+													 const LLSD& identifier, 
+													 const LLSD& authenticator)
+	{
+		LLPointer<LLCredential> cred = NULL;
+		return cred;
+	}
+	
+	virtual LLPointer<LLCredential> loadCredential(const std::string& grid)
+	{
+		LLPointer<LLCredential> cred = NULL;
+		return cred;
+	}
+	
+	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator) {}
+	
+	virtual void deleteCredential(LLPointer<LLCredential> cred) {}
+};
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+	// Test wrapper declaration : wrapping nothing for the moment
+	struct secapiTest
+	{
+		
+		secapiTest()
+		{
+		}
+		~secapiTest()
+		{
+		}
+	};
+	
+	// Tut templating thingamagic: test group, object and test instance
+	typedef test_group<secapiTest> secapiTestFactory;
+	typedef secapiTestFactory::object secapiTestObject;
+	tut::secapiTestFactory tut_test("llsecapi");
+	
+	// ---------------------------------------------------------------------------------------
+	// Test functions 
+	// ---------------------------------------------------------------------------------------
+	// registration
+	template<> template<>
+	void secapiTestObject::test<1>()
+	{
+		// retrieve an unknown handler
+
+		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+		LLPointer<LLSecAPIHandler> test1_handler =  new LLSecAPIBasicHandler();
+		registerSecHandler("sectest1", test1_handler);
+		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+		LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
+		ensure("Retrieved sectest1 handler should be the same", 
+			   retrieved_test1_handler == test1_handler);
+		
+		// insert a second handler
+		LLPointer<LLSecAPIHandler> test2_handler =  new LLSecAPIBasicHandler();
+		registerSecHandler("sectest2", test2_handler);
+		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
+		retrieved_test1_handler = getSecHandler("sectest1");
+		ensure("Retrieved sectest1 handler should be the same", 
+			   retrieved_test1_handler == test1_handler);
+
+		LLPointer<LLSecAPIHandler> retrieved_test2_handler = getSecHandler("sectest2");
+		ensure("Retrieved sectest1 handler should be the same", 
+			   retrieved_test2_handler == test2_handler);
+		
+	}
+}
\ No newline at end of file
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
index a5554d55a5..f52ebc198d 100644
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -44,9 +44,60 @@
 #include <ios>
 #include <llsdserialize.h>
 #include <openssl/pem.h>
+#include <openssl/err.h>
+#include <openssl/evp.h>
 #include "llxorcipher.h"
 
-LLControlGroup gSavedSettings;
+#define ensure_throws(str, exc_type, cert, func, ...) \
+try \
+{ \
+func(__VA_ARGS__); \
+fail("throws, " str); \
+} \
+catch(exc_type& except) \
+{ \
+ensure("Exception cert is incorrect for " str, except.getCert() == cert); \
+}
+
+extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string);
+
+//----------------------------------------------------------------------------               
+// Mock objects for the dependencies of the code we're testing                               
+
+std::string gFirstName;
+std::string gLastName;
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+                                   const std::string& initial_val,
+                                   const std::string& comment,
+                                   BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+std::string LLControlGroup::getString(const std::string& name)
+{
+
+	if (name == "FirstName")
+		return gFirstName;
+	else if (name == "LastName")
+		return gLastName;
+	return "";
+}
+
+LLSD LLCredential::getLoginParams()
+{
+	LLSD result = LLSD::emptyMap();
+	
+	// legacy credential
+	result["passwd"] = "$1$testpasssd";
+	result["first"] = "myfirst";
+	result["last"] ="mylast";
+	return result;
+}
+
+
+
+LLControlGroup gSavedSettings("test");
 unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
 
 // -------------------------------------------------------------------------------------------
@@ -57,44 +108,91 @@ namespace tut
 	// Test wrapper declaration : wrapping nothing for the moment
 	struct sechandler_basic_test
 	{
-		std::string mPemTestCert;
+		std::string mPemTestCert, mPemRootCert, mPemIntermediateCert, mPemChildCert;
 		std::string mDerFormat;
-		X509 *mX509TestCert;
-		LLBasicCertificate* mTestCert;
+		X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert;
 
 		sechandler_basic_test()
 		{
+			OpenSSL_add_all_algorithms();
+			OpenSSL_add_all_ciphers();
+			OpenSSL_add_all_digests();	
+			ERR_load_crypto_strings();
+			gFirstName = "";
+			gLastName = "";
 			LLFile::remove("test_password.dat");
 			LLFile::remove("sechandler_settings.tmp");			
 			mPemTestCert = "-----BEGIN CERTIFICATE-----\n"
-"MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIx\n"
-"EzARBgNVBAoTCklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25h\n"
-"bCBkZSBUZWNub2xvZ2lhIGRhIEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJy\n"
-"YXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UEAxMoQXV0b3JpZGFkZSBDZXJ0aWZp\n"
-"Y2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4MDBaFw0xMTExMzAy\n"
-"MzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsG\n"
-"A1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3Jt\n"
-"YWNhbyAtIElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYD\n"
-"VQQDEyhBdXRvcmlkYWRlIENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIB\n"
-"IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVA\n"
-"isamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma/3pUpgcfNAj0vYm5gsyj\n"
-"Qo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt4CyNrY50\n"
-"QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYt\n"
-"bRhFboUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbUR\n"
-"yEeNvZneVRKAAU6ouwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwID\n"
-"AQABo4HSMIHPME4GA1UdIARHMEUwQwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0\n"
-"cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQQ2FjcmFpei5wZGYwPQYDVR0f\n"
-"BDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0xDUmFj\n"
-"cmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB\n"
-"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1\n"
-"U/hgIh6OcgLAfiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGl\n"
-"YjJe+9zd+izPRbBqXPVQA34EXcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75Fos\n"
-"SzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQfS//JYeIc7Fue2JNLd00UOSMMaiK/\n"
-"t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr1ME7a55lFEnSeT0u\n"
-"mlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5nmPb\n"
-"K+9A46sd33oqK8n8\n"
-"-----END CERTIFICATE-----\n"
-"";
+				"MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIx\n"
+				"EzARBgNVBAoTCklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25h\n"
+				"bCBkZSBUZWNub2xvZ2lhIGRhIEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJy\n"
+				"YXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UEAxMoQXV0b3JpZGFkZSBDZXJ0aWZp\n"
+				"Y2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4MDBaFw0xMTExMzAy\n"
+				"MzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsG\n"
+				"A1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3Jt\n"
+				"YWNhbyAtIElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYD\n"
+				"VQQDEyhBdXRvcmlkYWRlIENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIB\n"
+				"IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVA\n"
+				"isamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma/3pUpgcfNAj0vYm5gsyj\n"
+				"Qo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt4CyNrY50\n"
+				"QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYt\n"
+				"bRhFboUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbUR\n"
+				"yEeNvZneVRKAAU6ouwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwID\n"
+				"AQABo4HSMIHPME4GA1UdIARHMEUwQwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0\n"
+				"cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQQ2FjcmFpei5wZGYwPQYDVR0f\n"
+				"BDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0xDUmFj\n"
+				"cmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB\n"
+				"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1\n"
+				"U/hgIh6OcgLAfiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGl\n"
+				"YjJe+9zd+izPRbBqXPVQA34EXcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75Fos\n"
+				"SzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQfS//JYeIc7Fue2JNLd00UOSMMaiK/\n"
+				"t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr1ME7a55lFEnSeT0u\n"
+				"mlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5nmPb\n"
+				"K+9A46sd33oqK8n8\n"
+				"-----END CERTIFICATE-----\n";
+
+			mPemRootCert = "-----BEGIN CERTIFICATE-----\n"
+			"MIIB0TCCATqgAwIBAgIJANaTqrzEvHaRMA0GCSqGSIb3DQEBBAUAMBsxGTAXBgNV\n"
+			"BAMTEFJveGllcyB0ZXN0IHJvb3QwHhcNMDkwNDE1MjEwNzQ3WhcNMTAwNDE1MjEw\n"
+			"NzQ3WjAbMRkwFwYDVQQDExBSb3hpZXMgdGVzdCByb290MIGfMA0GCSqGSIb3DQEB\n"
+			"AQUAA4GNADCBiQKBgQCpo5nDW6RNz9IHUVZd7Tw2XAQiBniDF4xH0N1w7sUYTiFq\n"
+			"21mABsnOPJD3ra+MtOsXPHcaljm661JjTD8L40v5sfEbqDUPcOw76ClrPqnuAeyT\n"
+			"38qk8DHku/mT8YdprevGZdVcUXQg3vosVzOL93HOOHK+u61mEEoM9W5xoNVEdQID\n"
+			"AQABox0wGzAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQQF\n"
+			"AAOBgQAzn0aW/+zWPmcTbvxonyiYYUr9b4SOB/quhAkT8KT4ir1dcZAXRR59+kEn\n"
+			"HSTu1FAodV0gvESqyobftF5hZ1XMxdJqGu//xP+YCwlv244G/0pp7KLI8ihNO2+N\n"
+			"lPBUJgbo++ZkhiE1jotZi9Ay0Oedh3s/AfbMZPyfpJ23ll6+BA==\n"
+			"-----END CERTIFICATE-----\n";
+			
+			
+			
+			mPemIntermediateCert = "-----BEGIN CERTIFICATE-----\n"
+			"MIIBzzCCATigAwIBAgIBATANBgkqhkiG9w0BAQQFADAbMRkwFwYDVQQDExBSb3hp\n"
+			"ZXMgdGVzdCByb290MB4XDTA5MDQxNTIxMzE1NloXDTEwMDQxNTIxMzE1NlowITEf\n"
+			"MB0GA1UEAxMWUm94aWVzIGludGVybWVkaWF0ZSBDQTCBnzANBgkqhkiG9w0BAQEF\n"
+			"AAOBjQAwgYkCgYEA15MM0W1R37rx/24Q2Qkb5bSiQZxTUcQAhJ2pA8mwUucXuCVt\n"
+			"6ayI2TuN32nkjmsCgUkiT/bdXWp0OJo7/MXRIFeUNMCRxrpeFnxuigYEqbIXAdN6\n"
+			"qu/vdG2X4PRv/v9Ijrju4cBEiKIldIgOurWEIfXEsVSFP2XmFQHesF04qDcCAwEA\n"
+			"AaMdMBswDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEEBQAD\n"
+			"gYEAYljikYgak3W1jSo0vYthNHUy3lBVAKzDhpM96lY5OuXFslpCRX42zNL8X3kN\n"
+			"U/4IaJUVtZqx8WsUXl1eXHzBCaXCftapV4Ir6cENLIsXCdXs8paFYzN5nPJA5GYU\n"
+			"zWgkSEl1MEhNIc+bJW34vwi29EjrAShAhsIZ84Mt/lvD3Pc=\n"
+			"-----END CERTIFICATE-----\n";
+			
+			mPemChildCert = "-----BEGIN CERTIFICATE-----\n"
+			"MIIB5DCCAU0CBEnm9eUwDQYJKoZIhvcNAQEEBQAwITEfMB0GA1UEAxMWUm94aWVz\n"
+			"IGludGVybWVkaWF0ZSBDQTAeFw0wOTA0MTYwMDAzNDlaFw0xMDA0MTYwMDAzNDla\n"
+			"MCAxHjAcBgNVBAMTFWVuaWFjNjMubGluZGVubGFiLmNvbTCBnzANBgkqhkiG9w0B\n"
+			"AQEFAAOBjQAwgYkCgYEAp9I5rofEzbjNht+9QejfnsIlEPqSxskoWKCG255TesWR\n"
+			"RTmw9wafHQQkJk/VIsaU4RMBYHkknGbHX2dGvMHmKZoWUPSQ/8FZz09o0Qx3TNUZ\n"
+			"l7KlGOD2d1c7ZxXDPqlLC6QW8DrE1/8zfwJ5cbYBXc8e7OKdSZeRrnwHyw4Q8r8C\n"
+			"AwEAAaMvMC0wEwYDVR0lBAwwCgYIKwYBBQUHAwEwCQYDVR0TBAIwADALBgNVHQ8E\n"
+			"BAMCBaAwDQYJKoZIhvcNAQEEBQADgYEAIG0M5tqYlXyMiGKPZfXy/R3M3ZZOapDk\n"
+			"W0dsXJYXAc35ftwtn0VYu9CNnZCcli17/d+AKhkK8a/oGPazqudjFF6WLJLTXaY9\n"
+			"NmhkJcOPADXkbyQPUPXzLe4YRrkEQeGhzMb4rKDQ1TKAcXfs0Y068pTpsixNSxja\n"
+			"NhAUUcve5Is=\n"
+			"-----END CERTIFICATE-----\n";
+			
 			mDerFormat = "MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIxEzARBgNVBAoT"
 "CklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25hbCBkZSBUZWNub2xvZ2lhIGRh"
 "IEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJyYXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UE"
@@ -118,24 +216,33 @@ namespace tut
 "1ME7a55lFEnSeT0umlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5"
 "nmPbK+9A46sd33oqK8n8";
 			
-			mTestCert = new LLBasicCertificate(mPemTestCert);
-			
-			gSavedSettings.cleanup();
-			gSavedSettings.declareString("FirstName", "", "", FALSE);
-			gSavedSettings.declareString("LastName", "", "", FALSE);
 			mX509TestCert = NULL;
-			BIO * validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());
+			mX509RootCert = NULL;
+			mX509IntermediateCert = NULL;
+			mX509ChildCert = NULL;
 			
+			BIO * validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());			
 			PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
 			BIO_free(validation_bio);
-
+			validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
+			PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
+			BIO_free(validation_bio);
+			validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
+			PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
+			BIO_free(validation_bio);	
+			validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
+			PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
+			BIO_free(validation_bio);				
 		}
 		~sechandler_basic_test()
 		{
 			LLFile::remove("test_password.dat");
 			LLFile::remove("sechandler_settings.tmp");
-			delete mTestCert;
+			LLFile::remove("mycertstore.pem");
 			X509_free(mX509TestCert);
+			X509_free(mX509RootCert);
+			X509_free(mX509IntermediateCert);
+			X509_free(mX509ChildCert);
 		}
 	};
 	
@@ -152,18 +259,18 @@ namespace tut
 	void sechandler_basic_test_object::test<1>()
 	
 	{
-
 		char buffer[4096];
-
+		LLPointer<LLCertificate> test_cert = new LLBasicCertificate(mPemTestCert);
+		
 		ensure_equals("Resultant pem is correct",
-			   mPemTestCert, mTestCert->getPem());
-		std::vector<U8> binary_cert = mTestCert->getBinary();
+			   mPemTestCert, test_cert->getPem());
+		std::vector<U8> binary_cert = test_cert->getBinary();
 
 		apr_base64_encode(buffer, (const char *)&binary_cert[0], binary_cert.size());
 		
 		ensure_equals("Der Format is correct", memcmp(buffer, mDerFormat.c_str(), mDerFormat.length()), 0);
 		
-		LLSD llsd_cert = mTestCert->getLLSD();
+		LLSD llsd_cert = test_cert->getLLSD();
 		std::ostringstream llsd_value;
 		llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
 		std::string llsd_cert_str = llsd_value.str();
@@ -194,10 +301,15 @@ namespace tut
 		ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "04");
 		// sha1 digest is giving a weird value, and I've no idea why...feh
 		//ensure_equals("sha1 digest", (std::string)llsd_cert["sha1_digest"], "8e:fd:ca:bc:93:e6:1e:92:5d:4d:1d:ed:18:1a:43:20:a4:67:a1:39");
-		ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2001-11-30T20:58:00Z");
-		ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2011-12-01T07:59:00Z");
+		ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2001-11-30T12:58:00Z");
+		ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2011-11-30T23:59:00Z");
+		LLSD expectedKeyUsage = LLSD::emptyArray();
+		expectedKeyUsage.append(LLSD((std::string)"certSigning"));
+		expectedKeyUsage.append(LLSD((std::string)"crlSigning"));
+		ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage));
+		ensure("basic constraints", (bool)llsd_cert["basicConstraints"]["CA"]);
 		
-		ensure("x509 is equal", !X509_cmp(mX509TestCert, mTestCert->getOpenSSLX509()));
+		ensure("x509 is equal", !X509_cmp(mX509TestCert, test_cert->getOpenSSLX509()));
 	}
 
 	
@@ -319,7 +431,6 @@ namespace tut
 	void sechandler_basic_test_object::test<3>()
 	{
 		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		
 
 		LLSD my_id = LLSD::emptyMap();
 		LLSD my_authenticator = LLSD::emptyMap();
@@ -349,7 +460,7 @@ namespace tut
 			
 		// test loading of a credential, that hasn't been saved, without
 		// any legacy saved credential data
-		LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid");
+		LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid2");
 		ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
 		ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));		
 		ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
@@ -379,10 +490,8 @@ namespace tut
 		
 		// test loading of an unknown credential with legacy saved username, but without
 		// saved password
-
-		gSavedSettings.setString("FirstName", "myfirstname");
-		gSavedSettings.setString("LastName", "mylastname");
-
+		gFirstName = "myfirstname";
+		gLastName = "mylastname";
 		my_new_cred = handler->loadCredential("my_legacy_grid");
 		ensure_equals("legacy credential with no password: type", 
 					  (const std::string)my_new_cred->getIdentifier()["type"], "agent");
@@ -438,19 +547,413 @@ namespace tut
 		ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
 	}
 
+	// test cert vector
+	template<> template<>
+	void sechandler_basic_test_object::test<4>()
+	{
+		
+		// validate create from empty vector
+		LLPointer<LLBasicCertificateVector> test_vector = new LLBasicCertificateVector();
+		ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0);
+		
+		test_vector->add(new LLBasicCertificate(mPemTestCert));
+		ensure_equals("one element in vector", test_vector->size(), 1);
+		test_vector->add(new LLBasicCertificate(mPemChildCert));
+		ensure_equals("two elements in vector after add", test_vector->size(), 2);
+		
+		test_vector->add(new LLBasicCertificate(mPemChildCert));
+		ensure_equals("two elements in vector after re-add", test_vector->size(), 2);
+		// validate order
+		X509* test_cert = (*test_vector)[0]->getOpenSSLX509();		
+		ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert));
+		X509_free(test_cert);
+		
+		test_cert = (*test_vector)[1]->getOpenSSLX509();	
+		ensure("adding a duplicate cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);		
+		
+		//
+		// validate iterator
+		//
+		LLBasicCertificateVector::iterator current_cert = test_vector->begin();
+		LLBasicCertificateVector::iterator copy_current_cert = current_cert;
+		// operator++(int)
+		ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]);
+		ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]);
+		ensure("validate end iterator++", current_cert == test_vector->end());
+		
+		// copy 
+		ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]);		
+		
+		// operator--(int)
+		current_cert--;
+		ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]);		
+		ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]);
+		
+		ensure("begin iterator is equal", current_cert == test_vector->begin());
+		
+		// operator++
+		ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]);				
+		ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end());
+		// operator--
+		ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]);		
+		ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]);		
+		
+		// validate remove
+		// validate create from empty vector
+		test_vector = new LLBasicCertificateVector();
+		test_vector->add(new LLBasicCertificate(mPemTestCert));
+		test_vector->add(new LLBasicCertificate(mPemChildCert));
+		test_vector->erase(test_vector->begin());
+		ensure_equals("one element in store after remove", test_vector->size(), 1);
+		test_cert = (*test_vector)[0]->getOpenSSLX509();
+		ensure("validate cert was removed", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		
+		// validate insert
+		test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemChildCert));
+		test_cert = (*test_vector)[0]->getOpenSSLX509();
+		
+		ensure("validate cert was inserted", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);	
 
+		//validate find
+		LLSD find_info = LLSD::emptyMap();
+		test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemRootCert));
+		find_info["issuer_name"] = LLSD::emptyMap();
+		find_info["issuer_name"]["commonName"] = "Roxies intermediate CA";
+		find_info["md5_digest"] = "97:24:c7:4c:d4:ba:2d:0e:9c:a1:18:8e:3a:c6:1f:c3";
+		current_cert = test_vector->find(find_info);
+		ensure("found", current_cert != test_vector->end());
+		ensure("found cert", (*current_cert).get() == (*test_vector)[1].get());
+		find_info["sha1_digest"] = "bad value";
+		current_cert =test_vector->find(find_info);
+		ensure("didn't find cert", current_cert == test_vector->end());		
+	}	
+	
 	// test cert store
 	template<> template<>
-	void sechandler_basic_test_object::test<4>()
+	void sechandler_basic_test_object::test<5>()
 	{
+		// validate load with nothing
+		LLFile::remove("mycertstore.pem");
+		LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+		ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+		
+		// validate load with empty file
+		test_store->save();
+		test_store = NULL;
+		test_store = new LLBasicCertificateStore("mycertstore.pem");
+		ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
+		test_store=NULL;
+		
 		// instantiate a cert store from a file
-		llofstream certstorefile("mycertstore.pem", std::ios::out | std::ios::binary);
-
-		certstorefile << mPemTestCert;
+		llofstream certstorefile("mycertstore.pem", std::ios::out);
+		certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl;
 		certstorefile.close();
-		// LLBasicCertificateStore test_store("mycertstore.pem");
-		// X509* test_cert = test_store[0]->getOpenSSLX509();
+		// validate loaded certs
+		test_store = new LLBasicCertificateStore("mycertstore.pem");
+		ensure_equals("two elements in store", test_store->size(), 2);
+		
+		// operator[]
+		X509* test_cert = (*test_store)[0]->getOpenSSLX509();
+
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		test_cert = (*test_store)[1]->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));	
+		X509_free(test_cert);
+
+
+		// validate save
+		LLFile::remove("mycertstore.pem");
+		test_store->save();
+		test_store = NULL;
+		test_store = new LLBasicCertificateStore("mycertstore.pem");
+		ensure_equals("two elements in store after save", test_store->size(), 2);				
+		LLCertificateStore::iterator current_cert = test_store->begin();		
+		test_cert = (*current_cert)->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		current_cert++;
+		X509_free(test_cert);
+		test_cert = (*current_cert)->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));	
+		X509_free(test_cert);
+		current_cert++;
+		ensure("end of cert store", current_cert == test_store->end());
+		
+	}
+	
+	// cert name wildcard matching
+	template<> template<>
+	void sechandler_basic_test_object::test<6>()
+	{
+		ensure("simple name match", 
+			   _cert_hostname_wildcard_match("foo", "foo"));
+		
+		ensure("simple name match, with end period", 
+			   _cert_hostname_wildcard_match("foo.", "foo."));
+		
+		ensure("simple name match, with begin period", 
+			   _cert_hostname_wildcard_match(".foo", ".foo"));		
+		
+		ensure("simple name match, with subdomain", 
+			   _cert_hostname_wildcard_match("foo.bar", "foo.bar"));	
+		
+		ensure("stutter name match", 
+			   _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo"));			
+		
+		ensure("simple name match, with beginning wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "*bar"));	
+		
+		ensure("simple name match, with ending wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "foo*"));
+		
+		ensure("simple name match, with beginning null wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "*foobar"));			
+
+		ensure("simple name match, with ending null wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "foobar*"));
+		
+		ensure("simple name match, with embedded wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "f*r"));		
+		
+		ensure("simple name match, with embedded null wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "foo*bar"));
+
+		ensure("simple name match, with dual embedded wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "f*o*ar"));		
+
+		ensure("simple name mismatch", 
+			   !_cert_hostname_wildcard_match("bar", "foo"));
+		
+		ensure("simple name mismatch, with end period", 
+			   !_cert_hostname_wildcard_match("foobar.", "foo."));
+		
+		ensure("simple name mismatch, with begin period", 
+			   !_cert_hostname_wildcard_match(".foobar", ".foo"));		
+		
+		ensure("simple name mismatch, with subdomain", 
+			   !_cert_hostname_wildcard_match("foobar.bar", "foo.bar"));	
+		
+		ensure("simple name mismatch, with beginning wildcard", 
+			   !_cert_hostname_wildcard_match("foobara", "*bar"));	
+		
+		ensure("simple name mismatch, with ending wildcard", 
+			   !_cert_hostname_wildcard_match("oobar", "foo*"));
+		
+		ensure("simple name mismatch, with embedded wildcard", 
+			   !_cert_hostname_wildcard_match("oobar", "f*r"));		
+		
+		ensure("simple name mismatch, with dual embedded wildcard", 
+			   !_cert_hostname_wildcard_match("foobar", "f*d*ar"));
+		
+		ensure("simple wildcard", 
+			   _cert_hostname_wildcard_match("foobar", "*"));
+		
+		ensure("long domain", 
+			   _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com"));
+		
+		ensure("long domain with multiple wildcards", 
+			   _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com"));	
 
-		// ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));
+		ensure("end periods", 
+			   _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com."));	
+		
+		ensure("mismatch end period", 
+			   !_cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com"));
+		
+		ensure("mismatch end period2", 
+			   !_cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com."));				
+	}
+	
+	// test cert chain
+	template<> template<>
+	void sechandler_basic_test_object::test<7>()
+	{
+		// validate create from empty chain
+		LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+		ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0);
+
+		// Single cert in the chain.
+		X509_STORE_CTX *test_store = X509_STORE_CTX_new();
+		test_store->cert = mX509ChildCert;		
+		test_store->untrusted = NULL;
+		test_chain = new LLBasicCertificateChain(test_store);
+		X509_STORE_CTX_free(test_store);
+		ensure_equals("two elements in store", test_chain->size(), 1);		
+		X509* test_cert = (*test_chain)[0]->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);		
+		
+		// cert + CA
+		
+		test_store = X509_STORE_CTX_new();
+		test_store->cert = mX509ChildCert;
+		test_store->untrusted = sk_X509_new_null();
+		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+		test_chain = new LLBasicCertificateChain(test_store);
+		X509_STORE_CTX_free(test_store);
+		ensure_equals("two elements in store", test_chain->size(), 2);	
+		test_cert = (*test_chain)[0]->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		test_cert = (*test_chain)[1]->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
+		X509_free(test_cert);
+
+		// cert + nonrelated
+		
+		test_store = X509_STORE_CTX_new();
+		test_store->cert = mX509ChildCert;
+		test_store->untrusted = sk_X509_new_null();
+		sk_X509_push(test_store->untrusted, mX509TestCert);
+		test_chain = new LLBasicCertificateChain(test_store);
+		X509_STORE_CTX_free(test_store);
+		ensure_equals("two elements in store", test_chain->size(), 1);	
+		test_cert = (*test_chain)[0]->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		
+		// cert + CA + nonrelated
+		test_store = X509_STORE_CTX_new();
+		test_store->cert = mX509ChildCert;
+		test_store->untrusted = sk_X509_new_null();
+		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+		sk_X509_push(test_store->untrusted, mX509TestCert);
+		test_chain = new LLBasicCertificateChain(test_store);
+		X509_STORE_CTX_free(test_store);
+		ensure_equals("two elements in store", test_chain->size(), 2);	
+		test_cert = (*test_chain)[0]->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		test_cert = (*test_chain)[1]->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
+		X509_free(test_cert);
+
+		// cert + intermediate + CA 
+		test_store = X509_STORE_CTX_new();
+		test_store->cert = mX509ChildCert;
+		test_store->untrusted = sk_X509_new_null();
+		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
+		sk_X509_push(test_store->untrusted, mX509RootCert);
+		test_chain = new LLBasicCertificateChain(test_store);
+		X509_STORE_CTX_free(test_store);
+		ensure_equals("three elements in store", test_chain->size(), 3);	
+		test_cert = (*test_chain)[0]->getOpenSSLX509();
+		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
+		X509_free(test_cert);
+		test_cert = (*test_chain)[1]->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
+		X509_free(test_cert);
+
+		test_cert = (*test_chain)[2]->getOpenSSLX509();
+		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert));	
+		X509_free(test_cert);		
+	}
+	// test cert validation
+	template<> template<>
+	void sechandler_basic_test_object::test<8>()
+	{
+		// start with a trusted store with our known root cert
+		LLFile::remove("mycertstore.pem");
+		LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
+		test_store->add(new LLBasicCertificate(mX509RootCert));
+		LLSD validation_params;
+		
+		// validate basic trust for a chain containing only the intermediate cert.  (1 deep)
+		LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
+
+		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
+
+		test_chain->validate(0, test_store, validation_params);
+
+		// add the root certificate to the chain and revalidate
+		test_chain->add(new LLBasicCertificate(mX509RootCert));	
+		test_chain->validate(0, test_store, validation_params);
+
+		// add the child cert at the head of the chain, and revalidate (3 deep chain)
+		test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert));
+		test_chain->validate(0, test_store, validation_params);
+
+		// basic failure cases
+		test_chain = new LLBasicCertificateChain(NULL);
+		//validate with only the child cert
+		test_chain->add(new LLBasicCertificate(mX509ChildCert));
+		ensure_throws("no CA, with only a child cert", 
+					  LLCertValidationTrustException, 
+					  (*test_chain)[0],
+					  test_chain->validate, 
+					  VALIDATION_POLICY_TRUSTED, 
+					  test_store, 
+					  validation_params);
+
+
+		// validate without the trust flag.
+		test_chain->validate(0, test_store, validation_params);		
+
+		// clear out the store
+		test_store = new LLBasicCertificateStore("mycertstore.pem");
+		// append the intermediate cert
+		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));		
+		ensure_throws("no CA, with child and intermediate certs", 
+					  LLCertValidationTrustException, 
+					  (*test_chain)[1],
+					  test_chain->validate, 
+					  VALIDATION_POLICY_TRUSTED, 
+					  test_store, 
+					  validation_params);
+		// validate without the trust flag
+		test_chain->validate(0, test_store, validation_params);
+
+		// Test time validity
+		LLSD child_info = (*test_chain)[0]->getLLSD();
+		validation_params = LLSD::emptyMap();
+		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0);  
+		test_chain->validate(VALIDATION_POLICY_TIME, test_store, validation_params);
+
+		validation_params = LLSD::emptyMap();		
+		validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate();
+		
+		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0);
+ 		
+		// test not yet valid
+		ensure_throws("Child cert not yet valid", 
+					  LLCertValidationExpirationException, 
+					  (*test_chain)[0],
+					  test_chain->validate, 
+					  VALIDATION_POLICY_TIME, 
+					  test_store, 
+					  validation_params);	
+		validation_params = LLSD::emptyMap();		
+		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0);
+ 		
+		// test cert expired
+		ensure_throws("Child cert expired", 
+					  LLCertValidationExpirationException, 
+					  (*test_chain)[0],
+					  test_chain->validate, 
+					  VALIDATION_POLICY_TIME, 
+					  test_store, 
+					  validation_params);
+
+		// test SSL KU
+		// validate basic trust for a chain containing child and intermediate.
+		test_chain = new LLBasicCertificateChain(NULL);
+		test_chain->add(new LLBasicCertificate(mX509ChildCert));
+		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
+		test_chain->validate(VALIDATION_POLICY_SSL_KU, test_store, validation_params);	
+
+		test_chain = new LLBasicCertificateChain(NULL);
+		test_chain->add(new LLBasicCertificate(mX509TestCert));
+
+		ensure_throws("Cert doesn't have ku", 
+					  LLCertKeyUsageValidationException, 
+					  (*test_chain)[0],
+					  test_chain->validate, 
+					  VALIDATION_POLICY_SSL_KU, 
+					  test_store, 
+					  validation_params);
 	}
 };
+
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index c7a6b2ad15..f341482d6f 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -37,7 +37,51 @@
 #include "../../llxml/llcontrol.h"
 #include "llfile.h"
 
-LLControlGroup gSavedSettings;
+//----------------------------------------------------------------------------               
+// Mock objects for the dependencies of the code we're testing                               
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+                                   const std::string& initial_val,
+                                   const std::string& comment,
+                                   BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+
+std::string gCmdLineLoginURI;
+std::string gCmdLineGridChoice;
+std::string gCmdLineHelperURI;
+std::string gLoginPage;
+std::string gCurrentGrid;
+std::string LLControlGroup::getString(const std::string& name)
+{
+	if (name == "CmdLineGridChoice")
+		return gCmdLineGridChoice;
+	else if (name == "CmdLineHelperURI")
+		return gCmdLineHelperURI;
+	else if (name == "LoginPage")
+		return gLoginPage;
+	else if (name == "CurrentGrid")
+		return gCurrentGrid;
+	return "";
+}
+
+LLSD LLControlGroup::getLLSD(const std::string& name)
+{
+	if (name == "CmdLineLoginURI")
+	{
+		if(!gCmdLineLoginURI.empty())
+		{
+			return LLSD(gCmdLineLoginURI);
+		}
+	}
+	return LLSD();
+}
+
+
+LLControlGroup gSavedSettings("test");
+
 const char *gSampleGridFile = "<llsd><map>"
 "<key>grid1</key><map>"
 "  <key>favorite</key><integer>1</integer>"
@@ -68,13 +112,12 @@ namespace tut
 	{
 		viewerNetworkTest()
 		{
-			gSavedSettings.cleanup();
-			gSavedSettings.cleanup();
-			gSavedSettings.declareString("CmdLineGridChoice", "", "", FALSE);
-			gSavedSettings.declareString("CmdLineHelperURI", "", "", FALSE);
-			gSavedSettings.declareString("LoginPage", "", "", FALSE);
-			gSavedSettings.declareString("CurrentGrid", "", "", FALSE);
-			gSavedSettings.declareLLSD("CmdLineLoginURI", LLSD(), "", FALSE);
+			LLFile::remove("grid_test.xml");
+			gCmdLineLoginURI.clear();
+			gCmdLineGridChoice.clear();
+			gCmdLineHelperURI.clear();
+			gLoginPage.clear();
+			gCurrentGrid.clear();			
 		}
 		~viewerNetworkTest()
 		{
@@ -95,20 +138,25 @@ namespace tut
 	void viewerNetworkTestObject::test<1>()
 	{
 
-		LLGridManager manager("grid_test.xml");
+		LLGridManager *manager = LLGridManager::getInstance();
+		// grid file doesn't exist
+		manager->initialize("grid_test.xml");
 		// validate that some of the defaults are available.
-		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		std::map<std::string, std::string> known_grids = manager->getKnownGrids();
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 18);
+		ensure_equals("Agni has the right name and label", 
+					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
 #else // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 2);
+		ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2);
+		ensure_equals("Agni has the right name and label", 
+					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Secondlife.com"));		
 #endif // LL_RELEASE_FOR_DOWNLOAD
 
-		ensure_equals("Agni has the right name and label", 
-					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
+
 		ensure_equals("None exists", known_grids[""], "None");
 		
-		LLSD grid = manager.getGridInfo("util.agni.lindenlab.com");
+		LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
 		ensure("Grid info for agni is a map", grid.isMap());
 		ensure_equals("name is correct for agni", 
 					  grid[GRID_NAME_VALUE].asString(), std::string("util.agni.lindenlab.com"));
@@ -130,8 +178,8 @@ namespace tut
 		ensure_equals("Agni login page is correct",
 					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
 					  std::string("http://secondlife.com/app/login/"));
-		ensure("Agni is not a favorite",
-			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("Agni is a favorite",
+			   grid.has(GRID_IS_FAVORITE_VALUE));
 		ensure("Agni is a system grid", 
 			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
 		ensure("Grid file wasn't greated as it wasn't saved", 
@@ -146,20 +194,25 @@ namespace tut
 		gridfile << gSampleGridFile;
 		gridfile.close();
 		
-		LLGridManager manager("grid_test.xml");
-		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("adding a grid via a grid file increases known grid size", 
 					  known_grids.size(), 19);
+		ensure_equals("Agni is still there after we've added a grid via a grid file", 
+					  known_grids["util.agni.lindenlab.com"], std::string("Agni"));
+	
 #else
 		ensure_equals("adding a grid via a grid file increases known grid size", 
 					  known_grids.size(), 3);
-#endif
 		ensure_equals("Agni is still there after we've added a grid via a grid file", 
-					  known_grids["util.agni.lindenlab.com"], std::string("Agni"));
+					  known_grids["util.agni.lindenlab.com"], std::string("Secondlife.com"));
+
+#endif
 	
+		
 		// assure Agni doesn't get overwritten
-		LLSD grid = manager.getGridInfo("util.agni.lindenlab.com");
+		LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Agni grid label was not modified by grid file", 
 					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
@@ -181,14 +234,14 @@ namespace tut
 		ensure_equals("Agni login page the same after grid file", 
 					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
 					  std::string("http://secondlife.com/app/login/"));
-		ensure("Agni still not favorite after grid file", 
-			   !grid.has(GRID_IS_FAVORITE_VALUE));
+		ensure("Agni still a favorite after grid file", 
+			   grid.has(GRID_IS_FAVORITE_VALUE));
 		ensure("Agni system grid still set after grid file", 
 			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
 		
 		ensure_equals("Grid file adds to name<->label map", 
 					  known_grids["grid1"], std::string("mylabel"));
-		grid = manager.getGridInfo("grid1");
+		grid = LLGridManager::getInstance()->getGridInfo("grid1");
 		ensure_equals("grid file grid name is set",
 					  grid[GRID_NAME_VALUE].asString(), std::string("grid1"));
 		ensure_equals("grid file label is set", 
@@ -217,22 +270,16 @@ namespace tut
 	template<> template<>
 	void viewerNetworkTestObject::test<3>()
 	{	
-		LLSD loginURI = std::string("https://my.login.uri/cgi-bin/login.cgi");
-		gSavedSettings.setLLSD("CmdLineLoginURI", loginURI);
-		LLGridManager manager("grid_test.xml");
+		gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi";
 		
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		// with single login uri specified.
-		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
-#ifndef LL_RELEASE_FOR_DOWNLOAD
+		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure_equals("adding a command line grid increases known grid size", 
 					  known_grids.size(), 19);
-#else
-		ensure_equals("adding a command line grid increases known grid size", 
-					  known_grids.size(), 3);
-#endif
 		ensure_equals("Command line grid is added to the list of grids", 
 					  known_grids["my.login.uri"], std::string("my.login.uri"));
-		LLSD grid = manager.getGridInfo("my.login.uri");
+		LLSD grid = LLGridManager::getInstance()->getGridInfo("my.login.uri");
 		ensure_equals("Command line grid name is set",
 					  grid[GRID_NAME_VALUE].asString(), std::string("my.login.uri"));
 		ensure_equals("Command line grid label is set", 
@@ -254,19 +301,14 @@ namespace tut
 			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));		
 		
 		// now try a command line with a custom grid identifier
-		gSavedSettings.setString("CmdLineGridChoice", "mycustomgridchoice");
-		manager = LLGridManager("grid_test.xml");
-		known_grids = manager.getKnownGrids();
-#ifndef LL_RELEASE_FOR_DOWNLOAD
+		gCmdLineGridChoice = "mycustomgridchoice";		
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure_equals("adding a command line grid with custom name increases known grid size", 
 					  known_grids.size(), 19);
-#else
-		ensure_equals("adding a command line grid with custom name inceases known grid size", 
-					  known_grids.size(), 3);
-#endif
 		ensure_equals("Custom Command line grid is added to the list of grids", 
 					  known_grids["mycustomgridchoice"], std::string("mycustomgridchoice"));
-		grid = manager.getGridInfo("mycustomgridchoice");
+		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");
 		ensure_equals("Custom Command line grid name is set",
 					  grid[GRID_NAME_VALUE].asString(), std::string("mycustomgridchoice"));
 		ensure_equals("Custom Command line grid label is set", 
@@ -278,16 +320,16 @@ namespace tut
 					  std::string("https://my.login.uri/cgi-bin/login.cgi"));
 		
 		// add a helperuri
-		gSavedSettings.setString("CmdLineHelperURI", "myhelperuri");
-		manager = LLGridManager("grid_test.xml");
-		grid = manager.getGridInfo("mycustomgridchoice");		
+		gCmdLineHelperURI = "myhelperuri";
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");		
 		ensure_equals("Validate command line helper uri", 
 					  grid[GRID_HELPER_URI_VALUE].asString(), std::string("myhelperuri"));		
 		
 		// add a login page
-		gSavedSettings.setString("LoginPage", "myloginpage");
-		manager = LLGridManager("grid_test.xml");
-		grid = manager.getGridInfo("mycustomgridchoice");		
+		gLoginPage = "myloginpage";
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");		
 		ensure_equals("Validate command line helper uri", 
 					  grid[GRID_LOGIN_PAGE_VALUE].asString(), std::string("myloginpage"));			
 	}
@@ -301,36 +343,34 @@ namespace tut
 		// adding a grid with simply a name will populate the values.
 		grid[GRID_NAME_VALUE] = "myaddedgrid";
 
-		loginURI.append(std::string("https://my.login.uri/cgi-bin/login.cgi"));
-		gSavedSettings.setLLSD("CmdLineLoginURI", loginURI);
-		LLGridManager manager("grid_test.xml");
-		manager.addGrid(grid);
-		manager.setGridChoice("util.agni.lindenlab.com");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		LLGridManager::getInstance()->addGrid(grid);
+		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
 #ifndef LL_RELEASE_FOR_DOWNLOAD		
-		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("Agni"));
+		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
 #else // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("Secondlife.com"));		
+		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Secondlife.com"));		
 #endif // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("getGridName", manager.getGridName(), 
+		ensure_equals("getGridName", LLGridManager::getInstance()->getGridName(), 
 					  std::string("util.agni.lindenlab.com"));
-		ensure_equals("getHelperURI", manager.getHelperURI(), 
+		ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(), 
 					  std::string("https://secondlife.com/helpers/"));
-		ensure_equals("getLoginPage", manager.getLoginPage(), 
+		ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(), 
 					  std::string("http://secondlife.com/app/login/"));
-		ensure_equals("getLoginPage2", manager.getLoginPage("util.agni.lindenlab.com"), 
+		ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), 
 					  std::string("http://secondlife.com/app/login/"));
-		ensure("Is Agni a production grid", manager.isInProductionGrid());		
+		ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());		
 		std::vector<std::string> uris;
-		manager.getLoginURIs(uris);
+		LLGridManager::getInstance()->getLoginURIs(uris);
 		ensure_equals("getLoginURIs size", uris.size(), 1);
 		ensure_equals("getLoginURIs", uris[0], 
 					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
-		manager.setGridChoice("myaddedgrid");
-		ensure_equals("getGridLabel", manager.getGridLabel(), std::string("myaddedgrid"));		
-		ensure("Is myaddedgrid a production grid", !manager.isInProductionGrid());
+		LLGridManager::getInstance()->setGridChoice("myaddedgrid");
+		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("myaddedgrid"));		
+		ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid());
 		
-		manager.setFavorite();
-		grid = manager.getGridInfo("myaddedgrid");
+		LLGridManager::getInstance()->setFavorite();
+		grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
 		ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE));
 	}
 	
@@ -338,12 +378,12 @@ namespace tut
 	template<> template<>
 	void viewerNetworkTestObject::test<5>()
 	{
-		LLGridManager manager("grid_test.xml");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		LLSD grid = LLSD::emptyMap();
 		// adding a grid with simply a name will populate the values.
 		grid[GRID_NAME_VALUE] = "myaddedgrid";
-		manager.addGrid(grid);
-		grid = manager.getGridInfo("myaddedgrid");
+		LLGridManager::getInstance()->addGrid(grid);
+		grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
 		
 		ensure_equals("name based grid has name value", 
 					  grid[GRID_NAME_VALUE].asString(),
@@ -380,29 +420,29 @@ namespace tut
 	{
 		// try with initial grid list without a grid file,
 		// without setting the grid to a saveable favorite.
-		LLGridManager manager("grid_test.xml");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		LLSD grid = LLSD::emptyMap();
 		grid[GRID_NAME_VALUE] = std::string("mynewgridname");
-		manager.addGrid(grid);
-		manager.saveFavorites();
+		LLGridManager::getInstance()->addGrid(grid);
+		LLGridManager::getInstance()->saveFavorites();
 		ensure("Grid file exists after saving", 
 			   LLFile::isfile("grid_test.xml"));
-		manager = LLGridManager("grid_test.xml");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		// should not be there
-		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure("New grid wasn't added to persisted list without being marked a favorite",
 					  known_grids.find(std::string("mynewgridname")) == known_grids.end());
 		
 		// mark a grid a favorite to make sure it's persisted
-		manager.addGrid(grid);
-		manager.setGridChoice("mynewgridname");
-		manager.setFavorite();
-		manager.saveFavorites();
+		LLGridManager::getInstance()->addGrid(grid);
+		LLGridManager::getInstance()->setGridChoice("mynewgridname");
+		LLGridManager::getInstance()->setFavorite();
+		LLGridManager::getInstance()->saveFavorites();
 		ensure("Grid file exists after saving", 
 			   LLFile::isfile("grid_test.xml"));
-		manager = LLGridManager("grid_test.xml");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		// should not be there
-		known_grids = manager.getKnownGrids();
+		known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure("New grid wasn't added to persisted list after being marked a favorite",
 					  known_grids.find(std::string("mynewgridname")) !=
 					  known_grids.end());
@@ -417,28 +457,28 @@ namespace tut
 		gridfile << gSampleGridFile;
 		gridfile.close();
 		
-		LLGridManager manager("grid_test.xml");
+		LLGridManager::getInstance()->initialize("grid_test.xml");
 		LLSD grid = LLSD::emptyMap();
 		grid[GRID_NAME_VALUE] = std::string("mynewgridname");
-		manager.addGrid(grid);
-		manager.saveFavorites();
+		LLGridManager::getInstance()->addGrid(grid);
+		LLGridManager::getInstance()->saveFavorites();
 		// validate we didn't lose existing favorites
-		manager = LLGridManager("grid_test.xml");
-		std::map<std::string, std::string> known_grids = manager.getKnownGrids();
+		LLGridManager::getInstance()->initialize("grid_test.xml");
+		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure("New grid wasn't added to persisted list after being marked a favorite",
 			   known_grids.find(std::string("grid1")) !=
 			   known_grids.end());
 		
 		// add a grid
-		manager.addGrid(grid);
-		manager.setGridChoice("mynewgridname");
-		manager.setFavorite();
-		manager.saveFavorites();
-		known_grids = manager.getKnownGrids();
+		LLGridManager::getInstance()->addGrid(grid);
+		LLGridManager::getInstance()->setGridChoice("mynewgridname");
+		LLGridManager::getInstance()->setFavorite();
+		LLGridManager::getInstance()->saveFavorites();
+		known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure("New grid wasn't added to persisted list after being marked a favorite",
 			   known_grids.find(std::string("grid1")) !=
 			   known_grids.end());
-		known_grids = manager.getKnownGrids();
+		known_grids = LLGridManager::getInstance()->getKnownGrids();
 		ensure("New grid wasn't added to persisted list after being marked a favorite",
 			   known_grids.find(std::string("mynewgridname")) !=
 			   known_grids.end());
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index 7723c3ca8f..452930a3b3 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -292,7 +292,12 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 	// to success, add a data/message and data/reason fields.
 	LLSD error_response;
 	error_response["reason"] = mAuthResponse["status"];
+	error_response["errorcode"] = mAuthResponse["errorcode"];
 	error_response["message"] = mAuthResponse["error"];
+	if(mAuthResponse.has("certificate"))
+	{
+		error_response["certificate"] = mAuthResponse["certificate"];
+	}
 	sendProgressEvent("offline", "fail.login", error_response);
 	}
 	catch (...) {
-- 
cgit v1.2.3


From 311aaf7ffd8f7dc95dba84f10fcae97bc93901bb Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Tue, 2 Feb 2010 22:17:39 -0800
Subject: add EOL to llsecapi_test.cpp to pass checkin filters

---
 indra/newview/tests/llsecapi_test.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
index 22bc47b6d3..caa1461987 100644
--- a/indra/newview/tests/llsecapi_test.cpp
+++ b/indra/newview/tests/llsecapi_test.cpp
@@ -185,4 +185,4 @@ namespace tut
 			   retrieved_test2_handler == test2_handler);
 		
 	}
-}
\ No newline at end of file
+}
-- 
cgit v1.2.3


From 7a64aad1def1b0612addbf2e66c66db061d7e182 Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxie@lindenlab.com>
Date: Thu, 9 Jul 2009 20:56:23 +0000
Subject: DEV-34822 - merge 1.23 merge -r119443 - basic slurl handling ignore
 dead branch

---
 indra/llcommon/lluri.cpp                           |   3 +-
 indra/llui/llurlentry.cpp                          |  29 +-
 indra/llui/tests/llurlentry_test.cpp               |  24 ++
 indra/newview/CMakeLists.txt                       |  11 +-
 indra/newview/Info-SecondLife.plist                |  28 ++
 .../installers/windows/installer_template.nsi      |   6 +
 indra/newview/llagent.h                            |   5 +-
 indra/newview/llagentlistener.cpp                  |   5 +-
 indra/newview/llagentui.cpp                        |  17 +-
 indra/newview/llagentui.h                          |   3 +-
 indra/newview/llappviewer.cpp                      |  57 +--
 indra/newview/llappviewermacosx.cpp                |   1 -
 indra/newview/llfloaterbuyland.cpp                 |   2 +-
 indra/newview/llfloaterchat.cpp                    |   2 +-
 indra/newview/llfloaterland.cpp                    |   6 +-
 indra/newview/llfloaterpreference.cpp              |   4 +-
 indra/newview/llfloaterregioninfo.cpp              |   3 +-
 indra/newview/llfloaterreporter.cpp                |   6 +-
 indra/newview/llfloaterworldmap.cpp                |  23 +-
 indra/newview/llfloaterworldmap.h                  |   3 +-
 indra/newview/llinspectobject.cpp                  |   6 +-
 indra/newview/llinspectremoteobject.cpp            |   4 +-
 indra/newview/lllandmarkactions.cpp                |   4 +-
 indra/newview/lllocationinputctrl.cpp              |   5 +-
 indra/newview/llloginhandler.cpp                   |  20 +-
 indra/newview/llloginhandler.h                     |   2 +-
 indra/newview/lllogininstance.cpp                  |  16 +-
 indra/newview/llnavigationbar.cpp                  |  18 +-
 indra/newview/llpanellogin.cpp                     | 262 ++++++++----
 indra/newview/llpanellogin.h                       |  13 +-
 indra/newview/llpanelplacestab.cpp                 |   5 +-
 indra/newview/llselectmgr.cpp                      |   8 +-
 indra/newview/llslurl.cpp                          | 470 +++++++++++++++++----
 indra/newview/llslurl.h                            | 146 +++----
 indra/newview/llstartup.cpp                        |  87 ++--
 indra/newview/llstartup.h                          |   9 +-
 indra/newview/llstylemap.cpp                       |   2 +-
 indra/newview/llurldispatcher.cpp                  | 213 ++++------
 indra/newview/llurldispatcher.h                    |  18 +-
 indra/newview/llurldispatcherlistener.cpp          |   1 +
 indra/newview/llurllineeditorctrl.cpp              |   2 +-
 indra/newview/llviewermessage.cpp                  |  10 +-
 indra/newview/llviewernetwork.cpp                  |  36 +-
 indra/newview/llviewernetwork.h                    |   9 +-
 indra/newview/llviewerwindow.cpp                   |   2 +-
 .../newview/skins/default/xui/en/notifications.xml |   9 +
 indra/newview/tests/lllogininstance_test.cpp       |   9 +-
 indra/newview/tests/llslurl_test.cpp               | 258 +++++++++++
 48 files changed, 1306 insertions(+), 576 deletions(-)
 create mode 100644 indra/newview/tests/llslurl_test.cpp

(limited to 'indra')

diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index f6e8f01f0e..b28657e2f4 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -220,7 +220,8 @@ static BOOL isDefault(const std::string& scheme, U16 port)
 void LLURI::parseAuthorityAndPathUsingOpaque()
 {
 	if (mScheme == "http" || mScheme == "https" ||
-		mScheme == "ftp" || mScheme == "secondlife" )
+		mScheme == "ftp" || mScheme == "secondlife" || 
+		mScheme == "x-grid-location-info")
 	{
 		if (mEscapedOpaque.substr(0,2) != "//")
 		{
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 1b6dd1b264..466ac2a7d1 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -39,6 +39,9 @@
 #include "lltrans.h"
 #include "lluicolortable.h"
 
+#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
+
+
 LLUrlEntryBase::LLUrlEntryBase()
 : mColor(LLUIColorTable::instance().getColor("HTMLLinkColor"))
 {
@@ -300,10 +303,11 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const
 //
 // LLUrlEntryAgent Describes a Second Life agent Url, e.g.,
 // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
+// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
 //
 LLUrlEntryAgent::LLUrlEntryAgent()
 {
-	mPattern = boost::regex("secondlife:///app/agent/[\\da-f-]+/\\w+",
+	mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_agent.xml";
 	mIcon = "Generic_Person";
@@ -358,10 +362,11 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
 // LLUrlEntryGroup Describes a Second Life group Url, e.g.,
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
+// x-grid-location-info://lincoln.lindenlab.com/app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
 //
 LLUrlEntryGroup::LLUrlEntryGroup()
 {
-	mPattern = boost::regex("secondlife:///app/group/[\\da-f-]+/\\w+",
+	mPattern = boost::regex(APP_HEADER_REGEX "/group/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_group.xml";
 	mIcon = "Generic_Group";
@@ -422,7 +427,8 @@ LLUrlEntryInventory::LLUrlEntryInventory()
 	//*TODO: add supporting of inventory item names with whitespaces
 	//this pattern cann't parse for example 
 	//secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
-	mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+\\S*",
+	//x-grid-location-info://lincoln.lindenlab.com/app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
+	mPattern = boost::regex(APP_HEADER_REGEX "/inventory/[\\da-f-]+/\\w+\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_inventory.xml";
 }
@@ -436,10 +442,11 @@ std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLab
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
 /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
+/// x-grid-location-info://lincoln.lindenlab.com/app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
 ///
 LLUrlEntryParcel::LLUrlEntryParcel()
 {
-	mPattern = boost::regex("secondlife:///app/parcel/[\\da-f-]+/about",
+	mPattern = boost::regex(APP_HEADER_REGEX "/parcel/[\\da-f-]+/about",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_parcel.xml";
 	mTooltip = LLTrans::getString("TooltipParcelUrl");
@@ -455,7 +462,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
 //
 LLUrlEntryPlace::LLUrlEntryPlace()
 {
-	mPattern = boost::regex("secondlife://\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
+	mPattern = boost::regex("((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slurl.xml";
 	mTooltip = LLTrans::getString("TooltipSLURL");
@@ -500,10 +507,11 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
 //
 // LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
 // secondlife:///app/teleport/Ahern/50/50/50/
+// x-grid-location-info://lincoln.lindenlab.com/app/teleport/Ahern/50/50/50/
 //
 LLUrlEntryTeleport::LLUrlEntryTeleport()
 {
-	mPattern = boost::regex("secondlife:///app/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
+	mPattern = boost::regex(APP_HEADER_REGEX "/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_teleport.xml";
 	mTooltip = LLTrans::getString("TooltipTeleportUrl");
@@ -521,7 +529,12 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe
 	LLURI uri(url);
 	LLSD path_array = uri.pathArray();
 	S32 path_parts = path_array.size();
-	const std::string label = LLTrans::getString("SLurlLabelTeleport");
+	std::string host = uri.hostName();
+	std::string label = LLTrans::getString("SLurlLabelTeleport");
+	if (!host.empty())
+	{
+		label += " " + host;
+	}
 	if (path_parts == 6)
 	{
 		// handle teleport url with (X,Y,Z) coordinates
@@ -606,7 +619,7 @@ std::string LLUrlEntrySLLabel::getUrl(const std::string &string)
 //
 LLUrlEntryWorldMap::LLUrlEntryWorldMap()
 {
-	mPattern = boost::regex("secondlife:///app/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
+	mPattern = boost::regex(APP_HEADER_REGEX "/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_map.xml";
 	mTooltip = LLTrans::getString("TooltipMapUrl");
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 38cf7124ce..1d66bc268b 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -289,6 +289,13 @@ namespace tut
 				  "XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar",
 				  "secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar");
 
+		testRegex("Nebraska Agent Url ", r,
+				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
+				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
+
+		testRegex("Nebraska Agent Url Multicase with Text", r,
+				  "M x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
+				  "x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
 	}
 
 	template<> template<>
@@ -319,6 +326,15 @@ namespace tut
 		testRegex("Group Url multicase", r,
 				  "XXX secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About XXX",
 				  "secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About");
+		
+		testRegex("Nebraska Group Url ", r,
+				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
+				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
+		
+		testRegex("Nebraska Group Url Multicase ith Text", r,
+				  "M x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
+				  "x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
+		
 	}
 
 	template<> template<>
@@ -367,6 +383,10 @@ namespace tut
 		testRegex("SLURL with quote", r,
 				  "XXX secondlife://A'ksha%20Oasis/41/166/701 XXX",
 				  "secondlife://A'ksha%20Oasis/41/166/701");
+		
+		testRegex("Nebraska All Hands (50,50) [2] with text", r,
+				  "XXX x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50 XXX",
+				  "x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50");		
 	}
 
 	template<> template<>
@@ -468,6 +488,10 @@ namespace tut
 		testRegex("Teleport url with quote", r,
 				  "XXX secondlife:///app/teleport/A'ksha%20Oasis/41/166/701 XXX",
 				  "secondlife:///app/teleport/A'ksha%20Oasis/41/166/701");
+		
+		testRegex("Nebraska All Hands", r,
+				  "XXX x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50 XXX",
+				  "x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50");		
 	}
 
 	template<> template<>
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 35f0a5036d..7891add9b8 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -449,7 +449,6 @@ set(viewer_SOURCE_FILES
     llurldispatcherlistener.cpp
     llurlhistory.cpp
     llurllineeditorctrl.cpp
-    llurlsimstring.cpp
     llurlwhitelist.cpp
     llvectorperfoptions.cpp
     llversioninfo.cpp
@@ -956,7 +955,6 @@ set(viewer_HEADER_FILES
     llurldispatcherlistener.h
     llurlhistory.h
     llurllineeditorctrl.h
-    llurlsimstring.h
     llurlwhitelist.h
     llvectorperfoptions.h
     llversioninfo.h
@@ -1822,12 +1820,21 @@ if (LL_TESTS)
      llsecapi.cpp
     "${test_libs}"
     )
+  set(llslurl_test_sources
+      llslurl.cpp
+      llviewernetwork.cpp
+  )
 
   LL_ADD_INTEGRATION_TEST(llviewernetwork
      llviewernetwork.cpp
     "${test_libs}"
     )
 
+  LL_ADD_INTEGRATION_TEST(llslurl
+     "${llslurl_test_sources}"
+    "${test_libs}"
+    )
+
   #ADD_VIEWER_BUILD_TEST(llmemoryview viewer)
   #ADD_VIEWER_BUILD_TEST(llagentaccess viewer)
   #ADD_VIEWER_BUILD_TEST(llworldmap viewer)
diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist
index 38ebb22b84..a800f4ba79 100644
--- a/indra/newview/Info-SecondLife.plist
+++ b/indra/newview/Info-SecondLife.plist
@@ -18,6 +18,33 @@
 	<string>APPL</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
+        <key>CFBundleDocumentTypes</key>
+        <array>
+                <dict>
+                        <key>CFBundleTypeExtensions</key>
+                        <array>
+                                <string>slurl</string>
+                        </array>
+                        <key>CFBundleTypeIconFile</key>
+                        <string>seconlife</string>
+                        <key>CFBundleTypeMIMETypes</key>
+                        <array>
+                                <string>application/x-grid-location-info</string>
+                        </array>
+                        <key>CFBundleTypeName</key>
+                        <string>Secondlife SLURL</string>
+			<key>CFBundleTypeOSTypes</key>
+			<array>
+			  <string>SLRL</string>
+			</array>
+                        <key>CFBundleTypeRole</key>
+                        <string>Viewer</string>
+                        <key>LSTypeIsPackage</key>
+			<true/>
+                        <key>NSDocumentClass</key>
+                        <string>SecondLifeSLURL</string>
+                </dict>
+        </array>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -26,6 +53,7 @@
 			<key>CFBundleURLSchemes</key>
 			<array>
 				<string>secondlife</string>
+				<string>x-grid-location-info</string>
 			</array>
 			<key>LSIsAppleDefaultForScheme</key>
 			<true/>
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index a7322749ca..b7b4c54001 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -797,6 +797,12 @@ WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
 ;; URL param must be last item passed to viewer, it ignores subsequent params
 ;; to avoid parameter injection attacks.
 WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
+WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
+;; URL param must be last item passed to viewer, it ignores subsequent params
+;; to avoid parameter injection attacks.
+WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
 
 ; write out uninstaller
 WriteUninstaller "$INSTDIR\uninst.exe"
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 2e95dc72be..4ea1185925 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -45,6 +45,7 @@
 #include "llpointer.h"
 #include "lluicolor.h"
 #include "llvoavatardefines.h"
+#include "llslurl.h"
 
 extern const BOOL 	ANIMATE;
 extern const U8 	AGENT_STATE_TYPING;  // Typing indication
@@ -594,13 +595,13 @@ public:
 
 public:
 	static void 	parseTeleportMessages(const std::string& xml_filename);
-	const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
+	const LLSLURL getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
 public:
 	// ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
 	static std::map<std::string, std::string> sTeleportErrorMessages;
 	static std::map<std::string, std::string> sTeleportProgressMessages;
 private:
-	std::string		mTeleportSourceSLURL; 			// SLURL where last TP began
+	LLSLURL	mTeleportSourceSLURL; 			// SLURL where last TP began
 
 	//--------------------------------------------------------------------
 	// Teleport Actions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index b3ed7c353e..7a8205acb5 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -53,7 +53,10 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
 	}
 	else
 	{
-		std::string url = LLSLURL::buildSLURL(event_data["regionname"], event_data["x"], event_data["y"], event_data["z"]);
+		std::string url = LLSLURL(event_data["regionname"], 
+								  LLVector3(event_data["x"].asReal(), 
+											event_data["y"].asReal(), 
+											event_data["z"].asReal())).getSLURLString();
 		LLURLDispatcher::dispatch(url, NULL, false);
 	}
 }
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 7404fe5bc4..e26c6470ef 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -77,16 +77,15 @@ void LLAgentUI::buildFullname(std::string& name)
 }
 
 //static
-std::string LLAgentUI::buildSLURL(const bool escaped /*= true*/)
+LLSLURL LLAgentUI::buildSLURL(const bool escaped /*= true*/)
 {
-	std::string slurl;
-	LLViewerRegion *regionp = gAgent.getRegion();
-	if (regionp)
-	{
-		LLVector3d agentPos = gAgent.getPositionGlobal();
-		slurl = LLSLURL::buildSLURLfromPosGlobal(regionp->getName(), agentPos, escaped);
-	}
-	return slurl;
+      LLSLURL slurl;
+      LLViewerRegion *regionp = gAgent.getRegion();
+      if (regionp)
+      {
+		  slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
+      }
+      return slurl;
 }
 
 //static
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index 3478793e38..9d10bc7322 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -32,6 +32,7 @@
 
 #ifndef LLAGENTUI_H
 #define LLAGENTUI_H
+#include "llslurl.h"
 
 class LLAgentUI
 {
@@ -48,7 +49,7 @@ public:
 	static void buildName(std::string& name);
 	static void buildFullname(std::string &name);
 
-	static std::string buildSLURL(const bool escaped = true);
+	static LLSLURL buildSLURL(const bool escaped = true);
 	//build location string using the current position of gAgent.
 	static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
 	//build location string using a region position of the avatar. 
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index cc32346441..d1e33fa91a 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -150,7 +150,7 @@
 #include "llworld.h"
 #include "llhudeffecttrail.h"
 #include "llvectorperfoptions.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
 #include "llwatchdog.h"
 
 // Included so that constants/settings might be initialized
@@ -2078,30 +2078,21 @@ bool LLAppViewer::initConfiguration()
     // injection and steal passwords. Phoenix. SL-55321
     if(clp.hasOption("url"))
     {
-        std::string slurl = clp.getOption("url")[0];
-        if (LLSLURL::isSLURLCommand(slurl))
-        {
-	        LLStartUp::sSLURLCommand = slurl;
-        }
-        else
-        {
-	        LLURLSimString::setString(slurl);
-        }
+		LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0]));
+		if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) 
+		{  
+			LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
+			
+		}  
     }
     else if(clp.hasOption("slurl"))
     {
-        std::string slurl = clp.getOption("slurl")[0];
-        if(LLSLURL::isSLURL(slurl))
-        {
-            if (LLSLURL::isSLURLCommand(slurl))
-            {
-	            LLStartUp::sSLURLCommand = slurl;
-            }
-            else
-            {
-	            LLURLSimString::setString(slurl);
-            }
-        }
+      LLStartUp::setStartSLURL(LLSLURL(clp.getOption("surl")[0]));
+      if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) 
+	  {  
+		  LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
+		  
+	  }  
     }
 
     const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
@@ -2180,18 +2171,10 @@ bool LLAppViewer::initConfiguration()
 	// don't call anotherInstanceRunning() when doing URL handoff, as
 	// it relies on checking a marker file which will not work when running
 	// out of different directories
-	std::string slurl;
-	if (!LLStartUp::sSLURLCommand.empty())
-	{
-		slurl = LLStartUp::sSLURLCommand;
-	}
-	else if (LLURLSimString::parse())
-	{
-		slurl = LLURLSimString::getURL();
-	}
-	if (!slurl.empty())
+
+	if (LLStartUp::getStartSLURL().isValid())
 	{
-		if (sendURLToOtherInstance(slurl))
+		if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
 		{
 			// successfully handed off URL to existing instance, exit
 			return false;
@@ -2247,9 +2230,9 @@ bool LLAppViewer::initConfiguration()
 
    	// need to do this here - need to have initialized global settings first
 	std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
-	if ( nextLoginLocation.length() )
+	if ( !nextLoginLocation.empty() )
 	{
-		LLURLSimString::setString( nextLoginLocation );
+		LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
 	};
 
 	gLastRunVersion = gSavedSettings.getString("LastRunVersion");
@@ -4246,10 +4229,10 @@ void LLAppViewer::launchUpdater()
 	LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
 
 	// if a sim name was passed in via command line parameter (typically through a SLURL)
-	if ( LLURLSimString::sInstance.mSimString.length() )
+	if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION )
 	{
 		// record the location to start at next time
-		gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); 
+		gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString()); 
 	};
 
 #if LL_WINDOWS
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 1282e437f2..d8c4a7d9d9 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -44,7 +44,6 @@
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
 #include "llmd5.h"
-#include "llurlsimstring.h"
 #include "llfloaterworldmap.h"
 #include "llurldispatcher.h"
 #include <Carbon/Carbon.h>
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 10a4908f3a..5fb129b87b 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -808,7 +808,7 @@ void LLFloaterBuyLandUI::updateNames()
 	else
 	{
 		mParcelSellerName =
-			LLSLURL::buildCommand("agent", parcelp->getOwnerID(), "inspect");
+			LLSLURL("agent", parcelp->getOwnerID(), "inspect").getSLURLString();
 	}
 }
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index b9e0f928f1..09b47c9866 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -168,7 +168,7 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4&
 	if (chat.mSourceType == CHAT_SOURCE_AGENT &&
 		chat.mFromID != LLUUID::null)
 	{
-		chat.mURL = LLSLURL::buildCommand("agent", chat.mFromID, "inspect");
+		chat.mURL = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
 	}
 
 	// If the chat line has an associated url, link it up to the name.
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 9b6e24f251..920c7ac58c 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -767,7 +767,7 @@ void LLPanelLandGeneral::refreshNames()
 	else
 	{
 		// Figure out the owner's name
-		owner = LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect");
+		owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
 	}
 
 	if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
@@ -779,7 +779,7 @@ void LLPanelLandGeneral::refreshNames()
 	std::string group;
 	if (!parcel->getGroupID().isNull())
 	{
-		group = LLSLURL::buildCommand("group", parcel->getGroupID(), "inspect");
+		group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
 	}
 	mTextGroup->setText(group);
 
@@ -787,7 +787,7 @@ void LLPanelLandGeneral::refreshNames()
 	if(auth_buyer_id.notNull())
 	{
 		std::string name;
-		name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
+		name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
 		mSaleInfoForSale2->setTextArg("[BUYER]", name);
 	}
 	else
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index d0716f67b8..f43aa697d1 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -614,7 +614,7 @@ void LLFloaterPreference::onBtnOK()
 		llinfos << "Can't close preferences!" << llendl;
 	}
 
-	LLPanelLogin::refreshLocation( false );
+	LLPanelLogin::updateLocationCombo( false );
 }
 
 // static 
@@ -631,7 +631,7 @@ void LLFloaterPreference::onBtnApply( )
 	apply();
 	saveSettings();
 
-	LLPanelLogin::refreshLocation( false );
+	LLPanelLogin::updateLocationCombo( false );
 }
 
 // static 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c4b87c1b2d..1bed47e7e1 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -2926,8 +2926,7 @@ bool LLDispatchEstateUpdateInfo::operator()(
 	LLUUID owner_id(strings[1]);
 	regionp->setOwner(owner_id);
 	// Update estate owner name in UI
-	std::string owner_name =
-		LLSLURL::buildCommand("agent", owner_id, "inspect");
+	std::string owner_name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
 	panel->setOwnerName(owner_name);
 
 	U32 estate_id = strtoul(strings[2].c_str(), NULL, 10);
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index a52fe131cd..3fd37c09dd 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -124,7 +124,7 @@ void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg)
 // virtual
 BOOL LLFloaterReporter::postBuild()
 {
-	childSetText("abuse_location_edit", LLAgentUI::buildSLURL());
+	childSetText("abuse_location_edit", LLAgentUI::buildSLURL().getSLURLString());
 
 	enableControls(TRUE);
 
@@ -279,7 +279,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 				}
 				childSetText("object_name", object_owner);
 				std::string owner_link =
-					LLSLURL::buildCommand("agent", mObjectID, "inspect");
+					LLSLURL("agent", mObjectID, "inspect").getSLURLString();
 				childSetText("owner_name", owner_link);
 				childSetText("abuser_name_edit", object_owner);
 				mAbuserID = object_id;
@@ -483,7 +483,7 @@ void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name
 {
 	childSetText("object_name", object_name);
 	std::string owner_link =
-		LLSLURL::buildCommand("agent", owner_id, "inspect");
+		LLSLURL("agent", owner_id, "inspect").getSLURLString();
 	childSetText("owner_name", owner_link);
 	childSetText("abuser_name_edit", owner_name);
 	mAbuserID = owner_id;
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 0781d8ed06..49416fff1c 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -457,7 +457,7 @@ void LLFloaterWorldMap::draw()
 	childSetEnabled("Teleport", (BOOL)tracking_status);
 //	childSetEnabled("Clear", (BOOL)tracking_status);
 	childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
-	childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
+	childSetEnabled("copy_slurl", (mSLURL.isValid()) );
 
 	setMouseOpaque(TRUE);
 	getDragHandle()->setMouseOpaque(TRUE);
@@ -656,14 +656,8 @@ void LLFloaterWorldMap::updateLocation()
 				childSetValue("location", agent_sim_name);
 
 				// Figure out where user is
-				LLVector3d agentPos = gAgent.getPositionGlobal();
-
-				S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
-				S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
-				S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
-
 				// Set the current SLURL
-				mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
+				mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
 			}
 		}
 
@@ -690,18 +684,15 @@ void LLFloaterWorldMap::updateLocation()
 		}
 
 		childSetValue("location", sim_name);
-		
-		F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
-		F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
 
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
 		{
-			mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
+		  mSLURL = LLSLURL(sim_name, pos_global);
 		}
 		else
 		{	// Empty SLURL will disable the "Copy SLURL to clipboard" button
-			mSLURL = "";
+			mSLURL = LLSLURL();
 		}
 	}
 }
@@ -1167,7 +1158,7 @@ void LLFloaterWorldMap::onClearBtn()
 	mTrackedStatus = LLTracker::TRACKING_NOTHING;
 	LLTracker::stopTracking((void *)(intptr_t)TRUE);
 	LLWorldMap::getInstance()->cancelTracking();
-	mSLURL = "";					// Clear the SLURL since it's invalid
+	mSLURL = LLSLURL();					// Clear the SLURL since it's invalid
 	mSetToUserPosition = TRUE;	// Revert back to the current user position
 }
 
@@ -1190,10 +1181,10 @@ void LLFloaterWorldMap::onClickTeleportBtn()
 
 void LLFloaterWorldMap::onCopySLURL()
 {
-	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL));
+	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
 	
 	LLSD args;
-	args["SLURL"] = mSLURL;
+	args["SLURL"] = mSLURL.getSLURLString();
 
 	LLNotificationsUtil::add("CopySLURL", args);
 }
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 00f5e788fb..52809ff830 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -43,6 +43,7 @@
 #include "llhudtext.h"
 #include "llmapimagetype.h"
 #include "lltracker.h"
+#include "llslurl.h"
 
 class LLEventInfo;
 class LLFriendObserver;
@@ -183,7 +184,7 @@ private:
 	LLTracker::ETrackingStatus mTrackedStatus;
 	std::string				mTrackedSimName;
 	std::string				mTrackedAvatarName;
-	std::string				mSLURL;
+	LLSLURL  				mSLURL;
 };
 
 extern LLFloaterWorldMap* gFloaterWorldMap;
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index dd313c528d..e4ee953eae 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -479,7 +479,7 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		// Objects cannot be created by a group, so use agent URL format
 		LLUUID creator_id = nodep->mPermissions->getCreator();
 		std::string creator_url =
-			LLSLURL::buildCommand("agent", creator_id, "about");
+			LLSLURL("agent", creator_id, "about").getSLURLString();
 		args["[CREATOR]"] = creator_url;
 				
 		// created by one user but owned by another
@@ -489,12 +489,12 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		if (group_owned)
 		{
 			owner_id = nodep->mPermissions->getGroup();
-			owner_url =	LLSLURL::buildCommand("group", owner_id, "about");
+			owner_url =	LLSLURL("group", owner_id, "about").getSLURLString();
 		}
 		else
 		{
 			owner_id = nodep->mPermissions->getOwner();
-			owner_url =	LLSLURL::buildCommand("agent", owner_id, "about");
+			owner_url =	LLSLURL("agent", owner_id, "about").getSLURLString();
 		}
 		args["[OWNER]"] = owner_url;
 		
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index e4d2eec242..7319bd0331 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -176,11 +176,11 @@ void LLInspectRemoteObject::update()
 	{
 		if (mGroupOwned)
 		{
-			owner = LLSLURL::buildCommand("group", mOwnerID, "about");
+			owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
 		}
 		else
 		{
-			owner = LLSLURL::buildCommand("agent", mOwnerID, "about");
+			owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
 		}
 	}
 	getChild<LLUICtrl>("object_owner")->setValue(owner);
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index f25d2ef574..eaa3a715cb 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -298,7 +298,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-		std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
+	  std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
 		cb(slurl);
 
 		return;
@@ -350,7 +350,7 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-		slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
+	  slurl = LLSLURL(sim_name, global_pos).getSLURLString();
 	}
 	else
 	{
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 404e266806..75b7f9313b 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -572,8 +572,7 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
 				value["global_pos"] = result->mGlobalPos.getValue();
 				std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
 				//TODO*: add Surl to teleportitem or parse region name from title
-				value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
-						result->mGlobalPos,	false);
+				value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
 				add(result->getTitle(), value); 
 			}
 			result = std::find_if(result + 1, th_items.end(), boost::bind(
@@ -832,7 +831,7 @@ void LLLocationInputCtrl::changeLocationPresentation()
 	if(mTextEntry && !mTextEntry->hasSelection() && text == mHumanReadableLocation )
 	{
 		//needs unescaped one
-		mTextEntry->setText(LLAgentUI::buildSLURL(false));
+		mTextEntry->setText(LLAgentUI::buildSLURL(false).getSLURLString());
 		mTextEntry->selectAll();
 	}	
 }
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 7d43f6a8cc..482660459e 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -38,7 +38,7 @@
 #include "llsecapi.h"
 #include "llpanellogin.h"			// save_password_to_disk()
 #include "llstartup.h"				// getStartupState()
-#include "llurlsimstring.h"
+#include "llslurl.h"
 #include "llviewercontrol.h"		// gSavedSettings
 #include "llviewernetwork.h"		// EGridInfo
 #include "llviewerwindow.h"                    // getWindow()
@@ -69,7 +69,7 @@ void LLLoginHandler::parse(const LLSD& queryMap)
 	
 	if (queryMap.has("grid"))
 	{
-		LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
+	  LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
 	}
 	
 	
@@ -77,11 +77,16 @@ void LLLoginHandler::parse(const LLSD& queryMap)
 	
 	if (startLocation == "specify")
 	{
-	  LLURLSimString::setString(queryMap["region"].asString());
+	  LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridID(),
+					   queryMap["region"].asString()));
 	}
-	else if (!startLocation.empty())
+	else if (startLocation == "home")
 	{
-	  LLURLSimString::setString(startLocation);
+	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+	}
+	else if (startLocation == "last")
+	{
+	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
 	}
 }
 
@@ -153,12 +158,9 @@ bool LLLoginHandler::handle(const LLSD& tokens,
 // ones from the protected credential store.                                                                                
 // This always returns with a credential structure set in the                                                               
 // login handler                                                                                                            
-LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo(const std::string& url)                                         
+LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()                                         
 {                                                                                                                           
-	LLURI uri(url);                                                                                                      
 	LLPointer<LLCredential> result = NULL;                                                                               
-	parse(uri.queryMap());                                                                                               
-	// we weren't able to parse login info from the slurl,                                                               
 	// so try to load it from the UserLoginInfo                                                                          
 	result = loadSavedUserLoginInfo();                                                                                   
 	if (result.isNull())                                                                                                 
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index ec2459c835..c15b998c91 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -51,7 +51,7 @@ class LLLoginHandler : public LLCommandHandler
 	//LLUUID getWebLoginKey() const { return mWebLoginKey; }
 
 	LLPointer<LLCredential> loadSavedUserLoginInfo();  
-	LLPointer<LLCredential> initializeLoginInfo(const std::string& url);
+	LLPointer<LLCredential> initializeLoginInfo();
 
 private:
 	void parse(const LLSD& queryMap);
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index e4b8becdd7..04e5cef62e 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -48,7 +48,8 @@
 // newview
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
+#include "llstartup.h"
 #include "llfloaterreg.h"
 #include "llnotifications.h"
 #include "llwindow.h"
@@ -56,6 +57,7 @@
 #include "lltrans.h"
 #endif
 #include "llsecapi.h"
+#include "llstartup.h"
 
 static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
 static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
@@ -462,15 +464,17 @@ bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD&
 std::string construct_start_string()
 {
 	std::string start;
-	if (LLURLSimString::parse())
+	LLSLURL start_slurl = LLStartUp::getStartSLURL();
+	if (start_slurl.getType() == LLSLURL::LOCATION)
 	{
 		// a startup URL was specified
+		LLVector3 position = start_slurl.getPosition();
 		std::string unescaped_start = 
 			STRINGIZE(  "uri:" 
-						<< LLURLSimString::sInstance.mSimName << "&" 
-						<< LLURLSimString::sInstance.mX << "&" 
-						<< LLURLSimString::sInstance.mY << "&" 
-						<< LLURLSimString::sInstance.mZ);
+					  << start_slurl.getRegion() << "&" 
+						<< position[VX] << "&" 
+						<< position[VY] << "&" 
+						<< position[VZ]);
 		start = xml_escape_string(unescaped_start);
 	}
 	else
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 71dc0f9011..8c21fb6314 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -50,7 +50,6 @@
 #include "llsearchcombobox.h"
 #include "llsidetray.h"
 #include "llslurl.h"
-#include "llurlsimstring.h"
 #include "llurlregistry.h"
 #include "llurldispatcher.h"
 #include "llviewerinventory.h"
@@ -421,16 +420,15 @@ void LLNavigationBar::onLocationSelection()
 	
 	std::string region_name;
 	LLVector3 local_coords(128, 128, 0);
-	S32 x = 0, y = 0, z = 0;
 	// Is the typed location a SLURL?
-	if (LLSLURL::isSLURL(typed_location))
+	LLSLURL slurl = LLSLURL(typed_location);
+	if (slurl.getType() == LLSLURL::LOCATION)
 	{
 		// Yes. Extract region name and local coordinates from it.
-		if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), &region_name, &x, &y, &z))
-				local_coords.set(x, y, z);
-		else
-			return;
-	}else
+		region_name = slurl.getRegion();
+		local_coords = slurl.getPosition();
+	}
+	else
 	{
 		// assume that an user has typed the {region name} or possible {region_name, parcel}
 		region_name  = typed_location.substr(0,typed_location.find(','));
@@ -465,7 +463,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
 	 */
 		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
 					gAgent.getPosAgentFromGlobal(global_agent_pos));
-	std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
+	std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
 	
 	LLLocationHistoryItem item (location,
 			global_agent_pos, tooltip,TYPED_REGION_SURL);// we can add into history only TYPED location
@@ -567,7 +565,7 @@ void LLNavigationBar::onRegionNameResponse(
 	LLVector3d region_pos = from_region_handle(region_handle);
 	LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
 
-	llinfos << "Teleporting to: " << LLSLURL::buildSLURLfromPosGlobal(region_name,	global_pos, false)  << llendl;
+	llinfos << "Teleporting to: " << LLSLURL(region_name,	global_pos).getSLURLString()  << llendl;
 	gAgent.teleportViaLocation(global_pos);
 }
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 6978d05389..7752750a31 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -56,7 +56,7 @@
 #include "lltextbox.h"
 #include "llui.h"
 #include "lluiconstants.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
 #include "llversioninfo.h"
 #include "llviewerhelp.h"
 #include "llviewertexturelist.h"
@@ -106,7 +106,6 @@ public:
 LLLoginRefreshHandler gLoginRefreshHandler;
 
 
-
 // helper class that trys to download a URL from a web site and calls a method 
 // on parent class indicating if the web server is working or not
 class LLIamHereLogin : public LLHTTPClient::Responder
@@ -155,10 +154,6 @@ namespace {
 	boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
 };
 
-void set_start_location(LLUICtrl* ctrl, void* data)
-{
-    LLURLSimString::setString(ctrl->getValue().asString());
-}
 
 //---------------------------------------------------------------------------
 // Public methods
@@ -228,12 +223,11 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 
 	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
 
-	std::string sim_string = LLURLSimString::sInstance.mSimString;
-	if(sim_string.empty())
+	if(!LLStartUp::getStartSLURL().isValid())
 	{
-		LLURLSimString::setString(gSavedSettings.getString("LoginLocation"));
+		LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
 	}
-
+	std::string sim_string = LLStartUp::getStartSLURL().getRegion();
 	if (!sim_string.empty())
 	{
 		// Replace "<Type region name>" with this region name
@@ -242,8 +236,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 		combo->setTextEntry(sim_string);
 		combo->setCurrentByIndex( 2 );
 	}
-
-	combo->setCommitCallback( &set_start_location, NULL );
+	
+	combo->setCommitCallback(onSelectLocation, NULL);
 
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
 	server_choice_combo->setCommitCallback(onSelectServer, NULL);
@@ -306,11 +300,8 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	gResponsePtr = LLIamHereLogin::build( this );
 
 	LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
-
-#if !USE_VIEWER_AUTH
-	// Initialize visibility (and don't force visibility - use prefs)
-	refreshLocation( false );
-#endif
+	
+	updateLocationCombo(false);
 
 }
 
@@ -674,46 +665,141 @@ BOOL LLPanelLogin::isGridComboDirty()
 }
 
 // static
-void LLPanelLogin::getLocation(std::string &location)
+BOOL LLPanelLogin::areCredentialFieldsDirty()
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted getLocation with no login view shown" << llendl;
+		llwarns << "Attempted getServer with no login view shown" << llendl;
+	}
+	else
+	{
+		std::string username = sInstance->childGetText("username_edit");
+		LLStringUtil::trim(username);
+		std::string password = sInstance->childGetText("password_edit");
+		LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
+		if(ctrl && ctrl->isDirty())
+		{
+			return true;
+		}
+		ctrl = sInstance->getChild<LLLineEditor>("password_edit");
+		if(ctrl && ctrl->isDirty()) 
+		{
+			return true;
+		}
+	}
+	return false;	
+}
+
+
+// static
+void LLPanelLogin::updateLocationCombo( bool force_visible )
+{
+	if (!sInstance) 
+	{
 		return;
+	}	
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	
+	switch(LLStartUp::getStartSLURL().getType())
+	{
+		case LLSLURL::LOCATION:
+		{
+			
+			combo->setCurrentByIndex( 2 );	
+			combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());	
+			break;
+		}
+		case LLSLURL::HOME_LOCATION:
+			combo->setCurrentByIndex(0);
+			break;
+		default:
+			combo->setCurrentByIndex(1);
+			break;
 	}
 	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	location = combo->getValue().asString();
+	BOOL show_start = TRUE;
+	
+	if ( ! force_visible )
+		show_start = gSavedSettings.getBOOL("ShowStartLocation");
+	
+	sInstance->childSetVisible("start_location_combo", show_start);
+	sInstance->childSetVisible("start_location_text", show_start);
+	
+	sInstance->childSetVisible("server_combo", TRUE);
 }
 
 // static
-void LLPanelLogin::refreshLocation( bool force_visible )
+void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
 {
 	if (!sInstance) return;
-
-#if USE_VIEWER_AUTH
-	loadLoginPage();
-#else
-	BOOL show_start = TRUE;
-
-	if ( ! force_visible )
+	
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	S32 index = combo->getCurrentIndex();
+	
+	switch (index)
 	{
-		// Don't show on first run after install
-		// Otherwise ShowStartLocation defaults to true.
-		show_start = gSavedSettings.getBOOL("ShowStartLocation")
-					&& !gSavedSettings.getBOOL("FirstRunThisInstall");
+		case 2:
+		{
+			LLSLURL slurl = LLSLURL(combo->getSelectedValue());
+			if((slurl.getType() == LLSLURL::LOCATION) &&
+			   (slurl.getGrid() != LLStartUp::getStartSLURL().getGrid()))
+			{
+				LLStartUp::setStartSLURL(slurl);
+				// we've changed the grid, so update the grid selection
+				try 
+				{
+					LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
+				}
+				catch (LLInvalidGridName ex)
+				{
+					LLSD args;	
+					args["GRID"] = slurl.getGrid();
+					LLNotificationsUtil::add("InvalidGrid", args);
+					return; 
+				}	
+				loadLoginPage();
+			}
+			break;
+		}
+		case 1:
+		{
+			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+			break;
+		}
+		default:
+		{
+			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+			break;
+		}
 	}
+}
 
-	sInstance->childSetVisible("start_location_combo", show_start);
-	sInstance->childSetVisible("start_location_text", show_start);
-
-	// should be true for enterprise viewer
-	BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
-	sInstance->childSetVisible("server_combo", show_server);
 
-#endif
+// static
+LLSLURL LLPanelLogin::getLocation()
+{
+	LLSLURL result;
+	if (!sInstance)
+	{
+		llwarns << "Attempted getLocation with no login view shown" << llendl;
+		return result;
+	}
+	
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	
+	switch(combo->getCurrentIndex())
+	{
+		case 0:
+			return LLSLURL(LLSLURL::SIM_LOCATION_HOME);
+		case 1:
+			return LLSLURL(LLSLURL::SIM_LOCATION_LAST);
+		default:
+			// construct a real slurl
+			return LLSLURL(LLURI::escape(combo->getValue().asString()));
+	}
 }
 
+
 // static
 void LLPanelLogin::closePanel()
 {
@@ -748,6 +834,7 @@ void LLPanelLogin::loadLoginPage()
 	std::ostringstream oStr;
 
 	std::string login_page = LLGridManager::getInstance()->getLoginPage();
+
 	oStr << login_page;
 	
 	// Use the right delimeter depending on how LLURI parses the URL
@@ -859,7 +946,7 @@ void LLPanelLogin::loadLoginPage()
 #endif
 	
 	LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-	
+
 	// navigate to the "real" page
 	if (gSavedSettings.getBOOL("RegInClient"))
 	{
@@ -1006,30 +1093,59 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 	}
 }
 
+
+void LLPanelLogin::updateServer(std::string grid)
+{
+	try 
+	{
+		LLGridManager::getInstance()->setGridChoice(grid);
+
+		updateServerCombo();	
+		// if they've selected another grid, we should load the credentials
+		// for that grid and set them to the UI.
+		if(sInstance && !sInstance->areCredentialFieldsDirty())
+		{
+			LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(grid);	
+			bool remember = sInstance->childGetValue("remember_check");
+			sInstance->setFields(credential, remember);
+		}
+		// grid changed so show new splash screen (possibly)
+		loadLoginPage();
+		updateLocationCombo(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
+	}
+	catch (LLInvalidGridName ex)
+	{
+		// do nothing
+	}}
+
 void LLPanelLogin::updateServerCombo()
 {
+	if (!sInstance) 
+	{
+		return;	
+	}
 	// We add all of the possible values, sorted, and then add a bar and the current value at the top
-	LLGridManager* viewer_login = LLGridManager::getInstance();
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");	
 	server_choice_combo->removeall();
-	std::map<std::string, std::string> known_grids = viewer_login->getKnownGrids();
+#ifdef LL_RELEASE_FOR_DOWNLOAD
+	std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(TRUE);
+#else
+	std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(FALSE);	
+#endif
 	for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
 		 grid_choice != known_grids.end();
 		 grid_choice++)
+	{
+		if (!grid_choice->first.empty())
 		{
-			//if (!grid_choice->first.empty())
-			{
-				LL_INFOS("Credentials") << "adding " << grid_choice->second << ":" << grid_choice->first << LL_ENDL;
-				server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
-			}
+			server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
 		}
+	}
 	
 	server_choice_combo->addSeparator(ADD_TOP);
 	
-	LL_INFOS("Credentials") << "adding top grid choice by " << viewer_login->getGridLabel() << LL_ENDL;
-	server_choice_combo->add(viewer_login->getGridLabel(), 
-							 viewer_login->getGridName(), 
-							 ADD_TOP);	
+	server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), 
+		LLGridManager::getInstance()->getGridName(), ADD_TOP);	
 	
 	server_choice_combo->selectFirstItem();	
 }
@@ -1040,37 +1156,26 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 	// *NOTE: The paramters for this method are ignored. 
 	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
 	// calls this method.
-
+	LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
 	// The user twiddled with the grid choice ui.
 	// apply the selection to the grid setting.
 	LLPointer<LLCredential> credential;
-	BOOL remember = FALSE;
-
+	
 	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
 	LLSD combo_val = combo->getSelectedValue();
 	if (combo_val.isUndefined())
 	{
-	  combo_val = combo->getValue();
+		combo_val = combo->getValue();
 	}
-
-	// This new selection will override preset uris
-	// from the command line.
-
-	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
-	updateServerCombo();
-
-	// grid changed so show new splash screen (possibly)
-	loadLoginPage();
 	
-	// if they've selected another grid, we should load the credentials
-	// for that grid and set them to the UI.
-	credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGridName());
+	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
+	combo->setCurrentByIndex(1);
+	LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
 	
-
-	remember = sInstance->childGetValue("remember_check");
-	sInstance->setFields(credential, remember);
-
-	LL_INFOS("Credentials") << "Grid changed to:" << LLGridManager::getInstance()->getGridName() << LL_ENDL;
+	// This new seelction will override preset uris
+	// from the command line.
+	updateServer(combo_val.asString());
+	updateLoginPanelLinks();
 }
 
 void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
@@ -1083,3 +1188,14 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
 		onSelectServer(combo, NULL);	
 	}
 }
+
+void LLPanelLogin::updateLoginPanelLinks()
+{
+	LLSD grid_data = LLGridManager::getInstance()->getGridInfo();
+	bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
+	
+	// need to call through sInstance, as it's called from onSelectServer, which
+	// is static.
+	sInstance->childSetVisible("create_new_account_text", system_grid);
+	sInstance->childSetVisible("forgot_password_text", system_grid);
+}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index d33aa2d550..4f18b7bfd8 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -38,6 +38,7 @@
 #include "llmediactrl.h"	// LLMediaCtrlObserver
 #include <boost/scoped_ptr.hpp>
 #include "llsecapi.h"
+#include "llslurl.h"
 
 class LLLineEditor;
 class LLUIImage;
@@ -68,13 +69,13 @@ public:
 
 	static void setFields(LLPointer<LLCredential> credential, BOOL remember);
 
-	static void refreshLocation( bool force_visible );
-
 	static void getFields(LLPointer<LLCredential>& credential, BOOL& remember);
 
 	static BOOL isGridComboDirty();
-	static void getLocation(std::string &location);
-
+	static BOOL areCredentialFieldsDirty();
+	static LLSLURL getLocation();
+	
+	static void updateLocationCombo(bool force_visible);  // simply update the combo box
 	static void closePanel();
 
 	void setSiteIsAlive( bool alive );
@@ -99,7 +100,11 @@ private:
 	static void onSelectServer(LLUICtrl*, void*);
 	static void onServerComboLostFocus(LLFocusableElement*);
 	static void updateServerCombo();
+	static void onSelectLocation(LLUICtrl*, void*);
 	
+	static void updateServer(std::string grid);  // update the combo box, change the login page to the new server, clear the combo
+	static void updateLoginPanelLinks();
+
 private:
 	LLPointer<LLUIImage> mLogoImage;
 	boost::scoped_ptr<LLPanelLoginListener> mListener;
diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 9806b8c64d..6b12796e59 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -70,10 +70,7 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
 	std::string sl_url;
 	if ( gotSimName )
 	{
-		F32 region_x = (F32)fmod( landmark_global_pos.mdV[VX], (F64)REGION_WIDTH_METERS );
-		F32 region_y = (F32)fmod( landmark_global_pos.mdV[VY], (F64)REGION_WIDTH_METERS );
-
-		sl_url = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)landmark_global_pos.mdV[VZ]));
+		sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
 	}
 	else
 	{
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 60a095506b..36ed1c466b 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2434,7 +2434,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
 	
 	if (identical)
 	{
-		name = LLSLURL::buildCommand("agent", first_id, "inspect");
+		name = LLSLURL("agent", first_id, "inspect").getSLURLString();
 	}
 	else
 	{
@@ -2493,11 +2493,11 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull() && !first_group_owned);
 		if (first_group_owned)
 		{
-			name = LLSLURL::buildCommand("group", first_id, "inspect");
+			name = LLSLURL("group", first_id, "inspect").getSLURLString();
 		}
 		else if(!public_owner)
 		{
-			name = LLSLURL::buildCommand("agent", first_id, "inspect");
+			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
 		}
 		else
 		{
@@ -2557,7 +2557,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull());
 		if(!public_owner)
 		{
-			name = LLSLURL::buildCommand("agent", first_id, "inspect");
+			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
 		}
 		else
 		{
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index 37e268ad34..43c505fae6 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -1,10 +1,11 @@
 /** 
- * @file llslurl.cpp
- * @brief SLURL manipulation
+ * @file llurlsimstring.cpp (was llsimurlstring.cpp)
+ * @brief Handles "SLURL fragments" like Ahern/123/45 for
+ * startup processing, login screen, prefs, etc.
  *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2009, Linden Research, Inc.
+ * Copyright (c) 2006-2007, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +13,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -34,120 +34,422 @@
 
 #include "llslurl.h"
 
-#include "llweb.h"
+#include "llpanellogin.h"
+#include "llviewercontrol.h"
+#include "llviewernetwork.h"
+#include "llfiltersd2xmlrpc.h"
+#include "curl/curl.h"
+const char* LLSLURL::SLURL_HTTP_SCHEME			= "http";
+const char* LLSLURL::SLURL_HTTPS_SCHEME			= "https";
+const char* LLSLURL::SLURL_SECONDLIFE_SCHEME	= "secondlife";
+const char* LLSLURL::SLURL_SECONDLIFE_PATH	= "secondlife";
+const char* LLSLURL::SLURL_COM		            = "slurl.com";	
+const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
+const char* LLSLURL::SLURL_APP_PATH             = "app";
+const char* LLSLURL::SLURL_REGION_PATH          = "region";
+const char* LLSLURL::SIM_LOCATION_HOME          = "MyHome";
+const char* LLSLURL::SIM_LOCATION_LAST          = "MyLastLocation";
 
-const std::string LLSLURL::PREFIX_SL_HELP		= "secondlife://app.";
-const std::string LLSLURL::PREFIX_SL			= "sl://";
-const std::string LLSLURL::PREFIX_SECONDLIFE	= "secondlife://";
-const std::string LLSLURL::PREFIX_SLURL			= "http://slurl.com/secondlife/";
-
-const std::string LLSLURL::APP_TOKEN = "app/";
-
-// static
-std::string LLSLURL::stripProtocol(const std::string& url)
+// resolve a simstring from a slurl
+LLSLURL::LLSLURL(const std::string& slurl)
 {
-	std::string stripped = url;
-	if (matchPrefix(stripped, PREFIX_SL_HELP))
-	{
-		stripped.erase(0, PREFIX_SL_HELP.length());
-	}
-	else if (matchPrefix(stripped, PREFIX_SL))
+	// by default we go to agni.
+	mType = INVALID;
+	LL_INFOS("AppInit") << "SLURL: " << slurl << LL_ENDL;
+	if(slurl == SIM_LOCATION_HOME)
 	{
-		stripped.erase(0, PREFIX_SL.length());
+		mType = HOME_LOCATION;
 	}
-	else if (matchPrefix(stripped, PREFIX_SECONDLIFE))
+	else if(slurl.empty() || (slurl == SIM_LOCATION_LAST))
 	{
-		stripped.erase(0, PREFIX_SECONDLIFE.length());
+		mType = LAST_LOCATION;
 	}
-	else if (matchPrefix(stripped, PREFIX_SLURL))
+	else
 	{
-		stripped.erase(0, PREFIX_SLURL.length());
+		LLURI slurl_uri;
+		// parse the slurl as a uri
+		if(slurl.find(':') == std::string::npos)
+		{
+			// There may be no scheme ('secondlife:' etc.) passed in.  In that case
+			// we want to normalize the slurl by putting the appropriate scheme
+			// in front of the slurl.  So, we grab the appropriate slurl base
+			// from the grid manager which may be http://slurl.com/secondlife/ for maingrid, or
+			// https://<hostname>/region/ for nebraska grid (the word region, not the region name)
+			// these slurls are typically passed in from the 'starting location' box on the login panel,
+			// where the user can type in <regionname>/<x>/<y>/<z>
+			
+			std::string fixed_slurl = LLGridManager::getInstance()->getSLURLBase();
+			// the slurl that was passed in might have a prepended /, or not.  So,
+			// we strip off the prepended '/' so we don't end up with http://slurl.com/secondlife/<region>/<x>/<y>/<z>
+			// or some such.
+			if(slurl[0] == '/')
+		    {
+				fixed_slurl += slurl.substr(1);
+		    }
+			else
+		    {
+				fixed_slurl += slurl;
+		    }
+			// We then load the slurl into a LLURI form
+			slurl_uri = LLURI(fixed_slurl);
+		}
+		else
+		{
+		    // as we did have a scheme, implying a URI style slurl, we
+		    // simply parse it as a URI
+		    slurl_uri = LLURI(slurl);
+		}
+		
+		LLSD path_array = slurl_uri.pathArray();
+		
+		// determine whether it's a maingrid URI or an nebraska/open style URI
+		// by looking at the scheme.  If it's a 'secondlife:' slurl scheme or
+		// 'sl:' scheme, we know it's maingrid
+		
+		// At the end of this if/else block, we'll have determined the grid,
+		// and the slurl type (APP or LOCATION)
+		if(slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
+		{
+			// parse a maingrid style slurl.  We know the grid is maingrid
+			// so grab it.
+			// A location slurl for maingrid (with the special schemes) can be in the form
+			// secondlife://<regionname>/<x>/<y>/<z>
+			// or
+			// secondlife://<Grid>/secondlife/<region>/<x>/<y>/<z>
+			// where if grid is empty, it specifies Agni
+			
+			// An app style slurl for maingrid can be
+			// secondlife://<Grid>/app/<app parameters>
+			// where an empty grid implies Agni
+			
+			// we'll start by checking the top of the 'path' which will be 
+			// either 'app', 'secondlife', or <x>.
+			
+			// default to maingrid
+			
+			mGrid = MAINGRID;
+			
+			if ((path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH) ||
+				(path_array[0].asString() == LLSLURL::SLURL_APP_PATH))
+		    {
+				// it's in the form secondlife://<grid>/(app|secondlife)
+				// so parse the grid name to derive the grid ID
+				if (!slurl_uri.hostName().empty())
+				{
+					mGrid = LLGridManager::getInstance()->getGridByLabel(slurl_uri.hostName());
+				}
+				else if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
+				{
+					// If the slurl is in the form secondlife:///secondlife/<region> form, 
+					// then we are in fact on maingrid.  
+					mGrid = MAINGRID;
+				}
+				else if(path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
+				{
+					// for app style slurls, where no grid name is specified, assume the currently
+					// selected or logged in grid.
+					mGrid =  LLGridManager::getInstance()->getGridName();
+				}
+
+				if(mGrid.empty())
+				{
+					// we couldn't find the grid in the grid manager, so bail
+					return;
+				}
+				// set the type as appropriate.
+				if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
+				{
+					mType = LOCATION;
+				}
+				else
+				{
+					mType = APP;
+				}
+				path_array.erase(0);
+		    }
+			else
+		    {
+				// it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
+				// therefore the hostname will be the region name, and it's a location type
+				mType = LOCATION;
+				// 'normalize' it so the region name is in fact the head of the path_array
+				path_array.insert(0, slurl_uri.hostName());
+		    }
+		}
+		else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) ||
+		   (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) || 
+		   (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME))
+		{
+		    // We're dealing with either a nebraska style slurl or slurl.com slurl
+		    if (slurl_uri.hostName() == LLSLURL::SLURL_COM)
+			{
+				// slurl.com implies maingrid
+				mGrid = MAINGRID;
+			}
+		    else
+			{
+				// As it's a nebraska grid/open, we will always have a hostname, as nebraska/open  style
+				// urls are properly formed, unlike the stinky maingrid style
+				mGrid = slurl_uri.hostName();
+			}
+		    if (path_array.size() == 0)
+			{
+				// um, we need a path...
+				return;
+			}
+			
+			// we need to normalize the urls so
+			// the path portion starts with the 'command' that we want to do
+			// it can either be region or app.  
+		    if ((path_array[0].asString() == LLSLURL::SLURL_REGION_PATH) ||
+				(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH))
+			{
+				// strip off 'region' or 'secondlife'
+				path_array.erase(0);
+				// it's a location
+				mType = LOCATION;
+			}
+			else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
+			{
+				mType = APP;
+				path_array.erase(0);
+				// leave app appended.  
+			}
+			else
+			{
+				// not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL
+				return;
+			}
+		}
+		else
+		{
+		    // invalid scheme, so bail
+		    return;
+		}
+		
+		
+		if(path_array.size() == 0)
+		{
+			// we gotta have some stuff after the specifier as to whether it's a region or command
+			return;
+		}
+		
+		// now that we know whether it's an app slurl or a location slurl,
+		// parse the slurl into the proper data structures.
+		if(mType == APP)
+		{		
+			// grab the app command type and strip it (could be a command to jump somewhere, 
+			// or whatever )
+			mAppCmd = path_array[0].asString();
+			path_array.erase(0);
+			
+			// Grab the parameters
+			mAppPath = path_array;
+			// and the query
+			mAppQuery = slurl_uri.query();
+			mAppQueryMap = slurl_uri.queryMap();
+			return;
+		}
+		else if(mType == LOCATION)
+		{
+			// at this point, head of the path array should be [ <region>, <x>, <y>, <z> ] where x, y and z 
+			// are collectively optional
+			// are optional
+			mRegion = LLURI::unescape(path_array[0].asString());
+			path_array.erase(0);
+			
+			// parse the x, y, z
+			if(path_array.size() >= 3)
+			{	
+				mPosition = LLVector3(path_array);
+			}
+			else
+			{
+				// if x, y and z were not fully passed in, go to the middle of the region.
+				// teleport will adjust the actual location to make sure you're on the ground
+				// and such
+				mPosition = LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0);
+			}
+		}
 	}
-	
-	return stripped;
 }
 
-// static
-bool LLSLURL::isSLURL(const std::string& url)
+
+// Create a slurl for the middle of the region
+LLSLURL::LLSLURL(const std::string& grid, 
+				 const std::string& region)
 {
-	if (matchPrefix(url, PREFIX_SL_HELP))		return true;
-	if (matchPrefix(url, PREFIX_SL))			return true;
-	if (matchPrefix(url, PREFIX_SECONDLIFE))	return true;
-	if (matchPrefix(url, PREFIX_SLURL))			return true;
-	
-	return false;
+	mGrid = grid;
+	mRegion = region;
+	mType = LOCATION;
+	mPosition = LLVector3((F64)REGION_WIDTH_METERS/2, (F64)REGION_WIDTH_METERS/2, 0);
+}
+
+
+
+// create a slurl given the position.  The position will be modded with the region
+// width handling global positions as well
+LLSLURL::LLSLURL(const std::string& grid, 
+		 const std::string& region, 
+		 const LLVector3& position)
+{
+	mGrid = grid;
+	mRegion = region;
+	S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
+	S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
+	S32 z = llround( (F32)position[VZ] );
+	mType = LOCATION;
+	mPosition = LLVector3(x, y, z);
 }
 
-// static
-bool LLSLURL::isSLURLCommand(const std::string& url)
-{ 
-	if (matchPrefix(url, PREFIX_SL + APP_TOKEN) ||
-		matchPrefix(url, PREFIX_SECONDLIFE + "/" + APP_TOKEN) ||
-		matchPrefix(url, PREFIX_SLURL + APP_TOKEN) )
-	{
-		return true;
-	}
 
-	return false;
+// create a simstring
+LLSLURL::LLSLURL(const std::string& region, 
+		 const LLVector3& position)
+{
+  *this = LLSLURL(LLGridManager::getInstance()->getGridName(),
+		  region, position);
 }
 
-// static
-bool LLSLURL::isSLURLHelp(const std::string& url)
+// create a slurl from a global position
+LLSLURL::LLSLURL(const std::string& grid, 
+		 const std::string& region, 
+		 const LLVector3d& global_position)
 {
-	return matchPrefix(url, PREFIX_SL_HELP);
+  *this = LLSLURL(grid,
+		  region, LLVector3(global_position.mdV[VX],
+				    global_position.mdV[VY],
+				    global_position.mdV[VZ]));
 }
 
-// static
-std::string LLSLURL::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
+// create a slurl from a global position
+LLSLURL::LLSLURL(const std::string& region, 
+		 const LLVector3d& global_position)
 {
-	std::string slurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z); 
-	slurl = LLWeb::escapeURL( slurl );
-	return slurl;
+  *this = LLSLURL(LLGridManager::getInstance()->getGridName(),
+		  region, global_position);
 }
 
-// static
-std::string LLSLURL::buildCommand(const char* noun, const LLUUID& id, const char* verb)
+LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
 {
-	std::string slurl = llformat("secondlife:///app/%s/%s/%s",
-		noun, id.asString().c_str(), verb);
-	return slurl;
+  mType = APP;
+  mAppCmd = command;
+  mAppPath = LLSD::emptyArray();
+  mAppPath.append(LLSD(id));
+  mAppPath.append(LLSD(verb));
 }
 
-// static
-std::string LLSLURL::buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
+
+std::string LLSLURL::getSLURLString() const
 {
-	std::string unescapedslurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z);
-	return unescapedslurl;
+	switch(mType)
+	{
+		case HOME_LOCATION:
+			return SIM_LOCATION_HOME;
+		case LAST_LOCATION:
+			return SIM_LOCATION_LAST;
+		case LOCATION:
+			{
+				// lookup the grid
+				S32 x = llround( (F32)mPosition[VX] );
+				S32 y = llround( (F32)mPosition[VY] );
+				S32 z = llround( (F32)mPosition[VZ] );	
+				return LLGridManager::getInstance()->getSLURLBase(mGrid) + 
+				LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z); 
+			}
+		case APP:
+		{
+			std::ostringstream app_url;
+			app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
+			for(LLSD::array_const_iterator i = mAppPath.beginArray();
+				i != mAppPath.endArray();
+				i++)
+			{
+				app_url << "/" << i->asString();
+			}
+			if(mAppQuery.length() > 0)
+			{
+				app_url << "?" << mAppQuery;
+			}
+			return app_url.str();
+		}	
+		default:
+			LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;			
+			return std::string();
+	}
 }
 
-// static
-std::string LLSLURL::buildSLURLfromPosGlobal(const std::string& regionname,
-											 const LLVector3d& global_pos,
-											 bool escaped /*= true*/)
+std::string LLSLURL::getLoginString() const
 {
-	S32 x, y, z;
-	globalPosToXYZ(global_pos, x, y, z);
-	if(escaped)
+	
+	std::stringstream unescaped_start;
+	switch(mType)
 	{
-		return buildSLURL(regionname, x, y, z);
+		case LOCATION:
+			unescaped_start << "uri:" 
+			<< mRegion << "&" 
+			<< llround(mPosition[0]) << "&" 
+			<< llround(mPosition[1]) << "&" 
+			<< llround(mPosition[2]);
+			break;
+		case HOME_LOCATION:
+			unescaped_start << "home";
+			break;
+		case LAST_LOCATION:
+			unescaped_start << "last";
+			break;
+		default:
+			LL_WARNS("AppInit") << "Unexpected SLURL type for login string" << (int)mType << LL_ENDL;
+			break;
 	}
-	else
+	return  xml_escape_string(unescaped_start.str());
+}
+
+bool LLSLURL::operator==(const LLSLURL& rhs)
+{
+	if(rhs.mType != mType) return false;
+	switch(mType)
 	{
-		return buildUnescapedSLURL(regionname, x, y, z);
+		case LOCATION:
+			return ((mGrid == rhs.mGrid) &&
+					(mRegion == rhs.mRegion) &&
+					(mPosition == rhs.mPosition));
+		case APP:
+			return getSLURLString() == rhs.getSLURLString();
+			
+		case HOME_LOCATION:
+		case LAST_LOCATION:
+			return true;
+		default:
+			return false;
 	}
 }
 
-// static
-bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix)
+bool LLSLURL::operator !=(const LLSLURL& rhs)
 {
-	std::string test_prefix = url.substr(0, prefix.length());
-	LLStringUtil::toLower(test_prefix);
-	return test_prefix == prefix;
+	return !(*this == rhs);
 }
 
-void LLSLURL::globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z)
+std::string LLSLURL::getLocationString() const
 {
-	x = llround((F32)fmod(pos.mdV[VX], (F64)REGION_WIDTH_METERS));
-	y = llround((F32)fmod(pos.mdV[VY], (F64)REGION_WIDTH_METERS));
-	z = llround((F32)pos.mdV[VZ]);
+	return llformat("%s/%d/%d/%d",
+					mRegion.c_str(),
+					(int)llround(mPosition[0]),
+					(int)llround(mPosition[1]),
+					(int)llround(mPosition[2]));						 
 }
+std::string LLSLURL::asString() const
+{
+    std::ostringstream result;
+    result << "   mAppCmd:"  << getAppCmd() <<
+              "   mAppPath:" + getAppPath().asString() <<
+              "   mAppQueryMap:" + getAppQueryMap().asString() <<
+              "   mAppQuery: " + getAppQuery() <<
+              "   mGrid: " + getGrid() <<
+              "   mRegion: " + getRegion() <<
+              "   mPosition: "  <<
+              "   mType: " << mType <<
+              "   mPosition: " << mPosition;
+    return result.str();
+}
+
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index 05b0143e72..c12ace17fd 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -1,6 +1,7 @@
-/** 
+/**
  * @file llslurl.h
- * @brief SLURL manipulation
+ * @brief Handles "SLURL fragments" like Ahern/123/45 for
+ * startup processing, login screen, prefs, etc.
  *
  * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
@@ -12,13 +13,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -29,78 +29,82 @@
  * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
+#ifndef LLSLURL_H
+#define LLSLURL_H
 
-#ifndef LL_SLURL_H
-#define LL_SLURL_H
+#include "llstring.h"
 
-#include <string>
 
-// IAN BUG: where should this live?
-// IAN BUG: are static utility functions right?  See LLUUID.
-// question of whether to have a LLSLURL object or a 
-// some of this was moved from LLURLDispatcher
+// represents a location in a grid
 
-/**
- * SLURL manipulation
- */
 class LLSLURL
 {
 public:
-	static const std::string PREFIX_SL_HELP;
-	static const std::string PREFIX_SL;
-	static const std::string PREFIX_SECONDLIFE;
-	static const std::string PREFIX_SLURL;
-
-	static const std::string APP_TOKEN;
-
-	/**
-	 * Is this any sort of secondlife:// or sl:// URL?
-	 */
-	static bool isSLURL(const std::string& url);
-
-	/**
-	 * Is this a special secondlife://app/ URL?
-	 */
-	static bool isSLURLCommand(const std::string& url);
-
-	/**
-	 * Not sure what it is.
-	 */
-	static bool isSLURLHelp(const std::string& url);
-
-	/**
-	 * builds: http://slurl.com/secondlife/Region%20Name/x/y/z/ escaping result url.
-	 */
-	static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
-
-	/// Build a SLURL like secondlife:///app/agent/<uuid>/inspect
-	static std::string buildCommand(const char* noun, const LLUUID& id, const char* verb);
-
-	/**
-	 * builds: http://slurl.com/secondlife/Region Name/x/y/z/ without escaping result url.
-	 */
-	static std::string buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
-
-	/**
-	 * builds SLURL from global position. Returns escaped or unescaped url.
-	 * Returns escaped url by default.
-	 */
-	static std::string buildSLURLfromPosGlobal(const std::string& regionname,
-											   const LLVector3d& global_pos,
-											   bool escaped = true);
-	/**
-	 * Strip protocol part from the URL.
-	 */
-	static std::string stripProtocol(const std::string& url);
-
-	/**
-	 * Convert global position to X, Y Z
-	 */
-	static void globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z);
-
-private:
-	static bool matchPrefix(const std::string& url, const std::string& prefix);
-
+	static const char* SLURL_HTTPS_SCHEME;
+	static const char* SLURL_HTTP_SCHEME;
+	static const char* SLURL_SL_SCHEME;
+	static const char* SLURL_SECONDLIFE_SCHEME;
+	static const char* SLURL_SECONDLIFE_PATH;
+	static const char* SLURL_COM;
+	static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
+	static LLSLURL START_LOCATION;
+	static const char* SIM_LOCATION_HOME;
+	static const char* SIM_LOCATION_LAST;
+	static const char* SLURL_APP_PATH;
+	static const char* SLURL_REGION_PATH;	
+	
+	enum SLURL_TYPE { 
+		INVALID, 
+		LOCATION,
+		HOME_LOCATION,
+		LAST_LOCATION,
+		APP,
+		HELP 
+	};
+		
+	
+	LLSLURL(): mType(LAST_LOCATION)  { }
+	LLSLURL(const std::string& slurl);
+	LLSLURL(const std::string& grid, const std::string& region);
+	LLSLURL(const std::string& region, const LLVector3& position);
+	LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
+	LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
+	LLSLURL(const std::string& region, const LLVector3d& global_position);
+	LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
+	
+	SLURL_TYPE getType() const { return mType; }
+	
+	std::string getSLURLString() const;
+	std::string getLoginString() const;
+	std::string getLocationString() const; 
+	std::string getGrid() const { return mGrid; }
+	std::string getRegion() const { return mRegion; }
+	LLVector3   getPosition() const { return mPosition; }
+	std::string getAppCmd() const { return mAppCmd; }
+	std::string getAppQuery() const { return mAppQuery; }
+	LLSD        getAppQueryMap() const { return mAppQueryMap; }
+	LLSD        getAppPath() const { return mAppPath; }
+	
+	bool        isValid() const { return mType != INVALID; }
+	
+	bool operator==(const LLSLURL& rhs);
+	bool operator!=(const LLSLURL&rhs);
+
+    std::string asString() const ;
+
+
+protected:
+	SLURL_TYPE mType;
+	
+	// used for Apps and Help
+	std::string mAppCmd;
+	LLSD        mAppPath;
+	LLSD        mAppQueryMap;
+	std::string mAppQuery;
+	
+	std::string mGrid;  // reference to grid manager grid
+	std::string mRegion;
+	LLVector3  mPosition;
 };
 
-#endif
+#endif // LLSLURL_H
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 6f7a4e2f6a..d1c6fca063 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -144,7 +144,7 @@
 #include "lltoolmgr.h"
 #include "llui.h"
 #include "llurldispatcher.h"
-#include "llurlsimstring.h"
+#include "llslurl.h"
 #include "llurlhistory.h"
 #include "llurlwhitelist.h"
 #include "llvieweraudio.h"
@@ -229,6 +229,7 @@ static std::string sInitialOutfitGender;	// "male" or "female"
 static bool gUseCircuitCallbackCalled = false;
 
 EStartupState LLStartUp::gStartupState = STATE_FIRST;
+LLSLURL LLStartUp::sStartSLURL;
 
 static LLPointer<LLCredential> gUserCredential;
 static std::string gDisplayName;
@@ -419,7 +420,7 @@ bool idle_startup()
 
 	if ( STATE_FIRST == LLStartUp::getStartupState() )
 	{
-		gViewerWindow->showCursor();
+		gViewerWindow->showCursor(); 
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
 		/////////////////////////////////////////////////
@@ -719,7 +720,7 @@ bool idle_startup()
 		//
 		if (gUserCredential.isNull())
 		{
-			gUserCredential = gLoginHandler.initializeLoginInfo(LLStartUp::sSLURLCommand);
+			gUserCredential = gLoginHandler.initializeLoginInfo();
 		}
 		if (gUserCredential.isNull())
 		{
@@ -769,7 +770,7 @@ bool idle_startup()
 			// show the login view until login_show() is called below.  
 			if (gUserCredential.isNull())                                                                          
 			{                                                                                                      
-				gUserCredential = gLoginHandler.initializeLoginInfo(LLStartUp::sSLURLCommand);                 
+				gUserCredential = gLoginHandler.initializeLoginInfo();                 
 			}     
 			if (gNoRender)
 			{
@@ -936,11 +937,7 @@ bool idle_startup()
 
 		if (show_connect_box)
 		{
-			std::string location;
-			LLPanelLogin::getLocation( location );
-			LLURLSimString::setString( location );
-
-			// END TODO
+			LLStartUp::setStartSLURL(LLPanelLogin::getLocation());
 			LLPanelLogin::closePanel();
 		}
 
@@ -961,26 +958,21 @@ bool idle_startup()
 		// their last location, or some URL "-url //sim/x/y[/z]"
 		// All accounts have both a home and a last location, and we don't support
 		// more locations than that.  Choose the appropriate one.  JC
-		if (LLURLSimString::parse())
-		{
-			// a startup URL was specified
-			agent_location_id = START_LOCATION_ID_URL;
-
-			// doesn't really matter what location_which is, since
-			// gAgentStartLookAt will be overwritten when the
-			// UserLoginLocationReply arrives
-			location_which = START_LOCATION_ID_LAST;
-		}
-		else if (gSavedSettings.getString("LoginLocation") == "last" )
-		{
-			agent_location_id = START_LOCATION_ID_LAST;	// last location
-			location_which = START_LOCATION_ID_LAST;
-		}
-		else
-		{
-			agent_location_id = START_LOCATION_ID_HOME;	// home
-			location_which = START_LOCATION_ID_HOME;
-		}
+		switch (LLStartUp::getStartSLURL().getType())
+		  {
+		  case LLSLURL::LOCATION:
+		    agent_location_id = START_LOCATION_ID_URL;
+		    location_which = START_LOCATION_ID_LAST;
+		    break;
+		  case LLSLURL::LAST_LOCATION:
+		    agent_location_id = START_LOCATION_ID_LAST;
+		    location_which = START_LOCATION_ID_LAST;
+		    break;
+		  default:
+		    agent_location_id = START_LOCATION_ID_HOME;
+		    location_which = START_LOCATION_ID_HOME;
+		    break;
+		  }
 
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
@@ -1851,7 +1843,8 @@ bool idle_startup()
 		// thus, do not show this alert.
 		if (!gAgent.isFirstLogin())
 		{
-			bool url_ok = LLURLSimString::sInstance.parse();
+			llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
+			bool url_ok = (LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
 			if ((url_ok && gAgentStartLocation == "url") ||
 				(!url_ok && ((gAgentStartLocation == gSavedSettings.getString("LoginLocation")))))
 			{
@@ -2197,7 +2190,7 @@ bool login_alert_status(const LLSD& notification, const LLSD& response)
       //      break;
         case 2:     // Teleport
             // Restart the login process, starting at our home locaton
-            LLURLSimString::setString("home");
+	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
             LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
             break;
         default:
@@ -2619,7 +2612,6 @@ void reset_login()
 
 //---------------------------------------------------------------------------
 
-std::string LLStartUp::sSLURLCommand;
 
 bool LLStartUp::canGoFullscreen()
 {
@@ -2652,35 +2644,40 @@ void LLStartUp::fontInit()
 bool LLStartUp::dispatchURL()
 {
 	// ok, if we've gotten this far and have a startup URL
-	if (!sSLURLCommand.empty())
+        if (!getStartSLURL().isValid())
 	{
-		LLMediaCtrl* web = NULL;
-		const bool trusted_browser = false;
-		LLURLDispatcher::dispatch(sSLURLCommand, web, trusted_browser);
+	  return false;
 	}
-	else if (LLURLSimString::parse())
-	{
+        if(getStartSLURL().getType() != LLSLURL::APP)
+	  {
+	    
 		// If we started with a location, but we're already
 		// at that location, don't pop dialogs open.
 		LLVector3 pos = gAgent.getPositionAgent();
-		F32 dx = pos.mV[VX] - (F32)LLURLSimString::sInstance.mX;
-		F32 dy = pos.mV[VY] - (F32)LLURLSimString::sInstance.mY;
+		LLVector3 slurlpos = getStartSLURL().getPosition();
+		F32 dx = pos.mV[VX] - slurlpos.mV[VX];
+		F32 dy = pos.mV[VY] - slurlpos.mV[VY];
 		const F32 SLOP = 2.f;	// meters
 
-		if( LLURLSimString::sInstance.mSimName != gAgent.getRegion()->getName()
+		if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
 			|| (dx*dx > SLOP*SLOP)
 			|| (dy*dy > SLOP*SLOP) )
 		{
-			std::string url = LLURLSimString::getURL();
-			LLMediaCtrl* web = NULL;
-			const bool trusted_browser = false;
-			LLURLDispatcher::dispatch(url, web, trusted_browser);
+			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), 
+						  NULL, false);
 		}
 		return true;
 	}
 	return false;
 }
 
+void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
+{
+  sStartSLURL = slurl;
+  gSavedSettings.setBOOL("LoginLastLocation", 
+			 !(slurl.getType() == LLSLURL::HOME_LOCATION)); 
+}
+
 bool login_alert_done(const LLSD& notification, const LLSD& response)
 {
 	LLPanelLogin::giveFocus();
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 28bc7fcd2a..c01a6fc8e1 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -34,6 +34,7 @@
 #define LL_LLSTARTUP_H
 
 #include <boost/scoped_ptr.hpp>
+#include "llslurl.h"
 
 class LLViewerTexture ;
 class LLEventPump;
@@ -106,13 +107,13 @@ public:
 		// if we have a SLURL or sim string ("Ahern/123/45") that started
 		// the viewer, dispatch it
 
-	static std::string sSLURLCommand;
-		// *HACK: On startup, if we were passed a secondlife://app/do/foo
-		// command URL, store it for later processing.
-
 	static void postStartupState();
+	static void setStartSLURL(const LLSLURL& slurl); 
+	static LLSLURL& getStartSLURL() { return sStartSLURL; } 
 
 private:
+	static LLSLURL sStartSLURL;
+
 	static std::string startupStateToString(EStartupState state);
 	static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
 	static boost::scoped_ptr<LLEventPump> sStateWatcher;
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 2485563cbc..15e02b38d1 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -50,7 +50,7 @@ const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
 		{
 			style_params.color.control = "HTMLLinkColor";
 			style_params.link_href = 
-					LLSLURL::buildCommand("agent", source, "inspect");
+					LLSLURL("agent", source, "inspect").getSLURLString();
 		}
 		else
 		{
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index 0b6bd4b401..5b11f82a45 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -4,7 +4,7 @@
  *
  * $LicenseInfo:firstyear=2007&license=viewergpl$
  * 
- * Copyright (c) 2007-2009, Linden Research, Inc.
+ * Copyright (c) 2010, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +12,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -45,10 +44,10 @@
 #include "llsidetray.h"
 #include "llslurl.h"
 #include "llstartup.h"			// gStartupState
-#include "llurlsimstring.h"
 #include "llweb.h"
 #include "llworldmapmessage.h"
 #include "llurldispatcherlistener.h"
+#include "llviewernetwork.h"
 
 // library includes
 #include "llnotificationsutil.h"
@@ -59,25 +58,25 @@ static LLURLDispatcherListener sURLDispatcherListener;
 class LLURLDispatcherImpl
 {
 public:
-	static bool dispatch(const std::string& url,
+	static bool dispatch(const LLSLURL& slurl,
 						 LLMediaCtrl* web,
 						 bool trusted_browser);
 		// returns true if handled or explicitly blocked.
 
-	static bool dispatchRightClick(const std::string& url);
+	static bool dispatchRightClick(const LLSLURL& slurl);
 
 private:
-	static bool dispatchCore(const std::string& url, 
+	static bool dispatchCore(const LLSLURL& slurl, 
 							 bool right_mouse,
 							 LLMediaCtrl* web,
 							 bool trusted_browser);
 		// handles both left and right click
 
-	static bool dispatchHelp(const std::string& url, bool right_mouse);
+	static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
 		// Handles sl://app.floater.html.help by showing Help floater.
 		// Returns true if handled.
 
-	static bool dispatchApp(const std::string& url,
+	static bool dispatchApp(const LLSLURL& slurl,
 							bool right_mouse,
 							LLMediaCtrl* web,
 							bool trusted_browser);
@@ -85,16 +84,16 @@ private:
 		// by showing panel in Search floater.
 		// Returns true if handled or explicitly blocked.
 
-	static bool dispatchRegion(const std::string& url, bool right_mouse);
+	static bool dispatchRegion(const LLSLURL& slurl, bool right_mouse);
 		// handles secondlife://Ahern/123/45/67/
 		// Returns true if handled.
 
-	static void regionHandleCallback(U64 handle, const std::string& url,
+	static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a location has been resolved to a
 	    // region name
 
-	static void regionNameCallback(U64 handle, const std::string& url,
+	static void regionNameCallback(U64 handle, const LLSLURL& slurl,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a region name has been resolved to a
 		// location in-world, used by places-panel display.
@@ -103,65 +102,57 @@ private:
 };
 
 // static
-bool LLURLDispatcherImpl::dispatchCore(const std::string& url,
+bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
 									   bool right_mouse,
 									   LLMediaCtrl* web,
 									   bool trusted_browser)
 {
-	if (url.empty()) return false;
-	//if (dispatchHelp(url, right_mouse)) return true;
-	if (dispatchApp(url, right_mouse, web, trusted_browser)) return true;
-	if (dispatchRegion(url, right_mouse)) return true;
+	//if (dispatchHelp(slurl, right_mouse)) return true;
+	switch(slurl.getType())
+	{
+		case LLSLURL::APP: 
+			return dispatchApp(slurl, right_mouse, web, trusted_browser);
+		case LLSLURL::LOCATION:
+			return dispatchRegion(slurl, right_mouse);
+		default:
+			return false;
+	}
 
 	/*
 	// Inform the user we can't handle this
 	std::map<std::string, std::string> args;
-	args["SLURL"] = url;
+	args["SLURL"] = slurl;
 	r;
 	*/
-	
-	return false;
 }
 
 // static
-bool LLURLDispatcherImpl::dispatch(const std::string& url,
+bool LLURLDispatcherImpl::dispatch(const LLSLURL& slurl,
 								   LLMediaCtrl* web,
 								   bool trusted_browser)
 {
-	llinfos << "url: " << url << llendl;
 	const bool right_click = false;
-	return dispatchCore(url, right_click, web, trusted_browser);
+	return dispatchCore(slurl, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url)
+bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
 {
-	llinfos << "url: " << url << llendl;
 	const bool right_click = true;
 	LLMediaCtrl* web = NULL;
 	const bool trusted_browser = false;
-	return dispatchCore(url, right_click, web, trusted_browser);
+	return dispatchCore(slurl, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
+bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, 
 									  bool right_mouse,
 									  LLMediaCtrl* web,
 									  bool trusted_browser)
 {
-	// ensure the URL is in the secondlife:///app/ format
-	if (!LLSLURL::isSLURLCommand(url))
-	{
-		return false;
-	}
-
-	LLURI uri(url);
-	LLSD pathArray = uri.pathArray();
-	pathArray.erase(0); // erase "app"
-	std::string cmd = pathArray.get(0);
-	pathArray.erase(0); // erase "cmd"
+	llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
 	bool handled = LLCommandDispatcher::dispatch(
-			cmd, pathArray, uri.queryMap(), web, trusted_browser);
+			slurl.getAppCmd(), slurl.getAppPath(), slurl.getAppQuery(), web, trusted_browser);
 
 	// alert if we didn't handle this secondlife:///app/ SLURL
 	// (but still return true because it is a valid app SLURL)
@@ -173,109 +164,68 @@ bool LLURLDispatcherImpl::dispatchApp(const std::string& url,
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mouse)
+bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse)
 {
-	if (!LLSLURL::isSLURL(url))
-	{
-		return false;
-	}
-
 	// Before we're logged in, need to update the startup screen
 	// to tell the user where they are going.
 	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
 	{
 		// Parse it and stash in globals, it will be dispatched in
 		// STATE_CLEANUP.
-		LLURLSimString::setString(url);
+		LLStartUp::setStartSLURL(slurl);
 		// We're at the login screen, so make sure user can see
 		// the login location box to know where they are going.
 		
-		LLPanelLogin::refreshLocation( true );
+		LLPanelLogin::updateLocationCombo( true );
 		return true;
 	}
 
-	std::string sim_string = LLSLURL::stripProtocol(url);
-	std::string region_name;
-	S32 x = 128;
-	S32 y = 128;
-	S32 z = 0;
-	LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
-
 	// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
-	//LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-	//if(url_displayp) url_displayp->setName(region_name);
+	//LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+	//if(slurl_displayp) slurl_displayp->setName(region_name);
 
 	// Request a region handle by name
-	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
+	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
 									  LLURLDispatcherImpl::regionNameCallback,
-									  url,
+									  slurl.getSLURLString(),
 									  false);	// don't teleport
 	return true;
 }
 
 /*static*/
-void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
 {
-	std::string sim_string = LLSLURL::stripProtocol(url);
-	std::string region_name;
-	S32 x = 128;
-	S32 y = 128;
-	S32 z = 0;
-	LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
-
-	LLVector3 local_pos;
-	local_pos.mV[VX] = (F32)x;
-	local_pos.mV[VY] = (F32)y;
-	local_pos.mV[VZ] = (F32)z;
+	regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
+}
 
-	
-	// determine whether the point is in this region
-	if ((x >= 0) && (x < REGION_WIDTH_UNITS) &&
-		(y >= 0) && (y < REGION_WIDTH_UNITS))
-	{
-		// if so, we're done
-		regionHandleCallback(region_handle, url, snapshot_id, teleport);
-	}
+/* static */
+void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
+{
 
-	else
+  // we can't teleport cross grid at this point
+	if((!LLGridManager::getInstance()->isSystemGrid(slurl.getGrid()) || !LLGridManager::getInstance()->isSystemGrid()) &&
+	   (slurl.getGrid() != LLGridManager::getInstance()->getGridName()))
 	{
-		// otherwise find the new region from the location
+		LLSD args;
+		args["SLURL"] = slurl.getLocationString();
+		args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
+		LLSD grid_info = LLGridManager::getInstance()->getGridInfo(slurl.getGrid());
 		
-		// add the position to get the new region
-		LLVector3d global_pos = from_region_handle(region_handle) + LLVector3d(local_pos);
-
-		U64 new_region_handle = to_region_handle(global_pos);
-		LLWorldMapMessage::getInstance()->sendHandleRegionRequest(new_region_handle,
-										   LLURLDispatcherImpl::regionHandleCallback,
-										   url, teleport);
+		if(grid_info.has(GRID_LABEL_VALUE))
+		{
+			args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
+		}
+		else 
+		{
+			args["GRID"] = slurl.getGrid();
+		}
+		LLNotificationsUtil::add("CantTeleportToGrid", args);
+		return;
 	}
-}
-
-/* static */
-void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
-{
-	std::string sim_string = LLSLURL::stripProtocol(url);
-	std::string region_name;
-	S32 x = 128;
-	S32 y = 128;
-	S32 z = 0;
-	LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
-
-	// remap x and y to local coordinates
-	S32 local_x = x % REGION_WIDTH_UNITS;
-	S32 local_y = y % REGION_WIDTH_UNITS;
-	if (local_x < 0)
-		local_x += REGION_WIDTH_UNITS;
-	if (local_y < 0)
-		local_y += REGION_WIDTH_UNITS;
 	
-	LLVector3 local_pos;
-	local_pos.mV[VX] = (F32)local_x;
-	local_pos.mV[VY] = (F32)local_y;
-	local_pos.mV[VZ] = (F32)z;
 
 	LLVector3d global_pos = from_region_handle(region_handle);
-	global_pos += LLVector3d(local_pos);
+	global_pos += LLVector3d(slurl.getPosition());
 	
 	if (teleport)
 	{	
@@ -299,8 +249,8 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str
 		// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
 
 //		// display informational floater, allow user to click teleport btn
-//		LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-//		if(url_displayp)
+//		LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+//		if(slurl_displayp)
 //		{
 //			url_displayp->displayParcelInfo(region_handle, local_pos);
 //			if(snapshot_id.notNull())
@@ -315,7 +265,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::str
 
 //---------------------------------------------------------------------------
 // Teleportation links are handled here because they are tightly coupled
-// to URL parsing and sim-fragment parsing
+// to SLURL parsing and sim-fragment parsing
 class LLTeleportHandler : public LLCommandHandler
 {
 public:
@@ -331,18 +281,21 @@ public:
 		// a global position, and teleport to it
 		if (tokens.size() < 1) return false;
 
-		// Region names may be %20 escaped.
-		std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
-
-		// build secondlife://De%20Haro/123/45/67 for use in callback
-		std::string url = LLSLURL::PREFIX_SECONDLIFE;
-		for (int i = 0; i < tokens.size(); ++i)
+		LLVector3 coords(128, 128, 0);
+		if (tokens.size() <= 4)
 		{
-			url += tokens[i].asString() + "/";
+			coords = LLVector3(tokens[1].asReal(), 
+							   tokens[2].asReal(), 
+							   tokens[3].asReal());
 		}
+		
+		// Region names may be %20 escaped.
+		
+		std::string region_name = LLURI::unescape(tokens[0]);
+
 		LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
 			LLURLDispatcherImpl::regionHandleCallback,
-			url,
+			LLSLURL(region_name, coords).getSLURLString(),
 			true);	// teleport
 		return true;
 	}
@@ -352,21 +305,21 @@ LLTeleportHandler gTeleportHandler;
 //---------------------------------------------------------------------------
 
 // static
-bool LLURLDispatcher::dispatch(const std::string& url,
+bool LLURLDispatcher::dispatch(const std::string& slurl,
 							   LLMediaCtrl* web,
 							   bool trusted_browser)
 {
-	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcher::dispatchRightClick(const std::string& url)
+bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
 {
-	return LLURLDispatcherImpl::dispatchRightClick(url);
+	return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
 }
 
 // static
-bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
+bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
 {
 	// *NOTE: Text editors are considered sources of trusted URLs
 	// in order to make avatar profile links in chat history work.
@@ -376,5 +329,7 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
 	// *TODO: Make this trust model more refined.  JC
 	const bool trusted_browser = true;
 	LLMediaCtrl* web = NULL;
-	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
 }
+
+
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index ff8a351253..41c5225e00 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -4,7 +4,7 @@
  *
  * $LicenseInfo:firstyear=2007&license=viewergpl$
  * 
- * Copyright (c) 2007-2009, Linden Research, Inc.
+ * Copyright (c) 2007, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +12,12 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * online at http://secondlife.com/developers/opensource/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlife.com/developers/opensource/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -31,16 +30,17 @@
  */
 #ifndef LLURLDISPATCHER_H
 #define LLURLDISPATCHER_H
-
+#include "llslurl.h"
 class LLMediaCtrl;
 
 
 class LLURLDispatcher
 {
 public:
-	static bool dispatch(const std::string& url,
+	
+	static bool dispatch(const std::string& slurl,
 						 LLMediaCtrl* web,
-						 bool trusted_browser);
+						 bool trusted_browser);	
 		// At startup time and on clicks in internal web browsers,
 		// teleport, open map, or run requested command.
 		// @param url
@@ -54,9 +54,9 @@ public:
 		//   that navigates to trusted (Linden Lab) pages.
 		// Returns true if someone handled the URL.
 
-	static bool dispatchRightClick(const std::string& url);
+	static bool dispatchRightClick(const std::string& slurl);
 
-	static bool dispatchFromTextEditor(const std::string& url);
+	static bool dispatchFromTextEditor(const std::string& slurl);
 };
 
 #endif
diff --git a/indra/newview/llurldispatcherlistener.cpp b/indra/newview/llurldispatcherlistener.cpp
index fea6a769c5..8f50f30d6d 100644
--- a/indra/newview/llurldispatcherlistener.cpp
+++ b/indra/newview/llurldispatcherlistener.cpp
@@ -17,6 +17,7 @@
 // std headers
 // external library headers
 // other Linden headers
+#include "llslurl.h"
 #include "llurldispatcher.h"
 
 LLURLDispatcherListener::LLURLDispatcherListener(/* LLURLDispatcher* instance */):
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 258c3ddd75..2a5c7cbea1 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -89,7 +89,7 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 
 	const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
 	LLWString text_to_copy;
-	if (LLSLURL::isSLURL(unescaped_text))
+	if (LLSLURL(unescaped_text).isValid())
 		text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
 	else
 		text_to_copy = utf8str_to_wstring(unescaped_text);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3362142807..6bff78de82 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1518,9 +1518,9 @@ void inventory_offer_handler(LLOfferInfo* info)
 	payload["give_inventory_notification"] = FALSE;
 	args["OBJECTFROMNAME"] = info->mFromName;
 	args["NAME"] = info->mFromName;
-	args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
+	args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
 	std::string verb = "select?name=" + LLURI::escape(msg);
-	args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
+	args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
 
 	LLNotification::Params p("ObjectGiveItem");
 
@@ -3037,7 +3037,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		if (avatarp)
 		{
 			// Chat the "back" SLURL. (DEV-4907)
-			LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL());
+			LLChat chat("Teleport completed from " + gAgent.getTeleportSourceSLURL().getSLURLString());
 			chat.mSourceType = CHAT_SOURCE_SYSTEM;
  		    LLFloaterChat::addChatHistory(chat);
 
@@ -5353,7 +5353,7 @@ void send_group_notice(const LLUUID& group_id,
 bool handle_lure_callback(const LLSD& notification, const LLSD& response)
 {
 	std::string text = response["message"].asString();
-	text.append("\r\n").append(LLAgentUI::buildSLURL());
+	text.append("\r\n").append(LLAgentUI::buildSLURL().getSLURLString());
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 
 	if(0 == option)
@@ -5774,7 +5774,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
-		LLSLURL::buildCommand("agent", estate_owner_id, "inspect");
+		LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
 	LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index 82dc459777..3615c00f37 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2010, Linden Research, Inc.
+ * Copyright (c) 2006-2007, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -40,7 +40,8 @@
                                                             
 const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/";
 
-const char* SYSTEM_GRID_SLURL_BASE = "http://slurl.com/secondlife/";
+const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
+const char* MAIN_GRID_SLURL_BASE = "http://slurl.com/secondlife/";
 const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
 
 const char* DEFAULT_SLURL_BASE = "https://%s/region/";
@@ -60,6 +61,12 @@ LLGridManager::LLGridManager()
 }
 
 
+LLGridManager::LLGridManager(const std::string& grid_file)
+{
+	// initialize with an explicity grid file for testing.
+	initialize(grid_file);
+}
+
 //
 // LLGridManager - class for managing the list of known grids, and the current
 // selection
@@ -391,7 +398,7 @@ void LLGridManager::addSystemGrid(const std::string& label,
 	grid[GRID_LOGIN_PAGE_VALUE] = login_page;
 	grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
 	grid[GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE] = GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT;
-	grid[GRID_SLURL_BASE] = SYSTEM_GRID_SLURL_BASE;
+	
 	grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
 	if (login_id.empty())
 	{
@@ -406,8 +413,13 @@ void LLGridManager::addSystemGrid(const std::string& label,
 	// if we're building a debug version.
 	if (name == std::string(MAINGRID))
 	{
+		grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;		
 		grid[GRID_IS_FAVORITE_VALUE] = TRUE;		
 	}
+	else
+	{
+		grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, label.c_str());		
+	}
 	addGrid(grid);
 }
 
@@ -458,6 +470,20 @@ void LLGridManager::setGridChoice(const std::string& grid_name)
 	gSavedSettings.setString("CurrentGrid", grid_name);
 }
 
+std::string LLGridManager::getGridByLabel( const std::string &grid_label)
+{
+	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
+		grid_iter != mGridList.endMap();
+		grid_iter++) 
+	{
+		if (grid_iter->second.has(GRID_LABEL_VALUE) && (grid_iter->second[GRID_LABEL_VALUE].asString() == grid_label))
+		{
+			return grid_iter->first;
+		}
+	}
+	return std::string();
+}
+
 void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
 {
 	uris.clear();
@@ -528,10 +554,10 @@ std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
 	std::string grid_base;
 	if(mGridList.has(grid_name) && mGridList[grid_name].has(GRID_APP_SLURL_BASE))
 	{
-		return mGridList[grid_name][GRID_APP_SLURL_BASE].asString();
+	  return mGridList[grid_name][GRID_APP_SLURL_BASE].asString();
 	}
 	else
 	{
-		return  llformat(DEFAULT_APP_SLURL_BASE, grid_name.c_str());
+	  return  llformat(DEFAULT_APP_SLURL_BASE, grid_name.c_str());
 	}
 }
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 0642845d54..bcf0c5a8f2 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -43,7 +43,6 @@ extern const char* DEFAULT_LOGIN_PAGE;
 #define GRID_LOGIN_PAGE_VALUE "login_page"
 #define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
 #define GRID_IS_FAVORITE_VALUE "favorite"
-#define GRID_IS_VISIBLE_VALUE "visible"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE "credential_type"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT "agent"
 #define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_ACCOUNT "account"
@@ -79,6 +78,7 @@ public:
 	
 	// when the grid manager is instantiated, the default grids are automatically
 	// loaded, and the grids favorites list is loaded from the xml file.
+	LLGridManager(const std::string& grid_file);
 	LLGridManager();
 	~LLGridManager();
 	
@@ -112,10 +112,7 @@ public:
 	void setGridChoice(const std::string& grid_name);
 	
 	
-	std::string getGridLabel() 
-	{ 
-		return mGridList[mGridName][GRID_LABEL_VALUE]; 
-	} 	
+	std::string getGridLabel() { return mGridList[mGridName][GRID_LABEL_VALUE]; } 	
 	std::string getGridName() const { return mGridName; }
 	void getLoginURIs(std::vector<std::string>& uris);
 	std::string getHelperURI() {return mGridList[mGridName][GRID_HELPER_URI_VALUE];}
@@ -132,6 +129,8 @@ public:
 	
 	LLSD getGridInfo() { return mGridList[mGridName]; }
 	
+	std::string getGridByLabel( const std::string &grid_label);
+	
 	bool isSystemGrid(const std::string& grid) 
 	{ 
 		return mGridList.has(grid) &&
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index f8e08dbf7d..ee6fb8120c 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2033,7 +2033,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 			gSavedSettings.setBOOL("ForceShowGrid", visible);
 
 			// Initialize visibility (and don't force visibility - use prefs)
-			LLPanelLogin::refreshLocation( false );
+			LLPanelLogin::updateLocationCombo( false );
 		}
 	}
 
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c4cbcb1dc8..d177cfce7d 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2371,6 +2371,15 @@ Please choose the male or female avatar. You can change your mind later.
      notext="Female"
      yestext="Male"/>
   </notification>
+  <notification icon="alertmodal.tga"
+		name="CantTeleportToGrid"
+		type="alertmodal">
+Could not teleport to [SLURL] as it's on a different grid ([GRID]) than the current grid ([CURRENT_GRID]).  Please close your viewer and try again.
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+
   <notification icon="alertmodal.tga"
 		name="GeneralCertificateError"
 		type="alertmodal">
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 9222882f5f..f4d9cc99cc 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -36,7 +36,12 @@ const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno");
 //-----------------------------------------------------------------------------
 static LLEventStream gTestPump("test_pump");
 
+#include "../llslurl.h"
+#include "../llstartup.h"
+LLSLURL LLStartUp::sStartSLURL;
+
 #include "lllogin.h"
+
 static std::string gLoginURI;
 static LLSD gLoginCreds;
 static bool gDisconnectCalled = false;
@@ -141,10 +146,6 @@ BOOL LLControlGroup::declareString(const std::string& name, const std::string &i
 #include "lluicolortable.h"
 void LLUIColorTable::saveUserSettings(void)const {}
 
-//-----------------------------------------------------------------------------
-#include "../llurlsimstring.h"
-LLURLSimString LLURLSimString::sInstance;
-bool LLURLSimString::parse() { return true; }
 
 //-----------------------------------------------------------------------------
 #include "llnotifications.h"
diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp
new file mode 100644
index 0000000000..90d2526890
--- /dev/null
+++ b/indra/newview/tests/llslurl_test.cpp
@@ -0,0 +1,258 @@
+/** 
+ * @file llsecapi_test.cpp
+ * @author Roxie
+ * @date 2009-02-10
+ * @brief Test the sec api functionality
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#include "../llviewerprecompiledheaders.h"
+#include "../llviewernetwork.h"
+#include "../test/lltut.h"
+#include "../llslurl.h"
+#include "../../llxml/llcontrol.h"
+#include "llsdserialize.h"
+//----------------------------------------------------------------------------               
+// Mock objects for the dependencies of the code we're testing                               
+
+LLControlGroup::LLControlGroup(const std::string& name)
+: LLInstanceTracker<LLControlGroup, std::string>(name) {}
+LLControlGroup::~LLControlGroup() {}
+BOOL LLControlGroup::declareString(const std::string& name,
+                                   const std::string& initial_val,
+                                   const std::string& comment,
+                                   BOOL persist) {return TRUE;}
+void LLControlGroup::setString(const std::string& name, const std::string& val){}
+
+std::string gCmdLineLoginURI;
+std::string gCmdLineGridChoice;
+std::string gCmdLineHelperURI;
+std::string gLoginPage;
+std::string gCurrentGrid;
+std::string LLControlGroup::getString(const std::string& name)
+{
+	if (name == "CmdLineGridChoice")
+		return gCmdLineGridChoice;
+	else if (name == "CmdLineHelperURI")
+		return gCmdLineHelperURI;
+	else if (name == "LoginPage")
+		return gLoginPage;
+	else if (name == "CurrentGrid")
+		return gCurrentGrid;
+	return "";
+}
+
+LLSD LLControlGroup::getLLSD(const std::string& name)
+{
+	if (name == "CmdLineLoginURI")
+	{
+		if(!gCmdLineLoginURI.empty())
+		{
+			return LLSD(gCmdLineLoginURI);
+		}
+	}
+	return LLSD();
+}
+
+
+LLControlGroup gSavedSettings("test");
+
+// -------------------------------------------------------------------------------------------
+// TUT
+// -------------------------------------------------------------------------------------------
+namespace tut
+{
+	// Test wrapper declaration : wrapping nothing for the moment
+	struct slurlTest
+	{
+		slurlTest()
+		{	
+			LLGridManager::getInstance()->initialize(std::string(""));
+		}
+		~slurlTest()
+		{
+		}
+	};
+	
+	// Tut templating thingamagic: test group, object and test instance
+	typedef test_group<slurlTest> slurlTestFactory;
+	typedef slurlTestFactory::object slurlTestObject;
+	tut::slurlTestFactory tut_test("llslurl");
+	
+	// ---------------------------------------------------------------------------------------
+	// Test functions 
+	// ---------------------------------------------------------------------------------------
+	// construction from slurl string
+	template<> template<>
+	void slurlTestObject::test<1>()
+	{
+		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
+		
+		LLSLURL slurl = LLSLURL("");
+		ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
+		
+		slurl = LLSLURL("http://slurl.com/secondlife/myregion");
+		ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/128/128/0");
+		
+		slurl = LLSLURL("http://slurl.com/secondlife/myregion/1/2/3");
+		ensure_equals("slurl.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("slurl.com slurl, region + coords", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/1/2/3");
+
+		slurl = LLSLURL("secondlife://myregion");
+		ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/128/128/0");
+		
+		slurl = LLSLURL("secondlife://myregion/1/2/3");
+		ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/1/2/3");
+		
+		slurl = LLSLURL("/myregion");
+		ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("/region slurl, region ", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/128/128/0");
+		
+		slurl = LLSLURL("/myregion/1/2/3");
+		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/myregion/1/2/3");	
+		
+		slurl = LLSLURL("my region/1/2/3");
+		ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/my%20region/1/2/3");	
+		
+		slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
+					  "https://my.grid.com/region/my%20region/1/2/3");	
+		
+		slurl = LLSLURL("https://my.grid.com/region/my region");
+		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
+					  "https://my.grid.com/region/my%20region/128/128/0");
+		
+		LLGridManager::getInstance()->setGridChoice("foo.bar.com");		
+		slurl = LLSLURL("/myregion/1/2/3");
+		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
+					  "https://foo.bar.com/region/myregion/1/2/3");		
+		
+		slurl = LLSLURL("myregion/1/2/3");
+		ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
+					  "https://foo.bar.com/region/myregion/1/2/3");		
+		
+		slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
+		ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);
+
+		slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
+		ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
+		
+		slurl = LLSLURL("secondlife:///app/foo/bar?12345");
+		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
+		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+		ensure_equals("apppath", slurl.getAppPath().size(), 1);
+		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+		ensure_equals("appquery", slurl.getAppQuery(), "12345");
+		ensure_equals("grid1", "foo.bar.com", slurl.getGrid());
+	
+		slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
+		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
+		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+		ensure_equals("apppath", slurl.getAppPath().size(), 1);
+		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+		ensure_equals("appquery", slurl.getAppQuery(), "12345");
+		ensure_equals("grid2", "util.aditi.lindenlab.com", slurl.getGrid());		
+
+		LLGridManager::getInstance()->setGridChoice("foo.bar.com");			
+		slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
+		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("region" , "myregion", slurl.getRegion());
+		ensure_equals("grid3", "util.agni.lindenlab.com", slurl.getGrid());
+				
+		slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
+		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("region" , "myregion", slurl.getRegion());
+		ensure_equals("grid4", "util.aditi.lindenlab.com", slurl.getGrid());		
+		
+		slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
+		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
+		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
+		ensure_equals("apppath", slurl.getAppPath().size(), 1);
+		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
+		ensure_equals("appquery", slurl.getAppQuery(), "12345");	
+		
+	}
+	
+	// construction from grid/region/vector combos
+	template<> template<>
+	void slurlTestObject::test<2>()
+	{
+		LLSLURL slurl = LLSLURL("mygrid.com", "my region");
+		ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals("grid/region", slurl.getSLURLString(), 
+					  "https://mygrid.com/region/my%20region/128/128/0");	
+		
+		slurl = LLSLURL("mygrid.com", "my region", LLVector3(1,2,3));
+		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
+					  "https://mygrid.com/region/my%20region/1/2/3");			
+
+		LLGridManager::getInstance()->setGridChoice("foo.bar.com.bar");			
+		slurl = LLSLURL("my region", LLVector3(1,2,3));
+		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
+					  "https://foo.bar.com.bar/region/my%20region/1/2/3");	
+		
+		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");	
+		slurl = LLSLURL("my region", LLVector3(1,2,3));
+		ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
+		ensure_equals(" default grid/region/vector", slurl.getSLURLString(), 
+					  "http://slurl.com/secondlife/my%20region/1/2/3");	
+		
+	}
+	// Accessors
+	template<> template<>
+	void slurlTestObject::test<3>()
+	{
+		LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
+		ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
+		ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
+		ensure_equals("grid", slurl.getGrid(), "my.grid.com");
+		ensure_equals("region", slurl.getRegion(), "my region");
+		ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
+		
+	}
+}
-- 
cgit v1.2.3


From e65b6d96957fd92fdc8c5a42b1ad4b1a153552b3 Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxie@lindenlab.com>
Date: Thu, 9 Jul 2009 21:45:04 +0000
Subject: DEV-34822

svn merge -c120157 svn+ssh://svn.lindenlab.com/svn/linden/branches/giab-viewer/giab-viewer-2
---
 indra/llmessage/llhttpclient.cpp | 16 +++++++---
 indra/llmessage/llhttpclient.h   | 11 +++++--
 indra/llmessage/llurlrequest.cpp | 52 +++++++++++++++++++++++++-----
 indra/llmessage/llurlrequest.h   | 68 ++++++----------------------------------
 indra/newview/llappviewer.cpp    |  1 +
 indra/newview/llsecapi.cpp       | 37 ++++++++++++++++++++++
 indra/newview/llsecapi.h         |  4 +++
 indra/newview/llworld.cpp        |  3 +-
 8 files changed, 119 insertions(+), 73 deletions(-)

(limited to 'indra')

diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 12ecbb36eb..345b76d1a1 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -31,7 +31,7 @@
  */
 
 #include "linden_common.h"
-
+#include <openssl/x509_vfy.h>
 #include "llhttpclient.h"
 
 #include "llassetstorage.h"
@@ -46,7 +46,10 @@
 #include "message.h"
 #include <curl/curl.h>
 
+
 const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
+LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
+
 ////////////////////////////////////////////////////////////////////////////
 
 // Responder class moved to LLCurl
@@ -206,13 +209,19 @@ namespace
 	LLPumpIO* theClientPump = NULL;
 }
 
+void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback)
+{
+	LLHTTPClient::mCertVerifyCallback = callback;
+}
+
 static void request(
 	const std::string& url,
 	LLURLRequest::ERequestAction method,
 	Injector* body_injector,
 	LLCurl::ResponderPtr responder,
 	const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
-	const LLSD& headers = LLSD())
+	const LLSD& headers = LLSD()
+    )
 {
 	if (!LLHTTPClient::hasPump())
 	{
@@ -222,7 +231,7 @@ static void request(
 	LLPumpIO::chain_t chain;
 
 	LLURLRequest* req = new LLURLRequest(method, url);
-	req->checkRootCertificate(true);
+	req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
 
 	
 	lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
@@ -417,7 +426,6 @@ static LLSD blocking_request(
 	std::string body_str;
 	
 	// other request method checks root cert first, we skip?
-	//req->checkRootCertificate(true);
 	
 	// * Set curl handle options
 	curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1);	// don't use SIGALRM for timeouts
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 3d0646e5fe..8afbc9e0fc 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -40,7 +40,8 @@
 #include <string>
 
 #include <boost/intrusive_ptr.hpp>
-
+#include <openssl/x509_vfy.h>
+#include "llurlrequest.h"
 #include "llassettype.h"
 #include "llcurl.h"
 #include "lliopipe.h"
@@ -61,6 +62,7 @@ public:
 	typedef LLCurl::Responder Responder;
 	typedef LLCurl::ResponderPtr ResponderPtr;
 
+	
 	/** @name non-blocking API */
 	//@{
 	static void head(
@@ -155,7 +157,12 @@ public:
 	static void setPump(LLPumpIO& pump);
 		///< must be called before any of the above calls are made
 	static bool hasPump();
-		///< for testing
+
+	static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
+	static  LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
+
+protected:
+	static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
 };
 
 #endif // LL_LLHTTPCLIENT_H
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 81b7761ed5..752be49663 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -36,7 +36,8 @@
 #include "llurlrequest.h"
 
 #include <algorithm>
-
+#include <openssl/x509_vfy.h>
+#include <openssl/ssl.h>
 #include "llcurl.h"
 #include "llioutil.h"
 #include "llmemtype.h"
@@ -56,6 +57,8 @@ const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
 
 static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user);
 
+
+
 /**
  * class LLURLRequestDetail
  */
@@ -72,6 +75,8 @@ public:
 	U32 mBodyLimit;
 	S32 mByteAccumulator;
 	bool mIsBodyLimitSet;
+	LLURLRequest::SSLCertVerifyCallback mSSLVerifyCallback;
+	void * mSSLVerifyParam;
 };
 
 LLURLRequestDetail::LLURLRequestDetail() :
@@ -80,7 +85,8 @@ LLURLRequestDetail::LLURLRequestDetail() :
 	mLastRead(NULL),
 	mBodyLimit(0),
 	mByteAccumulator(0),
-	mIsBodyLimitSet(false)
+	mIsBodyLimitSet(false),
+    mSSLVerifyCallback(NULL)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	mCurlRequest = new LLCurlEasyRequest();
@@ -94,6 +100,37 @@ LLURLRequestDetail::~LLURLRequestDetail()
 	mLastRead = NULL;
 }
 
+void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param)
+{
+	mDetail->mSSLVerifyCallback = callback;
+	mDetail->mSSLVerifyParam = param;
+	mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);	
+}
+
+
+// _sslCtxFunction
+// Callback function called when an SSL Context is created via CURL
+// used to configure the context for custom cert validation
+
+CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
+{	
+	LLURLRequest *req = (LLURLRequest *)param;
+	if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
+	{
+		SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL);
+		return CURLE_OK;
+	}
+	SSL_CTX * ctx = (SSL_CTX *) sslctx;
+	// disable any default verification for server certs
+	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
+	// set the verification callback.
+	SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
+	// the calls are void
+	return CURLE_OK;
+	
+}
 
 /**
  * class LLURLRequest
@@ -148,6 +185,11 @@ void LLURLRequest::setURL(const std::string& url)
 	mDetail->mURL = url;
 }
 
+std::string LLURLRequest::getURL() const
+{
+	return mDetail->mURL;
+}
+
 void LLURLRequest::addHeader(const char* header)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
@@ -160,12 +202,6 @@ void LLURLRequest::setBodyLimit(U32 size)
 	mDetail->mIsBodyLimitSet = true;
 }
 
-void LLURLRequest::checkRootCertificate(bool check)
-{
-	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE));
-	mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
-}
-
 void LLURLRequest::setCallback(LLURLRequestComplete* callback)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index cb3c466440..69fd22e592 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -44,6 +44,8 @@
 #include "lliopipe.h"
 #include "llchainio.h"
 #include "llerror.h"
+#include <openssl/x509_vfy.h>
+#include "llcurl.h"
 
 
 extern const std::string CONTEXT_REQUEST;
@@ -72,6 +74,8 @@ class LLURLRequest : public LLIOPipe
 {
 	LOG_CLASS(LLURLRequest);
 public:
+
+	typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
 	/** 
 	 * @brief This enumeration is for specifying the type of request.
 	 */
@@ -125,7 +129,7 @@ public:
 	 * 
 	 */
 	void setURL(const std::string& url);
-
+	std::string getURL() const;
 	/** 
 	 * @brief Add a header to the http post.
 	 *
@@ -143,8 +147,9 @@ public:
 	 * Set whether request will check that remote server
 	 * certificates are signed by a known root CA when using HTTPS.
 	 */
-	void checkRootCertificate(bool check);
+	void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
 
+	
 	/**
 	 * @brief Return at most size bytes of body.
 	 *
@@ -189,6 +194,7 @@ public:
 	 * @brief Give this pipe a chance to handle a generated error
 	 */
 	virtual EStatus handleError(EStatus status, LLPumpIO* pump);
+
 	
 protected:
 	/** 
@@ -217,6 +223,8 @@ protected:
 	 S32 mRequestTransferedBytes;
 	 S32 mResponseTransferedBytes;
 
+	static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
+	
 private:
 	/** 
 	 * @brief Initialize the object. Called during construction.
@@ -364,62 +372,6 @@ protected:
 };
 
 
-/** 
- * @class LLURLRequestClientFactory
- * @brief Template class to build url request based client chains 
- *
- * This class eases construction of a basic sd rpc client. Here is an
- * example of it's use:
- * <code>
- *  class LLUsefulService : public LLService { ... }<br>
- *  LLService::registerCreator(<br>
- *    "useful",<br>
- *    LLService::creator_t(new LLURLRequestClientFactory<LLUsefulService>))<br>
- * </code>
- *
- * This class should work, but I never got around to using/testing it.
- *
- */
-#if 0
-template<class Client>
-class LLURLRequestClientFactory : public LLChainIOFactory
-{
-public:
-	LLURLRequestClientFactory(LLURLRequest::ERequestAction action) {}
-	LLURLRequestClientFactory(
-		LLURLRequest::ERequestAction action,
-		const std::string& fixed_url) :
-		mAction(action),
-		mURL(fixed_url)
-	{
-	}
-	virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
-	{
-		lldebugs << "LLURLRequestClientFactory::build" << llendl;
-		LLIOPipe::ptr_t service(new Client);
-		chain.push_back(service);
-		LLURLRequest* http(new LLURLRequest(mAction));
-		LLIOPipe::ptr_t http_pipe(http);
-		// *FIX: how do we know the content type?
-		//http->addHeader("Content-Type: text/llsd");
-		if(mURL.empty())
-		{
-			chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
-		}
-		else
-		{
-			http->setURL(mURL);
-		}
-		chain.push_back(http_pipe);
-		chain.push_back(service);
-		return true;
-	}
-
-protected:
-	LLURLRequest::ERequestAction mAction;
-	std::string mURL;
-};
-#endif
 
 /**
  * External constants
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d1e33fa91a..187038ab15 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -621,6 +621,7 @@ bool LLAppViewer::init()
 
     initThreads();
     initializeSecHandler();
+	LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
     writeSystemInfo();
 
 	// Build a string representing the current version number.
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index 70c247c2de..26bdfd19da 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -36,6 +36,8 @@
 #include "llsechandler_basic.h"
 #include <openssl/evp.h>
 #include <map>
+#include "llhttpclient.h"
+
 
 
 std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap;
@@ -79,7 +81,42 @@ std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
 	return s << (std::string)cred;
 }
 
+	
+// secapiSSLCertVerifyCallback
+// basic callback called when a cert verification is requested.
+// calls SECAPI to validate the context
+// not initialized in the above initialization function, due to unit tests
+// see llappviewer
 
+int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
+{
+	LLURLRequest *req = (LLURLRequest *)param;
+	LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore("");
+	LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
+	LLSD validation_params = LLSD::emptyMap();
+	LLURI uri(req->getURL());
+	validation_params[CERT_HOSTNAME] = uri.hostName();
+	try
+	{
+		chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
+	}
+	catch (LLCertValidationTrustException& cert_exception)
+	{
+		LL_WARNS("AppInit") << "Cert not trusted: " << cert_exception.getMessage() << LL_ENDL;
+		return 0;		
+	}
+	catch (LLCertException& cert_exception)
+	{
+		LL_WARNS("AppInit") << "cert error " << cert_exception.getMessage() << LL_ENDL;
+		return 0;
+	}
+	catch (...)
+	{
+		LL_WARNS("AppInit") << "cert error " << LL_ENDL;
+		return 0;
+	}
+	return 1;
+}
 
 LLSD LLCredential::getLoginParams()
 {
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index 6fd12c044a..d3fb3c4c07 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -474,4 +474,8 @@ void registerSecHandler(const std::string& handler_type,
 
 extern LLPointer<LLSecAPIHandler> gSecAPIHandler;
 
+
+int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
+
+
 #endif // LL_SECAPI_H
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 118d7f8d08..ed70be7b9f 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -132,10 +132,11 @@ void LLWorld::destroyClass()
 LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 {
 	LLMemType mt(LLMemType::MTYPE_REGIONS);
-	
+	llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
 	LLViewerRegion *regionp = getRegionFromHandle(region_handle);
 	if (regionp)
 	{
+		llinfos << "Region exists, removing it " << llendl;
 		LLHost old_host = regionp->getHost();
 		// region already exists!
 		if (host == old_host && regionp->isAlive())
-- 
cgit v1.2.3


From b5f64f9a3f69990d584990b20957e5de9ed2d5b0 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Fri, 5 Feb 2010 01:37:36 -0800
Subject: Fix linux build

---
 indra/newview/llappviewerlinux.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index d34bcb4a68..78b0f7ba83 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -604,7 +604,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
 				{cmd.c_str(),
 				 ask_dialog,
 				 "-user",
-				 (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(),
+				 (char*)LLGridManager::getInstance()->getGridLabel().c_str(),
 				 "-name",
 				 LLAppViewer::instance()->getSecondLifeTitle().c_str(),
 				 NULL};
-- 
cgit v1.2.3


From 7ab41a8a815968e274ebbfc459328be40cf5479a Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Fri, 5 Feb 2010 15:59:14 -0800
Subject: transplant with 2517, also fix single username login issue

---
 indra/newview/llinventorymodel.cpp  | 11 ++++++++---
 indra/newview/llpanellogin.cpp      |  2 +-
 indra/newview/llsecapi.cpp          |  2 +-
 indra/newview/llviewerinventory.cpp | 13 ++++++++-----
 4 files changed, 18 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 711114173c..89f5ef026a 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1568,10 +1568,15 @@ void LLInventoryModel::bulkFetch(std::string url)
 				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
 				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
 				    
-				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
-					    body_lib["folders"].append(folder_sd);
-				    else
+				    if (gAgent.getID() == cat->getOwnerID())
+				    {
 					    body["folders"].append(folder_sd);
+				    }
+				    else
+				    {
+					    body_lib["folders"].append(folder_sd);
+				    }
+
 				    folder_count++;
 			    }
 			    if (sMyInventoryFetchStarted ||
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 7752750a31..906f091090 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -871,7 +871,7 @@ void LLPanelLogin::loadLoginPage()
 	curl_free(curl_version);
 
 	// Grid
-	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLabel().c_str(), 0);
+	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridID().c_str(), 0);
 	oStr << "&grid=" << curl_grid;
 	curl_free(curl_grid);
 	gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index 26bdfd19da..a928b4580e 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -131,7 +131,7 @@ LLSD LLCredential::getLoginParams()
 	}
 	else if (mIdentifier["type"].asString() == "account")
 	{
-		result["username"] = mIdentifier["username"];
+		result["username"] = mIdentifier["account_name"];
 		result["passwd"] = mAuthenticator["secret"];
                                     
 	}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 5605f425e0..df873f241e 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -35,7 +35,6 @@
 
 #include "llnotificationsutil.h"
 #include "message.h"
-#include "indra_constants.h"
 
 #include "llagent.h"
 #include "llviewerfoldertype.h"
@@ -242,10 +241,14 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 		// we have to check region. It can be null after region was destroyed. See EXT-245
 		if (region)
 		{
-			if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString())
-				url = region->getCapability("FetchLib");
-			else	
-				url = region->getCapability("FetchInventory");
+		  if(gAgent.getID() != mPermissions.getOwner())
+		    {
+		      url = region->getCapability("FetchLib");
+		    }
+		  else
+		    {	
+		      url = region->getCapability("FetchInventory");
+		    }
 		}
 		else
 		{
-- 
cgit v1.2.3


From 73e86b0bed548b2aaba8d92837e562d6d753808a Mon Sep 17 00:00:00 2001
From: Karen Lahey <karina@lindenlab.com>
Date: Thu, 15 Oct 2009 16:52:03 -0700
Subject: MAC Address Change no longer causes viewer to die cr:Roxie

---
 indra/llcommon/lluuid.cpp                          | 161 +++++++++++++--------
 indra/newview/llappviewer.cpp                      |  14 +-
 indra/newview/llsecapi.cpp                         |  22 +++
 indra/newview/llsecapi.h                           |  12 +-
 indra/newview/llsechandler_basic.cpp               |  30 ++--
 indra/newview/llsechandler_basic.h                 |   2 +
 .../newview/skins/default/xui/en/notifications.xml |  12 ++
 indra/newview/tests/llsechandler_basic_test.cpp    |   5 +
 8 files changed, 182 insertions(+), 76 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index bcbae06ec5..152223d524 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -36,6 +36,8 @@
 #	undef WIN32_LEAN_AND_MEAN
 #	include <winsock2.h>
 #	include <windows.h>
+#	pragma comment(lib, "IPHLPAPI.lib")
+#	include <iphlpapi.h>
 #endif
 
 #include "lldefs.h"
@@ -452,67 +454,104 @@ static void get_random_bytes(void *buf, int nbytes)
 	return;	
 }
 
-#if LL_WINDOWS
-typedef struct _ASTAT_
-{
-	ADAPTER_STATUS adapt;
-	NAME_BUFFER    NameBuff [30];
-}ASTAT, * PASTAT;
-
-// static
-S32 LLUUID::getNodeID(unsigned char * node_id)
-{
-	  ASTAT Adapter;
-      NCB Ncb;
-      UCHAR uRetCode;
-      LANA_ENUM   lenum;
-      int      i;
-	  int retval = 0;
-
-      memset( &Ncb, 0, sizeof(Ncb) );
-      Ncb.ncb_command = NCBENUM;
-      Ncb.ncb_buffer = (UCHAR *)&lenum;
-      Ncb.ncb_length = sizeof(lenum);
-      uRetCode = Netbios( &Ncb );
- //     printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
-
-      for(i=0; i < lenum.length ;i++)
-      {
-          memset( &Ncb, 0, sizeof(Ncb) );
-          Ncb.ncb_command = NCBRESET;
-          Ncb.ncb_lana_num = lenum.lana[i];
-
-          uRetCode = Netbios( &Ncb );
- //         printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
- //                 lenum.lana[i], uRetCode );
-
-          memset( &Ncb, 0, sizeof (Ncb) );
-          Ncb.ncb_command = NCBASTAT;
-          Ncb.ncb_lana_num = lenum.lana[i];
-
-          strcpy( (char *)Ncb.ncb_callname,  "*              " );		/* Flawfinder: ignore */
-          Ncb.ncb_buffer = (unsigned char *)&Adapter;
-          Ncb.ncb_length = sizeof(Adapter);
-
-          uRetCode = Netbios( &Ncb );
-//          printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
-//                 lenum.lana[i], uRetCode );
-          if ( uRetCode == 0 )
-          {
-//            printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
-//	 			  lenum.lana[i],
-//                  Adapter.adapt.adapter_address[0],
-//                  Adapter.adapt.adapter_address[1],
-//                  Adapter.adapt.adapter_address[2],
-//                  Adapter.adapt.adapter_address[3],
-//                  Adapter.adapt.adapter_address[4],
-//                  Adapter.adapt.adapter_address[5] );
-			memcpy(node_id,Adapter.adapt.adapter_address,6);		/* Flawfinder: ignore */
-			retval = 1;
-
-          }
-	  }
-	return retval;
+#if	LL_WINDOWS
+// Code	copied from	http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
+// This	code grabs the first hardware	address, rather	than the first interface.
+// Using a VPN can cause the first returned	interface	to be	changed.
+
+#define	MALLOC(x)HeapAlloc(GetProcessHeap(),0,(x))
+#define	FREE(x)	HeapFree(GetProcessHeap(),0,(x))
+const	S32	MAC_ADDRESS_BYTES=6;
+
+
+// static
+S32	LLUUID::getNodeID(unsigned char	*node_id)
+{
+
+	// Declare and initialize variables.
+	DWORD	dwSize = 0;
+	DWORD	dwRetVal = 0;
+	int	i;
+
+/* variables used	for	GetIfTable and GetIfEntry	*/
+	MIB_IFTABLE	*pIfTable;
+	MIB_IFROW	*pIfRow;
+
+	// Allocate	memory for our pointers.
+	pIfTable = (MIB_IFTABLE	*) MALLOC(sizeof (MIB_IFTABLE));
+	if (pIfTable ==	NULL)	
+	{
+			printf("Error allocating memory needed to call GetIfTable\n");
+			return 0;
+	}
+
+	// Before	calling	GetIfEntry,	we call	GetIfTable to	make
+	// sure	there	are	entries	to get and retrieve	the	interface	index.
+
+	// Make	an initial call	to GetIfTable	to get the
+	// necessary size	into dwSize
+	if (GetIfTable(pIfTable, &dwSize,	0) ==	ERROR_INSUFFICIENT_BUFFER) {
+			FREE(pIfTable);
+			pIfTable = (MIB_IFTABLE	*) MALLOC(dwSize);
+			if (pIfTable ==	NULL)	
+			{
+					printf("Error	allocating memory\n");
+					return 0;
+			}
+	}
+	//	Make a second	call to	GetIfTable to	get	the	actual
+	// data	we want.
+	if ((dwRetVal = GetIfTable(pIfTable, &dwSize,	0))	== NO_ERROR) 
+	{
+		if (pIfTable->dwNumEntries > 0)	
+		{
+			pIfRow = (MIB_IFROW	*) MALLOC(sizeof (MIB_IFROW));
+			if (pIfRow ==	NULL)	
+			{
+					printf("Error allocating memory\n");
+					if (pIfTable != NULL)	
+					{
+						FREE(pIfTable);
+						pIfTable = NULL;
+					}
+					return 0;
+			}
+
+			int	limit	=	MAC_ADDRESS_BYTES;
+			memcpy(node_id,	"\0\0\0\0\0\0",	limit);	// zero	out	array	of bytes	 
+			for	(i = 0;	i < (int) pIfTable->dwNumEntries; i++) 
+			{
+				pIfRow->dwIndex	= pIfTable->table[i].dwIndex;
+				if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR) 
+				{
+					switch (pIfRow->dwType)	
+					{
+						case IF_TYPE_ETHERNET_CSMACD:
+						case IF_TYPE_IEEE80211:		 
+							 limit = min((int) pIfRow->dwPhysAddrLen, limit);
+							 if	(pIfRow->dwPhysAddrLen == 0)
+									 break;
+							 memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit);		 //	just incase	the	PhysAddr is	not	the	expected MAC_Address size
+							 FREE(pIfTable);
+							 return 1;	//return first hardware	device found.	
+							break;
+
+						case IF_TYPE_OTHER:
+						case IF_TYPE_PPP:										 
+						case IF_TYPE_SOFTWARE_LOOPBACK:										 
+						case IF_TYPE_ISO88025_TOKENRING:										
+						case IF_TYPE_IEEE1394:																		
+						case IF_TYPE_ATM:										 
+						case IF_TYPE_TUNNEL:										
+								default:
+									break;
+					}
+				}
+			}
+		}
+	}
+	FREE(pIfTable);
+	return 0;
 }
 
 #elif LL_DARWIN
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 187038ab15..c2f8487aa9 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -620,8 +620,6 @@ bool LLAppViewer::init()
     LLCurl::initClass();
 
     initThreads();
-    initializeSecHandler();
-	LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
     writeSystemInfo();
 
 	// Build a string representing the current version number.
@@ -862,6 +860,7 @@ bool LLAppViewer::init()
 		}
 	}
 
+
 	// save the graphics card
 	gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
 
@@ -872,6 +871,17 @@ bool LLAppViewer::init()
 	gSimFrames = (F32)gFrameCount;
 
 	LLViewerJoystick::getInstance()->init(false);
+
+	try {
+		initializeSecHandler();
+	}
+	catch (LLProtectedDataException ex)
+	{
+	  LLNotificationsUtil::add("CorruptedProtectedDataStore");
+	}
+	LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
+
+
 	gGLActive = FALSE;
 	if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
 	{
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
index a928b4580e..ba343f5387 100644
--- a/indra/newview/llsecapi.cpp
+++ b/indra/newview/llsecapi.cpp
@@ -50,11 +50,33 @@ void initializeSecHandler()
 	OpenSSL_add_all_digests();	
 	gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
 	
+	
 	// Currently, we only have the Basic handler, so we can point the main sechandler
 	// pointer to the basic handler.  Later, we'll create a wrapper handler that
 	// selects the appropriate sechandler as needed, for instance choosing the
 	// mac keyring handler, with fallback to the basic sechandler
 	gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
+
+	// initialize all SecAPIHandlers
+	LLProtectedDataException ex = LLProtectedDataException("");
+	std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
+	for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
+	{
+		LLPointer<LLSecAPIHandler> handler = (*itr).second;
+		try 
+		{
+			handler->init();
+		}
+		catch (LLProtectedDataException e)
+		{
+			ex = e;
+		}
+	}
+	if (ex.getMessage().length() > 0 )  // an exception was thrown.
+	{
+		throw ex;
+	}
+
 }
 // start using a given security api handler.  If the string is empty
 // the default is used
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index d3fb3c4c07..b11563ef62 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -47,7 +47,7 @@
 #define CERT_ISSUER_NAME "issuer_name"
 #define CERT_NAME_CN "commonName"
 		
-#define  CERT_SUBJECT_NAME_STRING "subject_name_string"
+#define CERT_SUBJECT_NAME_STRING "subject_name_string"
 #define CERT_ISSUER_NAME_STRING "issuer_name_string"
 		
 #define CERT_SERIAL_NUMBER "serial_number"
@@ -118,9 +118,10 @@ class LLProtectedDataException
 public:
 	LLProtectedDataException(const char *msg) 
 	{
-		llerrs << "Certificate Error: " << msg << llendl;
-		mMsg = std::string(msg);
+		LL_WARNS("SECAPI") << "Protected Data Error: " << (std::string)msg << LL_ENDL;
+		mMsg = (std::string)msg;
 	}
+	std::string getMessage() { return mMsg; }
 protected:
 	std::string mMsg;
 };
@@ -421,13 +422,18 @@ class LLSecAPIHandler : public LLRefCount
 {
 public:
 	
+	
 	LLSecAPIHandler() {}
 	virtual ~LLSecAPIHandler() {}
 	
+	// initialize the SecAPIHandler
+	virtual void init() {};
+	
 	// instantiate a certificate from a pem string
 	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
 	
 	
+	
 	// instiate a certificate from an openssl X509 structure
 	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
 	
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 097cc395d7..1453506b0d 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1028,20 +1028,29 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_fil
 	mProtectedDataFilename = protected_data_file;
 	mProtectedDataMap = LLSD::emptyMap();
 	mLegacyPasswordPath = legacy_password_path;
-	_readProtectedData();
+
 }
 
 LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 {
-	mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-															"bin_conf.dat");
-	mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
+}
 
+
+void LLSecAPIBasicHandler::init()
+{
+	if (mProtectedDataFilename.length() == 0)
+	{
+		mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+															"bin_conf.dat");
+	}
+	if (mLegacyPasswordPath.length() == 0)
+	{
+		mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
+	}
 	mProtectedDataMap = LLSD::emptyMap();
 	
 	mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
 															"bin_conf.dat");	
-	_readProtectedData();
 
 	std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
 															"CA.pem");
@@ -1051,8 +1060,6 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 	// will reduce that risk.
 	// by using a user file, modifications will be limited to one user if
 	// we read-only the main file
-
-
 	if (!LLFile::isfile(store_file))
 	{
 
@@ -1071,8 +1078,9 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 	}
 	LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
 	mStore = new LLBasicCertificateStore(store_file);
+	_readProtectedData(); // initialize mProtectedDataMap
+						  // may throw LLProtectedDataException if saved datamap is not decryptable
 }
-
 LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
 {
 	_writeProtectedData();
@@ -1084,6 +1092,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
 	LLPointer<LLSDParser> parser = new LLSDXMLParser();
 	llifstream protected_data_stream(mProtectedDataFilename.c_str(), 
 									llifstream::binary);
+
 	if (!protected_data_stream.fail()) {
 		int offset;
 		U8 salt[STORE_SALT_SIZE];
@@ -1099,7 +1108,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
 		offset = 0;
 		if (protected_data_stream.gcount() < STORE_SALT_SIZE)
 		{
-			throw LLProtectedDataException("Corrupt Protected Data Store1");
+			throw LLProtectedDataException("Config file too short.");
 		}
 
 		cipher.decrypt(salt, STORE_SALT_SIZE);		
@@ -1139,7 +1148,7 @@ void LLSecAPIBasicHandler::_readProtectedData()
 		if (parser->parse(parse_stream, mProtectedDataMap, 
 						  LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
 		{
-			throw LLProtectedDataException("Corrupt Protected Data Store");
+			throw LLProtectedDataException("Config file cannot be decrypted.");
 		}
 	}
 }
@@ -1254,6 +1263,7 @@ LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const st
 LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
 											const std::string& data_id)
 {
+
 	if (mProtectedDataMap.has(data_type) && 
 		mProtectedDataMap[data_type].isMap() && 
 		mProtectedDataMap[data_type].has(data_id))
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
index e041322260..4bbb73f062 100644
--- a/indra/newview/llsechandler_basic.h
+++ b/indra/newview/llsechandler_basic.h
@@ -221,6 +221,8 @@ public:
 						 const std::string& legacy_password_path);
 	LLSecAPIBasicHandler();
 	
+	void init();
+	
 	virtual ~LLSecAPIBasicHandler();
 	
 	// instantiate a certificate from a pem string
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index d177cfce7d..333f5d3d2a 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1356,6 +1356,18 @@ Unknown Vorbis encode failure on: [FILE]
 Unable to encode file: [FILE]
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="CorruptedProtectedDataStore"
+   type="alertmodal">
+  We are unable to read your protected data so it is being reset.
+   This may happen when you change network setup.
+
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
+    
   <notification
    icon="alertmodal.tga"
    name="CorruptResourceFile"
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
index f52ebc198d..3e4e8c5b3e 100644
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -340,6 +340,7 @@ namespace tut
 
 		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
 																		   "test_password.dat");
+		handler.init();																		
 		// data retrieval for existing data
 		LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
 
@@ -397,6 +398,7 @@ namespace tut
 		// cause a 'write' by using 'LLPointer' to delete then instantiate a handler
 		handler = NULL;
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		handler.init();
 
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
@@ -411,6 +413,7 @@ namespace tut
 		
 		// cause a 'write'
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		handler.init();		
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure("not found", data.isUndefined());
 		
@@ -419,6 +422,7 @@ namespace tut
 		
 		LLFile::remove("sechandler_settings.tmp");
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		handler.init();		
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure("not found", data.isUndefined());
 		handler = NULL;
@@ -431,6 +435,7 @@ namespace tut
 	void sechandler_basic_test_object::test<3>()
 	{
 		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
+		handler.init();
 
 		LLSD my_id = LLSD::emptyMap();
 		LLSD my_authenticator = LLSD::emptyMap();
-- 
cgit v1.2.3


From b90c7d648e258ebe4cad4f7b026147e50304edca Mon Sep 17 00:00:00 2001
From: Karen Lahey <karina@lindenlab.com>
Date: Thu, 15 Oct 2009 19:40:20 -0700
Subject: Use malloc in order to fix linking issue

---
 indra/llcommon/lluuid.cpp | 1776 ++++++++++++++++++++++-----------------------
 1 file changed, 887 insertions(+), 889 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 152223d524..f87c00e38f 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -1,466 +1,464 @@
-/** 
- * @file lluuid.cpp
- *
- * $LicenseInfo:firstyear=2000&license=viewergpl$
- * 
- * Copyright (c) 2000-2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
-#if LL_WINDOWS
-#	undef WIN32_LEAN_AND_MEAN
-#	include <winsock2.h>
-#	include <windows.h>
+/** 
+ * @file lluuid.cpp
+ *
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
+#if LL_WINDOWS
+#	undef WIN32_LEAN_AND_MEAN
+#	include <winsock2.h>
+#	include <windows.h>
 #	pragma comment(lib, "IPHLPAPI.lib")
-#	include <iphlpapi.h>
-#endif
-
-#include "lldefs.h"
-#include "llerror.h"
-
-#include "lluuid.h"
-#include "llerror.h"
-#include "llrand.h"
-#include "llmd5.h"
-#include "llstring.h"
-#include "lltimer.h"
-
-const LLUUID LLUUID::null;
-const LLTransactionID LLTransactionID::tnull;
-
-/*
-
-NOT DONE YET!!!
-
-static char BASE85_TABLE[] = {
-	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
-	'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
-	'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
-	'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
-	'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
-	'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*',
-	'+', '-', ';', '[', '=', '>', '?', '@', '^', '_',
-	'`', '{', '|', '}', '~', '\0'
-};
-
-
-void encode( char * fiveChars, unsigned int word ) throw( )
-{
-for( int ix = 0; ix < 5; ++ix ) {
-fiveChars[4-ix] = encodeTable[ word % 85];
-word /= 85;
-}
-}
-
-To decode:
-unsigned int decode( char const * fiveChars ) throw( bad_input_data )
-{
-unsigned int ret = 0;
-for( int ix = 0; ix < 5; ++ix ) {
-char * s = strchr( encodeTable, fiveChars[ ix ] );
-if( s == 0 ) throw bad_input_data();
-ret = ret * 85 + (s-encodeTable);
-}
-return ret;
-}
-
-void LLUUID::toBase85(char* out)
-{
-	U32* me = (U32*)&(mData[0]);
-	for(S32 i = 0; i < 4; ++i)
-	{
-		char* o = &out[i*i];
-		for(S32 j = 0; j < 5; ++j)
-		{
-			o[4-j] = BASE85_TABLE[ me[i] % 85];
-			word /= 85;
-		}
-	}
-}
-
-unsigned int decode( char const * fiveChars ) throw( bad_input_data )
-{
-	unsigned int ret = 0;
-	for( S32 ix = 0; ix < 5; ++ix )
-	{
-		char * s = strchr( encodeTable, fiveChars[ ix ] );
-		ret = ret * 85 + (s-encodeTable);
-	}
-	return ret;
-} 
-*/
-
-#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-/**
- * @brief a global for
- */
-static U64 sJankyRandomSeed(LLUUID::getRandomSeed());
-
-/**
- * @brief generate a random U32.
- */
-U32 janky_fast_random_bytes()
-{
-	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
-	return (U32)sJankyRandomSeed;
-}
-
-/**
- * @brief generate a random U32 from [0, val)
- */
-U32 janky_fast_random_byes_range(U32 val)
-{
-	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
-	return (U32)(sJankyRandomSeed) % val; 
-}
-
-/**
- * @brief generate a random U32 from [0, val)
- */
-U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
-{
-	seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); 
-	return (U32)(seed) % val; 
-}
-#endif
-
-// Common to all UUID implementations
-void LLUUID::toString(std::string& out) const
-{
-	out = llformat(
-		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-		(U8)(mData[0]),
-		(U8)(mData[1]),
-		(U8)(mData[2]),
-		(U8)(mData[3]),
-		(U8)(mData[4]),
-		(U8)(mData[5]),
-		(U8)(mData[6]),
-		(U8)(mData[7]),
-		(U8)(mData[8]),
-		(U8)(mData[9]),
-		(U8)(mData[10]),
-		(U8)(mData[11]),
-		(U8)(mData[12]),
-		(U8)(mData[13]),
-		(U8)(mData[14]),
-		(U8)(mData[15]));
-}
-
-// *TODO: deprecate
-void LLUUID::toString(char *out) const
-{
-	std::string buffer;
-	toString(buffer);
-	strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
-}
-
-void LLUUID::toCompressedString(std::string& out) const
-{
-	char bytes[UUID_BYTES+1];
-	memcpy(bytes, mData, UUID_BYTES);		/* Flawfinder: ignore */
-	bytes[UUID_BYTES] = '\0';
-	out.assign(bytes, UUID_BYTES);
-}
-
-// *TODO: deprecate
-void LLUUID::toCompressedString(char *out) const
-{
-	memcpy(out, mData, UUID_BYTES);		/* Flawfinder: ignore */
-	out[UUID_BYTES] = '\0';
-}
-
-std::string LLUUID::getString() const
-{
-	return asString();
-}
-
-std::string LLUUID::asString() const
-{
-	std::string str;
-	toString(str);
-	return str;
-}
-
-BOOL LLUUID::set(const char* in_string, BOOL emit)
-{
-	return set(ll_safe_string(in_string),emit);
-}
-
-BOOL LLUUID::set(const std::string& in_string, BOOL emit)
-{
-	BOOL broken_format = FALSE;
-
-	// empty strings should make NULL uuid
-	if (in_string.empty())
-	{
-		setNull();
-		return TRUE;
-	}
-
-	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
-	{
-		// I'm a moron.  First implementation didn't have the right UUID format.
-		// Shouldn't see any of these any more
-		if (in_string.length() == (UUID_STR_LENGTH - 2))	/* Flawfinder: ignore */
-		{
-			if(emit)
-			{
-				llwarns << "Warning! Using broken UUID string format" << llendl;
-			}
-			broken_format = TRUE;
-		}
-		else
-		{
-			// Bad UUID string.  Spam as INFO, as most cases we don't care.
-			if(emit)
-			{
-				//don't spam the logs because a resident can't spell.
-				llwarns << "Bad UUID string: " << in_string << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-	}
-
-	U8 cur_pos = 0;
-	S32 i;
-	for (i = 0; i < UUID_BYTES; i++)
-	{
-		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
-		{
-			cur_pos++;
-			if (broken_format && (i==10))
-			{
-				// Missing - in the broken format
-				cur_pos--;
-			}
-		}
-
-		mData[i] = 0;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-			mData[i] += (U8)(in_string[cur_pos] - '0');
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
-		}
-		else
-		{
-			if(emit)
-			{							
-				llwarns << "Invalid UUID string character" << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-
-		mData[i] = mData[i] << 4;
-		cur_pos++;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-			mData[i] += (U8)(in_string[cur_pos] - '0');
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
-		}
-		else
-		{
-			if(emit)
-			{
-				llwarns << "Invalid UUID string character" << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-		cur_pos++;
-	}
-
-	return TRUE;
-}
-
-BOOL LLUUID::validate(const std::string& in_string)
-{
-	BOOL broken_format = FALSE;
-	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
-	{
-		// I'm a moron.  First implementation didn't have the right UUID format.
-		if (in_string.length() == (UUID_STR_LENGTH - 2))		/* Flawfinder: ignore */
-		{
-			broken_format = TRUE;
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-
-	U8 cur_pos = 0;
-	for (U32 i = 0; i < 16; i++)
-	{
-		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
-		{
-			cur_pos++;
-			if (broken_format && (i==10))
-			{
-				// Missing - in the broken format
-				cur_pos--;
-			}
-		}
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-		}
-		else
-		{
-			return FALSE;
-		}
-
-		cur_pos++;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-		}
-		else
-		{
-			return FALSE;
-		}
-		cur_pos++;
-	}
-	return TRUE;
-}
-
-const LLUUID& LLUUID::operator^=(const LLUUID& rhs)
-{
-	U32* me = (U32*)&(mData[0]);
-	const U32* other = (U32*)&(rhs.mData[0]);
-	for(S32 i = 0; i < 4; ++i)
-	{
-		me[i] = me[i] ^ other[i];
-	}
-	return *this;
-}
-
-LLUUID LLUUID::operator^(const LLUUID& rhs) const
-{
-	LLUUID id(*this);
-	id ^= rhs;
-	return id;
-}
-
-void LLUUID::combine(const LLUUID& other, LLUUID& result) const
-{
-	LLMD5 md5_uuid;
-	md5_uuid.update((unsigned char*)mData, 16);
-	md5_uuid.update((unsigned char*)other.mData, 16);
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(result.mData);
-}
-
-LLUUID LLUUID::combine(const LLUUID &other) const
-{
-	LLUUID combination;
-	combine(other, combination);
-	return combination;
-}
-
-std::ostream& operator<<(std::ostream& s, const LLUUID &uuid)
-{
-	std::string uuid_str;
-	uuid.toString(uuid_str);
-	s << uuid_str;
-	return s;
-}
-
-std::istream& operator>>(std::istream &s, LLUUID &uuid)
-{
-	U32 i;
-	char uuid_str[UUID_STR_LENGTH];		/* Flawfinder: ignore */
-	for (i = 0; i < UUID_STR_LENGTH-1; i++)
-	{
-		s >> uuid_str[i];
-	}
-	uuid_str[i] = '\0';
-	uuid.set(std::string(uuid_str));
-	return s;
-}
-
-static void get_random_bytes(void *buf, int nbytes)
-{
-	int i;
-	char *cp = (char *) buf;
-
-	// *NOTE: If we are not using the janky generator ll_rand()
-	// generates at least 3 good bytes of data since it is 0 to
-	// RAND_MAX. This could be made more efficient by copying all the
-	// bytes.
-	for (i=0; i < nbytes; i++)
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		*cp++ = janky_fast_random_bytes() & 0xFF;
-#else
-		*cp++ = ll_rand() & 0xFF;
-#endif
-	return;	
-}
-
+#	include <iphlpapi.h>
+#endif
+
+#include "lldefs.h"
+#include "llerror.h"
+
+#include "lluuid.h"
+#include "llerror.h"
+#include "llrand.h"
+#include "llmd5.h"
+#include "llstring.h"
+#include "lltimer.h"
+
+const LLUUID LLUUID::null;
+const LLTransactionID LLTransactionID::tnull;
+
+/*
+
+NOT DONE YET!!!
+
+static char BASE85_TABLE[] = {
+	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+	'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+	'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
+	'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+	'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
+	'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*',
+	'+', '-', ';', '[', '=', '>', '?', '@', '^', '_',
+	'`', '{', '|', '}', '~', '\0'
+};
+
+
+void encode( char * fiveChars, unsigned int word ) throw( )
+{
+for( int ix = 0; ix < 5; ++ix ) {
+fiveChars[4-ix] = encodeTable[ word % 85];
+word /= 85;
+}
+}
+
+To decode:
+unsigned int decode( char const * fiveChars ) throw( bad_input_data )
+{
+unsigned int ret = 0;
+for( int ix = 0; ix < 5; ++ix ) {
+char * s = strchr( encodeTable, fiveChars[ ix ] );
+if( s == 0 ) throw bad_input_data();
+ret = ret * 85 + (s-encodeTable);
+}
+return ret;
+}
+
+void LLUUID::toBase85(char* out)
+{
+	U32* me = (U32*)&(mData[0]);
+	for(S32 i = 0; i < 4; ++i)
+	{
+		char* o = &out[i*i];
+		for(S32 j = 0; j < 5; ++j)
+		{
+			o[4-j] = BASE85_TABLE[ me[i] % 85];
+			word /= 85;
+		}
+	}
+}
+
+unsigned int decode( char const * fiveChars ) throw( bad_input_data )
+{
+	unsigned int ret = 0;
+	for( S32 ix = 0; ix < 5; ++ix )
+	{
+		char * s = strchr( encodeTable, fiveChars[ ix ] );
+		ret = ret * 85 + (s-encodeTable);
+	}
+	return ret;
+} 
+*/
+
+#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+/**
+ * @brief a global for
+ */
+static U64 sJankyRandomSeed(LLUUID::getRandomSeed());
+
+/**
+ * @brief generate a random U32.
+ */
+U32 janky_fast_random_bytes()
+{
+	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
+	return (U32)sJankyRandomSeed;
+}
+
+/**
+ * @brief generate a random U32 from [0, val)
+ */
+U32 janky_fast_random_byes_range(U32 val)
+{
+	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
+	return (U32)(sJankyRandomSeed) % val; 
+}
+
+/**
+ * @brief generate a random U32 from [0, val)
+ */
+U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
+{
+	seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); 
+	return (U32)(seed) % val; 
+}
+#endif
+
+// Common to all UUID implementations
+void LLUUID::toString(std::string& out) const
+{
+	out = llformat(
+		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		(U8)(mData[0]),
+		(U8)(mData[1]),
+		(U8)(mData[2]),
+		(U8)(mData[3]),
+		(U8)(mData[4]),
+		(U8)(mData[5]),
+		(U8)(mData[6]),
+		(U8)(mData[7]),
+		(U8)(mData[8]),
+		(U8)(mData[9]),
+		(U8)(mData[10]),
+		(U8)(mData[11]),
+		(U8)(mData[12]),
+		(U8)(mData[13]),
+		(U8)(mData[14]),
+		(U8)(mData[15]));
+}
+
+// *TODO: deprecate
+void LLUUID::toString(char *out) const
+{
+	std::string buffer;
+	toString(buffer);
+	strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
+}
+
+void LLUUID::toCompressedString(std::string& out) const
+{
+	char bytes[UUID_BYTES+1];
+	memcpy(bytes, mData, UUID_BYTES);		/* Flawfinder: ignore */
+	bytes[UUID_BYTES] = '\0';
+	out.assign(bytes, UUID_BYTES);
+}
+
+// *TODO: deprecate
+void LLUUID::toCompressedString(char *out) const
+{
+	memcpy(out, mData, UUID_BYTES);		/* Flawfinder: ignore */
+	out[UUID_BYTES] = '\0';
+}
+
+std::string LLUUID::getString() const
+{
+	return asString();
+}
+
+std::string LLUUID::asString() const
+{
+	std::string str;
+	toString(str);
+	return str;
+}
+
+BOOL LLUUID::set(const char* in_string, BOOL emit)
+{
+	return set(ll_safe_string(in_string),emit);
+}
+
+BOOL LLUUID::set(const std::string& in_string, BOOL emit)
+{
+	BOOL broken_format = FALSE;
+
+	// empty strings should make NULL uuid
+	if (in_string.empty())
+	{
+		setNull();
+		return TRUE;
+	}
+
+	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
+	{
+		// I'm a moron.  First implementation didn't have the right UUID format.
+		// Shouldn't see any of these any more
+		if (in_string.length() == (UUID_STR_LENGTH - 2))	/* Flawfinder: ignore */
+		{
+			if(emit)
+			{
+				llwarns << "Warning! Using broken UUID string format" << llendl;
+			}
+			broken_format = TRUE;
+		}
+		else
+		{
+			// Bad UUID string.  Spam as INFO, as most cases we don't care.
+			if(emit)
+			{
+				//don't spam the logs because a resident can't spell.
+				llwarns << "Bad UUID string: " << in_string << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+	}
+
+	U8 cur_pos = 0;
+	S32 i;
+	for (i = 0; i < UUID_BYTES; i++)
+	{
+		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
+		{
+			cur_pos++;
+			if (broken_format && (i==10))
+			{
+				// Missing - in the broken format
+				cur_pos--;
+			}
+		}
+
+		mData[i] = 0;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+			mData[i] += (U8)(in_string[cur_pos] - '0');
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
+		}
+		else
+		{
+			if(emit)
+			{							
+				llwarns << "Invalid UUID string character" << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+
+		mData[i] = mData[i] << 4;
+		cur_pos++;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+			mData[i] += (U8)(in_string[cur_pos] - '0');
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
+		}
+		else
+		{
+			if(emit)
+			{
+				llwarns << "Invalid UUID string character" << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+		cur_pos++;
+	}
+
+	return TRUE;
+}
+
+BOOL LLUUID::validate(const std::string& in_string)
+{
+	BOOL broken_format = FALSE;
+	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
+	{
+		// I'm a moron.  First implementation didn't have the right UUID format.
+		if (in_string.length() == (UUID_STR_LENGTH - 2))		/* Flawfinder: ignore */
+		{
+			broken_format = TRUE;
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+
+	U8 cur_pos = 0;
+	for (U32 i = 0; i < 16; i++)
+	{
+		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
+		{
+			cur_pos++;
+			if (broken_format && (i==10))
+			{
+				// Missing - in the broken format
+				cur_pos--;
+			}
+		}
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+		}
+		else
+		{
+			return FALSE;
+		}
+
+		cur_pos++;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+		}
+		else
+		{
+			return FALSE;
+		}
+		cur_pos++;
+	}
+	return TRUE;
+}
+
+const LLUUID& LLUUID::operator^=(const LLUUID& rhs)
+{
+	U32* me = (U32*)&(mData[0]);
+	const U32* other = (U32*)&(rhs.mData[0]);
+	for(S32 i = 0; i < 4; ++i)
+	{
+		me[i] = me[i] ^ other[i];
+	}
+	return *this;
+}
+
+LLUUID LLUUID::operator^(const LLUUID& rhs) const
+{
+	LLUUID id(*this);
+	id ^= rhs;
+	return id;
+}
+
+void LLUUID::combine(const LLUUID& other, LLUUID& result) const
+{
+	LLMD5 md5_uuid;
+	md5_uuid.update((unsigned char*)mData, 16);
+	md5_uuid.update((unsigned char*)other.mData, 16);
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(result.mData);
+}
+
+LLUUID LLUUID::combine(const LLUUID &other) const
+{
+	LLUUID combination;
+	combine(other, combination);
+	return combination;
+}
+
+std::ostream& operator<<(std::ostream& s, const LLUUID &uuid)
+{
+	std::string uuid_str;
+	uuid.toString(uuid_str);
+	s << uuid_str;
+	return s;
+}
+
+std::istream& operator>>(std::istream &s, LLUUID &uuid)
+{
+	U32 i;
+	char uuid_str[UUID_STR_LENGTH];		/* Flawfinder: ignore */
+	for (i = 0; i < UUID_STR_LENGTH-1; i++)
+	{
+		s >> uuid_str[i];
+	}
+	uuid_str[i] = '\0';
+	uuid.set(std::string(uuid_str));
+	return s;
+}
+
+static void get_random_bytes(void *buf, int nbytes)
+{
+	int i;
+	char *cp = (char *) buf;
+
+	// *NOTE: If we are not using the janky generator ll_rand()
+	// generates at least 3 good bytes of data since it is 0 to
+	// RAND_MAX. This could be made more efficient by copying all the
+	// bytes.
+	for (i=0; i < nbytes; i++)
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		*cp++ = janky_fast_random_bytes() & 0xFF;
+#else
+		*cp++ = ll_rand() & 0xFF;
+#endif
+	return;	
+}
+
 #if	LL_WINDOWS
 // Code	copied from	http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
 // This	code grabs the first hardware	address, rather	than the first interface.
 // Using a VPN can cause the first returned	interface	to be	changed.
 
-#define	MALLOC(x)HeapAlloc(GetProcessHeap(),0,(x))
-#define	FREE(x)	HeapFree(GetProcessHeap(),0,(x))
 const	S32	MAC_ADDRESS_BYTES=6;
 
 
@@ -478,7 +476,7 @@ S32	LLUUID::getNodeID(unsigned char	*node_id)
 	MIB_IFROW	*pIfRow;
 
 	// Allocate	memory for our pointers.
-	pIfTable = (MIB_IFTABLE	*) MALLOC(sizeof (MIB_IFTABLE));
+	pIfTable = (MIB_IFTABLE	*) malloc(sizeof (MIB_IFTABLE));
 	if (pIfTable ==	NULL)	
 	{
 			printf("Error allocating memory needed to call GetIfTable\n");
@@ -491,8 +489,8 @@ S32	LLUUID::getNodeID(unsigned char	*node_id)
 	// Make	an initial call	to GetIfTable	to get the
 	// necessary size	into dwSize
 	if (GetIfTable(pIfTable, &dwSize,	0) ==	ERROR_INSUFFICIENT_BUFFER) {
-			FREE(pIfTable);
-			pIfTable = (MIB_IFTABLE	*) MALLOC(dwSize);
+			free(pIfTable);
+			pIfTable = (MIB_IFTABLE	*) malloc(dwSize);
 			if (pIfTable ==	NULL)	
 			{
 					printf("Error	allocating memory\n");
@@ -505,13 +503,13 @@ S32	LLUUID::getNodeID(unsigned char	*node_id)
 	{
 		if (pIfTable->dwNumEntries > 0)	
 		{
-			pIfRow = (MIB_IFROW	*) MALLOC(sizeof (MIB_IFROW));
+			pIfRow = (MIB_IFROW	*) malloc(sizeof (MIB_IFROW));
 			if (pIfRow ==	NULL)	
 			{
 					printf("Error allocating memory\n");
 					if (pIfTable != NULL)	
 					{
-						FREE(pIfTable);
+						free(pIfTable);
 						pIfTable = NULL;
 					}
 					return 0;
@@ -532,7 +530,7 @@ S32	LLUUID::getNodeID(unsigned char	*node_id)
 							 if	(pIfRow->dwPhysAddrLen == 0)
 									 break;
 							 memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit);		 //	just incase	the	PhysAddr is	not	the	expected MAC_Address size
-							 FREE(pIfTable);
+							 free(pIfTable);
 							 return 1;	//return first hardware	device found.	
 							break;
 
@@ -550,430 +548,430 @@ S32	LLUUID::getNodeID(unsigned char	*node_id)
 			}
 		}
 	}
-	FREE(pIfTable);
+	free(pIfTable);
+	return 0;
+}
+
+#elif LL_DARWIN
+// Mac OS X version of the UUID generation code...
+/*
+ * Get an ethernet hardware address, if we can find it...
+ */
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/if_dl.h>
+#include <net/route.h>
+#include <ifaddrs.h>
+
+// static
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+	int i;
+	unsigned char 	*a = NULL;
+	struct ifaddrs *ifap, *ifa;
+	int rv;
+	S32 result = 0;
+
+	if ((rv=getifaddrs(&ifap))==-1)
+	{       
+		return -1;
+	}
+	if (ifap == NULL)
+	{
+		return -1;
+	}
+
+	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next)
+	{       
+//		printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family);
+		for(i=0; i< ifa->ifa_addr->sa_len; i++)
+		{
+//			printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]);
+		}
+//		printf("\n");
+		
+		if(ifa->ifa_addr->sa_family == AF_LINK)
+		{
+			// This is a link-level address
+			struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr;
+			
+//			printf("\tLink level address, type %02X\n", lla->sdl_type);
+
+			if(lla->sdl_type == IFT_ETHER)
+			{
+				// Use the first ethernet MAC in the list.
+				// For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly.  This is what it would do.
+				a = (unsigned char *)&((lla)->sdl_data);
+				a += (lla)->sdl_nlen;
+				
+				if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+				{
+					continue;
+				}
+
+				if (node_id) 
+				{
+					memcpy(node_id, a, 6);
+					result = 1;
+				}
+				
+				// We found one.
+				break;
+			}
+		}
+	}
+	freeifaddrs(ifap);
+
+	return result;
+}
+
+#else
+
+// Linux version of the UUID generation code...
+/*
+ * Get the ethernet hardware address, if we can find it...
+ */
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#define HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#if LL_SOLARIS
+#include <sys/sockio.h>
+#elif !LL_DARWIN
+#include <linux/sockios.h>
+#endif
+#endif
+
+// static
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+	int 		sd;
+	struct ifreq 	ifr, *ifrp;
+	struct ifconf 	ifc;
+	char buf[1024];
+	int		n, i;
+	unsigned char 	*a;
+	
+/*
+ * BSD 4.4 defines the size of an ifreq to be
+ * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
+ * However, under earlier systems, sa_len isn't present, so the size is 
+ * just sizeof(struct ifreq)
+ */
+#ifdef HAVE_SA_LEN
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#define ifreq_size(i) max(sizeof(struct ifreq),\
+     sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
+#else
+#define ifreq_size(i) sizeof(struct ifreq)
+#endif /* HAVE_SA_LEN*/
+
+	sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+	if (sd < 0) {
+		return -1;
+	}
+	memset(buf, 0, sizeof(buf));
+	ifc.ifc_len = sizeof(buf);
+	ifc.ifc_buf = buf;
+	if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
+		close(sd);
+		return -1;
+	}
+	n = ifc.ifc_len;
+	for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
+		ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
+		strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);		/* Flawfinder: ignore */
+#ifdef SIOCGIFHWADDR
+		if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
+			continue;
+		a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
+#else
+#ifdef SIOCGENADDR
+		if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
+			continue;
+		a = (unsigned char *) ifr.ifr_enaddr;
+#else
+		/*
+		 * XXX we don't have a way of getting the hardware
+		 * address
+		 */
+		close(sd);
+		return 0;
+#endif /* SIOCGENADDR */
+#endif /* SIOCGIFHWADDR */
+		if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+			continue;
+		if (node_id) {
+			memcpy(node_id, a, 6);		/* Flawfinder: ignore */
+			close(sd);
+			return 1;
+		}
+	}
+	close(sd);
 	return 0;
-}
-
-#elif LL_DARWIN
-// Mac OS X version of the UUID generation code...
-/*
- * Get an ethernet hardware address, if we can find it...
- */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <ifaddrs.h>
-
-// static
-S32 LLUUID::getNodeID(unsigned char *node_id)
-{
-	int i;
-	unsigned char 	*a = NULL;
-	struct ifaddrs *ifap, *ifa;
-	int rv;
-	S32 result = 0;
-
-	if ((rv=getifaddrs(&ifap))==-1)
-	{       
-		return -1;
-	}
-	if (ifap == NULL)
-	{
-		return -1;
-	}
-
-	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next)
-	{       
-//		printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family);
-		for(i=0; i< ifa->ifa_addr->sa_len; i++)
-		{
-//			printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]);
-		}
-//		printf("\n");
-		
-		if(ifa->ifa_addr->sa_family == AF_LINK)
-		{
-			// This is a link-level address
-			struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr;
-			
-//			printf("\tLink level address, type %02X\n", lla->sdl_type);
-
-			if(lla->sdl_type == IFT_ETHER)
-			{
-				// Use the first ethernet MAC in the list.
-				// For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly.  This is what it would do.
-				a = (unsigned char *)&((lla)->sdl_data);
-				a += (lla)->sdl_nlen;
-				
-				if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
-				{
-					continue;
-				}
-
-				if (node_id) 
-				{
-					memcpy(node_id, a, 6);
-					result = 1;
-				}
-				
-				// We found one.
-				break;
-			}
-		}
-	}
-	freeifaddrs(ifap);
-
-	return result;
-}
-
-#else
-
-// Linux version of the UUID generation code...
-/*
- * Get the ethernet hardware address, if we can find it...
- */
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#define HAVE_NETINET_IN_H
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#if LL_SOLARIS
-#include <sys/sockio.h>
-#elif !LL_DARWIN
-#include <linux/sockios.h>
-#endif
-#endif
-
-// static
-S32 LLUUID::getNodeID(unsigned char *node_id)
-{
-	int 		sd;
-	struct ifreq 	ifr, *ifrp;
-	struct ifconf 	ifc;
-	char buf[1024];
-	int		n, i;
-	unsigned char 	*a;
-	
-/*
- * BSD 4.4 defines the size of an ifreq to be
- * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
- * However, under earlier systems, sa_len isn't present, so the size is 
- * just sizeof(struct ifreq)
- */
-#ifdef HAVE_SA_LEN
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#define ifreq_size(i) max(sizeof(struct ifreq),\
-     sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
-#else
-#define ifreq_size(i) sizeof(struct ifreq)
-#endif /* HAVE_SA_LEN*/
-
-	sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
-	if (sd < 0) {
-		return -1;
-	}
-	memset(buf, 0, sizeof(buf));
-	ifc.ifc_len = sizeof(buf);
-	ifc.ifc_buf = buf;
-	if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
-		close(sd);
-		return -1;
-	}
-	n = ifc.ifc_len;
-	for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
-		ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
-		strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);		/* Flawfinder: ignore */
-#ifdef SIOCGIFHWADDR
-		if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
-			continue;
-		a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
-#else
-#ifdef SIOCGENADDR
-		if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
-			continue;
-		a = (unsigned char *) ifr.ifr_enaddr;
-#else
-		/*
-		 * XXX we don't have a way of getting the hardware
-		 * address
-		 */
-		close(sd);
-		return 0;
-#endif /* SIOCGENADDR */
-#endif /* SIOCGIFHWADDR */
-		if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
-			continue;
-		if (node_id) {
-			memcpy(node_id, a, 6);		/* Flawfinder: ignore */
-			close(sd);
-			return 1;
-		}
-	}
-	close(sd);
-	return 0;
-}
-
-#endif
-
-S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2)
-{
-   // Compare two time values.
-
-   if (t1->high < t2->high) return -1;
-   if (t1->high > t2->high) return 1;
-   if (t1->low  < t2->low)  return -1;
-   if (t1->low  > t2->low)  return 1;
-   return 0;
-}
-
-void LLUUID::getSystemTime(uuid_time_t *timestamp)
-{
-   // Get system time with 100ns precision. Time is since Oct 15, 1582.
-#if LL_WINDOWS
-   ULARGE_INTEGER time;
-   GetSystemTimeAsFileTime((FILETIME *)&time);
-   // NT keeps time in FILETIME format which is 100ns ticks since
-   // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
-   // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
-   // + 18 years and 5 leap days.
-   time.QuadPart +=
-            (unsigned __int64) (1000*1000*10)       // seconds
-          * (unsigned __int64) (60 * 60 * 24)       // days
-          * (unsigned __int64) (17+30+31+365*18+5); // # of days
-
-   timestamp->high = time.HighPart;
-   timestamp->low  = time.LowPart;
-#else
-   struct timeval tp;
-   gettimeofday(&tp, 0);
-
-   // Offset between UUID formatted times and Unix formatted times.
-   // UUID UTC base time is October 15, 1582.
-   // Unix base time is January 1, 1970.
-   U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
-                           U64L(0x01B21DD213814000);
-   timestamp->high = (U32) (uuid_time >> 32);
-   timestamp->low  = (U32) (uuid_time & 0xFFFFFFFF);
-#endif
-}
-
-void LLUUID::getCurrentTime(uuid_time_t *timestamp)
-{
-   // Get current time as 60 bit 100ns ticks since whenever.
-   // Compensate for the fact that real clock resolution is less
-   // than 100ns.
-
-   const U32 uuids_per_tick = 1024;
-
-   static uuid_time_t time_last;
-   static U32    uuids_this_tick;
-   static BOOL     init = FALSE;
-
-   if (!init) {
-      getSystemTime(&time_last);
-      uuids_this_tick = uuids_per_tick;
-      init = TRUE;
-   }
-
-   uuid_time_t time_now = {0,0};
-
-   while (1) {
-      getSystemTime(&time_now);
-
-      // if clock reading changed since last UUID generated
-      if (cmpTime(&time_last, &time_now))  {
-         // reset count of uuid's generated with this clock reading
-         uuids_this_tick = 0;
-         break;
-      }
-      if (uuids_this_tick < uuids_per_tick) {
-         uuids_this_tick++;
-         break;
-      }
-      // going too fast for our clock; spin
-   }
-
-   time_last = time_now;
-
-   if (uuids_this_tick != 0) {
-      if (time_now.low & 0x80000000) {
-         time_now.low += uuids_this_tick;
-         if (!(time_now.low & 0x80000000))
-            time_now.high++;
-      } else
-         time_now.low += uuids_this_tick;
-   }
-
-   timestamp->high = time_now.high;
-   timestamp->low  = time_now.low;
-}
-
-void LLUUID::generate()
-{
-	// Create a UUID.
-	uuid_time_t timestamp;
-
-	static unsigned char node_id[6];	/* Flawfinder: ignore */
-	static int has_init = 0;
-   
-	// Create a UUID.
-	static uuid_time_t time_last = {0,0};
-	static U16 clock_seq = 0;
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-	static U32 seed = 0L; // dummy seed.  reset it below
-#endif
-	if (!has_init) 
-	{
-		if (getNodeID(node_id) <= 0) 
-		{
-			get_random_bytes(node_id, 6);
-			/*
-			 * Set multicast bit, to prevent conflicts
-			 * with IEEE 802 addresses obtained from
-			 * network cards
-			 */
-			node_id[0] |= 0x80;
-		}
-
-		getCurrentTime(&time_last);
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		seed = time_last.low;
-#endif
-
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536);
-#else
-		clock_seq = (U16)ll_rand(65536);
-#endif
-		has_init = 1;
-	}
-
-	// get current time
-	getCurrentTime(&timestamp);
-
-	// if clock went backward change clockseq
-	if (cmpTime(&timestamp, &time_last) == -1) {
-		clock_seq = (clock_seq + 1) & 0x3FFF;
-		if (clock_seq == 0) clock_seq++;
-	}
-
-	memcpy(mData+10, node_id, 6);		/* Flawfinder: ignore */
-	U32 tmp;
-	tmp = timestamp.low;
-	mData[3] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[2] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[1] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[0] = (unsigned char) tmp;
-	
-	tmp = (U16) timestamp.high;
-	mData[5] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[4] = (unsigned char) tmp;
-
-	tmp = (timestamp.high >> 16) | 0x1000;
-	mData[7] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[6] = (unsigned char) tmp;
-
-	tmp = clock_seq;
-	mData[9] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[8] = (unsigned char) tmp;
-
-	LLMD5 md5_uuid;
-	
-	md5_uuid.update(mData,16);
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(mData);
-
-    time_last = timestamp;
-}
-
-void LLUUID::generate(const std::string& hash_string)
-{
-	LLMD5 md5_uuid((U8*)hash_string.c_str());
-	md5_uuid.raw_digest(mData);
-}
-
-U32 LLUUID::getRandomSeed()
-{
-   static unsigned char seed[16];		/* Flawfinder: ignore */
-   
-   getNodeID(&seed[0]);
-   seed[6]='\0';
-   seed[7]='\0';
-   getSystemTime((uuid_time_t *)(&seed[8]));
-
-   LLMD5 md5_seed;
-	
-   md5_seed.update(seed,16);
-   md5_seed.finalize();
-   md5_seed.raw_digest(seed);
-   
-   return(*(U32 *)seed);
-}
-
-BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
-{
-	if( buf.empty() || value == NULL)
-	{
-		return FALSE;
-	}
-
-	std::string temp( buf );
-	LLStringUtil::trim(temp);
-	if( LLUUID::validate( temp ) )
-	{
-		value->set( temp );
-		return TRUE;
-	}
-	return FALSE;
-}
-
-//static
-LLUUID LLUUID::generateNewID(std::string hash_string)
-{
-	LLUUID new_id;
-	if (hash_string.empty())
-	{
-		new_id.generate();
-	}
-	else
-	{
-		new_id.generate(hash_string);
-	}
-	return new_id;
-}
-
-LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const
-{
-	LLAssetID result;
-	if (isNull())
-	{
-		result.setNull();
-	}
-	else
-	{
-		combine(session, result);
-	}
-	return result;
-}
+}
+
+#endif
+
+S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2)
+{
+   // Compare two time values.
+
+   if (t1->high < t2->high) return -1;
+   if (t1->high > t2->high) return 1;
+   if (t1->low  < t2->low)  return -1;
+   if (t1->low  > t2->low)  return 1;
+   return 0;
+}
+
+void LLUUID::getSystemTime(uuid_time_t *timestamp)
+{
+   // Get system time with 100ns precision. Time is since Oct 15, 1582.
+#if LL_WINDOWS
+   ULARGE_INTEGER time;
+   GetSystemTimeAsFileTime((FILETIME *)&time);
+   // NT keeps time in FILETIME format which is 100ns ticks since
+   // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
+   // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
+   // + 18 years and 5 leap days.
+   time.QuadPart +=
+            (unsigned __int64) (1000*1000*10)       // seconds
+          * (unsigned __int64) (60 * 60 * 24)       // days
+          * (unsigned __int64) (17+30+31+365*18+5); // # of days
+
+   timestamp->high = time.HighPart;
+   timestamp->low  = time.LowPart;
+#else
+   struct timeval tp;
+   gettimeofday(&tp, 0);
+
+   // Offset between UUID formatted times and Unix formatted times.
+   // UUID UTC base time is October 15, 1582.
+   // Unix base time is January 1, 1970.
+   U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
+                           U64L(0x01B21DD213814000);
+   timestamp->high = (U32) (uuid_time >> 32);
+   timestamp->low  = (U32) (uuid_time & 0xFFFFFFFF);
+#endif
+}
+
+void LLUUID::getCurrentTime(uuid_time_t *timestamp)
+{
+   // Get current time as 60 bit 100ns ticks since whenever.
+   // Compensate for the fact that real clock resolution is less
+   // than 100ns.
+
+   const U32 uuids_per_tick = 1024;
+
+   static uuid_time_t time_last;
+   static U32    uuids_this_tick;
+   static BOOL     init = FALSE;
+
+   if (!init) {
+      getSystemTime(&time_last);
+      uuids_this_tick = uuids_per_tick;
+      init = TRUE;
+   }
+
+   uuid_time_t time_now = {0,0};
+
+   while (1) {
+      getSystemTime(&time_now);
+
+      // if clock reading changed since last UUID generated
+      if (cmpTime(&time_last, &time_now))  {
+         // reset count of uuid's generated with this clock reading
+         uuids_this_tick = 0;
+         break;
+      }
+      if (uuids_this_tick < uuids_per_tick) {
+         uuids_this_tick++;
+         break;
+      }
+      // going too fast for our clock; spin
+   }
+
+   time_last = time_now;
+
+   if (uuids_this_tick != 0) {
+      if (time_now.low & 0x80000000) {
+         time_now.low += uuids_this_tick;
+         if (!(time_now.low & 0x80000000))
+            time_now.high++;
+      } else
+         time_now.low += uuids_this_tick;
+   }
+
+   timestamp->high = time_now.high;
+   timestamp->low  = time_now.low;
+}
+
+void LLUUID::generate()
+{
+	// Create a UUID.
+	uuid_time_t timestamp;
+
+	static unsigned char node_id[6];	/* Flawfinder: ignore */
+	static int has_init = 0;
+   
+	// Create a UUID.
+	static uuid_time_t time_last = {0,0};
+	static U16 clock_seq = 0;
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+	static U32 seed = 0L; // dummy seed.  reset it below
+#endif
+	if (!has_init) 
+	{
+		if (getNodeID(node_id) <= 0) 
+		{
+			get_random_bytes(node_id, 6);
+			/*
+			 * Set multicast bit, to prevent conflicts
+			 * with IEEE 802 addresses obtained from
+			 * network cards
+			 */
+			node_id[0] |= 0x80;
+		}
+
+		getCurrentTime(&time_last);
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		seed = time_last.low;
+#endif
+
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536);
+#else
+		clock_seq = (U16)ll_rand(65536);
+#endif
+		has_init = 1;
+	}
+
+	// get current time
+	getCurrentTime(&timestamp);
+
+	// if clock went backward change clockseq
+	if (cmpTime(&timestamp, &time_last) == -1) {
+		clock_seq = (clock_seq + 1) & 0x3FFF;
+		if (clock_seq == 0) clock_seq++;
+	}
+
+	memcpy(mData+10, node_id, 6);		/* Flawfinder: ignore */
+	U32 tmp;
+	tmp = timestamp.low;
+	mData[3] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[2] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[1] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[0] = (unsigned char) tmp;
+	
+	tmp = (U16) timestamp.high;
+	mData[5] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[4] = (unsigned char) tmp;
+
+	tmp = (timestamp.high >> 16) | 0x1000;
+	mData[7] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[6] = (unsigned char) tmp;
+
+	tmp = clock_seq;
+	mData[9] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[8] = (unsigned char) tmp;
+
+	LLMD5 md5_uuid;
+	
+	md5_uuid.update(mData,16);
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(mData);
+
+    time_last = timestamp;
+}
+
+void LLUUID::generate(const std::string& hash_string)
+{
+	LLMD5 md5_uuid((U8*)hash_string.c_str());
+	md5_uuid.raw_digest(mData);
+}
+
+U32 LLUUID::getRandomSeed()
+{
+   static unsigned char seed[16];		/* Flawfinder: ignore */
+   
+   getNodeID(&seed[0]);
+   seed[6]='\0';
+   seed[7]='\0';
+   getSystemTime((uuid_time_t *)(&seed[8]));
+
+   LLMD5 md5_seed;
+	
+   md5_seed.update(seed,16);
+   md5_seed.finalize();
+   md5_seed.raw_digest(seed);
+   
+   return(*(U32 *)seed);
+}
+
+BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
+{
+	if( buf.empty() || value == NULL)
+	{
+		return FALSE;
+	}
+
+	std::string temp( buf );
+	LLStringUtil::trim(temp);
+	if( LLUUID::validate( temp ) )
+	{
+		value->set( temp );
+		return TRUE;
+	}
+	return FALSE;
+}
+
+//static
+LLUUID LLUUID::generateNewID(std::string hash_string)
+{
+	LLUUID new_id;
+	if (hash_string.empty())
+	{
+		new_id.generate();
+	}
+	else
+	{
+		new_id.generate(hash_string);
+	}
+	return new_id;
+}
+
+LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const
+{
+	LLAssetID result;
+	if (isNull())
+	{
+		result.setNull();
+	}
+	else
+	{
+		combine(session, result);
+	}
+	return result;
+}
-- 
cgit v1.2.3


From 8f2df75f3d506fd0c8db57faee4aa0cff0e711aa Mon Sep 17 00:00:00 2001
From: Karen Lahey <karina@lindenlab.com>
Date: Fri, 16 Oct 2009 19:26:46 -0700
Subject: Fix build.

---
 indra/newview/llsechandler_basic.cpp            | 54 ++++++++++++-------------
 indra/newview/tests/llsechandler_basic_test.cpp | 10 ++---
 2 files changed, 30 insertions(+), 34 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index 1453506b0d..9827dc605a 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -1038,46 +1038,42 @@ LLSecAPIBasicHandler::LLSecAPIBasicHandler()
 
 void LLSecAPIBasicHandler::init()
 {
+	mProtectedDataMap = LLSD::emptyMap();
 	if (mProtectedDataFilename.length() == 0)
 	{
 		mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
 															"bin_conf.dat");
-	}
-	if (mLegacyPasswordPath.length() == 0)
-	{
 		mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
-	}
-	mProtectedDataMap = LLSD::emptyMap();
 	
-	mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+		mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
 															"bin_conf.dat");	
+		std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+														"CA.pem");
+		// copy the CA file to a user writable location so we can manipulate it.
+		// for this provider, by using a user writable file, there is a risk that
+		// an attacking program can modify the file, but OS dependent providers
+		// will reduce that risk.
+		// by using a user file, modifications will be limited to one user if
+		// we read-only the main file
+		if (!LLFile::isfile(store_file))
+		{
 
-	std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-															"CA.pem");
-	// copy the CA file to a user writable location so we can manipulate it.
-	// for this provider, by using a user writable file, there is a risk that
-	// an attacking program can modify the file, but OS dependent providers
-	// will reduce that risk.
-	// by using a user file, modifications will be limited to one user if
-	// we read-only the main file
-	if (!LLFile::isfile(store_file))
-	{
-
-		std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
-		llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
-		llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
+			std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
+			llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
+			llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
 
-		while(!ca_file.fail())
-		{
-			char buffer[BUFFER_READ_SIZE];
-			ca_file.read(buffer, sizeof(buffer));
-			copied_store_file.write(buffer, ca_file.gcount());
+			while(!ca_file.fail())
+			{
+				char buffer[BUFFER_READ_SIZE];
+				ca_file.read(buffer, sizeof(buffer));
+				copied_store_file.write(buffer, ca_file.gcount());
+			}
+			ca_file.close();
+			copied_store_file.close();
 		}
-		ca_file.close();
-		copied_store_file.close();
+		LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
+		mStore = new LLBasicCertificateStore(store_file);
 	}
-	LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
-	mStore = new LLBasicCertificateStore(store_file);
 	_readProtectedData(); // initialize mProtectedDataMap
 						  // may throw LLProtectedDataException if saved datamap is not decryptable
 }
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
index 3e4e8c5b3e..236d17c591 100644
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ b/indra/newview/tests/llsechandler_basic_test.cpp
@@ -340,7 +340,7 @@ namespace tut
 
 		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
 																		   "test_password.dat");
-		handler.init();																		
+		handler->init();																		
 		// data retrieval for existing data
 		LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
 
@@ -398,7 +398,7 @@ namespace tut
 		// cause a 'write' by using 'LLPointer' to delete then instantiate a handler
 		handler = NULL;
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler.init();
+		handler->init();
 
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
@@ -413,7 +413,7 @@ namespace tut
 		
 		// cause a 'write'
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler.init();		
+		handler->init();		
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure("not found", data.isUndefined());
 		
@@ -422,7 +422,7 @@ namespace tut
 		
 		LLFile::remove("sechandler_settings.tmp");
 		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler.init();		
+		handler->init();		
 		data = handler->getProtectedData("test_data_type1", "test_data_id");
 		ensure("not found", data.isUndefined());
 		handler = NULL;
@@ -435,7 +435,7 @@ namespace tut
 	void sechandler_basic_test_object::test<3>()
 	{
 		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler.init();
+		handler->init();
 
 		LLSD my_id = LLSD::emptyMap();
 		LLSD my_authenticator = LLSD::emptyMap();
-- 
cgit v1.2.3


From ff51d31af3d3c28e474c2831b38bbefa6f7732c5 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Fri, 5 Feb 2010 17:38:26 -0800
Subject: remove windows line endings introduced via transplant

---
 indra/llcommon/lluuid.cpp | 1954 ++++++++++++++++++++++-----------------------
 1 file changed, 977 insertions(+), 977 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index f87c00e38f..e55d236c77 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -1,977 +1,977 @@
-/** 
- * @file lluuid.cpp
- *
- * $LicenseInfo:firstyear=2000&license=viewergpl$
- * 
- * Copyright (c) 2000-2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#include "linden_common.h"
-
-// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
-#if LL_WINDOWS
-#	undef WIN32_LEAN_AND_MEAN
-#	include <winsock2.h>
-#	include <windows.h>
-#	pragma comment(lib, "IPHLPAPI.lib")
-#	include <iphlpapi.h>
-#endif
-
-#include "lldefs.h"
-#include "llerror.h"
-
-#include "lluuid.h"
-#include "llerror.h"
-#include "llrand.h"
-#include "llmd5.h"
-#include "llstring.h"
-#include "lltimer.h"
-
-const LLUUID LLUUID::null;
-const LLTransactionID LLTransactionID::tnull;
-
-/*
-
-NOT DONE YET!!!
-
-static char BASE85_TABLE[] = {
-	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
-	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
-	'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
-	'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
-	'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
-	'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
-	'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*',
-	'+', '-', ';', '[', '=', '>', '?', '@', '^', '_',
-	'`', '{', '|', '}', '~', '\0'
-};
-
-
-void encode( char * fiveChars, unsigned int word ) throw( )
-{
-for( int ix = 0; ix < 5; ++ix ) {
-fiveChars[4-ix] = encodeTable[ word % 85];
-word /= 85;
-}
-}
-
-To decode:
-unsigned int decode( char const * fiveChars ) throw( bad_input_data )
-{
-unsigned int ret = 0;
-for( int ix = 0; ix < 5; ++ix ) {
-char * s = strchr( encodeTable, fiveChars[ ix ] );
-if( s == 0 ) throw bad_input_data();
-ret = ret * 85 + (s-encodeTable);
-}
-return ret;
-}
-
-void LLUUID::toBase85(char* out)
-{
-	U32* me = (U32*)&(mData[0]);
-	for(S32 i = 0; i < 4; ++i)
-	{
-		char* o = &out[i*i];
-		for(S32 j = 0; j < 5; ++j)
-		{
-			o[4-j] = BASE85_TABLE[ me[i] % 85];
-			word /= 85;
-		}
-	}
-}
-
-unsigned int decode( char const * fiveChars ) throw( bad_input_data )
-{
-	unsigned int ret = 0;
-	for( S32 ix = 0; ix < 5; ++ix )
-	{
-		char * s = strchr( encodeTable, fiveChars[ ix ] );
-		ret = ret * 85 + (s-encodeTable);
-	}
-	return ret;
-} 
-*/
-
-#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-/**
- * @brief a global for
- */
-static U64 sJankyRandomSeed(LLUUID::getRandomSeed());
-
-/**
- * @brief generate a random U32.
- */
-U32 janky_fast_random_bytes()
-{
-	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
-	return (U32)sJankyRandomSeed;
-}
-
-/**
- * @brief generate a random U32 from [0, val)
- */
-U32 janky_fast_random_byes_range(U32 val)
-{
-	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
-	return (U32)(sJankyRandomSeed) % val; 
-}
-
-/**
- * @brief generate a random U32 from [0, val)
- */
-U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
-{
-	seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); 
-	return (U32)(seed) % val; 
-}
-#endif
-
-// Common to all UUID implementations
-void LLUUID::toString(std::string& out) const
-{
-	out = llformat(
-		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
-		(U8)(mData[0]),
-		(U8)(mData[1]),
-		(U8)(mData[2]),
-		(U8)(mData[3]),
-		(U8)(mData[4]),
-		(U8)(mData[5]),
-		(U8)(mData[6]),
-		(U8)(mData[7]),
-		(U8)(mData[8]),
-		(U8)(mData[9]),
-		(U8)(mData[10]),
-		(U8)(mData[11]),
-		(U8)(mData[12]),
-		(U8)(mData[13]),
-		(U8)(mData[14]),
-		(U8)(mData[15]));
-}
-
-// *TODO: deprecate
-void LLUUID::toString(char *out) const
-{
-	std::string buffer;
-	toString(buffer);
-	strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
-}
-
-void LLUUID::toCompressedString(std::string& out) const
-{
-	char bytes[UUID_BYTES+1];
-	memcpy(bytes, mData, UUID_BYTES);		/* Flawfinder: ignore */
-	bytes[UUID_BYTES] = '\0';
-	out.assign(bytes, UUID_BYTES);
-}
-
-// *TODO: deprecate
-void LLUUID::toCompressedString(char *out) const
-{
-	memcpy(out, mData, UUID_BYTES);		/* Flawfinder: ignore */
-	out[UUID_BYTES] = '\0';
-}
-
-std::string LLUUID::getString() const
-{
-	return asString();
-}
-
-std::string LLUUID::asString() const
-{
-	std::string str;
-	toString(str);
-	return str;
-}
-
-BOOL LLUUID::set(const char* in_string, BOOL emit)
-{
-	return set(ll_safe_string(in_string),emit);
-}
-
-BOOL LLUUID::set(const std::string& in_string, BOOL emit)
-{
-	BOOL broken_format = FALSE;
-
-	// empty strings should make NULL uuid
-	if (in_string.empty())
-	{
-		setNull();
-		return TRUE;
-	}
-
-	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
-	{
-		// I'm a moron.  First implementation didn't have the right UUID format.
-		// Shouldn't see any of these any more
-		if (in_string.length() == (UUID_STR_LENGTH - 2))	/* Flawfinder: ignore */
-		{
-			if(emit)
-			{
-				llwarns << "Warning! Using broken UUID string format" << llendl;
-			}
-			broken_format = TRUE;
-		}
-		else
-		{
-			// Bad UUID string.  Spam as INFO, as most cases we don't care.
-			if(emit)
-			{
-				//don't spam the logs because a resident can't spell.
-				llwarns << "Bad UUID string: " << in_string << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-	}
-
-	U8 cur_pos = 0;
-	S32 i;
-	for (i = 0; i < UUID_BYTES; i++)
-	{
-		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
-		{
-			cur_pos++;
-			if (broken_format && (i==10))
-			{
-				// Missing - in the broken format
-				cur_pos--;
-			}
-		}
-
-		mData[i] = 0;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-			mData[i] += (U8)(in_string[cur_pos] - '0');
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
-		}
-		else
-		{
-			if(emit)
-			{							
-				llwarns << "Invalid UUID string character" << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-
-		mData[i] = mData[i] << 4;
-		cur_pos++;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-			mData[i] += (U8)(in_string[cur_pos] - '0');
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
-		}
-		else
-		{
-			if(emit)
-			{
-				llwarns << "Invalid UUID string character" << llendl;
-			}
-			setNull();
-			return FALSE;
-		}
-		cur_pos++;
-	}
-
-	return TRUE;
-}
-
-BOOL LLUUID::validate(const std::string& in_string)
-{
-	BOOL broken_format = FALSE;
-	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
-	{
-		// I'm a moron.  First implementation didn't have the right UUID format.
-		if (in_string.length() == (UUID_STR_LENGTH - 2))		/* Flawfinder: ignore */
-		{
-			broken_format = TRUE;
-		}
-		else
-		{
-			return FALSE;
-		}
-	}
-
-	U8 cur_pos = 0;
-	for (U32 i = 0; i < 16; i++)
-	{
-		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
-		{
-			cur_pos++;
-			if (broken_format && (i==10))
-			{
-				// Missing - in the broken format
-				cur_pos--;
-			}
-		}
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-		}
-		else
-		{
-			return FALSE;
-		}
-
-		cur_pos++;
-
-		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
-		{
-		}
-		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
-		{
-		}
-		else
-		{
-			return FALSE;
-		}
-		cur_pos++;
-	}
-	return TRUE;
-}
-
-const LLUUID& LLUUID::operator^=(const LLUUID& rhs)
-{
-	U32* me = (U32*)&(mData[0]);
-	const U32* other = (U32*)&(rhs.mData[0]);
-	for(S32 i = 0; i < 4; ++i)
-	{
-		me[i] = me[i] ^ other[i];
-	}
-	return *this;
-}
-
-LLUUID LLUUID::operator^(const LLUUID& rhs) const
-{
-	LLUUID id(*this);
-	id ^= rhs;
-	return id;
-}
-
-void LLUUID::combine(const LLUUID& other, LLUUID& result) const
-{
-	LLMD5 md5_uuid;
-	md5_uuid.update((unsigned char*)mData, 16);
-	md5_uuid.update((unsigned char*)other.mData, 16);
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(result.mData);
-}
-
-LLUUID LLUUID::combine(const LLUUID &other) const
-{
-	LLUUID combination;
-	combine(other, combination);
-	return combination;
-}
-
-std::ostream& operator<<(std::ostream& s, const LLUUID &uuid)
-{
-	std::string uuid_str;
-	uuid.toString(uuid_str);
-	s << uuid_str;
-	return s;
-}
-
-std::istream& operator>>(std::istream &s, LLUUID &uuid)
-{
-	U32 i;
-	char uuid_str[UUID_STR_LENGTH];		/* Flawfinder: ignore */
-	for (i = 0; i < UUID_STR_LENGTH-1; i++)
-	{
-		s >> uuid_str[i];
-	}
-	uuid_str[i] = '\0';
-	uuid.set(std::string(uuid_str));
-	return s;
-}
-
-static void get_random_bytes(void *buf, int nbytes)
-{
-	int i;
-	char *cp = (char *) buf;
-
-	// *NOTE: If we are not using the janky generator ll_rand()
-	// generates at least 3 good bytes of data since it is 0 to
-	// RAND_MAX. This could be made more efficient by copying all the
-	// bytes.
-	for (i=0; i < nbytes; i++)
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		*cp++ = janky_fast_random_bytes() & 0xFF;
-#else
-		*cp++ = ll_rand() & 0xFF;
-#endif
-	return;	
-}
-
-#if	LL_WINDOWS
-// Code	copied from	http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
-// This	code grabs the first hardware	address, rather	than the first interface.
-// Using a VPN can cause the first returned	interface	to be	changed.
-
-const	S32	MAC_ADDRESS_BYTES=6;
-
-
-// static
-S32	LLUUID::getNodeID(unsigned char	*node_id)
-{
-
-	// Declare and initialize variables.
-	DWORD	dwSize = 0;
-	DWORD	dwRetVal = 0;
-	int	i;
-
-/* variables used	for	GetIfTable and GetIfEntry	*/
-	MIB_IFTABLE	*pIfTable;
-	MIB_IFROW	*pIfRow;
-
-	// Allocate	memory for our pointers.
-	pIfTable = (MIB_IFTABLE	*) malloc(sizeof (MIB_IFTABLE));
-	if (pIfTable ==	NULL)	
-	{
-			printf("Error allocating memory needed to call GetIfTable\n");
-			return 0;
-	}
-
-	// Before	calling	GetIfEntry,	we call	GetIfTable to	make
-	// sure	there	are	entries	to get and retrieve	the	interface	index.
-
-	// Make	an initial call	to GetIfTable	to get the
-	// necessary size	into dwSize
-	if (GetIfTable(pIfTable, &dwSize,	0) ==	ERROR_INSUFFICIENT_BUFFER) {
-			free(pIfTable);
-			pIfTable = (MIB_IFTABLE	*) malloc(dwSize);
-			if (pIfTable ==	NULL)	
-			{
-					printf("Error	allocating memory\n");
-					return 0;
-			}
-	}
-	//	Make a second	call to	GetIfTable to	get	the	actual
-	// data	we want.
-	if ((dwRetVal = GetIfTable(pIfTable, &dwSize,	0))	== NO_ERROR) 
-	{
-		if (pIfTable->dwNumEntries > 0)	
-		{
-			pIfRow = (MIB_IFROW	*) malloc(sizeof (MIB_IFROW));
-			if (pIfRow ==	NULL)	
-			{
-					printf("Error allocating memory\n");
-					if (pIfTable != NULL)	
-					{
-						free(pIfTable);
-						pIfTable = NULL;
-					}
-					return 0;
-			}
-
-			int	limit	=	MAC_ADDRESS_BYTES;
-			memcpy(node_id,	"\0\0\0\0\0\0",	limit);	// zero	out	array	of bytes	 
-			for	(i = 0;	i < (int) pIfTable->dwNumEntries; i++) 
-			{
-				pIfRow->dwIndex	= pIfTable->table[i].dwIndex;
-				if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR) 
-				{
-					switch (pIfRow->dwType)	
-					{
-						case IF_TYPE_ETHERNET_CSMACD:
-						case IF_TYPE_IEEE80211:		 
-							 limit = min((int) pIfRow->dwPhysAddrLen, limit);
-							 if	(pIfRow->dwPhysAddrLen == 0)
-									 break;
-							 memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit);		 //	just incase	the	PhysAddr is	not	the	expected MAC_Address size
-							 free(pIfTable);
-							 return 1;	//return first hardware	device found.	
-							break;
-
-						case IF_TYPE_OTHER:
-						case IF_TYPE_PPP:										 
-						case IF_TYPE_SOFTWARE_LOOPBACK:										 
-						case IF_TYPE_ISO88025_TOKENRING:										
-						case IF_TYPE_IEEE1394:																		
-						case IF_TYPE_ATM:										 
-						case IF_TYPE_TUNNEL:										
-								default:
-									break;
-					}
-				}
-			}
-		}
-	}
-	free(pIfTable);
-	return 0;
-}
-
-#elif LL_DARWIN
-// Mac OS X version of the UUID generation code...
-/*
- * Get an ethernet hardware address, if we can find it...
- */
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/if_dl.h>
-#include <net/route.h>
-#include <ifaddrs.h>
-
-// static
-S32 LLUUID::getNodeID(unsigned char *node_id)
-{
-	int i;
-	unsigned char 	*a = NULL;
-	struct ifaddrs *ifap, *ifa;
-	int rv;
-	S32 result = 0;
-
-	if ((rv=getifaddrs(&ifap))==-1)
-	{       
-		return -1;
-	}
-	if (ifap == NULL)
-	{
-		return -1;
-	}
-
-	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next)
-	{       
-//		printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family);
-		for(i=0; i< ifa->ifa_addr->sa_len; i++)
-		{
-//			printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]);
-		}
-//		printf("\n");
-		
-		if(ifa->ifa_addr->sa_family == AF_LINK)
-		{
-			// This is a link-level address
-			struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr;
-			
-//			printf("\tLink level address, type %02X\n", lla->sdl_type);
-
-			if(lla->sdl_type == IFT_ETHER)
-			{
-				// Use the first ethernet MAC in the list.
-				// For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly.  This is what it would do.
-				a = (unsigned char *)&((lla)->sdl_data);
-				a += (lla)->sdl_nlen;
-				
-				if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
-				{
-					continue;
-				}
-
-				if (node_id) 
-				{
-					memcpy(node_id, a, 6);
-					result = 1;
-				}
-				
-				// We found one.
-				break;
-			}
-		}
-	}
-	freeifaddrs(ifap);
-
-	return result;
-}
-
-#else
-
-// Linux version of the UUID generation code...
-/*
- * Get the ethernet hardware address, if we can find it...
- */
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <sys/file.h>
-#include <sys/ioctl.h>
-#include <sys/socket.h>
-#include <net/if.h>
-#define HAVE_NETINET_IN_H
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#if LL_SOLARIS
-#include <sys/sockio.h>
-#elif !LL_DARWIN
-#include <linux/sockios.h>
-#endif
-#endif
-
-// static
-S32 LLUUID::getNodeID(unsigned char *node_id)
-{
-	int 		sd;
-	struct ifreq 	ifr, *ifrp;
-	struct ifconf 	ifc;
-	char buf[1024];
-	int		n, i;
-	unsigned char 	*a;
-	
-/*
- * BSD 4.4 defines the size of an ifreq to be
- * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
- * However, under earlier systems, sa_len isn't present, so the size is 
- * just sizeof(struct ifreq)
- */
-#ifdef HAVE_SA_LEN
-#ifndef max
-#define max(a,b) ((a) > (b) ? (a) : (b))
-#endif
-#define ifreq_size(i) max(sizeof(struct ifreq),\
-     sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
-#else
-#define ifreq_size(i) sizeof(struct ifreq)
-#endif /* HAVE_SA_LEN*/
-
-	sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
-	if (sd < 0) {
-		return -1;
-	}
-	memset(buf, 0, sizeof(buf));
-	ifc.ifc_len = sizeof(buf);
-	ifc.ifc_buf = buf;
-	if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
-		close(sd);
-		return -1;
-	}
-	n = ifc.ifc_len;
-	for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
-		ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
-		strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);		/* Flawfinder: ignore */
-#ifdef SIOCGIFHWADDR
-		if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
-			continue;
-		a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
-#else
-#ifdef SIOCGENADDR
-		if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
-			continue;
-		a = (unsigned char *) ifr.ifr_enaddr;
-#else
-		/*
-		 * XXX we don't have a way of getting the hardware
-		 * address
-		 */
-		close(sd);
-		return 0;
-#endif /* SIOCGENADDR */
-#endif /* SIOCGIFHWADDR */
-		if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
-			continue;
-		if (node_id) {
-			memcpy(node_id, a, 6);		/* Flawfinder: ignore */
-			close(sd);
-			return 1;
-		}
-	}
-	close(sd);
-	return 0;
-}
-
-#endif
-
-S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2)
-{
-   // Compare two time values.
-
-   if (t1->high < t2->high) return -1;
-   if (t1->high > t2->high) return 1;
-   if (t1->low  < t2->low)  return -1;
-   if (t1->low  > t2->low)  return 1;
-   return 0;
-}
-
-void LLUUID::getSystemTime(uuid_time_t *timestamp)
-{
-   // Get system time with 100ns precision. Time is since Oct 15, 1582.
-#if LL_WINDOWS
-   ULARGE_INTEGER time;
-   GetSystemTimeAsFileTime((FILETIME *)&time);
-   // NT keeps time in FILETIME format which is 100ns ticks since
-   // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
-   // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
-   // + 18 years and 5 leap days.
-   time.QuadPart +=
-            (unsigned __int64) (1000*1000*10)       // seconds
-          * (unsigned __int64) (60 * 60 * 24)       // days
-          * (unsigned __int64) (17+30+31+365*18+5); // # of days
-
-   timestamp->high = time.HighPart;
-   timestamp->low  = time.LowPart;
-#else
-   struct timeval tp;
-   gettimeofday(&tp, 0);
-
-   // Offset between UUID formatted times and Unix formatted times.
-   // UUID UTC base time is October 15, 1582.
-   // Unix base time is January 1, 1970.
-   U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
-                           U64L(0x01B21DD213814000);
-   timestamp->high = (U32) (uuid_time >> 32);
-   timestamp->low  = (U32) (uuid_time & 0xFFFFFFFF);
-#endif
-}
-
-void LLUUID::getCurrentTime(uuid_time_t *timestamp)
-{
-   // Get current time as 60 bit 100ns ticks since whenever.
-   // Compensate for the fact that real clock resolution is less
-   // than 100ns.
-
-   const U32 uuids_per_tick = 1024;
-
-   static uuid_time_t time_last;
-   static U32    uuids_this_tick;
-   static BOOL     init = FALSE;
-
-   if (!init) {
-      getSystemTime(&time_last);
-      uuids_this_tick = uuids_per_tick;
-      init = TRUE;
-   }
-
-   uuid_time_t time_now = {0,0};
-
-   while (1) {
-      getSystemTime(&time_now);
-
-      // if clock reading changed since last UUID generated
-      if (cmpTime(&time_last, &time_now))  {
-         // reset count of uuid's generated with this clock reading
-         uuids_this_tick = 0;
-         break;
-      }
-      if (uuids_this_tick < uuids_per_tick) {
-         uuids_this_tick++;
-         break;
-      }
-      // going too fast for our clock; spin
-   }
-
-   time_last = time_now;
-
-   if (uuids_this_tick != 0) {
-      if (time_now.low & 0x80000000) {
-         time_now.low += uuids_this_tick;
-         if (!(time_now.low & 0x80000000))
-            time_now.high++;
-      } else
-         time_now.low += uuids_this_tick;
-   }
-
-   timestamp->high = time_now.high;
-   timestamp->low  = time_now.low;
-}
-
-void LLUUID::generate()
-{
-	// Create a UUID.
-	uuid_time_t timestamp;
-
-	static unsigned char node_id[6];	/* Flawfinder: ignore */
-	static int has_init = 0;
-   
-	// Create a UUID.
-	static uuid_time_t time_last = {0,0};
-	static U16 clock_seq = 0;
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-	static U32 seed = 0L; // dummy seed.  reset it below
-#endif
-	if (!has_init) 
-	{
-		if (getNodeID(node_id) <= 0) 
-		{
-			get_random_bytes(node_id, 6);
-			/*
-			 * Set multicast bit, to prevent conflicts
-			 * with IEEE 802 addresses obtained from
-			 * network cards
-			 */
-			node_id[0] |= 0x80;
-		}
-
-		getCurrentTime(&time_last);
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		seed = time_last.low;
-#endif
-
-#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
-		clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536);
-#else
-		clock_seq = (U16)ll_rand(65536);
-#endif
-		has_init = 1;
-	}
-
-	// get current time
-	getCurrentTime(&timestamp);
-
-	// if clock went backward change clockseq
-	if (cmpTime(&timestamp, &time_last) == -1) {
-		clock_seq = (clock_seq + 1) & 0x3FFF;
-		if (clock_seq == 0) clock_seq++;
-	}
-
-	memcpy(mData+10, node_id, 6);		/* Flawfinder: ignore */
-	U32 tmp;
-	tmp = timestamp.low;
-	mData[3] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[2] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[1] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[0] = (unsigned char) tmp;
-	
-	tmp = (U16) timestamp.high;
-	mData[5] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[4] = (unsigned char) tmp;
-
-	tmp = (timestamp.high >> 16) | 0x1000;
-	mData[7] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[6] = (unsigned char) tmp;
-
-	tmp = clock_seq;
-	mData[9] = (unsigned char) tmp;
-	tmp >>= 8;
-	mData[8] = (unsigned char) tmp;
-
-	LLMD5 md5_uuid;
-	
-	md5_uuid.update(mData,16);
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(mData);
-
-    time_last = timestamp;
-}
-
-void LLUUID::generate(const std::string& hash_string)
-{
-	LLMD5 md5_uuid((U8*)hash_string.c_str());
-	md5_uuid.raw_digest(mData);
-}
-
-U32 LLUUID::getRandomSeed()
-{
-   static unsigned char seed[16];		/* Flawfinder: ignore */
-   
-   getNodeID(&seed[0]);
-   seed[6]='\0';
-   seed[7]='\0';
-   getSystemTime((uuid_time_t *)(&seed[8]));
-
-   LLMD5 md5_seed;
-	
-   md5_seed.update(seed,16);
-   md5_seed.finalize();
-   md5_seed.raw_digest(seed);
-   
-   return(*(U32 *)seed);
-}
-
-BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
-{
-	if( buf.empty() || value == NULL)
-	{
-		return FALSE;
-	}
-
-	std::string temp( buf );
-	LLStringUtil::trim(temp);
-	if( LLUUID::validate( temp ) )
-	{
-		value->set( temp );
-		return TRUE;
-	}
-	return FALSE;
-}
-
-//static
-LLUUID LLUUID::generateNewID(std::string hash_string)
-{
-	LLUUID new_id;
-	if (hash_string.empty())
-	{
-		new_id.generate();
-	}
-	else
-	{
-		new_id.generate(hash_string);
-	}
-	return new_id;
-}
-
-LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const
-{
-	LLAssetID result;
-	if (isNull())
-	{
-		result.setNull();
-	}
-	else
-	{
-		combine(session, result);
-	}
-	return result;
-}
+/** 
+ * @file lluuid.cpp
+ *
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+
+// We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
+#if LL_WINDOWS
+#	undef WIN32_LEAN_AND_MEAN
+#	include <winsock2.h>
+#	include <windows.h>
+#	pragma comment(lib, "IPHLPAPI.lib")
+#	include <iphlpapi.h>
+#endif
+
+#include "lldefs.h"
+#include "llerror.h"
+
+#include "lluuid.h"
+#include "llerror.h"
+#include "llrand.h"
+#include "llmd5.h"
+#include "llstring.h"
+#include "lltimer.h"
+
+const LLUUID LLUUID::null;
+const LLTransactionID LLTransactionID::tnull;
+
+/*
+
+NOT DONE YET!!!
+
+static char BASE85_TABLE[] = {
+	'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+	'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
+	'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
+	'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
+	'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+	'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
+	'y', 'z', '!', '#', '$', '%', '&', '(', ')', '*',
+	'+', '-', ';', '[', '=', '>', '?', '@', '^', '_',
+	'`', '{', '|', '}', '~', '\0'
+};
+
+
+void encode( char * fiveChars, unsigned int word ) throw( )
+{
+for( int ix = 0; ix < 5; ++ix ) {
+fiveChars[4-ix] = encodeTable[ word % 85];
+word /= 85;
+}
+}
+
+To decode:
+unsigned int decode( char const * fiveChars ) throw( bad_input_data )
+{
+unsigned int ret = 0;
+for( int ix = 0; ix < 5; ++ix ) {
+char * s = strchr( encodeTable, fiveChars[ ix ] );
+if( s == 0 ) throw bad_input_data();
+ret = ret * 85 + (s-encodeTable);
+}
+return ret;
+}
+
+void LLUUID::toBase85(char* out)
+{
+	U32* me = (U32*)&(mData[0]);
+	for(S32 i = 0; i < 4; ++i)
+	{
+		char* o = &out[i*i];
+		for(S32 j = 0; j < 5; ++j)
+		{
+			o[4-j] = BASE85_TABLE[ me[i] % 85];
+			word /= 85;
+		}
+	}
+}
+
+unsigned int decode( char const * fiveChars ) throw( bad_input_data )
+{
+	unsigned int ret = 0;
+	for( S32 ix = 0; ix < 5; ++ix )
+	{
+		char * s = strchr( encodeTable, fiveChars[ ix ] );
+		ret = ret * 85 + (s-encodeTable);
+	}
+	return ret;
+} 
+*/
+
+#define LL_USE_JANKY_RANDOM_NUMBER_GENERATOR 0
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+/**
+ * @brief a global for
+ */
+static U64 sJankyRandomSeed(LLUUID::getRandomSeed());
+
+/**
+ * @brief generate a random U32.
+ */
+U32 janky_fast_random_bytes()
+{
+	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
+	return (U32)sJankyRandomSeed;
+}
+
+/**
+ * @brief generate a random U32 from [0, val)
+ */
+U32 janky_fast_random_byes_range(U32 val)
+{
+	sJankyRandomSeed = U64L(1664525) * sJankyRandomSeed + U64L(1013904223); 
+	return (U32)(sJankyRandomSeed) % val; 
+}
+
+/**
+ * @brief generate a random U32 from [0, val)
+ */
+U32 janky_fast_random_seeded_bytes(U32 seed, U32 val)
+{
+	seed = U64L(1664525) * (U64)(seed) + U64L(1013904223); 
+	return (U32)(seed) % val; 
+}
+#endif
+
+// Common to all UUID implementations
+void LLUUID::toString(std::string& out) const
+{
+	out = llformat(
+		"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+		(U8)(mData[0]),
+		(U8)(mData[1]),
+		(U8)(mData[2]),
+		(U8)(mData[3]),
+		(U8)(mData[4]),
+		(U8)(mData[5]),
+		(U8)(mData[6]),
+		(U8)(mData[7]),
+		(U8)(mData[8]),
+		(U8)(mData[9]),
+		(U8)(mData[10]),
+		(U8)(mData[11]),
+		(U8)(mData[12]),
+		(U8)(mData[13]),
+		(U8)(mData[14]),
+		(U8)(mData[15]));
+}
+
+// *TODO: deprecate
+void LLUUID::toString(char *out) const
+{
+	std::string buffer;
+	toString(buffer);
+	strcpy(out,buffer.c_str()); /* Flawfinder: ignore */
+}
+
+void LLUUID::toCompressedString(std::string& out) const
+{
+	char bytes[UUID_BYTES+1];
+	memcpy(bytes, mData, UUID_BYTES);		/* Flawfinder: ignore */
+	bytes[UUID_BYTES] = '\0';
+	out.assign(bytes, UUID_BYTES);
+}
+
+// *TODO: deprecate
+void LLUUID::toCompressedString(char *out) const
+{
+	memcpy(out, mData, UUID_BYTES);		/* Flawfinder: ignore */
+	out[UUID_BYTES] = '\0';
+}
+
+std::string LLUUID::getString() const
+{
+	return asString();
+}
+
+std::string LLUUID::asString() const
+{
+	std::string str;
+	toString(str);
+	return str;
+}
+
+BOOL LLUUID::set(const char* in_string, BOOL emit)
+{
+	return set(ll_safe_string(in_string),emit);
+}
+
+BOOL LLUUID::set(const std::string& in_string, BOOL emit)
+{
+	BOOL broken_format = FALSE;
+
+	// empty strings should make NULL uuid
+	if (in_string.empty())
+	{
+		setNull();
+		return TRUE;
+	}
+
+	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
+	{
+		// I'm a moron.  First implementation didn't have the right UUID format.
+		// Shouldn't see any of these any more
+		if (in_string.length() == (UUID_STR_LENGTH - 2))	/* Flawfinder: ignore */
+		{
+			if(emit)
+			{
+				llwarns << "Warning! Using broken UUID string format" << llendl;
+			}
+			broken_format = TRUE;
+		}
+		else
+		{
+			// Bad UUID string.  Spam as INFO, as most cases we don't care.
+			if(emit)
+			{
+				//don't spam the logs because a resident can't spell.
+				llwarns << "Bad UUID string: " << in_string << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+	}
+
+	U8 cur_pos = 0;
+	S32 i;
+	for (i = 0; i < UUID_BYTES; i++)
+	{
+		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
+		{
+			cur_pos++;
+			if (broken_format && (i==10))
+			{
+				// Missing - in the broken format
+				cur_pos--;
+			}
+		}
+
+		mData[i] = 0;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+			mData[i] += (U8)(in_string[cur_pos] - '0');
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
+		}
+		else
+		{
+			if(emit)
+			{							
+				llwarns << "Invalid UUID string character" << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+
+		mData[i] = mData[i] << 4;
+		cur_pos++;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+			mData[i] += (U8)(in_string[cur_pos] - '0');
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'a');
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+			mData[i] += (U8)(10 + in_string[cur_pos] - 'A');
+		}
+		else
+		{
+			if(emit)
+			{
+				llwarns << "Invalid UUID string character" << llendl;
+			}
+			setNull();
+			return FALSE;
+		}
+		cur_pos++;
+	}
+
+	return TRUE;
+}
+
+BOOL LLUUID::validate(const std::string& in_string)
+{
+	BOOL broken_format = FALSE;
+	if (in_string.length() != (UUID_STR_LENGTH - 1))		/* Flawfinder: ignore */
+	{
+		// I'm a moron.  First implementation didn't have the right UUID format.
+		if (in_string.length() == (UUID_STR_LENGTH - 2))		/* Flawfinder: ignore */
+		{
+			broken_format = TRUE;
+		}
+		else
+		{
+			return FALSE;
+		}
+	}
+
+	U8 cur_pos = 0;
+	for (U32 i = 0; i < 16; i++)
+	{
+		if ((i == 4) || (i == 6) || (i == 8) || (i == 10))
+		{
+			cur_pos++;
+			if (broken_format && (i==10))
+			{
+				// Missing - in the broken format
+				cur_pos--;
+			}
+		}
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+		}
+		else
+		{
+			return FALSE;
+		}
+
+		cur_pos++;
+
+		if ((in_string[cur_pos] >= '0') && (in_string[cur_pos] <= '9'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'a') && (in_string[cur_pos] <='f'))
+		{
+		}
+		else if ((in_string[cur_pos] >= 'A') && (in_string[cur_pos] <='F'))
+		{
+		}
+		else
+		{
+			return FALSE;
+		}
+		cur_pos++;
+	}
+	return TRUE;
+}
+
+const LLUUID& LLUUID::operator^=(const LLUUID& rhs)
+{
+	U32* me = (U32*)&(mData[0]);
+	const U32* other = (U32*)&(rhs.mData[0]);
+	for(S32 i = 0; i < 4; ++i)
+	{
+		me[i] = me[i] ^ other[i];
+	}
+	return *this;
+}
+
+LLUUID LLUUID::operator^(const LLUUID& rhs) const
+{
+	LLUUID id(*this);
+	id ^= rhs;
+	return id;
+}
+
+void LLUUID::combine(const LLUUID& other, LLUUID& result) const
+{
+	LLMD5 md5_uuid;
+	md5_uuid.update((unsigned char*)mData, 16);
+	md5_uuid.update((unsigned char*)other.mData, 16);
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(result.mData);
+}
+
+LLUUID LLUUID::combine(const LLUUID &other) const
+{
+	LLUUID combination;
+	combine(other, combination);
+	return combination;
+}
+
+std::ostream& operator<<(std::ostream& s, const LLUUID &uuid)
+{
+	std::string uuid_str;
+	uuid.toString(uuid_str);
+	s << uuid_str;
+	return s;
+}
+
+std::istream& operator>>(std::istream &s, LLUUID &uuid)
+{
+	U32 i;
+	char uuid_str[UUID_STR_LENGTH];		/* Flawfinder: ignore */
+	for (i = 0; i < UUID_STR_LENGTH-1; i++)
+	{
+		s >> uuid_str[i];
+	}
+	uuid_str[i] = '\0';
+	uuid.set(std::string(uuid_str));
+	return s;
+}
+
+static void get_random_bytes(void *buf, int nbytes)
+{
+	int i;
+	char *cp = (char *) buf;
+
+	// *NOTE: If we are not using the janky generator ll_rand()
+	// generates at least 3 good bytes of data since it is 0 to
+	// RAND_MAX. This could be made more efficient by copying all the
+	// bytes.
+	for (i=0; i < nbytes; i++)
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		*cp++ = janky_fast_random_bytes() & 0xFF;
+#else
+		*cp++ = ll_rand() & 0xFF;
+#endif
+	return;	
+}
+
+#if	LL_WINDOWS
+// Code	copied from	http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
+// This	code grabs the first hardware	address, rather	than the first interface.
+// Using a VPN can cause the first returned	interface	to be	changed.
+
+const	S32	MAC_ADDRESS_BYTES=6;
+
+
+// static
+S32	LLUUID::getNodeID(unsigned char	*node_id)
+{
+
+	// Declare and initialize variables.
+	DWORD	dwSize = 0;
+	DWORD	dwRetVal = 0;
+	int	i;
+
+/* variables used	for	GetIfTable and GetIfEntry	*/
+	MIB_IFTABLE	*pIfTable;
+	MIB_IFROW	*pIfRow;
+
+	// Allocate	memory for our pointers.
+	pIfTable = (MIB_IFTABLE	*) malloc(sizeof (MIB_IFTABLE));
+	if (pIfTable ==	NULL)	
+	{
+			printf("Error allocating memory needed to call GetIfTable\n");
+			return 0;
+	}
+
+	// Before	calling	GetIfEntry,	we call	GetIfTable to	make
+	// sure	there	are	entries	to get and retrieve	the	interface	index.
+
+	// Make	an initial call	to GetIfTable	to get the
+	// necessary size	into dwSize
+	if (GetIfTable(pIfTable, &dwSize,	0) ==	ERROR_INSUFFICIENT_BUFFER) {
+			free(pIfTable);
+			pIfTable = (MIB_IFTABLE	*) malloc(dwSize);
+			if (pIfTable ==	NULL)	
+			{
+					printf("Error	allocating memory\n");
+					return 0;
+			}
+	}
+	//	Make a second	call to	GetIfTable to	get	the	actual
+	// data	we want.
+	if ((dwRetVal = GetIfTable(pIfTable, &dwSize,	0))	== NO_ERROR) 
+	{
+		if (pIfTable->dwNumEntries > 0)	
+		{
+			pIfRow = (MIB_IFROW	*) malloc(sizeof (MIB_IFROW));
+			if (pIfRow ==	NULL)	
+			{
+					printf("Error allocating memory\n");
+					if (pIfTable != NULL)	
+					{
+						free(pIfTable);
+						pIfTable = NULL;
+					}
+					return 0;
+			}
+
+			int	limit	=	MAC_ADDRESS_BYTES;
+			memcpy(node_id,	"\0\0\0\0\0\0",	limit);	// zero	out	array	of bytes	 
+			for	(i = 0;	i < (int) pIfTable->dwNumEntries; i++) 
+			{
+				pIfRow->dwIndex	= pIfTable->table[i].dwIndex;
+				if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR) 
+				{
+					switch (pIfRow->dwType)	
+					{
+						case IF_TYPE_ETHERNET_CSMACD:
+						case IF_TYPE_IEEE80211:		 
+							 limit = min((int) pIfRow->dwPhysAddrLen, limit);
+							 if	(pIfRow->dwPhysAddrLen == 0)
+									 break;
+							 memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit);		 //	just incase	the	PhysAddr is	not	the	expected MAC_Address size
+							 free(pIfTable);
+							 return 1;	//return first hardware	device found.	
+							break;
+
+						case IF_TYPE_OTHER:
+						case IF_TYPE_PPP:										 
+						case IF_TYPE_SOFTWARE_LOOPBACK:										 
+						case IF_TYPE_ISO88025_TOKENRING:										
+						case IF_TYPE_IEEE1394:																		
+						case IF_TYPE_ATM:										 
+						case IF_TYPE_TUNNEL:										
+								default:
+									break;
+					}
+				}
+			}
+		}
+	}
+	free(pIfTable);
+	return 0;
+}
+
+#elif LL_DARWIN
+// Mac OS X version of the UUID generation code...
+/*
+ * Get an ethernet hardware address, if we can find it...
+ */
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <net/if.h>
+#include <net/if_types.h>
+#include <net/if_dl.h>
+#include <net/route.h>
+#include <ifaddrs.h>
+
+// static
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+	int i;
+	unsigned char 	*a = NULL;
+	struct ifaddrs *ifap, *ifa;
+	int rv;
+	S32 result = 0;
+
+	if ((rv=getifaddrs(&ifap))==-1)
+	{       
+		return -1;
+	}
+	if (ifap == NULL)
+	{
+		return -1;
+	}
+
+	for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next)
+	{       
+//		printf("Interface %s, address family %d, ", ifa->ifa_name, ifa->ifa_addr->sa_family);
+		for(i=0; i< ifa->ifa_addr->sa_len; i++)
+		{
+//			printf("%02X ", (unsigned char)ifa->ifa_addr->sa_data[i]);
+		}
+//		printf("\n");
+		
+		if(ifa->ifa_addr->sa_family == AF_LINK)
+		{
+			// This is a link-level address
+			struct sockaddr_dl *lla = (struct sockaddr_dl *)ifa->ifa_addr;
+			
+//			printf("\tLink level address, type %02X\n", lla->sdl_type);
+
+			if(lla->sdl_type == IFT_ETHER)
+			{
+				// Use the first ethernet MAC in the list.
+				// For some reason, the macro LLADDR() defined in net/if_dl.h doesn't expand correctly.  This is what it would do.
+				a = (unsigned char *)&((lla)->sdl_data);
+				a += (lla)->sdl_nlen;
+				
+				if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+				{
+					continue;
+				}
+
+				if (node_id) 
+				{
+					memcpy(node_id, a, 6);
+					result = 1;
+				}
+				
+				// We found one.
+				break;
+			}
+		}
+	}
+	freeifaddrs(ifap);
+
+	return result;
+}
+
+#else
+
+// Linux version of the UUID generation code...
+/*
+ * Get the ethernet hardware address, if we can find it...
+ */
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/stat.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+#include <net/if.h>
+#define HAVE_NETINET_IN_H
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#if LL_SOLARIS
+#include <sys/sockio.h>
+#elif !LL_DARWIN
+#include <linux/sockios.h>
+#endif
+#endif
+
+// static
+S32 LLUUID::getNodeID(unsigned char *node_id)
+{
+	int 		sd;
+	struct ifreq 	ifr, *ifrp;
+	struct ifconf 	ifc;
+	char buf[1024];
+	int		n, i;
+	unsigned char 	*a;
+	
+/*
+ * BSD 4.4 defines the size of an ifreq to be
+ * max(sizeof(ifreq), sizeof(ifreq.ifr_name)+ifreq.ifr_addr.sa_len
+ * However, under earlier systems, sa_len isn't present, so the size is 
+ * just sizeof(struct ifreq)
+ */
+#ifdef HAVE_SA_LEN
+#ifndef max
+#define max(a,b) ((a) > (b) ? (a) : (b))
+#endif
+#define ifreq_size(i) max(sizeof(struct ifreq),\
+     sizeof((i).ifr_name)+(i).ifr_addr.sa_len)
+#else
+#define ifreq_size(i) sizeof(struct ifreq)
+#endif /* HAVE_SA_LEN*/
+
+	sd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+	if (sd < 0) {
+		return -1;
+	}
+	memset(buf, 0, sizeof(buf));
+	ifc.ifc_len = sizeof(buf);
+	ifc.ifc_buf = buf;
+	if (ioctl (sd, SIOCGIFCONF, (char *)&ifc) < 0) {
+		close(sd);
+		return -1;
+	}
+	n = ifc.ifc_len;
+	for (i = 0; i < n; i+= ifreq_size(*ifr) ) {
+		ifrp = (struct ifreq *)((char *) ifc.ifc_buf+i);
+		strncpy(ifr.ifr_name, ifrp->ifr_name, IFNAMSIZ);		/* Flawfinder: ignore */
+#ifdef SIOCGIFHWADDR
+		if (ioctl(sd, SIOCGIFHWADDR, &ifr) < 0)
+			continue;
+		a = (unsigned char *) &ifr.ifr_hwaddr.sa_data;
+#else
+#ifdef SIOCGENADDR
+		if (ioctl(sd, SIOCGENADDR, &ifr) < 0)
+			continue;
+		a = (unsigned char *) ifr.ifr_enaddr;
+#else
+		/*
+		 * XXX we don't have a way of getting the hardware
+		 * address
+		 */
+		close(sd);
+		return 0;
+#endif /* SIOCGENADDR */
+#endif /* SIOCGIFHWADDR */
+		if (!a[0] && !a[1] && !a[2] && !a[3] && !a[4] && !a[5])
+			continue;
+		if (node_id) {
+			memcpy(node_id, a, 6);		/* Flawfinder: ignore */
+			close(sd);
+			return 1;
+		}
+	}
+	close(sd);
+	return 0;
+}
+
+#endif
+
+S32 LLUUID::cmpTime(uuid_time_t *t1, uuid_time_t *t2)
+{
+   // Compare two time values.
+
+   if (t1->high < t2->high) return -1;
+   if (t1->high > t2->high) return 1;
+   if (t1->low  < t2->low)  return -1;
+   if (t1->low  > t2->low)  return 1;
+   return 0;
+}
+
+void LLUUID::getSystemTime(uuid_time_t *timestamp)
+{
+   // Get system time with 100ns precision. Time is since Oct 15, 1582.
+#if LL_WINDOWS
+   ULARGE_INTEGER time;
+   GetSystemTimeAsFileTime((FILETIME *)&time);
+   // NT keeps time in FILETIME format which is 100ns ticks since
+   // Jan 1, 1601. UUIDs use time in 100ns ticks since Oct 15, 1582.
+   // The difference is 17 Days in Oct + 30 (Nov) + 31 (Dec)
+   // + 18 years and 5 leap days.
+   time.QuadPart +=
+            (unsigned __int64) (1000*1000*10)       // seconds
+          * (unsigned __int64) (60 * 60 * 24)       // days
+          * (unsigned __int64) (17+30+31+365*18+5); // # of days
+
+   timestamp->high = time.HighPart;
+   timestamp->low  = time.LowPart;
+#else
+   struct timeval tp;
+   gettimeofday(&tp, 0);
+
+   // Offset between UUID formatted times and Unix formatted times.
+   // UUID UTC base time is October 15, 1582.
+   // Unix base time is January 1, 1970.
+   U64 uuid_time = ((U64)tp.tv_sec * 10000000) + (tp.tv_usec * 10) +
+                           U64L(0x01B21DD213814000);
+   timestamp->high = (U32) (uuid_time >> 32);
+   timestamp->low  = (U32) (uuid_time & 0xFFFFFFFF);
+#endif
+}
+
+void LLUUID::getCurrentTime(uuid_time_t *timestamp)
+{
+   // Get current time as 60 bit 100ns ticks since whenever.
+   // Compensate for the fact that real clock resolution is less
+   // than 100ns.
+
+   const U32 uuids_per_tick = 1024;
+
+   static uuid_time_t time_last;
+   static U32    uuids_this_tick;
+   static BOOL     init = FALSE;
+
+   if (!init) {
+      getSystemTime(&time_last);
+      uuids_this_tick = uuids_per_tick;
+      init = TRUE;
+   }
+
+   uuid_time_t time_now = {0,0};
+
+   while (1) {
+      getSystemTime(&time_now);
+
+      // if clock reading changed since last UUID generated
+      if (cmpTime(&time_last, &time_now))  {
+         // reset count of uuid's generated with this clock reading
+         uuids_this_tick = 0;
+         break;
+      }
+      if (uuids_this_tick < uuids_per_tick) {
+         uuids_this_tick++;
+         break;
+      }
+      // going too fast for our clock; spin
+   }
+
+   time_last = time_now;
+
+   if (uuids_this_tick != 0) {
+      if (time_now.low & 0x80000000) {
+         time_now.low += uuids_this_tick;
+         if (!(time_now.low & 0x80000000))
+            time_now.high++;
+      } else
+         time_now.low += uuids_this_tick;
+   }
+
+   timestamp->high = time_now.high;
+   timestamp->low  = time_now.low;
+}
+
+void LLUUID::generate()
+{
+	// Create a UUID.
+	uuid_time_t timestamp;
+
+	static unsigned char node_id[6];	/* Flawfinder: ignore */
+	static int has_init = 0;
+   
+	// Create a UUID.
+	static uuid_time_t time_last = {0,0};
+	static U16 clock_seq = 0;
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+	static U32 seed = 0L; // dummy seed.  reset it below
+#endif
+	if (!has_init) 
+	{
+		if (getNodeID(node_id) <= 0) 
+		{
+			get_random_bytes(node_id, 6);
+			/*
+			 * Set multicast bit, to prevent conflicts
+			 * with IEEE 802 addresses obtained from
+			 * network cards
+			 */
+			node_id[0] |= 0x80;
+		}
+
+		getCurrentTime(&time_last);
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		seed = time_last.low;
+#endif
+
+#if LL_USE_JANKY_RANDOM_NUMBER_GENERATOR
+		clock_seq = (U16)janky_fast_random_seeded_bytes(seed, 65536);
+#else
+		clock_seq = (U16)ll_rand(65536);
+#endif
+		has_init = 1;
+	}
+
+	// get current time
+	getCurrentTime(&timestamp);
+
+	// if clock went backward change clockseq
+	if (cmpTime(&timestamp, &time_last) == -1) {
+		clock_seq = (clock_seq + 1) & 0x3FFF;
+		if (clock_seq == 0) clock_seq++;
+	}
+
+	memcpy(mData+10, node_id, 6);		/* Flawfinder: ignore */
+	U32 tmp;
+	tmp = timestamp.low;
+	mData[3] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[2] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[1] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[0] = (unsigned char) tmp;
+	
+	tmp = (U16) timestamp.high;
+	mData[5] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[4] = (unsigned char) tmp;
+
+	tmp = (timestamp.high >> 16) | 0x1000;
+	mData[7] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[6] = (unsigned char) tmp;
+
+	tmp = clock_seq;
+	mData[9] = (unsigned char) tmp;
+	tmp >>= 8;
+	mData[8] = (unsigned char) tmp;
+
+	LLMD5 md5_uuid;
+	
+	md5_uuid.update(mData,16);
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(mData);
+
+    time_last = timestamp;
+}
+
+void LLUUID::generate(const std::string& hash_string)
+{
+	LLMD5 md5_uuid((U8*)hash_string.c_str());
+	md5_uuid.raw_digest(mData);
+}
+
+U32 LLUUID::getRandomSeed()
+{
+   static unsigned char seed[16];		/* Flawfinder: ignore */
+   
+   getNodeID(&seed[0]);
+   seed[6]='\0';
+   seed[7]='\0';
+   getSystemTime((uuid_time_t *)(&seed[8]));
+
+   LLMD5 md5_seed;
+	
+   md5_seed.update(seed,16);
+   md5_seed.finalize();
+   md5_seed.raw_digest(seed);
+   
+   return(*(U32 *)seed);
+}
+
+BOOL LLUUID::parseUUID(const std::string& buf, LLUUID* value)
+{
+	if( buf.empty() || value == NULL)
+	{
+		return FALSE;
+	}
+
+	std::string temp( buf );
+	LLStringUtil::trim(temp);
+	if( LLUUID::validate( temp ) )
+	{
+		value->set( temp );
+		return TRUE;
+	}
+	return FALSE;
+}
+
+//static
+LLUUID LLUUID::generateNewID(std::string hash_string)
+{
+	LLUUID new_id;
+	if (hash_string.empty())
+	{
+		new_id.generate();
+	}
+	else
+	{
+		new_id.generate(hash_string);
+	}
+	return new_id;
+}
+
+LLAssetID LLTransactionID::makeAssetID(const LLUUID& session) const
+{
+	LLAssetID result;
+	if (isNull())
+	{
+		result.setNull();
+	}
+	else
+	{
+		combine(session, result);
+	}
+	return result;
+}
-- 
cgit v1.2.3


From ff52ac089f9ed67410f80fe66d0b997f0f2dafcc Mon Sep 17 00:00:00 2001
From: Roxanne Skelly <roxie@lindenlab.com>
Date: Wed, 15 Jul 2009 21:50:42 +0000
Subject: DEV-34822 viewer 1.23 merge DEV-32649 Merge the diamondware/vivox
 voice code -r124876 -r125220

---
 indra/newview/CMakeLists.txt                       |    4 +
 indra/newview/app_settings/logcontrol.xml          |    6 +-
 indra/newview/app_settings/settings.xml            |   55 +
 indra/newview/llagent.cpp                          |    2 +-
 indra/newview/llappviewer.cpp                      |    7 +-
 indra/newview/llavataractions.cpp                  |    2 +-
 indra/newview/llbottomtray.cpp                     |    2 +-
 indra/newview/llcallfloater.cpp                    |   33 +-
 indra/newview/llfloaterabout.cpp                   |   14 +-
 indra/newview/llfloaterchatterbox.cpp              |    2 +-
 indra/newview/llfloatervoicedevicesettings.cpp     |   38 +-
 indra/newview/llimpanel.cpp                        |   14 +-
 indra/newview/llimview.cpp                         |   25 +-
 indra/newview/llinspectavatar.cpp                  |    6 +-
 indra/newview/lllogininstance.cpp                  |    1 +
 indra/newview/lloutputmonitorctrl.cpp              |    8 +-
 indra/newview/lloutputmonitorctrl.h                |    2 +-
 indra/newview/lloverlaybar.cpp                     |    2 +-
 indra/newview/llpanelimcontrolpanel.cpp            |    2 +-
 indra/newview/llparticipantlist.cpp                |    3 +-
 indra/newview/llspeakbutton.cpp                    |   10 +-
 indra/newview/llspeakers.cpp                       |   39 +-
 indra/newview/llstartup.cpp                        |   46 +-
 indra/newview/llurl.cpp                            |    6 +
 indra/newview/llurl.h                              |    1 +
 indra/newview/llvieweraudio.cpp                    |   10 +-
 indra/newview/llviewercontrol.cpp                  |    4 +-
 indra/newview/llviewerwindow.cpp                   |    8 +-
 indra/newview/llvoavatar.cpp                       |   10 +-
 indra/newview/llvoicechannel.cpp                   |   64 +-
 indra/newview/llvoicechannel.h                     |    3 +-
 indra/newview/llvoiceclient.cpp                    | 7079 ++------------------
 indra/newview/llvoiceclient.h                      |  970 +--
 indra/newview/llvoicevivox.cpp                     | 6900 +++++++++++++++++++
 indra/newview/llvoicevivox.h                       |  905 +++
 .../newview/skins/default/xui/en/floater_about.xml |    2 +-
 indra/newview/viewer_manifest.py                   |   17 +
 indra/viewer_components/login/lllogin.cpp          |    1 +
 38 files changed, 8783 insertions(+), 7520 deletions(-)
 create mode 100644 indra/newview/llvoicevivox.cpp
 create mode 100644 indra/newview/llvoicevivox.h

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 7891add9b8..cf28d9da5e 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -515,8 +515,10 @@ set(viewer_SOURCE_FILES
     llvoground.cpp
     llvoicechannel.cpp
     llvoiceclient.cpp
+    llvoicedw.cpp
     llvoiceremotectrl.cpp
     llvoicevisualizer.cpp
+    llvoicevivox.cpp
     llvoinventorylistener.cpp
     llvopartgroup.cpp
     llvosky.cpp
@@ -1018,8 +1020,10 @@ set(viewer_HEADER_FILES
     llvoground.h
     llvoicechannel.h
     llvoiceclient.h
+    llvoicedw.h
     llvoiceremotectrl.h
     llvoicevisualizer.h
+    llvoicevivox.h
     llvoinventorylistener.h
     llvopartgroup.h
     llvosky.h
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 0eb98e3311..229f15852d 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -19,8 +19,7 @@
 						</array>
 					<key>tags</key>
 						<array>
-							<string>AppInit</string>
-							<string>LLLogin</string>
+							<string>Voice</string>
 						</array>
 				</map>
 				<map>
@@ -36,8 +35,7 @@
 						</array>
 					<key>tags</key>
 						<array>
-							<string>AppInit</string>
-							<string>LLLogin</string>
+							<string>Voice</string>
 						</array>
 				</map>
 			</array>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 1641ab0ce1..8ca330ca33 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10312,6 +10312,17 @@
       <key>Value</key>
       <string></string>
     </map>
+    <key>VivoxDebugSIPURIHostName</key>
+    <map>
+      <key>Comment</key>
+      <string>Hostname portion of vivox SIP URIs (empty string for the default).</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string></string>
+    </map>
     <key>VivoxDebugVoiceAccountServerURI</key>
     <map>
       <key>Comment</key>
@@ -10323,6 +10334,28 @@
       <key>Value</key>
       <string></string>
     </map>
+    <key>VivoxVoiceHost</key>
+    <map>
+      <key>Comment</key>
+      <string>Client SLVoice host to connect to</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>127.0.0.1</string>
+    </map>
+    <key>VivoxVoicePort</key>
+    <map>
+      <key>Comment</key>
+      <string>Client SLVoice port to connect to</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>44125</integer>
+    </map>
     <key>VoiceCallsFriendsOnly</key>
     <map>
       <key>Comment</key>
@@ -10455,6 +10488,17 @@
       <key>Value</key>
       <string>Default</string>
     </map>
+    <key>VoiceLogFile</key>
+    <map>
+      <key>Comment</key>
+      <string>Log file to use when launching the voice daemon</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string></string>
+    </map>
     <key>VoiceOutputAudioDevice</key>
     <map>
       <key>Comment</key>
@@ -10499,6 +10543,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>VoiceServerType</key>
+    <map>
+      <key>Comment</key>
+      <string>The type of voice server to connect to.</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>vivox</string>
+    </map>
     <key>WLSkyDetail</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 5e2e374df6..b5cad710a8 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5972,7 +5972,7 @@ bool LLAgent::teleportCore(bool is_local)
 	
 	// MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
 	// This was breaking the case of teleporting within a single sim.  Backing it out for now.
-//	gVoiceClient->leaveChannel();
+//	LLVoiceClient::getInstance()->leaveChannel();
 	
 	return true;
 }
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index c2f8487aa9..c1d1734cfb 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -920,8 +920,7 @@ bool LLAppViewer::mainLoop()
 	
 	// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
 
-	LLVoiceChannel::initClass();
-	LLVoiceClient::init(gServicePump);
+	LLVoiceClient::getInstance()->init(gServicePump);
 				
 	LLTimer frameTimer,idleTimer;
 	LLTimer debugTime;
@@ -1241,7 +1240,7 @@ bool LLAppViewer::cleanup()
 	// to ensure shutdown order
 	LLMortician::setZealous(TRUE);
 
-	LLVoiceClient::terminate();
+	LLVoiceClient::getInstance()->terminate();
 	
 	disconnectViewer();
 
@@ -3807,7 +3806,7 @@ void LLAppViewer::sendLogoutRequest()
 		gLogoutMaxTime = LOGOUT_REQUEST_TIME;
 		mLogoutRequestSent = TRUE;
 		
-		gVoiceClient->leaveChannel();
+		LLVoiceClient::getInstance()->leaveChannel();
 
 		//Set internal status variables and marker files
 		gLogoutInProgress = TRUE;
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index c3deb602ee..118a546ada 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -290,7 +290,7 @@ bool LLAvatarActions::canCall(const LLUUID &id)
 		// can be only ONLINE. There is no way to see "usual resident" in OFFLINE status. If we see "usual
 		// resident" it automatically means that the resident is ONLINE. So to make a call to the "usual resident"
 		// we need to check only that "our" voice is enabled.
-		return LLVoiceClient::voiceEnabled();
+		return LLVoiceClient::getInstance()->voiceEnabled();
 	}
 
 }
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 976b312509..8722ffd152 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -365,7 +365,7 @@ BOOL LLBottomTray::postBuild()
 	mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
 
 	// Registering Chat Bar to receive Voice client status change notifications.
-	gVoiceClient->addObserver(this);
+	LLVoiceClient::getInstance()->addObserver(this);
 
 	mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
 	mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 1468f6d584..38782226d6 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -143,9 +143,9 @@ LLCallFloater::~LLCallFloater()
 
 	// Don't use LLVoiceClient::getInstance() here 
 	// singleton MAY have already been destroyed.
-	if(gVoiceClient)
+	if(LLVoiceClient::getInstance())
 	{
-		gVoiceClient->removeObserver(this);
+		LLVoiceClient::getInstance()->removeObserver(this);
 	}
 	LLTransientFloaterMgr::getInstance()->removeControlView(this);
 }
@@ -194,7 +194,7 @@ void LLCallFloater::draw()
 	// Seems this is a problem somewhere in Voice Client (LLVoiceClient::participantAddedEvent)
 //	onChange();
 
-	bool is_moderator_muted = gVoiceClient->getIsModeratorMuted(gAgentID);
+	bool is_moderator_muted = LLVoiceClient::getInstance()->getIsModeratorMuted(gAgentID);
 
 	if (mIsModeratorMutedVoice != is_moderator_muted)
 	{
@@ -212,7 +212,6 @@ void LLCallFloater::draw()
 void LLCallFloater::onChange()
 {
 	if (NULL == mParticipants) return;
-
 	updateParticipantsVoiceState();
 
 	// Add newly joined participants.
@@ -252,11 +251,11 @@ void LLCallFloater::updateSession()
 	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
 	if (voice_channel)
 	{
-		lldebugs << "Current voice channel: " << voice_channel->getSessionID() << llendl;
+		LL_DEBUGS("Voice") << "Current voice channel: " << voice_channel->getSessionID() << LL_ENDL;
 
 		if (mSpeakerManager && voice_channel->getSessionID() == mSpeakerManager->getSessionID())
 		{
-			lldebugs << "Speaker manager is already set for session: " << voice_channel->getSessionID() << llendl;
+			LL_DEBUGS("Voice") << "Speaker manager is already set for session: " << voice_channel->getSessionID() << LL_ENDL;
 			return;
 		}
 		else
@@ -266,7 +265,7 @@ void LLCallFloater::updateSession()
 	}
 
 	const LLUUID& session_id = voice_channel->getSessionID();
-	lldebugs << "Set speaker manager for session: " << session_id << llendl;
+	LL_DEBUGS("Voice") << "Set speaker manager for session: " << session_id << LL_ENDL;
 
 	LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
 	if (im_session)
@@ -306,7 +305,7 @@ void LLCallFloater::updateSession()
 	{
 		// by default let show nearby chat participants
 		mSpeakerManager = LLLocalSpeakerMgr::getInstance();
-		lldebugs << "Set DEFAULT speaker manager" << llendl;
+		LL_DEBUGS("Voice") << "Set DEFAULT speaker manager" << LL_ENDL;
 		mVoiceType = VC_LOCAL_CHAT;
 	}
 
@@ -482,16 +481,14 @@ void LLCallFloater::updateAgentModeratorState()
 static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids)
 {
 	// Get a list of participants from VoiceClient
-	LLVoiceClient::participantMap *voice_map = gVoiceClient->getParticipantList();
-	if (voice_map)
+	std::vector<LLUUID> participants = LLVoiceClient::getInstance()->getParticipantList();
+	
+	for (std::vector<LLUUID>::const_iterator iter = participants.begin();
+		 iter != participants.end(); ++iter)
 	{
-		for (LLVoiceClient::participantMap::const_iterator iter = voice_map->begin();
-			iter != voice_map->end(); ++iter)
-		{
-			LLUUID id = (*iter).second->mAvatarID;
-			speakers_uuids.push_back(id);
-		}
+		speakers_uuids.push_back(*iter);
 	}
+
 }
 
 void LLCallFloater::initParticipantsVoiceState()
@@ -567,7 +564,7 @@ void LLCallFloater::updateParticipantsVoiceState()
 
 		std::vector<LLUUID>::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
 
-		lldebugs << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << llendl;
+		LL_DEBUGS("Voice") << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << LL_ENDL;
 
 		// If an avatarID assigned to a panel is found in a speakers list
 		// obtained from VoiceClient we assign the JOINED status to the owner
@@ -611,7 +608,7 @@ void LLCallFloater::updateParticipantsVoiceState()
 			}
 			else
 			{
-				llwarns << "Unsupported (" << getState(participant_id) << ") state: " << item->getAvatarName()  << llendl;
+				llwarns << "Unsupported (" << getState(participant_id) << ") state: " << item->getAvatarName()  << LL_ENDL;
 			}
 		}
 	}
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index aa343b2f69..775ccfa0d8 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -266,8 +266,18 @@ LLSD LLFloaterAbout::getInfo()
 	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
 	bool want_fullname = true;
 	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
-	info["VIVOX_VERSION"] = gVoiceClient ? gVoiceClient->getAPIVersion() : LLTrans::getString("NotConnected");
-
+	if(LLVoiceClient::getInstance()->voiceEnabled())
+	{
+		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
+		std::ostringstream version_string;
+		version_string << version.serverType << " " << version.serverVersion << std::endl;
+		info["VOICE_VERSION"] = version_string.str();
+	}
+	else 
+	{
+		info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
+	}
+	
 	// TODO: Implement media plugin version query
 	info["QT_WEBKIT_VERSION"] = "4.5.2 (version number hard-coded)";
 
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index 9108cfb72b..5a5d88b058 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -343,7 +343,7 @@ LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
 //static 
 LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
 {
-	if (!LLVoiceClient::voiceEnabled())
+	if (!LLVoiceClient::getInstance()->voiceEnabled())
 	{
 		return NULL;
 	}
diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp
index 43024a4bd0..0e437fb9b3 100644
--- a/indra/newview/llfloatervoicedevicesettings.cpp
+++ b/indra/newview/llfloatervoicedevicesettings.cpp
@@ -64,9 +64,6 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
 	// grab "live" mic volume level
 	mMicVolume = gSavedSettings.getF32("AudioLevelMic");
 
-	// ask for new device enumeration
-	// now do this in onOpen() instead...
-	//gVoiceClient->refreshDeviceLists();
 }
 
 LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
@@ -105,12 +102,12 @@ void LLPanelVoiceDeviceSettings::draw()
 	refresh();
 
 	// let user know that volume indicator is not yet available
-	bool is_in_tuning_mode = gVoiceClient->inTuningMode();
+	bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
 	childSetVisible("wait_text", !is_in_tuning_mode);
 
 	LLPanel::draw();
 
-	F32 voice_power = gVoiceClient->tuningGetEnergy();
+	F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy();
 	S32 discrete_power = 0;
 
 	if (!is_in_tuning_mode)
@@ -193,13 +190,13 @@ void LLPanelVoiceDeviceSettings::refresh()
 	LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
 	// set mic volume tuning slider based on last mic volume setting
 	F32 current_volume = (F32)volume_slider->getValue().asReal();
-	gVoiceClient->tuningSetMicVolume(current_volume);
+	LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
 
 	// Fill in popup menus
 	mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
 	mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
 
-	if(!gVoiceClient->deviceSettingsAvailable())
+	if(!LLVoiceClient::getInstance()->deviceSettingsAvailable())
 	{
 		// The combo boxes are disabled, since we can't get the device settings from the daemon just now.
 		// Put the currently set default (ONLY) in the box, and select it.
@@ -218,17 +215,16 @@ void LLPanelVoiceDeviceSettings::refresh()
 	}
 	else if (!mDevicesUpdated)
 	{
-		LLVoiceClient::deviceList *devices;
-		
-		LLVoiceClient::deviceList::iterator iter;
+		LLVoiceDeviceList::const_iterator iter;
 		
 		if(mCtrlInputDevices)
 		{
 			mCtrlInputDevices->removeall();
 			mCtrlInputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			devices = gVoiceClient->getCaptureDevices();
-			for(iter=devices->begin(); iter != devices->end(); iter++)
+			for(iter=LLVoiceClient::getInstance()->getCaptureDevices().begin(); 
+				iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
+				iter++)
 			{
 				mCtrlInputDevices->add( *iter, ADD_BOTTOM );
 			}
@@ -244,8 +240,8 @@ void LLPanelVoiceDeviceSettings::refresh()
 			mCtrlOutputDevices->removeall();
 			mCtrlOutputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			devices = gVoiceClient->getRenderDevices();
-			for(iter=devices->begin(); iter != devices->end(); iter++)
+			for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin(); 
+				iter !=  LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
 			{
 				mCtrlOutputDevices->add( *iter, ADD_BOTTOM );
 			}
@@ -267,34 +263,34 @@ void LLPanelVoiceDeviceSettings::initialize()
 	mDevicesUpdated = FALSE;
 
 	// ask for new device enumeration
-	gVoiceClient->refreshDeviceLists();
+	LLVoiceClient::getInstance()->refreshDeviceLists();
 
 	// put voice client in "tuning" mode
-	gVoiceClient->tuningStart();
+	LLVoiceClient::getInstance()->tuningStart();
 	LLVoiceChannel::suspend();
 }
 
 void LLPanelVoiceDeviceSettings::cleanup()
 {
-	gVoiceClient->tuningStop();
+	LLVoiceClient::getInstance()->tuningStop();
 	LLVoiceChannel::resume();
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitInputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(gVoiceClient)
+	if(LLVoiceClient::getInstance())
 	{
-		gVoiceClient->setCaptureDevice(ctrl->getValue().asString());
+		LLVoiceClient::getInstance()->setCaptureDevice(ctrl->getValue().asString());
 	}
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(gVoiceClient)
+	if(LLVoiceClient::getInstance())
 	{
-		gVoiceClient->setRenderDevice(ctrl->getValue().asString());
+		LLVoiceClient::getInstance()->setRenderDevice(ctrl->getValue().asString());
 	}
 }
 
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 029ddbaf2c..74e0a06a34 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -300,7 +300,7 @@ void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
 	LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
 	if (floaterp)
 	{
-		gVoiceClient->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
+		LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
 	}
 }
 
@@ -312,7 +312,7 @@ void LLFloaterIMPanel::draw()
 	
 	BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
 					  && mSessionInitialized
-					  && LLVoiceClient::voiceEnabled()
+					  && LLVoiceClient::getInstance()->voiceEnabled()
 					  && mCallBackEnabled;
 
 	// hide/show start call and end call buttons
@@ -320,8 +320,8 @@ void LLFloaterIMPanel::draw()
 	if (!voice_channel)
 		return;
 
-	childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
-	childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
 	childSetEnabled("start_call_btn", enable_connect);
 	childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
 	
@@ -384,11 +384,11 @@ void LLFloaterIMPanel::draw()
 	else
 	{
 		// refresh volume and mute checkbox
-		childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
-		childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID));
+		childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+		childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
 
 		childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
-		childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
+		childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
 	}
 	LLFloater::draw();
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index daabf1f717..15e657c866 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -331,13 +331,13 @@ LLIMModel::LLIMSession::~LLIMSession()
 	mSpeakers = NULL;
 
 	// End the text IM session if necessary
-	if(gVoiceClient && mOtherParticipantID.notNull())
+	if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
 	{
 		switch(mType)
 		{
 		case IM_NOTHING_SPECIAL:
 		case IM_SESSION_P2P_INVITE:
-			gVoiceClient->endUserIMSession(mOtherParticipantID);
+			LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
 			break;
 
 		default:
@@ -857,7 +857,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 	if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
 	{
 		// User is online through the OOW connector, but not with a regular viewer.  Try to send the message via SLVoice.
-		sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
+		sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
 	}
 	
 	if(!sent)
@@ -1723,7 +1723,11 @@ bool LLIncomingCallDialog::lifetimeHasExpired()
 void LLIncomingCallDialog::onLifetimeExpired()
 {
 	// check whether a call is valid or not
-	if (LLVoiceClient::getInstance()->findSession(mPayload["caller_id"].asUUID()))
+	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mPayload["session_id"].asUUID());
+	if(channelp &&
+	   (channelp->getState() != LLVoiceChannel::STATE_NO_CHANNEL_INFO) &&
+	   (channelp->getState() != LLVoiceChannel::STATE_ERROR) &&
+	   (channelp->getState() != LLVoiceChannel::STATE_HUNG_UP))
 	{
 		// restart notification's timer if call is still valid
 		mLifetimeTimer.start();
@@ -1952,10 +1956,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-			if(gVoiceClient)
+			if(LLVoiceClient::getInstance())
 			{
 				std::string s = mPayload["session_handle"].asString();
-				gVoiceClient->declineInvite(s);
+				LLVoiceClient::getInstance()->declineInvite(s);
 			}
 		}
 		else
@@ -2043,11 +2047,8 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-			if(gVoiceClient)
-			{
-				std::string s = payload["session_handle"].asString();
-				gVoiceClient->declineInvite(s);
-			}
+		  std::string s = payload["session_handle"].asString();
+		  LLVoiceClient::getInstance()->declineInvite(s);
 		}
 		else
 		{
@@ -3156,7 +3157,7 @@ public:
 				return;
 			}
 			
-			if(!LLVoiceClient::voiceEnabled())
+			if(!LLVoiceClient::getInstance()->voiceEnabled())
 			{
 				// Don't display voice invites unless the user has voice enabled.
 				return;
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index a2b3a54f51..ea55d25106 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -517,7 +517,7 @@ void LLInspectAvatar::updateVolumeSlider()
 	// By convention, we only display and toggle voice mutes, not all mutes
 	bool is_muted = LLMuteList::getInstance()->
 						isMuted(mAvatarID, LLMute::flagVoiceChat);
-	bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
+	bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
 	bool is_self = (mAvatarID == gAgent.getID());
 
 	LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
@@ -544,7 +544,7 @@ void LLInspectAvatar::updateVolumeSlider()
 	else
 	{
 		// actual volume
-		volume = gVoiceClient->getUserVolume(mAvatarID);
+		volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
 
 		// *HACK: Voice client doesn't have any data until user actually
 		// says something.
@@ -578,7 +578,7 @@ void LLInspectAvatar::onClickMuteVolume()
 void LLInspectAvatar::onVolumeChange(const LLSD& data)
 {
 	F32 volume = (F32)data.asReal();
-	gVoiceClient->setUserVolume(mAvatarID, volume);
+	LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
 }
 
 void LLInspectAvatar::nameUpdatedCallback(
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 04e5cef62e..c58a220ee8 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -150,6 +150,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 	requested_options.append("buddy-list");
 	requested_options.append("ui-config");
 #endif
+	requested_options.append("voice-config");
 	requested_options.append("tutorial_setting");
 	requested_options.append("login-flags");
 	requested_options.append("global-textures");
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 63803469dd..953121bd6f 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -119,7 +119,7 @@ void LLOutputMonitorCtrl::draw()
 {
 	// Copied from llmediaremotectrl.cpp
 	// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
-	// call directly into gVoiceClient to ask if that agent-id is muted, is
+	// call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
 	// speaking, and what power.  This avoids duplicating data, which can get
 	// out of sync.
 	const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
@@ -128,14 +128,14 @@ void LLOutputMonitorCtrl::draw()
 
 	if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
 	{
-		setPower(gVoiceClient->getCurrentPower(mSpeakerId));
+		setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
 		if(mIsAgentControl)
 		{
-			setIsTalking(gVoiceClient->getUserPTTState());
+			setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
 		}
 		else
 		{
-			setIsTalking(gVoiceClient->getIsSpeaking(mSpeakerId));
+			setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
 		}
 	}
 
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 85ea552a57..e6dbde41db 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -112,7 +112,7 @@ private:
 	LLPointer<LLUIImage> mImageLevel2;
 	LLPointer<LLUIImage> mImageLevel3;
 
-	/** whether to deal with gVoiceClient directly */
+	/** whether to deal with LLVoiceClient::getInstance() directly */
 	bool			mAutoUpdate;
 
 	/** uuid of a speaker being monitored */
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index 67e048885f..3f1b23ba14 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -258,7 +258,7 @@ void LLOverlayBar::refresh()
 	{
 		// update "remotes"
 		childSetVisible("media_remote_container", TRUE);
-		childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
+		childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
 		childSetVisible("state_buttons", TRUE);
 	}
 
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index b547997e7a..0111a200e8 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -92,7 +92,7 @@ BOOL LLPanelChatControlPanel::postBuild()
 void LLPanelChatControlPanel::draw()
 {
 	// hide/show start call and end call buttons
-	bool voice_enabled = LLVoiceClient::voiceEnabled();
+	bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled();
 
 	LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
 	if (!session) return;
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index e2da4c4475..ce946121df 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -336,7 +336,6 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
 {
 	if (mExcludeAgent && gAgent.getID() == avatar_id) return;
 	if (mAvatarList->contains(avatar_id)) return;
-
 	mAvatarList->getIDs().push_back(avatar_id);
 	mAvatarList->setDirty();
 	adjustParticipant(avatar_id);
@@ -622,7 +621,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 	}
 	else if (item == "can_call")
 	{
-		return LLVoiceClient::voiceEnabled();
+		return LLVoiceClient::getInstance()->voiceEnabled();
 	}
 
 	return true;
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index 8f2c877c7a..068ff34b36 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -59,9 +59,9 @@ LLSpeakButton::Params::Params()
 
 void LLSpeakButton::draw()
 {
-	// gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
-	bool openmic = gVoiceClient->getUserPTTState();
-	bool voiceenabled = gVoiceClient->voiceEnabled();
+	// LLVoiceClient::getInstance() is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
+	bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
+	bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
 	mSpeakBtn->setToggleState(openmic && voiceenabled);
 	mOutputMonitor->setIsMuted(!voiceenabled);
 	LLUICtrl::draw();
@@ -166,11 +166,11 @@ void LLSpeakButton::setLabelVisible(bool visible)
 void LLSpeakButton::onMouseDown_SpeakBtn()
 {
 	bool down = true;
-	gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
+	LLVoiceClient::getInstance()->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
 }
 void LLSpeakButton::onMouseUp_SpeakBtn()
 {
 	bool down = false;
-	gVoiceClient->inputUserControlState(down);
+	LLVoiceClient::getInstance()->inputUserControlState(down);
 }
 
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 010dfd1b33..a45c51784a 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -72,7 +72,7 @@ LLSpeaker::LLSpeaker(const LLUUID& id, const std::string& name, const ESpeakerTy
 		mDisplayName = name;
 	}
 
-	gVoiceClient->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id));
+	LLVoiceClient::getInstance()->setUserVolume(id, LLMuteList::getInstance()->getSavedResidentVolume(id));
 
 	mActivityTimer.resetWithExpiry(SPEAKER_TIMEOUT);
 }
@@ -210,7 +210,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 
 void LLSpeakerMgr::update(BOOL resort_ok)
 {
-	if (!gVoiceClient)
+	if (!LLVoiceClient::getInstance())
 	{
 		return;
 	}
@@ -224,7 +224,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 	}
 
 	// update status of all current speakers
-	BOOL voice_channel_active = (!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
+	BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
 	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end();)
 	{
 		LLUUID speaker_id = speaker_it->first;
@@ -232,21 +232,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 		
 		speaker_map_t::iterator  cur_speaker_it = speaker_it++;
 
-		if (voice_channel_active && gVoiceClient->getVoiceEnabled(speaker_id))
+		if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
 		{
-			speakerp->mSpeechVolume = gVoiceClient->getCurrentPower(speaker_id);
-			BOOL moderator_muted_voice = gVoiceClient->getIsModeratorMuted(speaker_id);
+			speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
+			BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
 			if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mModeratorMutedVoice = moderator_muted_voice;
 				speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
 			}
 
-			if (gVoiceClient->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
+			if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mStatus = LLSpeaker::STATUS_MUTED;
 			}
-			else if (gVoiceClient->getIsSpeaking(speaker_id))
+			else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
 			{
 				// reset inactivity expiration
 				if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
@@ -341,19 +341,20 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 void LLSpeakerMgr::updateSpeakerList()
 {
 	// are we bound to the currently active voice channel?
-	if ((!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
+	if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
 	{
-		LLVoiceClient::participantMap* participants = gVoiceClient->getParticipantList();
-		if(participants)
+		std::vector<LLUUID> participants = LLVoiceClient::getInstance()->getParticipantList();
+		// add new participants to our list of known speakers
+		for (std::vector<LLUUID>::iterator participant_it = participants.begin();
+			 participant_it != participants.end(); 
+			 ++participant_it)
 		{
-			LLVoiceClient::participantMap::iterator participant_it;
+				setSpeaker(*participant_it, 
+						   LLVoiceClient::getInstance()->getDisplayName(*participant_it),
+						   LLSpeaker::STATUS_VOICE_ACTIVE, 
+						   (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
+
 
-			// add new participants to our list of known speakers
-			for (participant_it = participants->begin(); participant_it != participants->end(); ++participant_it)
-			{
-				LLVoiceClient::participantState* participantp = participant_it->second;
-				setSpeaker(participantp->mAvatarID, participantp->mDisplayName, LLSpeaker::STATUS_VOICE_ACTIVE, (participantp->isAvatar()?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
-			}
 		}
 	}
 }
@@ -414,7 +415,7 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
 BOOL LLSpeakerMgr::isVoiceActive()
 {
 	// mVoiceChannel = NULL means current voice channel, whatever it is
-	return LLVoiceClient::voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
+	return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
 }
 
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index d1c6fca063..95158a9ae3 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -189,6 +189,7 @@
 #include "llinventorybridge.h"
 #include "llappearancemgr.h"
 #include "llavatariconctrl.h"
+#include "llvoicechannel.h"
 
 #include "lllogin.h"
 #include "llevents.h"
@@ -1157,7 +1158,11 @@ bool idle_startup()
 			if(process_login_success_response())
 			{
 				// Pass the user information to the voice chat server interface.
-				gVoiceClient->userAuthorized(gUserCredential->userID(), gAgentID);
+				LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
+				// create the default proximal channel
+				LLVoiceChannel::initClass();
+				// update the voice settings
+				LLVoiceClient::getInstance()->updateSettings();
 				LLGridManager::getInstance()->setFavorite(); 
 				LLStartUp::setStartupState( STATE_WORLD_INIT);
 			}
@@ -3008,7 +3013,44 @@ bool process_login_success_response()
 		//setup map of datetime strings to codes and slt & local time offset from utc
 		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
 	}
-
+	
+	static const char* CONFIG_OPTIONS[] = {"voice-config"};
+	for (int i = 0; i < sizeof(CONFIG_OPTIONS)/sizeof(CONFIG_OPTIONS[0]); i++)
+	{
+		LLSD options = response[CONFIG_OPTIONS[i]];
+		if (!options.isArray() && (options.size() < 1) && !options[0].isMap())
+		{
+			continue;
+		}
+		llinfos << "config option " << CONFIG_OPTIONS[i][0] << "response " << options << llendl;
+		for(LLSD::map_iterator option_it = options[0].beginMap();
+			option_it != options[0].endMap();
+			option_it++)
+		{
+			llinfos << "trying option " << option_it->first << llendl;
+			LLPointer<LLControlVariable> control = gSavedSettings.getControl(option_it->first);
+			if(control.notNull())
+			{
+				if(control->isType(TYPE_BOOLEAN))
+				{
+					llinfos << "Setting BOOL from login " << option_it->first << " " << option_it->second << llendl;
+					
+					gSavedSettings.setBOOL(option_it->first, !((option_it->second == "F") ||
+															   (option_it->second == "false") ||
+															   (!option_it->second)));
+				}
+				else if (control->isType(TYPE_STRING))
+				{
+					llinfos << "Setting String from login " << option_it->first << " " << option_it->second << llendl;
+					gSavedSettings.setString(option_it->first, option_it->second);
+				}
+				// we don't support other types now                                                                                                            
+				
+			}
+			
+		}
+	}
+	
 	LLSD initial_outfit = response["initial-outfit"][0];
 	if(initial_outfit.size())
 	{
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index ab65ead4c5..83a5839a93 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -286,5 +286,11 @@ const char * LLURL::getFullPath()
 	return(sReturnString);
 }
 
+const char * LLURL::getAuthority()
+{
+	strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1);               /* Flawfinder: ignore */
+	LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
+	return(sReturnString);
+}
 
 char LLURL::sReturnString[LL_MAX_PATH] = "";
diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h
index 9a089dd835..e41b83d29f 100644
--- a/indra/newview/llurl.h
+++ b/indra/newview/llurl.h
@@ -79,6 +79,7 @@ public:
 
 	virtual const char *getFQURL() const;
 	virtual const char *getFullPath();
+	virtual const char *getAuthority();
 
 	virtual const char *updateRelativePath(const LLURL &url);
 
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index 38103f9e41..49caaf18f3 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -156,21 +156,21 @@ void audio_update_volume(bool force_update)
 	LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );
 
 	// Voice
-	if (gVoiceClient)
+	if (LLVoiceClient::getInstance())
 	{
 		F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
 		voice_volume = mute_volume * master_volume * voice_volume;
 		BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
-		gVoiceClient->setVoiceVolume(voice_mute ? 0.f : voice_volume);
-		gVoiceClient->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
+		LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
+		LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
 
 		if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
 		{
-			gVoiceClient->setMuteMic(true);
+			LLVoiceClient::getInstance()->setMuteMic(true);
 		}
 		else
 		{
-			gVoiceClient->setMuteMic(false);
+			LLVoiceClient::getInstance()->setMuteMic(false);
 		}
 	}
 }
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 57434bd1e4..7be45c649c 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -441,9 +441,9 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue)
 
 bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
 {
-	if(gVoiceClient)
+	if(LLVoiceClient::getInstance())
 	{
-		gVoiceClient->updateSettings();
+		LLVoiceClient::getInstance()->updateSettings();
 	}
 	return true;
 }
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ee6fb8120c..660b33a1ff 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -813,7 +813,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window,  LLCoordGL pos, MASK m
 BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = TRUE;
-	gVoiceClient->middleMouseState(true);
+	LLVoiceClient::getInstance()->middleMouseState(true);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -823,7 +823,7 @@ BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window,  LLCoordGL pos, MAS
 BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = FALSE;
-	gVoiceClient->middleMouseState(false);
+	LLVoiceClient::getInstance()->middleMouseState(false);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -939,7 +939,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
 BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	gVoiceClient->keyDown(key, mask);
+	LLVoiceClient::getInstance()->keyDown(key, mask);
 	
 	if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
 	{
@@ -961,7 +961,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key,  MASK mask)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	gVoiceClient->keyUp(key, mask);
+	LLVoiceClient::getInstance()->keyUp(key, mask);
 
 	return FALSE;
 }
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 6e93bf1bf2..341ea91c6d 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1271,7 +1271,7 @@ void LLVOAvatar::initInstance(void)
 	
 	//VTPause();  // VTune
 	
-	mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
+	mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
 }
 
 const LLVector3 LLVOAvatar::getRenderPosition() const
@@ -2192,7 +2192,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	// store off last frame's root position to be consistent with camera position
 	LLVector3 root_pos_last = mRoot.getWorldPosition();
 	BOOL detailed_update = updateCharacter(agent);
-	BOOL voice_enabled = gVoiceClient->getVoiceEnabled( mID ) && gVoiceClient->inProximalChannel();
+	BOOL voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled( mID ) && LLVoiceClient::getInstance()->inProximalChannel();
 
 	if (gNoRender)
 	{
@@ -2260,7 +2260,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 		// Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
 		// "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. 
 		//-----------------------------------------------------------------------------------------------------------------
-		if (gVoiceClient->getIsSpeaking( mID ))
+		if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
 		{		
 			if (!mVoiceVisualizer->getCurrentlySpeaking())
 			{
@@ -2269,7 +2269,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 				//printf( "gAwayTimer.reset();\n" );
 			}
 			
-			mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
+			mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
 			
 			if( isSelf() )
 			{
@@ -2498,7 +2498,7 @@ F32 LLVOAvatar::calcMorphAmount()
 void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
 {
 	// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
-	if ( voice_enabled && (gVoiceClient->lipSyncEnabled()) && gVoiceClient->getIsSpeaking( mID ) )
+	if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
 	{
 		F32 ooh_morph_amount = 0.0f;
 		F32 aah_morph_amount = 0.0f;
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 917d69fe16..4388f473b4 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -72,9 +72,9 @@ private:
 
 void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
 {
-	llwarns << "LLVoiceCallCapResponder::error("
+	LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
 		<< status << ": " << reason << ")"
-		<< llendl;
+		<< LL_ENDL;
 	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
 	if ( channelp )
 	{
@@ -104,8 +104,8 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
 		LLSD::map_const_iterator iter;
 		for(iter = content.beginMap(); iter != content.endMap(); ++iter)
 		{
-			llinfos << "LLVoiceCallCapResponder::result got " 
-				<< iter->first << llendl;
+			LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got " 
+				<< iter->first << LL_ENDL;
 		}
 
 		channelp->setChannelInfo(
@@ -130,18 +130,16 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
 	{
 		// a voice channel already exists for this session id, so this instance will be orphaned
 		// the end result should simply be the failure to make voice calls
-		llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
+		LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
 	}
-
-	LLVoiceClient::getInstance()->addObserver(this);
 }
 
 LLVoiceChannel::~LLVoiceChannel()
 {
 	// Don't use LLVoiceClient::getInstance() here -- this can get called during atexit() time and that singleton MAY have already been destroyed.
-	if(gVoiceClient)
+	if(LLVoiceClient::getInstance())
 	{
-		gVoiceClient->removeObserver(this);
+		LLVoiceClient::getInstance()->removeObserver(this);
 	}
 	
 	sVoiceChannelMap.erase(mSessionID);
@@ -161,13 +159,13 @@ void LLVoiceChannel::setChannelInfo(
 		if (mURI.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			llwarns << "Received empty URI for channel " << mSessionName << llendl;
+			LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
 			deactivate();
 		}
 		else if (mCredentials.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			llwarns << "Received empty credentials for channel " << mSessionName << llendl;
+			LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
 			deactivate();
 		}
 		else
@@ -282,13 +280,14 @@ void LLVoiceChannel::deactivate()
 		//Default mic is OFF when leaving voice calls
 		if (gSavedSettings.getBOOL("AutoDisengageMic") && 
 			sCurrentVoiceChannel == this &&
-			gVoiceClient->getUserPTTState())
+			LLVoiceClient::getInstance()->getUserPTTState())
 		{
 			gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
-			gVoiceClient->inputUserControlState(true);
+			LLVoiceClient::getInstance()->inputUserControlState(true);
 		}
 	}
-
+	LLVoiceClient::getInstance()->removeObserver(this);
+	
 	if (sCurrentVoiceChannel == this)
 	{
 		// default channel is proximal channel
@@ -328,7 +327,9 @@ void LLVoiceChannel::activate()
 	{
 		setState(STATE_CALL_STARTED);
 	}
-
+	
+	LLVoiceClient::getInstance()->addObserver(this);
+	
 	//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
 	sCurrentVoiceChannelChangedSignal(this->mSessionID);
 }
@@ -370,6 +371,11 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
 	}
 }
 
+LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
+{
+	return sCurrentVoiceChannel;
+}
+
 void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
 {
 	sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
@@ -418,7 +424,6 @@ void LLVoiceChannel::initClass()
 	sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
 }
 
-
 //static 
 void LLVoiceChannel::suspend()
 {
@@ -434,7 +439,7 @@ void LLVoiceChannel::resume()
 {
 	if (sSuspended)
 	{
-		if (gVoiceClient->voiceEnabled())
+		if (LLVoiceClient::getInstance()->voiceEnabled())
 		{
 			if (sSuspendedVoiceChannel)
 			{
@@ -504,9 +509,9 @@ void LLVoiceChannelGroup::activate()
 #endif
 
 		//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
-		if (gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+		if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
 		{
-			gVoiceClient->inputUserControlState(true);
+			LLVoiceClient::getInstance()->inputUserControlState(true);
 		}
 		
 	}
@@ -553,7 +558,7 @@ void LLVoiceChannelGroup::setChannelInfo(
 		else
 		{
 			//*TODO: notify user
-			llwarns << "Received invalid credentials for channel " << mSessionName << llendl;
+			LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
 			deactivate();
 		}
 	}
@@ -651,7 +656,6 @@ void LLVoiceChannelGroup::setState(EState state)
 LLVoiceChannelProximal::LLVoiceChannelProximal() : 
 	LLVoiceChannel(LLUUID::null, LLStringUtil::null)
 {
-	activate();
 }
 
 BOOL LLVoiceChannelProximal::isActive()
@@ -663,13 +667,13 @@ void LLVoiceChannelProximal::activate()
 {
 	if (callStarted()) return;
 
-	LLVoiceChannel::activate();
-
-	if (callStarted())
+	if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
 	{
-		// this implicitly puts you back in the spatial channel
-		LLVoiceClient::getInstance()->leaveNonSpatialChannel();
+		// we're connected to a non-spatial channel, so disconnect.
+		LLVoiceClient::getInstance()->leaveNonSpatialChannel();	
 	}
+	LLVoiceChannel::activate();
+	
 }
 
 void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
@@ -754,7 +758,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
 
 void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
 {
-	llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
+	LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
 
 	// status updates
 	switch(type)
@@ -824,9 +828,9 @@ void LLVoiceChannelP2P::activate()
 		LLRecentPeople::instance().add(mOtherUserID);
 
 		//Default mic is ON on initiating/joining P2P calls
-		if (!gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
+		if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
 		{
-			gVoiceClient->inputUserControlState(true);
+			LLVoiceClient::getInstance()->inputUserControlState(true);
 		}
 	}
 }
@@ -889,7 +893,7 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
 
 void LLVoiceChannelP2P::setState(EState state)
 {
-	llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
+	LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
 
 	if (mReceivedCall) // incoming call
 	{
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index cb86671305..4538bfc10c 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -98,7 +98,8 @@ public:
 
 	static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
 	static LLVoiceChannel* getChannelByURI(std::string uri);
-	static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; }
+	static LLVoiceChannel* getCurrentVoiceChannel();
+	
 	static void initClass();
 	
 	static void suspend();
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index fc264a6fcf..0105e584c5 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1,6 +1,6 @@
  /** 
  * @file llvoiceclient.cpp
- * @brief Implementation of LLVoiceClient class which is the interface to the voice client process.
+ * @brief Voice client delegation class implementation.
  *
  * $LicenseInfo:firstyear=2001&license=viewergpl$
  * 
@@ -17,8 +17,7 @@
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -32,6991 +31,709 @@
 
 #include "llviewerprecompiledheaders.h"
 #include "llvoiceclient.h"
+#include "llviewercontrol.h"
+#include "llviewerwindow.h"
+#include "llvoicedw.h"
+#include "llvoicevivox.h"
+#include "llviewernetwork.h"
+#include "llhttpnode.h"
+#include "llnotificationsutil.h"
 
-#include <boost/tokenizer.hpp>
-
-// library includes
-#include "llnotificationsutil.h"
-#include "llsdutil.h"
-
-// project includes
-#include "llvoavatar.h"
-#include "llbufferstream.h"
-#include "llfile.h"
-#ifdef LL_STANDALONE
-# include "expat.h"
-#else
-# include "expat/expat.h"
-#endif
-#include "llcallbacklist.h"
-#include "llcallingcard.h"   // for LLFriendObserver
-#include "llviewerregion.h"
-#include "llviewernetwork.h"		// for gGridChoice
-#include "llbase64.h"
-#include "llviewercontrol.h"
-#include "llkeyboard.h"
-#include "llappviewer.h"	// for gDisconnected, gDisableVoice
-#include "llmutelist.h"  // to check for muted avatars
-#include "llagent.h"
-#include "llcachename.h"
-#include "llimview.h" // for LLIMMgr
-#include "llparcel.h"
-#include "llviewerparcelmgr.h"
-#include "llfirstuse.h"
-#include "lltrans.h"
-#include "llviewerwindow.h"
-#include "llviewercamera.h"
-#include "llvoavatarself.h"
-#include "llvoicechannel.h"
-
-#include "llfloaterfriends.h"  //VIVOX, inorder to refresh communicate panel
-#include "llfloaterchat.h"		// for LLFloaterChat::addChat()
-
-// for base64 decoding
-#include "apr_base64.h"
-
-// for SHA1 hash
-#include "apr_sha1.h"
-
-// for MD5 hash
-#include "llmd5.h"
-
-#define USE_SESSION_GROUPS 0
-
-static bool sConnectingToAgni = false;
-F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
-
-const F32 SPEAKING_TIMEOUT = 1.f;
-
-const int VOICE_MAJOR_VERSION = 1;
-const int VOICE_MINOR_VERSION = 0;
-
-LLVoiceClient *gVoiceClient = NULL;
-
-// Don't retry connecting to the daemon more frequently than this:
-const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
-
-// Don't send positional updates more frequently than this:
-const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
-
-const F32 LOGIN_RETRY_SECONDS = 10.0f;
-const int MAX_LOGIN_RETRIES = 12;
-
-static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
-{
-	LLMD5 md5_uuid;
-	md5_uuid.update((const unsigned char*)str.data(), str.size());
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(uuid.mData);
-}
-
-static int scale_mic_volume(float volume)
-{
-	// incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
-	// Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
-	return 30 + (int)(volume * 20.0f);
-}
-
-static int scale_speaker_volume(float volume)
-{
-	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
-	// Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
-	return 30 + (int)(volume * 40.0f);
-}
-
-class LLViewerVoiceAccountProvisionResponder :
-	public LLHTTPClient::Responder
-{
-public:
-	LLViewerVoiceAccountProvisionResponder(int retries)
-	{
-		mRetries = retries;
-	}
-
-	virtual void error(U32 status, const std::string& reason)
-	{
-		if ( mRetries > 0 )
-		{
-			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying.  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
-			if ( gVoiceClient ) gVoiceClient->requestVoiceAccountProvision(
-				mRetries - 1);
-		}
-		else
-		{
-			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up).  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
-			if ( gVoiceClient ) gVoiceClient->giveUp();
-		}
-	}
-
-	virtual void result(const LLSD& content)
-	{
-		if ( gVoiceClient )
-		{
-			std::string voice_sip_uri_hostname;
-			std::string voice_account_server_uri;
-			
-			LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-			
-			if(content.has("voice_sip_uri_hostname"))
-				voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
-			
-			// this key is actually misnamed -- it will be an entire URI, not just a hostname.
-			if(content.has("voice_account_server_name"))
-				voice_account_server_uri = content["voice_account_server_name"].asString();
-			
-			gVoiceClient->login(
-				content["username"].asString(),
-				content["password"].asString(),
-				voice_sip_uri_hostname,
-				voice_account_server_uri);
-		}
-	}
-
-private:
-	int mRetries;
-};
-
-/** 
- * @class LLVivoxProtocolParser
- * @brief This class helps construct new LLIOPipe specializations
- * @see LLIOPipe
- *
- * THOROUGH_DESCRIPTION
- */
-class LLVivoxProtocolParser : public LLIOPipe
-{
-	LOG_CLASS(LLVivoxProtocolParser);
-public:
-	LLVivoxProtocolParser();
-	virtual ~LLVivoxProtocolParser();
-
-protected:
-	/* @name LLIOPipe virtual implementations
-	 */
-	//@{
-	/** 
-	 * @brief Process the data in buffer
-	 */
-	virtual EStatus process_impl(
-		const LLChannelDescriptors& channels,
-		buffer_ptr_t& buffer,
-		bool& eos,
-		LLSD& context,
-		LLPumpIO* pump);
-	//@}
-	
-	std::string 	mInput;
-	
-	// Expat control members
-	XML_Parser		parser;
-	int				responseDepth;
-	bool			ignoringTags;
-	bool			isEvent;
-	int				ignoreDepth;
-
-	// Members for processing responses. The values are transient and only valid within a call to processResponse().
-	bool			squelchDebugOutput;
-	int				returnCode;
-	int				statusCode;
-	std::string		statusString;
-	std::string		requestId;
-	std::string		actionString;
-	std::string		connectorHandle;
-	std::string		versionID;
-	std::string		accountHandle;
-	std::string		sessionHandle;
-	std::string		sessionGroupHandle;
-	std::string		alias;
-	std::string		applicationString;
-
-	// Members for processing events. The values are transient and only valid within a call to processResponse().
-	std::string		eventTypeString;
-	int				state;
-	std::string		uriString;
-	bool			isChannel;
-	bool			incoming;
-	bool			enabled;
-	std::string		nameString;
-	std::string		audioMediaString;
-	std::string		displayNameString;
-	std::string		deviceString;
-	int				participantType;
-	bool			isLocallyMuted;
-	bool			isModeratorMuted;
-	bool			isSpeaking;
-	int				volume;
-	F32				energy;
-	std::string		messageHeader;
-	std::string		messageBody;
-	std::string		notificationType;
-	bool			hasText;
-	bool			hasAudio;
-	bool			hasVideo;
-	bool			terminated;
-	std::string		blockMask;
-	std::string		presenceOnly;
-	std::string		autoAcceptMask;
-	std::string		autoAddAsBuddy;
-	int				numberOfAliases;
-	std::string		subscriptionHandle;
-	std::string		subscriptionType;
-		
-
-	// Members for processing text between tags
-	std::string		textBuffer;
-	bool			accumulateText;
-	
-	void			reset();
-
-	void			processResponse(std::string tag);
-
-static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
-static void XMLCALL ExpatEndTag(void *data, const char *el);
-static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
-
-	void			StartTag(const char *tag, const char **attr);
-	void			EndTag(const char *tag);
-	void			CharData(const char *buffer, int length);
-	
-};
-
-LLVivoxProtocolParser::LLVivoxProtocolParser()
-{
-	parser = NULL;
-	parser = XML_ParserCreate(NULL);
-	
-	reset();
-}
-
-void LLVivoxProtocolParser::reset()
-{
-	responseDepth = 0;
-	ignoringTags = false;
-	accumulateText = false;
-	energy = 0.f;
-	ignoreDepth = 0;
-	isChannel = false;
-	isEvent = false;
-	isLocallyMuted = false;
-	isModeratorMuted = false;
-	isSpeaking = false;
-	participantType = 0;
-	squelchDebugOutput = false;
-	returnCode = -1;
-	state = 0;
-	statusCode = 0;
-	volume = 0;
-	textBuffer.clear();
-	alias.clear();
-	numberOfAliases = 0;
-	applicationString.clear();
-}
-
-//virtual 
-LLVivoxProtocolParser::~LLVivoxProtocolParser()
-{
-	if (parser)
-		XML_ParserFree(parser);
-}
-
-// virtual
-LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
-	const LLChannelDescriptors& channels,
-	buffer_ptr_t& buffer,
-	bool& eos,
-	LLSD& context,
-	LLPumpIO* pump)
-{
-	LLBufferStream istr(channels, buffer.get());
-	std::ostringstream ostr;
-	while (istr.good())
-	{
-		char buf[1024];
-		istr.read(buf, sizeof(buf));
-		mInput.append(buf, istr.gcount());
-	}
-	
-	// Look for input delimiter(s) in the input buffer.  If one is found, send the message to the xml parser.
-	int start = 0;
-	int delim;
-	while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
-	{	
-		
-		// Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
-		reset();
-		
-		XML_ParserReset(parser, NULL);
-		XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
-		XML_SetCharacterDataHandler(parser, ExpatCharHandler);
-		XML_SetUserData(parser, this);	
-		XML_Parse(parser, mInput.data() + start, delim - start, false);
-		
-		// If this message isn't set to be squelched, output the raw XML received.
-		if(!squelchDebugOutput)
-		{
-			LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
-		}
-		
-		start = delim + 3;
-	}
-	
-	if(start != 0)
-		mInput = mInput.substr(start);
-
-	LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
-	
-	if(!gVoiceClient->mConnected)
-	{
-		// If voice has been disabled, we just want to close the socket.  This does so.
-		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
-		return STATUS_STOP;
-	}
-	
-	return STATUS_OK;
-}
-
-void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->StartTag(el, attr);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->EndTag(el);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->CharData(s, len);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-
-void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
-{
-	// Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
-	textBuffer.clear();
-	// only accumulate text if we're not ignoring tags.
-	accumulateText = !ignoringTags;
-	
-	if (responseDepth == 0)
-	{	
-		isEvent = !stricmp("Event", tag);
-		
-		if (!stricmp("Response", tag) || isEvent)
-		{
-			// Grab the attributes
-			while (*attr)
-			{
-				const char	*key = *attr++;
-				const char	*value = *attr++;
-				
-				if (!stricmp("requestId", key))
-				{
-					requestId = value;
-				}
-				else if (!stricmp("action", key))
-				{
-					actionString = value;
-				}
-				else if (!stricmp("type", key))
-				{
-					eventTypeString = value;
-				}
-			}
-		}
-		LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
-	}
-	else
-	{
-		if (ignoringTags)
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-		}
-		else
-		{
-			LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
-	
-			// Ignore the InputXml stuff so we don't get confused
-			if (!stricmp("InputXml", tag))
-			{
-				ignoringTags = true;
-				ignoreDepth = responseDepth;
-				accumulateText = false;
-
-				LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
-			}
-			else if (!stricmp("CaptureDevices", tag))
-			{
-				gVoiceClient->clearCaptureDevices();
-			}
-			else if (!stricmp("RenderDevices", tag))
-			{
-				gVoiceClient->clearRenderDevices();
-			}
-			else if (!stricmp("CaptureDevice", tag))
-			{
-				deviceString.clear();
-			}
-			else if (!stricmp("RenderDevice", tag))
-			{
-				deviceString.clear();
-			}
-			else if (!stricmp("Buddies", tag))
-			{
-				gVoiceClient->deleteAllBuddies();
-			}
-			else if (!stricmp("BlockRules", tag))
-			{
-				gVoiceClient->deleteAllBlockRules();
-			}
-			else if (!stricmp("AutoAcceptRules", tag))
-			{
-				gVoiceClient->deleteAllAutoAcceptRules();
-			}
-			
-		}
-	}
-	responseDepth++;
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::EndTag(const char *tag)
-{
-	const std::string& string = textBuffer;
-
-	responseDepth--;
-
-	if (ignoringTags)
-	{
-		if (ignoreDepth == responseDepth)
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
-			ignoringTags = false;
-		}
-		else
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-		}
-	}
-	
-	if (!ignoringTags)
-	{
-		LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-
-		// Closing a tag. Finalize the text we've accumulated and reset
-		if (!stricmp("ReturnCode", tag))
-			returnCode = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("SessionHandle", tag))
-			sessionHandle = string;
-		else if (!stricmp("SessionGroupHandle", tag))
-			sessionGroupHandle = string;
-		else if (!stricmp("StatusCode", tag))
-			statusCode = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("StatusString", tag))
-			statusString = string;
-		else if (!stricmp("ParticipantURI", tag))
-			uriString = string;
-		else if (!stricmp("Volume", tag))
-			volume = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("Energy", tag))
-			energy = (F32)strtod(string.c_str(), NULL);
-		else if (!stricmp("IsModeratorMuted", tag))
-			isModeratorMuted = !stricmp(string.c_str(), "true");
-		else if (!stricmp("IsSpeaking", tag))
-			isSpeaking = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Alias", tag))
-			alias = string;
-		else if (!stricmp("NumberOfAliases", tag))
-			numberOfAliases = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("Application", tag))
-			applicationString = string;
-		else if (!stricmp("ConnectorHandle", tag))
-			connectorHandle = string;
-		else if (!stricmp("VersionID", tag))
-			versionID = string;
-		else if (!stricmp("AccountHandle", tag))
-			accountHandle = string;
-		else if (!stricmp("State", tag))
-			state = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("URI", tag))
-			uriString = string;
-		else if (!stricmp("IsChannel", tag))
-			isChannel = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Incoming", tag))
-			incoming = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Enabled", tag))
-			enabled = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Name", tag))
-			nameString = string;
-		else if (!stricmp("AudioMedia", tag))
-			audioMediaString = string;
-		else if (!stricmp("ChannelName", tag))
-			nameString = string;
-		else if (!stricmp("DisplayName", tag))
-			displayNameString = string;
-		else if (!stricmp("Device", tag))
-			deviceString = string;
-		else if (!stricmp("AccountName", tag))
-			nameString = string;
-		else if (!stricmp("ParticipantType", tag))
-			participantType = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("IsLocallyMuted", tag))
-			isLocallyMuted = !stricmp(string.c_str(), "true");
-		else if (!stricmp("MicEnergy", tag))
-			energy = (F32)strtod(string.c_str(), NULL);
-		else if (!stricmp("ChannelName", tag))
-			nameString = string;
-		else if (!stricmp("ChannelURI", tag))
-			uriString = string;
-		else if (!stricmp("BuddyURI", tag))
-			uriString = string;
-		else if (!stricmp("Presence", tag))
-			statusString = string;
-		else if (!stricmp("CaptureDevice", tag))
-		{
-			gVoiceClient->addCaptureDevice(deviceString);
-		}
-		else if (!stricmp("RenderDevice", tag))
-		{
-			gVoiceClient->addRenderDevice(deviceString);
-		}
-		else if (!stricmp("Buddy", tag))
-		{
-			gVoiceClient->processBuddyListEntry(uriString, displayNameString);
-		}
-		else if (!stricmp("BlockRule", tag))
-		{
-			gVoiceClient->addBlockRule(blockMask, presenceOnly);
-		}
-		else if (!stricmp("BlockMask", tag))
-			blockMask = string;
-		else if (!stricmp("PresenceOnly", tag))
-			presenceOnly = string;
-		else if (!stricmp("AutoAcceptRule", tag))
-		{
-			gVoiceClient->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
-		}
-		else if (!stricmp("AutoAcceptMask", tag))
-			autoAcceptMask = string;
-		else if (!stricmp("AutoAddAsBuddy", tag))
-			autoAddAsBuddy = string;
-		else if (!stricmp("MessageHeader", tag))
-			messageHeader = string;
-		else if (!stricmp("MessageBody", tag))
-			messageBody = string;
-		else if (!stricmp("NotificationType", tag))
-			notificationType = string;
-		else if (!stricmp("HasText", tag))
-			hasText = !stricmp(string.c_str(), "true");
-		else if (!stricmp("HasAudio", tag))
-			hasAudio = !stricmp(string.c_str(), "true");
-		else if (!stricmp("HasVideo", tag))
-			hasVideo = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Terminated", tag))
-			terminated = !stricmp(string.c_str(), "true");
-		else if (!stricmp("SubscriptionHandle", tag))
-			subscriptionHandle = string;
-		else if (!stricmp("SubscriptionType", tag))
-			subscriptionType = string;
-		
-		textBuffer.clear();
-		accumulateText= false;
-		
-		if (responseDepth == 0)
-		{
-			// We finished all of the XML, process the data
-			processResponse(tag);
-		}
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::CharData(const char *buffer, int length)
-{
-	/*
-		This method is called for anything that isn't a tag, which can be text you
-		want that lies between tags, and a lot of stuff you don't want like file formatting
-		(tabs, spaces, CR/LF, etc).
-		
-		Only copy text if we are in accumulate mode...
-	*/
-	if (accumulateText)
-		textBuffer.append(buffer, length);
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::processResponse(std::string tag)
-{
-	LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
-
-	// SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success.  This is a change vs. previous SDKs.
-	// According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
-	// so I believe this will give correct behavior.
-	
-	if(returnCode == 0)
-		statusCode = 0;
-		
-	if (isEvent)
-	{
-		const char *eventTypeCstr = eventTypeString.c_str();
-		if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
-		{
-			gVoiceClient->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
-		{
-			/*
-			<Event type="SessionAddedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-				<Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
-				<IsChannel>true</IsChannel>
-				<Incoming>false</Incoming>
-				<ChannelName />
-			</Event>
-			*/
-			gVoiceClient->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
-		{
-			gVoiceClient->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
-		{
-			gVoiceClient->sessionGroupAddedEvent(sessionGroupHandle);
-		}
-		else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
-		{
-			/*
-			<Event type="MediaStreamUpdatedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-				<StatusCode>200</StatusCode>
-				<StatusString>OK</StatusString>
-				<State>2</State>
-				<Incoming>false</Incoming>
-			</Event>
-			*/
-			gVoiceClient->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
-		}		
-		else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
-		{
-			/*
-			<Event type="TextStreamUpdatedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
-				<Enabled>true</Enabled>
-				<State>1</State>
-				<Incoming>true</Incoming>
-			</Event>
-			*/
-			gVoiceClient->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
-		{
-			/* 
-			<Event type="ParticipantAddedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
-				<ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
-				<AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
-				<DisplayName />
-				<ParticipantType>0</ParticipantType>
-			</Event>
-			*/
-			gVoiceClient->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
-		{
-			/*
-			<Event type="ParticipantRemovedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
-				<ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
-				<AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
-			</Event>
-			*/
-			gVoiceClient->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
-		{
-			/*
-			<Event type="ParticipantUpdatedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-				<ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
-				<IsModeratorMuted>false</IsModeratorMuted>
-				<IsSpeaking>true</IsSpeaking>
-				<Volume>44</Volume>
-				<Energy>0.0879437</Energy>
-			</Event>
-			*/
-			
-			// These happen so often that logging them is pretty useless.
-			squelchDebugOutput = true;
-			
-			gVoiceClient->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
-		}
-		else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
-		{
-			gVoiceClient->auxAudioPropertiesEvent(energy);
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
-		{
-			gVoiceClient->buddyPresenceEvent(uriString, alias, statusString, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
-		{
-			// The buddy list was updated during parsing.
-			// Need to recheck against the friends list.
-			gVoiceClient->buddyListChanged();
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
-		{
-			/*
-			<Event type="BuddyChangedEvent">
-				<AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
-				<BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
-				<DisplayName>Monroe Tester</DisplayName>
-				<BuddyData />
-				<GroupID>0</GroupID>
-				<ChangeType>Set</ChangeType>
-			</Event>
-			*/		
-			// TODO: Question: Do we need to process this at all?
-		}
-		else if (!stricmp(eventTypeCstr, "MessageEvent"))  
-		{
-			gVoiceClient->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))  
-		{
-			gVoiceClient->sessionNotificationEvent(sessionHandle, uriString, notificationType);
-		}
-		else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))  
-		{
-			gVoiceClient->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))  
-		{
-			/*
-			<Event type="SessionUpdatedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-				<Uri>sip:confctl-9@bhd.vivox.com</Uri>
-				<IsMuted>0</IsMuted>
-				<Volume>50</Volume>
-				<TransmitEnabled>1</TransmitEnabled>
-				<IsFocused>0</IsFocused>
-				<SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
-				<SessionFontID>0</SessionFontID>
-			</Event>
-			*/
-			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
-		}
-		
-		else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))  
-		{
-			/*
-			<Event type="SessionGroupRemovedEvent">
-				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			</Event>
-			*/
-			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
-		}
-		else
-		{
-			LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
-		}
-	}
-	else
-	{
-		const char *actionCstr = actionString.c_str();
-		if (!stricmp(actionCstr, "Connector.Create.1"))
-		{
-			gVoiceClient->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
-		}
-		else if (!stricmp(actionCstr, "Account.Login.1"))
-		{
-			gVoiceClient->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
-		}
-		else if (!stricmp(actionCstr, "Session.Create.1"))
-		{
-			gVoiceClient->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);			
-		}
-		else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
-		{
-			gVoiceClient->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);			
-		}
-		else if (!stricmp(actionCstr, "Session.Connect.1"))
-		{
-			gVoiceClient->sessionConnectResponse(requestId, statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Account.Logout.1"))
-		{
-			gVoiceClient->logoutResponse(statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
-		{
-			gVoiceClient->connectorShutdownResponse(statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
-		{
-			gVoiceClient->accountListBlockRulesResponse(statusCode, statusString);						
-		}
-		else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
-		{
-			gVoiceClient->accountListAutoAcceptRulesResponse(statusCode, statusString);						
-		}
-		else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
-		{
-			// We don't need to process these, but they're so spammy we don't want to log them.
-			squelchDebugOutput = true;
-		}
-/*
-		else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
-		{
-			gVoiceClient->channelGetListResponse(statusCode, statusString);
-		}
-		else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
-		{
-			
-		}
-		else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
-		{
-			
-		}
-*/
-	}
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVoiceClientMuteListObserver : public LLMuteListObserver
-{
-	/* virtual */ void onChange()  { gVoiceClient->muteListChanged();}
-};
-
-class LLVoiceClientFriendsObserver : public LLFriendObserver
-{
-public:
-	/* virtual */ void changed(U32 mask) { gVoiceClient->updateFriends(mask);}
-};
-
-static LLVoiceClientMuteListObserver mutelist_listener;
-static bool sMuteListListener_listening = false;
-
-static LLVoiceClientFriendsObserver *friendslist_listener = NULL;
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVoiceClientCapResponder : public LLHTTPClient::Responder
-{
-public:
-	LLVoiceClientCapResponder(void){};
-
-	virtual void error(U32 status, const std::string& reason);	// called with bad status codes
-	virtual void result(const LLSD& content);
-
-private:
-};
-
-void LLVoiceClientCapResponder::error(U32 status, const std::string& reason)
-{
-	LL_WARNS("Voice") << "LLVoiceClientCapResponder::error("
-		<< status << ": " << reason << ")"
-		<< LL_ENDL;
-}
-
-void LLVoiceClientCapResponder::result(const LLSD& content)
-{
-	LLSD::map_const_iterator iter;
-	
-	LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-
-	if ( content.has("voice_credentials") )
-	{
-		LLSD voice_credentials = content["voice_credentials"];
-		std::string uri;
-		std::string credentials;
-
-		if ( voice_credentials.has("channel_uri") )
-		{
-			uri = voice_credentials["channel_uri"].asString();
-		}
-		if ( voice_credentials.has("channel_credentials") )
-		{
-			credentials =
-				voice_credentials["channel_credentials"].asString();
-		}
-
-		gVoiceClient->setSpatialChannel(uri, credentials);
-	}
-}
-
-
-
-#if LL_WINDOWS
-static HANDLE sGatewayHandle = 0;
-
-static bool isGatewayRunning()
-{
-	bool result = false;
-	if(sGatewayHandle != 0)		
-	{
-		DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
-		if(waitresult != WAIT_OBJECT_0)
-		{
-			result = true;
-		}			
-	}
-	return result;
-}
-static void killGateway()
-{
-	if(sGatewayHandle != 0)
-	{
-		TerminateProcess(sGatewayHandle,0);
-	}
-}
-
-#else // Mac and linux
-
-static pid_t sGatewayPID = 0;
-static bool isGatewayRunning()
-{
-	bool result = false;
-	if(sGatewayPID != 0)
-	{
-		// A kill with signal number 0 has no effect, just does error checking.  It should return an error if the process no longer exists.
-		if(kill(sGatewayPID, 0) == 0)
-		{
-			result = true;
-		}
-	}
-	return result;
-}
-
-static void killGateway()
-{
-	if(sGatewayPID != 0)
-	{
-		kill(sGatewayPID, SIGTERM);
-	}
-}
-
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-LLVoiceClient::LLVoiceClient() :
-	mState(stateDisabled),
-	mSessionTerminateRequested(false),
-	mRelogRequested(false),
-	mConnected(false),
-	mPump(NULL),
-	
-	mTuningMode(false),
-	mTuningEnergy(0.0f),
-	mTuningMicVolume(0),
-	mTuningMicVolumeDirty(true),
-	mTuningSpeakerVolume(0),
-	mTuningSpeakerVolumeDirty(true),
-	mTuningExitState(stateDisabled),
-	
-	mAreaVoiceDisabled(false),
-	mAudioSession(NULL),
-	mAudioSessionChanged(false),
-	mNextAudioSession(NULL),
-	
-	mCurrentParcelLocalID(0),
-	mNumberOfAliases(0),
-	mCommandCookie(0),
-	mLoginRetryCount(0),
-	
-	mBuddyListMapPopulated(false),
-	mBlockRulesListReceived(false),
-	mAutoAcceptRulesListReceived(false),
-	mCaptureDeviceDirty(false),
-	mRenderDeviceDirty(false),
-	mSpatialCoordsDirty(false),
-
-	mPTTDirty(true),
-	mPTT(true),
-	mUsePTT(true),
-	mPTTIsMiddleMouse(false),
-	mPTTKey(0),
-	mPTTIsToggle(false),
-	mUserPTTState(false),
-	mMuteMic(false),
-	mFriendsListDirty(true),
-	
-	mEarLocation(0),
-	mSpeakerVolumeDirty(true),
-	mSpeakerMuteDirty(true),
-	mSpeakerVolume(0),
-	mMicVolume(0),
-	mMicVolumeDirty(true),
-	
-	mVoiceEnabled(false),
-	mWriteInProgress(false),
-	
-	mLipSyncEnabled(false)
-{	
-	gVoiceClient = this;
-	
-	mAPIVersion = LLTrans::getString("NotConnected");
-
-#if LL_DARWIN || LL_LINUX || LL_SOLARIS
-		// HACK: THIS DOES NOT BELONG HERE
-		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
-		// This should cause us to ignore SIGPIPE and handle the error through proper channels.
-		// This should really be set up elsewhere.  Where should it go?
-		signal(SIGPIPE, SIG_IGN);
-		
-		// Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
-		// Ignoring SIGCHLD should prevent zombies from being created.  Alternately, we could use wait(), but I'd rather not do that.
-		signal(SIGCHLD, SIG_IGN);
-#endif
-
-	// set up state machine
-	setState(stateDisabled);
-	
-	gIdleCallbacks.addFunction(idle, this);
-}
-
-//---------------------------------------------------
-
-LLVoiceClient::~LLVoiceClient()
-{
-}
-
-//----------------------------------------------
-
-void LLVoiceClient::init(LLPumpIO *pump)
-{
-	// constructor will set up gVoiceClient
-	LLVoiceClient::getInstance()->mPump = pump;
-	LLVoiceClient::getInstance()->updateSettings();
-}
-
-void LLVoiceClient::terminate()
-{
-	if(gVoiceClient)
-	{
-//		gVoiceClient->leaveAudioSession();
-		gVoiceClient->logout();
-		// As of SDK version 4885, this should no longer be necessary.  It will linger after the socket close if it needs to.
-		// ms_sleep(2000);
-		gVoiceClient->connectorShutdown();
-		gVoiceClient->closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
-		
-		// This will do unpleasant things on windows.
-//		killGateway();
-		
-		// Don't do this anymore -- LLSingleton will take care of deleting the object.		
-//		delete gVoiceClient;
-		
-		// Hint to other code not to access the voice client anymore.
-		gVoiceClient = NULL;
-	}
-}
-
-//---------------------------------------------------
-
-void LLVoiceClient::updateSettings()
-{
-	setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
-	setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
-	std::string keyString = gSavedSettings.getString("PushToTalkButton");
-	setPTTKey(keyString);
-	setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
-	setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
-
-	std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
-	setCaptureDevice(inputDevice);
-	std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
-	setRenderDevice(outputDevice);
-	F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
-	setMicGain(mic_level);
-	setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
-}
-
-/////////////////////////////
-// utility functions
-
-bool LLVoiceClient::writeString(const std::string &str)
-{
-	bool result = false;
-	if(mConnected)
-	{
-		apr_status_t err;
-		apr_size_t size = (apr_size_t)str.size();
-		apr_size_t written = size;
-	
-		//MARK: Turn this on to log outgoing XML
-//		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
-
-		// check return code - sockets will fail (broken, etc.)
-		err = apr_socket_send(
-				mSocket->getSocket(),
-				(const char*)str.data(),
-				&written);
-		
-		if(err == 0)
-		{
-			// Success.
-			result = true;
-		}
-		// TODO: handle partial writes (written is number of bytes written)
-		// Need to set socket to non-blocking before this will work.
-//		else if(APR_STATUS_IS_EAGAIN(err))
-//		{
-//			// 
-//		}
-		else
-		{
-			// Assume any socket error means something bad.  For now, just close the socket.
-			char buf[MAX_STRING];
-			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
-			daemonDied();
-		}
-	}
-		
-	return result;
-}
-
-
-/////////////////////////////
-// session control messages
-void LLVoiceClient::connectorCreate()
-{
-	std::ostringstream stream;
-	std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-	std::string loglevel = "0";
-	
-	// Transition to stateConnectorStarted when the connector handle comes back.
-	setState(stateConnectorStarting);
-
-	std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
-		
-	if(savedLogLevel != "-1")
-	{
-		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
-		loglevel = "10";
-	}
-	
-	stream 
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
-		<< "<ClientName>V2 SDK</ClientName>"
-		<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
-		<< "<Mode>Normal</Mode>"
-		<< "<Logging>"
-			<< "<Folder>" << logpath << "</Folder>"
-			<< "<FileNamePrefix>Connector</FileNamePrefix>"
-			<< "<FileNameSuffix>.log</FileNameSuffix>"
-			<< "<LogLevel>" << loglevel << "</LogLevel>"
-		<< "</Logging>"
-		<< "<Application>SecondLifeViewer.1</Application>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::connectorShutdown()
-{
-	setState(stateConnectorStopping);
-	
-	if(!mConnectorHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-		
-		mConnectorHandle.clear();
-		
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
-{
-	LL_INFOS("Voice") << "name \"" << user_id << "\" , ID " << agentID << LL_ENDL;
-
-	sConnectingToAgni = LLGridManager::getInstance()->isInProductionGrid();
-
-	mAccountName = nameFromID(agentID);
-}
-
-void LLVoiceClient::requestVoiceAccountProvision(S32 retries)
-{
-	if ( gAgent.getRegion() && mVoiceEnabled )
-	{
-		std::string url = 
-			gAgent.getRegion()->getCapability(
-				"ProvisionVoiceAccountRequest");
-
-		if ( url == "" ) return;
-
-		LLHTTPClient::post(
-			url,
-			LLSD(),
-			new LLViewerVoiceAccountProvisionResponder(retries));
-	}
-}
-
-void LLVoiceClient::login(
-	const std::string& account_name,
-	const std::string& password,
-	const std::string& voice_sip_uri_hostname,
-	const std::string& voice_account_server_uri)
-{
-	mVoiceSIPURIHostName = voice_sip_uri_hostname;
-	mVoiceAccountServerURI = voice_account_server_uri;
-
-	if(!mAccountHandle.empty())
-	{
-		// Already logged in.
-		LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
-		
-		// Don't process another login.
-		return;
-	}
-	else if ( account_name != mAccountName )
-	{
-		//TODO: error?
-		LL_WARNS("Voice") << "Wrong account name! " << account_name
-				<< " instead of " << mAccountName << LL_ENDL;
-	}
-	else
-	{
-		mAccountPassword = password;
-	}
-
-	std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
-	
-	if( !debugSIPURIHostName.empty() )
-	{
-		mVoiceSIPURIHostName = debugSIPURIHostName;
-	}
-	
-	if( mVoiceSIPURIHostName.empty() )
-	{
-		// we have an empty account server name
-		// so we fall back to hardcoded defaults
-
-		if(sConnectingToAgni)
-		{
-			// Use the release account server
-			mVoiceSIPURIHostName = "bhr.vivox.com";
-		}
-		else
-		{
-			// Use the development account server
-			mVoiceSIPURIHostName = "bhd.vivox.com";
-		}
-	}
-	
-	std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
-
-	if( !debugAccountServerURI.empty() )
-	{
-		mVoiceAccountServerURI = debugAccountServerURI;
-	}
-	
-	if( mVoiceAccountServerURI.empty() )
-	{
-		// If the account server URI isn't specified, construct it from the SIP URI hostname
-		mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";		
-	}
-}
-
-void LLVoiceClient::idle(void* user_data)
-{
-	LLVoiceClient* self = (LLVoiceClient*)user_data;
-	self->stateMachine();
-}
-
-std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
-{
-	std::string result = "UNKNOWN";
-	
-		// Prevent copy-paste errors when updating this list...
-#define CASE(x)  case x:  result = #x;  break
-
-	switch(inState)
-	{
-		CASE(stateDisableCleanup);
-		CASE(stateDisabled);
-		CASE(stateStart);
-		CASE(stateDaemonLaunched);
-		CASE(stateConnecting);
-		CASE(stateConnected);
-		CASE(stateIdle);
-		CASE(stateMicTuningStart);
-		CASE(stateMicTuningRunning);
-		CASE(stateMicTuningStop);
-		CASE(stateConnectorStart);
-		CASE(stateConnectorStarting);
-		CASE(stateConnectorStarted);
-		CASE(stateLoginRetry);
-		CASE(stateLoginRetryWait);
-		CASE(stateNeedsLogin);
-		CASE(stateLoggingIn);
-		CASE(stateLoggedIn);
-		CASE(stateCreatingSessionGroup);
-		CASE(stateNoChannel);
-		CASE(stateJoiningSession);
-		CASE(stateSessionJoined);
-		CASE(stateRunning);
-		CASE(stateLeavingSession);
-		CASE(stateSessionTerminated);
-		CASE(stateLoggingOut);
-		CASE(stateLoggedOut);
-		CASE(stateConnectorStopping);
-		CASE(stateConnectorStopped);
-		CASE(stateConnectorFailed);
-		CASE(stateConnectorFailedWaiting);
-		CASE(stateLoginFailed);
-		CASE(stateLoginFailedWaiting);
-		CASE(stateJoinSessionFailed);
-		CASE(stateJoinSessionFailedWaiting);
-		CASE(stateJail);
-	}
-
-#undef CASE
-	
-	return result;
-}
-
-std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
-{
-	std::string result = "UNKNOWN";
-	
-		// Prevent copy-paste errors when updating this list...
-#define CASE(x)  case x:  result = #x;  break
-
-	switch(inStatus)
-	{
-		CASE(STATUS_LOGIN_RETRY);
-		CASE(STATUS_LOGGED_IN);
-		CASE(STATUS_JOINING);
-		CASE(STATUS_JOINED);
-		CASE(STATUS_LEFT_CHANNEL);
-		CASE(STATUS_VOICE_DISABLED);
-		CASE(STATUS_VOICE_ENABLED);
-		CASE(BEGIN_ERROR_STATUS);
-		CASE(ERROR_CHANNEL_FULL);
-		CASE(ERROR_CHANNEL_LOCKED);
-		CASE(ERROR_NOT_AVAILABLE);
-		CASE(ERROR_UNKNOWN);
-	default:
-		break;
-	}
-
-#undef CASE
-	
-	return result;
-}
-
-void LLVoiceClient::setState(state inState)
-{
-	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
-	
-	mState = inState;
-}
-
-void LLVoiceClient::stateMachine()
-{
-	if(gDisconnected)
-	{
-		// The viewer has been disconnected from the sim.  Disable voice.
-		setVoiceEnabled(false);
-	}
-	
-	if(mVoiceEnabled)
-	{
-		updatePosition();
-	}
-	else if(mTuningMode)
-	{
-		// Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
-	}
-	else
-	{
-		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
-		{
-			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
-			if(!mConnected)
-			{
-				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
-				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
-				killGateway();
-			}
-			
-			logout();
-			connectorShutdown();
-			
-			setState(stateDisableCleanup);
-		}
-	}
-	
-	// Check for parcel boundary crossing
-	{
-		LLViewerRegion *region = gAgent.getRegion();
-		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-		
-		if(region && parcel)
-		{
-			S32 parcelLocalID = parcel->getLocalID();
-			std::string regionName = region->getName();
-			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
-		
-//			LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
-
-			// The region name starts out empty and gets filled in later.  
-			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
-			// If either is empty, wait for the next time around.
-			if(!regionName.empty())
-			{
-				if(!capURI.empty())
-				{
-					if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
-					{
-						// We have changed parcels.  Initiate a parcel channel lookup.
-						mCurrentParcelLocalID = parcelLocalID;
-						mCurrentRegionName = regionName;
-						
-						parcelChanged();
-					}
-				}
-				else
-				{
-					LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability.  This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
-				}
-			}
-		}
-	}
-
-	switch(getState())
-	{
-		//MARK: stateDisableCleanup
-		case stateDisableCleanup:
-			// Clean up and reset everything. 
-			closeSocket();
-			deleteAllSessions();
-			deleteAllBuddies();		
-			
-			mConnectorHandle.clear();
-			mAccountHandle.clear();
-			mAccountPassword.clear();
-			mVoiceAccountServerURI.clear();
-			
-			setState(stateDisabled);	
-		break;
-		
-		//MARK: stateDisabled
-		case stateDisabled:
-			if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
-			{
-				setState(stateStart);
-			}
-		break;
-		
-		//MARK: stateStart
-		case stateStart:
-			if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
-			{
-				// Voice is locked out, we must not launch the vivox daemon.
-				setState(stateJail);
-			}
-			else if(!isGatewayRunning())
-			{
-				if(true)
-				{
-					// Launch the voice daemon
-					
-					// *FIX:Mani - Using the executable dir instead 
-					// of mAppRODataDir, the working directory from which the app
-					// is launched.
-					//std::string exe_path = gDirUtilp->getAppRODataDir();
-					std::string exe_path = gDirUtilp->getExecutableDir();
-					exe_path += gDirUtilp->getDirDelimiter();
-#if LL_WINDOWS
-					exe_path += "SLVoice.exe";
-#elif LL_DARWIN
-					exe_path += "../Resources/SLVoice";
-#else
-					exe_path += "SLVoice";
-#endif
-					// See if the vivox executable exists
-					llstat s;
-					if(!LLFile::stat(exe_path, &s))
-					{
-						// vivox executable exists.  Build the command line and launch the daemon.
-						// SLIM SDK: these arguments are no longer necessary.
-//						std::string args = " -p tcp -h -c";
-						std::string args;
-						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
-						
-						if(loglevel.empty())
-						{
-							loglevel = "-1";	// turn logging off completely
-						}
-						
-						args += " -ll ";
-						args += loglevel;
-						
-						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
-
-#if LL_WINDOWS
-						PROCESS_INFORMATION pinfo;
-						STARTUPINFOW sinfo;
-						memset(&sinfo, 0, sizeof(sinfo));
-
-						std::string exe_dir = gDirUtilp->getExecutableDir();
-
-						llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
-						llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
-						llutf16string args16 = utf8str_to_utf16str(args);
-						// Create a writeable copy to keep Windows happy.
-						U16 *argscpy_16 = new U16[args16.size() + 1];
-						wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
-						if(!CreateProcessW(exe_path16.c_str(), argscpy_16, NULL, NULL, FALSE, 0, NULL, exe_dir16.c_str(), &sinfo, &pinfo))
-						{
-//							DWORD dwErr = GetLastError();
-						}
-						else
-						{
-							// foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
-							// CloseHandle(pinfo.hProcess); // stops leaks - nothing else
-							sGatewayHandle = pinfo.hProcess;
-							CloseHandle(pinfo.hThread); // stops leaks - nothing else
-						}		
-						
-						delete[] argscpy_16;
-#else	// LL_WINDOWS
-						// This should be the same for mac and linux
-						{
-							std::vector<std::string> arglist;
-							arglist.push_back(exe_path);
-							
-							// Split the argument string into separate strings for each argument
-							typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-							boost::char_separator<char> sep(" ");
-							tokenizer tokens(args, sep);
-							tokenizer::iterator token_iter;
-
-							for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
-							{
-								arglist.push_back(*token_iter);
-							}
-							
-							// create an argv vector for the child process
-							char **fakeargv = new char*[arglist.size() + 1];
-							int i;
-							for(i=0; i < arglist.size(); i++)
-								fakeargv[i] = const_cast<char*>(arglist[i].c_str());
-
-							fakeargv[i] = NULL;
-							
-							fflush(NULL); // flush all buffers before the child inherits them
-							pid_t id = vfork();
-							if(id == 0)
-							{
-								// child
-								execv(exe_path.c_str(), fakeargv);
-								
-								// If we reach this point, the exec failed.
-								// Use _exit() instead of exit() per the vfork man page.
-								_exit(0);
-							}
-
-							// parent
-							delete[] fakeargv;
-							sGatewayPID = id;
-						}
-#endif	// LL_WINDOWS
-						mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost").c_str(), gSavedSettings.getU32("VoicePort"));
-					}	
-					else
-					{
-						LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
-					}	
-				}
-				else
-				{		
-					// SLIM SDK: port changed from 44124 to 44125.
-					// We can connect to a client gateway running on another host.  This is useful for testing.
-					// To do this, launch the gateway on a nearby host like this:
-					//  vivox-gw.exe -p tcp -i 0.0.0.0:44125
-					// and put that host's IP address here.
-					mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost"), gSavedSettings.getU32("VoicePort"));
-				}
-
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
-				setState(stateDaemonLaunched);
-				
-				// Dirty the states we'll need to sync with the daemon when it comes up.
-				mPTTDirty = true;
-				mMicVolumeDirty = true;
-				mSpeakerVolumeDirty = true;
-				mSpeakerMuteDirty = true;
-				// These only need to be set if they're not default (i.e. empty string).
-				mCaptureDeviceDirty = !mCaptureDevice.empty();
-				mRenderDeviceDirty = !mRenderDevice.empty();
-				
-				mMainSessionGroupHandle.clear();
-			}
-		break;
-
-		//MARK: stateDaemonLaunched
-		case stateDaemonLaunched:
-			if(mUpdateTimer.hasExpired())
-			{
-				LL_DEBUGS("Voice") << "Connecting to vivox daemon" << LL_ENDL;
-
-				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
-				if(!mSocket)
-				{
-					mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);	
-				}
-				
-				mConnected = mSocket->blockingConnect(mDaemonHost);
-				if(mConnected)
-				{
-					setState(stateConnecting);
-				}
-				else
-				{
-					// If the connect failed, the socket may have been put into a bad state.  Delete it.
-					closeSocket();
-				}
-			}
-		break;
-
-		//MARK: stateConnecting
-		case stateConnecting:
-		// Can't do this until we have the pump available.
-		if(mPump)
-		{
-			// MBW -- Note to self: pumps and pipes examples in
-			//  indra/test/io.cpp
-			//  indra/test/llpipeutil.{cpp|h}
-
-			// Attach the pumps and pipes
-				
-			LLPumpIO::chain_t readChain;
-
-			readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
-			readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
-
-			mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
-
-			setState(stateConnected);
-		}
-
-		break;
-		
-		//MARK: stateConnected
-		case stateConnected:
-			// Initial devices query
-			getCaptureDevicesSendMessage();
-			getRenderDevicesSendMessage();
-
-			mLoginRetryCount = 0;
-
-			setState(stateIdle);
-		break;
-
-		//MARK: stateIdle
-		case stateIdle:
-			// This is the idle state where we're connected to the daemon but haven't set up a connector yet.
-			if(mTuningMode)
-			{
-				mTuningExitState = stateIdle;
-				setState(stateMicTuningStart);
-			}
-			else if(!mVoiceEnabled)
-			{
-				// We never started up the connector.  This will shut down the daemon.
-				setState(stateConnectorStopped);
-			}
-			else if(!mAccountName.empty())
-			{
-				LLViewerRegion *region = gAgent.getRegion();
-				
-				if(region)
-				{
-					if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
-					{
-						if ( mAccountPassword.empty() )
-						{
-							requestVoiceAccountProvision();
-						}
-						setState(stateConnectorStart);
-					}
-					else
-					{
-						LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
-					}
-				}
-			}
-		break;
-
-		//MARK: stateMicTuningStart
-		case stateMicTuningStart:
-			if(mUpdateTimer.hasExpired())
-			{
-				if(mCaptureDeviceDirty || mRenderDeviceDirty)
-				{
-					// These can't be changed while in tuning mode.  Set them before starting.
-					std::ostringstream stream;
-					
-					buildSetCaptureDevice(stream);
-					buildSetRenderDevice(stream);
-
-					if(!stream.str().empty())
-					{
-						writeString(stream.str());
-					}				
-
-					// This will come around again in the same state and start the capture, after the timer expires.
-					mUpdateTimer.start();
-					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-				}
-				else
-				{
-					// duration parameter is currently unused, per Mike S.
-					tuningCaptureStartSendMessage(10000);
-
-					setState(stateMicTuningRunning);
-				}
-			}
-			
-		break;
-		
-		//MARK: stateMicTuningRunning
-		case stateMicTuningRunning:
-			if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
-			{
-				// All of these conditions make us leave tuning mode.
-				setState(stateMicTuningStop);
-			}
-			else
-			{
-				// process mic/speaker volume changes
-				if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
-				{
-					std::ostringstream stream;
-					
-					if(mTuningMicVolumeDirty)
-					{
-						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
-						stream
-						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
-						<< "<Level>" << mTuningMicVolume << "</Level>"
-						<< "</Request>\n\n\n";
-					}
-					
-					if(mTuningSpeakerVolumeDirty)
-					{
-						stream
-						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
-						<< "<Level>" << mTuningSpeakerVolume << "</Level>"
-						<< "</Request>\n\n\n";
-					}
-					
-					mTuningMicVolumeDirty = false;
-					mTuningSpeakerVolumeDirty = false;
-
-					if(!stream.str().empty())
-					{
-						writeString(stream.str());
-					}
-				}
-			}
-		break;
-		
-		//MARK: stateMicTuningStop
-		case stateMicTuningStop:
-		{
-			// transition out of mic tuning
-			tuningCaptureStopSendMessage();
-			
-			setState(mTuningExitState);
-			
-			// if we exited just to change devices, this will keep us from re-entering too fast.
-			mUpdateTimer.start();
-			mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-			
-		}
-		break;
-												
-		//MARK: stateConnectorStart
-		case stateConnectorStart:
-			if(!mVoiceEnabled)
-			{
-				// We were never logged in.  This will shut down the connector.
-				setState(stateLoggedOut);
-			}
-			else if(!mVoiceAccountServerURI.empty())
-			{
-				connectorCreate();
-			}
-		break;
-		
-		//MARK: stateConnectorStarting
-		case stateConnectorStarting:	// waiting for connector handle
-			// connectorCreateResponse() will transition from here to stateConnectorStarted.
-		break;
-		
-		//MARK: stateConnectorStarted
-		case stateConnectorStarted:		// connector handle received
-			if(!mVoiceEnabled)
-			{
-				// We were never logged in.  This will shut down the connector.
-				setState(stateLoggedOut);
-			}
-			else
-			{
-				// The connector is started.  Send a login message.
-				setState(stateNeedsLogin);
-			}
-		break;
-				
-		//MARK: stateLoginRetry
-		case stateLoginRetry:
-			if(mLoginRetryCount == 0)
-			{
-				// First retry -- display a message to the user
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
-			}
-			
-			mLoginRetryCount++;
-			
-			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
-			{
-				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
-				setState(stateLoginFailed);
-			}
-			else
-			{
-				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
-				setState(stateLoginRetryWait);
-			}
-		break;
-		
-		//MARK: stateLoginRetryWait
-		case stateLoginRetryWait:
-			if(mUpdateTimer.hasExpired())
-			{
-				setState(stateNeedsLogin);
-			}
-		break;
-		
-		//MARK: stateNeedsLogin
-		case stateNeedsLogin:
-			if(!mAccountPassword.empty())
-			{
-				setState(stateLoggingIn);
-				loginSendMessage();
-			}		
-		break;
-		
-		//MARK: stateLoggingIn
-		case stateLoggingIn:			// waiting for account handle
-			// loginResponse() will transition from here to stateLoggedIn.
-		break;
-		
-		//MARK: stateLoggedIn
-		case stateLoggedIn:				// account handle received
-
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
-
-			// request the current set of block rules (we'll need them when updating the friends list)
-			accountListBlockRulesSendMessage();
-			
-			// request the current set of auto-accept rules
-			accountListAutoAcceptRulesSendMessage();
-			
-			// Set up the mute list observer if it hasn't been set up already.
-			if((!sMuteListListener_listening))
-			{
-				LLMuteList::getInstance()->addObserver(&mutelist_listener);
-				sMuteListListener_listening = true;
-			}
-
-			// Set up the friends list observer if it hasn't been set up already.
-			if(friendslist_listener == NULL)
-			{
-				friendslist_listener = new LLVoiceClientFriendsObserver;
-				LLAvatarTracker::instance().addObserver(friendslist_listener);
-			}
-			
-			// Set the initial state of mic mute, local speaker volume, etc.
-			{
-				std::ostringstream stream;
-				
-				buildLocalAudioUpdates(stream);
-				
-				if(!stream.str().empty())
-				{
-					writeString(stream.str());
-				}
-			}
-			
-#if USE_SESSION_GROUPS			
-			// create the main session group
-			sessionGroupCreateSendMessage();
-			
-			setState(stateCreatingSessionGroup);
-#else
-			// Not using session groups -- skip the stateCreatingSessionGroup state.
-			setState(stateNoChannel);
-
-			// Initial kick-off of channel lookup logic
-			parcelChanged();		
-#endif
-		break;
-		
-		//MARK: stateCreatingSessionGroup
-		case stateCreatingSessionGroup:
-			if(mSessionTerminateRequested || !mVoiceEnabled)
-			{
-				// TODO: Question: is this the right way out of this state
-				setState(stateSessionTerminated);
-			}
-			else if(!mMainSessionGroupHandle.empty())
-			{
-				setState(stateNoChannel);
-				
-				// Start looped recording (needed for "panic button" anti-griefing tool)
-				recordingLoopStart();
-
-				// Initial kick-off of channel lookup logic
-				parcelChanged();		
-			}
-		break;
-					
-		//MARK: stateNoChannel
-		case stateNoChannel:
-			// Do this here as well as inside sendPositionalUpdate().  
-			// Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
-			sendFriendsListUpdates();
-			
-			if(mSessionTerminateRequested || !mVoiceEnabled)
-			{
-				// TODO: Question: Is this the right way out of this state?
-				setState(stateSessionTerminated);
-			}
-			else if(mTuningMode)
-			{
-				mTuningExitState = stateNoChannel;
-				setState(stateMicTuningStart);
-			}
-			else if(sessionNeedsRelog(mNextAudioSession))
-			{
-				requestRelog();
-				setState(stateSessionTerminated);
-			}
-			else if(mNextAudioSession)
-			{				
-				sessionState *oldSession = mAudioSession;
-
-				mAudioSession = mNextAudioSession;
-				if(!mAudioSession->mReconnect)	
-				{
-					mNextAudioSession = NULL;
-				}
-				
-				// The old session may now need to be deleted.
-				reapSession(oldSession);
-				
-				if(!mAudioSession->mHandle.empty())
-				{
-					// Connect to a session by session handle
-
-					sessionMediaConnectSendMessage(mAudioSession);
-				}
-				else
-				{
-					// Connect to a session by URI
-					sessionCreateSendMessage(mAudioSession, true, false);
-				}
-
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
-				setState(stateJoiningSession);
-			}
-			else if(!mSpatialSessionURI.empty())
-			{
-				// If we're not headed elsewhere and have a spatial URI, return to spatial.
-				switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
-			}
-		break;
-
-		//MARK: stateJoiningSession
-		case stateJoiningSession:		// waiting for session handle
-			// joinedAudioSession() will transition from here to stateSessionJoined.
-			if(!mVoiceEnabled)
-			{
-				// User bailed out during connect -- jump straight to teardown.
-				setState(stateSessionTerminated);
-			}
-			else if(mSessionTerminateRequested)
-			{
-				if(mAudioSession && !mAudioSession->mHandle.empty())
-				{
-					// Only allow direct exits from this state in p2p calls (for cancelling an invite).
-					// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
-					if(mAudioSession->mIsP2P)
-					{
-						sessionMediaDisconnectSendMessage(mAudioSession);
-						setState(stateSessionTerminated);
-					}
-				}
-			}
-		break;
-		
-		//MARK: stateSessionJoined
-		case stateSessionJoined:		// session handle received
-			// It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
-			// before continuing from this state.  They can happen in either order, and if I don't wait for both, things can get stuck.
-			// For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
-			// This is a cheap way to make sure both have happened before proceeding.
-			if(mAudioSession && mAudioSession->mVoiceEnabled)
-			{
-				// Dirty state that may need to be sync'ed with the daemon.
-				mPTTDirty = true;
-				mSpeakerVolumeDirty = true;
-				mSpatialCoordsDirty = true;
-				
-				setState(stateRunning);
-				
-				// Start the throttle timer
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-
-				// Events that need to happen when a session is joined could go here.
-				// Maybe send initial spatial data?
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
-
-			}
-			else if(!mVoiceEnabled)
-			{
-				// User bailed out during connect -- jump straight to teardown.
-				setState(stateSessionTerminated);
-			}
-			else if(mSessionTerminateRequested)
-			{
-				// Only allow direct exits from this state in p2p calls (for cancelling an invite).
-				// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
-				if(mAudioSession && mAudioSession->mIsP2P)
-				{
-					sessionMediaDisconnectSendMessage(mAudioSession);
-					setState(stateSessionTerminated);
-				}
-			}
-		break;
-		
-		//MARK: stateRunning
-		case stateRunning:				// steady state
-			// Disabling voice or disconnect requested.
-			if(!mVoiceEnabled || mSessionTerminateRequested)
-			{
-				leaveAudioSession();
-			}
-			else
-			{
-				
-				// Figure out whether the PTT state needs to change
-				{
-					bool newPTT;
-					if(mUsePTT)
-					{
-						// If configured to use PTT, track the user state.
-						newPTT = mUserPTTState;
-					}
-					else
-					{
-						// If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
-						newPTT = true;
-					}
-					
-					if(mMuteMic)
-					{
-						// This always overrides any other PTT setting.
-						newPTT = false;
-					}
-					
-					// Dirty if state changed.
-					if(newPTT != mPTT)
-					{
-						mPTT = newPTT;
-						mPTTDirty = true;
-					}
-				}
-				
-				if(!inSpatialChannel())
-				{
-					// When in a non-spatial channel, never send positional updates.
-					mSpatialCoordsDirty = false;
-				}
-				else
-				{
-					// Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
-					enforceTether();
-				}
-				
-				// Send an update if the ptt state has changed (which shouldn't be able to happen that often -- the user can only click so fast)
-				// or every 10hz, whichever is sooner.
-				if((mAudioSession && mAudioSession->mVolumeDirty) || mPTTDirty || mSpeakerVolumeDirty || mUpdateTimer.hasExpired())
-				{
-					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-					sendPositionalUpdate();
-				}
-			}
-		break;
-		
-		//MARK: stateLeavingSession
-		case stateLeavingSession:		// waiting for terminate session response
-			// The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
-		break;
-
-		//MARK: stateSessionTerminated
-		case stateSessionTerminated:
-			
-			// Must do this first, since it uses mAudioSession.
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
-			
-			if(mAudioSession)
-			{
-				sessionState *oldSession = mAudioSession;
-
-				mAudioSession = NULL;
-				// We just notified status observers about this change.  Don't do it again.
-				mAudioSessionChanged = false;
-
-				// The old session may now need to be deleted.
-				reapSession(oldSession);
-			}
-			else
-			{
-				LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
-			}
-	
-			// Always reset the terminate request flag when we get here.
-			mSessionTerminateRequested = false;
-
-			if(mVoiceEnabled && !mRelogRequested)
-			{				
-				// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
-				setState(stateNoChannel);
-			}
-			else
-			{
-				// Shutting down voice, continue with disconnecting.
-				logout();
-				
-				// The state machine will take it from here
-				mRelogRequested = false;
-			}
-			
-		break;
-		
-		//MARK: stateLoggingOut
-		case stateLoggingOut:			// waiting for logout response
-			// The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
-		break;
-		
-		//MARK: stateLoggedOut
-		case stateLoggedOut:			// logout response received
-			
-			// Once we're logged out, all these things are invalid.
-			mAccountHandle.clear();
-			deleteAllSessions();
-			deleteAllBuddies();
-
-			if(mVoiceEnabled && !mRelogRequested)
-			{
-				// User was logged out, but wants to be logged in.  Send a new login request.
-				setState(stateNeedsLogin);
-			}
-			else
-			{
-				// shut down the connector
-				connectorShutdown();
-			}
-		break;
-		
-		//MARK: stateConnectorStopping
-		case stateConnectorStopping:	// waiting for connector stop
-			// The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
-		break;
-
-		//MARK: stateConnectorStopped
-		case stateConnectorStopped:		// connector stop received
-			setState(stateDisableCleanup);
-		break;
-
-		//MARK: stateConnectorFailed
-		case stateConnectorFailed:
-			setState(stateConnectorFailedWaiting);
-		break;
-		//MARK: stateConnectorFailedWaiting
-		case stateConnectorFailedWaiting:
-			if(!mVoiceEnabled)
-			{
-				setState(stateDisableCleanup);
-			}
-		break;
-
-		//MARK: stateLoginFailed
-		case stateLoginFailed:
-			setState(stateLoginFailedWaiting);
-		break;
-		//MARK: stateLoginFailedWaiting
-		case stateLoginFailedWaiting:
-			if(!mVoiceEnabled)
-			{
-				setState(stateDisableCleanup);
-			}
-		break;
-
-		//MARK: stateJoinSessionFailed
-		case stateJoinSessionFailed:
-			// Transition to error state.  Send out any notifications here.
-			if(mAudioSession)
-			{
-				LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
-			}
-			else
-			{
-				LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
-			}
-			
-			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
-			setState(stateJoinSessionFailedWaiting);
-		break;
-		
-		//MARK: stateJoinSessionFailedWaiting
-		case stateJoinSessionFailedWaiting:
-			// Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
-			// Region crossings may leave this state and try the join again.
-			if(mSessionTerminateRequested)
-			{
-				setState(stateSessionTerminated);
-			}
-		break;
-		
-		//MARK: stateJail
-		case stateJail:
-			// We have given up.  Do nothing.
-		break;
-
-	}
-	
-	if(mAudioSession && mAudioSession->mParticipantsChanged)
-	{
-		mAudioSession->mParticipantsChanged = false;
-		mAudioSessionChanged = true;
-	}
-	
-	if(mAudioSessionChanged)
-	{
-		mAudioSessionChanged = false;
-		notifyParticipantObservers();
-	}
-}
-
-void LLVoiceClient::closeSocket(void)
-{
-	mSocket.reset();
-	mConnected = false;	
-}
-
-void LLVoiceClient::loginSendMessage()
-{
-	std::ostringstream stream;
-
-	bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
-
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
-		<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-		<< "<AccountName>" << mAccountName << "</AccountName>"
-		<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
-		<< "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
-		<< "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
-		<< "<BuddyManagementMode>Application</BuddyManagementMode>"
-		<< "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
-		<< (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::logout()
-{
-	// Ensure that we'll re-request provisioning before logging in again
-	mAccountPassword.clear();
-	mVoiceAccountServerURI.clear();
-	
-	setState(stateLoggingOut);
-	logoutSendMessage();
-}
-
-void LLVoiceClient::logoutSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		mAccountHandle.clear();
-
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::accountListBlockRulesSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::accountListAutoAcceptRulesSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::sessionGroupCreateSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-			<< "<Type>Normal</Type>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
-{
-	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-	
-	session->mCreateInProgress = true;
-	if(startAudio)
-	{
-		session->mMediaConnectInProgress = true;
-	}
-
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
-		<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "<URI>" << session->mSIPURI << "</URI>";
-
-	static const std::string allowed_chars =
-				"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-				"0123456789"
-				"-._~";
-
-	if(!session->mHash.empty())
-	{
-		stream
-			<< "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
-			<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
-	}
-	
-	stream
-		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
-		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
-		<< "<Name>" << mChannelName << "</Name>"
-	<< "</Request>\n\n\n";
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
-{
-	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-	
-	session->mCreateInProgress = true;
-	if(startAudio)
-	{
-		session->mMediaConnectInProgress = true;
-	}
-	
-	std::string password;
-	if(!session->mHash.empty())
-	{
-		static const std::string allowed_chars =
-					"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-					"0123456789"
-					"-._~"
-					;
-		password = LLURI::escape(session->mHash, allowed_chars);
-	}
-
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<URI>" << session->mSIPURI << "</URI>"
-		<< "<Name>" << mChannelName << "</Name>"
-		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
-		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
-		<< "<Password>" << password << "</Password>"
-		<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
-	<< "</Request>\n\n\n"
-	;
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
-{
-	LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
-
-	session->mMediaConnectInProgress = true;
-	
-	std::ostringstream stream;
-
-	stream
-	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-		<< "<Media>Audio</Media>"
-	<< "</Request>\n\n\n";
-
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionTextConnectSendMessage(sessionState *session)
-{
-	LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
-	
-	std::ostringstream stream;
-
-	stream
-	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionTerminate()
-{
-	mSessionTerminateRequested = true;
-}
-
-void LLVoiceClient::requestRelog()
-{
-	mSessionTerminateRequested = true;
-	mRelogRequested = true;
-}
-
-
-void LLVoiceClient::leaveAudioSession()
-{
-	if(mAudioSession)
-	{
-		LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
-
-		switch(getState())
-		{
-			case stateNoChannel:
-				// In this case, we want to pretend the join failed so our state machine doesn't get stuck.
-				// Skip the join failed transition state so we don't send out error notifications.
-				setState(stateJoinSessionFailedWaiting);
-			break;
-			case stateJoiningSession:
-			case stateSessionJoined:
-			case stateRunning:
-				if(!mAudioSession->mHandle.empty())
-				{
-
-#if RECORD_EVERYTHING
-					// HACK: for testing only
-					// Save looped recording
-					std::string savepath("/tmp/vivoxrecording");
-					{
-						time_t now = time(NULL);
-						const size_t BUF_SIZE = 64;
-						char time_str[BUF_SIZE];	/* Flawfinder: ignore */
-						
-						strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
-						savepath += time_str;
-					}
-					recordingLoopSave(savepath);
-#endif
-
-					sessionMediaDisconnectSendMessage(mAudioSession);
-					setState(stateLeavingSession);
-				}
-				else
-				{
-					LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
-					setState(stateSessionTerminated);
-				}
-			break;
-			case stateJoinSessionFailed:
-			case stateJoinSessionFailedWaiting:
-				setState(stateSessionTerminated);
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
-			break;
-		}
-	}
-	else
-	{
-		LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
-		setState(stateSessionTerminated);
-	}
-}
-
-void LLVoiceClient::sessionTerminateSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-		<< "<Media>Audio</Media>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-	
-}
-
-void LLVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::getCaptureDevicesSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::getRenderDevicesSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::clearCaptureDevices()
-{
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-	mCaptureDevices.clear();
-}
-
-void LLVoiceClient::addCaptureDevice(const std::string& name)
-{
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-
-	mCaptureDevices.push_back(name);
-}
-
-LLVoiceClient::deviceList *LLVoiceClient::getCaptureDevices()
-{
-	return &mCaptureDevices;
-}
-
-void LLVoiceClient::setCaptureDevice(const std::string& name)
-{
-	if(name == "Default")
-	{
-		if(!mCaptureDevice.empty())
-		{
-			mCaptureDevice.clear();
-			mCaptureDeviceDirty = true;	
-		}
-	}
-	else
-	{
-		if(mCaptureDevice != name)
-		{
-			mCaptureDevice = name;
-			mCaptureDeviceDirty = true;	
-		}
-	}
-}
-
-void LLVoiceClient::clearRenderDevices()
-{	
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-	mRenderDevices.clear();
-}
-
-void LLVoiceClient::addRenderDevice(const std::string& name)
-{
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-	mRenderDevices.push_back(name);
-}
-
-LLVoiceClient::deviceList *LLVoiceClient::getRenderDevices()
-{
-	return &mRenderDevices;
-}
-
-void LLVoiceClient::setRenderDevice(const std::string& name)
-{
-	if(name == "Default")
-	{
-		if(!mRenderDevice.empty())
-		{
-			mRenderDevice.clear();
-			mRenderDeviceDirty = true;	
-		}
-	}
-	else
-	{
-		if(mRenderDevice != name)
-		{
-			mRenderDevice = name;
-			mRenderDeviceDirty = true;	
-		}
-	}
-	
-}
-
-void LLVoiceClient::tuningStart()
-{
-	mTuningMode = true;
-	if(getState() >= stateNoChannel)
-	{
-		sessionTerminate();
-	}
-}
-
-void LLVoiceClient::tuningStop()
-{
-	mTuningMode = false;
-}
-
-bool LLVoiceClient::inTuningMode()
-{
-	bool result = false;
-	switch(getState())
-	{
-	case stateMicTuningRunning:
-		result = true;
-		break;
-	default:
-		break;
-	}
-	return result;
-}
-
-void LLVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
-{		
-	mTuningAudioFile = name;
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
-    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
-    << "<Loop>" << (loop?"1":"0") << "</Loop>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::tuningRenderStopSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
-    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
-{
-	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
-	
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
-    << "<Duration>" << duration << "</Duration>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVoiceClient::tuningCaptureStopSendMessage()
-{
-	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
-	
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-
-	mTuningEnergy = 0.0f;
-}
-
-void LLVoiceClient::tuningSetMicVolume(float volume)
-{
-	int scaled_volume = scale_mic_volume(volume);
-
-	if(scaled_volume != mTuningMicVolume)
-	{
-		mTuningMicVolume = scaled_volume;
-		mTuningMicVolumeDirty = true;
-	}
-}
-
-void LLVoiceClient::tuningSetSpeakerVolume(float volume)
-{
-	int scaled_volume = scale_speaker_volume(volume);	
-
-	if(scaled_volume != mTuningSpeakerVolume)
-	{
-		mTuningSpeakerVolume = scaled_volume;
-		mTuningSpeakerVolumeDirty = true;
-	}
-}
-				
-float LLVoiceClient::tuningGetEnergy(void)
-{
-	return mTuningEnergy;
-}
-
-bool LLVoiceClient::deviceSettingsAvailable()
-{
-	bool result = true;
-	
-	if(!mConnected)
-		result = false;
-	
-	if(mRenderDevices.empty())
-		result = false;
-	
-	return result;
-}
-
-void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
-{
-	if(clearCurrentList)
-	{
-		clearCaptureDevices();
-		clearRenderDevices();
-	}
-	getCaptureDevicesSendMessage();
-	getRenderDevicesSendMessage();
-}
-
-void LLVoiceClient::daemonDied()
-{
-	// The daemon died, so the connection is gone.  Reset everything and start over.
-	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
-
-	// Try to relaunch the daemon
-	setState(stateDisableCleanup);
-}
-
-void LLVoiceClient::giveUp()
-{
-	// All has failed.  Clean up and stop trying.
-	closeSocket();
-	deleteAllSessions();
-	deleteAllBuddies();
-	
-	setState(stateJail);
-}
-
-static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
-{
-	F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the  new position and velocity
-	F64 npos[3];
-	
-	// The original XML command was sent like this:
-	/*
-			<< "<Position>"
-				<< "<X>" << pos[VX] << "</X>"
-				<< "<Y>" << pos[VZ] << "</Y>"
-				<< "<Z>" << pos[VY] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << mAvatarVelocity[VX] << "</X>"
-				<< "<Y>" << mAvatarVelocity[VZ] << "</Y>"
-				<< "<Z>" << mAvatarVelocity[VY] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << l.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VX] << "</Y>"
-				<< "<Z>" << a.mV[VX] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << l.mV[VZ] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VY] << "</X>"
-				<< "<Y>" << u.mV [VZ] << "</Y>"
-				<< "<Z>" << a.mV [VY] << "</Z>"
-			<< "</LeftOrientation>";
-	*/
-
-#if 1
-	// This was the original transform done when building the XML command
-	nat[0] = left.mV[VX];
-	nat[1] = up.mV[VX];
-	nat[2] = at.mV[VX];
-
-	nup[0] = left.mV[VZ];
-	nup[1] = up.mV[VY];
-	nup[2] = at.mV[VZ];
-
-	nl[0] = left.mV[VY];
-	nl[1] = up.mV[VZ];
-	nl[2] = at.mV[VY];
-
-	npos[0] = pos.mdV[VX];
-	npos[1] = pos.mdV[VZ];
-	npos[2] = pos.mdV[VY];
-
-	nvel[0] = vel.mV[VX];
-	nvel[1] = vel.mV[VZ];
-	nvel[2] = vel.mV[VY];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-	
-	// This was the original transform done in the SDK
-	nat[0] = at.mV[2];
-	nat[1] = 0; // y component of at vector is always 0, this was up[2]
-	nat[2] = -1 * left.mV[2];
-
-	// We override whatever the application gives us
-	nup[0] = 0; // x component of up vector is always 0
-	nup[1] = 1; // y component of up vector is always 1
-	nup[2] = 0; // z component of up vector is always 0
-
-	nl[0] = at.mV[0];
-	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
-	nl[2] = -1 * left.mV[0];
-
-	npos[2] = pos.mdV[2] * -1.0;
-	npos[1] = pos.mdV[1];
-	npos[0] = pos.mdV[0];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-#else
-	// This is the compose of the two transforms (at least, that's what I'm trying for)
-	nat[0] = at.mV[VX];
-	nat[1] = 0; // y component of at vector is always 0, this was up[2]
-	nat[2] = -1 * up.mV[VZ];
-
-	// We override whatever the application gives us
-	nup[0] = 0; // x component of up vector is always 0
-	nup[1] = 1; // y component of up vector is always 1
-	nup[2] = 0; // z component of up vector is always 0
-
-	nl[0] = left.mV[VX];
-	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
-	nl[2] = -1 * left.mV[VY];
-
-	npos[0] = pos.mdV[VX];
-	npos[1] = pos.mdV[VZ];
-	npos[2] = pos.mdV[VY] * -1.0;
-
-	nvel[0] = vel.mV[VX];
-	nvel[1] = vel.mV[VZ];
-	nvel[2] = vel.mV[VY];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-	
-#endif
-}
-
-void LLVoiceClient::sendPositionalUpdate(void)
-{	
-	std::ostringstream stream;
-	
-	if(mSpatialCoordsDirty)
-	{
-		LLVector3 l, u, a, vel;
-		LLVector3d pos;
-
-		mSpatialCoordsDirty = false;
-		
-		// Always send both speaker and listener positions together.
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"		
-			<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
-		
-		stream << "<SpeakerPosition>";
-
-//		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
-		l = mAvatarRot.getLeftRow();
-		u = mAvatarRot.getUpRow();
-		a = mAvatarRot.getFwdRow();
-		pos = mAvatarPosition;
-		vel = mAvatarVelocity;
-
-		// SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
-		// The old transform is replicated by this function.
-		oldSDKTransform(l, u, a, pos, vel);
-		
-		stream 
-			<< "<Position>"
-				<< "<X>" << pos.mdV[VX] << "</X>"
-				<< "<Y>" << pos.mdV[VY] << "</Y>"
-				<< "<Z>" << pos.mdV[VZ] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << vel.mV[VX] << "</X>"
-				<< "<Y>" << vel.mV[VY] << "</Y>"
-				<< "<Z>" << vel.mV[VZ] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << a.mV[VX] << "</X>"
-				<< "<Y>" << a.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << u.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << u.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VX] << "</X>"
-				<< "<Y>" << l.mV [VY] << "</Y>"
-				<< "<Z>" << l.mV [VZ] << "</Z>"
-			<< "</LeftOrientation>";
-
-		stream << "</SpeakerPosition>";
-
-		stream << "<ListenerPosition>";
-
-		LLVector3d	earPosition;
-		LLVector3	earVelocity;
-		LLMatrix3	earRot;
-		
-		switch(mEarLocation)
-		{
-			case earLocCamera:
-			default:
-				earPosition = mCameraPosition;
-				earVelocity = mCameraVelocity;
-				earRot = mCameraRot;
-			break;
-			
-			case earLocAvatar:
-				earPosition = mAvatarPosition;
-				earVelocity = mAvatarVelocity;
-				earRot = mAvatarRot;
-			break;
-			
-			case earLocMixed:
-				earPosition = mAvatarPosition;
-				earVelocity = mAvatarVelocity;
-				earRot = mCameraRot;
-			break;
-		}
-
-		l = earRot.getLeftRow();
-		u = earRot.getUpRow();
-		a = earRot.getFwdRow();
-		pos = earPosition;
-		vel = earVelocity;
-
-//		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
-		
-		oldSDKTransform(l, u, a, pos, vel);
-		
-		stream 
-			<< "<Position>"
-				<< "<X>" << pos.mdV[VX] << "</X>"
-				<< "<Y>" << pos.mdV[VY] << "</Y>"
-				<< "<Z>" << pos.mdV[VZ] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << vel.mV[VX] << "</X>"
-				<< "<Y>" << vel.mV[VY] << "</Y>"
-				<< "<Z>" << vel.mV[VZ] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << a.mV[VX] << "</X>"
-				<< "<Y>" << a.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << u.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << u.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VX] << "</X>"
-				<< "<Y>" << l.mV [VY] << "</Y>"
-				<< "<Z>" << l.mV [VZ] << "</Z>"
-			<< "</LeftOrientation>";
-
-
-		stream << "</ListenerPosition>";
-
-		stream << "</Request>\n\n\n";
-	}	
-	
-	if(mAudioSession && mAudioSession->mVolumeDirty)
-	{
-		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
-		mAudioSession->mVolumeDirty = false;
-		
-		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
-		{
-			participantState *p = iter->second;
-			
-			if(p->mVolumeDirty)
-			{
-				// Can't set volume/mute for yourself
-				if(!p->mIsSelf)
-				{
-					int volume = 56; // nominal default value
-					bool mute = p->mOnMuteList;
-					
-					if(p->mUserVolume != -1)
-					{
-						// scale from user volume in the range 0-400 (with 100 as "normal") to vivox volume in the range 0-100 (with 56 as "normal")
-						if(p->mUserVolume < 100)
-							volume = (p->mUserVolume * 56) / 100;
-						else
-							volume = (((p->mUserVolume - 100) * (100 - 56)) / 300) + 56;
-					}
-					else if(p->mVolume != -1)
-					{
-						// Use the previously reported internal volume (comes in with a ParticipantUpdatedEvent)
-						volume = p->mVolume;
-					}
-										
-
-					if(mute)
-					{
-						// SetParticipantMuteForMe doesn't work in p2p sessions.
-						// If we want the user to be muted, set their volume to 0 as well.
-						// This isn't perfect, but it will at least reduce their volume to a minimum.
-						volume = 0;
-					}
-					
-					if(volume == 0)
-						mute = true;
-
-					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
-					
-					// SLIM SDK: Send both volume and mute commands.
-					
-					// Send a "volume for me" command for the user.
-					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
-						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
-						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
-						<< "<Volume>" << volume << "</Volume>"
-						<< "</Request>\n\n\n";
-
-					// Send a "mute for me" command for the user
-					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
-						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
-						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
-						<< "<Mute>" << (mute?"1":"0") << "</Mute>"
-						<< "</Request>\n\n\n";
-				}
-				
-				p->mVolumeDirty = false;
-			}
-		}
-	}
-			
-	buildLocalAudioUpdates(stream);
-	
-	if(!stream.str().empty())
-	{
-		writeString(stream.str());
-	}
-	
-	// Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
-	// Batching them all together can choke SLVoice, so send them in separate writes.
-	sendFriendsListUpdates();
-}
-
-void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
-{
-	if(mCaptureDeviceDirty)
-	{
-		LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
-	
-		stream 
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
-			<< "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
-		<< "</Request>"
-		<< "\n\n\n";
-		
-		mCaptureDeviceDirty = false;
-	}
-}
-
-void LLVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
-{
-	if(mRenderDeviceDirty)
-	{
-		LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
-			<< "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
-		<< "</Request>"
-		<< "\n\n\n";
-		mRenderDeviceDirty = false;
-	}
-}
-
-void LLVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
-{
-	buildSetCaptureDevice(stream);
-
-	buildSetRenderDevice(stream);
-
-	if(mPTTDirty)
-	{
-		mPTTDirty = false;
-
-		// Send a local mute command.
-		// NOTE that the state of "PTT" is the inverse of "local mute".
-		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
-		
-		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << (mPTT?"false":"true") << "</Value>"
-			<< "</Request>\n\n\n";
-		
-	}
-
-	if(mSpeakerMuteDirty)
-	{
-		const char *muteval = ((mSpeakerVolume == 0)?"true":"false");
-
-		mSpeakerMuteDirty = false;
-
-		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
-		
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << muteval << "</Value>"
-			<< "</Request>\n\n\n";	
-		
-	}
-	
-	if(mSpeakerVolumeDirty)
-	{
-		mSpeakerVolumeDirty = false;
-
-		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << mSpeakerVolume << "</Value>"
-			<< "</Request>\n\n\n";
-			
-	}
-	
-	if(mMicVolumeDirty)
-	{
-		mMicVolumeDirty = false;
-
-		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << mMicVolume << "</Value>"
-			<< "</Request>\n\n\n";				
-	}
-
-	
-}
-
-void LLVoiceClient::checkFriend(const LLUUID& id)
-{
-	std::string name;
-	buddyListEntry *buddy = findBuddy(id);
-
-	// Make sure we don't add a name before it's been looked up.
-	if(gCacheName->getFullName(id, name))
-	{
-
-		const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
-		bool canSeeMeOnline = false;
-		if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
-			canSeeMeOnline = true;
-		
-		// When we get here, mNeedsSend is true and mInSLFriends is false.  Change them as necessary.
-		
-		if(buddy)
-		{
-			// This buddy is already in both lists.
-
-			if(name != buddy->mDisplayName)
-			{
-				// The buddy is in the list with the wrong name.  Update it with the correct name.
-				LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
-				buddy->mDisplayName = name;
-				buddy->mNeedsNameUpdate = true;		// This will cause the buddy to be resent.
-			}
-		}
-		else
-		{
-			// This buddy was not in the vivox list, needs to be added.
-			buddy = addBuddy(sipURIFromID(id), name);
-			buddy->mUUID = id;
-		}
-		
-		// In all the above cases, the buddy is in the SL friends list (which is how we got here).
-		buddy->mInSLFriends = true;
-		buddy->mCanSeeMeOnline = canSeeMeOnline;
-		buddy->mNameResolved = true;
-		
-	}
-	else
-	{
-		// This name hasn't been looked up yet.  Don't do anything with this buddy list entry until it has.
-		if(buddy)
-		{
-			buddy->mNameResolved = false;
-		}
-		
-		// Initiate a lookup.
-		// The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
-		lookupName(id);
-	}
-}
-
-void LLVoiceClient::clearAllLists()
-{
-	// FOR TESTING ONLY
-	
-	// This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
-	{
-		buddyListEntry *buddy = buddy_it->second;
-		buddy_it++;
-		
-		std::ostringstream stream;
-
-		if(buddy->mInVivoxBuddies)
-		{
-			// delete this entry from the vivox buddy list
-			buddy->mInVivoxBuddies = false;
-			LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-				<< "</Request>\n\n\n";		
-		}
-
-		if(buddy->mHasBlockListEntry)
-		{
-			// Delete the associated block list entry (so the block list doesn't fill up with junk)
-			buddy->mHasBlockListEntry = false;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-				<< "</Request>\n\n\n";								
-		}
-		if(buddy->mHasAutoAcceptListEntry)
-		{
-			// Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
-			buddy->mHasAutoAcceptListEntry = false;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-				<< "</Request>\n\n\n";
-		}
-
-		writeString(stream.str());
-
-	}
-}
-
-void LLVoiceClient::sendFriendsListUpdates()
-{
-	if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
-	{
-		mFriendsListDirty = false;
-		
-		if(0)
-		{
-			// FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
-			clearAllLists();
-			return;
-		}
-		
-		LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
-		
-		buddyListMap::iterator buddy_it;
-		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
-		{
-			// reset the temp flags in the local buddy list
-			buddy_it->second->mInSLFriends = false;
-		}
-		
-		// correlate with the friends list
-		{
-			LLCollectAllBuddies collect;
-			LLAvatarTracker::instance().applyFunctor(collect);
-			LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
-			LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
-			
-			for ( ; it != end; ++it)
-			{
-				checkFriend(it->second);
-			}
-			it = collect.mOffline.begin();
-			end = collect.mOffline.end();
-			for ( ; it != end; ++it)
-			{
-				checkFriend(it->second);
-			}
-		}
-				
-		LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
-
-		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
-		{
-			buddyListEntry *buddy = buddy_it->second;
-			buddy_it++;
-			
-			// Ignore entries that aren't resolved yet.
-			if(buddy->mNameResolved)
-			{
-				std::ostringstream stream;
-
-				if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
-				{					
-					if(mNumberOfAliases > 0)
-					{
-						// Add (or update) this entry in the vivox buddy list
-						buddy->mInVivoxBuddies = true;
-						buddy->mNeedsNameUpdate = false;
-						LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-						stream 
-							<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-								<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
-								<< "<BuddyData></BuddyData>"	// Without this, SLVoice doesn't seem to parse the command.
-								<< "<GroupID>0</GroupID>"
-							<< "</Request>\n\n\n";	
-					}
-				}
-				else if(!buddy->mInSLFriends)
-				{
-					// This entry no longer exists in your SL friends list.  Remove all traces of it from the Vivox buddy list.
- 					if(buddy->mInVivoxBuddies)
-					{
-						// delete this entry from the vivox buddy list
-						buddy->mInVivoxBuddies = false;
-						LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-							<< "</Request>\n\n\n";		
-					}
-
-					if(buddy->mHasBlockListEntry)
-					{
-						// Delete the associated block list entry, if any
-						buddy->mHasBlockListEntry = false;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-							<< "</Request>\n\n\n";								
-					}
-					if(buddy->mHasAutoAcceptListEntry)
-					{
-						// Delete the associated auto-accept list entry, if any
-						buddy->mHasAutoAcceptListEntry = false;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-							<< "</Request>\n\n\n";
-					}
-				}
-				
-				if(buddy->mInSLFriends)
-				{
-
-					if(buddy->mCanSeeMeOnline)
-					{
-						// Buddy should not be blocked.
-
-						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-						
-						// If the buddy has a block list entry, delete it.
-						if(buddy->mHasBlockListEntry)
-						{
-							buddy->mHasBlockListEntry = false;
-							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-								<< "</Request>\n\n\n";		
-							
-							
-							// If we just deleted a block list entry, add an auto-accept entry.
-							if(!buddy->mHasAutoAcceptListEntry)
-							{
-								buddy->mHasAutoAcceptListEntry = true;								
-								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
-									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-									<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-									<< "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
-									<< "</Request>\n\n\n";
-							}
-						}
-					}
-					else
-					{
-						// Buddy should be blocked.
-						
-						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-
-						// If this buddy has an autoaccept entry, delete it
-						if(buddy->mHasAutoAcceptListEntry)
-						{
-							buddy->mHasAutoAcceptListEntry = false;
-							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-								<< "</Request>\n\n\n";
-						
-							// If we just deleted an auto-accept entry, add a block list entry.
-							if(!buddy->mHasBlockListEntry)
-							{
-								buddy->mHasBlockListEntry = true;
-								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
-									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-									<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-									<< "<PresenceOnly>1</PresenceOnly>"
-									<< "</Request>\n\n\n";								
-							}
-						}
-					}
-
-					if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
-					{
-						// Delete this entry from the local buddy list.  This should NOT invalidate the iterator,
-						// since it has already been incremented to the next entry.
-						deleteBuddy(buddy->mURI);
-					}
-
-				}
-				writeString(stream.str());
-			}
-		}
-	}
-}
-
-/////////////////////////////
-// Response/Event handlers
-
-void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
-{	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
-		setState(stateConnectorFailed);
-	}
-	else
-	{
-		// Connector created, move forward.
-		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
-		mAPIVersion = versionID;
-		mConnectorHandle = connectorHandle;
-		if(getState() == stateConnectorStarting)
-		{
-			setState(stateConnectorStarted);
-		}
-	}
-}
-
-void LLVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
-{ 
-	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
-	
-	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
-	
-	if ( statusCode == 401 )
-	{
-		// Login failure which is probably caused by the delay after a user's password being updated.
-		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		setState(stateLoginRetry);
-	}
-	else if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		setState(stateLoginFailed);
-	}
-	else
-	{
-		// Login succeeded, move forward.
-		mAccountHandle = accountHandle;
-		mNumberOfAliases = numberOfAliases;
-		// This needs to wait until the AccountLoginStateChangeEvent is received.
-//		if(getState() == stateLoggingIn)
-//		{
-//			setState(stateLoggedIn);
-//		}
-	}
-}
-
-void LLVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{	
-	sessionState *session = findSessionBeingCreatedByURI(requestId);
-	
-	if(session)
-	{
-		session->mCreateInProgress = false;
-	}
-	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-			{
-				setState(stateJoinSessionFailed);
-			}
-			else
-			{
-				reapSession(session);
-			}
-		}
-	}
-	else
-	{
-		LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
-		if(session)
-		{
-			setSessionHandle(session, sessionHandle);
-		}
-	}
-}
-
-void LLVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{	
-	sessionState *session = findSessionBeingCreatedByURI(requestId);
-	
-	if(session)
-	{
-		session->mCreateInProgress = false;
-	}
-	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-			{
-				setState(stateJoinSessionFailed);
-			}
-			else
-			{
-				reapSession(session);
-			}
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
-		if(session)
-		{
-			setSessionHandle(session, sessionHandle);
-		}
-	}
-}
-
-void LLVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
-{
-	sessionState *session = findSession(requestId);
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mMediaConnectInProgress = false;
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-				setState(stateJoinSessionFailed);
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
-	}
-}
-
-void LLVoiceClient::logoutResponse(int statusCode, std::string &statusString)
-{	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
-		// Should this ever fail?  do we care if it does?
-	}
-}
-
-void LLVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
-{
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
-		// Should this ever fail?  do we care if it does?
-	}
-	
-	mConnected = false;
-	
-	if(getState() == stateConnectorStopping)
-	{
-		setState(stateConnectorStopped);
-	}
-}
-
-void LLVoiceClient::sessionAddedEvent(
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		bool isChannel, 
-		bool incoming,
-		std::string &nameString,
-		std::string &applicationString)
-{
-	sessionState *session = NULL;
-
-	LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
-	
-	session = addSession(uriString, sessionHandle);
-	if(session)
-	{
-		session->mGroupHandle = sessionGroupHandle;
-		session->mIsChannel = isChannel;
-		session->mIncoming = incoming;
-		session->mAlias = alias;
-			
-		// Generate a caller UUID -- don't need to do this for channels
-		if(!session->mIsChannel)
-		{
-			if(IDFromName(session->mSIPURI, session->mCallerID))
-			{
-				// Normal URI(base64-encoded UUID) 
-			}
-			else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
-			{
-				// Wrong URI, but an alias is available.  Stash the incoming URI as an alternate
-				session->mAlternateSIPURI = session->mSIPURI;
-				
-				// and generate a proper URI from the ID.
-				setSessionURI(session, sipURIFromID(session->mCallerID));
-			}
-			else
-			{
-				LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
-				setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
-				session->mSynthesizedCallerID = true;
-				
-				// Can't look up the name in this case -- we have to extract it from the URI.
-				std::string namePortion = nameFromsipURI(session->mSIPURI);
-				if(namePortion.empty())
-				{
-					// Didn't seem to be a SIP URI, just use the whole provided name.
-					namePortion = nameString;
-				}
-				
-				// Some incoming names may be separated with an underscore instead of a space.  Fix this.
-				LLStringUtil::replaceChar(namePortion, '_', ' ');
-				
-				// Act like we just finished resolving the name (this stores it in all the right places)
-				avatarNameResolved(session->mCallerID, namePortion);
-			}
-		
-			LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
-
-			if(!session->mSynthesizedCallerID)
-			{
-				// If we got here, we don't have a proper name.  Initiate a lookup.
-				lookupName(session->mCallerID);
-			}
-		}
-	}
-}
-
-void LLVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
-{
-	LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
-	
-#if USE_SESSION_GROUPS
-	if(mMainSessionGroupHandle.empty())
-	{
-		// This is the first (i.e. "main") session group.  Save its handle.
-		mMainSessionGroupHandle = sessionGroupHandle;
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
-	}
-#endif
-}
-
-void LLVoiceClient::joinedAudioSession(sessionState *session)
-{
-	if(mAudioSession != session)
-	{
-		sessionState *oldSession = mAudioSession;
-
-		mAudioSession = session;
-		mAudioSessionChanged = true;
-
-		// The old session may now need to be deleted.
-		reapSession(oldSession);
-	}
-	
-	// This is the session we're joining.
-	if(getState() == stateJoiningSession)
-	{
-		setState(stateSessionJoined);
-		
-		// SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
-		// Add the current user as a participant here.
-		participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
-		if(participant)
-		{
-			participant->mIsSelf = true;
-			lookupName(participant->mAvatarID);
-
-			LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName 
-					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-		}
-		
-		if(!session->mIsChannel)
-		{
-			// this is a p2p session.  Make sure the other end is added as a participant.
-			participantState *participant = session->addParticipant(session->mSIPURI);
-			if(participant)
-			{
-				if(participant->mAvatarIDValid)
-				{
-					lookupName(participant->mAvatarID);
-				}
-				else if(!session->mName.empty())
-				{
-					participant->mDisplayName = session->mName;
-					avatarNameResolved(participant->mAvatarID, session->mName);
-				}
-				
-				// TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
-				LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName 
-						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-			}
-		}
-	}
-}
-
-void LLVoiceClient::sessionRemovedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle)
-{
-	LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
-	
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		leftAudioSession(session);
-
-		// This message invalidates the session's handle.  Set it to empty.
-		setSessionHandle(session);
-		
-		// This also means that the session's session group is now empty.
-		// Terminate the session group so it doesn't leak.
-		sessionGroupTerminateSendMessage(session);
-		
-		// Reset the media state (we now have no info)
-		session->mMediaStreamState = streamStateUnknown;
-		session->mTextStreamState = streamStateUnknown;
-		
-		// Conditionally delete the session
-		reapSession(session);
-	}
-	else
-	{
-		LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
-	}
-}
-
-void LLVoiceClient::reapSession(sessionState *session)
-{
-	if(session)
-	{
-		if(!session->mHandle.empty())
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
-		}
-		else if(session->mCreateInProgress)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
-		}
-		else if(session->mMediaConnectInProgress)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
-		}
-		else if(session == mAudioSession)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
-		}
-		else if(session == mNextAudioSession)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
-		}
-		else
-		{
-			// TODO: Question: Should we check for queued text messages here?
-			// We don't have a reason to keep tracking this session, so just delete it.
-			LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
-			deleteSession(session);
-			session = NULL;
-		}	
-	}
-	else
-	{
-//		LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
-	}
-}
-
-// Returns true if the session seems to indicate we've moved to a region on a different voice server
-bool LLVoiceClient::sessionNeedsRelog(sessionState *session)
-{
-	bool result = false;
-	
-	if(session != NULL)
-	{
-		// Only make this check for spatial channels (so it won't happen for group or p2p calls)
-		if(session->mIsSpatial)
-		{
-			std::string::size_type atsign;
-			
-			atsign = session->mSIPURI.find("@");
-			
-			if(atsign != std::string::npos)
-			{
-				std::string urihost = session->mSIPURI.substr(atsign + 1);
-				if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
-				{
-					// The hostname in this URI is different from what we expect.  This probably means we need to relog.
-					
-					// We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
-					// mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
-					
-					result = true;
-				}
-			}
-		}
-	}
-	
-	return result;
-}
-
-void LLVoiceClient::leftAudioSession(
-	sessionState *session)
-{
-	if(mAudioSession == session)
-	{
-		switch(getState())
-		{
-			case stateJoiningSession:
-			case stateSessionJoined:
-			case stateRunning:
-			case stateLeavingSession:
-			case stateJoinSessionFailed:
-			case stateJoinSessionFailedWaiting:
-				// normal transition
-				LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
-				setState(stateSessionTerminated);
-			break;
-			
-			case stateSessionTerminated:
-				// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
-				LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
-				setState(stateSessionTerminated);
-			break;
-		}
-	}
-}
-
-void LLVoiceClient::accountLoginStateChangeEvent(
-		std::string &accountHandle, 
-		int statusCode, 
-		std::string &statusString, 
-		int state)
-{
-	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
-	/*
-		According to Mike S., status codes for this event are:
-		login_state_logged_out=0,
-        login_state_logged_in = 1,
-        login_state_logging_in = 2,
-        login_state_logging_out = 3,
-        login_state_resetting = 4,
-        login_state_error=100	
-	*/
-	
-	switch(state)
-	{
-		case 1:
-		if(getState() == stateLoggingIn)
-		{
-			setState(stateLoggedIn);
-		}
-		break;
-
-		case 3:
-			// The user is in the process of logging out.
-			setState(stateLoggingOut);
-		break;
-
-		case 0:
-			// The user has been logged out.  
-			setState(stateLoggedOut);
-		break;
-		
-		default:
-			//Used to be a commented out warning
-			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
-		break;
-	}
-}
-
-void LLVoiceClient::mediaStreamUpdatedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle, 
-	int statusCode, 
-	std::string &statusString, 
-	int state, 
-	bool incoming)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
-	
-	if(session)
-	{
-		// We know about this session
-		
-		// Save the state for later use
-		session->mMediaStreamState = state;
-		
-		switch(statusCode)
-		{
-			case 0:
-			case 200:
-				// generic success
-				// Don't change the saved error code (it may have been set elsewhere)
-			break;
-			default:
-				// save the status code for later
-				session->mErrorStatusCode = statusCode;
-			break;
-		}
-		
-		switch(state)
-		{
-			case streamStateIdle:
-				// Standard "left audio session"
-				session->mVoiceEnabled = false;
-				session->mMediaConnectInProgress = false;
-				leftAudioSession(session);
-			break;
-
-			case streamStateConnected:
-				session->mVoiceEnabled = true;
-				session->mMediaConnectInProgress = false;
-				joinedAudioSession(session);
-			break;
-			
-			case streamStateRinging:
-				if(incoming)
-				{
-					// Send the voice chat invite to the GUI layer
-					// *TODO: Question: Should we correlate with the mute list here?
-					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
-					session->mVoiceInvitePending = true;
-					if(session->mName.empty())
-					{
-						lookupName(session->mCallerID);
-					}
-					else
-					{
-						// Act like we just finished resolving the name
-						avatarNameResolved(session->mCallerID, session->mName);
-					}
-				}
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
-			break;
-			
-		}
-		
-	}
-	else
-	{
-		LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
-	}
-}
-
-void LLVoiceClient::textStreamUpdatedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle, 
-	bool enabled,
-	int state, 
-	bool incoming)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	if(session)
-	{
-		// Save the state for later use
-		session->mTextStreamState = state;
-		
-		// We know about this session
-		switch(state)
-		{
-			case 0:	// We see this when the text stream closes
-				LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
-			break;
-			
-			case 1:	// We see this on an incoming call from the Connector
-				// Try to send any text messages queued for this session.
-				sendQueuedTextMessages(session);
-
-				// Send the text chat invite to the GUI layer
-				// TODO: Question: Should we correlate with the mute list here?
-				session->mTextInvitePending = true;
-				if(session->mName.empty())
-				{
-					lookupName(session->mCallerID);
-				}
-				else
-				{
-					// Act like we just finished resolving the name
-					avatarNameResolved(session->mCallerID, session->mName);
-				}
-			break;
-
-			default:
-				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
-			break;
-			
-		}
-	}
-}
-
-void LLVoiceClient::participantAddedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &nameString, 
-		std::string &displayNameString, 
-		int participantType)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->addParticipant(uriString);
-		if(participant)
-		{
-			participant->mAccountName = nameString;
-
-			LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName 
-					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-
-			if(participant->mAvatarIDValid)
-			{
-				// Initiate a lookup
-				lookupName(participant->mAvatarID);
-			}
-			else
-			{
-				// If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
-				std::string namePortion = nameFromsipURI(uriString);
-				if(namePortion.empty())
-				{
-					// Problem with the SIP URI, fall back to the display name
-					namePortion = displayNameString;
-				}
-				if(namePortion.empty())
-				{
-					// Problems with both of the above, fall back to the account name
-					namePortion = nameString;
-				}
-				
-				// Set the display name (which is a hint to the active speakers window not to do its own lookup)
-				participant->mDisplayName = namePortion;
-				avatarNameResolved(participant->mAvatarID, namePortion);
-			}
-		}
-	}
-}
-
-void LLVoiceClient::participantRemovedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &nameString)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		if(participant)
-		{
-			session->removeParticipant(participant);
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
-	}
-}
-
-
-void LLVoiceClient::participantUpdatedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		bool isModeratorMuted, 
-		bool isSpeaking, 
-		int volume, 
-		F32 energy)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		
-		if(participant)
-		{
-			participant->mIsSpeaking = isSpeaking;
-			participant->mIsModeratorMuted = isModeratorMuted;
-
-			// SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
-			if (isSpeaking)
-			{
-				participant->mSpeakingTimeout.reset();
-				participant->mPower = energy;
-			}
-			else
-			{
-				participant->mPower = 0.0f;
-			}
-			participant->mVolume = volume;
-
-			
-			// *HACK: mantipov: added while working on EXT-3544
-			/*
-			Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE 
-			LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
-			
-			participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
-			Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
-			Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
-			
-			But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
-			voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
-			and event is not fired.
-
-			So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it
-			in LLCallFloater::draw()
-			*/
-			LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
-
-			// ignore session ID of local chat
-			if (voice_cnl && voice_cnl->getSessionID().notNull())
-			{
-				LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
-				if (speaker_manager)
-				{
-					speaker_manager->update(true);
-				}
-			}
-		}
-		else
-		{
-			LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
-	}
-}
-
-void LLVoiceClient::buddyPresenceEvent(
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &statusString,
-		std::string &applicationString)
-{
-	buddyListEntry *buddy = findBuddy(uriString);
-	
-	if(buddy)
-	{
-		LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
-		LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-
-		if(applicationString.empty())
-		{
-			// This presence event is from a client that doesn't set up the Application string.  Do things the old-skool way.
-			// NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
-
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// User went offline with a non-SLim-enabled viewer.
-				buddy->mOnlineSL = false;
-			}
-			else if ( stricmp("Online", statusString.c_str())== 0) 
-			{
-				// User came online with a non-SLim-enabled viewer.
-				buddy->mOnlineSL = true;
-			}
-			else
-			{
-				// If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
-				// NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
-				buddy->mOnlineSLim = true;
-			} 
-		}
-		else if(applicationString.find("SecondLifeViewer") != std::string::npos)
-		{
-			// This presence event is from a viewer that sets the application string
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// Viewer says they're offline
-				buddy->mOnlineSL = false;
-			}
-			else
-			{
-				// Viewer says they're online
-				buddy->mOnlineSL = true;
-			}
-		}
-		else
-		{
-			// This presence event is from something which is NOT the SL viewer (assume it's SLim).
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// SLim says they're offline
-				buddy->mOnlineSLim = false;
-			}
-			else
-			{
-				// SLim says they're online
-				buddy->mOnlineSLim = true;
-			}
-		} 
-
-		LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-		
-		// HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
-		LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
-
-		notifyFriendObservers();
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
-	}	
-}
-
-void LLVoiceClient::messageEvent(
-		std::string &sessionHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &messageHeader, 
-		std::string &messageBody,
-		std::string &applicationString)
-{
-	LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
-//	LL_DEBUGS("Voice") << "    header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
-	
-	if(messageHeader.find("text/html") != std::string::npos)
-	{
-		std::string message;
-
-		{
-			const std::string startMarker = "<body";
-			const std::string startMarker2 = ">";
-			const std::string endMarker = "</body>";
-			const std::string startSpan = "<span";
-			const std::string endSpan = "</span>";
-			std::string::size_type start;
-			std::string::size_type end;
-			
-			// Default to displaying the raw string, so the message gets through.
-			message = messageBody;
-
-			// Find the actual message text within the XML fragment
-			start = messageBody.find(startMarker);
-			start = messageBody.find(startMarker2, start);
-			end = messageBody.find(endMarker);
-
-			if(start != std::string::npos)
-			{
-				start += startMarker2.size();
-				
-				if(end != std::string::npos)
-					end -= start;
-					
-				message.assign(messageBody, start, end);
-			}
-			else 
-			{
-				// Didn't find a <body>, try looking for a <span> instead.
-				start = messageBody.find(startSpan);
-				start = messageBody.find(startMarker2, start);
-				end = messageBody.find(endSpan);
-				
-				if(start != std::string::npos)
-				{
-					start += startMarker2.size();
-					
-					if(end != std::string::npos)
-						end -= start;
-					
-					message.assign(messageBody, start, end);
-				}			
-			}
-		}	
-		
-//		LL_DEBUGS("Voice") << "    raw message = \n" << message << LL_ENDL;
-
-		// strip formatting tags
-		{
-			std::string::size_type start;
-			std::string::size_type end;
-			
-			while((start = message.find('<')) != std::string::npos)
-			{
-				if((end = message.find('>', start + 1)) != std::string::npos)
-				{
-					// Strip out the tag
-					message.erase(start, (end + 1) - start);
-				}
-				else
-				{
-					// Avoid an infinite loop
-					break;
-				}
-			}
-		}
-		
-		// Decode ampersand-escaped chars
-		{
-			std::string::size_type mark = 0;
-
-			// The text may contain text encoded with &lt;, &gt;, and &amp;
-			mark = 0;
-			while((mark = message.find("&lt;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 4, "<");
-				mark += 1;
-			}
-			
-			mark = 0;
-			while((mark = message.find("&gt;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 4, ">");
-				mark += 1;
-			}
-			
-			mark = 0;
-			while((mark = message.find("&amp;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 5, "&");
-				mark += 1;
-			}
-		}
-		
-		// strip leading/trailing whitespace (since we always seem to get a couple newlines)
-		LLStringUtil::trim(message);
-		
-//		LL_DEBUGS("Voice") << "    stripped message = \n" << message << LL_ENDL;
-		
-		sessionState *session = findSession(sessionHandle);
-		if(session)
-		{
-			bool is_busy = gAgent.getBusy();
-			bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
-			bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
-			bool quiet_chat = false;
-			LLChat chat;
-
-			chat.mMuted = is_muted && !is_linden;
-			
-			if(!chat.mMuted)
-			{
-				chat.mFromID = session->mCallerID;
-				chat.mFromName = session->mName;
-				chat.mSourceType = CHAT_SOURCE_AGENT;
-
-				if(is_busy && !is_linden)
-				{
-					quiet_chat = true;
-					// TODO: Question: Return busy mode response here?  Or maybe when session is started instead?
-				}
-								
-				LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
-				gIMMgr->addMessage(session->mIMSessionID,
-						session->mCallerID,
-						session->mName.c_str(),
-						message.c_str(),
-						LLStringUtil::null,		// default arg
-						IM_NOTHING_SPECIAL,		// default arg
-						0,						// default arg
-						LLUUID::null,			// default arg
-						LLVector3::zero,		// default arg
-						true);					// prepend name and make it a link to the user's profile
-
-				chat.mText = std::string("IM: ") + session->mName + std::string(": ") + message;
-				// If the chat should come in quietly (i.e. we're in busy mode), pretend it's from a local agent.
-				LLFloaterChat::addChat( chat, TRUE, quiet_chat );
-			}
-		}		
-	}
-}
-
-void LLVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		if(participant)
-		{
-			if (!stricmp(notificationType.c_str(), "Typing"))
-			{
-				// Other end started typing
-				// TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
-				// It requires an LLIMInfo for the message, which we don't have here.
-			}
-			else if (!stricmp(notificationType.c_str(), "NotTyping"))
-			{
-				// Other end stopped typing
-				// TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
-				// It requires an LLIMInfo for the message, which we don't have here.
-			}
-			else
-			{
-				LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
-			}
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
-	}
-}
-
-void LLVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
-{
-	buddyListEntry *buddy = findBuddy(buddyURI);
-	
-	if(!buddy)
-	{
-		// Couldn't find buddy by URI, try converting the alias...
-		if(!alias.empty())
-		{
-			LLUUID id;
-			if(IDFromName(alias, id))
-			{
-				buddy = findBuddy(id);
-			}
-		}
-	}
-	
-	if(buddy)
-	{
-		std::ostringstream stream;
-		
-		if(buddy->mCanSeeMeOnline)
-		{
-			// Sending the response will create an auto-accept rule
-			buddy->mHasAutoAcceptListEntry = true;
-		}
-		else
-		{
-			// Sending the response will create a block rule
-			buddy->mHasBlockListEntry = true;
-		}
-		
-		if(buddy->mInSLFriends)
-		{
-			buddy->mInVivoxBuddies = true;
-		}
-		
-		stream
-			<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-				<< "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
-				<< "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
-				<< "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
-			<< "</Request>"
-			<< "\n\n\n";
-			
-		writeString(stream.str());
-	}
-}
-
-void LLVoiceClient::auxAudioPropertiesEvent(F32 energy)
-{
-	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
-	mTuningEnergy = energy;
-}
-
-void LLVoiceClient::buddyListChanged()
-{
-	// This is called after we receive a BuddyAndGroupListChangedEvent.
-	mBuddyListMapPopulated = true;
-	mFriendsListDirty = true;
-}
-
-void LLVoiceClient::muteListChanged()
-{
-	// The user's mute list has been updated.  Go through the current participant list and sync it with the mute list.
-	if(mAudioSession)
-	{
-		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-		
-		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
-		{
-			participantState *p = iter->second;
-			
-			// Check to see if this participant is on the mute list already
-			if(p->updateMuteState())
-				mAudioSession->mVolumeDirty = true;
-		}
-	}
-}
-
-void LLVoiceClient::updateFriends(U32 mask)
-{
-	if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
-	{
-		// Just resend the whole friend list to the daemon
-		mFriendsListDirty = true;
-	}
-}
-
-/////////////////////////////
-// Managing list of participants
-LLVoiceClient::participantState::participantState(const std::string &uri) : 
-	 mURI(uri), 
-	 mPTT(false), 
-	 mIsSpeaking(false), 
-	 mIsModeratorMuted(false), 
-	 mLastSpokeTimestamp(0.f), 
-	 mPower(0.f), 
-	 mVolume(-1), 
-	 mOnMuteList(false), 
-	 mUserVolume(-1), 
-	 mVolumeDirty(false), 
-	 mAvatarIDValid(false),
-	 mIsSelf(false)
-{
-}
-
-LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri)
-{
-	participantState *result = NULL;
-	bool useAlternateURI = false;
-	
-	// Note: this is mostly the body of LLVoiceClient::sessionState::findParticipant(), but since we need to know if it
-	// matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
-	{
-		participantMap::iterator iter = mParticipantsByURI.find(&uri);
-
-		if(iter == mParticipantsByURI.end())
-		{
-			if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
-			{
-				// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
-				// Use mSIPURI instead, since it will be properly encoded.
-				iter = mParticipantsByURI.find(&(mSIPURI));
-				useAlternateURI = true;
-			}
-		}
-
-		if(iter != mParticipantsByURI.end())
-		{
-			result = iter->second;
-		}
-	}
-		
-	if(!result)
-	{
-		// participant isn't already in one list or the other.
-		result = new participantState(useAlternateURI?mSIPURI:uri);
-		mParticipantsByURI.insert(participantMap::value_type(&(result->mURI), result));
-		mParticipantsChanged = true;
-		
-		// Try to do a reverse transform on the URI to get the GUID back.
-		{
-			LLUUID id;
-			if(IDFromName(result->mURI, id))
-			{
-				result->mAvatarIDValid = true;
-				result->mAvatarID = id;
-
-				if(result->updateMuteState())
-					mVolumeDirty = true;
-			}
-			else
-			{
-				// Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
-				// This tells both code in LLVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache.
-				setUUIDFromStringHash(result->mAvatarID, uri);
-			}
-		}
-		
-		mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result));
-		
-		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
-	}
-	
-	return result;
-}
-
-bool LLVoiceClient::participantState::updateMuteState()
-{
-	bool result = false;
-	
-	if(mAvatarIDValid)
-	{
-		bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
-		if(mOnMuteList != isMuted)
-		{
-			mOnMuteList = isMuted;
-			mVolumeDirty = true;
-			result = true;
-		}
-	}
-	return result;
-}
-
-bool LLVoiceClient::participantState::isAvatar()
-{
-	return mAvatarIDValid;
-}
-
-void LLVoiceClient::sessionState::removeParticipant(LLVoiceClient::participantState *participant)
-{
-	if(participant)
-	{
-		participantMap::iterator iter = mParticipantsByURI.find(&(participant->mURI));
-		participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(&(participant->mAvatarID));
-		
-		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
-		
-		if(iter == mParticipantsByURI.end())
-		{
-			LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
-		}
-		else if(iter2 == mParticipantsByUUID.end())
-		{
-			LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
-		}
-		else if(iter->second != iter2->second)
-		{
-			LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
-		}
-		else
-		{
-			mParticipantsByURI.erase(iter);
-			mParticipantsByUUID.erase(iter2);
-			
-			delete participant;
-			mParticipantsChanged = true;
-		}
-	}
-}
-
-void LLVoiceClient::sessionState::removeAllParticipants()
-{
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-
-	while(!mParticipantsByURI.empty())
-	{
-		removeParticipant(mParticipantsByURI.begin()->second);
-	}
-	
-	if(!mParticipantsByUUID.empty())
-	{
-		LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
-	}
-}
-
-LLVoiceClient::participantMap *LLVoiceClient::getParticipantList(void)
-{
-	participantMap *result = NULL;
-	if(mAudioSession)
-	{
-		result = &(mAudioSession->mParticipantsByURI);
-	}
-	return result;
-}
-
-
-LLVoiceClient::participantState *LLVoiceClient::sessionState::findParticipant(const std::string &uri)
-{
-	participantState *result = NULL;
-	
-	participantMap::iterator iter = mParticipantsByURI.find(&uri);
-
-	if(iter == mParticipantsByURI.end())
-	{
-		if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
-		{
-			// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
-			// Look up the other URI
-			iter = mParticipantsByURI.find(&(mSIPURI));
-		}
-	}
-
-	if(iter != mParticipantsByURI.end())
-	{
-		result = iter->second;
-	}
-		
-	return result;
-}
-
-LLVoiceClient::participantState* LLVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
-{
-	participantState * result = NULL;
-	participantUUIDMap::iterator iter = mParticipantsByUUID.find(&id);
-
-	if(iter != mParticipantsByUUID.end())
-	{
-		result = iter->second;
-	}
-
-	return result;
-}
-
-LLVoiceClient::participantState* LLVoiceClient::findParticipantByID(const LLUUID& id)
-{
-	participantState * result = NULL;
-	
-	if(mAudioSession)
-	{
-		result = mAudioSession->findParticipantByID(id);
-	}
-	
-	return result;
-}
-
-
-void LLVoiceClient::parcelChanged()
-{
-	if(getState() >= stateNoChannel)
-	{
-		// If the user is logged in, start a channel lookup.
-		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
-
-		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
-		LLSD data;
-		LLHTTPClient::post(
-			url,
-			data,
-			new LLVoiceClientCapResponder);
-	}
-	else
-	{
-		// The transition to stateNoChannel needs to kick this off again.
-		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
-	}
-}
-
-void LLVoiceClient::switchChannel(
-	std::string uri,
-	bool spatial,
-	bool no_reconnect,
-	bool is_p2p,
-	std::string hash)
-{
-	bool needsSwitch = false;
-	
-	LL_DEBUGS("Voice") 
-		<< "called in state " << state2string(getState()) 
-		<< " with uri \"" << uri << "\"" 
-		<< (spatial?", spatial is true":", spatial is false")
-		<< LL_ENDL;
-	
-	switch(getState())
-	{
-		case stateJoinSessionFailed:
-		case stateJoinSessionFailedWaiting:
-		case stateNoChannel:
-			// Always switch to the new URI from these states.
-			needsSwitch = true;
-		break;
-
-		default:
-			if(mSessionTerminateRequested)
-			{
-				// If a terminate has been requested, we need to compare against where the URI we're already headed to.
-				if(mNextAudioSession)
-				{
-					if(mNextAudioSession->mSIPURI != uri)
-						needsSwitch = true;
-				}
-				else
-				{
-					// mNextAudioSession is null -- this probably means we're on our way back to spatial.
-					if(!uri.empty())
-					{
-						// We do want to process a switch in this case.
-						needsSwitch = true;
-					}
-				}
-			}
-			else
-			{
-				// Otherwise, compare against the URI we're in now.
-				if(mAudioSession)
-				{
-					if(mAudioSession->mSIPURI != uri)
-					{
-						needsSwitch = true;
-					}
-				}
-				else
-				{
-					if(!uri.empty())
-					{
-						// mAudioSession is null -- it's not clear what case would cause this.
-						// For now, log it as a warning and see if it ever crops up.
-						LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
-					}
-				}
-			}
-		break;
-	}
-	
-	if(needsSwitch)
-	{
-		if(uri.empty())
-		{
-			// Leave any channel we may be in
-			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
-
-			sessionState *oldSession = mNextAudioSession;
-			mNextAudioSession = NULL;
-
-			// The old session may now need to be deleted.
-			reapSession(oldSession);
-
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
-
-			mNextAudioSession = addSession(uri);
-			mNextAudioSession->mHash = hash;
-			mNextAudioSession->mIsSpatial = spatial;
-			mNextAudioSession->mReconnect = !no_reconnect;
-			mNextAudioSession->mIsP2P = is_p2p;
-		}
-		
-		if(getState() <= stateNoChannel)
-		{
-			// We're already set up to join a channel, just needed to fill in the session URI
-		}
-		else
-		{
-			// State machine will come around and rejoin if uri/handle is not empty.
-			sessionTerminate();
-		}
-	}
-}
-
-void LLVoiceClient::joinSession(sessionState *session)
-{
-	mNextAudioSession = session;
-	
-	if(getState() <= stateNoChannel)
-	{
-		// We're already set up to join a channel, just needed to fill in the session handle
-	}
-	else
-	{
-		// State machine will come around and rejoin if uri/handle is not empty.
-		sessionTerminate();
-	}
-}
-
-void LLVoiceClient::setNonSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
-{
-	switchChannel(uri, false, false, false, credentials);
-}
-
-void LLVoiceClient::setSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
-{
-	mSpatialSessionURI = uri;
-	mSpatialSessionCredentials = credentials;
-	mAreaVoiceDisabled = mSpatialSessionURI.empty();
-
-	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
-	
-	if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
-	{
-		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
-		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
-	}
-	else
-	{
-		switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
-	}
-}
-
-void LLVoiceClient::callUser(const LLUUID &uuid)
-{
-	std::string userURI = sipURIFromID(uuid);
-
-	switchChannel(userURI, false, true, true);
-}
-
-LLVoiceClient::sessionState* LLVoiceClient::startUserIMSession(const LLUUID &uuid)
-{
-	// Figure out if a session with the user already exists
-	sessionState *session = findSession(uuid);
-	if(!session)
-	{
-		// No session with user, need to start one.
-		std::string uri = sipURIFromID(uuid);
-		session = addSession(uri);
-		session->mIsSpatial = false;
-		session->mReconnect = false;	
-		session->mIsP2P = true;
-		session->mCallerID = uuid;
-	}
-	
-	if(session)
-	{
-		if(session->mHandle.empty())
-		{
-			// Session isn't active -- start it up.
-			sessionCreateSendMessage(session, false, true);
-		}
-		else
-		{	
-			// Session is already active -- start up text.
-			sessionTextConnectSendMessage(session);
-		}
-	}
-	
-	return session;
-}
-
-bool LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
-{
-	bool result = false;
-
-	// Attempt to locate the indicated session
-	sessionState *session = startUserIMSession(participant_id);
-	if(session)
-	{
-		// found the session, attempt to send the message
-		session->mTextMsgQueue.push(message);
-		
-		// Try to send queued messages (will do nothing if the session is not open yet)
-		sendQueuedTextMessages(session);
-
-		// The message is queued, so we succeed.
-		result = true;
-	}	
-	else
-	{
-		LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
-	}
-	
-	return result;
-}
-
-void LLVoiceClient::sendQueuedTextMessages(sessionState *session)
-{
-	if(session->mTextStreamState == 1)
-	{
-		if(!session->mTextMsgQueue.empty())
-		{
-			std::ostringstream stream;
-			
-			while(!session->mTextMsgQueue.empty())
-			{
-				std::string message = session->mTextMsgQueue.front();
-				session->mTextMsgQueue.pop();
-				stream
-				<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
-					<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-					<< "<MessageHeader>text/HTML</MessageHeader>"
-					<< "<MessageBody>" << message << "</MessageBody>"
-				<< "</Request>"
-				<< "\n\n\n";
-			}		
-			writeString(stream.str());
-		}
-	}
-	else
-	{
-		// Session isn't connected yet, defer until later.
-	}
-}
-
-void LLVoiceClient::endUserIMSession(const LLUUID &uuid)
-{
-	// Figure out if a session with the user exists
-	sessionState *session = findSession(uuid);
-	if(session)
-	{
-		// found the session
-		if(!session->mHandle.empty())
-		{
-			sessionTextDisconnectSendMessage(session);
-		}
-	}	
-	else
-	{
-		LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
-	}
-}
-
-bool LLVoiceClient::answerInvite(std::string &sessionHandle)
-{
-	// this is only ever used to answer incoming p2p call invites.
-	
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		session->mIsSpatial = false;
-		session->mReconnect = false;	
-		session->mIsP2P = true;
-
-		joinSession(session);
-		return true;
-	}
-	
-	return false;
-}
-
-bool LLVoiceClient::isOnlineSIP(const LLUUID &id)
-{
-	bool result = false;
-	buddyListEntry *buddy = findBuddy(id);
-	if(buddy)
-	{
-		result = buddy->mOnlineSLim;
-		LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
-	}
-
-	if(!result)
-	{
-		// This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
-		sessionState *session = findSession(id);
-		if(session && !session->mHandle.empty())
-		{
-			if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
-			{
-				LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
-				// we have a p2p text session open with this user, so by definition they're online.
-				result = true;
-			}
-		}
-	}
-	
-	return result;
-}
-
-// Returns true if the indicated participant in the current audio session is really an SL avatar.
-// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
-bool LLVoiceClient::isParticipantAvatar(const LLUUID &id)
-{
-	bool result = true; 
-	sessionState *session = findSession(id);
-	
-	if(session != NULL)
-	{
-		// this is a p2p session with the indicated caller, or the session with the specified UUID.
-		if(session->mSynthesizedCallerID)
-			result = false;
-	}
-	else
-	{
-		// Didn't find a matching session -- check the current audio session for a matching participant
-		if(mAudioSession != NULL)
-		{
-			participantState *participant = findParticipantByID(id);
-			if(participant != NULL)
-			{
-				result = participant->isAvatar();
-			}
-		}
-	}
-	
-	return result;
-}
-
-// Returns true if calling back the session URI after the session has closed is possible.
-// Currently this will be false only for PSTN P2P calls.		
-bool LLVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
-{
-	bool result = true; 
-	sessionState *session = findSession(session_id);
-	
-	if(session != NULL)
-	{
-		result = session->isCallBackPossible();
-	}
-	
-	return result;
-}
-
-// Returns true if the session can accepte text IM's.
-// Currently this will be false only for PSTN P2P calls.
-bool LLVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
-{
-	bool result = true; 
-	sessionState *session = findSession(session_id);
-	
-	if(session != NULL)
-	{
-		result = session->isTextIMPossible();
-	}
-	
-	return result;
-}
-		
-
-void LLVoiceClient::declineInvite(std::string &sessionHandle)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		sessionMediaDisconnectSendMessage(session);
-	}
-}
-
-void LLVoiceClient::leaveNonSpatialChannel()
-{
-	LL_DEBUGS("Voice") 
-		<< "called in state " << state2string(getState()) 
-		<< LL_ENDL;
-	
-	// Make sure we don't rejoin the current session.	
-	sessionState *oldNextSession = mNextAudioSession;
-	mNextAudioSession = NULL;
-	
-	// Most likely this will still be the current session at this point, but check it anyway.
-	reapSession(oldNextSession);
-	
-	verifySessionState();
-	
-	sessionTerminate();
-}
-
-std::string LLVoiceClient::getCurrentChannel()
-{
-	std::string result;
-	
-	if((getState() == stateRunning) && !mSessionTerminateRequested)
-	{
-		result = getAudioSessionURI();
-	}
-	
-	return result;
-}
-
-bool LLVoiceClient::inProximalChannel()
-{
-	bool result = false;
-	
-	if((getState() == stateRunning) && !mSessionTerminateRequested)
-	{
-		result = inSpatialChannel();
-	}
-	
-	return result;
-}
-
-std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
-{
-	std::string result;
-	result = "sip:";
-	result += nameFromID(id);
-	result += "@";
-	result += mVoiceSIPURIHostName;
-	
-	return result;
-}
-
-std::string LLVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
-{
-	std::string result;
-	if(avatar)
-	{
-		result = "sip:";
-		result += nameFromID(avatar->getID());
-		result += "@";
-		result += mVoiceSIPURIHostName;
-	}
-	
-	return result;
-}
-
-std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
-{
-	std::string result;
-	if(avatar)
-	{
-		result = nameFromID(avatar->getID());
-	}	
-	return result;
-}
-
-std::string LLVoiceClient::nameFromID(const LLUUID &uuid)
-{
-	std::string result;
-	
-	if (uuid.isNull()) {
-		//VIVOX, the uuid emtpy look for the mURIString and return that instead.
-		//result.assign(uuid.mURIStringName);
-		LLStringUtil::replaceChar(result, '_', ' ');
-		return result;
-	}
-	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
-	result = "x";
-	
-	// Base64 encode and replace the pieces of base64 that are less compatible 
-	// with e-mail local-parts.
-	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
-	result += LLBase64::encode(uuid.mData, UUID_BYTES);
-	LLStringUtil::replaceChar(result, '+', '-');
-	LLStringUtil::replaceChar(result, '/', '_');
-	
-	// If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
-	// echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
-	
-	// The reverse transform can be done with:
-	// echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
-	
-	return result;
-}
+const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
 
-bool LLVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
+std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
 {
-	bool result = false;
-	
-	// SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
-	// If it is, convert to a bare name before doing the transform.
-	std::string name = nameFromsipURI(inName);
-	
-	// Doesn't look like a SIP URI, assume it's an actual name.
-	if(name.empty())
-		name = inName;
-
-	// This will only work if the name is of the proper form.
-	// As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
-	// "xFnPP04IpREWNkuw1cOXlhw=="
-	
-	if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
-	{
-		// The name appears to have the right form.
-
-		// Reverse the transforms done by nameFromID
-		std::string temp = name;
-		LLStringUtil::replaceChar(temp, '-', '+');
-		LLStringUtil::replaceChar(temp, '_', '/');
-
-		U8 rawuuid[UUID_BYTES + 1]; 
-		int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
-		if(len == UUID_BYTES)
-		{
-			// The decode succeeded.  Stuff the bits into the result's UUID
-			memcpy(uuid.mData, rawuuid, UUID_BYTES);
-			result = true;
-		}
-	} 
+	std::string result = "UNKNOWN";
 	
-	if(!result)
-	{
-		// VIVOX:  not a standard account name, just copy the URI name mURIString field
-		// and hope for the best.  bpj
-		uuid.setNull();  // VIVOX, set the uuid field to nulls
-	}
+	// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
 	
-	return result;
-}
-
-std::string LLVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
-{
-	return avatar->getFullname();
-}
-
-std::string LLVoiceClient::sipURIFromName(std::string &name)
-{
-	std::string result;
-	result = "sip:";
-	result += name;
-	result += "@";
-	result += mVoiceSIPURIHostName;
-
-//	LLStringUtil::toLower(result);
-
-	return result;
-}
-
-std::string LLVoiceClient::nameFromsipURI(const std::string &uri)
-{
-	std::string result;
-
-	std::string::size_type sipOffset, atOffset;
-	sipOffset = uri.find("sip:");
-	atOffset = uri.find("@");
-	if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+	switch(inStatus)
 	{
-		result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+			CASE(STATUS_LOGIN_RETRY);
+			CASE(STATUS_LOGGED_IN);
+			CASE(STATUS_JOINING);
+			CASE(STATUS_JOINED);
+			CASE(STATUS_LEFT_CHANNEL);
+			CASE(STATUS_VOICE_DISABLED);
+			CASE(BEGIN_ERROR_STATUS);
+			CASE(ERROR_CHANNEL_FULL);
+			CASE(ERROR_CHANNEL_LOCKED);
+			CASE(ERROR_NOT_AVAILABLE);
+			CASE(ERROR_UNKNOWN);
+		default:
+			break;
 	}
 	
-	return result;
-}
-
-bool LLVoiceClient::inSpatialChannel(void)
-{
-	bool result = false;
+#undef CASE
 	
-	if(mAudioSession)
-		result = mAudioSession->mIsSpatial;
-		
 	return result;
 }
 
-std::string LLVoiceClient::getAudioSessionURI()
-{
-	std::string result;
-	
-	if(mAudioSession)
-		result = mAudioSession->mSIPURI;
-		
-	return result;
-}
 
-std::string LLVoiceClient::getAudioSessionHandle()
-{
-	std::string result;
-	
-	if(mAudioSession)
-		result = mAudioSession->mHandle;
-		
-	return result;
-}
 
 
-/////////////////////////////
-// Sending updates of current state
+///////////////////////////////////////////////////////////////////////////////////////////////
 
-void LLVoiceClient::enforceTether(void)
+LLVoiceClient::LLVoiceClient()
 {
-	LLVector3d tethered	= mCameraRequestedPosition;
-
-	// constrain 'tethered' to within 50m of mAvatarPosition.
-	{
-		F32 max_dist = 50.0f;
-		LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
-		F32 camera_distance = (F32)camera_offset.magVec();
-		if(camera_distance > max_dist)
-		{
-			tethered = mAvatarPosition + 
-				(max_dist / camera_distance) * camera_offset;
-		}
-	}
-	
-	if(dist_vec(mCameraPosition, tethered) > 0.1)
-	{
-		mCameraPosition = tethered;
-		mSpatialCoordsDirty = true;
-	}
+	mVoiceModule = NULL;
 }
 
-void LLVoiceClient::updatePosition(void)
-{
-	
-	if(gVoiceClient)
-	{
-		LLVOAvatar *agent = gAgent.getAvatarObject();
-		LLViewerRegion *region = gAgent.getRegion();
-		if(region && agent)
-		{
-			LLMatrix3 rot;
-			LLVector3d pos;
-
-			// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
-			// They're currently always set to zero.
-
-			// Send the current camera position to the voice code
-			rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (),  LLViewerCamera::getInstance()->getUpAxis());		
-			pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
-			
-			gVoiceClient->setCameraPosition(
-					pos,				// position
-					LLVector3::zero, 	// velocity
-					rot);				// rotation matrix
-					
-			// Send the current avatar position to the voice code
-			rot = agent->getRootJoint()->getWorldRotation().getMatrix3();
-	
-			pos = agent->getPositionGlobal();
-			// TODO: Can we get the head offset from outside the LLVOAvatar?
-//			pos += LLVector3d(mHeadOffset);
-			pos += LLVector3d(0.f, 0.f, 1.f);
-		
-			gVoiceClient->setAvatarPosition(
-					pos,				// position
-					LLVector3::zero, 	// velocity
-					rot);				// rotation matrix
-		}
-	}
-}
+//---------------------------------------------------
+// Basic setup/shutdown
 
-void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+LLVoiceClient::~LLVoiceClient()
 {
-	mCameraRequestedPosition = position;
-	
-	if(mCameraVelocity != velocity)
-	{
-		mCameraVelocity = velocity;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mCameraRot != rot)
-	{
-		mCameraRot = rot;
-		mSpatialCoordsDirty = true;
-	}
 }
 
-void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+void LLVoiceClient::init(LLPumpIO *pump)
 {
-	if(dist_vec(mAvatarPosition, position) > 0.1)
-	{
-		mAvatarPosition = position;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mAvatarVelocity != velocity)
-	{
-		mAvatarVelocity = velocity;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mAvatarRot != rot)
-	{
-		mAvatarRot = rot;
-		mSpatialCoordsDirty = true;
-	}
+	// Initialize all of the voice modules
+	m_servicePump = pump;
 }
 
-bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
 {
-	bool result = false;
-	
-	if(region)
+	// In the future, we should change this to allow voice module registration
+	// with a table lookup of sorts.
+	std::string voice_server = gSavedSettings.getString("VoiceServerType");
+	LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
+	if(voice_server == "diamondware")
 	{
-		name = region->getName();
+		mVoiceModule = (LLVoiceModuleInterface *)LLDiamondwareVoiceClient::getInstance();
 	}
-	
-	if(!name.empty())
-		result = true;
-	
-	return result;
-}
-
-void LLVoiceClient::leaveChannel(void)
-{
-	if(getState() == stateRunning)
+	else if(voice_server == "vivox")
 	{
-		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
-		mChannelName.clear();
-		sessionTerminate();
+		mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
 	}
-}
-
-void LLVoiceClient::setMuteMic(bool muted)
-{
-	mMuteMic = muted;
-}
-
-bool LLVoiceClient::getMuteMic() const
-{
-	return mMuteMic;
-}
-
-void LLVoiceClient::setUserPTTState(bool ptt)
-{
-	mUserPTTState = ptt;
-}
-
-bool LLVoiceClient::getUserPTTState()
-{
-	return mUserPTTState;
-}
-
-void LLVoiceClient::toggleUserPTTState(void)
-{
-	mUserPTTState = !mUserPTTState;
-}
-
-void LLVoiceClient::setVoiceEnabled(bool enabled)
-{
-	if (enabled != mVoiceEnabled)
+	else
 	{
-		mVoiceEnabled = enabled;
-		LLVoiceClientStatusObserver::EStatusType status;
-
-		if (enabled)
-		{
-			LLVoiceChannel::getCurrentVoiceChannel()->activate();
-			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
-		}
-		else
-		{
-			// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
-			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
-			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
-		}
-
-		notifyStatusObservers(status);
+		mVoiceModule = NULL;
+		return; 
 	}
+	mVoiceModule->init(m_servicePump);	
+	mVoiceModule->userAuthorized(user_id, agentID);
 }
 
-bool LLVoiceClient::voiceEnabled()
-{
-	return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
-}
 
-void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
+void LLVoiceClient::terminate()
 {
-	mLipSyncEnabled = enabled;
+	if (mVoiceModule) mVoiceModule->terminate();
+	mVoiceModule = NULL;
 }
 
-BOOL LLVoiceClient::lipSyncEnabled()
+const LLVoiceVersionInfo LLVoiceClient::getVersion()
 {
-	   
-	if ( mVoiceEnabled && stateDisabled != getState() )
+	if (mVoiceModule) 
 	{
-		return mLipSyncEnabled;
+		return mVoiceModule->getVersion();
 	}
 	else
 	{
-		return FALSE;
+		LLVoiceVersionInfo result;
+		result.serverVersion = std::string();
+		result.serverType = std::string();
+		return result;
 	}
 }
 
-void LLVoiceClient::setUsePTT(bool usePTT)
+void LLVoiceClient::updateSettings()
 {
-	if(usePTT && !mUsePTT)
-	{
-		// When the user turns on PTT, reset the current state.
-		mUserPTTState = false;
-	}
-	mUsePTT = usePTT;
+	if (mVoiceModule) mVoiceModule->updateSettings();
 }
 
-void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+//--------------------------------------------------
+// tuning
+
+void LLVoiceClient::tuningStart()
 {
-	if(!PTTIsToggle && mPTTIsToggle)
-	{
-		// When the user turns off toggle, reset the current state.
-		mUserPTTState = false;
-	}
-	
-	mPTTIsToggle = PTTIsToggle;
+	if (mVoiceModule) mVoiceModule->tuningStart();
 }
 
-bool LLVoiceClient::getPTTIsToggle()
+void LLVoiceClient::tuningStop()
 {
-	return mPTTIsToggle;
+	if (mVoiceModule) mVoiceModule->tuningStop();
 }
 
-void LLVoiceClient::setPTTKey(std::string &key)
+bool LLVoiceClient::inTuningMode()
 {
-	if(key == "MiddleMouse")
+	if (mVoiceModule) 
 	{
-		mPTTIsMiddleMouse = true;
+		return mVoiceModule->inTuningMode();
 	}
 	else
 	{
-		mPTTIsMiddleMouse = false;
-		if(!LLKeyboard::keyFromString(key, &mPTTKey))
-		{
-			// If the call failed, don't match any key.
-			key = KEY_NONE;
-		}
+		return false;
 	}
 }
 
-void LLVoiceClient::setEarLocation(S32 loc)
+void LLVoiceClient::tuningSetMicVolume(float volume)
 {
-	if(mEarLocation != loc)
-	{
-		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
-		
-		mEarLocation = loc;
-		mSpatialCoordsDirty = true;
-	}
+	if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
 }
 
-void LLVoiceClient::setVoiceVolume(F32 volume)
+void LLVoiceClient::tuningSetSpeakerVolume(float volume)
 {
-	int scaled_volume = scale_speaker_volume(volume);	
-
-	if(scaled_volume != mSpeakerVolume)
-	{
-		if((scaled_volume == 0) || (mSpeakerVolume == 0))
-		{
-			mSpeakerMuteDirty = true;
-		}
-
-		mSpeakerVolume = scaled_volume;
-		mSpeakerVolumeDirty = true;
-	}
+	if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
 }
 
-void LLVoiceClient::setMicGain(F32 volume)
+float LLVoiceClient::tuningGetEnergy(void)
 {
-	int scaled_volume = scale_mic_volume(volume);
-	
-	if(scaled_volume != mMicVolume)
-	{
-		mMicVolume = scaled_volume;
-		mMicVolumeDirty = true;
-	}
-}
-
-void LLVoiceClient::keyDown(KEY key, MASK mask)
-{	
-	if (gKeyboard->getKeyRepeated(key))
-	{
-		// ignore auto-repeat keys
-		return;
-	}
-
-	if(!mPTTIsMiddleMouse)
+	if (mVoiceModule) 
 	{
-		bool down = (mPTTKey != KEY_NONE)
-			&& gKeyboard->getKeyDown(mPTTKey);
-		inputUserControlState(down);
+		return mVoiceModule->tuningGetEnergy();
 	}
-}
-void LLVoiceClient::keyUp(KEY key, MASK mask)
-{
-	if(!mPTTIsMiddleMouse)
+	else
 	{
-		bool down = (mPTTKey != KEY_NONE)
-			&& gKeyboard->getKeyDown(mPTTKey);
-		inputUserControlState(down);
+		return 0.0;
 	}
 }
-void LLVoiceClient::inputUserControlState(bool down)
+
+
+//------------------------------------------------
+// devices
+
+bool LLVoiceClient::deviceSettingsAvailable()
 {
-	if(mPTTIsToggle)
+	if (mVoiceModule) 
 	{
-		if(down) // toggle open-mic state on 'down'
-		{
-			toggleUserPTTState();
-		}
+		return mVoiceModule->deviceSettingsAvailable();
 	}
-	else // set open-mic state as an absolute
+	else
 	{
-		setUserPTTState(down);
+		return false;
 	}
 }
-void LLVoiceClient::middleMouseState(bool down)
+
+void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
 {
-	if(mPTTIsMiddleMouse)
-	{
-		inputUserControlState(down);
-	}
+	if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
 }
 
-/////////////////////////////
-// Accessors for data related to nearby speakers
-BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
+void LLVoiceClient::setCaptureDevice(const std::string& name)
 {
-	BOOL result = FALSE;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		// I'm not sure what the semantics of this should be.
-		// For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
-		result = TRUE;
-	}
+	if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
 	
-	return result;
 }
 
-BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
+void LLVoiceClient::setRenderDevice(const std::string& name)
 {
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
-		{
-			participant->mIsSpeaking = FALSE;
-		}
-		result = participant->mIsSpeaking;
-	}
-	
-	return result;
+	if (mVoiceModule) mVoiceModule->setRenderDevice(name);	
 }
 
-BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
+const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
 {
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
+	static LLVoiceDeviceList nullCaptureDevices;
+	if (mVoiceModule) 
 	{
-		result = participant->mIsModeratorMuted;
+		return mVoiceModule->getCaptureDevices();
 	}
-	
-	return result;
-}
-
-F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
-{		
-	F32 result = 0;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
+	else
 	{
-		result = participant->mPower;
+		return nullCaptureDevices;
 	}
-	
-	return result;
 }
 
 
-std::string LLVoiceClient::getDisplayName(const LLUUID& id)
+const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
 {
-	std::string result;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
+	static LLVoiceDeviceList nullRenderDevices;	
+	if (mVoiceModule) 
 	{
-		result = participant->mDisplayName;
+		return mVoiceModule->getRenderDevices();
 	}
-	
-	return result;
-}
-
-
-BOOL LLVoiceClient::getUsingPTT(const LLUUID& id)
-{
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
+	else
 	{
-		// I'm not sure what the semantics of this should be.
-		// Does "using PTT" mean they're configured with a push-to-talk button?
-		// For now, we know there's no PTT mechanism in place, so nobody is using it.
+		return nullRenderDevices;
 	}
-	
-	return result;
 }
 
-BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
-{
-	BOOL result = FALSE;
-	
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mOnMuteList;
-	}
 
-	return result;
-}
+//--------------------------------------------------
+// participants
 
-// External accessiors. Maps 0.0 to 1.0 to internal values 0-400 with .5 == 100
-// internal = 400 * external^2
-F32 LLVoiceClient::getUserVolume(const LLUUID& id)
+std::vector<LLUUID> LLVoiceClient::getParticipantList(void)
 {
-	F32 result = 0.0f;
-	
-	participantState *participant = findParticipantByID(id);
-	if(participant)
+	if (mVoiceModule) 
 	{
-		S32 ires = 100; // nominal default volume
-		
-		if(participant->mIsSelf)
-		{
-			// Always make it look like the user's own volume is set at the default.
-		}
-		else if(participant->mUserVolume != -1)
-		{
-			// Use the internal volume
-			ires = participant->mUserVolume;
-			
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mUserVolume " << ires << LL_ENDL;
-		}
-		else if(participant->mVolume != -1)
-		{
-			// Map backwards from vivox volume 
-
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mVolume " << participant->mVolume << LL_ENDL;
-
-			if(participant->mVolume < 56)
-			{
-				ires = (participant->mVolume * 100) / 56;
-			}
-			else
-			{
-				ires = (((participant->mVolume - 56) * 300) / (100 - 56)) + 100;
-			}
-		}
-		result = sqrtf(((F32)ires) / 400.f);
+		return mVoiceModule->getParticipantList();
 	}
-
-	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//	LL_DEBUGS("Voice") << "returning " << result << LL_ENDL;
-
-	return result;
-}
-
-void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
-{
-	if(mAudioSession)
+	else
 	{
-		participantState *participant = findParticipantByID(id);
-		if (participant)
-		{
-			// volume can amplify by as much as 4x!
-			S32 ivol = (S32)(400.f * volume * volume);
-			participant->mUserVolume = llclamp(ivol, 0, 400);
-			participant->mVolumeDirty = TRUE;
-			mAudioSession->mVolumeDirty = TRUE;
-		}
+		return std::vector<LLUUID>();
 	}
 }
 
-std::string LLVoiceClient::getGroupID(const LLUUID& id)
-{
-	std::string result;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mGroupID;
-	}
-	
-	return result;
-}
+//--------------------------------------------------
+// text chat
 
-BOOL LLVoiceClient::getAreaVoiceDisabled()
-{
-	return mAreaVoiceDisabled;
-}
 
-void LLVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
+BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id)
 {
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
-	
-	if(!mMainSessionGroupHandle.empty())
+	if (mVoiceModule) 
 	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Start</RecordingControlType>" 
-		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
-		<< "<Filename>" << "" << "</Filename>"
-		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
-		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
-		<< "</Request>\n\n\n";
-
-
-		writeString(stream.str());
+		return mVoiceModule->isSessionTextIMPossible(id);
 	}
-}
-
-void LLVoiceClient::recordingLoopSave(const std::string& filename)
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	else
 	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Flush</RecordingControlType>" 
-		<< "<Filename>" << filename << "</Filename>"
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
-	}
+		return FALSE;
+	}	
 }
 
-void LLVoiceClient::recordingStop()
+BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id)
 {
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	if (mVoiceModule) 
 	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Stop</RecordingControlType>" 
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
+		return mVoiceModule->isSessionCallBackPossible(id);
 	}
+	else
+	{
+		return FALSE;
+	}	
 }
 
-void LLVoiceClient::filePlaybackStart(const std::string& filename)
+BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
 {
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	if (mVoiceModule) 
 	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Start</RecordingControlType>" 
-		<< "<Filename>" << filename << "</Filename>"
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
+		return mVoiceModule->sendTextMessage(participant_id, message);
 	}
+	else
+	{
+		return FALSE;
+	}	
 }
 
-void LLVoiceClient::filePlaybackStop()
+void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
 {
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	if (mVoiceModule) 
 	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Stop</RecordingControlType>" 
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
+		mVoiceModule->endUserIMSession(participant_id);
 	}
 }
 
-void LLVoiceClient::filePlaybackSetPaused(bool paused)
-{
-	// TODO: Implement once Vivox gives me a sample
-}
-
-void LLVoiceClient::filePlaybackSetMode(bool vox, float speed)
-{
-	// TODO: Implement once Vivox gives me a sample
-}
-
-LLVoiceClient::sessionState::sessionState() :
-	mMediaStreamState(streamStateUnknown),
-	mTextStreamState(streamStateUnknown),
-	mCreateInProgress(false),
-	mMediaConnectInProgress(false),
-	mVoiceInvitePending(false),
-	mTextInvitePending(false),
-	mSynthesizedCallerID(false),
-	mIsChannel(false),
-	mIsSpatial(false),
-	mIsP2P(false),
-	mIncoming(false),
-	mVoiceEnabled(false),
-	mReconnect(false),
-	mVolumeDirty(false),
-	mParticipantsChanged(false)
-{
-}
+//----------------------------------------------
+// channels
 
-LLVoiceClient::sessionState::~sessionState()
+bool LLVoiceClient::inProximalChannel()
 {
-	removeAllParticipants();
+	if (mVoiceModule) 
+	{
+		return mVoiceModule->inProximalChannel();
+	}
+	else
+	{
+		return false;
+	}
 }
 
-bool LLVoiceClient::sessionState::isCallBackPossible()
+void LLVoiceClient::setNonSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
 {
-	// This may change to be explicitly specified by vivox in the future...
-	// Currently, only PSTN P2P calls cannot be returned.
-	// Conveniently, this is also the only case where we synthesize a caller UUID.
-	return !mSynthesizedCallerID;
+	if (mVoiceModule) mVoiceModule->setNonSpatialChannel(uri, credentials);
 }
 
-bool LLVoiceClient::sessionState::isTextIMPossible()
+void LLVoiceClient::setSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
 {
-	// This may change to be explicitly specified by vivox in the future...
-	return !mSynthesizedCallerID;
+	if (mVoiceModule) mVoiceModule->setSpatialChannel(uri, credentials);
 }
 
-
-LLVoiceClient::sessionIterator LLVoiceClient::sessionsBegin(void)
+void LLVoiceClient::leaveNonSpatialChannel()
 {
-	return mSessions.begin();
+	if (mVoiceModule) mVoiceModule->leaveNonSpatialChannel();
 }
 
-LLVoiceClient::sessionIterator LLVoiceClient::sessionsEnd(void)
+void LLVoiceClient::leaveChannel(void)
 {
-	return mSessions.end();
+	if (mVoiceModule) mVoiceModule->leaveChannel();
 }
 
-
-LLVoiceClient::sessionState *LLVoiceClient::findSession(const std::string &handle)
+std::string LLVoiceClient::getCurrentChannel()
 {
-	sessionState *result = NULL;
-	sessionMap::iterator iter = mSessionsByHandle.find(&handle);
-	if(iter != mSessionsByHandle.end())
+	if (mVoiceModule) 
 	{
-		result = iter->second;
+		return mVoiceModule->getCurrentChannel();
 	}
-	
-	return result;
-}
-
-LLVoiceClient::sessionState *LLVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
-{	
-	sessionState *result = NULL;
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	else
 	{
-		sessionState *session = *iter;
-		if(session->mCreateInProgress && (session->mSIPURI == uri))
-		{
-			result = session;
-			break;
-		}
+		return std::string();
 	}
-	
-	return result;
 }
 
-LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participant_id)
+
+//---------------------------------------
+// invitations
+
+void LLVoiceClient::callUser(const LLUUID &uuid)
 {
-	sessionState *result = NULL;
-	
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
-		if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
-		{
-			result = session;
-			break;
-		}
-	}
-	
-	return result;
+	if (mVoiceModule) mVoiceModule->callUser(uuid);
 }
 
-LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)
+bool LLVoiceClient::answerInvite(std::string &channelHandle)
 {
-	sessionState *result = NULL;
-	
-	if(handle.empty())
-	{
-		// No handle supplied.
-		// Check whether there's already a session with this URI
-		for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-		{
-			sessionState *s = *iter;
-			if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
-			{
-				// TODO: I need to think about this logic... it's possible that this case should raise an internal error.
-				result = s;
-				break;
-			}
-		}
-	}
-	else // (!handle.empty())
-	{
-		// Check for an existing session with this handle
-		sessionMap::iterator iter = mSessionsByHandle.find(&handle);
-		
-		if(iter != mSessionsByHandle.end())
-		{
-			result = iter->second;
-		}
-	}
-
-	if(!result)
+	if (mVoiceModule) 
 	{
-		// No existing session found.
-		
-		LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
-		result = new sessionState();
-		result->mSIPURI = uri;
-		result->mHandle = handle;
-		
-		mSessions.insert(result);
-
-		if(!result->mHandle.empty())
-		{
-			mSessionsByHandle.insert(sessionMap::value_type(&(result->mHandle), result));
-		}
+		return mVoiceModule->answerInvite(channelHandle);
 	}
 	else
 	{
-		// Found an existing session
-		
-		if(uri != result->mSIPURI)
-		{
-			// TODO: Should this be an internal error?
-			LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
-			setSessionURI(result, uri);
-		}
-
-		if(handle != result->mHandle)
-		{
-			if(handle.empty())
-			{
-				// There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
-				LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
-			}
-			else
-			{
-				// TODO: Should this be an internal error?
-				LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
-				setSessionHandle(result, handle);
-			}
-		}
-		
-		LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
+		return false;
 	}
-
-	verifySessionState();
-		
-	return result;
 }
 
-void LLVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
+void LLVoiceClient::declineInvite(std::string &channelHandle)
 {
-	// Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
-	
-	if(!session->mHandle.empty())
-	{
-		// Remove session from the map if it should have been there.
-		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
-		if(iter != mSessionsByHandle.end())
-		{
-			if(iter->second != session)
-			{
-				LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
-			}
+	if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
+}
 
-			mSessionsByHandle.erase(iter);
-		}
-		else
-		{
-			LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
-		}
-	}
-			
-	session->mHandle = handle;
 
-	if(!handle.empty())
-	{
-		mSessionsByHandle.insert(sessionMap::value_type(&(session->mHandle), session));
-	}
+//------------------------------------------
+// Volume/gain
 
-	verifySessionState();
-}
 
-void LLVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
+void LLVoiceClient::setVoiceVolume(F32 volume)
 {
-	// There used to be a map of session URIs to sessions, which made this complex....
-	session->mSIPURI = uri;
-
-	verifySessionState();
+	if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
 }
 
-void LLVoiceClient::deleteSession(sessionState *session)
+void LLVoiceClient::setMicGain(F32 volume)
 {
-	// Remove the session from the handle map
-	if(!session->mHandle.empty())
-	{
-		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
-		if(iter != mSessionsByHandle.end())
-		{
-			if(iter->second != session)
-			{
-				LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
-			}
-			mSessionsByHandle.erase(iter);
-		}
-	}
+	if (mVoiceModule) mVoiceModule->setMicGain(volume);
+}
 
-	// Remove the session from the URI map
-	mSessions.erase(session);
-	
-	// At this point, the session should be unhooked from all lists and all state should be consistent.
-	verifySessionState();
 
-	// If this is the current audio session, clean up the pointer which will soon be dangling.
-	if(mAudioSession == session)
+//------------------------------------------
+// enable/disable voice features
+
+bool LLVoiceClient::voiceEnabled()
+{
+	if (mVoiceModule) 
 	{
-		mAudioSession = NULL;
-		mAudioSessionChanged = true;
+		return mVoiceModule->voiceEnabled();
 	}
-
-	// ditto for the next audio session
-	if(mNextAudioSession == session)
+	else
 	{
-		mNextAudioSession = NULL;
+		return false;
 	}
+}
 
-	// delete the session
-	delete session;
+void LLVoiceClient::setVoiceEnabled(bool enabled)
+{
+	if (mVoiceModule) mVoiceModule->setVoiceEnabled(enabled);
 }
 
-void LLVoiceClient::deleteAllSessions()
+void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
 {
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
+}
 
-	while(!mSessions.empty())
+BOOL LLVoiceClient::lipSyncEnabled()
+{
+	if (mVoiceModule) 
 	{
-		deleteSession(*(sessionsBegin()));
+		return mVoiceModule->lipSyncEnabled();
 	}
-	
-	if(!mSessionsByHandle.empty())
+	else
 	{
-		LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
+		return false;
 	}
 }
 
-void LLVoiceClient::verifySessionState(void)
+void LLVoiceClient::setMuteMic(bool muted)
 {
-	// This is mostly intended for debugging problems with session state management.
-	LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
+	if (mVoiceModule) mVoiceModule->setMuteMic(muted);
+}
 
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
 
-		LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
-		
-		if(!session->mHandle.empty())
-		{
-			// every session with a non-empty handle needs to be in the handle map
-			sessionMap::iterator i2 = mSessionsByHandle.find(&(session->mHandle));
-			if(i2 == mSessionsByHandle.end())
-			{
-				LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
-			}
-			else
-			{
-				if(i2->second != session)
-				{
-					LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
-				}
-			}
-		}
+// ----------------------------------------------
+// PTT
+
+void LLVoiceClient::setUserPTTState(bool ptt)
+{
+	if (mVoiceModule) mVoiceModule->setUserPTTState(ptt);
+}
+
+bool LLVoiceClient::getUserPTTState()
+{
+	if (mVoiceModule) 
+	{
+		return mVoiceModule->getUserPTTState();
 	}
-		
-	// check that every entry in the handle map points to a valid session in the session set
-	for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
+	else
 	{
-		sessionState *session = iter->second;
-		sessionIterator i2 = mSessions.find(session);
-		if(i2 == mSessions.end())
-		{
-			LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
-		}
-		else
-		{
-			if(session->mHandle != (*i2)->mHandle)
-			{
-				LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
-			}
-		}
+		return false;
 	}
 }
 
-LLVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
-	mURI(uri)
+void LLVoiceClient::setUsePTT(bool usePTT)
 {
-	mOnlineSL = false;
-	mOnlineSLim = false;
-	mCanSeeMeOnline = true;
-	mHasBlockListEntry = false;
-	mHasAutoAcceptListEntry = false;
-	mNameResolved = false;
-	mInVivoxBuddies = false;
-	mInSLFriends = false;
-	mNeedsNameUpdate = false;
+	if (mVoiceModule) mVoiceModule->setUsePTT(usePTT);
 }
 
-void LLVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
+void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
 {
-	buddyListEntry *buddy = addBuddy(uri, displayName);
-	buddy->mInVivoxBuddies = true;	
+	if (mVoiceModule) mVoiceModule->setPTTIsToggle(PTTIsToggle);
 }
 
-LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri)
+bool LLVoiceClient::getPTTIsToggle()
 {
-	std::string empty;
-	buddyListEntry *buddy = addBuddy(uri, empty);
-	if(buddy->mDisplayName.empty())
+	if (mVoiceModule) 
 	{
-		buddy->mNameResolved = false;
+		return mVoiceModule->getPTTIsToggle();
 	}
-	return buddy;
-}
-
-LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
-{
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
-	
-	if(iter != mBuddyListMap.end())
-	{
-		// Found a matching buddy already in the map.
-		LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
-		result = iter->second;
+	else {
+		return false;
 	}
 
-	if(!result)
-	{
-		// participant isn't already in one list or the other.
-		LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
-		result = new buddyListEntry(uri);
-		result->mDisplayName = displayName;
-
-		if(IDFromName(uri, result->mUUID)) 
-		{
-			// Extracted UUID from name successfully.
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
-		}
-
-		mBuddyListMap.insert(buddyListMap::value_type(&(result->mURI), result));
-	}
-	
-	return result;
 }
 
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const std::string &uri)
+void LLVoiceClient::inputUserControlState(bool down)
 {
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
-	if(iter != mBuddyListMap.end())
-	{
-		result = iter->second;
-	}
-	
-	return result;
+	if (mVoiceModule) mVoiceModule->inputUserControlState(down);	
 }
 
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const LLUUID &id)
+void LLVoiceClient::toggleUserPTTState(void)
 {
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter;
-
-	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
-	{
-		if(iter->second->mUUID == id)
-		{
-			result = iter->second;
-			break;
-		}
-	}
-	
-	return result;
+	if (mVoiceModule) mVoiceModule->toggleUserPTTState();
 }
 
-LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddyByDisplayName(const std::string &name)
+void LLVoiceClient::keyDown(KEY key, MASK mask)
+{	
+	if (mVoiceModule) mVoiceModule->keyDown(key, mask);
+}
+void LLVoiceClient::keyUp(KEY key, MASK mask)
 {
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter;
+	if (mVoiceModule) mVoiceModule->keyUp(key, mask);
+}
+void LLVoiceClient::middleMouseState(bool down)
+{
+	if (mVoiceModule) mVoiceModule->middleMouseState(down);
+}
 
-	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+
+//-------------------------------------------
+// nearby speaker accessors
+
+BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
+{
+	if (mVoiceModule) 
 	{
-		if(iter->second->mDisplayName == name)
-		{
-			result = iter->second;
-			break;
-		}
+		return mVoiceModule->getVoiceEnabled(id);
+	} 
+	else
+	{
+		return FALSE;
 	}
-	
-	return result;
 }
 
-void LLVoiceClient::deleteBuddy(const std::string &uri)
+std::string LLVoiceClient::getDisplayName(const LLUUID& id)
 {
-	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
-	if(iter != mBuddyListMap.end())
+	if (mVoiceModule) 
 	{
-		LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
-		buddyListEntry *buddy = iter->second;
-		mBuddyListMap.erase(iter);
-		delete buddy;
+		return mVoiceModule->getDisplayName(id);
 	}
 	else
 	{
-		LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
+	  return std::string();
 	}
-	
 }
 
-void LLVoiceClient::deleteAllBuddies(void)
+BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id)
 {
-	while(!mBuddyListMap.empty())
+	if (mVoiceModule) 
 	{
-		deleteBuddy(*(mBuddyListMap.begin()->first));
+		return mVoiceModule->isParticipantAvatar(id);
 	}
-	
-	// Don't want to correlate with friends list when we've emptied the buddy list.
-	mBuddyListMapPopulated = false;
-	
-	// Don't want to correlate with friends list when we've reset the block rules.
-	mBlockRulesListReceived = false;
-	mAutoAcceptRulesListReceived = false;
-}
-
-void LLVoiceClient::deleteAllBlockRules(void)
-{
-	// Clear the block list entry flags from all local buddy list entries
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+	else
 	{
-		buddy_it->second->mHasBlockListEntry = false;
+		return FALSE;
 	}
 }
 
-void LLVoiceClient::deleteAllAutoAcceptRules(void)
+BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id)
 {
-	// Clear the auto-accept list entry flags from all local buddy list entries
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+	if (mVoiceModule) 
 	{
-		buddy_it->second->mHasAutoAcceptListEntry = false;
+		return mVoiceModule->isOnlineSIP(id);
 	}
-}
-
-void LLVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
-{
-	buddyListEntry *buddy = NULL;
-
-	// blockMask is the SIP URI of a friends list entry
-	buddyListMap::iterator iter = mBuddyListMap.find(&blockMask);
-	if(iter != mBuddyListMap.end())
+	else
 	{
-		LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
-		buddy = iter->second;
+		return FALSE;
 	}
+}
 
-	if(buddy == NULL)
+BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
+{
+	if (mVoiceModule) 
 	{
-		LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
-		buddy = addBuddy(blockMask);
+		return mVoiceModule->getIsSpeaking(id);
 	}
-	
-	if(buddy != NULL)
+	else
 	{
-		buddy->mHasBlockListEntry = true;
+		return FALSE;
 	}
 }
 
-void LLVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
+BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
 {
-	buddyListEntry *buddy = NULL;
-
-	// blockMask is the SIP URI of a friends list entry
-	buddyListMap::iterator iter = mBuddyListMap.find(&autoAcceptMask);
-	if(iter != mBuddyListMap.end())
+	if (mVoiceModule) 
 	{
-		LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
-		buddy = iter->second;
+		return mVoiceModule->getIsModeratorMuted(id);
 	}
-
-	if(buddy == NULL)
+	else
 	{
-		LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
-		buddy = addBuddy(autoAcceptMask);
+		return FALSE;
 	}
+}
 
-	if(buddy != NULL)
+F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
+{		
+	if (mVoiceModule) 
 	{
-		buddy->mHasAutoAcceptListEntry = true;
+		return mVoiceModule->getCurrentPower(id);
+	}
+	else
+	{
+		return 0.0;
 	}
 }
 
-void LLVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
-{
-	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
-	mBlockRulesListReceived = true;
-}
-
-void LLVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
+BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
 {
-	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
-	mAutoAcceptRulesListReceived = true;
+	if (mVoiceModule) 
+	{
+		return mVoiceModule->getOnMuteList(id);
+	}
+	else
+	{
+		return FALSE;
+	}
 }
 
-void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+F32 LLVoiceClient::getUserVolume(const LLUUID& id)
 {
-	mParticipantObservers.insert(observer);
+	if (mVoiceModule) 
+	{
+		return mVoiceModule->getUserVolume(id);
+	}
+	else
+	{
+		return 0.0;
+	}
 }
 
-void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
+void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
 {
-	mParticipantObservers.erase(observer);
+	if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
 }
 
-void LLVoiceClient::notifyParticipantObservers()
-{
-	for (observer_set_t::iterator it = mParticipantObservers.begin();
-		it != mParticipantObservers.end();
-		)
-	{
-		LLVoiceClientParticipantObserver* observer = *it;
-		observer->onChange();
-		// In case onChange() deleted an entry.
-		it = mParticipantObservers.upper_bound(observer);
-	}
-}
+//--------------------------------------------------
+// status observers
 
 void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
 {
-	mStatusObservers.insert(observer);
+	if (mVoiceModule) mVoiceModule->addObserver(observer);
 }
 
 void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
 {
-	mStatusObservers.erase(observer);
-}
-
-void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
-{
-	if(mAudioSession)
-	{
-		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
-		{
-			switch(mAudioSession->mErrorStatusCode)
-			{
-				case 20713:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; 		break;
-				case 20714:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; 	break;
-				case 20715:
-					//invalid channel, we may be using a set of poorly cached
-					//info
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-					break;
-				case 1009:
-					//invalid username and password
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-					break;
-			}
-
-			// Reset the error code to make sure it won't be reused later by accident.
-			mAudioSession->mErrorStatusCode = 0;
-		}
-		else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
-		{
-			switch(mAudioSession->mErrorStatusCode)
-			{
-				case 404:	// NOT_FOUND
-				case 480:	// TEMPORARILY_UNAVAILABLE
-				case 408:	// REQUEST_TIMEOUT
-					// call failed because other user was not available
-					// treat this as an error case
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-
-					// Reset the error code to make sure it won't be reused later by accident.
-					mAudioSession->mErrorStatusCode = 0;
-				break;
-			}
-		}
-	}
-		
-	LL_DEBUGS("Voice") 
-		<< " " << LLVoiceClientStatusObserver::status2string(status)  
-		<< ", session URI " << getAudioSessionURI() 
-		<< (inSpatialChannel()?", proximal is true":", proximal is false")
-	<< LL_ENDL;
-
-	for (status_observer_set_t::iterator it = mStatusObservers.begin();
-		it != mStatusObservers.end();
-		)
-	{
-		LLVoiceClientStatusObserver* observer = *it;
-		observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
-		// In case onError() deleted an entry.
-		it = mStatusObservers.upper_bound(observer);
-	}
-
+	if (mVoiceModule) mVoiceModule->removeObserver(observer);
 }
 
 void LLVoiceClient::addObserver(LLFriendObserver* observer)
 {
-	mFriendObservers.insert(observer);
+	if (mVoiceModule) mVoiceModule->addObserver(observer);
 }
 
 void LLVoiceClient::removeObserver(LLFriendObserver* observer)
 {
-	mFriendObservers.erase(observer);
+	if (mVoiceModule) mVoiceModule->removeObserver(observer);
 }
 
-void LLVoiceClient::notifyFriendObservers()
+void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
 {
-	for (friend_observer_set_t::iterator it = mFriendObservers.begin();
-		it != mFriendObservers.end();
-		)
-	{
-		LLFriendObserver* observer = *it;
-		it++;
-		// The only friend-related thing we notify on is online/offline transitions.
-		observer->changed(LLFriendObserver::ONLINE);
-	}
+	if (mVoiceModule) mVoiceModule->addObserver(observer);
 }
 
-void LLVoiceClient::lookupName(const LLUUID &id)
+void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
 {
-	BOOL is_group = FALSE;
-	gCacheName->get(id, is_group, &LLVoiceClient::onAvatarNameLookup);
+	if (mVoiceModule) mVoiceModule->removeObserver(observer);
 }
 
-//static
-void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
+std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
 {
-	if(gVoiceClient)
+	if (mVoiceModule) 
+	{
+		return mVoiceModule->sipURIFromID(id);
+	}
+	else
 	{
-		std::string name = llformat("%s %s", first.c_str(), last.c_str());
-		gVoiceClient->avatarNameResolved(id, name);
+		return std::string();
 	}
 }
 
-void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
+
+///////////////////
+// version checking
+
+class LLViewerRequiredVoiceVersion : public LLHTTPNode
 {
-	// If the avatar whose name just resolved is on our friends list, resync the friends list.
-	if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
-	{
-		mFriendsListDirty = true;
-	}
-	
-	// Iterate over all sessions.
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	static BOOL sAlertedUser;
+	virtual void post(
+					  LLHTTPNode::ResponsePtr response,
+					  const LLSD& context,
+					  const LLSD& input) const
 	{
-		sessionState *session = *iter;
-
-		// Check for this user as a participant in this session
-		participantState *participant = session->findParticipantByID(id);
-		if(participant)
-		{
-			// Found -- fill in the name
-			participant->mAccountName = name;
-			// and post a "participants updated" message to listeners later.
-			session->mParticipantsChanged = true;
-		}
-		
-		// Check whether this is a p2p session whose caller name just resolved
-		if(session->mCallerID == id)
+		//You received this messsage (most likely on region cross or
+		//teleport)
+		if ( input.has("body") && input["body"].has("major_version") )
 		{
-			// this session's "caller ID" just resolved.  Fill in the name.
-			session->mName = name;
-			if(session->mTextInvitePending)
-			{
-				session->mTextInvitePending = false;
-
-				// We don't need to call gIMMgr->addP2PSession() here.  The first incoming message will create the panel.				
-			}
-			if(session->mVoiceInvitePending)
+			int major_voice_version =
+			input["body"]["major_version"].asInteger();
+			// 			int minor_voice_version =
+			// 				input["body"]["minor_version"].asInteger();
+			LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
+			
+			if (major_voice_version > 1)
 			{
-				session->mVoiceInvitePending = false;
-
-				gIMMgr->inviteToSession(
-					session->mIMSessionID,
-					session->mName,
-					session->mCallerID, 
-					session->mName, 
-					IM_SESSION_P2P_INVITE, 
-					LLIMMgr::INVITATION_TYPE_VOICE,
-					session->mHandle,
-					session->mSIPURI);
+				if (!sAlertedUser)
+				{
+					//sAlertedUser = TRUE;
+					LLNotificationsUtil::add("VoiceVersionMismatch");
+					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
+				}
 			}
-			
 		}
 	}
-}
+};
 
 class LLViewerParcelVoiceInfo : public LLHTTPNode
 {
 	virtual void post(
-		LLHTTPNode::ResponsePtr response,
-		const LLSD& context,
-		const LLSD& input) const
+					  LLHTTPNode::ResponsePtr response,
+					  const LLSD& context,
+					  const LLSD& input) const
 	{
 		//the parcel you are in has changed something about its
 		//voice information
-
+		
 		//this is a misnomer, as it can also be when you are not in
 		//a parcel at all.  Should really be something like
 		//LLViewerVoiceInfoChanged.....
 		if ( input.has("body") )
 		{
 			LLSD body = input["body"];
-
+			
 			//body has "region_name" (str), "parcel_local_id"(int),
 			//"voice_credentials" (map).
-
+			
 			//body["voice_credentials"] has "channel_uri" (str),
 			//body["voice_credentials"] has "channel_credentials" (str)
-
+			
 			//if we really wanted to be extra careful,
 			//we'd check the supplied
 			//local parcel id to make sure it's for the same parcel
@@ -7026,7 +743,7 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				LLSD voice_credentials = body["voice_credentials"];
 				std::string uri;
 				std::string credentials;
-
+				
 				if ( voice_credentials.has("channel_uri") )
 				{
 					uri = voice_credentials["channel_uri"].asString();
@@ -7034,51 +751,21 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				if ( voice_credentials.has("channel_credentials") )
 				{
 					credentials =
-						voice_credentials["channel_credentials"].asString();
+					voice_credentials["channel_credentials"].asString();
 				}
-
-				gVoiceClient->setSpatialChannel(uri, credentials);
+				
+				LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
 			}
 		}
 	}
 };
 
-class LLViewerRequiredVoiceVersion : public LLHTTPNode
-{
-	static BOOL sAlertedUser;
-	virtual void post(
-		LLHTTPNode::ResponsePtr response,
-		const LLSD& context,
-		const LLSD& input) const
-	{
-		//You received this messsage (most likely on region cross or
-		//teleport)
-		if ( input.has("body") && input["body"].has("major_version") )
-		{
-			int major_voice_version =
-				input["body"]["major_version"].asInteger();
-// 			int minor_voice_version =
-// 				input["body"]["minor_version"].asInteger();
-
-			if (gVoiceClient &&
-				(major_voice_version > VOICE_MAJOR_VERSION) )
-			{
-				if (!sAlertedUser)
-				{
-					//sAlertedUser = TRUE;
-					LLNotificationsUtil::add("VoiceVersionMismatch");
-					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
-				}
-			}
-		}
-	}
-};
 BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE;
 
 LLHTTPRegistration<LLViewerParcelVoiceInfo>
-    gHTTPRegistrationMessageParcelVoiceInfo(
-		"/message/ParcelVoiceInfo");
+gHTTPRegistrationMessageParcelVoiceInfo(
+										"/message/ParcelVoiceInfo");
 
 LLHTTPRegistration<LLViewerRequiredVoiceVersion>
-    gHTTPRegistrationMessageRequiredVoiceVersion(
-		"/message/RequiredVoiceVersion");
+gHTTPRegistrationMessageRequiredVoiceVersion(
+											 "/message/RequiredVoiceVersion");
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 075834f7e0..8af12f9d38 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -17,8 +17,7 @@
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -33,7 +32,6 @@
 #define LL_VOICE_CLIENT_H
 
 class LLVOAvatar;
-class LLVivoxProtocolParser;
 
 #include "lliopipe.h"
 #include "llpumpio.h"
@@ -42,9 +40,14 @@ class LLVivoxProtocolParser;
 #include "v3math.h"
 #include "llframetimer.h"
 #include "llviewerregion.h"
-#include "m3math.h"			// LLMatrix3
+#include "llcallingcard.h"   // for LLFriendObserver
+#include "llsecapi.h"
+
+// devices
+
+typedef std::vector<std::string> LLVoiceDeviceList;	
+
 
-class LLFriendObserver;
 class LLVoiceClientParticipantObserver
 {
 public:
@@ -52,6 +55,9 @@ public:
 	virtual void onChange() = 0;
 };
 
+
+///////////////////////////////////
+/// @class LLVoiceClientStatusObserver
 class LLVoiceClientStatusObserver
 {
 public:
@@ -65,11 +71,7 @@ public:
 		STATUS_JOINED,
 		STATUS_LEFT_CHANNEL,
 		STATUS_VOICE_DISABLED,
-
-		// Adding STATUS_VOICE_ENABLED as pair status for STATUS_VOICE_DISABLED
-		// See LLVoiceClient::setVoiceEnabled()
 		STATUS_VOICE_ENABLED,
-
 		BEGIN_ERROR_STATUS,
 		ERROR_CHANNEL_FULL,
 		ERROR_CHANNEL_LOCKED,
@@ -83,683 +85,319 @@ public:
 	static std::string status2string(EStatusType inStatus);
 };
 
-class LLVoiceClient: public LLSingleton<LLVoiceClient>
+struct LLVoiceVersionInfo
 {
-	LOG_CLASS(LLVoiceClient);
-	public:
-		LLVoiceClient();	
-		~LLVoiceClient();
-		
-	public:
-		static void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
-		static void terminate();	// Call this to clean up during shutdown
-						
-	protected:
-		bool writeString(const std::string &str);
-
-	public:
-		
-		static F32 OVERDRIVEN_POWER_LEVEL;
-
-		void updateSettings(); // call after loading settings and whenever they change
-	
-		void getCaptureDevicesSendMessage();
-		void getRenderDevicesSendMessage();
-		
-		void clearCaptureDevices();
-		void addCaptureDevice(const std::string& name);
-		void setCaptureDevice(const std::string& name);
-		
-		void clearRenderDevices();
-		void addRenderDevice(const std::string& name);
-		void setRenderDevice(const std::string& name);
-
-		void tuningStart();
-		void tuningStop();
-		bool inTuningMode();
-		bool inTuningStates();
-		
-		void tuningRenderStartSendMessage(const std::string& name, bool loop);
-		void tuningRenderStopSendMessage();
-
-		void tuningCaptureStartSendMessage(int duration);
-		void tuningCaptureStopSendMessage();
-		
-		void tuningSetMicVolume(float volume);
-		void tuningSetSpeakerVolume(float volume);
-		float tuningGetEnergy(void);
-				
-		// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-		// i.e. when the daemon is running and connected, and the device lists are populated.
-		bool deviceSettingsAvailable();
-		
-		// Requery the vivox daemon for the current list of input/output devices.
-		// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-		// (use this if you want to know when it's done).
-		// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-		void refreshDeviceLists(bool clearCurrentList = true);
-		
-		// Call this if the connection to the daemon terminates unexpectedly.  It will attempt to reset everything and relaunch.
-		void daemonDied();
-
-		// Call this if we're just giving up on voice (can't provision an account, etc.).  It will clean up and go away.
-		void giveUp();
-		
-		/////////////////////////////
-		// Response/Event handlers
-		void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
-		void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
-		void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
-		void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
-		void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
-		void logoutResponse(int statusCode, std::string &statusString);
-		void connectorShutdownResponse(int statusCode, std::string &statusString);
-
-		void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
-		void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
-		void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
-		void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
-		void sessionGroupAddedEvent(std::string &sessionGroupHandle);
-		void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
-		void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
-		void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
-		void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
-		void auxAudioPropertiesEvent(F32 energy);
-		void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
-		void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
-		void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
-		void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
-		
-		void buddyListChanged();
-		void muteListChanged();
-		void updateFriends(U32 mask);
-		
-		/////////////////////////////
-		// Sending updates of current state
-static	void updatePosition(void);
-		void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
-		void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
-		bool channelFromRegion(LLViewerRegion *region, std::string &name);
-		void leaveChannel(void);		// call this on logout or teleport begin
-
-		
-		void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-		bool getMuteMic() const;
-		void setUserPTTState(bool ptt);
-		bool getUserPTTState();
-		void toggleUserPTTState(void);
-		void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
-		void setVoiceEnabled(bool enabled);
-		static bool voiceEnabled();
-		void setUsePTT(bool usePTT);
-		void setPTTIsToggle(bool PTTIsToggle);
-		bool getPTTIsToggle();
-		void setPTTKey(std::string &key);
-		void setEarLocation(S32 loc);
-		void setVoiceVolume(F32 volume);
-		void setMicGain(F32 volume);
-		void setUserVolume(const LLUUID& id, F32 volume); // sets volume for specified agent, from 0-1 (where .5 is nominal)
-		void setLipSyncEnabled(BOOL enabled);
-		BOOL lipSyncEnabled();
-
-		// PTT key triggering
-		void keyDown(KEY key, MASK mask);
-		void keyUp(KEY key, MASK mask);
-		void middleMouseState(bool down);
-
-		// Return the version of the Vivox library
-		std::string getAPIVersion() const { return mAPIVersion; }
-		
-		/////////////////////////////
-		// Accessors for data related to nearby speakers
-		BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
-		BOOL getIsSpeaking(const LLUUID& id);
-		BOOL getIsModeratorMuted(const LLUUID& id);
-		F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-		BOOL getOnMuteList(const LLUUID& id);
-		F32 getUserVolume(const LLUUID& id);
-		std::string getDisplayName(const LLUUID& id);
-		
-		// MBW -- XXX -- Not sure how to get this data out of the TVC
-		BOOL getUsingPTT(const LLUUID& id);
-		std::string getGroupID(const LLUUID& id);		// group ID if the user is in group chat (empty string if not applicable)
-
-		/////////////////////////////
-		BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
-											// Use this to determine whether to show a "no speech" icon in the menu bar.
-		
-		/////////////////////////////
-		// Recording controls
-		void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
-		void recordingLoopSave(const std::string& filename);
-		void recordingStop();
-		
-		// Playback controls
-		void filePlaybackStart(const std::string& filename);
-		void filePlaybackStop();
-		void filePlaybackSetPaused(bool paused);
-		void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
-		
-		
-		// This is used by the string-keyed maps below, to avoid storing the string twice.
-		// The 'const std::string *' in the key points to a string actually stored in the object referenced by the map.
-		// The add and delete operations for each map allocate and delete in the right order to avoid dangling references.
-		// The default compare operation would just compare pointers, which is incorrect, so they must use this comparitor instead.
-		struct stringMapComparitor
-		{
-			bool operator()(const std::string* a, const std::string * b) const
-			{
-				return a->compare(*b) < 0;
-			}
-		};
-
-		struct uuidMapComparitor
-		{
-			bool operator()(const LLUUID* a, const LLUUID * b) const
-			{
-				return *a < *b;
-			}
-		};
-		
-		struct participantState
-		{
-		public:
-			participantState(const std::string &uri);
-
-			bool updateMuteState();
-			bool isAvatar();
-
-			std::string mURI;
-			LLUUID mAvatarID;
-			std::string mAccountName;
-			std::string mDisplayName;
-			LLFrameTimer mSpeakingTimeout;
-			F32	mLastSpokeTimestamp;
-			F32 mPower;
-			int mVolume;
-			std::string mGroupID;
-			int mUserVolume;
-			bool mPTT;
-			bool mIsSpeaking;
-			bool mIsModeratorMuted;
-			bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
-			bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
-			bool mAvatarIDValid;
-			bool mIsSelf;
-		};
-		typedef std::map<const std::string *, participantState*, stringMapComparitor> participantMap;
-
-		typedef std::map<const LLUUID *, participantState*, uuidMapComparitor> participantUUIDMap;
-	
-		enum streamState
-		{
-			streamStateUnknown = 0,
-			streamStateIdle = 1,
-			streamStateConnected = 2,
-			streamStateRinging = 3,
-		};
-		
-		struct sessionState
-		{
-		public:
-			sessionState();
-			~sessionState();
-
-			participantState *addParticipant(const std::string &uri);
-			// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
-			// Take care not to use the pointer again after that.
-			void removeParticipant(participantState *participant);
-			void removeAllParticipants();
-
-			participantState *findParticipant(const std::string &uri);
-			participantState *findParticipantByID(const LLUUID& id);
-
-			bool isCallBackPossible();
-			bool isTextIMPossible();
-
-			std::string mHandle;
-			std::string mGroupHandle;
-			std::string mSIPURI;
-			std::string mAlias;
-			std::string mName;
-			std::string mAlternateSIPURI;
-			std::string mHash;			// Channel password
-			std::string mErrorStatusString;
-			std::queue<std::string> mTextMsgQueue;
-			
-			LLUUID		mIMSessionID;
-			LLUUID		mCallerID;
-			int			mErrorStatusCode;
-			int			mMediaStreamState;
-			int			mTextStreamState;
-			bool		mCreateInProgress;	// True if a Session.Create has been sent for this session and no response has been received yet.
-			bool		mMediaConnectInProgress;	// True if a Session.MediaConnect has been sent for this session and no response has been received yet.
-			bool		mVoiceInvitePending;	// True if a voice invite is pending for this session (usually waiting on a name lookup)
-			bool		mTextInvitePending;		// True if a text invite is pending for this session (usually waiting on a name lookup)
-			bool		mSynthesizedCallerID;	// True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
-			bool		mIsChannel;	// True for both group and spatial channels (false for p2p, PSTN)
-			bool		mIsSpatial;	// True for spatial channels
-			bool		mIsP2P;
-			bool		mIncoming;
-			bool		mVoiceEnabled;
-			bool		mReconnect;	// Whether we should try to reconnect to this session if it's dropped
-			// Set to true when the mute state of someone in the participant list changes.
-			// The code will have to walk the list to find the changed participant(s).
-			bool		mVolumeDirty;
-
-			bool		mParticipantsChanged;
-			participantMap mParticipantsByURI;
-			participantUUIDMap mParticipantsByUUID;
-		};
-
-		participantState *findParticipantByID(const LLUUID& id);
-		participantMap *getParticipantList(void);
-		
-		typedef std::map<const std::string*, sessionState*, stringMapComparitor> sessionMap;
-		typedef std::set<sessionState*> sessionSet;
-				
-		typedef sessionSet::iterator sessionIterator;
-		sessionIterator sessionsBegin(void);
-		sessionIterator sessionsEnd(void);
-
-		sessionState *findSession(const std::string &handle);
-		sessionState *findSessionBeingCreatedByURI(const std::string &uri);
-		sessionState *findSession(const LLUUID &participant_id);
-		sessionState *findSessionByCreateID(const std::string &create_id);
-		
-		sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
-		void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
-		void setSessionURI(sessionState *session, const std::string &uri);
-		void deleteSession(sessionState *session);
-		void deleteAllSessions(void);
-
-		void verifySessionState(void);
-
-		void joinedAudioSession(sessionState *session);
-		void leftAudioSession(sessionState *session);
-
-		// This is called in several places where the session _may_ need to be deleted.
-		// It contains logic for whether to delete the session or keep it around.
-		void reapSession(sessionState *session);
-		
-		// Returns true if the session seems to indicate we've moved to a region on a different voice server
-		bool sessionNeedsRelog(sessionState *session);
-		
-		struct buddyListEntry
-		{
-			buddyListEntry(const std::string &uri);
-			std::string mURI;
-			std::string mDisplayName;
-			LLUUID	mUUID;
-			bool mOnlineSL;
-			bool mOnlineSLim;
-			bool mCanSeeMeOnline;
-			bool mHasBlockListEntry;
-			bool mHasAutoAcceptListEntry;
-			bool mNameResolved;
-			bool mInSLFriends;
-			bool mInVivoxBuddies;
-			bool mNeedsNameUpdate;
-		};
-
-		typedef std::map<const std::string*, buddyListEntry*, stringMapComparitor> buddyListMap;
-		
-		// This should be called when parsing a buddy list entry sent by SLVoice.		
-		void processBuddyListEntry(const std::string &uri, const std::string &displayName);
-
-		buddyListEntry *addBuddy(const std::string &uri);
-		buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
-		buddyListEntry *findBuddy(const std::string &uri);
-		buddyListEntry *findBuddy(const LLUUID &id);
-		buddyListEntry *findBuddyByDisplayName(const std::string &name);
-		void deleteBuddy(const std::string &uri);
-		void deleteAllBuddies(void);
-
-		void deleteAllBlockRules(void);
-		void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
-		void deleteAllAutoAcceptRules(void);
-		void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
-		void accountListBlockRulesResponse(int statusCode, const std::string &statusString);						
-		void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);						
-		
-		/////////////////////////////
-		// session control messages
-		void connectorCreate();
-		void connectorShutdown();
-
-		void requestVoiceAccountProvision(S32 retries = 3);
-	void userAuthorized(const std::string& user_id,
-						const LLUUID &agentID);
-		void login(
-			const std::string& account_name,
-			const std::string& password,
-			const std::string& voice_sip_uri_hostname,
-			const std::string& voice_account_server_uri);
-		void loginSendMessage();
-		void logout();
-		void logoutSendMessage();
-
-		void accountListBlockRulesSendMessage();
-		void accountListAutoAcceptRulesSendMessage();
-		
-		void sessionGroupCreateSendMessage();
-		void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
-		void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
-		void sessionMediaConnectSendMessage(sessionState *session);		// just joins the audio session
-		void sessionTextConnectSendMessage(sessionState *session);		// just joins the text session
-		void sessionTerminateSendMessage(sessionState *session);
-		void sessionGroupTerminateSendMessage(sessionState *session);
-		void sessionMediaDisconnectSendMessage(sessionState *session);
-		void sessionTextDisconnectSendMessage(sessionState *session);
-
-		// Pokes the state machine to leave the audio session next time around.
-		void sessionTerminate();	
-		
-		// Pokes the state machine to shut down the connector and restart it.
-		void requestRelog();
-		
-		// Does the actual work to get out of the audio session
-		void leaveAudioSession();
-		
-		void addObserver(LLVoiceClientParticipantObserver* observer);
-		void removeObserver(LLVoiceClientParticipantObserver* observer);
-
-		void addObserver(LLVoiceClientStatusObserver* observer);
-		void removeObserver(LLVoiceClientStatusObserver* observer);
-
-		void addObserver(LLFriendObserver* observer);
-		void removeObserver(LLFriendObserver* observer);
-		
-		void lookupName(const LLUUID &id);
-		static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
-		void avatarNameResolved(const LLUUID &id, const std::string &name);
-		
-		typedef std::vector<std::string> deviceList;
-
-		deviceList *getCaptureDevices();
-		deviceList *getRenderDevices();
-		
-		void setNonSpatialChannel(
-			const std::string &uri,
-			const std::string &credentials);
-		void setSpatialChannel(
-			const std::string &uri,
-			const std::string &credentials);
-		// start a voice session with the specified user
-		void callUser(const LLUUID &uuid);
-		
-		// Send a text message to the specified user, initiating the session if necessary.
-		bool sendTextMessage(const LLUUID& participant_id, const std::string& message);
-		
-		// close any existing text IM session with the specified user
-		void endUserIMSession(const LLUUID &uuid);
-		
-		bool answerInvite(std::string &sessionHandle);
-		void declineInvite(std::string &sessionHandle);
-		void leaveNonSpatialChannel();
+	std::string serverType;
+	std::string serverVersion;
+};
 
-		// Returns the URI of the current channel, or an empty string if not currently in a channel.
-		// NOTE that it will return an empty string if it's in the process of joining a channel.
-		std::string getCurrentChannel();
-		
-		// returns true iff the user is currently in a proximal (local spatial) channel.
-		// Note that gestures should only fire if this returns true.
-		bool inProximalChannel();
+//////////////////////////////////
+/// @class LLVoiceModuleInterface
+/// @brief Voice module interface
+///
+/// Voice modules should provide an implementation for this interface.
+/////////////////////////////////
 
-		std::string sipURIFromID(const LLUUID &id);
-				
-		// Returns true if the indicated user is online via SIP presence according to SLVoice.
-		// Note that we only get SIP presence data for other users that are in our vivox buddy list.
-		bool isOnlineSIP(const LLUUID &id);
-
-		// Returns true if the indicated participant is really an SL avatar.
-		// This should be used to control the state of the "profile" button.
-		// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
-		bool isParticipantAvatar(const LLUUID &id);
-		
-		// Returns true if calling back the session URI after the session has closed is possible.
-		// Currently this will be false only for PSTN P2P calls.		
-		// NOTE: this will return true if the session can't be found. 
-		bool isSessionCallBackPossible(const LLUUID &session_id);
-		
-		// Returns true if the session can accepte text IM's.
-		// Currently this will be false only for PSTN P2P calls.
-		// NOTE: this will return true if the session can't be found. 
-		bool isSessionTextIMPossible(const LLUUID &session_id);
-		
-	private:
-
-		// internal state for a simple state machine.  This is used to deal with the asynchronous nature of some of the messages.
-		// Note: if you change this list, please make corresponding changes to LLVoiceClient::state2string().
-		enum state
-		{
-			stateDisableCleanup,
-			stateDisabled,				// Voice is turned off.
-			stateStart,					// Class is initialized, socket is created
-			stateDaemonLaunched,		// Daemon has been launched
-			stateConnecting,			// connect() call has been issued
-			stateConnected,				// connection to the daemon has been made, send some initial setup commands.
-			stateIdle,					// socket is connected, ready for messaging
-			stateMicTuningStart,
-			stateMicTuningRunning,		
-			stateMicTuningStop,
-			stateConnectorStart,		// connector needs to be started
-			stateConnectorStarting,		// waiting for connector handle
-			stateConnectorStarted,		// connector handle received
-			stateLoginRetry,			// need to retry login (failed due to changing password)
-			stateLoginRetryWait,		// waiting for retry timer
-			stateNeedsLogin,			// send login request
-			stateLoggingIn,				// waiting for account handle
-			stateLoggedIn,				// account handle received
-			stateCreatingSessionGroup,	// Creating the main session group
-			stateNoChannel,				// 
-			stateJoiningSession,		// waiting for session handle
-			stateSessionJoined,			// session handle received
-			stateRunning,				// in session, steady state
-			stateLeavingSession,		// waiting for terminate session response
-			stateSessionTerminated,		// waiting for terminate session response
-
-			stateLoggingOut,			// waiting for logout response
-			stateLoggedOut,				// logout response received
-			stateConnectorStopping,		// waiting for connector stop
-			stateConnectorStopped,		// connector stop received
-			
-			// We go to this state if the login fails because the account needs to be provisioned.
-			
-			// error states.  No way to recover from these yet.
-			stateConnectorFailed,
-			stateConnectorFailedWaiting,
-			stateLoginFailed,
-			stateLoginFailedWaiting,
-			stateJoinSessionFailed,
-			stateJoinSessionFailedWaiting,
-
-			stateJail					// Go here when all else has failed.  Nothing will be retried, we're done.
-		};
-		
-		state mState;
-		bool mSessionTerminateRequested;
-		bool mRelogRequested;
-		
-		void setState(state inState);
-		state getState(void)  { return mState; };
-		static std::string state2string(state inState);
-		
-		void stateMachine();
-		static void idle(void *user_data);
-		
-		LLHost mDaemonHost;
-		LLSocket::ptr_t mSocket;
-		bool mConnected;
-		
-		void closeSocket(void);
-		
-		LLPumpIO *mPump;
-		friend class LLVivoxProtocolParser;
-		
-		std::string mAccountName;
-		std::string mAccountPassword;
-		std::string mAccountDisplayName;
-		std::string mAccountFirstName;
-		std::string mAccountLastName;
-				
-		bool mTuningMode;
-		float mTuningEnergy;
-		std::string mTuningAudioFile;
-		int mTuningMicVolume;
-		bool mTuningMicVolumeDirty;
-		int mTuningSpeakerVolume;
-		bool mTuningSpeakerVolumeDirty;
-		state mTuningExitState;					// state to return to when we leave tuning mode.
-		
-		std::string mSpatialSessionURI;
-		std::string mSpatialSessionCredentials;
+class LLVoiceModuleInterface
+{
+public:
+	LLVoiceModuleInterface() {}
+	virtual ~LLVoiceModuleInterface() {}
+	
+	virtual void init(LLPumpIO *pump)=0;	// Call this once at application startup (creates connector)
+	virtual void terminate()=0;	// Call this to clean up during shutdown
+	
+	virtual void updateSettings()=0; // call after loading settings and whenever they change
+	
+	virtual const LLVoiceVersionInfo& getVersion()=0;
+	
+	/////////////////////
+	/// @name Tuning
+	//@{
+	virtual void tuningStart()=0;
+	virtual void tuningStop()=0;
+	virtual bool inTuningMode()=0;
+	
+	virtual void tuningSetMicVolume(float volume)=0;
+	virtual void tuningSetSpeakerVolume(float volume)=0;
+	virtual float tuningGetEnergy(void)=0;
+	//@}
+	
+	/////////////////////
+	/// @name Devices
+	//@{
+	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+	// i.e. when the daemon is running and connected, and the device lists are populated.
+	virtual bool deviceSettingsAvailable()=0;
+	
+	// Requery the vivox daemon for the current list of input/output devices.
+	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+	// (use this if you want to know when it's done).
+	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+	virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
+	
+	virtual void setCaptureDevice(const std::string& name)=0;
+	virtual void setRenderDevice(const std::string& name)=0;
+	
+	virtual LLVoiceDeviceList& getCaptureDevices()=0;
+	virtual LLVoiceDeviceList& getRenderDevices()=0;
+	
+	virtual std::vector<LLUUID> getParticipantList(void)=0;
+	//@}
+	
+	////////////////////////////
+	/// @ name Channel stuff
+	//@{
+	// returns true iff the user is currently in a proximal (local spatial) channel.
+	// Note that gestures should only fire if this returns true.
+	virtual bool inProximalChannel()=0;
+	
+	virtual void setNonSpatialChannel(const std::string &uri,
+									  const std::string &credentials)=0;
+	
+	virtual void setSpatialChannel(const std::string &uri,
+								   const std::string &credentials)=0;
+	
+	virtual void leaveNonSpatialChannel()=0;
+	
+	virtual void leaveChannel(void)=0;	
+	
+	// Returns the URI of the current channel, or an empty string if not currently in a channel.
+	// NOTE that it will return an empty string if it's in the process of joining a channel.
+	virtual std::string getCurrentChannel()=0;
+	//@}
+	
+	
+	//////////////////////////
+	/// @name invitations
+	//@{
+	// start a voice channel with the specified user
+	virtual void callUser(const LLUUID &uuid)=0;
+	virtual bool answerInvite(std::string &channelHandle)=0;
+	virtual void declineInvite(std::string &channelHandle)=0;
+	//@}
+	
+	/////////////////////////
+	/// @name Volume/gain
+	//@{
+	virtual void setVoiceVolume(F32 volume)=0;
+	virtual void setMicGain(F32 volume)=0;
+	//@}
+	
+	/////////////////////////
+	/// @name enable disable voice and features
+	//@{
+	virtual bool voiceEnabled()=0;
+	virtual void setVoiceEnabled(bool enabled)=0;
+	virtual void setLipSyncEnabled(BOOL enabled)=0;
+	virtual BOOL lipSyncEnabled()=0;	
+	virtual void setMuteMic(bool muted)=0;		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+	//@}
+	
+	////////////////////////
+	/// @name PTT
+	//@{
+	virtual void setUserPTTState(bool ptt)=0;
+	virtual bool getUserPTTState()=0;
+	virtual void setUsePTT(bool usePTT)=0;
+	virtual void setPTTIsToggle(bool PTTIsToggle)=0;
+	virtual bool getPTTIsToggle()=0;	
+	virtual void toggleUserPTTState(void)=0;
+	virtual void inputUserControlState(bool down)=0;  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+	
+	virtual void keyDown(KEY key, MASK mask)=0;
+	virtual void keyUp(KEY key, MASK mask)=0;
+	virtual void middleMouseState(bool down)=0;
+	//@}
+	
+	//////////////////////////
+	/// @name nearby speaker accessors
+	//@{
+
+
+	virtual BOOL getVoiceEnabled(const LLUUID& id)=0;		// true if we've received data for this avatar
+	virtual std::string getDisplayName(const LLUUID& id)=0;
+	virtual BOOL isOnlineSIP(const LLUUID &id)=0;	
+	virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
+	virtual BOOL getIsSpeaking(const LLUUID& id)=0;
+	virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
+	virtual F32 getCurrentPower(const LLUUID& id)=0;		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
+	virtual BOOL getOnMuteList(const LLUUID& id)=0;
+	virtual F32 getUserVolume(const LLUUID& id)=0;
+	virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)	
+	//@}
+	
+	//////////////////////////
+	/// @name text chat
+	//@{
+	virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
+	virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
+	virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
+	virtual void endUserIMSession(const LLUUID &uuid)=0;	
+	//@}
+	
+	// authorize the user
+	virtual void userAuthorized(const std::string& user_id,
+								const LLUUID &agentID)=0;
+	
+	//////////////////////////////
+	/// @name Status notification
+	//@{
+	virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
+	virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
+	virtual void addObserver(LLFriendObserver* observer)=0;
+	virtual void removeObserver(LLFriendObserver* observer)=0;	
+	virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
+	virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;	
+	//@}
+	
+	virtual std::string sipURIFromID(const LLUUID &id)=0;
+	//@}
+	
+};
 
-		std::string mMainSessionGroupHandle; // handle of the "main" session group.
-		
-		std::string mChannelName;			// Name of the channel to be looked up 
-		bool mAreaVoiceDisabled;
-		sessionState *mAudioSession;		// Session state for the current audio session
-		bool mAudioSessionChanged;			// set to true when the above pointer gets changed, so observers can be notified.
 
-		sessionState *mNextAudioSession;	// Session state for the audio session we're trying to join
+class LLVoiceClient: public LLSingleton<LLVoiceClient>
+{
+	LOG_CLASS(LLVoiceClient);
+public:
+	LLVoiceClient();	
+	~LLVoiceClient();
 
-//		std::string mSessionURI;			// URI of the session we're in.
-//		std::string mSessionHandle;		// returned by ?
-		
-		S32 mCurrentParcelLocalID;			// Used to detect parcel boundary crossings
-		std::string mCurrentRegionName;		// Used to detect parcel boundary crossings
-		
-		std::string mConnectorHandle;	// returned by "Create Connector" message
-		std::string mAccountHandle;		// returned by login message		
-		int 		mNumberOfAliases;
-		U32 mCommandCookie;
+	void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
+	void terminate();	// Call this to clean up during shutdown
 	
-		std::string mVoiceAccountServerURI;
-		std::string mVoiceSIPURIHostName;
-		
-		int mLoginRetryCount;
-		
-		sessionMap mSessionsByHandle;				// Active sessions, indexed by session handle.  Sessions which are being initiated may not be in this map.
-		sessionSet mSessions;						// All sessions, not indexed.  This is the canonical session list.
-		
-		bool mBuddyListMapPopulated;
-		bool mBlockRulesListReceived;
-		bool mAutoAcceptRulesListReceived;
-		buddyListMap mBuddyListMap;
-		
-		deviceList mCaptureDevices;
-		deviceList mRenderDevices;
+	const LLVoiceVersionInfo getVersion();
+	
+static const F32 OVERDRIVEN_POWER_LEVEL;
 
-		std::string mCaptureDevice;
-		std::string mRenderDevice;
-		bool mCaptureDeviceDirty;
-		bool mRenderDeviceDirty;
-		
-		// This should be called when the code detects we have changed parcels.
-		// It initiates the call to the server that gets the parcel channel.
-		void parcelChanged();
-		
-	void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
-		void joinSession(sessionState *session);
-		
-static 	std::string nameFromAvatar(LLVOAvatar *avatar);
-static	std::string nameFromID(const LLUUID &id);
-static	bool IDFromName(const std::string name, LLUUID &uuid);
-static	std::string displayNameFromAvatar(LLVOAvatar *avatar);
-		std::string sipURIFromAvatar(LLVOAvatar *avatar);
-		std::string sipURIFromName(std::string &name);
-		
-		// Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
-static	std::string nameFromsipURI(const std::string &uri);		
+	void updateSettings(); // call after loading settings and whenever they change
 
-		bool inSpatialChannel(void);
-		std::string getAudioSessionURI();
-		std::string getAudioSessionHandle();
-				
-		void sendPositionalUpdate(void);
-		
-		void buildSetCaptureDevice(std::ostringstream &stream);
-		void buildSetRenderDevice(std::ostringstream &stream);
-		void buildLocalAudioUpdates(std::ostringstream &stream);
+	// tuning
+	void tuningStart();
+	void tuningStop();
+	bool inTuningMode();
 		
-		void clearAllLists();
-		void checkFriend(const LLUUID& id);
-		void sendFriendsListUpdates();
-
-		// start a text IM session with the specified user
-		// This will be asynchronous, the session may be established at a future time.
-		sessionState* startUserIMSession(const LLUUID& uuid);
-		void sendQueuedTextMessages(sessionState *session);
-		
-		void enforceTether(void);
-		
-		bool		mSpatialCoordsDirty;
-		
-		LLVector3d	mCameraPosition;
-		LLVector3d	mCameraRequestedPosition;
-		LLVector3	mCameraVelocity;
-		LLMatrix3	mCameraRot;
-
-		LLVector3d	mAvatarPosition;
-		LLVector3	mAvatarVelocity;
-		LLMatrix3	mAvatarRot;
-		
-		bool		mPTTDirty;
-		bool		mPTT;
-		
-		bool		mUsePTT;
-		bool		mPTTIsMiddleMouse;
-		KEY			mPTTKey;
-		bool		mPTTIsToggle;
-		bool		mUserPTTState;
-		bool		mMuteMic;
+	void tuningSetMicVolume(float volume);
+	void tuningSetSpeakerVolume(float volume);
+	float tuningGetEnergy(void);
 				
-		// Set to true when the friends list is known to have changed.
-		bool		mFriendsListDirty;
-		
-		enum
-		{
-			earLocCamera = 0,		// ear at camera
-			earLocAvatar,			// ear at avatar
-			earLocMixed				// ear at avatar location/camera direction
-		};
-		
-		S32			mEarLocation;  
+	// devices
+	
+	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+	// i.e. when the daemon is running and connected, and the device lists are populated.
+	bool deviceSettingsAvailable();
 		
-		bool		mSpeakerVolumeDirty;
-		bool		mSpeakerMuteDirty;
-		int			mSpeakerVolume;
+	// Requery the vivox daemon for the current list of input/output devices.
+	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+	// (use this if you want to know when it's done).
+	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+	void refreshDeviceLists(bool clearCurrentList = true);
 
-		int			mMicVolume;
-		bool		mMicVolumeDirty;
-		
-		bool		mVoiceEnabled;
-		bool		mWriteInProgress;
-		std::string mWriteString;
-		
-		LLTimer		mUpdateTimer;
-		
-		BOOL		mLipSyncEnabled;
+	void setCaptureDevice(const std::string& name);
+	void setRenderDevice(const std::string& name);
 
-		std::string	mAPIVersion;
+	const LLVoiceDeviceList& getCaptureDevices();
+	const LLVoiceDeviceList& getRenderDevices();
 
-		typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
-		observer_set_t mParticipantObservers;
+	////////////////////////////
+	// Channel stuff
+	//
+	
+	// returns true iff the user is currently in a proximal (local spatial) channel.
+	// Note that gestures should only fire if this returns true.
+	bool inProximalChannel();
+	void setNonSpatialChannel(
+							  const std::string &uri,
+							  const std::string &credentials);
+	void setSpatialChannel(
+						   const std::string &uri,
+						   const std::string &credentials);
+	void leaveNonSpatialChannel();
+	
+	// Returns the URI of the current channel, or an empty string if not currently in a channel.
+	// NOTE that it will return an empty string if it's in the process of joining a channel.
+	std::string getCurrentChannel();
+	// start a voice channel with the specified user
+	void callUser(const LLUUID &uuid);	
+	bool answerInvite(std::string &channelHandle);
+	void declineInvite(std::string &channelHandle);	
+	void leaveChannel(void);		// call this on logout or teleport begin
+	
+	
+	/////////////////////////////
+	// Sending updates of current state
+	
 
-		void notifyParticipantObservers();
+	void setVoiceVolume(F32 volume);
+	void setMicGain(F32 volume);
+	void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)		
+	bool voiceEnabled();
+	void setLipSyncEnabled(BOOL enabled);
+	void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+	void setUserPTTState(bool ptt);
+	bool getUserPTTState();
+	void toggleUserPTTState(void);
+	void inputUserControlState(bool down);  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs	
+	void setVoiceEnabled(bool enabled);
+
+	void setUsePTT(bool usePTT);
+	void setPTTIsToggle(bool PTTIsToggle);
+	bool getPTTIsToggle();	
+	
+	BOOL lipSyncEnabled();
+	
+	// PTT key triggering
+	void keyDown(KEY key, MASK mask);
+	void keyUp(KEY key, MASK mask);
+	void middleMouseState(bool down);
+	
+	
+	/////////////////////////////
+	// Accessors for data related to nearby speakers
+	BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
+	std::string getDisplayName(const LLUUID& id);	
+	BOOL isOnlineSIP(const LLUUID &id);
+	BOOL isParticipantAvatar(const LLUUID &id);
+	BOOL getIsSpeaking(const LLUUID& id);
+	BOOL getIsModeratorMuted(const LLUUID& id);
+	F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
+	BOOL getOnMuteList(const LLUUID& id);
+	F32 getUserVolume(const LLUUID& id);
+
+	/////////////////////////////
+	BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
+													  // Use this to determine whether to show a "no speech" icon in the menu bar.
+	std::vector<LLUUID> getParticipantList(void);
+	
+	//////////////////////////
+	/// @name text chat
+	//@{
+	BOOL isSessionTextIMPossible(const LLUUID& id);
+	BOOL isSessionCallBackPossible(const LLUUID& id);
+	BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
+	void endUserIMSession(const LLUUID &uuid);	
+	//@}
+	
 
-		typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
-		status_observer_set_t mStatusObservers;
+	void userAuthorized(const std::string& user_id,
+			const LLUUID &agentID);
+	
+	void addObserver(LLVoiceClientStatusObserver* observer);
+	void removeObserver(LLVoiceClientStatusObserver* observer);
+	void addObserver(LLFriendObserver* observer);
+	void removeObserver(LLFriendObserver* observer);
+	void addObserver(LLVoiceClientParticipantObserver* observer);
+	void removeObserver(LLVoiceClientParticipantObserver* observer);
+	
+	std::string sipURIFromID(const LLUUID &id);	
 		
-		void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
-
-		typedef std::set<LLFriendObserver*> friend_observer_set_t;
-		friend_observer_set_t mFriendObservers;
-		void notifyFriendObservers();
+protected:
+	LLVoiceModuleInterface* mVoiceModule;
+	LLPumpIO *m_servicePump;
+	
 };
 
-extern LLVoiceClient *gVoiceClient;
 
 #endif //LL_VOICE_CLIENT_H
 
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
new file mode 100644
index 0000000000..41c20597b1
--- /dev/null
+++ b/indra/newview/llvoicevivox.cpp
@@ -0,0 +1,6900 @@
+ /** 
+ * @file LLVivoxVoiceClient.cpp
+ * @brief Implementation of LLVivoxVoiceClient class which is the interface to the voice client process.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llvoicevivox.h"
+
+#include <boost/tokenizer.hpp>
+
+#include "llsdutil.h"
+
+#include "llvoavatarself.h"
+#include "llbufferstream.h"
+#include "llfile.h"
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llcallbacklist.h"
+#include "llviewerregion.h"
+#include "llviewernetwork.h"		// for gGridChoice
+#include "llbase64.h"
+#include "llviewercontrol.h"
+#include "llkeyboard.h"
+#include "llappviewer.h"	// for gDisconnected, gDisableVoice
+#include "llmutelist.h"  // to check for muted avatars
+#include "llagent.h"
+#include "llcachename.h"
+#include "llimview.h" // for LLIMMgr
+#include "llparcel.h"
+#include "llviewerparcelmgr.h"
+#include "llfirstuse.h"
+#include "llviewerwindow.h"
+#include "llviewercamera.h"
+
+#include "llfloaterfriends.h"  //VIVOX, inorder to refresh communicate panel
+#include "llfloaterchat.h"		// for LLFloaterChat::addChat()
+#include "llviewernetwork.h"
+#include "llnotificationsutil.h"
+
+// for base64 decoding
+#include "apr_base64.h"
+
+// for SHA1 hash
+#include "apr_sha1.h"
+
+// for MD5 hash
+#include "llmd5.h"
+
+#define USE_SESSION_GROUPS 0
+
+const F32 SPEAKING_TIMEOUT = 1.f;
+
+static const std::string VOICE_SERVER_TYPE = "Vivox";
+
+// Don't retry connecting to the daemon more frequently than this:
+const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
+
+// Don't send positional updates more frequently than this:
+const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
+
+const F32 LOGIN_RETRY_SECONDS = 10.0f;
+const int MAX_LOGIN_RETRIES = 12;
+
+static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
+{
+	LLMD5 md5_uuid;
+	md5_uuid.update((const unsigned char*)str.data(), str.size());
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(uuid.mData);
+}
+
+static int scale_mic_volume(float volume)
+{
+	// incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.                                                
+	// Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70                                                   
+	return 30 + (int)(volume * 20.0f);
+}
+
+static int scale_speaker_volume(float volume)
+{
+	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.                                                
+	// Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70                                                   
+	return 30 + (int)(volume * 40.0f);
+	
+}
+
+class LLVivoxVoiceAccountProvisionResponder :
+	public LLHTTPClient::Responder
+{
+public:
+	LLVivoxVoiceAccountProvisionResponder(int retries)
+	{
+		mRetries = retries;
+	}
+
+	virtual void error(U32 status, const std::string& reason)
+	{
+		if ( mRetries > 0 )
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying.  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			LLVivoxVoiceClient::getInstance()->requestVoiceAccountProvision(
+				mRetries - 1);
+		}
+		else
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up).  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			LLVivoxVoiceClient::getInstance()->giveUp();
+		}
+	}
+
+	virtual void result(const LLSD& content)
+	{
+
+		std::string voice_sip_uri_hostname;
+		std::string voice_account_server_uri;
+		
+		LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+		
+		if(content.has("voice_sip_uri_hostname"))
+			voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
+		
+		// this key is actually misnamed -- it will be an entire URI, not just a hostname.
+		if(content.has("voice_account_server_name"))
+			voice_account_server_uri = content["voice_account_server_name"].asString();
+		
+		LLVivoxVoiceClient::getInstance()->login(
+			content["username"].asString(),
+			content["password"].asString(),
+			voice_sip_uri_hostname,
+			voice_account_server_uri);
+
+	}
+
+private:
+	int mRetries;
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver
+{
+	/* virtual */ void onChange()  { LLVivoxVoiceClient::getInstance()->muteListChanged();}
+};
+
+class LLVivoxVoiceClientFriendsObserver : public LLFriendObserver
+{
+public:
+	/* virtual */ void changed(U32 mask) { LLVivoxVoiceClient::getInstance()->updateFriends(mask);}
+};
+
+static LLVivoxVoiceClientMuteListObserver mutelist_listener;
+static bool sMuteListListener_listening = false;
+
+static LLVivoxVoiceClientFriendsObserver *friendslist_listener = NULL;
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVivoxVoiceClientCapResponder : public LLHTTPClient::Responder
+{
+public:
+	LLVivoxVoiceClientCapResponder(void){};
+
+	virtual void error(U32 status, const std::string& reason);	// called with bad status codes
+	virtual void result(const LLSD& content);
+
+private:
+};
+
+void LLVivoxVoiceClientCapResponder::error(U32 status, const std::string& reason)
+{
+	LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder::error("
+		<< status << ": " << reason << ")"
+		<< LL_ENDL;
+}
+
+void LLVivoxVoiceClientCapResponder::result(const LLSD& content)
+{
+	LLSD::map_const_iterator iter;
+	
+	LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+
+	if ( content.has("voice_credentials") )
+	{
+		LLSD voice_credentials = content["voice_credentials"];
+		std::string uri;
+		std::string credentials;
+
+		if ( voice_credentials.has("channel_uri") )
+		{
+			uri = voice_credentials["channel_uri"].asString();
+		}
+		if ( voice_credentials.has("channel_credentials") )
+		{
+			credentials =
+				voice_credentials["channel_credentials"].asString();
+		}
+
+		LLVivoxVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
+	}
+}
+
+
+
+#if LL_WINDOWS
+static HANDLE sGatewayHandle = 0;
+
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayHandle != 0)		
+	{
+		DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
+		if(waitresult != WAIT_OBJECT_0)
+		{
+			result = true;
+		}			
+	}
+	return result;
+}
+static void killGateway()
+{
+	if(sGatewayHandle != 0)
+	{
+		TerminateProcess(sGatewayHandle,0);
+	}
+}
+
+#else // Mac and linux
+
+static pid_t sGatewayPID = 0;
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayPID != 0)
+	{
+		// A kill with signal number 0 has no effect, just does error checking.  It should return an error if the process no longer exists.
+		if(kill(sGatewayPID, 0) == 0)
+		{
+			result = true;
+		}
+	}
+	return result;
+}
+
+static void killGateway()
+{
+	if(sGatewayPID != 0)
+	{
+		kill(sGatewayPID, SIGTERM);
+	}
+}
+
+#endif
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+LLVivoxVoiceClient::LLVivoxVoiceClient() :
+	mState(stateDisabled),
+	mSessionTerminateRequested(false),
+	mRelogRequested(false),
+	mConnected(false),
+	mPump(NULL),
+
+	mTuningMode(false),
+	mTuningEnergy(0.0f),
+	mTuningMicVolume(0),
+	mTuningMicVolumeDirty(true),
+	mTuningSpeakerVolume(0),
+	mTuningSpeakerVolumeDirty(true),
+	mTuningExitState(stateDisabled),
+
+	mAreaVoiceDisabled(false),
+	mAudioSession(NULL),
+	mAudioSessionChanged(false),
+	mNextAudioSession(NULL),
+
+	mCurrentParcelLocalID(0),
+	mNumberOfAliases(0),
+	mCommandCookie(0),
+	mLoginRetryCount(0),
+
+	mBuddyListMapPopulated(false),
+	mBlockRulesListReceived(false),
+	mAutoAcceptRulesListReceived(false),
+	mCaptureDeviceDirty(false),
+	mRenderDeviceDirty(false),
+	mSpatialCoordsDirty(false),
+
+	mPTTDirty(true),
+	mPTT(true),
+	mUsePTT(true),
+	mPTTIsMiddleMouse(false),
+	mPTTKey(0),
+	mPTTIsToggle(false),
+	mUserPTTState(false),
+	mMuteMic(false),
+	mFriendsListDirty(true),
+
+	mEarLocation(0),
+	mSpeakerVolumeDirty(true),
+	mSpeakerMuteDirty(true),
+	mMicVolume(0),
+	mMicVolumeDirty(true),
+
+	mVoiceEnabled(false),
+	mWriteInProgress(false),
+
+	mLipSyncEnabled(false)
+
+
+
+{	
+	mSpeakerVolume = scale_speaker_volume(0);
+
+	mVoiceVersion.serverVersion = "";
+	mVoiceVersion.serverType = VOICE_SERVER_TYPE;
+	
+	//  gMuteListp isn't set up at this point, so we defer this until later.
+//	gMuteListp->addObserver(&mutelist_listener);
+	
+	
+#if LL_DARWIN || LL_LINUX || LL_SOLARIS
+		// HACK: THIS DOES NOT BELONG HERE
+		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
+		// This should cause us to ignore SIGPIPE and handle the error through proper channels.
+		// This should really be set up elsewhere.  Where should it go?
+		signal(SIGPIPE, SIG_IGN);
+		
+		// Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
+		// Ignoring SIGCHLD should prevent zombies from being created.  Alternately, we could use wait(), but I'd rather not do that.
+		signal(SIGCHLD, SIG_IGN);
+#endif
+
+	// set up state machine
+	setState(stateDisabled);
+	
+	gIdleCallbacks.addFunction(idle, this);
+}
+
+//---------------------------------------------------
+
+LLVivoxVoiceClient::~LLVivoxVoiceClient()
+{
+}
+
+//----------------------------------------------
+
+void LLVivoxVoiceClient::init(LLPumpIO *pump)
+{
+	// constructor will set up LLVoiceClient::getInstance()
+	LLVivoxVoiceClient::getInstance()->mPump = pump;
+}
+
+void LLVivoxVoiceClient::terminate()
+{
+
+//	leaveAudioSession();
+	logout();
+	// As of SDK version 4885, this should no longer be necessary.  It will linger after the socket close if it needs to.
+	// ms_sleep(2000);
+	connectorShutdown();
+	closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
+	
+	// This will do unpleasant things on windows.
+//	killGateway();
+	
+
+
+}
+
+const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
+{
+	return mVoiceVersion;
+}
+
+//---------------------------------------------------
+
+void LLVivoxVoiceClient::updateSettings()
+{
+	setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
+	setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
+	std::string keyString = gSavedSettings.getString("PushToTalkButton");
+	setPTTKey(keyString);
+	setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
+	setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
+
+	std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+	setCaptureDevice(inputDevice);
+	std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+	setRenderDevice(outputDevice);
+	F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
+	setMicGain(mic_level);
+	setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
+}
+
+/////////////////////////////
+// utility functions
+
+bool LLVivoxVoiceClient::writeString(const std::string &str)
+{
+	bool result = false;
+	if(mConnected)
+	{
+		apr_status_t err;
+		apr_size_t size = (apr_size_t)str.size();
+		apr_size_t written = size;
+	
+		//MARK: Turn this on to log outgoing XML
+//		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
+
+		// check return code - sockets will fail (broken, etc.)
+		err = apr_socket_send(
+				mSocket->getSocket(),
+				(const char*)str.data(),
+				&written);
+		
+		if(err == 0)
+		{
+			// Success.
+			result = true;
+		}
+		// TODO: handle partial writes (written is number of bytes written)
+		// Need to set socket to non-blocking before this will work.
+//		else if(APR_STATUS_IS_EAGAIN(err))
+//		{
+//			// 
+//		}
+		else
+		{
+			// Assume any socket error means something bad.  For now, just close the socket.
+			char buf[MAX_STRING];
+			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+			daemonDied();
+		}
+	}
+		
+	return result;
+}
+
+
+/////////////////////////////
+// session control messages
+void LLVivoxVoiceClient::connectorCreate()
+{
+	std::ostringstream stream;
+	std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+	std::string loglevel = "0";
+	
+	// Transition to stateConnectorStarted when the connector handle comes back.
+	setState(stateConnectorStarting);
+
+	std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
+		
+	if(savedLogLevel != "-1")
+	{
+		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
+		loglevel = "10";
+	}
+	
+	stream 
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
+		<< "<ClientName>V2 SDK</ClientName>"
+		<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
+		<< "<Mode>Normal</Mode>"
+		<< "<Logging>"
+			<< "<Folder>" << logpath << "</Folder>"
+			<< "<FileNamePrefix>Connector</FileNamePrefix>"
+			<< "<FileNameSuffix>.log</FileNameSuffix>"
+			<< "<LogLevel>" << loglevel << "</LogLevel>"
+		<< "</Logging>"
+		<< "<Application>SecondLifeViewer.1</Application>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::connectorShutdown()
+{
+	setState(stateConnectorStopping);
+	
+	if(!mConnectorHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mConnectorHandle.clear();
+		
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
+{
+
+	mAccountDisplayName = user_id;
+
+	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
+
+	mAccountName = nameFromID(agentID);
+}
+
+void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries)
+{
+	if ( gAgent.getRegion() && mVoiceEnabled )
+	{
+		std::string url = 
+			gAgent.getRegion()->getCapability(
+				"ProvisionVoiceAccountRequest");
+
+		if ( url == "" ) return;
+
+		LLHTTPClient::post(
+			url,
+			LLSD(),
+			new LLVivoxVoiceAccountProvisionResponder(retries));
+	}
+}
+
+void LLVivoxVoiceClient::login(
+	const std::string& account_name,
+	const std::string& password,
+	const std::string& voice_sip_uri_hostname,
+	const std::string& voice_account_server_uri)
+{
+	mVoiceSIPURIHostName = voice_sip_uri_hostname;
+	mVoiceAccountServerURI = voice_account_server_uri;
+
+	if(!mAccountHandle.empty())
+	{
+		// Already logged in.
+		LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
+		
+		// Don't process another login.
+		return;
+	}
+	else if ( account_name != mAccountName )
+	{
+		//TODO: error?
+		LL_WARNS("Voice") << "Wrong account name! " << account_name
+				<< " instead of " << mAccountName << LL_ENDL;
+	}
+	else
+	{
+		mAccountPassword = password;
+	}
+
+	std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
+	
+	if( !debugSIPURIHostName.empty() )
+	{
+		mVoiceSIPURIHostName = debugSIPURIHostName;
+	}
+	
+	if( mVoiceSIPURIHostName.empty() )
+	{
+		// we have an empty account server name
+		// so we fall back to hardcoded defaults
+
+		if(LLGridManager::getInstance()->isInProductionGrid())
+		{
+			// Use the release account server
+			mVoiceSIPURIHostName = "bhr.vivox.com";
+		}
+		else
+		{
+			// Use the development account server
+			mVoiceSIPURIHostName = "bhd.vivox.com";
+		}
+	}
+	
+	std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
+
+	if( !debugAccountServerURI.empty() )
+	{
+		mVoiceAccountServerURI = debugAccountServerURI;
+	}
+	
+	if( mVoiceAccountServerURI.empty() )
+	{
+		// If the account server URI isn't specified, construct it from the SIP URI hostname
+		mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";		
+	}
+}
+
+void LLVivoxVoiceClient::idle(void* user_data)
+{
+	LLVivoxVoiceClient* self = (LLVivoxVoiceClient*)user_data;
+	self->stateMachine();
+}
+
+std::string LLVivoxVoiceClient::state2string(LLVivoxVoiceClient::state inState)
+{
+	std::string result = "UNKNOWN";
+	
+		// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
+
+	switch(inState)
+	{
+		CASE(stateDisableCleanup);
+		CASE(stateDisabled);
+		CASE(stateStart);
+		CASE(stateDaemonLaunched);
+		CASE(stateConnecting);
+		CASE(stateConnected);
+		CASE(stateIdle);
+		CASE(stateMicTuningStart);
+		CASE(stateMicTuningRunning);
+		CASE(stateMicTuningStop);
+		CASE(stateConnectorStart);
+		CASE(stateConnectorStarting);
+		CASE(stateConnectorStarted);
+		CASE(stateLoginRetry);
+		CASE(stateLoginRetryWait);
+		CASE(stateNeedsLogin);
+		CASE(stateLoggingIn);
+		CASE(stateLoggedIn);
+		CASE(stateCreatingSessionGroup);
+		CASE(stateNoChannel);
+		CASE(stateJoiningSession);
+		CASE(stateSessionJoined);
+		CASE(stateRunning);
+		CASE(stateLeavingSession);
+		CASE(stateSessionTerminated);
+		CASE(stateLoggingOut);
+		CASE(stateLoggedOut);
+		CASE(stateConnectorStopping);
+		CASE(stateConnectorStopped);
+		CASE(stateConnectorFailed);
+		CASE(stateConnectorFailedWaiting);
+		CASE(stateLoginFailed);
+		CASE(stateLoginFailedWaiting);
+		CASE(stateJoinSessionFailed);
+		CASE(stateJoinSessionFailedWaiting);
+		CASE(stateJail);
+	}
+
+#undef CASE
+	
+	return result;
+}
+
+
+
+void LLVivoxVoiceClient::setState(state inState)
+{
+	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
+	
+	mState = inState;
+}
+
+void LLVivoxVoiceClient::stateMachine()
+{
+	if(gDisconnected)
+	{
+		// The viewer has been disconnected from the sim.  Disable voice.
+		setVoiceEnabled(false);
+	}
+	
+	if(mVoiceEnabled)
+	{
+		updatePosition();
+	}
+	else if(mTuningMode)
+	{
+		// Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
+	}
+	else
+	{
+		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
+		{
+			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
+			if(!mConnected)
+			{
+				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
+				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
+				killGateway();
+			}
+			
+			logout();
+			connectorShutdown();
+			
+			setState(stateDisableCleanup);
+		}
+	}
+	
+	// Check for parcel boundary crossing
+	{
+		LLViewerRegion *region = gAgent.getRegion();
+		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+		
+		if(region && parcel)
+		{
+			S32 parcelLocalID = parcel->getLocalID();
+			std::string regionName = region->getName();
+			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
+		
+//			LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
+
+			// The region name starts out empty and gets filled in later.  
+			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
+			// If either is empty, wait for the next time around.
+			if(!regionName.empty())
+			{
+				if(!capURI.empty())
+				{
+					if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
+					{
+						// We have changed parcels.  Initiate a parcel channel lookup.
+						mCurrentParcelLocalID = parcelLocalID;
+						mCurrentRegionName = regionName;
+						
+						parcelChanged();
+					}
+				}
+				else
+				{
+					LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability.  This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
+				}
+			}
+		}
+	}
+
+	switch(getState())
+	{
+		//MARK: stateDisableCleanup
+		case stateDisableCleanup:
+			// Clean up and reset everything. 
+			closeSocket();
+			deleteAllSessions();
+			deleteAllBuddies();		
+			
+			mConnectorHandle.clear();
+			mAccountHandle.clear();
+			mAccountPassword.clear();
+			mVoiceAccountServerURI.clear();
+			
+			setState(stateDisabled);	
+		break;
+		
+		//MARK: stateDisabled
+		case stateDisabled:
+			if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
+			{
+				setState(stateStart);
+			}
+		break;
+		
+		//MARK: stateStart
+		case stateStart:
+			if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
+			{
+				// Voice is locked out, we must not launch the vivox daemon.
+				setState(stateJail);
+			}
+			else if(!isGatewayRunning())
+			{
+				if(true)
+				{
+					// Launch the voice daemon
+					
+					// *FIX:Mani - Using the executable dir instead 
+					// of mAppRODataDir, the working directory from which the app
+					// is launched.
+					//std::string exe_path = gDirUtilp->getAppRODataDir();
+					std::string exe_path = gDirUtilp->getExecutableDir();
+					exe_path += gDirUtilp->getDirDelimiter();
+#if LL_WINDOWS
+					exe_path += "SLVoice.exe";
+#elif LL_DARWIN
+					exe_path += "../Resources/SLVoice";
+#else
+					exe_path += "SLVoice";
+#endif
+					// See if the vivox executable exists
+					llstat s;
+					if(!LLFile::stat(exe_path, &s))
+					{
+						// vivox executable exists.  Build the command line and launch the daemon.
+						// SLIM SDK: these arguments are no longer necessary.
+//						std::string args = " -p tcp -h -c";
+						std::string args;
+						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
+						
+						if(loglevel.empty())
+						{
+							loglevel = "-1";	// turn logging off completely
+						}
+						
+						args += " -ll ";
+						args += loglevel;
+						
+						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
+
+#if LL_WINDOWS
+						PROCESS_INFORMATION pinfo;
+						STARTUPINFOW sinfo;
+						
+						memset(&sinfo, 0, sizeof(sinfo));
+						
+						std::string exe_dir = gDirUtilp->getExecutableDir();
+						
+						llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
+						llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
+						llutf16string args16 = utf8str_to_utf16str(args);
+						// Create a writeable copy to keep Windows happy.                               
+						U16 *argscpy_16 = new U16[args16.size() + 1];
+						wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
+
+						if(!CreateProcessW(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo))
+						{
+//							DWORD dwErr = GetLastError();
+						}
+						else
+						{
+							// foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
+							// CloseHandle(pinfo.hProcess); // stops leaks - nothing else
+							sGatewayHandle = pinfo.hProcess;
+							CloseHandle(pinfo.hThread); // stops leaks - nothing else
+						}		
+						
+						delete[] argscpy_16;
+#else	// LL_WINDOWS
+						// This should be the same for mac and linux
+						{
+							std::vector<std::string> arglist;
+							arglist.push_back(exe_path);
+							
+							// Split the argument string into separate strings for each argument
+							typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+							boost::char_separator<char> sep(" ");
+							tokenizer tokens(args, sep);
+							tokenizer::iterator token_iter;
+
+							for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+							{
+								arglist.push_back(*token_iter);
+							}
+							
+							// create an argv vector for the child process
+							char **fakeargv = new char*[arglist.size() + 1];
+							int i;
+							for(i=0; i < arglist.size(); i++)
+								fakeargv[i] = const_cast<char*>(arglist[i].c_str());
+
+							fakeargv[i] = NULL;
+							
+							fflush(NULL); // flush all buffers before the child inherits them
+							pid_t id = vfork();
+							if(id == 0)
+							{
+								// child
+								execv(exe_path.c_str(), fakeargv);
+								
+								// If we reach this point, the exec failed.
+								// Use _exit() instead of exit() per the vfork man page.
+								_exit(0);
+							}
+
+							// parent
+							delete[] fakeargv;
+							sGatewayPID = id;
+						}
+#endif	// LL_WINDOWS
+						mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort"));
+					}	
+					else
+					{
+						LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
+					}	
+				}
+				else
+				{		
+					// SLIM SDK: port changed from 44124 to 44125.
+					// We can connect to a client gateway running on another host.  This is useful for testing.
+					// To do this, launch the gateway on a nearby host like this:
+					//  vivox-gw.exe -p tcp -i 0.0.0.0:44125
+					// and put that host's IP address here.
+					mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost"), gSavedSettings.getU32("VivoxVoicePort"));
+				}
+
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				setState(stateDaemonLaunched);
+				
+				// Dirty the states we'll need to sync with the daemon when it comes up.
+				mPTTDirty = true;
+				mMicVolumeDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpeakerMuteDirty = true;
+				// These only need to be set if they're not default (i.e. empty string).
+				mCaptureDeviceDirty = !mCaptureDevice.empty();
+				mRenderDeviceDirty = !mRenderDevice.empty();
+				
+				mMainSessionGroupHandle.clear();
+			}
+		break;
+
+		//MARK: stateDaemonLaunched
+		case stateDaemonLaunched:
+			if(mUpdateTimer.hasExpired())
+			{
+				LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL;
+
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				if(!mSocket)
+				{
+					mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);	
+				}
+				
+				mConnected = mSocket->blockingConnect(mDaemonHost);
+				if(mConnected)
+				{
+					setState(stateConnecting);
+				}
+				else
+				{
+					// If the connect failed, the socket may have been put into a bad state.  Delete it.
+					closeSocket();
+				}
+			}
+		break;
+
+		//MARK: stateConnecting
+		case stateConnecting:
+		// Can't do this until we have the pump available.
+		if(mPump)
+		{
+			// MBW -- Note to self: pumps and pipes examples in
+			//  indra/test/io.cpp
+			//  indra/test/llpipeutil.{cpp|h}
+
+			// Attach the pumps and pipes
+				
+			LLPumpIO::chain_t readChain;
+
+			readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
+			readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
+
+			mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
+
+			setState(stateConnected);
+		}
+
+		break;
+		
+		//MARK: stateConnected
+		case stateConnected:
+			// Initial devices query
+			getCaptureDevicesSendMessage();
+			getRenderDevicesSendMessage();
+
+			mLoginRetryCount = 0;
+
+			setState(stateIdle);
+		break;
+
+		//MARK: stateIdle
+		case stateIdle:
+			// This is the idle state where we're connected to the daemon but haven't set up a connector yet.
+			if(mTuningMode)
+			{
+				mTuningExitState = stateIdle;
+				setState(stateMicTuningStart);
+			}
+			else if(!mVoiceEnabled)
+			{
+				// We never started up the connector.  This will shut down the daemon.
+				setState(stateConnectorStopped);
+			}
+			else if(!mAccountName.empty())
+			{
+				LLViewerRegion *region = gAgent.getRegion();
+				
+				if(region)
+				{
+					if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
+					{
+						if ( mAccountPassword.empty() )
+						{
+							requestVoiceAccountProvision();
+						}
+						setState(stateConnectorStart);
+					}
+					else
+					{
+						LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
+					}
+				}
+			}
+		break;
+
+		//MARK: stateMicTuningStart
+		case stateMicTuningStart:
+			if(mUpdateTimer.hasExpired())
+			{
+				if(mCaptureDeviceDirty || mRenderDeviceDirty)
+				{
+					// These can't be changed while in tuning mode.  Set them before starting.
+					std::ostringstream stream;
+					
+					buildSetCaptureDevice(stream);
+					buildSetRenderDevice(stream);
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}				
+
+					// This will come around again in the same state and start the capture, after the timer expires.
+					mUpdateTimer.start();
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+				}
+				else
+				{
+					// duration parameter is currently unused, per Mike S.
+					tuningCaptureStartSendMessage(10000);
+
+					setState(stateMicTuningRunning);
+				}
+			}
+			
+		break;
+		
+		//MARK: stateMicTuningRunning
+		case stateMicTuningRunning:
+			if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
+			{
+				// All of these conditions make us leave tuning mode.
+				setState(stateMicTuningStop);
+			}
+			else
+			{
+				// process mic/speaker volume changes
+				if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
+				{
+					std::ostringstream stream;
+					
+					if(mTuningMicVolumeDirty)
+					{
+						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
+						<< "<Level>" << mTuningMicVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					if(mTuningSpeakerVolumeDirty)
+					{
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
+						<< "<Level>" << mTuningSpeakerVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					mTuningMicVolumeDirty = false;
+					mTuningSpeakerVolumeDirty = false;
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateMicTuningStop
+		case stateMicTuningStop:
+		{
+			// transition out of mic tuning
+			tuningCaptureStopSendMessage();
+			
+			setState(mTuningExitState);
+			
+			// if we exited just to change devices, this will keep us from re-entering too fast.
+			mUpdateTimer.start();
+			mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+			
+		}
+		break;
+												
+		//MARK: stateConnectorStart
+		case stateConnectorStart:
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else if(!mVoiceAccountServerURI.empty())
+			{
+				connectorCreate();
+			}
+		break;
+		
+		//MARK: stateConnectorStarting
+		case stateConnectorStarting:	// waiting for connector handle
+			// connectorCreateResponse() will transition from here to stateConnectorStarted.
+		break;
+		
+		//MARK: stateConnectorStarted
+		case stateConnectorStarted:		// connector handle received
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else
+			{
+				// The connector is started.  Send a login message.
+				setState(stateNeedsLogin);
+			}
+		break;
+				
+		//MARK: stateLoginRetry
+		case stateLoginRetry:
+			if(mLoginRetryCount == 0)
+			{
+				// First retry -- display a message to the user
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
+			}
+			
+			mLoginRetryCount++;
+			
+			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
+			{
+				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
+				setState(stateLoginFailed);
+				LLSD args;
+				std::stringstream errs;
+				errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
+				args["HOSTID"] = errs.str();
+				if (LLGridManager::getInstance()->isSystemGrid())
+				{
+					LLNotificationsUtil::add("NoVoiceConnect", args);	
+				}
+				else
+				{
+					LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);	
+				}				
+			}
+			else
+			{
+				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
+				setState(stateLoginRetryWait);
+			}
+		break;
+		
+		//MARK: stateLoginRetryWait
+		case stateLoginRetryWait:
+			if(mUpdateTimer.hasExpired())
+			{
+				setState(stateNeedsLogin);
+			}
+		break;
+		
+		//MARK: stateNeedsLogin
+		case stateNeedsLogin:
+			if(!mAccountPassword.empty())
+			{
+				setState(stateLoggingIn);
+				loginSendMessage();
+			}		
+		break;
+		
+		//MARK: stateLoggingIn
+		case stateLoggingIn:			// waiting for account handle
+			// loginResponse() will transition from here to stateLoggedIn.
+		break;
+		
+		//MARK: stateLoggedIn
+		case stateLoggedIn:				// account handle received
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
+
+			// request the current set of block rules (we'll need them when updating the friends list)
+			accountListBlockRulesSendMessage();
+			
+			// request the current set of auto-accept rules
+			accountListAutoAcceptRulesSendMessage();
+			
+			// Set up the mute list observer if it hasn't been set up already.
+			if((!sMuteListListener_listening))
+			{
+				LLMuteList::getInstance()->addObserver(&mutelist_listener);
+				sMuteListListener_listening = true;
+			}
+
+			// Set up the friends list observer if it hasn't been set up already.
+			if(friendslist_listener == NULL)
+			{
+				friendslist_listener = new LLVivoxVoiceClientFriendsObserver;
+				LLAvatarTracker::instance().addObserver(friendslist_listener);
+			}
+			
+			// Set the initial state of mic mute, local speaker volume, etc.
+			{
+				std::ostringstream stream;
+				
+				buildLocalAudioUpdates(stream);
+				
+				if(!stream.str().empty())
+				{
+					writeString(stream.str());
+				}
+			}
+			
+#if USE_SESSION_GROUPS			
+			// create the main session group
+			sessionGroupCreateSendMessage();
+			
+			setState(stateCreatingSessionGroup);
+#else
+			// Not using session groups -- skip the stateCreatingSessionGroup state.
+			setState(stateNoChannel);
+
+			// Initial kick-off of channel lookup logic
+			parcelChanged();		
+#endif
+		break;
+		
+		//MARK: stateCreatingSessionGroup
+		case stateCreatingSessionGroup:
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// *TODO: Question: is this the right way out of this state
+				setState(stateSessionTerminated);
+			}
+			else if(!mMainSessionGroupHandle.empty())
+			{
+				setState(stateNoChannel);
+				
+				// Start looped recording (needed for "panic button" anti-griefing tool)
+				recordingLoopStart();
+
+				// Initial kick-off of channel lookup logic
+				parcelChanged();		
+			}
+		break;
+					
+		//MARK: stateNoChannel
+		case stateNoChannel:
+			
+			LL_DEBUGS("Voice") << "State No Channel" << LL_ENDL;
+			// Do this here as well as inside sendPositionalUpdate().  
+			// Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
+			sendFriendsListUpdates();
+			
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// TODO: Question: Is this the right way out of this state?
+				setState(stateSessionTerminated);
+			}
+			else if(mTuningMode)
+			{
+				mTuningExitState = stateNoChannel;
+				setState(stateMicTuningStart);
+			}
+			else if(sessionNeedsRelog(mNextAudioSession))
+			{
+				requestRelog();
+				setState(stateSessionTerminated);
+			}
+			else if(mNextAudioSession)
+			{				
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = mNextAudioSession;
+				if(!mAudioSession->mReconnect)	
+				{
+					mNextAudioSession = NULL;
+				}
+				
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+				
+				if(!mAudioSession->mHandle.empty())
+				{
+					// Connect to a session by session handle
+
+					sessionMediaConnectSendMessage(mAudioSession);
+				}
+				else
+				{
+					// Connect to a session by URI
+					sessionCreateSendMessage(mAudioSession, true, false);
+				}
+
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
+				setState(stateJoiningSession);
+			}
+			else if(!mSpatialSessionURI.empty())
+			{
+				// If we're not headed elsewhere and have a spatial URI, return to spatial.
+				switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+			}
+		break;
+
+		//MARK: stateJoiningSession
+		case stateJoiningSession:		// waiting for session handle
+			// joinedAudioSession() will transition from here to stateSessionJoined.
+			if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				if(mAudioSession && !mAudioSession->mHandle.empty())
+				{
+					// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+					// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+					if(mAudioSession->mIsP2P)
+					{
+						sessionMediaDisconnectSendMessage(mAudioSession);
+						setState(stateSessionTerminated);
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateSessionJoined
+		case stateSessionJoined:		// session handle received
+			// It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
+			// before continuing from this state.  They can happen in either order, and if I don't wait for both, things can get stuck.
+			// For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
+			// This is a cheap way to make sure both have happened before proceeding.
+			if(mAudioSession && mAudioSession->mVoiceEnabled)
+			{
+				// Dirty state that may need to be sync'ed with the daemon.
+				mPTTDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpatialCoordsDirty = true;
+				
+				setState(stateRunning);
+				
+				// Start the throttle timer
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+
+				// Events that need to happen when a session is joined could go here.
+				// Maybe send initial spatial data?
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
+
+			}
+			else if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+				// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+				if(mAudioSession && mAudioSession->mIsP2P)
+				{
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateSessionTerminated);
+				}
+			}
+		break;
+		
+		//MARK: stateRunning
+		case stateRunning:				// steady state
+			// Disabling voice or disconnect requested.
+			if(!mVoiceEnabled || mSessionTerminateRequested)
+			{
+				leaveAudioSession();
+			}
+			else
+			{
+				
+				// Figure out whether the PTT state needs to change
+				{
+					bool newPTT;
+					if(mUsePTT)
+					{
+						// If configured to use PTT, track the user state.
+						newPTT = mUserPTTState;
+					}
+					else
+					{
+						// If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
+						newPTT = true;
+					}
+					
+					if(mMuteMic)
+					{
+						// This always overrides any other PTT setting.
+						newPTT = false;
+					}
+					
+					// Dirty if state changed.
+					if(newPTT != mPTT)
+					{
+						mPTT = newPTT;
+						mPTTDirty = true;
+					}
+				}
+				
+				if(!inSpatialChannel())
+				{
+					// When in a non-spatial channel, never send positional updates.
+					mSpatialCoordsDirty = false;
+				}
+				else
+				{
+					// Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
+					enforceTether();
+				}
+				
+				// Send an update if the ptt state has changed (which shouldn't be able to happen that often -- the user can only click so fast)
+				// or every 10hz, whichever is sooner.
+				if((mAudioSession && mAudioSession->mVolumeDirty) || mPTTDirty || mSpeakerVolumeDirty || mUpdateTimer.hasExpired())
+				{
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+					sendPositionalUpdate();
+				}
+			}
+		break;
+		
+		//MARK: stateLeavingSession
+		case stateLeavingSession:		// waiting for terminate session response
+			// The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
+		break;
+
+		//MARK: stateSessionTerminated
+		case stateSessionTerminated:
+			
+			// Must do this first, since it uses mAudioSession.
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
+			
+			if(mAudioSession)
+			{
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = NULL;
+				// We just notified status observers about this change.  Don't do it again.
+				mAudioSessionChanged = false;
+
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
+			}
+	
+			// Always reset the terminate request flag when we get here.
+			mSessionTerminateRequested = false;
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{				
+				// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
+				setState(stateNoChannel);
+			}
+			else
+			{
+				// Shutting down voice, continue with disconnecting.
+				logout();
+				
+				// The state machine will take it from here
+				mRelogRequested = false;
+			}
+			
+		break;
+		
+		//MARK: stateLoggingOut
+		case stateLoggingOut:			// waiting for logout response
+			// The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
+		break;
+		
+		//MARK: stateLoggedOut
+		case stateLoggedOut:			// logout response received
+			
+			// Once we're logged out, all these things are invalid.
+			mAccountHandle.clear();
+			deleteAllSessions();
+			deleteAllBuddies();
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{
+				// User was logged out, but wants to be logged in.  Send a new login request.
+				setState(stateNeedsLogin);
+			}
+			else
+			{
+				// shut down the connector
+				connectorShutdown();
+			}
+		break;
+		
+		//MARK: stateConnectorStopping
+		case stateConnectorStopping:	// waiting for connector stop
+			// The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
+		break;
+
+		//MARK: stateConnectorStopped
+		case stateConnectorStopped:		// connector stop received
+			setState(stateDisableCleanup);
+		break;
+
+		//MARK: stateConnectorFailed
+		case stateConnectorFailed:
+			setState(stateConnectorFailedWaiting);
+		break;
+		//MARK: stateConnectorFailedWaiting
+		case stateConnectorFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateLoginFailed
+		case stateLoginFailed:
+			setState(stateLoginFailedWaiting);
+		break;
+		//MARK: stateLoginFailedWaiting
+		case stateLoginFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateJoinSessionFailed
+		case stateJoinSessionFailed:
+			// Transition to error state.  Send out any notifications here.
+			if(mAudioSession)
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
+			}
+			
+			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
+			setState(stateJoinSessionFailedWaiting);
+		break;
+		
+		//MARK: stateJoinSessionFailedWaiting
+		case stateJoinSessionFailedWaiting:
+			// Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
+			// Region crossings may leave this state and try the join again.
+			if(mSessionTerminateRequested)
+			{
+				setState(stateSessionTerminated);
+			}
+		break;
+		
+		//MARK: stateJail
+		case stateJail:
+			// We have given up.  Do nothing.
+		break;
+
+	}
+	
+	if(mAudioSession && mAudioSession->mParticipantsChanged)
+	{
+		mAudioSession->mParticipantsChanged = false;
+		mAudioSessionChanged = true;
+	}
+	
+	if(mAudioSessionChanged)
+	{
+		mAudioSessionChanged = false;
+		notifyParticipantObservers();
+	}
+}
+
+void LLVivoxVoiceClient::closeSocket(void)
+{
+	mSocket.reset();
+	mConnected = false;	
+}
+
+void LLVivoxVoiceClient::loginSendMessage()
+{
+	std::ostringstream stream;
+
+	bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
+
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
+		<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "<AccountName>" << mAccountName << "</AccountName>"
+		<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
+		<< "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
+		<< "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
+		<< "<BuddyManagementMode>Application</BuddyManagementMode>"
+		<< "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
+		<< (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::logout()
+{
+	// Ensure that we'll re-request provisioning before logging in again
+	mAccountPassword.clear();
+	mVoiceAccountServerURI.clear();
+	
+	setState(stateLoggingOut);
+	logoutSendMessage();
+}
+
+void LLVivoxVoiceClient::logoutSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		mAccountHandle.clear();
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::accountListBlockRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::accountListAutoAcceptRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::sessionGroupCreateSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+			<< "<Type>Normal</Type>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
+		<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>";
+
+	static const std::string allowed_chars =
+				"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+				"0123456789"
+				"-._~";
+
+	if(!session->mHash.empty())
+	{
+		stream
+			<< "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
+			<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
+	}
+	
+	stream
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Name>" << mChannelName << "</Name>"
+	<< "</Request>\n\n\n";
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+	
+	std::string password;
+	if(!session->mHash.empty())
+	{
+		static const std::string allowed_chars =
+					"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+					"0123456789"
+					"-._~"
+					;
+		password = LLURI::escape(session->mHash, allowed_chars);
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>"
+		<< "<Name>" << mChannelName << "</Name>"
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Password>" << password << "</Password>"
+		<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
+	<< "</Request>\n\n\n"
+	;
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
+
+	session->mMediaConnectInProgress = true;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionTextConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionTerminate()
+{
+	mSessionTerminateRequested = true;
+}
+
+void LLVivoxVoiceClient::requestRelog()
+{
+	mSessionTerminateRequested = true;
+	mRelogRequested = true;
+}
+
+
+void LLVivoxVoiceClient::leaveAudioSession()
+{
+	if(mAudioSession)
+	{
+		LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
+
+		switch(getState())
+		{
+			case stateNoChannel:
+				// In this case, we want to pretend the join failed so our state machine doesn't get stuck.
+				// Skip the join failed transition state so we don't send out error notifications.
+				setState(stateJoinSessionFailedWaiting);
+			break;
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+				if(!mAudioSession->mHandle.empty())
+				{
+
+#if RECORD_EVERYTHING
+					// HACK: for testing only
+					// Save looped recording
+					std::string savepath("/tmp/vivoxrecording");
+					{
+						time_t now = time(NULL);
+						const size_t BUF_SIZE = 64;
+						char time_str[BUF_SIZE];	/* Flawfinder: ignore */
+						
+						strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
+						savepath += time_str;
+					}
+					recordingLoopSave(savepath);
+#endif
+
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateLeavingSession);
+				}
+				else
+				{
+					LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
+					setState(stateSessionTerminated);
+				}
+			break;
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				setState(stateSessionTerminated);
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
+			break;
+		}
+	}
+	else
+	{
+		LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
+		setState(stateSessionTerminated);
+	}
+}
+
+void LLVivoxVoiceClient::sessionTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+	
+}
+
+void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::getCaptureDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::getRenderDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::clearCaptureDevices()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mCaptureDevices.clear();
+}
+
+void LLVivoxVoiceClient::addCaptureDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+
+	mCaptureDevices.push_back(name);
+}
+
+LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
+{
+	return mCaptureDevices;
+}
+
+void LLVivoxVoiceClient::setCaptureDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mCaptureDevice.empty())
+		{
+			mCaptureDevice.clear();
+			mCaptureDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mCaptureDevice != name)
+		{
+			mCaptureDevice = name;
+			mCaptureDeviceDirty = true;	
+		}
+	}
+}
+
+void LLVivoxVoiceClient::clearRenderDevices()
+{	
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mRenderDevices.clear();
+}
+
+void LLVivoxVoiceClient::addRenderDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+	mRenderDevices.push_back(name);
+}
+
+LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
+{
+	return mRenderDevices;
+}
+
+void LLVivoxVoiceClient::setRenderDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mRenderDevice.empty())
+		{
+			mRenderDevice.clear();
+			mRenderDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mRenderDevice != name)
+		{
+			mRenderDevice = name;
+			mRenderDeviceDirty = true;	
+		}
+	}
+	
+}
+
+void LLVivoxVoiceClient::tuningStart()
+{
+	mTuningMode = true;
+	LL_DEBUGS("Voice") << "Starting tuning" << LL_ENDL;
+	if(getState() >= stateNoChannel)
+	{
+		LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
+		sessionTerminate();
+	}
+}
+
+void LLVivoxVoiceClient::tuningStop()
+{
+	mTuningMode = false;
+}
+
+bool LLVivoxVoiceClient::inTuningMode()
+{
+	bool result = false;
+	switch(getState())
+	{
+	case stateMicTuningRunning:
+		result = true;
+		break;
+	default:
+		break;
+	}
+	return result;
+}
+
+void LLVivoxVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
+{		
+	mTuningAudioFile = name;
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+    << "<Loop>" << (loop?"1":"0") << "</Loop>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningRenderStopSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int duration)
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
+    << "<Duration>" << duration << "</Duration>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVivoxVoiceClient::tuningCaptureStopSendMessage()
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+
+	mTuningEnergy = 0.0f;
+}
+
+void LLVivoxVoiceClient::tuningSetMicVolume(float volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+
+	if(scaled_volume != mTuningMicVolume)
+	{
+		mTuningMicVolume = scaled_volume;
+		mTuningMicVolumeDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::tuningSetSpeakerVolume(float volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mTuningSpeakerVolume)
+	{
+		mTuningSpeakerVolume = scaled_volume;
+		mTuningSpeakerVolumeDirty = true;
+	}
+}
+				
+float LLVivoxVoiceClient::tuningGetEnergy(void)
+{
+	return mTuningEnergy;
+}
+
+bool LLVivoxVoiceClient::deviceSettingsAvailable()
+{
+	bool result = true;
+	
+	if(!mConnected)
+		result = false;
+	
+	if(mRenderDevices.empty())
+		result = false;
+	
+	return result;
+}
+
+void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList)
+{
+	if(clearCurrentList)
+	{
+		clearCaptureDevices();
+		clearRenderDevices();
+	}
+	getCaptureDevicesSendMessage();
+	getRenderDevicesSendMessage();
+}
+
+void LLVivoxVoiceClient::daemonDied()
+{
+	// The daemon died, so the connection is gone.  Reset everything and start over.
+	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
+
+	// Try to relaunch the daemon
+	setState(stateDisableCleanup);
+}
+
+void LLVivoxVoiceClient::giveUp()
+{
+	// All has failed.  Clean up and stop trying.
+	closeSocket();
+	deleteAllSessions();
+	deleteAllBuddies();
+	
+	setState(stateJail);
+}
+
+static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
+{
+	F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the  new position and velocity
+	F64 npos[3];
+	
+	// The original XML command was sent like this:
+	/*
+			<< "<Position>"
+				<< "<X>" << pos[VX] << "</X>"
+				<< "<Y>" << pos[VZ] << "</Y>"
+				<< "<Z>" << pos[VY] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << mAvatarVelocity[VX] << "</X>"
+				<< "<Y>" << mAvatarVelocity[VZ] << "</Y>"
+				<< "<Z>" << mAvatarVelocity[VY] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << l.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VX] << "</Y>"
+				<< "<Z>" << a.mV[VX] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << l.mV[VZ] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VY] << "</X>"
+				<< "<Y>" << u.mV [VZ] << "</Y>"
+				<< "<Z>" << a.mV [VY] << "</Z>"
+			<< "</LeftOrientation>";
+	*/
+
+#if 1
+	// This was the original transform done when building the XML command
+	nat[0] = left.mV[VX];
+	nat[1] = up.mV[VX];
+	nat[2] = at.mV[VX];
+
+	nup[0] = left.mV[VZ];
+	nup[1] = up.mV[VY];
+	nup[2] = at.mV[VZ];
+
+	nl[0] = left.mV[VY];
+	nl[1] = up.mV[VZ];
+	nl[2] = at.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY];
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+	// This was the original transform done in the SDK
+	nat[0] = at.mV[2];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * left.mV[2];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = at.mV[0];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[0];
+
+	npos[2] = pos.mdV[2] * -1.0;
+	npos[1] = pos.mdV[1];
+	npos[0] = pos.mdV[0];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+#else
+	// This is the compose of the two transforms (at least, that's what I'm trying for)
+	nat[0] = at.mV[VX];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * up.mV[VZ];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = left.mV[VX];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY] * -1.0;
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+#endif
+}
+
+void LLVivoxVoiceClient::sendPositionalUpdate(void)
+{	
+	std::ostringstream stream;
+	
+	if(mSpatialCoordsDirty)
+	{
+		LLVector3 l, u, a, vel;
+		LLVector3d pos;
+
+		mSpatialCoordsDirty = false;
+		
+		// Always send both speaker and listener positions together.
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"		
+			<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
+		
+		stream << "<SpeakerPosition>";
+
+//		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
+		l = mAvatarRot.getLeftRow();
+		u = mAvatarRot.getUpRow();
+		a = mAvatarRot.getFwdRow();
+		pos = mAvatarPosition;
+		vel = mAvatarVelocity;
+
+		// SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
+		// The old transform is replicated by this function.
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+		stream << "</SpeakerPosition>";
+
+		stream << "<ListenerPosition>";
+
+		LLVector3d	earPosition;
+		LLVector3	earVelocity;
+		LLMatrix3	earRot;
+		
+		switch(mEarLocation)
+		{
+			case earLocCamera:
+			default:
+				earPosition = mCameraPosition;
+				earVelocity = mCameraVelocity;
+				earRot = mCameraRot;
+			break;
+			
+			case earLocAvatar:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mAvatarRot;
+			break;
+			
+			case earLocMixed:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mCameraRot;
+			break;
+		}
+
+		l = earRot.getLeftRow();
+		u = earRot.getUpRow();
+		a = earRot.getFwdRow();
+		pos = earPosition;
+		vel = earVelocity;
+
+//		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
+		
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+
+		stream << "</ListenerPosition>";
+
+		stream << "</Request>\n\n\n";
+	}	
+	
+	if(mAudioSession && mAudioSession->mVolumeDirty)
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+		mAudioSession->mVolumeDirty = false;
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+			
+			if(p->mVolumeDirty)
+			{
+				// Can't set volume/mute for yourself
+				if(!p->mIsSelf)
+				{
+					int volume = 56; // nominal default value
+					bool mute = p->mOnMuteList;
+					
+					if(p->mUserVolume != -1)
+					{
+						// scale from user volume in the range 0-400 (with 100 as "normal") to vivox volume in the range 0-100 (with 56 as "normal")
+						if(p->mUserVolume < 100)
+							volume = (p->mUserVolume * 56) / 100;
+						else
+							volume = (((p->mUserVolume - 100) * (100 - 56)) / 300) + 56;
+					}
+					else if(p->mVolume != -1)
+					{
+						// Use the previously reported internal volume (comes in with a ParticipantUpdatedEvent)
+						volume = p->mVolume;
+					}
+										
+
+					if(mute)
+					{
+						// SetParticipantMuteForMe doesn't work in p2p sessions.
+						// If we want the user to be muted, set their volume to 0 as well.
+						// This isn't perfect, but it will at least reduce their volume to a minimum.
+						volume = 0;
+					}
+					
+					if(volume == 0)
+						mute = true;
+
+					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
+					
+					// SLIM SDK: Send both volume and mute commands.
+					
+					// Send a "volume for me" command for the user.
+					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
+						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+						<< "<Volume>" << volume << "</Volume>"
+						<< "</Request>\n\n\n";
+
+					// Send a "mute for me" command for the user
+					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
+						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+						<< "<Mute>" << (mute?"1":"0") << "</Mute>"
+						<< "</Request>\n\n\n";
+				}
+				
+				p->mVolumeDirty = false;
+			}
+		}
+	}
+			
+	buildLocalAudioUpdates(stream);
+	
+	if(!stream.str().empty())
+	{
+		writeString(stream.str());
+	}
+	
+	// Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
+	// Batching them all together can choke SLVoice, so send them in separate writes.
+	sendFriendsListUpdates();
+}
+
+void LLVivoxVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
+{
+	if(mCaptureDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
+	
+		stream 
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
+			<< "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mCaptureDeviceDirty = false;
+	}
+}
+
+void LLVivoxVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
+{
+	if(mRenderDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
+			<< "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		mRenderDeviceDirty = false;
+	}
+}
+
+void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
+{
+	buildSetCaptureDevice(stream);
+
+	buildSetRenderDevice(stream);
+
+	if(mPTTDirty)
+	{
+		mPTTDirty = false;
+
+		// Send a local mute command.
+		// NOTE that the state of "PTT" is the inverse of "local mute".
+		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
+		
+		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << (mPTT?"false":"true") << "</Value>"
+			<< "</Request>\n\n\n";
+		
+	}
+
+	if(mSpeakerMuteDirty)
+	{
+		const char *muteval = ((mSpeakerVolume == 0)?"true":"false");
+
+		mSpeakerMuteDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
+		
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << muteval << "</Value>"
+			<< "</Request>\n\n\n";	
+		
+	}
+	
+	if(mSpeakerVolumeDirty)
+	{
+		mSpeakerVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mSpeakerVolume << "</Value>"
+			<< "</Request>\n\n\n";
+			
+	}
+	
+	if(mMicVolumeDirty)
+	{
+		mMicVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mMicVolume << "</Value>"
+			<< "</Request>\n\n\n";				
+	}
+
+	
+}
+
+void LLVivoxVoiceClient::checkFriend(const LLUUID& id)
+{
+	std::string name;
+	buddyListEntry *buddy = findBuddy(id);
+
+	// Make sure we don't add a name before it's been looked up.
+	if(gCacheName->getFullName(id, name))
+	{
+
+		const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
+		bool canSeeMeOnline = false;
+		if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
+			canSeeMeOnline = true;
+		
+		// When we get here, mNeedsSend is true and mInSLFriends is false.  Change them as necessary.
+		
+		if(buddy)
+		{
+			// This buddy is already in both lists.
+
+			if(name != buddy->mDisplayName)
+			{
+				// The buddy is in the list with the wrong name.  Update it with the correct name.
+				LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
+				buddy->mDisplayName = name;
+				buddy->mNeedsNameUpdate = true;		// This will cause the buddy to be resent.
+			}
+		}
+		else
+		{
+			// This buddy was not in the vivox list, needs to be added.
+			buddy = addBuddy(sipURIFromID(id), name);
+			buddy->mUUID = id;
+		}
+		
+		// In all the above cases, the buddy is in the SL friends list (which is how we got here).
+		buddy->mInSLFriends = true;
+		buddy->mCanSeeMeOnline = canSeeMeOnline;
+		buddy->mNameResolved = true;
+		
+	}
+	else
+	{
+		// This name hasn't been looked up yet.  Don't do anything with this buddy list entry until it has.
+		if(buddy)
+		{
+			buddy->mNameResolved = false;
+		}
+		
+		// Initiate a lookup.
+		// The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
+		lookupName(id);
+	}
+}
+
+void LLVivoxVoiceClient::clearAllLists()
+{
+	// FOR TESTING ONLY
+	
+	// This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+	{
+		buddyListEntry *buddy = buddy_it->second;
+		buddy_it++;
+		
+		std::ostringstream stream;
+
+		if(buddy->mInVivoxBuddies)
+		{
+			// delete this entry from the vivox buddy list
+			buddy->mInVivoxBuddies = false;
+			LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "</Request>\n\n\n";		
+		}
+
+		if(buddy->mHasBlockListEntry)
+		{
+			// Delete the associated block list entry (so the block list doesn't fill up with junk)
+			buddy->mHasBlockListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+				<< "</Request>\n\n\n";								
+		}
+		if(buddy->mHasAutoAcceptListEntry)
+		{
+			// Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
+			buddy->mHasAutoAcceptListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+				<< "</Request>\n\n\n";
+		}
+
+		writeString(stream.str());
+
+	}
+}
+
+void LLVivoxVoiceClient::sendFriendsListUpdates()
+{
+	if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
+	{
+		mFriendsListDirty = false;
+		
+		if(0)
+		{
+			// FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
+			clearAllLists();
+			return;
+		}
+		
+		LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
+		
+		buddyListMap::iterator buddy_it;
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+		{
+			// reset the temp flags in the local buddy list
+			buddy_it->second->mInSLFriends = false;
+		}
+		
+		// correlate with the friends list
+		{
+			LLCollectAllBuddies collect;
+			LLAvatarTracker::instance().applyFunctor(collect);
+			LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
+			LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
+			
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+			it = collect.mOffline.begin();
+			end = collect.mOffline.end();
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+		}
+				
+		LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
+
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+		{
+			buddyListEntry *buddy = buddy_it->second;
+			buddy_it++;
+			
+			// Ignore entries that aren't resolved yet.
+			if(buddy->mNameResolved)
+			{
+				std::ostringstream stream;
+
+				if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
+				{					
+					if(mNumberOfAliases > 0)
+					{
+						// Add (or update) this entry in the vivox buddy list
+						buddy->mInVivoxBuddies = true;
+						buddy->mNeedsNameUpdate = false;
+						LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream 
+							<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+								<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
+								<< "<BuddyData></BuddyData>"	// Without this, SLVoice doesn't seem to parse the command.
+								<< "<GroupID>0</GroupID>"
+							<< "</Request>\n\n\n";	
+					}
+				}
+				else if(!buddy->mInSLFriends)
+				{
+					// This entry no longer exists in your SL friends list.  Remove all traces of it from the Vivox buddy list.
+ 					if(buddy->mInVivoxBuddies)
+					{
+						// delete this entry from the vivox buddy list
+						buddy->mInVivoxBuddies = false;
+						LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+							<< "</Request>\n\n\n";		
+					}
+
+					if(buddy->mHasBlockListEntry)
+					{
+						// Delete the associated block list entry, if any
+						buddy->mHasBlockListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+							<< "</Request>\n\n\n";								
+					}
+					if(buddy->mHasAutoAcceptListEntry)
+					{
+						// Delete the associated auto-accept list entry, if any
+						buddy->mHasAutoAcceptListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+							<< "</Request>\n\n\n";
+					}
+				}
+				
+				if(buddy->mInSLFriends)
+				{
+
+					if(buddy->mCanSeeMeOnline)
+					{
+						// Buddy should not be blocked.
+
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+						
+						// If the buddy has a block list entry, delete it.
+						if(buddy->mHasBlockListEntry)
+						{
+							buddy->mHasBlockListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+								<< "</Request>\n\n\n";		
+							
+							
+							// If we just deleted a block list entry, add an auto-accept entry.
+							if(!buddy->mHasAutoAcceptListEntry)
+							{
+								buddy->mHasAutoAcceptListEntry = true;								
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+									<< "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
+									<< "</Request>\n\n\n";
+							}
+						}
+					}
+					else
+					{
+						// Buddy should be blocked.
+						
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+
+						// If this buddy has an autoaccept entry, delete it
+						if(buddy->mHasAutoAcceptListEntry)
+						{
+							buddy->mHasAutoAcceptListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+								<< "</Request>\n\n\n";
+						
+							// If we just deleted an auto-accept entry, add a block list entry.
+							if(!buddy->mHasBlockListEntry)
+							{
+								buddy->mHasBlockListEntry = true;
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+									<< "<PresenceOnly>1</PresenceOnly>"
+									<< "</Request>\n\n\n";								
+							}
+						}
+					}
+
+					if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
+					{
+						// Delete this entry from the local buddy list.  This should NOT invalidate the iterator,
+						// since it has already been incremented to the next entry.
+						deleteBuddy(buddy->mURI);
+					}
+
+				}
+				writeString(stream.str());
+			}
+		}
+	}
+}
+
+/////////////////////////////
+// Response/Event handlers
+
+void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
+		setState(stateConnectorFailed);
+		LLSD args;
+		std::stringstream errs;
+		errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
+		args["HOSTID"] = errs.str();
+		if (LLGridManager::getInstance()->isSystemGrid())
+		{
+			LLNotificationsUtil::add("NoVoiceConnect", args);	
+		}
+		else
+		{
+			LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);	
+		}
+	}
+	else
+	{
+		// Connector created, move forward.
+		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
+		mVoiceVersion.serverVersion = versionID;
+		mConnectorHandle = connectorHandle;
+		if(getState() == stateConnectorStarting)
+		{
+			setState(stateConnectorStarted);
+		}
+	}
+}
+
+void LLVivoxVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
+{ 
+	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
+	
+	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
+	
+	if ( statusCode == 401 )
+	{
+		// Login failure which is probably caused by the delay after a user's password being updated.
+		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginRetry);
+	}
+	else if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginFailed);
+	}
+	else
+	{
+		// Login succeeded, move forward.
+		mAccountHandle = accountHandle;
+		mNumberOfAliases = numberOfAliases;
+		// This needs to wait until the AccountLoginStateChangeEvent is received.
+//		if(getState() == stateLoggingIn)
+//		{
+//			setState(stateLoggedIn);
+//		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
+{
+	sessionState *session = findSession(requestId);
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mMediaConnectInProgress = false;
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+				setState(stateJoinSessionFailed);
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+}
+
+void LLVivoxVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
+{
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+	
+	mConnected = false;
+	
+	if(getState() == stateConnectorStopping)
+	{
+		setState(stateConnectorStopped);
+	}
+}
+
+void LLVivoxVoiceClient::sessionAddedEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		bool isChannel, 
+		bool incoming,
+		std::string &nameString,
+		std::string &applicationString)
+{
+	sessionState *session = NULL;
+
+	LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
+	
+	session = addSession(uriString, sessionHandle);
+	if(session)
+	{
+		session->mGroupHandle = sessionGroupHandle;
+		session->mIsChannel = isChannel;
+		session->mIncoming = incoming;
+		session->mAlias = alias;
+			
+		// Generate a caller UUID -- don't need to do this for channels
+		if(!session->mIsChannel)
+		{
+			if(IDFromName(session->mSIPURI, session->mCallerID))
+			{
+				// Normal URI(base64-encoded UUID) 
+			}
+			else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
+			{
+				// Wrong URI, but an alias is available.  Stash the incoming URI as an alternate
+				session->mAlternateSIPURI = session->mSIPURI;
+				
+				// and generate a proper URI from the ID.
+				setSessionURI(session, sipURIFromID(session->mCallerID));
+			}
+			else
+			{
+				LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
+				setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
+				session->mSynthesizedCallerID = true;
+				
+				// Can't look up the name in this case -- we have to extract it from the URI.
+				std::string namePortion = nameFromsipURI(session->mSIPURI);
+				if(namePortion.empty())
+				{
+					// Didn't seem to be a SIP URI, just use the whole provided name.
+					namePortion = nameString;
+				}
+				
+				// Some incoming names may be separated with an underscore instead of a space.  Fix this.
+				LLStringUtil::replaceChar(namePortion, '_', ' ');
+				
+				// Act like we just finished resolving the name (this stores it in all the right places)
+				avatarNameResolved(session->mCallerID, namePortion);
+			}
+		
+			LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
+
+			if(!session->mSynthesizedCallerID)
+			{
+				// If we got here, we don't have a proper name.  Initiate a lookup.
+				lookupName(session->mCallerID);
+			}
+		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
+{
+	LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
+	
+#if USE_SESSION_GROUPS
+	if(mMainSessionGroupHandle.empty())
+	{
+		// This is the first (i.e. "main") session group.  Save its handle.
+		mMainSessionGroupHandle = sessionGroupHandle;
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
+	}
+#endif
+}
+
+void LLVivoxVoiceClient::joinedAudioSession(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "Joined Audio Session" << LL_ENDL;
+	if(mAudioSession != session)
+	{
+		sessionState *oldSession = mAudioSession;
+
+		mAudioSession = session;
+		mAudioSessionChanged = true;
+
+		// The old session may now need to be deleted.
+		reapSession(oldSession);
+	}
+	
+	// This is the session we're joining.
+	if(getState() == stateJoiningSession)
+	{
+		setState(stateSessionJoined);
+		
+		// SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
+		// Add the current user as a participant here.
+		participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
+		if(participant)
+		{
+			participant->mIsSelf = true;
+			lookupName(participant->mAvatarID);
+
+			LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+		}
+		
+		if(!session->mIsChannel)
+		{
+			// this is a p2p session.  Make sure the other end is added as a participant.
+			participantState *participant = session->addParticipant(session->mSIPURI);
+			if(participant)
+			{
+				if(participant->mAvatarIDValid)
+				{
+					lookupName(participant->mAvatarID);
+				}
+				else if(!session->mName.empty())
+				{
+					participant->mDisplayName = session->mName;
+					avatarNameResolved(participant->mAvatarID, session->mName);
+				}
+				
+				// TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
+				LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName 
+						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+			}
+		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionRemovedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle)
+{
+	LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		leftAudioSession(session);
+
+		// This message invalidates the session's handle.  Set it to empty.
+		setSessionHandle(session);
+		
+		// This also means that the session's session group is now empty.
+		// Terminate the session group so it doesn't leak.
+		sessionGroupTerminateSendMessage(session);
+		
+		// Reset the media state (we now have no info)
+		session->mMediaStreamState = streamStateUnknown;
+		session->mTextStreamState = streamStateUnknown;
+		
+		// Conditionally delete the session
+		reapSession(session);
+	}
+	else
+	{
+		LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::reapSession(sessionState *session)
+{
+	if(session)
+	{
+		if(!session->mHandle.empty())
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
+		}
+		else if(session->mCreateInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
+		}
+		else if(session->mMediaConnectInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
+		}
+		else if(session == mAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
+		}
+		else if(session == mNextAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
+		}
+		else
+		{
+			// TODO: Question: Should we check for queued text messages here?
+			// We don't have a reason to keep tracking this session, so just delete it.
+			LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
+			deleteSession(session);
+			session = NULL;
+		}	
+	}
+	else
+	{
+//		LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+	}
+}
+
+// Returns true if the session seems to indicate we've moved to a region on a different voice server
+bool LLVivoxVoiceClient::sessionNeedsRelog(sessionState *session)
+{
+	bool result = false;
+	
+	if(session != NULL)
+	{
+		// Only make this check for spatial channels (so it won't happen for group or p2p calls)
+		if(session->mIsSpatial)
+		{	
+			std::string::size_type atsign;
+			
+			atsign = session->mSIPURI.find("@");
+			
+			if(atsign != std::string::npos)
+			{
+				std::string urihost = session->mSIPURI.substr(atsign + 1);
+				if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
+				{
+					// The hostname in this URI is different from what we expect.  This probably means we need to relog.
+					
+					// We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
+					// mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
+					
+					result = true;
+				}
+			}
+		}
+	}
+	
+	return result;
+}
+
+void LLVivoxVoiceClient::leftAudioSession(
+	sessionState *session)
+{
+	if(mAudioSession == session)
+	{
+		switch(getState())
+		{
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+			case stateLeavingSession:
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				// normal transition
+				LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+			
+			case stateSessionTerminated:
+				// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
+				LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+		}
+	}
+}
+
+void LLVivoxVoiceClient::accountLoginStateChangeEvent(
+		std::string &accountHandle, 
+		int statusCode, 
+		std::string &statusString, 
+		int state)
+{
+	/*
+		According to Mike S., status codes for this event are:
+		login_state_logged_out=0,
+        login_state_logged_in = 1,
+        login_state_logging_in = 2,
+        login_state_logging_out = 3,
+        login_state_resetting = 4,
+        login_state_error=100	
+	*/
+	
+	LL_DEBUGS("Voice") << "state change event: " << state << LL_ENDL;
+	switch(state)
+	{
+		case 1:
+		if(getState() == stateLoggingIn)
+		{
+			setState(stateLoggedIn);
+		}
+		break;
+
+		case 3:
+			// The user is in the process of logging out.
+			setState(stateLoggingOut);
+		break;
+
+		case 0:
+			// The user has been logged out.  
+			setState(stateLoggedOut);
+		break;
+		
+		default:
+			//Used to be a commented out warning
+			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
+		break;
+	}
+}
+
+void LLVivoxVoiceClient::mediaStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	int statusCode, 
+	std::string &statusString, 
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
+	
+	if(session)
+	{
+		// We know about this session
+		
+		// Save the state for later use
+		session->mMediaStreamState = state;
+		
+		switch(statusCode)
+		{
+			case 0:
+			case 200:
+				// generic success
+				// Don't change the saved error code (it may have been set elsewhere)
+			break;
+			default:
+				// save the status code for later
+				session->mErrorStatusCode = statusCode;
+			break;
+		}
+		
+		switch(state)
+		{
+			case streamStateIdle:
+				// Standard "left audio session"
+				session->mVoiceEnabled = false;
+				session->mMediaConnectInProgress = false;
+				leftAudioSession(session);
+			break;
+
+			case streamStateConnected:
+				session->mVoiceEnabled = true;
+				session->mMediaConnectInProgress = false;
+				joinedAudioSession(session);
+			break;
+			
+			case streamStateRinging:
+				if(incoming)
+				{
+					// Send the voice chat invite to the GUI layer
+					// TODO: Question: Should we correlate with the mute list here?
+					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
+					session->mVoiceInvitePending = true;
+					if(session->mName.empty())
+					{
+						lookupName(session->mCallerID);
+					}
+					else
+					{
+						// Act like we just finished resolving the name
+						avatarNameResolved(session->mCallerID, session->mName);
+					}
+				}
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+		
+	}
+	else
+	{
+		LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::textStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	bool enabled,
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		// Save the state for later use
+		session->mTextStreamState = state;
+		
+		// We know about this session
+		switch(state)
+		{
+			case 0:	// We see this when the text stream closes
+				LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
+			break;
+			
+			case 1:	// We see this on an incoming call from the Connector
+				// Try to send any text messages queued for this session.
+				sendQueuedTextMessages(session);
+
+				// Send the text chat invite to the GUI layer
+				// TODO: Question: Should we correlate with the mute list here?
+				session->mTextInvitePending = true;
+				if(session->mName.empty())
+				{
+					lookupName(session->mCallerID);
+				}
+				else
+				{
+					// Act like we just finished resolving the name
+					avatarNameResolved(session->mCallerID, session->mName);
+				}
+			break;
+
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+	}
+}
+
+void LLVivoxVoiceClient::participantAddedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString, 
+		std::string &displayNameString, 
+		int participantType)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->addParticipant(uriString);
+		if(participant)
+		{
+			participant->mAccountName = nameString;
+
+			LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+
+			if(participant->mAvatarIDValid)
+			{
+				// Initiate a lookup
+				lookupName(participant->mAvatarID);
+			}
+			else
+			{
+				// If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
+				std::string namePortion = nameFromsipURI(uriString);
+				if(namePortion.empty())
+				{
+					// Problem with the SIP URI, fall back to the display name
+					namePortion = displayNameString;
+				}
+				if(namePortion.empty())
+				{
+					// Problems with both of the above, fall back to the account name
+					namePortion = nameString;
+				}
+				
+				// Set the display name (which is a hint to the active speakers window not to do its own lookup)
+				participant->mDisplayName = namePortion;
+				avatarNameResolved(participant->mAvatarID, namePortion);
+			}
+		}
+	}
+}
+
+void LLVivoxVoiceClient::participantRemovedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			session->removeParticipant(participant);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+
+void LLVivoxVoiceClient::participantUpdatedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		bool isModeratorMuted, 
+		bool isSpeaking, 
+		int volume, 
+		F32 energy)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		
+		if(participant)
+		{
+			participant->mIsSpeaking = isSpeaking;
+			participant->mIsModeratorMuted = isModeratorMuted;
+
+			// SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
+			if (isSpeaking)
+			{
+				participant->mSpeakingTimeout.reset();
+				participant->mPower = energy;
+			}
+			else
+			{
+				participant->mPower = 0.0f;
+			}
+			participant->mVolume = volume;
+			
+			// *HACK: mantipov: added while working on EXT-3544                                                                                   
+			/*                                                                                                                                    
+			 Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE                                                            
+			 LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.                                                                    
+			 
+			 participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted                             
+			 Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.                 
+			 Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.                                         
+			 
+			 But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()                               
+			 voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager                                          
+			 and event is not fired.                                                                                                               
+			 
+			 So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it                                                
+			 in LLCallFloater::draw()                                                                                                              
+			 */
+			LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
+			
+			// ignore session ID of local chat                                                                                                    
+			if (voice_cnl && voice_cnl->getSessionID().notNull())
+			{
+				LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
+				if (speaker_manager)
+				{
+					speaker_manager->update(true);
+				}
+			}
+			
+		}
+		else
+		{
+			LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::buddyPresenceEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &statusString,
+		std::string &applicationString)
+{
+	buddyListEntry *buddy = findBuddy(uriString);
+	
+	if(buddy)
+	{
+		LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
+		LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+
+		if(applicationString.empty())
+		{
+			// This presence event is from a client that doesn't set up the Application string.  Do things the old-skool way.
+			// NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
+
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// User went offline with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = false;
+			}
+			else if ( stricmp("Online", statusString.c_str())== 0) 
+			{
+				// User came online with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = true;
+			}
+			else
+			{
+				// If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
+				// NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
+				buddy->mOnlineSLim = true;
+			} 
+		}
+		else if(applicationString.find("SecondLifeViewer") != std::string::npos)
+		{
+			// This presence event is from a viewer that sets the application string
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// Viewer says they're offline
+				buddy->mOnlineSL = false;
+			}
+			else
+			{
+				// Viewer says they're online
+				buddy->mOnlineSL = true;
+			}
+		}
+		else
+		{
+			// This presence event is from something which is NOT the SL viewer (assume it's SLim).
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// SLim says they're offline
+				buddy->mOnlineSLim = false;
+			}
+			else
+			{
+				// SLim says they're online
+				buddy->mOnlineSLim = true;
+			}
+		} 
+
+		LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+		
+		// HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
+		LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
+
+		notifyFriendObservers();
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
+	}	
+}
+
+void LLVivoxVoiceClient::messageEvent(
+		std::string &sessionHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &messageHeader, 
+		std::string &messageBody,
+		std::string &applicationString)
+{
+	LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
+//	LL_DEBUGS("Voice") << "    header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
+	
+	if(messageHeader.find("text/html") != std::string::npos)
+	{
+		std::string message;
+
+		{
+			const std::string startMarker = "<body";
+			const std::string startMarker2 = ">";
+			const std::string endMarker = "</body>";
+			const std::string startSpan = "<span";
+			const std::string endSpan = "</span>";
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			// Default to displaying the raw string, so the message gets through.
+			message = messageBody;
+
+			// Find the actual message text within the XML fragment
+			start = messageBody.find(startMarker);
+			start = messageBody.find(startMarker2, start);
+			end = messageBody.find(endMarker);
+
+			if(start != std::string::npos)
+			{
+				start += startMarker2.size();
+				
+				if(end != std::string::npos)
+					end -= start;
+					
+				message.assign(messageBody, start, end);
+			}
+			else 
+			{
+				// Didn't find a <body>, try looking for a <span> instead.
+				start = messageBody.find(startSpan);
+				start = messageBody.find(startMarker2, start);
+				end = messageBody.find(endSpan);
+				
+				if(start != std::string::npos)
+				{
+					start += startMarker2.size();
+					
+					if(end != std::string::npos)
+						end -= start;
+					
+					message.assign(messageBody, start, end);
+				}			
+			}
+		}	
+		
+//		LL_DEBUGS("Voice") << "    raw message = \n" << message << LL_ENDL;
+
+		// strip formatting tags
+		{
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			while((start = message.find('<')) != std::string::npos)
+			{
+				if((end = message.find('>', start + 1)) != std::string::npos)
+				{
+					// Strip out the tag
+					message.erase(start, (end + 1) - start);
+				}
+				else
+				{
+					// Avoid an infinite loop
+					break;
+				}
+			}
+		}
+		
+		// Decode ampersand-escaped chars
+		{
+			std::string::size_type mark = 0;
+
+			// The text may contain text encoded with &lt;, &gt;, and &amp;
+			mark = 0;
+			while((mark = message.find("&lt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, "<");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&gt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, ">");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&amp;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 5, "&");
+				mark += 1;
+			}
+		}
+		
+		// strip leading/trailing whitespace (since we always seem to get a couple newlines)
+		LLStringUtil::trim(message);
+		
+//		LL_DEBUGS("Voice") << "    stripped message = \n" << message << LL_ENDL;
+		
+		sessionState *session = findSession(sessionHandle);
+		if(session)
+		{
+			bool is_busy = gAgent.getBusy();
+			bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
+			bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
+			bool quiet_chat = false;
+			LLChat chat;
+
+			chat.mMuted = is_muted && !is_linden;
+			
+			if(!chat.mMuted)
+			{
+				chat.mFromID = session->mCallerID;
+				chat.mFromName = session->mName;
+				chat.mSourceType = CHAT_SOURCE_AGENT;
+
+				if(is_busy && !is_linden)
+				{
+					quiet_chat = true;
+					// TODO: Question: Return busy mode response here?  Or maybe when session is started instead?
+				}
+				
+				LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
+				gIMMgr->addMessage(session->mIMSessionID,
+						session->mCallerID,
+						session->mName.c_str(),
+						message.c_str(),
+						LLStringUtil::null,		// default arg
+						IM_NOTHING_SPECIAL,		// default arg
+						0,						// default arg
+						LLUUID::null,			// default arg
+						LLVector3::zero,		// default arg
+						true);					// prepend name and make it a link to the user's profile
+
+				chat.mText = std::string("IM: ") + session->mName + std::string(": ") + message;
+				// If the chat should come in quietly (i.e. we're in busy mode), pretend it's from a local agent.
+				LLFloaterChat::addChat( chat, TRUE, quiet_chat );
+			}
+		}		
+	}
+}
+
+void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			if (!stricmp(notificationType.c_str(), "Typing"))
+			{
+				// Other end started typing
+				// TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else if (!stricmp(notificationType.c_str(), "NotTyping"))
+			{
+				// Other end stopped typing
+				// TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else
+			{
+				LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+			}
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
+{
+	buddyListEntry *buddy = findBuddy(buddyURI);
+	
+	if(!buddy)
+	{
+		// Couldn't find buddy by URI, try converting the alias...
+		if(!alias.empty())
+		{
+			LLUUID id;
+			if(IDFromName(alias, id))
+			{
+				buddy = findBuddy(id);
+			}
+		}
+	}
+	
+	if(buddy)
+	{
+		std::ostringstream stream;
+		
+		if(buddy->mCanSeeMeOnline)
+		{
+			// Sending the response will create an auto-accept rule
+			buddy->mHasAutoAcceptListEntry = true;
+		}
+		else
+		{
+			// Sending the response will create a block rule
+			buddy->mHasBlockListEntry = true;
+		}
+		
+		if(buddy->mInSLFriends)
+		{
+			buddy->mInVivoxBuddies = true;
+		}
+		
+		stream
+			<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
+				<< "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
+				<< "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
+			<< "</Request>"
+			<< "\n\n\n";
+			
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
+{
+	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+	mTuningEnergy = energy;
+}
+
+void LLVivoxVoiceClient::buddyListChanged()
+{
+	// This is called after we receive a BuddyAndGroupListChangedEvent.
+	mBuddyListMapPopulated = true;
+	mFriendsListDirty = true;
+}
+
+void LLVivoxVoiceClient::muteListChanged()
+{
+	// The user's mute list has been updated.  Go through the current participant list and sync it with the mute list.
+	if(mAudioSession)
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+			
+			// Check to see if this participant is on the mute list already
+			if(p->updateMuteState())
+				mAudioSession->mVolumeDirty = true;
+		}
+	}
+}
+
+void LLVivoxVoiceClient::updateFriends(U32 mask)
+{
+	if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
+	{
+		// Just resend the whole friend list to the daemon
+		mFriendsListDirty = true;
+	}
+}
+
+/////////////////////////////
+// Managing list of participants
+LLVivoxVoiceClient::participantState::participantState(const std::string &uri) : 
+	 mURI(uri), 
+	 mPTT(false), 
+	 mIsSpeaking(false), 
+	 mIsModeratorMuted(false), 
+	 mLastSpokeTimestamp(0.f), 
+	 mPower(0.f), 
+	 mVolume(-1), 
+	 mOnMuteList(false), 
+	 mUserVolume(-1), 
+	 mVolumeDirty(false), 
+	 mAvatarIDValid(false),
+	 mIsSelf(false)
+{
+}
+
+LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::addParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	bool useAlternateURI = false;
+	
+	// Note: this is mostly the body of LLVivoxVoiceClient::sessionState::findParticipant(), but since we need to know if it
+	// matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+		if(iter == mParticipantsByURI.end())
+		{
+			if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+			{
+				// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+				// Use mSIPURI instead, since it will be properly encoded.
+				iter = mParticipantsByURI.find(mSIPURI);
+				useAlternateURI = true;
+			}
+		}
+
+		if(iter != mParticipantsByURI.end())
+		{
+			result = iter->second;
+		}
+	}
+		
+	if(!result)
+	{
+		// participant isn't already in one list or the other.
+		result = new participantState(useAlternateURI?mSIPURI:uri);
+		mParticipantsByURI.insert(participantMap::value_type(result->mURI, result));
+		mParticipantsChanged = true;
+		
+		// Try to do a reverse transform on the URI to get the GUID back.
+		{
+			LLUUID id;
+			if(LLVivoxVoiceClient::getInstance()->IDFromName(result->mURI, id))
+			{
+				result->mAvatarIDValid = true;
+				result->mAvatarID = id;
+
+				if(result->updateMuteState())
+					mVolumeDirty = true;
+			}
+			else
+			{
+				// Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
+				// This tells both code in LLVivoxVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache.
+				setUUIDFromStringHash(result->mAvatarID, uri);
+			}
+		}
+		
+		mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
+		
+		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
+	}
+	
+	return result;
+}
+
+bool LLVivoxVoiceClient::participantState::updateMuteState()
+{
+	bool result = false;
+	
+	if(mAvatarIDValid)
+	{
+		bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
+		if(mOnMuteList != isMuted)
+		{
+			mOnMuteList = isMuted;
+			mVolumeDirty = true;
+			result = true;
+		}
+	}
+	return result;
+}
+
+bool LLVivoxVoiceClient::participantState::isAvatar()
+{
+	return mAvatarIDValid;
+}
+
+void LLVivoxVoiceClient::sessionState::removeParticipant(LLVivoxVoiceClient::participantState *participant)
+{
+	if(participant)
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(participant->mURI);
+		participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(participant->mAvatarID);
+		
+		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
+		
+		if(iter == mParticipantsByURI.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
+		}
+		else if(iter2 == mParticipantsByUUID.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
+		}
+		else if(iter->second != iter2->second)
+		{
+			LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
+		}
+		else
+		{
+			mParticipantsByURI.erase(iter);
+			mParticipantsByUUID.erase(iter2);
+			
+			delete participant;
+			mParticipantsChanged = true;
+		}
+	}
+}
+
+void LLVivoxVoiceClient::sessionState::removeAllParticipants()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mParticipantsByURI.empty())
+	{
+		removeParticipant(mParticipantsByURI.begin()->second);
+	}
+	
+	if(!mParticipantsByUUID.empty())
+	{
+		LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
+	}
+}
+
+std::vector<LLUUID> LLVivoxVoiceClient::getParticipantList(void)
+{
+	std::vector<LLUUID> result;
+	if(mAudioSession)
+	{
+		for(participantUUIDMap::iterator iter = mAudioSession->mParticipantsByUUID.begin();
+			iter != mAudioSession->mParticipantsByUUID.end(); 
+			iter++)
+		{
+			result.push_back(iter->first);
+		}
+	}
+	return result;
+}
+
+
+LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::findParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	
+	participantMap::iterator iter = mParticipantsByURI.find(uri);
+
+	if(iter == mParticipantsByURI.end())
+	{
+		if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+		{
+			// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+			// Look up the other URI
+			iter = mParticipantsByURI.find(mSIPURI);
+		}
+	}
+
+	if(iter != mParticipantsByURI.end())
+	{
+		result = iter->second;
+	}
+		
+	return result;
+}
+
+LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
+
+	if(iter != mParticipantsByUUID.end())
+	{
+		result = iter->second;
+	}
+
+	return result;
+}
+
+LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	
+	if(mAudioSession)
+	{
+		result = mAudioSession->findParticipantByID(id);
+	}
+	
+	return result;
+}
+
+
+void LLVivoxVoiceClient::parcelChanged()
+{
+	if(getState() >= stateNoChannel)
+	{
+		// If the user is logged in, start a channel lookup.
+		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
+
+		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
+		LLSD data;
+		LLHTTPClient::post(
+			url,
+			data,
+			new LLVivoxVoiceClientCapResponder);
+	}
+	else
+	{
+		// The transition to stateNoChannel needs to kick this off again.
+		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::switchChannel(
+	std::string uri,
+	bool spatial,
+	bool no_reconnect,
+	bool is_p2p,
+	std::string hash)
+{
+	bool needsSwitch = false;
+	
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< " with uri \"" << uri << "\"" 
+		<< (spatial?", spatial is true":", spatial is false")
+		<< LL_ENDL;
+	
+	switch(getState())
+	{
+		case stateJoinSessionFailed:
+		case stateJoinSessionFailedWaiting:
+		case stateNoChannel:
+			// Always switch to the new URI from these states.
+			needsSwitch = true;
+		break;
+
+		default:
+			if(mSessionTerminateRequested)
+			{
+				// If a terminate has been requested, we need to compare against where the URI we're already headed to.
+				if(mNextAudioSession)
+				{
+					if(mNextAudioSession->mSIPURI != uri)
+						needsSwitch = true;
+				}
+				else
+				{
+					// mNextAudioSession is null -- this probably means we're on our way back to spatial.
+					if(!uri.empty())
+					{
+						// We do want to process a switch in this case.
+						needsSwitch = true;
+					}
+				}
+			}
+			else
+			{
+				// Otherwise, compare against the URI we're in now.
+				if(mAudioSession)
+				{
+					if(mAudioSession->mSIPURI != uri)
+					{
+						needsSwitch = true;
+					}
+				}
+				else
+				{
+					if(!uri.empty())
+					{
+						// mAudioSession is null -- it's not clear what case would cause this.
+						// For now, log it as a warning and see if it ever crops up.
+						LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
+					}
+				}
+			}
+		break;
+	}
+	
+	if(needsSwitch)
+	{
+		if(uri.empty())
+		{
+			// Leave any channel we may be in
+			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
+
+			sessionState *oldSession = mNextAudioSession;
+			mNextAudioSession = NULL;
+
+			// The old session may now need to be deleted.
+			reapSession(oldSession);
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+
+			mNextAudioSession = addSession(uri);
+			mNextAudioSession->mHash = hash;
+			mNextAudioSession->mIsSpatial = spatial;
+			mNextAudioSession->mReconnect = !no_reconnect;
+			mNextAudioSession->mIsP2P = is_p2p;
+		}
+		
+		if(getState() <= stateNoChannel)
+		{
+			// We're already set up to join a channel, just needed to fill in the session URI
+		}
+		else
+		{
+			// State machine will come around and rejoin if uri/handle is not empty.
+			sessionTerminate();
+		}
+	}
+}
+
+void LLVivoxVoiceClient::joinSession(sessionState *session)
+{
+	mNextAudioSession = session;
+	
+	if(getState() <= stateNoChannel)
+	{
+		// We're already set up to join a channel, just needed to fill in the session handle
+	}
+	else
+	{
+		// State machine will come around and rejoin if uri/handle is not empty.
+		sessionTerminate();
+	}
+}
+
+void LLVivoxVoiceClient::setNonSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	switchChannel(uri, false, false, false, credentials);
+}
+
+void LLVivoxVoiceClient::setSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	mSpatialSessionURI = uri;
+	mSpatialSessionCredentials = credentials;
+	mAreaVoiceDisabled = mSpatialSessionURI.empty();
+
+	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
+	
+	if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
+	{
+		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
+		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
+	}
+	else
+	{
+		switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+	}
+}
+
+void LLVivoxVoiceClient::callUser(const LLUUID &uuid)
+{
+	std::string userURI = sipURIFromID(uuid);
+
+	switchChannel(userURI, false, true, true);
+}
+
+LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user already exists
+	sessionState *session = findSession(uuid);
+	if(!session)
+	{
+		// No session with user, need to start one.
+		std::string uri = sipURIFromID(uuid);
+		session = addSession(uri);
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+		session->mCallerID = uuid;
+	}
+	
+	if(session)
+	{
+		if(session->mHandle.empty())
+		{
+			// Session isn't active -- start it up.
+			sessionCreateSendMessage(session, false, true);
+		}
+		else
+		{	
+			// Session is already active -- start up text.
+			sessionTextConnectSendMessage(session);
+		}
+	}
+	
+	return session;
+}
+
+BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+{
+	bool result = false;
+
+	// Attempt to locate the indicated session
+	sessionState *session = startUserIMSession(participant_id);
+	if(session)
+	{
+		// found the session, attempt to send the message
+		session->mTextMsgQueue.push(message);
+		
+		// Try to send queued messages (will do nothing if the session is not open yet)
+		sendQueuedTextMessages(session);
+
+		// The message is queued, so we succeed.
+		result = true;
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
+	}
+	
+	return result;
+}
+
+void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session)
+{
+	if(session->mTextStreamState == 1)
+	{
+		if(!session->mTextMsgQueue.empty())
+		{
+			std::ostringstream stream;
+			
+			while(!session->mTextMsgQueue.empty())
+			{
+				std::string message = session->mTextMsgQueue.front();
+				session->mTextMsgQueue.pop();
+				stream
+				<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
+					<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+					<< "<MessageHeader>text/HTML</MessageHeader>"
+					<< "<MessageBody>" << message << "</MessageBody>"
+				<< "</Request>"
+				<< "\n\n\n";
+			}		
+			writeString(stream.str());
+		}
+	}
+	else
+	{
+		// Session isn't connected yet, defer until later.
+	}
+}
+
+void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user exists
+	sessionState *session = findSession(uuid);
+	if(session)
+	{
+		// found the session
+		if(!session->mHandle.empty())
+		{
+			sessionTextDisconnectSendMessage(session);
+		}
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
+	}
+}
+
+bool LLVivoxVoiceClient::answerInvite(std::string &sessionHandle)
+{
+	// this is only ever used to answer incoming p2p call invites.
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+
+		joinSession(session);
+		return true;
+	}
+	
+	return false;
+}
+
+BOOL LLVivoxVoiceClient::isOnlineSIP(const LLUUID &id)
+{
+	bool result = false;
+	buddyListEntry *buddy = findBuddy(id);
+	if(buddy)
+	{
+		result = buddy->mOnlineSLim;
+		LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
+	}
+
+	if(!result)
+	{
+		// This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
+		sessionState *session = findSession(id);
+		if(session && !session->mHandle.empty())
+		{
+			if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
+			{
+				LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
+				// we have a p2p text session open with this user, so by definition they're online.
+				result = true;
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if the indicated participant in the current audio session is really an SL avatar.
+// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id)
+{
+	BOOL result = TRUE; 
+	sessionState *session = findSession(id);
+	
+	if(session != NULL)
+	{
+		// this is a p2p session with the indicated caller, or the session with the specified UUID.
+		if(session->mSynthesizedCallerID)
+			result = FALSE;
+	}
+	else
+	{
+		// Didn't find a matching session -- check the current audio session for a matching participant
+		if(mAudioSession != NULL)
+		{
+			participantState *participant = findParticipantByID(id);
+			if(participant != NULL)
+			{
+				result = participant->isAvatar();
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if calling back the session URI after the session has closed is possible.
+// Currently this will be false only for PSTN P2P calls.		
+BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
+{
+	BOOL result = TRUE; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isCallBackPossible();
+	}
+	
+	return result;
+}
+
+// Returns true if the session can accepte text IM's.
+// Currently this will be false only for PSTN P2P calls.
+BOOL LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
+{
+	bool result = TRUE; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isTextIMPossible();
+	}
+	
+	return result;
+}
+		
+
+void LLVivoxVoiceClient::declineInvite(std::string &sessionHandle)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		sessionMediaDisconnectSendMessage(session);
+	}
+}
+
+void LLVivoxVoiceClient::leaveNonSpatialChannel()
+{
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< LL_ENDL;
+	
+	// Make sure we don't rejoin the current session.	
+	sessionState *oldNextSession = mNextAudioSession;
+	mNextAudioSession = NULL;
+	
+	// Most likely this will still be the current session at this point, but check it anyway.
+	reapSession(oldNextSession);
+	
+	verifySessionState();
+	
+	sessionTerminate();
+}
+
+std::string LLVivoxVoiceClient::getCurrentChannel()
+{
+	std::string result;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
+	{
+		result = getAudioSessionURI();
+	}
+	
+	return result;
+}
+
+bool LLVivoxVoiceClient::inProximalChannel()
+{
+	bool result = false;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
+	{
+		result = inSpatialChannel();
+	}
+	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
+{
+	std::string result;
+	result = "sip:";
+	result += nameFromID(id);
+	result += "@";
+	result += mVoiceSIPURIHostName;
+	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = "sip:";
+		result += nameFromID(avatar->getID());
+		result += "@";
+		result += mVoiceSIPURIHostName;
+	}
+	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = nameFromID(avatar->getID());
+	}	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid)
+{
+	std::string result;
+	
+	if (uuid.isNull()) {
+		//VIVOX, the uuid emtpy look for the mURIString and return that instead.
+		//result.assign(uuid.mURIStringName);
+		LLStringUtil::replaceChar(result, '_', ' ');
+		return result;
+	}
+	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
+	result = "x";
+	
+	// Base64 encode and replace the pieces of base64 that are less compatible 
+	// with e-mail local-parts.
+	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
+	result += LLBase64::encode(uuid.mData, UUID_BYTES);
+	LLStringUtil::replaceChar(result, '+', '-');
+	LLStringUtil::replaceChar(result, '/', '_');
+	
+	// If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
+	// echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
+	
+	// The reverse transform can be done with:
+	// echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
+	
+	return result;
+}
+
+bool LLVivoxVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
+{
+	bool result = false;
+	
+	// SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
+	// If it is, convert to a bare name before doing the transform.
+	std::string name = nameFromsipURI(inName);
+	
+	// Doesn't look like a SIP URI, assume it's an actual name.
+	if(name.empty())
+		name = inName;
+
+	// This will only work if the name is of the proper form.
+	// As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
+	// "xFnPP04IpREWNkuw1cOXlhw=="
+	
+	if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
+	{
+		// The name appears to have the right form.
+
+		// Reverse the transforms done by nameFromID
+		std::string temp = name;
+		LLStringUtil::replaceChar(temp, '-', '+');
+		LLStringUtil::replaceChar(temp, '_', '/');
+
+		U8 rawuuid[UUID_BYTES + 1]; 
+		int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
+		if(len == UUID_BYTES)
+		{
+			// The decode succeeded.  Stuff the bits into the result's UUID
+			memcpy(uuid.mData, rawuuid, UUID_BYTES);
+			result = true;
+		}
+	} 
+	
+	if(!result)
+	{
+		// VIVOX:  not a standard account name, just copy the URI name mURIString field
+		// and hope for the best.  bpj
+		uuid.setNull();  // VIVOX, set the uuid field to nulls
+	}
+	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
+{
+	return avatar->getFullname();
+}
+
+std::string LLVivoxVoiceClient::sipURIFromName(std::string &name)
+{
+	std::string result;
+	result = "sip:";
+	result += name;
+	result += "@";
+	result += mVoiceSIPURIHostName;
+
+//	LLStringUtil::toLower(result);
+
+	return result;
+}
+
+std::string LLVivoxVoiceClient::nameFromsipURI(const std::string &uri)
+{
+	std::string result;
+
+	std::string::size_type sipOffset, atOffset;
+	sipOffset = uri.find("sip:");
+	atOffset = uri.find("@");
+	if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+	{
+		result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+	}
+	
+	return result;
+}
+
+bool LLVivoxVoiceClient::inSpatialChannel(void)
+{
+	bool result = false;
+	
+	if(mAudioSession)
+		result = mAudioSession->mIsSpatial;
+		
+	return result;
+}
+
+std::string LLVivoxVoiceClient::getAudioSessionURI()
+{
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mSIPURI;
+		
+	return result;
+}
+
+std::string LLVivoxVoiceClient::getAudioSessionHandle()
+{
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mHandle;
+		
+	return result;
+}
+
+
+/////////////////////////////
+// Sending updates of current state
+
+void LLVivoxVoiceClient::enforceTether(void)
+{
+	LLVector3d tethered	= mCameraRequestedPosition;
+
+	// constrain 'tethered' to within 50m of mAvatarPosition.
+	{
+		F32 max_dist = 50.0f;
+		LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
+		F32 camera_distance = (F32)camera_offset.magVec();
+		if(camera_distance > max_dist)
+		{
+			tethered = mAvatarPosition + 
+				(max_dist / camera_distance) * camera_offset;
+		}
+	}
+	
+	if(dist_vec(mCameraPosition, tethered) > 0.1)
+	{
+		mCameraPosition = tethered;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::updatePosition(void)
+{
+	
+	LLVOAvatarSelf *agent = gAgent.getAvatarObject();
+	LLViewerRegion *region = gAgent.getRegion();
+	if(region && agent)
+	{
+		LLMatrix3 rot;
+		LLVector3d pos;
+		
+		// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
+		// They're currently always set to zero.
+		
+		// Send the current camera position to the voice code
+		rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (),  LLViewerCamera::getInstance()->getUpAxis());		
+		pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
+		
+		LLVivoxVoiceClient::getInstance()->setCameraPosition(
+															 pos,				// position
+															 LLVector3::zero, 	// velocity
+															 rot);				// rotation matrix
+		
+		// Send the current avatar position to the voice code
+		rot = agent->getRootJoint()->getWorldRotation().getMatrix3();
+		
+		pos = agent->getPositionGlobal();
+		// TODO: Can we get the head offset from outside the LLVOAvatar?
+		//			pos += LLVector3d(mHeadOffset);
+		pos += LLVector3d(0.f, 0.f, 1.f);
+		
+		LLVivoxVoiceClient::getInstance()->setAvatarPosition(
+															 pos,				// position
+															 LLVector3::zero, 	// velocity
+															 rot);				// rotation matrix
+	}
+}
+
+void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	mCameraRequestedPosition = position;
+	
+	if(mCameraVelocity != velocity)
+	{
+		mCameraVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mCameraRot != rot)
+	{
+		mCameraRot = rot;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	if(dist_vec(mAvatarPosition, position) > 0.1)
+	{
+		mAvatarPosition = position;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarVelocity != velocity)
+	{
+		mAvatarVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarRot != rot)
+	{
+		mAvatarRot = rot;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+bool LLVivoxVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+{
+	bool result = false;
+	
+	if(region)
+	{
+		name = region->getName();
+	}
+	
+	if(!name.empty())
+		result = true;
+	
+	return result;
+}
+
+void LLVivoxVoiceClient::leaveChannel(void)
+{
+	if(getState() == stateRunning)
+	{
+		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
+		mChannelName.clear();
+		sessionTerminate();
+	}
+}
+
+void LLVivoxVoiceClient::setMuteMic(bool muted)
+{
+	mMuteMic = muted;
+}
+
+void LLVivoxVoiceClient::setUserPTTState(bool ptt)
+{
+	mUserPTTState = ptt;
+}
+
+bool LLVivoxVoiceClient::getUserPTTState()
+{
+	return mUserPTTState;
+}
+
+void LLVivoxVoiceClient::inputUserControlState(bool down)
+{
+	if(mPTTIsToggle)
+	{
+		if(down) // toggle open-mic state on 'down'                                                        
+		{
+			toggleUserPTTState();
+		}
+	}
+	else // set open-mic state as an absolute                                                                  
+	{
+		setUserPTTState(down);
+	}
+}
+
+
+void LLVivoxVoiceClient::toggleUserPTTState(void)
+{
+	mUserPTTState = !mUserPTTState;
+}
+
+void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
+{
+	if (enabled != mVoiceEnabled)
+	{
+		// TODO: Refactor this so we don't call into LLVoiceChannel, but simply
+		// use the status observer
+		mVoiceEnabled = enabled;
+		LLVoiceClientStatusObserver::EStatusType status;
+		
+		
+		if (enabled)
+		{
+			LLVoiceChannel::getCurrentVoiceChannel()->activate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
+		}
+		else
+		{
+			// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
+			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
+		}
+	}
+}
+
+bool LLVivoxVoiceClient::voiceEnabled()
+{
+	return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
+}
+
+void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled)
+{
+	mLipSyncEnabled = enabled;
+}
+
+BOOL LLVivoxVoiceClient::lipSyncEnabled()
+{
+	   
+	if ( mVoiceEnabled && stateDisabled != getState() )
+	{
+		return mLipSyncEnabled;
+	}
+	else
+	{
+		return FALSE;
+	}
+}
+
+void LLVivoxVoiceClient::setUsePTT(bool usePTT)
+{
+	if(usePTT && !mUsePTT)
+	{
+		// When the user turns on PTT, reset the current state.
+		mUserPTTState = false;
+	}
+	mUsePTT = usePTT;
+}
+
+void LLVivoxVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+{
+	if(!PTTIsToggle && mPTTIsToggle)
+	{
+		// When the user turns off toggle, reset the current state.
+		mUserPTTState = false;
+	}
+	
+	mPTTIsToggle = PTTIsToggle;
+}
+
+bool LLVivoxVoiceClient::getPTTIsToggle()
+{
+	return mPTTIsToggle;
+}
+
+void LLVivoxVoiceClient::setPTTKey(std::string &key)
+{
+	if(key == "MiddleMouse")
+	{
+		mPTTIsMiddleMouse = true;
+	}
+	else
+	{
+		mPTTIsMiddleMouse = false;
+		if(!LLKeyboard::keyFromString(key, &mPTTKey))
+		{
+			// If the call failed, don't match any key.
+			key = KEY_NONE;
+		}
+	}
+}
+
+void LLVivoxVoiceClient::setEarLocation(S32 loc)
+{
+	if(mEarLocation != loc)
+	{
+		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
+		
+		mEarLocation = loc;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::setVoiceVolume(F32 volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mSpeakerVolume)
+	{
+		if((scaled_volume == 0) || (mSpeakerVolume == 0))
+		{
+			mSpeakerMuteDirty = true;
+		}
+
+		mSpeakerVolume = scaled_volume;
+		mSpeakerVolumeDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::setMicGain(F32 volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+	
+	if(scaled_volume != mMicVolume)
+	{
+		mMicVolume = scaled_volume;
+		mMicVolumeDirty = true;
+	}
+}
+
+void LLVivoxVoiceClient::keyDown(KEY key, MASK mask)
+{	
+	if (gKeyboard->getKeyRepeated(key))
+	{
+		// ignore auto-repeat keys                                                                         
+		return;
+	}
+	
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+		&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+	
+	
+}
+void LLVivoxVoiceClient::keyUp(KEY key, MASK mask)
+{
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+		&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+	
+}
+void LLVivoxVoiceClient::middleMouseState(bool down)
+{
+	if(mPTTIsMiddleMouse)
+	{
+        if(mPTTIsMiddleMouse)
+        {
+			inputUserControlState(down);
+        }		
+	}
+}
+
+/////////////////////////////
+// Accessors for data related to nearby speakers
+BOOL LLVivoxVoiceClient::getVoiceEnabled(const LLUUID& id)
+{
+	BOOL result = FALSE;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		// I'm not sure what the semantics of this should be.
+		// For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
+		result = TRUE;
+	}
+	
+	return result;
+}
+
+std::string LLVivoxVoiceClient::getDisplayName(const LLUUID& id)
+{
+	std::string result;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mDisplayName;
+	}
+	
+	return result;
+}
+
+
+
+BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
+		{
+			participant->mIsSpeaking = FALSE;
+		}
+		result = participant->mIsSpeaking;
+	}
+	
+	return result;
+}
+
+BOOL LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mIsModeratorMuted;
+	}
+	
+	return result;
+}
+
+F32 LLVivoxVoiceClient::getCurrentPower(const LLUUID& id)
+{		
+	F32 result = 0;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mPower;
+	}
+	
+	return result;
+}
+
+
+
+BOOL LLVivoxVoiceClient::getUsingPTT(const LLUUID& id)
+{
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		// I'm not sure what the semantics of this should be.
+		// Does "using PTT" mean they're configured with a push-to-talk button?
+		// For now, we know there's no PTT mechanism in place, so nobody is using it.
+	}
+	
+	return result;
+}
+
+BOOL LLVivoxVoiceClient::getOnMuteList(const LLUUID& id)
+{
+	BOOL result = FALSE;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mOnMuteList;
+	}
+
+	return result;
+}
+
+// External accessiors. Maps 0.0 to 1.0 to internal values 0-400 with .5 == 100
+// internal = 400 * external^2
+F32 LLVivoxVoiceClient::getUserVolume(const LLUUID& id)
+{
+	F32 result = 0.0f;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		S32 ires = 100; // nominal default volume
+		
+		if(participant->mIsSelf)
+		{
+			// Always make it look like the user's own volume is set at the default.
+		}
+		else if(participant->mUserVolume != -1)
+		{
+			// Use the internal volume
+			ires = participant->mUserVolume;
+			
+			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+//			LL_DEBUGS("Voice") << "mapping from mUserVolume " << ires << LL_ENDL;
+		}
+		else if(participant->mVolume != -1)
+		{
+			// Map backwards from vivox volume 
+
+			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+//			LL_DEBUGS("Voice") << "mapping from mVolume " << participant->mVolume << LL_ENDL;
+
+			if(participant->mVolume < 56)
+			{
+				ires = (participant->mVolume * 100) / 56;
+			}
+			else
+			{
+				ires = (((participant->mVolume - 56) * 300) / (100 - 56)) + 100;
+			}
+		}
+		result = sqrtf(((F32)ires) / 400.f);
+	}
+
+	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+//	LL_DEBUGS("Voice") << "returning " << result << LL_ENDL;
+
+	return result;
+}
+
+void LLVivoxVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
+{
+	if(mAudioSession)
+	{
+		participantState *participant = findParticipantByID(id);
+		if (participant)
+		{
+			// volume can amplify by as much as 4x!
+			S32 ivol = (S32)(400.f * volume * volume);
+			participant->mUserVolume = llclamp(ivol, 0, 400);
+			participant->mVolumeDirty = TRUE;
+			mAudioSession->mVolumeDirty = TRUE;
+		}
+	}
+}
+
+std::string LLVivoxVoiceClient::getGroupID(const LLUUID& id)
+{
+	std::string result;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mGroupID;
+	}
+	
+	return result;
+}
+
+BOOL LLVivoxVoiceClient::getAreaVoiceDisabled()
+{
+	return mAreaVoiceDisabled;
+}
+
+void LLVivoxVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
+	
+	if(!mMainSessionGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
+		<< "<Filename>" << "" << "</Filename>"
+		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
+		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
+		<< "</Request>\n\n\n";
+
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::recordingLoopSave(const std::string& filename)
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Flush</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::recordingStop()
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::filePlaybackStart(const std::string& filename)
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::filePlaybackStop()
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVivoxVoiceClient::filePlaybackSetPaused(bool paused)
+{
+	// TODO: Implement once Vivox gives me a sample
+}
+
+void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed)
+{
+	// TODO: Implement once Vivox gives me a sample
+}
+
+LLVivoxVoiceClient::sessionState::sessionState() :
+	mMediaStreamState(streamStateUnknown),
+	mTextStreamState(streamStateUnknown),
+	mCreateInProgress(false),
+	mMediaConnectInProgress(false),
+	mVoiceInvitePending(false),
+	mTextInvitePending(false),
+	mSynthesizedCallerID(false),
+	mIsChannel(false),
+	mIsSpatial(false),
+	mIsP2P(false),
+	mIncoming(false),
+	mVoiceEnabled(false),
+	mReconnect(false),
+	mVolumeDirty(false),
+	mParticipantsChanged(false)
+{
+}
+
+LLVivoxVoiceClient::sessionState::~sessionState()
+{
+	removeAllParticipants();
+}
+
+bool LLVivoxVoiceClient::sessionState::isCallBackPossible()
+{
+	// This may change to be explicitly specified by vivox in the future...
+	// Currently, only PSTN P2P calls cannot be returned.
+	// Conveniently, this is also the only case where we synthesize a caller UUID.
+	return !mSynthesizedCallerID;
+}
+
+bool LLVivoxVoiceClient::sessionState::isTextIMPossible()
+{
+	// This may change to be explicitly specified by vivox in the future...
+	return !mSynthesizedCallerID;
+}
+
+
+LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsBegin(void)
+{
+	return mSessions.begin();
+}
+
+LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsEnd(void)
+{
+	return mSessions.end();
+}
+
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const std::string &handle)
+{
+	sessionState *result = NULL;
+	sessionMap::iterator iter = mSessionsByHandle.find(handle);
+	if(iter != mSessionsByHandle.end())
+	{
+		result = iter->second;
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
+{	
+	sessionState *result = NULL;
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+		if(session->mCreateInProgress && (session->mSIPURI == uri))
+		{
+			result = session;
+			break;
+		}
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const LLUUID &participant_id)
+{
+	sessionState *result = NULL;
+	
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+		if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
+		{
+			result = session;
+			break;
+		}
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::addSession(const std::string &uri, const std::string &handle)
+{
+	sessionState *result = NULL;
+	
+	if(handle.empty())
+	{
+		// No handle supplied.
+		// Check whether there's already a session with this URI
+		for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+		{
+			sessionState *s = *iter;
+			if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
+			{
+				// TODO: I need to think about this logic... it's possible that this case should raise an internal error.
+				result = s;
+				break;
+			}
+		}
+	}
+	else // (!handle.empty())
+	{
+		// Check for an existing session with this handle
+		sessionMap::iterator iter = mSessionsByHandle.find(handle);
+		
+		if(iter != mSessionsByHandle.end())
+		{
+			result = iter->second;
+		}
+	}
+
+	if(!result)
+	{
+		// No existing session found.
+		
+		LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
+		result = new sessionState();
+		result->mSIPURI = uri;
+		result->mHandle = handle;
+		
+		mSessions.insert(result);
+
+		if(!result->mHandle.empty())
+		{
+			mSessionsByHandle.insert(sessionMap::value_type(result->mHandle, result));
+		}
+	}
+	else
+	{
+		// Found an existing session
+		
+		if(uri != result->mSIPURI)
+		{
+			// TODO: Should this be an internal error?
+			LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
+			setSessionURI(result, uri);
+		}
+
+		if(handle != result->mHandle)
+		{
+			if(handle.empty())
+			{
+				// There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
+				LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
+			}
+			else
+			{
+				// TODO: Should this be an internal error?
+				LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
+				setSessionHandle(result, handle);
+			}
+		}
+		
+		LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
+	}
+
+	verifySessionState();
+		
+	return result;
+}
+
+void LLVivoxVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
+{
+	// Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
+	
+	if(!session->mHandle.empty())
+	{
+		// Remove session from the map if it should have been there.
+		sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
+			}
+
+			mSessionsByHandle.erase(iter);
+		}
+		else
+		{
+			LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
+		}
+	}
+			
+	session->mHandle = handle;
+
+	if(!handle.empty())
+	{
+		mSessionsByHandle.insert(sessionMap::value_type(session->mHandle, session));
+	}
+
+	verifySessionState();
+}
+
+void LLVivoxVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
+{
+	// There used to be a map of session URIs to sessions, which made this complex....
+	session->mSIPURI = uri;
+
+	verifySessionState();
+}
+
+void LLVivoxVoiceClient::deleteSession(sessionState *session)
+{
+	// Remove the session from the handle map
+	if(!session->mHandle.empty())
+	{
+		sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
+			}
+			mSessionsByHandle.erase(iter);
+		}
+	}
+
+	// Remove the session from the URI map
+	mSessions.erase(session);
+	
+	// At this point, the session should be unhooked from all lists and all state should be consistent.
+	verifySessionState();
+
+	// If this is the current audio session, clean up the pointer which will soon be dangling.
+	if(mAudioSession == session)
+	{
+		mAudioSession = NULL;
+		mAudioSessionChanged = true;
+	}
+
+	// ditto for the next audio session
+	if(mNextAudioSession == session)
+	{
+		mNextAudioSession = NULL;
+	}
+
+	// delete the session
+	delete session;
+}
+
+void LLVivoxVoiceClient::deleteAllSessions()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mSessions.empty())
+	{
+		deleteSession(*(sessionsBegin()));
+	}
+	
+	if(!mSessionsByHandle.empty())
+	{
+		LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
+	}
+}
+
+void LLVivoxVoiceClient::verifySessionState(void)
+{
+	// This is mostly intended for debugging problems with session state management.
+	LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
+
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+
+		LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
+		
+		if(!session->mHandle.empty())
+		{
+			// every session with a non-empty handle needs to be in the handle map
+			sessionMap::iterator i2 = mSessionsByHandle.find(session->mHandle);
+			if(i2 == mSessionsByHandle.end())
+			{
+				LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+			}
+			else
+			{
+				if(i2->second != session)
+				{
+					LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
+				}
+			}
+		}
+	}
+		
+	// check that every entry in the handle map points to a valid session in the session set
+	for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
+	{
+		sessionState *session = iter->second;
+		sessionIterator i2 = mSessions.find(session);
+		if(i2 == mSessions.end())
+		{
+			LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+		}
+		else
+		{
+			if(session->mHandle != (*i2)->mHandle)
+			{
+				LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
+			}
+		}
+	}
+}
+
+LLVivoxVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
+	mURI(uri)
+{
+	mOnlineSL = false;
+	mOnlineSLim = false;
+	mCanSeeMeOnline = true;
+	mHasBlockListEntry = false;
+	mHasAutoAcceptListEntry = false;
+	mNameResolved = false;
+	mInVivoxBuddies = false;
+	mInSLFriends = false;
+	mNeedsNameUpdate = false;
+}
+
+void LLVivoxVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
+{
+	buddyListEntry *buddy = addBuddy(uri, displayName);
+	buddy->mInVivoxBuddies = true;	
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri)
+{
+	std::string empty;
+	buddyListEntry *buddy = addBuddy(uri, empty);
+	if(buddy->mDisplayName.empty())
+	{
+		buddy->mNameResolved = false;
+	}
+	return buddy;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
+{
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(uri);
+	
+	if(iter != mBuddyListMap.end())
+	{
+		// Found a matching buddy already in the map.
+		LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
+		result = iter->second;
+	}
+
+	if(!result)
+	{
+		// participant isn't already in one list or the other.
+		LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
+		result = new buddyListEntry(uri);
+		result->mDisplayName = displayName;
+
+		if(IDFromName(uri, result->mUUID)) 
+		{
+			// Extracted UUID from name successfully.
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
+		}
+
+		mBuddyListMap.insert(buddyListMap::value_type(result->mURI, result));
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const std::string &uri)
+{
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(uri);
+	if(iter != mBuddyListMap.end())
+	{
+		result = iter->second;
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const LLUUID &id)
+{
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+	{
+		if(iter->second->mUUID == id)
+		{
+			result = iter->second;
+			break;
+		}
+	}
+	
+	return result;
+}
+
+LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddyByDisplayName(const std::string &name)
+{
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
+	{
+		if(iter->second->mDisplayName == name)
+		{
+			result = iter->second;
+			break;
+		}
+	}
+	
+	return result;
+}
+
+void LLVivoxVoiceClient::deleteBuddy(const std::string &uri)
+{
+	buddyListMap::iterator iter = mBuddyListMap.find(uri);
+	if(iter != mBuddyListMap.end())
+	{
+		LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
+		buddyListEntry *buddy = iter->second;
+		mBuddyListMap.erase(iter);
+		delete buddy;
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
+	}
+	
+}
+
+void LLVivoxVoiceClient::deleteAllBuddies(void)
+{
+	while(!mBuddyListMap.empty())
+	{
+		deleteBuddy(mBuddyListMap.begin()->first);
+	}
+	
+	// Don't want to correlate with friends list when we've emptied the buddy list.
+	mBuddyListMapPopulated = false;
+	
+	// Don't want to correlate with friends list when we've reset the block rules.
+	mBlockRulesListReceived = false;
+	mAutoAcceptRulesListReceived = false;
+}
+
+void LLVivoxVoiceClient::deleteAllBlockRules(void)
+{
+	// Clear the block list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+	{
+		buddy_it->second->mHasBlockListEntry = false;
+	}
+}
+
+void LLVivoxVoiceClient::deleteAllAutoAcceptRules(void)
+{
+	// Clear the auto-accept list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+	{
+		buddy_it->second->mHasAutoAcceptListEntry = false;
+	}
+}
+
+void LLVivoxVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
+{
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(blockMask);
+	if(iter != mBuddyListMap.end())
+	{
+		LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
+		buddy = iter->second;
+	}
+
+	if(buddy == NULL)
+	{
+		LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
+		buddy = addBuddy(blockMask);
+	}
+	
+	if(buddy != NULL)
+	{
+		buddy->mHasBlockListEntry = true;
+	}
+}
+
+void LLVivoxVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
+{
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(autoAcceptMask);
+	if(iter != mBuddyListMap.end())
+	{
+		LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
+		buddy = iter->second;
+	}
+
+	if(buddy == NULL)
+	{
+		LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
+		buddy = addBuddy(autoAcceptMask);
+	}
+
+	if(buddy != NULL)
+	{
+		buddy->mHasAutoAcceptListEntry = true;
+	}
+}
+
+void LLVivoxVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
+{
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mBlockRulesListReceived = true;
+}
+
+void LLVivoxVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
+{
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mAutoAcceptRulesListReceived = true;
+}
+
+void LLVivoxVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+{
+	mParticipantObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
+{
+	mParticipantObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyParticipantObservers()
+{
+	for (observer_set_t::iterator it = mParticipantObservers.begin();
+		it != mParticipantObservers.end();
+		)
+	{
+		LLVoiceClientParticipantObserver* observer = *it;
+		observer->onChange();
+		// In case onChange() deleted an entry.
+		it = mParticipantObservers.upper_bound(observer);
+	}
+}
+
+void LLVivoxVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
+{
+	mStatusObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
+{
+	mStatusObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
+{
+	if(mAudioSession)
+	{
+		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 20713:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; 		break;
+				case 20714:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; 	break;
+				case 20715:
+					//invalid channel, we may be using a set of poorly cached
+					//info
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+				case 1009:
+					//invalid username and password
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+			}
+
+			// Reset the error code to make sure it won't be reused later by accident.
+			mAudioSession->mErrorStatusCode = 0;
+		}
+		else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 404:	// NOT_FOUND
+				case 480:	// TEMPORARILY_UNAVAILABLE
+				case 408:	// REQUEST_TIMEOUT
+					// call failed because other user was not available
+					// treat this as an error case
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+
+					// Reset the error code to make sure it won't be reused later by accident.
+					mAudioSession->mErrorStatusCode = 0;
+				break;
+			}
+		}
+	}
+		
+	LL_DEBUGS("Voice") 
+		<< " " << LLVoiceClientStatusObserver::status2string(status)  
+		<< ", session URI " << getAudioSessionURI() 
+		<< (inSpatialChannel()?", proximal is true":", proximal is false")
+	<< LL_ENDL;
+
+	for (status_observer_set_t::iterator it = mStatusObservers.begin();
+		it != mStatusObservers.end();
+		)
+	{
+		LLVoiceClientStatusObserver* observer = *it;
+		observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
+		// In case onError() deleted an entry.
+		it = mStatusObservers.upper_bound(observer);
+	}
+
+}
+
+void LLVivoxVoiceClient::addObserver(LLFriendObserver* observer)
+{
+	mFriendObservers.insert(observer);
+}
+
+void LLVivoxVoiceClient::removeObserver(LLFriendObserver* observer)
+{
+	mFriendObservers.erase(observer);
+}
+
+void LLVivoxVoiceClient::notifyFriendObservers()
+{
+	for (friend_observer_set_t::iterator it = mFriendObservers.begin();
+		it != mFriendObservers.end();
+		)
+	{
+		LLFriendObserver* observer = *it;
+		it++;
+		// The only friend-related thing we notify on is online/offline transitions.
+		observer->changed(LLFriendObserver::ONLINE);
+	}
+}
+
+void LLVivoxVoiceClient::lookupName(const LLUUID &id)
+{
+	BOOL is_group = FALSE;
+	gCacheName->get(id, is_group, &LLVivoxVoiceClient::onAvatarNameLookup);
+}
+
+//static
+void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
+{
+		std::string name = llformat("%s %s", first.c_str(), last.c_str());
+		LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name);
+	
+}
+
+void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
+{
+	// If the avatar whose name just resolved is on our friends list, resync the friends list.
+	if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
+	{
+		mFriendsListDirty = true;
+	}
+	
+	// Iterate over all sessions.
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+
+		// Check for this user as a participant in this session
+		participantState *participant = session->findParticipantByID(id);
+		if(participant)
+		{
+			// Found -- fill in the name
+			participant->mAccountName = name;
+			// and post a "participants updated" message to listeners later.
+			session->mParticipantsChanged = true;
+		}
+		
+		// Check whether this is a p2p session whose caller name just resolved
+		if(session->mCallerID == id)
+		{
+			// this session's "caller ID" just resolved.  Fill in the name.
+			session->mName = name;
+			if(session->mTextInvitePending)
+			{
+				session->mTextInvitePending = false;
+
+				// We don't need to call gIMMgr->addP2PSession() here.  The first incoming message will create the panel.				
+			}
+			if(session->mVoiceInvitePending)
+			{
+				session->mVoiceInvitePending = false;
+
+				gIMMgr->inviteToSession(
+										LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID),
+										session->mName,
+										session->mCallerID, 
+										session->mName, 
+										IM_SESSION_P2P_INVITE, 
+										LLIMMgr::INVITATION_TYPE_VOICE,
+										session->mHandle);
+			}
+			
+		}
+	}
+}
+
+
+LLVivoxProtocolParser::LLVivoxProtocolParser()
+{
+	parser = NULL;
+	parser = XML_ParserCreate(NULL);
+	
+	reset();
+}
+
+void LLVivoxProtocolParser::reset()
+{
+	responseDepth = 0;
+	ignoringTags = false;
+	accumulateText = false;
+	energy = 0.f;
+	ignoreDepth = 0;
+	isChannel = false;
+	isEvent = false;
+	isLocallyMuted = false;
+	isModeratorMuted = false;
+	isSpeaking = false;
+	participantType = 0;
+	squelchDebugOutput = false;
+	returnCode = -1;
+	state = 0;
+	statusCode = 0;
+	volume = 0;
+	textBuffer.clear();
+	alias.clear();
+	numberOfAliases = 0;
+	applicationString.clear();
+}
+
+//virtual 
+LLVivoxProtocolParser::~LLVivoxProtocolParser()
+{
+	if (parser)
+		XML_ParserFree(parser);
+}
+
+// virtual
+LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
+													  const LLChannelDescriptors& channels,
+													  buffer_ptr_t& buffer,
+													  bool& eos,
+													  LLSD& context,
+													  LLPumpIO* pump)
+{
+	LLBufferStream istr(channels, buffer.get());
+	std::ostringstream ostr;
+	while (istr.good())
+	{
+		char buf[1024];
+		istr.read(buf, sizeof(buf));
+		mInput.append(buf, istr.gcount());
+	}
+	
+	// Look for input delimiter(s) in the input buffer.  If one is found, send the message to the xml parser.
+	int start = 0;
+	int delim;
+	while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
+	{	
+		
+		// Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
+		reset();
+		
+		XML_ParserReset(parser, NULL);
+		XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
+		XML_SetCharacterDataHandler(parser, ExpatCharHandler);
+		XML_SetUserData(parser, this);	
+		XML_Parse(parser, mInput.data() + start, delim - start, false);
+		
+		// If this message isn't set to be squelched, output the raw XML received.
+		if(!squelchDebugOutput)
+		{
+			LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
+		}
+		
+		start = delim + 3;
+	}
+	
+	if(start != 0)
+		mInput = mInput.substr(start);
+	
+	LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
+	
+	if(!LLVivoxVoiceClient::getInstance()->mConnected)
+	{
+		// If voice has been disabled, we just want to close the socket.  This does so.
+		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
+		return STATUS_STOP;
+	}
+	
+	return STATUS_OK;
+}
+
+void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->StartTag(el, attr);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->EndTag(el);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->CharData(s, len);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+
+void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
+{
+	// Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
+	textBuffer.clear();
+	// only accumulate text if we're not ignoring tags.
+	accumulateText = !ignoringTags;
+	
+	if (responseDepth == 0)
+	{	
+		isEvent = !stricmp("Event", tag);
+		
+		if (!stricmp("Response", tag) || isEvent)
+		{
+			// Grab the attributes
+			while (*attr)
+			{
+				const char	*key = *attr++;
+				const char	*value = *attr++;
+				
+				if (!stricmp("requestId", key))
+				{
+					requestId = value;
+				}
+				else if (!stricmp("action", key))
+				{
+					actionString = value;
+				}
+				else if (!stricmp("type", key))
+				{
+					eventTypeString = value;
+				}
+			}
+		}
+		LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
+	}
+	else
+	{
+		if (ignoringTags)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
+			
+			// Ignore the InputXml stuff so we don't get confused
+			if (!stricmp("InputXml", tag))
+			{
+				ignoringTags = true;
+				ignoreDepth = responseDepth;
+				accumulateText = false;
+				
+				LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
+			}
+			else if (!stricmp("CaptureDevices", tag))
+			{
+				LLVivoxVoiceClient::getInstance()->clearCaptureDevices();
+			}			
+			else if (!stricmp("RenderDevices", tag))
+			{
+				LLVivoxVoiceClient::getInstance()->clearRenderDevices();
+			}
+			else if (!stricmp("CaptureDevice", tag))
+			{
+				deviceString.clear();
+			}
+			else if (!stricmp("RenderDevice", tag))
+			{
+				deviceString.clear();
+			}			
+			else if (!stricmp("Buddies", tag))
+			{
+				LLVivoxVoiceClient::getInstance()->deleteAllBuddies();
+			}
+			else if (!stricmp("BlockRules", tag))
+			{
+				LLVivoxVoiceClient::getInstance()->deleteAllBlockRules();
+			}
+			else if (!stricmp("AutoAcceptRules", tag))
+			{
+				LLVivoxVoiceClient::getInstance()->deleteAllAutoAcceptRules();
+			}
+			
+		}
+	}
+	responseDepth++;
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::EndTag(const char *tag)
+{
+	const std::string& string = textBuffer;
+	
+	responseDepth--;
+	
+	if (ignoringTags)
+	{
+		if (ignoreDepth == responseDepth)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
+			ignoringTags = false;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
+	}
+	
+	if (!ignoringTags)
+	{
+		LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		
+		// Closing a tag. Finalize the text we've accumulated and reset
+		if (!stricmp("ReturnCode", tag))
+			returnCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("SessionHandle", tag))
+			sessionHandle = string;
+		else if (!stricmp("SessionGroupHandle", tag))
+			sessionGroupHandle = string;
+		else if (!stricmp("StatusCode", tag))
+			statusCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("StatusString", tag))
+			statusString = string;
+		else if (!stricmp("ParticipantURI", tag))
+			uriString = string;
+		else if (!stricmp("Volume", tag))
+			volume = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Energy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("IsModeratorMuted", tag))
+			isModeratorMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("IsSpeaking", tag))
+			isSpeaking = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Alias", tag))
+			alias = string;
+		else if (!stricmp("NumberOfAliases", tag))
+			numberOfAliases = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Application", tag))
+			applicationString = string;
+		else if (!stricmp("ConnectorHandle", tag))
+			connectorHandle = string;
+		else if (!stricmp("VersionID", tag))
+			versionID = string;
+		else if (!stricmp("AccountHandle", tag))
+			accountHandle = string;
+		else if (!stricmp("State", tag))
+			state = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("URI", tag))
+			uriString = string;
+		else if (!stricmp("IsChannel", tag))
+			isChannel = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Incoming", tag))
+			incoming = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Enabled", tag))
+			enabled = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Name", tag))
+			nameString = string;
+		else if (!stricmp("AudioMedia", tag))
+			audioMediaString = string;
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("DisplayName", tag))
+			displayNameString = string;
+		else if (!stricmp("Device", tag))
+			deviceString = string;		
+		else if (!stricmp("AccountName", tag))
+			nameString = string;
+		else if (!stricmp("ParticipantType", tag))
+			participantType = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("IsLocallyMuted", tag))
+			isLocallyMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("MicEnergy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("ChannelURI", tag))
+			uriString = string;
+		else if (!stricmp("BuddyURI", tag))
+			uriString = string;
+		else if (!stricmp("Presence", tag))
+			statusString = string;
+		else if (!stricmp("CaptureDevice", tag))
+		{
+			LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString);
+		}
+		else if (!stricmp("RenderDevice", tag))
+		{
+			LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString);
+		}
+		else if (!stricmp("Buddy", tag))
+		{
+			LLVivoxVoiceClient::getInstance()->processBuddyListEntry(uriString, displayNameString);
+		}
+		else if (!stricmp("BlockRule", tag))
+		{
+			LLVivoxVoiceClient::getInstance()->addBlockRule(blockMask, presenceOnly);
+		}
+		else if (!stricmp("BlockMask", tag))
+			blockMask = string;
+		else if (!stricmp("PresenceOnly", tag))
+			presenceOnly = string;
+		else if (!stricmp("AutoAcceptRule", tag))
+		{
+			LLVivoxVoiceClient::getInstance()->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
+		}
+		else if (!stricmp("AutoAcceptMask", tag))
+			autoAcceptMask = string;
+		else if (!stricmp("AutoAddAsBuddy", tag))
+			autoAddAsBuddy = string;
+		else if (!stricmp("MessageHeader", tag))
+			messageHeader = string;
+		else if (!stricmp("MessageBody", tag))
+			messageBody = string;
+		else if (!stricmp("NotificationType", tag))
+			notificationType = string;
+		else if (!stricmp("HasText", tag))
+			hasText = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasAudio", tag))
+			hasAudio = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasVideo", tag))
+			hasVideo = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Terminated", tag))
+			terminated = !stricmp(string.c_str(), "true");
+		else if (!stricmp("SubscriptionHandle", tag))
+			subscriptionHandle = string;
+		else if (!stricmp("SubscriptionType", tag))
+			subscriptionType = string;
+		
+	
+		textBuffer.clear();
+		accumulateText= false;
+		
+		if (responseDepth == 0)
+		{
+			// We finished all of the XML, process the data
+			processResponse(tag);
+		}
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::CharData(const char *buffer, int length)
+{
+	/*
+	 This method is called for anything that isn't a tag, which can be text you
+	 want that lies between tags, and a lot of stuff you don't want like file formatting
+	 (tabs, spaces, CR/LF, etc).
+	 
+	 Only copy text if we are in accumulate mode...
+	 */
+	if (accumulateText)
+		textBuffer.append(buffer, length);
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::processResponse(std::string tag)
+{
+	LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
+	
+	// SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success.  This is a change vs. previous SDKs.
+	// According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
+	// so I believe this will give correct behavior.
+	
+	if(returnCode == 0)
+		statusCode = 0;
+	
+	if (isEvent)
+	{
+		const char *eventTypeCstr = eventTypeString.c_str();
+		if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
+		{
+			LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
+		{
+			/*
+			 <Event type="SessionAddedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+			 <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
+			 <IsChannel>true</IsChannel>
+			 <Incoming>false</Incoming>
+			 <ChannelName />
+			 </Event>
+			 */
+			LLVivoxVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
+		{
+			LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
+		{
+			LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
+		{
+			/*
+			 <Event type="MediaStreamUpdatedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+			 <StatusCode>200</StatusCode>
+			 <StatusString>OK</StatusString>
+			 <State>2</State>
+			 <Incoming>false</Incoming>
+			 </Event>
+			 */
+			LLVivoxVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
+		}		
+		else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
+		{
+			/*
+			 <Event type="TextStreamUpdatedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
+			 <Enabled>true</Enabled>
+			 <State>1</State>
+			 <Incoming>true</Incoming>
+			 </Event>
+			 */
+			LLVivoxVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
+		{
+			/* 
+			 <Event type="ParticipantAddedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+			 <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
+			 <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
+			 <DisplayName />
+			 <ParticipantType>0</ParticipantType>
+			 </Event>
+			 */
+			LLVivoxVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
+		{
+			/*
+			 <Event type="ParticipantRemovedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+			 <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
+			 <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
+			 </Event>
+			 */
+			LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
+		{
+			/*
+			 <Event type="ParticipantUpdatedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+			 <ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
+			 <IsModeratorMuted>false</IsModeratorMuted>
+			 <IsSpeaking>true</IsSpeaking>
+			 <Volume>44</Volume>
+			 <Energy>0.0879437</Energy>
+			 </Event>
+			 */
+			
+			// These happen so often that logging them is pretty useless.
+			squelchDebugOutput = true;
+			
+			LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
+		}
+		else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
+		{
+			LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
+		{
+			LLVivoxVoiceClient::getInstance()->buddyPresenceEvent(uriString, alias, statusString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
+		{
+			// The buddy list was updated during parsing.
+			// Need to recheck against the friends list.
+			LLVivoxVoiceClient::getInstance()->buddyListChanged();
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
+		{
+			/*
+			 <Event type="BuddyChangedEvent">
+			 <AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
+			 <BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
+			 <DisplayName>Monroe Tester</DisplayName>
+			 <BuddyData />
+			 <GroupID>0</GroupID>
+			 <ChangeType>Set</ChangeType>
+			 </Event>
+			 */		
+			// TODO: Question: Do we need to process this at all?
+		}
+		else if (!stricmp(eventTypeCstr, "MessageEvent"))  
+		{
+			LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))  
+		{
+			LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
+		}
+		else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))  
+		{
+			LLVivoxVoiceClient::getInstance()->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))  
+		{
+			/*
+			 <Event type="SessionUpdatedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+			 <Uri>sip:confctl-9@bhd.vivox.com</Uri>
+			 <IsMuted>0</IsMuted>
+			 <Volume>50</Volume>
+			 <TransmitEnabled>1</TransmitEnabled>
+			 <IsFocused>0</IsFocused>
+			 <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
+			 <SessionFontID>0</SessionFontID>
+			 </Event>
+			 */
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		
+		else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))  
+		{
+			/*
+			 <Event type="SessionGroupRemovedEvent">
+			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			 </Event>
+			 */
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		else
+		{
+			LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
+		}
+	}
+	else
+	{
+		const char *actionCstr = actionString.c_str();
+		if (!stricmp(actionCstr, "Connector.Create.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
+		}
+		else if (!stricmp(actionCstr, "Account.Login.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
+		}
+		else if (!stricmp(actionCstr, "Session.Create.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "Session.Connect.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.Logout.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->logoutResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->accountListBlockRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
+		{
+			LLVivoxVoiceClient::getInstance()->accountListAutoAcceptRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
+		{
+			// We don't need to process these, but they're so spammy we don't want to log them.
+			squelchDebugOutput = true;
+		}
+		/*
+		 else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
+		 {
+		 LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
+		 }
+		 else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
+		 {
+		 
+		 }
+		 else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
+		 {
+		 
+		 }
+		 */
+	}
+}
+
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
new file mode 100644
index 0000000000..5bf13e6793
--- /dev/null
+++ b/indra/newview/llvoicevivox.h
@@ -0,0 +1,905 @@
+/** 
+ * @file llvoicevivox.h
+ * @brief Declaration of LLDiamondwareVoiceClient class which is the interface to the voice client process.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+#ifndef LL_VOICE_VIVOX_H
+#define LL_VOICE_VIVOX_H
+
+class LLVOAvatar;
+class LLVivoxProtocolParser;
+
+#include "lliopipe.h"
+#include "llpumpio.h"
+#include "llchainio.h"
+#include "lliosocket.h"
+#include "v3math.h"
+#include "llframetimer.h"
+#include "llviewerregion.h"
+#include "llcallingcard.h"   // for LLFriendObserver
+
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llvoiceclient.h"
+
+
+class LLVivoxVoiceAccountProvisionResponder;
+class LLVivoxVoiceClientMuteListObserver;
+class LLVivoxVoiceClientFriendsObserver;	
+
+
+class LLVivoxVoiceClientParticipantObserver
+{
+public:
+	virtual ~LLVivoxVoiceClientParticipantObserver() { }
+	virtual void onChange() = 0;
+};
+
+
+class LLVivoxVoiceClient: public LLSingleton<LLVivoxVoiceClient>, virtual public LLVoiceModuleInterface
+{
+	LOG_CLASS(LLVivoxVoiceClient);
+public:
+	LLVivoxVoiceClient();	
+	virtual ~LLVivoxVoiceClient();
+	
+	
+	/// @name LLVoiceModuleInterface virtual implementations
+	///  @see LLVoiceModuleInterface
+	//@{
+	virtual void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
+	virtual void terminate();	// Call this to clean up during shutdown
+	
+	virtual const LLVoiceVersionInfo& getVersion();
+	
+	virtual void updateSettings(); // call after loading settings and whenever they change
+	
+	/////////////////////
+	/// @name Tuning
+	//@{
+	virtual void tuningStart();
+	virtual void tuningStop();
+	virtual bool inTuningMode();
+	
+	virtual void tuningSetMicVolume(float volume);
+	virtual void tuningSetSpeakerVolume(float volume);
+	virtual float tuningGetEnergy(void);
+	//@}
+	
+	/////////////////////
+	/// @name Devices
+	//@{
+	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+	// i.e. when the daemon is running and connected, and the device lists are populated.
+	virtual bool deviceSettingsAvailable();
+	
+	// Requery the vivox daemon for the current list of input/output devices.
+	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+	// (use this if you want to know when it's done).
+	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+	virtual void refreshDeviceLists(bool clearCurrentList = true);
+	
+	virtual void setCaptureDevice(const std::string& name);
+	virtual void setRenderDevice(const std::string& name);
+	
+	virtual LLVoiceDeviceList& getCaptureDevices();
+	virtual LLVoiceDeviceList& getRenderDevices();
+	//@}	
+	
+	virtual std::vector<LLUUID> getParticipantList(void);
+	// Send a text message to the specified user, initiating the session if necessary.
+	virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
+	
+	// close any existing text IM session with the specified user
+	virtual void endUserIMSession(const LLUUID &uuid);
+	
+	// Returns true if calling back the session URI after the session has closed is possible.
+	// Currently this will be false only for PSTN P2P calls.		
+	// NOTE: this will return true if the session can't be found. 
+	virtual BOOL isSessionCallBackPossible(const LLUUID &session_id);
+	
+	// Returns true if the session can accepte text IM's.
+	// Currently this will be false only for PSTN P2P calls.
+	// NOTE: this will return true if the session can't be found. 
+	virtual BOOL isSessionTextIMPossible(const LLUUID &session_id);
+	
+	
+	////////////////////////////
+	/// @name Channel stuff
+	//@{
+	// returns true iff the user is currently in a proximal (local spatial) channel.
+	// Note that gestures should only fire if this returns true.
+	virtual bool inProximalChannel();
+	
+	virtual void setNonSpatialChannel(const std::string &uri,
+									  const std::string &credentials);
+	
+	virtual void setSpatialChannel(const std::string &uri,
+								   const std::string &credentials);
+	
+	virtual void leaveNonSpatialChannel();
+	
+	virtual void leaveChannel(void);	
+	
+	// Returns the URI of the current channel, or an empty string if not currently in a channel.
+	// NOTE that it will return an empty string if it's in the process of joining a channel.
+	virtual std::string getCurrentChannel();
+	//@}
+	
+	
+	//////////////////////////
+	/// @name invitations
+	//@{
+	// start a voice channel with the specified user
+	virtual void callUser(const LLUUID &uuid);	
+	virtual bool answerInvite(std::string &channelHandle);
+	virtual void declineInvite(std::string &channelHandle);
+	//@}
+	
+	/////////////////////////
+	/// @name Volume/gain
+	//@{
+	virtual void setVoiceVolume(F32 volume);
+	virtual void setMicGain(F32 volume);
+	//@}
+	
+	/////////////////////////
+	/// @name enable disable voice and features
+	//@{
+	virtual bool voiceEnabled();
+	virtual void setVoiceEnabled(bool enabled);
+	virtual BOOL lipSyncEnabled();	
+	virtual void setLipSyncEnabled(BOOL enabled);
+	virtual void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+	//@}
+	
+	////////////////////////
+	/// @name PTT
+	//@{
+	virtual void setUserPTTState(bool ptt);
+	virtual bool getUserPTTState();
+	virtual void setUsePTT(bool usePTT);
+	virtual void setPTTIsToggle(bool PTTIsToggle);
+	virtual bool getPTTIsToggle();
+	virtual void inputUserControlState(bool down);  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs	
+	virtual void toggleUserPTTState(void);
+	
+	virtual void keyDown(KEY key, MASK mask);
+	virtual void keyUp(KEY key, MASK mask);
+	virtual void middleMouseState(bool down);
+	//@}
+	
+	//////////////////////////
+	/// @name nearby speaker accessors
+	//@{
+	virtual BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
+	virtual std::string getDisplayName(const LLUUID& id);
+	virtual BOOL isOnlineSIP(const LLUUID &id);
+	virtual BOOL isParticipantAvatar(const LLUUID &id);
+	virtual BOOL getIsSpeaking(const LLUUID& id);
+	virtual BOOL getIsModeratorMuted(const LLUUID& id);
+	virtual F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
+	virtual BOOL getOnMuteList(const LLUUID& id);
+	virtual F32 getUserVolume(const LLUUID& id);
+	virtual void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)	
+	//@}
+	
+	// authorize the user
+	virtual void userAuthorized(const std::string& user_id,
+								const LLUUID &agentID);
+	
+	//////////////////////////////
+	/// @name Status notification
+	//@{
+	virtual void addObserver(LLVoiceClientStatusObserver* observer);
+	virtual void removeObserver(LLVoiceClientStatusObserver* observer);
+	virtual void addObserver(LLFriendObserver* observer);
+	virtual void removeObserver(LLFriendObserver* observer);		
+	virtual void addObserver(LLVoiceClientParticipantObserver* observer);
+	virtual void removeObserver(LLVoiceClientParticipantObserver* observer);
+	
+	
+	
+	//@}
+	
+	virtual std::string sipURIFromID(const LLUUID &id);
+	//@}
+
+				
+protected:
+	//////////////////////
+	// Vivox Specific definitions	
+	
+	friend class LLVivoxVoiceAccountProvisionResponder;
+	friend class LLVivoxVoiceClientMuteListObserver;
+	friend class LLVivoxVoiceClientFriendsObserver;	
+	
+	enum streamState
+	{
+		streamStateUnknown = 0,
+		streamStateIdle = 1,
+		streamStateConnected = 2,
+		streamStateRinging = 3,
+	};	
+	struct participantState
+	{
+	public:
+		participantState(const std::string &uri);
+		
+		bool updateMuteState();
+		bool isAvatar();
+		
+		std::string mURI;
+		LLUUID mAvatarID;
+		std::string mAccountName;
+		std::string mDisplayName;
+		LLFrameTimer mSpeakingTimeout;
+		F32	mLastSpokeTimestamp;
+		F32 mPower;
+		int mVolume;
+		std::string mGroupID;
+		int mUserVolume;
+		bool mPTT;
+		bool mIsSpeaking;
+		bool mIsModeratorMuted;
+		bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
+		bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
+		bool mAvatarIDValid;
+		bool mIsSelf;
+	};
+	
+	typedef std::map<const std::string, participantState*> participantMap;
+	
+	typedef std::map<const LLUUID, participantState*> participantUUIDMap;
+	
+	struct sessionState
+	{
+	public:
+		sessionState();
+		~sessionState();
+		
+		participantState *addParticipant(const std::string &uri);
+		// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
+		// Take care not to use the pointer again after that.
+		void removeParticipant(participantState *participant);
+		void removeAllParticipants();
+		
+		participantState *findParticipant(const std::string &uri);
+		participantState *findParticipantByID(const LLUUID& id);
+		
+		bool isCallBackPossible();
+		bool isTextIMPossible();
+		
+		std::string mHandle;
+		std::string mGroupHandle;
+		std::string mSIPURI;
+		std::string mAlias;
+		std::string mName;
+		std::string mAlternateSIPURI;
+		std::string mHash;			// Channel password
+		std::string mErrorStatusString;
+		std::queue<std::string> mTextMsgQueue;
+		
+		LLUUID		mIMSessionID;
+		LLUUID		mCallerID;
+		int			mErrorStatusCode;
+		int			mMediaStreamState;
+		int			mTextStreamState;
+		bool		mCreateInProgress;	// True if a Session.Create has been sent for this session and no response has been received yet.
+		bool		mMediaConnectInProgress;	// True if a Session.MediaConnect has been sent for this session and no response has been received yet.
+		bool		mVoiceInvitePending;	// True if a voice invite is pending for this session (usually waiting on a name lookup)
+		bool		mTextInvitePending;		// True if a text invite is pending for this session (usually waiting on a name lookup)
+		bool		mSynthesizedCallerID;	// True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
+		bool		mIsChannel;	// True for both group and spatial channels (false for p2p, PSTN)
+		bool		mIsSpatial;	// True for spatial channels
+		bool		mIsP2P;
+		bool		mIncoming;
+		bool		mVoiceEnabled;
+		bool		mReconnect;	// Whether we should try to reconnect to this session if it's dropped
+		// Set to true when the mute state of someone in the participant list changes.
+		// The code will have to walk the list to find the changed participant(s).
+		bool		mVolumeDirty;
+		
+		bool		mParticipantsChanged;
+		participantMap mParticipantsByURI;
+		participantUUIDMap mParticipantsByUUID;
+	};
+
+	// internal state for a simple state machine.  This is used to deal with the asynchronous nature of some of the messages.
+	// Note: if you change this list, please make corresponding changes to LLVivoxVoiceClient::state2string().
+	enum state
+	{
+		stateDisableCleanup,
+		stateDisabled,				// Voice is turned off.
+		stateStart,					// Class is initialized, socket is created
+		stateDaemonLaunched,		// Daemon has been launched
+		stateConnecting,			// connect() call has been issued
+		stateConnected,				// connection to the daemon has been made, send some initial setup commands.
+		stateIdle,					// socket is connected, ready for messaging
+		stateMicTuningStart,
+		stateMicTuningRunning,		
+		stateMicTuningStop,
+		stateConnectorStart,		// connector needs to be started
+		stateConnectorStarting,		// waiting for connector handle
+		stateConnectorStarted,		// connector handle received
+		stateLoginRetry,			// need to retry login (failed due to changing password)
+		stateLoginRetryWait,		// waiting for retry timer
+		stateNeedsLogin,			// send login request
+		stateLoggingIn,				// waiting for account handle
+		stateLoggedIn,				// account handle received
+		stateCreatingSessionGroup,	// Creating the main session group
+		stateNoChannel,				// 
+		stateJoiningSession,		// waiting for session handle
+		stateSessionJoined,			// session handle received
+		stateRunning,				// in session, steady state
+		stateLeavingSession,		// waiting for terminate session response
+		stateSessionTerminated,		// waiting for terminate session response
+		
+		stateLoggingOut,			// waiting for logout response
+		stateLoggedOut,				// logout response received
+		stateConnectorStopping,		// waiting for connector stop
+		stateConnectorStopped,		// connector stop received
+		
+		// We go to this state if the login fails because the account needs to be provisioned.
+		
+		// error states.  No way to recover from these yet.
+		stateConnectorFailed,
+		stateConnectorFailedWaiting,
+		stateLoginFailed,
+		stateLoginFailedWaiting,
+		stateJoinSessionFailed,
+		stateJoinSessionFailedWaiting,
+		
+		stateJail					// Go here when all else has failed.  Nothing will be retried, we're done.
+	};
+	
+	typedef std::map<std::string, sessionState*> sessionMap;
+	
+	
+	
+	///////////////////////////////////////////////////////
+	// Private Member Functions
+	//////////////////////////////////////////////////////
+	
+	//////////////////////////////
+	/// @name TVC/Server management and communication
+	//@{
+	// Call this if the connection to the daemon terminates unexpectedly.  It will attempt to reset everything and relaunch.
+	void daemonDied();
+	
+	// Call this if we're just giving up on voice (can't provision an account, etc.).  It will clean up and go away.
+	void giveUp();	
+	
+	// write to the tvc
+	bool writeString(const std::string &str);
+	
+	void connectorCreate();
+	void connectorShutdown();	
+	void closeSocket(void);	
+	
+	void requestVoiceAccountProvision(S32 retries = 3);
+	void login(
+			   const std::string& account_name,
+			   const std::string& password,
+			   const std::string& voice_sip_uri_hostname,
+			   const std::string& voice_account_server_uri);
+	void loginSendMessage();
+	void logout();
+	void logoutSendMessage();	
+	
+	
+	//@}
+	
+	//------------------------------------
+	// tuning
+	
+	void tuningRenderStartSendMessage(const std::string& name, bool loop);
+	void tuningRenderStopSendMessage();
+
+	void tuningCaptureStartSendMessage(int duration);
+	void tuningCaptureStopSendMessage();
+
+	bool inTuningStates();
+
+	//----------------------------------
+	// devices
+	void clearCaptureDevices();
+	void addCaptureDevice(const std::string& name);
+	void clearRenderDevices();
+	void addRenderDevice(const std::string& name);	
+	void buildSetAudioDevices(std::ostringstream &stream);
+	
+	void getCaptureDevicesSendMessage();
+	void getRenderDevicesSendMessage();
+	
+	// local audio updates
+	void buildLocalAudioUpdates(std::ostringstream &stream);		
+
+
+	/////////////////////////////
+	// Response/Event handlers
+	void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
+	void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
+	void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+	void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+	void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
+	void logoutResponse(int statusCode, std::string &statusString);
+	void connectorShutdownResponse(int statusCode, std::string &statusString);
+
+	void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
+	void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
+	void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
+	void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
+	void sessionGroupAddedEvent(std::string &sessionGroupHandle);
+	void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
+	void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
+	void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
+	void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+	void auxAudioPropertiesEvent(F32 energy);
+	void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
+	void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
+	void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
+	void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
+	
+	void buddyListChanged();
+	void muteListChanged();
+	void updateFriends(U32 mask);
+		
+	/////////////////////////////
+	// Sending updates of current state
+	void updatePosition(void);
+	void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+	void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+	bool channelFromRegion(LLViewerRegion *region, std::string &name);
+
+	void setEarLocation(S32 loc);
+
+	
+	/////////////////////////////
+	// Accessors for data related to nearby speakers
+
+	// MBW -- XXX -- Not sure how to get this data out of the TVC
+	BOOL getUsingPTT(const LLUUID& id);
+	std::string getGroupID(const LLUUID& id);		// group ID if the user is in group chat (empty string if not applicable)
+
+	/////////////////////////////
+	BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
+										// Use this to determine whether to show a "no speech" icon in the menu bar.
+		
+	
+	// PTT
+	void setPTTKey(std::string &key);
+	
+	/////////////////////////////
+	// Recording controls
+	void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+	void recordingLoopSave(const std::string& filename);
+	void recordingStop();
+	
+	// Playback controls
+	void filePlaybackStart(const std::string& filename);
+	void filePlaybackStop();
+	void filePlaybackSetPaused(bool paused);
+	void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+	
+	participantState *findParticipantByID(const LLUUID& id);
+	
+
+	////////////////////////////////////////
+	// voice sessions.
+	typedef std::set<sessionState*> sessionSet;
+			
+	typedef sessionSet::iterator sessionIterator;
+	sessionIterator sessionsBegin(void);
+	sessionIterator sessionsEnd(void);
+
+	sessionState *findSession(const std::string &handle);
+	sessionState *findSessionBeingCreatedByURI(const std::string &uri);
+	sessionState *findSession(const LLUUID &participant_id);
+	sessionState *findSessionByCreateID(const std::string &create_id);
+	
+	sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
+	void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
+	void setSessionURI(sessionState *session, const std::string &uri);
+	void deleteSession(sessionState *session);
+	void deleteAllSessions(void);
+
+	void verifySessionState(void);
+
+	void joinedAudioSession(sessionState *session);
+	void leftAudioSession(sessionState *session);
+
+	// This is called in several places where the session _may_ need to be deleted.
+	// It contains logic for whether to delete the session or keep it around.
+	void reapSession(sessionState *session);
+	
+	// Returns true if the session seems to indicate we've moved to a region on a different voice server
+	bool sessionNeedsRelog(sessionState *session);
+	
+	
+	//////////////////////////////////////
+	// buddy list stuff, needed for SLIM later
+	struct buddyListEntry
+	{
+		buddyListEntry(const std::string &uri);
+		std::string mURI;
+		std::string mDisplayName;
+		LLUUID	mUUID;
+		bool mOnlineSL;
+		bool mOnlineSLim;
+		bool mCanSeeMeOnline;
+		bool mHasBlockListEntry;
+		bool mHasAutoAcceptListEntry;
+		bool mNameResolved;
+		bool mInSLFriends;
+		bool mInVivoxBuddies;
+		bool mNeedsNameUpdate;
+	};
+
+	typedef std::map<std::string, buddyListEntry*> buddyListMap;
+	
+	// This should be called when parsing a buddy list entry sent by SLVoice.		
+	void processBuddyListEntry(const std::string &uri, const std::string &displayName);
+
+	buddyListEntry *addBuddy(const std::string &uri);
+	buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
+	buddyListEntry *findBuddy(const std::string &uri);
+	buddyListEntry *findBuddy(const LLUUID &id);
+	buddyListEntry *findBuddyByDisplayName(const std::string &name);
+	void deleteBuddy(const std::string &uri);
+	void deleteAllBuddies(void);
+
+	void deleteAllBlockRules(void);
+	void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
+	void deleteAllAutoAcceptRules(void);
+	void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
+	void accountListBlockRulesResponse(int statusCode, const std::string &statusString);						
+	void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);						
+	
+	/////////////////////////////
+	// session control messages
+
+	void accountListBlockRulesSendMessage();
+	void accountListAutoAcceptRulesSendMessage();
+	
+	void sessionGroupCreateSendMessage();
+	void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+	void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+	void sessionMediaConnectSendMessage(sessionState *session);		// just joins the audio session
+	void sessionTextConnectSendMessage(sessionState *session);		// just joins the text session
+	void sessionTerminateSendMessage(sessionState *session);
+	void sessionGroupTerminateSendMessage(sessionState *session);
+	void sessionMediaDisconnectSendMessage(sessionState *session);
+	void sessionTextDisconnectSendMessage(sessionState *session);
+
+	// Pokes the state machine to leave the audio session next time around.
+	void sessionTerminate();	
+	
+	// Pokes the state machine to shut down the connector and restart it.
+	void requestRelog();
+	
+	// Does the actual work to get out of the audio session
+	void leaveAudioSession();
+	
+	void lookupName(const LLUUID &id);
+	static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
+	void avatarNameResolved(const LLUUID &id, const std::string &name);
+		
+private:
+	LLVoiceVersionInfo mVoiceVersion;
+		
+	state mState;
+	bool mSessionTerminateRequested;
+	bool mRelogRequested;
+	
+	void setState(state inState);
+	state getState(void)  { return mState; };
+	std::string state2string(state inState);
+	
+	void stateMachine();
+	static void idle(void *user_data);
+	
+	LLHost mDaemonHost;
+	LLSocket::ptr_t mSocket;
+	bool mConnected;
+	
+	
+	LLPumpIO *mPump;
+	friend class LLVivoxProtocolParser;
+	
+	std::string mAccountName;
+	std::string mAccountPassword;
+	std::string mAccountDisplayName;
+			
+	bool mTuningMode;
+	float mTuningEnergy;
+	std::string mTuningAudioFile;
+	int mTuningMicVolume;
+	bool mTuningMicVolumeDirty;
+	int mTuningSpeakerVolume;
+	bool mTuningSpeakerVolumeDirty;
+	state mTuningExitState;					// state to return to when we leave tuning mode.
+	
+	std::string mSpatialSessionURI;
+	std::string mSpatialSessionCredentials;
+
+	std::string mMainSessionGroupHandle; // handle of the "main" session group.
+	
+	std::string mChannelName;			// Name of the channel to be looked up 
+	bool mAreaVoiceDisabled;
+	sessionState *mAudioSession;		// Session state for the current audio session
+	bool mAudioSessionChanged;			// set to true when the above pointer gets changed, so observers can be notified.
+
+	sessionState *mNextAudioSession;	// Session state for the audio session we're trying to join
+
+//		std::string mSessionURI;			// URI of the session we're in.
+//		std::string mSessionHandle;		// returned by ?
+	
+	S32 mCurrentParcelLocalID;			// Used to detect parcel boundary crossings
+	std::string mCurrentRegionName;		// Used to detect parcel boundary crossings
+	
+	std::string mConnectorHandle;	// returned by "Create Connector" message
+	std::string mAccountHandle;		// returned by login message		
+	int 		mNumberOfAliases;
+	U32 mCommandCookie;
+
+	std::string mVoiceAccountServerURI;
+	std::string mVoiceSIPURIHostName;
+	
+	int mLoginRetryCount;
+	
+	sessionMap mSessionsByHandle;				// Active sessions, indexed by session handle.  Sessions which are being initiated may not be in this map.
+	sessionSet mSessions;						// All sessions, not indexed.  This is the canonical session list.
+	
+	bool mBuddyListMapPopulated;
+	bool mBlockRulesListReceived;
+	bool mAutoAcceptRulesListReceived;
+	buddyListMap mBuddyListMap;
+	
+	LLVoiceDeviceList mCaptureDevices;
+	LLVoiceDeviceList mRenderDevices;
+
+	std::string mCaptureDevice;
+	std::string mRenderDevice;
+	bool mCaptureDeviceDirty;
+	bool mRenderDeviceDirty;
+	
+	// This should be called when the code detects we have changed parcels.
+	// It initiates the call to the server that gets the parcel channel.
+	void parcelChanged();
+	
+	void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
+	void joinSession(sessionState *session);
+	
+	std::string nameFromAvatar(LLVOAvatar *avatar);
+	std::string nameFromID(const LLUUID &id);
+	bool IDFromName(const std::string name, LLUUID &uuid);
+	std::string displayNameFromAvatar(LLVOAvatar *avatar);
+	std::string sipURIFromAvatar(LLVOAvatar *avatar);
+	std::string sipURIFromName(std::string &name);
+	
+	// Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
+	std::string nameFromsipURI(const std::string &uri);		
+
+	bool inSpatialChannel(void);
+	std::string getAudioSessionURI();
+	std::string getAudioSessionHandle();
+			
+	void sendPositionalUpdate(void);
+	
+	void buildSetCaptureDevice(std::ostringstream &stream);
+	void buildSetRenderDevice(std::ostringstream &stream);
+	
+	void clearAllLists();
+	void checkFriend(const LLUUID& id);
+	void sendFriendsListUpdates();
+
+	// start a text IM session with the specified user
+	// This will be asynchronous, the session may be established at a future time.
+	sessionState* startUserIMSession(const LLUUID& uuid);
+	void sendQueuedTextMessages(sessionState *session);
+	
+	void enforceTether(void);
+	
+	bool		mSpatialCoordsDirty;
+	
+	LLVector3d	mCameraPosition;
+	LLVector3d	mCameraRequestedPosition;
+	LLVector3	mCameraVelocity;
+	LLMatrix3	mCameraRot;
+
+	LLVector3d	mAvatarPosition;
+	LLVector3	mAvatarVelocity;
+	LLMatrix3	mAvatarRot;
+	
+	bool		mPTTDirty;
+	bool		mPTT;
+	
+	bool		mUsePTT;
+	bool		mPTTIsMiddleMouse;
+	KEY			mPTTKey;
+	bool		mPTTIsToggle;
+	bool		mUserPTTState;
+	bool		mMuteMic;
+			
+	// Set to true when the friends list is known to have changed.
+	bool		mFriendsListDirty;
+	
+	enum
+	{
+		earLocCamera = 0,		// ear at camera
+		earLocAvatar,			// ear at avatar
+		earLocMixed				// ear at avatar location/camera direction
+	};
+	
+	S32			mEarLocation;  
+	
+	bool		mSpeakerVolumeDirty;
+	bool		mSpeakerMuteDirty;
+	int			mSpeakerVolume;
+
+	int			mMicVolume;
+	bool		mMicVolumeDirty;
+	
+	bool		mVoiceEnabled;
+	bool		mWriteInProgress;
+	std::string mWriteString;
+	size_t		mWriteOffset;
+	
+	LLTimer		mUpdateTimer;
+	
+	BOOL		mLipSyncEnabled;
+
+	typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
+	observer_set_t mParticipantObservers;
+
+	void notifyParticipantObservers();
+
+	typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
+	status_observer_set_t mStatusObservers;
+	
+	void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
+
+	typedef std::set<LLFriendObserver*> friend_observer_set_t;
+	friend_observer_set_t mFriendObservers;
+	void notifyFriendObservers();
+};
+
+/** 
+ * @class LLVivoxProtocolParser
+ * @brief This class helps construct new LLIOPipe specializations
+ * @see LLIOPipe
+ *
+ * THOROUGH_DESCRIPTION
+ */
+class LLVivoxProtocolParser : public LLIOPipe
+{
+	LOG_CLASS(LLVivoxProtocolParser);
+public:
+	LLVivoxProtocolParser();
+	virtual ~LLVivoxProtocolParser();
+	
+protected:
+	/* @name LLIOPipe virtual implementations
+	 */
+	//@{
+	/** 
+	 * @brief Process the data in buffer
+	 */
+	virtual EStatus process_impl(
+								 const LLChannelDescriptors& channels,
+								 buffer_ptr_t& buffer,
+								 bool& eos,
+								 LLSD& context,
+								 LLPumpIO* pump);
+	//@}
+	
+	std::string 	mInput;
+	
+	// Expat control members
+	XML_Parser		parser;
+	int				responseDepth;
+	bool			ignoringTags;
+	bool			isEvent;
+	int				ignoreDepth;
+	
+	// Members for processing responses. The values are transient and only valid within a call to processResponse().
+	bool			squelchDebugOutput;
+	int				returnCode;
+	int				statusCode;
+	std::string		statusString;
+	std::string		requestId;
+	std::string		actionString;
+	std::string		connectorHandle;
+	std::string		versionID;
+	std::string		accountHandle;
+	std::string		sessionHandle;
+	std::string		sessionGroupHandle;
+	std::string		alias;
+	std::string		applicationString;
+	
+	// Members for processing events. The values are transient and only valid within a call to processResponse().
+	std::string		eventTypeString;
+	int				state;
+	std::string		uriString;
+	bool			isChannel;
+	bool			incoming;
+	bool			enabled;
+	std::string		nameString;
+	std::string		audioMediaString;
+	std::string     deviceString;
+	std::string		displayNameString;
+	int				participantType;
+	bool			isLocallyMuted;
+	bool			isModeratorMuted;
+	bool			isSpeaking;
+	int				volume;
+	F32				energy;
+	std::string		messageHeader;
+	std::string		messageBody;
+	std::string		notificationType;
+	bool			hasText;
+	bool			hasAudio;
+	bool			hasVideo;
+	bool			terminated;
+	std::string		blockMask;
+	std::string		presenceOnly;
+	std::string		autoAcceptMask;
+	std::string		autoAddAsBuddy;
+	int				numberOfAliases;
+	std::string		subscriptionHandle;
+	std::string		subscriptionType;
+	
+	
+	// Members for processing text between tags
+	std::string		textBuffer;
+	bool			accumulateText;
+	
+	void			reset();
+	
+	void			processResponse(std::string tag);
+	
+	static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
+	static void XMLCALL ExpatEndTag(void *data, const char *el);
+	static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
+	
+	void			StartTag(const char *tag, const char **attr);
+	void			EndTag(const char *tag);
+	void			CharData(const char *buffer, int length);
+	
+};
+
+
+#endif //LL_VIVOX_VOICE_CLIENT_H
+
+
+
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index fac7aef690..cb5cec7bdb 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -49,7 +49,7 @@ libcurl Version: [LIBCURL_VERSION]
 J2C Decoder Version: [J2C_VERSION]
 Audio Driver Version: [AUDIO_DRIVER_VERSION]
 Qt Webkit Version: [QT_WEBKIT_VERSION]
-Vivox Version: [VIVOX_VERSION]
+Voice Server Version: [VOICE_VERSION]
 </floater.string>
   <floater.string
      name="none">
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 0db18525d7..1917fd9b5c 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -397,6 +397,15 @@ class WindowsManifest(ViewerManifest):
 
         self.disable_manifest_check()
 
+        # Diamondware Runtimes
+        if self.prefix(src="diamondware-runtime/i686-win32", dst=""):
+            self.path("SLVoice_dwTVC.exe")
+            self.path("libcurl.dll")
+            self.path("libeay32.dll")
+            self.path("ssleay32.dll")
+            self.path("zlib1.dll")
+            self.end_prefix()
+
         # pull in the crash logger and updater from other projects
         # tag:"crash-logger" here as a cue to the exporter
         self.path(src='../win_crash_logger/%s/windows-crash-logger.exe' % self.args['configuration'],
@@ -606,6 +615,9 @@ class DarwinManifest(ViewerManifest):
                 self.path("vivox-runtime/universal-darwin/libvivoxsdk.dylib", "libvivoxsdk.dylib")
                 self.path("vivox-runtime/universal-darwin/libvivoxplatform.dylib", "libvivoxplatform.dylib")
                 self.path("vivox-runtime/universal-darwin/SLVoice", "SLVoice")
+                # DiamondWare runtime                                           
+                self.path("diamondware-runtime/universal-darwin/SLVoice_dwTVC","SLVoice_dwTVC")
+                self.path("diamondware-runtime/universal-darwin/libfmodex.dylib", "libfmodex.dylib")
 
                 libdir = "../../libraries/universal-darwin/lib_release"
                 dylibs = {}
@@ -898,6 +910,11 @@ class Linux_i686Manifest(LinuxManifest):
                     pass
             self.end_prefix("lib")
 
+            # Diamondware runtimes
+            if self.prefix(src="diamondware-runtime/i686-linux", dst="bin"):
+                    self.path("SLVoice_dwTVC")
+                    self.end_prefix()
+
             # Vivox runtimes
             if self.prefix(src="vivox-runtime/i686-linux", dst="bin"):
                     self.path("SLVoice")
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index 452930a3b3..8af7453bd6 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -131,6 +131,7 @@ void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
     std::string coroname = 
         LLCoros::instance().launch("LLLogin::Impl::login_",
                                    boost::bind(&Impl::login_, this, _1, uri, login_params));
+    LL_DEBUGS("LLLogin") << " connected with  uri '" << uri << "', login_params " << login_params << LL_ENDL;	
 }
 
 void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params)
-- 
cgit v1.2.3


From 1718a41c2f0ee0f45b5f7811978469c0e9c2a4ce Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Wed, 24 Feb 2010 17:09:15 -0800
Subject: remove windows line endings

---
 indra/newview/llspeakingindicatormanager.h | 68 +++++++++++++++---------------
 1 file changed, 34 insertions(+), 34 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llspeakingindicatormanager.h b/indra/newview/llspeakingindicatormanager.h
index f32c70bd73..0154b8fe4e 100644
--- a/indra/newview/llspeakingindicatormanager.h
+++ b/indra/newview/llspeakingindicatormanager.h
@@ -1,37 +1,37 @@
-/** 
- * @file llspeakingindicatormanager.h
- * @author Mike Antipov
- * @brief Interfeace of LLSpeackerIndicator class to be processed depend on avatars are in the same voice channel.
- * Also register/unregister methods for this class are declared
- *
- * $LicenseInfo:firstyear=2010&license=viewergpl$
- * 
- * Copyright (c) 2010, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
+/**
+ * @file llspeakingindicatormanager.h
+ * @author Mike Antipov
+ * @brief Interfeace of LLSpeackerIndicator class to be processed depend on avatars are in the same voice channel.
+ * Also register/unregister methods for this class are declared
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
 #ifndef LL_LLSPEAKINGINDICATORMANAGER_H
 #define LL_LLSPEAKINGINDICATORMANAGER_H
 
-- 
cgit v1.2.3


From 615afb52a779e0d3065c7696f5ea7d56126a7462 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Wed, 24 Feb 2010 17:15:40 -0800
Subject: remove DOS newlines

---
 .../skins/default/xui/en/floater_im_container.xml  | 70 +++++++++++-----------
 1 file changed, 35 insertions(+), 35 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_im_container.xml b/indra/newview/skins/default/xui/en/floater_im_container.xml
index ccbba61ddf..72a01f5652 100644
--- a/indra/newview/skins/default/xui/en/floater_im_container.xml
+++ b/indra/newview/skins/default/xui/en/floater_im_container.xml
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<multi_floater
- can_minimize="false"
- can_resize="true"
- height="390"
- layout="topleft"
- name="floater_im_box"
- help_topic="floater_im_box"
- save_rect="true"
- save_visibility="true"
- single_instance="true"
- title="CONVERSATIONS"
- width="392">
-    <tab_container
-     follows="left|right|top|bottom"
-     height="390"
-     layout="topleft"
-     left="1"
-     name="im_box_tab_container"
-     tab_position="bottom"
-     tab_width="80"
-     top="0"
-     width="390" />
-    <icon
-     color="DefaultShadowLight"
-     enabled="false"
-     follows="left|right|bottom"
-     height="17"
-     image_name="tabarea.tga"
-     layout="bottomleft"
-     left="1"
-     name="im_box_tab_container_icon"
-     bottom="10"
-     width="390" />
-</multi_floater>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<multi_floater
+ can_minimize="false"
+ can_resize="true"
+ height="390"
+ layout="topleft"
+ name="floater_im_box"
+ help_topic="floater_im_box"
+ save_rect="true"
+ save_visibility="true"
+ single_instance="true"
+ title="CONVERSATIONS"
+ width="392">
+    <tab_container
+     follows="left|right|top|bottom"
+     height="390"
+     layout="topleft"
+     left="1"
+     name="im_box_tab_container"
+     tab_position="bottom"
+     tab_width="80"
+     top="0"
+     width="390" />
+    <icon
+     color="DefaultShadowLight"
+     enabled="false"
+     follows="left|right|bottom"
+     height="17"
+     image_name="tabarea.tga"
+     layout="bottomleft"
+     left="1"
+     name="im_box_tab_container_icon"
+     bottom="10"
+     width="390" />
+</multi_floater>
-- 
cgit v1.2.3


From c70d0f0ee280f5b417426154290a752489cded13 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Tue, 8 Dec 2009 00:00:51 -0800
Subject: DEV-42996 GIAB: configuring via CLI tools corrupts viewer certs Added
 authority key identifier/subject key identifier checking. Whenever a new cert
 was created, a new private key was also created.  Typically you get a new key
 identifier with that private key which is written to the child cert.  The
 child cert can then find the appropriate parent cert for validation via
 subject key identifier.

---
 indra/newview/llsecapi.h             |  6 +++
 indra/newview/llsechandler_basic.cpp | 75 +++++++++++++++++++++++++++++++++++-
 2 files changed, 80 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
index b11563ef62..5211dc2699 100644
--- a/indra/newview/llsecapi.h
+++ b/indra/newview/llsecapi.h
@@ -78,6 +78,12 @@
 #define CERT_EXTENDED_KEY_USAGE "extendedKeyUsage"
 #define CERT_EKU_SERVER_AUTH SN_server_auth
 
+#define CERT_SUBJECT_KEY_IDENTFIER "subjectKeyIdentifier"
+#define CERT_AUTHORITY_KEY_IDENTIFIER "authorityKeyIdentifier"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_ID "authorityKeyIdentifierId"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_NAME "authorityKeyIdentifierName"
+#define CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL "authorityKeyIdentifierSerial"
+
 // validate the current time lies within 
 // the validation period of the cert
 #define VALIDATION_POLICY_TIME 1
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index be5c7b3c61..d41ec96ab6 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -59,10 +59,13 @@ LLS * By copying, modifying or distributing this software, you acknowledge
 #define STORE_SALT_SIZE 16 
 #define BUFFER_READ_SIZE 256
 std::string cert_string_from_asn1_string(ASN1_STRING* value);
+std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value);
+
 LLSD _basic_constraints_ext(X509* cert);
 LLSD _key_usage_ext(X509* cert);
 LLSD _ext_key_usage_ext(X509* cert);
-
+LLSD _subject_key_identifier_ext(X509 *cert);
+LLSD _authority_key_identifier_ext(X509* cert);
 
 LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert) 
 {
@@ -175,6 +178,8 @@ LLSD& LLBasicCertificate::_initLLSD()
 	mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
 	mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
 	mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
+	mLLSDInfo[CERT_SUBJECT_KEY_IDENTFIER] = _subject_key_identifier_ext(mCert);
+	mLLSDInfo[CERT_AUTHORITY_KEY_IDENTIFIER] = _authority_key_identifier_ext(mCert);
 	return mLLSDInfo; 
 }
 
@@ -269,6 +274,43 @@ LLSD _ext_key_usage_ext(X509* cert)
 	return result;
 }
 
+// retrieve the subject key identifier of the cert
+LLSD _subject_key_identifier_ext(X509 *cert)
+{
+	LLSD result;
+	ASN1_OCTET_STRING *skeyid = (ASN1_OCTET_STRING *)X509_get_ext_d2i(cert, NID_subject_key_identifier, NULL, NULL);
+	if(skeyid)
+	{
+		result = cert_string_from_octet_string(skeyid);
+	}
+	return result;
+}
+
+// retrieve the authority key identifier of the cert
+LLSD _authority_key_identifier_ext(X509* cert)
+{
+	LLSD result;
+	AUTHORITY_KEYID *akeyid = (AUTHORITY_KEYID *)X509_get_ext_d2i(cert, NID_authority_key_identifier, NULL, NULL);
+	if(akeyid)
+	{
+		result = LLSD::emptyMap();
+		if(akeyid->keyid)
+		{
+			result[CERT_AUTHORITY_KEY_IDENTIFIER_ID] = cert_string_from_octet_string(akeyid->keyid);
+		}
+		if(akeyid->serial)
+		{
+			result[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL] = cert_string_from_asn1_integer(akeyid->serial);
+		}	
+	}
+	
+	// we ignore the issuer name in the authority key identifier, we check the issue name via
+	// the the issuer name entry in the cert.
+	
+
+	return result;
+}
+
 // retrieve an openssl x509 object,
 // which must be freed by X509_free
 X509* LLBasicCertificate::getOpenSSLX509() const
@@ -337,6 +379,25 @@ std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
 	return result;
 }
 
+// Generate a string from an OCTET string.
+// we retrieve as a 
+
+std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
+{
+	
+	std::stringstream result;
+	result << std::hex << std::setprecision(2);
+	for (unsigned int i=0; i < value->length; i++)
+	{
+		if (i != 0) 
+		{
+			result << ":";
+		}
+		result  << std::setfill('0') << std::setw(2) << (int)value->data[i];
+	}
+	return result.str();
+}
+
 // Generate a string from an ASN1 integer.  ASN1 Integers are
 // bignums, so they can be 'infinitely' long, therefore we
 // cannot simply use a conversion to U64 or something.
@@ -983,6 +1044,18 @@ void LLBasicCertificateChain::validate(int validation_policy,
 			
 		cert_search_params = LLSD::emptyMap();
 		cert_search_params[CERT_SUBJECT_NAME_STRING] = cert_llsd[CERT_ISSUER_NAME_STRING];
+		if (cert_llsd.has(CERT_AUTHORITY_KEY_IDENTIFIER))
+		{
+			LLSD cert_aki = cert_llsd[CERT_AUTHORITY_KEY_IDENTIFIER];
+			if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_ID))
+			{
+				cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_ID];
+			}
+			if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL))
+			{
+				cert_search_params[CERT_SERIAL_NUMBER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL];
+			}
+		}
 		found_store_cert = ca_store->find(cert_search_params);
 		
 		if(found_store_cert != ca_store->end())
-- 
cgit v1.2.3


From a633f3fd228db7a6bf5eb32c9d281542f1c7be67 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 1 Mar 2010 18:50:36 -0800
Subject: remove tab

---
 indra/newview/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 6d4db7def7..76586968ae 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1189,7 +1189,7 @@ if (WINDOWS)
         comdlg32
         ${DINPUT_LIBRARY}
         ${DXGUID_LIBRARY}
-	iphlpapi
+        iphlpapi
         kernel32
         odbc32
         odbccp32
-- 
cgit v1.2.3


From 2b2e8f6301fc22da370699449cfc81e3597528f0 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 1 Mar 2010 21:30:26 -0800
Subject: fix linux build break

---
 indra/newview/llvoiceclient.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index 3fa82105a3..f1a7d3dbec 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -442,7 +442,7 @@ private:
 	void load();
 	void save();
 
-	typedef std::map<LLUUID, S32> speaker_data_map_t;
+	typedef std::map<LLUUID, F32> speaker_data_map_t;
 	speaker_data_map_t mSpeakersData;
 };
 
-- 
cgit v1.2.3


From 25467eaf4aca8496b44f54b2ac7b72cb600fbb25 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 1 Mar 2010 23:17:12 -0800
Subject: Fix windows build break

---
 indra/cmake/Linking.cmake    | 1 +
 indra/newview/CMakeLists.txt | 1 -
 2 files changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index bca99caf2a..fca0cdd2d2 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -48,6 +48,7 @@ if (WINDOWS)
       wldap32
       gdi32
       user32
+      iphlpapi
       dbghelp
       )
 else (WINDOWS)
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 76586968ae..41375002a3 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1189,7 +1189,6 @@ if (WINDOWS)
         comdlg32
         ${DINPUT_LIBRARY}
         ${DXGUID_LIBRARY}
-        iphlpapi
         kernel32
         odbc32
         odbccp32
-- 
cgit v1.2.3


From d79af12e04e182bab639e64e9cd1181d5c799582 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Tue, 2 Mar 2010 13:42:17 -0800
Subject: Fix windows build break, segfault on exit and bad library link
 location

---
 indra/cmake/LLCommon.cmake           | 6 +++++-
 indra/cmake/Linking.cmake            | 1 -
 indra/newview/llappearancemgr.cpp    | 2 +-
 indra/newview/llsechandler_basic.cpp | 2 +-
 4 files changed, 7 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
index d1ab264a41..c10fa63049 100644
--- a/indra/cmake/LLCommon.cmake
+++ b/indra/cmake/LLCommon.cmake
@@ -13,7 +13,11 @@ set(LLCOMMON_INCLUDE_DIRS
     ${Boost_INCLUDE_DIRS}
     )
 
-set(LLCOMMON_LIBRARIES llcommon)
+if (WINDOWS)
+   set(LLCOMMON_LIBRARIES llcommon iphlpapi)
+else (WINDOWS)
+   set(LLCOMMON_LIBRARIES llcommon)
+endif (WINDOWS)
 
 add_definitions(${TCMALLOC_FLAG})
 
diff --git a/indra/cmake/Linking.cmake b/indra/cmake/Linking.cmake
index fca0cdd2d2..bca99caf2a 100644
--- a/indra/cmake/Linking.cmake
+++ b/indra/cmake/Linking.cmake
@@ -48,7 +48,6 @@ if (WINDOWS)
       wldap32
       gdi32
       user32
-      iphlpapi
       dbghelp
       )
 else (WINDOWS)
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 71df064236..c03cd5810b 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -310,7 +310,7 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
 {
 	llinfos << "done update appearance on destroy" << llendl;
 	
-	if (!LLApp::isExiting())
+	if (!LLApp::isExiting() && !LLApp::isStopped())
 	{
 		LLAppearanceManager::instance().updateAppearanceFromCOF();
 	}
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
index d41ec96ab6..51e250ffc6 100644
--- a/indra/newview/llsechandler_basic.cpp
+++ b/indra/newview/llsechandler_basic.cpp
@@ -387,7 +387,7 @@ std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
 	
 	std::stringstream result;
 	result << std::hex << std::setprecision(2);
-	for (unsigned int i=0; i < value->length; i++)
+	for (int i=0; i < value->length; i++)
 	{
 		if (i != 0) 
 		{
-- 
cgit v1.2.3


From 66efd3f43248c7db6b5a832ed5a293eeb1f98957 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Tue, 2 Mar 2010 14:29:42 -0800
Subject: fix windows build break again

---
 indra/cmake/LLCommon.cmake | 6 +-----
 indra/llcommon/lluuid.cpp  | 2 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/cmake/LLCommon.cmake b/indra/cmake/LLCommon.cmake
index c10fa63049..d1ab264a41 100644
--- a/indra/cmake/LLCommon.cmake
+++ b/indra/cmake/LLCommon.cmake
@@ -13,11 +13,7 @@ set(LLCOMMON_INCLUDE_DIRS
     ${Boost_INCLUDE_DIRS}
     )
 
-if (WINDOWS)
-   set(LLCOMMON_LIBRARIES llcommon iphlpapi)
-else (WINDOWS)
-   set(LLCOMMON_LIBRARIES llcommon)
-endif (WINDOWS)
+set(LLCOMMON_LIBRARIES llcommon)
 
 add_definitions(${TCMALLOC_FLAG})
 
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 3a11753683..583c1e589b 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -36,6 +36,8 @@
 #undef WIN32_LEAN_AND_MEAN
 #include <winsock2.h>
 #include <windows.h>
+// ugh, this is ugly.  We need to straighten out our linking for this library
+#pragma comment(lib, "IPHLPAPI.lib")
 #include <iphlpapi.h>
 #endif
 
-- 
cgit v1.2.3


From 836ab95d90298092dd845f47b5ac51817d7bb665 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Tue, 2 Mar 2010 15:43:20 -0800
Subject: Windows launching changes for vivox and diamondware voice did not get
 properly merged.

---
 indra/newview/llvoicevivox.cpp | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index c75405e12e..e4e3b23ea6 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -825,6 +825,7 @@ void LLVivoxVoiceClient::stateMachine()
 						// SLIM SDK: these arguments are no longer necessary.
 //						std::string args = " -p tcp -h -c";
 						std::string args;
+						std::string cmd;
 						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
 						
 						if(loglevel.empty())
@@ -839,20 +840,18 @@ void LLVivoxVoiceClient::stateMachine()
 
 #if LL_WINDOWS
 						PROCESS_INFORMATION pinfo;
-						STARTUPINFOW sinfo;
+						STARTUPINFOA sinfo;
 						
 						memset(&sinfo, 0, sizeof(sinfo));
 						
-						std::string exe_dir = gDirUtilp->getExecutableDir();
-						
-						llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
-						llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
-						llutf16string args16 = utf8str_to_utf16str(args);
-						// Create a writeable copy to keep Windows happy.                               
-						U16 *argscpy_16 = new U16[args16.size() + 1];
-						wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
-
-						if(!CreateProcessW(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo))
+						std::string exe_dir = gDirUtilp->getAppRODataDir();
+						cmd = "SLVoice.exe";
+						cmd += args;
+
+						// So retarded.  Windows requires that the second parameter to CreateProcessA be writable (non-const) string...
+						char *args2 = new char[args.size() + 1];
+						strcpy(args2, args.c_str());
+						if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo))
 						{
 //							DWORD dwErr = GetLastError();
 						}
@@ -864,7 +863,7 @@ void LLVivoxVoiceClient::stateMachine()
 							CloseHandle(pinfo.hThread); // stops leaks - nothing else
 						}		
 						
-						delete[] argscpy_16;
+						delete[] args2;
 #else	// LL_WINDOWS
 						// This should be the same for mac and linux
 						{
-- 
cgit v1.2.3


From 8bd5a3bca38b0ba663d3563029e54da057020424 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 8 Mar 2010 15:10:27 -0800
Subject: DEV-45976 Last Login Location Preference not remembered

---
 indra/llvfs/lldir.cpp            |  7 +++----
 indra/newview/llappviewer.cpp    |  8 ++------
 indra/newview/llpanellogin.cpp   | 30 +++++++++++++-----------------
 indra/newview/llslurl.h          |  2 +-
 indra/newview/llstartup.cpp      | 26 ++++++++++++++++++++------
 indra/newview/llviewerwindow.cpp | 16 +++++++++-------
 6 files changed, 48 insertions(+), 41 deletions(-)

(limited to 'indra')

diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index 1f0c4fe13a..b4ee42ef3a 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -459,7 +459,6 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 	}
 
 	//llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl;
-
 	return expanded_filename;
 }
 
@@ -609,9 +608,9 @@ void LLDir::setPerAccountChatLogsDir(const std::string &username)
 		std::string userlower(username);
 		LLStringUtil::toLower(userlower);
 		LLStringUtil::replaceChar(userlower, ' ', '_');
-		mLindenUserDir = getChatLogsDir();
-		mLindenUserDir += mDirDelimiter;
-		mLindenUserDir += userlower;
+		mPerAccountChatLogsDir = getChatLogsDir();
+		mPerAccountChatLogsDir += mDirDelimiter;
+		mPerAccountChatLogsDir += userlower;
 	}
 	else
 	{
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 9535e5f239..9fd486b2ff 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -2098,12 +2098,8 @@ bool LLAppViewer::initConfiguration()
     }
     else if(clp.hasOption("slurl"))
     {
-      LLStartUp::setStartSLURL(LLSLURL(clp.getOption("surl")[0]));
-      if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) 
-	  {  
-		  LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
-		  
-	  }  
+		LLSLURL start_slurl(clp.getOption("slurl")[0]);
+		LLStartUp::setStartSLURL(start_slurl);
     }
 
     const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index e5c8393eaa..b620a005d2 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -223,19 +223,12 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 
 	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
 
-	if(!LLStartUp::getStartSLURL().isLocation())
+	if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
 	{
-		LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
-	}
-	std::string sim_string = LLStartUp::getStartSLURL().getRegion();
-	if (!sim_string.empty())
-	{
-		// Replace "<Type region name>" with this region name
-		combo->remove(2);
-		combo->add( sim_string );
-		combo->setTextEntry(sim_string);
-		combo->setCurrentByIndex( 2 );
+		LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
+		LLStartUp::setStartSLURL(slurl);
 	}
+	updateLocationCombo(false);
 	
 	combo->setCommitCallback(onSelectLocation, NULL);
 
@@ -698,6 +691,8 @@ void LLPanelLogin::updateLocationCombo( bool force_visible )
 	{
 		return;
 	}	
+	
+	llinfos << "updatelocationcombo " << LLStartUp::getStartSLURL().asString() << llendl;
 	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
 	
 	switch(LLStartUp::getStartSLURL().getType())
@@ -744,11 +739,12 @@ void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
 			if((slurl.getType() == LLSLURL::LOCATION) &&
 			   (slurl.getGrid() != LLStartUp::getStartSLURL().getGrid()))
 			{
-				LLStartUp::setStartSLURL(slurl);
+				
+
 				// we've changed the grid, so update the grid selection
 				try 
 				{
-					LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
+					LLStartUp::setStartSLURL(slurl);
 				}
 				catch (LLInvalidGridName ex)
 				{
@@ -763,12 +759,12 @@ void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
 		}
 		case 1:
 		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
 			break;
 		}
 		default:
 		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
 			break;
 		}
 	}
@@ -800,7 +796,6 @@ void LLPanelLogin::getLocation(LLSLURL& slurl)
 void LLPanelLogin::setLocation(const LLSLURL& slurl)
 {
 	LLStartUp::setStartSLURL(slurl);
-	LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
 	updateServer();
 	
 }
@@ -1174,11 +1169,12 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 	
 	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
 	combo->setCurrentByIndex(1);
-	LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+	LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
 	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
 	// This new selection will override preset uris
 	// from the command line.
 	updateServer();
+	updateLocationCombo(false);
 	updateLoginPanelLinks();
 }
 
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index 37bdc36fa4..28c23561cf 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -88,7 +88,7 @@ public:
 	LLSD        getAppPath() const { return mAppPath; }
 	
 	bool        isValid() const { return mType != INVALID; }
-	bool        isLocation() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
+	bool        isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
 	
 	bool operator==(const LLSLURL& rhs);
 	bool operator!=(const LLSLURL&rhs);
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 951806846c..6860da1bd2 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -824,10 +824,11 @@ bool idle_startup()
          
 		// create necessary directories
 		// *FIX: these mkdir's should error check
-		gDirUtilp->setPerAccountChatLogsDir(userid);  
+		gDirUtilp->setLindenUserDir(userid);
 		LLFile::mkdir(gDirUtilp->getLindenUserDir());
 
 		// Set PerAccountSettingsFile to the default value.
+		std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
 		gSavedSettings.setString("PerAccountSettingsFile",
 			gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
 				LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
@@ -857,7 +858,8 @@ bool idle_startup()
 		{
 			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
 		}
-
+		gDirUtilp->setPerAccountChatLogsDir(userid);  
+		
 		LLFile::mkdir(gDirUtilp->getChatLogsDir());
 		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
 
@@ -879,8 +881,6 @@ bool idle_startup()
 		if (show_connect_box)
 		{
 			LLSLURL slurl;
-			LLPanelLogin::getLocation(slurl);
-			LLStartUp::setStartSLURL(slurl);
 			LLPanelLogin::closePanel();
 		}
 
@@ -2660,8 +2660,22 @@ bool LLStartUp::dispatchURL()
 void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
 {
   sStartSLURL = slurl;
-  gSavedSettings.setBOOL("LoginLastLocation", 
-			 !(slurl.getType() == LLSLURL::HOME_LOCATION)); 
+  switch(slurl.getType())
+    {
+    case LLSLURL::HOME_LOCATION:
+      {
+		  gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
+	break;
+      }
+    case LLSLURL::LAST_LOCATION:
+      {
+	gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
+	break;
+      }
+    default:
+			LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
+			break;
+    }
 }
 
 bool login_alert_done(const LLSD& notification, const LLSD& response)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 5d2550b9a7..dcc2a6f4a5 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -829,13 +829,15 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 					
 				if (slurl_dnd_enabled)
 				{
-				  LLSLURL dropped_slurl(data);
-				  if(dropped_slurl.isLocation())
-				    if (drop)
-				      {
-					LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
-					return LLWindowCallbacks::DND_MOVE;
-				      };
+					LLSLURL dropped_slurl(data);
+					if(dropped_slurl.isSpatial())
+					{
+						if (drop)
+						{
+							LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
+							return LLWindowCallbacks::DND_MOVE;
+						}
+					}
 				}
 
 				if (prim_media_dnd_enabled)
-- 
cgit v1.2.3


From 9757cd64e19209484333ff8d07aa86fcccaf22f6 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Wed, 10 Mar 2010 14:04:36 +0200
Subject: fixed EXT-4872 'Loading...' message remains in ad-hoc IM floated
 opened by 'Start IM' button

added timing out of session initialization (after 30 seconds)

--HG--
branch : product-engine
---
 indra/newview/llimview.cpp                     | 21 +++++++++++++++++++++
 indra/newview/llimview.h                       | 18 ++++++++++++++++++
 indra/newview/skins/default/xui/en/strings.xml |  3 +++
 3 files changed, 42 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 77e3012d26..1641e2a0e2 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -80,6 +80,9 @@ const static std::string ADHOC_NAME_SUFFIX(" Conference");
 const static std::string NEARBY_P2P_BY_OTHER("nearby_P2P_by_other");
 const static std::string NEARBY_P2P_BY_AGENT("nearby_P2P_by_agent");
 
+/** Timeout of outgoing session initialization (in seconds) */
+const static U32 SESSION_INITIALIZATION_TIMEOUT = 30;
+
 std::string LLCallDialogManager::sPreviousSessionlName = "";
 LLIMModel::LLIMSession::SType LLCallDialogManager::sPreviousSessionType = LLIMModel::LLIMSession::P2P_SESSION;
 std::string LLCallDialogManager::sCurrentSessionlName = "";
@@ -91,6 +94,19 @@ const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-141
 //
 LLIMMgr* gIMMgr = NULL;
 
+
+BOOL LLSessionTimeoutTimer::tick()
+{
+	if (mSessionId.isNull()) return TRUE;
+
+	LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
+	if (session && !session->mSessionInitialized)
+	{
+		gIMMgr->showSessionStartError("session_initialization_timed_out_error", mSessionId);
+	}
+	return TRUE;
+}
+
 void toast_callback(const LLSD& msg){
 	// do not show toast in busy mode or it goes from agent
 	if (gAgent.getBusy() || gAgent.getID() == msg["from_id"])
@@ -214,6 +230,11 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 		//so we're already initialized
 		mSessionInitialized = true;
 	}
+	else
+	{
+		//tick returns TRUE - timer will be deleted after the tick
+		new LLSessionTimeoutTimer(mSessionID, SESSION_INITIALIZATION_TIMEOUT);
+	}
 
 	if (IM_NOTHING_SPECIAL == type)
 	{
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index ad6cede727..8e53edaab0 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -34,6 +34,7 @@
 #define LL_LLIMVIEW_H
 
 #include "lldockablefloater.h"
+#include "lleventtimer.h"
 #include "llinstantmessage.h"
 
 #include "lllogchat.h"
@@ -45,7 +46,24 @@ class LLFriendObserver;
 class LLCallDialogManager;	
 class LLIMSpeakerMgr;
 
+/**
+ * Timeout Timer for outgoing Ad-Hoc/Group IM sessions which being initialized by the server
+ */
+class LLSessionTimeoutTimer : public LLEventTimer
+{
+public:
+	LLSessionTimeoutTimer(const LLUUID& session_id, F32 period) : LLEventTimer(period), mSessionId(session_id) {}
+	virtual ~LLSessionTimeoutTimer() {};
+	/* virtual */ BOOL tick();
+
+private:
+	LLUUID mSessionId;
+};
 
+
+/**
+ * Model (MVC) for IM Sessions
+ */
 class LLIMModel :  public LLSingleton<LLIMModel>
 {
 public:
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 39762d57fb..a7bca3955c 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3009,4 +3009,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
   <string name="unread_chat_multiple">
     [SOURCES] have said something new
   </string>"
+	<string name="session_initialization_timed_out_error">
+		The session initialization is timed out
+	</string>
 </strings>
-- 
cgit v1.2.3


From 2e525711cd08d5f1dce991d1b6595a8dd41c9e3b Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Wed, 10 Mar 2010 12:41:55 -0800
Subject: Clean up login page a bit

---
 indra/newview/skins/default/xui/en/panel_login.xml | 28 +++++++++++++++-------
 1 file changed, 19 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 4543dd3263..4885f368ae 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -48,8 +48,8 @@ auto_resize="false"
 follows="left|bottom"
 name="login"
 layout="topleft"
-width="775"
-min_width="775"
+width="850"
+min_width="850"
 user_resize="false"
 height="80">
 <text
@@ -81,7 +81,7 @@ height="15"
 left_pad="8"
 name="password_text"
 top="20"
-    width="150">
+    width="135">
        Password:
 </text>
 <line_editor
@@ -106,10 +106,10 @@ label="Remember password"
   follows="left|bottom"
   font="SansSerifSmall"
   height="15"
-  left_pad="18"
+  left_pad="10"
   name="start_location_text"
 top="20"
-  width="130">
+  width="250">
        Start at:
  </text>
 <combo_box
@@ -120,7 +120,7 @@ control_name="LoginLocation"
 max_chars="128"
 top_pad="0"
 name="start_location_combo"
-     width="135">
+     width="250">
 <combo_box.item
 label="My last location"
 name="MyLastLocation"
@@ -140,18 +140,28 @@ name="Typeregionname"   value="" />
   label="Log In"
   label_color="White"
   layout="topleft"
-  left_pad="15"
+  left_pad="10"
   name="connect_btn"
   top="35"
   width="90" />
+  <text
+  follows="left|bottom"
+  font="SansSerifSmall"
+  height="15"
+  left_pad="10"
+  name="start_location_text"
+top="20"
+  width="150">
+       Grid Name:
+ </text>
 <combo_box
 follows="left|bottom"
 allow_text_entry="true"
 font="SansSerifSmall"
 height="23"
 name="server_combo"
-left_pad="15"
-width="200"
+top_pad="0"
+width="150"
 max_chars="255"
 visible="false" />
 </layout_panel>
-- 
cgit v1.2.3


From 2b4158c4a0ed5c70d9e81c81bb044f5fd4faa7ac Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 19 Mar 2010 15:38:23 -0400
Subject: cleaning up dead code, comments

---
 indra/newview/llagentwearables.cpp | 69 --------------------------------------
 indra/newview/llappearancemgr.cpp  |  3 +-
 2 files changed, 2 insertions(+), 70 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 1187455971..c31b154b74 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -55,8 +55,6 @@
 
 #include <boost/scoped_ptr.hpp>
 
-#define USE_CURRENT_OUTFIT_FOLDER
-
 //--------------------------------------------------------------------
 // Classes for fetching initial wearables data
 //--------------------------------------------------------------------
@@ -1036,64 +1034,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 	}
 }
 
-// A single wearable that the avatar was wearing on start-up has arrived from the database.
-// static
-void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void* userdata)
-{
-	boost::scoped_ptr<LLInitialWearablesFetch::InitialWearableData> wear_data((LLInitialWearablesFetch::InitialWearableData*)userdata); 
-	const EWearableType type = wear_data->mType;
-	U32 index = 0;
-
-	LLVOAvatarSelf* avatar = gAgent.getAvatarObject();
-	if (!avatar)
-	{
-		return;
-	}
-		
-	if (wearable)
-	{
-		llassert(type == wearable->getType());
-		wearable->setItemID(wear_data->mItemID);
-		index = gAgentWearables.pushWearable(type, wearable);
-		gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID);
-
-		// disable composites if initial textures are baked
-		avatar->setupComposites();
-
-		avatar->setCompositeUpdatesEnabled(TRUE);
-		gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
-	}
-	else
-	{
-		// Somehow the asset doesn't exist in the database.
-		gAgentWearables.recoverMissingWearable(type,index);
-	}
-	
-
-	gInventory.notifyObservers();
-
-	// Have all the wearables that the avatar was wearing at log-in arrived?
-	// MULTI-WEARABLE: update when multiple wearables can arrive per type.
-
-	gAgentWearables.updateWearablesLoaded();
-	if (gAgentWearables.areWearablesLoaded())
-	{
-
-		// Can't query cache until all wearables have arrived, so calling this earlier is a no-op.
-		gAgentWearables.queryWearableCache();
-
-		// Make sure that the server's idea of the avatar's wearables actually match the wearables.
-		gAgent.sendAgentSetAppearance();
-
-		// Check to see if there are any baked textures that we hadn't uploaded before we logged off last time.
-		// If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
-		if (gAgent.cameraCustomizeAvatar())
-		{
-			avatar->requestLayerSetUploads();
-		}
-	}
-}
-
 // Normally, all wearables referred to "AgentWearablesUpdate" will correspond to actual assets in the
 // database.  If for some reason, we can't load one of those assets, we can try to reconstruct it so that
 // the user isn't left without a shape, for example.  (We can do that only after the inventory has loaded.)
@@ -2666,16 +2606,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 			
 			if (wearable_data->mAssetID.notNull())
 			{
-#ifdef USE_CURRENT_OUTFIT_FOLDER
 				ids.push_back(wearable_data->mItemID);
-#endif
-#if 0
-// 				// Fetch the wearables
-// 				LLWearableList::instance().getAsset(wearable_data->mAssetID,
-// 													LLStringUtil::null,
-// 													LLWearableDictionary::getAssetType(wearable_data->mType),
-// 													LLAgentWearables::onInitialWearableAssetArrived, (void*)(wearable_data));
-#endif
 			}
 			else
 			{
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index f2d15757c9..613e67016c 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1186,7 +1186,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 	// callback will be called (and this object deleted)
 	// before the final getNextData().
 
-	// BAP future cleanup - no point having found_container when
+	// BAP 2.1 cleanup - no point having found_container when
 	// mFoundList already has all the info.
 	LLDynamicArray<LLFoundData> found_container;
 	for(S32 i = 0; i  < wear_items.count(); ++i)
@@ -1507,6 +1507,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
 	return;
 }
 
+// BAP remove ensemble code for 2.1?
 void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_update )
 {
 #if SUPPORT_ENSEMBLES
-- 
cgit v1.2.3


From 3979bf6caea3b2f4828f4d76514399f5b63ee39c Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 19 Mar 2010 16:06:42 -0400
Subject: cleanup - replaced larger chunk of code with removeCOFItemLinks

---
 indra/newview/llinventorybridge.cpp | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ceeffea1c9..4330dfba9d 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4966,20 +4966,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 	}
 
 	// Find and remove this item from the COF.
-	// FIXME 2.1 - call removeCOFItemLinks in llappearancemgr instead.
-	LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(item_id, LLAppearanceManager::instance().getCOF());
-	if (items.size() != 1)
-	{
-		llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
-	}
-	for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
-		 iter != items.end();
-		 ++iter)
-	{
-		const LLViewerInventoryItem *linked_item = (*iter);
-		const LLUUID &item_id = linked_item->getUUID();
-		gInventory.purgeObject(item_id);
-	}
+	LLAppearanceManager::instance().removeCOFItemLinks(item_id,false);
 	gInventory.notifyObservers();
 
 	delete on_remove_struct;
-- 
cgit v1.2.3


From 7792a53b2827b761a83b8243e2838ad0084633d6 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 19 Mar 2010 16:44:50 -0400
Subject: cleanup - replaced larger chunk of code with removeCOFItemLinks

---
 indra/newview/llinventorybridge.cpp | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 4330dfba9d..966ea1dcef 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4992,20 +4992,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
 			continue;
 
 		// Find and remove this item from the COF.
-		LLInventoryModel::item_array_t items = gInventory.collectLinkedItems(
-			item_id, LLAppearanceManager::instance().getCOF());
-		if (items.size() != 1)
-		{
-			llwarns << "Found " << items.size() << " COF links to " << item_id.asString() << ", expected 1" << llendl;
-		}
-		for (LLInventoryModel::item_array_t::const_iterator iter = items.begin();
-			 iter != items.end();
-			 ++iter)
-		{
-			const LLViewerInventoryItem *linked_item = (*iter);
-			const LLUUID &item_id = linked_item->getUUID();
-			gInventory.purgeObject(item_id);
-		}
+		LLAppearanceManager::instance().removeCOFItemLinks(item_id,false);
 	}
 	gInventory.notifyObservers();
 
-- 
cgit v1.2.3


From f428d62c93f2cd2817e055fce7db49410e8324d6 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 19 Mar 2010 17:15:41 -0400
Subject: Moved some logic into LLWearableHoldingPattern

---
 indra/newview/llappearancemgr.cpp | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 613e67016c..c74efe863f 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -368,6 +368,7 @@ public:
 	void recoverMissingWearable(EWearableType type);
 	void clearCOFLinksForMissingWearables();
 	
+	void onWearableAssetFetch(LLWearable *wearable);
 	void onAllComplete();
 	
 	typedef std::list<LLFoundData> found_list_t;
@@ -657,11 +658,10 @@ bool LLWearableHoldingPattern::pollMissingWearables()
 	return done;
 }
 
-static void onWearableAssetFetch(LLWearable* wearable, void* data)
+void LLWearableHoldingPattern::onWearableAssetFetch(LLWearable *wearable)
 {
-	LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
-	holder->mResolved += 1;  // just counting callbacks, not successes.
-	llinfos << "onWearableAssetFetch, resolved count " << holder->mResolved << " of requested " << holder->mFoundList.size() << llendl;
+	mResolved += 1;  // just counting callbacks, not successes.
+	llinfos << "onWearableAssetFetch, resolved count " << mResolved << " of requested " << mFoundList.size() << llendl;
 	if (wearable)
 	{
 		llinfos << "wearable found, type " << wearable->getType() << " asset " << wearable->getAssetID() << llendl;
@@ -671,7 +671,7 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data)
 		llwarns << "no wearable found" << llendl;
 	}
 
-	if (holder->mFired)
+	if (mFired)
 	{
 		llwarns << "called after holder fired" << llendl;
 		return;
@@ -682,8 +682,8 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data)
 		return;
 	}
 
-	for (LLWearableHoldingPattern::found_list_t::iterator iter = holder->mFoundList.begin();
-		 iter != holder->mFoundList.end(); ++iter)
+	for (LLWearableHoldingPattern::found_list_t::iterator iter = mFoundList.begin();
+		 iter != mFoundList.end(); ++iter)
 	{
 		LLFoundData& data = *iter;
 		if(wearable->getAssetID() == data.mAssetID)
@@ -696,6 +696,12 @@ static void onWearableAssetFetch(LLWearable* wearable, void* data)
 	}
 }
 
+static void onWearableAssetFetch(LLWearable* wearable, void* data)
+{
+	LLWearableHoldingPattern* holder = (LLWearableHoldingPattern*)data;
+	holder->onWearableAssetFetch(wearable);
+}
+
 
 static void removeDuplicateItems(LLInventoryModel::item_array_t& items)
 {
@@ -1186,9 +1192,6 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 	// callback will be called (and this object deleted)
 	// before the final getNextData().
 
-	// BAP 2.1 cleanup - no point having found_container when
-	// mFoundList already has all the info.
-	LLDynamicArray<LLFoundData> found_container;
 	for(S32 i = 0; i  < wear_items.count(); ++i)
 	{
 		LLViewerInventoryItem *item = wear_items.get(i);
@@ -1214,7 +1217,6 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 #endif
 
 			holder->mFoundList.push_front(found);
-			found_container.put(found);
 		}
 		else
 		{
@@ -1229,9 +1231,10 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 		}
 	}
 
-	for(S32 i = 0; i < found_container.count(); ++i)
+	for (LLWearableHoldingPattern::found_list_t::iterator it = holder->mFoundList.begin();
+		 it != holder->mFoundList.end(); ++it)
 	{
-		LLFoundData& found = found_container.get(i);
+		LLFoundData& found = *it;
 
 		llinfos << "waiting for onWearableAssetFetch callback, asset " << found.mAssetID.asString() << llendl;
 
@@ -1248,7 +1251,6 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 	{
 		doOnIdleRepeating(boost::bind(&LLWearableHoldingPattern::pollFetchCompletion,holder));
 	}
-
 }
 
 void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category,
-- 
cgit v1.2.3


From 6efbbfa0805c337b3f7e476fd743a964bc68d09e Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Mon, 22 Mar 2010 15:35:34 +0200
Subject: fix for EXT-4288 Shrinking chat history window from top doesn't keep
 scroll thumb at bottom

--HG--
branch : product-engine
---
 indra/llui/lltextbase.cpp | 11 +++++++++++
 1 file changed, 11 insertions(+)

(limited to 'indra')

diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 851fb966ec..d7bbb8a56e 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -957,7 +957,18 @@ void LLTextBase::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	if (width != getRect().getWidth() || height != getRect().getHeight())
 	{
+		//EXT-4288
+		//to keep consistance scrolling behaviour 
+		//when scrolling from top and from bottom...
+		bool is_scrolled_to_end = (mScroller!=NULL) && scrolledToEnd();
+		
 		LLUICtrl::reshape( width, height, called_from_parent );
+	
+		if (is_scrolled_to_end)
+		{
+			deselect();
+			endOfDoc();
+		}		
 
 		// do this first after reshape, because other things depend on
 		// up-to-date mVisibleTextRect
-- 
cgit v1.2.3


From 5e0de9609d7a18af31241565f3a56ac906612fcb Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Mon, 22 Mar 2010 15:37:22 +0200
Subject: fix for EXT-3868 Edit Window: Group name shown when no object is
 selected

--HG--
branch : product-engine
---
 indra/newview/llpanelpermissions.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelpermissions.cpp b/indra/newview/llpanelpermissions.cpp
index 01b6e8ffad..71d16a08b4 100644
--- a/indra/newview/llpanelpermissions.cpp
+++ b/indra/newview/llpanelpermissions.cpp
@@ -195,8 +195,8 @@ void LLPanelPermissions::disableAll()
 	childSetEnabled("Owner Name",						FALSE);
 
 	childSetEnabled("Group:",							FALSE);
-	childSetText("Group Name",							LLStringUtil::null);
-	childSetEnabled("Group Name",						FALSE);
+	childSetText("Group Name Proxy",					LLStringUtil::null);
+	childSetEnabled("Group Name Proxy",					FALSE);
 	childSetEnabled("button set group",					FALSE);
 
 	childSetText("Object Name",							LLStringUtil::null);
-- 
cgit v1.2.3


From 858d1e9ad00db909be54112dbffc1c709dd7ba2e Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Mon, 22 Mar 2010 17:02:44 +0200
Subject: fixed EXT-6476 (waiting).txt chat log file with "(waiting)" instead
 of avatar name gets created when Offering Teleport from Search Floater

offer teleport action is put on hold until Name Cache gets updated with appropriate avatar name

--HG--
branch : product-engine
---
 indra/newview/llavataractions.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index e6666c7f83..cb518f0ad6 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -161,6 +161,14 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee)
 	if (invitee.isNull())
 		return;
 
+	//waiting until Name Cache gets updated with corresponding avatar name
+	std::string just_to_request_name;
+	if (!gCacheName->getFullName(invitee, just_to_request_name))
+	{
+		gCacheName->get(invitee, FALSE, boost::bind((void (*)(const LLUUID&)) &LLAvatarActions::offerTeleport, invitee));
+		return;
+	}
+
 	LLDynamicArray<LLUUID> ids;
 	ids.push_back(invitee);
 	offerTeleport(ids);
-- 
cgit v1.2.3


From bcf959f97cbec3f394bd1ca8f07fb742d09b0614 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Mon, 22 Mar 2010 17:04:58 +0200
Subject: fixed EXT-6474  crash in Search Floater, people tab, on offering
 teleport (when viewer is disconnected, timed out)

added defensive check for non null region

--HG--
branch : product-engine
---
 indra/newview/llviewermessage.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5f7b19a5cb..af0af9cd0e 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5511,6 +5511,10 @@ void handle_lure(const LLUUID& invitee)
 // Prompt for a message to the invited user.
 void handle_lure(const std::vector<LLUUID>& ids)
 {
+	if (ids.empty()) return;
+
+	if (!gAgent.getRegion()) return;
+
 	LLSD edit_args;
 	edit_args["REGION"] = gAgent.getRegion()->getName();
 
-- 
cgit v1.2.3


From 9ff6b6ecd123d3fcd71e189094cc9cb99eca9724 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 25 Mar 2010 15:48:08 +0200
Subject: Fixed low bug EXT-6444 - Long notecard titles continue under Locked
 and Help icons on title bar. Changed the way floater title is reshaped.
 Calculations takes title buttons into account instead of using hardcoded
 values.

--HG--
branch : product-engine
---
 indra/llui/lldraghandle.cpp         |  7 +++----
 indra/llui/lldraghandle.h           |  3 +++
 indra/llui/llfloater.cpp            | 40 ++++++++++++++++++++++++-------------
 indra/llui/llfloater.h              |  3 ++-
 indra/newview/llpreviewnotecard.cpp | 15 ++++++++++++++
 indra/newview/llpreviewnotecard.h   |  1 +
 6 files changed, 50 insertions(+), 19 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/lldraghandle.cpp b/indra/llui/lldraghandle.cpp
index 832f148902..9d4e2fa495 100644
--- a/indra/llui/lldraghandle.cpp
+++ b/indra/llui/lldraghandle.cpp
@@ -248,15 +248,14 @@ void LLDragHandleTop::reshapeTitleBox()
 		return;
 	}
 	const LLFontGL* font = LLFontGL::getFontSansSerif();
-	S32 title_width = font->getWidth( mTitleBox->getText() ) + TITLE_HPAD;
-	if (getMaxTitleWidth() > 0)
-		title_width = llmin(title_width, getMaxTitleWidth());
+	S32 title_width = getRect().getWidth();
+	title_width -= 2 * LEFT_PAD + 2 * BORDER_PAD + getButtonsRect().getWidth();
 	S32 title_height = llround(font->getLineHeight());
 	LLRect title_rect;
 	title_rect.setLeftTopAndSize( 
 		LEFT_PAD, 
 		getRect().getHeight() - title_vpad,
-		getRect().getWidth() - LEFT_PAD - RIGHT_PAD,
+		title_width,
 		title_height);
 
 	// calls reshape on mTitleBox
diff --git a/indra/llui/lldraghandle.h b/indra/llui/lldraghandle.h
index dc5410787b..825bc9303e 100644
--- a/indra/llui/lldraghandle.h
+++ b/indra/llui/lldraghandle.h
@@ -71,6 +71,8 @@ public:
 	BOOL			getForeground() const		{ return mForeground; }
 	void			setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); }
 	S32				getMaxTitleWidth() const { return mMaxTitleWidth; }
+	void			setButtonsRect(const LLRect& rect){ mButtonsRect = rect; }
+	LLRect			getButtonsRect() { return mButtonsRect; }
 	void			setTitleVisible(BOOL visible);
 
 	virtual void	setTitle( const std::string& title ) = 0;
@@ -88,6 +90,7 @@ protected:
 	LLTextBox*		mTitleBox;
 	
 private:
+	LLRect			mButtonsRect;
 	S32				mDragLastScreenX;
 	S32				mDragLastScreenY;
 	S32				mLastMouseScreenX;
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 104ae19eda..e672252a50 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -346,7 +346,7 @@ void LLFloater::layoutDragHandle()
 		rect = getLocalRect();
 	}
 	mDragHandle->setRect(rect);
-	updateButtons();
+	updateTitleButtons();
 	applyTitle();
 }
 
@@ -1061,11 +1061,10 @@ void LLFloater::setMinimized(BOOL minimize)
 		// Reshape *after* setting mMinimized
 		reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
 	}
-	
-	applyTitle ();
 
 	make_ui_sound("UISndWindowClose");
-	updateButtons();
+	updateTitleButtons();
+	applyTitle ();
 }
 
 void LLFloater::setFocus( BOOL b )
@@ -1191,7 +1190,7 @@ void LLFloater::setHost(LLMultiFloater* host)
 		mButtonScale = 1.f;
 		//mButtonsEnabled[BUTTON_TEAR_OFF] = FALSE;
 	}
-	updateButtons();
+	updateTitleButtons();
 	if (host)
 	{
 		mHostHandle = host->getHandle();
@@ -1390,7 +1389,7 @@ void LLFloater::setCanDock(bool b)
 			mButtonsEnabled[BUTTON_DOCK] = FALSE;
 		}
 	}
-	updateButtons();
+	updateTitleButtons();
 }
 
 void LLFloater::setDocked(bool docked, bool pop_on_undock)
@@ -1399,7 +1398,7 @@ void LLFloater::setDocked(bool docked, bool pop_on_undock)
 	{
 		mDocked = docked;
 		mButtonsEnabled[BUTTON_DOCK] = !mDocked;
-		updateButtons();
+		updateTitleButtons();
 
 		storeDockStateControl();
 	}
@@ -1452,7 +1451,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
 		}
 		self->setTornOff(false);
 	}
-	self->updateButtons();
+	self->updateTitleButtons();
 }
 
 // static
@@ -1692,7 +1691,7 @@ void	LLFloater::setCanMinimize(BOOL can_minimize)
 	mButtonsEnabled[BUTTON_MINIMIZE] = can_minimize && !isMinimized();
 	mButtonsEnabled[BUTTON_RESTORE]  = can_minimize &&  isMinimized();
 
-	updateButtons();
+	updateTitleButtons();
 }
 
 void	LLFloater::setCanClose(BOOL can_close)
@@ -1700,7 +1699,7 @@ void	LLFloater::setCanClose(BOOL can_close)
 	mCanClose = can_close;
 	mButtonsEnabled[BUTTON_CLOSE] = can_close;
 
-	updateButtons();
+	updateTitleButtons();
 }
 
 void	LLFloater::setCanTearOff(BOOL can_tear_off)
@@ -1708,7 +1707,7 @@ void	LLFloater::setCanTearOff(BOOL can_tear_off)
 	mCanTearOff = can_tear_off;
 	mButtonsEnabled[BUTTON_TEAR_OFF] = mCanTearOff && !mHostHandle.isDead();
 
-	updateButtons();
+	updateTitleButtons();
 }
 
 
@@ -1732,10 +1731,11 @@ void LLFloater::setCanDrag(BOOL can_drag)
 	}
 }
 
-void LLFloater::updateButtons()
+void LLFloater::updateTitleButtons()
 {
 	static LLUICachedControl<S32> floater_close_box_size ("UIFloaterCloseBoxSize", 0);
 	static LLUICachedControl<S32> close_box_from_top ("UICloseBoxFromTop", 0);
+	LLRect buttons_rect;
 	S32 button_count = 0;
 	for (S32 i = 0; i < BUTTON_COUNT; i++)
 	{
@@ -1786,6 +1786,15 @@ void LLFloater::updateButtons()
 					llround((F32)floater_close_box_size * mButtonScale));
 			}
 
+			if(!buttons_rect.isValid())
+			{
+				buttons_rect = btn_rect;
+			}
+			else
+			{
+				mDragOnLeft ? buttons_rect.mRight + btn_rect.mRight : 
+					buttons_rect.mLeft = btn_rect.mLeft;
+			}
 			mButtons[i]->setRect(btn_rect);
 			mButtons[i]->setVisible(TRUE);
 			// the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater
@@ -1797,7 +1806,10 @@ void LLFloater::updateButtons()
 		}
 	}
 	if (mDragHandle)
-		mDragHandle->setMaxTitleWidth(getRect().getWidth() - (button_count * (floater_close_box_size + 1)));
+	{
+		localRectToOtherView(buttons_rect, &buttons_rect, mDragHandle);
+		mDragHandle->setButtonsRect(buttons_rect);
+	}
 }
 
 void LLFloater::buildButtons(const Params& floater_params)
@@ -1854,7 +1866,7 @@ void LLFloater::buildButtons(const Params& floater_params)
 		mButtons[i] = buttonp;
 	}
 
-	updateButtons();
+	updateTitleButtons();
 }
 
 // static
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index d8c77370f6..403723d9d8 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -311,11 +311,12 @@ protected:
 
 	virtual	void	onClickCloseBtn();
 
+	virtual void	updateTitleButtons();
+
 private:
 	void			setForeground(BOOL b);	// called only by floaterview
 	void			cleanupHandles(); // remove handles to dead floaters
 	void			createMinimizeButton();
-	void			updateButtons();
 	void			buildButtons(const Params& p);
 	
 	// Images and tooltips are named in the XML, but we want to look them
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index ee8e3f1db6..bfd9a840f2 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -38,6 +38,7 @@
 
 #include "llagent.h"
 #include "llassetuploadresponders.h"
+#include "lldraghandle.h"
 #include "llviewerwindow.h"
 #include "llbutton.h"
 #include "llfloaterreg.h"
@@ -188,6 +189,20 @@ void LLPreviewNotecard::refreshFromInventory(const LLUUID& new_item_id)
 	loadAsset();
 }
 
+void LLPreviewNotecard::updateTitleButtons()
+{
+	LLPreview::updateTitleButtons();
+
+	LLUICtrl* lock_btn = getChild<LLUICtrl>("lock");
+	if(lock_btn->getVisible() && !isMinimized()) // lock button stays visible if floater is minimized.
+	{
+		LLRect lock_rc = lock_btn->getRect();
+		LLRect buttons_rect = getDragHandle()->getButtonsRect();
+		buttons_rect.mLeft = lock_rc.mLeft;
+		getDragHandle()->setButtonsRect(buttons_rect);
+	}
+}
+
 void LLPreviewNotecard::loadAsset()
 {
 	// request the asset.
diff --git a/indra/newview/llpreviewnotecard.h b/indra/newview/llpreviewnotecard.h
index 5b8cf1c2f6..e0363eef54 100644
--- a/indra/newview/llpreviewnotecard.h
+++ b/indra/newview/llpreviewnotecard.h
@@ -79,6 +79,7 @@ public:
 
 protected:
 
+	void updateTitleButtons();
 	virtual void loadAsset();
 	bool saveIfNeeded(LLInventoryItem* copyitem = NULL);
 
-- 
cgit v1.2.3


From c5c72899f3f9e203474d8635aa05e154ee14add9 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Tue, 23 Mar 2010 10:10:15 +0200
Subject: Fixed normal subtask EXT-6441 - Do not show "friendship accepted"
 toast if respective IM window is open and in focus. Minor changes to supress
 toast for FriendshipAccepted notification.

--HG--
branch : product-engine
---
 indra/newview/llnotificationhandler.h        | 17 +++++++--
 indra/newview/llnotificationhandlerutil.cpp  | 54 ++++++++++++++++++++++------
 indra/newview/llnotificationofferhandler.cpp |  6 +---
 3 files changed, 60 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h
index 1dc0e414a2..99a1fedcf3 100644
--- a/indra/newview/llnotificationhandler.h
+++ b/indra/newview/llnotificationhandler.h
@@ -42,6 +42,8 @@
 #include "llinstantmessage.h"
 #include "llnotificationptr.h"
 
+class LLIMFloater;
+
 namespace LLNotificationsUI
 {
 // ENotificationType enumerates all possible types of notifications that could be met
@@ -304,8 +306,6 @@ public:
 
 	/**
 	 * Checks if passed notification can create toast.
-	 *
-	 * It returns false only for inventory accepted/declined notifications if respective IM window is open (EXT-5909)
 	 */
 	static bool canSpawnToast(const LLNotificationPtr& notification);
 
@@ -314,6 +314,11 @@ public:
 	 */
 	static bool isIMFloaterOpened(const LLNotificationPtr& notification);
 
+	/**
+	* Determines whether IM floater is focused.
+	*/
+	static bool isIMFloaterFocused(const LLNotificationPtr& notification);
+
 	/**
 	 * Writes notification message to IM session.
 	 */
@@ -375,6 +380,14 @@ public:
 	 * Decrements counter of IM messages.
 	 */
 	static void decIMMesageCounter(const LLNotificationPtr& notification);
+
+private:
+
+	/**
+	 * Find IM floater based on "from_id"
+	 */
+	static LLIMFloater* findIMFloater(const LLNotificationPtr& notification);
+
 };
 
 }
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index d3ad61128d..24cffd222b 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -193,10 +193,36 @@ bool LLHandlerUtil::canSpawnSessionAndLogToIM(const LLNotificationPtr& notificat
 // static
 bool LLHandlerUtil::canSpawnToast(const LLNotificationPtr& notification)
 {
-	bool cannot_spawn = isIMFloaterOpened(notification) && (INVENTORY_DECLINED == notification->getName()
-			|| INVENTORY_ACCEPTED == notification->getName());
-	
-	return !cannot_spawn;
+	if(INVENTORY_DECLINED == notification->getName() 
+		|| INVENTORY_ACCEPTED == notification->getName())
+	{
+		// return false for inventory accepted/declined notifications if respective IM window is open (EXT-5909)
+		return ! isIMFloaterOpened(notification);
+	}
+
+	if(FRIENDSHIP_ACCEPTED == notification->getName())
+	{
+		// don't show FRIENDSHIP_ACCEPTED if IM window is opened and focused - EXT-6441
+		return ! isIMFloaterFocused(notification);
+	}
+
+	if(OFFER_FRIENDSHIP == notification->getName()
+		|| USER_GIVE_ITEM == notification->getName()
+		|| TELEPORT_OFFERED == notification->getName())
+	{
+		// When ANY offer arrives, show toast, unless IM window is already open - EXT-5904
+		return ! isIMFloaterOpened(notification);
+	}
+
+	return true;
+}
+
+// static
+LLIMFloater* LLHandlerUtil::findIMFloater(const LLNotificationPtr& notification)
+{
+	LLUUID from_id = notification->getPayload()["from_id"];
+	LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, from_id);
+	return LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id);
 }
 
 // static
@@ -204,12 +230,7 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
 {
 	bool res = false;
 
-	LLUUID from_id = notification->getPayload()["from_id"];
-	LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL,
-			from_id);
-
-	LLIMFloater* im_floater = LLFloaterReg::findTypedInstance<LLIMFloater>(
-					"impanel", session_id);
+	LLIMFloater* im_floater = findIMFloater(notification);
 	if (im_floater != NULL)
 	{
 		res = im_floater->getVisible() == TRUE;
@@ -218,6 +239,19 @@ bool LLHandlerUtil::isIMFloaterOpened(const LLNotificationPtr& notification)
 	return res;
 }
 
+bool LLHandlerUtil::isIMFloaterFocused(const LLNotificationPtr& notification)
+{
+	bool res = false;
+
+	LLIMFloater* im_floater = findIMFloater(notification);
+	if (im_floater != NULL)
+	{
+		res = im_floater->hasFocus() == TRUE;
+	}
+
+	return res;
+}
+
 // static
 void LLHandlerUtil::logToIM(const EInstantMessage& session_type,
 		const std::string& session_name, const std::string& from_name,
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index e93aec9d01..c5960a9040 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -115,15 +115,11 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 				session_id = LLHandlerUtil::spawnIMSession(name, from_id);
 			}
 
-			bool show_toast = true;
+			bool show_toast = LLHandlerUtil::canSpawnToast(notification);
 			bool add_notid_to_im = LLHandlerUtil::canAddNotifPanelToIM(notification);
 			if (add_notid_to_im)
 			{
 				LLHandlerUtil::addNotifPanelToIM(notification);
-				if (LLHandlerUtil::isIMFloaterOpened(notification))
-				{
-					show_toast = false;
-				}
 			}
 
 			if (notification->getPayload().has("SUPPRESS_TOAST")
-- 
cgit v1.2.3


From dc3c0c601693b9f4e35739a48af2c4bf0bffaeb8 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Tue, 23 Mar 2010 12:09:57 +0200
Subject: Fixed normal bug EXT-6436 - Not showing all classifieds in Profile
 sidebar. Updated code to be able to receive classifieds list in two or more
 packets.

---
 indra/newview/llpanelpicks.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index 0a7c39db46..4ac57bc7a4 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -288,7 +288,8 @@ void LLPanelPicks::processProperties(void* data, EAvatarProcessorType type)
 		LLAvatarClassifieds* c_info = static_cast<LLAvatarClassifieds*>(data);
 		if(c_info && getAvatarId() == c_info->target_id)
 		{
-			mClassifiedsList->clear();
+			// do not clear classified list in case we will receive two or more data packets.
+			// list has been cleared in updateData(). (fix for EXT-6436)
 
 			LLAvatarClassifieds::classifieds_list_t::const_iterator it = c_info->classifieds_list.begin();
 			for(; c_info->classifieds_list.end() != it; ++it)
-- 
cgit v1.2.3


From eb119c2268798b4c64fb437806199ee7ae509217 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Tue, 23 Mar 2010 14:09:38 +0200
Subject: Fixed low bug EXT-4081 (Lag Meter: Ctrl+W does not close floater)

- Set 'Close' text of tooltip instead of 'Close (Ctrl+W)' for close button of chrome floaters

Reviewed by Mike Antipov

--HG--
branch : product-engine
---
 indra/llui/llfloater.cpp                       | 12 ++++++++++--
 indra/llui/llfloater.h                         |  8 +++++++-
 indra/newview/skins/default/xui/en/strings.xml |  1 +
 3 files changed, 18 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 33895ac22a..966bd2e85d 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1121,6 +1121,7 @@ void LLFloater::setIsChrome(BOOL is_chrome)
 		setFocus(FALSE);
 		// can't Ctrl-Tab to "chrome" floaters
 		setFocusRoot(FALSE);
+		mButtons[BUTTON_CLOSE]->setToolTip(LLStringExplicit(getButtonTooltip(Params(), BUTTON_CLOSE, is_chrome)));
 	}
 	
 	// no titles displayed on "chrome" floaters
@@ -1845,7 +1846,7 @@ void LLFloater::buildButtons(const Params& floater_params)
 		p.click_callback.function(boost::bind(sButtonCallbacks[i], this));
 		p.tab_stop(false);
 		p.follows.flags(FOLLOWS_TOP|FOLLOWS_RIGHT);
-		p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i);
+		p.tool_tip = getButtonTooltip(floater_params, (EFloaterButton)i, getIsChrome());
 		p.scale_image(true);
 		p.chrome(true);
 
@@ -1900,8 +1901,15 @@ LLUIImage* LLFloater::getButtonPressedImage(const Params& p, EFloaterButton e)
 }
 
 // static
-std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e)
+std::string LLFloater::getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome)
 {
+	// EXT-4081 (Lag Meter: Ctrl+W does not close floater)
+	// If floater is chrome set 'Close' text for close button's tooltip
+	if(is_chrome && BUTTON_CLOSE == e)
+	{
+		static std::string close_tooltip_chrome = LLTrans::getString("BUTTON_CLOSE_CHROME");
+		return close_tooltip_chrome;
+	}
 	// TODO: per-floater localizable tooltips set in XML
 	return sButtonToolTips[e];
 }
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index 97d2bda594..d8c77370f6 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -322,8 +322,14 @@ private:
 	// up by index.
 	static LLUIImage*	getButtonImage(const Params& p, EFloaterButton e);
 	static LLUIImage*	getButtonPressedImage(const Params& p, EFloaterButton e);
-	static std::string	getButtonTooltip(const Params& p, EFloaterButton e);
 	
+	/**
+	 * @params is_chrome - if floater is Chrome it means that floater will never get focus.
+	 * Therefore it can't be closed with 'Ctrl+W'. So the tooltip text of close button( X )
+	 * should be 'Close' not 'Close(Ctrl+W)' as for usual floaters.
+	 */
+	static std::string	getButtonTooltip(const Params& p, EFloaterButton e, bool is_chrome);
+
 	BOOL			offerClickToButton(S32 x, S32 y, MASK mask, EFloaterButton index);
 	void			addResizeCtrls();
 	void			layoutResizeCtrls();
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index c0573c0215..1df3e21de3 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -98,6 +98,7 @@
 	<!-- ButtonToolTips, llfloater.cpp -->
 	<string name="BUTTON_CLOSE_DARWIN">Close (&#8984;W)</string>
 	<string name="BUTTON_CLOSE_WIN">Close (Ctrl+W)</string>
+	<string name="BUTTON_CLOSE_CHROME">Close</string>>
 	<string name="BUTTON_RESTORE">Restore</string>
 	<string name="BUTTON_MINIMIZE">Minimize</string>
 	<string name="BUTTON_TEAR_OFF">Tear Off</string>
-- 
cgit v1.2.3


From 60d680f2eb92e5dbf2ba287f7e4e2e36e1d024e9 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Tue, 23 Mar 2010 16:13:59 +0200
Subject: fixed EXT-4753 Just arrived avatars aren't sorted by name in VCP

added requesting a list to resort when avatar list item gets updated with avatar name from the name cache

--HG--
branch : product-engine
---
 indra/llui/llflatlistview.h        |  5 ++++-
 indra/newview/llavatarlist.cpp     | 11 +++++++++++
 indra/newview/llavatarlist.h       |  2 ++
 indra/newview/llavatarlistitem.cpp |  6 +++++-
 4 files changed, 22 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 92cb40332e..5a1ddc2c59 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -379,11 +379,14 @@ private:
 
 	void setNoItemsCommentVisible(bool visible) const;
 
-private:
+protected:
 
 	/** Comparator to use when sorting the list. */
 	const ItemComparator* mItemComparator;
 
+
+private:
+
 	LLPanel* mItemsPanel;
 
 	S32 mItemsNoScrollWidth;
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 45c540b3a3..91ebe910ce 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -334,6 +334,17 @@ boost::signals2::connection LLAvatarList::setItemDoubleClickCallback(const mouse
 	return mItemDoubleClickSignal.connect(cb);
 }
 
+//virtual
+S32 LLAvatarList::notifyParent(const LLSD& info)
+{
+	if (info.has("sort") && &NAME_COMPARATOR == mItemComparator)
+	{
+		sort();
+		return 1;
+	}
+	return LLFlatListView::notifyParent(info);
+}
+
 void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
 {
 	LLAvatarListItem* item = new LLAvatarListItem();
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 00c72f1f9d..b9be1d0bdc 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -96,6 +96,8 @@ public:
 
 	boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb);
 
+	virtual S32 notifyParent(const LLSD& info);
+
 protected:
 	void refresh();
 
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 9645e75e60..44f88cce29 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -119,8 +119,9 @@ S32 LLAvatarListItem::notifyParent(const LLSD& info)
 	if (info.has("visibility_changed"))
 	{
 		updateChildren();
+		return 1;
 	}
-	return 0;
+	return LLPanel::notifyParent(info);
 }
 
 void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -334,6 +335,9 @@ void LLAvatarListItem::onNameCache(const std::string& first_name, const std::str
 {
 	std::string name = first_name + " " + last_name;
 	setName(name);
+
+	//requesting the list to resort
+	notifyParent(LLSD().with("sort", LLSD()));
 }
 
 // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years",
-- 
cgit v1.2.3


From c008004e1806464982ec2f0d4b31d2cf9c094115 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Tue, 23 Mar 2010 20:34:12 +0200
Subject: Fixed low bug (Menu bar background + Master Volume control display in
 Mouselook mode) - removed overlaping of master volume and nearby media icons
 in mouselook mode

--HG--
branch : product-engine
---
 indra/newview/llstatusbar.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 9206b4a43a..4198f047d4 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -371,6 +371,8 @@ void LLStatusBar::setVisibleForMouselook(bool visible)
 	mTextTime->setVisible(visible);
 	getChild<LLUICtrl>("buycurrency")->setVisible(visible);
 	getChild<LLUICtrl>("buyL")->setVisible(visible);
+	mBtnVolume->setVisible(visible);
+	mMediaToggle->setVisible(visible);
 	mSGBandwidth->setVisible(visible);
 	mSGPacketLoss->setVisible(visible);
 	setBackgroundVisible(visible);
-- 
cgit v1.2.3


From 2768663081b27c39202f292ca53d98c381419e12 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Tue, 23 Mar 2010 20:34:12 +0200
Subject: Related to normal bug EXT-5715(Conversations window auto-resizes when
 new conversation starts.) - disabled auto-resizing of well window if it was
 reshaped by user.

--HG--
branch : product-engine
---
 indra/newview/llsyswellwindow.cpp | 12 ++++++++++--
 indra/newview/llsyswellwindow.h   |  3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llsyswellwindow.cpp b/indra/newview/llsyswellwindow.cpp
index 66373feb93..cbb030836e 100644
--- a/indra/newview/llsyswellwindow.cpp
+++ b/indra/newview/llsyswellwindow.cpp
@@ -58,7 +58,8 @@ LLSysWellWindow::LLSysWellWindow(const LLSD& key) : LLTransientDockableFloater(N
 													mSysWellChiclet(NULL),
 													mSeparator(NULL),
 													NOTIFICATION_WELL_ANCHOR_NAME("notification_well_panel"),
-													IM_WELL_ANCHOR_NAME("im_well_panel")
+													IM_WELL_ANCHOR_NAME("im_well_panel"),
+													mIsReshapedByUser(false)
 
 {
 	mTypedItemsCount[IT_NOTIFICATION] = 0;
@@ -99,6 +100,13 @@ void LLSysWellWindow::setMinimized(BOOL minimize)
 	LLTransientDockableFloater::setMinimized(minimize);
 }
 
+//---------------------------------------------------------------------------------
+void LLSysWellWindow::handleReshape(const LLRect& rect, bool by_user)
+{
+	mIsReshapedByUser |= by_user; // mark floater that it is reshaped by user
+	LLTransientDockableFloater::handleReshape(rect, by_user);
+}
+
 //---------------------------------------------------------------------------------
 void LLSysWellWindow::onStartUpToastClick(S32 x, S32 y, MASK mask)
 {
@@ -211,7 +219,7 @@ void LLSysWellWindow::reshapeWindow()
 	// it includes height from floater top to list top and from floater bottom and list bottom
 	static S32 parent_list_delta_height = getRect().getHeight() - mMessageList->getRect().getHeight();
 
-	if (isDocked()) // Don't reshape undocked Well window. See EXT-5715.
+	if (!mIsReshapedByUser) // Don't reshape Well window, if it ever was reshaped by user. See EXT-5715.
 	{
 		S32 notif_list_height = mMessageList->getItemsRect().getHeight() + 2 * mMessageList->getBorderWidth();
 
diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h
index 3790aa3ea9..296bdf7482 100644
--- a/indra/newview/llsyswellwindow.h
+++ b/indra/newview/llsyswellwindow.h
@@ -70,6 +70,7 @@ public:
 	/*virtual*/ void	setDocked(bool docked, bool pop_on_undock = true);
 	// override LLFloater's minimization according to EXT-1216
 	/*virtual*/ void	setMinimized(BOOL minimize);
+	/*virtual*/ void	handleReshape(const LLRect& rect, bool by_user);
 
 	void onStartUpToastClick(S32 x, S32 y, MASK mask);
 
@@ -121,7 +122,7 @@ protected:
 
 	typedef std::map<EItemType, S32> typed_items_count_t;
 	typed_items_count_t mTypedItemsCount;
-
+	bool mIsReshapedByUser;
 };
 
 /**
-- 
cgit v1.2.3


From ae9e68f251033f8ed0b40163f778d8f4460634d3 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Tue, 23 Mar 2010 21:33:09 +0200
Subject: Fixed normal bug (EXT-6340) Crash when attempting to
 getChild<LLAccordionCtrlTab>("accordion_tab_name") and "accordion_tab_name"
 is not found. - Added NULL pointer checks.

--HG--
branch : product-engine
---
 indra/llui/llaccordionctrltab.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 1067c3f1d5..0247935a7c 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -465,10 +465,11 @@ void LLAccordionCtrlTab::setHeaderVisible(bool value)
 	reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
 };
 
-//vurtual
+//virtual
 BOOL LLAccordionCtrlTab::postBuild()
 {
-	mHeader->setVisible(mHeaderVisible);
+	if(mHeader)
+		mHeader->setVisible(mHeaderVisible);
 	
 	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
 
@@ -504,7 +505,8 @@ BOOL LLAccordionCtrlTab::postBuild()
 		mScrollbar->setVisible(false);
 	}
 
-	mContainerPanel->setVisible(mDisplayChildren);
+	if(mContainerPanel)
+		mContainerPanel->setVisible(mDisplayChildren);
 
 	return LLUICtrl::postBuild();
 }
-- 
cgit v1.2.3


From f99fae683736961ceda866c7778ad96ab559f496 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Tue, 23 Mar 2010 21:36:27 +0200
Subject: Fixed normal bug (EXT-5690) "delete" button is enabled for landmarks
 from trash - Added check for landmarks already in trash to disable "delete"
 button for them.

--HG--
branch : product-engine
---
 indra/newview/llpanellandmarks.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 879fbba9cd..be460e8e5c 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -1072,7 +1072,7 @@ bool LLLandmarksPanel::canSelectedBeModified(const std::string& command_name) co
 		}
 		else if ("delete" == command_name)
 		{
-			can_be_modified = listenerp ? listenerp->isItemRemovable() : false;
+			can_be_modified = listenerp ? listenerp->isItemRemovable() && !listenerp->isItemInTrash() : false;
 		}
 		else if("paste" == command_name)
 		{
-- 
cgit v1.2.3


From cf6b233e50135a961a9be4e8e00c846466060bf8 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Tue, 23 Mar 2010 21:47:17 +0200
Subject: Fixed critical bug EXT-6468 (group creation process ignores group
 options set prior to creation).

Submitting on behalf of Yuri Cheborarev.

Reviewed by Leyla: https://codereview.productengine.com/secondlife/r/81/

--HG--
branch : product-engine
---
 indra/newview/llpanelgroupgeneral.cpp                      |  8 +++++---
 indra/newview/skins/default/xui/en/panel_group_general.xml | 11 +++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 517204b232..0a83ba8212 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -820,15 +820,15 @@ void LLPanelGroupGeneral::reset()
 	
 	mCtrlListGroup->set(true);
 	
-	mCtrlReceiveNotices->setEnabled(true);
+	mCtrlReceiveNotices->setEnabled(false);
 	mCtrlReceiveNotices->setVisible(true);
 
-	mCtrlListGroup->setEnabled(true);
+	mCtrlListGroup->setEnabled(false);
 
 	mGroupNameEditor->setEnabled(TRUE);
 	mEditCharter->setEnabled(TRUE);
 
-	mCtrlShowInGroupList->setEnabled(TRUE);
+	mCtrlShowInGroupList->setEnabled(false);
 	mComboMature->setEnabled(TRUE);
 	
 	mCtrlOpenEnrollment->setEnabled(TRUE);
@@ -934,6 +934,8 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
 		mCtrlListGroup->setEnabled(data.mID.notNull());
 	}
 
+	mCtrlShowInGroupList->setEnabled(data.mID.notNull());
+
 	mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
 	
 	mComboActiveTitle = getChild<LLComboBox>("active_title");
diff --git a/indra/newview/skins/default/xui/en/panel_group_general.xml b/indra/newview/skins/default/xui/en/panel_group_general.xml
index f913c58cc9..9341d433e8 100644
--- a/indra/newview/skins/default/xui/en/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_general.xml
@@ -241,14 +241,17 @@ Hover your mouse over the options for more help.
          tool_tip="Sets whether your group contains information rated as Moderate"
          top_pad="4"
          width="190">
+			<combo_item name="select_mature" value="Select">
+			- Select Mature -
+			</combo_item>
             <combo_box.item
-             label="General Content"
-             name="pg"
-             value="Not Mature" />
-             <combo_box.item
              label="Moderate Content"
              name="mature"
              value="Mature" />
+            <combo_box.item
+             label="General Content"
+             name="pg"
+             value="Not Mature" />
         </combo_box>
         <check_box
          follows="left|top"
-- 
cgit v1.2.3


From 2edbd733843d5ad0f9ec3dec49e676651bda07af Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Tue, 23 Mar 2010 22:10:04 +0200
Subject: Major task (EXT-5106) Side panel list view toolbars are missing
 background art - Added "on hover" textures for toolbar buttons to
 textures.xml - Adjusted toolbars for list views according to style guide. -
 Adjusted tab container width, height and positioning for People, Places,
 Inventory, Appearance SP's. - Applied "over", "selected", "unselected"
 textures for toolbar buttons. - Fixed bottom buttons position and bottom
 panel height in Appearance and People tabs.

Reviewed by Leyla Farazha https://codereview.productengine.com/secondlife/r/82/

--HG--
branch : product-engine
---
 indra/newview/skins/default/textures/textures.xml  |   3 +
 .../skins/default/xui/en/panel_landmarks.xml       |  86 ++++---
 .../skins/default/xui/en/panel_main_inventory.xml  |  71 +++---
 .../default/xui/en/panel_outfits_inventory.xml     |  72 +++---
 .../newview/skins/default/xui/en/panel_people.xml  | 276 +++++++++++++--------
 .../newview/skins/default/xui/en/panel_places.xml  |   2 +-
 .../default/xui/en/panel_teleport_history.xml      |  65 ++---
 7 files changed, 334 insertions(+), 241 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index a3e5361e76..fed326c25e 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -616,12 +616,15 @@ with the same filename but different name
 
   <texture name="Toolbar_Divider" file_name="containers/Toolbar_Divider.png" preload="false" />
   <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
+  <texture name="Toolbar_Left_Over" file_name="containers/Toolbar_Left_Over.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Press" file_name="containers/Toolbar_Left_Press.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
+  <texture name="Toolbar_Middle_Over" file_name="containers/Toolbar_Middle_Over.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Press" file_name="containers/Toolbar_Middle_Press.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
+  <texture name="Toolbar_Right_Over" file_name="containers/Toolbar_Right_Over.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
 
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index ee8bca6f83..639e5d30ef 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -3,22 +3,25 @@
    name="Landmarks"
    top="0"
    height="400"
-   layout="topleft" 
+   layout="topleft"
    left="0"
-   width="380"
+   width="313"
    help_topic="panel_landmarks"
    border="false"
    background_visible="true"
-   bg_alpha_color="DkGray2"
+   bg_alpha_color="DkGray"
    follows="all">
     <accordion
+     background_visible="true"
+     bg_alpha_color="DkGray2"
+     bg_opaque_color="DkGray2"
      follows="all"
-     height="360"
+     height="369"
      layout="topleft"
-     left="0"
+     left="3"
      name="landmarks_accordion"
      top="0"
-     width="380">
+     width="307">
         <accordion_tab
          layout="topleft"
          name="tab_favorites"
@@ -33,7 +36,7 @@
              mouse_opaque="true"
              name="favorites_list"
              start_folder="Favorites"
-             width="380"/>
+             width="307"/>
         </accordion_tab>
         <accordion_tab
          layout="topleft"
@@ -49,7 +52,7 @@
              mouse_opaque="true"
              name="landmarks_list"
              start_folder="Landmarks"
-             width="380"/>
+             width="307"/>
         </accordion_tab>
         <accordion_tab
          layout="topleft"
@@ -65,7 +68,7 @@
              mouse_opaque="true"
              name="my_inventory_list"
              start_folder="My Inventory"
-             width="380"/>
+             width="307"/>
           </accordion_tab>
           <accordion_tab
            layout="topleft"
@@ -81,55 +84,64 @@
              mouse_opaque="true"
              name="library_list"
              start_folder="LIBRARY"
-             width="380"/>
+             width="313"/>
         </accordion_tab>
     </accordion>
     <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+     background_visible="true"
      bevel_style="none"
      bottom="0"
      follows="left|right|bottom"
-     height="38"
+     height="27"
      layout="bottomleft"
-     left="0"
+     left="3"
      name="bottom_panel"
-     width="380">
+     width="313">
         <button
          follows="bottom|left"
          tool_tip="Show additional options"
-         height="18"
-         image_disabled="OptionsMenu_Disabled"
-         image_selected="OptionsMenu_Press"
-         image_unselected="OptionsMenu_Off"
+         height="25"
+         image_hover_unselected="Toolbar_Left_Over"
+         image_overlay="OptionsMenu_Off"
+         image_selected="Toolbar_Left_Selected"
+         image_unselected="Toolbar_Left_Off"
          layout="topleft"
-         left="10"
+         left="0"
          name="options_gear_btn"
-         top="14"
-         width="18" />
+         top="1"
+         width="31" />
         <button
          follows="bottom|left"
-         height="18"
-         image_selected="AddItem_Press"
-         image_unselected="AddItem_Off"
-         image_disabled="AddItem_Disabled"
+         height="25"
+         image_hover_unselected="Toolbar_Middle_Over"
+         image_overlay="AddItem_Off"
+         image_selected="Toolbar_Middle_Selected"
+         image_unselected="Toolbar_Middle_Off"
          layout="topleft"
-         left_pad="10"
+         left_pad="1"
          name="add_btn"
          tool_tip="Add new landmark"
-         width="18" />
+         width="31" />
+        <icon
+         follows="bottom|left"
+         height="25"
+         image_name="Toolbar_Middle_Off"
+         layout="topleft"
+         left_pad="1"
+         name="dummy_icon"
+         width="209"
+         />
         <dnd_button
-         follows="bottom|right"
-         height="18"
-         image_selected="TrashItem_Press"
-         image_unselected="TrashItem_Off"
+         follows="bottom|left"
+         height="25"
+         image_hover_unselected="Toolbar_Right_Over"
+         image_overlay="TrashItem_Off"
+         image_selected="Toolbar_Right_Selected"
+         image_unselected="Toolbar_Right_Off"
          layout="topleft"
-         right="-8"
+         left_pad="1"
          name="trash_btn"
          tool_tip="Remove selected landmark"
-         top="14"
-         width="18" />
+         width="31" />
     </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index c7768c6eb6..bef62f48e0 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -417,15 +417,15 @@
        background_opaque="true"
        follows="all"
        halign="center"
-       height="300"
+       height="306"
        layout="topleft"
-       left="6"
+       left="7"
        name="inventory filter tabs"
        tab_height="30"
        tab_position="top"
        tab_min_width="100"
        top_pad="10"
-       width="315">
+       width="312">
         <inventory_panel
             bg_opaque_color="DkGray2"
        bg_alpha_color="DkGray2"
@@ -442,7 +442,7 @@
          name="All Items"
          sort_order_setting="InventorySortOrder"
          top="16"
-         width="290" />
+         width="288" />
         <inventory_panel
             bg_opaque_color="DkGray2"
        bg_alpha_color="DkGray2"
@@ -451,7 +451,7 @@
 	       border="false"
 	       bevel_style="none"
          follows="all"
-         height="295"
+         height="293"
          label="RECENT"
          help_topic="recent_inventory_tab"
          layout="topleft"
@@ -461,52 +461,61 @@
     </tab_container>
 
     <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
        background_visible="true"
-       background_opaque="true"
      bevel_style="none"
      follows="left|right|bottom"
-     height="38"
+     height="27"
      layout="topleft"
-     top_pad="-1"
-     left="9"
+     top_pad="4"
+     left="10"
      name="bottom_panel"
      width="310">
         <button
          follows="bottom|left"
          tool_tip="Show additional options"
-         height="18"
-         image_disabled="OptionsMenu_Disabled"
-         image_selected="OptionsMenu_Press"
-         image_unselected="OptionsMenu_Off"
+         height="25"
+         image_hover_unselected="Toolbar_Left_Over"
+         image_overlay="OptionsMenu_Off"
+         image_selected="Toolbar_Left_Selected"
+         image_unselected="Toolbar_Left_Off"
          layout="topleft"
-         left="8"
+         left="0"
          name="options_gear_btn"
-         top="14"
-         width="18" />
+         top="1"
+         width="31" />
         <button
          follows="bottom|left"
-         height="18"
-         image_selected="AddItem_Press"
-         image_unselected="AddItem_Off"
-         image_disabled="AddItem_Disabled"
+         height="25"
+         image_hover_unselected="Toolbar_Middle_Over"
+         image_overlay="AddItem_Off"
+         image_selected="Toolbar_Middle_Selected"
+         image_unselected="Toolbar_Middle_Off"
          layout="topleft"
-         left_pad="10"
+         left_pad="1"
          name="add_btn"
          tool_tip="Add new item"
-         width="18" />
+         width="31" />
+       <icon
+        follows="bottom|left"
+        height="25"
+        image_name="Toolbar_Middle_Off"
+        layout="topleft"
+        left_pad="1"
+        name="dummy_icon"
+        width="209"
+       />
         <dnd_button
-         follows="bottom|right"
-         height="18"
-         image_selected="TrashItem_Press"
-         image_unselected="TrashItem_Off"
+         follows="bottom|left"
+         height="25"
+         image_hover_unselected="Toolbar_Right_Over"
+         image_overlay="TrashItem_Off"
+         image_selected="Toolbar_Right_Selected"
+         image_unselected="Toolbar_Right_Off"
+         left_pad="1" 
          layout="topleft"
-         right="-7"
          name="trash_btn"
          tool_tip="Remove selected item"
-         top="14"
-         width="18" />
+         width="31"/>
     </panel>
 
     
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index cc60b97f92..66ef373168 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel name="Outfits"
+ bg_alpha_color="DkGray"
+ bg_opaque_color="DkGray"
+ background_opaque="true"
  background_visible="true"
   follows="all"
  height="570"
@@ -11,15 +14,15 @@
  border="false">
    <tab_container
      follows="all"
-     height="490"
+     height="497"
      layout="topleft"
-     left="6"
+     left="7"
      name="appearance_tabs"
      tab_min_width="140"
      tab_height="30"
      tab_position="top"
      halign="center"
-     width="315">
+     width="312">
          <inventory_panel
            background_visible="true"
            background_opaque="true"
@@ -30,7 +33,7 @@
            border="false"
            left="0"
            top="0"
-           width="314"
+           width="315"
            mouse_opaque="true"
            name="outfitslist_tab"
            start_folder="My Outfits" /> 
@@ -47,53 +50,53 @@
            mouse_opaque="true"
            name="cof_tab"
            start_folder="Current Outfit"
-           width="313" />
+           width="315" />
    </tab_container>
 	 <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
        background_visible="true"
-       background_opaque="true"
-     follows="left|right|bottom"
-	  height="38"
-	  layout="topleft"
-	  left="9"
-	  visible="true"
-	  top_pad="-1"
-     width="310" />
-	<panel
-	  background_visible="false"
 	  follows="bottom|left"
 	  height="73"
 	  layout="topleft"
 	  left="9"
+	  top_pad="3"
 	  visible="true"
 	  name="bottom_panel"
-	  top_pad="-38"
 	  width="310">
         <button
          follows="bottom|left"
          tool_tip="Show additional options"
-         height="18"
-         image_disabled="OptionsMenu_Disabled"
-         image_selected="OptionsMenu_Press"
-         image_unselected="OptionsMenu_Off"
+         height="25"
+         image_hover_unselected="Toolbar_Left_Over"
+         image_overlay="OptionsMenu_Off"
+         image_selected="Toolbar_Left_Selected"
+         image_unselected="Toolbar_Left_Off"
          layout="topleft"
-         left="8"
+         left="1"
          name="options_gear_btn"
-         top="14"
-         width="18" />
+         top="1"
+         width="31" />
+     <icon
+      follows="bottom|left"
+      height="25"
+      image_name="Toolbar_Middle_Off"
+      layout="topleft"
+      left_pad="1"
+      name="dummy_icon"
+      width="241"
+        />
+
         <dnd_button
-         follows="bottom|right"
-         height="18"
-         image_selected="TrashItem_Press"
-         image_unselected="TrashItem_Off"
+         follows="bottom|left"
+         height="25"
+         image_hover_unselected="Toolbar_Right_Over"
+          image_overlay="TrashItem_Off"
+          image_selected="Toolbar_Right_Selected"
+          image_unselected="Toolbar_Right_Off"
          layout="topleft"
-         right="-9"
+         left_pad="1"
          name="trash_btn"
          tool_tip="Remove selected item"
-         top="14"
-         width="18" />
+         width="31"/>
 	 <button
 	  follows="bottom|left"
 		height="23" 
@@ -101,7 +104,7 @@
       layout="topleft"
       name="make_outfit_btn"
       tool_tip="Save appearance as an outfit"
-       top="43"
+       top_pad="6"
        left="0"
       width="153" />
      <button
@@ -111,7 +114,6 @@
       layout="topleft"
       name="wear_btn"
       left_pad="3"
-       top="43"
       tool_tip="Wear selected outfit"
       width="152" />
 	 <button
@@ -126,4 +128,4 @@
 		width="20" />
 	 </panel>
        
-</panel>
+</panel>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 13791a6d32..85841da48f 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -2,13 +2,13 @@
 <!-- Side tray panel -->
 <panel
  follows="all"
+ height="449"
  label="People"
  layout="topleft"
- height="449"
+ left="0"
  min_height="350"
  name="people_panel"
  top="0"
- left="0"
  width="333">
     <string
      name="no_people"
@@ -39,7 +39,6 @@
      name="no_groups_msg"
      value="[secondlife:///app/search/groups Try searching for some groups to join.]" />
     <filter_editor
-     text_pad_left="10"
      follows="left|top|right"
      height="23"
      layout="topleft"
@@ -48,6 +47,7 @@
      max_length="300"
      name="filter_input"
      text_color="Black"
+     text_pad_left="10"
      top="3"
      width="303" />
     <tab_container
@@ -63,10 +63,10 @@
      halign="center"
      width="317">
      	<panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+         background_opaque="true"
+         background_visible="true"
+         bg_alpha_color="DkGray"
+         bg_opaque_color="DkGray"
          follows="all"
          height="383"
          label="NEARBY"
@@ -78,56 +78,70 @@
          width="313">
             <avatar_list
              allow_select="true"
+       		 bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
-             height="345"
+             height="352"
              ignore_online_status="true"
              layout="topleft"
-             left="0"
+             left="3"
              multi_select="true"
              name="avatar_list"
              top="0"
-             width="313" />
+             width="307" />
             <panel
+             background_visible="true"
              follows="left|right|bottom"
-             height="38"
+             height="27"
              label="bottom_panel"
              layout="topleft"
-             left="0"
+             left="3"
              name="bottom_panel"
              width="313">
              <button
              follows="bottom|left"
-             tool_tip="Options"
-             height="18"
-             image_disabled="OptionsMenu_Disabled"
-             image_selected="OptionsMenu_Press"
-             image_unselected="OptionsMenu_Off"
+             height="25"
+             image_hover_unselected="Toolbar_Left_Over"
+             image_overlay="OptionsMenu_Off"
+             image_selected="Toolbar_Left_Selected"
+             image_unselected="Toolbar_Left_Off"
              layout="topleft"
-             left="10"
+             left="0"
              name="nearby_view_sort_btn"
-             top="10"
-             width="18" />
+             tool_tip="Options"
+             top="1"
+             width="31" />
              <button
                  follows="bottom|left"
-                 height="18"
-                 image_selected="AddItem_Press"
-                 image_unselected="AddItem_Off"
-                 image_disabled="AddItem_Disabled"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+             	 image_overlay="AddItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+             	 image_unselected="Toolbar_Middle_Off"
                  layout="topleft"
-                 left_pad="10"
+                 left_pad="1"
                  name="add_friend_btn"
                  tool_tip="Add selected Resident to your friends List"
-                 width="18">
+                 width="31">
                <commit_callback
                   function="People.addFriend" />
              </button>
+             <icon
+             follows="bottom|left"
+             height="25"
+             image_name="Toolbar_Right_Off"
+             layout="topleft"
+             left_pad="1"
+             name="dummy_icon"
+             width="241"
+             />
             </panel>
         </panel>
         <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+         background_opaque="true"
+         background_visible="true"
+         bg_alpha_color="DkGray"
+         bg_opaque_color="DkGray"
          follows="all"
          height="383"
          label="MY FRIENDS"
@@ -138,13 +152,16 @@
          top="0"
          width="313">
             <accordion
+       		 background_visible="true"
+       		 bg_alpha_color="DkGray2"
+       		 bg_opaque_color="DkGray2"
              follows="all"
-             height="345"
+             height="352"
              layout="topleft"
-             left="0"
+             left="3"
              name="friends_accordion"
              top="0"
-             width="313">
+             width="307">
                 <accordion_tab
                  layout="topleft"
                  height="172"
@@ -160,7 +177,7 @@
                          multi_select="true"
                          name="avatars_online"
                          top="0"
-                         width="313" />
+                         width="307" />
                 </accordion_tab>
                 <accordion_tab
                  layout="topleft"
@@ -176,53 +193,64 @@
                          multi_select="true"
                          name="avatars_all"
                          top="0"
-                         width="313" />
+                         width="307" />
                 </accordion_tab>
             </accordion>
             <panel
+             background_visible="true"
              follows="left|right|bottom"
-             height="38"
+             height="27"
              label="bottom_panel"
              layout="topleft"
-             left="0"
+             left="3"
              name="bottom_panel"
              width="313">
                <button
                follows="bottom|left"
                tool_tip="Options"
-               height="18"
-               image_disabled="OptionsMenu_Disabled"
-               image_selected="OptionsMenu_Press"
-               image_unselected="OptionsMenu_Off"
+               height="25"
+               image_hover_unselected="Toolbar_Left_Over"
+               image_overlay="OptionsMenu_Off"
+               image_selected="Toolbar_Left_Selected"
+               image_unselected="Toolbar_Left_Off"
                layout="topleft"
-               left="10"
+               left="0"
                name="friends_viewsort_btn"
-               top="10"
-               width="18" />
+               top="1"
+               width="31" />
                 <button
                  follows="bottom|left"
-                 height="18"
-                 image_selected="AddItem_Press"
-                 image_unselected="AddItem_Off"
-                 image_disabled="AddItem_Disabled"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+             	 image_overlay="AddItem_Off"
+             	 image_selected="Toolbar_Middle_Selected"
+             	 image_unselected="Toolbar_Middle_Off"
                  layout="topleft"
-                 left_pad="10"
+                 left_pad="1"
                  name="add_btn"
                  tool_tip="Offer friendship to a Resident"
-                 width="18" />
+                 width="31" />
+                <icon
+             	 follows="bottom|left"
+             	 height="25"
+             	 image_name="Toolbar_Middle_Off"
+             	 layout="topleft"
+             	 left_pad="1"
+             	 name="dummy_icon"
+             	 width="210"
+             />
                 <button
                  follows="bottom|left"
-                 height="18"
-                 image_selected="TrashItem_Press"
-                 image_unselected="TrashItem_Off"
-                 image_disabled="TrashItem_Disabled"
+                 height="25"
+                 image_hover_unselected="Toolbar_Right_Over"
+                 image_overlay="TrashItem_Off"
+                 image_selected="Toolbar_Right_Selected"
+                 image_unselected="Toolbar_Right_Off"
                  layout="topleft"
-                 left_pad="10"
-                 right="-10"
+                 left_pad="1"
                  name="del_btn"
                  tool_tip="Remove selected person from your Friends list"
-                 top_delta="0"
-                 width="18" />
+                 width="31" />
             </panel>
             <text
              follows="all"
@@ -237,10 +265,10 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
              </text>
         </panel>
         <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+         background_opaque="true"
+         background_visible="true"
+         bg_alpha_color="DkGray"
+         bg_opaque_color="DkGray"
          follows="all"
          height="383"
          label="MY GROUPS"
@@ -255,18 +283,22 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
      Values are set from appropriate strings at the top of file via LLPeoplePanel::postBuild()
     -->
             <group_list
+             background_visible="true"
+             bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
-             height="345"
+             height="352"
              layout="topleft"
-             left="0"
+             left="3"
              name="group_list"
              no_filtered_groups_msg="[secondlife:///app/search/groups Try finding the group in search?]"
              no_groups_msg="[secondlife:///app/search/groups Try searching for some groups to join.]"
              top="0"
-             width="313" />
+             width="307" />
             <panel
+             background_visible="true"
              follows="left|right|bottom"
-             height="38"
+             height="27"
              label="bottom_panel"
              layout="topleft"
              left="0"
@@ -275,45 +307,56 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
                <button
                follows="bottom|left"
                tool_tip="Options"
-               height="18"
-               image_disabled="OptionsMenu_Disabled"
-               image_selected="OptionsMenu_Press"
-               image_unselected="OptionsMenu_Off"
+               height="25"
+               image_hover_unselected="Toolbar_Left_Over"
+               image_overlay="OptionsMenu_Off"
+               image_selected="Toolbar_Left_Selected"
+               image_unselected="Toolbar_Left_Off"
                layout="topleft"
-               left="10"
+               left="3"
                name="groups_viewsort_btn"
-               top="10"
-               width="18" />
+               top="1"
+               width="31" />
                 <button
                  follows="bottom|left"
-                 height="18"
-                 image_selected="AddItem_Press"
-                 image_unselected="AddItem_Off"
-                 image_disabled="AddItem_Disabled"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="AddItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
                  layout="topleft"
-                 left_pad="10"
+                 left_pad="1"
                  name="plus_btn"
                  tool_tip="Join group/Create new group"
-                 width="18" />
+                 width="31" />
                 <button
                  follows="bottom|left"
-                 height="10"
-                 image_hover_selected="Activate_Checkmark"
-                 image_selected="Activate_Checkmark"
-                 image_unselected="Activate_Checkmark"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="Activate_Checkmark"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
                  layout="topleft"
-                 left_pad="10"
+                 left_pad="1"
                  name="activate_btn"
                  tool_tip="Activate selected group"
-                 top_delta="4"
-                 width="10" />
+                 width="31" />
+                 <icon
+             	 follows="bottom|left"
+             	 height="25"
+             	 image_name="Toolbar_Right_Off"
+             	 layout="topleft"
+             	 left_pad="1"
+             	 name="dummy_icon"
+             	 width="209"
+             />
             </panel>
         </panel>
         <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+         background_opaque="true"
+         background_visible="true"
+         bg_alpha_color="DkGray"
+         bg_opaque_color="DkGray"
          follows="all"
          height="383"
          label="RECENT"
@@ -325,18 +368,22 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
          width="313">
             <avatar_list
              allow_select="true"
+       		 background_visible="true"
+       		 bg_alpha_color="DkGray2"
+             bg_opaque_color="DkGray2"
              follows="all"
-             height="345"
+             height="352"
              layout="topleft"
-             left="0"
+             left="3"
              multi_select="true"
              name="avatar_list"
              show_last_interaction_time="true"
              top="0"
-             width="313" />
+             width="307" />
             <panel
+             background_visible="true"
              follows="left|right|bottom"
-             height="38"
+             height="27"
              label="bottom_panel"
              layout="topleft"
              left="0"
@@ -345,30 +392,40 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
                <button
                follows="bottom|left"
                tool_tip="Options"
-               height="18"
-               image_disabled="OptionsMenu_Disabled"
-               image_selected="OptionsMenu_Press"
-               image_unselected="OptionsMenu_Off"
+               height="25"
+               image_hover_unselected="Toolbar_Left_Over"
+               image_overlay="OptionsMenu_Off"
+               image_selected="Toolbar_Left_Selected"
+               image_unselected="Toolbar_Left_Off"
                layout="topleft"
-               left="10"
+               left="3"
                name="recent_viewsort_btn"
-               top="10"
-               width="18" />
+               top="1"
+               width="31" />
               <button
                  follows="bottom|left"
-                 height="18"
-                 image_selected="AddItem_Press"
-                 image_unselected="AddItem_Off"
-                 image_disabled="AddItem_Disabled"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="AddItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
                  layout="topleft"
-                 left_pad="10"
+                 left_pad="1"
                  name="add_friend_btn"
-                 top_delta="0"
                  tool_tip="Add selected Resident to your friends List"
-                 width="18">
+                 width="31">
                 <commit_callback
                    function="People.addFriend" />
               </button>
+              <icon
+             	 follows="bottom|left"
+             	 height="25"
+             	 image_name="Toolbar_Right_Off"
+             	 layout="topleft"
+             	 left_pad="1"
+             	 name="dummy_icon"
+             	 width="241"
+             />
             </panel>
         </panel>
     </tab_container>
@@ -377,7 +434,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
      height="23"
      layout="topleft"
      left="8"
-     top_pad="0"
+     top_pad="4"
      name="button_bar"
      width="313">
         <button
@@ -387,6 +444,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
          layout="topleft"
          name="view_profile_btn"
          tool_tip="Show picture, groups, and other Residents information"
+         top="0"
          width="70" />
         <button
          follows="bottom|left"
diff --git a/indra/newview/skins/default/xui/en/panel_places.xml b/indra/newview/skins/default/xui/en/panel_places.xml
index ff5d89470c..c61007a9e1 100644
--- a/indra/newview/skins/default/xui/en/panel_places.xml
+++ b/indra/newview/skins/default/xui/en/panel_places.xml
@@ -65,7 +65,7 @@ background_visible="true"
      visible="false"
      width="315" />
     <panel
-     height="19"
+     height="23"
      layout="topleft"
      left="4"
      name="button_panel"
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index 0d4f67f94c..cbcaf1a58c 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -1,17 +1,19 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel name="Teleport History" bottom="0" height="400" left="0" width="380"
+<panel name="Teleport History" bottom="0" height="400" left="0" width="313"
      help_topic="panel_teleport_history"
-     border="false" follows="left|top|right|bottom">     
+     border="false" follows="left|top|right|bottom"
+     background_visible="true"
+     bg_alpha_color="DkGray">     
     <accordion
      follows="left|top|right|bottom"
-     height="368"
+     height="369"
      layout="topleft"
-     left="0"
+     left="3"
      top="0"
      name="history_accordion"
    background_visible="true"
    bg_alpha_color="DkGray2"
-     width="380">
+     width="307">
 	    <accordion_tab
          layout="topleft"
          name="today"
@@ -23,7 +25,7 @@
              left="0"
              name="today_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -37,7 +39,7 @@
              left="0"
              name="yesterday_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -51,7 +53,7 @@
              left="0"
              name="2_days_ago"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -65,7 +67,7 @@
              left="0"
              name="3_days_ago"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -79,7 +81,7 @@
              left="0"
              name="4_days_ago"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -93,7 +95,7 @@
              left="0"
              name="5_days_ago_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -107,7 +109,7 @@
              left="0"
              name="6_days_and_older_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -121,7 +123,7 @@
              left="0"
              name="1_month_and_older_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
         <accordion_tab
@@ -135,34 +137,41 @@
              left="0"
              name="6_months_and_older_items"
              top="0"
-             width="380">
+             width="307">
 	        </flat_list_view>
 	    </accordion_tab>
     </accordion>
     <panel
-            bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
-       background_visible="true"
-       background_opaque="true"
+     background_visible="true"
      bevel_style="none"
      bottom="0"
      follows="left|right|bottom"
-     height="38"
+     height="27"
      layout="bottomleft"
-     left="0"
+     left="3"
      name="bottom_panel"
-     width="380">
+     width="313">
         <button
          follows="bottom|left"
          tool_tip="Show additional options"
-         height="18"
-         image_disabled="OptionsMenu_Disabled"
-         image_selected="OptionsMenu_Press"
-         image_unselected="OptionsMenu_Off"
+         height="25"
+         image_hover_unselected="Toolbar_Left_Over"
+         image_overlay="OptionsMenu_Off"
+         image_selected="Toolbar_Left_Selected"
+         image_unselected="Toolbar_Left_Off"
          layout="topleft"
-         left="10"
+         left="0"
          name="gear_btn"
-         top="14"
-         width="18" />
+         top="1"
+         width="31" />
+        <icon
+         follows="bottom|left"
+         height="25"
+         image_name="Toolbar_Right_Off"
+         layout="topleft"
+         left_pad="1"
+         name="dummy_icon"
+         width="273"
+        />
     </panel>
 </panel>
-- 
cgit v1.2.3


From c2686fad3717e4cf206e91c98bf24f2c7903dec1 Mon Sep 17 00:00:00 2001
From: "Mark Palange (Mani)" <palange@lindenlab.com>
Date: Tue, 23 Mar 2010 18:23:57 -0700
Subject: EXT-6522 Change release installation location to Second Life Viewer 2
 (Windows Only) reviewed by palmer

---
 indra/newview/viewer_manifest.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 3f379fcf75..987efc60b2 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -479,8 +479,8 @@ class WindowsManifest(ViewerManifest):
                 grid_vars_template = """
                 OutFile "%(installer_file)s"
                 !define INSTFLAGS "%(flags)s"
-                !define INSTNAME   "SecondLife"
-                !define SHORTCUT   "Second Life"
+                !define INSTNAME   "SecondLifeViewer2"
+                !define SHORTCUT   "Second Life Viewer 2"
                 !define URLNAME   "secondlife"
                 Caption "Second Life ${VERSION}"
                 """
-- 
cgit v1.2.3


From 3ad56f22158dd2665204745af2171689f208cd7e Mon Sep 17 00:00:00 2001
From: palange <palange@lindenlab.com>
Date: Tue, 23 Mar 2010 19:38:31 -0700
Subject: EXT-6522 Changed app bundle to Second Life Viewer 2.app (Mac)

---
 indra/newview/viewer_manifest.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 987efc60b2..18ac10fe38 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -686,7 +686,7 @@ class DarwinManifest(ViewerManifest):
 
 
     def package_finish(self):
-        channel_standin = 'Second Life'  # hah, our default channel is not usable on its own
+        channel_standin = 'Second Life Viewer 2'  # hah, our default channel is not usable on its own
         if not self.default_channel():
             channel_standin = self.channel()
 
-- 
cgit v1.2.3


From c4a1e10a8d29b95f925b64fccefdbeaf292c99dd Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Wed, 24 Mar 2010 15:06:40 +0200
Subject: fixed EXT-6458 Recent speakers not sorting properly with Group Voice

switched nearby people panel to use active speaker manager instead of local/nearby speaker manager only

reviewed by Mike at https://codereview.productengine.com/secondlife/r/88/

--HG--
branch : product-engine
---
 indra/newview/llpanelpeople.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 03e8ab644e..2025bd52dc 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -178,8 +178,8 @@ public:
 protected:
 	virtual bool doCompare(const LLAvatarListItem* item1, const LLAvatarListItem* item2) const
 	{
-		LLPointer<LLSpeaker> lhs = LLLocalSpeakerMgr::instance().findSpeaker(item1->getAvatarId());
-		LLPointer<LLSpeaker> rhs = LLLocalSpeakerMgr::instance().findSpeaker(item2->getAvatarId());
+		LLPointer<LLSpeaker> lhs = LLActiveSpeakerMgr::instance().findSpeaker(item1->getAvatarId());
+		LLPointer<LLSpeaker> rhs = LLActiveSpeakerMgr::instance().findSpeaker(item2->getAvatarId());
 		if ( lhs.notNull() && rhs.notNull() )
 		{
 			// Compare by last speaking time
@@ -708,7 +708,7 @@ void LLPanelPeople::updateNearbyList()
 	mNearbyList->setDirty();
 
 	DISTANCE_COMPARATOR.updateAvatarsPositions(positions, mNearbyList->getIDs());
-	LLLocalSpeakerMgr::instance().update(TRUE);
+	LLActiveSpeakerMgr::instance().update(TRUE);
 }
 
 void LLPanelPeople::updateRecentList()
-- 
cgit v1.2.3


From c0ea363c86a1a2182754b201622bc78bdbea787e Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Wed, 24 Mar 2010 15:43:02 +0200
Subject: Normal bug (EXT-6511) "Rename" item is enabled for multiple landmarks
 - Fixed check to enable/disable "Rename" menu item if multiple items are
 selected.

Reviewed by Leyla Farazha and Mike Antipov
https://codereview.productengine.com/secondlife/r/85/

--HG--
branch : product-engine
---
 indra/newview/llpanellandmarks.cpp | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index be460e8e5c..220ea2813d 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -922,7 +922,6 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 		return false;
 	}
 	else if (  "paste"		== command_name
-			|| "rename"		== command_name
 			|| "cut"		== command_name
 			|| "copy"		== command_name
 			|| "delete"		== command_name
@@ -934,16 +933,16 @@ bool LLLandmarksPanel::isActionEnabled(const LLSD& userdata) const
 	}
 	else if (  "teleport"		== command_name
 			|| "more_info"		== command_name
-			|| "rename"			== command_name
 			|| "show_on_map"	== command_name
 			|| "copy_slurl"		== command_name
 			)
 	{
 		// disable some commands for multi-selection. EXT-1757
-		if (root_folder_view->getSelectedCount() > 1)
-		{
-			return false;
-		}
+		return root_folder_view->getSelectedCount() == 1;
+	}
+	else if ("rename" == command_name)
+	{
+		return root_folder_view->getSelectedCount() == 1 && canSelectedBeModified(command_name);
 	}
 	else if("category" == command_name)
 	{
-- 
cgit v1.2.3


From 5f46430a1aa16212838dd7a9493a42fcb5e92ec3 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Wed, 24 Mar 2010 15:47:37 +0200
Subject: Normal task (EXT-6251) [HARD CODED]? Side bar: Landmarks > + button >
 Create Landmark > Landmark location dropdown > Landmarks/Japanese - Fixed
 translating category name in Landmark location dropdown list for cases when
 localized name is a part of folder's full name.

Reviewed by Mike Antipov https://codereview.productengine.com/secondlife/r/32/

--HG--
branch : product-engine
---
 indra/newview/llpanellandmarkinfo.cpp | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 143a64d08b..a60c69f169 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -396,17 +396,20 @@ std::string LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCatego
 				if (is_under_root_category || cat->getParentUUID() == gInventory.getRootFolderID())
 				{
 					std::string localized_name;
+
+					// Looking for translation only for protected type categories
+					// to avoid warnings about non existent string in strings.xml.
+					bool is_protected_type = LLFolderType::lookupIsProtectedType(cat->getPreferredType());
+
 					if (is_under_root_category)
 					{
 						// translate category name, if it's right below the root
-						// FIXME: it can throw notification about non existent string in strings.xml
-						bool is_found = LLTrans::findString(localized_name, "InvFolder " + name);
+						bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + name);
 						name = is_found ? localized_name : name;
 					}
 					else
 					{
-						// FIXME: it can throw notification about non existent string in strings.xml
-						bool is_found = LLTrans::findString(localized_name, "InvFolder " + cat->getName());
+						bool is_found = is_protected_type && LLTrans::findString(localized_name, "InvFolder " + cat->getName());
 
 						// add translated category name to folder's full name
 						name = (is_found ? localized_name : cat->getName()) + "/" + name;
-- 
cgit v1.2.3


From 7fa6e0ad6c7a916b45ca1ff7f6603ca2a5726a97 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 24 Mar 2010 21:03:50 +0200
Subject: Fixed normal bug EXT-5840 (Search floater auto-closes on telelport) -
 removed the closing of search floater at teleportation request. Reviewed by
 Leyla Farazha at https://codereview.productengine.com/secondlife/r/94/

--HG--
branch : product-engine
---
 indra/newview/llagent.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index c5d7f6f118..67126a999f 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -5969,9 +5969,9 @@ bool LLAgent::teleportCore(bool is_local)
 	// yet if the teleport will succeed.  Look in 
 	// process_teleport_location_reply
 
-	// close the map and find panels so we can see our destination
+	// close the map panel so we can see our destination.
+	// we don't close search floater, see EXT-5840.
 	LLFloaterReg::hideInstance("world_map");
-	LLFloaterReg::hideInstance("search");
 
 	// hide land floater too - it'll be out of date
 	LLFloaterReg::hideInstance("about_land");
-- 
cgit v1.2.3


From d5d9668a59895874951fb3e5927ea0159270a6e8 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Thu, 25 Mar 2010 09:04:01 +0200
Subject: Fixed low bug EXT-6488 (Teleport menuitem is enabled for offline
 residents in the context menu and inspectors)

- Added a check for a teleport offer ability. In XML created a paremeter and check it in source code.

Reviewed by Leyla Farazha at https://codereview.productengine.com/secondlife/r/86/

--HG--
branch : product-engine
---
 indra/newview/llavataractions.cpp                          | 14 ++++++++++++++
 indra/newview/llavataractions.h                            |  6 ++++++
 indra/newview/llinspectavatar.cpp                          |  7 +++++++
 indra/newview/llpanelpeoplemenus.cpp                       |  5 +++++
 .../skins/default/xui/en/menu_inspect_avatar_gear.xml      |  2 ++
 indra/newview/skins/default/xui/en/menu_people_nearby.xml  |  3 +++
 6 files changed, 37 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index cb518f0ad6..699916b0d6 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -442,6 +442,20 @@ void LLAvatarActions::toggleBlock(const LLUUID& id)
 		LLMuteList::getInstance()->add(mute);
 	}
 }
+// static
+bool LLAvatarActions::canOfferTeleport(const LLUUID& id)
+{
+	// First use LLAvatarTracker::isBuddy()
+	// If LLAvatarTracker::instance().isBuddyOnline function only is used
+	// then for avatars that are online and not a friend it will return false.
+	// But we should give an ability to offer a teleport for such avatars.
+	if(LLAvatarTracker::instance().isBuddy(id))
+	{
+		return LLAvatarTracker::instance().isBuddyOnline(id);
+	}
+
+	return true;
+}
 
 void LLAvatarActions::inviteToGroup(const LLUUID& id)
 {
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index a7f3acad4f..9adf6efec7 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -171,6 +171,12 @@ public:
 	 */	
 	static void csr(const LLUUID& id, std::string name);
 
+	/**
+	 * Checks whether can offer teleport to the avatar
+	 * Can't offer only for offline friends
+	 */
+	static bool canOfferTeleport(const LLUUID& id);
+
 	
 private:
 	static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 35cb9b3468..94ea236757 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -137,6 +137,7 @@ private:
 	void onVolumeChange(const LLSD& data);
 	bool enableMute();
 	bool enableUnmute();
+	bool enableTeleportOffer();
 
 	// Is used to determine if "Add friend" option should be enabled in gear menu
 	bool isNotFriend();
@@ -235,6 +236,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
 		boost::bind(&LLInspectAvatar::onVisibleZoomIn, this));
 	mEnableCallbackRegistrar.add("InspectAvatar.Gear.Enable", boost::bind(&LLInspectAvatar::isNotFriend, this));
 	mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableCall", boost::bind(&LLAvatarActions::canCall));
+	mEnableCallbackRegistrar.add("InspectAvatar.Gear.EnableTeleportOffer", boost::bind(&LLInspectAvatar::enableTeleportOffer, this));
 	mEnableCallbackRegistrar.add("InspectAvatar.EnableMute", boost::bind(&LLInspectAvatar::enableMute, this));
 	mEnableCallbackRegistrar.add("InspectAvatar.EnableUnmute", boost::bind(&LLInspectAvatar::enableUnmute, this));
 
@@ -764,6 +766,11 @@ bool LLInspectAvatar::enableUnmute()
 		}
 }
 
+bool LLInspectAvatar::enableTeleportOffer()
+{
+	return LLAvatarActions::canOfferTeleport(mAvatarID);
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // LLInspectAvatarUtil
 //////////////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 854651cd01..313ed4b70e 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -226,6 +226,11 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
 		return (LLAvatarTracker::instance().isBuddyOnline(id) && is_agent_mappable(id))
 					|| gAgent.isGodlike();
 	}
+	else if(item == std::string("can_offer_teleport"))
+	{
+		const LLUUID& id = mUUIDs.front();
+		return LLAvatarActions::canOfferTeleport(id);
+	}
 	return false;
 }
 
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
index 1b002b1c32..a5ac5f76e1 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
@@ -40,6 +40,8 @@
    name="teleport">
     <menu_item_call.on_click
      function="InspectAvatar.Teleport"/>
+    <menu_item_call.on_enable
+     function="InspectAvatar.Gear.EnableTeleportOffer"/>
   </menu_item_call>
   <menu_item_call
    label="Invite to Group"
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby.xml b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
index 014a52bb4f..d2e35e4cc0 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby.xml
@@ -88,5 +88,8 @@
     name="teleport">
       <menu_item_call.on_click
        function="Avatar.OfferTeleport"/>
+      <menu_item_call.on_enable
+      function="Avatar.EnableItem"
+      parameter="can_offer_teleport"/>
     </menu_item_call>
 </context_menu>
-- 
cgit v1.2.3


From 0f32c14cab77717dab75b8d91302104e8f168ceb Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Thu, 25 Mar 2010 12:06:39 +0200
Subject: Fixed normal bug EXT-6324 (View - View Object - should have "press
 ESC to return to World View" message) - added showing the "press ESC to
 return to World View" when viewer is in free camera mode (if mode was started
 by camera floater). Reviewed by Leyla Farazha at
 https://codereview.productengine.com/secondlife/r/97/

--HG--
branch : product-engine
---
 indra/newview/llviewerwindow.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index d91833fd22..e66914fb60 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2088,7 +2088,7 @@ void LLViewerWindow::draw()
 		// Draw tool specific overlay on world
 		LLToolMgr::getInstance()->getCurrentTool()->draw();
 
-		if( gAgent.cameraMouselook() )
+		if( gAgent.cameraMouselook() || LLFloaterCamera::inFreeCameraMode() )
 		{
 			drawMouselookInstructions();
 			stop_glerror();
-- 
cgit v1.2.3


From 920d54297fc13a7a975ff4372f0c1559cf9cf199 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 25 Mar 2010 17:09:20 +0200
Subject: =?UTF-8?q?fixed=20major=20EXT-6500=20=E2=80=9CMessage=20Well=20co?=
 =?UTF-8?q?unter=20changes=20to=20'-1'=20after=20plain=20text=20chat=20was?=
 =?UTF-8?q?=20enabled=20while=20unresolved=20offer=20was=20in=20hided=20IM?=
 =?UTF-8?q?=20window=E2=80=9D,=20Added=20check=20to=20LLToastNotifyPanel?=
 =?UTF-8?q?=20destructor=20whether=20we=20should=20close=20notification=20?=
 =?UTF-8?q?since=20notification=20will=20be=20reused=20by=20IM=20floater?=
 =?UTF-8?q?=20when=20reload=20messages,=20the=20rule=20is:=20if=20LLToastN?=
 =?UTF-8?q?otifyPanel=20destroying=20but=20IM=20floater=20is=20exists=20?=
 =?UTF-8?q?=E2=80=93=20we=20shouldn't=20close=20notification.=20The=20prob?=
 =?UTF-8?q?lem=20is=20that=20notification=20was=20incorrectly=20deleted=20?=
 =?UTF-8?q?when=20IM=20floater=20reloads=20messages=20on=20chat=20log=20fr?=
 =?UTF-8?q?omat=20change=20event.=20reviewed=20by=20Vadim=20Savchuk=20at?=
 =?UTF-8?q?=20https://codereview.productengine.com/secondlife/r/80/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--HG--
branch : product-engine
---
 indra/newview/llchathistory.cpp      |  2 +-
 indra/newview/lltoastnotifypanel.cpp | 19 +++++++++++++++++--
 indra/newview/lltoastnotifypanel.h   |  7 ++++++-
 3 files changed, 24 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index efdfbb8d20..858ea334d1 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -751,7 +751,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 		if (notification != NULL)
 		{
 			LLIMToastNotifyPanel* notify_box = new LLIMToastNotifyPanel(
-					notification);
+					notification, chat.mSessionID);
 			//we can't set follows in xml since it broke toasts behavior
 			notify_box->setFollowsLeft();
 			notify_box->setFollowsRight();
diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp
index 907740a88e..c9d2d404c0 100644
--- a/indra/newview/lltoastnotifypanel.cpp
+++ b/indra/newview/lltoastnotifypanel.cpp
@@ -45,6 +45,7 @@
 #include "lltrans.h"
 #include "llnotificationsutil.h"
 #include "llviewermessage.h"
+#include "llimfloater.h"
 
 const S32 BOTTOM_PAD = VPAD * 3;
 const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding
@@ -531,12 +532,26 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification
 
 //////////////////////////////////////////////////////////////////////////
 
-LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */)
- : LLToastNotifyPanel(pNotification, rect)
+LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect /* = LLRect::null */)
+ : mSessionID(session_id), LLToastNotifyPanel(pNotification, rect)
 {
 	mTextBox->setFollowsAll();
 }
 
+LLIMToastNotifyPanel::~LLIMToastNotifyPanel()
+{
+	// We shouldn't delete notification when IM floater exists
+	// since that notification will be reused by IM floater.
+	// This may happened when IM floater reloads messages, exactly when user
+	// changes layout of IM chat log(disable/enable plaintext mode).
+	// See EXT-6500
+	LLIMFloater* im_floater = LLIMFloater::findInstance(mSessionID);
+	if (im_floater != NULL && !im_floater->isDead())
+	{
+		mCloseNotificationOnDestroy = false;
+	}
+}
+
 void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
 {
 	S32 text_height = mTextBox->getTextBoundingRect().getHeight();
diff --git a/indra/newview/lltoastnotifypanel.h b/indra/newview/lltoastnotifypanel.h
index a8d2d03236..1c68e4c6b3 100644
--- a/indra/newview/lltoastnotifypanel.h
+++ b/indra/newview/lltoastnotifypanel.h
@@ -138,9 +138,14 @@ class LLIMToastNotifyPanel : public LLToastNotifyPanel
 {
 public:
 
-	LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect = LLRect::null);
+	LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLUUID& session_id, const LLRect& rect = LLRect::null);
+
+	~LLIMToastNotifyPanel();
 
 	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
+protected:
+	LLUUID	mSessionID;
 };
 
 #endif /* LLTOASTNOTIFYPANEL_H_ */
-- 
cgit v1.2.3


From 54a3f1051e5ef411b39ac34ba37fc7444832a3eb Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 25 Mar 2010 17:53:25 +0200
Subject: =?UTF-8?q?fixed=20EXT-6489=20=E2=80=9C"User=20not=20online=20-=20?=
 =?UTF-8?q?inventory=20has=20been=20saved"=20should=20be=20logged=20to=20I?=
 =?UTF-8?q?M=20log=E2=80=9D,=20reviewed=20by=20Mike=20Antipov=20at=20https?=
 =?UTF-8?q?://codereview.productengine.com/secondlife/r/90/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--HG--
branch : product-engine
---
 indra/newview/llnotificationhandlerutil.cpp          |  9 ++++++---
 indra/newview/llviewermessage.cpp                    | 11 ++++-------
 indra/newview/skins/default/xui/en/notifications.xml |  7 +++++++
 3 files changed, 17 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 24cffd222b..6aafa04a17 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -128,7 +128,8 @@ const static std::string GRANTED_MODIFY_RIGHTS("GrantedModifyRights"),
 						FRIEND_ONLINE("FriendOnline"), FRIEND_OFFLINE("FriendOffline"),
 						SERVER_OBJECT_MESSAGE("ServerObjectMessage"),
 						TELEPORT_OFFERED("TeleportOffered"),
-						TELEPORT_OFFER_SENT("TeleportOfferSent");
+						TELEPORT_OFFER_SENT("TeleportOfferSent"),
+						IM_SYSTEM_MESSAGE_TIP("IMSystemMessageTip");
 
 
 // static
@@ -147,7 +148,8 @@ bool LLHandlerUtil::canLogToIM(const LLNotificationPtr& notification)
 			|| INVENTORY_DECLINED == notification->getName()
 			|| USER_GIVE_ITEM == notification->getName()
 			|| TELEPORT_OFFERED == notification->getName()
-			|| TELEPORT_OFFER_SENT == notification->getName();
+			|| TELEPORT_OFFER_SENT == notification->getName()
+			|| IM_SYSTEM_MESSAGE_TIP == notification->getName();
 }
 
 // static
@@ -157,7 +159,8 @@ bool LLHandlerUtil::canLogToNearbyChat(const LLNotificationPtr& notification)
 			&&  FRIEND_ONLINE != notification->getName()
 			&& FRIEND_OFFLINE != notification->getName()
 			&& INVENTORY_ACCEPTED != notification->getName()
-			&& INVENTORY_DECLINED != notification->getName();
+			&& INVENTORY_DECLINED != notification->getName()
+			&& IM_SYSTEM_MESSAGE_TIP != notification->getName();
 }
 
 // static
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7ba9c54e53..6043ec4954 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1752,17 +1752,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 	std::string separator_string(": ");
 
 	LLSD args;
+	LLSD payload;
 	switch(dialog)
 	{
 	case IM_CONSOLE_AND_CHAT_HISTORY:
-		// These are used for system messages, hence don't need the name,
-		// as it is always "Second Life".
 	  	// *TODO: Translate
 		args["MESSAGE"] = message;
-
-		// Note: don't put the message in the IM history, even though was sent
-		// via the IM mechanism.
-		LLNotificationsUtil::add("SystemMessageTip",args);
+		payload["SESSION_NAME"] = name;
+		payload["from_id"] = from_id;
+		LLNotificationsUtil::add("IMSystemMessageTip",args, payload);
 		break;
 
 	case IM_NOTHING_SPECIAL: 
@@ -1985,7 +1983,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			// For requested notices, we don't want to send the popups.
 			if (dialog != IM_GROUP_NOTICE_REQUESTED)
 			{
-				LLSD payload;
 				payload["subject"] = subj;
 				payload["message"] = mes;
 				payload["sender_name"] = name;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c39a91281e..5403defc59 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -4269,6 +4269,13 @@ The string [STRING_NAME] is missing from strings.xml
    type="notifytip">
 [MESSAGE]
   </notification>
+  
+  <notification
+   icon="notifytip.tga"
+   name="IMSystemMessageTip"
+   type="notifytip">
+[MESSAGE]
+  </notification>
 
   <notification
    icon="notifytip.tga"
-- 
cgit v1.2.3


From 3318c8f09e5edb907712d626ea12c2cbd6136c50 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 25 Mar 2010 18:06:48 +0200
Subject: =?UTF-8?q?fixed=20EXT-3818=20=E2=80=9C[BSI]=20plain=20text=20chat?=
 =?UTF-8?q?=20has=20too=20much=20space=20between=20lines=E2=80=9D,=20To=20?=
 =?UTF-8?q?fix=20EXT-6373=20I=20added=20vertical=20padding=20between=20pos?=
 =?UTF-8?q?ts=20in=20plain-text=20and=20unified=20padding=20in=20default?=
 =?UTF-8?q?=20mode=20of=20IM/chat=20history.=20Now=20I'm=20backing=20out?=
 =?UTF-8?q?=20the=20changes=20to=20plain-text=20mode=20that=20led=20to=20E?=
 =?UTF-8?q?XT-3818.=20reviewed=20by=20Leyla=20Farazha=20at=20https://coder?=
 =?UTF-8?q?eview.productengine.com/secondlife/r/95/?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--HG--
branch : product-engine
---
 indra/newview/llchathistory.cpp                          | 16 ----------------
 indra/newview/llchathistory.h                            |  9 ---------
 .../skins/default/xui/en/widgets/chat_history.xml        |  1 -
 3 files changed, 26 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 858ea334d1..71e7ae7061 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -447,7 +447,6 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
 :	LLUICtrl(p),
 	mMessageHeaderFilename(p.message_header),
 	mMessageSeparatorFilename(p.message_separator),
-	mMessagePlaintextSeparatorFilename(p.message_plaintext_separator),
 	mLeftTextPad(p.left_text_pad),
 	mRightTextPad(p.right_text_pad),
 	mLeftWidgetPad(p.left_widget_pad),
@@ -535,12 +534,6 @@ LLView* LLChatHistory::getSeparator()
 	return separator;
 }
 
-LLView* LLChatHistory::getPlaintextSeparator()
-{
-	LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessagePlaintextSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
-	return separator;
-}
-
 LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params)
 {
 	LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
@@ -639,15 +632,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 
 	if (use_plain_text_chat_history)
 	{
-		// append plaintext separator
-		LLView* separator = getPlaintextSeparator();
-		LLInlineViewSegment::Params p;
-		p.force_newline = true;
-		p.left_pad = mLeftWidgetPad;
-		p.right_pad = mRightWidgetPad;
-		p.view = separator;
-		mEditor->appendWidget(p, "\n", false);
-
 		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
 
 		if (utf8str_trim(chat.mFromName).size() != 0)
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index dfe5ea98e6..950b32861b 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -47,8 +47,6 @@ class LLChatHistory : public LLUICtrl
 			Optional<std::string>	message_header;
 			//Message separator filename
 			Optional<std::string>	message_separator;
-			//Message plaintext  separator filename
-			Optional<std::string>	message_plaintext_separator;
 			//Text left padding from the scroll rect
 			Optional<S32>			left_text_pad;
 			//Text right padding from the scroll rect
@@ -71,7 +69,6 @@ class LLChatHistory : public LLUICtrl
 			Params()
 			:	message_header("message_header"),
 				message_separator("message_separator"),
-				message_plaintext_separator("message_plaintext_separator"),
 				left_text_pad("left_text_pad"),
 				right_text_pad("right_text_pad"),
 				left_widget_pad("left_widget_pad"),
@@ -99,11 +96,6 @@ class LLChatHistory : public LLUICtrl
 		 * @return pointer to LLView separator object.
 		 */
 		LLView* getSeparator();
-		/**
-		 * Builds a message plaintext  separator.
-		 * @return pointer to LLView separator object.
-		 */
-		LLView* getPlaintextSeparator();
 		/**
 		 * Builds a message header.
 		 * @return pointer to LLView header object.
@@ -141,7 +133,6 @@ class LLChatHistory : public LLUICtrl
 
 		std::string mMessageHeaderFilename;
 		std::string mMessageSeparatorFilename;
-		std::string mMessagePlaintextSeparatorFilename;
 
 		S32 mLeftTextPad;
 		S32 mRightTextPad;
diff --git a/indra/newview/skins/default/xui/en/widgets/chat_history.xml b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
index aa3ea736b8..ef885e8045 100644
--- a/indra/newview/skins/default/xui/en/widgets/chat_history.xml
+++ b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
@@ -2,7 +2,6 @@
 <chat_history
   message_header="panel_chat_header.xml"
   message_separator="panel_chat_separator.xml"
-  message_plaintext_separator="panel_chat_plaintext_separator.xml"
   left_text_pad="10"
   right_text_pad="15"
   left_widget_pad="0"
-- 
cgit v1.2.3


From 869fc803cb30c311fa5bd20aa036e1db683ce874 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 25 Mar 2010 18:12:00 +0200
Subject: Fixed normal bug (EXT-6484) Drop down dialogs have same/similar color
 to background & no border. - Removed unused attributes from drop down menus
 in side panel People. - Removed drop_shadow="false" to display shadow and
 distinguish drop down from background.

Reviewed by Vadim Savchuk https://codereview.productengine.com/secondlife/r/103/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/menu_group_plus.xml               | 2 +-
 indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml | 2 +-
 indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml  | 2 +-
 indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml  | 2 +-
 indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml  | 2 +-
 5 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_group_plus.xml b/indra/newview/skins/default/xui/en/menu_group_plus.xml
index e83d07baec..fce7414d80 100644
--- a/indra/newview/skins/default/xui/en/menu_group_plus.xml
+++ b/indra/newview/skins/default/xui/en/menu_group_plus.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
+     mouse_opaque="false">
   <menu_item_call name="item_join" label="Join Group...">
     <menu_item_call.on_click function="People.Group.Plus.Action" userdata="join_group" />
   </menu_item_call>
diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
index f1117d1419..92752a0fee 100644
--- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
+     mouse_opaque="false">
   <menu_item_check
    label="Sort by Name"
    name="sort_name">
diff --git a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
index df3cb26b04..2efb204ffb 100644
--- a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
+     mouse_opaque="false">
   <menu_item_check
    label="Display Group Icons"
    layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
index 39f9e48609..69b3831738 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
+     mouse_opaque="false">
   <menu_item_check
      label="Sort by Recent Speakers"
      name="sort_by_recent_speakers">
diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
index cfd6dc78b6..5c9555db92 100644
--- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <menu name="menu_group_plus"
      left="0" bottom="0" visible="false"
-     mouse_opaque="false" opaque="true" color="MenuDefaultBgColor" drop_shadow="false">
+     mouse_opaque="false">
   <menu_item_check
    label="Sort by Most Recent"
    name="sort_most">
-- 
cgit v1.2.3


From 378b65ca4cad6d6bcd1d5b0d58cb7c0bb7834a22 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 25 Mar 2010 18:31:08 +0200
Subject: Fixed normal bug EXT-5604 - Context menu of URL is covered by profile
 description itself This issue was fixed when menu became non top-control.
 Enabled context menu in expandable textbox in profile panel.

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_my_profile.xml | 3 +++
 indra/newview/skins/default/xui/en/panel_profile.xml    | 3 +++
 2 files changed, 6 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml
index 4112b65635..4386475cf1 100644
--- a/indra/newview/skins/default/xui/en/panel_my_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml
@@ -117,6 +117,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.show_context_menu="true"
                name="sl_description_edit"
                top_pad="-3"
                translate="false"
@@ -171,6 +172,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.show_context_menu="true"
                name="fl_description_edit"
                top_pad="-3"
                translate="false"
@@ -311,6 +313,7 @@
             name="sl_groups"
           top_pad="0"
             translate="false"
+            textbox.show_context_menu="true"
             width="298"
             expanded_bg_visible="true"
             expanded_bg_color="DkGray">
diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml
index 30191aecb6..34ec64b8af 100644
--- a/indra/newview/skins/default/xui/en/panel_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile.xml
@@ -107,6 +107,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.show_context_menu="true"
                name="sl_description_edit"
                top_pad="-3"
                translate="false"
@@ -151,6 +152,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.show_context_menu="true"
                name="fl_description_edit"
                top_pad="-3"
                translate="false"
@@ -289,6 +291,7 @@
             left="7"
             name="sl_groups"
             textbox.max_length="512"
+            textbox.show_context_menu="true"
             top_pad="0"
             translate="false"
             width="290"
-- 
cgit v1.2.3


From a33e5ad325ce6c35532a04b97e58273d6748e3e0 Mon Sep 17 00:00:00 2001
From: Andrew Dyukov <adyukov@productengine.com>
Date: Thu, 25 Mar 2010 21:35:31 +0200
Subject: Fixed major bug EXT-6538(Can't sell land with objects).

- Changed radio items "bottom" attribute to "top_pad".

Reviewed by Kent at https://codereview.productengine.com/secondlife/r/109/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/floater_sell_land.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_sell_land.xml b/indra/newview/skins/default/xui/en/floater_sell_land.xml
index afc44c41b8..4cae42bcfe 100644
--- a/indra/newview/skins/default/xui/en/floater_sell_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_sell_land.xml
@@ -203,13 +203,13 @@
          name="none"
          visible="false" />
         <radio_item
-         bottom="20"
+         top_pad="10"
          height="16"
          label="No, keep ownership of objects"
          left="10"
          name="no" />
         <radio_item
-         bottom="40"
+         top_pad="10"
          height="16"
          label="Yes, sell objects with land"
          left="10"
-- 
cgit v1.2.3


From 5fbcc249e3af8e8cd1edabf7a4b6e4c9ca0fc7e3 Mon Sep 17 00:00:00 2001
From: Andrew Dyukov <adyukov@productengine.com>
Date: Thu, 25 Mar 2010 22:52:28 +0200
Subject: Fixed normal bug EXT-6325 (ABOUT SECOND LIFE window, Copy to
 Clipboard button overlaps horizontal rule).

- Decreased height of text editor.

Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/98/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/floater_about.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index bc67621dfd..d03231a3fa 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -76,7 +76,7 @@ Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number
         allow_html="true" 
        follows="top|left"
        font="SansSerif"
-       height="350"
+       height="343"
        bg_readonly_color="Transparent"
        left="5"
        max_length="65536"
-- 
cgit v1.2.3


From 4d8338ff3eb91b7185b347b4c538ae20ff7940ce Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Fri, 26 Mar 2010 09:47:42 +0200
Subject: Fixen normal EXT-6434 (Mini Map does not go transparent when not in
 focus)

- Set background opaque of the floater depending on focus and made map's background color transparent

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/99/

--HG--
branch : product-engine
---
 indra/newview/llfloatermap.cpp                     | 14 ++++++++++++++
 indra/newview/llfloatermap.h                       |  2 ++
 indra/newview/skins/default/colors.xml             |  2 +-
 indra/newview/skins/default/xui/en/floater_map.xml |  1 +
 4 files changed, 18 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index 051ab585e2..ccf286c4cc 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -215,6 +215,20 @@ void LLFloaterMap::draw()
 	LLFloater::draw();
 }
 
+// virtual
+void LLFloaterMap::onFocusReceived()
+{
+	setBackgroundOpaque(true);
+	LLPanel::onFocusReceived();
+}
+
+// virtual
+void LLFloaterMap::onFocusLost()
+{
+	setBackgroundOpaque(false);
+	LLPanel::onFocusLost();
+}
+
 void LLFloaterMap::reshape(S32 width, S32 height, BOOL called_from_parent)
 {
 	LLFloater::reshape(width, height, called_from_parent);
diff --git a/indra/newview/llfloatermap.h b/indra/newview/llfloatermap.h
index 6c9138c6a7..9ff2f03180 100644
--- a/indra/newview/llfloatermap.h
+++ b/indra/newview/llfloatermap.h
@@ -53,6 +53,8 @@ public:
 	/*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();
+	/*virtual*/ void	onFocusReceived();
 	
 private:
 	void handleZoom(const LLSD& userdata);
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index fcf5cfadb2..777d671e81 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -524,7 +524,7 @@
      reference="Unused?" />
     <color
      name="NetMapBackgroundColor"
-     value="0 0 0 0.3" />
+     value="0 0 0 0" />
     <color
      name="NetMapGroupOwnAboveWater"
      reference="Purple" />
diff --git a/indra/newview/skins/default/xui/en/floater_map.xml b/indra/newview/skins/default/xui/en/floater_map.xml
index 5d35275e17..e21e44204d 100644
--- a/indra/newview/skins/default/xui/en/floater_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_map.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
+ bg_alpha_image_overlay="DkGray_66"
  legacy_header_height="18"
  can_minimize="true" 
  can_resize="true"
-- 
cgit v1.2.3


From 4b847b4388a38209ec8e12ed55d8137c94119c17 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Fri, 26 Mar 2010 10:28:57 +0200
Subject: =?UTF-8?q?fixed=20EXT-6373=20=E2=80=9CConsecutive=20offer=20messa?=
 =?UTF-8?q?ges=20are=20unreadable=20in=20the=20IM=20log=E2=80=9D,=20replac?=
 =?UTF-8?q?ed=20[NAME]=20with=20[NAME=5FSLURL]=20in=20teleport=20offer=20n?=
 =?UTF-8?q?otification,=20this=20will=20unify=20offers=20appearance=20and?=
 =?UTF-8?q?=20gap=20between=20offers=20in=20IM=20chat=20log=20with=20disab?=
 =?UTF-8?q?led=20plaintext=20mode;?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

--HG--
branch : product-engine
---
 indra/newview/llviewermessage.cpp                    | 2 +-
 indra/newview/skins/default/xui/en/notifications.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 6043ec4954..c8cc813576 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2313,7 +2313,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			{
 				LLSD args;
 				// *TODO: Translate -> [FIRST] [LAST] (maybe)
-				args["NAME"] = name;
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				args["MESSAGE"] = message;
 				LLSD payload;
 				payload["from_id"] = from_id;
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 5403defc59..6d18111be0 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -5110,7 +5110,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
    icon="notify.tga"
    name="TeleportOffered"
    type="offer">
-[NAME] has offered to teleport you to their location:
+[NAME_SLURL] has offered to teleport you to their location:
 
 [MESSAGE]
     <form name="form">
-- 
cgit v1.2.3


From b846bc1fe48e8681f9f468d097228e3330d10ce8 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Fri, 26 Mar 2010 14:21:50 +0200
Subject: Fixed normal bug EXT-6331 (Gestures floater has an extra column
 titled \"1\")

- Corrected wrong indexes at the point of adding gestures to the gestures list.
Problem probably is a result of 'copy & paste'.

Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/113/

--HG--
branch : product-engine
---
 indra/newview/llfloatergesture.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 9c1ac2631d..ac32319690 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -354,10 +354,10 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur
 		element["columns"][0]["value"] = "";
 		element["columns"][0]["font"]["name"] = "SANSSERIF";
 		element["columns"][0]["font"]["style"] = font_style;
-		element["columns"][0]["column"] = "trigger";
-		element["columns"][0]["value"] = "---";
-		element["columns"][0]["font"]["name"] = "SANSSERIF";
-		element["columns"][0]["font"]["style"] = font_style;
+		element["columns"][1]["column"] = "shortcut";
+		element["columns"][1]["value"] = "---";
+		element["columns"][1]["font"]["name"] = "SANSSERIF";
+		element["columns"][1]["font"]["style"] = font_style;
 		element["columns"][2]["column"] = "key";
 		element["columns"][2]["value"] = "~~~";
 		element["columns"][2]["font"]["name"] = "SANSSERIF";
-- 
cgit v1.2.3


From 56fa20e168240fe6c971a8c8e672fc5a9e2b6690 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Fri, 26 Mar 2010 14:38:03 +0200
Subject: Fixed major bug EXT-6544 - remove Admin > God Tools > Grid > Kick All
 Residents button. Removed "Kick all" button and corresponding code.

Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/117/

--HG--
branch : product-engine
---
 indra/newview/llfloatergodtools.cpp                | 41 ----------------------
 indra/newview/llfloatergodtools.h                  |  3 --
 .../skins/default/xui/en/floater_god_tools.xml     | 13 -------
 3 files changed, 57 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index eb56f387cd..c08d891d2f 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -828,7 +828,6 @@ const F32 HOURS_TO_RADIANS = (2.f*F_PI)/24.f;
 LLPanelGridTools::LLPanelGridTools() :
 	LLPanel()
 {
-	mCommitCallbackRegistrar.add("GridTools.KickAll",		boost::bind(&LLPanelGridTools::onClickKickAll, this));	
 	mCommitCallbackRegistrar.add("GridTools.FlushMapVisibilityCaches",		boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this));	
 }
 
@@ -846,46 +845,6 @@ void LLPanelGridTools::refresh()
 {
 }
 
-void LLPanelGridTools::onClickKickAll()
-{
-	LLNotificationsUtil::add("KickAllUsers", LLSD(), LLSD(), LLPanelGridTools::confirmKick);
-}
-
-
-bool LLPanelGridTools::confirmKick(const LLSD& notification, const LLSD& response)
-{
-	if (LLNotificationsUtil::getSelectedOption(notification, response) == 0)
-	{
-		LLSD payload;
-		payload["kick_message"] = response["message"].asString();
-		LLNotificationsUtil::add("ConfirmKick", LLSD(), payload, LLPanelGridTools::finishKick);
-	}
-	return false;
-}
-
-
-// static
-bool LLPanelGridTools::finishKick(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-
-
-	if (option == 0)
-	{
-		LLMessageSystem* msg = gMessageSystem;
-
-		msg->newMessageFast(_PREHASH_GodKickUser);
-		msg->nextBlockFast(_PREHASH_UserInfo);
-		msg->addUUIDFast(_PREHASH_GodID, gAgent.getID());
-		msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID());
-		msg->addUUIDFast(_PREHASH_AgentID,   LL_UUID_ALL_AGENTS );
-		msg->addU32("KickFlags", KICK_FLAGS_DEFAULT );
-		msg->addStringFast(_PREHASH_Reason,    notification["payload"]["kick_message"].asString());
-		gAgent.sendReliableMessage();
-	}
-	return false;
-}
-
 void LLPanelGridTools::onClickFlushMapVisibilityCaches()
 {
 	LLNotificationsUtil::add("FlushMapVisibilityCaches", LLSD(), LLSD(), flushMapVisibilityCachesConfirm);
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index ef5ce02749..b95d1a30e4 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -198,9 +198,6 @@ public:
 
 	void refresh();
 
-	void onClickKickAll();
-	static bool confirmKick(const LLSD& notification, const LLSD& response);
-	static bool finishKick(const LLSD& notification, const LLSD& response);
 	static void onDragSunPhase(LLUICtrl *ctrl, void *userdata);
 	void onClickFlushMapVisibilityCaches();
 	static bool flushMapVisibilityCachesConfirm(const LLSD& notification, const LLSD& response);
diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml
index 36ef6beb59..240871ec25 100644
--- a/indra/newview/skins/default/xui/en/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml
@@ -28,19 +28,6 @@
          name="grid"
          top="16"
          width="398">
-            <button
-             follows="left|top"
-             height="20"
-             label="Kick all Residents"
-             label_selected="Kick all Residents"
-             layout="topleft"
-             left="10"
-             name="Kick all users"
-             top="30"
-             width="120">
-				<button.commit_callback
-				function="GridTools.KickAll" />
-			</button>
             <button
              follows="left|top"
              height="20"
-- 
cgit v1.2.3


From 379517ce5e1535b20a94ef3a581e1b25223f8798 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Fri, 26 Mar 2010 14:39:46 +0200
Subject: Fixed normal bug EXT-6070 - Truncated strings in window to buy linden
 dollars Increased textbox width. French translation is the longest so other
 languages will be ok.

Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/114/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/floater_buy_currency.xml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
index e02d32596a..637f9f55d4 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
@@ -24,13 +24,13 @@
    <text
      type="string"
      length="1"
-     follows="top|left"
+     follows="top|left|right"
      font="SansSerifHuge"
      layout="topleft"
      left="20"
      height="30"
      top="25"
-     width="300"
+     width="340"
      name="info_need_more">
         You need more L$
     </text>
@@ -55,7 +55,7 @@
      left="20"
      height="30"
      top="25"
-     width="200"
+     width="300"
      name="info_buying">
         Buy L$
     </text>
@@ -178,8 +178,8 @@
      follows="top|left"
      height="16"
      halign="right"
-     left="140"
-     width="180"
+     left="20"
+     width="300"
      layout="topleft"
      name="buy_action">
         [ACTION]
-- 
cgit v1.2.3


From 3eca1e1ff9f5322f212a6ce8103d210cf2f46b77 Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Fri, 26 Mar 2010 10:23:21 -0400
Subject: EXT-6514 -- backing out my incorrect fix for this and putting in the
 one from PE.

---
 indra/newview/skins/default/xui/en/sidepanel_item_info.xml | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index e5382e1e3f..b840fdd31b 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -399,12 +399,11 @@ top_pad="10"
 			    top_pad="10"/>
    </panel>
     <panel
-		 follows="bottom|left"
 		 height="30"
 		 layout="topleft"
 		 name="button_panel"
 		 left="5"
-		 bottom="2"
+		 top_pad="0"
 		 width="313">
 	    <button
 		     height="23"
-- 
cgit v1.2.3


From e962b8418f8a37c1d18743c31199dd9c33d5c74b Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Fri, 26 Mar 2010 16:29:47 +0200
Subject: fix for EXT-6475 Scrollbar in the Notices panel is semitransparent
 and overlaps controls (also for EXT-6374  Side Panel> Create a Notice> dialog
 boxes overrun up/down slider)
 https://codereview.productengine.com/secondlife/r/100/ reviewed Leyla Farazha
 ,vsavchuk

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_group_notices.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml
index 731b3c119c..479629f6ea 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml
@@ -131,6 +131,7 @@ Maximum 200 per group daily
             Subject:
         </text>
         <line_editor
+         follows="left|top|right"
          border_style="line"
          border_thickness="1"
          height="16"
@@ -153,6 +154,7 @@ Maximum 200 per group daily
             Message:
         </text>
         <text_editor
+         follows="left|top|right"
          height="90"
          layout="topleft"
          left_pad="3"
@@ -173,6 +175,7 @@ Maximum 200 per group daily
             Attach:
         </text>
         <line_editor
+         follows="left|top|right"
          enabled="false"
          height="19"
          layout="topleft"
@@ -222,7 +225,7 @@ Maximum 200 per group daily
          label="Send"
          label_selected="Send"
          layout="topleft"
-         right="-10"
+         right="-25"
          top_pad="10"
          name="send_notice"
          width="100" />
-- 
cgit v1.2.3


From d2cbc6c5b646e334e706e51faafbaa738b0d10a9 Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Fri, 26 Mar 2010 10:43:07 -0400
Subject: Fix for EXT-3818 -- back out some code that was put in for EXT-6373,
 but overreached.

---
 indra/newview/llchathistory.cpp                          | 16 ----------------
 indra/newview/llchathistory.h                            |  9 ---------
 .../skins/default/xui/en/widgets/chat_history.xml        |  1 -
 3 files changed, 26 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index efdfbb8d20..000fb62431 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -447,7 +447,6 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
 :	LLUICtrl(p),
 	mMessageHeaderFilename(p.message_header),
 	mMessageSeparatorFilename(p.message_separator),
-	mMessagePlaintextSeparatorFilename(p.message_plaintext_separator),
 	mLeftTextPad(p.left_text_pad),
 	mRightTextPad(p.right_text_pad),
 	mLeftWidgetPad(p.left_widget_pad),
@@ -535,12 +534,6 @@ LLView* LLChatHistory::getSeparator()
 	return separator;
 }
 
-LLView* LLChatHistory::getPlaintextSeparator()
-{
-	LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessagePlaintextSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
-	return separator;
-}
-
 LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params)
 {
 	LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
@@ -639,15 +632,6 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 
 	if (use_plain_text_chat_history)
 	{
-		// append plaintext separator
-		LLView* separator = getPlaintextSeparator();
-		LLInlineViewSegment::Params p;
-		p.force_newline = true;
-		p.left_pad = mLeftWidgetPad;
-		p.right_pad = mRightWidgetPad;
-		p.view = separator;
-		mEditor->appendWidget(p, "\n", false);
-
 		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
 
 		if (utf8str_trim(chat.mFromName).size() != 0)
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index dfe5ea98e6..950b32861b 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -47,8 +47,6 @@ class LLChatHistory : public LLUICtrl
 			Optional<std::string>	message_header;
 			//Message separator filename
 			Optional<std::string>	message_separator;
-			//Message plaintext  separator filename
-			Optional<std::string>	message_plaintext_separator;
 			//Text left padding from the scroll rect
 			Optional<S32>			left_text_pad;
 			//Text right padding from the scroll rect
@@ -71,7 +69,6 @@ class LLChatHistory : public LLUICtrl
 			Params()
 			:	message_header("message_header"),
 				message_separator("message_separator"),
-				message_plaintext_separator("message_plaintext_separator"),
 				left_text_pad("left_text_pad"),
 				right_text_pad("right_text_pad"),
 				left_widget_pad("left_widget_pad"),
@@ -99,11 +96,6 @@ class LLChatHistory : public LLUICtrl
 		 * @return pointer to LLView separator object.
 		 */
 		LLView* getSeparator();
-		/**
-		 * Builds a message plaintext  separator.
-		 * @return pointer to LLView separator object.
-		 */
-		LLView* getPlaintextSeparator();
 		/**
 		 * Builds a message header.
 		 * @return pointer to LLView header object.
@@ -141,7 +133,6 @@ class LLChatHistory : public LLUICtrl
 
 		std::string mMessageHeaderFilename;
 		std::string mMessageSeparatorFilename;
-		std::string mMessagePlaintextSeparatorFilename;
 
 		S32 mLeftTextPad;
 		S32 mRightTextPad;
diff --git a/indra/newview/skins/default/xui/en/widgets/chat_history.xml b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
index aa3ea736b8..ef885e8045 100644
--- a/indra/newview/skins/default/xui/en/widgets/chat_history.xml
+++ b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
@@ -2,7 +2,6 @@
 <chat_history
   message_header="panel_chat_header.xml"
   message_separator="panel_chat_separator.xml"
-  message_plaintext_separator="panel_chat_plaintext_separator.xml"
   left_text_pad="10"
   right_text_pad="15"
   left_widget_pad="0"
-- 
cgit v1.2.3


From be66b520571aa89feefc8e1dad6dbc622521f124 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Fri, 26 Mar 2010 16:44:43 +0200
Subject: Fixed normal bug EXT-6448 (People -> My Friends list has overlapping
 text at the top covering the first few contacts.)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Unfortunately I was unable to reproduce this bug. But I have some idea about the reason of it.
Decision to show or not the help text based on count of people in Inventory/Calling Cards/Friends/All list. So, if this list is empty even if Resident has some friend (and at least one of them is online) both help text & online list were shown at the same time.

The reason of why Friends/All can be empty in inventory can be clean cachу & slow connection to upload it from the server. But I could not reproduce it.

So, the fix is to check both all friends & online friends lists to prevent overlaping in the future.

Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/118/

--HG--
branch : product-engine
---
 indra/newview/llpanelpeople.cpp | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 2025bd52dc..325157a064 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -672,11 +672,6 @@ void LLPanelPeople::updateFriendList()
 		lldebugs << "Friends Cards were not found" << llendl;
 	}
 
-	// show special help text for just created account to help found friends. EXT-4836
-	static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_msg");
-	no_friends_text->setVisible(all_friendsp.size() == 0);
-
-
 	LLAvatarTracker::buddy_map_t::const_iterator buddy_it = all_buddies.begin();
 	for (; buddy_it != all_buddies.end(); ++buddy_it)
 	{
@@ -685,6 +680,14 @@ void LLPanelPeople::updateFriendList()
 			online_friendsp.push_back(buddy_id);
 	}
 
+	// show special help text for just created account to help found friends. EXT-4836
+	static LLTextBox* no_friends_text = getChild<LLTextBox>("no_friends_msg");
+
+	// Seems sometimes all_friends can be empty because of issue with Inventory loading (clear cache, slow connection...)
+	// So, lets check all lists to avoid overlapping the text with online list. See EXT-6448.
+	bool any_friend_exists = (all_friendsp.size() > 0) || (online_friendsp.size() > 0);
+	no_friends_text->setVisible(!any_friend_exists);
+
 	/*
 	 * Avatarlists  will be hidden by showFriendsAccordionsIfNeeded(), if they do not have items.
 	 * But avatarlist can be updated only if it is visible @see LLAvatarList::draw();   
-- 
cgit v1.2.3


From 3f3c9c7e255e090c7f09dafd08ec20f2d8a09c6d Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Fri, 26 Mar 2010 17:08:32 +0200
Subject: Fixed normal bug EXT-5116 (Voice notification should display on top
 of IM window, not under.)

Replaced sending voice notifications to front (in floater view) with adding them to popup view.
In this case Voice Notifications are shown on top even IM window has focus. And Resident can continue enter the text when Voice notification is shown.

Reviewad by Vadim at https://codereview.productengine.com/secondlife/r/120/

--HG--
branch : product-engine
---
 indra/newview/llimview.cpp | 7 ++++++-
 indra/newview/llimview.h   | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 288895be8c..389917a6f7 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -1559,6 +1559,11 @@ LLCallDialog::LLCallDialog(const LLSD& payload)
 	setDocked(true);
 }
 
+LLCallDialog::~LLCallDialog()
+{
+	LLUI::removePopup(this);
+}
+
 void LLCallDialog::getAllowedRect(LLRect& rect)
 {
 	rect = gViewerWindow->getWorldViewRectScaled();
@@ -1612,7 +1617,7 @@ void LLCallDialog::onOpen(const LLSD& key)
 	LLDockableFloater::onOpen(key);
 
 	// it should be over the all floaters. EXT-5116
-	gFloaterView->bringToFront(this, FALSE);
+	LLUI::addPopup(this);
 }
 
 void LLCallDialog::setIcon(const LLSD& session_id, const LLSD& participant_id)
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 475d407bea..fac8f4954c 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -495,7 +495,7 @@ class LLCallDialog : public LLDockableFloater
 {
 public:
 	LLCallDialog(const LLSD& payload);
-	~LLCallDialog() {}
+	~LLCallDialog();
 
 	virtual BOOL postBuild();
 
-- 
cgit v1.2.3


From 1ed3117a6d3d40788245d2b28f2ed7a82380b4bb Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Fri, 26 Mar 2010 11:38:42 -0400
Subject: Backed out changeset 686628355e4a as it caused a crash.

---
 indra/newview/llchathistory.cpp                          | 16 ++++++++++++++++
 indra/newview/llchathistory.h                            |  9 +++++++++
 .../skins/default/xui/en/widgets/chat_history.xml        |  1 +
 3 files changed, 26 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 000fb62431..efdfbb8d20 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -447,6 +447,7 @@ LLChatHistory::LLChatHistory(const LLChatHistory::Params& p)
 :	LLUICtrl(p),
 	mMessageHeaderFilename(p.message_header),
 	mMessageSeparatorFilename(p.message_separator),
+	mMessagePlaintextSeparatorFilename(p.message_plaintext_separator),
 	mLeftTextPad(p.left_text_pad),
 	mRightTextPad(p.right_text_pad),
 	mLeftWidgetPad(p.left_widget_pad),
@@ -534,6 +535,12 @@ LLView* LLChatHistory::getSeparator()
 	return separator;
 }
 
+LLView* LLChatHistory::getPlaintextSeparator()
+{
+	LLPanel* separator = LLUICtrlFactory::getInstance()->createFromFile<LLPanel>(mMessagePlaintextSeparatorFilename, NULL, LLPanel::child_registry_t::instance());
+	return separator;
+}
+
 LLView* LLChatHistory::getHeader(const LLChat& chat,const LLStyle::Params& style_params)
 {
 	LLChatHistoryHeader* header = LLChatHistoryHeader::createInstance(mMessageHeaderFilename);
@@ -632,6 +639,15 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 
 	if (use_plain_text_chat_history)
 	{
+		// append plaintext separator
+		LLView* separator = getPlaintextSeparator();
+		LLInlineViewSegment::Params p;
+		p.force_newline = true;
+		p.left_pad = mLeftWidgetPad;
+		p.right_pad = mRightWidgetPad;
+		p.view = separator;
+		mEditor->appendWidget(p, "\n", false);
+
 		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
 
 		if (utf8str_trim(chat.mFromName).size() != 0)
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index 950b32861b..dfe5ea98e6 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -47,6 +47,8 @@ class LLChatHistory : public LLUICtrl
 			Optional<std::string>	message_header;
 			//Message separator filename
 			Optional<std::string>	message_separator;
+			//Message plaintext  separator filename
+			Optional<std::string>	message_plaintext_separator;
 			//Text left padding from the scroll rect
 			Optional<S32>			left_text_pad;
 			//Text right padding from the scroll rect
@@ -69,6 +71,7 @@ class LLChatHistory : public LLUICtrl
 			Params()
 			:	message_header("message_header"),
 				message_separator("message_separator"),
+				message_plaintext_separator("message_plaintext_separator"),
 				left_text_pad("left_text_pad"),
 				right_text_pad("right_text_pad"),
 				left_widget_pad("left_widget_pad"),
@@ -96,6 +99,11 @@ class LLChatHistory : public LLUICtrl
 		 * @return pointer to LLView separator object.
 		 */
 		LLView* getSeparator();
+		/**
+		 * Builds a message plaintext  separator.
+		 * @return pointer to LLView separator object.
+		 */
+		LLView* getPlaintextSeparator();
 		/**
 		 * Builds a message header.
 		 * @return pointer to LLView header object.
@@ -133,6 +141,7 @@ class LLChatHistory : public LLUICtrl
 
 		std::string mMessageHeaderFilename;
 		std::string mMessageSeparatorFilename;
+		std::string mMessagePlaintextSeparatorFilename;
 
 		S32 mLeftTextPad;
 		S32 mRightTextPad;
diff --git a/indra/newview/skins/default/xui/en/widgets/chat_history.xml b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
index ef885e8045..aa3ea736b8 100644
--- a/indra/newview/skins/default/xui/en/widgets/chat_history.xml
+++ b/indra/newview/skins/default/xui/en/widgets/chat_history.xml
@@ -2,6 +2,7 @@
 <chat_history
   message_header="panel_chat_header.xml"
   message_separator="panel_chat_separator.xml"
+  message_plaintext_separator="panel_chat_plaintext_separator.xml"
   left_text_pad="10"
   right_text_pad="15"
   left_widget_pad="0"
-- 
cgit v1.2.3


From 5a12802503b8e557b5cdd99202466bb293a4474f Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Fri, 26 Mar 2010 19:02:14 +0200
Subject: Fixed bug EXT-6268 (Group spawns Resident inspector when called from
 About Land > Objects for group deeded object)

Reason: groups were added to the list as avatars, which led to invoking
incorrect inspector on hover.
Also added a fix for potential crash on hovering name list items.

Reviewed by Leyla: https://codereview.productengine.com/secondlife/r/110/

--HG--
branch : product-engine
---
 indra/newview/llfloaterland.cpp  |  2 +-
 indra/newview/llnamelistctrl.cpp | 24 +++++++++++++++++++-----
 2 files changed, 20 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 65003d9b5c..5dc63b7ef2 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -1612,7 +1612,7 @@ void LLPanelLandObjects::processParcelObjectOwnersReply(LLMessageSystem *msg, vo
 		item_params.columns.add().value(object_count_str).font(FONT).column("count");
 		item_params.columns.add().value(LLDate((time_t)most_recent_time)).font(FONT).column("mostrecent").type("date");
 
-		self->mOwnerList->addRow(item_params);
+		self->mOwnerList->addNameItemRow(item_params);
 
 		lldebugs << "object owner " << owner_id << " (" << (is_group_owned ? "group" : "agent")
 				<< ") owns " << object_count << " objects." << llendl;
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 7a538e372b..9611c286eb 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -148,16 +148,30 @@ void	LLNameListCtrl::mouseOverHighlightNthItem( S32 target_index )
 		if(0 <= cur_index && cur_index < (S32)getItemList().size())
 		{
 			LLScrollListItem* item = getItemList()[cur_index];
-			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
-			if(cell)
-				cell->setTextWidth(cell->getTextWidth() + info_icon_size);
+			if (item)
+			{
+				LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
+				if (cell)
+					cell->setTextWidth(cell->getTextWidth() + info_icon_size);
+			}
+			else
+			{
+				llwarns << "highlighted name list item is NULL" << llendl;
+			}
 		}
 		if(target_index != -1)
 		{
 			LLScrollListItem* item = getItemList()[target_index];
 			LLScrollListText* cell = dynamic_cast<LLScrollListText*>(item->getColumn(mNameColumnIndex));
-			if(cell)
-				cell->setTextWidth(cell->getTextWidth() - info_icon_size);
+			if (item)
+			{
+				if (cell)
+					cell->setTextWidth(cell->getTextWidth() - info_icon_size);
+			}
+			else
+			{
+				llwarns << "target name item is NULL" << llendl;
+			}
 		}
 	}
 
-- 
cgit v1.2.3


From b7d0bb9e1ed7aab7eb6d4bb0eb129778892f503a Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Fri, 26 Mar 2010 19:09:11 +0200
Subject: Fixed bug EXT-6399 (System locale is the same for all languages).

Problem:
* English locale was set for all languages.
* Specifying a correct locale didn't affect anything, including date/time formatting.

My investigation has shown that LLStringUtil was instantiated twice: in the
main binary and in libllcommon.so.
Because LLStringUtil::setLocale() was called from newview and getLocale()
was called from llcommon, they effectively used *different* instances of
LLStringUtil::sLocale. Hence getLocale() always returned empty string.

This seems to be caused by get/setLocale() methods not being dllexported.

The fix instantiates get/setLocale() and sLocale in llcommon and exposes
them to use from newview (i.e. prevents multiple instantiation).

Besides, I specified correct locale names for all languages and platforms.

Reviewed by Leyla: https://codereview.productengine.com/secondlife/r/104/

--HG--
branch : product-engine
---
 indra/llcommon/llstring.cpp                              | 14 ++++++++++++++
 indra/llcommon/llstring.h                                |  4 ++--
 indra/newview/skins/default/xui/da/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/de/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/es/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/fr/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/it/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/ja/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/nl/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/pl/language_settings.xml |  6 +++---
 indra/newview/skins/default/xui/pt/language_settings.xml |  6 +++---
 11 files changed, 43 insertions(+), 29 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp
index 5f3d9d6582..b5a73ec1d1 100644
--- a/indra/llcommon/llstring.cpp
+++ b/indra/llcommon/llstring.cpp
@@ -911,6 +911,20 @@ bool LLStringUtil::simpleReplacement(std::string &replacement, std::string token
 	return false;
 }
 
+//static
+template<>
+void LLStringUtil::setLocale(std::string inLocale)
+{
+	sLocale = inLocale;
+};
+
+//static
+template<>
+std::string LLStringUtil::getLocale(void)
+{
+	return sLocale;
+};
+
 // static
 template<> 
 void LLStringUtil::formatNumber(std::string& numStr, std::string decimals)
diff --git a/indra/llcommon/llstring.h b/indra/llcommon/llstring.h
index 62cedcde4e..96588b29b9 100644
--- a/indra/llcommon/llstring.h
+++ b/indra/llcommon/llstring.h
@@ -241,8 +241,8 @@ public:
 	LL_COMMON_API static S32 format(std::basic_string<T>& s, const LLSD& substitutions);
 	LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const format_map_t& substitutions);
 	LL_COMMON_API static bool simpleReplacement(std::basic_string<T>& replacement, std::basic_string<T> token, const LLSD& substitutions);
-	static void setLocale (std::string inLocale) {sLocale = inLocale;};
-	static std::string getLocale (void) {return sLocale;};
+	LL_COMMON_API static void setLocale (std::string inLocale);
+	LL_COMMON_API static std::string getLocale (void);
 	
 	static bool isValidIndex(const std::basic_string<T>& string, size_type i)
 	{
diff --git a/indra/newview/skins/default/xui/da/language_settings.xml b/indra/newview/skins/default/xui/da/language_settings.xml
index 71418d446a..fa8a788605 100644
--- a/indra/newview/skins/default/xui/da/language_settings.xml
+++ b/indra/newview/skins/default/xui/da/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">danish</string>
+	<string name="DarwinLocale">da_DK.UTF-8</string>
+	<string name="LinuxLocale">da_DK.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/de/language_settings.xml b/indra/newview/skins/default/xui/de/language_settings.xml
index 71418d446a..3e357007ff 100644
--- a/indra/newview/skins/default/xui/de/language_settings.xml
+++ b/indra/newview/skins/default/xui/de/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">german</string>
+	<string name="DarwinLocale">de_DE.UTF-8</string>
+	<string name="LinuxLocale">de_DE.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/es/language_settings.xml b/indra/newview/skins/default/xui/es/language_settings.xml
index 71418d446a..1ade4ba300 100644
--- a/indra/newview/skins/default/xui/es/language_settings.xml
+++ b/indra/newview/skins/default/xui/es/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">spanish</string>
+	<string name="DarwinLocale">es_ES.UTF-8</string>
+	<string name="LinuxLocale">es_ES.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/fr/language_settings.xml b/indra/newview/skins/default/xui/fr/language_settings.xml
index 71418d446a..117ae16ee8 100644
--- a/indra/newview/skins/default/xui/fr/language_settings.xml
+++ b/indra/newview/skins/default/xui/fr/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">french</string>
+	<string name="DarwinLocale">fr_FR.UTF-8</string>
+	<string name="LinuxLocale">fr_FR.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/it/language_settings.xml b/indra/newview/skins/default/xui/it/language_settings.xml
index 71418d446a..82cf789a6b 100644
--- a/indra/newview/skins/default/xui/it/language_settings.xml
+++ b/indra/newview/skins/default/xui/it/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">italian</string>
+	<string name="DarwinLocale">it_IT.UTF-8</string>
+	<string name="LinuxLocale">it_IT.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/ja/language_settings.xml b/indra/newview/skins/default/xui/ja/language_settings.xml
index 71418d446a..72382417d9 100644
--- a/indra/newview/skins/default/xui/ja/language_settings.xml
+++ b/indra/newview/skins/default/xui/ja/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">japanese</string>
+	<string name="DarwinLocale">ja_JP.UTF-8</string>
+	<string name="LinuxLocale">ja_JP.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/nl/language_settings.xml b/indra/newview/skins/default/xui/nl/language_settings.xml
index 71418d446a..dc4663705f 100644
--- a/indra/newview/skins/default/xui/nl/language_settings.xml
+++ b/indra/newview/skins/default/xui/nl/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">dutch</string>
+	<string name="DarwinLocale">nl_NL.UTF-8</string>
+	<string name="LinuxLocale">nl_NL.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/pl/language_settings.xml b/indra/newview/skins/default/xui/pl/language_settings.xml
index 71418d446a..debc451a33 100644
--- a/indra/newview/skins/default/xui/pl/language_settings.xml
+++ b/indra/newview/skins/default/xui/pl/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">polish</string>
+	<string name="DarwinLocale">pl_PL.UTF-8</string>
+	<string name="LinuxLocale">pl_PL.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
diff --git a/indra/newview/skins/default/xui/pt/language_settings.xml b/indra/newview/skins/default/xui/pt/language_settings.xml
index 71418d446a..f25e77574d 100644
--- a/indra/newview/skins/default/xui/pt/language_settings.xml
+++ b/indra/newview/skins/default/xui/pt/language_settings.xml
@@ -3,9 +3,9 @@
 <strings>
 
 	<!-- Locale Information -->
-	<string name="MicrosoftLocale">english</string>
-	<string name="DarwinLocale">C</string>
-	<string name="LinuxLocale">C</string>
+	<string name="MicrosoftLocale">portuguese</string>
+	<string name="DarwinLocale">pt_PT.UTF-8</string>
+	<string name="LinuxLocale">pt_PT.UTF-8</string>
 	
 	<!-- 
 	datetimeToCodes["wkday"]	= "%a";		// Thu
-- 
cgit v1.2.3


From 0bcfbde3a4265d7963ea501622e512de8eab7f61 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 26 Mar 2010 13:58:19 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Lots of superficial cleanup, particularly around "if (" formatting.
Removed LLAgent as a friend of LLAgentCamera and refactored to use accessors.
---
 indra/newview/llagent.cpp               |  32 +--
 indra/newview/llagentcamera.cpp         |  13 +-
 indra/newview/llagentcamera.h           |   6 +-
 indra/newview/llagentwearables.cpp      |   2 +-
 indra/newview/llfloateranimpreview.cpp  |   4 +-
 indra/newview/llinventorybridge.cpp     |  10 +-
 indra/newview/llmorphview.cpp           |   2 +-
 indra/newview/llpreview.cpp             |   2 +-
 indra/newview/llsidepanelappearance.cpp |   2 +-
 indra/newview/lltooldraganddrop.cpp     | 412 ++++++++++++++++----------------
 indra/newview/llviewermessage.cpp       |   2 +-
 indra/newview/llvoavatarself.cpp        |   8 +-
 indra/newview/llwearable.cpp            |   6 +-
 13 files changed, 250 insertions(+), 251 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 7a34112807..a1b2a9fc44 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -315,7 +315,7 @@ LLAgent::~LLAgent()
 //-----------------------------------------------------------------------------
 void LLAgent::onAppFocusGained()
 {
-	if (CAMERA_MODE_MOUSELOOK == gAgentCamera.mCameraMode)
+	if (CAMERA_MODE_MOUSELOOK == gAgentCamera.getCameraMode())
 	{
 		gAgentCamera.changeCameraToDefault();
 		LLToolMgr::getInstance()->clearSavedTool();
@@ -952,7 +952,7 @@ LLVector3 LLAgent::getReferenceUpVector()
 		mAvatarObject->getParent() &&
 		mAvatarObject->mDrawable.notNull())
 	{
-		U32 camera_mode = gAgentCamera.mCameraAnimating ? gAgentCamera.mLastCameraMode : gAgentCamera.mCameraMode;
+		U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
 		// and in third person...
 		if (camera_mode == CAMERA_MODE_THIRD_PERSON)
 		{
@@ -1076,17 +1076,6 @@ void LLAgent::setKey(const S32 direction, S32 &key)
 //-----------------------------------------------------------------------------
 U32 LLAgent::getControlFlags()
 {
-/*
-	// HACK -- avoids maintenance of control flags when camera mode is turned on or off,
-	// only worries about it when the flags are measured
-	if (mCameraMode == CAMERA_MODE_MOUSELOOK) 
-	{
-		if ( !(mControlFlags & AGENT_CONTROL_MOUSELOOK) )
-		{
-			mControlFlags |= AGENT_CONTROL_MOUSELOOK;
-		}
-	}
-*/
 	return mControlFlags;
 }
 
@@ -1768,14 +1757,14 @@ U8 LLAgent::getRenderState()
 //-----------------------------------------------------------------------------
 void LLAgent::endAnimationUpdateUI()
 {
-	if (gAgentCamera.mCameraMode == gAgentCamera.mLastCameraMode)
+	if (gAgentCamera.getCameraMode() == gAgentCamera.getLastCameraMode())
 	{
 		// We're already done endAnimationUpdateUI for this transition.
 		return;
 	}
 
 	// clean up UI from mode we're leaving
-	if (gAgentCamera.mLastCameraMode == CAMERA_MODE_MOUSELOOK )
+	if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_MOUSELOOK )
 	{
 		// show mouse cursor
 		gViewerWindow->showCursor();
@@ -1847,7 +1836,7 @@ void LLAgent::endAnimationUpdateUI()
 			}
 		}
 	}
-	else if(gAgentCamera.mLastCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR)
+	else if (gAgentCamera.getLastCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
 		// make sure we ask to save changes
 
@@ -1875,7 +1864,7 @@ void LLAgent::endAnimationUpdateUI()
 	//---------------------------------------------------------------------
 	// Set up UI for mode we're entering
 	//---------------------------------------------------------------------
-	if (gAgentCamera.mCameraMode == CAMERA_MODE_MOUSELOOK)
+	if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK)
 	{
 		// hide menus
 		gMenuBarView->setVisible(FALSE);
@@ -1890,7 +1879,7 @@ void LLAgent::endAnimationUpdateUI()
 		LLPanelStandStopFlying::getInstance()->setVisible(FALSE);
 
 		// clear out camera lag effect
-		gAgentCamera.mCameraLag.clearVec();
+		gAgentCamera.clearCameraLag();
 
 		// JC - Added for always chat in third person option
 		gFocusMgr.setKeyboardFocus(NULL);
@@ -1960,7 +1949,7 @@ void LLAgent::endAnimationUpdateUI()
 		}
 
 	}
-	else if (gAgentCamera.mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR)
+	else if (gAgentCamera.getCameraMode() == CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
 		LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
 
@@ -1978,15 +1967,14 @@ void LLAgent::endAnimationUpdateUI()
 
 	if (getAvatarObject())
 	{
-		getAvatarObject()->updateAttachmentVisibility(gAgentCamera.mCameraMode);
+		getAvatarObject()->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 	}
 
 	gFloaterTools->dirty();
 
 	// Don't let this be called more than once if the camera
 	// mode hasn't changed.  --JC
-	gAgentCamera.mLastCameraMode = gAgentCamera.mCameraMode;
-
+	gAgentCamera.updateLastCamera();
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index e000d44ab8..b9555e1a37 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1537,6 +1537,11 @@ void LLAgentCamera::updateCamera()
 	}
 }
 
+void LLAgentCamera::updateLastCamera()
+{
+	mLastCameraMode = mCameraMode;
+}
+
 void LLAgentCamera::updateFocusOffset()
 {
 	validateFocusObject();
@@ -2161,7 +2166,7 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
 	{
 		gFocusMgr.setKeyboardFocus(NULL);
 		
-		mLastCameraMode = mCameraMode;
+		updateLastCamera();
 		mCameraMode = CAMERA_MODE_MOUSELOOK;
 		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.setControlFlags(AGENT_CONTROL_MOUSELOOK);
@@ -2223,7 +2228,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
 		}
 		startCameraAnimation();
 
-		mLastCameraMode = mCameraMode;
+		updateLastCamera();
 		mCameraMode = CAMERA_MODE_FOLLOW;
 
 		// bang-in the current focus, position, and up vector of the follow cam
@@ -2308,7 +2313,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 			mTargetCameraDistance = MIN_CAMERA_DISTANCE;
 			animate = FALSE;
 		}
-		mLastCameraMode = mCameraMode;
+		updateLastCamera();
 		mCameraMode = CAMERA_MODE_THIRD_PERSON;
 		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
@@ -2379,7 +2384,7 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 
 	if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
-		mLastCameraMode = mCameraMode;
+		updateLastCamera();
 		mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR;
 		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 6fe645e7d1..2074864336 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -92,8 +92,6 @@ class LLAgentCamera
 	LOG_CLASS(LLAgentCamera);
 
 public:
-	friend class LLAgent;
-
 	//--------------------------------------------------------------------
 	// Constructors / Destructors
 	//--------------------------------------------------------------------
@@ -121,8 +119,11 @@ public:
 	BOOL			cameraCustomizeAvatar() const	{ return (mCameraMode == CAMERA_MODE_CUSTOMIZE_AVATAR /*&& !mCameraAnimating*/); }
 	BOOL			cameraFollow() const			{ return (mCameraMode == CAMERA_MODE_FOLLOW && mLastCameraMode == CAMERA_MODE_FOLLOW); }
 	ECameraMode		getCameraMode() const 			{ return mCameraMode; }
+	ECameraMode		getLastCameraMode() const 		{ return mLastCameraMode; }
 	void			updateCamera();					// Call once per frame to update camera location/orientation
 	void			resetCamera(); 					// Slam camera into its default position
+	void			updateLastCamera();				// Set last camera to current camera
+
 private:
 	ECameraMode		mCameraMode;					// Target mode after transition animation is done
 	ECameraMode		mLastCameraMode;
@@ -157,6 +158,7 @@ public:
 	BOOL			calcCameraMinDistance(F32 &obj_min_distance);
 	F32				calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global);
 	F32				getCurrentCameraBuildOffset() 	{ return (F32)mCameraFocusOffset.length(); }
+	void			clearCameraLag() { mCameraLag.clearVec(); }
 private:
 	F32				mCurrentCameraDistance;	 		// Current camera offset from avatar
 	F32				mTargetCameraDistance;			// Target camera offset from avatar
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 5eb943877a..c673e82d5f 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2714,7 +2714,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 
 		// Add all current attachments to the requested items as well.
 		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if(avatarp)
+		if (avatarp)
 		{
 			for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin(); 
 				 iter != avatarp->mAttachmentPoints.end(); ++iter)
diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp
index feb18fe393..434c89e8ba 100644
--- a/indra/newview/llfloateranimpreview.cpp
+++ b/indra/newview/llfloateranimpreview.cpp
@@ -568,7 +568,7 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data)
 	{
 		LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
 		
-		if(!avatarp->isMotionActive(previewp->mMotionID))
+		if (!avatarp->isMotionActive(previewp->mMotionID))
 		{
 			previewp->resetMotion();
 			previewp->mPauseRequest = NULL;
@@ -593,7 +593,7 @@ void LLFloaterAnimPreview::onBtnPause(void* user_data)
 	{
 		LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar();
 
-		if(avatarp->isMotionActive(previewp->mMotionID))
+		if (avatarp->isMotionActive(previewp->mMotionID))
 		{
 			if (!avatarp->areAnimationsPaused())
 			{
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index da21939a61..2d544f53f4 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1507,7 +1507,7 @@ BOOL LLFolderBridge::isItemRemovable() const
 	}
 
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(!avatarp)
+	if (!avatarp)
 	{
 		return FALSE;
 	}
@@ -1662,7 +1662,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	if(!model) return FALSE;
 
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(!avatarp) return FALSE;
+	if (!avatarp) return FALSE;
 
 	// cannot drag categories into library
 	if(!isAgentInventory())
@@ -3027,7 +3027,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 	}
 
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(!avatarp) return FALSE;
+	if (!avatarp) return FALSE;
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
 	BOOL accept = FALSE;
@@ -4269,7 +4269,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		if(item)
 		{
 			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if( !avatarp )
+			if (!avatarp)
 			{
 				return;
 			}
@@ -4355,7 +4355,7 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
 		model->notifyObservers();
 
 		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if(avatarp)
+		if (avatarp)
 		{
 			LLViewerObject* obj = avatarp->getWornAttachment( item->getUUID() );
 			if(obj)
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index 47234eb773..28da9a2b90 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -112,7 +112,7 @@ void	LLMorphView::shutdown()
 	LLVOAvatarSelf::onCustomizeEnd();
 
 	LLVOAvatar *avatarp = gAgent.getAvatarObject();
-	if(avatarp && !avatarp->isDead())
+	if (avatarp && !avatarp->isDead())
 	{
 		avatarp->startMotion( ANIM_AGENT_BODY_NOISE );
 		avatarp->mSpecialRenderMode = 0;
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 99e0b82b8f..312bbc0e11 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -180,7 +180,7 @@ void LLPreview::onCommit()
 			if( item->getType() == LLAssetType::AT_OBJECT )
 			{
 				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-				if(avatarp)
+				if (avatarp)
 				{
 					LLViewerObject* obj = avatarp->getWornAttachment( item->getUUID() );
 					if( obj )
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 9a37af4916..c6fba61886 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -367,7 +367,7 @@ void LLSidepanelAppearance::fetchInventory()
 	}
 
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(avatarp)
+	if (avatarp)
 	{
 		for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin(); 
 			 iter != avatarp->mAttachmentPoints.end(); ++iter)
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 813b3bd22f..0aa6b8736b 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -80,7 +80,7 @@ public:
 	virtual bool operator()(LLInventoryCategory* cat,
 							LLInventoryItem* item)
 	{
-		if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+		if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
 		{
 			return true;
 		}
@@ -96,8 +96,8 @@ public:
 	virtual bool operator()(LLInventoryCategory* cat,
 							LLInventoryItem* item)
 	{
-		if(item) return true;
-		if(cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
+		if (item) return true;
+		if (cat && (cat->getPreferredType() == LLFolderType::FT_NONE))
 		{
 			return true;
 		}
@@ -124,18 +124,18 @@ bool LLDroppableItem::operator()(LLInventoryCategory* cat,
 				 LLInventoryItem* item)
 {
 	bool allowed = false;
-	if(item)
+	if (item)
 	{
 		allowed = itemTransferCommonlyAllowed(item);
 
-		if(allowed
+		if (allowed
 		   && mIsTransfer
 		   && !item->getPermissions().allowOperationBy(PERM_TRANSFER,
 							       gAgent.getID()))
 		{
 			allowed = false;
 		}
-		if(allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
+		if (allowed && !item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
 			++mCountLosing;
 		}
@@ -155,7 +155,7 @@ bool LLUncopyableItems::operator()(LLInventoryCategory* cat,
 				   LLInventoryItem* item)
 {
 	bool uncopyable = false;
-	if(item)
+	if (item)
 	{
 		if (itemTransferCommonlyAllowed(item) &&
 		   !item->getPermissions().allowCopyBy(gAgent.getID()))
@@ -180,10 +180,10 @@ bool LLDropCopyableItems::operator()(
 	LLInventoryItem* item)
 {
 	bool allowed = false;
-	if(item)
+	if (item)
 	{
 		allowed = itemTransferCommonlyAllowed(item);
-		if(allowed &&
+		if (allowed &&
 		   !item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
 			// whoops, can't copy it - don't allow it.
@@ -212,16 +212,16 @@ bool LLGiveable::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
 		return true;
 
 	bool allowed = false;
-	if(item)
+	if (item)
 	{
 		allowed = itemTransferCommonlyAllowed(item);
-		if(allowed &&
+		if (allowed &&
 		   !item->getPermissions().allowOperationBy(PERM_TRANSFER,
 							    gAgent.getID()))
 		{
 			allowed = FALSE;
 		}
-		if(allowed &&
+		if (allowed &&
 		   !item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
 			++mCountLosing;
@@ -262,7 +262,7 @@ void LLCategoryDropObserver::done()
 {
 	gInventory.removeObserver(this);
 	LLViewerObject* dst_obj = gObjectList.findObject(mObjectID);
-	if(dst_obj)
+	if (dst_obj)
 	{
 		// *FIX: coalesce these...
  		LLInventoryItem* item = NULL;
@@ -271,7 +271,7 @@ void LLCategoryDropObserver::done()
   		for(; it < end; ++it)
   		{
  			item = gInventory.getItem(*it);
- 			if(item)
+ 			if (item)
  			{
  				LLToolDragAndDrop::dropInventory(
  					dst_obj,
@@ -318,7 +318,7 @@ void LLCategoryDropDescendentsObserver::done()
 	}
 
 	S32 count = items.count();
-	if(count)
+	if (count)
 	{
 		std::set<LLUUID> unique_ids;
 		for(S32 i = 0; i < count; ++i)
@@ -331,7 +331,7 @@ void LLCategoryDropDescendentsObserver::done()
 		LLCategoryDropObserver* dropper;
 		dropper = new LLCategoryDropObserver(mObjectID, mSource);
 		dropper->fetchItems(ids);
-		if(dropper->isEverythingComplete())
+		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
 		}
@@ -422,7 +422,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 								  const LLUUID& source_id,
 								  const LLUUID& object_id)
 {
-	if(type == DAD_NONE)
+	if (type == DAD_NONE)
 	{
 		llwarns << "Attempted to start drag without a cargo type" << llendl;
 		return;
@@ -438,24 +438,24 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 	setMouseCapture( TRUE );
 	LLToolMgr::getInstance()->setTransientTool( this );
 	mCursor = UI_CURSOR_NO;
-	if((mCargoTypes[0] == DAD_CATEGORY)
+	if ((mCargoTypes[0] == DAD_CATEGORY)
 	   && ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY)))
 	{
 		LLInventoryCategory* cat = gInventory.getCategory(cargo_id);
 		// go ahead and fire & forget the descendents if we are not
 		// dragging a protected folder.
-		if(cat)
+		if (cat)
 		{
 			LLViewerInventoryCategory::cat_array_t cats;
 			LLViewerInventoryItem::item_array_t items;
 			LLNoPreferredTypeOrItem is_not_preferred;
 			LLInventoryFetchComboObserver::folder_ref_t folder_ids;
 			LLInventoryFetchComboObserver::item_ref_t item_ids;
-			if(is_not_preferred(cat, NULL))
+			if (is_not_preferred(cat, NULL))
 			{
 				folder_ids.push_back(cargo_id);
 			}
-			gInventory.collectDescendentsIf(
+			gInventory.collectDescendentsIf (
 				cargo_id,
 				cats,
 				items,
@@ -472,7 +472,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 			{
 				item_ids.push_back(items.get(i)->getUUID());
 			}
-			if(!folder_ids.empty() || !item_ids.empty())
+			if (!folder_ids.empty() || !item_ids.empty())
 			{
 				LLCategoryFireAndForget fetcher;
 				fetcher.fetch(folder_ids, item_ids);
@@ -493,7 +493,7 @@ void LLToolDragAndDrop::beginMultiDrag(
 	std::vector<EDragAndDropType>::const_iterator types_it;
 	for (types_it = types.begin(); types_it != types.end(); ++types_it)
 	{
-		if(DAD_NONE == *types_it)
+		if (DAD_NONE == *types_it)
 		{
 			llwarns << "Attempted to start drag without a cargo type" << llendl;
 			return;
@@ -507,7 +507,7 @@ void LLToolDragAndDrop::beginMultiDrag(
 	setMouseCapture( TRUE );
 	LLToolMgr::getInstance()->setTransientTool( this );
 	mCursor = UI_CURSOR_NO;
-	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+	if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
 	{
 		// find categories (i.e. inventory folders) in the cargo.
 		LLInventoryCategory* cat = NULL;
@@ -516,16 +516,16 @@ void LLToolDragAndDrop::beginMultiDrag(
 		for(S32 i = 0; i < count; ++i)
 		{
 			cat = gInventory.getCategory(cargo_ids[i]);
-			if(cat)
+			if (cat)
 			{
 				LLViewerInventoryCategory::cat_array_t cats;
 				LLViewerInventoryItem::item_array_t items;
 				LLNoPreferredType is_not_preferred;
-				if(is_not_preferred(cat, NULL))
+				if (is_not_preferred(cat, NULL))
 				{
 					cat_ids.insert(cat->getUUID());
 				}
-				gInventory.collectDescendentsIf(
+				gInventory.collectDescendentsIf (
 					cat->getUUID(),
 					cats,
 					items,
@@ -538,7 +538,7 @@ void LLToolDragAndDrop::beginMultiDrag(
 				}
 			}
 		}
-		if(!cat_ids.empty())
+		if (!cat_ids.empty())
 		{
 			LLInventoryFetchComboObserver::folder_ref_t folder_ids;
 			LLInventoryFetchComboObserver::item_ref_t item_ids;
@@ -570,7 +570,7 @@ void LLToolDragAndDrop::onMouseCaptureLost()
 
 BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
 {
-	if( hasMouseCapture() )
+	if (hasMouseCapture())
 	{
 		EAcceptance acceptance = ACCEPT_NO;
 		dragOrDrop( x, y, mask, TRUE, &acceptance );
@@ -581,7 +581,7 @@ BOOL LLToolDragAndDrop::handleMouseUp( S32 x, S32 y, MASK mask )
 
 ECursorType LLToolDragAndDrop::acceptanceToCursor( EAcceptance acceptance )
 {
-	switch( acceptance )
+	switch (acceptance)
 	{
 	case ACCEPT_YES_MULTI:
 		if (mCargoIDs.size() > 1)
@@ -698,7 +698,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
 
 	mToolTipMsg.clear();
 
-	if(top_view)
+	if (top_view)
 	{
 		handled = TRUE;
 
@@ -763,7 +763,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
 		}
 	}
 
-	if(!handled)
+	if (!handled)
 	{
 		handled = TRUE;
 
@@ -821,7 +821,7 @@ void LLToolDragAndDrop::dragOrDrop( S32 x, S32 y, MASK mask, BOOL drop,
 		}
 	}
 
-	if ( !handled )
+	if (!handled)
 	{
 		dragOrDrop3D( x, y, mask, drop, acceptance );
 	}
@@ -874,7 +874,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
 		if (hit_obj->isAttachment() && !hit_obj->isHUDAttachment())
 		{
 			LLVOAvatar* avatar = LLVOAvatar::findAvatarFromAttachment( hit_obj );
-			if( !avatar )
+			if (!avatar)
 			{
 				mLastAccept = ACCEPT_NO;
 				mCursor = UI_CURSOR_NO;
@@ -886,7 +886,7 @@ void LLToolDragAndDrop::pick(const LLPickInfo& pick_info)
 
 		if (hit_obj->isAvatar())
 		{
-			if(((LLVOAvatar*) hit_obj)->isSelf())
+			if (((LLVOAvatar*) hit_obj)->isSelf())
 			{
 				target = DT_SELF;
 				hit_face = -1;
@@ -972,7 +972,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
 	// Always succeed if....
 	// texture is from the library 
 	// or already in the contents of the object
-	if(SOURCE_LIBRARY == source)
+	if (SOURCE_LIBRARY == source)
 	{
 		// dropping a texture from the library always just works.
 		return TRUE;
@@ -1000,7 +1000,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
 	if (!item) return FALSE;
 	
 	LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(item);
-	if(!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
+	if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID()))
 	{
 		// Check that we can add the texture as inventory to the object
 		if (willObjectAcceptInventory(hit_obj,item) < ACCEPT_YES_COPY_SINGLE )
@@ -1008,20 +1008,20 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
 			return FALSE;
 		}
 		// make sure the object has the texture in it's inventory.
-		if(SOURCE_AGENT == source)
+		if (SOURCE_AGENT == source)
 		{
 			// Remove the texture from local inventory. The server
 			// will actually remove the item from agent inventory.
 			gInventory.deleteObject(item->getUUID());
 			gInventory.notifyObservers();
 		}
-		else if(SOURCE_WORLD == source)
+		else if (SOURCE_WORLD == source)
 		{
 			// *FIX: if the objects are in different regions, and the
 			// source region has crashed, you can bypass these
 			// permissions.
 			LLViewerObject* src_obj = gObjectList.findObject(src_id);
-			if(src_obj)
+			if (src_obj)
 			{
 				src_obj->removeInventory(item->getUUID());
 			}
@@ -1036,7 +1036,7 @@ BOOL LLToolDragAndDrop::handleDropTextureProtections(LLViewerObject* hit_obj,
  		// TODO: Check to see if adding the item was successful; if not, then
 		// we should return false here.
 	}
-	else if(!item->getPermissions().allowOperationBy(PERM_TRANSFER,
+	else if (!item->getPermissions().allowOperationBy(PERM_TRANSFER,
 													 gAgent.getID()))
 	{
 		// Check that we can add the texture as inventory to the object
@@ -1068,7 +1068,7 @@ void LLToolDragAndDrop::dropTextureAllFaces(LLViewerObject* hit_obj,
 	}
 	LLUUID asset_id = item->getAssetUUID();
 	BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id);
-	if(!success)
+	if (!success)
 	{
 		return;
 	}
@@ -1110,7 +1110,7 @@ void LLToolDragAndDrop::dropTextureOneFace(LLViewerObject* hit_obj,
 	}
 	LLUUID asset_id = item->getAssetUUID();
 	BOOL success = handleDropTextureProtections(hit_obj, item, source, src_id);
-	if(!success)
+	if (!success)
 	{
 		return;
 	}
@@ -1133,32 +1133,32 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
 {
 	// *HACK: In order to resolve SL-22177, we need to block drags
 	// from notecards and objects onto other objects.
-	if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+	if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
 	   || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
 	{
 		llwarns << "Call to LLToolDragAndDrop::dropScript() from world"
 			<< " or notecard." << llendl;
 		return;
 	}
-	if(hit_obj && item)
+	if (hit_obj && item)
 	{
 		LLPointer<LLViewerInventoryItem> new_script = new LLViewerInventoryItem(item);
-		if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+		if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
-			if(SOURCE_AGENT == source)
+			if (SOURCE_AGENT == source)
 			{
 				// Remove the script from local inventory. The server
 				// will actually remove the item from agent inventory.
 				gInventory.deleteObject(item->getUUID());
 				gInventory.notifyObservers();
 			}
-			else if(SOURCE_WORLD == source)
+			else if (SOURCE_WORLD == source)
 			{
 				// *FIX: if the objects are in different regions, and
 				// the source region has crashed, you can bypass
 				// these permissions.
 				LLViewerObject* src_obj = gObjectList.findObject(src_id);
-				if(src_obj)
+				if (src_obj)
 				{
 					src_obj->removeInventory(item->getUUID());
 				}
@@ -1198,7 +1198,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return;
+	if (!item || !item->isComplete()) return;
 	
 	//if (regionp
 	//	&& (regionp->getRegionFlags() & REGION_FLAGS_SANDBOX))
@@ -1209,7 +1209,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	// this will remove the object from inventory after rez. Only
 	// bother with this check if we would not normally remove from
 	// inventory.
-	if(!remove_from_inventory
+	if (!remove_from_inventory
 		&& !item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		remove_from_inventory = TRUE;
@@ -1220,7 +1220,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	// hitting objects that were clipped by the near plane or culled
 	// on the viewer.
 	LLUUID ray_target_id;
-	if( raycast_target )
+	if (raycast_target)
 	{
 		ray_target_id = raycast_target->getID();
 	}
@@ -1232,7 +1232,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	// Check if it's in the trash.
 	bool is_in_trash = false;
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+	if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 	{
 		is_in_trash = true;
 		remove_from_inventory = TRUE;
@@ -1290,7 +1290,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 	pack_permissions_slam(msg, item->getFlags(), item->getPermissions());
 
 	LLUUID folder_id = item->getParentUUID();
-	if((SOURCE_LIBRARY == mSource) || (is_in_trash))
+	if ((SOURCE_LIBRARY == mSource) || (is_in_trash))
 	{
 		// since it's coming from the library or trash, we want to not
 		// 'take' it back to the same place.
@@ -1324,7 +1324,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 		gViewerWindow->getWindow()->incBusyCount();
 	}
 
-	if(remove_from_inventory)
+	if (remove_from_inventory)
 	{
 		// Delete it from inventory immediately so that users cannot
 		// easily bypass copy protection in laggy situations. If the
@@ -1350,7 +1350,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 {
 	// *HACK: In order to resolve SL-22177, we need to block drags
 	// from notecards and objects onto other objects.
-	if((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
+	if ((SOURCE_WORLD == LLToolDragAndDrop::getInstance()->mSource)
 	   || (SOURCE_NOTECARD == LLToolDragAndDrop::getInstance()->mSource))
 	{
 		llwarns << "Call to LLToolDragAndDrop::dropInventory() from world"
@@ -1362,9 +1362,9 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 	time_t creation_date = time_corrected();
 	new_item->setCreationDate(creation_date);
 
-	if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
-		if(SOURCE_AGENT == source)
+		if (SOURCE_AGENT == source)
 		{
 			// Remove the inventory item from local inventory. The
 			// server will actually remove the item from agent
@@ -1372,13 +1372,13 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 			gInventory.deleteObject(item->getUUID());
 			gInventory.notifyObservers();
 		}
-		else if(SOURCE_WORLD == source)
+		else if (SOURCE_WORLD == source)
 		{
 			// *FIX: if the objects are in different regions, and the
 			// source region has crashed, you can bypass these
 			// permissions.
 			LLViewerObject* src_obj = gObjectList.findObject(src_id);
-			if(src_obj)
+			if (src_obj)
 			{
 				src_obj->removeInventory(item->getUUID());
 			}
@@ -1411,11 +1411,11 @@ void LLToolDragAndDrop::giveInventory(const LLUUID& to_agent,
 									  
 {
 	llinfos << "LLToolDragAndDrop::giveInventory()" << llendl;
-	if(!isInventoryGiveAcceptable(item))
+	if (!isInventoryGiveAcceptable(item))
 	{
 		return;
 	}
-	if(item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		// just give it away.
 		LLToolDragAndDrop::commitGiveInventoryItem(to_agent, item, im_session_id);
@@ -1439,7 +1439,7 @@ bool LLToolDragAndDrop::handleCopyProtectedItem(const LLSD& notification, const
 	{
 	case 0:  // "Yes"
 		item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
-		if(item)
+		if (item)
 		{
 			LLToolDragAndDrop::commitGiveInventoryItem(notification["payload"]["agent_id"].asUUID(),
 													   item);
@@ -1466,7 +1466,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
 												LLInventoryItem* item,
 												const LLUUID& im_session_id)
 {
-	if(!item) return;
+	if (!item) return;
 	std::string name;
 	LLAgentUI::buildFullname(name);
 	LLUUID transaction_id;
@@ -1543,12 +1543,12 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 											  const LLUUID& im_session_id)
 
 {
-	if(!cat) return;
+	if (!cat) return;
 	llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
 			<< cat->getUUID() << llendl;
 
-	LLVOAvatar* my_avatar = gAgent.getAvatarObject();
-	if( !my_avatar )
+	LLVOAvatar* avatarp = gAgent.getAvatarObject();
+	if (!avatarp)
 	{
 		return;
 	}
@@ -1557,7 +1557,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 	LLViewerInventoryCategory::cat_array_t cats;
 	LLViewerInventoryItem::item_array_t items;
 	LLGiveable giveable;
-	gInventory.collectDescendentsIf(cat->getUUID(),
+	gInventory.collectDescendentsIf (cat->getUUID(),
 									cats,
 									items,
 									LLInventoryModel::EXCLUDE_TRASH,
@@ -1566,31 +1566,31 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 	bool complete = true;
 	for(S32 i = 0; i < count; ++i)
 	{
-		if(!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
+		if (!gInventory.isCategoryComplete(cats.get(i)->getUUID()))
 		{
 			complete = false;
 			break;
 		}
 	}
-	if(!complete)
+	if (!complete)
 	{
 		LLNotificationsUtil::add("IncompleteInventory");
 		return;
 	}
  	count = items.count() + cats.count();
- 	if(count > MAX_ITEMS)
+ 	if (count > MAX_ITEMS)
   	{
 		LLNotificationsUtil::add("TooManyItems");
   		return;
   	}
- 	else if(count == 0)
+ 	else if (count == 0)
   	{
 		LLNotificationsUtil::add("NoItems");
   		return;
   	}
 	else
 	{
-		if(0 == giveable.countNoCopy())
+		if (0 == giveable.countNoCopy())
 		{
 			LLToolDragAndDrop::commitGiveInventoryCategory(to_agent, cat, im_session_id);
 		}
@@ -1616,14 +1616,14 @@ bool LLToolDragAndDrop::handleCopyProtectedCategory(const LLSD& notification, co
 	{
 	case 0:  // "Yes"
 		cat = gInventory.getCategory(notification["payload"]["folder_id"].asUUID());
-		if(cat)
+		if (cat)
 		{
 			LLToolDragAndDrop::commitGiveInventoryCategory(notification["payload"]["agent_id"].asUUID(),
 														   cat);
 			LLViewerInventoryCategory::cat_array_t cats;
 			LLViewerInventoryItem::item_array_t items;
 			LLUncopyableItems remove;
-			gInventory.collectDescendentsIf(cat->getUUID(),
+			gInventory.collectDescendentsIf (cat->getUUID(),
 											cats,
 											items,
 											LLInventoryModel::EXCLUDE_TRASH,
@@ -1654,7 +1654,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 													const LLUUID& im_session_id)
 
 {
-	if(!cat) return;
+	if (!cat) return;
 	llinfos << "LLToolDragAndDrop::commitGiveInventoryCategory() - "
 			<< cat->getUUID() << llendl;
 
@@ -1665,7 +1665,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 	LLViewerInventoryCategory::cat_array_t cats;
 	LLViewerInventoryItem::item_array_t items;
 	LLGiveable giveable;
-	gInventory.collectDescendentsIf(cat->getUUID(),
+	gInventory.collectDescendentsIf (cat->getUUID(),
 									cats,
 									items,
 									LLInventoryModel::EXCLUDE_TRASH,
@@ -1675,12 +1675,12 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 	// MTUBYTES or 18 * count < 1200 => count < 1200/18 =>
 	// 66. I've cut it down a bit from there to give some pad.
  	S32 count = items.count() + cats.count();
- 	if(count > MAX_ITEMS)
+ 	if (count > MAX_ITEMS)
   	{
 		LLNotificationsUtil::add("TooManyItems");
   		return;
   	}
- 	else if(count == 0)
+ 	else if (count == 0)
   	{
 		LLNotificationsUtil::add("NoItems");
   		return;
@@ -1754,19 +1754,19 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 // static
 BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
 {
-	if(!item)
+	if (!item)
 	{
 		return FALSE;
 	}
-	if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
 	{
 		return FALSE;
 	}
 	BOOL copyable = FALSE;
-	if(item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
+	if (item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
 
-	LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
-	if(!my_avatar)
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp)
 	{
 		return FALSE;
 	}
@@ -1775,14 +1775,14 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if(my_avatar->isWearingAttachment(item->getUUID()))
+		if (avatarp->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
 		break;
 	case LLAssetType::AT_BODYPART:
 	case LLAssetType::AT_CLOTHING:
-		if(!copyable && gAgentWearables.isWearingItem(item->getUUID()))
+		if (!copyable && gAgentWearables.isWearingItem(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1796,24 +1796,24 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
 // Static
 BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
 {
-	if(!item)
+	if (!item)
 	{
 		return FALSE;
 	}
 
 	// These permissions are double checked in the simulator in
 	// LLGroupNoticeInventoryItemFetch::result().
-	if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
 	{
 		return FALSE;
 	}
-	if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		return FALSE;
 	}
 
-	LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
-	if(!my_avatar)
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp)
 	{
 		return FALSE;
 	}
@@ -1822,7 +1822,7 @@ BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if(my_avatar->isWearingAttachment(item->getUUID()))
+		if (avatarp->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1848,7 +1848,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	// help make sure that drops that are from an object to an object
 	// don't have to worry about order of evaluation. Think of this
 	// like check for self in assignment.
-	if(obj->getID() == item->getParentUUID())
+	if (obj->getID() == item->getParentUUID())
 	{
 		return ACCEPT_NO;
 	}
@@ -1857,19 +1857,19 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	//							  gAgent.getGroupID())
 	//			 && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
 	BOOL worn = FALSE;
-	LLVOAvatarSelf* my_avatar = NULL;
+	LLVOAvatarSelf* avatarp = NULL;
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		my_avatar = gAgent.getAvatarObject();
-		if(my_avatar && my_avatar->isWearingAttachment(item->getUUID()))
+		avatarp = gAgent.getAvatarObject();
+		if (avatarp && avatarp->isWearingAttachment(item->getUUID()))
 		{
 				worn = TRUE;
 		}
 		break;
 	case LLAssetType::AT_BODYPART:
 	case LLAssetType::AT_CLOTHING:
-		if(gAgentWearables.isWearingItem(item->getUUID()))
+		if (gAgentWearables.isWearingItem(item->getUUID()))
 		{
 			worn = TRUE;
 		}
@@ -1880,7 +1880,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	const LLPermissions& perm = item->getPermissions();
 	BOOL modify = (obj->permModify() || obj->flagAllowInventoryAdd());
 	BOOL transfer = FALSE;
-	if((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
+	if ((obj->permYouOwner() && (perm.getOwner() == gAgent.getID()))
 	   || perm.allowOperationBy(PERM_TRANSFER, gAgent.getID()))
 	{
 		transfer = TRUE;
@@ -1888,15 +1888,15 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	BOOL volume = (LL_PCODE_VOLUME == obj->getPCode());
 	BOOL attached = obj->isAttachment();
 	BOOL unrestricted = ((perm.getMaskBase() & PERM_ITEM_UNRESTRICTED) == PERM_ITEM_UNRESTRICTED) ? TRUE : FALSE;
-	if(attached && !unrestricted)
+	if (attached && !unrestricted)
 	{
 		return ACCEPT_NO_LOCKED;
 	}
-	else if(modify && transfer && volume && !worn)
+	else if (modify && transfer && volume && !worn)
 	{
 		return ACCEPT_YES_MULTI;
 	}
-	else if(!modify)
+	else if (!modify)
 	{
 		return ACCEPT_NO_LOCKED;
 	}
@@ -1927,12 +1927,12 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
 	case DAD_CALLINGCARD:
 	{
 		LLViewerInventoryItem* inv_item = (LLViewerInventoryItem*)cargo_data;
-		if(gInventory.getItem(inv_item->getUUID())
+		if (gInventory.getItem(inv_item->getUUID())
 		   && LLToolDragAndDrop::isInventoryGiveAcceptable(inv_item))
 		{
 			// *TODO: get multiple object transfers working
 			*accept = ACCEPT_YES_COPY_SINGLE;
-			if(drop)
+			if (drop)
 			{
 				LLToolDragAndDrop::giveInventory(dest_agent, inv_item, session_id);
 			}
@@ -1950,11 +1950,11 @@ bool LLToolDragAndDrop::handleGiveDragAndDrop(LLUUID dest_agent, LLUUID session_
 	case DAD_CATEGORY:
 	{
 		LLViewerInventoryCategory* inv_cat = (LLViewerInventoryCategory*)cargo_data;
-		if( gInventory.getCategory( inv_cat->getUUID() ) )
+		if (gInventory.getCategory(inv_cat->getUUID()))
 		{
 			// *TODO: get multiple object transfers working
 			*accept = ACCEPT_YES_COPY_SINGLE;
-			if(drop)
+			if (drop)
 			{
 				LLToolDragAndDrop::giveInventoryCategory(dest_agent, inv_cat, session_id);
 			}
@@ -1995,7 +1995,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
 {
 	lldebugs << "LLToolDragAndDrop::dad3dRezAttachmentFromInv()" << llendl;
 	// must be in the user's inventory
-	if(mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
+	if (mSource != SOURCE_AGENT && mSource != SOURCE_LIBRARY)
 	{
 		return ACCEPT_NO;
 	}
@@ -2003,25 +2003,25 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
 	// must not be in the trash
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+	if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 	{
 		return ACCEPT_NO;
 	}
 
 	// must not be already wearing it
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(!avatarp || avatarp->isWearingAttachment(item->getUUID()) )
+	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
 
-	if( drop )
+	if (drop)
 	{
-		if(mSource == SOURCE_LIBRARY)
+		if (mSource == SOURCE_LIBRARY)
 		{
 			LLPointer<LLInventoryCallback> cb = new RezAttachmentCallback(0);
 			copy_inventory_item(
@@ -2053,10 +2053,10 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
-	if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2081,7 +2081,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 
 	// check if the item can be copied. If not, send that to the sim
 	// which will remove the inventory item.
-	if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		accept = ACCEPT_YES_SINGLE;
 		remove_inventory = TRUE;
@@ -2089,13 +2089,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 
 	// Check if it's in the trash.
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+	if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 	{
 		accept = ACCEPT_YES_SINGLE;
 		remove_inventory = TRUE;
 	}
 
-	if(drop)
+	if (drop)
 	{
 		dropObject(obj, TRUE, FALSE, remove_inventory);
 	}
@@ -2116,24 +2116,24 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
-	LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
-	if( !my_avatar || my_avatar->isWearingAttachment( item->getUUID() ) )
+	if (!item || !item->isComplete()) return ACCEPT_NO;
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
 
-	if((mask & MASK_CONTROL))
+	if ((mask & MASK_CONTROL))
 	{
 		// *HACK: In order to resolve SL-22177, we need to block drags
 		// from notecards and objects onto other objects.
-		if(mSource == SOURCE_NOTECARD)
+		if (mSource == SOURCE_NOTECARD)
 		{
 			return ACCEPT_NO;
 		}
 
 		EAcceptance rv = willObjectAcceptInventory(obj, item);
-		if(drop && (ACCEPT_YES_SINGLE <= rv))
+		if (drop && (ACCEPT_YES_SINGLE <= rv))
 		{
 			dropInventory(obj, item, mSource, mSourceID);
 		}
@@ -2159,7 +2159,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 	
 	// check if the item can be copied. If not, send that to the sim
 	// which will remove the inventory item.
-	if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		accept = ACCEPT_YES_SINGLE;
 		remove_inventory = TRUE;
@@ -2167,13 +2167,13 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 
 	// Check if it's in the trash.
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	if(gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
+	if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 	{
 		accept = ACCEPT_YES_SINGLE;
 		remove_inventory = TRUE;
 	}
 
-	if(drop)
+	if (drop)
 	{
 		dropObject(obj, FALSE, FALSE, remove_inventory);
 	}
@@ -2188,7 +2188,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
 
 	// *HACK: In order to resolve SL-22177, we need to block drags
 	// from notecards and objects onto other objects.
-	if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+	if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
 	{
 		return ACCEPT_NO;
 	}
@@ -2196,9 +2196,9 @@ EAcceptance LLToolDragAndDrop::dad3dRezScript(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	EAcceptance rv = willObjectAcceptInventory(obj, item);
-	if(drop && (ACCEPT_YES_SINGLE <= rv))
+	if (drop && (ACCEPT_YES_SINGLE <= rv))
 	{
 		// rez in the script active by default, rez in inactive if the
 		// control key is being held down.
@@ -2226,7 +2226,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
 
 	// *HACK: In order to resolve SL-22177, we need to block drags
 	// from notecards and objects onto other objects.
-	if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+	if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
 	{
 		return ACCEPT_NO;
 	}
@@ -2234,29 +2234,29 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	EAcceptance rv = willObjectAcceptInventory(obj, item);
-	if((mask & MASK_CONTROL))
+	if ((mask & MASK_CONTROL))
 	{
-		if((ACCEPT_YES_SINGLE <= rv) && drop)
+		if ((ACCEPT_YES_SINGLE <= rv) && drop)
 		{
 			dropInventory(obj, item, mSource, mSourceID);
 		}
 		return rv;
 	}
-	if(!obj->permModify())
+	if (!obj->permModify())
 	{
 		return ACCEPT_NO_LOCKED;
 	}
 	//If texture !copyable don't texture or you'll never get it back.
-	if(!item->getPermissions().allowCopyBy(gAgent.getID()))
+	if (!item->getPermissions().allowCopyBy(gAgent.getID()))
 	{
 		return ACCEPT_NO;
 	}
 
-	if(drop && (ACCEPT_YES_SINGLE <= rv))
+	if (drop && (ACCEPT_YES_SINGLE <= rv))
 	{
-		if((mask & MASK_SHIFT))
+		if ((mask & MASK_SHIFT))
 		{
 			dropTextureAllFaces(obj, item, mSource, mSourceID);
 		}
@@ -2281,9 +2281,9 @@ EAcceptance LLToolDragAndDrop::dad3dTextureSelf(
 	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
 {
 	lldebugs << "LLToolDragAndDrop::dad3dTextureAvatar()" << llendl;
-	if(drop)
+	if (drop)
 	{
-		if( !(mask & MASK_SHIFT) )
+		if (!(mask & MASK_SHIFT))
 		{
 			dropTextureOneFaceAvatar( (LLVOAvatar*)obj, face, (LLInventoryItem*)mCargoData);
 		}
@@ -2299,18 +2299,18 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
 	{
 		// it's in the agent inventory
 		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+		if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 		{
 			return ACCEPT_NO;
 		}
 
-		if( drop )
+		if (drop)
 		{
 			// Don't wear anything until initial wearables are loaded, can
 			// destroy clothing items.
@@ -2320,7 +2320,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearItem(
 				return ACCEPT_NO;
 			}
 
-			if(mSource == SOURCE_LIBRARY)
+			if (mSource == SOURCE_LIBRARY)
 			{
 				// create item based on that one, and put it on if that
 				// was a success.
@@ -2354,21 +2354,21 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	if(mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
+	if (mSource == SOURCE_AGENT || mSource == SOURCE_LIBRARY)
 	{
 		// it's in the agent inventory
 		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		if( gInventory.isObjectDescendentOf( item->getUUID(), trash_id ) )
+		if (gInventory.isObjectDescendentOf(item->getUUID(), trash_id))
 		{
 			return ACCEPT_NO;
 		}
 
-		if( drop )
+		if (drop)
 		{
 			LLUUID item_id;
-			if(mSource == SOURCE_LIBRARY)
+			if (mSource == SOURCE_LIBRARY)
 			{
 				// create item based on that one, and put it on if that
 				// was a success.
@@ -2403,7 +2403,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* category;
 	locateInventory(item, category);
-	if(!category) return ACCEPT_NO;
+	if (!category) return ACCEPT_NO;
 
 	if (drop)
 	{
@@ -2416,24 +2416,24 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
 		}
 	}
 
-	if(mSource == SOURCE_AGENT)
+	if (mSource == SOURCE_AGENT)
 	{
 		const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-		if( gInventory.isObjectDescendentOf( category->getUUID(), trash_id ) )
+		if (gInventory.isObjectDescendentOf(category->getUUID(), trash_id))
 		{
 			return ACCEPT_NO;
 		}
 
-		if(drop)
+		if (drop)
 		{
 		    BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
 			LLAppearanceManager::instance().wearInventoryCategory(category, false, append);
 		}
 		return ACCEPT_YES_MULTI;
 	}
-	else if(mSource == SOURCE_LIBRARY)
+	else if (mSource == SOURCE_LIBRARY)
 	{
-		if(drop)
+		if (drop)
 		{
 			LLAppearanceManager::instance().wearInventoryCategory(category, true, false);
 		}
@@ -2454,7 +2454,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
 
 	// *HACK: In order to resolve SL-22177, we need to block drags
 	// from notecards and objects onto other objects.
-	if((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
+	if ((SOURCE_WORLD == mSource) || (SOURCE_NOTECARD == mSource))
 	{
 		return ACCEPT_NO;
 	}
@@ -2462,7 +2462,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 	LLViewerObject* root_object = obj;
 	if (obj && obj->getParent())
 	{
@@ -2474,7 +2474,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventory(
 	}
 
 	EAcceptance rv = willObjectAcceptInventory(root_object, item);
-	if(root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
+	if (root_object && drop && (ACCEPT_YES_COPY_SINGLE <= rv))
 	{
 		dropInventory(root_object, item, mSource, mSourceID);
 	}
@@ -2518,7 +2518,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 	LLDroppableItem droppable(!obj->permYouOwner());
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
-	gInventory.collectDescendentsIf(cat->getUUID(),
+	gInventory.collectDescendentsIf (cat->getUUID(),
 					cats,
 					items,
 					LLInventoryModel::EXCLUDE_TRASH,
@@ -2547,7 +2547,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 	{
 		const LLViewerInventoryCategory *cat = (*cat_iter);
 		rv = gInventory.isCategoryComplete(cat->getUUID()) ? ACCEPT_YES_MULTI : ACCEPT_NO;
-		if(rv < ACCEPT_YES_SINGLE)
+		if (rv < ACCEPT_YES_SINGLE)
 		{
 			lldebugs << "Category " << cat->getUUID() << "is not complete." << llendl;
 			break;
@@ -2590,7 +2590,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 		}
 		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource);
 		dropper->fetchItems(ids);
-		if(dropper->isEverythingComplete())
+		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
 		}
@@ -2615,27 +2615,27 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
 	lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryObject()" << llendl;
 
 	// item has to be in agent inventory.
-	if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+	if (mSource != SOURCE_AGENT) return ACCEPT_NO;
 
 	// find the item now.
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
-	if(!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
+	if (!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()))
 	{
 		// cannot give away no-transfer objects
 		return ACCEPT_NO;
 	}
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(avatarp && avatarp->isWearingAttachment( item->getUUID() ) )
+	if (avatarp && avatarp->isWearingAttachment(item->getUUID()))
 	{
 		// You can't give objects that are attached to you
 		return ACCEPT_NO;
 	}
-	if(obj && avatarp)
+	if (obj && avatarp)
 	{
-		if(drop)
+		if (drop)
 		{
 			giveInventory(obj->getID(), item );
 		}
@@ -2652,16 +2652,16 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventory(
 {
 	lldebugs << "LLToolDragAndDrop::dad3dGiveInventory()" << llendl;
 	// item has to be in agent inventory.
-	if(mSource != SOURCE_AGENT) return ACCEPT_NO;
+	if (mSource != SOURCE_AGENT) return ACCEPT_NO;
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
-	if(!isInventoryGiveAcceptable(item))
+	if (!item || !item->isComplete()) return ACCEPT_NO;
+	if (!isInventoryGiveAcceptable(item))
 	{
 		return ACCEPT_NO;
 	}
-	if(drop && obj)
+	if (drop && obj)
 	{
 		giveInventory(obj->getID(), item);
 	}
@@ -2674,12 +2674,12 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryCategory(
 	LLViewerObject* obj, S32 face, MASK mask, BOOL drop)
 {
 	lldebugs << "LLToolDragAndDrop::dad3dGiveInventoryCategory()" << llendl;
-	if(drop && obj)
+	if (drop && obj)
 	{
 		LLViewerInventoryItem* item;
 		LLViewerInventoryCategory* cat;
 		locateInventory(item, cat);
-		if(!cat) return ACCEPT_NO;
+		if (!cat) return ACCEPT_NO;
 		giveInventoryCategory(obj->getID(), cat);
 	}
 	// *TODO: deal with all the issues surrounding multi-object
@@ -2695,14 +2695,14 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnLand(
 	LLViewerInventoryItem* item = NULL;
 	LLViewerInventoryCategory* cat = NULL;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
+	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	if(!gAgent.allowOperation(PERM_COPY, item->getPermissions())
+	if (!gAgent.allowOperation(PERM_COPY, item->getPermissions())
 		|| !item->getPermissions().allowTransferTo(LLUUID::null))
 	{
 		return ACCEPT_NO_LOCKED;
 	}
-	if(drop)
+	if (drop)
 	{
 		dropObject(obj, TRUE, TRUE, FALSE);
 	}
@@ -2716,8 +2716,8 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
 	LLViewerInventoryItem* item;
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!item || !item->isComplete()) return ACCEPT_NO;
-	if((mask & MASK_CONTROL))
+	if (!item || !item->isComplete()) return ACCEPT_NO;
+	if ((mask & MASK_CONTROL))
 	{
 		// *HACK: In order to resolve SL-22177, we need to block drags
 		// from notecards and objects onto other objects.
@@ -2725,19 +2725,19 @@ EAcceptance LLToolDragAndDrop::dad3dRezFromObjectOnObject(
 
 		// *HACK: uncomment this when appropriate
 		//EAcceptance rv = willObjectAcceptInventory(obj, item);
-		//if(drop && (ACCEPT_YES_SINGLE <= rv))
+		//if (drop && (ACCEPT_YES_SINGLE <= rv))
 		//{
 		//	dropInventory(obj, item, mSource, mSourceID);
 		//}
 		//return rv;
 	}
-	if(!item->getPermissions().allowCopyBy(gAgent.getID(),
+	if (!item->getPermissions().allowCopyBy(gAgent.getID(),
 										   gAgent.getGroupID())
 	   || !item->getPermissions().allowTransferTo(LLUUID::null))
 	{
 		return ACCEPT_NO_LOCKED;
 	}
-	if(drop)
+	if (drop)
 	{
 		dropObject(obj, FALSE, TRUE, FALSE);
 	}
@@ -2753,23 +2753,23 @@ EAcceptance LLToolDragAndDrop::dad3dCategoryOnLand(
 	LLInventoryItem* item;
 	LLInventoryCategory* cat;
 	locateInventory(item, cat);
-	if(!cat) return ACCEPT_NO;
+	if (!cat) return ACCEPT_NO;
 	EAcceptance rv = ACCEPT_NO;
 
 	// find all the items in the category
 	LLViewerInventoryCategory::cat_array_t cats;
 	LLViewerInventoryItem::item_array_t items;
 	LLDropCopyableItems droppable;
-	gInventory.collectDescendentsIf(cat->getUUID(),
+	gInventory.collectDescendentsIf (cat->getUUID(),
 									cats,
 									items,
 									LLInventoryModel::EXCLUDE_TRASH,
 									droppable);
-	if(items.count() > 0)
+	if (items.count() > 0)
 	{
 		rv = ACCEPT_YES_SINGLE;
 	}
-	if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+	if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
 	{
 		createContainer(items, cat->getName());
 		return ACCEPT_NO;
@@ -2792,19 +2792,19 @@ EAcceptance LLToolDragAndDrop::dad3dAssetOnLand(
 	LLViewerInventoryItem::item_array_t items;
 	LLViewerInventoryItem::item_array_t copyable_items;
 	locateMultipleInventory(items, cats);
-	if(!items.count()) return ACCEPT_NO;
+	if (!items.count()) return ACCEPT_NO;
 	EAcceptance rv = ACCEPT_NO;
 	for (S32 i = 0; i < items.count(); i++)
 	{
 		LLInventoryItem* item = items[i];
-		if(item->getPermissions().allowCopyBy(gAgent.getID()))
+		if (item->getPermissions().allowCopyBy(gAgent.getID()))
 		{
 			copyable_items.put(item);
 			rv = ACCEPT_YES_SINGLE;
 		}
 	}
 
-	if((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
+	if ((rv >= ACCEPT_YES_COPY_SINGLE) && drop)
 	{
 		createContainer(copyable_items, NULL);
 	}
@@ -2819,20 +2819,20 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 {
 	item = NULL;
 	cat = NULL;
-	if(mCargoIDs.empty()) return NULL;
-	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+	if (mCargoIDs.empty()) return NULL;
+	if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
 	{
 		// The object should be in user inventory.
 		item = (LLViewerInventoryItem*)gInventory.getItem(mCargoIDs[mCurItemIndex]);
 		cat = (LLViewerInventoryCategory*)gInventory.getCategory(mCargoIDs[mCurItemIndex]);
 	}
-	else if(mSource == SOURCE_WORLD)
+	else if (mSource == SOURCE_WORLD)
 	{
 		// This object is in some task inventory somewhere.
 		LLViewerObject* obj = gObjectList.findObject(mSourceID);
-		if(obj)
+		if (obj)
 		{
-			if((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
+			if ((mCargoTypes[mCurItemIndex] == DAD_CATEGORY)
 			   || (mCargoTypes[mCurItemIndex] == DAD_ROOT_CATEGORY))
 			{
 				cat = (LLViewerInventoryCategory*)obj->getInventoryObject(mCargoIDs[mCurItemIndex]);
@@ -2843,16 +2843,16 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 			}
 		}
 	}
-	else if(mSource == SOURCE_NOTECARD)
+	else if (mSource == SOURCE_NOTECARD)
 	{
 		LLPreviewNotecard* preview = LLFloaterReg::findTypedInstance<LLPreviewNotecard>("preview_notecard", mSourceID);
-		if(preview)
+		if (preview)
 		{
 			item = (LLViewerInventoryItem*)preview->getDragItem();
 		}
 	}
-	if(item) return item;
-	if(cat) return cat;
+	if (item) return item;
+	if (cat) return cat;
 	return NULL;
 }
 
@@ -2860,8 +2860,8 @@ LLInventoryObject* LLToolDragAndDrop::locateInventory(
 LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryCategory::cat_array_t& cats,
 															  LLViewerInventoryItem::item_array_t& items)
 {
-	if(mCargoIDs.count() == 0) return NULL;
-	if((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
+	if (mCargoIDs.count() == 0) return NULL;
+	if ((mSource == SOURCE_AGENT) || (mSource == SOURCE_LIBRARY))
 	{
 		// The object should be in user inventory.
 		for (S32 i = 0; i < mCargoIDs.count(); i++)
@@ -2878,13 +2878,13 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
 			}
 		}
 	}
-	else if(mSource == SOURCE_WORLD)
+	else if (mSource == SOURCE_WORLD)
 	{
 		// This object is in some task inventory somewhere.
 		LLViewerObject* obj = gObjectList.findObject(mSourceID);
-		if(obj)
+		if (obj)
 		{
-			if((mCargoType == DAD_CATEGORY)
+			if ((mCargoType == DAD_CATEGORY)
 			   || (mCargoType == DAD_ROOT_CATEGORY))
 			{
 				// The object should be in user inventory.
@@ -2910,17 +2910,17 @@ LLInventoryObject* LLToolDragAndDrop::locateMultipleInventory(LLViewerInventoryC
 			}
 		}
 	}
-	else if(mSource == SOURCE_NOTECARD)
+	else if (mSource == SOURCE_NOTECARD)
 	{
 		LLPreviewNotecard* card;
 		card = (LLPreviewNotecard*)LLPreview::find(mSourceID);
-		if(card)
+		if (card)
 		{
 			items.put((LLInventoryItem*)card->getDragItem());
 		}
 	}
-	if(items.count()) return items[0];
-	if(cats.count()) return cats[0];
+	if (items.count()) return items[0];
+	if (cats.count()) return cats[0];
 	return NULL;
 }
 */
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index c2a78f20e1..7b52724e8e 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4117,7 +4117,7 @@ void process_avatar_appearance(LLMessageSystem *mesgsys, void **user_data)
 	mesgsys->getUUIDFast(_PREHASH_Sender, _PREHASH_ID, uuid);
 
 	LLVOAvatar* avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
-	if( avatarp )
+	if (avatarp)
 	{
 		avatarp->processAvatarAppearance( mesgsys );
 	}
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 15be6b23b3..0243130e12 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -777,7 +777,8 @@ void LLVOAvatarSelf::removeMissingBakedTextures()
 //virtual
 void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
 {
-	if (regionp->getHandle() != mLastRegionHandle)
+	setRegion(regionp);
+	if (!regionp || (regionp->getHandle() != mLastRegionHandle))
 	{
 		if (mLastRegionHandle != 0)
 		{
@@ -791,7 +792,10 @@ void LLVOAvatarSelf::updateRegion(LLViewerRegion *regionp)
 			max = llmax(delta, max);
 			LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max);
 		}
-		mLastRegionHandle = regionp->getHandle();
+		if (regionp)
+		{
+			mLastRegionHandle = regionp->getHandle();
+		}
 	}
 	mRegionCrossingTimer.reset();
 }
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 589099673d..de2d049382 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -647,7 +647,7 @@ void LLWearable::writeToAvatar()
 {
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	llassert(avatarp);
-	if(!avatarp)
+	if (!avatarp)
 	{
 		llerrs << "could not get avatar object to write to for wearable " << this->getName() << llendl;
 		return;
@@ -709,7 +709,7 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 {
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	llassert(avatarp);
-	if(!avatarp)
+	if (!avatarp)
 	{
 		return;
 	}
@@ -753,7 +753,7 @@ void LLWearable::copyDataFrom(const LLWearable* src)
 {
 	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	llassert(avatarp);
-	if(!avatarp)
+	if (!avatarp)
 	{
 		return;
 	}
-- 
cgit v1.2.3


From aebfa2f6f30cbfeb3f3297c5da7fbf67c571f8b8 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 26 Mar 2010 20:22:52 +0200
Subject: Fixed normal bug EXT-6353 (SLapp chat cannot chat spaces). Reviewed
 by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/119/

--HG--
branch : product-engine
---
 indra/newview/llnearbychatbar.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index af711b6943..9de1ffddc8 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -807,8 +807,11 @@ public:
 	{
 		if (tokens.size() < 2) return false;
 		S32 channel = tokens[0].asInteger();
-		std::string mesg = tokens[1].asString();
-		send_chat_from_viewer(mesg, CHAT_TYPE_NORMAL, channel);
+
+		// Send unescaped message, see EXT-6353.
+		std::string unescaped_mesg (LLURI::unescape(tokens[1].asString()));
+
+		send_chat_from_viewer(unescaped_mesg, CHAT_TYPE_NORMAL, channel);
 		return true;
 	}
 };
-- 
cgit v1.2.3


From 46fe5d49caef6c8db3df9d88f0d0ec773ef28095 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 26 Mar 2010 14:33:48 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Superficial cleanup so that all instances of gAgent.getAvatarObject() use "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject".
---
 indra/newview/llagentui.cpp            |  3 +-
 indra/newview/llagentwearables.cpp     |  3 +-
 indra/newview/lldriverparam.cpp        | 15 ++++----
 indra/newview/llgesturemgr.cpp         | 12 +++----
 indra/newview/llinventorybridge.cpp    |  9 ++---
 indra/newview/llinventoryfunctions.cpp |  4 +--
 indra/newview/llinventorymodel.cpp     |  5 ++-
 indra/newview/llinventorypanel.cpp     |  2 +-
 indra/newview/llmorphview.cpp          | 10 +++---
 indra/newview/llpreviewanim.cpp        | 17 ++++-----
 indra/newview/llselectmgr.cpp          | 15 ++++----
 indra/newview/lltooldraganddrop.cpp    |  2 +-
 indra/newview/lltoolfocus.cpp          |  7 ++--
 indra/newview/lltoolpie.cpp            | 24 +++++++------
 indra/newview/llviewerdisplay.cpp      |  6 ++--
 indra/newview/llviewerkeyboard.cpp     |  3 +-
 indra/newview/llviewermenu.cpp         | 14 ++++----
 indra/newview/llviewermessage.cpp      |  6 ++--
 indra/newview/llvoavatar.cpp           | 22 ++++++------
 indra/newview/llvoavatarself.cpp       | 14 ++++----
 indra/newview/llwearable.cpp           | 65 ++++++++++++++--------------------
 21 files changed, 126 insertions(+), 132 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 4601e3241b..97e956c082 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -73,7 +73,8 @@ void LLAgentUI::buildName(std::string& name)
 //static
 void LLAgentUI::buildFullname(std::string& name)
 {
-	if (gAgent.getAvatarObject()) name = gAgent.getAvatarObject()->getFullname();
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+	if (avatarp) name = avatarp->getFullname();
 }
 
 //static
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index c673e82d5f..aec8c6e403 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -485,7 +485,8 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
 			return;
 		}
 
-		gAgent.getAvatarObject()->wearableUpdated( type, TRUE );
+		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+		avatarp->wearableUpdated( type, TRUE );
 
 		if (send_update)
 		{
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 830e975e8a..c22c9d3048 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -118,13 +118,13 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 
 	out << std::endl;
 
-	LLVOAvatarSelf *avatar = gAgent.getAvatarObject();
-	if(avatar)
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+	if(avatarp)
 	{
 		for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
 		{
 			LLDrivenEntryInfo driven = *iter;
-			LLViewerVisualParam *param = (LLViewerVisualParam*)avatar->getVisualParam(driven.mDrivenID);
+			LLViewerVisualParam *param = (LLViewerVisualParam*)avatarp->getVisualParam(driven.mDrivenID);
 			if (param)
 			{
 				param->getInfo()->toStream(out);
@@ -146,7 +146,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 			}
 			else
 			{
-				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatar << " for driver parameter " << getID() << llendl;
+				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatarp << " for driver parameter " << getID() << llendl;
 			}
 			out << std::endl;
 		}
@@ -626,13 +626,14 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
 
 void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
 {
-	LLVOAvatarSelf *avatar_self = gAgent.getAvatarObject();
-	if(mWearablep && 
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+	if(avatarp &&
+	   mWearablep && 
 	   driven->mParam->getCrossWearable() &&
 	   mWearablep->isOnTop())
 	{
 		// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
-		avatar_self->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
+		avatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
 	}
 	else
 	{
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 0ba7bdf613..47a9961323 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -746,8 +746,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 	{
 		return;
 	}
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if (!avatar) return;
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp) return;
 
 	// Of the ones that started playing, have any stopped?
 
@@ -758,8 +758,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 	{
 		// look in signaled animations (simulator's view of what is
 		// currently playing.
-		LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it);
-		if (play_it != avatar->mSignaledAnimations.end())
+		LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it);
+		if (play_it != avatarp->mSignaledAnimations.end())
 		{
 			++gest_it;
 		}
@@ -777,8 +777,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 		 gest_it != gesture->mRequestedAnimIDs.end();
 		 )
 	{
-	 LLVOAvatar::AnimIterator play_it = avatar->mSignaledAnimations.find(*gest_it);
-		if (play_it != avatar->mSignaledAnimations.end())
+	 LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it);
+		if (play_it != avatarp->mSignaledAnimations.end())
 		{
 			// Hooray, this animation has started playing!
 			// Copy into playing.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2d544f53f4..08734137b6 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4177,8 +4177,9 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	S32 attach_pt = 0;
 	if (gAgent.getAvatarObject() && attachment)
 	{
-		for (LLVOAvatar::attachment_map_t::iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
-			 iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
+			 iter != avatarp->mAttachmentPoints.end(); ++iter)
 		{
 			if (iter->second == attachment)
 			{
@@ -4204,7 +4205,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 
 bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
 {
-	LLVOAvatar *avatarp = gAgent.getAvatarObject();
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 
 	if (!avatarp->canAttachMoreObjects())
 	{
@@ -4296,7 +4297,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				}
 				LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
 				LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
-				LLVOAvatar *avatarp = gAgent.getAvatarObject();
+				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 				if (attach_menu
 					&& (attach_menu->getChildCount() == 0)
 					&& attach_hud_menu
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 3553137f53..d3e2a2f555 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -352,8 +352,8 @@ BOOL get_is_item_worn(const LLUUID& id)
 	{
 		case LLAssetType::AT_OBJECT:
 		{
-			const LLVOAvatarSelf* my_avatar = gAgent.getAvatarObject();
-			if(my_avatar && my_avatar->isWearingAttachment(item->getLinkedUUID()))
+			const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+			if(avatarp && avatarp->isWearingAttachment(item->getLinkedUUID()))
 				return TRUE;
 			break;
 		}
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 83a466a243..1f9840923c 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3774,7 +3774,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 		return false;
 
 	bool allowed = false;
-	LLVOAvatarSelf* my_avatar = NULL;
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	switch(item->getType())
 	{
@@ -3783,8 +3783,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 		break;
 		
 	case LLAssetType::AT_OBJECT:
-		my_avatar = gAgent.getAvatarObject();
-		if(my_avatar && !my_avatar->isWearingAttachment(item->getUUID()))
+		if(avatarp && !avatarp->isWearingAttachment(item->getUUID()))
 		{
 			allowed = true;
 		}
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d7720b735c..2a8306f232 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -871,7 +871,7 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata)
 	mFolders->getSelectionList(selected_items);
 
 	std::string joint_name = userdata.asString();
-	LLVOAvatar *avatarp = static_cast<LLVOAvatar*>(gAgent.getAvatarObject());
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	LLViewerJointAttachment* attachmentp = NULL;
 	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
 		 iter != avatarp->mAttachmentPoints.end(); )
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index 28da9a2b90..cb48db15e4 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -89,7 +89,7 @@ void	LLMorphView::initialize()
 	mCameraYaw = 0.f;
 	mCameraDist = -1.f;
 
-	LLVOAvatar *avatarp = gAgent.getAvatarObject();
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	if (!avatarp || avatarp->isDead())
 	{
 		gAgentCamera.changeCameraToDefault();
@@ -111,7 +111,7 @@ void	LLMorphView::shutdown()
 {
 	LLVOAvatarSelf::onCustomizeEnd();
 
-	LLVOAvatar *avatarp = gAgent.getAvatarObject();
+	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	if (avatarp && !avatarp->isDead())
 	{
 		avatarp->startMotion( ANIM_AGENT_BODY_NOISE );
@@ -167,12 +167,12 @@ void LLMorphView::updateCamera()
 		setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead"));
 	}
 	
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if( !avatar )
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp)
 	{
 		return;
 	}
-	LLJoint* root_joint = avatar->getRootJoint();
+	LLJoint* root_joint = avatarp->getRootJoint();
 	if( !root_joint )
 	{
 		return;
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 0cc747f789..49b297f702 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -110,6 +110,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 {
 	LLPreviewAnim* self = (LLPreviewAnim*) userdata;
 	const LLInventoryItem *item = self->getItem();
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	if(item)
 	{
@@ -125,10 +126,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		{
 			self->mPauseRequest = NULL;
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
-			
-			LLVOAvatar* avatar = gAgent.getAvatarObject();
-			LLMotion*   motion = avatar->findMotion(itemID);
-			
+			LLMotion* motion = avatarp->findMotion(itemID);
 			if (motion)
 			{
 				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
@@ -136,7 +134,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		}
 		else
 		{
-			gAgent.getAvatarObject()->stopMotion(itemID);
+			avatarp->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
@@ -161,10 +159,9 @@ void LLPreviewAnim::auditionAnim( void *userdata )
 		if (self->childGetValue("Anim audition btn").asBoolean() ) 
 		{
 			self->mPauseRequest = NULL;
+			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 			gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
-			
-			LLVOAvatar* avatar = gAgent.getAvatarObject();
-			LLMotion*   motion = avatar->findMotion(itemID);
+			LLMotion* motion = avatarp->findMotion(itemID);
 			
 			if (motion)
 			{
@@ -189,8 +186,8 @@ void LLPreviewAnim::onClose(bool app_quitting)
 		gAgent.getAvatarObject()->stopMotion(item->getAssetUUID());
 		gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
 					
-		LLVOAvatar* avatar = gAgent.getAvatarObject();
-		LLMotion*   motion = avatar->findMotion(item->getAssetUUID());
+		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+		LLMotion* motion = avatarp->findMotion(item->getAssetUUID());
 		
 		if (motion)
 		{
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index d744f097d5..69f9a7e6fa 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -4911,10 +4911,10 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 	LLGLEnable blend(GL_BLEND);
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
 
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if (for_hud && avatar)
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (avatarp && for_hud)
 	{
-		LLBBox hud_bbox = avatar->getHUDBBox();
+		LLBBox hud_bbox = avatarp->getHUDBBox();
 
 		F32 cur_zoom = gAgentCamera.mHUDCurZoom;
 
@@ -5023,7 +5023,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 		}
 	}
 
-	if (for_hud && avatar)
+	if (avatarp && for_hud)
 	{
 		glMatrixMode(GL_PROJECTION);
 		gGL.popMatrix();
@@ -5399,7 +5399,8 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 	if (volume)
 	{
 		F32 silhouette_thickness;
-		if (is_hud_object && gAgent.getAvatarObject())
+		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+		if (avatarp && is_hud_object)
 		{
 			silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom;
 		}
@@ -5641,10 +5642,10 @@ void LLSelectMgr::updateSelectionCenter()
 			LLViewerObject* object = node->getObject();
 			if (!object)
 				continue;
-			LLViewerObject *myAvatar = gAgent.getAvatarObject();
+			LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 			LLViewerObject *root = object->getRootEdit();
 			if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
-				!root->isChild(myAvatar) && // not the object you're sitting on
+				!root->isChild(avatarp) && // not the object you're sitting on
 				!object->isAvatar()) // not another avatar
 			{
 				mShowSelection = TRUE;
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 0aa6b8736b..1f6f840c45 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1547,7 +1547,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 	llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
 			<< cat->getUUID() << llendl;
 
-	LLVOAvatar* avatarp = gAgent.getAvatarObject();
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	if (!avatarp)
 	{
 		return;
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 1e2e7095d8..363df74379 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -173,14 +173,13 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 		BOOL good_customize_avatar_hit = FALSE;
 		if( hit_obj )
 		{
-			LLVOAvatar* avatar = gAgent.getAvatarObject();
-			if( hit_obj == avatar) 
+			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+			if (avatarp &&(hit_obj == avatarp))
 			{
 				// It's you
 				good_customize_avatar_hit = TRUE;
 			}
-			else
-			if( hit_obj->isAttachment() && hit_obj->permYouOwner() )
+			else if (hit_obj->isAttachment() && hit_obj->permYouOwner())
 			{
 				// It's an attachment that you're wearing
 				good_customize_avatar_hit = TRUE;
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 8d4f0f9116..c80db89ef0 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -205,15 +205,16 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 			// touch behavior down below...
 			break;
 		case CLICK_ACTION_SIT:
-
-			if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // agent not already sitting
 			{
-				handle_object_sit_or_stand();
-				// put focus in world when sitting on an object
-				gFocusMgr.setKeyboardFocus(NULL);
-				return TRUE;
-			} // else nothing (fall through to touch)
-			
+				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+				if (avatarp && !avatarp->isSitting()) // agent not already sitting
+				{
+					handle_object_sit_or_stand();
+					// put focus in world when sitting on an object
+					gFocusMgr.setKeyboardFocus(NULL);
+					return TRUE;
+				} // else nothing (fall through to touch)
+			}
 		case CLICK_ACTION_PAY:
 			if ((object && object->flagTakesMoney())
 				|| (parent && parent->flagTakesMoney()))
@@ -411,9 +412,12 @@ ECursorType cursor_from_object(LLViewerObject* object)
 	switch(click_action)
 	{
 	case CLICK_ACTION_SIT:
-		if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting?
 		{
-			cursor = UI_CURSOR_TOOLSIT;
+			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+			if (avatarp && !avatarp->isSitting()) // not already sitting?
+			{
+				cursor = UI_CURSOR_TOOLSIT;
+			}
 		}
 		break;
 	case CLICK_ACTION_BUY:
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 5a2b901bd7..7bbe40a486 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -1032,11 +1032,11 @@ LLRect get_whole_screen_region()
 
 bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
 {
-	LLVOAvatar* my_avatarp = gAgent.getAvatarObject();
-	if (my_avatarp && my_avatarp->hasHUDAttachment())
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (avatarp && avatarp->hasHUDAttachment())
 	{
 		F32 zoom_level = gAgentCamera.mHUDCurZoom;
-		LLBBox hud_bbox = my_avatarp->getHUDBBox();
+		LLBBox hud_bbox = avatarp->getHUDBBox();
 		
 		F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
 		proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index cbec2c890f..00046ed3dd 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -869,6 +869,7 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename)
 
 EKeyboardMode LLViewerKeyboard::getMode()
 {
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	if ( gAgentCamera.cameraMouselook() )
 	{
 		return MODE_FIRST_PERSON;
@@ -877,7 +878,7 @@ EKeyboardMode LLViewerKeyboard::getMode()
 	{
 		return MODE_EDIT_AVATAR;
 	}
-	else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting())
+	else if (avatarp && avatarp->isSitting())
 	{
 		return MODE_SITTING;
 	}
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index d79cb85730..b8a3232c29 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -4587,13 +4587,13 @@ BOOL sitting_on_selection()
 	}
 
 	// Need to determine if avatar is sitting on this object
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if (!avatar)
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp)
 	{
 		return FALSE;
 	}
 
-	return (avatar->isSitting() && avatar->getRoot() == root_object);
+	return (avatarp->isSitting() && avatarp->getRoot() == root_object);
 }
 
 class LLToolsSaveToInventory : public view_listener_t
@@ -6489,15 +6489,15 @@ void handle_toggle_pg(void*)
 
 void handle_dump_attachments(void*)
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if( !avatar )
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if(!avatarp)
 	{
 		llinfos << "NO AVATAR" << llendl;
 		return;
 	}
 
-	for (LLVOAvatar::attachment_map_t::iterator iter = avatar->mAttachmentPoints.begin(); 
-		 iter != avatar->mAttachmentPoints.end(); )
+	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
+		 iter != avatarp->mAttachmentPoints.end(); )
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7b52724e8e..1ead7bac10 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4165,9 +4165,9 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	BOOL force_mouselook;
 	mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
 
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
-	if (avatar && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
+	if (avatarp && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
 	{
 		gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
 	}
@@ -4178,7 +4178,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	if (object)
 	{
 		LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
-		if (!use_autopilot || (avatar && avatar->isSitting() && avatar->getRoot() == object->getRoot()))
+		if (!use_autopilot || (avatarp && avatarp->isSitting() && avatarp->getRoot() == object->getRoot()))
 		{
 			//we're already sitting on this object, so don't autopilot
 		}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 54379dece3..bb69622135 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -965,15 +965,15 @@ void LLVOAvatar::dumpBakedStatus()
 //static
 void LLVOAvatar::restoreGL()
 {
-	LLVOAvatar* self = gAgent.getAvatarObject();
-	if (!self)
-		return;
-	self->setCompositeUpdatesEnabled(TRUE);
-	for (U32 i = 0; i < self->mBakedTextureDatas.size(); i++)
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp) return;
+
+	avatarp->setCompositeUpdatesEnabled(TRUE);
+	for (U32 i = 0; i < avatarp->mBakedTextureDatas.size(); i++)
 	{
-		self->invalidateComposite(self->mBakedTextureDatas[i].mTexLayerSet, FALSE);
+		avatarp->invalidateComposite(avatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE);
 	}
-	self->updateMeshTextures();
+	avatarp->updateMeshTextures();
 }
 
 //static
@@ -6859,8 +6859,8 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 // static
 void LLVOAvatar::dumpArchetypeXML( void* )
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	LLAPRFile outfile ;
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	LLAPRFile outfile;
 	outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB );
 	apr_file_t* file = outfile.getFileHandle() ;
 	if (!file)
@@ -6878,7 +6878,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 		const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type);
 		apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
 
-		for (LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam())
+		for (LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam())
 		{
 			LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
 			if( (viewer_param->getWearableType() == type) && 
@@ -6894,7 +6894,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 			if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type)
 			{
 				// MULTIPLE_WEARABLES: extend to multiple wearables?
-				LLViewerTexture* te_image = avatar->getImage((ETextureIndex)te, 0);
+				LLViewerTexture* te_image = ((LLVOAvatar*)avatarp)->getImage((ETextureIndex)te, 0);
 				if( te_image )
 				{
 					std::string uuid_str;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 0243130e12..e3583b4d6b 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1930,8 +1930,8 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 	LLUUID texture_id;
 	msg->getUUID("TextureData", "TextureID", texture_id);
 
-	LLVOAvatarSelf* self = gAgent.getAvatarObject();
-	if (!self) return;
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	if (!avatarp) return;
 
 	// If this is a texture corresponding to one of our baked entries, 
 	// just rebake that layer set.
@@ -1948,13 +1948,13 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 		const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
 		if (texture_dict->mIsBakedTexture)
 		{
-			if (texture_id == self->getTEImage(index)->getID())
+			if (texture_id == avatarp->getTEImage(index)->getID())
 			{
-				LLTexLayerSet* layer_set = self->getLayerSet(index);
+				LLTexLayerSet* layer_set = avatarp->getLayerSet(index);
 				if (layer_set)
 				{
 					llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
-					self->invalidateComposite(layer_set, TRUE);
+					avatarp->invalidateComposite(layer_set, TRUE);
 					found = TRUE;
 					LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
 				}
@@ -1965,12 +1965,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 	// If texture not found, rebake all entries.
 	if (!found)
 	{
-		self->forceBakeAllTextures();
+		avatarp->forceBakeAllTextures();
 	}
 	else
 	{
 		// Not sure if this is necessary, but forceBakeAllTextures() does it.
-		self->updateMeshTextures();
+		avatarp->updateMeshTextures();
 	}
 }
 
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index de2d049382..c9fe032a24 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -62,27 +62,26 @@ class LLOverrideBakedTextureUpdate
 public:
 	LLOverrideBakedTextureUpdate(bool temp_state)
 	{
-		mAvatar = gAgent.getAvatarObject();
+		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 		U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES;
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			composite_enabled[index] = mAvatar->isCompositeUpdateEnabled(index);
+			composite_enabled[index] = avatarp->isCompositeUpdateEnabled(index);
 		}
-		mAvatar->setCompositeUpdatesEnabled(temp_state);
+		avatarp->setCompositeUpdatesEnabled(temp_state);
 	}
 
 	~LLOverrideBakedTextureUpdate()
 	{
+		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 		U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES;		
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			mAvatar->setCompositeUpdatesEnabled(index, composite_enabled[index]);
-		}		
+			avatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
+		}
 	}
-
 private:
 	bool composite_enabled[LLVOAvatarDefines::BAKED_NUM_INDICES];
-	LLVOAvatarSelf *mAvatar;
 };
 
 // Private local functions
@@ -205,10 +204,10 @@ BOOL LLWearable::exportFile(LLFILE* file) const
 
 void LLWearable::createVisualParams()
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); 
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) avatar->getNextVisualParam())
+		 param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
 	{
 		if (param->getWearableType() == mType)
 		{
@@ -228,7 +227,7 @@ void LLWearable::createVisualParams()
 		param->resetDrivenParams();
 		if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
 		{
-			if( !param->linkDrivenParams(boost::bind(avatar_function,(LLVOAvatarSelf*)avatar,_1 ), true))
+			if( !param->linkDrivenParams(boost::bind(avatar_function,avatarp,_1 ), true))
 			{
 				llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
 				continue;
@@ -464,12 +463,9 @@ BOOL LLWearable::importFile( LLFILE* file )
 // since this wearable was created.
 BOOL LLWearable::isOldVersion() const
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	llassert( avatar );
-	if( !avatar )
-	{
-		return FALSE;
-	}
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	llassert(avatarp);
+	if(!avatarp) return FALSE;
 
 	if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
 	{
@@ -483,9 +479,9 @@ BOOL LLWearable::isOldVersion() const
 	}
 
 	S32 param_count = 0;
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
+		param = (LLViewerVisualParam*) avatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -531,17 +527,13 @@ BOOL LLWearable::isOldVersion() const
 // only if those values are the same as the defaults.
 BOOL LLWearable::isDirty() const
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	llassert( avatar );
-	if( !avatar )
-	{
-		return FALSE;
-	}
-
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	llassert(avatarp);
+	if(!avatarp) return FALSE;
 
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) avatar->getNextVisualParam() )
+		param = (LLViewerVisualParam*) avatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) 
 			&& (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) 
@@ -602,14 +594,11 @@ BOOL LLWearable::isDirty() const
 
 void LLWearable::setParamsToDefaults()
 {
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	llassert( avatar );
-	if( !avatar )
-	{
-		return;
-	}
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	llassert(avatarp);
+	if (!avatarp) return;
 
-	for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() )
+	for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
 	{
 		if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -1123,10 +1112,10 @@ void LLWearable::destroyTextures()
 void LLWearable::pullCrossWearableValues()
 {
 	// scan through all of the avatar's visual parameters
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatar->getFirstVisualParam(); 
+	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) avatar->getNextVisualParam())
+		 param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
 	{
 		if( param )
 		{
-- 
cgit v1.2.3


From ac141e1862e265c00d1adf6466cfad8602fc1f18 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 26 Mar 2010 20:45:04 +0200
Subject: Related to normal bug EXT-6345 (SLapp group profile does not display
 group name.) - fixed group info panel title to show "Loading..." while
 waiting for group info. Reviewed by Vadim Savchuk at
 https://codereview.productengine.com/secondlife/r/124/

--HG--
branch : product-engine
---
 indra/newview/llpanelgroup.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 706787e824..c00b6a4147 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -59,6 +59,8 @@
 #include "llaccordionctrltab.h"
 #include "llaccordionctrl.h"
 
+#include "lltrans.h"
+
 static LLRegisterPanelClassWrapper<LLPanelGroup> t_panel_group("panel_group_info_sidetray");
 
 
@@ -333,8 +335,9 @@ void LLPanelGroup::update(LLGroupChange gc)
 	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
 	if(gdatap)
 	{
-		childSetValue("group_name", gdatap->mName);
-		childSetToolTip("group_name",gdatap->mName);
+		std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
+		childSetValue("group_name", group_name);
+		childSetToolTip("group_name",group_name);
 		
 		LLGroupData agent_gdatap;
 		bool is_member = gAgent.getGroupData(mID,agent_gdatap) || gAgent.isGodlike();
@@ -379,8 +382,9 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
 	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mID);
 	if(gdatap)
 	{
-		childSetValue("group_name", gdatap->mName);
-		childSetToolTip("group_name",gdatap->mName);
+		std::string group_name =  gdatap->mName.empty() ? LLTrans::getString("LoadingData") : gdatap->mName;
+		childSetValue("group_name", group_name);
+		childSetToolTip("group_name",group_name);
 	}
 
 	LLButton* button_apply = findChild<LLButton>("btn_apply");
-- 
cgit v1.2.3


From 55f549db455f657f1d36fa72a45abfe71449f286 Mon Sep 17 00:00:00 2001
From: "Mark Palange (Mani)" <palange@lindenlab.com>
Date: Fri, 26 Mar 2010 12:52:02 -0700
Subject: EXT-6517 Now updating the location value in refreshLocation. Reviewed
 by Richard

---
 indra/newview/llpanellogin.cpp | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 7bd03167fd..ee4dcc44fe 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -679,6 +679,9 @@ void LLPanelLogin::refreshLocation( bool force_visible )
 		show_start = gSavedSettings.getBOOL("ShowStartLocation");
 	}
 
+	// Update the value of the location combo.
+	updateLocationUI();
+	
 	sInstance->childSetVisible("start_location_combo", show_start);
 	sInstance->childSetVisible("start_location_text", show_start);
 
-- 
cgit v1.2.3


From 32253813b4d885f2a62a02f55ab249bca01c6cdf Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Fri, 26 Mar 2010 17:05:29 -0400
Subject: EXT-3818 -- absolute minimal fix for Viewer 2, can be better fixed in
 2.1. Previous proposed fix caused a crash on at least one machine, too risky.

---
 indra/newview/llchathistory.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index efdfbb8d20..f5faeca126 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -646,7 +646,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 		p.left_pad = mLeftWidgetPad;
 		p.right_pad = mRightWidgetPad;
 		p.view = separator;
-		mEditor->appendWidget(p, "\n", false);
+		//mEditor->appendWidget(p, "\n", false);  // TODO: this is absolute minimal fix for EXT-3818 because it's late for 2.0
+		mEditor->appendWidget(p, "", false);      // This should be properly fixed in 2.1
 
 		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
 
-- 
cgit v1.2.3


From fe1a1a09dca545e0764442cfb5b6e6162b106c77 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 14:38:00 -0700
Subject: FR linguistic

---
 indra/newview/skins/default/xui/fr/notifications.xml | 2 +-
 indra/newview/skins/default/xui/fr/panel_places.xml  | 2 +-
 indra/newview/skins/default/xui/fr/strings.xml       | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/fr/notifications.xml b/indra/newview/skins/default/xui/fr/notifications.xml
index 0fb609d653..38c6b57f5c 100644
--- a/indra/newview/skins/default/xui/fr/notifications.xml
+++ b/indra/newview/skins/default/xui/fr/notifications.xml
@@ -178,7 +178,7 @@ Voulez-vous continuer ?
 	<notification name="JoinGroupNoCost">
 		Vous vous apprêtez à rejoindre le groupe [NAME].
 Voulez-vous continuer ?
-		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Fusionner"/>
+		<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Rejoindre"/>
 	</notification>
 	<notification name="JoinGroupCannotAfford">
 		Rejoindre ce groupe coûte [COST] L$.
diff --git a/indra/newview/skins/default/xui/fr/panel_places.xml b/indra/newview/skins/default/xui/fr/panel_places.xml
index f0c40d7e92..19b727b57b 100644
--- a/indra/newview/skins/default/xui/fr/panel_places.xml
+++ b/indra/newview/skins/default/xui/fr/panel_places.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Lieux" name="places panel">
 	<string name="landmarks_tab_title" value="MES REPÈRES"/>
-	<string name="teleport_history_tab_title" value="HISTORIQUE DES TÉLÉPORTATIONS"/>
+	<string name="teleport_history_tab_title" value="HISTORIQUE DES TP"/>
 	<filter_editor label="Filtrer les endroits" name="Filter"/>
 	<panel name="button_panel">
 		<button label="Téléporter" name="teleport_btn" tool_tip="Me téléporter jusqu&apos;à la zone sélectionnée"/>
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 9bb18b1559..7ab232672a 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -3465,13 +3465,13 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		[NAME] vous a payé [AMOUNT] L$
 	</string>
 	<string name="you_paid_ldollars">
-		Vous avez payé [NAME] [AMOUNT] L$ [REASON].
+		Vous avez payé à [AMOUNT] L$ [REASON].
 	</string>
 	<string name="you_paid_ldollars_no_reason">
-		Vous avez payé [NAME] [AMOUNT] L$.
+		Vous avez payé à [NAME] [AMOUNT] L$.
 	</string>
 	<string name="you_paid_ldollars_no_name">
-		Vous avez payé [AMOUNT] L$ [REASON].
+		Vous avez payé à [AMOUNT] L$ [REASON].
 	</string>
 	<string name="for a parcel of land">
 		pour une parcelle de terrain
-- 
cgit v1.2.3


From 4e7838fb004f67c51d1b9991ba6782be7036bd7e Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Fri, 26 Mar 2010 15:39:21 -0700
Subject: Implemented central storage mechanism for media plugin cookies.

Added LLPluginCookieStore, which manages the central list of cookies.

New Mac and Windows versions of llqtwebkit, built from the tip of the cookie-api branch on http://bitbucket.org/lindenlab/llqtwebkit/ (currently revision f35a5eab8c2f).

Added "set_cookies" and "cookie_set" messages to the media_browser message class in the plugin API, and made the webkit plugin use them appropriately.

Added methods to LLViewerMedia to read/write the cookie file and add/remove individual cookies.

Added hooks to read/write the cookie file (plugin_cookies.txt) in the same places as  the location history (idle_startup() in llstartup.cpp and LLAppViewer::cleanup(), respectively).

Reviewed by Richard at http://codereview.lindenlab.com/1006003
---
 indra/llplugin/CMakeLists.txt                      |   2 +
 indra/llplugin/llpluginclassmedia.cpp              |  14 +
 indra/llplugin/llpluginclassmedia.h                |   1 +
 indra/llplugin/llpluginclassmediaowner.h           |   2 +
 indra/llplugin/llplugincookiestore.cpp             | 600 +++++++++++++++++++++
 indra/llplugin/llplugincookiestore.h               | 122 +++++
 indra/media_plugins/webkit/media_plugin_webkit.cpp |  17 +
 indra/newview/llappviewer.cpp                      |   2 +
 indra/newview/llstartup.cpp                        |   3 +
 indra/newview/llviewermedia.cpp                    | 150 +++++-
 indra/newview/llviewermedia.h                      |  11 +
 11 files changed, 923 insertions(+), 1 deletion(-)
 create mode 100644 indra/llplugin/llplugincookiestore.cpp
 create mode 100644 indra/llplugin/llplugincookiestore.h

(limited to 'indra')

diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index 6706775d4f..def9fcbeae 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -23,6 +23,7 @@ include_directories(
 
 set(llplugin_SOURCE_FILES
     llpluginclassmedia.cpp
+    llplugincookiestore.cpp
     llplugininstance.cpp
     llpluginmessage.cpp
     llpluginmessagepipe.cpp
@@ -36,6 +37,7 @@ set(llplugin_HEADER_FILES
 
     llpluginclassmedia.h
     llpluginclassmediaowner.h
+    llplugincookiestore.h
     llplugininstance.h
     llpluginmessage.h
     llpluginmessageclasses.h
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index bf0e19473e..e09b511a6e 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -993,6 +993,13 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
 			mClickTargetType = TARGET_NONE;
 			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW);
 		}
+		else if(message_name == "cookie_set")
+		{
+			if(mOwner)
+			{
+				mOwner->handleCookieSet(this, message.getValue("cookie"));
+			}
+		}
 		else
 		{
 			LL_WARNS("Plugin") << "Unknown " << message_name << " class message: " << message_name << LL_ENDL;
@@ -1076,6 +1083,13 @@ void LLPluginClassMedia::clear_cookies()
 	sendMessage(message);
 }
 
+void LLPluginClassMedia::set_cookies(const std::string &cookies)
+{
+	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "set_cookies");
+	message.setValue("cookies", cookies);	
+	sendMessage(message);
+}
+
 void LLPluginClassMedia::enable_cookies(bool enable)
 {
 	LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "enable_cookies");
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index 79356beb68..8c7b00f45b 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -189,6 +189,7 @@ public:
 	void focus(bool focused);
 	void clear_cache();
 	void clear_cookies();
+	void set_cookies(const std::string &cookies);
 	void enable_cookies(bool enable);
 	void proxy_setup(bool enable, const std::string &host = LLStringUtil::null, int port = 0);
 	void browse_stop();
diff --git a/indra/llplugin/llpluginclassmediaowner.h b/indra/llplugin/llpluginclassmediaowner.h
index 6d369cd51a..5669b81fd1 100644
--- a/indra/llplugin/llpluginclassmediaowner.h
+++ b/indra/llplugin/llpluginclassmediaowner.h
@@ -39,6 +39,7 @@
 #include <queue>
 
 class LLPluginClassMedia;
+class LLPluginCookieStore;
 
 class LLPluginClassMediaOwner
 {
@@ -78,6 +79,7 @@ public:
 	
 	virtual ~LLPluginClassMediaOwner() {};
 	virtual void handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent /*event*/) {};
+	virtual void handleCookieSet(LLPluginClassMedia* /*self*/, const std::string &/*cookie*/) {};
 };
 
 #endif // LL_LLPLUGINCLASSMEDIAOWNER_H
diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp
new file mode 100644
index 0000000000..1964b8d789
--- /dev/null
+++ b/indra/llplugin/llplugincookiestore.cpp
@@ -0,0 +1,600 @@
+/** 
+ * @file llplugincookiestore.cpp
+ * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+#include "linden_common.h"
+#include "indra_constants.h"
+
+#include "llplugincookiestore.h"
+#include <iostream>
+
+// for curl_getdate() (apparently parsing RFC 1123 dates is hard)
+#include <curl/curl.h>
+
+LLPluginCookieStore::LLPluginCookieStore():
+	mHasChangedCookies(false)
+{
+}
+
+
+LLPluginCookieStore::~LLPluginCookieStore()
+{
+	clearCookies();
+}
+
+
+LLPluginCookieStore::Cookie::Cookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end):
+	mCookie(s, cookie_start, cookie_end),
+	mNameStart(0), mNameEnd(0),
+	mValueStart(0), mValueEnd(0),
+	mDomainStart(0), mDomainEnd(0),
+	mPathStart(0), mPathEnd(0),
+	mDead(false), mChanged(true)
+{
+}
+
+LLPluginCookieStore::Cookie *LLPluginCookieStore::Cookie::createFromString(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end)
+{
+	Cookie *result = new Cookie(s, cookie_start, cookie_end);
+
+	if(!result->parse())
+	{
+		delete result;
+		result = NULL;
+	}
+	
+	return result;
+}
+
+std::string LLPluginCookieStore::Cookie::getKey() const
+{
+	std::string result;
+	if(mDomainEnd > mDomainStart)
+	{
+		result += mCookie.substr(mDomainStart, mDomainEnd - mDomainStart);
+	}
+	result += ';';
+	if(mPathEnd > mPathStart)
+	{
+		result += mCookie.substr(mPathStart, mPathEnd - mPathStart);
+	}
+	result += ';';
+	result += mCookie.substr(mNameStart, mNameEnd - mNameStart);
+	return result;
+}
+
+bool LLPluginCookieStore::Cookie::parse()
+{
+	bool first_field = true;
+
+	std::string::size_type cookie_end = mCookie.size();
+	std::string::size_type field_start = 0;
+
+	lldebugs << "parsing cookie: " << mCookie << llendl;
+	while(field_start < cookie_end)
+	{
+		// Finding the start of the next field requires honoring special quoting rules
+		// see the definition of 'quoted-string' in rfc2616 for details
+		std::string::size_type next_field_start = findFieldEnd(field_start);
+
+		// The end of this field should not include the terminating ';' or any trailing whitespace
+		std::string::size_type field_end = mCookie.find_last_not_of("; ", next_field_start);
+		if(field_end == std::string::npos || field_end < field_start)
+		{
+			// This field was empty or all whitespace.  Set end = start so it shows as empty.
+			field_end = field_start;
+		}
+		else if (field_end < next_field_start)
+		{
+			// we actually want the index of the char _after_ what 'last not of' found
+			++field_end;
+		}
+		
+		// find the start of the actual name (skip separator and possible whitespace)
+		std::string::size_type name_start = mCookie.find_first_not_of("; ", field_start);
+		if(name_start == std::string::npos || name_start > next_field_start)
+		{
+			// Again, nothing but whitespace.
+			name_start = field_start;
+		}
+		
+		// the name and value are separated by the first equals sign
+		std::string::size_type name_value_sep = mCookie.find_first_of("=", name_start);
+		if(name_value_sep == std::string::npos || name_value_sep > field_end)
+		{
+			// No separator found, so this is a field without an = 
+			name_value_sep = field_end;
+		}
+		
+		// the name end is before the name-value separator
+		std::string::size_type name_end = mCookie.find_last_not_of("= ", name_value_sep);
+		if(name_end == std::string::npos || name_end < name_start)
+		{
+			// I'm not sure how we'd hit this case... it seems like it would have to be an empty name.
+			name_end = name_start;
+		}
+		else if (name_end < name_value_sep)
+		{
+			// we actually want the index of the char _after_ what 'last not of' found
+			++name_end;
+		}
+		
+		// Value is between the name-value sep and the end of the field.
+		std::string::size_type value_start = mCookie.find_first_not_of("= ", name_value_sep);
+		if(value_start == std::string::npos || value_start > field_end)
+		{
+			// All whitespace or empty value
+			value_start = field_end;
+		}
+		std::string::size_type value_end = mCookie.find_last_not_of("; ", field_end);
+		if(value_end == std::string::npos || value_end < value_start)
+		{
+			// All whitespace or empty value
+			value_end = value_start;
+		}
+		else if (value_end < field_end)
+		{
+			// we actually want the index of the char _after_ what 'last not of' found
+			++value_end;
+		}
+
+		lldebugs 
+			<< "    field name: \"" << mCookie.substr(name_start, name_end - name_start) 
+			<< "\", value: \"" << mCookie.substr(value_start, value_end - value_start) << "\""
+			<< llendl;
+				
+		// See whether this field is one we know
+		if(first_field)
+		{
+			// The first field is the name=value pair
+			mNameStart = name_start;
+			mNameEnd = name_end;
+			mValueStart = value_start;
+			mValueEnd = value_end;
+			first_field = false;
+		}
+		else
+		{
+			// Subsequent fields must come from the set in rfc2109
+			if(matchName(name_start, name_end, "expires"))
+			{
+				std::string date_string(mCookie, value_start, value_end - value_start); 
+				// If the cookie contains an "expires" field, it MUST contain a parsable date.
+				
+				// HACK: LLDate apparently can't PARSE an rfc1123-format date, even though it can GENERATE one.
+				//  The curl function curl_getdate can do this, but I'm hesitant to unilaterally introduce a curl dependency in LLDate.
+#if 1
+				time_t date = curl_getdate(date_string.c_str(), NULL );
+				mDate.secondsSinceEpoch((F64)date);
+				lldebugs << "        expire date parsed to: " << mDate.asRFC1123() << llendl;
+#else
+				// This doesn't work (rfc1123-format dates cause it to fail)
+				if(!mDate.fromString(date_string))
+				{
+					// Date failed to parse.
+					llwarns << "failed to parse cookie's expire date: " << date << llendl;
+					return false;
+				}
+#endif
+			}
+			else if(matchName(name_start, name_end, "domain"))
+			{
+				mDomainStart = value_start;
+				mDomainEnd = value_end;
+			}
+			else if(matchName(name_start, name_end, "path"))
+			{
+				mPathStart = value_start;
+				mPathEnd = value_end;
+			}
+			else if(matchName(name_start, name_end, "max-age"))
+			{
+				// TODO: how should we handle this?
+			}
+			else if(matchName(name_start, name_end, "secure"))
+			{
+				// We don't care about the value of this field (yet)
+			}
+			else if(matchName(name_start, name_end, "version"))
+			{
+				// We don't care about the value of this field (yet)
+			}
+			else if(matchName(name_start, name_end, "comment"))
+			{
+				// We don't care about the value of this field (yet)
+			}
+			else
+			{
+				// An unknown field is a parse failure
+				return false;
+			}
+			
+		}
+
+		
+		// move on to the next field, skipping this field's separator and any leading whitespace
+		field_start = mCookie.find_first_not_of("; ", next_field_start);
+	}
+		
+	// The cookie MUST have a name
+	if(mNameEnd <= mNameStart)
+		return false;
+		
+	return true;
+}
+
+std::string::size_type LLPluginCookieStore::Cookie::findFieldEnd(std::string::size_type start, std::string::size_type end)
+{
+	std::string::size_type result = start;
+	
+	if(end == std::string::npos)
+		end = mCookie.size();
+	
+	bool in_quotes = false;
+	for(; (result < end); result++)
+	{
+		switch(mCookie[result])
+		{
+			case '\\':
+				if(in_quotes)
+					result++; // The next character is backslash-quoted.  Skip over it.
+			break;
+			case '"':
+				in_quotes = !in_quotes;
+			break;
+			case ';':
+				if(!in_quotes)
+					return result;
+			break;
+		}		
+	}
+	
+	// If we got here, no ';' was found.
+	return end;
+}
+
+bool LLPluginCookieStore::Cookie::matchName(std::string::size_type start, std::string::size_type end, const char *name)
+{
+	// NOTE: this assumes 'name' is already in lowercase.  The code which uses it should be able to arrange this...
+	
+	while((start < end) && (*name != '\0'))
+	{
+		if(tolower(mCookie[start]) != *name)
+			return false;
+			
+		start++;
+		name++;
+	}
+	
+	// iff both strings hit the end at the same time, they're equal.
+	return ((start == end) && (*name == '\0'));
+}
+
+std::string LLPluginCookieStore::getAllCookies()
+{
+	std::stringstream result;
+	writeAllCookies(result);
+	return result.str();
+}
+
+void LLPluginCookieStore::writeAllCookies(std::ostream& s)
+{
+	cookie_map_t::iterator iter;
+	for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
+	{
+		// Don't return expired cookies
+		if(!iter->second->isDead())
+		{
+			s << (iter->second->getCookie()) << "\n";
+		}
+	}
+
+}
+
+std::string LLPluginCookieStore::getPersistentCookies()
+{
+	std::stringstream result;
+	writePersistentCookies(result);
+	return result.str();
+}
+
+void LLPluginCookieStore::writePersistentCookies(std::ostream& s)
+{
+	cookie_map_t::iterator iter;
+	for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
+	{
+		// Don't return expired cookies or session cookies
+		if(!iter->second->isDead() && !iter->second->isSessionCookie())
+		{
+			s << iter->second->getCookie() << "\n";
+		}
+	}
+}
+
+std::string LLPluginCookieStore::getChangedCookies(bool clear_changed)
+{
+	std::stringstream result;
+	writeChangedCookies(result, clear_changed);
+	
+	return result.str();
+}
+
+void LLPluginCookieStore::writeChangedCookies(std::ostream& s, bool clear_changed)
+{
+	if(mHasChangedCookies)
+	{
+		lldebugs << "returning changed cookies: " << llendl;
+		cookie_map_t::iterator iter;
+		for(iter = mCookies.begin(); iter != mCookies.end(); )
+		{
+			cookie_map_t::iterator next = iter;
+			next++;
+			
+			// Only return cookies marked as "changed"
+			if(iter->second->isChanged())
+			{
+				s << iter->second->getCookie() << "\n";
+
+				lldebugs << "    " << iter->second->getCookie() << llendl;
+
+				// If requested, clear the changed mark
+				if(clear_changed)
+				{
+					if(iter->second->isDead())
+					{
+						// If this cookie was previously marked dead, it needs to be removed entirely.	
+						delete iter->second;
+						mCookies.erase(iter);
+					}
+					else
+					{
+						// Not dead, just mark as not changed.
+						iter->second->setChanged(false);
+					}
+				}
+			}
+			
+			iter = next;
+		}
+	}
+	
+	if(clear_changed)
+		mHasChangedCookies = false;
+}
+
+void LLPluginCookieStore::setAllCookies(const std::string &cookies, bool mark_changed)
+{
+	clearCookies();
+	setCookies(cookies, mark_changed);
+}
+
+void LLPluginCookieStore::readAllCookies(std::istream& s, bool mark_changed)
+{
+	clearCookies();
+	readCookies(s, mark_changed);
+}
+	
+void LLPluginCookieStore::setCookies(const std::string &cookies, bool mark_changed)
+{
+	std::string::size_type start = 0;
+
+	while(start != std::string::npos)
+	{
+		std::string::size_type end = cookies.find('\n', start);
+		if(end > start)
+		{
+			// The line is non-empty.  Try to create a cookie from it.
+			setOneCookie(cookies, start, end, mark_changed);
+		}
+		start = cookies.find_first_not_of("\n ", end);
+	}
+}
+			
+void LLPluginCookieStore::readCookies(std::istream& s, bool mark_changed)
+{
+	std::string line;
+	while(s.good() && !s.eof())
+	{
+		std::getline(s, line);
+		if(!line.empty())
+		{
+			// Try to create a cookie from this line.
+			setOneCookie(line, 0, std::string::npos, mark_changed);
+		}
+	}
+}
+
+std::string LLPluginCookieStore::quoteString(const std::string &s)
+{
+	std::stringstream result;
+	
+	result << '"';
+	
+	for(std::string::size_type i = 0; i < s.size(); ++i)
+	{
+		char c = s[i];
+		switch(c)
+		{
+			// All these separators need to be quoted in HTTP headers, according to section 2.2 of rfc 2616:
+			case '(': case ')': case '<': case '>': case '@':
+			case ',': case ';': case ':': case '\\': case '"':
+			case '/': case '[': case ']': case '?': case '=':
+			case '{': case '}':	case ' ': case '\t':
+				result << '\\';
+			break;
+		}
+		
+		result << c;
+	}
+	
+	result << '"';
+	
+	return result.str();
+}
+
+std::string LLPluginCookieStore::unquoteString(const std::string &s)
+{
+	std::stringstream result;
+	
+	bool in_quotes = false;
+	
+	for(std::string::size_type i = 0; i < s.size(); ++i)
+	{
+		char c = s[i];
+		switch(c)
+		{
+			case '\\':
+				if(in_quotes)
+				{
+					// The next character is backslash-quoted.  Pass it through untouched.
+					++i; 
+					if(i < s.size())
+					{
+						result << s[i];
+					}
+					continue;
+				}
+			break;
+			case '"':
+				in_quotes = !in_quotes;
+				continue;
+			break;
+		}
+		
+		result << c;
+	}
+	
+	return result.str();
+}
+
+// The flow for deleting a cookie is non-obvious enough that I should call it out here...
+// Deleting a cookie is done by setting a cookie with the same name, path, and domain, but with an expire timestamp in the past.
+// (This is exactly how a web server tells a browser to delete a cookie.)
+// When deleting with mark_changed set to true, this replaces the existing cookie in the list with an entry that's marked both dead and changed.
+// Some time later when writeChangedCookies() is called with clear_changed set to true, the dead cookie is deleted from the list after being returned, so that the
+// delete operation (in the form of the expired cookie) is passed along.
+void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed)
+{
+	Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end);
+	if(cookie)
+	{
+		lldebugs << "setting cookie: " << cookie->getCookie() << llendl;
+		
+		// Create a key for this cookie
+		std::string key = cookie->getKey();
+		
+		// Check to see whether this cookie should have expired
+		if(!cookie->isSessionCookie() && (cookie->getDate() < LLDate::now()))
+		{
+			// This cookie has expired.
+			if(mark_changed)
+			{
+				// If we're marking cookies as changed, we should keep it anyway since we'll need to send it out with deltas.
+				cookie->setDead(true);
+				lldebugs << "    marking dead" << llendl;
+			}
+			else
+			{
+				// If we're not marking cookies as changed, we don't need to keep this cookie at all.
+				// If the cookie was already in the list, delete it.
+				removeCookie(key);
+
+				delete cookie;
+				cookie = NULL;
+
+				lldebugs << "    removing" << llendl;
+			}
+		}
+		
+		if(cookie)
+		{
+			// If it already exists in the map, replace it.
+			cookie_map_t::iterator iter = mCookies.find(key);
+			if(iter != mCookies.end())
+			{
+				if(iter->second->getCookie() == cookie->getCookie())
+				{
+					// The new cookie is identical to the old -- don't mark as changed.
+					// Just leave the old one in the map.
+					delete cookie;
+					cookie = NULL;
+
+					lldebugs << "    unchanged" << llendl;
+				}
+				else
+				{
+					// A matching cookie was already in the map.  Replace it.
+					delete iter->second;
+					iter->second = cookie;
+					
+					cookie->setChanged(mark_changed);
+					if(mark_changed)
+						mHasChangedCookies = true;
+
+					lldebugs << "    replacing" << llendl;
+				}
+			}
+			else
+			{
+				// The cookie wasn't in the map.  Insert it.
+				mCookies.insert(std::make_pair(key, cookie));
+				
+				cookie->setChanged(mark_changed);
+				if(mark_changed)
+					mHasChangedCookies = true;
+
+				lldebugs << "    adding" << llendl;
+			}
+		}
+	}
+}
+
+void LLPluginCookieStore::clearCookies()
+{
+	while(!mCookies.empty())
+	{
+		cookie_map_t::iterator iter = mCookies.begin();
+		delete iter->second;
+		mCookies.erase(iter);
+	}
+}
+
+void LLPluginCookieStore::removeCookie(const std::string &key)
+{
+	cookie_map_t::iterator iter = mCookies.find(key);
+	if(iter != mCookies.end())
+	{
+		delete iter->second;
+		mCookies.erase(iter);
+	}
+}
+
diff --git a/indra/llplugin/llplugincookiestore.h b/indra/llplugin/llplugincookiestore.h
new file mode 100644
index 0000000000..5250f008b6
--- /dev/null
+++ b/indra/llplugin/llplugincookiestore.h
@@ -0,0 +1,122 @@
+/** 
+ * @file llplugincookiestore.h
+ * @brief LLPluginCookieStore provides central storage for http cookies used by plugins
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ * @endcond
+ */
+
+#ifndef LL_LLPLUGINCOOKIESTORE_H
+#define LL_LLPLUGINCOOKIESTORE_H
+
+#include "lldate.h"
+#include <map>
+#include <string>
+#include <iostream>
+
+class LLPluginCookieStore
+{
+	LOG_CLASS(LLPluginCookieStore);
+public:
+	LLPluginCookieStore();
+	~LLPluginCookieStore();
+
+	// gets all cookies currently in storage -- use when initializing a plugin
+	std::string getAllCookies();
+	void writeAllCookies(std::ostream& s);
+	
+	// gets only persistent cookies (i.e. not session cookies) -- use when writing cookies to a file
+	std::string getPersistentCookies();
+	void writePersistentCookies(std::ostream& s);
+	
+	// gets cookies which are marked as "changed" -- use when sending periodic updates to plugins
+	std::string getChangedCookies(bool clear_changed = true);
+	void writeChangedCookies(std::ostream& s, bool clear_changed = true);
+	
+	// (re)initializes internal data structures and bulk-sets cookies -- use when reading cookies from a file
+	void setAllCookies(const std::string &cookies, bool mark_changed = false);
+	void readAllCookies(std::istream& s, bool mark_changed = false);
+	
+	// sets one or more cookies (without reinitializing anything) -- use when receiving cookies from a plugin
+	void setCookies(const std::string &cookies, bool mark_changed = true);
+	void readCookies(std::istream& s, bool mark_changed = true);
+
+	// quote or unquote a string as per the definition of 'quoted-string' in rfc2616
+	static std::string quoteString(const std::string &s);
+	static std::string unquoteString(const std::string &s);
+	
+private:
+
+	void setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed);
+
+	class Cookie
+	{
+	public:
+		static Cookie *createFromString(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos);
+		
+		// Construct a string from the cookie that uniquely represents it, to be used as a key in a std::map.
+		std::string getKey() const;
+		
+		const std::string &getCookie() const { return mCookie; };
+		bool isSessionCookie() const { return mDate.isNull(); };
+
+		bool isDead() const { return mDead; };
+		void setDead(bool dead) { mDead = dead; };
+		
+		bool isChanged() const { return mChanged; };
+		void setChanged(bool changed) { mChanged = changed; };
+
+		const LLDate &getDate() const { return mDate; };
+		
+	private:
+		Cookie(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos);
+		bool parse();
+		std::string::size_type findFieldEnd(std::string::size_type start = 0, std::string::size_type end = std::string::npos);
+		bool matchName(std::string::size_type start, std::string::size_type end, const char *name);
+		
+		std::string mCookie;	// The full cookie, in RFC 2109 string format
+		LLDate mDate;			// The expiration date of the cookie.  For session cookies, this will be a null date (mDate.isNull() is true).
+		// Start/end indices of various parts of the cookie string.  Stored as indices into the string to save space and time.
+		std::string::size_type mNameStart, mNameEnd;
+		std::string::size_type mValueStart, mValueEnd;
+		std::string::size_type mDomainStart, mDomainEnd;
+		std::string::size_type mPathStart, mPathEnd;
+		bool mDead;
+		bool mChanged;
+	};
+	
+	typedef std::map<std::string, Cookie*> cookie_map_t;
+	
+	cookie_map_t mCookies;
+	bool mHasChangedCookies;
+	
+	void clearCookies();
+	void removeCookie(const std::string &key);
+};
+
+#endif // LL_LLPLUGINCOOKIESTORE_H
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 0462fce236..85d6b2f5ff 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -507,6 +507,19 @@ private:
 		sendMessage(message);
 	}
 	
+
+	////////////////////////////////////////////////////////////////////////////////
+	// virtual
+	void onCookieChanged(const EventType& event)
+	{
+		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "cookie_set");
+		message.setValue("cookie", event.getStringValue());
+		// These could be passed through as well, but aren't really needed.
+//		message.setValue("uri", event.getEventUri());
+//		message.setValueBoolean("dead", (event.getIntValue() != 0))
+		sendMessage(message);
+	}
+	
 	LLQtWebKit::EKeyboardModifier decodeModifiers(std::string &modifiers)
 	{
 		int result = 0;
@@ -1051,6 +1064,10 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 				mJavascriptEnabled = message_in.getValueBoolean("enable");
 				//LLQtWebKit::getInstance()->enableJavascript( mJavascriptEnabled );
 			}
+			else if(message_name == "set_cookies")
+			{
+				LLQtWebKit::getInstance()->setCookies(message_in.getValue("cookies"));
+			}
 			else if(message_name == "proxy_setup")
 			{
 				bool val = message_in.getValueBoolean("enable");
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d30d7fd26d..a3d0b8d8d9 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1526,6 +1526,8 @@ bool LLAppViewer::cleanup()
 	LLLocationHistory::getInstance()->save();
 
 	LLAvatarIconIDCache::getInstance()->save();
+	
+	LLViewerMedia::saveCookieFile();
 
 	llinfos << "Shutting down Threads" << llendflush;
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index edd03dc836..59d118abe2 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -938,6 +938,9 @@ bool idle_startup()
 
 		// Load Avatars icons cache
 		LLAvatarIconIDCache::getInstance()->load();
+		
+		// Load media plugin cookies
+		LLViewerMedia::loadCookieFile();
 
 		//-------------------------------------------------
 		// Handle startup progress screen
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 2fcd3f1114..8863bf187d 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -45,6 +45,7 @@
 #include "llviewertexturelist.h"
 #include "llvovolume.h"
 #include "llpluginclassmedia.h"
+#include "llplugincookiestore.h"
 #include "llviewerwindow.h"
 #include "llfocusmgr.h"
 #include "llcallbacklist.h"
@@ -256,6 +257,7 @@ public:
 		LLViewerMediaImpl *mMediaImpl;
 		bool mInitialized;
 };
+LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
 static LLViewerMedia::impl_list sViewerMediaImplList;
 static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap;
 static LLTimer sMediaCreateTimer;
@@ -264,6 +266,8 @@ static F32 sGlobalVolume = 1.0f;
 static F64 sLowestLoadableImplInterest = 0.0f;
 static bool sAnyMediaShowing = false;
 static boost::signals2::connection sTeleportFinishConnection;
+static std::string sUpdatedCookies;
+static const char *PLUGIN_COOKIE_FILE_NAME = "plugin_cookies.txt";
 
 //////////////////////////////////////////////////////////////////////////////////////////
 static void add_media_impl(LLViewerMediaImpl* media)
@@ -399,7 +403,6 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 		media_impl->setHomeURL(media_entry->getHomeURL());
 		media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
 		media_impl->mMediaEntryURL = media_entry->getCurrentURL();
-		
 		if(media_impl->isAutoPlayable())
 		{
 			needs_navigate = true;
@@ -698,6 +701,13 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
 void LLViewerMedia::updateMedia(void *dummy_arg)
 {
 	sAnyMediaShowing = false;
+	sUpdatedCookies = getCookieStore()->getChangedCookies();
+	if(!sUpdatedCookies.empty())
+	{
+		lldebugs << "updated cookies will be sent to all loaded plugins: " << llendl;
+		lldebugs << sUpdatedCookies << llendl;
+	}
+	
 	impl_list::iterator iter = sViewerMediaImplList.begin();
 	impl_list::iterator end = sViewerMediaImplList.end();
 
@@ -1095,6 +1105,116 @@ void LLViewerMedia::setProxyConfig(bool enable, const std::string &host, int por
 
 /////////////////////////////////////////////////////////////////////////////////////////
 // static 
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+LLPluginCookieStore *LLViewerMedia::getCookieStore()
+{
+	if(sCookieStore == NULL)
+	{
+		sCookieStore = new LLPluginCookieStore;
+	}
+	
+	return sCookieStore;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::loadCookieFile()
+{
+	// build filename for each user
+	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
+
+	if (resolved_filename.empty())
+	{
+		llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl;
+		return;
+	}
+	
+	// open the file for reading
+	llifstream file(resolved_filename);
+	if (!file.is_open())
+	{
+		llwarns << "can't load plugin cookies from file \"" << PLUGIN_COOKIE_FILE_NAME << "\"" << llendl;
+		return;
+	}
+	
+	getCookieStore()->readAllCookies(file, true);
+
+	file.close();
+	
+	// TODO: send the clear_cookies message to all loaded plugins
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::saveCookieFile()
+{
+	// build filename for each user
+	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, PLUGIN_COOKIE_FILE_NAME);
+
+	if (resolved_filename.empty())
+	{
+		llinfos << "can't get path to plugin cookie file - probably not logged in yet." << llendl;
+		return;
+	}
+
+	// open a file for writing
+	llofstream file (resolved_filename);
+	if (!file.is_open())
+	{
+		llwarns << "can't open plugin cookie file \"" << PLUGIN_COOKIE_FILE_NAME << "\" for writing" << llendl;
+		return;
+	}
+
+	getCookieStore()->writePersistentCookies(file);
+
+	file.close();
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path, bool secure)
+{
+	std::stringstream cookie;
+	
+	cookie << name << "=" << LLPluginCookieStore::quoteString(value);
+	
+	if(expires.notNull())
+	{
+		cookie << "; expires=" << expires.asRFC1123();
+	}
+	
+	cookie << "; domain=" << domain;
+
+	cookie << "; path=" << path;
+	
+	if(secure)
+	{
+		cookie << "; secure";
+	}
+	
+	getCookieStore()->setCookies(cookie.str());
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path, bool secure)
+{
+	// A session cookie just has a NULL date.
+	addCookie(name, value, domain, LLDate(), path, secure);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::removeCookie(const std::string &name, const std::string &domain, const std::string &path )
+{
+	// To remove a cookie, add one with the same name, domain, and path that expires in the past.
+	
+	addCookie(name, "", domain, LLDate(LLDate::now().secondsSinceEpoch() - 1.0), path);
+}
+
+
 bool LLViewerMedia::hasInWorldMedia()
 {
 	if (sInWorldMediaDisabled) return false;
@@ -1455,6 +1575,17 @@ bool LLViewerMediaImpl::initializePlugin(const std::string& media_type)
 			media_source->clear_cache();
 		}
 		
+		// TODO: Only send cookies to plugins that need them
+		//  Ideally, the plugin should tell us whether it handles cookies or not -- either via the init response or through a separate message.
+		//  Due to the ordering of messages, it's possible we wouldn't get that information back in time to send cookies before sending a navigate message,
+		//  which could cause odd race conditions.
+		std::string all_cookies = LLViewerMedia::getCookieStore()->getAllCookies();
+		lldebugs << "setting cookies: " << all_cookies << llendl;
+		if(!all_cookies.empty())
+		{
+			media_source->set_cookies(all_cookies);
+		}
+				
 		mMediaSource = media_source;
 
 		updateVolume();
@@ -2152,6 +2283,16 @@ void LLViewerMediaImpl::update()
 			}
 		}
 	}
+	else
+	{
+		// If we didn't just create the impl, it may need to get cookie updates.
+		if(!sUpdatedCookies.empty())
+		{
+			// TODO: Only send cookies to plugins that need them
+			mMediaSource->set_cookies(sUpdatedCookies);
+		}
+	}
+
 	
 	if(mMediaSource == NULL)
 	{
@@ -2612,6 +2753,13 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
 	emitEvent(plugin, event);
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// virtual
+void LLViewerMediaImpl::handleCookieSet(LLPluginClassMedia* self, const std::string &cookie)
+{
+	LLViewerMedia::getCookieStore()->setCookies(cookie);
+}
+
 ////////////////////////////////////////////////////////////////////////////////
 // virtual
 void
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index f9870fb3b9..10dacf9532 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -50,6 +50,7 @@ class LLViewerMediaTexture;
 class LLMediaEntry;
 class LLVOVolume;
 class LLMimeDiscoveryResponder;
+class LLPluginCookieStore;
 
 typedef LLPointer<LLViewerMediaImpl> viewer_media_t;
 ///////////////////////////////////////////////////////////////////////////////
@@ -145,8 +146,17 @@ public:
 	// Set the proxy config for all loaded plugins
 	static void setProxyConfig(bool enable, const std::string &host, int port);
 	
+	static LLPluginCookieStore *getCookieStore();
+	static void loadCookieFile();
+	static void saveCookieFile();
+	static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false );
+	static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false );
+	static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
+	
 private:
 	static void onTeleportFinished();
+	
+	static LLPluginCookieStore *sCookieStore;
 };
 
 // Implementation functions not exported into header file
@@ -294,6 +304,7 @@ public:
 
 	// Inherited from LLPluginClassMediaOwner
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent);
+	/*virtual*/ void handleCookieSet(LLPluginClassMedia* self, const std::string &cookie);
 
 	// LLEditMenuHandler overrides
 	/*virtual*/ void	cut();
-- 
cgit v1.2.3


From 8155e60deec245b318384aa01bdb6fb4db860725 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 15:48:11 -0700
Subject: IT translation for set5C

---
 .../newview/skins/default/xui/it/floater_tools.xml | 124 +++---
 .../default/xui/it/floater_voice_controls.xml      |  10 +-
 .../newview/skins/default/xui/it/notifications.xml | 445 +++++++++++----------
 indra/newview/skins/default/xui/it/panel_notes.xml |  12 +-
 4 files changed, 292 insertions(+), 299 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index dda957025b..16ee797ce4 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="toolbox floater" short_title="STRUMENTI/ATTREZZI PER COSTRUIRE" title="" width="288">
+<floater name="toolbox floater" short_title="STRUMENTI PER COSTRUZIONE" title="" width="288">
 	<floater.string name="status_rotate">
 		Sposta le fasce colorate per ruotare l&apos;oggetto
 	</floater.string>
@@ -16,7 +16,7 @@
 		Clicca e trascina per spostare la camera
 	</floater.string>
 	<floater.string name="status_grab">
-		Trascina per spostare, Ctrl per sollevare, Ctrl+Shift per ruotare
+		Trascina per spostare, Ctrl per sollevare, Ctrl+Maiusc per ruotare
 	</floater.string>
 	<floater.string name="status_place">
 		Clicca inworld per costruire
@@ -50,32 +50,32 @@
 	<radio_group name="focus_radio_group">
 		<radio_item label="Zoom" name="radio zoom"/>
 		<radio_item label="Guarda ruotando (Ctrl)" name="radio orbit"/>
-		<radio_item label="Panoramica (Ctrl+Shift)" name="radio pan"/>
+		<radio_item label="Panoramica (Ctrl+Maiusc)" name="radio pan"/>
 	</radio_group>
 	<radio_group name="move_radio_group">
 		<radio_item label="Muovi" name="radio move"/>
 		<radio_item label="Alza (Ctrl)" name="radio lift"/>
-		<radio_item label="Ruota (Ctrl+Shift)" name="radio spin"/>
+		<radio_item label="Gira (Ctrl+Maiusc)" name="radio spin"/>
 	</radio_group>
 	<radio_group name="edit_radio_group">
 		<radio_item label="Sposta" name="radio position"/>
 		<radio_item label="Ruota (Ctrl)" name="radio rotate"/>
-		<radio_item label="Estendi/Stira???!!!! (Ctrl+Shift)" name="radio stretch"/>
-		<radio_item label="Seleziona Faccia multimediale" name="radio select face"/>
+		<radio_item label="Allunga (Ctrl+Maiusc)" name="radio stretch"/>
+		<radio_item label="Seleziona faccia" name="radio select face"/>
 	</radio_group>
 	<check_box label="Modifica parti collegate" name="checkbox edit linked parts"/>
-	<text name="RenderingCost" tool_tip="Mostra il rendering cost calcolato per questo oggetto">
+	<text name="RenderingCost" tool_tip="Mostra il costo di rendering calcolato per questo oggetto">
 		þ: [COUNT]
 	</text>
 	<check_box label="Ridimens. simmetricamente" name="checkbox uniform"/>
 	<check_box initial_value="true" label="Ridimensiona le texture" name="checkbox stretch textures"/>
-	<check_box initial_value="true" label="Posiziona nella rete???!!!" name="checkbox snap to grid"/>
+	<check_box initial_value="true" label="Posiziona nella griglia" name="checkbox snap to grid"/>
 	<combo_box left_delta="48" name="combobox grid mode" tool_tip="Scegli il tipo di righello per posizionare l&apos;oggetto">
-		<combo_box.item label="Rete del Mondo" name="World"/>
+		<combo_box.item label="Rete del mondo" name="World"/>
 		<combo_box.item label="Rete locale" name="Local"/>
-		<combo_box.item label="Riferimento della rete???!!!!" name="Reference"/>
+		<combo_box.item label="Griglia di riferimento" name="Reference"/>
 	</combo_box>
-	<button label="Opzioni..." label_selected="Opzioni..." name="Options..." tool_tip="Vedi più opzioni delle rete"/>
+	<button label="Opzioni..." label_selected="Opzioni..." name="Options..." tool_tip="Vedi più opzioni della griglia"/>
 	<button label="" label_selected="" name="ToolCube" tool_tip="Cubo"/>
 	<button label="" label_selected="" name="ToolPrism" tool_tip="Prisma"/>
 	<button label="" label_selected="" name="ToolPyramid" tool_tip="Piramide"/>
@@ -91,10 +91,10 @@
 	<button label="" label_selected="" name="ToolRing" tool_tip="Anello"/>
 	<button label="" label_selected="" name="ToolTree" tool_tip="Albero"/>
 	<button label="" label_selected="" name="ToolGrass" tool_tip="Erba"/>
-	<check_box label="Mantieni lo strumento/attrezzo selezionato" name="checkbox sticky"/>
-	<check_box label="Seleziona la Copia" name="checkbox copy selection"/>
-	<check_box initial_value="true" label="Centra la Copia" name="checkbox copy centers"/>
-	<check_box label="Ruotare la Copia" name="checkbox copy rotates"/>
+	<check_box label="Mantieni lo strumento selezionato" name="checkbox sticky"/>
+	<check_box label="Copia la selezione" name="checkbox copy selection"/>
+	<check_box initial_value="true" label="Centra la copia" name="checkbox copy centers"/>
+	<check_box label="Ruota la copia" name="checkbox copy rotates"/>
 	<radio_group name="land_radio_group">
 		<radio_item label="Seleziona il terreno" name="radio select land"/>
 		<radio_item label="Appiattisci" name="radio flatten"/>
@@ -114,26 +114,26 @@
 	<text name="Strength:">
 		Potenza
 	</text>
-	<button label="Applica" label_selected="Applica" left="146" name="button apply to selection" tool_tip="Modifica la terra selezionata"/>
+	<button label="Applica" label_selected="Applica" left="146" name="button apply to selection" tool_tip="Modifica il terreno selezionato"/>
 	<text left="134" name="obj_count">
 		Oggetti: [COUNT]
 	</text>
 	<text left="134" name="prim_count">
-		Prims: [COUNT]
+		Prim: [COUNT]
 	</text>
 	<tab_container name="Object Info Tabs" tab_max_width="150" tab_min_width="30" width="288">
 		<panel label="Generale" name="General">
 			<panel.string name="text deed continued">
-				Intesta
+				Cessione
 			</panel.string>
 			<panel.string name="text deed">
 				Cedi al gruppo
 			</panel.string>
 			<panel.string name="text modify info 1">
-				Puoi modificare questo oggetto
+				Tu puoi modificare questo oggetto
 			</panel.string>
 			<panel.string name="text modify info 2">
-				Puoi modificare questi oggetti
+				Tu puoi modificare questi oggetti
 			</panel.string>
 			<panel.string name="text modify info 3">
 				Non puoi modificare questo oggetto
@@ -148,10 +148,10 @@
 				Prezzo: L$
 			</panel.string>
 			<panel.string name="Cost Total">
-				Prezzo Totale: L$
+				Prezzo totale: L$
 			</panel.string>
 			<panel.string name="Cost Per Unit">
-				Prezzo per Unità: L$
+				Prezzo per: L$
 			</panel.string>
 			<panel.string name="Cost Mixed">
 				Prezzo misto
@@ -180,20 +180,20 @@
 			<text name="Group:">
 				Gruppo:
 			</text>
-			<button label="Imposta..." label_selected="Imposta..." name="button set group" tool_tip="Scegli un gruppo per condividere i permessi di questo oggetto"/>
-			<name_box initial_value="Caricando..." name="Group Name Proxy"/>
-			<button label="Intesta" label_selected="Intesta" left_delta="152" name="button deed" tool_tip="Intestando permette di regalare questo oggetto con i permessi del prossimo proprietario. Gli oggetti condivisi dal gruppo posso essere instestati solo da un officer del gruppo." width="98"/>
-			<check_box label="Condividi" name="checkbox share with group" tool_tip="Permetti ai membri del gruppo selezionato di condividere i tuoi permessi modify per questo oggetto. Tu devi Intestare per attivare le restrizioni al ruolo."/>
+			<button label="Imposta..." label_selected="Imposta..." name="button set group" tool_tip="Scegli un gruppo con cui condividere i diritti relativi all&apos;oggetto"/>
+			<name_box initial_value="Caricamento in corso..." name="Group Name Proxy"/>
+			<button label="Cessione" label_selected="Cessione" left_delta="152" name="button deed" tool_tip="Con una cessione si trasferisce il bene con i diritti al proprietario successivo Gli oggetti in proprietà condivisa di gruppo possono essere ceduti soltanto da un funzionario del gruppo." width="98"/>
+			<check_box label="Condividi" name="checkbox share with group" tool_tip="Consenti a tutti i membri del gruppo selezionato di condividere i tuoi diritti di modifica di questo oggetto. Per attivare le restrizioni per ruolo devi prima effettuare la cessione."/>
 			<text name="label click action" width="220">
-				Clicca:
+				Fai clic per:
 			</text>
 			<combo_box name="clickaction" width="192">
-				<combo_box.item label="Tocca (default)" name="Touch/grab(default)"/>
+				<combo_box.item label="Tocca (predefinito)" name="Touch/grab(default)"/>
 				<combo_box.item label="Siediti sull&apos;oggetto" name="Sitonobject"/>
 				<combo_box.item label="Compra l&apos;oggetto" name="Buyobject"/>
 				<combo_box.item label="Paga l&apos;oggetto" name="Payobject"/>
 				<combo_box.item label="Apri" name="Open"/>
-				<combo_box.item label="Zoom" name="Zoom"/>
+				<combo_box.item label="Ingrandisci" name="Zoom"/>
 			</combo_box>
 			<check_box label="In vendita:" name="checkbox for sale"/>
 			<combo_box name="sale type">
@@ -205,7 +205,7 @@
 			<check_box label="Mostra nella ricerca" name="search_check" tool_tip="Permetti che l&apos;oggetto sia visibile nella ricerca"/>
 			<panel name="perms_build">
 				<text name="perm_modify">
-					Puoi modificare questo oggetto
+					Tu puoi modificare questo oggetto
 				</text>
 				<text name="Anyone can:">
 					Chiunque:
@@ -213,11 +213,11 @@
 				<check_box label="Sposta" name="checkbox allow everyone move"/>
 				<check_box label="Copia" name="checkbox allow everyone copy"/>
 				<text name="Next owner can:">
-					Prossimo proprietario:
+					Proprietario successivo:
 				</text>
 				<check_box label="Modificare" name="checkbox next owner can modify"/>
 				<check_box label="Copiare" left_delta="80" name="checkbox next owner can copy"/>
-				<check_box label="Transfer" left_delta="67" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
+				<check_box label="Trasferisci" left_delta="67" name="checkbox next owner can transfer" tool_tip="Il prossimo proprietario può regalare o rivendere questo oggetto"/>
 				<text name="B:">
 					B:
 				</text>
@@ -241,7 +241,7 @@
 		<panel label="Oggetto" name="Object">
 			<check_box label="Bloccato" name="checkbox locked" tool_tip="Previene lo spostamento o la cancellazione dell&apos;oggetto. Spesso utile mentre si costruisce per evitare involontarie modifiche."/>
 			<check_box label="Fisico" name="Physical Checkbox Ctrl" tool_tip="Permette all&apos;oggetto di essere spostato e di subire gli effetti della gravità"/>
-			<check_box label="Temporaneo" name="Temporary Checkbox Ctrl" tool_tip="Causa la cancellazione dell&apos;oggetto 1 minuto dopo la sua creazione"/>
+			<check_box label="Temporaneo" name="Temporary Checkbox Ctrl" tool_tip="Determina la cancellazione dell&apos;oggetto 1 minuto dopo la sua creazione"/>
 			<check_box label="Fantasma" name="Phantom Checkbox Ctrl" tool_tip="Rende l&apos;oggetto penetrabile dagli altri oggetti e dagli avatars"/>
 			<text name="label position">
 				Posizione (metri)
@@ -281,7 +281,7 @@
 				<combo_box.item label="Gomma" name="Rubber"/>
 			</combo_box>
 			<text name="text cut">
-				Riduci una sezione (begin/end)
+				Riduci una sezione (inizio/fine)
 			</text>
 			<spinner label="I" name="cut begin"/>
 			<spinner label="F" name="cut end"/>
@@ -301,7 +301,7 @@
 				<combo_box.item label="Triangolare" name="Triangle"/>
 			</combo_box>
 			<text name="text twist">
-				Attorciglia (begin/end)
+				Attorciglia (inizio/fine)
 			</text>
 			<spinner label="I" name="Twist Begin"/>
 			<spinner label="F" name="Twist End"/>
@@ -319,13 +319,13 @@
 			<spinner label="X" name="Shear X"/>
 			<spinner label="Y" name="Shear Y"/>
 			<text name="advanced_cut" width="149">
-				Riduci un bordo (begin/end)
+				Riduci un bordo (inizio/fine)
 			</text>
 			<text name="advanced_dimple">
-				Fossetta???!!!! (begin/end)
+				Scava (inizio/fine)
 			</text>
 			<text name="advanced_slice">
-				Taglia???!!! (begin/end)
+				Taglia (inizio/fine)
 			</text>
 			<spinner label="I" name="Path Limit Begin"/>
 			<spinner label="F" name="Path Limit End"/>
@@ -361,7 +361,7 @@
 			<text name="edit_object">
 				Modifica le caratteristiche dell&apos;oggetto:
 			</text>
-			<check_box label="Flessibilità" name="Flexible1D Checkbox Ctrl" tool_tip="Permetti all&apos;oggetto di flettersi lungo l&apos;asse Z  (Client-side only)"/>
+			<check_box label="Flessibilità" name="Flexible1D Checkbox Ctrl" tool_tip="Consenti all&apos;oggetto di flettersi lungo l&apos;asse Z (solo lato client)"/>
 			<spinner label="Morbidezza" label_width="72" name="FlexNumSections" width="135"/>
 			<spinner label="Gravità" label_width="72" name="FlexGravity" width="135"/>
 			<spinner label="Elasticità" label_width="72" name="FlexFriction" width="135"/>
@@ -372,11 +372,11 @@
 			<spinner label="Forza Z" label_width="72" name="FlexForceZ" width="135"/>
 			<check_box label="Luce" name="Light Checkbox Ctrl" tool_tip="Imposta l&apos;oggetto come sorgente di luce"/>
 			<color_swatch label="" name="colorswatch" tool_tip="Clicca per aprire il selettore dei colori"/>
-			<texture_picker label="" name="light texture control" tool_tip="Clicca per scegliere una proiezione dell&apos;immagine (funziona solo con deferred rendering attivato)"/>
+			<texture_picker label="" name="light texture control" tool_tip="Clicca per scegliere un&apos;immagine da proiettare (funziona solo con il rendering differito attivato)"/>
 			<spinner label="Intensità" label_width="72" name="Light Intensity" width="135"/>
-			<spinner label="FOV" name="Light FOV"/>
+			<spinner label="Angolo di vista" name="Light FOV"/>
 			<spinner label="Raggio" label_width="72" name="Light Radius" width="135"/>
-			<spinner label="Focus" name="Light Focus"/>
+			<spinner label="Centro focale" name="Light Focus"/>
 			<spinner label="Attenuazione" label_width="72" name="Light Falloff" width="135"/>
 			<spinner label="Atmosfera" name="Light Ambiance"/>
 		</panel>
@@ -395,8 +395,7 @@
 			<text name="glow label">
 				Bagliore
 			</text>
-			<check_box bottom_delta="-21" label="Massima 
-luminosità" name="checkbox fullbright"/>
+			<check_box bottom_delta="-21" label="Massima  luminosità" name="checkbox fullbright"/>
 			<text name="tex gen">
 				Applicazione 
 della texture
@@ -438,32 +437,32 @@ della texture
 				<combo_box.item label="Trama" name="weave"/>
 			</combo_box>
 			<text name="tex scale">
-				Ripeti / Lato
+				Ripetizioni / Faccia
 			</text>
 			<spinner label="Orizzontale (U)" name="TexScaleU"/>
 			<check_box label="Inverti" name="checkbox flip s"/>
 			<spinner label="Verticale (V)" name="TexScaleV"/>
 			<check_box label="Inverti" name="checkbox flip t"/>
 			<spinner label="Rotazione˚" left="120" name="TexRot" width="60"/>
-			<spinner label="Ripete / Metri" left="120" name="rptctrl" width="60"/>
+			<spinner label="Ripetizioni / Metro" left="120" name="rptctrl" width="60"/>
 			<button label="Applica" label_selected="Applica" left_delta="72" name="button apply"/>
 			<text name="tex offset">
-				Bilanciamento della Texture
+				Bilanciamento della texture
 			</text>
 			<spinner label="Orizzontale (U)" name="TexOffsetU"/>
 			<spinner label="Verticale (V)" name="TexOffsetV"/>
 			<panel name="Add_Media">
 				<text name="media_tex">
-					Media
+					Multimediale
 				</text>
-				<button name="add_media" tool_tip="Aggiungi Media"/>
+				<button name="add_media" tool_tip="Aggiungi media"/>
 				<button name="delete_media" tool_tip="Cancella questa media texture"/>
-				<button name="edit_media" tool_tip="Modifica questo Media"/>
-				<button label="Alllinea" label_selected="Allinea Media" name="button align" tool_tip="Allinea media texture (must load first)"/>
+				<button name="edit_media" tool_tip="Modifica questo media"/>
+				<button label="Alllinea" label_selected="Allinea media" name="button align" tool_tip="Allinea texture del media (il caricamento deve prima essere completato)"/>
 			</panel>
 		</panel>
 		<panel label="Contenuto" name="Contents">
-			<button label="Nuovo Script" label_selected="Nuovo Script" name="button new script"/>
+			<button label="Nuovo Script" label_selected="Nuovo script" name="button new script"/>
 			<button label="Permessi" name="button permissions"/>
 		</panel>
 	</tab_container>
@@ -472,29 +471,22 @@ della texture
 			Informazioni sul terreno
 		</text>
 		<text name="label_area_price">
-			Prezzo: L$[PRICE] per [AREA] m²
+			Prezzo: L$ [PRICE] per [AREA] m²
 		</text>
 		<text name="label_area">
-			Area: [AREA] m²
+			Zona: [AREA] m²
 		</text>
-		<button label="Info sul terreno" label_selected="Info sul terreno" name="button about land" width="156"/>
-		<check_box label="Mostra i proprietari" name="checkbox show owners" tool_tip="Colora i terreni in base ai loro proprietari: 
-
-Verde = il tuo terreno 
-Acqua = la terra del tuo gruppo 
-Rosso = posseduta da altri 
-Giallo = in vendita 
-Viola = in asta 
-Grigia = pubblica"/>
+		<button label="Informazioni sui terreni" label_selected="Informazioni sui terreni" name="button about land" width="156"/>
+		<check_box label="Mostra i proprietari" name="checkbox show owners" tool_tip="Colora i terreni in base ai loro proprietari:   Verde = il tuo terreno  Acqua = la terra del tuo gruppo  Rosso = posseduta da altri  Giallo = in vendita  Viola = in asta  Grigia = pubblica"/>
 		<text name="label_parcel_modify">
 			Modifica il terreno
 		</text>
 		<button label="Suddividi" label_selected="Suddividi" name="button subdivide land" width="156"/>
-		<button label="Aderisci" label_selected="Aderisci" name="button join land" width="156"/>
+		<button label="Iscriviti" label_selected="Iscriviti" name="button join land" width="156"/>
 		<text name="label_parcel_trans">
 			Transazioni del territorio
 		</text>
-		<button label="Compra la Terra" label_selected="Compra la Terra" name="button buy land" width="156"/>
-		<button label="Abbandona la Terra" label_selected="Abbandona la Terra" name="button abandon land" width="156"/>
+		<button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land" width="156"/>
+		<button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land" width="156"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_voice_controls.xml b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
index c2375f357a..07368da0dd 100644
--- a/indra/newview/skins/default/xui/it/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/it/floater_voice_controls.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater_voice_controls" title="Controlli del Voice">
+<floater name="floater_voice_controls" title="Regolazione voce">
 	<string name="title_nearby">
-		VOICE NEI DINTORNI
+		VOCE NEI DINTORNI
 	</string>
 	<string name="title_group">
-		Chiamata di Gruppo con [GROUP]
+		Chiamata di gruppo con [GROUP]
 	</string>
 	<string name="title_adhoc">
-		Conference Call
+		Chiamata in conferenza
 	</string>
 	<string name="title_peer_2_peer">
-		Chiama con [NAME]
+		Chiamata con [NAME]
 	</string>
 	<string name="no_one_near">
 		Nessuno nei dintorni ha attivato la funzione voce
diff --git a/indra/newview/skins/default/xui/it/notifications.xml b/indra/newview/skins/default/xui/it/notifications.xml
index ba68816f58..6736c6a6f1 100644
--- a/indra/newview/skins/default/xui/it/notifications.xml
+++ b/indra/newview/skins/default/xui/it/notifications.xml
@@ -44,10 +44,10 @@
 			<button name="Cancel_yesnocancelbuttons" text="$canceltext"/>
 		</form>
 	</template>
-	<notification functor="GenericAcknowledge" label="Messaggio di Notifica Sconosciuto" name="MissingAlert">
-		La versione di [APP_NAME] non riesce a visualizzare la notifica che ha ricevuto. Verifica di avere l&apos;ultima versione del Viewer installata.
+	<notification functor="GenericAcknowledge" label="Messaggio di notifica sconosciuto" name="MissingAlert">
+		La versione di [APP_NAME] non riesce a visualizzare la notifica appena ricevuta.  Verifica di avere l&apos;ultima versione del Viewer installata.
 
-Dettaglio Errore: La notifica di nome &apos;[_NAME]&apos; non è stata trovata in notifications.xml.
+Dettagli errore: La notifica denominata &apos;[_NAME]&apos; non è stata trovata in notifications.xml.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="FloaterNotFound">
@@ -68,11 +68,11 @@ Dettaglio Errore: La notifica di nome &apos;[_NAME]&apos; non è stata trovata i
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Si"/>
 	</notification>
 	<notification name="BadInstallation">
-		Errore mentre si aggiornava [APP_NAME].  [http://get.secondlife.com Scarica l&apos;ultima versione] del Viewer.
+		Il programma [APP_NAME] ha riscontrato un&apos;errore durante il tentativo di aggiornamento.  [http://get.secondlife.com Scarica l&apos;ultima versione] del Viewer.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="LoginFailedNoNetwork">
-		Non è possibile connettersi a [SECOND_LIFE_GRID].
+		Non è possibile collegarsi alla [SECOND_LIFE_GRID].
 &apos;[DIAGNOSTIC]&apos;
 Accertati che la tua connessione Internet stia funzionando correttamente.
 		<usetemplate name="okbutton" yestext="OK"/>
@@ -146,7 +146,7 @@ Vuoi concedere i diritti di modifica ai residenti selezionati?
 Non si possono rimuovere membri da quel ruolo.
 I membri devono dimettersi volontariamente dal ruolo.
 Confermi l&apos;operazione?
-		<usetemplate ignoretext="Conferma prima di aggiungere un nuovo Proprietario del Gruppo" name="okcancelignore" notext="No" yestext="Si"/>
+		<usetemplate ignoretext="Conferma prima di aggiungere un nuovo proprietario del gruppo" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="AssignDangerousActionWarning">
 		Stai per aggiungere il potere &apos;[ACTION_NAME]&apos; al ruolo &apos;[ROLE_NAME]&apos;.
@@ -186,10 +186,10 @@ Continuare?
 Non hai abbastanza L$ per iscriverti a questo gruppo.
 	</notification>
 	<notification name="CreateGroupCost">
-		La Creazione di questo gruppo costerà L$100.
-I Gruppi devono avere più di un membro, o saranno cancellati definitivamente.
-Per favore invita altri membri entro le prossime 48 ore.
-		<usetemplate canceltext="Annulla" name="okcancelbuttons" notext="Cancella" yestext="Crea un gruppo per L$100"/>
+		La creazione di questo gruppo costerà L$ 100.
+I gruppi devono avere più di un partecipante, o saranno eliminati definitivamente.
+Invita altri partecipanti entro le prossime 48 ore.
+		<usetemplate canceltext="Annulla" name="okcancelbuttons" notext="Annulla" yestext="Crea un gruppo per L$ 100"/>
 	</notification>
 	<notification name="LandBuyPass">
 		Pagando [COST]L$ puoi entrare in questa terra (&apos;[PARCEL_NAME]&apos;) per [TIME] ore.  Compri un pass?
@@ -205,10 +205,10 @@ Il tuo prezzo di vendità è [SALE_PRICE]L$ ed è autorizzato alla vendita a [NA
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmLandSaleToAnyoneChange">
-		ATTENZIONE: Cliccando &apos;vendi a tutti&apos; rende questo terreno disponibile all&apos;intera comunità [SECOND_LIFE], perfino a quelli che non sono in questa regione.
+		ATTENZIONE: Quando selezioni &apos;vendi a tutti&apos;, rendi questo terreno disponibile all&apos;intera comunità di [SECOND_LIFE], anche alle persone che non si trovano in questa regione.
 
-Stai mettendo in vendita il terrendo selezionato di [LAND_SIZE] m².
-Il prezzo di vendità è [SALE_PRICE]L$ e verrà autorizzato alla vendita a [NAME].
+Il terrendo selezionato di [LAND_SIZE] m² sta per essere messo in vendita.
+Il prezzo di vendità sarà [SALE_PRICE]L$ e [NAME] viene autorizzato alla vendita.
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsDeededToGroup">
@@ -269,10 +269,10 @@ L&apos;intera regione ha l&apos;abilitazione danni.
 Gli script devono essere autorizzati all&apos;esecuzione affinchè le armi funzionino.
 	</notification>
 	<notification name="MultipleFacesSelected">
-		Multiple facce multimediale sono attualmente selezionate.
-Se prosegui con questa azione, esempi separati del media saranno impostati su facce multimediali dell&apos;oggetto. ???!!!
-Per impostare il media su una sola faccia multimediale, scegli Seleziona Faccia e clicca la faccia desiderata dell&apos;oggetto e poi clicca Aggiungi.
-		<usetemplate ignoretext="Il Media sarà impostato su facce multimediali multiple" name="okcancelignore" notext="Cancella" yestext="OK"/>
+		Sono state selezionate più facce.
+Se prosegui con questa azione, sulle diverse facce dell&apos;oggetto verranno definite sessioni multimediali distinte.
+Per collocare il media su una sola faccia, scegli Seleziona faccia, clicca su una faccia e clicca su Aggiungi.
+		<usetemplate ignoretext="Il canale multimediale sarà impostato su più facce selezionate" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="MustBeInParcel">
 		Devi essere dentro il terreno per impostare il suo Punto di Atterraggio.
@@ -310,8 +310,8 @@ La cartella equipaggiamento non contiene abbigliamento, parti del corpo o attach
 		Non puoi indossare abiti e parti del corpo che sono nel cestino
 	</notification>
 	<notification name="MaxAttachmentsOnOutfit">
-		L&apos;oggetto non può essere attaccato.
-Superato il limite di oggetti attaccati [MAX_ATTACHMENTS]. Per favore prima stacca un altro oggetto.
+		L&apos;oggetto non può essere collegato.
+Superato il limite di oggetti collegati [MAX_ATTACHMENTS]. Per favore prima stacca un altro oggetto.
 	</notification>
 	<notification name="CannotWearInfoNotComplete">
 		Non puoi indossare quell&apos;elemento perchè non è ancora stato caricato. Riprova fra un minuto.
@@ -327,11 +327,11 @@ Hai bisogno di un account per entrare in [SECOND_LIFE]. Ne vuoi creare uno adess
 		<usetemplate name="okcancelbuttons" notext="Riprova" yestext="Crea un nuovo account"/>
 	</notification>
 	<notification name="AddClassified">
-		L&apos;inserzione apparirà nella sezione &apos;Annunci&apos; della Ricerca e su [http://secondlife.com/community/classifieds secondlife.com] per una settimana.
-Compila la tua inserzione, e quindi clicca &apos;Pubblica...&apos; per aggiungerla all&apos;elenco.
-Ti sarà chiesto un prezzo da pagare quando clicchi Pubblica.
-Pagando di più il tuo annuncio apparirà più in alto nella lista, e apparirà anche più in alto quando la gente cerca per Parole Chiavi.
-		<usetemplate ignoretext="Come Creare una nuova Inserzione" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		L&apos;inserzione comparirà nella sezione &apos;Annunci&apos; della Ricerca e su [http://secondlife.com/community/classifieds secondlife.com] per una settimana.
+Compila la tua inserzione, quindi clicca &apos;Pubblica...&apos; per aggiungerla all&apos;elenco degli annunci.
+Quando clicchi su Pubblica, ti verrà chiesto di indicare quale prezzo vuoi pagare.
+Pagando di più, il tuo annuncio comparirà più in alto nella lista delle inserzioni, nonché nei risultati delle ricerche in base a parole chiave.
+		<usetemplate ignoretext="Come creare una nuova inserzione" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="DeleteClassified">
 		Cancella annuncio &apos;[NAME]&apos;?
@@ -339,9 +339,9 @@ Non ci sono rimborsi per la tariffa pagata.
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="DeleteMedia">
-		Hai selezionato la cancellazione del media associato a questa faccia multimediale.
-Sei sicuro di voler continuare?
-		<usetemplate ignoretext="Confemra la cancellazione del multimedia dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Si"/>
+		Hai selezionato la cancellazione del media associato a questa faccia.
+Vuoi continuare?
+		<usetemplate ignoretext="Conferma prima di eliminare elemnti multimediali dall&apos;oggetto" name="okcancelignore" notext="No" yestext="Sì"/>
 	</notification>
 	<notification name="ClassifiedSave">
 		Salva le modifiche all&apos;annuncio [NAME]?
@@ -369,17 +369,17 @@ Sei sicuro di voler continuare?
 		Scegli un item storico da vedere.
 	</notification>
 	<notification name="CacheWillClear">
-		La Cache verrà cancellata dopo la ripartenza di  [APP_NAME].
+		La cache verrà cancellata dopo il riavvio di [APP_NAME].
 	</notification>
 	<notification name="CacheWillBeMoved">
-		La Cache verrà mossa dopo la ripartenza di  [APP_NAME].
-Nota: Questo cancellerà anche la cache.
+		La cache verrà spostata dopo il riavvio di [APP_NAME].
+Nota: questa operazione cancellerà la cache.
 	</notification>
 	<notification name="ChangeConnectionPort">
-		Le importazioni di Porte avranno effetto dopo la ripartenza di [APP_NAME].
+		Le impostazioni della porta avranno effetto dopo il riavvio di [APP_NAME].
 	</notification>
 	<notification name="ChangeSkin">
-		La nuova skin apparirà dopo la ripartenza di  [APP_NAME].
+		La nuova pelle comparirà dopo il riavvio di [APP_NAME].
 	</notification>
 	<notification name="GoToAuctionPage">
 		Vai alla pagina web [SECOND_LIFE] per vedere i dettagli dell&apos;asta oppure fai un&apos;offerta?
@@ -428,8 +428,8 @@ L&apos;oggetto potrebbe essere troppo lontano oppure essere stato cancellato.
 		C&apos;è stato un problema salvando lo script compilato a causa del seguente motivo: [REASON].  Riprova a salvare lo script più tardi.
 	</notification>
 	<notification name="StartRegionEmpty">
-		Oops, la tua Regione di Inizio non è stata impostata.
-Per favore scrivi il nome della Regione nello spazio Regione di Inizio oppure scegli la mia ultima Ubicazione o Casa Mia come ultima ubicazione.
+		La tua Regione di inizio non è stata definita.
+Per scegliere il luogo dove vuoi trovarti all&apos;accesso, digita il nome della regione nel campo del luogo di partenza oppure scegli La mia ultima Ubicazione o Casa mia.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CouldNotStartStopScript">
@@ -449,21 +449,21 @@ Visitare [_URL] per ulteriori informazioni?
 		<url name="url" option="0">
 			http://secondlife.com/support/sysreqs.php?lang=it
 		</url>
-		<usetemplate ignoretext="L&apos;hardware di questo computer non è supportato" name="okcancelignore" notext="No" yestext="Si"/>
+		<usetemplate ignoretext="L&apos;hardware di questo computer non è compatibile" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="UnknownGPU">
 		Il tuo sistema utilizza una scheda grafica che [APP_NAME] non riconosce.
 Questo succede spesso con un nuovo hardware che non è stato ancora testato con [APP_NAME].  Probabilmente tutto andrà bene, ma devi riconfigurare le tue impostazioni grafiche.
 (Io &gt; Preferenze &gt; Grafica).
 		<form name="form">
-			<ignore name="ignore" text="La mia scheda grafica non è stata identificata"/>
+			<ignore name="ignore" text="La tua scheda grafica non è stata riconosciuta"/>
 		</form>
 	</notification>
 	<notification name="DisplaySettingsNoShaders">
-		[APP_NAME] si è interrotta mentre stava inizializzando i driver grafici.
-La Qualità Grafica verrà impostata a Basso per evitare alcuni errori comuni di driver. Questo disabiliterà alcune caratteristiche grafiche.
-Si raccomanda di aggiornare i driver della scheda grafica.
-La Qualità Grafica può essere aumentata in Preferenze &gt; Grafica.
+		L&apos;esecuzione di [APP_NAME] si è interrotta durante l&apos;inizializzazione dei driver grafici.
+La qualità grafica verrà impostata a livello basso per evitare alcuni errori comuni di driver. Alcune funzionalità grafiche saranno disattivate.
+Si consiglia di aggiornare i driver della scheda grafica.
+La qualità grafica può essere aumentata in Preferenze &gt; Grafica.
 	</notification>
 	<notification name="RegionNoTerraforming">
 		La regione [REGION] non consente di terraformare.
@@ -618,7 +618,7 @@ Attese [VALIDS]
 		Impossibile creare il file in uscita: [FILE]
 	</notification>
 	<notification name="DoNotSupportBulkAnimationUpload">
-		[APP_NAME] non supporta ancora l&apos;upload in blocco di file di animazione.
+		[APP_NAME] non supporta ancora il caricamento in blocco di file di animazione.
 	</notification>
 	<notification name="CannotUploadReason">
 		Impossibile importare il file [FILE] a causa del seguente motivo: [REASON]
@@ -654,7 +654,7 @@ Seleziona oggetti con degli script.
 Seleziona oggetti con script su cui hai i permessi di modifica.
 	</notification>
 	<notification name="CannotOpenScriptObjectNoMod">
-		Impossibile aprire la script dell&apos;oggetto senza i permessi modify.
+		Impossibile aprire la script dell&apos;oggetto senza i diritti di modifica.
 	</notification>
 	<notification name="CannotSetRunningSelectObjectsNoScripts">
 		Impossibile mettere &apos;in esecuzione&apos; gli script.
@@ -683,12 +683,12 @@ Ho cercato: [FINALQUERY]
 [REASON]
 	</notification>
 	<notification name="invalid_tport">
-		E&apos; stato incontrato un problema eseguendo la tua richiesta di teleport. Potresti avere bisogno di riloggarti per ritentare il teleport.
-Se continui a ricevere questo errore, controlla [SUPPORT_SITE].
+		C&apos;è stato un problema nell&apos;elaborare la tua richiesta di teleport. Potresti dover effettuare nuovamente l&apos;accesso prima di poter usare il teleport.
+Se si continua a visualizzare questo messaggio, consulta la pagina [SUPPORT_SITE].
 	</notification>
 	<notification name="invalid_region_handoff">
-		Ci sono stati problemi eseguendo il passaggio di regione. Potresti avere bisogno di riloggarti per ritentare il passaggio di regione.
-Se continui a ricevere questo errore, controlla  [SUPPORT_SITE].
+		Si è verificato un problema nel tentativo di attraversare regioni. È possibile che per potere attraversare le regioni, tu debba effettuare nuovamente l&apos;accesso.
+Se si continua a visualizzare questo messaggio, consulta la pagina [SUPPORT_SITE].
 	</notification>
 	<notification name="blocked_tport">
 		Spiacenti, il teletrasporto è bloccato al momento. Prova di nuovo tra pochi istanti. Se ancora non potrai teletrasportarti, per favore scollegati e ricollegati per risolvere il problema.
@@ -757,7 +757,7 @@ Nessun terreno selezionato.
 Non riesco a trovare la regione dove è situato il terreno.
 	</notification>
 	<notification name="CannotCloseFloaterBuyLand">
-		Non puoi chiudere la finestra di Acquisto Terreno finchè [APP_NAME] non finisce di stimare il prezzo di questa transazione.
+		Non puoi chiudere la finestra Acquista terreno finché [APP_NAME] non finisce di stimare il prezzo di questa transazione.
 	</notification>
 	<notification name="CannotDeedLandNothingSelected">
 		Impossibile cedere il terreno:
@@ -768,8 +768,8 @@ Nessun terreno selezionato.
 Nessun gruppo selezionato.
 	</notification>
 	<notification name="CannotDeedLandNoRegion">
-		Non è possibile donare il terreno:
-Non riesco a trovare la regione in cui si trova.
+		Non è possibile effettuare la cessione del terreno:
+Impossibile trovare la regione in cui si trova il terreno.
 	</notification>
 	<notification name="CannotDeedLandMultipleSelected">
 		Impossibile cedere il terreno:
@@ -806,7 +806,7 @@ I terreni di tua proprietà vengono visualizzati in verde.
 	</notification>
 	<notification name="CannotReleaseLandRegionNotFound">
 		Non è possibile abbandonare il terreno:
-Non riesco a trovare la regione in cui si trova.
+Impossibile trovare la regione in cui si trova il terreno.
 	</notification>
 	<notification name="CannotReleaseLandNoTransfer">
 		Impossibile abbandonare il terreno:
@@ -844,11 +844,11 @@ Dividi il terreno?
 	</notification>
 	<notification name="CannotDivideLandNoRegion">
 		Non è possibile suddividere il terreno:
-Non riesco a trovare la regione in cui si trova.
+Impossibile trovare la regione in cui si trova il terreno.
 	</notification>
 	<notification name="CannotJoinLandNoRegion">
 		Non è possibile unire il terreno:
-Non riesco a trovare la regione in cui si trova.
+Impossibile trovare la regione in cui si trova il terreno.
 	</notification>
 	<notification name="CannotJoinLandNothingSelected">
 		Impossibile unire il terreno:
@@ -895,7 +895,7 @@ Unisci il terreno?
 	</notification>
 	<notification name="CannotSaveToAssetStore">
 		Non è possibile salvare [NAME] nel database centrale degli asset.
-Questo normalmente è un problema temporaneo. Riadatta e salva i vestiti e riprova fra qualche minuto.
+In genere si tratta di un problema temporaneo. Attendi alcuni minuti per modificare e salvare nuovamente gli elementi indossabili.
 	</notification>
 	<notification name="YouHaveBeenLoggedOut">
 		Accidenti. Sei stato scollegato da [SECOND_LIFE]
@@ -1060,35 +1060,36 @@ Cedi questo terreno di [AREA] m² al gruppo &apos;[GROUP_NAME]&apos;?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="AvatarMovedDesired">
-		L&apos;ubicazione desiderata non è attualmente disponibile. Sei stato trasportato in una regione vicina.
+		L&apos;ubicazione prescelta non è attualmente disponibile.
+Sei stato trasferito in una regione vicina.
 	</notification>
 	<notification name="AvatarMovedLast">
-		La tua ultima ubicazione non è al momento disponibile.
-Sei stato trasferito in una regione vicina .
+		La tua ultima posizione non è al momento disponibile.
+Sei stato trasferito in una regione vicina.
 	</notification>
 	<notification name="AvatarMovedHome">
 		L&apos;ubicazione di casa tua non è al momento disponibile.
-Sei stato trasferito in un&apos;ubicazione vicina.
-Potresti impostare una nuova ubicazione.
+Sei stato trasferito in una regione vicina.
+Ti consigliamo di impostare una nuova posizione iniziale.
 	</notification>
 	<notification name="ClothingLoading">
-		Sto ancora scaricando i tuoi abiti.
-Puoi comunque usare [SECOND_LIFE] normalmente e gli altri ti vedranno correttamente.
+		Gli abiti sono in corso di scaricamento.
+Puoi comunque usare [SECOND_LIFE] normalmente e gli altri residenti ti vedranno correttamente.
 		<form name="form">
-			<ignore name="ignore" text="Lo scarico degli abiti sta impiegando parecchio tempo"/>
+			<ignore name="ignore" text="Lo scaricamento sta richiedendo parecchio tempo"/>
 		</form>
 	</notification>
 	<notification name="FirstRun">
-		L&apos;installazione di [APP_NAME] è completa.
+		L&apos;installazione di [APP_NAME] è terminata.
 
-Se questa è la prima volta che usi [SECOND_LIFE], devi creare un account prima che tu possa fare il log in.
-Vuoi ritornare su [http://join.secondlife.com secondlife.com] per creare un nuovo account?
+Se questa è la prima volta che usi [SECOND_LIFE], devi creare un account prima che tu possa effettuare l&apos;accesso.
+Vuoi tornare a [http://join.secondlife.com secondlife.com] per creare un nuovo account?
 		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Nuovo Account..."/>
 	</notification>
 	<notification name="LoginPacketNeverReceived">
-		Ci sono problemi di connessione. Può darsi che siano nella tua connessione Internet oppure in [SECOND_LIFE_GRID].
+		Ci sono problemi di connessione. È possibile che ci siano problemi con la tua connessione Internet oppure sulla [SECOND_LIFE_GRID].
 
-Puoi controllare la tua connessione Internet e riprovare fra qualche minuto, oppure cliccare Aiuto per vedere il [SUPPORT_SITE], oppure cliccare Teleport per tentare di teleportarti a casa.
+Controlla la tua connessione Internet e riprova fra qualche minuto, oppure clicca su Aiuto per visualizzare la pagina [SUPPORT_SITE], oppure clicca su Teleport per tentare il teleport a casa tua.
 		<url name="url">
 			http://it.secondlife.com/support/
 		</url>
@@ -1110,10 +1111,10 @@ Scegli un avatar maschile o femminile. Puoi sempre cambiare idea più tardi.
 		[NAME] [PRICE]L$ Non hai abbastanza L$ per farlo.
 	</notification>
 	<notification name="GrantedModifyRights">
-		[NAME] ti ha dato il permesso di editare i suoi oggetti.
+		[NAME] ti ha dato il permesso di modificare i suoi oggetti.
 	</notification>
 	<notification name="RevokedModifyRights">
-		Ti è stato revocato il permesso di modificare gli oggetti di [NAME]
+		Non sei più autorizzato a modificare gli oggetti di [NAME]
 	</notification>
 	<notification name="FlushMapVisibilityCaches">
 		Questo reinizializzerà la cache della mappa di questa regione.
@@ -1192,107 +1193,107 @@ Imposta l&apos;oggetto per la vendita e riprova.
 [DOWNLOAD_PATH].
 	</notification>
 	<notification name="DownloadWindowsMandatory">
-		E&apos; disponibile una nuova versione di [APP_NAME].
+		È disponibile una nuova versione di [APP_NAME].
 [MESSAGE]
-Devi scaricarla per usare  [APP_NAME].
+Devi scaricare questo aggiornamento per utilizzare [APP_NAME].
 		<usetemplate name="okcancelbuttons" notext="Esci" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DownloadWindows">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è obbligatorio, ma è consigliabile installarlo per migliorare le prestazioni e la stabilità.
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
 		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DownloadWindowsReleaseForDownload">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è obbligatorio, ma è consigliabile installarlo per migliorare le prestazioni e la stabilità.
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
 		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DownloadLinuxMandatory">
-		Una nuova versione di [APP_NAME] è disponibile.
+		È disponibile una nuova versione di [APP_NAME].
 [MESSAGE]
-Devi scaricare questo aggiornamento per utilizzarlo [APP_NAME].
-		<usetemplate name="okcancelbuttons" notext="Esci" yestext="Download"/>
+Devi scaricare questo aggiornamento per utilizzare [APP_NAME].
+		<usetemplate name="okcancelbuttons" notext="Esci" yestext="Scarica"/>
 	</notification>
 	<notification name="DownloadLinux">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è necessario, ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
-		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Download"/>
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
+		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica"/>
 	</notification>
 	<notification name="DownloadLinuxReleaseForDownload">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è obbligatorio, ma è consigliata l&apos;installazione per migliorare le prestazioni e l&apos;affidabilità.
-		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Download"/>
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
+		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica"/>
 	</notification>
 	<notification name="DownloadMacMandatory">
-		E&apos; disponibile una nuova versione di [APP_NAME].
+		È disponibile una nuova versione di [APP_NAME].
 [MESSAGE]
-Devi scaricarla per usare [APP_NAME].
+Devi scaricare questo aggiornamento per utilizzare [APP_NAME].
 
-Scarico nella cartella Applicazioni?
+Scaricare nella cartella Applicazioni?
 		<usetemplate name="okcancelbuttons" notext="Esci" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DownloadMac">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è obbligatorio, ma è consigliabile installarlo per migliorare le prestazioni e la stabilità.
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
 
-Scarico nella cartella Applicazioni?
+Scaricare nella cartella Applicazioni?
 		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DownloadMacReleaseForDownload">
-		E&apos; disponibile una versione aggiornata di [APP_NAME].
+		È disponibile una versione aggiornata di [APP_NAME].
 [MESSAGE]
-Questo aggiornamento non è obbligatorio, ma è consigliabile installarlo per migliorare le prestazioni e la stabilità.
+Questo aggiornamento non è necessario, ma ti consigliamo di installarlo per migliorare il rendimento e la stabilità.
 
-Scarico nella cartella Applicazioni?
+Scaricare nella cartella Applicazioni?
 		<usetemplate name="okcancelbuttons" notext="Continua" yestext="Scarica l&apos;aggiornamento"/>
 	</notification>
 	<notification name="DeedObjectToGroup">
 		La cessione di questo oggetto farà in modo che il gruppo:
 * Riceva i L$ pagati all&apos;oggetto
-		<usetemplate ignoretext="Conferma la donazione di un oggetto al gruppo" name="okcancelignore" notext="Annulla" yestext="Cedi"/>
+		<usetemplate ignoretext="Conferma la cessione di un oggetto al gruppo" name="okcancelignore" notext="Annulla" yestext="Cedi"/>
 	</notification>
 	<notification name="WebLaunchExternalTarget">
-		Vuoi aprire il browser per vedere questo contenuto?
-		<usetemplate ignoretext="Lancia il browser per vedere la pagina web" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		Vuoi aprire il browser per vedere questi contenuti?
+		<usetemplate ignoretext="Lancia il browser per consultare una pagina web" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchJoinNow">
 		Vuoi andare su [http://secondlife.com/account/ Dashboard] per gestire il tuo account?
-		<usetemplate ignoretext="Lancia il browser pe gestire il mio account" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Lancia il browser per gestire il mio account" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchSecurityIssues">
 		Visita la Wiki di [SECOND_LIFE] per i dettagli su come segnalare un problema di sicurezza.
-		<usetemplate ignoretext="Lancia il browser per imparare a segnalare un Problema di Sicurezza" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Lancia il browser per imparare a segnalare un problema di sicurezza" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchQAWiki">
 		Visita il controllo di qualità Wiki [SECOND_LIFE].
-		<usetemplate ignoretext="Lancia il browser per vedere il QA Wiki" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Lancia il browser per vedere la pagina Wiki sul controllo di qualità" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchPublicIssue">
 		Visita il registro pubblico dei problemi di [SECOND_LIFE], dove puoi segnalare bug ed altri problemi.
-		<usetemplate ignoretext="Lancia il browser per vedere il Registro dei Problemi Pubblici" name="okcancelignore" notext="Annulla" yestext="Vai alla pagina"/>
+		<usetemplate ignoretext="Lancia il browser per vedere il registro pubblico di monitoraggio dei problemi" name="okcancelignore" notext="Annulla" yestext="Vai alla pagina"/>
 	</notification>
 	<notification name="WebLaunchSupportWiki">
 		Vai al blog ufficiale Linden, per le ultime notizie ed informazioni.
 		<usetemplate ignoretext="Lancia il browser per vedere il blog" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchLSLGuide">
-		Vuoi aprire la Guida per lo Scripting per avere aiuto con lo scripting?
-		<usetemplate ignoretext="Lancia il browser per vedere la Guida per lo Scripting" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		Vuoi aprire la Guida per lo scripting per avere aiuto con lo scripting?
+		<usetemplate ignoretext="Lancia il browser per vedere la Guida per lo scripting" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="WebLaunchLSLWiki">
-		Vuoi visitare il Portale LSL per avere aiuto con lo Scripting?
+		Vuoi visitare il Portale LSL per avere aiuto con lo scripting?
 		<usetemplate ignoretext="Lancia il browser per vedere il Portale LSL" name="okcancelignore" notext="Annulla" yestext="Vai alla pagina"/>
 	</notification>
 	<notification name="ReturnToOwner">
 		Confermi di voler restituire gli oggetti selezionati ai loro proprietari? Gli oggetti trasferibili ceduti al gruppo, verranno restituiti ai proprietari precedenti.
 
 *ATTENZIONE* Gli oggetti ceduti non trasferibili verranno cancellati!
-		<usetemplate ignoretext="Conferma la restituzione degli oggetti ai loro proprietari" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Conferma prima di restituire gli oggetti ai relativi proprietari" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
 		Sei attualmente un membro del gruppo [GROUP].
@@ -1304,14 +1305,14 @@ Vuoi lasciare il gruppo?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Espelli tutti i residenti"/>
 	</notification>
 	<notification name="MuteLinden">
-		Mi dispiace, non puoi bloccare un Linden.
+		Spiacenti, non puoi bloccare un Linden.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CannotStartAuctionAlreadyForSale">
 		Non è possibile mettere in vendita all&apos;asta un terreno che è già impostato per la vendita. Disabilita la vendita del terreno, se sei certo di voler avviare una vendita all&apos;asta.
 	</notification>
-	<notification label="E&apos; fallito Il Blocco dell&apos;Oggetto" name="MuteByNameFailed">
-		Hai già bloccato questo nome.
+	<notification label="Il blocco dell&apos;oggetto in base al nome non è riuscito," name="MuteByNameFailed">
+		hai già bloccato questo nome.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="RemoveItemWarn">
@@ -1328,9 +1329,9 @@ Vuoi cancellare quell&apos;elemento?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="BusyModeSet">
-		E&apos; stata impostata la modalità Non Disponibile.
-La Chat e gli IM verranno nascosti. Gli IM riceveranno la tua risposta di Non Disponibile. Tutte le offerte di teleport verranno declinate. Tutte le offerte di Inventory andranno nel Cestino.
-		<usetemplate ignoretext="Cambio il mio stato in Non Disponibile" name="okignore" yestext="OK"/>
+		È stata impostata la modalità Non disponibile.
+La chat e gli IM verranno nascosti. Gli IM riceveranno la tua risposta di Non disponibile. Tutte le offerte di teleport verranno rifiutate. Tutte le offerte di Inventario andranno nel Cestino.
+		<usetemplate ignoretext="Cambio il mio stato sulla modalità Non disponibile" name="okignore" yestext="OK"/>
 	</notification>
 	<notification name="JoinedTooManyGroupsMember">
 		Hai raggiunto il numero massimo di gruppi. Per favore abbandona almeno un gruppo prima di aderire a questo, oppure declina l&apos;offerta.
@@ -1403,15 +1404,15 @@ La Chat e gli IM verranno nascosti. Gli IM riceveranno la tua risposta di Non Di
 	</notification>
 	<notification name="TeleportFromLandmark">
 		Sei sicuro di volere il teleport a &lt;nolink&gt;[LOCATION]&lt;/nolink&gt;?
-		<usetemplate ignoretext="Conferma il teleport verso un Landmark" name="okcancelignore" notext="Annulla" yestext="Teleportati"/>
+		<usetemplate ignoretext="Conferma il teleport verso un punto di riferimento" name="okcancelignore" notext="Annulla" yestext="Teleportati"/>
 	</notification>
 	<notification name="TeleportToPick">
 		Teleport a [PICK]?
-		<usetemplate ignoretext="Conferma il teleport verso l&apos;ubicazione nei Posti Consigliati" name="okcancelignore" notext="Annulla" yestext="Teleport"/>
+		<usetemplate ignoretext="Conferma che voglio il teleport verso l&apos;ubicazione nei Luoghi preferiti" name="okcancelignore" notext="Annulla" yestext="Teleport"/>
 	</notification>
 	<notification name="TeleportToClassified">
 		Teleport a [CLASSIFIED]?
-		<usetemplate ignoretext="Confermo il teleport verso questa ubicazione negli Annunci" name="okcancelignore" notext="Cancella" yestext="Teleport"/>
+		<usetemplate ignoretext="Conferma il teleport verso questa posizione negli annunci" name="okcancelignore" notext="Annulla" yestext="Teleport"/>
 	</notification>
 	<notification label="Manda un messaggio a tutti nella tua proprietà" name="MessageEstate">
 		Scrivi un annuncio breve che verrà mandato a tutti quelli che sono in questo momento nella tua proprietà.
@@ -1489,19 +1490,19 @@ Vuoi andare alla Knowledge Base per ulteriori informazioni sulle categorie di ac
 		<url name="url">
 			http://wiki.secondlife.com/wiki/Linden_Lab_Official:Maturity_ratings:_an_overview/it
 		</url>
-		<usetemplate ignoretext="Non posso entrare in questa Regione, a causa delle restrizioni sulla Categoria di Accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
+		<usetemplate ignoretext="Non posso entrare in questa regione a causa delle restrizioni della categoria di accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Notify">
 		Non sei ammesso in questa regione a causa della tua categoria d&apos;accesso.
 	</notification>
 	<notification name="RegionEntryAccessBlocked_Change">
-		Non ti è consentito entrare in quella Regione a causa della tua Categoria di Accesso impostata nelle Preferenze.
+		Non ti è consentito entrare in quella regione a causa della tua categoria di accesso impostata nelle preferenze.
 
-Puoi cliccare su &apos;Cambia Preferenze&apos; per alzare la tua preferenza di Categoria di Accesso e quindi riuscire ad entrare. Sarai in grado di ricercare e di accedere da adesso in poi contenuto [REGIONMATURITY]. Se più tardi volessi cambiare di nuovo le tue impostazioni, vai su Me &gt; Preferenze &gt; Generali.
+Puoi cliccare su Cambia preferenze per modificare la categoria di accesso e quindi riuscire ad entrare. Da adesso potrai accedere ai contenuti [REGIONMATURITY] ed effettuare ricerche in questa categoria. Se in seguito tu volessi cambiare di nuovo le tue impostazioni, apri la finestra di dialogo da Io &gt; Preferenze &gt; Generale.
 		<form name="form">
-			<button name="OK" text="Cambia Preferenza"/>
+			<button name="OK" text="Cambia preferenza"/>
 			<button default="true" name="Cancel" text="Chiudi"/>
-			<ignore name="ignore" text="Le mie preferenze attivate nel Rating (Classificazione) prevengono il mio ingresso in una Regione"/>
+			<ignore name="ignore" text="La categoria di accesso impostata mi impedisce di entrare in una regione"/>
 		</form>
 	</notification>
 	<notification name="LandClaimAccessBlocked">
@@ -1517,16 +1518,16 @@ Vuoi andare alla Knowledge Base per maggiori informazioni sulle categorie di acc
 		<url name="url">
 			http://wiki.secondlife.com/wiki/Linden_Lab_Official:Maturity_ratings:_an_overview/it
 		</url>
-		<usetemplate ignoretext="Non posso richiedere questo Terreno, a causa delle restrizioni sulla Categoria di Accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
+		<usetemplate ignoretext="Non posso richiedere questo terreno a causa delle restrizioni della categoria di accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
 	</notification>
 	<notification name="LandClaimAccessBlocked_Notify">
 		Non puoi prendere possesso di questa terra a causa della tua categoria di accesso.
 	</notification>
 	<notification name="LandClaimAccessBlocked_Change">
-		Non puoi richiedere questo Terreno a causa delle tue preferenze di Categoria di Accesso.
+		Non puoi richiedere questo terreno a causa della tua categoria di accesso.
 
-Puoi cliccare su &apos;Cambia Preferenze&apos; per alzare la tua preferenza di Categoria di Accesso e quindi riuscire ad entrare. Sarai in grado di ricercare e di accedere da adesso in poi contenuto [REGIONMATURITY]. Se più tardi volessi cambiare di nuovo le tue impostazioni, vai su Me &gt; Preferenze &gt; Generali.
-		<usetemplate ignoretext="Le mie preferenze di Categoria di Accesso mi impediscono di chiedere questo Terreno" name="okcancelignore" notext="Chiudi" yestext="Cambia le preferenze"/>
+Puoi cliccare su Cambia preferenze per modificare la categoria di accesso e quindi riuscire ad entrare. Da adesso potrai accedere ai contenuti [REGIONMATURITY] ed effettuare ricerche in questa categoria. Se in seguito tu volessi cambiare di nuovo le tue impostazioni, apri la finestra di dialogo da Io &gt; Preferenze &gt; Generale.
+		<usetemplate ignoretext="Le mie preferenze di categoria di accesso mi impediscono di richiedere terreno" name="okcancelignore" notext="Chiudi" yestext="Cambia le preferenze"/>
 	</notification>
 	<notification name="LandBuyAccessBlocked">
 		Non puoi acquistare questo terreno a causa della tua categoria di accesso. Questo può essere dovuto ad una mancanza di informazioni valide che confermino la tua età.
@@ -1541,16 +1542,16 @@ Vuoi andare alla Knowledge Base per maggiori informazioni sulle categorie di acc
 		<url name="url">
 			http://wiki.secondlife.com/wiki/Linden_Lab_Official:Maturity_ratings:_an_overview/it
 		</url>
-		<usetemplate ignoretext="Non posso comprare questo Terreno , a causa delle restrizioni della Categoria di Accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
+		<usetemplate ignoretext="Non posso acquistare questo terreno a causa delle restrizioni della categoria di accesso" name="okcancelignore" notext="Chiudi" yestext="Vai alla Knowledge Base"/>
 	</notification>
 	<notification name="LandBuyAccessBlocked_Notify">
 		Non puoi acquistare questa land a causa della tua categoria di accesso.
 	</notification>
 	<notification name="LandBuyAccessBlocked_Change">
-		Non puoi comprare questo Terreno a causa delle tue preferenze di Categoria di Accesso.
+		Non puoi acquistare questo terreno a causa della tua categoria di accesso.
 
-Puoi cliccare su &apos;Cambia Preferenze&apos; per alzare la tua preferenza di Categoria di Accesso e quindi riuscire ad entrare. Sarai in grado di ricercare e di accedere da adesso in poi contenuto [REGIONMATURITY]. Se più tardi volessi cambiare di nuovo le tue impostazioni, vai su Me &gt; Preferenze &gt; Generali.
-		<usetemplate ignoretext="Le mie Preferenze di Accesso mi impediscono l&apos;acquisto di questo Terreno" name="okcancelignore" notext="Chiudi" yestext="Cambia le preferenze"/>
+Puoi cliccare su Cambia preferenze per modificare la categoria di accesso e quindi riuscire ad entrare. Da adesso potrai accedere ai contenuti [REGIONMATURITY] ed effettuare ricerche in questa categoria. Se in seguito tu volessi cambiare di nuovo le tue impostazioni, apri la finestra di dialogo da Io &gt; Preferenze &gt; Generale.
+		<usetemplate ignoretext="Le mie Preferenze di accesso mi impediscono di acquistare terreno" name="okcancelignore" notext="Chiudi" yestext="Cambia le preferenze"/>
 	</notification>
 	<notification name="TooManyPrimsSelected">
 		Hai selezionato troppi prim.  Seleziona non più di [MAX_PRIM_COUNT] prim e riprova
@@ -1611,7 +1612,7 @@ Un periodo di tempo è necessario prima che la modifica venga integrata nella ma
 Per accedere a regioni per adulti, i residenti devono avere un Account verificato, mediante verifica dell&apos;età oppure mediante verifica della modalità di pagamento.
 	</notification>
 	<notification label="Versione voice non compatibile" name="VoiceVersionMismatch">
-		Questa versione di [APP_NAME] non è compatibile con le capacità di Chat Voice in questa regione. Per poter far funzionare correttamente la Chat Voice devi aggiornare [APP_NAME].
+		Questa versione di [APP_NAME] non è compatibile con la funzionalità di chat vocale in questa regione. Affinché la chat vocale funzioni correttamente, dovrai aggiornare [APP_NAME].
 	</notification>
 	<notification label="Impossibile comprare oggetti" name="BuyObjectOneOwner">
 		Impossibile comprare oggetti da proprietari diversi nello stesso momento.
@@ -1700,31 +1701,31 @@ Hai aggiornato l&apos;ubicazione di questo preferito ma gli altri dettagli conse
 Questi elementi verranno trasferiti nel tuo inventario, ma non copiati.
 
 Trasferisci gli elementi nell&apos;inventario?
-		<usetemplate ignoretext="Avvertimi quando rimuovo gli elementi  &apos;no-copy&apos; da un oggetto" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Avvertimi quando tento di rimuovore elementi per i quali non è consentita la copia da un oggetto" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="MoveInventoryFromScriptedObject">
 		Hai selezionato elementi dell&apos;inventario non copiabili.  Questi elementi verranno trasferiti nel tuo inventario, non verranno copiati.
 Dato che questo oggetto è scriptato, il trasferimento di questi elementi nel tuo inventario potrebbe causare un malfunzionamento degli script.
 
 Trasferisci gli elementi nell&apos;inventario?
-		<usetemplate ignoretext="Avvertimi se la rimozione di elementi  &apos;no-copy&apos; possono danneggiare un oggetto scriptato" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		<usetemplate ignoretext="Avvertimi se tento di rimuovore di elementi per i quali non è consentita la copia e che potrebbero danneggiare un oggetto scriptato" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ClickActionNotPayable">
-		Attenzione: E&apos; stata impostata l&apos;azione &apos;Paga Oggetto&apos;, ma funzionerà soltanto se inserisci uno script con un evento money().
+		Attenzione: l&apos;azione Paga oggetto è stata impostata, ma funzionerà soltanto se inserisci uno script con un evento money().
 		<form name="form">
-			<ignore name="ignore" text="Ho impostato l&apos;azione &apos;Paga Oggetto&apos; costruendo un oggetto senza uno script money()"/>
+			<ignore name="ignore" text="Ho impostato l&apos;azione Paga oggetto costruendo un oggetto senza uno script money()"/>
 		</form>
 	</notification>
 	<notification name="OpenObjectCannotCopy">
 		Non ci sono elementi in questo oggetto che tu possa copiare.
 	</notification>
 	<notification name="WebLaunchAccountHistory">
-		Vai su [http://secondlife.com/account/ Dashboard] per vedere la storia delle tue Transazioni?
-		<usetemplate ignoretext="Lancia il browser per vedere la storia del mio account" name="okcancelignore" notext="Annulla" yestext="Vai alla pagina"/>
+		Vai al [http://secondlife.com/account/ Dashboard] per vedere la cronologia del tuo account?
+		<usetemplate ignoretext="Lancia il browser per vedere la cronologia del mio account" name="okcancelignore" notext="Annulla" yestext="Vai alla pagina"/>
 	</notification>
 	<notification name="ConfirmQuit">
 		Confermi di voler uscire?
-		<usetemplate ignoretext="Conferma Uscita" name="okcancelignore" notext="Non Uscire" yestext="Esci"/>
+		<usetemplate ignoretext="Conferma prima di uscire" name="okcancelignore" notext="Non uscire" yestext="Esci"/>
 	</notification>
 	<notification name="HelpReportAbuseEmailLL">
 		Usa questo strumento per segnalare violazioni a [http://secondlife.com/corporate/tos.php Terms of Service] e [http://secondlife.com/corporate/cs.php Community Standards].
@@ -1753,15 +1754,15 @@ Devi essere il più specifico possibile, includendo i nomi e i dettagli dell&apo
 Inserendo una descrizione accurata ci aiuti a gestire ed elaborare le segnalazioni di abuso.
 	</notification>
 	<notification name="HelpReportAbuseContainsCopyright">
-		Gentile Residente,
+		Gentile residente,
 
-Sembra che tu stia segnalando una violazione di proprietà intellettuale. Cerca di essere sicuro che la tua segnalazione stia riportando correttamente:
+Ci risulta che tu stia segnalando una violazione di proprietà intellettuale. Per segnalare correttamente la violazione:
 
-(1) Il processo di Abuso. Puoi inviare una segnalazione di abuso se ritieni che un residente stia sfruttando il sistema di permessi di [SECOND_LIFE], per esempio usando CopyBot o simili strumenti di copia, per rubare i diritti della proprietà intellettuale. L&apos;Ufficio Abusi investigherà e deciderà adeguate azioni disciplinari per comportamenti che violano i [http://secondlife.com/corporate/tos.php Termini di Servizio] di  [SECOND_LIFE] oppure i  [http://secondlife.com/corporate/cs.php Standard di Comunità]. Si tenga però presente che l&apos;ufficio Abusi non gestisce e non risponde alle richieste di rimozione di contentuo da [SECOND_LIFE].
+(1) Definizione di abuso. Puoi inviare una segnalazione di abuso se ritieni che un residente stia sfruttando il sistema di permessi di [SECOND_LIFE], per esempio usando CopyBot o simili strumenti di copia, per rubare i diritti di proprietà intellettuale. L&apos;Ufficio abusi investigherà e deciderà adeguate azioni disciplinari per comportamenti che violano i [http://secondlife.com/corporate/tos.php Termini del servizio] di  [SECOND_LIFE] oppure gli  [http://secondlife.com/corporate/cs.php Standard della comunità]. Tieni comunque presente che l&apos;Ufficio abusi non gestisce e non risponde alle richieste di rimozione di contenuti da [SECOND_LIFE].
 
-(2) Il processo di rimozione DMCA o processo di rimozione dei contenuti. Per richiedere la rimozione di contenuto da [SECOND_LIFE], DEVI compilare una denuncia valid di furto come definito nella nostra  [http://secondlife.com/corporate/dmca.php Policy DMCA].
+(2) DMCA o rimozione di contenuti. Per richiedere la rimozione di contenuti da [SECOND_LIFE], devi compilare una denuncia valida di violazione come definito nelle nostra  [http://secondlife.com/corporate/dmca.php Regole DMCA] (leggi sul copyright).
 
-Se desideri egualmente continuare con il processo di Abuso, chiudi questa finestra e completa la compilazione della segnalazione. Puoi specificare la categoria specifica  &apos;CopyBot o Sfruttamento Permessi&apos;.
+Per continuare con il procedimento di abuso, chiudi questa finestra e completa la compilazione della segnalazione.  È possibile che dovrai specificare la categoria CopyBot o Sfruttamento dei diritti.
 
 Grazie,
 
@@ -1775,7 +1776,7 @@ Linden Lab
 		C&apos;è già un oggetto indossato in questo punto del corpo.
 Vuoi sostituirlo con l&apos;oggetto selezionato?
 		<form name="form">
-			<ignore name="ignore" save_option="true" text="Sostituisci un preesistente attachment con l&apos;elemento selezionato"/>
+			<ignore name="ignore" save_option="true" text="Sostituisci un pezzo collegato con l&apos;elemento selezionato"/>
 			<button ignore="Replace Automatically" name="Yes" text="OK"/>
 			<button ignore="Never Replace" name="No" text="Annulla"/>
 		</form>
@@ -1785,21 +1786,21 @@ Vuoi sostituirlo con l&apos;oggetto selezionato?
 
 Desideri abbandonare la modalità &apos;Occupato&apos; prima di completare questa transazione?
 		<form name="form">
-			<ignore name="ignore" save_option="true" text="Sto per pagare una persona o un oggetto mentro sono Non Disponibile"/>
+			<ignore name="ignore" save_option="true" text="Sto per pagare una persona o un oggetto mentro sono in modalià Non disponibile"/>
 			<button ignore="Always leave Busy Mode" name="Yes" text="OK"/>
 			<button ignore="Never leave Busy Mode" name="No" text="Abbandona"/>
 		</form>
 	</notification>
 	<notification name="ConfirmDeleteProtectedCategory">
-		La cartella &apos;[FOLDERNAME]&apos; è una cartella di sistema. La cancellazione delle cartelle di sistema può creare instabilità.  Sei sicuro di volerla cancellare?
-		<usetemplate ignoretext="Conferma prima di cancellare una cartella di sistema" name="okcancelignore" notext="Cancella" yestext="OK"/>
+		La cartella &apos;[FOLDERNAME]&apos; è una cartella di sistema. L&apos;eliminazione di cartelle di sistema può creare instabilità.  Sei sicuro di volerla eliminare?
+		<usetemplate ignoretext="Chiedi conferma prima di eliminare una cartella di sistema" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmEmptyTrash">
-		Vuoi veramente cancellare permanentemente il contenuto del tuo Cestino?
-		<usetemplate ignoretext="Conferma lo svuotamento del contenuto del Cestino" name="okcancelignore" notext="Annulla" yestext="OK"/>
+		Vuoi veramente eliminare in modo permanente il contenuto del tuo Cestino?
+		<usetemplate ignoretext="Conferma prima di svuotare la cartella del Cestino inventario" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmClearBrowserCache">
-		Vuoi veramente cancellare la storia dei viaggi, web e delle ricerche fatte?
+		Vuoi veramente eliminare la cronologia viaggi, web e ricerche fatte?
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="ConfirmClearCookies">
@@ -1811,14 +1812,14 @@ Desideri abbandonare la modalità &apos;Occupato&apos; prima di completare quest
 		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="Si"/>
 	</notification>
 	<notification name="ConfirmEmptyLostAndFound">
-		Vuoi veramente cancellare permanentemente il contenuto dei tuoi Persi e Ritrovati?
-		<usetemplate ignoretext="Conferma lo svuotamento della cartella Persi e Ritrovati" name="okcancelignore" notext="No" yestext="Si"/>
+		Vuoi veramente eliminare in modo definitivo il contenuto dei tuoi Oggetti smarriti?
+		<usetemplate ignoretext="Conferma prima di svuotare della cartella Oggetti smarriti" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="CopySLURL">
 		Lo SLurl seguente è stato copiato negli Appunti:
  [SLURL]
 
-Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubicazione, o provala incollandola nella barra indirizzo di un browser web.
+Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubicazione, o provala incollandola nella barra degli indirizzi di un browser web.
 		<form name="form">
 			<ignore name="ignore" text="Lo SLurl è stato copiato negli Appunti"/>
 		</form>
@@ -1886,18 +1887,18 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="Cannot_Purchase_an_Attachment">
-		Non puoi comprare un oggetto mentre è indossato.
+		Non puoi comprare un oggetto mentre è unito.
 	</notification>
 	<notification label="Informazioni sulle richieste per il permesso di addebito" name="DebitPermissionDetails">
 		Accettare questa richiesta da allo script il permesso continuativo di prendere Linden dollar (L$) dal tuo account. Per revocare questo permesso, il proprietario dell&apos;oggetto deve cancellare l&apos;oggetto oppure reimpostare gli script nell&apos;oggetto.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="AutoWearNewClothing">
-		Vuoi indossare automaticamente gli oggetti che stai per creare?
-		<usetemplate ignoretext="Indossa gli abiti che creo mentre modifico il Mio Aspetto" name="okcancelignore" notext="No" yestext="Si"/>
+		Vuoi indossare automaticamente gli indumenti che stai per creare?
+		<usetemplate ignoretext="Indossare gli abiti che creo mentre modifico il mio aspetto" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="NotAgeVerified">
-		Devi avere l&apos;Età Verificata per visitare quest&apos;area. Vuoi andare sul sito [SECOND_LIFE] per verificare la tua età?
+		Per entrare in questa zona, devi avere eseguito la verifica dell&apos;età.  Vuoi andare sul sito di [SECOND_LIFE] per verificare la tua età?
 
 [_URL]
 		<url name="url" option="0">
@@ -1906,13 +1907,13 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 		<usetemplate ignoretext="Non ho verificato la mia età" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="Cannot enter parcel: no payment info on file">
-		Devi avere le Informazioni di Pagamento registrate per poter visitare quest&apos;area. Vuoi andare sul sito di [SECOND_LIFE] ed impostarle?
+		Per poter visitare questa zona devi avere devi aver fornito informazioni di pagamento a Linden Lab.  Vuoi andare sul sito di [SECOND_LIFE] ed impostarle?
 
 [_URL]
 		<url name="url" option="0">
 			https://secondlife.com/account/index.php?lang=it
 		</url>
-		<usetemplate ignoretext="Manca la registrazione delle Informazioni di Pagamento" name="okcancelignore" notext="No" yestext="Si"/>
+		<usetemplate ignoretext="Manca la registrazione delle informazioni di pagamento" name="okcancelignore" notext="No" yestext="Si"/>
 	</notification>
 	<notification name="MissingString">
 		La stringa [STRING_NAME] non è presente in strings.xml
@@ -1942,7 +1943,7 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 		[FIRST] [LAST] è Offline
 	</notification>
 	<notification name="AddSelfFriend">
-		Anche se sei molto piacevole, non puoi aggiungerti come amicizia.
+		Anche se sei molto simpatico, non puoi aggiungere te stesso all&apos;elenco degli amici.
 	</notification>
 	<notification name="UploadingAuctionSnapshot">
 		Sto importando le fotografie per l&apos;uso inworld e per il web...
@@ -1961,7 +1962,7 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 		Terrain.raw caricato
 	</notification>
 	<notification name="GestureMissing">
-		Manca la Gesture [NAME] dal database.
+		Manca la gesture [NAME] dal database.
 	</notification>
 	<notification name="UnableToLoadGesture">
 		Impossibile caricare la gesture [NAME].
@@ -1973,14 +1974,14 @@ Inseriscilo in una pagina web per dare ad altri un accesso facile a questa ubica
 		Impossibile caricare il Landmark di riferimento. Riprova.
 	</notification>
 	<notification name="CapsKeyOn">
-		Hai il Blocco delle Maiuscole attivato.
-Questo potrebbe influenzare la tua password.
+		Hai il blocco delle maiuscole attivato.
+Questo potrebbe incidere sulla tua password.
 	</notification>
 	<notification name="NotecardMissing">
 		Notecard non trovata nel database.
 	</notification>
 	<notification name="NotecardNoPermissions">
-		Non hai il permesso di vedere questa notecard.
+		Non hai il permesso di vedere questo biglietto.
 	</notification>
 	<notification name="RezItemNoPermissions">
 		Permessi insufficienti per creare un oggetto.
@@ -2018,7 +2019,7 @@ Riprova.
 Riprova.
 	</notification>
 	<notification name="CannotBuyObjectsFromDifferentOwners">
-		Puoi comprare oggetti solo da un proprietario per volta.
+		Puoi acquistare oggetti soltanto da un proprietario per volta.
 Seleziona solo un oggetto.
 	</notification>
 	<notification name="ObjectNotForSale">
@@ -2031,10 +2032,10 @@ Seleziona solo un oggetto.
 		Esci dalla modalità divina, livello [LEVEL]
 	</notification>
 	<notification name="CopyFailed">
-		Non hai i permessi per copiare.
+		Non hai l&apos;autorizzazione a copiare.
 	</notification>
 	<notification name="InventoryAccepted">
-		[NAME] ha ricevuto la tua offerta di Inventory.
+		[NAME] ha ricevuto la tua offerta di inventario.
 	</notification>
 	<notification name="InventoryDeclined">
 		[NAME] non ha accettato la tua offerta dall&apos;inventario.
@@ -2049,9 +2050,9 @@ Seleziona solo un oggetto.
 		Il tuo biglietto da visita non è stato accettato.
 	</notification>
 	<notification name="TeleportToLandmark">
-		Puoi teleportarti alle ubicazioni come  &apos;[NAME]&apos; aprendo il pannello Luoghi sul lato destro dello schermo, e quindi selezionare la linguetta Landmarks.
-Clicca su un landmark per selezionarlo e quindi clicca  &apos;Teleport&apos; sul fondo del pannello.
-(Puoi anche fare doppio-click sul landmark oppure cliccarlo con il tasto destro e scegliere &apos;Teleport&apos;.)
+		Puoi teleportarti alle ubicazioni come &apos;[NAME]&apos; aprendo il pannello Luoghi sul lato destro dello schermo, quindi selezionare la scheda Punti di riferimento.
+Clicca su un punto di riferimento per selezionarlo, quindi clicca su Teleport sul lato inferiore del pannello.
+(Puoi anche fare doppio clic sul punto di riferimento oppure cliccare su di esso con il tasto destro del mouse e scegliere Teleport.)
 	</notification>
 	<notification name="TeleportToPerson">
 		Puoi contattare il residente &apos;[NAME]&apos; aprendo il pannello Persone nel lato destro del tuo schermo.
@@ -2106,19 +2107,19 @@ Prova a selezionare una parte di terreno più piccola.
 [NAMES]
 	</notification>
 	<notification name="NoQuickTime">
-		Il Software QuickTime di Apple non sembra installato sul tuo computer.
-Se vuoi vedere contenuto multimediale sugli appezzamenti che lo supportano devi andare su [http://www.apple.com/quicktime QuickTime site] e installare il Player QuickTime.
+		Il software QuickTime di Apple sembra non essere installato sul tuo computer.
+Se vuoi vedere contenuto multimediale in streaming sui lotti che lo supportano, vai alla pagina [http://www.apple.com/quicktime QuickTime] e installa il Player QuickTime.
 	</notification>
 	<notification name="NoPlugin">
-		Nessun Media Plugin è stato trovato per gestire &quot;[MIME_TYPE]&quot; il tipo mime.  Il Media di questo tipo non è disponibile.
+		Non è stato trovato alcun plugin multimediale per gestire il tipo mime [MIME_TYPE].  Il media di questo tipo non è disponibile.
 	</notification>
 	<notification name="MediaPluginFailed">
-		Questo Media Plugin non funziona:
+		Questo plugin multimediale non funziona:
     [PLUGIN]
 
-Per favore re-installa il plugin o contatta il venditore se continui ad avere questi problemi.
+Reinstalla il plugin o contatta il venditore se continui ad avere questi problemi.
 		<form name="form">
-			<ignore name="ignore" text="Mancato funzionamento del Media Plugin"/>
+			<ignore name="ignore" text="Mancato funzionamento del plugin multimediale"/>
 		</form>
 	</notification>
 	<notification name="OwnedObjectsReturned">
@@ -2143,21 +2144,21 @@ Gli oggetti non trasferibili che erano stati ceduti al gruppo sono stati cancell
 &lt;nolink&gt;[MSG]&lt;/nolink&gt;
 	</notification>
 	<notification name="NotSafe">
-		Questo terreno è abilitato ai Danni da combattimento.
-Qui potresti ricevere ferite. Se dovessi morire verrai teleportato a casa tua.
+		Su questo terreno sono abilitati i danni.
+Qui potresti essere ferito. Se dovessi morire verrai teleportato a casa tua.
 	</notification>
 	<notification name="NoFly">
-		Quest&apos;are ha il volo disabilitato.
+		In questa zona è proibito il volo.
 Qui non puoi volare.
 	</notification>
 	<notification name="PushRestricted">
-		Quest&apos;area non consente le spinte. Non puoi spingere gli altri a meno che tu non sia il proprietario del terreno.
+		Questa zona non consente le spinte. Non puoi spingere gli altri a meno che tu non sia il proprietario del terreno.
 	</notification>
 	<notification name="NoVoice">
-		Quest&apos;area ha la chat voice disabilitata. Non puoi sentire nessuno parlare.
+		Questa zona ha la chat vocale disattivata. Non puoi sentire nessuno parlare.
 	</notification>
 	<notification name="NoBuild">
-		Quest&apos;area ha il building disabilitato. Qui non puoi costruire o rezzare oggetti.
+		In questa zona è proibita la costruzione. Qui non puoi costruire né rezzare oggetti.
 	</notification>
 	<notification name="ScriptsStopped">
 		Un amministratore ha temporaneamente disabilitato gli script in questa regione.
@@ -2168,10 +2169,10 @@ Qui non puoi volare.
 	<notification name="NoOutsideScripts">
 		Questo terreno non consente script esterni.
 
-Qui funzinano solo gli script del proprietario del terreno.
+Qui funzionano soltanto gli script del proprietario del terreno.
 	</notification>
 	<notification name="ClaimPublicLand">
-		Puoi solo chiedere terreni pubblici nella regione in cui sei posizionato.
+		Puoi solo richiedere terreni pubblici nella regione in cui sei posizionato.
 	</notification>
 	<notification name="RegionTPAccessBlocked">
 		Non puoi entrare in quella regione a causa della tua categoria di accesso. Può essere necessario validare l&apos;età e/o installare l&apos;ultima versione del programma.
@@ -2352,12 +2353,12 @@ Questo sarà aggiunto nel tuo inventario come segnalibro per consentirti di invi
 		</form>
 	</notification>
 	<notification name="RegionRestartMinutes">
-		Questa regione farà il restart fra [MINUTES] minuti.
-Se rimani qui verrai disconnesso.
+		Questa regione verrà riavviata fra [MINUTES] minuti.
+Se rimani qui verrai scollegato da Second Life.
 	</notification>
 	<notification name="RegionRestartSeconds">
-		Questa regione farà il restart fra  [SECONDS] secondi.
-Se rimani qui verrai disconnesso.
+		Questa regione verrà riavviata fra [SECONDS] secondi.
+Se rimani qui verrai scollegato da Second Life.
 	</notification>
 	<notification name="LoadWebPage">
 		Caricare pagina web [URL]?
@@ -2394,9 +2395,9 @@ Va bene?
 		Un oggetto di nome &apos;[OBJECTNAME]&apos;, posseduto da  &apos;[NAME]&apos; vorrebbe:
 
 [QUESTIONS]
-Se non ti fidi di questo oggetto e del suo creatore dovresti declinare la richiesta.
+Se non ti fidi di questo oggetto e del suo ideatore, dovresti rifiutare la richiesta.
 
-Consenti questa richiesta?
+Concedi questa richiesta?
 		<form name="form">
 			<button name="Grant" text="Accetta"/>
 			<button name="Deny" text="Nega"/>
@@ -2418,11 +2419,11 @@ Consenti questa richiesta?
 		</form>
 	</notification>
 	<notification name="BuyLindenDollarSuccess">
-		Grazie per il pagamento!
+		Grazie per aver inviato il pagamento.
 
-Il tuo saldo in L$ sarà aggiornato al termine dell&apos;elaborazione. Se l&apos;elaborazione dovesse impiegare più di 20 minuti, la transazione verrà annullata. In quel caso l&apos;ammontare dell&apos;acquisto verrà rimborsato nel tuo saldo in US$.
+Il tuo saldo in L$ sarà aggiornato al termine dell&apos;elaborazione. Se l&apos;elaborazione dovesse impiegare più di 20 minuti, la transazione verrà annullata. In quel caso l&apos;ammontare dell&apos;acquisto verrà accreditato sul tuo saldo in US$.
 
-Lo stato del tuo pagamento potrà essere controllato nella pagina della Storia delle tue Transazioni su  [http://secondlife.com/account/ Pannello di Controllo]
+Potrai controllare lo stato del pagamento nella pagina della cronologia delle transazioni nel tuo [http://secondlife.com/account/ Dashboard]
 	</notification>
 	<notification name="FirstOverrideKeys">
 		I tuoi movimenti della tastiera vengono ora gestiti da un oggetto.
@@ -2431,16 +2432,16 @@ Alcuni oggetti (come pistole) richiedono di andare in mouselook per il loro util
 Premi &apos;M&apos; per farlo.
 	</notification>
 	<notification name="FirstSandbox">
-		Questa è una Sandbox, serve per aiutare i Residenti ad imparare a costruire.
+		Questa è una Sandbox, serve ai residenti per imparare a costruire.
 
-Gli oggetti che costruisci qui saranno cancellati dopo che te ne sei andato, perciò non dimenticare di cliccare sulle tue creazioni col tasto destro e scegliere &apos;Prendi&apos; per trasferirle nel tuo Inventory.
+Gli oggetti che costruisci qui verranno eliminati dopo che te ne sei andato, perciò non dimenticare di cliccare sulle tue creazioni col tasto destro del mouse e scegliere Prendi per trasferirle nel tuo Inventario.
 	</notification>
 	<notification name="MaxListSelectMessage">
 		È possibile selezionare solo fino a [MAX_SELECT] oggetti da questa lista.
 	</notification>
 	<notification name="VoiceInviteP2P">
-		[NAME] ti sta invitando ad una chiamata in Chat Voice.
-Clicca Accetta per unirti alla chiamata oppure Declina per declinare l&apos;invito. Clicca Blocca per bloccare questo chiamante.
+		[NAME] ti sta invitando ad una chiamata in chat vocale.
+Clicca su Accetta per unirti alla chiamata oppure su Declina to declinare l&apos;invito. Clicca su Blocca per bloccare questo chiamante.
 		<form name="form">
 			<button name="Accept" text="Accetta"/>
 			<button name="Decline" text="Rifiuta"/>
@@ -2448,17 +2449,17 @@ Clicca Accetta per unirti alla chiamata oppure Declina per declinare l&apos;invi
 		</form>
 	</notification>
 	<notification name="AutoUnmuteByIM">
-		Hai appena inviato un IM a [FIRST] [LAST], che è stato automaticamente sbloccato.
+		[FIRST] [LAST] ha ricevuto un IM ed è stato automaticamente sbloccato.
 	</notification>
 	<notification name="AutoUnmuteByMoney">
-		Hai appena inviato del denaro a [FIRST] [LAST], che è stato automaticamente sbloccato.
+		[FIRST] [LAST] ha ricevuto del denaro e pertanto è stato automaticamente sbloccato.
 	</notification>
 	<notification name="AutoUnmuteByInventory">
-		Hai appena offerto un elemento dell&apos;Inventory a [FIRST] [LAST], che è stato automaticamente sbloccato.
+		A [FIRST] [LAST] è stato offerto un elemento dell&apos;Inventario e pertanto è stato automaticamente sbloccato.
 	</notification>
 	<notification name="VoiceInviteGroup">
-		[NAME] si è aggiunto alla chiamata in Chat Voice con il gruppo [GROUP].
-Clicca  Accetta per unirti alla chiamata oppure  Declina per declinare l&apos;invito. Clicca Blocca per bloccare questo chiamante.
+		[NAME] si è aggiunto alla chiamata in chat vocale con il gruppo [GROUP].
+Clicca su Accetta per unirti alla chiamata oppure su Declina to declinare l&apos;invito. Clicca su Blocca per bloccare questo chiamante.
 		<form name="form">
 			<button name="Accept" text="Accetta"/>
 			<button name="Decline" text="Rifiuta"/>
@@ -2466,8 +2467,8 @@ Clicca  Accetta per unirti alla chiamata oppure  Declina per declinare l&apos;in
 		</form>
 	</notification>
 	<notification name="VoiceInviteAdHoc">
-		[NAME] si è aggiunto alla chiamata in Chat Voice con una conferenza.
-Clicca Accetta per unirti alla chiamata oppure Declina to declinare l&apos;invito. Clicca Blocca per bloccare questo chiamante.
+		[NAME] si è aggiunto alla chiamata in chat vocale con una conferenza.
+Clicca su Accetta per unirti alla chiamata oppure su Declina to declinare l&apos;invito. Clicca su Blocca per bloccare questo chiamante.
 		<form name="form">
 			<button name="Accept" text="Accetta"/>
 			<button name="Decline" text="Rifiuta"/>
@@ -2476,7 +2477,7 @@ Clicca Accetta per unirti alla chiamata oppure Declina to declinare l&apos;invit
 	</notification>
 	<notification name="InviteAdHoc">
 		[NAME] ti sta invitando ad una conferenza in chat.
-Clicca Accetta per unirti alla chat oppure  Declina per declinare l&apos;invito. Clicca Blocca per bloccare questo chiamante.
+Clicca su Accetta per unirti alla chat oppure su Declina per declinare l&apos;invito. Clicca su Blocca per bloccare questo chiamante.
 		<form name="form">
 			<button name="Accept" text="Accetta"/>
 			<button name="Decline" text="Rifiuta"/>
@@ -2490,25 +2491,25 @@ Clicca Accetta per unirti alla chat oppure  Declina per declinare l&apos;invito.
 		Siamo spiacenti.  Questa area ha raggiunto la capacità massima per le chiamate voice.  Si prega di provare ad usare il voice in un&apos;altra area.
 	</notification>
 	<notification name="VoiceChannelDisconnected">
-		Sei stato disconnesso da [VOICE_CHANNEL_NAME].  Verrai ora riconnesso alla Chat Voice Locale.
+		Sei stato scollegato da [VOICE_CHANNEL_NAME].  Verrai ora ricollegato alla chat vocale nei dintorni.
 	</notification>
 	<notification name="VoiceChannelDisconnectedP2P">
-		[VOICE_CHANNEL_NAME] ha terminato la chiamata.  Verrai ora riconnesso alla Chat Voice Locale.
+		[VOICE_CHANNEL_NAME] ha chiuso la chiamata.  Verrai ora ricollegato alla chat vocale nei dintorni.
 	</notification>
 	<notification name="P2PCallDeclined">
-		[VOICE_CHANNEL_NAME] ha declinato la tua chiamata. Verrai ora riconnesso alla Chat Voice Locale.
+		[VOICE_CHANNEL_NAME] ha declinato la tua chiamata.  Verrai ora ricollegato alla chat vocale nei dintorni.
 	</notification>
 	<notification name="P2PCallNoAnswer">
-		[VOICE_CHANNEL_NAME] non è disponibile per la tua chiamata. Verrai ora riconnesso alla Chat Voice Locale.
+		[VOICE_CHANNEL_NAME] non è disponibile per la tua chiamata.  Verrai ora ricollegato alla chat vocale nei dintorni.
 	</notification>
 	<notification name="VoiceChannelJoinFailed">
-		Connessione a [VOICE_CHANNEL_NAME] fallita, riprova più tardi.  Verrai ora riconnesso alla Chat Voice Locale.
+		Collegamento a [VOICE_CHANNEL_NAME] non riuscito, riprova più tardi.  Verrai ora ricollegato alla chat vocale nei dintorni.
 	</notification>
 	<notification name="VoiceLoginRetry">
 		Stiamo creando una canale voice per te. Questo può richiedere fino a un minuto.
 	</notification>
 	<notification name="Cannot enter parcel: not a group member">
-		Soltanto i membri di uno specifico gruppo possono visitare quest&apos;area.
+		Soltanto i membri di un determinato gruppo possono visitare questa zona.
 	</notification>
 	<notification name="Cannot enter parcel: banned">
 		Non puoi entrare nel terreno, sei stato bloccato.
@@ -2523,17 +2524,17 @@ Clicca Accetta per unirti alla chat oppure  Declina per declinare l&apos;invito.
 		Si è verificato un errore durante il tentativo di collegarti a una voice chat con [VOICE_CHANNEL_NAME].  Riprova più tardi.
 	</notification>
 	<notification name="ServerVersionChanged">
-		Sei appena entrato in una regione che usa una versione differente del server, questo potrebbe influenzare le prestazioni. [[URL] Guarda le Release Notes.]
+		Sei appena entrato in una regione che usa una versione differente del server: ciò potrebbe incidere sule prestazioni. [[URL] Visualizza le note sulla versione.]
 	</notification>
 	<notification name="UnsupportedCommandSLURL">
-		Lo SLurl che hai cliccato non è attivo.
+		Lo SLurl su cui hai cliccato non è valido.
 	</notification>
 	<notification name="BlockedSLURL">
-		Uno SLurl è stato ricevuto da un browser sconosciuto e per la tua sicurezza è stato bloccato.
+		Uno SLurl è stato ricevuto da un browser sconosciuto o non sicuro e, per sicurezza, è stato bloccato.
 	</notification>
 	<notification name="ThrottledSLURL">
-		Multipli SLurls sono stati ricevuti da un browser sconosciuto in un breve periodo.
-Per la tua sicurezza verranno bloccati per alcuni secondi.
+		Sono stati ricevuti più SLurl da un browser sconosciuto o non sicuro in un breve periodo di tempo.
+Per sicurezza, verranno bloccati per alcuni secondi.
 	</notification>
 	<notification name="IMToast">
 		[MESSAGE]
@@ -2546,18 +2547,18 @@ Per la tua sicurezza verranno bloccati per alcuni secondi.
 		<usetemplate ignoretext="Conferma prima della chiusura di tutti gli IM" name="okcancelignore" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="AttachmentSaved">
-		L&apos;Allegato (Attachment) è stato salvato.
+		L&apos;elemento da collegare è stato salvato.
 	</notification>
 	<notification name="UnableToFindHelpTopic">
-		Impossibilitato a trovare il tema aiuto per questo elemento (nozione)???!!!!.
+		Impossibile trovare l&apos;argomento nell&apos;aiuto per questo elemento.
 	</notification>
 	<notification name="ObjectMediaFailure">
-		Errore del Server: aggiornamento del Media o mancato funzionamento.
+		Errore del server: mancato aggiornamento o ottenimento del media.
 &apos;[ERROR]&apos;
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="TextChatIsMutedByModerator">
-		Il tuo testo nella chat è stato interrotto dal moderatore.
+		La tua chat di testo è stata interrotta dal moderatore.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="VoiceIsMutedByModerator">
@@ -2566,19 +2567,19 @@ Per la tua sicurezza verranno bloccati per alcuni secondi.
 	</notification>
 	<notification name="ConfirmClearTeleportHistory">
 		Sei sicuro di volere cancellare la cronologia dei tuoi teleport?
-		<usetemplate name="okcancelbuttons" notext="Cancella" yestext="OK"/>
+		<usetemplate name="okcancelbuttons" notext="Annulla" yestext="OK"/>
 	</notification>
 	<notification name="BottomTrayButtonCanNotBeShown">
-		Il bottone selezionato non può essere mostrato in questo momento.
-Il bottone verrà mostrato quando ci sarà abbastanza spazio.
+		Il pulsante selezionato non può essere visualizzato in questo momento.
+Il pulsante verrà visualizzato quando lo spazio sarà sufficiente.
 	</notification>
 	<global name="UnsupportedCPU">
 		- La velocità della tua CPU non soddisfa i requisiti minimi.
 	</global>
 	<global name="UnsupportedGLRequirements">
-		Non sembra che tu abbia i requisiti hardware adeguati per [APP_NAME]. [APP_NAME] richiede una scheda grafica OpenGL con supporto multitexture. Se tu ce l&apos;hai, dovresti accertarti di avere i driver, i service pack e le patch più recenti della scheda grafica e del tuo sistema operativo.
+		Non sembra che tu abbia i requisiti hardware adeguati per [APP_NAME]. [APP_NAME] richiede una scheda grafica OpenGL con supporto multitexture. Se ne hai una in dotazione, accertati di avere i driver, i service pack e i patch più recenti per la scheda grafica e per il sistema operativo.
 
-Se continui ad avere problemi, visita [SUPPORT_SITE].
+Se continui ad avere problemi, visita la pagina [SUPPORT_SITE].
 	</global>
 	<global name="UnsupportedCPUAmount">
 		796
@@ -2593,7 +2594,7 @@ Se continui ad avere problemi, visita [SUPPORT_SITE].
 		- La memoria del tuo sistema non soddisfa i requisiti minimi.
 	</global>
 	<global name="You can only set your &apos;Home Location&apos; on your land or at a mainland Infohub.">
-		Se possiedi una parte di terra, puoi creare qui la tua ubicazione di casa.
-Altrimenti, puoi guardare sulla Mappa e trovare luoghi segnalati come &quot;Infohub&quot;.
+		Se sei proprietario di un appezzamento di terreno, puoi definirlo come la tua posizione iniziale.
+In alternativa, puoi guardare sulla mappa e trovare luoghi segnalati come &quot;Infohub&quot;.
 	</global>
 </notifications>
diff --git a/indra/newview/skins/default/xui/it/panel_notes.xml b/indra/newview/skins/default/xui/it/panel_notes.xml
index cb805dae49..9ce6b47a32 100644
--- a/indra/newview/skins/default/xui/it/panel_notes.xml
+++ b/indra/newview/skins/default/xui/it/panel_notes.xml
@@ -1,20 +1,20 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Note &amp; Privacy" name="panel_notes">
+<panel label="Note e Privacy" name="panel_notes">
 	<layout_stack name="layout">
 		<panel name="notes_stack">
 			<scroll_container name="profile_scroll">
 				<panel name="profile_scroll_panel">
 					<text name="status_message" value="Le mie note private:"/>
-					<text name="status_message2" value="Permetti a questa persona di:"/>
-					<check_box label="Vedermi On-line" name="status_check"/>
-					<check_box label="Vedermi sull mappa" name="map_check"/>
-					<check_box label="Modificare, cancellare o prendere i miei oggetti" name="objects_check"/>
+					<text name="status_message2" value="Consenti a questa persona di:"/>
+					<check_box label="Vedere se sono online" name="status_check"/>
+					<check_box label="Vedermi sulla mappa" name="map_check"/>
+					<check_box label="Modificare, eliminare o prendere i miei oggetti" name="objects_check"/>
 				</panel>
 			</scroll_container>
 		</panel>
 		<panel name="notes_buttons_panel">
 			<button label="Aggiungi amico" name="add_friend" tool_tip="Offri amicizia a questo residente"/>
-			<button label="IM" name="im" tool_tip="Apri una sessione di messaggio istantaneo"/>
+			<button label="IM" name="im" tool_tip="Apri una sessione messaggio istantaneo"/>
 			<button label="Chiama" name="call" tool_tip="Chiama questo residente"/>
 			<button label="Mappa" name="show_on_map_btn" tool_tip="Mostra il residente sulla mappa"/>
 			<button label="Teleport" name="teleport" tool_tip="Offri teleport"/>
-- 
cgit v1.2.3


From 28e3190296f7d6791e6fd0297f9fcab10239648f Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Fri, 26 Mar 2010 16:19:34 -0700
Subject: Fix a couple of minor issues with the central cookie storage code.

Made LLViewerMedia::clearAllCookies() delete the new per-user cookie file (userdir/plugin_cookies.txt) as well as the old one.

Made LLViewerMedia::loadCookieFile() send the clear_cookies message to all loaded plugins.
---
 indra/newview/llviewermedia.cpp | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 8863bf187d..ab55fcff6e 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1018,6 +1018,7 @@ void LLViewerMedia::clearAllCookies()
 	// Places that cookie files can be:
 	// <getOSUserAppDir>/browser_profile/cookies
 	// <getOSUserAppDir>/first_last/browser_profile/cookies  (note that there may be any number of these!)
+	// <getOSUserAppDir>/first_last/plugin_cookies.txt  (note that there may be any number of these!)
 	
 	std::string base_dir = gDirUtilp->getOSUserAppDir() + gDirUtilp->getDirDelimiter();
 	std::string target;
@@ -1050,6 +1051,16 @@ void LLViewerMedia::clearAllCookies()
 		{	
 			LLFile::remove(target);
 		}
+
+		target = base_dir;
+		target += filename;
+		target += gDirUtilp->getDirDelimiter();
+		target += PLUGIN_COOKIE_FILE_NAME;
+		lldebugs << "target = " << target << llendl;
+		if(LLFile::isfile(target))
+		{	
+			LLFile::remove(target);
+		}
 	}
 	
 	
@@ -1142,7 +1153,18 @@ void LLViewerMedia::loadCookieFile()
 
 	file.close();
 	
-	// TODO: send the clear_cookies message to all loaded plugins
+	// send the clear_cookies message to all loaded plugins
+	impl_list::iterator iter = sViewerMediaImplList.begin();
+	impl_list::iterator end = sViewerMediaImplList.end();
+	for (; iter != end; iter++)
+	{
+		LLViewerMediaImpl* pimpl = *iter;
+		if(pimpl->mMediaSource)
+		{
+			pimpl->mMediaSource->clear_cookies();
+		}
+	}
+
 }
 
 
-- 
cgit v1.2.3


From e5edc41ac8497813d7d37d13d1eb958e169be235 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 16:26:33 -0700
Subject: DA CT edit

---
 .../skins/default/xui/da/floater_build_options.xml |  4 +-
 .../newview/skins/default/xui/da/floater_tools.xml | 52 +++++++++++-----------
 .../newview/skins/default/xui/da/menu_mini_map.xml |  2 +-
 indra/newview/skins/default/xui/da/menu_viewer.xml | 16 +++----
 .../newview/skins/default/xui/da/notifications.xml |  2 +-
 .../skins/default/xui/da/panel_landmarks.xml       |  2 +-
 .../skins/default/xui/da/panel_navigation_bar.xml  |  2 +-
 .../skins/default/xui/da/panel_nearby_media.xml    | 14 +++---
 .../default/xui/da/panel_preferences_advanced.xml  |  2 +-
 .../default/xui/da/panel_preferences_general.xml   |  2 +-
 .../skins/default/xui/da/panel_region_covenant.xml |  2 +-
 .../skins/default/xui/da/panel_region_estate.xml   |  2 +-
 .../skins/default/xui/da/panel_side_tray.xml       | 14 +++---
 .../skins/default/xui/da/sidepanel_item_info.xml   | 16 +++----
 .../skins/default/xui/da/sidepanel_task_info.xml   | 20 ++++-----
 indra/newview/skins/default/xui/da/strings.xml     | 14 +++---
 16 files changed, 83 insertions(+), 83 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/da/floater_build_options.xml b/indra/newview/skins/default/xui/da/floater_build_options.xml
index 9196f19b78..d3c3ac1899 100644
--- a/indra/newview/skins/default/xui/da/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/da/floater_build_options.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="build options floater" title="GITTER VALG">
-	<spinner label="Gitter enheder (meter)" label_width="136" name="GridResolution" width="200"/>
-	<spinner label="Gitter rækkevidde (meter)" label_width="136" name="GridDrawSize" width="200"/>
+	<spinner label="Enheder (meter)" label_width="136" name="GridResolution" width="200"/>
+	<spinner label="Rækkevidde (meter)" label_width="136" name="GridDrawSize" width="200"/>
 	<check_box label="Aktivér låsning til underenheder" name="GridSubUnit"/>
 	<check_box label="Vis &apos;cross-sections&apos;" name="GridCrossSection"/>
 	<text name="grid_opacity_label" tool_tip="Gitter synlighed">
diff --git a/indra/newview/skins/default/xui/da/floater_tools.xml b/indra/newview/skins/default/xui/da/floater_tools.xml
index 2e35811133..a39a7e8698 100644
--- a/indra/newview/skins/default/xui/da/floater_tools.xml
+++ b/indra/newview/skins/default/xui/da/floater_tools.xml
@@ -63,7 +63,7 @@
 		<radio_item label="Stræk (Ctrl+Shift)" name="radio stretch"/>
 		<radio_item label="Vælg overflade" name="radio select face"/>
 	</radio_group>
-	<check_box label="Redigér sammenlænkede dele" name="checkbox edit linked parts"/>
+	<check_box label="Redigér lænkede" name="checkbox edit linked parts"/>
 	<text name="RenderingCost" tool_tip="Hvis beregnede rendering omkostninger for dette objekt">
 		þ: [COUNT]
 	</text>
@@ -184,12 +184,12 @@
 				Klik for at:
 			</text>
 			<combo_box name="clickaction">
-				<combo_box.item label="Rør (Standard)" name="Touch/grab(default)"/>
-				<combo_box.item label="Sid på objekt" name="Sitonobject"/>
-				<combo_box.item label="Køb objekt" name="Buyobject"/>
-				<combo_box.item label="Betal objekt" name="Payobject"/>
-				<combo_box.item label="Åben" name="Open"/>
-				<combo_box.item label="Zoom" name="Zoom"/>
+				<combo_box.item label="Røre (Standard)" name="Touch/grab(default)"/>
+				<combo_box.item label="Sidde på objekt" name="Sitonobject"/>
+				<combo_box.item label="Købe objekt" name="Buyobject"/>
+				<combo_box.item label="Betale objekt" name="Payobject"/>
+				<combo_box.item label="Åbne" name="Open"/>
+				<combo_box.item label="Zoome" name="Zoom"/>
 			</combo_box>
 			<check_box label="Til salg:" name="checkbox for sale"/>
 			<combo_box name="sale type">
@@ -206,8 +206,8 @@
 				<text name="Anyone can:">
 					Enhver:
 				</text>
-				<check_box label="Flyt" name="checkbox allow everyone move"/>
-				<check_box label="Kopi" name="checkbox allow everyone copy"/>
+				<check_box label="Flytte" name="checkbox allow everyone move"/>
+				<check_box label="Kopiere" name="checkbox allow everyone copy"/>
 				<text name="Next owner can:">
 					Næste ejer:
 				</text>
@@ -417,21 +417,21 @@
 				<combo_box.item label="Ingen" name="None"/>
 				<combo_box.item label="Lysintensitet" name="Brightness"/>
 				<combo_box.item label="Mørke" name="Darkness"/>
-				<combo_box.item label="træårer" name="woodgrain"/>
-				<combo_box.item label="bark" name="bark"/>
-				<combo_box.item label="mursten" name="bricks"/>
-				<combo_box.item label="tern" name="checker"/>
-				<combo_box.item label="beton" name="concrete"/>
-				<combo_box.item label="rustik flise" name="crustytile"/>
+				<combo_box.item label="Træårer" name="woodgrain"/>
+				<combo_box.item label="Bark" name="bark"/>
+				<combo_box.item label="Mursten" name="bricks"/>
+				<combo_box.item label="Tern" name="checker"/>
+				<combo_box.item label="Beton" name="concrete"/>
+				<combo_box.item label="Rustik flise" name="crustytile"/>
 				<combo_box.item label="Skåret sten" name="cutstone"/>
-				<combo_box.item label="plader" name="discs"/>
-				<combo_box.item label="grus" name="gravel"/>
-				<combo_box.item label="petriskål" name="petridish"/>
-				<combo_box.item label="udvendig beklædning" name="siding"/>
-				<combo_box.item label="stenflise" name="stonetile"/>
-				<combo_box.item label="puds" name="stucco"/>
-				<combo_box.item label="rør" name="suction"/>
-				<combo_box.item label="væv" name="weave"/>
+				<combo_box.item label="Plader" name="discs"/>
+				<combo_box.item label="Grus" name="gravel"/>
+				<combo_box.item label="Petriskål" name="petridish"/>
+				<combo_box.item label="Udvendig beklædning" name="siding"/>
+				<combo_box.item label="Stenflise" name="stonetile"/>
+				<combo_box.item label="Puds" name="stucco"/>
+				<combo_box.item label="Rør" name="suction"/>
+				<combo_box.item label="Væv" name="weave"/>
 			</combo_box>
 			<text name="tex scale">
 				Gentagelser på overflade
@@ -440,8 +440,8 @@
 			<check_box label="Vend" name="checkbox flip s"/>
 			<spinner label="Lodret (V)" name="TexScaleV"/>
 			<check_box label="Vend" name="checkbox flip t"/>
-			<spinner label="Rotation˚" left="125" name="TexRot" width="55"/>
-			<spinner label="Gentagelser pr. meter" left="125" name="rptctrl" width="55"/>
+			<spinner label="Rotation˚"/>
+			<spinner label="Gentagelser pr. m."/>
 			<button label="Gem" label_selected="Gem" left_delta="62" name="button apply"/>
 			<text name="tex offset">
 				Tekstur offset
@@ -488,7 +488,7 @@ Grå = Offentligt ejet"/>
 		<button label="Opdel" label_selected="Opdel" name="button subdivide land"/>
 		<button label="Saml" label_selected="Saml" name="button join land"/>
 		<text name="label_parcel_trans">
-			Transaktioner for land
+			Transaktioner - land
 		</text>
 		<button label="Køb land" label_selected="Køb land" name="button buy land"/>
 		<button label="Efterlad land" label_selected="Efterlad land" name="button abandon land"/>
diff --git a/indra/newview/skins/default/xui/da/menu_mini_map.xml b/indra/newview/skins/default/xui/da/menu_mini_map.xml
index 0e2d04ffbb..38486cdecb 100644
--- a/indra/newview/skins/default/xui/da/menu_mini_map.xml
+++ b/indra/newview/skins/default/xui/da/menu_mini_map.xml
@@ -4,6 +4,6 @@
 	<menu_item_call label="Zoom mellem" name="Zoom Medium"/>
 	<menu_item_call label="Zoom langt" name="Zoom Far"/>
 	<menu_item_check label="Rotér kort" name="Rotate Map"/>
-	<menu_item_call label="Stop Tracking" name="Stop Tracking"/>
+	<menu_item_call label="Fjern ref." name="Stop Tracking"/>
 	<menu_item_call label="Verdenskort" name="World Map"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/da/menu_viewer.xml b/indra/newview/skins/default/xui/da/menu_viewer.xml
index 18ad7cfffa..7e7d1b190a 100644
--- a/indra/newview/skins/default/xui/da/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/da/menu_viewer.xml
@@ -36,7 +36,7 @@
 		<menu_item_call label="Mit land" name="My Land"/>
 		<menu label="Vis" name="LandShow">
 			<menu_item_check label="Bevægelses kontrol" name="Movement Controls"/>
-			<menu_item_check label="Vis kontroller" name="Camera Controls"/>
+			<menu_item_check label="Kontroller" name="Camera Controls"/>
 			<menu_item_check label="&apos;Ingen adgang&apos; markering" name="Ban Lines"/>
 			<menu_item_check label="Pejlelys" name="beacons"/>
 			<menu_item_check label="Parcel skel" name="Property Lines"/>
@@ -75,7 +75,7 @@
 			<menu_item_call label="Vælg alt" name="Select All"/>
 			<menu_item_call label="Fravælg" name="Deselect"/>
 		</menu>
-		<menu_item_call label="Sammenkæde" name="Link"/>
+		<menu_item_call label="Sammenkæd" name="Link"/>
 		<menu_item_call label="Adskil" name="Unlink"/>
 		<menu_item_check label="Redigér sammekædede objekter" name="Edit Linked Parts"/>
 		<menu_item_call label="Fokusér på valgte" name="Focus on Selection"/>
@@ -88,10 +88,10 @@
 			<menu_item_call label="Opdater ændringer i indhold til objekt" name="Save Object Back to Object Contents"/>
 		</menu>
 		<menu label="Scripts" name="Scripts">
-			<menu_item_call label="Rekompilér scripts (Mono)" name="Mono"/>
+			<menu_item_call label="Genoversæt scripts (Mono)" name="Mono"/>
 			<menu_item_call label="Genoversæt scripts (LSL)" name="LSL"/>
 			<menu_item_call label="Genstart scripts" name="Reset Scripts"/>
-			<menu_item_call label="sæt scripts til &quot;Running&quot;" name="Set Scripts to Running"/>
+			<menu_item_call label="Sæt scripts til &quot;Running&quot;" name="Set Scripts to Running"/>
 			<menu_item_call label="Sæt scripts til &quot;Not Running&quot;" name="Set Scripts to Not Running"/>
 		</menu>
 		<menu label="Valg" name="Options">
@@ -111,7 +111,7 @@
 		<menu label="Vis lænkede dele" name="Select Linked Parts">
 			<menu_item_call label="Vælg næste del" name="Select Next Part"/>
 			<menu_item_call label="Vælg forrige del" name="Select Previous Part"/>
-			<menu_item_call label="Inkludér næste valg" name="Include Next Part"/>
+			<menu_item_call label="Inkludér næste del" name="Include Next Part"/>
 			<menu_item_call label="Inkludér forrige del" name="Include Previous Part"/>
 		</menu>
 	</menu>
@@ -128,7 +128,7 @@
 		<menu_item_check label="Begræns valg afstand" name="Limit Select Distance"/>
 		<menu_item_check label="Fjern kamerabegrænsninger" name="Disable Camera Distance"/>
 		<menu_item_check label="Højopløsningsfoto" name="HighResSnapshot"/>
-		<menu_item_check label="Lydløse foto&apos;s til disk" name="QuietSnapshotsToDisk"/>
+		<menu_item_check label="Lydløse fotos til disk" name="QuietSnapshotsToDisk"/>
 		<menu_item_check label="Komprimér fotos til disk" name="CompressSnapshotsToDisk"/>
 		<menu label="Værktøjer til ydelse" name="Performance Tools">
 			<menu_item_call label="Lag meter" name="Lag Meter"/>
@@ -149,7 +149,7 @@
 			<menu_item_check label="Alpha" name="Alpha"/>
 			<menu_item_check label="Træer" name="Tree"/>
 			<menu_item_check label="Avatarer" name="Character"/>
-			<menu_item_check label="SurfacePath" name="SurfacePath"/>
+			<menu_item_check label="Overflade" name="SurfacePath"/>
 			<menu_item_check label="Himmel" name="Sky"/>
 			<menu_item_check label="Vand" name="Water"/>
 			<menu_item_check label="Jord" name="Ground"/>
@@ -168,7 +168,7 @@
 			<menu_item_check label="Tåge" name="Fog"/>
 			<menu_item_check label="Fleksible objekter" name="Flexible Objects"/>
 		</menu>
-		<menu_item_check label="Kør flere tråde" name="Run Multiple Threads"/>
+		<menu_item_check label="Kør flere 'threats'" name="Run Multiple Threads"/>
 		<menu_item_call label="Tøm gruppe cache" name="ClearGroupCache"/>
 		<menu_item_check label="Muse udjævning" name="Mouse Smoothing"/>
 		<menu label="Shortcuts" name="Shortcuts">
diff --git a/indra/newview/skins/default/xui/da/notifications.xml b/indra/newview/skins/default/xui/da/notifications.xml
index ea3527d63b..30e19ee901 100644
--- a/indra/newview/skins/default/xui/da/notifications.xml
+++ b/indra/newview/skins/default/xui/da/notifications.xml
@@ -228,7 +228,7 @@ Er du sikker på at du vil fortsætte?
 		Cache vil blive tømt ved næste genstart af [APP_NAME].
 	</notification>
 	<notification name="CacheWillBeMoved">
-		Cache vil blive flyttet ved næste genstart af [APP_NAME].
+		Cache vil blive fjernet ved næste genstart af [APP_NAME].
 Note: This will clear the cache.
 	</notification>
 	<notification name="ChangeConnectionPort">
diff --git a/indra/newview/skins/default/xui/da/panel_landmarks.xml b/indra/newview/skins/default/xui/da/panel_landmarks.xml
index 8adce2c819..9a0a2fb207 100644
--- a/indra/newview/skins/default/xui/da/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/da/panel_landmarks.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="Landmarks">
 	<accordion name="landmarks_accordion">
-		<accordion_tab name="tab_favorites" title="Favorites bjælke"/>
+		<accordion_tab name="tab_favorites" title="Favoritter"/>
 		<accordion_tab name="tab_landmarks" title="Mine landmærker"/>
 		<accordion_tab name="tab_inventory" title="Min beholdning"/>
 		<accordion_tab name="tab_library" title="Bibliotek"/>
diff --git a/indra/newview/skins/default/xui/da/panel_navigation_bar.xml b/indra/newview/skins/default/xui/da/panel_navigation_bar.xml
index 79f7e81b35..2ee87433a4 100644
--- a/indra/newview/skins/default/xui/da/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/da/panel_navigation_bar.xml
@@ -11,7 +11,7 @@
 	</panel>
 	<favorites_bar name="favorite" tool_tip="Træk landemærker hertil for at få hurtig adgang til dine favoritsteder i Second Life!">
 		<label name="favorites_bar_label" tool_tip="Træk landemærker hertil for at få hurtig adgang til dine favoritsteder i Second Life!">
-			Favorit bar
+			Favoritter
 		</label>
 		<chevron_button name="&gt;&gt;" tool_tip="Søg mere af mine favoritter"/>
 	</favorites_bar>
diff --git a/indra/newview/skins/default/xui/da/panel_nearby_media.xml b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
index 407d9f7c87..7a8b5a6389 100644
--- a/indra/newview/skins/default/xui/da/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/da/panel_nearby_media.xml
@@ -41,25 +41,25 @@
 		<panel name="media_controls_panel">
 			<layout_stack name="media_controls">
 				<layout_panel name="stop">
-					<button name="stop_btn" tool_tip="Stop valgte media"/>
+					<button name="stop_btn" tool_tip="Stop valgte medie"/>
 				</layout_panel>
 				<layout_panel name="play">
-					<button name="play_btn" tool_tip="Afspil valgte media"/>
+					<button name="play_btn" tool_tip="Afspil valgte medie"/>
 				</layout_panel>
 				<layout_panel name="pause">
-					<button name="pause_btn" tool_tip="Pause valgte media"/>
+					<button name="pause_btn" tool_tip="Pause valgte medie"/>
 				</layout_panel>
 				<layout_panel name="volume_slider_ctrl">
-					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Lydstyrke for valgte media"/>
+					<slider_bar initial_value="0.5" name="volume_slider" tool_tip="Volumen for valgte medie"/>
 				</layout_panel>
 				<layout_panel name="mute">
-					<button name="mute_btn" tool_tip="Sluk for lyd på valgte media"/>
+					<button name="mute_btn" tool_tip="Sluk for lyd for valgte medie"/>
 				</layout_panel>
 				<layout_panel name="zoom">
-					<button name="zoom_btn" tool_tip="Zoom ind til valgte media"/>
+					<button name="zoom_btn" tool_tip="Zoom ind til valgte medie"/>
 				</layout_panel>
 				<layout_panel name="unzoom">
-					<button name="unzoom_btn" tool_tip="Zoom tilbage fra valgte media"/>
+					<button name="unzoom_btn" tool_tip="Zoom tilbage fra valgte medie"/>
 				</layout_panel>
 			</layout_stack>
 		</panel>
diff --git a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
index b6ff4a6d90..1570960745 100644
--- a/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/da/panel_preferences_advanced.xml
@@ -18,7 +18,7 @@
 	<check_box label="Tast-tast-hold for at løbe" name="tap_tap_hold_to_run"/>
 	<check_box label="Bevæg avatarlæber når der tales" name="enable_lip_sync"/>
 	<check_box label="Talebobler" name="bubble_text_chat"/>
-	<slider label="Gennemsigtighed" name="bubble_chat_opacity"/>
+	<slider label="Synlighed" name="bubble_chat_opacity"/>
 	<color_swatch name="background" tool_tip="Vælg farve for talebobler"/>
 	<check_box label="Vis script fejl i:" name="show_script_errors"/>
 	<radio_group name="show_location">
diff --git a/indra/newview/skins/default/xui/da/panel_preferences_general.xml b/indra/newview/skins/default/xui/da/panel_preferences_general.xml
index f2c59f3d81..e70cb48262 100644
--- a/indra/newview/skins/default/xui/da/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/da/panel_preferences_general.xml
@@ -23,7 +23,7 @@
 	<text name="maturity_desired_textbox"/>
 	<combo_box name="maturity_desired_combobox">
 		<combo_box.item label="PG, Mature og Adult" name="Desired_Adult"/>
-		<combo_box.item label="PG and Mature" name="Desired_Mature"/>
+		<combo_box.item label="PG og Mature" name="Desired_Mature"/>
 		<combo_box.item label="PG" name="Desired_PG"/>
 	</combo_box>
 	<text name="start_location_textbox">
diff --git a/indra/newview/skins/default/xui/da/panel_region_covenant.xml b/indra/newview/skins/default/xui/da/panel_region_covenant.xml
index 564d8e6665..4b9c7539ea 100644
--- a/indra/newview/skins/default/xui/da/panel_region_covenant.xml
+++ b/indra/newview/skins/default/xui/da/panel_region_covenant.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Covenant" name="Covenant">
+<panel label="Regler" name="Covenant">
 	<text name="estate_section_lbl">
 		Estate
 	</text>
diff --git a/indra/newview/skins/default/xui/da/panel_region_estate.xml b/indra/newview/skins/default/xui/da/panel_region_estate.xml
index 7941553ade..65948ce481 100644
--- a/indra/newview/skins/default/xui/da/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/da/panel_region_estate.xml
@@ -39,7 +39,7 @@
 	</string>
 	<button label="?" name="abuse_email_address_help"/>
 	<button label="Gem" name="apply_btn"/>
-	<button label="Spark en beboer ud af estate..." name="kick_user_from_estate_btn"/>
+	<button label="Fjern en beboer fra estate..." name="kick_user_from_estate_btn"/>
 	<button label="Send besked til estate..." name="message_estate_btn"/>
 	<text name="estate_manager_label">
 		Administratorer:
diff --git a/indra/newview/skins/default/xui/da/panel_side_tray.xml b/indra/newview/skins/default/xui/da/panel_side_tray.xml
index ec430d6fd4..66c3e69904 100644
--- a/indra/newview/skins/default/xui/da/panel_side_tray.xml
+++ b/indra/newview/skins/default/xui/da/panel_side_tray.xml
@@ -3,27 +3,27 @@
 	partially on screen to hold tab buttons. -->
 <side_tray name="sidebar">
 	<sidetray_tab description="Åbn/luk sidebar" name="sidebar_openclose" tab_title="Åbn/luk sidebar"/>
-	<sidetray_tab description="Hjem." name="sidebar_home" tab_title="Home">
+	<sidetray_tab description="Hjem." name="sidebar_home" tab_title="Hjem">
 		<panel label="hjem" name="panel_home"/>
 	</sidetray_tab>
-	<sidetray_tab description="Redigér din profile og favoritter." name="sidebar_me" tab_title="My Profile">
+	<sidetray_tab description="Redigér din profile og favoritter." name="sidebar_me" tab_title="Min profil">
 		<panel_container name="panel_container">
 			<panel label="Mig" name="panel_me"/>
 		</panel_container>
 	</sidetray_tab>
-	<sidetray_tab description="Find venner, kontakter og personer tæt på." name="sidebar_people" tab_title="People">
+	<sidetray_tab description="Find venner, kontakter og personer tæt på." name="sidebar_people" tab_title="Personer">
 		<panel_container name="panel_container">
 			<panel label="Gruppe profil" name="panel_group_info_sidetray"/>
 			<panel label="Blokerede beboere og objekter" name="panel_block_list_sidetray"/>
 		</panel_container>
 	</sidetray_tab>
-	<sidetray_tab description="Find steder du vil hen og steder du har været før." label="Steder" name="sidebar_places" tab_title="Places">
+	<sidetray_tab description="Find steder du vil hen og steder du har været før." label="Steder" name="sidebar_places" tab_title="Steder">
 		<panel label="Steder" name="panel_places"/>
 	</sidetray_tab>
-	<sidetray_tab description="Browse din beholdning." name="sidebar_inventory" tab_title="My Inventory">
+	<sidetray_tab description="Browse din beholdning." name="sidebar_inventory" tab_title="Min beholdning">
 		<panel label="Redigér beholdning" name="sidepanel_inventory"/>
 	</sidetray_tab>
-	<sidetray_tab description="Ændre dit nuværende udseende" name="sidebar_appearance" tab_title="My Appearance">
-		<panel label="Redigér fremtoning" name="sidepanel_appearance"/>
+	<sidetray_tab description="Ændre dit nuværende udseende" name="sidebar_appearance" tab_title="Mit udseende">
+		<panel label="Redigér udseende" name="sidepanel_appearance"/>
 	</sidetray_tab>
 </side_tray>
diff --git a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
index 77db828c20..701a59bade 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
@@ -42,27 +42,27 @@
 			<text name="perm_modify">
 				Du kan:
 			</text>
-			<check_box label="Redigér" name="CheckOwnerModify"/>
-			<check_box label="Kopi" name="CheckOwnerCopy"/>
-			<check_box label="Giv væk" name="CheckOwnerTransfer"/>
+			<check_box label="Redigere" name="CheckOwnerModify"/>
+			<check_box label="Kopiere" name="CheckOwnerCopy"/>
+			<check_box label="Give væk" name="CheckOwnerTransfer"/>
 			<text name="AnyoneLabel">
 				Enhver:
 			</text>
-			<check_box label="Kopi" name="CheckEveryoneCopy"/>
+			<check_box label="Kopiere" name="CheckEveryoneCopy"/>
 			<text name="GroupLabel">
 				Gruppe:
 			</text>
-			<check_box label="Del" name="CheckShareWithGroup" tool_tip="Tillad alle medlemmer i den aktive gruppe at dele dine &apos;redigere&apos; rettigheder for dette objekt. Du skal dedikere for at åbne for rolle begrænsninger."/>
+			<check_box label="Dele" name="CheckShareWithGroup" tool_tip="Tillad alle medlemmer i den aktive gruppe at dele dine &apos;redigere&apos; rettigheder for dette objekt. Du skal dedikere for at åbne for rolle begrænsninger."/>
 			<text name="NextOwnerLabel">
 				Næste ejer:
 			</text>
 			<check_box label="Redigere" name="CheckNextOwnerModify"/>
-			<check_box label="Kopi" name="CheckNextOwnerCopy"/>
-			<check_box label="Giv væk" name="CheckNextOwnerTransfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
+			<check_box label="Kopiere" name="CheckNextOwnerCopy"/>
+			<check_box label="Give væk" name="CheckNextOwnerTransfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
 		</panel>
 		<check_box label="Til salg" name="CheckPurchase"/>
 		<combo_box name="combobox sale copy">
-			<combo_box.item label="Kopiér" name="Copy"/>
+			<combo_box.item label="Kopi" name="Copy"/>
 			<combo_box.item label="Original" name="Original"/>
 		</combo_box>
 		<spinner label="Pris: L$" name="Edit Cost"/>
diff --git a/indra/newview/skins/default/xui/da/sidepanel_task_info.xml b/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
index 4642c11d21..bec97734e4 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_task_info.xml
@@ -67,11 +67,11 @@
 			Klik for at:
 		</text>
 		<combo_box name="clickaction">
-			<combo_box.item label="Berør  (standard)" name="Touch/grab(default)"/>
-			<combo_box.item label="Sid på objekt" name="Sitonobject"/>
-			<combo_box.item label="Køb objekt" name="Buyobject"/>
-			<combo_box.item label="Betal objekt" name="Payobject"/>
-			<combo_box.item label="Åben" name="Open"/>
+			<combo_box.item label="Berøre (standard)" name="Touch/grab(default)"/>
+			<combo_box.item label="Sidde på objekt" name="Sitonobject"/>
+			<combo_box.item label="Købe objekt" name="Buyobject"/>
+			<combo_box.item label="Betale objekt" name="Payobject"/>
+			<combo_box.item label="Åbne" name="Open"/>
 		</combo_box>
 		<panel name="perms_inv">
 			<text name="perm_modify">
@@ -80,18 +80,18 @@
 			<text name="Anyone can:">
 				Enhver:
 			</text>
-			<check_box label="Kopi" name="checkbox allow everyone copy"/>
-			<check_box label="Flyt" name="checkbox allow everyone move"/>
+			<check_box label="Kopiere" name="checkbox allow everyone copy"/>
+			<check_box label="Flytte" name="checkbox allow everyone move"/>
 			<text name="GroupLabel">
 				Gruppe:
 			</text>
-			<check_box label="Del" name="checkbox share with group" tool_tip="Tillad alle gruppemedlemmer i den valgte gruppe at dele dine redigeringsrettigheder for dette objekt. Du skal dedikere for at aktivere rollebegrænsninger"/>
+			<check_box label="Dele" name="checkbox share with group" tool_tip="Tillad alle gruppemedlemmer i den valgte gruppe at dele dine redigeringsrettigheder for dette objekt. Du skal dedikere for at aktivere rollebegrænsninger"/>
 			<text name="NextOwnerLabel">
 				Næste ejer:
 			</text>
 			<check_box label="Redigere" name="checkbox next owner can modify"/>
-			<check_box label="Kopi" name="checkbox next owner can copy"/>
-			<check_box label="Overfør" name="checkbox next owner can transfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
+			<check_box label="Kopiere" name="checkbox next owner can copy"/>
+			<check_box label="Overføre" name="checkbox next owner can transfer" tool_tip="Næste ejer kan give væk eller sælge dette objekt"/>
 		</panel>
 		<check_box label="Til salg" name="checkbox for sale"/>
 		<combo_box name="sale type">
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index bce197113f..37501a3534 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -56,7 +56,7 @@
 		Klargør multimedia...
 	</string>
 	<string name="LoginInitializingFonts">
-		Indlæser fonts...
+		Indlæser skriftstyper...
 	</string>
 	<string name="LoginVerifyingCache">
 		Checker cache filer (kan tage 60-90 sekunder)...
@@ -892,8 +892,8 @@
 	<string name="no_modify" value=" (ikke redigere)"/>
 	<string name="no_copy" value=" (ikke kopiere)"/>
 	<string name="worn" value=" (båret)"/>
-	<string name="link" value=" (sammenkæde)"/>
-	<string name="broken_link" value=" (brudt_kæde)"/>
+	<string name="link" value=" (link)"/>
+	<string name="broken_link" value=" (brudt link)"/>
 	<string name="LoadingContents">
 		Henter indhold...
 	</string>
@@ -1795,7 +1795,7 @@ Forventet .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
 		Enhver
 	</string>
 	<string name="You">
-		Dig
+		Du
 	</string>
 	<string name="Multiple Media">
 		Flere medietyper
@@ -2604,7 +2604,7 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 		Mere
 	</string>
 	<string name="More Gravity">
-		More
+		Mere
 	</string>
 	<string name="More Lipstick">
 		Mere læbestift
@@ -3276,10 +3276,10 @@ Hvis du bliver ved med at modtage denne besked, kontakt venligst [SUPPORT_SITE].
 		(Moderator)
 	</string>
 	<string name="started_call">
-		Startet et stemme opkald
+		startede et stemme opkald
 	</string>
 	<string name="joined_call">
-		Tilsluttet stemme opkaldet
+		tilsluttede stemme opkald
 	</string>
 	<string name="ringing-im">
 		Tilslutter stemme opkald...
-- 
cgit v1.2.3


From c59484a5623a28f5cc430c666dd02ca6b21aad1f Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 16:32:20 -0700
Subject: DE FR ES linguistic

---
 .../skins/default/xui/de/floater_build_options.xml     |  2 +-
 .../skins/default/xui/de/panel_nearby_media.xml        |  4 ++--
 .../skins/default/xui/es/panel_preferences_privacy.xml |  2 +-
 .../skins/default/xui/fr/floater_buy_currency.xml      |  4 ++--
 .../newview/skins/default/xui/fr/floater_customize.xml | 18 +++++++++---------
 .../skins/default/xui/fr/floater_day_cycle_options.xml |  4 ++--
 indra/newview/skins/default/xui/fr/floater_tools.xml   |  2 +-
 indra/newview/skins/default/xui/fr/menu_viewer.xml     |  8 ++++----
 .../newview/skins/default/xui/fr/panel_edit_gloves.xml |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_jacket.xml |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_pants.xml  |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_shirt.xml  |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_shoes.xml  |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_skirt.xml  |  2 +-
 .../newview/skins/default/xui/fr/panel_edit_socks.xml  |  2 +-
 .../skins/default/xui/fr/panel_edit_underpants.xml     |  2 +-
 .../skins/default/xui/fr/panel_edit_undershirt.xml     |  2 +-
 .../default/xui/fr/panel_media_settings_general.xml    |  4 ++--
 .../xui/fr/panel_media_settings_permissions.xml        |  6 +++---
 .../skins/default/xui/fr/panel_nearby_media.xml        |  2 +-
 indra/newview/skins/default/xui/fr/panel_places.xml    |  2 +-
 indra/newview/skins/default/xui/fr/strings.xml         |  2 +-
 22 files changed, 39 insertions(+), 39 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/de/floater_build_options.xml b/indra/newview/skins/default/xui/de/floater_build_options.xml
index b70c859490..e90eb2c00b 100644
--- a/indra/newview/skins/default/xui/de/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/de/floater_build_options.xml
@@ -2,7 +2,7 @@
 <floater name="build options floater" title="RASTER-OPTIONEN">
 	<spinner label="Raster-Einheiten (Meter)" name="GridResolution"/>
 	<spinner label="Rastergröße (Meter)" name="GridDrawSize"/>
-	<check_box label="Einrasten von Untereinheiten aktivieren" name="GridSubUnit"/>
+	<check_box label="An Untereinheiten ausrichten" name="GridSubUnit"/>
 	<check_box label="Überschneidungen anzeigen" name="GridCrossSection"/>
 	<text name="grid_opacity_label" tool_tip="Raster-Deckkraft">
 		Deckkraft:
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 ad26f71245..32750f14d4 100644
--- a/indra/newview/skins/default/xui/de/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/de/panel_nearby_media.xml
@@ -13,8 +13,8 @@
 		(wird abgespielt)
 	</string>
 	<panel name="minimized_controls">
-		<button label="Alle stoppen" name="all_nearby_media_disable_btn" tool_tip="Alle Medien in der Nähe ausschalten"/>
-		<button label="Alle starten" name="all_nearby_media_enable_btn" tool_tip="Alle Medien in der Nähe einschalten"/>
+		<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 &gt;&gt;" label_selected="Weniger &lt;&lt;" name="more_less_btn" tool_tip="Erweiterte Steuerung"/>
 	</panel>
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 3632ecca7b..bf2c6b7aa6 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_privacy.xml
@@ -18,7 +18,7 @@
 	<check_box label="Guardar en mi ordenador registros de los MI" name="log_instant_messages"/>
 	<check_box label="Añadir fecha y hora" name="show_timestamps_check_im"/>
 	<text name="log_path_desc">
-		Localización de los registros:
+		Ruta de los registros:
 	</text>
 	<line_editor left="278" name="log_path_string" right="-20"/>
 	<button label="Elegir" label_selected="Elegir" name="log_path_button" width="120"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
index d7ec0b4885..4eaff8535e 100644
--- a/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/fr/floater_buy_currency.xml
@@ -4,7 +4,7 @@
 		Achetez [LINDENS] L$ pour environ [LOCALAMOUNT]
 	</floater.string>
 	<text left="5" name="info_need_more" right="-5">
-		Vous avez besoin de plus de L$
+		Plus de L$ sont requis
 	</text>
 	<text name="contacting">
 		En train de contacter 
@@ -53,7 +53,7 @@ le Lindex...
 		Saisissez à nouveau le montant pour voir le taux de change actuel.
 	</text>
 	<text name="purchase_warning_repurchase">
-		La confirmation de cet achat n&apos;achète que des L$, pas l&apos;objet.
+		Confirmer cet achat n'achète que des L$, pas l'objet.
 	</text>
 	<text bottom_delta="16" name="purchase_warning_notenough">
 		Vous n&apos;achetez pas assez de L$. Veuillez augmenter le montant.
diff --git a/indra/newview/skins/default/xui/fr/floater_customize.xml b/indra/newview/skins/default/xui/fr/floater_customize.xml
index 0343ff0014..d5ee070dcd 100644
--- a/indra/newview/skins/default/xui/fr/floater_customize.xml
+++ b/indra/newview/skins/default/xui/fr/floater_customize.xml
@@ -155,7 +155,7 @@
 		</text>
 		<panel label="Chemise" name="Shirt">
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Créer une chemise" label_selected="Créer une chemise" name="Create New"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
@@ -188,7 +188,7 @@
 		</panel>
 		<panel label="Pantalon" name="Pants">
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Créer un pantalon" label_selected="Créer un pantalon" name="Create New"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
@@ -246,7 +246,7 @@
 				Chaussures :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -279,7 +279,7 @@
 				Chaussettes :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -313,7 +313,7 @@
 			</text>
 			<texture_picker label="Tissu (dessus)" name="Upper Fabric" tool_tip="Cliquez pour sélectionner une image" width="81"/>
 			<texture_picker label="Tissu (dessous)" name="Lower Fabric" tool_tip="Cliquez pour sélectionner une image" width="81"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="81"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="81"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -346,7 +346,7 @@
 				Gants :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -379,7 +379,7 @@
 				Débardeur :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -412,7 +412,7 @@
 				Caleçon :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
@@ -445,7 +445,7 @@
 				Jupe :
 			</text>
 			<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image" width="74"/>
-			<color_swatch label="Couleur/Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
+			<color_swatch label="Coul./Teinte" name="Color/Tint" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs" width="74"/>
 			<button label="Enlever" label_selected="Enlever" left="12" name="Take Off" width="82"/>
 			<button label="Enregistrer" label_selected="Enregistrer" left="100" name="Save" width="82"/>
 			<button label="Enregistrer sous..." label_selected="Enregistrer sous..." left="188" name="Save As" width="111"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
index 951670ec7e..a381f64cd9 100644
--- a/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/fr/floater_day_cycle_options.xml
@@ -4,7 +4,7 @@
 		<panel label="Cycle du jour" name="Day Cycle">
 			<button label="?" name="WLDayCycleHelp" />
 			<text name="WL12am">
-				Minuit
+				Min.
 			</text>
 			<text name="WL3am">
 				3h
@@ -28,7 +28,7 @@
 				21h
 			</text>
 			<text name="WL12am2">
-				Minuit
+				Min.
 			</text>
 			<text name="WL12amHash">
 				|
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index 663f1da7b6..1d9d395960 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -355,7 +355,7 @@
 		</panel>
 		<panel label="Attributs" name="Features">
 			<text name="select_single">
-				Choisissez une prim pour changer les attributs.
+				Choisir une prim pour changer les attributs.
 			</text>
 			<text name="edit_object">
 				Modifier les attributs de l&apos;objet :
diff --git a/indra/newview/skins/default/xui/fr/menu_viewer.xml b/indra/newview/skins/default/xui/fr/menu_viewer.xml
index ff4a40b1ce..b8a3b65101 100644
--- a/indra/newview/skins/default/xui/fr/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/fr/menu_viewer.xml
@@ -276,7 +276,7 @@
 			<menu_item_check label="Atlas des textures" name="Texture Atlas"/>
 			<menu_item_check label="Rendu des lumières jointes" name="Render Attached Lights"/>
 			<menu_item_check label="Rendu des particules jointes" name="Render Attached Particles"/>
-			<menu_item_check label="Hover Glow Objects" name="Hover Glow Objects"/>
+			<menu_item_check label="Objets en surbrillance avec le pointeur" name="Hover Glow Objects"/>
 		</menu>
 		<menu label="Réseau" name="Network">
 			<menu_item_check label="Pauser l&apos;avatar" name="AgentPause"/>
@@ -296,7 +296,7 @@
 			<menu_item_call label="Arrêter l&apos;enregistrement" name="Stop Record"/>
 		</menu>
 		<menu label="Monde" name="World">
-			<menu_item_check label="Sim Sun Override" name="Sim Sun Override"/>
+			<menu_item_check label="Ignorer les paramètres du soleil de la sim" name="Sim Sun Override"/>
 			<menu_item_check label="Balise animée" name="Cheesy Beacon"/>
 			<menu_item_check label="Météo fixe" name="Fixed Weather"/>
 			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
@@ -369,14 +369,14 @@
 	<menu label="Admin" name="Admin">
 		<menu label="Object">
 			<menu_item_call label="Prendre une copie" name="Take Copy"/>
-			<menu_item_call label="Forcer le propriétaire sur moi" name="Force Owner To Me"/>
+			<menu_item_call label="Téléporter le propriétaire" name="Force Owner To Me"/>
 			<menu_item_call label="Forcer la permission du propriétaire" name="Force Owner Permissive"/>
 			<menu_item_call label="Supprimer" name="Delete"/>
 			<menu_item_call label="Verrouiller" name="Lock"/>
 			<menu_item_call label="Obtenir les ID d&apos;actifs" name="Get Assets IDs"/>
 		</menu>
 		<menu label="Parcelle" name="Parcel">
-			<menu_item_call label="Forcer le propriétaire sur moi" name="Owner To Me"/>
+			<menu_item_call label="Téléporter le propriétaire" name="Owner To Me"/>
 			<menu_item_call label="Définir sur le contenu Linden" name="Set to Linden Content"/>
 			<menu_item_call label="Réclamer un terrain public" name="Claim Public Land"/>
 		</menu>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml b/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
index 73e136ade6..b1a437497d 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_gloves.xml
@@ -2,7 +2,7 @@
 <panel name="edit_gloves_panel">
 	<panel name="avatar_gloves_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="gloves_main_tab" title="Gants"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml b/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
index cee44eb795..b757f60b18 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_jacket.xml
@@ -3,7 +3,7 @@
 	<panel name="avatar_jacket_color_panel">
 		<texture_picker label="Tissu (haut)" name="Upper Fabric" tool_tip="Cliquez pour sélectionner une image"/>
 		<texture_picker label="Tissu (bas)" name="Lower Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="jacket_main_tab" title="Veste"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_pants.xml b/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
index 71d82c817f..0cebe1e76a 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_pants.xml
@@ -2,7 +2,7 @@
 <panel name="edit_pants_panel">
 	<panel name="avatar_pants_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="pants_main_tab" title="Pantalon"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
index cf28cd8c1e..d6035415d8 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_shirt.xml
@@ -2,7 +2,7 @@
 <panel name="edit_shirt_panel">
 	<panel name="avatar_shirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="shirt_main_tab" title="Chemise"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml b/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
index a8e0910a15..ef6d72629c 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_shoes.xml
@@ -2,7 +2,7 @@
 <panel name="edit_shoes_panel">
 	<panel name="avatar_shoes_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="shoes_main_tab" title="Chaussures"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
index e9784b9510..1250c7819d 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_skirt.xml
@@ -2,7 +2,7 @@
 <panel name="edit_skirt_panel">
 	<panel name="avatar_skirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="skirt_main_tab" title="Jupe"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_socks.xml b/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
index 6fc6a3dc77..bcd69b7dc5 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_socks.xml
@@ -2,7 +2,7 @@
 <panel name="edit_socks_panel">
 	<panel name="avatar_socks_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="socks_main_tab" title="Chaussettes"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml b/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
index 90dcae18ec..dd2670bd75 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_underpants.xml
@@ -2,7 +2,7 @@
 <panel name="edit_underpants_panel">
 	<panel name="avatar_underpants_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="underpants_main_tab" title="Caleçon"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
index 950cdd7639..93a08f1189 100644
--- a/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/fr/panel_edit_undershirt.xml
@@ -2,7 +2,7 @@
 <panel name="edit_undershirt_panel">
 	<panel name="avatar_undershirt_color_panel">
 		<texture_picker label="Tissu" name="Fabric" tool_tip="Cliquez pour sélectionner une image"/>
-		<color_swatch label="Couleur/Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
+		<color_swatch label="Coul./Teinte" name="Color/Tint" width="80" tool_tip="Cliquez pour ouvrir le sélecteur de couleurs"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="undershirt_main_tab" title="Débardeur"/>
diff --git a/indra/newview/skins/default/xui/fr/panel_media_settings_general.xml b/indra/newview/skins/default/xui/fr/panel_media_settings_general.xml
index afd2d9cd8f..e048e66810 100644
--- a/indra/newview/skins/default/xui/fr/panel_media_settings_general.xml
+++ b/indra/newview/skins/default/xui/fr/panel_media_settings_general.xml
@@ -8,7 +8,7 @@
 	</text>
 	<line_editor name="home_url" tool_tip="La page d&apos;accueil pour cette source média"/>
 	<text name="preview_label">
-		Prévisualiser
+		Aperçu
 	</text>
 	<text name="current_url_label">
 		Page actuelle :
@@ -20,7 +20,7 @@
 	<check_box initial_value="false" label="Zoom auto" name="auto_zoom"/>
 	<check_box initial_value="false" label="Lecture auto du média" name="auto_play"/>
 	<text name="media_setting_note">
-		Remarque : kes résidents peuvent ignorer ce paramètre
+		Remarque : les résidents peuvent ignorer ce paramètre
 	</text>
 	<check_box initial_value="false" label="Mise à l&apos;échelle auto du média sur la face de l&apos;objet" name="auto_scale"/>
 	<text name="size_label">
diff --git a/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml b/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
index 6f6ae035a1..f456ee1c83 100644
--- a/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
+++ b/indra/newview/skins/default/xui/fr/panel_media_settings_permissions.xml
@@ -11,10 +11,10 @@
 			Mini
 		</combo_item>
 	</combo_box>
-	<check_box initial_value="false" label="Désactiver la navigation et l&apos;interactivité" name="perms_owner_interact"/>
+	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_owner_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_owner_control"/>
-	<check_box initial_value="false" label="Désactiver la navigation et l&apos;interactivité" name="perms_group_interact"/>
+	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_group_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_group_control"/>
-	<check_box initial_value="false" label="Désactiver la navigation et l&apos;interactivité" name="perms_anyone_interact"/>
+	<check_box initial_value="false" label="Activer la navigation et l&apos;interactivité" name="perms_anyone_interact"/>
 	<check_box initial_value="false" label="Afficher la barre de contrôles" name="perms_anyone_control"/>
 </panel>
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 d7757b3d9d..ef5a42555e 100644
--- a/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/fr/panel_nearby_media.xml
@@ -20,7 +20,7 @@
 	</panel>
 	<panel name="nearby_media_panel">
 		<text name="nearby_media">
-			Médias locaux
+			Médias proches
 		</text>
 		<text name="show">
 			Voir :
diff --git a/indra/newview/skins/default/xui/fr/panel_places.xml b/indra/newview/skins/default/xui/fr/panel_places.xml
index 19b727b57b..92b0a6c1db 100644
--- a/indra/newview/skins/default/xui/fr/panel_places.xml
+++ b/indra/newview/skins/default/xui/fr/panel_places.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Lieux" name="places panel">
 	<string name="landmarks_tab_title" value="MES REPÈRES"/>
-	<string name="teleport_history_tab_title" value="HISTORIQUE DES TP"/>
+	<string name="teleport_history_tab_title" value="HISTORIQUE DES TÉLÉP."/>
 	<filter_editor label="Filtrer les endroits" name="Filter"/>
 	<panel name="button_panel">
 		<button label="Téléporter" name="teleport_btn" tool_tip="Me téléporter jusqu&apos;à la zone sélectionnée"/>
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 7ab232672a..0ea11bb80f 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -3492,7 +3492,7 @@ Si ce message persiste, veuillez aller sur la page [SUPPORT_SITE].
 		pour charger
 	</string>
 	<string name="giving">
-		Donne [AMOUNT] L$
+		Donner [AMOUNT] L$
 	</string>
 	<string name="uploading_costs">
 		Le chargement coûte [AMOUNT] L$
-- 
cgit v1.2.3


From dde671f1df7fd7a6930148833ab5eecaf328f6f9 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 16:34:20 -0700
Subject: ES linguistic

---
 indra/newview/skins/default/xui/es/panel_preferences_chat.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

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 34b78b468b..8d5f1202d6 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
@@ -5,7 +5,7 @@
 	</text>
 	<radio_group name="chat_font_size">
 		<radio_item label="Disminuir" name="radio" value="0"/>
-		<radio_item label="Media" name="radio2" value="1"/>
+		<radio_item label="Medio" name="radio2" value="1"/>
 		<radio_item label="Aumentar" name="radio3" value="2"/>
 	</radio_group>
 	<text name="font_colors">
-- 
cgit v1.2.3


From 8ab9ea934f3f7560b0d46a5db7936da5819cefc4 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Fri, 26 Mar 2010 16:57:56 -0700
Subject: EXT-EXT-6317 - cursor does not indicate clicking will trigger an
 action when over transparent objects

reviewed by Leyla
---
 indra/newview/lltoolpie.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 8d4f0f9116..b7947cf4ae 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -497,6 +497,8 @@ void LLToolPie::selectionPropertiesReceived()
 BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 {
 	mHoverPick = gViewerWindow->pickImmediate(x, y, FALSE);
+	// perform a separate pick that detects transparent objects since they respond to 1-click actions
+	LLPickInfo click_action_pick = gViewerWindow->pickImmediate(x, y, TRUE);
 
 	// Show screen-space highlight glow effect
 	bool show_highlight = false;
@@ -508,10 +510,11 @@ BOOL LLToolPie::handleHover(S32 x, S32 y, MASK mask)
 		parent = object->getRootEdit();
 	}
 
-	if (object && useClickAction(mask, object, parent))
+	LLViewerObject* click_action_object = click_action_pick.getObject();
+	if (click_action_object && useClickAction(mask, click_action_object, click_action_object->getRootEdit()))
 	{
 		show_highlight = true;
-		ECursorType cursor = cursor_from_object(object);
+		ECursorType cursor = cursor_from_object(click_action_object);
 		gViewerWindow->setCursor(cursor);
 		lldebugst(LLERR_USER_INPUT) << "hover handled by LLToolPie (inactive)" << llendl;
 	}
-- 
cgit v1.2.3


From 40fdb2b9323a84d3364e3c3dcad1b53fc15aea68 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 17:46:35 -0700
Subject: IT translation review for set6A; FR and ES linguistic

---
 .../default/xui/es/panel_preferences_chat.xml      |  2 +-
 .../skins/default/xui/fr/floater_color_picker.xml  |  2 +-
 .../skins/default/xui/it/floater_about_land.xml    | 24 +++++-----
 .../default/xui/it/floater_avatar_textures.xml     |  2 +-
 .../skins/default/xui/it/floater_beacons.xml       | 12 ++---
 .../skins/default/xui/it/floater_help_browser.xml  |  2 +-
 .../skins/default/xui/it/floater_image_preview.xml | 16 +++----
 .../skins/default/xui/it/floater_incoming_call.xml |  8 ++--
 .../skins/default/xui/it/floater_lagmeter.xml      |  6 +--
 .../default/xui/it/floater_media_settings.xml      |  2 +-
 .../skins/default/xui/it/floater_nearby_chat.xml   |  2 +-
 .../default/xui/it/floater_preview_gesture.xml     |  8 ++--
 .../xui/it/floater_preview_gesture_info.xml        |  2 +-
 .../xui/it/floater_preview_gesture_shortcut.xml    |  6 +--
 .../xui/it/floater_preview_gesture_steps.xml       |  2 +-
 .../default/xui/it/floater_preview_texture.xml     | 16 +++----
 .../skins/default/xui/it/floater_sys_well.xml      |  4 +-
 .../skins/default/xui/it/floater_telehub.xml       |  4 +-
 .../skins/default/xui/it/inspect_object.xml        | 16 +++----
 .../skins/default/xui/it/panel_bottomtray.xml      | 10 ++--
 .../skins/default/xui/it/panel_edit_skin.xml       | 12 ++---
 .../skins/default/xui/it/panel_edit_socks.xml      |  4 +-
 .../skins/default/xui/it/panel_group_invite.xml    |  4 +-
 .../default/xui/it/panel_group_land_money.xml      | 18 ++++----
 .../skins/default/xui/it/panel_group_notices.xml   | 16 +++----
 indra/newview/skins/default/xui/it/panel_me.xml    |  2 +-
 .../xui/it/panel_media_settings_security.xml       |  2 +-
 .../skins/default/xui/it/panel_nearby_chat_bar.xml |  4 +-
 .../skins/default/xui/it/panel_profile_view.xml    |  6 +--
 .../newview/skins/default/xui/it/role_actions.xml  | 54 +++++++++++-----------
 30 files changed, 134 insertions(+), 134 deletions(-)

(limited to 'indra')

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 8d5f1202d6..46d8984889 100644
--- a/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/es/panel_preferences_chat.xml
@@ -46,7 +46,7 @@
 	<check_box initial_value="true" label="Ejecutar la animación de escribir al hacerlo en el chat" name="play_typing_animation"/>
 	<check_box label="Cuando estoy desconectado, enviarme los MI al correo-e" name="send_im_to_email"/>
 	<text name="show_ims_in_label">
-		Mostrar los MI en:
+		Mostrar los MI en: 
 	</text>
 	<text name="requires_restart_label">
 		(requiere reiniciar)
diff --git a/indra/newview/skins/default/xui/fr/floater_color_picker.xml b/indra/newview/skins/default/xui/fr/floater_color_picker.xml
index 8d7fe76b35..7ead543c78 100644
--- a/indra/newview/skins/default/xui/fr/floater_color_picker.xml
+++ b/indra/newview/skins/default/xui/fr/floater_color_picker.xml
@@ -26,6 +26,6 @@
 		Couleur actuelle :
 	</text>
 	<text left="8" name="(Drag below to save.)" width="220">
-		(Faire glisser dessous pour enregistrer.)
+		Enreg. : faire glisser dessous
 	</text>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_about_land.xml b/indra/newview/skins/default/xui/it/floater_about_land.xml
index 4b361f6fa6..a61b0584d3 100644
--- a/indra/newview/skins/default/xui/it/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_about_land.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floaterland" title="INFO SUL TERRENO">
+<floater name="floaterland" title="INFORMAZIONI SUL TERRENO">
 	<floater.string name="maturity_icon_general">
 		&quot;Parcel_PG_Dark&quot;
 	</floater.string>
@@ -19,7 +19,7 @@
 		[SECONDS] secondi
 	</floater.string>
 	<floater.string name="Remaining">
-		restante
+		rimanenti
 	</floater.string>
 	<tab_container name="landtab">
 		<panel label="GENERALE" name="land_general_panel">
@@ -144,7 +144,7 @@ Vai al menu Mondo &gt; Informazioni sul terreno oppure seleziona un altro appezz
 			<button label="Reclama la terra" name="Reclaim Land..."/>
 			<button label="Vendita Linden" name="Linden Sale..." tool_tip="La terra deve essere posseduta, con contenuto impostato, e non già messa in asta."/>
 		</panel>
-		<panel label="COVENANT" name="land_covenant_panel">
+		<panel label="REGOLAMENTO" name="land_covenant_panel">
 			<panel.string name="can_resell">
 				La terra acquistata in questa regione può essere rivenduta.
 			</panel.string>
@@ -208,7 +208,7 @@ o suddivisa.
 				La terra in questa regione non può essere unita/suddivisa.
 			</text>
 		</panel>
-		<panel label="OBJECTS" name="land_objects_panel">
+		<panel label="OGGETTI" name="land_objects_panel">
 			<panel.string name="objects_available_text">
 				[COUNT] dei [MAX] ([AVAILABLE] disponibili)
 			</panel.string>
@@ -219,7 +219,7 @@ o suddivisa.
 				Fattore bonus degli oggetti della regione: [BONUS]
 			</text>
 			<text name="Simulator primitive usage:">
-				Uso dei Primative :
+				Uso dei Prim:
 			</text>
 			<text left="214" name="objects_available" width="230">
 				[COUNT] dei [MAX] ([AVAILABLE] dsponibili)
@@ -339,7 +339,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			</text>
 			<check_box label="Sicuro (senza danno)" name="check safe" tool_tip="Se spuntato, imposta il terreno su &apos;sicuro&apos;, disabilitando i danni da combattimento. Se non spuntato, viene abilitato il combattimento a morte."/>
 			<check_box label="Nessuna spinta" name="PushRestrictCheck" tool_tip="Previeni i colpi. Selezionare questa opzione può essere utile per prevenire comportamenti dannosi sul tuo terreno."/>
-			<check_box label="Mostra luogo nel Cerca (L$30/settimana)" name="ShowDirectoryCheck" tool_tip="Lascia che questa terra sia vista dagli altri nei risultati di ricerca"/>
+			<check_box label="Mostra luogo nella ricerca (30 L$/settimana)" name="ShowDirectoryCheck" tool_tip="Lascia che questa terra sia vista dagli altri nei risultati di ricerca"/>
 			<combo_box left="282" name="land category with adult" width="140">
 				<combo_box.item label="Tutte le categorie" name="item0"/>
 				<combo_box.item label="Luogo dei Linden" name="item1"/>
@@ -428,13 +428,13 @@ Media:
 		</panel>
 		<panel label="SUONO" name="land_audio_panel">
 			<check_box label="Nascondi URL" name="hide_music_url" tool_tip="Questa opzione consente di nascondere l&apos;url della musica a chi non è autorizzato a visionare le informazioni di questo parcel."/>
-			<check_box label="Attiva Voice" name="parcel_enable_voice_channel"/>
-			<check_box label="Attiva Voice (stabilito dalla Proprietà)" name="parcel_enable_voice_channel_is_estate_disabled"/>
+			<check_box label="Attiva voce" name="parcel_enable_voice_channel"/>
+			<check_box label="Attiva voce (stabilito dalla proprietà)" name="parcel_enable_voice_channel_is_estate_disabled"/>
 			<check_box label="Limita il chat vocale a questo lotto" name="parcel_enable_voice_channel_local"/>
 		</panel>
 		<panel label="ACCESSO" name="land_access_panel">
 			<panel.string name="access_estate_defined">
-				(Definito dalla Proprietà)
+				(Definito dalla proprietà)
 			</panel.string>
 			<panel.string name="allow_public_access">
 				Consenti accesso pubblico ([MATURITY])
@@ -445,11 +445,11 @@ Media:
 			<text name="Limit access to this parcel to:">
 				Accesso a questo terreno
 			</text>
-			<check_box label="Permetti Accesso Pubblico [MATURITY]" name="public_access"/>
+			<check_box label="Consenti l&apos;accesso pubblico [MATURITY]" name="public_access"/>
 			<text name="Only Allow">
-				Accesso ristretto ai Residenti verificati con:
+				Consenti l&apos;accesso soltanto ai residenti verificati tramite:
 			</text>
-			<check_box label="Informazioni di pagamento on File [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Espelli i residenti non identificati."/>
+			<check_box label="Informazioni di pagamento in archivio [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Espelli i residenti non identificati."/>
 			<check_box label="Verifica dell&apos;età [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Espelli i residenti che non hanno la loro età verificata. Vedi [SUPPORT_SITE] per maggiori informazioni."/>
 			<check_box label="Permetti accesso al gruppo: [GROUP]" name="GroupCheck" tool_tip="Imposta il gruppo nel pannello generale."/>
 			<check_box label="Vendi pass a:" name="PassCheck" tool_tip="Permetti in questo terreno l&apos;accesso temporaneo"/>
diff --git a/indra/newview/skins/default/xui/it/floater_avatar_textures.xml b/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
index b2c963929f..2935f0fdb6 100644
--- a/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
+++ b/indra/newview/skins/default/xui/it/floater_avatar_textures.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="avatar_texture_debug" title="AVATAR TEXTURES">
+<floater name="avatar_texture_debug" title="TEXTURE DI AVATAR">
 	<floater.string name="InvalidAvatar">
 		AVATAR NON VALIDO
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/it/floater_beacons.xml b/indra/newview/skins/default/xui/it/floater_beacons.xml
index 8fd69d811d..ca6711468d 100644
--- a/indra/newview/skins/default/xui/it/floater_beacons.xml
+++ b/indra/newview/skins/default/xui/it/floater_beacons.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="beacons" title="BEACONS">
+<floater name="beacons" title="MARCATORI">
 	<panel name="beacons_panel">
 		<text name="label_show">
 			Mostra:
 		</text>
-		<check_box label="Beacons" name="beacons"/>
-		<check_box label="Highlights" name="highlights"/>
-		<text name="beacon_width_label" tool_tip="Beacon width">
+		<check_box label="Marcatori" name="beacons"/>
+		<check_box label="In evidenza" name="highlights"/>
+		<text name="beacon_width_label" tool_tip="Larghezza marcatore">
 			Larghezza:
 		</text>
 		<text name="label_objects">
@@ -15,7 +15,7 @@
 		<check_box label="Fisico" name="physical"/>
 		<check_box label="Scripted" name="scripted"/>
 		<check_box label="Tocca solo" name="touch_only"/>
-		<check_box label="Fonte del Suono" name="sounds"/>
-		<check_box label="Fonte delle Particle" name="particles"/>
+		<check_box label="Fonti sonore" name="sounds"/>
+		<check_box label="Fonti delle particelle" name="particles"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_help_browser.xml b/indra/newview/skins/default/xui/it/floater_help_browser.xml
index 93da2a37c9..008643afac 100644
--- a/indra/newview/skins/default/xui/it/floater_help_browser.xml
+++ b/indra/newview/skins/default/xui/it/floater_help_browser.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater_help_browser" title="HELP BROWSER">
+<floater name="floater_help_browser" title="BROWSER DELL&apos;AIUTO">
 	<floater.string name="loading_text">
 		Caricamento in corso...
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/it/floater_image_preview.xml b/indra/newview/skins/default/xui/it/floater_image_preview.xml
index 341202d8bc..6169c0222d 100644
--- a/indra/newview/skins/default/xui/it/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/it/floater_image_preview.xml
@@ -12,15 +12,15 @@ immagine come:
 	</text>
 	<combo_box label="Tipo d&apos;abito" left="120" name="clothing_type_combo" width="166">
 		<combo_box.item label="Immagine" name="Image"/>
-		<combo_box.item label="Capelli" name="Hair"/>
-		<combo_box.item label="Testa Femminile" name="FemaleHead"/>
-		<combo_box.item label="Corpo Femminile Superiore" name="FemaleUpperBody"/>
-		<combo_box.item label="Corpo Femminile Inferiore" name="FemaleLowerBody"/>
-		<combo_box.item label="Testa Maschile" name="MaleHead"/>
-		<combo_box.item label="Corpo Maschile Superiore" name="MaleUpperBody"/>
-		<combo_box.item label="Corpo Maschile Inferiore" name="MaleLowerBody"/>
+		<combo_box.item label="Capigliature" name="Hair"/>
+		<combo_box.item label="Testa femminile" name="FemaleHead"/>
+		<combo_box.item label="Parte superiore del corpo femminile" name="FemaleUpperBody"/>
+		<combo_box.item label="Parte inferiore del corpo femminile" name="FemaleLowerBody"/>
+		<combo_box.item label="Testa maschile" name="MaleHead"/>
+		<combo_box.item label="Parte superiore del corpo maschile" name="MaleUpperBody"/>
+		<combo_box.item label="Parte inferiore del corpo maschile" name="MaleLowerBody"/>
 		<combo_box.item label="Gonna" name="Skirt"/>
-		<combo_box.item label="Sculpted Prim" name="SculptedPrim"/>
+		<combo_box.item label="Prim Sculpted" name="SculptedPrim"/>
 	</combo_box>
 	<text name="bad_image_text">
 		Non è stato possibile leggere l&apos;immagine.
diff --git a/indra/newview/skins/default/xui/it/floater_incoming_call.xml b/indra/newview/skins/default/xui/it/floater_incoming_call.xml
index 22aed7a69c..81a6ea7a60 100644
--- a/indra/newview/skins/default/xui/it/floater_incoming_call.xml
+++ b/indra/newview/skins/default/xui/it/floater_incoming_call.xml
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="incoming call" title="UNA PERSONA SCONOSCIUTA STA&apos; CHIAMANDO">
+<floater name="incoming call" title="UNA PERSONA SCONOSCIUTA STA CHIAMANDO">
 	<floater.string name="lifetime">
 		5
 	</floater.string>
 	<floater.string name="localchat">
-		Voice Chat nei dintorni
+		Chat vocale nei dintorni
 	</floater.string>
 	<floater.string name="anonymous">
 		anonimo
 	</floater.string>
 	<floater.string name="VoiceInviteP2P">
-		stà chiamando.
+		sta chiamando.
 	</floater.string>
 	<floater.string name="VoiceInviteAdHoc">
-		ha aggiunto una chiamata in Voice Chat ad una conferenza in chat.
+		ha aderito ad una chiamata in chat vocale in conferenza.
 	</floater.string>
 	<floater.string name="VoiceInviteGroup">
 		ha accettato una chiamata in Chat vocale con il gruppo [GROUP].
diff --git a/indra/newview/skins/default/xui/it/floater_lagmeter.xml b/indra/newview/skins/default/xui/it/floater_lagmeter.xml
index 93bf11b069..f7b2b1ab4a 100644
--- a/indra/newview/skins/default/xui/it/floater_lagmeter.xml
+++ b/indra/newview/skins/default/xui/it/floater_lagmeter.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater_lagmeter" title="LAG METER">
+<floater name="floater_lagmeter" title="MISURATORE LAG">
 	<floater.string name="max_title_msg">
 		Misuratore del lag
 	</floater.string>
@@ -136,7 +136,7 @@
 	<text left="30" name="client_lag_cause" right="-10"/>
 	<button label="" label_selected="" name="network_lagmeter" tool_tip="Stato del lag del network"/>
 	<text name="network">
-		Network
+		Rete
 	</text>
 	<text font="SansSerifSmall" name="network_text">
 		Normale
@@ -150,5 +150,5 @@
 		Normale
 	</text>
 	<text left="30" name="server_lag_cause" right="-32"/>
-	<button label="&gt;&gt;" name="minimize" tool_tip="Pulsante per minimizzare"/>
+	<button label="&gt;&gt;" name="minimize" tool_tip="Cambia dimensioni floater"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_media_settings.xml b/indra/newview/skins/default/xui/it/floater_media_settings.xml
index b99a11b881..d521502a4c 100644
--- a/indra/newview/skins/default/xui/it/floater_media_settings.xml
+++ b/indra/newview/skins/default/xui/it/floater_media_settings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="media_settings" title="IMPOSTAZIONI MEDIA">
 	<button label="OK" label_selected="OK" name="OK"/>
-	<button label="Cancella" label_selected="Cancella" name="Cancel"/>
+	<button label="Annulla" label_selected="Annulla" name="Cancel"/>
 	<button label="Applica" label_selected="Applica" name="Apply"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml
index 364b62fbdb..9878fe85ea 100644
--- a/indra/newview/skins/default/xui/it/floater_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/it/floater_nearby_chat.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="nearby_chat" title="CHAT VICINA"/>
+<floater name="nearby_chat" title="CHAT NEI DINTORNI"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_gesture.xml b/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
index 41d4fdfce2..4e926cedc9 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_gesture.xml
@@ -50,18 +50,18 @@
 	<text name="steps_label">
 		Fasi:
 	</text>
-	<button label="Sù" name="up_btn"/>
+	<button label="Su" name="up_btn"/>
 	<button label="Giù" name="down_btn"/>
 	<button label="Elimina" name="delete_btn"/>
 	<radio_group name="animation_trigger_type">
-		<radio_item label="Inizia" name="start"/>
-		<radio_item label="Stop" name="stop"/>
+		<radio_item label="Attiva" name="start"/>
+		<radio_item label="Ferma" name="stop"/>
 	</radio_group>
 	<check_box label="finché le animazioni sono eseguite" left="226" name="wait_anim_check"/>
 	<check_box label="tempo in secondi" name="wait_time_check"/>
 	<line_editor left_delta="114" name="wait_time_editor"/>
 	<text name="help_label">
-		Tutte le fasi avvengono simultaneamente, a meno che non aggiungi una fase attendi.
+		Tutte le fasi avvengono contemporaneamente, a meno che non aggiungi fasi di attesa.
 	</text>
 	<check_box label="Attiva" name="active_check" tool_tip="Le gesture attivate possono essere eseguite scrivendo in chat la parola chiave o premendo i tasti chiave. Le gesture generalmente si disattivano quando c&apos;è un conflitto nei relativi tasti."/>
 	<button label="Anteprima" name="preview_btn"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_gesture_info.xml b/indra/newview/skins/default/xui/it/floater_preview_gesture_info.xml
index 660b868cae..d490416cc7 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_gesture_info.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_gesture_info.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="GESTURE SHORTCUT"/>
+<floater name="Gesture" title="SCORCIATOIA GESTURE"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_gesture_shortcut.xml b/indra/newview/skins/default/xui/it/floater_preview_gesture_shortcut.xml
index 942d5ed1ce..eb0bc4d868 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_gesture_shortcut.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_gesture_shortcut.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="TASTO RAPIDO PER GESTURE">
+<floater name="Gesture" title="SCORCIATOIA GESTURE">
 	<text name="trigger_label">
 		Chat:
 	</text>
@@ -8,8 +8,8 @@
 	</text>
 	<combo_box label="Nessuno" name="modifier_combo"/>
 	<combo_box label="Nessuno" name="key_combo"/>
-	<text name="replace_text" tool_tip="Sostituisci la parola chiave con queste parole. Per esempio, parola chiave &apos;ciao&apos; sostituendo con &apos;buongiorno&apos; cambierà la chat da &apos;Io dico ciao&apos; in &apos;Io dico buongiorno&apos; non appena attiverete la gesture!">
+	<text name="replace_text" tool_tip="Sostituisci la parola chiave con queste parole. Per esempio, se si sceglie di sostituire la parola chiave &apos;ciao&apos; con &apos;buongiorno&apos;, nella chat il testo &apos;Volevo dire ciao&apos; diventerà &apos;Volevo dire buongiorno&apos; e verrà attivata la gesture.">
 		Sostituisci:
 	</text>
-	<line_editor name="replace_editor" tool_tip="Sostituisci la parola chiave con queste parole. Per esempio, parola chiave &apos;ciao&apos; sostituendo con &apos;buongiorno&apos; cambierà la chat da &apos;Io dico ciao&apos; in &apos;Io dico buongiorno&apos; non appena attiverete la gesture"/>
+	<line_editor name="replace_editor" tool_tip="Sostituisci la parola chiave con queste parole. Per esempio, se si sceglie di sostituire la parola chiave &apos;ciao&apos; con &apos;buongiorno&apos;, nella chat il testo &apos;Volevo dire ciao&apos; diventerà &apos;Volevo dire buongiorno&apos; e verrà attivata la gesture"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_gesture_steps.xml b/indra/newview/skins/default/xui/it/floater_preview_gesture_steps.xml
index 7c1f55ddba..d490416cc7 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_gesture_steps.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_gesture_steps.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="TASTO RAPIDO GESTURE"/>
+<floater name="Gesture" title="SCORCIATOIA GESTURE"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_texture.xml b/indra/newview/skins/default/xui/it/floater_preview_texture.xml
index e59f707ce7..5b4054514e 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_texture.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_texture.xml
@@ -10,31 +10,31 @@
 		Descrizione:
 	</text>
 	<text name="dimensions">
-		[WIDTH]px x [HEIGHT]px
+		[WIDTH] px x [HEIGHT] px
 	</text>
 	<text name="aspect_ratio">
 		Antreprima rapporto di visualizzazione
 	</text>
-	<combo_box name="combo_aspect_ratio" tool_tip="Anteprima del rapporto d&apos;aspetto impostato">
+	<combo_box name="combo_aspect_ratio" tool_tip="Anteprima con rapporto di visualizzazione fisso">
 		<combo_item name="Unconstrained">
 			Libero
 		</combo_item>
-		<combo_item name="1:1" tool_tip="Immagine del Gruppo o Profilo nel Mondo Reale">
+		<combo_item name="1:1" tool_tip="Logo del gruppo o profilo nel mondo reale">
 			1:1
 		</combo_item>
-		<combo_item name="4:3" tool_tip="[SECOND_LIFE] profilo">
+		<combo_item name="4:3" tool_tip="Profilo [SECOND_LIFE]">
 			4:3
 		</combo_item>
-		<combo_item name="10:7" tool_tip="Annunci ed elenco del Cerca, landmarks">
+		<combo_item name="10:7" tool_tip="Annunci e inserzioni, punti di riferimento">
 			10:7
 		</combo_item>
-		<combo_item name="3:2" tool_tip="Info sul terreno">
+		<combo_item name="3:2" tool_tip="Informazioni sul terreno">
 			3:2
 		</combo_item>
 		<combo_item name="16:10">
 			16:10
 		</combo_item>
-		<combo_item name="16:9" tool_tip="Preferiti nel Profilo">
+		<combo_item name="16:9" tool_tip="Preferiti del Profilo">
 			16:9
 		</combo_item>
 		<combo_item name="2:1">
@@ -43,5 +43,5 @@
 	</combo_box>
 	<button label="OK" name="Keep"/>
 	<button label="Elimina" name="Discard"/>
-	<button label="Salva come:" name="save_tex_btn"/>
+	<button label="Salva con nome" name="save_tex_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_sys_well.xml b/indra/newview/skins/default/xui/it/floater_sys_well.xml
index 1acdfa2815..e1c0b89902 100644
--- a/indra/newview/skins/default/xui/it/floater_sys_well.xml
+++ b/indra/newview/skins/default/xui/it/floater_sys_well.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="sys_well_window" title="NOTIFICHE">
+<floater name="sys_well_window" title="AVVISI">
 	<string name="title_im_well_window">
 		CONVERSAZIONI
 	</string>
 	<string name="title_notification_well_window">
-		NOTIFICHE
+		AVVISI
 	</string>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/floater_telehub.xml b/indra/newview/skins/default/xui/it/floater_telehub.xml
index 08f5564c7b..15312a8959 100644
--- a/indra/newview/skins/default/xui/it/floater_telehub.xml
+++ b/indra/newview/skins/default/xui/it/floater_telehub.xml
@@ -21,9 +21,9 @@
 	<button label="Aggiungi punti rigenerazione" name="add_spawn_point_btn" width="165"/>
 	<button label="Rimuovi punti" left="175" name="remove_spawn_point_btn" width="105"/>
 	<text name="spawn_point_help">
-		Seleziona un oggetto e click &quot;Aggiungi Spawn&quot; per specificare la posizione.
+		Seleziona un oggetto e fai clic su Aggiungi per specificare la posizione.
 Ora puoi spostare o cancellare l&apos;oggetto.
-Le Posizioni sono relative al centro del telehub.
+Le posizioni sono relative al centro del telehub.
 Seleziona un oggetto nella lista per evidenziarlo nel mondo.
 	</text>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/inspect_object.xml b/indra/newview/skins/default/xui/it/inspect_object.xml
index 7e6d195cb1..fd58c18e0b 100644
--- a/indra/newview/skins/default/xui/it/inspect_object.xml
+++ b/indra/newview/skins/default/xui/it/inspect_object.xml
@@ -9,10 +9,10 @@
 	</string>
 	<string name="CreatorAndOwner">
 		Di [CREATOR]
-owner [OWNER]
+proprietario [OWNER]
 	</string>
 	<string name="Price">
-		L$[AMOUNT]
+		L$ [AMOUNT]
 	</string>
 	<string name="PriceFree">
 		Gratis!
@@ -21,14 +21,14 @@ owner [OWNER]
 		Tocca
 	</string>
 	<string name="Sit">
-		Siedi
+		Siediti
 	</string>
-	<button label="Compra" name="buy_btn"/>
+	<button label="Acquista" name="buy_btn"/>
 	<button label="Paga" name="pay_btn"/>
-	<button label="Fai una Copia" name="take_free_copy_btn"/>
+	<button label="Prendi copia" name="take_free_copy_btn"/>
 	<button label="Tocca" name="touch_btn"/>
-	<button label="Siedi" name="sit_btn"/>
+	<button label="Siediti" name="sit_btn"/>
 	<button label="Apri" name="open_btn"/>
-	<icon name="secure_browsing" tool_tip="Secure Browsing"/>
-	<button label="Ulteriore" name="more_info_btn"/>
+	<icon name="secure_browsing" tool_tip="Browsing sicuro"/>
+	<button label="Altro" name="more_info_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/panel_bottomtray.xml b/indra/newview/skins/default/xui/it/panel_bottomtray.xml
index ccefc91ce1..c0218fad5e 100644
--- a/indra/newview/skins/default/xui/it/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/it/panel_bottomtray.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="bottom_tray">
 	<string name="SpeakBtnToolTip">
-		Microfono on/off
+		Accende o spegne il microfono
 	</string>
 	<string name="VoiceControlBtnToolTip">
-		Mostra/nascondi il pannello voice control
+		Mostra o nasconde il pannello di regolazione voce
 	</string>
 	<layout_stack name="toolbar_stack">
 		<layout_panel name="speak_panel">
@@ -13,13 +13,13 @@
 			</talk_button>
 		</layout_panel>
 		<layout_panel name="gesture_panel">
-			<gesture_combo_list label="Gesture" name="Gesture" tool_tip="Mostra/nascondi gestures"/>
+			<gesture_combo_list label="Gesture" name="Gesture" tool_tip="Mostra o nasconde le gesture"/>
 		</layout_panel>
 		<layout_panel name="movement_panel">
-			<button label="Sposta" name="movement_btn" tool_tip="Mostra/nascondi i controlli del movimento"/>
+			<button label="Sposta" name="movement_btn" tool_tip="Mostra o nasconde i comandi del movimento"/>
 		</layout_panel>
 		<layout_panel name="cam_panel">
-			<button label="Visualizza" name="camera_btn" tool_tip="Mostra/nascondi i controlli della camera"/>
+			<button label="Visuale" name="camera_btn" tool_tip="Mostra o nasconde le regolazioni della visuale"/>
 		</layout_panel>
 		<layout_panel name="snapshot_panel">
 			<button label="" name="snapshots" tool_tip="Scatta una foto"/>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_skin.xml b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
index 2fa76d4afc..9e05599470 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_skin.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_skin_panel">
 	<panel name="avatar_skin_color_panel">
-		<texture_picker label="Tatuaggi Testa" name="Head Tattoos" tool_tip="Clicca per scegliere un&apos;immagine"/>
-		<texture_picker label="Tatuaggi superiori" name="Upper Tattoos" tool_tip="Clicca per scegliere un&apos;immagine"/>
-		<texture_picker label="Tatuaggi inferiori" name="Lower Tattoos" tool_tip="Clicca per scegliere un&apos;immagine"/>
+		<texture_picker label="Tatuaggi testa" name="Head Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
+		<texture_picker label="Tatuaggi superiori" name="Upper Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
+		<texture_picker label="Tatuaggi inferiori" name="Lower Tattoos" tool_tip="Clicca per scegliere una fotografia"/>
 	</panel>
 	<accordion name="wearable_accordion">
 		<accordion_tab name="skin_color_tab" title="Colore della pelle"/>
-		<accordion_tab name="skin_face_tab" title="Dettagli del Viso"/>
-		<accordion_tab name="skin_makeup_tab" title="Trucco"/>
-		<accordion_tab name="skin_body_tab" title="Dettagli del Corpo"/>
+		<accordion_tab name="skin_face_tab" title="Dettagli del viso"/>
+		<accordion_tab name="skin_makeup_tab" title="Makeup"/>
+		<accordion_tab name="skin_body_tab" title="Dettagli del corpo"/>
 	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_socks.xml b/indra/newview/skins/default/xui/it/panel_edit_socks.xml
index 1d1eb4bd3a..d2af3ebd5a 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_socks.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_socks_panel">
 	<panel name="avatar_socks_color_panel">
-		<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere una foto"/>
+		<texture_picker label="Tessuto" name="Fabric" tool_tip="Clicca per scegliere una fotografia"/>
 		<color_swatch label="Colore/Tinta" name="Color/Tint" tool_tip="Clicca per aprire il selettore dei colori"/>
 	</panel>
 	<accordion name="wearable_accordion">
-		<accordion_tab name="socks_main_tab" title="Calze"/>
+		<accordion_tab name="socks_main_tab" title="Calzini"/>
 	</accordion>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_group_invite.xml b/indra/newview/skins/default/xui/it/panel_group_invite.xml
index 346945baff..7874f588a5 100644
--- a/indra/newview/skins/default/xui/it/panel_group_invite.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_invite.xml
@@ -18,10 +18,10 @@
 	<text name="role_text">
 		Scegli che ruolo assegnare loro:
 	</text>
-	<combo_box name="role_name" tool_tip="Choose from the list of Roles you are allowed to assign members to"/>
+	<combo_box name="role_name" tool_tip="Scegli dall&apos;elenco dei ruoli ai quali ti è consentito assegnare i membri"/>
 	<button label="Manda gli inviti" name="ok_button"/>
 	<button label="Annulla" name="cancel_button"/>
 	<string name="GroupInvitation">
-		Invito del Gruppo
+		Invito di gruppo
 	</string>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_group_land_money.xml b/indra/newview/skins/default/xui/it/panel_group_land_money.xml
index 0ad4d9cd02..1e3ef5e657 100644
--- a/indra/newview/skins/default/xui/it/panel_group_land_money.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_land_money.xml
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Terra &amp; L$" name="land_money_tab">
 	<panel.string name="help_text">
-		Appare un avviso fino a quando la Terra Totale in Uso è meno o = alla Contribuzione Totale.
+		Viene visualizzata un&apos;avvertenza fino a quando il terreno totale in uso è inferiore o uguale al contributo totale.
 	</panel.string>
 	<panel.string name="cant_view_group_land_text">
-		Non hai i permessi per vedere la terra posseduta dal gruppo
+		Non sei autorizzato a vedere quali terreni appartengono al gruppo.
 	</panel.string>
 	<panel.string name="cant_view_group_accounting_text">
-		Non hai i permessi per vedere le informazioni sulla contabilità del gruppo.
+		Non sei autorizzato a visionare le informazioni finanziarie del gruppo.
 	</panel.string>
 	<panel.string name="loading_txt">
 		Attendi...
 	</panel.string>
 	<panel.string name="land_contrib_error">
-		Incapace di impostare la tua contribuzione di terreno
+		Impossibile definire il tuo contributo di terreno
 	</panel.string>
 	<panel name="layout_panel_landmoney">
 		<scroll_list name="group_parcel_list">
@@ -60,22 +60,22 @@
 	<tab_container name="group_money_tab_container">
 		<panel label="PIANIFICAZIONE" name="group_money_planning_tab">
 			<text_editor name="group_money_planning_text">
-				Caricando...
+				Caricamento in corso...
 			</text_editor>
 		</panel>
 		<panel label="DETTAGLI" name="group_money_details_tab">
 			<text_editor name="group_money_details_text">
-				Caricando...
+				Caricamento in corso...
 			</text_editor>
 			<button label="&lt; Precedente" label_selected="&lt; Precedente" name="earlier_details_button" tool_tip="Indietro" width="90"/>
-			<button label="Successivo &gt;" label_selected="Successivo &gt;" left_delta="260" name="later_details_button" tool_tip="Prossimo" width="90"/>
+			<button label="Successivo &gt;" label_selected="Successivo &gt;" left_delta="260" name="later_details_button" tool_tip="Avanti" width="90"/>
 		</panel>
 		<panel label="VENDITE" name="group_money_sales_tab">
 			<text_editor name="group_money_sales_text">
-				Caricando...
+				Caricamento in corso...
 			</text_editor>
 			<button label="&lt; Precedente" label_selected="&lt; Precedente" name="earlier_sales_button" tool_tip="Indietro" width="90"/>
-			<button label="Successivo &gt;" label_selected="Successivo &gt;" left_delta="260" name="later_sales_button" tool_tip="Prossimo" width="90"/>
+			<button label="Successivo &gt;" label_selected="Successivo &gt;" left_delta="260" name="later_sales_button" tool_tip="Avanti" width="90"/>
 		</panel>
 	</tab_container>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_group_notices.xml b/indra/newview/skins/default/xui/it/panel_group_notices.xml
index e1e397392f..9dac282de9 100644
--- a/indra/newview/skins/default/xui/it/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_notices.xml
@@ -5,10 +5,10 @@
 Puoi disattivare la ricezione delle notice nella finestra principale.
 	</panel.string>
 	<panel.string name="no_notices_text">
-		Non ci sono vecchie Notice
+		Non ci sono avvisi precedenti
 	</panel.string>
 	<text name="lbl2">
-		Le Notice sono conservate per 14 giorni.
+		Gli avvisi sono conservati per 14 giorni.
 Massimo 200 per gruppo al giorno
 	</text>
 	<scroll_list name="notice_list">
@@ -17,10 +17,10 @@ Massimo 200 per gruppo al giorno
 		<scroll_list.columns label="Data" name="date"/>
 	</scroll_list>
 	<text name="notice_list_none_found">
-		Nessuna trovata
+		Nessuno trovato
 	</text>
-	<button label="Crea una nuova notice" label_selected="Crea una nuova notice" name="create_new_notice" tool_tip="Crea una nuova notice"/>
-	<button label="Aggiorna" label_selected="Aggiorna l&apos;elenco" name="refresh_notices" tool_tip="Aggiorna la lista delle notice"/>
+	<button label="Crea un nuovo avviso" label_selected="Crea una nuova notice" name="create_new_notice" tool_tip="Crea un nuovo avviso"/>
+	<button label="Aggiorna" label_selected="Aggiorna l&apos;elenco" name="refresh_notices" tool_tip="Aggiorna la lista degli avvisi"/>
 	<panel label="Crea una nuova notice" name="panel_create_new_notice">
 		<text name="lbl">
 			Crea una notice
@@ -41,15 +41,15 @@ Massimo 200 per gruppo al giorno
 			Trascina e rilascia qui l&apos;oggetto da allegare:
 		</text>
 		<button label="Rimuovi" label_selected="Rimuovi allegato" name="remove_attachment" tool_tip="Rimuovi allegato dal tuo avviso"/>
-		<button label="Spedisci" label_selected="Spedisci" name="send_notice"/>
-		<group_drop_target name="drop_target" tool_tip="Trascina un oggetto dall&apos;inventario nello spazio ALLEGA per spedirlo con la notice. Devi avere i permessi copy e transfer relativi all&apos;oggetto da allegare."/>
+		<button label="Invia" label_selected="Invia" name="send_notice"/>
+		<group_drop_target name="drop_target" tool_tip="Trascina un oggetto dall&apos;inventario ín questa casella per spedirlo con questo avviso. Devi avere i diritti per la copia e il trasferimento per poter allegare l&apos;oggetto."/>
 	</panel>
 	<panel label="Vedi le notice precedenti" name="panel_view_past_notice">
 		<text name="lbl">
 			Notice archiviate
 		</text>
 		<text name="lbl2">
-			Per spedire una nuova notice, clicca il bottone +
+			Per spedire un nuovo avviso, clicca sul pulsante +
 		</text>
 		<text name="lbl3">
 			Oggetto:
diff --git a/indra/newview/skins/default/xui/it/panel_me.xml b/indra/newview/skins/default/xui/it/panel_me.xml
index 7a0805b936..66601aa165 100644
--- a/indra/newview/skins/default/xui/it/panel_me.xml
+++ b/indra/newview/skins/default/xui/it/panel_me.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Mio Profilo" name="panel_me">
+<panel label="Il mio profilo" name="panel_me">
 	<tab_container name="tabs">
 		<panel label="IL MIO PROFILO" name="panel_profile"/>
 		<panel label="I MIEI PREFERITI" name="panel_picks"/>
diff --git a/indra/newview/skins/default/xui/it/panel_media_settings_security.xml b/indra/newview/skins/default/xui/it/panel_media_settings_security.xml
index 5969c7bdba..785cd048a1 100644
--- a/indra/newview/skins/default/xui/it/panel_media_settings_security.xml
+++ b/indra/newview/skins/default/xui/it/panel_media_settings_security.xml
@@ -5,7 +5,7 @@
 		Le mancate aperture di home page sono segnalate:
 	</text>
 	<button label="Aggiungi" name="whitelist_add"/>
-	<button label="Cancella" name="whitelist_del"/>
+	<button label="Elimina" name="whitelist_del"/>
 	<text name="home_url_fails_whitelist">
 		Avvertenza: la home page specificata nella scheda Generale non ha superato la lista bianca. Viene disabilitata fino a che non venga inserita una voce valida.
 	</text>
diff --git a/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
index f7a58581d4..67ec20ba18 100644
--- a/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="chat_bar">
-	<line_editor label="Clicca qui per la chat." name="chat_box" tool_tip="Premi Invio per dire, Ctrl+Invio per gridare"/>
-	<button name="show_nearby_chat" tool_tip="Mostra/Nasconde la chat log nei dintorni"/>
+	<line_editor label="Clicca qui per la chat." name="chat_box" tool_tip="Premi Invio per parlare, Ctrl+Invio per gridare"/>
+	<button name="show_nearby_chat" tool_tip="Mostra/Nasconde il registro della chat nei dintorni"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_profile_view.xml b/indra/newview/skins/default/xui/it/panel_profile_view.xml
index bf89a3e6f6..20c62d4ceb 100644
--- a/indra/newview/skins/default/xui/it/panel_profile_view.xml
+++ b/indra/newview/skins/default/xui/it/panel_profile_view.xml
@@ -6,11 +6,11 @@
 	<string name="status_offline">
 		Offline
 	</string>
-	<text_editor name="user_name" value="(Caricando...)"/>
+	<text_editor name="user_name" value="(Caricamento in corso...)"/>
 	<text name="status" value="Online"/>
 	<tab_container name="tabs">
 		<panel label="PROFILO" name="panel_profile"/>
-		<panel label="PREFERITI" name="panel_picks"/>
-		<panel label="NOTE &amp; PRIVACY" name="panel_notes"/>
+		<panel label="LUOGHI CONSIGLIATI" name="panel_picks"/>
+		<panel label="NOTE E PRIVACY" name="panel_notes"/>
 	</tab_container>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/role_actions.xml b/indra/newview/skins/default/xui/it/role_actions.xml
index eab8e6b4e3..e97a77723b 100644
--- a/indra/newview/skins/default/xui/it/role_actions.xml
+++ b/indra/newview/skins/default/xui/it/role_actions.xml
@@ -1,68 +1,68 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <role_actions>
 	<action_set description="Queste abilità permettono di aggiungere e rimuovere Membri dal gruppo, e permettono ai nuovi membri di aderire al gruppo senza invito." name="Membership">
-		<action description="Invitare persone in questo Gruppo" longdescription="Invita Persone in questo Gruppo usando il bottone &apos;Invita&apos; nella sezione Ruoli &gt; tabella Membri." name="member invite"/>
-		<action description="Espellere Membri da questo Gruppo" longdescription="Espelli Membri dal Gruppo usando il bottone &apos;Espelli&apos; nella sezione Ruoli &gt; tabella Membri. Un Proprietario può espellere chiunque eccetto un altro Proprietario. Se tu non sei un Proprietario, un Membro può essere espulso da un gruppo solo ed unicamente, se hanno il Ruolo Everyone, e nessun altro Ruolo. Per rimuovere Membri dai Ruoli, devi avere l&apos;Abilità &apos;Rimuovi Membri dai Ruoli&apos;." name="member eject"/>
-		<action description="Seleziona &apos;Iscrizione libera&apos; e modifica da &apos;Tassa d&apos;Iscrizione&apos;" longdescription="Seleziona &apos;Iscrizione libera&apos; per permettere ai nuovi Membri di aderire senza invito, e modifica da &apos;Tassa d&apos;Iscrizione&apos; nella sezione Generale." name="member options"/>
+		<action description="Invitare persone in questo Gruppo" longdescription="Invita persone in questo gruppo usando il pulsante Invita nella sezione Ruoli &gt; scheda membri." name="member invite"/>
+		<action description="Espellere Membri da questo Gruppo" longdescription="Espelli membri dal gruppo usando il pulsante Espelli nella sezione Ruoli &gt; scheda membri. Un proprietario può espellere chiunque tranne un altro proprietario. Se non sei un proprietario, un membro può essere espulso da un gruppo soltanto qualora abbia soltanto il ruolo Tutti, e nessun altro ruolo. Per rimuovere membri dai ruoli, devi avere l&apos;Abilità corrispondente." name="member eject"/>
+		<action description="Seleziona Iscrizione libera e modifica da Quota d&apos;iscrizione" longdescription="Seleziona Iscrizione libera per permettere ai nuovi membri di aderire senza invito e modifica la quota d&apos;iscrizione nella scheda Generale." name="member options"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di aggiungere, rimuovere, cambiare i Ruoli del Gruppo, aggiungere e rimuovere Membri dai Ruoli, e assegnare Abilità ai Ruoli." name="Roles">
-		<action description="Creare nuovi Ruoli" longdescription="Crea nuovi Ruoli nella sezione Ruoli &gt; tabella Ruoli." name="role create"/>
-		<action description="Cancellare Ruoli" longdescription="Cancella Ruoli nella sezione Ruoli &gt; tabella Ruoli." name="role delete"/>
-		<action description="Cambia i nomi del Ruolo, titoli, descrizioni, se i membri in quel Ruolo sono resi pubblici" longdescription="Cambia i nomi del Ruolo, titoli, descrizioni, se i membri in quel Ruolo sono resi pubblici. Viene fatto nella parte bassa della sezione Ruoli &gt; tabella Ruoli dopo avere selezionato un Ruolo." name="role properties"/>
-		<action description="Incaricare Membri ad Assegnare Ruoli" longdescription="Assegna un Ruolo a Membri nella lista dei Ruoli assegnati (Roles section &gt; Members tab). Un Membro con questa Abilità può aggiungere Membri ad un Ruolo già presente nell&apos;elenco." name="role assign member limited"/>
-		<action description="Assegnare Membri a tutti i Ruoli" longdescription="Assegna Tutti i Ruoli a Membri nella lista dei Ruoli Assegnati (Roles section &gt; Members tab). *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può assegnarsi -- e assegnare ad altri Membri non Proprietari-- Ruoli con poteri maggiori di quelli normalmente concessi, potenzialmente elevandosi ai poteri concessi al Proprietario. Siate sicuri di quello che fate prima di assegnare questa Abilità." name="role assign member"/>
-		<action description="Rimuovere Membri dai Ruoli" longdescription="Rimuovi dai Ruoli i Membri nella lista dei Ruoli Assegnati (Roles section &gt; Members tab). Il Proprietario non può essere rimosso." name="role remove member"/>
-		<action description="Assegnare e Rimuovere Abilità nei Ruoli" longdescription="Assegna e Rimuovi Abilità per ogni Ruolo nella lista dei Ruoli Assegnati (Roles section &gt; Roles tab). *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può assegnarsi --ed assegnare ad altri Membri non Proprietà-- tutte le Abilità, che potenzialmente lo elevano ai poteri ai poteri concessi al Proprietario. Siate sicuri di quello che fate prima di assegnare questa Abilità ." name="role change actions"/>
+		<action description="Creare nuovi Ruoli" longdescription="Crea nuovi ruoli nella sezione Ruoli &gt; scheda ruoli." name="role create"/>
+		<action description="Cancellare Ruoli" longdescription="Elimina ruoli nella sezione Ruoli &gt; scheda ruoli." name="role delete"/>
+		<action description="Cambia i nomi di ruoli, i titoli, le descrizioni e definisci se i membri in quel ruolo sono resi pubblici" longdescription="Cambia i nomi di ruoli, i titoli, le descrizioni e definisci se i membri in quel ruolo sono resi pubblici Viene fatto nella parte inferiore della sezione Ruoli &gt; scheda Ruoli, dopo avere selezionato un ruolo." name="role properties"/>
+		<action description="Incaricare Membri ad Assegnare Ruoli" longdescription="Assegna un ruolo a membri nella lista dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Un utente con questa Abilità può aggiungere membri ad un ruolo nel quale il responsabile è già presente." name="role assign member limited"/>
+		<action description="Assegnare Membri a tutti i Ruoli" longdescription="Assegna i membri a qualsiasi ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). *ATTENZIONE* Ogni membro con questo Ruolo e Abilità può assegnarsi -- e assegnare ad altri membri non proprietari -- ruoli con poteri maggiori di quelli normalmente concessi, potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role assign member"/>
+		<action description="Rimuovere Membri dai Ruoli" longdescription="Rimuovi dai ruoli i membri nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Il proprietario non può essere rimosso." name="role remove member"/>
+		<action description="Assegnare e Rimuovere Abilità nei Ruoli" longdescription="Assegna e Rimuovi Abilità per ogni ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda Ruoli). *ATTENZIONE* Ogni membro con questo ruolo e Abilità può assegnarsi -- ed assegnare ad altri membri non proprietari -- tutte le Abilità, che potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role change actions"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di modificare l&apos;identità di questo Gruppo, come il cambiamento della visibilità pubblica, lo statuto, e lo stemma." name="Group Identity">
-		<action description="Cambiare lo Statuto, lo Stemma, e &apos;Mostra nel Cerca/Search&apos;" longdescription="Cambia Statuto, Immagine, e &apos;Mostra nel Cerca&apos;. Viene fatto nella sezione Generale." name="group change identity"/>
+		<action description="Cambiare lo Statuto, lo Stemma, e &apos;Mostra nel Cerca/Search&apos;" longdescription="Cambia statuto, logo e &apos;Mostra nella ricerca&apos;. Viene fatto nella sezione Generale." name="group change identity"/>
 	</action_set>
-	<action_set description="Queste Abilità includono il potere di intestare, modificare, e vendere terreni di proprietà del Gruppo. Per aprire la finestra Info sul Terreno, click destro sulla terra e seleziona &apos;Info sul Terreno&apos;, o clicca l&apos;icona &apos;i&apos; sulla Barra di Navigazione." name="Parcel Management">
+	<action_set description="Queste Abilità comprendono il potere di intestare, modificare e vendere terreni di proprietà del gruppo. Per aprire la finestra Informazioni sul terreno, fai clic con il pulsante destro del mouse sul terreno e seleziona Informazioni sul terreno, o clicca sull&apos;icona &apos;i&apos; nella Barra di Navigazione." name="Parcel Management">
 		<action description="Intestare terra e comprare terra per il gruppo" longdescription="Intesta terra e compra terra per il Gruppo. Viene fatto in Informazioni sul Terreno &gt; tabella Generale." name="land deed"/>
 		<action description="Abbandonare la terra in favore di Governor Linden" longdescription="Abbandona la terra in favore di Governor Linden. *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può abbandonare la terra posseduta dal Gruppo in Informazioni sul Terreno &gt; tabella Generale, restituendola alla proprietà Linden senza una vendita! Devi essere sicuro di quello che fai prima di assegnare questa Abilità." name="land release"/>
 		<action description="Impostare le info per la vendita della terra" longdescription="Imposta le info per la vendita della terra. *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può vendere la terra posseduta dal Gruppo in Info sul Terreno &gt; tabella Generale (al prezzo che vogliono)! Devi essere sicuro di quello che fai prima di assegnare questa Abilità." name="land set sale info"/>
-		<action description="Suddividere e unire appezzamenti" longdescription="Suddividi e unisci parcel. Viene fatto con click destro sul terra, &apos;Modifica Terreno&apos;, trascinando poi il mouse sulla terra per creare una selezione. Per suddividere, seleziona quale parte vuoi dividere e clicca &apos;Suddividere&apos;. Per unire, seleziona due o più two parcel confinanti e clicca &apos;Unisci&apos;." name="land divide join"/>
+		<action description="Suddividere e unire appezzamenti" longdescription="Suddividi e unisci lotti. Viene fatto cliccando con il pulsante destro del mouse sul terreno, selezionando Modifica terreno e trascinando il mouse sul terreno per creare una selezione. Per suddividere, seleziona quale parte vuoi dividere e clicca su Suddividi. Per unire, seleziona due o più lotti confinanti e clicca su Unisci." name="land divide join"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di cambiare il nome dell&apos;appezzamento, le impostazioni pre-definite, la visibilità nella mappatura, il punto di arrivo &amp; le coordinate del Teleport." name="Parcel Identity">
-		<action description="Premi &apos;Mostra Luogo nel Cerca&apos; e seleziona una categoria" longdescription="Premi &apos;Mostra Luogo nel Cerca&apos; e seleziona una categoria di parcel in Info sul Terreno &gt; tabella Opzioni." name="land find places"/>
-		<action description="Cambia il nome del parcel, descrizione, e impostazioni nel &apos;Mostra Luogo nel Cerca&apos;" longdescription="Cambia il nome del parcel, descrizione, e impostazioni nel &apos;Mostra Luogo nel Cerca&apos;. Viene fatto in Info sul Terreno &gt; tabella Opzioni." name="land change identity"/>
+		<action description="Premi Mostra luogo nella ricerca e seleziona una categoria" longdescription="Premi Mostra luogo nella ricerca e seleziona una categoria di lotto in Informazioni sul terreno &gt; scheda Opzioni." name="land find places"/>
+		<action description="Cambia il nome del lotto, la descrizione e le impostazioni di Mostra luogo nella ricerca" longdescription="Cambia il nome del lotto, la descrizione e le impostazioni di Mostra luogo nella ricerca. Ciò viene fatto in Informazioni sul terreno &gt; scheda Opzioni." name="land change identity"/>
 		<action description="Impostare il punto di arrivo e le coordinate del Teleport" longdescription="In un appezzamento posseduto da un Gruppo, i Membri con questo Ruolo e Abilità possono impostare un punto di arrivo per i Teleport entranti, e impostare anche le coordinate del Teleport per ulteriore precisione. Viene fatto in Informazioni sul Terreno &gt; tabella Opzioni." name="land set landing point"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono alcune permessi nell&apos;appezzamento, quali &apos;Creare Oggetti&apos;, &apos;Editare il Terreno&apos;, trasmettere musica &amp; tabella Media." name="Parcel Settings">
 		<action description="Cambiare musica &amp; tabella media" longdescription="Cambia le impostazioni per lo streaming della musica e dei video in Informazioni sul Terreno &gt; tabella Media." name="land change media"/>
 		<action description="Cliccare &apos;Edita il Terreno&apos;" longdescription="Clicca &apos;Edita il Terreno&apos;. *ATTENZIONE* Informazioni sul Terreno &gt; tabella Opzioni &gt; Edita il Terreno permette a tutti di modificare la forma del terreno, collocare e spostare le piante Linden. Devi essere sicuro di quello che fai prima di assignera questa Abilità. Edita il terreno in Informazioni sul Terreno &gt; tabella Opzioni." name="land edit"/>
-		<action description="Cliccare Informazioni sul Terreno &gt; Impostazione Opzioni" longdescription="Premi &apos;Salvo (nessun danno)&apos;, &apos;Vola&apos;, e permetti agli altri Residenti di: &apos;modifica Terreno&apos;, &apos;Crea&apos;, &apos;Crea Landmarks&apos;, e &apos;Scripts attivi&apos; nella terra posseduta da un Gruppo in Info sul Terreno &gt; tabella Opzioni." name="land options"/>
+		<action description="Cliccare Informazioni sul Terreno &gt; Impostazione Opzioni" longdescription="Premi Sicuro (nessun danno), Vola e consenti agli altri residenti di: modificare il terreno, costruire, creare punti di riferimento ed eseguire script nel terreno appartenente ad un gruppo in Informazioni sul terreno &gt; scheda Opzioni." name="land options"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono ai Membri di non avere restrizioni in un appezzamento posseduto da un Gruppo." name="Parcel Powers">
 		<action description="Permettere sempre &apos;Edita il Terreno&apos;" longdescription="I Membri con questo Ruolo e Abilità possono editare il terreno posseduto da un Gruppo, anche se non è selezionato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow edit land"/>
 		<action description="Permettere Vola Sempre&apos;" longdescription="I Membri con questo Ruolo e Abilità possono volare in un terreno posseduto da un Gruppo, anche se non è selezionato in Info sul Terreno &gt; tabella Opzioni." name="land allow fly"/>
 		<action description="Permettere &apos;Crea Oggetti&apos; sempre" longdescription="I Membri con questo Ruolo e Abilità possono creare oggetti in un appezzamento posseduto da un Gruppo, anche se non è selezionato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow create"/>
 		<action description="Permettere &apos;Crea Landmark&apos; sempre" longdescription="I Membri con questo Ruolo e Abilità possono creare Landmark in un appezzamento posseduto da un Gruppo , anche se non è evidenziato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow landmark"/>
-		<action description="Permettere &apos;Teleportami a Casa&apos; in un appezzamento di un Gruppo" longdescription="I Membri in un Ruolo con questa Abilità possono usare il menu Mondo &gt; Landmarks &gt; Imposta come Casa su un parcel intestato ad un Gruppo." name="land allow set home"/>
+		<action description="Permettere &apos;Teleportami a Casa&apos; in un appezzamento di un Gruppo" longdescription="I membri in un ruolo con questa Abilità possono usare il menu Mondo &gt; Punti di riferimento &gt; Imposta come Casa su un lotto ceduto a questo gruppo." name="land allow set home"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di concedere o limitare l&apos;accesso ad un appezzamento di un Gruppo, e includono Congela ed Espelli un Residente." name="Parcel Access">
 		<action description="Gestire la lista degli Accessi Consentiti" longdescription="Gestisci la lista degli Accessi Consentiti in Informazioni sul Terreno &gt; tabella Accesso." name="land manage allowed"/>
-		<action description="Gestire la lista degli Accessi Bloccati" longdescription="Gestisci la lista Espulsi dal parcel in Info sul Terreno &gt; tabella Accesso." name="land manage banned"/>
-		<action description="Cambia le impostazioni del parcel in &apos;Vendi Pass a&apos;" longdescription="Cambia le impostazioni &apos;Vendi Pass a&apos; in Info sul Terreno &gt; tabella Accesso." name="land manage passes"/>
-		<action description="Espellere e Congelare i Residenti in un appezzamento" longdescription="Membri in un Ruolo con questa Abilità possono occuparsi di un residente indesiderato in un parcel posseduto da un Gruppo, con click destro sul residente, selezionando &apos;Espelli&apos; o &apos;Immobilizza&apos;." name="land admin"/>
+		<action description="Gestire la lista degli Accessi Bloccati" longdescription="Gestisci la lista Espulsi dal lotto in Informazioni sul terreno &gt; scheda Accesso." name="land manage banned"/>
+		<action description="Cambia le impostazioni del lotto in Vendi pass a" longdescription="Cambia le impostazioni Vendi pass a in Informazioni sul terreno &gt; scheda Accesso." name="land manage passes"/>
+		<action description="Espellere e Congelare i Residenti in un appezzamento" longdescription="Membri in un ruolo con questa Abilità possono occuparsi di un residente indesiderato in un lotto posseduto da un gruppo, facendo clic sul residente con il pulsante destro del mouse e selezionando Espelli o Congela." name="land admin"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono ai Membri di restituire oggetti, collocare e spostare piante Linden. Questo è utile ai Membri per ripulire da oggetti indesiderati e creare paesaggi, ma deve essere utilizzato con cura, perchè non si può annullare la restituzione degli Oggetti." name="Parcel Content">
 		<action description="Restituire oggetti posseduti da un Gruppo" longdescription="Restituisci gli oggetti posseduti da un Gruppo in un appezzamento di un Gruppo in Informazioni sul Terreno &gt; tabella Oggetti." name="land return group owned"/>
 		<action description="Restituire oggetti concessi ad un Gruppo" longdescription="Restituisci oggetti concessi ad un Gruppo in un appezzamento di un Gruppo in Informazioni sul Terreno &gt; tabella Oggetti." name="land return group set"/>
 		<action description="Restituire oggetti estranei al Gruppo" longdescription="Restituire oggetti estranei al Gruppo in un appezzamento di un Gruppo in Info sul Terreno &gt; tabella Oggetti." name="land return non group"/>
-		<action description="Creare un paesaggio utilizzando le piante Linden" longdescription="Abilità di creare paesaggi di posizionare e spostare alberi, piante, erba. Questi oggetti sono presenti nella Libreria del tuo Inventario &gt; Cartella Oggetti, o possono essere creati con il menu Crea." name="land gardening"/>
+		<action description="Creare un paesaggio utilizzando le piante Linden" longdescription="Abilità di creare paesaggi e posizionare e spostare alberi, piante, erba Linden. Questi oggetti sono presenti nella Libreria del tuo Inventario &gt; cartella Oggetti, o possono essere creati con il menu Crea." name="land gardening"/>
 	</action_set>
-	<action_set description="Queste Abilità includono il potere di intestare, modificare, vendere oggetti posseduti dal gruppo. Viene fatto in Build Tools &gt; tabella Generale. Click destro su un oggetto e Modifica per vedere le impostazioni." name="Object Management">
-		<action description="Intestare oggetti ad un Gruppo" longdescription="Intesta oggetti ad un Gruppo in Build Tools &gt; tabella Generale." name="object deed"/>
-		<action description="Modificare (sposta, copia, modifica) oggetti di un Gruppo" longdescription="Controlla (sposta, copia, modifica) gli oggetti posseduti da un Gruppo in Build Tools &gt; tabella Generale." name="object manipulate"/>
-		<action description="Mettere in vendita oggetti di un Gruppo" longdescription="Metti in vendita oggetti posseduti da un Gruppo in Build Tools &gt; tabelle Generale." name="object set sale"/>
+	<action_set description="Queste Abilità includono il potere di cedere, modificare e vendere oggetti posseduti dal gruppo. Viene fatto negli strumenti Costruisci &gt; scheda Generale. Clic con il pulsante destro del mouse su un oggetto e Modifica per vedere le impostazioni." name="Object Management">
+		<action description="Intestare oggetti ad un Gruppo" longdescription="Intesta oggetti ad un gruppo in Strumenti per costruzione &gt; scheda Generale." name="object deed"/>
+		<action description="Modificare (sposta, copia, modifica) oggetti di un Gruppo" longdescription="Gestisci (sposta, copia, modifica) gli oggetti appartenenti ad un gruppo in Build Tools &gt; tabella Generale." name="object manipulate"/>
+		<action description="Mettere in vendita oggetti di un Gruppo" longdescription="Metti in vendita oggetti posseduti da un Gruppo in Strumenti per costruzione &gt; scheda Generale." name="object set sale"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di richiedere ai Membri di pagare le perdite del Gruppo e di ricevere i dividendi del Gruppo, e di limitare l&apos;accesso all&apos;account del Gruppo." name="Accounting">
 		<action description="Pagare le perdite del Gruppo e ricevere i dividendi del Gruppo" longdescription="I Membri con questo Ruolo e Abilità pagheranno automaticamente le perdite del Gruppo e riceveranno i dividendi del Gruppo. Questo significa che riceveranno una porzione delle vendite di terre possedute dal gruppo (che sono risolte giornalmente), e contribuiranno anche su cose come le tasse di iscrizione dell&apos;appezzament. " name="accounting accountable"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono ai Membri di spedire, ricevere, e vedere le Notice del Gruppo." name="Notices">
-		<action description="Spedire Notice" longdescription="Membri in un Ruolo con questa Abilità possono spedire Notice nel Gruppo &gt; sezione Notice." name="notices send"/>
-		<action description="Ricevere Notice e vedere Notice precedenti" longdescription="Membri in un ruolo con questa Abilità possono ricevere Notice e vedere Notice vecchie nel Gruppo &gt; sezione Notice." name="notices receive"/>
+		<action description="Spedire Notice" longdescription="Membri in un ruolo con questa Abilità possono inviare avvisi tramite la sezione Gruppo &gt; Avvisi." name="notices send"/>
+		<action description="Ricevere Notice e vedere Notice precedenti" longdescription="Membri in un ruolo con questa Abilità possono ricevere avvisi e vedere avvisi precedenti nella sezione Gruppo &gt; Avvisi." name="notices receive"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di concedere o limitare l&apos;accesso alle sessioni di chat e di voice chat nel gruppo." name="Chat">
 		<action description="Aderire alla Chat di Gruppo" longdescription="I Membri con questo Ruolo e Abilità possono aderire alle sessioni di chat, sia scritte che in voice." name="join group chat"/>
-- 
cgit v1.2.3


From 8a3fe4d9e4dd5e3092bf55664c0435315690d1f0 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Fri, 26 Mar 2010 17:47:12 -0700
Subject: Fix for EXT-6573 (Mouse-steering doesn't work in third person view)

LLAgentCamera::cameraOrbitAround() (which had been created from LLAgent:: cameraOrbitAround() when LLAgentCamera was factored out) wasn't correctly processing yaw.  Specifically, since gAgent.getFrameAgent() returns by value and not reference, gAgent.getFrameAgent().rotate() was discarding the result of the rotation.

Changed LLAgentCamera::cameraOrbitAround() to use gAgent.yaw() instead, and changed LLAgent::getFrameAgent() to return a const reference instead of a value, which should make the compiler catch errors like this.

Reviewed by Richard in http://codereview.lindenlab.com/1153001
---
 indra/newview/llagent.h         | 2 +-
 indra/newview/llagentcamera.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 891ce799d2..b59a49be13 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -217,7 +217,7 @@ public:
 	// Coordinate System
 	//--------------------------------------------------------------------
 public:
-	LLCoordFrame	getFrameAgent()	const	{ return mFrameAgent; }
+	const LLCoordFrame&	getFrameAgent()	const	{ return mFrameAgent; }
 	void 			initOriginGlobal(const LLVector3d &origin_global); // Only to be used in ONE place
 	void			resetAxes();
 	void			resetAxes(const LLVector3 &look_at); // Makes reasonable left and up
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index e000d44ab8..8eee53363e 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -852,7 +852,7 @@ void LLAgentCamera::cameraOrbitAround(const F32 radians)
 	}
 	else if (mFocusOnAvatar && (mCameraMode == CAMERA_MODE_THIRD_PERSON || mCameraMode == CAMERA_MODE_FOLLOW))
 	{
-		gAgent.getFrameAgent().rotate(radians, gAgent.getReferenceUpVector());
+		gAgent.yaw(radians);
 	}
 	else
 	{
-- 
cgit v1.2.3


From cb7ea3f354f8305471e40090fff96e868517b60e Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Fri, 26 Mar 2010 18:21:10 -0700
Subject: Fix "clear cookies" not clearing cookies in some cases

LLViewerMedia::clearAllCookies was sending "clear cookies" messages to all plugins and deleting cookie files, but it wasn't clearing the cookies in the central store.  It now does all of the above.
---
 indra/newview/llviewermedia.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index ab55fcff6e..61a75f7227 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1008,6 +1008,9 @@ void LLViewerMedia::clearAllCookies()
 		}
 	}
 	
+	// Clear all cookies from the cookie store
+	getCookieStore()->setAllCookies("");
+
 	// FIXME: this may not be sufficient, since the on-disk cookie file won't get written until some browser instance exits cleanly.
 	// It also won't clear cookies for other accounts, or for any account if we're not logged in, and won't do anything at all if there are no webkit plugins loaded.
 	// Until such time as we can centralize cookie storage, the following hack should cover these cases:
@@ -1051,7 +1054,8 @@ void LLViewerMedia::clearAllCookies()
 		{	
 			LLFile::remove(target);
 		}
-
+		
+		// Other accounts may have new-style cookie files too -- delete them as well
 		target = base_dir;
 		target += filename;
 		target += gDirUtilp->getDirDelimiter();
-- 
cgit v1.2.3


From 524b207125ad8ac94026ed585390771ad36f98d2 Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Fri, 26 Mar 2010 22:00:59 -0400
Subject: Fix application icon position for Mac

---
 .../newview/installers/darwin/release-dmg/_DS_Store | Bin 12292 -> 12292 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/installers/darwin/release-dmg/_DS_Store b/indra/newview/installers/darwin/release-dmg/_DS_Store
index 495ec37f53..8f6c25c2f4 100644
Binary files a/indra/newview/installers/darwin/release-dmg/_DS_Store and b/indra/newview/installers/darwin/release-dmg/_DS_Store differ
-- 
cgit v1.2.3


From d60830b52256ea53b94e8eb333b39eb22404d280 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 21:12:43 -0700
Subject: PT linguistic

---
 .../skins/default/xui/es/floater_joystick.xml      |   2 +-
 indra/newview/skins/default/xui/es/menu_viewer.xml |  12 +-
 .../newview/skins/default/xui/es/notifications.xml |   2 +-
 .../newview/skins/default/xui/pt/floater_about.xml |   2 +-
 .../skins/default/xui/pt/floater_about_land.xml    |  88 +++---
 .../skins/default/xui/pt/floater_bulk_perms.xml    |   8 +-
 .../skins/default/xui/pt/floater_customize.xml     |  40 +--
 .../skins/default/xui/pt/floater_preferences.xml   |   2 +-
 .../skins/default/xui/pt/floater_snapshot.xml      |  12 +-
 .../newview/skins/default/xui/pt/floater_tools.xml |   4 +-
 .../skins/default/xui/pt/menu_inventory.xml        |  46 +--
 .../skins/default/xui/pt/menu_inventory_add.xml    |   2 +-
 .../default/xui/pt/menu_teleport_history_item.xml  |   2 +-
 indra/newview/skins/default/xui/pt/menu_viewer.xml |  52 +--
 .../newview/skins/default/xui/pt/notifications.xml |   6 +-
 .../skins/default/xui/pt/panel_edit_tattoo.xml     |   6 +-
 .../skins/default/xui/pt/panel_group_general.xml   |   2 +-
 .../skins/default/xui/pt/panel_group_notices.xml   |   6 +-
 .../newview/skins/default/xui/pt/panel_groups.xml  |   8 +-
 .../skins/default/xui/pt/panel_main_inventory.xml  |   2 +-
 .../xui/pt/panel_media_settings_general.xml        |   2 +-
 .../newview/skins/default/xui/pt/panel_people.xml  |   4 +-
 .../skins/default/xui/pt/panel_place_profile.xml   |   2 +-
 .../newview/skins/default/xui/pt/panel_places.xml  |   2 +-
 .../default/xui/pt/panel_preferences_advanced.xml  |  10 +-
 .../default/xui/pt/panel_preferences_chat.xml      |   6 +-
 .../default/xui/pt/panel_preferences_general.xml   |  18 +-
 .../default/xui/pt/panel_preferences_setup.xml     |   4 +-
 indra/newview/skins/default/xui/pt/strings.xml     | 348 ++++++++++-----------
 29 files changed, 350 insertions(+), 350 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/floater_joystick.xml b/indra/newview/skins/default/xui/es/floater_joystick.xml
index 283a46b60b..dbd2e4f04e 100644
--- a/indra/newview/skins/default/xui/es/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/es/floater_joystick.xml
@@ -63,7 +63,7 @@
 	<text name="ZoomDeadZone">
 		Zona muerta zoom
 	</text>
-	<button font="SansSerifSmall" label="Predeterminados del SpaceNavigator" left="330" name="SpaceNavigatorDefaults" width="210"/>
+	<button font="SansSerifSmall" label="Por defecto del SpaceNavigator" left="330" name="SpaceNavigatorDefaults" width="210"/>
 	<button label="OK" label_selected="OK" left="330" name="ok_btn"/>
 	<button label="Cancelar" label_selected="Cancelar" left_delta="120" name="cancel_btn"/>
 	<stat_view label="Monitor del joystick" name="axis_view">
diff --git a/indra/newview/skins/default/xui/es/menu_viewer.xml b/indra/newview/skins/default/xui/es/menu_viewer.xml
index 2cbd0f0a61..93964a2f4f 100644
--- a/indra/newview/skins/default/xui/es/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/es/menu_viewer.xml
@@ -238,7 +238,7 @@
 			<menu_item_check label="Frame Test" name="Frame Test"/>
 		</menu>
 		<menu label="Rendering" name="Rendering">
-			<menu_item_check label="Ejes" name="Axes"/>
+			<menu_item_check label="Axes" name="Axes"/>
 			<menu_item_check label="Wireframe" name="Wireframe"/>
 			<menu_item_check label="Global Illumination" name="Global Illumination"/>
 			<menu_item_check label="Animation Textures" name="Animation Textures"/>
@@ -254,7 +254,7 @@
 		<menu_item_call label="Bumps, Pushes &amp; Hits" name="Bumps, Pushes &amp;amp; Hits"/>
 		<menu label="World" name="World">
 			<menu_item_check label="Region Sun Override" name="Sim Sun Override"/>
-			<menu_item_check label="Baliza con destellos" name="Cheesy Beacon"/>
+			<menu_item_check label="Beacon flashing effect" name="Cheesy Beacon"/>
 			<menu_item_check label="Fixed Weather" name="Fixed Weather"/>
 			<menu_item_call label="Dump Region Object Cache" name="Dump Region Object Cache"/>
 		</menu>
@@ -277,10 +277,10 @@
 		<menu label="Avatar" name="Character">
 			<menu label="Grab Baked Texture" name="Grab Baked Texture">
 				<menu_item_call label="Iris" name="Iris"/>
-				<menu_item_call label="Cabeza" name="Head"/>
+				<menu_item_call label="Head" name="Head"/>
 				<menu_item_call label="Upper Body" name="Upper Body"/>
 				<menu_item_call label="Lower Body" name="Lower Body"/>
-				<menu_item_call label="Falda" name="Skirt"/>
+				<menu_item_call label="Skirt" name="Skirt"/>
 			</menu>
 			<menu label="Character Tests" name="Character Tests">
 				<menu_item_call label="Toggle Character Geometry" name="Toggle Character Geometry"/>
@@ -297,8 +297,8 @@
 		<menu_item_check label="HTTP Textures" name="HTTP Textures"/>
 		<menu_item_check label="Console Window on next Run" name="Console Window"/>
 		<menu_item_check label="Show Admin Menu" name="View Admin Options"/>
-		<menu_item_call label="Solicitar estatus de Administrador" name="Request Admin Options"/>
-		<menu_item_call label="Dejar el estatus de Administrador" name="Leave Admin Options"/>
+		<menu_item_call label="Request Admin Status" name="Request Admin Options"/>
+		<menu_item_call label="Leave Admin Status" name="Leave Admin Options"/>
 	</menu>
 	<menu label="Admin" name="Admin">
 		<menu label="Object">
diff --git a/indra/newview/skins/default/xui/es/notifications.xml b/indra/newview/skins/default/xui/es/notifications.xml
index cc6a442508..df18b88832 100644
--- a/indra/newview/skins/default/xui/es/notifications.xml
+++ b/indra/newview/skins/default/xui/es/notifications.xml
@@ -1734,7 +1734,7 @@ Dado que estos objetos tienen scripts, moverlos a tu inventario puede provocar u
 		<usetemplate ignoretext="Confirmar antes de salir" name="okcancelignore" notext="No salir" yestext="Salir"/>
 	</notification>
 	<notification name="HelpReportAbuseEmailLL">
-		Usa esta herramienta para denunciar violaciones de las [http://secondlife.com/corporate/tos.php Condiciones de Servicio] o las [http://secondlife.com/corporate/cs.php Normas de la Comunidad].
+		Usa esta herramienta para denunciar violaciones de las [http://secondlife.com/corporate/tos.php Condiciones del Servicio] o las [http://secondlife.com/corporate/cs.php Normas de la Comunidad].
 
 Se investigan y resuelven todas las infracciones denunciadas.
 	</notification>
diff --git a/indra/newview/skins/default/xui/pt/floater_about.xml b/indra/newview/skins/default/xui/pt/floater_about.xml
index 39548dc497..f1f6ff9aea 100644
--- a/indra/newview/skins/default/xui/pt/floater_about.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about.xml
@@ -38,7 +38,7 @@ Versão Vivox: [VIVOX_VERSION]
 	</floater.string>
 	<tab_container name="about_tab">
 		<panel label="Info" name="support_panel">
-			<button label="Copiar para área de transferência" name="copy_btn"/>
+			<button label="Copiar" name="copy_btn"/>
 		</panel>
 		<panel label="Créditos" name="credits_panel">
 			<text_editor name="credits_editor">
diff --git a/indra/newview/skins/default/xui/pt/floater_about_land.xml b/indra/newview/skins/default/xui/pt/floater_about_land.xml
index 885221997a..252969609a 100644
--- a/indra/newview/skins/default/xui/pt/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/pt/floater_about_land.xml
@@ -118,7 +118,7 @@ Vá para o menu Mundo &gt; Sobre a Terra ou selecione outro lote para mostrar se
 			</text>
 			<button label="Cancelar venda do terreno" label_selected="Cancelar venda do terreno" left="275" name="Cancel Land Sale" width="165"/>
 			<text name="Claimed:">
-				Reclamado:
+				Posse em:
 			</text>
 			<text name="DateClaimText">
 				Ter Ago 15 13:47:25 2006
@@ -135,28 +135,28 @@ Vá para o menu Mundo &gt; Sobre a Terra ou selecione outro lote para mostrar se
 			<text name="DwellText">
 				0
 			</text>
-			<button label="Comprar Terra..." label_selected="Comprar Terra..." left="130" name="Buy Land..." width="125"/>
+			<button label="Comprar terreno..." label_selected="Comprar terreno..." left="130" name="Buy Land..." width="125"/>
 			<button label="Dados do script" name="Scripts..."/>
 			<button label="Comprar para o Grupo" name="Buy For Group..."/>
-			<button label="Comprar Passe..." label_selected="Comprar Passe..." left="130" name="Buy Pass..." tool_tip="Um passe concede a você acesso temporário a esta terra." width="125"/>
-			<button label="Abandonar Terra.." label_selected="Abandonar Terra.." name="Abandon Land..."/>
-			<button label="Reclamar Terra" name="Reclaim Land..."/>
-			<button label="Venda Linden" name="Linden Sale..." tool_tip="A terra precisa ser possuída, estar com o conteúdo configurado e não estar pronta para leilão."/>
+			<button label="Comprar passe..." label_selected="Comprar passe..." left="130" name="Buy Pass..." tool_tip="Um passe concede a você acesso temporário a este terreno." width="125"/>
+			<button label="Abandonar terreno..." label_selected="Abandonar terreno..." name="Abandon Land..."/>
+			<button label="Pedir terreno" name="Reclaim Land..."/>
+			<button label="Venda Linden" name="Linden Sale..." tool_tip="O terreno precisa ser possuído, estar com o conteúdo configurado e não estar pronto para leilão."/>
 		</panel>
 		<panel label="CONTRATO" name="land_covenant_panel">
 			<panel.string name="can_resell">
-				Terra comprada nesta região pode ser revendida.
+				Terrenos comprados nesta região podem ser revendidos.
 			</panel.string>
 			<panel.string name="can_not_resell">
-				Terra comprada nesta região não pode ser revendida.
+				Terrenos comprados nesta região não podem ser revendidos.
 			</panel.string>
 			<panel.string name="can_change">
-				Terra comprada nesta região pode ser compartilhada
-ou sub-dividida.
+				Terrenos comprados nesta região podem ser compartilhados
+ou sub-divididos.
 			</panel.string>
 			<panel.string name="can_not_change">
-				Terra comprada nesta região não pode ser compartilhada
-ou sub-dividida.
+				Terrenos comprados nesta região não podem ser compartilhados
+ou sub-divididos.
 			</panel.string>
 			<text name="estate_section_lbl">
 				Propriedade:
@@ -215,7 +215,7 @@ ou sub-dividida.
 				[COUNT] de [MAX] ([DELETED] serão deletados)
 			</panel.string>
 			<text name="parcel_object_bonus">
-				Fator de Bonus para Objetos na Região: [BONUS]
+				Fator de bônus para objetos na região: [BONUS]
 			</text>
 			<text name="Simulator primitive usage:">
 				Uso de prims:
@@ -224,13 +224,13 @@ ou sub-dividida.
 				[COUNT] de [MAX] ([AVAILABLE] disponíveis)
 			</text>
 			<text name="Primitives parcel supports:" width="200">
-				Primitivas suportadas pelo lote:
+				Prims suportadas pelo lote:
 			</text>
 			<text left="214" name="object_contrib_text" width="152">
 				[COUNT]
 			</text>
 			<text name="Primitives on parcel:">
-				Primitivas no Lote:
+				Prims no Lote:
 			</text>
 			<text left="214" name="total_objects_text" width="48">
 				[COUNT]
@@ -252,7 +252,7 @@ ou sub-dividida.
 			<button label="Mostrar" label_selected="Mostrar" name="ShowGroup" right="-135" width="60"/>
 			<button label="Retornar" name="ReturnGroup..." right="-10" tool_tip="Retornar os objetos para seus donos." width="119"/>
 			<text left="14" name="Owned by others:" width="128">
-				Propriedade de Outros:
+				Propriedade de outros:
 			</text>
 			<text left="214" name="other_objects_text" width="48">
 				[COUNT]
@@ -266,13 +266,13 @@ ou sub-dividida.
 				[COUNT]
 			</text>
 			<text left="4" name="Autoreturn" width="412">
-				Devolver objetos de outros residentes automaticamente (digite 0 para desligar)
+				Devolver objetos de outros residentes (p/ desligar tecle 0)
 			</text>
 			<line_editor name="clean other time" right="-10"/>
 			<text name="Object Owners:">
-				Donos dos Objetos:
+				Donos dos objetos:
 			</text>
-			<button label="Atualizar Lista" label_selected="Atualizar Lista" left="118" name="Refresh List" tool_tip="Refresh Object List"/>
+			<button label="Atualizar lista" label_selected="Atualizar lista" left="118" name="Refresh List" tool_tip="Refresh Object List"/>
 			<button label="Retornar objetos..." label_selected="Retornar objetos..." left="230" name="Return objects..."/>
 			<name_list name="owner list">
 				<name_list.columns label="Tipo" name="type"/>
@@ -293,25 +293,25 @@ Apenas lotes maiores podem ser listados na busca.
 				Esta opção está desabilitada porque você não pode modificar as opções deste lote.
 			</panel.string>
 			<panel.string name="mature_check_mature">
-				Conteúdo Mature
+				Conteúdo Adulto
 			</panel.string>
 			<panel.string name="mature_check_adult">
-				Conteúdo Adult
+				Conteúdo Adulto
 			</panel.string>
 			<panel.string name="mature_check_mature_tooltip">
-				A informação do seu lote ou seu conteúdo são considerados mature.
+				A informação do seu lote ou seu conteúdo são considerados adulto.
 			</panel.string>
 			<panel.string name="mature_check_adult_tooltip">
-				A informação do seu lote ou seu conteúdo são considerados adult.
+				A informação do seu lote ou seu conteúdo são considerados adulto.
 			</panel.string>
 			<panel.string name="landing_point_none">
 				(nenhum)
 			</panel.string>
 			<panel.string name="push_restrict_text">
-				Sem Empurrar
+				Sem empurrar
 			</panel.string>
 			<panel.string name="push_restrict_region_text">
-				Sem Empurrar (Imposição na Região)
+				Sem empurrar (imposição na região)
 			</panel.string>
 			<text name="allow_label">
 				Autorizar outros residentes a:
@@ -319,31 +319,31 @@ Apenas lotes maiores podem ser listados na busca.
 			<check_box label="Editar Terreno" name="edit land check" tool_tip="Se ativado, qualquer um pode modificar a forma da sua terra. É melhor deixar esta opção desativada, uma vez que você sempre pode editar seu próprio terreno."/>
 			<check_box label="Voar" name="check fly" tool_tip="Se ativado, os Residentes podem voar na sua terra. Se desativado, eles podem voar apenas para dentro e por cima de sua terra."/>
 			<text name="allow_label2">
-				Criar Objetos:
+				Criar objetos:
 			</text>
 			<check_box label="Residentes" name="edit objects check"/>
 			<check_box label="Grupo" name="edit group objects check"/>
 			<text name="allow_label3">
-				Entrada do Objeto:
+				Entrada do objeto:
 			</text>
 			<check_box label="Residentes" name="all object entry check"/>
 			<check_box label="Grupo" name="group object entry check"/>
 			<text name="allow_label4">
-				Executar Scripts:
+				Executar scripts:
 			</text>
 			<check_box label="Residentes" name="check other scripts"/>
 			<check_box label="Grupo" name="check group scripts"/>
 			<text name="land_options_label">
-				Opções de Terra:
+				Opções de terra:
 			</text>
 			<check_box label="Salvo (sem dano)" name="check safe" tool_tip="Se ativado, ajusta o terreno para Seguro, desabilitando combate com danos. Se não ativado, o combate com danos é habilitado."/>
 			<check_box label="Sem Empurrar" name="PushRestrictCheck" tool_tip="Evita scripts que empurram. A ativação dessa opção pode ser útil para prevenir comportamentos desordeiros na sua terra."/>
 			<check_box label="Mostrar terreno nos resultados de busca (L$30/semana)" name="ShowDirectoryCheck" tool_tip="Permitir que as pessoas vejam este terreno nos resultados de busca"/>
 			<combo_box left="265" name="land category with adult" width="155">
-				<combo_box.item label="Qualquer Categoria" name="item0"/>
+				<combo_box.item label="Qualquer categoria" name="item0"/>
 				<combo_box.item label="Locação Linden" name="item1"/>
-				<combo_box.item label="Adult" name="item2"/>
-				<combo_box.item label="Artes e Cultura" name="item3"/>
+				<combo_box.item label="Adulto" name="item2"/>
+				<combo_box.item label="Artes e cultura" name="item3"/>
 				<combo_box.item label="Negócios" name="item4"/>
 				<combo_box.item label="Educacional" name="item5"/>
 				<combo_box.item label="Jogos" name="item6"/>
@@ -355,9 +355,9 @@ Apenas lotes maiores podem ser listados na busca.
 				<combo_box.item label="Outros" name="item12"/>
 			</combo_box>
 			<combo_box left="265" name="land category" width="155">
-				<combo_box.item label="Qualquer Categoria" name="item0"/>
+				<combo_box.item label="Qualquer categoria" name="item0"/>
 				<combo_box.item label="Locação Linden" name="item1"/>
-				<combo_box.item label="Artes e Cultura" name="item3"/>
+				<combo_box.item label="Artes e cultura" name="item3"/>
 				<combo_box.item label="Negócios" name="item4"/>
 				<combo_box.item label="Educacional" name="item5"/>
 				<combo_box.item label="Jogos" name="item6"/>
@@ -368,7 +368,7 @@ Apenas lotes maiores podem ser listados na busca.
 				<combo_box.item label="Compras" name="item11"/>
 				<combo_box.item label="Outros" name="item12"/>
 			</combo_box>
-			<check_box label="Conteúdo Mature" name="MatureCheck" tool_tip=""/>
+			<check_box label="Conteúdo adulto" name="MatureCheck" tool_tip=""/>
 			<text name="Snapshot:">
 				Foto:
 			</text>
@@ -379,11 +379,11 @@ Apenas lotes maiores podem ser listados na busca.
 			<button label="Definir" label_selected="Definir" name="Set" tool_tip="Define o ponto de aterrissagem aonde o visitante chega. Define para o ponto em que seu avatar se encontra neste lote."/>
 			<button label="Limpar" label_selected="Limpar" name="Clear" tool_tip="Limpar o ponto de aterrissagem."/>
 			<text name="Teleport Routing: ">
-				Rota de Tele-transporte:
+				Rota de Teletransporte:
 			</text>
-			<combo_box left="140" name="landing type" tool_tip="Rota de Teletransporte -- Selecione como tratar os tele-transportes no seu lote." width="160">
+			<combo_box left="140" name="landing type" tool_tip="Rota de Teletransporte -- Selecione como tratar os teletransportes no seu lote." width="160">
 				<combo_box.item label="Bloqueado" name="Blocked"/>
-				<combo_box.item label="Ponto de Aterrissagem" name="LandingPoint"/>
+				<combo_box.item label="Ponto de aterrissagem" name="LandingPoint"/>
 				<combo_box.item label="Qualquer lugar" name="Anywhere"/>
 			</combo_box>
 		</panel>
@@ -396,8 +396,8 @@ Apenas lotes maiores podem ser listados na busca.
 				Página web:
 			</text>
 			<line_editor left="97" name="media_url"/>
-			<button label="Definir" name="set_media_url"/>
-			<check_box label="Esconder a URL da Mídia" left="97" name="hide_media_url" tool_tip="Ativando esta opção, a URL da mídia se ocultará para quaisquer visualizadores não autorizados a ver esta informação do lote. Notar que isto não está disponível para tipos HTML."/>
+			<button label="Definir..." label_selected="Definir..." name="set_media_url"/>
+			<check_box label="Esconder a URL da mídia" left="97" name="hide_media_url" tool_tip="Ativando esta opção, a URL da mídia se ocultará para quaisquer visualizadores não autorizados a ver esta informação do lote. Notar que isto não está disponível para tipos HTML."/>
 			<text name="Description:">
 				Descrição:
 			</text>
@@ -442,22 +442,22 @@ Mídia:
 				Uma ou mais destas opções está definida no nível de propriedade.
 			</panel.string>
 			<text name="Limit access to this parcel to:">
-				Acesso a Este Lote
+				Acesso a este lote
 			</text>
 			<check_box label="Acesso para público categoria [MATURITY]" name="public_access"/>
 			<text name="Only Allow">
 				Restringir acesso a contas confirmardas por:
 			</text>
 			<check_box label="Dados de pagamento fornecidos [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Banir residentes sem identificação."/>
-			<check_box label="Idade confirmada: [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Banir residentes que não comprovaram a idade. Consulte o [SUPPORT_SITE] para saber mais."/>
-			<check_box label="Permitir Acesso do Grupo: [GROUP]" name="GroupCheck" tool_tip="Definir grupo na aba Geral."/>
+			<check_box label="Idade comprovada: [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Banir residentes que não comprovaram a idade. Consulte o [SUPPORT_SITE] para saber mais."/>
+			<check_box label="Permitir acesso do grupo: [GROUP]" name="GroupCheck" tool_tip="Definir grupo na aba Geral."/>
 			<check_box label="Vender passes para:" name="PassCheck" tool_tip="Permite acesso temporário a este terreno"/>
 			<combo_box name="pass_combo">
 				<combo_box.item label="Qualquer um" name="Anyone"/>
 				<combo_box.item label="Grupo" name="Group"/>
 			</combo_box>
 			<spinner label="Preço em L$:" name="PriceSpin"/>
-			<spinner label="Horas de Acesso:" name="HoursSpin"/>
+			<spinner label="Horas de acesso:" name="HoursSpin"/>
 			<panel name="Allowed_layout_panel">
 				<name_list name="AccessList" tool_tip="(Total [LISTED], máx de [MAX])"/>
 			</panel>
diff --git a/indra/newview/skins/default/xui/pt/floater_bulk_perms.xml b/indra/newview/skins/default/xui/pt/floater_bulk_perms.xml
index 9f34111d8a..8823d04b62 100644
--- a/indra/newview/skins/default/xui/pt/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/pt/floater_bulk_perms.xml
@@ -7,20 +7,20 @@
 		Definindo permissões em [NAME]
 	</floater.string>
 	<floater.string name="start_text">
-		Iniciando solicitação de mudança de permissão...
+		Solicitando mudança de permissão...
 	</floater.string>
 	<floater.string name="done_text">
 		Solicitação de mudança de permissão concluída.
 	</floater.string>
 	<check_box label="Animação" name="check_animation"/>
 	<icon name="icon_animation" tool_tip="Animação"/>
-	<check_box label="Partes do Corpo" name="check_bodypart"/>
+	<check_box label="Partes do corpo" name="check_bodypart"/>
 	<icon name="icon_bodypart" tool_tip="Partes do corpo"/>
 	<check_box label="Roupas" name="check_clothing"/>
 	<icon name="icon_clothing" tool_tip="Vestuário"/>
 	<check_box label="Gestos" name="check_gesture"/>
 	<icon name="icon_gesture" tool_tip="Gestos"/>
-	<check_box label="Notecards" name="check_notecard"/>
+	<check_box label="Anotações" name="check_notecard"/>
 	<icon name="icon_notecard" tool_tip="Anotações"/>
 	<check_box label="Objetos" name="check_object"/>
 	<icon name="icon_object" tool_tip="Objects"/>
@@ -30,7 +30,7 @@
 	<icon name="icon_sound" tool_tip="Sons"/>
 	<check_box label="Texturas" name="check_texture"/>
 	<icon name="icon_texture" tool_tip="Texturas"/>
-	<button label="√ Tudo" label_selected="Todas" name="check_all"/>
+	<button label="Tudo" label_selected="Todas" name="check_all"/>
 	<button label="Limpar" label_selected="Nenhuma" name="check_none"/>
 	<text name="newperms">
 		Novas autorizações de conteúdo
diff --git a/indra/newview/skins/default/xui/pt/floater_customize.xml b/indra/newview/skins/default/xui/pt/floater_customize.xml
index 318c73e52d..2a367cb24a 100644
--- a/indra/newview/skins/default/xui/pt/floater_customize.xml
+++ b/indra/newview/skins/default/xui/pt/floater_customize.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater customize" title="APARÊNCIA" width="546">
 	<tab_container name="customize tab container" tab_min_width="115" width="544">
-		<text label="Partes de corpo" name="body_parts_placeholder">
+		<text label="Corpo" name="body_parts_placeholder">
 			Partes do corpo
 		</text>
 		<panel label="Forma" name="Shape">
@@ -43,15 +43,15 @@
 			<text name="Item Action Label">
 				Forma:
 			</text>
-			<button label="Criar Nova Forma" label_selected="Criar Nova Forma" name="Create New"/>
+			<button label="Nova" label_selected="Nova" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 		</panel>
 		<panel label="Pele" name="Skin">
-			<button label="Cor de Pele" label_selected="Cor de Pele" name="Skin Color" width="115"/>
-			<button label="Detalhes Faciais" label_selected="Detalhes Faciais" name="Face Detail" width="115"/>
-			<button label="Maquiagem" label_selected="Maquiagem" name="Makeup" width="115"/>
-			<button label="Detalhes do Corpo" label_selected="Detalhes do Corpo" name="Body Detail" width="115"/>
+			<button label="Cor de pele" label_selected="Cor de pele" name="Skin Color" width="115"/>
+			<button label="Detalhes faciais" label_selected="Detalhes faciais" name="Face Detail" width="115"/>
+			<button label="Maquilagem" label_selected="Maquilagem" name="Makeup" width="115"/>
+			<button label="Detalhes do corpo" label_selected="Detalhes do corpo" name="Body Detail" width="115"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -79,7 +79,7 @@
 			<texture_picker label="Tattoo: cabeça" name="Head Tattoos" tool_tip="Clique para escolher um desenho" width="86"/>
 			<texture_picker label="Tattoo: superior" name="Upper Tattoos" tool_tip="Clique para escolher um desenho" width="86"/>
 			<texture_picker label="Tattoo: inferior" name="Lower Tattoos" tool_tip="Clique para escolher um desenho" width="86"/>
-			<button label="Criar Nova Pele" label_selected="Criar Nova Pele" name="Create New"/>
+			<button label="Novo" label_selected="Novo" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 			<button label="Reverter" label_selected="Reverter" name="Revert"/>
@@ -114,7 +114,7 @@
 				Cabelo:
 			</text>
 			<texture_picker label="Texture" name="Texture" tool_tip="Clique para escolher uma imagem"/>
-			<button label="Criar Novo Cabelo" label_selected="Criar Novo Cabelo" name="Create New"/>
+			<button label="Criar novo cabelo" label_selected="Criar novo cabelo" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 			<button label="Reverter" label_selected="Reverter" name="Revert"/>
@@ -145,7 +145,7 @@
 				Olhos:
 			</text>
 			<texture_picker label="Íris" name="Iris" tool_tip="Clique para escolher uma imagem"/>
-			<button label="Criar Novos Olhos" label_selected="Criar Novos Olhos" name="Create New"/>
+			<button label="Criar novos olhos" label_selected="Criar novos olhos" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 			<button label="Reverter" label_selected="Reverter" name="Revert"/>
@@ -157,7 +157,7 @@
 			<texture_picker label="Tecido" name="Fabric" tool_tip="Clique para escolher uma imagem"/>
 			<color_swatch label="Cor/Tint" name="Color/Tint" tool_tip="Selecionar a cor"/>
 			<button label="Remover" label_selected="Remover" name="Take Off"/>
-			<button label="Criar Nova Camisa" label_selected="Criar Nova Camisa" name="Create New"/>
+			<button label="Criar nova camisa" label_selected="Criar nova camisa" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 			<button label="Reverter" label_selected="Reverter" name="Revert"/>
@@ -190,7 +190,7 @@
 			<texture_picker label="Tecido" name="Fabric" tool_tip="Clique para escolher uma imagem"/>
 			<color_swatch label="Cor/Tint" name="Color/Tint" tool_tip="Selecionar a cor"/>
 			<button label="Remover" label_selected="Remover" name="Take Off"/>
-			<button label="Criar Novas Calças" label_selected="Criar Novas Calças" name="Create New"/>
+			<button label="Criar novas calças" label_selected="Criar novas calças" name="Create New"/>
 			<button label="Salvar" label_selected="Salvar" name="Save"/>
 			<button label="Salvar como..." label_selected="Salvar como..." name="Save As"/>
 			<button label="Reverter" label_selected="Reverter" name="Revert"/>
@@ -238,7 +238,7 @@
 			<text name="not worn instructions">
 				Para obter novos olhos, arraste um tipo de olhos do inventário para o seu avatar. Ou crie olhos novos.
 			</text>
-			<button label="Criar Novos Sapatos" label_selected="Criar Novos Sapatos" name="Create New" width="166"/>
+			<button label="Criar novos sapatos" label_selected="Criar novos sapatos" name="Create New" width="166"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar esta vestimenta.
 			</text>
@@ -271,7 +271,7 @@
 			<text name="not worn instructions">
 				Para obter meias novas, arraste um par do inventário para o seu avatar. Ou crie meias novas.
 			</text>
-			<button label="Criar Novas Meias" label_selected="Criar Novas Meias" name="Create New"/>
+			<button label="Criar novas meias" label_selected="Criar novas meias" name="Create New"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar essa vestimenta.
 			</text>
@@ -304,14 +304,14 @@
 			<text name="not worn instructions">
 				Para por uma jaqueta nova, arraste uma do inventário para o seu avatar. Ou crie uma jaqueta nova.
 			</text>
-			<button label="Criar Nova Jaqueta" label_selected="Criar Nova Jaqueta" name="Create New"/>
+			<button label="Criar nova jaqueta" label_selected="Criar nova jaqueta" name="Create New"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar esta vestimenta.
 			</text>
 			<text name="Item Action Label">
 				Jaqueta:
 			</text>
-			<texture_picker label="Tecido Superior" name="Upper Fabric" tool_tip="Clique para escolher uma imagem." width="84"/>
+			<texture_picker label="Tecido superior" name="Upper Fabric" tool_tip="Clique para escolher uma imagem." width="84"/>
 			<texture_picker label="Tecido Inferior" name="Lower Fabric" tool_tip="Clique para escolher uma imagem." width="84"/>
 			<color_swatch label="Cor/Tint" name="Color/Tint" tool_tip="Selecionar a cor"/>
 			<button label="Remover" label_selected="Remover" name="Take Off"/>
@@ -338,7 +338,7 @@
 			<text name="not worn instructions">
 				Para obter luvas novas, arraste um par do inventário para o seu avatar. Ou crie luvas novas.
 			</text>
-			<button label="Criar Novas Luvas" label_selected="Criar Novas Luvas" name="Create New"/>
+			<button label="Criar novas luvas" label_selected="Criar novas luvas" name="Create New"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar essa vestimenta.
 			</text>
@@ -371,7 +371,7 @@
 			<text name="not worn instructions">
 				Para obter uma camiseta nova, arraste uma do inventário para o seu avatar. Ou crie uma camiseta nova.
 			</text>
-			<button label="Criar Nova Camiseta" label_selected="Criar Nova Camiseta" name="Create New"/>
+			<button label="Criar nova camiseta" label_selected="Criar nova camiseta" name="Create New"/>
 			<text name="no modify instructions">
 				Você não ter permissão para modificar essa vestimenta.
 			</text>
@@ -404,12 +404,12 @@
 			<text name="not worn instructions">
 				Para obter roupa de baixo nova, arraste um modelo do inventário para o seu avatar. Ou crie uma roupa de baixo nova.
 			</text>
-			<button label="Criar Novas Roupas de Baixo" label_selected="Criar Novas Roupas de Baixo" name="Create New" width="180"/>
+			<button label="Criar novas" label_selected="Criar novas" name="Create New" width="180"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar essa vestimenta.
 			</text>
 			<text name="Item Action Label">
-				Roupas de Baixo:
+				Roupas de baixo:
 			</text>
 			<texture_picker label="Tecido" name="Fabric" tool_tip="Clique para escolher uma imagem"/>
 			<color_swatch label="Cor/Tint" name="Color/Tint" tool_tip="Selecionar a cor"/>
@@ -437,7 +437,7 @@
 			<text name="not worn instructions">
 				Para obter um saia nova, arraste uma saia do inventário para o seu avatar. Ou crie uma saia nova.
 			</text>
-			<button label="Criar Nova Saia" label_selected="Criar Nova Saia" name="Create New"/>
+			<button label="Criar nova saia" label_selected="Criar nova saia" name="Create New"/>
 			<text name="no modify instructions">
 				Você não tem permissão para modificar esta vestimenta.
 			</text>
diff --git a/indra/newview/skins/default/xui/pt/floater_preferences.xml b/indra/newview/skins/default/xui/pt/floater_preferences.xml
index 803f2f87b8..2736900d5f 100644
--- a/indra/newview/skins/default/xui/pt/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/pt/floater_preferences.xml
@@ -3,7 +3,7 @@
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Cancelar" label_selected="Cancelar" name="Cancel"/>
 	<tab_container name="pref core" tab_width="128" width="628">
-		<panel label="Público geral" name="general"/>
+		<panel label="Geral" name="general"/>
 		<panel label="Vídeo" name="display"/>
 		<panel label="Privacidade" name="im"/>
 		<panel label="Som e mídia" name="audio"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_snapshot.xml b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
index a3934a6667..bb852cb11a 100644
--- a/indra/newview/skins/default/xui/pt/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/pt/floater_snapshot.xml
@@ -3,7 +3,7 @@
 	<text name="type_label">
 		Destino da foto
 	</text>
-	<radio_group label="Tipo de Foto" name="snapshot_type_radio">
+	<radio_group label="Tipo de foto" name="snapshot_type_radio">
 		<radio_item label="Email" name="postcard"/>
 		<radio_item label="Meu inventário (L$[AMOUNT])" name="texture"/>
 		<radio_item label="Salvar no meu PC" name="local"/>
@@ -28,21 +28,21 @@
 		Formato
 	</text>
 	<combo_box label="Resolução" name="postcard_size_combo">
-		<combo_box.item label="Janela Atual" name="CurrentWindow"/>
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
 		<combo_box.item label="640x480" name="640x480"/>
 		<combo_box.item label="800x600" name="800x600"/>
 		<combo_box.item label="1024x768" name="1024x768"/>
 		<combo_box.item label="Customizado" name="Custom"/>
 	</combo_box>
 	<combo_box label="Resolução" name="texture_size_combo">
-		<combo_box.item label="Janela Atual" name="CurrentWindow"/>
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
 		<combo_box.item label="Pequeno (128x128)" name="Small(128x128)"/>
 		<combo_box.item label="Médio (256x256)" name="Medium(256x256)"/>
 		<combo_box.item label="Grande (512x512)" name="Large(512x512)"/>
 		<combo_box.item label="Customizado" name="Custom"/>
 	</combo_box>
 	<combo_box label="Resolução" name="local_size_combo">
-		<combo_box.item label="Janela Atual" name="CurrentWindow"/>
+		<combo_box.item label="Janela atual" name="CurrentWindow"/>
 		<combo_box.item label="320x240" name="320x240"/>
 		<combo_box.item label="640x480" name="640x480"/>
 		<combo_box.item label="800x600" name="800x600"/>
@@ -63,10 +63,10 @@
 	<text name="layer_type_label">
 		Capturar:
 	</text>
-	<combo_box label="Camadas da Imagem" name="layer_types">
+	<combo_box label="Camadas da imagem" name="layer_types">
 		<combo_box.item label="Cores" name="Colors"/>
 		<combo_box.item label="Formato" name="Depth"/>
-		<combo_box.item label="Decoração do Objeto" name="ObjectMattes"/>
+		<combo_box.item label="Decoração do objeto" name="ObjectMattes"/>
 	</combo_box>
 	<check_box label="Interface" name="ui_check"/>
 	<check_box bottom_delta="-17" label="HUDs" name="hud_check"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_tools.xml b/indra/newview/skins/default/xui/pt/floater_tools.xml
index fb44c5c3bf..958a166dfc 100644
--- a/indra/newview/skins/default/xui/pt/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pt/floater_tools.xml
@@ -63,7 +63,7 @@
 		<radio_item label="Stretch (Ctrl+Shift)" name="radio stretch"/>
 		<radio_item label="Face selecionada" name="radio select face"/>
 	</radio_group>
-	<check_box label="Editar item linkado" name="checkbox edit linked parts"/>
+	<check_box label="Editar partes linkadas" name="checkbox edit linked parts"/>
 	<text name="RenderingCost" tool_tip="Mostra o cálculo do custo de renderização do objeto">
 		þ: [COUNT]
 	</text>
@@ -91,7 +91,7 @@
 	<button label="" label_selected="" name="ToolRing" tool_tip="Anel"/>
 	<button label="" label_selected="" name="ToolTree" tool_tip="Árvore"/>
 	<button label="" label_selected="" name="ToolGrass" tool_tip="Grama"/>
-	<check_box label="Ficar com ferramenta selecionado" name="checkbox sticky"/>
+	<check_box label="Ficar com ferramenta selecionada" name="checkbox sticky"/>
 	<check_box label="Copiar seleção" name="checkbox copy selection"/>
 	<check_box initial_value="true" label="Copiar parte central" name="checkbox copy centers"/>
 	<check_box label="Girar cópia" name="checkbox copy rotates"/>
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory.xml b/indra/newview/skins/default/xui/pt/menu_inventory.xml
index 8b565b9645..627072c32d 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory.xml
@@ -6,21 +6,21 @@
 	<menu_item_call label="Propriedades" name="Task Properties"/>
 	<menu_item_call label="Renomear" name="Task Rename"/>
 	<menu_item_call label="Apagar" name="Task Remove"/>
-	<menu_item_call label="Limpar Lixeira" name="Empty Trash"/>
-	<menu_item_call label="Limpar Achados e perdidos" name="Empty Lost And Found"/>
-	<menu_item_call label="Nova Pasta" name="New Folder"/>
-	<menu_item_call label="Novo Script" name="New Script"/>
+	<menu_item_call label="Limpar lixeira" name="Empty Trash"/>
+	<menu_item_call label="Limpar Achados & perdidos" name="Empty Lost And Found"/>
+	<menu_item_call label="Nova pasta" name="New Folder"/>
+	<menu_item_call label="Novo script" name="New Script"/>
 	<menu_item_call label="Nova anotação" name="New Note"/>
-	<menu_item_call label="Novo Gesto" name="New Gesture"/>
+	<menu_item_call label="Novo gesto" name="New Gesture"/>
 	<menu label="Novas roupas" name="New Clothes">
-		<menu_item_call label="Nova Camisa" name="New Shirt"/>
-		<menu_item_call label="Nova Calça" name="New Pants"/>
-		<menu_item_call label="Novos Calçados" name="New Shoes"/>
-		<menu_item_call label="Novas Meias" name="New Socks"/>
-		<menu_item_call label="Nova Jaqueta" name="New Jacket"/>
-		<menu_item_call label="Nova Saia" name="New Skirt"/>
-		<menu_item_call label="Novas Luvas" name="New Gloves"/>
-		<menu_item_call label="Nova Anágua" name="New Undershirt"/>
+		<menu_item_call label="Nova camisa" name="New Shirt"/>
+		<menu_item_call label="Nova calça" name="New Pants"/>
+		<menu_item_call label="Novos calçados" name="New Shoes"/>
+		<menu_item_call label="Novas meias" name="New Socks"/>
+		<menu_item_call label="Nova jaqueta" name="New Jacket"/>
+		<menu_item_call label="Nova saia" name="New Skirt"/>
+		<menu_item_call label="Novas luvas" name="New Gloves"/>
+		<menu_item_call label="Nova anágua" name="New Undershirt"/>
 		<menu_item_call label="Nova roupa de baixo" name="New Underpants"/>
 		<menu_item_call label="Nova máscara alfa" name="New Alpha Mask"/>
 		<menu_item_call label="Nova tatuagem" name="New Tattoo"/>
@@ -53,29 +53,29 @@
 	<menu_item_call label="Abrir" name="Open"/>
 	<menu_item_call label="Propriedades" name="Properties"/>
 	<menu_item_call label="Renomear" name="Rename"/>
-	<menu_item_call label="Copy Asset UUID" name="Copy Asset UUID"/>
+	<menu_item_call label="Copiar item UUID" name="Copy Asset UUID"/>
 	<menu_item_call label="Copiar" name="Copy"/>
 	<menu_item_call label="Colar" name="Paste"/>
 	<menu_item_call label="Colar como link" name="Paste As Link"/>
 	<menu_item_call label="Apagar" name="Delete"/>
 	<menu_item_call label="Excluir pasta do sistema" name="Delete System Folder"/>
-	<menu_item_call label="Iniciar conversa em conferência" name="Conference Chat Folder"/>
-	<menu_item_call label="Executar" name="Sound Play"/>
+	<menu_item_call label="Pasta conversa em conferência" name="Conference Chat Folder"/>
+	<menu_item_call label="Executar som" name="Sound Play"/>
 	<menu_item_call label="Sobre o marco" name="About Landmark"/>
-	<menu_item_call label="Tocar inworld" name="Animation Play"/>
-	<menu_item_call label="Executar localmente" name="Animation Audition"/>
-	<menu_item_call label="Mandar Mensagem Instantânea" name="Send Instant Message"/>
+	<menu_item_call label="Executar animação" name="Animation Play"/>
+	<menu_item_call label="Executar áudio" name="Animation Audition"/>
+	<menu_item_call label="Mandar MI" name="Send Instant Message"/>
 	<menu_item_call label="Oferecer teletransporte..." name="Offer Teleport..."/>
-	<menu_item_call label="Iniciar conversa em conferência" name="Conference Chat"/>
+	<menu_item_call label="Bate-papo em conferência" name="Conference Chat"/>
 	<menu_item_call label="Ativar" name="Activate"/>
 	<menu_item_call label="Desativar" name="Deactivate"/>
 	<menu_item_call label="Salvar como" name="Save As"/>
-	<menu_item_call label="Retirar de você" name="Detach From Yourself"/>
-	<menu_item_call label="Vestir" name="Object Wear"/>
+	<menu_item_call label="Retirar de si mesmo" name="Detach From Yourself"/>
+	<menu_item_call label="Vestir objeto" name="Object Wear"/>
 	<menu label="Anexar a" name="Attach To"/>
 	<menu label="Anexar ao HUD" name="Attach To HUD"/>
 	<menu_item_call label="Editar" name="Wearable Edit"/>
 	<menu_item_call label="Vestir" name="Wearable Wear"/>
-	<menu_item_call label="Retirar" name="Take Off"/>
+	<menu_item_call label="Tirar" name="Take Off"/>
 	<menu_item_call label="--Sem opções--" name="--no options--"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
index 81898c63bf..fc40384891 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory_add.xml
@@ -24,7 +24,7 @@
 		<menu_item_call label="Nova tatuagem" name="New Tattoo"/>
 	</menu>
 	<menu label="Nova parte do corpo" name="New Body Parts">
-		<menu_item_call label="Nova silhueta" name="New Shape"/>
+		<menu_item_call label="Nova forma" name="New Shape"/>
 		<menu_item_call label="Nova pele" name="New Skin"/>
 		<menu_item_call label="Novo cabelo" name="New Hair"/>
 		<menu_item_call label="Novos olhos" name="New Eyes"/>
diff --git a/indra/newview/skins/default/xui/pt/menu_teleport_history_item.xml b/indra/newview/skins/default/xui/pt/menu_teleport_history_item.xml
index b4216b7ddc..ec1e7a0950 100644
--- a/indra/newview/skins/default/xui/pt/menu_teleport_history_item.xml
+++ b/indra/newview/skins/default/xui/pt/menu_teleport_history_item.xml
@@ -2,5 +2,5 @@
 <context_menu name="Teleport History Item Context Menu">
 	<menu_item_call label="Teletransportar" name="Teleport"/>
 	<menu_item_call label="Mais informações" name="More Information"/>
-	<menu_item_call label="Copiar para área de transferência" name="CopyToClipboard"/>
+	<menu_item_call label="Copiar" name="CopyToClipboard"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pt/menu_viewer.xml b/indra/newview/skins/default/xui/pt/menu_viewer.xml
index 2b83386cad..45f7ca1424 100644
--- a/indra/newview/skins/default/xui/pt/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pt/menu_viewer.xml
@@ -80,7 +80,7 @@
 		<menu_item_call label="Link" name="Link"/>
 		<menu_item_call label="Desconectar links" name="Unlink"/>
 		<menu_item_check label="Edit Linked Parts" name="Edit Linked Parts"/>
-		<menu_item_call label="Focus on Selection" name="Focus on Selection"/>
+		<menu_item_call label="Enfocar seleção" name="Focus on Selection"/>
 		<menu_item_call label="Ampliar seleção" name="Zoom to Selection"/>
 		<menu label="Objeto:" name="Object">
 			<menu_item_call label="Comprar" name="Menu Object Buy"/>
@@ -92,29 +92,29 @@
 		<menu label="Scripts" name="Scripts">
 			<menu_item_call label="Recompilar scripts (LSL)" name="Mono"/>
 			<menu_item_call label="Recompilar scripts (LSL)" name="LSL"/>
-			<menu_item_call label="Reset Scripts" name="Reset Scripts"/>
+			<menu_item_call label="Resetar scripts" name="Reset Scripts"/>
 			<menu_item_call label="Scripts em modo execução" name="Set Scripts to Running"/>
 			<menu_item_call label="Scripts em modo não execução" name="Set Scripts to Not Running"/>
 		</menu>
 		<menu label="Opções" name="Options">
-			<menu_item_call label="Set Default Upload Permissions" name="perm prefs"/>
+			<menu_item_call label="Definir permissões padrão de upload" name="perm prefs"/>
 			<menu_item_check label="Mostrar permissões avançadas" name="DebugPermissions"/>
 			<menu_item_check label="Só selecionar meus objetos" name="Select Only My Objects"/>
-			<menu_item_check label="Só selecionar meus objetos" name="Select Only Movable Objects"/>
+			<menu_item_check label="Só selecionar objetos móveis" name="Select Only Movable Objects"/>
 			<menu_item_check label="Selecionar contornando" name="Select By Surrounding"/>
 			<menu_item_check label="Mostrar seleção oculta" name="Show Hidden Selection"/>
-			<menu_item_check label="Show Light Radius for Selection" name="Show Light Radius for Selection"/>
-			<menu_item_check label="Show Selection Beam" name="Show Selection Beam"/>
-			<menu_item_check label="Mostrar na grade" name="Snap to Grid"/>
-			<menu_item_call label="Snap Object XY to Grid" name="Snap Object XY to Grid"/>
+			<menu_item_check label="Mostrar alcance de luz da seleção" name="Show Light Radius for Selection"/>
+			<menu_item_check label="Mostrar raio de seleção" name="Show Selection Beam"/>
+			<menu_item_check label="Encaixar em grade" name="Snap to Grid"/>
+			<menu_item_call label="Encaixar objeto XY em grade" name="Snap Object XY to Grid"/>
 			<menu_item_call label="Usar seleção em grade" name="Use Selection for Grid"/>
 			<menu_item_call label="Opções de grade" name="Grid Options"/>
 		</menu>
 		<menu label="Selecionar partes conectadas" name="Select Linked Parts">
-			<menu_item_call label="Select Next Part" name="Select Next Part"/>
-			<menu_item_call label="Select Previous Part" name="Select Previous Part"/>
-			<menu_item_call label="Include Next Part" name="Include Next Part"/>
-			<menu_item_call label="Include Previous Part" name="Include Previous Part"/>
+			<menu_item_call label="Selecionar próxima parte" name="Select Next Part"/>
+			<menu_item_call label="Selecionar parte anterior" name="Select Previous Part"/>
+			<menu_item_call label="Incluir próxima parte" name="Include Next Part"/>
+			<menu_item_call label="Incluir parte anterior" name="Include Previous Part"/>
 		</menu>
 	</menu>
 	<menu label="Ajuda" name="Help">
@@ -133,9 +133,9 @@
 		<menu_item_check label="Compactar fotos para HD" name="QuietSnapshotsToDisk"/>
 		<menu_item_check label="Compactar fotos para HD" name="CompressSnapshotsToDisk"/>
 		<menu label="Ferramentas de desempenho" name="Performance Tools">
-			<menu_item_call label="Lag Meter" name="Lag Meter"/>
+			<menu_item_call label="Medidor de lag" name="Lag Meter"/>
 			<menu_item_check label="Barra de estatísticas" name="Statistics Bar"/>
-			<menu_item_check label="Show Avatar Rendering Cost" name="Avatar Rendering Cost"/>
+			<menu_item_check label="Carga de renderização de avatar" name="Avatar Rendering Cost"/>
 		</menu>
 		<menu label="Realces e visibilidade" name="Highlighting and Visibility">
 			<menu_item_check label="Efeito baliza piscando" name="Cheesy Beacon"/>
@@ -166,13 +166,13 @@
 			<menu_item_check label="Selecionado" name="Selected"/>
 			<menu_item_check label="Realçado" name="Highlighted"/>
 			<menu_item_check label="Texturas dinâmicas" name="Dynamic Textures"/>
-			<menu_item_check label="Foot Shadows" name="Foot Shadows"/>
-			<menu_item_check label="Fog" name="Fog"/>
-			<menu_item_check label="Flexible Objects" name="Flexible Objects"/>
+			<menu_item_check label="Sombras nos pés" name="Foot Shadows"/>
+			<menu_item_check label="Neblina" name="Fog"/>
+			<menu_item_check label="Objetos flexíveis" name="Flexible Objects"/>
 		</menu>
 		<menu_item_check label="Executar diversas instâncias" name="Run Multiple Threads"/>
 		<menu_item_call label="Limpar cache de grupo" name="ClearGroupCache"/>
-		<menu_item_check label="Mouse Smoothing" name="Mouse Smoothing"/>
+		<menu_item_check label="Smoothing de mouse" name="Mouse Smoothing"/>
 		<menu label="Atalhos" name="Shortcuts">
 			<menu_item_call label="Imagem (L$[COST])..." name="Upload Image"/>
 			<menu_item_check label="Busca" name="Search"/>
@@ -205,7 +205,7 @@
 	<menu label="Desenvolver" name="Develop">
 		<menu label="Painéis" name="Consoles">
 			<menu_item_check label="Painel de textura" name="Texture Console"/>
-			<menu_item_check label="Debug Console" name="Debug Console"/>
+			<menu_item_check label="Console de depuração" name="Debug Console"/>
 			<menu_item_call label="Painel de avisos" name="Notifications"/>
 			<menu_item_check label="Painel de tamanho de textura" name="Texture Size"/>
 			<menu_item_check label="Painel de texturas" name="Texture Category"/>
@@ -218,7 +218,7 @@
 		</menu>
 		<menu label="Show Info" name="Display Info">
 			<menu_item_check label="Mostrar hora" name="Show Time"/>
-			<menu_item_check label="Show Render Info" name="Show Render Info"/>
+			<menu_item_check label="Dados de renderização" name="Show Render Info"/>
 			<menu_item_check label="Mostrar cor sob o cursor" name="Show Color Under Cursor"/>
 			<menu_item_check label="Mostrar mudanças a objetos" name="Show Updates"/>
 		</menu>
@@ -239,7 +239,7 @@
 		</menu>
 		<menu label="Rendering" name="Rendering">
 			<menu_item_check label="Axes" name="Axes"/>
-			<menu_item_check label="Contornos" name="Wireframe"/>
+			<menu_item_check label="Wireframe" name="Wireframe"/>
 			<menu_item_check label="Global Illumination" name="Global Illumination"/>
 			<menu_item_check label="Texturas de animação" name="Animation Textures"/>
 			<menu_item_check label="Desativar texturas" name="Disable Textures"/>
@@ -247,11 +247,11 @@
 			<menu_item_check label="Render Attached Particles" name="Render Attached Particles"/>
 			<menu_item_check label="Objetos iridescentes" name="Hover Glow Objects"/>
 		</menu>
-		<menu label="Network" name="Network">
+		<menu label="Rede" name="Network">
 			<menu_item_check label="Pausar avatar" name="AgentPause"/>
 			<menu_item_call label="Drop a Packet" name="Drop a Packet"/>
 		</menu>
-		<menu_item_call label="Bumps, Pushes &amp; Hits" name="Bumps, Pushes &amp;amp; Hits"/>
+		<menu_item_call label="Empurrões, trombadas e tapas" name="Bumps, Pushes &amp;amp; Hits"/>
 		<menu label="Mundo" name="World">
 			<menu_item_check label="Impor sobre sol regional" name="Sim Sun Override"/>
 			<menu_item_check label="Efeito baliza piscando" name="Cheesy Beacon"/>
@@ -261,15 +261,15 @@
 		<menu label="Interface" name="UI">
 			<menu_item_call label="Teste de navegador web" name="Web Browser Test"/>
 			<menu_item_call label="Print Selected Object Info" name="Print Selected Object Info"/>
-			<menu_item_call label="Memory Stats" name="Memory Stats"/>
+			<menu_item_call label="Dados de memória" name="Memory Stats"/>
 			<menu_item_check label="Double-Click Auto-Pilot" name="Double-ClickAuto-Pilot"/>
 			<menu_item_check label="Debug Clicks" name="Debug Clicks"/>
 			<menu_item_check label="Debug Mouse Events" name="Debug Mouse Events"/>
 		</menu>
 		<menu label="XUI" name="XUI">
 			<menu_item_call label="Recarregar cores" name="Reload Color Settings"/>
-			<menu_item_call label="Show Font Test" name="Show Font Test"/>
-			<menu_item_call label="Load from XML" name="Load from XML"/>
+			<menu_item_call label="Teste de fonte" name="Show Font Test"/>
+			<menu_item_call label="Carregar de XML" name="Load from XML"/>
 			<menu_item_call label="Salvar para XML" name="Save to XML"/>
 			<menu_item_check label="Mostrar nomes XUI" name="Show XUI Names"/>
 			<menu_item_call label="Enviar MIs de teste" name="Send Test IMs"/>
diff --git a/indra/newview/skins/default/xui/pt/notifications.xml b/indra/newview/skins/default/xui/pt/notifications.xml
index 1480343dc1..5f91ff09e5 100644
--- a/indra/newview/skins/default/xui/pt/notifications.xml
+++ b/indra/newview/skins/default/xui/pt/notifications.xml
@@ -1282,8 +1282,8 @@ Salvar na pasta Aplicativos?
 	</notification>
 	<notification name="GroupLeaveConfirmMember">
 		Você é atualmente um membro do grupo [GROUP].
-Deixar este grupo?
-		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Deixar"/>
+Sair do grupo?
+		<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Sair"/>
 	</notification>
 	<notification name="ConfirmKick">
 		Tem CERTEZA de que deseja expulsar todos os residentes do grid?
@@ -1294,7 +1294,7 @@ Deixar este grupo?
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="CannotStartAuctionAlreadyForSale">
-		Você não pode começar um leilão com um lote que já foi colocado à venda.  Desabilite a venda da terra se você tem certeza que deseja iniciar um leilão.
+		Você não pode começar um leilão com um lote que já foi colocado à venda. Desabilite a venda se você tem certeza que deseja fazer um leilão.
 	</notification>
 	<notification label="Falha ao bloquear objeto por nome" name="MuteByNameFailed">
 		Você já bloqueou este residente.
diff --git a/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
index c11d800171..23cde50acc 100644
--- a/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/pt/panel_edit_tattoo.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_tattoo_panel">
 	<panel name="avatar_tattoo_color_panel">
-		<texture_picker label="Tatoo de cabeça" name="Head Tattoo" tool_tip="Clique para escolher uma foto"/>
-		<texture_picker label="Tatoo da parte superior do corpo" name="Upper Tattoo" tool_tip="Clique para escolher uma foto"/>
-		<texture_picker label="Tatoo da parte inferior do corpo" name="Lower Tattoo" tool_tip="Clique para escolher uma foto"/>
+		<texture_picker label="Tatuagem de cabeça" name="Head Tattoo" tool_tip="Clique para escolher uma foto"/>
+		<texture_picker label="Tatuagem superior" name="Upper Tattoo" tool_tip="Selecione uma foto"/>
+		<texture_picker label="Tatuagem inferior" name="Lower Tattoo" tool_tip="Selecione uma foto"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_group_general.xml b/indra/newview/skins/default/xui/pt/panel_group_general.xml
index 85488f43af..0b65b4aade 100644
--- a/indra/newview/skins/default/xui/pt/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/pt/panel_group_general.xml
@@ -46,7 +46,7 @@ Para obter mais ajuda, passe o mouse sobre as opções.
 		<check_box label="Qualquer um pode entrar" name="open_enrollement" tool_tip="Controla a entrada de novos membros, com ou sem convite."/>
 		<check_box label="Taxa de inscrição" name="check_enrollment_fee" tool_tip="Controla a cobrança de uma taxa de associação ao grupo."/>
 		<spinner label="L$" left_delta="120" name="spin_enrollment_fee" tool_tip="Se a opção &apos;Taxa de associação&apos; estiver marcada, novos membros precisam pagar o valor definido para entrar no grupo." width="60"/>
-		<combo_box name="group_mature_check" tool_tip="Define se a informação do seu grupo é considerada mature." width="170">
+		<combo_box name="group_mature_check" tool_tip="Define se os dados do seu grupo são conteúdo moderado." width="170">
 			<combo_box.item label="Conteúdo PG" name="pg"/>
 			<combo_box.item label="Conteúdo Mature" name="mature"/>
 		</combo_box>
diff --git a/indra/newview/skins/default/xui/pt/panel_group_notices.xml b/indra/newview/skins/default/xui/pt/panel_group_notices.xml
index 2abc8bc7c8..4b5a00c761 100644
--- a/indra/newview/skins/default/xui/pt/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/pt/panel_group_notices.xml
@@ -19,10 +19,10 @@ Cada grupo pode enviar no máximo 200 avisos/dia
 		Nenhum resultado foi encontrado.
 	</text>
 	<button label="Criar um novo aviso" label_selected="Criar nova notícia" name="create_new_notice" tool_tip="Criar um novo aviso"/>
-	<button label="Atualizar" label_selected="Atualizar Lista" name="refresh_notices" tool_tip="Atualizar lista de avisos"/>
+	<button label="Atualizar" label_selected="Atualizar lista" name="refresh_notices" tool_tip="Atualizar lista de avisos"/>
 	<panel label="Criar nova notícia" name="panel_create_new_notice">
 		<text name="lbl">
-			Criar uma notícia
+			Criar  notícia
 		</text>
 		<text left="20" name="lbl3">
 			Assunto:
@@ -43,7 +43,7 @@ Cada grupo pode enviar no máximo 200 avisos/dia
 		<button label="Enviar" label_selected="Enviar" name="send_notice"/>
 		<group_drop_target name="drop_target" tool_tip="Arrastar um item do inventário para a caixa para enviá-lo com o aviso. É preciso ter autorização de cópia e transferência do item para anexá-lo ao aviso."/>
 	</panel>
-	<panel label="Visualizar Notícia Anterior" name="panel_view_past_notice">
+	<panel label="Visualizar notícia anterior" name="panel_view_past_notice">
 		<text name="lbl">
 			Notícia arquivada
 		</text>
diff --git a/indra/newview/skins/default/xui/pt/panel_groups.xml b/indra/newview/skins/default/xui/pt/panel_groups.xml
index aaea1178a6..0aea0d53dd 100644
--- a/indra/newview/skins/default/xui/pt/panel_groups.xml
+++ b/indra/newview/skins/default/xui/pt/panel_groups.xml
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="groups">
 	<text name="groupdesc" width="268">
-		Seu grupo ativo atual es&apos;ta mostrado em negrito.
+		Seu grupo ativo atual está em negrito.
 	</text>
 	<text name="groupcount" width="300">
-		Você pertence a [COUNT] grupos (de no máximo [MAX]).
+		Você pertence a [COUNT] grupos (máximo [MAX]).
 	</text>
-	<button width="86" label="MI/Chamada" name="IM" tool_tip="Abrir sessão de Mensagem Instantânea"/>
+	<button width="86" label="MI/Ligação" name="IM" tool_tip="Abrir sessão de Mensagem Instantânea"/>
 	<button width="86" label="Informações" name="Info"/>
 	<button width="86" label="Ativar" name="Activate"/>
-	<button width="86" label="Deixar" name="Leave"/>
+	<button width="86" label="Sair" name="Leave"/>
 	<button width="86" label="Criar..." name="Create"/>
 	<button width="86" label="Buscar..." name="Search..."/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_main_inventory.xml b/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
index 4ba6746614..104c3bface 100644
--- a/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/panel_main_inventory.xml
@@ -44,7 +44,7 @@
 				<menu_item_call label="Nova tatuagem" name="New Tattoo"/>
 			</menu>
 			<menu label="Nova parte do corpo" name="New Body Parts">
-				<menu_item_call label="Nova silhueta" name="New Shape"/>
+				<menu_item_call label="Nova forma" name="New Shape"/>
 				<menu_item_call label="Nova pele" name="New Skin"/>
 				<menu_item_call label="Novo cabelo" name="New Hair"/>
 				<menu_item_call label="Novos olhos" name="New Eyes"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_media_settings_general.xml b/indra/newview/skins/default/xui/pt/panel_media_settings_general.xml
index 9815b8d0b4..43c0820036 100644
--- a/indra/newview/skins/default/xui/pt/panel_media_settings_general.xml
+++ b/indra/newview/skins/default/xui/pt/panel_media_settings_general.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<panel label="Público geral" name="Media Settings General">
+<panel label="Geral" name="Media Settings General">
 	<text name="home_label">
 		Página web:
 	</text>
diff --git a/indra/newview/skins/default/xui/pt/panel_people.xml b/indra/newview/skins/default/xui/pt/panel_people.xml
index 66938e8f6f..1516a2bb65 100644
--- a/indra/newview/skins/default/xui/pt/panel_people.xml
+++ b/indra/newview/skins/default/xui/pt/panel_people.xml
@@ -48,12 +48,12 @@ Para conhecer mais gente, use [secondlife:///app/worldmap o Mapa].
 	</tab_container>
 	<panel name="button_bar">
 		<button label="Perfil" name="view_profile_btn" tool_tip="Exibir fotografia, grupos e outras informações dos residentes"/>
-		<button label="MI" name="im_btn" tool_tip="Abrir sessão de mensagem instantânea"/>
+		<button label="MI" name="im_btn" tool_tip="Iniciar MI"/>
 		<button label="Chamada" name="call_btn" tool_tip="Ligar para este residente"/>
 		<button label="Compartilhar" name="share_btn"/>
 		<button label="Teletransporte" name="teleport_btn" tool_tip="Oferecer teletransporte"/>
 		<button label="Perfil do grupo" name="group_info_btn" tool_tip="Exibir informação de grupo"/>
-		<button label="Bate- papo de grupo" name="chat_btn" tool_tip="abrir sessão de bate- papo"/>
+		<button label="Bate-papo de grupo" name="chat_btn" tool_tip="Iniciar bate-papo"/>
 		<button label="Ligar para o grupo" name="group_call_btn" tool_tip="Ligar para este grupo"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_place_profile.xml b/indra/newview/skins/default/xui/pt/panel_place_profile.xml
index 5c81c7649b..03f997f31b 100644
--- a/indra/newview/skins/default/xui/pt/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/pt/panel_place_profile.xml
@@ -6,7 +6,7 @@
 	<string name="available" value="disponível"/>
 	<string name="allocated" value="alocados"/>
 	<string name="title_place" value="Perfil da região"/>
-	<string name="title_teleport_history" value="Histórico de teletransportes"/>
+	<string name="title_teleport_history" value="Teletransportes"/>
 	<string name="not_available" value="(N\A)"/>
 	<string name="unknown" value="(Desconhecido)"/>
 	<string name="public" value="(público)"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_places.xml b/indra/newview/skins/default/xui/pt/panel_places.xml
index d9045e1a37..9da4201c85 100644
--- a/indra/newview/skins/default/xui/pt/panel_places.xml
+++ b/indra/newview/skins/default/xui/pt/panel_places.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Lugares" name="places panel">
 	<string name="landmarks_tab_title" value="MEUS MARCOS"/>
-	<string name="teleport_history_tab_title" value="HISTÓRICO DE TELETRANSPORTES"/>
+	<string name="teleport_history_tab_title" value="TELETRANSPORTES"/>
 	<filter_editor label="Filtrar meus lugares" name="Filter"/>
 	<panel name="button_panel">
 		<button label="Teletransportar" name="teleport_btn" tool_tip="Teletransportar para a área selecionada"/>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
index 95a2e47eba..f30c218c81 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_advanced.xml
@@ -16,17 +16,17 @@
 	<check_box label="Mostre-me em visão de mouse" name="first_person_avatar_visible"/>
 	<check_box label="Teclas de seta sempre me movem" name="arrow_keys_move_avatar_check"/>
 	<check_box label="Dê dois toques e pressione para correr" name="tap_tap_hold_to_run"/>
-	<check_box label="Mover os lábios do avatar quando estiver falando" name="enable_lip_sync"/>
+	<check_box label="Mover os lábios do avatar ao falar" name="enable_lip_sync"/>
 	<check_box label="Balão de bate-papo" name="bubble_text_chat"/>
 	<slider label="Opacidade" name="bubble_chat_opacity"/>
-	<color_swatch name="background" tool_tip="Escolha a cor do balão de bate-papo"/>
+	<color_swatch name="background" tool_tip="Cor do balão de bate-papo"/>
 	<check_box label="Mostrar erros de script" name="show_script_errors"/>
 	<radio_group name="show_location">
 		<radio_item label="Bate-papo local" name="0"/>
 		<radio_item label="Janelas separadas" name="1"/>
 	</radio_group>
-	<check_box label="Tecla liga/desliga da minha voz:" name="push_to_talk_toggle_check" tool_tip="Quando em modo de alternância, pressione e solte o botão UMA vez para ligar e desligar o microfone. Quando em modo de alternância, o microfone só transmite sua enquanto o botão estiver pressionado."/>
-	<line_editor label="Botao apertar e falar" name="modifier_combo"/>
-	<button label="Definir chave" name="set_voice_hotkey_button"/>
+	<check_box label="Tecla liga/desliga da minha voz:" name="push_to_talk_toggle_check" tool_tip="Quando em modo de alternância, pressione e solte o botão UMA vez para ligar e desligar o microfone. Quando em modo de alternância, o microfone só transmite sua voz quando o botão estiver pressionado."/>
+	<line_editor label="Botão apertar e falar" name="modifier_combo"/>
+	<button label="Definir tecla" name="set_voice_hotkey_button"/>
 	<button label="Botão do meio do mouse" name="set_voice_middlemouse_button" tool_tip="Redefinir como botão do meio do mouse"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
index 0c2e67b4d5..e566fde27c 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_chat.xml
@@ -5,7 +5,7 @@
 	</text>
 	<radio_group name="chat_font_size">
 		<radio_item label="Pequeno" name="radio" value="0"/>
-		<radio_item label="Média" name="radio2" value="1"/>
+		<radio_item label="Médio" name="radio2" value="1"/>
 		<radio_item label="Grande" name="radio3" value="2"/>
 	</radio_group>
 	<text name="font_colors">
@@ -44,14 +44,14 @@
 		URLs
 	</text>
 	<check_box initial_value="true" label="Executar animação digitada quando estiver conversando" name="play_typing_animation"/>
-	<check_box label="Envie MIs por email quando eu estiver desconectado" name="send_im_to_email"/>
+	<check_box label="Enviar MIs por email se estiver desconectado" name="send_im_to_email"/>
 	<text name="show_ims_in_label">
 		Mostrar MIs em:
 	</text>
 	<text name="requires_restart_label">
 		(Reinicie para ativar)
 	</text>
-	<radio_group name="chat_window" tool_tip="Exibir cada bate-papo em uma janela separada, ou exibir todos em uma única janela com uma aba para cada pessoa (requer reinício)">
+	<radio_group name="chat_window" tool_tip="Exibir cada bate-papo em uma janela separada ou exibir todos em uma única janela com uma aba para cada pessoa (requer reinício)">
 		<radio_item label="Janelas separadas" name="radio" value="0"/>
 		<radio_item label="Guias" name="radio2" value="1"/>
 	</radio_group>
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
index 7a3e69c988..5c69fa8de1 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_general.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Geral" name="general_panel">
 	<text name="language_textbox">
-		Linguagem:
+		Idioma:
 	</text>
 	<combo_box name="language_combobox">
 		<combo_box.item label="Padrão" name="System Default Language"/>
@@ -20,20 +20,20 @@
 		(Reinicie para mostrar o novo idioma)
 	</text>
 	<text name="maturity_desired_prompt">
-		Eu quero acessar conteúdo classificado:
+		Quero acessar conteúdo:
 	</text>
 	<text name="maturity_desired_textbox"/>
 	<combo_box name="maturity_desired_combobox">
-		<combo_box.item label="PG, Mature e Adult" name="Desired_Adult"/>
-		<combo_box.item label="PG e Mature" name="Desired_Mature"/>
-		<combo_box.item label="PG" name="Desired_PG"/>
+		<combo_box.item label="Geral, Moderado e Adulto" name="Desired_Adult"/>
+		<combo_box.item label="Geral e Moderado" name="Desired_Mature"/>
+		<combo_box.item label="Geral" name="Desired_PG"/>
 	</combo_box>
 	<text name="start_location_textbox">
-		Ponto de partida:
+		Posição inicial:
 	</text>
 	<combo_box name="start_location_combo">
-		<combo_box.item label="Minha Última Localidade" name="MyLastLocation" tool_tip="Por padrão, registrar na minha última localidade."/>
-		<combo_box.item label="Minha Casa" name="MyHome" tool_tip="Como padrão, registrar na minha casa."/>
+		<combo_box.item label="Última localização" name="MyLastLocation" tool_tip="Voltar ao lugar onde estava antes."/>
+		<combo_box.item label="Meu início" name="MyHome" tool_tip="Voltar ao meu início."/>
 	</combo_box>
 	<check_box initial_value="true" label="Mostrar ao entrar" name="show_location_checkbox"/>
 	<text name="name_tags_textbox">
@@ -45,7 +45,7 @@
 		<radio_item label="Brevemente" name="radio3" value="2"/>
 	</radio_group>
 	<check_box label="Mostrar meu nome" name="show_my_name_checkbox1"/>
-	<check_box initial_value="true" label="Nomes pequenos" name="small_avatar_names_checkbox"/>
+	<check_box initial_value="true" label="Nome curto" name="small_avatar_names_checkbox"/>
 	<check_box label="Mostrar cargo" name="show_all_title_checkbox1"/>
 	<text name="effects_color_textbox">
 		Meus efeitos:
diff --git a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
index 7f6439d1e7..f03063d05b 100644
--- a/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/pt/panel_preferences_setup.xml
@@ -28,7 +28,7 @@
 	<text name="Cache location">
 		Localização do cache:
 	</text>
-	<button label="Navegar" label_selected="Navegar" name="set_cache"/>
+	<button label="Procurar" label_selected="Procurar" name="set_cache"/>
 	<button label="Redefinir" label_selected="Redefinir" name="reset_cache"/>
 	<text name="Web:">
 		Web:
@@ -45,5 +45,5 @@
 		Localização do proxy:
 	</text>
 	<line_editor name="web_proxy_editor" tool_tip="O nome ou endereço IP do proxy da sua preferência"/>
-	<spinner label="Número da porta:" name="web_proxy_port"/>
+	<spinner label="Porta:" name="web_proxy_port"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml
index 393478de08..773aea5848 100644
--- a/indra/newview/skins/default/xui/pt/strings.xml
+++ b/indra/newview/skins/default/xui/pt/strings.xml
@@ -8,7 +8,7 @@
 		SECOND LIFE
 	</string>
 	<string name="SUPPORT_SITE">
-		Portal de Apoio do Second Life
+		Portal de Supporte Second Life
 	</string>
 	<string name="StartupDetectingHardware">
 		Detectando hardware...
@@ -32,7 +32,7 @@
 		Alterando a resolução...
 	</string>
 	<string name="LoginInProgress">
-		Fazendo Login. [APP_NAME] pode parecer congelado. Por favor, aguarde.
+		Fazendo login. [APP_NAME] pode parecer congelado. Por favor, aguarde.
 	</string>
 	<string name="LoginInProgressNoFrozen">
 		Logando...
@@ -44,7 +44,7 @@
 		Executando manutenção da conta...
 	</string>
 	<string name="LoginAttempt">
-		Falha na tentativa anterior de login. Fazendo Login, tentativa [NUMBER]
+		Falha na tentativa anterior de login. Login, tentativa [NUMBER]
 	</string>
 	<string name="LoginPrecaching">
 		Carregando mundo...
@@ -62,10 +62,10 @@
 		Verificando arquivos cache (pode levar de 60-90 segundos)...
 	</string>
 	<string name="LoginProcessingResponse">
-		Processando Resposta...
+		Processando resposta...
 	</string>
 	<string name="LoginInitializingWorld">
-		Inicializando Mundo...
+		Inicializando mundo...
 	</string>
 	<string name="LoginDecodingImages">
 		Decodificando imagens...
@@ -74,13 +74,13 @@
 		Inicializando o QuickTime...
 	</string>
 	<string name="LoginQuicktimeNotFound">
-		O QuickTime não foi encontrado - incapaz de inicializar.
+		O QuickTime não foi encontrado - falha ao iniciar.
 	</string>
 	<string name="LoginQuicktimeOK">
 		O QuickTime foi inicializado com sucesso.
 	</string>
 	<string name="LoginWaitingForRegionHandshake">
-		Aguardando o handshake com a região...
+		Aguardando handshake com a região...
 	</string>
 	<string name="LoginConnectingToRegion">
 		Conectando à região...
@@ -89,7 +89,7 @@
 		Baixando roupas...
 	</string>
 	<string name="LoginFailedNoNetwork">
-		Erro de Rede: Não foi possível estabelecer a conexão, verifique sua conexão de rede.
+		Erro de rede: Não foi possível estabelecer a conexão, verifique sua conexão de rede.
 	</string>
 	<string name="LoginFailed">
 		Falha do login.
@@ -143,22 +143,22 @@
 		Construído por Grupo
 	</string>
 	<string name="TooltipFlagNoBuild">
-		Não é Permitido Construir
+		Não é permitido construir
 	</string>
 	<string name="TooltipFlagNoEdit">
 		Construído por Grupo
 	</string>
 	<string name="TooltipFlagNotSafe">
-		Não é Seguro
+		Não é seguro
 	</string>
 	<string name="TooltipFlagNoFly">
-		Não é Permitido Voar
+		Não é permitido voar
 	</string>
 	<string name="TooltipFlagGroupScripts">
 		Scripts de Grupo
 	</string>
 	<string name="TooltipFlagNoScripts">
-		Não são Permitidos Scripts
+		Não são permitidos scripts
 	</string>
 	<string name="TooltipLand">
 		Terreno:
@@ -167,10 +167,10 @@
 		Apenas um item único pode ser arrastado para este local
 	</string>
 	<string name="TooltipHttpUrl">
-		Clique para ver essa página web
+		Clique para ver a página web
 	</string>
 	<string name="TooltipSLURL">
-		Clique para ver a informação desta localização
+		Clique para ver os dados desta localização
 	</string>
 	<string name="TooltipAgentUrl">
 		Clique para ver o perfil deste residente
@@ -200,7 +200,7 @@
 		Clique para ver a descrição deste evento
 	</string>
 	<string name="TooltipClassifiedUrl">
-		Clique para ver este classificado
+		Clique para ver este anúncio
 	</string>
 	<string name="TooltipParcelUrl">
 		Clique para ver a descrição desta parcela
@@ -215,7 +215,7 @@
 		Clique para ver esta localização no mapa
 	</string>
 	<string name="TooltipSLAPP">
-		Clique para ativar no secondlife:// commando
+		Clique para ativar no secondlife:// comando
 	</string>
 	<string name="CurrentURL" value="URL atual: [CurrentURL]"/>
 	<string name="TooltipPrice" value="L$[PRICE]-"/>
@@ -274,7 +274,7 @@
 		Buscando...
 	</string>
 	<string name="ReleaseNotes">
-		Notas de Distribuição
+		Notas de versão
 	</string>
 	<string name="LoadingData">
 		Carregando...
@@ -343,7 +343,7 @@
 		objeto
 	</string>
 	<string name="note card">
-		notecard
+		anotação
 	</string>
 	<string name="folder">
 		pasta
@@ -430,7 +430,7 @@
 		Entediado
 	</string>
 	<string name="anim_bow">
-		Saudar curvando
+		Reverência
 	</string>
 	<string name="anim_clap">
 		Aplaudir
@@ -490,10 +490,10 @@
 		Impaciente
 	</string>
 	<string name="anim_jumpforjoy">
-		Pular de Alegria
+		Pular de alegria
 	</string>
 	<string name="anim_kissmybutt">
-		Beije meu Bumbum
+		Beije meu bumbum
 	</string>
 	<string name="anim_express_kiss">
 		Beijar
@@ -514,7 +514,7 @@
 		Nya-nya-nya
 	</string>
 	<string name="anim_punch_onetwo">
-		Soco Um-Dois
+		Soco um-dois
 	</string>
 	<string name="anim_express_open_mouth">
 		Abrir a boca
@@ -529,10 +529,10 @@
 		Apontar para si
 	</string>
 	<string name="anim_punch_l">
-		Socar Esquerda
+		Soco esquerdo
 	</string>
 	<string name="anim_punch_r">
-		Socar Direita
+		Soco direito
 	</string>
 	<string name="anim_rps_countdown">
 		RPS contar
@@ -571,16 +571,16 @@
 		Fumar à toa
 	</string>
 	<string name="anim_smoke_inhale">
-		Inalar Fumaça
+		Inalar fumaça
 	</string>
 	<string name="anim_smoke_throw_down">
-		Expelir Fumaça
+		Expelir fumaça
 	</string>
 	<string name="anim_express_surprise">
 		Surpresa
 	</string>
 	<string name="anim_sword_strike_r">
-		Golpe de Espada
+		Golpe de espada
 	</string>
 	<string name="anim_angry_tantrum">
 		Enraivecer
@@ -637,7 +637,7 @@
 		grita:
 	</string>
 	<string name="ringing">
-		Conectando à conversa de Voz no mundo
+		Conectando à conversa de voz no mundo
 	</string>
 	<string name="connected">
 		Conectado
@@ -691,13 +691,13 @@
 		Controle sua camera
 	</string>
 	<string name="SIM_ACCESS_PG">
-		PG
+		Público geral
 	</string>
 	<string name="SIM_ACCESS_MATURE">
-		Mature
+		Moderado
 	</string>
 	<string name="SIM_ACCESS_ADULT">
-		Adult
+		Adulto
 	</string>
 	<string name="SIM_ACCESS_DOWN">
 		Desconectado
@@ -709,7 +709,7 @@
 		(desconhecido)
 	</string>
 	<string name="all_files">
-		Todos os Arquivos
+		Todos os arquivos
 	</string>
 	<string name="sound_files">
 		Sons
@@ -733,10 +733,10 @@
 		Imagens Bitmap
 	</string>
 	<string name="avi_movie_file">
-		Arquivo de filme AVI
+		Arquivo de vídeo AVI
 	</string>
 	<string name="xaf_animation_file">
-		Arquivo de Animação XAF
+		Arquivo de animação XAF
 	</string>
 	<string name="xml_file">
 		Arquivo XML
@@ -745,25 +745,25 @@
 		Arquivo RAW
 	</string>
 	<string name="compressed_image_files">
-		Imagens Compactadas
+		Imagens compactadas
 	</string>
 	<string name="load_files">
-		Carregar Arquivos
+		Carregar arquivos
 	</string>
 	<string name="choose_the_directory">
-		Escolher Diretório
+		Selecionar pasta
 	</string>
 	<string name="AvatarSetNotAway">
-		deixar como não away
+		deixar como ausente
 	</string>
 	<string name="AvatarSetAway">
-		deixar como Away
+		deixar como ausente
 	</string>
 	<string name="AvatarSetNotBusy">
-		deixar como não Ocupado
+		deixar como não ocupado
 	</string>
 	<string name="AvatarSetBusy">
-		Deixar como Busy
+		Deixar como ocupado
 	</string>
 	<string name="shape">
 		Silhueta
@@ -781,7 +781,7 @@
 		Camisa
 	</string>
 	<string name="pants">
-		calças
+		Calças
 	</string>
 	<string name="shoes">
 		Sapatos
@@ -796,22 +796,22 @@
 		Luvas
 	</string>
 	<string name="undershirt">
-		camiseta
+		Camiseta
 	</string>
 	<string name="underpants">
-		roupa debaixo
+		Roupa de baixo
 	</string>
 	<string name="skirt">
-		saia
+		Saia
 	</string>
 	<string name="alpha">
 		Alpha
 	</string>
 	<string name="tattoo">
-		Tattoo
+		Tatuagem
 	</string>
 	<string name="invalid">
-		inválido
+		Inválido
 	</string>
 	<string name="NewWearable">
 		Novo [WEARABLE_ITEM]
@@ -905,32 +905,32 @@
 	</string>
 	<string name="WornOnAttachmentPoint" value="(vestido em [ATTACHMENT_POINT])"/>
 	<string name="ActiveGesture" value="[GESLABEL] (ativado)"/>
-	<string name="Chat" value="Bate papo :"/>
-	<string name="Sound" value="Som :"/>
-	<string name="Wait" value="--- Aguarde :"/>
-	<string name="AnimFlagStop" value="Parar animação :"/>
-	<string name="AnimFlagStart" value="Iniciar animação :"/>
-	<string name="Wave" value="Aceno"/>
+	<string name="Chat" value="Bate papo"/>
+	<string name="Sound" value="Som"/>
+	<string name="Wait" value="--- Aguarde"/>
+	<string name="AnimFlagStop" value="Parar animação"/>
+	<string name="AnimFlagStart" value="Iniciar animação"/>
+	<string name="Wave" value="Acenar"/>
 	<string name="HelloAvatar" value="Olá, avatar!"/>
-	<string name="ViewAllGestures" value="Ver tudo &gt;&gt;"/>
+	<string name="ViewAllGestures" value="Ver todos&gt;&gt;"/>
 	<string name="Animations" value="Animações,"/>
 	<string name="Calling Cards" value="Cartões de visitas,"/>
 	<string name="Clothing" value="Vestuário,"/>
 	<string name="Gestures" value="Gestos,"/>
-	<string name="Landmarks" value="Landmarks,"/>
-	<string name="Notecards" value="Notecards,"/>
+	<string name="Landmarks" value="Marcos"/>
+	<string name="Notecards" value="Anotações"/>
 	<string name="Objects" value="Objetos,"/>
 	<string name="Scripts" value="Scripts,"/>
-	<string name="Sounds" value="Sons,"/>
-	<string name="Textures" value="Texturas,"/>
-	<string name="Snapshots" value="Fotografias,"/>
+	<string name="Sounds" value="Sons"/>
+	<string name="Textures" value="Texturas"/>
+	<string name="Snapshots" value="Fotografias"/>
 	<string name="No Filters" value="Não"/>
-	<string name="Since Logoff" value="- desde desligado"/>
+	<string name="Since Logoff" value="- Desde desligado"/>
 	<string name="InvFolder My Inventory">
-		Meu Inventorio
+		Meu inventário
 	</string>
 	<string name="InvFolder My Favorites">
-		Meus Favoritos
+		Meus favoritos
 	</string>
 	<string name="InvFolder Library">
 		Biblioteca
@@ -942,10 +942,10 @@
 		Sons
 	</string>
 	<string name="InvFolder Calling Cards">
-		Cartões de Visitas
+		Cartões de visitas
 	</string>
 	<string name="InvFolder Landmarks">
-		Landmarks
+		Marcos
 	</string>
 	<string name="InvFolder Scripts">
 		Scripts
@@ -957,31 +957,31 @@
 		Objetos
 	</string>
 	<string name="InvFolder Notecards">
-		Notecards
+		Anotações
 	</string>
 	<string name="InvFolder New Folder">
-		Nova Pasta
+		Nova pasta
 	</string>
 	<string name="InvFolder Inventory">
 		Inventário
 	</string>
 	<string name="InvFolder Uncompressed Images">
-		Imagens Descompactadas
+		Imagens descompactadas
 	</string>
 	<string name="InvFolder Body Parts">
-		Partes do Corpo
+		Corpo
 	</string>
 	<string name="InvFolder Trash">
 		Lixo
 	</string>
 	<string name="InvFolder Photo Album">
-		Álbum de Fotografias
+		Álbum de fotografias
 	</string>
 	<string name="InvFolder Lost And Found">
 		Achados e Perdidos
 	</string>
 	<string name="InvFolder Uncompressed Sounds">
-		Sons Descompactados
+		Sons descompactados
 	</string>
 	<string name="InvFolder Animations">
 		Animações
@@ -993,10 +993,10 @@
 		Favoritos
 	</string>
 	<string name="InvFolder Current Outfit">
-		Vestimanta Atual
+		Look atual
 	</string>
 	<string name="InvFolder My Outfits">
-		Minhas Vestimentas
+		Meus looks
 	</string>
 	<string name="InvFolder Accessories">
 		Acessórios
@@ -1071,7 +1071,7 @@
 		Espinha
 	</string>
 	<string name="Pelvis">
-		Pelvis
+		Pélvis
 	</string>
 	<string name="Mouth">
 		Boca
@@ -1128,10 +1128,10 @@
 		Estômago
 	</string>
 	<string name="Left Pec">
-		Pec esquerdo
+		Peitoral E
 	</string>
 	<string name="Right Pec">
-		Pec direito
+		Peitoral D
 	</string>
 	<string name="YearsMonthsOld">
 		[AGEYEARS] [AGEMONTHS] de idade
@@ -1209,19 +1209,19 @@
 		Empregado da Linden Lab
 	</string>
 	<string name="PaymentInfoUsed">
-		Info de Pagamento usada
+		Dados de pagamento usados
 	</string>
 	<string name="PaymentInfoOnFile">
-		Info de Pagamento no Arquivo
+		Dados de pagamento fornecidos
 	</string>
 	<string name="NoPaymentInfoOnFile">
-		Nenhuma Info de Pagamento no Arquivo
+		Nenhum dado de pagamento
 	</string>
 	<string name="AgeVerified">
-		Idade-verificada
+		Idade comprovada
 	</string>
 	<string name="NotAgeVerified">
-		Idade não-verificada
+		Idade não comprovada
 	</string>
 	<string name="Center 2">
 		Centro 2
@@ -1248,16 +1248,16 @@
 		Inferior direito
 	</string>
 	<string name="CompileQueueDownloadedCompiling">
-		Downloaded, agora compilando
+		Baixado, agora compilando
 	</string>
 	<string name="CompileQueueScriptNotFound">
 		Script não encontrado no servidor.
 	</string>
 	<string name="CompileQueueProblemDownloading">
-		Problema no  download
+		Problema no download
 	</string>
 	<string name="CompileQueueInsufficientPermDownload">
-		Permissões insuficientes para  fazer o download do script.
+		Permissões insuficientes para fazer o download do script.
 	</string>
 	<string name="CompileQueueInsufficientPermFor">
 		Permissões insuficientes para
@@ -1266,7 +1266,7 @@
 		Falha desconhecida para download
 	</string>
 	<string name="CompileQueueTitle">
-		Progresso do Recompilamento
+		Progresso do recompilamento
 	</string>
 	<string name="CompileQueueStart">
 		recompilar
@@ -1275,7 +1275,7 @@
 		Reset Progresso
 	</string>
 	<string name="ResetQueueStart">
-		reset
+		Zerar
 	</string>
 	<string name="RunQueueTitle">
 		Definir funcionamento do progresso
@@ -1299,7 +1299,7 @@
 		Salvo.
 	</string>
 	<string name="ObjectOutOfRange">
-		Script (objecto fora de alcance)
+		Script (objeto fora de alcance)
 	</string>
 	<string name="GodToolsObjectOwnedBy">
 		Objeto [OBJECT] de propriedade de [OWNER]
@@ -1327,10 +1327,10 @@
 		Total
 	</string>
 	<string name="NoGroupDataFound">
-		Não ha dados de grupo para o grupo
+		Não há dados de grupo
 	</string>
 	<string name="IMParentEstate">
-		propriedade dos pais
+		Propriedade-pai
 	</string>
 	<string name="IMMainland">
 		continente
@@ -1522,7 +1522,7 @@
 		Conteúdo do objeto
 	</string>
 	<string name="BusyModeResponseDefault">
-		O residente para o qual escreveu está no modo &apos;ocupado&apos;, ou seja, ele prefere não receber nada no momento.   Sua mensagem será exibida como uma MI mais tarde.
+		O residente para o qual escreveu está no modo &apos;ocupado&apos;, ou seja, ele prefere não receber nada no momento. Sua mensagem será exibida como uma MI mais tarde.
 	</string>
 	<string name="MuteByName">
 		(por nome)
@@ -1537,10 +1537,10 @@
 		(grupo)
 	</string>
 	<string name="RegionNoCovenant">
-		Não ha Contrato fornecido para essa Região.
+		Não foi definido um contrato para essa região.
 	</string>
 	<string name="RegionNoCovenantOtherOwner">
-		Não ha Contrato fornecido para essa Região. O terreno nesta região está sendo vendido pelo Proprietário, não pela Linden Lab. Favor contatar o Proprietário da região para detalhes de venda.
+		Não foi definido um contrato para essa Região. O terreno nesta região está sendo vendido pelo Proprietário, não pela Linden Lab. Favor contatar o Proprietário da região para detalhes de venda.
 	</string>
 	<string name="covenant_last_modified">
 		Última modificação:
@@ -1560,7 +1560,7 @@
 		(vai atualizar depois de publicado)
 	</string>
 	<string name="NoPicksClassifiedsText">
-		Você não criou nenhum Destaque ou Anúncio.  Clique no botão &quot;+&quot; para criar um Destaque ou Anúncio.
+		Você não criou nenhum Destaque ou Anúncio. Clique no botão &quot;+&quot; para criar um Destaque ou Anúncio.
 	</string>
 	<string name="NoAvatarPicksClassifiedsText">
 		O usuário não tem nenhum destaque ou anúncio
@@ -1581,19 +1581,19 @@
 		possuído pelo grupo
 	</string>
 	<string name="InvOfferOwnedByUnknownGroup">
-		possuído por um grupo desconhecido
+		de um grupo desconhecido
 	</string>
 	<string name="InvOfferOwnedBy">
-		possuído por
+		de
 	</string>
 	<string name="InvOfferOwnedByUnknownUser">
-		possuído por usuário desconhecido
+		de usuário desconhecido
 	</string>
 	<string name="InvOfferGaveYou">
 		deu a você
 	</string>
 	<string name="InvOfferYouDecline">
-		Você declina
+		Você recusa
 	</string>
 	<string name="InvOfferFrom">
 		de
@@ -1620,7 +1620,7 @@
 		pagou prêmio para o evento
 	</string>
 	<string name="GroupMoneyBalance">
-		Balanço
+		Saldo
 	</string>
 	<string name="GroupMoneyCredits">
 		Créditos
@@ -1651,10 +1651,10 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
 		Bloquear
 	</string>
 	<string name="AddLandmarkNavBarMenu">
-		Adicionar Landmark...
+		Adicionar marco...
 	</string>
 	<string name="EditLandmarkNavBarMenu">
-		Editar Landmark...
+		Editar marco...
 	</string>
 	<string name="accel-mac-control">
 		⌃
@@ -1762,7 +1762,7 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
 		Locação Linden
 	</string>
 	<string name="Adult">
-		Adult
+		Adulto
 	</string>
 	<string name="Arts&amp;Culture">
 		Artes e Cultura
@@ -1774,13 +1774,13 @@ Expected .wav, .tga, .bmp, .jpg, .jpeg, or .bvh
 		Educacional
 	</string>
 	<string name="Gaming">
-		Jogos
+		Games
 	</string>
 	<string name="Hangout">
 		Moradia
 	</string>
 	<string name="Newcomer Friendly">
-		Amigável a Novos Usuários
+		Para recém-chegados
 	</string>
 	<string name="Parks&amp;Nature">
 		Parques &amp; Natureza
@@ -1822,10 +1822,10 @@ Se a mensagem persistir, reinicie o computador e tente novamente.
 Se o error persistir, pode ser necessário desinstalar completamente [APP_NAME] e reinstalá-lo.
 	</string>
 	<string name="MBFatalError">
-		Erro Fatal
+		Erro fatal
 	</string>
 	<string name="MBRequiresAltiVec">
-		[APP_NAME] exige um processador com AltiVec (G4 ou superior).
+		[APP_NAME] exige processador com AltiVec (G4 ou superior).
 	</string>
 	<string name="MBAlreadyRunning">
 		[APP_NAME] já está em execução.
@@ -1833,7 +1833,7 @@ Verifique a sua barra de tarefas para obter uma cópia do programa minimizado.
 Se a mensagem persistir, reinicie o computador.
 	</string>
 	<string name="MBFrozenCrashed">
-		[APP_NAME] parece ter congelado ou falhado na execução anterior. Você gostaria de enviar um relatório de falha?
+		[APP_NAME] parece ter congelado ou falhado na execução anterior. Enviar relatório de falha?
 	</string>
 	<string name="MBAlert">
 		Alerta
@@ -1887,7 +1887,7 @@ Também não se esqueça de definir seu monitor para True Color (32-bit), em pai
 Se você continuar a receber esta mensagem, contate o [SUPPORT_SITE].
 	</string>
 	<string name="MBPixelFmtSetErr">
-		ão é possível definir o formato de pixel
+		Não é possível definir o formato de pixel
 	</string>
 	<string name="MBGLContextErr">
 		Não é possível criar o contexto de renderização GL
@@ -1901,7 +1901,7 @@ Se você continuar a receber esta mensagem, contate o [SUPPORT_SITE].
 If you continue to receive this message, contact the [SUPPORT_SITE].
 	</string>
 	<string name="5 O&apos;Clock Shadow">
-		Sombra descuidada
+		Barba por fazer
 	</string>
 	<string name="All White">
 		Todo branco
@@ -1910,10 +1910,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Olhos de Anime
 	</string>
 	<string name="Arced">
-		arqueado
+		Arqueados
 	</string>
 	<string name="Arm Length">
-		Comprimento do Braço
+		Comprimento do braço
 	</string>
 	<string name="Attached">
 		Anexado
@@ -1931,7 +1931,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Franja
 	</string>
 	<string name="Beady Eyes">
-		Olhos malévolos
+		Olhos pequenos
 	</string>
 	<string name="Belly Size">
 		Tamanho da barriga
@@ -1940,7 +1940,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Grande
 	</string>
 	<string name="Big Butt">
-		Traseiro Grande
+		Bunda grande
 	</string>
 	<string name="Big Hair Back">
 		Cabelo volumoso: Trás
@@ -1949,7 +1949,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Cabelo volumoso: Frente
 	</string>
 	<string name="Big Hair Top">
-		cabelo volumoso: Topo
+		Cabelo volumoso: Topo
 	</string>
 	<string name="Big Head">
 		cabeça grande
@@ -1958,7 +1958,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Peitorais grandes
 	</string>
 	<string name="Big Spikes">
-		espinhos grandes
+		Pontas grandes
 	</string>
 	<string name="Black">
 		Negro
@@ -1967,40 +1967,40 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Loiro
 	</string>
 	<string name="Blonde Hair">
-		Cabelo Loiro
+		Cabelo loiro
 	</string>
 	<string name="Blush">
 		Blush
 	</string>
 	<string name="Blush Color">
-		cor do Blush
+		Cor do blush
 	</string>
 	<string name="Blush Opacity">
-		Opacidade do Blush
+		Opacidade do blush
 	</string>
 	<string name="Body Definition">
-		definição do Corpo
+		Definição do corpo
 	</string>
 	<string name="Body Fat">
-		Gordura corporal
+		Gordura
 	</string>
 	<string name="Body Freckles">
-		Sardas do corpo
+		Sardas
 	</string>
 	<string name="Body Thick">
 		Corpo cheio
 	</string>
 	<string name="Body Thickness">
-		Espessura do corpo
+		Ossatura
 	</string>
 	<string name="Body Thin">
 		Corpo magro
 	</string>
 	<string name="Bow Legged">
-		pernas arqueadas
+		Pernas arqueadas
 	</string>
 	<string name="Breast Buoyancy">
-		Flexibilidade dos seios
+		Caimento dos seios
 	</string>
 	<string name="Breast Cleavage">
 		Separação dos seios
@@ -2015,7 +2015,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Largo
 	</string>
 	<string name="Brow Size">
-		tamanho da sobrancelha
+		Tamanho da sobrancelha
 	</string>
 	<string name="Bug Eyes">
 		Olhos saltados
@@ -2039,25 +2039,25 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Tamanho do traseiro
 	</string>
 	<string name="bustle skirt">
-		Movimentação de saia
+		Saia armada
 	</string>
 	<string name="no bustle">
-		Sem movimento
+		Saia reta
 	</string>
 	<string name="more bustle">
-		Mais movimento
+		Mais
 	</string>
 	<string name="Chaplin">
 		Chaplin
 	</string>
 	<string name="Cheek Bones">
-		Maças do rosto
+		Maçãs do rosto
 	</string>
 	<string name="Chest Size">
 		Tamanho do peito
 	</string>
 	<string name="Chin Angle">
-		ângulo do queixo
+		Ângulo do queixo
 	</string>
 	<string name="Chin Cleft">
 		Fissura do queixo
@@ -2105,7 +2105,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Direita fechada
 	</string>
 	<string name="Coin Purse">
-		Pubis
+		Pouco volume
 	</string>
 	<string name="Collar Back">
 		Colarinho posterior
@@ -2126,7 +2126,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Nariz torto
 	</string>
 	<string name="Cuff Flare">
-		bainha larga
+		Bainha larga
 	</string>
 	<string name="Dark">
 		Escuro
@@ -2135,13 +2135,13 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Verde escuro
 	</string>
 	<string name="Darker">
-		mais escuro
+		Mais escuro
 	</string>
 	<string name="Deep">
 		Profundidade
 	</string>
 	<string name="Default Heels">
-		Salto Padrão
+		Salto padrão
 	</string>
 	<string name="Dense">
 		Densidade
@@ -2153,10 +2153,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Curvado para baixo
 	</string>
 	<string name="Duffle Bag">
-		pubis
+		Mais volume
 	</string>
 	<string name="Ear Angle">
-		ângulo da orelha
+		Ângulo da orelha
 	</string>
 	<string name="Ear Size">
 		Tamanho da orelha
@@ -2183,7 +2183,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Abertura dos olhos
 	</string>
 	<string name="Eye Pop">
-		Olho Saltado
+		Olho saltado
 	</string>
 	<string name="Eye Size">
 		Tamanho dos olhos
@@ -2195,7 +2195,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Arco da sobrancelha
 	</string>
 	<string name="Eyebrow Density">
-		densidade da sobrancelha
+		Densidade da sobrancelha
 	</string>
 	<string name="Eyebrow Height">
 		Altura da sobrancelha
@@ -2258,7 +2258,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Tamanho dos pés
 	</string>
 	<string name="Forehead Angle">
-		ângulo da testa
+		Ângulo da testa
 	</string>
 	<string name="Forehead Heavy">
 		Testa pronunciada
@@ -2291,7 +2291,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Dedos da luva
 	</string>
 	<string name="Glove Length">
-		comprimento das luvas
+		Comprimento das luvas
 	</string>
 	<string name="Hair">
 		Cabelo
@@ -2330,7 +2330,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Tamanho das mãos
 	</string>
 	<string name="Handlebars">
-		bigode
+		Bigode
 	</string>
 	<string name="Head Length">
 		Comprimento da cabeça
@@ -2354,7 +2354,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Altura
 	</string>
 	<string name="High">
-		alto
+		Alto
 	</string>
 	<string name="High Heels">
 		Salto alto
@@ -2363,7 +2363,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Maxilar alto
 	</string>
 	<string name="High Platforms">
-		Plataformas alta
+		Plataformas altas
 	</string>
 	<string name="High and Tight">
 		Alto e justo
@@ -2399,7 +2399,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Comprimento da blusa
 	</string>
 	<string name="Jacket Wrinkles">
-		Dobras da Blusa
+		Dobras da jaqueta
 	</string>
 	<string name="Jaw Angle">
 		Ângulo da mandíbula
@@ -2441,7 +2441,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Menos
 	</string>
 	<string name="Less Body Fat">
-		Menos gordura corporal
+		Menos gordura
 	</string>
 	<string name="Less Curtains">
 		Menos barba
@@ -2456,7 +2456,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Menos gravidade
 	</string>
 	<string name="Less Love">
-		Menos cintura
+		Menos excesso
 	</string>
 	<string name="Less Muscles">
 		Menos músculos
@@ -2489,7 +2489,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Fenda dos lábios
 	</string>
 	<string name="Lip Cleft Depth">
-		Prfundidade da fenda dos lábios
+		Profundidade da fenda dos lábios
 	</string>
 	<string name="Lip Fullness">
 		Volume dos lábios
@@ -2546,37 +2546,37 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Pantalonas
 	</string>
 	<string name="Loose Shirt">
-		Saia folgada
+		Camisa folgada
 	</string>
 	<string name="Loose Sleeves">
-		Manga longa
+		Mangas folgadas
 	</string>
 	<string name="Love Handles">
 		Pneu
 	</string>
 	<string name="Low">
-		baixo
+		Baixo
 	</string>
 	<string name="Low Heels">
 		Salto baixo
 	</string>
 	<string name="Low Jaw">
-		maxilar baixo
+		Maxilar baixo
 	</string>
 	<string name="Low Platforms">
 		Plataformas baixas
 	</string>
 	<string name="Low and Loose">
-		baixo e solto
+		Baixo e solto
 	</string>
 	<string name="Lower">
-		diminuir
+		Mais baixo
 	</string>
 	<string name="Lower Bridge">
-		nariz baixo
+		Mais baixa
 	</string>
 	<string name="Lower Cheeks">
-		bochechas abaixadas
+		Bochechas abaixadas
 	</string>
 	<string name="Male">
 		Masculino
@@ -2591,7 +2591,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Mais blush
 	</string>
 	<string name="More Body Fat">
-		Mais gordura corporal
+		Mais gordura
 	</string>
 	<string name="More Curtains">
 		Mais barba
@@ -2645,7 +2645,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Mais vertical
 	</string>
 	<string name="More Volume">
-		Mais Volume
+		Mais volume
 	</string>
 	<string name="More soul">
 		Mais alma
@@ -2696,16 +2696,16 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Espessura do pescoço
 	</string>
 	<string name="No Blush">
-		Sem Blush
+		Sem blush
 	</string>
 	<string name="No Eyeliner">
 		Sem delineador
 	</string>
 	<string name="No Eyeshadow">
-		Sem Sombra dos olhos
+		Sem sombra
 	</string>
 	<string name="No Lipgloss">
-		Sem brilho labial
+		Sem brilho
 	</string>
 	<string name="No Lipstick">
 		Sem batom
@@ -2720,7 +2720,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Sem vermelho
 	</string>
 	<string name="No Spikes">
-		Sem espinhos
+		Sem pontas
 	</string>
 	<string name="No White">
 		Sem branco
@@ -2801,10 +2801,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Sombra externa
 	</string>
 	<string name="Overbite">
-		Overbite
+		Má oclusão
 	</string>
 	<string name="Package">
-		Pubis
+		Púbis
 	</string>
 	<string name="Painted Nails">
 		Unhas pintadas
@@ -2816,7 +2816,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Cavalo da calça
 	</string>
 	<string name="Pants Fit">
-		Pants Fit
+		Caimento das calças
 	</string>
 	<string name="Pants Length">
 		Comprimento das calças
@@ -2831,10 +2831,10 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Parte
 	</string>
 	<string name="Part Bangs">
-		Parts da franja
+		Divisão da franja
 	</string>
 	<string name="Pectorals">
-		Peitoral
+		Peitorais
 	</string>
 	<string name="Pigment">
 		Pigmento
@@ -2879,7 +2879,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Pálpebras inchadas
 	</string>
 	<string name="Rainbow Color">
-		Cor do arco iris
+		Cor do arco íris
 	</string>
 	<string name="Red Hair">
 		Cabelo ruivo
@@ -2906,7 +2906,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Cabelo desalinhado
 	</string>
 	<string name="Saddle Bags">
-		Saddle Bags
+		Culote
 	</string>
 	<string name="Scrawny Leg">
 		Pernas magricelas
@@ -2915,7 +2915,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Separar
 	</string>
 	<string name="Shallow">
-		raso
+		Raso
 	</string>
 	<string name="Shear Back">
 		Trás rente
@@ -2939,22 +2939,22 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Rente frente
 	</string>
 	<string name="Shift Left">
-		Deslocar  à esquerda
+		Deslocar p/ esquerda
 	</string>
 	<string name="Shift Mouth">
 		Deslocar boca
 	</string>
 	<string name="Shift Right">
-		Deslocar direita
+		Deslocar p/ direita
 	</string>
 	<string name="Shirt Bottom">
-		Deslocar inferior
+		Barra da camisa
 	</string>
 	<string name="Shirt Fit">
-		Deslocar ajuste
+		Ajuste da camisa
 	</string>
 	<string name="Shirt Wrinkles">
-		Deslocar dobras
+		+/- amassada
 	</string>
 	<string name="Shoe Height">
 		Altura do sapato
@@ -3218,7 +3218,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 		Ver mais informações sobre a localização atual
 	</string>
 	<string name="LocationCtrlComboBtnTooltip">
-		Meu histórico de localizações
+		Histórico de localizações
 	</string>
 	<string name="UpdaterWindowTitle">
 		[APP_NAME] Atualização
@@ -3418,7 +3418,7 @@ If you continue to receive this message, contact the [SUPPORT_SITE].
 Denunciar abuso
 	</string>
 	<string name="New Shape">
-		Nova silhueta
+		Nova forma
 	</string>
 	<string name="New Skin">
 		Nova pele
-- 
cgit v1.2.3


From 609767d2197e39e5b3456aa805260750e84d74e6 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 21:21:59 -0700
Subject: IT translation review for set6C

---
 .../skins/default/xui/it/floater_build_options.xml | 10 +++---
 .../skins/default/xui/it/floater_buy_currency.xml  | 22 ++++++------
 .../skins/default/xui/it/floater_customize.xml     | 22 ++++++------
 .../default/xui/it/floater_preview_notecard.xml    |  2 +-
 .../default/xui/it/floater_settings_debug.xml      |  2 +-
 .../default/xui/it/floater_whitelist_entry.xml     |  2 +-
 .../skins/default/xui/it/mime_types_linux.xml      | 42 +++++++++++-----------
 .../skins/default/xui/it/panel_edit_alpha.xml      |  2 +-
 .../skins/default/xui/it/panel_edit_wearable.xml   | 38 ++++++++++----------
 .../skins/default/xui/it/panel_nearby_chat_bar.xml |  6 ++++
 .../skins/default/xui/it/panel_place_profile.xml   | 32 ++++++++---------
 .../default/xui/it/panel_preferences_graphics1.xml |  6 ++--
 .../skins/default/xui/it/panel_status_bar.xml      |  4 +--
 .../newview/skins/default/xui/it/role_actions.xml  |  2 +-
 14 files changed, 99 insertions(+), 93 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/it/floater_build_options.xml b/indra/newview/skins/default/xui/it/floater_build_options.xml
index 233efef19b..326aab1a31 100644
--- a/indra/newview/skins/default/xui/it/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/it/floater_build_options.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="build options floater" title="GRID OPTIONS">
-	<spinner label="Grid Units (meters)" label_width="192" name="GridResolution" width="250"/>
+<floater name="build options floater" title="OPZIONI DELLA GRIGLIA">
+	<spinner label="Unità griglia (metri)" label_width="192" name="GridResolution" width="250"/>
 	<spinner label="Estensione della griglia (metri)" label_width="192" name="GridDrawSize" width="250"/>
-	<check_box label="Usa allineamento sub-unitario" name="GridSubUnit"/>
-	<check_box label="Guarda le cross-sections" name="GridCrossSection"/>
-	<text name="grid_opacity_label" tool_tip="Opacità della Grid">
+	<check_box label="Usa sottounità" name="GridSubUnit"/>
+	<check_box label="Guarda le sezioni trasversali" name="GridCrossSection"/>
+	<text name="grid_opacity_label" tool_tip="Opacità della griglia">
 		Opacità:
 	</text>
 	<slider label="Trasparenza della griglia" name="GridOpacity" width="250"/>
diff --git a/indra/newview/skins/default/xui/it/floater_buy_currency.xml b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
index 79b8836f3e..1327e8b172 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_currency.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="buy currency" title="COMPRA L$">
+<floater name="buy currency" title="ACQUISTA L$">
 	<floater.string name="buy_currency">
-		Compra L$ [LINDENS] per approx. [LOCALAMOUNT]
+		Acquista [LINDENS] L$ per circa [LOCALAMOUNT]
 	</floater.string>
 	<text font="SansSerifLarge" left="5" name="info_need_more" right="-5">
-		Necessiti di più  L$
+		Ti servono più L$
 	</text>
 	<text name="contacting">
 		Sto contattando il LindeX...
 	</text>
 	<text name="info_buying">
-		COMPRA L$
+		Acquista L$
 	</text>
 	<text name="balance_label">
 		Io ho
@@ -19,7 +19,7 @@
 		[AMT]L$
 	</text>
 	<text name="currency_action" width="45">
-		Io voglio comprare
+		Voglio acquistare
 	</text>
 	<text name="currency_label">
 		L$
@@ -31,10 +31,10 @@
 		Al prezzo
 	</text>
 	<text name="currency_est">
-		approx. [LOCALAMOUNT]
+		circa [LOCALAMOUNT]
 	</text>
 	<text name="getting_data">
-		Calcolando...
+		Stima in corso...
 	</text>
 	<text name="buy_action">
 		[ACTION]
@@ -49,15 +49,15 @@
 		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
 	</text>
 	<text name="exchange_rate_note">
-		Ri-scrivi un importo per vedere l&apos;ultimo rapporto di cambio.
+		Riscrivi l&apos;importo per vedere l&apos;ultimo tasso al cambio.
 	</text>
 	<text name="purchase_warning_repurchase">
-		Confermando questo acquisto di soli L$, non l&apos;oggetto.
+		La conferma di questo acquisto compra solo L$, non l&apos;oggetto.
 	</text>
 	<text bottom_delta="16" name="purchase_warning_notenough">
-		Non stai acquistando abbastanza L$. Per favore aumenta l&apos;importo.
+		Non stai acquistando abbastanza L$. Aumenta l&apos;importo.
 	</text>
-	<button label="Compra ora" name="buy_btn"/>
+	<button label="Acquista adesso" name="buy_btn"/>
 	<button label="Cancella" name="cancel_btn"/>
 	<text left="5" name="info_cannot_buy" right="-5">
 		Non in grado di acquistare
diff --git a/indra/newview/skins/default/xui/it/floater_customize.xml b/indra/newview/skins/default/xui/it/floater_customize.xml
index 1ace781a7e..75ddf43f65 100644
--- a/indra/newview/skins/default/xui/it/floater_customize.xml
+++ b/indra/newview/skins/default/xui/it/floater_customize.xml
@@ -459,7 +459,7 @@
 				[DESC]: non può essere modificato
 			</text>
 			<text name="title_loading">
-				[DESC]: caricando...
+				[DESC]: caricamento in corso...
 			</text>
 			<text name="title_not_worn">
 				[DESC]: non indossato
@@ -470,22 +470,22 @@
 			<text name="not worn instructions">
 				Metti un nuovo tatuaggio trascinandolo dal tuo inventario al avatar. Oppure, crea un nuovo tatuaggio e indossalo.
 			</text>
-			<button label="Crea Nuovo tatuaggio" label_selected="Crea un nuovo tatuaggio" name="Create New"/>
+			<button label="Crea un nuovo tatuaggio" label_selected="Crea un nuovo tatuaggio" name="Create New"/>
 			<text name="no modify instructions">
-				Non hai i permessi per moficare questa vestibilità.
+				Non hai i permessi per modificare questo capo.
 			</text>
 			<text name="Item Action Label">
 				Tatuaggio:
 			</text>
-			<texture_picker label="Tatuaggio della testa" name="Head Tattoo" tool_tip="Clicca per scegliere una foto"/>
+			<texture_picker label="Tatuaggio della testa" name="Head Tattoo" tool_tip="Clicca per scegliere una fotografia"/>
 			<texture_picker label="Tatuaggio superiore" name="Upper Tattoo" tool_tip="Clicca per scegliere una fotografia"/>
-			<texture_picker label="Tatuaggio inferiore" name="Lower Tattoo" tool_tip="Clicca per scegliere una fotografia"/>
+			<texture_picker label="Tattuaggio inferiore" name="Lower Tattoo" tool_tip="Clicca per scegliere una fotografia"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
 			<button label="Salva" label_selected="Salva" name="Save"/>
 			<button label="Salva con nome..." label_selected="Salva con nome..." name="Save As"/>
 			<button label="Ripristina" label_selected="Ripristina" name="Revert"/>
 		</panel>
-		<panel label="Alpha" name="Alpha">
+		<panel label="Alpha (Trasparenza)" name="Alpha">
 			<text name="title">
 				[DESC]
 			</text>
@@ -493,7 +493,7 @@
 				[DESC]: non può essere modificato
 			</text>
 			<text name="title_loading">
-				[DESC]: caricando...
+				[DESC]: caricamento in corso...
 			</text>
 			<text name="title_not_worn">
 				[DESC]: non indossato
@@ -504,18 +504,18 @@
 			<text name="not worn instructions">
 				Metti una nuova alpha mask trascinandola dal tuo inventario al tuo avatar. Oppure, crea un nuovo tatuaggio e indossalo.
 			</text>
-			<button label="Crea nuova alpha" label_selected="Crea nuova alpha" name="Create New"/>
+			<button label="Crea nuovo Alpha" label_selected="Crea nuovo Alpha" name="Create New"/>
 			<text name="no modify instructions">
-				Non hai i permessi per modificare questa vestibilità.
+				Non hai i permessi per modificare questo capo.
 			</text>
 			<text name="Item Action Label">
 				Alpha:
 			</text>
 			<texture_picker label="Alpha inferiore" name="Lower Alpha" tool_tip="Clicca per scegliere una fotografia"/>
-			<texture_picker label="Alpha superiore" name="Upper Alpha" tool_tip="Clicca per scegliere una foto"/>
+			<texture_picker label="Alpha superiore" name="Upper Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 			<texture_picker label="Alpha della testa" name="Head Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 			<texture_picker label="Alpha dell&apos;occhio" name="Eye Alpha" tool_tip="Clicca per scegliere una fotografia"/>
-			<texture_picker label="Alpha dei capelli" name="Hair Alpha" tool_tip="Clicca per scegiere una fotografia"/>
+			<texture_picker label="Alpha dei capelli" name="Hair Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 			<button label="Togli" label_selected="Togli" name="Take Off"/>
 			<button label="Salva" label_selected="Salva" name="Save"/>
 			<button label="Salva con nome..." label_selected="Salva con nome..." name="Save As"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preview_notecard.xml b/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
index 726152d147..70e28dde35 100644
--- a/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/it/floater_preview_notecard.xml
@@ -7,7 +7,7 @@
 		Non hai il permesso di leggere questo biglietto.
 	</floater.string>
 	<floater.string name="Title">
-		Notecard: [NAME]
+		Biglietto: [NAME]
 	</floater.string>
 	<floater.string label="Salva" label_selected="Salva" name="Save">
 		Salva
diff --git a/indra/newview/skins/default/xui/it/floater_settings_debug.xml b/indra/newview/skins/default/xui/it/floater_settings_debug.xml
index 3dc7ee010e..aab00a26ce 100644
--- a/indra/newview/skins/default/xui/it/floater_settings_debug.xml
+++ b/indra/newview/skins/default/xui/it/floater_settings_debug.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="settings_debug" title="DEBUG SETTINGS">
+<floater name="settings_debug" title="PARAMETRI DI DEBUG">
 	<radio_group name="boolean_combo">
 		<radio_item label="VERO" name="TRUE" value="vero"/>
 		<radio_item label="FALSO" name="FALSE" value=""/>
diff --git a/indra/newview/skins/default/xui/it/floater_whitelist_entry.xml b/indra/newview/skins/default/xui/it/floater_whitelist_entry.xml
index a8e07f73a4..9abc968b94 100644
--- a/indra/newview/skins/default/xui/it/floater_whitelist_entry.xml
+++ b/indra/newview/skins/default/xui/it/floater_whitelist_entry.xml
@@ -5,5 +5,5 @@
 	</text>
 	<line_editor name="whitelist_entry" tool_tip="Inserisci un URL o una configurazione URL alla lista bianca"/>
 	<button label="OK" name="ok_btn"/>
-	<button label="Cancella" name="cancel_btn"/>
+	<button label="Annulla" name="cancel_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/mime_types_linux.xml b/indra/newview/skins/default/xui/it/mime_types_linux.xml
index 5db3eddca8..3bc30b507a 100644
--- a/indra/newview/skins/default/xui/it/mime_types_linux.xml
+++ b/indra/newview/skins/default/xui/it/mime_types_linux.xml
@@ -2,24 +2,24 @@
 <mimetypes name="default">
 	<widgetset name="web">
 		<label name="web_label">
-			Contenuto del Web
+			Contenuti Web
 		</label>
 		<tooltip name="web_tooltip">
-			Questo luogo ha un contenuto Web
+			Questo luogo presenta contenuti Web
 		</tooltip>
 		<playtip name="web_playtip">
-			Mostra il contenuto Web
+			Mostra contenuti Web
 		</playtip>
 	</widgetset>
 	<widgetset name="movie">
 		<label name="movie_label">
-			Video
+			Filmato
 		</label>
 		<tooltip name="movie_tooltip">
-			Qui c&apos;è un video da riprodurre
+			C&apos;è un filmato da vedere qui
 		</tooltip>
 		<playtip name="movie_playtip">
-			Riproduci video
+			Riproduci il filmato
 		</playtip>
 	</widgetset>
 	<widgetset name="image">
@@ -27,10 +27,10 @@
 			Immagine
 		</label>
 		<tooltip name="image_tooltip">
-			C&apos;è un immagine in questo luogo
+			C&apos;è un&apos;immagine in questo luogo
 		</tooltip>
 		<playtip name="image_playtip">
-			Guarda l&apos;immagine di questo luogo
+			Vedi l&apos;immagine di questo luogo
 		</playtip>
 	</widgetset>
 	<widgetset name="audio">
@@ -38,25 +38,25 @@
 			Audio
 		</label>
 		<tooltip name="audio_tooltip">
-			In questo luogo c&apos;è l&apos;audio
+			C&apos;è un audio in questo luogo
 		</tooltip>
 		<playtip name="audio_playtip">
-			Riproduci l&apos;audio in questo luogo
+			Riproduci l&apos;audio di questo luogo
 		</playtip>
 	</widgetset>
 	<scheme name="rtsp">
 		<label name="rtsp_label">
-			Real Time Streaming
+			Streaming in tempo reale
 		</label>
 	</scheme>
 	<mimetype name="blank">
 		<label name="blank_label">
-			- Vuoto -
+			- Nessuno -
 		</label>
 	</mimetype>
 	<mimetype name="none/none">
 		<label name="none/none_label">
-			- Vuoto -
+			- Nessuno -
 		</label>
 	</mimetype>
 	<mimetype name="audio/*">
@@ -76,7 +76,7 @@
 	</mimetype>
 	<mimetype name="video/vnd.secondlife.qt.legacy">
 		<label name="vnd.secondlife.qt.legacy_label">
-			Video (QuickTime)
+			Filmato (QuickTime)
 		</label>
 	</mimetype>
 	<mimetype name="application/javascript">
@@ -116,7 +116,7 @@
 	</mimetype>
 	<mimetype name="application/x-director">
 		<label name="application/x-director_label">
-			Direttore Macromedia
+			Macromedia Director
 		</label>
 	</mimetype>
 	<mimetype name="audio/mid">
@@ -186,32 +186,32 @@
 	</mimetype>
 	<mimetype name="video/mpeg">
 		<label name="video/mpeg_label">
-			Video (MPEG)
+			Filmato (MPEG)
 		</label>
 	</mimetype>
 	<mimetype name="video/mp4">
 		<label name="video/mp4_label">
-			Video (MP4)
+			Filmato (MP4)
 		</label>
 	</mimetype>
 	<mimetype name="video/quicktime">
 		<label name="video/quicktime_label">
-			Video (QuickTime)
+			Filmato (QuickTime)
 		</label>
 	</mimetype>
 	<mimetype name="video/x-ms-asf">
 		<label name="video/x-ms-asf_label">
-			Video (Windows Media ASF)
+			Filmato (Windows Media ASF)
 		</label>
 	</mimetype>
 	<mimetype name="video/x-ms-wmv">
 		<label name="video/x-ms-wmv_label">
-			Video (Windows Media WMV)
+			Filmato (Windows Media WMV)
 		</label>
 	</mimetype>
 	<mimetype name="video/x-msvideo">
 		<label name="video/x-msvideo_label">
-			Video (AVI)
+			Filmato (AVI)
 		</label>
 	</mimetype>
 </mimetypes>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_alpha.xml b/indra/newview/skins/default/xui/it/panel_edit_alpha.xml
index 652bef0430..286ee626cf 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_alpha.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_alpha.xml
@@ -2,7 +2,7 @@
 <panel name="edit_alpha_panel">
 	<panel name="avatar_alpha_color_panel">
 		<texture_picker label="Alpha inferiore" name="Lower Alpha" tool_tip="Clicca per scegliere una fotografia"/>
-		<texture_picker label="Alpha superiore" name="Upper Alpha" tool_tip="Click to choose a picture"/>
+		<texture_picker label="Alpha superiore" name="Upper Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 		<texture_picker label="Alpha della testa" name="Head Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 		<texture_picker label="Alpha dell&apos;occhio" name="Eye Alpha" tool_tip="Clicca per scegliere una fotografia"/>
 		<texture_picker label="Alpha dei capelli" name="Hair Alpha" tool_tip="Clicca per scegliere una fotografia"/>
diff --git a/indra/newview/skins/default/xui/it/panel_edit_wearable.xml b/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
index baf585dad0..2583cf4e0e 100644
--- a/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/it/panel_edit_wearable.xml
@@ -1,55 +1,55 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Indossabile" name="panel_edit_wearable">
 	<string name="edit_shape_title">
-		Modifica la Shape
+		Modifica della figura corporea
 	</string>
 	<string name="edit_skin_title">
-		Modifica la Skin
+		Modifica della pelle
 	</string>
 	<string name="edit_hair_title">
-		Modifica capelli
+		Modifica dei capelli
 	</string>
 	<string name="edit_eyes_title">
-		Modifica occhi
+		Modifica degli occhi
 	</string>
 	<string name="edit_shirt_title">
-		Modifica camicia
+		Modifica della camicia
 	</string>
 	<string name="edit_pants_title">
-		Modifica pantaloni
+		Modifica dei pantaloni
 	</string>
 	<string name="edit_shoes_title">
-		Modifica scarpe
+		Modifica delle scarpe
 	</string>
 	<string name="edit_socks_title">
-		Modifica calze
+		Modifica delle calze
 	</string>
 	<string name="edit_jacket_title">
-		Modifica Giacca
+		Modifica della giacca
 	</string>
 	<string name="edit_skirt_title">
-		Modifica gonna
+		Modifica della gonna
 	</string>
 	<string name="edit_gloves_title">
-		Modifica guanti
+		Modifica dei guanti
 	</string>
 	<string name="edit_undershirt_title">
-		Modifica maglietta intima
+		Modifica della maglietta intima
 	</string>
 	<string name="edit_underpants_title">
-		Modifica slip
+		Modifica dello slip
 	</string>
 	<string name="edit_alpha_title">
-		Modifica Alpha Mask
+		Modifica di Alpha Mask
 	</string>
 	<string name="edit_tattoo_title">
-		Modifica tatuaggio
+		Modifica del tatuaggio
 	</string>
 	<string name="shape_desc_text">
-		Shape:
+		Figura corporea:
 	</string>
 	<string name="skin_desc_text">
-		Skin:
+		Pelle:
 	</string>
 	<string name="hair_desc_text">
 		Capelli:
@@ -90,9 +90,9 @@
 	<string name="tattoo_desc_text">
 		Tatuaggio:
 	</string>
-	<text name="edit_wearable_title" value="Modifica Shape"/>
+	<text name="edit_wearable_title" value="Modifica della figura corporea"/>
 	<panel label="Camicia" name="wearable_type_panel">
-		<text name="description_text" value="Shape:"/>
+		<text name="description_text" value="Figura corporea:"/>
 	</panel>
 	<panel name="button_panel">
 		<button label="Salva con nome" name="save_as_button"/>
diff --git a/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
index 67ec20ba18..6317d3192e 100644
--- a/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_nearby_chat_bar.xml
@@ -1,5 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="chat_bar">
+	<string name="min_width">
+		192
+	</string>
+	<string name="max_width">
+		320
+	</string>
 	<line_editor label="Clicca qui per la chat." name="chat_box" tool_tip="Premi Invio per parlare, Ctrl+Invio per gridare"/>
 	<button name="show_nearby_chat" tool_tip="Mostra/Nasconde il registro della chat nei dintorni"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_place_profile.xml b/indra/newview/skins/default/xui/it/panel_place_profile.xml
index fef262d2b9..9a38909d47 100644
--- a/indra/newview/skins/default/xui/it/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/it/panel_place_profile.xml
@@ -1,42 +1,42 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="place_profile">
-	<string name="on" value="On"/>
-	<string name="off" value="Off"/>
+	<string name="on" value="Attivo"/>
+	<string name="off" value="Disattivato"/>
 	<string name="anyone" value="Chiunque"/>
 	<string name="available" value="disponibile"/>
 	<string name="allocated" value="assegnato"/>
-	<string name="title_place" value="Profilo del luogo"/>
+	<string name="title_place" value="Profilo del posto"/>
 	<string name="title_teleport_history" value="Cronologia Teleport"/>
-	<string name="not_available" value="(N\D)"/>
+	<string name="not_available" value="(non pert.)"/>
 	<string name="unknown" value="(sconosciuto)"/>
-	<string name="public" value="(publico)"/>
+	<string name="public" value="(pubblico)"/>
 	<string name="none_text" value="(nessuno)"/>
-	<string name="sale_pending_text" value="(Vendita in attesa di)"/>
-	<string name="group_owned_text" value="(Gruppo posseduto)"/>
+	<string name="sale_pending_text" value="(In corso di vendita)"/>
+	<string name="group_owned_text" value="(Di proprietà di un gruppo)"/>
 	<string name="price_text" value="L$"/>
 	<string name="area_text" value="m²"/>
-	<string name="all_residents_text" value="Tutti i Residenti"/>
+	<string name="all_residents_text" value="Tutti i residenti"/>
 	<string name="group_text" value="Gruppo"/>
 	<string name="can_resell">
-		La terra acquistata in questa regione può essere rivenduta.
+		Il terreno acquistato in questa regione può essere rivenduto.
 	</string>
 	<string name="can_not_resell">
-		La terra acquistata in questa regione non può essere rivenduta.
+		Il terreno acquistato in questa regione non può essere rivenduto.
 	</string>
 	<string name="can_change">
-		La terra acquistata in questa regione può essere unita o suddivisa.
+		Il terreno acquistato in questa regione può essere unito o suddiviso.
 	</string>
 	<string name="can_not_change">
-		La terra acquistata in questa regione non può essere unita o suddivisa.
+		Il terreno acquistato in questa regione non può essere unito o suddiviso.
 	</string>
 	<string name="server_update_text">
-		Informazioni su questo luogo non disponibili senza l&apos;aggiornamento del server.
+		Informazioni sul luogo non disponibili senza l&apos;aggiornamento del server.
 	</string>
 	<string name="server_error_text">
-		Informazioni su questo luogo non sono disponibili ora, per favore riprova più tardi.
+		Informazioni su questo luogo non disponibili al momento, riprova più tardi.
 	</string>
 	<string name="server_forbidden_text">
-		Informazioni su questo luogo non sono disponibili a cause delle restrizioni sull&apos;accesso.  Per favore verifica i tuoi permessi con il proprietario del parcel.
+		Informazioni su questo luogo non disponibili a causa delle limitazioni di accesso.  Controlla i tuoi permessi con il proprietario del terreno.
 	</string>
 	<string name="acquired_date">
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
@@ -48,7 +48,7 @@
 			<text name="owner_label" value="Proprietario:"/>
 			<text name="maturity_value" value="sconosciuto"/>
 			<accordion name="advanced_info_accordion">
-				<accordion_tab name="parcel_characteristics_tab" title="Parcel">
+				<accordion_tab name="parcel_characteristics_tab" title="Lotto">
 					<panel name="parcel_characteristics_panel">
 						<text name="rating_label" value="Categoria:"/>
 						<text name="rating_value" value="sconosciuto"/>
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
index 1fc75b2857..d02a794219 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_graphics1.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Grafica" name="Display panel">
 	<text name="UI Size:">
-		misura UI:
+		Dimensioni UI:
 	</text>
 	<text name="QualitySpeed">
 		Qualità e velocità:
@@ -99,7 +99,7 @@
 		</radio_group>
 	</panel>
 	<button label="Applica" label_selected="Applica" name="Apply"/>
-	<button label="Resetta" left="110" name="Defaults" width="190"/>
-	<button label="Avanzato" name="Advanced"/>
+	<button label="Reimposta" left="110" name="Defaults" width="190"/>
+	<button label="Avanzate" name="Advanced"/>
 	<button label="Hardware" label_selected="Hardware" name="GraphicsHardwareButton"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/panel_status_bar.xml b/indra/newview/skins/default/xui/it/panel_status_bar.xml
index 5b5ca57759..584ac5e4b4 100644
--- a/indra/newview/skins/default/xui/it/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/it/panel_status_bar.xml
@@ -23,9 +23,9 @@
 	</panel.string>
 	<button label="" label_selected="" name="buycurrency" tool_tip="Il mio saldo"/>
 	<button label="Acquista" name="buyL" tool_tip="Clicca per comprare più L$"/>
-	<text name="TimeText" tool_tip="Ora attuale (Pacific)">
+	<text name="TimeText" tool_tip="Orario attuale (Pacifico)">
 		24:00, ora del Pacifico
 	</text>
 	<button name="media_toggle_btn" tool_tip="Attiva/ferma tutti i media (musica, video, pagine Web)"/>
-	<button name="volume_btn" tool_tip="Controllo del volume globale"/>
+	<button name="volume_btn" tool_tip="Regolazione del volume globale"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/it/role_actions.xml b/indra/newview/skins/default/xui/it/role_actions.xml
index e97a77723b..87f0602239 100644
--- a/indra/newview/skins/default/xui/it/role_actions.xml
+++ b/indra/newview/skins/default/xui/it/role_actions.xml
@@ -3,7 +3,7 @@
 	<action_set description="Queste abilità permettono di aggiungere e rimuovere Membri dal gruppo, e permettono ai nuovi membri di aderire al gruppo senza invito." name="Membership">
 		<action description="Invitare persone in questo Gruppo" longdescription="Invita persone in questo gruppo usando il pulsante Invita nella sezione Ruoli &gt; scheda membri." name="member invite"/>
 		<action description="Espellere Membri da questo Gruppo" longdescription="Espelli membri dal gruppo usando il pulsante Espelli nella sezione Ruoli &gt; scheda membri. Un proprietario può espellere chiunque tranne un altro proprietario. Se non sei un proprietario, un membro può essere espulso da un gruppo soltanto qualora abbia soltanto il ruolo Tutti, e nessun altro ruolo. Per rimuovere membri dai ruoli, devi avere l&apos;Abilità corrispondente." name="member eject"/>
-		<action description="Seleziona Iscrizione libera e modifica da Quota d&apos;iscrizione" longdescription="Seleziona Iscrizione libera per permettere ai nuovi membri di aderire senza invito e modifica la quota d&apos;iscrizione nella scheda Generale." name="member options"/>
+		<action description="Seleziona Iscrizione libera e modifica la Quota d&apos;iscrizione" longdescription="Seleziona Iscrizione libera per permettere ai nuovi membri di aderire senza invito e modifica la quota d&apos;iscrizione nella scheda Generale." name="member options"/>
 	</action_set>
 	<action_set description="Queste Abilità permettono di aggiungere, rimuovere, cambiare i Ruoli del Gruppo, aggiungere e rimuovere Membri dai Ruoli, e assegnare Abilità ai Ruoli." name="Roles">
 		<action description="Creare nuovi Ruoli" longdescription="Crea nuovi ruoli nella sezione Ruoli &gt; scheda ruoli." name="role create"/>
-- 
cgit v1.2.3


From 5ac0348131f273627fcbdca8d441b26087e6c11c Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 21:24:26 -0700
Subject: fix invalid xml

---
 indra/newview/skins/default/xui/pt/menu_inventory.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/pt/menu_inventory.xml b/indra/newview/skins/default/xui/pt/menu_inventory.xml
index 627072c32d..2691ac81b3 100644
--- a/indra/newview/skins/default/xui/pt/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pt/menu_inventory.xml
@@ -7,7 +7,7 @@
 	<menu_item_call label="Renomear" name="Task Rename"/>
 	<menu_item_call label="Apagar" name="Task Remove"/>
 	<menu_item_call label="Limpar lixeira" name="Empty Trash"/>
-	<menu_item_call label="Limpar Achados & perdidos" name="Empty Lost And Found"/>
+	<menu_item_call label="Limpar Achados &amp; perdidos" name="Empty Lost And Found"/>
 	<menu_item_call label="Nova pasta" name="New Folder"/>
 	<menu_item_call label="Novo script" name="New Script"/>
 	<menu_item_call label="Nova anotação" name="New Note"/>
-- 
cgit v1.2.3


From 4f766829f394cf14d29ca272b1e9c3e228ea36de Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 26 Mar 2010 21:41:33 -0700
Subject: PL CT global edit

---
 .../newview/skins/default/xui/pl/floater_about.xml |  14 +-
 .../skins/default/xui/pl/floater_about_land.xml    | 112 ++---
 .../default/xui/pl/floater_animation_preview.xml   |  20 +-
 .../skins/default/xui/pl/floater_auction.xml       |   6 +-
 .../default/xui/pl/floater_avatar_textures.xml     |  28 +-
 .../skins/default/xui/pl/floater_beacons.xml       |  16 +-
 .../skins/default/xui/pl/floater_build_options.xml |  10 +-
 .../skins/default/xui/pl/floater_bulk_perms.xml    |   4 +-
 .../skins/default/xui/pl/floater_buy_contents.xml  |   2 +-
 .../skins/default/xui/pl/floater_buy_currency.xml  |   6 +-
 .../skins/default/xui/pl/floater_buy_land.xml      |  10 +-
 .../skins/default/xui/pl/floater_camera.xml        |  12 +-
 .../skins/default/xui/pl/floater_choose_group.xml  |   2 +-
 .../skins/default/xui/pl/floater_color_picker.xml  |   4 +-
 .../skins/default/xui/pl/floater_customize.xml     |  70 +--
 .../default/xui/pl/floater_day_cycle_options.xml   |  10 +-
 .../skins/default/xui/pl/floater_env_settings.xml  |   8 +-
 .../newview/skins/default/xui/pl/floater_event.xml |   4 +-
 .../skins/default/xui/pl/floater_gesture.xml       |   6 +-
 .../skins/default/xui/pl/floater_god_tools.xml     |  32 +-
 .../default/xui/pl/floater_hardware_settings.xml   |  10 +-
 .../skins/default/xui/pl/floater_im_session.xml    |   2 +-
 .../skins/default/xui/pl/floater_image_preview.xml |  12 +-
 .../skins/default/xui/pl/floater_incoming_call.xml |   2 +-
 .../skins/default/xui/pl/floater_inspect.xml       |   2 +-
 .../skins/default/xui/pl/floater_inventory.xml     |   2 +-
 .../xui/pl/floater_inventory_view_finder.xml       |   2 +-
 .../skins/default/xui/pl/floater_joystick.xml      |  32 +-
 .../skins/default/xui/pl/floater_lagmeter.xml      |  22 +-
 .../skins/default/xui/pl/floater_lsl_guide.xml     |   2 +-
 .../skins/default/xui/pl/floater_media_browser.xml |   6 +-
 .../skins/default/xui/pl/floater_mem_leaking.xml   |   4 +-
 .../skins/default/xui/pl/floater_moveview.xml      |   6 +-
 .../skins/default/xui/pl/floater_openobject.xml    |   2 +-
 .../default/xui/pl/floater_outfit_save_as.xml      |   2 +-
 .../skins/default/xui/pl/floater_outgoing_call.xml |   8 +-
 .../skins/default/xui/pl/floater_perm_prefs.xml    |   2 +-
 .../skins/default/xui/pl/floater_post_process.xml  |  16 +-
 .../skins/default/xui/pl/floater_postcard.xml      |   2 +-
 .../default/xui/pl/floater_preview_animation.xml   |   4 +-
 .../skins/default/xui/pl/floater_preview_event.xml |   2 +-
 .../default/xui/pl/floater_preview_gesture.xml     |   6 +-
 .../xui/pl/floater_preview_gesture_info.xml        |   2 +-
 .../xui/pl/floater_preview_gesture_shortcut.xml    |   2 +-
 .../xui/pl/floater_preview_gesture_steps.xml       |   2 +-
 .../default/xui/pl/floater_preview_notecard.xml    |   2 +-
 .../skins/default/xui/pl/floater_preview_sound.xml |   2 +-
 .../default/xui/pl/floater_preview_texture.xml     |   4 +-
 .../skins/default/xui/pl/floater_region_info.xml   |   2 +-
 .../skins/default/xui/pl/floater_report_abuse.xml  |  60 +--
 .../skins/default/xui/pl/floater_script_queue.xml  |   2 +-
 .../skins/default/xui/pl/floater_script_search.xml |   4 +-
 .../skins/default/xui/pl/floater_sell_land.xml     |   2 +-
 .../skins/default/xui/pl/floater_snapshot.xml      |   4 +-
 .../skins/default/xui/pl/floater_sound_preview.xml |   2 +-
 .../newview/skins/default/xui/pl/floater_stats.xml |  54 +--
 .../skins/default/xui/pl/floater_telehub.xml       |   6 +-
 .../skins/default/xui/pl/floater_texture_ctrl.xml  |   6 +-
 .../newview/skins/default/xui/pl/floater_tools.xml |  44 +-
 .../skins/default/xui/pl/floater_top_objects.xml   |  20 +-
 .../default/xui/pl/floater_voice_controls.xml      |   2 +-
 .../newview/skins/default/xui/pl/floater_water.xml |  22 +-
 .../default/xui/pl/floater_wearable_save_as.xml    |   2 +-
 .../default/xui/pl/floater_windlight_options.xml   |  44 +-
 .../skins/default/xui/pl/floater_world_map.xml     |   4 +-
 .../skins/default/xui/pl/inspect_avatar.xml        |   4 +-
 .../newview/skins/default/xui/pl/inspect_group.xml |   4 +-
 .../skins/default/xui/pl/inspect_object.xml        |   4 +-
 .../skins/default/xui/pl/menu_attachment_self.xml  |   2 +-
 .../skins/default/xui/pl/menu_bottomtray.xml       |   4 +-
 .../skins/default/xui/pl/menu_favorites.xml        |   2 +-
 .../skins/default/xui/pl/menu_hide_navbar.xml      |   4 +-
 .../skins/default/xui/pl/menu_im_well_button.xml   |   2 +-
 .../skins/default/xui/pl/menu_imchiclet_adhoc.xml  |   2 +-
 .../skins/default/xui/pl/menu_imchiclet_group.xml  |   4 +-
 .../skins/default/xui/pl/menu_imchiclet_p2p.xml    |   4 +-
 .../default/xui/pl/menu_inspect_avatar_gear.xml    |   2 +-
 .../default/xui/pl/menu_inspect_object_gear.xml    |   4 +-
 .../skins/default/xui/pl/menu_inventory.xml        |  66 +--
 .../skins/default/xui/pl/menu_inventory_add.xml    |  46 +-
 .../default/xui/pl/menu_inventory_gear_default.xml |  18 +-
 indra/newview/skins/default/xui/pl/menu_land.xml   |   6 +-
 .../newview/skins/default/xui/pl/menu_landmark.xml |   2 +-
 indra/newview/skins/default/xui/pl/menu_login.xml  |  14 +-
 .../newview/skins/default/xui/pl/menu_mini_map.xml |   8 +-
 indra/newview/skins/default/xui/pl/menu_navbar.xml |   6 +-
 .../skins/default/xui/pl/menu_nearby_chat.xml      |  12 +-
 indra/newview/skins/default/xui/pl/menu_object.xml |   4 +-
 .../skins/default/xui/pl/menu_participant_list.xml |   4 +-
 .../xui/pl/menu_people_friends_view_sort.xml       |   8 +-
 .../xui/pl/menu_people_groups_view_sort.xml        |   4 +-
 .../skins/default/xui/pl/menu_people_nearby.xml    |   2 +-
 .../xui/pl/menu_people_nearby_view_sort.xml        |  10 +-
 .../xui/pl/menu_people_recent_view_sort.xml        |   8 +-
 .../skins/default/xui/pl/menu_picks_plus.xml       |   2 +-
 indra/newview/skins/default/xui/pl/menu_place.xml  |   4 +-
 .../skins/default/xui/pl/menu_place_add_button.xml |   4 +-
 .../default/xui/pl/menu_places_gear_folder.xml     |  10 +-
 .../default/xui/pl/menu_places_gear_landmark.xml   |  16 +-
 .../default/xui/pl/menu_teleport_history_item.xml  |   2 +-
 .../skins/default/xui/pl/menu_url_agent.xml        |   2 +-
 .../skins/default/xui/pl/menu_url_group.xml        |   4 +-
 .../newview/skins/default/xui/pl/menu_url_http.xml |   6 +-
 .../skins/default/xui/pl/menu_url_inventory.xml    |   4 +-
 .../newview/skins/default/xui/pl/menu_url_map.xml  |   4 +-
 .../skins/default/xui/pl/menu_url_objectim.xml     |   8 +-
 .../skins/default/xui/pl/menu_url_parcel.xml       |   4 +-
 .../skins/default/xui/pl/menu_url_slurl.xml        |   4 +-
 indra/newview/skins/default/xui/pl/menu_viewer.xml |   4 +-
 indra/newview/skins/default/xui/pl/mime_types.xml  |   6 +-
 .../skins/default/xui/pl/mime_types_linux.xml      |   6 +-
 .../skins/default/xui/pl/mime_types_mac.xml        |   6 +-
 .../newview/skins/default/xui/pl/notifications.xml |  52 +--
 .../skins/default/xui/pl/panel_audio_device.xml    |   2 +-
 .../skins/default/xui/pl/panel_bottomtray.xml      |   2 +-
 .../skins/default/xui/pl/panel_bottomtray_lite.xml |   2 +-
 .../skins/default/xui/pl/panel_edit_jacket.xml     |   4 +-
 .../skins/default/xui/pl/panel_edit_pick.xml       |   2 +-
 .../skins/default/xui/pl/panel_edit_profile.xml    |  10 +-
 .../skins/default/xui/pl/panel_edit_tattoo.xml     |   6 +-
 .../skins/default/xui/pl/panel_edit_wearable.xml   |  28 +-
 .../skins/default/xui/pl/panel_group_general.xml   |   6 +-
 .../default/xui/pl/panel_group_info_sidetray.xml   |   2 +-
 .../skins/default/xui/pl/panel_group_invite.xml    |   2 +-
 .../skins/default/xui/pl/panel_group_notices.xml   |   6 +-
 .../skins/default/xui/pl/panel_landmarks.xml       |   2 +-
 .../skins/default/xui/pl/panel_main_inventory.xml  |  56 +--
 .../xui/pl/panel_media_settings_permissions.xml    |   6 +-
 .../xui/pl/panel_media_settings_security.xml       |   2 +-
 .../skins/default/xui/pl/panel_my_profile.xml      |   4 +-
 .../skins/default/xui/pl/panel_navigation_bar.xml  |   4 +-
 .../skins/default/xui/pl/panel_nearby_media.xml    |   6 +-
 .../pl/panel_outfits_inventory_gear_default.xml    |   6 +-
 .../newview/skins/default/xui/pl/panel_people.xml  |  12 +-
 .../skins/default/xui/pl/panel_pick_info.xml       |   6 +-
 .../skins/default/xui/pl/panel_place_profile.xml   |   2 +-
 .../default/xui/pl/panel_preferences_alerts.xml    |   2 +-
 .../default/xui/pl/panel_preferences_chat.xml      |   2 +-
 .../default/xui/pl/panel_preferences_graphics1.xml |  28 +-
 .../default/xui/pl/panel_preferences_sound.xml     |   4 +-
 .../skins/default/xui/pl/panel_region_covenant.xml |   4 +-
 .../skins/default/xui/pl/panel_region_debug.xml    |  14 +-
 .../skins/default/xui/pl/panel_region_estate.xml   |  12 +-
 .../skins/default/xui/pl/panel_region_general.xml  |  26 +-
 .../default/xui/pl/panel_region_general_layout.xml |  26 +-
 .../skins/default/xui/pl/panel_region_terrain.xml  |  12 +-
 .../xui/pl/panel_script_limits_my_avatar.xml       |   2 +-
 .../xui/pl/panel_script_limits_region_memory.xml   |   2 +-
 .../default/xui/pl/panel_stand_stop_flying.xml     |   2 +-
 .../skins/default/xui/pl/panel_status_bar.xml      |   2 +-
 .../skins/default/xui/pl/panel_world_map.xml       |   2 +-
 .../skins/default/xui/pl/sidepanel_item_info.xml   |   2 +-
 indra/newview/skins/default/xui/pl/strings.xml     | 476 ++++++++++-----------
 153 files changed, 1011 insertions(+), 1011 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/pl/floater_about.xml b/indra/newview/skins/default/xui/pl/floater_about.xml
index 93a87b8cbc..b49247c4bf 100644
--- a/indra/newview/skins/default/xui/pl/floater_about.xml
+++ b/indra/newview/skins/default/xui/pl/floater_about.xml
@@ -16,18 +16,18 @@
 		Procesor: [CPU]
 Pamięć: [MEMORY_MB] MB
 Wersja OS: [OS_VERSION]
-Graphics Card Vendor: [GRAPHICS_CARD_VENDOR]
-Karta Graficzna: [GRAPHICS_CARD]
+Sprzedawca karty graficznej: [GRAPHICS_CARD_VENDOR]
+Karta graficzna: [GRAPHICS_CARD]
 	</floater.string>
 	<floater.string name="AboutDriver">
-		Windows Sterownik Karty Graficznej: [GRAPHICS_DRIVER_VERSION]
+		Windows Sterownik karty graficznej: [GRAPHICS_DRIVER_VERSION]
 	</floater.string>
 	<floater.string name="AboutLibs">
 		Wersja OpenGL: [OPENGL_VERSION]
 
 Wersja libcurl: [LIBCURL_VERSION]
-Wersja Dekodera J2C: [J2C_VERSION]
-Wersja Sterownika Audio: [AUDIO_DRIVER_VERSION]
+Wersja dekodera J2C: [J2C_VERSION]
+Wersja sterownika audio: [AUDIO_DRIVER_VERSION]
 Wersja Qt Webkit: [QT_WEBKIT_VERSION]
 Wersja Vivox: [VIVOX_VERSION]
 	</floater.string>
@@ -35,11 +35,11 @@ Wersja Vivox: [VIVOX_VERSION]
 		(żadne)
 	</floater.string>
 	<floater.string name="AboutTraffic">
-		Stracone Pakiety: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)
+		Stracone pakiety: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number,1]%)
 	</floater.string>
 	<tab_container name="about_tab">
 		<panel label="Info" name="support_panel">
-			<button label="Kopiuj do Schowka" name="copy_btn"/>
+			<button label="Kopiuj do schowka" name="copy_btn"/>
 		</panel>
 		<panel label="Podziękowania" name="credits_panel">
 			<text_editor name="credits_editor">
diff --git a/indra/newview/skins/default/xui/pl/floater_about_land.xml b/indra/newview/skins/default/xui/pl/floater_about_land.xml
index 6f5cc18104..e4908deb07 100644
--- a/indra/newview/skins/default/xui/pl/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/pl/floater_about_land.xml
@@ -24,7 +24,7 @@
 	<tab_container name="landtab">
 		<panel label="OGÓLNE" name="land_general_panel">
 			<panel.string name="new users only">
-				Tylko Nowi Rezydenci
+				Tylko nowi Rezydenci
 			</panel.string>
 			<panel.string name="anyone">
 				Każdy
@@ -39,7 +39,7 @@
 				Numer aukcji: [ID]
 			</panel.string>
 			<panel.string name="need_tier_to_modify">
-				Musisz zaakceptować zakup by móc modyfikować posiadłość.
+				Musisz zaakceptować zakup by móc modyfikować Posiadłość.
 			</panel.string>
 			<panel.string name="group_owned_text">
 				(Własność Grupy)
@@ -57,7 +57,7 @@
 				(brak)
 			</panel.string>
 			<panel.string name="sale_pending_text">
-				(Sprzedaż w Toku Realizacji)
+				(Sprzedaż w toku realizacji)
 			</panel.string>
 			<panel.string name="no_selection_text">
 				Posiadłość nie wybrana.
@@ -94,9 +94,9 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				Leyla Linden
 			</text>
 			<button label="Ustaw" name="Set..."/>
-			<check_box label="Udostępnij przypisywanie na grupę" name="check deed" tool_tip="Oficer grupy ma prawo przepisać prawo własności posiadłości na grupę. Posiadłość wspierana jest przez przydziały pochodzące od członków grupy."/>
-			<button label="Przypisz" name="Deed..." tool_tip="Prawo przypisania posiadłości na grupę może dokonać jedynie oficer grupy."/>
-			<check_box label="Właścicel dokonuje wpłat związanych z posiadłością" name="check contrib" tool_tip="Kiedy posiadłość zostaje przypisana na grupę, poprzedni właściciel realizuje wpłaty z nią związane w celu jej utrzymania."/>
+			<check_box label="Udostępnij przypisywanie na Grupę" name="check deed" tool_tip="Oficer Grupy ma prawo przepisać prawo własności Posiadłości na Grupę. Posiadłość wspierana jest przez przydziały pochodzące od członków Grupy."/>
+			<button label="Przypisz" name="Deed..." tool_tip="Prawo przypisania Posiadłości na Grupę może dokonać jedynie oficer Grupy."/>
+			<check_box label="Właścicel dokonuje wpłat związanych z Posiadłością" name="check contrib" tool_tip="Kiedy Posiadłość zostaje przypisana na Grupę, poprzedni Właściciel realizuje wpłaty z nią związane w celu jej utrzymania."/>
 			<text name="For Sale:">
 				Na Sprzedaż:
 			</text>
@@ -104,9 +104,9 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				Nie
 			</text>
 			<text name="For Sale: Price L$[PRICE].">
-				Cena: L$[PRICE] (L$[PRICE_PER_SQM]/m²).
+				Cena: [PRICE]L$ ([PRICE_PER_SQM]L$/m²).
 			</text>
-			<button label="Sprzedaj Posiadłość" name="Sell Land..."/>
+			<button label="Sprzedaj posiadłość" name="Sell Land..."/>
 			<text name="For sale to">
 				Na sprzedaż dla: [BUYER]
 			</text>
@@ -116,7 +116,7 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 			<text name="Selling with no objects in parcel.">
 				Obiekty nie są zawarte w sprzedaży.
 			</text>
-			<button label="Anuluj Sprzedaż" label_selected="Anuluj Sprzedaż" name="Cancel Land Sale"/>
+			<button label="Anuluj sprzedaż" label_selected="Anuluj sprzedaż" name="Cancel Land Sale"/>
 			<text name="Claimed:">
 				Data:
 			</text>
@@ -139,22 +139,22 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 			<button label="Skrypt" name="Scripts..."/>
 			<button label="Kup dla Grupy" name="Buy For Group..."/>
 			<button label="Kup Przepustkę..." label_selected="Kup Przeputkę..." left="130" name="Buy Pass..." tool_tip="Przepustka udostępnia tymczasowy wstęp na posiadłość." width="125"/>
-			<button label="Porzuć z Posiadłości" name="Abandon Land..."/>
+			<button label="Porzuć Posiadłość" name="Abandon Land..."/>
 			<button label="Odzyskaj Posiadłość" name="Reclaim Land..."/>
-			<button label="Sprzedaż przez Lindenów" name="Linden Sale..." tool_tip="Posiadłość musi mieć właściciela, zawartość oraz nie może być wystawiona na aukcę."/>
+			<button label="Sprzedaż przez Lindenów" name="Linden Sale..." tool_tip="Posiadłość musi mieć Właściciela, zawartość oraz nie może być wystawiona na Aukcję."/>
 		</panel>
 		<panel label="UMOWA" name="land_covenant_panel">
 			<panel.string name="can_resell">
-				Posiadłość zakupiona w tym regionie może być odsprzedana.
+				Posiadłość zakupiona w tym Regionie może być odsprzedana.
 			</panel.string>
 			<panel.string name="can_not_resell">
-				Posiadłość zakupiona w tym regionie nie może być odsprzedana.
+				Posiadłość zakupiona w tym Regionie nie może być odsprzedana.
 			</panel.string>
 			<panel.string name="can_change">
-				Posiadłość zakupiona w tym regionie może być łączona/dzielona.
+				Posiadłość zakupiona w tym Regionie może być łączona/dzielona.
 			</panel.string>
 			<panel.string name="can_not_change">
-				Posiadłość zakupiona w tym regionie nie może być
+				Posiadłość zakupiona w tym Regionie nie może być
 łączona/dzielona.
 			</panel.string>
 			<text name="estate_section_lbl">
@@ -197,13 +197,13 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				Odsprzedaj:
 			</text>
 			<text left="115" name="resellable_clause" width="338">
-				Posiadłość zakupiona w tym regionie nie może być odsprzedana.
+				Posiadłość zakupiona w tym Regionie nie może być odsprzedana.
 			</text>
 			<text name="changeable_lbl">
 				Podziel:
 			</text>
 			<text left="115" name="changeable_clause" width="338">
-				Posiadłość zakupiona w tym regionie nie może być
+				Posiadłość zakupiona w tym Regionie nie może być
 łączona/dzielona.
 			</text>
 		</panel>
@@ -215,7 +215,7 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				[COUNT] z [MAX] ([DELETED] zostanie usunięte)
 			</panel.string>
 			<text name="parcel_object_bonus">
-				Ilość Ekstra Obiektów: [BONUS]
+				Ilość ekstra obiektów: [BONUS]
 			</text>
 			<text name="Simulator primitive usage:">
 				Ilość używanych primów:
@@ -230,19 +230,19 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				[COUNT]
 			</text>
 			<text name="Primitives on parcel:">
-				Primy na posiadłości:
+				Primy na Posiadłości:
 			</text>
 			<text name="total_objects_text">
 				[COUNT]
 			</text>
 			<text name="Owned by parcel owner:">
-				Właściciela posiadłości:
+				Właściciela Posiadłości:
 			</text>
 			<text name="owner_objects_text">
 				[COUNT]
 			</text>
 			<button label="Pokaż" label_selected="Pokaż" name="ShowOwner"/>
-			<button label="Zwróć" name="ReturnOwner..." tool_tip="Zwróć obiekty do ich właścicieli."/>
+			<button label="Zwróć" name="ReturnOwner..." tool_tip="Zwróć obiekty do ich Właścicieli."/>
 			<text name="Set to group:">
 				Grupy:
 			</text>
@@ -250,7 +250,7 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				[COUNT]
 			</text>
 			<button label="Pokaż" label_selected="Pokaż" name="ShowGroup"/>
-			<button label="Zwróć" name="ReturnGroup..." tool_tip="Zwróć obiekty do ich właścicieli.."/>
+			<button label="Zwróć" name="ReturnGroup..." tool_tip="Zwróć obiekty do ich Właścicieli.."/>
 			<text name="Owned by others:">
 				Innych Rezydentów:
 			</text>
@@ -258,7 +258,7 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				[COUNT]
 			</text>
 			<button label="Pokaż" label_selected="Pokaż" name="ShowOther"/>
-			<button label="Zwróć" name="ReturnOther..." tool_tip="Zwróć obiekty do ich właścicieli."/>
+			<button label="Zwróć" name="ReturnOther..." tool_tip="Zwróć obiekty do ich Właścicieli."/>
 			<text name="Selected / sat upon:">
 				Wybranych:
 			</text>
@@ -269,9 +269,9 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 				Zwracaj obiekty innych Rezydentów (minut, 0 = wyłącz):
 			</text>
 			<text name="Object Owners:" width="108">
-				Właściciel Obiektów:
+				Właściciel obiektów:
 			</text>
-			<button label="Odśwież Listę" label_selected="Odśwież Listę" left="112" name="Refresh List" tool_tip="Refresh Object List"/>
+			<button label="Odśwież listę" label_selected="Odśwież listę" left="112" name="Refresh List" tool_tip="Refresh Object List"/>
 			<button label="Zwróć obiekty..." label_selected="Zwróć obiekty..." left="224" name="Return objects..."/>
 			<name_list name="owner list">
 				<name_list.columns label="Typ" name="type"/>
@@ -283,14 +283,14 @@ Idź do Świat &gt; O Posiadłości albo wybierz inną posiadłość żeby pokaz
 		</panel>
 		<panel label="OPCJE" name="land_options_panel">
 			<panel.string name="search_enabled_tooltip">
-				Udostępnij wyświetlanie tej posiadłości w wyszukiwarce
+				Udostępnij wyświetlanie tej Posiadłości w wyszukiwarce
 			</panel.string>
 			<panel.string name="search_disabled_small_tooltip">
-				Wybrana opcja jest wyłączona ze względu iż wielkość posiadłości wynosi 128 m² bądź mniej.
+				Wybrana opcja jest wyłączona, ponieważ wielkość Posiadłości wynosi 128 m² bądź mniej.
 Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 			</panel.string>
 			<panel.string name="search_disabled_permissions_tooltip">
-				Wybrana opcja jest wyłączona ponieważ nie posiadasz prawa do modyfikacji posiadłości.
+				Wybrana opcja jest wyłączona ponieważ nie posiadasz prawa do modyfikacji Posiadłości.
 			</panel.string>
 			<panel.string name="mature_check_mature">
 				Treść &apos;Mature&apos;
@@ -299,10 +299,10 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 				Treść &apos;Adult&apos;
 			</panel.string>
 			<panel.string name="mature_check_mature_tooltip">
-				Twoja posiadłość bądź treść jaką zawiera klasyfikowana jest jako &apos;Mature&apos;.
+				Twoja Posiadłość bądź treść jaką zawiera klasyfikowana jest jako &apos;Mature&apos;.
 			</panel.string>
 			<panel.string name="mature_check_adult_tooltip">
-				Informacje o Twojej posiadłości i treści jaką zawiera klasyfikowane są jako &apos;Adult&apos;.
+				Informacje o Twojej Posiadłości i treści jaką zawiera klasyfikowane są jako &apos;Adult&apos;.
 			</panel.string>
 			<panel.string name="landing_point_none">
 				(brak)
@@ -316,8 +316,8 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 			<text name="allow_label">
 				Udostępnij innym Rezydentom:
 			</text>
-			<check_box label="Edytowanie Terenu" name="edit land check" tool_tip="Wybrana - każdy może kształtować Twój teren. Najlepiej jest zostawić tą opcję nie wybraną, Ty zawsze możesz kształtowć Twój teren."/>
-			<check_box label="Latanie" name="check fly" tool_tip="Wybrana - Rezydenci mogą latać na Twojej posiadłości. Nie wybrana - mogą tylko wlatywać do lub latać ponad Twoją posiadłością."/>
+			<check_box label="Edytowanie Terenu" name="edit land check" tool_tip="Wybrana - każdy może kształtować Twój teren. Najlepiej jest zostawić tą opcję nie wybraną, Ty zawsze możesz kształtować Twój teren."/>
+			<check_box label="Latanie" name="check fly" tool_tip="Wybrana - Rezydenci mogą latać na Twojej Posiadłości. Nie jest wybrana - mogą tylko wlatywać do lub latać ponad Twoją Posiadłością."/>
 			<text name="allow_label2">
 				Budowanie:
 			</text>
@@ -336,34 +336,34 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 			<text name="land_options_label">
 				Opcje Posiadłości:
 			</text>
-			<check_box label="Bezpieczna (brak zniszczeń)" name="check safe" tool_tip="Wybrana - posiadłość jest bezpieczna - zniszczenia w walce są zablokowane. Nie wybrana - zniszczenia w walce są włączone."/>
-			<check_box label="Popychanie niedozwolone" name="PushRestrictCheck" tool_tip="Nie pozwalaj skryptom na popychanie. Wybranie tej opcji może być przydatne do ograniczenia zakłóceń spokoju w Twojej posiadłości."/>
-			<check_box label="Wyświetlaj w wyszukiwarce (30L$/tyg.)" name="ShowDirectoryCheck" tool_tip="Udostępnij ukazywanie się nazwy posiadłości w wyszukiwarce"/>
+			<check_box label="Bezpieczna (brak zniszczeń)" name="check safe" tool_tip="Wybrana - Posiadłość jest bezpieczna - zniszczenia w walce są zablokowane. Nie jest wybrana - zniszczenia w walce są włączone."/>
+			<check_box label="Popychanie niedozwolone" name="PushRestrictCheck" tool_tip="Nie pozwalaj skryptom na popychanie. Wybranie tej opcji może być przydatne do ograniczenia zakłóceń spokoju w Twojej Posiadłości."/>
+			<check_box label="Wyświetlaj w wyszukiwarce (30L$/tyg.)" name="ShowDirectoryCheck" tool_tip="Udostępnij ukazywanie się nazwy Posiadłości w wyszukiwarce"/>
 			<combo_box name="land category with adult">
-				<combo_box.item label="Każda Kategoria" name="item0"/>
-				<combo_box.item label="Linden Lokacja" name="item1"/>
+				<combo_box.item label="Każda kategoria" name="item0"/>
+				<combo_box.item label="Linden Lokalizacja" name="item1"/>
 				<combo_box.item label="&apos;Adult&apos;" name="item2"/>
-				<combo_box.item label="Sztuka i Kultura" name="item3"/>
+				<combo_box.item label="Sztuka i kultura" name="item3"/>
 				<combo_box.item label="Biznes" name="item4"/>
 				<combo_box.item label="Edukacyjna" name="item5"/>
 				<combo_box.item label="Gra" name="item6"/>
 				<combo_box.item label="Poznawanie ludzi" name="item7"/>
 				<combo_box.item label="Przyjazne dla nowych" name="item8"/>
-				<combo_box.item label="Park i Natura" name="item9"/>
+				<combo_box.item label="Park i natura" name="item9"/>
 				<combo_box.item label="Mieszkalna" name="item10"/>
 				<combo_box.item label="Zakupy" name="item11"/>
 				<combo_box.item label="Inna" name="item12"/>
 			</combo_box>
 			<combo_box name="land category">
-				<combo_box.item label="Każda Kategoria" name="item0"/>
-				<combo_box.item label="Linden Lokacja" name="item1"/>
-				<combo_box.item label="Sztuka i Kultura" name="item3"/>
+				<combo_box.item label="Każda kategoria" name="item0"/>
+				<combo_box.item label="Linden Lokalizacja" name="item1"/>
+				<combo_box.item label="Sztuka i kultura" name="item3"/>
 				<combo_box.item label="Biznes" name="item4"/>
 				<combo_box.item label="Edukacyjna" name="item5"/>
 				<combo_box.item label="Gra" name="item6"/>
 				<combo_box.item label="Poznawanie ludzi" name="item7"/>
 				<combo_box.item label="Przyjazna dla nowych" name="item8"/>
-				<combo_box.item label="Parki i Natura" name="item9"/>
+				<combo_box.item label="Parki i natura" name="item9"/>
 				<combo_box.item label="Mieszkalna" name="item10"/>
 				<combo_box.item label="Zakupy" name="item11"/>
 				<combo_box.item label="Inna" name="item12"/>
@@ -379,9 +379,9 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 			<button label="Ustaw" label_selected="Ustaw" name="Set" tool_tip="Ustal miejsce lądowania dla przybywających gości. Używa położenia Twojego awatara na tej posiadłości."/>
 			<button label="Nowy" label_selected="Nowy" name="Clear" tool_tip="Clear the landing point."/>
 			<text name="Teleport Routing: ">
-				Trasa Teleportacji:
+				Trasa teleportacji:
 			</text>
-			<combo_box name="landing type" tool_tip="Trasa Teleportacj-ustaw w jaki sposób będzie sę odbywać proces telportacji w posiadłości.">
+			<combo_box name="landing type" tool_tip="Trasa teleportacj-ustaw w jaki sposób będzie sę odbywać proces telportacji w Posiadłości.">
 				<combo_box.item label="Zablokowana" name="Blocked"/>
 				<combo_box.item label="Punkt Lądowania" name="LandingPoint"/>
 				<combo_box.item label="Gdziekolwiek" name="Anywhere"/>
@@ -389,14 +389,14 @@ Jedynie większe posiadłości mogą być umieszczone w bazie wyszukiwarki.
 		</panel>
 		<panel label="MEDIA" name="land_media_panel">
 			<text name="with media:">
-				Typ Mediów:
+				Typ mediów:
 			</text>
 			<combo_box name="media type" tool_tip=""/>
 			<text name="at URL:">
-				URL Mediów:
+				URL mediów:
 			</text>
 			<button label="Ustaw" name="set_media_url"/>
-			<check_box label="Ukryj URL Mediów" name="hide_media_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów wszystkim nieautoryzowanym użytkownikom. Nie dotyczy to jednak typów HTML."/>
+			<check_box label="Ukryj URL mediów" name="hide_media_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów wszystkim nieautoryzowanym Użytkownikom. Nie dotyczy to jednak typów HTML."/>
 			<text name="Description:">
 				Opis:
 			</text>
@@ -425,9 +425,9 @@ Mediów:
 			<check_box label="Powtórka Odtwarzania" name="media_loop" tool_tip="Odtwarzaj media z powtórką. Po wyświetleniu materialu, rozpocznie się odtwarzanie od początku."/>
 		</panel>
 		<panel label="DŹWIĘK" name="land_audio_panel">
-			<check_box label="Ukryj URL Muzyki" name="hide_music_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów muzycznych w posiadłości wszystkim nieautoryzowanym użytkownikom"/>
-			<check_box label="Rozmowy Dozwolone" name="parcel_enable_voice_channel"/>
-			<check_box label="Rozmowy Dozwolone (ustawione przez Majątek)" name="parcel_enable_voice_channel_is_estate_disabled"/>
+			<check_box label="Ukryj URL muzyki" name="hide_music_url" tool_tip="Wybranie tej opcji, zablokuje widok adresu do medów muzycznych w posiadłości wszystkim nieautoryzowanym Użytkownikom"/>
+			<check_box label="Rozmowy dozwolone" name="parcel_enable_voice_channel"/>
+			<check_box label="Rozmowy dozwolone (ustawione przez Majątek)" name="parcel_enable_voice_channel_is_estate_disabled"/>
 			<check_box label="Ogranicz komunikację głosową w tej posiadłości." name="parcel_enable_voice_channel_local"/>
 		</panel>
 		<panel label="DOSTĘP" name="land_access_panel">
@@ -438,19 +438,19 @@ Mediów:
 				Udostępnij dostęp publiczny ([MATURITY])
 			</panel.string>
 			<panel.string name="estate_override">
-				Jedna lub więcej z tych opcji ustawiona jest z poziomu posiadłości
+				Jedna lub więcej z tych opcji ustawiona jest z poziomu Posiadłości
 			</panel.string>
 			<text name="Limit access to this parcel to:">
-				Dostęp do tej posiadłości:
+				Dostęp do tej Posiadłości:
 			</text>
 			<check_box label="Publiczny [MATURITY]" name="public_access"/>
 			<text name="Only Allow">
 				Zablokuj dostęp dla:
 			</text>
 			<check_box label="Rezydentów zarejestrowanych w systemie płatniczym Linden Lab [ESTATE_PAYMENT_LIMIT]" name="limit_payment" tool_tip="Zbanuj Rezydentów niezarejestrowanych w systemie płatniczym z Linden Lab."/>
-			<check_box label="Weryfikacja Wieku: [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Zbanuj Rezydetów bez weryfikacji wieku. Odwiedź support.secondlife.com po więcej informacji."/>
-			<check_box label="Udostępnij wejście grupie: [GROUP]" name="GroupCheck" tool_tip="Ustaw grupę w głównej zakładce"/>
-			<check_box label="Sprzedaj wejściówki:" name="PassCheck" tool_tip="Otwórz tymczasowy dostęp do tej posiadłości"/>
+			<check_box label="Weryfikacja Wieku: [ESTATE_AGE_LIMIT]" name="limit_age_verified" tool_tip="Zbanuj Rezydetów bez Weryfikacji Wieku. Odwiedź support.secondlife.com po więcej informacji."/>
+			<check_box label="Udostępnij wejście Grupie: [GROUP]" name="GroupCheck" tool_tip="Ustaw Grupę w głównej zakładce"/>
+			<check_box label="Sprzedaj przepustki:" name="PassCheck" tool_tip="Otwórz tymczasowy dostęp do tej Posiadłości"/>
 			<combo_box name="pass_combo">
 				<combo_box.item label="Każdemu" name="Anyone"/>
 				<combo_box.item label="Grupie" name="Group"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_animation_preview.xml b/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
index b8eea31e29..ca06665c65 100644
--- a/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_animation_preview.xml
@@ -9,7 +9,7 @@
 Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 	</floater.string>
 	<floater.string name="failed_file_read">
-		Niemożliwość odczytania pliku animacji do wyświetlenia.
+		Brak możliwości odczytania plików animacji do wyświetlenia.
 
 [STATUS]
 	</floater.string>
@@ -62,25 +62,25 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 		Nie można odczytać wartości obrotu.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_FILE">
-		Niemożliwość otworzenia pliku tłumaczenia.
+		Nie można otworzyć pliku tłumaczenia.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_HEADER">
-		Niemożliwość przeczytania tłumaczenia nagłówka.
+		Nie można przeczytać tłumaczenia nagłówka.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_NAME">
-		Niemożliwość przeczytania nazw tłumaczenia.
+		Nie można przetłumaczyć nazw.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_IGNORE">
-		Niemożliwość przeczytania tłumaczenia dla wartości ignorowania.
+		Nie można przeczytać tłumaczenia dla wartości ignorowania.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_RELATIVE">
-		Niemożliwość przeczytania tłumaczenia wartości relatywnej.
+		Nie można przeczytać tłumaczenia wartości relatywnej.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_OUTNAME">
-		Niemożliwość przeczytania nazw wartości tłumaczenia.
+		Nie można przeczytać nazw wartości tłumaczenia.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_MATRIX">
-		Niemożliwość przeczytania tłumaczenia pola.
+		Nie można przeczytać tłumaczenia pola.
 	</floater.string>
 	<floater.string name="E_ST_NO_XLT_MERGECHILD">
 		Brak otrzymania nazwy dla mergechild.
@@ -115,7 +115,7 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 	<text name="description_label">
 		Opis:
 	</text>
-	<spinner label="Pierwszeństwo" name="priority" tool_tip="Kontroluj,animacje,które mogą zostać zdominowane przez tą animację"/>
+	<spinner label="Pierwszeństwo" name="priority" tool_tip="Kontroluj animacje,które mogą zostać zdominowane przez tą animację"/>
 	<check_box label="Powtarzaj" name="loop_check" tool_tip="Powtarzaj tą animację"/>
 	<spinner label="Od(%)" name="loop_in_point" tool_tip="Wybierz punkt, od którego chcesz zacząć powtarzać animację"/>
 	<spinner label="Do(%)" name="loop_out_point" tool_tip="Wybierz punkt, od którego chcesz zakończyć powtarzanie animacji"/>
@@ -182,6 +182,6 @@ Maksymalna długość pliku animacji wynosi [MAX_LENGTH] sekund.
 
 Doradzamy eksport plików BVH z Poser 4.
 	</text>
-	<button label="Załaduj (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Załaduj ([AMOUNT]L$)" name="ok_btn"/>
 	<button label="Anuluj" name="cancel_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_auction.xml b/indra/newview/skins/default/xui/pl/floater_auction.xml
index 815c36606c..9399fa1115 100644
--- a/indra/newview/skins/default/xui/pl/floater_auction.xml
+++ b/indra/newview/skins/default/xui/pl/floater_auction.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_auction" title="ROZPOCZNIJ SPRZEDAŻ POSIADŁOŚCI LINDENÓW">
 	<floater.string name="already for sale">
-		Nie możesz umieścić posiadłości na aukcji, jeżeli już została wystawiona na sprzedaż.
+		Nie możesz umieścić Posiadłości na Aukcji, jeżeli już została wystawiona na sprzedaż.
 	</floater.string>
 	<check_box initial_value="true" label="Zawierając żółte ogrodzenie" name="fence_check"/>
 	<button label="Zdjęce" label_selected="Zdjęce" name="snapshot_btn"/>
-	<button label="Sprzedaj Każdemu" label_selected="Sprzedaj Każdemu" name="sell_to_anyone_btn"/>
-	<button label="Wyczyść Ustawienia" label_selected="Wyczyść Ustawienia" name="reset_parcel_btn"/>
+	<button label="Sprzedaj każdemu" label_selected="Sprzedaj Każdemu" name="sell_to_anyone_btn"/>
+	<button label="Wyczyść ustawienia" label_selected="Wyczyść ustawienia" name="reset_parcel_btn"/>
 	<button label="Rozpocznij Aukcję" label_selected="Rozpocznij Aukcję" name="start_auction_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml b/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
index b42464d212..11651ad7e8 100644
--- a/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
+++ b/indra/newview/skins/default/xui/pl/floater_avatar_textures.xml
@@ -4,38 +4,38 @@
 		NIEWŁAŚCIWY AWATAR
 	</floater.string>
 	<text name="composite_label">
-		Tekstury Kompozytowe
+		Tekstury kompozytowe
 	</text>
 	<button label="Zrzuć" label_selected="Zrzuć" name="Dump"/>
 	<scroll_container name="profile_scroll">
 		<panel name="scroll_content_panel">
 			<texture_picker label="Włosy" name="hair-baked"/>
 			<texture_picker label="Włosy" name="hair_grain"/>
-			<texture_picker label="Alpha Włosów" name="hair_alpha"/>
+			<texture_picker label="Alpha włosów" name="hair_alpha"/>
 			<texture_picker label="Głowa" name="head-baked"/>
 			<texture_picker label="Makijaż" name="head_bodypaint"/>
-			<texture_picker label="Alpha Głowy" name="head_alpha"/>
-			<texture_picker label="Tatuaż Głowy" name="head_tattoo"/>
+			<texture_picker label="Alpha głowy" name="head_alpha"/>
+			<texture_picker label="Tatuaż głowy" name="head_tattoo"/>
 			<texture_picker label="Oczy" name="eyes-baked"/>
 			<texture_picker label="Oko" name="eyes_iris"/>
-			<texture_picker label="Alpha Oczu" name="eyes_alpha"/>
-			<texture_picker label="Górna Część Ciała" name="upper-baked"/>
-			<texture_picker label="Górny Wzór na Ciele" name="upper_bodypaint"/>
+			<texture_picker label="Alpha oczu" name="eyes_alpha"/>
+			<texture_picker label="Górna część ciała" name="upper-baked"/>
+			<texture_picker label="Górny wzór na ciele" name="upper_bodypaint"/>
 			<texture_picker label="Podkoszulek" name="upper_undershirt"/>
 			<texture_picker label="Rękawiczki" name="upper_gloves"/>
 			<texture_picker label="Koszula" name="upper_shirt"/>
-			<texture_picker label="Kurtka Górna" name="upper_jacket"/>
-			<texture_picker label="Alpha Górna" name="upper_alpha"/>
-			<texture_picker label="Tatuaż Górny" name="upper_tattoo"/>
-			<texture_picker label="Dolna Część Ciała" name="lower-baked"/>
-			<texture_picker label="Dolny Wzór na Ciele" name="lower_bodypaint"/>
+			<texture_picker label="Kurtka górna" name="upper_jacket"/>
+			<texture_picker label="Alpha górna" name="upper_alpha"/>
+			<texture_picker label="Tatuaż górny" name="upper_tattoo"/>
+			<texture_picker label="Dolna część ciała" name="lower-baked"/>
+			<texture_picker label="Dolny wzór na ciele" name="lower_bodypaint"/>
 			<texture_picker label="Bielizna" name="lower_underpants"/>
 			<texture_picker label="Skarpetki" name="lower_socks"/>
 			<texture_picker label="Buty" name="lower_shoes"/>
 			<texture_picker label="Spodnie" name="lower_pants"/>
 			<texture_picker label="Kurtka" name="lower_jacket"/>
-			<texture_picker label="Alpha Dolna" name="lower_alpha"/>
-			<texture_picker label="Tatuaż Dolny" name="lower_tattoo"/>
+			<texture_picker label="Alpha dolna" name="lower_alpha"/>
+			<texture_picker label="Tatuaż dolny" name="lower_tattoo"/>
 			<texture_picker label="Spódnica" name="skirt-baked"/>
 			<texture_picker label="Spódnica" name="skirt"/>
 		</panel>
diff --git a/indra/newview/skins/default/xui/pl/floater_beacons.xml b/indra/newview/skins/default/xui/pl/floater_beacons.xml
index 5bb469c433..547db2b351 100644
--- a/indra/newview/skins/default/xui/pl/floater_beacons.xml
+++ b/indra/newview/skins/default/xui/pl/floater_beacons.xml
@@ -2,20 +2,20 @@
 <floater name="beacons" title="EMITERY">
 	<panel name="beacons_panel">
 		<text name="label_show">
-			Pokaż Emitery:
+			Pokaż emitery:
 		</text>
 		<check_box label="Emitery" name="beacons"/>
-		<check_box label="Podkreśl Emitery" name="highlights"/>
-		<text name="beacon_width_label" tool_tip="Zasięg Emiterów">
+		<check_box label="Podkreśl emitery" name="highlights"/>
+		<text name="beacon_width_label" tool_tip="Zasięg emiterów">
 			Szer.
 		</text>
 		<text name="label_objects">
 			Dla tych obiektów:
 		</text>
-		<check_box label="Obiekty Fizyczne" name="physical"/>
-		<check_box label="Obiekty Skryptowane" name="scripted"/>
-		<check_box label="Obiekty Dotykalne" name="touch_only"/>
-		<check_box label="Źródła Dźwięku" name="sounds"/>
-		<check_box label="Źródła Cząsteczek" name="particles"/>
+		<check_box label="Obiekty fizyczne" name="physical"/>
+		<check_box label="Obiekty skryptowane" name="scripted"/>
+		<check_box label="Obiekty dotykalne" name="touch_only"/>
+		<check_box label="Źródła dźwięku" name="sounds"/>
+		<check_box label="Źródła cząsteczek" name="particles"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_build_options.xml b/indra/newview/skins/default/xui/pl/floater_build_options.xml
index 8e9ae36c05..5d296aa725 100644
--- a/indra/newview/skins/default/xui/pl/floater_build_options.xml
+++ b/indra/newview/skins/default/xui/pl/floater_build_options.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="build options floater" title="OPCJE SIATKI">
-	<spinner label="Jednostki Siatki (metery)" name="GridResolution"/>
-	<spinner label="Rozmiary Siatki (metry)" name="GridDrawSize"/>
+	<spinner label="Jednostki siatki (metery)" name="GridResolution"/>
+	<spinner label="Rozmiary siatki (metry)" name="GridDrawSize"/>
 	<check_box label="Pokaż podjednostki" name="GridSubUnit"/>
-	<check_box label="Pokaż Przekroje" name="GridCrossSection"/>
-	<text name="grid_opacity_label" tool_tip="Nieprzeźroczystość Siatki:">
+	<check_box label="Pokaż przekroje" name="GridCrossSection"/>
+	<text name="grid_opacity_label" tool_tip="Nieprzeźroczystość siatki:">
 		Nieprzeźroczystość:
 	</text>
-	<slider label="Nieprzezroczystość Siatki" name="GridOpacity"/>
+	<slider label="Nieprzezroczystość siatki" name="GridOpacity"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml b/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
index 4b6e8f793b..f4721b05d8 100644
--- a/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/pl/floater_bulk_perms.xml
@@ -14,7 +14,7 @@
 	</floater.string>
 	<check_box label="Animacje" name="check_animation"/>
 	<icon name="icon_animation" tool_tip="Animacja"/>
-	<check_box label="Części Ciała" name="check_bodypart"/>
+	<check_box label="Części ciała" name="check_bodypart"/>
 	<icon name="icon_bodypart" tool_tip="Części Ciała"/>
 	<check_box label="Ubranie" name="check_clothing"/>
 	<icon name="icon_clothing" tool_tip="Ubranie"/>
@@ -44,7 +44,7 @@
 	</text>
 	<check_box label="Kopiuj" name="everyone_copy"/>
 	<text name="NextOwnerLabel">
-		Następny właściciel:
+		Następny Właściciel:
 	</text>
 	<check_box label="Modyfikuje" name="next_owner_modify"/>
 	<check_box label="Kopiuje" name="next_owner_copy"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_buy_contents.xml b/indra/newview/skins/default/xui/pl/floater_buy_contents.xml
index dacd2c2376..94f2b50450 100644
--- a/indra/newview/skins/default/xui/pl/floater_buy_contents.xml
+++ b/indra/newview/skins/default/xui/pl/floater_buy_contents.xml
@@ -4,7 +4,7 @@
 		[NAME] zawiera:
 	</text>
 	<text name="buy_text">
-		Kupić za L$[AMOUNT] od [NAME]?
+		Kupić za [AMOUNT]L$ od [NAME]?
 	</text>
 	<button label="Anuluj" label_selected="Anuluj" name="cancel_btn"/>
 	<button label="Kup" label_selected="Kup" name="buy_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
index d8e53ee37a..f2a6579dc3 100644
--- a/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/pl/floater_buy_currency.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="buy currency" title="KUP L$">
 	<floater.string name="buy_currency">
-		Kup L$ [LINDENS] za [LOCALAMOUNT]
+		Kup [LINDENS] L$ za [LOCALAMOUNT]
 	</floater.string>
 	<text name="info_need_more">
 		Potrzebujesz więcej L$
@@ -10,7 +10,7 @@
 		Kontaktowanie z LindeX...
 	</text>
 	<text name="info_buying">
-		kup L$
+		Kup L$
 	</text>
 	<text name="balance_label">
 		Obecnie posiadasz
@@ -46,7 +46,7 @@
 		[AMT]L$
 	</text>
 	<text name="currency_links">
-		[http://www.secondlife.com/my/account/payment_method_management.php payment method] | [http://www.secondlife.com/my/account/currency.php currency] | [http://www.secondlife.com/my/account/exchange_rates.php exchange rate]
+		[http://www.secondlife.com/my/account/payment_method_management.php metoda płatności] | [http://www.secondlife.com/my/account/currency.php waluta] | [http://www.secondlife.com/my/account/exchange_rates.php kurs wymiany]
 	</text>
 	<text name="exchange_rate_note">
 		Wpisz ponownie kwotę aby zobaczyć ostatni kurs wymiany.
diff --git a/indra/newview/skins/default/xui/pl/floater_buy_land.xml b/indra/newview/skins/default/xui/pl/floater_buy_land.xml
index daafd14e1f..3d01129d9b 100644
--- a/indra/newview/skins/default/xui/pl/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/pl/floater_buy_land.xml
@@ -35,14 +35,14 @@ Spróbuj wybrać mniejszy obszar.
 		Ta Posiadłość już należy do Ciebie.
 	</floater.string>
 	<floater.string name="set_to_sell_to_other">
-		Wybrana Posiadłość będzie sprzedana komu innemu.
+		Wybrana Posiadłość będzie sprzedana komuś innemu.
 	</floater.string>
 	<floater.string name="no_public_land">
 		Wybrany obszar nie ma publicznych Posiadłości.
 	</floater.string>
 	<floater.string name="not_owned_by_you">
-		Wybrałeś posiadłość, której właścicielem jest inny Rezydent.
-Spróbuj wybrać ponownie mniejszą powierzchnię posiadłości.
+		Wybrałeś Posiadłość, której Właścicielem jest inny Rezydent.
+Spróbuj wybrać ponownie mniejszą powierzchnię Posiadłości.
 	</floater.string>
 	<floater.string name="processing">
 		Przetwarzanie Twojego zakupu...
@@ -56,7 +56,7 @@ Spróbuj wybrać ponownie mniejszą powierzchnię posiadłości.
 		Zakup tej Posiadłości spowoduje:
 	</floater.string>
 	<floater.string name="buying_for_group">
-		Zakup ziemi dla grupy:
+		Zakup ziemi dla Grupy:
 	</floater.string>
 	<floater.string name="cannot_buy_now">
 		Nie możesz teraz kupić:
@@ -123,7 +123,7 @@ używanie Posiadłości żeby sfinalizować ten zakup.
 		Musisz dokupić [AMOUNT]L$ żeby kupić tą Posiadłość.
 	</floater.string>
 	<floater.string name="no_parcel_selected">
-		(Posiadłość nie wybrana)
+		(Posiadłość nie została wybrana)
 	</floater.string>
 	<floater.string name="icon_PG" value="Parcel_PG_Dark"/>
 	<floater.string name="icon_M" value="Parcel_M_Dark"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_camera.xml b/indra/newview/skins/default/xui/pl/floater_camera.xml
index 4de00e39f3..aec75f026f 100644
--- a/indra/newview/skins/default/xui/pl/floater_camera.xml
+++ b/indra/newview/skins/default/xui/pl/floater_camera.xml
@@ -28,16 +28,16 @@
 		</panel>
 		<joystick_rotate name="cam_rotate_stick" tool_tip="Obracaj kamerę wokoł osi"/>
 		<panel name="camera_presets">
-			<button name="rear_view" tool_tip="Widok z Tyłu"/>
+			<button name="rear_view" tool_tip="Widok z tyłu"/>
 			<button name="group_view" tool_tip="Podgląd Grupy"/>
-			<button name="front_view" tool_tip="Widok z Przodu"/>
-			<button name="mouselook_view" tool_tip="Widok Panoramiczny"/>
+			<button name="front_view" tool_tip="Widok z przodu"/>
+			<button name="mouselook_view" tool_tip="Widok panoramiczny"/>
 		</panel>
 	</panel>
 	<panel name="buttons">
-		<button label="" name="orbit_btn" tool_tip="Obracaj Kamerę"/>
-		<button label="" name="pan_btn" tool_tip="Kamera Horyzontalna"/>
+		<button label="" name="orbit_btn" tool_tip="Obracaj kamerę"/>
+		<button label="" name="pan_btn" tool_tip="Kamera horyzontalna"/>
 		<button label="" name="avatarview_btn" tool_tip="Ustawienia"/>
-		<button label="" name="freecamera_btn" tool_tip="Podgląd Obiektu"/>
+		<button label="" name="freecamera_btn" tool_tip="Podgląd obiektu"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_choose_group.xml b/indra/newview/skins/default/xui/pl/floater_choose_group.xml
index 1e89b8bafc..877cedc0bc 100644
--- a/indra/newview/skins/default/xui/pl/floater_choose_group.xml
+++ b/indra/newview/skins/default/xui/pl/floater_choose_group.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="groups" title="GRUPY">
 	<text name="groupdesc">
-		Wybierz grupę:
+		Wybierz Grupę:
 	</text>
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Anuluj" label_selected="Anuluj" name="Cancel"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_color_picker.xml b/indra/newview/skins/default/xui/pl/floater_color_picker.xml
index 2246bf9ede..a607ca982f 100644
--- a/indra/newview/skins/default/xui/pl/floater_color_picker.xml
+++ b/indra/newview/skins/default/xui/pl/floater_color_picker.xml
@@ -23,9 +23,9 @@
 	<button label="Anuluj" label_selected="Anuluj" name="cancel_btn"/>
 	<button label="OK" label_selected="OK" name="select_btn"/>
 	<text name="Current color:">
-		Obecny Kolor:
+		Obecny kolor:
 	</text>
 	<text name="(Drag below to save.)">
-		(Przeciągnij tutaj by zapisać)
+		(Przeciągnij tutaj aby zapisać)
 	</text>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_customize.xml b/indra/newview/skins/default/xui/pl/floater_customize.xml
index 5acab60642..dd1d5cf684 100644
--- a/indra/newview/skins/default/xui/pl/floater_customize.xml
+++ b/indra/newview/skins/default/xui/pl/floater_customize.xml
@@ -43,15 +43,15 @@
 			<text name="Item Action Label">
 				Kształt:
 			</text>
-			<button label="Nowy Kształt" label_selected="Nowy Kształt" name="Create New"/>
+			<button label="Nowy kształt" label_selected="Nowy kształt" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 		</panel>
 		<panel label="Skórka" name="Skin">
-			<button label="Kolor Skórki" label_selected="Kolor Skórki" name="Skin Color"/>
-			<button label="Detale Twarzy" label_selected="Detale Twarzy" name="Face Detail"/>
+			<button label="Kolor skórki" label_selected="Kolor skórki" name="Skin Color"/>
+			<button label="Detale twarzy" label_selected="Detale twarzy" name="Face Detail"/>
 			<button label="Makijaż" label_selected="Makijaż" name="Makeup"/>
-			<button label="Detale Ciała" label_selected="Detale Ciała" name="Body Detail"/>
+			<button label="Detale ciała" label_selected="Detale ciała" name="Body Detail"/>
 			<text name="title">
 				[DESC]
 			</text>
@@ -76,12 +76,12 @@
 			<text name="Item Action Label">
 				Skórka:
 			</text>
-			<texture_picker label="Tatuaże Głowy" name="Head Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
-			<texture_picker label="Tatuaże Górne" name="Upper Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
-			<texture_picker label="Tatuaże Dolne" name="Lower Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
-			<button label="Nowa Skórka" label_selected="Nowa Skórka" name="Create New"/>
+			<texture_picker label="Tatuaże głowy" name="Head Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
+			<texture_picker label="Tatuaże górne" name="Upper Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
+			<texture_picker label="Tatuaże dolne" name="Lower Tattoos" tool_tip="Kliknij by wybrać teksturę"/>
+			<button label="Nowa skórka" label_selected="Nowa skórka" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Włosy" name="Hair">
@@ -114,9 +114,9 @@
 				Włosy:
 			</text>
 			<texture_picker label="Tekstura" name="Texture" tool_tip="Kliknij by wybrać teksturę"/>
-			<button label="Nowe Włosy" label_selected="Nowe Włosy" name="Create New"/>
+			<button label="Nowe włosy" label_selected="Nowe włosy" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Oczy" name="Eyes">
@@ -145,9 +145,9 @@
 				Oczy:
 			</text>
 			<texture_picker label="Tęczówka" name="Iris" tool_tip="Kliknij by wybrać teksturę"/>
-			<button label="Nowe Oczy" label_selected="Nowe Oczy" name="Create New"/>
+			<button label="Nowe oczy" label_selected="Nowe oczy" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<text label="Ubrania" name="clothes_placeholder">
@@ -159,7 +159,7 @@
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Nowa Koszula" label_selected="Nowa Koszula" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 			<text name="title">
 				[DESC]
@@ -190,9 +190,9 @@
 			<texture_picker label="Materiał" name="Fabric" tool_tip="Kliknij tutaj by wybrać teksturę"/>
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
-			<button label="Nowe Spodnie" label_selected="Nowe Spodnie" name="Create New"/>
+			<button label="Nowe spodnie" label_selected="Nowe spodnie" name="Create New"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 			<text name="title">
 				[DESC]
@@ -249,7 +249,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Skarpety" name="Socks">
@@ -282,7 +282,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Kurtka" name="Jacket">
@@ -311,12 +311,12 @@
 			<text name="Item Action Label">
 				Kurtka:
 			</text>
-			<texture_picker label="Górny Materiał" name="Upper Fabric" tool_tip="Kliknij by wybrać teksturę" width="76"/>
-			<texture_picker label="Dolny Materiał" name="Lower Fabric" tool_tip="Kliknij by wybrać kolor" width="76"/>
+			<texture_picker label="Górny materiał" name="Upper Fabric" tool_tip="Kliknij by wybrać teksturę" width="76"/>
+			<texture_picker label="Dolny materiał" name="Lower Fabric" tool_tip="Kliknij by wybrać kolor" width="76"/>
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor" width="76"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Rękawiczki" name="Gloves">
@@ -349,7 +349,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Podkoszulek" name="Undershirt">
@@ -382,7 +382,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Bielizna" name="Underpants">
@@ -415,7 +415,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Spódnica" name="Skirt">
@@ -448,7 +448,7 @@
 			<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
-			<button label="Zapisz Jako..." label_selected="Zapisz Jako..." name="Save As"/>
+			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 		<panel label="Tatuaż" name="Tattoo">
@@ -477,9 +477,9 @@
 			<text name="Item Action Label">
 				Tatuaż:
 			</text>
-			<texture_picker label="Tatuaż Głowy" name="Head Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Górny Tatuaż" name="Upper Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Tatuaż Dolnej Części Ciała" name="Lower Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Tatuaż głowy" name="Head Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Górny tatuaż" name="Upper Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Tatuaż dolnej części ciała" name="Lower Tattoo" tool_tip="Kliknij aby wybrać teksturę"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
 			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
@@ -512,18 +512,18 @@
 				Alpha:
 			</text>
 			<texture_picker label="Dolna Alpha" name="Lower Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Alpha Górnej Części Ciała" name="Upper Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Alpha Głowy" name="Head Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Alpha Oka" name="Eye Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
-			<texture_picker label="Alpha Włosów" name="Hair Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Alpha górnej części ciała" name="Upper Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Alpha głowy" name="Head Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Alpha oka" name="Eye Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
+			<texture_picker label="Alpha włosów" name="Hair Alpha" tool_tip="Kliknij aby wybrać teksturę"/>
 			<button label="Zdejmij" label_selected="Zdejmij" name="Take Off"/>
 			<button label="Zapisz" label_selected="Zapisz" name="Save"/>
 			<button label="Zapisz jako..." label_selected="Zapisz jako..." name="Save As"/>
 			<button label="Wróć" label_selected="Wróć" name="Revert"/>
 		</panel>
 	</tab_container>
-	<button label="Info o Skrypcie" label_selected="Info o Skrypcie" name="script_info" tool_tip="Pokaż skrypty przyłączone do Twojego awatara"/>
-	<button label="Stwórz Ubranie" label_selected="Stwórz Ubranie" name="make_outfit_btn"/>
+	<button label="Info o skrypcie" label_selected="Info o skrypcie" name="script_info" tool_tip="Pokaż skrypty przyłączone do Twojego awatara"/>
+	<button label="Stwórz ubranie" label_selected="Stwórz Ubranie" name="make_outfit_btn"/>
 	<button label="Anuluj" label_selected="Anuluj" name="Cancel"/>
 	<button label="OK" label_selected="OK" name="Ok"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml b/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
index 6671bb853e..0cb2114f99 100644
--- a/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
+++ b/indra/newview/skins/default/xui/pl/floater_day_cycle_options.xml
@@ -62,7 +62,7 @@
 			<button label="Dodaj" label_selected="Dodaj" name="WLAddKey" />
 			<button label="Usuń" label_selected="Usuń" name="WLDeleteKey" />
 			<text name="WLCurKeyFrameText">
-				Preferencje Czasu:
+				Preferencje czasu:
 			</text>
 			<text name="WLCurKeyTimeText">
 				Czas:
@@ -78,7 +78,7 @@
 			</text>
 			<combo_box label="5 min" name="WLSnapOptions" />
 			<text name="DayCycleText2">
-				Długość Cyklu:
+				Długość cyklu:
 			</text>
 			<spinner label="Godz" name="WLLengthOfDayHour" />
 			<spinner label="Min" name="WLLengthOfDayMin" />
@@ -88,11 +88,11 @@
 			</text>
 			<button label="Start" label_selected="Start" name="WLAnimSky" />
 			<button label="Stop" label_selected="Stop" name="WLStopAnimSky" />
-			<button label="Używaj Czasu Regionu" label_selected="Używaj Czasu Regionu"
+			<button label="Używaj czasu regionu" label_selected="Używaj czasu regionu"
 			     name="WLUseLindenTime" />
-			<button label="Zapisz Test Dnia" label_selected="Zapisz Test Dnia"
+			<button label="Zapisz test dnia" label_selected="Zapisz test dnia"
 			     name="WLSaveDayCycle" />
-			<button label="Załaduj Test Dnia" label_selected="Załaduj Test Dnia"
+			<button label="Załaduj test dnia" label_selected="Załaduj test dnia"
 			     name="WLLoadDayCycle" />
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/pl/floater_env_settings.xml b/indra/newview/skins/default/xui/pl/floater_env_settings.xml
index fb4c505ff3..3ab854fbbb 100644
--- a/indra/newview/skins/default/xui/pl/floater_env_settings.xml
+++ b/indra/newview/skins/default/xui/pl/floater_env_settings.xml
@@ -15,14 +15,14 @@
 	</text>
 	<slider label="" name="EnvCloudSlider"/>
 	<text name="EnvWaterColorText">
-		Kolor Wody
+		Kolor wody
 	</text>
 	<color_swatch label="" name="EnvWaterColor" tool_tip="Kliknij aby wybrać kolor"/>
 	<text name="EnvWaterFogText">
 		Zamglenie:
 	</text>
 	<slider label="" name="EnvWaterFogSlider"/>
-	<button label="Używaj Czasu Regionu" name="EnvUseEstateTimeButton"/>
-	<button label="Zaawansowane Niebo" name="EnvAdvancedSkyButton"/>
-	<button label="Zaawansowana Woda" name="EnvAdvancedWaterButton"/>
+	<button label="Używaj czasu regionu" name="EnvUseEstateTimeButton"/>
+	<button label="Zaawansowane niebo" name="EnvAdvancedSkyButton"/>
+	<button label="Zaawansowana woda" name="EnvAdvancedWaterButton"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_event.xml b/indra/newview/skins/default/xui/pl/floater_event.xml
index dfdc87b079..7588493464 100644
--- a/indra/newview/skins/default/xui/pl/floater_event.xml
+++ b/indra/newview/skins/default/xui/pl/floater_event.xml
@@ -10,13 +10,13 @@
 		Nie zawiadamiaj
 	</floater.string>
 	<floater.string name="moderate">
-		Moderuj
+		Mature
 	</floater.string>
 	<floater.string name="adult">
 		Adult
 	</floater.string>
 	<floater.string name="general">
-		Ogólne
+		PG
 	</floater.string>
 	<floater.string name="unknown">
 		Nieznana
diff --git a/indra/newview/skins/default/xui/pl/floater_gesture.xml b/indra/newview/skins/default/xui/pl/floater_gesture.xml
index d12ea98815..750a9e4a66 100644
--- a/indra/newview/skins/default/xui/pl/floater_gesture.xml
+++ b/indra/newview/skins/default/xui/pl/floater_gesture.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater label="Miejsca" name="gestures" title="GESTURY">
+<floater label="Miejsca" name="gestures" title="GESTY">
 	<floater.string name="loading">
 		Ładowanie...
 	</floater.string>
@@ -18,8 +18,8 @@
 	<panel label="bottom_panel" name="bottom_panel">
 		<menu_button name="gear_btn" tool_tip="Więcej opcji"/>
 		<button name="new_gesture_btn" tool_tip="Stwórz nową gesturę"/>
-		<button name="activate_btn" tool_tip="Aktywuj/Dezaktywuj wybraną gesturę"/>
-		<button name="del_btn" tool_tip="Usuń gesturę"/>
+		<button name="activate_btn" tool_tip="Aktywuj/Dezaktywuj wybrany gest"/>
+		<button name="del_btn" tool_tip="Usuń gest"/>
 	</panel>
 	<button label="Edytuj" name="edit_btn"/>
 	<button label="Odtwarzaj" name="play_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_god_tools.xml b/indra/newview/skins/default/xui/pl/floater_god_tools.xml
index d3ff603970..4d49c32fc1 100644
--- a/indra/newview/skins/default/xui/pl/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/pl/floater_god_tools.xml
@@ -3,7 +3,7 @@
 	<tab_container name="GodTools Tabs">
 		<panel label="Grid" name="grid">
 			<button label="Wyrzuć wszystkich Rezydentów" label_selected="Wyrzuć wszystkich Rezydentów" name="Kick all users" width="205"/>
-			<button label="Wyrównaj Widoczność Buforu Mapy Regionu" label_selected="Wyrównaj Widoczność Buforu Mapy Regionu" name="Flush This Region&apos;s Map Visibility Caches" width="285"/>
+			<button label="Wyrównaj widoczność buforu mapy Regionu" label_selected="Wyrównaj widoczność buforu mapy Regionu" name="Flush This Region&apos;s Map Visibility Caches" width="285"/>
 		</panel>
 		<panel label="Region" name="region">
 			<text name="Sim Name:" width="100">
@@ -12,15 +12,15 @@
 			<line_editor left="115" name="region name" width="178"/>
 			<check_box label="Wstęp" name="check prelude" tool_tip="Set this to make the region a prelude"/>
 			<check_box label="Korekta Słońca" name="check fixed sun" tool_tip="Skorektuj ustawienia pozycji słońca."/>
-			<check_box height="32" label="Zresetuj Pozycję  Miejsca Startowego" name="check reset home" tool_tip="Zresetuj miejsce startu Rezydentów po teleportacji"/>
-			<check_box bottom_delta="-32" label="Widoczny" name="check visible" tool_tip="Wybierz tę opcję by ustawić region widocznym dla wszystkich."/>
+			<check_box height="32" label="Zresetuj pozycję  Miejsca Startowego" name="check reset home" tool_tip="Zresetuj miejsce startu Rezydentów po teleportacji"/>
+			<check_box bottom_delta="-32" label="Widoczny" name="check visible" tool_tip="Wybierz tą opcję by ustawić region widocznym dla wszystkich."/>
 			<check_box label="Zniszczenia" name="check damage" tool_tip="Wybierz tę opcję by uruchomić opcję zniszczeń w regionie."/>
-			<check_box label="Zablokuj Monitorowanie Trafficu" name="block dwell" tool_tip="Wybierz tę opcję by zablokować monitorowanie trafficu w regionie."/>
-			<check_box label="Zablokuj Terraformowanie" name="block terraform" tool_tip="Wybierz tę opcję by zablokować terraforming w regionie"/>
+			<check_box label="Zablokuj Monitorowanie Trafficu" name="block dwell" tool_tip="Wybierz tą opcję by zablokować monitorowanie trafficu w regionie."/>
+			<check_box label="Zablokuj Terraformowanie" name="block terraform" tool_tip="Wybierz tą opcję by zablokować terraforming w regionie"/>
 			<check_box label="Piaskownica" name="is sandbox" tool_tip="Toggle whether this is a sandbox region"/>
-			<button label="Ustal Teren" label_selected="Ustal Teren" name="Bake Terrain" tool_tip="Zapamiętaj obecny teren jako początkowy dla cofnięcia modyfikacji terenu." width="138"/>
-			<button label="Cofnięcie Modyfikacji" label_selected="Cofnięcie Modyfikacji" name="Revert Terrain" tool_tip="Przywróć Ustawienia Domyślne Regionu." width="138"/>
-			<button label="Zamień Teren" label_selected="Zamień Teren" name="Swap Terrain" tool_tip="Swap current terrain with default" width="138"/>
+			<button label="Ustal teren" label_selected="Ustal teren" name="Bake Terrain" tool_tip="Zapamiętaj obecny teren jako początkowy dla cofnięcia modyfikacji terenu." width="138"/>
+			<button label="Cofnięcie modyfikacji" label_selected="Cofnięcie modyfikacji" name="Revert Terrain" tool_tip="Przywróć ustawienia domyślne Regionu." width="138"/>
+			<button label="Zamień teren" label_selected="Zamień teren" name="Swap Terrain" tool_tip="Swap current terrain with default" width="138"/>
 			<text name="estate id">
 				ID Regionu:
 			</text>
@@ -40,7 +40,7 @@
 			<line_editor left_delta="110" name="redirectx" width="35"/>
 			<line_editor left_delta="45" name="redirecty" width="35"/>
 			<text name="billable factor text">
-				Czynnik Płatności:
+				Czynnik płatności:
 			</text>
 			<spinner name="billable factor"/>
 			<text name="land cost text">
@@ -49,8 +49,8 @@
 			<spinner name="land cost"/>
 			<button label="Odśwież" label_selected="Odśwież" name="Refresh" tool_tip="Click here to refresh the above information"/>
 			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Click here to apply any changes from above"/>
-			<button label="Wybierz Region" label_selected="Wybierz Region" left="156" name="Select Region" tool_tip="Wybierz cały region za pomocą narzędzi edycji terenu" width="150"/>
-			<button label="Automatyczne Zapisanie" label_selected="Automatyczne Zapisanie" left="156" name="Autosave now" tool_tip="Save gzipped state to autosave directory" width="150"/>
+			<button label="Wybierz Region" label_selected="Wybierz Region" left="156" name="Select Region" tool_tip="Wybierz cały Region za pomocą narzędzi edycji terenu" width="150"/>
+			<button label="Automatyczne zapisanie" label_selected="Automatyczne zapisanie" left="156" name="Autosave now" tool_tip="Save gzipped state to autosave directory" width="150"/>
 		</panel>
 		<panel label="Obiekty" name="objects">
 			<text name="Sim Name:" width="105">
@@ -59,9 +59,9 @@
 			<text left_delta="110" name="region name">
 				Welsh
 			</text>
-			<check_box label="Wyłącz Skrypty" name="disable scripts" tool_tip="Set this to disable all scripts in this region"/>
-			<check_box label="Deaktywuj Kolizje" name="disable collisions" tool_tip="Set this to disable non-agent collisions in this region"/>
-			<check_box label="Wylącz Fizykę" name="disable physics" tool_tip="Set this to disable all physics in this region"/>
+			<check_box label="Wyłącz skrypty" name="disable scripts" tool_tip="Set this to disable all scripts in this region"/>
+			<check_box label="Deaktywuj kolizje" name="disable collisions" tool_tip="Set this to disable non-agent collisions in this region"/>
+			<check_box label="Wylącz fizykę" name="disable physics" tool_tip="Set this to disable all physics in this region"/>
 			<button label="Zastosuj" label_selected="Zastosuj" name="Apply" tool_tip="Click here to apply any changes from above"/>
 			<button label="Ustaw Cel" label_selected="Set Target" name="Set Target" tool_tip="Set the target avatar for object deletion"/>
 			<text name="target_avatar_name">
@@ -70,8 +70,8 @@
 			<button label="Usuń cel z oskryptowanych obiektów na innych posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na innych posiadłościach" name="Delete Target&apos;s Scripted Objects On Others Land" tool_tip="Delete all scripted objects owned by the target on land not owned by the target. (no copy) objects will be returned."/>
 			<button label="Usuń cel z oskryptowanych obiektów na jakichkolwiek posiadłościach" label_selected="Usuń cel &apos;s skryptowane obiekty na jakichkolwiek posiadłościach" name="Delete Target&apos;s Scripted Objects On *Any* Land" tool_tip="Delete all scripted objects owned by the target in this region. (no copy) objects will be returned."/>
 			<button label="Usuń wszystkie cele i obiekty" label_selected="Usuń wszystkie cele i obiekty" name="Delete *ALL* Of Target&apos;s Objects" tool_tip="Delete all objects owned by the target in this region. (no copy) objects will be returned."/>
-			<button label="Główne Kolizje" label_selected="Główne Kolizje" name="Get Top Colliders" tool_tip="Gets list of objects experiencing the most narrowphase callbacks"/>
-			<button label="Główne Skrypty" label_selected="Główne Skrypty" name="Get Top Scripts" tool_tip="Gets list of objects spending the most time running scripts"/>
+			<button label="Główne kolizje" label_selected="Główne kolizje" name="Get Top Colliders" tool_tip="Gets list of objects experiencing the most narrowphase callbacks"/>
+			<button label="Główne skrypty" label_selected="Główne skrypty" name="Get Top Scripts" tool_tip="Gets list of objects spending the most time running scripts"/>
 			<button label="Treść skryptów" label_selected="Treść skryptów" name="Scripts digest" tool_tip="Wyświetla listę wszystkich skryptów i liczbę ich zastosowań."/>
 		</panel>
 		<panel label="Zażądaj" name="request">
diff --git a/indra/newview/skins/default/xui/pl/floater_hardware_settings.xml b/indra/newview/skins/default/xui/pl/floater_hardware_settings.xml
index 85e8194834..bd5dd7e7d2 100644
--- a/indra/newview/skins/default/xui/pl/floater_hardware_settings.xml
+++ b/indra/newview/skins/default/xui/pl/floater_hardware_settings.xml
@@ -3,9 +3,9 @@
 	<text name="Filtering:">
 		Filtrowanie:
 	</text>
-	<check_box label="Filtrowanie Anizotropowe" name="ani"/>
+	<check_box label="Filtr anizotropowy" name="ani"/>
 	<text name="Antialiasing:">
-		Antialiasing:
+		Antyaliasing:
 	</text>
 	<combo_box label="Antialiasing" name="fsaa" width="84">
 		<combo_box.item label="Wyłączone" name="FSAADisabled"/>
@@ -21,8 +21,8 @@
 	<text name="Enable VBO:">
 		Włącz VBO:
 	</text>
-	<check_box initial_value="true" label="Włącz Bufor Vertexów OpenGL" name="vbo" tool_tip=""/>
-	<slider label="Pamięć Tekstur (MB):" name="GraphicsCardTextureMemory" tool_tip="Ilość alokacji pamięci dla tekstur. Domyślne dla karty pamięci video. Obniżenie poziomu tych funkcji może polepszyć wydajność systemową jednak spowoduje zmniejszenie jakości i wyrazistości tekstur."/>
-	<spinner label="Stosunek Dystansu Mgły:" name="fog"/>
+	<check_box initial_value="true" label="Włącz rozszerzenie OpenGL" name="vbo" tool_tip=""/>
+	<slider label="Pamięć na tekstury (MB):" name="GraphicsCardTextureMemory" tool_tip="Ilość alokacji pamięci dla tekstur. Domyślne dla karty pamięci video. Obniżenie poziomu tych funkcji może polepszyć wydajność systemową jednak spowoduje zmniejszenie jakości i wyrazistości tekstur."/>
+	<spinner label="Stosunek dystansu mgły:" name="fog"/>
 	<button label="OK" label_selected="OK" name="OK"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_im_session.xml b/indra/newview/skins/default/xui/pl/floater_im_session.xml
index f4dd7d00e1..db513f787c 100644
--- a/indra/newview/skins/default/xui/pl/floater_im_session.xml
+++ b/indra/newview/skins/default/xui/pl/floater_im_session.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="panel_im">
 	<layout_stack name="im_panels">
-		<layout_panel label="Panel Kontroli Wiadomości Prywatnej (IM)" name="panel_im_control_panel"/>
+		<layout_panel label="Panel kontroli wiadomości prywatnej (IM)" name="panel_im_control_panel"/>
 		<layout_panel>
 			<line_editor label="Do" name="chat_editor"/>
 		</layout_panel>
diff --git a/indra/newview/skins/default/xui/pl/floater_image_preview.xml b/indra/newview/skins/default/xui/pl/floater_image_preview.xml
index 6c61cfcacf..a27e8ffed3 100644
--- a/indra/newview/skins/default/xui/pl/floater_image_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_image_preview.xml
@@ -12,12 +12,12 @@
 	<combo_box label="Rodzaj Ubrania" name="clothing_type_combo">
 		<combo_box.item label="Obraz" name="Image"/>
 		<combo_box.item label="Włosy" name="Hair"/>
-		<combo_box.item label="Damska Głowa" name="FemaleHead"/>
-		<combo_box.item label="Damska Górna Część Ciała" name="FemaleUpperBody"/>
-		<combo_box.item label="Damska Górna Część Ciała" name="FemaleLowerBody"/>
-		<combo_box.item label="Męska Głowa" name="MaleHead"/>
-		<combo_box.item label="Męska Górna Część Ciała" name="MaleUpperBody"/>
-		<combo_box.item label="Męska Dolna Część Ciała" name="MaleLowerBody"/>
+		<combo_box.item label="Damska głowa" name="FemaleHead"/>
+		<combo_box.item label="Damska górna część ciała" name="FemaleUpperBody"/>
+		<combo_box.item label="Damska górna część ciała" name="FemaleLowerBody"/>
+		<combo_box.item label="Męska głowa" name="MaleHead"/>
+		<combo_box.item label="Męska górna część ciała" name="MaleUpperBody"/>
+		<combo_box.item label="Męska dolna część ciała" name="MaleLowerBody"/>
 		<combo_box.item label="Spódnica" name="Skirt"/>
 		<combo_box.item label="Prim sculptowy" name="SculptedPrim"/>
 	</combo_box>
diff --git a/indra/newview/skins/default/xui/pl/floater_incoming_call.xml b/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
index fa2308675e..e5ec3804ae 100644
--- a/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
+++ b/indra/newview/skins/default/xui/pl/floater_incoming_call.xml
@@ -4,7 +4,7 @@
 		5
 	</floater.string>
 	<floater.string name="localchat">
-		Rozmowy Głosowe w Pobliżu
+		Rozmowy głosowe w pobliżu
 	</floater.string>
 	<floater.string name="anonymous">
 		anonimowy
diff --git a/indra/newview/skins/default/xui/pl/floater_inspect.xml b/indra/newview/skins/default/xui/pl/floater_inspect.xml
index f595f0c7dd..2c66f2851d 100644
--- a/indra/newview/skins/default/xui/pl/floater_inspect.xml
+++ b/indra/newview/skins/default/xui/pl/floater_inspect.xml
@@ -7,7 +7,7 @@
 		<scroll_list.columns label="Nazwa" name="object_name"/>
 		<scroll_list.columns label="Właściciel" name="owner_name"/>
 		<scroll_list.columns label="Twórca" name="creator_name"/>
-		<scroll_list.columns label="Data Kreacji" name="creation_date"/>
+		<scroll_list.columns label="Data kreacji" name="creation_date"/>
 	</scroll_list>
 	<button label="Profil Właściciela..." label_selected="" name="button owner" tool_tip=""/>
 	<button label="Profil Twórcy..." label_selected="" name="button creator" tool_tip=""/>
diff --git a/indra/newview/skins/default/xui/pl/floater_inventory.xml b/indra/newview/skins/default/xui/pl/floater_inventory.xml
index 42aebe99d6..0dc4d5b96d 100644
--- a/indra/newview/skins/default/xui/pl/floater_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/floater_inventory.xml
@@ -4,7 +4,7 @@
 		MOJA SZAFA
 	</floater.string>
 	<floater.string name="TitleFetching">
-		MOJA SZAFA (Fetching [ITEM_COUNT] Obiekty...) [FILTER]
+		MOJA SZAFA (Dostarczanie [ITEM_COUNT] obiektów...) [FILTER]
 	</floater.string>
 	<floater.string name="TitleCompleted">
 		MOJA SZAFA ([ITEM_COUNT] Obiektów) [FILTER]
diff --git a/indra/newview/skins/default/xui/pl/floater_inventory_view_finder.xml b/indra/newview/skins/default/xui/pl/floater_inventory_view_finder.xml
index 9204262304..bd7b221c5d 100644
--- a/indra/newview/skins/default/xui/pl/floater_inventory_view_finder.xml
+++ b/indra/newview/skins/default/xui/pl/floater_inventory_view_finder.xml
@@ -4,7 +4,7 @@
 	<check_box label="Wizytówki" name="check_calling_card" />
 	<check_box label="Ubrania" name="check_clothing" />
 	<check_box label="Gesty" name="check_gesture" />
-	<check_box label="Zakładki Miejsc" name="check_landmark" />
+	<check_box label="Landmarki" name="check_landmark" />
 	<check_box label="Noty" name="check_notecard" />
 	<check_box label="Obiekty" name="check_object" />
 	<check_box label="Skrypty" name="check_script" />
diff --git a/indra/newview/skins/default/xui/pl/floater_joystick.xml b/indra/newview/skins/default/xui/pl/floater_joystick.xml
index b0b4f173b2..78742c39d1 100644
--- a/indra/newview/skins/default/xui/pl/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/pl/floater_joystick.xml
@@ -5,10 +5,10 @@
 	<spinner label="Kalibracja Osi X" label_width="130" left="20" name="JoystickAxis1" width="170"/>
 	<spinner label="Kalibracja Osi Y" label_width="130" left="210" name="JoystickAxis2" width="170"/>
 	<spinner label="Kalibracja Osi Z" label_width="130" left="400" name="JoystickAxis0" width="170"/>
-	<spinner label="Kalibracja Wznoszenia" label_width="130" left="20" name="JoystickAxis4" width="170"/>
-	<spinner label="Kalibracja Wychylania" label_width="130" left="210" name="JoystickAxis5" width="170"/>
-	<spinner label="Kalibracja Obrotu" label_width="130" left="400" name="JoystickAxis3" width="170"/>
-	<spinner label="Kalibracja Powiększania" label_width="130" name="JoystickAxis6" width="170"/>
+	<spinner label="Kalibracja wznoszenia" label_width="130" left="20" name="JoystickAxis4" width="170"/>
+	<spinner label="Kalibracja wychylania" label_width="130" left="210" name="JoystickAxis5" width="170"/>
+	<spinner label="Kalibracja obrotu" label_width="130" left="400" name="JoystickAxis3" width="170"/>
+	<spinner label="Kalibracja powiększania" label_width="130" name="JoystickAxis6" width="170"/>
 	<check_box label="Bezpośrednie" left="205" name="ZoomDirect"/>
 	<check_box label="Kursor 3D" left="340" name="Cursor3D"/>
 	<check_box label="Automatyczne" left="450" name="AutoLeveling"/>
@@ -37,54 +37,54 @@
 	<spinner left="208" name="BuildAxisScale0"/>
 	<spinner left="283" name="FlycamAxisScale0"/>
 	<text name="PitchScale" width="104">
-		Skala Wznoszenia
+		Skala wznoszenia
 	</text>
 	<spinner left="133" name="AvatarAxisScale4"/>
 	<spinner left="208" name="BuildAxisScale4"/>
 	<spinner left="283" name="FlycamAxisScale4"/>
 	<text name="YawScale" width="104">
-		Skala Odchylania
+		Skala odchylania
 	</text>
 	<spinner left="133" name="AvatarAxisScale5"/>
 	<spinner left="208" name="BuildAxisScale5"/>
 	<spinner left="283" name="FlycamAxisScale5"/>
 	<text name="RollScale" width="104">
-		Skala Obrotu
+		Skala obrotu
 	</text>
 	<spinner left="208" name="BuildAxisScale3"/>
 	<spinner left="283" name="FlycamAxisScale3"/>
 	<text name="XDeadZone" width="104">
-		Tolerancja Osi X
+		Tolerancja osi X
 	</text>
 	<spinner left="133" name="AvatarAxisDeadZone1"/>
 	<spinner left="208" name="BuildAxisDeadZone1"/>
 	<spinner left="283" name="FlycamAxisDeadZone1"/>
 	<text name="YDeadZone" width="104">
-		Tolerancja Osi Y
+		Tolerancja osi Y
 	</text>
 	<spinner left="133" name="AvatarAxisDeadZone2"/>
 	<spinner left="208" name="BuildAxisDeadZone2"/>
 	<spinner left="283" name="FlycamAxisDeadZone2"/>
 	<text name="ZDeadZone" width="104">
-		Tolerancja Osi Z
+		Tolerancja osi Z
 	</text>
 	<spinner left="133" name="AvatarAxisDeadZone0"/>
 	<spinner left="208" name="BuildAxisDeadZone0"/>
 	<spinner left="283" name="FlycamAxisDeadZone0"/>
 	<text name="PitchDeadZone" width="104">
-		Tolerancja Wznoszenia
+		Tolerancja wznoszenia
 	</text>
 	<spinner left="133" name="AvatarAxisDeadZone4"/>
 	<spinner left="208" name="BuildAxisDeadZone4"/>
 	<spinner left="283" name="FlycamAxisDeadZone4"/>
 	<text name="YawDeadZone" width="104">
-		Tolerancja Odchylania
+		Tolerancja odchylania
 	</text>
 	<spinner left="133" name="AvatarAxisDeadZone5"/>
 	<spinner left="208" name="BuildAxisDeadZone5"/>
 	<spinner left="283" name="FlycamAxisDeadZone5"/>
 	<text name="RollDeadZone" width="104">
-		Tolerancja Obrotu
+		Tolerancja obrotu
 	</text>
 	<spinner left="208" name="BuildAxisDeadZone3"/>
 	<spinner left="283" name="FlycamAxisDeadZone3"/>
@@ -95,14 +95,14 @@
 	<slider label="" left="200" name="BuildFeathering"/>
 	<slider label="" left="275" name="FlycamFeathering"/>
 	<text name="ZoomScale2" width="104">
-		Skala Powiększania
+		Skala powiększania
 	</text>
 	<spinner label="" left="283" name="FlycamAxisScale6"/>
 	<text name="ZoomDeadZone" width="104">
-		Tolerancja Powiększania
+		Tolerancja powiększania
 	</text>
 	<spinner label="" left="283" name="FlycamAxisDeadZone6"/>
-	<button label="Ustawienia Domyślne" left="366" name="SpaceNavigatorDefaults"/>
+	<button label="Ustawienia domyślne" left="366" name="SpaceNavigatorDefaults"/>
 	<button label="OK" label_selected="OK" left="366" name="ok_btn"/>
 	<button label="Anuluj" label_selected="Anuluj" name="cancel_btn"/>
 	<stat_view label="Monitor Joysticka" name="axis_view">
diff --git a/indra/newview/skins/default/xui/pl/floater_lagmeter.xml b/indra/newview/skins/default/xui/pl/floater_lagmeter.xml
index cc71c1dc33..8038550bcb 100644
--- a/indra/newview/skins/default/xui/pl/floater_lagmeter.xml
+++ b/indra/newview/skins/default/xui/pl/floater_lagmeter.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_lagmeter" title="POMIAR LAGÓW">
 	<floater.string name="max_title_msg">
-		Pomiar Lagów
+		Pomiar lagów
 	</floater.string>
 	<floater.string name="max_width_px">
 		360
@@ -34,16 +34,16 @@
 		W normie
 	</floater.string>
 	<floater.string name="client_draw_distance_cause_msg">
-		Przyczyna: Dystans rysowania jest za wysoki
+		Przyczyna: dystans rysowania jest za wysoki
 	</floater.string>
 	<floater.string name="client_texture_loading_cause_msg">
-		Przyczyna: Ładowanie obrazu
+		Przyczyna: ładowanie obrazu
 	</floater.string>
 	<floater.string name="client_texture_memory_cause_msg">
-		Przyczyna: Za dużo obrazów w pamięci
+		Przyczyna: za dużo obrazów w pamięci
 	</floater.string>
 	<floater.string name="client_complex_objects_cause_msg">
-		Przyczyna: Za dużo złożonych obiektów
+		Przyczyna: za dużo złożonych obiektów
 	</floater.string>
 	<floater.string name="network_text_msg">
 		Sieć
@@ -103,22 +103,22 @@
 		W normie
 	</floater.string>
 	<floater.string name="server_physics_cause_msg">
-		Przyczyna: Za dużo obiektów fizycznych
+		Przyczyna: za dużo obiektów fizycznych
 	</floater.string>
 	<floater.string name="server_scripts_cause_msg">
-		Przyczyna: Za dużo obieków skryptowanych
+		Przyczyna: za dużo obieków skryptowanych
 	</floater.string>
 	<floater.string name="server_net_cause_msg">
-		Przyczyna: Za duży ruch w sieci
+		Przyczyna: za duży ruch w sieci
 	</floater.string>
 	<floater.string name="server_agent_cause_msg">
-		Przyczyna: Za dużo poruszających się awatarów w regionie
+		Przyczyna: za dużo poruszających się awatarów w regionie
 	</floater.string>
 	<floater.string name="server_images_cause_msg">
-		Przyczyna: Za dużo kalkulacji obrazu
+		Przyczyna: za dużo kalkulacji obrazu
 	</floater.string>
 	<floater.string name="server_generic_cause_msg">
-		Przyczyna: Symulator ładuje się zbyt powoli
+		Przyczyna: symulator ładuje się zbyt powoli
 	</floater.string>
 	<floater.string name="smaller_label">
 		&gt;&gt;
diff --git a/indra/newview/skins/default/xui/pl/floater_lsl_guide.xml b/indra/newview/skins/default/xui/pl/floater_lsl_guide.xml
index 0dc5b9f663..7b1b395f87 100644
--- a/indra/newview/skins/default/xui/pl/floater_lsl_guide.xml
+++ b/indra/newview/skins/default/xui/pl/floater_lsl_guide.xml
@@ -3,5 +3,5 @@
 	<check_box label="Idź za kursorem" name="lock_check"/>
 	<combo_box label="Zablokuj" name="history_combo"/>
 	<button label="Wróć" name="back_btn"/>
-	<button label="Do Przodu" name="fwd_btn"/>
+	<button label="Do przodu" name="fwd_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_media_browser.xml b/indra/newview/skins/default/xui/pl/floater_media_browser.xml
index 4a513f146d..9787736ad8 100644
--- a/indra/newview/skins/default/xui/pl/floater_media_browser.xml
+++ b/indra/newview/skins/default/xui/pl/floater_media_browser.xml
@@ -3,15 +3,15 @@
 	<layout_stack name="stack1">
 		<layout_panel name="nav_controls">
 			<button label="Wróć" name="back"/>
-			<button label="Do Przodu" name="forward"/>
+			<button label="Do przodu" name="forward"/>
 			<button label="Załaduj" name="reload"/>
 			<button label="Idź" name="go"/>
 		</layout_panel>
 		<layout_panel name="parcel_owner_controls">
-			<button label="Wyślij bieżącą Stronę do Parceli" name="assign"/>
+			<button label="Wyślij bieżącą stronę do Parceli" name="assign"/>
 		</layout_panel>
 		<layout_panel name="external_controls">
-			<button label="Użyj Mojej Przeglądarki" name="open_browser"/>
+			<button label="Użyj mojej przeglądarki" name="open_browser"/>
 			<check_box label="Zawsze otwieraj w mojej przeglądarce internetowej" name="open_always"/>
 			<button label="Zamknij" name="close"/>
 		</layout_panel>
diff --git a/indra/newview/skins/default/xui/pl/floater_mem_leaking.xml b/indra/newview/skins/default/xui/pl/floater_mem_leaking.xml
index 87d74f6c15..9ce99692d0 100644
--- a/indra/newview/skins/default/xui/pl/floater_mem_leaking.xml
+++ b/indra/newview/skins/default/xui/pl/floater_mem_leaking.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="MemLeak" title="STYMULACJA WYCIEKU PAMIĘCI">
-	<spinner label="Prędkość Przecieków (byty na klatkę):" name="leak_speed"/>
-	<spinner label="Max Przecieki (MB):" name="max_leak"/>
+	<spinner label="Prędkość przecieków (byty na klatkę):" name="leak_speed"/>
+	<spinner label="Max przecieki (MB):" name="max_leak"/>
 	<text name="total_leaked_label">
 		Przeciekło: [SIZE] KB
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_moveview.xml b/indra/newview/skins/default/xui/pl/floater_moveview.xml
index 9f93335177..9c97a8a0e7 100644
--- a/indra/newview/skins/default/xui/pl/floater_moveview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_moveview.xml
@@ -28,8 +28,8 @@
 		Lataj
 	</string>
 	<panel name="panel_actions">
-		<button label="" label_selected="" name="turn left btn" tool_tip="Obróć w Lewo (naciśnij Lewą Strzałkę lub A)"/>
-		<button label="" label_selected="" name="turn right btn" tool_tip="Obróć w Prawo (naciśnij Prawą Strzałkę lub D)"/>
+		<button label="" label_selected="" name="turn left btn" tool_tip="Obróć w lewo (naciśnij Lewą Strzałkę lub A)"/>
+		<button label="" label_selected="" name="turn right btn" tool_tip="Obróć w prawo (naciśnij Prawą Strzałkę lub D)"/>
 		<button label="" label_selected="" name="move up btn" tool_tip="Leć do góry, naciśnij E"/>
 		<button label="" label_selected="" name="move down btn" tool_tip="Leć w dół, naciśnij C"/>
 		<joystick_turn name="forward btn" tool_tip="Idź (naciśnij Strzałkę w Górę lub W)"/>
@@ -38,6 +38,6 @@
 	<panel name="panel_modes">
 		<button label="" name="mode_walk_btn" tool_tip="Tryb chodzenia"/>
 		<button label="" name="mode_run_btn" tool_tip="Tryb biegu"/>
-		<button label="" name="mode_fly_btn" tool_tip="Tryb Latania"/>
+		<button label="" name="mode_fly_btn" tool_tip="Tryb latania"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_openobject.xml b/indra/newview/skins/default/xui/pl/floater_openobject.xml
index e30fbe3889..8e94ae821c 100644
--- a/indra/newview/skins/default/xui/pl/floater_openobject.xml
+++ b/indra/newview/skins/default/xui/pl/floater_openobject.xml
@@ -4,5 +4,5 @@
 		[DESC]:
 	</text>
 	<button label="Kopiuj do Szafy" label_selected="Kopiuj do Szafy" name="copy_to_inventory_button"/>
-	<button label="Kopiuj i Zalóż" label_selected="Kopiuj i Załóż" name="copy_and_wear_button"/>
+	<button label="Kopiuj i zalóż" label_selected="Kopiuj i załóż" name="copy_and_wear_button"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_outfit_save_as.xml b/indra/newview/skins/default/xui/pl/floater_outfit_save_as.xml
index 7e55f6db3b..a8d2e10c5f 100644
--- a/indra/newview/skins/default/xui/pl/floater_outfit_save_as.xml
+++ b/indra/newview/skins/default/xui/pl/floater_outfit_save_as.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="modal container" title="Stwórz Ubranie">
+<floater name="modal container" title="Stwórz ubranie">
 	<button label="Zapisz" label_selected="Zapisz" name="Save"/>
 	<button label="Anuluj" label_selected="Anuluj" name="Cancel"/>
 	<text name="Save item as:">
diff --git a/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml b/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
index 5522c02631..8a70cb3247 100644
--- a/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
+++ b/indra/newview/skins/default/xui/pl/floater_outgoing_call.xml
@@ -4,7 +4,7 @@
 		5
 	</floater.string>
 	<floater.string name="localchat">
-		Rozmowy Głosowe w Pobliżu
+		Rozmowy głosowe w pobliżu
 	</floater.string>
 	<floater.string name="anonymous">
 		anonimowy
@@ -13,7 +13,7 @@
 		dzwoni.
 	</floater.string>
 	<floater.string name="VoiceInviteAdHoc">
-		uczestniczy w Konferencyjnej Rozmowie Głosowej
+		uczestniczy w konferencyjnej rozmowie głosowej
 	</floater.string>
 	<text name="connecting">
 		Łączy z [CALLEE_NAME]
@@ -25,10 +25,10 @@
 		Brak odpowiedzi. Proszę spróbować ponownie później.
 	</text>
 	<text name="nearby">
-		Zostaleś rozłączony od [VOICE_CHANNEL_NAME].  [RECONNECT_NEARBY]
+		Zostaleś rozłączony z [VOICE_CHANNEL_NAME].  [RECONNECT_NEARBY]
 	</text>
 	<text name="nearby_P2P_by_other">
-		[VOICE_CHANNEL_NAME] has ended the call.  [RECONNECT_NEARBY]
+		[VOICE_CHANNEL_NAME] zakończył/a rozmowę głosową.  [RECONNECT_NEARBY]
 	</text>
 	<text name="nearby_P2P_by_agent">
 		Zakończyłeś rozmowę.  [RECONNECT_NEARBY]
diff --git a/indra/newview/skins/default/xui/pl/floater_perm_prefs.xml b/indra/newview/skins/default/xui/pl/floater_perm_prefs.xml
index 1b0dd6113e..2128cfa3c8 100644
--- a/indra/newview/skins/default/xui/pl/floater_perm_prefs.xml
+++ b/indra/newview/skins/default/xui/pl/floater_perm_prefs.xml
@@ -5,7 +5,7 @@
 		<check_box label="Udostępnij grupie" name="share_with_group"/>
 		<check_box label="Pozwól kopiować każdemu" name="everyone_copy"/>
 		<text name="NextOwnerLabel">
-			Następny właściciel:
+			Następny Właściciel:
 		</text>
 		<check_box label="Modyfikuje" name="next_owner_modify"/>
 		<check_box label="Kopiuje" name="next_owner_copy"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_post_process.xml b/indra/newview/skins/default/xui/pl/floater_post_process.xml
index 6bd91f97b1..a3515915bf 100644
--- a/indra/newview/skins/default/xui/pl/floater_post_process.xml
+++ b/indra/newview/skins/default/xui/pl/floater_post_process.xml
@@ -16,40 +16,40 @@
 			</text>
 			<slider label="" name="wmiColorFilterContrast" />
 			<text name="wmiColorFilterBaseText">
-				Kontrast Koloru Podstawowego
+				Kontrast koloru podstawowego
 			</text>
 			<slider label="R" name="wmiColorFilterBaseR" />
 			<slider label="G" name="wmiColorFilterBaseG" />
 			<slider label="B" name="wmiColorFilterBaseB" />
 			<slider label="I" name="wmiColorFilterBaseI" />
 		</panel>
-		<panel label="Wizja Nocna" name="wmiNightVisionPanel">
+		<panel label="Wizja nocna" name="wmiNightVisionPanel">
 			<check_box label="Udostępnij" name="wmiNightVisionToggle" />
 			<text name="wmiNightVisionBrightMultText">
-				Wielokrotne Wzmocnienie Światła
+				Wielokrotne wzmocnienie światła
 			</text>
 			<slider label="" name="wmiNightVisionBrightMult" />
 			<text name="wmiNightVisionNoiseSizeText">
-				Rozmiar Szumu
+				Rozmiar szumu
 			</text>
 			<slider label="" name="wmiNightVisionNoiseSize" />
 			<text name="wmiNightVisionNoiseStrengthText">
-				Moc Szumu
+				Moc szumu
 			</text>
 			<slider label="" name="wmiNightVisionNoiseStrength" />
 		</panel>
 		<panel label="Bloom" name="wmiBloomPanel">
 			<check_box label="Udostępnij" name="wmiBloomToggle" />
 			<text name="wmiBloomExtractText">
-				Ekstracja Luminacji
+				Ekstracja luminacji
 			</text>
 			<slider label="" name="wmiBloomExtract" />
 			<text name="wmiBloomSizeText">
-				Rozmiar Rozmazania Obrazu
+				Rozmiar rozmazania obrazu
 			</text>
 			<slider label="" name="wmiBloomSize" />
 			<text name="wmiBloomStrengthText">
-				Moc Rozmazania Obrazu
+				Moc rozmazania obrazu
 			</text>
 			<slider label="" name="wmiBloomStrength" />
 		</panel>
diff --git a/indra/newview/skins/default/xui/pl/floater_postcard.xml b/indra/newview/skins/default/xui/pl/floater_postcard.xml
index 362483e2fd..095974aa61 100644
--- a/indra/newview/skins/default/xui/pl/floater_postcard.xml
+++ b/indra/newview/skins/default/xui/pl/floater_postcard.xml
@@ -20,7 +20,7 @@
 		Wpisz treść swojej wiadomości tutaj
 	</text_editor>
 	<text name="fine_print">
-		Jeżeli odbiorca tej pocztówki dołączy do [SECOND_LIFE], otrzymasz bonusa.
+		Jeżeli Odbiorca tej pocztówki dołączy do [SECOND_LIFE], otrzymasz bonus.
 	</text>
 	<button label="Anuluj" name="cancel_btn"/>
 	<button label="Wyślij" name="send_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_animation.xml b/indra/newview/skins/default/xui/pl/floater_preview_animation.xml
index 386d703eb3..6ce6914771 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_animation.xml
@@ -6,6 +6,6 @@
 	<text name="desc txt">
 		Opis:
 	</text>
-	<button label="Uruchom in-world" label_selected="Stop" left="20" name="Anim play btn" tool_tip="Uruchom tę animację by widzieli ją pozostali Rezydenci" width="131"/>
-	<button label="Używaj lokalnie" label_selected="Stop" left="162" name="Anim audition btn" tool_tip="Uruchom tę animację widoczną tylko przez Ciebie" width="125"/>
+	<button label="Uruchom in-world" label_selected="Stop" left="20" name="Anim play btn" tool_tip="Uruchom animację by widzieli ją pozostali Rezydenci" width="131"/>
+	<button label="Używaj lokalnie" label_selected="Stop" left="162" name="Anim audition btn" tool_tip="Uruchom animację widoczną tylko przez Ciebie" width="125"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_event.xml b/indra/newview/skins/default/xui/pl/floater_preview_event.xml
index 180cdea6e8..5d9e47bc00 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_event.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_event.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="event_preview" title="INFORMACJE O IMPREZIE">
+<floater name="event_preview" title="INFO O IMPREZIE">
 	<floater.string name="Title">
 		Impreza: [NAME]
 	</floater.string>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml b/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
index ba4fa736b1..05758ac04d 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_gesture.xml
@@ -22,7 +22,7 @@
 		-- Brak --
 	</floater.string>
 	<floater.string name="Title">
-		Gestura: [NAME]
+		Gest: [NAME]
 	</floater.string>
 	<text name="name_text">
 		Nazwa:
@@ -50,8 +50,8 @@
 	<text name="steps_label">
 		Etapy:
 	</text>
-	<button label="W Górę" name="up_btn"/>
-	<button label="W Dół" name="down_btn"/>
+	<button label="W górę" name="up_btn"/>
+	<button label="W dół" name="down_btn"/>
 	<button label="Usuń" name="delete_btn"/>
 	<radio_group name="animation_trigger_type">
 		<radio_item label="Start" name="start"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_gesture_info.xml b/indra/newview/skins/default/xui/pl/floater_preview_gesture_info.xml
index 8f760d5085..d31cada96d 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_gesture_info.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_gesture_info.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="GESTURA"/>
+<floater name="Gesture" title="GEST"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_gesture_shortcut.xml b/indra/newview/skins/default/xui/pl/floater_preview_gesture_shortcut.xml
index 2dc9917435..d33b799476 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_gesture_shortcut.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_gesture_shortcut.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="GESTURY">
+<floater name="Gesture" title="GESTY">
 	<text name="trigger_label">
 		Czat:
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_gesture_steps.xml b/indra/newview/skins/default/xui/pl/floater_preview_gesture_steps.xml
index 74fb0c258e..6592d9dad0 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_gesture_steps.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_gesture_steps.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Gesture" title="GESTURY"/>
+<floater name="Gesture" title="GESTY"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml b/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
index eb8b5c1a46..1ad07c236b 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_notecard.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="preview notecard" title="NOTA:">
 	<floater.string name="no_object">
-		Nie można znaleść obiektu zawierającego tą notkę.
+		Nie można znaleźć obiektu zawierającego tą notkę.
 	</floater.string>
 	<floater.string name="not_allowed">
 		Nie masz pozwolenia na zobaczenie tej notki.
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_sound.xml b/indra/newview/skins/default/xui/pl/floater_preview_sound.xml
index 230f432e09..d02b3ca75e 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_sound.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_sound.xml
@@ -7,5 +7,5 @@
 		Opis:
 	</text>
 	<button label="Odtwarzaj" label_selected="Odtwarzaj" left_delta="-136" name="Sound play btn" tool_tip="Dźwięk będzie słyszalny przez wszystkich." width="130"/>
-	<button label="Odtwarzaj Lokalnie" label_selected="Odtwarzaj Lokalnie" name="Sound audition btn" tool_tip="Dźwięk będzie słyszalny tylko dla Ciebie."/>
+	<button label="Odtwarzaj Lokalnie" label_selected="Odtwarzaj lokalnie" name="Sound audition btn" tool_tip="Dźwięk będzie słyszalny tylko dla Ciebie."/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_preview_texture.xml b/indra/newview/skins/default/xui/pl/floater_preview_texture.xml
index 698a63e74a..e58acee139 100644
--- a/indra/newview/skins/default/xui/pl/floater_preview_texture.xml
+++ b/indra/newview/skins/default/xui/pl/floater_preview_texture.xml
@@ -13,13 +13,13 @@
 		[WIDTH]px x [HEIGHT]px
 	</text>
 	<text name="aspect_ratio">
-		Zobacz Proporcje
+		Zobacz proporcje
 	</text>
 	<combo_box name="combo_aspect_ratio" tool_tip="Wyświetl w domyślnych proporcjach">
 		<combo_item name="Unconstrained">
 			Swobodny
 		</combo_item>
-		<combo_item name="1:1" tool_tip="Insygnia Grupy lub Realny Profil">
+		<combo_item name="1:1" tool_tip="Insygnia Grupy lub realny Profil">
 			1:1
 		</combo_item>
 		<combo_item name="4:3" tool_tip="[SECOND_LIFE] profil">
diff --git a/indra/newview/skins/default/xui/pl/floater_region_info.xml b/indra/newview/skins/default/xui/pl/floater_region_info.xml
index ae00f90f16..a1f7785f48 100644
--- a/indra/newview/skins/default/xui/pl/floater_region_info.xml
+++ b/indra/newview/skins/default/xui/pl/floater_region_info.xml
@@ -1,2 +1,2 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="regioninfo" title="REGION/ESTATE"/>
+<floater name="regioninfo" title="REGION/MAJĄTEK"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_report_abuse.xml b/indra/newview/skins/default/xui/pl/floater_report_abuse.xml
index 18ce1b230f..a6f8ba6c11 100644
--- a/indra/newview/skins/default/xui/pl/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/pl/floater_report_abuse.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="floater_report_abuse" title="RAPORT O NADUŻYCIU">
 	<floater.string name="Screenshot">
-		Zdjęcie Ekranu
+		Zdjęcie ekranu
 	</floater.string>
 	<check_box label="Załącz zdjęcie do raportu" name="screen_check"/>
 	<text name="reporter_title">
@@ -40,42 +40,42 @@
 	</text>
 	<combo_box name="category_combo" tool_tip="Wybór kategorii - wybierz kategorię, której dotyczy raport">
 		<combo_box.item label="Wybierz Kategorię:" name="Select_category"/>
-		<combo_box.item label="Wiek &gt; Udawanie Nieletniej Osoby" name="Age__Age_play"/>
+		<combo_box.item label="Wiek &gt; Udawanie nieletniej osoby" name="Age__Age_play"/>
 		<combo_box.item label="Wiek &gt; Dorosły Rezydent w Teen Second Life" name="Age__Adult_resident_on_Teen_Second_Life"/>
 		<combo_box.item label="Wiek &gt; Nieletni Rezydent poza Teen Second Life" name="Age__Underage_resident_outside_of_Teen_Second_Life"/>
-		<combo_box.item label="Napaść &gt; Strefa Militarna / Niebezpieczny Obszar" name="Assault__Combat_sandbox___unsafe_area"/>
-		<combo_box.item label="Napaść &gt; Bezpieczny Obszar" name="Assault__Safe_area"/>
-		<combo_box.item label="Napaść &gt; Obszar do Testowania Broni" name="Assault__Weapons_testing_sandbox"/>
-		<combo_box.item label="Handel &gt; Niedostarczenie Produktu lub Usługi" name="Commerce__Failure_to_deliver_product_or_service"/>
-		<combo_box.item label="Naruszenie Prywatności &gt; Dane Osobiste" name="Disclosure__Real_world_information"/>
-		<combo_box.item label="Ujawnienie &gt; Monitorowanie Czatu" name="Disclosure__Remotely_monitoring chat"/>
-		<combo_box.item label="Ujawnienie &gt; Dane z Second Life / Czatu / IM" name="Disclosure__Second_Life_information_chat_IMs"/>
-		<combo_box.item label="Zakłócanie Spokoju &gt; Nieuczciwe Używanie Zasobów Regionu" name="Disturbing_the_peace__Unfair_use_of_region_resources"/>
-		<combo_box.item label="Zakłócanie Spokoju &gt; Przesadnie Skryptowane Obiekty" name="Disturbing_the_peace__Excessive_scripted_objects"/>
-		<combo_box.item label="Zakłócanie Spokoju &gt; Śmiecenie Obiektami" name="Disturbing_the_peace__Object_littering"/>
-		<combo_box.item label="Zakłócanie Spokoju &gt; Ciągły Spam" name="Disturbing_the_peace__Repetitive_spam"/>
-		<combo_box.item label="Zakłócanie Spokoju &gt; Nieporządany Spam Reklamowy" name="Disturbing_the_peace__Unwanted_advert_spam"/>
+		<combo_box.item label="Napaść &gt; strefa militarna / niebezpieczny obszar" name="Assault__Combat_sandbox___unsafe_area"/>
+		<combo_box.item label="Napaść &gt; nezpieczny obszar" name="Assault__Safe_area"/>
+		<combo_box.item label="Napaść &gt; obszar do testowania broni" name="Assault__Weapons_testing_sandbox"/>
+		<combo_box.item label="Handel &gt; niedostarczenie produktu lub usługi" name="Commerce__Failure_to_deliver_product_or_service"/>
+		<combo_box.item label="Naruszenie prywatności &gt; dane osobiste" name="Disclosure__Real_world_information"/>
+		<combo_box.item label="Ujawnienie &gt; monitorowanie czatu" name="Disclosure__Remotely_monitoring chat"/>
+		<combo_box.item label="Ujawnienie &gt; dane z Second Life / Czatu / IM" name="Disclosure__Second_Life_information_chat_IMs"/>
+		<combo_box.item label="Zakłócanie spokoju &gt; nieuczciwe używanie zasobów Regionu" name="Disturbing_the_peace__Unfair_use_of_region_resources"/>
+		<combo_box.item label="Zakłócanie spokoju &gt; przesadnie skryptowane obiekty" name="Disturbing_the_peace__Excessive_scripted_objects"/>
+		<combo_box.item label="Zakłócanie spokoju &gt; śmiecenie obiektami" name="Disturbing_the_peace__Object_littering"/>
+		<combo_box.item label="Zakłócanie spokoju &gt; ciągły spam" name="Disturbing_the_peace__Repetitive_spam"/>
+		<combo_box.item label="Zakłócanie spokoju &gt; nieporządany spam reklamowy" name="Disturbing_the_peace__Unwanted_advert_spam"/>
 		<combo_box.item label="Oszustwo &gt; L$" name="Fraud__L$"/>
 		<combo_box.item label="Oszustwo &gt; Posiadłości" name="Fraud__Land"/>
-		<combo_box.item label="Oszustwo &gt; Piramidy albo Listy Łańcuchowe" name="Fraud__Pyramid_scheme_or_chain_letter"/>
+		<combo_box.item label="Oszustwo &gt; piramidy albo listy łańcuchowe" name="Fraud__Pyramid_scheme_or_chain_letter"/>
 		<combo_box.item label="Oszustwo &gt; US$" name="Fraud__US$"/>
-		<combo_box.item label="Prześladowanie &gt; Farmy Reklamowe / Wizualny Spam" name="Harassment__Advert_farms___visual_spam"/>
-		<combo_box.item label="Prześladowanie &gt; Zniesławianie Jedostek lub Grup" name="Harassment__Defaming_individuals_or_groups"/>
-		<combo_box.item label="Prześladowanie &gt; Ograniczanie Ruchu" name="Harassment__Impeding_movement"/>
-		<combo_box.item label="Prześladowanie &gt; Molestowanie Seksualne" name="Harassment__Sexual_harassment"/>
-		<combo_box.item label="Prześladowanie &gt; Namawianie/Zachęcanie Innych do Łamania Warunków Umowy (ToS)" name="Harassment__Solicting_inciting_others_to_violate_ToS"/>
+		<combo_box.item label="Prześladowanie &gt; farmy reklamowe / wizualny spam" name="Harassment__Advert_farms___visual_spam"/>
+		<combo_box.item label="Prześladowanie &gt; zniesławianie jedostek lub grup" name="Harassment__Defaming_individuals_or_groups"/>
+		<combo_box.item label="Prześladowanie &gt; Ograniczanie ruchu" name="Harassment__Impeding_movement"/>
+		<combo_box.item label="Prześladowanie &gt; Molestowanie seksualne" name="Harassment__Sexual_harassment"/>
+		<combo_box.item label="Prześladowanie &gt; Namawianie/Zachęcanie innych do łamania warunków umowy (ToS)" name="Harassment__Solicting_inciting_others_to_violate_ToS"/>
 		<combo_box.item label="Prześladowanie &gt; Znieważanie Słowne" name="Harassment__Verbal_abuse"/>
-		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa Treść lub Postępowanie" name="Indecency__Broadly_offensive_content_or_conduct"/>
-		<combo_box.item label="Nieprzyzwoitość &gt; Niestosowne Imię Awatara" name="Indecency__Inappropriate_avatar_name"/>
-		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa treść i postępowanie w regionie &apos;PG&apos;" name="Indecency__Mature_content_in_PG_region"/>
-		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa treść i postępowanie w regionie &apos;Mature&apos;" name="Indecency__Inappropriate_content_in_Mature_region"/>
-		<combo_box.item label="Naruszenie Własności Intelektualnej &gt; Usunięcie Treści" name="Intellectual_property_infringement_Content_Removal"/>
-		<combo_box.item label="Naruszenie Własności Intelektualnej &gt; CopyBot albo Nadużycie Przywilejów" name="Intellectual_property_infringement_CopyBot_or_Permissions_Exploit"/>
+		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa treść lub postępowanie" name="Indecency__Broadly_offensive_content_or_conduct"/>
+		<combo_box.item label="Nieprzyzwoitość &gt; Niestosowne imię awatara" name="Indecency__Inappropriate_avatar_name"/>
+		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa treść i postępowanie w Regionie &apos;PG&apos;" name="Indecency__Mature_content_in_PG_region"/>
+		<combo_box.item label="Nieprzyzwoitość &gt; Obraźliwa treść i postępowanie w Regionie &apos;Mature&apos;" name="Indecency__Inappropriate_content_in_Mature_region"/>
+		<combo_box.item label="Naruszenie własności intelektualnej &gt; usunięcie treści" name="Intellectual_property_infringement_Content_Removal"/>
+		<combo_box.item label="Naruszenie własności intelektualnej &gt; CopyBot albo nadużycie przywilejów" name="Intellectual_property_infringement_CopyBot_or_Permissions_Exploit"/>
 		<combo_box.item label="Nietolerancja" name="Intolerance"/>
-		<combo_box.item label="Posiadłości &gt; Nadużywanie Piaskownicy" name="Land__Abuse_of_sandbox_resources"/>
-		<combo_box.item label="Posiadłości &gt; Naruszenie &gt; Obiekty/Tekstury" name="Land__Encroachment__Objects_textures"/>
-		<combo_box.item label="Posiadłości &gt; Naruszenie &gt; Cząsteczki" name="Land__Encroachment__Particles"/>
-		<combo_box.item label="Posiadłości &gt; Naruszenie &gt; Drzewa/Rośliny" name="Land__Encroachment__Trees_plants"/>
+		<combo_box.item label="Posiadłości &gt; nadużywanie piaskownicy" name="Land__Abuse_of_sandbox_resources"/>
+		<combo_box.item label="Posiadłości &gt; naruszenie &gt; obiekty/tekstury" name="Land__Encroachment__Objects_textures"/>
+		<combo_box.item label="Posiadłości &gt; naruszenie &gt; cząsteczki" name="Land__Encroachment__Particles"/>
+		<combo_box.item label="Posiadłości &gt; naruszenie &gt; drzewa/rośliny" name="Land__Encroachment__Trees_plants"/>
 		<combo_box.item label="Zakłady/Hazard" name="Wagering_gambling"/>
 		<combo_box.item label="Inne" name="Other"/>
 	</combo_box>
diff --git a/indra/newview/skins/default/xui/pl/floater_script_queue.xml b/indra/newview/skins/default/xui/pl/floater_script_queue.xml
index c20decdd00..bdfdba569e 100644
--- a/indra/newview/skins/default/xui/pl/floater_script_queue.xml
+++ b/indra/newview/skins/default/xui/pl/floater_script_queue.xml
@@ -7,7 +7,7 @@
 		Wykonane.
 	</floater.string>
 	<floater.string name="Resetting">
-		Trwa reset
+		Trwa resetowanie
 	</floater.string>
 	<floater.string name="Running">
 		Skrypt działa
diff --git a/indra/newview/skins/default/xui/pl/floater_script_search.xml b/indra/newview/skins/default/xui/pl/floater_script_search.xml
index a2812406a4..cb010daee4 100644
--- a/indra/newview/skins/default/xui/pl/floater_script_search.xml
+++ b/indra/newview/skins/default/xui/pl/floater_script_search.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="script search" title="SZUKAJ SKRYPTU">
-	<check_box label="CapsLoock Nieaktywny" name="case_text"/>
+	<check_box label="CapsLoock nieaktywny" name="case_text"/>
 	<button label="Szukaj" label_selected="Szukaj" name="search_btn"/>
 	<button label="Zamień" label_selected="Zamień" name="replace_btn"/>
-	<button label="Zamień Wszystko" label_selected="Zamień Wszystko" name="replace_all_btn"/>
+	<button label="Zamień Wszystko" label_selected="Zamień wszystko" name="replace_all_btn"/>
 	<text name="txt">
 		Szukaj
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/floater_sell_land.xml b/indra/newview/skins/default/xui/pl/floater_sell_land.xml
index 1670becbbb..eb1ed74797 100644
--- a/indra/newview/skins/default/xui/pl/floater_sell_land.xml
+++ b/indra/newview/skins/default/xui/pl/floater_sell_land.xml
@@ -58,7 +58,7 @@
 			<text name="nag_message_label">
 				PAMIĘTAJ: Sprzedaż jest nieodwracalna.
 			</text>
-			<button label="Wystaw Ziemię na Sprzedaż" name="sell_btn"/>
+			<button label="Wystaw ziemię na sprzedaż" name="sell_btn"/>
 			<button label="Anuluj" name="cancel_btn"/>
 		</panel>
 	</scroll_container>
diff --git a/indra/newview/skins/default/xui/pl/floater_snapshot.xml b/indra/newview/skins/default/xui/pl/floater_snapshot.xml
index 0b15727daa..df4e5b43bc 100644
--- a/indra/newview/skins/default/xui/pl/floater_snapshot.xml
+++ b/indra/newview/skins/default/xui/pl/floater_snapshot.xml
@@ -11,7 +11,7 @@
 	<text name="file_size_label">
 		[SIZE] KB
 	</text>
-	<button label="Odśwież Zdjęcie" name="new_snapshot_btn"/>
+	<button label="Odśwież zdjęcie" name="new_snapshot_btn"/>
 	<button label="Wyślij" name="send_btn"/>
 	<button label="Załaduj (L$[AMOUNT])" name="upload_btn"/>
 	<flyout_button label="Zapisz" name="save_btn" tool_tip="Zapisz zdjęcie na dysk">
@@ -66,7 +66,7 @@
 	<combo_box label="Warstwy Obrazu" name="layer_types">
 		<combo_box.item label="Kolory" name="Colors"/>
 		<combo_box.item label="Głębokość" name="Depth"/>
-		<combo_box.item label="Obiekty Ślepe" name="ObjectMattes"/>
+		<combo_box.item label="Obiekty ślepe" name="ObjectMattes"/>
 	</combo_box>
 	<check_box label="Pokaż interfejs na zdjęciu" name="ui_check"/>
 	<check_box label="Pokaż obiekty HUD na zdjęciu" name="hud_check"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_sound_preview.xml b/indra/newview/skins/default/xui/pl/floater_sound_preview.xml
index c66ac0a98f..ac041dff6a 100644
--- a/indra/newview/skins/default/xui/pl/floater_sound_preview.xml
+++ b/indra/newview/skins/default/xui/pl/floater_sound_preview.xml
@@ -7,5 +7,5 @@
 		Opis:
 	</text>
 	<button label="Anuluj" label_selected="Anuluj" name="cancel_btn"/>
-	<button label="Załaduj (L$[AMOUNT])" label_selected="Załaduj (L$[AMOUNT])" name="ok_btn"/>
+	<button label="Załaduj ([AMOUNT]L$)" label_selected="Załaduj ([AMOUNT]L$)" name="ok_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_stats.xml b/indra/newview/skins/default/xui/pl/floater_stats.xml
index acd3df0585..ee5fba4d63 100644
--- a/indra/newview/skins/default/xui/pl/floater_stats.xml
+++ b/indra/newview/skins/default/xui/pl/floater_stats.xml
@@ -3,17 +3,17 @@
 	<scroll_container name="statistics_scroll">
 		<container_view name="statistics_view">
 			<stat_view label="Podstawowe" name="basic">
-				<stat_bar label="Ilość Obrazów/Sec (FPS)" name="fps"/>
+				<stat_bar label="Ilość obrazów/sek (FPS)" name="fps"/>
 				<stat_bar label="Przepustowość" name="bandwidth"/>
-				<stat_bar label="Stracone Pakiety" name="packet_loss"/>
-				<stat_bar label="Ping Sim" name="ping"/>
+				<stat_bar label="Stracone pakiety" name="packet_loss"/>
+				<stat_bar label="Ping sim" name="ping"/>
 			</stat_view>
 			<stat_view label="Zaawansowane" name="advanced">
 				<stat_view label="Renderuj" name="render">
 					<stat_bar label="KTris Drawn" name="ktrisframe"/>
 					<stat_bar label="KTris Drawn" name="ktrissec"/>
-					<stat_bar label="Wszystkie Obiekty" name="objs"/>
-					<stat_bar label="Nowe Obiekty" name="newobjs"/>
+					<stat_bar label="Wszystkie obiekty" name="objs"/>
+					<stat_bar label="Nowe obiekty" name="newobjs"/>
 				</stat_view>
 				<stat_view label="Tekstura" name="texture">
 					<stat_bar label="Suma" name="numimagesstat"/>
@@ -24,8 +24,8 @@
 					<stat_bar label="Bound Mem" name="glboundmemstat"/>
 				</stat_view>
 				<stat_view label="Sieć" name="network">
-					<stat_bar label="Pakiety Wewnętrzne" name="packetsinstat"/>
-					<stat_bar label="Pakiety Zewnętrzne" name="packetsoutstat"/>
+					<stat_bar label="Pakiety wewnętrzne" name="packetsinstat"/>
+					<stat_bar label="Pakiety zewnętrzne" name="packetsoutstat"/>
 					<stat_bar label="Obiekty" name="objectkbitstat"/>
 					<stat_bar label="Tesktura" name="texturekbitstat"/>
 					<stat_bar label="Asset" name="assetkbitstat"/>
@@ -40,30 +40,30 @@
 				<stat_bar label="Ilość Obrazów/Sec na Symulatorze (Sim FPS)" name="simfps"/>
 				<stat_bar label="Fizyka Obrazów/Sec" name="simphysicsfps"/>
 				<stat_view label="Szczegóły Fizyki" name="physicsdetail">
-					<stat_bar label="Pinned Objects" name="physicspinnedtasks"/>
+					<stat_bar label="Pinned objects" name="physicspinnedtasks"/>
 					<stat_bar label="Niskie LOD Obiektów" name="physicslodtasks"/>
-					<stat_bar label="Alokacja Pamięci" name="physicsmemoryallocated"/>
-					<stat_bar label="Aktualizacja Agentów/Sec" name="simagentups"/>
-					<stat_bar label="Główni Agenci" name="simmainagents"/>
-					<stat_bar label="Child Agents" name="simchildagents"/>
+					<stat_bar label="Alokacja pamięci" name="physicsmemoryallocated"/>
+					<stat_bar label="Aktualizacja agentów/Sek" name="simagentups"/>
+					<stat_bar label="Główni agenci" name="simmainagents"/>
+					<stat_bar label="Child agents" name="simchildagents"/>
 					<stat_bar label="Obiekty" name="simobjects"/>
-					<stat_bar label="Aktywne Obiekty" name="simactiveobjects"/>
-					<stat_bar label="Aktywne Skrypty" name="simactivescripts"/>
-					<stat_bar label="Wydarzenie Skryptowe" name="simscripteps"/>
-					<stat_bar label="Pakiety Wewnętrzne" name="siminpps"/>
-					<stat_bar label="Pakiety Zewnętrzne" name="simoutpps"/>
-					<stat_bar label="Oczekiwane na Pobranie" name="simpendingdownloads"/>
-					<stat_bar label="Oczekiwane na Załadowanie" name="simpendinguploads"/>
-					<stat_bar label="Wszystkie Niepotwierdzone Bity" name="simtotalunackedbytes"/>
+					<stat_bar label="Aktywne obiekty" name="simactiveobjects"/>
+					<stat_bar label="Aktywne skrypty" name="simactivescripts"/>
+					<stat_bar label="Wydarzenie skryptowe" name="simscripteps"/>
+					<stat_bar label="Pakiety wewnętrzne" name="siminpps"/>
+					<stat_bar label="Pakiety zewnętrzne" name="simoutpps"/>
+					<stat_bar label="Oczekiwane na pobranie" name="simpendingdownloads"/>
+					<stat_bar label="Oczekiwane na załadowanie" name="simpendinguploads"/>
+					<stat_bar label="Wszystkie niepotwierdzone bity" name="simtotalunackedbytes"/>
 				</stat_view>
 				<stat_view label="Czas (ms)" name="simperf">
-					<stat_bar label="Całkowity Czas Obrazu" name="simframemsec"/>
-					<stat_bar label="Czas Sieciowy" name="simnetmsec"/>
-					<stat_bar label="Czas Fizyki" name="simsimphysicsmsec"/>
-					<stat_bar label="Czas Symulatora" name="simsimothermsec"/>
-					<stat_bar label="Czas Agenta" name="simagentmsec"/>
-					<stat_bar label="Czas Obrazu" name="simimagesmsec"/>
-					<stat_bar label="Czas Skryptu" name="simscriptmsec"/>
+					<stat_bar label="Całkowity czas obrazu" name="simframemsec"/>
+					<stat_bar label="Czas sieciowy" name="simnetmsec"/>
+					<stat_bar label="Czas fizyki" name="simsimphysicsmsec"/>
+					<stat_bar label="Czas symulatora" name="simsimothermsec"/>
+					<stat_bar label="Czas agenta" name="simagentmsec"/>
+					<stat_bar label="Czas obrazu" name="simimagesmsec"/>
+					<stat_bar label="Czas skryptu" name="simscriptmsec"/>
 				</stat_view>
 			</stat_view>
 		</container_view>
diff --git a/indra/newview/skins/default/xui/pl/floater_telehub.xml b/indra/newview/skins/default/xui/pl/floater_telehub.xml
index f8a23a6fc3..32cc08810d 100644
--- a/indra/newview/skins/default/xui/pl/floater_telehub.xml
+++ b/indra/newview/skins/default/xui/pl/floater_telehub.xml
@@ -15,10 +15,10 @@
 	<button label="Połącz z teleporterem" name="connect_btn" width="132"/>
 	<button label="Rozłącz" left="152" name="disconnect_btn" width="88"/>
 	<text name="spawn_points_text" width="250">
-		Punkty Składowe (pozycje - nie obiekty!):
+		Punkty składowe (pozycje - nie obiekty!):
 	</text>
-	<button label="Dodaj Punkt" name="add_spawn_point_btn"/>
-	<button label="Usuń Punkt" name="remove_spawn_point_btn"/>
+	<button label="Dodaj punkt" name="add_spawn_point_btn"/>
+	<button label="Usuń punkt" name="remove_spawn_point_btn"/>
 	<text name="spawn_point_help">
 		Wybierz obiekt i wybierz &quot;Dodaj&quot; by sprecyzować pozycję.
 Możesz przesunąć lub usunąć obiekt.
diff --git a/indra/newview/skins/default/xui/pl/floater_texture_ctrl.xml b/indra/newview/skins/default/xui/pl/floater_texture_ctrl.xml
index 8464343ebb..52c0cb8a93 100644
--- a/indra/newview/skins/default/xui/pl/floater_texture_ctrl.xml
+++ b/indra/newview/skins/default/xui/pl/floater_texture_ctrl.xml
@@ -4,7 +4,7 @@
 		Kliknij by wybrać obraz
 	</string>
 	<text name="Multiple">
-		Wiele Tekstur
+		Wiele tekstur
 	</text>
 	<text name="unknown">
 		Rozmiar: [DIMENSIONS]
@@ -12,8 +12,8 @@
 	<button label="Domyślna" label_selected="Domyślna" name="Default"/>
 	<button label="Żadna" label_selected="Żadna" name="None"/>
 	<button label="Pusta" label_selected="Pusta" name="Blank"/>
-	<check_box label="Pokaż Foldery" name="show_folders_check"/>
-	<search_editor label="Filtruj Tektury" name="inventory search editor"/>
+	<check_box label="Pokaż foldery" name="show_folders_check"/>
+	<search_editor label="Filtruj tektury" name="inventory search editor"/>
 	<check_box label="Zastosuj teraz" name="apply_immediate_check"/>
 	<button label="" label_selected="" name="Pipette"/>
 	<button label="Anuluj" label_selected="Anuluj" name="Cancel"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_tools.xml b/indra/newview/skins/default/xui/pl/floater_tools.xml
index e355813f83..5bc3811ef6 100644
--- a/indra/newview/skins/default/xui/pl/floater_tools.xml
+++ b/indra/newview/skins/default/xui/pl/floater_tools.xml
@@ -154,10 +154,10 @@
 				Cena za: L$
 			</panel.string>
 			<panel.string name="Cost Mixed">
-				Cena Mieszana
+				Cena mieszana
 			</panel.string>
 			<panel.string name="Sale Mixed">
-				Sprzedaż Mieszana
+				Sprzedaż mieszana
 			</panel.string>
 			<text name="Name:">
 				Nazwa:
@@ -190,10 +190,10 @@
 				Kliknij:
 			</text>
 			<combo_box name="clickaction">
-				<combo_box.item label="Dotknij  (domyślne)" name="Touch/grab(default)"/>
-				<combo_box.item label="Usiądź na Obiekcie" name="Sitonobject"/>
-				<combo_box.item label="Kup Obiekt" name="Buyobject"/>
-				<combo_box.item label="Zapłać Obiektowi" name="Payobject"/>
+				<combo_box.item label="Dotknij (domyślne)" name="Touch/grab(default)"/>
+				<combo_box.item label="Usiądź na obiekcie" name="Sitonobject"/>
+				<combo_box.item label="Kup obiekt" name="Buyobject"/>
+				<combo_box.item label="Zapłać obiektowi" name="Payobject"/>
 				<combo_box.item label="Otwórz" name="Open"/>
 				<combo_box.item label="Przybliż" name="Zoom"/>
 			</combo_box>
@@ -215,11 +215,11 @@
 				<check_box label="Przesuń" name="checkbox allow everyone move"/>
 				<check_box label="Kopiuj" name="checkbox allow everyone copy"/>
 				<text name="Next owner can:">
-					Następny właściciel:
+					Następny Właściciel:
 				</text>
 				<check_box label="Zmienia" name="checkbox next owner can modify"/>
 				<check_box label="Kopiuje" name="checkbox next owner can copy"/>
-				<check_box label="Oddaje/Sprzedaje" name="checkbox next owner can transfer" tool_tip="Następny właściciel może oddawać lub sprzedawać ten obiekt"/>
+				<check_box label="Oddaje/Sprzedaje" name="checkbox next owner can transfer" tool_tip="Następny Właściciel może oddawać lub sprzedawać ten obiekt"/>
 				<text name="B:">
 					B:
 				</text>
@@ -313,20 +313,20 @@
 				Zwężenie
 			</text>
 			<text name="scale_hole">
-				Rozmiar Wgłębienia
+				Rozmiar wgłębienia
 			</text>
 			<spinner label="X" name="Taper Scale X"/>
 			<spinner label="Y" name="Taper Scale Y"/>
 			<text name="text topshear">
-				Przesunięcie Górne
+				Przesunięcie górne
 			</text>
 			<spinner label="X" name="Shear X"/>
 			<spinner label="Y" name="Shear Y"/>
 			<text name="advanced_cut">
-				Wykrojenie Przekroju (początek/koniec)
+				Wykrojenie przekroju (początek/koniec)
 			</text>
 			<text name="advanced_dimple">
-				Przesunięcie Promienia (początek/koniec)
+				Przesunięcie promienia (początek/koniec)
 			</text>
 			<text name="advanced_slice">
 				Przetnij(początek/koniec)
@@ -346,17 +346,17 @@
 			</text>
 			<spinner name="Radius Offset"/>
 			<spinner name="Revolutions"/>
-			<texture_picker label="Tekstura Skulptowa" name="sculpt texture control" tool_tip="Click to choose a picture"/>
+			<texture_picker label="Tekstura skulptowa" name="sculpt texture control" tool_tip="Click to choose a picture"/>
 			<check_box label="Odbicie" name="sculpt mirror control" tool_tip="Odwraca skulpt wzdłuż osi X."/>
 			<check_box label="Środek na zewnątrz" name="sculpt invert control" tool_tip="Odwraca normalne skulptu."/>
 			<text name="label sculpt type">
-				Typ Ścięgna
+				Typ ścięgna
 			</text>
 			<combo_box name="sculpt type control">
 				<combo_box.item label="(żadne)" name="None"/>
 				<combo_box.item label="Kula" name="Sphere"/>
 				<combo_box.item label="Torus" name="Torus"/>
-				<combo_box.item label="Płaczyzna" name="Plane"/>
+				<combo_box.item label="Płaszczyzna" name="Plane"/>
 				<combo_box.item label="Walec" name="Cylinder"/>
 			</combo_box>
 		</panel>
@@ -454,7 +454,7 @@
 			<spinner label="Powtórzenia / metr" name="rptctrl"/>
 			<button label="Zastosuj" label_selected="Zastosuj" name="button apply"/>
 			<text name="tex offset">
-				Wyrównanie Tekstury
+				Wyrównanie tekstury
 			</text>
 			<spinner label="Poziome (U)" name="TexOffsetU"/>
 			<spinner label="Pionowe (V)" name="TexOffsetV"/>
@@ -469,7 +469,7 @@
 			</panel>
 		</panel>
 		<panel label="Treść" name="Contents">
-			<button label="Nowy Skrypt" label_selected="Nowy Skrypt" name="button new script"/>
+			<button label="Nowy skrypt" label_selected="Nowy skrypt" name="button new script"/>
 			<button label="Prawa" name="button permissions"/>
 		</panel>
 	</tab_container>
@@ -484,13 +484,13 @@
 			Obszar: [AREA] m²
 		</text>
 		<button label="O Posiadłości" label_selected="O Posiadłości" name="button about land"/>
-		<check_box label="Pokaż Właścicieli" name="checkbox show owners" tool_tip="Pokoloruj posiadłości zgodnie z przynależnością do właściciela: 
+		<check_box label="Pokaż Właścicieli" name="checkbox show owners" tool_tip="Pokoloruj Posiadłości zgodnie z przynależnością do Właściciela: 
 
 Zielony = Twoja Posiadłość 
 Morski = Posiadłość Twojej Grupy 
-Czerwony = Posiadłości Innych 
-Żółty = Na Sprzedaż 
-Fioletowy = Na Aukcję 
+Czerwony = Posiadłości innych 
+Żółty = Na sprzedaż 
+Fioletowy = Na aukcję 
 Szary = Publiczna"/>
 		<text name="label_parcel_modify">
 			Modyfikuj Posiadłość
@@ -498,7 +498,7 @@ Szary = Publiczna"/>
 		<button label="Podziel" label_selected="Podziel" name="button subdivide land"/>
 		<button label="Złącz" label_selected="Złącz" name="button join land"/>
 		<text name="label_parcel_trans">
-			Transakcje na posiadłości
+			Transakcje na Posiadłości
 		</text>
 		<button label="Kup Posiadłość" label_selected="Kup Posiadłość" name="button buy land"/>
 		<button label="Porzuć Posiadłość" label_selected="Porzuć Posiadłość" name="button abandon land"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_top_objects.xml b/indra/newview/skins/default/xui/pl/floater_top_objects.xml
index 8d41e0fb13..6afbce7e10 100644
--- a/indra/newview/skins/default/xui/pl/floater_top_objects.xml
+++ b/indra/newview/skins/default/xui/pl/floater_top_objects.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="top_objects" title="Główne Obiekty">
 	<floater.string name="top_scripts_title">
-		Główne Skrypty
+		Główne skrypty
 	</floater.string>
 	<floater.string name="top_scripts_text">
 		[COUNT] skryptów działa w czasie [TIME] ms
@@ -13,7 +13,7 @@
 		Mono Time
 	</floater.string>
 	<floater.string name="top_colliders_title">
-		Główne Kolizje
+		Główne kolizje
 	</floater.string>
 	<floater.string name="top_colliders_text">
 		[COUNT] obiektów odczuwa działanie wielu potencjalnych kolizji
@@ -22,7 +22,7 @@
 		Wynik
 	</floater.string>
 	<floater.string name="none_descriptor">
-		Nie odnalezione
+		Nieodnalezione
 	</floater.string>
 	<text name="title_text">
 		Ładowanie...
@@ -37,11 +37,11 @@
 		<scroll_list.columns label="URL" name="URLs"/>
 	</scroll_list>
 	<text name="id_text">
-		ID Obiektu:
+		ID obiektu:
 	</text>
-	<button label="Pokaż Emitery" name="show_beacon_btn"/>
+	<button label="Pokaż emitery" name="show_beacon_btn"/>
 	<text name="obj_name_text">
-		Nazwa Obiektu:
+		Nazwa obiektu:
 	</text>
 	<button label="Filtr" name="filter_object_btn"/>
 	<text name="owner_name_text">
@@ -49,8 +49,8 @@
 	</text>
 	<button label="Filter" name="filter_owner_btn"/>
 	<button label="Odśwież" name="refresh_btn"/>
-	<button label="Zwróć Wybrane" name="return_selected_btn"/>
-	<button label="Zwróć Wszystko" name="return_all_btn"/>
-	<button label="Deaktywuj Wybrane" name="disable_selected_btn"/>
-	<button label="Deaktywuj Wszystko" name="disable_all_btn"/>
+	<button label="Zwróć wybrane" name="return_selected_btn"/>
+	<button label="Zwróć wszystko" name="return_all_btn"/>
+	<button label="Deaktywuj wybrane" name="disable_selected_btn"/>
+	<button label="Deaktywuj wszystko" name="disable_all_btn"/>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/floater_voice_controls.xml b/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
index 27e2611952..6bee3e911c 100644
--- a/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
+++ b/indra/newview/skins/default/xui/pl/floater_voice_controls.xml
@@ -17,7 +17,7 @@
 	</string>
 	<layout_stack name="my_call_stack">
 		<layout_panel name="my_panel">
-			<text name="user_text" value="Mój Awatar:"/>
+			<text name="user_text" value="Mój awatar:"/>
 		</layout_panel>
 		<layout_panel name="leave_call_btn_panel">
 			<button label="Zakończ" name="leave_call_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_water.xml b/indra/newview/skins/default/xui/pl/floater_water.xml
index 5ea5dbdd0e..9720dae516 100644
--- a/indra/newview/skins/default/xui/pl/floater_water.xml
+++ b/indra/newview/skins/default/xui/pl/floater_water.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="Water Floater" title="ZAAWANSOWANY EDYTOR WODY">
 	<text name="KeyFramePresetsText">
-		Ustawienia Wody:
+		Ustawienia wody:
 	</text>
 	<button label="Nowe" label_selected="Nowe" name="WaterNewPreset"/>
 	<button label="Zapisz" label_selected="Zapisz" name="WaterSavePreset"/>
@@ -9,22 +9,22 @@
 	<tab_container name="Water Tabs">
 		<panel label="USTAWIENIA" name="Settings">
 			<text name="BHText">
-				Kolor Podwodnej Mgły
+				Kolor podwodnej mgły
 			</text>
 			<button label="?" name="WaterFogColorHelp"/>
 			<color_swatch label="" name="WaterFogColor" tool_tip="Kliknij aby wybrać kolor"/>
 			<text name="WaterFogDensText">
-				Wykładnik Gęstości Mgły
+				Wykładnik gęstości mgły
 			</text>
 			<button label="?" name="WaterFogDensityHelp"/>
 			<slider label="" name="WaterFogDensity"/>
 			<text name="WaterUnderWaterFogModText">
-				Modyfikator Mgły
+				Modyfikator mgły
 			</text>
 			<button label="?" name="WaterUnderWaterFogModHelp"/>
 			<slider label="" name="WaterUnderWaterFogMod"/>
 			<text name="BDensText">
-				Skala Zmarszczeń
+				Skala zmarszczeń
 			</text>
 			<button label="?" name="WaterNormalScaleHelp"/>
 			<text name="BHText2">
@@ -50,24 +50,24 @@
 			<button label="?" name="WaterFresnelOffsetHelp"/>
 			<slider label="" name="WaterFresnelOffset"/>
 			<text name="DensMultText">
-				Górna Refrakcja
+				Górna refrakcja
 			</text>
 			<button label="?" name="WaterScaleAboveHelp"/>
 			<slider label="" name="WaterScaleAbove"/>
 			<text name="WaterScaleBelowText">
-				Dolna Refrakcja
+				Dolna refrakcja
 			</text>
 			<button label="?" name="WaterScaleBelowHelp"/>
 			<slider label="" name="WaterScaleBelow"/>
 			<text name="MaxAltText">
-				Mnożnik Rozmycia
+				Mnożnik rozmycia
 			</text>
 			<button label="?" name="WaterBlurMultiplierHelp"/>
 			<slider label="" name="WaterBlurMult"/>
 		</panel>
 		<panel label="OBRAZ" name="Waves">
 			<text name="BHText">
-				Kierunek Dużych Fal
+				Kierunek dużych fal
 			</text>
 			<button label="?" name="WaterWave1Help"/>
 			<text name="WaterWave1DirXText">
@@ -79,7 +79,7 @@
 			<slider label="" name="WaterWave1DirX"/>
 			<slider label="" name="WaterWave1DirY"/>
 			<text name="BHText2">
-				Kierunek Małych Fal
+				Kierunek małych fal
 			</text>
 			<button label="?" name="WaterWave2Help"/>
 			<text name="WaterWave2DirXText">
@@ -91,7 +91,7 @@
 			<slider label="" name="WaterWave2DirX"/>
 			<slider label="" name="WaterWave2DirY"/>
 			<text name="BHText3">
-				Mapa Normalnych
+				Mapa normalnych
 			</text>
 			<button label="?" name="WaterNormalMapHelp"/>
 			<texture_picker label="" name="WaterNormalMap"/>
diff --git a/indra/newview/skins/default/xui/pl/floater_wearable_save_as.xml b/indra/newview/skins/default/xui/pl/floater_wearable_save_as.xml
index 42a67995f6..925295102e 100644
--- a/indra/newview/skins/default/xui/pl/floater_wearable_save_as.xml
+++ b/indra/newview/skins/default/xui/pl/floater_wearable_save_as.xml
@@ -3,7 +3,7 @@
 	<button label="Zapisz" label_selected="Zapisz" name="Save"/>
 	<button label="Anuluj" label_selected="Anuluj" name="Cancel"/>
 	<text name="Save item as:">
-		Zapisz obiekt w mojej szafie jako:
+		Zapisz obiekt w mojej Szafie jako:
 	</text>
 	<line_editor name="name ed">
 		Nowe [DESC]
diff --git a/indra/newview/skins/default/xui/pl/floater_windlight_options.xml b/indra/newview/skins/default/xui/pl/floater_windlight_options.xml
index 6de121a180..49e523fae8 100644
--- a/indra/newview/skins/default/xui/pl/floater_windlight_options.xml
+++ b/indra/newview/skins/default/xui/pl/floater_windlight_options.xml
@@ -1,16 +1,16 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="WindLight floater" title="ZAAWANSOWANY EDYTOR NIEBA">
 	<text name="KeyFramePresetsText">
-		Ustawienia Nieba:
+		Ustawienia nieba:
 	</text>
 	<button label="Nowe" label_selected="Nowe" name="WLNewPreset"/>
 	<button label="Zapisz" label_selected="Zapisz" name="WLSavePreset"/>
 	<button label="Usuń" label_selected="Usuń" name="WLDeletePreset"/>
-	<button label="Edytor Cyklu Dnia" label_selected="Edytor Cyklu Dnia" name="WLDayCycleMenuButton"/>
+	<button label="Edytor cyklu dnia" label_selected="Edytor cyklu dnia" name="WLDayCycleMenuButton"/>
 	<tab_container name="WindLight Tabs">
 		<panel label="ATMOSFERA" name="Atmosphere">
 			<text name="BHText">
-				Horyzont Błękitu
+				Horyzont błękitu
 			</text>
 			<button label="?" name="WLBlueHorizonHelp"/>
 			<text name="BHText2">
@@ -30,12 +30,12 @@
 			<slider label="" name="WLBlueHorizonB"/>
 			<slider label="" name="WLBlueHorizonI"/>
 			<text name="BDensText">
-				Horyzont Zamglenia
+				Horyzont zamglenia
 			</text>
 			<button label="?" name="WLHazeHorizonHelp"/>
 			<slider label="" name="WLHazeHorizon"/>
 			<text name="BDensText2">
-				Gęstość Błękitu
+				Gęstość błękitu
 			</text>
 			<button label="?" name="WLBlueDensityHelp"/>
 			<text name="BHText6">
@@ -55,29 +55,29 @@
 			<slider label="" name="WLBlueDensityB"/>
 			<slider label="" name="WLBlueDensityI"/>
 			<text name="HDText">
-				Gęstość Zamglenia
+				Gęstość zamglenia
 			</text>
 			<button label="?" name="WLHazeDensityHelp"/>
 			<slider label="" name="WLHazeDensity"/>
 			<text name="DensMultText">
-				Mnożnik Gęsości
+				Mnożnik gęsości
 			</text>
 			<button label="?" name="WLDensityMultHelp"/>
 			<slider label="" name="WLDensityMult"/>
 			<text name="WLDistanceMultText">
-				Mnożnik Dystansu
+				Mnożnik dystansu
 			</text>
 			<button label="?" name="WLDistanceMultHelp"/>
 			<slider label="" name="WLDistanceMult"/>
 			<text name="MaxAltText">
-				Max Wysokość
+				Max wysokość
 			</text>
 			<button label="?" name="WLMaxAltitudeHelp"/>
 			<slider label="" name="WLMaxAltitude"/>
 		</panel>
 		<panel label="ŚWIATŁO" name="Lighting">
 			<text name="SLCText">
-				Kolor Słońca/Księżyca
+				Kolor słońca/księżyca
 			</text>
 			<button label="?" name="WLSunlightColorHelp"/>
 			<text name="BHText">
@@ -97,7 +97,7 @@
 			<slider label="" name="WLSunlightB"/>
 			<slider label="" name="WLSunlightI"/>
 			<text name="TODText">
-				Pozycja Słońca/Księżyca
+				Pozycja słońca/księżyca
 			</text>
 			<button label="?" name="WLTimeOfDayHelp"/>
 			<slider label="" name="WLSunAngle"/>
@@ -122,30 +122,30 @@
 			<slider label="" name="WLAmbientB"/>
 			<slider label="" name="WLAmbientI"/>
 			<text name="WLEastAngleText">
-				Pozycja Wschodu
+				Pozycja wschodu
 			</text>
 			<button label="?" name="WLEastAngleHelp"/>
 			<slider label="" name="WLEastAngle"/>
 			<text name="SunGlowText">
-				Blask Słońca
+				Blask słońca
 			</text>
 			<button label="?" name="WLSunGlowHelp"/>
 			<slider label="Ostrość" name="WLGlowB"/>
 			<slider label="Rozmiar" name="WLGlowR"/>
 			<text name="SceneGammaText">
-				Jasność Obrazu
+				Jasność obrazu
 			</text>
 			<button label="?" name="WLSceneGammaHelp"/>
 			<slider label="" name="WLGamma"/>
 			<text name="WLStarText">
-				Blask Gwiazd
+				Blask gwiazd
 			</text>
 			<button label="?" name="WLStarBrightnessHelp"/>
 			<slider label="" name="WLStarAlpha"/>
 		</panel>
 		<panel label="CHMURY" name="Clouds">
 			<text name="WLCloudColorText">
-				Kolor Chmur
+				Kolor chmur
 			</text>
 			<button label="?" name="WLCloudColorHelp"/>
 			<text name="BHText">
@@ -181,17 +181,17 @@
 			<slider label="" name="WLCloudY"/>
 			<slider label="" name="WLCloudDensity"/>
 			<text name="WLCloudCoverageText">
-				Pokrycie Chmur
+				Pokrycie chmur
 			</text>
 			<button label="?" name="WLCloudCoverageHelp"/>
 			<slider label="" name="WLCloudCoverage"/>
 			<text name="WLCloudScaleText">
-				Skala Chmur
+				Skala chmur
 			</text>
 			<button label="?" name="WLCloudScaleHelp"/>
 			<slider label="" name="WLCloudScale"/>
 			<text name="WLCloudDetailText">
-				Szczegóły (XY/Gęstość)
+				Szczegóły (XY/gęstość)
 			</text>
 			<button label="?" name="WLCloudDetailHelp"/>
 			<text name="BHText8">
@@ -207,18 +207,18 @@
 			<slider label="" name="WLCloudDetailY"/>
 			<slider label="" name="WLCloudDetailDensity"/>
 			<text name="WLCloudScrollXText">
-				Przewijanie Chmur X
+				Przewijanie chmur X
 			</text>
 			<button label="?" name="WLCloudScrollXHelp"/>
 			<check_box label="Zablokuj" name="WLCloudLockX"/>
 			<slider label="" name="WLCloudScrollX"/>
 			<text name="WLCloudScrollYText">
-				Przewijanie Chmur Y
+				Przewijanie chmur Y
 			</text>
 			<button label="?" name="WLCloudScrollYHelp"/>
 			<check_box label="Zablokuj" name="WLCloudLockY"/>
 			<slider label="" name="WLCloudScrollY"/>
-			<check_box label="Klasyczne Chmury" name="DrawClassicClouds"/>
+			<check_box label="Klasyczne chmury" name="DrawClassicClouds"/>
 			<button label="?" name="WLClassicCloudsHelp"/>
 		</panel>
 	</tab_container>
diff --git a/indra/newview/skins/default/xui/pl/floater_world_map.xml b/indra/newview/skins/default/xui/pl/floater_world_map.xml
index 13ad1bccc7..95010e0b91 100644
--- a/indra/newview/skins/default/xui/pl/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/pl/floater_world_map.xml
@@ -20,10 +20,10 @@
 			Sprzedaż Posiadłości
 		</text>
 		<text name="by_owner_label">
-			przez właściciela
+			przez Właściciela
 		</text>
 		<text name="auction_label">
-			aukcja posiadłości
+			aukcja Posiadłości
 		</text>
 		<button name="Go Home" tool_tip="Teleportuj do mojego Miejsca Startowego"/>
 		<text name="Home_label">
diff --git a/indra/newview/skins/default/xui/pl/inspect_avatar.xml b/indra/newview/skins/default/xui/pl/inspect_avatar.xml
index 6a688391c0..3ee0b976eb 100644
--- a/indra/newview/skins/default/xui/pl/inspect_avatar.xml
+++ b/indra/newview/skins/default/xui/pl/inspect_avatar.xml
@@ -15,7 +15,7 @@
 	<button label="IM" name="im_btn"/>
 	<button label="Profil" name="view_profile_btn"/>
 	<panel name="moderator_panel">
-		<button label="Wyłącz Komunikację Głosową" name="disable_voice"/>
-		<button label="Włącz Komunikację Głosową" name="enable_voice"/>
+		<button label="Wyłącz komunikację głosową" name="disable_voice"/>
+		<button label="Włącz komunikację głosową" name="enable_voice"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/pl/inspect_group.xml b/indra/newview/skins/default/xui/pl/inspect_group.xml
index d434443794..0a2a62ce74 100644
--- a/indra/newview/skins/default/xui/pl/inspect_group.xml
+++ b/indra/newview/skins/default/xui/pl/inspect_group.xml
@@ -5,10 +5,10 @@
 -->
 <floater name="inspect_group">
 	<string name="PrivateGroup">
-		Grupa Prywatna
+		Grupa prywatna
 	</string>
 	<string name="FreeToJoin">
-		Wstęp Wolny
+		Wstęp wolny
 	</string>
 	<string name="CostToJoin">
 		L$[AMOUNT] by dołączyć
diff --git a/indra/newview/skins/default/xui/pl/inspect_object.xml b/indra/newview/skins/default/xui/pl/inspect_object.xml
index 822e28ea7e..2e15691463 100644
--- a/indra/newview/skins/default/xui/pl/inspect_object.xml
+++ b/indra/newview/skins/default/xui/pl/inspect_object.xml
@@ -21,13 +21,13 @@ właściciel [OWNER]
 		Dotknij
 	</string>
 	<string name="Sit">
-		Usiądź tu
+		Usiądź tutaj
 	</string>
 	<button label="Kup" name="buy_btn"/>
 	<button label="Zapłać" name="pay_btn"/>
 	<button label="Weź kopię" name="take_free_copy_btn"/>
 	<button label="Dotknij" name="touch_btn"/>
-	<button label="Usiądź tu" name="sit_btn"/>
+	<button label="Usiądź tutaj" name="sit_btn"/>
 	<button label="Otwórz" name="open_btn"/>
 	<icon name="secure_browsing" tool_tip="Zabezpiecz przeglądanie"/>
 	<button label="Więcej" name="more_info_btn"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_attachment_self.xml b/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
index 1107a5d9d1..ff695be205 100644
--- a/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
+++ b/indra/newview/skins/default/xui/pl/menu_attachment_self.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Attachment Pie">
-	<menu_item_call label="Dotnij" name="Attachment Object Touch"/>
+	<menu_item_call label="Dotknij" name="Attachment Object Touch"/>
 	<menu_item_call label="Edytuj" name="Edit..."/>
 	<menu_item_call label="Odłącz" name="Detach"/>
 	<menu_item_call label="Opuść" name="Drop"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_bottomtray.xml b/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
index 818dfc08ae..9fcf1b3440 100644
--- a/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/pl/menu_bottomtray.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="hide_camera_move_controls_menu">
-	<menu_item_check label="Przycisk Gesturek" name="ShowGestureButton"/>
+	<menu_item_check label="Przycisk Gestur" name="ShowGestureButton"/>
 	<menu_item_check label="Przycisk Ruchu" name="ShowMoveButton"/>
 	<menu_item_check label="Przycisk Widoku" name="ShowCameraButton"/>
 	<menu_item_check label="Przycisk Zdjęć" name="ShowSnapshotButton"/>
@@ -8,5 +8,5 @@
 	<menu_item_call label="Kopiuj" name="NearbyChatBar_Copy"/>
 	<menu_item_call label="Wklej" name="NearbyChatBar_Paste"/>
 	<menu_item_call label="Usuń" name="NearbyChatBar_Delete"/>
-	<menu_item_call label="Zaznacz Wszystko" name="NearbyChatBar_Select_All"/>
+	<menu_item_call label="Zaznacz wszystko" name="NearbyChatBar_Select_All"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_favorites.xml b/indra/newview/skins/default/xui/pl/menu_favorites.xml
index 0a0b54a548..cbacaf4beb 100644
--- a/indra/newview/skins/default/xui/pl/menu_favorites.xml
+++ b/indra/newview/skins/default/xui/pl/menu_favorites.xml
@@ -3,7 +3,7 @@
 	<menu_item_call label="Teleportuj" name="Teleport To Landmark"/>
 	<menu_item_call label="Zobacz/Edytuj Ulubione Miejsce" name="Landmark Open"/>
 	<menu_item_call label="Kopiuj SLurl" name="Copy slurl"/>
-	<menu_item_call label="Pokaż na Mapie" name="Show On Map"/>
+	<menu_item_call label="Pokaż na mapie" name="Show On Map"/>
 	<menu_item_call label="Kopiuj" name="Landmark Copy"/>
 	<menu_item_call label="Wklej" name="Landmark Paste"/>
 	<menu_item_call label="Usuń" name="Delete"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml b/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
index 1c2687338d..d30f5a4d3f 100644
--- a/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
+++ b/indra/newview/skins/default/xui/pl/menu_hide_navbar.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="hide_navbar_menu">
-	<menu_item_check label="Pokaż Pasek Nawigacji" name="ShowNavbarNavigationPanel"/>
-	<menu_item_check label="Pokaż Pasek Ulubionych" name="ShowNavbarFavoritesPanel"/>
+	<menu_item_check label="Pokaż pasek Nawigacji" name="ShowNavbarNavigationPanel"/>
+	<menu_item_check label="Pokaż pasek Ulubionych" name="ShowNavbarFavoritesPanel"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_im_well_button.xml b/indra/newview/skins/default/xui/pl/menu_im_well_button.xml
index 4962ffc356..207bc2211b 100644
--- a/indra/newview/skins/default/xui/pl/menu_im_well_button.xml
+++ b/indra/newview/skins/default/xui/pl/menu_im_well_button.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="IM Well Button Context Menu">
-	<menu_item_call label="Zamknij Wszystkie" name="Close All"/>
+	<menu_item_call label="Zamknij wszystkie" name="Close All"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_imchiclet_adhoc.xml b/indra/newview/skins/default/xui/pl/menu_imchiclet_adhoc.xml
index 925272d5ee..4ead44878a 100644
--- a/indra/newview/skins/default/xui/pl/menu_imchiclet_adhoc.xml
+++ b/indra/newview/skins/default/xui/pl/menu_imchiclet_adhoc.xml
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="IMChiclet AdHoc Menu">
-	<menu_item_call label="Zakończ Rozmowę" name="End Session"/>
+	<menu_item_call label="Zakończ rozmowę" name="End Session"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_imchiclet_group.xml b/indra/newview/skins/default/xui/pl/menu_imchiclet_group.xml
index dc232c096d..c53f72c043 100644
--- a/indra/newview/skins/default/xui/pl/menu_imchiclet_group.xml
+++ b/indra/newview/skins/default/xui/pl/menu_imchiclet_group.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="IMChiclet Group Menu">
 	<menu_item_call label="O Grupie" name="Show Profile"/>
-	<menu_item_call label="Pokaż Sesję" name="Chat"/>
-	<menu_item_call label="Zakończ Rozmowę" name="End Session"/>
+	<menu_item_call label="Pokaż sesję" name="Chat"/>
+	<menu_item_call label="Zakończ rozmowę" name="End Session"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_imchiclet_p2p.xml b/indra/newview/skins/default/xui/pl/menu_imchiclet_p2p.xml
index df991cbc36..c0c812c0a7 100644
--- a/indra/newview/skins/default/xui/pl/menu_imchiclet_p2p.xml
+++ b/indra/newview/skins/default/xui/pl/menu_imchiclet_p2p.xml
@@ -2,6 +2,6 @@
 <menu name="IMChiclet P2P Menu">
 	<menu_item_call label="Zobacz Profil" name="Show Profile"/>
 	<menu_item_call label="Dodaj Znajomość" name="Add Friend"/>
-	<menu_item_call label="Pokaż Sesję" name="Send IM"/>
-	<menu_item_call label="Zakończ Rozmowę" name="End Session"/>
+	<menu_item_call label="Pokaż sesję" name="Send IM"/>
+	<menu_item_call label="Zakończ rozmowę" name="End Session"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
index f6ac02f91c..325072d0fb 100644
--- a/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inspect_avatar_gear.xml
@@ -12,7 +12,7 @@
 	<menu_item_call label="Unieruchom" name="freeze"/>
 	<menu_item_call label="Wyrzuć" name="eject"/>
 	<menu_item_call label="Debug" name="debug"/>
-	<menu_item_call label="Znajdź na Mapie" name="find_on_map"/>
+	<menu_item_call label="Znajdź na mapie" name="find_on_map"/>
 	<menu_item_call label="Przybliż" name="zoom_in"/>
 	<menu_item_call label="Zapłać" name="pay"/>
 	<menu_item_call label="Udostępnij" name="share"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/pl/menu_inspect_object_gear.xml
index 988c31a6e4..2c56d2ca3d 100644
--- a/indra/newview/skins/default/xui/pl/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inspect_object_gear.xml
@@ -5,7 +5,7 @@
 	<menu_item_call label="Zapłać" name="pay"/>
 	<menu_item_call label="Kup" name="buy"/>
 	<menu_item_call label="Weź" name="take"/>
-	<menu_item_call label="Weź Kopię" name="take_copy"/>
+	<menu_item_call label="Weź kopię" name="take_copy"/>
 	<menu_item_call label="Otwórz" name="open"/>
 	<menu_item_call label="Edytuj" name="edit"/>
 	<menu_item_call label="Ubierz" name="wear"/>
@@ -13,5 +13,5 @@
 	<menu_item_call label="Zablokuj" name="block"/>
 	<menu_item_call label="Przybliż" name="zoom_in"/>
 	<menu_item_call label="Usuń" name="remove"/>
-	<menu_item_call label="Więcej Informacji" name="more_info"/>
+	<menu_item_call label="Więcej informacji" name="more_info"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory.xml b/indra/newview/skins/default/xui/pl/menu_inventory.xml
index 30fb703584..7fe9da3c0c 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory.xml
@@ -4,32 +4,32 @@
 	<menu_item_call label="Otwórz" name="Task Open"/>
 	<menu_item_call label="Odtwarzaj" name="Task Play"/>
 	<menu_item_call label="Właściwości" name="Task Properties"/>
-	<menu_item_call label="Zmień Nazwę" name="Task Rename"/>
+	<menu_item_call label="Zmień nazwę" name="Task Rename"/>
 	<menu_item_call label="Usuń" name="Task Remove"/>
 	<menu_item_call label="Opróżnij Kosz" name="Empty Trash"/>
 	<menu_item_call label="Opróżnij Folder Zgubione i Odnalezione" name="Empty Lost And Found"/>
-	<menu_item_call label="Nowy Folder" name="New Folder"/>
-	<menu_item_call label="Nowy Skrypt" name="New Script"/>
-	<menu_item_call label="Nowa Nota" name="New Note"/>
-	<menu_item_call label="Nowy Gest" name="New Gesture"/>
+	<menu_item_call label="Nowy folder" name="New Folder"/>
+	<menu_item_call label="Nowy skrypt" name="New Script"/>
+	<menu_item_call label="Nowa nota" name="New Note"/>
+	<menu_item_call label="Nowy gest" name="New Gesture"/>
 	<menu label="Nowe Ubranie" name="New Clothes">
-		<menu_item_call label="Nowa Koszulka" name="New Shirt"/>
-		<menu_item_call label="Nowe Spodnie" name="New Pants"/>
-		<menu_item_call label="Nowe Buty" name="New Shoes"/>
-		<menu_item_call label="Nowe Skarpety" name="New Socks"/>
-		<menu_item_call label="Nowa Kurtka" name="New Jacket"/>
-		<menu_item_call label="Nowa Spódnica" name="New Skirt"/>
-		<menu_item_call label="Nowe Rękawiczki" name="New Gloves"/>
-		<menu_item_call label="Nowy Podkoszulek" name="New Undershirt"/>
-		<menu_item_call label="Nowa Bielizna" name="New Underpants"/>
-		<menu_item_call label="Nowa Maska Przezroczysta" name="New Alpha Mask"/>
-		<menu_item_call label="Nowy Tatuaż" name="New Tattoo"/>
+		<menu_item_call label="Nowa koszulka" name="New Shirt"/>
+		<menu_item_call label="Nowe spodnie" name="New Pants"/>
+		<menu_item_call label="Nowe buty" name="New Shoes"/>
+		<menu_item_call label="Nowe skarpety" name="New Socks"/>
+		<menu_item_call label="Nowa kurtka" name="New Jacket"/>
+		<menu_item_call label="Nowa spódnica" name="New Skirt"/>
+		<menu_item_call label="Nowe rękawiczki" name="New Gloves"/>
+		<menu_item_call label="Nowy podkoszulek" name="New Undershirt"/>
+		<menu_item_call label="Nowa bielizna" name="New Underpants"/>
+		<menu_item_call label="Nowa maska Alpha" name="New Alpha Mask"/>
+		<menu_item_call label="Nowy tatuaż" name="New Tattoo"/>
 	</menu>
 	<menu label="Nowa Część Ciała" name="New Body Parts">
-		<menu_item_call label="Nowy Kształt" name="New Shape"/>
-		<menu_item_call label="Nowa Skórka" name="New Skin"/>
-		<menu_item_call label="Nowe Włosy" name="New Hair"/>
-		<menu_item_call label="Nowe Oczy" name="New Eyes"/>
+		<menu_item_call label="Nowy kształt" name="New Shape"/>
+		<menu_item_call label="Nowa skórka" name="New Skin"/>
+		<menu_item_call label="Nowe włosy" name="New Hair"/>
+		<menu_item_call label="Nowe oczy" name="New Eyes"/>
 	</menu>
 	<menu label="Zmień Czcionkę" name="Change Type">
 		<menu_item_call label="Domyślna" name="Default"/>
@@ -46,31 +46,31 @@
 	<menu_item_call label="Teleportuj" name="Landmark Open"/>
 	<menu_item_call label="Otwórz" name="Animation Open"/>
 	<menu_item_call label="Otwórz" name="Sound Open"/>
-	<menu_item_call label="Zmień Strój" name="Replace Outfit"/>
-	<menu_item_call label="Dodaj do Stroju" name="Add To Outfit"/>
-	<menu_item_call label="Usuń Obiekt" name="Purge Item"/>
-	<menu_item_call label="Przywróć Obiekt" name="Restore Item"/>
+	<menu_item_call label="Zmień strój" name="Replace Outfit"/>
+	<menu_item_call label="Dodaj do stroju" name="Add To Outfit"/>
+	<menu_item_call label="Usuń obiekt" name="Purge Item"/>
+	<menu_item_call label="Przywróć obiekt" name="Restore Item"/>
 	<menu_item_call label="Otwórz" name="Open"/>
 	<menu_item_call label="Właściwości" name="Properties"/>
-	<menu_item_call label="Zmień Nazwę" name="Rename"/>
-	<menu_item_call label="Kopiuj Dane UUID" name="Copy Asset UUID"/>
+	<menu_item_call label="Zmień nazwę" name="Rename"/>
+	<menu_item_call label="Kopiuj dane UUID" name="Copy Asset UUID"/>
 	<menu_item_call label="Kopiuj" name="Copy"/>
 	<menu_item_call label="Wklej" name="Paste"/>
-	<menu_item_call label="Wklej jako Link" name="Paste As Link"/>
+	<menu_item_call label="Wklej jako link" name="Paste As Link"/>
 	<menu_item_call label="Usuń" name="Delete"/>
 	<menu_item_call label="Skasuj Folder Systemu" name="Delete System Folder"/>
-	<menu_item_call label="Rozpocznij Konferencję Czatową" name="Conference Chat Folder"/>
+	<menu_item_call label="Rozpocznij konferencję czatową" name="Conference Chat Folder"/>
 	<menu_item_call label="Odtwarzaj" name="Sound Play"/>
 	<menu_item_call label="O Miejscu" name="About Landmark"/>
-	<menu_item_call label="Używaj w Świecie" name="Animation Play"/>
-	<menu_item_call label="Odtwarzaj Lokalnie" name="Animation Audition"/>
+	<menu_item_call label="Używaj in-world" name="Animation Play"/>
+	<menu_item_call label="Odtwarzaj lokalnie" name="Animation Audition"/>
 	<menu_item_call label="Wyślij IM" name="Send Instant Message"/>
-	<menu_item_call label="Zaoferuj Teleportację..." name="Offer Teleport..."/>
-	<menu_item_call label="Rozpocznij Konferencję Czatową" name="Conference Chat"/>
+	<menu_item_call label="Teleportuj..." name="Offer Teleport..."/>
+	<menu_item_call label="Rozpocznij konferencję czatową" name="Conference Chat"/>
 	<menu_item_call label="Aktywuj" name="Activate"/>
 	<menu_item_call label="Deaktywuj" name="Deactivate"/>
 	<menu_item_call label="Zapisz jako" name="Save As"/>
-	<menu_item_call label="Odłącz od Siebie" name="Detach From Yourself"/>
+	<menu_item_call label="Odłącz od siebie" name="Detach From Yourself"/>
 	<menu_item_call label="Ubierz" name="Object Wear"/>
 	<menu label="Dołącz do" name="Attach To"/>
 	<menu label="Dołącz do Załączników HUD" name="Attach To HUD"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory_add.xml b/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
index 5b8c5426dd..b4d85c2c5c 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory_add.xml
@@ -1,32 +1,32 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_inventory_add">
 	<menu label="Załaduj" name="upload">
-		<menu_item_call label="Obraz (L$[COST])..." name="Upload Image"/>
-		<menu_item_call label="Dźwięk (L$[COST])..." name="Upload Sound"/>
-		<menu_item_call label="Animację (L$[COST])..." name="Upload Animation"/>
-		<menu_item_call label="Zbiór Plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
+		<menu_item_call label="obraz (L$[COST])..." name="Upload Image"/>
+		<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
+		<menu_item_call label="animację (L$[COST])..." name="Upload Animation"/>
+		<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
 	</menu>
-	<menu_item_call label="Nowy Folder" name="New Folder"/>
-	<menu_item_call label="Nowy Skrypt" name="New Script"/>
-	<menu_item_call label="Nowa Nota" name="New Note"/>
-	<menu_item_call label="Nowa Gesturka" name="New Gesture"/>
+	<menu_item_call label="Nowy folder" name="New Folder"/>
+	<menu_item_call label="Nowy skrypt" name="New Script"/>
+	<menu_item_call label="Nowa nota" name="New Note"/>
+	<menu_item_call label="Nowy gest" name="New Gesture"/>
 	<menu label="Nowe Ubranie" name="New Clothes">
-		<menu_item_call label="Nowa Koszulka" name="New Shirt"/>
-		<menu_item_call label="Nowe Spodnie" name="New Pants"/>
-		<menu_item_call label="Nowe Buty" name="New Shoes"/>
-		<menu_item_call label="Nowe Skarpetki" name="New Socks"/>
-		<menu_item_call label="Nowa Kurtka" name="New Jacket"/>
-		<menu_item_call label="Nowa Spódnica" name="New Skirt"/>
-		<menu_item_call label="Nowe Rękawiczki" name="New Gloves"/>
-		<menu_item_call label="Nowy Podkoszulek" name="New Undershirt"/>
-		<menu_item_call label="Nowa Bielizna" name="New Underpants"/>
-		<menu_item_call label="Nowe Ubranie Przezroczyste" name="New Alpha"/>
-		<menu_item_call label="Nowy Tatuaż" name="New Tattoo"/>
+		<menu_item_call label="Nowa koszulka" name="New Shirt"/>
+		<menu_item_call label="Nowe spodnie" name="New Pants"/>
+		<menu_item_call label="Nowe buty" name="New Shoes"/>
+		<menu_item_call label="Nowe skarpetki" name="New Socks"/>
+		<menu_item_call label="Nowa kurtka" name="New Jacket"/>
+		<menu_item_call label="Nowa spódnica" name="New Skirt"/>
+		<menu_item_call label="Nowe rękawiczki" name="New Gloves"/>
+		<menu_item_call label="Nowy podkoszulek" name="New Undershirt"/>
+		<menu_item_call label="Nowa bielizna" name="New Underpants"/>
+		<menu_item_call label="Nowe ubranie Przezroczyste" name="New Alpha"/>
+		<menu_item_call label="Nowy tatuaż" name="New Tattoo"/>
 	</menu>
 	<menu label="Nowa Część Ciała" name="New Body Parts">
-		<menu_item_call label="Nowy Kształt" name="New Shape"/>
-		<menu_item_call label="Nowa Skórka" name="New Skin"/>
-		<menu_item_call label="Nowe Włosy" name="New Hair"/>
-		<menu_item_call label="Nowe Oczy" name="New Eyes"/>
+		<menu_item_call label="Nowy kształt" name="New Shape"/>
+		<menu_item_call label="Nowa skórka" name="New Skin"/>
+		<menu_item_call label="Nowe włosy" name="New Hair"/>
+		<menu_item_call label="Nowe oczy" name="New Eyes"/>
 	</menu>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
index 8f5f94a02f..2ec3741682 100644
--- a/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/pl/menu_inventory_gear_default.xml
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_gear_default">
-	<menu_item_call label="Nowe Okno Szafy" name="new_window"/>
-	<menu_item_call label="Porządkuj Według Nazwy" name="sort_by_name"/>
-	<menu_item_call label="Porządkuj Według Daty" name="sort_by_recent"/>
-	<menu_item_call label="Pokaż Filtry" name="show_filters"/>
-	<menu_item_call label="Zresetuj Filtry" name="reset_filters"/>
-	<menu_item_call label="Zamknij Wszystkie Foldery" name="close_folders"/>
+	<menu_item_call label="Nowe okno Szafy" name="new_window"/>
+	<menu_item_call label="Porządkuj według nazwy" name="sort_by_name"/>
+	<menu_item_call label="Porządkuj według daty" name="sort_by_recent"/>
+	<menu_item_call label="Pokaż filtry" name="show_filters"/>
+	<menu_item_call label="Zresetuj filtry" name="reset_filters"/>
+	<menu_item_call label="Zamknij wszystkie foldery" name="close_folders"/>
 	<menu_item_call label="Opróżnij Kosz" name="empty_trash"/>
 	<menu_item_call label="Opróżnij Zagubione i Odnalezione" name="empty_lostnfound"/>
-	<menu_item_call label="Zapisz Teksturę Jako" name="Save Texture As"/>
-	<menu_item_call label="Znajdź Oryginał" name="Find Original"/>
-	<menu_item_call label="Znajdź Wszystkie Linki" name="Find All Links"/>
+	<menu_item_call label="Zapisz teksturę jako" name="Save Texture As"/>
+	<menu_item_call label="Znajdź oryginał" name="Find Original"/>
+	<menu_item_call label="Znajdź wszystkie linki" name="Find All Links"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_land.xml b/indra/newview/skins/default/xui/pl/menu_land.xml
index 2c89b43525..1e1ce73089 100644
--- a/indra/newview/skins/default/xui/pl/menu_land.xml
+++ b/indra/newview/skins/default/xui/pl/menu_land.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Land Pie">
 	<menu_item_call label="O Posiadłości" name="Place Information..."/>
-	<menu_item_call label="Usiądź Tutaj" name="Sit Here"/>
+	<menu_item_call label="Usiądź tutaj" name="Sit Here"/>
 	<menu_item_call label="Kup Posiadłość" name="Land Buy"/>
-	<menu_item_call label="Kup Wstęp" name="Land Buy Pass"/>
+	<menu_item_call label="Kup przepustkę" name="Land Buy Pass"/>
 	<menu_item_call label="Buduj" name="Create"/>
-	<menu_item_call label="Edytuj Teren" name="Edit Terrain"/>
+	<menu_item_call label="Edytuj teren" name="Edit Terrain"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_landmark.xml b/indra/newview/skins/default/xui/pl/menu_landmark.xml
index 8cd7e03bf1..aa5808390c 100644
--- a/indra/newview/skins/default/xui/pl/menu_landmark.xml
+++ b/indra/newview/skins/default/xui/pl/menu_landmark.xml
@@ -3,5 +3,5 @@
 	<menu_item_call label="Kopiuj SLurl" name="copy"/>
 	<menu_item_call label="Usuń" name="delete"/>
 	<menu_item_call label="Utwórz" name="pick"/>
-	<menu_item_call label="Dodaj do Paska Ulubionych" name="add_to_favbar"/>
+	<menu_item_call label="Dodaj do paska Ulubionych" name="add_to_favbar"/>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_login.xml b/indra/newview/skins/default/xui/pl/menu_login.xml
index be7c8c2102..2673f5c271 100644
--- a/indra/newview/skins/default/xui/pl/menu_login.xml
+++ b/indra/newview/skins/default/xui/pl/menu_login.xml
@@ -2,7 +2,7 @@
 <menu_bar name="Login Menu">
 	<menu label="Ja" name="File">
 		<menu_item_call label="Ustawienia" name="Preferences..."/>
-		<menu_item_call label="Wyłącz Program" name="Quit"/>
+		<menu_item_call label="Wyłącz program" name="Quit"/>
 	</menu>
 	<menu label="Pomoc" name="Help">
 		<menu_item_call label="[SECOND_LIFE]: Pomoc" name="Second Life Help"/>
@@ -16,15 +16,15 @@
 			<menu_item_call label="Wklej" name="Paste"/>
 			<menu_item_call label="Usuń" name="Delete"/>
 			<menu_item_call label="Powiel" name="Duplicate"/>
-			<menu_item_call label="Zaznacz Wszystko" name="Select All"/>
+			<menu_item_call label="Zaznacz wszystko" name="Select All"/>
 			<menu_item_call label="Odznacz" name="Deselect"/>
 		</menu>
-		<menu_item_call label="Ustawienia Debugowania" name="Debug Settings"/>
-		<menu_item_call label="Ustawienia UI/Kolor" name="UI/Color Settings"/>
+		<menu_item_call label="Ustawienia debugowania" name="Debug Settings"/>
+		<menu_item_call label="Ustawienia UI/kolor" name="UI/Color Settings"/>
 		<menu label="UI Testy" name="UI Tests"/>
-		<menu_item_call label="Ustaw Rozmiar Interfejsu..." name="Set Window Size..."/>
+		<menu_item_call label="Ustaw rozmiar interfejsu..." name="Set Window Size..."/>
 		<menu_item_call label="Wyświetl TOS" name="TOS"/>
-		<menu_item_call label="Wyświetl Wiadomość Krytyczną" name="Critical"/>
-		<menu_item_call label="Test Przeglądarki Internetowej" name="Web Browser Test"/>
+		<menu_item_call label="Wyświetl wiadomość krytyczną" name="Critical"/>
+		<menu_item_call label="Test przeglądarki internetowej" name="Web Browser Test"/>
 	</menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/pl/menu_mini_map.xml b/indra/newview/skins/default/xui/pl/menu_mini_map.xml
index dbebeadfbe..94e4c91abb 100644
--- a/indra/newview/skins/default/xui/pl/menu_mini_map.xml
+++ b/indra/newview/skins/default/xui/pl/menu_mini_map.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="Popup">
-	<menu_item_call label="Zoom Blisko" name="Zoom Close"/>
-	<menu_item_call label="Zoom Średnio" name="Zoom Medium"/>
-	<menu_item_call label="Zoom Daleko" name="Zoom Far"/>
-	<menu_item_check label="Obróć Mapę" name="Rotate Map"/>
+	<menu_item_call label="Zoom blisko" name="Zoom Close"/>
+	<menu_item_call label="Zoom średnio" name="Zoom Medium"/>
+	<menu_item_call label="Zoom daleko" name="Zoom Far"/>
+	<menu_item_check label="Obróć mapę" name="Rotate Map"/>
 	<menu_item_call label="Zatrzymaj" name="Stop Tracking"/>
 	<menu_item_call label="Mapa Świata" name="World Map"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_navbar.xml b/indra/newview/skins/default/xui/pl/menu_navbar.xml
index 8d84f3e764..f38b805ee2 100644
--- a/indra/newview/skins/default/xui/pl/menu_navbar.xml
+++ b/indra/newview/skins/default/xui/pl/menu_navbar.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="Navbar Menu">
-	<menu_item_check label="Pokaż Współrzędne" name="Show Coordinates"/>
-	<menu_item_check label="Pokaż Właściwości Posiadłości" name="Show Parcel Properties"/>
+	<menu_item_check label="Pokaż współrzędne" name="Show Coordinates"/>
+	<menu_item_check label="Pokaż właściwości Posiadłości" name="Show Parcel Properties"/>
 	<menu_item_call label="Ulubione Miejsce" name="Landmark"/>
 	<menu_item_call label="Wytnij" name="Cut"/>
 	<menu_item_call label="Kopiuj" name="Copy"/>
 	<menu_item_call label="Wklej" name="Paste"/>
 	<menu_item_call label="Usuń" name="Delete"/>
-	<menu_item_call label="Zaznacz Wszystko" name="Select All"/>
+	<menu_item_call label="Zaznacz wszystko" name="Select All"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_nearby_chat.xml b/indra/newview/skins/default/xui/pl/menu_nearby_chat.xml
index 78b8c0a4fc..fe5bc6ba6f 100644
--- a/indra/newview/skins/default/xui/pl/menu_nearby_chat.xml
+++ b/indra/newview/skins/default/xui/pl/menu_nearby_chat.xml
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="NearBy Chat Menu">
-	<menu_item_call label="Pokaż Osoby w Pobliżu..." name="nearby_people"/>
-	<menu_item_check label="Pokaż Zablokowany Tekst" name="muted_text"/>
-	<menu_item_check label="Wyświetlaj Ikonki Znajomych" name="show_buddy_icons"/>
-	<menu_item_check label="Wyświetlaj Imiona" name="show_names"/>
-	<menu_item_check label="Wyświetlaj Ikonki i Imiona" name="show_icons_and_names"/>
-	<menu_item_call label="Rozmiar Czcionki" name="font_size"/>
+	<menu_item_call label="Pokaż osoby w pobliżu..." name="nearby_people"/>
+	<menu_item_check label="Pokaż zablokowany tekst" name="muted_text"/>
+	<menu_item_check label="Wyświetlaj ikonki znajomych" name="show_buddy_icons"/>
+	<menu_item_check label="Wyświetlaj imiona" name="show_names"/>
+	<menu_item_check label="Wyświetlaj ikonki i imiona" name="show_icons_and_names"/>
+	<menu_item_call label="Rozmiar czcionki" name="font_size"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_object.xml b/indra/newview/skins/default/xui/pl/menu_object.xml
index d71611ce91..763b120f89 100644
--- a/indra/newview/skins/default/xui/pl/menu_object.xml
+++ b/indra/newview/skins/default/xui/pl/menu_object.xml
@@ -4,7 +4,7 @@
 	<menu_item_call label="Edytuj" name="Edit..."/>
 	<menu_item_call label="Buduj" name="Build"/>
 	<menu_item_call label="Otwórz" name="Open"/>
-	<menu_item_call label="Usiądź Tutaj" name="Object Sit"/>
+	<menu_item_call label="Usiądź tutaj" name="Object Sit"/>
 	<menu_item_call label="Wstań" name="Object Stand Up"/>
 	<menu_item_call label="Sprawdź" name="Object Inspect"/>
 	<menu_item_call label="Przybliż" name="Zoom In"/>
@@ -21,7 +21,7 @@
 	</context_menu>
 	<menu_item_call label="Kup" name="Pie Object Bye"/>
 	<menu_item_call label="Weź" name="Pie Object Take"/>
-	<menu_item_call label="Weź Kopię" name="Take Copy"/>
+	<menu_item_call label="Weź kopię" name="Take Copy"/>
 	<menu_item_call label="Zapłać" name="Pay..."/>
 	<menu_item_call label="Kup" name="Buy..."/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_participant_list.xml b/indra/newview/skins/default/xui/pl/menu_participant_list.xml
index 9b60b17ba8..079b8558da 100644
--- a/indra/newview/skins/default/xui/pl/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/pl/menu_participant_list.xml
@@ -8,8 +8,8 @@
 	<menu_item_call label="Zadzwoń" name="Call"/>
 	<menu_item_call label="Udostępnij" name="Share"/>
 	<menu_item_call label="Zapłać" name="Pay"/>
-	<menu_item_check label="Zablokuj Głos" name="Block/Unblock"/>
-	<menu_item_check label="Zablokuj Tekst" name="MuteText"/>
+	<menu_item_check label="Zablokuj głos" name="Block/Unblock"/>
+	<menu_item_check label="Zablokuj tekst" name="MuteText"/>
 	<context_menu label="Opcje Moderatora &gt;" name="Moderator Options">
 		<menu_item_check label="Czat/IM dozwolony" name="AllowTextChat"/>
 		<menu_item_call label="Wycisz tego uczestnika" name="ModerateVoiceMuteSelected"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/pl/menu_people_friends_view_sort.xml
index 0043030035..9c33fad00f 100644
--- a/indra/newview/skins/default/xui/pl/menu_people_friends_view_sort.xml
+++ b/indra/newview/skins/default/xui/pl/menu_people_friends_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_group_plus">
-	<menu_item_check label="Porządkuj Według Nazwy" name="sort_name"/>
-	<menu_item_check label="Porządkuj Według Statusu" name="sort_status"/>
-	<menu_item_check label="Wyświetlaj Ikonki" name="view_icons"/>
-	<menu_item_call label="Pokaż Zablokowanych Rezydentów &amp; Obiekty" name="show_blocked_list"/>
+	<menu_item_check label="Porządkuj według nazwy" name="sort_name"/>
+	<menu_item_check label="Porządkuj według statusu" name="sort_status"/>
+	<menu_item_check label="Wyświetlaj ikonki" name="view_icons"/>
+	<menu_item_call label="Pokaż zablokowanych Rezydentów &amp; obiekty" name="show_blocked_list"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_people_groups_view_sort.xml b/indra/newview/skins/default/xui/pl/menu_people_groups_view_sort.xml
index f661cfeba0..4be60d9b83 100644
--- a/indra/newview/skins/default/xui/pl/menu_people_groups_view_sort.xml
+++ b/indra/newview/skins/default/xui/pl/menu_people_groups_view_sort.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_group_plus">
-	<menu_item_check label="Wyświetlaj Ikonki Grupy" name="Display Group Icons"/>
-	<menu_item_call label="Opuść Zaznaczone Grupy" name="Leave Selected Group"/>
+	<menu_item_check label="Wyświetlaj ikonki Grupy" name="Display Group Icons"/>
+	<menu_item_call label="Opuść zaznaczone Grupy" name="Leave Selected Group"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_people_nearby.xml b/indra/newview/skins/default/xui/pl/menu_people_nearby.xml
index fcba806e45..afe3a5200b 100644
--- a/indra/newview/skins/default/xui/pl/menu_people_nearby.xml
+++ b/indra/newview/skins/default/xui/pl/menu_people_nearby.xml
@@ -2,7 +2,7 @@
 <context_menu name="Avatar Context Menu">
 	<menu_item_call label="Zobacz Profil" name="View Profile"/>
 	<menu_item_call label="Dodaj Znajomość" name="Add Friend"/>
-	<menu_item_call label="Usuń z listy znajomych" name="Remove Friend"/>
+	<menu_item_call label="Usuń z listy Znajomych" name="Remove Friend"/>
 	<menu_item_call label="IM" name="IM"/>
 	<menu_item_call label="Zadzwoń" name="Call"/>
 	<menu_item_call label="Mapa" name="Map"/>
diff --git a/indra/newview/skins/default/xui/pl/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/pl/menu_people_nearby_view_sort.xml
index 9e5f1a5917..8ec3820f84 100644
--- a/indra/newview/skins/default/xui/pl/menu_people_nearby_view_sort.xml
+++ b/indra/newview/skins/default/xui/pl/menu_people_nearby_view_sort.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_group_plus">
-	<menu_item_check label="Porządkuj Według Ostatnich Rozmówców" name="sort_by_recent_speakers"/>
-	<menu_item_check label="Porządkuj Według Nazwy" name="sort_name"/>
-	<menu_item_check label="Porządkuj Według Odległości" name="sort_distance"/>
-	<menu_item_check label="Wyświetlaj Ikonki" name="view_icons"/>
-	<menu_item_call label="Pokaż Zablokowanych Rezydentów &amp; Obiekty" name="show_blocked_list"/>
+	<menu_item_check label="Porządkuj według ostatnich rozmówców" name="sort_by_recent_speakers"/>
+	<menu_item_check label="Porządkuj według nazwy" name="sort_name"/>
+	<menu_item_check label="Porządkuj według odległości" name="sort_distance"/>
+	<menu_item_check label="Wyświetlaj ikonki" name="view_icons"/>
+	<menu_item_call label="Pokaż zablokowanych Rezydentów &amp; obiekty" name="show_blocked_list"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/pl/menu_people_recent_view_sort.xml
index 418b67bce8..b474a556bd 100644
--- a/indra/newview/skins/default/xui/pl/menu_people_recent_view_sort.xml
+++ b/indra/newview/skins/default/xui/pl/menu_people_recent_view_sort.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_group_plus">
-	<menu_item_check label="Porządkuj Według Daty" name="sort_most"/>
-	<menu_item_check label="Porządkuj Według Nazwy" name="sort_name"/>
-	<menu_item_check label="Wyświetlaj Ikonki" name="view_icons"/>
-	<menu_item_call label="Pokaż Zablokowanych Rezydentów &amp; Obiekty" name="show_blocked_list"/>
+	<menu_item_check label="Porządkuj według daty" name="sort_most"/>
+	<menu_item_check label="Porządkuj według nazwy" name="sort_name"/>
+	<menu_item_check label="Wyświetlaj ikonki" name="view_icons"/>
+	<menu_item_call label="Pokaż zablokowanych Rezydentów &amp; obiekty" name="show_blocked_list"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_picks_plus.xml b/indra/newview/skins/default/xui/pl/menu_picks_plus.xml
index 14ab9c2978..8f196612a8 100644
--- a/indra/newview/skins/default/xui/pl/menu_picks_plus.xml
+++ b/indra/newview/skins/default/xui/pl/menu_picks_plus.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <toggleable_menu name="picks_plus_menu">
-	<menu_item_call label="Utwórz" name="create_pick"/>
+	<menu_item_call label="Stwórz" name="create_pick"/>
 	<menu_item_call label="Nowa Reklama" name="create_classified"/>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_place.xml b/indra/newview/skins/default/xui/pl/menu_place.xml
index 72f4b1265f..312bfc6bb0 100644
--- a/indra/newview/skins/default/xui/pl/menu_place.xml
+++ b/indra/newview/skins/default/xui/pl/menu_place.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <toggleable_menu name="place_overflow_menu">
-	<menu_item_call label="Zapisz Ulubione Miejsce" name="landmark"/>
+	<menu_item_call label="Zapisz Landmark" name="landmark"/>
 	<menu_item_call label="Utwórz" name="pick"/>
-	<menu_item_call label="Kup Wstęp" name="pass"/>
+	<menu_item_call label="Kup Przepustkę" name="pass"/>
 	<menu_item_call label="Edytuj" name="edit"/>
 </toggleable_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_place_add_button.xml b/indra/newview/skins/default/xui/pl/menu_place_add_button.xml
index a737fc49ce..6175671fb9 100644
--- a/indra/newview/skins/default/xui/pl/menu_place_add_button.xml
+++ b/indra/newview/skins/default/xui/pl/menu_place_add_button.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_folder_gear">
-	<menu_item_call label="Dodaj Folder" name="add_folder"/>
-	<menu_item_call label="Dodaj do Ulubionych Miejsc" name="add_landmark"/>
+	<menu_item_call label="Dodaj folder" name="add_folder"/>
+	<menu_item_call label="Dodaj do Landmarków" name="add_landmark"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/pl/menu_places_gear_folder.xml
index f5ece87b28..d17b6c1033 100644
--- a/indra/newview/skins/default/xui/pl/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/pl/menu_places_gear_folder.xml
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_folder_gear">
-	<menu_item_call label="Dodaj do Ulubionych Miejsc" name="add_landmark"/>
-	<menu_item_call label="Dodaj Folder" name="add_folder"/>
+	<menu_item_call label="Dodaj do Landmarków" name="add_landmark"/>
+	<menu_item_call label="Dodaj folder" name="add_folder"/>
 	<menu_item_call label="Wytnij" name="cut"/>
 	<menu_item_call label="Kopiuj" name="copy_folder"/>
 	<menu_item_call label="Wklej" name="paste"/>
-	<menu_item_call label="Zmień Nazwę" name="rename"/>
+	<menu_item_call label="Zmień nazwę" name="rename"/>
 	<menu_item_call label="Usuń" name="delete"/>
 	<menu_item_call label="Rozwiń" name="expand"/>
 	<menu_item_call label="Schowaj" name="collapse"/>
-	<menu_item_call label="Rozwiń Wszystkie Foldery" name="expand_all"/>
-	<menu_item_call label="Schowaj Wszystkie Foldery" name="collapse_all"/>
+	<menu_item_call label="Rozwiń wszystkie foldery" name="expand_all"/>
+	<menu_item_call label="Schowaj wszystkie foldery" name="collapse_all"/>
 	<menu_item_check label="Sortuj według daty" name="sort_by_date"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/pl/menu_places_gear_landmark.xml
index e88f650ed0..0720aea8aa 100644
--- a/indra/newview/skins/default/xui/pl/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/pl/menu_places_gear_landmark.xml
@@ -1,18 +1,18 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_ladmark_gear">
 	<menu_item_call label="Teleportuj" name="teleport"/>
-	<menu_item_call label="Więcej Informacji" name="more_info"/>
-	<menu_item_call label="Pokaż na Mapie" name="show_on_map"/>
-	<menu_item_call label="Dodaj do Ulubionych Miejsc" name="add_landmark"/>
-	<menu_item_call label="Dodaj Folder" name="add_folder"/>
+	<menu_item_call label="Więcej informacji" name="more_info"/>
+	<menu_item_call label="Pokaż na mapie" name="show_on_map"/>
+	<menu_item_call label="Dodaj do Landmarków" name="add_landmark"/>
+	<menu_item_call label="Dodaj folder" name="add_folder"/>
 	<menu_item_call label="Wytnij" name="cut"/>
-	<menu_item_call label="Kopiuj Ulubione Miejsce" name="copy_landmark"/>
+	<menu_item_call label="Kopiuj Landmark" name="copy_landmark"/>
 	<menu_item_call label="Kopiuj SLurl" name="copy_slurl"/>
 	<menu_item_call label="Wklej" name="paste"/>
-	<menu_item_call label="Zmień Nazwę" name="rename"/>
+	<menu_item_call label="Zmień nazwę" name="rename"/>
 	<menu_item_call label="Usuń" name="delete"/>
-	<menu_item_call label="Rozwiń Wszystkie Foldery" name="expand_all"/>
-	<menu_item_call label="Schowaj Wszystkie Foldery" name="collapse_all"/>
+	<menu_item_call label="Rozwiń wszystkie foldery" name="expand_all"/>
+	<menu_item_call label="Schowaj wszystkie foldery" name="collapse_all"/>
 	<menu_item_check label="Sortuj według daty" name="sort_by_date"/>
 	<menu_item_call label="Stwórz Ulubione" name="create_pick"/>
 </menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_teleport_history_item.xml b/indra/newview/skins/default/xui/pl/menu_teleport_history_item.xml
index 7e58747267..cd36c116b0 100644
--- a/indra/newview/skins/default/xui/pl/menu_teleport_history_item.xml
+++ b/indra/newview/skins/default/xui/pl/menu_teleport_history_item.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Teleport History Item Context Menu">
 	<menu_item_call label="Teleportuj" name="Teleport"/>
-	<menu_item_call label="Więcej Szczegółów" name="More Information"/>
+	<menu_item_call label="Więcej szczegółów" name="More Information"/>
 	<menu_item_call label="Kopiuj do schowka" name="CopyToClipboard"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_agent.xml b/indra/newview/skins/default/xui/pl/menu_url_agent.xml
index 0f210b140b..7c90e6582d 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_agent.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_agent.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
 	<menu_item_call label="Pokaż Profil Rezydenta" name="show_agent"/>
-	<menu_item_call label="Kopiuj Nazwę do Schowka" name="url_copy_label"/>
+	<menu_item_call label="Kopiuj nazwę do schowka" name="url_copy_label"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_group.xml b/indra/newview/skins/default/xui/pl/menu_url_group.xml
index 38e4360691..109f96e562 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_group.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_group.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż Szczegóły o Grupie" name="show_group"/>
-	<menu_item_call label="Kopiuj Grupę do Schowka" name="url_copy_label"/>
+	<menu_item_call label="Pokaż szczegóły o Grupie" name="show_group"/>
+	<menu_item_call label="Kopiuj Grupę do schowka" name="url_copy_label"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_http.xml b/indra/newview/skins/default/xui/pl/menu_url_http.xml
index 0d8793d41e..e73f7b6745 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_http.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_http.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Otwórz Przeglądarkę Internetową" name="url_open"/>
-	<menu_item_call label="Otwórz w Wewnętrzenej Przeglądarce" name="url_open_internal"/>
-	<menu_item_call label="Otwórz w Zewnętrznej Przeglądarce" name="url_open_external"/>
+	<menu_item_call label="Otwórz przeglądarkę internetową" name="url_open"/>
+	<menu_item_call label="Otwórz w wewnętrzenej przeglądarce" name="url_open_internal"/>
+	<menu_item_call label="Otwórz w zewnętrznej przeglądarce" name="url_open_external"/>
 	<menu_item_call label="Kopiuj URL do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_inventory.xml b/indra/newview/skins/default/xui/pl/menu_url_inventory.xml
index c11860d6fe..ce3309cba0 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_inventory.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż Obiekt w Szafie" name="show_item"/>
-	<menu_item_call label="Kopiuj Nazwę do Schowka" name="url_copy_label"/>
+	<menu_item_call label="Pokaż obiekt w Szafie" name="show_item"/>
+	<menu_item_call label="Kopiuj nazwę do schowka" name="url_copy_label"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_map.xml b/indra/newview/skins/default/xui/pl/menu_url_map.xml
index becbd8276f..179ab1f676 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_map.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_map.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż na Mapie" name="show_on_map"/>
-	<menu_item_call label="Teleportuj do Miejsca" name="teleport_to_location"/>
+	<menu_item_call label="Pokaż na mapie" name="show_on_map"/>
+	<menu_item_call label="Teleportuj do miejsca" name="teleport_to_location"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_objectim.xml b/indra/newview/skins/default/xui/pl/menu_url_objectim.xml
index 0bdf1da2a4..7576208a9e 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_objectim.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_objectim.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż Szczegóły o Obiekcie" name="show_object"/>
-	<menu_item_call label="Pokaż na Mapie" name="show_on_map"/>
-	<menu_item_call label="Teleportuj to Miejsca Obiektu" name="teleport_to_object"/>
-	<menu_item_call label="Kopiuj Nazwę Obiektu do Schowka" name="url_copy_label"/>
+	<menu_item_call label="Pokaż szczegóły o obiekcie" name="show_object"/>
+	<menu_item_call label="Pokaż na mapie" name="show_on_map"/>
+	<menu_item_call label="Teleportuj to miejsca obiektu" name="teleport_to_object"/>
+	<menu_item_call label="Kopiuj nazwę obiektu do schowka" name="url_copy_label"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_parcel.xml b/indra/newview/skins/default/xui/pl/menu_url_parcel.xml
index 881c010bc1..43b945b8be 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_parcel.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_parcel.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż Szczegóły o Miejscu" name="show_parcel"/>
-	<menu_item_call label="Pokaż na Mapie" name="show_on_map"/>
+	<menu_item_call label="Pokaż szczegóły o Miejscu" name="show_parcel"/>
+	<menu_item_call label="Pokaż na mapie" name="show_on_map"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_url_slurl.xml b/indra/newview/skins/default/xui/pl/menu_url_slurl.xml
index b9fa692365..456146d8e5 100644
--- a/indra/newview/skins/default/xui/pl/menu_url_slurl.xml
+++ b/indra/newview/skins/default/xui/pl/menu_url_slurl.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <context_menu name="Url Popup">
-	<menu_item_call label="Pokaż Szczegóły o Miejscu" name="show_place"/>
-	<menu_item_call label="Pokaż na Mapie" name="show_on_map"/>
+	<menu_item_call label="Pokaż szczegóły o Miejscu" name="show_place"/>
+	<menu_item_call label="Pokaż na mapie" name="show_on_map"/>
 	<menu_item_call label="Teleportuj do miejsca" name="teleport_to_location"/>
 	<menu_item_call label="Kopiuj SLurl do schowka" name="url_copy"/>
 </context_menu>
diff --git a/indra/newview/skins/default/xui/pl/menu_viewer.xml b/indra/newview/skins/default/xui/pl/menu_viewer.xml
index 23a17f4eda..85ceb9592f 100644
--- a/indra/newview/skins/default/xui/pl/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/pl/menu_viewer.xml
@@ -8,7 +8,7 @@
 		<menu_item_call label="Mój Wygląd" name="Appearance"/>
 		<menu_item_check label="Moja Szafa" name="Inventory"/>
 		<menu_item_check label="Moja Szafa" name="ShowSidetrayInventory"/>
-		<menu_item_check label="Moje Gesturki" name="Gestures"/>
+		<menu_item_check label="Moje Gesty" name="Gestures"/>
 		<menu label="Mój Status" name="Status">
 			<menu_item_call label="Tryb Oddalenia" name="Set Away"/>
 			<menu_item_call label="Tryb Pracy" name="Set Busy"/>
@@ -75,7 +75,7 @@
 			<menu_item_call label="Zaznacz Wszystko" name="Select All"/>
 			<menu_item_call label="Cofnij Zaznaczenie" name="Deselect"/>
 		</menu>
-		<menu_item_call label="Grupuj" name="Link"/>
+		<menu_item_call label="Linkuj" name="Link"/>
 		<menu_item_call label="Rozlinkuj" name="Unlink"/>
 		<menu_item_check label="Edytuj Zgrupowane Obiekty" name="Edit Linked Parts"/>
 		<menu_item_call label="Ogniskowa Selekcji" name="Focus on Selection"/>
diff --git a/indra/newview/skins/default/xui/pl/mime_types.xml b/indra/newview/skins/default/xui/pl/mime_types.xml
index c90d5761e6..cbf2afa91d 100644
--- a/indra/newview/skins/default/xui/pl/mime_types.xml
+++ b/indra/newview/skins/default/xui/pl/mime_types.xml
@@ -2,13 +2,13 @@
 <mimetypes name="default">
 	<widgetset name="web">
 		<label name="web_label">
-			Zawartość Strony Internetowej
+			Zawartość przeglądarki internetowej
 		</label>
 		<tooltip name="web_tooltip">
-			To miejsce posiada zawartość strony internetowej
+			To miejsce posiada zawartość przeglądarki internetowej
 		</tooltip>
 		<playtip name="web_playtip">
-			Pokaż zawartość strony internetowej
+			Pokaż zawartość przeglądarki internetowej
 		</playtip>
 	</widgetset>
 	<widgetset name="movie">
diff --git a/indra/newview/skins/default/xui/pl/mime_types_linux.xml b/indra/newview/skins/default/xui/pl/mime_types_linux.xml
index 0c901809dc..a2b8168b51 100644
--- a/indra/newview/skins/default/xui/pl/mime_types_linux.xml
+++ b/indra/newview/skins/default/xui/pl/mime_types_linux.xml
@@ -2,13 +2,13 @@
 <mimetypes name="default">
 	<widgetset name="web">
 		<label name="web_label">
-			Zawartość Strony Internetowej
+			Zawartość przeglądarki internetowej
 		</label>
 		<tooltip name="web_tooltip">
-			W tym miejscu można zobaczyć zawartość strony internetowej
+			W tym miejscu można zobaczyć zawartość przeglądarki internetowej
 		</tooltip>
 		<playtip name="web_playtip">
-			Pokaż zawartość strony internetowej
+			Pokaż zawartość przeglądarki internetowej
 		</playtip>
 	</widgetset>
 	<widgetset name="movie">
diff --git a/indra/newview/skins/default/xui/pl/mime_types_mac.xml b/indra/newview/skins/default/xui/pl/mime_types_mac.xml
index bd39ff7ac3..ae860249bb 100644
--- a/indra/newview/skins/default/xui/pl/mime_types_mac.xml
+++ b/indra/newview/skins/default/xui/pl/mime_types_mac.xml
@@ -2,13 +2,13 @@
 <mimetypes name="default">
 	<widgetset name="web">
 		<label name="web_label">
-			Zawartość Przeglądarki Internetowej
+			Zawartość przeglądarki internetowej
 		</label>
 		<tooltip name="web_tooltip">
-			To miejsce posiada zawartość internetową
+			W tym miejscu można zobaczyć zawartość przeglądarki internetowej
 		</tooltip>
 		<playtip name="web_playtip">
-			Pokaż Zawartość Przeglądarki Internetowej
+			Pokaż zawartość przeglądarki internetowej
 		</playtip>
 	</widgetset>
 	<widgetset name="movie">
diff --git a/indra/newview/skins/default/xui/pl/notifications.xml b/indra/newview/skins/default/xui/pl/notifications.xml
index f565a0fa18..12d68ed30e 100644
--- a/indra/newview/skins/default/xui/pl/notifications.xml
+++ b/indra/newview/skins/default/xui/pl/notifications.xml
@@ -89,7 +89,7 @@ Sprawdź stan swojego połączenia sieciowego.
 		W trakcie ładwania tekstu dla skryptu pojawił się problem z następującego powodu: [REASON]. Spróbuj ponownie za kilka minut.
 	</notification>
 	<notification name="CompileQueueSaveBytecode">
-		W trakcie ładwania skompilowanego skryptu pojawił się problem z następującego powodu: [REASON]. Spróbuj ponownie za kilka minut.
+		W trakcie ładowania skompilowanego skryptu pojawił się problem z następującego powodu: [REASON]. Spróbuj ponownie za kilka minut.
 	</notification>
 	<notification name="WriteAnimationFail">
 		Problem w zapisywaniu danych animacji. Spróbuj ponownie za kilka minut.
@@ -255,7 +255,7 @@ Obiekty: [N]
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="DisableAllTopObjects">
-		Czy na pewno chcesz deaktywować wszystkie obiekty w tym regionie?
+		Czy na pewno chcesz deaktywować wszystkie obiekty w tym Regionie?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="ReturnObjectsNotOwnedByGroup">
@@ -325,7 +325,7 @@ Czy chcesz przejść na stronę www.secondlife.com by założyć konto?
 	<notification name="AddClassified">
 		Ogłoszenia reklamowe ukazują się w zakładce Reklama w wyszukiwarce (Szukaj) oraz na [http://secondlife.com/community/classifieds secondlife.com] przez tydzień.
 Napisz treść swojej reklamy, kliknij Zamieść by dodać katalogu ogłoszeń.
-Po zamieszczeniu reklamy zostaniesz poproszony o sprecyzowanie opłaty za reklamę.
+Po zamieszczeniu reklamy zostaniesz poproszony o sprecyzowanie opłaty za Reklamę.
 Im wyższa opłata tym wyżej Twoja reklama wyświetla się w katalogu i wyszukiwarce po wpisaniu słów kluczowych.
 		<usetemplate ignoretext="Jak stworzyć nową reklamę?" name="okcancelignore" notext="Anuluj" yestext="OK"/>
 	</notification>
@@ -340,7 +340,7 @@ Czy na pewno chcesz kontynuować?
 		<usetemplate ignoretext="Potwierdź przed usunięciem mediów z obiektu" name="okcancelignore" notext="Nie" yestext="Tak"/>
 	</notification>
 	<notification name="ClassifiedSave">
-		Zapisać zmiany w reklamie [NAME]?
+		Zapisać zmiany w Reklamie [NAME]?
 		<usetemplate canceltext="Anuluj" name="yesnocancelbuttons" notext="Nie Zapisuj" yestext="Zapisz"/>
 	</notification>
 	<notification name="ClassifiedInsufficientFunds">
@@ -352,7 +352,7 @@ Czy na pewno chcesz kontynuować?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="PromptGoToEventsPage">
-		Odwiedzić internetową stronę imprez [SECOND_LIFE]?
+		Odwiedzić internetową stronę Imprez [SECOND_LIFE]?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="SelectProposalToView">
@@ -392,17 +392,17 @@ Usuń kilka etapów i zapisz jeszcze raz.
 	</notification>
 	<notification name="GestureSaveFailedObjectNotFound">
 		Nie można zapisać gestu ponieważ obiekt lub szafa powiązanego obiektu nie został znaleziony.
-Obiekt może znajdować się zbyt daleko albo został usuniety.
+Obiekt może znajdować się zbyt daleko albo został usunięty.
 	</notification>
 	<notification name="GestureSaveFailedReason">
-		Nie można zapisać gestu z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz póżniej.
+		Nie można zapisać gestu z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz później.
 	</notification>
 	<notification name="SaveNotecardFailObjectNotFound">
 		Nie można zapisać notki ponieważ obiekt lub szafa powiązanego obiektu nie został znaleziony.
 Obiekt może znajdować się zbyt daleko albo został usuniety.
 	</notification>
 	<notification name="SaveNotecardFailReason">
-		Nie można zapisać notki z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz póżniej.
+		Nie można zapisać notki z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz później.
 	</notification>
 	<notification name="ScriptCannotUndo">
 		Nie można cofnąć wszystkich zmian w Twojej wersji skryptu.
@@ -411,7 +411,7 @@ Czy chcesz załadować ostatnią wersję zapisaną na serwerze?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="SaveScriptFailReason">
-		Nie można zapisać skryptu z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz póżniej.
+		Nie można zapisać skryptu z następującego powodu: [REASON]. Spróbuj zapisać jeszcze raz później.
 	</notification>
 	<notification name="SaveScriptFailObjectNotFound">
 		Nie można zapisać skryptu ponieważ obiekt w którym się zawiera nie został znaleziony.
@@ -517,7 +517,7 @@ Odwiedź stronę [_URL] po więcej informacji na temat zakupu L$?
 	</notification>
 	<notification name="UnableToLinkObjects">
 		Nie można połączyć [COUNT] obiektów.
-Maksimalnie można połączyć [MAX] obiektów.
+Maksymalnie można połączyć [MAX] obiektów.
 	</notification>
 	<notification name="CannotLinkIncompleteSet">
 		Możesz łączyć tylko kompletne zbiory obiektów i musisz wybrać więcej niż jeden obiekt.
@@ -682,7 +682,7 @@ Jeśli nadal nie możesz się teleportować wyloguj się i ponownie zaloguj.
 		Czekamy na Twoje akcesoria. Możesz poczekać kilka minut lub zrobić relog przed następną próbą teleportacji.
 	</notification>
 	<notification name="too_many_uploads_tport">
-		Obecnie ten region ma problemy z ładowaniem obiektów w związku z czym teleportacja bardzo sie opóznia.
+		Obecnie ten region ma problemy z ładowaniem obiektów w związku z czym teleportacja bardzo sie opóźnia.
 Spróbuj jeszcze raz za kilka minut albo teleportuj się do mniej zatłoczonego miejsca.
 	</notification>
 	<notification name="expired_tport">
@@ -864,10 +864,10 @@ Połączyć posiadłości?
 		Zmiana rozdzielczości do [RESX] x [RESY] nie powidła się
 	</notification>
 	<notification name="ErrorUndefinedGrasses">
-		Błąd: Niezdefiniowane trawy: [SPECIES]
+		Błąd: niezdefiniowane trawy: [SPECIES]
 	</notification>
 	<notification name="ErrorUndefinedTrees">
-		Bład: Niezdefiniowane drzewa: [SPECIES]
+		Bład: niezdefiniowane drzewa: [SPECIES]
 	</notification>
 	<notification name="CannotSaveWearableOutOfSpace">
 		Nie można zapisać &apos;[NAME]&apos; do pliku stroju. Musisz zwolnić trochę miejsca na Twoim komputerze i zapisać strój jeszcze raz.
@@ -930,7 +930,7 @@ ze wszystkich posiadłości w tym symulatorze?
 		<usetemplate name="okcancelbuttons" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="BlankClassifiedName">
-		Musisz nadać tytuł Twojej reklamie.
+		Musisz nadać tytuł Twojej Reklamie.
 	</notification>
 	<notification name="MinClassifiedPrice">
 		Minimalna cena za publikację wynosi [MIN_PRICE]L$.
@@ -1132,10 +1132,10 @@ Zamień teksturę [TEXTURE_NUM] na 24-o bitową teksturę o wymiarze 512x512 lub
 		Maksymalna liczba gości wynosi [MAX_AGENTS].
 	</notification>
 	<notification name="MaxBannedAgentsOnRegion">
-		Maksymalna liczba nieporządanych Rezydentów (banów) wynosi [MAX_BANNED].
+		Maksymalna liczba niepożądanych Rezydentów (banów) wynosi [MAX_BANNED].
 	</notification>
 	<notification name="MaxAgentOnRegionBatch">
-		Próba dodania [NUM_ADDED] osób nie powidła się:
+		Próba dodania [NUM_ADDED] osób nie powiodła się:
 [MAX_AGENTS] [LIST_TYPE] limit przekroczony o [NUM_EXCESS].
 	</notification>
 	<notification name="MaxAllowedGroupsOnRegion">
@@ -1223,7 +1223,7 @@ Pobrać i zapisać w folderze Aplikacji?
 		<usetemplate name="okcancelbuttons" notext="Kontynuuj" yestext="Załaduj"/>
 	</notification>
 	<notification name="DeedObjectToGroup">
-		Przekazanie tego obiektu spowoduje, że grupa:
+		Przekazanie tego obiektu spowoduje, że Grupa:
 * Otrzyma L$ zapłacone temu obiektowi
 		<usetemplate ignoretext="Proszę potwierdzić decyzję przed przepisaniem obiektu do grupy" name="okcancelignore" notext="Anuluj" yestext="Przekaż"/>
 	</notification>
@@ -1583,7 +1583,7 @@ Zazwyczaj musi upłynąć nieco czasu zanim ta zmiana zostanie odzwierciedlona n
 Aby wejść do regionu Adult, Rezydenci muszą posiadać zweryfikowane konto, albo w wyniku weryfikacji wieku albo płatości.
 	</notification>
 	<notification label="Wersja Niezgodna z Systemem Rozmów" name="VoiceVersionMismatch">
-		Ta wersja [APP_NAME] nie jest kompatybilna z systemem Rozmów w tym regionie. Musisz zainstalować aktualną wersję [APP_NAME] komunikacja głosowa działała poprawnie.
+		Ta wersja [APP_NAME] nie jest kompatybilna z systemem rozmów w tym Regionie. Musisz zainstalować aktualną wersję [APP_NAME] aby komunikacja głosowa działała poprawnie.
 	</notification>
 	<notification label="Nie Można Kupić Obiektów" name="BuyObjectOneOwner">
 		Jednorazowo możesz kupować tylko od jednego właściciela.
@@ -1660,20 +1660,20 @@ Wpisz hasło ponownie i kliknij OK.
 	</notification>
 	<notification name="SetPickLocation">
 		Uwaga:
-Lokacja tego wyboru została zaktualizowana ale pozostałe szczegóły zachowają oryginalne wartości.
+Lokalizacja tego wyboru została zaktualizowana ale pozostałe szczegóły zachowają oryginalne wartości.
 		<usetemplate name="okbutton" yestext="OK"/>
 	</notification>
 	<notification name="MoveInventoryFromObject">
-		Wybrane obiekty szafy nie mają praw kopiowania.
-Obiekty zostaną przeniesione do Twojej szafy, nie zostaną skopiowane.
+		Wybrane obiekty Szafy nie mają praw kopiowania.
+Obiekty zostaną przeniesione do Twojej Szafy, nie zostaną skopiowane.
 
-Przenieść obiekty szafy?
+Przenieść obiekty Szafy?
 		<usetemplate ignoretext="Uprzedź przed przeniesieniem zawartości niekopiowalnej z obiektu" name="okcancelignore" notext="Anuluj" yestext="OK"/>
 	</notification>
 	<notification name="MoveInventoryFromScriptedObject">
-		Wybrane obiekty szafy nie mają praw kopiowania.
+		Wybrane obiekty Szafy nie mają praw kopiowania.
 Obiekty zostaną przeniesione do Twojej Szafy, nie zostaną skopiowane.
-Ponieważ obiekty zawierają skrypty, przeniesienie obiektów do Twojej szafy może spowodować niepoprawne działanie skryptów.
+Ponieważ obiekty zawierają skrypty, przeniesienie obiektów do Twojej Szafy może spowodować niepoprawne działanie skryptów.
 
 Przenieść obiekty szafy?
 		<usetemplate ignoretext="Uprzedź przed przeniesieniem zawartości niekopiowalnej z obiektu, która może uszkodzić skrypty obiektu" name="okcancelignore" notext="Anuluj" yestext="OK"/>
@@ -1837,7 +1837,7 @@ Zamieść go na stronie internetowej żeby umożliwić innym łatwy dostęp do t
 		Ustawienie już istnieje!
 	</notification>
 	<notification name="WaterNoEditDefault">
-		Domyśle ustawienie nie może być zmienione ani usunięte.
+		Domyślne ustawienie nie może być zmienione ani usunięte.
 	</notification>
 	<notification name="ChatterBoxSessionStartError">
 		Błąd podczas rozpoczynania czatu/IM z [RECIPIENT].
@@ -2025,7 +2025,7 @@ i wybierając folder Zapisane Miejsca (LM).
 (Kliknij dwa razy na miejsce (LM) i wybierz &apos;Teleport&apos; żeby tam się przenieść.)
 	</notification>
 	<notification name="TeleportToPerson">
-		Możesz skontaktować się z Rezydentem &apos;[NAME]&apos; poprzez otworzenie panelu Ludzie po prawej stronei ekranu.
+		Możesz skontaktować się z Rezydentem &apos;[NAME]&apos; poprzez otworzenie panelu Ludzie po prawej stronie ekranu.
 Wybierz Rezydenta z listy, następnie kliknij &apos;IM&apos; na dole panelu.
 (Możesz także kliknąć podwójnie na ich imię na liście, lub prawym przyciskiem i wybrać &apos;IM&apos;).
 	</notification>
diff --git a/indra/newview/skins/default/xui/pl/panel_audio_device.xml b/indra/newview/skins/default/xui/pl/panel_audio_device.xml
index fc3b3776f0..fa8dde77eb 100644
--- a/indra/newview/skins/default/xui/pl/panel_audio_device.xml
+++ b/indra/newview/skins/default/xui/pl/panel_audio_device.xml
@@ -13,7 +13,7 @@
 		Poziom Wejścia
 	</text>
 	<text_editor name="voice_intro_text1">
-		Użyj suwaka by dostosować jak głośno Cię słychać dla innych Rezydentów. By przetestować poziom wejścia, zacznij mówić do mikrofonu.
+		Użyj suwaka by dostosować jak głośno Cię słychać dla innych Rezydentów. W celu przetestowania poziomu wejścia, zacznij mówić do mikrofonu.
 	</text_editor>
 	<volume_slider name="mic_volume_slider"
 	     tool_tip="By zmienić poziom głośności użyj suwaka" />
diff --git a/indra/newview/skins/default/xui/pl/panel_bottomtray.xml b/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
index 043db94c95..e21d8a077d 100644
--- a/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/pl/panel_bottomtray.xml
@@ -16,7 +16,7 @@
 			<gesture_combo_list label="Gestury" name="Gesture" tool_tip="Pokazuje/Ukrywa gestury"/>
 		</layout_panel>
 		<layout_panel name="movement_panel">
-			<button label="Move" name="movement_btn" tool_tip="Pokaż/Ukryj Ustawienia Ruchu"/>
+			<button label="Ruch" name="movement_btn" tool_tip="Pokaż/Ukryj Ustawienia Ruchu"/>
 		</layout_panel>
 		<layout_panel name="cam_panel">
 			<button label="Widok" name="camera_btn" tool_tip="Pokaż/Ukryj Ustawienia Kamery"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_bottomtray_lite.xml b/indra/newview/skins/default/xui/pl/panel_bottomtray_lite.xml
index 8be5324dd4..77d2e86b7e 100644
--- a/indra/newview/skins/default/xui/pl/panel_bottomtray_lite.xml
+++ b/indra/newview/skins/default/xui/pl/panel_bottomtray_lite.xml
@@ -2,7 +2,7 @@
 <panel name="bottom_tray_lite">
 	<layout_stack name="toolbar_stack_lite">
 		<layout_panel name="gesture_panel">
-			<gesture_combo_list label="Gestura" name="Gesture" tool_tip="Pokaż/ukryj gestury"/>
+			<gesture_combo_list label="Gest" name="Gest" tool_tip="Pokaż/ukryj gestury"/>
 		</layout_panel>
 	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml b/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
index bf3c0f4789..f4ea9303aa 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_jacket.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_jacket_panel">
 	<panel name="avatar_jacket_color_panel">
-		<texture_picker label="Górny Materiał" name="Upper Fabric" tool_tip="Kliknij aby wybrać teksturę"/>
-		<texture_picker label="Dolny Materiał" name="Lower Fabric" tool_tip="Kliknij aby wybrać teksturę"/>
+		<texture_picker label="Górny materiał" name="Upper Fabric" tool_tip="Kliknij aby wybrać teksturę"/>
+		<texture_picker label="Dolny materiał" name="Lower Fabric" tool_tip="Kliknij aby wybrać teksturę"/>
 		<color_swatch label="Kolor/Barwa" name="Color/Tint" tool_tip="Kliknij aby wybrać kolor"/>
 	</panel>
 	<accordion name="wearable_accordion">
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_pick.xml b/indra/newview/skins/default/xui/pl/panel_edit_pick.xml
index f07f5496be..22fb00671d 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_pick.xml
@@ -21,7 +21,7 @@
 			<text name="pick_location">
 				ładowanie...
 			</text>
-			<button label="Ustaw na Bieżąca Lokalizacje" name="set_to_curr_location_btn"/>
+			<button label="Ustaw na bieżąca lokalizację" name="set_to_curr_location_btn"/>
 		</panel>
 	</scroll_container>
 	<panel label="bottom_panel" name="bottom_panel">
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_profile.xml b/indra/newview/skins/default/xui/pl/panel_edit_profile.xml
index 3f3d32c9fc..edd7415751 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_profile.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_profile.xml
@@ -10,11 +10,11 @@
 	<string name="AcctTypeTrial" value="Próbne"/>
 	<string name="AcctTypeCharterMember" value="Członek-zalożyciel"/>
 	<string name="AcctTypeEmployee" value="Pracownik Linden Lab"/>
-	<string name="PaymentInfoUsed" value="Dane Konta Używane"/>
-	<string name="PaymentInfoOnFile" value="Dane Konta Dostępne"/>
-	<string name="NoPaymentInfoOnFile" value="Brak Danych Konta"/>
-	<string name="AgeVerified" value="Wiek Zweryfikowany"/>
-	<string name="NotAgeVerified" value="Brak Weryfikacji Wieku"/>
+	<string name="PaymentInfoUsed" value="Dane konta używane"/>
+	<string name="PaymentInfoOnFile" value="Dane konta dostępne"/>
+	<string name="NoPaymentInfoOnFile" value="Brak danych konta"/>
+	<string name="AgeVerified" value="Wiek zweryfikowany"/>
+	<string name="NotAgeVerified" value="Brak weryfikacji wieku"/>
 	<string name="partner_edit_link_url">
 		http://www.secondlife.com/account/partners.php?lang=pl
 	</string>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
index 5efa402698..b5e1828588 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_tattoo.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel name="edit_tattoo_panel">
 	<panel name="avatar_tattoo_color_panel">
-		<texture_picker label="Tatuaż Głowy" name="Head Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
-		<texture_picker label="Tatuaż Górnej Części Ciała" name="Upper Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
-		<texture_picker label="Tatuaż Dolnej Części Ciała" name="Lower Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
+		<texture_picker label="Tatuaż głowy" name="Head Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
+		<texture_picker label="Tatuaż górnej części ciała" name="Upper Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
+		<texture_picker label="Tatuaż dolnej części ciała" name="Lower Tattoo" tool_tip="Kliknij by wybrać grafikę"/>
 	</panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml b/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
index 9bd89f0b36..cf17afea3f 100644
--- a/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/pl/panel_edit_wearable.xml
@@ -4,46 +4,46 @@
 		Edycja kształtu
 	</string>
 	<string name="edit_skin_title">
-		Edycja Skórki
+		Edycja skórki
 	</string>
 	<string name="edit_hair_title">
-		Edycja Włosów
+		Edycja włosów
 	</string>
 	<string name="edit_eyes_title">
-		Edycja Oczu
+		Edycja oczu
 	</string>
 	<string name="edit_shirt_title">
-		Edycja Spódnicy
+		Edycja spódnicy
 	</string>
 	<string name="edit_pants_title">
-		Edycja Spodni
+		Edycja spodni
 	</string>
 	<string name="edit_shoes_title">
-		Edycja Butów
+		Edycja butów
 	</string>
 	<string name="edit_socks_title">
-		Edycja Skarpetek
+		Edycja skarpetek
 	</string>
 	<string name="edit_jacket_title">
-		Edycja Kurtki
+		Edycja kurtki
 	</string>
 	<string name="edit_skirt_title">
-		Edycja Spódnicy
+		Edycja spódnicy
 	</string>
 	<string name="edit_gloves_title">
-		Edycja Rękawiczek
+		Edycja rękawiczek
 	</string>
 	<string name="edit_undershirt_title">
-		Edycja Podkoszulki
+		Edycja podkoszulki
 	</string>
 	<string name="edit_underpants_title">
-		Edycja Bielizny
+		Edycja bielizny
 	</string>
 	<string name="edit_alpha_title">
-		Edycja Maski Alpha
+		Edycja maski Alpha
 	</string>
 	<string name="edit_tattoo_title">
-		Edycja Tatuażu
+		Edycja tatuażu
 	</string>
 	<string name="shape_desc_text">
 		Kształt:
diff --git a/indra/newview/skins/default/xui/pl/panel_group_general.xml b/indra/newview/skins/default/xui/pl/panel_group_general.xml
index 0dc955c096..67fa0bf085 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_general.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_general.xml
@@ -18,7 +18,7 @@ By otrzymać pomoc i dodatkowe wskazówki przesuń kursor na przyciski.
 		</text>
 		<name_box initial_value="(przetwarzanie)" name="founder_name"/>
 		<text name="join_cost_text">
-			Wstęp Wolny
+			Wstęp wolny
 		</text>
 		<button label="DOŁĄCZ TERAZ!" name="btn_join"/>
 	</panel>
@@ -43,8 +43,8 @@ By otrzymać pomoc i dodatkowe wskazówki przesuń kursor na przyciski.
 		<text name="group_settngs_label">
 			Grupa
 		</text>
-		<check_box label="Wolny Wstęp" name="open_enrollement" tool_tip="Sprawdź czy grupa oferuje wolny wstęp i nie wymaga zaproszenia."/>
-		<check_box label="Opłata Wstępu" name="check_enrollment_fee" tool_tip="Ustaw opłatę za przyłączenie się do grupy."/>
+		<check_box label="Wolny wstęp" name="open_enrollement" tool_tip="Sprawdź czy grupa oferuje wolny wstęp i nie wymaga zaproszenia."/>
+		<check_box label="Opłata wstępu" name="check_enrollment_fee" tool_tip="Ustaw opłatę za przyłączenie się do grupy."/>
 		<spinner label="L$" name="spin_enrollment_fee" tool_tip="Nowi członkowie grupy muszą zapłacić wymaganą opłatę by dołączyć do grupy."/>
 		<combo_box name="group_mature_check" tool_tip="Wybierz jeżeli uważasz, iż Twoja grupa klasyfikowana jest jako &apos;Mature&apos;.">
 			<combo_box.item label="Treść &apos;PG&apos;" name="pg"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/pl/panel_group_info_sidetray.xml
index dd4938d50b..509c2893cf 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_info_sidetray.xml
@@ -29,7 +29,7 @@
 			<button label="Czat" name="btn_chat"/>
 			<button label="Konferencja Głosowa" name="btn_call" tool_tip="Konferencja Głosowa"/>
 			<button label="Zapisz" label_selected="Zapisz" name="btn_apply"/>
-			<button label="Stwórz nową grupę" name="btn_create" tool_tip="Stwórz nową grupę"/>
+			<button label="Stwórz nową Grupę" name="btn_create" tool_tip="Stwórz nową Grupę"/>
 		</layout_panel>
 	</layout_stack>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_group_invite.xml b/indra/newview/skins/default/xui/pl/panel_group_invite.xml
index 335fff8458..e520c06944 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_invite.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_invite.xml
@@ -4,7 +4,7 @@
 		Jesteś pewny, że chcesz wybrać nowych właścieli grupy? Ta decyzja jest ostateczna!
 	</panel.string>
 	<panel.string name="loading">
-		(loading...)
+		(ładowanie...)
 	</panel.string>
 	<panel.string name="already_in_group">
 		Niektórzy Rezydenci, których wybrałeś już należą do grupy i nie otrzymali zaproszenia.
diff --git a/indra/newview/skins/default/xui/pl/panel_group_notices.xml b/indra/newview/skins/default/xui/pl/panel_group_notices.xml
index c973bcd24f..31882ab0e6 100644
--- a/indra/newview/skins/default/xui/pl/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/pl/panel_group_notices.xml
@@ -39,11 +39,11 @@ Limit dzienny ogłoszeń dla grupy wynosi 200.
 		</text>
 		<button label="Usuń załącznik" label_selected="Usuń Załącznik" name="remove_attachment" tool_tip="Usuń załącznik z noty"/>
 		<button label="Wyślij" label_selected="Wyślij" name="send_notice"/>
-		<group_drop_target name="drop_target" tool_tip="Przeciągnij załącznik ze swojej Szafy na pole docelowe aby wysłać go z ogłoszeniem. Musisz posiadać prawo do kopiowania i transferu załącznika aby go dodać do ogłoszenia."/>
+		<group_drop_target name="drop_target" tool_tip="Przeciągnij załącznik ze swojej Szafy na pole docelowe aby wysłać go z Ogłoszeniem. Musisz posiadać prawo do kopiowania i transferu załącznika aby go dodać do ogłoszenia."/>
 	</panel>
-	<panel label="Zobacz Przeszłe Ogłoszenia" name="panel_view_past_notice">
+	<panel label="Zobacz przeszłe Ogłoszenia" name="panel_view_past_notice">
 		<text name="lbl">
-			Ogłoszenia Zachowane
+			Ogłoszenia zachowane
 		</text>
 		<text name="lbl2">
 			W celu wysłania nowego ogłoszenia kliknij przycisk +
diff --git a/indra/newview/skins/default/xui/pl/panel_landmarks.xml b/indra/newview/skins/default/xui/pl/panel_landmarks.xml
index ccd3409015..dcc495b5a8 100644
--- a/indra/newview/skins/default/xui/pl/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/pl/panel_landmarks.xml
@@ -2,7 +2,7 @@
 <panel name="Landmarks">
 	<accordion name="landmarks_accordion">
 		<accordion_tab name="tab_favorites" title="Ulubione"/>
-		<accordion_tab name="tab_landmarks" title="Miejsca Zapisane"/>
+		<accordion_tab name="tab_landmarks" title="Landmarki"/>
 		<accordion_tab name="tab_inventory" title="Moja Szafa"/>
 		<accordion_tab name="tab_library" title="Biblioteka"/>
 	</accordion>
diff --git a/indra/newview/skins/default/xui/pl/panel_main_inventory.xml b/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
index 648f6e2ff0..e0d9def8b3 100644
--- a/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/pl/panel_main_inventory.xml
@@ -13,10 +13,10 @@
 		<menu label="Plik" name="File">
 			<menu_item_call label="Otwórz" name="Open"/>
 			<menu label="Załaduj" name="upload">
-				<menu_item_call label="Obraz (L$[COST])..." name="Upload Image"/>
-				<menu_item_call label="Dźwięk (L$[COST])..." name="Upload Sound"/>
-				<menu_item_call label="Animację (L$[COST])..." name="Upload Animation"/>
-				<menu_item_call label="Zbiór Plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
+				<menu_item_call label="obraz (L$[COST])..." name="Upload Image"/>
+				<menu_item_call label="dźwięk (L$[COST])..." name="Upload Sound"/>
+				<menu_item_call label="animację (L$[COST])..." name="Upload Animation"/>
+				<menu_item_call label="zbiór plików (L$[COST] za jeden plik)..." name="Bulk Upload"/>
 			</menu>
 			<menu_item_call label="Nowe Okno" name="New Window"/>
 			<menu_item_call label="Pokaż Filtry" name="Show Filters"/>
@@ -26,41 +26,41 @@
 			<menu_item_call label="Opróżnij Folder Zgubione i Znalezione" name="Empty Lost And Found"/>
 		</menu>
 		<menu label="Stwórz" name="Create">
-			<menu_item_call label="Nowy Folder" name="New Folder"/>
-			<menu_item_call label="Nowy Skrypt" name="New Script"/>
-			<menu_item_call label="Nowa Nota" name="New Note"/>
-			<menu_item_call label="Nową Gesturkę" name="New Gesture"/>
+			<menu_item_call label="Nowy folder" name="New Folder"/>
+			<menu_item_call label="Nowy skrypt" name="New Script"/>
+			<menu_item_call label="Nowa nota" name="New Note"/>
+			<menu_item_call label="Nowy gest" name="New Gesture"/>
 			<menu label="Nowe Ubranie" name="New Clothes">
-				<menu_item_call label="Nową Koszulkę" name="New Shirt"/>
-				<menu_item_call label="Nowe Spodnie" name="New Pants"/>
-				<menu_item_call label="Nowe Buty" name="New Shoes"/>
-				<menu_item_call label="Nowe Skarpetki" name="New Socks"/>
-				<menu_item_call label="Nową Kurtkę" name="New Jacket"/>
-				<menu_item_call label="Nową Spódnicę" name="New Skirt"/>
-				<menu_item_call label="Nowe Rękawiczki" name="New Gloves"/>
-				<menu_item_call label="Nowy Podkoszulek" name="New Undershirt"/>
-				<menu_item_call label="Nową Bieliznę" name="New Underpants"/>
-				<menu_item_call label="Nowe Ubranie Przezroczyste" name="New Alpha"/>
-				<menu_item_call label="Nowy Tatuaż" name="New Tattoo"/>
+				<menu_item_call label="Nową kkoszulkę" name="New Shirt"/>
+				<menu_item_call label="Nowe spodnie" name="New Pants"/>
+				<menu_item_call label="Nowe buty" name="New Shoes"/>
+				<menu_item_call label="Nowe skarpetki" name="New Socks"/>
+				<menu_item_call label="Nową kurtkę" name="New Jacket"/>
+				<menu_item_call label="Nową spódnicę" name="New Skirt"/>
+				<menu_item_call label="Nowe rękawiczki" name="New Gloves"/>
+				<menu_item_call label="Nowy podkoszulek" name="New Undershirt"/>
+				<menu_item_call label="Nową bieliznę" name="New Underpants"/>
+				<menu_item_call label="Nowe ubranie Alpha" name="New Alpha"/>
+				<menu_item_call label="Nowy tatuaż" name="New Tattoo"/>
 			</menu>
 			<menu label="Nową Część Ciała" name="New Body Parts">
-				<menu_item_call label="Nowy Kształt" name="New Shape"/>
-				<menu_item_call label="Nową Skórkę" name="New Skin"/>
-				<menu_item_call label="Nowe Włosy" name="New Hair"/>
-				<menu_item_call label="Nowe Oczy" name="New Eyes"/>
+				<menu_item_call label="Nowy kształt" name="New Shape"/>
+				<menu_item_call label="Nową skórkę" name="New Skin"/>
+				<menu_item_call label="Nowe włosy" name="New Hair"/>
+				<menu_item_call label="Nowe oczy" name="New Eyes"/>
 			</menu>
 		</menu>
 		<menu label="Uporządkuj" name="Sort">
-			<menu_item_check label="Wegług Nazwy" name="By Name"/>
-			<menu_item_check label="Według Daty" name="By Date"/>
+			<menu_item_check label="Wegług bazwy" name="By Name"/>
+			<menu_item_check label="Według daty" name="By Date"/>
 			<menu_item_check label="Foldery zawsze według nazwy" name="Folders Always By Name"/>
-			<menu_item_check label="Foldery Systemowe od Góry" name="System Folders To Top"/>
+			<menu_item_check label="Foldery Systemowe od góry" name="System Folders To Top"/>
 		</menu>
 	</menu_bar>
 	<filter_editor label="Filtr" name="inventory search editor"/>
 	<tab_container name="inventory filter tabs">
-		<inventory_panel label="Wszystkie Obiekty" name="All Items"/>
-		<inventory_panel label="Ostatnio Dodane Obiekty" name="Recent Items"/>
+		<inventory_panel label="Wszystkie obiekty" name="All Items"/>
+		<inventory_panel label="Ostatnio dodane obiekty" name="Recent Items"/>
 	</tab_container>
 	<panel name="bottom_panel">
 		<button name="options_gear_btn" tool_tip="Pokaż dodatkowe opcje"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml b/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
index 4d91c3cdc8..939bcbbb42 100644
--- a/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
+++ b/indra/newview/skins/default/xui/pl/panel_media_settings_permissions.xml
@@ -11,10 +11,10 @@
 			Mini
 		</combo_item>
 	</combo_box>
-	<check_box initial_value="false" label="Pozwól na Nawigację &amp; Interaktywność" name="perms_owner_interact"/>
+	<check_box initial_value="false" label="Pozwól na nawigację &amp; interaktywność" name="perms_owner_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_owner_control"/>
-	<check_box initial_value="false" label="Pozwól na Nawigację &amp; Interaktywność" name="perms_group_interact"/>
+	<check_box initial_value="false" label="Pozwól na nawigację &amp; Interaktywność" name="perms_group_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_group_control"/>
-	<check_box initial_value="false" label="Pozwól na Nawigację &amp; Interaktywność" name="perms_anyone_interact"/>
+	<check_box initial_value="false" label="Pozwól na nawigację &amp; interaktywność" name="perms_anyone_interact"/>
 	<check_box initial_value="false" label="Pokaż Pasek Kontroli" name="perms_anyone_control"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_media_settings_security.xml b/indra/newview/skins/default/xui/pl/panel_media_settings_security.xml
index a9b5e71a3b..da3142b54e 100644
--- a/indra/newview/skins/default/xui/pl/panel_media_settings_security.xml
+++ b/indra/newview/skins/default/xui/pl/panel_media_settings_security.xml
@@ -7,6 +7,6 @@
 	<button label="Dodaj" name="whitelist_add"/>
 	<button label="Usuń" name="whitelist_del"/>
 	<text name="home_url_fails_whitelist">
-		UWAGA: WWW  wyszczególnione w Ogólne nie przeszły białej listy. Została ona wyłączona dopóki poprawny zapis nie zostanie dodany.
+		UWAGA: WWW  wyszczególnione w Ogólne nie przeszły Białej Listy. Została ona wyłączona dopóki poprawny zapis nie zostanie dodany.
 	</text>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_my_profile.xml b/indra/newview/skins/default/xui/pl/panel_my_profile.xml
index 4f0b6dc42c..7ca762b825 100644
--- a/indra/newview/skins/default/xui/pl/panel_my_profile.xml
+++ b/indra/newview/skins/default/xui/pl/panel_my_profile.xml
@@ -10,11 +10,11 @@
 			<scroll_container name="profile_scroll">
 				<panel name="scroll_content_panel">
 					<panel name="second_life_image_panel">
-						<icon label="" name="2nd_life_edit_icon" tool_tip="Kliknij przycisk Edytuj Profil by zmienić zdjecie"/>
+						<icon label="" name="2nd_life_edit_icon" tool_tip="Kliknij przycisk Edytuj Profil by zmienić zdjęcie"/>
 						<text name="title_sl_descr_text" value="[SECOND_LIFE]:"/>
 					</panel>
 					<panel name="first_life_image_panel">
-						<icon label="" name="real_world_edit_icon" tool_tip="Kliknij przycisk Edytuj Profil by zmienić zdjecie"/>
+						<icon label="" name="real_world_edit_icon" tool_tip="Kliknij przycisk Edytuj Profil by zmienić zdjęcie"/>
 						<text name="title_rw_descr_text" value="Życie#1:"/>
 					</panel>
 					<text name="title_member_text" value="Urodziny:"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_navigation_bar.xml b/indra/newview/skins/default/xui/pl/panel_navigation_bar.xml
index 3e6cad59bf..b01e686c41 100644
--- a/indra/newview/skins/default/xui/pl/panel_navigation_bar.xml
+++ b/indra/newview/skins/default/xui/pl/panel_navigation_bar.xml
@@ -9,8 +9,8 @@
 			<combo_editor label="Szukaj [SECOND_LIFE]" name="search_combo_editor"/>
 		</search_combo_box>
 	</panel>
-	<favorites_bar name="favorite" tool_tip="Przeciągnij swoje zapisane miejsca tutaj by szybko dostać się do swoich ulubionych miejsc w Second Life!">
-		<label name="favorites_bar_label" tool_tip="Przeciągnij swoje zapisane miejsca tutaj by szybko dostać się do swoich ulubionych miejsc w Second Life!">
+	<favorites_bar name="favorite" tool_tip="Przeciągnij swoje landmarki tutaj by szybko dostać się do swoich ulubionych miejsc w Second Life!">
+		<label name="favorites_bar_label" tool_tip="Przeciągnij swoje landmarki tutaj by szybko dostać się do swoich ulubionych miejsc w Second Life!">
 			Pasek Ulubionych
 		</label>
 		<chevron_button name="&gt;&gt;" tool_tip="Pokaż więcej Moich Ulubionych"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_nearby_media.xml b/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
index 2c47d2a736..a05c0d856f 100644
--- a/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/pl/panel_nearby_media.xml
@@ -4,10 +4,10 @@
 		&lt;empty&gt;
 	</string>
 	<string name="parcel_media_name">
-		Strumień Mediów Parceli
+		Strumień Mediów Posiadłości
 	</string>
 	<string name="parcel_audio_name">
-		Strumień Audio Parceli
+		Strumień Audio Posiadłości
 	</string>
 	<string name="playing_suffix">
 		(odtwarzanie)
@@ -28,7 +28,7 @@
 		<combo_box name="show_combo">
 			<combo_box.item label="Wszystkie" name="All"/>
 			<combo_box.item label="Na obecnej Parceli" name="WithinParcel"/>
-			<combo_box.item label="Poza Parcelą" name="OutsideParcel"/>
+			<combo_box.item label="Poza Posiadłością" name="OutsideParcel"/>
 			<combo_box.item label="Na innych awatarach" name="OnOthers"/>
 		</combo_box>
 		<scroll_list name="media_list">
diff --git a/indra/newview/skins/default/xui/pl/panel_outfits_inventory_gear_default.xml b/indra/newview/skins/default/xui/pl/panel_outfits_inventory_gear_default.xml
index 8eaf152fb6..5b77c390ca 100644
--- a/indra/newview/skins/default/xui/pl/panel_outfits_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/pl/panel_outfits_inventory_gear_default.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <menu name="menu_gear_default">
-	<menu_item_call label="Zastąp Aktualny Stroju" name="wear"/>
-	<menu_item_call label="Dodaj do Aktualnego Stroju" name="add"/>
-	<menu_item_call label="Usuń z Aktualnego Stroju" name="remove"/>
+	<menu_item_call label="Zastąp Obecne Ubranie" name="wear"/>
+	<menu_item_call label="Dodaj do Obecnego Ubrania" name="add"/>
+	<menu_item_call label="Usuń z Obecnego Ubrania" name="remove"/>
 	<menu_item_call label="Zmień nazwę" name="rename"/>
 	<menu_item_call label="Usuń Link" name="remove_link"/>
 	<menu_item_call label="Usuń Ubranie" name="delete"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_people.xml b/indra/newview/skins/default/xui/pl/panel_people.xml
index b92a37907b..5ea5356c60 100644
--- a/indra/newview/skins/default/xui/pl/panel_people.xml
+++ b/indra/newview/skins/default/xui/pl/panel_people.xml
@@ -3,12 +3,12 @@
 <panel label="Ludzie" name="people_panel">
 	<string name="no_people" value="Brak ludzi"/>
 	<string name="no_one_near" value="Nikogo w pobliżu"/>
-	<string name="no_friends_online" value="Brak dostępnych przyjaciół"/>
-	<string name="no_friends" value="Brak przyjaciół"/>
+	<string name="no_friends_online" value="Brak dostępnych Znajomych"/>
+	<string name="no_friends" value="Brak Znajomych"/>
 	<string name="people_filter_label" value="Filtruj Ludzi"/>
 	<string name="groups_filter_label" value="Filtruj Grupy"/>
-	<string name="no_filtered_groups_msg" value="[secondlife:///app/search/groups Try finding the group in search?]"/>
-	<string name="no_groups_msg" value="[secondlife:///app/search/groups Try searching for some groups to join.]"/>
+	<string name="no_filtered_groups_msg" value="[secondlife:///app/search/groups Może spróbuj odnaleźć Grupę korzystając z Szukaj?]"/>
+	<string name="no_groups_msg" value="[secondlife:///app/search/groups Spróbuj wyszukać grupy aby do nich dołączyć.]"/>
 	<filter_editor label="Filtr" name="filter_input"/>
 	<tab_container name="tabs">
 		<panel label="W POBLIŻU" name="nearby_panel">
@@ -28,8 +28,8 @@
 				<button name="del_btn" tool_tip="Usuń wybraną osobę ze swojej listy znajomych"/>
 			</panel>
 			<text name="no_friends_msg">
-				By dodać nową znajomość skorzystaj ze strony [secondlife:///app/search/people global search] lub kliknij prawym przyciskiem myszki na Rezydenta by wysłać mu zaproszenie.
-Jeżeli szukasz ludzi, z którymi można się spotkać, kliknij tutaj [secondlife:///app/worldmap try the Map].
+				By dodać nową znajomość skorzystaj ze strony [secondlife:///app/search/people ogólne wyszukiwanie] lub kliknij prawym przyciskiem myszki na Rezydenta by wysłać mu zaproszenie.
+Jeżeli szukasz ludzi, z którymi można się spotkać, kliknij tutaj [secondlife:///app/worldmap skorzystaj z mapy].
 			</text>
 		</panel>
 		<panel label="GRUPY" name="groups_panel">
diff --git a/indra/newview/skins/default/xui/pl/panel_pick_info.xml b/indra/newview/skins/default/xui/pl/panel_pick_info.xml
index 5b6df28883..0454ecc430 100644
--- a/indra/newview/skins/default/xui/pl/panel_pick_info.xml
+++ b/indra/newview/skins/default/xui/pl/panel_pick_info.xml
@@ -3,9 +3,9 @@
 	<text name="title" value="Info o Ulubionych"/>
 	<scroll_container name="profile_scroll">
 		<panel name="scroll_content_panel">
-			<text name="pick_name" value="[nazwa]"/>
-			<text name="pick_location" value="[ładowanie...]"/>
-			<text name="pick_desc" value="[opis]"/>
+			<text name="pick_name" value="[name]"/>
+			<text name="pick_location" value="[loading...]"/>
+			<text name="pick_desc" value="[description]"/>
 		</panel>
 	</scroll_container>
 	<panel name="buttons">
diff --git a/indra/newview/skins/default/xui/pl/panel_place_profile.xml b/indra/newview/skins/default/xui/pl/panel_place_profile.xml
index 22811cd2a1..3714a141db 100644
--- a/indra/newview/skins/default/xui/pl/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/pl/panel_place_profile.xml
@@ -99,7 +99,7 @@
 						<text name="traffic_label" value="Ruch:"/>
 						<text name="primitives_label" value="Primy:"/>
 						<text name="parcel_scripts_label" value="Skrypty:"/>
-						<text name="terraform_limits_label" value="Ograniczenia Terraformingu:"/>
+						<text name="terraform_limits_label" value="Ograniczenia terraformingu:"/>
 						<text name="subdivide_label" value="Podziel/Złącz:"/>
 						<text name="resale_label" value="Możliwość sprzedaży:"/>
 						<text name="sale_to_label" value="Na sprzedaż:"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml b/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml
index d53a99e8c1..e843342aa2 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_alerts.xml
@@ -4,7 +4,7 @@
 		Powiadom mnie:
 	</text>
 	<check_box label="Kiedy wydaję lub otrzymuję L$" name="notify_money_change_checkbox"/>
-	<check_box label="Kiedy moi znajomi zalogowują się i wylogowują" name="friends_online_notify_checkbox"/>
+	<check_box label="Kiedy moi Znajomi zalogowują się i wylogowują" name="friends_online_notify_checkbox"/>
 	<text name="show_label">
 		Zawsze pokazuj:
 	</text>
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
index 3fc220976f..ae13cf662f 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_chat.xml
@@ -46,7 +46,7 @@
 	<check_box initial_value="true" label="Używaj animacji podczas pisania" name="play_typing_animation"/>
 	<check_box label="Wysyłaj wszystkie wiadomości (IM) na moją skrzynkę pocztową kiedy jestem niedostępny" name="send_im_to_email"/>
 	<text name="show_ims_in_label">
-		Pokaż IMy w:
+		Pokaż wiadomości (IM) w:
 	</text>
 	<text name="requires_restart_label">
 		(restart wymagany)
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
index 37670d3470..bc08e025dd 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_graphics1.xml
@@ -27,14 +27,14 @@
 	</text>
 	<panel label="CustomGraphics" name="CustomGraphics Panel">
 		<text name="ShadersText">
-			Shadery:
+			Cieniowanie pixeli (shadery):
 		</text>
 		<check_box initial_value="true" label="Mapowanie Wypukłości i Połysk" name="BumpShiny"/>
 		<check_box initial_value="true" label="Podstawowe Shadery" name="BasicShaders" tool_tip="Wyłączenie tej opcji może naprawić błędy niektórych sterowników graficznych."/>
 		<check_box initial_value="true" label="Shadery Atmosfery" name="WindLightUseAtmosShaders"/>
-		<check_box initial_value="true" label="Odbicia w Wodzie" name="Reflections"/>
+		<check_box initial_value="true" label="Refleksy w wodzie" name="Reflections"/>
 		<text name="ReflectionDetailText">
-			Ustawienia Odbić:
+			Ustawienia refleksów:
 		</text>
 		<radio_group name="ReflectionDetailRadio">
 			<radio_item label="Teren i drzewa" name="0"/>
@@ -43,22 +43,22 @@
 			<radio_item label="Wszystko" name="3"/>
 		</radio_group>
 		<text name="AvatarRenderingText">
-			Prezentacja Awatarów:
+			Rendering awatarów
 		</text>
 		<check_box initial_value="true" label="Impostoryzacja Awatarowa" name="AvatarImpostors"/>
-		<check_box initial_value="true" label="Skinning" name="AvatarVertexProgram"/>
-		<check_box initial_value="true" label="Ubranie Awatarów" name="AvatarCloth"/>
-		<slider label="Głębia Rysowania:" name="DrawDistance"/>
+		<check_box initial_value="true" label="Rendering awatara przez GPU" name="AvatarVertexProgram"/>
+		<check_box initial_value="true" label="Oddzielne warstwy ubrań" name="AvatarCloth"/>
+		<slider label="Pole widzenia:" name="DrawDistance"/>
 		<text name="DrawDistanceMeterText2">
 			m
 		</text>
-		<slider label="Liczba Cząsteczek:" name="MaxParticleCount"/>
+		<slider label="Liczba cząsteczek:" name="MaxParticleCount"/>
 		<slider label="Jakość Post-Procesu:" name="RenderPostProcess"/>
 		<text name="MeshDetailText">
-			Szczegóły Meszu:
+			Szczególy obiektów:
 		</text>
-		<slider label="  Obiekty:" name="ObjectMeshDetail"/>
-		<slider label="  Elastyczne:" name="FlexibleMeshDetail"/>
+		<slider label="  Przedmioty:" name="ObjectMeshDetail"/>
+		<slider label="  Obiekty elastyczne:" name="FlexibleMeshDetail"/>
 		<slider label="  Drzewa:" name="TreeMeshDetail"/>
 		<slider label="  Awatary:" name="AvatarMeshDetail"/>
 		<slider label="  Teren:" name="TerrainMeshDetail"/>
@@ -85,14 +85,14 @@
 			Mało
 		</text>
 		<text name="LightingDetailText">
-			Ustawienia Światła:
+			Ustawienia świateł:
 		</text>
 		<radio_group name="LightingDetailRadio">
 			<radio_item label="Tylko Słońce i Księżyc" name="SunMoon" value="0"/>
 			<radio_item label="Tylko Bliskie Światła" name="LocalLights" value="1"/>
 		</radio_group>
 		<text name="TerrainDetailText">
-			Szczgóły Terenu:
+			Szczegóły terenu:
 		</text>
 		<radio_group name="TerrainDetailRadio">
 			<radio_item label="Niska" name="0"/>
@@ -100,7 +100,7 @@
 		</radio_group>
 	</panel>
 	<button label="Zastosuj" label_selected="Zastosuj" name="Apply"/>
-	<button label="Zresetu" name="Defaults"/>
+	<button label="Zresetuj" name="Defaults"/>
 	<button label="Zaawansowane" name="Advanced"/>
 	<button label="Sprzęt" label_selected="Sprzęt" name="GraphicsHardwareButton"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
index abcb989757..b69efeb77e 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
@@ -4,8 +4,8 @@
 	<check_box initial_value="true" label="Wycisz dzwięk podczas minimalizacji okna" name="mute_when_minimized"/>
 	<slider label="Interfejs" name="UI Volume"/>
 	<slider label="Otoczenie" name="Wind Volume"/>
-	<slider label="Efekty Dźwiękowe" name="SFX Volume"/>
-	<slider label="Muzyka Strumieniowa" name="Music Volume"/>
+	<slider label="Efekty dźwiękowe" name="SFX Volume"/>
+	<slider label="Muzyka strumieniowa" name="Music Volume"/>
 	<check_box label="Odtwarzaj media audio" name="music_enabled"/>
 	<slider label="Media" name="Media Volume"/>
 	<check_box label="Odtwarzaj media" name="enable_media"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_region_covenant.xml b/indra/newview/skins/default/xui/pl/panel_region_covenant.xml
index 2cfe2ca2ce..2b37dd96b7 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_covenant.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_covenant.xml
@@ -58,13 +58,13 @@ wszystkich posiadłościach majątku.
 		Odsprzedaj:
 	</text>
 	<text left="115" name="resellable_clause" width="350">
-		Posiadłość zakupiona w tym regionie nie może być odsprzedana.
+		Posiadłość kupiona w tym Regionie nie może być odsprzedana.
 	</text>
 	<text name="changeable_lbl">
 		Podziel:
 	</text>
 	<text left="115" name="changeable_clause" width="350">
-		Posiadłość zakupiona w tym regionie nie może być
+		Posiadłość kupiona w tym Regionie nie może być
 łączona/dzielona.
 	</text>
 	<string name="can_resell">
diff --git a/indra/newview/skins/default/xui/pl/panel_region_debug.xml b/indra/newview/skins/default/xui/pl/panel_region_debug.xml
index 14fa3cd94c..c5b08383dc 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_debug.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_debug.xml
@@ -6,15 +6,15 @@
 	<text name="region_text">
 		brak danych
 	</text>
-	<check_box label="Zablokuj Skrypty" name="disable_scripts_check" tool_tip="Zablokuj wszystkie skrypty w tym Regionie"/>
+	<check_box label="Zablokuj skrypty" name="disable_scripts_check" tool_tip="Zablokuj wszystkie skrypty w tym Regionie"/>
 	<button label="?" name="disable_scripts_help"/>
-	<check_box label="Zablokuj Kolizje" name="disable_collisions_check" tool_tip="Zablokuj kolizje obiektów (nie Awatarów) w tym Regionie"/>
+	<check_box label="Zablokuj kolizje" name="disable_collisions_check" tool_tip="Zablokuj kolizje obiektów (nie awatarów) w tym Regionie"/>
 	<button label="?" name="disable_collisions_help"/>
-	<check_box label="Zablokuj Fizykę" name="disable_physics_check" tool_tip="Zablokuj wpływ fizyki w tym Regionie"/>
+	<check_box label="Zablokuj fizykę" name="disable_physics_check" tool_tip="Zablokuj wpływ fizyki w tym Regionie"/>
 	<button label="?" name="disable_physics_help"/>
 	<button label="Zastosuj" name="apply_btn"/>
 	<text name="objret_text_lbl">
-		Zwrot Obiektu
+		Zwrot obiektu
 	</text>
 	<text name="resident_text_lbl">
 		Rezydent:
@@ -30,11 +30,11 @@
 	<check_box label="Odeślij wyłącznie obiekty które są na posiadłościach innych osób" name="return_other_land" tool_tip="Odeślij wyłącznie obiekty które są na posiadłościach innych osób"/>
 	<check_box label="W każdym regionie tego majątku" name="return_estate_wide" tool_tip="Odeślij obiekty z wszystkich regionów w tym majątku"/>
 	<button label="Odeślij" name="return_btn"/>
-	<button label="Znajdź Główne Kolizje..." name="top_colliders_btn" tool_tip="Lista obiektów doświadczających najwięcej potencjalnych kolizji"/>
+	<button label="Znajdź główne kolizje..." name="top_colliders_btn" tool_tip="Lista obiektów doświadczających najwięcej potencjalnych kolizji"/>
 	<button label="?" name="top_colliders_help"/>
-	<button label="Główne Skrypty..." name="top_scripts_btn" tool_tip="Lista obiektów najdłużej wykonujących skrypty"/>
+	<button label="Główne skrypty..." name="top_scripts_btn" tool_tip="Lista obiektów najdłużej wykonujących skrypty"/>
 	<button label="?" name="top_scripts_help"/>
 	<button label="Restart Regionu" name="restart_btn" tool_tip="Odliczanie i restart Regionu za dwie minuty"/>
 	<button label="?" name="restart_help"/>
-	<button label="Opóźnij Restart" name="cancel_restart_btn" tool_tip="Opóźnij restart Regionu o godzinę"/>
+	<button label="Opóźnij restart" name="cancel_restart_btn" tool_tip="Opóźnij restart Regionu o godzinę"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_region_estate.xml b/indra/newview/skins/default/xui/pl/panel_region_estate.xml
index 78da656448..a796274738 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_estate.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_estate.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Majątek" name="Estate">
 	<text name="estate_help_text">
-		Zmiany w tej zakładce będą odczuwalne w całym regionie.
+		Zmiany w tej zakładce będą odczuwalne w całym Regionie.
 	</text>
 	<text name="estate_text">
 		Majątek:
@@ -15,19 +15,19 @@
 	<text name="estate_owner">
 		(brak danych)
 	</text>
-	<check_box label="Używaj Czasu Światowego" name="use_global_time_check"/>
+	<check_box label="Używaj czasu światowego" name="use_global_time_check"/>
 	<button label="?" name="use_global_time_help"/>
 	<check_box label="Stałe Słońce" name="fixed_sun_check"/>
 	<button label="?" name="fixed_sun_help"/>
-	<slider label="Pora Doby" name="sun_hour_slider"/>
-	<check_box label="Dostęp Publiczny" name="externally_visible_check"/>
+	<slider label="Pora doby" name="sun_hour_slider"/>
+	<check_box label="Dostęp publiczny" name="externally_visible_check"/>
 	<button label="?" name="externally_visible_help"/>
 	<text name="Only Allow">
-		Ogranicz Dostęp dla kont zweryfikowanych przez:
+		Ogranicz dostęp dla kont zweryfikowanych przez:
 	</text>
 	<check_box label="Rezydenci z danymi o koncie" name="limit_payment" tool_tip="Zbanuj niezidentyfikowanych Rezydentów"/>
 	<check_box label="Rezydenci, którzy dokonali weryfikacji wieku" name="limit_age_verified" tool_tip="Zbanuj Rezydentów, którzy nie zweryfikowali swojego wieku. Odwiedź stronę [SUPPORT_SITE] po więcej informacji."/>
-	<check_box label="Rozmowy Dozwolone" name="voice_chat_check"/>
+	<check_box label="Rozmowy dozwolone" name="voice_chat_check"/>
 	<button label="?" name="voice_chat_help"/>
 	<check_box label="Teleportacja Dozwolona" name="allow_direct_teleport"/>
 	<button label="?" name="allow_direct_teleport_help"/>
diff --git a/indra/newview/skins/default/xui/pl/panel_region_general.xml b/indra/newview/skins/default/xui/pl/panel_region_general.xml
index 26076b9a1a..1410a2a882 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_general.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_general.xml
@@ -18,16 +18,16 @@
 	<text name="region_type">
 		nieznany
 	</text>
-	<check_box label="Zablokuj Zmiany Terenu" name="block_terraform_check"/>
-	<check_box label="Zablokuj Latanie" name="block_fly_check"/>
-	<check_box label="Uszkodzenia Dozwolone" name="allow_damage_check"/>
-	<check_box label="Zablokuj Popychanie" name="restrict_pushobject"/>
-	<check_box label="Odsprzedaż Dozwolona" name="allow_land_resell_check"/>
-	<check_box label="Łączenie/Dzielenie Dozwolone" name="allow_parcel_changes_check"/>
-	<check_box label="Zablokuj Wyszukiwanie" name="block_parcel_search_check" tool_tip="Pozwól na wyświetlanie nazwy regionu i posiadłości w wynikach wyszukiwania"/>
+	<check_box label="Zablokuj zmiany terenu" name="block_terraform_check"/>
+	<check_box label="Zablokuj latanie" name="block_fly_check"/>
+	<check_box label="Uszkodzenia dozwolone" name="allow_damage_check"/>
+	<check_box label="Zablokuj popychanie" name="restrict_pushobject"/>
+	<check_box label="Odsprzedaż dozwolona" name="allow_land_resell_check"/>
+	<check_box label="Łączenie/Dzielenie dozwolone" name="allow_parcel_changes_check"/>
+	<check_box label="Zablokuj wyszukiwanie" name="block_parcel_search_check" tool_tip="Pozwól na wyświetlanie nazwy regionu i posiadłości w wynikach wyszukiwania"/>
 	<spinner label="Limit Gości" name="agent_limit_spin"/>
-	<spinner label="Ekstra Obiekty" name="object_bonus_spin"/>
-	<text label="Ograniczenia Wieku" name="access_text">
+	<spinner label="Ekstra obiekty" name="object_bonus_spin"/>
+	<text label="Ograniczenia wieku" name="access_text">
 		Rodzaj:
 	</text>
 	<icons_combo_box label="&apos;Mature&apos;" name="access_combo">
@@ -36,8 +36,8 @@
 		<icons_combo_box.item label="&apos;PG&apos;" name="PG" value="13"/>
 	</icons_combo_box>
 	<button label="Zastosuj" name="apply_btn"/>
-	<button label="Teleportuj do Miejsca Startu Jednego Rezydenta..." name="kick_btn"/>
-	<button label="Teleportuj do Miejsca Startu Wszystkich Rezydentów..." name="kick_all_btn"/>
-	<button label="Wyślij Wiadomość do Regionu..." name="im_btn"/>
-	<button label="Obsługa Teleportera..." name="manage_telehub_btn"/>
+	<button label="Teleportuj do Miejsca Startu jednego Rezydenta..." name="kick_btn"/>
+	<button label="Teleportuj do Miejsca Startu wszystkich Rezydentów..." name="kick_all_btn"/>
+	<button label="Wyślij wiadomość do Regionu..." name="im_btn"/>
+	<button label="Obsługa teleportera..." name="manage_telehub_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_region_general_layout.xml b/indra/newview/skins/default/xui/pl/panel_region_general_layout.xml
index 6e53e8b7e4..ffa8f1e18a 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_general_layout.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_general_layout.xml
@@ -18,16 +18,16 @@
 	<text name="region_type">
 		nieznany
 	</text>
-	<check_box label="Zablokuj Zmiany Terenu" name="block_terraform_check"/>
-	<check_box label="Zablokuj Latanie" name="block_fly_check"/>
-	<check_box label="Uszkodzenia Dozwolone" name="allow_damage_check"/>
-	<check_box label="Zablokuj Popychanie" name="restrict_pushobject"/>
-	<check_box label="Odsprzedaż Dozwolona" name="allow_land_resell_check"/>
-	<check_box label="Łączenie/Dzielenie Dozwolone" name="allow_parcel_changes_check"/>
-	<check_box label="Zablokuj Wyszukiwanie" name="block_parcel_search_check" tool_tip="Pozwól na wyświetlanie nazwy regionu i posiadłości w wynikach wyszukiwania"/>
+	<check_box label="Zablokuj zmiany terenu" name="block_terraform_check"/>
+	<check_box label="Zablokuj latanie" name="block_fly_check"/>
+	<check_box label="Uszkodzenia dozwolone" name="allow_damage_check"/>
+	<check_box label="Zablokuj popychanie" name="restrict_pushobject"/>
+	<check_box label="Odsprzedaż dozwolona" name="allow_land_resell_check"/>
+	<check_box label="Łączenie/Dzielenie dozwolone" name="allow_parcel_changes_check"/>
+	<check_box label="Zablokuj wyszukiwanie" name="block_parcel_search_check" tool_tip="Pozwól na wyświetlanie nazwy Regionu i Posiadłości w wynikach wyszukiwania"/>
 	<spinner label="Limit Gości" name="agent_limit_spin"/>
-	<spinner label="Ekstra Obiekty" name="object_bonus_spin"/>
-	<text label="Restrykcje Wieku" name="access_text">
+	<spinner label="Ekstra obiekty" name="object_bonus_spin"/>
+	<text label="Restrykcje wieku" name="access_text">
 		Rodzaj:
 	</text>
 	<combo_box label="Moderuj" name="access_combo">
@@ -36,8 +36,8 @@
 		<combo_box.item label="Ogólne" name="PG"/>
 	</combo_box>
 	<button label="Zastosuj" name="apply_btn"/>
-	<button label="Teleportuj do Miejsca Startu Jednego Rezydenta..." name="kick_btn"/>
-	<button label="Teleportuj do Miejsca Startu Wszystkich Rezydentów..." name="kick_all_btn"/>
-	<button label="Wyślij Wiadomość do Regionu..." name="im_btn"/>
-	<button label="Obsługa Teleportera..." name="manage_telehub_btn"/>
+	<button label="Teleportuj do Miejsca Startu jednego Rezydenta..." name="kick_btn"/>
+	<button label="Teleportuj do Miejsca Startu wszystkich Rezydentów..." name="kick_all_btn"/>
+	<button label="Wyślij wiadomość do Regionu..." name="im_btn"/>
+	<button label="Obsługa teleportera..." name="manage_telehub_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_region_terrain.xml b/indra/newview/skins/default/xui/pl/panel_region_terrain.xml
index b206616e34..917ae91774 100644
--- a/indra/newview/skins/default/xui/pl/panel_region_terrain.xml
+++ b/indra/newview/skins/default/xui/pl/panel_region_terrain.xml
@@ -6,22 +6,22 @@
 	<text name="region_text">
 		brak danych
 	</text>
-	<spinner label="Poziom Wody" name="water_height_spin" />
+	<spinner label="Poziom wody" name="water_height_spin" />
 	<button label="?" name="water_height_help" />
-	<spinner label="Górny Limit Terenu" name="terrain_raise_spin" />
+	<spinner label="Górny limit terenu" name="terrain_raise_spin" />
 	<button label="?" name="terrain_raise_help" />
-	<spinner label="Dolny Limit Terenu" name="terrain_lower_spin" />
+	<spinner label="Dolny limit terenu" name="terrain_lower_spin" />
 	<button label="?" name="terrain_lower_help" />
 	<check_box label="Używaj Słońca Majątku" name="use_estate_sun_check" />
 	<button label="?" name="use_estate_sun_help" />
 	<check_box label="Stałe Słońce" name="fixed_sun_check" />
 	<button label="?" name="fixed_sun_help" />
-	<slider label="Pora Doby" name="sun_hour_slider" />
+	<slider label="Pora doby" name="sun_hour_slider" />
 	<button label="Zastosuj" name="apply_btn" />
-	<button label="Zapisz Surowy Teren..." name="download_raw_btn"
+	<button label="Zapisz surowy teren..." name="download_raw_btn"
 	     tool_tip="Dostępne tylko dla Właścicieli Majątku, nie dla Zarządców" />
 	<button label="?" name="download_raw_help" />
-	<button label="Załaduj Surowy Teren..." name="upload_raw_btn"
+	<button label="Załaduj surowy teren..." name="upload_raw_btn"
 	     tool_tip="Dostępne tylko dla Właścicieli Majątku, nie dla Zarządców" />
 	<button label="?" name="upload_raw_help" />
 	<button label="Ustal Teren" name="bake_terrain_btn"
diff --git a/indra/newview/skins/default/xui/pl/panel_script_limits_my_avatar.xml b/indra/newview/skins/default/xui/pl/panel_script_limits_my_avatar.xml
index 1841e1544e..e1863517a2 100644
--- a/indra/newview/skins/default/xui/pl/panel_script_limits_my_avatar.xml
+++ b/indra/newview/skins/default/xui/pl/panel_script_limits_my_avatar.xml
@@ -12,5 +12,5 @@
 		<scroll_list.columns label="Nazwa Obiektu" name="name"/>
 		<scroll_list.columns label="Lokalizacja" name="location"/>
 	</scroll_list>
-	<button label="Odśwież Listę" name="refresh_list_btn"/>
+	<button label="Odśwież listę" name="refresh_list_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_script_limits_region_memory.xml b/indra/newview/skins/default/xui/pl/panel_script_limits_region_memory.xml
index f1de73c84d..1419a9c9f6 100644
--- a/indra/newview/skins/default/xui/pl/panel_script_limits_region_memory.xml
+++ b/indra/newview/skins/default/xui/pl/panel_script_limits_region_memory.xml
@@ -14,7 +14,7 @@
 		<scroll_list.columns label="Parcela" name="parcel"/>
 		<scroll_list.columns label="Lokalizacja" name="location"/>
 	</scroll_list>
-	<button label="Odśwież Listę" name="refresh_list_btn"/>
+	<button label="Odśwież listę" name="refresh_list_btn"/>
 	<button label="Pokaż" name="highlight_btn"/>
 	<button label="Zwróć" name="return_btn"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_stand_stop_flying.xml b/indra/newview/skins/default/xui/pl/panel_stand_stop_flying.xml
index e47a15b67a..0f99f3911c 100644
--- a/indra/newview/skins/default/xui/pl/panel_stand_stop_flying.xml
+++ b/indra/newview/skins/default/xui/pl/panel_stand_stop_flying.xml
@@ -2,5 +2,5 @@
 <!-- Width and height of this panel should be synchronized with "panel_modes" in the floater_moveview.xml-->
 <panel name="panel_stand_stop_flying">
 	<button label="Wstań" name="stand_btn" tool_tip="Kliknij tutaj by wstać."/>
-	<button label="Zatrzymaj Latanie" name="stop_fly_btn" tool_tip="Zatrzymaj Latanie"/>
+	<button label="Zatrzymaj latanie" name="stop_fly_btn" tool_tip="Zatrzymaj latanie"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/pl/panel_status_bar.xml b/indra/newview/skins/default/xui/pl/panel_status_bar.xml
index 8e03d2a3b9..cd2ae14f6c 100644
--- a/indra/newview/skins/default/xui/pl/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/pl/panel_status_bar.xml
@@ -7,7 +7,7 @@
 		Styczeń:Luty:Marzec:Kwiecień:Maj:Czerwiec:Lipiec:Styczeń:Wrzesień:Październik:Listopad:Grudzień
 	</panel.string>
 	<panel.string name="packet_loss_tooltip">
-		Utracone Pakiety
+		Utracone pakiety
 	</panel.string>
 	<panel.string name="bandwidth_tooltip">
 		Przepustowość
diff --git a/indra/newview/skins/default/xui/pl/panel_world_map.xml b/indra/newview/skins/default/xui/pl/panel_world_map.xml
index 70479fe209..849b01a1ce 100644
--- a/indra/newview/skins/default/xui/pl/panel_world_map.xml
+++ b/indra/newview/skins/default/xui/pl/panel_world_map.xml
@@ -4,7 +4,7 @@
 		Ładowanie...
 	</panel.string>
 	<panel.string name="InvalidLocation">
-		Niewłaściwa Lokalizacja
+		Niewłaściwa lokalizacja
 	</panel.string>
 	<panel.string name="world_map_north">
 		N
diff --git a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
index c986179377..3b038a7102 100644
--- a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
@@ -54,7 +54,7 @@
 			</text>
 			<check_box label="Udostępnij" name="CheckShareWithGroup" tool_tip="Pozwól wszystkim członkom ustawionej grupy na dzielenie prawa do modyfikacji dla tego obiektu. Musisz Przypisać aby aktywować ograniczenia wynikające z roli."/>
 			<text name="NextOwnerLabel">
-				Następny właściciel:
+				Następny Właściciel:
 			</text>
 			<check_box label="Modyfikuje" name="CheckNextOwnerModify"/>
 			<check_box label="Kopiuje" name="CheckNextOwnerCopy"/>
diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml
index f01dd9c475..c72f783a51 100644
--- a/indra/newview/skins/default/xui/pl/strings.xml
+++ b/indra/newview/skins/default/xui/pl/strings.xml
@@ -1902,25 +1902,25 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Cień o godzinie 5
 	</string>
 	<string name="All White">
-		Wszystko Białe
+		Wszystko białe
 	</string>
 	<string name="Anime Eyes">
-		Animuj Oczy
+		Animuj oczy
 	</string>
 	<string name="Arced">
 		Obrócony
 	</string>
 	<string name="Arm Length">
-		Długość Ramienia
+		Długość ramienia
 	</string>
 	<string name="Attached">
 		Dołączone
 	</string>
 	<string name="Attached Earlobes">
-		Płatki Uszu Dołączone
+		Płatki uszu dołączone
 	</string>
 	<string name="Back Fringe">
-		Tylnia Grzywka
+		Tylnia grzywka
 	</string>
 	<string name="Baggy">
 		Wypchane
@@ -1941,13 +1941,13 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Duży Pośladek
 	</string>
 	<string name="Big Hair Back">
-		Duże Włosy: z Tyłu
+		Duże Włosy: z tyłu
 	</string>
 	<string name="Big Hair Front">
-		Duże Włosy: z Przodu
+		Duże Włosy: z przodu
 	</string>
 	<string name="Big Hair Top">
-		Duże Włosy: z Góry
+		Duże Włosy: z góry
 	</string>
 	<string name="Big Head">
 		Duża Głowa
@@ -1965,22 +1965,22 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Blond
 	</string>
 	<string name="Blonde Hair">
-		Włosy Koloru Blond
+		Włosy Blond
 	</string>
 	<string name="Blush">
 		Rumieniec
 	</string>
 	<string name="Blush Color">
-		Kolor Rumieńca
+		Kolor rumieńca
 	</string>
 	<string name="Blush Opacity">
-		Intensywność Rumieńca
+		Intensywność rumieńca
 	</string>
 	<string name="Body Definition">
-		Detale Ciała
+		Detale ciała
 	</string>
 	<string name="Body Fat">
-		Zawartość Tkanki Tłuszczowej
+		Zawartość tkanki tłuszczowej
 	</string>
 	<string name="Body Freckles">
 		Piegi
@@ -1998,13 +1998,13 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Bow Legged
 	</string>
 	<string name="Breast Buoyancy">
-		Jędrność Piersi
+		Jędrność piersi
 	</string>
 	<string name="Breast Cleavage">
-		Odstęp Między Piersiami
+		Odstęp między piersiami
 	</string>
 	<string name="Breast Size">
-		Rozmiar Piersi
+		Rozmiar piersi
 	</string>
 	<string name="Bridge Width">
 		Szerokość
@@ -2013,7 +2013,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Szerokie
 	</string>
 	<string name="Brow Size">
-		Rozmiar Czoła
+		Rozmiar czoła
 	</string>
 	<string name="Bug Eyes">
 		Bug Eyes
@@ -2049,34 +2049,34 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Chaplin
 	</string>
 	<string name="Cheek Bones">
-		Kości Policzkowe
+		Kości policzkowe
 	</string>
 	<string name="Chest Size">
-		Rozmiar Klatki Piersiowej
+		Rozmiar klatki piersiowej
 	</string>
 	<string name="Chin Angle">
-		Kąt Podbródka
+		Kąt podbródka
 	</string>
 	<string name="Chin Cleft">
-		Dołek w Podbródku
+		Dołek w podbródku
 	</string>
 	<string name="Chin Curtains">
-		Zasłonięcie Podbródka
+		Zasłonięcie podbródka
 	</string>
 	<string name="Chin Depth">
-		Długość Podbródka
+		Długość podbródka
 	</string>
 	<string name="Chin Heavy">
-		Ciężar Podbródka
+		Ciężar podbródka
 	</string>
 	<string name="Chin In">
-		Podbródek Wewnątrz
+		Podbródek wewnątrz
 	</string>
 	<string name="Chin Out">
-		Podbródek Zewnętrzny
+		Podbródek zewnętrzny
 	</string>
 	<string name="Chin-Neck">
-		Podwójny Podbródek
+		Podwójny podbródek
 	</string>
 	<string name="Clear">
 		Wyczyść
@@ -2091,25 +2091,25 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Zamknięte
 	</string>
 	<string name="Closed Back">
-		Zamknięte z Tyłu
+		Zamknięte z tyłu
 	</string>
 	<string name="Closed Front">
-		Zamknięte z Przodu
+		Zamknięte z przodu
 	</string>
 	<string name="Closed Left">
-		Lewe Oko Zamknięte
+		Lewe Oko zamknięte
 	</string>
 	<string name="Closed Right">
-		Prawe Oko Zamknięte
+		Prawe Oko zamknięte
 	</string>
 	<string name="Coin Purse">
 		Coin Purse
 	</string>
 	<string name="Collar Back">
-		Kołnierz z Tyłu
+		Kołnierz z tyłu
 	</string>
 	<string name="Collar Front">
-		Kołnierz z Przodu
+		Kołnierz z przodu
 	</string>
 	<string name="Corner Down">
 		Corner Down
@@ -2121,7 +2121,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Pognieciony
 	</string>
 	<string name="Crooked Nose">
-		Skrzywienie Nosa
+		Skrzywienie nosa
 	</string>
 	<string name="Cuff Flare">
 		Cuff Flare
@@ -2130,7 +2130,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Ciemne
 	</string>
 	<string name="Dark Green">
-		Ciemne Zielone
+		Ciemne zielone
 	</string>
 	<string name="Darker">
 		Ciemniejsze
@@ -2145,7 +2145,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Gęstość
 	</string>
 	<string name="Double Chin">
-		Podwójny Podbródek
+		Podwójny podbródek
 	</string>
 	<string name="Downturned">
 		Downturned
@@ -2154,58 +2154,58 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Duffle Bag
 	</string>
 	<string name="Ear Angle">
-		Odstawanie Uszu
+		Odstawanie uszu
 	</string>
 	<string name="Ear Size">
-		Rozmiar Uszu
+		Rozmiar uszu
 	</string>
 	<string name="Ear Tips">
-		Wierzchołki Uszu
+		Wierzchołki uszu
 	</string>
 	<string name="Egg Head">
-		Jajowata Głowa
+		Jajowata głowa
 	</string>
 	<string name="Eye Bags">
-		Woreczek Łzowy
+		Woreczek łzowy
 	</string>
 	<string name="Eye Color">
-		Kolor Oczu
+		Kolor oczu
 	</string>
 	<string name="Eye Depth">
-		Głębokość Osadzenia Oczu
+		Głębokość osadzenia oczu
 	</string>
 	<string name="Eye Lightness">
-		Ustawienie Jasności Oczu
+		Ustawienie jasności oczu
 	</string>
 	<string name="Eye Opening">
-		Oczy Otwarte
+		Oczy otwarte
 	</string>
 	<string name="Eye Pop">
-		Różnica w Wielkości Oczu
+		Różnica w wielkości oczu
 	</string>
 	<string name="Eye Size">
-		Rozmiar Oczu
+		Rozmiar oczu
 	</string>
 	<string name="Eye Spacing">
-		Rozstaw Oczu
+		Rozstaw oczu
 	</string>
 	<string name="Eyebrow Arc">
-		Łuk Brwiowy
+		Łuk brwiowy
 	</string>
 	<string name="Eyebrow Density">
-		Gęstość Brwi
+		Gęstość brwi
 	</string>
 	<string name="Eyebrow Height">
-		Wysokość Brwi
+		Wysokość brwi
 	</string>
 	<string name="Eyebrow Points">
-		Kształt Brwi
+		Kształt brwi
 	</string>
 	<string name="Eyebrow Size">
-		Rozmiar Brwi
+		Rozmiar brwi
 	</string>
 	<string name="Eyelash Length">
-		Długość Rzęs
+		Długość rzęs
 	</string>
 	<string name="Eyeliner">
 		Eyeliner
@@ -2217,16 +2217,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Eyes Bugged
 	</string>
 	<string name="Face Shear">
-		Usunięcie Twarzy
+		Usunięcie twarzy
 	</string>
 	<string name="Facial Definition">
-		Detale Twarzy
+		Detale twarzy
 	</string>
 	<string name="Far Set Eyes">
 		Far Set Eyes
 	</string>
 	<string name="Fat Lips">
-		Grube Usta
+		Grube usta
 	</string>
 	<string name="Female">
 		Kobieta
@@ -2238,28 +2238,28 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Palce
 	</string>
 	<string name="Flared Cuffs">
-		Flared Cuffs
+		Rozszerzane rękawy
 	</string>
 	<string name="Flat">
 		Płaskość
 	</string>
 	<string name="Flat Butt">
-		Płaskie Pośladki
+		Płaskie pośladki
 	</string>
 	<string name="Flat Head">
-		Płaska Głowa
+		Płaska głowa
 	</string>
 	<string name="Flat Toe">
-		Płaski Palec
+		Płaski palec
 	</string>
 	<string name="Foot Size">
-		Rozmiar Stopy
+		Rozmiar stopy
 	</string>
 	<string name="Forehead Angle">
-		Kształt Czoła
+		Kształt czoła
 	</string>
 	<string name="Forehead Heavy">
-		Ciężar Czoła
+		Ciężar czoła
 	</string>
 	<string name="Freckles">
 		Piegi
@@ -2268,19 +2268,19 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Przednia Grzywka
 	</string>
 	<string name="Full Back">
-		Gęstość Włosów po Bokach
+		Gęstość włosów po bokach
 	</string>
 	<string name="Full Eyeliner">
-		Gęsty Eyeliner
+		Gęsta kredka do oczu
 	</string>
 	<string name="Full Front">
-		Gęsty Przód
+		Gęsty przód
 	</string>
 	<string name="Full Hair Sides">
-		Gęste Włosy po Bokach
+		Gęste włosy po bokach
 	</string>
 	<string name="Full Sides">
-		Gęste Boki
+		Gęste boki
 	</string>
 	<string name="Glossy">
 		Błyszczące
@@ -2289,64 +2289,64 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Rękawiczki
 	</string>
 	<string name="Glove Length">
-		Długość Rękawiczek
+		Długość rękawiczek
 	</string>
 	<string name="Hair">
 		Włosy
 	</string>
 	<string name="Hair Back">
-		Włosy: z Tyłu
+		Włosy: z tyłu
 	</string>
 	<string name="Hair Front">
-		Włosy: z Przodu
+		Włosy: z przodu
 	</string>
 	<string name="Hair Sides">
-		Hair: Boki
+		Włosy: boki
 	</string>
 	<string name="Hair Sweep">
-		Kierunek Zaczesania
+		Kierunek zaczesania
 	</string>
 	<string name="Hair Thickess">
-		Grubość Włosów
+		Grubość włosów
 	</string>
 	<string name="Hair Thickness">
-		Grubość Włosów
+		Grubość włosów
 	</string>
 	<string name="Hair Tilt">
-		Przesunięcie Fryzury
+		Przes. fryzury
 	</string>
 	<string name="Hair Tilted Left">
-		Przesunięcie Fryzury w Lewo
+		Przes. fryzury L
 	</string>
 	<string name="Hair Tilted Right">
-		Przesunięcie Fryzury w Prawo
+		Przes. fryzury P
 	</string>
 	<string name="Hair Volume">
-		Włosy: Objętość
+		Włosy: objętość
 	</string>
 	<string name="Hand Size">
-		Rozmiar Dłoni
+		Rozmiar dłoni
 	</string>
 	<string name="Handlebars">
 		Handlebars
 	</string>
 	<string name="Head Length">
-		Długość Głowy
+		Długość głowy
 	</string>
 	<string name="Head Shape">
-		Kształt Głowy
+		Kształt głowy
 	</string>
 	<string name="Head Size">
-		Rozmiar Głowy
+		Rozmiar głowy
 	</string>
 	<string name="Head Stretch">
-		Rozciągnięcie Głowy
+		Rozciągnięcie głowy
 	</string>
 	<string name="Heel Height">
-		Wysokość Obcasa
+		Wysokość obcasa
 	</string>
 	<string name="Heel Shape">
-		Ksztalt Obcasa
+		Ksztalt obcasa
 	</string>
 	<string name="Height">
 		Wysokość
@@ -2355,7 +2355,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Wysoka
 	</string>
 	<string name="High Heels">
-		Wysokie Obcasy
+		Wysokie obcasy
 	</string>
 	<string name="High Jaw">
 		High Jaw
@@ -2370,34 +2370,34 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Wyżej
 	</string>
 	<string name="Hip Length">
-		Długość Bioder
+		Długość bioder
 	</string>
 	<string name="Hip Width">
-		Szerokość Bioder
+		Szerokość bioder
 	</string>
 	<string name="In">
 		W
 	</string>
 	<string name="In Shdw Color">
-		Wewnętrzny Kolor Cienia
+		Wewnętrzny kolor cienia
 	</string>
 	<string name="In Shdw Opacity">
-		Wewnętrzna Intensywność Cienia
+		Wewnętrzna intensywność cienia
 	</string>
 	<string name="Inner Eye Corner">
-		Wenwętrzny Bok Oka
+		Wenwętrzny bok oka
 	</string>
 	<string name="Inner Eye Shadow">
-		Wewnętrzny Cień Oka
+		Wewnętrzny cień oka
 	</string>
 	<string name="Inner Shadow">
-		Wewnętrzny Cień
+		Wewnętrzny cień
 	</string>
 	<string name="Jacket Length">
-		Długość Kurtki
+		Długość kurtki
 	</string>
 	<string name="Jacket Wrinkles">
-		Zmarszczki na Kurtce
+		Zmarszczki na kurtce
 	</string>
 	<string name="Jaw Angle">
 		Jaw Angle
@@ -2415,7 +2415,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Jowls
 	</string>
 	<string name="Knee Angle">
-		Kąt Kolana
+		Kąt kolana
 	</string>
 	<string name="Knock Kneed">
 		Knock Kneed
@@ -2424,22 +2424,22 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Duże
 	</string>
 	<string name="Large Hands">
-		Duże Dłonie
+		Duże dłonie
 	</string>
 	<string name="Left Part">
 		Left Part
 	</string>
 	<string name="Leg Length">
-		Długość Nogi
+		Długość nogi
 	</string>
 	<string name="Leg Muscles">
-		Umięśnione Nogi
+		Umięśnione nogi
 	</string>
 	<string name="Less">
 		Mniej
 	</string>
 	<string name="Less Body Fat">
-		Mniejsza Zawartości Tkanki Tłuszczowej
+		Mniejsza zawartości tkanki tłuszczowej
 	</string>
 	<string name="Less Curtains">
 		Less Curtains
@@ -2448,7 +2448,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Mniej Piegów
 	</string>
 	<string name="Less Full">
-		Less Full
+		Mniej Pełne
 	</string>
 	<string name="Less Gravity">
 		Mniej Ciężaru
@@ -2457,25 +2457,25 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Less Love
 	</string>
 	<string name="Less Muscles">
-		Mniej Mięśni
+		Mniej mięśni
 	</string>
 	<string name="Less Muscular">
-		Mniej Umięśnienia
+		Mniej umięśnienia
 	</string>
 	<string name="Less Rosy">
 		Less Rosy
 	</string>
 	<string name="Less Round">
-		Mniej Zaaokrąglone
+		Mniej zaaokrąglone
 	</string>
 	<string name="Less Saddle">
 		Less Saddle
 	</string>
 	<string name="Less Square">
-		Mniej Kwadratowe
+		Mniej kwadratowe
 	</string>
 	<string name="Less Volume">
-		Mniej Objętości
+		Mniej objętości
 	</string>
 	<string name="Less soul">
 		Less soul
@@ -2484,25 +2484,25 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Lżejsze
 	</string>
 	<string name="Lip Cleft">
-		Szerokość Rozszczepienia Górnej Wargi
+		Szerokość Rozszczepienia górnej wargi
 	</string>
 	<string name="Lip Cleft Depth">
-		Głębokość Rozszczepienia Górnej Wargi
+		Głębokość rozszczepienia górnej wargi
 	</string>
 	<string name="Lip Fullness">
-		Pełność Ust
+		Pełne usta
 	</string>
 	<string name="Lip Pinkness">
-		Róż Ust
+		Róż ust
 	</string>
 	<string name="Lip Ratio">
-		Proporcje Ust
+		Proporcje ust
 	</string>
 	<string name="Lip Thickness">
-		Grubość Ust
+		Grubość ust
 	</string>
 	<string name="Lip Width">
-		Szerokość Ust
+		Szerokość ust
 	</string>
 	<string name="Lipgloss">
 		Połysk
@@ -2511,43 +2511,43 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Szminka
 	</string>
 	<string name="Lipstick Color">
-		Kolor Szminki
+		Kolor szminki
 	</string>
 	<string name="Long">
 		Dlugość
 	</string>
 	<string name="Long Head">
-		Długa Głowa
+		Długa głowa
 	</string>
 	<string name="Long Hips">
-		Długie Biodra
+		Długie biodra
 	</string>
 	<string name="Long Legs">
-		Długie Nogi
+		Długie nogi
 	</string>
 	<string name="Long Neck">
-		Długi Kark
+		Długi kark
 	</string>
 	<string name="Long Pigtails">
-		Długi Warkocz
+		Długi warkocz
 	</string>
 	<string name="Long Ponytail">
-		Długi Kucyk
+		Długi kucyk
 	</string>
 	<string name="Long Torso">
-		Długi Tułów
+		Długi tułów
 	</string>
 	<string name="Long arms">
-		Dlugie Ramiona
+		Dlugie ramiona
 	</string>
 	<string name="Loose Pants">
-		Luźne Spodnie
+		Luźne spodnie
 	</string>
 	<string name="Loose Shirt">
-		Luźna Koszulka
+		Luźna koszulka
 	</string>
 	<string name="Loose Sleeves">
-		Luźne Rękawy
+		Luźne rękawy
 	</string>
 	<string name="Love Handles">
 		Love Handles
@@ -2556,16 +2556,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Nisko
 	</string>
 	<string name="Low Heels">
-		Niskie Obcasy
+		Niskie obcasy
 	</string>
 	<string name="Low Jaw">
-		Niska Szczęka
+		Niska szczęka
 	</string>
 	<string name="Low Platforms">
 		Low Platforms
 	</string>
 	<string name="Low and Loose">
-		Niskie i Luźne
+		Niskie i luźne
 	</string>
 	<string name="Lower">
 		Niżej
@@ -2580,7 +2580,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Mężczyzna
 	</string>
 	<string name="Middle Part">
-		Część Środkowa
+		Część środkowa
 	</string>
 	<string name="More">
 		Więcej
@@ -2589,7 +2589,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		More Blush
 	</string>
 	<string name="More Body Fat">
-		Więcej Zawartości Tkanki Tłuszczowej
+		Więcej zawartości tkanki tłuszczowej
 	</string>
 	<string name="More Curtains">
 		More Curtains
@@ -2598,34 +2598,34 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		More Eyeshadow
 	</string>
 	<string name="More Freckles">
-		Więcej Piegów
+		Więcej piegów
 	</string>
 	<string name="More Full">
 		More Full
 	</string>
 	<string name="More Gravity">
-		Więcej Ciężaru
+		Więcej ciężaru
 	</string>
 	<string name="More Lipstick">
-		Więcej Szminki
+		Więcej szminki
 	</string>
 	<string name="More Love">
 		More Love
 	</string>
 	<string name="More Lower Lip">
-		Więcej Dolnej Wargi
+		Więcej dolnej wargi
 	</string>
 	<string name="More Muscles">
-		Więcej Mięśni
+		Więcej mięśni
 	</string>
 	<string name="More Muscular">
-		Więcej Umięśnienia
+		Więcej umięśnienia
 	</string>
 	<string name="More Rosy">
 		More Rosy
 	</string>
 	<string name="More Round">
-		Więcej Zaokrąglenia
+		Więcej zaokrąglenia
 	</string>
 	<string name="More Saddle">
 		More Saddle
@@ -2634,16 +2634,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		More Sloped
 	</string>
 	<string name="More Square">
-		Więcej Kwadratowy
+		Więcej kwadratowy
 	</string>
 	<string name="More Upper Lip">
-		Więcej Górnej Wargi
+		Więcej górnej wargi
 	</string>
 	<string name="More Vertical">
 		More Vertical
 	</string>
 	<string name="More Volume">
-		Więcej Objętości
+		Więcej objętości
 	</string>
 	<string name="More soul">
 		More soul
@@ -2667,10 +2667,10 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Mutton Chops
 	</string>
 	<string name="Nail Polish">
-		Lakier na Paznokciach
+		Lakier na paznokciach
 	</string>
 	<string name="Nail Polish Color">
-		Kolor Lakieru na Paznokciach
+		Kolor lakieru na paznokciach
 	</string>
 	<string name="Narrow">
 		Wąskie
@@ -2688,10 +2688,10 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Naturalne
 	</string>
 	<string name="Neck Length">
-		Długość Karku
+		Długość karku
 	</string>
 	<string name="Neck Thickness">
-		Grubość Karku
+		Grubość karku
 	</string>
 	<string name="No Blush">
 		No Blush
@@ -2700,64 +2700,64 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Brak Eyeliner&apos;s
 	</string>
 	<string name="No Eyeshadow">
-		Brak Cienia pod Powieką
+		Brak cienia pod powieką
 	</string>
 	<string name="No Lipgloss">
-		Brak Połysku
+		Brak połysku
 	</string>
 	<string name="No Lipstick">
-		Brak Szminki
+		Brak szminki
 	</string>
 	<string name="No Part">
 		No Part
 	</string>
 	<string name="No Polish">
-		Brak Lakieru
+		Brak lakieru
 	</string>
 	<string name="No Red">
-		Brak Czerwieni
+		Brak czerwieni
 	</string>
 	<string name="No Spikes">
-		Brak Szpiców
+		Brak szpiców
 	</string>
 	<string name="No White">
-		Brak Białego
+		Brak białego
 	</string>
 	<string name="No Wrinkles">
-		Brak Zmarszczek
+		Brak zmarszczek
 	</string>
 	<string name="Normal Lower">
-		Dół Normalny
+		Dół normalny
 	</string>
 	<string name="Normal Upper">
-		Góra Normalna
+		Góra normalna
 	</string>
 	<string name="Nose Left">
-		Nos w Stronę Lewą
+		Nos w stronę lewą
 	</string>
 	<string name="Nose Right">
-		Nos w Stronę Prawą
+		Nos w stronę prawą
 	</string>
 	<string name="Nose Size">
-		Rozmiar Nosa
+		Rozmiar nosa
 	</string>
 	<string name="Nose Thickness">
-		Grubość Nosa
+		Grubość nosa
 	</string>
 	<string name="Nose Tip Angle">
-		Kąt Czubka Nosa
+		Kąt czubka nosa
 	</string>
 	<string name="Nose Tip Shape">
-		Kształt Czubka Nosa
+		Kształt czubka nosa
 	</string>
 	<string name="Nose Width">
-		Szerokość Nosa
+		Szerokość nosa
 	</string>
 	<string name="Nostril Division">
-		Przegroda Nosa
+		Przegroda nosa
 	</string>
 	<string name="Nostril Width">
-		Wielkość Dziurek w Nosie
+		Wielkość dziurek w nosie
 	</string>
 	<string name="Opaque">
 		Intensywność
@@ -2766,16 +2766,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Otwarte
 	</string>
 	<string name="Open Back">
-		Otwarte z Tyłu
+		Otwarte z tyłu
 	</string>
 	<string name="Open Front">
-		Otwarte z Przodu
+		Otwarte z przodu
 	</string>
 	<string name="Open Left">
-		Otwarte z Lewej
+		Otwarte z lewej
 	</string>
 	<string name="Open Right">
-		Otwarte z Prawej
+		Otwarte z prawej
 	</string>
 	<string name="Orange">
 		Pomarańczowe
@@ -2784,19 +2784,19 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Zewnętrznie
 	</string>
 	<string name="Out Shdw Color">
-		Zewnętrzny Kolor Cienia
+		Zewnętrzny kolor cienia
 	</string>
 	<string name="Out Shdw Opacity">
-		Zewnętrzna Grubość Cienia
+		Zewnętrzna grubość cienia
 	</string>
 	<string name="Outer Eye Corner">
-		Zewnętrzny Bok Oka
+		Zewnętrzny bok oka
 	</string>
 	<string name="Outer Eye Shadow">
-		Zewnętrzny Cień Oka
+		Zewnętrzny cień oka
 	</string>
 	<string name="Outer Shadow">
-		Zewnętrzny Cień
+		Zewnętrzny cień
 	</string>
 	<string name="Overbite">
 		Overbite
@@ -2805,25 +2805,25 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Package
 	</string>
 	<string name="Painted Nails">
-		Pomalowane Paznokcie
+		Pomalowane paznokcie
 	</string>
 	<string name="Pale">
 		Pale
 	</string>
 	<string name="Pants Crotch">
-		Krocze Spodni
+		Krocze spodni
 	</string>
 	<string name="Pants Fit">
 		Pants Fit
 	</string>
 	<string name="Pants Length">
-		Długość Spodni
+		Długość spodni
 	</string>
 	<string name="Pants Waist">
-		Talia Spodni
+		Talia spodni
 	</string>
 	<string name="Pants Wrinkles">
-		Zmarszczki Spodni
+		Zmarszczki spodni
 	</string>
 	<string name="Part">
 		Część
@@ -2832,7 +2832,7 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Part Bangs
 	</string>
 	<string name="Pectorals">
-		Mięśnie Klatki Piersiowej
+		Mięśnie klatki piersiowej
 	</string>
 	<string name="Pigment">
 		Pigment
@@ -2886,10 +2886,10 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Regularne
 	</string>
 	<string name="Right Part">
-		Prawa Cześć
+		Prawa część
 	</string>
 	<string name="Rosy Complexion">
-		Kompleksowość Różu
+		Kompleksowość różu
 	</string>
 	<string name="Round">
 		Zaokrąglenie
@@ -2916,34 +2916,34 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Płytkie
 	</string>
 	<string name="Shear Back">
-		Tylne Usunięcie Włosów
+		Tylne usunięcie włosów
 	</string>
 	<string name="Shear Face">
-		Usunięcie Twarzy
+		Usunięcie twarzy
 	</string>
 	<string name="Shear Front">
-		Przednie Usunięcie Włosów
+		Przednie usunięcie włosów
 	</string>
 	<string name="Shear Left Up">
-		Usunięcie od Lewej Strony do Góry
+		Usunięcie od lewej strony do góry
 	</string>
 	<string name="Shear Right Up">
-		Usunięcie od Prawej Strony do Góry
+		Usunięcie od prawej strony do góry
 	</string>
 	<string name="Sheared Back">
-		Tylnie Usunięcie Włosów
+		Tylnie usunięcie włosów
 	</string>
 	<string name="Sheared Front">
-		Przednie Usunięcie Włosów
+		Przednie usunięcie włosów
 	</string>
 	<string name="Shift Left">
-		Przesuń w Lewo
+		Przesuń w lewo
 	</string>
 	<string name="Shift Mouth">
-		Przesuń Usta
+		Przesuń usta
 	</string>
 	<string name="Shift Right">
-		Przesuń w Prawo
+		Przesuń w prawo
 	</string>
 	<string name="Shirt Bottom">
 		Dolna Część Koszulki
@@ -2952,22 +2952,22 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Shirt Fit
 	</string>
 	<string name="Shirt Wrinkles">
-		Zmarszczki na Koszulce
+		Zmarszczki na koszulce
 	</string>
 	<string name="Shoe Height">
-		Wysokość Buta
+		Wysokość buta
 	</string>
 	<string name="Short">
 		Krótkie
 	</string>
 	<string name="Short Arms">
-		Krótkie Ramiona
+		Krótkie ramiona
 	</string>
 	<string name="Short Legs">
-		Krótkie Nogi
+		Krótkie nogi
 	</string>
 	<string name="Short Neck">
-		Krótki Kark
+		Krótki kark
 	</string>
 	<string name="Short Pigtails">
 		Short Pigtails
@@ -2979,16 +2979,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Krótkie Baczki
 	</string>
 	<string name="Short Torso">
-		Krótki Tułów
+		Krótki tułów
 	</string>
 	<string name="Short hips">
-		Krótkie Biodra
+		Krótkie biodra
 	</string>
 	<string name="Shoulders">
 		Ramiona
 	</string>
 	<string name="Side Fringe">
-		Boczna Grzywka
+		Boczna grzywka
 	</string>
 	<string name="Sideburns">
 		Baczki
@@ -3009,16 +3009,16 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Skirt Fit
 	</string>
 	<string name="Skirt Length">
-		Długość Spódnicy
+		Długość spódnicy
 	</string>
 	<string name="Slanted Forehead">
-		Ukośne Czoło
+		Ukośne czoło
 	</string>
 	<string name="Sleeve Length">
-		Długość Rękawów
+		Długość rękawów
 	</string>
 	<string name="Sleeve Looseness">
-		Luźność Rękawów
+		Luźność rękawów
 	</string>
 	<string name="Slit Back">
 		Slit: Back
@@ -3036,19 +3036,19 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Małe
 	</string>
 	<string name="Small Hands">
-		Małe Dłonie
+		Małe dłonie
 	</string>
 	<string name="Small Head">
-		Mała Głowa
+		Mała głowa
 	</string>
 	<string name="Smooth">
 		Gładkie
 	</string>
 	<string name="Smooth Hair">
-		Gładkie Włosy
+		Gładkie włosy
 	</string>
 	<string name="Socks Length">
-		Długość Skarpetek
+		Długość skarpetek
 	</string>
 	<string name="Soulpatch">
 		Soulpatch
@@ -3063,13 +3063,13 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Kwadratowe
 	</string>
 	<string name="Square Toe">
-		Kwadratowy Palec
+		Kwadratowy palec
 	</string>
 	<string name="Squash Head">
-		Ściśnięta Głowa
+		Ściśnięta głowa
 	</string>
 	<string name="Stretch Head">
-		Rozciągnięta Głowa
+		Rozciągnięta głowa
 	</string>
 	<string name="Sunken">
 		Sunken
@@ -3096,58 +3096,58 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Taper Front
 	</string>
 	<string name="Thick Heels">
-		Grube Obcasy
+		Grube obcasy
 	</string>
 	<string name="Thick Neck">
-		Gruby Kark
+		Gruby kark
 	</string>
 	<string name="Thick Toe">
-		Gruby Palec
+		Gruby palec
 	</string>
 	<string name="Thin">
 		Wąski
 	</string>
 	<string name="Thin Eyebrows">
-		Wąskie Brwi
+		Wąskie brwi
 	</string>
 	<string name="Thin Lips">
-		Wąskie Usta
+		Wąskie usta
 	</string>
 	<string name="Thin Nose">
-		Wąski Nos
+		Wąski nos
 	</string>
 	<string name="Tight Chin">
-		Obcisły Podbródek
+		Obcisły podbródek
 	</string>
 	<string name="Tight Cuffs">
-		Obcisłe Rękawy
+		Obcisłe rękawy
 	</string>
 	<string name="Tight Pants">
-		Obciesłe Spodnie
+		Obciesłe spodnie
 	</string>
 	<string name="Tight Shirt">
-		Obcisły Podkoszulek
+		Obcisły podkoszulek
 	</string>
 	<string name="Tight Skirt">
-		Tight Skirt
+		Wąska spódnica
 	</string>
 	<string name="Tight Sleeves">
-		Obcisłe Rękawy
+		Obcisłe rękawy
 	</string>
 	<string name="Toe Shape">
-		Kształt Palca
+		Kształt palca
 	</string>
 	<string name="Toe Thickness">
-		Grubość Palca
+		Grubość palca
 	</string>
 	<string name="Torso Length">
-		Długość Tułowia
+		Długość tułowia
 	</string>
 	<string name="Torso Muscles">
-		Mięśnie Tułowia
+		Mięśnie tułowia
 	</string>
 	<string name="Torso Scrawny">
-		Wychudzony Tułów
+		Wychudzony tułów
 	</string>
 	<string name="Unattached">
 		Nieprzyłączone
@@ -3162,43 +3162,43 @@ Jeżeli nadal otrzymujesz ten komunikat, skontaktuj się z [SUPPORT_SITE].
 		Nienaturalne
 	</string>
 	<string name="Upper Bridge">
-		Górny Mostek
+		Górny mostek
 	</string>
 	<string name="Upper Cheeks">
-		Górne Policzki
+		Górne policzki
 	</string>
 	<string name="Upper Chin Cleft">
-		Roszczepienie Górnego Podbródka
+		Roszczepienie górnego podbródka
 	</string>
 	<string name="Upper Eyelid Fold">
-		Górna Powieka
+		Górna powieka
 	</string>
 	<string name="Upturned">
 		Zadarta
 	</string>
 	<string name="Very Red">
-		Bardzo Czerwona
+		Bardzo czerwona
 	</string>
 	<string name="Waist Height">
-		Wysokość Tali
+		Wysokość talii
 	</string>
 	<string name="Well-Fed">
 		Well-Fed
 	</string>
 	<string name="White Hair">
-		Białe Włosy
+		Białe włosy
 	</string>
 	<string name="Wide">
 		Szerokie
 	</string>
 	<string name="Wide Back">
-		Szeroki Tył
+		Szeroki tył
 	</string>
 	<string name="Wide Front">
-		Szeroki Przód
+		Szeroki przód
 	</string>
 	<string name="Wide Lips">
-		Szerokie Usta
+		Szerokie usta
 	</string>
 	<string name="Wild">
 		Dzikość
-- 
cgit v1.2.3


From bdf4b0b33fd824322f084ce4f334cb0781f9fba1 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Sat, 27 Mar 2010 18:07:22 -0700
Subject: IT translation review of set3

---
 .../newview/skins/default/xui/it/role_actions.xml  | 96 +++++++++++-----------
 indra/newview/skins/default/xui/it/strings.xml     |  2 +-
 2 files changed, 49 insertions(+), 49 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/it/role_actions.xml b/indra/newview/skins/default/xui/it/role_actions.xml
index 87f0602239..95f1f662f9 100644
--- a/indra/newview/skins/default/xui/it/role_actions.xml
+++ b/indra/newview/skins/default/xui/it/role_actions.xml
@@ -1,72 +1,72 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <role_actions>
-	<action_set description="Queste abilità permettono di aggiungere e rimuovere Membri dal gruppo, e permettono ai nuovi membri di aderire al gruppo senza invito." name="Membership">
-		<action description="Invitare persone in questo Gruppo" longdescription="Invita persone in questo gruppo usando il pulsante Invita nella sezione Ruoli &gt; scheda membri." name="member invite"/>
-		<action description="Espellere Membri da questo Gruppo" longdescription="Espelli membri dal gruppo usando il pulsante Espelli nella sezione Ruoli &gt; scheda membri. Un proprietario può espellere chiunque tranne un altro proprietario. Se non sei un proprietario, un membro può essere espulso da un gruppo soltanto qualora abbia soltanto il ruolo Tutti, e nessun altro ruolo. Per rimuovere membri dai ruoli, devi avere l&apos;Abilità corrispondente." name="member eject"/>
+	<action_set description="Queste abilità permettono di aggiungere e rimuovere membri dal gruppo e consentono ai nuovi membri di aderire al gruppo senza invito." name="Membership">
+		<action description="Invita persone in questo gruppo" longdescription="Invita persone in questo gruppo usando il pulsante Invita nella sezione Ruoli &gt; scheda membri." name="member invite"/>
+		<action description="Espelli membri da questo gruppo" longdescription="Espelli membri dal gruppo usando il pulsante Espelli nella sezione Ruoli &gt; scheda membri. Un proprietario può espellere chiunque tranne un altro proprietario. Se non sei un proprietario, un membro può essere espulso da un gruppo soltanto qualora abbia soltanto il ruolo Tutti, e nessun altro ruolo. Per rimuovere membri dai ruoli, devi avere l&apos;Abilità corrispondente." name="member eject"/>
 		<action description="Seleziona Iscrizione libera e modifica la Quota d&apos;iscrizione" longdescription="Seleziona Iscrizione libera per permettere ai nuovi membri di aderire senza invito e modifica la quota d&apos;iscrizione nella scheda Generale." name="member options"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di aggiungere, rimuovere, cambiare i Ruoli del Gruppo, aggiungere e rimuovere Membri dai Ruoli, e assegnare Abilità ai Ruoli." name="Roles">
-		<action description="Creare nuovi Ruoli" longdescription="Crea nuovi ruoli nella sezione Ruoli &gt; scheda ruoli." name="role create"/>
-		<action description="Cancellare Ruoli" longdescription="Elimina ruoli nella sezione Ruoli &gt; scheda ruoli." name="role delete"/>
+	<action_set description="Queste Abilità permettono di aggiungere, rimuovere, cambiare i ruoli del gruppo, aggiungere e rimuovere membri dai ruoli, nonché assegnare abilità ai ruoli." name="Roles">
+		<action description="Creare nuovi ruoli" longdescription="Crea nuovi ruoli nella sezione Ruoli &gt; scheda ruoli." name="role create"/>
+		<action description="Eliminare ruoli" longdescription="Elimina ruoli nella sezione Ruoli &gt; scheda ruoli." name="role delete"/>
 		<action description="Cambia i nomi di ruoli, i titoli, le descrizioni e definisci se i membri in quel ruolo sono resi pubblici" longdescription="Cambia i nomi di ruoli, i titoli, le descrizioni e definisci se i membri in quel ruolo sono resi pubblici Viene fatto nella parte inferiore della sezione Ruoli &gt; scheda Ruoli, dopo avere selezionato un ruolo." name="role properties"/>
-		<action description="Incaricare Membri ad Assegnare Ruoli" longdescription="Assegna un ruolo a membri nella lista dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Un utente con questa Abilità può aggiungere membri ad un ruolo nel quale il responsabile è già presente." name="role assign member limited"/>
-		<action description="Assegnare Membri a tutti i Ruoli" longdescription="Assegna i membri a qualsiasi ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). *ATTENZIONE* Ogni membro con questo Ruolo e Abilità può assegnarsi -- e assegnare ad altri membri non proprietari -- ruoli con poteri maggiori di quelli normalmente concessi, potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role assign member"/>
-		<action description="Rimuovere Membri dai Ruoli" longdescription="Rimuovi dai ruoli i membri nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Il proprietario non può essere rimosso." name="role remove member"/>
-		<action description="Assegnare e Rimuovere Abilità nei Ruoli" longdescription="Assegna e Rimuovi Abilità per ogni ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda Ruoli). *ATTENZIONE* Ogni membro con questo ruolo e Abilità può assegnarsi -- ed assegnare ad altri membri non proprietari -- tutte le Abilità, che potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role change actions"/>
+		<action description="Assegnare membri a ruoli del responsabile" longdescription="Assegna un ruolo a membri nella lista dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Un utente con questa Abilità può aggiungere membri ad un ruolo nel quale il responsabile è già presente." name="role assign member limited"/>
+		<action description="Assegnare membri a qualsiasi ruolo" longdescription="Assegna i membri a qualsiasi ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). *ATTENZIONE* Ogni membro con questo Ruolo e Abilità può assegnarsi -- e assegnare ad altri membri non proprietari -- ruoli con poteri maggiori di quelli normalmente concessi, potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role assign member"/>
+		<action description="Rimuovere membri dai ruoli" longdescription="Rimuovi dai ruoli i membri nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda membri). Il proprietario non può essere rimosso." name="role remove member"/>
+		<action description="Assegnare e rimuovere abilità nei ruoli" longdescription="Assegna e Rimuovi Abilità per ogni ruolo nell&apos;elenco dei ruoli assegnati (sezione Ruoli &gt; scheda Ruoli). *ATTENZIONE* Ogni membro con questo ruolo e Abilità può assegnarsi -- ed assegnare ad altri membri non proprietari -- tutte le Abilità, che potenzialmente con poteri analoghi a quelli di proprietario. Sii sicuro della scelta prima di assegnare questa Abilità." name="role change actions"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di modificare l&apos;identità di questo Gruppo, come il cambiamento della visibilità pubblica, lo statuto, e lo stemma." name="Group Identity">
-		<action description="Cambiare lo Statuto, lo Stemma, e &apos;Mostra nel Cerca/Search&apos;" longdescription="Cambia statuto, logo e &apos;Mostra nella ricerca&apos;. Viene fatto nella sezione Generale." name="group change identity"/>
+	<action_set description="Queste abilità autorizzano a modificare l&apos;identità di questo gruppo, come ad esempio la modifica della visibilità pubblica, lo statuto e il logo." name="Group Identity">
+		<action description="Cambiare lo statuto, il logo, e &apos;Mostra nella ricerca&apos;" longdescription="Cambia statuto, logo e &apos;Mostra nella ricerca&apos;. Viene fatto nella sezione Generale." name="group change identity"/>
 	</action_set>
 	<action_set description="Queste Abilità comprendono il potere di intestare, modificare e vendere terreni di proprietà del gruppo. Per aprire la finestra Informazioni sul terreno, fai clic con il pulsante destro del mouse sul terreno e seleziona Informazioni sul terreno, o clicca sull&apos;icona &apos;i&apos; nella Barra di Navigazione." name="Parcel Management">
-		<action description="Intestare terra e comprare terra per il gruppo" longdescription="Intesta terra e compra terra per il Gruppo. Viene fatto in Informazioni sul Terreno &gt; tabella Generale." name="land deed"/>
-		<action description="Abbandonare la terra in favore di Governor Linden" longdescription="Abbandona la terra in favore di Governor Linden. *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può abbandonare la terra posseduta dal Gruppo in Informazioni sul Terreno &gt; tabella Generale, restituendola alla proprietà Linden senza una vendita! Devi essere sicuro di quello che fai prima di assegnare questa Abilità." name="land release"/>
-		<action description="Impostare le info per la vendita della terra" longdescription="Imposta le info per la vendita della terra. *ATTENZIONE* Ogni Membro con questo Ruolo e Abilità può vendere la terra posseduta dal Gruppo in Info sul Terreno &gt; tabella Generale (al prezzo che vogliono)! Devi essere sicuro di quello che fai prima di assegnare questa Abilità." name="land set sale info"/>
-		<action description="Suddividere e unire appezzamenti" longdescription="Suddividi e unisci lotti. Viene fatto cliccando con il pulsante destro del mouse sul terreno, selezionando Modifica terreno e trascinando il mouse sul terreno per creare una selezione. Per suddividere, seleziona quale parte vuoi dividere e clicca su Suddividi. Per unire, seleziona due o più lotti confinanti e clicca su Unisci." name="land divide join"/>
+		<action description="Cessione di terreno e acquisto di terreno per il gruppo" longdescription="Intesta terreno e acquista terreno per il gruppo. Ciò viene fatto in Informazioni sul terreno &gt; scheda Generale." name="land deed"/>
+		<action description="Abbandonare il terreno in favore di Governor Linden" longdescription="Abbandona il terreno in favore di Governor Linden. *ATTENZIONE* Ogni membro con questo ruolo e abilità può abbandonare il terreno di proprietà del gruppo in Informazioni sul terreno &gt; scheda Generale, restituendolo alla proprietà Linden senza effettuare una vendita. Sii sicuro della scelta prima di assegnare questa Abilità." name="land release"/>
+		<action description="Informazioni su come impostare il terreno come in vendita" longdescription="Imposta le info per la vendita della terra. *ATTENZIONE* Ogni Membro con questo ruolo e abilità può vendere il terreno di proprietà del gruppo nella scheda Informazioni sul terreno &gt; scheda Generale. Pertanto sii sicuro della scelta prima di assegnare questa Abilità." name="land set sale info"/>
+		<action description="Suddividere e unire lotti" longdescription="Suddividi e unisci lotti. Viene fatto cliccando con il pulsante destro del mouse sul terreno, selezionando Modifica terreno e trascinando il mouse sul terreno per creare una selezione. Per suddividere, seleziona quale parte vuoi dividere e clicca su Suddividi. Per unire, seleziona due o più lotti confinanti e clicca su Unisci." name="land divide join"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di cambiare il nome dell&apos;appezzamento, le impostazioni pre-definite, la visibilità nella mappatura, il punto di arrivo &amp; le coordinate del Teleport." name="Parcel Identity">
+	<action_set description="Queste abilità permettono di cambiare il nome del lotto, le impostazioni di pubblicazione, la visibilità negli elenchi e il punto di arrivo, nonché opzioni di indirizzamento del Teleport." name="Parcel Identity">
 		<action description="Premi Mostra luogo nella ricerca e seleziona una categoria" longdescription="Premi Mostra luogo nella ricerca e seleziona una categoria di lotto in Informazioni sul terreno &gt; scheda Opzioni." name="land find places"/>
 		<action description="Cambia il nome del lotto, la descrizione e le impostazioni di Mostra luogo nella ricerca" longdescription="Cambia il nome del lotto, la descrizione e le impostazioni di Mostra luogo nella ricerca. Ciò viene fatto in Informazioni sul terreno &gt; scheda Opzioni." name="land change identity"/>
-		<action description="Impostare il punto di arrivo e le coordinate del Teleport" longdescription="In un appezzamento posseduto da un Gruppo, i Membri con questo Ruolo e Abilità possono impostare un punto di arrivo per i Teleport entranti, e impostare anche le coordinate del Teleport per ulteriore precisione. Viene fatto in Informazioni sul Terreno &gt; tabella Opzioni." name="land set landing point"/>
+		<action description="Impostare il punto di arrivo e l&apos;indirizzamento del Teleport" longdescription="In un lotto di proprietà di un gruppo, i membri con questo ruolo e abilità possono impostare un punto di arrivo per i teleport entranti e impostare anche l&apos;indirizzamento del teleport per ulteriore precisione. Viene fatto in Informazioni sul terreno &gt; Opzioni." name="land set landing point"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono alcune permessi nell&apos;appezzamento, quali &apos;Creare Oggetti&apos;, &apos;Editare il Terreno&apos;, trasmettere musica &amp; tabella Media." name="Parcel Settings">
-		<action description="Cambiare musica &amp; tabella media" longdescription="Cambia le impostazioni per lo streaming della musica e dei video in Informazioni sul Terreno &gt; tabella Media." name="land change media"/>
-		<action description="Cliccare &apos;Edita il Terreno&apos;" longdescription="Clicca &apos;Edita il Terreno&apos;. *ATTENZIONE* Informazioni sul Terreno &gt; tabella Opzioni &gt; Edita il Terreno permette a tutti di modificare la forma del terreno, collocare e spostare le piante Linden. Devi essere sicuro di quello che fai prima di assignera questa Abilità. Edita il terreno in Informazioni sul Terreno &gt; tabella Opzioni." name="land edit"/>
-		<action description="Cliccare Informazioni sul Terreno &gt; Impostazione Opzioni" longdescription="Premi Sicuro (nessun danno), Vola e consenti agli altri residenti di: modificare il terreno, costruire, creare punti di riferimento ed eseguire script nel terreno appartenente ad un gruppo in Informazioni sul terreno &gt; scheda Opzioni." name="land options"/>
+	<action_set description="Queste abilità hanno poteri relativi alle opzioni dei lotti, come la creazione di oggetti, la modifica del terreno e le impostazioni per la musica e gli elementi multimediali." name="Parcel Settings">
+		<action description="Cambiare impostazioni musica e multimediali" longdescription="Cambia le impostazioni per lo streaming della musica e dei video in Informazioni sul terreno &gt; Media." name="land change media"/>
+		<action description="Attiva &apos;Modifica terreno&apos;" longdescription="Attiva &apos;Modifica terreno&apos;. *ATTENZIONE* Informazioni sul terreno &gt; Opzioni &gt; Modifica terreno consente a chiunque di modificare la forma del tuo terreno e di collocare e spostare le piante Linden. Pertanto sii sicuro della scelta prima di assegnare questa Abilità. La funzione di modifica del terreno è attivata in Informazioni sul terreno &gt; Opzioni." name="land edit"/>
+		<action description="Attivazione di parametri per Informazioni sul terreno &gt; Opzioni" longdescription="Premi Sicuro (nessun danno), Vola e consenti agli altri residenti di: modificare il terreno, costruire, creare punti di riferimento ed eseguire script nel terreno appartenente ad un gruppo in Informazioni sul terreno &gt; scheda Opzioni." name="land options"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono ai Membri di non avere restrizioni in un appezzamento posseduto da un Gruppo." name="Parcel Powers">
-		<action description="Permettere sempre &apos;Edita il Terreno&apos;" longdescription="I Membri con questo Ruolo e Abilità possono editare il terreno posseduto da un Gruppo, anche se non è selezionato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow edit land"/>
-		<action description="Permettere Vola Sempre&apos;" longdescription="I Membri con questo Ruolo e Abilità possono volare in un terreno posseduto da un Gruppo, anche se non è selezionato in Info sul Terreno &gt; tabella Opzioni." name="land allow fly"/>
-		<action description="Permettere &apos;Crea Oggetti&apos; sempre" longdescription="I Membri con questo Ruolo e Abilità possono creare oggetti in un appezzamento posseduto da un Gruppo, anche se non è selezionato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow create"/>
-		<action description="Permettere &apos;Crea Landmark&apos; sempre" longdescription="I Membri con questo Ruolo e Abilità possono creare Landmark in un appezzamento posseduto da un Gruppo , anche se non è evidenziato in Informazioni sul Terreno &gt; tabella Opzioni." name="land allow landmark"/>
-		<action description="Permettere &apos;Teleportami a Casa&apos; in un appezzamento di un Gruppo" longdescription="I membri in un ruolo con questa Abilità possono usare il menu Mondo &gt; Punti di riferimento &gt; Imposta come Casa su un lotto ceduto a questo gruppo." name="land allow set home"/>
+	<action_set description="Queste abilità permettono ai membri di non avere restrizioni in un lotto appartenente ad un gruppo." name="Parcel Powers">
+		<action description="Consenti sempre la modifica del terreno" longdescription="I membri con questo ruolo e abilità possono modificare il terreno appartenente ad un gruppo, anche se la funzionalità è disattivata in Informazioni sul terreno &gt; Opzioni." name="land allow edit land"/>
+		<action description="Consenti sempre il volo" longdescription=" I membri con questo ruolo e abilità possono volare in un terreno appartenente ad un gruppo, anche se la funzionalità è disattivata in Informazioni sul terreno &gt; Opzioni." name="land allow fly"/>
+		<action description="Consenti sempre la creazione di oggetti" longdescription="I membri con questo ruolo e abilità possono creare oggetti in un lotto appartenente ad un gruppo, anche se la funzionalità è disattivata in Informazioni sul terreno &gt; Opzioni." name="land allow create"/>
+		<action description="Consenti sempre la creazione di punti di riferimento" longdescription="I membri con questo ruolo e abilità possono creare punti di riferimento in un lotto appartenente ad un gruppo, anche se la funzionalità è disattivata in Informazioni sul terreno &gt; Opzioni." name="land allow landmark"/>
+		<action description="Consenti la funzione &apos;Imposta come Casa mia&apos; in un lotto di gruppo" longdescription="I membri in un ruolo con questa Abilità possono usare il menu Mondo &gt; Punti di riferimento &gt; Imposta come Casa su un lotto ceduto a questo gruppo." name="land allow set home"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di concedere o limitare l&apos;accesso ad un appezzamento di un Gruppo, e includono Congela ed Espelli un Residente." name="Parcel Access">
-		<action description="Gestire la lista degli Accessi Consentiti" longdescription="Gestisci la lista degli Accessi Consentiti in Informazioni sul Terreno &gt; tabella Accesso." name="land manage allowed"/>
-		<action description="Gestire la lista degli Accessi Bloccati" longdescription="Gestisci la lista Espulsi dal lotto in Informazioni sul terreno &gt; scheda Accesso." name="land manage banned"/>
+	<action_set description="Queste Abilità consentono di concedere o limitare l&apos;accesso ad un lotto di un gruppo da parte di residenti, con le azioni Congela ed Espelli." name="Parcel Access">
+		<action description="Gestire la lista di accesso al lotto" longdescription="Gestisci la lista di accesso al lotto in Informazioni sul terreno &gt;  Accesso." name="land manage allowed"/>
+		<action description="Gestire la lista dei residenti espulsi dal lotto" longdescription="Gestisci la lista Espulsi dal lotto in Informazioni sul terreno &gt; scheda Accesso." name="land manage banned"/>
 		<action description="Cambia le impostazioni del lotto in Vendi pass a" longdescription="Cambia le impostazioni Vendi pass a in Informazioni sul terreno &gt; scheda Accesso." name="land manage passes"/>
-		<action description="Espellere e Congelare i Residenti in un appezzamento" longdescription="Membri in un ruolo con questa Abilità possono occuparsi di un residente indesiderato in un lotto posseduto da un gruppo, facendo clic sul residente con il pulsante destro del mouse e selezionando Espelli o Congela." name="land admin"/>
+		<action description="Espellere e Congelare i Residenti in un lotto" longdescription="Membri in un ruolo con questa Abilità possono occuparsi di un residente indesiderato in un lotto posseduto da un gruppo, facendo clic sul residente con il pulsante destro del mouse e selezionando Espelli o Congela." name="land admin"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono ai Membri di restituire oggetti, collocare e spostare piante Linden. Questo è utile ai Membri per ripulire da oggetti indesiderati e creare paesaggi, ma deve essere utilizzato con cura, perchè non si può annullare la restituzione degli Oggetti." name="Parcel Content">
-		<action description="Restituire oggetti posseduti da un Gruppo" longdescription="Restituisci gli oggetti posseduti da un Gruppo in un appezzamento di un Gruppo in Informazioni sul Terreno &gt; tabella Oggetti." name="land return group owned"/>
-		<action description="Restituire oggetti concessi ad un Gruppo" longdescription="Restituisci oggetti concessi ad un Gruppo in un appezzamento di un Gruppo in Informazioni sul Terreno &gt; tabella Oggetti." name="land return group set"/>
-		<action description="Restituire oggetti estranei al Gruppo" longdescription="Restituire oggetti estranei al Gruppo in un appezzamento di un Gruppo in Info sul Terreno &gt; tabella Oggetti." name="land return non group"/>
+	<action_set description="Queste abilità consentono ai membri di restituire oggetti, collocare e spostare piante Linden. Questo è utile ai membri per ripulire da oggetti indesiderati e creare paesaggi, ma deve essere utilizzato con cura, perchè la restituzione degli oggetti non può essere annullata." name="Parcel Content">
+		<action description="Restituire oggetti di proprietà di un gruppo" longdescription="Restituisci gli oggetti di proprietà di un gruppo in un appezzamento di un gruppo in Informazioni sul terreno &gt; Oggetti." name="land return group owned"/>
+		<action description="Restituire oggetti assegnati ad un gruppo" longdescription="Restituisci oggetti assegnati ad un gruppo in un lotto di un gruppo in Informazioni sul terreno &gt; Oggetti." name="land return group set"/>
+		<action description="Restituire oggetti estranei al gruppo" longdescription="Restituire oggetti estranei al gruppo in un appezzamento di un gruppo in Informazioni sul terreno &gt; Oggetti." name="land return non group"/>
 		<action description="Creare un paesaggio utilizzando le piante Linden" longdescription="Abilità di creare paesaggi e posizionare e spostare alberi, piante, erba Linden. Questi oggetti sono presenti nella Libreria del tuo Inventario &gt; cartella Oggetti, o possono essere creati con il menu Crea." name="land gardening"/>
 	</action_set>
 	<action_set description="Queste Abilità includono il potere di cedere, modificare e vendere oggetti posseduti dal gruppo. Viene fatto negli strumenti Costruisci &gt; scheda Generale. Clic con il pulsante destro del mouse su un oggetto e Modifica per vedere le impostazioni." name="Object Management">
-		<action description="Intestare oggetti ad un Gruppo" longdescription="Intesta oggetti ad un gruppo in Strumenti per costruzione &gt; scheda Generale." name="object deed"/>
-		<action description="Modificare (sposta, copia, modifica) oggetti di un Gruppo" longdescription="Gestisci (sposta, copia, modifica) gli oggetti appartenenti ad un gruppo in Build Tools &gt; tabella Generale." name="object manipulate"/>
-		<action description="Mettere in vendita oggetti di un Gruppo" longdescription="Metti in vendita oggetti posseduti da un Gruppo in Strumenti per costruzione &gt; scheda Generale." name="object set sale"/>
+		<action description="Intestare oggetti ad un gruppo" longdescription="Intesta oggetti ad un gruppo in Strumenti per costruzione &gt; scheda Generale." name="object deed"/>
+		<action description="Modificare (sposta, copia, modifica) oggetti di un gruppo" longdescription="Gestisci (sposta, copia, modifica) gli oggetti appartenenti ad un gruppo in Build Tools &gt; tabella Generale." name="object manipulate"/>
+		<action description="Mettere in vendita oggetti di un gruppo" longdescription="Metti in vendita oggetti posseduti da un Gruppo in Strumenti per costruzione &gt; scheda Generale." name="object set sale"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di richiedere ai Membri di pagare le perdite del Gruppo e di ricevere i dividendi del Gruppo, e di limitare l&apos;accesso all&apos;account del Gruppo." name="Accounting">
-		<action description="Pagare le perdite del Gruppo e ricevere i dividendi del Gruppo" longdescription="I Membri con questo Ruolo e Abilità pagheranno automaticamente le perdite del Gruppo e riceveranno i dividendi del Gruppo. Questo significa che riceveranno una porzione delle vendite di terre possedute dal gruppo (che sono risolte giornalmente), e contribuiranno anche su cose come le tasse di iscrizione dell&apos;appezzament. " name="accounting accountable"/>
+	<action_set description="Queste abilità consentono di richiedere ai membri di pagare le passività del gruppo e di ricevere i dividendi del gruppo, nonché di limitare l&apos;accesso alla cronologia finanziaria del gruppo." name="Accounting">
+		<action description="Pagare le passività del gruppo e ricevere i dividendi del gruppo" longdescription="I membri con questo ruolo e abilità pagheranno automaticamente le passività del gruppo e riceveranno i dividendi del gruppo. Questo significa che riceveranno una porzione delle vendite di terreni appartenenti al gruppo (che sono distribuite giornalmente) e contribuiranno fondi a spese come le quote di inserzione del lotto. " name="accounting accountable"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono ai Membri di spedire, ricevere, e vedere le Notice del Gruppo." name="Notices">
-		<action description="Spedire Notice" longdescription="Membri in un ruolo con questa Abilità possono inviare avvisi tramite la sezione Gruppo &gt; Avvisi." name="notices send"/>
-		<action description="Ricevere Notice e vedere Notice precedenti" longdescription="Membri in un ruolo con questa Abilità possono ricevere avvisi e vedere avvisi precedenti nella sezione Gruppo &gt; Avvisi." name="notices receive"/>
+	<action_set description="Queste abilità consentono ai membri di inviare, ricevere e vedere gli avvisi del gruppo." name="Notices">
+		<action description="Invia avvisi" longdescription="Membri in un ruolo con questa Abilità possono inviare avvisi tramite la sezione Gruppo &gt; Avvisi." name="notices send"/>
+		<action description="Ricevere avvisi e vedere avvisi precedenti" longdescription="Membri in un ruolo con questa Abilità possono ricevere avvisi e vedere avvisi precedenti nella sezione Gruppo &gt; Avvisi." name="notices receive"/>
 	</action_set>
-	<action_set description="Queste Abilità permettono di concedere o limitare l&apos;accesso alle sessioni di chat e di voice chat nel gruppo." name="Chat">
-		<action description="Aderire alla Chat di Gruppo" longdescription="I Membri con questo Ruolo e Abilità possono aderire alle sessioni di chat, sia scritte che in voice." name="join group chat"/>
-		<action description="Aderire alla Voice Chat di Gruppo" longdescription="I Membri con questo Ruolo e Abilità possono aderire alle sessioni di Voice Chat nel gruppo.  NOTA: Per poter partecipare alla Chat di Gruppo è necessario accedere alla sessione di voice chat." name="join voice chat"/>
-		<action description="Moderare la Chat di Gruppo" longdescription="I Membri con questo Ruolo e Abilità possono controllare l&apos;accesso e la partecipazione alle sessioni di chat scritta e di voice chat nel Gruppo." name="moderate group chat"/>
+	<action_set description="Queste Abilità permettono di concedere o limitare l&apos;accesso alle sessioni di chat e di chat vocale nel gruppo." name="Chat">
+		<action description="Partecipare alla Chat di gruppo" longdescription="I membri con questo ruolo e abilità possono partecipare alle sessioni di chat, sia scritte che vocale." name="join group chat"/>
+		<action description="Partecipa alla Chat vocale di gruppo" longdescription=" I membri con questo ruolo e abilità possono partecipare alle sessioni di Chat vocale nel gruppo.  NOTA: per poter partecipare alla Chat di gruppo è necessario accedere alla sessione di chat vocale." name="join voice chat"/>
+		<action description="Moderare la Chat di gruppo" longdescription="I membri con questo ruolo e abilità possono gestire l&apos;accesso e la partecipazione alle sessioni di chat scritta e di chat vocale nel gruppo." name="moderate group chat"/>
 	</action_set>
 </role_actions>
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index 308d550188..93239983a8 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -999,7 +999,7 @@
 		Preferiti
 	</string>
 	<string name="InvFolder Current Outfit">
-		Vestiario attuale
+		Abbigliamento attuale
 	</string>
 	<string name="InvFolder My Outfits">
 		Il mio vestiario
-- 
cgit v1.2.3


From 8654ba5e2571e07c8d2fd898027abf6f85777905 Mon Sep 17 00:00:00 2001
From: Aimee Linden <aimee@lindenlab.com>
Date: Mon, 29 Mar 2010 10:49:21 +0100
Subject: EXT-6515 Turn off Vivox automatic crash reporting

---
 indra/newview/app_settings/settings.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 9f474a39bc..73fb24e4eb 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10369,7 +10369,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>VivoxDebugLevel</key>
     <map>
-- 
cgit v1.2.3


From f55af5fcdfdd0b4520e382d315afefd41c534820 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Mon, 29 Mar 2010 14:07:40 +0300
Subject: done EXT-6547 Rename stuff related with Panel Look Info to Panel
 Outfit Edit

renamed panel_look_info.xml to panel_outfit_edit.xml
renamed llpanellookinfo.cpp/llpanellookinfo.h to llpaneloutfitedit.cpp/llpaneloutfitedit.h
renamed LLPanelLookInfo to LLPanelOutfitEdit

Reviewed at https://codereview.productengine.com/secondlife/r/130/

--HG--
branch : product-engine
---
 indra/newview/CMakeLists.txt                       |   4 +-
 indra/newview/llpaneloutfitedit.cpp                | 511 +++++++++++++++++++++
 indra/newview/llpaneloutfitedit.h                  | 127 +++++
 indra/newview/llsidepanelappearance.cpp            |  32 +-
 indra/newview/llsidepanelappearance.h              |   6 +-
 .../skins/default/xui/en/panel_outfit_edit.xml     | 233 ++++++++++
 .../skins/default/xui/en/sidepanel_appearance.xml  |   6 +-
 7 files changed, 895 insertions(+), 24 deletions(-)
 create mode 100644 indra/newview/llpaneloutfitedit.cpp
 create mode 100644 indra/newview/llpaneloutfitedit.h
 create mode 100644 indra/newview/skins/default/xui/en/panel_outfit_edit.xml

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index f45237a73c..9bdf9d8893 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -317,7 +317,6 @@ set(viewer_SOURCE_FILES
     llpanellandmedia.cpp
     llpanellogin.cpp
     llpanelloginlistener.cpp
-    llpanellookinfo.cpp
     llpanelmaininventory.cpp
     llpanelmediasettingsgeneral.cpp
     llpanelmediasettingspermissions.cpp
@@ -326,6 +325,7 @@ set(viewer_SOURCE_FILES
     llpanelnearbymedia.cpp
     llpanelobject.cpp
     llpanelobjectinventory.cpp
+    llpaneloutfitedit.cpp
     llpaneloutfitsinventory.cpp
     llpanelpeople.cpp
     llpanelpeoplemenus.cpp
@@ -814,7 +814,6 @@ set(viewer_HEADER_FILES
     llpanellandmedia.h
     llpanellogin.h
     llpanelloginlistener.h
-    llpanellookinfo.h
     llpanelmaininventory.h
     llpanelmediasettingsgeneral.h
     llpanelmediasettingspermissions.h
@@ -823,6 +822,7 @@ set(viewer_HEADER_FILES
     llpanelnearbymedia.h
     llpanelobject.h
     llpanelobjectinventory.h
+    llpaneloutfitedit.h
     llpaneloutfitsinventory.h
     llpanelpeople.h
     llpanelpeoplemenus.h
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
new file mode 100644
index 0000000000..6139174da3
--- /dev/null
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -0,0 +1,511 @@
+/**
+ * @file llpaneloutfitedit.cpp
+ * @brief Displays outfit edit information in Side Tray.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llpaneloutfitedit.h"
+
+// *TODO: reorder includes to match the coding standard
+#include "llagent.h"
+#include "llagentwearables.h"
+#include "llappearancemgr.h"
+#include "llinventory.h"
+#include "llviewercontrol.h"
+#include "llui.h"
+#include "llfloater.h"
+#include "llfloaterreg.h"
+#include "llinventoryfunctions.h"
+#include "llinventorypanel.h"
+#include "llviewerwindow.h"
+#include "llviewerinventory.h"
+#include "llbutton.h"
+#include "llcombobox.h"
+#include "llfiltereditor.h"
+#include "llfloaterinventory.h"
+#include "llinventorybridge.h"
+#include "llinventorymodel.h"
+#include "lluiconstants.h"
+#include "llscrolllistctrl.h"
+#include "lltextbox.h"
+#include "lluictrlfactory.h"
+#include "llsdutil.h"
+#include "llsidepanelappearance.h"
+#include "llwearablelist.h"
+
+static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_look("panel_outfit_edit");
+
+const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
+const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
+const U64 ALL_ITEMS_MASK = WEARABLE_MASK | ATTACHMENT_MASK;
+
+class LLInventoryLookObserver : public LLInventoryObserver
+{
+public:
+	LLInventoryLookObserver(LLPanelOutfitEdit *panel) : mPanel(panel) {}
+	virtual ~LLInventoryLookObserver() 
+	{
+		if (gInventory.containsObserver(this))
+		{
+			gInventory.removeObserver(this);
+		}
+	}
+	
+	virtual void changed(U32 mask)
+	{
+		if (mask & (LLInventoryObserver::ADD | LLInventoryObserver::REMOVE))
+		{
+			mPanel->updateLookInfo();
+		}
+	}
+protected:
+	LLPanelOutfitEdit *mPanel;
+};
+
+class LLLookFetchObserver : public LLInventoryFetchDescendentsObserver
+{
+public:
+	LLLookFetchObserver(LLPanelOutfitEdit *panel) :
+	mPanel(panel)
+	{}
+	LLLookFetchObserver() {}
+	virtual void done()
+	{
+		mPanel->lookFetched();
+		if(gInventory.containsObserver(this))
+		{
+			gInventory.removeObserver(this);
+		}
+	}
+private:
+	LLPanelOutfitEdit *mPanel;
+};
+
+
+
+LLPanelOutfitEdit::LLPanelOutfitEdit()
+:	LLPanel(), mLookID(), mFetchLook(NULL), mSearchFilter(NULL),
+mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL),
+mRemoveFromLookBtn(NULL), mLookObserver(NULL), mNumItemsInLook(0)
+{
+	mSavedFolderState = new LLSaveFolderState();
+	mSavedFolderState->setApply(FALSE);
+	
+	mFetchLook = new LLLookFetchObserver(this);
+	mLookObserver = new LLInventoryLookObserver(this);
+	gInventory.addObserver(mLookObserver);
+	
+	mLookItemTypes.reserve(NUM_LOOK_ITEM_TYPES);
+	for (U32 i = 0; i < NUM_LOOK_ITEM_TYPES; i++)
+	{
+		mLookItemTypes.push_back(LLLookItemType());
+	}
+	
+	// TODO: make these strings translatable
+	mLookItemTypes[LIT_ALL] = LLLookItemType("All Items", ALL_ITEMS_MASK);
+	mLookItemTypes[LIT_WEARABLE] = LLLookItemType("Shape & Clothing", WEARABLE_MASK);
+	mLookItemTypes[LIT_ATTACHMENT] = LLLookItemType("Attachments", ATTACHMENT_MASK);
+
+}
+
+LLPanelOutfitEdit::~LLPanelOutfitEdit()
+{
+	delete mSavedFolderState;
+	if (gInventory.containsObserver(mFetchLook))
+	{
+		gInventory.removeObserver(mFetchLook);
+	}
+	delete mFetchLook;
+	
+	if (gInventory.containsObserver(mLookObserver))
+	{
+		gInventory.removeObserver(mLookObserver);
+	}
+	delete mLookObserver;
+}
+
+BOOL LLPanelOutfitEdit::postBuild()
+{
+	// gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
+		
+	mLookName = getChild<LLTextBox>("curr_look_name"); 
+	
+	/*
+	mLookContents->setDoubleClickCallback(onDoubleClickSpeaker, this);
+	mLookContents->setCommitOnSelectionChange(TRUE);
+	mLookContents->setCommitCallback(boost::bind(&LLPanelActiveSpeakers::handleSpeakerSelect, this, _2));
+	mLookContents->setSortChangedCallback(boost::bind(&LLPanelActiveSpeakers::onSortChanged, this));
+	mLookContents->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+	*/
+	
+	mInventoryItemsPanel = getChild<LLInventoryPanel>("inventory_items");
+	mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK);
+	mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	// mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2));
+	// mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this, _1, _2));
+	
+	LLComboBox* type_filter = getChild<LLComboBox>("inventory_filter");
+	type_filter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onTypeFilterChanged, this, _1));
+	type_filter->removeall();
+	for (U32 i = 0; i < mLookItemTypes.size(); ++i)
+	{
+		type_filter->add(mLookItemTypes[i].displayName);
+	}
+	type_filter->setCurrentByIndex(LIT_ALL);
+	
+	mSearchFilter = getChild<LLFilterEditor>("look_item_filter");
+	mSearchFilter->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onSearchEdit, this, _2));
+	
+	/* Removing add to look inline button (not part of mvp for viewer 2)
+	LLButton::Params add_params;
+	add_params.name("add_to_look");
+	add_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this));
+	add_params.label("+");
+	
+	mAddToLookBtn = LLUICtrlFactory::create<LLButton>(add_params);
+	mAddToLookBtn->setEnabled(FALSE);
+	mAddToLookBtn->setVisible(FALSE); */
+	
+	childSetAction("add_item_btn", boost::bind(&LLPanelOutfitEdit::onAddToLookClicked, this), this);
+
+	mUpBtn = getChild<LLButton>("up_btn");
+	mUpBtn->setEnabled(TRUE);
+	mUpBtn->setClickedCallback(boost::bind(&LLPanelOutfitEdit::onUpClicked, this));
+	
+	mLookContents = getChild<LLScrollListCtrl>("look_items_list");
+	mLookContents->sortByColumn("look_item_sort", TRUE);
+	mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this));
+	
+	/*
+	LLButton::Params remove_params;
+	remove_params.name("remove_from_look");
+	remove_params.click_callback.function(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
+	remove_params.label("-"); */
+	
+	//mRemoveFromLookBtn = LLUICtrlFactory::create<LLButton>(remove_params);
+	mRemoveFromLookBtn = getChild<LLButton>("remove_from_look_btn");
+	mRemoveFromLookBtn->setEnabled(FALSE);
+	mRemoveFromLookBtn->setVisible(FALSE);
+	//childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
+	mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
+	//getChild<LLPanel>("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn
+
+	mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
+	mEditWearableBtn->setEnabled(FALSE);
+	mEditWearableBtn->setVisible(FALSE);
+	mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this));
+	
+	childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
+	
+	return TRUE;
+}
+
+void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
+{
+	LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl);
+	llassert(type_filter);
+	if (type_filter)
+	{
+		U32 curr_filter_type = type_filter->getCurrentIndex();
+		mInventoryItemsPanel->setFilterTypes(mLookItemTypes[curr_filter_type].inventoryMask);
+	}
+	
+	mSavedFolderState->setApply(TRUE);
+	mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+	
+	LLOpenFoldersWithSelection opener;
+	mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
+	mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
+	
+	gInventory.startBackgroundFetch();
+}
+
+void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
+{
+	if (mSearchString != string)
+	{
+		mSearchString = string;
+		
+		// Searches are case-insensitive
+		LLStringUtil::toUpper(mSearchString);
+		LLStringUtil::trimHead(mSearchString);
+	}
+	
+	if (mSearchString == "")
+	{
+		mInventoryItemsPanel->setFilterSubString(LLStringUtil::null);
+		
+		// re-open folders that were initially open
+		mSavedFolderState->setApply(TRUE);
+		mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+		LLOpenFoldersWithSelection opener;
+		mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(opener);
+		mInventoryItemsPanel->getRootFolder()->scrollToShowSelection();
+	}
+	
+	gInventory.startBackgroundFetch();
+	
+	if (mInventoryItemsPanel->getFilterSubString().empty() && mSearchString.empty())
+	{
+		// current filter and new filter empty, do nothing
+		return;
+	}
+	
+	// save current folder open state if no filter currently applied
+	if (mInventoryItemsPanel->getRootFolder()->getFilterSubString().empty())
+	{
+		mSavedFolderState->setApply(FALSE);
+		mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+	}
+	
+	// set new filter string
+	mInventoryItemsPanel->setFilterSubString(mSearchString);
+}
+
+void LLPanelOutfitEdit::onAddToLookClicked(void)
+{
+	LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
+	LLFolderViewEventListener* listenerp  = curr_item->getListener();
+	link_inventory_item(gAgent.getID(), listenerp->getUUID(), mLookID, listenerp->getName(),
+						LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL));
+	updateLookInfo();
+}
+
+
+void LLPanelOutfitEdit::onRemoveFromLookClicked(void)
+{
+	LLUUID id_to_remove = mLookContents->getSelectionInterface()->getCurrentID();
+	
+	LLViewerInventoryItem * item_to_remove = gInventory.getItem(id_to_remove);
+	
+	if (item_to_remove)
+	{
+		// returns null if not a wearable (attachment, etc).
+		const LLWearable* wearable_to_remove = gAgentWearables.getWearableFromAssetID(item_to_remove->getAssetUUID());
+		if (!wearable_to_remove || gAgentWearables.canWearableBeRemoved( wearable_to_remove ))
+		{											 
+			gInventory.purgeObject( id_to_remove );
+			updateLookInfo();
+			mRemoveFromLookBtn->setEnabled(FALSE);
+			if (mRemoveFromLookBtn->getVisible())
+			{
+				mRemoveFromLookBtn->setVisible(FALSE);
+			}
+		}
+	}
+}
+
+
+void LLPanelOutfitEdit::onUpClicked(void)
+{
+	LLUUID inv_id = mLookContents->getSelectionInterface()->getCurrentID();
+	if (inv_id.isNull())
+	{
+		//nothing selected, do nothing
+		return;
+	}
+
+	LLViewerInventoryItem *link_item = gInventory.getItem(inv_id);
+	if (!link_item)
+	{
+		llwarns << "could not find inventory item based on currently worn link." << llendl;
+		return;
+	}
+
+
+	LLUUID asset_id = link_item->getAssetUUID();
+	if (asset_id.isNull())
+	{
+		llwarns << "inventory link has null Asset ID. could not get object reference" << llendl;
+	}
+
+	static const std::string empty = "";
+	LLWearableList::instance().getAsset(asset_id,
+										empty,	// don't care about wearable name
+										link_item->getActualType(),
+										LLSidepanelAppearance::editWearable,
+										(void*)getParentUICtrl());
+}
+
+
+void LLPanelOutfitEdit::onEditWearableClicked(void)
+{
+	LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID();
+
+	LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit);
+
+	if (item_to_edit)
+	{
+		// returns null if not a wearable (attachment, etc).
+		LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID());
+		if (!wearable_to_edit || !wearable_to_edit->getPermissions().allowModifyBy(gAgent.getID()) )
+		{											 
+			LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
+			if (mEditWearableBtn->getVisible())
+			{
+				mEditWearableBtn->setVisible(FALSE);
+			}
+		}
+	}
+}
+
+void LLPanelOutfitEdit::onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
+{
+	LLFolderViewItem* current_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
+	if (!current_item)
+	{
+		return;
+	}
+	
+	/* Removing add to look inline button (not part of mvp for viewer 2)
+	LLRect btn_rect(current_item->getLocalRect().mRight - 50,
+					current_item->getLocalRect().mTop,
+					current_item->getLocalRect().mRight - 30,
+					current_item->getLocalRect().mBottom);
+	
+	mAddToLookBtn->setRect(btn_rect);
+	mAddToLookBtn->setEnabled(TRUE);
+	if (!mAddToLookBtn->getVisible())
+	{
+		mAddToLookBtn->setVisible(TRUE);
+	}
+	
+	current_item->addChild(mAddToLookBtn); */
+}
+
+void LLPanelOutfitEdit::onLookItemSelectionChange(void)
+{	
+	S32 left_offset = -4;
+	S32 top_offset = -10;
+	LLRect rect = mLookContents->getLastSelectedItem()->getRect();
+	LLRect btn_rect(
+					left_offset + rect.mRight - 50,
+					top_offset  + rect.mTop,
+					left_offset + rect.mRight - 30,
+					top_offset  + rect.mBottom);
+	
+	mEditWearableBtn->setRect(btn_rect);
+	
+	mEditWearableBtn->setEnabled(TRUE);
+	if (!mEditWearableBtn->getVisible())
+	{
+		mEditWearableBtn->setVisible(TRUE);
+	}
+	//mLookContents->addChild(mRemoveFromLookBtn);
+}
+
+void LLPanelOutfitEdit::changed(U32 mask)
+{
+}
+
+void LLPanelOutfitEdit::lookFetched(void)
+{
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t item_array;
+
+	// collectDescendentsIf takes non-const reference:
+	LLFindCOFValidItems is_cof_valid;
+	gInventory.collectDescendentsIf(mLookID,
+									cat_array,
+									item_array,
+									LLInventoryModel::EXCLUDE_TRASH,
+									is_cof_valid);
+	for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
+		 iter != item_array.end();
+		 iter++)
+	{
+		const LLViewerInventoryItem *item = (*iter);
+		
+		LLSD row;
+		row["id"] = item->getUUID();
+		LLSD& columns = row["columns"];
+		columns[0]["column"] = "look_item";
+		columns[0]["type"] = "text";
+		columns[0]["value"] = item->getName();
+		columns[1]["column"] = "look_item_sort";
+		columns[1]["type"] = "text"; // TODO: multi-wearable sort "type" should go here.
+		columns[1]["value"] = "BAR"; // TODO: Multi-wearable sort index should go here
+		
+		mLookContents->addElement(row);
+	}
+	
+	if (mLookContents->getItemCount() != mNumItemsInLook)
+	{
+		mNumItemsInLook = mLookContents->getItemCount();
+		LLAppearanceManager::instance().updateCOF(mLookID);
+	}
+}
+
+void LLPanelOutfitEdit::updateLookInfo()
+{	
+	if (getVisible())
+	{
+		mLookContents->clearRows();
+		
+		LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+		folders.push_back(mLookID);
+		mFetchLook->fetchDescendents(folders);
+		if (mFetchLook->isEverythingComplete())
+		{
+			mFetchLook->done();
+		}
+		else
+		{
+			gInventory.addObserver(mFetchLook);
+		}
+	}
+}
+
+void LLPanelOutfitEdit::displayLookInfo(const LLInventoryCategory* pLook)
+{
+	if (!pLook)
+	{
+		return;
+	}
+	
+	if (!getVisible())
+	{
+		setVisible(TRUE);
+	}
+
+	if (mLookID != pLook->getUUID())
+	{
+		mLookID = pLook->getUUID();
+		mLookName->setText("Look: " + pLook->getName());
+		updateLookInfo();
+	}
+}
+
+void LLPanelOutfitEdit::reset()
+{
+	mLookID.setNull();
+}
+
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
new file mode 100644
index 0000000000..09ec51c056
--- /dev/null
+++ b/indra/newview/llpaneloutfitedit.h
@@ -0,0 +1,127 @@
+/** 
+ * @file llpaneloutfitedit.h
+ * @brief Displays outfit edit information in Side Tray.
+ *
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
+ * 
+ * Copyright (c) 2004-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLPANELOUTFITEDIT_H
+#define LL_LLPANELOUTFITEDIT_H
+
+#include "llpanel.h"
+
+#include "v3dmath.h"
+#include "lluuid.h"
+
+#include "lliconctrl.h"
+
+#include "llremoteparcelrequest.h"
+#include "llinventory.h"
+#include "llinventorymodel.h"
+
+class LLButton;
+class LLTextBox;
+class LLInventoryCategory;
+class LLInventoryLookObserver;
+class LLInventoryPanel;
+class LLSaveFolderState;
+class LLFolderViewItem;
+class LLScrollListCtrl;
+class LLLookFetchObserver;
+class LLFilterEditor;
+
+class LLPanelOutfitEdit : public LLPanel
+{
+public:
+	
+	// NOTE: initialize mLookItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
+	typedef enum e_look_item_type
+	{
+		LIT_ALL = 0,
+		LIT_WEARABLE, // clothing or shape
+		LIT_ATTACHMENT,
+		NUM_LOOK_ITEM_TYPES
+	} ELookItemType; 
+	
+	struct LLLookItemType {
+		std::string displayName;
+		U64 inventoryMask;
+		LLLookItemType() : displayName("NONE"), inventoryMask(0) {}
+		LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {}
+	};
+	
+	LLPanelOutfitEdit();
+	/*virtual*/ ~LLPanelOutfitEdit();
+
+	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void changed(U32 mask);
+
+	void reset();
+		// Ignore all old information, useful if you are 
+		// recycling an existing dialog and need to clear it.
+
+	/*virtual*/ void setParcelID(const LLUUID& parcel_id);
+		// Sends a request for data about the given parcel, which will
+		// only update the location if there is none already available.
+	
+	void onTypeFilterChanged(LLUICtrl* ctrl);
+	void onSearchEdit(const std::string& string);
+	void onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
+	void onAddToLookClicked(void);
+	void onLookItemSelectionChange(void);
+	void onRemoveFromLookClicked(void);
+	void onEditWearableClicked(void);
+	void onUpClicked(void);
+
+	void displayLookInfo(const LLInventoryCategory* pLook);
+	
+	void lookFetched(void);
+	
+	void updateLookInfo(void);
+
+private:
+
+	LLUUID				mLookID;
+	LLTextBox*			mLookName;
+	LLScrollListCtrl*	mLookContents;
+	LLInventoryPanel*	mInventoryItemsPanel;
+	LLFilterEditor*		mSearchFilter;
+	LLSaveFolderState*	mSavedFolderState;
+	std::string			mSearchString;
+	LLButton*			mAddToLookBtn;
+	LLButton*			mRemoveFromLookBtn;
+	LLButton*			mUpBtn;
+	LLButton*			mEditWearableBtn;
+	S32					mNumItemsInLook;
+	
+	LLLookFetchObserver*		mFetchLook;
+	LLInventoryLookObserver*	mLookObserver;
+	std::vector<LLLookItemType> mLookItemTypes;
+};
+
+#endif // LL_LLPANELOUTFITEDIT_H
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 9a37af4916..90c0cd5467 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -93,7 +93,7 @@ LLSidepanelAppearance::LLSidepanelAppearance() :
 	LLPanel(),
 	mFilterSubString(LLStringUtil::null),
 	mFilterEditor(NULL),
-	mLookInfo(NULL),
+	mOutfitEdit(NULL),
 	mCurrOutfitPanel(NULL)
 {
 }
@@ -129,10 +129,10 @@ BOOL LLSidepanelAppearance::postBuild()
 	mPanelOutfitsInventory = dynamic_cast<LLPanelOutfitsInventory *>(getChild<LLPanel>("panel_outfits_inventory"));
 	mPanelOutfitsInventory->setParent(this);
 
-	mLookInfo = dynamic_cast<LLPanelLookInfo*>(getChild<LLPanel>("panel_look_info"));
-	if (mLookInfo)
+	mOutfitEdit = dynamic_cast<LLPanelOutfitEdit*>(getChild<LLPanel>("panel_outfit_edit"));
+	if (mOutfitEdit)
 	{
-		LLButton* back_btn = mLookInfo->getChild<LLButton>("back_btn");
+		LLButton* back_btn = mOutfitEdit->getChild<LLButton>("back_btn");
 		if (back_btn)
 		{
 			back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onBackButtonClicked, this));
@@ -177,7 +177,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
 	if(key.size() == 0)
 		return;
 
-	toggleLookInfoPanel(TRUE);
+	toggleOutfitEditPanel(TRUE);
 	updateVerbs();
 	
 	mLookInfoType = key["type"].asString();
@@ -186,7 +186,7 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
 	{
 		LLInventoryCategory *pLook = gInventory.getCategory(key["id"].asUUID());
 		if (pLook)
-			mLookInfo->displayLookInfo(pLook);
+			mOutfitEdit->displayLookInfo(pLook);
 	}
 }
 
@@ -241,9 +241,9 @@ void LLSidepanelAppearance::onEditAppearanceButtonClicked()
 
 void LLSidepanelAppearance::onEditButtonClicked()
 {
-	toggleLookInfoPanel(FALSE);
+	toggleOutfitEditPanel(FALSE);
 	toggleWearableEditPanel(TRUE, NULL);
-	/*if (mLookInfo->getVisible())
+	/*if (mOutfitEdit->getVisible())
 	  {
 	  }
 	  else
@@ -254,7 +254,7 @@ void LLSidepanelAppearance::onEditButtonClicked()
 
 void LLSidepanelAppearance::onNewOutfitButtonClicked()
 {
-	if (!mLookInfo->getVisible())
+	if (!mOutfitEdit->getVisible())
 	{
 		mPanelOutfitsInventory->onSave();
 	}
@@ -263,22 +263,22 @@ void LLSidepanelAppearance::onNewOutfitButtonClicked()
 
 void LLSidepanelAppearance::onBackButtonClicked()
 {
-	toggleLookInfoPanel(FALSE);
+	toggleOutfitEditPanel(FALSE);
 }
 
 void LLSidepanelAppearance::onEditWearBackClicked()
 {
 	mEditWearable->saveChanges();
 	toggleWearableEditPanel(FALSE, NULL);
-	toggleLookInfoPanel(TRUE);
+	toggleOutfitEditPanel(TRUE);
 }
 
-void LLSidepanelAppearance::toggleLookInfoPanel(BOOL visible)
+void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible)
 {
-	if (!mLookInfo)
+	if (!mOutfitEdit)
 		return;
 
-	mLookInfo->setVisible(visible);
+	mOutfitEdit->setVisible(visible);
 	if (mPanelOutfitsInventory) mPanelOutfitsInventory->setVisible(!visible);
 	mFilterEditor->setVisible(!visible);
 	mEditBtn->setVisible(!visible);
@@ -305,7 +305,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
 
 void LLSidepanelAppearance::updateVerbs()
 {
-	bool is_look_info_visible = mLookInfo->getVisible();
+	bool is_look_info_visible = mOutfitEdit->getVisible();
 
 	if (mPanelOutfitsInventory && !is_look_info_visible)
 	{
@@ -344,7 +344,7 @@ void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
 void LLSidepanelAppearance::editWearable(LLWearable *wearable, void *data)
 {
 	LLSidepanelAppearance *panel = (LLSidepanelAppearance*) data;
-	panel->toggleLookInfoPanel(FALSE);
+	panel->toggleOutfitEditPanel(FALSE);
 	panel->toggleWearableEditPanel(TRUE, wearable);
 }
 
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index aa2e67fd16..1d78e92a84 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -36,7 +36,7 @@
 #include "llinventoryobserver.h"
 
 #include "llinventory.h"
-#include "llpanellookinfo.h"
+#include "llpaneloutfitedit.h"
 
 class LLFilterEditor;
 class LLCurrentlyWornFetchObserver;
@@ -71,12 +71,12 @@ private:
 	void onEditButtonClicked();
 	void onBackButtonClicked();
 	void onEditWearBackClicked();
-	void toggleLookInfoPanel(BOOL visible);
+	void toggleOutfitEditPanel(BOOL visible);
 	void toggleWearableEditPanel(BOOL visible, LLWearable* wearable);
 
 	LLFilterEditor*			mFilterEditor;
 	LLPanelOutfitsInventory* mPanelOutfitsInventory;
-	LLPanelLookInfo*		mLookInfo;
+	LLPanelOutfitEdit*		mOutfitEdit;
 	LLPanelEditWearable*	mEditWearable;
 
 	LLButton*					mOpenOutfitBtn;
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
new file mode 100644
index 0000000000..d4924562fb
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+  background_visible="true"
+  border="false"
+	height="570"
+	follows="all"
+	label="Look Info"
+	layout="topleft"
+	name="look_info"
+	width="320">
+	<panel.string
+		name="not_available">
+		(N\A)
+	</panel.string>
+	<panel.string
+		name="unknown">
+		(unknown)
+	</panel.string>
+	<panel
+		background_visible="true"
+		bevel_style="none"
+		follows="left|top|right|bottom"
+		height="530"
+		label="Outfit"
+		layout="topleft"
+		name="look_management_panel"
+		width="320">
+        <panel
+          follows="left|right|top"
+            header_visible="false"
+            layout="topleft"
+            min_height="300"
+            name="look_group"
+            title="Outfit Group"
+          top="0">
+            <panel
+                follows="left|right|top"
+                height="210"
+                layout="topleft"
+                top_pad="0"
+                name="look_info_group_bar"
+                width="295">
+                <text
+                    type="string"
+                    length="1"
+                    follows="left|top"
+                    height="20"
+                    layout="topleft"
+                    mouse_opaque="false"
+                    name="curr_look_name"
+                    width="175">
+                    Look: [LOOK]
+                </text>
+                <button
+                    follows="left|top"
+                    height="20"
+                    label="Wear"
+                    layout="topleft"
+                    name="wear_look_btn"
+                    left_pad="5"
+                    top_pad="-24"
+                    width="65" />
+                <button
+                    follows="left|top"
+                    height="20"
+                    layout="topleft"
+                    left_pad="5"
+                    name="back_btn"
+                    width="20" />
+            </panel>
+        </panel>
+
+        <panel
+            follows="left|right|top"
+          height="200"
+          layout="topleft"
+          name="outfit_display"
+          top_pad="10"
+          width="320">
+          
+              <scroll_list
+                  width="285"
+                  column_padding="0"
+                  draw_heading="false"
+                  draw_stripes="false"
+                  follows="left|top|bottom|right"
+                  layout="topleft"
+                  name="look_items_list"
+                  search_column="1"
+                  sort_column="2"
+                  left="0"
+                  height="200"
+                  top_pad="0">
+                  <scroll_list.columns
+                      label="Look Item"
+                      name="look_item"
+                      width="285" />
+                  <scroll_list.columns
+                      label="Outfit Item Sort"
+                      width="0"
+                      sort_column="look_item_sort"
+                      name="look_item_sort" />
+              </scroll_list>
+              <button
+                  follows="left|top|right"
+                  height="20"
+                  label="-"
+                  left_pad="0"
+                  layout="topleft"
+                  name="edit_wearable_btn"
+                  width="20" />
+        </panel>
+        <panel
+          follows="all"
+            header_visible="false"
+            min_height="100"
+          left="0"
+            name="inventory_group"
+            title="My Inventory"
+          top_pad="10"
+          width="230">
+            <panel
+                follows="left|right|top"
+                height="270"
+                name="lower_look_accordion"
+                width="295">
+                <panel
+                    follows="left|right|top"
+                    height="20"
+                    layout="topleft"
+                    name="inventory_bar"
+                    width="295">
+                    <text
+                        type="string"
+                        length="1"
+                        follows="left|top"
+                        height="20"
+                        layout="topleft"
+                        mouse_opaque="false"
+                        name="inventory_info_text"
+                        width="100">
+                        My Inventory
+                    </text>
+                    <combo_box
+                        follows="left"
+                        height="20"
+                        layout="topleft"
+                        left_pad="0"
+                        top_pad="-24"
+                        name="inventory_filter"
+                        tool_tip="Only show the selected inventory types"
+                        width="185" />
+                </panel>
+                <panel
+                    follows="left|right|top"
+                    height="20"
+                    layout="topleft"
+                    name="look_item_filter_bar"
+                    width="295">
+                    <filter_editor
+                        background_image="TextField_Search_Off"
+                        follows="left|top|right"
+                        font="SansSerif"
+                        label="Outfit Item Filter"
+                        layout="topleft"
+                        left="0"
+                        top_pad="0"
+                        width="270"
+                        height="20"
+                        name="look_item_filter"
+                        text_color="black"
+                        text_pad_left="25" />
+                </panel>
+                <panel
+                    follows="all"
+                    height="230"
+                    layout="topleft"
+                    name="inventory_panel"
+                    width="285">
+                    <inventory_panel
+                        allow_multi_select="true"
+                        border="true"
+                        follows="left|top|right|bottom"
+                        height="230"
+                        mouse_opaque="false"
+                        name="inventory_items"
+                        width="285"/>
+                </panel>
+            </panel>
+        </panel>
+	</panel>
+	<panel
+		follows="left|right|bottom"
+		height="30"
+		layout="topleft"
+		left="5"
+		top_pad="0"
+		name="button_bar"
+		width="295">
+		<button
+			follows="top|left|right"
+			height="25"
+			label="Add"
+			left="0"
+			layout="topleft"
+			name="add_item_btn"
+			width="90" />
+		<button
+			follows="left|right"
+			height="25"
+			left_pad="0"
+			label="Remove"
+			layout="topleft"
+			name="remove_item_btn"
+			width="90" />
+		<button
+			follows="top|left|right"
+			height="25"
+			label="UP"
+			left_pad="0"
+			layout="topleft"
+			name="up_btn"
+			width="55" />
+		<button
+			follows="left|top|right"
+			height="25"
+			label="DOWN"
+			left_pad="0"
+			layout="topleft"
+			name="down_btn"
+			width="60" />
+	</panel>
+</panel>
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index b3d55fec65..735635f1a0 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -102,12 +102,12 @@ width="333">
 		name="newlook_btn"
 		 width="100" />-->
    <panel
-   class="panel_look_info"
-   filename="panel_look_info.xml"
+   class="panel_outfit_edit"
+   filename="panel_outfit_edit.xml"
    follows="all"
    layout="topleft"
    left="0"
-   name="panel_look_info"
+   name="panel_outfit_edit"
    top="35"
    visible="false" />
    <panel
-- 
cgit v1.2.3


From fc0906d6e8c1238fe7fd21c185957ca89511e76e Mon Sep 17 00:00:00 2001
From: Aimee Linden <aimee@lindenlab.com>
Date: Mon, 29 Mar 2010 14:39:17 +0100
Subject: EXT-6031 Refactoring of voice volume representation

Standardizes representation of volume as [0.0 - 1.0] logarithmic with 0db at 0.5 within LLVoiceClient
Reviewed by Tofu.
---
 indra/newview/llvoiceclient.cpp | 258 ++++++++++++++++++++++++----------------
 indra/newview/llvoiceclient.h   |  11 +-
 2 files changed, 164 insertions(+), 105 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index cc346c2345..3bfb898a1e 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -87,6 +87,12 @@
 static bool sConnectingToAgni = false;
 F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
 
+const F32 LLVoiceClient::VOLUME_MIN = 0.f;
+const F32 LLVoiceClient::VOLUME_DEFAULT = 0.5f;
+const F32 LLVoiceClient::VOLUME_MAX = 1.0f;
+
+const F32 VOLUME_SCALE_VIVOX = 0.01f;
+
 const F32 SPEAKING_TIMEOUT = 1.f;
 
 const int VOICE_MAJOR_VERSION = 1;
@@ -1112,24 +1118,28 @@ class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
 public:
 
 	/**
-	 * Sets internal voluem level for specified user.
+	 * Stores volume level for specified user.
 	 *
-	 * @param[in] speaker_id - LLUUID of user to store volume level for
-	 * @param[in] volume - external (vivox) volume level to be stored for user.
+	 * @param[in] speaker_id - LLUUID of user to store volume level for.
+	 * @param[in] volume - volume level to be stored for user.
 	 */
 	void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
 
 	/**
-	 * Gets stored external (vivox) volume level for specified speaker and
-	 * transforms it into internal (viewer) level.
+	 * Gets stored volume level for specified speaker
 	 *
-	 * If specified user is not found -1 will be returned.
-	 * Internal level is calculated as: internal = 400 * external^2
-	 * Maps 0.0 to 1.0 to internal values 0-400
+	 * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
+	 * @param[out] volume - set to stored volume if found, otherwise unmodified.
+	 * @return - true if a stored volume is found.
+	 */
+	bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
+
+	/**
+	 * Removes stored volume level for specified user.
 	 *
-	 * @param[in] speaker_id - LLUUID of user to get his volume level
+	 * @param[in] speaker_id - LLUUID of user to remove.
 	 */
-	S32 getSpeakerVolume(const LLUUID& speaker_id);
+	void removeSpeakerVolume(const LLUUID& speaker_id);
 
 private:
 	friend class LLSingleton<LLSpeakerVolumeStorage>;
@@ -1141,6 +1151,9 @@ private:
 	void load();
 	void save();
 
+	static F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in);
+	static F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in);
+
 	typedef std::map<LLUUID, F32> speaker_data_map_t;
 	speaker_data_map_t mSpeakersData;
 };
@@ -1159,23 +1172,85 @@ LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
 
 void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
 {
-	mSpeakersData[speaker_id] = volume;
+	if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
+	{
+		mSpeakersData[speaker_id] = volume;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Stored volume = " << volume <<  " for " << id << LL_ENDL;
+	}
+	else
+	{
+		LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
+		llassert(0);
+	}
 }
 
-S32 LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id)
+bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
 {
-	// Return value of -1 indicates no level is stored for this speaker
-	S32 ret_val = -1;
 	speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
 	
 	if (it != mSpeakersData.end())
 	{
-		F32 f_val = it->second;
-		// volume can amplify by as much as 4x!
-		S32 ivol = (S32)(400.f * f_val * f_val);
-		ret_val = llclamp(ivol, 0, 400);
+		volume = it->second;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume <<  " for " << id << LL_ENDL;
+
+		return true;
+	}
+
+	return false;
+}
+
+void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
+{
+	mSpeakersData.erase(speaker_id);
+
+	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+	// LL_DEBUGS("Voice") << "Removing stored volume for  " << id << LL_ENDL;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
+{
+	// Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// from legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.5, volume_out = 0.56
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.5f)
+	{
+		volume_out = volume_in * volume_in * 4.f * 0.56f;
+	}
+	else
+	{
+		volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
+	}
+
+	return volume_out;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
+{
+	// Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// to legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.56, volume_out = 0.5
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.56f)
+	{
+		volume_out = sqrt(volume_in / (4.f * 0.56f));
+	}
+	else
+	{
+		volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
 	}
-	return ret_val;
+
+	return volume_out;
 }
 
 void LLSpeakerVolumeStorage::load()
@@ -1183,6 +1258,8 @@ void LLSpeakerVolumeStorage::load()
 	// load per-resident voice volume information
 	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
 
+	LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
+
 	LLSD settings_llsd;
 	llifstream file;
 	file.open(filename);
@@ -1194,7 +1271,10 @@ void LLSpeakerVolumeStorage::load()
 	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
 		iter != settings_llsd.endMap(); ++iter)
 	{
-		mSpeakersData.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal()));
+		// Maintain compatibility with 1.23 non-linear saved volume levels
+		F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
+
+		storeSpeakerVolume(LLUUID(iter->first), volume);
 	}
 }
 
@@ -1209,9 +1289,14 @@ void LLSpeakerVolumeStorage::save()
 		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
 		LLSD settings_llsd;
 
+		LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
+
 		for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
 		{
-			settings_llsd[iter->first.asString()] = iter->second;
+			// Maintain compatibility with 1.23 non-linear saved volume levels
+			F32 volume = transformToLegacyVolume(iter->second);
+
+			settings_llsd[iter->first.asString()] = volume;
 		}
 
 		llofstream file;
@@ -2420,9 +2505,10 @@ void LLVoiceClient::stateMachine()
 					enforceTether();
 				}
 				
-				// Send an update if the ptt state has changed (which shouldn't be able to happen that often -- the user can only click so fast)
-				// or every 10hz, whichever is sooner.
-				if((mAudioSession && mAudioSession->mVolumeDirty) || mPTTDirty || mSpeakerVolumeDirty || mUpdateTimer.hasExpired())
+				// Send an update only if the ptt or mute state has changed (which shouldn't be able to happen that often
+				// -- the user can only click so fast) or every 10hz, whichever is sooner.
+				// Sending for every volume update causes an excessive flood of messages whenever a volume slider is dragged.
+				if((mAudioSession && mAudioSession->mMuteDirty) || mPTTDirty || mUpdateTimer.hasExpired())
 				{
 					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
 					sendPositionalUpdate();
@@ -3417,38 +3503,26 @@ void LLVoiceClient::sendPositionalUpdate(void)
 		stream << "</Request>\n\n\n";
 	}	
 	
-	if(mAudioSession && mAudioSession->mVolumeDirty)
+	if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
 	{
 		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
 
 		mAudioSession->mVolumeDirty = false;
+		mAudioSession->mMuteDirty = false;
 		
 		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
 		{
 			participantState *p = iter->second;
-			
+
 			if(p->mVolumeDirty)
 			{
 				// Can't set volume/mute for yourself
 				if(!p->mIsSelf)
 				{
-					int volume = 56; // nominal default value
+					// scale from the range 0.0-1.0 to vivox volume in the range 0-100
+					S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
+
 					bool mute = p->mOnMuteList;
-					
-					if(p->mUserVolume != -1)
-					{
-						// scale from user volume in the range 0-400 (with 100 as "normal") to vivox volume in the range 0-100 (with 56 as "normal")
-						if(p->mUserVolume < 100)
-							volume = (p->mUserVolume * 56) / 100;
-						else
-							volume = (((p->mUserVolume - 100) * (100 - 56)) / 300) + 56;
-					}
-					else if(p->mVolume != -1)
-					{
-						// Use the previously reported internal volume (comes in with a ParticipantUpdatedEvent)
-						volume = p->mVolume;
-					}
-										
 
 					if(mute)
 					{
@@ -3456,10 +3530,16 @@ void LLVoiceClient::sendPositionalUpdate(void)
 						// If we want the user to be muted, set their volume to 0 as well.
 						// This isn't perfect, but it will at least reduce their volume to a minimum.
 						volume = 0;
+
+						// Mark the current volume level as set to prevent incoming events
+						// changing it to 0, so that we can return to it when unmuting.
+						p->mVolumeSet = true;
 					}
-					
+
 					if(volume == 0)
+					{
 						mute = true;
+					}
 
 					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
 					
@@ -4600,16 +4680,13 @@ void LLVoiceClient::participantUpdatedEvent(
 				participant->mPower = 0.0f;
 			}
 
-			// *HACK: Minimal hack to fix EXT-6508, ignore the incoming volume if it is zero.
-			// This happens because we send volume zero to Vivox when someone is muted,
-			// Vivox then send it back to us, overwriting the previous volume.
-			// Remove this hack once volume refactoring from EXT-6031 is applied.
-			if (volume != 0)
+			// Ignore incoming volume level if it has been explicitly set, or there
+			//  is a volume or mute change pending.
+			if ( !participant->mVolumeSet && !participant->mVolumeDirty)
 			{
-				participant->mVolume = volume;
+				participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
 			}
 
-			
 			// *HACK: mantipov: added while working on EXT-3544
 			/*
 			Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE 
@@ -4993,7 +5070,7 @@ void LLVoiceClient::muteListChanged()
 			
 			// Check to see if this participant is on the mute list already
 			if(p->updateMuteState())
-				mAudioSession->mVolumeDirty = true;
+				mAudioSession->mMuteDirty = true;
 		}
 	}
 }
@@ -5016,10 +5093,10 @@ LLVoiceClient::participantState::participantState(const std::string &uri) :
 	 mIsModeratorMuted(false), 
 	 mLastSpokeTimestamp(0.f), 
 	 mPower(0.f), 
-	 mVolume(-1), 
-	 mOnMuteList(false), 
-	 mUserVolume(-1), 
-	 mVolumeDirty(false), 
+	 mVolume(VOLUME_DEFAULT),
+	 mOnMuteList(false),
+	 mVolumeSet(false),
+	 mVolumeDirty(false),
 	 mAvatarIDValid(false),
 	 mIsSelf(false)
 {
@@ -5068,7 +5145,7 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con
 				result->mAvatarID = id;
 
 				if(result->updateMuteState())
-					mVolumeDirty = true;
+					mMuteDirty = true;
 			}
 			else
 			{
@@ -5080,8 +5157,7 @@ LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(con
 		
 		mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result));
 
-		result->mUserVolume = LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID);
-		if (result->mUserVolume != -1)
+		if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
 		{
 			result->mVolumeDirty = true;
 			mVolumeDirty = true;
@@ -6281,51 +6357,21 @@ BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
 	return result;
 }
 
-// External accessiors. Maps 0.0 to 1.0 to internal values 0-400 with .5 == 100
-// internal = 400 * external^2
+// External accessors.
 F32 LLVoiceClient::getUserVolume(const LLUUID& id)
 {
-	F32 result = 0.0f;
+	// Minimum volume will be returned for users with voice disabled
+	F32 result = VOLUME_MIN;
 	
 	participantState *participant = findParticipantByID(id);
 	if(participant)
 	{
-		S32 ires = 100; // nominal default volume
-		
-		if(participant->mIsSelf)
-		{
-			// Always make it look like the user's own volume is set at the default.
-		}
-		else if(participant->mUserVolume != -1)
-		{
-			// Use the internal volume
-			ires = participant->mUserVolume;
-			
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mUserVolume " << ires << LL_ENDL;
-		}
-		else if(participant->mVolume != -1)
-		{
-			// Map backwards from vivox volume 
-
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mVolume " << participant->mVolume << LL_ENDL;
+		result = participant->mVolume;
 
-			if(participant->mVolume < 56)
-			{
-				ires = (participant->mVolume * 100) / 56;
-			}
-			else
-			{
-				ires = (((participant->mVolume - 56) * 300) / (100 - 56)) + 100;
-			}
-		}
-		result = sqrtf(((F32)ires) / 400.f);
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "mVolume = " << result <<  " for " << id << LL_ENDL;
 	}
 
-	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//	LL_DEBUGS("Voice") << "returning " << result << LL_ENDL;
-
 	return result;
 }
 
@@ -6334,16 +6380,23 @@ void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
 	if(mAudioSession)
 	{
 		participantState *participant = findParticipantByID(id);
-		if (participant)
+		if (participant && !participant->mIsSelf)
 		{
-			// store this volume setting for future sessions
-			LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+			if (!is_approx_equal(volume, VOLUME_DEFAULT))
+			{
+				// Store this volume setting for future sessions if it has been
+				// changed from the default
+				LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+			}
+			else
+			{
+				// Remove stored volume setting if it is returned to the default
+				LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
+			}
 
-			// volume can amplify by as much as 4x!
-			S32 ivol = (S32)(400.f * volume * volume);
-			participant->mUserVolume = llclamp(ivol, 0, 400);
-			participant->mVolumeDirty = TRUE;
-			mAudioSession->mVolumeDirty = TRUE;
+			participant->mVolume = llclamp(volume, VOLUME_MIN, VOLUME_MAX);
+			participant->mVolumeDirty = true;
+			mAudioSession->mVolumeDirty = true;
 		}
 	}
 }
@@ -6484,6 +6537,7 @@ LLVoiceClient::sessionState::sessionState() :
 	mVoiceEnabled(false),
 	mReconnect(false),
 	mVolumeDirty(false),
+	mMuteDirty(false),
 	mParticipantsChanged(false)
 {
 }
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index aaacab69e0..a29c386182 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -101,6 +101,10 @@ class LLVoiceClient: public LLSingleton<LLVoiceClient>
 		
 		static F32 OVERDRIVEN_POWER_LEVEL;
 
+		static const F32 VOLUME_MIN;
+		static const F32 VOLUME_DEFAULT;
+		static const F32 VOLUME_MAX;
+
 		void updateSettings(); // call after loading settings and whenever they change
 	
 		void getCaptureDevicesSendMessage();
@@ -269,7 +273,7 @@ static	void updatePosition(void);
 		public:
 			participantState(const std::string &uri);
 
-			bool updateMuteState();
+			bool updateMuteState();	// true if mute state has changed
 			bool isAvatar();
 
 			std::string mURI;
@@ -279,13 +283,13 @@ static	void updatePosition(void);
 			LLFrameTimer mSpeakingTimeout;
 			F32	mLastSpokeTimestamp;
 			F32 mPower;
-			int mVolume;
+			F32 mVolume;
 			std::string mGroupID;
-			int mUserVolume;
 			bool mPTT;
 			bool mIsSpeaking;
 			bool mIsModeratorMuted;
 			bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
+			bool mVolumeSet;		// true if incoming volume messages should not change the volume
 			bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
 			bool mAvatarIDValid;
 			bool mIsSelf;
@@ -349,6 +353,7 @@ static	void updatePosition(void);
 			// Set to true when the mute state of someone in the participant list changes.
 			// The code will have to walk the list to find the changed participant(s).
 			bool		mVolumeDirty;
+			bool		mMuteDirty;
 
 			bool		mParticipantsChanged;
 			participantMap mParticipantsByURI;
-- 
cgit v1.2.3


From 4ff53b90660477f54ba3c8ca9a9718fe0d16a1dd Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 29 Mar 2010 11:02:39 -0400
Subject: For EXT-4666: changed LLAppearanceManager to LLAppearanceMgr
 throughout

---
 indra/newview/llagentwearables.cpp        |  30 ++++----
 indra/newview/llappearancemgr.cpp         | 116 +++++++++++++++---------------
 indra/newview/llappearancemgr.h           |   8 +--
 indra/newview/llfloatergesture.cpp        |   2 +-
 indra/newview/llgesturemgr.cpp            |   2 +-
 indra/newview/llinventorybridge.cpp       |  28 ++++----
 indra/newview/llinventorypanel.cpp        |   2 +-
 indra/newview/llpaneloutfitsinventory.cpp |   2 +-
 indra/newview/llsidepanelappearance.cpp   |   6 +-
 indra/newview/llstartup.cpp               |  10 +--
 indra/newview/lltooldraganddrop.cpp       |   4 +-
 indra/newview/llviewerinventory.cpp       |   2 +-
 indra/newview/llviewermenu.cpp            |   4 +-
 indra/newview/llvoavatar.cpp              |   2 +-
 indra/newview/llvoavatarself.cpp          |   4 +-
 15 files changed, 111 insertions(+), 111 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index a22e872517..a4ff4be56a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -289,7 +289,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
 	}
 	if (mTodo & CALL_RECOVERDONE)
 	{
-		LLAppearanceManager::instance().addCOFItemLink(inv_item,false);
+		LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
 		gAgentWearables.recoverMissingWearableDone();
 	}
 	/*
@@ -297,7 +297,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
 	 */
 	if (mTodo & CALL_CREATESTANDARDDONE)
 	{
-		LLAppearanceManager::instance().addCOFItemLink(inv_item,false);
+		LLAppearanceMgr::instance().addCOFItemLink(inv_item,false);
 		gAgentWearables.createStandardWearablesDone(mType, mIndex);
 	}
 	if (mTodo & CALL_MAKENEWOUTFITDONE)
@@ -306,7 +306,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i
 	}
 	if (mTodo & CALL_WEARITEM)
 	{
-		LLAppearanceManager::instance().addCOFItemLink(inv_item, true);
+		LLAppearanceMgr::instance().addCOFItemLink(inv_item, true);
 	}
 }
 
@@ -1119,7 +1119,7 @@ public:
 	{
 		llinfos << "All items created" << llendl;
 		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
-		LLAppearanceManager::instance().linkAll(LLAppearanceManager::instance().getCOF(),
+		LLAppearanceMgr::instance().linkAll(LLAppearanceMgr::instance().getCOF(),
 												mItemsToLink,
 												link_waiter);
 	}
@@ -1438,8 +1438,8 @@ public:
 			tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren());
 		}
 
-		LLAppearanceManager::instance().updateIsDirty();
-		LLAppearanceManager::instance().updatePanelOutfitName("");
+		LLAppearanceMgr::instance().updateIsDirty();
+		LLAppearanceMgr::instance().updatePanelOutfitName("");
 	}
 	
 	virtual void fire(const LLUUID&)
@@ -1466,8 +1466,8 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
 		new_folder_name);
 
 	LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id);
-	LLAppearanceManager::instance().shallowCopyCategoryContents(LLAppearanceManager::instance().getCOF(),folder_id, cb);
-	LLAppearanceManager::instance().createBaseOutfitLink(folder_id, cb);
+	LLAppearanceMgr::instance().shallowCopyCategoryContents(LLAppearanceMgr::instance().getCOF(),folder_id, cb);
+	LLAppearanceMgr::instance().createBaseOutfitLink(folder_id, cb);
 
 	return folder_id;
 }
@@ -2421,7 +2421,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 			continue;
 		}
 		
-		if (!LLAppearanceManager::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
+		if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
 		{
 			llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl;
 			continue;
@@ -2443,7 +2443,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 		LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID,
 															LLFolderType::FT_NONE,
 															cat->getName());
-		LLAppearanceManager::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
+		LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
 	}
 }
 
@@ -2565,15 +2565,15 @@ void LLInitialWearablesFetch::processContents()
 	gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, 
 									LLInventoryModel::EXCLUDE_TRASH, is_wearable);
 
-	LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
+	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
 	if (wearable_array.count() > 0)
 	{
-		LLAppearanceManager::instance().updateAppearanceFromCOF();
+		LLAppearanceMgr::instance().updateAppearanceFromCOF();
 	}
 	else
 	{
 		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
-		LLAppearanceManager::instance().setOutfitDirty(true);
+		LLAppearanceMgr::instance().setOutfitDirty(true);
 		processWearablesMessage();
 	}
 	delete this;
@@ -2610,7 +2610,7 @@ public:
 
 			link_inventory_item(gAgent.getID(),
 								item->getLinkedUUID(),
-								LLAppearanceManager::instance().getCOF(),
+								LLAppearanceMgr::instance().getCOF(),
 								item->getName(),
 								LLAssetType::AT_LINK,
 								link_waiter);
@@ -2624,7 +2624,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 {
 	if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
 	{
-		const LLUUID current_outfit_id = LLAppearanceManager::instance().getCOF();
+		const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
 		LLInventoryFetchObserver::item_ref_t ids;
 		for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
 		{
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index c15f1efb9b..0f8e48c5f0 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -119,7 +119,7 @@ protected:
 		// If the inventory callback manager goes away, we're shutting down, no longer want the callback.
 		if( LLInventoryCallbackManager::is_instantiated() )
 		{
-			LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend);
+			LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend);
 		}
 		else
 		{
@@ -228,7 +228,7 @@ void LLOutfitObserver::doWearCategory()
 	else
 	{
 		// Wear the inventory category.
-		LLAppearanceManager::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend);
+		LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend);
 	}
 	delete this;
 }
@@ -312,7 +312,7 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
 	
 	if (!LLApp::isExiting())
 	{
-		LLAppearanceManager::instance().updateAppearanceFromCOF();
+		LLAppearanceMgr::instance().updateAppearanceFromCOF();
 	}
 }
 
@@ -456,7 +456,7 @@ void LLWearableHoldingPattern::onAllComplete()
 		// Update the inventory item labels to reflect the fact
 		// they are active.
 		LLViewerInventoryCategory* catp =
-			gInventory.getCategory(LLAppearanceManager::instance().getCOF());
+			gInventory.getCategory(LLAppearanceMgr::instance().getCOF());
 		
 		if (catp)
 		{
@@ -467,7 +467,7 @@ void LLWearableHoldingPattern::onAllComplete()
 
 	// Update wearables.
 	llinfos << "Updating agent wearables with " << mResolved << " wearable items " << llendl;
-	LLAppearanceManager::instance().updateAgentWearables(this, false);
+	LLAppearanceMgr::instance().updateAgentWearables(this, false);
 	
 	// Update attachments to match those requested.
 	LLVOAvatar* avatar = gAgent.getAvatarObject();
@@ -582,7 +582,7 @@ public:
 		{
 			link_inventory_item( gAgent.getID(),
 					     item_id,
-					     LLAppearanceManager::instance().getCOF(),
+					     LLAppearanceMgr::instance().getCOF(),
 					     itemp->getName(),
 					     LLAssetType::AT_LINK,
 					     cb);
@@ -633,7 +633,7 @@ void LLWearableHoldingPattern::clearCOFLinksForMissingWearables()
 		{
 			// Wearable link that was never resolved; remove links to it from COF
 			llinfos << "removing link for unresolved item " << data.mItemID.asString() << llendl;
-			LLAppearanceManager::instance().removeCOFItemLinks(data.mItemID,false);
+			LLAppearanceMgr::instance().removeCOFItemLinks(data.mItemID,false);
 		}
 	}
 }
@@ -730,13 +730,13 @@ static void removeDuplicateItems(LLInventoryModel::item_array_t& items)
 	items = new_items;
 }
 
-const LLUUID LLAppearanceManager::getCOF() const
+const LLUUID LLAppearanceMgr::getCOF() const
 {
 	return gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 }
 
 
-const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink()
+const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink()
 {
 	const LLUUID& current_outfit_cat = getCOF();
 	LLInventoryModel::cat_array_t cat_array;
@@ -764,7 +764,7 @@ const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink()
 	return NULL;
 }
 
-bool LLAppearanceManager::getBaseOutfitName(std::string& name)
+bool LLAppearanceMgr::getBaseOutfitName(std::string& name)
 {
 	const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
 	if(outfit_link)
@@ -780,15 +780,15 @@ bool LLAppearanceManager::getBaseOutfitName(std::string& name)
 }
 
 // Update appearance from outfit folder.
-void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append)
+void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool append)
 {
 	if (!proceed)
 		return;
-	LLAppearanceManager::instance().updateCOF(category,append);
+	LLAppearanceMgr::instance().updateCOF(category,append);
 }
 
 // Create a copy of src_id + contents as a subfolder of dst_id.
-void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
+void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
 											  LLPointer<LLInventoryCallback> cb)
 {
 	LLInventoryCategory *src_cat = gInventory.getCategory(src_id);
@@ -811,7 +811,7 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
 }
 
 // Copy contents of src_id to dst_id.
-void LLAppearanceManager::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
+void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LLUUID& dst_id,
 													  LLPointer<LLInventoryCallback> cb)
 {
 	LLInventoryModel::cat_array_t* cats;
@@ -867,7 +867,7 @@ void LLAppearanceManager::shallowCopyCategoryContents(const LLUUID& src_id, cons
 	}
 }
 
-BOOL LLAppearanceManager::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
+BOOL LLAppearanceMgr::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
 {
 	// These are the wearable items that are required for considering this
 	// folder as containing a complete outfit.
@@ -899,7 +899,7 @@ BOOL LLAppearanceManager::getCanMakeFolderIntoOutfit(const LLUUID& folder_id)
 }
 
 
-void LLAppearanceManager::purgeBaseOutfitLink(const LLUUID& category)
+void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category)
 {
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
@@ -921,7 +921,7 @@ void LLAppearanceManager::purgeBaseOutfitLink(const LLUUID& category)
 	}
 }
 
-void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links)
+void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links)
 {
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
@@ -941,7 +941,7 @@ void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit
 
 // Keep the last N wearables of each type.  For viewer 2.0, N is 1 for
 // both body parts and clothing items.
-void LLAppearanceManager::filterWearableItems(
+void LLAppearanceMgr::filterWearableItems(
 	LLInventoryModel::item_array_t& items, S32 max_per_type)
 {
 	// Divvy items into arrays by wearable type.
@@ -977,7 +977,7 @@ void LLAppearanceManager::filterWearableItems(
 }
 
 // Create links to all listed items.
-void LLAppearanceManager::linkAll(const LLUUID& category,
+void LLAppearanceMgr::linkAll(const LLUUID& category,
 								  LLInventoryModel::item_array_t& items,
 								  LLPointer<LLInventoryCallback> cb)
 {
@@ -993,7 +993,7 @@ void LLAppearanceManager::linkAll(const LLUUID& category,
 	}
 }
 
-void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
+void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 {
 	LLViewerInventoryCategory *pcat = gInventory.getCategory(category);
 	llinfos << "starting, cat " << (pcat ? pcat->getName() : "[UNKNOWN]") << llendl;
@@ -1071,7 +1071,7 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 	llinfos << "waiting for LLUpdateAppearanceOnDestroy" << llendl;
 }
 
-void LLAppearanceManager::updatePanelOutfitName(const std::string& name)
+void LLAppearanceMgr::updatePanelOutfitName(const std::string& name)
 {
 	LLSidepanelAppearance* panel_appearance =
 		dynamic_cast<LLSidepanelAppearance *>(LLSideTray::getInstance()->getPanel("sidepanel_appearance"));
@@ -1081,7 +1081,7 @@ void LLAppearanceManager::updatePanelOutfitName(const std::string& name)
 	}
 }
 
-void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter)
+void LLAppearanceMgr::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter)
 {
 	const LLUUID cof = getCOF();
 	LLViewerInventoryCategory* catp = gInventory.getCategory(category);
@@ -1099,7 +1099,7 @@ void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer
 	updatePanelOutfitName(new_outfit_name);
 }
 
-void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
+void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
 {
 	lldebugs << "updateAgentWearables()" << llendl;
 	LLInventoryItem::item_array_t items;
@@ -1152,7 +1152,7 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items)
 	items = pruned_items;
 }
 
-void LLAppearanceManager::updateAppearanceFromCOF()
+void LLAppearanceMgr::updateAppearanceFromCOF()
 {
 	// update dirty flag to see if the state of the COF matches
 	// the saved outfit stored as a folder link
@@ -1166,7 +1166,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 	LLUUID current_outfit_id = getCOF();
 
 	// Find all the wearables that are in the COF's subtree.
-	lldebugs << "LLAppearanceManager::updateFromCOF()" << llendl;
+	lldebugs << "LLAppearanceMgr::updateFromCOF()" << llendl;
 	LLInventoryModel::item_array_t wear_items;
 	LLInventoryModel::item_array_t obj_items;
 	LLInventoryModel::item_array_t gest_items;
@@ -1253,7 +1253,7 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 	}
 }
 
-void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category,
+void LLAppearanceMgr::getDescendentsOfAssetType(const LLUUID& category,
 													LLInventoryModel::item_array_t& items,
 													LLAssetType::EType type,
 													bool follow_folder_links)
@@ -1268,7 +1268,7 @@ void LLAppearanceManager::getDescendentsOfAssetType(const LLUUID& category,
 									follow_folder_links);
 }
 
-void LLAppearanceManager::getUserDescendents(const LLUUID& category, 
+void LLAppearanceMgr::getUserDescendents(const LLUUID& category, 
 											 LLInventoryModel::item_array_t& wear_items,
 											 LLInventoryModel::item_array_t& obj_items,
 											 LLInventoryModel::item_array_t& gest_items,
@@ -1303,7 +1303,7 @@ void LLAppearanceManager::getUserDescendents(const LLUUID& category,
 									follow_folder_links);
 }
 
-void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append)
+void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append)
 {
 	if(!category) return;
 
@@ -1332,7 +1332,7 @@ void LLAppearanceManager::wearInventoryCategory(LLInventoryCategory* category, b
 }
 
 // *NOTE: hack to get from avatar inventory to avatar
-void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append )
+void LLAppearanceMgr::wearInventoryCategoryOnAvatar( LLInventoryCategory* category, bool append )
 {
 	// Avoid unintentionally overwriting old wearables.  We have to do
 	// this up front to avoid having to deal with the case of multiple
@@ -1344,17 +1344,17 @@ void LLAppearanceManager::wearInventoryCategoryOnAvatar( LLInventoryCategory* ca
 			 	
 	if( gFloaterCustomize )
 	{
-		gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceManager::changeOutfit,
-														&LLAppearanceManager::instance(),
+		gFloaterCustomize->askToSaveIfDirty(boost::bind(&LLAppearanceMgr::changeOutfit,
+														&LLAppearanceMgr::instance(),
 														_1, category->getUUID(), append));
 	}
 	else
 	{
-		LLAppearanceManager::changeOutfit(TRUE, category->getUUID(), append);
+		LLAppearanceMgr::changeOutfit(TRUE, category->getUUID(), append);
 	}
 }
 
-void LLAppearanceManager::wearOutfitByName(const std::string& name)
+void LLAppearanceMgr::wearOutfitByName(const std::string& name)
 {
 	llinfos << "Wearing category " << name << llendl;
 	//inc_busy_count();
@@ -1390,7 +1390,7 @@ void LLAppearanceManager::wearOutfitByName(const std::string& name)
 
 	if(cat)
 	{
-		LLAppearanceManager::wearInventoryCategory(cat, copy_items, false);
+		LLAppearanceMgr::wearInventoryCategory(cat, copy_items, false);
 	}
 	else
 	{
@@ -1426,7 +1426,7 @@ public:
 		if (item)
 		{
 			gInventory.removeObserver(this);
-			LLAppearanceManager::instance().addCOFItemLink(item,mDoUpdate);
+			LLAppearanceMgr::instance().addCOFItemLink(item,mDoUpdate);
 			delete this;
 		}
 	}
@@ -1437,7 +1437,7 @@ private:
 };
 
 
-void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update )
+void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update )
 {
 	const LLInventoryItem *item = gInventory.getItem(item_id);
 	if (!item)
@@ -1451,7 +1451,7 @@ void LLAppearanceManager::addCOFItemLink(const LLUUID &item_id, bool do_update )
 	}
 }
 
-void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_update )
+void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update )
 {		
 	const LLViewerInventoryItem *vitem = dynamic_cast<const LLViewerInventoryItem*>(item);
 	if (!vitem)
@@ -1464,7 +1464,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
 
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(LLAppearanceManager::getCOF(),
+	gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
 								  cat_array,
 								  item_array,
 								  LLInventoryModel::EXCLUDE_TRASH);
@@ -1492,7 +1492,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
 	{
 		if (do_update)
 		{	
-			LLAppearanceManager::updateAppearanceFromCOF();
+			LLAppearanceMgr::updateAppearanceFromCOF();
 		}
 		return;
 	}
@@ -1510,7 +1510,7 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
 }
 
 // BAP remove ensemble code for 2.1?
-void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_update )
+void LLAppearanceMgr::addEnsembleLink( LLInventoryCategory* cat, bool do_update )
 {
 #if SUPPORT_ENSEMBLES
 	// BAP add check for already in COF.
@@ -1524,13 +1524,13 @@ void LLAppearanceManager::addEnsembleLink( LLInventoryCategory* cat, bool do_upd
 #endif
 }
 
-void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_update)
+void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update)
 {
 	gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
 
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(LLAppearanceManager::getCOF(),
+	gInventory.collectDescendents(LLAppearanceMgr::getCOF(),
 								  cat_array,
 								  item_array,
 								  LLInventoryModel::EXCLUDE_TRASH);
@@ -1544,11 +1544,11 @@ void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_upda
 	}
 	if (do_update)
 	{
-		LLAppearanceManager::updateAppearanceFromCOF();
+		LLAppearanceMgr::updateAppearanceFromCOF();
 	}
 }
 
-void LLAppearanceManager::updateIsDirty()
+void LLAppearanceMgr::updateIsDirty()
 {
 	LLUUID cof = getCOF();
 	LLUUID base_outfit;
@@ -1617,7 +1617,7 @@ void LLAppearanceManager::updateIsDirty()
 	}
 }
 
-void LLAppearanceManager::onFirstFullyVisible()
+void LLAppearanceMgr::onFirstFullyVisible()
 {
 	// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
 	// then auto-populate outfits from the library into the My Outfits folder.
@@ -1636,7 +1636,7 @@ void LLAppearanceManager::onFirstFullyVisible()
 
 //#define DUMP_CAT_VERBOSE
 
-void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg)
+void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
 {
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
@@ -1657,7 +1657,7 @@ void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg)
 	llinfos << msg << " count " << items.count() << llendl;
 }
 
-void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& items,
+void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
 										const std::string& msg)
 {
 	llinfos << msg << llendl;
@@ -1669,17 +1669,17 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it
 	llinfos << llendl;
 }
 
-LLAppearanceManager::LLAppearanceManager():
+LLAppearanceMgr::LLAppearanceMgr():
 	mAttachmentInvLinkEnabled(false),
 	mOutfitIsDirty(false)
 {
 }
 
-LLAppearanceManager::~LLAppearanceManager()
+LLAppearanceMgr::~LLAppearanceMgr()
 {
 }
 
-void LLAppearanceManager::setAttachmentInvLinkEnable(bool val)
+void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val)
 {
 	llinfos << "setAttachmentInvLinkEnable => " << (int) val << llendl;
 	mAttachmentInvLinkEnabled = val;
@@ -1702,7 +1702,7 @@ void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
        llinfos << llendl;
 }
 
-void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
+void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
 {
        mRegisteredAttachments.insert(item_id);
 	   gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
@@ -1710,7 +1710,7 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
 
 	   if (mAttachmentInvLinkEnabled)
 	   {
-		   LLAppearanceManager::addCOFItemLink(item_id, false);  // Add COF link for item.
+		   LLAppearanceMgr::addCOFItemLink(item_id, false);  // Add COF link for item.
 	   }
 	   else
 	   {
@@ -1718,7 +1718,7 @@ void LLAppearanceManager::registerAttachment(const LLUUID& item_id)
 	   }
 }
 
-void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
+void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
 {
        mRegisteredAttachments.erase(item_id);
 	   gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
@@ -1727,8 +1727,8 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
 
 	   if (mAttachmentInvLinkEnabled)
 	   {
-		   //LLAppearanceManager::dumpCat(LLAppearanceManager::getCOF(),"Removing attachment link:");
-		   LLAppearanceManager::removeCOFItemLinks(item_id, false);
+		   //LLAppearanceMgr::dumpCat(LLAppearanceMgr::getCOF(),"Removing attachment link:");
+		   LLAppearanceMgr::removeCOFItemLinks(item_id, false);
 	   }
 	   else
 	   {
@@ -1736,7 +1736,7 @@ void LLAppearanceManager::unregisterAttachment(const LLUUID& item_id)
 	   }
 }
 
-void LLAppearanceManager::linkRegisteredAttachments()
+void LLAppearanceMgr::linkRegisteredAttachments()
 {
 	for (std::set<LLUUID>::iterator it = mRegisteredAttachments.begin();
 		 it != mRegisteredAttachments.end();
@@ -1748,12 +1748,12 @@ void LLAppearanceManager::linkRegisteredAttachments()
 	mRegisteredAttachments.clear();
 }
 
-BOOL LLAppearanceManager::getIsInCOF(const LLUUID& obj_id) const
+BOOL LLAppearanceMgr::getIsInCOF(const LLUUID& obj_id) const
 {
 	return gInventory.isObjectDescendentOf(obj_id, getCOF());
 }
 
-BOOL LLAppearanceManager::getIsProtectedCOFItem(const LLUUID& obj_id) const
+BOOL LLAppearanceMgr::getIsProtectedCOFItem(const LLUUID& obj_id) const
 {
 	if (!getIsInCOF(obj_id)) return FALSE;
 
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 9d6cd34ad7..199ca80658 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -43,9 +43,9 @@ class LLWearable;
 class LLWearableHoldingPattern;
 class LLInventoryCallback;
 
-class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
+class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 {
-	friend class LLSingleton<LLAppearanceManager>;
+	friend class LLSingleton<LLAppearanceMgr>;
 	
 public:
 	void updateAppearanceFromCOF();
@@ -120,8 +120,8 @@ public:
 	void onFirstFullyVisible();
 	
 protected:
-	LLAppearanceManager();
-	~LLAppearanceManager();
+	LLAppearanceMgr();
+	~LLAppearanceMgr();
 
 private:
 
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 9c1ac2631d..ff1d68aee1 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -612,7 +612,7 @@ void LLFloaterGesture::addToCurrentOutFit()
 {
 	std::vector<LLUUID> ids;
 	getSelectedIds(ids);
-	LLAppearanceManager* am = LLAppearanceManager::getInstance();
+	LLAppearanceMgr* am = LLAppearanceMgr::getInstance();
 	for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
 	{
 		am->addCOFItemLink(*it);
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 0ba7bdf613..cfbb60fe17 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -338,7 +338,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
 
 	gAgent.sendReliableMessage();
 
-	LLAppearanceManager::instance().removeCOFItemLinks(base_item_id, false);
+	LLAppearanceMgr::instance().removeCOFItemLinks(base_item_id, false);
 
 	notifyObservers();
 }
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 91a9ee03c8..41e15992de 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -193,7 +193,7 @@ BOOL LLInvFVBridge::isItemRemovable() const
 	}
 
 	// Disable delete from COF folder; have users explicitly choose "detach/take off".
-	if (LLAppearanceManager::instance().getIsProtectedCOFItem(mUUID))
+	if (LLAppearanceMgr::instance().getIsProtectedCOFItem(mUUID))
 	{
 		return FALSE;
 	}
@@ -802,7 +802,7 @@ BOOL LLInvFVBridge::isAgentInventory() const
 
 BOOL LLInvFVBridge::isCOFFolder() const
 {
-	return LLAppearanceManager::instance().getIsInCOF(mUUID);
+	return LLAppearanceMgr::instance().getIsInCOF(mUUID);
 }
 
 BOOL LLInvFVBridge::isItemPermissive() const
@@ -1763,7 +1763,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 					{
 						// traverse category and add all contents to currently worn.
 						BOOL append = true;
-						LLAppearanceManager::instance().wearInventoryCategory(inv_cat, false, append);
+						LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, false, append);
 					}
 					else
 					{
@@ -1771,7 +1771,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 						LLInventoryModel::cat_array_t cats;
 						LLInventoryModel::item_array_t items;
 						gInventory.collectDescendents(inv_cat->getUUID(), cats, items, LLInventoryModel::EXCLUDE_TRASH);
-						LLAppearanceManager::instance().linkAll(mUUID,items,NULL);
+						LLAppearanceMgr::instance().linkAll(mUUID,items,NULL);
 					}
 				}
 				else
@@ -1780,7 +1780,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				// BAP - should skip if dup.
 				if (move_is_into_current_outfit)
 				{
-					LLAppearanceManager::instance().addEnsembleLink(inv_cat);
+					LLAppearanceMgr::instance().addEnsembleLink(inv_cat);
 				}
 				else
 				{
@@ -2138,7 +2138,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 				    mContentsCount)
 				{
 					gInventory.removeObserver(this);
-					LLAppearanceManager::instance().wearInventoryCategory(category, FALSE, TRUE);
+					LLAppearanceMgr::instance().wearInventoryCategory(category, FALSE, TRUE);
 					delete this;
 				}
 			}
@@ -2188,7 +2188,7 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
 		if(!model) return;
 		LLViewerInventoryCategory* cat = getCategory();
 		if(!cat) return;
-		LLAppearanceManager::instance().addEnsembleLink(cat,true);
+		LLAppearanceMgr::instance().addEnsembleLink(cat,true);
 		return;
 	}
 #endif
@@ -2723,7 +2723,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 				addDeleteContextMenuOptions(mItems, mDisabledItems);
 				// EXT-4030: disallow deletion of currently worn outfit
-				const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink();
+				const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
 				if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
 				{
 					mDisabledItems.push_back(std::string("Delete"));
@@ -2971,7 +2971,7 @@ void LLFolderBridge::modifyOutfit(BOOL append)
 	LLViewerInventoryCategory* cat = getCategory();
 	if(!cat) return;
 
-	LLAppearanceManager::instance().wearInventoryCategory( cat, FALSE, append );
+	LLAppearanceMgr::instance().wearInventoryCategory( cat, FALSE, append );
 }
 
 // helper stuff
@@ -3049,7 +3049,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
 		const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
-		const BOOL move_is_outof_current_outfit = LLAppearanceManager::instance().getIsInCOF(inv_item->getUUID());
+		const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
 
 		// Can't explicitly drag things out of the COF.
 		if (move_is_outof_current_outfit)
@@ -3136,7 +3136,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 				// BAP - should skip if dup.
 				if (move_is_into_current_outfit)
 				{
-					LLAppearanceManager::instance().addCOFItemLink(inv_item);
+					LLAppearanceMgr::instance().addCOFItemLink(inv_item);
 				}
 				else
 				{
@@ -4410,7 +4410,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item )
 		lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
 				 << " )" << llendl;
 
-		LLAppearanceManager::instance().addCOFItemLink(item);
+		LLAppearanceMgr::instance().addCOFItemLink(item);
 	}
 }
 
@@ -4969,7 +4969,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 	}
 
 	// Find and remove this item from the COF.
-	LLAppearanceManager::instance().removeCOFItemLinks(item_id,false);
+	LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
 	gInventory.notifyObservers();
 
 	delete on_remove_struct;
@@ -4995,7 +4995,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
 			continue;
 
 		// Find and remove this item from the COF.
-		LLAppearanceManager::instance().removeCOFItemLinks(item_id,false);
+		LLAppearanceMgr::instance().removeCOFItemLinks(item_id,false);
 	}
 	gInventory.notifyObservers();
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index d7720b735c..83bca2cd21 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -723,7 +723,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
 {
 	// Don't select objects in COF (e.g. to prevent refocus when items are worn).
 	const LLInventoryObject *obj = gInventory.getObject(obj_id);
-	if (obj && obj->getParentUUID() == LLAppearanceManager::instance().getCOF())
+	if (obj && obj->getParentUUID() == LLAppearanceMgr::instance().getCOF())
 	{
 		return;
 	}
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index c2f2d32142..6bda7d1546 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -271,7 +271,7 @@ void LLPanelOutfitsInventory::onSave()
 {
 	std::string outfit_name;
 
-	if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name))
+	if (!LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
 	{
 		outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
 	}
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 9a37af4916..15b623751f 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -206,7 +206,7 @@ void LLSidepanelAppearance::onFilterEdit(const std::string& search_string)
 
 void LLSidepanelAppearance::onOpenOutfitButtonClicked()
 {
-	const LLViewerInventoryItem *outfit_link = LLAppearanceManager::getInstance()->getBaseOutfitLink();
+	const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink();
 	if (!outfit_link)
 		return;
 	if (!outfit_link->getIsLinkType())
@@ -320,11 +320,11 @@ void LLSidepanelAppearance::updateVerbs()
 
 void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name)
 {
-	mOutfitDirtyTag->setVisible(LLAppearanceManager::getInstance()->isOutfitDirty());
+	mOutfitDirtyTag->setVisible(LLAppearanceMgr::getInstance()->isOutfitDirty());
 	if (name == "")
 	{
 		std::string outfit_name;
-		if (LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name))
+		if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name))
 		{
 				mCurrentLookName->setText(outfit_name);
 				return;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 59d118abe2..766ec9afb8 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2536,7 +2536,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	llinfos << "starting" << llendl;
 
 	// Not going through the processAgentInitialWearables path, so need to set this here.
-	LLAppearanceManager::instance().setAttachmentInvLinkEnable(true);
+	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
 	// Initiate creation of COF, since we're also bypassing that.
 	gInventory.findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 	
@@ -2567,13 +2567,13 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 		bool do_copy = true;
 		bool do_append = false;
 		LLViewerInventoryCategory *cat = gInventory.getCategory(cat_id);
-		LLAppearanceManager::instance().wearInventoryCategory(cat, do_copy, do_append);
+		LLAppearanceMgr::instance().wearInventoryCategory(cat, do_copy, do_append);
 	}
 
 	// Copy gestures
 	LLUUID dst_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
 	LLPointer<LLInventoryCallback> cb(NULL);
-	LLAppearanceManager *app_mgr = &(LLAppearanceManager::instance());
+	LLAppearanceMgr *app_mgr = &(LLAppearanceMgr::instance());
 
 	// - Copy gender-specific gestures.
 	LLUUID gestures_cat_id = findDescendentCategoryIDByName( 
@@ -2582,7 +2582,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	if (gestures_cat_id.notNull())
 	{
 		callAfterCategoryFetch(gestures_cat_id,
-							   boost::bind(&LLAppearanceManager::shallowCopyCategory,
+							   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
 										   app_mgr,
 										   gestures_cat_id,
 										   dst_id,
@@ -2596,7 +2596,7 @@ void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 	if (common_gestures_cat_id.notNull())
 	{
 		callAfterCategoryFetch(common_gestures_cat_id,
-							   boost::bind(&LLAppearanceManager::shallowCopyCategory,
+							   boost::bind(&LLAppearanceMgr::shallowCopyCategory,
 										   app_mgr,
 										   common_gestures_cat_id,
 										   dst_id,
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 813b3bd22f..db6f726a93 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -2427,7 +2427,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
 		if(drop)
 		{
 		    BOOL append = ( (mask & MASK_SHIFT) ? TRUE : FALSE );
-			LLAppearanceManager::instance().wearInventoryCategory(category, false, append);
+			LLAppearanceMgr::instance().wearInventoryCategory(category, false, append);
 		}
 		return ACCEPT_YES_MULTI;
 	}
@@ -2435,7 +2435,7 @@ EAcceptance LLToolDragAndDrop::dad3dWearCategory(
 	{
 		if(drop)
 		{
-			LLAppearanceManager::instance().wearInventoryCategory(category, true, false);
+			LLAppearanceMgr::instance().wearInventoryCategory(category, true, false);
 		}
 		return ACCEPT_YES_MULTI;
 	}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 7bf7bf5e2f..063e49fc57 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -791,7 +791,7 @@ void WearOnAvatarCallback::fire(const LLUUID& inv_item)
 
 void ModifiedCOFCallback::fire(const LLUUID& inv_item)
 {
-	LLAppearanceManager::instance().updateAppearanceFromCOF();
+	LLAppearanceMgr::instance().updateAppearanceFromCOF();
 	if( CAMERA_MODE_CUSTOMIZE_AVATAR == gAgentCamera.getCameraMode() )
 	{
 		// If we're in appearance editing mode, the current tab may need to be refreshed
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index d79cb85730..5345a81121 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6468,13 +6468,13 @@ void handle_selected_texture_info(void*)
 
 void handle_test_male(void*)
 {
-	LLAppearanceManager::instance().wearOutfitByName("Male Shape & Outfit");
+	LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit");
 	//gGestureList.requestResetFromServer( TRUE );
 }
 
 void handle_test_female(void*)
 {
-	LLAppearanceManager::instance().wearOutfitByName("Female Shape & Outfit");
+	LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit");
 	//gGestureList.requestResetFromServer( FALSE );
 }
 
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 54379dece3..3f2161f881 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2547,7 +2547,7 @@ void LLVOAvatar::idleUpdateLoadingEffect()
 				llinfos << "self isFullyLoaded, first_fully_visible" << llendl;
 
 				first_fully_visible = false;
-				LLAppearanceManager::instance().onFirstFullyVisible();
+				LLAppearanceMgr::instance().onFirstFullyVisible();
 			}
 		}
 		if (isFullyLoaded())
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 15be6b23b3..762eecc047 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1036,7 +1036,7 @@ const LLViewerJointAttachment *LLVOAvatarSelf::attachObject(LLViewerObject *view
 	if (attachment->isObjectAttached(viewer_object))
 	{
 		const LLUUID& attachment_id = viewer_object->getItemID();
-		LLAppearanceManager::instance().registerAttachment(attachment_id);
+		LLAppearanceMgr::instance().registerAttachment(attachment_id);
 	}
 
 	return attachment;
@@ -1075,7 +1075,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
 		}
 		else
 		{
-			LLAppearanceManager::instance().unregisterAttachment(attachment_id);
+			LLAppearanceMgr::instance().unregisterAttachment(attachment_id);
 		}
 		
 		return TRUE;
-- 
cgit v1.2.3


From b2a667b7222640a384cb23763b32f8746b0c8cd8 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Mon, 29 Mar 2010 11:10:54 -0400
Subject: For EXT-4666: changed LLGestureManager to LLGestureMgr throughout

---
 indra/newview/llappearancemgr.cpp         |  6 +--
 indra/newview/llappviewer.cpp             |  2 +-
 indra/newview/llassetuploadresponders.cpp |  4 +-
 indra/newview/llchatbar.cpp               | 14 +++---
 indra/newview/llfloatergesture.cpp        | 28 ++++++------
 indra/newview/llgesturemgr.cpp            | 74 +++++++++++++++----------------
 indra/newview/llgesturemgr.h              |  6 +--
 indra/newview/llinventorybridge.cpp       | 42 +++++++++---------
 indra/newview/llinventoryfunctions.cpp    |  2 +-
 indra/newview/llnearbychatbar.cpp         | 16 +++----
 indra/newview/llpreviewgesture.cpp        | 22 ++++-----
 indra/newview/llstartup.cpp               |  4 +-
 indra/newview/lltooldraganddrop.cpp       |  2 +-
 indra/newview/llviewerinventory.cpp       |  4 +-
 indra/newview/llviewerwindow.cpp          |  2 +-
 indra/newview/llvoavatar.cpp              |  2 +-
 16 files changed, 115 insertions(+), 115 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 0f8e48c5f0..11e4a19cf0 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -451,7 +451,7 @@ void LLWearableHoldingPattern::onAllComplete()
 	{
 		llinfos << "Activating " << mGestItems.count() << " gestures" << llendl;
 		
-		LLGestureManager::instance().activateGestures(mGestItems);
+		LLGestureMgr::instance().activateGestures(mGestItems);
 		
 		// Update the inventory item labels to reflect the fact
 		// they are active.
@@ -1008,9 +1008,9 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 		for(S32 i = 0; i  < gest_items.count(); ++i)
 		{
 			LLViewerInventoryItem *gest_item = gest_items.get(i);
-			if ( LLGestureManager::instance().isGestureActive( gest_item->getLinkedUUID()) )
+			if ( LLGestureMgr::instance().isGestureActive( gest_item->getLinkedUUID()) )
 			{
-				LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() );
+				LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
 			}
 		}
 	}
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a3d0b8d8d9..37bdc32395 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -3619,7 +3619,7 @@ void LLAppViewer::idle()
 		// Handle pending gesture processing
 		static LLFastTimer::DeclareTimer ftm("Agent Position");
 		LLFastTimer t(ftm);
-		LLGestureManager::instance().update();
+		LLGestureMgr::instance().update();
 
 		gAgent.updateAgentPosition(gFrameDTClamped, yaw, current_mouse.mX, current_mouse.mY);
 	}
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 2bd3728ab7..370ecc0665 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -487,10 +487,10 @@ void LLUpdateAgentInventoryResponder::uploadComplete(const LLSD& content)
 	  {
 		  // If this gesture is active, then we need to update the in-memory
 		  // active map with the new pointer.				
-		  if (LLGestureManager::instance().isGestureActive(item_id))
+		  if (LLGestureMgr::instance().isGestureActive(item_id))
 		  {
 			  LLUUID asset_id = new_item->getAssetUUID();
-			  LLGestureManager::instance().replaceGesture(item_id, asset_id);
+			  LLGestureMgr::instance().replaceGesture(item_id, asset_id);
 			  gInventory.notifyObservers();
 		  }				
 
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index b32a955038..67d5d21b2a 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -107,7 +107,7 @@ LLChatBar::LLChatBar()
 
 LLChatBar::~LLChatBar()
 {
-	LLGestureManager::instance().removeObserver(mObserver);
+	LLGestureMgr::instance().removeObserver(mObserver);
 	delete mObserver;
 	mObserver = NULL;
 	// LLView destructor cleans up children
@@ -209,8 +209,8 @@ void LLChatBar::refreshGestures()
 
 		// collect list of unique gestures
 		std::map <std::string, BOOL> unique;
-		LLGestureManager::item_map_t::const_iterator it;
-		const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures();
+		LLGestureMgr::item_map_t::const_iterator it;
+		const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
 		for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
 		{
 			LLMultiGesture* gesture = (*it).second;
@@ -296,7 +296,7 @@ void LLChatBar::setGestureCombo(LLComboBox* combo)
 
 		// now register observer since we have a place to put the results
 		mObserver = new LLChatBarGestureObserver(this);
-		LLGestureManager::instance().addObserver(mObserver);
+		LLGestureMgr::instance().addObserver(mObserver);
 
 		// refresh list from current active gestures
 		refreshGestures();
@@ -377,7 +377,7 @@ void LLChatBar::sendChat( EChatType type )
 			if (0 == channel)
 			{
 				// discard returned "found" boolean
-				LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
+				LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
 			}
 			else
 			{
@@ -516,7 +516,7 @@ void LLChatBar::onInputEditorKeystroke( LLLineEditor* caller, void* userdata )
 		std::string utf8_trigger = wstring_to_utf8str(raw_text);
 		std::string utf8_out_str(utf8_trigger);
 
-		if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str))
+		if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
 		{
 			if (self->mInputEditor)
 			{
@@ -653,7 +653,7 @@ void LLChatBar::onCommitGesture(LLUICtrl* ctrl)
 		// substitution and logging.
 		std::string text(trigger);
 		std::string revised_text;
-		LLGestureManager::instance().triggerAndReviseString(text, &revised_text);
+		LLGestureMgr::instance().triggerAndReviseString(text, &revised_text);
 
 		revised_text = utf8str_trim(revised_text);
 		if (!revised_text.empty())
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index ff1d68aee1..0f80d55b67 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -106,7 +106,7 @@ LLFloaterGesture::LLFloaterGesture(const LLSD& key)
 	: LLFloater(key)
 {
 	mObserver = new LLFloaterGestureObserver(this);
-	LLGestureManager::instance().addObserver(mObserver);
+	LLGestureMgr::instance().addObserver(mObserver);
 
 	mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
 	mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
@@ -165,7 +165,7 @@ void LLFloaterGesture::done()
 // virtual
 LLFloaterGesture::~LLFloaterGesture()
 {
-	LLGestureManager::instance().removeObserver(mObserver);
+	LLGestureMgr::instance().removeObserver(mObserver);
 	delete mObserver;
 	mObserver = NULL;
 	gInventory.removeObserver(this);
@@ -251,8 +251,8 @@ void LLFloaterGesture::buildGestureList()
 	LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
 	mGestureList->deleteAllItems();
 
-	LLGestureManager::item_map_t::const_iterator it;
-	const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures();
+	LLGestureMgr::item_map_t::const_iterator it;
+	const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
 	for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
 	{
 		addGesture(it->first,it->second, mGestureList);
@@ -371,7 +371,7 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur
 	LLScrollListItem* sl_item = list->addElement(element, ADD_BOTTOM);
 	if(sl_item)
 	{
-		LLFontGL::StyleFlags style = LLGestureManager::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL;
+		LLFontGL::StyleFlags style = LLGestureMgr::getInstance()->isGestureActive(item_id) ? LLFontGL::BOLD : LLFontGL::NORMAL;
 		// *TODO find out why ["font"]["style"] does not affect font style
 		((LLScrollListText*)sl_item->getColumn(0))->setFontStyle(style);
 	}
@@ -421,17 +421,17 @@ void LLFloaterGesture::onClickPlay()
 	if(item_id.isNull()) return;
 
 	LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
-	if(!LLGestureManager::instance().isGestureActive(item_id))
+	if(!LLGestureMgr::instance().isGestureActive(item_id))
 	{
 		// we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboList.
 		BOOL inform_server = TRUE;
 		BOOL deactivate_similar = FALSE;
-		LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
+		LLGestureMgr::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
 		LLViewerInventoryItem *item = gInventory.getItem(item_id);
 		llassert(item);
 		if (item)
 		{
-			LLGestureManager::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
+			LLGestureMgr::instance().activateGestureWithAsset(item_id, item->getAssetUUID(), inform_server, deactivate_similar);
 			LL_DEBUGS("Gesture")<< "Activating gesture with inventory ID: " << item_id <<LL_ENDL;
 		}
 	}
@@ -456,7 +456,7 @@ void LLFloaterGesture::onActivateBtnClick()
 	if(ids.empty())
 		return;
 
-	LLGestureManager* gm = LLGestureManager::getInstance();
+	LLGestureMgr* gm = LLGestureMgr::getInstance();
 	std::vector<LLUUID>::const_iterator it = ids.begin();
 	BOOL first_gesture_state = gm->isGestureActive(*it);
 	BOOL is_mixed = FALSE;
@@ -558,7 +558,7 @@ void LLFloaterGesture::onCommitList()
 	const LLUUID& item_id = mGestureList->getCurrentID();
 
 	mSelectedID = item_id;
-	if (LLGestureManager::instance().isGesturePlaying(item_id))
+	if (LLGestureMgr::instance().isGesturePlaying(item_id))
 	{
 		childSetVisible("play_btn", false);
 		childSetVisible("stop_btn", true);
@@ -578,7 +578,7 @@ void LLFloaterGesture::onDeleteSelected()
 		return;
 
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
-	LLGestureManager* gm = LLGestureManager::getInstance();
+	LLGestureMgr* gm = LLGestureMgr::getInstance();
 	for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
 	{
 		const LLUUID& selected_item = *it;
@@ -623,12 +623,12 @@ void LLFloaterGesture::playGesture(LLUUID item_id)
 {
 	LL_DEBUGS("Gesture")<<"Playing gesture "<< item_id<<LL_ENDL;
 
-	if (LLGestureManager::instance().isGesturePlaying(item_id))
+	if (LLGestureMgr::instance().isGesturePlaying(item_id))
 	{
-		LLGestureManager::instance().stopGesture(item_id);
+		LLGestureMgr::instance().stopGesture(item_id);
 	}
 	else
 	{
-		LLGestureManager::instance().playGesture(item_id);
+		LLGestureMgr::instance().playGesture(item_id);
 	}
 }
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index cfbb60fe17..739d28c90f 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -67,7 +67,7 @@ static const LLUUID& get_linked_uuid(const LLUUID& item_id);
 
 // Lightweight constructor.
 // init() does the heavy lifting.
-LLGestureManager::LLGestureManager()
+LLGestureMgr::LLGestureMgr()
 :	mValid(FALSE),
 	mPlaying(),
 	mActive(),
@@ -79,7 +79,7 @@ LLGestureManager::LLGestureManager()
 
 
 // We own the data for gestures, so clean them up.
-LLGestureManager::~LLGestureManager()
+LLGestureMgr::~LLGestureMgr()
 {
 	item_map_t::iterator it;
 	for (it = mActive.begin(); it != mActive.end(); ++it)
@@ -93,12 +93,12 @@ LLGestureManager::~LLGestureManager()
 }
 
 
-void LLGestureManager::init()
+void LLGestureMgr::init()
 {
 	// TODO
 }
 
-void LLGestureManager::changed(U32 mask) 
+void LLGestureMgr::changed(U32 mask) 
 { 
 	LLInventoryFetchObserver::changed(mask);
 
@@ -136,7 +136,7 @@ void LLGestureManager::changed(U32 mask)
 
 // Use this version when you have the item_id but not the asset_id,
 // and you KNOW the inventory is loaded.
-void LLGestureManager::activateGesture(const LLUUID& item_id)
+void LLGestureMgr::activateGesture(const LLUUID& item_id)
 {
 	LLViewerInventoryItem* item = gInventory.getItem(item_id);
 	if (!item) return;
@@ -152,7 +152,7 @@ void LLGestureManager::activateGesture(const LLUUID& item_id)
 }
 
 
-void LLGestureManager::activateGestures(LLViewerInventoryItem::item_array_t& items)
+void LLGestureMgr::activateGestures(LLViewerInventoryItem::item_array_t& items)
 {
 	// Load up the assets
 	S32 count = 0;
@@ -248,7 +248,7 @@ struct LLLoadInfo
 /**
  * It will load a gesture from remote storage
  */
-void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
+void LLGestureMgr::activateGestureWithAsset(const LLUUID& item_id,
 												const LLUUID& asset_id,
 												BOOL inform_server,
 												BOOL deactivate_similar)
@@ -257,7 +257,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
 
 	if( !gAssetStorage )
 	{
-		llwarns << "LLGestureManager::activateGestureWithAsset without valid gAssetStorage" << llendl;
+		llwarns << "LLGestureMgr::activateGestureWithAsset without valid gAssetStorage" << llendl;
 		return;
 	}
 	// If gesture is already active, nothing to do.
@@ -299,7 +299,7 @@ void LLGestureManager::activateGestureWithAsset(const LLUUID& item_id,
 }
 
 
-void LLGestureManager::deactivateGesture(const LLUUID& item_id)
+void LLGestureMgr::deactivateGesture(const LLUUID& item_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 	item_map_t::iterator it = mActive.find(base_item_id);
@@ -344,7 +344,7 @@ void LLGestureManager::deactivateGesture(const LLUUID& item_id)
 }
 
 
-void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
+void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
 {
 	const LLUUID& base_in_item_id = get_linked_uuid(in_item_id);
 	std::vector<LLUUID> gest_item_ids;
@@ -431,7 +431,7 @@ void LLGestureManager::deactivateSimilarGestures(LLMultiGesture* in, const LLUUI
 }
 
 
-BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
+BOOL LLGestureMgr::isGestureActive(const LLUUID& item_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 	item_map_t::iterator it = mActive.find(base_item_id);
@@ -439,7 +439,7 @@ BOOL LLGestureManager::isGestureActive(const LLUUID& item_id)
 }
 
 
-BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
+BOOL LLGestureMgr::isGesturePlaying(const LLUUID& item_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 
@@ -452,7 +452,7 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
 	return gesture->mPlaying;
 }
 
-BOOL LLGestureManager::isGesturePlaying(LLMultiGesture* gesture)
+BOOL LLGestureMgr::isGesturePlaying(LLMultiGesture* gesture)
 {
 	if(!gesture)
 	{
@@ -462,7 +462,7 @@ BOOL LLGestureManager::isGesturePlaying(LLMultiGesture* gesture)
 	return gesture->mPlaying;
 }
 
-void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
+void LLGestureMgr::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 
@@ -504,11 +504,11 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new
 	notifyObservers();
 }
 
-void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
+void LLGestureMgr::replaceGesture(const LLUUID& item_id, const LLUUID& new_asset_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 
-	item_map_t::iterator it = LLGestureManager::instance().mActive.find(base_item_id);
+	item_map_t::iterator it = LLGestureMgr::instance().mActive.find(base_item_id);
 	if (it == mActive.end())
 	{
 		llwarns << "replaceGesture for inactive gesture " << base_item_id << llendl;
@@ -517,10 +517,10 @@ void LLGestureManager::replaceGesture(const LLUUID& item_id, const LLUUID& new_a
 
 	// mActive owns this gesture pointer, so clean up memory.
 	LLMultiGesture* gesture = (*it).second;
-	LLGestureManager::instance().replaceGesture(base_item_id, gesture, new_asset_id);
+	LLGestureMgr::instance().replaceGesture(base_item_id, gesture, new_asset_id);
 }
 
-void LLGestureManager::playGesture(LLMultiGesture* gesture)
+void LLGestureMgr::playGesture(LLMultiGesture* gesture)
 {
 	if (!gesture) return;
 
@@ -539,7 +539,7 @@ void LLGestureManager::playGesture(LLMultiGesture* gesture)
 
 
 // Convenience function that looks up the item_id for you.
-void LLGestureManager::playGesture(const LLUUID& item_id)
+void LLGestureMgr::playGesture(const LLUUID& item_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 
@@ -556,7 +556,7 @@ void LLGestureManager::playGesture(const LLUUID& item_id)
 // Iterates through space delimited tokens in string, triggering any gestures found.
 // Generates a revised string that has the found tokens replaced by their replacement strings
 // and (as a minor side effect) has multiple spaces in a row replaced by single spaces.
-BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
+BOOL LLGestureMgr::triggerAndReviseString(const std::string &utf8str, std::string* revised_string)
 {
 	std::string tokenized = utf8str;
 
@@ -649,7 +649,7 @@ BOOL LLGestureManager::triggerAndReviseString(const std::string &utf8str, std::s
 }
 
 
-BOOL LLGestureManager::triggerGesture(KEY key, MASK mask)
+BOOL LLGestureMgr::triggerGesture(KEY key, MASK mask)
 {
 	std::vector <LLMultiGesture *> matching;
 	item_map_t::iterator it;
@@ -683,7 +683,7 @@ BOOL LLGestureManager::triggerGesture(KEY key, MASK mask)
 }
 
 
-S32 LLGestureManager::getPlayingCount() const
+S32 LLGestureMgr::getPlayingCount() const
 {
 	return mPlaying.size();
 }
@@ -697,7 +697,7 @@ struct IsGesturePlaying : public std::unary_function<LLMultiGesture*, bool>
 	}
 };
 
-void LLGestureManager::update()
+void LLGestureMgr::update()
 {
 	S32 i;
 	for (i = 0; i < (S32)mPlaying.size(); ++i)
@@ -740,7 +740,7 @@ void LLGestureManager::update()
 
 
 // Run all steps until you're either done or hit a wait.
-void LLGestureManager::stepGesture(LLMultiGesture* gesture)
+void LLGestureMgr::stepGesture(LLMultiGesture* gesture)
 {
 	if (!gesture)
 	{
@@ -888,7 +888,7 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 }
 
 
-void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
+void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step)
 {
 	switch(step->getType())
 	{
@@ -975,7 +975,7 @@ void LLGestureManager::runStep(LLMultiGesture* gesture, LLGestureStep* step)
 
 
 // static
-void LLGestureManager::onLoadComplete(LLVFS *vfs,
+void LLGestureMgr::onLoadComplete(LLVFS *vfs,
 									   const LLUUID& asset_uuid,
 									   LLAssetType::EType type,
 									   void* user_data, S32 status, LLExtStat ext_status)
@@ -988,7 +988,7 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
 
 	delete info;
 	info = NULL;
-	LLGestureManager& self = LLGestureManager::instance();
+	LLGestureMgr& self = LLGestureMgr::instance();
 	self.mLoadingCount--;
 
 	if (0 == status)
@@ -1094,12 +1094,12 @@ void LLGestureManager::onLoadComplete(LLVFS *vfs,
 
 		llwarns << "Problem loading gesture: " << status << llendl;
 		
-		LLGestureManager::instance().mActive.erase(item_id);			
+		LLGestureMgr::instance().mActive.erase(item_id);			
 	}
 }
 
 
-void LLGestureManager::stopGesture(LLMultiGesture* gesture)
+void LLGestureMgr::stopGesture(LLMultiGesture* gesture)
 {
 	if (!gesture) return;
 
@@ -1139,7 +1139,7 @@ void LLGestureManager::stopGesture(LLMultiGesture* gesture)
 }
 
 
-void LLGestureManager::stopGesture(const LLUUID& item_id)
+void LLGestureMgr::stopGesture(const LLUUID& item_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
 
@@ -1153,12 +1153,12 @@ void LLGestureManager::stopGesture(const LLUUID& item_id)
 }
 
 
-void LLGestureManager::addObserver(LLGestureManagerObserver* observer)
+void LLGestureMgr::addObserver(LLGestureManagerObserver* observer)
 {
 	mObservers.push_back(observer);
 }
 
-void LLGestureManager::removeObserver(LLGestureManagerObserver* observer)
+void LLGestureMgr::removeObserver(LLGestureManagerObserver* observer)
 {
 	std::vector<LLGestureManagerObserver*>::iterator it;
 	it = std::find(mObservers.begin(), mObservers.end(), observer);
@@ -1171,9 +1171,9 @@ void LLGestureManager::removeObserver(LLGestureManagerObserver* observer)
 // Call this method when it's time to update everyone on a new state.
 // Copy the list because an observer could respond by removing itself
 // from the list.
-void LLGestureManager::notifyObservers()
+void LLGestureMgr::notifyObservers()
 {
-	lldebugs << "LLGestureManager::notifyObservers" << llendl;
+	lldebugs << "LLGestureMgr::notifyObservers" << llendl;
 
 	std::vector<LLGestureManagerObserver*> observers = mObservers;
 
@@ -1185,7 +1185,7 @@ void LLGestureManager::notifyObservers()
 	}
 }
 
-BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_str)
+BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
 {
 	S32 in_len = in_str.length();
 
@@ -1216,7 +1216,7 @@ BOOL LLGestureManager::matchPrefix(const std::string& in_str, std::string* out_s
 }
 
 
-void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids)
+void LLGestureMgr::getItemIDs(std::vector<LLUUID>* ids)
 {
 	item_map_t::const_iterator it;
 	for (it = mActive.begin(); it != mActive.end(); ++it)
@@ -1225,7 +1225,7 @@ void LLGestureManager::getItemIDs(std::vector<LLUUID>* ids)
 	}
 }
 
-void LLGestureManager::done()
+void LLGestureMgr::done()
 {
 	bool notify = false;
 	for(item_map_t::iterator it = mActive.begin(); it != mActive.end(); ++it)
diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h
index 3dd184ddc7..bda657679a 100644
--- a/indra/newview/llgesturemgr.h
+++ b/indra/newview/llgesturemgr.h
@@ -54,7 +54,7 @@ public:
 	virtual void changed() = 0;
 };
 
-class LLGestureManager : public LLSingleton<LLGestureManager>, public LLInventoryFetchObserver
+class LLGestureMgr : public LLSingleton<LLGestureMgr>, public LLInventoryFetchObserver
 {
 public:
 
@@ -63,8 +63,8 @@ public:
 	typedef std::map<LLUUID, LLMultiGesture*> item_map_t;
 	typedef std::map<LLUUID, gesture_loaded_callback_t> callback_map_t;
 
-	LLGestureManager();
-	~LLGestureManager();
+	LLGestureMgr();
+	~LLGestureMgr();
 
 	void init();
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 41e15992de..65f7b6f1c6 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -260,7 +260,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
 		{
 			if(LLAssetType::AT_GESTURE == item->getType())
 			{
-				LLGestureManager::instance().deactivateGesture(item->getUUID());
+				LLGestureMgr::instance().deactivateGesture(item->getUUID());
 			}
 		}
 	}
@@ -276,7 +276,7 @@ void LLInvFVBridge::removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batc
 			{
 				if(LLAssetType::AT_GESTURE == descendent_items[j]->getType())
 				{
-					LLGestureManager::instance().deactivateGesture(descendent_items[j]->getUUID());
+					LLGestureMgr::instance().deactivateGesture(descendent_items[j]->getUUID());
 				}
 			}
 		}
@@ -1748,9 +1748,9 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				{
 					LLInventoryItem* item = descendent_items[i];
 					if (item->getType() == LLAssetType::AT_GESTURE
-						&& LLGestureManager::instance().isGestureActive(item->getUUID()))
+						&& LLGestureMgr::instance().isGestureActive(item->getUUID()))
 					{
-						LLGestureManager::instance().deactivateGesture(item->getUUID());
+						LLGestureMgr::instance().deactivateGesture(item->getUUID());
 					}
 				}
 			}
@@ -2418,9 +2418,9 @@ bool LLFolderBridge::removeItemResponse(const LLSD& notification, const LLSD& re
 			const LLViewerInventoryItem* item = (*iter);
 			const LLUUID& item_id = item->getUUID();
 			if (item->getType() == LLAssetType::AT_GESTURE
-				&& LLGestureManager::instance().isGestureActive(item_id))
+				&& LLGestureMgr::instance().isGestureActive(item_id))
 			{
-				LLGestureManager::instance().deactivateGesture(item_id);
+				LLGestureMgr::instance().deactivateGesture(item_id);
 			}
 		}
 		
@@ -3081,9 +3081,9 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		if(accept && drop)
 		{
 			if (inv_item->getType() == LLAssetType::AT_GESTURE
-				&& LLGestureManager::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
+				&& LLGestureMgr::instance().isGestureActive(inv_item->getUUID()) && move_is_into_trash)
 			{
-				LLGestureManager::instance().deactivateGesture(inv_item->getUUID());
+				LLGestureMgr::instance().deactivateGesture(inv_item->getUUID());
 			}
 			// If an item is being dragged between windows, unselect
 			// everything in the active window so that we don't follow
@@ -3795,7 +3795,7 @@ LLUIImagePtr LLGestureBridge::getIcon() const
 
 LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
 {
-	if( LLGestureManager::instance().isGestureActive(mUUID) )
+	if( LLGestureMgr::instance().isGestureActive(mUUID) )
 	{
 		return LLFontGL::BOLD;
 	}
@@ -3807,7 +3807,7 @@ LLFontGL::StyleFlags LLGestureBridge::getLabelStyle() const
 
 std::string LLGestureBridge::getLabelSuffix() const
 {
-	if( LLGestureManager::instance().isGestureActive(mUUID) )
+	if( LLGestureMgr::instance().isGestureActive(mUUID) )
 	{
 		LLStringUtil::format_map_t args;
 		args["[GESLABEL]"] =  LLItemBridge::getLabelSuffix();
@@ -3824,7 +3824,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 {
 	if (isAddAction(action))
 	{
-		LLGestureManager::instance().activateGesture(mUUID);
+		LLGestureMgr::instance().activateGesture(mUUID);
 
 		LLViewerInventoryItem* item = gInventory.getItem(mUUID);
 		if (!item) return;
@@ -3836,7 +3836,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 	}
 	else if (isRemoveAction(action))
 	{
-		LLGestureManager::instance().deactivateGesture(mUUID);
+		LLGestureMgr::instance().deactivateGesture(mUUID);
 
 		LLViewerInventoryItem* item = gInventory.getItem(mUUID);
 		if (!item) return;
@@ -3848,17 +3848,17 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 	}
 	else if("play" == action)
 	{
-		if(!LLGestureManager::instance().isGestureActive(mUUID))
+		if(!LLGestureMgr::instance().isGestureActive(mUUID))
 		{
 			// we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboList.
 			BOOL inform_server = TRUE;
 			BOOL deactivate_similar = FALSE;
-			LLGestureManager::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
+			LLGestureMgr::instance().setGestureLoadedCallback(mUUID, boost::bind(&LLGestureBridge::playGesture, mUUID));
 			LLViewerInventoryItem* item = gInventory.getItem(mUUID);
 			llassert(item);
 			if (item)
 			{
-				LLGestureManager::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
+				LLGestureMgr::instance().activateGestureWithAsset(mUUID, item->getAssetUUID(), inform_server, deactivate_similar);
 			}
 		}
 		else
@@ -3900,7 +3900,7 @@ BOOL LLGestureBridge::removeItem()
 	
 	// This will also force close the preview window, if it exists.
 	// This may actually delete *this, if mUUID is in the COF.
-	LLGestureManager::instance().deactivateGesture(item_id);
+	LLGestureMgr::instance().deactivateGesture(item_id);
 	
 	// If deactivateGesture deleted *this, then return out immediately.
 	if (!model->getObject(item_id))
@@ -3933,7 +3933,7 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		getClipboardEntries(true, items, disabled_items, flags);
 
 		items.push_back(std::string("Gesture Separator"));
-		if (LLGestureManager::instance().isGestureActive(getUUID()))
+		if (LLGestureMgr::instance().isGestureActive(getUUID()))
 		{
 			items.push_back(std::string("Deactivate"));
 		}
@@ -3948,13 +3948,13 @@ void LLGestureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 // static
 void LLGestureBridge::playGesture(const LLUUID& item_id)
 {
-	if (LLGestureManager::instance().isGesturePlaying(item_id))
+	if (LLGestureMgr::instance().isGesturePlaying(item_id))
 	{
-		LLGestureManager::instance().stopGesture(item_id);
+		LLGestureMgr::instance().stopGesture(item_id);
 	}
 	else
 	{
-		LLGestureManager::instance().playGesture(item_id);
+		LLGestureMgr::instance().playGesture(item_id);
 	}
 }
 
@@ -4547,7 +4547,7 @@ void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_
 				LLViewerInventoryItem *gest_item = gest_item_array.get(i);
 				if (get_is_item_worn(gest_item->getUUID()))
 				{
-					LLGestureManager::instance().deactivateGesture( gest_item->getLinkedUUID() );
+					LLGestureMgr::instance().deactivateGesture( gest_item->getLinkedUUID() );
 					gInventory.updateItem( gest_item );
 					gInventory.notifyObservers();
 				}
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 3553137f53..5a52071dc6 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -363,7 +363,7 @@ BOOL get_is_item_worn(const LLUUID& id)
 				return TRUE;
 			break;
 		case LLAssetType::AT_GESTURE:
-			if (LLGestureManager::instance().isGestureActive(item->getLinkedUUID()))
+			if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
 				return TRUE;
 			break;
 		default:
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index af711b6943..424b8c9a66 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -103,7 +103,7 @@ LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p)
 	setCommitCallback(boost::bind(&LLGestureComboList::onCommitGesture, this));
 
 	// now register us as observer since we have a place to put the results
-	LLGestureManager::instance().addObserver(this);
+	LLGestureMgr::instance().addObserver(this);
 
 	// refresh list from current active gestures
 	refreshGestures();
@@ -244,8 +244,8 @@ void LLGestureComboList::refreshGestures()
 	mList->clearRows();
 	mGestures.clear();
 
-	LLGestureManager::item_map_t::const_iterator it;
-	const LLGestureManager::item_map_t& active_gestures = LLGestureManager::instance().getActiveGestures();
+	LLGestureMgr::item_map_t::const_iterator it;
+	const LLGestureMgr::item_map_t& active_gestures = LLGestureMgr::instance().getActiveGestures();
 	LLSD::Integer idx(0);
 	for (it = active_gestures.begin(); it != active_gestures.end(); ++it)
 	{
@@ -289,7 +289,7 @@ void LLGestureComboList::refreshGestures()
 			gesture = mGestures.at(index);
 	}
 	
-	if(gesture && LLGestureManager::instance().isGesturePlaying(gesture))
+	if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture))
 	{
 		return;
 	}
@@ -321,7 +321,7 @@ void LLGestureComboList::onCommitGesture()
 		LLMultiGesture* gesture = mGestures.at(index);
 		if(gesture)
 		{
-			LLGestureManager::instance().playGesture(gesture);
+			LLGestureMgr::instance().playGesture(gesture);
 			if(!gesture->mReplaceText.empty())
 			{
 				LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
@@ -332,7 +332,7 @@ void LLGestureComboList::onCommitGesture()
 
 LLGestureComboList::~LLGestureComboList()
 {
-	LLGestureManager::instance().removeObserver(this);
+	LLGestureMgr::instance().removeObserver(this);
 }
 
 LLNearbyChatBar::LLNearbyChatBar() 
@@ -476,7 +476,7 @@ void LLNearbyChatBar::onChatBoxKeystroke(LLLineEditor* caller, void* userdata)
 		std::string utf8_trigger = wstring_to_utf8str(raw_text);
 		std::string utf8_out_str(utf8_trigger);
 
-		if (LLGestureManager::instance().matchPrefix(utf8_trigger, &utf8_out_str))
+		if (LLGestureMgr::instance().matchPrefix(utf8_trigger, &utf8_out_str))
 		{
 			std::string rest_of_match = utf8_out_str.substr(utf8_trigger.size());
 			self->mChatBox->setText(utf8_trigger + rest_of_match); // keep original capitalization for user-entered part
@@ -558,7 +558,7 @@ void LLNearbyChatBar::sendChat( EChatType type )
 			if (0 == channel)
 			{
 				// discard returned "found" boolean
-				LLGestureManager::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
+				LLGestureMgr::instance().triggerAndReviseString(utf8text, &utf8_revised_text);
 			}
 			else
 			{
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 57a8ca3d12..143938bcea 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -269,7 +269,7 @@ BOOL LLPreviewGesture::canClose()
 // virtual
 void LLPreviewGesture::onClose(bool app_quitting)
 {
-	LLGestureManager::instance().stopGesture(mPreviewGesture);
+	LLGestureMgr::instance().stopGesture(mPreviewGesture);
 }
 
 // virtual
@@ -293,13 +293,13 @@ bool LLPreviewGesture::handleSaveChangesDialog(const LLSD& notification, const L
 	switch(option)
 	{
 	case 0:  // "Yes"
-		LLGestureManager::instance().stopGesture(mPreviewGesture);
+		LLGestureMgr::instance().stopGesture(mPreviewGesture);
 		mCloseAfterSave = TRUE;
 		onClickSave(this);
 		break;
 
 	case 1:  // "No"
-		LLGestureManager::instance().stopGesture(mPreviewGesture);
+		LLGestureMgr::instance().stopGesture(mPreviewGesture);
 		mDirty = FALSE; // Force the dirty flag because user has clicked NO on confirm save dialog...
 		closeFloater();
 		break;
@@ -784,7 +784,7 @@ void LLPreviewGesture::refresh()
 	
 	mOptionsText->setText(optionstext);
 
-	BOOL active = LLGestureManager::instance().isGestureActive(mItemUUID);
+	BOOL active = LLGestureMgr::instance().isGestureActive(mItemUUID);
 	mActiveCheck->set(active);
 
 	// Can only preview if there are steps
@@ -1138,10 +1138,10 @@ void LLPreviewGesture::saveIfNeeded()
 
 		// If this gesture is active, then we need to update the in-memory
 		// active map with the new pointer.
-		if (!delayedUpload && LLGestureManager::instance().isGestureActive(mItemUUID))
+		if (!delayedUpload && LLGestureMgr::instance().isGestureActive(mItemUUID))
 		{
 			// gesture manager now owns the pointer
-			LLGestureManager::instance().replaceGesture(mItemUUID, gesture, asset_id);
+			LLGestureMgr::instance().replaceGesture(mItemUUID, gesture, asset_id);
 
 			// replaceGesture may deactivate other gestures so let the
 			// inventory know.
@@ -1702,13 +1702,13 @@ void LLPreviewGesture::onClickDelete(void* data)
 void LLPreviewGesture::onCommitActive(LLUICtrl* ctrl, void* data)
 {
 	LLPreviewGesture* self = (LLPreviewGesture*)data;
-	if (!LLGestureManager::instance().isGestureActive(self->mItemUUID))
+	if (!LLGestureMgr::instance().isGestureActive(self->mItemUUID))
 	{
-		LLGestureManager::instance().activateGesture(self->mItemUUID);
+		LLGestureMgr::instance().activateGesture(self->mItemUUID);
 	}
 	else
 	{
-		LLGestureManager::instance().deactivateGesture(self->mItemUUID);
+		LLGestureMgr::instance().deactivateGesture(self->mItemUUID);
 	}
 
 	// Make sure the (active) label in the inventory gets updated.
@@ -1747,14 +1747,14 @@ void LLPreviewGesture::onClickPreview(void* data)
 		self->mPreviewBtn->setLabel(self->getString("stop_txt"));
 
 		// play it, and delete when done
-		LLGestureManager::instance().playGesture(self->mPreviewGesture);
+		LLGestureMgr::instance().playGesture(self->mPreviewGesture);
 
 		self->refresh();
 	}
 	else
 	{
 		// Will call onDonePreview() below
-		LLGestureManager::instance().stopGesture(self->mPreviewGesture);
+		LLGestureMgr::instance().stopGesture(self->mPreviewGesture);
 
 		self->refresh();
 	}
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 766ec9afb8..7fe3ac1b4a 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1760,7 +1760,7 @@ bool idle_startup()
 						// Could schedule and delay these for later.
 						const BOOL no_inform_server = FALSE;
 						const BOOL no_deactivate_similar = FALSE;
-						LLGestureManager::instance().activateGestureWithAsset(item_id, asset_id,
+						LLGestureMgr::instance().activateGestureWithAsset(item_id, asset_id,
 											 no_inform_server,
 											 no_deactivate_similar);
 						// We need to fetch the inventory items for these gestures
@@ -1769,7 +1769,7 @@ bool idle_startup()
 					}
 				}
 				// no need to add gesture to inventory observer, it's already made in constructor 
-				LLGestureManager::instance().fetchItems(item_ids);
+				LLGestureMgr::instance().fetchItems(item_ids);
 			}
 		}
 		gDisplaySwapBuffers = TRUE;
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index db6f726a93..7bc0f0b68f 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -2383,7 +2383,7 @@ EAcceptance LLToolDragAndDrop::dad3dActivateGesture(
 			}
 			else
 			{
-				LLGestureManager::instance().activateGesture(item->getUUID());
+				LLGestureMgr::instance().activateGesture(item->getUUID());
 				gInventory.updateItem(item);
 				gInventory.notifyObservers();
 			}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 063e49fc57..a2c67abf05 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -827,7 +827,7 @@ void ActivateGestureCallback::fire(const LLUUID& inv_item)
 	if (inv_item.isNull())
 		return;
 
-	LLGestureManager::instance().activateGesture(inv_item);
+	LLGestureMgr::instance().activateGesture(inv_item);
 }
 
 void CreateGestureCallback::fire(const LLUUID& inv_item)
@@ -835,7 +835,7 @@ void CreateGestureCallback::fire(const LLUUID& inv_item)
 	if (inv_item.isNull())
 		return;
 
-	LLGestureManager::instance().activateGesture(inv_item);
+	LLGestureMgr::instance().activateGesture(inv_item);
 	
 	LLViewerInventoryItem* item = gInventory.getItem(inv_item);
 	if (!item) return;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 6d2bbb27ee..e4889410f0 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2272,7 +2272,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 	}
 
 	// Try for a new-format gesture
-	if (LLGestureManager::instance().triggerGesture(key, mask))
+	if (LLGestureMgr::instance().triggerGesture(key, mask))
 	{
 		return TRUE;
 	}
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 3f2161f881..dedc2e6637 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2254,7 +2254,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 					else	{ llinfos << "oops - CurrentGesticulationLevel can be only 0, 1, or 2"  << llendl; }
 					
 					// this is the call that Karl S. created for triggering gestures from within the code.
-					LLGestureManager::instance().triggerAndReviseString( gestureString );
+					LLGestureMgr::instance().triggerAndReviseString( gestureString );
 				}
 			}
 			
-- 
cgit v1.2.3


From cb98c887da13cf5dc9ebae16028d7217e893c61e Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Mon, 29 Mar 2010 18:14:39 +0300
Subject: Fixed normal bug EXT-6048 (Shortcut for Groups Ctrl-Shift-G)

-Added tag for shortcut to the XML

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/131/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/menu_viewer.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index a08bc16066..ac31636ed2 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -159,7 +159,8 @@
         <menu_item_call
          label="My Groups"
          layout="topleft"
-         name="My Groups">
+         name="My Groups"
+         shortcut="control|shift|G">
             <menu_item_call.on_click
              function="SideTray.PanelPeopleTab"
              parameter="groups_panel" />
-- 
cgit v1.2.3


From 94e6e10739c8321b6fb651a109901380ef92975a Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 12:00:26 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Superficial cleanup to replace all instances of "LLVOAvatarSelf *avatarp = gAgent.getAvatarObject" with "gAgentAvatar".
---
 indra/newview/llagent.cpp               | 217 +++++++++++++------------------
 indra/newview/llagent.h                 |  16 ---
 indra/newview/llagentcamera.cpp         | 218 ++++++++++++++------------------
 indra/newview/llagentui.cpp             |  12 +-
 indra/newview/llagentwearables.cpp      | 101 +++++----------
 indra/newview/llappearancemgr.cpp       |   3 +-
 indra/newview/llappviewer.cpp           |   3 +-
 indra/newview/lldriverparam.cpp         |  12 +-
 indra/newview/llgesturemgr.cpp          |  11 +-
 indra/newview/llinventorybridge.cpp     |  46 +++----
 indra/newview/llinventoryfunctions.cpp  |   3 +-
 indra/newview/llinventorymodel.cpp      |   3 +-
 indra/newview/llinventorypanel.cpp      |   5 +-
 indra/newview/llmaniprotate.cpp         |   9 +-
 indra/newview/llmaniptranslate.cpp      |   2 +-
 indra/newview/llmorphview.cpp           |  28 ++--
 indra/newview/llmoveview.cpp            |  10 +-
 indra/newview/llpaneleditwearable.cpp   |   2 +-
 indra/newview/llpreview.cpp             |   5 +-
 indra/newview/llpreviewanim.cpp         |  20 ++-
 indra/newview/llscrollingpanelparam.cpp |   7 +-
 indra/newview/llselectmgr.cpp           |  26 ++--
 indra/newview/llsidepanelappearance.cpp |   7 +-
 indra/newview/llstartup.cpp             |   8 +-
 indra/newview/llstatusbar.cpp           |   6 +-
 indra/newview/lltexlayer.cpp            |  18 +--
 indra/newview/lltooldraganddrop.cpp     |  52 +++-----
 indra/newview/lltoolfocus.cpp           |   7 +-
 indra/newview/lltoolgrab.cpp            |   2 +-
 indra/newview/lltoolmorph.cpp           |  40 +++---
 indra/newview/lltoolpie.cpp             |   8 +-
 indra/newview/lltoolplacer.cpp          |   3 +-
 indra/newview/lltoolselect.cpp          |   4 +-
 indra/newview/llviewerdisplay.cpp       |  11 +-
 indra/newview/llviewerkeyboard.cpp      |   3 +-
 indra/newview/llviewermedia.cpp         |   2 +-
 indra/newview/llviewermenu.cpp          | 198 ++++++++++++++---------------
 indra/newview/llviewermessage.cpp       |  27 ++--
 indra/newview/llviewerobject.cpp        |  20 ++-
 indra/newview/llviewerobjectlist.cpp    |  15 ++-
 indra/newview/llviewerwindow.cpp        |   6 +-
 indra/newview/llvoavatar.cpp            |  23 ++--
 indra/newview/llvoavatarself.cpp        |  58 +++++----
 indra/newview/llvoavatarself.h          |   7 +-
 indra/newview/llvoiceclient.cpp         |   8 +-
 indra/newview/llwearable.cpp            |  95 +++++---------
 indra/newview/pipeline.cpp              |  35 +++--
 47 files changed, 602 insertions(+), 820 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index a1b2a9fc44..645acca4ae 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -159,11 +159,11 @@ bool handleSlowMotionAnimation(const LLSD& newvalue)
 {
 	if (newvalue.asBoolean())
 	{
-		gAgent.getAvatarObject()->setAnimTimeFactor(0.2f);
+		gAgentAvatar->setAnimTimeFactor(0.2f);
 	}
 	else
 	{
-		gAgent.getAvatarObject()->setAnimTimeFactor(1.0f);
+		gAgentAvatar->setAnimTimeFactor(1.0f);
 	}
 	return true;
 }
@@ -207,8 +207,6 @@ LLAgent::LLAgent() :
 	mDistanceTraveled(0.F),
 	mLastPositionGlobal(LLVector3d::zero),
 
-	mAvatarObject(NULL),
-
 	mRenderState(0),
 	mTypingTimer(),
 
@@ -294,7 +292,6 @@ void LLAgent::init()
 //-----------------------------------------------------------------------------
 void LLAgent::cleanup()
 {
-	mAvatarObject = NULL;
 	mRegionp = NULL;
 }
 
@@ -325,12 +322,12 @@ void LLAgent::onAppFocusGained()
 
 void LLAgent::ageChat()
 {
-	if (mAvatarObject.notNull())
+	if (isAgentAvatarValid())
 	{
 		// get amount of time since I last chatted
-		F64 elapsed_time = (F64)mAvatarObject->mChatTimer.getElapsedTimeF32();
+		F64 elapsed_time = (F64)gAgentAvatar->mChatTimer.getElapsedTimeF32();
 		// add in frame time * 3 (so it ages 4x)
-		mAvatarObject->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
+		gAgentAvatar->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
 	}
 }
 
@@ -517,20 +514,20 @@ BOOL LLAgent::getFlying() const
 //-----------------------------------------------------------------------------
 void LLAgent::setFlying(BOOL fly)
 {
-	if (mAvatarObject.notNull())
+	if (isAgentAvatarValid())
 	{
 		// *HACK: Don't allow to start the flying mode if we got ANIM_AGENT_STANDUP signal
 		// because in this case we won't get a signal to start avatar flying animation and
 		// it will be walking with flying mode "ON" indication. However we allow to switch
 		// the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation().
 		// See EXT-2781.
-		if(fly && mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != mAvatarObject->mSignaledAnimations.end())
+		if(fly && gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatar->mSignaledAnimations.end())
 		{
 			return;
 		}
 
 		// don't allow taking off while sitting
-		if (fly && mAvatarObject->isSitting())
+		if (fly && gAgentAvatar->isSitting())
 		{
 			return;
 		}
@@ -583,9 +580,9 @@ void LLAgent::toggleFlying()
 bool LLAgent::enableFlying()
 {
 	BOOL sitting = FALSE;
-	if (gAgent.getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		sitting = gAgent.getAvatarObject()->isSitting();
+		sitting = gAgentAvatar->isSitting();
 	}
 	return !sitting;
 }
@@ -755,9 +752,9 @@ void LLAgent::sendReliableMessage()
 //-----------------------------------------------------------------------------
 LLVector3 LLAgent::getVelocity() const
 {
-	if (mAvatarObject.notNull())
+	if (isAgentAvatarValid())
 	{
-		return mAvatarObject->getVelocity();
+		return gAgentAvatar->getVelocity();
 	}
 	else
 	{
@@ -776,13 +773,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
 		llerrs << "setPositionAgent is not a number" << llendl;
 	}
 
-	if (mAvatarObject.notNull() && mAvatarObject->getParent())
+	if (isAgentAvatarValid() && gAgentAvatar->getParent())
 	{
 		LLVector3 pos_agent_sitting;
 		LLVector3d pos_agent_d;
-		LLViewerObject *parent = (LLViewerObject*)mAvatarObject->getParent();
+		LLViewerObject *parent = (LLViewerObject*)gAgentAvatar->getParent();
 
-		pos_agent_sitting = mAvatarObject->getPosition() * parent->getRotation() + parent->getPositionAgent();
+		pos_agent_sitting = gAgentAvatar->getPosition() * parent->getRotation() + parent->getPositionAgent();
 		pos_agent_d.setVec(pos_agent_sitting);
 
 		mFrameAgent.setOrigin(pos_agent_sitting);
@@ -803,9 +800,9 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
 //-----------------------------------------------------------------------------
 const LLVector3d &LLAgent::getPositionGlobal() const
 {
-	if (mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull())
+	if (isAgentAvatarValid() && !gAgentAvatar->mDrawable.isNull())
 	{
-		mPositionGlobal = getPosGlobalFromAgent(mAvatarObject->getRenderPosition());
+		mPositionGlobal = getPosGlobalFromAgent(gAgentAvatar->getRenderPosition());
 	}
 	else
 	{
@@ -820,9 +817,9 @@ const LLVector3d &LLAgent::getPositionGlobal() const
 //-----------------------------------------------------------------------------
 const LLVector3 &LLAgent::getPositionAgent()
 {
-	if(mAvatarObject.notNull() && !mAvatarObject->mDrawable.isNull())
+	if (isAgentAvatarValid() && !gAgentAvatar->mDrawable.isNull())
 	{
-		mFrameAgent.setOrigin(mAvatarObject->getRenderPosition());	
+		mFrameAgent.setOrigin(gAgentAvatar->getRenderPosition());	
 	}
 
 	return mFrameAgent.getOrigin();
@@ -948,21 +945,21 @@ LLVector3 LLAgent::getReferenceUpVector()
 {
 	// this vector is in the coordinate frame of the avatar's parent object, or the world if none
 	LLVector3 up_vector = LLVector3::z_axis;
-	if (mAvatarObject.notNull() && 
-		mAvatarObject->getParent() &&
-		mAvatarObject->mDrawable.notNull())
+	if (isAgentAvatarValid() && 
+		gAgentAvatar->getParent() &&
+		gAgentAvatar->mDrawable.notNull())
 	{
 		U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
 		// and in third person...
 		if (camera_mode == CAMERA_MODE_THIRD_PERSON)
 		{
 			// make the up vector point to the absolute +z axis
-			up_vector = up_vector * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation();
+			up_vector = up_vector * ~((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
 		}
 		else if (camera_mode == CAMERA_MODE_MOUSELOOK)
 		{
 			// make the up vector point to the avatar's +z axis
-			up_vector = up_vector * mAvatarObject->mDrawable->getRotation();
+			up_vector = up_vector * gAgentAvatar->mDrawable->getRotation();
 		}
 	}
 
@@ -998,7 +995,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
 
 	F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
 
-	if (mAvatarObject.notNull() && mAvatarObject->isSitting())
+	if (isAgentAvatarValid() && gAgentAvatar->isSitting())
 	{
 		look_down_limit = 130.f * DEG_TO_RAD;
 	}
@@ -1171,10 +1168,9 @@ void LLAgent::clearAFK()
 
 	// Gods can sometimes get into away state (via gestures)
 	// without setting the appropriate control flag. JC
-	LLVOAvatar* av = mAvatarObject;
 	if (mControlFlags & AGENT_CONTROL_AWAY
-		|| (av
-			&& (av->mSignaledAnimations.find(ANIM_AGENT_AWAY) != av->mSignaledAnimations.end())))
+		|| (isAgentAvatarValid()
+			&& (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatar->mSignaledAnimations.end())))
 	{
 		sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
 		clearControlFlags(AGENT_CONTROL_AWAY);
@@ -1235,7 +1231,7 @@ BOOL LLAgent::getBusy() const
 //-----------------------------------------------------------------------------
 void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::string& behavior_name, const LLQuaternion *target_rotation, void (*finish_callback)(BOOL, void *),  void *callback_data, F32 stop_distance, F32 rot_threshold)
 {
-	if (!gAgent.getAvatarObject())
+	if (!isAgentAvatarValid())
 	{
 		return;
 	}
@@ -1296,7 +1292,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
 	LLViewerObject *obj;
 
 	LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
-	F64 target_height = llmax((F64)gAgent.getAvatarObject()->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
+	F64 target_height = llmax((F64)gAgentAvatar->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
 
 	// clamp z value of target to minimum height above ground
 	mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
@@ -1396,12 +1392,9 @@ void LLAgent::autoPilot(F32 *delta_yaw)
 			mAutoPilotTargetGlobal = object->getPositionGlobal();
 		}
 		
-		if (mAvatarObject.isNull())
-		{
-			return;
-		}
+		if (!isAgentAvatarValid()) return;
 
-		if (mAvatarObject->mInAir)
+		if (gAgentAvatar->mInAir)
 		{
 			setFlying(TRUE);
 		}
@@ -1477,9 +1470,9 @@ void LLAgent::autoPilot(F32 *delta_yaw)
 		// If we're flying, handle autopilot points above or below you.
 		if (getFlying() && xy_distance < AUTOPILOT_HEIGHT_ADJUST_DISTANCE)
 		{
-			if (mAvatarObject.notNull())
+			if (isAgentAvatarValid())
 			{
-				F64 current_height = mAvatarObject->getPositionGlobal().mdV[VZ];
+				F64 current_height = gAgentAvatar->getPositionGlobal().mdV[VZ];
 				F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
 				F32 slope = delta_z / xy_distance;
 				if (slope > 0.45f && delta_z > 6.f)
@@ -1560,9 +1553,9 @@ void LLAgent::propagate(const F32 dt)
 	pitch(PITCH_RATE * mPitchKey * dt);
 	
 	// handle auto-land behavior
-	if (mAvatarObject.notNull())
+	if (isAgentAvatarValid())
 	{
-		BOOL in_air = mAvatarObject->mInAir;
+		BOOL in_air = gAgentAvatar->mInAir;
 		LLVector3 land_vel = getVelocity();
 		land_vel.mV[VZ] = 0.f;
 
@@ -1615,29 +1608,6 @@ std::ostream& operator<<(std::ostream &s, const LLAgent &agent)
 	return s;
 }
 
-
-// ------------------- Beginning of legacy LLCamera hack ----------------------
-// This section is included for legacy LLCamera support until
-// it is no longer needed.  Some legacy code must exist in 
-// non-legacy functions, and is labeled with "// legacy" comments.
-
-//-----------------------------------------------------------------------------
-// setAvatarObject()
-//-----------------------------------------------------------------------------
-void LLAgent::setAvatarObject(LLVOAvatarSelf *avatar)			
-{ 
-	mAvatarObject = avatar;
-
-	if (!avatar)
-	{
-		llinfos << "Setting LLAgent::mAvatarObject to NULL" << llendl;
-		return;
-	}
-	
-	gAgentCamera.setAvatarObject(avatar);
-	gAgentWearables.setAvatarObject(avatar);
-}
-
 // TRUE if your own avatar needs to be rendered.  Usually only
 // in third person and build.
 //-----------------------------------------------------------------------------
@@ -1809,26 +1779,26 @@ void LLAgent::endAnimationUpdateUI()
 		}
 
 		// Disable mouselook-specific animations
-		if (mAvatarObject.notNull())
+		if (isAgentAvatarValid())
 		{
-			if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
+			if( gAgentAvatar->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
 			{
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START);
@@ -1847,7 +1817,7 @@ void LLAgent::endAnimationUpdateUI()
 			gMorphView->setVisible( FALSE );
 		}
 
-		if (mAvatarObject.notNull())
+		if (isAgentAvatarValid())
 		{
 			if(mCustomAnim)
 			{
@@ -1907,43 +1877,43 @@ void LLAgent::endAnimationUpdateUI()
 
 		gConsole->setVisible( TRUE );
 
-		if (mAvatarObject.notNull())
+		if (isAgentAvatarValid())
 		{
 			// Trigger mouselook-specific animations
-			if( mAvatarObject->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
+			if( gAgentAvatar->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
 			{
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START);
 				}
-				if (mAvatarObject->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != mAvatarObject->mSignaledAnimations.end())
+				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatar->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START);
 				}
 			}
-			if (mAvatarObject->getParent())
+			if (gAgentAvatar->getParent())
 			{
 				LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
-				LLViewerObject* root_object = (LLViewerObject*)mAvatarObject->getRoot();
+				LLViewerObject* root_object = (LLViewerObject*)gAgentAvatar->getRoot();
 				if (root_object->flagCameraDecoupled())
 				{
 					resetAxes(at_axis);
 				}
 				else
 				{
-					resetAxes(at_axis * ~((LLViewerObject*)mAvatarObject->getParent())->getRenderRotation());
+					resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation());
 				}
 			}
 		}
@@ -1959,15 +1929,15 @@ void LLAgent::endAnimationUpdateUI()
 		}
 
 		// freeze avatar
-		if (mAvatarObject.notNull())
+		if (isAgentAvatarValid())
 		{
-			mPauseRequest = mAvatarObject->requestPause();
+			mPauseRequest = gAgentAvatar->requestPause();
 		}
 	}
 
-	if (getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		getAvatarObject()->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+		gAgentAvatar->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 	}
 
 	gFloaterTools->dirty();
@@ -2043,10 +2013,10 @@ void LLAgent::setStartPosition( U32 location_id )
 
     LLVector3 agent_pos = getPositionAgent();
 
-    if (mAvatarObject.notNull())
+    if (isAgentAvatarValid())
     {
         // the z height is at the agent's feet
-        agent_pos.mV[VZ] -= 0.5f * mAvatarObject->mBodySize.mV[VZ];
+        agent_pos.mV[VZ] -= 0.5f * gAgentAvatar->mBodySize.mV[VZ];
     }
 
     agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
@@ -2153,7 +2123,7 @@ void LLAgent::onAnimStop(const LLUUID& id)
 		setControlFlags(AGENT_CONTROL_FINISH_ANIM);
 
 		// now trigger dusting self off animation
-		if (mAvatarObject.notNull() && !mAvatarObject->mBelowWater && rand() % 3 == 0)
+		if (isAgentAvatarValid() && !gAgentAvatar->mBelowWater && rand() % 3 == 0)
 			sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
 	}
 	else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
@@ -2352,9 +2322,9 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
 		name.erase(0, name.length());
 	}
 
-	if (mAvatarObject.notNull())
+	if (isAgentAvatarValid())
 	{
-		name += mAvatarObject->getFullname();
+		name += gAgentAvatar->getFullname();
 	}
 }
 
@@ -2500,14 +2470,14 @@ BOOL LLAgent::canJoinGroups() const
 
 LLQuaternion LLAgent::getHeadRotation()
 {
-	if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
+	if (!isAgentAvatarValid() || !gAgentAvatar->mPelvisp || !gAgentAvatar->mHeadp)
 	{
 		return LLQuaternion::DEFAULT;
 	}
 
 	if (!gAgentCamera.cameraMouselook())
 	{
-		return mAvatarObject->getRotation();
+		return gAgentAvatar->getRotation();
 	}
 
 	// We must be in mouselook
@@ -2516,9 +2486,9 @@ LLQuaternion LLAgent::getHeadRotation()
 	LLVector3 left = up % look_dir;
 
 	LLQuaternion rot(look_dir, left, up);
-	if (mAvatarObject->getParent())
+	if (gAgentAvatar->getParent())
 	{
-		rot = rot * ~mAvatarObject->getParent()->getRotation();
+		rot = rot * ~gAgentAvatar->getParent()->getRotation();
 	}
 
 	return rot;
@@ -3141,8 +3111,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 {
 	gAgentQueryManager.mNumPendingQueries--;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp || avatarp->isDead())
+	if (!isAgentAvatarValid() || gAgentAvatar->isDead())
 	{
 		llwarns << "No avatar for user in cached texture update!" << llendl;
 		return;
@@ -3175,27 +3144,27 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 			if (texture_id.notNull())
 			{
 				//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
-				avatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
-				//avatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
+				gAgentAvatar->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
+				//gAgentAvatar->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
 				gAgentQueryManager.mActiveCacheQueries[texture_index] = 0;
 				num_results++;
 			}
 			else
 			{
 				// no cache of this bake. request upload.
-				avatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index);
+				gAgentAvatar->requestLayerSetUpload((EBakedTextureIndex)texture_index);
 			}
 		}
 	}
 
 	llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
 
-	avatarp->updateMeshTextures();
+	gAgentAvatar->updateMeshTextures();
 
 	if (gAgentQueryManager.mNumPendingQueries == 0)
 	{
 		// RN: not sure why composites are disabled at this point
-		avatarp->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
 		gAgent.sendAgentSetAppearance();
 	}
 }
@@ -3248,11 +3217,10 @@ BOOL LLAgent::getHomePosGlobal( LLVector3d* pos_global )
 
 void LLAgent::clearVisualParams(void *data)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		avatarp->clearVisualParamWeights();
-		avatarp->updateVisualParams();
+		gAgentAvatar->clearVisualParamWeights();
+		gAgentAvatar->updateVisualParams();
 	}
 }
 
@@ -3276,16 +3244,15 @@ bool LLAgent::teleportCore(bool is_local)
 	// sync with other viewers. Discuss in DEV-14145/VWR-6744 before reenabling.
 
 	// Stop all animation before actual teleporting 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-        if (avatarp)
+        if (isAgentAvatarValid())
 	{
-		for ( LLVOAvatar::AnimIterator anim_it= avatarp->mPlayingAnimations.begin();
-		      anim_it != avatarp->mPlayingAnimations.end();
+		for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatar->mPlayingAnimations.begin();
+		      anim_it != gAgentAvatar->mPlayingAnimations.end();
 		      ++anim_it)
                {
-                       avatarp->stopMotion(anim_it->first);
+                       gAgentAvatar->stopMotion(anim_it->first);
                }
-               avatarp->processAnimationStateChanges();
+               gAgentAvatar->processAnimationStateChanges();
        }
 #endif
 
@@ -3478,13 +3445,11 @@ void LLAgent::stopCurrentAnimations()
 {
 	// This function stops all current overriding animations on this
 	// avatar, propagating this change back to the server.
-
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
 		for ( LLVOAvatar::AnimIterator anim_it =
-			      avatarp->mPlayingAnimations.begin();
-		      anim_it != avatarp->mPlayingAnimations.end();
+			      gAgentAvatar->mPlayingAnimations.begin();
+		      anim_it != gAgentAvatar->mPlayingAnimations.end();
 		      anim_it++)
 		{
 			if (anim_it->first ==
@@ -3497,7 +3462,7 @@ void LLAgent::stopCurrentAnimations()
 			else
 			{
 				// stop this animation locally
-				avatarp->stopMotion(anim_it->first, TRUE);
+				gAgentAvatar->stopMotion(anim_it->first, TRUE);
 				// ...and tell the server to tell everyone.
 				sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
 			}
@@ -3604,7 +3569,7 @@ void LLAgent::requestLeaveGodMode()
 //-----------------------------------------------------------------------------
 void LLAgent::sendAgentSetAppearance()
 {
-	if (mAvatarObject.isNull()) return;
+	if (!isAgentAvatarValid()) return;
 
 	if (gAgentQueryManager.mNumPendingQueries > 0 && !gAgentCamera.cameraCustomizeAvatar()) 
 	{
@@ -3612,7 +3577,7 @@ void LLAgent::sendAgentSetAppearance()
 	}
 
 
-	llinfos << "TAT: Sent AgentSetAppearance: " << mAvatarObject->getBakedStatusForPrintout() << llendl;
+	llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatar->getBakedStatusForPrintout() << llendl;
 	//dumpAvatarTEs( "sendAgentSetAppearance()" );
 
 	LLMessageSystem* msg = gMessageSystem;
@@ -3626,7 +3591,7 @@ void LLAgent::sendAgentSetAppearance()
 	// NOTE -- when we start correcting all of the other Havok geometry 
 	// to compensate for the COLLISION_TOLERANCE ugliness we will have 
 	// to tweak this number again
-	const LLVector3 body_size = mAvatarObject->mBodySize;
+	const LLVector3 body_size = gAgentAvatar->mBodySize;
 	msg->addVector3Fast(_PREHASH_Size, body_size);	
 
 	// To guard against out of order packets
@@ -3636,20 +3601,20 @@ void LLAgent::sendAgentSetAppearance()
 
 	// is texture data current relative to wearables?
 	// KLW - TAT this will probably need to check the local queue.
-	BOOL textures_current = mAvatarObject->areTexturesCurrent();
+	BOOL textures_current = gAgentAvatar->areTexturesCurrent();
 
 	for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
 	{
 		const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
 
 		// if we're not wearing a skirt, we don't need the texture to be baked
-		if (texture_index == TEX_SKIRT_BAKED && !mAvatarObject->isWearingWearableType(WT_SKIRT))
+		if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatar->isWearingWearableType(WT_SKIRT))
 		{
 			continue;
 		}
 
 		// IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures
-		if (!mAvatarObject->isTextureDefined(texture_index, 0))
+		if (!gAgentAvatar->isTextureDefined(texture_index, 0))
 		{
 			textures_current = FALSE;
 			break;
@@ -3687,7 +3652,7 @@ void LLAgent::sendAgentSetAppearance()
 			msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
 		}
 		msg->nextBlockFast(_PREHASH_ObjectData);
-		mAvatarObject->sendAppearanceMessage( gMessageSystem );
+		gAgentAvatar->sendAppearanceMessage( gMessageSystem );
 	}
 	else
 	{
@@ -3700,9 +3665,9 @@ void LLAgent::sendAgentSetAppearance()
 
 
 	S32 transmitted_params = 0;
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*)mAvatarObject->getFirstVisualParam();
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatar->getFirstVisualParam();
 		 param;
-		 param = (LLViewerVisualParam*)mAvatarObject->getNextVisualParam())
+		 param = (LLViewerVisualParam*)gAgentAvatar->getNextVisualParam())
 	{
 		if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 		{
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 891ce799d2..53b4fea1dc 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -51,7 +51,6 @@ extern const U8 	AGENT_STATE_TYPING;  // Typing indication
 extern const U8 	AGENT_STATE_EDITING; // Set when agent has objects selected
 
 class LLChat;
-class LLVOAvatarSelf;
 class LLViewerRegion;
 class LLMotion;
 class LLToolset;
@@ -109,7 +108,6 @@ public:
 	virtual 		~LLAgent();
 	void			init();
 	void			cleanup();
-	void			setAvatarObject(LLVOAvatarSelf *avatar);
 
 	//--------------------------------------------------------------------
 	// Login
@@ -171,20 +169,6 @@ private:
  **                                                                            **
  *******************************************************************************/
 
-/********************************************************************************
- **                                                                            **
- **                    GENERAL ACCESSORS
- **/
-
-public:
- 	LLVOAvatarSelf* getAvatarObject() const		{ return mAvatarObject; }
-private:
-	LLPointer<LLVOAvatarSelf> mAvatarObject; 	// NULL until avatar object sent down from simulator
-
-/**                    General Accessors
- **                                                                            **
- *******************************************************************************/
-
 /********************************************************************************
  **                                                                            **
  **                    POSITION
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index b9555e1a37..62f1746f28 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -372,10 +372,9 @@ void LLAgentCamera::unlockView()
 {
 	if (getFocusOnAvatar())
 	{
-		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
-			setFocusGlobal(LLVector3d::zero, avatarp->mID);
+			setFocusGlobal(LLVector3d::zero, gAgentAvatar->mID);
 		}
 		setFocusOnAvatar(FALSE, FALSE);	// no animation
 	}
@@ -1092,30 +1091,25 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 {
 	static LLVector3 last_at_axis;
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+	if (!isAgentAvatarValid()) return;
 
-	if (!avatarp)
-	{
-		return;
-	}
-
-	LLQuaternion av_inv_rot = ~avatarp->mRoot.getWorldRotation();
-	LLVector3 root_at = LLVector3::x_axis * avatarp->mRoot.getWorldRotation();
+	LLQuaternion av_inv_rot = ~gAgentAvatar->mRoot.getWorldRotation();
+	LLVector3 root_at = LLVector3::x_axis * gAgentAvatar->mRoot.getWorldRotation();
 
 	if 	((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) &&
 		 (root_at * last_at_axis > 0.95f))
 	{
-		LLVector3 vel = avatarp->getVelocity();
+		LLVector3 vel = gAgentAvatar->getVelocity();
 		if (vel.magVecSquared() > 4.f)
 		{
-			setLookAt(LOOKAT_TARGET_IDLE, avatarp, vel * av_inv_rot);
+			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatar, vel * av_inv_rot);
 		}
 		else
 		{
 			// *FIX: rotate mframeagent by sit object's rotation?
-			LLQuaternion look_rotation = avatarp->isSitting() ? avatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
+			LLQuaternion look_rotation = gAgentAvatar->isSitting() ? gAgentAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
 			LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot;
-			setLookAt(LOOKAT_TARGET_IDLE, avatarp, look_offset);
+			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatar, look_offset);
 		}
 		last_at_axis = root_at;
 		return;
@@ -1125,7 +1119,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 	
 	if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
 	{
-		setLookAt(LOOKAT_TARGET_NONE, avatarp, LLVector3(-2.f, 0.f, 0.f));	
+		setLookAt(LOOKAT_TARGET_NONE, gAgentAvatar, LLVector3(-2.f, 0.f, 0.f));	
 	}
 	else
 	{
@@ -1154,7 +1148,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 		headLookAxis = frameCamera.getAtAxis();
 		// RN: we use world-space offset for mouselook and freelook
 		//headLookAxis = headLookAxis * av_inv_rot;
-		setLookAt(lookAtType, avatarp, headLookAxis);
+		setLookAt(lookAtType, gAgentAvatar, headLookAxis);
 	}
 }
 
@@ -1175,15 +1169,13 @@ void LLAgentCamera::updateCamera()
 
 	validateFocusObject();
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
-	if (avatarp && 
-		avatarp->isSitting() &&
+	if (isAgentAvatarValid() && 
+		gAgentAvatar->isSitting() &&
 		camera_mode == CAMERA_MODE_MOUSELOOK)
 	{
 		//Ventrella
 		//changed camera_skyward to the new global "mCameraUpVector"
-		mCameraUpVector = mCameraUpVector * avatarp->getRenderRotation();
+		mCameraUpVector = mCameraUpVector * gAgentAvatar->getRenderRotation();
 		//end Ventrella
 	}
 
@@ -1291,7 +1283,7 @@ void LLAgentCamera::updateCamera()
 	//Ventrella
 	if ( mCameraMode == CAMERA_MODE_FOLLOW )
 	{
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
 			//--------------------------------------------------------------------------------
 			// this is where the avatar's position and rotation are given to followCam, and 
@@ -1299,13 +1291,13 @@ void LLAgentCamera::updateCamera()
 			// (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent.
 			//--------------------------------------------------------------------------------
 			// *TODO: use combined rotation of frameagent and sit object
-			LLQuaternion avatarRotationForFollowCam = avatarp->isSitting() ? avatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
+			LLQuaternion avatarRotationForFollowCam = gAgentAvatar->isSitting() ? gAgentAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
 
 			LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams();
 			if (current_cam)
 			{
 				mFollowCam.copyParams(*current_cam);
-				mFollowCam.setSubjectPositionAndRotation( avatarp->getRenderPosition(), avatarRotationForFollowCam );
+				mFollowCam.setSubjectPositionAndRotation( gAgentAvatar->getRenderPosition(), avatarRotationForFollowCam );
 				mFollowCam.update();
 				LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
 			}
@@ -1380,9 +1372,9 @@ void LLAgentCamera::updateCamera()
 			gAgent.setShowAvatar(TRUE);
 		}
 
-		if (avatarp && (mCameraMode != CAMERA_MODE_MOUSELOOK))
+		if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK))
 		{
-			avatarp->updateAttachmentVisibility(mCameraMode);
+			gAgentAvatar->updateAttachmentVisibility(mCameraMode);
 		}
 	}
 	else 
@@ -1480,40 +1472,40 @@ void LLAgentCamera::updateCamera()
 	}
 	gAgent.setLastPositionGlobal(global_pos);
 	
-	if (LLVOAvatar::sVisibleInFirstPerson && avatarp && !avatarp->isSitting() && cameraMouselook())
+	if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatar->isSitting() && cameraMouselook())
 	{
-		LLVector3 head_pos = avatarp->mHeadp->getWorldPosition() + 
-			LLVector3(0.08f, 0.f, 0.05f) * avatarp->mHeadp->getWorldRotation() + 
-			LLVector3(0.1f, 0.f, 0.f) * avatarp->mPelvisp->getWorldRotation();
+		LLVector3 head_pos = gAgentAvatar->mHeadp->getWorldPosition() + 
+			LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatar->mHeadp->getWorldRotation() + 
+			LLVector3(0.1f, 0.f, 0.f) * gAgentAvatar->mPelvisp->getWorldRotation();
 		LLVector3 diff = mCameraPositionAgent - head_pos;
-		diff = diff * ~avatarp->mRoot.getWorldRotation();
+		diff = diff * ~gAgentAvatar->mRoot.getWorldRotation();
 
-		LLJoint* torso_joint = avatarp->mTorsop;
-		LLJoint* chest_joint = avatarp->mChestp;
+		LLJoint* torso_joint = gAgentAvatar->mTorsop;
+		LLJoint* chest_joint = gAgentAvatar->mChestp;
 		LLVector3 torso_scale = torso_joint->getScale();
 		LLVector3 chest_scale = chest_joint->getScale();
 
 		// shorten avatar skeleton to avoid foot interpenetration
-		if (!avatarp->mInAir)
+		if (!gAgentAvatar->mInAir)
 		{
 			LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation();
 			F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f);
 			F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f);
 			torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
 
-			LLJoint* neck_joint = avatarp->mNeckp;
+			LLJoint* neck_joint = gAgentAvatar->mNeckp;
 			LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation();
 			scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f);
 			chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
 			diff.mV[VZ] = 0.f;
 		}
 
-		avatarp->mPelvisp->setPosition(avatarp->mPelvisp->getPosition() + diff);
+		gAgentAvatar->mPelvisp->setPosition(gAgentAvatar->mPelvisp->getPosition() + diff);
 
-		avatarp->mRoot.updateWorldMatrixChildren();
+		gAgentAvatar->mRoot.updateWorldMatrixChildren();
 
-		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-			 iter != avatarp->mAttachmentPoints.end(); )
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatar->mAttachmentPoints.end(); )
 		{
 			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 			LLViewerJointAttachment* attachment = curiter->second;
@@ -1605,8 +1597,6 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
 		clearFocusObject();
 	}
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
 	// Ventrella
 	if (mCameraMode == CAMERA_MODE_FOLLOW && mFocusOnAvatar)
 	{
@@ -1617,12 +1607,12 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
 	{
 		LLVector3d at_axis(1.0, 0.0, 0.0);
 		LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
-		if (avatarp && avatarp->getParent())
+		if (isAgentAvatarValid() && gAgentAvatar->getParent())
 		{
-			LLViewerObject* root_object = (LLViewerObject*)avatarp->getRoot();
+			LLViewerObject* root_object = (LLViewerObject*)gAgentAvatar->getRoot();
 			if (!root_object->flagCameraDecoupled())
 			{
-				agent_rot *= ((LLViewerObject*)(avatarp->getParent()))->getRenderRotation();
+				agent_rot *= ((LLViewerObject*)(gAgentAvatar->getParent()))->getRenderRotation();
 			}
 		}
 		at_axis = at_axis * agent_rot;
@@ -1672,7 +1662,7 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
 		}
 		return mFocusTargetGlobal;
 	}
-	else if (mSitCameraEnabled && avatarp && avatarp->isSitting() && mSitCameraReferenceObject.notNull())
+	else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatar->isSitting() && mSitCameraReferenceObject.notNull())
 	{
 		// sit camera
 		LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
@@ -1691,12 +1681,10 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
 {
 	// ...offset from avatar
 	LLVector3d focus_offset;
-
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
-	if (avatarp && avatarp->getParent())
+	if (isAgentAvatarValid() && gAgentAvatar->getParent())
 	{
-		agent_rot *= ((LLViewerObject*)(avatarp->getParent()))->getRenderRotation();
+		agent_rot *= ((LLViewerObject*)(gAgentAvatar->getParent()))->getRenderRotation();
 	}
 
 	focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot;
@@ -1705,12 +1693,10 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
 
 void LLAgentCamera::setupSitCamera()
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
 	// agent frame entering this function is in world coordinates
-	if (avatarp && avatarp->getParent())
+	if (isAgentAvatarValid() && gAgentAvatar->getParent())
 	{
-		LLQuaternion parent_rot = ((LLViewerObject*)avatarp->getParent())->getRenderRotation();
+		LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
 		// slam agent coordinate frame to proper parent local version
 		LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis();
 		at_axis.mV[VZ] = 0.f;
@@ -1773,13 +1759,11 @@ F32	LLAgentCamera::calcCameraFOVZoomFactor()
 //-----------------------------------------------------------------------------
 LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
 	// Compute base camera position and look-at points.
 	F32			camera_land_height;
-	LLVector3d	frame_center_global = !avatarp ? 
+	LLVector3d	frame_center_global = !isAgentAvatarValid() ? 
 		gAgent.getPositionGlobal() :
-		gAgent.getPosGlobalFromAgent(avatarp->mRoot.getWorldPosition());
+		gAgent.getPosGlobalFromAgent(gAgentAvatar->mRoot.getWorldPosition());
 	
 	BOOL		isConstrained = FALSE;
 	LLVector3d	head_offset;
@@ -1794,32 +1778,32 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 	}// End Ventrella
 	else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
 	{
-		if (!avatarp || avatarp->mDrawable.isNull())
+		if (!isAgentAvatarValid() || gAgentAvatar->mDrawable.isNull())
 		{
 			llwarns << "Null avatar drawable!" << llendl;
 			return LLVector3d::zero;
 		}
 		head_offset.clearVec();
-		if (avatarp->isSitting() && avatarp->getParent())
+		if (gAgentAvatar->isSitting() && gAgentAvatar->getParent())
 		{
-			avatarp->updateHeadOffset();
-			head_offset.mdV[VX] = avatarp->mHeadOffset.mV[VX];
-			head_offset.mdV[VY] = avatarp->mHeadOffset.mV[VY];
-			head_offset.mdV[VZ] = avatarp->mHeadOffset.mV[VZ] + 0.1f;
-			const LLMatrix4& mat = ((LLViewerObject*) avatarp->getParent())->getRenderMatrix();
+			gAgentAvatar->updateHeadOffset();
+			head_offset.mdV[VX] = gAgentAvatar->mHeadOffset.mV[VX];
+			head_offset.mdV[VY] = gAgentAvatar->mHeadOffset.mV[VY];
+			head_offset.mdV[VZ] = gAgentAvatar->mHeadOffset.mV[VZ] + 0.1f;
+			const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatar->getParent())->getRenderMatrix();
 			camera_position_global = gAgent.getPosGlobalFromAgent
-								((avatarp->getPosition()+
-								 LLVector3(head_offset)*avatarp->getRotation()) * mat);
+								((gAgentAvatar->getPosition()+
+								 LLVector3(head_offset)*gAgentAvatar->getRotation()) * mat);
 		}
 		else
 		{
-			head_offset.mdV[VZ] = avatarp->mHeadOffset.mV[VZ];
-			if (avatarp->isSitting())
+			head_offset.mdV[VZ] = gAgentAvatar->mHeadOffset.mV[VZ];
+			if (gAgentAvatar->isSitting())
 			{
 				head_offset.mdV[VZ] += 0.1;
 			}
-			camera_position_global = gAgent.getPosGlobalFromAgent(avatarp->getRenderPosition());//frame_center_global;
-			head_offset = head_offset * avatarp->getRenderRotation();
+			camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatar->getRenderPosition());//frame_center_global;
+			head_offset = head_offset * gAgentAvatar->getRenderRotation();
 			camera_position_global = camera_position_global + head_offset;
 		}
 	}
@@ -1829,8 +1813,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 		F32 camera_distance = 0.f;
 
 		if (mSitCameraEnabled 
-			&& avatarp 
-			&& avatarp->isSitting() 
+			&& isAgentAvatarValid() 
+			&& gAgentAvatar->isSitting() 
 			&& mSitCameraReferenceObject.notNull())
 		{
 			// sit camera
@@ -1846,9 +1830,9 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 			local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale");
 			
 			// are we sitting down?
-			if (avatarp && avatarp->getParent())
+			if (isAgentAvatarValid() && gAgentAvatar->getParent())
 			{
-				LLQuaternion parent_rot = ((LLViewerObject*)avatarp->getParent())->getRenderRotation();
+				LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
 				// slam agent coordinate frame to proper parent local version
 				LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot;
 				at_axis.mV[VZ] = 0.f;
@@ -1862,7 +1846,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 				local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
 			}
 
-			if (!mCameraCollidePlane.isExactlyZero() && (!avatarp || !avatarp->isSitting()))
+			if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatar->isSitting()))
 			{
 				LLVector3 plane_normal;
 				plane_normal.setVec(mCameraCollidePlane.mV);
@@ -1915,11 +1899,11 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 			// set the global camera position
 			LLVector3d camera_offset;
 			
-			LLVector3 av_pos = !avatarp ? LLVector3::zero : avatarp->getRenderPosition();
+			LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : gAgentAvatar->getRenderPosition();
 			camera_offset.setVec( local_camera_offset );
 			camera_position_global = frame_center_global + head_offset + camera_offset;
 
-			if (avatarp)
+			if (isAgentAvatarValid())
 			{
 				LLVector3d camera_lag_d;
 				F32 lag_interp = LLCriticalDamp::getInterpolant(CAMERA_LAG_HALF_LIFE);
@@ -1927,8 +1911,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 				LLVector3 vel = gAgent.getVelocity();
 
 				// lag by appropriate amount for flying
-				F32 time_in_air = avatarp->mTimeInAir.getElapsedTimeF32();
-				if(!mCameraAnimating && avatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
+				F32 time_in_air = gAgentAvatar->mTimeInAir.getElapsedTimeF32();
+				if(!mCameraAnimating && gAgentAvatar->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
 				{
 					LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis();
 					frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector());
@@ -1940,7 +1924,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 
 					lag_interp *= u;
 
-					if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == avatarp->getID())
+					if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatar->getID())
 					{
 						// disable camera lag when using mouse-directed steering
 						target_lag.clearVec();
@@ -2141,8 +2125,6 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
 		return;
 	}
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
 	// visibility changes at end of animation
 	gViewerWindow->getWindow()->resetBusyCount();
 
@@ -2151,10 +2133,10 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
 
 	LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
 
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		avatarp->stopMotion(ANIM_AGENT_BODY_NOISE);
-		avatarp->stopMotion(ANIM_AGENT_BREATHE_ROT);
+		gAgentAvatar->stopMotion(ANIM_AGENT_BODY_NOISE);
+		gAgentAvatar->stopMotion(ANIM_AGENT_BREATHE_ROT);
 	}
 
 	//gViewerWindow->stopGrab();
@@ -2239,12 +2221,11 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
 			LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
 		}
 
-		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
-			avatarp->mPelvisp->setPosition(LLVector3::zero);
-			avatarp->startMotion( ANIM_AGENT_BODY_NOISE );
-			avatarp->startMotion( ANIM_AGENT_BREATHE_ROT );
+			gAgentAvatar->mPelvisp->setPosition(LLVector3::zero);
+			gAgentAvatar->startMotion( ANIM_AGENT_BODY_NOISE );
+			gAgentAvatar->startMotion( ANIM_AGENT_BREATHE_ROT );
 		}
 
 		// unpause avatar animation
@@ -2283,15 +2264,14 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 
 	mCameraZoomFraction = INITIAL_ZOOM_FRACTION;
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		if (!avatarp->isSitting())
+		if (!gAgentAvatar->isSitting())
 		{
-			avatarp->mPelvisp->setPosition(LLVector3::zero);
+			gAgentAvatar->mPelvisp->setPosition(LLVector3::zero);
 		}
-		avatarp->startMotion(ANIM_AGENT_BODY_NOISE);
-		avatarp->startMotion(ANIM_AGENT_BREATHE_ROT);
+		gAgentAvatar->startMotion(ANIM_AGENT_BODY_NOISE);
+		gAgentAvatar->startMotion(ANIM_AGENT_BREATHE_ROT);
 	}
 
 	LLVector3 at_axis;
@@ -2325,9 +2305,9 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 	}
 
 	// Remove any pitch from the avatar
-	if (avatarp && avatarp->getParent())
+	if (isAgentAvatarValid() && gAgentAvatar->getParent())
 	{
-		LLQuaternion obj_rot = ((LLViewerObject*)avatarp->getParent())->getRenderRotation();
+		LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
 		at_axis = LLViewerCamera::getInstance()->getAtAxis();
 		at_axis.mV[VZ] = 0.f;
 		at_axis.normalize();
@@ -2399,8 +2379,7 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 		LLVOAvatarSelf::onCustomizeStart();
 	}
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
 		if(avatar_animate)
 		{
@@ -2412,8 +2391,8 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 
 			gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START);
 			gAgent.setCustomAnim(TRUE);
-			avatarp->startMotion(ANIM_AGENT_CUSTOMIZE);
-			LLMotion* turn_motion = avatarp->findMotion(ANIM_AGENT_CUSTOMIZE);
+			gAgentAvatar->startMotion(ANIM_AGENT_CUSTOMIZE);
+			LLMotion* turn_motion = gAgentAvatar->findMotion(ANIM_AGENT_CUSTOMIZE);
 
 			if (turn_motion)
 			{
@@ -2516,16 +2495,15 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 	setFocusObject(gObjectList.findObject(object_id));
 	LLVector3d old_focus = mFocusTargetGlobal;
 	LLViewerObject *focus_obj = mFocusObject;
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 
 	// if focus has changed
 	if (old_focus != focus)
 	{
 		if (focus.isExactlyZero())
 		{
-			if (avatarp)
+			if (isAgentAvatarValid())
 			{
-				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(avatarp->mHeadp->getWorldPosition());
+				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatar->mHeadp->getWorldPosition());
 			}
 			else
 			{
@@ -2568,9 +2546,9 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 	{
 		if (focus.isExactlyZero())
 		{
-			if (avatarp)
+			if (isAgentAvatarValid())
 			{
-				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(avatarp->mHeadp->getWorldPosition());
+				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatar->mHeadp->getWorldPosition());
 			}
 			else
 			{
@@ -2707,10 +2685,9 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
 		if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
 		{
 			LLVector3 at_axis;
-			LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-			if (avatarp && avatarp->getParent())
+			if (isAgentAvatarValid() && gAgentAvatar->getParent())
 			{
-				LLQuaternion obj_rot = ((LLViewerObject*)avatarp->getParent())->getRenderRotation();
+				LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
 				at_axis = LLViewerCamera::getInstance()->getAtAxis();
 				at_axis.mV[VZ] = 0.f;
 				at_axis.normalize();
@@ -2738,16 +2715,15 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
 
 BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, LLVector3 position)
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	if(object && object->isAttachment())
 	{
 		LLViewerObject* parent = object;
 		while(parent)
 		{
-			if (parent == avatarp)
+			if (parent == gAgentAvatar)
 			{
 				// looking at an attachment on ourselves, which we don't want to do
-				object = avatarp;
+				object = gAgentAvatar;
 				position.clearVec();
 			}
 			parent = (LLViewerObject*)parent->getParent();
@@ -2756,7 +2732,7 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L
 	if(!mLookAt || mLookAt->isDead())
 	{
 		mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
-		mLookAt->setSourceObject(avatarp);
+		mLookAt->setSourceObject(gAgentAvatar);
 	}
 
 	return mLookAt->setLookAt(target_type, object, position);
@@ -2779,14 +2755,13 @@ void LLAgentCamera::lookAtLastChat()
 		return;
 	}
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	LLVector3 delta_pos;
 	if (chatter->isAvatar())
 	{
 		LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
-		if (avatarp && chatter_av->mHeadp)
+		if (isAgentAvatarValid() && chatter_av->mHeadp)
 		{
-			delta_pos = chatter_av->mHeadp->getWorldPosition() - avatarp->mHeadp->getWorldPosition();
+			delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatar->mHeadp->getWorldPosition();
 		}
 		else
 		{
@@ -2798,7 +2773,7 @@ void LLAgentCamera::lookAtLastChat()
 
 		changeCameraToThirdPerson();
 
-		LLVector3 new_camera_pos = avatarp->mHeadp->getWorldPosition();
+		LLVector3 new_camera_pos = gAgentAvatar->mHeadp->getWorldPosition();
 		LLVector3 left = delta_pos % LLVector3::z_axis;
 		left.normalize();
 		LLVector3 up = left % delta_pos;
@@ -2827,7 +2802,7 @@ void LLAgentCamera::lookAtLastChat()
 
 		changeCameraToThirdPerson();
 
-		LLVector3 new_camera_pos = avatarp->mHeadp->getWorldPosition();
+		LLVector3 new_camera_pos = gAgentAvatar->mHeadp->getWorldPosition();
 		LLVector3 left = delta_pos % LLVector3::z_axis;
 		left.normalize();
 		LLVector3 up = left % delta_pos;
@@ -2852,8 +2827,7 @@ BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object,
 	if (!mPointAt || mPointAt->isDead())
 	{
 		mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
-		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-		mPointAt->setSourceObject(avatarp);
+		mPointAt->setSourceObject(gAgentAvatar);
 	}
 	return mPointAt->setPointAt(target_type, object, position);
 }
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 97e956c082..452a11b01e 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -49,12 +49,10 @@
 void LLAgentUI::buildName(std::string& name)
 {
 	name.clear();
-
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		LLNameValue *first_nv = avatarp->getNVPair("FirstName");
-		LLNameValue *last_nv = avatarp->getNVPair("LastName");
+		LLNameValue *first_nv = gAgentAvatar->getNVPair("FirstName");
+		LLNameValue *last_nv = gAgentAvatar->getNVPair("LastName");
 		if (first_nv && last_nv)
 		{
 			name = first_nv->printData() + " " + last_nv->printData();
@@ -73,8 +71,8 @@ void LLAgentUI::buildName(std::string& name)
 //static
 void LLAgentUI::buildFullname(std::string& name)
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (avatarp) name = avatarp->getFullname();
+	if (isAgentAvatarValid())
+		name = gAgentAvatar->getFullname();
 }
 
 //static
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index aec8c6e403..91552a7f5b 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -485,8 +485,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
 			return;
 		}
 
-		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-		avatarp->wearableUpdated( type, TRUE );
+		gAgentAvatar->wearableUpdated( type, TRUE );
 
 		if (send_update)
 		{
@@ -784,8 +783,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
 
 void LLAgentWearables::wearableUpdated(LLWearable *wearable)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	avatarp->wearableUpdated(wearable->getType(), TRUE);
+	gAgentAvatar->wearableUpdated(wearable->getType(), TRUE);
 	wearable->refreshName();
 	wearable->setLabelUpdated();
 
@@ -826,11 +824,10 @@ void LLAgentWearables::popWearable(LLWearable *wearable)
 void LLAgentWearables::popWearable(const EWearableType type, U32 index)
 {
 	LLWearable *wearable = getWearable(type, index);
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	if (wearable)
 	{
 		mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
-		avatarp->wearableUpdated(wearable->getType(), TRUE);
+		gAgentAvatar->wearableUpdated(wearable->getType(), TRUE);
 		wearable->setLabelUpdated();
 	}
 }
@@ -962,8 +959,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 	LLUUID agent_id;
 	gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && (agent_id == avatarp->getID()))
+	if (isAgentAvatarValid() && (agent_id == gAgentAvatar->getID()))
 	{
 		gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum);
 		
@@ -1055,11 +1051,7 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
 	const EWearableType type = wear_data->mType;
 	U32 index = 0;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 		
 	if (wearable)
 	{
@@ -1069,9 +1061,9 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
 		gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID);
 
 		// disable composites if initial textures are baked
-		avatarp->setupComposites();
+		gAgentAvatar->setupComposites();
 
-		avatarp->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
 		gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
 	}
 	else
@@ -1100,7 +1092,7 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
 		// If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
 		if (gAgentCamera.cameraCustomizeAvatar())
 		{
-			avatarp->requestLayerSetUploads();
+			gAgentAvatar->requestLayerSetUploads();
 		}
 	}
 }
@@ -1240,13 +1232,9 @@ void LLAgentWearables::createStandardWearables(BOOL female)
 	llwarns << "Creating Standard " << (female ? "female" : "male")
 			<< " Wearables" << llendl;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
-	avatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
+	gAgentAvatar->setSex(female ? SEX_FEMALE : SEX_MALE);
 
 	const BOOL create[WT_COUNT] = 
 		{
@@ -1294,11 +1282,8 @@ void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
 {
 	llinfos << "type " << type << " index " << index << llendl;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
-	{
-		avatarp->updateVisualParams();
-	}
+	if (!isAgentAvatarValid()) return;
+	gAgentAvatar->updateVisualParams();
 }
 
 void LLAgentWearables::createStandardWearablesAllDone()
@@ -1313,8 +1298,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
 	updateServer();
 
 	// Treat this as the first texture entry message, if none received yet
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	avatarp->onFirstTEMessageReceived();
+	gAgentAvatar->onFirstTEMessageReceived();
 }
 
 // MULTI-WEARABLE: Properly handle multiwearables later.
@@ -1336,11 +1320,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
 									 const LLDynamicArray<S32>& attachments_to_include,
 									 BOOL rename_clothing)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	// First, make a folder in the Clothes directory.
 	LLUUID folder_id = gInventory.createNewCategory(
@@ -1438,7 +1418,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
 		for (S32 i = 0; i < attachments_to_include.count(); i++)
 		{
 			S32 attachment_pt = attachments_to_include[i];
-			LLViewerJointAttachment* attachment = get_if_there(avatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
+			LLViewerJointAttachment* attachment = get_if_there(gAgentAvatar->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
 			if (!attachment) continue;
 			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
 				 attachment_iter != attachment->mAttachedObjects.end();
@@ -1513,11 +1493,7 @@ private:
 
 LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return LLUUID::null;
-	}
+	if (!isAgentAvatarValid()) return LLUUID::null;
 
 	// First, make a folder in the My Outfits directory.
 	const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
@@ -1681,7 +1657,6 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 										 BOOL remove)
 {
 	llinfos << "setWearableOutfit() start" << llendl;
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	BOOL wearables_to_remove[WT_COUNT];
 	wearables_to_remove[WT_SHAPE]		= FALSE;
@@ -1785,11 +1760,11 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		}
 	}
 
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		avatarp->setCompositeUpdatesEnabled(TRUE);
-		avatarp->updateVisualParams();
-		avatarp->invalidateAll();
+		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatar->updateVisualParams();
+		gAgentAvatar->invalidateAll();
 	}
 
 	// Start rendering & update the server
@@ -2039,12 +2014,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
 	// already wearing and in request set -> leave alone.
 	// not wearing and in request set -> put on.
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		llwarns << "No avatar found." << llendl;
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	std::set<LLUUID> requested_item_ids;
 	std::set<LLUUID> current_item_ids;
@@ -2053,8 +2023,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
 
 	// Build up list of objects to be removed and items currently attached.
 	llvo_vec_t objects_to_remove;
-	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-		 iter != avatarp->mAttachmentPoints.end();)
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatar->mAttachmentPoints.end();)
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -2110,12 +2080,7 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
 
 void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remove)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		llwarns << "No avatar found." << llendl;
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	if (objects_to_remove.empty())
 		return;
@@ -2138,17 +2103,12 @@ void LLAgentWearables::userRemoveMultipleAttachments(llvo_vec_t& objects_to_remo
 
 void LLAgentWearables::userRemoveAllAttachments()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		llwarns << "No avatar found." << llendl;
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	llvo_vec_t objects_to_remove;
 	
-	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-		 iter != avatarp->mAttachmentPoints.end();)
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatar->mAttachmentPoints.end();)
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -2714,11 +2674,10 @@ void LLInitialWearablesFetch::processWearablesMessage()
 		}
 
 		// Add all current attachments to the requested items as well.
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
-			for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin(); 
-				 iter != avatarp->mAttachmentPoints.end(); ++iter)
+			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
 			{
 				LLViewerJointAttachment* attachment = iter->second;
 				if (!attachment) continue;
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index b3dfb8f141..ef25faac26 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -469,8 +469,7 @@ void LLWearableHoldingPattern::onAllComplete()
 	LLAppearanceManager::instance().updateAgentWearables(this, false);
 	
 	// Update attachments to match those requested.
-	LLVOAvatar* avatar = gAgent.getAvatarObject();
-	if( avatar )
+	if (isAgentAvatarValid())
 	{
 		llinfos << "Updating " << mObjItems.count() << " attachments" << llendl;
 		LLAgentWearables::userUpdateAttachments(mObjItems);
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index d30d7fd26d..220b84500f 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -79,6 +79,7 @@
 #include "lllocationhistory.h"
 #include "llfasttimerview.h"
 #include "llvoicechannel.h"
+#include "llvoavatarself.h"
 #include "llsidetray.h"
 
 
@@ -356,7 +357,7 @@ void request_initial_instant_messages()
 	if (!requested
 		&& gMessageSystem
 		&& LLMuteList::getInstance()->isLoaded()
-		&& gAgent.getAvatarObject())
+		&& isAgentAvatarValid())
 	{
 		// Auto-accepted inventory items may require the avatar object
 		// to build a correct name.  Likewise, inventory offers from
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index c22c9d3048..75d1c437c3 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -118,13 +118,12 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 
 	out << std::endl;
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if(avatarp)
+	if(isAgentAvatarValid())
 	{
 		for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
 		{
 			LLDrivenEntryInfo driven = *iter;
-			LLViewerVisualParam *param = (LLViewerVisualParam*)avatarp->getVisualParam(driven.mDrivenID);
+			LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatar->getVisualParam(driven.mDrivenID);
 			if (param)
 			{
 				param->getInfo()->toStream(out);
@@ -146,7 +145,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 			}
 			else
 			{
-				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << avatarp << " for driver parameter " << getID() << llendl;
+				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatar << " for driver parameter " << getID() << llendl;
 			}
 			out << std::endl;
 		}
@@ -626,14 +625,13 @@ F32 LLDriverParam::getDrivenWeight(const LLDrivenEntry* driven, F32 input_weight
 
 void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bool upload_bake)
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if(avatarp &&
+	if(isAgentAvatarValid() &&
 	   mWearablep && 
 	   driven->mParam->getCrossWearable() &&
 	   mWearablep->isOnTop())
 	{
 		// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
-		avatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
+		gAgentAvatar->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
 	}
 	else
 	{
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 47a9961323..c9a950ed42 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -746,8 +746,7 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 	{
 		return;
 	}
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return;
+	if (!isAgentAvatarValid()) return;
 
 	// Of the ones that started playing, have any stopped?
 
@@ -758,8 +757,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 	{
 		// look in signaled animations (simulator's view of what is
 		// currently playing.
-		LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it);
-		if (play_it != avatarp->mSignaledAnimations.end())
+		LLVOAvatar::AnimIterator play_it = gAgentAvatar->mSignaledAnimations.find(*gest_it);
+		if (play_it != gAgentAvatar->mSignaledAnimations.end())
 		{
 			++gest_it;
 		}
@@ -777,8 +776,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 		 gest_it != gesture->mRequestedAnimIDs.end();
 		 )
 	{
-	 LLVOAvatar::AnimIterator play_it = avatarp->mSignaledAnimations.find(*gest_it);
-		if (play_it != avatarp->mSignaledAnimations.end())
+	 LLVOAvatar::AnimIterator play_it = gAgentAvatar->mSignaledAnimations.find(*gest_it);
+		if (play_it != gAgentAvatar->mSignaledAnimations.end())
 		{
 			// Hooray, this animation has started playing!
 			// Copy into playing.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 08734137b6..a62640c813 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1506,11 +1506,7 @@ BOOL LLFolderBridge::isItemRemovable() const
 		return FALSE;
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return FALSE;
-	}
+	if (!isAgentAvatarValid()) return FALSE;
 
 	LLInventoryCategory* category = model->getCategory(mUUID);
 	if(!category)
@@ -1661,8 +1657,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	LLInventoryModel* model = getInventoryModel();
 	if(!model) return FALSE;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return FALSE;
+	if (!isAgentAvatarValid()) return FALSE;
 
 	// cannot drag categories into library
 	if(!isAgentInventory())
@@ -3026,8 +3021,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		return FALSE;
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return FALSE;
+	if (!isAgentAvatarValid()) return FALSE;
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
 	BOOL accept = FALSE;
@@ -4155,8 +4149,7 @@ std::string LLObjectBridge::getLabelSuffix() const
 {
 	if (get_is_item_worn(mUUID))
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		std::string attachment_point_name = avatarp->getAttachedPointName(mUUID);
+		std::string attachment_point_name = gAgentAvatar->getAttachedPointName(mUUID);
 
 		// e.g. "(worn on ...)" / "(attached to ...)"
 		LLStringUtil::format_map_t args;
@@ -4175,11 +4168,10 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	payload["item_id"] = item->getLinkedUUID(); // Wear the base object in case this is a link.
 
 	S32 attach_pt = 0;
-	if (gAgent.getAvatarObject() && attachment)
+	if (isAgentAvatarValid() && attachment)
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
-			 iter != avatarp->mAttachmentPoints.end(); ++iter)
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin();
+			 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
 		{
 			if (iter->second == attachment)
 			{
@@ -4205,9 +4197,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 
 bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-
-	if (!avatarp->canAttachMoreObjects())
+	if (!gAgentAvatar->canAttachMoreObjects())
 	{
 		LLSD args;
 		args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS);
@@ -4269,11 +4259,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		LLInventoryItem *item = getItem();
 		if(item)
 		{
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if (!avatarp)
-			{
-				return;
-			}
+			if (!isAgentAvatarValid()) return;
 
 			if( get_is_item_worn( mUUID ) )
 			{
@@ -4289,7 +4275,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				// commented out for DEV-32347
 				//items.push_back(std::string("Restore to Last Position"));
 
-				if (!avatarp->canAttachMoreObjects())
+				if (!gAgentAvatar->canAttachMoreObjects())
 				{
 					disabled_items.push_back(std::string("Object Wear"));
 					disabled_items.push_back(std::string("Attach To"));
@@ -4297,15 +4283,14 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				}
 				LLMenuGL* attach_menu = menu.findChildMenuByName("Attach To", TRUE);
 				LLMenuGL* attach_hud_menu = menu.findChildMenuByName("Attach To HUD", TRUE);
-				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 				if (attach_menu
 					&& (attach_menu->getChildCount() == 0)
 					&& attach_hud_menu
 					&& (attach_hud_menu->getChildCount() == 0)
-					&& avatarp)
+					&& isAgentAvatarValid())
 				{
-					for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
-						 iter != avatarp->mAttachmentPoints.end(); )
+					for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin();
+						 iter != gAgentAvatar->mAttachmentPoints.end(); )
 					{
 						LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 						LLViewerJointAttachment* attachment = curiter->second;
@@ -4355,10 +4340,9 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
 
 		model->notifyObservers();
 
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
-			LLViewerObject* obj = avatarp->getWornAttachment( item->getUUID() );
+			LLViewerObject* obj = gAgentAvatar->getWornAttachment( item->getUUID() );
 			if(obj)
 			{
 				LLSelectMgr::getInstance()->deselectAll();
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index d3e2a2f555..f1b7806635 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -352,8 +352,7 @@ BOOL get_is_item_worn(const LLUUID& id)
 	{
 		case LLAssetType::AT_OBJECT:
 		{
-			const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if(avatarp && avatarp->isWearingAttachment(item->getLinkedUUID()))
+			if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getLinkedUUID()))
 				return TRUE;
 			break;
 		}
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 1f9840923c..7c8fb4f9b9 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3774,7 +3774,6 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 		return false;
 
 	bool allowed = false;
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	switch(item->getType())
 	{
@@ -3783,7 +3782,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 		break;
 		
 	case LLAssetType::AT_OBJECT:
-		if(avatarp && !avatarp->isWearingAttachment(item->getUUID()))
+		if (isAgentAvatarValid() && !gAgentAvatar->isWearingAttachment(item->getUUID()))
 		{
 			allowed = true;
 		}
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 2a8306f232..3520c7e0c0 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -871,10 +871,9 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata)
 	mFolders->getSelectionList(selected_items);
 
 	std::string joint_name = userdata.asString();
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 	LLViewerJointAttachment* attachmentp = NULL;
-	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-		 iter != avatarp->mAttachmentPoints.end(); )
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatar->mAttachmentPoints.end(); )
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
diff --git a/indra/newview/llmaniprotate.cpp b/indra/newview/llmaniprotate.cpp
index 6dc0a929c8..6747bcb9c9 100644
--- a/indra/newview/llmaniprotate.cpp
+++ b/indra/newview/llmaniprotate.cpp
@@ -65,6 +65,7 @@
 #include "lldrawable.h"
 #include "llglheaders.h"
 #include "lltrans.h"
+#include "llvoavatarself.h"
 
 const F32 RADIUS_PIXELS = 100.f;		// size in screen space
 const F32 SQ_RADIUS = RADIUS_PIXELS * RADIUS_PIXELS;
@@ -739,7 +740,7 @@ void LLManipRotate::renderSnapGuides()
 	LLVector3 test_axis = constraint_axis;
 
 	BOOL constrain_to_ref_object = FALSE;
-	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 	{
 		test_axis = test_axis * ~grid_rotation;
 	}
@@ -766,7 +767,7 @@ void LLManipRotate::renderSnapGuides()
 	}
 
 	LLVector3 projected_snap_axis = world_snap_axis;
-	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 	{
 		projected_snap_axis = projected_snap_axis * grid_rotation;
 	}
@@ -1282,7 +1283,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
 	LLVector3 axis2;
 
 	LLVector3 test_axis = constraint_axis;
-	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 	{
 		test_axis = test_axis * ~grid_rotation;
 	}
@@ -1306,7 +1307,7 @@ LLQuaternion LLManipRotate::dragConstrained( S32 x, S32 y )
 		axis1 = LLVector3::x_axis;
 	}
 
-	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+	if (mObjectSelection->getSelectType() == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 	{
 		axis1 = axis1 * grid_rotation;
 	}
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 35c4f7f787..8d77ade253 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -714,7 +714,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 				// in position changes even when the mouse moves
 				object->setPosition(new_position_local);
 				rebuild(object);
-				gAgent.getAvatarObject()->clampAttachmentPositions();
+				gAgentAvatar->clampAttachmentPositions();
 				new_position_local = object->getPosition();
 
 				if (selectNode->mIndividualSelection)
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index cb48db15e4..6334d54e33 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -89,15 +89,14 @@ void	LLMorphView::initialize()
 	mCameraYaw = 0.f;
 	mCameraDist = -1.f;
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (!avatarp || avatarp->isDead())
+	if (!isAgentAvatarValid() || gAgentAvatar->isDead())
 	{
 		gAgentCamera.changeCameraToDefault();
 		return;
 	}
 
-	avatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
-	avatarp->mSpecialRenderMode = 3;
+	gAgentAvatar->stopMotion( ANIM_AGENT_BODY_NOISE );
+	gAgentAvatar->mSpecialRenderMode = 3;
 	
 	// set up camera for close look at avatar
 	mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
@@ -111,11 +110,10 @@ void	LLMorphView::shutdown()
 {
 	LLVOAvatarSelf::onCustomizeEnd();
 
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (avatarp && !avatarp->isDead())
+	if (isAgentAvatarValid())
 	{
-		avatarp->startMotion( ANIM_AGENT_BODY_NOISE );
-		avatarp->mSpecialRenderMode = 0;
+		gAgentAvatar->startMotion( ANIM_AGENT_BODY_NOISE );
+		gAgentAvatar->mSpecialRenderMode = 0;
 		// reset camera
 		LLViewerCamera::getInstance()->setNear(mOldCameraNearClip);
 	}
@@ -164,15 +162,11 @@ void LLMorphView::updateCamera()
 {
 	if (!mCameraTargetJoint)
 	{
-		setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead"));
-	}
-	
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return;
-	}
-	LLJoint* root_joint = avatarp->getRootJoint();
+		setCameraTargetJoint(gAgentAvatar->getJoint("mHead"));
+	}	
+	if (!isAgentAvatarValid()) return;
+
+	LLJoint* root_joint = gAgentAvatar->getRootJoint();
 	if( !root_joint )
 	{
 		return;
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index 58fac14349..b47acefc76 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -42,7 +42,7 @@
 
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llvoavatarself.h" // to check gAgent.getAvatarObject()->isSitting()
+#include "llvoavatarself.h" // to check gAgentAvatar->isSitting()
 #include "llbottomtray.h"
 #include "llbutton.h"
 #include "llfloaterreg.h"
@@ -332,7 +332,7 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode)
 	updateButtonsWithMovementMode(mode);
 
 	bool bHideModeButtons = MM_FLY == mode
-		|| (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting());
+		|| (isAgentAvatarValid() && gAgentAvatar->isSitting());
 
 	showModeButtons(!bHideModeButtons);
 
@@ -388,9 +388,9 @@ void LLFloaterMove::initMovementMode()
 	}
 	setMovementMode(initMovementMode);
 
-	if (gAgent.getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		setEnabled(!gAgent.getAvatarObject()->isSitting());
+		setEnabled(!gAgentAvatar->isSitting());
 	}
 }
 
@@ -491,7 +491,7 @@ void LLFloaterMove::onOpen(const LLSD& key)
 		showModeButtons(FALSE);
 	}
 
-	if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting())
+	if (isAgentAvatarValid() && gAgentAvatar->isSitting())
 	{
 		setSittingMode(TRUE);
 		showModeButtons(FALSE);
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index e7acc68b93..89fd4715fc 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -602,7 +602,7 @@ LLPanel* LLPanelEditWearable::getPanel(EWearableType type)
 void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std::string &edit_group)
 {
 	LLWearable::visual_param_vec_t param_list;
-	ESex avatar_sex = gAgent.getAvatarObject()->getSex();
+	ESex avatar_sex = gAgentAvatar->getSex();
 
 	mWearablePtr->getVisualParams(param_list);
 
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 312bbc0e11..87c7bdbfab 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -179,10 +179,9 @@ void LLPreview::onCommit()
 			// update the object itself.
 			if( item->getType() == LLAssetType::AT_OBJECT )
 			{
-				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-				if (avatarp)
+				if (isAgentAvatarValid())
 				{
-					LLViewerObject* obj = avatarp->getWornAttachment( item->getUUID() );
+					LLViewerObject* obj = gAgentAvatar->getWornAttachment( item->getUUID() );
 					if( obj )
 					{
 						LLSelectMgr::getInstance()->deselectAll();
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 49b297f702..9210f5b8b7 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -71,7 +71,7 @@ BOOL LLPreviewAnim::postBuild()
 	const LLInventoryItem* item = getItem();
 	if(item)
 	{
-		gAgent.getAvatarObject()->createMotion(item->getAssetUUID()); // preload the animation
+		gAgentAvatar->createMotion(item->getAssetUUID()); // preload the animation
 		childSetText("desc", item->getDescription());
 	}
 
@@ -110,7 +110,6 @@ void LLPreviewAnim::playAnim( void *userdata )
 {
 	LLPreviewAnim* self = (LLPreviewAnim*) userdata;
 	const LLInventoryItem *item = self->getItem();
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	if(item)
 	{
@@ -126,7 +125,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		{
 			self->mPauseRequest = NULL;
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
-			LLMotion* motion = avatarp->findMotion(itemID);
+			LLMotion* motion = gAgentAvatar->findMotion(itemID);
 			if (motion)
 			{
 				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
@@ -134,7 +133,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		}
 		else
 		{
-			avatarp->stopMotion(itemID);
+			gAgentAvatar->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
@@ -159,9 +158,8 @@ void LLPreviewAnim::auditionAnim( void *userdata )
 		if (self->childGetValue("Anim audition btn").asBoolean() ) 
 		{
 			self->mPauseRequest = NULL;
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			gAgent.getAvatarObject()->startMotion(item->getAssetUUID());
-			LLMotion* motion = avatarp->findMotion(itemID);
+			gAgentAvatar->startMotion(item->getAssetUUID());
+			LLMotion* motion = gAgentAvatar->findMotion(itemID);
 			
 			if (motion)
 			{
@@ -170,7 +168,7 @@ void LLPreviewAnim::auditionAnim( void *userdata )
 		}
 		else
 		{
-			gAgent.getAvatarObject()->stopMotion(itemID);
+			gAgentAvatar->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
@@ -183,11 +181,9 @@ void LLPreviewAnim::onClose(bool app_quitting)
 
 	if(item)
 	{
-		gAgent.getAvatarObject()->stopMotion(item->getAssetUUID());
+		gAgentAvatar->stopMotion(item->getAssetUUID());
 		gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
-					
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		LLMotion* motion = avatarp->findMotion(item->getAssetUUID());
+		LLMotion* motion = gAgentAvatar->findMotion(item->getAssetUUID());
 		
 		if (motion)
 		{
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index 95e12bf46f..b47b384308 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -209,7 +209,7 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata)
 	if (current_weight != new_weight )
 	{
 		self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE );
-		gAgent.getAvatarObject()->updateVisualParams();
+		gAgentAvatar->updateVisualParams();
 	}
 }
 
@@ -298,7 +298,7 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
 				&& new_percent < slider->getMaxValue())
 			{
 				mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE);
-				gAgent.getAvatarObject()->updateVisualParams();
+				gAgentAvatar->updateVisualParams();
 
 				slider->setValue( weightToPercent( new_weight ) );
 			}
@@ -344,8 +344,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
 
 	F32 elapsed_time = self->mMouseDownTimer.getElapsedTimeF32();
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
 		LLVisualParamHint* hint = self->mHintMax;
 
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 69f9a7e6fa..26d1ec1d6c 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1475,7 +1475,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
 				object->sendTEUpdate();
 				// 1 particle effect per object				
 				LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-				effectp->setSourceObject(gAgent.getAvatarObject());
+				effectp->setSourceObject(gAgentAvatar);
 				effectp->setTargetObject(object);
 				effectp->setDuration(LL_HUD_DUR_SHORT);
 				effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -3619,7 +3619,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 {
 	LLViewerObject* attach_object = mSelectedObjects->getFirstRootObject();
 
-	if (!attach_object || !gAgent.getAvatarObject() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
+	if (!attach_object || !isAgentAvatarValid() || mSelectedObjects->mSelectType != SELECT_TYPE_WORLD)
 	{
 		return;
 	}
@@ -3630,7 +3630,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
 	// Special case: Attach to default location for this object.
 	if (0 == attachment_point ||
-		get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
+		get_if_there(gAgentAvatar->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
 	{
 		sendListToRegions(
 			"ObjectAttach",
@@ -4911,10 +4911,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 	LLGLEnable blend(GL_BLEND);
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && for_hud)
+	if (isAgentAvatarValid() && for_hud)
 	{
-		LLBBox hud_bbox = avatarp->getHUDBBox();
+		LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
 
 		F32 cur_zoom = gAgentCamera.mHUDCurZoom;
 
@@ -5023,7 +5022,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 		}
 	}
 
-	if (avatarp && for_hud)
+	if (isAgentAvatarValid() && for_hud)
 	{
 		glMatrixMode(GL_PROJECTION);
 		gGL.popMatrix();
@@ -5399,8 +5398,7 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color)
 	if (volume)
 	{
 		F32 silhouette_thickness;
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if (avatarp && is_hud_object)
+		if (isAgentAvatarValid() && is_hud_object)
 		{
 			silhouette_thickness = LLSelectMgr::sHighlightThickness / gAgentCamera.mHUDCurZoom;
 		}
@@ -5610,16 +5608,16 @@ void LLSelectMgr::updateSelectionCenter()
 	{
 		mSelectedObjects->mSelectType = getSelectTypeForObject(object);
 
-		if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && gAgent.getAvatarObject())
+		if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 		{
-			mPauseRequest = gAgent.getAvatarObject()->requestPause();
+			mPauseRequest = gAgentAvatar->requestPause();
 		}
 		else
 		{
 			mPauseRequest = NULL;
 		}
 
-		if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && gAgent.getAvatarObject())
+		if (mSelectedObjects->mSelectType != SELECT_TYPE_HUD && isAgentAvatarValid())
 		{
 			// reset hud ZOOM
 			gAgentCamera.mHUDTargetZoom = 1.f;
@@ -5642,10 +5640,10 @@ void LLSelectMgr::updateSelectionCenter()
 			LLViewerObject* object = node->getObject();
 			if (!object)
 				continue;
-			LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
+			
 			LLViewerObject *root = object->getRootEdit();
 			if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
-				!root->isChild(avatarp) && // not the object you're sitting on
+				!root->isChild(gAgentAvatar) && // not the object you're sitting on
 				!object->isAvatar()) // not another avatar
 			{
 				mShowSelection = TRUE;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index c6fba61886..e65da0022e 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -366,11 +366,10 @@ void LLSidepanelAppearance::fetchInventory()
 		}
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		for (LLVOAvatar::attachment_map_t::const_iterator iter = avatarp->mAttachmentPoints.begin(); 
-			 iter != avatarp->mAttachmentPoints.end(); ++iter)
+		for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
 		{
 			LLViewerJointAttachment* attachment = iter->second;
 			if (!attachment) continue;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index edd03dc836..7ed095c68e 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1861,7 +1861,7 @@ bool idle_startup()
 		if (gAgent.isFirstLogin()
 			&& !sInitialOutfit.empty()    // registration set up an outfit
 			&& !sInitialOutfitGender.empty() // and a gender
-			&& gAgent.getAvatarObject()	  // can't wear clothes without object
+			&& isAgentAvatarValid()	  // can't wear clothes without object
 			&& !gAgent.isGenderChosen() ) // nothing already loading
 		{
 			// Start loading the wearables, textures, gestures
@@ -1869,7 +1869,7 @@ bool idle_startup()
 		}
 
 		// wait precache-delay and for agent's avatar or a lot longer.
-		if(((timeout_frac > 1.f) && gAgent.getAvatarObject())
+		if(((timeout_frac > 1.f) && isAgentAvatarValid())
 		   || (timeout_frac > 3.f))
 		{
 			LLStartUp::setStartupState( STATE_WEARABLES_WAIT );
@@ -1925,8 +1925,8 @@ bool idle_startup()
 		if (gAgent.isFirstLogin())
 		{
 			// wait for avatar to be completely loaded
-			if (gAgent.getAvatarObject()
-				&& gAgent.getAvatarObject()->isFullyLoaded())
+			if (isAgentAvatarValid()
+				&& gAgentAvatar->isFullyLoaded())
 			{
 				//llinfos << "avatar fully loaded" << llendl;
 				LLStartUp::setStartupState( STATE_CLEANUP );
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index 3052134d4f..add1cea8cc 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -445,11 +445,9 @@ void LLStatusBar::setHealth(S32 health)
 	{
 		if (mHealth > (health + gSavedSettings.getF32("UISndHealthReductionThreshold")))
 		{
-			LLVOAvatar *me;
-
-			if ((me = gAgent.getAvatarObject()))
+			if (isAgentAvatarValid())
 			{
-				if (me->getSex() == SEX_FEMALE)
+				if (gAgentAvatar->getSex() == SEX_FEMALE)
 				{
 					make_ui_sound("UISndHealthReductionF");
 				}
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 21c928282a..6461ec8221 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -284,8 +284,6 @@ void LLTexLayerSetBuffer::readBackAndUpload()
 	llinfos << "Baked " << mTexLayerSet->getBodyRegion() << llendl;
 	LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_BAKES);
 
-	llassert( gAgent.getAvatarObject() == mTexLayerSet->getAvatar() );
-
 	// We won't need our caches since we're baked now.  (Techically, we won't 
 	// really be baked until this image is sent to the server and the Avatar
 	// Appearance message is received.)
@@ -352,7 +350,7 @@ void LLTexLayerSetBuffer::readBackAndUpload()
 			{
 				// baked_upload_data is owned by the responder and deleted after the request completes
 				LLBakedUploadData* baked_upload_data =
-					new LLBakedUploadData(gAgent.getAvatarObject(), this->mTexLayerSet, asset_id);
+					new LLBakedUploadData(gAgentAvatar, this->mTexLayerSet, asset_id);
 				mUploadID = asset_id;
 				
 				// upload the image
@@ -409,12 +407,10 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 {
 	LLBakedUploadData* baked_upload_data = (LLBakedUploadData*)userdata;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
 	if (0 == result &&
-		avatarp &&
-		!avatarp->isDead() &&
-		baked_upload_data->mAvatar == avatarp && // Sanity check: only the user's avatar should be uploading textures.
+		isAgentAvatarValid() &&
+		!gAgentAvatar->isDead() &&
+		baked_upload_data->mAvatar == gAgentAvatar && // Sanity check: only the user's avatar should be uploading textures.
 		baked_upload_data->mTexLayerSet->hasComposite()
 		)
 	{
@@ -439,11 +435,11 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 
 			if (result >= 0)
 			{
-				LLVOAvatarDefines::ETextureIndex baked_te = avatarp->getBakedTE(layerset_buffer->mTexLayerSet);
+				LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatar->getBakedTE(layerset_buffer->mTexLayerSet);
 				// Update baked texture info with the new UUID
 				U64 now = LLFrameTimer::getTotalTime();		// Record starting time
 				llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl;
-				avatarp->setNewBakedTexture(baked_te, uuid);
+				gAgentAvatar->setNewBakedTexture(baked_te, uuid);
 			}
 			else
 			{	
@@ -457,7 +453,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 			llinfos << "Received baked texture out of date, ignored." << llendl;
 		}
 
-		avatarp->dirtyMesh();
+		gAgentAvatar->dirtyMesh();
 	}
 	else
 	{
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 1f6f840c45..f9d0c7c307 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1174,7 +1174,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
 
 		// VEFFECT: SetScript
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgent.getAvatarObject());
+		effectp->setSourceObject(gAgentAvatar);
 		effectp->setTargetObject(hit_obj);
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1335,7 +1335,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 
 	// VEFFECT: DropObject
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgent.getAvatarObject());
+	effectp->setSourceObject(gAgentAvatar);
 	effectp->setPositionGlobal(mLastHitPos);
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1398,7 +1398,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 
 	// VEFFECT: AddToInventory
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgent.getAvatarObject());
+	effectp->setSourceObject(gAgentAvatar);
 	effectp->setTargetObject(hit_obj);
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1496,7 +1496,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
 
 	// VEFFECT: giveInventory
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgent.getAvatarObject());
+	effectp->setSourceObject(gAgentAvatar);
 	effectp->setTargetObject(gObjectList.findObject(to_agent));
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1547,11 +1547,7 @@ void LLToolDragAndDrop::giveInventoryCategory(const LLUUID& to_agent,
 	llinfos << "LLToolDragAndDrop::giveInventoryCategory() - "
 			<< cat->getUUID() << llendl;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	// Test out how many items are being given.
 	LLViewerInventoryCategory::cat_array_t cats;
@@ -1739,7 +1735,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 
 		// VEFFECT: giveInventoryCategory
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgent.getAvatarObject());
+		effectp->setSourceObject(gAgentAvatar);
 		effectp->setTargetObject(gObjectList.findObject(to_agent));
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1765,17 +1761,13 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
 	BOOL copyable = FALSE;
 	if (item->getPermissions().allowCopyBy(gAgent.getID())) copyable = TRUE;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return FALSE;
-	}
+	if (!isAgentAvatarValid()) return FALSE;
 
 	BOOL acceptable = TRUE;
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (avatarp->isWearingAttachment(item->getUUID()))
+		if (gAgentAvatar->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1812,17 +1804,13 @@ BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
 		return FALSE;
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return FALSE;
-	}
+	if (!isAgentAvatarValid()) return FALSE;
 
 	BOOL acceptable = TRUE;
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (avatarp->isWearingAttachment(item->getUUID()))
+		if (gAgentAvatar->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1857,12 +1845,10 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	//							  gAgent.getGroupID())
 	//			 && (obj->mPermModify || obj->mFlagAllowInventoryAdd));
 	BOOL worn = FALSE;
-	LLVOAvatarSelf* avatarp = NULL;
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		avatarp = gAgent.getAvatarObject();
-		if (avatarp && avatarp->isWearingAttachment(item->getUUID()))
+		if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getUUID()))
 		{
 				worn = TRUE;
 		}
@@ -2013,8 +1999,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
 	}
 
 	// must not be already wearing it
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2055,8 +2040,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 	locateInventory(item, cat);
 	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2117,8 +2101,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
 	if (!item || !item->isComplete()) return ACCEPT_NO;
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp || avatarp->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2267,7 +2250,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
 		
 		// VEFFECT: SetTexture
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgent.getAvatarObject());
+		effectp->setSourceObject(gAgentAvatar);
 		effectp->setTargetObject(obj);
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -2627,13 +2610,12 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
 		// cannot give away no-transfer objects
 		return ACCEPT_NO;
 	}
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && avatarp->isWearingAttachment(item->getUUID()))
+	if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getUUID()))
 	{
 		// You can't give objects that are attached to you
 		return ACCEPT_NO;
 	}
-	if (obj && avatarp)
+	if (obj && isAgentAvatarValid())
 	{
 		if (drop)
 		{
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index 363df74379..b362d564df 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -173,8 +173,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 		BOOL good_customize_avatar_hit = FALSE;
 		if( hit_obj )
 		{
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if (avatarp &&(hit_obj == avatarp))
+			if (isAgentAvatarValid() && (hit_obj == gAgentAvatar))
 			{
 				// It's you
 				good_customize_avatar_hit = TRUE;
@@ -222,8 +221,8 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 			gAgentCamera.cameraThirdPerson() &&
 			gViewerWindow->getLeftMouseDown() && 
 			!gSavedSettings.getBOOL("FreezeTime") &&
-			(hit_obj == gAgent.getAvatarObject() || 
-				(hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
+			(hit_obj == gAgentAvatar || 
+			 (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
 		{
 			LLToolCamera::getInstance()->mMouseSteering = TRUE;
 		}
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index 008cf16f2e..982d55914d 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -708,7 +708,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 	{
 		if (!gAgentCamera.cameraMouselook() && 
 			!objectp->isHUDAttachment() && 
-			objectp->getRoot() == gAgent.getAvatarObject()->getRoot())
+			objectp->getRoot() == gAgentAvatar->getRoot())
 		{
 			// force focus to point in space where we were looking previously
 			gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null);
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index c42c47c486..67d696d7d7 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -139,22 +139,20 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis
 
 BOOL LLVisualParamHint::needsRender()
 {
-	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgent.getAvatarObject()->mAppearanceAnimating && mAllowsUpdates;
+	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatar->mAppearanceAnimating && mAllowsUpdates;
 }
 
 void LLVisualParamHint::preRender(BOOL clear_depth)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
 	mLastParamWeight = mVisualParam->getWeight();
 	mVisualParam->setWeight(mVisualParamWeight, FALSE);
-	avatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
-	avatarp->setVisualParamWeight("Blink_Left", 0.f);
-	avatarp->setVisualParamWeight("Blink_Right", 0.f);
-	avatarp->updateComposites();
-	avatarp->updateVisualParams();
-	avatarp->updateGeometry(avatarp->mDrawable);
-	avatarp->updateLOD();
+	gAgentAvatar->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
+	gAgentAvatar->setVisualParamWeight("Blink_Left", 0.f);
+	gAgentAvatar->setVisualParamWeight("Blink_Right", 0.f);
+	gAgentAvatar->updateComposites();
+	gAgentAvatar->updateVisualParams();
+	gAgentAvatar->updateGeometry(gAgentAvatar->mDrawable);
+	gAgentAvatar->updateLOD();
 
 	LLViewerDynamicTexture::preRender(clear_depth);
 }
@@ -165,7 +163,6 @@ void LLVisualParamHint::preRender(BOOL clear_depth)
 BOOL LLVisualParamHint::render()
 {
 	LLVisualParamReset::sDirty = TRUE;
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 
 	gGL.pushUIMatrix();
 	gGL.loadUIIdentity();
@@ -196,7 +193,7 @@ BOOL LLVisualParamHint::render()
 	const std::string& cam_target_mesh_name = mVisualParam->getCameraTargetName();
 	if( !cam_target_mesh_name.empty() )
 	{
-		cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint( cam_target_mesh_name );
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatar->getJoint( cam_target_mesh_name );
 	}
 	if( !cam_target_joint )
 	{
@@ -204,11 +201,11 @@ BOOL LLVisualParamHint::render()
 	}
 	if( !cam_target_joint )
 	{
-		cam_target_joint = (LLViewerJointMesh*)avatarp->getJoint("mHead");
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatar->getJoint("mHead");
 	}
 
 	LLQuaternion avatar_rotation;
-	LLJoint* root_joint = avatarp->getRootJoint();
+	LLJoint* root_joint = gAgentAvatar->getRootJoint();
 	if( root_joint )
 	{
 		avatar_rotation = root_joint->getWorldRotation();
@@ -236,17 +233,17 @@ BOOL LLVisualParamHint::render()
 
 	LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
 
-	if (avatarp->mDrawable.notNull())
+	if (gAgentAvatar->mDrawable.notNull())
 	{
-		LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool();
+		LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatar->mDrawable->getFace(0)->getPool();
 		LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
 		gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS);
 		gGL.setSceneBlendType(LLRender::BT_REPLACE);
-		avatarPoolp->renderAvatars(avatarp);  // renders only one avatar
+		avatarPoolp->renderAvatars(gAgentAvatar);  // renders only one avatar
 		gGL.setSceneBlendType(LLRender::BT_ALPHA);
 		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 	}
-	avatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
+	gAgentAvatar->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
 	mVisualParam->setWeight(mLastParamWeight, FALSE);
 	gGL.color4f(1,1,1,1);
 	mGLTexturep->setGLTextureCreated(true);
@@ -297,10 +294,9 @@ BOOL LLVisualParamReset::render()
 {
 	if (sDirty)
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		avatarp->updateComposites();
-		avatarp->updateVisualParams();
-		avatarp->updateGeometry(avatarp->mDrawable);
+		gAgentAvatar->updateComposites();
+		gAgentAvatar->updateVisualParams();
+		gAgentAvatar->updateGeometry(gAgentAvatar->mDrawable);
 		sDirty = FALSE;
 	}
 
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index c80db89ef0..580b483b6b 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -206,8 +206,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 			break;
 		case CLICK_ACTION_SIT:
 			{
-				LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-				if (avatarp && !avatarp->isSitting()) // agent not already sitting
+				if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // agent not already sitting
 				{
 					handle_object_sit_or_stand();
 					// put focus in world when sitting on an object
@@ -331,7 +330,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 			}
 			object = (LLViewerObject*)object->getParent();
 		}
-		if (object && object == gAgent.getAvatarObject())
+		if (object && object == gAgentAvatar)
 		{
 			// we left clicked on avatar, switch to focus mode
 			LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
@@ -413,8 +412,7 @@ ECursorType cursor_from_object(LLViewerObject* object)
 	{
 	case CLICK_ACTION_SIT:
 		{
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if (avatarp && !avatarp->isSitting()) // not already sitting?
+			if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // not already sitting?
 			{
 				cursor = UI_CURSOR_TOOLSIT;
 			}
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index b10ee590e0..847852f8af 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -62,6 +62,7 @@
 #include "llviewerobjectlist.h"
 #include "llviewercamera.h"
 #include "llviewerstats.h"
+#include "llvoavatarself.h"
 
 // linden library headers
 #include "llprimitive.h"
@@ -433,7 +434,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
 
 	// VEFFECT: AddObject
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject((LLViewerObject*)gAgent.getAvatarObject());
+	effectp->setSourceObject((LLViewerObject*)gAgentAvatar);
 	effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region));
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index 6e0c6663e9..a45bb2a4de 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -169,8 +169,8 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi
 		}
 
 		if (!gAgentCamera.getFocusOnAvatar() &&										// if camera not glued to avatar
-			LLVOAvatar::findAvatarFromAttachment(object) != gAgent.getAvatarObject() &&	// and it's not one of your attachments
-			object != gAgent.getAvatarObject())									// and it's not you
+			LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatar &&	// and it's not one of your attachments
+			object != gAgentAvatar)									// and it's not you
 		{
 			// have avatar turn to face the selected object(s)
 			LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 7bbe40a486..f0f911b996 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -345,9 +345,9 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived.
 
 		S32 attach_count = 0;
-		if (gAgent.getAvatarObject())
+		if (isAgentAvatarValid())
 		{
-			attach_count = gAgent.getAvatarObject()->getAttachmentCount();
+			attach_count = gAgentAvatar->getAttachmentCount();
 		}
 		F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
 		F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
@@ -1032,11 +1032,10 @@ LLRect get_whole_screen_region()
 
 bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && avatarp->hasHUDAttachment())
+	if (isAgentAvatarValid() && gAgentAvatar->hasHUDAttachment())
 	{
 		F32 zoom_level = gAgentCamera.mHUDCurZoom;
-		LLBBox hud_bbox = avatarp->getHUDBBox();
+		LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
 		
 		F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
 		proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
@@ -1300,7 +1299,7 @@ void render_ui_2d()
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 
 	// render outline for HUD
-	if (gAgent.getAvatarObject() && gAgentCamera.mHUDCurZoom < 0.98f)
+	if (isAgentAvatarValid() && gAgentCamera.mHUDCurZoom < 0.98f)
 	{
 		glPushMatrix();
 		S32 half_width = (gViewerWindow->getWorldViewWidthScaled() / 2);
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 00046ed3dd..d899c72e0e 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -869,7 +869,6 @@ S32 LLViewerKeyboard::loadBindings(const std::string& filename)
 
 EKeyboardMode LLViewerKeyboard::getMode()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	if ( gAgentCamera.cameraMouselook() )
 	{
 		return MODE_FIRST_PERSON;
@@ -878,7 +877,7 @@ EKeyboardMode LLViewerKeyboard::getMode()
 	{
 		return MODE_EDIT_AVATAR;
 	}
-	else if (avatarp && avatarp->isSitting())
+	else if (isAgentAvatarValid() && gAgentAvatar->isSitting())
 	{
 		return MODE_SITTING;
 	}
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 2fcd3f1114..49a3ed14dc 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -3025,7 +3025,7 @@ bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
 		if (NULL != object)
 		{
 			LLVOAvatar *avatar = object->asAvatar();
-			if (NULL != avatar && avatar != gAgent.getAvatarObject())
+			if ((NULL != avatar) && (avatar != gAgentAvatar))
 			{
 				result = true;
 				break;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index b8a3232c29..f838d1436d 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2692,11 +2692,10 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
 	bool handleEvent(const LLSD& userdata)
 	{
 		bool new_value = false;
-		if (gAgent.getAvatarObject())
+		if (isAgentAvatarValid())
 		{
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-				 iter != avatarp->mAttachmentPoints.end(); )
+			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatar->mAttachmentPoints.end(); )
 			{
 				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 				LLViewerJointAttachment* attachment = curiter->second;
@@ -2824,9 +2823,9 @@ bool handle_go_to()
 
 	LLViewerParcelMgr::getInstance()->deselectLand();
 
-	if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
+	if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
 	{
-		gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID());
+		gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatar->getID());
 	}
 	else 
 	{
@@ -3365,7 +3364,7 @@ class LLSelfStandUp : public view_listener_t
 
 bool enable_standup_self()
 {
-	bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting();
+	bool new_value = isAgentAvatarValid() && gAgentAvatar->isSitting();
 	return new_value;
 }
 
@@ -3694,9 +3693,9 @@ class LLLandSit : public view_listener_t
 		LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal;
 		
 		LLQuaternion target_rot;
-		if (gAgent.getAvatarObject())
+		if (isAgentAvatarValid())
 		{
-			target_rot = gAgent.getAvatarObject()->getRotation();
+			target_rot = gAgentAvatar->getRotation();
 		}
 		else
 		{
@@ -4587,13 +4586,9 @@ BOOL sitting_on_selection()
 	}
 
 	// Need to determine if avatar is sitting on this object
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
-	{
-		return FALSE;
-	}
+	if (!isAgentAvatarValid()) return FALSE;
 
-	return (avatarp->isSitting() && avatarp->getRoot() == root_object);
+	return (gAgentAvatar->isSitting() && gAgentAvatar->getRoot() == root_object);
 }
 
 class LLToolsSaveToInventory : public view_listener_t
@@ -5846,7 +5841,7 @@ private:
 			S32 index = userdata.asInteger();
 			LLViewerJointAttachment* attachment_point = NULL;
 			if (index > 0)
-				attachment_point = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
+				attachment_point = get_if_there(gAgentAvatar->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
 			confirm_replace_attachment(0, attachment_point);
 		}
 		return true;
@@ -5867,8 +5862,8 @@ void near_attach_object(BOOL success, void *user_data)
 		U8 attachment_id = 0;
 		if (attachment)
 		{
-			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgent.getAvatarObject()->mAttachmentPoints.begin();
-				 iter != gAgent.getAvatarObject()->mAttachmentPoints.end(); ++iter)
+			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin();
+				 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
 			{
 				if (iter->second == attachment)
 				{
@@ -5993,7 +5988,7 @@ class LLAttachmentDetachFromPoint : public view_listener_t
 {
 	bool handleEvent(const LLSD& user_data)
 	{
-		const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
+		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatar->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
 		if (attachment->getNumObjects() > 0)
 		{
 			gMessageSystem->newMessage("ObjectDetach");
@@ -6021,7 +6016,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
 	LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl);
 	if (menu)
 	{
-		const LLViewerJointAttachment *attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
+		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatar->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
 		if (attachment)
 		{
 			label = data["label"].asString();
@@ -6139,7 +6134,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 		if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
 		{
     		S32 attachmentID  = ATTACHMENT_ID_FROM_STATE(object->getState());
-			attachment = get_if_there(gAgent.getAvatarObject()->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
+			attachment = get_if_there(gAgentAvatar->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
 
 			if (attachment)
 			{
@@ -6271,8 +6266,8 @@ class LLAttachmentPointFilled : public view_listener_t
 	bool handleEvent(const LLSD& user_data)
 	{
 		bool enable = false;
-		LLVOAvatar::attachment_map_t::iterator found_it = gAgent.getAvatarObject()->mAttachmentPoints.find(user_data.asInteger());
-		if (found_it != gAgent.getAvatarObject()->mAttachmentPoints.end())
+		LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatar->mAttachmentPoints.find(user_data.asInteger());
+		if (found_it != gAgentAvatar->mAttachmentPoints.end())
 		{
 			enable = found_it->second->getNumObjects() > 0;
 		}
@@ -6489,15 +6484,10 @@ void handle_toggle_pg(void*)
 
 void handle_dump_attachments(void*)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if(!avatarp)
-	{
-		llinfos << "NO AVATAR" << llendl;
-		return;
-	}
+	if(!isAgentAvatarValid()) return;
 
-	for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-		 iter != avatarp->mAttachmentPoints.end(); )
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatar->mAttachmentPoints.end(); )
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -6917,7 +6907,7 @@ void reload_vertex_shader(void *)
 
 void handle_dump_avatar_local_textures(void*)
 {
-	gAgent.getAvatarObject()->dumpLocalTextures();
+	gAgentAvatar->dumpLocalTextures();
 }
 
 void handle_dump_timers()
@@ -6937,86 +6927,83 @@ void handle_debug_avatar_textures(void*)
 void handle_grab_texture(void* data)
 {
 	ETextureIndex tex_index = (ETextureIndex)((intptr_t)data);
-	const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
-	{
-		// MULTI-WEARABLE: change to support an index
-		const LLUUID& asset_id = avatarp->grabLocalTexture(tex_index, 0);
-		LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
-		LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
-		LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
-		const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
-		if(folder_id.notNull())
-		{
-			std::string name = "Unknown";
-			const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
-			if (texture_dict->mIsBakedTexture)
-			{
-				EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
-				name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
-			}
-			name += " Texture";
-
-			LLUUID item_id;
-			item_id.generate();
-			LLPermissions perm;
-			perm.init(gAgentID,
-					  gAgentID,
-					  LLUUID::null,
-					  LLUUID::null);
-			U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
-			perm.initMasks(PERM_ALL,
-						   PERM_ALL,
-						   PERM_NONE,
-						   PERM_NONE,
-						   next_owner_perm);
-			time_t creation_date_now = time_corrected();
-			LLPointer<LLViewerInventoryItem> item
-				= new LLViewerInventoryItem(item_id,
-											folder_id,
-											perm,
-											asset_id,
-											asset_type,
-											inv_type,
-											name,
-											LLStringUtil::null,
-											LLSaleInfo::DEFAULT,
-											LLInventoryItem::II_FLAGS_NONE,
-											creation_date_now);
-
-			item->updateServer(TRUE);
-			gInventory.updateItem(item);
-			gInventory.notifyObservers();
-
-			// Show the preview panel for textures to let
-			// user know that the image is now in inventory.
-			LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
-			if(active_panel)
-			{
-				LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
-
-				active_panel->setSelection(item_id, TAKE_FOCUS_NO);
-				active_panel->openSelected();
-				//LLFloaterInventory::dumpSelectionInformation((void*)view);
-				// restore keyboard focus
-				gFocusMgr.setKeyboardFocus(focus_ctrl);
-			}
-		}
-		else
-		{
-			llwarns << "Can't find a folder to put it in" << llendl;
+	if (!isAgentAvatarValid()) return;
+
+	// MULTI-WEARABLE: change to support an index
+	const LLUUID& asset_id = gAgentAvatar->grabLocalTexture(tex_index, 0);
+	LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
+	LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
+	LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
+	const LLUUID folder_id = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(asset_type));
+	if(folder_id.notNull())
+	{
+		std::string name = "Unknown";
+		const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(tex_index);
+		if (texture_dict->mIsBakedTexture)
+		{
+			EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex;
+			name = "Baked " + LLVOAvatarDictionary::getInstance()->getBakedTexture(baked_index)->mNameCapitalized;
+		}
+		name += " Texture";
+
+		LLUUID item_id;
+		item_id.generate();
+		LLPermissions perm;
+		perm.init(gAgentID,
+				  gAgentID,
+				  LLUUID::null,
+				  LLUUID::null);
+		U32 next_owner_perm = PERM_MOVE | PERM_TRANSFER;
+		perm.initMasks(PERM_ALL,
+					   PERM_ALL,
+					   PERM_NONE,
+					   PERM_NONE,
+					   next_owner_perm);
+		time_t creation_date_now = time_corrected();
+		LLPointer<LLViewerInventoryItem> item
+			= new LLViewerInventoryItem(item_id,
+										folder_id,
+										perm,
+										asset_id,
+										asset_type,
+										inv_type,
+										name,
+										LLStringUtil::null,
+										LLSaleInfo::DEFAULT,
+										LLInventoryItem::II_FLAGS_NONE,
+										creation_date_now);
+
+		item->updateServer(TRUE);
+		gInventory.updateItem(item);
+		gInventory.notifyObservers();
+
+		// Show the preview panel for textures to let
+		// user know that the image is now in inventory.
+		LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel();
+		if(active_panel)
+		{
+			LLFocusableElement* focus_ctrl = gFocusMgr.getKeyboardFocus();
+
+			active_panel->setSelection(item_id, TAKE_FOCUS_NO);
+			active_panel->openSelected();
+			//LLFloaterInventory::dumpSelectionInformation((void*)view);
+			// restore keyboard focus
+			gFocusMgr.setKeyboardFocus(focus_ctrl);
 		}
 	}
+	else
+	{
+		llwarns << "Can't find a folder to put it in" << llendl;
+	}
 }
 
 BOOL enable_grab_texture(void* data)
 {
 	ETextureIndex index = (ETextureIndex)((intptr_t)data);
-	const LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
 		// MULTI-WEARABLE:
-		return avatarp->canGrabLocalTexture(index,0);
+		return gAgentAvatar->canGrabLocalTexture(index,0);
 	}
 	return FALSE;
 }
@@ -7227,12 +7214,11 @@ void handle_buy_currency_test(void*)
 
 void handle_rebake_textures(void*)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return;
+	if (!isAgentAvatarValid()) return;
 
 	// Slam pending upload count to "unstick" things
 	bool slam_for_debug = true;
-	avatarp->forceBakeAllTextures(slam_for_debug);
+	gAgentAvatar->forceBakeAllTextures(slam_for_debug);
 }
 
 void toggle_visibility(void* user_data)
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 1ead7bac10..96bb687bbb 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3002,9 +3002,9 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
 	gAgent.setRegion(regionp);
 	gObjectList.shiftObjects(shift_vector);
 
-	if (gAgent.getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		gAgent.getAvatarObject()->clearChatText();
+		gAgentAvatar->clearChatText();
 		gAgentCamera.slamLookAt(look_at);
 	}
 	gAgent.setPositionAgent(pos);
@@ -3084,8 +3084,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	std::string version_channel;
 	msg->getString("SimData", "ChannelVersion", version_channel);
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp)
+	if (!isAgentAvatarValid())
 	{
 		// Could happen if you were immediately god-teleported away on login,
 		// maybe other cases.  Continue, but warn.
@@ -3139,7 +3138,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		// know what you look like.
 		gAgent.sendAgentSetAppearance();
 
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
 			// Chat the "back" SLURL. (DEV-4907)
 
@@ -3152,9 +3151,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 			LLNotificationsUtil::add("SystemMessageTip", args);
 
 			// Set the new position
-			avatarp->setPositionAgent(agent_pos);
-			avatarp->clearChat();
-			avatarp->slamPosition();
+			gAgentAvatar->setPositionAgent(agent_pos);
+			gAgentAvatar->clearChat();
+			gAgentAvatar->slamPosition();
 		}
 	}
 	else
@@ -3214,9 +3213,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		gAgent.clearBusy();
 	}
 
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		avatarp->mFootPlane.clearVec();
+		gAgentAvatar->mFootPlane.clearVec();
 	}
 	
 	// send walk-vs-run status
@@ -4031,7 +4030,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 	//clear animation flags
 	avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
 
-	if (!avatarp)
+	if (!isAgentAvatarValid())
 	{
 		// no agent by this ID...error?
 		LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL;
@@ -4165,9 +4164,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	BOOL force_mouselook;
 	mesgsys->getBOOLFast(_PREHASH_SitTransform, _PREHASH_ForceMouselook, force_mouselook);
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
-	if (avatarp && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
+	if (isAgentAvatarValid() && dist_vec_squared(camera_eye, camera_at) > 0.0001f)
 	{
 		gAgentCamera.setSitCamera(sitObjectID, camera_eye, camera_at);
 	}
@@ -4178,7 +4175,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	if (object)
 	{
 		LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
-		if (!use_autopilot || (avatarp && avatarp->isSitting() && avatarp->getRoot() == object->getRoot()))
+		if (!use_autopilot || isAgentAvatarValid() && gAgentAvatar->isSitting() && gAgentAvatar->getRoot() == object->getRoot())
 		{
 			//we're already sitting on this object, so don't autopilot
 		}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index abcb7e5452..f3eb75bcd0 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -134,7 +134,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
 	{
 		if (id == gAgentID)
 		{
-			res = new LLVOAvatarSelf(id, pcode, regionp);
+			if (!gAgentAvatar)
+			{
+				gAgentAvatar = new LLVOAvatarSelf(id, pcode, regionp);
+			}
+			else 
+			{
+				gAgentAvatar->updateRegion(regionp);
+			}
+			res = gAgentAvatar;
 		}
 		else
 		{
@@ -223,7 +231,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 	mClickAction(0),
 	mAttachmentItemID(LLUUID::null)
 {
-	if(!is_global)
+	if (!is_global)
 	{
 		llassert(mRegionp);
 	}
@@ -235,7 +243,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe
 
 	mPositionRegion = LLVector3(0.f, 0.f, 0.f);
 
-	if(!is_global)
+	if (!is_global && mRegionp)
 	{
 		mPositionAgent = mRegionp->getOriginAgent();
 	}
@@ -377,11 +385,10 @@ void LLViewerObject::markDead()
 
 		if (flagAnimSource())
 		{
-			LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-			if (avatarp && !avatarp->isDead())
+			if (isAgentAvatarValid())
 			{
 				// stop motions associated with this object
-				avatarp->stopMotionFromSource(mID);
+				gAgentAvatar->stopMotionFromSource(mID);
 			}
 		}
 
@@ -4920,7 +4927,6 @@ void LLViewerObject::setIncludeInSearch(bool include_in_search)
 
 void LLViewerObject::setRegion(LLViewerRegion *regionp)
 {
-	llassert(regionp);
 	mLatestRecvPacketID = 0;
 	mRegionp = regionp;
 
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 64a7b2166b..eb966a1535 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -474,7 +474,6 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
 			
 			if (objectp->getRegion() != regionp)
 			{    // Object changed region, so update it
-				objectp->setRegion(regionp);
 				objectp->updateRegion(regionp); // for LLVOAvatar
 			}
 		}
@@ -895,6 +894,13 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
 
 BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
 {
+	// Don't ever kill gAgentAvatar, just mark it as null region instead.
+	if (objectp == gAgentAvatar)
+	{
+		objectp->setRegion(NULL);
+		return FALSE;
+	}
+
 	// When we're killing objects, all we do is mark them as dead.
 	// We clean up the dead objects later.
 
@@ -1210,11 +1216,10 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
 		}
 
 		// add all hud objects to pick list
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-		if (avatarp)
+		if (isAgentAvatarValid())
 		{
-			for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-				 iter != avatarp->mAttachmentPoints.end(); )
+			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatar->mAttachmentPoints.end(); )
 			{
 				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 				LLViewerJointAttachment* attachment = curiter->second;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 6d2bbb27ee..4b6ac07a94 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -365,9 +365,9 @@ public:
 			agent_center_text = llformat("AgentCenter  %f %f %f",
 										 (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
 
-			if (gAgent.getAvatarObject())
+			if (isAgentAvatarValid())
 			{
-				tvector = gAgent.getPosGlobalFromAgent(gAgent.getAvatarObject()->mRoot.getWorldPosition());
+				tvector = gAgent.getPosGlobalFromAgent(gAgentAvatar->mRoot.getWorldPosition());
 				agent_root_center_text = llformat("AgentRootCenter %f %f %f",
 												  (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
 			}
@@ -3150,7 +3150,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 		// setup HUD render
 		if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
 		{
-			LLBBox hud_bbox = gAgent.getAvatarObject()->getHUDBBox();
+			LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
 
 			// set up transform to encompass bounding box of HUD
 			glMatrixMode(GL_PROJECTION);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index bb69622135..8e9e15352a 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -755,11 +755,6 @@ LLVOAvatar::~LLVOAvatar()
 {
 	lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl;
 
-	if (isSelf())
-	{
-		gAgent.setAvatarObject(NULL);
-	}
-
 	mRoot.removeAllChildren();
 
 	deleteAndClearArray(mSkeleton);
@@ -965,15 +960,14 @@ void LLVOAvatar::dumpBakedStatus()
 //static
 void LLVOAvatar::restoreGL()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return;
+	if (!isAgentAvatarValid()) return;
 
-	avatarp->setCompositeUpdatesEnabled(TRUE);
-	for (U32 i = 0; i < avatarp->mBakedTextureDatas.size(); i++)
+	gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
+	for (U32 i = 0; i < gAgentAvatar->mBakedTextureDatas.size(); i++)
 	{
-		avatarp->invalidateComposite(avatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE);
+		gAgentAvatar->invalidateComposite(gAgentAvatar->mBakedTextureDatas[i].mTexLayerSet, FALSE);
 	}
-	avatarp->updateMeshTextures();
+	gAgentAvatar->updateMeshTextures();
 }
 
 //static
@@ -2085,7 +2079,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys,
 
 	if(retval & LLViewerObject::INVALID_UPDATE)
 	{
-		if(this == gAgent.getAvatarObject())
+		if (isSelf())
 		{
 			//tell sim to cancel this update
 			gAgent.teleportViaLocation(gAgent.getPositionGlobal());
@@ -6859,7 +6853,6 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id )
 // static
 void LLVOAvatar::dumpArchetypeXML( void* )
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 	LLAPRFile outfile;
 	outfile.open(gDirUtilp->getExpandedFilename(LL_PATH_CHARACTER,"new archetype.xml"), LL_APR_WB );
 	apr_file_t* file = outfile.getFileHandle() ;
@@ -6878,7 +6871,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 		const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type);
 		apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
 
-		for (LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam())
+		for (LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam())
 		{
 			LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
 			if( (viewer_param->getWearableType() == type) && 
@@ -6894,7 +6887,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 			if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type)
 			{
 				// MULTIPLE_WEARABLES: extend to multiple wearables?
-				LLViewerTexture* te_image = ((LLVOAvatar*)avatarp)->getImage((ETextureIndex)te, 0);
+				LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatar))->getImage((ETextureIndex)te, 0);
 				if( te_image )
 				{
 					std::string uuid_str;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index e3583b4d6b..0183061c0e 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -67,6 +67,14 @@
 
 #include <boost/lexical_cast.hpp>
 
+LLVOAvatarSelf *gAgentAvatar = NULL;
+BOOL isAgentAvatarValid()
+{
+	return (gAgentAvatar &&
+			(gAgentAvatar->getRegion() != NULL) &&
+			(!gAgentAvatar->isDead()));
+}
+
 using namespace LLVOAvatarDefines;
 
 /*********************************************************************************
@@ -133,7 +141,6 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id,
 	mLastRegionHandle(0),
 	mRegionCrossingCount(0)
 {
-	gAgent.setAvatarObject(this);
 	gAgentWearables.setAvatarObject(this);
 	
 	lldebugs << "Marking avatar as self " << id << llendl;
@@ -513,12 +520,6 @@ BOOL LLVOAvatarSelf::buildMenus()
 
 LLVOAvatarSelf::~LLVOAvatarSelf()
 {
-	// gAgents pointer might have been set to a different Avatar Self, don't get rid of it if so.
-	if (gAgent.getAvatarObject() == this)
-	{
-		gAgent.setAvatarObject(NULL);
-		gAgentWearables.setAvatarObject(NULL);
-	}
 	delete mScreenp;
 	mScreenp = NULL;
 }
@@ -610,6 +611,17 @@ BOOL LLVOAvatarSelf::updateCharacter(LLAgent &agent)
 	return LLVOAvatar::updateCharacter(agent);
 }
 
+// virtual
+BOOL LLVOAvatarSelf::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
+{
+	if (!isAgentAvatarValid())
+	{
+		return TRUE;
+	}
+	LLVOAvatar::idleUpdate(agent, world, time);
+	return TRUE;
+}
+
 // virtual
 LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
 {
@@ -621,7 +633,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
 	return LLVOAvatar::getJoint(name);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )
+// virtual
+BOOL LLVOAvatarSelf::setVisualParamWeight(LLVisualParam *which_param, F32 weight, BOOL upload_bake )
 {
 	if (!which_param)
 	{
@@ -631,7 +644,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
 	return setParamWeight(param,weight,upload_bake);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake )
+// virtual
+BOOL LLVOAvatarSelf::setVisualParamWeight(const char* param_name, F32 weight, BOOL upload_bake )
 {
 	if (!param_name)
 	{
@@ -641,7 +655,8 @@ LLJoint *LLVOAvatarSelf::getJoint(const std::string &name)
 	return setParamWeight(param,weight,upload_bake);
 }
 
-/*virtual*/ BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake )
+// virtual
+BOOL LLVOAvatarSelf::setVisualParamWeight(S32 index, F32 weight, BOOL upload_bake )
 {
 	LLViewerVisualParam *param = (LLViewerVisualParam*) LLCharacter::getVisualParam(index);
 	return setParamWeight(param,weight,upload_bake);
@@ -1073,7 +1088,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object)
 		// Make sure the inventory is in sync with the avatar.
 
 		// Update COF contents, don't trigger appearance update.
-		if (gAgent.getAvatarObject() == NULL)
+		if (!isAgentAvatarValid())
 		{
 			llinfos << "removeItemLinks skipped, avatar is under destruction" << llendl;
 		}
@@ -1672,7 +1687,7 @@ void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture *
 void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
 {
 	S32 gl_bytes = 0;
-	gAgent.getAvatarObject()->getLocalTextureByteCount(&gl_bytes);
+	gAgentAvatar->getLocalTextureByteCount(&gl_bytes);
 	llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;
 }
 
@@ -1929,9 +1944,7 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 {
 	LLUUID texture_id;
 	msg->getUUID("TextureData", "TextureID", texture_id);
-
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (!avatarp) return;
+	if (!isAgentAvatarValid()) return;
 
 	// If this is a texture corresponding to one of our baked entries, 
 	// just rebake that layer set.
@@ -1948,13 +1961,13 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 		const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
 		if (texture_dict->mIsBakedTexture)
 		{
-			if (texture_id == avatarp->getTEImage(index)->getID())
+			if (texture_id == gAgentAvatar->getTEImage(index)->getID())
 			{
-				LLTexLayerSet* layer_set = avatarp->getLayerSet(index);
+				LLTexLayerSet* layer_set = gAgentAvatar->getLayerSet(index);
 				if (layer_set)
 				{
 					llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
-					avatarp->invalidateComposite(layer_set, TRUE);
+					gAgentAvatar->invalidateComposite(layer_set, TRUE);
 					found = TRUE;
 					LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
 				}
@@ -1965,12 +1978,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 	// If texture not found, rebake all entries.
 	if (!found)
 	{
-		avatarp->forceBakeAllTextures();
+		gAgentAvatar->forceBakeAllTextures();
 	}
 	else
 	{
 		// Not sure if this is necessary, but forceBakeAllTextures() does it.
-		avatarp->updateMeshTextures();
+		gAgentAvatar->updateMeshTextures();
 	}
 }
 
@@ -2050,10 +2063,9 @@ void LLVOAvatarSelf::onCustomizeStart()
 // static
 void LLVOAvatarSelf::onCustomizeEnd()
 {
-	LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
-	if (avatarp)
+	if (isAgentAvatarValid())
 	{
-		avatarp->invalidateAll();
+		gAgentAvatar->invalidateAll();
 	}
 }
 
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 9514abc5bc..706a02c088 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -55,7 +55,7 @@ public:
 	LLVOAvatarSelf(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp);
 	virtual 				~LLVOAvatarSelf();
 	virtual void			markDead();
-	virtual void 		initInstance(); // Called after construction to initialize the class.
+	virtual void 			initInstance(); // Called after construction to initialize the class.
 protected:
 	/*virtual*/ BOOL		loadAvatar();
 	BOOL					loadAvatarSelf();
@@ -77,6 +77,7 @@ protected:
 	//--------------------------------------------------------------------
 public:
 	/*virtual*/ void 		updateRegion(LLViewerRegion *regionp);
+	/*virtual*/ BOOL   	 	idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time);
 
 	//--------------------------------------------------------------------
 	// LLCharacter interface and related
@@ -333,4 +334,8 @@ public:
 
 };
 
+extern LLVOAvatarSelf *gAgentAvatar;
+
+BOOL isAgentAvatarValid();
+
 #endif // LL_VO_AVATARSELF_H
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index cc346c2345..710348ac4b 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -5872,12 +5872,10 @@ void LLVoiceClient::enforceTether(void)
 
 void LLVoiceClient::updatePosition(void)
 {
-	
 	if(gVoiceClient)
 	{
-		LLVOAvatarSelf *avatarp = gAgent.getAvatarObject();
 		LLViewerRegion *region = gAgent.getRegion();
-		if(region && avatarp)
+		if(region && isAgentAvatarValid())
 		{
 			LLMatrix3 rot;
 			LLVector3d pos;
@@ -5895,9 +5893,9 @@ void LLVoiceClient::updatePosition(void)
 					rot);				// rotation matrix
 					
 			// Send the current avatar position to the voice code
-			rot = avatarp->getRootJoint()->getWorldRotation().getMatrix3();
+			rot = gAgentAvatar->getRootJoint()->getWorldRotation().getMatrix3();
 	
-			pos = avatarp->getPositionGlobal();
+			pos = gAgentAvatar->getPositionGlobal();
 			// TODO: Can we get the head offset from outside the LLVOAvatar?
 //			pos += LLVector3d(mHeadOffset);
 			pos += LLVector3d(0.f, 0.f, 1.f);
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index c9fe032a24..23a14c07ab 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -62,22 +62,20 @@ class LLOverrideBakedTextureUpdate
 public:
 	LLOverrideBakedTextureUpdate(bool temp_state)
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 		U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES;
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			composite_enabled[index] = avatarp->isCompositeUpdateEnabled(index);
+			composite_enabled[index] = gAgentAvatar->isCompositeUpdateEnabled(index);
 		}
-		avatarp->setCompositeUpdatesEnabled(temp_state);
+		gAgentAvatar->setCompositeUpdatesEnabled(temp_state);
 	}
 
 	~LLOverrideBakedTextureUpdate()
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
 		U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES;		
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			avatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
+			gAgentAvatar->setCompositeUpdatesEnabled(index, composite_enabled[index]);
 		}
 	}
 private:
@@ -204,10 +202,9 @@ BOOL LLWearable::exportFile(LLFILE* file) const
 
 void LLWearable::createVisualParams()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
+		 param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam())
 	{
 		if (param->getWearableType() == mType)
 		{
@@ -227,7 +224,7 @@ void LLWearable::createVisualParams()
 		param->resetDrivenParams();
 		if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
 		{
-			if( !param->linkDrivenParams(boost::bind(avatar_function,avatarp,_1 ), true))
+			if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatar,_1 ), true))
 			{
 				llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
 				continue;
@@ -463,9 +460,7 @@ BOOL LLWearable::importFile( LLFILE* file )
 // since this wearable was created.
 BOOL LLWearable::isOldVersion() const
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if(!avatarp) return FALSE;
+	if (!isAgentAvatarValid()) return FALSE;
 
 	if( LLWearable::sCurrentDefinitionVersion < mDefinitionVersion )
 	{
@@ -479,9 +474,9 @@ BOOL LLWearable::isOldVersion() const
 	}
 
 	S32 param_count = 0;
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) avatarp->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -527,13 +522,11 @@ BOOL LLWearable::isOldVersion() const
 // only if those values are the same as the defaults.
 BOOL LLWearable::isDirty() const
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if(!avatarp) return FALSE;
+	if (!isAgentAvatarValid()) return FALSE;
 
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) avatarp->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) 
 			&& (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) 
@@ -594,11 +587,9 @@ BOOL LLWearable::isDirty() const
 
 void LLWearable::setParamsToDefaults()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if (!avatarp) return;
+	if (!isAgentAvatarValid()) return;
 
-	for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
 	{
 		if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -634,18 +625,12 @@ void LLWearable::setTexturesToDefaults()
 // Updates the user's avatar's appearance
 void LLWearable::writeToAvatar()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if (!avatarp)
-	{
-		llerrs << "could not get avatar object to write to for wearable " << this->getName() << llendl;
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
-	ESex old_sex = avatarp->getSex();
+	ESex old_sex = gAgentAvatar->getSex();
 
 	// Pull params
-	for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
 	{
 		// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
 		// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
@@ -654,7 +639,7 @@ void LLWearable::writeToAvatar()
 			S32 param_id = param->getID();
 			F32 weight = getVisualParamWeight(param_id);
 
-			avatarp->setVisualParamWeight( param_id, weight, FALSE );
+			gAgentAvatar->setVisualParamWeight( param_id, weight, FALSE );
 		}
 	}
 
@@ -675,14 +660,14 @@ void LLWearable::writeToAvatar()
 			}
 			LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
 			// MULTI-WEARABLE: replace hard-coded 0
-			avatarp->setLocalTextureTE(te, image, 0);
+			gAgentAvatar->setLocalTextureTE(te, image, 0);
 		}
 	}
 
-	ESex new_sex = avatarp->getSex();
+	ESex new_sex = gAgentAvatar->getSex();
 	if( old_sex != new_sex )
 	{
-		avatarp->updateSexDependentLayerSets( FALSE );
+		gAgentAvatar->updateSexDependentLayerSets( FALSE );
 	}	
 	
 //	if( upload_bake )
@@ -696,12 +681,7 @@ void LLWearable::writeToAvatar()
 // static 
 void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	// You can't just remove body parts.
 	if( (type == WT_SHAPE) ||
@@ -713,12 +693,12 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 	}
 
 	// Pull params
-	for( LLVisualParam* param = avatarp->getFirstVisualParam(); param; param = avatarp->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
 	{
 		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			S32 param_id = param->getID();
-			avatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
+			gAgentAvatar->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
 		}
 	}
 
@@ -727,8 +707,8 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 		gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE);
 	}
 
-	avatarp->updateVisualParams();
-	avatarp->wearableUpdated(type, TRUE);
+	gAgentAvatar->updateVisualParams();
+	gAgentAvatar->wearableUpdated(type, TRUE);
 
 //	if( upload_bake )
 //	{
@@ -740,12 +720,7 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 // Definition version is current: removes obsolete enties and creates default values for new ones.
 void LLWearable::copyDataFrom(const LLWearable* src)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	llassert(avatarp);
-	if (!avatarp)
-	{
-		return;
-	}
+	if (!isAgentAvatarValid()) return;
 
 	mDefinitionVersion = LLWearable::sCurrentDefinitionVersion;
 
@@ -758,9 +733,9 @@ void LLWearable::copyDataFrom(const LLWearable* src)
 
 	mSavedVisualParamMap.clear();
 	// Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) avatarp->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) )
 		{
@@ -865,14 +840,12 @@ void LLWearable::addVisualParam(LLVisualParam *param)
 
 void LLWearable::setVisualParams()
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
 	for (visual_param_index_map_t::const_iterator iter = mVisualParamIndexMap.begin(); iter != mVisualParamIndexMap.end(); iter++)
 	{
 		S32 id = iter->first;
 		LLVisualParam *wearable_param = iter->second;
 		F32 value = wearable_param->getWeight();
-		avatarp->setVisualParamWeight(id, value, FALSE);
+		gAgentAvatar->setVisualParamWeight(id, value, FALSE);
 	}
 }
 
@@ -1013,8 +986,7 @@ BOOL LLWearable::isOnTop() const
 
 void LLWearable::createLayers(S32 te)
 {
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	LLTexLayerSet *layer_set = avatarp->getLayerSet((ETextureIndex)te);
+	LLTexLayerSet *layer_set = gAgentAvatar->getLayerSet((ETextureIndex)te);
 	if (layer_set)
 	{
 		layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
@@ -1112,10 +1084,9 @@ void LLWearable::destroyTextures()
 void LLWearable::pullCrossWearableValues()
 {
 	// scan through all of the avatar's visual parameters
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) avatarp->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) avatarp->getNextVisualParam())
+		 param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam())
 	{
 		if( param )
 		{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 685be043fc..fda89fae60 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3856,15 +3856,14 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render
 	}
 
 	// pick HUD objects
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-	if (avatarp && sShowHUDAttachments)
+	if (isAgentAvatarValid() && sShowHUDAttachments)
 	{
 		glh::matrix4f save_proj(glh_get_current_projection());
 		glh::matrix4f save_model(glh_get_current_modelview());
 
 		setup_hud_matrices(screen_rect);
-		for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); 
-			 iter != avatarp->mAttachmentPoints.end(); )
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatar->mAttachmentPoints.end(); )
 		{
 			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 			LLViewerJointAttachment* attachment = curiter->second;
@@ -3964,9 +3963,9 @@ void LLPipeline::rebuildPools()
 		max_count--;
 	}
 
-	if (gAgent.getAvatarObject())
+	if (isAgentAvatarValid())
 	{
-		gAgent.getAvatarObject()->rebuildHUD();
+		gAgentAvatar->rebuildHUD();
 	}
 }
 
@@ -4598,8 +4597,8 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 		glLightfv(gllight, GL_SPECULAR, LLColor4::black.mV);
 	}
 
-	if (gAgent.getAvatarObject() &&
-		gAgent.getAvatarObject()->mSpecialRenderMode == 3)
+	if (isAgentAvatarValid() &&
+		gAgentAvatar->mSpecialRenderMode == 3)
 	{
 		LLColor4  light_color = LLColor4::white;
 		light_color.mV[3] = 0.0f;
@@ -4708,15 +4707,13 @@ void LLPipeline::enableLightsDynamic()
 		glColor4f(0.f, 0.f, 0.f, 1.f); // no local lighting by default
 	}
 
-	LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
-
-	if (avatarp && getLightingDetail() <= 0)
+	if (isAgentAvatarValid() && getLightingDetail() <= 0)
 	{
-		if (avatarp->mSpecialRenderMode == 0) // normal
+		if (gAgentAvatar->mSpecialRenderMode == 0) // normal
 		{
 			gPipeline.enableLightsAvatar();
 		}
-		else if (avatarp->mSpecialRenderMode >= 1)  // anim preview
+		else if (gAgentAvatar->mSpecialRenderMode >= 1)  // anim preview
 		{
 			gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
 		}
@@ -7101,15 +7098,15 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 {
 	if (LLPipeline::sWaterReflections && assertInitialized() && LLDrawPoolWater::sNeedsReflectionUpdate)
 	{
-		LLVOAvatarSelf* avatarp = gAgent.getAvatarObject();
+		BOOL skip_avatar_update = FALSE;
 		if (gAgentCamera.getCameraAnimating() || gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
 		{
-			avatarp = NULL;
+			skip_avatar_update = TRUE;
 		}
 
-		if (avatarp)
+		if (!skip_avatar_update)
 		{
-			avatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+			gAgentAvatar->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
 		}
 		LLVertexBuffer::unbind();
 
@@ -7333,9 +7330,9 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 		LLGLState::checkTextureChannels();
 		LLGLState::checkClientArrays();
 
-		if (avatarp)
+		if (!skip_avatar_update)
 		{
-			avatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+			gAgentAvatar->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 		}
 	}
 }
-- 
cgit v1.2.3


From 58d76a9ecf83b49e42fabfada27ca20814f93cf3 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 12:11:51 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Superficial cleanup to replace all instances of "gAgentAvatar" with "gAgentAvatarp".
---
 indra/newview/llagent.cpp               | 140 +++++++++++++--------------
 indra/newview/llagentcamera.cpp         | 162 ++++++++++++++++----------------
 indra/newview/llagentui.cpp             |   6 +-
 indra/newview/llagentwearables.cpp      |  40 ++++----
 indra/newview/lldriverparam.cpp         |   6 +-
 indra/newview/llgesturemgr.cpp          |   8 +-
 indra/newview/llinventorybridge.cpp     |  16 ++--
 indra/newview/llinventoryfunctions.cpp  |   2 +-
 indra/newview/llinventorymodel.cpp      |   2 +-
 indra/newview/llinventorypanel.cpp      |   4 +-
 indra/newview/llmaniptranslate.cpp      |   2 +-
 indra/newview/llmorphview.cpp           |  14 +--
 indra/newview/llmoveview.cpp            |   8 +-
 indra/newview/llpaneleditwearable.cpp   |   2 +-
 indra/newview/llpreview.cpp             |   2 +-
 indra/newview/llpreviewanim.cpp         |  16 ++--
 indra/newview/llscrollingpanelparam.cpp |   4 +-
 indra/newview/llselectmgr.cpp           |  10 +-
 indra/newview/llsidepanelappearance.cpp |   4 +-
 indra/newview/llstartup.cpp             |   2 +-
 indra/newview/llstatusbar.cpp           |   2 +-
 indra/newview/lltexlayer.cpp            |  12 +--
 indra/newview/lltooldraganddrop.cpp     |  26 ++---
 indra/newview/lltoolfocus.cpp           |   4 +-
 indra/newview/lltoolgrab.cpp            |   2 +-
 indra/newview/lltoolmorph.cpp           |  36 +++----
 indra/newview/lltoolpie.cpp             |   6 +-
 indra/newview/lltoolplacer.cpp          |   2 +-
 indra/newview/lltoolselect.cpp          |   4 +-
 indra/newview/llviewerdisplay.cpp       |   6 +-
 indra/newview/llviewerkeyboard.cpp      |   2 +-
 indra/newview/llviewermedia.cpp         |   2 +-
 indra/newview/llviewermenu.cpp          |  40 ++++----
 indra/newview/llviewermessage.cpp       |  12 +--
 indra/newview/llviewerobject.cpp        |  10 +-
 indra/newview/llviewerobjectlist.cpp    |   8 +-
 indra/newview/llviewerwindow.cpp        |   4 +-
 indra/newview/llvoavatar.cpp            |  12 +--
 indra/newview/llvoavatarself.cpp        |  22 ++---
 indra/newview/llvoavatarself.h          |   2 +-
 indra/newview/llvoiceclient.cpp         |   4 +-
 indra/newview/llwearable.cpp            |  54 +++++------
 indra/newview/pipeline.cpp              |  16 ++--
 43 files changed, 369 insertions(+), 369 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 645acca4ae..3eeaacf93b 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -159,11 +159,11 @@ bool handleSlowMotionAnimation(const LLSD& newvalue)
 {
 	if (newvalue.asBoolean())
 	{
-		gAgentAvatar->setAnimTimeFactor(0.2f);
+		gAgentAvatarp->setAnimTimeFactor(0.2f);
 	}
 	else
 	{
-		gAgentAvatar->setAnimTimeFactor(1.0f);
+		gAgentAvatarp->setAnimTimeFactor(1.0f);
 	}
 	return true;
 }
@@ -325,9 +325,9 @@ void LLAgent::ageChat()
 	if (isAgentAvatarValid())
 	{
 		// get amount of time since I last chatted
-		F64 elapsed_time = (F64)gAgentAvatar->mChatTimer.getElapsedTimeF32();
+		F64 elapsed_time = (F64)gAgentAvatarp->mChatTimer.getElapsedTimeF32();
 		// add in frame time * 3 (so it ages 4x)
-		gAgentAvatar->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
+		gAgentAvatarp->mChatTimer.setAge(elapsed_time + (F64)gFrameDTClamped * (CHAT_AGE_FAST_RATE - 1.0));
 	}
 }
 
@@ -521,13 +521,13 @@ void LLAgent::setFlying(BOOL fly)
 		// it will be walking with flying mode "ON" indication. However we allow to switch
 		// the flying mode off if we get ANIM_AGENT_STANDUP signal. See process_avatar_animation().
 		// See EXT-2781.
-		if(fly && gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatar->mSignaledAnimations.end())
+		if(fly && gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_STANDUP) != gAgentAvatarp->mSignaledAnimations.end())
 		{
 			return;
 		}
 
 		// don't allow taking off while sitting
-		if (fly && gAgentAvatar->isSitting())
+		if (fly && gAgentAvatarp->isSitting())
 		{
 			return;
 		}
@@ -582,7 +582,7 @@ bool LLAgent::enableFlying()
 	BOOL sitting = FALSE;
 	if (isAgentAvatarValid())
 	{
-		sitting = gAgentAvatar->isSitting();
+		sitting = gAgentAvatarp->isSitting();
 	}
 	return !sitting;
 }
@@ -754,7 +754,7 @@ LLVector3 LLAgent::getVelocity() const
 {
 	if (isAgentAvatarValid())
 	{
-		return gAgentAvatar->getVelocity();
+		return gAgentAvatarp->getVelocity();
 	}
 	else
 	{
@@ -773,13 +773,13 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
 		llerrs << "setPositionAgent is not a number" << llendl;
 	}
 
-	if (isAgentAvatarValid() && gAgentAvatar->getParent())
+	if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 	{
 		LLVector3 pos_agent_sitting;
 		LLVector3d pos_agent_d;
-		LLViewerObject *parent = (LLViewerObject*)gAgentAvatar->getParent();
+		LLViewerObject *parent = (LLViewerObject*)gAgentAvatarp->getParent();
 
-		pos_agent_sitting = gAgentAvatar->getPosition() * parent->getRotation() + parent->getPositionAgent();
+		pos_agent_sitting = gAgentAvatarp->getPosition() * parent->getRotation() + parent->getPositionAgent();
 		pos_agent_d.setVec(pos_agent_sitting);
 
 		mFrameAgent.setOrigin(pos_agent_sitting);
@@ -800,9 +800,9 @@ void LLAgent::setPositionAgent(const LLVector3 &pos_agent)
 //-----------------------------------------------------------------------------
 const LLVector3d &LLAgent::getPositionGlobal() const
 {
-	if (isAgentAvatarValid() && !gAgentAvatar->mDrawable.isNull())
+	if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
 	{
-		mPositionGlobal = getPosGlobalFromAgent(gAgentAvatar->getRenderPosition());
+		mPositionGlobal = getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());
 	}
 	else
 	{
@@ -817,9 +817,9 @@ const LLVector3d &LLAgent::getPositionGlobal() const
 //-----------------------------------------------------------------------------
 const LLVector3 &LLAgent::getPositionAgent()
 {
-	if (isAgentAvatarValid() && !gAgentAvatar->mDrawable.isNull())
+	if (isAgentAvatarValid() && !gAgentAvatarp->mDrawable.isNull())
 	{
-		mFrameAgent.setOrigin(gAgentAvatar->getRenderPosition());	
+		mFrameAgent.setOrigin(gAgentAvatarp->getRenderPosition());	
 	}
 
 	return mFrameAgent.getOrigin();
@@ -946,20 +946,20 @@ LLVector3 LLAgent::getReferenceUpVector()
 	// this vector is in the coordinate frame of the avatar's parent object, or the world if none
 	LLVector3 up_vector = LLVector3::z_axis;
 	if (isAgentAvatarValid() && 
-		gAgentAvatar->getParent() &&
-		gAgentAvatar->mDrawable.notNull())
+		gAgentAvatarp->getParent() &&
+		gAgentAvatarp->mDrawable.notNull())
 	{
 		U32 camera_mode = gAgentCamera.getCameraAnimating() ? gAgentCamera.getLastCameraMode() : gAgentCamera.getCameraMode();
 		// and in third person...
 		if (camera_mode == CAMERA_MODE_THIRD_PERSON)
 		{
 			// make the up vector point to the absolute +z axis
-			up_vector = up_vector * ~((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
+			up_vector = up_vector * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
 		}
 		else if (camera_mode == CAMERA_MODE_MOUSELOOK)
 		{
 			// make the up vector point to the avatar's +z axis
-			up_vector = up_vector * gAgentAvatar->mDrawable->getRotation();
+			up_vector = up_vector * gAgentAvatarp->mDrawable->getRotation();
 		}
 	}
 
@@ -995,7 +995,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle)
 
 	F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward );
 
-	if (isAgentAvatarValid() && gAgentAvatar->isSitting())
+	if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
 	{
 		look_down_limit = 130.f * DEG_TO_RAD;
 	}
@@ -1170,7 +1170,7 @@ void LLAgent::clearAFK()
 	// without setting the appropriate control flag. JC
 	if (mControlFlags & AGENT_CONTROL_AWAY
 		|| (isAgentAvatarValid()
-			&& (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatar->mSignaledAnimations.end())))
+			&& (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AWAY) != gAgentAvatarp->mSignaledAnimations.end())))
 	{
 		sendAnimationRequest(ANIM_AGENT_AWAY, ANIM_REQUEST_STOP);
 		clearControlFlags(AGENT_CONTROL_AWAY);
@@ -1292,7 +1292,7 @@ void LLAgent::startAutoPilotGlobal(const LLVector3d &target_global, const std::s
 	LLViewerObject *obj;
 
 	LLWorld::getInstance()->resolveStepHeightGlobal(NULL, target_global, traceEndPt, targetOnGround, groundNorm, &obj);
-	F64 target_height = llmax((F64)gAgentAvatar->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
+	F64 target_height = llmax((F64)gAgentAvatarp->getPelvisToFoot(), target_global.mdV[VZ] - targetOnGround.mdV[VZ]);
 
 	// clamp z value of target to minimum height above ground
 	mAutoPilotTargetGlobal.mdV[VZ] = targetOnGround.mdV[VZ] + target_height;
@@ -1394,7 +1394,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
 		
 		if (!isAgentAvatarValid()) return;
 
-		if (gAgentAvatar->mInAir)
+		if (gAgentAvatarp->mInAir)
 		{
 			setFlying(TRUE);
 		}
@@ -1472,7 +1472,7 @@ void LLAgent::autoPilot(F32 *delta_yaw)
 		{
 			if (isAgentAvatarValid())
 			{
-				F64 current_height = gAgentAvatar->getPositionGlobal().mdV[VZ];
+				F64 current_height = gAgentAvatarp->getPositionGlobal().mdV[VZ];
 				F32 delta_z = (F32)(mAutoPilotTargetGlobal.mdV[VZ] - current_height);
 				F32 slope = delta_z / xy_distance;
 				if (slope > 0.45f && delta_z > 6.f)
@@ -1555,7 +1555,7 @@ void LLAgent::propagate(const F32 dt)
 	// handle auto-land behavior
 	if (isAgentAvatarValid())
 	{
-		BOOL in_air = gAgentAvatar->mInAir;
+		BOOL in_air = gAgentAvatarp->mInAir;
 		LLVector3 land_vel = getVelocity();
 		land_vel.mV[VZ] = 0.f;
 
@@ -1781,24 +1781,24 @@ void LLAgent::endAnimationUpdateUI()
 		// Disable mouselook-specific animations
 		if (isAgentAvatarValid())
 		{
-			if( gAgentAvatar->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
+			if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_AIM_ANIMS, NUM_AGENT_GUN_AIM_ANIMS) )
 			{
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_AIM_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_START);
@@ -1880,40 +1880,40 @@ void LLAgent::endAnimationUpdateUI()
 		if (isAgentAvatarValid())
 		{
 			// Trigger mouselook-specific animations
-			if( gAgentAvatar->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
+			if( gAgentAvatarp->isAnyAnimationSignaled(AGENT_GUN_HOLD_ANIMS, NUM_AGENT_GUN_HOLD_ANIMS) )
 			{
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_RIFLE_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_RIFLE_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_RIFLE_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_HANDGUN_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_HANDGUN_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_HANDGUN_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BAZOOKA_R) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_BAZOOKA_R, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_BAZOOKA_R, ANIM_REQUEST_START);
 				}
-				if (gAgentAvatar->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatar->mSignaledAnimations.end())
+				if (gAgentAvatarp->mSignaledAnimations.find(ANIM_AGENT_HOLD_BOW_L) != gAgentAvatarp->mSignaledAnimations.end())
 				{
 					sendAnimationRequest(ANIM_AGENT_HOLD_BOW_L, ANIM_REQUEST_STOP);
 					sendAnimationRequest(ANIM_AGENT_AIM_BOW_L, ANIM_REQUEST_START);
 				}
 			}
-			if (gAgentAvatar->getParent())
+			if (gAgentAvatarp->getParent())
 			{
 				LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
-				LLViewerObject* root_object = (LLViewerObject*)gAgentAvatar->getRoot();
+				LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
 				if (root_object->flagCameraDecoupled())
 				{
 					resetAxes(at_axis);
 				}
 				else
 				{
-					resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation());
+					resetAxes(at_axis * ~((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation());
 				}
 			}
 		}
@@ -1931,13 +1931,13 @@ void LLAgent::endAnimationUpdateUI()
 		// freeze avatar
 		if (isAgentAvatarValid())
 		{
-			mPauseRequest = gAgentAvatar->requestPause();
+			mPauseRequest = gAgentAvatarp->requestPause();
 		}
 	}
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+		gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 	}
 
 	gFloaterTools->dirty();
@@ -2016,7 +2016,7 @@ void LLAgent::setStartPosition( U32 location_id )
     if (isAgentAvatarValid())
     {
         // the z height is at the agent's feet
-        agent_pos.mV[VZ] -= 0.5f * gAgentAvatar->mBodySize.mV[VZ];
+        agent_pos.mV[VZ] -= 0.5f * gAgentAvatarp->mBodySize.mV[VZ];
     }
 
     agent_pos.mV[VX] = llclamp( agent_pos.mV[VX], INSET, REGION_WIDTH - INSET );
@@ -2123,7 +2123,7 @@ void LLAgent::onAnimStop(const LLUUID& id)
 		setControlFlags(AGENT_CONTROL_FINISH_ANIM);
 
 		// now trigger dusting self off animation
-		if (isAgentAvatarValid() && !gAgentAvatar->mBelowWater && rand() % 3 == 0)
+		if (isAgentAvatarValid() && !gAgentAvatarp->mBelowWater && rand() % 3 == 0)
 			sendAnimationRequest( ANIM_AGENT_BRUSH, ANIM_REQUEST_START );
 	}
 	else if (id == ANIM_AGENT_PRE_JUMP || id == ANIM_AGENT_LAND || id == ANIM_AGENT_MEDIUM_LAND)
@@ -2324,7 +2324,7 @@ void LLAgent::buildFullnameAndTitle(std::string& name) const
 
 	if (isAgentAvatarValid())
 	{
-		name += gAgentAvatar->getFullname();
+		name += gAgentAvatarp->getFullname();
 	}
 }
 
@@ -2470,14 +2470,14 @@ BOOL LLAgent::canJoinGroups() const
 
 LLQuaternion LLAgent::getHeadRotation()
 {
-	if (!isAgentAvatarValid() || !gAgentAvatar->mPelvisp || !gAgentAvatar->mHeadp)
+	if (!isAgentAvatarValid() || !gAgentAvatarp->mPelvisp || !gAgentAvatarp->mHeadp)
 	{
 		return LLQuaternion::DEFAULT;
 	}
 
 	if (!gAgentCamera.cameraMouselook())
 	{
-		return gAgentAvatar->getRotation();
+		return gAgentAvatarp->getRotation();
 	}
 
 	// We must be in mouselook
@@ -2486,9 +2486,9 @@ LLQuaternion LLAgent::getHeadRotation()
 	LLVector3 left = up % look_dir;
 
 	LLQuaternion rot(look_dir, left, up);
-	if (gAgentAvatar->getParent())
+	if (gAgentAvatarp->getParent())
 	{
-		rot = rot * ~gAgentAvatar->getParent()->getRotation();
+		rot = rot * ~gAgentAvatarp->getParent()->getRotation();
 	}
 
 	return rot;
@@ -3111,7 +3111,7 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 {
 	gAgentQueryManager.mNumPendingQueries--;
 
-	if (!isAgentAvatarValid() || gAgentAvatar->isDead())
+	if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
 	{
 		llwarns << "No avatar for user in cached texture update!" << llendl;
 		return;
@@ -3144,27 +3144,27 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 			if (texture_id.notNull())
 			{
 				//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
-				gAgentAvatar->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
-				//gAgentAvatar->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
+				gAgentAvatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
+				//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
 				gAgentQueryManager.mActiveCacheQueries[texture_index] = 0;
 				num_results++;
 			}
 			else
 			{
 				// no cache of this bake. request upload.
-				gAgentAvatar->requestLayerSetUpload((EBakedTextureIndex)texture_index);
+				gAgentAvatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index);
 			}
 		}
 	}
 
 	llinfos << "Received cached texture response for " << num_results << " textures." << llendl;
 
-	gAgentAvatar->updateMeshTextures();
+	gAgentAvatarp->updateMeshTextures();
 
 	if (gAgentQueryManager.mNumPendingQueries == 0)
 	{
 		// RN: not sure why composites are disabled at this point
-		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
 		gAgent.sendAgentSetAppearance();
 	}
 }
@@ -3219,8 +3219,8 @@ void LLAgent::clearVisualParams(void *data)
 {
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->clearVisualParamWeights();
-		gAgentAvatar->updateVisualParams();
+		gAgentAvatarp->clearVisualParamWeights();
+		gAgentAvatarp->updateVisualParams();
 	}
 }
 
@@ -3246,13 +3246,13 @@ bool LLAgent::teleportCore(bool is_local)
 	// Stop all animation before actual teleporting 
         if (isAgentAvatarValid())
 	{
-		for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatar->mPlayingAnimations.begin();
-		      anim_it != gAgentAvatar->mPlayingAnimations.end();
+		for ( LLVOAvatar::AnimIterator anim_it= gAgentAvatarp->mPlayingAnimations.begin();
+		      anim_it != gAgentAvatarp->mPlayingAnimations.end();
 		      ++anim_it)
                {
-                       gAgentAvatar->stopMotion(anim_it->first);
+                       gAgentAvatarp->stopMotion(anim_it->first);
                }
-               gAgentAvatar->processAnimationStateChanges();
+               gAgentAvatarp->processAnimationStateChanges();
        }
 #endif
 
@@ -3448,8 +3448,8 @@ void LLAgent::stopCurrentAnimations()
 	if (isAgentAvatarValid())
 	{
 		for ( LLVOAvatar::AnimIterator anim_it =
-			      gAgentAvatar->mPlayingAnimations.begin();
-		      anim_it != gAgentAvatar->mPlayingAnimations.end();
+			      gAgentAvatarp->mPlayingAnimations.begin();
+		      anim_it != gAgentAvatarp->mPlayingAnimations.end();
 		      anim_it++)
 		{
 			if (anim_it->first ==
@@ -3462,7 +3462,7 @@ void LLAgent::stopCurrentAnimations()
 			else
 			{
 				// stop this animation locally
-				gAgentAvatar->stopMotion(anim_it->first, TRUE);
+				gAgentAvatarp->stopMotion(anim_it->first, TRUE);
 				// ...and tell the server to tell everyone.
 				sendAnimationRequest(anim_it->first, ANIM_REQUEST_STOP);
 			}
@@ -3577,7 +3577,7 @@ void LLAgent::sendAgentSetAppearance()
 	}
 
 
-	llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatar->getBakedStatusForPrintout() << llendl;
+	llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl;
 	//dumpAvatarTEs( "sendAgentSetAppearance()" );
 
 	LLMessageSystem* msg = gMessageSystem;
@@ -3591,7 +3591,7 @@ void LLAgent::sendAgentSetAppearance()
 	// NOTE -- when we start correcting all of the other Havok geometry 
 	// to compensate for the COLLISION_TOLERANCE ugliness we will have 
 	// to tweak this number again
-	const LLVector3 body_size = gAgentAvatar->mBodySize;
+	const LLVector3 body_size = gAgentAvatarp->mBodySize;
 	msg->addVector3Fast(_PREHASH_Size, body_size);	
 
 	// To guard against out of order packets
@@ -3601,20 +3601,20 @@ void LLAgent::sendAgentSetAppearance()
 
 	// is texture data current relative to wearables?
 	// KLW - TAT this will probably need to check the local queue.
-	BOOL textures_current = gAgentAvatar->areTexturesCurrent();
+	BOOL textures_current = gAgentAvatarp->areTexturesCurrent();
 
 	for(U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++ )
 	{
 		const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
 
 		// if we're not wearing a skirt, we don't need the texture to be baked
-		if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatar->isWearingWearableType(WT_SKIRT))
+		if (texture_index == TEX_SKIRT_BAKED && !gAgentAvatarp->isWearingWearableType(WT_SKIRT))
 		{
 			continue;
 		}
 
 		// IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures
-		if (!gAgentAvatar->isTextureDefined(texture_index, 0))
+		if (!gAgentAvatarp->isTextureDefined(texture_index, 0))
 		{
 			textures_current = FALSE;
 			break;
@@ -3652,7 +3652,7 @@ void LLAgent::sendAgentSetAppearance()
 			msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
 		}
 		msg->nextBlockFast(_PREHASH_ObjectData);
-		gAgentAvatar->sendAppearanceMessage( gMessageSystem );
+		gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
 	}
 	else
 	{
@@ -3665,9 +3665,9 @@ void LLAgent::sendAgentSetAppearance()
 
 
 	S32 transmitted_params = 0;
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatar->getFirstVisualParam();
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*)gAgentAvatarp->getFirstVisualParam();
 		 param;
-		 param = (LLViewerVisualParam*)gAgentAvatar->getNextVisualParam())
+		 param = (LLViewerVisualParam*)gAgentAvatarp->getNextVisualParam())
 	{
 		if (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE)
 		{
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 62f1746f28..2dd523cb24 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -374,7 +374,7 @@ void LLAgentCamera::unlockView()
 	{
 		if (isAgentAvatarValid())
 		{
-			setFocusGlobal(LLVector3d::zero, gAgentAvatar->mID);
+			setFocusGlobal(LLVector3d::zero, gAgentAvatarp->mID);
 		}
 		setFocusOnAvatar(FALSE, FALSE);	// no animation
 	}
@@ -1093,23 +1093,23 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 
 	if (!isAgentAvatarValid()) return;
 
-	LLQuaternion av_inv_rot = ~gAgentAvatar->mRoot.getWorldRotation();
-	LLVector3 root_at = LLVector3::x_axis * gAgentAvatar->mRoot.getWorldRotation();
+	LLQuaternion av_inv_rot = ~gAgentAvatarp->mRoot.getWorldRotation();
+	LLVector3 root_at = LLVector3::x_axis * gAgentAvatarp->mRoot.getWorldRotation();
 
 	if 	((gViewerWindow->getMouseVelocityStat()->getCurrent() < 0.01f) &&
 		 (root_at * last_at_axis > 0.95f))
 	{
-		LLVector3 vel = gAgentAvatar->getVelocity();
+		LLVector3 vel = gAgentAvatarp->getVelocity();
 		if (vel.magVecSquared() > 4.f)
 		{
-			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatar, vel * av_inv_rot);
+			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, vel * av_inv_rot);
 		}
 		else
 		{
 			// *FIX: rotate mframeagent by sit object's rotation?
-			LLQuaternion look_rotation = gAgentAvatar->isSitting() ? gAgentAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
+			LLQuaternion look_rotation = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); // use camera's current rotation
 			LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot;
-			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatar, look_offset);
+			setLookAt(LOOKAT_TARGET_IDLE, gAgentAvatarp, look_offset);
 		}
 		last_at_axis = root_at;
 		return;
@@ -1119,7 +1119,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 	
 	if (CAMERA_MODE_CUSTOMIZE_AVATAR == getCameraMode())
 	{
-		setLookAt(LOOKAT_TARGET_NONE, gAgentAvatar, LLVector3(-2.f, 0.f, 0.f));	
+		setLookAt(LOOKAT_TARGET_NONE, gAgentAvatarp, LLVector3(-2.f, 0.f, 0.f));	
 	}
 	else
 	{
@@ -1148,7 +1148,7 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 		headLookAxis = frameCamera.getAtAxis();
 		// RN: we use world-space offset for mouselook and freelook
 		//headLookAxis = headLookAxis * av_inv_rot;
-		setLookAt(lookAtType, gAgentAvatar, headLookAxis);
+		setLookAt(lookAtType, gAgentAvatarp, headLookAxis);
 	}
 }
 
@@ -1170,12 +1170,12 @@ void LLAgentCamera::updateCamera()
 	validateFocusObject();
 
 	if (isAgentAvatarValid() && 
-		gAgentAvatar->isSitting() &&
+		gAgentAvatarp->isSitting() &&
 		camera_mode == CAMERA_MODE_MOUSELOOK)
 	{
 		//Ventrella
 		//changed camera_skyward to the new global "mCameraUpVector"
-		mCameraUpVector = mCameraUpVector * gAgentAvatar->getRenderRotation();
+		mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation();
 		//end Ventrella
 	}
 
@@ -1291,13 +1291,13 @@ void LLAgentCamera::updateCamera()
 			// (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent.
 			//--------------------------------------------------------------------------------
 			// *TODO: use combined rotation of frameagent and sit object
-			LLQuaternion avatarRotationForFollowCam = gAgentAvatar->isSitting() ? gAgentAvatar->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
+			LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion();
 
 			LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams();
 			if (current_cam)
 			{
 				mFollowCam.copyParams(*current_cam);
-				mFollowCam.setSubjectPositionAndRotation( gAgentAvatar->getRenderPosition(), avatarRotationForFollowCam );
+				mFollowCam.setSubjectPositionAndRotation( gAgentAvatarp->getRenderPosition(), avatarRotationForFollowCam );
 				mFollowCam.update();
 				LLViewerJoystick::getInstance()->setCameraNeedsUpdate(true);
 			}
@@ -1374,7 +1374,7 @@ void LLAgentCamera::updateCamera()
 
 		if (isAgentAvatarValid() && (mCameraMode != CAMERA_MODE_MOUSELOOK))
 		{
-			gAgentAvatar->updateAttachmentVisibility(mCameraMode);
+			gAgentAvatarp->updateAttachmentVisibility(mCameraMode);
 		}
 	}
 	else 
@@ -1472,40 +1472,40 @@ void LLAgentCamera::updateCamera()
 	}
 	gAgent.setLastPositionGlobal(global_pos);
 	
-	if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatar->isSitting() && cameraMouselook())
+	if (LLVOAvatar::sVisibleInFirstPerson && isAgentAvatarValid() && !gAgentAvatarp->isSitting() && cameraMouselook())
 	{
-		LLVector3 head_pos = gAgentAvatar->mHeadp->getWorldPosition() + 
-			LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatar->mHeadp->getWorldRotation() + 
-			LLVector3(0.1f, 0.f, 0.f) * gAgentAvatar->mPelvisp->getWorldRotation();
+		LLVector3 head_pos = gAgentAvatarp->mHeadp->getWorldPosition() + 
+			LLVector3(0.08f, 0.f, 0.05f) * gAgentAvatarp->mHeadp->getWorldRotation() + 
+			LLVector3(0.1f, 0.f, 0.f) * gAgentAvatarp->mPelvisp->getWorldRotation();
 		LLVector3 diff = mCameraPositionAgent - head_pos;
-		diff = diff * ~gAgentAvatar->mRoot.getWorldRotation();
+		diff = diff * ~gAgentAvatarp->mRoot.getWorldRotation();
 
-		LLJoint* torso_joint = gAgentAvatar->mTorsop;
-		LLJoint* chest_joint = gAgentAvatar->mChestp;
+		LLJoint* torso_joint = gAgentAvatarp->mTorsop;
+		LLJoint* chest_joint = gAgentAvatarp->mChestp;
 		LLVector3 torso_scale = torso_joint->getScale();
 		LLVector3 chest_scale = chest_joint->getScale();
 
 		// shorten avatar skeleton to avoid foot interpenetration
-		if (!gAgentAvatar->mInAir)
+		if (!gAgentAvatarp->mInAir)
 		{
 			LLVector3 chest_offset = LLVector3(0.f, 0.f, chest_joint->getPosition().mV[VZ]) * torso_joint->getWorldRotation();
 			F32 z_compensate = llclamp(-diff.mV[VZ], -0.2f, 1.f);
 			F32 scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / chest_offset.mV[VZ]), 0.5f, 1.2f);
 			torso_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
 
-			LLJoint* neck_joint = gAgentAvatar->mNeckp;
+			LLJoint* neck_joint = gAgentAvatarp->mNeckp;
 			LLVector3 neck_offset = LLVector3(0.f, 0.f, neck_joint->getPosition().mV[VZ]) * chest_joint->getWorldRotation();
 			scale_factor = llclamp(1.f - ((z_compensate * 0.5f) / neck_offset.mV[VZ]), 0.5f, 1.2f);
 			chest_joint->setScale(LLVector3(1.f, 1.f, scale_factor));
 			diff.mV[VZ] = 0.f;
 		}
 
-		gAgentAvatar->mPelvisp->setPosition(gAgentAvatar->mPelvisp->getPosition() + diff);
+		gAgentAvatarp->mPelvisp->setPosition(gAgentAvatarp->mPelvisp->getPosition() + diff);
 
-		gAgentAvatar->mRoot.updateWorldMatrixChildren();
+		gAgentAvatarp->mRoot.updateWorldMatrixChildren();
 
-		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-			 iter != gAgentAvatar->mAttachmentPoints.end(); )
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 		{
 			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 			LLViewerJointAttachment* attachment = curiter->second;
@@ -1607,12 +1607,12 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
 	{
 		LLVector3d at_axis(1.0, 0.0, 0.0);
 		LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
-		if (isAgentAvatarValid() && gAgentAvatar->getParent())
+		if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 		{
-			LLViewerObject* root_object = (LLViewerObject*)gAgentAvatar->getRoot();
+			LLViewerObject* root_object = (LLViewerObject*)gAgentAvatarp->getRoot();
 			if (!root_object->flagCameraDecoupled())
 			{
-				agent_rot *= ((LLViewerObject*)(gAgentAvatar->getParent()))->getRenderRotation();
+				agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
 			}
 		}
 		at_axis = at_axis * agent_rot;
@@ -1662,7 +1662,7 @@ LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal()
 		}
 		return mFocusTargetGlobal;
 	}
-	else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatar->isSitting() && mSitCameraReferenceObject.notNull())
+	else if (mSitCameraEnabled && isAgentAvatarValid() && gAgentAvatarp->isSitting() && mSitCameraReferenceObject.notNull())
 	{
 		// sit camera
 		LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition();
@@ -1682,9 +1682,9 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
 	// ...offset from avatar
 	LLVector3d focus_offset;
 	LLQuaternion agent_rot = gAgent.getFrameAgent().getQuaternion();
-	if (isAgentAvatarValid() && gAgentAvatar->getParent())
+	if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 	{
-		agent_rot *= ((LLViewerObject*)(gAgentAvatar->getParent()))->getRenderRotation();
+		agent_rot *= ((LLViewerObject*)(gAgentAvatarp->getParent()))->getRenderRotation();
 	}
 
 	focus_offset = mFocusOffsetInitial[mCameraPreset] * agent_rot;
@@ -1694,9 +1694,9 @@ LLVector3d LLAgentCamera::calcThirdPersonFocusOffset()
 void LLAgentCamera::setupSitCamera()
 {
 	// agent frame entering this function is in world coordinates
-	if (isAgentAvatarValid() && gAgentAvatar->getParent())
+	if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 	{
-		LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
+		LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
 		// slam agent coordinate frame to proper parent local version
 		LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis();
 		at_axis.mV[VZ] = 0.f;
@@ -1763,7 +1763,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 	F32			camera_land_height;
 	LLVector3d	frame_center_global = !isAgentAvatarValid() ? 
 		gAgent.getPositionGlobal() :
-		gAgent.getPosGlobalFromAgent(gAgentAvatar->mRoot.getWorldPosition());
+		gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition());
 	
 	BOOL		isConstrained = FALSE;
 	LLVector3d	head_offset;
@@ -1778,32 +1778,32 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 	}// End Ventrella
 	else if (mCameraMode == CAMERA_MODE_MOUSELOOK)
 	{
-		if (!isAgentAvatarValid() || gAgentAvatar->mDrawable.isNull())
+		if (!isAgentAvatarValid() || gAgentAvatarp->mDrawable.isNull())
 		{
 			llwarns << "Null avatar drawable!" << llendl;
 			return LLVector3d::zero;
 		}
 		head_offset.clearVec();
-		if (gAgentAvatar->isSitting() && gAgentAvatar->getParent())
+		if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent())
 		{
-			gAgentAvatar->updateHeadOffset();
-			head_offset.mdV[VX] = gAgentAvatar->mHeadOffset.mV[VX];
-			head_offset.mdV[VY] = gAgentAvatar->mHeadOffset.mV[VY];
-			head_offset.mdV[VZ] = gAgentAvatar->mHeadOffset.mV[VZ] + 0.1f;
-			const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatar->getParent())->getRenderMatrix();
+			gAgentAvatarp->updateHeadOffset();
+			head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX];
+			head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY];
+			head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f;
+			const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix();
 			camera_position_global = gAgent.getPosGlobalFromAgent
-								((gAgentAvatar->getPosition()+
-								 LLVector3(head_offset)*gAgentAvatar->getRotation()) * mat);
+								((gAgentAvatarp->getPosition()+
+								 LLVector3(head_offset)*gAgentAvatarp->getRotation()) * mat);
 		}
 		else
 		{
-			head_offset.mdV[VZ] = gAgentAvatar->mHeadOffset.mV[VZ];
-			if (gAgentAvatar->isSitting())
+			head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ];
+			if (gAgentAvatarp->isSitting())
 			{
 				head_offset.mdV[VZ] += 0.1;
 			}
-			camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatar->getRenderPosition());//frame_center_global;
-			head_offset = head_offset * gAgentAvatar->getRenderRotation();
+			camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global;
+			head_offset = head_offset * gAgentAvatarp->getRenderRotation();
 			camera_position_global = camera_position_global + head_offset;
 		}
 	}
@@ -1814,7 +1814,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 
 		if (mSitCameraEnabled 
 			&& isAgentAvatarValid() 
-			&& gAgentAvatar->isSitting() 
+			&& gAgentAvatarp->isSitting() 
 			&& mSitCameraReferenceObject.notNull())
 		{
 			// sit camera
@@ -1830,9 +1830,9 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 			local_camera_offset = mCameraZoomFraction * getCameraOffsetInitial() * gSavedSettings.getF32("CameraOffsetScale");
 			
 			// are we sitting down?
-			if (isAgentAvatarValid() && gAgentAvatar->getParent())
+			if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 			{
-				LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
+				LLQuaternion parent_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
 				// slam agent coordinate frame to proper parent local version
 				LLVector3 at_axis = gAgent.getFrameAgent().getAtAxis() * parent_rot;
 				at_axis.mV[VZ] = 0.f;
@@ -1846,7 +1846,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 				local_camera_offset = gAgent.getFrameAgent().rotateToAbsolute( local_camera_offset );
 			}
 
-			if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatar->isSitting()))
+			if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !gAgentAvatarp->isSitting()))
 			{
 				LLVector3 plane_normal;
 				plane_normal.setVec(mCameraCollidePlane.mV);
@@ -1899,7 +1899,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 			// set the global camera position
 			LLVector3d camera_offset;
 			
-			LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : gAgentAvatar->getRenderPosition();
+			LLVector3 av_pos = !isAgentAvatarValid() ? LLVector3::zero : gAgentAvatarp->getRenderPosition();
 			camera_offset.setVec( local_camera_offset );
 			camera_position_global = frame_center_global + head_offset + camera_offset;
 
@@ -1911,8 +1911,8 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 				LLVector3 vel = gAgent.getVelocity();
 
 				// lag by appropriate amount for flying
-				F32 time_in_air = gAgentAvatar->mTimeInAir.getElapsedTimeF32();
-				if(!mCameraAnimating && gAgentAvatar->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
+				F32 time_in_air = gAgentAvatarp->mTimeInAir.getElapsedTimeF32();
+				if(!mCameraAnimating && gAgentAvatarp->mInAir && time_in_air > GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME)
 				{
 					LLVector3 frame_at_axis = gAgent.getFrameAgent().getAtAxis();
 					frame_at_axis -= projected_vec(frame_at_axis, gAgent.getReferenceUpVector());
@@ -1924,7 +1924,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit)
 
 					lag_interp *= u;
 
-					if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatar->getID())
+					if (gViewerWindow->getLeftMouseDown() && gViewerWindow->getLastPick().mObjectID == gAgentAvatarp->getID())
 					{
 						// disable camera lag when using mouse-directed steering
 						target_lag.clearVec();
@@ -2135,8 +2135,8 @@ void LLAgentCamera::changeCameraToMouselook(BOOL animate)
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->stopMotion(ANIM_AGENT_BODY_NOISE);
-		gAgentAvatar->stopMotion(ANIM_AGENT_BREATHE_ROT);
+		gAgentAvatarp->stopMotion(ANIM_AGENT_BODY_NOISE);
+		gAgentAvatarp->stopMotion(ANIM_AGENT_BREATHE_ROT);
 	}
 
 	//gViewerWindow->stopGrab();
@@ -2223,9 +2223,9 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
 
 		if (isAgentAvatarValid())
 		{
-			gAgentAvatar->mPelvisp->setPosition(LLVector3::zero);
-			gAgentAvatar->startMotion( ANIM_AGENT_BODY_NOISE );
-			gAgentAvatar->startMotion( ANIM_AGENT_BREATHE_ROT );
+			gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
+			gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
+			gAgentAvatarp->startMotion( ANIM_AGENT_BREATHE_ROT );
 		}
 
 		// unpause avatar animation
@@ -2266,12 +2266,12 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 
 	if (isAgentAvatarValid())
 	{
-		if (!gAgentAvatar->isSitting())
+		if (!gAgentAvatarp->isSitting())
 		{
-			gAgentAvatar->mPelvisp->setPosition(LLVector3::zero);
+			gAgentAvatarp->mPelvisp->setPosition(LLVector3::zero);
 		}
-		gAgentAvatar->startMotion(ANIM_AGENT_BODY_NOISE);
-		gAgentAvatar->startMotion(ANIM_AGENT_BREATHE_ROT);
+		gAgentAvatarp->startMotion(ANIM_AGENT_BODY_NOISE);
+		gAgentAvatarp->startMotion(ANIM_AGENT_BREATHE_ROT);
 	}
 
 	LLVector3 at_axis;
@@ -2305,9 +2305,9 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 	}
 
 	// Remove any pitch from the avatar
-	if (isAgentAvatarValid() && gAgentAvatar->getParent())
+	if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 	{
-		LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
+		LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
 		at_axis = LLViewerCamera::getInstance()->getAtAxis();
 		at_axis.mV[VZ] = 0.f;
 		at_axis.normalize();
@@ -2391,8 +2391,8 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 
 			gAgent.sendAnimationRequest(ANIM_AGENT_CUSTOMIZE, ANIM_REQUEST_START);
 			gAgent.setCustomAnim(TRUE);
-			gAgentAvatar->startMotion(ANIM_AGENT_CUSTOMIZE);
-			LLMotion* turn_motion = gAgentAvatar->findMotion(ANIM_AGENT_CUSTOMIZE);
+			gAgentAvatarp->startMotion(ANIM_AGENT_CUSTOMIZE);
+			LLMotion* turn_motion = gAgentAvatarp->findMotion(ANIM_AGENT_CUSTOMIZE);
 
 			if (turn_motion)
 			{
@@ -2503,7 +2503,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 		{
 			if (isAgentAvatarValid())
 			{
-				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatar->mHeadp->getWorldPosition());
+				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
 			}
 			else
 			{
@@ -2548,7 +2548,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 		{
 			if (isAgentAvatarValid())
 			{
-				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatar->mHeadp->getWorldPosition());
+				mFocusTargetGlobal = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mHeadp->getWorldPosition());
 			}
 			else
 			{
@@ -2685,9 +2685,9 @@ void LLAgentCamera::setFocusOnAvatar(BOOL focus_on_avatar, BOOL animate)
 		if (mCameraMode == CAMERA_MODE_THIRD_PERSON)
 		{
 			LLVector3 at_axis;
-			if (isAgentAvatarValid() && gAgentAvatar->getParent())
+			if (isAgentAvatarValid() && gAgentAvatarp->getParent())
 			{
-				LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatar->getParent())->getRenderRotation();
+				LLQuaternion obj_rot = ((LLViewerObject*)gAgentAvatarp->getParent())->getRenderRotation();
 				at_axis = LLViewerCamera::getInstance()->getAtAxis();
 				at_axis.mV[VZ] = 0.f;
 				at_axis.normalize();
@@ -2720,10 +2720,10 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L
 		LLViewerObject* parent = object;
 		while(parent)
 		{
-			if (parent == gAgentAvatar)
+			if (parent == gAgentAvatarp)
 			{
 				// looking at an attachment on ourselves, which we don't want to do
-				object = gAgentAvatar;
+				object = gAgentAvatarp;
 				position.clearVec();
 			}
 			parent = (LLViewerObject*)parent->getParent();
@@ -2732,7 +2732,7 @@ BOOL LLAgentCamera::setLookAt(ELookAtType target_type, LLViewerObject *object, L
 	if(!mLookAt || mLookAt->isDead())
 	{
 		mLookAt = (LLHUDEffectLookAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_LOOKAT);
-		mLookAt->setSourceObject(gAgentAvatar);
+		mLookAt->setSourceObject(gAgentAvatarp);
 	}
 
 	return mLookAt->setLookAt(target_type, object, position);
@@ -2761,7 +2761,7 @@ void LLAgentCamera::lookAtLastChat()
 		LLVOAvatar *chatter_av = (LLVOAvatar*)chatter;
 		if (isAgentAvatarValid() && chatter_av->mHeadp)
 		{
-			delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatar->mHeadp->getWorldPosition();
+			delta_pos = chatter_av->mHeadp->getWorldPosition() - gAgentAvatarp->mHeadp->getWorldPosition();
 		}
 		else
 		{
@@ -2773,7 +2773,7 @@ void LLAgentCamera::lookAtLastChat()
 
 		changeCameraToThirdPerson();
 
-		LLVector3 new_camera_pos = gAgentAvatar->mHeadp->getWorldPosition();
+		LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
 		LLVector3 left = delta_pos % LLVector3::z_axis;
 		left.normalize();
 		LLVector3 up = left % delta_pos;
@@ -2802,7 +2802,7 @@ void LLAgentCamera::lookAtLastChat()
 
 		changeCameraToThirdPerson();
 
-		LLVector3 new_camera_pos = gAgentAvatar->mHeadp->getWorldPosition();
+		LLVector3 new_camera_pos = gAgentAvatarp->mHeadp->getWorldPosition();
 		LLVector3 left = delta_pos % LLVector3::z_axis;
 		left.normalize();
 		LLVector3 up = left % delta_pos;
@@ -2827,7 +2827,7 @@ BOOL LLAgentCamera::setPointAt(EPointAtType target_type, LLViewerObject *object,
 	if (!mPointAt || mPointAt->isDead())
 	{
 		mPointAt = (LLHUDEffectPointAt *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINTAT);
-		mPointAt->setSourceObject(gAgentAvatar);
+		mPointAt->setSourceObject(gAgentAvatarp);
 	}
 	return mPointAt->setPointAt(target_type, object, position);
 }
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 452a11b01e..c4597ad6f8 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -51,8 +51,8 @@ void LLAgentUI::buildName(std::string& name)
 	name.clear();
 	if (isAgentAvatarValid())
 	{
-		LLNameValue *first_nv = gAgentAvatar->getNVPair("FirstName");
-		LLNameValue *last_nv = gAgentAvatar->getNVPair("LastName");
+		LLNameValue *first_nv = gAgentAvatarp->getNVPair("FirstName");
+		LLNameValue *last_nv = gAgentAvatarp->getNVPair("LastName");
 		if (first_nv && last_nv)
 		{
 			name = first_nv->printData() + " " + last_nv->printData();
@@ -72,7 +72,7 @@ void LLAgentUI::buildName(std::string& name)
 void LLAgentUI::buildFullname(std::string& name)
 {
 	if (isAgentAvatarValid())
-		name = gAgentAvatar->getFullname();
+		name = gAgentAvatarp->getFullname();
 }
 
 //static
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 91552a7f5b..62fc5544ab 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -485,7 +485,7 @@ void LLAgentWearables::saveWearable(const EWearableType type, const U32 index, B
 			return;
 		}
 
-		gAgentAvatar->wearableUpdated( type, TRUE );
+		gAgentAvatarp->wearableUpdated( type, TRUE );
 
 		if (send_update)
 		{
@@ -783,7 +783,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
 
 void LLAgentWearables::wearableUpdated(LLWearable *wearable)
 {
-	gAgentAvatar->wearableUpdated(wearable->getType(), TRUE);
+	gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
 	wearable->refreshName();
 	wearable->setLabelUpdated();
 
@@ -827,7 +827,7 @@ void LLAgentWearables::popWearable(const EWearableType type, U32 index)
 	if (wearable)
 	{
 		mWearableDatas[type].erase(mWearableDatas[type].begin() + index);
-		gAgentAvatar->wearableUpdated(wearable->getType(), TRUE);
+		gAgentAvatarp->wearableUpdated(wearable->getType(), TRUE);
 		wearable->setLabelUpdated();
 	}
 }
@@ -959,7 +959,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 	LLUUID agent_id;
 	gMessageSystem->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
 
-	if (isAgentAvatarValid() && (agent_id == gAgentAvatar->getID()))
+	if (isAgentAvatarValid() && (agent_id == gAgentAvatarp->getID()))
 	{
 		gMessageSystem->getU32Fast(_PREHASH_AgentData, _PREHASH_SerialNum, gAgentQueryManager.mUpdateSerialNum);
 		
@@ -1061,9 +1061,9 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
 		gAgentWearables.mItemsAwaitingWearableUpdate.erase(wear_data->mItemID);
 
 		// disable composites if initial textures are baked
-		gAgentAvatar->setupComposites();
+		gAgentAvatarp->setupComposites();
 
-		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
 		gInventory.addChangedMask(LLInventoryObserver::LABEL, wearable->getItemID());
 	}
 	else
@@ -1092,7 +1092,7 @@ void LLAgentWearables::onInitialWearableAssetArrived(LLWearable* wearable, void*
 		// If there are any, schedule them to be uploaded as soon as the layer textures they depend on arrive.
 		if (gAgentCamera.cameraCustomizeAvatar())
 		{
-			gAgentAvatar->requestLayerSetUploads();
+			gAgentAvatarp->requestLayerSetUploads();
 		}
 	}
 }
@@ -1234,7 +1234,7 @@ void LLAgentWearables::createStandardWearables(BOOL female)
 
 	if (!isAgentAvatarValid()) return;
 
-	gAgentAvatar->setSex(female ? SEX_FEMALE : SEX_MALE);
+	gAgentAvatarp->setSex(female ? SEX_FEMALE : SEX_MALE);
 
 	const BOOL create[WT_COUNT] = 
 		{
@@ -1283,7 +1283,7 @@ void LLAgentWearables::createStandardWearablesDone(S32 type, U32 index)
 	llinfos << "type " << type << " index " << index << llendl;
 
 	if (!isAgentAvatarValid()) return;
-	gAgentAvatar->updateVisualParams();
+	gAgentAvatarp->updateVisualParams();
 }
 
 void LLAgentWearables::createStandardWearablesAllDone()
@@ -1298,7 +1298,7 @@ void LLAgentWearables::createStandardWearablesAllDone()
 	updateServer();
 
 	// Treat this as the first texture entry message, if none received yet
-	gAgentAvatar->onFirstTEMessageReceived();
+	gAgentAvatarp->onFirstTEMessageReceived();
 }
 
 // MULTI-WEARABLE: Properly handle multiwearables later.
@@ -1418,7 +1418,7 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
 		for (S32 i = 0; i < attachments_to_include.count(); i++)
 		{
 			S32 attachment_pt = attachments_to_include[i];
-			LLViewerJointAttachment* attachment = get_if_there(gAgentAvatar->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
+			LLViewerJointAttachment* attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachment_pt, (LLViewerJointAttachment*)NULL);
 			if (!attachment) continue;
 			for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
 				 attachment_iter != attachment->mAttachedObjects.end();
@@ -1762,9 +1762,9 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
-		gAgentAvatar->updateVisualParams();
-		gAgentAvatar->invalidateAll();
+		gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+		gAgentAvatarp->updateVisualParams();
+		gAgentAvatarp->invalidateAll();
 	}
 
 	// Start rendering & update the server
@@ -2023,8 +2023,8 @@ void LLAgentWearables::userUpdateAttachments(LLInventoryModel::item_array_t& obj
 
 	// Build up list of objects to be removed and items currently attached.
 	llvo_vec_t objects_to_remove;
-	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-		 iter != gAgentAvatar->mAttachmentPoints.end();)
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatarp->mAttachmentPoints.end();)
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -2107,8 +2107,8 @@ void LLAgentWearables::userRemoveAllAttachments()
 
 	llvo_vec_t objects_to_remove;
 	
-	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-		 iter != gAgentAvatar->mAttachmentPoints.end();)
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatarp->mAttachmentPoints.end();)
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -2676,8 +2676,8 @@ void LLInitialWearablesFetch::processWearablesMessage()
 		// Add all current attachments to the requested items as well.
 		if (isAgentAvatarValid())
 		{
-			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-				 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
+			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
 			{
 				LLViewerJointAttachment* attachment = iter->second;
 				if (!attachment) continue;
diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp
index 75d1c437c3..ebd767d654 100644
--- a/indra/newview/lldriverparam.cpp
+++ b/indra/newview/lldriverparam.cpp
@@ -123,7 +123,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 		for (entry_info_list_t::iterator iter = mDrivenInfoList.begin(); iter != mDrivenInfoList.end(); iter++)
 		{
 			LLDrivenEntryInfo driven = *iter;
-			LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatar->getVisualParam(driven.mDrivenID);
+			LLViewerVisualParam *param = (LLViewerVisualParam*)gAgentAvatarp->getVisualParam(driven.mDrivenID);
 			if (param)
 			{
 				param->getInfo()->toStream(out);
@@ -145,7 +145,7 @@ void LLDriverParamInfo::toStream(std::ostream &out)
 			}
 			else
 			{
-				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatar << " for driver parameter " << getID() << llendl;
+				llwarns << "could not get parameter " << driven.mDrivenID << " from avatar " << gAgentAvatarp << " for driver parameter " << getID() << llendl;
 			}
 			out << std::endl;
 		}
@@ -631,7 +631,7 @@ void LLDriverParam::setDrivenWeight(LLDrivenEntry *driven, F32 driven_weight, bo
 	   mWearablep->isOnTop())
 	{
 		// call setWeight through LLVOAvatarSelf so other wearables can be updated with the correct values
-		gAgentAvatar->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
+		gAgentAvatarp->setVisualParamWeight( (LLVisualParam*)driven->mParam, driven_weight, upload_bake );
 	}
 	else
 	{
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index c9a950ed42..1f8c42ad90 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -757,8 +757,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 	{
 		// look in signaled animations (simulator's view of what is
 		// currently playing.
-		LLVOAvatar::AnimIterator play_it = gAgentAvatar->mSignaledAnimations.find(*gest_it);
-		if (play_it != gAgentAvatar->mSignaledAnimations.end())
+		LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
+		if (play_it != gAgentAvatarp->mSignaledAnimations.end())
 		{
 			++gest_it;
 		}
@@ -776,8 +776,8 @@ void LLGestureManager::stepGesture(LLMultiGesture* gesture)
 		 gest_it != gesture->mRequestedAnimIDs.end();
 		 )
 	{
-	 LLVOAvatar::AnimIterator play_it = gAgentAvatar->mSignaledAnimations.find(*gest_it);
-		if (play_it != gAgentAvatar->mSignaledAnimations.end())
+	 LLVOAvatar::AnimIterator play_it = gAgentAvatarp->mSignaledAnimations.find(*gest_it);
+		if (play_it != gAgentAvatarp->mSignaledAnimations.end())
 		{
 			// Hooray, this animation has started playing!
 			// Copy into playing.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a62640c813..bcd53023ca 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4149,7 +4149,7 @@ std::string LLObjectBridge::getLabelSuffix() const
 {
 	if (get_is_item_worn(mUUID))
 	{
-		std::string attachment_point_name = gAgentAvatar->getAttachedPointName(mUUID);
+		std::string attachment_point_name = gAgentAvatarp->getAttachedPointName(mUUID);
 
 		// e.g. "(worn on ...)" / "(attached to ...)"
 		LLStringUtil::format_map_t args;
@@ -4170,8 +4170,8 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 	S32 attach_pt = 0;
 	if (isAgentAvatarValid() && attachment)
 	{
-		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin();
-			 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+			 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
 		{
 			if (iter->second == attachment)
 			{
@@ -4197,7 +4197,7 @@ void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attach
 
 bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response)
 {
-	if (!gAgentAvatar->canAttachMoreObjects())
+	if (!gAgentAvatarp->canAttachMoreObjects())
 	{
 		LLSD args;
 		args["MAX_ATTACHMENTS"] = llformat("%d", MAX_AGENT_ATTACHMENTS);
@@ -4275,7 +4275,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				// commented out for DEV-32347
 				//items.push_back(std::string("Restore to Last Position"));
 
-				if (!gAgentAvatar->canAttachMoreObjects())
+				if (!gAgentAvatarp->canAttachMoreObjects())
 				{
 					disabled_items.push_back(std::string("Object Wear"));
 					disabled_items.push_back(std::string("Attach To"));
@@ -4289,8 +4289,8 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 					&& (attach_hud_menu->getChildCount() == 0)
 					&& isAgentAvatarValid())
 				{
-					for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin();
-						 iter != gAgentAvatar->mAttachmentPoints.end(); )
+					for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+						 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 					{
 						LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 						LLViewerJointAttachment* attachment = curiter->second;
@@ -4342,7 +4342,7 @@ BOOL LLObjectBridge::renameItem(const std::string& new_name)
 
 		if (isAgentAvatarValid())
 		{
-			LLViewerObject* obj = gAgentAvatar->getWornAttachment( item->getUUID() );
+			LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
 			if(obj)
 			{
 				LLSelectMgr::getInstance()->deselectAll();
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f1b7806635..1750dd79ac 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -352,7 +352,7 @@ BOOL get_is_item_worn(const LLUUID& id)
 	{
 		case LLAssetType::AT_OBJECT:
 		{
-			if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getLinkedUUID()))
+			if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
 				return TRUE;
 			break;
 		}
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 7c8fb4f9b9..f88747c382 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3782,7 +3782,7 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 		break;
 		
 	case LLAssetType::AT_OBJECT:
-		if (isAgentAvatarValid() && !gAgentAvatar->isWearingAttachment(item->getUUID()))
+		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
 		{
 			allowed = true;
 		}
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 3520c7e0c0..e2ace7db01 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -872,8 +872,8 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata)
 
 	std::string joint_name = userdata.asString();
 	LLViewerJointAttachment* attachmentp = NULL;
-	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-		 iter != gAgentAvatar->mAttachmentPoints.end(); )
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 8d77ade253..5f0c5e1795 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -714,7 +714,7 @@ BOOL LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
 				// in position changes even when the mouse moves
 				object->setPosition(new_position_local);
 				rebuild(object);
-				gAgentAvatar->clampAttachmentPositions();
+				gAgentAvatarp->clampAttachmentPositions();
 				new_position_local = object->getPosition();
 
 				if (selectNode->mIndividualSelection)
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index 6334d54e33..d670eb6ffd 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -89,14 +89,14 @@ void	LLMorphView::initialize()
 	mCameraYaw = 0.f;
 	mCameraDist = -1.f;
 
-	if (!isAgentAvatarValid() || gAgentAvatar->isDead())
+	if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
 	{
 		gAgentCamera.changeCameraToDefault();
 		return;
 	}
 
-	gAgentAvatar->stopMotion( ANIM_AGENT_BODY_NOISE );
-	gAgentAvatar->mSpecialRenderMode = 3;
+	gAgentAvatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
+	gAgentAvatarp->mSpecialRenderMode = 3;
 	
 	// set up camera for close look at avatar
 	mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
@@ -112,8 +112,8 @@ void	LLMorphView::shutdown()
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->startMotion( ANIM_AGENT_BODY_NOISE );
-		gAgentAvatar->mSpecialRenderMode = 0;
+		gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
+		gAgentAvatarp->mSpecialRenderMode = 0;
 		// reset camera
 		LLViewerCamera::getInstance()->setNear(mOldCameraNearClip);
 	}
@@ -162,11 +162,11 @@ void LLMorphView::updateCamera()
 {
 	if (!mCameraTargetJoint)
 	{
-		setCameraTargetJoint(gAgentAvatar->getJoint("mHead"));
+		setCameraTargetJoint(gAgentAvatarp->getJoint("mHead"));
 	}	
 	if (!isAgentAvatarValid()) return;
 
-	LLJoint* root_joint = gAgentAvatar->getRootJoint();
+	LLJoint* root_joint = gAgentAvatarp->getRootJoint();
 	if( !root_joint )
 	{
 		return;
diff --git a/indra/newview/llmoveview.cpp b/indra/newview/llmoveview.cpp
index b47acefc76..0f22a50093 100644
--- a/indra/newview/llmoveview.cpp
+++ b/indra/newview/llmoveview.cpp
@@ -42,7 +42,7 @@
 
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llvoavatarself.h" // to check gAgentAvatar->isSitting()
+#include "llvoavatarself.h" // to check gAgentAvatarp->isSitting()
 #include "llbottomtray.h"
 #include "llbutton.h"
 #include "llfloaterreg.h"
@@ -332,7 +332,7 @@ void LLFloaterMove::setMovementMode(const EMovementMode mode)
 	updateButtonsWithMovementMode(mode);
 
 	bool bHideModeButtons = MM_FLY == mode
-		|| (isAgentAvatarValid() && gAgentAvatar->isSitting());
+		|| (isAgentAvatarValid() && gAgentAvatarp->isSitting());
 
 	showModeButtons(!bHideModeButtons);
 
@@ -390,7 +390,7 @@ void LLFloaterMove::initMovementMode()
 
 	if (isAgentAvatarValid())
 	{
-		setEnabled(!gAgentAvatar->isSitting());
+		setEnabled(!gAgentAvatarp->isSitting());
 	}
 }
 
@@ -491,7 +491,7 @@ void LLFloaterMove::onOpen(const LLSD& key)
 		showModeButtons(FALSE);
 	}
 
-	if (isAgentAvatarValid() && gAgentAvatar->isSitting())
+	if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
 	{
 		setSittingMode(TRUE);
 		showModeButtons(FALSE);
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 89fd4715fc..805016f089 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -602,7 +602,7 @@ LLPanel* LLPanelEditWearable::getPanel(EWearableType type)
 void LLPanelEditWearable::getSortedParams(value_map_t &sorted_params, const std::string &edit_group)
 {
 	LLWearable::visual_param_vec_t param_list;
-	ESex avatar_sex = gAgentAvatar->getSex();
+	ESex avatar_sex = gAgentAvatarp->getSex();
 
 	mWearablePtr->getVisualParams(param_list);
 
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index 87c7bdbfab..d5ec3a36c3 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -181,7 +181,7 @@ void LLPreview::onCommit()
 			{
 				if (isAgentAvatarValid())
 				{
-					LLViewerObject* obj = gAgentAvatar->getWornAttachment( item->getUUID() );
+					LLViewerObject* obj = gAgentAvatarp->getWornAttachment( item->getUUID() );
 					if( obj )
 					{
 						LLSelectMgr::getInstance()->deselectAll();
diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp
index 9210f5b8b7..262961b73b 100644
--- a/indra/newview/llpreviewanim.cpp
+++ b/indra/newview/llpreviewanim.cpp
@@ -71,7 +71,7 @@ BOOL LLPreviewAnim::postBuild()
 	const LLInventoryItem* item = getItem();
 	if(item)
 	{
-		gAgentAvatar->createMotion(item->getAssetUUID()); // preload the animation
+		gAgentAvatarp->createMotion(item->getAssetUUID()); // preload the animation
 		childSetText("desc", item->getDescription());
 	}
 
@@ -125,7 +125,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		{
 			self->mPauseRequest = NULL;
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_START);
-			LLMotion* motion = gAgentAvatar->findMotion(itemID);
+			LLMotion* motion = gAgentAvatarp->findMotion(itemID);
 			if (motion)
 			{
 				motion->setDeactivateCallback(&endAnimCallback, (void *)(new LLHandle<LLFloater>(self->getHandle())));
@@ -133,7 +133,7 @@ void LLPreviewAnim::playAnim( void *userdata )
 		}
 		else
 		{
-			gAgentAvatar->stopMotion(itemID);
+			gAgentAvatarp->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
@@ -158,8 +158,8 @@ void LLPreviewAnim::auditionAnim( void *userdata )
 		if (self->childGetValue("Anim audition btn").asBoolean() ) 
 		{
 			self->mPauseRequest = NULL;
-			gAgentAvatar->startMotion(item->getAssetUUID());
-			LLMotion* motion = gAgentAvatar->findMotion(itemID);
+			gAgentAvatarp->startMotion(item->getAssetUUID());
+			LLMotion* motion = gAgentAvatarp->findMotion(itemID);
 			
 			if (motion)
 			{
@@ -168,7 +168,7 @@ void LLPreviewAnim::auditionAnim( void *userdata )
 		}
 		else
 		{
-			gAgentAvatar->stopMotion(itemID);
+			gAgentAvatarp->stopMotion(itemID);
 			gAgent.sendAnimationRequest(itemID, ANIM_REQUEST_STOP);
 		}
 	}
@@ -181,9 +181,9 @@ void LLPreviewAnim::onClose(bool app_quitting)
 
 	if(item)
 	{
-		gAgentAvatar->stopMotion(item->getAssetUUID());
+		gAgentAvatarp->stopMotion(item->getAssetUUID());
 		gAgent.sendAnimationRequest(item->getAssetUUID(), ANIM_REQUEST_STOP);
-		LLMotion* motion = gAgentAvatar->findMotion(item->getAssetUUID());
+		LLMotion* motion = gAgentAvatarp->findMotion(item->getAssetUUID());
 		
 		if (motion)
 		{
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index b47b384308..7980fe1945 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -209,7 +209,7 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata)
 	if (current_weight != new_weight )
 	{
 		self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE );
-		gAgentAvatar->updateVisualParams();
+		gAgentAvatarp->updateVisualParams();
 	}
 }
 
@@ -298,7 +298,7 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
 				&& new_percent < slider->getMaxValue())
 			{
 				mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE);
-				gAgentAvatar->updateVisualParams();
+				gAgentAvatarp->updateVisualParams();
 
 				slider->setValue( weightToPercent( new_weight ) );
 			}
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 26d1ec1d6c..6969ae5e1e 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -1475,7 +1475,7 @@ void LLSelectMgr::selectionSetImage(const LLUUID& imageid)
 				object->sendTEUpdate();
 				// 1 particle effect per object				
 				LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-				effectp->setSourceObject(gAgentAvatar);
+				effectp->setSourceObject(gAgentAvatarp);
 				effectp->setTargetObject(object);
 				effectp->setDuration(LL_HUD_DUR_SHORT);
 				effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -3630,7 +3630,7 @@ void LLSelectMgr::sendAttach(U8 attachment_point)
 	BOOL build_mode = LLToolMgr::getInstance()->inEdit();
 	// Special case: Attach to default location for this object.
 	if (0 == attachment_point ||
-		get_if_there(gAgentAvatar->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
+		get_if_there(gAgentAvatarp->mAttachmentPoints, (S32)attachment_point, (LLViewerJointAttachment*)NULL))
 	{
 		sendListToRegions(
 			"ObjectAttach",
@@ -4913,7 +4913,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud)
 
 	if (isAgentAvatarValid() && for_hud)
 	{
-		LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
+		LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
 
 		F32 cur_zoom = gAgentCamera.mHUDCurZoom;
 
@@ -5610,7 +5610,7 @@ void LLSelectMgr::updateSelectionCenter()
 
 		if (mSelectedObjects->mSelectType == SELECT_TYPE_ATTACHMENT && isAgentAvatarValid())
 		{
-			mPauseRequest = gAgentAvatar->requestPause();
+			mPauseRequest = gAgentAvatarp->requestPause();
 		}
 		else
 		{
@@ -5643,7 +5643,7 @@ void LLSelectMgr::updateSelectionCenter()
 			
 			LLViewerObject *root = object->getRootEdit();
 			if (mSelectedObjects->mSelectType == SELECT_TYPE_WORLD && // not an attachment
-				!root->isChild(gAgentAvatar) && // not the object you're sitting on
+				!root->isChild(gAgentAvatarp) && // not the object you're sitting on
 				!object->isAvatar()) // not another avatar
 			{
 				mShowSelection = TRUE;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index e65da0022e..587565bafd 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -368,8 +368,8 @@ void LLSidepanelAppearance::fetchInventory()
 
 	if (isAgentAvatarValid())
 	{
-		for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-			 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
+		for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
 		{
 			LLViewerJointAttachment* attachment = iter->second;
 			if (!attachment) continue;
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 7ed095c68e..87ced0352b 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1926,7 +1926,7 @@ bool idle_startup()
 		{
 			// wait for avatar to be completely loaded
 			if (isAgentAvatarValid()
-				&& gAgentAvatar->isFullyLoaded())
+				&& gAgentAvatarp->isFullyLoaded())
 			{
 				//llinfos << "avatar fully loaded" << llendl;
 				LLStartUp::setStartupState( STATE_CLEANUP );
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index add1cea8cc..58f64ff1f3 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -447,7 +447,7 @@ void LLStatusBar::setHealth(S32 health)
 		{
 			if (isAgentAvatarValid())
 			{
-				if (gAgentAvatar->getSex() == SEX_FEMALE)
+				if (gAgentAvatarp->getSex() == SEX_FEMALE)
 				{
 					make_ui_sound("UISndHealthReductionF");
 				}
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 6461ec8221..3f4dab4fea 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -350,7 +350,7 @@ void LLTexLayerSetBuffer::readBackAndUpload()
 			{
 				// baked_upload_data is owned by the responder and deleted after the request completes
 				LLBakedUploadData* baked_upload_data =
-					new LLBakedUploadData(gAgentAvatar, this->mTexLayerSet, asset_id);
+					new LLBakedUploadData(gAgentAvatarp, this->mTexLayerSet, asset_id);
 				mUploadID = asset_id;
 				
 				// upload the image
@@ -409,8 +409,8 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 
 	if (0 == result &&
 		isAgentAvatarValid() &&
-		!gAgentAvatar->isDead() &&
-		baked_upload_data->mAvatar == gAgentAvatar && // Sanity check: only the user's avatar should be uploading textures.
+		!gAgentAvatarp->isDead() &&
+		baked_upload_data->mAvatar == gAgentAvatarp && // Sanity check: only the user's avatar should be uploading textures.
 		baked_upload_data->mTexLayerSet->hasComposite()
 		)
 	{
@@ -435,11 +435,11 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 
 			if (result >= 0)
 			{
-				LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatar->getBakedTE(layerset_buffer->mTexLayerSet);
+				LLVOAvatarDefines::ETextureIndex baked_te = gAgentAvatarp->getBakedTE(layerset_buffer->mTexLayerSet);
 				// Update baked texture info with the new UUID
 				U64 now = LLFrameTimer::getTotalTime();		// Record starting time
 				llinfos << "Baked texture upload took " << (S32)((now - baked_upload_data->mStartTime) / 1000) << " ms" << llendl;
-				gAgentAvatar->setNewBakedTexture(baked_te, uuid);
+				gAgentAvatarp->setNewBakedTexture(baked_te, uuid);
 			}
 			else
 			{	
@@ -453,7 +453,7 @@ void LLTexLayerSetBuffer::onTextureUploadComplete(const LLUUID& uuid,
 			llinfos << "Received baked texture out of date, ignored." << llendl;
 		}
 
-		gAgentAvatar->dirtyMesh();
+		gAgentAvatarp->dirtyMesh();
 	}
 	else
 	{
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index f9d0c7c307..c3aba4e591 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -1174,7 +1174,7 @@ void LLToolDragAndDrop::dropScript(LLViewerObject* hit_obj,
 
 		// VEFFECT: SetScript
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgentAvatar);
+		effectp->setSourceObject(gAgentAvatarp);
 		effectp->setTargetObject(hit_obj);
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1335,7 +1335,7 @@ void LLToolDragAndDrop::dropObject(LLViewerObject* raycast_target,
 
 	// VEFFECT: DropObject
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgentAvatar);
+	effectp->setSourceObject(gAgentAvatarp);
 	effectp->setPositionGlobal(mLastHitPos);
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1398,7 +1398,7 @@ void LLToolDragAndDrop::dropInventory(LLViewerObject* hit_obj,
 
 	// VEFFECT: AddToInventory
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgentAvatar);
+	effectp->setSourceObject(gAgentAvatarp);
 	effectp->setTargetObject(hit_obj);
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1496,7 +1496,7 @@ void LLToolDragAndDrop::commitGiveInventoryItem(const LLUUID& to_agent,
 
 	// VEFFECT: giveInventory
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject(gAgentAvatar);
+	effectp->setSourceObject(gAgentAvatarp);
 	effectp->setTargetObject(gObjectList.findObject(to_agent));
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1735,7 +1735,7 @@ void LLToolDragAndDrop::commitGiveInventoryCategory(const LLUUID& to_agent,
 
 		// VEFFECT: giveInventoryCategory
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgentAvatar);
+		effectp->setSourceObject(gAgentAvatarp);
 		effectp->setTargetObject(gObjectList.findObject(to_agent));
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -1767,7 +1767,7 @@ BOOL LLToolDragAndDrop::isInventoryGiveAcceptable(LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (gAgentAvatar->isWearingAttachment(item->getUUID()))
+		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1810,7 +1810,7 @@ BOOL LLToolDragAndDrop::isInventoryGroupGiveAcceptable(LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (gAgentAvatar->isWearingAttachment(item->getUUID()))
+		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
 		{
 			acceptable = FALSE;
 		}
@@ -1848,7 +1848,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getUUID()))
+		if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID()))
 		{
 				worn = TRUE;
 		}
@@ -1999,7 +1999,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezAttachmentFromInv(
 	}
 
 	// must not be already wearing it
-	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2040,7 +2040,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnLand(
 	locateInventory(item, cat);
 	if (!item || !item->isComplete()) return ACCEPT_NO;
 
-	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2101,7 +2101,7 @@ EAcceptance LLToolDragAndDrop::dad3dRezObjectOnObject(
 	LLViewerInventoryCategory* cat;
 	locateInventory(item, cat);
 	if (!item || !item->isComplete()) return ACCEPT_NO;
-	if (!isAgentAvatarValid() || gAgentAvatar->isWearingAttachment(item->getUUID()))
+	if (!isAgentAvatarValid() || gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
 		return ACCEPT_NO;
 	}
@@ -2250,7 +2250,7 @@ EAcceptance LLToolDragAndDrop::dad3dTextureObject(
 		
 		// VEFFECT: SetTexture
 		LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-		effectp->setSourceObject(gAgentAvatar);
+		effectp->setSourceObject(gAgentAvatarp);
 		effectp->setTargetObject(obj);
 		effectp->setDuration(LL_HUD_DUR_SHORT);
 		effectp->setColor(LLColor4U(gAgent.getEffectColor()));
@@ -2610,7 +2610,7 @@ EAcceptance LLToolDragAndDrop::dad3dGiveInventoryObject(
 		// cannot give away no-transfer objects
 		return ACCEPT_NO;
 	}
-	if (isAgentAvatarValid() && gAgentAvatar->isWearingAttachment(item->getUUID()))
+	if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getUUID()))
 	{
 		// You can't give objects that are attached to you
 		return ACCEPT_NO;
diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp
index b362d564df..032714cabf 100644
--- a/indra/newview/lltoolfocus.cpp
+++ b/indra/newview/lltoolfocus.cpp
@@ -173,7 +173,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 		BOOL good_customize_avatar_hit = FALSE;
 		if( hit_obj )
 		{
-			if (isAgentAvatarValid() && (hit_obj == gAgentAvatar))
+			if (isAgentAvatarValid() && (hit_obj == gAgentAvatarp))
 			{
 				// It's you
 				good_customize_avatar_hit = TRUE;
@@ -221,7 +221,7 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)
 			gAgentCamera.cameraThirdPerson() &&
 			gViewerWindow->getLeftMouseDown() && 
 			!gSavedSettings.getBOOL("FreezeTime") &&
-			(hit_obj == gAgentAvatar || 
+			(hit_obj == gAgentAvatarp || 
 			 (hit_obj && hit_obj->isAttachment() && LLVOAvatar::findAvatarFromAttachment(hit_obj)->isSelf())))
 		{
 			LLToolCamera::getInstance()->mMouseSteering = TRUE;
diff --git a/indra/newview/lltoolgrab.cpp b/indra/newview/lltoolgrab.cpp
index 982d55914d..04d873f91b 100644
--- a/indra/newview/lltoolgrab.cpp
+++ b/indra/newview/lltoolgrab.cpp
@@ -708,7 +708,7 @@ void LLToolGrab::handleHoverActive(S32 x, S32 y, MASK mask)
 	{
 		if (!gAgentCamera.cameraMouselook() && 
 			!objectp->isHUDAttachment() && 
-			objectp->getRoot() == gAgentAvatar->getRoot())
+			objectp->getRoot() == gAgentAvatarp->getRoot())
 		{
 			// force focus to point in space where we were looking previously
 			gAgentCamera.setFocusGlobal(gAgentCamera.calcFocusPositionTargetGlobal(), LLUUID::null);
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 67d696d7d7..969049ee65 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -139,20 +139,20 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis
 
 BOOL LLVisualParamHint::needsRender()
 {
-	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatar->mAppearanceAnimating && mAllowsUpdates;
+	return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgentAvatarp->mAppearanceAnimating && mAllowsUpdates;
 }
 
 void LLVisualParamHint::preRender(BOOL clear_depth)
 {
 	mLastParamWeight = mVisualParam->getWeight();
 	mVisualParam->setWeight(mVisualParamWeight, FALSE);
-	gAgentAvatar->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
-	gAgentAvatar->setVisualParamWeight("Blink_Left", 0.f);
-	gAgentAvatar->setVisualParamWeight("Blink_Right", 0.f);
-	gAgentAvatar->updateComposites();
-	gAgentAvatar->updateVisualParams();
-	gAgentAvatar->updateGeometry(gAgentAvatar->mDrawable);
-	gAgentAvatar->updateLOD();
+	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
+	gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
+	gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
+	gAgentAvatarp->updateComposites();
+	gAgentAvatarp->updateVisualParams();
+	gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
+	gAgentAvatarp->updateLOD();
 
 	LLViewerDynamicTexture::preRender(clear_depth);
 }
@@ -193,7 +193,7 @@ BOOL LLVisualParamHint::render()
 	const std::string& cam_target_mesh_name = mVisualParam->getCameraTargetName();
 	if( !cam_target_mesh_name.empty() )
 	{
-		cam_target_joint = (LLViewerJointMesh*)gAgentAvatar->getJoint( cam_target_mesh_name );
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint( cam_target_mesh_name );
 	}
 	if( !cam_target_joint )
 	{
@@ -201,11 +201,11 @@ BOOL LLVisualParamHint::render()
 	}
 	if( !cam_target_joint )
 	{
-		cam_target_joint = (LLViewerJointMesh*)gAgentAvatar->getJoint("mHead");
+		cam_target_joint = (LLViewerJointMesh*)gAgentAvatarp->getJoint("mHead");
 	}
 
 	LLQuaternion avatar_rotation;
-	LLJoint* root_joint = gAgentAvatar->getRootJoint();
+	LLJoint* root_joint = gAgentAvatarp->getRootJoint();
 	if( root_joint )
 	{
 		avatar_rotation = root_joint->getWorldRotation();
@@ -233,17 +233,17 @@ BOOL LLVisualParamHint::render()
 
 	LLViewerCamera::getInstance()->setPerspective(FALSE, mOrigin.mX, mOrigin.mY, mFullWidth, mFullHeight, FALSE);
 
-	if (gAgentAvatar->mDrawable.notNull())
+	if (gAgentAvatarp->mDrawable.notNull())
 	{
-		LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatar->mDrawable->getFace(0)->getPool();
+		LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)gAgentAvatarp->mDrawable->getFace(0)->getPool();
 		LLGLDepthTest gls_depth(GL_TRUE, GL_TRUE);
 		gGL.setAlphaRejectSettings(LLRender::CF_ALWAYS);
 		gGL.setSceneBlendType(LLRender::BT_REPLACE);
-		avatarPoolp->renderAvatars(gAgentAvatar);  // renders only one avatar
+		avatarPoolp->renderAvatars(gAgentAvatarp);  // renders only one avatar
 		gGL.setSceneBlendType(LLRender::BT_ALPHA);
 		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 	}
-	gAgentAvatar->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
+	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
 	mVisualParam->setWeight(mLastParamWeight, FALSE);
 	gGL.color4f(1,1,1,1);
 	mGLTexturep->setGLTextureCreated(true);
@@ -294,9 +294,9 @@ BOOL LLVisualParamReset::render()
 {
 	if (sDirty)
 	{
-		gAgentAvatar->updateComposites();
-		gAgentAvatar->updateVisualParams();
-		gAgentAvatar->updateGeometry(gAgentAvatar->mDrawable);
+		gAgentAvatarp->updateComposites();
+		gAgentAvatarp->updateVisualParams();
+		gAgentAvatarp->updateGeometry(gAgentAvatarp->mDrawable);
 		sDirty = FALSE;
 	}
 
diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp
index 580b483b6b..322da2e343 100644
--- a/indra/newview/lltoolpie.cpp
+++ b/indra/newview/lltoolpie.cpp
@@ -206,7 +206,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 			break;
 		case CLICK_ACTION_SIT:
 			{
-				if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // agent not already sitting
+				if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // agent not already sitting
 				{
 					handle_object_sit_or_stand();
 					// put focus in world when sitting on an object
@@ -330,7 +330,7 @@ BOOL LLToolPie::pickLeftMouseDownCallback()
 			}
 			object = (LLViewerObject*)object->getParent();
 		}
-		if (object && object == gAgentAvatar)
+		if (object && object == gAgentAvatarp)
 		{
 			// we left clicked on avatar, switch to focus mode
 			LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
@@ -412,7 +412,7 @@ ECursorType cursor_from_object(LLViewerObject* object)
 	{
 	case CLICK_ACTION_SIT:
 		{
-			if (isAgentAvatarValid() && !gAgentAvatar->isSitting()) // not already sitting?
+			if (isAgentAvatarValid() && !gAgentAvatarp->isSitting()) // not already sitting?
 			{
 				cursor = UI_CURSOR_TOOLSIT;
 			}
diff --git a/indra/newview/lltoolplacer.cpp b/indra/newview/lltoolplacer.cpp
index 847852f8af..91f01f0b36 100644
--- a/indra/newview/lltoolplacer.cpp
+++ b/indra/newview/lltoolplacer.cpp
@@ -434,7 +434,7 @@ BOOL LLToolPlacer::addObject( LLPCode pcode, S32 x, S32 y, U8 use_physics )
 
 	// VEFFECT: AddObject
 	LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM, TRUE);
-	effectp->setSourceObject((LLViewerObject*)gAgentAvatar);
+	effectp->setSourceObject((LLViewerObject*)gAgentAvatarp);
 	effectp->setPositionGlobal(regionp->getPosGlobalFromRegion(ray_end_region));
 	effectp->setDuration(LL_HUD_DUR_SHORT);
 	effectp->setColor(LLColor4U(gAgent.getEffectColor()));
diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp
index a45bb2a4de..2065ba1791 100644
--- a/indra/newview/lltoolselect.cpp
+++ b/indra/newview/lltoolselect.cpp
@@ -169,8 +169,8 @@ LLObjectSelectionHandle LLToolSelect::handleObjectSelection(const LLPickInfo& pi
 		}
 
 		if (!gAgentCamera.getFocusOnAvatar() &&										// if camera not glued to avatar
-			LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatar &&	// and it's not one of your attachments
-			object != gAgentAvatar)									// and it's not you
+			LLVOAvatar::findAvatarFromAttachment(object) != gAgentAvatarp &&	// and it's not one of your attachments
+			object != gAgentAvatarp)									// and it's not you
 		{
 			// have avatar turn to face the selected object(s)
 			LLVector3d selection_center = LLSelectMgr::getInstance()->getSelectionCenterGlobal();
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index f0f911b996..823466e33e 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -347,7 +347,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		S32 attach_count = 0;
 		if (isAgentAvatarValid())
 		{
-			attach_count = gAgentAvatar->getAttachmentCount();
+			attach_count = gAgentAvatarp->getAttachmentCount();
 		}
 		F32 teleport_save_time = TELEPORT_EXPIRY + TELEPORT_EXPIRY_PER_ATTACHMENT * attach_count;
 		F32 teleport_elapsed = gTeleportDisplayTimer.getElapsedTimeF32();
@@ -1032,10 +1032,10 @@ LLRect get_whole_screen_region()
 
 bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model)
 {
-	if (isAgentAvatarValid() && gAgentAvatar->hasHUDAttachment())
+	if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment())
 	{
 		F32 zoom_level = gAgentCamera.mHUDCurZoom;
-		LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
+		LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
 		
 		F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f);
 		proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth);
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index d899c72e0e..dd7390a907 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -877,7 +877,7 @@ EKeyboardMode LLViewerKeyboard::getMode()
 	{
 		return MODE_EDIT_AVATAR;
 	}
-	else if (isAgentAvatarValid() && gAgentAvatar->isSitting())
+	else if (isAgentAvatarValid() && gAgentAvatarp->isSitting())
 	{
 		return MODE_SITTING;
 	}
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 49a3ed14dc..9bf2a5fad2 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -3025,7 +3025,7 @@ bool LLViewerMediaImpl::isObjectAttachedToAnotherAvatar(LLVOVolume *obj)
 		if (NULL != object)
 		{
 			LLVOAvatar *avatar = object->asAvatar();
-			if ((NULL != avatar) && (avatar != gAgentAvatar))
+			if ((NULL != avatar) && (avatar != gAgentAvatarp))
 			{
 				result = true;
 				break;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index f838d1436d..8d3bf4deab 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -2694,8 +2694,8 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t
 		bool new_value = false;
 		if (isAgentAvatarValid())
 		{
-			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-				 iter != gAgentAvatar->mAttachmentPoints.end(); )
+			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 			{
 				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 				LLViewerJointAttachment* attachment = curiter->second;
@@ -2825,7 +2825,7 @@ bool handle_go_to()
 
 	if (isAgentAvatarValid() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
 	{
-		gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatar->getID());
+		gAgentCamera.setFocusGlobal(gAgentCamera.getFocusTargetGlobal(), gAgentAvatarp->getID());
 	}
 	else 
 	{
@@ -3364,7 +3364,7 @@ class LLSelfStandUp : public view_listener_t
 
 bool enable_standup_self()
 {
-	bool new_value = isAgentAvatarValid() && gAgentAvatar->isSitting();
+	bool new_value = isAgentAvatarValid() && gAgentAvatarp->isSitting();
 	return new_value;
 }
 
@@ -3695,7 +3695,7 @@ class LLLandSit : public view_listener_t
 		LLQuaternion target_rot;
 		if (isAgentAvatarValid())
 		{
-			target_rot = gAgentAvatar->getRotation();
+			target_rot = gAgentAvatarp->getRotation();
 		}
 		else
 		{
@@ -4588,7 +4588,7 @@ BOOL sitting_on_selection()
 	// Need to determine if avatar is sitting on this object
 	if (!isAgentAvatarValid()) return FALSE;
 
-	return (gAgentAvatar->isSitting() && gAgentAvatar->getRoot() == root_object);
+	return (gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == root_object);
 }
 
 class LLToolsSaveToInventory : public view_listener_t
@@ -5841,7 +5841,7 @@ private:
 			S32 index = userdata.asInteger();
 			LLViewerJointAttachment* attachment_point = NULL;
 			if (index > 0)
-				attachment_point = get_if_there(gAgentAvatar->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
+				attachment_point = get_if_there(gAgentAvatarp->mAttachmentPoints, index, (LLViewerJointAttachment*)NULL);
 			confirm_replace_attachment(0, attachment_point);
 		}
 		return true;
@@ -5862,8 +5862,8 @@ void near_attach_object(BOOL success, void *user_data)
 		U8 attachment_id = 0;
 		if (attachment)
 		{
-			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatar->mAttachmentPoints.begin();
-				 iter != gAgentAvatar->mAttachmentPoints.end(); ++iter)
+			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin();
+				 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
 			{
 				if (iter->second == attachment)
 				{
@@ -5988,7 +5988,7 @@ class LLAttachmentDetachFromPoint : public view_listener_t
 {
 	bool handleEvent(const LLSD& user_data)
 	{
-		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatar->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
+		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, user_data.asInteger(), (LLViewerJointAttachment*)NULL);
 		if (attachment->getNumObjects() > 0)
 		{
 			gMessageSystem->newMessage("ObjectDetach");
@@ -6016,7 +6016,7 @@ static bool onEnableAttachmentLabel(LLUICtrl* ctrl, const LLSD& data)
 	LLMenuItemGL* menu = dynamic_cast<LLMenuItemGL*>(ctrl);
 	if (menu)
 	{
-		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatar->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
+		const LLViewerJointAttachment *attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, data["index"].asInteger(), (LLViewerJointAttachment*)NULL);
 		if (attachment)
 		{
 			label = data["label"].asString();
@@ -6134,7 +6134,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 		if (object && LLSelectMgr::getInstance()->getSelection()->contains(object,SELECT_ALL_TES ))
 		{
     		S32 attachmentID  = ATTACHMENT_ID_FROM_STATE(object->getState());
-			attachment = get_if_there(gAgentAvatar->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
+			attachment = get_if_there(gAgentAvatarp->mAttachmentPoints, attachmentID, (LLViewerJointAttachment*)NULL);
 
 			if (attachment)
 			{
@@ -6266,8 +6266,8 @@ class LLAttachmentPointFilled : public view_listener_t
 	bool handleEvent(const LLSD& user_data)
 	{
 		bool enable = false;
-		LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatar->mAttachmentPoints.find(user_data.asInteger());
-		if (found_it != gAgentAvatar->mAttachmentPoints.end())
+		LLVOAvatar::attachment_map_t::iterator found_it = gAgentAvatarp->mAttachmentPoints.find(user_data.asInteger());
+		if (found_it != gAgentAvatarp->mAttachmentPoints.end())
 		{
 			enable = found_it->second->getNumObjects() > 0;
 		}
@@ -6486,8 +6486,8 @@ void handle_dump_attachments(void*)
 {
 	if(!isAgentAvatarValid()) return;
 
-	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-		 iter != gAgentAvatar->mAttachmentPoints.end(); )
+	for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+		 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 	{
 		LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 		LLViewerJointAttachment* attachment = curiter->second;
@@ -6907,7 +6907,7 @@ void reload_vertex_shader(void *)
 
 void handle_dump_avatar_local_textures(void*)
 {
-	gAgentAvatar->dumpLocalTextures();
+	gAgentAvatarp->dumpLocalTextures();
 }
 
 void handle_dump_timers()
@@ -6930,7 +6930,7 @@ void handle_grab_texture(void* data)
 	if (!isAgentAvatarValid()) return;
 
 	// MULTI-WEARABLE: change to support an index
-	const LLUUID& asset_id = gAgentAvatar->grabLocalTexture(tex_index, 0);
+	const LLUUID& asset_id = gAgentAvatarp->grabLocalTexture(tex_index, 0);
 	LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << llendl;
 	LLAssetType::EType asset_type = LLAssetType::AT_TEXTURE;
 	LLInventoryType::EType inv_type = LLInventoryType::IT_TEXTURE;
@@ -7003,7 +7003,7 @@ BOOL enable_grab_texture(void* data)
 	if (isAgentAvatarValid())
 	{
 		// MULTI-WEARABLE:
-		return gAgentAvatar->canGrabLocalTexture(index,0);
+		return gAgentAvatarp->canGrabLocalTexture(index,0);
 	}
 	return FALSE;
 }
@@ -7218,7 +7218,7 @@ void handle_rebake_textures(void*)
 
 	// Slam pending upload count to "unstick" things
 	bool slam_for_debug = true;
-	gAgentAvatar->forceBakeAllTextures(slam_for_debug);
+	gAgentAvatarp->forceBakeAllTextures(slam_for_debug);
 }
 
 void toggle_visibility(void* user_data)
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 96bb687bbb..85f501b2a1 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -3004,7 +3004,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**)
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->clearChatText();
+		gAgentAvatarp->clearChatText();
 		gAgentCamera.slamLookAt(look_at);
 	}
 	gAgent.setPositionAgent(pos);
@@ -3151,9 +3151,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 			LLNotificationsUtil::add("SystemMessageTip", args);
 
 			// Set the new position
-			gAgentAvatar->setPositionAgent(agent_pos);
-			gAgentAvatar->clearChat();
-			gAgentAvatar->slamPosition();
+			gAgentAvatarp->setPositionAgent(agent_pos);
+			gAgentAvatarp->clearChat();
+			gAgentAvatarp->slamPosition();
 		}
 	}
 	else
@@ -3215,7 +3215,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->mFootPlane.clearVec();
+		gAgentAvatarp->mFootPlane.clearVec();
 	}
 	
 	// send walk-vs-run status
@@ -4175,7 +4175,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data)
 	if (object)
 	{
 		LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation());
-		if (!use_autopilot || isAgentAvatarValid() && gAgentAvatar->isSitting() && gAgentAvatar->getRoot() == object->getRoot())
+		if (!use_autopilot || isAgentAvatarValid() && gAgentAvatarp->isSitting() && gAgentAvatarp->getRoot() == object->getRoot())
 		{
 			//we're already sitting on this object, so don't autopilot
 		}
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index f3eb75bcd0..8860b734bb 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -134,15 +134,15 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
 	{
 		if (id == gAgentID)
 		{
-			if (!gAgentAvatar)
+			if (!gAgentAvatarp)
 			{
-				gAgentAvatar = new LLVOAvatarSelf(id, pcode, regionp);
+				gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp);
 			}
 			else 
 			{
-				gAgentAvatar->updateRegion(regionp);
+				gAgentAvatarp->updateRegion(regionp);
 			}
-			res = gAgentAvatar;
+			res = gAgentAvatarp;
 		}
 		else
 		{
@@ -388,7 +388,7 @@ void LLViewerObject::markDead()
 			if (isAgentAvatarValid())
 			{
 				// stop motions associated with this object
-				gAgentAvatar->stopMotionFromSource(mID);
+				gAgentAvatarp->stopMotionFromSource(mID);
 			}
 		}
 
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index eb966a1535..5e0bd5b811 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -894,8 +894,8 @@ void LLViewerObjectList::removeDrawable(LLDrawable* drawablep)
 
 BOOL LLViewerObjectList::killObject(LLViewerObject *objectp)
 {
-	// Don't ever kill gAgentAvatar, just mark it as null region instead.
-	if (objectp == gAgentAvatar)
+	// Don't ever kill gAgentAvatarp, just mark it as null region instead.
+	if (objectp == gAgentAvatarp)
 	{
 		objectp->setRegion(NULL);
 		return FALSE;
@@ -1218,8 +1218,8 @@ void LLViewerObjectList::generatePickList(LLCamera &camera)
 		// add all hud objects to pick list
 		if (isAgentAvatarValid())
 		{
-			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-				 iter != gAgentAvatar->mAttachmentPoints.end(); )
+			for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 			{
 				LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 				LLViewerJointAttachment* attachment = curiter->second;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 4b6ac07a94..f3ef4b38e9 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -367,7 +367,7 @@ public:
 
 			if (isAgentAvatarValid())
 			{
-				tvector = gAgent.getPosGlobalFromAgent(gAgentAvatar->mRoot.getWorldPosition());
+				tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition());
 				agent_root_center_text = llformat("AgentRootCenter %f %f %f",
 												  (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ]));
 			}
@@ -3150,7 +3150,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls,
 		// setup HUD render
 		if (selection->getSelectType() == SELECT_TYPE_HUD && LLSelectMgr::getInstance()->getSelection()->getObjectCount())
 		{
-			LLBBox hud_bbox = gAgentAvatar->getHUDBBox();
+			LLBBox hud_bbox = gAgentAvatarp->getHUDBBox();
 
 			// set up transform to encompass bounding box of HUD
 			glMatrixMode(GL_PROJECTION);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 8e9e15352a..e82a988ed2 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -962,12 +962,12 @@ void LLVOAvatar::restoreGL()
 {
 	if (!isAgentAvatarValid()) return;
 
-	gAgentAvatar->setCompositeUpdatesEnabled(TRUE);
-	for (U32 i = 0; i < gAgentAvatar->mBakedTextureDatas.size(); i++)
+	gAgentAvatarp->setCompositeUpdatesEnabled(TRUE);
+	for (U32 i = 0; i < gAgentAvatarp->mBakedTextureDatas.size(); i++)
 	{
-		gAgentAvatar->invalidateComposite(gAgentAvatar->mBakedTextureDatas[i].mTexLayerSet, FALSE);
+		gAgentAvatarp->invalidateComposite(gAgentAvatarp->mBakedTextureDatas[i].mTexLayerSet, FALSE);
 	}
-	gAgentAvatar->updateMeshTextures();
+	gAgentAvatarp->updateMeshTextures();
 }
 
 //static
@@ -6871,7 +6871,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 		const std::string& wearable_name = LLWearableDictionary::getTypeName((EWearableType)type);
 		apr_file_printf( file, "\n\t\t<!-- wearable: %s -->\n", wearable_name.c_str() );
 
-		for (LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam())
+		for (LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam())
 		{
 			LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param;
 			if( (viewer_param->getWearableType() == type) && 
@@ -6887,7 +6887,7 @@ void LLVOAvatar::dumpArchetypeXML( void* )
 			if (LLVOAvatarDictionary::getTEWearableType((ETextureIndex)te) == type)
 			{
 				// MULTIPLE_WEARABLES: extend to multiple wearables?
-				LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatar))->getImage((ETextureIndex)te, 0);
+				LLViewerTexture* te_image = ((LLVOAvatar *)(gAgentAvatarp))->getImage((ETextureIndex)te, 0);
 				if( te_image )
 				{
 					std::string uuid_str;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 0183061c0e..74ee6a05d9 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -67,12 +67,12 @@
 
 #include <boost/lexical_cast.hpp>
 
-LLVOAvatarSelf *gAgentAvatar = NULL;
+LLVOAvatarSelf *gAgentAvatarp = NULL;
 BOOL isAgentAvatarValid()
 {
-	return (gAgentAvatar &&
-			(gAgentAvatar->getRegion() != NULL) &&
-			(!gAgentAvatar->isDead()));
+	return (gAgentAvatarp &&
+			(gAgentAvatarp->getRegion() != NULL) &&
+			(!gAgentAvatarp->isDead()));
 }
 
 using namespace LLVOAvatarDefines;
@@ -1687,7 +1687,7 @@ void LLVOAvatarSelf::onLocalTextureLoaded(BOOL success, LLViewerFetchedTexture *
 void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()
 {
 	S32 gl_bytes = 0;
-	gAgentAvatar->getLocalTextureByteCount(&gl_bytes);
+	gAgentAvatarp->getLocalTextureByteCount(&gl_bytes);
 	llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;
 }
 
@@ -1961,13 +1961,13 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 		const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second;
 		if (texture_dict->mIsBakedTexture)
 		{
-			if (texture_id == gAgentAvatar->getTEImage(index)->getID())
+			if (texture_id == gAgentAvatarp->getTEImage(index)->getID())
 			{
-				LLTexLayerSet* layer_set = gAgentAvatar->getLayerSet(index);
+				LLTexLayerSet* layer_set = gAgentAvatarp->getLayerSet(index);
 				if (layer_set)
 				{
 					llinfos << "TAT: rebake - matched entry " << (S32)index << llendl;
-					gAgentAvatar->invalidateComposite(layer_set, TRUE);
+					gAgentAvatarp->invalidateComposite(layer_set, TRUE);
 					found = TRUE;
 					LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
 				}
@@ -1978,12 +1978,12 @@ void LLVOAvatarSelf::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
 	// If texture not found, rebake all entries.
 	if (!found)
 	{
-		gAgentAvatar->forceBakeAllTextures();
+		gAgentAvatarp->forceBakeAllTextures();
 	}
 	else
 	{
 		// Not sure if this is necessary, but forceBakeAllTextures() does it.
-		gAgentAvatar->updateMeshTextures();
+		gAgentAvatarp->updateMeshTextures();
 	}
 }
 
@@ -2065,7 +2065,7 @@ void LLVOAvatarSelf::onCustomizeEnd()
 {
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->invalidateAll();
+		gAgentAvatarp->invalidateAll();
 	}
 }
 
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 706a02c088..3c7ec04fab 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -334,7 +334,7 @@ public:
 
 };
 
-extern LLVOAvatarSelf *gAgentAvatar;
+extern LLVOAvatarSelf *gAgentAvatarp;
 
 BOOL isAgentAvatarValid();
 
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index 710348ac4b..e8fdccf30e 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -5893,9 +5893,9 @@ void LLVoiceClient::updatePosition(void)
 					rot);				// rotation matrix
 					
 			// Send the current avatar position to the voice code
-			rot = gAgentAvatar->getRootJoint()->getWorldRotation().getMatrix3();
+			rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
 	
-			pos = gAgentAvatar->getPositionGlobal();
+			pos = gAgentAvatarp->getPositionGlobal();
 			// TODO: Can we get the head offset from outside the LLVOAvatar?
 //			pos += LLVector3d(mHeadOffset);
 			pos += LLVector3d(0.f, 0.f, 1.f);
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 23a14c07ab..63f99273fe 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -65,9 +65,9 @@ public:
 		U32 num_bakes = (U32) LLVOAvatarDefines::BAKED_NUM_INDICES;
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			composite_enabled[index] = gAgentAvatar->isCompositeUpdateEnabled(index);
+			composite_enabled[index] = gAgentAvatarp->isCompositeUpdateEnabled(index);
 		}
-		gAgentAvatar->setCompositeUpdatesEnabled(temp_state);
+		gAgentAvatarp->setCompositeUpdatesEnabled(temp_state);
 	}
 
 	~LLOverrideBakedTextureUpdate()
@@ -75,7 +75,7 @@ public:
 		U32 num_bakes = (U32)LLVOAvatarDefines::BAKED_NUM_INDICES;		
 		for( U32 index = 0; index < num_bakes; ++index )
 		{
-			gAgentAvatar->setCompositeUpdatesEnabled(index, composite_enabled[index]);
+			gAgentAvatarp->setCompositeUpdatesEnabled(index, composite_enabled[index]);
 		}
 	}
 private:
@@ -202,9 +202,9 @@ BOOL LLWearable::exportFile(LLFILE* file) const
 
 void LLWearable::createVisualParams()
 {
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam())
+		 param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam())
 	{
 		if (param->getWearableType() == mType)
 		{
@@ -224,7 +224,7 @@ void LLWearable::createVisualParams()
 		param->resetDrivenParams();
 		if(!param->linkDrivenParams(boost::bind(wearable_function,(LLWearable*)this, _1), false))
 		{
-			if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatar,_1 ), true))
+			if( !param->linkDrivenParams(boost::bind(avatar_function,gAgentAvatarp,_1 ), true))
 			{
 				llwarns << "could not link driven params for wearable " << getName() << " id: " << param->getID() << llendl;
 				continue;
@@ -474,9 +474,9 @@ BOOL LLWearable::isOldVersion() const
 	}
 
 	S32 param_count = 0;
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -524,9 +524,9 @@ BOOL LLWearable::isDirty() const
 {
 	if (!isAgentAvatarValid()) return FALSE;
 
-	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
+	for( LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) 
 			&& (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) 
@@ -589,7 +589,7 @@ void LLWearable::setParamsToDefaults()
 {
 	if (!isAgentAvatarValid()) return;
 
-	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (((LLViewerVisualParam*)param)->getWearableType() == mType ) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
@@ -627,10 +627,10 @@ void LLWearable::writeToAvatar()
 {
 	if (!isAgentAvatarValid()) return;
 
-	ESex old_sex = gAgentAvatar->getSex();
+	ESex old_sex = gAgentAvatarp->getSex();
 
 	// Pull params
-	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
 	{
 		// cross-wearable parameters are not authoritative, as they are driven by a different wearable. So don't copy the values to the
 		// avatar object if cross wearable. Cross wearable params get their values from the avatar, they shouldn't write the other way.
@@ -639,7 +639,7 @@ void LLWearable::writeToAvatar()
 			S32 param_id = param->getID();
 			F32 weight = getVisualParamWeight(param_id);
 
-			gAgentAvatar->setVisualParamWeight( param_id, weight, FALSE );
+			gAgentAvatarp->setVisualParamWeight( param_id, weight, FALSE );
 		}
 	}
 
@@ -660,14 +660,14 @@ void LLWearable::writeToAvatar()
 			}
 			LLViewerTexture* image = LLViewerTextureManager::getFetchedTexture( image_id, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE );
 			// MULTI-WEARABLE: replace hard-coded 0
-			gAgentAvatar->setLocalTextureTE(te, image, 0);
+			gAgentAvatarp->setLocalTextureTE(te, image, 0);
 		}
 	}
 
-	ESex new_sex = gAgentAvatar->getSex();
+	ESex new_sex = gAgentAvatarp->getSex();
 	if( old_sex != new_sex )
 	{
-		gAgentAvatar->updateSexDependentLayerSets( FALSE );
+		gAgentAvatarp->updateSexDependentLayerSets( FALSE );
 	}	
 	
 //	if( upload_bake )
@@ -693,12 +693,12 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 	}
 
 	// Pull params
-	for( LLVisualParam* param = gAgentAvatar->getFirstVisualParam(); param; param = gAgentAvatar->getNextVisualParam() )
+	for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (((LLViewerVisualParam*)param)->getWearableType() == type) && (param->getGroup() == VISUAL_PARAM_GROUP_TWEAKABLE ) )
 		{
 			S32 param_id = param->getID();
-			gAgentAvatar->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
+			gAgentAvatarp->setVisualParamWeight( param_id, param->getDefaultWeight(), upload_bake );
 		}
 	}
 
@@ -707,8 +707,8 @@ void LLWearable::removeFromAvatar( EWearableType type, BOOL upload_bake )
 		gFloaterCustomize->setWearable(type, NULL, PERM_ALL, TRUE);
 	}
 
-	gAgentAvatar->updateVisualParams();
-	gAgentAvatar->wearableUpdated(type, TRUE);
+	gAgentAvatarp->updateVisualParams();
+	gAgentAvatarp->wearableUpdated(type, TRUE);
 
 //	if( upload_bake )
 //	{
@@ -733,9 +733,9 @@ void LLWearable::copyDataFrom(const LLWearable* src)
 
 	mSavedVisualParamMap.clear();
 	// Deep copy of mVisualParamMap (copies only those params that are current, filling in defaults where needed)
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); 
 		param;
-		param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam() )
+		param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam() )
 	{
 		if( (param->getWearableType() == mType) )
 		{
@@ -845,7 +845,7 @@ void LLWearable::setVisualParams()
 		S32 id = iter->first;
 		LLVisualParam *wearable_param = iter->second;
 		F32 value = wearable_param->getWeight();
-		gAgentAvatar->setVisualParamWeight(id, value, FALSE);
+		gAgentAvatarp->setVisualParamWeight(id, value, FALSE);
 	}
 }
 
@@ -986,7 +986,7 @@ BOOL LLWearable::isOnTop() const
 
 void LLWearable::createLayers(S32 te)
 {
-	LLTexLayerSet *layer_set = gAgentAvatar->getLayerSet((ETextureIndex)te);
+	LLTexLayerSet *layer_set = gAgentAvatarp->getLayerSet((ETextureIndex)te);
 	if (layer_set)
 	{
 		layer_set->cloneTemplates(mTEMap[te], (ETextureIndex)te, this);
@@ -1084,9 +1084,9 @@ void LLWearable::destroyTextures()
 void LLWearable::pullCrossWearableValues()
 {
 	// scan through all of the avatar's visual parameters
-	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatar->getFirstVisualParam(); 
+	for (LLViewerVisualParam* param = (LLViewerVisualParam*) gAgentAvatarp->getFirstVisualParam(); 
 		 param;
-		 param = (LLViewerVisualParam*) gAgentAvatar->getNextVisualParam())
+		 param = (LLViewerVisualParam*) gAgentAvatarp->getNextVisualParam())
 	{
 		if( param )
 		{
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index fda89fae60..4ca251af3e 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -3862,8 +3862,8 @@ void LLPipeline::renderForSelect(std::set<LLViewerObject*>& objects, BOOL render
 		glh::matrix4f save_model(glh_get_current_modelview());
 
 		setup_hud_matrices(screen_rect);
-		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatar->mAttachmentPoints.begin(); 
-			 iter != gAgentAvatar->mAttachmentPoints.end(); )
+		for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+			 iter != gAgentAvatarp->mAttachmentPoints.end(); )
 		{
 			LLVOAvatar::attachment_map_t::iterator curiter = iter++;
 			LLViewerJointAttachment* attachment = curiter->second;
@@ -3965,7 +3965,7 @@ void LLPipeline::rebuildPools()
 
 	if (isAgentAvatarValid())
 	{
-		gAgentAvatar->rebuildHUD();
+		gAgentAvatarp->rebuildHUD();
 	}
 }
 
@@ -4598,7 +4598,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
 	}
 
 	if (isAgentAvatarValid() &&
-		gAgentAvatar->mSpecialRenderMode == 3)
+		gAgentAvatarp->mSpecialRenderMode == 3)
 	{
 		LLColor4  light_color = LLColor4::white;
 		light_color.mV[3] = 0.0f;
@@ -4709,11 +4709,11 @@ void LLPipeline::enableLightsDynamic()
 
 	if (isAgentAvatarValid() && getLightingDetail() <= 0)
 	{
-		if (gAgentAvatar->mSpecialRenderMode == 0) // normal
+		if (gAgentAvatarp->mSpecialRenderMode == 0) // normal
 		{
 			gPipeline.enableLightsAvatar();
 		}
-		else if (gAgentAvatar->mSpecialRenderMode >= 1)  // anim preview
+		else if (gAgentAvatarp->mSpecialRenderMode >= 1)  // anim preview
 		{
 			gPipeline.enableLightsAvatarEdit(LLColor4(0.7f, 0.6f, 0.3f, 1.f));
 		}
@@ -7106,7 +7106,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 		if (!skip_avatar_update)
 		{
-			gAgentAvatar->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
+			gAgentAvatarp->updateAttachmentVisibility(CAMERA_MODE_THIRD_PERSON);
 		}
 		LLVertexBuffer::unbind();
 
@@ -7332,7 +7332,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 
 		if (!skip_avatar_update)
 		{
-			gAgentAvatar->updateAttachmentVisibility(gAgentCamera.getCameraMode());
+			gAgentAvatarp->updateAttachmentVisibility(gAgentCamera.getCameraMode());
 		}
 	}
 }
-- 
cgit v1.2.3


From ac103403160e87bb6b40ac3e032d077a3381da8e Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Mon, 29 Mar 2010 18:03:58 +0100
Subject: EXT-6580  restrict size of linux's fallback font list

reviewed and approved for hotfix branch by Q.
---
 indra/llwindow/llwindowsdl.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 1f705f9e60..efa0110f8b 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -2543,6 +2543,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 	// Use libfontconfig to find us a nice ordered list of fallback fonts
 	// specific to this system.
 	std::string final_fallback("/usr/share/fonts/truetype/kochi/kochi-gothic.ttf");
+	const int max_font_count_cutoff = 40; // fonts are expensive in the current system, don't enumerate an arbitrary number of them
 	// Our 'ideal' font properties which define the sorting results.
 	// slant=0 means Roman, index=0 means the first face in a font file
 	// (the one we actually use), weight=80 means medium weight,
@@ -2558,7 +2559,6 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 	std::vector<std::string> rtns;
 	FcFontSet *fs = NULL;
 	FcPattern *sortpat = NULL;
-	int font_count = 0;
 
 	llinfos << "Getting system font list from FontConfig..." << llendl;
 
@@ -2602,12 +2602,13 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 		FcPatternDestroy(sortpat);
 	}
 
+	int found_font_count = 0;
 	if (fs)
 	{
 		// Get the full pathnames to the fonts, where available,
 		// which is what we really want.
-		int i;
-		for (i=0; i<fs->nfont; ++i)
+		found_font_count = fs->nfont;
+		for (int i=0; i<fs->nfont; ++i)
 		{
 			FcChar8 *filename;
 			if (FcResultMatch == FcPatternGetString(fs->fonts[i],
@@ -2616,7 +2617,8 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 			    && filename)
 			{
 				rtns.push_back(std::string((const char*)filename));
-				++font_count;
+				if (rtns.size() >= max_font_count_cutoff)
+					break; // hit limit
 			}
 		}
 		FcFontSetDestroy (fs);
@@ -2629,7 +2631,7 @@ std::vector<std::string> LLWindowSDL::getDynamicFallbackFontList()
 	{
 		lldebugs << "  file: " << *it << llendl;
 	}
-	llinfos << "Using " << font_count << " system font(s)." << llendl;
+	llinfos << "Using " << rtns.size() << "/" << found_font_count << " system fonts." << llendl;
 
 	rtns.push_back(final_fallback);
 	return rtns;
-- 
cgit v1.2.3


From 970b7051acbc23a504c40f23fb6180e45aa536ae Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Mon, 29 Mar 2010 11:28:42 -0600
Subject: fix for EXT-6566: crash at LLTextureCache::updatedHeaderEntriesFile
 [secondlife-bin lltexturecache.cpp:1292]

---
 indra/newview/lltexturecache.cpp | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 7a0712f8aa..0e72b93e48 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1221,9 +1221,17 @@ U32 LLTextureCache::openAndReadEntries(std::vector<Entry>& entries)
 	mFreeList.clear();
 	mTexturesSizeTotal = 0;
 
-	LLAPRFile* aprfile = openHeaderEntriesFile(true, 0);
-	updatedHeaderEntriesFile() ;
-	aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
+	LLAPRFile* aprfile = NULL; 
+	if(mUpdatedEntryMap.empty())
+	{
+		aprfile = openHeaderEntriesFile(true, (S32)sizeof(EntriesInfo));
+	}
+	else //update the header file first.
+	{
+		aprfile = openHeaderEntriesFile(false, 0);
+		updatedHeaderEntriesFile() ;
+		aprfile->seek(APR_SET, (S32)sizeof(EntriesInfo));
+	}
 	for (U32 idx=0; idx<num_entries; idx++)
 	{
 		Entry entry;
-- 
cgit v1.2.3


From 8b40230f4157ca9a47bd3615dfe7817750db6c4c Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Mon, 29 Mar 2010 11:32:47 -0600
Subject: fix for EXT-6435: crash at writeEntriesAndClose: ASSERT (num_entries
 == mHeaderEntriesInfo.mEntries)

---
 indra/newview/lltexturecache.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 0e72b93e48..08bc8220d9 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -852,8 +852,8 @@ bool LLTextureCache::updateTextureEntryList(const LLUUID& id, S32 bodysize)
 			}			
 			else if (oldbodysize != entry.mBodySize)
 			{
-				// TODO: change to llwarns
-				llerrs << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
+				// only happens to 64 bits systems, do not know why.
+				llwarns << "Entry mismatch in mTextureSizeMap / mHeaderIDMap"
 					   << " idx=" << idx << " oldsize=" << oldbodysize << " entrysize=" << entry.mBodySize << llendl;
 			}
 			updateEntry(idx, entry, entry.mImageSize, bodysize);			
-- 
cgit v1.2.3


From 0ffc73855b02bf4679c42cdb20e00544922f8407 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 13:50:37 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Fix for cleaning up gAgentAvatar on app shutdown.
---
 indra/newview/llappviewer.cpp        |  1 +
 indra/newview/llviewerobjectlist.cpp |  3 ++-
 indra/newview/llvoavatarself.cpp     | 11 +++++++++--
 indra/newview/llvoavatarself.h       |  1 +
 4 files changed, 13 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a8d69a38cd..8eab4bf508 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4085,6 +4085,7 @@ void LLAppViewer::disconnectViewer()
 	gAgentCamera.cleanup();
 	// Also writes cached agent settings to gSavedSettings
 	gAgent.cleanup();
+	delete gAgentAvatarp;
 
 	// This is where we used to call gObjectList.destroy() and then delete gWorldp.
 	// Now we just ask the LLWorld singleton to cleanly shut down.
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index 5e0bd5b811..752aeaaab0 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -949,7 +949,8 @@ void LLViewerObjectList::killAllObjects()
 	{
 		objectp = *iter;
 		killObject(objectp);
-		llassert(objectp->isDead());
+		// Object must be dead, or it's the LLVOAvatarSelf which never dies.
+		llassert((objectp == gAgentAvatarp) || objectp->isDead());
 	}
 
 	cleanDeadObjects(FALSE);
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index d58be21910..06c9af6c2f 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -518,10 +518,17 @@ BOOL LLVOAvatarSelf::buildMenus()
 	return TRUE;
 }
 
+LLVOAvatarSelf::cleanup()
+{
+	markDead();
+ 	delete mScreenp;
+ 	mScreenp = NULL;
+	mRegionp = NULL;
+}
+
 LLVOAvatarSelf::~LLVOAvatarSelf()
 {
-	delete mScreenp;
-	mScreenp = NULL;
+	cleanup();
 }
 
 /**
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 3c7ec04fab..4960d4d103 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -56,6 +56,7 @@ public:
 	virtual 				~LLVOAvatarSelf();
 	virtual void			markDead();
 	virtual void 			initInstance(); // Called after construction to initialize the class.
+	void					cleanup();
 protected:
 	/*virtual*/ BOOL		loadAvatar();
 	BOOL					loadAvatarSelf();
-- 
cgit v1.2.3


From b4cb21e9b38bd86eddfd4ebef82283e2865f958b Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 13:55:43 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

Fix for cleaning up gAgentAvatar on app shutdown.
---
 indra/newview/llvoavatarself.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 06c9af6c2f..9c2e5461b2 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -518,7 +518,7 @@ BOOL LLVOAvatarSelf::buildMenus()
 	return TRUE;
 }
 
-LLVOAvatarSelf::cleanup()
+void LLVOAvatarSelf::cleanup()
 {
 	markDead();
  	delete mScreenp;
-- 
cgit v1.2.3


From fbdd93bb91c921b387682269423ce07dd69a92d1 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 14:45:21 -0400
Subject: EXT-6536 : Make LLVOAvatarSelf a singleton

No longer explicitly deleting gAgentAvatarp due to reference counting.
---
 indra/newview/llappviewer.cpp | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 8eab4bf508..a8d69a38cd 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -4085,7 +4085,6 @@ void LLAppViewer::disconnectViewer()
 	gAgentCamera.cleanup();
 	// Also writes cached agent settings to gSavedSettings
 	gAgent.cleanup();
-	delete gAgentAvatarp;
 
 	// This is where we used to call gObjectList.destroy() and then delete gWorldp.
 	// Now we just ask the LLWorld singleton to cleanly shut down.
-- 
cgit v1.2.3


From 3fca923949667d1c713119043cd4aaeae4acfe09 Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Mon, 29 Mar 2010 11:58:31 -0700
Subject: Fix initial outfit selection dialog to choose initial outfit based on
 what's passed up from login.cgi instead of just using hardcoded values.  If
 nothing is passed up, it defaults to values in settings.xml

---
 indra/newview/app_settings/settings.xml | 23 +++++++++++++++++++++++
 indra/newview/lllogininstance.cpp       |  1 +
 indra/newview/llstartup.cpp             | 31 +++++++++++++++++--------------
 3 files changed, 41 insertions(+), 14 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 6cbb6d05f4..aaa6b874d9 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2388,6 +2388,29 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+	<key>DefaultFemaleAvatar</key>
+	<map>
+	  <key>Comment</key>
+	  <string>Default Female Avatar</string>
+	  <key>Persist</key>
+	  <integer>1</integer>
+	  <key>Type</key>
+	  <string>String</string>
+	  <key>Value</key>
+	  <string>Female Shape &amp; Outfit</string>
+	</map>
+	<key>DefaultMaleAvatar</key>
+	<map>
+	  <key>Comment</key>
+	  <string>Default Male Avatar</string>
+	  <key>Persist</key>
+	  <integer>1</integer>
+	  <key>Type</key>
+	  <string>String</string>
+	  <key>Value</key>
+	  <string>Male Shape &amp; Outfit</string>
+	</map>
+
     <key>DefaultObjectTexture</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index df7aa6f79d..0459c85050 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -148,6 +148,7 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 	requested_options.append("adult_compliant"); 
 	//requested_options.append("inventory-targets");
 	requested_options.append("buddy-list");
+	requested_options.append("newuser-config");
 	requested_options.append("ui-config");
 #endif
 	requested_options.append("voice-config");
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index a726d8c476..6bdae3cba9 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -2360,8 +2360,6 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3
 const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
 const std::string MALE_GESTURES_FOLDER = "Male Gestures";
 const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
-const std::string MALE_OUTFIT_FOLDER = "Male Shape & Outfit";
-const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit";
 const S32 OPT_CLOSED_WINDOW = -1;
 const S32 OPT_MALE = 0;
 const S32 OPT_FEMALE = 1;
@@ -2369,23 +2367,28 @@ const S32 OPT_TRUST_CERT = 0;
 const S32 OPT_CANCEL_TRUST = 1;
 	
 bool callback_choose_gender(const LLSD& notification, const LLSD& response)
-{	
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+{
+	
+    // These defaults are returned from the server on login.  They are set in login.xml.                  
+    // If no default is returned from the server, they are retrieved from settings.xml.                   
+	
+	S32 option = LLNotification::getSelectedOption(notification, response);
 	switch(option)
 	{
-	case OPT_MALE:
-		LLStartUp::loadInitialOutfit( MALE_OUTFIT_FOLDER, "male" );
-		break;
-
-	case OPT_FEMALE:
-	case OPT_CLOSED_WINDOW:
-	default:
-		LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" );
-		break;
+		case OPT_MALE:
+			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
+			break;
+			
+        case OPT_FEMALE:
+        case OPT_CLOSED_WINDOW:
+        default:
+			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
+			break;
 	}
 	return false;
 }
 
+
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name )
 {
@@ -3011,7 +3014,7 @@ bool process_login_success_response()
 		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
 	}
 	
-	static const char* CONFIG_OPTIONS[] = {"voice-config"};
+	static const char* CONFIG_OPTIONS[] = {"voice-config", "newuser-config"};
 	for (int i = 0; i < sizeof(CONFIG_OPTIONS)/sizeof(CONFIG_OPTIONS[0]); i++)
 	{
 		LLSD options = response[CONFIG_OPTIONS[i]];
-- 
cgit v1.2.3


From b1b5a11bb0f581e66a2922841920d5fb40755bac Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 15:33:48 -0400
Subject: EXT-3075 : Remove swear words from comments across viewer

This bugs me in a minor way.  Did a search-and-cleanup on various swear words.
---
 indra/llcommon/llapp.h                             | 2 +-
 indra/llinventory/llparcel.h                       | 2 +-
 indra/llmessage/lltransfersourceasset.cpp          | 2 +-
 indra/llui/llmenugl.h                              | 2 +-
 indra/lscript/lscript_execute/lscript_execute.cpp  | 2 +-
 indra/newview/llfloaterlagmeter.cpp                | 2 +-
 indra/newview/llpreviewscript.cpp                  | 3 +--
 indra/newview/llvovolume.cpp                       | 2 +-
 indra/test_apps/llplugintest/llmediaplugintest.cpp | 2 +-
 9 files changed, 9 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index 27a52cdd99..e5b8edf9c3 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -235,7 +235,7 @@ public:
 	// Child process handling (Unix only for now)
 	//
 	// Set a callback to be run on exit of a child process
-	// WARNING!  This callback is run from the signal handler due to the extreme crappiness of
+	// WARNING!  This callback is run from the signal handler due to
 	// Linux threading requiring waitpid() to be called from the thread that spawned the process.
 	// At some point I will make this more behaved, but I'm not going to fix this right now - djs
 	void setChildCallback(pid_t pid, LLAppChildCallback callback);
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 2a9a596912..1219711617 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -258,7 +258,7 @@ public:
 	void setMediaURLResetTimer(F32 time);
 	virtual void	setLocalID(S32 local_id);
 
-	// blow away all the extra crap lurking in parcels, including urls, access lists, etc
+	// blow away all the extra stuff lurking in parcels, including urls, access lists, etc
 	void clearParcel();
 
 	// This value is not persisted out to the parcel file, it is only
diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp
index 8f36d516d7..abfb432020 100644
--- a/indra/llmessage/lltransfersourceasset.cpp
+++ b/indra/llmessage/lltransfersourceasset.cpp
@@ -131,7 +131,7 @@ LLTSCode LLTransferSourceAsset::dataCallback(const S32 packet_id,
 	*data_handle = tmpp;
 	if (!vf.read(tmpp, max_bytes))		/* Flawfinder: Ignore */
 	{
-		// Crap, read failure, need to deal with it.
+		// Read failure, need to deal with it.
 		delete[] tmpp;
 		*data_handle = NULL;
 		returned_bytes = 0;
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 39d1986461..6f0f83d4b9 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -295,7 +295,7 @@ private:
 // class, by allowing another method to be specified which determines
 // if the menu item should consider itself checked as true or not.  Be
 // careful that the provided callback is fast - it needs to be VERY
-// FUCKING EFFICIENT, because it may need to be checked a lot.
+// EFFICIENT because it may need to be checked a lot.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 class LLMenuItemCheckGL 
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp
index e849fa9a6e..8de54aeda5 100644
--- a/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -520,7 +520,7 @@ void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const L
 		}
 		else
 		{
-			llwarns << "Shit, somehow got an event that we're not registered for!" << llendl;
+			llwarns << "Somehow got an event that we're not registered for!" << llendl;
 		}
 		delete eventdata;
 	}
diff --git a/indra/newview/llfloaterlagmeter.cpp b/indra/newview/llfloaterlagmeter.cpp
index 85186cee6b..100cbdb217 100644
--- a/indra/newview/llfloaterlagmeter.cpp
+++ b/indra/newview/llfloaterlagmeter.cpp
@@ -206,7 +206,7 @@ void LLFloaterLagMeter::determineNetwork()
 
 	// *FIXME: We can't blame a large ping time on anything in
 	// particular if the frame rate is low, because a low frame
-	// rate is a sure recipe for crappy ping times right now until
+	// rate is a sure recipe for bad ping times right now until
 	// the network handlers are de-synched from the rendering.
 	F32 client_frame_time_ms = 1000.0f * LLViewerStats::getInstance()->mFPSStat.getMeanDuration();
 	
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index f5a9f82d50..4167408fc3 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -1090,8 +1090,7 @@ void LLPreviewLSL::onSave(void* userdata, BOOL close_after_save)
 
 // Save needs to compile the text in the buffer. If the compile
 // succeeds, then save both assets out to the database. If the compile
-// fails, go ahead and save the text anyway so that the user doesn't
-// get too fucked.
+// fails, go ahead and save the text anyway.
 void LLPreviewLSL::saveIfNeeded()
 {
 	// llinfos << "LLPreviewLSL::saveIfNeeded()" << llendl;
diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp
index cb362d557c..6b052b8e99 100644
--- a/indra/newview/llvovolume.cpp
+++ b/indra/newview/llvovolume.cpp
@@ -369,7 +369,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys,
 			S32 res2 = unpackTEMessage(*dp);
 			if (TEM_INVALID == res2)
 			{
-				// Well, crap, there's something bogus in the data that we're unpacking.
+				// There's something bogus in the data that we're unpacking.
 				dp->dumpBufferToLog();
 				llwarns << "Flushing cache files" << llendl;
 				std::string mask;
diff --git a/indra/test_apps/llplugintest/llmediaplugintest.cpp b/indra/test_apps/llplugintest/llmediaplugintest.cpp
index 5677308fb0..7e9a8336e7 100644
--- a/indra/test_apps/llplugintest/llmediaplugintest.cpp
+++ b/indra/test_apps/llplugintest/llmediaplugintest.cpp
@@ -1955,7 +1955,7 @@ void LLMediaPluginTest::updateStatusBar()
 		 cached_distance == mDistanceCameraToSelectedGeometry
 	   )
 	{
-		// nothing changed so don't spend time in this shitty function
+		// nothing changed so don't spend time here
 		return;
 	};
 
-- 
cgit v1.2.3


From 998c7fb94bea15b228053524228ae7eadd8e6de2 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Mon, 29 Mar 2010 12:45:29 -0700
Subject: VWR-17644 undo old 'es' overrides

---
 indra/newview/skins/default/xui/es/floater_tools.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml
index ac3a949821..d912f233f5 100644
--- a/indra/newview/skins/default/xui/es/floater_tools.xml
+++ b/indra/newview/skins/default/xui/es/floater_tools.xml
@@ -399,7 +399,7 @@ máximo" name="checkbox fullbright"/>
 			<text name="tex gen">
 				Detallado
 			</text>
-			<combo_box name="combobox texgen" width="86">
+			<combo_box name="combobox texgen">
 				<combo_box.item label="Por defecto" name="Default"/>
 				<combo_box.item label="Plano" name="Planar"/>
 			</combo_box>
@@ -442,9 +442,9 @@ máximo" name="checkbox fullbright"/>
 			<check_box label="Voltear" name="checkbox flip s"/>
 			<spinner label="Vertical (V)" name="TexScaleV"/>
 			<check_box label="Voltear" name="checkbox flip t"/>
-			<spinner label="Rotación" left="118" name="TexRot" width="62"/>
-			<spinner label="Repeticiones / Metro" left="118" name="rptctrl" width="62"/>
-			<button label="Aplicar" label_selected="Aplicar" left_delta="72" name="button apply"/>
+			<spinner label="Rotación" name="TexRot"/>
+			<spinner label="Repeticiones / Metro" name="rptctrl"/>
+			<button label="Aplicar" label_selected="Aplicar" name="button apply"/>
 			<text name="tex offset">
 				Desplazar
 			</text>
-- 
cgit v1.2.3


From 78436b3237e3ca23d0266f410e475a65ddf287aa Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Mon, 29 Mar 2010 12:51:01 -0700
Subject: EXT-6572 (major bug) DE workaround to remove the word "Kaufen" and
 leave just the L$ link to avoid obvious linguistic error due to poor source
 design, at Simone's request

---
 indra/newview/skins/default/xui/de/panel_status_bar.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/de/panel_status_bar.xml b/indra/newview/skins/default/xui/de/panel_status_bar.xml
index 0e182fa417..803bd1b5ab 100644
--- a/indra/newview/skins/default/xui/de/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/de/panel_status_bar.xml
@@ -22,7 +22,7 @@
 		[AMT] L$
 	</panel.string>
 	<button label="" label_selected="" name="buycurrency" tool_tip="Mein Kontostand"/>
-	<button label="Kaufen" name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
+	<button label=" " name="buyL" tool_tip="Hier klicken, um mehr L$ zu kaufen"/>
 	<text name="TimeText" tool_tip="Aktuelle Zeit (Pazifik)">
 		24:00 H PST
 	</text>
-- 
cgit v1.2.3


From ab6a2456c0b8c2bf5bc13cfe811aa58e81fa3327 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Mon, 29 Mar 2010 13:16:12 -0700
Subject: VWR-17649 en_xui_change

---
 indra/newview/skins/default/xui/en/floater_tools.xml | 14 +++++++-------
 indra/newview/skins/default/xui/es/floater_tools.xml |  4 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index fd046c3695..957ab240ee 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -2842,7 +2842,7 @@ even though the user gets a free copy.
          left_delta="0"
          name="button about land"
          top_pad="4"
-         width="112" />
+         width="125" />
         <check_box
          control_name="ShowParcelOwners"
          height="19"
@@ -2863,7 +2863,7 @@ even though the user gets a free copy.
          left="20"
          name="label_parcel_modify"
          top="152"
-         width="150">
+         width="240">
             Modify Parcel
         </text>
         <button
@@ -2875,7 +2875,7 @@ even though the user gets a free copy.
          left="30"
          name="button subdivide land"
          top="172"
-         width="112" />
+         width="125" />
         <button
          follows="left|top"
          height="23"
@@ -2885,7 +2885,7 @@ even though the user gets a free copy.
          left_delta="0"
          name="button join land"
          top_pad="4"
-         width="112" />
+         width="125" />
         <text
          type="string"
          length="1"
@@ -2896,7 +2896,7 @@ even though the user gets a free copy.
          left="20"
          name="label_parcel_trans"
          top="256"
-         width="150">
+         width="240">
             Land Transactions
         </text>
         <button
@@ -2908,7 +2908,7 @@ even though the user gets a free copy.
          left="30"
          name="button buy land"
          top="276"
-         width="112" />
+         width="125" />
         <button
          follows="left|top"
          height="23"
@@ -2918,6 +2918,6 @@ even though the user gets a free copy.
          left_delta="0"
          name="button abandon land"
          top_pad="4"
-         width="112" />
+         width="125" />
  </panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml
index d912f233f5..9c5fea9267 100644
--- a/indra/newview/skins/default/xui/es/floater_tools.xml
+++ b/indra/newview/skins/default/xui/es/floater_tools.xml
@@ -487,8 +487,8 @@ Gris = Público"/>
 		<text name="label_parcel_modify">
 			Modificar la parcela
 		</text>
-		<button label="Dividir" label_selected="Dividir" name="button subdivide land" width="140"/>
-		<button label="Inscribirse" label_selected="Inscribirse" name="button join land" width="140"/>
+		<button label="Dividir" label_selected="Dividir" name="button subdivide land"/>
+		<button label="Inscribirse" label_selected="Inscribirse" name="button join land"/>
 		<text name="label_parcel_trans">
 			Transacciones de terreno
 		</text>
-- 
cgit v1.2.3


From 114e5ca0839bace7f247a6eadb6e06a28597501d Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 29 Mar 2010 16:33:35 -0400
Subject: EXT-5940 : Typedef all vector<LLUUID>'s

Superficial cleanup to change all typedef std::vector<LLUUID> to use a common typedef uuid_vec_t instead.
---
 indra/llcommon/lluuid.h                 |  1 +
 indra/llinventory/llparcel.cpp          |  2 +-
 indra/llinventory/llparcel.h            |  2 +-
 indra/llui/llflatlistview.cpp           |  2 +-
 indra/llui/llflatlistview.h             |  2 +-
 indra/llui/llscrolllistctrl.cpp         |  4 ++--
 indra/llui/llscrolllistctrl.h           |  2 +-
 indra/newview/llagentwearables.cpp      | 21 ++++++++++----------
 indra/newview/llappearancemgr.cpp       |  2 +-
 indra/newview/llappearancemgr.h         |  2 +-
 indra/newview/llavataractions.cpp       | 18 ++++++++---------
 indra/newview/llavataractions.h         |  8 ++++----
 indra/newview/llavatarlist.cpp          | 22 ++++++++++-----------
 indra/newview/llavatarlist.h            |  8 ++++----
 indra/newview/llavatarlistitem.h        |  2 +-
 indra/newview/llcallfloater.cpp         | 20 +++++++++----------
 indra/newview/llfloateravatarpicker.cpp |  8 ++++----
 indra/newview/llfloateravatarpicker.h   |  4 ++--
 indra/newview/llfloatergesture.cpp      | 28 +++++++++++++-------------
 indra/newview/llfloatergesture.h        |  2 +-
 indra/newview/llfloatergodtools.cpp     |  2 +-
 indra/newview/llfloatergodtools.h       |  2 +-
 indra/newview/llfloatergroupinvite.cpp  |  2 +-
 indra/newview/llfloatergroupinvite.h    |  2 +-
 indra/newview/llfloaterland.cpp         |  4 ++--
 indra/newview/llfloaterland.h           |  6 +++---
 indra/newview/llfloaterregioninfo.cpp   | 13 ++++++------
 indra/newview/llfloaterregioninfo.h     |  8 ++++----
 indra/newview/llfloaterreporter.cpp     |  2 +-
 indra/newview/llfloaterreporter.h       |  2 +-
 indra/newview/llfloaterscriptlimits.cpp |  2 +-
 indra/newview/llfloatersellland.cpp     |  4 ++--
 indra/newview/llfloatertopobjects.cpp   |  2 +-
 indra/newview/llfloatertopobjects.h     |  2 +-
 indra/newview/llfolderview.cpp          |  2 +-
 indra/newview/llfriendcard.cpp          |  4 ++--
 indra/newview/llfriendcard.h            |  2 +-
 indra/newview/llgesturemgr.cpp          |  6 +++---
 indra/newview/llgesturemgr.h            |  2 +-
 indra/newview/llgroupmgr.cpp            | 12 +++++------
 indra/newview/llgroupmgr.h              | 12 +++++------
 indra/newview/llimfloater.cpp           |  6 +++---
 indra/newview/llimfloater.h             |  2 +-
 indra/newview/llimview.cpp              | 14 ++++++-------
 indra/newview/llimview.h                | 10 +++++-----
 indra/newview/llinventorybridge.cpp     |  8 ++++----
 indra/newview/llinventorymodel.cpp      | 14 ++++++-------
 indra/newview/llinventoryobserver.cpp   | 26 ++++++++++++------------
 indra/newview/llinventoryobserver.h     | 35 +++++++++++++--------------------
 indra/newview/lllocationinputctrl.cpp   |  2 +-
 indra/newview/llpanelblockedlist.cpp    |  2 +-
 indra/newview/llpanelblockedlist.h      |  2 +-
 indra/newview/llpanelgroupinvite.cpp    | 12 +++++------
 indra/newview/llpanelgroupinvite.h      |  2 +-
 indra/newview/llpanelgrouproles.cpp     | 22 ++++++++++-----------
 indra/newview/llpanelgrouproles.h       |  2 +-
 indra/newview/llpanelpeople.cpp         | 20 +++++++++----------
 indra/newview/llpanelpeople.h           |  6 +++---
 indra/newview/llpanelpeoplemenus.cpp    |  6 +++---
 indra/newview/llpanelpeoplemenus.h      |  4 ++--
 indra/newview/llpanelplaces.cpp         |  4 ++--
 indra/newview/llpanelplaces.h           |  2 +-
 indra/newview/llparticipantlist.cpp     |  4 ++--
 indra/newview/llparticipantlist.h       |  2 +-
 indra/newview/llpreviewgesture.cpp      |  2 +-
 indra/newview/llrecentpeople.cpp        |  2 +-
 indra/newview/llrecentpeople.h          |  2 +-
 indra/newview/llselectmgr.cpp           |  6 +++---
 indra/newview/llselectmgr.h             |  4 ++--
 indra/newview/llspeakers.cpp            |  2 +-
 indra/newview/llstartup.cpp             |  2 +-
 indra/newview/lltooldraganddrop.cpp     | 16 +++++++--------
 indra/newview/lltooldraganddrop.h       |  4 ++--
 indra/newview/llviewerinventory.cpp     |  2 +-
 indra/newview/llviewermessage.cpp       | 16 +++++++--------
 indra/newview/llviewermessage.h         |  4 ++--
 indra/newview/llworld.cpp               |  2 +-
 indra/newview/llworld.h                 |  2 +-
 78 files changed, 259 insertions(+), 267 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h
index c78fb12018..3a0d66e4a5 100644
--- a/indra/llcommon/lluuid.h
+++ b/indra/llcommon/lluuid.h
@@ -133,6 +133,7 @@ public:
 	U8 mData[UUID_BYTES];
 };
 
+typedef std::vector<LLUUID> uuid_vec_t;
 
 // Construct
 inline LLUUID::LLUUID()
diff --git a/indra/llinventory/llparcel.cpp b/indra/llinventory/llparcel.cpp
index ec21ae40e7..b08cb28218 100644
--- a/indra/llinventory/llparcel.cpp
+++ b/indra/llinventory/llparcel.cpp
@@ -452,7 +452,7 @@ BOOL LLParcel::allowTerraformBy(const LLUUID &agent_id) const
 
 bool LLParcel::isAgentBlockedFromParcel(LLParcel* parcelp,
                                         const LLUUID& agent_id,
-                                        const std::vector<LLUUID>& group_ids,
+                                        const uuid_vec_t& group_ids,
                                         const BOOL is_agent_identified,
                                         const BOOL is_agent_transacted,
                                         const BOOL is_agent_ageverified)
diff --git a/indra/llinventory/llparcel.h b/indra/llinventory/llparcel.h
index 1219711617..4ee9d9b40f 100644
--- a/indra/llinventory/llparcel.h
+++ b/indra/llinventory/llparcel.h
@@ -538,7 +538,7 @@ public:
 
 	static bool isAgentBlockedFromParcel(LLParcel* parcelp, 
 									const LLUUID& agent_id,
-									const std::vector<LLUUID>& group_ids,
+									const uuid_vec_t& group_ids,
 									const BOOL is_agent_identified,
 									const BOOL is_agent_transacted,
 									const BOOL is_agent_ageverified);
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 2e5aeec41d..bc34012267 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -243,7 +243,7 @@ LLUUID LLFlatListView::getSelectedUUID() const
 	}
 }
 
-void LLFlatListView::getSelectedUUIDs(std::vector<LLUUID>& selected_uuids) const
+void LLFlatListView::getSelectedUUIDs(uuid_vec_t& selected_uuids) const
 {
 	if (mSelectedItemPairs.empty()) return;
 
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 92cb40332e..837fbb36b7 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -224,7 +224,7 @@ public:
 	 * Get LLUUIDs associated with selected items
 	 * @param selected_uuids An std::vector being populated with LLUUIDs associated with selected items
 	 */
-	virtual void getSelectedUUIDs(std::vector<LLUUID>& selected_uuids) const;
+	virtual void getSelectedUUIDs(uuid_vec_t& selected_uuids) const;
 
 	/** Get the top selected item */
 	virtual LLPanel* getSelectedItem() const;
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index 77caaaa425..bf0866a655 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -957,14 +957,14 @@ void LLScrollListCtrl::mouseOverHighlightNthItem(S32 target_index)
 	}
 }
 
-S32	LLScrollListCtrl::selectMultiple( std::vector<LLUUID> ids )
+S32	LLScrollListCtrl::selectMultiple( uuid_vec_t ids )
 {
 	item_list::iterator iter;
 	S32 count = 0;
 	for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
 	{
 		LLScrollListItem* item = *iter;
-		std::vector<LLUUID>::iterator iditr;
+		uuid_vec_t::iterator iditr;
 		for(iditr = ids.begin(); iditr != ids.end(); ++iditr)
 		{
 			if (item->getEnabled() && (item->getUUID() == (*iditr)))
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index ebdc82115f..1f0ef585db 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -379,7 +379,7 @@ public:
 	BOOL			getSortAscending() { return mSortColumns.empty() ? TRUE : mSortColumns.back().second; }
 	BOOL			hasSortOrder() const;
 
-	S32		selectMultiple( std::vector<LLUUID> ids );
+	S32		selectMultiple( uuid_vec_t ids );
 	// conceptually const, but mutates mItemList
 	void			updateSort() const;
 	// sorts a list without affecting the permanent sort order (so further list insertions can be unsorted, for example)
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 7aed3c1fc8..1fb4cff31a 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -118,9 +118,8 @@ protected:
 	void importedFolderDone(void);
 	void contentsDone(void);
 	enum ELibraryOutfitFetchStep mCurrFetchStep;
-	typedef std::vector<LLUUID> clothing_folder_vec_t;
-	clothing_folder_vec_t mLibraryClothingFolders;
-	clothing_folder_vec_t mImportedClothingFolders;
+	uuid_vec_t mLibraryClothingFolders;
+	uuid_vec_t mImportedClothingFolders;
 	bool mOutfitsPopulated;
 	LLUUID mClothingID;
 	LLUUID mLibraryClothingID;
@@ -1023,7 +1022,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 		
 		// Get the complete information on the items in the inventory and set up an observer
 		// that will trigger when the complete information is fetched.
-		LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+		uuid_vec_t folders;
 		folders.push_back(current_outfit_id);
 		outfit->fetchDescendents(folders);
 		if(outfit->isEverythingComplete())
@@ -2179,7 +2178,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
 	
 	// Get the complete information on the items in the inventory and 
 	// setup an observer that will wait for that to happen.
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
 
 	folders.push_back(outfits->mMyOutfitsID);
@@ -2270,7 +2269,7 @@ void LLLibraryOutfitsFetch::folderDone(void)
 	mCompleteFolders.clear();
 	
 	// Get the complete information on the items in the inventory.
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(mClothingID);
 	folders.push_back(mLibraryClothingID);
 	fetchDescendents(folders);
@@ -2284,7 +2283,7 @@ void LLLibraryOutfitsFetch::outfitsDone(void)
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	
 	// Collect the contents of the Library's Clothing folder
 	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
@@ -2374,7 +2373,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 													   LLFolderType::FT_NONE,
 													   mImportedClothingName);
 	// Copy each folder from library into clothing unless it already exists.
-	for (clothing_folder_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
+	for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
 		 iter != mLibraryClothingFolders.end();
 		 ++iter)
 	{
@@ -2415,7 +2414,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 void LLLibraryOutfitsFetch::importedFolderFetch(void)
 {
 	// Fetch the contents of the Imported Clothing Folder
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(mImportedClothingID);
 	
 	mCompleteFolders.clear();
@@ -2431,7 +2430,7 @@ void LLLibraryOutfitsFetch::importedFolderDone(void)
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	
 	// Collect the contents of the Imported Clothing folder
 	gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, 
@@ -2461,7 +2460,7 @@ void LLLibraryOutfitsFetch::contentsDone(void)
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	
-	for (clothing_folder_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
+	for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
 		 folder_iter != mImportedClothingFolders.end();
 		 ++folder_iter)
 	{
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index eb0a602e0e..80d24f75b9 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1313,7 +1313,7 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
 	// the inventory, and set up an observer that will wait for that to
 	// happen.
 	LLOutfitFetch* outfit_fetcher = new LLOutfitFetch(copy, append);
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(category->getUUID());
 	outfit_fetcher->fetchDescendents(folders);
 	//inc_busy_count();
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 199ca80658..2d6a0a10ed 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -324,7 +324,7 @@ template <class T>
 void callAfterCategoryFetch(const LLUUID& cat_id, T callable)
 {
 	CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable);
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(cat_id);
 	stage1->fetchDescendents(folders);
 	if (stage1->isEverythingComplete())
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index e6666c7f83..4075ad8ee2 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -113,13 +113,13 @@ void LLAvatarActions::removeFriendDialog(const LLUUID& id)
 	if (id.isNull())
 		return;
 
-	std::vector<LLUUID> ids;
+	uuid_vec_t ids;
 	ids.push_back(id);
 	removeFriendsDialog(ids);
 }
 
 // static
-void LLAvatarActions::removeFriendsDialog(const std::vector<LLUUID>& ids)
+void LLAvatarActions::removeFriendsDialog(const uuid_vec_t& ids)
 {
 	if(ids.size() == 0)
 		return;
@@ -144,7 +144,7 @@ void LLAvatarActions::removeFriendsDialog(const std::vector<LLUUID>& ids)
 	}
 
 	LLSD payload;
-	for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		payload["ids"].append(*it);
 	}
@@ -167,7 +167,7 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee)
 }
 
 // static
-void LLAvatarActions::offerTeleport(const std::vector<LLUUID>& ids) 
+void LLAvatarActions::offerTeleport(const uuid_vec_t& ids) 
 {
 	if (ids.size() == 0)
 		return;
@@ -228,7 +228,7 @@ void LLAvatarActions::startCall(const LLUUID& id)
 }
 
 // static
-void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids)
+void LLAvatarActions::startAdhocCall(const uuid_vec_t& ids)
 {
 	if (ids.size() == 0)
 	{
@@ -237,7 +237,7 @@ void LLAvatarActions::startAdhocCall(const std::vector<LLUUID>& ids)
 
 	// convert vector into LLDynamicArray for addSession
 	LLDynamicArray<LLUUID> id_array;
-	for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		id_array.push_back(*it);
 	}
@@ -278,11 +278,11 @@ bool LLAvatarActions::canCall()
 }
 
 // static
-void LLAvatarActions::startConference(const std::vector<LLUUID>& ids)
+void LLAvatarActions::startConference(const uuid_vec_t& ids)
 {
 	// *HACK: Copy into dynamic array
 	LLDynamicArray<LLUUID> id_array;
-	for (std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		id_array.push_back(*it);
 	}
@@ -499,7 +499,7 @@ bool LLAvatarActions::handlePay(const LLSD& notification, const LLSD& response,
 // static
 void LLAvatarActions::callback_invite_to_group(LLUUID group_id, LLUUID id)
 {
-	std::vector<LLUUID> agent_ids;
+	uuid_vec_t agent_ids;
 	agent_ids.push_back(id);
 	
 	LLFloaterGroupInvite::showForGroup(group_id, &agent_ids);
diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h
index a7f3acad4f..c573144a33 100644
--- a/indra/newview/llavataractions.h
+++ b/indra/newview/llavataractions.h
@@ -60,13 +60,13 @@ public:
 	 * Show a friend removal dialog.
 	 */
 	static void removeFriendDialog(const LLUUID& id);
-	static void removeFriendsDialog(const std::vector<LLUUID>& ids);
+	static void removeFriendsDialog(const uuid_vec_t& ids);
 	
 	/**
 	 * Show teleport offer dialog.
 	 */
 	static void offerTeleport(const LLUUID& invitee);
-	static void offerTeleport(const std::vector<LLUUID>& ids);
+	static void offerTeleport(const uuid_vec_t& ids);
 
 	/**
 	 * Start instant messaging session.
@@ -86,12 +86,12 @@ public:
 	/**
 	 * Start an ad-hoc conference voice call with multiple users
 	 */
-	static void startAdhocCall(const std::vector<LLUUID>& ids);
+	static void startAdhocCall(const uuid_vec_t& ids);
 
 	/**
 	 * Start conference chat with the given avatars.
 	 */
-	static void startConference(const std::vector<LLUUID>& ids);
+	static void startConference(const uuid_vec_t& ids);
 
 	/**
 	 * Show avatar profile.
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 45c540b3a3..e8abdd32ec 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -204,17 +204,17 @@ void LLAvatarList::refresh()
 	bool have_filter		= !mNameFilter.empty();
 
 	// Save selection.	
-	std::vector<LLUUID> selected_ids;
+	uuid_vec_t selected_ids;
 	getSelectedUUIDs(selected_ids);
 	LLUUID current_id = getSelectedUUID();
 
 	// Determine what to add and what to remove.
-	std::vector<LLUUID> added, removed;
+	uuid_vec_t added, removed;
 	LLAvatarList::computeDifference(getIDs(), added, removed);
 
 	// Handle added items.
 	unsigned nadded = 0;
-	for (std::vector<LLUUID>::const_iterator it=added.begin(); it != added.end(); it++)
+	for (uuid_vec_t::const_iterator it=added.begin(); it != added.end(); it++)
 	{
 		std::string name;
 		const LLUUID& buddy_id = *it;
@@ -236,7 +236,7 @@ void LLAvatarList::refresh()
 	}
 
 	// Handle removed items.
-	for (std::vector<LLUUID>::const_iterator it=removed.begin(); it != removed.end(); it++)
+	for (uuid_vec_t::const_iterator it=removed.begin(); it != removed.end(); it++)
 	{
 		removeItemByUUID(*it);
 		modified = true;
@@ -358,7 +358,7 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	BOOL handled = LLUICtrl::handleRightMouseDown(x, y, mask);
 	if ( mContextMenu )
 	{
-		std::vector<LLUUID> selected_uuids;
+		uuid_vec_t selected_uuids;
 		getSelectedUUIDs(selected_uuids);
 		mContextMenu->show(this, selected_uuids, x, y);
 	}
@@ -366,12 +366,12 @@ BOOL LLAvatarList::handleRightMouseDown(S32 x, S32 y, MASK mask)
 }
 
 void LLAvatarList::computeDifference(
-	const std::vector<LLUUID>& vnew_unsorted,
-	std::vector<LLUUID>& vadded,
-	std::vector<LLUUID>& vremoved)
+	const uuid_vec_t& vnew_unsorted,
+	uuid_vec_t& vadded,
+	uuid_vec_t& vremoved)
 {
-	std::vector<LLUUID> vcur;
-	std::vector<LLUUID> vnew = vnew_unsorted;
+	uuid_vec_t vcur;
+	uuid_vec_t vnew = vnew_unsorted;
 
 	// Convert LLSDs to LLUUIDs.
 	{
@@ -385,7 +385,7 @@ void LLAvatarList::computeDifference(
 	std::sort(vcur.begin(), vcur.end());
 	std::sort(vnew.begin(), vnew.end());
 
-	std::vector<LLUUID>::iterator it;
+	uuid_vec_t::iterator it;
 	size_t maxsize = llmax(vcur.size(), vnew.size());
 	vadded.resize(maxsize);
 	vremoved.resize(maxsize);
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 00c72f1f9d..c3f79dcb3a 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -53,7 +53,7 @@ class LLAvatarList : public LLFlatListView
 {
 	LOG_CLASS(LLAvatarList);
 public:
-	typedef std::vector<LLUUID> uuid_vector_t;
+	typedef uuid_vec_t uuid_vector_t;
 
 	struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> 
 	{
@@ -101,9 +101,9 @@ protected:
 
 	void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
 	void computeDifference(
-		const std::vector<LLUUID>& vnew,
-		std::vector<LLUUID>& vadded,
-		std::vector<LLUUID>& vremoved);
+		const uuid_vec_t& vnew,
+		uuid_vec_t& vadded,
+		uuid_vec_t& vremoved);
 	void updateLastInteractionTimes();
 	void onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
 
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index cecb64add7..2db6484a30 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -70,7 +70,7 @@ public:
 	class ContextMenu
 	{
 	public:
-		virtual void show(LLView* spawning_view, const std::vector<LLUUID>& selected_uuids, S32 x, S32 y) = 0;
+		virtual void show(LLView* spawning_view, const uuid_vec_t& selected_uuids, S32 x, S32 y) = 0;
 	};
 
 	/**
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index c8552de66a..4ea3c61ab2 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -54,7 +54,7 @@
 #include "llvoicechannel.h"
 #include "llviewerparcelmgr.h"
 
-static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids);
+static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids);
 void reshape_floater(LLCallFloater* floater, S32 delta_height);
 
 class LLNonAvatarCaller : public LLAvatarListItem
@@ -213,9 +213,9 @@ void LLCallFloater::onChange()
 	updateParticipantsVoiceState();
 
 	// Add newly joined participants.
-	std::vector<LLUUID> speakers_uuids;
+	uuid_vec_t speakers_uuids;
 	get_voice_participants_uuids(speakers_uuids);
-	for (std::vector<LLUUID>::const_iterator it = speakers_uuids.begin(); it != speakers_uuids.end(); it++)
+	for (uuid_vec_t::const_iterator it = speakers_uuids.begin(); it != speakers_uuids.end(); it++)
 	{
 		mParticipants->addAvatarIDExceptAgent(*it);
 	}
@@ -469,7 +469,7 @@ void LLCallFloater::updateAgentModeratorState()
 	mAgentPanel->childSetValue("user_text", name);
 }
 
-static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids)
+static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
 {
 	// Get a list of participants from VoiceClient
 	LLVoiceClient::participantMap *voice_map = gVoiceClient->getParticipantList();
@@ -494,7 +494,7 @@ void LLCallFloater::initParticipantsVoiceState()
 		it_end = items.end();
 
 
-	std::vector<LLUUID> speakers_uuids;
+	uuid_vec_t speakers_uuids;
 	get_voice_participants_uuids(speakers_uuids);
 
 	for(; it != it_end; ++it)
@@ -505,7 +505,7 @@ void LLCallFloater::initParticipantsVoiceState()
 		
 		LLUUID speaker_id = item->getAvatarId();
 
-		std::vector<LLUUID>::const_iterator speaker_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), speaker_id);
+		uuid_vec_t::const_iterator speaker_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), speaker_id);
 
 		// If an avatarID assigned to a panel is found in a speakers list
 		// obtained from VoiceClient we assign the JOINED status to the owner
@@ -534,10 +534,10 @@ void LLCallFloater::initParticipantsVoiceState()
 
 void LLCallFloater::updateParticipantsVoiceState()
 {
-	std::vector<LLUUID> speakers_list;
+	uuid_vec_t speakers_list;
 
 	// Get a list of participants from VoiceClient
-	std::vector<LLUUID> speakers_uuids;
+	uuid_vec_t speakers_uuids;
 	get_voice_participants_uuids(speakers_uuids);
 
 	// Updating the status for each participant already in list.
@@ -555,7 +555,7 @@ void LLCallFloater::updateParticipantsVoiceState()
 		const LLUUID participant_id = item->getAvatarId();
 		bool found = false;
 
-		std::vector<LLUUID>::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
+		uuid_vec_t::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
 
 		lldebugs << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << llendl;
 
@@ -695,7 +695,7 @@ bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id)
 	case  VC_LOCAL_CHAT:
 		{
 			// A nearby chat speaker is considered valid it it's known to LLVoiceClient (i.e. has enabled voice).
-			std::vector<LLUUID> speakers;
+			uuid_vec_t speakers;
 			get_voice_participants_uuids(speakers);
 			is_valid = std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end();
 		}
diff --git a/indra/newview/llfloateravatarpicker.cpp b/indra/newview/llfloateravatarpicker.cpp
index a0b2de85f0..2cb0cdf368 100644
--- a/indra/newview/llfloateravatarpicker.cpp
+++ b/indra/newview/llfloateravatarpicker.cpp
@@ -157,7 +157,7 @@ void LLFloaterAvatarPicker::onBtnFind()
 	find();
 }
 
-static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, std::vector<LLUUID>& avatar_ids)
+static void getSelectedAvatarData(const LLScrollListCtrl* from, std::vector<std::string>& avatar_names, uuid_vec_t& avatar_ids)
 {
 	std::vector<LLScrollListItem*> items = from->getAllSelected();
 	for (std::vector<LLScrollListItem*>::iterator iter = items.begin(); iter != items.end(); ++iter)
@@ -203,7 +203,7 @@ void LLFloaterAvatarPicker::onBtnSelect()
 		if(list)
 		{
 			std::vector<std::string>	avatar_names;
-			std::vector<LLUUID>			avatar_ids;
+			uuid_vec_t			avatar_ids;
 			getSelectedAvatarData(list, avatar_names, avatar_ids);
 			mSelectionCallback(avatar_names, avatar_ids);
 		}
@@ -247,7 +247,7 @@ void LLFloaterAvatarPicker::populateNearMe()
 	LLScrollListCtrl* near_me_scroller = getChild<LLScrollListCtrl>("NearMe");
 	near_me_scroller->deleteAllItems();
 
-	std::vector<LLUUID> avatar_ids;
+	uuid_vec_t avatar_ids;
 	LLWorld::getInstance()->getAvatars(&avatar_ids, NULL, gAgent.getPositionGlobal(), gSavedSettings.getF32("NearMeRange"));
 	for(U32 i=0; i<avatar_ids.size(); i++)
 	{
@@ -499,7 +499,7 @@ bool LLFloaterAvatarPicker::isSelectBtnEnabled()
 
 		if(list)
 		{
-			std::vector<LLUUID> avatar_ids;
+			uuid_vec_t avatar_ids;
 			std::vector<std::string> avatar_names;
 			getSelectedAvatarData(list, avatar_names, avatar_ids);
 			return mOkButtonValidateSignal(avatar_ids);
diff --git a/indra/newview/llfloateravatarpicker.h b/indra/newview/llfloateravatarpicker.h
index e35466cec8..860f3930ef 100644
--- a/indra/newview/llfloateravatarpicker.h
+++ b/indra/newview/llfloateravatarpicker.h
@@ -40,11 +40,11 @@
 class LLFloaterAvatarPicker : public LLFloater
 {
 public:
-	typedef boost::signals2::signal<bool(const std::vector<LLUUID>&), boost_boolean_combiner> validate_signal_t;
+	typedef boost::signals2::signal<bool(const uuid_vec_t&), boost_boolean_combiner> validate_signal_t;
 	typedef validate_signal_t::slot_type validate_callback_t;
 
 	// The callback function will be called with an avatar name and UUID.
-	typedef boost::function<void (const std::vector<std::string>&, const std::vector<LLUUID>&)> select_callback_t;
+	typedef boost::function<void (const std::vector<std::string>&, const uuid_vec_t&)> select_callback_t;
 	// Call this to select an avatar.	
 	static LLFloaterAvatarPicker* show(select_callback_t callback, 
 									   BOOL allow_multiple = FALSE,
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 0f80d55b67..bf03412696 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -125,7 +125,7 @@ void LLFloaterGesture::done()
 		// we load only gesture folder without childred.
 		LLInventoryModel::cat_array_t* categories;
 		LLInventoryModel::item_array_t* items;
-		LLInventoryFetchDescendentsObserver::folder_ref_t unloaded_folders;
+		uuid_vec_t unloaded_folders;
 		LL_DEBUGS("Gesture")<< "Get subdirs of Gesture Folder...." << LL_ENDL;
 		gInventory.getDirectDescendentsOf(mGestureFolderID, categories, items);
 		if (categories->empty())
@@ -197,7 +197,7 @@ BOOL LLFloaterGesture::postBuild()
 	setDefaultBtn("play_btn");
 	mGestureFolderID = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE, false);
 
-	folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(mGestureFolderID);
 	//perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
 	gInventory.addObserver(this);
@@ -246,7 +246,7 @@ void LLFloaterGesture::refreshAll()
 void LLFloaterGesture::buildGestureList()
 {
 	S32 scroll_pos = mGestureList->getScrollPos();
-	std::vector<LLUUID> selected_items;
+	uuid_vec_t selected_items;
 	getSelectedIds(selected_items);
 	LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
 	mGestureList->deleteAllItems();
@@ -278,7 +278,7 @@ void LLFloaterGesture::buildGestureList()
 
 	// attempt to preserve scroll position through re-builds
 	// since we do re-build whenever something gets dirty
-	for(std::vector<LLUUID>::iterator it = selected_items.begin(); it != selected_items.end(); it++)
+	for(uuid_vec_t::iterator it = selected_items.begin(); it != selected_items.end(); it++)
 	{
 		mGestureList->selectByID(*it);
 	}
@@ -377,7 +377,7 @@ void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gestur
 	}
 }
 
-void LLFloaterGesture::getSelectedIds(std::vector<LLUUID>& ids)
+void LLFloaterGesture::getSelectedIds(uuid_vec_t& ids)
 {
 	std::vector<LLScrollListItem*> items = mGestureList->getAllSelected();
 	for(std::vector<LLScrollListItem*>::const_iterator it = items.begin(); it != items.end(); it++)
@@ -451,13 +451,13 @@ void LLFloaterGesture::onClickNew()
 
 void LLFloaterGesture::onActivateBtnClick()
 {
-	std::vector<LLUUID> ids;
+	uuid_vec_t ids;
 	getSelectedIds(ids);
 	if(ids.empty())
 		return;
 
 	LLGestureMgr* gm = LLGestureMgr::getInstance();
-	std::vector<LLUUID>::const_iterator it = ids.begin();
+	uuid_vec_t::const_iterator it = ids.begin();
 	BOOL first_gesture_state = gm->isGestureActive(*it);
 	BOOL is_mixed = FALSE;
 	while( ++it != ids.end() )
@@ -468,7 +468,7 @@ void LLFloaterGesture::onActivateBtnClick()
 			break;
 		}
 	}
-	for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
 	{
 		if(is_mixed)
 		{
@@ -494,11 +494,11 @@ void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 	// since we select this comman inventory item had  already arrived .
 	if("copy_gesture" == command_name)
 	{
-		std::vector<LLUUID> ids;
+		uuid_vec_t ids;
 		getSelectedIds(ids);
 		// make sure that clopboard is empty
 		LLInventoryClipboard::instance().reset();
-		for(std::vector<LLUUID>::iterator it = ids.begin(); it != ids.end(); it++)
+		for(uuid_vec_t::iterator it = ids.begin(); it != ids.end(); it++)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
 			if(item  && item->getInventoryType() == LLInventoryType::IT_GESTURE)
@@ -572,14 +572,14 @@ void LLFloaterGesture::onCommitList()
 
 void LLFloaterGesture::onDeleteSelected()
 {
-	std::vector<LLUUID> ids;
+	uuid_vec_t ids;
 	getSelectedIds(ids);
 	if(ids.empty())
 		return;
 
 	const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	LLGestureMgr* gm = LLGestureMgr::getInstance();
-	for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
 	{
 		const LLUUID& selected_item = *it;
 		LLInventoryItem* inv_item = gInventory.getItem(selected_item);
@@ -610,10 +610,10 @@ void LLFloaterGesture::onDeleteSelected()
 
 void LLFloaterGesture::addToCurrentOutFit()
 {
-	std::vector<LLUUID> ids;
+	uuid_vec_t ids;
 	getSelectedIds(ids);
 	LLAppearanceMgr* am = LLAppearanceMgr::getInstance();
-	for(std::vector<LLUUID>::const_iterator it = ids.begin(); it != ids.end(); it++)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); it++)
 	{
 		am->addCOFItemLink(*it);
 	}
diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h
index 629d77b949..1676542c77 100644
--- a/indra/newview/llfloatergesture.h
+++ b/indra/newview/llfloatergesture.h
@@ -85,7 +85,7 @@ private:
 	 * Therefore we have to copy these items to avoid viewer crash.
 	 * @see LLFloaterGesture::onActivateBtnClick
 	 */
-	void getSelectedIds(std::vector<LLUUID>& ids);
+	void getSelectedIds(uuid_vec_t& ids);
 	bool isActionEnabled(const LLSD& command);
 	/**
 	 * @brief Activation rules:
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index eb56f387cd..fbd516ba7a 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -1191,7 +1191,7 @@ void LLPanelObjectTools::onClickSetBySelection(void* data)
 	panelp->childSetValue("target_avatar_name", name);
 }
 
-void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelObjectTools::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (ids.empty() || names.empty()) return;
 	mTargetAvatar = ids[0];
diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h
index ef5ce02749..4e97a1058e 100644
--- a/indra/newview/llfloatergodtools.h
+++ b/indra/newview/llfloatergodtools.h
@@ -234,7 +234,7 @@ public:
 	void onChangeAnything();
 	void onApplyChanges();
 	void onClickSet();
-	void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	void onClickDeletePublicOwnedBy();
 	void onClickDeleteAllScriptedOwnedBy();
 	void onClickDeleteAllOwnedBy();
diff --git a/indra/newview/llfloatergroupinvite.cpp b/indra/newview/llfloatergroupinvite.cpp
index bf484c6343..5d1864b4c8 100644
--- a/indra/newview/llfloatergroupinvite.cpp
+++ b/indra/newview/llfloatergroupinvite.cpp
@@ -112,7 +112,7 @@ LLFloaterGroupInvite::~LLFloaterGroupInvite()
 }
 
 // static
-void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, std::vector<LLUUID> *agent_ids)
+void LLFloaterGroupInvite::showForGroup(const LLUUID& group_id, uuid_vec_t *agent_ids)
 {
 	const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
 	S32 floater_header_size = floater_params.header_height;
diff --git a/indra/newview/llfloatergroupinvite.h b/indra/newview/llfloatergroupinvite.h
index b3f5d75ac1..68943724df 100644
--- a/indra/newview/llfloatergroupinvite.h
+++ b/indra/newview/llfloatergroupinvite.h
@@ -43,7 +43,7 @@ class LLFloaterGroupInvite
 public:
 	virtual ~LLFloaterGroupInvite();
 
-	static void showForGroup(const LLUUID &group_id, std::vector<LLUUID> *agent_ids = NULL);
+	static void showForGroup(const LLUUID &group_id, uuid_vec_t *agent_ids = NULL);
 
 protected:
 	LLFloaterGroupInvite(const LLUUID& group_id = LLUUID::null);
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 65003d9b5c..6467ee13b0 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -2774,7 +2774,7 @@ void LLPanelLandAccess::onClickAddAccess()
 	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLPanelLandAccess::callbackAvatarCBAccess, this, _1,_2)) );
 }
 
-void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelLandAccess::callbackAvatarCBAccess(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (!names.empty() && !ids.empty())
 	{
@@ -2819,7 +2819,7 @@ void LLPanelLandAccess::onClickAddBanned()
 }
 
 // static
-void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelLandAccess::callbackAvatarCBBanned(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (!names.empty() && !ids.empty())
 	{
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index a4785e8f5b..fe80766a74 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -167,7 +167,7 @@ public:
 	static void onClickSet(void* data);
 	static void onClickClear(void* data);
 	static void onClickShow(void* data);
-	static void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
+	static void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data);
 	static void finalizeAvatarPick(void* data);
 	static void callbackHighlightTransferable(S32 option, void* userdata);
 	static void onClickStartAuction(void*);
@@ -374,8 +374,8 @@ public:
 	
 	void onClickAddAccess();
 	void onClickAddBanned();
-	void callbackAvatarCBBanned(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
-	void callbackAvatarCBAccess(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackAvatarCBBanned(const std::vector<std::string>& names, const uuid_vec_t& ids);
+	void callbackAvatarCBAccess(const std::vector<std::string>& names, const uuid_vec_t& ids);
 
 protected:
 	LLNameListCtrl*		mListAccess;
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index d54736e942..3758cbe74f 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -610,7 +610,7 @@ void LLPanelRegionGeneralInfo::onClickKick()
 	parent_floater->addDependentFloater(child_floater);
 }
 
-void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelRegionGeneralInfo::onKickCommit(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (names.empty() || ids.empty()) return;
 	if(ids[0].notNull())
@@ -848,7 +848,7 @@ void LLPanelRegionDebugInfo::onClickChooseAvatar()
 }
 
 
-void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelRegionDebugInfo::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (ids.empty() || names.empty()) return;
 	mTargetAvatar = ids[0];
@@ -1531,7 +1531,7 @@ void LLPanelEstateInfo::onClickKickUser()
 	parent_floater->addDependentFloater(child_floater);
 }
 
-void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelEstateInfo::onKickUserCommit(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (names.empty() || ids.empty()) return;
 	
@@ -1616,7 +1616,6 @@ bool LLPanelEstateInfo::isLindenEstate()
 	return (estate_id <= ESTATE_LAST_LINDEN);
 }
 
-typedef std::vector<LLUUID> AgentOrGroupIDsVector;
 struct LLEstateAccessChangeInfo
 {
 	LLEstateAccessChangeInfo(const LLSD& sd)
@@ -1637,7 +1636,7 @@ struct LLEstateAccessChangeInfo
 		LLSD sd;
 		sd["name"] = mDialogName;
 		sd["operation"] = (S32)mOperationFlag;
-		for (AgentOrGroupIDsVector::const_iterator it = mAgentOrGroupIDs.begin();
+		for (uuid_vec_t::const_iterator it = mAgentOrGroupIDs.begin();
 			it != mAgentOrGroupIDs.end();
 			++it)
 		{
@@ -1648,7 +1647,7 @@ struct LLEstateAccessChangeInfo
 
 	U32 mOperationFlag;	// ESTATE_ACCESS_BANNED_AGENT_ADD, _REMOVE, etc.
 	std::string mDialogName;
-	AgentOrGroupIDsVector mAgentOrGroupIDs; // List of agent IDs to apply to this change
+	uuid_vec_t mAgentOrGroupIDs; // List of agent IDs to apply to this change
 };
 
 // Special case callback for groups, since it has different callback format than names
@@ -1716,7 +1715,7 @@ bool LLPanelEstateInfo::accessAddCore2(const LLSD& notification, const LLSD& res
 }
 
 // static
-void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data)
+void LLPanelEstateInfo::accessAddCore3(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data)
 {
 	LLEstateAccessChangeInfo* change_info = (LLEstateAccessChangeInfo*)data;
 	if (!change_info) return;
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index 8d315bdb78..482ebb3303 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -168,7 +168,7 @@ public:
 protected:
 	virtual BOOL sendUpdate();
 	void onClickKick();
-	void onKickCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void onKickCommit(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	static void onClickKickAll(void* userdata);
 	bool onKickAllCommit(const LLSD& notification, const LLSD& response);
 	static void onClickMessage(void* userdata);
@@ -193,7 +193,7 @@ protected:
 	virtual BOOL sendUpdate();
 
 	void onClickChooseAvatar();
-	void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	static void onClickReturn(void *);
 	bool callbackReturn(const LLSD& notification, const LLSD& response);
 	static void onClickTopColliders(void*);
@@ -284,7 +284,7 @@ public:
 	// Core methods for all above add/remove button clicks
 	static void accessAddCore(U32 operation_flag, const std::string& dialog_name);
 	static bool accessAddCore2(const LLSD& notification, const LLSD& response);
-	static void accessAddCore3(const std::vector<std::string>& names, const std::vector<LLUUID>& ids, void* data);
+	static void accessAddCore3(const std::vector<std::string>& names, const uuid_vec_t& ids, void* data);
 
 	static void accessRemoveCore(U32 operation_flag, const std::string& dialog_name, const std::string& list_ctrl_name);
 	static bool accessRemoveCore2(const LLSD& notification, const LLSD& response);
@@ -296,7 +296,7 @@ public:
 	// Send the actual EstateOwnerRequest "estateaccessdelta" message
 	static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
 
-	void onKickUserCommit(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void onKickUserCommit(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	static void onClickMessageEstate(void* data);
 	bool onMessageCommit(const LLSD& notification, const LLSD& response);
 	
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 42a7eeff26..b42b34835d 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -308,7 +308,7 @@ void LLFloaterReporter::onClickSelectAbuser()
 	gFloaterView->getParentFloater(this)->addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterReporter::callbackAvatarID, this, _1, _2), FALSE, TRUE ));
 }
 
-void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLFloaterReporter::callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (ids.empty() || names.empty()) return;
 
diff --git a/indra/newview/llfloaterreporter.h b/indra/newview/llfloaterreporter.h
index 7c6473f975..23784b7650 100644
--- a/indra/newview/llfloaterreporter.h
+++ b/indra/newview/llfloaterreporter.h
@@ -123,7 +123,7 @@ private:
 	void setPosBox(const LLVector3d &pos);
 	void enableControls(BOOL own_avatar);
 	void getObjectInfo(const LLUUID& object_id);
-	void callbackAvatarID(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackAvatarID(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	void setFromAvatar(const LLUUID& avatar_id, const std::string& avatar_name = LLStringUtil::null);
 
 private:
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index daba3d8460..4792d761d8 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -644,7 +644,7 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
 	std::string msg_parcels = LLTrans::getString("ScriptLimitsParcelsOwned", args_parcels);
 	childSetValue("parcels_listed", LLSD(msg_parcels));
 
-	std::vector<LLUUID> names_requested;
+	uuid_vec_t names_requested;
 
 	// This makes the assumption that all objects will have the same set
 	// of attributes, ie they will all have, or none will have locations
diff --git a/indra/newview/llfloatersellland.cpp b/indra/newview/llfloatersellland.cpp
index eae6121e79..980b456497 100644
--- a/indra/newview/llfloatersellland.cpp
+++ b/indra/newview/llfloatersellland.cpp
@@ -96,7 +96,7 @@ private:
 	static void doShowObjects(void *userdata);
 	static bool callbackHighlightTransferable(const LLSD& notification, const LLSD& response);
 
-	void callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids);
 
 public:
 	virtual BOOL postBuild();
@@ -391,7 +391,7 @@ void LLFloaterSellLandUI::doSelectAgent()
 	addDependentFloater(LLFloaterAvatarPicker::show(boost::bind(&LLFloaterSellLandUI::callbackAvatarPick, this, _1, _2), FALSE, TRUE));
 }
 
-void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLFloaterSellLandUI::callbackAvatarPick(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {	
 	LLParcel* parcel = mParcelSelection->getParcel();
 
diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp
index 8ab050beaa..84ea353dab 100644
--- a/indra/newview/llfloatertopobjects.cpp
+++ b/indra/newview/llfloatertopobjects.cpp
@@ -315,7 +315,7 @@ void LLFloaterTopObjects::doToObjects(int action, bool all)
 	LLCtrlListInterface *list = childGetListInterface("objects_list");
 	if (!list || list->getItemCount() == 0) return;
 
-	std::vector<LLUUID>::iterator id_itor;
+	uuid_vec_t::iterator id_itor;
 
 	bool start_message = true;
 
diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h
index ee3c5d3cce..8fb89a3cc5 100644
--- a/indra/newview/llfloatertopobjects.h
+++ b/indra/newview/llfloatertopobjects.h
@@ -89,7 +89,7 @@ private:
 	std::string mMethod;
 
 	LLSD mObjectListData;
-	std::vector<LLUUID> mObjectListIDs;
+	uuid_vec_t mObjectListIDs;
 
 	U32 mCurrentMode;
 	U32 mFlags;
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index f74d912842..149bbe805d 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -865,7 +865,7 @@ BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const
 BOOL LLFolderView::startDrag(LLToolDragAndDrop::ESource source)
 {
 	std::vector<EDragAndDropType> types;
-	std::vector<LLUUID> cargo_ids;
+	uuid_vec_t cargo_ids;
 	selected_items_t::iterator item_it;
 	BOOL can_drag = TRUE;
 	if (!mSelectedItems.empty())
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 18f81fe506..1a06bef6cb 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -322,7 +322,7 @@ void LLFriendCardsManager::collectFriendsLists(folderid_buddies_map_t& folderBud
 		if (NULL == items)
 			continue;
 
-		std::vector<LLUUID> buddyUUIDs;
+		uuid_vec_t buddyUUIDs;
 		for (itBuddy = items->begin(); itBuddy != items->end(); ++itBuddy)
 		{
 			buddyUUIDs.push_back((*itBuddy)->getCreatorUUID());
@@ -409,7 +409,7 @@ void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_i
 	// This instance will be deleted in LLInitialFriendCardsFetch::done().
 	LLInitialFriendCardsFetch* fetch = new LLInitialFriendCardsFetch(cb);
 
-	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	uuid_vec_t folders;
 	folders.push_back(folder_id);
 
 	fetch->fetchDescendents(folders);
diff --git a/indra/newview/llfriendcard.h b/indra/newview/llfriendcard.h
index 1cda52c1d7..638a1eca84 100644
--- a/indra/newview/llfriendcard.h
+++ b/indra/newview/llfriendcard.h
@@ -49,7 +49,7 @@ class LLFriendCardsManager
 	friend class CreateFriendCardCallback;
 
 public:
-	typedef std::map<LLUUID, std::vector<LLUUID> > folderid_buddies_map_t;
+	typedef std::map<LLUUID, uuid_vec_t > folderid_buddies_map_t;
 
 	// LLFriendObserver implementation
 	void changed(U32 mask)
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index 561ca68f4a..fbacbd704f 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -347,7 +347,7 @@ void LLGestureMgr::deactivateGesture(const LLUUID& item_id)
 void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& in_item_id)
 {
 	const LLUUID& base_in_item_id = get_linked_uuid(in_item_id);
-	std::vector<LLUUID> gest_item_ids;
+	uuid_vec_t gest_item_ids;
 
 	// Deactivate all gestures that match
 	item_map_t::iterator it;
@@ -386,7 +386,7 @@ void LLGestureMgr::deactivateSimilarGestures(LLMultiGesture* in, const LLUUID& i
 	// Inform database of the change
 	LLMessageSystem* msg = gMessageSystem;
 	BOOL start_message = TRUE;
-	std::vector<LLUUID>::const_iterator vit = gest_item_ids.begin();
+	uuid_vec_t::const_iterator vit = gest_item_ids.begin();
 	while (vit != gest_item_ids.end())
 	{
 		if (start_message)
@@ -1215,7 +1215,7 @@ BOOL LLGestureMgr::matchPrefix(const std::string& in_str, std::string* out_str)
 }
 
 
-void LLGestureMgr::getItemIDs(std::vector<LLUUID>* ids)
+void LLGestureMgr::getItemIDs(uuid_vec_t* ids)
 {
 	item_map_t::const_iterator it;
 	for (it = mActive.begin(); it != mActive.end(); ++it)
diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h
index bda657679a..081ca983a9 100644
--- a/indra/newview/llgesturemgr.h
+++ b/indra/newview/llgesturemgr.h
@@ -146,7 +146,7 @@ public:
 	BOOL matchPrefix(const std::string& in_str, std::string* out_str);
 
 	// Copy item ids into the vector
-	void getItemIDs(std::vector<LLUUID>* ids);
+	void getItemIDs(uuid_vec_t* ids);
 
 protected:
 	// Handle the processing of a single gesture
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp
index 7f93a357de..996553ccf7 100644
--- a/indra/newview/llgroupmgr.cpp
+++ b/indra/newview/llgroupmgr.cpp
@@ -160,7 +160,7 @@ LLGroupRoleData::~LLGroupRoleData()
 {	
 }
 
-S32 LLGroupRoleData::getMembersInRole(std::vector<LLUUID> members,
+S32 LLGroupRoleData::getMembersInRole(uuid_vec_t members,
 									  BOOL needs_sort)
 {
 	if (mRoleID.isNull())
@@ -184,8 +184,8 @@ S32 LLGroupRoleData::getMembersInRole(std::vector<LLUUID> members,
 
 	// Return the number of members in the intersection.
 	S32 max_size = llmin( members.size(), mMemberIDs.size() );
-	std::vector<LLUUID> in_role( max_size );
-	std::vector<LLUUID>::iterator in_role_end;
+	uuid_vec_t in_role( max_size );
+	uuid_vec_t::iterator in_role_end;
 	in_role_end = std::set_intersection(mMemberIDs.begin(), mMemberIDs.end(),
 									members.begin(), members.end(),
 									in_role.begin());
@@ -200,7 +200,7 @@ void LLGroupRoleData::addMember(const LLUUID& member)
 
 bool LLGroupRoleData::removeMember(const LLUUID& member)
 {
-	std::vector<LLUUID>::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member);
+	uuid_vec_t::iterator it = std::find(mMemberIDs.begin(),mMemberIDs.end(),member);
 
 	if (it != mMemberIDs.end())
 	{
@@ -1736,7 +1736,7 @@ void LLGroupMgr::sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,
 
 //static
 void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
-									   std::vector<LLUUID>& member_ids)
+									   uuid_vec_t& member_ids)
 {
 	bool start_message = true;
 	LLMessageSystem* msg = gMessageSystem;
@@ -1746,7 +1746,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id,
 	LLGroupMgrGroupData* group_datap = LLGroupMgr::getInstance()->getGroupData(group_id);
 	if (!group_datap) return;
 
-	for (std::vector<LLUUID>::iterator it = member_ids.begin();
+	for (uuid_vec_t::iterator it = member_ids.begin();
 		 it != member_ids.end(); ++it)
 	{
 		LLUUID& ejected_member_id = (*it);
diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h
index 2c86de8b97..82df631b8c 100644
--- a/indra/newview/llgroupmgr.h
+++ b/indra/newview/llgroupmgr.h
@@ -139,8 +139,8 @@ public:
 
 	const LLUUID& getID() const { return mRoleID; }
 
-	const std::vector<LLUUID>& getRoleMembers() const { return mMemberIDs; }
-	S32 getMembersInRole(std::vector<LLUUID> members, BOOL needs_sort = TRUE);
+	const uuid_vec_t& getRoleMembers() const { return mMemberIDs; }
+	S32 getMembersInRole(uuid_vec_t members, BOOL needs_sort = TRUE);
 	S32 getTotalMembersInRole() { return mMemberIDs.size(); }
 
 	LLRoleData getRoleData() const { return mRoleData; }
@@ -150,10 +150,10 @@ public:
 	bool removeMember(const LLUUID& member);
 	void clearMembers();
 
-	const std::vector<LLUUID>::const_iterator getMembersBegin() const
+	const uuid_vec_t::const_iterator getMembersBegin() const
 	{ return mMemberIDs.begin(); }
 
-	const std::vector<LLUUID>::const_iterator getMembersEnd() const
+	const uuid_vec_t::const_iterator getMembersEnd() const
 	{ return mMemberIDs.end(); }
 
 
@@ -164,7 +164,7 @@ protected:
 	LLUUID mRoleID;
 	LLRoleData	mRoleData;
 
-	std::vector<LLUUID> mMemberIDs;
+	uuid_vec_t mMemberIDs;
 	S32	mMemberCount;
 
 private:
@@ -340,7 +340,7 @@ public:
 	static void sendGroupMemberJoin(const LLUUID& group_id);
 	static void sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID,LLUUID>& role_member_pairs);
 	static void sendGroupMemberEjects(const LLUUID& group_id,
-									  std::vector<LLUUID>& member_ids);
+									  uuid_vec_t& member_ids);
 
 	void cancelGroupRoleChanges(const LLUUID& group_id);
 
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 91f4f57e54..9c477791b3 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -922,7 +922,7 @@ BOOL LLIMFloater::dropCallingCard(LLInventoryItem* item, BOOL drop)
 	{
 		if(drop)
 		{
-			std::vector<LLUUID> ids;
+			uuid_vec_t ids;
 			ids.push_back(item->getCreatorUUID());
 			inviteToSession(ids);
 		}
@@ -955,7 +955,7 @@ BOOL LLIMFloater::dropCategory(LLInventoryCategory* category, BOOL drop)
 		}
 		else if(drop)
 		{
-			std::vector<LLUUID> ids;
+			uuid_vec_t ids;
 			ids.reserve(count);
 			for(S32 i = 0; i < count; ++i)
 			{
@@ -992,7 +992,7 @@ private:
 	LLUUID mSessionID;
 };
 
-BOOL LLIMFloater::inviteToSession(const std::vector<LLUUID>& ids)
+BOOL LLIMFloater::inviteToSession(const uuid_vec_t& ids)
 {
 	LLViewerRegion* region = gAgent.getRegion();
 	if (!region)
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index 2f034d02b8..763dd5655b 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -129,7 +129,7 @@ private:
 	BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
 
 	BOOL isInviteAllowed() const;
-	BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
+	BOOL inviteToSession(const uuid_vec_t& agent_ids);
 	
 	static void		onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
 	static void		onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 7a4febec20..a8d876e8a3 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -146,7 +146,7 @@ LLIMModel::LLIMModel()
 	addNewMsgCallback(toast_callback);
 }
 
-LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice)
+LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice)
 :	mSessionID(session_id),
 	mName(name),
 	mType(type),
@@ -423,7 +423,7 @@ LLIMModel::LLIMSession* LLIMModel::findIMSession(const LLUUID& session_id) const
 }
 
 //*TODO consider switching to using std::set instead of std::list for holding LLUUIDs across the whole code
-LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const std::vector<LLUUID>& ids)
+LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const uuid_vec_t& ids)
 {
 	S32 num = ids.size();
 	if (!num) return NULL;
@@ -440,7 +440,7 @@ LLIMModel::LLIMSession* LLIMModel::findAdHocIMSession(const std::vector<LLUUID>&
 
 		std::list<LLUUID> tmp_list(session->mInitialTargetIDs.begin(), session->mInitialTargetIDs.end());
 
-		std::vector<LLUUID>::const_iterator iter = ids.begin();
+		uuid_vec_t::const_iterator iter = ids.begin();
 		while (iter != ids.end())
 		{
 			tmp_list.remove(*iter);
@@ -571,7 +571,7 @@ void LLIMModel::testMessages()
 
 //session name should not be empty
 bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, 
-						   const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice)
+						   const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice)
 {
 	if (name.empty())
 	{
@@ -596,7 +596,7 @@ bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, co
 
 bool LLIMModel::newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, bool voice)
 {
-	std::vector<LLUUID> no_ids;
+	uuid_vec_t no_ids;
 	return newSession(session_id, name, type, other_participant_id, no_ids, voice);
 }
 
@@ -1002,7 +1002,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 		}
 		else
 		{
-			for(std::vector<LLUUID>::iterator it = session->mInitialTargetIDs.begin();
+			for(uuid_vec_t::iterator it = session->mInitialTargetIDs.begin();
 				it!=session->mInitialTargetIDs.end();++it)
 			{
 				const LLUUID id = *it;
@@ -1134,7 +1134,7 @@ private:
 bool LLIMModel::sendStartSession(
 	const LLUUID& temp_session_id,
 	const LLUUID& other_participant_id,
-	const std::vector<LLUUID>& ids,
+	const uuid_vec_t& ids,
 	EInstantMessage dialog)
 {
 	if ( dialog == IM_SESSION_GROUP_START )
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index f1693d0e17..0a23fda9d8 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -61,7 +61,7 @@ public:
 		} SType;
 
 		LLIMSession(const LLUUID& session_id, const std::string& name, 
-			const EInstantMessage& type, const LLUUID& other_participant_id, const std::vector<LLUUID>& ids, bool voice);
+			const EInstantMessage& type, const LLUUID& other_participant_id, const uuid_vec_t& ids, bool voice);
 		virtual ~LLIMSession();
 
 		void sessionInitReplyReceived(const LLUUID& new_session_id);
@@ -93,7 +93,7 @@ public:
 		EInstantMessage mType;
 		SType mSessionType;
 		LLUUID mOtherParticipantID;
-		std::vector<LLUUID> mInitialTargetIDs;
+		uuid_vec_t mInitialTargetIDs;
 		std::string mHistoryFileName;
 
 		// connection to voice channel state change signal
@@ -152,7 +152,7 @@ public:
 	 * Find an Ad-Hoc IM Session with specified participants
 	 * @return first found Ad-Hoc session or NULL if the session does not exist
 	 */
-	LLIMSession* findAdHocIMSession(const std::vector<LLUUID>& ids);
+	LLIMSession* findAdHocIMSession(const uuid_vec_t& ids);
 
 	/**
 	 * Rebind session data to a new session id.
@@ -167,7 +167,7 @@ public:
 	 * @param name session name should not be empty, will return false if empty
 	 */
 	bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type, const LLUUID& other_participant_id, 
-		const std::vector<LLUUID>& ids, bool voice = false);
+		const uuid_vec_t& ids, bool voice = false);
 
 	bool newSession(const LLUUID& session_id, const std::string& name, const EInstantMessage& type,
 		const LLUUID& other_participant_id, bool voice = false);
@@ -255,7 +255,7 @@ public:
 
 	static void sendLeaveSession(const LLUUID& session_id, const LLUUID& other_participant_id);
 	static bool sendStartSession(const LLUUID& temp_session_id, const LLUUID& other_participant_id,
-						  const std::vector<LLUUID>& ids, EInstantMessage dialog);
+						  const uuid_vec_t& ids, EInstantMessage dialog);
 	static void sendTypingState(LLUUID session_id, LLUUID other_participant_id, BOOL typing);
 	static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
 								const LLUUID& other_participant_id, EInstantMessage dialog);
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 5122f308a2..efd23c36ca 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -297,7 +297,7 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 	LLMessageSystem* msg = gMessageSystem;
 	const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 	LLViewerInventoryItem* item = NULL;
-	std::vector<LLUUID> move_ids;
+	uuid_vec_t move_ids;
 	LLInventoryModel::update_map_t update;
 	bool start_new_message = true;
 	S32 count = batch.count();
@@ -398,8 +398,8 @@ void LLInvFVBridge::removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*
 	}
 
 	// move everything.
-	std::vector<LLUUID>::iterator it = move_ids.begin();
-	std::vector<LLUUID>::iterator end = move_ids.end();
+	uuid_vec_t::iterator it = move_ids.begin();
+	uuid_vec_t::iterator end = move_ids.end();
 	for(; it != end; ++it)
 	{
 		gInventory.moveObject((*it), trash_id);
@@ -2750,7 +2750,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		sSelf = this;
 		LLRightClickInventoryFetchDescendentsObserver* fetch = new LLRightClickInventoryFetchDescendentsObserver(FALSE);
 
-		LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+		uuid_vec_t folders;
 		LLViewerInventoryCategory* category = (LLViewerInventoryCategory*)model->getCategory(mUUID);
 		if (category)
 		{
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index f88747c382..41f0b430e8 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -2595,7 +2595,7 @@ void LLInventoryModel::buildParentChildMap()
 	}
 	count = items.count();
 	lost = 0;
-	std::vector<LLUUID> lost_item_ids;
+	uuid_vec_t lost_item_ids;
 	for(i = 0; i < count; ++i)
 	{
 		LLPointer<LLViewerInventoryItem> item;
@@ -2634,7 +2634,7 @@ void LLInventoryModel::buildParentChildMap()
 		LLMessageSystem* msg = gMessageSystem;
 		BOOL start_new_message = TRUE;
 		const LLUUID lnf = findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
-		for(std::vector<LLUUID>::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it)
+		for(uuid_vec_t::iterator it = lost_item_ids.begin() ; it < lost_item_ids.end(); ++it)
 		{
 			if(start_new_message)
 			{
@@ -3094,7 +3094,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
 		return;
 	}
 	S32 count = msg->getNumberOfBlocksFast(_PREHASH_InventoryData);
-	std::vector<LLUUID> item_ids;
+	uuid_vec_t item_ids;
 	update_map_t update;
 	for(S32 i = 0; i < count; ++i)
 	{
@@ -3110,7 +3110,7 @@ void LLInventoryModel::processRemoveInventoryItem(LLMessageSystem* msg, void**)
 		}
 	}
 	gInventory.accountForUpdate(update);
-	for(std::vector<LLUUID>::iterator it = item_ids.begin(); it != item_ids.end(); ++it)
+	for(uuid_vec_t::iterator it = item_ids.begin(); it != item_ids.end(); ++it)
 	{
 		gInventory.deleteObject(*it);
 	}
@@ -3190,7 +3190,7 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg,
 				<< llendl;
 		return;
 	}
-	std::vector<LLUUID> folder_ids;
+	uuid_vec_t folder_ids;
 	update_map_t update;
 	S32 count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
 	for(S32 i = 0; i < count; ++i)
@@ -3204,7 +3204,7 @@ void LLInventoryModel::processRemoveInventoryFolder(LLMessageSystem* msg,
 		}
 	}
 	gInventory.accountForUpdate(update);
-	for(std::vector<LLUUID>::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it)
+	for(uuid_vec_t::iterator it = folder_ids.begin(); it != folder_ids.end(); ++it)
 	{
 		gInventory.deleteObject(*it);
 	}
@@ -3317,7 +3317,7 @@ void LLInventoryModel::processBulkUpdateInventory(LLMessageSystem* msg, void**)
 
 
 	count = msg->getNumberOfBlocksFast(_PREHASH_ItemData);
-	std::vector<LLUUID> wearable_ids;
+	uuid_vec_t wearable_ids;
 	item_array_t items;
 	std::list<InventoryCallbackInfo> cblist;
 	for(i = 0; i < count; ++i)
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 62c2d80609..9913be2e88 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -77,7 +77,7 @@ void LLInventoryCompletionObserver::changed(U32 mask)
 	// appropriate.
 	if(!mIncomplete.empty())
 	{
-		for(item_ref_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+		for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
 		{
 			LLViewerInventoryItem* item = gInventory.getItem(*it);
 			if(!item)
@@ -262,7 +262,7 @@ void LLInventoryFetchObserver::fetchItems(
 // virtual
 void LLInventoryFetchDescendentsObserver::changed(U32 mask)
 {
-	for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+	for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
 	{
 		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
 		if(!cat)
@@ -285,9 +285,9 @@ void LLInventoryFetchDescendentsObserver::changed(U32 mask)
 }
 
 void LLInventoryFetchDescendentsObserver::fetchDescendents(
-	const folder_ref_t& ids)
+	const uuid_vec_t& ids)
 {
-	for(folder_ref_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
 		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
 		if(!cat) continue;
@@ -355,7 +355,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
 {
 	if(!mIncompleteItems.empty())
 	{
-		for(item_ref_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); )
+		for(uuid_vec_t::iterator it = mIncompleteItems.begin(); it < mIncompleteItems.end(); )
 		{
 			LLViewerInventoryItem* item = gInventory.getItem(*it);
 			if(!item)
@@ -364,7 +364,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
 				continue;
 			}
 			if(item->isComplete())
-		{	
+			{	
 				mCompleteItems.push_back(*it);
 				it = mIncompleteItems.erase(it);
 				continue;
@@ -374,7 +374,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
 	}
 	if(!mIncompleteFolders.empty())
 	{
-		for(folder_ref_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+		for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
 		{
 			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
 			if(!cat)
@@ -399,11 +399,11 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
 }
 
 void LLInventoryFetchComboObserver::fetch(
-	const folder_ref_t& folder_ids,
-	const item_ref_t& item_ids)
+	const uuid_vec_t& folder_ids,
+	const uuid_vec_t& item_ids)
 {
 	lldebugs << "LLInventoryFetchComboObserver::fetch()" << llendl;
-	for(folder_ref_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
+	for(uuid_vec_t::const_iterator fit = folder_ids.begin(); fit != folder_ids.end(); ++fit)
 	{
 		LLViewerInventoryCategory* cat = gInventory.getCategory(*fit);
 		if(!cat) continue;
@@ -426,7 +426,7 @@ void LLInventoryFetchComboObserver::fetch(
 	// have to fetch it individually.
 	LLSD items_llsd;
 	LLUUID owner_id;
-	for(item_ref_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit)
+	for(uuid_vec_t::const_iterator iit = item_ids.begin(); iit != item_ids.end(); ++iit)
 	{
 		LLViewerInventoryItem* item = gInventory.getItem(*iit);
 		if(!item)
@@ -564,8 +564,8 @@ void LLInventoryTransactionObserver::changed(U32 mask)
 			if(id == mTransactionID)
 			{
 				// woo hoo, we found it
-				folder_ref_t folders;
-				item_ref_t items;
+				uuid_vec_t folders;
+				uuid_vec_t items;
 				S32 count;
 				count = msg->getNumberOfBlocksFast(_PREHASH_FolderData);
 				S32 i;
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index d6dded52d4..e1c8bd3faf 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -93,9 +93,8 @@ public:
 protected:
 	virtual void done() = 0;
 
-	typedef std::vector<LLUUID> item_ref_t;
-	item_ref_t mComplete;
-	item_ref_t mIncomplete;
+	uuid_vec_t mComplete;
+	uuid_vec_t mIncomplete;
 };
 
 
@@ -113,7 +112,7 @@ public:
 	LLInventoryFetchObserver(bool retry_if_missing = false): mRetryIfMissing(retry_if_missing) {}
 	virtual void changed(U32 mask);
 
-	typedef std::vector<LLUUID> item_ref_t;
+	typedef uuid_vec_t item_ref_t;
 
 	bool isEverythingComplete() const;
 	void fetchItems(const item_ref_t& ids);
@@ -138,15 +137,14 @@ public:
 	LLInventoryFetchDescendentsObserver() {}
 	virtual void changed(U32 mask);
 
-	typedef std::vector<LLUUID> folder_ref_t;
-	void fetchDescendents(const folder_ref_t& ids);
+	void fetchDescendents(const uuid_vec_t& ids);
 	bool isEverythingComplete() const;
 	virtual void done() = 0;
 
 protected:
 	bool isComplete(LLViewerInventoryCategory* cat);
-	folder_ref_t mIncompleteFolders;
-	folder_ref_t mCompleteFolders;
+	uuid_vec_t mIncompleteFolders;
+	uuid_vec_t mCompleteFolders;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -163,18 +161,16 @@ public:
 	LLInventoryFetchComboObserver() : mDone(false) {}
 	virtual void changed(U32 mask);
 
-	typedef std::vector<LLUUID> folder_ref_t;
-	typedef std::vector<LLUUID> item_ref_t;
-	void fetch(const folder_ref_t& folder_ids, const item_ref_t& item_ids);
+	void fetch(const uuid_vec_t& folder_ids, const uuid_vec_t& item_ids);
 
 	virtual void done() = 0;
 
 protected:
 	bool mDone;
-	folder_ref_t mCompleteFolders;
-	folder_ref_t mIncompleteFolders;
-	item_ref_t mCompleteItems;
-	item_ref_t mIncompleteItems;
+	uuid_vec_t mCompleteFolders;
+	uuid_vec_t mIncompleteFolders;
+	uuid_vec_t mCompleteItems;
+	uuid_vec_t mIncompleteItems;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -197,7 +193,7 @@ public:
 protected:
 	virtual void done() = 0;
 
-	typedef std::vector<LLUUID> item_ref_t;
+	typedef uuid_vec_t item_ref_t;
 	item_ref_t mExist;
 	item_ref_t mMIA;
 };
@@ -221,8 +217,7 @@ public:
 protected:
 	virtual void done() = 0;
 
-	typedef std::vector<LLUUID> item_ref_t;
-	item_ref_t mAdded;
+	uuid_vec_t mAdded;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -242,9 +237,7 @@ public:
 	virtual void changed(U32 mask);
 
 protected:
-	typedef std::vector<LLUUID> folder_ref_t;
-	typedef std::vector<LLUUID> item_ref_t;
-	virtual void done(const folder_ref_t& folders, const item_ref_t& items) = 0;
+	virtual void done(const uuid_vec_t& folders, const uuid_vec_t& items) = 0;
 
 	LLTransactionID mTransactionID;
 };
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 4100e2fc61..ba50287ebd 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -108,7 +108,7 @@ public:
 private:
 	/*virtual*/ void done()
 	{
-		std::vector<LLUUID>::const_iterator it = mAdded.begin(), end = mAdded.end();
+		uuid_vec_t::const_iterator it = mAdded.begin(), end = mAdded.end();
 		for(; it != end; ++it)
 		{
 			LLInventoryItem* item = gInventory.getItem(*it);
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index a186bc926c..c72f0f8012 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -186,7 +186,7 @@ void LLPanelBlockedList::onBlockByNameClick()
 	LLFloaterGetBlockedObjectName::show(&LLPanelBlockedList::callbackBlockByName);
 }
 
-void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids)
+void LLPanelBlockedList::callbackBlockPicked(const std::vector<std::string>& names, const uuid_vec_t& ids)
 {
 	if (names.empty() || ids.empty()) return;
 	LLMute mute(ids[0], names[0], LLMute::AGENT);
diff --git a/indra/newview/llpanelblockedlist.h b/indra/newview/llpanelblockedlist.h
index 1ef16a02f4..a100577e43 100644
--- a/indra/newview/llpanelblockedlist.h
+++ b/indra/newview/llpanelblockedlist.h
@@ -78,7 +78,7 @@ private:
 	void onPickBtnClick();
 	void onBlockByNameClick();
 
-	void callbackBlockPicked(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
+	void callbackBlockPicked(const std::vector<std::string>& names, const uuid_vec_t& ids);
 	static void callbackBlockByName(const std::string& text);
 
 private:
diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp
index 05261a65de..11d3768a3d 100644
--- a/indra/newview/llpanelgroupinvite.cpp
+++ b/indra/newview/llpanelgroupinvite.cpp
@@ -57,7 +57,7 @@ public:
 	~impl();
 
 	void addUsers(const std::vector<std::string>& names,
-				  const std::vector<LLUUID>& agent_ids);
+				  const uuid_vec_t& agent_ids);
 	void submitInvitations();
 	void addRoleNames(LLGroupMgrGroupData* gdatap);
 	void handleRemove();
@@ -69,7 +69,7 @@ public:
 	static void callbackClickRemove(void* userdata);
 	static void callbackSelect(LLUICtrl* ctrl, void* userdata);
 	static void callbackAddUsers(const std::vector<std::string>& names,
-								 const std::vector<LLUUID>& agent_ids,
+								 const uuid_vec_t& agent_ids,
 								 void* user_data);
 	bool inviteOwnerCallback(const LLSD& notification, const LLSD& response);
 
@@ -111,7 +111,7 @@ LLPanelGroupInvite::impl::~impl()
 }
 
 void LLPanelGroupInvite::impl::addUsers(const std::vector<std::string>& names,
-										const std::vector<LLUUID>& agent_ids)
+										const uuid_vec_t& agent_ids)
 {
 	std::string name;
 	LLUUID id;
@@ -361,7 +361,7 @@ void LLPanelGroupInvite::impl::callbackClickOK(void* userdata)
 
 //static
 void LLPanelGroupInvite::impl::callbackAddUsers(const std::vector<std::string>& names,
-												const std::vector<LLUUID>& ids,
+												const uuid_vec_t& ids,
 												void* user_data)
 {
 	impl* selfp = (impl*) user_data;
@@ -399,7 +399,7 @@ void LLPanelGroupInvite::clear()
 	mImplementation->mOKButton->setEnabled(FALSE);
 }
 
-void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids)
+void LLPanelGroupInvite::addUsers(uuid_vec_t& agent_ids)
 {
 	std::vector<std::string> names;
 	for (S32 i = 0; i < (S32)agent_ids.size(); i++)
@@ -456,7 +456,7 @@ void LLPanelGroupInvite::addUsers(std::vector<LLUUID>& agent_ids)
 void LLPanelGroupInvite::addUserCallback(const LLUUID& id, const std::string& first_name, const std::string& last_name)
 {
 	std::vector<std::string> names;
-	std::vector<LLUUID> agent_ids;
+	uuid_vec_t agent_ids;
 	std::string full_name = first_name + " " + last_name;
 	agent_ids.push_back(id);
 	names.push_back(first_name + " " + last_name);
diff --git a/indra/newview/llpanelgroupinvite.h b/indra/newview/llpanelgroupinvite.h
index b095dd2395..2ed443ed46 100644
--- a/indra/newview/llpanelgroupinvite.h
+++ b/indra/newview/llpanelgroupinvite.h
@@ -42,7 +42,7 @@ public:
 	LLPanelGroupInvite(const LLUUID& group_id);
 	~LLPanelGroupInvite();
 	
-	void addUsers(std::vector<LLUUID>& agent_ids);
+	void addUsers(uuid_vec_t& agent_ids);
 	/**
 	 * this callback is being used to add a user whose fullname isn't been loaded before invoking of addUsers().
 	 */  
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index c6287472fe..0c24e6ad22 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -859,7 +859,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 	if (selection.empty()) return;
 
 	// Build a vector of all selected members, and gather allowed actions.
-	std::vector<LLUUID> selected_members;
+	uuid_vec_t selected_members;
 	U64 allowed_by_all = 0xffffffffffffLL;
 	U64 allowed_by_some = 0;
 
@@ -925,8 +925,8 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 			if (cb_enable && (count > 0) && role_id == gdatap->mOwnerRole)
 			{
 				// Check if any owners besides this agent are selected.
-				std::vector<LLUUID>::const_iterator member_iter;
-				std::vector<LLUUID>::const_iterator member_end =
+				uuid_vec_t::const_iterator member_iter;
+				uuid_vec_t::const_iterator member_end =
 												selected_members.end();
 				for (member_iter = selected_members.begin();
 					 member_iter != member_end;	
@@ -952,7 +952,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 
 			//now see if there are any role changes for the selected
 			//members and remember to include them
-			std::vector<LLUUID>::iterator sel_mem_iter = selected_members.begin();
+			uuid_vec_t::iterator sel_mem_iter = selected_members.begin();
 			for (; sel_mem_iter != selected_members.end(); sel_mem_iter++)
 			{
 				LLRoleMemberChangeType type;
@@ -1009,7 +1009,7 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 				check->setTentative(
 					(0 != count)
 					&& (selected_members.size() !=
-						(std::vector<LLUUID>::size_type)count));
+						(uuid_vec_t::size_type)count));
 
 				//NOTE: as of right now a user can break the group
 				//by removing himself from a role if he is the
@@ -1084,7 +1084,7 @@ void LLPanelGroupMembersSubTab::onEjectMembers(void *userdata)
 void LLPanelGroupMembersSubTab::handleEjectMembers()
 {
 	//send down an eject message
-	std::vector<LLUUID> selected_members;
+	uuid_vec_t selected_members;
 
 	std::vector<LLScrollListItem*> selection = mMembersList->getAllSelected();
 	if (selection.empty()) return;
@@ -1105,13 +1105,13 @@ void LLPanelGroupMembersSubTab::handleEjectMembers()
 									 selected_members);
 }
 
-void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const std::vector<LLUUID>& selected_members)
+void LLPanelGroupMembersSubTab::sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members)
 {
 	LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
 
 	if (group_data)
 	{
-		for (std::vector<LLUUID>::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i)
+		for (uuid_vec_t::const_iterator i = selected_members.begin(); i != selected_members.end(); ++i)
 		{
 			LLSD args;
 			std::string name;
@@ -1437,7 +1437,7 @@ U64 LLPanelGroupMembersSubTab::getAgentPowersBasedOnRoleChanges(const LLUUID& ag
 
 	if ( role_change_datap )
 	{
-		std::vector<LLUUID> roles_to_be_removed;
+		uuid_vec_t roles_to_be_removed;
 
 		for (role_change_data_map_t::iterator role = role_change_datap->begin();
 			 role != role_change_datap->end(); ++ role)
@@ -2086,8 +2086,8 @@ void LLPanelGroupRolesSubTab::buildMembersList()
 			LLGroupRoleData* rdatap = (*rit).second;
 			if (rdatap)
 			{
-				std::vector<LLUUID>::const_iterator mit = rdatap->getMembersBegin();
-				std::vector<LLUUID>::const_iterator end = rdatap->getMembersEnd();
+				uuid_vec_t::const_iterator mit = rdatap->getMembersBegin();
+				uuid_vec_t::const_iterator end = rdatap->getMembersEnd();
 				for ( ; mit != end; ++mit)
 				{
 					mAssignedMembersList->addNameItem((*mit));
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index eac22a6338..98cebe9882 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -173,7 +173,7 @@ public:
 
 	static void onEjectMembers(void*);
 	void handleEjectMembers();
-	void sendEjectNotifications(const LLUUID& group_id, const std::vector<LLUUID>& selected_members);
+	void sendEjectNotifications(const LLUUID& group_id, const uuid_vec_t& selected_members);
 
 	static void onRoleCheck(LLUICtrl* check, void* user_data);
 	void handleRoleCheck(const LLUUID& role_id,
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 03e8ab644e..8a1be2706c 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -134,13 +134,13 @@ public:
 	typedef std::map < LLUUID, LLVector3d > id_to_pos_map_t;
 	LLAvatarItemDistanceComparator() {};
 
-	void updateAvatarsPositions(std::vector<LLVector3d>& positions, std::vector<LLUUID>& uuids)
+	void updateAvatarsPositions(std::vector<LLVector3d>& positions, uuid_vec_t& uuids)
 	{
 		std::vector<LLVector3d>::const_iterator
 			pos_it = positions.begin(),
 			pos_end = positions.end();
 
-		std::vector<LLUUID>::const_iterator
+		uuid_vec_t::const_iterator
 			id_it = uuids.begin(),
 			id_end = uuids.end();
 
@@ -756,7 +756,7 @@ void LLPanelPeople::updateButtons()
 	//bool recent_tab_active	= (cur_tab == RECENT_TAB_NAME);
 	LLUUID selected_id;
 
-	std::vector<LLUUID> selected_uuids;
+	uuid_vec_t selected_uuids;
 	getCurrentItemIDs(selected_uuids);
 	bool item_selected = (selected_uuids.size() == 1);
 	bool multiple_selected = (selected_uuids.size() >= 1);
@@ -852,7 +852,7 @@ LLUUID LLPanelPeople::getCurrentItemID() const
 	return LLUUID::null;
 }
 
-void LLPanelPeople::getCurrentItemIDs(std::vector<LLUUID>& selected_uuids) const
+void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
 {
 	std::string cur_tab = getActiveTabName();
 
@@ -1063,10 +1063,10 @@ void LLPanelPeople::onAddFriendButtonClicked()
 	}
 }
 
-bool LLPanelPeople::isItemsFreeOfFriends(const std::vector<LLUUID>& uuids)
+bool LLPanelPeople::isItemsFreeOfFriends(const uuid_vec_t& uuids)
 {
 	const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
-	for ( std::vector<LLUUID>::const_iterator
+	for ( uuid_vec_t::const_iterator
 			  id = uuids.begin(),
 			  id_end = uuids.end();
 		  id != id_end; ++id )
@@ -1094,7 +1094,7 @@ void LLPanelPeople::onAddFriendWizButtonClicked()
 
 void LLPanelPeople::onDeleteFriendButtonClicked()
 {
-	std::vector<LLUUID> selected_uuids;
+	uuid_vec_t selected_uuids;
 	getCurrentItemIDs(selected_uuids);
 
 	if (selected_uuids.size() == 1)
@@ -1121,7 +1121,7 @@ void LLPanelPeople::onChatButtonClicked()
 
 void LLPanelPeople::onImButtonClicked()
 {
-	std::vector<LLUUID> selected_uuids;
+	uuid_vec_t selected_uuids;
 	getCurrentItemIDs(selected_uuids);
 	if ( selected_uuids.size() == 1 )
 	{
@@ -1143,7 +1143,7 @@ void LLPanelPeople::onActivateButtonClicked()
 // static
 void LLPanelPeople::onAvatarPicked(
 		const std::vector<std::string>& names,
-		const std::vector<LLUUID>& ids)
+		const uuid_vec_t& ids)
 {
 	if (!names.empty() && !ids.empty())
 		LLAvatarActions::requestFriendshipDialog(ids[0], names[0]);
@@ -1293,7 +1293,7 @@ bool LLPanelPeople::onRecentViewSortMenuItemCheck(const LLSD& userdata)
 
 void LLPanelPeople::onCallButtonClicked()
 {
-	std::vector<LLUUID> selected_uuids;
+	uuid_vec_t selected_uuids;
 	getCurrentItemIDs(selected_uuids);
 
 	if (selected_uuids.size() == 1)
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index 6d3d436156..891381e2de 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -78,12 +78,12 @@ private:
 	void					updateRecentList();
 
 	bool					isFriendOnline(const LLUUID& id);
-	bool					isItemsFreeOfFriends(const std::vector<LLUUID>& uuids);
+	bool					isItemsFreeOfFriends(const uuid_vec_t& uuids);
 
 	void					updateButtons();
 	std::string				getActiveTabName() const;
 	LLUUID					getCurrentItemID() const;
-	void					getCurrentItemIDs(std::vector<LLUUID>& selected_uuids) const;
+	void					getCurrentItemIDs(uuid_vec_t& selected_uuids) const;
 	void					buttonSetVisible(std::string btn_name, BOOL visible);
 	void					buttonSetEnabled(const std::string& btn_name, bool enabled);
 	void					buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb);
@@ -134,7 +134,7 @@ private:
 	// misc callbacks
 	static void				onAvatarPicked(
 								const std::vector<std::string>& names,
-								const std::vector<LLUUID>& ids);
+								const uuid_vec_t& ids);
 
 	void					onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list);
 
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 854651cd01..8b365c6433 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -72,7 +72,7 @@ ContextMenu::~ContextMenu()
 	}
 }
 
-void ContextMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y)
+void ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
 {
 	if (mMenu)
 	{
@@ -177,7 +177,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
 
 		bool result = (mUUIDs.size() > 0);
 
-		std::vector<LLUUID>::const_iterator
+		uuid_vec_t::const_iterator
 			id = mUUIDs.begin(),
 			uuids_end = mUUIDs.end();
 
@@ -200,7 +200,7 @@ bool NearbyMenu::enableContextMenuItem(const LLSD& userdata)
 
 		bool result = (mUUIDs.size() > 0);
 
-		std::vector<LLUUID>::const_iterator
+		uuid_vec_t::const_iterator
 			id = mUUIDs.begin(),
 			uuids_end = mUUIDs.end();
 
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index 913638d8c8..8e12710afc 100644
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -52,7 +52,7 @@ public:
 	 *
 	 * @param  uuids - an array of avatar or group ids
 	 */
-	/*virtual*/ void show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y);
+	/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
 
 	virtual void hide();
 
@@ -60,7 +60,7 @@ protected:
 
 	virtual LLContextMenu* createMenu() = 0;
 
-	std::vector<LLUUID>	mUUIDs;
+	uuid_vec_t	mUUIDs;
 	LLContextMenu*		mMenu;
 	LLHandle<LLView>	mMenuHandle;
 };
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index f9ba6f625d..34cef1bee7 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -1006,9 +1006,9 @@ void LLPanelPlaces::changedGlobalPos(const LLVector3d &global_pos)
 	updateVerbs();
 }
 
-void LLPanelPlaces::showAddedLandmarkInfo(const std::vector<LLUUID>& items)
+void LLPanelPlaces::showAddedLandmarkInfo(const uuid_vec_t& items)
 {
-	for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
+	for (uuid_vec_t::const_iterator item_iter = items.begin();
 		 item_iter != items.end();
 		 ++item_iter)
 	{
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index 78fcbbb11d..97cf43d222 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -73,7 +73,7 @@ public:
 	void changedGlobalPos(const LLVector3d &global_pos);
 
 	// Opens landmark info panel when agent creates or receives landmark.
-	void showAddedLandmarkInfo(const std::vector<LLUUID>& items);
+	void showAddedLandmarkInfo(const uuid_vec_t& items);
 
 	void setItem(LLInventoryItem* item);
 
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 2748daaffa..0a20ff6226 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -445,7 +445,7 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 	return main_menu;
 }
 
-void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y)
+void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
 {
 	LLPanelPeopleMenus::ContextMenu::show(spawning_view, uuids, x, y);
 
@@ -615,7 +615,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 
 		bool result = (mUUIDs.size() > 0);
 
-		std::vector<LLUUID>::const_iterator
+		uuid_vec_t::const_iterator
 			id = mUUIDs.begin(),
 			uuids_end = mUUIDs.end();
 
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index e1b1b5af00..d9ca4230a9 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -152,7 +152,7 @@ class LLParticipantList
 		public:
 			LLParticipantListMenu(LLParticipantList& parent):mParent(parent){};
 			/*virtual*/ LLContextMenu* createMenu();
-			/*virtual*/ void show(LLView* spawning_view, const std::vector<LLUUID>& uuids, S32 x, S32 y);
+			/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
 		protected:
 			LLParticipantList& mParent;
 		private:
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 143938bcea..aa7b7b8636 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -97,7 +97,7 @@ protected:
 
 void LLInventoryGestureAvailable::done()
 {
-	for(item_ref_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it)
+	for(uuid_vec_t::iterator it = mComplete.begin(); it != mComplete.end(); ++it)
 	{
 		LLPreviewGesture* preview = LLFloaterReg::findTypedInstance<LLPreviewGesture>("preview_gesture", *it);
 		if(preview)
diff --git a/indra/newview/llrecentpeople.cpp b/indra/newview/llrecentpeople.cpp
index bd46b5b56a..62c2ddfd9f 100644
--- a/indra/newview/llrecentpeople.cpp
+++ b/indra/newview/llrecentpeople.cpp
@@ -63,7 +63,7 @@ bool LLRecentPeople::contains(const LLUUID& id) const
 	return mPeople.find(id) != mPeople.end();
 }
 
-void LLRecentPeople::get(std::vector<LLUUID>& result) const
+void LLRecentPeople::get(uuid_vec_t& result) const
 {
 	result.clear();
 	for (recent_people_t::const_iterator pos = mPeople.begin(); pos != mPeople.end(); ++pos)
diff --git a/indra/newview/llrecentpeople.h b/indra/newview/llrecentpeople.h
index e0f2faaec5..c718997f7e 100644
--- a/indra/newview/llrecentpeople.h
+++ b/indra/newview/llrecentpeople.h
@@ -79,7 +79,7 @@ public:
 	 * 
 	 * @param result where to put the result.
 	 */
-	void get(std::vector<LLUUID>& result) const;
+	void get(uuid_vec_t& result) const;
 
 	const LLDate& getDate(const LLUUID& id) const;
 
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 6969ae5e1e..d03a492cd1 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -4392,7 +4392,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data
 		msg->getStringFast(_PREHASH_ObjectData, _PREHASH_SitName, sit_name, i);
 
 		//unpack TE IDs
-		std::vector<LLUUID> texture_ids;
+		uuid_vec_t texture_ids;
 		S32 size = msg->getSizeFast(_PREHASH_ObjectData, i, _PREHASH_TextureID);
 		if (size > 0)
 		{
@@ -5207,13 +5207,13 @@ void LLSelectNode::saveColors()
 	}
 }
 
-void LLSelectNode::saveTextures(const std::vector<LLUUID>& textures)
+void LLSelectNode::saveTextures(const uuid_vec_t& textures)
 {
 	if (mObject.notNull())
 	{
 		mSavedTextures.clear();
 
-		for (std::vector<LLUUID>::const_iterator texture_it = textures.begin();
+		for (uuid_vec_t::const_iterator texture_it = textures.begin();
 			 texture_it != textures.end(); ++texture_it)
 		{
 			mSavedTextures.push_back(*texture_it);
diff --git a/indra/newview/llselectmgr.h b/indra/newview/llselectmgr.h
index 00474827ca..d315f40ff3 100644
--- a/indra/newview/llselectmgr.h
+++ b/indra/newview/llselectmgr.h
@@ -147,7 +147,7 @@ public:
 	void setObject(LLViewerObject* object);
 	// *NOTE: invalidate stored textures and colors when # faces change
 	void saveColors();
-	void saveTextures(const std::vector<LLUUID>& textures);
+	void saveTextures(const uuid_vec_t& textures);
 	void saveTextureScaleRatios();
 
 	BOOL allowOperationOnNode(PermissionBit op, U64 group_proxy_power) const;
@@ -183,7 +183,7 @@ public:
 	std::string		mSitName;
 	U64				mCreationDate;
 	std::vector<LLColor4>	mSavedColors;
-	std::vector<LLUUID>		mSavedTextures;
+	uuid_vec_t		mSavedTextures;
 	std::vector<LLVector3>  mTextureScaleRatios;
 	std::vector<LLVector3>	mSilhouetteVertices;	// array of vertices to render silhouette of object
 	std::vector<LLVector3>	mSilhouetteNormals;	// array of normals to render silhouette of object
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index 6cf9c6b95d..4573520647 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -879,7 +879,7 @@ void LLLocalSpeakerMgr::updateSpeakerList()
 	}
 
 	// pick up non-voice speakers in chat range
-	std::vector<LLUUID> avatar_ids;
+	uuid_vec_t avatar_ids;
 	std::vector<LLVector3d> positions;
 	LLWorld::getInstance()->getAvatars(&avatar_ids, &positions, gAgent.getPositionGlobal(), CHAT_NORMAL_RADIUS);
 	for(U32 i=0; i<avatar_ids.size(); i++)
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 2910814703..d75a1424d2 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1746,7 +1746,7 @@ bool idle_startup()
 			{
 				LL_DEBUGS("AppInit") << "Gesture Manager loading " << gesture_options.size()
 					<< LL_ENDL;
-				std::vector<LLUUID> item_ids;
+				uuid_vec_t item_ids;
 				for(LLSD::array_const_iterator resp_it = gesture_options.beginArray(),
 					end = gesture_options.endArray(); resp_it != end; ++resp_it)
 				{
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 9d7f42a978..4f5eeb254b 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -304,8 +304,8 @@ void LLCategoryDropDescendentsObserver::done()
 {
 
 	gInventory.removeObserver(this);
-	folder_ref_t::iterator it = mCompleteFolders.begin();
-	folder_ref_t::iterator end = mCompleteFolders.end();
+	uuid_vec_t::iterator it = mCompleteFolders.begin();
+	uuid_vec_t::iterator end = mCompleteFolders.end();
 	LLViewerInventoryCategory::cat_array_t cats;
 	LLViewerInventoryItem::item_array_t items;
 	for(; it != end; ++it)
@@ -449,8 +449,8 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 			LLViewerInventoryCategory::cat_array_t cats;
 			LLViewerInventoryItem::item_array_t items;
 			LLNoPreferredTypeOrItem is_not_preferred;
-			LLInventoryFetchComboObserver::folder_ref_t folder_ids;
-			LLInventoryFetchComboObserver::item_ref_t item_ids;
+			uuid_vec_t folder_ids;
+			uuid_vec_t item_ids;
 			if (is_not_preferred(cat, NULL))
 			{
 				folder_ids.push_back(cargo_id);
@@ -483,7 +483,7 @@ void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
 
 void LLToolDragAndDrop::beginMultiDrag(
 	const std::vector<EDragAndDropType> types,
-	const std::vector<LLUUID>& cargo_ids,
+	const uuid_vec_t& cargo_ids,
 	ESource source,
 	const LLUUID& source_id)
 {
@@ -540,9 +540,9 @@ void LLToolDragAndDrop::beginMultiDrag(
 		}
 		if (!cat_ids.empty())
 		{
-			LLInventoryFetchComboObserver::folder_ref_t folder_ids;
-			LLInventoryFetchComboObserver::item_ref_t item_ids;
-			std::back_insert_iterator<LLInventoryFetchDescendentsObserver::folder_ref_t> copier(folder_ids);
+			uuid_vec_t folder_ids;
+			uuid_vec_t item_ids;
+			std::back_insert_iterator<uuid_vec_t> copier(folder_ids);
 			std::copy(cat_ids.begin(), cat_ids.end(), copier);
 			LLCategoryFireAndForget fetcher;
 			fetcher.fetch(folder_ids, item_ids);
diff --git a/indra/newview/lltooldraganddrop.h b/indra/newview/lltooldraganddrop.h
index 0da13dac8b..85d003e5fc 100644
--- a/indra/newview/lltooldraganddrop.h
+++ b/indra/newview/lltooldraganddrop.h
@@ -81,7 +81,7 @@ public:
 				   const LLUUID& source_id = LLUUID::null,
 				   const LLUUID& object_id = LLUUID::null);
 	void beginMultiDrag(const std::vector<EDragAndDropType> types,
-						const std::vector<LLUUID>& cargo_ids,
+						const uuid_vec_t& cargo_ids,
 						ESource source,
 						const LLUUID& source_id = LLUUID::null);
 	void endDrag();
@@ -125,7 +125,7 @@ protected:
 	
 	std::vector<EDragAndDropType> mCargoTypes;
 	//void*			mCargoData;
-	std::vector<LLUUID> mCargoIDs;
+	uuid_vec_t mCargoIDs;
 	ESource mSource;
 	LLUUID mSourceID;
 	LLUUID mObjectID;
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index a2c67abf05..75ec02f8ea 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -102,7 +102,7 @@ public:
 		const std::string verb = params[1].asString();
 		if (verb == "select")
 		{
-			std::vector<LLUUID> items_to_open;
+			uuid_vec_t items_to_open;
 			items_to_open.push_back(inventory_id);
 			//inventory_handler is just a stub, because we don't know from who this offer
 			open_inventory_offer(items_to_open, "inventory_handler");
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 85f501b2a1..42c8b4ee64 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -870,9 +870,9 @@ bool check_offer_throttle(const std::string& from_name, bool check_only)
 	}
 }
  
-void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name)
+void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name)
 {
-	for (std::vector<LLUUID>::const_iterator item_iter = items.begin();
+	for (uuid_vec_t::const_iterator item_iter = items.begin();
 		 item_iter != items.end();
 		 ++item_iter)
 	{
@@ -1263,8 +1263,8 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 			// Disabled logging to old chat floater to fix crash in group notices - EXT-4149
 			// LLFloaterChat::addChatHistory(chat);
 			
-			LLInventoryFetchComboObserver::folder_ref_t folders;
-			LLInventoryFetchComboObserver::item_ref_t items;
+			uuid_vec_t folders;
+			uuid_vec_t items;
 			items.push_back(mObjectID);
 			LLDiscardAgentOffer* discard_agent_offer;
 			discard_agent_offer = new LLDiscardAgentOffer(mFolderID, mObjectID);
@@ -2844,8 +2844,8 @@ public:
 		LLInventoryModel::cat_array_t	land_cats;
 		LLInventoryModel::item_array_t	land_items;
 
-		folder_ref_t::iterator it = mCompleteFolders.begin();
-		folder_ref_t::iterator end = mCompleteFolders.end();
+		uuid_vec_t::iterator it = mCompleteFolders.begin();
+		uuid_vec_t::iterator end = mCompleteFolders.end();
 		for(; it != end; ++it)
 		{
 			gInventory.collectDescendentsIf(
@@ -2906,7 +2906,7 @@ BOOL LLPostTeleportNotifiers::tick()
 	if ( gAgent.getTeleportState() == LLAgent::TELEPORT_NONE )
 	{
 		// get callingcards and landmarks available to the user arriving.
-		LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+		uuid_vec_t folders;
 		const LLUUID callingcard_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CALLINGCARD);
 		if(callingcard_id.notNull()) 
 			folders.push_back(callingcard_id);
@@ -5587,7 +5587,7 @@ void handle_lure(const LLUUID& invitee)
 }
 
 // Prompt for a message to the invited user.
-void handle_lure(const std::vector<LLUUID>& ids)
+void handle_lure(const uuid_vec_t& ids)
 {
 	LLSD edit_args;
 	edit_args["REGION"] = gAgent.getRegion()->getName();
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 88f9697037..0ba4ac0c8d 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -157,7 +157,7 @@ void send_group_notice(const LLUUID& group_id,
 					   const LLInventoryItem* item);
 
 void handle_lure(const LLUUID& invitee);
-void handle_lure(const std::vector<LLUUID>& ids);
+void handle_lure(const uuid_vec_t& ids);
 
 // always from gAgent and 
 // routes through the gAgent's current simulator
@@ -201,7 +201,7 @@ void invalid_message_callback(LLMessageSystem*, void*, EMessageException);
 
 void process_initiate_download(LLMessageSystem* msg, void**);
 void start_new_inventory_observer();
-void open_inventory_offer(const std::vector<LLUUID>& items, const std::string& from_name);
+void open_inventory_offer(const uuid_vec_t& items, const std::string& from_name);
 
 // Returns true if item is not in certain "quiet" folder which don't need UI
 // notification (e.g. trash, cof, lost-and-found) and agent is not AFK, false otherwise.
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 19f303ab88..0b63f5efbd 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -1209,7 +1209,7 @@ static LLVector3d unpackLocalToGlobalPosition(U32 compact_local, const LLVector3
 	return pos_global;
 }
 
-void LLWorld::getAvatars(std::vector<LLUUID>* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
+void LLWorld::getAvatars(uuid_vec_t* avatar_ids, std::vector<LLVector3d>* positions, const LLVector3d& relative_to, F32 radius) const
 {
 	if(avatar_ids != NULL)
 	{
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 48025c700b..502f7b0320 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -158,7 +158,7 @@ public:
 	// All arguments are optional. Given containers will be emptied and then filled.
 	// Not supplying origin or radius input returns data on all avatars in the known regions.
 	void getAvatars(
-		std::vector<LLUUID>* avatar_ids = NULL,
+		uuid_vec_t* avatar_ids = NULL,
 		std::vector<LLVector3d>* positions = NULL, 
 		const LLVector3d& relative_to = LLVector3d(), F32 radius = FLT_MAX) const;
 
-- 
cgit v1.2.3


From e50586043b3920864d58bb2243d977705d6669aa Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Mon, 29 Mar 2010 15:28:48 -0700
Subject: EXT-3258 - Viewer freezes while external web browser loads page
 reviewed by Callum

---
 indra/llwindow/llwindow.h          |  2 +-
 indra/llwindow/llwindowmacosx.cpp  |  2 +-
 indra/llwindow/llwindowmacosx.h    |  2 +-
 indra/llwindow/llwindowsdl.cpp     |  2 +-
 indra/llwindow/llwindowsdl.h       |  2 +-
 indra/llwindow/llwindowwin32.cpp   |  9 +++++++--
 indra/llwindow/llwindowwin32.h     |  2 +-
 indra/newview/llappviewer.cpp      |  2 +-
 indra/newview/llappviewerwin32.cpp |  2 +-
 indra/newview/llweb.cpp            | 12 +++++++++++-
 indra/newview/llweb.h              |  4 +++-
 11 files changed, 29 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 55b221e716..52132c38d3 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -160,7 +160,7 @@ public:
 	virtual void setLanguageTextInput( const LLCoordGL & pos ) {};
 	virtual void updateLanguageTextInputArea() {}
 	virtual void interruptLanguageTextInput() {}
-	virtual void spawnWebBrowser(const std::string& escaped_url) {};
+	virtual void spawnWebBrowser(const std::string& escaped_url, bool async) {};
 
 	static std::vector<std::string> getDynamicFallbackFontList();
 	
diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp
index 022b97f481..7026a3f7a6 100644
--- a/indra/llwindow/llwindowmacosx.cpp
+++ b/indra/llwindow/llwindowmacosx.cpp
@@ -3178,7 +3178,7 @@ S32 OSMessageBoxMacOSX(const std::string& text, const std::string& caption, U32
 
 // Open a URL with the user's default web browser.
 // Must begin with protocol identifier.
-void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url)
+void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url, bool async)
 {
 	bool found = false;
 	S32 i;
diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h
index 7c6b324029..5ac74bb004 100644
--- a/indra/llwindow/llwindowmacosx.h
+++ b/indra/llwindow/llwindowmacosx.h
@@ -116,7 +116,7 @@ public:
 	
 	/*virtual*/ void allowLanguageTextInput(LLPreeditor *preeditor, BOOL b);
 	/*virtual*/ void interruptLanguageTextInput();
-	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
+	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
 
 	static std::vector<std::string> getDynamicFallbackFontList();
 
diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 1f705f9e60..5902d3417c 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -2465,7 +2465,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg)
 
 // Open a URL with the user's default web browser.
 // Must begin with protocol identifier.
-void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url)
+void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
 {
 	llinfos << "spawn_web_browser: " << escaped_url << llendl;
 	
diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h
index e6bdd46a77..8e65a2f324 100644
--- a/indra/llwindow/llwindowsdl.h
+++ b/indra/llwindow/llwindowsdl.h
@@ -125,7 +125,7 @@ public:
 	/*virtual*/ void *getPlatformWindow();
 	/*virtual*/ void bringToFront();
 
-	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
+	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
 	
 	static std::vector<std::string> getDynamicFallbackFontList();
 
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 8df9dad581..d726c60018 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2959,7 +2959,7 @@ S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 t
 }
 
 
-void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
+void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
 {
 	bool found = false;
 	S32 i;
@@ -2989,7 +2989,12 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url )
 
 	// let the OS decide what to use to open the URL
 	SHELLEXECUTEINFO sei = { sizeof( sei ) };
-	sei.fMask = SEE_MASK_FLAG_DDEWAIT;
+	// NOTE: this assumes that SL will stick around long enough to complete the DDE message exchange
+	// necessary for ShellExecuteEx to complete
+	if (async)
+	{
+		sei.fMask = SEE_MASK_ASYNCOK;
+	}
 	sei.nShow = SW_SHOWNORMAL;
 	sei.lpVerb = L"open";
 	sei.lpFile = url_utf16.c_str();
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 9d57735772..d4a3446515 100644
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -114,7 +114,7 @@ public:
 	/*virtual*/ void setLanguageTextInput( const LLCoordGL & pos );
 	/*virtual*/ void updateLanguageTextInputArea();
 	/*virtual*/ void interruptLanguageTextInput();
-	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url);
+	/*virtual*/ void spawnWebBrowser(const std::string& escaped_url, bool async);
 
 	LLWindowCallbacks::DragNDropResult completeDragNDropRequest( const LLCoordGL gl_coord, const MASK mask, LLWindowCallbacks::DragNDropAction action, const std::string url );
 
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index a3d0b8d8d9..2fd840d85e 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -1648,7 +1648,7 @@ bool LLAppViewer::cleanup()
 		// HACK: Attempt to wait until the screen res. switch is complete.
 		ms_sleep(1000);
 
-		LLWeb::loadURLExternal( gLaunchFileOnQuit );
+		LLWeb::loadURLExternal( gLaunchFileOnQuit, false );
 		llinfos << "File launched." << llendflush;
 	}
 
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 63d9ed19ad..60a6d2f072 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -469,7 +469,7 @@ bool LLAppViewerWin32::initHardwareTest()
 			if (OSBTN_NO== button)
 			{
 				LL_INFOS("AppInit") << "User quitting after failed DirectX 9 detection" << LL_ENDL;
-				LLWeb::loadURLExternal(DIRECTX_9_URL);
+				LLWeb::loadURLExternal(DIRECTX_9_URL, false);
 				return false;
 			}
 			gWarningSettings.setBOOL("AboutDirectX9", FALSE);
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index 3385b75c65..1a64f9d881 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -102,9 +102,19 @@ void LLWeb::loadURLInternal(const std::string &url)
 
 // static
 void LLWeb::loadURLExternal(const std::string& url)
+{
+	loadURLExternal(url, true);
+}
+
+
+// static
+void LLWeb::loadURLExternal(const std::string& url, bool async)
 {
 	std::string escaped_url = escapeURL(url);
-	gViewerWindow->getWindow()->spawnWebBrowser(escaped_url);
+	if (gViewerWindow)
+	{
+		gViewerWindow->getWindow()->spawnWebBrowser(escaped_url, async);
+	}
 }
 
 
diff --git a/indra/newview/llweb.h b/indra/newview/llweb.h
index f4666c9280..1119b80bb4 100644
--- a/indra/newview/llweb.h
+++ b/indra/newview/llweb.h
@@ -54,8 +54,10 @@ public:
 	static void loadURL(const char* url) { loadURL( ll_safe_string(url) ); }
 	/// Load the given url in the Second Life internal web browser
 	static void loadURLInternal(const std::string &url);
-	/// Load the given url in the operating system's web browser
+	/// Load the given url in the operating system's web browser, async if we want to return immediately
+	/// before browser has spawned
 	static void loadURLExternal(const std::string& url);
+	static void loadURLExternal(const std::string& url, bool async);
 
 	/// Returns escaped url (eg, " " to "%20") - used by all loadURL methods
 	static std::string escapeURL(const std::string& url);
-- 
cgit v1.2.3


From 9e211a3e209e6ef2ac55df04c07f4f3d36987580 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Mon, 29 Mar 2010 17:00:44 -0700
Subject: Default MediaShowOnOthers setting to false.

--HG--
branch : EXT-4880
---
 indra/newview/app_settings/settings.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 73fb24e4eb..92226f4148 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4609,7 +4609,7 @@
     <key>Type</key>
     <string>Boolean</string>
     <key>Value</key>
-    <integer>1</integer>
+    <integer>0</integer>
   </map>
   <key>MediaShowOutsideParcel</key>
   <map>
-- 
cgit v1.2.3


From e1517318c58d6796b5566d5cf96c02474fd7376e Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Mon, 29 Mar 2010 18:36:47 -0700
Subject: Fix for EXT-6615 (SL webkit no longer reports "Second Life" in the
 HTTP_USER_AGENT)

The issue here is that initBrowserWindow() was doing the wrong thing if it got called after the set_user_agent message was received.

Made the handler for the set_user_agent message save the string in a member variable (mUserAgent).

Initialize mUserAgent to the default string in the MediaPluginWebKit constructor.

initBrowserWindow() now sets the user agent string from mUserAgent instead of from a literal.
---
 indra/media_plugins/webkit/media_plugin_webkit.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 85d6b2f5ff..436e077e9b 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -89,6 +89,7 @@ private:
 
 	std::string mProfileDir;
 	std::string mHostLanguage;
+	std::string mUserAgent;
 	bool mCookiesEnabled;
 	bool mJavascriptEnabled;
 	bool mPluginsEnabled;
@@ -300,7 +301,7 @@ private:
 		LLQtWebKit::getInstance()->addObserver( mBrowserWindowId, this );
 
 		// append details to agent string
-		LLQtWebKit::getInstance()->setBrowserAgentId( "LLPluginMedia Web Browser" );
+		LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
 
 #if !LL_QTWEBKIT_USES_PIXMAPS
 		// don't flip bitmap
@@ -688,6 +689,7 @@ MediaPluginWebKit::MediaPluginWebKit(LLPluginInstance::sendMessageFunction host_
 	mHostLanguage = "en";		// default to english
 	mJavascriptEnabled = true;	// default to on
 	mPluginsEnabled = true;		// default to on
+	mUserAgent = "LLPluginMedia Web Browser";
 }
 
 MediaPluginWebKit::~MediaPluginWebKit()
@@ -1103,8 +1105,8 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 			}
 			else if(message_name == "set_user_agent")
 			{
-				std::string user_agent = message_in.getValue("user_agent");
-				LLQtWebKit::getInstance()->setBrowserAgentId( user_agent );
+				mUserAgent = message_in.getValue("user_agent");
+				LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
 			}
 			else if(message_name == "init_history")
 			{
-- 
cgit v1.2.3


From 72cf44849205f9f469befbe3f26a69f261e80a83 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Tue, 30 Mar 2010 10:00:40 +0300
Subject: Fixed normal bug EXT-6390 (inventory loses focus after renaming a
 inventory item)

- Discard NULL'ing item after renaming it, to avoid focus losing of this item

Reviewed by Samuel Kolb at https://codereview.productengine.com/secondlife/r/128/

--HG--
branch : product-engine
---
 indra/newview/llfolderview.cpp | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index f74d912842..1472f490bb 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -979,7 +979,6 @@ void LLFolderView::finishRenamingItem( void )
 	if( mRenameItem )
 	{
 		setSelectionFromRoot( mRenameItem, TRUE );
-		mRenameItem = NULL;
 	}
 
 	// List is re-sorted alphabeticly, so scroll to make sure the selected item is visible.
-- 
cgit v1.2.3


From 50802e68fc272e4dd78220210781ac036806d107 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Tue, 30 Mar 2010 12:14:37 +0300
Subject: Fixed normal bug EXT-5696 (chiclets bar minimal width doesn't match
 design specification) * Increased the minimal width of Chiclet panel up to 95
 px. * Also set default width between chiclet panel & im well the same as
 minimal (4 px).

For now minimal viewer width when all buttons are still visible (and have non-truncated labels in the 'EN' locale)
 with opened sidetray is 1042 px; with short Speak button (without text label) is 991 px.

Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/126/
See also EXT-3397

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_bottomtray.xml | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 58c5c11e51..b6d7bf8dd0 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -263,7 +263,7 @@
          top="0"
          name="chiclet_list_panel"
          width="189"
-         min_width="60"
+         min_width="95"
          user_resize="false"
          auto_resize="true">
 <!--*NOTE: min_width of the chiclet_panel (chiclet_list) must be the same
@@ -274,7 +274,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
              height="24"
              layout="topleft"
              left="1"
-             min_width="60"
+             min_width="95"
              name="chiclet_list"
              top="7"
              chiclet_padding="4"
@@ -330,7 +330,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
          min_width="4"
          name="DUMMY"
          top="0"
-         width="5"/>
+         width="4"/>
         <layout_panel
          auto_resize="false"
          follows="right"
-- 
cgit v1.2.3


From 337ddc1593a1d8200952bb12b1ed77e94a98a1d8 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Tue, 30 Mar 2010 12:49:05 +0300
Subject: fixed EXT-6509 URL-name of object is shown as hyperlink in widget
 style Nearby chat

set allow_html to false for Message Header and Name field of Object Inspector

Reviewed by Vadim at https://codereview.productengine.com/secondlife/r/127/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/inspect_object.xml    | 1 +
 indra/newview/skins/default/xui/en/panel_chat_header.xml | 1 +
 2 files changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/inspect_object.xml b/indra/newview/skins/default/xui/en/inspect_object.xml
index 00e00b9694..b8a7222e8e 100644
--- a/indra/newview/skins/default/xui/en/inspect_object.xml
+++ b/indra/newview/skins/default/xui/en/inspect_object.xml
@@ -26,6 +26,7 @@ owner [OWNER]
   <string name="Touch">Touch</string>
   <string name="Sit">Sit</string>
   <text
+     allow_html="false"
      follows="all"
      font="SansSerifLarge"
      height="16"
diff --git a/indra/newview/skins/default/xui/en/panel_chat_header.xml b/indra/newview/skins/default/xui/en/panel_chat_header.xml
index 250dadd390..9124ad528d 100644
--- a/indra/newview/skins/default/xui/en/panel_chat_header.xml
+++ b/indra/newview/skins/default/xui/en/panel_chat_header.xml
@@ -21,6 +21,7 @@
          top="3"
          width="18" />
     <text
+      allow_html="false"
       allow_scroll="false"
       v_pad = "7"
       read_only = "true"
-- 
cgit v1.2.3


From 8ba495722ce243c161cac9e880c2e5c88e23da3d Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Tue, 30 Mar 2010 15:19:42 +0300
Subject: fix for normal EXT-5882 Max. Contribution field on groups -> land and
 assets tab miscalculates after first group fetch. reviewed vsavchuk
 https://codereview.productengine.com/secondlife/r/133/

--HG--
branch : product-engine
---
 indra/newview/llpanelgrouplandmoney.cpp | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index 9023afc602..f276df8573 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -1600,6 +1600,8 @@ void LLPanelGroupLandMoney::setGroupID(const LLUUID& id)
 		mImplementationp->mMoneySalesTabEHp->setGroupID(mGroupID);
 	}
 
+	mImplementationp->mBeenActivated = true;
+
 	activate();
 }
 
-- 
cgit v1.2.3


From c73dcb079991bad12458386274cec409013ad76b Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Tue, 30 Mar 2010 15:51:32 +0300
Subject: Fixed bug EXT-6270 (No confirm teleport dialog appears, while
 teleporting from teleport history tab).

Added teleport confirmation dialog to the teleport history panel.

Reviewed by Mike: https://codereview.productengine.com/secondlife/r/135/

--HG--
branch : product-engine
---
 indra/newview/llpanelteleporthistory.cpp           | 28 ++++++++++++++++++++--
 indra/newview/llpanelteleporthistory.h             |  3 +++
 .../newview/skins/default/xui/en/notifications.xml | 12 ++++++++++
 3 files changed, 41 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 90c8f2551f..0a34531eee 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -348,7 +348,7 @@ LLContextMenu* LLTeleportHistoryPanel::ContextMenu::createMenu()
 
 void LLTeleportHistoryPanel::ContextMenu::onTeleport()
 {
-	LLTeleportHistoryStorage::getInstance()->goToItem(mIndex);
+	confirmTeleport(mIndex);
 }
 
 void LLTeleportHistoryPanel::ContextMenu::onInfo()
@@ -507,7 +507,7 @@ void LLTeleportHistoryPanel::onTeleport()
 		return;
 
 	// teleport to existing item in history, so we don't add it again
-	mTeleportHistory->goToItem(itemp->getIndex());
+	confirmTeleport(itemp->getIndex());
 }
 
 /*
@@ -1058,3 +1058,27 @@ void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param
 		mLastSelectedFlatlList->resetSelection();
 	}
 }
+
+// static
+void LLTeleportHistoryPanel::confirmTeleport(S32 hist_idx)
+{
+	LLSD args;
+	args["HISTORY_ENTRY"] = LLTeleportHistoryStorage::getInstance()->getItems()[hist_idx].mTitle;
+	LLNotificationsUtil::add("TeleportToHistoryEntry", args, LLSD(),
+		boost::bind(&LLTeleportHistoryPanel::onTeleportConfirmation, _1, _2, hist_idx));
+}
+
+// Called when user reacts upon teleport confirmation dialog.
+// static
+bool LLTeleportHistoryPanel::onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+
+	if (0 == option)
+	{
+		// Teleport to given history item.
+		LLTeleportHistoryStorage::getInstance()->goToItem(hist_idx);
+	}
+
+	return false;
+}
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index 4eeaec7705..5e2ccc0c93 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -103,6 +103,9 @@ private:
 	bool isAccordionCollapsedByUser(LLUICtrl* acc_tab);
 	void onAccordionExpand(LLUICtrl* ctrl, const LLSD& param);
 
+	static void confirmTeleport(S32 hist_idx);
+	static bool onTeleportConfirmation(const LLSD& notification, const LLSD& response, S32 hist_idx);
+
 	LLTeleportHistoryStorage*	mTeleportHistory;
 	LLAccordionCtrl*		mHistoryAccordion;
 
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 6d18111be0..8501143fe6 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -3110,6 +3110,18 @@ Teleport to [PICK]?
      yestext="Teleport"/>
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="TeleportToHistoryEntry"
+   type="alertmodal">
+Teleport to [HISTORY_ENTRY]?
+    <usetemplate
+     ignoretext="Confirm that I want to teleport to a history location"
+     name="okcancelignore"
+     notext="Cancel"
+     yestext="Teleport"/>
+  </notification>
+
   <notification
    icon="alert.tga"
    label="Message everyone in your Estate"
-- 
cgit v1.2.3


From 197c4d0ab4fe90562b30e3d1c9ae76d331299c29 Mon Sep 17 00:00:00 2001
From: Kent Quirk <q@lindenlab.com>
Date: Tue, 30 Mar 2010 10:15:53 -0400
Subject: Fix the credits in the right file.

---
 indra/newview/skins/default/xui/en/floater_about.xml | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index bc67621dfd..05beb45593 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -110,19 +110,14 @@ Packets Lost: [PACKETS_LOST,number,0]/[PACKETS_IN,number,0] ([PACKETS_PCT,number
        top="5"
        width="435"
        word_wrap="true">
-Second Life is brought to you by Philip, Tessa, Andrew, Cory, James, Ben, Char, Charlie, Colin, Dan, Daniel, Doug, Eric, Hamlet, Haney, Eve, Hunter, Ian, Jeff, Jennifer, Jim, John, Lee, Mark, Peter, Phoenix, Richard, Robin, Xenon, Steve, Tanya, Eddie, Avi, Frank, Bruce, Aaron, Alice, Bob, Debra, Eileen, Helen, Janet, Louie, Leviathania, Stefan, Ray, Kevin, Tom, Mikeb, MikeT, Burgess, Elena, Tracy, Bill, Todd, Ryan, Zach, Sarah, Nova, Tim, Stephanie, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Magellan, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Ventrella, Jack, Vektor, Iris, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Altruima, Jesse, Teeny, Monroe, Icculus, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Satoko, Yuko, Makiko, Thomas, Harry, Seth, Alexei, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, beez, Milo, Hermia, Red, Thrax, Joe, Sally, Magenta, Mogura, Paul, Jose, Rejean, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Jean, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, dustin, George, Del, Matthew, Cat, Jacqui, Lightfoot, Adrian, Viola, Alfred, Noel, Irfan, Sunil, Yool, Rika, Jane, Xtreme, Frontier, a2, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Gulliver, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Anthony, Jeremy, JP, Jake, Maurice, Madhavi, Leopard, Kyle, Joon, Kari, Bert, Belinda, Jon, Kristi, Bridie, Pramod, KJ, Socrates, Maria, Ivan, Aric, Yamasaki, Adreanne, Jay, MitchK, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Rohn, Colossus, Zen, BigPapi, Brad, Pastrami, Kurz, Mani, Neuro, Jaime, MJ, Rowan, Sgt, Elvis, Gecko, Samuel, Sardonyx, Leo, Bryan, Niko, Soft, Poppy, Rachel, Aki, Angelo, Banzai, Alexa, Sue, CeeLo, Bender, CG, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Heidy, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Winnie, Stella, Milton, Rothman, Niall, Marin, Allison, Katie, Dawn, Katt, Dusty, Kalpana, Judy, Andrea, Ambroff, Infinity, Gail, Rico, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Vidtuts, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Austin, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Yang, T, Simone, Maestro, Scott, Charlene, Quixote, Amanda, Susan, Zed, Anne, Enkidu, Esbee, Joroan, Katelin, Roxie, Tay, Scarlet, Kevin, Johnny, Wolfgang, Andren, Bob, Howard, Merov, Rand, Ray, Michon, Newell, Galen, Dessie, Les and many others.
+Second Life is brought to you by Philip, Tessa, Andrew, Cory, Ian, James, Phoenix, Ryan, Haney, Dan, Char, Ben, John, Tanya, Eddie, Richard, Mitch, Doug, Eric, Frank, Bruce, Aaron, Peter, Alice, Charlie, Debra, Eileen, Helen, Janet, Steffan, Steve, Tom, Mark, Hunter, Xenon, Burgess, Bill, Jim, Lee, Hamlet, Daniel, Jeff, Todd, Sarah, Tim, Stephanie, Colin, Michael, Evan, Nicolas, Catherine, Rachelle, Dave, Holly, Bub, Kelly, Ramzi, Don, Sabin, Jill, Rheya, Jeska, Torley, Kona, Callum, Charity, Jack, Vektor, Chris, Nicole, Mick, Reuben, Blue, Babbage, Yedwab, Deana, Lauren, Brent, Pathfinder, Chadrick, Jesse, David, Tess, Lizzie, Patsy, Isaac, Lawrence, Cyn, Bo, Gia, Annette, Marius, Tbone, Jonathan, Karen, Ginsu, Yuko, Makiko, Thomas, Harry, Seth, Brian, Guy, Runitai, Ethan, Data, Cornelius, Kenny, Swiss, Zero, Brad, Natria, Wendy, Stephen, Teeple, Thumper, Lucy, Dee, Mia, Liana, Warren, Branka, Aura, Beez, Milo, Hermia, Red, Thrax, Gulliver, Joe, Sally, Paul, Jose, Rejean, Dore, Henrik, Lexie, Amber, Logan, Xan, Nora, Morpheus, Donovan, Leyla, MichaelFrancis, Beast, Cube, Bucky, Joshua, Stryfe, Harmony, Teresa, Claudia, Walker, Glenn, Fritz, Fordak, June, Cleopetra, Ivy, Betsy, Roosevelt, Spike, Ken, Which, Tofu, Chiyo, Rob, Zee, Dustin, George, Del, Matthew, Cat, Jacqui, Adrian, Viola, Alfred, Noel, Irfan, Yool, Rika, Jane, Frontier, Neo, Siobhan, Yoz, Justin, Elle, Qarl, Benjamin, Isabel, Everett, Christopher, Izzy, Stephany, Garry, Sejong, Sean, Tobin, Iridium, Meta, Jeremy, JP, Jake, Anthony, Maurice, Madhavi, Leopard, Kyle, Joon, Bert, Belinda, Jon, Kristi, Bridie, Pramod, Socrates, Maria, Aric, Adreanne, Jay, Kari, Ceren, Coco, Durl, Jenny, Periapse, Kartic, Storrs, Lotte, Sandy, Colossus, Zen, BigPapi, Pastrami, Kurz, Mani, Neuro, Mel, Sardonyx, MJ, Rowan, Sgt, Elvis, Samuel, Leo, Bryan, Niko, Austin, Soft, Poppy, Rachel, Aki, Banzai, Alexa, Sue, Bender, CG, Angelo, Gillian, Pelle, Nick, Echo, Zara, Christine, Shamiran, Emma, Blake, Keiko, Plexus, Joppa, Sidewinder, Erica, Ashlei, Twilight, Kristen, Brett, Q, Enus, Simon, Bevis, Kraft, Kip, Chandler, Ron, LauraP, Ram, KyleJM, Scouse, Prospero, Melissa, Marty, Nat, Hamilton, Kend, Lordan, Jimmy, Kosmo, Seraph, Green, Ekim, Wiggo, JT, Rome, Doris, Miz, Benoc, Whump, Trinity, Patch, Kate, TJ, Bao, Joohwan, Christy, Sofia, Matias, Cogsworth, Johan, Oreh, Cheah, Angela, Brandy, Mango, Lan, Aleks, Gloria, Mitchell, Space, Colton, Bambers, Einstein, Maggie, Malbers, Rose, Rothman, Niall, Marin, Allison, Katie, Dawn, Dusty, Katt, Judy, Andrea, Ambroff, Infinity, Rico, Gail, Kalpana, Raymond, Yi, William, Christa, M, Teagan, Scout, Molly, Dante, Corr, Dynamike, Usi, Kaylee, Lil, Danica, Sascha, Kelv, Jacob, Nya, Rodney, Brandon, Elsie, Blondin, Grant, Katrin, Nyx, Gabriel, Locklainn, Claire, Devin, Minerva, Monty, Bradford, Si, Keira, H, Caitlin, Dita, Makai, Jenn, Ann, Meredith, Clare, Joy, Praveen, Cody, Edmund, Ruthe, Sirena, Gayathri, Spider, FJ, Davidoff, Tian, Jennie, Louise, Oskar, Landon, Noelle, Jarv, Ingrid, Al, Sommer, Doc, Aria, Huin, Gray, Lili, Vir, DJ, Maestro, Simone, Yang, T, Shannon, Nelson, Khanh, Scott, Courtney, Charlene, Quixote, Susan, Zed, Amanda, Katelin, Enkidu, Roxie, Esbee, JoRoan, Scarlet, Tay, Kevin, Wolfgang, Johnny, Ray, Andren, Merov, Bob, Rand, Howard, Callen, Heff, Galen, Newell, Dessie, Les, Michon, Jenelle, Geo, Siz, Shapiro, Pete, Calyle, Selene, Allen, Phoebe, Goldin, Kimmora, Dakota, Slaton, Lindquist, Zoey, Hari, Othello, Rohit, Sheldon, Petra, Viale, Gordon, Kaye, Pink, Ferny, Emerson, Davy, Bri, Chan, Juan, Robert, Terrence, Nathan, Carl, Ashley, JessieAnn, Huseby, Karina, Paris, Kurt, Rick, Lis, Kotler, Theeba, Lynx, Murphy, Doten, Taka, Norm, Jillian, Marcus, Mae, Novack, Esther, Perry, Dana, Ducot, Javier, Porter, Madison, Gecko, Dough, JR, Gisele, Crimp, Norie, Arch, Kimi, Fisher, Barbara, Jason, Peggy, Bernard, Jules, Leroy, Eva, Khederian, Campbell, Vogt, Masido, Karel, Torres, Lo, Breezer, Delby, Rountree, Anna, Servus, Rue, Itiaes, Chuck, Luna, Novella, Zaza, Wen, Gino, Lex, Cassandra, Limey, Nancy, Anukul, Silver, Brodesky, Jinsai, Squid, Gez, Rakesh, Ladan, Edelman, Marcet, Squire, Tatem, Tony, Jerm, Tia, Falcon, BK, Tiggs, Driscoll, Bacon, Timothee, Cru, Carmilla, Coyot, Webb, Kazu, Rudas, LJ, Sea, Ali Wallace, Bewest, Pup, Drub, Dragon, Inoshiro, Byron, Rhett, Xandix, Aimee, Fredrik, Thor, Teddy, Baron, Nelly, Ghengis, Epic, Eli, Stone, Grapes, Irie, Prep, Scobu, Valerie, Alain, and many others.
 
-Thank you to the following Residents for helping to ensure that this is the best version yet: (in progress)
+Thank you to the following Residents for helping to ensure that this is the best version yet: Drew Dwi, Zai Lynch, Latif Khalifa, Ellla McMahon, Harleen Gretzky, Squirrel Wood, Malarthi Behemoth, Dante Tucker, Buckaroo Mu, Eddi Decosta, Dirk, Talamasca, Torben Trautman, Irene Muni, Lilly Zenovka, Vick Forcella, Sasy Scarborough, Gentle Welinder, Elric Anatine, Techwolf Lupindo, Dusan Writer, WolfPup Lowenhar, Marianne McCann, Fiachra Lach, Sitearm Madonna, Sudane Erato, Sahkolihaa Contepomi, Sachi Vixen, Questar Utu, Dimitrio Lewis, Matto Destiny, Scrim Pinion, Radio Signals, Psi Merlin, Pixel Gausman, Mel Vanbeeck, Laurent Bechir, Lamorna Proctor, Lares Carter, Gwyneth Llewelyn, Hydra Shaftoe, Holger Gilruth, Gentle Heron, Carla Broek, Boroondas Gupte, Fury Rosewood, Flower Ducatillon, Colpo Wexler, gwampa Lomu, Borg Capalini, Beansy Twine, Ardy Lay, , 45ms Zhong, Adeon Writer, Aeonix Aeon, Ai Austin, Aiko Ying, Alexandrea Fride, Alliez Mysterio, Annie Milestone, Annika Genezzia, Ansariel Hiller, ArminasX Saiman, Arya Braveheart, Asaeda Meltingdots, Asturkon Jua, Avallyn Oakleaf, Avatar Quinzet, BabyA Littlething, Bacchus Ireto, Bazaar, Riva, Benjamin Bigdipper, Beth Walcher, Bezilon Kasei, Biancaluce Robbiani, Bill Walach, blakopal Galicia, Blitzckreed Levenque, Bryn Oh, Callipygian Christensen, Cap Carver, Carr Arbenlow, Chantal Harvey, Charles Courtois, Charlie Sazaland, Cherry Cheevers, ChickyBabes Zuzu, Christopher  Organiser, Ciaran Laval, Clara Young, Celierra Darling, Corinne Helendale, Corro Moseley, Coughdrop Littlething, Darien Caldwell, Dartagan Shepherd, Debs Regent, Decro Schmooz, Denim Kamachi, DiJodi Dubratt, Dil Spitz, Edgware Marker, Egehan Dryke, Emma Portilo, Emmie Fairymeadow, Evangelista Emerald, Faelon Swordthain, Frenchimmo Sabra, Gaberoonie Zanzibar, Ganymedes Costagravas, Gene Frostbite, GeneJ Composer, Giggles Littlebird, Grady Echegaray, Guni Greenstein, Gypsy Tripsa, Hackshaven Harford, Ham Rambler, Han Shuffle, Hanglow Short, Hatzfeld Runo, herina Bode, Horatio Freund, Hypatia Callisto, Hypatia Pickens, Identity Euler, Imnotgoing Sideways, Innula Zenovka, Iyoba Tarantal, Jack Abraham, Jagga Meredith, Jennifer Boyle, Jeremy Marquez, Jessica Qin, Jinx Nordberg, Jo Bernandes, Jocial Sonnenkern, Joel Savard, Jondan Lundquist, Josef Munster, Josette Windlow, Juilan Tripsa, Juro Kothari, Justin RiversRunRed, Kagehi Kohn, Kaimen Takahe, Keklily Longfall, Ken Lavender, Kestral Karas, Khisme Nitely, Kimar Coba, Kithrak Kirkorian, Kitty Barnett, Kolor Fall, Komiko Okamoto, Korvel Noh, Larry Pixel, Leal Choche, len Starship, Lenae Munz, Lexi Frua, Lillie Cordeaux, Lizzy Macarthur, LSL Scientist, Luban Yiyuan, Luc Starsider, Maccus McCullough, Madison Blanc, Maggie Darwin, Mallory Destiny, Manx Wharton, Marc Claridge, Marc2 Sands, Matthew Anthony, Maxim RiversRunRed, Medhue Simoni, Melinda Latynina, Mencius Watts, Michi Lumin, Midian Farspire, Miles Glaz, Mindy Mathy, Mitch Wagner, Mo Hax, Mourna Biziou, Nao Noe, naofan Teardrop, Naomah Beaumont, Nathiel Siamendes, Nber Medici, Neko Link, Netpat Igaly, Neutron Chesnokov, Newfie Pendragon, Nicholai Laviscu, Nick Rhodes, Nicoladie Gymnast, Ollie Kubrick, Orenj Marat, Orion Delphis, Oryx Tempel, Parvati Silverweb, PeterPunk Mooney, Pixel Scientist, Pounce Teazle, Professor Noarlunga, Quantum Destiny, Quicksilver Hermes, Ralf Setsuko, RAT Quan, RedMokum Bravin, Revolution Perenti, Rezit Sideways, Rich Grainger, Rosco Teardrop, Rose Evans, Rudee Voom, RufusTT Horsefly, Saii Hallard, SaintLEOlions Zimer, Samm Larkham, Satanello Miami, SexySteven Morrisey, Sheet Spotter, Shnurui Troughton, sicarius Thorne, Sicarius Toxx, Sini Nubalo, SLB Wirefly, snowy Sidran, Soupa Segura, ST Mensing, Starshine Halasy, Stickman Ingmann, Synystyr Texan, Takeda Terrawyng, Tali Rosca, Templar Merlin, Tezcatlipoca Bisiani, Tiel Stonecutter, Tony Kembia, TouchaHoney Perhaps, Trey Reanimator, TriloByte Zanzibar, Trinity Dechou, Trinity Dejavu, Unlikely Quintessa, UsikuFarasi Kanarik, Veritas Raymaker, Vex Streeter, Viaticus Speculaas, Villain Baroque, Vixie Durant, Void Singer, Watty Berkson, Westley Schridde, Westley Streeter, Whimsy Winx, Winter Ventura, Wundur Primbee, xstorm Radek, YongYong Francois, Zak Westminster, Zana Kohime, Zaren Alexander, Zeja Pyle, ZenMondo Wormser, Zoex Flanagan, and many others.
 
 
 
 
-
-
-
-
-It is a rare mind indeed that can render the hitherto non-existent blindingly obvious. The cry 'I could have thought of that' is a very popular and misleading one, for the fact is that they didn't, and a very significant and revealing fact it is too.
- -- Douglas Adams
+"The work goes on, the cause endures, the hope still lives, and the dreams shall never die" - Edward Kennedy
       </text_editor>
     </panel>
     <panel
-- 
cgit v1.2.3


From 67a7112a7cfae8633cfd903e24cec8b003a3cee9 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Tue, 30 Mar 2010 17:42:05 +0300
Subject: Completed normal task EXT-3397 (Hide well buttons if there are no
 active IM sessions and unresolved notifications) * Implemented hiding of
 bottom tray's wells if there are no active IMs or unresolved notifications
 (via LLBottomTray::notifyParent)

* Also refactored initializing code to init a pointer to a chiclet panel and map with bottomtray parts in postBuild BEFORE initializing start wells' visibility.

For now minimal viewer width when all buttons are still visible (and have non-truncated labels in the 'EN' locale) with opened sidetray is 1041 px; with short Speak button (without text label) is 990 px. (with implemented patch in https://codereview.productengine.com/secondlife/r/126/)

Each well button takes 37 px (with a padding). So, they can free up to 74 px when invisible.

reviewed by Vadim at https://codereview.productengine.com/secondlife/r/136/

--HG--
branch : product-engine
---
 indra/newview/llbottomtray.cpp                     | 62 +++++++++++++++++++---
 indra/newview/llbottomtray.h                       | 13 +++++
 indra/newview/llchiclet.cpp                        |  5 ++
 .../skins/default/xui/en/panel_bottomtray.xml      | 31 ++---------
 4 files changed, 78 insertions(+), 33 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 34cb6fd2eb..41bee540fc 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -160,10 +160,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
 
 	LLUICtrlFactory::getInstance()->buildPanel(this,"panel_bottomtray.xml");
 
-	mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
-
-	mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1));
-
 	LLUICtrl::CommitCallbackRegistry::defaultRegistrar().add("CameraPresets.ChangeView", boost::bind(&LLFloaterCamera::onClickCameraPresets, _2));
 
 	//this is to fix a crash that occurs because LLBottomTray is a singleton
@@ -171,8 +167,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
 	//destroyed LLBottomTray requires some subsystems that are long gone
 	//LLUI::getRootView()->addChild(this);
 
-	initStateProcessedObjectMap();
-
 	// Necessary for focus movement among child controls
 	setFocusRoot(TRUE);
 
@@ -371,6 +365,23 @@ void LLBottomTray::setVisible(BOOL visible)
 		gFloaterView->setSnapOffsetBottom(0);
 }
 
+S32 LLBottomTray::notifyParent(const LLSD& info)
+{
+	if(info.has("well_empty")) // implementation of EXT-3397
+	{
+		const std::string chiclet_name = info["well_name"];
+
+		// only "im_well" or "notification_well" names are expected.
+		// They are set in panel_bottomtray.xml in <chiclet_im_well> & <chiclet_notification>
+		llassert("im_well" == chiclet_name || "notification_well" == chiclet_name);
+
+		BOOL should_be_visible = !info["well_empty"];
+		showWellButton("im_well" == chiclet_name ? RS_IM_WELL : RS_NOTIFICATION_WELL, should_be_visible);
+		return 1;
+	}
+	return LLPanel::notifyParent(info);
+}
+
 void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)
 {
 	// We should show BottomTrayContextMenu in last  turn
@@ -487,6 +498,15 @@ BOOL LLBottomTray::postBuild()
 
 	mNearbyChatBar->getChatBox()->setContextMenu(NULL);
 
+	mChicletPanel = getChild<LLChicletPanel>("chiclet_list");
+	mChicletPanel->setChicletClickedCallback(boost::bind(&LLBottomTray::onChicletClick,this,_1));
+
+	initStateProcessedObjectMap();
+
+	// update wells visibility:
+	showWellButton(RS_IM_WELL, !LLIMWellWindow::getInstance()->isWindowEmpty());
+	showWellButton(RS_NOTIFICATION_WELL, !LLNotificationWellWindow::getInstance()->isWindowEmpty());
+
 	return TRUE;
 }
 
@@ -855,6 +875,7 @@ void LLBottomTray::processWidthIncreased(S32 delta_width)
 bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* available_width)
 {
 	lldebugs << "Trying to show object type: " << shown_object_type << llendl;
+	llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
 
 	LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
 	if (NULL == panel)
@@ -886,6 +907,7 @@ bool LLBottomTray::processShowButton(EResizeState shown_object_type, S32* availa
 void LLBottomTray::processHideButton(EResizeState processed_object_type, S32* required_width, S32* buttons_freed_width)
 {
 	lldebugs << "Trying to hide object type: " << processed_object_type << llendl;
+	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
 
 	LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
 	if (NULL == panel)
@@ -963,6 +985,7 @@ void LLBottomTray::processShrinkButtons(S32* required_width, S32* buttons_freed_
 
 void LLBottomTray::processShrinkButton(EResizeState processed_object_type, S32* required_width)
 {
+	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
 	LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
 	if (NULL == panel)
 	{
@@ -1046,6 +1069,7 @@ void LLBottomTray::processExtendButtons(S32* available_width)
 
 void LLBottomTray::processExtendButton(EResizeState processed_object_type, S32* available_width)
 {
+	llassert(mStateProcessedObjectMap[processed_object_type] != NULL);
 	LLPanel* panel = mStateProcessedObjectMap[processed_object_type];
 	if (NULL == panel)
 	{
@@ -1126,6 +1150,7 @@ void LLBottomTray::initStateProcessedObjectMap()
 
 void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool visible)
 {
+	llassert(mStateProcessedObjectMap[shown_object_type] != NULL);
 	LLPanel* panel = mStateProcessedObjectMap[shown_object_type];
 	if (NULL == panel)
 	{
@@ -1264,4 +1289,29 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 	return is_set;
 }
 
+void LLBottomTray::showWellButton(EResizeState object_type, bool visible)
+{
+	llassert( ((RS_NOTIFICATION_WELL | RS_IM_WELL) & object_type) == object_type );
+
+	const std::string panel_name = RS_IM_WELL == object_type ? "im_well_panel" : "notification_well_panel";
+
+	LLView * panel = getChild<LLView>(panel_name);
+
+	// if necessary visibility is set nothing to do here
+	if (panel->getVisible() == (BOOL)visible) return;
+
+	S32 panel_width = panel->getRect().getWidth();
+	panel->setVisible(visible);
+
+	if (visible)
+	{
+		// method assumes that input param is a negative value
+		processWidthDecreased(-panel_width);
+	}
+	else
+	{
+		processWidthIncreased(panel_width);
+	}
+}
+
 //EOF
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 18c14e5e19..3c45777645 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -83,6 +83,8 @@ public:
 
 	virtual void setVisible(BOOL visible);
 
+	/*virtual*/ S32 notifyParent(const LLSD& info);
+
 	// Implements LLVoiceClientStatusObserver::onChange() to enable the speak
 	// button when voice is available
 	/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
@@ -116,6 +118,8 @@ private:
 		, RS_BUTTON_MOVEMENT	= 0x0010
 		, RS_BUTTON_GESTURES	= 0x0020
 		, RS_BUTTON_SPEAK		= 0x0040
+		, RS_IM_WELL			= 0x0080
+		, RS_NOTIFICATION_WELL	= 0x0100
 
 		/**
 		 * Specifies buttons which can be hidden when bottom tray is shrunk.
@@ -184,6 +188,15 @@ private:
 	 */
 	bool setVisibleAndFitWidths(EResizeState object_type, bool visible);
 
+	/**
+	 * Shows/hides panel with specified well button (IM or Notification)
+	 *
+	 * @param[in] object_type - type of well button to be processed.
+	 *		Must be one of RS_IM_WELL or RS_NOTIFICATION_WELL.
+	 * @param[in] visible - flag specified whether button should be shown or hidden.
+	 */
+	void showWellButton(EResizeState object_type, bool visible);
+
 	MASK mResizeState;
 
 	typedef std::map<EResizeState, LLPanel*> state_object_map_t;
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index 1f92686a43..e39384b7b2 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -229,6 +229,11 @@ void LLSysWellChiclet::setNewMessagesState(bool new_messages)
 void LLSysWellChiclet::updateWidget(bool is_window_empty)
 {
 	mButton->setEnabled(!is_window_empty);
+
+	LLSD params;
+	params["well_empty"] = is_window_empty;
+	params["well_name"] = getName();
+	notifyParent(params);
 }
 // virtual
 BOOL LLSysWellChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index b6d7bf8dd0..c34a367c32 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -339,8 +339,8 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
          min_height="28"
          top="0"
          name="im_well_panel"
-         width="35"
-         min_width="35"
+         width="37"
+         min_width="37"
          user_resize="false">
             <chiclet_im_well
              max_displayed_count="99"
@@ -388,22 +388,10 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
          layout="topleft"
          min_height="28"
          top="0"
-         left_pad="3"
          name="notification_well_panel"
-         width="40"
-         min_width="40"
+         width="37"
+         min_width="37"
          user_resize="false">
-         <icon
-         auto_resize="false"
-         color="0 0 0 0"
-         follows="left|right"
-         height="10"
-         image_name="spacer24.tga"
-         layout="topleft"
-         left="0"
-         min_width="4"
-         top="0"
-         width="5" />
             <chiclet_notification
              flash_period="0.25"
              follows="right"
@@ -434,17 +422,6 @@ image_pressed_selected  "Lit" + "Selected" - there are new messages and the Well
                    function="Button.SetDockableFloaterToggle"
                    parameter="notification_well_window" />
               </button>
-         <icon
-         auto_resize="false"
-         color="0 0 0 0"
-         follows="left|right"
-         height="10"
-         image_name="spacer24.tga"
-         layout="topleft"
-         left="0"
-         min_width="4"
-         top="0"
-         width="5" />
 	    </chiclet_notification>
         </layout_panel>
     </layout_stack>
-- 
cgit v1.2.3


From 088a878f42e8ed4c2b1f63bea100ad47ac69d1f5 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Tue, 30 Mar 2010 15:43:28 +0100
Subject: fix linux build error.

---
 indra/newview/llvoiceclient.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index d8319f3cc3..2238acd643 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1151,8 +1151,8 @@ private:
 	void load();
 	void save();
 
-	static F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in);
-	static F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in);
+	static F32 transformFromLegacyVolume(F32 volume_in);
+	static F32 transformToLegacyVolume(F32 volume_in);
 
 	typedef std::map<LLUUID, F32> speaker_data_map_t;
 	speaker_data_map_t mSpeakersData;
-- 
cgit v1.2.3


From 7b801ca15de795c12b81a0e348d145881168e8ef Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Tue, 30 Mar 2010 15:51:40 +0100
Subject: EXT-6589 "Are you sure you want to teleport.." dialog has broken
 "[LOCATION]" tag

---
 indra/newview/llpanelplaces.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 34cef1bee7..54455afa4f 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -551,7 +551,9 @@ void LLPanelPlaces::onTeleportButtonClicked()
 		{
 			LLSD payload;
 			payload["asset_id"] = mItem->getAssetUUID();
-			LLNotificationsUtil::add("TeleportFromLandmark", LLSD(), payload);
+			LLSD args; 
+			args["LOCATION"] = mItem->getName(); 
+			LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
 		}
 		else if (mPlaceInfoType == AGENT_INFO_TYPE ||
 				 mPlaceInfoType == REMOTE_PLACE_INFO_TYPE ||
-- 
cgit v1.2.3


From 5861a2faf2b5e5bf88bc5732e6a77406e3fcbaef Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 11:49:15 -0400
Subject: EXT-3414 : Move static backgroundfetch methods and variables to
 llinventorymodel subclass

Created LLInventoryModelBackgroundFetch file for handling background fetch.
---
 indra/newview/CMakeLists.txt              |   2 +
 indra/newview/llfloaterworldmap.cpp       |   3 +-
 indra/newview/llfolderview.cpp            |   3 +-
 indra/newview/llfolderviewitem.cpp        |   9 +-
 indra/newview/llinventorybridge.cpp       |   3 +-
 indra/newview/llinventoryfilter.cpp       |   5 +-
 indra/newview/llinventorymodel.cpp        | 554 +-----------------------------
 indra/newview/llinventorymodel.h          |  44 ---
 indra/newview/llinventorypanel.cpp        |   3 +-
 indra/newview/llpanellandmarks.cpp        |   5 +-
 indra/newview/llpanelmaininventory.cpp    |  11 +-
 indra/newview/llpaneloutfitsinventory.cpp |   3 +-
 indra/newview/llpreviewgesture.cpp        |   5 +-
 indra/newview/llstartup.cpp               |   4 +-
 indra/newview/lltexturectrl.cpp           |   7 +-
 indra/newview/llviewerinventory.cpp       |   3 +-
 16 files changed, 42 insertions(+), 622 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index f45237a73c..5c7e9c8db2 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -253,6 +253,7 @@ set(viewer_SOURCE_FILES
     llinventoryfilter.cpp
     llinventoryfunctions.cpp
     llinventorymodel.cpp
+    llinventorymodelbackgroundfetch.cpp
     llinventoryobserver.cpp
     llinventorypanel.cpp
     lljoystickbutton.cpp
@@ -754,6 +755,7 @@ set(viewer_HEADER_FILES
     llinventoryfilter.h
     llinventoryfunctions.h
     llinventorymodel.h
+    llinventorymodelbackgroundfetch.h
     llinventoryobserver.h
     llinventorypanel.h
     lljoystickbutton.h
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 391e63f730..f05bd8574f 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -52,6 +52,7 @@
 #include "llfloaterreg.h"		// getTypedInstance()
 #include "llfocusmgr.h"
 #include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventoryobserver.h"
 #include "lllandmarklist.h"
 #include "lllineeditor.h"
@@ -322,7 +323,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
 
 		// Start speculative download of landmarks
 		const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
-		gInventory.startBackgroundFetch(landmark_folder_id);
+		LLInventoryModelBackgroundFetch::instance().start(landmark_folder_id);
 
 		childSetFocus("location", TRUE);
 		gFocusMgr.triggerFocusFlash();
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 149bbe805d..4fbd1efbef 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -39,6 +39,7 @@
 #include "llinventoryclipboard.h" // *TODO: remove this once hack below gone.
 #include "llinventoryfilter.h"
 #include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "llfoldertype.h"
 #include "llfloaterinventory.h"// hacked in for the bonus context menu items.
@@ -943,7 +944,7 @@ void LLFolderView::draw()
 	}
 	else
 	{
-		if (gInventory.backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
+		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() || mCompletedFilterGeneration < mFilter->getMinRequiredGeneration())
 		{
 			mStatusText = LLTrans::getString("Searching");
 			//font->renderUTF8(mStatusText, 0, 2, 1, sSearchStatusColor, LLFontGL::LEFT, LLFontGL::TOP, LLFontGL::NORMAL,  LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index bb4c75d3ac..ecbaac5743 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -38,6 +38,7 @@
 #include "llfoldervieweventlistener.h"
 #include "llinventorybridge.h"	// for LLItemBridge in LLInventorySort::operator()
 #include "llinventoryfilter.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llpanel.h"
 #include "llviewercontrol.h"	// gSavedSettings
 #include "llviewerwindow.h"		// Argh, only for setCursor()
@@ -992,16 +993,16 @@ void LLFolderViewItem::draw()
 		if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getRootFolderID()))
 		{
 			// Descendent of my inventory.
-			root_is_loading = gInventory.myInventoryFetchInProgress();
+			root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress();
 		}
 		if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getLibraryRootFolderID()))
 		{
 			// Descendent of library
-			root_is_loading = gInventory.libraryFetchInProgress();
+			root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress();
 		}
 			
 		if ( (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime"))
-			|| (LLInventoryModel::backgroundFetchActive() && root_is_loading && mShowLoadStatus) )
+			|| (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && root_is_loading && mShowLoadStatus) )
 		{
 			std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) ";
 			font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor,
@@ -1317,7 +1318,7 @@ void LLFolderViewFolder::filter( LLInventoryFilter& filter)
 	// when applying a filter, matching folders get their contents downloaded first
 	if (filter.isNotDefault() && getFiltered(filter.getMinRequiredGeneration()) && (mListener && !gInventory.isCategoryComplete(mListener->getUUID())))
 	{
-		gInventory.startBackgroundFetch(mListener->getUUID());
+		LLInventoryModelBackgroundFetch::instance().start(mListener->getUUID());
 	}
 
 	// now query children
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index efd23c36ca..899a70303b 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -52,6 +52,7 @@
 #include "llinventoryclipboard.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
@@ -729,7 +730,7 @@ BOOL LLInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const
 
 		if (*type == DAD_CATEGORY)
 		{
-			gInventory.startBackgroundFetch(obj->getUUID());
+			LLInventoryModelBackgroundFetch::instance().start(obj->getUUID());
 		}
 
 		rv = TRUE;
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index cd20d64ca8..1a488175ac 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -37,7 +37,8 @@
 // viewer includes
 #include "llfoldervieweventlistener.h"
 #include "llfolderviewitem.h"
-#include "llinventorymodel.h"	// gInventory.backgroundFetchActive()
+#include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llviewercontrol.h"
 #include "llfolderview.h"
 
@@ -713,7 +714,7 @@ const std::string& LLInventoryFilter::getFilterText()
 		filtered_by_all_types = FALSE;
 	}
 
-	if (!gInventory.backgroundFetchActive()
+	if (!LLInventoryModelBackgroundFetch::instance().backgroundFetchActive()
 		&& filtered_by_type
 		&& !filtered_by_all_types)
 	{
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 41f0b430e8..96b9bbb725 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -57,32 +57,16 @@
 #include "process.h"
 #endif
 
-BOOL LLInventoryModel::sBackgroundFetchActive = FALSE;
-BOOL LLInventoryModel::sAllFoldersFetched = FALSE;
-BOOL LLInventoryModel::sMyInventoryFetchStarted = FALSE;
-BOOL LLInventoryModel::sLibraryFetchStarted = FALSE;
-S32  LLInventoryModel::sNumFetchRetries = 0;
-F32  LLInventoryModel::sMinTimeBetweenFetches = 0.3f;
-F32  LLInventoryModel::sMaxTimeBetweenFetches = 10.f;
-BOOL LLInventoryModel::sTimelyFetchPending = FALSE;
-LLFrameTimer LLInventoryModel::sFetchTimer;
-S16 LLInventoryModel::sBulkFetchCount = 0;
-BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE;
-
 // Increment this if the inventory contents change in a non-backwards-compatible way.
 // For viewer 2, the addition of link items makes a pre-viewer-2 cache incorrect.
 const S32 LLInventoryModel::sCurrentInvCacheVersion = 2;
-
-// RN: for some reason, using std::queue in the header file confuses the compiler which things it's an xmlrpc_queue
-static std::deque<LLUUID> sFetchQueue;
+BOOL LLInventoryModel::sFirstTimeInViewer2 = TRUE;
 
 ///----------------------------------------------------------------------------
 /// Local function declarations, constants, enums, and typedefs
 ///----------------------------------------------------------------------------
 
 //BOOL decompress_file(const char* src_filename, const char* dst_filename);
-const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
-const S32 MAX_FETCH_RETRIES = 10;
 const char CACHE_FORMAT_STRING[] = "%s.inv"; 
 
 struct InventoryIDPtrLess
@@ -1345,542 +1329,6 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
 	return cat->fetchDescendents();
 }
 
-//Initialize statics.
-bool LLInventoryModel::isBulkFetchProcessingComplete()
-{
-	return sFetchQueue.empty() && sBulkFetchCount<=0;
-}
-
-class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
-{
-	public:
-		LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
-		//LLInventoryModelFetchDescendentsResponder() {};
-		void result(const LLSD& content);
-		void error(U32 status, const std::string& reason);
-	public:
-		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
-	protected:
-		LLSD mRequestSD;
-};
-
-//If we get back a normal response, handle it here
-void  LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
-{
-	if (content.has("folders"))	
-	{
-
-		for(LLSD::array_const_iterator folder_it = content["folders"].beginArray();
-			folder_it != content["folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			
-
-			//LLUUID agent_id = folder_sd["agent_id"];
-
-			//if(agent_id != gAgent.getID())	//This should never happen.
-			//{
-			//	llwarns << "Got a UpdateInventoryItem for the wrong agent."
-			//			<< llendl;
-			//	break;
-			//}
-
-			LLUUID parent_id = folder_sd["folder_id"];
-			LLUUID owner_id = folder_sd["owner_id"];
-			S32    version  = (S32)folder_sd["version"].asInteger();
-			S32    descendents = (S32)folder_sd["descendents"].asInteger();
-			LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
-
-            if (parent_id.isNull())
-            {
-			    LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-			    for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
-				    item_it != folder_sd["items"].endArray();
-				    ++item_it)
-			    {	
-                    const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
-                    if (lost_uuid.notNull())
-                    {
-				        LLSD item = *item_it;
-				        titem->unpackMessage(item);
-				
-                        LLInventoryModel::update_list_t update;
-                        LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
-                        update.push_back(new_folder);
-                        gInventory.accountForUpdate(update);
-
-                        titem->setParent(lost_uuid);
-                        titem->updateParentOnServer(FALSE);
-                        gInventory.updateItem(titem);
-                        gInventory.notifyObservers("fetchDescendents");
-                        
-                    }
-                }
-            }
-
-	        LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id);
-			if (!pcat)
-			{
-				continue;
-			}
-
-			for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray();
-				category_it != folder_sd["categories"].endArray();
-				++category_it)
-			{	
-				LLSD category = *category_it;
-				tcategory->fromLLSD(category); 
-							
-				if (LLInventoryModel::sMyInventoryFetchStarted ||
-					LLInventoryModel::sLibraryFetchStarted)
-				{
-					sFetchQueue.push_back(tcategory->getUUID());
-				}
-				else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
-				{
-					gInventory.updateCategory(tcategory);
-				}
-
-			}
-			LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-			for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
-				item_it != folder_sd["items"].endArray();
-				++item_it)
-			{	
-				LLSD item = *item_it;
-				titem->unpackMessage(item);
-				
-				gInventory.updateItem(titem);
-			}
-
-			// set version and descendentcount according to message.
-			LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id);
-			if(cat)
-			{
-				cat->setVersion(version);
-				cat->setDescendentCount(descendents);
-				cat->determineFolderType();
-			}
-
-		}
-	}
-		
-	if (content.has("bad_folders"))
-	{
-		for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray();
-			folder_it != content["bad_folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			
-			//These folders failed on the dataserver.  We probably don't want to retry them.
-			llinfos << "Folder " << folder_sd["folder_id"].asString() 
-					<< "Error: " << folder_sd["error"].asString() << llendl;
-		}
-	}
-
-	LLInventoryModel::incrBulkFetch(-1);
-	
-	if (LLInventoryModel::isBulkFetchProcessingComplete())
-	{
-		llinfos << "Inventory fetch completed" << llendl;
-		LLInventoryModel::setAllFoldersFetched();
-	}
-	
-	gInventory.notifyObservers("fetchDescendents");
-}
-
-//If we get back an error (not found, etc...), handle it here
-void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
-{
-	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
-		<< status << ": " << reason << llendl;
-						
-	LLInventoryModel::incrBulkFetch(-1);
-
-	if (status==499)		//timed out.  Let's be awesome!
-	{
-		for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
-			folder_it != mRequestSD["folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			LLUUID folder_id = folder_sd["folder_id"];
-			sFetchQueue.push_front(folder_id);
-		}
-	}
-	else
-	{
-		if (LLInventoryModel::isBulkFetchProcessingComplete())
-		{
-			LLInventoryModel::setAllFoldersFetched();
-		}
-	}
-	gInventory.notifyObservers("fetchDescendents");
-}
-
-//static   Bundle up a bunch of requests to send all at once.
-void LLInventoryModel::bulkFetch(std::string url)
-{
-	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
-	//If there are items in sFetchQueue, we want to check the time since the last bulkFetch was 
-	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
-	//Stopbackgroundfetch will be run from the Responder instead of here.  
-
-	S16 max_concurrent_fetches=8;
-	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
-	if (sMinTimeBetweenFetches < new_min_time) sMinTimeBetweenFetches=new_min_time;  //HACK!  See above.
-	
-	if(gDisconnected 
-	|| sBulkFetchCount > max_concurrent_fetches
-	|| sFetchTimer.getElapsedTimeF32() < sMinTimeBetweenFetches)
-	{
-		return; // just bail if we are disconnected.
-	}	
-
-	U32 folder_count=0;
-	U32 max_batch_size=5;
-
-	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
-
-	LLSD body;
-	LLSD body_lib;
-	while( !(sFetchQueue.empty() ) && (folder_count < max_batch_size) )
-	{
-        if (sFetchQueue.front().isNull()) //DEV-17797
-        {
-			LLSD folder_sd;
-			folder_sd["folder_id"]		= LLUUID::null.asString();
-			folder_sd["owner_id"]		= gAgent.getID();
-			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
-			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-			body["folders"].append(folder_sd);
-            folder_count++;
-        }
-        else
-        {
-				
-
-		    LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
-		
-		    if (cat)
-		    {
-			    if ( LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			    {
-				    LLSD folder_sd;
-				    folder_sd["folder_id"]		= cat->getUUID();
-				    folder_sd["owner_id"]		= cat->getOwnerID();
-				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
-				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-				    
-				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
-					    body_lib["folders"].append(folder_sd);
-				    else
-					    body["folders"].append(folder_sd);
-				    folder_count++;
-			    }
-			    if (sMyInventoryFetchStarted ||
-					sLibraryFetchStarted)
-			    {	//Already have this folder but append child folders to list.
-				    // add all children to queue
-				    parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID());
-				    if (cat_it != gInventory.mParentChildCategoryTree.end())
-				    {
-					    cat_array_t* child_categories = cat_it->second;
-    
-					    for (S32 child_num = 0; child_num < child_categories->count(); child_num++)
-					    {
-						    sFetchQueue.push_back(child_categories->get(child_num)->getUUID());
-					    }
-				    }
-    
-			    }
-		    }
-        }
-		sFetchQueue.pop_front();
-	}
-		
-		if (folder_count > 0)
-		{
-			sBulkFetchCount++;
-			if (body["folders"].size())
-			{
-				LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
-			}
-			if (body_lib["folders"].size())
-			{
-				std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
-				LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
-			}
-			sFetchTimer.reset();
-		}
-	else if (isBulkFetchProcessingComplete())
-	{
-		setAllFoldersFetched();
-	}	
-}
-
-bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
-{
-	for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
-		 it != sFetchQueue.end(); ++it)
-	{
-		const LLUUID& fetch_id = *it;
-		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
-			return false;
-	}
-	return true;
-}
-
-/* static */
-bool LLInventoryModel::libraryFetchStarted()
-{
-	return sLibraryFetchStarted;
-}
-
-/* static */
-bool LLInventoryModel::libraryFetchCompleted()
-{
-	return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
-}
-
-/* static */
-bool LLInventoryModel::libraryFetchInProgress()
-{
-	return libraryFetchStarted() && !libraryFetchCompleted();
-}
-	
-/* static */
-bool LLInventoryModel::myInventoryFetchStarted()
-{
-	return sMyInventoryFetchStarted;
-}
-
-/* static */
-bool LLInventoryModel::myInventoryFetchCompleted()
-{
-	return myInventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
-}
-
-/* static */
-bool LLInventoryModel::myInventoryFetchInProgress()
-{
-	return myInventoryFetchStarted() && !myInventoryFetchCompleted();
-}
-
-// static
-bool LLInventoryModel::isEverythingFetched()
-{
-	return sAllFoldersFetched;
-}
-
-//static
-BOOL LLInventoryModel::backgroundFetchActive()
-{
-	return sBackgroundFetchActive;
-}
-
-void LLInventoryModel::startBackgroundFetch(const LLUUID& cat_id)
-{
-	if (!sAllFoldersFetched)
-	{
-		sBackgroundFetchActive = TRUE;
-		if (cat_id.isNull())
-		{
-			if (!sMyInventoryFetchStarted)
-			{
-				sMyInventoryFetchStarted = TRUE;
-				sFetchQueue.push_back(gInventory.getRootFolderID());
-				gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
-			}
-			if (!sLibraryFetchStarted)
-			{
-				sLibraryFetchStarted = TRUE;
-				sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
-				gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
-			}
-		}
-		else
-		{
-			// specific folder requests go to front of queue
-			if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
-			{
-				sFetchQueue.push_front(cat_id);
-				gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
-			}
-			if (cat_id == gInventory.getLibraryRootFolderID())
-			{
-				sLibraryFetchStarted = TRUE;
-			}
-			if (cat_id == gInventory.getRootFolderID())
-			{
-				sMyInventoryFetchStarted = TRUE;
-			}
-		}
-	}
-}
-
-//static
-void LLInventoryModel::findLostItems()
-{
-	sBackgroundFetchActive = TRUE;
-    sFetchQueue.push_back(LLUUID::null);
-    gIdleCallbacks.addFunction(&LLInventoryModel::backgroundFetch, NULL);
-}
-
-//static
-void LLInventoryModel::stopBackgroundFetch()
-{
-	if (sBackgroundFetchActive)
-	{
-		sBackgroundFetchActive = FALSE;
-		gIdleCallbacks.deleteFunction(&LLInventoryModel::backgroundFetch, NULL);
-		sBulkFetchCount=0;
-		sMinTimeBetweenFetches=0.0f;
-	}
-}
-
-// static
-void LLInventoryModel::setAllFoldersFetched()
-{
-	if (sMyInventoryFetchStarted &&
-		sLibraryFetchStarted)
-	{
-		sAllFoldersFetched = TRUE;
-	}
-	stopBackgroundFetch();
-}
-
-//static 
-void LLInventoryModel::backgroundFetch(void*)
-{
-	if (sBackgroundFetchActive && gAgent.getRegion())
-	{
-		//If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
-		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
-		if (!url.empty()) 
-		{
-			bulkFetch(url);
-			return;
-		}
-		
-		//DEPRECATED OLD CODE FOLLOWS.
-		// no more categories to fetch, stop fetch process
-		if (sFetchQueue.empty())
-		{
-			llinfos << "Inventory fetch completed" << llendl;
-
-			setAllFoldersFetched();
-			return;
-		}
-
-		F32 fast_fetch_time = lerp(sMinTimeBetweenFetches, sMaxTimeBetweenFetches, 0.1f);
-		F32 slow_fetch_time = lerp(sMinTimeBetweenFetches, sMaxTimeBetweenFetches, 0.5f);
-		if (sTimelyFetchPending && sFetchTimer.getElapsedTimeF32() > slow_fetch_time)
-		{
-			// double timeouts on failure
-			sMinTimeBetweenFetches = llmin(sMinTimeBetweenFetches * 2.f, 10.f);
-			sMaxTimeBetweenFetches = llmin(sMaxTimeBetweenFetches * 2.f, 120.f);
-			llinfos << "Inventory fetch times grown to (" << sMinTimeBetweenFetches << ", " << sMaxTimeBetweenFetches << ")" << llendl;
-			// fetch is no longer considered "timely" although we will wait for full time-out
-			sTimelyFetchPending = FALSE;
-		}
-
-		while(1)
-		{
-			if (sFetchQueue.empty())
-			{
-				break;
-			}
-
-			if(gDisconnected)
-			{
-				// just bail if we are disconnected.
-				break;
-			}
-
-			LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
-
-			// category has been deleted, remove from queue.
-			if (!cat)
-			{
-				sFetchQueue.pop_front();
-				continue;
-			}
-			
-			if (sFetchTimer.getElapsedTimeF32() > sMinTimeBetweenFetches && 
-				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			{
-				// category exists but has no children yet, fetch the descendants
-				// for now, just request every time and rely on retry timer to throttle
-				if (cat->fetchDescendents())
-				{
-					sFetchTimer.reset();
-					sTimelyFetchPending = TRUE;
-				}
-				else
-				{
-					//  The catagory also tracks if it has expired and here it says it hasn't
-					//  yet.  Get out of here because nothing is going to happen until we
-					//  update the timers.
-					break;
-				}
-			}
-			// do I have all my children?
-			else if (gInventory.isCategoryComplete(sFetchQueue.front()))
-			{
-				// finished with this category, remove from queue
-				sFetchQueue.pop_front();
-
-				// add all children to queue
-				parent_cat_map_t::iterator cat_it = gInventory.mParentChildCategoryTree.find(cat->getUUID());
-				if (cat_it != gInventory.mParentChildCategoryTree.end())
-				{
-					cat_array_t* child_categories = cat_it->second;
-
-					for (S32 child_num = 0; child_num < child_categories->count(); child_num++)
-					{
-						sFetchQueue.push_back(child_categories->get(child_num)->getUUID());
-					}
-				}
-
-				// we received a response in less than the fast time
-				if (sTimelyFetchPending && sFetchTimer.getElapsedTimeF32() < fast_fetch_time)
-				{
-					// shrink timeouts based on success
-					sMinTimeBetweenFetches = llmax(sMinTimeBetweenFetches * 0.8f, 0.3f);
-					sMaxTimeBetweenFetches = llmax(sMaxTimeBetweenFetches * 0.8f, 10.f);
-					//llinfos << "Inventory fetch times shrunk to (" << sMinTimeBetweenFetches << ", " << sMaxTimeBetweenFetches << ")" << llendl;
-				}
-
-				sTimelyFetchPending = FALSE;
-				continue;
-			}
-			else if (sFetchTimer.getElapsedTimeF32() > sMaxTimeBetweenFetches)
-			{
-				// received first packet, but our num descendants does not match db's num descendants
-				// so try again later
-				LLUUID fetch_id = sFetchQueue.front();
-				sFetchQueue.pop_front();
-
-				if (sNumFetchRetries++ < MAX_FETCH_RETRIES)
-				{
-					// push on back of queue
-					sFetchQueue.push_back(fetch_id);
-				}
-				sTimelyFetchPending = FALSE;
-				sFetchTimer.reset();
-				break;
-			}
-
-			// not enough time has elapsed to do a new fetch
-			break;
-		}
-	}
-}
 
 void LLInventoryModel::cache(
 	const LLUUID& parent_folder_id,
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 2a2b48ce3c..700e5317f7 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -81,7 +81,6 @@ public:
 		CHILDREN_MAYBE
 	};
 
-	// These are used a lot...
 	typedef LLDynamicArray<LLPointer<LLViewerInventoryCategory> > cat_array_t;
 	typedef LLDynamicArray<LLPointer<LLViewerInventoryItem> > item_array_t;
 	typedef std::set<LLUUID> changed_items_t;
@@ -368,8 +367,6 @@ public:
 	// Utility Functions
 	void removeItem(const LLUUID& item_id);
 	
-    static void findLostItems();
-
 	// Data about the agent's root folder and root library folder
 	// are stored here, rather than in LLAgent where it used to be, because
 	// gInventory is a singleton and represents the agent's inventory.
@@ -501,12 +498,6 @@ private:
 	LLUUID mLibraryRootFolderID;
 	LLUUID mLibraryOwnerID;
 
-	static BOOL sTimelyFetchPending;
-	static S32  sNumFetchRetries;
-	static LLFrameTimer sFetchTimer;
-	static F32 sMinTimeBetweenFetches;
-	static F32 sMaxTimeBetweenFetches;
-
 	// Expected inventory cache version
 	const static S32 sCurrentInvCacheVersion;
 	
@@ -532,41 +523,6 @@ public:
 	// *NOTE: DEBUG functionality
 	void dumpInventory() const;
 
-
-	////////////////////////////////////////////////////////////////////////////////
-	// Bulk fetch
-public:
-	// Start and stop background breadth-first fetching of inventory contents.
-	// This gets triggered when performing a filter-search
-	void startBackgroundFetch(const LLUUID& cat_id = LLUUID::null);
-	static BOOL backgroundFetchActive();
-	static bool isEverythingFetched();
-	static void backgroundFetch(void*); // background fetch idle function
-	static void incrBulkFetch(S16 fetching) {  sBulkFetchCount+=fetching; if (sBulkFetchCount<0) sBulkFetchCount=0; }
-	static void stopBackgroundFetch(); // stop fetch process
-	static bool isBulkFetchProcessingComplete();
-
-	// Add categories to a list to be fetched in bulk.
-	static void bulkFetch(std::string url);
-
-	static bool libraryFetchStarted();
-	static bool libraryFetchCompleted();
-	static bool libraryFetchInProgress();
-	
-	static bool myInventoryFetchStarted();
-	static bool myInventoryFetchCompleted();
-	static bool myInventoryFetchInProgress();
-	
-private:
- 	static BOOL sMyInventoryFetchStarted;
-	static BOOL sLibraryFetchStarted;
-	static BOOL sAllFoldersFetched; 
-	static void setAllFoldersFetched();
-
-	// completing the fetch once per session should be sufficient
-	static BOOL sBackgroundFetchActive;
-	static S16 sBulkFetchCount;
-
 	////////////////////////////////////////////////////////////////////////////////
 	// Login status
 public:
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 9a2d76e7e2..f38659ba5f 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -43,6 +43,7 @@
 #include "llimfloater.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llsidepanelinventory.h"
 #include "llsidetray.h"
 #include "llscrollcontainer.h"
@@ -643,7 +644,7 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask)
 	if(handled)
 	{
 		ECursorType cursor = getWindow()->getCursor();
-		if (LLInventoryModel::backgroundFetchActive() && cursor == UI_CURSOR_ARROW)
+		if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && cursor == UI_CURSOR_ARROW)
 		{
 			// replace arrow cursor with arrow and hourglass cursor
 			getWindow()->setCursor(UI_CURSOR_WORKING);
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index e3b8581aca..4cde02c1ce 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -49,6 +49,7 @@
 #include "lldndbutton.h"
 #include "llfloaterworldmap.h"
 #include "llfolderviewitem.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "lllandmarkactions.h"
 #include "llplacesinventorybridge.h"
@@ -556,7 +557,7 @@ void LLLandmarksPanel::initLibraryInventoryPanel()
 	const LLUUID &landmarks_cat = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false, true);
 	if (landmarks_cat.notNull())
 	{
-		gInventory.startBackgroundFetch(landmarks_cat);
+		LLInventoryModelBackgroundFetch::instance().start(landmarks_cat);
 	}
 
 	// Expanding "Library" tab for new users who have no landmarks in "My Inventory".
@@ -620,7 +621,7 @@ void LLLandmarksPanel::onAccordionExpandedCollapsed(const LLSD& param, LLPlacesI
 		  if (!gInventory.isCategoryComplete(cat_id))
 		*/
 		{
-			gInventory.startBackgroundFetch(cat_id);
+			LLInventoryModelBackgroundFetch::instance().start(cat_id);
 		}
 
 		// Apply filter substring because it might have been changed
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index d40141c91d..dbc40959d7 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -40,6 +40,7 @@
 #include "llfloaterinventory.h"
 #include "llinventorybridge.h"
 #include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "llfiltereditor.h"
 #include "llfloaterreg.h"
@@ -419,7 +420,7 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
 		return;
 	}
 
-	gInventory.startBackgroundFetch();
+	LLInventoryModelBackgroundFetch::instance().start();
 
 	mFilterSubString = search_string;
 	if (mActivePanel->getFilterSubString().empty() && mFilterSubString.empty())
@@ -499,7 +500,7 @@ void LLPanelMainInventory::onFilterSelected()
 	if (filter->isActive())
 	{
 		// If our filter is active we may be the first thing requiring a fetch so we better start it here.
-		gInventory.startBackgroundFetch();
+		LLInventoryModelBackgroundFetch::instance().start();
 	}
 	setFilterTextFromFilter();
 }
@@ -566,11 +567,11 @@ void LLPanelMainInventory::updateItemcountText()
 
 	std::string text = "";
 
-	if (LLInventoryModel::backgroundFetchActive())
+	if (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive())
 	{
 		text = getString("ItemcountFetching", string_args);
 	}
-	else if (LLInventoryModel::isEverythingFetched())
+	else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
 	{
 		text = getString("ItemcountCompleted", string_args);
 	}
@@ -600,7 +601,7 @@ void LLPanelMainInventory::toggleFindOptions()
 		if (parent_floater) // Seraph: Fix this, shouldn't be null even for sidepanel
 			parent_floater->addDependentFloater(mFinderHandle);
 		// start background fetch of folders
-		gInventory.startBackgroundFetch();
+		LLInventoryModelBackgroundFetch::instance().start();
 	}
 	else
 	{
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 6bda7d1546..dd320f8328 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -43,6 +43,7 @@
 #include "llfloaterinventory.h"
 #include "llfoldervieweventlistener.h"
 #include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "lllandmark.h"
 #include "lllineeditor.h"
@@ -217,7 +218,7 @@ void LLPanelOutfitsInventory::onSearchEdit(const std::string& string)
 		getRootFolder()->scrollToShowSelection();
 	}
 
-	gInventory.startBackgroundFetch();
+	LLInventoryModelBackgroundFetch::instance().start();
 
 	if (mActivePanel->getFilterSubString().empty() && string.empty())
 	{
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index aa7b7b8636..77b72dc728 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -42,6 +42,7 @@
 #include "llstring.h"
 #include "lldir.h"
 #include "llfloaterreg.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llmultigesture.h"
 #include "llnotificationsutil.h"
 #include "llvfile.h"
@@ -131,10 +132,10 @@ LLPreviewGesture* LLPreviewGesture::show(const LLUUID& item_id, const LLUUID& ob
 	
 	// Start speculative download of sounds and animations
 	const LLUUID animation_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_ANIMATION);
-	gInventory.startBackgroundFetch(animation_folder_id);
+	LLInventoryModelBackgroundFetch::instance().start(animation_folder_id);
 
 	const LLUUID sound_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_SOUND);
-	gInventory.startBackgroundFetch(sound_folder_id);
+	LLInventoryModelBackgroundFetch::instance().start(sound_folder_id);
 
 	// this will call refresh when we have everything.
 	LLViewerInventoryItem* item = (LLViewerInventoryItem*)preview->getItem();
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index d75a1424d2..1a1dffe85c 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -62,6 +62,7 @@
 #include "llimfloater.h"
 #include "lllocationhistory.h"
 #include "llimageworker.h"
+
 #include "llloginflags.h"
 #include "llmd5.h"
 #include "llmemorystream.h"
@@ -116,6 +117,7 @@
 #include "llimagebmp.h"
 #include "llinventorybridge.h"
 #include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llfriendcard.h"
 #include "llkeyboard.h"
 #include "llloginhandler.h"			// gLoginHandler, SLURL support
@@ -1846,7 +1848,7 @@ bool idle_startup()
 		}
 
         //DEV-17797.  get null folder.  Any items found here moved to Lost and Found
-        LLInventoryModel::findLostItems();
+        LLInventoryModelBackgroundFetch::instance().findLostItems();
 
 		LLStartUp::setStartupState( STATE_PRECACHE );
 		timeout.reset();
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 2b846d33fc..a1b3c8dabd 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -48,6 +48,7 @@
 #include "llfoldervieweventlistener.h"
 #include "llinventory.h"
 #include "llinventoryfunctions.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llfloaterinventory.h"
@@ -1053,7 +1054,7 @@ public:
 	{
 		// We need to find textures in all folders, so get the main
 		// background download going.
-		gInventory.startBackgroundFetch();
+		LLInventoryModelBackgroundFetch::instance().start();
 		gInventory.removeObserver(this);
 		delete this;
 	}
@@ -1074,9 +1075,9 @@ BOOL LLTextureCtrl::handleMouseDown(S32 x, S32 y, MASK mask)
 	{
 		showPicker(FALSE);
 		//grab textures first...
-		gInventory.startBackgroundFetch(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
+		LLInventoryModelBackgroundFetch::instance().start(gInventory.findCategoryUUIDForType(LLFolderType::FT_TEXTURE));
 		//...then start full inventory fetch.
-		gInventory.startBackgroundFetch();
+		LLInventoryModelBackgroundFetch::instance().start();
 		handled = TRUE;
 	}
 
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 75ec02f8ea..58d02be99a 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -45,6 +45,7 @@
 #include "llviewercontrol.h"
 #include "llconsole.h"
 #include "llinventorymodel.h"
+#include "llinventorymodelbackgroundfetch.h"
 #include "llgesturemgr.h"
 #include "llsidetray.h"
 
@@ -538,7 +539,7 @@ bool LLViewerInventoryCategory::fetchDescendents()
 		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");
 		if (!url.empty()) //Capability found.  Build up LLSD and use it.
 		{
-			gInventory.startBackgroundFetch(mUUID);			
+			LLInventoryModelBackgroundFetch::instance().start(mUUID);			
 		}
 		else
 		{	//Deprecated, but if we don't have a capability, use the old system.
-- 
cgit v1.2.3


From 1751e6add7e9957106f628816f0808c92a67cc6c Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Tue, 30 Mar 2010 19:21:30 +0300
Subject: Fixed gcc-4.1 build.

--HG--
branch : product-engine
---
 indra/newview/llvoiceclient.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index d8319f3cc3..2238acd643 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1151,8 +1151,8 @@ private:
 	void load();
 	void save();
 
-	static F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in);
-	static F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in);
+	static F32 transformFromLegacyVolume(F32 volume_in);
+	static F32 transformToLegacyVolume(F32 volume_in);
 
 	typedef std::map<LLUUID, F32> speaker_data_map_t;
 	speaker_data_map_t mSpeakersData;
-- 
cgit v1.2.3


From b15e34b94207c52d81e310f962e72f4d8030bd94 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 14:21:20 -0400
Subject: EXT-6630 : INFRASTRUCTURE: Pull out -Keys functions from llagent into
 llagentcamera

Orbit/Pan keys were already in llagentcamera.  Pulled alt/walk/left/up/yaw/pitch into llagentcamera.
---
 indra/newview/llagent.cpp       |  67 ++++++---------------
 indra/newview/llagent.h         |  13 ----
 indra/newview/llagentcamera.cpp | 118 ++++++++++++++++++++++++-------------
 indra/newview/llagentcamera.h   | 127 ++++++++++++++++++++++++++++------------
 4 files changed, 186 insertions(+), 139 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 3eeaacf93b..0215dc1309 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -218,13 +218,6 @@ LLAgent::LLAgent() :
 
 	mIsBusy(FALSE),
 
-	mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed
-	mWalkKey(0), // like AtKey, but causes less forward thrust
-	mLeftKey(0),
-	mUpKey(0),
-	mYawKey(0.f),
-	mPitchKey(0.f),
-
 	mControlFlags(0x00000000),
 	mbFlagsDirty(FALSE),
 	mbFlagsNeedReset(FALSE),
@@ -339,7 +332,7 @@ void LLAgent::moveAt(S32 direction, bool reset)
 	// age chat timer so it fades more quickly when you are intentionally moving
 	ageChat();
 
-	setKey(direction, mAtKey);
+	gAgentCamera.setAtKey(LLAgentCamera::directionToKey(direction));
 
 	if (direction > 0)
 	{
@@ -364,7 +357,7 @@ void LLAgent::moveAtNudge(S32 direction)
 	// age chat timer so it fades more quickly when you are intentionally moving
 	ageChat();
 
-	setKey(direction, mWalkKey);
+	gAgentCamera.setWalkKey(LLAgentCamera::directionToKey(direction));
 
 	if (direction > 0)
 	{
@@ -386,7 +379,7 @@ void LLAgent::moveLeft(S32 direction)
 	// age chat timer so it fades more quickly when you are intentionally moving
 	ageChat();
 
-	setKey(direction, mLeftKey);
+	gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
 
 	if (direction > 0)
 	{
@@ -408,7 +401,7 @@ void LLAgent::moveLeftNudge(S32 direction)
 	// age chat timer so it fades more quickly when you are intentionally moving
 	ageChat();
 
-	setKey(direction, mLeftKey);
+	gAgentCamera.setLeftKey(LLAgentCamera::directionToKey(direction));
 
 	if (direction > 0)
 	{
@@ -430,7 +423,7 @@ void LLAgent::moveUp(S32 direction)
 	// age chat timer so it fades more quickly when you are intentionally moving
 	ageChat();
 
-	setKey(direction, mUpKey);
+	gAgentCamera.setUpKey(LLAgentCamera::directionToKey(direction));
 
 	if (direction > 0)
 	{
@@ -449,7 +442,7 @@ void LLAgent::moveUp(S32 direction)
 //-----------------------------------------------------------------------------
 void LLAgent::moveYaw(F32 mag, bool reset_view)
 {
-	mYawKey = mag;
+	gAgentCamera.setYawKey(mag);
 
 	if (mag > 0)
 	{
@@ -471,7 +464,7 @@ void LLAgent::moveYaw(F32 mag, bool reset_view)
 //-----------------------------------------------------------------------------
 void LLAgent::movePitch(F32 mag)
 {
-	mPitchKey = mag;
+	gAgentCamera.setPitchKey(mag);
 
 	if (mag > 0)
 	{
@@ -1048,26 +1041,6 @@ LLQuaternion LLAgent::getQuat() const
 	return mFrameAgent.getQuaternion();
 }
 
-//-----------------------------------------------------------------------------
-// setKey()
-//-----------------------------------------------------------------------------
-void LLAgent::setKey(const S32 direction, S32 &key)
-{
-	if (direction > 0)
-	{
-		key = 1;
-	}
-	else if (direction < 0)
-	{
-		key = -1;
-	}
-	else
-	{
-		key = 0;
-	}
-}
-
-
 //-----------------------------------------------------------------------------
 // getControlFlags()
 //-----------------------------------------------------------------------------
@@ -1537,20 +1510,20 @@ void LLAgent::propagate(const F32 dt)
 	LLFloaterMove *floater_move = LLFloaterReg::findTypedInstance<LLFloaterMove>("moveview");
 	if (floater_move)
 	{
-		floater_move->mForwardButton   ->setToggleState( mAtKey > 0 || mWalkKey > 0 );
-		floater_move->mBackwardButton  ->setToggleState( mAtKey < 0 || mWalkKey < 0 );
-		floater_move->mTurnLeftButton  ->setToggleState( mYawKey > 0.f );
-		floater_move->mTurnRightButton ->setToggleState( mYawKey < 0.f );
-		floater_move->mMoveUpButton    ->setToggleState( mUpKey > 0 );
-		floater_move->mMoveDownButton  ->setToggleState( mUpKey < 0 );
+		floater_move->mForwardButton   ->setToggleState( gAgentCamera.getAtKey() > 0 || gAgentCamera.getWalkKey() > 0 );
+		floater_move->mBackwardButton  ->setToggleState( gAgentCamera.getAtKey() < 0 || gAgentCamera.getWalkKey() < 0 );
+		floater_move->mTurnLeftButton  ->setToggleState( gAgentCamera.getYawKey() > 0.f );
+		floater_move->mTurnRightButton ->setToggleState( gAgentCamera.getYawKey() < 0.f );
+		floater_move->mMoveUpButton    ->setToggleState( gAgentCamera.getUpKey() > 0 );
+		floater_move->mMoveDownButton  ->setToggleState( gAgentCamera.getUpKey() < 0 );
 	}
 
 	// handle rotation based on keyboard levels
 	const F32 YAW_RATE = 90.f * DEG_TO_RAD;				// radians per second
-	yaw(YAW_RATE * mYawKey * dt);
+	yaw(YAW_RATE * gAgentCamera.getYawKey() * dt);
 
 	const F32 PITCH_RATE = 90.f * DEG_TO_RAD;			// radians per second
-	pitch(PITCH_RATE * mPitchKey * dt);
+	pitch(PITCH_RATE * gAgentCamera.getPitchKey() * dt);
 	
 	// handle auto-land behavior
 	if (isAgentAvatarValid())
@@ -1560,7 +1533,7 @@ void LLAgent::propagate(const F32 dt)
 		land_vel.mV[VZ] = 0.f;
 
 		if (!in_air 
-			&& mUpKey < 0 
+			&& gAgentCamera.getUpKey() < 0 
 			&& land_vel.magVecSquared() < MAX_VELOCITY_AUTO_LAND_SQUARED
 			&& gSavedSettings.getBOOL("AutomaticFly"))
 		{
@@ -1569,13 +1542,7 @@ void LLAgent::propagate(const F32 dt)
 		}
 	}
 
-	// clear keys
-	mAtKey = 0;
-	mWalkKey = 0;
-	mLeftKey = 0;
-	mUpKey = 0;
-	mYawKey = 0.f;
-	mPitchKey = 0.f;
+	gAgentCamera.clearGeneralKeys();
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 55d9b292d7..ab4eee8d7d 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -434,19 +434,6 @@ private:
  **                                                                            **
  **                    MOVEMENT
  **/
-	
-	//--------------------------------------------------------------------
-	// Keys
-	//--------------------------------------------------------------------
-public:
-	void			setKey(const S32 direction, S32 &key); // Sets key to +1 for +direction, -1 for -direction
-private:
-	S32 			mAtKey;				// Either 1, 0, or -1. Indicates that movement key is pressed
-	S32				mWalkKey; 			// Like AtKey, but causes less forward thrust
-	S32 			mLeftKey;
-	S32				mUpKey;
-	F32				mYawKey;
-	F32				mPitchKey;
 
 	//--------------------------------------------------------------------
 	// Movement from user input
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 8ff55cafca..394c07b0f4 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -35,6 +35,7 @@
 
 #include "pipeline.h"
 
+// SERAPH clean this up
 #include "llagentlistener.h"
 #include "llagentwearables.h"
 #include "llagentui.h"
@@ -181,6 +182,13 @@ LLAgentCamera::LLAgentCamera() :
 	mTrackFocusObject(TRUE),
 	mUIOffset(0.f),
 
+	mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed
+	mWalkKey(0), // like AtKey, but causes less forward thrust
+	mLeftKey(0),
+	mUpKey(0),
+	mYawKey(0.f),
+	mPitchKey(0.f),
+
 	mOrbitLeftKey(0.f),
 	mOrbitRightKey(0.f),
 	mOrbitUpKey(0.f),
@@ -196,6 +204,10 @@ LLAgentCamera::LLAgentCamera() :
 	mPanOutKey(0.f)
 {
 	mFollowCam.setMaxCameraDistantFromSubject( MAX_CAMERA_DISTANCE_FROM_AGENT );
+
+	clearGeneralKeys();
+	clearOrbitKeys();
+	clearPanKeys();
 }
 
 // Requires gSavedSettings to be initialized.
@@ -1204,17 +1216,15 @@ void LLAgentCamera::updateCamera()
 	LLFloaterCamera* camera_floater = LLFloaterReg::findTypedInstance<LLFloaterCamera>("camera");
 	if (camera_floater)
 	{
-		camera_floater->mRotate->setToggleState(
-		mOrbitRightKey > 0.f,	// left
-		mOrbitUpKey > 0.f,		// top
-		mOrbitLeftKey > 0.f,	// right
-		mOrbitDownKey > 0.f);	// bottom
-
-		camera_floater->mTrack->setToggleState(
-		mPanLeftKey > 0.f,		// left
-		mPanUpKey > 0.f,		// top
-		mPanRightKey > 0.f,		// right
-		mPanDownKey > 0.f);		// bottom
+		camera_floater->mRotate->setToggleState(gAgentCamera.getOrbitRightKey() > 0.f,	// left
+												gAgentCamera.getOrbitUpKey() > 0.f,		// top
+												gAgentCamera.getOrbitLeftKey() > 0.f,	// right
+												gAgentCamera.getOrbitDownKey() > 0.f);	// bottom
+		
+		camera_floater->mTrack->setToggleState(gAgentCamera.getPanLeftKey() > 0.f,		// left
+											   gAgentCamera.getPanUpKey() > 0.f,			// top
+											   gAgentCamera.getPanRightKey() > 0.f,		// right
+											   gAgentCamera.getPanDownKey() > 0.f);		// bottom
 	}
 
 	// Handle camera movement based on keyboard.
@@ -1222,21 +1232,21 @@ void LLAgentCamera::updateCamera()
 	const F32 ORBIT_AROUND_RATE = 90.f * DEG_TO_RAD;		// radians per second
 	const F32 PAN_RATE = 5.f;								// meters per second
 
-	if( mOrbitUpKey || mOrbitDownKey )
+	if (gAgentCamera.getOrbitUpKey() || gAgentCamera.getOrbitDownKey())
 	{
-		F32 input_rate = mOrbitUpKey - mOrbitDownKey;
+		F32 input_rate = gAgentCamera.getOrbitUpKey() - gAgentCamera.getOrbitDownKey();
 		cameraOrbitOver( input_rate * ORBIT_OVER_RATE / gFPSClamped );
 	}
 
-	if( mOrbitLeftKey || mOrbitRightKey)
+	if (gAgentCamera.getOrbitLeftKey() || gAgentCamera.getOrbitRightKey())
 	{
-		F32 input_rate = mOrbitLeftKey - mOrbitRightKey;
-		cameraOrbitAround( input_rate * ORBIT_AROUND_RATE / gFPSClamped );
+		F32 input_rate = gAgentCamera.getOrbitLeftKey() - gAgentCamera.getOrbitRightKey();
+		cameraOrbitAround(input_rate * ORBIT_AROUND_RATE / gFPSClamped);
 	}
 
-	if( mOrbitInKey || mOrbitOutKey )
+	if (gAgentCamera.getOrbitInKey() || gAgentCamera.getOrbitOutKey())
 	{
-		F32 input_rate = mOrbitInKey - mOrbitOutKey;
+		F32 input_rate = gAgentCamera.getOrbitInKey() - gAgentCamera.getOrbitOutKey();
 		
 		LLVector3d to_focus = gAgent.getPosGlobalFromAgent(LLViewerCamera::getInstance()->getOrigin()) - calcFocusPositionTargetGlobal();
 		F32 distance_to_focus = (F32)to_focus.magVec();
@@ -1244,38 +1254,27 @@ void LLAgentCamera::updateCamera()
 		cameraOrbitIn( input_rate * distance_to_focus / gFPSClamped );
 	}
 
-	if( mPanInKey || mPanOutKey )
+	if (gAgentCamera.getPanInKey() || gAgentCamera.getPanOutKey())
 	{
-		F32 input_rate = mPanInKey - mPanOutKey;
-		cameraPanIn( input_rate * PAN_RATE / gFPSClamped );
+		F32 input_rate = gAgentCamera.getPanInKey() - gAgentCamera.getPanOutKey();
+		cameraPanIn(input_rate * PAN_RATE / gFPSClamped);
 	}
 
-	if( mPanRightKey || mPanLeftKey )
+	if (gAgentCamera.getPanRightKey() || gAgentCamera.getPanLeftKey())
 	{
-		F32 input_rate = mPanRightKey - mPanLeftKey;
-		cameraPanLeft( input_rate * -PAN_RATE / gFPSClamped );
+		F32 input_rate = gAgentCamera.getPanRightKey() - gAgentCamera.getPanLeftKey();
+		cameraPanLeft(input_rate * -PAN_RATE / gFPSClamped );
 	}
 
-	if( mPanUpKey || mPanDownKey )
+	if (gAgentCamera.getPanUpKey() || gAgentCamera.getPanDownKey())
 	{
-		F32 input_rate = mPanUpKey - mPanDownKey;
-		cameraPanUp( input_rate * PAN_RATE / gFPSClamped );
+		F32 input_rate = gAgentCamera.getPanUpKey() - gAgentCamera.getPanDownKey();
+		cameraPanUp(input_rate * PAN_RATE / gFPSClamped );
 	}
 
 	// Clear camera keyboard keys.
-	mOrbitLeftKey		= 0.f;
-	mOrbitRightKey		= 0.f;
-	mOrbitUpKey			= 0.f;
-	mOrbitDownKey		= 0.f;
-	mOrbitInKey			= 0.f;
-	mOrbitOutKey		= 0.f;
-
-	mPanRightKey		= 0.f;
-	mPanLeftKey			= 0.f;
-	mPanUpKey			= 0.f;
-	mPanDownKey			= 0.f;
-	mPanInKey			= 0.f;
-	mPanOutKey			= 0.f;
+	gAgentCamera.clearOrbitKeys();
+	gAgentCamera.clearPanKeys();
 
 	// lerp camera focus offset
 	mCameraFocusOffset = lerp(mCameraFocusOffset, mCameraFocusOffsetTarget, LLCriticalDamp::getInterpolant(CAMERA_FOCUS_HALF_LIFE));
@@ -2850,5 +2849,44 @@ EPointAtType LLAgentCamera::getPointAtType()
 	return POINTAT_TARGET_NONE;
 }
 
+void LLAgentCamera::clearGeneralKeys()
+{
+	mAtKey 				= 0;
+	mWalkKey 			= 0;
+	mLeftKey 			= 0;
+	mUpKey 				= 0;
+	mYawKey 			= 0.f;
+	mPitchKey 			= 0.f;
+}
+
+void LLAgentCamera::clearOrbitKeys()
+{
+	mOrbitLeftKey		= 0.f;
+	mOrbitRightKey		= 0.f;
+	mOrbitUpKey			= 0.f;
+	mOrbitDownKey		= 0.f;
+	mOrbitInKey			= 0.f;
+	mOrbitOutKey		= 0.f;
+}
+
+void LLAgentCamera::clearPanKeys()
+{
+	mPanRightKey		= 0.f;
+	mPanLeftKey			= 0.f;
+	mPanUpKey			= 0.f;
+	mPanDownKey			= 0.f;
+	mPanInKey			= 0.f;
+	mPanOutKey			= 0.f;
+}
+
+// static
+S32 LLAgentCamera::directionToKey(S32 direction)
+{
+	if (direction > 0) return 1;
+	if (direction < 0) return -1;
+	return 0;
+}
+
+
 // EOF
 
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 2074864336..9d226aeb81 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -175,42 +175,6 @@ private:
 	LLVector3		mCameraLag;						// Third person camera lag
 	LLVector3		mCameraUpVector;				// Camera's up direction in world coordinates (determines the 'roll' of the view)
 
-	//--------------------------------------------------------------------
-	// Orbit
-	//--------------------------------------------------------------------
-public:
-	void			setOrbitLeftKey(F32 mag)	{ mOrbitLeftKey = mag; }
-	void			setOrbitRightKey(F32 mag)	{ mOrbitRightKey = mag; }
-	void			setOrbitUpKey(F32 mag)		{ mOrbitUpKey = mag; }
-	void			setOrbitDownKey(F32 mag)	{ mOrbitDownKey = mag; }
-	void			setOrbitInKey(F32 mag)		{ mOrbitInKey = mag; }
-	void			setOrbitOutKey(F32 mag)		{ mOrbitOutKey = mag; }
-private:
-	F32				mOrbitLeftKey;
-	F32				mOrbitRightKey;
-	F32				mOrbitUpKey;
-	F32				mOrbitDownKey;
-	F32				mOrbitInKey;
-	F32				mOrbitOutKey;
-
-	//--------------------------------------------------------------------
-	// Pan
-	//--------------------------------------------------------------------
-public:
-	void			setPanLeftKey(F32 mag)		{ mPanLeftKey = mag; }
-	void			setPanRightKey(F32 mag)		{ mPanRightKey = mag; }
-	void			setPanUpKey(F32 mag)		{ mPanUpKey = mag; }
-	void			setPanDownKey(F32 mag)		{ mPanDownKey = mag; }
-	void			setPanInKey(F32 mag)		{ mPanInKey = mag; }
-	void			setPanOutKey(F32 mag)		{ mPanOutKey = mag; }
-private:
-	F32				mPanUpKey;						
-	F32				mPanDownKey;					
-	F32				mPanLeftKey;					
-	F32				mPanRightKey;					
-	F32				mPanInKey;
-	F32				mPanOutKey;	
-	
 	//--------------------------------------------------------------------
 	// Follow
 	//--------------------------------------------------------------------
@@ -358,6 +322,97 @@ private:
 public:
 	F32				mHUDTargetZoom;	// Target zoom level for HUD objects (used when editing)
 	F32				mHUDCurZoom; 	// Current animated zoom level for HUD objects
+
+
+/********************************************************************************
+ **                                                                            **
+ **                    KEYS
+ **/
+
+public:
+	S32				getAtKey() const		{ return mAtKey; }
+	S32				getWalkKey() const		{ return mWalkKey; }
+	S32				getLeftKey() const		{ return mLeftKey; }
+	F32				getUpKey() const		{ return mUpKey; }
+	F32				getYawKey() const		{ return mYawKey; }
+	F32				getPitchKey() const		{ return mPitchKey; }
+
+	void			setAtKey(S32 mag)		{ mAtKey = mag; }
+	void			setWalkKey(S32 mag)		{ mWalkKey = mag; }
+	void			setLeftKey(S32 mag)		{ mLeftKey = mag; }
+	void			setUpKey(F32 mag)		{ mUpKey = mag; }
+	void			setYawKey(F32 mag)		{ mYawKey = mag; }
+	void			setPitchKey(F32 mag)	{ mPitchKey = mag; }
+
+	void			clearGeneralKeys();
+	static S32		directionToKey(S32 direction); // Changes direction to -1/0/1
+
+private:
+	S32 			mAtKey;				// Either 1, 0, or -1. Indicates that movement key is pressed
+	S32				mWalkKey; 			// Like AtKey, but causes less forward thrust
+	S32 			mLeftKey;
+	S32				mUpKey;
+	F32				mYawKey;
+	F32				mPitchKey;
+
+	//--------------------------------------------------------------------
+	// Orbit
+	//--------------------------------------------------------------------
+public:
+	F32				getOrbitLeftKey() const		{ return mOrbitLeftKey; }
+	F32				getOrbitRightKey() const	{ return mOrbitRightKey; }
+	F32				getOrbitUpKey() const		{ return mOrbitUpKey; }
+	F32				getOrbitDownKey() const		{ return mOrbitDownKey; }
+	F32				getOrbitInKey() const		{ return mOrbitInKey; }
+	F32				getOrbitOutKey() const		{ return mOrbitOutKey; }
+
+	void			setOrbitLeftKey(F32 mag)	{ mOrbitLeftKey = mag; }
+	void			setOrbitRightKey(F32 mag)	{ mOrbitRightKey = mag; }
+	void			setOrbitUpKey(F32 mag)		{ mOrbitUpKey = mag; }
+	void			setOrbitDownKey(F32 mag)	{ mOrbitDownKey = mag; }
+	void			setOrbitInKey(F32 mag)		{ mOrbitInKey = mag; }
+	void			setOrbitOutKey(F32 mag)		{ mOrbitOutKey = mag; }
+
+	void			clearOrbitKeys();
+private:
+	F32				mOrbitLeftKey;
+	F32				mOrbitRightKey;
+	F32				mOrbitUpKey;
+	F32				mOrbitDownKey;
+	F32				mOrbitInKey;
+	F32				mOrbitOutKey;
+
+	//--------------------------------------------------------------------
+	// Pan
+	//--------------------------------------------------------------------
+public:
+	F32				getPanLeftKey() const		{ return mPanLeftKey; }
+	F32				getPanRightKey() const	{ return mPanRightKey; }
+	F32				getPanUpKey() const		{ return mPanUpKey; }
+	F32				getPanDownKey() const		{ return mPanDownKey; }
+	F32				getPanInKey() const		{ return mPanInKey; }
+	F32				getPanOutKey() const		{ return mPanOutKey; }
+
+	void			setPanLeftKey(F32 mag)		{ mPanLeftKey = mag; }
+	void			setPanRightKey(F32 mag)		{ mPanRightKey = mag; }
+	void			setPanUpKey(F32 mag)		{ mPanUpKey = mag; }
+	void			setPanDownKey(F32 mag)		{ mPanDownKey = mag; }
+	void			setPanInKey(F32 mag)		{ mPanInKey = mag; }
+	void			setPanOutKey(F32 mag)		{ mPanOutKey = mag; }
+
+	void			clearPanKeys();
+private:
+	F32				mPanUpKey;						
+	F32				mPanDownKey;					
+	F32				mPanLeftKey;					
+	F32				mPanRightKey;					
+	F32				mPanInKey;
+	F32				mPanOutKey;
+
+/**                    Keys
+ **                                                                            **
+ *******************************************************************************/
+
 };
 
 extern LLAgentCamera gAgentCamera;
-- 
cgit v1.2.3


From 7a8c6a235e6f287b27303bd5733d4b7989ddd6c2 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 15:05:48 -0400
Subject: EXT-6632 : INFRASTRUCTURE: LLAgentCamera / LLAgent header file /
 #include cleanup

Took out unnecessary #includes from llagentcamera.*
---
 indra/newview/llagentcamera.cpp            | 36 +++++-------------------------
 indra/newview/llagentcamera.h              | 22 +-----------------
 indra/newview/llpanelprimmediacontrols.cpp |  1 +
 3 files changed, 7 insertions(+), 52 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 394c07b0f4..bb06255fd1 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -35,51 +35,25 @@
 
 #include "pipeline.h"
 
-// SERAPH clean this up
-#include "llagentlistener.h"
-#include "llagentwearables.h"
-#include "llagentui.h"
+#include "llagent.h"
 #include "llanimationstates.h"
-#include "llbottomtray.h"
-#include "llcallingcard.h"
-#include "llchannelmanager.h"
-#include "llconsole.h"
-//#include "llfirstuse.h"
 #include "llfloatercamera.h"
 #include "llfloatercustomize.h"
 #include "llfloaterreg.h"
-#include "llfloatertools.h"
-#include "llgroupactions.h"
-#include "llgroupmgr.h"
-#include "llhomelocationresponder.h"
 #include "llhudmanager.h"
 #include "lljoystickbutton.h"
-#include "llmorphview.h"
-#include "llmoveview.h"
-#include "llnavigationbar.h" // to show/hide navigation bar when changing mouse look state
-#include "llnearbychatbar.h"
-#include "llnotificationsutil.h"
-#include "llparcel.h"
-#include "llsdutil.h"
-#include "llsidetray.h"
-#include "llsky.h"
+#include "llselectmgr.h"
 #include "llsmoothstep.h"
-#include "llstatusbar.h"
-#include "llteleportflags.h"
-#include "lltool.h"
 #include "lltoolmgr.h"
-#include "lltrans.h"
+#include "llviewercamera.h"
 #include "llviewercontrol.h"
-#include "llviewerdisplay.h"
 #include "llviewerjoystick.h"
-#include "llviewermediafocus.h"
 #include "llviewerobjectlist.h"
-#include "llviewerparcelmgr.h"
-#include "llviewerstats.h"
+#include "llviewerregion.h"
+#include "llviewerwindow.h"
 #include "llvoavatarself.h"
 #include "llwindow.h"
 #include "llworld.h"
-#include "llworldmap.h"
 
 using namespace LLVOAvatarDefines;
 
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 9d226aeb81..56a0e68bd1 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -33,32 +33,12 @@
 #ifndef LL_LLAGENTCAMERA_H
 #define LL_LLAGENTCAMERA_H
 
-#include "indra_constants.h"
-#include "llevent.h" 				// LLObservable base class
-#include "llagent.h"
-#include "llagentaccess.h"
-#include "llagentconstants.h"
-#include "llagentdata.h" 			// gAgentID, gAgentSessionID
-#include "llcharacter.h" 			// LLAnimPauseRequest
 #include "llfollowcam.h" 			// Ventrella
 #include "llhudeffectlookat.h" 		// EPointAtType
 #include "llhudeffectpointat.h" 	// ELookAtType
-#include "llpointer.h"
-#include "lluicolor.h"
-#include "llvoavatardefines.h"
 
-class LLChat;
-class LLVOAvatarSelf;
-class LLViewerRegion;
-class LLMotion;
-class LLToolset;
-class LLMessageSystem;
-class LLPermissions;
-class LLHost;
-class LLFriendObserver;
 class LLPickInfo;
-class LLViewerObject;
-class LLAgentDropGroupViewerNode;
+class LLVOAvatarSelf;
 
 //--------------------------------------------------------------------
 // Types
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index a9ec01f33a..ab2f9284f7 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -32,6 +32,7 @@
 #include "llviewerprecompiledheaders.h"
 
 //LLPanelPrimMediaControls
+#include "llagent.h"
 #include "llagentcamera.h"
 #include "llparcel.h"
 #include "llpanel.h"
-- 
cgit v1.2.3


From dbcd12a4d14412de6850fbf89dfe58b1f799222d Mon Sep 17 00:00:00 2001
From: "Nyx (Neal Orman)" <nyx@lindenlab.com>
Date: Tue, 30 Mar 2010 15:17:14 -0400
Subject: EXT-6633 enable basic multiwearables demo

Fixed several areas of code that were not multi-wearables enabled.
Specifically allowed for the wearing of created outfits that had links to
multiple items of the same type. Such outfits can be created by dragging
multiple items of the same type into an unworn outfit folder. When you
wear the outfit, all items (up to 5 per type) should be worn. Does not
affect right-click options or other buttons.

Code reviewed by Vir.
---
 indra/newview/llagentwearables.cpp      | 122 +++++++++++---------------------
 indra/newview/llappearancemgr.cpp       |   3 +-
 indra/newview/llinventorybridge.cpp     |   4 +-
 indra/newview/llsidepanelappearance.cpp |  10 +--
 4 files changed, 49 insertions(+), 90 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 1187455971..cc866e7504 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -40,6 +40,7 @@
 #include "llinventorybridge.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
+#include "llmd5.h"
 #include "llnotificationsutil.h"
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
@@ -1578,6 +1579,7 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a
 			{
 				LLSD payload;
 				payload["wearable_type"] = (S32)type;
+				payload["wearable_index"] = (S32)index;
 				// Bring up view-modal dialog: Save changes? Yes, No, Cancel
 				LLNotificationsUtil::add("WearableSave", LLSD(), payload, &LLAgentWearables::onRemoveWearableDialog);
 				return;
@@ -1591,22 +1593,21 @@ void LLAgentWearables::removeWearable(const EWearableType type, bool do_remove_a
 }
 
 
-// MULTI_WEARABLE: assuming one wearable per type.
-// MULTI_WEARABLE: hardwiring 0th elt for now - notification needs to change.
 // static 
 bool LLAgentWearables::onRemoveWearableDialog(const LLSD& notification, const LLSD& response)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	EWearableType type = (EWearableType)notification["payload"]["wearable_type"].asInteger();
+	S32 index = (S32)notification["payload"]["wearable_index"].asInteger();
 	switch(option)
 	{
 		case 0:  // "Save"
-			gAgentWearables.saveWearable(type, 0);
-			gAgentWearables.removeWearableFinal(type, false, 0);
+			gAgentWearables.saveWearable(type, index);
+			gAgentWearables.removeWearableFinal(type, false, index);
 			break;
 
 		case 1:  // "Don't Save"
-			gAgentWearables.removeWearableFinal(type, false, 0);
+			gAgentWearables.removeWearableFinal(type, false, index);
 			break;
 
 		case 2: // "Cancel"
@@ -1665,23 +1666,19 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 {
 	llinfos << "setWearableOutfit() start" << llendl;
 
-	BOOL wearables_to_remove[WT_COUNT];
-	wearables_to_remove[WT_SHAPE]		= FALSE;
-	wearables_to_remove[WT_SKIN]		= FALSE;
-	wearables_to_remove[WT_HAIR]		= FALSE;
-	wearables_to_remove[WT_EYES]		= FALSE;
-	wearables_to_remove[WT_SHIRT]		= remove;
-	wearables_to_remove[WT_PANTS]		= remove;
-	wearables_to_remove[WT_SHOES]		= remove;
-	wearables_to_remove[WT_SOCKS]		= remove;
-	wearables_to_remove[WT_JACKET]		= remove;
-	wearables_to_remove[WT_GLOVES]		= remove;
-	wearables_to_remove[WT_UNDERSHIRT]	= (!gAgent.isTeen()) & remove;
-	wearables_to_remove[WT_UNDERPANTS]	= (!gAgent.isTeen()) & remove;
-	wearables_to_remove[WT_SKIRT]		= remove;
-	wearables_to_remove[WT_ALPHA]		= remove;
-	wearables_to_remove[WT_TATTOO]		= remove;
-
+	// TODO: Removed check for ensuring that teens don't remove undershirt and underwear. Handle later
+	if (remove)
+	{
+		// note: shirt is the first non-body part wearable item. Update if wearable order changes.
+		// This loop should remove all clothing, but not any body parts
+		for (S32 type = 0; type < (S32)WT_COUNT; type++)
+		{
+			if (LLWearableDictionary::getAssetType((EWearableType)type) == LLAssetType::AT_CLOTHING)
+			{
+				removeWearable((EWearableType)type, true, 0);
+			}
+		}
+	}
 
 	S32 count = wearables.count();
 	llassert(items.count() == count);
@@ -1696,67 +1693,23 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		if (new_wearable)
 		{
 			const EWearableType type = new_wearable->getType();
-			wearables_to_remove[type] = FALSE;
-
-			// MULTI_WEARABLE: using 0th
-			LLWearable* old_wearable = getWearable(type, 0);
-			if (old_wearable)
+			new_wearable->setItemID(new_item->getUUID());
+			if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART)
 			{
-				const LLUUID& old_item_id = getWearableItemID(type, 0);
-				if ((old_wearable->getAssetID() == new_wearable->getAssetID()) &&
-				    (old_item_id == new_item->getUUID()))
-				{
-					lldebugs << "No change to wearable asset and item: " << LLWearableDictionary::getInstance()->getWearableEntry(type) << llendl;
-					continue;
-				}
-				
-				// Assumes existing wearables are not dirty.
-				if (old_wearable->isDirty())
-				{
-					llassert(0);
-					continue;
-				}
+				// exactly one wearable per body part
+				setWearable(type,0,new_wearable);
 			}
-
-			new_wearable->setItemID(new_item->getUUID());
-			setWearable(type,0,new_wearable);
-		}
-	}
-
-	std::vector<LLWearable*> wearables_being_removed;
-
-	for (i = 0; i < WT_COUNT; i++)
-	{
-		if (wearables_to_remove[i])
-		{
-			// MULTI_WEARABLE: assuming 0th
-			LLWearable* wearable = getWearable((EWearableType)i, 0);
-			const LLUUID &item_id = getWearableItemID((EWearableType)i,0);
-			gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-			if (wearable)
+			else
 			{
-				wearables_being_removed.push_back(wearable);
+				pushWearable(type,new_wearable);
 			}
-			removeWearable((EWearableType)i,true,0);
+			wearableUpdated(new_wearable);
+			checkWearableAgainstInventory(new_wearable);
 		}
 	}
 
 	gInventory.notifyObservers();
 
-
-	std::vector<LLWearable*>::iterator wearable_iter;
-
-	for (wearable_iter = wearables_being_removed.begin(); 
-		 wearable_iter != wearables_being_removed.end();
-		 ++wearable_iter)
-	{
-		LLWearable* wearablep = *wearable_iter;
-		if (wearablep)
-		{
-			wearablep->removeFromAvatar(TRUE);
-		}
-	}
-
 	if (mAvatarObject)
 	{
 		mAvatarObject->setCompositeUpdatesEnabled(TRUE);
@@ -1820,6 +1773,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	LLInventoryItem* new_item = gInventory.getItem(notification["payload"]["item_id"].asUUID());
+	U32 index = gAgentWearables.getWearableIndex(wearable);
 	if (!new_item)
 	{
 		delete wearable;
@@ -1829,8 +1783,7 @@ bool LLAgentWearables::onSetWearableDialog(const LLSD& notification, const LLSD&
 	switch(option)
 	{
 		case 0:  // "Save"
-// MULTI_WEARABLE: assuming 0th
-			gAgentWearables.saveWearable(wearable->getType(),0);
+			gAgentWearables.saveWearable(wearable->getType(),index);
 			gAgentWearables.setWearableFinal(new_item, wearable);
 			break;
 
@@ -1920,30 +1873,35 @@ void LLAgentWearables::queryWearableCache()
 	for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
 	{
 		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
-		LLUUID hash;
+		LLMD5 hash;
+		bool hash_computed = false;
 		for (U8 i=0; i < baked_dict->mWearables.size(); i++)
 		{
 			const EWearableType baked_type = baked_dict->mWearables[i];
-			// MULTI_WEARABLE: not order-dependent
 			const U32 num_wearables = getWearableCount(baked_type);
 			for (U32 index = 0; index < num_wearables; ++index)
 			{
 				const LLWearable* wearable = getWearable(baked_type,index);
 				if (wearable)
 				{
-					hash ^= wearable->getAssetID();
+					LLUUID asset_id = wearable->getAssetID();
+					hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+					hash_computed = true;
 				}
 			}
 		}
-		if (hash.notNull())
+		hash.finalize();
+		if (hash_computed)
 		{
-			hash ^= baked_dict->mWearablesHashID;
+			LLUUID hash_id;
+			hash.raw_digest(hash_id.mData);
+			hash_id ^= baked_dict->mWearablesHashID;
 			num_queries++;
 			// *NOTE: make sure at least one request gets packed
 
 			//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
 			gMessageSystem->nextBlockFast(_PREHASH_WearableData);
-			gMessageSystem->addUUIDFast(_PREHASH_ID, hash);
+			gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id);
 			gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index);
 		}
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index f2d15757c9..18d6ac6bbc 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1027,7 +1027,7 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 	getDescendentsOfAssetType(category, wear_items, LLAssetType::AT_CLOTHING, false);
 	// Reduce wearables to max of one per type.
 	removeDuplicateItems(wear_items);
-	filterWearableItems(wear_items, 1);
+	filterWearableItems(wear_items, 5);
 
 	// - Attachments: include COF contents only if appending.
 	LLInventoryModel::item_array_t obj_items;
@@ -1117,7 +1117,6 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,
 					items.put(item);
 					wearables.put(wearable);
 				}
-				break;
 			}
 		}
 	}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index ceeffea1c9..b42c14c840 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4958,9 +4958,9 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 			if( !(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES ) ) //&&
 				//!((!gAgent.isTeen()) && ( type==WT_UNDERPANTS || type==WT_UNDERSHIRT )) )
 			{
-				// MULTI_WEARABLE: FIXME HACK - always remove all
 				bool do_remove_all = false;
-				gAgentWearables.removeWearable( type, do_remove_all, 0 );
+				U32 index = gAgentWearables.getWearableIndex(wearable);
+				gAgentWearables.removeWearable( type, do_remove_all, index );
 			}
 		}
 	}
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 4a24a5dec5..a072440fa4 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -357,11 +357,13 @@ void LLSidepanelAppearance::fetchInventory()
 	LLUUID item_id;
 	for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
 	{
-		// MULTI_WEARABLE:
-		item_id = gAgentWearables.getWearableItemID((EWearableType)type,0);
-		if(item_id.notNull())
+		for (U32 index = 0; index < gAgentWearables.getWearableCount((EWearableType)type); ++index)
 		{
-			ids.push_back(item_id);
+			item_id = gAgentWearables.getWearableItemID((EWearableType)type, index);
+			if(item_id.notNull())
+			{
+				ids.push_back(item_id);
+			}
 		}
 	}
 
-- 
cgit v1.2.3


From b0d2cd38f0fe0ba6c63141259062f2552f817145 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 15:21:53 -0400
Subject: EXT-6634 : INFRASTRUCTURE: Generic header file / #include cleanup

LLAgent.* cleanup
Also took out some constants from llagent.cpp that aren't being used.
---
 indra/newview/llagent.cpp     | 28 ++--------------------------
 indra/newview/llagent.h       |  3 ---
 indra/newview/llhudobject.cpp |  1 +
 indra/newview/llimview.cpp    |  1 +
 4 files changed, 4 insertions(+), 29 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 0215dc1309..69d4bba16d 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -44,7 +44,6 @@
 #include "llcallingcard.h"
 #include "llchannelmanager.h"
 #include "llconsole.h"
-//#include "llfirstuse.h"
 #include "llfloatercamera.h"
 #include "llfloatercustomize.h"
 #include "llfloaterreg.h"
@@ -90,41 +89,18 @@ const BOOL ANIMATE = TRUE;
 const U8 AGENT_STATE_TYPING =	0x04;
 const U8 AGENT_STATE_EDITING =  0x10;
 
-//drone wandering constants
-const F32 MAX_WANDER_TIME = 20.f;						// seconds
-const F32 MAX_HEADING_HALF_ERROR = 0.2f;				// radians
-const F32 WANDER_MAX_SLEW_RATE = 2.f * DEG_TO_RAD;		// radians / frame
-const F32 WANDER_TARGET_MIN_DISTANCE = 10.f;			// meters
-
 // Autopilot constants
-const F32 AUTOPILOT_HEADING_HALF_ERROR = 10.f * DEG_TO_RAD;	// radians
-const F32 AUTOPILOT_MAX_SLEW_RATE = 1.f * DEG_TO_RAD;		// radians / frame
-const F32 AUTOPILOT_STOP_DISTANCE = 2.f;					// meters
 const F32 AUTOPILOT_HEIGHT_ADJUST_DISTANCE = 8.f;			// meters
 const F32 AUTOPILOT_MIN_TARGET_HEIGHT_OFF_GROUND = 1.f;	// meters
 const F32 AUTOPILOT_MAX_TIME_NO_PROGRESS = 1.5f;		// seconds
 
-// face editing constants
-const LLVector3d FACE_EDIT_CAMERA_OFFSET(0.4f, -0.05f, 0.07f);
-const LLVector3d FACE_EDIT_TARGET_OFFSET(0.f, 0.f, 0.05f);
-
-const F32 METERS_PER_WHEEL_CLICK = 1.f;
-
-const F32 MAX_TIME_DELTA = 1.f;
+const F32 MAX_VELOCITY_AUTO_LAND_SQUARED = 4.f * 4.f;
+const F64 CHAT_AGE_FAST_RATE = 3.0;
 
 // fidget constants
 const F32 MIN_FIDGET_TIME = 8.f; // seconds
 const F32 MAX_FIDGET_TIME = 20.f; // seconds
 
-const S32 MAX_NUM_CHAT_POSITIONS = 10;
-
-const F32 MAX_VELOCITY_AUTO_LAND_SQUARED = 4.f * 4.f;
-
-const F32 MAX_FOCUS_OFFSET = 20.f;
-
-const F32 MIN_RADIUS_ALPHA_SIZZLE = 0.5f;
-
-const F64 CHAT_AGE_FAST_RATE = 3.0;
 
 // The agent instance.
 LLAgent gAgent;
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index ab4eee8d7d..a460077b7e 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -39,9 +39,6 @@
 #include "llagentconstants.h"
 #include "llagentdata.h" 			// gAgentID, gAgentSessionID
 #include "llcharacter.h" 			// LLAnimPauseRequest
-#include "llfollowcam.h" 			// Ventrella
-#include "llhudeffectlookat.h" 		// EPointAtType
-#include "llhudeffectpointat.h" 	// ELookAtType
 #include "llpointer.h"
 #include "lluicolor.h"
 #include "llvoavatardefines.h"
diff --git a/indra/newview/llhudobject.cpp b/indra/newview/llhudobject.cpp
index dc55aba0db..2b73ed1dcd 100644
--- a/indra/newview/llhudobject.cpp
+++ b/indra/newview/llhudobject.cpp
@@ -43,6 +43,7 @@
 #include "llhudeffectbeam.h"
 #include "llhudeffecttrail.h"
 #include "llhudeffectlookat.h"
+#include "llhudeffectpointat.h"
 
 #include "llvoicevisualizer.h"
 
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index a8d876e8a3..0099cd114f 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -36,6 +36,7 @@
 
 #include "llfloaterreg.h"
 #include "llfontgl.h"
+#include "llgl.h"
 #include "llrect.h"
 #include "llerror.h"
 #include "llbutton.h"
-- 
cgit v1.2.3


From 6d82b0c0a2b470452b86332f3b51d7d720bc7341 Mon Sep 17 00:00:00 2001
From: "Nyx (Neal Orman)" <nyx@lindenlab.com>
Date: Tue, 30 Mar 2010 15:30:59 -0400
Subject: EXT-6633 enable demo of multiwearables code

cleaning up a merge conflict where HG didn't quite do the right thing.
---
 indra/newview/llagentwearables.cpp | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index e1ecdbc3c4..aa8f8c22b1 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1629,18 +1629,10 @@ void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& it
 		if (new_wearable)
 		{
 			const EWearableType type = new_wearable->getType();
-				// Special case where you're putting on a wearable that has the same assetID
-				// as the previous (e.g. wear a shirt then wear a copy of that shirt) since in this
-				// case old_wearable == new_wearable.
-				if (old_wearable == new_wearable)
-				{
-					old_wearable->setLabelUpdated();
-					new_wearable->setName(new_item->getName());
-					new_wearable->setItemID(new_item->getUUID());
-				}
-
-			
+		
+			new_wearable->setName(new_item->getName());
 			new_wearable->setItemID(new_item->getUUID());
+
 			if (LLWearableDictionary::getAssetType(type) == LLAssetType::AT_BODYPART)
 			{
 				// exactly one wearable per body part
-- 
cgit v1.2.3


From bf49c0fcc472504db6e876620bedef56bc200da4 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 15:38:16 -0400
Subject: Rename to remove camelcase from llinventorymodelbackground files.

---
 indra/newview/llinventorymodelbackgroundfetch.cpp | 603 ++++++++++++++++++++++
 1 file changed, 603 insertions(+)
 create mode 100644 indra/newview/llinventorymodelbackgroundfetch.cpp

(limited to 'indra')

diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
new file mode 100644
index 0000000000..72e5c0dd75
--- /dev/null
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -0,0 +1,603 @@
+/** 
+ * @file llinventorymodel.cpp
+ * @brief Implementation of the inventory model used to track agent inventory.
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llinventorymodelbackgroundfetch.h"
+
+// Seraph clean this up
+#include "llagent.h"
+#include "llinventorypanel.h"
+#include "llviewercontrol.h"
+#include "llviewermessage.h"
+#include "llviewerwindow.h"
+#include "llappviewer.h"
+#include "llviewerregion.h"
+#include "llcallbacklist.h"
+
+const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
+const S32 MAX_FETCH_RETRIES = 10;
+
+// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
+static std::deque<LLUUID> sFetchQueue;
+bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
+{
+	for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
+		 it != sFetchQueue.end(); ++it)
+	{
+		const LLUUID& fetch_id = *it;
+		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
+			return false;
+	}
+	return true;
+}
+
+
+LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
+	mBackgroundFetchActive(FALSE),
+	mAllFoldersFetched(FALSE),
+	mInventoryFetchStarted(FALSE),
+	mLibraryFetchStarted(FALSE),
+	mNumFetchRetries(0),
+	mMinTimeBetweenFetches(0.3f),
+	mMaxTimeBetweenFetches(10.f),
+	mTimelyFetchPending(FALSE),
+	mBulkFetchCount(0)
+{
+}
+
+LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
+{
+}
+
+bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete()
+{
+	return sFetchQueue.empty() && mBulkFetchCount<=0;
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchStarted()
+{
+	return mLibraryFetchStarted;
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchCompleted()
+{
+	return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchInProgress()
+{
+	return libraryFetchStarted() && !libraryFetchCompleted();
+}
+	
+bool LLInventoryModelBackgroundFetch::inventoryFetchStarted()
+{
+	return mInventoryFetchStarted;
+}
+
+bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted()
+{
+	return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
+}
+
+bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress()
+{
+	return inventoryFetchStarted() && !inventoryFetchCompleted();
+}
+
+bool LLInventoryModelBackgroundFetch::isEverythingFetched()
+{
+	return mAllFoldersFetched;
+}
+
+BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive()
+{
+	return mBackgroundFetchActive;
+}
+
+void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
+{
+	if (!mAllFoldersFetched)
+	{
+		mBackgroundFetchActive = TRUE;
+		if (cat_id.isNull())
+		{
+			if (!mInventoryFetchStarted)
+			{
+				mInventoryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getRootFolderID());
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+			if (!mLibraryFetchStarted)
+			{
+				mLibraryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+		}
+		else
+		{
+			// specific folder requests go to front of queue
+			if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
+			{
+				sFetchQueue.push_front(cat_id);
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+			if (cat_id == gInventory.getLibraryRootFolderID())
+			{
+				mLibraryFetchStarted = TRUE;
+			}
+			if (cat_id == gInventory.getRootFolderID())
+			{
+				mInventoryFetchStarted = TRUE;
+			}
+		}
+	}
+}
+
+void LLInventoryModelBackgroundFetch::findLostItems()
+{
+	mBackgroundFetchActive = TRUE;
+    sFetchQueue.push_back(LLUUID::null);
+    gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+}
+
+void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
+{
+	if (mBackgroundFetchActive)
+	{
+		mBackgroundFetchActive = FALSE;
+		gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+		mBulkFetchCount=0;
+		mMinTimeBetweenFetches=0.0f;
+	}
+}
+
+void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
+{
+	if (mInventoryFetchStarted &&
+		mLibraryFetchStarted)
+	{
+		mAllFoldersFetched = TRUE;
+	}
+	stopBackgroundFetch();
+}
+
+void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
+{
+	LLInventoryModelBackgroundFetch::instance().backgroundFetch();
+}
+
+void LLInventoryModelBackgroundFetch::backgroundFetch()
+{
+	if (mBackgroundFetchActive && gAgent.getRegion())
+	{
+		//If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
+		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
+		if (!url.empty()) 
+		{
+			bulkFetch(url);
+			return;
+		}
+		
+		//DEPRECATED OLD CODE FOLLOWS.
+		// no more categories to fetch, stop fetch process
+		if (sFetchQueue.empty())
+		{
+			llinfos << "Inventory fetch completed" << llendl;
+
+			setAllFoldersFetched();
+			return;
+		}
+
+		F32 fast_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.1f);
+		F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f);
+		if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time)
+		{
+			// double timeouts on failure
+			mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f);
+			mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f);
+			llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+			// fetch is no longer considered "timely" although we will wait for full time-out
+			mTimelyFetchPending = FALSE;
+		}
+
+		while(1)
+		{
+			if (sFetchQueue.empty())
+			{
+				break;
+			}
+
+			if(gDisconnected)
+			{
+				// just bail if we are disconnected.
+				break;
+			}
+
+			LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+
+			// category has been deleted, remove from queue.
+			if (!cat)
+			{
+				sFetchQueue.pop_front();
+				continue;
+			}
+			
+			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
+				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
+			{
+				// category exists but has no children yet, fetch the descendants
+				// for now, just request every time and rely on retry timer to throttle
+				if (cat->fetchDescendents())
+				{
+					mFetchTimer.reset();
+					mTimelyFetchPending = TRUE;
+				}
+				else
+				{
+					//  The catagory also tracks if it has expired and here it says it hasn't
+					//  yet.  Get out of here because nothing is going to happen until we
+					//  update the timers.
+					break;
+				}
+			}
+			// do I have all my children?
+			else if (gInventory.isCategoryComplete(sFetchQueue.front()))
+			{
+				// finished with this category, remove from queue
+				sFetchQueue.pop_front();
+
+				// add all children to queue
+				LLInventoryModel::cat_array_t* categories;
+				LLInventoryModel::item_array_t* items;
+				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+				for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+					 it != categories->end();
+					 ++it)
+				{
+					sFetchQueue.push_back((*it)->getUUID());
+				}
+
+				// we received a response in less than the fast time
+				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+				{
+					// shrink timeouts based on success
+					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
+					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
+					//llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+				}
+
+				mTimelyFetchPending = FALSE;
+				continue;
+			}
+			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
+			{
+				// received first packet, but our num descendants does not match db's num descendants
+				// so try again later
+				LLUUID fetch_id = sFetchQueue.front();
+				sFetchQueue.pop_front();
+
+				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+				{
+					// push on back of queue
+					sFetchQueue.push_back(fetch_id);
+				}
+				mTimelyFetchPending = FALSE;
+				mFetchTimer.reset();
+				break;
+			}
+
+			// not enough time has elapsed to do a new fetch
+			break;
+		}
+	}
+}
+
+void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) 
+{  
+	mBulkFetchCount += fetching; 
+	if (mBulkFetchCount < 0)
+	{
+		mBulkFetchCount = 0; 
+	}
+}
+
+
+class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
+{
+	public:
+		LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
+		//LLInventoryModelFetchDescendentsResponder() {};
+		void result(const LLSD& content);
+		void error(U32 status, const std::string& reason);
+	public:
+		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
+	protected:
+		LLSD mRequestSD;
+};
+
+//If we get back a normal response, handle it here
+void  LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
+{
+	if (content.has("folders"))	
+	{
+
+		for(LLSD::array_const_iterator folder_it = content["folders"].beginArray();
+			folder_it != content["folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			
+
+			//LLUUID agent_id = folder_sd["agent_id"];
+
+			//if(agent_id != gAgent.getID())	//This should never happen.
+			//{
+			//	llwarns << "Got a UpdateInventoryItem for the wrong agent."
+			//			<< llendl;
+			//	break;
+			//}
+
+			LLUUID parent_id = folder_sd["folder_id"];
+			LLUUID owner_id = folder_sd["owner_id"];
+			S32    version  = (S32)folder_sd["version"].asInteger();
+			S32    descendents = (S32)folder_sd["descendents"].asInteger();
+			LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
+
+            if (parent_id.isNull())
+            {
+			    LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+			    for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
+				    item_it != folder_sd["items"].endArray();
+				    ++item_it)
+			    {	
+                    const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+                    if (lost_uuid.notNull())
+                    {
+				        LLSD item = *item_it;
+				        titem->unpackMessage(item);
+				
+                        LLInventoryModel::update_list_t update;
+                        LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
+                        update.push_back(new_folder);
+                        gInventory.accountForUpdate(update);
+
+                        titem->setParent(lost_uuid);
+                        titem->updateParentOnServer(FALSE);
+                        gInventory.updateItem(titem);
+                        gInventory.notifyObservers("fetchDescendents");
+                        
+                    }
+                }
+            }
+
+	        LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id);
+			if (!pcat)
+			{
+				continue;
+			}
+
+			for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray();
+				category_it != folder_sd["categories"].endArray();
+				++category_it)
+			{	
+				LLSD category = *category_it;
+				tcategory->fromLLSD(category); 
+							
+				if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() ||
+					LLInventoryModelBackgroundFetch::instance().libraryFetchStarted())
+				{
+					sFetchQueue.push_back(tcategory->getUUID());
+				}
+				else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
+				{
+					gInventory.updateCategory(tcategory);
+				}
+
+			}
+			LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+			for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
+				item_it != folder_sd["items"].endArray();
+				++item_it)
+			{	
+				LLSD item = *item_it;
+				titem->unpackMessage(item);
+				
+				gInventory.updateItem(titem);
+			}
+
+			// set version and descendentcount according to message.
+			LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id);
+			if(cat)
+			{
+				cat->setVersion(version);
+				cat->setDescendentCount(descendents);
+				cat->determineFolderType();
+			}
+
+		}
+	}
+		
+	if (content.has("bad_folders"))
+	{
+		for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray();
+			folder_it != content["bad_folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			
+			//These folders failed on the dataserver.  We probably don't want to retry them.
+			llinfos << "Folder " << folder_sd["folder_id"].asString() 
+					<< "Error: " << folder_sd["error"].asString() << llendl;
+		}
+	}
+
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+	
+	if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+	{
+		llinfos << "Inventory fetch completed" << llendl;
+		LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+	}
+	
+	gInventory.notifyObservers("fetchDescendents");
+}
+
+//If we get back an error (not found, etc...), handle it here
+void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
+{
+	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
+		<< status << ": " << reason << llendl;
+						
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+
+	if (status==499)		//timed out.  Let's be awesome!
+	{
+		for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
+			folder_it != mRequestSD["folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			LLUUID folder_id = folder_sd["folder_id"];
+			sFetchQueue.push_front(folder_id);
+		}
+	}
+	else
+	{
+		if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+		{
+			LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+		}
+	}
+	gInventory.notifyObservers("fetchDescendents");
+}
+
+//static   Bundle up a bunch of requests to send all at once.
+void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
+{
+	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
+	//If there are items in sFetchQueue, we want to check the time since the last bulkFetch was 
+	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
+	//Stopbackgroundfetch will be run from the Responder instead of here.  
+
+	S16 max_concurrent_fetches=8;
+	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
+	if (mMinTimeBetweenFetches < new_min_time) 
+	{
+		mMinTimeBetweenFetches=new_min_time;  //HACK!  See above.
+	}
+	
+	if (gDisconnected ||
+		(mBulkFetchCount > max_concurrent_fetches) ||
+		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
+	{
+		return; // just bail if we are disconnected.
+	}	
+
+	U32 folder_count=0;
+	U32 max_batch_size=5;
+
+	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
+
+	LLSD body;
+	LLSD body_lib;
+	while (!(sFetchQueue.empty()) && (folder_count < max_batch_size))
+	{
+        if (sFetchQueue.front().isNull()) //DEV-17797
+        {
+			LLSD folder_sd;
+			folder_sd["folder_id"]		= LLUUID::null.asString();
+			folder_sd["owner_id"]		= gAgent.getID();
+			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
+			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+			body["folders"].append(folder_sd);
+            folder_count++;
+        }
+        else
+        {
+		    LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+		
+		    if (cat)
+		    {
+			    if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
+			    {
+				    LLSD folder_sd;
+				    folder_sd["folder_id"]		= cat->getUUID();
+				    folder_sd["owner_id"]		= cat->getOwnerID();
+				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
+				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				    
+				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
+					    body_lib["folders"].append(folder_sd);
+				    else
+					    body["folders"].append(folder_sd);
+				    folder_count++;
+			    }
+			    if (mInventoryFetchStarted || mLibraryFetchStarted)
+			    {	//Already have this folder but append child folders to list.
+				    // add all children to queue
+					LLInventoryModel::cat_array_t* categories;
+					LLInventoryModel::item_array_t* items;
+					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+						 it != categories->end();
+						 ++it)
+					{
+						sFetchQueue.push_back((*it)->getUUID());
+				    }
+			    }
+		    }
+        }
+		sFetchQueue.pop_front();
+	}
+		
+	if (folder_count > 0)
+	{
+		mBulkFetchCount++;
+		if (body["folders"].size())
+		{
+			LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
+		}
+		if (body_lib["folders"].size())
+		{
+			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
+			LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
+		}
+		mFetchTimer.reset();
+	}
+	else if (isBulkFetchProcessingComplete())
+	{
+		setAllFoldersFetched();
+	}
+}
-- 
cgit v1.2.3


From 856eccdb535b967cd60ad4a906f810cc1827584d Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 15:45:29 -0400
Subject: Rename to remove camelcase from llinventorymodelbackground files.

---
 indra/newview/llinventorymodelbackgroundfetch.h | 119 ++++++++++++++++++++++++
 1 file changed, 119 insertions(+)
 create mode 100644 indra/newview/llinventorymodelbackgroundfetch.h

(limited to 'indra')

diff --git a/indra/newview/llinventorymodelbackgroundfetch.h b/indra/newview/llinventorymodelbackgroundfetch.h
new file mode 100644
index 0000000000..94606fae23
--- /dev/null
+++ b/indra/newview/llinventorymodelbackgroundfetch.h
@@ -0,0 +1,119 @@
+/** 
+ * @file llinventorymodelbackgroundfetch.h
+ * @brief LLInventoryModelBackgroundFetch class header file
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLINVENTORYMODELBACKGROUNDFETCH_H
+#define LL_LLINVENTORYMODELBACKGROUNDFETCH_H
+
+// Seraph clean this up
+#include "llassettype.h"
+#include "llfoldertype.h"
+#include "lldarray.h"
+#include "llframetimer.h"
+#include "llhttpclient.h"
+#include "lluuid.h"
+#include "llpermissionsflags.h"
+#include "llstring.h"
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+// Seraph clean this up
+class LLInventoryObserver;
+class LLInventoryObject;
+class LLInventoryItem;
+class LLInventoryCategory;
+class LLViewerInventoryItem;
+class LLViewerInventoryCategory;
+class LLViewerInventoryItem;
+class LLViewerInventoryCategory;
+class LLMessageSystem;
+class LLInventoryCollectFunctor;
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryModelBackgroundFetch
+//
+// This class handles background fetch.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLInventoryModelBackgroundFetch : public LLSingleton<LLInventoryModelBackgroundFetch>
+{
+public:
+	LLInventoryModelBackgroundFetch();
+	~LLInventoryModelBackgroundFetch();
+
+	// Start and stop background breadth-first fetching of inventory contents.
+	// This gets triggered when performing a filter-search
+	void start(const LLUUID& cat_id = LLUUID::null);
+	BOOL backgroundFetchActive();
+	bool isEverythingFetched();
+	void incrBulkFetch(S16 fetching);
+	void stopBackgroundFetch(); // stop fetch process
+	bool isBulkFetchProcessingComplete();
+
+	// Add categories to a list to be fetched in bulk.
+	void bulkFetch(std::string url);
+
+	bool libraryFetchStarted();
+	bool libraryFetchCompleted();
+	bool libraryFetchInProgress();
+	
+	bool inventoryFetchStarted();
+	bool inventoryFetchCompleted();
+	bool inventoryFetchInProgress();
+    void findLostItems();
+
+	void setAllFoldersFetched();
+
+	static void backgroundFetchCB(void*); // background fetch idle function
+	void backgroundFetch();
+	
+private:
+ 	BOOL mInventoryFetchStarted;
+	BOOL mLibraryFetchStarted;
+	BOOL mAllFoldersFetched;
+
+	// completing the fetch once per session should be sufficient
+	BOOL mBackgroundFetchActive;
+	S16 mBulkFetchCount;
+	BOOL mTimelyFetchPending;
+	S32 mNumFetchRetries;
+
+	LLFrameTimer mFetchTimer;
+	F32 mMinTimeBetweenFetches;
+	F32 mMaxTimeBetweenFetches;
+
+};
+
+#endif // LL_LLINVENTORYMODELBACKGROUNDFETCH_H
+
-- 
cgit v1.2.3


From 909091cc0c85a8178ff7ed338de04b1bb882bd82 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 15:56:15 -0400
Subject: EXT-3415 : INFRASTRUCTURE : Move LLInventoryCollectFunctors to
 separate class

Moved all the LLInventoryModelCOllectFunctors from LLInventoryModel to LLInventoryFunctions
---
 indra/llui/llaccordionctrltab.h        |   3 +-
 indra/newview/llagentwearables.cpp     |  18 +--
 indra/newview/llappearancemgr.cpp      |   1 +
 indra/newview/llfavoritesbar.cpp       |   2 +-
 indra/newview/llfloatergesture.cpp     |   1 +
 indra/newview/llfloaterworldmap.cpp    |   1 +
 indra/newview/llfriendcard.cpp         |   1 +
 indra/newview/llimfloater.cpp          |   1 +
 indra/newview/llinventoryfunctions.cpp | 171 ++++++++++++++++++++++++
 indra/newview/llinventoryfunctions.h   | 214 +++++++++++++++++++++++++++++-
 indra/newview/llinventorymodel.cpp     | 199 ----------------------------
 indra/newview/llinventorymodel.h       | 229 ---------------------------------
 indra/newview/llinventorypanel.cpp     |   1 +
 indra/newview/lllandmarkactions.cpp    |   1 +
 indra/newview/llpanellandmarkinfo.cpp  |   1 +
 indra/newview/llpreviewgesture.cpp     |   1 +
 indra/newview/lltooldraganddrop.cpp    |   1 +
 indra/newview/llviewerinventory.cpp    |   1 +
 indra/newview/llviewermenu.cpp         |   1 +
 indra/newview/llviewermessage.cpp      |   1 +
 indra/newview/llvoavatarself.cpp       |   1 +
 21 files changed, 407 insertions(+), 443 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h
index 462ccc6d53..4b8b22405e 100644
--- a/indra/llui/llaccordionctrltab.h
+++ b/indra/llui/llaccordionctrltab.h
@@ -35,8 +35,9 @@
 
 #include <string>
 #include "llrect.h"
+#include "lluictrl.h"
+#include "lluicolor.h"
 
-class LLUICtrl;
 class LLUICtrlFactory;
 class LLUIImage;
 class LLButton;
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 1fb4cff31a..36c03aca57 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -31,28 +31,28 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+#include "llagentwearables.h"
 
+#include "llaccordionctrltab.h"
 #include "llagent.h"
 #include "llagentcamera.h"
-#include "llagentwearables.h"
-
+#include "llappearancemgr.h"
 #include "llcallbacklist.h"
 #include "llfloatercustomize.h"
+#include "llfolderview.h"
+#include "llgesturemgr.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llnotificationsutil.h"
+#include "llpaneloutfitsinventory.h"
+#include "llsidetray.h"
+#include "lltexlayer.h"
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
 #include "llwearable.h"
 #include "llwearablelist.h"
-#include "llgesturemgr.h"
-#include "llappearancemgr.h"
-#include "lltexlayer.h"
-#include "llsidetray.h"
-#include "llpaneloutfitsinventory.h"
-#include "llfolderview.h"
-#include "llaccordionctrltab.h"
 
 #include <boost/scoped_ptr.hpp>
 
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 80d24f75b9..5b034b53c0 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -39,6 +39,7 @@
 #include "llfloatercustomize.h"
 #include "llgesturemgr.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llnotificationsutil.h"
 #include "llsidepanelappearance.h"
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index bf7c735488..ba92c33d59 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -31,7 +31,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-
 #include "llfavoritesbar.h"
 
 #include "llfloaterreg.h"
@@ -47,6 +46,7 @@
 #include "llclipboard.h"
 #include "llinventoryclipboard.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llfloaterworldmap.h"
 #include "lllandmarkactions.h"
 #include "llnotificationsutil.h"
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index bf03412696..5a332726b2 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -36,6 +36,7 @@
 
 #include "llinventory.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventoryclipboard.h"
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index f05bd8574f..f17c9765b9 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -51,6 +51,7 @@
 //#include "llfirstuse.h"
 #include "llfloaterreg.h"		// getTypedInstance()
 #include "llfocusmgr.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventoryobserver.h"
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index 1a06bef6cb..a848128d67 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -33,6 +33,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llinventory.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "lltrans.h"
 
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 9c477791b3..3ec8d11fb0 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -44,6 +44,7 @@
 #include "llchiclet.h"
 #include "llfloaterreg.h"
 #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
+#include "llinventoryfunctions.h"
 #include "lllayoutstack.h"
 #include "lllineeditor.h"
 #include "lllogchat.h"
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 1e0abeadf1..ab2133d779 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -86,6 +86,177 @@
 BOOL LLInventoryState::sWearNewClothing = FALSE;
 LLUUID LLInventoryState::sWearNewClothingTransactionID;
 
+
+///----------------------------------------------------------------------------
+/// LLInventoryCollectFunctor implementations
+///----------------------------------------------------------------------------
+
+// static
+bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
+{
+	if (!item)
+		return false;
+
+	bool allowed = false;
+
+	switch(item->getType())
+	{
+	case LLAssetType::AT_CALLINGCARD:
+		// not allowed
+		break;
+		
+	case LLAssetType::AT_OBJECT:
+		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		{
+			allowed = true;
+		}
+		break;
+		
+	case LLAssetType::AT_BODYPART:
+	case LLAssetType::AT_CLOTHING:
+		if(!gAgentWearables.isWearingItem(item->getUUID()))
+		{
+			allowed = true;
+		}
+		break;
+		
+	default:
+		allowed = true;
+		break;
+	}
+
+	return allowed;
+}
+
+bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) return TRUE;
+	}
+	if(item)
+	{
+		if(item->getType() == mType) return TRUE;
+	}
+	return FALSE;
+}
+
+bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) return FALSE;
+	}
+	if(item)
+	{
+		if(item->getType() == mType) return FALSE;
+		else return TRUE;
+	}
+	return TRUE;
+}
+
+bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(mType == LLAssetType::AT_CATEGORY)
+	{
+		if(cat) 
+		{
+			return TRUE;
+		}
+	}
+	if(item)
+	{
+		if(item->getType() == mType)
+		{
+			LLPermissions perm = item->getPermissions();
+			if ((perm.getMaskBase() & mPerm) == mPerm)
+			{
+				return TRUE;
+			}
+		}
+	}
+	return FALSE;
+}
+
+bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
+								  LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+		   && (!item->getCreatorUUID().isNull())
+		   && (item->getCreatorUUID() != gAgent.getID()))
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+
+bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat,
+										LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+ 		   && (item->getCreatorUUID().notNull())
+ 		   && (item->getCreatorUUID() != gAgent.getID()))
+		{
+			mSeen.insert(item->getCreatorUUID());
+			return true;
+		}
+	}
+	return false;
+}
+
+
+bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
+											LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((LLAssetType::AT_CALLINGCARD == item->getType())
+		   && (item->getCreatorUUID() == mBuddyID))
+		{
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
+
+bool LLNameCategoryCollector::operator()(
+	LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if(cat)
+	{
+		if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
+		{
+			return true;
+		}
+	}
+	return false;
+}
+
+///----------------------------------------------------------------------------
+/// LLAssetIDMatches 
+///----------------------------------------------------------------------------
+bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	return (item && item->getAssetUUID() == mAssetID);
+}
+
+///----------------------------------------------------------------------------
+/// LLLinkedItemIDMatches 
+///----------------------------------------------------------------------------
+bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	return (item && 
+			(item->getIsLinkType()) &&
+			(item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
+}
+
 void LLSaveFolderState::setApply(BOOL apply)
 {
 	mApply = apply; 
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 968db84819..eb33763670 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -38,15 +38,221 @@
 #include "llfolderview.h"
 #include "llfolderviewitem.h"
 
+/********************************************************************************
+ **                                                                            **
+ **                    INVENTORY COLLECTOR FUNCTIONS
+ **/
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInventoryCollectFunctor
+//
+// Base class for LLInventoryModel::collectDescendentsIf() method
+// which accepts an instance of one of these objects to use as the
+// function to determine if it should be added. Derive from this class
+// and override the () operator to return TRUE if you want to collect
+// the category or item passed in.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLInventoryCollectFunctor
+{
+public:
+	virtual ~LLInventoryCollectFunctor(){};
+	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
+
+	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLAssetIDMatches
+//
+// This functor finds inventory items pointing to the specified asset
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLViewerInventoryItem;
+
+class LLAssetIDMatches : public LLInventoryCollectFunctor
+{
+public:
+	LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
+	virtual ~LLAssetIDMatches() {}
+	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+	
+protected:
+	LLUUID mAssetID;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLLinkedItemIDMatches
+//
+// This functor finds inventory items linked to the specific inventory id.
+// Assumes the inventory id is itself not a linked item.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLLinkedItemIDMatches : public LLInventoryCollectFunctor
+{
+public:
+	LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
+	virtual ~LLLinkedItemIDMatches() {}
+	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+	
+protected:
+	LLUUID mBaseItemID;
+};
+
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLIsType
 //
-// This is a collection of miscellaneous functions and classes
-// that don't fit cleanly into any other class header.  Eventually,
-// we should figure out where to put these functions so that we can
-// get rid of this generic file.
+// Implementation of a LLInventoryCollectFunctor which returns TRUE if
+// the type is the type passed in during construction.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLIsType : public LLInventoryCollectFunctor
+{
+public:
+	LLIsType(LLAssetType::EType type) : mType(type) {}
+	virtual ~LLIsType() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLIsNotType
 //
+// Implementation of a LLInventoryCollectFunctor which returns FALSE if the
+// type is the type passed in during construction, otherwise false.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+class LLIsNotType : public LLInventoryCollectFunctor
+{
+public:
+	LLIsNotType(LLAssetType::EType type) : mType(type) {}
+	virtual ~LLIsNotType() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+};
+
+class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
+{
+public:
+	LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) 
+		: mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
+	virtual ~LLIsTypeWithPermissions() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLAssetType::EType mType;
+	PermissionBit mPerm;
+	LLUUID			mAgentID;
+	LLUUID			mGroupID;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLBuddyCollector
+//
+// Simple class that collects calling cards that are not null, and not
+// the agent. Duplicates are possible.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLBuddyCollector() {}
+	virtual ~LLBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLUniqueBuddyCollector
+//
+// Simple class that collects calling cards that are not null, and not
+// the agent. Duplicates are discarded.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLUniqueBuddyCollector() {}
+	virtual ~LLUniqueBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+
+protected:
+	std::set<LLUUID> mSeen;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLParticularBuddyCollector
+//
+// Simple class that collects calling cards that match a particular uuid
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLParticularBuddyCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
+	virtual ~LLParticularBuddyCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	LLUUID mBuddyID;
+};
+
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLNameCategoryCollector
+//
+// Collects categories based on case-insensitive match of prefix
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+class LLNameCategoryCollector : public LLInventoryCollectFunctor
+{
+public:
+	LLNameCategoryCollector(const std::string& name) : mName(name) {}
+	virtual ~LLNameCategoryCollector() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+protected:
+	std::string mName;
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLFindCOFValidItems
+//
+// Collects items that can be legitimately linked to in the COF.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLFindCOFValidItems : public LLInventoryCollectFunctor
+{
+public:
+	LLFindCOFValidItems() {}
+	virtual ~LLFindCOFValidItems() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+	
+};
+
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLFindWearables
+//
+// Collects wearables based on item type.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+class LLFindWearables : public LLInventoryCollectFunctor
+{
+public:
+	LLFindWearables() {}
+	virtual ~LLFindWearables() {}
+	virtual bool operator()(LLInventoryCategory* cat,
+							LLInventoryItem* item);
+};
+
+/**                    Inventory Collector Functions
+ **                                                                            **
+ *******************************************************************************/
+
 class LLInventoryState
 {
 public:
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 96b9bbb725..d1cc0ae936 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -3211,205 +3211,6 @@ void LLInventoryModel::dumpInventory() const
 	llinfos << "\n**********************\nEnd Inventory Dump" << llendl;
 }
 
-///----------------------------------------------------------------------------
-/// LLInventoryCollectFunctor implementations
-///----------------------------------------------------------------------------
-
-// static
-bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* item)
-{
-	if (!item)
-		return false;
-
-	bool allowed = false;
-
-	switch(item->getType())
-	{
-	case LLAssetType::AT_CALLINGCARD:
-		// not allowed
-		break;
-		
-	case LLAssetType::AT_OBJECT:
-		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-		{
-			allowed = true;
-		}
-		break;
-		
-	case LLAssetType::AT_BODYPART:
-	case LLAssetType::AT_CLOTHING:
-		if(!gAgentWearables.isWearingItem(item->getUUID()))
-		{
-			allowed = true;
-		}
-		break;
-		
-	default:
-		allowed = true;
-		break;
-	}
-
-	return allowed;
-}
-
-bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) return TRUE;
-	}
-	if(item)
-	{
-		if(item->getType() == mType) return TRUE;
-	}
-	return FALSE;
-}
-
-bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) return FALSE;
-	}
-	if(item)
-	{
-		if(item->getType() == mType) return FALSE;
-		else return TRUE;
-	}
-	return TRUE;
-}
-
-bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(mType == LLAssetType::AT_CATEGORY)
-	{
-		if(cat) 
-		{
-			return TRUE;
-		}
-	}
-	if(item)
-	{
-		if(item->getType() == mType)
-		{
-			LLPermissions perm = item->getPermissions();
-			if ((perm.getMaskBase() & mPerm) == mPerm)
-			{
-				return TRUE;
-			}
-		}
-	}
-	return FALSE;
-}
-
-
-//bool LLIsClone::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-//{
-//	if(cat) return FALSE;
-//	if(item)
-//	{
-//		if(mItemMap->getType() == LLAssetType::AT_CALLINGCARD)
-//		{
-//			if((item->getType() == LLAssetType::AT_CALLINGCARD)
-//			   && !(item->getCreatorUUID().isNull())
-//			   && (item->getCreatorUUID() == mItemMap->getCreatorUUID()))
-//			{
-//				return TRUE;
-//			}
-//		}
-//		else
-//		{
-//			if((item->getType() == mItemMap->getType())
-//			   && !(item->getAssetUUID().isNull())
-//			   && (item->getAssetUUID() == mItemMap->getAssetUUID())
-//			   && (item->getName() == mItemMap->getName()))
-//			{
-//				return TRUE;
-//			}
-//		}
-//	}
-//	return FALSE;
-//}
-
-bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
-								  LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
-		   && (!item->getCreatorUUID().isNull())
-		   && (item->getCreatorUUID() != gAgent.getID()))
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-
-bool LLUniqueBuddyCollector::operator()(LLInventoryCategory* cat,
-										LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
- 		   && (item->getCreatorUUID().notNull())
- 		   && (item->getCreatorUUID() != gAgent.getID()))
-		{
-			mSeen.insert(item->getCreatorUUID());
-			return true;
-		}
-	}
-	return false;
-}
-
-
-bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
-											LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((LLAssetType::AT_CALLINGCARD == item->getType())
-		   && (item->getCreatorUUID() == mBuddyID))
-		{
-			return TRUE;
-		}
-	}
-	return FALSE;
-}
-
-
-bool LLNameCategoryCollector::operator()(
-	LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	if(cat)
-	{
-		if (!LLStringUtil::compareInsensitive(mName, cat->getName()))
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
-///----------------------------------------------------------------------------
-/// LLAssetIDMatches 
-///----------------------------------------------------------------------------
-bool LLAssetIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	return (item && item->getAssetUUID() == mAssetID);
-}
-
-///----------------------------------------------------------------------------
-/// LLLinkedItemIDMatches 
-///----------------------------------------------------------------------------
-bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-{
-	return (item && 
-			(item->getIsLinkType()) &&
-			(item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
-}
-
 ///----------------------------------------------------------------------------
 /// Local function definitions
 ///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 700e5317f7..b7c1b57397 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -534,234 +534,5 @@ private:
 // a special inventory model for the agent
 extern LLInventoryModel gInventory;
 
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryCollectFunctor
-//
-// Base class for LLInventoryModel::collectDescendentsIf() method
-// which accepts an instance of one of these objects to use as the
-// function to determine if it should be added. Derive from this class
-// and override the () operator to return TRUE if you want to collect
-// the category or item passed in.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLInventoryCollectFunctor
-{
-public:
-	virtual ~LLInventoryCollectFunctor(){};
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item) = 0;
-
-	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLAssetIDMatches
-//
-// This functor finds inventory items pointing to the specified asset
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLViewerInventoryItem;
-
-class LLAssetIDMatches : public LLInventoryCollectFunctor
-{
-public:
-	LLAssetIDMatches(const LLUUID& asset_id) : mAssetID(asset_id) {}
-	virtual ~LLAssetIDMatches() {}
-	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-	
-protected:
-	LLUUID mAssetID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLLinkedItemIDMatches
-//
-// This functor finds inventory items linked to the specific inventory id.
-// Assumes the inventory id is itself not a linked item.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLLinkedItemIDMatches : public LLInventoryCollectFunctor
-{
-public:
-	LLLinkedItemIDMatches(const LLUUID& item_id) : mBaseItemID(item_id) {}
-	virtual ~LLLinkedItemIDMatches() {}
-	bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
-	
-protected:
-	LLUUID mBaseItemID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsType
-//
-// Implementation of a LLInventoryCollectFunctor which returns TRUE if
-// the type is the type passed in during construction.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLIsType : public LLInventoryCollectFunctor
-{
-public:
-	LLIsType(LLAssetType::EType type) : mType(type) {}
-	virtual ~LLIsType() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsNotType
-//
-// Implementation of a LLInventoryCollectFunctor which returns FALSE if the
-// type is the type passed in during construction, otherwise false.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLIsNotType : public LLInventoryCollectFunctor
-{
-public:
-	LLIsNotType(LLAssetType::EType type) : mType(type) {}
-	virtual ~LLIsNotType() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-};
-
-class LLIsTypeWithPermissions : public LLInventoryCollectFunctor
-{
-public:
-	LLIsTypeWithPermissions(LLAssetType::EType type, const PermissionBit perms, const LLUUID &agent_id, const LLUUID &group_id) 
-		: mType(type), mPerm(perms), mAgentID(agent_id), mGroupID(group_id) {}
-	virtual ~LLIsTypeWithPermissions() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLAssetType::EType mType;
-	PermissionBit mPerm;
-	LLUUID			mAgentID;
-	LLUUID			mGroupID;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLIsClone
-//
-// Implementation of a LLInventoryCollectFunctor which returns TRUE if
-// the object is a clone of the item passed in during
-// construction.
-//
-// *NOTE: Since clone information is determined based off of asset id
-// (or creator with calling cards), if the id is NULL, it has no
-// clones - even itself.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-//class LLIsClone : public LLInventoryCollectFunctor
-//{
-//public:
-//	LLIsClone(LLViewerInventoryItem* item) : mItem(item) {}
-//	virtual ~LLIsClone() {}
-//	virtual bool operator()(LLViewerInventoryCategory* cat,
-//							LLViewerInventoryItem* item);
-//protected:
-//	LLPointer<LLViewerInventoryItem> mItem;
-//};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLBuddyCollector
-//
-// Simple class that collects calling cards that are not null, and not
-// the agent. Duplicates are possible.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLBuddyCollector() {}
-	virtual ~LLBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLUniqueBuddyCollector
-//
-// Simple class that collects calling cards that are not null, and not
-// the agent. Duplicates are discarded.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLUniqueBuddyCollector() {}
-	virtual ~LLUniqueBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-
-protected:
-	std::set<LLUUID> mSeen;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLParticularBuddyCollector
-//
-// Simple class that collects calling cards that match a particular uuid
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLParticularBuddyCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLParticularBuddyCollector(const LLUUID& id) : mBuddyID(id) {}
-	virtual ~LLParticularBuddyCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	LLUUID mBuddyID;
-};
-
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLNameCategoryCollector
-//
-// Collects categories based on case-insensitive match of prefix
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLNameCategoryCollector : public LLInventoryCollectFunctor
-{
-public:
-	LLNameCategoryCollector(const std::string& name) : mName(name) {}
-	virtual ~LLNameCategoryCollector() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-protected:
-	std::string mName;
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindCOFValidItems
-//
-// Collects items that can be legitimately linked to in the COF.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindCOFValidItems : public LLInventoryCollectFunctor
-{
-public:
-	LLFindCOFValidItems() {}
-	virtual ~LLFindCOFValidItems() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-	
-};
-
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLFindWearables
-//
-// Collects wearables based on item type.
-//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-class LLFindWearables : public LLInventoryCollectFunctor
-{
-public:
-	LLFindWearables() {}
-	virtual ~LLFindWearables() {}
-	virtual bool operator()(LLInventoryCategory* cat,
-							LLInventoryItem* item);
-};
-
 #endif // LL_LLINVENTORYMODEL_H
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index f38659ba5f..83c2d62ee8 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -43,6 +43,7 @@
 #include "llimfloater.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llsidepanelinventory.h"
 #include "llsidetray.h"
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index f25d2ef574..7336efb62a 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -36,6 +36,7 @@
 #include "roles_constants.h"
 
 #include "llinventory.h"
+#include "llinventoryfunctions.h"
 #include "lllandmark.h"
 #include "llparcel.h"
 #include "llregionhandle.h"
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 143a64d08b..3dbe9a7f59 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -36,6 +36,7 @@
 
 #include "llcombobox.h"
 #include "lliconctrl.h"
+#include "llinventoryfunctions.h"
 #include "lllineeditor.h"
 #include "lltextbox.h"
 #include "lltexteditor.h"
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 77b72dc728..11cde47744 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -42,6 +42,7 @@
 #include "llstring.h"
 #include "lldir.h"
 #include "llfloaterreg.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llmultigesture.h"
 #include "llnotificationsutil.h"
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 4f5eeb254b..394f550f2e 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -50,6 +50,7 @@
 #include "llhudeffecttrail.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llmutelist.h"
 #include "llpreviewnotecard.h"
 #include "llrecentpeople.h"
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 58d02be99a..b42d25c1d8 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -44,6 +44,7 @@
 #include "llfolderview.h"
 #include "llviewercontrol.h"
 #include "llconsole.h"
+#include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llgesturemgr.h"
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index fe924d68a5..3a6aed01ce 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -73,6 +73,7 @@
 #include "llhudmanager.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventoryfunctions.h"
 #include "llpanellogin.h"
 #include "llpanelblockedlist.h"
 #include "llmenucommands.h"
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 42c8b4ee64..6dc0983f10 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -63,6 +63,7 @@
 #include "llfloaterpreference.h"
 #include "llhudeffecttrail.h"
 #include "llhudmanager.h"
+#include "llinventoryfunctions.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llnearbychat.h"
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 9c2e5461b2..fe6990eae9 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -48,6 +48,7 @@
 #include "llagentwearables.h"
 #include "llhudeffecttrail.h"
 #include "llhudmanager.h"
+#include "llinventoryfunctions.h"
 #include "llselectmgr.h"
 #include "lltoolgrab.h"	// for needsRenderBeam
 #include "lltoolmgr.h" // for needsRenderBeam
-- 
cgit v1.2.3


From 715e38fb536a47ce6b1ad8655c90b36324860acb Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 16:01:17 -0400
Subject: EXT-6630 : INFRASTRUCTURE: Pull out -Keys functions from llagent into
 llagentcamera

Fix for S32/F32 mismatch.
---
 indra/newview/llagentcamera.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 56a0e68bd1..3ba24ef32b 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -313,14 +313,14 @@ public:
 	S32				getAtKey() const		{ return mAtKey; }
 	S32				getWalkKey() const		{ return mWalkKey; }
 	S32				getLeftKey() const		{ return mLeftKey; }
-	F32				getUpKey() const		{ return mUpKey; }
+	S32				getUpKey() const		{ return mUpKey; }
 	F32				getYawKey() const		{ return mYawKey; }
 	F32				getPitchKey() const		{ return mPitchKey; }
 
 	void			setAtKey(S32 mag)		{ mAtKey = mag; }
 	void			setWalkKey(S32 mag)		{ mWalkKey = mag; }
 	void			setLeftKey(S32 mag)		{ mLeftKey = mag; }
-	void			setUpKey(F32 mag)		{ mUpKey = mag; }
+	void			setUpKey(S32 mag)		{ mUpKey = mag; }
 	void			setYawKey(F32 mag)		{ mYawKey = mag; }
 	void			setPitchKey(F32 mag)	{ mPitchKey = mag; }
 
-- 
cgit v1.2.3


From 116c42750bd6186f77a0e5c15992fc0ce2752bdf Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 16:03:48 -0400
Subject: Rename to remove camelcase from llinventorymodelbackground files.

---
 indra/newview/llinventorymodelbackgroundfetch.cpp | 603 ----------------------
 1 file changed, 603 deletions(-)
 delete mode 100644 indra/newview/llinventorymodelbackgroundfetch.cpp

(limited to 'indra')

diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
deleted file mode 100644
index 72e5c0dd75..0000000000
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ /dev/null
@@ -1,603 +0,0 @@
-/** 
- * @file llinventorymodel.cpp
- * @brief Implementation of the inventory model used to track agent inventory.
- *
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- * 
- * Copyright (c) 2002-2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-#include "llinventorymodelbackgroundfetch.h"
-
-// Seraph clean this up
-#include "llagent.h"
-#include "llinventorypanel.h"
-#include "llviewercontrol.h"
-#include "llviewermessage.h"
-#include "llviewerwindow.h"
-#include "llappviewer.h"
-#include "llviewerregion.h"
-#include "llcallbacklist.h"
-
-const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
-const S32 MAX_FETCH_RETRIES = 10;
-
-// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
-static std::deque<LLUUID> sFetchQueue;
-bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
-{
-	for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
-		 it != sFetchQueue.end(); ++it)
-	{
-		const LLUUID& fetch_id = *it;
-		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
-			return false;
-	}
-	return true;
-}
-
-
-LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
-	mBackgroundFetchActive(FALSE),
-	mAllFoldersFetched(FALSE),
-	mInventoryFetchStarted(FALSE),
-	mLibraryFetchStarted(FALSE),
-	mNumFetchRetries(0),
-	mMinTimeBetweenFetches(0.3f),
-	mMaxTimeBetweenFetches(10.f),
-	mTimelyFetchPending(FALSE),
-	mBulkFetchCount(0)
-{
-}
-
-LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
-{
-}
-
-bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete()
-{
-	return sFetchQueue.empty() && mBulkFetchCount<=0;
-}
-
-bool LLInventoryModelBackgroundFetch::libraryFetchStarted()
-{
-	return mLibraryFetchStarted;
-}
-
-bool LLInventoryModelBackgroundFetch::libraryFetchCompleted()
-{
-	return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
-}
-
-bool LLInventoryModelBackgroundFetch::libraryFetchInProgress()
-{
-	return libraryFetchStarted() && !libraryFetchCompleted();
-}
-	
-bool LLInventoryModelBackgroundFetch::inventoryFetchStarted()
-{
-	return mInventoryFetchStarted;
-}
-
-bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted()
-{
-	return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
-}
-
-bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress()
-{
-	return inventoryFetchStarted() && !inventoryFetchCompleted();
-}
-
-bool LLInventoryModelBackgroundFetch::isEverythingFetched()
-{
-	return mAllFoldersFetched;
-}
-
-BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive()
-{
-	return mBackgroundFetchActive;
-}
-
-void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
-{
-	if (!mAllFoldersFetched)
-	{
-		mBackgroundFetchActive = TRUE;
-		if (cat_id.isNull())
-		{
-			if (!mInventoryFetchStarted)
-			{
-				mInventoryFetchStarted = TRUE;
-				sFetchQueue.push_back(gInventory.getRootFolderID());
-				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-			}
-			if (!mLibraryFetchStarted)
-			{
-				mLibraryFetchStarted = TRUE;
-				sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
-				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-			}
-		}
-		else
-		{
-			// specific folder requests go to front of queue
-			if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
-			{
-				sFetchQueue.push_front(cat_id);
-				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-			}
-			if (cat_id == gInventory.getLibraryRootFolderID())
-			{
-				mLibraryFetchStarted = TRUE;
-			}
-			if (cat_id == gInventory.getRootFolderID())
-			{
-				mInventoryFetchStarted = TRUE;
-			}
-		}
-	}
-}
-
-void LLInventoryModelBackgroundFetch::findLostItems()
-{
-	mBackgroundFetchActive = TRUE;
-    sFetchQueue.push_back(LLUUID::null);
-    gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-}
-
-void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
-{
-	if (mBackgroundFetchActive)
-	{
-		mBackgroundFetchActive = FALSE;
-		gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
-		mBulkFetchCount=0;
-		mMinTimeBetweenFetches=0.0f;
-	}
-}
-
-void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
-{
-	if (mInventoryFetchStarted &&
-		mLibraryFetchStarted)
-	{
-		mAllFoldersFetched = TRUE;
-	}
-	stopBackgroundFetch();
-}
-
-void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
-{
-	LLInventoryModelBackgroundFetch::instance().backgroundFetch();
-}
-
-void LLInventoryModelBackgroundFetch::backgroundFetch()
-{
-	if (mBackgroundFetchActive && gAgent.getRegion())
-	{
-		//If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
-		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
-		if (!url.empty()) 
-		{
-			bulkFetch(url);
-			return;
-		}
-		
-		//DEPRECATED OLD CODE FOLLOWS.
-		// no more categories to fetch, stop fetch process
-		if (sFetchQueue.empty())
-		{
-			llinfos << "Inventory fetch completed" << llendl;
-
-			setAllFoldersFetched();
-			return;
-		}
-
-		F32 fast_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.1f);
-		F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f);
-		if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time)
-		{
-			// double timeouts on failure
-			mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f);
-			mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f);
-			llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
-			// fetch is no longer considered "timely" although we will wait for full time-out
-			mTimelyFetchPending = FALSE;
-		}
-
-		while(1)
-		{
-			if (sFetchQueue.empty())
-			{
-				break;
-			}
-
-			if(gDisconnected)
-			{
-				// just bail if we are disconnected.
-				break;
-			}
-
-			LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
-
-			// category has been deleted, remove from queue.
-			if (!cat)
-			{
-				sFetchQueue.pop_front();
-				continue;
-			}
-			
-			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
-				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			{
-				// category exists but has no children yet, fetch the descendants
-				// for now, just request every time and rely on retry timer to throttle
-				if (cat->fetchDescendents())
-				{
-					mFetchTimer.reset();
-					mTimelyFetchPending = TRUE;
-				}
-				else
-				{
-					//  The catagory also tracks if it has expired and here it says it hasn't
-					//  yet.  Get out of here because nothing is going to happen until we
-					//  update the timers.
-					break;
-				}
-			}
-			// do I have all my children?
-			else if (gInventory.isCategoryComplete(sFetchQueue.front()))
-			{
-				// finished with this category, remove from queue
-				sFetchQueue.pop_front();
-
-				// add all children to queue
-				LLInventoryModel::cat_array_t* categories;
-				LLInventoryModel::item_array_t* items;
-				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-				for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-					 it != categories->end();
-					 ++it)
-				{
-					sFetchQueue.push_back((*it)->getUUID());
-				}
-
-				// we received a response in less than the fast time
-				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
-				{
-					// shrink timeouts based on success
-					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
-					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
-					//llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
-				}
-
-				mTimelyFetchPending = FALSE;
-				continue;
-			}
-			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
-			{
-				// received first packet, but our num descendants does not match db's num descendants
-				// so try again later
-				LLUUID fetch_id = sFetchQueue.front();
-				sFetchQueue.pop_front();
-
-				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
-				{
-					// push on back of queue
-					sFetchQueue.push_back(fetch_id);
-				}
-				mTimelyFetchPending = FALSE;
-				mFetchTimer.reset();
-				break;
-			}
-
-			// not enough time has elapsed to do a new fetch
-			break;
-		}
-	}
-}
-
-void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) 
-{  
-	mBulkFetchCount += fetching; 
-	if (mBulkFetchCount < 0)
-	{
-		mBulkFetchCount = 0; 
-	}
-}
-
-
-class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
-{
-	public:
-		LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
-		//LLInventoryModelFetchDescendentsResponder() {};
-		void result(const LLSD& content);
-		void error(U32 status, const std::string& reason);
-	public:
-		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
-	protected:
-		LLSD mRequestSD;
-};
-
-//If we get back a normal response, handle it here
-void  LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
-{
-	if (content.has("folders"))	
-	{
-
-		for(LLSD::array_const_iterator folder_it = content["folders"].beginArray();
-			folder_it != content["folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			
-
-			//LLUUID agent_id = folder_sd["agent_id"];
-
-			//if(agent_id != gAgent.getID())	//This should never happen.
-			//{
-			//	llwarns << "Got a UpdateInventoryItem for the wrong agent."
-			//			<< llendl;
-			//	break;
-			//}
-
-			LLUUID parent_id = folder_sd["folder_id"];
-			LLUUID owner_id = folder_sd["owner_id"];
-			S32    version  = (S32)folder_sd["version"].asInteger();
-			S32    descendents = (S32)folder_sd["descendents"].asInteger();
-			LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
-
-            if (parent_id.isNull())
-            {
-			    LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-			    for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
-				    item_it != folder_sd["items"].endArray();
-				    ++item_it)
-			    {	
-                    const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
-                    if (lost_uuid.notNull())
-                    {
-				        LLSD item = *item_it;
-				        titem->unpackMessage(item);
-				
-                        LLInventoryModel::update_list_t update;
-                        LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
-                        update.push_back(new_folder);
-                        gInventory.accountForUpdate(update);
-
-                        titem->setParent(lost_uuid);
-                        titem->updateParentOnServer(FALSE);
-                        gInventory.updateItem(titem);
-                        gInventory.notifyObservers("fetchDescendents");
-                        
-                    }
-                }
-            }
-
-	        LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id);
-			if (!pcat)
-			{
-				continue;
-			}
-
-			for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray();
-				category_it != folder_sd["categories"].endArray();
-				++category_it)
-			{	
-				LLSD category = *category_it;
-				tcategory->fromLLSD(category); 
-							
-				if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() ||
-					LLInventoryModelBackgroundFetch::instance().libraryFetchStarted())
-				{
-					sFetchQueue.push_back(tcategory->getUUID());
-				}
-				else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
-				{
-					gInventory.updateCategory(tcategory);
-				}
-
-			}
-			LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
-			for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
-				item_it != folder_sd["items"].endArray();
-				++item_it)
-			{	
-				LLSD item = *item_it;
-				titem->unpackMessage(item);
-				
-				gInventory.updateItem(titem);
-			}
-
-			// set version and descendentcount according to message.
-			LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id);
-			if(cat)
-			{
-				cat->setVersion(version);
-				cat->setDescendentCount(descendents);
-				cat->determineFolderType();
-			}
-
-		}
-	}
-		
-	if (content.has("bad_folders"))
-	{
-		for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray();
-			folder_it != content["bad_folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			
-			//These folders failed on the dataserver.  We probably don't want to retry them.
-			llinfos << "Folder " << folder_sd["folder_id"].asString() 
-					<< "Error: " << folder_sd["error"].asString() << llendl;
-		}
-	}
-
-	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
-	
-	if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
-	{
-		llinfos << "Inventory fetch completed" << llendl;
-		LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
-	}
-	
-	gInventory.notifyObservers("fetchDescendents");
-}
-
-//If we get back an error (not found, etc...), handle it here
-void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
-{
-	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
-		<< status << ": " << reason << llendl;
-						
-	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
-
-	if (status==499)		//timed out.  Let's be awesome!
-	{
-		for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
-			folder_it != mRequestSD["folders"].endArray();
-			++folder_it)
-		{	
-			LLSD folder_sd = *folder_it;
-			LLUUID folder_id = folder_sd["folder_id"];
-			sFetchQueue.push_front(folder_id);
-		}
-	}
-	else
-	{
-		if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
-		{
-			LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
-		}
-	}
-	gInventory.notifyObservers("fetchDescendents");
-}
-
-//static   Bundle up a bunch of requests to send all at once.
-void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
-{
-	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
-	//If there are items in sFetchQueue, we want to check the time since the last bulkFetch was 
-	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
-	//Stopbackgroundfetch will be run from the Responder instead of here.  
-
-	S16 max_concurrent_fetches=8;
-	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
-	if (mMinTimeBetweenFetches < new_min_time) 
-	{
-		mMinTimeBetweenFetches=new_min_time;  //HACK!  See above.
-	}
-	
-	if (gDisconnected ||
-		(mBulkFetchCount > max_concurrent_fetches) ||
-		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
-	{
-		return; // just bail if we are disconnected.
-	}	
-
-	U32 folder_count=0;
-	U32 max_batch_size=5;
-
-	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
-
-	LLSD body;
-	LLSD body_lib;
-	while (!(sFetchQueue.empty()) && (folder_count < max_batch_size))
-	{
-        if (sFetchQueue.front().isNull()) //DEV-17797
-        {
-			LLSD folder_sd;
-			folder_sd["folder_id"]		= LLUUID::null.asString();
-			folder_sd["owner_id"]		= gAgent.getID();
-			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
-			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-			body["folders"].append(folder_sd);
-            folder_count++;
-        }
-        else
-        {
-		    LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
-		
-		    if (cat)
-		    {
-			    if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
-			    {
-				    LLSD folder_sd;
-				    folder_sd["folder_id"]		= cat->getUUID();
-				    folder_sd["owner_id"]		= cat->getOwnerID();
-				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
-				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
-				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
-				    
-				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
-					    body_lib["folders"].append(folder_sd);
-				    else
-					    body["folders"].append(folder_sd);
-				    folder_count++;
-			    }
-			    if (mInventoryFetchStarted || mLibraryFetchStarted)
-			    {	//Already have this folder but append child folders to list.
-				    // add all children to queue
-					LLInventoryModel::cat_array_t* categories;
-					LLInventoryModel::item_array_t* items;
-					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
-					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
-						 it != categories->end();
-						 ++it)
-					{
-						sFetchQueue.push_back((*it)->getUUID());
-				    }
-			    }
-		    }
-        }
-		sFetchQueue.pop_front();
-	}
-		
-	if (folder_count > 0)
-	{
-		mBulkFetchCount++;
-		if (body["folders"].size())
-		{
-			LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
-		}
-		if (body_lib["folders"].size())
-		{
-			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
-			LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
-		}
-		mFetchTimer.reset();
-	}
-	else if (isBulkFetchProcessingComplete())
-	{
-		setAllFoldersFetched();
-	}
-}
-- 
cgit v1.2.3


From 094700f49926a1ffb0678bf83cd4670841b618f7 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 16:05:16 -0400
Subject: Rename to remove camelcase from llinventorymodelbackground files.

---
 indra/newview/llinventorymodelbackgroundfetch.cpp | 603 ++++++++++++++++++++++
 1 file changed, 603 insertions(+)
 create mode 100644 indra/newview/llinventorymodelbackgroundfetch.cpp

(limited to 'indra')

diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
new file mode 100644
index 0000000000..72e5c0dd75
--- /dev/null
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -0,0 +1,603 @@
+/** 
+ * @file llinventorymodel.cpp
+ * @brief Implementation of the inventory model used to track agent inventory.
+ *
+ * $LicenseInfo:firstyear=2002&license=viewergpl$
+ * 
+ * Copyright (c) 2002-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llinventorymodelbackgroundfetch.h"
+
+// Seraph clean this up
+#include "llagent.h"
+#include "llinventorypanel.h"
+#include "llviewercontrol.h"
+#include "llviewermessage.h"
+#include "llviewerwindow.h"
+#include "llappviewer.h"
+#include "llviewerregion.h"
+#include "llcallbacklist.h"
+
+const F32 MAX_TIME_FOR_SINGLE_FETCH = 10.f;
+const S32 MAX_FETCH_RETRIES = 10;
+
+// RN: for some reason, using std::queue in the header file confuses the compiler which thinks it's an xmlrpc_queue
+static std::deque<LLUUID> sFetchQueue;
+bool fetchQueueContainsNoDescendentsOf(const LLUUID& cat_id)
+{
+	for (std::deque<LLUUID>::iterator it = sFetchQueue.begin();
+		 it != sFetchQueue.end(); ++it)
+	{
+		const LLUUID& fetch_id = *it;
+		if (gInventory.isObjectDescendentOf(fetch_id, cat_id))
+			return false;
+	}
+	return true;
+}
+
+
+LLInventoryModelBackgroundFetch::LLInventoryModelBackgroundFetch() :
+	mBackgroundFetchActive(FALSE),
+	mAllFoldersFetched(FALSE),
+	mInventoryFetchStarted(FALSE),
+	mLibraryFetchStarted(FALSE),
+	mNumFetchRetries(0),
+	mMinTimeBetweenFetches(0.3f),
+	mMaxTimeBetweenFetches(10.f),
+	mTimelyFetchPending(FALSE),
+	mBulkFetchCount(0)
+{
+}
+
+LLInventoryModelBackgroundFetch::~LLInventoryModelBackgroundFetch()
+{
+}
+
+bool LLInventoryModelBackgroundFetch::isBulkFetchProcessingComplete()
+{
+	return sFetchQueue.empty() && mBulkFetchCount<=0;
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchStarted()
+{
+	return mLibraryFetchStarted;
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchCompleted()
+{
+	return libraryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getLibraryRootFolderID());
+}
+
+bool LLInventoryModelBackgroundFetch::libraryFetchInProgress()
+{
+	return libraryFetchStarted() && !libraryFetchCompleted();
+}
+	
+bool LLInventoryModelBackgroundFetch::inventoryFetchStarted()
+{
+	return mInventoryFetchStarted;
+}
+
+bool LLInventoryModelBackgroundFetch::inventoryFetchCompleted()
+{
+	return inventoryFetchStarted() && fetchQueueContainsNoDescendentsOf(gInventory.getRootFolderID());
+}
+
+bool LLInventoryModelBackgroundFetch::inventoryFetchInProgress()
+{
+	return inventoryFetchStarted() && !inventoryFetchCompleted();
+}
+
+bool LLInventoryModelBackgroundFetch::isEverythingFetched()
+{
+	return mAllFoldersFetched;
+}
+
+BOOL LLInventoryModelBackgroundFetch::backgroundFetchActive()
+{
+	return mBackgroundFetchActive;
+}
+
+void LLInventoryModelBackgroundFetch::start(const LLUUID& cat_id)
+{
+	if (!mAllFoldersFetched)
+	{
+		mBackgroundFetchActive = TRUE;
+		if (cat_id.isNull())
+		{
+			if (!mInventoryFetchStarted)
+			{
+				mInventoryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getRootFolderID());
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+			if (!mLibraryFetchStarted)
+			{
+				mLibraryFetchStarted = TRUE;
+				sFetchQueue.push_back(gInventory.getLibraryRootFolderID());
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+		}
+		else
+		{
+			// specific folder requests go to front of queue
+			if (sFetchQueue.empty() || sFetchQueue.front() != cat_id)
+			{
+				sFetchQueue.push_front(cat_id);
+				gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+			}
+			if (cat_id == gInventory.getLibraryRootFolderID())
+			{
+				mLibraryFetchStarted = TRUE;
+			}
+			if (cat_id == gInventory.getRootFolderID())
+			{
+				mInventoryFetchStarted = TRUE;
+			}
+		}
+	}
+}
+
+void LLInventoryModelBackgroundFetch::findLostItems()
+{
+	mBackgroundFetchActive = TRUE;
+    sFetchQueue.push_back(LLUUID::null);
+    gIdleCallbacks.addFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+}
+
+void LLInventoryModelBackgroundFetch::stopBackgroundFetch()
+{
+	if (mBackgroundFetchActive)
+	{
+		mBackgroundFetchActive = FALSE;
+		gIdleCallbacks.deleteFunction(&LLInventoryModelBackgroundFetch::backgroundFetchCB, NULL);
+		mBulkFetchCount=0;
+		mMinTimeBetweenFetches=0.0f;
+	}
+}
+
+void LLInventoryModelBackgroundFetch::setAllFoldersFetched()
+{
+	if (mInventoryFetchStarted &&
+		mLibraryFetchStarted)
+	{
+		mAllFoldersFetched = TRUE;
+	}
+	stopBackgroundFetch();
+}
+
+void LLInventoryModelBackgroundFetch::backgroundFetchCB(void *)
+{
+	LLInventoryModelBackgroundFetch::instance().backgroundFetch();
+}
+
+void LLInventoryModelBackgroundFetch::backgroundFetch()
+{
+	if (mBackgroundFetchActive && gAgent.getRegion())
+	{
+		//If we'll be using the capability, we'll be sending batches and the background thing isn't as important.
+		std::string url = gAgent.getRegion()->getCapability("WebFetchInventoryDescendents");   
+		if (!url.empty()) 
+		{
+			bulkFetch(url);
+			return;
+		}
+		
+		//DEPRECATED OLD CODE FOLLOWS.
+		// no more categories to fetch, stop fetch process
+		if (sFetchQueue.empty())
+		{
+			llinfos << "Inventory fetch completed" << llendl;
+
+			setAllFoldersFetched();
+			return;
+		}
+
+		F32 fast_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.1f);
+		F32 slow_fetch_time = lerp(mMinTimeBetweenFetches, mMaxTimeBetweenFetches, 0.5f);
+		if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() > slow_fetch_time)
+		{
+			// double timeouts on failure
+			mMinTimeBetweenFetches = llmin(mMinTimeBetweenFetches * 2.f, 10.f);
+			mMaxTimeBetweenFetches = llmin(mMaxTimeBetweenFetches * 2.f, 120.f);
+			llinfos << "Inventory fetch times grown to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+			// fetch is no longer considered "timely" although we will wait for full time-out
+			mTimelyFetchPending = FALSE;
+		}
+
+		while(1)
+		{
+			if (sFetchQueue.empty())
+			{
+				break;
+			}
+
+			if(gDisconnected)
+			{
+				// just bail if we are disconnected.
+				break;
+			}
+
+			LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+
+			// category has been deleted, remove from queue.
+			if (!cat)
+			{
+				sFetchQueue.pop_front();
+				continue;
+			}
+			
+			if (mFetchTimer.getElapsedTimeF32() > mMinTimeBetweenFetches && 
+				LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
+			{
+				// category exists but has no children yet, fetch the descendants
+				// for now, just request every time and rely on retry timer to throttle
+				if (cat->fetchDescendents())
+				{
+					mFetchTimer.reset();
+					mTimelyFetchPending = TRUE;
+				}
+				else
+				{
+					//  The catagory also tracks if it has expired and here it says it hasn't
+					//  yet.  Get out of here because nothing is going to happen until we
+					//  update the timers.
+					break;
+				}
+			}
+			// do I have all my children?
+			else if (gInventory.isCategoryComplete(sFetchQueue.front()))
+			{
+				// finished with this category, remove from queue
+				sFetchQueue.pop_front();
+
+				// add all children to queue
+				LLInventoryModel::cat_array_t* categories;
+				LLInventoryModel::item_array_t* items;
+				gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+				for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+					 it != categories->end();
+					 ++it)
+				{
+					sFetchQueue.push_back((*it)->getUUID());
+				}
+
+				// we received a response in less than the fast time
+				if (mTimelyFetchPending && mFetchTimer.getElapsedTimeF32() < fast_fetch_time)
+				{
+					// shrink timeouts based on success
+					mMinTimeBetweenFetches = llmax(mMinTimeBetweenFetches * 0.8f, 0.3f);
+					mMaxTimeBetweenFetches = llmax(mMaxTimeBetweenFetches * 0.8f, 10.f);
+					//llinfos << "Inventory fetch times shrunk to (" << mMinTimeBetweenFetches << ", " << mMaxTimeBetweenFetches << ")" << llendl;
+				}
+
+				mTimelyFetchPending = FALSE;
+				continue;
+			}
+			else if (mFetchTimer.getElapsedTimeF32() > mMaxTimeBetweenFetches)
+			{
+				// received first packet, but our num descendants does not match db's num descendants
+				// so try again later
+				LLUUID fetch_id = sFetchQueue.front();
+				sFetchQueue.pop_front();
+
+				if (mNumFetchRetries++ < MAX_FETCH_RETRIES)
+				{
+					// push on back of queue
+					sFetchQueue.push_back(fetch_id);
+				}
+				mTimelyFetchPending = FALSE;
+				mFetchTimer.reset();
+				break;
+			}
+
+			// not enough time has elapsed to do a new fetch
+			break;
+		}
+	}
+}
+
+void LLInventoryModelBackgroundFetch::incrBulkFetch(S16 fetching) 
+{  
+	mBulkFetchCount += fetching; 
+	if (mBulkFetchCount < 0)
+	{
+		mBulkFetchCount = 0; 
+	}
+}
+
+
+class LLInventoryModelFetchDescendentsResponder: public LLHTTPClient::Responder
+{
+	public:
+		LLInventoryModelFetchDescendentsResponder(const LLSD& request_sd) : mRequestSD(request_sd) {};
+		//LLInventoryModelFetchDescendentsResponder() {};
+		void result(const LLSD& content);
+		void error(U32 status, const std::string& reason);
+	public:
+		typedef std::vector<LLViewerInventoryCategory*> folder_ref_t;
+	protected:
+		LLSD mRequestSD;
+};
+
+//If we get back a normal response, handle it here
+void  LLInventoryModelFetchDescendentsResponder::result(const LLSD& content)
+{
+	if (content.has("folders"))	
+	{
+
+		for(LLSD::array_const_iterator folder_it = content["folders"].beginArray();
+			folder_it != content["folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			
+
+			//LLUUID agent_id = folder_sd["agent_id"];
+
+			//if(agent_id != gAgent.getID())	//This should never happen.
+			//{
+			//	llwarns << "Got a UpdateInventoryItem for the wrong agent."
+			//			<< llendl;
+			//	break;
+			//}
+
+			LLUUID parent_id = folder_sd["folder_id"];
+			LLUUID owner_id = folder_sd["owner_id"];
+			S32    version  = (S32)folder_sd["version"].asInteger();
+			S32    descendents = (S32)folder_sd["descendents"].asInteger();
+			LLPointer<LLViewerInventoryCategory> tcategory = new LLViewerInventoryCategory(owner_id);
+
+            if (parent_id.isNull())
+            {
+			    LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+			    for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
+				    item_it != folder_sd["items"].endArray();
+				    ++item_it)
+			    {	
+                    const LLUUID lost_uuid = gInventory.findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
+                    if (lost_uuid.notNull())
+                    {
+				        LLSD item = *item_it;
+				        titem->unpackMessage(item);
+				
+                        LLInventoryModel::update_list_t update;
+                        LLInventoryModel::LLCategoryUpdate new_folder(lost_uuid, 1);
+                        update.push_back(new_folder);
+                        gInventory.accountForUpdate(update);
+
+                        titem->setParent(lost_uuid);
+                        titem->updateParentOnServer(FALSE);
+                        gInventory.updateItem(titem);
+                        gInventory.notifyObservers("fetchDescendents");
+                        
+                    }
+                }
+            }
+
+	        LLViewerInventoryCategory* pcat = gInventory.getCategory(parent_id);
+			if (!pcat)
+			{
+				continue;
+			}
+
+			for(LLSD::array_const_iterator category_it = folder_sd["categories"].beginArray();
+				category_it != folder_sd["categories"].endArray();
+				++category_it)
+			{	
+				LLSD category = *category_it;
+				tcategory->fromLLSD(category); 
+							
+				if (LLInventoryModelBackgroundFetch::instance().inventoryFetchStarted() ||
+					LLInventoryModelBackgroundFetch::instance().libraryFetchStarted())
+				{
+					sFetchQueue.push_back(tcategory->getUUID());
+				}
+				else if ( !gInventory.isCategoryComplete(tcategory->getUUID()) )
+				{
+					gInventory.updateCategory(tcategory);
+				}
+
+			}
+			LLPointer<LLViewerInventoryItem> titem = new LLViewerInventoryItem;
+			for(LLSD::array_const_iterator item_it = folder_sd["items"].beginArray();
+				item_it != folder_sd["items"].endArray();
+				++item_it)
+			{	
+				LLSD item = *item_it;
+				titem->unpackMessage(item);
+				
+				gInventory.updateItem(titem);
+			}
+
+			// set version and descendentcount according to message.
+			LLViewerInventoryCategory* cat = gInventory.getCategory(parent_id);
+			if(cat)
+			{
+				cat->setVersion(version);
+				cat->setDescendentCount(descendents);
+				cat->determineFolderType();
+			}
+
+		}
+	}
+		
+	if (content.has("bad_folders"))
+	{
+		for(LLSD::array_const_iterator folder_it = content["bad_folders"].beginArray();
+			folder_it != content["bad_folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			
+			//These folders failed on the dataserver.  We probably don't want to retry them.
+			llinfos << "Folder " << folder_sd["folder_id"].asString() 
+					<< "Error: " << folder_sd["error"].asString() << llendl;
+		}
+	}
+
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+	
+	if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+	{
+		llinfos << "Inventory fetch completed" << llendl;
+		LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+	}
+	
+	gInventory.notifyObservers("fetchDescendents");
+}
+
+//If we get back an error (not found, etc...), handle it here
+void LLInventoryModelFetchDescendentsResponder::error(U32 status, const std::string& reason)
+{
+	llinfos << "LLInventoryModelFetchDescendentsResponder::error "
+		<< status << ": " << reason << llendl;
+						
+	LLInventoryModelBackgroundFetch::instance().incrBulkFetch(-1);
+
+	if (status==499)		//timed out.  Let's be awesome!
+	{
+		for(LLSD::array_const_iterator folder_it = mRequestSD["folders"].beginArray();
+			folder_it != mRequestSD["folders"].endArray();
+			++folder_it)
+		{	
+			LLSD folder_sd = *folder_it;
+			LLUUID folder_id = folder_sd["folder_id"];
+			sFetchQueue.push_front(folder_id);
+		}
+	}
+	else
+	{
+		if (LLInventoryModelBackgroundFetch::instance().isBulkFetchProcessingComplete())
+		{
+			LLInventoryModelBackgroundFetch::instance().setAllFoldersFetched();
+		}
+	}
+	gInventory.notifyObservers("fetchDescendents");
+}
+
+//static   Bundle up a bunch of requests to send all at once.
+void LLInventoryModelBackgroundFetch::bulkFetch(std::string url)
+{
+	//Background fetch is called from gIdleCallbacks in a loop until background fetch is stopped.
+	//If there are items in sFetchQueue, we want to check the time since the last bulkFetch was 
+	//sent.  If it exceeds our retry time, go ahead and fire off another batch.  
+	//Stopbackgroundfetch will be run from the Responder instead of here.  
+
+	S16 max_concurrent_fetches=8;
+	F32 new_min_time = 0.5f;			//HACK!  Clean this up when old code goes away entirely.
+	if (mMinTimeBetweenFetches < new_min_time) 
+	{
+		mMinTimeBetweenFetches=new_min_time;  //HACK!  See above.
+	}
+	
+	if (gDisconnected ||
+		(mBulkFetchCount > max_concurrent_fetches) ||
+		(mFetchTimer.getElapsedTimeF32() < mMinTimeBetweenFetches))
+	{
+		return; // just bail if we are disconnected.
+	}	
+
+	U32 folder_count=0;
+	U32 max_batch_size=5;
+
+	U32 sort_order = gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER) & 0x1;
+
+	LLSD body;
+	LLSD body_lib;
+	while (!(sFetchQueue.empty()) && (folder_count < max_batch_size))
+	{
+        if (sFetchQueue.front().isNull()) //DEV-17797
+        {
+			LLSD folder_sd;
+			folder_sd["folder_id"]		= LLUUID::null.asString();
+			folder_sd["owner_id"]		= gAgent.getID();
+			folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+			folder_sd["fetch_folders"]	= (LLSD::Boolean)FALSE;
+			folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+			body["folders"].append(folder_sd);
+            folder_count++;
+        }
+        else
+        {
+		    LLViewerInventoryCategory* cat = gInventory.getCategory(sFetchQueue.front());
+		
+		    if (cat)
+		    {
+			    if (LLViewerInventoryCategory::VERSION_UNKNOWN == cat->getVersion())
+			    {
+				    LLSD folder_sd;
+				    folder_sd["folder_id"]		= cat->getUUID();
+				    folder_sd["owner_id"]		= cat->getOwnerID();
+				    folder_sd["sort_order"]		= (LLSD::Integer)sort_order;
+				    folder_sd["fetch_folders"]	= TRUE; //(LLSD::Boolean)sFullFetchStarted;
+				    folder_sd["fetch_items"]	= (LLSD::Boolean)TRUE;
+				    
+				    if (ALEXANDRIA_LINDEN_ID == cat->getOwnerID())
+					    body_lib["folders"].append(folder_sd);
+				    else
+					    body["folders"].append(folder_sd);
+				    folder_count++;
+			    }
+			    if (mInventoryFetchStarted || mLibraryFetchStarted)
+			    {	//Already have this folder but append child folders to list.
+				    // add all children to queue
+					LLInventoryModel::cat_array_t* categories;
+					LLInventoryModel::item_array_t* items;
+					gInventory.getDirectDescendentsOf(cat->getUUID(), categories, items);
+					for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin();
+						 it != categories->end();
+						 ++it)
+					{
+						sFetchQueue.push_back((*it)->getUUID());
+				    }
+			    }
+		    }
+        }
+		sFetchQueue.pop_front();
+	}
+		
+	if (folder_count > 0)
+	{
+		mBulkFetchCount++;
+		if (body["folders"].size())
+		{
+			LLHTTPClient::post(url, body, new LLInventoryModelFetchDescendentsResponder(body),300.0);
+		}
+		if (body_lib["folders"].size())
+		{
+			std::string url_lib = gAgent.getRegion()->getCapability("FetchLibDescendents");
+			LLHTTPClient::post(url_lib, body_lib, new LLInventoryModelFetchDescendentsResponder(body_lib),300.0);
+		}
+		mFetchTimer.reset();
+	}
+	else if (isBulkFetchProcessingComplete())
+	{
+		setAllFoldersFetched();
+	}
+}
-- 
cgit v1.2.3


From d7002c0695927f2135e86a837d4472886ea42eb6 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 16:24:18 -0400
Subject: EXT-3529 : INFRASTRUCTURE : Move LLFindWearables code and others into
 LLInventoryFunctions

These functions are defined in LLInventoryFunctions.h but their implementation is in LLInventoryBridge...  moved everything to LLInventoryFunctions.
---
 indra/newview/llinventorybridge.cpp    | 48 +++-------------------------------
 indra/newview/llinventoryfunctions.cpp | 41 +++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 45 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 899a70303b..e7c51aa2a8 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -31,10 +31,12 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+#include "llinventorybridge.h"
+
 // external projects
 #include "lltransfersourceasset.h"
 
-#include "llinventorybridge.h"
+
 
 #include "llagent.h"
 #include "llagentcamera.h"
@@ -1923,50 +1925,6 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	return accept;
 }
 
-bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat,
-									 LLInventoryItem* item)
-{
-	// Valid COF items are:
-	// - links to wearables (body parts or clothing)
-	// - links to attachments
-	// - links to gestures
-	// - links to ensemble folders
-	LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem();
-	if (linked_item)
-	{
-		LLAssetType::EType type = linked_item->getType();
-		return (type == LLAssetType::AT_CLOTHING ||
-				type == LLAssetType::AT_BODYPART ||
-				type == LLAssetType::AT_GESTURE ||
-				type == LLAssetType::AT_OBJECT);
-	}
-	else
-	{
-		LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory();
-		// BAP remove AT_NONE support after ensembles are fully working?
-		return (linked_category &&
-				((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
-				 (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
-	}
-}
-
-
-bool LLFindWearables::operator()(LLInventoryCategory* cat,
-								 LLInventoryItem* item)
-{
-	if(item)
-	{
-		if((item->getType() == LLAssetType::AT_CLOTHING)
-		   || (item->getType() == LLAssetType::AT_BODYPART))
-		{
-			return TRUE;
-		}
-	}
-	return FALSE;
-}
-
-
-
 //Used by LLFolderBridge as callback for directory recursion.
 class LLRightClickInventoryFetchObserver : public LLInventoryFetchObserver
 {
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ab2133d779..3e16dfea5f 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -239,6 +239,47 @@ bool LLNameCategoryCollector::operator()(
 	return false;
 }
 
+bool LLFindCOFValidItems::operator()(LLInventoryCategory* cat,
+									 LLInventoryItem* item)
+{
+	// Valid COF items are:
+	// - links to wearables (body parts or clothing)
+	// - links to attachments
+	// - links to gestures
+	// - links to ensemble folders
+	LLViewerInventoryItem *linked_item = ((LLViewerInventoryItem*)item)->getLinkedItem();
+	if (linked_item)
+	{
+		LLAssetType::EType type = linked_item->getType();
+		return (type == LLAssetType::AT_CLOTHING ||
+				type == LLAssetType::AT_BODYPART ||
+				type == LLAssetType::AT_GESTURE ||
+				type == LLAssetType::AT_OBJECT);
+	}
+	else
+	{
+		LLViewerInventoryCategory *linked_category = ((LLViewerInventoryItem*)item)->getLinkedCategory();
+		// BAP remove AT_NONE support after ensembles are fully working?
+		return (linked_category &&
+				((linked_category->getPreferredType() == LLFolderType::FT_NONE) ||
+				 (LLFolderType::lookupIsEnsembleType(linked_category->getPreferredType()))));
+	}
+}
+
+bool LLFindWearables::operator()(LLInventoryCategory* cat,
+								 LLInventoryItem* item)
+{
+	if(item)
+	{
+		if((item->getType() == LLAssetType::AT_CLOTHING)
+		   || (item->getType() == LLAssetType::AT_BODYPART))
+		{
+			return TRUE;
+		}
+	}
+	return FALSE;
+}
+
 ///----------------------------------------------------------------------------
 /// LLAssetIDMatches 
 ///----------------------------------------------------------------------------
-- 
cgit v1.2.3


From 2e05cc588f1ba2a5977d4d9c66c5d82c163fa156 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 30 Mar 2010 17:39:16 -0400
Subject: EXT-5916 : INFRASTRUCTURE: Move autopopulation code into its own
 separate class

Moved LLLibraryOutfitsFetch and LLInitialWearablesFetch
---
 indra/newview/CMakeLists.txt            |   2 +
 indra/newview/llagentwearables.cpp      | 535 +-------------------------------
 indra/newview/llagentwearablesfetch.cpp | 516 ++++++++++++++++++++++++++++++
 indra/newview/llagentwearablesfetch.h   | 118 +++++++
 4 files changed, 638 insertions(+), 533 deletions(-)
 create mode 100644 indra/newview/llagentwearablesfetch.cpp
 create mode 100644 indra/newview/llagentwearablesfetch.h

(limited to 'indra')

diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 5c7e9c8db2..bc838e20e4 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -74,6 +74,7 @@ set(viewer_SOURCE_FILES
     llagentpilot.cpp
     llagentui.cpp
     llagentwearables.cpp
+    llagentwearablesfetch.cpp
     llanimstatelabels.cpp
     llappearancemgr.cpp
     llappviewer.cpp
@@ -574,6 +575,7 @@ set(viewer_HEADER_FILES
     llagentpilot.h
     llagentui.h
     llagentwearables.h
+    llagentwearablesfetch.h
     llanimstatelabels.h
     llappearance.h
     llappearancemgr.h
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 36c03aca57..b63fec7600 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -36,6 +36,7 @@
 #include "llaccordionctrltab.h"
 #include "llagent.h"
 #include "llagentcamera.h"
+#include "llagentwearablesfetch.h"
 #include "llappearancemgr.h"
 #include "llcallbacklist.h"
 #include "llfloatercustomize.h"
@@ -56,77 +57,6 @@
 
 #include <boost/scoped_ptr.hpp>
 
-//--------------------------------------------------------------------
-// Classes for fetching initial wearables data
-//--------------------------------------------------------------------
-// Outfit folder fetching callback structure.
-class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver
-{
-public:
-	LLInitialWearablesFetch() {}
-	~LLInitialWearablesFetch();
-	virtual void done();
-
-	struct InitialWearableData
-	{
-		EWearableType mType;
-		LLUUID mItemID;
-		LLUUID mAssetID;
-		InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) :
-			mType(type),
-			mItemID(itemID),
-			mAssetID(assetID)
-		{}
-	};
-
-	typedef std::vector<InitialWearableData> initial_wearable_data_vec_t;
-	initial_wearable_data_vec_t mCOFInitialWearables; // Wearables from the Current Outfit Folder
-	initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg
-
-protected:
-	void processWearablesMessage();
-	void processContents();
-};
-
-class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
-{
-public:
-	enum ELibraryOutfitFetchStep {
-		LOFS_FOLDER = 0,
-		LOFS_OUTFITS,
-		LOFS_LIBRARY,
-		LOFS_IMPORTED,
-		LOFS_CONTENTS
-	};
-	LLLibraryOutfitsFetch() : mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) 
-	{
-		mMyOutfitsID = LLUUID::null;
-		mClothingID = LLUUID::null;
-		mLibraryClothingID = LLUUID::null;
-		mImportedClothingID = LLUUID::null;
-		mImportedClothingName = "Imported Library Clothing";
-	}
-	~LLLibraryOutfitsFetch() {}
-	virtual void done();
-	void doneIdle();
-	LLUUID mMyOutfitsID;
-	void importedFolderFetch();
-protected:
-	void folderDone(void);
-	void outfitsDone(void);
-	void libraryDone(void);
-	void importedFolderDone(void);
-	void contentsDone(void);
-	enum ELibraryOutfitFetchStep mCurrFetchStep;
-	uuid_vec_t mLibraryClothingFolders;
-	uuid_vec_t mImportedClothingFolders;
-	bool mOutfitsPopulated;
-	LLUUID mClothingID;
-	LLUUID mLibraryClothingID;
-	LLUUID mImportedClothingID;
-	std::string mImportedClothingName;
-};
-
 LLAgentWearables gAgentWearables;
 
 BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
@@ -1013,8 +943,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 				
 				// Store initial wearables data until we know whether we have the current outfit folder or need to use the data.
 				LLInitialWearablesFetch::InitialWearableData wearable_data(type, item_id, asset_id); // MULTI-WEARABLE: update
-				outfit->mAgentInitialWearables.push_back(wearable_data);
-				
+				outfit->add(wearable_data);
 			}
 			
 			lldebugs << "       " << LLWearableDictionary::getTypeLabel(type) << llendl;
@@ -2189,463 +2118,3 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
 		outfits->done();
 	}
 }
-
-void LLLibraryOutfitsFetch::done()
-{
-	// Delay this until idle() routine, since it's a heavy operation and
-	// we also can't have it run within notifyObservers.
-	doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
-	gInventory.removeObserver(this); // Prevent doOnIdle from being added twice.
-}
-
-void LLLibraryOutfitsFetch::doneIdle()
-{
-	gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
-	
-	switch (mCurrFetchStep)
-	{
-		case LOFS_FOLDER:
-			folderDone();
-			mCurrFetchStep = LOFS_OUTFITS;
-			break;
-		case LOFS_OUTFITS:
-			outfitsDone();
-			mCurrFetchStep = LOFS_LIBRARY;
-			break;
-		case LOFS_LIBRARY:
-			libraryDone();
-			mCurrFetchStep = LOFS_IMPORTED;
-			break;
-		case LOFS_IMPORTED:
-			importedFolderDone();
-			mCurrFetchStep = LOFS_CONTENTS;
-			break;
-		case LOFS_CONTENTS:
-			contentsDone();
-			break;
-		default:
-			llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl;
-			mOutfitsPopulated = TRUE;
-			break;
-	}
-
-	// We're completely done.  Cleanup.
-	if (mOutfitsPopulated)
-	{
-		gInventory.removeObserver(this);
-		delete this;
-		return;
-	}
-}
-
-void LLLibraryOutfitsFetch::folderDone(void)
-{
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t wearable_array;
-	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
-								  LLInventoryModel::EXCLUDE_TRASH);
-	// Early out if we already have items in My Outfits.
-	if (cat_array.count() > 0 || wearable_array.count() > 0)
-	{
-		mOutfitsPopulated = true;
-		return;
-	}
-
-	mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
-	mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true);
-
-	// If Library->Clothing->Initial Outfits exists, use that.
-	LLNameCategoryCollector matchFolderFunctor("Initial Outfits");
-	gInventory.collectDescendentsIf(mLibraryClothingID,
-									cat_array, wearable_array, 
-									LLInventoryModel::EXCLUDE_TRASH,
-									matchFolderFunctor);
-	if (cat_array.count() > 0)
-	{
-		const LLViewerInventoryCategory *cat = cat_array.get(0);
-		mLibraryClothingID = cat->getUUID();
-	}
-
-	mCompleteFolders.clear();
-	
-	// Get the complete information on the items in the inventory.
-	uuid_vec_t folders;
-	folders.push_back(mClothingID);
-	folders.push_back(mLibraryClothingID);
-	fetchDescendents(folders);
-	if (isEverythingComplete())
-	{
-		done();
-	}
-}
-
-void LLLibraryOutfitsFetch::outfitsDone(void)
-{
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t wearable_array;
-	uuid_vec_t folders;
-	
-	// Collect the contents of the Library's Clothing folder
-	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
-								  LLInventoryModel::EXCLUDE_TRASH);
-	
-	llassert(cat_array.count() > 0);
-	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
-		 iter != cat_array.end();
-		 ++iter)
-	{
-		const LLViewerInventoryCategory *cat = iter->get();
-		
-		// Get the names and id's of every outfit in the library, skip "Ruth"
-		// because it's a low quality legacy outfit
-		if (cat->getName() != "Ruth")
-		{
-			// Get the name of every outfit in the library 
-			folders.push_back(cat->getUUID());
-			mLibraryClothingFolders.push_back(cat->getUUID());
-		}
-	}
-	cat_array.clear();
-	wearable_array.clear();
-
-	// Check if you already have an "Imported Library Clothing" folder
-	LLNameCategoryCollector matchFolderFunctor(mImportedClothingName);
-	gInventory.collectDescendentsIf(mClothingID, 
-									cat_array, wearable_array, 
-									LLInventoryModel::EXCLUDE_TRASH,
-									matchFolderFunctor);
-	if (cat_array.size() > 0)
-	{
-		const LLViewerInventoryCategory *cat = cat_array.get(0);
-		mImportedClothingID = cat->getUUID();
-	}
-	
-	mCompleteFolders.clear();
-	
-	fetchDescendents(folders);
-	if (isEverythingComplete())
-	{
-		done();
-	}
-}
-
-class LLLibraryOutfitsCopyDone: public LLInventoryCallback
-{
-public:
-	LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher):
-	mFireCount(0), mLibraryOutfitsFetcher(fetcher)
-	{
-	}
-	
-	virtual ~LLLibraryOutfitsCopyDone()
-	{
-		if (!LLApp::isExiting() && mLibraryOutfitsFetcher)
-		{
-			gInventory.addObserver(mLibraryOutfitsFetcher);
-			mLibraryOutfitsFetcher->done();
-		}
-	}
-	
-	/* virtual */ void fire(const LLUUID& inv_item)
-	{
-		mFireCount++;
-	}
-private:
-	U32 mFireCount;
-	LLLibraryOutfitsFetch * mLibraryOutfitsFetcher;
-};
-
-// Copy the clothing folders from the library into the imported clothing folder
-void LLLibraryOutfitsFetch::libraryDone(void)
-{
-	if (mImportedClothingID != LLUUID::null)
-	{
-		// Skip straight to fetching the contents of the imported folder
-		importedFolderFetch();
-		return;
-	}
-
-	// Remove observer; next autopopulation step will be triggered externally by LLLibraryOutfitsCopyDone.
-	gInventory.removeObserver(this);
-	
-	LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
-	mImportedClothingID = gInventory.createNewCategory(mClothingID,
-													   LLFolderType::FT_NONE,
-													   mImportedClothingName);
-	// Copy each folder from library into clothing unless it already exists.
-	for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
-		 iter != mLibraryClothingFolders.end();
-		 ++iter)
-	{
-		const LLUUID& src_folder_id = (*iter); // Library clothing folder ID
-		const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id);
-		if (!cat)
-		{
-			llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl;
-			continue;
-		}
-		
-		if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
-		{
-			llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl;
-			continue;
-		}
-		
-		// Don't copy the category if it already exists.
-		LLNameCategoryCollector matchFolderFunctor(cat->getName());
-		LLInventoryModel::cat_array_t cat_array;
-		LLInventoryModel::item_array_t wearable_array;
-		gInventory.collectDescendentsIf(mImportedClothingID, 
-										cat_array, wearable_array, 
-										LLInventoryModel::EXCLUDE_TRASH,
-										matchFolderFunctor);
-		if (cat_array.size() > 0)
-		{
-			continue;
-		}
-
-		LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID,
-															LLFolderType::FT_NONE,
-															cat->getName());
-		LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
-	}
-}
-
-void LLLibraryOutfitsFetch::importedFolderFetch(void)
-{
-	// Fetch the contents of the Imported Clothing Folder
-	uuid_vec_t folders;
-	folders.push_back(mImportedClothingID);
-	
-	mCompleteFolders.clear();
-	
-	fetchDescendents(folders);
-	if (isEverythingComplete())
-	{
-		done();
-	}
-}
-
-void LLLibraryOutfitsFetch::importedFolderDone(void)
-{
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t wearable_array;
-	uuid_vec_t folders;
-	
-	// Collect the contents of the Imported Clothing folder
-	gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, 
-								  LLInventoryModel::EXCLUDE_TRASH);
-	
-	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
-		 iter != cat_array.end();
-		 ++iter)
-	{
-		const LLViewerInventoryCategory *cat = iter->get();
-		
-		// Get the name of every imported outfit
-		folders.push_back(cat->getUUID());
-		mImportedClothingFolders.push_back(cat->getUUID());
-	}
-	
-	mCompleteFolders.clear();
-	fetchDescendents(folders);
-	if (isEverythingComplete())
-	{
-		done();
-	}
-}
-
-void LLLibraryOutfitsFetch::contentsDone(void)
-{		
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t wearable_array;
-	
-	for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
-		 folder_iter != mImportedClothingFolders.end();
-		 ++folder_iter)
-	{
-		const LLUUID &folder_id = (*folder_iter);
-		const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
-		if (!cat)
-		{
-			llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl;
-			continue;
-		}
-		
-		// First, make a folder in the My Outfits directory.
-		LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName());
-		
-		cat_array.clear();
-		wearable_array.clear();
-		// Collect the contents of each imported clothing folder, so we can create new outfit links for it
-		gInventory.collectDescendents(folder_id, cat_array, wearable_array, 
-									  LLInventoryModel::EXCLUDE_TRASH);
-		
-		for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin();
-			 wearable_iter != wearable_array.end();
-			 ++wearable_iter)
-		{
-			const LLViewerInventoryItem *item = wearable_iter->get();
-			link_inventory_item(gAgent.getID(),
-								item->getLinkedUUID(),
-								new_outfit_folder_id,
-								item->getName(),
-								LLAssetType::AT_LINK,
-								NULL);
-		}
-	}
-
-	mOutfitsPopulated = true;
-}
-
-//--------------------------------------------------------------------
-// InitialWearablesFetch
-// 
-// This grabs contents from the COF and processes them.
-// The processing is handled in idle(), i.e. outside of done(),
-// to avoid gInventory.notifyObservers recursion.
-//--------------------------------------------------------------------
-
-LLInitialWearablesFetch::~LLInitialWearablesFetch()
-{
-}
-
-// virtual
-void LLInitialWearablesFetch::done()
-{
-	// Delay processing the actual results of this so it's not handled within
-	// gInventory.notifyObservers.  The results will be handled in the next
-	// idle tick instead.
-	gInventory.removeObserver(this);
-	doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this));
-}
-
-void LLInitialWearablesFetch::processContents()
-{
-	// Fetch the wearable items from the Current Outfit Folder
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t wearable_array;
-	LLFindWearables is_wearable;
-	gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, 
-									LLInventoryModel::EXCLUDE_TRASH, is_wearable);
-
-	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
-	if (wearable_array.count() > 0)
-	{
-		LLAppearanceMgr::instance().updateAppearanceFromCOF();
-	}
-	else
-	{
-		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
-		LLAppearanceMgr::instance().setOutfitDirty(true);
-		processWearablesMessage();
-	}
-	delete this;
-}
-
-class LLFetchAndLinkObserver: public LLInventoryFetchObserver
-{
-public:
-	LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids):
-		m_ids(ids),
-		LLInventoryFetchObserver(true) // retry for missing items
-	{
-	}
-	~LLFetchAndLinkObserver()
-	{
-	}
-	virtual void done()
-	{
-		gInventory.removeObserver(this);
-
-		// Link to all fetched items in COF.
-		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
-		for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin();
-			 it != m_ids.end();
-			 ++it)
-		{
-			LLUUID id = *it;
-			LLViewerInventoryItem *item = gInventory.getItem(*it);
-			if (!item)
-			{
-				llwarns << "fetch failed!" << llendl;
-				continue;
-			}
-
-			link_inventory_item(gAgent.getID(),
-								item->getLinkedUUID(),
-								LLAppearanceMgr::instance().getCOF(),
-								item->getName(),
-								LLAssetType::AT_LINK,
-								link_waiter);
-		}
-	}
-private:
-	LLInventoryFetchObserver::item_ref_t m_ids;
-};
-
-void LLInitialWearablesFetch::processWearablesMessage()
-{
-	if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
-	{
-		const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
-		LLInventoryFetchObserver::item_ref_t ids;
-		for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
-		{
-			// Populate the current outfit folder with links to the wearables passed in the message
-			InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback.
-			
-			if (wearable_data->mAssetID.notNull())
-			{
-				ids.push_back(wearable_data->mItemID);
-			}
-			else
-			{
-				llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID "
-				<< wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl;
-				delete wearable_data;
-			}
-		}
-
-		// Add all current attachments to the requested items as well.
-		if (isAgentAvatarValid())
-		{
-			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
-				 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
-			{
-				LLViewerJointAttachment* attachment = iter->second;
-				if (!attachment) continue;
-				for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
-					 attachment_iter != attachment->mAttachedObjects.end();
-					 ++attachment_iter)
-				{
-					LLViewerObject* attached_object = (*attachment_iter);
-					if (!attached_object) continue;
-					const LLUUID& item_id = attached_object->getItemID();
-					if (item_id.isNull()) continue;
-					ids.push_back(item_id);
-				}
-			}
-		}
-
-		// Need to fetch the inventory items for ids, then create links to them after they arrive.
-		LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids);
-		fetcher->fetchItems(ids);
-		// If no items to be fetched, done will never be triggered.
-		// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
-		if (fetcher->isEverythingComplete())
-		{
-			fetcher->done();
-		}
-		else
-		{
-			gInventory.addObserver(fetcher);
-		}
-	}
-	else
-	{
-		LL_WARNS("Wearables") << "No current outfit folder items found and no initial wearables fallback message received." << LL_ENDL;
-	}
-}
-
-
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
new file mode 100644
index 0000000000..45274a8e2c
--- /dev/null
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -0,0 +1,516 @@
+/** 
+ * @file llagentwearablesfetch.cpp
+ * @brief LLAgentWearblesFetch class implementation
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+#include "llagentwearablesfetch.h"
+
+#include "llagent.h"
+#include "llagentwearables.h"
+#include "llappearancemgr.h"
+#include "llinventoryfunctions.h"
+#include "llvoavatarself.h"
+
+LLInitialWearablesFetch::LLInitialWearablesFetch()
+{
+}
+
+LLInitialWearablesFetch::~LLInitialWearablesFetch()
+{
+}
+
+// virtual
+void LLInitialWearablesFetch::done()
+{
+	// Delay processing the actual results of this so it's not handled within
+	// gInventory.notifyObservers.  The results will be handled in the next
+	// idle tick instead.
+	gInventory.removeObserver(this);
+	doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this));
+}
+
+void LLInitialWearablesFetch::add(InitialWearableData &data)
+
+{
+	mAgentInitialWearables.push_back(data);
+}
+
+void LLInitialWearablesFetch::processContents()
+{
+	// Fetch the wearable items from the Current Outfit Folder
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	LLFindWearables is_wearable;
+	gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, 
+									LLInventoryModel::EXCLUDE_TRASH, is_wearable);
+
+	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
+	if (wearable_array.count() > 0)
+	{
+		LLAppearanceMgr::instance().updateAppearanceFromCOF();
+	}
+	else
+	{
+		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
+		LLAppearanceMgr::instance().setOutfitDirty(true);
+		processWearablesMessage();
+	}
+	delete this;
+}
+
+class LLFetchAndLinkObserver: public LLInventoryFetchObserver
+{
+public:
+	LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids):
+		m_ids(ids),
+		LLInventoryFetchObserver(true) // retry for missing items
+	{
+	}
+	~LLFetchAndLinkObserver()
+	{
+	}
+	virtual void done()
+	{
+		gInventory.removeObserver(this);
+
+		// Link to all fetched items in COF.
+		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+		for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin();
+			 it != m_ids.end();
+			 ++it)
+		{
+			LLUUID id = *it;
+			LLViewerInventoryItem *item = gInventory.getItem(*it);
+			if (!item)
+			{
+				llwarns << "fetch failed!" << llendl;
+				continue;
+			}
+
+			link_inventory_item(gAgent.getID(),
+								item->getLinkedUUID(),
+								LLAppearanceMgr::instance().getCOF(),
+								item->getName(),
+								LLAssetType::AT_LINK,
+								link_waiter);
+		}
+	}
+private:
+	LLInventoryFetchObserver::item_ref_t m_ids;
+};
+
+void LLInitialWearablesFetch::processWearablesMessage()
+{
+	if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
+	{
+		const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
+		LLInventoryFetchObserver::item_ref_t ids;
+		for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
+		{
+			// Populate the current outfit folder with links to the wearables passed in the message
+			InitialWearableData *wearable_data = new InitialWearableData(mAgentInitialWearables[i]); // This will be deleted in the callback.
+			
+			if (wearable_data->mAssetID.notNull())
+			{
+				ids.push_back(wearable_data->mItemID);
+			}
+			else
+			{
+				llinfos << "Invalid wearable, type " << wearable_data->mType << " itemID "
+				<< wearable_data->mItemID << " assetID " << wearable_data->mAssetID << llendl;
+				delete wearable_data;
+			}
+		}
+
+		// Add all current attachments to the requested items as well.
+		if (isAgentAvatarValid())
+		{
+			for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); 
+				 iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter)
+			{
+				LLViewerJointAttachment* attachment = iter->second;
+				if (!attachment) continue;
+				for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin();
+					 attachment_iter != attachment->mAttachedObjects.end();
+					 ++attachment_iter)
+				{
+					LLViewerObject* attached_object = (*attachment_iter);
+					if (!attached_object) continue;
+					const LLUUID& item_id = attached_object->getItemID();
+					if (item_id.isNull()) continue;
+					ids.push_back(item_id);
+				}
+			}
+		}
+
+		// Need to fetch the inventory items for ids, then create links to them after they arrive.
+		LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids);
+		fetcher->fetchItems(ids);
+		// If no items to be fetched, done will never be triggered.
+		// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
+		if (fetcher->isEverythingComplete())
+		{
+			fetcher->done();
+		}
+		else
+		{
+			gInventory.addObserver(fetcher);
+		}
+	}
+	else
+	{
+		LL_WARNS("Wearables") << "No current outfit folder items found and no initial wearables fallback message received." << LL_ENDL;
+	}
+}
+
+LLLibraryOutfitsFetch::LLLibraryOutfitsFetch() : 
+	mCurrFetchStep(LOFS_FOLDER), 
+	mOutfitsPopulated(false) 
+{
+	mMyOutfitsID = LLUUID::null;
+	mClothingID = LLUUID::null;
+	mLibraryClothingID = LLUUID::null;
+	mImportedClothingID = LLUUID::null;
+	mImportedClothingName = "Imported Library Clothing";
+}
+
+LLLibraryOutfitsFetch::~LLLibraryOutfitsFetch()
+{
+}
+
+void LLLibraryOutfitsFetch::done()
+{
+	// Delay this until idle() routine, since it's a heavy operation and
+	// we also can't have it run within notifyObservers.
+	doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
+	gInventory.removeObserver(this); // Prevent doOnIdle from being added twice.
+}
+
+void LLLibraryOutfitsFetch::doneIdle()
+{
+	gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
+	
+	switch (mCurrFetchStep)
+	{
+		case LOFS_FOLDER:
+			folderDone();
+			mCurrFetchStep = LOFS_OUTFITS;
+			break;
+		case LOFS_OUTFITS:
+			outfitsDone();
+			mCurrFetchStep = LOFS_LIBRARY;
+			break;
+		case LOFS_LIBRARY:
+			libraryDone();
+			mCurrFetchStep = LOFS_IMPORTED;
+			break;
+		case LOFS_IMPORTED:
+			importedFolderDone();
+			mCurrFetchStep = LOFS_CONTENTS;
+			break;
+		case LOFS_CONTENTS:
+			contentsDone();
+			break;
+		default:
+			llwarns << "Got invalid state for outfit fetch: " << mCurrFetchStep << llendl;
+			mOutfitsPopulated = TRUE;
+			break;
+	}
+
+	// We're completely done.  Cleanup.
+	if (mOutfitsPopulated)
+	{
+		gInventory.removeObserver(this);
+		delete this;
+		return;
+	}
+}
+
+void LLLibraryOutfitsFetch::folderDone(void)
+{
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+	// Early out if we already have items in My Outfits.
+	if (cat_array.count() > 0 || wearable_array.count() > 0)
+	{
+		mOutfitsPopulated = true;
+		return;
+	}
+
+	mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
+	mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true);
+
+	// If Library->Clothing->Initial Outfits exists, use that.
+	LLNameCategoryCollector matchFolderFunctor("Initial Outfits");
+	gInventory.collectDescendentsIf(mLibraryClothingID,
+									cat_array, wearable_array, 
+									LLInventoryModel::EXCLUDE_TRASH,
+									matchFolderFunctor);
+	if (cat_array.count() > 0)
+	{
+		const LLViewerInventoryCategory *cat = cat_array.get(0);
+		mLibraryClothingID = cat->getUUID();
+	}
+
+	mCompleteFolders.clear();
+	
+	// Get the complete information on the items in the inventory.
+	uuid_vec_t folders;
+	folders.push_back(mClothingID);
+	folders.push_back(mLibraryClothingID);
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
+
+void LLLibraryOutfitsFetch::outfitsDone(void)
+{
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	uuid_vec_t folders;
+	
+	// Collect the contents of the Library's Clothing folder
+	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+	
+	llassert(cat_array.count() > 0);
+	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
+		 iter != cat_array.end();
+		 ++iter)
+	{
+		const LLViewerInventoryCategory *cat = iter->get();
+		
+		// Get the names and id's of every outfit in the library, skip "Ruth"
+		// because it's a low quality legacy outfit
+		if (cat->getName() != "Ruth")
+		{
+			// Get the name of every outfit in the library 
+			folders.push_back(cat->getUUID());
+			mLibraryClothingFolders.push_back(cat->getUUID());
+		}
+	}
+	cat_array.clear();
+	wearable_array.clear();
+
+	// Check if you already have an "Imported Library Clothing" folder
+	LLNameCategoryCollector matchFolderFunctor(mImportedClothingName);
+	gInventory.collectDescendentsIf(mClothingID, 
+									cat_array, wearable_array, 
+									LLInventoryModel::EXCLUDE_TRASH,
+									matchFolderFunctor);
+	if (cat_array.size() > 0)
+	{
+		const LLViewerInventoryCategory *cat = cat_array.get(0);
+		mImportedClothingID = cat->getUUID();
+	}
+	
+	mCompleteFolders.clear();
+	
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
+
+class LLLibraryOutfitsCopyDone: public LLInventoryCallback
+{
+public:
+	LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher):
+	mFireCount(0), mLibraryOutfitsFetcher(fetcher)
+	{
+	}
+	
+	virtual ~LLLibraryOutfitsCopyDone()
+	{
+		if (!LLApp::isExiting() && mLibraryOutfitsFetcher)
+		{
+			gInventory.addObserver(mLibraryOutfitsFetcher);
+			mLibraryOutfitsFetcher->done();
+		}
+	}
+	
+	/* virtual */ void fire(const LLUUID& inv_item)
+	{
+		mFireCount++;
+	}
+private:
+	U32 mFireCount;
+	LLLibraryOutfitsFetch * mLibraryOutfitsFetcher;
+};
+
+// Copy the clothing folders from the library into the imported clothing folder
+void LLLibraryOutfitsFetch::libraryDone(void)
+{
+	if (mImportedClothingID != LLUUID::null)
+	{
+		// Skip straight to fetching the contents of the imported folder
+		importedFolderFetch();
+		return;
+	}
+
+	// Remove observer; next autopopulation step will be triggered externally by LLLibraryOutfitsCopyDone.
+	gInventory.removeObserver(this);
+	
+	LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
+	mImportedClothingID = gInventory.createNewCategory(mClothingID,
+													   LLFolderType::FT_NONE,
+													   mImportedClothingName);
+	// Copy each folder from library into clothing unless it already exists.
+	for (uuid_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
+		 iter != mLibraryClothingFolders.end();
+		 ++iter)
+	{
+		const LLUUID& src_folder_id = (*iter); // Library clothing folder ID
+		const LLViewerInventoryCategory *cat = gInventory.getCategory(src_folder_id);
+		if (!cat)
+		{
+			llwarns << "Library folder import for uuid:" << src_folder_id << " failed to find folder." << llendl;
+			continue;
+		}
+		
+		if (!LLAppearanceMgr::getInstance()->getCanMakeFolderIntoOutfit(src_folder_id))
+		{
+			llinfos << "Skipping non-outfit folder name:" << cat->getName() << llendl;
+			continue;
+		}
+		
+		// Don't copy the category if it already exists.
+		LLNameCategoryCollector matchFolderFunctor(cat->getName());
+		LLInventoryModel::cat_array_t cat_array;
+		LLInventoryModel::item_array_t wearable_array;
+		gInventory.collectDescendentsIf(mImportedClothingID, 
+										cat_array, wearable_array, 
+										LLInventoryModel::EXCLUDE_TRASH,
+										matchFolderFunctor);
+		if (cat_array.size() > 0)
+		{
+			continue;
+		}
+
+		LLUUID dst_folder_id = gInventory.createNewCategory(mImportedClothingID,
+															LLFolderType::FT_NONE,
+															cat->getName());
+		LLAppearanceMgr::getInstance()->shallowCopyCategoryContents(src_folder_id, dst_folder_id, copy_waiter);
+	}
+}
+
+void LLLibraryOutfitsFetch::importedFolderFetch(void)
+{
+	// Fetch the contents of the Imported Clothing Folder
+	uuid_vec_t folders;
+	folders.push_back(mImportedClothingID);
+	
+	mCompleteFolders.clear();
+	
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
+
+void LLLibraryOutfitsFetch::importedFolderDone(void)
+{
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	uuid_vec_t folders;
+	
+	// Collect the contents of the Imported Clothing folder
+	gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+	
+	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
+		 iter != cat_array.end();
+		 ++iter)
+	{
+		const LLViewerInventoryCategory *cat = iter->get();
+		
+		// Get the name of every imported outfit
+		folders.push_back(cat->getUUID());
+		mImportedClothingFolders.push_back(cat->getUUID());
+	}
+	
+	mCompleteFolders.clear();
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
+
+void LLLibraryOutfitsFetch::contentsDone(void)
+{		
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	
+	for (uuid_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
+		 folder_iter != mImportedClothingFolders.end();
+		 ++folder_iter)
+	{
+		const LLUUID &folder_id = (*folder_iter);
+		const LLViewerInventoryCategory *cat = gInventory.getCategory(folder_id);
+		if (!cat)
+		{
+			llwarns << "Library folder import for uuid:" << folder_id << " failed to find folder." << llendl;
+			continue;
+		}
+		
+		// First, make a folder in the My Outfits directory.
+		LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, cat->getName());
+		
+		cat_array.clear();
+		wearable_array.clear();
+		// Collect the contents of each imported clothing folder, so we can create new outfit links for it
+		gInventory.collectDescendents(folder_id, cat_array, wearable_array, 
+									  LLInventoryModel::EXCLUDE_TRASH);
+		
+		for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin();
+			 wearable_iter != wearable_array.end();
+			 ++wearable_iter)
+		{
+			const LLViewerInventoryItem *item = wearable_iter->get();
+			link_inventory_item(gAgent.getID(),
+								item->getLinkedUUID(),
+								new_outfit_folder_id,
+								item->getName(),
+								LLAssetType::AT_LINK,
+								NULL);
+		}
+	}
+
+	mOutfitsPopulated = true;
+}
+
diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h
new file mode 100644
index 0000000000..72063114b8
--- /dev/null
+++ b/indra/newview/llagentwearablesfetch.h
@@ -0,0 +1,118 @@
+/** 
+ * @file llagentwearablesinitialfetch.h
+ * @brief LLAgentWearablesInitialFetch class header file
+ *
+ * $LicenseInfo:firstyear=2000&license=viewergpl$
+ * 
+ * Copyright (c) 2000-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLAGENTWEARABLESINITIALFETCH_H
+#define LL_LLAGENTWEARABLESINITIALFETCH_H
+
+#include "llinventoryobserver.h"
+#include "llwearabledictionary.h"
+#include "lluuid.h"
+
+//--------------------------------------------------------------------
+// InitialWearablesFetch
+// 
+// This grabs contents from the COF and processes them.
+// The processing is handled in idle(), i.e. outside of done(),
+// to avoid gInventory.notifyObservers recursion.
+//--------------------------------------------------------------------
+class LLInitialWearablesFetch : public LLInventoryFetchDescendentsObserver
+{
+public:
+	LLInitialWearablesFetch();
+	~LLInitialWearablesFetch();
+	virtual void done();
+
+	struct InitialWearableData
+	{
+		EWearableType mType;
+		LLUUID mItemID;
+		LLUUID mAssetID;
+		InitialWearableData(EWearableType type, LLUUID& itemID, LLUUID& assetID) :
+			mType(type),
+			mItemID(itemID),
+			mAssetID(assetID)
+		{}
+	};
+
+	void add(InitialWearableData &data);
+
+protected:
+	void processWearablesMessage();
+	void processContents();
+
+private:
+	typedef std::vector<InitialWearableData> initial_wearable_data_vec_t;
+	initial_wearable_data_vec_t mAgentInitialWearables; // Wearables from the old agent wearables msg
+};
+
+//--------------------------------------------------------------------
+// InitialWearablesFetch
+// 
+// This grabs outfits from the Library and copies those over to the user's
+// outfits folder, typically during first-ever login.
+//--------------------------------------------------------------------
+class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
+{
+public:
+	enum ELibraryOutfitFetchStep
+	{
+		LOFS_FOLDER = 0,
+		LOFS_OUTFITS,
+		LOFS_LIBRARY,
+		LOFS_IMPORTED,
+		LOFS_CONTENTS
+	};
+
+	LLLibraryOutfitsFetch();
+	~LLLibraryOutfitsFetch();
+
+	virtual void done();
+	void doneIdle();
+	LLUUID mMyOutfitsID;
+	void importedFolderFetch();
+protected:
+	void folderDone(void);
+	void outfitsDone(void);
+	void libraryDone(void);
+	void importedFolderDone(void);
+	void contentsDone(void);
+	enum ELibraryOutfitFetchStep mCurrFetchStep;
+	uuid_vec_t mLibraryClothingFolders;
+	uuid_vec_t mImportedClothingFolders;
+	bool mOutfitsPopulated;
+	LLUUID mClothingID;
+	LLUUID mLibraryClothingID;
+	LLUUID mImportedClothingID;
+	std::string mImportedClothingName;
+};
+
+#endif // LL_AGENTWEARABLESINITIALFETCH_H
-- 
cgit v1.2.3


From 2bb03e5edb5572de1ea31c66f439c8cde9cd2197 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Tue, 30 Mar 2010 16:30:31 -0700
Subject: EXT-6525 - drag threshold is very low for navbar favorites reviewed
 by Leyla

---
 indra/newview/app_settings/settings.xml | 11 +++++++++++
 indra/newview/lltooldraganddrop.cpp     |  9 ++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 73fb24e4eb..e62c4fbfc1 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -2564,6 +2564,17 @@
       <key>Value</key>
       <real>0.10000000149</real>
     </map>
+    <key>DragAndDropDistanceThreshold</key>
+    <map>
+      <key>Comment</key>
+      <string>Number of pixels that mouse should move before triggering drag and drop mode</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>3</integer>
+    </map>
     <key>DropShadowButton</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 394f550f2e..f37efd778f 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -412,9 +412,12 @@ void LLToolDragAndDrop::setDragStart(S32 x, S32 y)
 
 BOOL LLToolDragAndDrop::isOverThreshold(S32 x,S32 y)
 {
-	const S32 MIN_MANHATTAN_DIST = 3;
-	S32 manhattan_dist = llabs( x - mDragStartX ) + llabs( y - mDragStartY );
-	return manhattan_dist >= MIN_MANHATTAN_DIST;
+	static LLCachedControl<S32> drag_and_drop_threshold(gSavedSettings,"DragAndDropDistanceThreshold");
+	
+	S32 mouse_delta_x = x - mDragStartX;
+	S32 mouse_delta_y = y - mDragStartY;
+	
+	return (mouse_delta_x * mouse_delta_x) + (mouse_delta_y * mouse_delta_y) > drag_and_drop_threshold * drag_and_drop_threshold;
 }
 
 void LLToolDragAndDrop::beginDrag(EDragAndDropType type,
-- 
cgit v1.2.3


From 0e0236dc677187975982b8d69d33b80449a4d7e3 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Tue, 30 Mar 2010 16:30:53 -0700
Subject: EXT-6649 IT missing strings; ES undo overrides

---
 indra/newview/skins/default/xui/es/floater_customize.xml | 14 +++++++-------
 indra/newview/skins/default/xui/es/floater_tools.xml     |  6 +++---
 indra/newview/skins/default/xui/it/panel_login.xml       | 11 +++++++++++
 3 files changed, 21 insertions(+), 10 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/floater_customize.xml b/indra/newview/skins/default/xui/es/floater_customize.xml
index 8daf2bed15..6d07aca8c5 100644
--- a/indra/newview/skins/default/xui/es/floater_customize.xml
+++ b/indra/newview/skins/default/xui/es/floater_customize.xml
@@ -1,10 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="floater customize" title="APARIENCIA" width="527">
-	<tab_container name="customize tab container" width="525">
+<floater name="floater customize" title="APARIENCIA">
+	<tab_container name="customize tab container">
 		<text label="Partes del cuerpo" name="body_parts_placeholder">
 			Partes del cuerpo
 		</text>
-		<panel label="Forma" name="Shape" width="389">
+		<panel label="Forma" name="Shape">
 			<button label="Restablecer" label_selected="Restablecer" name="Revert"/>
 			<button label="Cuerpo" label_selected="Cuerpo" name="Body"/>
 			<button label="Cabeza" label_selected="Cabeza" name="Head"/>
@@ -40,12 +40,12 @@
 			<text name="no modify instructions">
 				No tiene permiso para modificar este ítem.
 			</text>
-			<text name="Item Action Label" right="107">
+			<text name="Item Action Label">
 				Forma:
 			</text>
 			<button label="Crear una forma nueva" label_selected="Crear una forma nueva" name="Create New"/>
-			<button label="Guardar" label_selected="Guardar" left="113" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." left="199" name="Save As" width="102"/>
+			<button label="Guardar" label_selected="Guardar" name="Save"/>
+			<button label="Guardar como..." label_selected="Guardar como..." name="Save As">
 		</panel>
 		<panel label="Piel" name="Skin">
 			<button label="Color de piel" label_selected="Color de piel" name="Skin Color" width="115"/>
@@ -522,7 +522,7 @@
 			<button label="Revertir" label_selected="Revertir" name="Revert"/>
 		</panel>
 	</tab_container>
-	<scroll_container left="230" name="panel_container"/>
+	<scroll_container name="panel_container"/>
 	<button label="Información del script" label_selected="Información del script" name="script_info" tool_tip="Mostrar los scripts anexados a tu avatar"/>
 	<button label="Hacer un vestuario" label_selected="Hacer un vestuario" name="make_outfit_btn"/>
 	<button label="Cancelar" label_selected="Cancelar" name="Cancel"/>
diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml
index 9c5fea9267..a3851ea2b0 100644
--- a/indra/newview/skins/default/xui/es/floater_tools.xml
+++ b/indra/newview/skins/default/xui/es/floater_tools.xml
@@ -475,7 +475,7 @@ máximo" name="checkbox fullbright"/>
 		<text name="label_area">
 			Área: [AREA] m²
 		</text>
-		<button label="Acerca del terreno" label_selected="Acerca del terreno" name="button about land" width="140"/>
+		<button label="Acerca del terreno" label_selected="Acerca del terreno" name="button about land"/>
 		<check_box label="Mostrar los propietarios" name="checkbox show owners" tool_tip="El color de las parcelas es según su propietario: 
 
 Verde = Su terreno 
@@ -492,7 +492,7 @@ Gris = Público"/>
 		<text name="label_parcel_trans">
 			Transacciones de terreno
 		</text>
-		<button label="Comprar terreno" label_selected="Comprar terreno" name="button buy land" width="140"/>
-		<button label="Abandonar el terreno" label_selected="Abandonar el terreno" name="button abandon land" width="140"/>
+		<button label="Comprar terreno" label_selected="Comprar terreno" name="button buy land"/>
+		<button label="Abandonar el terreno" label_selected="Abandonar el terreno" name="button abandon land"/>
 	</panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/it/panel_login.xml b/indra/newview/skins/default/xui/it/panel_login.xml
index bbf93ceb87..287e938d57 100644
--- a/indra/newview/skins/default/xui/it/panel_login.xml
+++ b/indra/newview/skins/default/xui/it/panel_login.xml
@@ -12,13 +12,21 @@
 				Nome:
 			</text>
 			<line_editor label="Nome" name="first_name_edit" tool_tip="[SECOND_LIFE] First Name"/>
+			<text name="last_name_text">
+				Cognome:
+			</text>
 			<line_editor label="Cognome" name="last_name_edit" tool_tip="[SECOND_LIFE] Last Name"/>
+			<text name="password_text">
+				Password:
+			</text>
 			<check_box label="Ricorda password" name="remember_check"/>
 			<text name="start_location_text">
 				Inizia da:
 			</text>
 			<combo_box name="start_location_combo">
+				<combo_box.item label="La mia ultima ubicazione" name="MyLastLocation"/>
 				<combo_box.item label="Casa mia" name="MyHome"/>
+				<combo_box.item label="&lt;Scrivi nome regione&gt;" name="Typeregionname"/>
 			</combo_box>
 			<button label="Accedi" name="connect_btn"/>
 		</layout_panel>
@@ -26,6 +34,9 @@
 			<text name="create_new_account_text">
 				Iscriviti
 			</text>
+			<text name="forgot_password_text">
+				Hai dimenticato il nome o la password?
+			</text>
 			<text name="login_help">
 				Ti serve aiuto con la fase di accesso?
 			</text>
-- 
cgit v1.2.3


From 5e61897f93342ea46cb5acd6f90dfbfcc61a4e53 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Tue, 30 Mar 2010 17:06:01 -0700
Subject: IT linguistic

---
 .../skins/default/xui/it/floater_buy_land.xml      | 28 +++++++++++-----------
 .../skins/default/xui/it/panel_group_invite.xml    |  2 +-
 .../default/xui/it/panel_preferences_sound.xml     |  4 ++--
 3 files changed, 17 insertions(+), 17 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/it/floater_buy_land.xml b/indra/newview/skins/default/xui/it/floater_buy_land.xml
index f4e7a6c2c5..ca3285b438 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_land.xml
@@ -1,29 +1,29 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <floater name="buy land" title="ACQUISTA TERRENO">
 	<floater.string name="can_resell">
-		Può essere rivenduta.
+		Può essere rivenduto.
 	</floater.string>
 	<floater.string name="can_not_resell">
-		Può non essere rivenduta.
+		Può non essere rivenduto.
 	</floater.string>
 	<floater.string name="can_change">
-		Può essere unita o suddivisa.
+		Può essere unito o suddiviso.
 	</floater.string>
 	<floater.string name="can_not_change">
-		Non può essere unita o suddivisa.
+		Non può essere unito o suddiviso.
 	</floater.string>
 	<floater.string name="cant_buy_for_group">
-		Non hai il permesso di comprare terra per il tuo gruppo attivo.
+		Non sei autorizzato ad acquistare terreno per il tuo gruppo attivo.
 	</floater.string>
 	<floater.string name="no_land_selected">
-		Nessuna terra selezionata.
+		Nessun terreno selezionato.
 	</floater.string>
 	<floater.string name="multiple_parcels_selected">
-		Hai selezionato appezzamenti diversi. 
+		Hai selezionato lotti diversi. 
 Prova a selezionare un&apos;area più piccola.
 	</floater.string>
 	<floater.string name="no_permission">
-		Non hai il permesso di comprare terra per il tuo gruppo attivo.
+		Non sei autorizzato ad acquistare terreno per il tuo gruppo attivo.
 	</floater.string>
 	<floater.string name="parcel_not_for_sale">
 		Il terreno selezionato non è in vendita.
@@ -32,7 +32,7 @@ Prova a selezionare un&apos;area più piccola.
 		Il gruppo possiede già il terreno.
 	</floater.string>
 	<floater.string name="you_already_own">
-		Possiedi già il terreno.
+		Sei già proprietario del terreno.
 	</floater.string>
 	<floater.string name="set_to_sell_to_other">
 		Il terreno selezionato è già impostato per la vendita ad un altro gruppo.
@@ -41,7 +41,7 @@ Prova a selezionare un&apos;area più piccola.
 		L&apos;area selezionata non è pubblica.
 	</floater.string>
 	<floater.string name="not_owned_by_you">
-		È selezionato terreno di proprietà di un altro residente. 
+		Hai selezionato terreno di proprietà di un altro residente. 
 Prova a scegliere una superficie più piccola.
 	</floater.string>
 	<floater.string name="processing">
@@ -50,13 +50,13 @@ Prova a scegliere una superficie più piccola.
 (Potrebbe volerci un minuto o due.)
 	</floater.string>
 	<floater.string name="fetching_error">
-		C&apos;e stato un errore mentre si stavano ottenendo le informazioni sull&apos;acquisto della terra.
+		Si &apos;e verificato un errore mentre si stavano ottenendo le informazioni sull&apos;acquisto del terreno.
 	</floater.string>
 	<floater.string name="buying_will">
-		Comprando questa terra:
+		Acuistando il terreno:
 	</floater.string>
 	<floater.string name="buying_for_group">
-		Comprare la terra per il gruppo farà:
+		Acuistando il terreno per il gruppo:
 	</floater.string>
 	<floater.string name="cannot_buy_now">
 		Non puoi comprare ora:
@@ -68,7 +68,7 @@ Prova a scegliere una superficie più piccola.
 		nessuno necessario
 	</floater.string>
 	<floater.string name="must_upgrade">
-		Il tuo tipo di account ha bisogno di un upgrade per possedere terra.
+		Per acquistare terreno devi passare a un livello di abbonamento superiore.
 	</floater.string>
 	<floater.string name="cant_own_land">
 		Il tuo account può possedere terra.
diff --git a/indra/newview/skins/default/xui/it/panel_group_invite.xml b/indra/newview/skins/default/xui/it/panel_group_invite.xml
index 7874f588a5..e3cb3c1092 100644
--- a/indra/newview/skins/default/xui/it/panel_group_invite.xml
+++ b/indra/newview/skins/default/xui/it/panel_group_invite.xml
@@ -13,7 +13,7 @@
 		Puoi selezionare più residenti da invitare nel tuo gruppo. Per iniziare, clicca su Apri il selettore di residenti.
 	</text>
 	<button label="Scelta residenti" name="add_button" tool_tip=""/>
-	<name_list name="invitee_list" tool_tip="Tieni premuto Ctrl e fai clic sui nomi dei residenti per una selezionare più nomi"/>
+	<name_list name="invitee_list" tool_tip="Tieni premuto Ctrl e fai clic sui nomi dei residenti per selezionare più nomi"/>
 	<button label="Rimuovi i selezionati dall&apos;elenco" name="remove_button" tool_tip="Rimuove i residenti selezionati dalla lista degli inviti"/>
 	<text name="role_text">
 		Scegli che ruolo assegnare loro:
diff --git a/indra/newview/skins/default/xui/it/panel_preferences_sound.xml b/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
index 2842b6a8aa..6936f24a8a 100644
--- a/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/it/panel_preferences_sound.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Suoni" name="Preference Media panel">
-	<slider label="Comando volume centrale" name="System Volume"/>
-	<check_box initial_value="true" label="Disattiva audio quando minimizzato" name="mute_when_minimized"/>
+	<slider label="Vol. principale" name="System Volume"/>
+	<check_box initial_value="true" label="Disatt. se a icona" name="mute_when_minimized"/>
 	<slider label="Pulsanti" name="UI Volume"/>
 	<slider label="Ambiente" name="Wind Volume"/>
 	<slider label="Effetti sonori" name="SFX Volume"/>
-- 
cgit v1.2.3


From 58de782e08bb704aca5187c4983ee9c5698659a4 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Wed, 31 Mar 2010 16:01:50 +0300
Subject: Fixed bug EXT-4436 Clicking labels/text plays 'click' sound.

Disabled playing sound when a textbox is clicked.

Reviewed by Sam: https://codereview.productengine.com/secondlife/r/140/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/widgets/text.xml | 1 +
 1 file changed, 1 insertion(+)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/widgets/text.xml b/indra/newview/skins/default/xui/en/widgets/text.xml
index 855584a0db..998ec5b170 100644
--- a/indra/newview/skins/default/xui/en/widgets/text.xml
+++ b/indra/newview/skins/default/xui/en/widgets/text.xml
@@ -15,6 +15,7 @@
       bg_visible="false" 
       border_visible="false" 
       hover="false" 
+      sound_flags="0"
       text_color="LabelTextColor"
       v_pad="0"
       max_length="4096"/>
-- 
cgit v1.2.3


From 8ef5fd0e144af53e6044c0dfc15fda9b36bdd85a Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Wed, 31 Mar 2010 16:04:03 +0300
Subject: Fixed bug EXT-6628 IM floater: unable to open 'Pay' floater by click
 on 'Pay' button if floater height was reduced.

Reason: Height of the layout stack containing buttons was too small, hence
when you decrease the window height the bottommost buttons might move beyond
its container, becoming unclickable.

Fix: Increased height of the layout stack for it to reach the bottom of the
floater (occupying all visible area).

Reviewed by Sam: https://codereview.productengine.com/secondlife/r/141/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_im_control_panel.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
index 88566ea037..7d7e21d4b0 100644
--- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
@@ -16,7 +16,7 @@
      border_size="0"
      clip="false"
      follows="all"
-     height="168"
+     height="183"
      layout="topleft"
      left="5"
      name="button_stack"
-- 
cgit v1.2.3


From 0a0f6dec5f6128990f4116c1f90e19691e30c3d2 Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Wed, 31 Mar 2010 16:46:16 +0300
Subject: fix for normal EXT-6346 SLapp group inspector link opens group
 profile instead https://codereview.productengine.com/secondlife/r/138/
 reviwed vsavchuk

--HG--
branch : product-engine
---
 indra/newview/llgroupactions.cpp | 8 +++++++-
 indra/newview/llgroupactions.h   | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 00e2365ffd..d4eecc8c48 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -105,7 +105,7 @@ public:
 		{
 			if (group_id.isNull())
 				return true;
-			LLGroupActions::show(group_id);
+			LLGroupActions::inspect(group_id);
 			return true;
 		}
 		return false;
@@ -246,6 +246,12 @@ static bool isGroupUIVisible()
 	return panel->isInVisibleChain();
 }
 
+// static 
+void LLGroupActions::inspect(const LLUUID& group_id)
+{
+	LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id));
+}
+
 // static
 void LLGroupActions::show(const LLUUID& group_id)
 {
diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h
index e99df86cd9..7e00f2dbe3 100644
--- a/indra/newview/llgroupactions.h
+++ b/indra/newview/llgroupactions.h
@@ -65,6 +65,11 @@ public:
 	 */
 	static void show(const LLUUID& group_id);
 
+	/**
+	 * Show group inspector floater.
+	 */
+	static void LLGroupActions::inspect(const LLUUID& group_id);
+
 	/**
 	 * Refresh group information panel.
 	 */
-- 
cgit v1.2.3


From 1e74f573bbb7e9d3a6cf3134d3373a202912c721 Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Wed, 31 Mar 2010 16:50:06 +0300
Subject: Fixed normal bug EXT-6505 (Certain gear icon buttons should not have
 chevrons)

- Created an icon that is just the gear icon, no dropdown chevron in places where there is no context menu, notably in: Nearby media popover, Master volume popover and Edit Floater

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/137/

--HG--
branch : product-engine
---
 .../default/textures/windows/Icon_Gear_Background.png   | Bin 373 -> 370 bytes
 .../default/textures/windows/Icon_Gear_Foreground.png   | Bin 373 -> 371 bytes
 .../skins/default/textures/windows/Icon_Gear_Over.png   | Bin 279 -> 293 bytes
 .../skins/default/textures/windows/Icon_Gear_Press.png  | Bin 396 -> 365 bytes
 indra/newview/skins/default/xui/en/floater_tools.xml    |  12 ++++++------
 .../skins/default/xui/en/panel_volume_pulldown.xml      |   4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png
index db74b93afd..93d62a8d4f 100644
Binary files a/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png and b/indra/newview/skins/default/textures/windows/Icon_Gear_Background.png differ
diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png
index 1032e45f7e..b2b2a77a88 100644
Binary files a/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png and b/indra/newview/skins/default/textures/windows/Icon_Gear_Foreground.png differ
diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png
index 01dbde102b..67bd399358 100644
Binary files a/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png and b/indra/newview/skins/default/textures/windows/Icon_Gear_Over.png differ
diff --git a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png
index 6614bdd165..6fc3744d6b 100644
Binary files a/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png and b/indra/newview/skins/default/textures/windows/Icon_Gear_Press.png differ
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index fd046c3695..8e7587f4cd 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -2701,15 +2701,15 @@ even though the user gets a free copy.
 			<button
 			 follows="top|left"
 			 tool_tip="Edit this Media"
-			 height="18"
-			 image_disabled="OptionsMenu_Disabled"
-			 image_selected="OptionsMenu_Press"
-			 image_unselected="OptionsMenu_Off"
+			 height="12"
+			 image_disabled="Icon_Gear_Foreground"
+			 image_selected="Icon_Gear_Background"
+			 image_unselected="Icon_Gear_Press"
 			 layout="topleft"
 			 left_pad="10"
 			 name="edit_media"
-			 top_delta="0"
-			 width="18">
+			 top_delta="3"
+			 width="12">
 				<button.commit_callback
 				function="BuildTool.EditMedia"/>
 			</button>
diff --git a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
index cd66c56ca1..7b22b2cce1 100644
--- a/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
+++ b/indra/newview/skins/default/xui/en/panel_volume_pulldown.xml
@@ -32,9 +32,9 @@
    parameter="MuteAudio" />
   </slider>
   <button
-    left="7"
+    left="10"
     top_pad="9"
-    width="18"
+    width="12"
     height="12"
     follows="top|left"
     name="prefs_btn"
-- 
cgit v1.2.3


From 3e11f81b693cf17e767d8890a5d02ae2c152d20f Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Wed, 31 Mar 2010 15:24:10 +0100
Subject: EXT-2418 - improved cursors for sit/open/buy - the neglected Linux
 part.

---
 indra/llwindow/llwindowsdl.cpp     |   3 +++
 indra/newview/res-sdl/toolbuy.BMP  | Bin 0 -> 3126 bytes
 indra/newview/res-sdl/toolopen.BMP | Bin 0 -> 3126 bytes
 indra/newview/res-sdl/toolsit.BMP  | Bin 0 -> 3126 bytes
 4 files changed, 3 insertions(+)
 create mode 100644 indra/newview/res-sdl/toolbuy.BMP
 create mode 100644 indra/newview/res-sdl/toolopen.BMP
 create mode 100644 indra/newview/res-sdl/toolsit.BMP

(limited to 'indra')

diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp
index 4d25b4134e..399d284402 100644
--- a/indra/llwindow/llwindowsdl.cpp
+++ b/indra/llwindow/llwindowsdl.cpp
@@ -2074,6 +2074,9 @@ void LLWindowSDL::initCursors()
 	mSDLCursors[UI_CURSOR_TOOLPAUSE] = makeSDLCursorFromBMP("toolpause.BMP",0,0);
 	mSDLCursors[UI_CURSOR_TOOLMEDIAOPEN] = makeSDLCursorFromBMP("toolmediaopen.BMP",0,0);
 	mSDLCursors[UI_CURSOR_PIPETTE] = makeSDLCursorFromBMP("lltoolpipette.BMP",2,28);
+	mSDLCursors[UI_CURSOR_TOOLSIT] = makeSDLCursorFromBMP("toolsit.BMP",20,15);
+	mSDLCursors[UI_CURSOR_TOOLBUY] = makeSDLCursorFromBMP("toolbuy.BMP",20,15);
+	mSDLCursors[UI_CURSOR_TOOLOPEN] = makeSDLCursorFromBMP("toolopen.BMP",20,15);
 
 	if (getenv("LL_ATI_MOUSE_CURSOR_BUG") != NULL) {
 		llinfos << "Disabling cursor updating due to LL_ATI_MOUSE_CURSOR_BUG" << llendl;
diff --git a/indra/newview/res-sdl/toolbuy.BMP b/indra/newview/res-sdl/toolbuy.BMP
new file mode 100644
index 0000000000..07e9273721
Binary files /dev/null and b/indra/newview/res-sdl/toolbuy.BMP differ
diff --git a/indra/newview/res-sdl/toolopen.BMP b/indra/newview/res-sdl/toolopen.BMP
new file mode 100644
index 0000000000..5b87979304
Binary files /dev/null and b/indra/newview/res-sdl/toolopen.BMP differ
diff --git a/indra/newview/res-sdl/toolsit.BMP b/indra/newview/res-sdl/toolsit.BMP
new file mode 100644
index 0000000000..8ce59ae97a
Binary files /dev/null and b/indra/newview/res-sdl/toolsit.BMP differ
-- 
cgit v1.2.3


From b3bbc9d9ac2f35d38e6fa9a7df00cec1f2e7ee3e Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 31 Mar 2010 11:05:23 -0400
Subject: Fix for crash in process_avatar_movement.

gAgentAvatarp pointer was being checked for null instead of the local avatarp.
---
 indra/newview/llviewermessage.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 6dc0983f10..5f8c03b545 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4031,7 +4031,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 	//clear animation flags
 	avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
 
-	if (!isAgentAvatarValid())
+	if (!avatarp)
 	{
 		// no agent by this ID...error?
 		LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL;
-- 
cgit v1.2.3


From eff5d1fbff9ed00762264f364c860a9f1c75902e Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 31 Mar 2010 18:16:24 +0300
Subject: No ticket, fixed Linux build.

--HG--
branch : product-engine
---
 indra/newview/llgroupactions.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llgroupactions.h b/indra/newview/llgroupactions.h
index 7e00f2dbe3..55cae4db0b 100644
--- a/indra/newview/llgroupactions.h
+++ b/indra/newview/llgroupactions.h
@@ -68,7 +68,7 @@ public:
 	/**
 	 * Show group inspector floater.
 	 */
-	static void LLGroupActions::inspect(const LLUUID& group_id);
+	static void inspect(const LLUUID& group_id);
 
 	/**
 	 * Refresh group information panel.
-- 
cgit v1.2.3


From 7263906f495407cdb49c80b2ad17f845fa2f1c81 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 31 Mar 2010 18:19:16 +0300
Subject: Fixed normal bug EXT-6541(snapshot preview opens before login curtain
 lifts) - changed the order of main view panels so the progress_view overlaps
 the snapshot_floater_view. Reviewed by Vadim Savchuk at
 https://codereview.productengine.com/secondlife/r/144/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/main_view.xml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/main_view.xml b/indra/newview/skins/default/xui/en/main_view.xml
index e8f9d65be5..b2e4a7ad95 100644
--- a/indra/newview/skins/default/xui/en/main_view.xml
+++ b/indra/newview/skins/default/xui/en/main_view.xml
@@ -163,15 +163,6 @@
                    name="notify_container"
                    tab_group="-2"
                    width="1024"/>
-  <panel top="0"
-         follows="all"
-         height="768"
-         mouse_opaque="true"
-         name="progress_view"
-         filename="panel_progress.xml" 
-         class="progress_view"
-         width="1024"
-         visible="false"/>
   <panel top="0"
         follows="all"
         mouse_opaque="false"
@@ -190,6 +181,15 @@
                            visible="false"
                            width="1024"/>
   </panel>
+  <panel top="0"
+         follows="all"
+         height="768"
+         mouse_opaque="true"
+         name="progress_view"
+         filename="panel_progress.xml"
+         class="progress_view"
+         width="1024"
+         visible="false"/>
   <panel top="0"
          follows="all"
          height="768"
-- 
cgit v1.2.3


From 8f5e094757b6ac0ee7f2eeb1a1f386938b390981 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Wed, 31 Mar 2010 16:46:57 +0100
Subject: recent crash regression fix from Seraph.

---
 indra/newview/llviewermessage.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 6dc0983f10..5f8c03b545 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -4031,7 +4031,7 @@ void process_avatar_animation(LLMessageSystem *mesgsys, void **user_data)
 	//clear animation flags
 	avatarp = (LLVOAvatar *)gObjectList.findObject(uuid);
 
-	if (!isAgentAvatarValid())
+	if (!avatarp)
 	{
 		// no agent by this ID...error?
 		LL_WARNS("Messaging") << "Received animation state for unknown avatar" << uuid << LL_ENDL;
-- 
cgit v1.2.3


From d4fef262bc346331cdc8010ada1b5f5d9c8dd647 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 31 Mar 2010 12:05:51 -0400
Subject: EXT-5581 : Centralize is_asset_fetch/knowlable into asset dictionary

Took out some ugly case statements and stuck those functions into the asset dictionary instead.  This makes the code a lot more centralized/extensible since if we ever add assets, it'll be clear that their fetch/knowable fields need to be added (versus that logic being in some obscure case statement).
---
 indra/llcommon/llassettype.cpp            | 98 ++++++++++++++++++++-----------
 indra/llcommon/llassettype.h              |  7 ++-
 indra/llmessage/lltransfersourceasset.cpp | 49 +---------------
 indra/llmessage/lltransfersourceasset.h   | 20 -------
 indra/newview/llinventorybridge.cpp       |  2 +-
 5 files changed, 71 insertions(+), 105 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index 6d5b12d840..e5068f1bc5 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -45,19 +45,25 @@ struct AssetEntry : public LLDictionaryEntry
 	AssetEntry(const char *desc_name,
 			   const char *type_name, 	// 8 character limit!
 			   const char *human_name, 	// for decoding to human readable form; put any and as many printable characters you want in each one
-			   bool can_link) 			// can you create a link to this type?
+			   BOOL can_link, 			// can you create a link to this type?
+			   BOOL can_fetch, 			// can you fetch this asset by ID?
+			   BOOL can_know) 			// can you see this asset's ID?
 		:
 		LLDictionaryEntry(desc_name),
 		mTypeName(type_name),
 		mHumanName(human_name),
-		mCanLink(can_link)
+		mCanLink(can_link),
+		mCanFetch(can_fetch),
+		mCanKnow(can_know)
 	{
 		llassert(strlen(mTypeName) <= 8);
 	}
 
 	const char *mTypeName;
 	const char *mHumanName;
-	bool mCanLink;
+	BOOL mCanLink;
+	BOOL mCanFetch;
+	BOOL mCanKnow;
 };
 
 class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
@@ -69,32 +75,32 @@ public:
 
 LLAssetDictionary::LLAssetDictionary()
 {
-	//       												   DESCRIPTION			TYPE NAME	HUMAN NAME			CAN LINK?	
-	//      												  |--------------------|-----------|-------------------|-----------|
-	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			FALSE));
-	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			FALSE));
-	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		FALSE));
-	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			FALSE));
-	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	FALSE));
-	addEntry(LLAssetType::AT_CLOTHING, 			new AssetEntry("CLOTHING",			"clothing",	"clothing",			TRUE));
-	addEntry(LLAssetType::AT_OBJECT, 			new AssetEntry("OBJECT",			"object",	"object",			TRUE));
-	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		FALSE));
-	addEntry(LLAssetType::AT_CATEGORY, 			new AssetEntry("CATEGORY",			"category",	"folder",			TRUE));
-	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		FALSE));
-	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		FALSE));
-	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		FALSE));
-	addEntry(LLAssetType::AT_BODYPART, 			new AssetEntry("BODYPART",			"bodypart",	"body part",		TRUE));
-	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			FALSE));
-	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		FALSE));
-	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		FALSE));
-	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		FALSE));
-	addEntry(LLAssetType::AT_GESTURE, 			new AssetEntry("GESTURE",			"gesture",	"gesture",			TRUE));
-	addEntry(LLAssetType::AT_SIMSTATE, 			new AssetEntry("SIMSTATE",			"simstate",	"simstate",			FALSE));
-
-	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"symbolic link",	FALSE));
-	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"symbolic folder link", FALSE));
-
-	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE));
+	//       												   DESCRIPTION			TYPE NAME	HUMAN NAME			CAN LINK?   CAN FETCH?  CAN KNOW?	
+	//      												  |--------------------|-----------|-------------------|-----------|-----------|---------|
+	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			FALSE,		FALSE,		TRUE));
+	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			FALSE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			FALSE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_CLOTHING, 			new AssetEntry("CLOTHING",			"clothing",	"clothing",			TRUE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_OBJECT, 			new AssetEntry("OBJECT",			"object",	"object",			TRUE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		FALSE,		FALSE,		TRUE));
+	addEntry(LLAssetType::AT_CATEGORY, 			new AssetEntry("CATEGORY",			"category",	"folder",			TRUE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_BODYPART, 			new AssetEntry("BODYPART",			"bodypart",	"body part",		TRUE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		FALSE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_GESTURE, 			new AssetEntry("GESTURE",			"gesture",	"gesture",			TRUE,		TRUE,		TRUE));
+	addEntry(LLAssetType::AT_SIMSTATE, 			new AssetEntry("SIMSTATE",			"simstate",	"simstate",			FALSE,		FALSE,		FALSE));
+
+	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"sym link",			FALSE,		FALSE,		TRUE));
+	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	FALSE,		FALSE,		TRUE));
+
+	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE,		FALSE,		FALSE));
 };
 
 // static
@@ -196,7 +202,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
 }
 
 // static
-bool LLAssetType::lookupCanLink(EType asset_type)
+BOOL LLAssetType::lookupCanLink(EType asset_type)
 {
 	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
 	const AssetEntry *entry = dict->lookup(asset_type);
@@ -204,18 +210,18 @@ bool LLAssetType::lookupCanLink(EType asset_type)
 	{
 		return entry->mCanLink;
 	}
-	return false;
+	return FALSE;
 }
 
 // static
 // Not adding this to dictionary since we probably will only have these two types
-bool LLAssetType::lookupIsLinkType(EType asset_type)
+BOOL LLAssetType::lookupIsLinkType(EType asset_type)
 {
 	if (asset_type == AT_LINK || asset_type == AT_LINK_FOLDER)
 	{
-		return true;
+		return TRUE;
 	}
-	return false;
+	return FALSE;
 }
 
 // static
@@ -225,3 +231,27 @@ const std::string &LLAssetType::badLookup()
 	return sBadLookup;
 
 }
+
+// static
+BOOL LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
+{
+	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+	const AssetEntry *entry = dict->lookup(asset_type);
+	if (entry)
+	{
+		return entry->mCanFetch;
+	}
+	return FALSE;
+}
+
+// static
+BOOL LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
+{
+	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
+	const AssetEntry *entry = dict->lookup(asset_type);
+	if (entry)
+	{
+		return entry->mCanKnow;
+	}
+	return FALSE;
+}
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index c7bbc2e74a..4440e1bac3 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -143,9 +143,12 @@ public:
 	static EType 				getType(const std::string& desc_name);
 	static const std::string&	getDesc(EType asset_type);
 
-	static bool 				lookupCanLink(EType asset_type);
-	static bool 				lookupIsLinkType(EType asset_type);
+	static BOOL 				lookupCanLink(EType asset_type);
+	static BOOL 				lookupIsLinkType(EType asset_type);
 
+	static BOOL 				lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
+	static BOOL 				lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
+	
 	static const std::string&	badLookup(); // error string when a lookup fails
 
 protected:
diff --git a/indra/llmessage/lltransfersourceasset.cpp b/indra/llmessage/lltransfersourceasset.cpp
index abfb432020..43f7c07e94 100644
--- a/indra/llmessage/lltransfersourceasset.cpp
+++ b/indra/llmessage/lltransfersourceasset.cpp
@@ -60,7 +60,7 @@ void LLTransferSourceAsset::initTransfer()
 		// to the simulator. This is subset of assets we allow to be
 		// simply pulled straight from the asset system.
 		LLUUID* tidp;
-		if(is_asset_fetch_by_id_allowed(mParams.getAssetType()))
+		if(LLAssetType::lookupIsAssetFetchByIDAllowed(mParams.getAssetType()))
 		{
 			tidp = new LLUUID(getID());
 			gAssetStorage->getAssetData(
@@ -257,50 +257,3 @@ BOOL LLTransferSourceParamsAsset::unpackParams(LLDataPacker &dp)
 
 	return TRUE;
 }
-
-/**
- * Helper functions
- */
-bool is_asset_fetch_by_id_allowed(LLAssetType::EType type)
-{
-	// *FIX: Make this list smaller.
-	bool rv = false;
-	switch(type)
-	{
-		case LLAssetType::AT_SOUND:
-		case LLAssetType::AT_LANDMARK:
-		case LLAssetType::AT_CLOTHING:
-		case LLAssetType::AT_BODYPART:
-		case LLAssetType::AT_ANIMATION:
-		case LLAssetType::AT_GESTURE:
-			rv = true;
-			break;
-		default:
-			break;
-	}
-	return rv;
-}
-
-bool is_asset_id_knowable(LLAssetType::EType type)
-{
-	// *FIX: Make this list smaller.
-	bool rv = false;
-	switch(type)
-	{
-		case LLAssetType::AT_TEXTURE:
-		case LLAssetType::AT_SOUND:
-		case LLAssetType::AT_LANDMARK:
-		case LLAssetType::AT_CLOTHING:
-		case LLAssetType::AT_NOTECARD:
-		case LLAssetType::AT_BODYPART:
-		case LLAssetType::AT_ANIMATION:
-		case LLAssetType::AT_GESTURE:
-		case LLAssetType::AT_LINK:
-		case LLAssetType::AT_LINK_FOLDER:
-			rv = true;
-			break;
-		default:
-			break;
-	}
-	return rv;
-}
diff --git a/indra/llmessage/lltransfersourceasset.h b/indra/llmessage/lltransfersourceasset.h
index 70b09b6aaf..8616595654 100644
--- a/indra/llmessage/lltransfersourceasset.h
+++ b/indra/llmessage/lltransfersourceasset.h
@@ -84,24 +84,4 @@ protected:
 	S32 mCurPos;
 };
 
-/**
- * @brief Quick check to see if the asset allows direct download.
- *
- * This might not be the right place for this function call, but it
- * originally started life inside the LLTransferSourceAsset code.
- * @param type The type of asset.
- * @return Returns true if the asset can be fetched by id.
- */
-bool is_asset_fetch_by_id_allowed(LLAssetType::EType type);
-
-/**
- * @brief Quick check to see if all asset data can be known by the viewer.
- *
- * This might not be the right place for this function call, but it
- * originally started life inside the LLTransferSourceAsset code.
- * @param type The type of asset.
- * @return Returns true if the asset id can be transmitted to the viewer.
- */
-bool is_asset_id_knowable(LLAssetType::EType type);
-
 #endif // LL_LLTRANSFERSOURCEASSET_H
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 1b6fa6dd9a..0fbf3148ac 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -596,7 +596,7 @@ void LLInvFVBridge::getClipboardEntries(bool show_asset_id,
 				LLViewerInventoryItem* inv_item = gInventory.getItem(mUUID);
 				if (inv_item)
 				{
-					is_asset_knowable = is_asset_id_knowable(inv_item->getType());
+					is_asset_knowable = LLAssetType::lookupIsAssetIDKnowable(inv_item->getType());
 				}
 				if ( !is_asset_knowable // disable menu item for Inventory items with unknown asset. EXT-5308
 					 || (! ( isItemPermissive() || gAgent.isGodlike() ) )
-- 
cgit v1.2.3


From 9dcdbf029c3a74de5aefca52262d4ed41626298d Mon Sep 17 00:00:00 2001
From: Yuri Chebotarev <ychebotarev@productengine.com>
Date: Wed, 31 Mar 2010 19:38:15 +0300
Subject: fix for EXT-5882 Max. Contribution field on groups -> land and assets
 tab miscalculates after first group fetch. previous fix I commint with wrong
 (re)initialization...donno why)

--HG--
branch : product-engine
---
 indra/newview/llpanelgrouplandmoney.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelgrouplandmoney.cpp b/indra/newview/llpanelgrouplandmoney.cpp
index f276df8573..9ac3a07041 100644
--- a/indra/newview/llpanelgrouplandmoney.cpp
+++ b/indra/newview/llpanelgrouplandmoney.cpp
@@ -1600,7 +1600,7 @@ void LLPanelGroupLandMoney::setGroupID(const LLUUID& id)
 		mImplementationp->mMoneySalesTabEHp->setGroupID(mGroupID);
 	}
 
-	mImplementationp->mBeenActivated = true;
+	mImplementationp->mBeenActivated = false;
 
 	activate();
 }
-- 
cgit v1.2.3


From 1ee1004e126293bbfc2fd901f0e6f73e1952cc73 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 31 Mar 2010 15:16:44 -0400
Subject: EXT-6666 : Enable debug avatar textures in God, versus non-Release,
 mode

---
 indra/newview/llfloateravatartextures.cpp | 92 +++++++++++++++----------------
 indra/newview/llviewermenu.cpp            |  7 ++-
 2 files changed, 47 insertions(+), 52 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloateravatartextures.cpp b/indra/newview/llfloateravatartextures.cpp
index 8c7899af3e..18db60705b 100644
--- a/indra/newview/llfloateravatartextures.cpp
+++ b/indra/newview/llfloateravatartextures.cpp
@@ -31,15 +31,14 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-
 #include "llfloateravatartextures.h"
 
+#include "llagent.h"
+#include "llagentwearables.h"
 #include "lltexturectrl.h"
-
 #include "lluictrlfactory.h"
 #include "llviewerobjectlist.h"
 #include "llvoavatar.h"
-#include "llagentwearables.h"
 
 using namespace LLVOAvatarDefines;
 
@@ -75,7 +74,6 @@ void LLFloaterAvatarTextures::draw()
 	LLFloater::draw();
 }
 
-#if !LL_RELEASE_FOR_DOWNLOAD
 static void update_texture_ctrl(LLVOAvatar* avatarp,
 								 LLTextureCtrl* ctrl,
 								 ETextureIndex te)
@@ -132,72 +130,68 @@ static LLVOAvatar* find_avatar(const LLUUID& id)
 
 void LLFloaterAvatarTextures::refresh()
 {
-	LLVOAvatar *avatarp = find_avatar(mID);
-	if (avatarp)
+	if (gAgent.isGodlike())
 	{
-		std::string fullname;
-		if (gCacheName->getFullName(avatarp->getID(), fullname))
+		LLVOAvatar *avatarp = find_avatar(mID);
+		if (avatarp)
 		{
-			setTitle(mTitle + ": " + fullname);
+			std::string fullname;
+			if (gCacheName->getFullName(avatarp->getID(), fullname))
+			{
+				setTitle(mTitle + ": " + fullname);
+			}
+			for (U32 i=0; i < TEX_NUM_INDICES; i++)
+			{
+				update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i));
+			}
 		}
-		for (U32 i=0; i < TEX_NUM_INDICES; i++)
+		else
 		{
-			update_texture_ctrl(avatarp, mTextures[i], ETextureIndex(i));
+			setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")");
 		}
 	}
-	else
-	{
-		setTitle(mTitle + ": " + getString("InvalidAvatar") + " (" + mID.asString() + ")");
-	}
 }
 
-#else
-
-void LLFloaterAvatarTextures::refresh()
-{
-}
-
-#endif
-
 // static
 void LLFloaterAvatarTextures::onClickDump(void* data)
 {
-#if !LL_RELEASE_FOR_DOWNLOAD
-	LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data;
-	LLVOAvatar* avatarp = find_avatar(self->mID);
-	if (!avatarp) return;
-
-	for (S32 i = 0; i < avatarp->getNumTEs(); i++)
+	if (gAgent.isGodlike())
 	{
-		const LLTextureEntry* te = avatarp->getTE(i);
-		if (!te) continue;
+		LLFloaterAvatarTextures* self = (LLFloaterAvatarTextures*)data;
+		LLVOAvatar* avatarp = find_avatar(self->mID);
+		if (!avatarp) return;
 
-		if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
+		for (S32 i = 0; i < avatarp->getNumTEs(); i++)
 		{
-			LLUUID id = IMG_DEFAULT_AVATAR;
-			EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
-			LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
-			if (wearable)
+			const LLTextureEntry* te = avatarp->getTE(i);
+			if (!te) continue;
+
+			if (LLVOAvatar::isIndexLocalTexture((ETextureIndex)i))
 			{
-				LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
-				if (lto)
+				LLUUID id = IMG_DEFAULT_AVATAR;
+				EWearableType wearable_type = LLVOAvatarDictionary::getInstance()->getTEWearableType((ETextureIndex)i);
+				LLWearable *wearable = gAgentWearables.getWearable(wearable_type, 0);
+				if (wearable)
 				{
-					id = lto->getID();
+					LLLocalTextureObject *lto = wearable->getLocalTextureObject(i);
+					if (lto)
+					{
+						id = lto->getID();
+					}
+				}
+				if (id != IMG_DEFAULT_AVATAR)
+				{
+					llinfos << "Avatar TE " << i << " id " << id << llendl;
+				}
+				else
+				{
+					llinfos << "Avatar TE " << i << " id " << "<DEFAULT>" << llendl;
 				}
-			}
-			if (id != IMG_DEFAULT_AVATAR)
-			{
-				llinfos << "Avatar TE " << i << " id " << id << llendl;
 			}
 			else
 			{
-				llinfos << "Avatar TE " << i << " id " << "<DEFAULT>" << llendl;
+				llinfos << "Avatar TE " << i << " id " << te->getID() << llendl;
 			}
 		}
-		else
-		{
-			llinfos << "Avatar TE " << i << " id " << te->getID() << llendl;
-		}
 	}
-#endif
 }
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 3a6aed01ce..b54305f021 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -1802,9 +1802,10 @@ class LLAdvancedDebugAvatarTextures : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		handle_debug_avatar_textures(NULL);
-#endif
+		if (gAgent.isGodlike())
+		{
+			handle_debug_avatar_textures(NULL);
+		}
 		return true;
 	}
 };
-- 
cgit v1.2.3


From 2208e6da2ca9b9e94f5aa903d98a0167baf15577 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Wed, 31 Mar 2010 16:09:34 -0400
Subject: asset request logging for DEV-47362 investigation.

---
 indra/llmessage/llassetstorage.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'indra')

diff --git a/indra/llmessage/llassetstorage.cpp b/indra/llmessage/llassetstorage.cpp
index 0ab1081200..02523467e8 100644
--- a/indra/llmessage/llassetstorage.cpp
+++ b/indra/llmessage/llassetstorage.cpp
@@ -408,6 +408,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
 {
 	lldebugs << "LLAssetStorage::getAssetData() - " << uuid << "," << LLAssetType::lookup(type) << llendl;
 
+	llinfos << "ASSET_TRACE requesting " << uuid << " type " << LLAssetType::lookup(type) << llendl;
+
 	if (mShutDown)
 	{
 		return; // don't get the asset or do any callbacks, we are shutting down
@@ -471,6 +473,8 @@ void LLAssetStorage::getAssetData(const LLUUID uuid, LLAssetType::EType type, vo
 		// we've already got the file
 		// theoretically, partial files w/o a pending request shouldn't happen
 		// unless there's a weird error
+		llinfos << "ASSET_TRACE asset " << uuid << " found in VFS" << llendl;
+
 		if (callback)
 		{
 			callback(mVFS, uuid, type, user_data, LL_ERR_NOERR, LL_EXSTAT_VFS_CACHED);
@@ -528,6 +532,8 @@ void LLAssetStorage::downloadCompleteCallback(
 	LLAssetType::EType file_type,
 	void* user_data, LLExtStat ext_status)
 {
+	llinfos << "ASSET_TRACE asset " << file_id << " downloadCompleteCallback" << llendl;
+
 	lldebugs << "LLAssetStorage::downloadCompleteCallback() for " << file_id
 		 << "," << LLAssetType::lookup(file_type) << llendl;
 	LLAssetRequest* req = (LLAssetRequest*)user_data;
-- 
cgit v1.2.3


From 5c190996222ce2cf14997e16e16beb110173c0a2 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Wed, 31 Mar 2010 13:53:40 -0700
Subject: Enable OpenID auth in the embedded webkit browser.

Extract openid_url and openid_token tokens from the login response in process_login_success_response() and send them to LLViewerMedia if they're present.

Added LLViewerMedia::openIDSetup() to receive openid_url and openid_token, and added code to LLViewerMedia to do a POST with LLHTTPClient, retrieve the resulting cookie, and push it into the central cookie store.  Also made sure the OpenID cookie gets re-added when the cookie store is cleared.

Added LLPluginCookieStore::setCookiesFromHost() to properly add a cookie that may not have a domain set.  Made LLPluginCookieStore::Cookie::parse() add missing domain and path fields to cookies as necessary.

Fixed an issue where carriage returns in the string passed to LLPluginCookieStore::setCookies() or LLPluginCookieStore::setCookiesFromHost() would cause a parse failure.

Reviewed by gino and callum at http://codereview.lindenlab.com/1254001
---
 indra/llplugin/llplugincookiestore.cpp | 73 ++++++++++++++++++++++---
 indra/llplugin/llplugincookiestore.h   |  9 ++--
 indra/newview/llstartup.cpp            |  7 +++
 indra/newview/llviewermedia.cpp        | 99 +++++++++++++++++++++++++++++++++-
 indra/newview/llviewermedia.h          |  8 +++
 5 files changed, 184 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp
index 1964b8d789..92ee24e1d5 100644
--- a/indra/llplugin/llplugincookiestore.cpp
+++ b/indra/llplugin/llplugincookiestore.cpp
@@ -62,11 +62,11 @@ LLPluginCookieStore::Cookie::Cookie(const std::string &s, std::string::size_type
 {
 }
 
-LLPluginCookieStore::Cookie *LLPluginCookieStore::Cookie::createFromString(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end)
+LLPluginCookieStore::Cookie *LLPluginCookieStore::Cookie::createFromString(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, const std::string &host)
 {
 	Cookie *result = new Cookie(s, cookie_start, cookie_end);
 
-	if(!result->parse())
+	if(!result->parse(host))
 	{
 		delete result;
 		result = NULL;
@@ -92,7 +92,7 @@ std::string LLPluginCookieStore::Cookie::getKey() const
 	return result;
 }
 
-bool LLPluginCookieStore::Cookie::parse()
+bool LLPluginCookieStore::Cookie::parse(const std::string &host)
 {
 	bool first_field = true;
 
@@ -248,7 +248,50 @@ bool LLPluginCookieStore::Cookie::parse()
 	// The cookie MUST have a name
 	if(mNameEnd <= mNameStart)
 		return false;
+	
+	// If the cookie doesn't have a domain, add the current host as the domain.
+	if(mDomainEnd <= mDomainStart)
+	{
+		if(host.empty())
+		{
+			// no domain and no current host -- this is a parse failure.
+			return false;
+		}
+		
+		// Figure out whether this cookie ended with a ";" or not...
+		std::string::size_type last_char = mCookie.find_last_not_of(" ");
+		if((last_char != std::string::npos) && (mCookie[last_char] != ';'))
+		{
+			mCookie += ";";
+		}
+		
+		mCookie += " domain=";
+		mDomainStart = mCookie.size();
+		mCookie += host;
+		mDomainEnd = mCookie.size();
+		
+		lldebugs << "added domain (" << mDomainStart << " to " << mDomainEnd << "), new cookie is: " << mCookie << llendl;
+	}
+
+	// If the cookie doesn't have a path, add "/".
+	if(mPathEnd <= mPathStart)
+	{
+		// Figure out whether this cookie ended with a ";" or not...
+		std::string::size_type last_char = mCookie.find_last_not_of(" ");
+		if((last_char != std::string::npos) && (mCookie[last_char] != ';'))
+		{
+			mCookie += ";";
+		}
+		
+		mCookie += " path=";
+		mPathStart = mCookie.size();
+		mCookie += "/";
+		mPathEnd = mCookie.size();
 		
+		lldebugs << "added path (" << mPathStart << " to " << mPathEnd << "), new cookie is: " << mCookie << llendl;
+	}
+	
+	
 	return true;
 }
 
@@ -409,13 +452,29 @@ void LLPluginCookieStore::setCookies(const std::string &cookies, bool mark_chang
 
 	while(start != std::string::npos)
 	{
-		std::string::size_type end = cookies.find('\n', start);
+		std::string::size_type end = cookies.find_first_of("\r\n", start);
 		if(end > start)
 		{
 			// The line is non-empty.  Try to create a cookie from it.
 			setOneCookie(cookies, start, end, mark_changed);
 		}
-		start = cookies.find_first_not_of("\n ", end);
+		start = cookies.find_first_not_of("\r\n ", end);
+	}
+}
+
+void LLPluginCookieStore::setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed)
+{
+	std::string::size_type start = 0;
+
+	while(start != std::string::npos)
+	{
+		std::string::size_type end = cookies.find_first_of("\r\n", start);
+		if(end > start)
+		{
+			// The line is non-empty.  Try to create a cookie from it.
+			setOneCookie(cookies, start, end, mark_changed, host);
+		}
+		start = cookies.find_first_not_of("\r\n ", end);
 	}
 }
 			
@@ -502,9 +561,9 @@ std::string LLPluginCookieStore::unquoteString(const std::string &s)
 // When deleting with mark_changed set to true, this replaces the existing cookie in the list with an entry that's marked both dead and changed.
 // Some time later when writeChangedCookies() is called with clear_changed set to true, the dead cookie is deleted from the list after being returned, so that the
 // delete operation (in the form of the expired cookie) is passed along.
-void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed)
+void LLPluginCookieStore::setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host)
 {
-	Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end);
+	Cookie *cookie = Cookie::createFromString(s, cookie_start, cookie_end, host);
 	if(cookie)
 	{
 		lldebugs << "setting cookie: " << cookie->getCookie() << llendl;
diff --git a/indra/llplugin/llplugincookiestore.h b/indra/llplugin/llplugincookiestore.h
index 5250f008b6..a93f0c14f0 100644
--- a/indra/llplugin/llplugincookiestore.h
+++ b/indra/llplugin/llplugincookiestore.h
@@ -66,18 +66,21 @@ public:
 	void setCookies(const std::string &cookies, bool mark_changed = true);
 	void readCookies(std::istream& s, bool mark_changed = true);
 
+	// sets one or more cookies (without reinitializing anything), supplying a hostname the cookies came from -- use when setting a cookie manually
+	void setCookiesFromHost(const std::string &cookies, const std::string &host, bool mark_changed = true);
+
 	// quote or unquote a string as per the definition of 'quoted-string' in rfc2616
 	static std::string quoteString(const std::string &s);
 	static std::string unquoteString(const std::string &s);
 	
 private:
 
-	void setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed);
+	void setOneCookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end, bool mark_changed, const std::string &host = LLStringUtil::null);
 
 	class Cookie
 	{
 	public:
-		static Cookie *createFromString(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos);
+		static Cookie *createFromString(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos, const std::string &host = LLStringUtil::null);
 		
 		// Construct a string from the cookie that uniquely represents it, to be used as a key in a std::map.
 		std::string getKey() const;
@@ -95,7 +98,7 @@ private:
 		
 	private:
 		Cookie(const std::string &s, std::string::size_type cookie_start = 0, std::string::size_type cookie_end = std::string::npos);
-		bool parse();
+		bool parse(const std::string &host);
 		std::string::size_type findFieldEnd(std::string::size_type start = 0, std::string::size_type end = std::string::npos);
 		bool matchName(std::string::size_type start, std::string::size_type end, const char *name);
 		
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 1a1dffe85c..b5a73a3143 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -3087,6 +3087,13 @@ bool process_login_success_response()
 		}
 	}
 
+	// Start the process of fetching the OpenID session cookie for this user login
+	std::string openid_url = response["openid_url"];
+	if(!openid_url.empty())
+	{
+		std::string openid_token = response["openid_token"];
+		LLViewerMedia::openIDSetup(openid_url, openid_token);
+	}
 
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 6f0d9cdd95..d9fabc7d64 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -257,7 +257,43 @@ public:
 		LLViewerMediaImpl *mMediaImpl;
 		bool mInitialized;
 };
+
+class LLViewerMediaOpenIDResponder : public LLHTTPClient::Responder
+{
+LOG_CLASS(LLViewerMediaOpenIDResponder);
+public:
+	LLViewerMediaOpenIDResponder( )
+	{
+	}
+
+	~LLViewerMediaOpenIDResponder()
+	{
+	}
+
+	/* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
+	{
+		LL_DEBUGS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL;
+		LL_DEBUGS("MediaAuth") << content << LL_ENDL;
+		std::string cookie = content["set-cookie"].asString();
+		
+		LLViewerMedia::openIDCookieResponse(cookie);
+	}
+
+	/* virtual */ void completedRaw(
+		U32 status,
+		const std::string& reason,
+		const LLChannelDescriptors& channels,
+		const LLIOPipe::buffer_ptr_t& buffer)
+	{
+		// This is just here to disable the default behavior (attempting to parse the response as llsd).
+		// We don't care about the content of the response, only the set-cookie header.
+	}
+
+};
+
 LLPluginCookieStore *LLViewerMedia::sCookieStore = NULL;
+LLURL LLViewerMedia::sOpenIDURL;
+std::string LLViewerMedia::sOpenIDCookie;
 static LLViewerMedia::impl_list sViewerMediaImplList;
 static LLViewerMedia::impl_id_map sViewerMediaTextureIDMap;
 static LLTimer sMediaCreateTimer;
@@ -1067,7 +1103,8 @@ void LLViewerMedia::clearAllCookies()
 		}
 	}
 	
-	
+	// If we have an OpenID cookie, re-add it to the cookie store.
+	setOpenIDCookie();
 }
 	
 /////////////////////////////////////////////////////////////////////////////////////////
@@ -1168,7 +1205,9 @@ void LLViewerMedia::loadCookieFile()
 			pimpl->mMediaSource->clear_cookies();
 		}
 	}
-
+	
+	// If we have an OpenID cookie, re-add it to the cookie store.
+	setOpenIDCookie();
 }
 
 
@@ -1241,6 +1280,62 @@ void LLViewerMedia::removeCookie(const std::string &name, const std::string &dom
 }
 
 
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::setOpenIDCookie()
+{
+	if(!sOpenIDCookie.empty())
+	{
+		getCookieStore()->setCookiesFromHost(sOpenIDCookie, sOpenIDURL.mAuthority);
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::openIDSetup(const std::string &openid_url, const std::string &openid_token)
+{
+	LL_DEBUGS("MediaAuth") << "url = \"" << openid_url << "\", token = \"" << openid_token << "\"" << LL_ENDL;
+
+	// post the token to the url 
+	// the responder will need to extract the cookie(s).
+
+	// Save the OpenID URL for later -- we may need the host when adding the cookie.
+	sOpenIDURL.init(openid_url.c_str());
+	
+	// We shouldn't ever do this twice, but just in case this code gets repurposed later, clear existing cookies.
+	sOpenIDCookie.clear();
+
+	LLSD headers = LLSD::emptyMap();
+	// Keep LLHTTPClient from adding an "Accept: application/llsd+xml" header
+	headers["Accept"] = "*/*";
+	// and use the expected content-type for a post, instead of the LLHTTPClient::postRaw() default of "application/octet-stream"
+	headers["Content-Type"] = "application/x-www-form-urlencoded";
+
+	// postRaw() takes ownership of the buffer and releases it later, so we need to allocate a new buffer here.
+	size_t size = openid_token.size();
+	U8 *data = new U8[size];
+	memcpy(data, openid_token.data(), size);
+
+	LLHTTPClient::postRaw( 
+		openid_url, 
+		data, 
+		size, 
+		new LLViewerMediaOpenIDResponder(),
+		headers);
+			
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::openIDCookieResponse(const std::string &cookie)
+{
+	LL_DEBUGS("MediaAuth") << "Cookie received: \"" << cookie << "\"" << LL_ENDL;
+	
+	sOpenIDCookie += cookie;
+
+	setOpenIDCookie();
+}
+
 bool LLViewerMedia::hasInWorldMedia()
 {
 	if (sInWorldMediaDisabled) return false;
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 10dacf9532..e829d7a5b4 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -44,6 +44,8 @@
 #include "llpluginclassmedia.h"
 #include "v4color.h"
 
+#include "llurl.h"
+
 class LLViewerMediaImpl;
 class LLUUID;
 class LLViewerMediaTexture;
@@ -152,11 +154,17 @@ public:
 	static void addCookie(const std::string &name, const std::string &value, const std::string &domain, const LLDate &expires, const std::string &path = std::string("/"), bool secure = false );
 	static void addSessionCookie(const std::string &name, const std::string &value, const std::string &domain, const std::string &path = std::string("/"), bool secure = false );
 	static void removeCookie(const std::string &name, const std::string &domain, const std::string &path = std::string("/") );
+
+	static void openIDSetup(const std::string &openid_url, const std::string &openid_token);
+	static void openIDCookieResponse(const std::string &cookie);
 	
 private:
+	static void setOpenIDCookie();
 	static void onTeleportFinished();
 	
 	static LLPluginCookieStore *sCookieStore;
+	static LLURL sOpenIDURL;
+	static std::string sOpenIDCookie;
 };
 
 // Implementation functions not exported into header file
-- 
cgit v1.2.3


From 1e8375571526c0275ef0d5dcc4860df9cdd8b68b Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Wed, 31 Mar 2010 17:55:08 -0400
Subject: EXT-3604 : Accordion folders should show "Loading..." when fetching
 contents

Superficial cleanup of LLFolderViewItem::draw.  No functionality change.
---
 indra/newview/llfolderviewitem.cpp | 292 +++++++++++++++++++------------------
 1 file changed, 151 insertions(+), 141 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index ecbaac5743..c916e4b98c 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -437,11 +437,8 @@ S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 
 S32 LLFolderViewItem::getItemHeight()
 {
-	if (mHidden) return 0;
+	if (getHidden()) return 0;
 
-	//S32 icon_height = mIcon->getHeight();
-	//S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight());
-	//return llmax( icon_height, label_height ) + ICON_PAD;
 	return mItemHeight;
 }
 
@@ -824,32 +821,34 @@ BOOL LLFolderViewItem::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 	return handled;
 }
 
-
 void LLFolderViewItem::draw()
 {
-	if (mHidden) return;
+	if (getHidden())
+	{
+		return;
+	}
 
 	static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
 	static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
 	static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
-	static LLUIColor sFocusOutlineColor =
-		LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
+	static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
 	static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
 	static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
 	static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemSuffixColor", DEFAULT_WHITE);
 	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
-
 	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
 	const S32 TOP_PAD = default_params.item_top_pad;
+	const S32 FOCUS_LEFT = 1;
+	const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
 
-	bool possibly_has_children = false;
-	bool up_to_date = mListener && mListener->isUpToDate();
-	if((up_to_date && hasVisibleChildren() ) || // we fetched our children and some of them have passed the filter...
-		(!up_to_date && mListener && mListener->hasChildren())) // ...or we know we have children but haven't fetched them (doesn't obey filter)
-	{
-		possibly_has_children = true;
-	}
-	if(/*mControlLabel[0] != '\0' && */possibly_has_children)
+
+	//--------------------------------------------------------------------------------//
+	// Draw open folder arrow
+	//
+	const bool up_to_date = mListener && mListener->isUpToDate();
+	const bool possibly_has_children = ((up_to_date && hasVisibleChildren()) || // we fetched our children and some of them have passed the filter...
+										(!up_to_date && mListener && mListener->hasChildren())); // ...or we know we have children but haven't fetched them (doesn't obey filter)
+	if (possibly_has_children)
 	{
 		LLUIImage* arrow_image = default_params.folder_arrow_image;
 		gl_draw_scaled_rotated_image(
@@ -857,22 +856,16 @@ void LLFolderViewItem::draw()
 			ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor);
 	}
 
-	// See also LLFolderView::updateRenamerPosition()
-	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
-
-	LLFontGL* font = getLabelFontForStyle(mLabelStyle);
-
-	// If we have keyboard focus, draw selection filled
-	BOOL show_context = getRoot()->getShowSelectionContext();
-	BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus());
-	const S32 FOCUS_LEFT = 1;
-	S32 focus_top = getRect().getHeight();
-	S32 focus_bottom = getRect().getHeight() - mItemHeight;
-	bool folder_open = (getRect().getHeight() > mItemHeight + 4);
 
-	// always render "current" item, only render other selected items if
-	// mShowSingleSelection is FALSE
-	if( mIsSelected )
+	//--------------------------------------------------------------------------------//
+	// Draw highlight for selected items
+	//
+	const BOOL show_context = getRoot()->getShowSelectionContext();
+	const BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus()); // If we have keyboard focus, draw selection filled
+	const S32 focus_top = getRect().getHeight();
+	const S32 focus_bottom = getRect().getHeight() - mItemHeight;
+	const bool folder_open = (getRect().getHeight() > mItemHeight + 4);
+	if (mIsSelected) // always render "current" item.  Only render other selected items if mShowSingleSelection is FALSE
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		LLColor4 bg_color = sHighlightBgColor;
@@ -891,152 +884,169 @@ void LLFolderViewItem::draw()
 				bg_color.mV[VALPHA] = clamp_rescale(fade_time, 0.f, 0.4f, 0.f, bg_color.mV[VALPHA]);
 			}
 		}
-
-		gl_rect_2d(
-			FOCUS_LEFT,
-			focus_top, 
-			getRect().getWidth() - 2,
-			focus_bottom,
-			bg_color, filled);
+		gl_rect_2d(FOCUS_LEFT,
+				   focus_top, 
+				   getRect().getWidth() - 2,
+				   focus_bottom,
+				   bg_color, filled);
 		if (mIsCurSelection)
 		{
-			gl_rect_2d(
-				FOCUS_LEFT, 
-				focus_top, 
-				getRect().getWidth() - 2,
-				focus_bottom,
-				sFocusOutlineColor, FALSE);
+			gl_rect_2d(FOCUS_LEFT, 
+					   focus_top, 
+					   getRect().getWidth() - 2,
+					   focus_bottom,
+					   sFocusOutlineColor, FALSE);
 		}
 		if (folder_open)
 		{
-			gl_rect_2d(
-				FOCUS_LEFT,
-				focus_bottom + 1, // overlap with bottom edge of above rect
-				getRect().getWidth() - 2,
-				0,
-				sFocusOutlineColor, FALSE);
+			gl_rect_2d(FOCUS_LEFT,
+					   focus_bottom + 1, // overlap with bottom edge of above rect
+					   getRect().getWidth() - 2,
+					   0,
+					   sFocusOutlineColor, FALSE);
 			if (show_context)
 			{
-				gl_rect_2d(
-					FOCUS_LEFT,
-					focus_bottom + 1,
-					getRect().getWidth() - 2,
-					0,
-					sHighlightBgColor, TRUE);
+				gl_rect_2d(FOCUS_LEFT,
+						   focus_bottom + 1,
+						   getRect().getWidth() - 2,
+						   0,
+						   sHighlightBgColor, TRUE);
 			}
 		}
 	}
+
+	//--------------------------------------------------------------------------------//
+	// Draw DragNDrop highlight
+	//
 	if (mDragAndDropTarget)
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
-		gl_rect_2d(
-			FOCUS_LEFT, 
-			focus_top, 
-			getRect().getWidth() - 2,
-			focus_bottom,
-			sHighlightBgColor, FALSE);
+		gl_rect_2d(FOCUS_LEFT, 
+				   focus_top, 
+				   getRect().getWidth() - 2,
+				   focus_bottom,
+				   sHighlightBgColor, FALSE);
 		if (folder_open)
 		{
-			gl_rect_2d(
-				FOCUS_LEFT,
-				focus_bottom + 1, // overlap with bottom edge of above rect
-				getRect().getWidth() - 2,
-				0,
-				sHighlightBgColor, FALSE);
+			gl_rect_2d(FOCUS_LEFT,
+					   focus_bottom + 1, // overlap with bottom edge of above rect
+					   getRect().getWidth() - 2,
+					   0,
+					   sHighlightBgColor, FALSE);
 		}
 		mDragAndDropTarget = FALSE;
 	}
 
-	S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD;
-	// First case is used for open folders
-	if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80))
+	
+	//--------------------------------------------------------------------------------//
+	// Draw open icon
+	//
+	const S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD;
+	if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80)) // For open folders
  	{
 		mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1);
 	}
-	else if(mIcon)
+	else if (mIcon)
 	{
  		mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
  	}
 
-	if (!mLabel.empty())
+
+	//--------------------------------------------------------------------------------//
+	// Exit if no label to draw
+	//
+	if (mLabel.empty())
 	{
-		// highlight filtered text
-		BOOL debug_filters = getRoot()->getDebugFilters();
-		LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor );
-		F32 right_x;
-		F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
+		return;
+	}
 
-		if (debug_filters)
-		{
-			if (!getFiltered() && !possibly_has_children)
-			{
-				color.mV[VALPHA] *= 0.5f;
-			}
+	LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
+	F32 right_x  = 0;
+	F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
+	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
 
-			LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? LLColor4(0.5f, 0.8f, 0.5f, 1.f) : LLColor4(0.8f, 0.5f, 0.5f, 1.f);
-			LLFontGL::getFontMonospace()->renderUTF8(
-				mStatusText, 0, text_left, y, filter_color,
-				LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
-				S32_MAX, S32_MAX, &right_x, FALSE );
-			text_left = right_x;
+	//--------------------------------------------------------------------------------//
+	// Highlight filtered text
+	//
+	if (getRoot()->getDebugFilters())
+	{
+		if (!getFiltered() && !possibly_has_children)
+		{
+			color.mV[VALPHA] *= 0.5f;
 		}
+		LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? 
+			LLColor4(0.5f, 0.8f, 0.5f, 1.f) : 
+			LLColor4(0.8f, 0.5f, 0.5f, 1.f);
+		LLFontGL::getFontMonospace()->renderUTF8(mStatusText, 0, text_left, y, filter_color,
+												 LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+												 S32_MAX, S32_MAX, &right_x, FALSE );
+		text_left = right_x;
+	}
 
 
-		font->renderUTF8( mLabel, 0, text_left, y, color,
-						  LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
-						  S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE);
+	//--------------------------------------------------------------------------------//
+	// Draw the actual label text
+	//
+	font->renderUTF8(mLabel, 0, text_left, y, color,
+					 LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+					 S32_MAX, getRect().getWidth() - (S32) text_left, &right_x, TRUE);
 
-//		LLViewerInventoryCategory *item = 0;
-//		if (getListener())
-//			item = gInventory.getCategory(getListener()->getUUID());
-		bool root_is_loading = false;
-		if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getRootFolderID()))
-		{
-			// Descendent of my inventory.
-			root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress();
-		}
-		if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(),gInventory.getLibraryRootFolderID()))
-		{
-			// Descendent of library
-			root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress();
-		}
-			
-		if ( (mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime"))
-			|| (LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && root_is_loading && mShowLoadStatus) )
-		{
-			std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) ";
-			font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor,
-					  LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, &right_x, FALSE);
-		}
+	//--------------------------------------------------------------------------------//
+	// Draw "Loading..." text
+	//
+	bool root_is_loading = false;
+	if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), 
+														 gInventory.getRootFolderID())) // Descendent of my inventory
+	{
+		root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress(); 
+	}
+	if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), 
+														 gInventory.getLibraryRootFolderID())) // Descendent of library
+	{
+		root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress();
+	}
+	if ((mIsLoading && mTimeSinceRequestStart.getElapsedTimeF32() >= gSavedSettings.getF32("FolderLoadingMessageWaitTime")) ||
+		(LLInventoryModelBackgroundFetch::instance().backgroundFetchActive() && root_is_loading && (mShowLoadStatus || mHidden)))
+	{
+		std::string load_string = " ( " + LLTrans::getString("LoadingData") + " ) ";
+		font->renderUTF8(load_string, 0, right_x, y, sSearchStatusColor,
+						 LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, 
+						 S32_MAX, S32_MAX, &right_x, FALSE);
+	}
 
-		if (!mLabelSuffix.empty())
-		{
-			font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor,
-					   LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
-				S32_MAX, S32_MAX, &right_x, FALSE );
-		}
+	//--------------------------------------------------------------------------------//
+	// Draw label suffix
+	//
+	if (!mLabelSuffix.empty())
+	{
+		font->renderUTF8( mLabelSuffix, 0, right_x, y, sSuffixColor,
+						  LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+						  S32_MAX, S32_MAX, &right_x, FALSE );
+	}
 
-		if (mStringMatchOffset != std::string::npos)
+	//--------------------------------------------------------------------------------//
+	// Highlight string match
+	//
+	if (mStringMatchOffset != std::string::npos)
+	{
+		// don't draw backgrounds for zero-length strings
+		S32 filter_string_length = getRoot()->getFilterSubString().size();
+		if (filter_string_length > 0)
 		{
-			// don't draw backgrounds for zero-length strings
-			S32 filter_string_length = getRoot()->getFilterSubString().size();
-			if (filter_string_length > 0)
-			{
-				std::string combined_string = mLabel + mLabelSuffix;
-				S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1;
-				S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
-				S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
-				S32 top = getRect().getHeight() - TOP_PAD;
+			std::string combined_string = mLabel + mLabelSuffix;
+			S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1;
+			S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
+			S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
+			S32 top = getRect().getHeight() - TOP_PAD;
 		
-				LLUIImage* box_image = default_params.selection_image;
-				LLRect box_rect(left, top, right, bottom);
-				box_image->draw(box_rect, sFilterBGColor);
-				F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset);
-				F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
-				font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy,
-								  sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
-								  filter_string_length, S32_MAX, &right_x, FALSE );
-			}
+			LLUIImage* box_image = default_params.selection_image;
+			LLRect box_rect(left, top, right, bottom);
+			box_image->draw(box_rect, sFilterBGColor);
+			F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset);
+			F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
+			font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy,
+							  sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
+							  filter_string_length, S32_MAX, &right_x, FALSE );
 		}
 	}
 }
-- 
cgit v1.2.3


From ac271e1d50bd601d9fbf18655596fa695b80dec0 Mon Sep 17 00:00:00 2001
From: CG Linden <cg@lindenlab.com>
Date: Wed, 31 Mar 2010 15:24:42 -0700
Subject: Include channel names in update_version_files.py invocation to fix
 bad viewer channel name.

---
 indra/llcommon/llversionserver.h              | 2 +-
 indra/llcommon/llversionviewer.h              | 2 +-
 indra/newview/English.lproj/InfoPlist.strings | 4 ++--
 indra/newview/Info-SecondLife.plist           | 2 +-
 indra/newview/res/viewerRes.rc                | 8 ++++----
 5 files changed, 9 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h
index 0f1e59a18c..e3663544db 100644
--- a/indra/llcommon/llversionserver.h
+++ b/indra/llcommon/llversionserver.h
@@ -36,7 +36,7 @@
 const S32 LL_VERSION_MAJOR = 1;
 const S32 LL_VERSION_MINOR = 31;
 const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 200030;
+const S32 LL_VERSION_BUILD = 203110;
 
 const char * const LL_CHANNEL = "Second Life Server";
 
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 540aea4252..3ab4257fab 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -36,7 +36,7 @@
 const S32 LL_VERSION_MAJOR = 2;
 const S32 LL_VERSION_MINOR = 0;
 const S32 LL_VERSION_PATCH = 0;
-const S32 LL_VERSION_BUILD = 200030;
+const S32 LL_VERSION_BUILD = 203110;
 
 const char * const LL_CHANNEL = "Second Life Developer";
 
diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings
index 879408d6e4..02c3dfc6e0 100644
--- a/indra/newview/English.lproj/InfoPlist.strings
+++ b/indra/newview/English.lproj/InfoPlist.strings
@@ -2,6 +2,6 @@
 
 CFBundleName = "Second Life";
 
-CFBundleShortVersionString = "Second Life version 2.0.0.200030";
-CFBundleGetInfoString = "Second Life version 2.0.0.200030, Copyright 2004-2009 Linden Research, Inc.";
+CFBundleShortVersionString = "Second Life version 2.0.0.203110";
+CFBundleGetInfoString = "Second Life version 2.0.0.203110, Copyright 2004-2009 Linden Research, Inc.";
 
diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist
index 38ebb22b84..4cb01a0f33 100644
--- a/indra/newview/Info-SecondLife.plist
+++ b/indra/newview/Info-SecondLife.plist
@@ -32,7 +32,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>2.0.0.200030</string>
+	<string>2.0.0.203110</string>
 	<key>CSResourcesFileMapped</key>
 	<true/>
 </dict>
diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc
index 7a965cf57e..ecdcacec46 100644
--- a/indra/newview/res/viewerRes.rc
+++ b/indra/newview/res/viewerRes.rc
@@ -129,8 +129,8 @@ TOOLBUY                 CURSOR                  "toolbuy.cur"
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 2,0,0,3422
- PRODUCTVERSION 2,0,0,3422
+ FILEVERSION 2,0,0,203110
+ PRODUCTVERSION 2,0,0,203110
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
@@ -147,12 +147,12 @@ BEGIN
         BEGIN
             VALUE "CompanyName", "Linden Lab"
             VALUE "FileDescription", "Second Life"
-            VALUE "FileVersion", "2.0.0.200030"
+            VALUE "FileVersion", "2.0.0.203110"
             VALUE "InternalName", "Second Life"
             VALUE "LegalCopyright", "Copyright � 2001-2008, Linden Research, Inc."
             VALUE "OriginalFilename", "SecondLife.exe"
             VALUE "ProductName", "Second Life"
-            VALUE "ProductVersion", "2.0.0.200030"
+            VALUE "ProductVersion", "2.0.0.203110"
         END
     END
     BLOCK "VarFileInfo"
-- 
cgit v1.2.3


From 11b588c29c5c49af70f4a55258bb934cb7ccdb55 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Wed, 31 Mar 2010 18:50:20 -0700
Subject: Fixed a problem with LLPluginCookieStore that would have caused
 problems when adding multiple cookies with setCookies(), setAllCookies(), and
 setCookiesFromHost().

---
 indra/llplugin/llplugincookiestore.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llplugin/llplugincookiestore.cpp b/indra/llplugin/llplugincookiestore.cpp
index 92ee24e1d5..85b1e70d78 100644
--- a/indra/llplugin/llplugincookiestore.cpp
+++ b/indra/llplugin/llplugincookiestore.cpp
@@ -53,7 +53,7 @@ LLPluginCookieStore::~LLPluginCookieStore()
 
 
 LLPluginCookieStore::Cookie::Cookie(const std::string &s, std::string::size_type cookie_start, std::string::size_type cookie_end):
-	mCookie(s, cookie_start, cookie_end),
+	mCookie(s, cookie_start, cookie_end - cookie_start),
 	mNameStart(0), mNameEnd(0),
 	mValueStart(0), mValueEnd(0),
 	mDomainStart(0), mDomainEnd(0),
-- 
cgit v1.2.3


From e868159922b97c5f7de4bdd83de65e135d16ff01 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Wed, 31 Mar 2010 18:51:09 -0700
Subject: Added unit test for LLPluginCookieStore.

---
 indra/llplugin/CMakeLists.txt                     |  17 +++
 indra/llplugin/tests/llplugincookiestore_test.cpp | 178 ++++++++++++++++++++++
 2 files changed, 195 insertions(+)
 create mode 100644 indra/llplugin/tests/llplugincookiestore_test.cpp

(limited to 'indra')

diff --git a/indra/llplugin/CMakeLists.txt b/indra/llplugin/CMakeLists.txt
index def9fcbeae..441becbae0 100644
--- a/indra/llplugin/CMakeLists.txt
+++ b/indra/llplugin/CMakeLists.txt
@@ -3,6 +3,7 @@
 project(llplugin)
 
 include(00-Common)
+include(CURL)
 include(LLCommon)
 include(LLImage)
 include(LLMath)
@@ -55,3 +56,19 @@ list(APPEND llplugin_SOURCE_FILES ${llplugin_HEADER_FILES})
 add_library (llplugin ${llplugin_SOURCE_FILES})
 
 add_subdirectory(slplugin)
+
+# Add tests
+include(LLAddBuildTest)
+# UNIT TESTS
+SET(llplugin_TEST_SOURCE_FILES
+  llplugincookiestore.cpp
+  )
+
+# llplugincookiestore has a dependency on curl, so we need to link the curl library into the test.
+set_source_files_properties(
+  llplugincookiestore.cpp
+  PROPERTIES
+    LL_TEST_ADDITIONAL_LIBRARIES "${CURL_LIBRARIES}"
+  )
+
+LL_ADD_PROJECT_UNIT_TESTS(llplugin "${llplugin_TEST_SOURCE_FILES}")
diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp
new file mode 100644
index 0000000000..e3e8ac9804
--- /dev/null
+++ b/indra/llplugin/tests/llplugincookiestore_test.cpp
@@ -0,0 +1,178 @@
+#include "linden_common.h"
+#include "../test/lltut.h"
+
+#include "../llplugincookiestore.h"
+
+
+namespace tut
+{
+	// Main Setup
+	struct LLPluginCookieStoreFixture
+	{
+		LLPluginCookieStoreFixture()
+		{
+			// We need dates definitively in the past and the future to properly test cookie expiration.
+			LLDate now = LLDate::now(); 
+			LLDate past(now.secondsSinceEpoch() - (60.0 * 60.0 * 24.0));	// 1 day in the past
+			LLDate future(now.secondsSinceEpoch() + (60.0 * 60.0 * 24.0));	// 1 day in the future
+			
+			mPastString = past.asRFC1123();
+			mFutureString = future.asRFC1123();
+		}
+		
+		std::string mPastString;
+		std::string mFutureString;
+		LLPluginCookieStore mCookieStore;
+		
+		// List of cookies used for validation
+		std::list<std::string> mCookies;
+		
+		// This sets up mCookies from a string returned by one of the functions in LLPluginCookieStore
+		void setCookies(const std::string &cookies)
+		{
+			mCookies.clear();
+			std::string::size_type start = 0;
+
+			while(start != std::string::npos)
+			{
+				std::string::size_type end = cookies.find_first_of("\r\n", start);
+				if(end > start)
+				{
+					std::string line(cookies, start, end - start);
+					if(line.find_first_not_of("\r\n\t ") != std::string::npos)
+					{
+						// The line has some non-whitespace characters.  Save it to the list.
+						mCookies.push_back(std::string(cookies, start, end - start));
+					}
+				}
+				start = cookies.find_first_not_of("\r\n ", end);
+			}
+		}
+		
+		// This ensures that a cookie matching the one passed is in the list.
+		void ensureCookie(const std::string &cookie)
+		{
+			std::list<std::string>::iterator iter;
+			for(iter = mCookies.begin(); iter != mCookies.end(); iter++)
+			{
+				if(*iter == cookie)
+				{
+					// Found the cookie
+					// TODO: this should do a smarter equality comparison on the two cookies, instead of just a string compare.
+					return;
+				}
+			}
+			
+			// Didn't find this cookie
+			std::string message = "cookie not found: ";
+			message += cookie;
+			ensure(message, false);
+		}
+		
+		// This ensures that the number of cookies in the list matches what's expected.
+		void ensureSize(const std::string &message, size_t size)
+		{
+			if(mCookies.size() != size)
+			{
+				std::stringstream full_message;
+				
+				full_message << message << " (expected " << size << ", actual " << mCookies.size() << ")";
+				ensure(full_message.str(), false);
+			}
+		}
+	};
+	
+	typedef test_group<LLPluginCookieStoreFixture> factory;
+	typedef factory::object object;
+	factory tf("LLPluginCookieStore test");
+
+	// Tests
+	template<> template<>
+	void object::test<1>()
+	{
+		// Test 1: cookie uniqueness and update lists.
+		// Valid, distinct cookies:
+		
+		std::string cookie01 = "cookieA=value; domain=example.com; path=/";
+		std::string cookie02 = "cookieB=value; domain=example.com; path=/"; // different name
+		std::string cookie03 = "cookieA=value; domain=foo.example.com; path=/"; // different domain
+		std::string cookie04 = "cookieA=value; domain=example.com; path=/bar/"; // different path
+		std::string cookie05 = "cookieC; domain=example.com; path=/"; // empty value
+		std::string cookie06 = "cookieD=value; domain=example.com; path=/; expires="; // different name, persistent cookie
+		cookie06 += mFutureString;
+		
+		mCookieStore.setCookies(cookie01);
+		mCookieStore.setCookies(cookie02);
+		mCookieStore.setCookies(cookie03);
+		mCookieStore.setCookies(cookie04);
+		mCookieStore.setCookies(cookie05);
+		mCookieStore.setCookies(cookie06);
+		
+		// Invalid cookies (these will get parse errors and not be added to the store)
+
+		std::string badcookie01 = "cookieD=value; domain=example.com; path=/; foo=bar"; // invalid field name
+		std::string badcookie02 = "cookieE=value; path=/"; // no domain
+
+		mCookieStore.setCookies(badcookie01);
+		mCookieStore.setCookies(badcookie02);
+		
+		// All cookies added so far should have been marked as "changed"
+		setCookies(mCookieStore.getChangedCookies());
+		ensureSize("count of changed cookies", 6);
+		ensureCookie(cookie01);
+		ensureCookie(cookie02);
+		ensureCookie(cookie03);
+		ensureCookie(cookie04);
+		ensureCookie(cookie05);
+		ensureCookie(cookie06);
+		
+		// Save off the current state of the cookie store (we'll restore it later)
+		std::string savedCookies = mCookieStore.getAllCookies();
+		
+		// Test replacing cookies
+		std::string cookie01a = "cookieA=newvalue; domain=example.com; path=/";	// updated value
+		std::string cookie02a = "cookieB=newvalue; domain=example.com; path=/; expires="; // remove cookie (by setting an expire date in the past)
+		cookie02a += mPastString;
+		
+		mCookieStore.setCookies(cookie01a);
+		mCookieStore.setCookies(cookie02a);
+
+		// test for getting changed cookies
+		setCookies(mCookieStore.getChangedCookies());
+		ensureSize("count of updated cookies", 2);
+		ensureCookie(cookie01a);
+		ensureCookie(cookie02a);
+		
+		// and for the state of the store after getting changed cookies
+		setCookies(mCookieStore.getAllCookies());
+		ensureSize("count of valid cookies", 5);
+		ensureCookie(cookie01a);
+		ensureCookie(cookie03);
+		ensureCookie(cookie04);
+		ensureCookie(cookie05);
+		ensureCookie(cookie06);
+
+		// Check that only the persistent cookie is returned here
+		setCookies(mCookieStore.getPersistentCookies());
+		ensureSize("count of persistent cookies", 1);
+		ensureCookie(cookie06);
+
+		// Restore the cookie store to a previous state and verify
+		mCookieStore.setAllCookies(savedCookies);
+		
+		// Since setAllCookies defaults to not marking cookies as changed, this list should be empty.
+		setCookies(mCookieStore.getChangedCookies());
+		ensureSize("count of changed cookies after restore", 0);
+
+		// Verify that the restore worked as it should have.
+		setCookies(mCookieStore.getAllCookies());
+		ensureSize("count of restored cookies", 6);
+		ensureCookie(cookie01);
+		ensureCookie(cookie02);
+		ensureCookie(cookie03);
+		ensureCookie(cookie04);
+		ensureCookie(cookie05);
+		ensureCookie(cookie06);
+	}
+
+}
-- 
cgit v1.2.3


From 68870a1f59c11a173353698b994f4540b214d57f Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Wed, 31 Mar 2010 18:53:50 -0700
Subject: Added copyright header to new unit test.

---
 indra/llplugin/tests/llplugincookiestore_test.cpp | 33 +++++++++++++++++++++++
 1 file changed, 33 insertions(+)

(limited to 'indra')

diff --git a/indra/llplugin/tests/llplugincookiestore_test.cpp b/indra/llplugin/tests/llplugincookiestore_test.cpp
index e3e8ac9804..020d9c1977 100644
--- a/indra/llplugin/tests/llplugincookiestore_test.cpp
+++ b/indra/llplugin/tests/llplugincookiestore_test.cpp
@@ -1,3 +1,36 @@
+/** 
+ * @file llplugincookiestore_test.cpp
+ * @brief Unit tests for LLPluginCookieStore.
+ *
+ * @cond
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ *
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlife.com/developers/opensource/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at http://secondlife.com/developers/opensource/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ * @endcond
+ */
+
 #include "linden_common.h"
 #include "../test/lltut.h"
 
-- 
cgit v1.2.3


From 7f38ea147466b6d045c90d710402b2ac321dbfd9 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Thu, 1 Apr 2010 11:32:51 +0300
Subject: Fixed normal bug EXT-6659("Ctrl+A" combination allows selecting of
 several picks) - added check that multiple selection is allowed Reviewed by
 Mike Antipov at https://codereview.productengine.com/secondlife/r/146/

--HG--
branch : product-engine
---
 indra/llui/llflatlistview.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index bc34012267..d8084fd9aa 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -562,8 +562,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 		{
 			if(MASK_CONTROL & mask)
 			{
-				selectAll();
-				handled = TRUE;
+				handled = (BOOL)selectAll();
 			}
 			break;
 		}
@@ -793,7 +792,7 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
 
 bool LLFlatListView::selectAll()
 {
-	if (!mAllowSelection)
+	if (!mAllowSelection || !mMultipleSelection)
 		return false;
 
 	mSelectedItemPairs.clear();
-- 
cgit v1.2.3


From 69833aff50b1d1d360ff5568314d347dd3df40f5 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Thu, 1 Apr 2010 13:35:25 +0300
Subject: drafted out edit outfit panel XUI layout as major part of EXT-6548
 Edit Outfit: Clean up XUI to allow all elements to fit properly in the panel

Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/143/

--HG--
branch : product-engine
---
 indra/newview/llpaneloutfitedit.cpp                |  13 +-
 indra/newview/llpaneloutfitedit.h                  |   4 +-
 .../skins/default/xui/en/panel_outfit_edit.xml     | 540 +++++++++++++--------
 .../default/xui/en/panel_outfits_inventory.xml     |   4 +-
 .../skins/default/xui/en/sidepanel_appearance.xml  |   9 +-
 5 files changed, 347 insertions(+), 223 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 421181dda1..ba22adc01c 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -62,7 +62,7 @@
 #include "llsidepanelappearance.h"
 #include "llwearablelist.h"
 
-static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_look("panel_outfit_edit");
+static LLRegisterPanelClassWrapper<LLPanelOutfitEdit> t_outfit_edit("panel_outfit_edit");
 
 const U64 WEARABLE_MASK = (1LL << LLInventoryType::IT_WEARABLE);
 const U64 ATTACHMENT_MASK = (1LL << LLInventoryType::IT_ATTACHMENT) | (1LL << LLInventoryType::IT_OBJECT);
@@ -158,7 +158,9 @@ BOOL LLPanelOutfitEdit::postBuild()
 	// gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
 		
 	mLookName = getChild<LLTextBox>("curr_look_name"); 
-	
+
+	childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL);
+
 	/*
 	mLookContents->setDoubleClickCallback(onDoubleClickSpeaker, this);
 	mLookContents->setCommitOnSelectionChange(TRUE);
@@ -229,6 +231,11 @@ BOOL LLPanelOutfitEdit::postBuild()
 	return TRUE;
 }
 
+void LLPanelOutfitEdit::showAddWearablesPanel()
+{
+	childSetVisible("add_wearables_panel", childGetValue("add_btn"));
+}
+
 void LLPanelOutfitEdit::onTypeFilterChanged(LLUICtrl* ctrl)
 {
 	LLComboBox* type_filter = dynamic_cast<LLComboBox*>(ctrl);
@@ -500,7 +507,7 @@ void LLPanelOutfitEdit::displayLookInfo(const LLInventoryCategory* pLook)
 	if (mLookID != pLook->getUUID())
 	{
 		mLookID = pLook->getUUID();
-		mLookName->setText("Look: " + pLook->getName());
+		mLookName->setText(pLook->getName());
 		updateLookInfo();
 	}
 }
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 09ec51c056..5c00f84e0e 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -88,7 +88,9 @@ public:
 	/*virtual*/ void setParcelID(const LLUUID& parcel_id);
 		// Sends a request for data about the given parcel, which will
 		// only update the location if there is none already available.
-	
+
+	void showAddWearablesPanel();
+
 	void onTypeFilterChanged(LLUICtrl* ctrl);
 	void onSearchEdit(const std::string& string);
 	void onInventorySelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index d4924562fb..535e24f3d9 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -1,13 +1,18 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<!-- Side tray Outfit Edit panel -->
 <panel
-  background_visible="true"
-  border="false"
-	height="570"
-	follows="all"
-	label="Look Info"
-	layout="topleft"
-	name="look_info"
-	width="320">
+ background_visible="true"
+ border="false"
+ height="600"
+ follows="all"
+ label="Outfit Edit"
+ layout="topleft"
+ left="0"
+ min_height="350"
+ name="outfit_edit"
+ top="0"
+ width="320">
+	
 	<panel.string
 		name="not_available">
 		(N\A)
@@ -16,218 +21,325 @@
 		name="unknown">
 		(unknown)
 	</panel.string>
-	<panel
-		background_visible="true"
-		bevel_style="none"
-		follows="left|top|right|bottom"
-		height="530"
-		label="Outfit"
-		layout="topleft"
-		name="look_management_panel"
-		width="320">
-        <panel
-          follows="left|right|top"
-            header_visible="false"
-            layout="topleft"
-            min_height="300"
-            name="look_group"
-            title="Outfit Group"
-          top="0">
+
+
+    <button
+     follows="top|left"
+     height="23"
+     image_overlay="BackArrow_Off"
+     layout="topleft"
+     name="back_btn"
+     left="5"
+     tab_stop="false"
+     top="2"
+     width="23" />
+    <text
+     follows="top|right"
+     font="SansSerifHugeBold"
+     height="26"
+     layout="topleft"
+     left_pad="20"
+     name="title"
+     text_color="LtGray"
+     top="0"
+     value="Edit Outfit"
+     use_ellipses="true"
+     width="275" /> 
+
+<!-- "HEADER WITH ICON, STATUS TEXT AND OUTFIT NAME" -->
+    <panel
+     bevel_style="none"
+     follows="top|left|right"
+     height="45"
+     label="bottom_panel"
+     layout="topleft"
+     left="5"
+     name="header_panel"
+     top_pad="5" 
+     width="300">
+        <icon
+         follows="left|top"
+         height="40"
+         image_name="t-shirt-image"
+         left="2"
+         mouse_opaque="false"
+         name="outfit_icon"
+         top="1"
+         scale_image="true"
+         visible="true"
+         width="35" />
             <panel
-                follows="left|right|top"
-                height="210"
-                layout="topleft"
-                top_pad="0"
-                name="look_info_group_bar"
-                width="295">
+             bevel_style="none"
+             follows="top|right"
+             height="40"
+             label="bottom_panel"
+             layout="topleft"
+             left_pad="10"
+             name="outfit_name_and_status"
+             top="2"
+             width="200">
                 <text
-                    type="string"
-                    length="1"
-                    follows="left|top"
-                    height="20"
-                    layout="topleft"
-                    mouse_opaque="false"
-                    name="curr_look_name"
-                    width="175">
-                    Look: [LOOK]
-                </text>
+                 follows="top|left|right"
+                 font="SansSerif"
+                 height="13"
+                 layout="topleft"
+                 name="status"
+                 text_color="Green"
+                 top="0"
+                 value="Editing..."
+                 use_ellipses="true"
+                 width="275" /> 
+                <text
+                 follows="bottom|left|right"
+                 font="SansSerifHugeBold"
+                 height="26"
+                 layout="topleft"
+                 name="curr_look_name"
+                 text_color="LtGray"
+                 top_pad="0"
+                 value="[Current Outfit]"
+                 use_ellipses="true"
+                 width="275" /> 
+            </panel>
+    </panel>
+
+
+<!-- LIST OF WEARABLES (CURRENT OUTFIT/ WEARABLES TO ADD) -->
+    <layout_stack
+     animate="false"
+     default_tab_group="2"
+     follows="all"
+     height="470"
+     width="300"
+     layout="topleft"
+     orientation="vertical"
+     name="im_panels"
+     tab_group="1"
+     top_pad="10"
+     left="5">
+        <layout_panel
+         layout="topleft"
+         follows="left|top|right"
+         height="220"
+         label="IM Control Panel"
+         min_height="100"
+         name="outfit_wearables_panel"
+         width="300"
+         auto_resize="true"
+         user_resize="true">
+
+            <scroll_list
+             width="300"
+             column_padding="0"
+             draw_heading="false"
+             draw_stripes="false"
+             follows="left|top|right|bottom"
+             layout="topleft"
+             name="look_items_list"
+             search_column="1"
+             sort_column="2"
+             left="0"
+             height="193"
+             top="0">
+                <scroll_list.columns
+                 label="Look Item"
+                 name="look_item"
+                 width="285" />
+                <scroll_list.columns
+                 label="Outfit Item Sort"
+                 width="0"
+                 sort_column="look_item_sort"
+                 name="look_item_sort" />
+            </scroll_list>
+
+            <panel
+             background_visible="true"
+             bevel_style="none"
+             follows="bottom|left|right"
+             height="27"
+             label="bottom_panel"
+             layout="topleft"
+             left="0"
+             name="edit_panel"
+             top_pad="0"
+             width="300">
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Left_Over"
+                 image_overlay="OptionsMenu_Off"
+                 image_selected="Toolbar_Left_Selected"
+                 image_unselected="Toolbar_Left_Off"
+                 layout="topleft"
+                 left="0"
+                 name="gear_menu_btn"
+                 top="1"
+                 width="31" />
                 <button
-                    follows="left|top"
-                    height="20"
-                    label="Wear"
-                    layout="topleft"
-                    name="wear_look_btn"
-                    left_pad="5"
-                    top_pad="-24"
-                    width="65" />
+                 is_toggle="true"
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="AddItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 left_pad="1"
+                 name="add_btn"
+                 top="1"
+                 width="31" />
                 <button
-                    follows="left|top"
-                    height="20"
-                    layout="topleft"
-                    left_pad="5"
-                    name="back_btn"
-                    width="20" />
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 left_pad="1"
+                 name="new_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|right"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay="TrashItem_Off"
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 layout="topleft"
+                 name="trash_btn"
+                 right="-1"
+                 top="1"
+                 width="31" />
             </panel>
-        </panel>
+        </layout_panel>
+
+
+        <layout_panel
+         auto_resize="true"
+         default_tab_group="3"
+         height="250" 
+         min_height="120"
+         name="add_wearables_panel"
+         width="300"
+         tab_group="2"
+         user_resize="true">
+
+            <text
+             follows="top|left|right"
+             font="SansSerifBold"
+             height="13"
+             layout="topleft"
+             left="5"
+             name="status"
+             text_color="LtGray"
+             top="5"
+             value="Add Wearables"
+             use_ellipses="true"
+             width="275" />
+
+            <filter_editor
+             background_image="TextField_Search_Off"
+             follows="left|top|right"
+             font="SansSerif"
+             label="Filter"
+             layout="topleft"
+             left="5"
+             width="290"
+             height="20"
+             name="look_item_filter"
+             text_color="black"
+             text_pad_left="25" />
+
+            <inventory_panel
+             allow_multi_select="true"
+             border="false"
+             follows="left|top|right|bottom"
+             height="176"
+             layout="topleft"
+             left="0"
+             mouse_opaque="false"
+             name="inventory_items"
+             top_pad="5"
+             width="300"/>
 
-        <panel
-            follows="left|right|top"
-          height="200"
-          layout="topleft"
-          name="outfit_display"
-          top_pad="10"
-          width="320">
-          
-              <scroll_list
-                  width="285"
-                  column_padding="0"
-                  draw_heading="false"
-                  draw_stripes="false"
-                  follows="left|top|bottom|right"
-                  layout="topleft"
-                  name="look_items_list"
-                  search_column="1"
-                  sort_column="2"
-                  left="0"
-                  height="200"
-                  top_pad="0">
-                  <scroll_list.columns
-                      label="Look Item"
-                      name="look_item"
-                      width="285" />
-                  <scroll_list.columns
-                      label="Outfit Item Sort"
-                      width="0"
-                      sort_column="look_item_sort"
-                      name="look_item_sort" />
-              </scroll_list>
-              <button
-                  follows="left|top|right"
-                  height="20"
-                  label="-"
-                  left_pad="0"
-                  layout="topleft"
-                  name="edit_wearable_btn"
-                  width="20" />
-        </panel>
-        <panel
-          follows="all"
-            header_visible="false"
-            min_height="100"
-          left="0"
-            name="inventory_group"
-            title="My Inventory"
-          top_pad="10"
-          width="230">
             <panel
-                follows="left|right|top"
-                height="270"
-                name="lower_look_accordion"
-                width="295">
-                <panel
-                    follows="left|right|top"
-                    height="20"
-                    layout="topleft"
-                    name="inventory_bar"
-                    width="295">
-                    <text
-                        type="string"
-                        length="1"
-                        follows="left|top"
-                        height="20"
-                        layout="topleft"
-                        mouse_opaque="false"
-                        name="inventory_info_text"
-                        width="100">
-                        My Inventory
-                    </text>
-                    <combo_box
-                        follows="left"
-                        height="20"
-                        layout="topleft"
-                        left_pad="0"
-                        top_pad="-24"
-                        name="inventory_filter"
-                        tool_tip="Only show the selected inventory types"
-                        width="185" />
-                </panel>
-                <panel
-                    follows="left|right|top"
-                    height="20"
-                    layout="topleft"
-                    name="look_item_filter_bar"
-                    width="295">
-                    <filter_editor
-                        background_image="TextField_Search_Off"
-                        follows="left|top|right"
-                        font="SansSerif"
-                        label="Outfit Item Filter"
-                        layout="topleft"
-                        left="0"
-                        top_pad="0"
-                        width="270"
-                        height="20"
-                        name="look_item_filter"
-                        text_color="black"
-                        text_pad_left="25" />
-                </panel>
-                <panel
-                    follows="all"
-                    height="230"
-                    layout="topleft"
-                    name="inventory_panel"
-                    width="285">
-                    <inventory_panel
-                        allow_multi_select="true"
-                        border="true"
-                        follows="left|top|right|bottom"
-                        height="230"
-                        mouse_opaque="false"
-                        name="inventory_items"
-                        width="285"/>
-                </panel>
+             background_visible="true"
+             bevel_style="none"
+             follows="left|right|bottom"
+             height="27"
+             label="add_wearables_button_bar"
+             layout="topleft"
+             left="0"
+             name="add_wearables_button_bar"
+             top_pad="0"
+             width="300">
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Left_Over"
+                 image_overlay="OptionsMenu_Off"
+                 image_selected="Toolbar_Left_Selected"
+                 image_unselected="Toolbar_Left_Off"
+                 layout="topleft"
+                 left="0"
+                 name="wearables_gear_menu_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 label="F"
+                 layout="topleft"
+                 left_pad="1"
+                 name="folder_view_btn"
+                 top="1"
+                 width="31" />
+                <button
+                 follows="bottom|left"
+                 height="25"
+                 image_hover_unselected="Toolbar_Middle_Over"
+                 image_overlay=""
+                 image_selected="Toolbar_Middle_Selected"
+                 image_unselected="Toolbar_Middle_Off"
+                 label="L"
+                 layout="topleft"
+                 left_pad="1"
+                 name="list_view_btn"
+                 top="1"
+                 width="31" />
             </panel>
-        </panel>
-	</panel>
-	<panel
-		follows="left|right|bottom"
-		height="30"
-		layout="topleft"
-		left="5"
-		top_pad="0"
-		name="button_bar"
-		width="295">
-		<button
-			follows="top|left|right"
-			height="25"
-			label="Add"
-			left="0"
-			layout="topleft"
-			name="add_item_btn"
-			width="90" />
-		<button
-			follows="left|right"
-			height="25"
-			left_pad="0"
-			label="Remove"
-			layout="topleft"
-			name="remove_item_btn"
-			width="90" />
-		<button
-			follows="top|left|right"
-			height="25"
-			label="UP"
-			left_pad="0"
-			layout="topleft"
-			name="up_btn"
-			width="55" />
-		<button
-			follows="left|top|right"
-			height="25"
-			label="DOWN"
-			left_pad="0"
-			layout="topleft"
-			name="down_btn"
-			width="60" />
-	</panel>
+        </layout_panel>
+    </layout_stack>
+
+    <panel
+     follows="left|right|bottom"
+     height="30"
+     layout="topleft"
+     left="5"
+     top_pad="10"
+     name="save_revert_button_bar"
+     width="300">
+        <button
+         follows="bottom|left|right"
+         height="23"
+         label="Save"
+         left="0"
+         layout="topleft"
+         name="save_btn"
+         width="145" />
+        <button
+         follows="bottom|left|right"
+         height="23"
+         left_pad="15"
+         label="Revert"
+         layout="topleft"
+         name="revert_btn"
+         width="145" />
+    </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index 66ef373168..b297ec1988 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -119,13 +119,13 @@
 	 <button
 	  follows="bottom|left"
 		height="23" 
-		label="M" 
+		label="Edit Outfit" 
 		layout="topleft"
         right="-140"
 		name="look_edit_btn"
         top="26"
         visible="false" 
-		width="20" />
+		width="50" />
 	 </panel>
        
 </panel>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index 735635f1a0..20a1de59fc 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -104,12 +104,15 @@ width="333">
    <panel
    class="panel_outfit_edit"
    filename="panel_outfit_edit.xml"
+   height="550"
    follows="all"
    layout="topleft"
-   left="0"
+   left="5"
+   min_height="410"
    name="panel_outfit_edit"
-   top="35"
-   visible="false" />
+   top="5"
+   visible="false" 
+   width="320"/>
    <panel
    class="panel_edit_wearable"
    filename="panel_edit_wearable.xml"
-- 
cgit v1.2.3


From 9c0087c0a68b37718dbedae0e5a99b8a5920c318 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 1 Apr 2010 14:07:45 +0300
Subject: Fixed normal bug EXT-6023 - [HARD CODED]? Side Bar : "More" link
 inside "Profile" and "Pick" According to ticket, files in "widgets" folder
 are not localized and "more_label" is not a translatable attribute. Replaced
 "more_label" with "label". expandable_text "More" text is accessible through
 "textbox.label" attribute. Added "textbox.label" to every expandable_text to
 make "More" text localizable.

--HG--
branch : product-engine
---
 indra/newview/llexpandabletextbox.cpp                              | 3 +--
 indra/newview/llexpandabletextbox.h                                | 1 -
 indra/newview/skins/default/xui/en/floater_event.xml               | 1 +
 indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml | 1 +
 indra/newview/skins/default/xui/en/panel_landmark_info.xml         | 1 +
 indra/newview/skins/default/xui/en/panel_my_profile.xml            | 3 +++
 indra/newview/skins/default/xui/en/panel_pick_list_item.xml        | 1 +
 indra/newview/skins/default/xui/en/panel_place_profile.xml         | 1 +
 indra/newview/skins/default/xui/en/panel_profile.xml               | 3 +++
 indra/newview/skins/default/xui/en/widgets/expandable_text.xml     | 2 +-
 10 files changed, 13 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llexpandabletextbox.cpp b/indra/newview/llexpandabletextbox.cpp
index 362010d65a..149ba2478d 100644
--- a/indra/newview/llexpandabletextbox.cpp
+++ b/indra/newview/llexpandabletextbox.cpp
@@ -112,13 +112,12 @@ private:
 };
 
 LLExpandableTextBox::LLTextBoxEx::Params::Params()
-:	more_label("more_label")
 {
 }
 
 LLExpandableTextBox::LLTextBoxEx::LLTextBoxEx(const Params& p)
 :	LLTextEditor(p),
-	mExpanderLabel(p.more_label),
+	mExpanderLabel(p.label),
 	mExpanderVisible(false)
 {
 	setIsChrome(TRUE);
diff --git a/indra/newview/llexpandabletextbox.h b/indra/newview/llexpandabletextbox.h
index 9d4a8aef76..5872592fae 100644
--- a/indra/newview/llexpandabletextbox.h
+++ b/indra/newview/llexpandabletextbox.h
@@ -54,7 +54,6 @@ protected:
 	public:
 		struct Params :	public LLInitParam::Block<Params, LLTextEditor::Params>
 		{
-			Mandatory<std::string> more_label;
 			Params();
 		};
 
diff --git a/indra/newview/skins/default/xui/en/floater_event.xml b/indra/newview/skins/default/xui/en/floater_event.xml
index 0255e202fb..d9c9d63c72 100644
--- a/indra/newview/skins/default/xui/en/floater_event.xml
+++ b/indra/newview/skins/default/xui/en/floater_event.xml
@@ -244,6 +244,7 @@
        layout="topleft"
        left="6"
        name="event_desc"
+       textbox.label="More"
        width="322">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</expandable_text>
     </layout_panel>
diff --git a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
index 996e28c575..af3315ebfe 100644
--- a/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_classifieds_list_item.xml
@@ -65,6 +65,7 @@
      left="103"
      name="description"
      textbox.max_length="1024"
+     textbox.label="More"
      textbox.show_context_menu="false" 
      top_pad="0"
      width="178"
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index befeb182f9..31ba539c44 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -133,6 +133,7 @@
              layout="topleft"
              left="10"
              name="description"
+             textbox.label="More"
              top_pad="10"
              value="Du waltz die spritz"
              width="280" />
diff --git a/indra/newview/skins/default/xui/en/panel_my_profile.xml b/indra/newview/skins/default/xui/en/panel_my_profile.xml
index 4386475cf1..5e41d65720 100644
--- a/indra/newview/skins/default/xui/en/panel_my_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_my_profile.xml
@@ -117,6 +117,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.label="More"
                textbox.show_context_menu="true"
                name="sl_description_edit"
                top_pad="-3"
@@ -172,6 +173,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.label="More"
                textbox.show_context_menu="true"
                name="fl_description_edit"
                top_pad="-3"
@@ -313,6 +315,7 @@
             name="sl_groups"
           top_pad="0"
             translate="false"
+            textbox.label="More"
             textbox.show_context_menu="true"
             width="298"
             expanded_bg_visible="true"
diff --git a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
index 715dc5f23c..41651edaa0 100644
--- a/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
+++ b/indra/newview/skins/default/xui/en/panel_pick_list_item.xml
@@ -65,6 +65,7 @@
      left="103"
      name="picture_descr"
      textbox.max_length="1024"
+     textbox.label="More"
      textbox.show_context_menu="false" 
      top_pad="0"
      width="178"
diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml
index 9e5ef10d42..c1c1e54b47 100644
--- a/indra/newview/skins/default/xui/en/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml
@@ -275,6 +275,7 @@
              layout="topleft"
              left="5"
              name="description"
+             textbox.label="More"
              top_pad="10"
              value="Du waltz die spritz"
              width="300" />
diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml
index 34ec64b8af..a666608103 100644
--- a/indra/newview/skins/default/xui/en/panel_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_profile.xml
@@ -107,6 +107,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.label="More"
                textbox.show_context_menu="true"
                name="sl_description_edit"
                top_pad="-3"
@@ -152,6 +153,7 @@
                layout="topleft"
                left="107"
                textbox.max_length="512"
+               textbox.label="More"
                textbox.show_context_menu="true"
                name="fl_description_edit"
                top_pad="-3"
@@ -291,6 +293,7 @@
             left="7"
             name="sl_groups"
             textbox.max_length="512"
+            textbox.label="More"
             textbox.show_context_menu="true"
             top_pad="0"
             translate="false"
diff --git a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
index d9b6387f0d..6190ea7872 100644
--- a/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
+++ b/indra/newview/skins/default/xui/en/widgets/expandable_text.xml
@@ -5,7 +5,7 @@
   allow_html="true"
   allow_scroll="true"
   bg_visible="false"
-  more_label="More" 
+  label="More" 
   follows="left|top|right"
   name="text"
   read_only="true"
-- 
cgit v1.2.3


From 985d422210defe6f975bd9b0c301f877c75a86d6 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Thu, 1 Apr 2010 14:30:09 +0300
Subject: forgot to commit visible=false of Add Wearables panel as part of
 EXT-6548 Edit Outfit: Clean up XUI to allow all elements to fit properly in
 the panel

Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/143/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_outfit_edit.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index 535e24f3d9..4d3ee07195 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -224,7 +224,8 @@
          name="add_wearables_panel"
          width="300"
          tab_group="2"
-         user_resize="true">
+         user_resize="true"
+         visible="false">
 
             <text
              follows="top|left|right"
-- 
cgit v1.2.3


From c6cdd40c4eab2bb413ce778e6659f27c1d04c008 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 1 Apr 2010 14:58:24 +0300
Subject: fixed EXT-6373 Consecutive offer messages are unreadable in the IM
 log replaced [NAME] with [NAME_SLURL] in friendship offer notification;

--HG--
branch : product-engine
---
 indra/newview/llviewermessage.cpp                    | 2 +-
 indra/newview/skins/default/xui/en/notifications.xml | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 53beced1d3..3a5d701bc1 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -2381,7 +2381,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			else
 			{
-				args["[NAME]"] = name;
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				if(message.empty())
 				{
 					//support for frienship offers from clients before July 2008
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 8501143fe6..3d41989e54 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -5167,7 +5167,7 @@ An object named [OBJECTFROMNAME] owned by (an unknown Resident) has given you th
    icon="notify.tga"
    name="OfferFriendship"
    type="offer">
-[NAME] is offering friendship.
+[NAME_SLURL] is offering friendship.
 
 [MESSAGE]
 
-- 
cgit v1.2.3


From 4992eaf27dd113df805f347811882e72df6d7a86 Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 1 Apr 2010 15:24:36 +0300
Subject: fixed EXT-2801 Record "object return" notification into IM history,
 not chat history, * added class for LLPostponedNotification to rpovide
 possibility postpone adding notification to notifications system till sender
 avatar name will be received from cache name; * rolled back changes related
 to fix of EXT-4779; * avoided passing avatar id when logging 'Object Return'
 notification to nearby chat;

eviewed by Vadim Savchuk at https://jira.secondlife.com/browse/EXT-6373

--HG--
branch : product-engine
---
 indra/llui/llnotifications.cpp              |  8 ++++
 indra/llui/llnotifications.h                | 57 +++++++++++++++++++++++++++++
 indra/newview/llnotificationhandlerutil.cpp |  9 +----
 indra/newview/llviewermessage.cpp           | 23 ++++++++++--
 4 files changed, 86 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index d7424cf05a..65ef53443b 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -1552,3 +1552,11 @@ std::ostream& operator<<(std::ostream& s, const LLNotification& notification)
 	return s;
 }
 
+void LLPostponedNotification::onCachedNameReceived(const LLUUID& id, const std::string& first,
+		const std::string& last, bool is_group)
+{
+	gCacheName->getFullName(id, mName);
+	modifyNotificationParams();
+	LLNotifications::instance().add(mParams);
+	cleanup();
+}
diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 400491a154..707a84bdfe 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -104,6 +104,7 @@
 #include "llinitparam.h"
 #include "llnotificationslistener.h"
 #include "llnotificationptr.h"
+#include "llcachename.h"
 
 	
 typedef enum e_notification_priority
@@ -949,6 +950,62 @@ private:
     boost::scoped_ptr<LLNotificationsListener> mListener;
 };
 
+/**
+ * Abstract class for postponed notifications.
+ * Provides possibility to add notification after specified by id avatar or group will be
+ * received from cache name. The object of this type automatically well be deleted
+ * by cleanup method after respond will be received from cache name.
+ *
+ * To add custom postponed notification to the notification system client should:
+ *  1 create class derived from LLPostponedNotification;
+ *  2 call LLPostponedNotification::add method;
+ */
+class LLPostponedNotification
+{
+public:
+	/**
+	 * Performs hooking cache name callback which will add notification to notifications system.
+	 * Type of added notification should be specified by template parameter T
+	 * and non-private derived from LLPostponedNotification class,
+	 * otherwise compilation error will occur.
+	 */
+	template<class T>
+	static void add(const LLNotification::Params& params,
+			const LLUUID& id, bool is_group)
+	{
+		// upcast T to the base type to restrict T derivation from LLPostponedNotification
+		LLPostponedNotification* thiz = new T();
+
+		thiz->mParams = params;
+
+		gCacheName->get(id, is_group, boost::bind(
+				&LLPostponedNotification::onCachedNameReceived, thiz, _1, _2,
+				_3, _4));
+	}
+
+private:
+	void onCachedNameReceived(const LLUUID& id, const std::string& first,
+			const std::string& last, bool is_group);
+
+	void cleanup()
+	{
+		delete this;
+	}
+
+protected:
+	LLPostponedNotification() {}
+	~LLPostponedNotification() {}
+
+	/**
+	 * Abstract method provides possibility to modify notification parameters and
+	 * will be called after cache name retrieve information about avatar or group
+	 * and before notification will be added to the notification system.
+	 */
+	virtual void modifyNotificationParams() = 0;
+
+	LLNotification::Params mParams;
+	std::string mName;
+};
 
 #endif//LL_LLNOTIFICATIONS_H
 
diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp
index 6aafa04a17..3f551f6b32 100644
--- a/indra/newview/llnotificationhandlerutil.cpp
+++ b/indra/newview/llnotificationhandlerutil.cpp
@@ -323,7 +323,7 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi
 {
 	const std::string name = LLHandlerUtil::getSubstitutionName(notification);
 
-	std::string session_name = notification->getPayload().has(
+	const std::string& session_name = notification->getPayload().has(
 			"SESSION_NAME") ? notification->getPayload()["SESSION_NAME"].asString() : name;
 
 	// don't create IM p2p session with objects, it's necessary condition to log
@@ -332,12 +332,6 @@ void LLHandlerUtil::logToIMP2P(const LLNotificationPtr& notification, bool to_fi
 	{
 		LLUUID from_id = notification->getPayload()["from_id"];
 
-		//*HACK for ServerObjectMessage the sesson name is really weird, see EXT-4779
-		if (SERVER_OBJECT_MESSAGE == notification->getName())
-		{
-			session_name = "chat";
-		}
-
 		//there still appears a log history file with weird name " .txt"
 		if (" " == session_name || "{waiting}" == session_name || "{nobody}" == session_name)
 		{
@@ -392,6 +386,7 @@ void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChat
 		LLChat chat_msg(notification->getMessage());
 		chat_msg.mSourceType = type;
 		chat_msg.mFromName = SYSTEM_FROM;
+		chat_msg.mFromID = LLUUID::null;
 		nearby_chat->addMessage(chat_msg);
 	}
 }
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 3a5d701bc1..1426c0b9e2 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1685,6 +1685,18 @@ bool inspect_remote_object_callback(const LLSD& notification, const LLSD& respon
 }
 static LLNotificationFunctorRegistration inspect_remote_object_callback_reg("ServerObjectMessage", inspect_remote_object_callback);
 
+class LLPostponedServerObjectNotification: public LLPostponedNotification
+{
+protected:
+	/* virtual */
+	void modifyNotificationParams()
+	{
+		LLSD payload = mParams.payload;
+		payload["SESSION_NAME"] = mName;
+		mParams.payload = payload;
+	}
+};
+
 void process_improved_im(LLMessageSystem *msg, void **user_data)
 {
 	if (gNoRender)
@@ -2220,7 +2232,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			if(SYSTEM_FROM == name)
 			{
 				// System's UUID is NULL (fixes EXT-4766)
-				chat.mFromID = from_id = LLUUID::null;
+				chat.mFromID = LLUUID::null;
 			}
 
 			LLSD query_string;
@@ -2266,13 +2278,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			payload["slurl"] = location;
 			payload["name"] = name;
 			std::string session_name;
-			gCacheName->getFullName(from_id, session_name);
-			payload["SESSION_NAME"] = session_name;
 			if (from_group)
 			{
 				payload["group_owned"] = "true";
 			}
-			LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload);
+
+			LLNotification::Params params("ServerObjectMessage");
+			params.substitutions = substitutions;
+			params.payload = payload;
+
+			LLPostponedNotification::add<LLPostponedServerObjectNotification>(params, from_id, false);
 		}
 		break;
 	case IM_FROM_TASK_AS_ALERT:
-- 
cgit v1.2.3


From 97f9dbee2ccd32b666c14bd79111bc2dbe2523e2 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Thu, 1 Apr 2010 14:40:44 +0100
Subject: BOOL->bool on llassettype.*

---
 indra/llcommon/llassettype.cpp | 74 +++++++++++++++++++++---------------------
 indra/llcommon/llassettype.h   |  8 ++---
 2 files changed, 41 insertions(+), 41 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llassettype.cpp b/indra/llcommon/llassettype.cpp
index e5068f1bc5..1c664e093b 100644
--- a/indra/llcommon/llassettype.cpp
+++ b/indra/llcommon/llassettype.cpp
@@ -45,9 +45,9 @@ struct AssetEntry : public LLDictionaryEntry
 	AssetEntry(const char *desc_name,
 			   const char *type_name, 	// 8 character limit!
 			   const char *human_name, 	// for decoding to human readable form; put any and as many printable characters you want in each one
-			   BOOL can_link, 			// can you create a link to this type?
-			   BOOL can_fetch, 			// can you fetch this asset by ID?
-			   BOOL can_know) 			// can you see this asset's ID?
+			   bool can_link, 			// can you create a link to this type?
+			   bool can_fetch, 			// can you fetch this asset by ID?
+			   bool can_know) 			// can you see this asset's ID?
 		:
 		LLDictionaryEntry(desc_name),
 		mTypeName(type_name),
@@ -61,9 +61,9 @@ struct AssetEntry : public LLDictionaryEntry
 
 	const char *mTypeName;
 	const char *mHumanName;
-	BOOL mCanLink;
-	BOOL mCanFetch;
-	BOOL mCanKnow;
+	bool mCanLink;
+	bool mCanFetch;
+	bool mCanKnow;
 };
 
 class LLAssetDictionary : public LLSingleton<LLAssetDictionary>,
@@ -77,30 +77,30 @@ LLAssetDictionary::LLAssetDictionary()
 {
 	//       												   DESCRIPTION			TYPE NAME	HUMAN NAME			CAN LINK?   CAN FETCH?  CAN KNOW?	
 	//      												  |--------------------|-----------|-------------------|-----------|-----------|---------|
-	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			FALSE,		FALSE,		TRUE));
-	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			FALSE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			FALSE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_CLOTHING, 			new AssetEntry("CLOTHING",			"clothing",	"clothing",			TRUE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_OBJECT, 			new AssetEntry("OBJECT",			"object",	"object",			TRUE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		FALSE,		FALSE,		TRUE));
-	addEntry(LLAssetType::AT_CATEGORY, 			new AssetEntry("CATEGORY",			"category",	"folder",			TRUE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_BODYPART, 			new AssetEntry("BODYPART",			"bodypart",	"body part",		TRUE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		FALSE,		FALSE,		FALSE));
-	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		FALSE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_GESTURE, 			new AssetEntry("GESTURE",			"gesture",	"gesture",			TRUE,		TRUE,		TRUE));
-	addEntry(LLAssetType::AT_SIMSTATE, 			new AssetEntry("SIMSTATE",			"simstate",	"simstate",			FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_TEXTURE, 			new AssetEntry("TEXTURE",			"texture",	"texture",			false,		false,		true));
+	addEntry(LLAssetType::AT_SOUND, 			new AssetEntry("SOUND",				"sound",	"sound",			false,		true,		true));
+	addEntry(LLAssetType::AT_CALLINGCARD, 		new AssetEntry("CALLINGCARD",		"callcard",	"calling card",		false,		false,		false));
+	addEntry(LLAssetType::AT_LANDMARK, 			new AssetEntry("LANDMARK",			"landmark",	"landmark",			false,		true,		true));
+	addEntry(LLAssetType::AT_SCRIPT, 			new AssetEntry("SCRIPT",			"script",	"legacy script",	false,		false,		false));
+	addEntry(LLAssetType::AT_CLOTHING, 			new AssetEntry("CLOTHING",			"clothing",	"clothing",			true,		true,		true));
+	addEntry(LLAssetType::AT_OBJECT, 			new AssetEntry("OBJECT",			"object",	"object",			true,		false,		false));
+	addEntry(LLAssetType::AT_NOTECARD, 			new AssetEntry("NOTECARD",			"notecard",	"note card",		false,		false,		true));
+	addEntry(LLAssetType::AT_CATEGORY, 			new AssetEntry("CATEGORY",			"category",	"folder",			true,		false,		false));
+	addEntry(LLAssetType::AT_LSL_TEXT, 			new AssetEntry("LSL_TEXT",			"lsltext",	"lsl2 script",		false,		false,		false));
+	addEntry(LLAssetType::AT_LSL_BYTECODE, 		new AssetEntry("LSL_BYTECODE",		"lslbyte",	"lsl bytecode",		false,		false,		false));
+	addEntry(LLAssetType::AT_TEXTURE_TGA, 		new AssetEntry("TEXTURE_TGA",		"txtr_tga",	"tga texture",		false,		false,		false));
+	addEntry(LLAssetType::AT_BODYPART, 			new AssetEntry("BODYPART",			"bodypart",	"body part",		true,		true,		true));
+	addEntry(LLAssetType::AT_SOUND_WAV, 		new AssetEntry("SOUND_WAV",			"snd_wav",	"sound",			false,		false,		false));
+	addEntry(LLAssetType::AT_IMAGE_TGA, 		new AssetEntry("IMAGE_TGA",			"img_tga",	"targa image",		false,		false,		false));
+	addEntry(LLAssetType::AT_IMAGE_JPEG, 		new AssetEntry("IMAGE_JPEG",		"jpeg",		"jpeg image",		false,		false,		false));
+	addEntry(LLAssetType::AT_ANIMATION, 		new AssetEntry("ANIMATION",			"animatn",	"animation",		false,		true,		true));
+	addEntry(LLAssetType::AT_GESTURE, 			new AssetEntry("GESTURE",			"gesture",	"gesture",			true,		true,		true));
+	addEntry(LLAssetType::AT_SIMSTATE, 			new AssetEntry("SIMSTATE",			"simstate",	"simstate",			false,		false,		false));
 
-	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"sym link",			FALSE,		FALSE,		TRUE));
-	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	FALSE,		FALSE,		TRUE));
+	addEntry(LLAssetType::AT_LINK, 				new AssetEntry("LINK",				"link",		"sym link",			false,		false,		true));
+	addEntry(LLAssetType::AT_LINK_FOLDER, 		new AssetEntry("FOLDER_LINK",		"link_f", 	"sym folder link",	false,		false,		true));
 
-	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		FALSE,		FALSE,		FALSE));
+	addEntry(LLAssetType::AT_NONE, 				new AssetEntry("NONE",				"-1",		NULL,		  		false,		false,		false));
 };
 
 // static
@@ -202,7 +202,7 @@ LLAssetType::EType LLAssetType::lookupHumanReadable(const std::string& readable_
 }
 
 // static
-BOOL LLAssetType::lookupCanLink(EType asset_type)
+bool LLAssetType::lookupCanLink(EType asset_type)
 {
 	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
 	const AssetEntry *entry = dict->lookup(asset_type);
@@ -210,18 +210,18 @@ BOOL LLAssetType::lookupCanLink(EType asset_type)
 	{
 		return entry->mCanLink;
 	}
-	return FALSE;
+	return false;
 }
 
 // static
 // Not adding this to dictionary since we probably will only have these two types
-BOOL LLAssetType::lookupIsLinkType(EType asset_type)
+bool LLAssetType::lookupIsLinkType(EType asset_type)
 {
 	if (asset_type == AT_LINK || asset_type == AT_LINK_FOLDER)
 	{
-		return TRUE;
+		return true;
 	}
-	return FALSE;
+	return false;
 }
 
 // static
@@ -233,7 +233,7 @@ const std::string &LLAssetType::badLookup()
 }
 
 // static
-BOOL LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
+bool LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
 {
 	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
 	const AssetEntry *entry = dict->lookup(asset_type);
@@ -241,11 +241,11 @@ BOOL LLAssetType::lookupIsAssetFetchByIDAllowed(EType asset_type)
 	{
 		return entry->mCanFetch;
 	}
-	return FALSE;
+	return false;
 }
 
 // static
-BOOL LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
+bool LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
 {
 	const LLAssetDictionary *dict = LLAssetDictionary::getInstance();
 	const AssetEntry *entry = dict->lookup(asset_type);
@@ -253,5 +253,5 @@ BOOL LLAssetType::lookupIsAssetIDKnowable(EType asset_type)
 	{
 		return entry->mCanKnow;
 	}
-	return FALSE;
+	return false;
 }
diff --git a/indra/llcommon/llassettype.h b/indra/llcommon/llassettype.h
index 4440e1bac3..2c2dc27aaa 100644
--- a/indra/llcommon/llassettype.h
+++ b/indra/llcommon/llassettype.h
@@ -143,11 +143,11 @@ public:
 	static EType 				getType(const std::string& desc_name);
 	static const std::string&	getDesc(EType asset_type);
 
-	static BOOL 				lookupCanLink(EType asset_type);
-	static BOOL 				lookupIsLinkType(EType asset_type);
+	static bool 				lookupCanLink(EType asset_type);
+	static bool 				lookupIsLinkType(EType asset_type);
 
-	static BOOL 				lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
-	static BOOL 				lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
+	static bool 				lookupIsAssetFetchByIDAllowed(EType asset_type); // the asset allows direct download
+	static bool 				lookupIsAssetIDKnowable(EType asset_type); // asset data can be known by the viewer
 	
 	static const std::string&	badLookup(); // error string when a lookup fails
 
-- 
cgit v1.2.3


From b98ebdecda66a1f08e74321cb255e39edfbc47dd Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Thu, 1 Apr 2010 17:24:50 +0300
Subject: Fixed reopened major bug (EXT-5106) Side panel list view toolbars are
 missing background art. - Made toolbars look connected to the respective
 lists. - Fixed tab container background in Inventory side panel.

Tab container reserves 1 pixel for the border width so we have to use top_pad="-1" to move the toolbar 1 pixel up to physically connect them.

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_landmarks.xml     |  2 +-
 .../newview/skins/default/xui/en/panel_main_inventory.xml  | 12 ++++++------
 .../skins/default/xui/en/panel_outfits_inventory.xml       |  4 ++--
 indra/newview/skins/default/xui/en/panel_people.xml        | 14 +++++++++-----
 .../skins/default/xui/en/panel_teleport_history.xml        |  2 +-
 5 files changed, 19 insertions(+), 15 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 639e5d30ef..a7e87f2a1e 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -16,7 +16,7 @@
      bg_alpha_color="DkGray2"
      bg_opaque_color="DkGray2"
      follows="all"
-     height="369"
+     height="373"
      layout="topleft"
      left="3"
      name="landmarks_accordion"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index bef62f48e0..6c81107dde 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -411,13 +411,13 @@
      top="+31"
      width="303" />
     <tab_container
-       bg_opaque_color="DkGray2"
-       bg_alpha_color="DkGray2"
+       bg_alpha_color="DkGray"
+       bg_opaque_color="DkGray"
        background_visible="true"
        background_opaque="true"
        follows="all"
        halign="center"
-       height="306"
+       height="311"
        layout="topleft"
        left="7"
        name="inventory filter tabs"
@@ -434,7 +434,7 @@
 	       border="false"
 	       bevel_style="none"
          follows="all"
-         height="295"
+         height="310"
          label="MY INVENTORY"
          help_topic="my_inventory_tab"
          layout="topleft"
@@ -451,7 +451,7 @@
 	       border="false"
 	       bevel_style="none"
          follows="all"
-         height="293"
+         height="310"
          label="RECENT"
          help_topic="recent_inventory_tab"
          layout="topleft"
@@ -466,7 +466,7 @@
      follows="left|right|bottom"
      height="27"
      layout="topleft"
-     top_pad="4"
+     top_pad="-1"
      left="10"
      name="bottom_panel"
      width="310">
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index b297ec1988..f9ad525642 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -14,7 +14,7 @@
  border="false">
    <tab_container
      follows="all"
-     height="497"
+     height="501"
      layout="topleft"
      left="7"
      name="appearance_tabs"
@@ -58,7 +58,7 @@
 	  height="73"
 	  layout="topleft"
 	  left="9"
-	  top_pad="3"
+	  top_pad="-1"
 	  visible="true"
 	  name="bottom_panel"
 	  width="310">
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index 85841da48f..6152dd1587 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -81,7 +81,7 @@
        		 bg_alpha_color="DkGray2"
              bg_opaque_color="DkGray2"
              follows="all"
-             height="352"
+             height="356"
              ignore_online_status="true"
              layout="topleft"
              left="3"
@@ -97,6 +97,7 @@
              layout="topleft"
              left="3"
              name="bottom_panel"
+             top_pad="0"
              width="313">
              <button
              follows="bottom|left"
@@ -156,7 +157,7 @@
        		 bg_alpha_color="DkGray2"
        		 bg_opaque_color="DkGray2"
              follows="all"
-             height="352"
+             height="356"
              layout="topleft"
              left="3"
              name="friends_accordion"
@@ -204,6 +205,7 @@
              layout="topleft"
              left="3"
              name="bottom_panel"
+             top_pad="0"
              width="313">
                <button
                follows="bottom|left"
@@ -237,7 +239,7 @@
              	 layout="topleft"
              	 left_pad="1"
              	 name="dummy_icon"
-             	 width="210"
+             	 width="209"
              />
                 <button
                  follows="bottom|left"
@@ -287,7 +289,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
              bg_alpha_color="DkGray2"
              bg_opaque_color="DkGray2"
              follows="all"
-             height="352"
+             height="356"
              layout="topleft"
              left="3"
              name="group_list"
@@ -303,6 +305,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
              layout="topleft"
              left="0"
              name="bottom_panel"
+             top_pad="0"
              width="313">
                <button
                follows="bottom|left"
@@ -372,7 +375,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
        		 bg_alpha_color="DkGray2"
              bg_opaque_color="DkGray2"
              follows="all"
-             height="352"
+             height="356"
              layout="topleft"
              left="3"
              multi_select="true"
@@ -388,6 +391,7 @@ If you're looking for people to hang out with, [secondlife:///app/worldmap try t
              layout="topleft"
              left="0"
              name="bottom_panel"
+             top_pad="0"
              width="313">
                <button
                follows="bottom|left"
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index cbcaf1a58c..21addb8e6f 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -6,7 +6,7 @@
      bg_alpha_color="DkGray">     
     <accordion
      follows="left|top|right|bottom"
-     height="369"
+     height="373"
      layout="topleft"
      left="3"
      top="0"
-- 
cgit v1.2.3


From 53c96ec24b70452ddd1947bb23ece84cc1c1004c Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Thu, 1 Apr 2010 17:48:07 +0300
Subject: EXT-2801 Record "object return" notification into IM history, not
 chat history, replaced toast timer LLTimer with LLEventTimer implementation
 that not depends on draw method;

reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/148/

--HG--
branch : product-engine
---
 indra/newview/lltoast.cpp | 59 +++++++++++++++--------------------------------
 indra/newview/lltoast.h   | 37 ++++++++++++++++++++---------
 2 files changed, 45 insertions(+), 51 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 60a89c02e4..60657d3fa7 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -41,6 +41,16 @@
 
 using namespace LLNotificationsUI;
 
+/*virtual*/
+BOOL LLToastLifeTimer::tick()
+{
+	if (mEventTimer.hasExpired())
+	{
+		mToast->expire();
+	}
+	return FALSE;
+}
+
 //--------------------------------------------------------------------------
 LLToast::Params::Params() 
 :	can_fade("can_fade", true),
@@ -57,7 +67,6 @@ LLToast::Params::Params()
 LLToast::LLToast(const LLToast::Params& p) 
 :	LLModalDialog(LLSD(), p.is_modal),
 	mPanel(p.panel), 
-	mToastLifetime(p.lifetime_secs),
 	mToastFadingTime(p.fading_time_secs),
 	mNotificationID(p.notif_id),  
 	mSessionID(p.session_id),
@@ -71,6 +80,8 @@ LLToast::LLToast(const LLToast::Params& p)
 	mIsTip(p.is_tip),
 	mWrapperPanel(NULL)
 {
+	mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
+
 	LLUICtrlFactory::getInstance()->buildFloater(this, "panel_toast.xml", NULL);
 
 	setCanDrag(FALSE);
@@ -105,7 +116,7 @@ BOOL LLToast::postBuild()
 {
 	if(!mCanFade)
 	{
-		mTimer.stop();
+		mTimer->stop();
 	}
 
 	if (mIsTip)
@@ -144,39 +155,11 @@ LLToast::~LLToast()
 	mOnToastDestroyedSignal(this);
 }
 
-//--------------------------------------------------------------------------
-void LLToast::setAndStartTimer(F32 period)
-{
-	if(mCanFade)
-	{
-		mToastLifetime = period;
-		mTimer.start();
-	}
-}
-
-//--------------------------------------------------------------------------
-bool LLToast::lifetimeHasExpired()
-{
-	if (mTimer.getStarted())
-	{
-		F32 elapsed_time = mTimer.getElapsedTimeF32();
-		if ((mToastLifetime - elapsed_time) <= mToastFadingTime) 
-		{
-			setBackgroundOpaque(FALSE);
-		}
-		if (elapsed_time > mToastLifetime) 
-		{
-			return true;
-		}
-	}
-	return false;
-}
-
 //--------------------------------------------------------------------------
 void LLToast::hide()
 {
 	setVisible(FALSE);
-	mTimer.stop();
+	mTimer->stop();
 	mIsHidden = true;
 	mOnFadeSignal(this); 
 }
@@ -222,12 +205,13 @@ void LLToast::setCanFade(bool can_fade)
 { 
 	mCanFade = can_fade; 
 	if(!mCanFade)
-		mTimer.stop();
+		mTimer->stop();
 }
 
 //--------------------------------------------------------------------------
-void LLToast::tick()
+void LLToast::expire()
 {
+	// if toast has fade property - hide it
 	if(mCanFade)
 	{
 		hide();
@@ -263,11 +247,6 @@ void LLToast::insertPanel(LLPanel* panel)
 //--------------------------------------------------------------------------
 void LLToast::draw()
 {
-	if(lifetimeHasExpired())
-	{
-		tick();
-	}
-
 	LLFloater::draw();
 
 	if(!isBackgroundVisible())
@@ -300,9 +279,9 @@ void LLToast::setVisible(BOOL show)
 	if(show)
 	{
 		setBackgroundOpaque(TRUE);
-		if(!mTimer.getStarted() && mCanFade)
+		if(!mTimer->getStarted() && mCanFade)
 		{
-			mTimer.start();
+			mTimer->start();
 		}
 		LLModalDialog::setFrontmost(FALSE);
 	}
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 64855020a9..20198a9398 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -36,7 +36,7 @@
 
 #include "llpanel.h"
 #include "llmodaldialog.h"
-#include "lltimer.h"
+#include "lleventtimer.h"
 #include "llnotificationptr.h"
 
 #include "llviewercontrol.h"
@@ -48,12 +48,32 @@
 namespace LLNotificationsUI
 {
 
+class LLToast;
+/**
+ * Timer for toasts.
+ */
+class LLToastLifeTimer: public LLEventTimer
+{
+public:
+	LLToastLifeTimer(LLToast* toast, F32 period) : mToast(toast), LLEventTimer(period){}
+
+	/*virtual*/
+	BOOL tick();
+	void stop() { mEventTimer.stop(); }
+	void start() { mEventTimer.start(); }
+	void restart() {mEventTimer.reset(); }
+	BOOL getStarted() { return mEventTimer.getStarted(); }
+private :
+	LLToast* mToast;
+};
+
 /**
  * Represents toast pop-up.
  * This is a parent view for all toast panels.
  */
 class LLToast : public LLModalDialog
 {
+	friend class LLToastLifeTimer;
 public:
 	typedef boost::function<void (LLToast* toast)> toast_callback_t;
 	typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
@@ -107,12 +127,10 @@ public:
 	LLPanel* getPanel() { return mPanel; }
 	// enable/disable Toast's Hide button
 	void setHideButtonEnabled(bool enabled);
-	// initialize and start Toast's timer
-	void setAndStartTimer(F32 period);
 	// 
-	void resetTimer() { mTimer.start(); }
+	void resetTimer() { mTimer->start(); }
 	//
-	void stopTimer() { mTimer.stop(); }
+	void stopTimer() { mTimer->stop(); }
 	//
 	virtual void draw();
 	//
@@ -176,10 +194,7 @@ private:
 
 	void handleTipToastClick(S32 x, S32 y, MASK mask);
 
-	// check timer
-	bool	lifetimeHasExpired();
-	// on timer finished function
-	void	tick();
+	void	expire();
 
 	LLUUID				mNotificationID;
 	LLUUID				mSessionID;
@@ -188,8 +203,8 @@ private:
 	LLPanel* mWrapperPanel;
 
 	// timer counts a lifetime of a toast
-	LLTimer		mTimer;
-	F32			mToastLifetime; // in seconds
+	std::auto_ptr<LLToastLifeTimer> mTimer;
+
 	F32			mToastFadingTime; // in seconds
 
 	LLPanel*		mPanel;
-- 
cgit v1.2.3


From 7b0dab508363e5da1ab180bdd0f8d63f1985105c Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 1 Apr 2010 17:28:36 +0300
Subject: (work in progress) Update for LLAccordionCtrl arrange single
 expansion. Found this issue while working on EXT-6564(Fix wearable editing
 panels) - Every single_expansion accordion is treated like "fit_parent" is
 set to "true" after changes made in 9805 : e6c5f3b23be1 (fix for EXT-5128
 Groups accordions should all appear on-screen w/out scrolling (open accordion
 should fill space)). Updated accordion to take into account "fit_parent"
 property.

Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/147/

--HG--
branch : product-engine
---
 indra/llui/llaccordionctrl.cpp                     | 24 +++++++++++++++++++++-
 .../default/xui/en/panel_group_info_sidetray.xml   |  1 +
 2 files changed, 24 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp
index 2ed1082f56..cdcf780d2e 100644
--- a/indra/llui/llaccordionctrl.cpp
+++ b/indra/llui/llaccordionctrl.cpp
@@ -372,11 +372,33 @@ void	LLAccordionCtrl::arrangeSinge()
 		}
 		else
 		{
-			panel_height = expanded_height;
+			if(mFitParent)
+			{
+				panel_height = expanded_height;
+			}
+			else
+			{
+				if(accordion_tab->getAccordionView())
+				{
+					panel_height = accordion_tab->getAccordionView()->getRect().getHeight() + 
+						accordion_tab->getHeaderHeight() + 2*BORDER_MARGIN;
+				}
+				else
+				{
+					panel_height = accordion_tab->getRect().getHeight();
+				}
+			}
 		}
+
+		// make sure at least header is shown
+		panel_height = llmax(panel_height, accordion_tab->getHeaderHeight());
+
 		ctrlSetLeftTopAndSize(mAccordionTabs[i], panel_left, panel_top, panel_width, panel_height);
 		panel_top-=mAccordionTabs[i]->getRect().getHeight();
 	}
+
+	show_hide_scrollbar(getRect().getWidth(), getRect().getHeight());
+	updateLayout(getRect().getWidth(), getRect().getHeight());
 }
 
 void	LLAccordionCtrl::arrangeMultiple()
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index 701a14e1c5..789d69bc68 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -98,6 +98,7 @@ background_visible="true"
      left="0"
      top="0"
      single_expansion="true"
+     fit_parent="true"
      follows="all"
      layout="topleft"
      name="groups_accordion">
-- 
cgit v1.2.3


From 3c036ef49b1e8690f5efe29393a4990e117e5bfe Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 1 Apr 2010 17:41:47 +0300
Subject: (work in progress) EXT-6564(major) - Fix wearable editing panels
 Fixed Edit Shape panel layout: - fixed widget positioning according to spec -
 added gear button bar - fixed accordion positioning - fixed parameter list
 positioning

TODO:
- fix parameter panel positioning
- apply changes to the rest of wearable panels

Reviewed by Vadim Savchuk - https://codereview.productengine.com/secondlife/r/149/

--HG--
branch : product-engine
---
 indra/llui/llscrollingpanellist.cpp                | 28 ++++++-
 indra/llui/llscrollingpanellist.h                  |  6 +-
 indra/newview/llpaneleditwearable.cpp              |  6 --
 indra/newview/llsidepanelappearance.cpp            |  2 +
 .../skins/default/xui/en/panel_edit_shape.xml      | 86 ++++++++++++++++------
 .../skins/default/xui/en/panel_edit_wearable.xml   | 64 ++++++++++++++--
 .../skins/default/xui/en/panel_scrolling_param.xml | 32 +++++++-
 .../skins/default/xui/en/sidepanel_appearance.xml  |  2 +-
 8 files changed, 185 insertions(+), 41 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llscrollingpanellist.cpp b/indra/llui/llscrollingpanellist.cpp
index 4f55c0507c..b7840d1b59 100644
--- a/indra/llui/llscrollingpanellist.cpp
+++ b/indra/llui/llscrollingpanellist.cpp
@@ -47,7 +47,12 @@ void LLScrollingPanelList::clearPanels()
 {
 	deleteAllChildren();
 	mPanelList.clear();
-	reshape( 1, 1, FALSE );
+
+	LLRect rc = getRect();
+	rc.setLeftTopAndSize(rc.mLeft, rc.mTop, 1, 1);
+	setRect(rc);
+
+	notifySizeChanged(rc.getHeight());
 }
 
 S32 LLScrollingPanelList::addPanel( LLScrollingPanel* panel )
@@ -67,7 +72,11 @@ S32 LLScrollingPanelList::addPanel( LLScrollingPanel* panel )
 		max_width = llmax( max_width, childp->getRect().getWidth() );
 		cur_gap = GAP_BETWEEN_PANELS;
 	}
-	reshape( max_width, total_height, FALSE );
+ 	LLRect rc = getRect();
+ 	rc.setLeftTopAndSize(rc.mLeft, rc.mTop, max_width, total_height);
+ 	setRect(rc);
+
+	notifySizeChanged(rc.getHeight());
 
 	// Reposition each of the child views
 	S32 cur_y = total_height;
@@ -131,7 +140,11 @@ void LLScrollingPanelList::removePanel( U32 panel_index )
 		max_width = llmax( max_width, childp->getRect().getWidth() );
 		cur_gap = GAP_BETWEEN_PANELS;
 	}
-	reshape( max_width, total_height, FALSE );
+	LLRect rc = getRect();
+	rc.setLeftTopAndSize(rc.mLeft, rc.mTop, max_width, total_height);
+	setRect(rc);
+
+	notifySizeChanged(rc.getHeight());
 
 	// Reposition each of the child views
 	S32 cur_y = total_height;
@@ -200,3 +213,12 @@ void LLScrollingPanelList::draw()
 	LLUICtrl::draw();
 }
 
+void LLScrollingPanelList::notifySizeChanged(S32 height)
+{
+	LLSD info;
+	info["action"] = "size_changes";
+	info["height"] = height;
+	notifyParent(info);
+}
+
+// EOF
diff --git a/indra/llui/llscrollingpanellist.h b/indra/llui/llscrollingpanellist.h
index 3abfbcbbe7..5f1996159b 100644
--- a/indra/llui/llscrollingpanellist.h
+++ b/indra/llui/llscrollingpanellist.h
@@ -61,7 +61,6 @@ public:
 		Params()
 		{
 			name = "scrolling_panel_list";
-			follows.flags = FOLLOWS_LEFT | FOLLOWS_BOTTOM;
 		}
 	};
 	LLScrollingPanelList(const Params& p)
@@ -86,6 +85,11 @@ public:
 private:
 	void				updatePanelVisiblilty();
 
+	/**
+	 * Notify parent about size change, makes sense when used inside accordion
+	 */
+	void				notifySizeChanged(S32 height);
+
 	panel_list_t		mPanelList;
 };
 
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index 805016f089..c0528da999 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -489,7 +489,6 @@ void LLPanelEditWearable::initializePanel()
 
 		updateScrollingPanelUI();
 	}
-	
 }
 
 void LLPanelEditWearable::updateScrollingPanelUI()
@@ -640,14 +639,9 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value
 		{
 			LLPanel::Params p;
 			p.name("LLScrollingPanelParam");
-			p.rect(LLRect(0, LLScrollingPanelParam::PARAM_PANEL_HEIGHT, LLScrollingPanelParam::PARAM_PANEL_WIDTH, 0 ));
 			LLScrollingPanelParam* panel_param = new LLScrollingPanelParam( p, NULL, (*it).second, TRUE, this->getWearable());
 			height = panel_list->addPanel( panel_param );
 		}
-	
-		S32 width = tab->getRect().getWidth();
-	
-		tab->reshape(width,height + tab->getHeaderHeight()+10,FALSE);
 	}
 }
 
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index b951434010..a80687da4d 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -297,6 +297,8 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
 		return;
 	}
 
+	mCurrOutfitPanel->setVisible(!visible);
+
 	mEditWearable->setVisible(visible);
 	mEditWearable->setWearable(wearable);
 	mFilterEditor->setVisible(!visible);
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index 45c4b92338..9a3b5c26ec 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -1,38 +1,43 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
 	 left="10"
 	 name="edit_shape_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-		 border="true"
+		 border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
 		 follows="top|left"
 		 height="50"
 		 left="10"
 		 layout="topleft"
 		 name="avatar_sex_panel"
-		 top="10"
-		 width="293" >
+		 top="0"
+		 width="313" >
    			<text 
 			 follows="top|left"
 			 height="16"
 			 layout="topleft"
 			 left="10"
 			 name="gender_text"
-			 width="303">
+			 width="313">
 				Gender:
 			</text>
 		   <radio_group
-			 follows="all"
+			 follows="left|top|right"
 			 left="10"
-             height="34"
+             height="28"
              layout="topleft"
              name="sex_radio"
 			 top_pad="3"
-			 width="200" >
+			 width="303" >
                 <radio_item
 					follows="all"
                  height="16"
@@ -51,21 +56,41 @@
                  width="82" />
             </radio_group>
 	 </panel>
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="345"
+         label="Shirt"
+         layout="topleft"
+		 left="10"
+         name="accordion_panel"
+		 top_pad="10"
+         width="313">
 	 <accordion
-		follows="left|top|right|bottom"
-		height ="330"
-		left="10"
+        layout="topleft"
+		follows="all"
+		height ="345"
+		left="0"
 		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+		top="0"
+        single_expansion="true"
+        fit_parent="false"
+		width="313">
 		<accordion_tab
 			layout="topleft"
 			min_height="150"
 			name="shape_body_tab"
+            fit_panel="false"
 			title="Body">
 			<scrolling_panel_list
+                layout="topleft" 
 				follows="all"
 				left="0"
+                height="300"
 				name="shape_body_param_list"
 				top="0"
 				width="303" />
@@ -73,11 +98,13 @@
 		<accordion_tab
 			layout="topleft"
 			min_height="150"
+            fit_panel="false"
 			name="shape_head_tab"
 			title="Head">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
-				left="0"
+				left="10"
 				name="shape_head_param_list"
 				top="0"
 				width="303" />
@@ -85,9 +112,11 @@
 		<accordion_tab
 			layout="topleft"
 			min_height="150"
+            fit_panel="false"
 			name="shape_eyes_tab"
 			title="Eyes">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_eyes_param_list"
@@ -97,9 +126,11 @@
 		<accordion_tab
 			layout="topleft"
 			min_height="150"
+            fit_panel="false"
 			name="shape_ears_tab"
 			title="Ears">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_ears_param_list"
@@ -110,8 +141,10 @@
 			layout="topleft"
 			min_height="150"
 			name="shape_nose_tab"
+            fit_panel="false"
 			title="Nose">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_nose_param_list"
@@ -122,8 +155,10 @@
 			layout="topleft"
 			min_height="150"
 			name="shape_mouth_tab"
+            fit_panel="false"
 			title="Mouth">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_mouth_param_list"
@@ -134,8 +169,10 @@
 			layout="topleft"
 			min_height="150"
 			name="shape_chin_tab"
+            fit_panel="false"
 			title="Chin">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_chin_param_list"
@@ -146,8 +183,10 @@
 			layout="topleft"
 			min_height="150"
 			name="shape_torso_tab"
+            fit_panel="false"
 			title="Torso">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_torso_param_list"
@@ -158,8 +197,10 @@
 			layout="topleft"
 			min_height="150"
 			name="shape_legs_tab"
+            fit_panel="false"
 			title="Legs">
-			<scrolling_panel_list
+           <scrolling_panel_list
+                layout="topleft"
 				follows="all"
 				left="0"
 				name="shape_legs_param_list"
@@ -167,5 +208,6 @@
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index f76a56bda4..b4272bb10a 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -150,7 +150,11 @@ left="0"
 	 value="Editing Shape"
 	 width="270" />
      <panel
-         border="true"
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
          follows="top|left"
          height="60"
          label="Shirt"
@@ -335,30 +339,76 @@ left="0"
 			 visible="false"
 			 width="333" />
 	 </panel>
+     <panel
+        follows="left|right|bottom"
+        height="38"
+        label="gear_buttom_panel"
+        layout="bottom|left|right"
+        left="0"
+        bottom="25"
+        name="gear_buttom_panel"
+        width="333">
+        <button
+            follows="bottom|left"
+            tool_tip="Options"
+            height="18"
+            image_disabled="OptionsMenu_Disabled"
+            image_selected="OptionsMenu_Press"
+            image_unselected="OptionsMenu_Off"
+            layout="topleft"
+            left="10"
+            name="friends_viewsort_btn"
+            top="10"
+            width="18" />
+        <button
+            follows="bottom|left"
+            height="18"
+            image_selected="AddItem_Press"
+            image_unselected="AddItem_Off"
+            image_disabled="AddItem_Disabled"
+            layout="topleft"
+            left_pad="10"
+            name="add_btn"
+            tool_tip="TODO"
+            width="18" />
+        <button
+            follows="bottom|left"
+            height="18"
+            image_selected="TrashItem_Press"
+            image_unselected="TrashItem_Off"
+            image_disabled="TrashItem_Disabled"
+            layout="topleft"
+            left_pad="10"
+            right="-10"
+            name="del_btn"
+            tool_tip="TODO"
+            top_delta="0"
+            width="18" />
+     </panel>
 	 <panel
-		 follows="all"
+		 follows="bottom|left|right"
 		 height="25"
 		 layout="bottom|left|right"
 		 left="0"
 		 name="button_panel"
-		 top_pad="10"
+		 bottom="5"
 		 width="333" >
 		 <button
 			 follows="bottomleft"
 			 layout="topleft"
 			 height="23"
 			 label="Save As"
-			 left="10"
+			 left="8"
 			 name="save_as_button"
 			 top="0"
-			 width="100" />
+			 width="153" />
 		 <button
 			 follows="bottomleft"
 			 layout="topleft"
 			 height="23"
 			 label="Revert"
-			 left_pad="10"
+			 left_pad="7"
 			 name="revert_button"
-			 width="100" />
+			 width="153" />
 	 </panel>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
index 44afadf65a..f9c86fc75b 100644
--- a/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
+++ b/indra/newview/skins/default/xui/en/panel_scrolling_param.xml
@@ -5,7 +5,7 @@
  left="0"
  name="LLScrollingPanelParam"
  top="152"
- width="270">
+ width="290">
     <text
      follows="left|top"
      height="16"
@@ -46,6 +46,36 @@
      width="128">
         Loading...
     </text>
+    <view_border 
+     layout="topleft"
+     follows="left|top"
+     left="2"
+     top="0"
+     width="132"
+     height="132"
+     thickness="2"
+     shadow_light_color="LtGray_50"
+     highlight_light_color="LtGray_50"
+     highlight_dark_color="LtGray_50"
+     shadow_dark_color="LtGray_50"
+     bevel_style="in"
+     name="left_border"
+    />
+    <view_border 
+     layout="topleft"
+     follows="left|top"
+     left_pad="2"
+     top_delta="0"
+     width="132"
+     height="132"
+     thickness="2"
+     shadow_light_color="LtGray_50"
+     highlight_light_color="LtGray_50"
+     highlight_dark_color="LtGray_50"
+     shadow_dark_color="LtGray_50"
+     bevel_style="in"
+     name="right_border"
+    />
     <button
      enabled="false"
      height="132"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
index 20a1de59fc..c5efa2e221 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_appearance.xml
@@ -120,6 +120,6 @@ width="333">
    layout="topleft"
    left="0"
    name="panel_edit_wearable"
-   top="35"
+   top="0"
    visible="false" />
 </panel>
-- 
cgit v1.2.3


From 08a2242ceb9c94c74c31aa56dbfd42e204a7fd8e Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Thu, 1 Apr 2010 18:20:34 +0300
Subject: Fixed windows build

--HG--
branch : product-engine
---
 indra/llui/llnotifications.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 707a84bdfe..1799ca65b7 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -994,7 +994,7 @@ private:
 
 protected:
 	LLPostponedNotification() {}
-	~LLPostponedNotification() {}
+	virtual ~LLPostponedNotification() {}
 
 	/**
 	 * Abstract method provides possibility to modify notification parameters and
-- 
cgit v1.2.3


From 6eeb4247bbdbb8c7682fabf871dd0345a340593c Mon Sep 17 00:00:00 2001
From: "Nyx (Neal Orman)" <nyx@lindenlab.com>
Date: Thu, 1 Apr 2010 11:24:04 -0400
Subject: updating some back-end functionality that will come in handy as we
 bring the UI up to date with multiwearables.

code reviewed by Seraph and Vir.
---
 indra/newview/llagentwearables.cpp | 19 +++++++++++++------
 indra/newview/llagentwearables.h   |  4 ++--
 2 files changed, 15 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index dad7c7e705..6e983747b2 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -1595,7 +1595,6 @@ void LLAgentWearables::removeWearableFinal(const EWearableType type, bool do_rem
 }
 
 // Assumes existing wearables are not dirty.
-// MULTI_WEARABLE: assumes one wearable per type.
 void LLAgentWearables::setWearableOutfit(const LLInventoryItem::item_array_t& items,
 										 const LLDynamicArray< LLWearable* >& wearables,
 										 BOOL remove)
@@ -1853,16 +1852,24 @@ void LLAgentWearables::queryWearableCache()
 	gAgentQueryManager.mWearablesCacheQueryID++;
 }
 
-// MULTI_WEARABLE: need a way to specify by wearable rather than by type.
 // User has picked "remove from avatar" from a menu.
 // static
-void LLAgentWearables::userRemoveWearable(EWearableType& type)
+void LLAgentWearables::userRemoveWearable(const EWearableType &type, const U32 &index)
 {
-	if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR)) //&&
+	if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
 		//!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
 	{
-		// MULTI_WEARABLE: fixed to 0th for now.
-		gAgentWearables.removeWearable(type,false,0);
+		gAgentWearables.removeWearable(type,false,index);
+	}
+}
+
+//static 
+void LLAgentWearables::userRemoveWearablesOfType(const EWearableType &type)
+{
+	if (!(type==WT_SHAPE || type==WT_SKIN || type==WT_HAIR || type==WT_EYES)) //&&
+		//!((!gAgent.isTeen()) && (type==WT_UNDERPANTS || type==WT_UNDERSHIRT)))
+	{
+		gAgentWearables.removeWearable(type,true,0);
 	}
 }
 
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 652ffd4587..9f8aadeae7 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -193,8 +193,8 @@ public:
 	// Static UI hooks
 	//--------------------------------------------------------------------
 public:
-	// MULTI-WEARABLE: assuming one wearable per type.  Need upstream changes.
-	static void		userRemoveWearable(EWearableType& type);
+	static void		userRemoveWearable(const EWearableType &type, const U32 &index);
+	static void		userRemoveWearablesOfType(const EWearableType &type);
 	static void		userRemoveAllClothes();	
 	
 	typedef std::vector<LLViewerObject*> llvo_vec_t;
-- 
cgit v1.2.3


From 5db663c87ef816fc09b0f93266d871d05833df8c Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Thu, 1 Apr 2010 18:47:35 +0300
Subject: Partial fix for normal bug EXT-6612 (End Call button in 1:1 IMs
 should be labeled End Call (not Leave Call))

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_im_control_panel.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
index 7d7e21d4b0..29c6a17c31 100644
--- a/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
+++ b/indra/newview/skins/default/xui/en/panel_im_control_panel.xml
@@ -150,7 +150,7 @@
             <button
              follows="left|top|right"
              height="23"
-             label="Leave Call"
+             label="End Call"
              name="end_call_btn"
              width="100" />
         </layout_panel>
-- 
cgit v1.2.3


From 4a9567d749b7b1e92aadf2224ed7fd5588d68dd6 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Thu, 1 Apr 2010 19:23:09 +0300
Subject: Minor optimization: removed reduntant getChild() calls. Not reviewed.

--HG--
branch : product-engine
---
 indra/newview/lllocationinputctrl.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index ba50287ebd..5a2332cdd8 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -391,8 +391,8 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 
 	mAddLandmarkTooltip = LLTrans::getString("LocationCtrlAddLandmarkTooltip");
 	mEditLandmarkTooltip = LLTrans::getString("LocationCtrlEditLandmarkTooltip");
-	getChild<LLView>("Location History")->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
-	getChild<LLView>("Place Information")->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
+	mButton->setToolTip(LLTrans::getString("LocationCtrlComboBtnTooltip"));
+	mInfoBtn->setToolTip(LLTrans::getString("LocationCtrlInfoBtnTooltip"));
 }
 
 LLLocationInputCtrl::~LLLocationInputCtrl()
-- 
cgit v1.2.3


From 56dbd313a156a6913d791c920d0023f5451c657f Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Thu, 1 Apr 2010 17:23:49 +0100
Subject: Checker: CHECKED_RETURN Function: LLAgentCamera::updateCamera() File:
 /indra/newview/llagentcamera.cpp

not a bug, but I cleaned up BOOL->bool
---
 indra/newview/llagentcamera.cpp | 11 ++++++-----
 indra/newview/llagentcamera.h   |  2 +-
 2 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index bb06255fd1..e8ffe9708b 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -142,7 +142,7 @@ LLAgentCamera::LLAgentCamera() :
 	mSitCameraEnabled(FALSE),
 	mCameraSmoothingLastPositionGlobal(),
 	mCameraSmoothingLastPositionAgent(),
-	mCameraSmoothingStop(FALSE),
+	mCameraSmoothingStop(false),
 
 	mCameraUpVector(LLVector3::z_axis), // default is straight up
 
@@ -1042,7 +1042,7 @@ void LLAgentCamera::cameraPanLeft(F32 meters)
 	mFocusGlobal = mFocusTargetGlobal;
 
 	// disable smoothing for camera pan, which causes some residents unhappiness
-	mCameraSmoothingStop = TRUE;
+	mCameraSmoothingStop = true;
 	
 	cameraZoomIn(1.f);
 	updateFocusOffset();
@@ -1062,7 +1062,7 @@ void LLAgentCamera::cameraPanUp(F32 meters)
 	mFocusGlobal = mFocusTargetGlobal;
 
 	// disable smoothing for camera pan, which causes some residents unhappiness
-	mCameraSmoothingStop = TRUE;
+	mCameraSmoothingStop = true;
 
 	cameraZoomIn(1.f);
 	updateFocusOffset();
@@ -1364,7 +1364,8 @@ void LLAgentCamera::updateCamera()
 		LLVector3d camera_pos_agent = camera_pos_global - agent_pos;
 		// Sitting on what you're manipulating can cause camera jitter with smoothing. 
 		// This turns off smoothing while editing. -MG
-		mCameraSmoothingStop |= (BOOL)LLToolMgr::getInstance()->inBuildMode();
+		bool in_build_mode = LLToolMgr::getInstance()->inBuildMode();
+		mCameraSmoothingStop = mCameraSmoothingStop || in_build_mode;
 		
 		if (cameraThirdPerson() && !mCameraSmoothingStop)
 		{
@@ -1396,7 +1397,7 @@ void LLAgentCamera::updateCamera()
 								 
 		mCameraSmoothingLastPositionGlobal = camera_pos_global;
 		mCameraSmoothingLastPositionAgent = camera_pos_agent;
-		mCameraSmoothingStop = FALSE;
+		mCameraSmoothingStop = false;
 	}
 
 	
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 3ba24ef32b..1e55e18d2a 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -151,7 +151,7 @@ private:
 	LLVector3		mCameraVirtualPositionAgent;	// Camera virtual position (target) before performing FOV zoom
 	LLVector3d      mCameraSmoothingLastPositionGlobal;    
 	LLVector3d      mCameraSmoothingLastPositionAgent;
-	BOOL            mCameraSmoothingStop;
+	bool            mCameraSmoothingStop;
 	LLVector3		mCameraLag;						// Third person camera lag
 	LLVector3		mCameraUpVector;				// Camera's up direction in world coordinates (determines the 'roll' of the view)
 
-- 
cgit v1.2.3


From fb08c17cdda47051fcfffc9cc8ff590e34c6ef94 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Thu, 1 Apr 2010 17:25:42 +0100
Subject: Checker: UNINIT_CTOR Function: LLAgentCamera::LLAgentCamera() File:
 /indra/newview/llagentcamera.cpp

---
 indra/newview/llagentcamera.cpp | 4 +++-
 indra/newview/llagentcamera.h   | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index e8ffe9708b..908bcfab6a 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -107,6 +107,8 @@ LLAgentCamera gAgentCamera;
 // LLAgentCamera()
 //-----------------------------------------------------------------------------
 LLAgentCamera::LLAgentCamera() :
+	mInitialized(false),
+
 	mDrawDistance( DEFAULT_FAR_PLANE ),
 
 	mLookAt(NULL),
@@ -219,7 +221,7 @@ void LLAgentCamera::init()
 	mCameraZoomFraction = 1.f;
 	mTrackFocusObject = gSavedSettings.getBOOL("TrackFocusObject");
 
-	mInitialized = TRUE;
+	mInitialized = true;
 }
 
 //-----------------------------------------------------------------------------
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index 1e55e18d2a..5cbb1de6f4 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -82,7 +82,7 @@ public:
 	void			cleanup();
 	void		    setAvatarObject(LLVOAvatarSelf* avatar);
 private:
-	BOOL			mInitialized;
+	bool			mInitialized;
 
 
 	//--------------------------------------------------------------------
-- 
cgit v1.2.3


From 03322a8e87db8e42435e0641d40e48dc25aa9a97 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Thu, 1 Apr 2010 17:29:08 +0100
Subject: Checker: UNINIT_CTOR Function: LLVOAvatarSelf::LLVOAvatarSelf(const
 LLUUID &, unsigned char, LLViewerRegion *) File:
 /indra/newview/llvoavatarself.cpp

---
 indra/newview/llvoavatarself.cpp | 4 ++--
 indra/newview/llvoavatarself.h   | 2 --
 2 files changed, 2 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index fe6990eae9..c15dbeb8c6 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -87,14 +87,14 @@ using namespace LLVOAvatarDefines;
 struct LocalTextureData
 {
 	LocalTextureData() : 
-		mIsBakedReady(FALSE), 
+		mIsBakedReady(false), 
 		mDiscard(MAX_DISCARD_LEVEL+1), 
 		mImage(NULL), 
 		mWearableID(IMG_DEFAULT_AVATAR),
 		mTexEntry(NULL)
 	{}
 	LLPointer<LLViewerFetchedTexture> mImage;
-	BOOL mIsBakedReady;
+	bool mIsBakedReady;
 	S32 mDiscard;
 	LLUUID mWearableID;	// UUID of the wearable that this texture belongs to, not of the image itself
 	LLTextureEntry *mTexEntry;
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 4960d4d103..4856e82275 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -124,12 +124,10 @@ public:
 public:
 	/*virtual*/ BOOL    updateIsFullyLoaded();
 private:
-	BOOL                mIsBaked; // are the stored baked textures up to date?
 
 	//--------------------------------------------------------------------
 	// Region state
 	//--------------------------------------------------------------------
-private:
 	U64				mLastRegionHandle;
 	LLFrameTimer	mRegionCrossingTimer;
 	S32				mRegionCrossingCount;
-- 
cgit v1.2.3


From 990011f3d68b46ec43218800328d810bd153495a Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Thu, 1 Apr 2010 10:30:27 -0600
Subject: make LLImageBase::allocateData() thread-safe. insert debug code for
 EXT-6567: crash at LLImageBase::allocateData [secondlife-bin llimage.cpp:170]

---
 indra/llimage/llimage.cpp          | 30 +++++++++++++++++++++---------
 indra/llimage/llimage.h            | 14 ++++++--------
 indra/newview/llviewermenufile.cpp |  5 ++---
 3 files changed, 29 insertions(+), 20 deletions(-)

(limited to 'indra')

diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index 7d0de18c7c..0874f574c5 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -93,9 +93,10 @@ LLImageBase::LLImageBase()
 	  mWidth(0),
 	  mHeight(0),
 	  mComponents(0),
+	  mBadBufferAllocation(false),
+	  mAllowOverSize(false),
 	  mMemType(LLMemType::MTYPE_IMAGEBASE)
 {
-	mBadBufferAllocation = FALSE ;
 }
 
 // virtual
@@ -134,8 +135,6 @@ void LLImageBase::sanityCheck()
 	}
 }
 
-BOOL LLImageBase::sSizeOverride = FALSE;
-
 // virtual
 void LLImageBase::deleteData()
 {
@@ -157,23 +156,32 @@ U8* LLImageBase::allocateData(S32 size)
 			llerrs << llformat("LLImageBase::allocateData called with bad dimensions: %dx%dx%d",mWidth,mHeight,mComponents) << llendl;
 		}
 	}
-	if (size < 1 || (size > 4096*4096*16 && sSizeOverride == FALSE))
+	
+	//make this function thread-safe.
+	static const U32 MAX_BUFFER_SIZE = 4096 * 4096 * 16 ; //256 MB
+	if (size < 1 || size > MAX_BUFFER_SIZE) 
 	{
 		llinfos << "width: " << mWidth << " height: " << mHeight << " components: " << mComponents << llendl ;
+		if(mAllowOverSize)
+		{
+			llinfos << "Oversize: " << size << llendl ;
+		}
+		else
+		{
 		llerrs << "LLImageBase::allocateData: bad size: " << size << llendl;
 	}
-	
+	}
 	if (!mData || size != mDataSize)
 	{
 		deleteData(); // virtual
-		mBadBufferAllocation = FALSE ;
+		mBadBufferAllocation = false ;
 		mData = new U8[size];
 		if (!mData)
 		{
 			llwarns << "allocate image data: " << size << llendl;
 			size = 0 ;
 			mWidth = mHeight = 0 ;
-			mBadBufferAllocation = TRUE ;
+			mBadBufferAllocation = true ;
 		}
 		mDataSize = size;
 	}
@@ -222,7 +230,7 @@ U8* LLImageBase::getData()
 	return mData; 
 }
 
-BOOL LLImageBase::isBufferInvalid()
+bool LLImageBase::isBufferInvalid()
 {
 	return mBadBufferAllocation || mData == NULL ;
 }
@@ -258,7 +266,11 @@ LLImageRaw::LLImageRaw(U16 width, U16 height, S8 components)
 	: LLImageBase()
 {
 	mMemType = LLMemType::MTYPE_IMAGERAW;
-	llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
+	//llassert( S32(width) * S32(height) * S32(components) <= MAX_IMAGE_DATA_SIZE );
+	if(S32(width) * S32(height) * S32(components) > MAX_IMAGE_DATA_SIZE)
+	{
+		llwarns << "over size: width: " << (S32)width << " height: " << (S32)height << " components: " << (S32)components << llendl ;
+	}
 	allocateDataSize(width, height, components);
 	++sRawImageCount;
 }
diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h
index 686f583886..10444e7f89 100644
--- a/indra/llimage/llimage.h
+++ b/indra/llimage/llimage.h
@@ -48,7 +48,7 @@ const S32 MAX_IMAGE_SIZE = (1<<MAX_IMAGE_MIP); // 2048
 const S32 MIN_IMAGE_AREA = MIN_IMAGE_SIZE * MIN_IMAGE_SIZE;
 const S32 MAX_IMAGE_AREA = MAX_IMAGE_SIZE * MAX_IMAGE_SIZE;
 const S32 MAX_IMAGE_COMPONENTS = 8;
-const S32 MAX_IMAGE_DATA_SIZE = MAX_IMAGE_AREA * MAX_IMAGE_COMPONENTS;
+const S32 MAX_IMAGE_DATA_SIZE = MAX_IMAGE_AREA * MAX_IMAGE_COMPONENTS; //2048 * 2048 * 8 = 16 MB
 
 // Note!  These CANNOT be changed without modifying simulator code
 // *TODO: change both to 1024 when SIM texture fetching is deprecated
@@ -124,10 +124,12 @@ public:
 
 	const U8 *getData() const	;
 	U8 *getData()				;
-	BOOL isBufferInvalid() ;
+	bool isBufferInvalid() ;
 
 	void setSize(S32 width, S32 height, S32 ncomponents);
 	U8* allocateDataSize(S32 width, S32 height, S32 ncomponents, S32 size = -1); // setSize() + allocateData()
+	void enableOverSize() {mAllowOverSize = true ;}
+	void disableOverSize() {mAllowOverSize = false; }
 
 protected:
 	// special accessor to allow direct setting of mData and mDataSize by LLImageFormatted
@@ -140,8 +142,6 @@ public:
 	// <= 0 priority means that there's no need for more data.
 	static F32 calc_download_priority(F32 virtual_size, F32 visible_area, S32 bytes_sent);
 
-	static void setSizeOverride(BOOL enabled) { sSizeOverride = enabled; }
-
 	static EImageCodec getCodecFromExtension(const std::string& exten);
 	
 private:
@@ -153,12 +153,10 @@ private:
 
 	S8 mComponents;
 
-	BOOL mBadBufferAllocation ;
-
+	bool mBadBufferAllocation ;
+	bool mAllowOverSize ;
 public:
 	LLMemType::DeclareMemType& mMemType; // debug
-	
-	static BOOL sSizeOverride;
 };
 
 // Raw representation of an image (used for textures, and other uncompressed formats
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index c575656b24..c415d89e9c 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -410,7 +410,6 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
 		{
 			gViewerWindow->playSnapshotAnimAndSound();
 			
-			LLImageBase::setSizeOverride(TRUE);
 			LLPointer<LLImageFormatted> formatted;
 			switch(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat")))
 			{
@@ -425,12 +424,12 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
 				break;
 			  default: 
 				llwarns << "Unknown Local Snapshot format" << llendl;
-				LLImageBase::setSizeOverride(FALSE);
 				return true;
 			}
 
+			formatted->enableOverSize() ;
 			formatted->encode(raw, 0);
-			LLImageBase::setSizeOverride(FALSE);
+			formatted->disableOverSize() ;
 			gViewerWindow->saveImageNumbered(formatted);
 		}
 		return true;
-- 
cgit v1.2.3


From ab79bf7aaeaa0cbd7b2571601971cce97f9b4acd Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Thu, 1 Apr 2010 17:34:26 +0100
Subject: Checker: CHECKED_RETURN Function:
 LLViewerMediaImpl::createMediaSource() File: /indra/newview/llviewermedia.cpp

---
 indra/newview/llviewermedia.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index d9fabc7d64..d3eed40f25 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1537,7 +1537,10 @@ void LLViewerMediaImpl::createMediaSource()
 	}
 	else if(! mMimeType.empty())
 	{
-		initializeMedia(mMimeType);
+		if (!initializeMedia(mMimeType))
+		{
+			LL_WARNS("Media") << "Failed to initialize media for mime type " << mMimeType << LL_ENDL;
+		}
 	}
 }
 
-- 
cgit v1.2.3


From 309d94452b43361e13c599c1d14b706a3c46aad6 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Thu, 1 Apr 2010 11:39:01 -0600
Subject: fix for EXT-6678: crash at LLTextureCache::openAndReadEntry
 [secondlife-bin lltexturecache.cpp:1111]

---
 indra/newview/lltexturecache.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/lltexturecache.cpp b/indra/newview/lltexturecache.cpp
index 08bc8220d9..651070a2ea 100644
--- a/indra/newview/lltexturecache.cpp
+++ b/indra/newview/lltexturecache.cpp
@@ -1108,7 +1108,16 @@ S32 LLTextureCache::openAndReadEntry(const LLUUID& id, Entry& entry, bool create
 		{
 			readEntryFromHeaderImmediately(idx, entry) ;
 		}
-		llassert_always(entry.mImageSize > entry.mBodySize);
+		if(entry.mImageSize <= entry.mBodySize)//it happens on 64-bit systems, do not know why
+		{
+			llwarns << "corrupted entry: " << id << " entry image size: " << entry.mImageSize << " entry body size: " << entry.mBodySize << llendl ;
+
+			//erase this entry and the cached texture from the cache.
+			std::string tex_filename = getTextureFileName(id);
+			removeEntry(idx, entry, tex_filename) ;
+			mUpdatedEntryMap.erase(idx) ;
+			idx = -1 ;
+		}
 	}
 	return idx;
 }
-- 
cgit v1.2.3


From 0d7d486f8f14f160de82170ea2f05f1c636b879d Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Thu, 1 Apr 2010 21:22:12 +0300
Subject: Fixed bug EXT-6337 (Changing maturity settings in preferences floater
 only works on first floater spawn when account is not age verified).

I'm actually copying an existing fix from the viewer-hotfix branch. See the ticket for more details.

Not reviewed.

--HG--
branch : product-engine
---
 indra/newview/llfloaterpreference.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 3487f52f35..1172064b59 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -515,13 +515,15 @@ void LLFloaterPreference::onOpen(const LLSD& key)
 		// if they're not adult or a god, they shouldn't see the adult selection, so delete it
 		if (!gAgent.isAdult() && !gAgent.isGodlike())
 		{
-			// we're going to remove the adult entry from the combo. This obviously depends
-			// on the order of items in the XML file, but there doesn't seem to be a reasonable
-			// way to depend on the field in XML called 'name'.
-			maturity_combo->remove(0);
+			// we're going to remove the adult entry from the combo
+			LLScrollListCtrl* maturity_list = maturity_combo->findChild<LLScrollListCtrl>("ComboBox");
+			if (maturity_list)
+			{
+				maturity_list->deleteItems(LLSD(SIM_ACCESS_ADULT));
+			}
 		}
 		childSetVisible("maturity_desired_combobox", true);
-		childSetVisible("maturity_desired_textbox", false);		
+		childSetVisible("maturity_desired_textbox", false);
 	}
 	else
 	{
-- 
cgit v1.2.3


From 5372782d50b087fc12d07b9ef4584581fac10228 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 1 Apr 2010 14:29:23 -0400
Subject: EXT-4084 : Change LLInventoryBridge "LLFolderView* folder" to
 "LLFolderView *rootFolder"

Superficial cleanup - changed all instances to "LLFolderView* root".
---
 indra/newview/llfoldervieweventlistener.h |  2 +-
 indra/newview/llfolderviewitem.cpp        | 29 ++++++++--------
 indra/newview/llinventorybridge.cpp       | 56 +++++++++++++++----------------
 indra/newview/llinventorybridge.h         | 24 ++++++-------
 indra/newview/llpanellandmarks.cpp        |  6 ++--
 indra/newview/llpanelmaininventory.cpp    |  8 ++---
 indra/newview/llpanelobjectinventory.cpp  | 10 +++---
 indra/newview/llpaneloutfitsinventory.cpp | 20 +++++------
 indra/newview/llplacesinventorybridge.cpp |  4 +--
 indra/newview/llplacesinventorybridge.h   |  2 +-
 indra/newview/llsidepanelappearance.cpp   |  8 ++---
 indra/newview/llviewerinventory.cpp       |  6 ++--
 indra/newview/llviewerinventory.h         |  2 +-
 13 files changed, 89 insertions(+), 88 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index 12e100caf4..7fe53d4aad 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -88,7 +88,7 @@ public:
 	virtual BOOL isUpToDate() const = 0;
 	virtual BOOL hasChildren() const = 0;
 	virtual LLInventoryType::EType getInventoryType() const = 0;
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action) = 0;
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action) = 0;
 	
 	// This method should be called when a drag begins. returns TRUE
 	// if the drag can begin, otherwise FALSE.
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index c916e4b98c..0a2a33d220 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -1057,20 +1057,21 @@ void LLFolderViewItem::draw()
 ///----------------------------------------------------------------------------
 
 LLFolderViewFolder::LLFolderViewFolder( const LLFolderViewItem::Params& p ): 
-LLFolderViewItem( p ),	// 0 = no create time
-mIsOpen(FALSE),
-mExpanderHighlighted(FALSE),
-mCurHeight(0.f),
-mTargetHeight(0.f),
-mAutoOpenCountdown(0.f),
-mSubtreeCreationDate(0),
-mAmTrash(LLFolderViewFolder::UNKNOWN),
-mLastArrangeGeneration( -1 ),
-mLastCalculatedWidth(0),
-mCompletedFilterGeneration(-1),
-mMostFilteredDescendantGeneration(-1),
-mNeedsSort(false)
-{}
+	LLFolderViewItem( p ),	// 0 = no create time
+	mIsOpen(FALSE),
+	mExpanderHighlighted(FALSE),
+	mCurHeight(0.f),
+	mTargetHeight(0.f),
+	mAutoOpenCountdown(0.f),
+	mSubtreeCreationDate(0),
+	mAmTrash(LLFolderViewFolder::UNKNOWN),
+	mLastArrangeGeneration( -1 ),
+	mLastCalculatedWidth(0),
+	mCompletedFilterGeneration(-1),
+	mMostFilteredDescendantGeneration(-1),
+	mNeedsSort(false)
+{
+}
 
 // Destroys the object
 LLFolderViewFolder::~LLFolderViewFolder( void )
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 0fbf3148ac..be0e5f8829 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1047,11 +1047,11 @@ LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset
 // |        LLItemBridge                             |
 // +=================================================+
 
-void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLItemBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("goto" == action)
 	{
-		gotoItem(folder);
+		gotoItem(root);
 	}
 
 	if ("open" == action)
@@ -1102,7 +1102,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
-		LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID());
+		LLFolderViewItem* folder_view_itemp = root->getItemByID(itemp->getParentUUID());
 		if (!folder_view_itemp) return;
 
 		folder_view_itemp->getListener()->pasteFromClipboard();
@@ -1114,7 +1114,7 @@ void LLItemBridge::performAction(LLFolderView* folder, LLInventoryModel* model,
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
-		LLFolderViewItem* folder_view_itemp = folder->getItemByID(itemp->getParentUUID());
+		LLFolderViewItem* folder_view_itemp = root->getItemByID(itemp->getParentUUID());
 		if (!folder_view_itemp) return;
 
 		folder_view_itemp->getListener()->pasteLinkFromClipboard();
@@ -1183,7 +1183,7 @@ void LLItemBridge::restoreToWorld()
 	}
 }
 
-void LLItemBridge::gotoItem(LLFolderView *folder)
+void LLItemBridge::gotoItem(LLFolderView* root)
 {
 	LLInventoryObject *obj = getInventoryObject();
 	if (obj && obj->getIsLinkType())
@@ -2103,11 +2103,11 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 
 
 
-void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("open" == action)
 	{
-		LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(folder->getItemByID(mUUID));
+		LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(root->getItemByID(mUUID));
 		if (f)
 		{
 			f->setOpen(TRUE);
@@ -3271,7 +3271,7 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 // virtual
-void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLTextureBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("save_as" == action)
 	{
@@ -3282,7 +3282,7 @@ void LLTextureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 			preview_texture->openToSave();
 		}
 	}
-	else LLItemBridge::performAction(folder, model, action);
+	else LLItemBridge::performAction(root, model, action);
 }
 
 // +=================================================+
@@ -3421,7 +3421,7 @@ void teleport_via_landmark(const LLUUID& asset_id)
 }
 
 // virtual
-void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLLandmarkBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("teleport" == action)
 	{
@@ -3445,7 +3445,7 @@ void LLLandmarkBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
 	}
 	else
 	{
-		LLItemBridge::performAction(folder, model, action);
+		LLItemBridge::performAction(root, model, action);
 	}
 }
 
@@ -3523,7 +3523,7 @@ void LLCallingCardBridge::refreshFolderViewItem()
 }
 
 // virtual
-void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLCallingCardBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("begin_im" == action)
 	{
@@ -3549,7 +3549,7 @@ void LLCallingCardBridge::performAction(LLFolderView* folder, LLInventoryModel*
 			LLAvatarActions::offerTeleport(item->getCreatorUUID());
 		}
 	}
-	else LLItemBridge::performAction(folder, model, action);
+	else LLItemBridge::performAction(root, model, action);
 }
 
 LLUIImagePtr LLCallingCardBridge::getIcon() const
@@ -3773,7 +3773,7 @@ std::string LLGestureBridge::getLabelSuffix() const
 }
 
 // virtual
-void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLGestureBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -3819,7 +3819,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 			playGesture(mUUID);
 		}
 	}
-	else LLItemBridge::performAction(folder, model, action);
+	else LLItemBridge::performAction(root, model, action);
 }
 
 void LLGestureBridge::openItem()
@@ -3948,7 +3948,7 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 // virtual
-void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLAnimationBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ((action == "playworld") || (action == "playlocal"))
 	{
@@ -3967,7 +3967,7 @@ void LLAnimationBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
 	}
 	else
 	{
-		LLItemBridge::performAction(folder, model, action);
+		LLItemBridge::performAction(root, model, action);
 	}
 }
 
@@ -4020,7 +4020,7 @@ LLInventoryObject* LLObjectBridge::getObject() const
 }
 
 // virtual
-void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLObjectBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -4064,7 +4064,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
 			}
 		}
 	}
-	else LLItemBridge::performAction(folder, model, action);
+	else LLItemBridge::performAction(root, model, action);
 }
 
 void LLObjectBridge::openItem()
@@ -4529,7 +4529,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const
 }
 
 // virtual
-void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLWearableBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -4549,7 +4549,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
 		removeFromAvatar();
 		return;
 	}
-	else LLItemBridge::performAction(folder, model, action);
+	else LLItemBridge::performAction(root, model, action);
 }
 
 void LLWearableBridge::openItem()
@@ -5348,30 +5348,30 @@ void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	hide_context_entries(menu, items, disabled_items);
 }
 
-void LLLinkFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLLinkFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("goto" == action)
 	{
-		gotoItem(folder);
+		gotoItem(root);
 		return;
 	}
-	LLItemBridge::performAction(folder,model,action);
+	LLItemBridge::performAction(root,model,action);
 }
 
-void LLLinkFolderBridge::gotoItem(LLFolderView *folder)
+void LLLinkFolderBridge::gotoItem(LLFolderView* root)
 {
 	const LLUUID &cat_uuid = getFolderID();
 	if (!cat_uuid.isNull())
 	{
-		if (LLFolderViewItem *base_folder = folder->getItemByID(cat_uuid))
+		if (LLFolderViewItem *base_folder = root->getItemByID(cat_uuid))
 		{
 			if (LLInventoryModel* model = getInventoryModel())
 			{
 				model->fetchDescendentsOf(cat_uuid);
 			}
 			base_folder->setOpen(TRUE);
-			folder->setSelectionFromRoot(base_folder,TRUE);
-			folder->scrollToShowSelection();
+			root->setSelectionFromRoot(base_folder,TRUE);
+			root->scrollToShowSelection();
 		}
 	}
 }
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 32504091cb..22e454d645 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -249,12 +249,12 @@ public:
 	LLItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
 		LLInvFVBridge(inventory, uuid) {}
 
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 
 	virtual void selectItem();
 	virtual void restoreItem();
 	virtual void restoreToWorld();
-	virtual void gotoItem(LLFolderView *folder);
+	virtual void gotoItem(LLFolderView* root);
 	virtual LLUIImagePtr getIcon() const;
 	virtual const std::string& getDisplayName() const;
 	virtual std::string getLabelSuffix() const;
@@ -292,7 +292,7 @@ public:
 							BOOL drop);
 	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category,
 								BOOL drop);
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void closeItem();
 	virtual BOOL isItemRenameable() const;
@@ -395,7 +395,7 @@ public:
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 
 protected:
 	LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) :
@@ -423,7 +423,7 @@ class LLLandmarkBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
@@ -455,7 +455,7 @@ public:
 	virtual std::string getLabelSuffix() const;
 	//virtual const std::string& getDisplayName() const;
 	virtual LLUIImagePtr getIcon() const;
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	//virtual void renameItem(const std::string& new_name);
@@ -497,7 +497,7 @@ public:
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
 
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual BOOL removeItem();
 
@@ -515,7 +515,7 @@ class LLAnimationBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 
 	virtual LLUIImagePtr getIcon() const;
@@ -532,7 +532,7 @@ class LLObjectBridge : public LLItemBridge
 	friend class LLInvFVBridge;
 public:
 	virtual LLUIImagePtr	getIcon() const;
-	virtual void			performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void			performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void			openItem();
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
@@ -570,7 +570,7 @@ class LLWearableBridge : public LLItemBridge
 	friend class LLInvFVBridge;
 public:
 	virtual LLUIImagePtr getIcon() const;
-	virtual void	performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void	performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void	openItem();
 	virtual void	buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual std::string getLabelSuffix() const;
@@ -635,8 +635,8 @@ public:
 
 	virtual LLUIImagePtr getIcon() const;
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
-	virtual void gotoItem(LLFolderView *folder);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void gotoItem(LLFolderView* root);
 
 protected:
 	LLLinkFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 4cde02c1ce..9a22d9ccf0 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -435,9 +435,9 @@ LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPa
 	if (!inventory_list)
 		return NULL;
 
-	LLFolderView* folder_view = inventory_list->getRootFolder();
+	LLFolderView* root = inventory_list->getRootFolder();
 
-	LLFolderViewItem* item = folder_view->getItemByID(obj_id);
+	LLFolderViewItem* item = root->getItemByID(obj_id);
 	if (!item)
 		return NULL;
 
@@ -447,7 +447,7 @@ LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPa
 		tab->changeOpenClose(false);
 	}
 
-	folder_view->setSelection(item, FALSE, take_keyboard_focus);
+	root->setSelection(item, FALSE, take_keyboard_focus);
 
 	LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
 	LLRect screen_rc;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index dbc40959d7..e4f13cdeda 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1089,19 +1089,19 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 	if (command_name == "delete")
 	{
 		BOOL can_delete = FALSE;
-		LLFolderView *folder = getActivePanel()->getRootFolder();
-		if (folder)
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		if (root)
 		{
 			can_delete = TRUE;
 			std::set<LLUUID> selection_set;
-			folder->getSelectionList(selection_set);
+			root->getSelectionList(selection_set);
 			if (selection_set.empty()) return FALSE;
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
 				 ++iter)
 			{
 				const LLUUID &item_id = (*iter);
-				LLFolderViewItem *item = folder->getItemByID(item_id);
+				LLFolderViewItem *item = root->getItemByID(item_id);
 				const LLFolderViewEventListener *listener = item->getListener();
 				llassert(listener);
 				if (!listener) return FALSE;
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index c43cbf5819..988b5576c2 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -128,7 +128,7 @@ public:
 	virtual void pasteFromClipboard();
 	virtual void pasteLinkFromClipboard();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual BOOL isUpToDate() const { return TRUE; }
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
@@ -595,7 +595,7 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,
 }
 
 // virtual
-void LLTaskInvFVBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLTaskInvFVBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if (action == "task_buy")
 	{
@@ -917,7 +917,7 @@ public:
 
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
-	virtual void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	static void openSoundPreview(void* data);
 };
@@ -954,7 +954,7 @@ void LLTaskSoundBridge::openSoundPreview(void* data)
 }
 
 // virtual
-void LLTaskSoundBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLTaskSoundBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if (action == "task_play")
 	{
@@ -964,7 +964,7 @@ void LLTaskSoundBridge::performAction(LLFolderView* folder, LLInventoryModel* mo
 			send_sound_trigger(item->getAssetUUID(), 1.0);
 		}
 	}
-	LLTaskInvFVBridge::performAction(folder, model, action);
+	LLTaskInvFVBridge::performAction(root, model, action);
 }
 
 void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index dd320f8328..09a93e3714 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -480,18 +480,18 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 	if (command_name == "delete" || command_name == "remove")
 	{
 		BOOL can_delete = FALSE;
-		LLFolderView *folder = getActivePanel()->getRootFolder();
-		if (folder)
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		if (root)
 		{
 			std::set<LLUUID> selection_set;
-			folder->getSelectionList(selection_set);
+			root->getSelectionList(selection_set);
 			can_delete = (selection_set.size() > 0);
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
 				 ++iter)
 			{
 				const LLUUID &item_id = (*iter);
-				LLFolderViewItem *item = folder->getItemByID(item_id);
+				LLFolderViewItem *item = root->getItemByID(item_id);
 				can_delete &= item->getListener()->isItemRemovable();
 			}
 			return can_delete;
@@ -501,11 +501,11 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 	if (command_name == "remove_link")
 	{
 		BOOL can_delete = FALSE;
-		LLFolderView *folder = getActivePanel()->getRootFolder();
-		if (folder)
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		if (root)
 		{
 			std::set<LLUUID> selection_set;
-			folder->getSelectionList(selection_set);
+			root->getSelectionList(selection_set);
 			can_delete = (selection_set.size() > 0);
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
@@ -550,11 +550,11 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 bool LLPanelOutfitsInventory::hasItemsSelected()
 {
 	bool has_items_selected = false;
-	LLFolderView *folder = getActivePanel()->getRootFolder();
-	if (folder)
+	LLFolderView* root = getActivePanel()->getRootFolder();
+	if (root)
 	{
 		std::set<LLUUID> selection_set;
-		folder->getSelectionList(selection_set);
+		root->getSelectionList(selection_set);
 		has_items_selected = (selection_set.size() > 0);
 	}
 	return has_items_selected;
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index 4fe69f295c..f003a9b9ec 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -122,7 +122,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 //virtual
-void LLPlacesFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
+void LLPlacesFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
 {
 	if ("expand" == action)
 	{
@@ -136,7 +136,7 @@ void LLPlacesFolderBridge::performAction(LLFolderView* folder, LLInventoryModel*
 	}
 	else
 	{
-		LLFolderBridge::performAction(folder, model, action);
+		LLFolderBridge::performAction(root, model, action);
 	}
 }
 
diff --git a/indra/newview/llplacesinventorybridge.h b/indra/newview/llplacesinventorybridge.h
index 66a8e8e54d..e90cc45356 100644
--- a/indra/newview/llplacesinventorybridge.h
+++ b/indra/newview/llplacesinventorybridge.h
@@ -61,7 +61,7 @@ class LLPlacesFolderBridge : public LLFolderBridge
 
 public:
 	/*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
-	/*virtual*/ void performAction(LLFolderView* folder, LLInventoryModel* model, std::string action);
+	/*virtual*/ void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
 
 protected:
 	LLPlacesFolderBridge(LLInventoryType::EType type, LLInventoryPanel* inventory, const LLUUID& uuid)
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index c9e9b2815c..b953b1d447 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -219,13 +219,13 @@ void LLSidepanelAppearance::onOpenOutfitButtonClicked()
 		LLInventoryPanel *inventory_panel = tab_outfits->findChild<LLInventoryPanel>("outfitslist_tab");
 		if (inventory_panel)
 		{
-			LLFolderView *folder = inventory_panel->getRootFolder();
-			LLFolderViewItem *outfit_folder = folder->getItemByID(outfit_link->getLinkedUUID());
+			LLFolderView* root = inventory_panel->getRootFolder();
+			LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID());
 			if (outfit_folder)
 			{
 				outfit_folder->setOpen(!outfit_folder->isOpen());
-				folder->setSelectionFromRoot(outfit_folder,TRUE);
-				folder->scrollToShowSelection();
+				root->setSelectionFromRoot(outfit_folder,TRUE);
+				root->scrollToShowSelection();
 			}
 		}
 	}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index b42d25c1d8..9803b23865 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -1074,7 +1074,7 @@ const std::string NEW_NOTECARD_NAME = "New Note"; // *TODO:Translate? (probably
 const std::string NEW_GESTURE_NAME = "New Gesture"; // *TODO:Translate? (probably not)
 
 // ! REFACTOR ! Really need to refactor this so that it's not a bunch of if-then statements...
-void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, const LLSD& userdata, const LLUUID& default_parent_uuid)
+void menu_create_inventory_item(LLFolderView* root, LLFolderBridge *bridge, const LLSD& userdata, const LLUUID& default_parent_uuid)
 {
 	std::string type_name = userdata.asString();
 	
@@ -1098,7 +1098,7 @@ void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, co
 
 		LLUUID category = gInventory.createNewCategory(parent_id, preferred_type, LLStringUtil::null);
 		gInventory.notifyObservers();
-		folder->setSelectionByID(category, TRUE);
+		root->setSelectionByID(category, TRUE);
 	}
 	else if ("lsl" == type_name)
 	{
@@ -1143,7 +1143,7 @@ void menu_create_inventory_item(LLFolderView* folder, LLFolderBridge *bridge, co
 			llwarns << "Can't create unrecognized type " << type_name << llendl;
 		}
 	}
-	folder->setNeedsAutoRename(TRUE);	
+	root->setNeedsAutoRename(TRUE);	
 }
 
 LLAssetType::EType LLViewerInventoryItem::getType() const
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index 3d3f80b9b5..3577bd8791 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -356,7 +356,7 @@ void copy_inventory_from_notecard(const LLUUID& object_id,
 								  U32 callback_id = 0);
 
 
-void menu_create_inventory_item(LLFolderView* folder,
+void menu_create_inventory_item(LLFolderView* root,
 								LLFolderBridge* bridge,
 								const LLSD& userdata,
 								const LLUUID& default_parent_uuid = LLUUID::null);
-- 
cgit v1.2.3


From 12a1c0aa8b10c3c366dd07b760624c026176c561 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 1 Apr 2010 14:41:12 -0400
Subject: EXT-6680 : [INFRASTRUCTURE] Change LLInventoryPanel "LLFolderView*
 mFolders" to "LLFolderView* mRootFolder"

Superficial member variable name changes.
---
 indra/newview/llinventorypanel.cpp       | 106 +++++++++++++++----------------
 indra/newview/llinventorypanel.h         |  16 ++---
 indra/newview/llplacesinventorypanel.cpp |  34 +++++-----
 3 files changed, 78 insertions(+), 78 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 83c2d62ee8..4d490b0d24 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -80,7 +80,7 @@ protected:
 LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :	
 	LLPanel(p),
 	mInventoryObserver(NULL),
-	mFolders(NULL),
+	mFolderRoot(NULL),
 	mScroller(NULL),
 	mSortOrderSetting(p.sort_order_setting),
 	mInventory(p.inventory),
@@ -124,13 +124,13 @@ BOOL LLInventoryPanel::postBuild()
 		p.rect = folder_rect;
 		p.parent_panel = this;
 		p.tool_tip = p.name;
-		mFolders = LLUICtrlFactory::create<LLFolderView>(p);
-		mFolders->setAllowMultiSelect(mAllowMultiSelect);
+		mFolderRoot = LLUICtrlFactory::create<LLFolderView>(p);
+		mFolderRoot->setAllowMultiSelect(mAllowMultiSelect);
 	}
 
 	mCommitCallbackRegistrar.popScope();
 	
-	mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
+	mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
 	
 	// Scroller
 	{
@@ -144,9 +144,9 @@ BOOL LLInventoryPanel::postBuild()
 		p.tab_stop(true);
 		mScroller = LLUICtrlFactory::create<LLScrollContainer>(p);
 		addChild(mScroller);
-		mScroller->addChild(mFolders);
-		mFolders->setScrollContainer(mScroller);
-		mFolders->addChild(mFolders->mStatusTextBox);
+		mScroller->addChild(mFolderRoot);
+		mFolderRoot->setScrollContainer(mScroller);
+		mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
 	}
 
 	// Set up the callbacks from the inventory we're viewing, and then build everything.
@@ -169,16 +169,16 @@ BOOL LLInventoryPanel::postBuild()
 	{
 		setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER));
 	}
-	mFolders->setSortOrder(getFilter()->getSortOrder());
+	mFolderRoot->setSortOrder(getFilter()->getSortOrder());
 
 	return TRUE;
 }
 
 LLInventoryPanel::~LLInventoryPanel()
 {
-	if (mFolders)
+	if (mFolderRoot)
 	{
-		U32 sort_order = mFolders->getSortOrder();
+		U32 sort_order = mFolderRoot->getSortOrder();
 		if (mSortOrderSetting != INHERIT_SORT_ORDER)
 		{
 			gSavedSettings.setU32(mSortOrderSetting, sort_order);
@@ -194,15 +194,15 @@ LLInventoryPanel::~LLInventoryPanel()
 void LLInventoryPanel::draw()
 {
 	// Select the desired item (in case it wasn't loaded when the selection was requested)
-	mFolders->updateSelection();
+	mFolderRoot->updateSelection();
 	LLPanel::draw();
 }
 
 LLInventoryFilter* LLInventoryPanel::getFilter()
 {
-	if (mFolders) 
+	if (mFolderRoot) 
 	{
-		return mFolders->getFilter();
+		return mFolderRoot->getFilter();
 	}
 	return NULL;
 }
@@ -230,9 +230,9 @@ void LLInventoryPanel::setSortOrder(U32 order)
 	getFilter()->setSortOrder(order);
 	if (getFilter()->isModified())
 	{
-		mFolders->setSortOrder(order);
+		mFolderRoot->setSortOrder(order);
 		// try to keep selection onscreen, even if it wasn't to start with
-		mFolders->scrollToShowSelection();
+		mFolderRoot->scrollToShowSelection();
 	}
 }
 
@@ -277,8 +277,8 @@ void LLInventoryPanel::modelChanged(U32 mask)
 	{
 		const LLUUID& item_id = (*items_iter);
 		const LLInventoryObject* model_item = model->getObject(item_id);
-		LLFolderViewItem* view_item = mFolders->getItemByID(item_id);
-		LLFolderViewFolder* view_folder = mFolders->getFolderByID(item_id);
+		LLFolderViewItem* view_item = mFolderRoot->getItemByID(item_id);
+		LLFolderViewFolder* view_folder = mFolderRoot->getFolderByID(item_id);
 
 		//////////////////////////////
 		// LABEL Operation
@@ -353,7 +353,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				// Add the UI element for this item.
 				buildNewViews(item_id);
 				// Select any newly created object that has the auto rename at top of folder root set.
-				if(mFolders->getRoot()->needsAutoRename())
+				if(mFolderRoot->getRoot()->needsAutoRename())
 				{
 					setSelection(item_id, FALSE);
 				}
@@ -368,7 +368,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 				// model_item's parent will be NULL.
 				if (view_item->getRoot() != view_item->getParent())
 				{
-					LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
+					LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolderRoot->getItemByID(model_item->getParentUUID());
 					// Item has been moved.
 					if (view_item->getParentFolder() != new_parent)
 					{
@@ -376,7 +376,7 @@ void LLInventoryPanel::modelChanged(U32 mask)
 						{
 							// Item is to be moved and we found its new parent in the panel's directory, so move the item's UI.
 							view_item->getParentFolder()->extractItem(view_item);
-							view_item->addToFolder(new_parent, mFolders);
+							view_item->addToFolder(new_parent, mFolderRoot);
 						}
 						else 
 						{
@@ -444,14 +444,14 @@ void LLInventoryPanel::initializeViews()
 	if (gAgent.isFirstLogin())
 	{
 		// Auto open the user's library
-		LLFolderViewFolder* lib_folder = mFolders->getFolderByID(gInventory.getLibraryRootFolderID());
+		LLFolderViewFolder* lib_folder = mFolderRoot->getFolderByID(gInventory.getLibraryRootFolderID());
 		if (lib_folder)
 		{
 			lib_folder->setOpen(TRUE);
 		}
 		
 		// Auto close the user's my inventory folder
-		LLFolderViewFolder* my_inv_folder = mFolders->getFolderByID(gInventory.getRootFolderID());
+		LLFolderViewFolder* my_inv_folder = mFolderRoot->getFolderByID(gInventory.getRootFolderID());
 		if (my_inv_folder)
 		{
 			my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN);
@@ -462,7 +462,7 @@ void LLInventoryPanel::initializeViews()
 void LLInventoryPanel::rebuildViewsFor(const LLUUID& id)
 {
 	// Destroy the old view for this ID so we can rebuild it.
-	LLFolderViewItem* old_view = mFolders->getItemByID(id);
+	LLFolderViewItem* old_view = mFolderRoot->getItemByID(id);
 	if (old_view && id.notNull())
 	{
 		old_view->destroyView();
@@ -479,10 +479,10 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 	if (objectp)
 	{
 		const LLUUID &parent_id = objectp->getParentUUID();
-		LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolders->getItemByID(parent_id);
+		LLFolderViewFolder* parent_folder = (LLFolderViewFolder*)mFolderRoot->getItemByID(parent_id);
 		if (id == mStartFolderID)
 		{
-			parent_folder = mFolders;
+			parent_folder = mFolderRoot;
 		}
 		else if ((mStartFolderID != LLUUID::null) && (!gInventory.isObjectDescendentOf(id, mStartFolderID)))
 		{
@@ -514,11 +514,11 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 				params.name = new_listener->getDisplayName();
 				params.icon = new_listener->getIcon();
 				params.icon_open = new_listener->getOpenIcon();
-				params.root = mFolders;
+				params.root = mFolderRoot;
 				params.listener = new_listener;
 				params.tool_tip = params.name;
 				LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params);
-				folderp->setItemSortOrder(mFolders->getSortOrder());
+				folderp->setItemSortOrder(mFolderRoot->getSortOrder());
 				itemp = folderp;
 
 				// Hide the root folder, so we can show the contents of a folder flat
@@ -552,7 +552,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 				params.icon = new_listener->getIcon();
 				params.icon_open = new_listener->getOpenIcon();
 				params.creation_date = new_listener->getCreationDate();
-				params.root = mFolders;
+				params.root = mFolderRoot;
 				params.listener = new_listener;
 				params.rect = LLRect (0, 0, 0, 0);
 				params.tool_tip = params.name;
@@ -562,7 +562,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 
 		if (itemp)
 		{
-			itemp->addToFolder(parent_folder, mFolders);
+			itemp->addToFolder(parent_folder, mFolderRoot);
 
 			// Don't add children of hidden folders unless this is the panel's root folder.
 			if (itemp->getHidden() && (id != mStartFolderID))
@@ -611,19 +611,19 @@ void LLInventoryPanel::openStartFolderOrMyInventory()
 {
 	if (mStartFolderString != "")
 	{
-		mFolders->openFolder(mStartFolderString);
+		mFolderRoot->openFolder(mStartFolderString);
 	}
 	else
 	{
 		// Find My Inventory folder and open it up by name
-		for (LLView *child = mFolders->getFirstChild(); child; child = mFolders->findNextSibling(child))
+		for (LLView *child = mFolderRoot->getFirstChild(); child; child = mFolderRoot->findNextSibling(child))
 		{
 			LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
 			if (fchild && fchild->getListener() &&
 				(fchild->getListener()->getUUID() == gInventory.getRootFolderID()))
 			{
 				const std::string& child_name = child->getName();
-				mFolders->openFolder(child_name);
+				mFolderRoot->openFolder(child_name);
 				break;
 			}
 		}
@@ -632,7 +632,7 @@ void LLInventoryPanel::openStartFolderOrMyInventory()
 
 void LLInventoryPanel::openSelected()
 {
-	LLFolderViewItem* folder_item = mFolders->getCurSelectedItem();
+	LLFolderViewItem* folder_item = mFolderRoot->getCurSelectedItem();
 	if(!folder_item) return;
 	LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
 	if(!bridge) return;
@@ -668,14 +668,14 @@ BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 
 	// If folder view is empty the (x, y) point won't be in its rect
 	// so the handler must be called explicitly.
-	if (!mFolders->hasVisibleChildren())
+	if (!mFolderRoot->hasVisibleChildren())
 	{
-		handled = mFolders->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
+		handled = mFolderRoot->handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg);
 	}
 
 	if (handled)
 	{
-		mFolders->setDragAndDropThisFrame();
+		mFolderRoot->setDragAndDropThisFrame();
 	}
 
 	return handled;
@@ -686,20 +686,20 @@ void LLInventoryPanel::onMouseEnter(S32 x, S32 y, MASK mask)
 {
 	LLPanel::onMouseEnter(x, y, mask);
 	// don't auto-scroll a list when cursor is over Inventory. See EXT-3981.
-	mFolders->setEnableScroll(false);
+	mFolderRoot->setEnableScroll(false);
 }
 
 // virtual
 void LLInventoryPanel::onMouseLeave(S32 x, S32 y, MASK mask)
 {
 	LLPanel::onMouseLeave(x, y, mask);
-	mFolders->setEnableScroll(true);
+	mFolderRoot->setEnableScroll(true);
 }
 
 void LLInventoryPanel::onFocusLost()
 {
 	// inventory no longer handles cut/copy/paste/delete
-	if (LLEditMenuHandler::gEditMenuHandler == mFolders)
+	if (LLEditMenuHandler::gEditMenuHandler == mFolderRoot)
 	{
 		LLEditMenuHandler::gEditMenuHandler = NULL;
 	}
@@ -710,15 +710,15 @@ void LLInventoryPanel::onFocusLost()
 void LLInventoryPanel::onFocusReceived()
 {
 	// inventory now handles cut/copy/paste/delete
-	LLEditMenuHandler::gEditMenuHandler = mFolders;
+	LLEditMenuHandler::gEditMenuHandler = mFolderRoot;
 
 	LLPanel::onFocusReceived();
 }
 
 void LLInventoryPanel::openAllFolders()
 {
-	mFolders->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
-	mFolders->arrangeAll();
+	mFolderRoot->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN);
+	mFolderRoot->arrangeAll();
 }
 
 void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus)
@@ -729,20 +729,20 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc
 	{
 		return;
 	}
-	mFolders->setSelectionByID(obj_id, take_keyboard_focus);
+	mFolderRoot->setSelectionByID(obj_id, take_keyboard_focus);
 }
 
 void LLInventoryPanel::setSelectCallback(const LLFolderView::signal_t::slot_type& cb) 
 { 
-	if (mFolders) 
+	if (mFolderRoot) 
 	{
-		mFolders->setSelectCallback(cb);
+		mFolderRoot->setSelectCallback(cb);
 	}
 }
 
 void LLInventoryPanel::clearSelection()
 {
-	mFolders->clearSelection();
+	mFolderRoot->clearSelection();
 }
 
 void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action)
@@ -761,18 +761,18 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it
 
 void LLInventoryPanel::doToSelected(const LLSD& userdata)
 {
-	mFolders->doToSelected(&gInventory, userdata);
+	mFolderRoot->doToSelected(&gInventory, userdata);
 }
 
 void LLInventoryPanel::doCreate(const LLSD& userdata)
 {
-	menu_create_inventory_item(mFolders, LLFolderBridge::sSelf, userdata);
+	menu_create_inventory_item(mFolderRoot, LLFolderBridge::sSelf, userdata);
 }
 
 bool LLInventoryPanel::beginIMSession()
 {
 	std::set<LLUUID> selected_items;
-	mFolders->getSelectionList(selected_items);
+	mFolderRoot->getSelectionList(selected_items);
 
 	std::string name;
 	static int session_num = 1;
@@ -785,7 +785,7 @@ bool LLInventoryPanel::beginIMSession()
 	{
 
 		LLUUID item = *iter;
-		LLFolderViewItem* folder_item = mFolders->getItemByID(item);
+		LLFolderViewItem* folder_item = mFolderRoot->getItemByID(item);
 			
 		if(folder_item) 
 		{
@@ -827,7 +827,7 @@ bool LLInventoryPanel::beginIMSession()
 			}
 			else
 			{
-				LLFolderViewItem* folder_item = mFolders->getItemByID(item);
+				LLFolderViewItem* folder_item = mFolderRoot->getItemByID(item);
 				if(!folder_item) return true;
 				LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener();
 
@@ -870,7 +870,7 @@ bool LLInventoryPanel::beginIMSession()
 bool LLInventoryPanel::attachObject(const LLSD& userdata)
 {
 	std::set<LLUUID> selected_items;
-	mFolders->getSelectionList(selected_items);
+	mFolderRoot->getSelectionList(selected_items);
 
 	std::string joint_name = userdata.asString();
 	LLViewerJointAttachment* attachmentp = NULL;
@@ -927,7 +927,7 @@ BOOL LLInventoryPanel::getSinceLogoff()
 void LLInventoryPanel::dumpSelectionInformation(void* user_data)
 {
 	LLInventoryPanel* iv = (LLInventoryPanel*)user_data;
-	iv->mFolders->dumpSelectionInformation();
+	iv->mFolderRoot->dumpSelectionInformation();
 }
 
 BOOL is_inventorysp_active()
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 928a458b84..160a3d6f23 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -133,21 +133,21 @@ public:
 	void clearSelection();
 	LLInventoryFilter* getFilter();
 	void setFilterTypes(U64 filter, LLInventoryFilter::EFilterType = LLInventoryFilter::FILTERTYPE_OBJECT);
-	U32 getFilterObjectTypes() const { return mFolders->getFilterObjectTypes(); }
+	U32 getFilterObjectTypes() const { return mFolderRoot->getFilterObjectTypes(); }
 	void setFilterPermMask(PermissionMask filter_perm_mask);
-	U32 getFilterPermMask() const { return mFolders->getFilterPermissions(); }
+	U32 getFilterPermMask() const { return mFolderRoot->getFilterPermissions(); }
 	void setFilterSubString(const std::string& string);
-	const std::string getFilterSubString() { return mFolders->getFilterSubString(); }
+	const std::string getFilterSubString() { return mFolderRoot->getFilterSubString(); }
 	void setSinceLogoff(BOOL sl);
 	void setHoursAgo(U32 hours);
 	BOOL getSinceLogoff();
 	
 	void setShowFolderState(LLInventoryFilter::EFolderShow show);
 	LLInventoryFilter::EFolderShow getShowFolderState();
-	void setAllowMultiSelect(BOOL allow) { mFolders->setAllowMultiSelect(allow); }
+	void setAllowMultiSelect(BOOL allow) { mFolderRoot->setAllowMultiSelect(allow); }
 	// This method is called when something has changed about the inventory.
 	void modelChanged(U32 mask);
-	LLFolderView* getRootFolder() { return mFolders; }
+	LLFolderView* getRootFolder() { return mFolderRoot; }
 	LLScrollContainer* getScrollableContainer() { return mScroller; }
 	
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
@@ -162,7 +162,7 @@ public:
 	static void dumpSelectionInformation(void* user_data);
 
 	void openSelected();
-	void unSelectAll()	{ mFolders->setSelection(NULL, FALSE, FALSE); }
+	void unSelectAll()	{ mFolderRoot->setSelection(NULL, FALSE, FALSE); }
 	
 	static void onIdle(void* user_data);
 
@@ -177,7 +177,7 @@ protected:
 	LLInventoryObserver*		mInventoryObserver;
 	BOOL 						mAllowMultiSelect;
 
-	LLFolderView*				mFolders;
+	LLFolderView*				mFolderRoot;
 	LLScrollContainer*			mScroller;
 
 	/**
@@ -199,7 +199,7 @@ public:
 	static const std::string INHERIT_SORT_ORDER;
 	
 	void setSortOrder(U32 order);
-	U32 getSortOrder() const { return mFolders->getSortOrder(); }
+	U32 getSortOrder() const { return mFolderRoot->getSortOrder(); }
 private:
 	std::string					mSortOrderSetting;
 
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index ed0fb54051..0930a7be7f 100644
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -68,9 +68,9 @@ BOOL LLPlacesInventoryPanel::postBuild()
 
 	// clear Contents();
 	{
-		mFolders->destroyView();
-		mFolders->getParent()->removeChild(mFolders);
-		mFolders->die();
+		mFolderRoot->destroyView();
+		mFolderRoot->getParent()->removeChild(mFolderRoot);
+		mFolderRoot->die();
 
 		if( mScroller )
 		{
@@ -78,7 +78,7 @@ BOOL LLPlacesInventoryPanel::postBuild()
 			mScroller->die();
 			mScroller = NULL;
 		}
-		mFolders = NULL;
+		mFolderRoot = NULL;
 	}
 
 
@@ -95,13 +95,13 @@ BOOL LLPlacesInventoryPanel::postBuild()
 		p.title = getLabel();
 		p.rect = folder_rect;
 		p.parent_panel = this;
-		mFolders = (LLFolderView*)LLUICtrlFactory::create<LLPlacesFolderView>(p);
-		mFolders->setAllowMultiSelect(mAllowMultiSelect);
+		mFolderRoot = (LLFolderView*)LLUICtrlFactory::create<LLPlacesFolderView>(p);
+		mFolderRoot->setAllowMultiSelect(mAllowMultiSelect);
 	}
 
 	mCommitCallbackRegistrar.popScope();
 
-	mFolders->setCallbackRegistrar(&mCommitCallbackRegistrar);
+	mFolderRoot->setCallbackRegistrar(&mCommitCallbackRegistrar);
 
 	// scroller
 	{
@@ -116,14 +116,14 @@ BOOL LLPlacesInventoryPanel::postBuild()
 		mScroller = LLUICtrlFactory::create<LLScrollContainer>(p);
 	}
 	addChild(mScroller);
-	mScroller->addChild(mFolders);
+	mScroller->addChild(mFolderRoot);
 
-	mFolders->setScrollContainer(mScroller);
-	mFolders->addChild(mFolders->mStatusTextBox);
+	mFolderRoot->setScrollContainer(mScroller);
+	mFolderRoot->addChild(mFolderRoot->mStatusTextBox);
 
 
 	// cut subitems
-	mFolders->setUseEllipses(true);
+	mFolderRoot->setUseEllipses(true);
 
 	return TRUE;
 }
@@ -132,17 +132,17 @@ BOOL LLPlacesInventoryPanel::postBuild()
 void LLPlacesInventoryPanel::saveFolderState()
 {
 	mSavedFolderState->setApply(FALSE);
-	getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+	mFolderRoot->applyFunctorRecursively(*mSavedFolderState);
 }
 
 // re-open folders which state was saved
 void LLPlacesInventoryPanel::restoreFolderState()
 {
 	mSavedFolderState->setApply(TRUE);
-	getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+	mFolderRoot->applyFunctorRecursively(*mSavedFolderState);
 	LLOpenFoldersWithSelection opener;
-	getRootFolder()->applyFunctorRecursively(opener);
-	getRootFolder()->scrollToShowSelection();
+	mFolderRoot->applyFunctorRecursively(opener);
+	mFolderRoot->scrollToShowSelection();
 }
 
 S32	LLPlacesInventoryPanel::notify(const LLSD& info) 
@@ -152,11 +152,11 @@ S32	LLPlacesInventoryPanel::notify(const LLSD& info)
 		std::string str_action = info["action"];
 		if(str_action == "select_first")
 		{
-			return getRootFolder()->notify(info);
+			return mFolderRoot->notify(info);
 		}
 		else if(str_action == "select_last")
 		{
-			return getRootFolder()->notify(info);
+			return mFolderRoot->notify(info);
 		}
 	}
 	return 0;
-- 
cgit v1.2.3


From 7b4046df83e4353bdade8fbc39387a7bbb3f498d Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Thu, 1 Apr 2010 11:47:21 -0700
Subject: EXT-3531 - Ctrl-P does not work reliably on login

---
 indra/llui/llcombobox.cpp             |   1 -
 indra/llui/llflatlistview.cpp         |  37 ++++--
 indra/llui/llflatlistview.h           |   7 +-
 indra/llui/lllineeditor.cpp           | 112 +++-------------
 indra/llui/lllineeditor.h             |   4 -
 indra/llui/llmenugl.cpp               |   2 +-
 indra/llui/llmultifloater.cpp         |   2 +-
 indra/llui/lltextbase.cpp             |   7 +
 indra/llui/lltextbase.h               |   1 +
 indra/llui/lltexteditor.cpp           | 237 +++++-----------------------------
 indra/llui/lltexteditor.h             |  12 +-
 indra/llui/llui.cpp                   |   7 +-
 indra/llui/llui.h                     |   2 +
 indra/llwindow/llwindowwin32.cpp      |  73 -----------
 indra/newview/lllocationinputctrl.cpp |   1 -
 indra/newview/lltoastalertpanel.cpp   |   3 -
 indra/newview/llurllineeditorctrl.cpp |   7 +-
 indra/newview/llurllineeditorctrl.h   |   2 -
 indra/newview/llviewercontrol.cpp     |   8 ++
 indra/newview/llviewermenu.cpp        |   7 +-
 indra/newview/llviewermenu.h          |   1 +
 indra/newview/llviewerwindow.cpp      | 129 ++++++------------
 22 files changed, 141 insertions(+), 521 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp
index 3a8efadaa4..cc107c972d 100644
--- a/indra/llui/llcombobox.cpp
+++ b/indra/llui/llcombobox.cpp
@@ -495,7 +495,6 @@ void LLComboBox::createLineEditor(const LLComboBox::Params& p)
 		params.max_length_bytes(mMaxChars);
 		params.commit_callback.function(boost::bind(&LLComboBox::onTextCommit, this, _2));
 		params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
-		params.handle_edit_keys_directly(true);
 		params.commit_on_focus_lost(false);
 		params.follows.flags(FOLLOWS_ALL);
 		params.label(mLabel);
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index bc34012267..d499e08ecb 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -53,6 +53,17 @@ LLFlatListView::Params::Params()
 	no_items_text("no_items_text")
 {};
 
+LLFlatListView::~LLFlatListView() 
+{ 
+	clear();
+	// Route menu back to the default
+	if( gEditMenuHandler == this )
+	{
+		gEditMenuHandler = NULL;
+	}
+};
+
+
 void LLFlatListView::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */)
 {
 	LLScrollContainer::reshape(width, height, called_from_parent);
@@ -558,15 +569,6 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 			}
 			break;
 		}
-		case 'A':
-		{
-			if(MASK_CONTROL & mask)
-			{
-				selectAll();
-				handled = TRUE;
-			}
-			break;
-		}
 		default:
 			break;
 	}
@@ -791,10 +793,15 @@ bool LLFlatListView::selectNextItemPair(bool is_up_direction, bool reset_selecti
 	return false;
 }
 
-bool LLFlatListView::selectAll()
+BOOL LLFlatListView::canSelectAll() const
+{
+	return !mItemPairs.empty() && mAllowSelection;
+}
+
+void LLFlatListView::selectAll()
 {
 	if (!mAllowSelection)
-		return false;
+		return;
 
 	mSelectedItemPairs.clear();
 
@@ -814,8 +821,6 @@ bool LLFlatListView::selectAll()
 
 	// Stretch selected item rect to ensure it won't be clipped
 	mSelectedItemsBorder->setRect(getLastSelectedItemRect().stretch(-1));
-
-	return true;
 }
 
 bool LLFlatListView::isSelected(item_pair_t* item_pair) const
@@ -953,11 +958,17 @@ void LLFlatListView::getValues(std::vector<LLSD>& values) const
 void LLFlatListView::onFocusReceived()
 {
 	mSelectedItemsBorder->setVisible(TRUE);
+	gEditMenuHandler = this;
 }
 // virtual
 void LLFlatListView::onFocusLost()
 {
 	mSelectedItemsBorder->setVisible(FALSE);
+	// Route menu back to the default
+ 	if( gEditMenuHandler == this )
+	{
+		gEditMenuHandler = NULL;
+	}
 }
 
 //virtual 
diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index 837fbb36b7..3a2ab54658 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -58,7 +58,7 @@
  * - Order of returned selected items are not guaranteed
  * - The control assumes that all items being added are unique.
  */
-class LLFlatListView : public LLScrollContainer
+class LLFlatListView : public LLScrollContainer, public LLEditMenuHandler
 {
 public:
 
@@ -114,7 +114,7 @@ public:
 		Params();
 	};
 	
-	virtual ~LLFlatListView() { clear(); };
+	virtual ~LLFlatListView();
 
 	/**
 	 * Connects callback to signal called when Return key is pressed.
@@ -344,7 +344,8 @@ protected:
 
 	virtual bool selectNextItemPair(bool is_up_direction, bool reset_selection);
 
-	virtual bool selectAll();
+	virtual BOOL canSelectAll() const;
+	virtual void selectAll();
 
 	virtual bool isSelected(item_pair_t* item_pair) const;
 
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 483a394bbd..ce0c0befe0 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -91,7 +91,6 @@ LLLineEditor::Params::Params()
 	background_image_disabled("background_image_disabled"),
 	background_image_focused("background_image_focused"),
 	select_on_focus("select_on_focus", false),
-	handle_edit_keys_directly("handle_edit_keys_directly", false),
 	revert_on_esc("revert_on_esc", true),
 	commit_on_focus_lost("commit_on_focus_lost", true),
 	ignore_tab("ignore_tab", true),
@@ -136,7 +135,6 @@ LLLineEditor::LLLineEditor(const LLLineEditor::Params& p)
 	mIgnoreArrowKeys( FALSE ),
 	mIgnoreTab( p.ignore_tab ),
 	mDrawAsterixes( FALSE ),
-	mHandleEditKeysDirectly(p.handle_edit_keys_directly),
 	mSelectAllonFocusReceived( p.select_on_focus ),
 	mPassDelete(FALSE),
 	mReadOnly(FALSE),
@@ -497,6 +495,7 @@ void LLLineEditor::selectAll()
 	setCursor(mSelectionEnd);
 	//mScrollHPos = 0;
 	mIsSelecting = TRUE;
+	updatePrimary();
 }
 
 
@@ -788,7 +787,7 @@ void LLLineEditor::removeChar()
 	}
 	else
 	{
-		reportBadKeystroke();
+		LLUI::reportBadKeystroke();
 	}
 }
 
@@ -827,7 +826,7 @@ void LLLineEditor::addChar(const llwchar uni_char)
 	}
 	else
 	{
-		reportBadKeystroke();
+		LLUI::reportBadKeystroke();
 	}
 
 	getWindow()->hideCursorUntilMouseMove();
@@ -916,7 +915,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			break;
 
@@ -932,7 +931,7 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			break;
 
@@ -958,22 +957,6 @@ BOOL LLLineEditor::handleSelectionKey(KEY key, MASK mask)
 		}
 	}
 
-	if (!handled && mHandleEditKeysDirectly)
-	{
-		if( (MASK_CONTROL & mask) && ('A' == key) )
-		{
-			if( canSelectAll() )
-			{
-				selectAll();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-	}
-
 	if(handled)
 	{
 		// take selection to 'primary' clipboard
@@ -1020,7 +1003,7 @@ void LLLineEditor::cut()
 		if( need_to_rollback )
 		{
 			rollback.doRollback( this );
-			reportBadKeystroke();
+			LLUI::reportBadKeystroke();
 		}
 		else
 		if( mKeystrokeCallback )
@@ -1129,7 +1112,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
 				}
 				// Truncate the clean string at the limit of what will fit
 				clean_string = clean_string.substr(0, wchars_that_fit);
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
  
 			mText.insert(getCursor(), clean_string);
@@ -1141,7 +1124,7 @@ void LLLineEditor::pasteHelper(bool is_primary)
 			if( need_to_rollback )
 			{
 				rollback.doRollback( this );
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			else
 			if( mKeystrokeCallback )
@@ -1206,7 +1189,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 		}
 		handled = TRUE;
@@ -1255,7 +1238,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			handled = TRUE;
 		}
@@ -1282,7 +1265,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			handled = TRUE;
 		}
@@ -1299,7 +1282,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			handled = TRUE;
 		}
@@ -1316,7 +1299,7 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 			}
 			else
 			{
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 			handled = TRUE;
 		}
@@ -1339,64 +1322,6 @@ BOOL LLLineEditor::handleSpecialKey(KEY key, MASK mask)
 		break;
 	}
 
-	if( !handled && mHandleEditKeysDirectly )
-	{
-		// Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system.
-		if( KEY_DELETE == key )
-		{
-			if( canDoDelete() )
-			{
-				doDelete();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-		else
-		if( MASK_CONTROL & mask )
-		{
-			if( 'C' == key )
-			{
-				if( canCopy() )
-				{
-					copy();
-				}
-				else
-				{
-					reportBadKeystroke();
-				}
-				handled = TRUE;
-			}
-			else
-			if( 'V' == key )
-			{
-				if( canPaste() )
-				{
-					paste();
-				}
-				else
-				{
-					reportBadKeystroke();
-				}
-				handled = TRUE;
-			}
-			else
-			if( 'X' == key )
-			{
-				if( canCut() )
-				{
-					cut();
-				}
-				else
-				{
-					reportBadKeystroke();
-				}
-				handled = TRUE;
-			}
-		}
-	}
 	return handled;
 }
 
@@ -1451,7 +1376,7 @@ BOOL LLLineEditor::handleKeyHere(KEY key, MASK mask )
 			{
 				rollback.doRollback(this);
 
-				reportBadKeystroke();
+				LLUI::reportBadKeystroke();
 			}
 
 			// Notify owner if requested
@@ -1499,7 +1424,7 @@ BOOL LLLineEditor::handleUnicodeCharHere(llwchar uni_char)
 		{
 			rollback.doRollback( this );
 
-			reportBadKeystroke();
+			LLUI::reportBadKeystroke();
 		}
 
 		// Notify owner if requested
@@ -1544,7 +1469,7 @@ void LLLineEditor::doDelete()
 		if( need_to_rollback )
 		{
 			rollback.doRollback( this );
-			reportBadKeystroke();
+			LLUI::reportBadKeystroke();
 		}
 		else
 		{
@@ -1879,11 +1804,6 @@ S32 LLLineEditor::findPixelNearestPos(const S32 cursor_offset) const
 	return result;
 }
 
-void LLLineEditor::reportBadKeystroke()
-{
-	make_ui_sound("UISndBadKeystroke");
-}
-
 //virtual
 void LLLineEditor::clear()
 {
diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h
index b62138426b..9489e723e3 100644
--- a/indra/llui/lllineeditor.h
+++ b/indra/llui/lllineeditor.h
@@ -81,7 +81,6 @@ public:
 										background_image_focused;
 
 		Optional<bool>					select_on_focus,
-										handle_edit_keys_directly,
 										revert_on_esc,
 										commit_on_focus_lost,
 										ignore_tab;
@@ -215,7 +214,6 @@ public:
 	void			extendSelection(S32 new_cursor_pos);
 	void			deleteSelection();
 
-	void			setHandleEditKeysDirectly( BOOL b ) { mHandleEditKeysDirectly = b; }
 	void			setSelectAllonFocusReceived(BOOL b);
 	
 	typedef boost::function<void (LLLineEditor* caller, void* user_data)> callback_t;
@@ -247,7 +245,6 @@ private:
 	void			addChar(const llwchar c);
 	void			setCursorAtLocalPos(S32 local_mouse_x);
 	S32				findPixelNearestPos(S32 cursor_offset = 0) const;
-	void			reportBadKeystroke();
 	BOOL			handleSpecialKey(KEY key, MASK mask);
 	BOOL			handleSelectionKey(KEY key, MASK mask);
 	BOOL			handleControlKey(KEY key, MASK mask);
@@ -325,7 +322,6 @@ protected:
 	BOOL		mIgnoreTab;
 	BOOL		mDrawAsterixes;
 
-	BOOL		mHandleEditKeysDirectly;  // If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system
 	BOOL		mSelectAllonFocusReceived;
 	BOOL		mPassDelete;
 
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index fb4a9d032d..e0e86ae228 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -3345,7 +3345,7 @@ void LLMenuHolderGL::draw()
 	LLView::draw();
 	// now draw last selected item as overlay
 	LLMenuItemGL* selecteditem = (LLMenuItemGL*)sItemLastSelectedHandle.get();
-	if (selecteditem && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
+	if (selecteditem && selecteditem->getVisible() && sItemActivationTimer.getStarted() && sItemActivationTimer.getElapsedTimeF32() < ACTIVATE_HIGHLIGHT_TIME)
 	{
 		// make sure toggle items, for example, show the proper state when fading out
 		selecteditem->buildDrawLabel();
diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp
index 4af9108329..3aea648562 100644
--- a/indra/llui/llmultifloater.cpp
+++ b/indra/llui/llmultifloater.cpp
@@ -345,7 +345,7 @@ void LLMultiFloater::setVisible(BOOL visible)
 
 BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask)
 {
-	if (key == 'W' && mask == MASK_CONTROL)
+	if (key == 'W' && mask == (MASK_CONTROL|MASK_SHIFT))
 	{
 		LLFloater* floater = getActiveFloater();
 		// is user closeable and is system closeable
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 5f4b16ec9e..fb8cb1c93b 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1047,6 +1047,13 @@ void LLTextBase::setValue(const LLSD& value )
 	setText(value.asString());
 }
 
+//virtual
+BOOL LLTextBase::canDeselect() const 
+{ 
+	return hasSelection(); 
+}
+
+
 //virtual
 void LLTextBase::deselect()
 {
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 5b24c63557..8ed0680df9 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -132,6 +132,7 @@ public:
 	/*virtual*/ LLTextViewModel* getViewModel() const;
 
 	// LLEditMenuHandler interface
+	/*virtual*/ BOOL		canDeselect() const;
 	/*virtual*/ void		deselect();
 
 	// used by LLTextSegment layout code
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 7d230f7d42..0f943831eb 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -240,7 +240,6 @@ LLTextEditor::Params::Params()
 	prevalidate_callback("prevalidate_callback"),
 	embedded_items("embedded_items", false),
 	ignore_tab("ignore_tab", true),
-	handle_edit_keys_directly("handle_edit_keys_directly", false),
 	show_line_numbers("show_line_numbers", false),
 	default_color("default_color"),
     commit_on_focus_lost("commit_on_focus_lost", false),
@@ -258,7 +257,6 @@ LLTextEditor::LLTextEditor(const LLTextEditor::Params& p) :
 	mShowLineNumbers ( p.show_line_numbers ),
 	mCommitOnFocusLost( p.commit_on_focus_lost),
 	mAllowEmbeddedItems( p.embedded_items ),
-	mHandleEditKeysDirectly( p.handle_edit_keys_directly ),
 	mMouseDownX(0),
 	mMouseDownY(0),
 	mTabsToNextField(p.ignore_tab),
@@ -507,21 +505,6 @@ void LLTextEditor::getSegmentsInRange(LLTextEditor::segment_vec_t& segments_out,
 	}
 }
 
-// virtual
-BOOL LLTextEditor::canDeselect() const
-{
-	return hasSelection(); 
-}
-
-
-void LLTextEditor::deselect()
-{
-	mSelectionStart = 0;
-	mSelectionEnd = 0;
-	mIsSelecting = FALSE;
-}
-
-
 BOOL LLTextEditor::selectionContainsLineBreaks()
 {
 	if (hasSelection())
@@ -668,6 +651,7 @@ void LLTextEditor::selectAll()
 	mSelectionStart = getLength();
 	mSelectionEnd = 0;
 	setCursorPos(mSelectionEnd);
+	updatePrimary();
 }
 
 BOOL LLTextEditor::handleMouseDown(S32 x, S32 y, MASK mask)
@@ -1025,7 +1009,7 @@ void LLTextEditor::removeCharOrTab()
 	}
 	else
 	{
-		reportBadKeystroke();
+		LLUI::reportBadKeystroke();
 	}
 }
 
@@ -1048,7 +1032,7 @@ void LLTextEditor::removeChar()
 	}
 	else
 	{
-		reportBadKeystroke();
+		LLUI::reportBadKeystroke();
 	}
 }
 
@@ -1198,22 +1182,6 @@ BOOL LLTextEditor::handleSelectionKey(const KEY key, const MASK mask)
 		}
 	}
 
-	if( !handled && mHandleEditKeysDirectly )
-	{
-		if( (MASK_CONTROL & mask) && ('A' == key) )
-		{
-			if( canSelectAll() )
-			{
-				selectAll();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-	}
-
 	if( handled )
 	{
 		// take selection to 'primary' clipboard
@@ -1247,6 +1215,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 
 		case KEY_DOWN:
 			changeLine( 1 );
+			deselect();
 			break;
 
 		case KEY_PAGE_DOWN:
@@ -1260,7 +1229,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 		case KEY_LEFT:
 			if( hasSelection() )
 			{
-				setCursorPos(llmin( mCursorPos - 1, mSelectionStart, mSelectionEnd ));
+				setCursorPos(llmin( mSelectionStart, mSelectionEnd ));
 			}
 			else
 			{
@@ -1270,7 +1239,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 				}
 				else
 				{
-					reportBadKeystroke();
+					LLUI::reportBadKeystroke();
 				}
 			}
 			break;
@@ -1278,7 +1247,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 		case KEY_RIGHT:
 			if( hasSelection() )
 			{
-				setCursorPos(llmax( mCursorPos + 1, mSelectionStart, mSelectionEnd ));
+				setCursorPos(llmax( mSelectionStart, mSelectionEnd ));
 			}
 			else
 			{
@@ -1288,7 +1257,7 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 				}
 				else
 				{
-					reportBadKeystroke();
+					LLUI::reportBadKeystroke();
 				}
 			}	
 			break;
@@ -1298,6 +1267,11 @@ BOOL LLTextEditor::handleNavigationKey(const KEY key, const MASK mask)
 			break;
 		}
 	}
+
+	if (handled)
+	{
+		deselect();
+	}
 	
 	return handled;
 }
@@ -1551,75 +1525,13 @@ BOOL LLTextEditor::handleControlKey(const KEY key, const MASK mask)
 	return handled;
 }
 
-BOOL LLTextEditor::handleEditKey(const KEY key, const MASK mask)
-{
-	BOOL handled = FALSE;
-
-	// Standard edit keys (Ctrl-X, Delete, etc,) are handled here instead of routed by the menu system.
-	if( KEY_DELETE == key )
-	{
-		if( canDoDelete() )
-		{
-			doDelete();
-		}
-		else
-		{
-			reportBadKeystroke();
-		}
-		handled = TRUE;
-	}
-	else
-	if( MASK_CONTROL & mask )
-	{
-		if( 'C' == key )
-		{
-			if( canCopy() )
-			{
-				copy();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-		else
-		if( 'V' == key )
-		{
-			if( canPaste() )
-			{
-				paste();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-		else
-		if( 'X' == key )
-		{
-			if( canCut() )
-			{
-				cut();
-			}
-			else
-			{
-				reportBadKeystroke();
-			}
-			handled = TRUE;
-		}
-	}
-
-	return handled;
-}
 
-	
-BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit)	
+BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask)	
 {
-	*return_key_hit = FALSE;
 	BOOL handled = TRUE;
 
+	if (mReadOnly) return FALSE;
+
 	switch( key )
 	{
 	case KEY_INSERT:
@@ -1641,7 +1553,7 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
 		}
 		else
 		{
-			reportBadKeystroke();
+			LLUI::reportBadKeystroke();
 		}
 		break;
 
@@ -1694,6 +1606,10 @@ BOOL LLTextEditor::handleSpecialKey(const KEY key, const MASK mask, BOOL* return
 		break;
 	}
 
+	if (handled)
+	{
+		onKeyStroke();
+	}
 	return handled;
 }
 
@@ -1714,9 +1630,6 @@ void LLTextEditor::unindentLineBeforeCloseBrace()
 BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
 {
 	BOOL	handled = FALSE;
-	BOOL	selection_modified = FALSE;
-	BOOL	return_key_hit = FALSE;
-	BOOL	text_may_have_changed = TRUE;
 
 	// Special case for TAB.  If want to move to next field, report
 	// not handled and let the parent take care of field movement.
@@ -1724,116 +1637,24 @@ BOOL LLTextEditor::handleKeyHere(KEY key, MASK mask )
 	{
 		return FALSE;
 	}
-	/*
-	if (KEY_F10 == key)
-	{
-		LLComboBox::Params cp;
-		cp.name = "combo box";
-		cp.label = "my combo";
-		cp.rect.width = 100;
-		cp.rect.height = 20;
-		cp.items.add().label = "item 1";
-		cp.items.add().label = "item 2";
-		cp.items.add().label = "item 3";
-		
-		appendWidget(LLUICtrlFactory::create<LLComboBox>(cp), "combo", true, false);
-	}
-	if (KEY_F11 == key)
-	{
-		LLButton::Params bp;
-		bp.name = "text button";
-		bp.label = "Click me";
-		bp.rect.width = 100;
-		bp.rect.height = 20;
 
-		appendWidget(LLUICtrlFactory::create<LLButton>(bp), "button", true, false);
-	}
-	*/
-	if (mReadOnly)
+	if (mReadOnly && mScroller)
 	{
-		if(mScroller)
-		{
-			handled = mScroller->handleKeyHere( key, mask );
-		}
-		else 
-		{
-			handled = handleNavigationKey( key, mask );
-		}
-
+		handled = (mScroller && mScroller->handleKeyHere( key, mask ))
+				|| handleSelectionKey(key, mask)
+				|| handleControlKey(key, mask);
 	}
 	else
 	{
-		// handle navigation keys ourself
-		handled = handleNavigationKey( key, mask );
-	}
-
-
-	if( handled )
-	{
-		text_may_have_changed = FALSE;
-	}
-		
-	if( !handled )
-	{
-		handled = handleSelectionKey( key, mask );
-		if( handled )
-		{
-			selection_modified = TRUE;
-		}
-	}
-
-	if( !handled )
-	{
-		handled = handleControlKey( key, mask );
-		if( handled )
-		{
-			selection_modified = TRUE;
-		}
-	}
-
-	if( !handled && mHandleEditKeysDirectly )
-	{
-		handled = handleEditKey( key, mask );
-		if( handled )
-		{
-			selection_modified = TRUE;
-			text_may_have_changed = TRUE;
-		}
-	}
-
-	// Handle most keys only if the text editor is writeable.
-	if( !mReadOnly )
-	{
-		if( !handled )
-		{
-			handled = handleSpecialKey( key, mask, &return_key_hit );
-			if( handled )
-			{
-				selection_modified = TRUE;
-				text_may_have_changed = TRUE;
-			}
-		}
-
+		handled = handleNavigationKey( key, mask )
+				|| handleSelectionKey(key, mask)
+				|| handleControlKey(key, mask)
+				|| handleSpecialKey(key, mask);
 	}
 
 	if( handled )
 	{
 		resetCursorBlink();
-
-		// Most keystrokes will make the selection box go away, but not all will.
-		if( !selection_modified &&
-			KEY_SHIFT != key &&
-			KEY_CONTROL != key &&
-			KEY_ALT != key &&
-			KEY_CAPSLOCK )
-		{
-			deselect();
-		}
-
-		if(text_may_have_changed)
-		{
-			onKeyStroke();
-		}
 		needsScroll();
 	}
 
diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h
index 71d937b2c4..9b3ab9414c 100644
--- a/indra/llui/lltexteditor.h
+++ b/indra/llui/lltexteditor.h
@@ -68,7 +68,6 @@ public:
 
 		Optional<bool>			embedded_items,
 								ignore_tab,
-								handle_edit_keys_directly,
 								show_line_numbers,
 								commit_on_focus_lost,
 								show_context_menu;
@@ -146,8 +145,6 @@ public:
 	virtual BOOL	canDoDelete() const;
 	virtual void	selectAll();
 	virtual BOOL	canSelectAll()	const;
-	virtual void	deselect();
-	virtual BOOL	canDeselect() const;
 
 	void			selectNext(const std::string& search_text_in, BOOL case_insensitive, BOOL wrap = TRUE);
 	BOOL			replaceText(const std::string& search_text, const std::string& replace_text, BOOL case_insensitive, BOOL wrap = TRUE);
@@ -218,13 +215,10 @@ protected:
 	S32				indentLine( S32 pos, S32 spaces );
 	void			unindentLineBeforeCloseBrace();
 
-	void			reportBadKeystroke() { make_ui_sound("UISndBadKeystroke"); }
-
 	BOOL			handleNavigationKey(const KEY key, const MASK mask);
-	BOOL			handleSpecialKey(const KEY key, const MASK mask, BOOL* return_key_hit);
+	BOOL			handleSpecialKey(const KEY key, const MASK mask);
 	BOOL			handleSelectionKey(const KEY key, const MASK mask);
 	BOOL			handleControlKey(const KEY key, const MASK mask);
-	BOOL			handleEditKey(const KEY key, const MASK mask);
 
 	BOOL			selectionContainsLineBreaks();
 	void			deleteSelection(BOOL transient_operation);
@@ -329,10 +323,6 @@ private:
 
 	LLUUID			mSourceID;
 
-	// If true, the standard edit keys (Ctrl-X, Delete, etc,) are handled here 
-	//instead of routed by the menu system
-	BOOL			mHandleEditKeysDirectly;  
-
 	LLCoordGL		mLastIMEPosition;		// Last position of the IME editor
 
 	keystroke_signal_t mKeystrokeSignal;
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index b049895526..f9a4ed7285 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -1914,7 +1914,12 @@ void LLUI::clearPopups()
 	}
 }
 
-
+//static
+void LLUI::reportBadKeystroke()
+{
+	make_ui_sound("UISndBadKeystroke");
+}
+	
 //static
 // spawn_x and spawn_y are top left corner of view in screen GL coordinates
 void LLUI::positionViewNearMouse(LLView* view, S32 spawn_x, S32 spawn_y)
diff --git a/indra/llui/llui.h b/indra/llui/llui.h
index 30f3623ded..c18262ef76 100644
--- a/indra/llui/llui.h
+++ b/indra/llui/llui.h
@@ -217,6 +217,8 @@ public:
 	static void removePopup(LLView*);
 	static void clearPopups();
 
+	static void reportBadKeystroke();
+
 	// Ensures view does not overlap mouse cursor, but is inside
 	// the view's parent rectangle.  Used for tooltips, inspectors.
 	// Optionally override the view's default X/Y, which are relative to the
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index d726c60018..95c1980dd6 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2999,79 +2999,6 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
 	sei.lpVerb = L"open";
 	sei.lpFile = url_utf16.c_str();
 	ShellExecuteEx( &sei );
-
-	//// TODO: LEAVING OLD CODE HERE SO I DON'T BONE OTHER MERGES
-	//// DELETE THIS ONCE THE MERGES ARE DONE
-
-	// Figure out the user's default web browser
-	// HKEY_CLASSES_ROOT\http\shell\open\command
-	/*
-	std::string reg_path_str = gURLProtocolWhitelistHandler[i] + "\\shell\\open\\command";
-	WCHAR reg_path_wstr[256];
-	mbstowcs( reg_path_wstr, reg_path_str.c_str(), LL_ARRAY_SIZE(reg_path_wstr) );
-
-	HKEY key;
-	WCHAR browser_open_wstr[1024];
-	DWORD buffer_length = 1024;
-	RegOpenKeyEx(HKEY_CLASSES_ROOT, reg_path_wstr, 0, KEY_QUERY_VALUE, &key);
-	RegQueryValueEx(key, NULL, NULL, NULL, (LPBYTE)browser_open_wstr, &buffer_length);
-	RegCloseKey(key);
-
-	// Convert to STL string
-	LLWString browser_open_wstring = utf16str_to_wstring(browser_open_wstr);
-
-	if (browser_open_wstring.length() < 2)
-	{
-		LL_WARNS("Window") << "Invalid browser executable in registry " << browser_open_wstring << LL_ENDL;
-		return;
-	}
-
-	// Extract the process that's supposed to be launched
-	LLWString browser_executable;
-	if (browser_open_wstring[0] == '"')
-	{
-		// executable is quoted, find the matching quote
-		size_t quote_pos = browser_open_wstring.find('"', 1);
-		// copy out the string including both quotes
-		browser_executable = browser_open_wstring.substr(0, quote_pos+1);
-	}
-	else
-	{
-		// executable not quoted, find a space
-		size_t space_pos = browser_open_wstring.find(' ', 1);
-		browser_executable = browser_open_wstring.substr(0, space_pos);
-	}
-
-	LL_DEBUGS("Window") << "Browser reg key: " << wstring_to_utf8str(browser_open_wstring) << LL_ENDL;
-	LL_INFOS("Window") << "Browser executable: " << wstring_to_utf8str(browser_executable) << LL_ENDL;
-
-	// Convert URL to wide string for Windows API
-	// Assume URL is UTF8, as can come from scripts
-	LLWString url_wstring = utf8str_to_wstring(escaped_url);
-	llutf16string url_utf16 = wstring_to_utf16str(url_wstring);
-
-	// Convert executable and path to wide string for Windows API
-	llutf16string browser_exec_utf16 = wstring_to_utf16str(browser_executable);
-
-	// ShellExecute returns HINSTANCE for backwards compatiblity.
-	// MS docs say to cast to int and compare to 32.
-	HWND our_window = NULL;
-	LPCWSTR directory_wstr = NULL;
-	int retval = (int) ShellExecute(our_window, 	// Flawfinder: ignore
-									L"open", 
-									browser_exec_utf16.c_str(), 
-									url_utf16.c_str(), 
-									directory_wstr,
-									SW_SHOWNORMAL);
-	if (retval > 32)
-	{
-		LL_DEBUGS("Window") << "load_url success with " << retval << LL_ENDL;
-	}
-	else
-	{
-		LL_INFOS("Window") << "load_url failure with " << retval << LL_ENDL;
-	}
-	*/
 }
 
 /*
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index ba50287ebd..ad2e594b49 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -227,7 +227,6 @@ LLLocationInputCtrl::LLLocationInputCtrl(const LLLocationInputCtrl::Params& p)
 	params.default_text(LLStringUtil::null);
 	params.max_length_bytes(p.max_chars);
 	params.keystroke_callback(boost::bind(&LLComboBox::onTextEntry, this, _1));
-	params.handle_edit_keys_directly(true);
 	params.commit_on_focus_lost(false);
 	params.follows.flags(FOLLOWS_ALL);
 	mTextEntry = LLUICtrlFactory::create<LLURLLineEditor>(params);
diff --git a/indra/newview/lltoastalertpanel.cpp b/indra/newview/lltoastalertpanel.cpp
index c3ccb9380b..986ccdf19b 100644
--- a/indra/newview/lltoastalertpanel.cpp
+++ b/indra/newview/lltoastalertpanel.cpp
@@ -281,9 +281,6 @@ LLToastAlertPanel::LLToastAlertPanel( LLNotificationPtr notification, bool modal
 			mLineEditor->setText(edit_text_contents);
 			mLineEditor->setMaxTextLength(STD_STRING_STR_LEN - 1);
 
-			// make sure all edit keys get handled properly (DEV-22396)
-			mLineEditor->setHandleEditKeysDirectly(TRUE);
-
 			LLToastPanel::addChild(mLineEditor);
 
 			mLineEditor->setDrawAsterixes(is_password);
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 258c3ddd75..1d2687a8c2 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -72,7 +72,7 @@ void LLURLLineEditor::cut()
 		if( need_to_rollback )
 		{
 			rollback.doRollback( this );
-			reportBadKeystroke();
+			LLUI::reportBadKeystroke();
 		}
 		else
 		if( mKeystrokeCallback )
@@ -96,8 +96,3 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 		
 	gClipboard.copyFromString( text_to_copy );
 }
-// Makes UISndBadKeystroke sound
-void LLURLLineEditor::reportBadKeystroke()
-{
-	make_ui_sound("UISndBadKeystroke");
-}
diff --git a/indra/newview/llurllineeditorctrl.h b/indra/newview/llurllineeditorctrl.h
index 618f29dfbf..ebe417e855 100644
--- a/indra/newview/llurllineeditorctrl.h
+++ b/indra/newview/llurllineeditorctrl.h
@@ -55,8 +55,6 @@ protected:
 private:
 	// util function to escape selected text and copy it to clipboard
 	void 			copyEscapedURLToClipboard();
-	// send a beep signal if keystroke is bad. As it is private at LLLineEditor we need own function
-	void			reportBadKeystroke();
 
 	// Helper class to do rollback if needed
 	class LLURLLineEditorRollback
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 23349ab916..b2b7e653e4 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -74,6 +74,7 @@
 #include "llnavigationbar.h"
 #include "llfloatertools.h"
 #include "llpaneloutfitsinventory.h"
+#include "llpanellogin.h"
 
 #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
 BOOL 				gHackGodmode = FALSE;
@@ -443,6 +444,12 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
 	return true;
 }
 
+bool handleForceShowGrid(const LLSD& newvalue)
+{
+	LLPanelLogin::refreshLocation( false );
+	return true;
+}
+
 bool toggle_agent_pause(const LLSD& newvalue)
 {
 	if ( newvalue.asBoolean() )
@@ -648,6 +655,7 @@ void settings_setup_listeners()
 	gSavedSettings.getControl("ShowNavbarFavoritesPanel")->getSignal()->connect(boost::bind(&toggle_show_favorites_panel, _2));
 	gSavedSettings.getControl("ShowDebugAppearanceEditor")->getSignal()->connect(boost::bind(&toggle_show_appearance_editor, _2));
 	gSavedSettings.getControl("ShowObjectRenderingCost")->getSignal()->connect(boost::bind(&toggle_show_object_render_cost, _2));
+	gSavedSettings.getControl("ForceShowGrid")->getSignal()->connect(boost::bind(&handleForceShowGrid, _2));
 }
 
 #if TEST_CACHED_CONTROL
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 3a6aed01ce..eae60b4d85 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -136,6 +136,7 @@ extern BOOL gDebugWindowProc;
 LLMenuBarGL		*gMenuBarView = NULL;
 LLViewerMenuHolderGL	*gMenuHolder = NULL;
 LLMenuGL		*gPopupMenuView = NULL;
+LLMenuGL		*gEditMenu = NULL;
 LLMenuBarGL		*gLoginMenuBarView = NULL;
 
 // Pie menus
@@ -383,8 +384,10 @@ void init_menus()
 	///
 	/// Context menus
 	///
+
 	const widget_registry_t& registry =
 		LLViewerMenuHolderGL::child_registry_t::instance();
+	gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
 	gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
 		"menu_avatar_self.xml", gMenuHolder, registry);
 	gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
@@ -5182,10 +5185,6 @@ void toggle_debug_menus(void*)
 {
 	BOOL visible = ! gSavedSettings.getBOOL("UseDebugMenus");
 	gSavedSettings.setBOOL("UseDebugMenus", visible);
-	if(visible)
-	{
-		//LLFirstUse::useDebugMenus();
-	}
 	show_debug_menus();
 }
 
diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h
index d3c34f0de4..d72ea00077 100644
--- a/indra/newview/llviewermenu.h
+++ b/indra/newview/llviewermenu.h
@@ -157,6 +157,7 @@ extern const std::string SAVE_INTO_INVENTORY;
 
 extern LLMenuBarGL*		gMenuBarView;
 //extern LLView*			gMenuBarHolder;
+extern LLMenuGL*		gEditMenu;
 extern LLMenuGL*		gPopupMenuView;
 extern LLViewerMenuHolderGL*	gMenuHolder;
 extern LLMenuBarGL*		gLoginMenuBarView;
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 85c961f34a..6fb1a054ed 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -2145,12 +2145,14 @@ void LLViewerWindow::draw()
 // Takes a single keydown event, usually when UI is visible
 BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 {
+	// hide tooltips on keypress
+	LLToolTipMgr::instance().blockToolTips();
+
 	if (gFocusMgr.getKeyboardFocus() 
 		&& !(mask & (MASK_CONTROL | MASK_ALT))
 		&& !gFocusMgr.getKeystrokesOnly())
 	{
 		// We have keyboard focus, and it's not an accelerator
-
 		if (key < 0x80)
 		{
 			// Not a special key, so likely (we hope) to generate a character.  Let it fall through to character handler first.
@@ -2158,68 +2160,49 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		}
 	}
 
-	// hide tooltips on keypress
-	LLToolTipMgr::instance().blockToolTips();
-	
-	// Explicit hack for debug menu.
-	if ((MASK_ALT & mask) &&
-		(MASK_CONTROL & mask) &&
-		('D' == key || 'd' == key))
+	// let menus handle navigation keys for navigation
+	if ((gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
+		||(gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
+		||(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE)))
 	{
-		toggle_debug_menus(NULL);
+		return TRUE;
 	}
 
-		// Explicit hack for debug menu.
-	if ((mask == (MASK_SHIFT | MASK_CONTROL)) &&
-		('G' == key || 'g' == key))
+	// give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus 
+	// as long as focus isn't locked
+	if (mask & (MASK_CONTROL | MASK_ALT) && !gFocusMgr.focusLocked())
 	{
-		if  (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page
+		if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
+			||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
 		{
-			BOOL visible = ! gSavedSettings.getBOOL("ForceShowGrid");
-			gSavedSettings.setBOOL("ForceShowGrid", visible);
-
-			// Initialize visibility (and don't force visibility - use prefs)
-			LLPanelLogin::refreshLocation( false );
+			return TRUE;
 		}
 	}
 
-	// Debugging view for unified notifications: CTRL-SHIFT-5
-	// *FIXME: Having this special-cased right here (just so this can be invoked from the login screen) sucks.
-	if ((MASK_SHIFT & mask) 
-	    && (!(MASK_ALT & mask))
-	    && (MASK_CONTROL & mask)
-	    && ('5' == key))
+	// give floaters first chance to handle TAB key
+	// so frontmost floater gets focus
+	// if nothing has focus, go to first or last UI element as appropriate
+	if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL))
 	{
-		//LLFloaterNotificationConsole::showInstance();
-		LLFloaterReg::showInstance("notifications_console");
-		return TRUE;
-	}
+		if (gMenuHolder) gMenuHolder->hideMenus();
 
-	// handle escape key
-	//if (key == KEY_ESCAPE && mask == MASK_NONE)
-	//{
+		// if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
+		gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
 
-		// *TODO: get this to play well with mouselook and hidden
-		// cursor modes, etc, and re-enable.
-		//if (gFocusMgr.getMouseCapture())
-		//{
-		//	gFocusMgr.setMouseCapture(NULL);
-		//	return TRUE;
-		//}
-	//}
-
-	// let menus handle navigation keys
-	if (gMenuBarView && gMenuBarView->handleKey(key, mask, TRUE))
-	{
-		return TRUE;
-	}
-	// let menus handle navigation keys
-	if (gLoginMenuBarView && gLoginMenuBarView->handleKey(key, mask, TRUE))
-	{
+		// do CTRL-TAB and CTRL-SHIFT-TAB logic
+		if (mask & MASK_SHIFT)
+		{
+			mRootView->focusPrevRoot();
+		}
+		else
+		{
+			mRootView->focusNextRoot();
+		}
 		return TRUE;
 	}
-	//some of context menus use this container, let context menu handle navigation keys
-	if(gMenuHolder && gMenuHolder->handleKey(key, mask, TRUE))
+
+	// hidden edit menu for cut/copy/paste
+	if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
 	{
 		return TRUE;
 	}
@@ -2284,50 +2267,10 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		return TRUE;
 	}
 
-	// Topmost view gets a chance before the hierarchy
-	// *FIX: get rid of this?
-	//LLUICtrl* top_ctrl = gFocusMgr.getTopCtrl();
-	//if (top_ctrl)
-	//{
-	//	if( top_ctrl->handleKey( key, mask, TRUE ) )
-	//	{
-	//		return TRUE;
-	//	}
-	//}
-
-	// give floaters first chance to handle TAB key
-	// so frontmost floater gets focus
-	if (key == KEY_TAB)
-	{
-		// if nothing has focus, go to first or last UI element as appropriate
-		if (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL)
-		{
-			if (gMenuHolder) gMenuHolder->hideMenus();
-
-			// if CTRL-tabbing (and not just TAB with no focus), go into window cycle mode
-			gFloaterView->setCycleMode((mask & MASK_CONTROL) != 0);
 
-			// do CTRL-TAB and CTRL-SHIFT-TAB logic
-			if (mask & MASK_SHIFT)
-			{
-				mRootView->focusPrevRoot();
-			}
-			else
-			{
-				mRootView->focusNextRoot();
-			}
-			return TRUE;
-		}
-	}
-	
-	// give menus a chance to handle keys
-	if (gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
-	{
-		return TRUE;
-	}
-	
-	// give menus a chance to handle keys
-	if (gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask))
+	// give menus a chance to handle unmodified accelerator keys
+	if ((gMenuBarView && gMenuBarView->handleAcceleratorKey(key, mask))
+		||(gLoginMenuBarView && gLoginMenuBarView->handleAcceleratorKey(key, mask)))
 	{
 		return TRUE;
 	}
-- 
cgit v1.2.3


From 406b595e8c6811c2550340ba316328289d8b856f Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 11:51:06 -0700
Subject: fixed build

---
 indra/llui/llnotifications.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llnotifications.h b/indra/llui/llnotifications.h
index 707a84bdfe..1799ca65b7 100644
--- a/indra/llui/llnotifications.h
+++ b/indra/llui/llnotifications.h
@@ -994,7 +994,7 @@ private:
 
 protected:
 	LLPostponedNotification() {}
-	~LLPostponedNotification() {}
+	virtual ~LLPostponedNotification() {}
 
 	/**
 	 * Abstract method provides possibility to modify notification parameters and
-- 
cgit v1.2.3


From bb4c1384ac4113775cf69e2de521ad150733fa67 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Thu, 1 Apr 2010 12:05:17 -0700
Subject: EXT-3531 - Ctrl-P does not work reliably on login forgot
 menu_edit.xml

---
 indra/newview/skins/default/xui/en/menu_edit.xml | 89 ++++++++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 indra/newview/skins/default/xui/en/menu_edit.xml

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_edit.xml b/indra/newview/skins/default/xui/en/menu_edit.xml
new file mode 100644
index 0000000000..68f3cb532c
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_edit.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu create_jump_keys="true"
+      label="Edit"
+      name="Edit"
+      visible="false">
+  <menu_item_call
+   label="Undo"
+   name="Undo"
+   shortcut="control|Z">
+    <menu_item_call.on_click
+     function="Edit.Undo" />
+    <menu_item_call.on_enable
+     function="Edit.EnableUndo" />
+  </menu_item_call>
+  <menu_item_call
+   label="Redo"
+   name="Redo"
+   shortcut="control|Y">
+    <menu_item_call.on_click
+     function="Edit.Redo" />
+    <menu_item_call.on_enable
+     function="Edit.EnableRedo" />
+  </menu_item_call>
+  <menu_item_separator/>
+  <menu_item_call
+   label="Cut"
+   name="Cut"
+   shortcut="control|X">
+    <menu_item_call.on_click
+     function="Edit.Cut" />
+    <menu_item_call.on_enable
+     function="Edit.EnableCut" />
+  </menu_item_call>
+  <menu_item_call
+   label="Copy"
+   name="Copy"
+   shortcut="control|C">
+    <menu_item_call.on_click
+     function="Edit.Copy" />
+    <menu_item_call.on_enable
+     function="Edit.EnableCopy" />
+  </menu_item_call>
+  <menu_item_call
+   label="Paste"
+   name="Paste"
+   shortcut="control|V">
+    <menu_item_call.on_click
+     function="Edit.Paste" />
+    <menu_item_call.on_enable
+     function="Edit.EnablePaste" />
+  </menu_item_call>
+  <menu_item_call
+   label="Delete"
+   name="Delete"
+   shortcut="Del">
+    <menu_item_call.on_click
+     function="Edit.Delete" />
+    <menu_item_call.on_enable
+     function="Edit.EnableDelete" />
+  </menu_item_call>
+  <menu_item_call
+   label="Duplicate"
+   name="Duplicate"
+   shortcut="control|D">
+    <menu_item_call.on_click
+     function="Edit.Duplicate" />
+    <menu_item_call.on_enable
+     function="Edit.EnableDuplicate" />
+  </menu_item_call>
+  <menu_item_separator/>
+  <menu_item_call
+   label="Select All"
+   name="Select All"
+   shortcut="control|A">
+    <menu_item_call.on_click
+     function="Edit.SelectAll" />
+    <menu_item_call.on_enable
+     function="Edit.EnableSelectAll" />
+  </menu_item_call>
+  <menu_item_call
+   label="Deselect"
+   name="Deselect"
+   shortcut="control|E">
+    <menu_item_call.on_click
+     function="Edit.Deselect" />
+    <menu_item_call.on_enable
+     function="Edit.EnableDeselect" />
+  </menu_item_call>
+</menu>
\ No newline at end of file
-- 
cgit v1.2.3


From e254aa6dc6dcd3ba7369de5231dec16a570701a8 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Thu, 1 Apr 2010 12:06:16 -0700
Subject: EXT-3531 - Ctrl-P does not work reliably on login deprecated
 handle_edit_keys_directly and moved edit menu out of menu_viewer and
 menu_login

---
 .../skins/default/xui/en/alert_line_editor.xml     |   1 -
 .../skins/default/xui/en/floater_about_land.xml    |   1 -
 .../skins/default/xui/en/floater_buy_land.xml      |   1 -
 .../default/xui/en/floater_outfit_save_as.xml      |   1 -
 .../default/xui/en/floater_preview_notecard.xml    |   1 -
 .../skins/default/xui/en/floater_ui_preview.xml    |   3 -
 .../default/xui/en/floater_wearable_save_as.xml    |   1 -
 indra/newview/skins/default/xui/en/menu_login.xml  | 135 ++---
 indra/newview/skins/default/xui/en/menu_viewer.xml | 582 ++-------------------
 indra/newview/skins/default/xui/en/panel_login.xml |   3 -
 .../skins/default/xui/en/panel_place_profile.xml   |   1 -
 .../default/xui/en/panel_preferences_setup.xml     |   1 -
 .../skins/default/xui/en/panel_region_covenant.xml |   1 -
 .../skins/default/xui/en/panel_script_ed.xml       |   1 -
 .../skins/default/xui/en/widgets/line_editor.xml   |   1 -
 15 files changed, 87 insertions(+), 647 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/alert_line_editor.xml b/indra/newview/skins/default/xui/en/alert_line_editor.xml
index 97991153d8..82bf5fc8da 100644
--- a/indra/newview/skins/default/xui/en/alert_line_editor.xml
+++ b/indra/newview/skins/default/xui/en/alert_line_editor.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <line_editor
   select_on_focus="false"
-  handle_edit_keys_directly="false"
   revert_on_esc="true"
   commit_on_focus_lost="true"
   ignore_tab="true"
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 51bd7a0a16..59f1889808 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -636,7 +636,6 @@ Leyla Linden               </text>
              length="1"
              enabled="false"
              follows="all"
-             handle_edit_keys_directly="true"
              height="200"
              layout="topleft"
              left="10"
diff --git a/indra/newview/skins/default/xui/en/floater_buy_land.xml b/indra/newview/skins/default/xui/en/floater_buy_land.xml
index 125b080519..df44b61632 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_land.xml
@@ -356,7 +356,6 @@ supports [AMOUNT2] objects
      length="1"
      enabled="false"
      follows="top|right"
-     handle_edit_keys_directly="false" 
      height="237"
      layout="topleft"
      left="444"
diff --git a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
index a2938e8574..1d73d516d0 100644
--- a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
+++ b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
@@ -45,7 +45,6 @@ as a new Outfit:
      border_style="line"
      border_thickness="1"
      follows="left|top"
-     handle_edit_keys_directly="true"
      height="23"
      layout="topleft"
      left_delta="0"
diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
index e9099211a3..14c0081c0d 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
@@ -72,7 +72,6 @@
      max_length="65536"
      name="Notecard Editor"
      allow_html="false" 
-     handle_edit_keys_directly="true"
      tab_group="1"
      top="46"
      width="392"
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 3a981adfdf..3b10a57c50 100644
--- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
@@ -238,7 +238,6 @@
              border_thickness="1"
              follows="left|bottom"
              font="SansSerif"
-             handle_edit_keys_directly="true"
              height="20"
              layout="topleft"
              left_delta="100"
@@ -278,7 +277,6 @@
              border_thickness="1"
              follows="left|bottom"
              font="SansSerif"
-             handle_edit_keys_directly="true"
              height="20"
              layout="topleft"
              left_delta="100"
@@ -320,7 +318,6 @@
              border_thickness="1"
              follows="left|bottom"
              font="SansSerif"
-             handle_edit_keys_directly="true"
              height="20"
              layout="topleft"
              left_delta="65"
diff --git a/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml b/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml
index b4b57f2dbc..71812bd1a6 100644
--- a/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml
+++ b/indra/newview/skins/default/xui/en/floater_wearable_save_as.xml
@@ -44,7 +44,6 @@
      border_style="line"
      border_thickness="1"
      follows="left|top"
-     handle_edit_keys_directly="true"
      height="23"
      layout="topleft"
      left_delta="0"
diff --git a/indra/newview/skins/default/xui/en/menu_login.xml b/indra/newview/skins/default/xui/en/menu_login.xml
index ba74104594..4655fa8c46 100644
--- a/indra/newview/skins/default/xui/en/menu_login.xml
+++ b/indra/newview/skins/default/xui/en/menu_login.xml
@@ -29,14 +29,6 @@
              function="File.Quit" />
         </menu_item_call>
     </menu>
-<!-- Edit menu merged into the Me menu above
-    <menu
-     create_jump_keys="true"
-     label="Edit"
-     name="Edit"
-     width="153">
-    </menu>
--->
     <menu
      create_jump_keys="true"
      label="Help"
@@ -59,105 +51,24 @@
              parameter="sl_about" />
         </menu_item_call>
     </menu>
+    <menu_item_check
+      label="Show Debug Menu"
+      name="Show Debug Menu"
+      visible="false" 
+      shortcut="control|alt|D">
+      <on_check
+       function="CheckControl"
+       parameter="UseDebugMenus" />
+      <on_click
+       function="ToggleControl"
+       parameter="UseDebugMenus" />
+    </menu_item_check>
     <menu
       visible="false"
      create_jump_keys="true"
      label="Debug"
      name="Debug"
      tear_off="true">
-      <!-- Need a copy of the edit menu here so keyboard shortcuts like
-           control-C work to copy text at login screen and About dialog (for QA)
-      -->
-      <menu
-       create_jump_keys="true"
-       label="Edit"
-       name="Edit"
-       tear_off="true">
-        <menu_item_call
-         label="Undo"
-         name="Undo"
-         shortcut="control|Z">
-          <menu_item_call.on_click
-           function="Edit.Undo" />
-          <menu_item_call.on_enable
-           function="Edit.EnableUndo" />
-        </menu_item_call>
-        <menu_item_call
-         label="Redo"
-         name="Redo"
-         shortcut="control|Y">
-          <menu_item_call.on_click
-           function="Edit.Redo" />
-          <menu_item_call.on_enable
-           function="Edit.EnableRedo" />
-        </menu_item_call>
-        <menu_item_separator />
-        <menu_item_call
-         label="Cut"
-         name="Cut"
-         shortcut="control|X">
-          <menu_item_call.on_click
-           function="Edit.Cut" />
-          <menu_item_call.on_enable
-           function="Edit.EnableCut" />
-        </menu_item_call>
-        <menu_item_call
-         label="Copy"
-         name="Copy"
-         shortcut="control|C">
-          <menu_item_call.on_click
-           function="Edit.Copy" />
-          <menu_item_call.on_enable
-           function="Edit.EnableCopy" />
-        </menu_item_call>
-        <menu_item_call
-         label="Paste"
-         name="Paste"
-         shortcut="control|V">
-          <menu_item_call.on_click
-           function="Edit.Paste" />
-          <menu_item_call.on_enable
-           function="Edit.EnablePaste" />
-        </menu_item_call>
-        <menu_item_call
-         label="Delete"
-         name="Delete"
-         shortcut="Del">
-          <menu_item_call.on_click
-           function="Edit.Delete" />
-          <menu_item_call.on_enable
-           function="Edit.EnableDelete" />
-        </menu_item_call>
-        <menu_item_call
-         label="Duplicate"
-         name="Duplicate"
-         shortcut="control|D">
-          <menu_item_call.on_click
-           function="Edit.Duplicate" />
-          <menu_item_call.on_enable
-           function="Edit.EnableDuplicate" />
-        </menu_item_call>
-        <menu_item_separator />
-        <menu_item_call
-         label="Select All"
-         name="Select All"
-         shortcut="control|A">
-          <menu_item_call.on_click
-           function="Edit.SelectAll" />
-          <menu_item_call.on_enable
-           function="Edit.EnableSelectAll" />
-        </menu_item_call>
-        <menu_item_call
-         label="Deselect"
-         name="Deselect"
-         shortcut="control|E">
-          <menu_item_call.on_click
-           function="Edit.Deselect" />
-          <menu_item_call.on_enable
-           function="Edit.EnableDeselect" />
-        </menu_item_call>
-      </menu>
-      <menu_item_separator />
       <menu_item_call
          label="Show Debug Settings"
          name="Debug Settings">
@@ -270,5 +181,27 @@
            function="Advanced.WebBrowserTest"
            parameter="http://join.secondlife.com/"/>
         </menu_item_call>
+      <menu_item_separator/>
+      <menu_item_check
+        label="Show Grid Picker"
+        name="Show Grid Picker"
+        visible="false" 
+        shortcut="control|shift|G">
+        <on_check
+         function="CheckControl"
+         parameter="ForceShowGrid" />
+        <on_click
+         function="ToggleControl"
+         parameter="ForceShowGrid" />
+      </menu_item_check>
+      <menu_item_call
+        label="Show Notifications Console"
+        name="Show Notifications Console"
+        visible="false"
+        shortcut="control|shift|5">
+        <on_click
+         function="Floater.Toggle"
+         parameter="notifications_console" />
+      </menu_item_call>
     </menu>
 </menu_bar>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index a08bc16066..43f594ca5a 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2,16 +2,13 @@
 <menu_bar
  bg_visible="false"
  follows="left|top|right"
- layout="topleft"
  name="Main Menu">
     <menu
      label="Me"
-     layout="topleft"
      name="Me"
      tear_off="true">
         <menu_item_call
          label="Preferences"
-         layout="topleft"
          name="Preferences"
          shortcut="control|P">
             <menu_item_call.on_click
@@ -20,7 +17,6 @@
         </menu_item_call>
          <menu_item_call
              label="My Dashboard"
-             layout="topleft"
              name="Manage My Account">
                 <menu_item_call.on_click
                  function="PromptShowURL"
@@ -29,16 +25,13 @@
       </menu_item_call>
         <menu_item_call
          label="Buy L$"
-         layout="topleft"
          name="Buy and Sell L$">
             <menu_item_call.on_click
              function="BuyCurrency" />
         </menu_item_call>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
          label="My Profile"
-         layout="topleft"
          name="Profile">
             <menu_item_call.on_click
              function="ShowAgentProfile"
@@ -46,7 +39,6 @@
         </menu_item_call>
         <menu_item_call
          label="My Appearance"
-         layout="topleft"
          name="Appearance">
             <menu_item_call.on_click
              function="CustomizeAvatar" />
@@ -56,7 +48,6 @@
         <menu_item_check
          label="My Inventory"
          name="Inventory"
-         layout="topleft"
          shortcut="control|shift|I"
 		 visible="false">
             <menu_item_check.on_check
@@ -69,7 +60,6 @@
         <menu_item_check
          label="My Inventory"
          name="ShowSidetrayInventory"
-         layout="topleft"
          shortcut="control|I"
 		 visible="true">
             <menu_item_check.on_check
@@ -81,7 +71,6 @@
         </menu_item_check>
         <menu_item_check
          label="My Gestures"
-         layout="topleft"
          name="Gestures"
          shortcut="control|G">
             <menu_item_check.on_check
@@ -93,21 +82,17 @@
         </menu_item_check>
         <menu
          label="My Status"
-         layout="topleft"
          name="Status"
          tear_off="true">
             <menu_item_call
              label="Away"
-             layout="topleft"
              name="Set Away">
                 <menu_item_call.on_click
                  function="World.SetAway" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft"/>
+          <menu_item_separator/>
             <menu_item_call
              label="Busy"
-             layout="topleft"
              name="Set Busy">
                 <menu_item_call.on_click
                  function="World.SetBusy"/>
@@ -115,7 +100,6 @@
         </menu>
         <menu_item_call
          label="Request Admin Status"
-         layout="topleft"
          name="Request Admin Options"
          shortcut="control|alt|G"
 		 visible="false">
@@ -124,18 +108,15 @@
         </menu_item_call>
         <menu_item_call
          label="Leave Admin Status"
-         layout="topleft"
          name="Leave Admin Options"
          shortcut="control|alt|shift|G"
 		 visible="false">
             <menu_item_call.on_click
              function="Advanced.LeaveAdminStatus" />
         </menu_item_call>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
          label="Quit [APP_NAME]"
-         layout="topleft"
          name="Quit"
          shortcut="control|Q">
             <menu_item_call.on_click
@@ -144,12 +125,10 @@
     </menu>
     <menu
      label="Communicate"
-     layout="topleft"
      name="Communicate"
      tear_off="true">
         <menu_item_call
          label="My Friends"
-         layout="topleft"
          name="My Friends"
          shortcut="control|shift|F">
             <menu_item_call.on_click
@@ -158,24 +137,20 @@
             </menu_item_call>
         <menu_item_call
          label="My Groups"
-         layout="topleft"
          name="My Groups">
             <menu_item_call.on_click
              function="SideTray.PanelPeopleTab"
              parameter="groups_panel" />
         </menu_item_call>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <!--menu_item_call
          label="Chat"
-         layout="topleft"
          name="Chat">
             <menu_item_call.on_click
              function="World.Chat" />
         </menu_item_call-->
         <menu_item_check
          label="Nearby Chat"
-         layout="topleft"
          name="Nearby Chat"
          shortcut="control|H"
          use_mac_ctrl="true">
@@ -188,7 +163,6 @@
         </menu_item_check>
         <menu_item_call
          label="Nearby People"
-         layout="topleft"
          name="Active Speakers"
          shortcut="control|shift|A">
             <menu_item_call.on_click
@@ -198,12 +172,10 @@
     </menu>
     <menu
      label="World"
-     layout="topleft"
      name="World"
      tear_off="true">
             <menu_item_check
          label="Mini-Map"
-         layout="topleft"
          name="Mini-Map"
          shortcut="control|shift|M">
             <menu_item_check.on_check
@@ -215,7 +187,6 @@
         </menu_item_check>
          <menu_item_check
          label="World Map"
-         layout="topleft"
          name="World Map"
          shortcut="control|M"
          use_mac_ctrl="true">
@@ -228,7 +199,6 @@
         </menu_item_check>
         <menu_item_call
          label="Snapshot"
-         layout="topleft"
          name="Take Snapshot"
          shortcut="control|shift|S">
             <menu_item_call.on_click
@@ -237,7 +207,6 @@
         </menu_item_call>
       <menu_item_call
              label="Landmark This Place"
-             layout="topleft"
              name="Create Landmark Here">
                 <menu_item_call.on_click
                  function="World.CreateLandmark" />
@@ -247,12 +216,10 @@
       <menu
            create_jump_keys="true"
            label="Place Profile"
-           layout="topleft"
            name="Land"
            tear_off="true">
         <menu_item_call
          label="About Land"
-         layout="topleft"
          name="About Land">
             <menu_item_call.on_click
              function="Floater.Show"
@@ -260,18 +227,15 @@
         </menu_item_call>
         <menu_item_call
          label="Region/Estate"
-         layout="topleft"
          name="Region/Estate">
             <menu_item_call.on_click
              function="Floater.Show"
              parameter="region_info" />
         </menu_item_call>
         </menu>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
              label="Buy This Land"
-             layout="topleft"
              name="Buy Land">
                 <menu_item_call.on_click
                  function="Land.Buy" />
@@ -280,7 +244,6 @@
             </menu_item_call>
         <menu_item_call
              label="My Land"
-             layout="topleft"
              name="My Land">
                 <menu_item_call.on_click
                  function="Floater.Show"
@@ -289,12 +252,10 @@
         <menu
            create_jump_keys="true"
            label="Show"
-           layout="topleft"
            name="LandShow"
            tear_off="true">
          <menu_item_check
          label="Move Controls"
-         layout="topleft"
          name="Movement Controls">
             <menu_item_check.on_check
              function="Floater.Visible"
@@ -304,7 +265,6 @@
         </menu_item_check>
         <menu_item_check
          label="View Controls"
-         layout="topleft"
          name="Camera Controls">
             <menu_item_check.on_check
              function="Floater.Visible"
@@ -314,7 +274,6 @@
         </menu_item_check>
           <menu_item_check
              label="Ban Lines"
-             layout="topleft"
              name="Ban Lines">
             <menu_item_check.on_check
                control="ShowBanLines" />
@@ -324,7 +283,6 @@
           </menu_item_check>
            <menu_item_check
                  label="Beacons"
-                 layout="topleft"
                  name="beacons"
                  shortcut="control|alt|shift|N">
                     <menu_item_check.on_check
@@ -336,7 +294,6 @@
                 </menu_item_check>
           <menu_item_check
              label="Property Lines"
-             layout="topleft"
              name="Property Lines"
              shortcut="control|alt|shift|P">
             <menu_item_check.on_check
@@ -347,7 +304,6 @@
           </menu_item_check>
           <menu_item_check
              label="Land Owners"
-             layout="topleft"
              name="Land Owners">
             <menu_item_check.on_check
                control="ShowParcelOwners" />
@@ -374,11 +330,9 @@
                control="NavBarShowParcelProperties" />
           </menu_item_check>
         </menu>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
 	    <menu_item_call
 	     label="Teleport Home"
-	     layout="topleft"
 	     name="Teleport Home"
 	     shortcut="control|shift|H">
 		<menu_item_call.on_click
@@ -388,7 +342,6 @@
 	    </menu_item_call>
             <menu_item_call
              label="Set Home to Here"
-             layout="topleft"
              name="Set Home to Here">
                 <menu_item_call.on_click
                  function="World.SetHomeLocation" />
@@ -397,7 +350,6 @@
             </menu_item_call>
     <!--    <menu_item_check
          label="Show Navigation Bar"
-         layout="topleft"
          name="ShowNavbarNavigationPanel">
            <menu_item_check.on_click
              function="ToggleControl"
@@ -408,7 +360,6 @@
         </menu_item_check>
        <menu_item_check
          label="Show Favorites Bar"
-         layout="topleft"
          name="ShowNavbarFavoritesPanel">
            <menu_item_check.on_click
              function="ToggleControl"
@@ -417,19 +368,15 @@
              function="CheckControl"
              parameter="ShowNavbarFavoritesPanel" />
         </menu_item_check>
-        <menu_item_separator
-         layout="topleft" />-->
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
+        <menu_item_separator/>
     <menu
          create_jump_keys="true"
          label="Sun"
-         layout="topleft"
          name="Environment Settings"
          tear_off="true">
             <menu_item_call
              label="Sunrise"
-             layout="topleft"
              name="Sunrise">
                 <menu_item_call.on_click
                  function="World.EnvSettings"
@@ -437,7 +384,6 @@
             </menu_item_call>
             <menu_item_call
              label="Midday"
-             layout="topleft"
              name="Noon"
              shortcut="control|shift|Y">
                 <menu_item_call.on_click
@@ -446,7 +392,6 @@
             </menu_item_call>
             <menu_item_call
              label="Sunset"
-             layout="topleft"
              name="Sunset"
              shortcut="control|shift|N">
                 <menu_item_call.on_click
@@ -455,7 +400,6 @@
             </menu_item_call>
             <menu_item_call
              label="Midnight"
-             layout="topleft"
              name="Midnight">
                 <menu_item_call.on_click
                  function="World.EnvSettings"
@@ -463,17 +407,14 @@
             </menu_item_call>
             <menu_item_call
              label="Estate Time"
-             layout="topleft"
              name="Revert to Region Default">
                 <menu_item_call.on_click
                  function="World.EnvSettings"
                  parameter="default" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Environment Editor"
-             layout="topleft"
              name="Environment Editor">
                 <menu_item_call.on_click
                  function="World.EnvSettings"
@@ -484,13 +425,11 @@
     <menu
      create_jump_keys="true"
      label="Build"
-     layout="topleft"
      name="BuildTools"
      tear_off="true"
      visible="true">
        <menu_item_check
          label="Build"
-         layout="topleft"
          name="Show Build Tools"
          shortcut="control|B">
             <menu_item_check.on_check
@@ -503,12 +442,10 @@
        <menu
           create_jump_keys="true"
           label="Select Build Tool"
-          layout="topleft"
           name="Select Tool"
           tear_off="true">
          <menu_item_call
 			label="Focus Tool"
-			layout="topleft"
 			name="Focus"
 			shortcut="control|1">
            <menu_item_call.on_click
@@ -517,7 +454,6 @@
          </menu_item_call>
          <menu_item_call
 			label="Move Tool"
-			layout="topleft"
 			name="Move"
 			shortcut="control|2">
            <menu_item_call.on_click
@@ -526,7 +462,6 @@
          </menu_item_call>
          <menu_item_call
 			label="Edit Tool"
-			layout="topleft"
 			name="Edit"
 			shortcut="control|3">
            <menu_item_call.on_click
@@ -535,7 +470,6 @@
          </menu_item_call>
          <menu_item_call
 			label="Create Tool"
-			layout="topleft"
 			name="Create"
 			shortcut="control|4">
            <menu_item_call.on_click
@@ -544,7 +478,6 @@
          </menu_item_call>
          <menu_item_call
 			label="Land Tool"
-			layout="topleft"
 			name="Land"
 			shortcut="control|5">
            <menu_item_call.on_click
@@ -552,112 +485,8 @@
               parameter="land" />
          </menu_item_call>
 	   </menu>
-        <menu
-         create_jump_keys="true"
-         label="Edit"
-         layout="topleft"
-         name="Edit"
-         tear_off="true">
-            <menu_item_call
-             label="Undo"
-             layout="topleft"
-             name="Undo"
-             shortcut="control|Z">
-                <menu_item_call.on_click
-                 function="Edit.Undo" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableUndo" />
-            </menu_item_call>
-            <menu_item_call
-             label="Redo"
-             layout="topleft"
-             name="Redo"
-             shortcut="control|Y">
-                <menu_item_call.on_click
-                 function="Edit.Redo" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableRedo" />
-            </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
-            <menu_item_call
-             label="Cut"
-             layout="topleft"
-             name="Cut"
-             shortcut="control|X">
-                <menu_item_call.on_click
-                 function="Edit.Cut" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableCut" />
-            </menu_item_call>
-            <menu_item_call
-             label="Copy"
-             layout="topleft"
-             name="Copy"
-             shortcut="control|C">
-                <menu_item_call.on_click
-                 function="Edit.Copy" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableCopy" />
-            </menu_item_call>
-            <menu_item_call
-             label="Paste"
-             layout="topleft"
-             name="Paste"
-             shortcut="control|V">
-                <menu_item_call.on_click
-                 function="Edit.Paste" />
-                <menu_item_call.on_enable
-                 function="Edit.EnablePaste" />
-            </menu_item_call>
-            <menu_item_call
-             label="Delete"
-             layout="topleft"
-             name="Delete"
-             shortcut="Del">
-                <menu_item_call.on_click
-                 function="Edit.Delete" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableDelete" />
-            </menu_item_call>
-            <menu_item_call
-             label="Duplicate"
-             layout="topleft"
-             name="Duplicate"
-             shortcut="control|D">
-                <menu_item_call.on_click
-                 function="Edit.Duplicate" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableDuplicate" />
-            </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
-            <menu_item_call
-             label="Select All"
-             layout="topleft"
-             name="Select All"
-             shortcut="control|A">
-                <menu_item_call.on_click
-                 function="Edit.SelectAll" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableSelectAll" />
-            </menu_item_call>
-            <menu_item_call
-             label="Deselect"
-             layout="topleft"
-             name="Deselect"
-             shortcut="control|E">
-                <menu_item_call.on_click
-                 function="Edit.Deselect" />
-                <menu_item_call.on_enable
-                 function="Edit.EnableDeselect" />
-            </menu_item_call>
-        </menu>
-        <menu_item_separator
-           layout="topleft" />
         <menu_item_call
            label="Link"
-           layout="topleft"
            name="Link"
            shortcut="control|L">
           <menu_item_call.on_click
@@ -667,7 +496,6 @@
         </menu_item_call>
         <menu_item_call
            label="Unlink"
-           layout="topleft"
            name="Unlink"
            shortcut="control|shift|L">
           <menu_item_call.on_click
@@ -677,7 +505,6 @@
         </menu_item_call>
         <menu_item_check
              label="Edit Linked Parts"
-             layout="topleft"
              name="Edit Linked Parts">
                 <menu_item_check.on_check
                  control="EditLinkedParts" />
@@ -687,11 +514,9 @@
                 <menu_item_check.on_enable
                  function="Tools.EnableToolNotPie" />
             </menu_item_check>
-        <menu_item_separator
-           layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
            label="Focus on Selection"
-           layout="topleft"
            name="Focus on Selection"
            shortcut="H">
           <menu_item_call.on_click
@@ -702,7 +527,6 @@
         </menu_item_call>
         <menu_item_call
            label="Zoom to Selection"
-           layout="topleft"
            name="Zoom to Selection"
            shortcut="shift|H">
           <menu_item_call.on_click
@@ -711,17 +535,14 @@
           <menu_item_call.on_enable
              function="Tools.SomethingSelectedNoHUD" />
         </menu_item_call>
-        <menu_item_separator
-           layout="topleft" />
+        <menu_item_separator/>
         <menu
          create_jump_keys="true"
          label="Object"
-         layout="topleft"
          name="Object"
          tear_off="true">
           <menu_item_call
              label="Buy"
-             layout="topleft"
              name="Menu Object Buy">
             <menu_item_call.on_click
                function="Tools.BuyOrTake"/>
@@ -732,7 +553,6 @@
           </menu_item_call>
           <menu_item_call
              label="Take"
-             layout="topleft"
              name="Menu Object Take">
             <menu_item_call.on_click
                function="Tools.BuyOrTake"/>
@@ -743,7 +563,6 @@
           </menu_item_call>
           <menu_item_call
 			 label="Take Copy"
-			 layout="topleft"
 			 name="Take Copy">
 			<menu_item_call.on_click
                function="Tools.TakeCopy" />
@@ -752,7 +571,6 @@
           </menu_item_call>
           <menu_item_call
 			 label="Save Back to My Inventory"
-			 layout="topleft"
 			 name="Save Object Back to My Inventory">
 			<menu_item_call.on_click
                function="Tools.SaveToInventory" />
@@ -761,7 +579,6 @@
           </menu_item_call>
           <menu_item_call
 			 label="Save Back to Object Contents"
-			 layout="topleft"
 			 name="Save Object Back to Object Contents">
 			<menu_item_call.on_click
                function="Tools.SaveToObjectInventory" />
@@ -772,12 +589,10 @@
         <menu
            create_jump_keys="true"
            label="Scripts"
-           layout="topleft"
            name="Scripts"
            tear_off="true">
           <menu_item_call
              label="Recompile Scripts (Mono)"
-             layout="topleft"
              name="Mono">
             <menu_item_call.on_click
                function="Tools.SelectedScriptAction"
@@ -787,7 +602,6 @@
           </menu_item_call>
           <menu_item_call
              label="Recompile Scripts (LSL)"
-             layout="topleft"
              name="LSL">
             <menu_item_call.on_click
                function="Tools.SelectedScriptAction"
@@ -797,7 +611,6 @@
           </menu_item_call>
           <menu_item_call
              label="Reset Scripts"
-             layout="topleft"
              name="Reset Scripts">
             <menu_item_call.on_click
                function="Tools.SelectedScriptAction"
@@ -807,7 +620,6 @@
           </menu_item_call>
           <menu_item_call
              label="Set Scripts to Running"
-             layout="topleft"
              name="Set Scripts to Running">
             <menu_item_call.on_click
                function="Tools.SelectedScriptAction"
@@ -817,7 +629,6 @@
           </menu_item_call>
           <menu_item_call
              label="Set Scripts to Not Running"
-             layout="topleft"
              name="Set Scripts to Not Running">
             <menu_item_call.on_click
                function="Tools.SelectedScriptAction"
@@ -826,17 +637,14 @@
                function="EditableSelected" />
           </menu_item_call>
         </menu>
-        <menu_item_separator
-           layout="topleft" />
+        <menu_item_separator/>
         <menu
          create_jump_keys="true"
          label="Options"
-         layout="topleft"
          name="Options"
          tear_off="true">
             <menu_item_call
              label="Set Default Upload Permissions"
-             layout="topleft"
              name="perm prefs">
                 <menu_item_call.on_click
                  function="Floater.Toggle"
@@ -844,7 +652,6 @@
             </menu_item_call>
 	   <menu_item_check
 	       label="Show Advanced Permissions"
-	       layout="topleft"
 	       name="DebugPermissions">
 			  <menu_item_check.on_check
 				 function="CheckControl"
@@ -853,11 +660,9 @@
 				 function="ToggleControl"
 				 parameter="DebugPermissions" />
 			</menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_check
                  label="Select Only My Objects"
-                 layout="topleft"
                  name="Select Only My Objects">
                     <menu_item_check.on_check
                      control="SelectOwnedOnly" />
@@ -867,7 +672,6 @@
                 </menu_item_check>
                 <menu_item_check
                  label="Select Only Movable Objects"
-                 layout="topleft"
                  name="Select Only Movable Objects">
                     <menu_item_check.on_check
                      control="SelectMovableOnly" />
@@ -877,18 +681,15 @@
                 </menu_item_check>
                 <menu_item_check
                  label="Select By Surrounding"
-                 layout="topleft"
                  name="Select By Surrounding">
                     <menu_item_check.on_check
                      control="RectangleSelectInclusive" />
                     <menu_item_check.on_click
                      function="Tools.SelectBySurrounding" />
             </menu_item_check>
-          <menu_item_separator
-           layout="topleft" />
+          <menu_item_separator/>
                 <menu_item_check
                  label="Show Hidden Selection"
-                 layout="topleft"
                  name="Show Hidden Selection">
                     <menu_item_check.on_check
                      control="RenderHiddenSelections" />
@@ -897,7 +698,6 @@
                 </menu_item_check>
                 <menu_item_check
                  label="Show Light Radius for Selection"
-                 layout="topleft"
                  name="Show Light Radius for Selection">
                     <menu_item_check.on_check
                      control="RenderLightRadius" />
@@ -906,7 +706,6 @@
                 </menu_item_check>
                 <menu_item_check
                  label="Show Selection Beam"
-                 layout="topleft"
                  name="Show Selection Beam">
                     <menu_item_check.on_check
                      control="ShowSelectionBeam" />
@@ -914,11 +713,9 @@
                      function="ToggleControl"
                      parameter="ShowSelectionBeam" />
                 </menu_item_check>
-        <menu_item_separator
-           layout="topleft" />
+        <menu_item_separator/>
                 <menu_item_check
                  label="Snap to Grid"
-                 layout="topleft"
                  name="Snap to Grid"
                  shortcut="G">
                     <menu_item_check.on_check
@@ -931,7 +728,6 @@
                 </menu_item_check>
                 <menu_item_call
                  label="Snap Object XY to Grid"
-                 layout="topleft"
                  name="Snap Object XY to Grid"
                  shortcut="shift|X">
                     <menu_item_call.on_click
@@ -941,7 +737,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Use Selection for Grid"
-                 layout="topleft"
                  name="Use Selection for Grid"
                  shortcut="shift|G">
                     <menu_item_call.on_click
@@ -951,7 +746,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Grid Options"
-                 layout="topleft"
                  name="Grid Options"
                  shortcut="control|shift|B">
                     <menu_item_call.on_click
@@ -964,12 +758,10 @@
         <menu
          create_jump_keys="true"
          label="Select Linked Parts"
-         layout="topleft"
          name="Select Linked Parts"
          tear_off="true">
             <menu_item_call
              label="Select Next Part"
-             layout="topleft"
              name="Select Next Part"
 	     shortcut="control|.">
                 <menu_item_call.on_click
@@ -980,7 +772,6 @@
             </menu_item_call>
             <menu_item_call
              label="Select Previous Part"
-             layout="topleft"
              name="Select Previous Part"
 	     shortcut="control|,">
                 <menu_item_call.on_click
@@ -991,7 +782,6 @@
             </menu_item_call>
             <menu_item_call
              label="Include Next Part"
-             layout="topleft"
              name="Include Next Part"
 	     shortcut="control|shift|.">
                 <menu_item_call.on_click
@@ -1002,7 +792,6 @@
             </menu_item_call>
             <menu_item_call
              label="Include Previous Part"
-             layout="topleft"
              name="Include Previous Part"
 	     shortcut="control|shift|,">
                 <menu_item_call.on_click
@@ -1015,48 +804,40 @@
     </menu>
     <menu
      label="Help"
-     layout="topleft"
      name="Help"
      tear_off="true">
         <menu_item_call
          label="[SECOND_LIFE] Help"
-         layout="topleft"
          name="Second Life Help"
          shortcut="F1">
             <menu_item_call.on_click
              function="ShowHelp"
              parameter="f1_help" />
         </menu_item_call>
-  <!--      <menu_item_call
+        <menu_item_call
          label="Tutorial"
-         layout="topleft"
          name="Tutorial">
             <menu_item_call.on_click
              function="Floater.Show"
              parameter="hud" />
         </menu_item_call>-->
-        <menu_item_separator
-             layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
              label="Report Abuse"
-             layout="topleft"
              name="Report Abuse">
                 <menu_item_call.on_click
                  function="ReportAbuse" />
             </menu_item_call>
         <menu_item_call
              label="Report Bug"
-             layout="topleft"
              name="Report Bug">
                 <menu_item_call.on_click
                  function="ShowHelp"
                  parameter="report_bug" />
             </menu_item_call>
-        <menu_item_separator
-             layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
          label="About [APP_NAME]"
-         layout="topleft"
          name="About Second Life">
             <menu_item_call.on_click
              function="Floater.Show"
@@ -1065,20 +846,28 @@
     </menu>
     <menu
      label="Advanced"
-     layout="topleft"
      name="Advanced"
      tear_off="true"
      visible="false">
+        <menu_item_check
+         label="Show Advanced Menu"
+         name="Show Advanced Menu"
+         shortcut="control|alt|D">
+          <on_check
+           function="CheckControl"
+           parameter="UseDebugMenus" />
+          <on_click
+           function="ToggleControl"
+           parameter="UseDebugMenus" />
+        </menu_item_check>
         <menu_item_call
          label="Stop Animating Me"
-         layout="topleft"
          name="Stop Animating My Avatar">
             <menu_item_call.on_click
              function="Tools.StopAllAnimations" />
         </menu_item_call>
         <menu_item_call
          label="Rebake Textures"
-         layout="topleft"
          name="Rebake Texture"
          shortcut="control|alt|R">
             <menu_item_call.on_click
@@ -1086,7 +875,6 @@
         </menu_item_call>
         <menu_item_call
            label="Set UI Size to Default"
-           layout="topleft"
            name="Set UI Size to Default">
           <menu_item_call.on_click
              function="View.DefaultUISize" />
@@ -1101,7 +889,6 @@
         <menu_item_separator/>
         <menu_item_check
          label="Limit Select Distance"
-         layout="topleft"
          name="Limit Select Distance">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1112,7 +899,6 @@
         </menu_item_check>
         <menu_item_check
          label="Disable Camera Constraints"
-         layout="topleft"
          name="Disable Camera Distance">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1121,11 +907,9 @@
              function="ToggleControl"
              parameter="DisableCameraConstraints" />
         </menu_item_check>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_check
          label="High-res Snapshot"
-         layout="topleft"
          name="HighResSnapshot">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1136,7 +920,6 @@
         </menu_item_check>
         <menu_item_check
          label="Quiet Snapshots to Disk"
-         layout="topleft"
          name="QuietSnapshotsToDisk">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1147,7 +930,6 @@
         </menu_item_check>
         <menu_item_check
          label="Compress Snapshots to Disk"
-         layout="topleft"
          name="CompressSnapshotsToDisk">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1156,17 +938,14 @@
              function="ToggleControl"
              parameter="CompressSnapshotsToDisk" />
         </menu_item_check>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu
          create_jump_keys="true"
          label="Performance Tools"
-         layout="topleft"
          name="Performance Tools"
          tear_off="true">
             <menu_item_call
              label="Lag Meter"
-             layout="topleft"
              name="Lag Meter">
                 <menu_item_call.on_click
                  function="Floater.Show"
@@ -1174,7 +953,6 @@
             </menu_item_call>
             <menu_item_check
              label="Statistics Bar"
-             layout="topleft"
              name="Statistics Bar"
              shortcut="control|shift|1">
                 <menu_item_check.on_check
@@ -1186,7 +964,6 @@
             </menu_item_check>
       <menu_item_check
         label="Show Avatar Rendering Cost"
-        layout="topleft"
         name="Avatar Rendering Cost">
            <menu_item_check.on_check
             function="Advanced.CheckInfoDisplay"
@@ -1199,12 +976,10 @@
         <menu
          create_jump_keys="true"
          label="Highlighting and Visibility"
-         layout="topleft"
          name="Highlighting and Visibility"
          tear_off="true">
          <menu_item_check
                  label="Cheesy Beacon"
-                 layout="topleft"
                  name="Cheesy Beacon">
                     <menu_item_check.on_check
                      function="CheckControl"
@@ -1215,7 +990,6 @@
                 </menu_item_check>
             <menu_item_check
              label="Hide Particles"
-             layout="topleft"
              name="Hide Particles"
              shortcut="control|alt|shift|=">
                 <menu_item_check.on_check
@@ -1227,7 +1001,6 @@
             </menu_item_check>
             <menu_item_check
              label="Hide Selected"
-             layout="topleft"
              name="Hide Selected">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -1238,7 +1011,6 @@
             </menu_item_check>
             <menu_item_check
              label="Highlight Transparent"
-             layout="topleft"
              name="Highlight Transparent"
              shortcut="control|alt|T">
                 <menu_item_check.on_check
@@ -1248,7 +1020,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show HUD Attachments"
-             layout="topleft"
              name="Show HUD Attachments"
              shortcut="alt|shift|H">
                 <menu_item_check.on_check
@@ -1258,7 +1029,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Mouselook Crosshairs"
-             layout="topleft"
              name="ShowCrosshairs">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -1270,12 +1040,10 @@
   <!-- <menu
          create_jump_keys="true"
          label="Hover Tips"
-         layout="topleft"
          name="Hover Tips"
          tear_off="true">
             <menu_item_check
              label="Show Tips"
-             layout="topleft"
              name="Show Tips"
              shortcut="control|shift|T">
                 <menu_item_check.on_check
@@ -1283,11 +1051,9 @@
                 <menu_item_check.on_click
                  function="View.ShowHoverTips" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />-->
+            <menu_item_separator/>
             <menu_item_check
              label="Show Land Tooltips"
-             layout="topleft"
              name="Land Tips">
                 <menu_item_check.on_check
                  control="ShowLandHoverTip" />
@@ -1297,9 +1063,8 @@
                 <menu_item_check.on_enable
                  function="View.CheckShowHoverTips" />
             </menu_item_check>
- <!--           <menu_item_check
+           <menu_item_check
              label="Show Tips On All Objects"
-             layout="topleft"
              name="Tips On All Objects">
                 <menu_item_check.on_check
                  control="ShowAllObjectHoverTip" />
@@ -1316,12 +1081,10 @@
         <menu
          create_jump_keys="true"
          label="Rendering Types"
-         layout="topleft"
          name="Rendering Types"
          tear_off="true">
             <menu_item_check
              label="Simple"
-             layout="topleft"
              name="Simple"
              shortcut="control|alt|shift|1">
                 <menu_item_check.on_check
@@ -1333,7 +1096,6 @@
             </menu_item_check>
             <menu_item_check
              label="Alpha"
-             layout="topleft"
              name="Alpha"
              shortcut="control|alt|shift|2">
                 <menu_item_check.on_check
@@ -1345,7 +1107,6 @@
             </menu_item_check>
             <menu_item_check
              label="Tree"
-             layout="topleft"
              name="Tree"
              shortcut="control|alt|shift|3">
                 <menu_item_check.on_check
@@ -1357,7 +1118,6 @@
             </menu_item_check>
             <menu_item_check
              label="Avatars"
-             layout="topleft"
              name="Character"
              shortcut="control|alt|shift|4">
                 <menu_item_check.on_check
@@ -1369,7 +1129,6 @@
             </menu_item_check>
             <menu_item_check
              label="SurfacePath"
-             layout="topleft"
              name="SurfacePath"
              shortcut="control|alt|shift|5">
                 <menu_item_check.on_check
@@ -1381,7 +1140,6 @@
             </menu_item_check>
             <menu_item_check
              label="Sky"
-             layout="topleft"
              name="Sky"
              shortcut="control|alt|shift|6">
                 <menu_item_check.on_check
@@ -1393,7 +1151,6 @@
             </menu_item_check>
             <menu_item_check
              label="Water"
-             layout="topleft"
              name="Water"
              shortcut="control|alt|shift|7">
                 <menu_item_check.on_check
@@ -1405,7 +1162,6 @@
             </menu_item_check>
             <menu_item_check
              label="Ground"
-             layout="topleft"
              name="Ground"
              shortcut="control|alt|shift|8">
                 <menu_item_check.on_check
@@ -1417,7 +1173,6 @@
             </menu_item_check>
             <menu_item_check
              label="Volume"
-             layout="topleft"
              name="Volume"
              shortcut="control|alt|shift|9">
                 <menu_item_check.on_check
@@ -1429,7 +1184,6 @@
             </menu_item_check>
             <menu_item_check
              label="Grass"
-             layout="topleft"
              name="Grass"
              shortcut="control|alt|shift|0">
                 <menu_item_check.on_check
@@ -1441,7 +1195,6 @@
             </menu_item_check>
             <menu_item_check
              label="Clouds"
-             layout="topleft"
              name="Clouds"
              shortcut="control|alt|shift|-">
                 <menu_item_check.on_check
@@ -1453,7 +1206,6 @@
             </menu_item_check>
             <menu_item_check
              label="Particles"
-             layout="topleft"
              name="Particles"
              shortcut="control|alt|shift|=">
                 <menu_item_check.on_check
@@ -1465,7 +1217,6 @@
             </menu_item_check>
             <menu_item_check
              label="Bump"
-             layout="topleft"
              name="Bump"
              shortcut="control|alt|shift|\">
                 <menu_item_check.on_check
@@ -1479,12 +1230,10 @@
         <menu
          create_jump_keys="true"
          label="Rendering Features"
-         layout="topleft"
          name="Rendering Features"
          tear_off="true">
             <menu_item_check
              label="UI"
-             layout="topleft"
              name="UI"
              shortcut="control|alt|F1">
                 <menu_item_check.on_check
@@ -1496,7 +1245,6 @@
             </menu_item_check>
             <menu_item_check
              label="Selected"
-             layout="topleft"
              name="Selected"
              shortcut="control|alt|F2">
                 <menu_item_check.on_check
@@ -1508,7 +1256,6 @@
             </menu_item_check>
             <menu_item_check
              label="Highlighted"
-             layout="topleft"
              name="Highlighted"
              shortcut="control|alt|F3">
                 <menu_item_check.on_check
@@ -1520,7 +1267,6 @@
             </menu_item_check>
             <menu_item_check
              label="Dynamic Textures"
-             layout="topleft"
              name="Dynamic Textures"
              shortcut="control|alt|F4">
                 <menu_item_check.on_check
@@ -1532,7 +1278,6 @@
             </menu_item_check>
             <menu_item_check
              label="Foot Shadows"
-             layout="topleft"
              name="Foot Shadows"
              shortcut="control|alt|F5">
                 <menu_item_check.on_check
@@ -1544,7 +1289,6 @@
             </menu_item_check>
             <menu_item_check
              label="Fog"
-             layout="topleft"
              name="Fog"
              shortcut="control|alt|F6">
                 <menu_item_check.on_check
@@ -1556,7 +1300,6 @@
             </menu_item_check>
             <menu_item_check
              label="Test FRInfo"
-             layout="topleft"
              name="Test FRInfo"
              shortcut="control|alt|F8">
                 <menu_item_check.on_check
@@ -1568,7 +1311,6 @@
             </menu_item_check>
             <menu_item_check
              label="Flexible Objects"
-             layout="topleft"
              name="Flexible Objects"
              shortcut="control|alt|F9">
                 <menu_item_check.on_check
@@ -1581,7 +1323,6 @@
         </menu>
         <menu_item_check
          label="Run Multiple Threads"
-         layout="topleft"
          name="Run Multiple Threads">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1592,7 +1333,6 @@
         </menu_item_check>
         <menu_item_call
          label="Clear Group Cache"
-         layout="topleft"
          name="ClearGroupCache">
             <menu_item_call.on_click
              function="Advanced.ClearGroupCache"
@@ -1600,7 +1340,6 @@
         </menu_item_call>
         <menu_item_check
          label="Mouse Smoothing"
-         layout="topleft"
          name="Mouse Smoothing">
             <menu_item_check.on_check
              function="CheckControl"
@@ -1609,17 +1348,14 @@
              function="ToggleControl"
              parameter="MouseSmooth" />
         </menu_item_check>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu
          label="Shortcuts"
-         layout="topleft"
          name="Shortcuts"
          tear_off="true"
          visible="false">
           <menu_item_call
              label="Image (L$[COST])..."
-             layout="topleft"
              name="Upload Image"
              shortcut="control|U">
             <menu_item_call.on_click
@@ -1630,7 +1366,6 @@
             </menu_item_call>
             <menu_item_check
                label="Search"
-               layout="topleft"
                name="Search"
                shortcut="control|F">
             <menu_item_check.on_check
@@ -1643,7 +1378,6 @@
             <menu_item_call
              enabled="false"
              label="Release Keys"
-             layout="topleft"
              name="Release Keys">
                 <menu_item_call.on_click
                  function="Tools.ReleaseKeys"
@@ -1654,16 +1388,13 @@
             </menu_item_call>
             <menu_item_call
              label="Set UI Size to Default"
-             layout="topleft"
              name="Set UI Size to Default">
                 <menu_item_call.on_click
                  function="View.DefaultUISize" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_check
              label="Always Run"
-             layout="topleft"
              name="Always Run"
              shortcut="control|R">
                 <menu_item_check.on_check
@@ -1673,7 +1404,6 @@
             </menu_item_check>
             <menu_item_check
              label="Fly"
-             layout="topleft"
              name="Fly"
              shortcut="Home">
                 <menu_item_check.on_check
@@ -1683,11 +1413,9 @@
                 <menu_item_check.on_enable
                  function="Agent.enableFlying" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Close Window"
-             layout="topleft"
              name="Close Window"
              shortcut="control|W">
                 <menu_item_call.on_click
@@ -1697,7 +1425,6 @@
             </menu_item_call>
             <menu_item_call
              label="Close All Windows"
-             layout="topleft"
              name="Close All Windows"
              shortcut="control|shift|W">
                 <menu_item_call.on_click
@@ -1705,22 +1432,18 @@
                 <menu_item_call.on_enable
                  function="File.EnableCloseAllWindows" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Snapshot to Disk"
-             layout="topleft"
              name="Snapshot to Disk"
              shortcut="control|`"
              use_mac_ctrl="true">
                 <menu_item_call.on_click
                  function="File.TakeSnapshotToDisk" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Mouselook"
-             layout="topleft"
              name="Mouselook"
              shortcut="M">
                 <menu_item_call.on_click
@@ -1730,7 +1453,6 @@
             </menu_item_call>
             <menu_item_check
              label="Joystick Flycam"
-             layout="topleft"
              name="Joystick Flycam"
              shortcut="alt|shift|F">
                 <menu_item_check.on_check
@@ -1742,7 +1464,6 @@
             </menu_item_check>
             <menu_item_call
              label="Reset View"
-             layout="topleft"
              name="Reset View"
              shortcut="Esc">
                 <menu_item_call.on_click
@@ -1750,7 +1471,6 @@
             </menu_item_call>
             <menu_item_call
              label="Look at Last Chatter"
-             layout="topleft"
              name="Look at Last Chatter"
              shortcut="control|\">
                 <menu_item_call.on_click
@@ -1758,17 +1478,14 @@
                 <menu_item_call.on_enable
                  function="View.EnableLastChatter" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu
              create_jump_keys="true"
              label="Select Build Tool"
-             layout="topleft"
              name="Select Tool"
              tear_off="true">
                 <menu_item_call
                  label="Focus Tool"
-                 layout="topleft"
                  name="Focus"
                  shortcut="control|1">
                     <menu_item_call.on_click
@@ -1777,7 +1494,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Move Tool"
-                 layout="topleft"
                  name="Move"
                  shortcut="control|2">
                     <menu_item_call.on_click
@@ -1786,7 +1502,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Edit Tool"
-                 layout="topleft"
                  name="Edit"
                  shortcut="control|3">
                     <menu_item_call.on_click
@@ -1795,7 +1510,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Create Tool"
-                 layout="topleft"
                  name="Create"
                  shortcut="control|4">
                     <menu_item_call.on_click
@@ -1804,7 +1518,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Land Tool"
-                 layout="topleft"
                  name="Land"
                  shortcut="control|5">
                     <menu_item_call.on_click
@@ -1812,11 +1525,9 @@
                      parameter="land" />
                 </menu_item_call>
             </menu>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Zoom In"
-             layout="topleft"
              name="Zoom In"
              shortcut="control|0">
                 <menu_item_call.on_click
@@ -1824,7 +1535,6 @@
             </menu_item_call>
             <menu_item_call
              label="Zoom Default"
-             layout="topleft"
              name="Zoom Default"
              shortcut="control|9">
                 <menu_item_call.on_click
@@ -1832,17 +1542,14 @@
             </menu_item_call>
             <menu_item_call
              label="Zoom Out"
-             layout="topleft"
              name="Zoom Out"
              shortcut="control|8">
                 <menu_item_call.on_click
                  function="View.ZoomOut" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Toggle Fullscreen"
-             layout="topleft"
              name="Toggle Fullscreen"
              >
                <!-- Note: shortcut="alt|Enter" was deleted from the preceding node-->
@@ -1850,11 +1557,9 @@
                  function="View.Fullscreen" />
             </menu_item_call>
         </menu>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_call
          label="Show Debug Settings"
-         layout="topleft"
          name="Debug Settings">
             <menu_item_call.on_click
              function="Advanced.ShowDebugSettings"
@@ -1862,7 +1567,6 @@
         </menu_item_call>
      <menu_item_check
          label="Show Develop Menu"
-         layout="topleft"
          name="Debug Mode"
          shortcut="control|alt|Q">
             <menu_item_check.on_check
@@ -1872,23 +1576,21 @@
              function="ToggleControl"
              parameter="QAMode" />
         </menu_item_check>
+    
     </menu>
     <menu
      create_jump_keys="true"
      label="Develop"
-     layout="topleft"
      name="Develop"
      tear_off="true"
      visible="false">
         <menu
          create_jump_keys="true"
          label="Consoles"
-         layout="topleft"
          name="Consoles"
          tear_off="true">
             <menu_item_check
              label="Texture Console"
-             layout="topleft"
              name="Texture Console"
              shortcut="control|shift|3"
              use_mac_ctrl="true">
@@ -1901,7 +1603,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Console"
-             layout="topleft"
              name="Debug Console"
              shortcut="control|shift|4"
              use_mac_ctrl="true">
@@ -1914,7 +1615,6 @@
             </menu_item_check>
             <menu_item_call
              label="Notifications Console"
-             layout="topleft"
              name="Notifications"
              shortcut="control|shift|5">
               <menu_item_call.on_click
@@ -1923,7 +1623,6 @@
             </menu_item_call>
             <menu_item_check
                label="Texture Size Console"
-               layout="topleft"
                name="Texture Size"
                shortcut="control|shift|6">
               <menu_item_check.on_check
@@ -1935,7 +1634,6 @@
             </menu_item_check>
             <menu_item_check
                label="Texture Category Console"
-               layout="topleft"
                name="Texture Category"
                shortcut="control|shift|7">
               <menu_item_check.on_check
@@ -1947,7 +1645,6 @@
             </menu_item_check>
             <menu_item_check
              label="Fast Timers"
-             layout="topleft"
              name="Fast Timers"
              shortcut="control|shift|9"
              use_mac_ctrl="true">
@@ -1960,7 +1657,6 @@
             </menu_item_check>
             <menu_item_check
              label="Memory"
-             layout="topleft"
              name="Memory"
              shortcut="control|shift|0"
              use_mac_ctrl="true">
@@ -1971,11 +1667,9 @@
                  function="Advanced.ToggleConsole"
                  parameter="memory view" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Region Info to Debug Console"
-             layout="topleft"
              name="Region Info to Debug Console">
                 <menu_item_call.on_click
                  function="Advanced.DumpInfoToConsole"
@@ -1983,7 +1677,6 @@
             </menu_item_call>
             <menu_item_call
              label="Group Info to Debug Console"
-             layout="topleft"
              name="Group Info to Debug Console">
                 <menu_item_call.on_click
                  function="Advanced.DumpInfoToConsole"
@@ -1991,17 +1684,14 @@
             </menu_item_call>
             <menu_item_call
              label="Capabilities Info to Debug Console"
-             layout="topleft"
              name="Capabilities Info to Debug Console">
                 <menu_item_call.on_click
                  function="Advanced.DumpInfoToConsole"
                  parameter="capabilities" />
             </menu_item_call>
-            <menu_item_separator
-         layout="topleft" />
+            <menu_item_separator/>
             <menu_item_check
              label="Camera"
-             layout="topleft"
              name="Camera">
                 <menu_item_check.on_check
                  function="Advanced.CheckHUDInfo"
@@ -2012,7 +1702,6 @@
             </menu_item_check>
             <menu_item_check
              label="Wind"
-             layout="topleft"
              name="Wind">
                 <menu_item_check.on_check
                  function="Advanced.CheckHUDInfo"
@@ -2023,7 +1712,6 @@
             </menu_item_check>
             <menu_item_check
              label="FOV"
-             layout="topleft"
              name="FOV">
                 <menu_item_check.on_check
                  function="Advanced.CheckHUDInfo"
@@ -2034,7 +1722,6 @@
             </menu_item_check>
             <menu_item_check
              label="Badge"
-             layout="topleft"
              name="Badge"
 			 shortcut="alt|control|shift|h">
                 <menu_item_check.on_check
@@ -2048,12 +1735,10 @@
         <menu
          create_jump_keys="true"
          label="Show Info"
-         layout="topleft"
          name="Display Info"
          tear_off="true">
             <menu_item_check
              label="Show Time"
-             layout="topleft"
              name="Show Time">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2064,7 +1749,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Render Info"
-             layout="topleft"
              name="Show Render Info">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2075,7 +1759,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Matrices"
-             layout="topleft"
              name="Show Matrices">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2086,7 +1769,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Color Under Cursor"
-             layout="topleft"
              name="Show Color Under Cursor">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2095,11 +1777,9 @@
                  function="ToggleControl"
                  parameter="DebugShowColor" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_check
              label="Show Updates to Objects"
-             layout="topleft"
              name="Show Updates"
              shortcut="control|alt|shift|U">
                 <menu_item_check.on_check
@@ -2109,17 +1789,14 @@
                  function="Advanced.ToggleShowObjectUpdates" />
             </menu_item_check>
         </menu>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu
          create_jump_keys="true"
          label="Force an Error"
-         layout="topleft"
          name="Force Errors"
          tear_off="true">
             <menu_item_call
              label="Force Breakpoint"
-             layout="topleft"
              name="Force Breakpoint"
              shortcut="control|alt|shift|B">
                 <menu_item_call.on_click
@@ -2127,49 +1804,42 @@
             </menu_item_call>
             <menu_item_call
              label="Force LLError And Crash"
-             layout="topleft"
              name="Force LLError And Crash">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorLlerror" />
             </menu_item_call>
             <menu_item_call
              label="Force Bad Memory Access"
-             layout="topleft"
              name="Force Bad Memory Access">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorBadMemoryAccess" />
             </menu_item_call>
             <menu_item_call
              label="Force Infinite Loop"
-             layout="topleft"
              name="Force Infinite Loop">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorInfiniteLoop" />
             </menu_item_call>
             <menu_item_call
              label="Force Driver Crash"
-             layout="topleft"
              name="Force Driver Carsh">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorDriverCrash" />
             </menu_item_call>
             <menu_item_call
              label="Force Software Exception"
-             layout="topleft"
              name="Force Software Exception">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorSoftwareException" />
             </menu_item_call>
             <menu_item_call
              label="Force Disconnect Viewer"
-             layout="topleft"
              name="Force Disconnect Viewer">
                 <menu_item_call.on_click
                  function="Advanced.ForceErrorDisconnectViewer" />
             </menu_item_call>
             <menu_item_call
              label="Simulate a Memory Leak"
-             layout="topleft"
              name="Memory Leaking Simulation">
                <menu_item_call.on_click
                 function="Floater.Show"
@@ -2179,12 +1849,10 @@
         <menu
          create_jump_keys="true"
          label="Render Tests"
-         layout="topleft"
          name="Render Tests"
          tear_off="true">
             <menu_item_check
              label="Camera Offset"
-             layout="topleft"
              name="Camera Offset">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2195,7 +1863,6 @@
             </menu_item_check>
             <menu_item_check
              label="Randomize Framerate"
-             layout="topleft"
              name="Randomize Framerate">
                 <menu_item_check.on_check
                  function="Advanced.CheckRandomizeFramerate"
@@ -2205,7 +1872,6 @@
             </menu_item_check>
             <menu_item_check
              label="Periodic Slow Frame"
-             layout="topleft"
              name="Periodic Slow Frame">
                 <menu_item_check.on_check
                  function="Advanced.CheckPeriodicSlowFrame"
@@ -2216,7 +1882,6 @@
             </menu_item_check>
             <menu_item_check
              label="Frame Test"
-             layout="topleft"
              name="Frame Test">
                 <menu_item_check.on_check
                  function="Advanced.CheckFrameTest"
@@ -2228,12 +1893,10 @@
       <menu
         create_jump_keys="true"
         label="Render Metadata"
-        layout="topleft"
         name="Render Metadata"
         tear_off="true">
         <menu_item_check
          label="Bounding Boxes"
-         layout="topleft"
          name="Bounding Boxes">
         <menu_item_check.on_check
          function="Advanced.CheckInfoDisplay"
@@ -2244,7 +1907,6 @@
         </menu_item_check>
         <menu_item_check
          label="Octree"
-         layout="topleft"
          name="Octree">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2255,7 +1917,6 @@
         </menu_item_check>
         <menu_item_check
          label="Shadow Frusta"
-         layout="topleft"
          name="Shadow Frusta">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2266,7 +1927,6 @@
         </menu_item_check>
         <menu_item_check
          label="Occlusion"
-         layout="topleft"
          name="Occlusion">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2277,7 +1937,6 @@
         </menu_item_check>
         <menu_item_check
          label="Render Batches"
-         layout="topleft"
          name="Render Batches">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2288,7 +1947,6 @@
         </menu_item_check>
         <menu_item_check
          label="Texture Anim"
-         layout="topleft"
          name="Texture Anim">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2299,7 +1957,6 @@
         </menu_item_check>
         <menu_item_check
          label="Texture Priority"
-         layout="topleft"
          name="Texture Priority">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2310,7 +1967,6 @@
         </menu_item_check>
         <menu_item_check
          label="Texture Area"
-         layout="topleft"
          name="Texture Area">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2321,7 +1977,6 @@
         </menu_item_check>
         <menu_item_check
          label="Face Area"
-         layout="topleft"
          name="Face Area">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2332,7 +1987,6 @@
         </menu_item_check>
         <menu_item_check
          label="Lights"
-         layout="topleft"
          name="Lights">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2343,7 +1997,6 @@
         </menu_item_check>
         <menu_item_check
          label="Collision Skeleton"
-         layout="topleft"
          name="Collision Skeleton">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2354,7 +2007,6 @@
         </menu_item_check>
         <menu_item_check
          label="Raycast"
-         layout="topleft"
          name="Raycast">
           <menu_item_check.on_check
            function="Advanced.CheckInfoDisplay"
@@ -2367,7 +2019,6 @@
         <menu
          create_jump_keys="true"
          label="Rendering"
-         layout="topleft"
          name="Rendering"
          tear_off="true">
             <menu_item_check
@@ -2509,7 +2160,6 @@
             </menu_item_check>
             <menu_item_check
               label="Full Res Textures"
-             layout="topleft"
              name="Rull Res Textures">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2520,7 +2170,6 @@
             </menu_item_check>
             <menu_item_check
                label="Audit Textures"
-               layout="topleft"
                name="Audit Textures">
               <menu_item_check.on_check
                function="CheckControl"
@@ -2574,12 +2223,10 @@
         <menu
          create_jump_keys="true"
          label="Network"
-         layout="topleft"
          name="Network"
          tear_off="true">
             <menu_item_check
              label="Pause Agent"
-             layout="topleft"
              name="AgentPause">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2588,27 +2235,22 @@
                  function="ToggleControl"
                  parameter="AgentPause" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Enable Message Log"
-             layout="topleft"
              name="Enable Message Log">
                 <menu_item_call.on_click
                  function="Advanced.EnableMessageLog" />
             </menu_item_call>
             <menu_item_call
              label="Disable Message Log"
-             layout="topleft"
              name="Disable Message Log">
                 <menu_item_call.on_click
                  function="Advanced.DisableMessageLog" />
             </menu_item_call>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_check
              label="Velocity Interpolate Objects"
-             layout="topleft"
              name="Velocity Interpolate Objects">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2619,7 +2261,6 @@
             </menu_item_check>
             <menu_item_check
              label="Ping Interpolate Object Positions"
-             layout="topleft"
              name="Ping Interpolate Object Positions">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2628,11 +2269,9 @@
                  function="ToggleControl"
                  parameter="PingInterpolate" />
             </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
+            <menu_item_separator/>
             <menu_item_call
              label="Drop a Packet"
-             layout="topleft"
              name="Drop a Packet"
              shortcut="control|alt|L">
                 <menu_item_call.on_click
@@ -2641,14 +2280,12 @@
         </menu>
         <menu_item_call
          label="Dump Scripted Camera"
-         layout="topleft"
          name="Dump Scripted Camera">
             <menu_item_call.on_click
              function="Advanced.DumpScriptedCamera" />
         </menu_item_call>
         <menu_item_call
              label="Bumps, Pushes &amp; Hits"
-             layout="topleft"
              name="Bumps, Pushes &amp;amp; Hits">
                 <menu_item_call.on_click
                  function="Floater.Show"
@@ -2658,12 +2295,10 @@
         <menu
          create_jump_keys="true"
          label="Recorder"
-         layout="topleft"
          name="Recorder"
          tear_off="true">
             <menu_item_call
              label="Start Playback"
-             layout="topleft"
              name="Start Playback">
                 <menu_item_call.on_click
                  function="Advanced.AgentPilot"
@@ -2671,7 +2306,6 @@
             </menu_item_call>
             <menu_item_call
              label="Stop Playback"
-             layout="topleft"
              name="Stop Playback">
                 <menu_item_call.on_click
                  function="Advanced.AgentPilot"
@@ -2679,7 +2313,6 @@
             </menu_item_call>
             <menu_item_check
              label="Loop Playback"
-             layout="topleft"
              name="Loop Playback">
                 <menu_item_check.on_check
                  function="Advanced.CheckAgentPilotLoop"
@@ -2689,7 +2322,6 @@
             </menu_item_check>
             <menu_item_call
              label="Start Record"
-             layout="topleft"
              name="Start Record">
                 <menu_item_call.on_click
                  function="Advanced.AgentPilot"
@@ -2697,7 +2329,6 @@
             </menu_item_call>
             <menu_item_call
              label="Stop Record"
-             layout="topleft"
              name="Stop Record">
                 <menu_item_call.on_click
                  function="Advanced.AgentPilot"
@@ -2708,12 +2339,10 @@
         <menu
          create_jump_keys="true"
          label="World"
-         layout="topleft"
          name="World"
          tear_off="true">
             <menu_item_check
              label="Sim Sun Override"
-             layout="topleft"
              name="Sim Sun Override">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2724,7 +2353,6 @@
             </menu_item_check>
             <menu_item_check
              label="Cheesy Beacon"
-             layout="topleft"
              name="Cheesy Beacon">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2735,7 +2363,6 @@
             </menu_item_check>
             <menu_item_check
              label="Fixed Weather"
-             layout="topleft"
              name="Fixed Weather">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2746,7 +2373,6 @@
             </menu_item_check>
             <menu_item_call
              label="Dump Region Object Cache"
-             layout="topleft"
              name="Dump Region Object Cache">
                 <menu_item_call.on_click
                  function="Advanced.DumpRegionObjectCache" />
@@ -2755,12 +2381,10 @@
         <menu
          create_jump_keys="true"
          label="UI"
-         layout="topleft"
          name="UI"
          tear_off="true">
          <!--   <menu_item_check
              label="New Bottom Bar"
-             layout="topleft"
              name="New Bottom Bar">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2771,7 +2395,6 @@
             </menu_item_check>-->
             <menu_item_call
              label="Web Browser Test"
-             layout="topleft"
              name="Web Browser Test">
                 <menu_item_call.on_click
                  function="Advanced.WebBrowserTest"
@@ -2779,14 +2402,12 @@
             </menu_item_call>
             <menu_item_call
              label="Dump SelectMgr"
-             layout="topleft"
              name="Dump SelectMgr">
                 <menu_item_call.on_click
                  function="Advanced.DumpSelectMgr" />
             </menu_item_call>
             <menu_item_call
              label="Dump Inventory"
-             layout="topleft"
              name="Dump Inventory">
                 <menu_item_call.on_click
                  function="Advanced.DumpInventory" />
@@ -2799,14 +2420,12 @@
             </menu_item_call>
             <menu_item_call
              label="Dump Focus Holder"
-             layout="topleft"
              name="Dump Focus Holder">
                 <menu_item_call.on_click
                  function="Advanced.DumpFocusHolder" />
             </menu_item_call>
             <menu_item_call
              label="Print Selected Object Info"
-             layout="topleft"
              name="Print Selected Object Info"
              shortcut="control|shift|P">
                 <menu_item_call.on_click
@@ -2814,7 +2433,6 @@
             </menu_item_call>
             <menu_item_call
              label="Print Agent Info"
-             layout="topleft"
              name="Print Agent Info"
              shortcut="shift|P">
                 <menu_item_call.on_click
@@ -2822,7 +2440,6 @@
             </menu_item_call>
             <menu_item_call
              label="Memory Stats"
-             layout="topleft"
              name="Memory Stats"
              shortcut="control|alt|shift|M">
                 <menu_item_call.on_click
@@ -2830,7 +2447,6 @@
             </menu_item_call>
             <menu_item_check
              label="Double-ClickAuto-Pilot"
-             layout="topleft"
              name="Double-ClickAuto-Pilot">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2843,7 +2459,6 @@
             <menu_item_separator />
             <menu_item_check
              label="Debug SelectMgr"
-             layout="topleft"
              name="Debug SelectMgr">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -2854,7 +2469,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Clicks"
-             layout="topleft"
              name="Debug Clicks">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugClicks"
@@ -2865,7 +2479,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Views"
-             layout="topleft"
              name="Debug Views">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugViews" />
@@ -2874,7 +2487,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Name Tooltips"
-             layout="topleft"
              name="Debug Name Tooltips">
                 <menu_item_check.on_check
                  function="Advanced.CheckXUINameTooltips"
@@ -2884,7 +2496,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Mouse Events"
-             layout="topleft"
              name="Debug Mouse Events">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugMouseEvents"
@@ -2894,7 +2505,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Keys"
-             layout="topleft"
              name="Debug Keys">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugKeys"
@@ -2904,7 +2514,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug WindowProc"
-             layout="topleft"
              name="Debug WindowProc">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugWindowProc"
@@ -2921,14 +2530,12 @@
          tear_off="true">
             <menu_item_call
                label="Reload Color Settings"
-               layout="topleft"
                name="Reload Color Settings">
               <menu_item_call.on_click
                function="Advanced.ReloadColorSettings" />
             </menu_item_call>
             <menu_item_call
              label="Show Font Test"
-             layout="topleft"
              name="Show Font Test">
                 <menu_item_call.on_click
                  function="Floater.Show"
@@ -2936,21 +2543,18 @@
             </menu_item_call>
             <menu_item_call
              label="Load from XML"
-             layout="topleft"
              name="Load from XML">
                 <menu_item_call.on_click
                  function="Advanced.LoadUIFromXML" />
             </menu_item_call>
             <menu_item_call
              label="Save to XML"
-             layout="topleft"
              name="Save to XML">
                 <menu_item_call.on_click
                  function="Advanced.SaveUIToXML" />
             </menu_item_call>
             <menu_item_check
              label="Show XUI Names"
-             layout="topleft"
              name="Show XUI Names">
                 <menu_item_check.on_check
                  function="Advanced.CheckXUINames"
@@ -2960,7 +2564,6 @@
             </menu_item_check>
           <menu_item_call
            label="Send Test IMs"
-           layout="topleft"
            name="Send Test IMs">
             <menu_item_call.on_click
              function="Advanced.SendTestIMs" />
@@ -2969,18 +2572,15 @@
         <menu
          create_jump_keys="true"
          label="Avatar"
-         layout="topleft"
          name="Character"
          tear_off="true">
             <menu
              create_jump_keys="true"
              label="Grab Baked Texture"
-             layout="topleft"
              name="Grab Baked Texture"
              tear_off="true">
                 <menu_item_call
                  label="Iris"
-                 layout="topleft"
                  name="Iris">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
@@ -2991,7 +2591,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Head"
-                 layout="topleft"
                  name="Head">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
@@ -3002,7 +2601,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Upper Body"
-                 layout="topleft"
                  name="Upper Body">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
@@ -3013,7 +2611,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Lower Body"
-                 layout="topleft"
                  name="Lower Body">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
@@ -3024,7 +2621,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Skirt"
-                 layout="topleft"
                  name="Skirt">
                     <menu_item_call.on_click
                      function="Advanced.GrabBakedTexture"
@@ -3037,19 +2633,16 @@
             <menu
              create_jump_keys="true"
              label="Character Tests"
-             layout="topleft"
              name="Character Tests"
              tear_off="true">
                 <menu_item_call
                  label="Appearance To XML"
-                 layout="topleft"
                  name="Appearance To XML">
                     <menu_item_call.on_click
                      function="Advanced.AppearanceToXML" />
                 </menu_item_call>
                 <menu_item_call
                  label="Toggle Character Geometry"
-                 layout="topleft"
                  name="Toggle Character Geometry">
                     <menu_item_call.on_click
                      function="Advanced.ToggleCharacterGeometry" />
@@ -3058,28 +2651,24 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Test Male"
-                 layout="topleft"
                  name="Test Male">
                     <menu_item_call.on_click
                      function="Advanced.TestMale" />
                 </menu_item_call>
                 <menu_item_call
                  label="Test Female"
-                 layout="topleft"
                  name="Test Female">
                     <menu_item_call.on_click
                      function="Advanced.TestFemale" />
                 </menu_item_call>
                 <menu_item_call
                  label="Toggle PG"
-                 layout="topleft"
                  name="Toggle PG">
                     <menu_item_call.on_click
                      function="Advanced.TogglePG" />
                 </menu_item_call>
                 <menu_item_check
                  label="Allow Select Avatar"
-                 layout="topleft"
                  name="Allow Select Avatar">
                     <menu_item_check.on_check
                      function="CheckControl"
@@ -3091,14 +2680,12 @@
             </menu>
             <menu_item_call
              label="Force Params to Default"
-             layout="topleft"
              name="Force Params to Default">
                 <menu_item_call.on_click
                  function="Advanced.ForceParamsToDefault" />
             </menu_item_call>
             <menu_item_check
              label="Animation Info"
-             layout="topleft"
              name="Animation Info">
                 <menu_item_check.on_check
                  function="Advanced.CheckAnimationInfo"
@@ -3109,7 +2696,6 @@
             </menu_item_check>
             <menu_item_check
              label="Slow Motion Animations"
-             layout="topleft"
              name="Slow Motion Animations">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -3120,7 +2706,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Look At"
-             layout="topleft"
              name="Show Look At">
                 <menu_item_check.on_check
                  function="Advanced.CheckShowLookAt"
@@ -3130,7 +2715,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Point At"
-             layout="topleft"
              name="Show Point At">
                 <menu_item_check.on_check
                  function="Advanced.CheckShowPointAt"
@@ -3140,7 +2724,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Joint Updates"
-             layout="topleft"
              name="Debug Joint Updates">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugJointUpdates"
@@ -3150,7 +2733,6 @@
             </menu_item_check>
             <menu_item_check
              label="Disable LOD"
-             layout="topleft"
              name="Disable LOD">
                 <menu_item_check.on_check
                  function="Advanced.CheckDisableLOD"
@@ -3160,7 +2742,6 @@
             </menu_item_check>
             <menu_item_check
              label="Debug Character Vis"
-             layout="topleft"
              name="Debug Character Vis">
                 <menu_item_check.on_check
                  function="Advanced.CheckDebugCharacterVis"
@@ -3170,7 +2751,6 @@
             </menu_item_check>
             <menu_item_check
              label="Show Collision Skeleton"
-             layout="topleft"
              name="Show Collision Skeleton">
                 <menu_item_check.on_check
                  function="Advanced.CheckInfoDisplay"
@@ -3181,7 +2761,6 @@
             </menu_item_check>
             <menu_item_check
              label="Display Agent Target"
-             layout="topleft"
              name="Display Agent Target">
                 <menu_item_check.on_check
                  function="Advanced.CheckInfoDisplay"
@@ -3193,7 +2772,6 @@
 <!-- Appears not to exist anymore
             <menu_item_check
              label="Debug Rotation"
-             layout="topleft"
              name="Debug Rotation">
                 <menu_item_check.on_check
                  function="CheckControl"
@@ -3205,14 +2783,12 @@
 -->
             <menu_item_call
              label="Dump Attachments"
-             layout="topleft"
              name="Dump Attachments">
                 <menu_item_call.on_click
                  function="Advanced.DumpAttachments" />
             </menu_item_call>
             <menu_item_call
              label="Debug Avatar Textures"
-             layout="topleft"
              name="Debug Avatar Textures"
              shortcut="control|alt|shift|A">
                 <menu_item_call.on_click
@@ -3220,18 +2796,15 @@
             </menu_item_call>
             <menu_item_call
              label="Dump Local Textures"
-             layout="topleft"
              name="Dump Local Textures"
              shortcut="alt|shift|M">
                 <menu_item_call.on_click
                  function="Advanced.DumpAvatarLocalTextures" />
             </menu_item_call>
         </menu>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_check
          label="HTTP Textures"
-         layout="topleft"
          name="HTTP Textures">
             <menu_item_check.on_check
              function="CheckControl"
@@ -3242,14 +2815,12 @@
         </menu_item_check>
         <menu_item_call
          label="Compress Images"
-         layout="topleft"
          name="Compress Images">
             <menu_item_call.on_click
              function="Advanced.CompressImage" />
         </menu_item_call>
         <menu_item_check
          label="Output Debug Minidump"
-         layout="topleft"
          name="Output Debug Minidump">
             <menu_item_check.on_check
              function="CheckControl"
@@ -3260,7 +2831,6 @@
         </menu_item_check>
         <menu_item_check
          label="Console Window on next Run"
-         layout="topleft"
          name="Console Window">
             <menu_item_check.on_check
              function="CheckControl"
@@ -3269,11 +2839,9 @@
              function="ToggleControl"
              parameter="ShowConsoleWindow" />
         </menu_item_check>
-        <menu_item_separator
-         layout="topleft" />
+        <menu_item_separator/>
         <menu_item_check
          label="Show Admin Menu"
-         layout="topleft"
          name="View Admin Options">
             <menu_item_check.on_check
              function="Advanced.CheckViewAdminOptions"
@@ -3283,7 +2851,6 @@
         </menu_item_check>
         <menu_item_call
          label="Request Admin Status"
-         layout="topleft"
          name="Request Admin Options"
          shortcut="control|alt|G">
             <menu_item_call.on_click
@@ -3291,7 +2858,6 @@
         </menu_item_call>
         <menu_item_call
          label="Leave Admin Status"
-         layout="topleft"
          name="Leave Admin Options"
          shortcut="control|alt|shift|G">
             <menu_item_call.on_click
@@ -3301,18 +2867,15 @@
     <menu
      create_jump_keys="true"
      label="Admin"
-     layout="topleft"
      name="Admin"
      tear_off="true"
      visible="false">
         <menu
          create_jump_keys="true"
          label="Object"
-         layout="topleft"
          tear_off="true">
             <menu_item_call
              label="Take Copy"
-             layout="topleft"
              name="Take Copy"
              shortcut="control|alt|shift|O">
                 <menu_item_call.on_click
@@ -3322,7 +2885,6 @@
             </menu_item_call>
             <menu_item_call
              label="Force Owner To Me"
-             layout="topleft"
              name="Force Owner To Me">
                 <menu_item_call.on_click
                  function="Admin.HandleObjectOwnerSelf" />
@@ -3331,7 +2893,6 @@
             </menu_item_call>
             <menu_item_call
              label="Force Owner Permissive"
-             layout="topleft"
              name="Force Owner Permissive">
                 <menu_item_call.on_click
                  function="Admin.HandleObjectOwnerPermissive" />
@@ -3340,7 +2901,6 @@
             </menu_item_call>
             <menu_item_call
              label="Delete"
-             layout="topleft"
              name="Delete"
              shortcut="control|alt|shift|Del">
                 <menu_item_call.on_click
@@ -3350,7 +2910,6 @@
             </menu_item_call>
             <menu_item_call
              label="Lock"
-             layout="topleft"
              name="Lock"
              shortcut="control|alt|shift|L">
                 <menu_item_call.on_click
@@ -3360,7 +2919,6 @@
             </menu_item_call>
             <menu_item_call
              label="Get Assets IDs"
-             layout="topleft"
              name="Get Assets IDs"
              shortcut="control|alt|shift|I">
                 <menu_item_call.on_click
@@ -3372,12 +2930,10 @@
         <menu
          create_jump_keys="true"
          label="Parcel"
-         layout="topleft"
          name="Parcel"
          tear_off="true">
             <menu_item_call
              label="Force Owner To Me"
-             layout="topleft"
              name="Owner To Me">
                 <menu_item_call.on_click
                  function="Admin.HandleForceParcelOwnerToMe" />
@@ -3386,7 +2942,6 @@
             </menu_item_call>
             <menu_item_call
              label="Set to Linden Content"
-             layout="topleft"
              name="Set to Linden Content"
              shortcut="control|alt|shift|C">
                 <menu_item_call.on_click
@@ -3396,7 +2951,6 @@
             </menu_item_call>
             <menu_item_call
              label="Claim Public Land"
-             layout="topleft"
              name="Claim Public Land">
                 <menu_item_call.on_click
                  function="Admin.HandleClaimPublicLand" />
@@ -3407,12 +2961,10 @@
         <menu
          create_jump_keys="true"
          label="Region"
-         layout="topleft"
          name="Region"
          tear_off="true">
             <menu_item_call
              label="Dump Temp Asset Data"
-             layout="topleft"
              name="Dump Temp Asset Data">
                 <menu_item_call.on_click
                  function="Admin.HandleRegionDumpTempAssetData" />
@@ -3421,7 +2973,6 @@
             </menu_item_call>
             <menu_item_call
              label="Save Region State"
-             layout="topleft"
              name="Save Region State">
                 <menu_item_call.on_click
                  function="Admin.OnSaveState" />
@@ -3431,7 +2982,6 @@
         </menu>
         <menu_item_call
          label="God Tools"
-         layout="topleft"
          name="God Tools">
             <menu_item_call.on_click
              function="Floater.Show"
@@ -3443,34 +2993,29 @@
     <menu
      create_jump_keys="true"
      label="Admin"
-     layout="topleft"
      name="Deprecated"
      tear_off="true"
      visible="false">
         <menu
          create_jump_keys="true"
          label="Attach Object"
-         layout="topleft"
          mouse_opaque="false"
          name="Attach Object"
          tear_off="true" />
         <menu
          create_jump_keys="true"
          label="Detach Object"
-         layout="topleft"
          mouse_opaque="false"
          name="Detach Object"
          tear_off="true" />
         <menu
          create_jump_keys="true"
          label="Take Off Clothing"
-         layout="topleft"
          mouse_opaque="false"
          name="Take Off Clothing"
          tear_off="true">
             <menu_item_call
              label="Shirt"
-             layout="topleft"
              name="Shirt">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3481,7 +3026,6 @@
             </menu_item_call>
             <menu_item_call
              label="Pants"
-             layout="topleft"
              name="Pants">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3492,7 +3036,6 @@
             </menu_item_call>
             <menu_item_call
              label="Shoes"
-             layout="topleft"
              name="Shoes">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3503,7 +3046,6 @@
             </menu_item_call>
             <menu_item_call
              label="Socks"
-             layout="topleft"
              name="Socks">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3514,7 +3056,6 @@
             </menu_item_call>
             <menu_item_call
              label="Jacket"
-             layout="topleft"
              name="Jacket">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3525,7 +3066,6 @@
             </menu_item_call>
             <menu_item_call
              label="Gloves"
-             layout="topleft"
              name="Gloves">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3536,7 +3076,6 @@
             </menu_item_call>
             <menu_item_call
              label="Undershirt"
-             layout="topleft"
              name="Menu Undershirt">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3547,7 +3086,6 @@
             </menu_item_call>
             <menu_item_call
              label="Underpants"
-             layout="topleft"
              name="Menu Underpants">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3558,7 +3096,6 @@
             </menu_item_call>
             <menu_item_call
              label="Skirt"
-             layout="topleft"
              name="Skirt">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3569,7 +3106,6 @@
             </menu_item_call>
             <menu_item_call
              label="Alpha"
-             layout="topleft"
              name="Alpha">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3580,7 +3116,6 @@
             </menu_item_call>
             <menu_item_call
              label="Tattoo"
-             layout="topleft"
              name="Tattoo">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3591,7 +3126,6 @@
             </menu_item_call>
             <menu_item_call
              label="All Clothes"
-             layout="topleft"
              name="All Clothes">
                 <menu_item_call.on_click
                  function="Edit.TakeOff"
@@ -3601,12 +3135,10 @@
         <menu
          create_jump_keys="true"
          label="Help"
-         layout="topleft"
          name="Help"
          tear_off="true">
             <menu_item_call
              label="Official Linden Blog"
-             layout="topleft"
              name="Official Linden Blog">
                 <menu_item_call.on_click
                  function="PromptShowURL"
@@ -3615,7 +3147,6 @@
             </menu_item_call>
             <menu_item_call
              label="Scripting Portal"
-             layout="topleft"
              name="Scripting Portal">
                 <menu_item_call.on_click
                  function="PromptShowURL"
@@ -3625,12 +3156,10 @@
             <menu
              create_jump_keys="true"
              label="Bug Reporting"
-             layout="topleft"
              name="Bug Reporting"
              tear_off="true">
                 <menu_item_call
                  label="Public Issue Tracker"
-                 layout="topleft"
                  name="Public Issue Tracker">
                     <menu_item_call.on_click
                      function="PromptShowURL"
@@ -3639,18 +3168,15 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Public Issue Tracker Help"
-                 layout="topleft"
                  name="Publc Issue Tracker Help">
                     <menu_item_call.on_click
                      function="PromptShowURL"
                      name="PublicIssueTrackerHelp_url"
                      parameter="WebLaunchPublicIssueHelp,http://wiki.secondlife.com/wiki/Issue_tracker" />
                 </menu_item_call>
-                <menu_item_separator
-                 layout="topleft" />
+                <menu_item_separator/>
                 <menu_item_call
                  label="Bug Reporting 101"
-                 layout="topleft"
                  name="Bug Reporing 101">
                     <menu_item_call.on_click
                      function="PromptShowURL"
@@ -3659,7 +3185,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="Security Issues"
-                 layout="topleft"
                  name="Security Issues">
                     <menu_item_call.on_click
                      function="PromptShowURL"
@@ -3668,7 +3193,6 @@
                 </menu_item_call>
                 <menu_item_call
                  label="QA Wiki"
-                 layout="topleft"
                  name="QA Wiki">
                     <menu_item_call.on_click
                      function="PromptShowURL"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index cc68ec2bdc..01adc00e1a 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -64,7 +64,6 @@ First name:
 </text>
 <line_editor
 follows="left|bottom"
-handle_edit_keys_directly="true"
 height="22"
 label="First"
 left_delta="0"
@@ -85,7 +84,6 @@ top_pad="0"
     Last name:   </text>
 <line_editor
 follows="left|bottom"
-handle_edit_keys_directly="true"
 height="22"
 label="Last"
 max_length="31"
@@ -106,7 +104,6 @@ top="20"
 </text>
 <line_editor
 follows="left|bottom"
-handle_edit_keys_directly="true"
   height="22"
   max_length="16"
 name="password_edit"
diff --git a/indra/newview/skins/default/xui/en/panel_place_profile.xml b/indra/newview/skins/default/xui/en/panel_place_profile.xml
index 9e5ef10d42..2efcfa5772 100644
--- a/indra/newview/skins/default/xui/en/panel_place_profile.xml
+++ b/indra/newview/skins/default/xui/en/panel_place_profile.xml
@@ -742,7 +742,6 @@
                          bg_focus_color="DkGray2"
                          bg_readonly_color="DkGray2"
                          follows="left|top|right"
-                         handle_edit_keys_directly="true"
                          height="90"
                          layout="topleft"
                          left="10"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index 2123e62daa..d75aba44e5 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -210,7 +210,6 @@
    enabled="false"
    follows="left|top"
    font="SansSerif"
-   handle_edit_keys_directly="true"
    height="23"
    layout="topleft"
    left="80"
diff --git a/indra/newview/skins/default/xui/en/panel_region_covenant.xml b/indra/newview/skins/default/xui/en/panel_region_covenant.xml
index dc8f71c868..2b2ea78fac 100644
--- a/indra/newview/skins/default/xui/en/panel_region_covenant.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_covenant.xml
@@ -113,7 +113,6 @@
      max_length="65535"
      name="covenant_editor"
      top_delta="30"
-     handle_edit_keys_directly="true"
      width="340"
      word_wrap="true">
         There is no Covenant provided for this Estate.
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 d444420550..c5c66c04d5 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -143,7 +143,6 @@
      name="Script Editor"
      width="487"
      show_line_numbers="true" 
-     handle_edit_keys_directly="true" 
      word_wrap="true">
         Loading...
     </text_editor>
diff --git a/indra/newview/skins/default/xui/en/widgets/line_editor.xml b/indra/newview/skins/default/xui/en/widgets/line_editor.xml
index a21e3f2645..a054960bf8 100644
--- a/indra/newview/skins/default/xui/en/widgets/line_editor.xml
+++ b/indra/newview/skins/default/xui/en/widgets/line_editor.xml
@@ -3,7 +3,6 @@
              background_image_disabled="TextField_Disabled"
              background_image_focused="TextField_Active"
              select_on_focus="false"
-             handle_edit_keys_directly="false"
              commit_on_focus_lost="true"
              ignore_tab="true"
              cursor_color="TextCursorColor"
-- 
cgit v1.2.3


From 656a533fac6c039ae7b38a6d33f7a28bc763d053 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Thu, 1 Apr 2010 12:41:41 -0700
Subject: EXT-6431 - Avatar head doesn't correctly follow mouse when side panel
 is open

---
 indra/newview/llagentcamera.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index bb06255fd1..66f9e1117b 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -1122,9 +1122,9 @@ void LLAgentCamera::updateLookAt(const S32 mouse_x, const S32 mouse_y)
 		{
 			// range from -.5 to .5
 			F32 x_from_center = 
-				((F32) mouse_x / (F32) gViewerWindow->getWindowWidthScaled() ) - 0.5f;
+				((F32) mouse_x / (F32) gViewerWindow->getWorldViewWidthScaled() ) - 0.5f;
 			F32 y_from_center = 
-				((F32) mouse_y / (F32) gViewerWindow->getWindowHeightScaled() ) - 0.5f;
+				((F32) mouse_y / (F32) gViewerWindow->getWorldViewHeightScaled() ) - 0.5f;
 
 			frameCamera.yaw( - x_from_center * gSavedSettings.getF32("YawFromMousePosition") * DEG_TO_RAD);
 			frameCamera.pitch( - y_from_center * gSavedSettings.getF32("PitchFromMousePosition") * DEG_TO_RAD);
-- 
cgit v1.2.3


From df45c16169bd2be38c53fd39fd87aa7b00bb64c2 Mon Sep 17 00:00:00 2001
From: Richard Nelson <none@none>
Date: Thu, 1 Apr 2010 12:49:23 -0700
Subject: removed unused textures reviewed by Erica

---
 .../default/textures/icons/Generic_Group_Large.png | Bin 2282 -> 0 bytes
 .../skins/default/textures/icons/Progress_1.png    | Bin 464 -> 0 bytes
 .../skins/default/textures/icons/Progress_10.png   | Bin 461 -> 0 bytes
 .../skins/default/textures/icons/Progress_11.png   | Bin 471 -> 0 bytes
 .../skins/default/textures/icons/Progress_12.png   | Bin 457 -> 0 bytes
 .../skins/default/textures/icons/Progress_2.png    | Bin 461 -> 0 bytes
 .../skins/default/textures/icons/Progress_3.png    | Bin 487 -> 0 bytes
 .../skins/default/textures/icons/Progress_4.png    | Bin 466 -> 0 bytes
 .../skins/default/textures/icons/Progress_5.png    | Bin 477 -> 0 bytes
 .../skins/default/textures/icons/Progress_6.png    | Bin 460 -> 0 bytes
 .../skins/default/textures/icons/Progress_7.png    | Bin 483 -> 0 bytes
 .../skins/default/textures/icons/Progress_8.png    | Bin 467 -> 0 bytes
 .../skins/default/textures/icons/Progress_9.png    | Bin 483 -> 0 bytes
 indra/newview/skins/default/textures/textures.xml  | 183 +--------------------
 14 files changed, 1 insertion(+), 182 deletions(-)
 delete mode 100644 indra/newview/skins/default/textures/icons/Generic_Group_Large.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_1.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_10.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_11.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_12.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_2.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_3.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_4.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_5.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_6.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_7.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_8.png
 delete mode 100644 indra/newview/skins/default/textures/icons/Progress_9.png

(limited to 'indra')

diff --git a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png b/indra/newview/skins/default/textures/icons/Generic_Group_Large.png
deleted file mode 100644
index 4d4f1e1bee..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Generic_Group_Large.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_1.png b/indra/newview/skins/default/textures/icons/Progress_1.png
deleted file mode 100644
index 58b56003c4..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_1.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_10.png b/indra/newview/skins/default/textures/icons/Progress_10.png
deleted file mode 100644
index 07fe0be8a3..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_10.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_11.png b/indra/newview/skins/default/textures/icons/Progress_11.png
deleted file mode 100644
index 215d68cc46..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_11.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_12.png b/indra/newview/skins/default/textures/icons/Progress_12.png
deleted file mode 100644
index d755588621..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_12.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_2.png b/indra/newview/skins/default/textures/icons/Progress_2.png
deleted file mode 100644
index 6640ee227b..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_2.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_3.png b/indra/newview/skins/default/textures/icons/Progress_3.png
deleted file mode 100644
index 5decbe977e..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_3.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_4.png b/indra/newview/skins/default/textures/icons/Progress_4.png
deleted file mode 100644
index 56e81c17aa..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_4.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_5.png b/indra/newview/skins/default/textures/icons/Progress_5.png
deleted file mode 100644
index a89bf2ac62..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_5.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_6.png b/indra/newview/skins/default/textures/icons/Progress_6.png
deleted file mode 100644
index 233c479540..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_6.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_7.png b/indra/newview/skins/default/textures/icons/Progress_7.png
deleted file mode 100644
index 631d7a6819..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_7.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_8.png b/indra/newview/skins/default/textures/icons/Progress_8.png
deleted file mode 100644
index ac0e3f13f7..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_8.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/icons/Progress_9.png b/indra/newview/skins/default/textures/icons/Progress_9.png
deleted file mode 100644
index 17fb4a0335..0000000000
Binary files a/indra/newview/skins/default/textures/icons/Progress_9.png and /dev/null differ
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index fed326c25e..41bcc62220 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -1,4 +1,4 @@
-<!--
+<!--
 This file contains metadata about how to load, display, and scale textures for rendering in the UI.
 Images do *NOT* have to appear in this file in order to use them as textures in the UI...simply refer
 to them by filename (relative to textures directory).
@@ -46,13 +46,9 @@ with the same filename but different name
   <texture name="AddItem_Press" file_name="icons/AddItem_Press.png" preload="false" />
 
   <texture name="Arrow_Left_Off" file_name="navbar/Arrow_Left_Off.png" preload="true" />
-  <texture name="Arrow_Left_Press" file_name="navbar/Arrow_Left_Press.png" preload="true" />
   <texture name="Arrow_Right_Off" file_name="navbar/Arrow_Right_Off.png" preload="true" />
-  <texture name="Arrow_Right_Press" file_name="navbar/Arrow_Right_Press.png" preload="true" />
 
 <!--
-  <texture name="Arrow_Left" file_name="widgets/Arrow_Left.png" preload="true" />
-  <texture name="Arrow_Right" file_name="widgets/Arrow_Right.png" preload="true" />
 -->
 
   <texture name="Arrow_Small_Up" file_name="widgets/Arrow_Small_Up.png" preload="true" />
@@ -64,49 +60,28 @@ with the same filename but different name
 
   <texture name="AudioMute_Off" file_name="icons/AudioMute_Off.png" preload="false" />
   <texture name="AudioMute_Over" file_name="icons/AudioMute_Over.png" preload="false" />
-  <texture name="AudioMute_Press" file_name="icons/AudioMute_Press.png" preload="false" />
 
   <texture name="Audio_Off" file_name="icons/Audio_Off.png" preload="false" />
-  <texture name="Audio_Over" file_name="icons/Audio_Over.png" preload="false" />
   <texture name="Audio_Press" file_name="icons/Audio_Press.png" preload="false" />
 
   <texture name="Avaline_Icon" file_name="icons/avaline_default_icon.jpg" preload="true" />
 
-  <texture name="BackArrow_Disabled" file_name="icons/BackArrow_Disabled.png" preload="false" />
   <texture name="BackArrow_Off" file_name="icons/BackArrow_Off.png" preload="false" />
-  <texture name="BackArrow_Press" file_name="icons/BackArrow_Press.png" preload="false" />
 
   <texture name="Blank" file_name="Blank.png" preload="false" />
 
-  <texture name="BottomTray_BG" file_name="bottomtray/BottomTray_BG.png" preload="false" />
-  <texture name="BottomTray_Scroll_Right" file_name="navbar/Arrow_Right_Off.png" preload="false" />
-  <texture name="BottomTray_Scroll_Left" file_name="navbar/Arrow_Left_Off.png" preload="false" />
 
-  <texture name="BuyArrow_Off" file_name="navbar/BuyArrow_Off.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0"  />
   <texture name="BuyArrow_Over" file_name="navbar/BuyArrow_Over.png" preload="true" scale.left="0" scale.top="1" scale.right="0" scale.bottom="0"  />
   <texture name="BuyArrow_Press" file_name="navbar/BuyArrow_Press.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0"  />
 
-  <texture name="Cam_Avatar_Disabled" file_name="bottomtray/Cam_Avatar_Disabled.png" preload="false" />
-  <texture name="Cam_Avatar_Over" file_name="bottomtray/Cam_Avatar_Over.png" preload="false" />
   <texture name="Cam_Avatar_Off" file_name="bottomtray/Cam_Avatar_Off.png" preload="false" />
-  <texture name="Cam_Avatar_Press" file_name="bottomtray/Cam_Avatar_Press.png" preload="false" />
-  <texture name="Cam_FreeCam_Disabled" file_name="bottomtray/Cam_FreeCam_Disabled.png" preload="false" />
   <texture name="Cam_FreeCam_Off" file_name="bottomtray/Cam_FreeCam_Off.png" preload="false" />
-  <texture name="Cam_FreeCam_Over" file_name="bottomtray/Cam_FreeCam_Over.png" preload="false" />
-  <texture name="Cam_FreeCam_Press" file_name="bottomtray/Cam_FreeCam_Press.png" preload="false" />
-  <texture name="Cam_Orbit_Disabled" file_name="bottomtray/Cam_Orbit_Disabled.png" preload="false" />
   <texture name="Cam_Orbit_Off" file_name="bottomtray/Cam_Orbit_Off.png" preload="false" />
-  <texture name="Cam_Orbit_Over" file_name="bottomtray/Cam_Orbit_Over.png" preload="false" />
-  <texture name="Cam_Orbit_Press" file_name="bottomtray/Cam_Orbit_Press.png" preload="false" />
-  <texture name="Cam_Pan_Disabled" file_name="bottomtray/Cam_Pan_Disabled.png" preload="false" />
   <texture name="Cam_Pan_Off" file_name="bottomtray/Cam_Pan_Off.png" preload="false" />
-  <texture name="Cam_Pan_Over" file_name="bottomtray/CCam_Pan_Over.png" preload="false" />
-  <texture name="Cam_Pan_Press" file_name="bottomtray/Cam_Pan_Press.png" preload="false" />
 
   <texture name="Cam_Preset_Back_Off" file_name="bottomtray/Cam_Preset_Back_Off.png" preload="false" />
   <texture name="Cam_Preset_Back_On" file_name="bottomtray/Cam_Preset_Back_On.png" preload="false" />
   <texture name="Cam_Preset_Eye_Off" file_name="bottomtray/Cam_Preset_Eye_Off.png" preload="false" />
-  <texture name="Cam_Preset_Eye_On" file_name="bottomtray/Cam_Preset_Eye_On.png" preload="false" />
   <texture name="Cam_Preset_Front_Off" file_name="bottomtray/Cam_Preset_Front_Off.png" preload="false" />
   <texture name="Cam_Preset_Front_On" file_name="bottomtray/Cam_Preset_Front_On.png" preload="false" />
   <texture name="Cam_Preset_Side_Off" file_name="bottomtray/Cam_Preset_Side_Off.png" preload="false" />
@@ -116,8 +91,6 @@ with the same filename but different name
   <texture name="Cam_Rotate_Out" file_name="bottomtray/Cam_Rotate_Out.png" preload="false" />
   <texture name="Cam_Tracking_In" file_name="bottomtray/Cam_Tracking_In.png" preload="false" />
   <texture name="Cam_Tracking_Out" file_name="bottomtray/Cam_Tracking_Out.png" preload="false" />
-  <texture name="CameraView_Off" file_name="bottomtray/CameraView_Off.png" preload="false" />
-  <texture name="CameraView_Over" file_name="bottomtray/CameraView_Over.png" preload="false" />
 
   <texture name="Checkbox_Off_Disabled" file_name="widgets/Checkbox_Disabled.png" preload="true" />
   <texture name="Checkbox_On_Disabled" file_name="widgets/Checkbox_On_Disabled.png" preload="true" />
@@ -127,8 +100,6 @@ with the same filename but different name
   <texture name="Checkbox_Press" file_name="widgets/Checkbox_Press.png" preload="true" />
 
   <texture name="ComboButton_Disabled" file_name="widgets/ComboButton_Disabled.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
-  <texture name="ComboButton_Over" file_name="widgets/ComboButton_Over.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
-  <texture name="ComboButton_Press" file_name="widgets/ComboButton_Press.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
   <texture name="ComboButton_Selected" file_name="widgets/ComboButton_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
   <texture name="ComboButton_UpSelected" file_name="widgets/ComboButton_UpSelected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
   <texture name="ComboButton_Up_On_Selected" file_name="widgets/ComboButton_Up_On_Selected.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
@@ -136,25 +107,18 @@ with the same filename but different name
   <texture name="ComboButton_UpOff" file_name="widgets/ComboButton_UpOff.png" preload="true" scale.left="2" scale.top="19" scale.right="18" scale.bottom="2" />
   <texture name="Container" file_name="containers/Container.png" preload="false" />
 
-  <texture name="DisclosureArrow_Closed_Off" file_name="widgets/DisclosureArrow_Closed_Off.png" preload="true" />
-  <texture name="DisclosureArrow_Closed_Press" file_name="widgets/DisclosureArrow_Closed_Press.png" preload="true" />
   <texture name="DisclosureArrow_Opened_Off" file_name="widgets/DisclosureArrow_Opened_Off.png" preload="true" />
-  <texture name="DisclosureArrow_Opened_Press" file_name="widgets/DisclosureArrow_Opened_Press.png" preload="true" />
 
   <texture name="DownArrow" file_name="bottomtray/DownArrow.png" preload="false" />
 
   <texture name="DropDown_Disabled" file_name="widgets/DropDown_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
-  <texture name="DropDown_Over" file_name="widgets/DropDown_Over.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
   <texture name="DropDown_Press" file_name="widgets/DropDown_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
-  <texture name="DropDown_Selected" file_name="widgets/DropDown_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
   <texture name="DropDown_On" file_name="widgets/DropDown_On.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
   <texture name="DropDown_Off" file_name="widgets/DropDown_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="99" scale.bottom="4" />
 
   <texture name="DropTarget" file_name="widgets/DropTarget.png" preload="false" />
 
   <texture name="ExternalBrowser_Off" file_name="icons/ExternalBrowser_Off.png" preload="false" />
-  <texture name="ExternalBrowser_Over" file_name="icons/ExternalBrowser_Over.png" preload="false" />
-  <texture name="ExternalBrowser_Press" file_name="icons/ExternalBrowser_Press.png" preload="false" />
 
   <texture name="Favorite_Star_Active" file_name="navbar/Favorite_Star_Active.png" preload="false" />
   <texture name="Favorite_Star_Off" file_name="navbar/Favorite_Star_Off.png" preload="false" />
@@ -162,8 +126,6 @@ with the same filename but different name
   <texture name="Favorite_Star_Over" file_name="navbar/Favorite_Star_Over.png" preload="false" />
   <texture name="Favorite_Link_Over" file_name="navbar/Favorite_Link_Over.png" preload="false" />
 
-  <texture name="FileMenu_BarSelect" file_name="navbar/FileMenu_BarSelect.png" preload="false" scale.left="2" scale.top="0" scale.right="2" scale.bottom="0" />
-  <texture name="FileMenu_BG" file_name="navbar/FileMenu_BG.png" preload="false" />
 
   <texture name="Flag" file_name="navbar/Flag.png" preload="false" />
 
@@ -174,22 +136,16 @@ with the same filename but different name
 
   <texture name="Generic_Group" file_name="icons/Generic_Group.png" preload="false" />
   <texture name="icon_group.tga" file_name="icons/Generic_Group.png" preload="false" />
-  <texture name="Generic_Group_Large" file_name="icons/Generic_Group_Large.png" preload="false" />
-  <texture name="Generic_Object_Medium" file_name="icons/Generic_Object_Medium.png" preload="false" />
   <texture name="Generic_Object_Small" file_name="icons/Generic_Object_Small.png" preload="false" />
-  <texture name="Generic_Object_Large" file_name="icons/Generic_Object_Large.png" preload="false" />
   <texture name="Generic_Person" file_name="icons/Generic_Person.png" preload="false" />
   <texture name="Generic_Person_Large" file_name="icons/Generic_Person_Large.png" preload="false" />
 
   <texture name="Health" file_name="icons/Health.png" preload="false" />
 
-  <texture name="Help_Off" file_name="navbar/Help_Off.png" preload="false" />
   <texture name="Help_Press" file_name="navbar/Help_Press.png" preload="false" />
 
-  <texture name="History_Arrow" file_name="navbar/History_Arrow.png" preload="true" />
 
   <texture name="Home_Off" file_name="navbar/Home_Off.png" preload="false" />
-  <texture name="Home_Press" file_name="navbar/Home_Press.png" preload="false" />
 
   <texture name="Icon_Close_Foreground" file_name="windows/Icon_Close_Foreground.png" preload="true" />
   <texture name="Icon_Close_Press" file_name="windows/Icon_Close_Press.png" preload="true" />
@@ -206,7 +162,6 @@ with the same filename but different name
 
   <texture name="Icon_Help_Foreground" file_name="windows/Icon_Help_Foreground.png" preload="true" />
   <texture name="Icon_Help_Press" file_name="windows/Icon_Help_Press.png" preload="true" />
-  <texture name="Icon_Info" file_name="windows/Icon_Info.png" preload="false" />
 
   <texture name="Icon_Minimize_Foreground" file_name="windows/Icon_Minimize_Foreground.png" preload="true" />
   <texture name="Icon_Minimize_Press" file_name="windows/Icon_Minimize_Press.png" preload="true" />
@@ -225,13 +180,11 @@ with the same filename but different name
   <texture name="Inspector_Hover" file_name="windows/Inspector_Hover.png" preload="false" />
   <texture name="Inspector_I" file_name="windows/Inspector_I.png" preload="false" />
 
-  <texture name="Inv_Acessories" file_name="icons/Inv_Accessories.png" preload="false" />
   <texture name="Inv_Alpha" file_name="icons/Inv_Alpha.png" preload="false" />
   <texture name="Inv_Animation" file_name="icons/Inv_Animation.png" preload="false" />
   <texture name="Inv_BodyShape" file_name="icons/Inv_BodyShape.png" preload="false" />
   <texture name="Inv_CallingCard" file_name="icons/Inv_CallingCard.png" preload="false" />
   <texture name="Inv_Clothing" file_name="icons/Inv_Clothing.png" preload="false" />
-  <texture name="Inv_DangerousScript" file_name="icons/Inv_DangerousScript.png" preload="false" />
   <texture name="Inv_Eye" file_name="icons/Inv_Eye.png" preload="false" />
   <texture name="Inv_FolderClosed" file_name="icons/Inv_FolderClosed.png" preload="false" />
   <texture name="Inv_FolderOpen" file_name="icons/Inv_FolderOpen.png" preload="false" />
@@ -239,7 +192,6 @@ with the same filename but different name
   <texture name="Inv_Gloves" file_name="icons/Inv_Gloves.png" preload="false" />
   <texture name="Inv_Hair" file_name="icons/Inv_Hair.png" preload="false" />
   <texture name="Inv_LinkItem" file_name="icons/Inv_LinkItem.png" preload="false" />
-  <texture name="Inv_LinkItem_Broken" file_name="icons/Inv_LinkItem_Broken.png" preload="false" />
   <texture name="Inv_LinkFolder" file_name="icons/Inv_LinkFolder.png" preload="false" />
   <texture name="Inv_Jacket" file_name="icons/Inv_Jacket.png" preload="false" />
   <texture name="Inv_LookFolderOpen" file_name="icons/Inv_LookFolderOpen.png" preload="false" />
@@ -259,7 +211,6 @@ with the same filename but different name
   <texture name="Inv_Sound" file_name="icons/Inv_Sound.png" preload="false" />
   <texture name="Inv_Tattoo" file_name="icons/Inv_Tattoo.png" preload="false" />
   <texture name="Inv_Texture" file_name="icons/Inv_Texture.png" preload="false" />
-  <texture name="Inv_Trash" file_name="icons/Inv_Trash.png" preload="false" />
   <texture name="Inv_Underpants" file_name="icons/Inv_Underpants.png" preload="false" />
   <texture name="Inv_Undershirt" file_name="icons/Inv_Undershirt.png" preload="false" />
 
@@ -272,9 +223,7 @@ with the same filename but different name
   <texture name="Lock" file_name="icons/Lock.png" preload="false" />
   <texture name="Lock2" file_name="navbar/Lock.png" preload="false" />
 
-  <texture name="Login_Pod" file_name="windows/Login_Pod.png" preload="true" />
 
-  <texture name="Microphone_Mute" file_name="icons/Microphone_Mute.png" preload="false" />
   <texture name="Microphone_On" file_name="icons/Microphone_On.png" preload="false" />
 
   <texture name="MinusItem_Disabled" file_name="icons/MinusItem_Disabled.png" preload="false" />
@@ -283,18 +232,9 @@ with the same filename but different name
 
   <texture name="menu_separator" file_name="navbar/FileMenu_Divider.png" scale.left="4" scale.top="166" scale.right="0" scale.bottom="0" />
 
-  <texture name="Move_Fly_Disabled" file_name="bottomtray/Move_Fly_Disabled.png" preload="false" />
   <texture name="Move_Fly_Off" file_name="bottomtray/Move_Fly_Off.png" preload="false" />
-  <texture name="Move_Fly_Over" file_name="bottomtray/Move_Fly_Over.png" preload="false" />
-  <texture name="Move_Fly_Press" file_name="bottomtray/Move_Fly_Press.png" preload="false" />
-  <texture name="Move_Run_Disabled" file_name="bottomtray/Move_Run_Disabled.png" preload="false" />
   <texture name="Move_Run_Off" file_name="bottomtray/Move_Run_Off.png" preload="false" />
-  <texture name="Move_Run_Over" file_name="bottomtray/Move_Run_Over.png" preload="false" />
-  <texture name="Move_Run_Press" file_name="bottomtray/Move_Run_Press.png" preload="false" />
-  <texture name="Move_Walk_Disabled" file_name="bottomtray/Move_Walk_Disabled.png" preload="false" />
   <texture name="Move_Walk_Off" file_name="bottomtray/Move_Walk_Off.png" preload="false" />
-  <texture name="Move_Walk_Over" file_name="bottomtray/Move_Walk_Over.png" preload="false" />
-  <texture name="Move_Walk_Press" file_name="bottomtray/Move_Walk_Press.png" preload="false" />
   <texture name="Movement_Backward_Off" file_name="bottomtray/Movement_Backward_Off.png" preload="false" />
   <texture name="Movement_Backward_On" file_name="bottomtray/Movement_Backward_On.png" preload="false" />
   <texture name="Movement_Down_Off" file_name="bottomtray/Movement_Down_Off.png" preload="false" />
@@ -311,10 +251,6 @@ with the same filename but different name
   <texture name="NavBar_BG_NoFav" file_name="navbar/NavBar_BG_NoFav.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
   <texture name="NavBar_BG" file_name="navbar/NavBar_BG.png" preload="true" scale.left="1" scale.top="1" scale.right="0" scale.bottom="0" />
 
-  <texture name="NearbyVoice_Lvl1" file_name="bottomtray/NearbyVoice_Lvl1.png" preload="false" />
-  <texture name="NearbyVoice_Lvl2" file_name="bottomtray/NearbyVoice_Lvl2.png" preload="false" />
-  <texture name="NearbyVoice_Lvl3" file_name="bottomtray/NearbyVoice_Lvl3.png" preload="false" />
-  <texture name="NearbyVoice_On" file_name="bottomtray/NearbyVoice_On.png" preload="false" />
 
   <texture name="Notices_Unread" file_name="bottomtray/Notices_Unread.png" preload="true" />
 
@@ -356,27 +292,15 @@ with the same filename but different name
   <texture name="OptionsMenu_Off" file_name="icons/OptionsMenu_Off.png" preload="false" />
   <texture name="OptionsMenu_Press" file_name="icons/OptionsMenu_Press.png" preload="false" />
 
-  <texture name="Overhead_Arrow_L" file_name="world/Overhead_Arrow_L.png" preload="false" />
-  <texture name="Overhead_Arrow_M" file_name="world/Overhead_Arrow_M.png" preload="false" />
-  <texture name="Overhead_Arrow_S" file_name="world/Overhead_Arrow_S.png" preload="false" />
-  <texture name="Overhead_L" file_name="world/Overhead_L.png" preload="false" />
-  <texture name="Overhead_M" file_name="world/Overhead_M.png" preload="false" />
-  <texture name="Overhead_S" file_name="world/Overhead_S.png" preload="false" />
 
-  <texture name="Parcel_Evry_Color" file_name="icons/Parcel_Evry_Color.png" preload="false" />
   <texture name="Parcel_Exp_Color" file_name="icons/Parcel_Exp_Color.png" preload="false" />
-  <texture name="Parcel_M_Color" file_name="icons/Parcel_M_Color.png" preload="false" />
 
  <texture name="Parcel_Build_Dark" file_name="icons/Parcel_Build_Dark.png" preload="false" />
  <texture name="Parcel_BuildNo_Dark" file_name="icons/Parcel_BuildNo_Dark.png" preload="false" />
  <texture name="Parcel_Damage_Dark" file_name="icons/Parcel_Damage_Dark.png" preload="false" />
  <texture name="Parcel_DamageNo_Dark" file_name="icons/Parcel_DamageNo_Dark.png" preload="false" />
- <texture name="Parcel_Evry_Dark" file_name="icons/Parcel_Evry_Dark.png" preload="false" />
- <texture name="Parcel_Exp_Dark" file_name="icons/Parcel_Exp_Dark.png" preload="false" />
  <texture name="Parcel_Fly_Dark" file_name="icons/Parcel_Fly_Dark.png" preload="false" />
  <texture name="Parcel_FlyNo_Dark" file_name="icons/Parcel_FlyNo_Dark.png" preload="false" />
- <texture name="Parcel_ForSale_Dark" file_name="icons/Parcel_ForSale_Dark.png" preload="false" />
- <texture name="Parcel_ForSaleNo_Dark" file_name="icons/Parcel_ForSaleNo_Dark.png" preload="false" />
  <texture name="Parcel_Health_Dark" file_name="icons/Parcel_Health_Dark.png" preload="false" />
  <texture name="Parcel_M_Dark" file_name="icons/Parcel_M_Dark.png" preload="false" />
  <texture name="Parcel_PG_Dark" file_name="icons/Parcel_PG_Dark.png" preload="false" />
@@ -388,22 +312,13 @@ with the same filename but different name
  <texture name="Parcel_Voice_Dark" file_name="icons/Parcel_Voice_Dark.png" preload="false" />
  <texture name="Parcel_VoiceNo_Dark" file_name="icons/Parcel_VoiceNo_Dark.png" preload="false" />
 
- <texture name="Parcel_Build_Light" file_name="icons/Parcel_Build_Light.png" preload="false" />
  <texture name="Parcel_BuildNo_Light" file_name="icons/Parcel_BuildNo_Light.png" preload="false" />
- <texture name="Parcel_Damage_Light" file_name="icons/Parcel_Damage_Light.png" preload="false" />
- <texture name="Parcel_DamageNo_Light" file_name="icons/Parcel_DamageNo_Light.png" preload="false" />
- <texture name="Parcel_Evry_Light" file_name="icons/Parcel_Evry_Light.png" preload="false" />
- <texture name="Parcel_Exp_Light" file_name="icons/Parcel_Exp_Light.png" preload="false" />
- <texture name="Parcel_Fly_Light" file_name="icons/Parcel_Fly_Light.png" preload="false" />
  <texture name="Parcel_FlyNo_Light" file_name="icons/Parcel_FlyNo_Light.png" preload="false" />
  <texture name="Parcel_ForSale_Light" file_name="icons/Parcel_ForSale_Light.png" preload="false" />
- <texture name="Parcel_ForSaleNo_Light" file_name="icons/Parcel_ForSaleNo_Light.png" preload="false" />
  <texture name="Parcel_M_Light" file_name="icons/Parcel_M_Light.png" preload="false" />
  <texture name="Parcel_PG_Light" file_name="icons/Parcel_PG_Light.png" preload="false" />
- <texture name="Parcel_Push_Light" file_name="icons/Parcel_Push_Light.png" preload="false" />
  <texture name="Parcel_PushNo_Light" file_name="icons/Parcel_PushNo_Light.png" preload="false" />
  <texture name="Parcel_R_Light" file_name="icons/Parcel_R_Light.png" preload="false" />
- <texture name="Parcel_Scripts_Light" file_name="icons/Parcel_Scripts_Light.png" preload="false" />
  <texture name="Parcel_ScriptsNo_Light" file_name="icons/Parcel_ScriptsNo_Dark.png" preload="false" />
  <texture name="Parcel_Voice_Light" file_name="icons/Parcel_Voice_Light.png" preload="false" />
  <texture name="Parcel_VoiceNo_Light" file_name="icons/Parcel_VoiceNo_Light.png" preload="false" />
@@ -415,18 +330,6 @@ with the same filename but different name
   <texture name="Play_Over" file_name="icons/Play_Over.png" preload="false" />
   <texture name="Play_Press" file_name="icons/Play_Press.png" preload="false" />
 
-  <texture name="Progress_1" file_name="icons/Progress_1.png" preload="false" />
-  <texture name="Progress_2" file_name="icons/Progress_2.png" preload="false" />
-  <texture name="Progress_3" file_name="icons/Progress_3.png" preload="false" />
-  <texture name="Progress_4" file_name="icons/Progress_4.png" preload="false" />
-  <texture name="Progress_5" file_name="icons/Progress_5.png" preload="false" />
-  <texture name="Progress_6" file_name="icons/Progress_6.png" preload="false" />
-  <texture name="Progress_7" file_name="icons/Progress_7.png" preload="false" />
-  <texture name="Progress_8" file_name="icons/Progress_8.png" preload="false" />
-  <texture name="Progress_9" file_name="icons/Progress_9.png" preload="false" />
-  <texture name="Progress_10" file_name="icons/Progress_10.png" preload="false" />
-  <texture name="Progress_11" file_name="icons/Progress_11.png" preload="false" />
-  <texture name="Progress_12" file_name="icons/Progress_12.png" preload="false" />
 
   <texture name="ProgressBar" file_name="widgets/ProgressBar.png" preload="true" scale.left="4" scale.top="10" scale.right="48" scale.bottom="2" />
   <texture name="ProgressTrack" file_name="widgets/ProgressTrack.png" preload="true" scale.left="4" scale.top="13" scale.right="148" scale.bottom="2" />
@@ -435,7 +338,6 @@ with the same filename but different name
   <texture name="PushButton_Off" file_name="widgets/PushButton_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="PushButton_On" file_name="widgets/PushButton_On.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="PushButton_On_Selected" file_name="widgets/PushButton_On_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
-  <texture name="PushButton_On_Disabled" file_name="widgets/PushButton_On_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="PushButton_Press" file_name="widgets/PushButton_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="PushButton_Selected" file_name="widgets/PushButton_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="PushButton_Selected_Press" file_name="widgets/PushButton_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
@@ -448,12 +350,8 @@ with the same filename but different name
   <texture name="RadioButton_Disabled" file_name="widgets/RadioButton_Disabled.png" preload="true" />
   <texture name="RadioButton_On_Disabled" file_name="widgets/RadioButton_On_Disabled.png" preload="true" />
 
-  <texture name="Rec_Off" file_name="icons/Rec_Off.png" preload="false" />
-  <texture name="Rec_On" file_name="icons/Rec_On.png" preload="false" />
 
-  <texture name="Refresh_Disabled" file_name="icons/Refresh_Disabled.png" preload="false" />
   <texture name="Refresh_Off" file_name="icons/Refresh_Off.png" preload="false" />
-  <texture name="Refresh_Press" file_name="icons/Refresh_Press.png" preload="false" />
 
   <texture name="Resize_Corner" file_name="windows/Resize_Corner.png" preload="true" />
 
@@ -470,11 +368,6 @@ with the same filename but different name
   <texture name="ScrollTrack_Vert" file_name="widgets/ScrollTrack_Vert.png" preload="true" scale.left="2" scale.top="40" scale.bottom="13" scale.right="0" />
   <texture name="ScrollTrack_Horiz" file_name="widgets/ScrollTrack_Horiz.png" preload="true" scale.left="4" scale.top="0" scale.bottom="0" scale.right="2" />
 
-  <texture name="ScrubberThumb_Disabled" file_name="widgets/ScrubberThumb_Disabled.png" preload="false" />
-  <texture name="ScrubberThumb_Focus" file_name="widgets/ScrubberThumb_Focus.png" preload="false" />
-  <texture name="ScrubberThumb_Off" file_name="widgets/ScrubberThumb_Off.png" preload="false" />
-  <texture name="ScrubberThumb_Over" file_name="widgets/ScrubberThumb_Over.png" preload="false" />
-  <texture name="ScrubberThumb_Press" file_name="widgets/ScrubberThumb_Press.png" preload="false" />
 
   <texture name="Search" file_name="navbar/Search.png" preload="false" />
 
@@ -487,8 +380,6 @@ with the same filename but different name
   <texture name="SegmentedBtn_Left_Selected_Press" file_name="widgets/SegmentedBtn_Left_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Left_Selected_Disabled" file_name="widgets/SegmentedBtn_Left_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
 
-  <texture name="SegmentedBtn_Middle_Off" file_name="widgets/SegmentedBtn_Middle_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
-  <texture name="SegmentedBtn_Middle_Press" file_name="widgets/SegmentedBtn_Middle_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Middle_Disabled" file_name="widgets/SegmentedBtn_Middle_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Middle_Selected" file_name="widgets/SegmentedBtn_Middle_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
   <texture name="SegmentedBtn_Middle_Selected_Press" file_name="widgets/SegmentedBtn_Middle_Selected_Press.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
@@ -503,11 +394,7 @@ with the same filename but different name
   <texture name="SegmentedBtn_Right_Selected_Disabled" file_name="widgets/SegmentedBtn_Right_Selected_Disabled.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
 
   <texture name="SkipBackward_Off" file_name="icons/SkipBackward_Off.png" preload="false" />
-  <texture name="SkipBackward_Over" file_name="icons/SkipBackward_Over.png" preload="false" />
-  <texture name="SkipBackward_Press" file_name="icons/SkipBackward_Press.png" preload="false" />
   <texture name="SkipForward_Off" file_name="icons/SkipForward_Off.png" preload="false" />
-  <texture name="SkipForward_Over" file_name="icons/SkipForward_Over.png" preload="false" />
-  <texture name="SkipForward_Press" file_name="icons/SkipForward_Press.png" preload="false" />
 
   <texture name="SliderTrack_Horiz" file_name="widgets/SliderTrack_Horiz.png" scale.left="4" scale.top="4" scale.right="100" scale.bottom="2" />
   <texture name="SliderTrack_Vert" file_name="widgets/SliderTrack_Vert.png" scale.left="2" scale.top="100" scale.right="4" scale.bottom="4" />
@@ -520,63 +407,35 @@ with the same filename but different name
   <texture name="Unknown_Icon" file_name="icons/unknown_icon.png" preload="true" />
 
   <texture name="Snapshot_Off" file_name="bottomtray/Snapshot_Off.png" preload="true" scale.left="4" scale.top="19" scale.right="22" scale.bottom="4" />
-  <texture name="Snapshot_Over" file_name="bottomtray/Snapshot_Over.png" preload="false" />
-  <texture name="Snapshot_Press" file_name="bottomtray/Snapshot_Press.png" preload="false" />
 
   <texture name="startup_logo"  file_name="windows/startup_logo.png" preload="true" />
 
-  <texture name="Stepper_Down_Disabled" file_name="widgets/Stepper_Down_Disabled.png" preload="false" />
   <texture name="Stepper_Down_Off" file_name="widgets/Stepper_Down_Off.png" preload="false" />
   <texture name="Stepper_Down_Press" file_name="widgets/Stepper_Down_Press.png" preload="false" />
-  <texture name="Stepper_Up_Disabled" file_name="widgets/Stepper_Up_Disabled.png" preload="false" />
   <texture name="Stepper_Up_Off" file_name="widgets/Stepper_Up_Off.png" preload="false" />
   <texture name="Stepper_Up_Press" file_name="widgets/Stepper_Up_Press.png" preload="false" />
 
   <texture name="Stop_Off" file_name="icons/Stop_Off.png" preload="false" />
-  <texture name="Stop_Over" file_name="icons/Stop_Over.png" preload="false" />
-  <texture name="Stop_Press" file_name="icons/Stop_Press.png" preload="false" />
   <texture name="StopReload_Off" file_name="icons/StopReload_Off.png" preload="false" />
   <texture name="StopReload_Over" file_name="icons/StopReload_Over.png" preload="false" />
-  <texture name="StopReload_Press" file_name="icons/StopReload_Press.png" preload="false" />
 
-  <texture name="TabIcon_Appearance_Large" file_name="taskpanel/TabIcon_Appearance_Large.png" preload="false" />
   <texture name="TabIcon_Appearance_Off" file_name="taskpanel/TabIcon_Appearance_Off.png" preload="false" />
-  <texture name="TabIcon_Appearance_Over" file_name="taskpanel/TabIcon_Appearance_Over.png" preload="false" />
   <texture name="TabIcon_Appearance_Selected" file_name="taskpanel/TabIcon_Appearance_Selected.png" preload="false" />
   <texture name="TabIcon_Close_Off" file_name="taskpanel/TabIcon_Close_Off.png" preload="false" />
-  <texture name="TabIcon_Close_Over" file_name="taskpanel/TabIcon_Close_Over.png" preload="false" />
-  <texture name="TabIcon_Inventory_Large" file_name="taskpanel/TabIcon_Inventory_Large.png" preload="false" />
-  <texture name="TabIcon_Inventory_Off" file_name="taskpanel/TabIcon_Inventory_Off.png" preload="false" />
-  <texture name="TabIcon_Inventory_Over" file_name="taskpanel/TabIcon_Inventory_Over.png" preload="false" />
-  <texture name="TabIcon_Inventory_Selected" file_name="taskpanel/TabIcon_Inventory_Selected.png" preload="false" />
-  <texture name="TabIcon_Home_Large" file_name="taskpanel/TabIcon_Home_Large.png" preload="false" />
   <texture name="TabIcon_Home_Off" file_name="taskpanel/TabIcon_Home_Off.png" preload="false" />
-  <texture name="TabIcon_Home_Over" file_name="taskpanel/TabIcon_Home_Over.png" preload="false" />
   <texture name="TabIcon_Home_Selected" file_name="taskpanel/TabIcon_Home_Selected.png" preload="false" />
-  <texture name="TabIcon_Me_Large" file_name="taskpanel/TabIcon_Me_Large.png" preload="false" />
   <texture name="TabIcon_Me_Off" file_name="taskpanel/TabIcon_Me_Off.png" preload="false" />
-  <texture name="TabIcon_Me_Over" file_name="taskpanel/TabIcon_Me_Over.png" preload="false" />
   <texture name="TabIcon_Me_Selected" file_name="taskpanel/TabIcon_Me_Selected.png" preload="false" />
   <texture name="TabIcon_Open_Off" file_name="taskpanel/TabIcon_Open_Off.png" preload="false" />
-  <texture name="TabIcon_Open_Over" file_name="taskpanel/TabIcon_Open_Over.png" preload="false" />
-  <texture name="TabIcon_People_Large" file_name="taskpanel/TabIcon_People_Large.png" preload="false" />
   <texture name="TabIcon_People_Off" file_name="taskpanel/TabIcon_People_Off.png" preload="false" />
-  <texture name="TabIcon_People_Over" file_name="taskpanel/TabIcon_People_Over.png" preload="false" />
   <texture name="TabIcon_People_Selected" file_name="taskpanel/TabIcon_People_Selected.png" preload="false" />
   <texture name="TabIcon_Places_Large" file_name="taskpanel/TabIcon_Places_Large.png" preload="false" />
   <texture name="TabIcon_Places_Off" file_name="taskpanel/TabIcon_Places_Off.png" preload="false" />
-  <texture name="TabIcon_Places_Over" file_name="taskpanel/TabIcon_Places_Over.png" preload="false" />
   <texture name="TabIcon_Places_Selected" file_name="taskpanel/TabIcon_Places_Selected.png" preload="false" />
-  <texture name="TabIcon_Things_Large" file_name="taskpanel/TabIcon_Things_Large.png" preload="false" />
   <texture name="TabIcon_Things_Off" file_name="taskpanel/TabIcon_Things_Off.png" preload="false" />
-  <texture name="TabIcon_Things_Over" file_name="taskpanel/TabIcon_Things_Over.png" preload="false" />
   <texture name="TabIcon_Things_Selected" file_name="taskpanel/TabIcon_Things_Selected.png" preload="false" />
 
-  <texture name="TabTop_Divider" file_name="containers/TabTop_Divider.png" preload="false" />
-  <texture name="TabTop_Left_Press" file_name="containers/TabTop_Left_Press.png" preload="false" />
-  <texture name="TabTop_Middle_Press" file_name="containers/TabTop_Middle_Press.png" preload="false" />
   <texture name="TabTop_Right_Off" file_name="containers/TabTop_Right_Off.png" preload="false"  scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" />
-  <texture name="TabTop_Right_Press" file_name="containers/TabTop_Right_Press.png" preload="false" />
   <texture name="TabTop_Right_Selected" file_name="containers/TabTop_Right_Selected.png" preload="false"  scale.left="8" scale.top="8" scale.right="62" scale.bottom="9" />
   <texture name="TabTop_Middle_Off" file_name="containers/TabTop_Middle_Off.png" preload="false" scale.left="8" scale.top="8" scale.right="120" scale.bottom="9" />
   <texture name="TabTop_Middle_Selected" file_name="containers/TabTop_Middle_Selected.png" preload="false" scale.left="8" scale.top="8" scale.right="96" scale.bottom="9" />
@@ -585,8 +444,6 @@ with the same filename but different name
 
   <texture name="TaskPanel_Tab_Off" file_name="taskpanel/TaskPanel_Tab_Off.png" preload="false" scale.left="4" scale.top="29" scale.right="36" scale.bottom="4" />
   <texture name="TaskPanel_Tab_Selected" file_name="taskpanel/TaskPanel_Tab_Selected.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" />
-  <texture name="TaskPanel_BG" file_name="taskpanel/TaskPanel_BG.png" preload="false" scale.left="4" scale.top="146" scale.right="146" scale.bottom="4" />
-  <texture name="TaskPanel_Tab_Unselected" file_name="taskpanel/TaskPanel_Tab_Over.png" preload="false" scale.left="5" scale.top="30" scale.right="36" scale.bottom="5" />
 
   <texture name="TextField_Search_Disabled" file_name="widgets/TextField_Search_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
   <texture name="TextField_Off" file_name="widgets/TextField_Off.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
@@ -595,7 +452,6 @@ with the same filename but different name
   <texture name="TextField_Disabled" file_name="widgets/TextField_Disabled.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
   <texture name="TextField_Active" file_name="widgets/TextField_Active.png" preload="true" scale.left="9" scale.top="12" scale.right="248" scale.bottom="12" />
 
-  <texture name="TimeBasedMediaBackground" file_name="windows/TimeBasedMediaBackground.png" preload="false" />
 
   <texture name="Toast_CloseBtn" file_name="windows/Toast_CloseBtn.png" preload="true" />
   <texture name="Toast_Background" file_name="windows/Toast_Background.png" preload="true"
@@ -604,28 +460,19 @@ with the same filename but different name
            scale.left="4" scale.top="28" scale.right="60" scale.bottom="4" />
 
   <texture name="Tool_Create" file_name="build/Tool_Create.png" preload="false" />
-  <texture name="Tool_Create_Selected" file_name="build/Tool_Create_Selected.png" preload="false" />
   <texture name="Tool_Dozer" file_name="build/Tool_Dozer.png" preload="false" />
-  <texture name="Tool_Dozer_Selected" file_name="build/Tool_Dozer_Selected.png" preload="false" />
   <texture name="Tool_Face" file_name="build/Tool_Face.png" preload="false" />
-  <texture name="Tool_Face_Selected" file_name="build/Tool_Face_Selected.png" preload="false" />
   <texture name="Tool_Grab" file_name="build/Tool_Grab.png" preload="false" />
-  <texture name="Tool_Grab_Selected" file_name="build/Tool_Grab_Selected.png" preload="false" />
   <texture name="Tool_Zoom" file_name="build/Tool_Zoom.png" preload="false" />
-  <texture name="Tool_Zoom_Selected" file_name="build/Tool_Zoom_Selected.png" preload="false" />
 
-  <texture name="Toolbar_Divider" file_name="containers/Toolbar_Divider.png" preload="false" />
   <texture name="Toolbar_Left_Off" file_name="containers/Toolbar_Left_Off.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Over" file_name="containers/Toolbar_Left_Over.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
-  <texture name="Toolbar_Left_Press" file_name="containers/Toolbar_Left_Press.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Left_Selected" file_name="containers/Toolbar_Left_Selected.png" preload="false" scale.left="5" scale.bottom="4" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Off" file_name="containers/Toolbar_Middle_Off.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Over" file_name="containers/Toolbar_Middle_Over.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
-  <texture name="Toolbar_Middle_Press" file_name="containers/Toolbar_Middle_Press.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Middle_Selected" file_name="containers/Toolbar_Middle_Selected.png" preload="false" scale.left="1" scale.bottom="2" scale.top="24" scale.right="30" />
   <texture name="Toolbar_Right_Off" file_name="containers/Toolbar_Right_Off.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Over" file_name="containers/Toolbar_Right_Over.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
-  <texture name="Toolbar_Right_Press" file_name="containers/Toolbar_Right_Press.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
   <texture name="Toolbar_Right_Selected" file_name="containers/Toolbar_Right_Selected.png" preload="false" scale.left="1" scale.bottom="4" scale.top="24" scale.right="26" />
 
   <texture name="Tooltip" file_name="widgets/Tooltip.png" preload="true" scale.left="2" scale.top="16" scale.right="100" scale.bottom="3" />
@@ -635,7 +482,6 @@ with the same filename but different name
   <texture name="TrashItem_Press" file_name="icons/TrashItem_Press.png" preload="false" />
 
   <texture name="Unread_Chiclet" file_name="bottomtray/Unread_Chiclet.png" preload="false" />
-  <texture name="Unread_Msg" file_name="bottomtray/Unread_Msg.png" preload="false" />
   <texture name="Unread_IM" file_name="bottomtray/Unread_IM.png" preload="false" />
 
     <texture name="Volume_Background" file_name="windows/Volume_Background.png" preload="false"
@@ -650,10 +496,7 @@ with the same filename but different name
   <texture name="WellButton_Lit" file_name="bottomtray/WellButton_Lit.png"  preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
   <texture name="WellButton_Lit_Selected" file_name="bottomtray/WellButton_Lit_Selected.png" preload="true" scale.left="4" scale.top="19" scale.right="28" scale.bottom="4" />
 
-  <texture name="WebBasedMediaBackground" file_name="windows/WebBasedMediaBackground.png" preload="false" />
 
-  <texture name="Widget_DownArrow" file_name="icons/Widget_DownArrow.png" preload="true" />
-  <texture name="Widget_UpArrow" file_name="icons/Widget_UpArrow.png" preload="true" />
 
   <texture name="Window_Background" file_name="windows/Window_Background.png" preload="true"
            scale.left="4" scale.top="24" scale.right="26" scale.bottom="4" />
@@ -667,17 +510,7 @@ with the same filename but different name
   <texture name="YouAreHere_Badge" file_name="icons/YouAreHere_Badge.png" preload="false" />
 
   <texture name="Zoom_Off" file_name="icons/Zoom_Off.png" preload="false" />
-  <texture name="Zoom_Over" file_name="icons/Zoom_Over.png" preload="false" />
-  <texture name="Zoom_Press" file_name="icons/Zoom_Press.png" preload="false" />
   <texture name="UnZoom_Off" file_name="icons/UnZoom_Off.png" preload="false" />
-  <texture name="UnZoom_Over" file_name="icons/UnZoom_Over.png" preload="false" />
-  <texture name="UnZoom_Press" file_name="icons/UnZoom_Press.png" preload="false" />
-  <texture name="PowerOn_Off" file_name="icons/PowerOn_Off.png" preload="false" />
-  <texture name="PowerOn_Over" file_name="icons/PowerOn_Over.png" preload="false" />
-  <texture name="PowerOn_Press" file_name="icons/PowerOn_Press.png" preload="false" />
-  <texture name="PowerOff_Off" file_name="icons/PowerOff_Off.png" preload="false" />
-  <texture name="PowerOff_Over" file_name="icons/PowerOff_Over.png" preload="false" />
-  <texture name="PowerOff_Press" file_name="icons/PowerOff_Press.png" preload="false" />
 
   <texture name="pixiesmall.j2c" use_mips="true" />
   <texture name="script_error.j2c" use_mips="true" />
@@ -687,7 +520,6 @@ with the same filename but different name
   <texture name="transparent.j2c" use_mips="true" />
 
   <!--WARNING OLD ART BELOW *do not use*-->
-  <texture name="icn_chatbar.tga" />
   <texture name="icn_media_web.tga" preload="true" />
   <texture name="icn_media_movie.tga" preload="true" />
   <texture name="icn_speaker-muted_dark.tga" />
@@ -717,8 +549,6 @@ with the same filename but different name
   <texture name="icn_label_media.tga" />
   <texture name="icn_rounded-text-field.tga" scale.left="14" scale.bottom="16" scale.top="16" scale.right="114" />
 
-  <texture name="toggle_button_off" file_name="toggle_button_off.png" preload="true" />
-  <texture name="toggle_button_selected" file_name="toggle_button_selected.png" preload="true" />
   <texture name="color_swatch_alpha.tga" preload="true" />
 
   <texture name="button_anim_pause.tga" />
@@ -728,15 +558,11 @@ with the same filename but different name
   <texture name="crosshairs.tga" />
   <texture name="direction_arrow.tga" file_name="world/BeaconArrow.png" />
 
-  <texture name="icon_auction.tga" />
   <texture name="icon_avatar_offline.tga" />
   <texture name="icon_avatar_online.tga" />
   <texture name="icon_day_cycle.tga" />
   <texture name="icon_diurnal.tga" />
-  <texture name="icon_event.tga" />
-  <texture name="icon_event_mature.tga" />
   <texture name="icon_for_sale.tga" />
-  <texture name="icon_place_for_sale.tga" />
   <texture name="icon_top_pick.tga" />
 
   <texture name="lag_status_critical.tga" />
@@ -747,7 +573,6 @@ with the same filename but different name
 
   <texture name="map_avatar_16.tga" />
   <texture name="map_avatar_8.tga" />
-  <texture name="map_avatar_you_8.tga" />
   <texture name="map_event.tga" />
   <texture name="map_event_mature.tga" />
   <texture name="map_home.tga" />
@@ -756,15 +581,10 @@ with the same filename but different name
   <texture name="map_track_16.tga" />
 
   <texture name="notify_caution_icon.tga" />
-  <texture name="notify_next.png" preload="true" />
-  <texture name="notify_box_icon.tga" />
 
   <texture name="icn_active-speakers-dot-lvl0.tga" />
   <texture name="icn_active-speakers-dot-lvl1.tga" />
   <texture name="icn_active-speakers-dot-lvl2.tga" />
-  <texture name="icn_active-speakers-typing1.tga" />
-  <texture name="icn_active-speakers-typing2.tga" />
-  <texture name="icn_active-speakers-typing3.tga" />
 
   <texture name="icn_voice_ptt-off.tga" />
   <texture name="icn_voice_ptt-on.tga" />
@@ -780,5 +600,4 @@ with the same filename but different name
   <texture name="default_profile_picture.j2c" />
   <texture name="locked_image.j2c" />
 
-  <texture name="media_floater_border_16.png" scale_top="12" scale_left="4" scale_bottom="4" scale_right="12" />
 </textures>
-- 
cgit v1.2.3


From 9cf97ccd33bf147f525d15ca3c103e68bf6d8c2e Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Thu, 1 Apr 2010 13:39:41 -0700
Subject: fix bad xml; IT linguistic

---
 indra/newview/skins/default/xui/es/floater_customize.xml  |  2 +-
 indra/newview/skins/default/xui/it/floater_about_land.xml |  2 +-
 indra/newview/skins/default/xui/it/floater_buy_land.xml   | 10 ++++------
 indra/newview/skins/default/xui/it/floater_tools.xml      |  2 +-
 indra/newview/skins/default/xui/it/role_actions.xml       |  2 +-
 indra/newview/skins/default/xui/it/strings.xml            |  2 +-
 6 files changed, 9 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/floater_customize.xml b/indra/newview/skins/default/xui/es/floater_customize.xml
index 6d07aca8c5..b7058d4314 100644
--- a/indra/newview/skins/default/xui/es/floater_customize.xml
+++ b/indra/newview/skins/default/xui/es/floater_customize.xml
@@ -45,7 +45,7 @@
 			</text>
 			<button label="Crear una forma nueva" label_selected="Crear una forma nueva" name="Create New"/>
 			<button label="Guardar" label_selected="Guardar" name="Save"/>
-			<button label="Guardar como..." label_selected="Guardar como..." name="Save As">
+			<button label="Guardar como..." label_selected="Guardar como..." name="Save As"/>
 		</panel>
 		<panel label="Piel" name="Skin">
 			<button label="Color de piel" label_selected="Color de piel" name="Skin Color" width="115"/>
diff --git a/indra/newview/skins/default/xui/it/floater_about_land.xml b/indra/newview/skins/default/xui/it/floater_about_land.xml
index a61b0584d3..bc23c2e8ff 100644
--- a/indra/newview/skins/default/xui/it/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_about_land.xml
@@ -335,7 +335,7 @@ Solamente terreni più grandi possono essere abilitati nella ricerca.
 			<check_box label="Tutti i residenti" name="check other scripts"/>
 			<check_box label="Gruppo" name="check group scripts"/>
 			<text name="land_options_label">
-				Opzioni della terra:
+				Opzioni per il terreno:
 			</text>
 			<check_box label="Sicuro (senza danno)" name="check safe" tool_tip="Se spuntato, imposta il terreno su &apos;sicuro&apos;, disabilitando i danni da combattimento. Se non spuntato, viene abilitato il combattimento a morte."/>
 			<check_box label="Nessuna spinta" name="PushRestrictCheck" tool_tip="Previeni i colpi. Selezionare questa opzione può essere utile per prevenire comportamenti dannosi sul tuo terreno."/>
diff --git a/indra/newview/skins/default/xui/it/floater_buy_land.xml b/indra/newview/skins/default/xui/it/floater_buy_land.xml
index ca3285b438..2e78168209 100644
--- a/indra/newview/skins/default/xui/it/floater_buy_land.xml
+++ b/indra/newview/skins/default/xui/it/floater_buy_land.xml
@@ -71,7 +71,7 @@ Prova a scegliere una superficie più piccola.
 		Per acquistare terreno devi passare a un livello di abbonamento superiore.
 	</floater.string>
 	<floater.string name="cant_own_land">
-		Il tuo account può possedere terra.
+		Con questo account puoi essere proprietario di terreno.
 	</floater.string>
 	<floater.string name="land_holdings">
 		Sei proprietario di [BUYER] m² di terreno.
@@ -107,12 +107,10 @@ consente [AMOUNT2] oggetti
 [VENDUTO_CON_OGGETTI]
 	</floater.string>
 	<floater.string name="insufficient_land_credits">
-		Il gruppo [GROUP] avrà bisogno di contribuzioni anticipate, mediante crediti d&apos;uso terriero,
-sufficienti a coprire l&apos;area del terreno prima che l&apos;acquisto
-sia completato.
+		Il gruppo [GROUP] avrà bisogno di contributi di crediti di utilizzo terreno sufficienti a coprire il terreno prima che l&apos;acquisto sia completato.
 	</floater.string>
 	<floater.string name="have_enough_lindens">
-		Hai [AMOUNT] L$, che sono sufficienti per comprare questa terra.
+		Hai [AMOUNT] L$, che sono sufficienti per comprare questo terreno.
 	</floater.string>
 	<floater.string name="not_enough_lindens">
 		Hai solo [AMOUNT] L$, ed hai bisogno di altri [AMOUNT2] L$.
@@ -209,7 +207,7 @@ venduto con oggetti
 		<combo_box.item label="US$ 6.00 al mese, addebitato annualmente" name="US$6.00/month,billedannually"/>
 	</combo_box>
 	<text name="land_use_action">
-		Aumenta il tasso di pagamento mensile delle tasse d&apos;uso della terra a 40 US$/mese.
+		Aumenta le tariffe mensili di utilizzo del terreno a 40 US$/mese.
 	</text>
 	<text name="land_use_reason">
 		Tu occupi 1309 m² di terreno.
diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index 16ee797ce4..d86627afc2 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -484,7 +484,7 @@ della texture
 		<button label="Suddividi" label_selected="Suddividi" name="button subdivide land" width="156"/>
 		<button label="Iscriviti" label_selected="Iscriviti" name="button join land" width="156"/>
 		<text name="label_parcel_trans">
-			Transazioni del territorio
+			Transazioni terreno
 		</text>
 		<button label="Acquista terreno" label_selected="Acquista terreno" name="button buy land" width="156"/>
 		<button label="Abbandona il terreno" label_selected="Abbandona il terreno" name="button abandon land" width="156"/>
diff --git a/indra/newview/skins/default/xui/it/role_actions.xml b/indra/newview/skins/default/xui/it/role_actions.xml
index 95f1f662f9..e3f95f7f86 100644
--- a/indra/newview/skins/default/xui/it/role_actions.xml
+++ b/indra/newview/skins/default/xui/it/role_actions.xml
@@ -20,7 +20,7 @@
 	<action_set description="Queste Abilità comprendono il potere di intestare, modificare e vendere terreni di proprietà del gruppo. Per aprire la finestra Informazioni sul terreno, fai clic con il pulsante destro del mouse sul terreno e seleziona Informazioni sul terreno, o clicca sull&apos;icona &apos;i&apos; nella Barra di Navigazione." name="Parcel Management">
 		<action description="Cessione di terreno e acquisto di terreno per il gruppo" longdescription="Intesta terreno e acquista terreno per il gruppo. Ciò viene fatto in Informazioni sul terreno &gt; scheda Generale." name="land deed"/>
 		<action description="Abbandonare il terreno in favore di Governor Linden" longdescription="Abbandona il terreno in favore di Governor Linden. *ATTENZIONE* Ogni membro con questo ruolo e abilità può abbandonare il terreno di proprietà del gruppo in Informazioni sul terreno &gt; scheda Generale, restituendolo alla proprietà Linden senza effettuare una vendita. Sii sicuro della scelta prima di assegnare questa Abilità." name="land release"/>
-		<action description="Informazioni su come impostare il terreno come in vendita" longdescription="Imposta le info per la vendita della terra. *ATTENZIONE* Ogni Membro con questo ruolo e abilità può vendere il terreno di proprietà del gruppo nella scheda Informazioni sul terreno &gt; scheda Generale. Pertanto sii sicuro della scelta prima di assegnare questa Abilità." name="land set sale info"/>
+		<action description="Informazioni su come impostare il terreno come in vendita" longdescription="Imposta le informazioni per la vendita del terreno. *ATTENZIONE* Ogni Membro con questo ruolo e abilità può vendere il terreno di proprietà del gruppo nella scheda Informazioni sul terreno &gt; scheda Generale. Pertanto sii sicuro della scelta prima di assegnare questa Abilità." name="land set sale info"/>
 		<action description="Suddividere e unire lotti" longdescription="Suddividi e unisci lotti. Viene fatto cliccando con il pulsante destro del mouse sul terreno, selezionando Modifica terreno e trascinando il mouse sul terreno per creare una selezione. Per suddividere, seleziona quale parte vuoi dividere e clicca su Suddividi. Per unire, seleziona due o più lotti confinanti e clicca su Unisci." name="land divide join"/>
 	</action_set>
 	<action_set description="Queste abilità permettono di cambiare il nome del lotto, le impostazioni di pubblicazione, la visibilità negli elenchi e il punto di arrivo, nonché opzioni di indirizzamento del Teleport." name="Parcel Identity">
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index 93239983a8..a1b570d716 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -853,7 +853,7 @@
 		Offerta di Teleport
 	</string>
 	<string name="StartUpNotifications">
-		Nuove notifice sono arrivate mentre eri assente...
+		Mentre eri assente sono arrivate nuove notifiche...
 	</string>
 	<string name="OverflowInfoChannelString">
 		Hai ancora [%d] notifiche
-- 
cgit v1.2.3


From 09add95e314652bdb55200ad62a75c42326d69b4 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 13:42:42 -0700
Subject: EXT-6307 World Map: field of view triangle rotates

reviewed by Leyla
---
 indra/newview/llworldmapview.cpp | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 7afe81b436..0c37bb6eb1 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -886,28 +886,36 @@ void LLWorldMapView::drawFrustum()
 	F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
 	F32 half_width_pixels = half_width_meters * meters_to_pixels;
 	
-	F32 ctr_x = getRect().getWidth() * 0.5f + sPanX;
-	F32 ctr_y = getRect().getHeight() * 0.5f + sPanY;
+	F32 ctr_x = getLocalRect().getWidth() * 0.5f + sPanX;
+	F32 ctr_y = getLocalRect().getHeight() * 0.5f + sPanY;
 
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
 	// Since we don't rotate the map, we have to rotate the frustum.
 	gGL.pushMatrix();
+	{
 		gGL.translatef( ctr_x, ctr_y, 0 );
-		glRotatef( atan2( LLViewerCamera::getInstance()->getAtAxis().mV[VX], LLViewerCamera::getInstance()->getAtAxis().mV[VY] ) * RAD_TO_DEG, 0.f, 0.f, -1.f);
 
 		// Draw triangle with more alpha in far pixels to make it 
 		// fade out in distance.
 		gGL.begin( LLRender::TRIANGLES  );
+		{
+			LLVector2 cam_lookat(LLViewerCamera::instance().getAtAxis().mV[VX], LLViewerCamera::instance().getAtAxis().mV[VY]);
+			LLVector2 cam_left(LLViewerCamera::instance().getLeftAxis().mV[VX], LLViewerCamera::instance().getLeftAxis().mV[VY]);
+
 			gGL.color4f(1.f, 1.f, 1.f, 0.25f);
 			gGL.vertex2f( 0, 0 );
 
 			gGL.color4f(1.f, 1.f, 1.f, 0.02f);
-			gGL.vertex2f( -half_width_pixels, far_clip_pixels );
+			
+			LLVector2 vert = cam_lookat * far_clip_pixels + cam_left * half_width_pixels;
+			gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
 
-			gGL.color4f(1.f, 1.f, 1.f, 0.02f);
-			gGL.vertex2f(  half_width_pixels, far_clip_pixels );
+			vert = cam_lookat * far_clip_pixels - cam_left * half_width_pixels;
+			gGL.vertex2f(vert.mV[VX], vert.mV[VY]);
+		}
 		gGL.end();
+	}
 	gGL.popMatrix();
 }
 
-- 
cgit v1.2.3


From 39308422f153b5aada2a8f1c18689b7b40587d70 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Thu, 1 Apr 2010 17:05:25 -0400
Subject: Cleanup and consolidation

---
 indra/newview/llagentwearablesfetch.cpp |   6 +-
 indra/newview/llappearancemgr.cpp       | 159 ++++----------------------------
 indra/newview/llappearancemgr.h         |  17 ++--
 3 files changed, 28 insertions(+), 154 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 45274a8e2c..021b53e135 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -54,7 +54,7 @@ void LLInitialWearablesFetch::done()
 	// gInventory.notifyObservers.  The results will be handled in the next
 	// idle tick instead.
 	gInventory.removeObserver(this);
-	doOnIdle(boost::bind(&LLInitialWearablesFetch::processContents,this));
+	doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this));
 }
 
 void LLInitialWearablesFetch::add(InitialWearableData &data)
@@ -210,8 +210,8 @@ void LLLibraryOutfitsFetch::done()
 {
 	// Delay this until idle() routine, since it's a heavy operation and
 	// we also can't have it run within notifyObservers.
-	doOnIdle(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
-	gInventory.removeObserver(this); // Prevent doOnIdle from being added twice.
+	doOnIdleOneTime(boost::bind(&LLLibraryOutfitsFetch::doneIdle,this));
+	gInventory.removeObserver(this); // Prevent doOnIdleOneTime from being added twice.
 }
 
 void LLLibraryOutfitsFetch::doneIdle()
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 8c5352ded7..f254d986b5 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -74,23 +74,6 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string&
 	}
 }
 
-// support for secondlife:///app/appearance SLapps
-class LLAppearanceHandler : public LLCommandHandler
-{
-public:
-	// requests will be throttled from a non-trusted browser
-	LLAppearanceHandler() : LLCommandHandler("appearance", UNTRUSTED_THROTTLE) {}
-
-	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
-	{
-		// support secondlife:///app/appearance/show, but for now we just
-		// make all secondlife:///app/appearance SLapps behave this way
-		LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD());
-		return true;
-	}
-};
-LLAppearanceHandler gAppearanceHandler;
-
 class LLWearInventoryCategoryCallback : public LLInventoryCallback
 {
 public:
@@ -133,40 +116,18 @@ private:
 	bool mAppend;
 };
 
-class LLOutfitObserver : public LLInventoryFetchObserver
-{
-public:
-	LLOutfitObserver(const LLUUID& cat_id, bool copy_items, bool append) :
-		mCatID(cat_id),
-		mCopyItems(copy_items),
-		mAppend(append)
-	{}
-	~LLOutfitObserver() {}
-	virtual void done();
-	void doWearCategory();
-
-protected:
-	LLUUID mCatID;
-	bool mCopyItems;
-	bool mAppend;
-};
-
-void LLOutfitObserver::done()
-{
-	llinfos << "done 2nd stage fetch" << llendl;
-	gInventory.removeObserver(this);
-	doOnIdle(boost::bind(&LLOutfitObserver::doWearCategory,this));
-}
-
-void LLOutfitObserver::doWearCategory()
+void newDoWearCategory(LLUUID& cat_id, bool copy_items, bool append)
 {
 	llinfos << "starting" << llendl;
 	
 	// We now have an outfit ready to be copied to agent inventory. Do
 	// it, and wear that outfit normally.
-	if(mCopyItems)
+	LLInventoryCategory* cat = gInventory.getCategory(cat_id);
+	if(copy_items)
 	{
-		LLInventoryCategory* cat = gInventory.getCategory(mCatID);
+		LLInventoryModel::cat_array_t* cats;
+		LLInventoryModel::item_array_t* items;
+		gInventory.getDirectDescendentsOf(cat_id, cats, items);
 		std::string name;
 		if(!cat)
 		{
@@ -178,12 +139,12 @@ void LLOutfitObserver::doWearCategory()
 			name = cat->getName();
 		}
 		LLViewerInventoryItem* item = NULL;
-		item_ref_t::iterator it = mComplete.begin();
-		item_ref_t::iterator end = mComplete.end();
+		LLInventoryModel::item_array_t::const_iterator it = items->begin();
+		LLInventoryModel::item_array_t::const_iterator end = items->end();
 		LLUUID pid;
 		for(; it < end; ++it)
 		{
-			item = (LLViewerInventoryItem*)gInventory.getItem(*it);
+			item = *it;
 			if(item)
 			{
 				if(LLInventoryType::IT_GESTURE == item->getInventoryType())
@@ -202,23 +163,22 @@ void LLOutfitObserver::doWearCategory()
 			pid = gInventory.getRootFolderID();
 		}
 		
-		LLUUID cat_id = gInventory.createNewCategory(
+		LLUUID new_cat_id = gInventory.createNewCategory(
 			pid,
 			LLFolderType::FT_NONE,
 			name);
-		mCatID = cat_id;
-		LLPointer<LLInventoryCallback> cb = new LLWearInventoryCategoryCallback(mCatID, mAppend);
-		it = mComplete.begin();
+		LLPointer<LLInventoryCallback> cb = new LLWearInventoryCategoryCallback(new_cat_id, append);
+		it = items->begin();
 		for(; it < end; ++it)
 		{
-			item = (LLViewerInventoryItem*)gInventory.getItem(*it);
+			item = *it;
 			if(item)
 			{
 				copy_inventory_item(
 					gAgent.getID(),
 					item->getPermissions().getOwner(),
 					item->getUUID(),
-					cat_id,
+					new_cat_id,
 					std::string(),
 					cb);
 			}
@@ -229,77 +189,8 @@ void LLOutfitObserver::doWearCategory()
 	else
 	{
 		// Wear the inventory category.
-		LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(gInventory.getCategory(mCatID), mAppend);
-	}
-	delete this;
-}
-
-class LLOutfitFetch : public LLInventoryFetchDescendentsObserver
-{
-public:
-	LLOutfitFetch(bool copy_items, bool append) : mCopyItems(copy_items), mAppend(append) {}
-	~LLOutfitFetch() {}
-	virtual void done();
-protected:
-	bool mCopyItems;
-	bool mAppend;
-};
-
-void LLOutfitFetch::done()
-{
-	// What we do here is get the complete information on the items in
-	// the library, and set up an observer that will wait for that to
-	// happen.
-	llinfos << "done first stage fetch" << llendl;
-	
-	LLInventoryModel::cat_array_t cat_array;
-	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(mCompleteFolders.front(),
-								  cat_array,
-								  item_array,
-								  LLInventoryModel::EXCLUDE_TRASH);
-	S32 count = item_array.count();
-	if(!count)
-	{
-		llwarns << "Nothing fetched in category " << mCompleteFolders.front()
-				<< llendl;
-		//dec_busy_count();
-		gInventory.removeObserver(this);
-		delete this;
-		return;
+		LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, append);
 	}
-
-	LLOutfitObserver* outfit_observer = new LLOutfitObserver(mCompleteFolders.front(), mCopyItems, mAppend);
-	LLInventoryFetchObserver::item_ref_t ids;
-	for(S32 i = 0; i < count; ++i)
-	{
-		ids.push_back(item_array.get(i)->getUUID());
-	}
-
-	// clean up, and remove this as an observer since the call to the
-	// outfit could notify observers and throw us into an infinite
-	// loop.
-	//dec_busy_count();
-	gInventory.removeObserver(this);
-
-	// increment busy count and either tell the inventory to check &
-	// call done, or add this object to the inventory for observation.
-	//inc_busy_count();
-
-	// do the fetch
-	outfit_observer->fetchItems(ids);
-	if(outfit_observer->isEverythingComplete())
-	{
-		// everything is already here - call done.
-		outfit_observer->done();
-	}
-	else
-	{
-		// it's all on it's way - add an observer, and the inventory
-		// will call done for us when everything is here.
-		gInventory.addObserver(outfit_observer);
-	}
-	delete this;
 }
 
 LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy():
@@ -1309,25 +1200,7 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
 	llinfos << "wearInventoryCategory( " << category->getName()
 			 << " )" << llendl;
 
-	// What we do here is get the complete information on the items in
-	// the inventory, and set up an observer that will wait for that to
-	// happen.
-	LLOutfitFetch* outfit_fetcher = new LLOutfitFetch(copy, append);
-	uuid_vec_t folders;
-	folders.push_back(category->getUUID());
-	outfit_fetcher->fetchDescendents(folders);
-	//inc_busy_count();
-	if(outfit_fetcher->isEverythingComplete())
-	{
-		// everything is already here - call done.
-		outfit_fetcher->done();
-	}
-	else
-	{
-		// it's all on it's way - add an observer, and the inventory
-		// will call done for us when everything is here.
-		gInventory.addObserver(outfit_fetcher);
-	}
+	callAfterCategoryFetch(category->getUUID(),boost::bind(newDoWearCategory,category->getUUID(), copy, append));
 }
 
 // *NOTE: hack to get from avatar inventory to avatar
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 2d6a0a10ed..7b39a13a72 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -173,17 +173,17 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id,const std::string&
 // Shim class and template function to allow arbitrary boost::bind
 // expressions to be run as one-time idle callbacks.
 template <typename T>
-class OnIdleCallback
+class OnIdleCallbackOneTime
 {
 public:
-	OnIdleCallback(T callable):
+	OnIdleCallbackOneTime(T callable):
 		mCallable(callable)
 	{
 	}
 	static void onIdle(void *data)
 	{
 		gIdleCallbacks.deleteFunction(onIdle, data);
-		OnIdleCallback<T>* self = reinterpret_cast<OnIdleCallback<T>*>(data);
+		OnIdleCallbackOneTime<T>* self = reinterpret_cast<OnIdleCallbackOneTime<T>*>(data);
 		self->call();
 		delete self;
 	}
@@ -196,14 +196,15 @@ private:
 };
 
 template <typename T>
-void doOnIdle(T callable)
+void doOnIdleOneTime(T callable)
 {
-	OnIdleCallback<T>* cb_functor = new OnIdleCallback<T>(callable);
-	gIdleCallbacks.addFunction(&OnIdleCallback<T>::onIdle,cb_functor);
+	OnIdleCallbackOneTime<T>* cb_functor = new OnIdleCallbackOneTime<T>(callable);
+	gIdleCallbacks.addFunction(&OnIdleCallbackOneTime<T>::onIdle,cb_functor);
 }
 
 // Shim class and template function to allow arbitrary boost::bind
 // expressions to be run as recurring idle callbacks.
+// Callable should return true when done, false to continue getting called.
 template <typename T>
 class OnIdleCallbackRepeating
 {
@@ -212,7 +213,7 @@ public:
 		mCallable(callable)
 	{
 	}
-	// Will keep getting called until the callable returns false.
+	// Will keep getting called until the callable returns true.
 	static void onIdle(void *data)
 	{
 		OnIdleCallbackRepeating<T>* self = reinterpret_cast<OnIdleCallbackRepeating<T>*>(data);
@@ -252,7 +253,7 @@ public:
 	virtual void done()
 	{
 		gInventory.removeObserver(this);
-		doOnIdle(mCallable);
+		doOnIdleOneTime(mCallable);
 		delete this;
 	}
 protected:
-- 
cgit v1.2.3


From 2be2fdca5c334b787b8019d7226a48e1d5eaec91 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 14:08:49 -0700
Subject: EXT-3606 - Script editor window: next line not indenting if current
 line wraps

---
 indra/llui/lltexteditor.cpp                                     | 2 +-
 indra/newview/skins/default/xui/en/floater_test_text_editor.xml | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 7d230f7d42..94c7ebec2a 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -2334,7 +2334,7 @@ void LLTextEditor::getCurrentLineAndColumn( S32* line, S32* col, BOOL include_wo
 void LLTextEditor::autoIndent()
 {
 	// Count the number of spaces in the current line
-	S32 line = getLineNumFromDocIndex(mCursorPos);
+	S32 line = getLineNumFromDocIndex(mCursorPos, false);
 	S32 line_start = getLineStart(line);
 	S32 space_count = 0;
 	S32 i;
diff --git a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
index b730f0e511..548e24efba 100644
--- a/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
+++ b/indra/newview/skins/default/xui/en/floater_test_text_editor.xml
@@ -14,6 +14,7 @@
    name="test_text_editor"
    tool_tip="text editor"
    top="25"
+   word_wrap="true" 
    width="200">
     Text Editor
   </text_editor>
-- 
cgit v1.2.3


From e45040412c95372ee6549ea98ea04df7076dab6d Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Thu, 1 Apr 2010 17:26:25 -0400
Subject: Cleanup and consolidation

---
 indra/newview/llappearancemgr.cpp | 158 +++++++++++++++++++-------------------
 indra/newview/llappearancemgr.h   |   1 +
 2 files changed, 81 insertions(+), 78 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index f254d986b5..3c4341e82c 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -116,83 +116,6 @@ private:
 	bool mAppend;
 };
 
-void newDoWearCategory(LLUUID& cat_id, bool copy_items, bool append)
-{
-	llinfos << "starting" << llendl;
-	
-	// We now have an outfit ready to be copied to agent inventory. Do
-	// it, and wear that outfit normally.
-	LLInventoryCategory* cat = gInventory.getCategory(cat_id);
-	if(copy_items)
-	{
-		LLInventoryModel::cat_array_t* cats;
-		LLInventoryModel::item_array_t* items;
-		gInventory.getDirectDescendentsOf(cat_id, cats, items);
-		std::string name;
-		if(!cat)
-		{
-			// should never happen.
-			name = "New Outfit";
-		}
-		else
-		{
-			name = cat->getName();
-		}
-		LLViewerInventoryItem* item = NULL;
-		LLInventoryModel::item_array_t::const_iterator it = items->begin();
-		LLInventoryModel::item_array_t::const_iterator end = items->end();
-		LLUUID pid;
-		for(; it < end; ++it)
-		{
-			item = *it;
-			if(item)
-			{
-				if(LLInventoryType::IT_GESTURE == item->getInventoryType())
-				{
-					pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
-				}
-				else
-				{
-					pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
-				}
-				break;
-			}
-		}
-		if(pid.isNull())
-		{
-			pid = gInventory.getRootFolderID();
-		}
-		
-		LLUUID new_cat_id = gInventory.createNewCategory(
-			pid,
-			LLFolderType::FT_NONE,
-			name);
-		LLPointer<LLInventoryCallback> cb = new LLWearInventoryCategoryCallback(new_cat_id, append);
-		it = items->begin();
-		for(; it < end; ++it)
-		{
-			item = *it;
-			if(item)
-			{
-				copy_inventory_item(
-					gAgent.getID(),
-					item->getPermissions().getOwner(),
-					item->getUUID(),
-					new_cat_id,
-					std::string(),
-					cb);
-			}
-		}
-		// BAP fixes a lag in display of created dir.
-		gInventory.notifyObservers();
-	}
-	else
-	{
-		// Wear the inventory category.
-		LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, append);
-	}
-}
-
 LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy():
 	mFireCount(0)
 {
@@ -1200,7 +1123,86 @@ void LLAppearanceMgr::wearInventoryCategory(LLInventoryCategory* category, bool
 	llinfos << "wearInventoryCategory( " << category->getName()
 			 << " )" << llendl;
 
-	callAfterCategoryFetch(category->getUUID(),boost::bind(newDoWearCategory,category->getUUID(), copy, append));
+	callAfterCategoryFetch(category->getUUID(),boost::bind(&LLAppearanceMgr::wearCategoryFinal,
+														   &LLAppearanceMgr::instance(),
+														   category->getUUID(), copy, append));
+}
+
+void LLAppearanceMgr::wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append)
+{
+	llinfos << "starting" << llendl;
+	
+	// We now have an outfit ready to be copied to agent inventory. Do
+	// it, and wear that outfit normally.
+	LLInventoryCategory* cat = gInventory.getCategory(cat_id);
+	if(copy_items)
+	{
+		LLInventoryModel::cat_array_t* cats;
+		LLInventoryModel::item_array_t* items;
+		gInventory.getDirectDescendentsOf(cat_id, cats, items);
+		std::string name;
+		if(!cat)
+		{
+			// should never happen.
+			name = "New Outfit";
+		}
+		else
+		{
+			name = cat->getName();
+		}
+		LLViewerInventoryItem* item = NULL;
+		LLInventoryModel::item_array_t::const_iterator it = items->begin();
+		LLInventoryModel::item_array_t::const_iterator end = items->end();
+		LLUUID pid;
+		for(; it < end; ++it)
+		{
+			item = *it;
+			if(item)
+			{
+				if(LLInventoryType::IT_GESTURE == item->getInventoryType())
+				{
+					pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_GESTURE);
+				}
+				else
+				{
+					pid = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
+				}
+				break;
+			}
+		}
+		if(pid.isNull())
+		{
+			pid = gInventory.getRootFolderID();
+		}
+		
+		LLUUID new_cat_id = gInventory.createNewCategory(
+			pid,
+			LLFolderType::FT_NONE,
+			name);
+		LLPointer<LLInventoryCallback> cb = new LLWearInventoryCategoryCallback(new_cat_id, append);
+		it = items->begin();
+		for(; it < end; ++it)
+		{
+			item = *it;
+			if(item)
+			{
+				copy_inventory_item(
+					gAgent.getID(),
+					item->getPermissions().getOwner(),
+					item->getUUID(),
+					new_cat_id,
+					std::string(),
+					cb);
+			}
+		}
+		// BAP fixes a lag in display of created dir.
+		gInventory.notifyObservers();
+	}
+	else
+	{
+		// Wear the inventory category.
+		LLAppearanceMgr::instance().wearInventoryCategoryOnAvatar(cat, append);
+	}
 }
 
 // *NOTE: hack to get from avatar inventory to avatar
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 7b39a13a72..5e1ce55fbd 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -53,6 +53,7 @@ public:
 	void updateCOF(const LLUUID& category, bool append = false);
 	void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
 	void wearInventoryCategoryOnAvatar(LLInventoryCategory* category, bool append);
+	void wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append);
 	void wearOutfitByName(const std::string& name);
 	void changeOutfit(bool proceed, const LLUUID& category, bool append);
 
-- 
cgit v1.2.3


From 3962ca7a0b1469a40b5f7cb0587c65c4ebf33cb6 Mon Sep 17 00:00:00 2001
From: Sergei Litovchuk <slitovchuk@productengine.com>
Date: Fri, 2 Apr 2010 00:43:32 +0300
Subject: Low bug (EXT-6677) Crash when selecting empty outfit edit panel -
 Added NULL check for selected item pointer.

Reviewed by Neal Orman https://codereview.productengine.com/secondlife/r/162/

--HG--
branch : product-engine
---
 indra/newview/llpaneloutfitedit.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ba22adc01c..2b25c544e3 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -413,7 +413,11 @@ void LLPanelOutfitEdit::onLookItemSelectionChange(void)
 {	
 	S32 left_offset = -4;
 	S32 top_offset = -10;
-	LLRect rect = mLookContents->getLastSelectedItem()->getRect();
+	LLScrollListItem* item = mLookContents->getLastSelectedItem();
+	if (!item)
+		return;
+
+	LLRect rect = item->getRect();
 	LLRect btn_rect(
 					left_offset + rect.mRight - 50,
 					top_offset  + rect.mTop,
-- 
cgit v1.2.3


From 1ec47c39a6c4a6e7e518d0b91a87f50596362f06 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Thu, 1 Apr 2010 17:50:48 -0400
Subject: EXT-6679 : INFRASTRUCTURE : Have LLInvFVBridge contain a LLFolderView
 *mRoot instead of passing it along everywhere such as in performAction

mRoot is now stored for all LLInventoryBridge types.
Did some superficial formatting cleanup for LLInventoryBridge.
---
 indra/newview/llfolderview.cpp            |   3 +-
 indra/newview/llfoldervieweventlistener.h |   2 +-
 indra/newview/llinventorybridge.cpp       | 570 ++++++++++++++----------------
 indra/newview/llinventorybridge.h         | 155 ++++----
 indra/newview/llinventorypanel.cpp        |   3 +-
 indra/newview/llpanellandmarks.cpp        |   2 +-
 indra/newview/llpanelmaininventory.cpp    |   2 +-
 indra/newview/llpanelobjectinventory.cpp  |  10 +-
 indra/newview/llpaneloutfitsinventory.cpp |   6 +-
 indra/newview/llplacesinventorybridge.cpp |  11 +-
 indra/newview/llplacesinventorybridge.h   |  38 +-
 indra/newview/llsidepanelinventory.cpp    |   2 +-
 12 files changed, 399 insertions(+), 405 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 4fbd1efbef..c31b01200f 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2104,8 +2104,7 @@ bool LLFolderView::doToSelected(LLInventoryModel* model, const LLSD& userdata)
 		if(!folder_item) continue;
 		LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
 		if(!bridge) continue;
-
-		bridge->performAction(this, model, action);
+		bridge->performAction(model, action);
 	}
 
 	LLFloater::setFloaterHost(NULL);
diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index 7fe53d4aad..a2ef8c1d12 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -88,7 +88,7 @@ public:
 	virtual BOOL isUpToDate() const = 0;
 	virtual BOOL hasChildren() const = 0;
 	virtual LLInventoryType::EType getInventoryType() const = 0;
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action) = 0;
+	virtual void performAction(LLInventoryModel* model, std::string action) = 0;
 	
 	// This method should be called when a drag begins. returns TRUE
 	// if the drag can begin, otherwise FALSE.
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index be0e5f8829..2a570ecebb 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -36,8 +36,6 @@
 // external projects
 #include "lltransfersourceasset.h"
 
-
-
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llagentwearables.h"
@@ -139,8 +137,12 @@ std::string ICON_NAME[ICON_NAME_COUNT] =
 // |        LLInvFVBridge                            |
 // +=================================================+
 
-LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-mUUID(uuid), mInvType(LLInventoryType::IT_NONE)
+LLInvFVBridge::LLInvFVBridge(LLInventoryPanel* inventory, 
+							 LLFolderView* root,
+							 const LLUUID& uuid) :
+	mUUID(uuid), 
+	mRoot(root),
+	mInvType(LLInventoryType::IT_NONE)
 {
 	mInventoryPanel = inventory->getHandle();
 }
@@ -239,7 +241,7 @@ void LLInvFVBridge::showProperties()
 
 	// Disable old properties floater; this is replaced by the sidepanel.
 	/*
-	LLFloaterReg::showInstance("properties", mUUID);
+	  LLFloaterReg::showInstance("properties", mUUID);
 	*/
 }
 
@@ -487,8 +489,8 @@ BOOL LLInvFVBridge::isClipboardPasteableAsLink() const
 }
 
 void hide_context_entries(LLMenuGL& menu, 
-						const menuentry_vec_t &entries_to_show,
-						const menuentry_vec_t &disabled_entries)
+						  const menuentry_vec_t &entries_to_show,
+						  const menuentry_vec_t &disabled_entries)
 {
 	const LLView::child_list_t *list = menu.getChildList();
 
@@ -877,6 +879,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 										   LLAssetType::EType actual_asset_type,
 										   LLInventoryType::EType inv_type,
 										   LLInventoryPanel* inventory,
+										   LLFolderView* root,
 										   const LLUUID& uuid,
 										   U32 flags)
 {
@@ -888,7 +891,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLTextureBridge(inventory, uuid, inv_type);
+			new_listener = new LLTextureBridge(inventory, root, uuid, inv_type);
 			break;
 
 		case LLAssetType::AT_SOUND:
@@ -896,7 +899,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLSoundBridge(inventory, uuid);
+			new_listener = new LLSoundBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_LANDMARK:
@@ -904,7 +907,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLLandmarkBridge(inventory, uuid, flags);
+			new_listener = new LLLandmarkBridge(inventory, root, uuid, flags);
 			break;
 
 		case LLAssetType::AT_CALLINGCARD:
@@ -912,7 +915,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLCallingCardBridge(inventory, uuid);
+			new_listener = new LLCallingCardBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_SCRIPT:
@@ -920,7 +923,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLScriptBridge(inventory, uuid);
+			new_listener = new LLScriptBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_OBJECT:
@@ -928,7 +931,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLObjectBridge(inventory, uuid, inv_type, flags);
+			new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags);
 			break;
 
 		case LLAssetType::AT_NOTECARD:
@@ -936,7 +939,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLNotecardBridge(inventory, uuid);
+			new_listener = new LLNotecardBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_ANIMATION:
@@ -944,7 +947,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLAnimationBridge(inventory, uuid);
+			new_listener = new LLAnimationBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_GESTURE:
@@ -952,7 +955,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLGestureBridge(inventory, uuid);
+			new_listener = new LLGestureBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_LSL_TEXT:
@@ -960,7 +963,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLLSLTextBridge(inventory, uuid);
+			new_listener = new LLLSLTextBridge(inventory, root, uuid);
 			break;
 
 		case LLAssetType::AT_CLOTHING:
@@ -969,21 +972,21 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 			{
 				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 			}
-			new_listener = new LLWearableBridge(inventory, uuid, asset_type, inv_type, (EWearableType)flags);
+			new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (EWearableType)flags);
 			break;
 		case LLAssetType::AT_CATEGORY:
 			if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
 			{
 				// Create a link folder handler instead.
-				new_listener = new LLLinkFolderBridge(inventory, uuid);
+				new_listener = new LLLinkFolderBridge(inventory, root, uuid);
 				break;
 			}
-			new_listener = new LLFolderBridge(inventory, uuid);
+			new_listener = new LLFolderBridge(inventory, root, uuid);
 			break;
 		case LLAssetType::AT_LINK:
 		case LLAssetType::AT_LINK_FOLDER:
 			// Only should happen for broken links.
-			new_listener = new LLLinkItemBridge(inventory, uuid);
+			new_listener = new LLLinkItemBridge(inventory, root, uuid);
 			break;
 		default:
 			llinfos << "Unhandled asset type (llassetstorage.h): "
@@ -1032,26 +1035,28 @@ LLInvFVBridge* LLInventoryFVBridgeBuilder::createBridge(LLAssetType::EType asset
 														LLAssetType::EType actual_asset_type,
 														LLInventoryType::EType inv_type,
 														LLInventoryPanel* inventory,
+														LLFolderView* root,
 														const LLUUID& uuid,
 														U32 flags /* = 0x00 */) const
 {
 	return LLInvFVBridge::createBridge(asset_type,
-		actual_asset_type,
-		inv_type,
-		inventory,
-		uuid,
-		flags);
+									   actual_asset_type,
+									   inv_type,
+									   inventory,
+									   root,
+									   uuid,
+									   flags);
 }
 
 // +=================================================+
 // |        LLItemBridge                             |
 // +=================================================+
 
-void LLItemBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLItemBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("goto" == action)
 	{
-		gotoItem(root);
+		gotoItem();
 	}
 
 	if ("open" == action)
@@ -1102,7 +1107,7 @@ void LLItemBridge::performAction(LLFolderView* root, LLInventoryModel* model, st
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
-		LLFolderViewItem* folder_view_itemp = root->getItemByID(itemp->getParentUUID());
+		LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID());
 		if (!folder_view_itemp) return;
 
 		folder_view_itemp->getListener()->pasteFromClipboard();
@@ -1114,7 +1119,7 @@ void LLItemBridge::performAction(LLFolderView* root, LLInventoryModel* model, st
 		LLInventoryItem* itemp = model->getItem(mUUID);
 		if (!itemp) return;
 
-		LLFolderViewItem* folder_view_itemp = root->getItemByID(itemp->getParentUUID());
+		LLFolderViewItem* folder_view_itemp = mRoot->getItemByID(itemp->getParentUUID());
 		if (!folder_view_itemp) return;
 
 		folder_view_itemp->getListener()->pasteLinkFromClipboard();
@@ -1183,7 +1188,7 @@ void LLItemBridge::restoreToWorld()
 	}
 }
 
-void LLItemBridge::gotoItem(LLFolderView* root)
+void LLItemBridge::gotoItem()
 {
 	LLInventoryObject *obj = getInventoryObject();
 	if (obj && obj->getIsLinkType())
@@ -1684,7 +1689,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		// Is the destination the trash?
 		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
 		BOOL move_is_into_trash = (mUUID == trash_id)
-				|| model->isObjectDescendentOf(mUUID, trash_id);
+			|| model->isObjectDescendentOf(mUUID, trash_id);
 		BOOL is_movable = (!LLFolderType::lookupIsProtectedType(inv_cat->getPreferredType()));
 		const LLUUID current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT);
 		BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
@@ -1732,12 +1737,11 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			}
 		}
 
-
-		accept =	is_movable
-					&& (mUUID != cat_id)								// Can't move a folder into itself
-					&& (mUUID != inv_cat->getParentUUID())				// Avoid moves that would change nothing
-					&& !(model->isObjectDescendentOf(mUUID, cat_id));	// Avoid circularity
-		if(accept && drop)
+		accept = is_movable
+			&& (mUUID != cat_id)								// Can't move a folder into itself
+			&& (mUUID != inv_cat->getParentUUID())				// Avoid moves that would change nothing
+			&& !(model->isObjectDescendentOf(mUUID, cat_id));	// Avoid circularity
+		if (accept && drop)
 		{
 			// Look for any gestures and deactivate them
 			if (move_is_into_trash)
@@ -1775,22 +1779,22 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				else
 				{
 #if SUPPORT_ENSEMBLES
-				// BAP - should skip if dup.
-				if (move_is_into_current_outfit)
-				{
-					LLAppearanceMgr::instance().addEnsembleLink(inv_cat);
-				}
-				else
-				{
-					LLPointer<LLInventoryCallback> cb = NULL;
-					link_inventory_item(
-						gAgent.getID(),
-						inv_cat->getUUID(),
-						mUUID,
-						inv_cat->getName(),
-						LLAssetType::AT_LINK_FOLDER,
-						cb);
-				}
+					// BAP - should skip if dup.
+					if (move_is_into_current_outfit)
+					{
+						LLAppearanceMgr::instance().addEnsembleLink(inv_cat);
+					}
+					else
+					{
+						LLPointer<LLInventoryCallback> cb = NULL;
+						link_inventory_item(
+							gAgent.getID(),
+							inv_cat->getUUID(),
+							mUUID,
+							inv_cat->getName(),
+							LLAssetType::AT_LINK_FOLDER,
+							cb);
+					}
 #endif
 				}
 			}
@@ -1807,7 +1811,7 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 			}
 		}
 	}
-	else if(LLToolDragAndDrop::SOURCE_WORLD == source)
+	else if (LLToolDragAndDrop::SOURCE_WORLD == source)
 	{
 		// content category has same ID as object itself
 		LLUUID object_id = inv_cat->getUUID();
@@ -1935,7 +1939,7 @@ public:
 	LLRightClickInventoryFetchObserver(const LLUUID& cat_id, bool copy_items) :
 		mCatID(cat_id),
 		mCopyItems(copy_items)
-		{ };
+	{ };
 	virtual void done()
 	{
 		// we've downloaded all the items, so repaint the dialog
@@ -2024,14 +2028,14 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 //Uncomment the following code for laggy Inventory UI.
 /*	if(outfit->isEverythingComplete())
 	{
-		// everything is already here - call done.
-		outfit->done();
+	// everything is already here - call done.
+	outfit->done();
 	}
 	else
 	{
-		// it's all on it's way - add an observer, and the inventory
-		// will call done for us when everything is here.
-		gInventory.addObserver(outfit);
+	// it's all on it's way - add an observer, and the inventory
+	// will call done for us when everything is here.
+	gInventory.addObserver(outfit);
 	}*/
 }
 
@@ -2045,7 +2049,8 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 class LLInventoryCopyAndWearObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {}
+	LLInventoryCopyAndWearObserver(const LLUUID& cat_id, int count) :
+		mCatID(cat_id), mContentsCount(count), mFolderAdded(FALSE) {}
 	virtual ~LLInventoryCopyAndWearObserver() {}
 	virtual void changed(U32 mask);
 
@@ -2084,7 +2089,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 			if (NULL == category)
 			{
 				llwarns << "gInventory.getCategory(" << mCatID
-					<< ") was NULL" << llendl;
+						<< ") was NULL" << llendl;
 			}
 			else
 			{
@@ -2103,11 +2108,11 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask)
 
 
 
-void LLFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLFolderBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("open" == action)
 	{
-		LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(root->getItemByID(mUUID));
+		LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(mRoot->getItemByID(mUUID));
 		if (f)
 		{
 			f->setOpen(TRUE);
@@ -2460,16 +2465,16 @@ void LLFolderBridge::pasteLinkFromClipboard()
 			}
 			else
 #endif
-			if (LLInventoryItem *item = model->getItem(object_id))
-			{
-				link_inventory_item(
-					gAgent.getID(),
-					item->getLinkedUUID(),
-					parent_id,
-					item->getName(),
-					LLAssetType::AT_LINK,
-					LLPointer<LLInventoryCallback>(NULL));
-			}
+				if (LLInventoryItem *item = model->getItem(object_id))
+				{
+					link_inventory_item(
+						gAgent.getID(),
+						item->getLinkedUUID(),
+						parent_id,
+						item->getName(),
+						LLAssetType::AT_LINK,
+						LLPointer<LLInventoryCallback>(NULL));
+				}
 		}
 	}
 }
@@ -2494,7 +2499,7 @@ void LLFolderBridge::folderOptionsMenu()
 	const bool is_system_folder = LLFolderType::lookupIsProtectedType(type);
 	// BAP change once we're no longer treating regular categories as ensembles.
 	const bool is_ensemble = (type == LLFolderType::FT_NONE ||
-				  LLFolderType::lookupIsEnsembleType(type));
+							  LLFolderType::lookupIsEnsembleType(type));
 
 	// calling card related functionality for folders.
 
@@ -2624,10 +2629,10 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	const LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLFolderType::FT_LOST_AND_FOUND);
 
 	if (lost_and_found_id == mUUID)
-	  {
+	{
 		// This is the lost+found folder.
-		  mItems.push_back(std::string("Empty Lost And Found"));
-	  }
+		mItems.push_back(std::string("Empty Lost And Found"));
+	}
 
 	if(trash_id == mUUID)
 	{
@@ -2912,10 +2917,10 @@ void LLFolderBridge::createWearable(const LLUUID &parent_id, EWearableType type)
 	LLAssetType::EType asset_type = wearable->getAssetType();
 	LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
 	create_inventory_item(gAgent.getID(), gAgent.getSessionID(),
-		parent_id, wearable->getTransactionID(), wearable->getName(),
-		wearable->getDescription(), asset_type, inv_type, wearable->getType(),
-		wearable->getPermissions().getMaskNextOwner(),
-		LLPointer<LLInventoryCallback>(NULL));
+						  parent_id, wearable->getTransactionID(), wearable->getName(),
+						  wearable->getDescription(), asset_type, inv_type, wearable->getType(),
+						  wearable->getPermissions().getMaskNextOwner(),
+						  LLPointer<LLInventoryCallback>(NULL));
 }
 
 void LLFolderBridge::modifyOutfit(BOOL append)
@@ -2949,8 +2954,8 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 
 		two_uuids_list_t::iterator move_it;
 		for (move_it = move_inv->mMoveList.begin();
-			move_it != move_inv->mMoveList.end();
-			++move_it)
+			 move_it != move_inv->mMoveList.end();
+			 ++move_it)
 		{
 			object->moveInventory(move_it->first, move_it->second);
 		}
@@ -2990,11 +2995,11 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		BOOL is_movable = TRUE;
 		switch( inv_item->getActualType() )
 		{
-		case LLAssetType::AT_CATEGORY:
-			is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
-			break;
-		default:
-			break;
+			case LLAssetType::AT_CATEGORY:
+				is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType());
+				break;
+			default:
+				break;
 		}
 
 		const LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
@@ -3172,7 +3177,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		if(drop)
 		{
 			copy_inventory_from_notecard(LLToolDragAndDrop::getInstance()->getObjectID(),
-				LLToolDragAndDrop::getInstance()->getSourceID(), inv_item);
+										 LLToolDragAndDrop::getInstance()->getSourceID(), inv_item);
 		}
 	}
 	else if(LLToolDragAndDrop::SOURCE_LIBRARY == source)
@@ -3271,7 +3276,7 @@ void LLTextureBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 // virtual
-void LLTextureBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLTextureBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("save_as" == action)
 	{
@@ -3282,7 +3287,7 @@ void LLTextureBridge::performAction(LLFolderView* root, LLInventoryModel* model,
 			preview_texture->openToSave();
 		}
 	}
-	else LLItemBridge::performAction(root, model, action);
+	else LLItemBridge::performAction(model, action);
 }
 
 // +=================================================+
@@ -3307,14 +3312,14 @@ void LLSoundBridge::openItem()
 // only open the preview dialog through the contextual right-click menu
 // double-click just plays the sound
 
-	LLViewerInventoryItem* item = getItem();
-	if(item)
-	{
-		openSoundPreview((void*)this);
-		//send_uuid_sound_trigger(item->getAssetUUID(), 1.0);
-	}
-*/
+LLViewerInventoryItem* item = getItem();
+if(item)
+{
+openSoundPreview((void*)this);
+//send_uuid_sound_trigger(item->getAssetUUID(), 1.0);
 }
+*/
+		}
 
 void LLSoundBridge::previewItem()
 {
@@ -3359,8 +3364,11 @@ void LLSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 // |        LLLandmarkBridge                         |
 // +=================================================+
 
-LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags/* = 0x00*/) :
-LLItemBridge(inventory, uuid)
+LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory, 
+								   LLFolderView* root,
+								   const LLUUID& uuid, 
+								   U32 flags/* = 0x00*/) :
+	LLItemBridge(inventory, root, uuid)
 {
 	mVisited = FALSE;
 	if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
@@ -3421,7 +3429,7 @@ void teleport_via_landmark(const LLUUID& asset_id)
 }
 
 // virtual
-void LLLandmarkBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLLandmarkBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("teleport" == action)
 	{
@@ -3445,7 +3453,7 @@ void LLLandmarkBridge::performAction(LLFolderView* root, LLInventoryModel* model
 	}
 	else
 	{
-		LLItemBridge::performAction(root, model, action);
+		LLItemBridge::performAction(model, action);
 	}
 }
 
@@ -3472,35 +3480,33 @@ void LLLandmarkBridge::openItem()
 	{
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
-/*
-	LLViewerInventoryItem* item = getItem();
-	if( item )
-	{
-		// Opening (double-clicking) a landmark immediately teleports,
-		// but warns you the first time.
-		// open_landmark(item);
-		LLSD payload;
-		payload["asset_id"] = item->getAssetUUID();
-		LLNotificationsUtil::add("TeleportFromLandmark", LLSD(), payload);
-	}
-*/
 }
 
 
 // +=================================================+
 // |        LLCallingCardObserver                    |
 // +=================================================+
-void LLCallingCardObserver::changed(U32 mask)
+class LLCallingCardObserver : public LLFriendObserver
 {
-	mBridgep->refreshFolderViewItem();
-}
+public:
+	LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {}
+	virtual ~LLCallingCardObserver() { mBridgep = NULL; }
+	virtual void changed(U32 mask)
+	{
+		mBridgep->refreshFolderViewItem();
+	}
+protected:
+	LLCallingCardBridge* mBridgep;
+};
 
 // +=================================================+
 // |        LLCallingCardBridge                      |
 // +=================================================+
 
-LLCallingCardBridge::LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
-	LLItemBridge(inventory, uuid)
+LLCallingCardBridge::LLCallingCardBridge(LLInventoryPanel* inventory, 
+										 LLFolderView* root,
+										 const LLUUID& uuid ) :
+	LLItemBridge(inventory, root, uuid)
 {
 	mObserver = new LLCallingCardObserver(this);
 	LLAvatarTracker::instance().addObserver(mObserver);
@@ -3523,7 +3529,7 @@ void LLCallingCardBridge::refreshFolderViewItem()
 }
 
 // virtual
-void LLCallingCardBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLCallingCardBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("begin_im" == action)
 	{
@@ -3549,7 +3555,7 @@ void LLCallingCardBridge::performAction(LLFolderView* root, LLInventoryModel* mo
 			LLAvatarActions::offerTeleport(item->getCreatorUUID());
 		}
 	}
-	else LLItemBridge::performAction(root, model, action);
+	else LLItemBridge::performAction(model, action);
 }
 
 LLUIImagePtr LLCallingCardBridge::getIcon() const
@@ -3585,11 +3591,11 @@ void LLCallingCardBridge::openItem()
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
 /*
-	LLViewerInventoryItem* item = getItem();
-	if(item && !item->getCreatorUUID().isNull())
-	{
-		LLAvatarActions::showProfile(item->getCreatorUUID());
-	}
+  LLViewerInventoryItem* item = getItem();
+  if(item && !item->getCreatorUUID().isNull())
+  {
+  LLAvatarActions::showProfile(item->getCreatorUUID());
+  }
 */
 }
 
@@ -3612,8 +3618,8 @@ void LLCallingCardBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 		LLInventoryItem* item = getItem();
 		BOOL good_card = (item
-				  && (LLUUID::null != item->getCreatorUUID())
-				  && (item->getCreatorUUID() != gAgent.getID()));
+						  && (LLUUID::null != item->getCreatorUUID())
+						  && (item->getCreatorUUID() != gAgent.getID()));
 		BOOL user_online = FALSE;
 		if (item)
 		{
@@ -3648,16 +3654,16 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 		// check the type
 		switch(cargo_type)
 		{
-		case DAD_TEXTURE:
-		case DAD_SOUND:
-		case DAD_LANDMARK:
-		case DAD_SCRIPT:
-		case DAD_CLOTHING:
-		case DAD_OBJECT:
-		case DAD_NOTECARD:
-		case DAD_BODYPART:
-		case DAD_ANIMATION:
-		case DAD_GESTURE:
+			case DAD_TEXTURE:
+			case DAD_SOUND:
+			case DAD_LANDMARK:
+			case DAD_SCRIPT:
+			case DAD_CLOTHING:
+			case DAD_OBJECT:
+			case DAD_NOTECARD:
+			case DAD_BODYPART:
+			case DAD_ANIMATION:
+			case DAD_GESTURE:
 			{
 				LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
 				const LLPermissions& perm = inv_item->getPermissions();
@@ -3680,7 +3686,7 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 				}
 				break;
 			}
-		case DAD_CATEGORY:
+			case DAD_CATEGORY:
 			{
 				LLInventoryCategory* inv_cat = (LLInventoryCategory*)cargo_data;
 				if( gInventory.getCategory( inv_cat->getUUID() ) )
@@ -3702,8 +3708,8 @@ BOOL LLCallingCardBridge::dragOrDrop(MASK mask, BOOL drop,
 				}
 				break;
 			}
-		default:
-			break;
+			default:
+				break;
 		}
 	}
 	return rv;
@@ -3728,11 +3734,11 @@ void LLNotecardBridge::openItem()
 	}
 
 /*
-	LLViewerInventoryItem* item = getItem();
-	if (item)
-	{
-		LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
-	}
+  LLViewerInventoryItem* item = getItem();
+  if (item)
+  {
+  LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+  }
 */
 }
 
@@ -3773,7 +3779,7 @@ std::string LLGestureBridge::getLabelSuffix() const
 }
 
 // virtual
-void LLGestureBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLGestureBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -3819,7 +3825,7 @@ void LLGestureBridge::performAction(LLFolderView* root, LLInventoryModel* model,
 			playGesture(mUUID);
 		}
 	}
-	else LLItemBridge::performAction(root, model, action);
+	else LLItemBridge::performAction(model, action);
 }
 
 void LLGestureBridge::openItem()
@@ -3831,12 +3837,12 @@ void LLGestureBridge::openItem()
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
 /*
-	LLViewerInventoryItem* item = getItem();
-	if (item)
-	{
-		LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
-		preview->setFocus(TRUE);
-	}
+  LLViewerInventoryItem* item = getItem();
+  if (item)
+  {
+  LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+  preview->setFocus(TRUE);
+  }
 */
 }
 
@@ -3948,7 +3954,7 @@ void LLAnimationBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 // virtual
-void LLAnimationBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLAnimationBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ((action == "playworld") || (action == "playlocal"))
 	{
@@ -3967,7 +3973,7 @@ void LLAnimationBridge::performAction(LLFolderView* root, LLInventoryModel* mode
 	}
 	else
 	{
-		LLItemBridge::performAction(root, model, action);
+		LLItemBridge::performAction(model, action);
 	}
 }
 
@@ -3980,11 +3986,11 @@ void LLAnimationBridge::openItem()
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
 /*
-	LLViewerInventoryItem* item = getItem();
-	if (item)
-	{
-		LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
-	}
+  LLViewerInventoryItem* item = getItem();
+  if (item)
+  {
+  LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+  }
 */
 }
 
@@ -3995,8 +4001,13 @@ void LLAnimationBridge::openItem()
 // static
 LLUUID LLObjectBridge::sContextMenuItemID;
 
-LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags) :
-LLItemBridge(inventory, uuid), mInvType(type)
+LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory, 
+							   LLFolderView* root,
+							   const LLUUID& uuid, 
+							   LLInventoryType::EType type, 
+							   U32 flags) :
+	LLItemBridge(inventory, root, uuid), 
+	mInvType(type)
 {
 	mAttachPt = (flags & 0xff); // low bye of inventory flags
 
@@ -4020,7 +4031,7 @@ LLInventoryObject* LLObjectBridge::getObject() const
 }
 
 // virtual
-void LLObjectBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -4064,7 +4075,7 @@ void LLObjectBridge::performAction(LLFolderView* root, LLInventoryModel* model,
 			}
 		}
 	}
-	else LLItemBridge::performAction(root, model, action);
+	else LLItemBridge::performAction(model, action);
 }
 
 void LLObjectBridge::openItem()
@@ -4082,7 +4093,7 @@ void LLObjectBridge::openItem()
 
 	// Disable old properties floater; this is replaced by the sidepanel.
 	/*
-	LLFloaterReg::showInstance("properties", mUUID);
+	  LLFloaterReg::showInstance("properties", mUUID);
 	*/
 }
 
@@ -4333,19 +4344,25 @@ void LLLSLTextBridge::openItem()
 	{
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
-	/*
-	LLViewerInventoryItem* item = getItem();
-	if (item)
-	{
-		LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
-	}
-	*/
 }
 
 // +=================================================+
 // |        LLWearableBridge                         |
 // +=================================================+
 
+LLWearableBridge::LLWearableBridge(LLInventoryPanel* inventory, 
+								   LLFolderView* root, 
+								   const LLUUID& uuid, 
+								   LLAssetType::EType asset_type, 
+								   LLInventoryType::EType inv_type, 
+								   EWearableType  wearable_type) :
+	LLItemBridge(inventory, root, uuid),
+	mAssetType( asset_type ),
+	mInvType(inv_type),
+	mWearableType(wearable_type)
+{
+}
+
 // *NOTE: hack to get from avatar inventory to avatar
 void wear_inventory_item_on_avatar( LLInventoryItem* item )
 {
@@ -4366,10 +4383,10 @@ void wear_add_inventory_item_on_avatar( LLInventoryItem* item )
 				 << " )" << llendl;
 
 		LLWearableList::instance().getAsset(item->getAssetUUID(),
-							   item->getName(),
-							   item->getType(),
-							   LLWearableBridge::onWearAddOnAvatarArrived,
-							   new LLUUID(item->getUUID()));
+											item->getName(),
+											item->getType(),
+											LLWearableBridge::onWearAddOnAvatarArrived,
+											new LLUUID(item->getUUID()));
 	}
 }
 
@@ -4529,7 +4546,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const
 }
 
 // virtual
-void LLWearableBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLWearableBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if (isAddAction(action))
 	{
@@ -4549,7 +4566,7 @@ void LLWearableBridge::performAction(LLFolderView* root, LLInventoryModel* model
 		removeFromAvatar();
 		return;
 	}
-	else LLItemBridge::performAction(root, model, action);
+	else LLItemBridge::performAction(model, action);
 }
 
 void LLWearableBridge::openItem()
@@ -4560,42 +4577,6 @@ void LLWearableBridge::openItem()
 	{
 		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
 	}
-	/*
-	if( isItemInTrash() )
-	{
-		LLNotificationsUtil::add("CannotWearTrash");
-	}
-	else if(isAgentInventory())
-	{
-		if( !get_is_item_worn( mUUID ) )
-		{
-			wearOnAvatar();
-		}
-	}
-	else
-	{
-		// must be in the inventory library. copy it to our inventory
-		// and put it on right away.
-		LLViewerInventoryItem* item = getItem();
-		if(item && item->isComplete())
-		{
-			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
-			copy_inventory_item(
-				gAgent.getID(),
-				item->getPermissions().getOwner(),
-				item->getUUID(),
-				LLUUID::null,
-				std::string(),
-				cb);
-		}
-		else if(item)
-		{
-			// *TODO: We should fetch the item details, and then do
-			// the operation above.
-			LLNotificationsUtil::add("CannotWearInfoNotComplete");
-		}
-	}
-	*/
 }
 
 void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
@@ -4919,7 +4900,7 @@ void LLWearableBridge::onRemoveFromAvatarArrived(LLWearable* wearable,
 	delete on_remove_struct;
 }
 
-/* static */
+// static
 void LLWearableBridge::removeAllClothesFromAvatar()
 {
 	// Remove COF links.
@@ -4947,7 +4928,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
 	LLAgentWearables::userRemoveAllClothes();
 }
 
-/* static */
+// static
 void LLWearableBridge::removeItemFromAvatar(LLViewerInventoryItem *item)
 {
 	if (item)
@@ -4970,60 +4951,50 @@ void LLWearableBridge::removeFromAvatar()
 }
 
 LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
-													   const LLUUID& uuid,LLInventoryModel* model)
+													   const LLUUID& uuid,
+													   LLInventoryModel* model)
 {
 	LLInvFVBridgeAction* action = NULL;
 	switch(asset_type)
 	{
-	case LLAssetType::AT_TEXTURE:
-		action = new LLTextureBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_SOUND:
-		action = new LLSoundBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_LANDMARK:
-		action = new LLLandmarkBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_CALLINGCARD:
-		action = new LLCallingCardBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_OBJECT:
-		action = new LLObjectBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_NOTECARD:
-		action = new LLNotecardBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_ANIMATION:
-		action = new LLAnimationBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_GESTURE:
-		action = new LLGestureBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_LSL_TEXT:
-		action = new LLLSLTextBridgeAction(uuid,model);
-		break;
-
-	case LLAssetType::AT_CLOTHING:
-	case LLAssetType::AT_BODYPART:
-		action = new LLWearableBridgeAction(uuid,model);
-
-		break;
-
-	default:
-		break;
+		case LLAssetType::AT_TEXTURE:
+			action = new LLTextureBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_SOUND:
+			action = new LLSoundBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_LANDMARK:
+			action = new LLLandmarkBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_CALLINGCARD:
+			action = new LLCallingCardBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_OBJECT:
+			action = new LLObjectBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_NOTECARD:
+			action = new LLNotecardBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_ANIMATION:
+			action = new LLAnimationBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_GESTURE:
+			action = new LLGestureBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_LSL_TEXT:
+			action = new LLLSLTextBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_CLOTHING:
+		case LLAssetType::AT_BODYPART:
+			action = new LLWearableBridgeAction(uuid,model);
+			break;
+		default:
+			break;
 	}
 	return action;
 }
 
-//static
+// static
 void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
 								   const LLUUID& uuid,LLInventoryModel* model)
 {
@@ -5060,8 +5031,8 @@ LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const
 	return NULL;
 }
 
-//virtual
-void	LLTextureBridgeAction::doIt()
+// virtual
+void LLTextureBridgeAction::doIt()
 {
 	if (getItem())
 	{
@@ -5071,8 +5042,8 @@ void	LLTextureBridgeAction::doIt()
 	LLInvFVBridgeAction::doIt();
 }
 
-//virtual
-void	LLSoundBridgeAction::doIt()
+// virtual
+void LLSoundBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if(item)
@@ -5084,8 +5055,8 @@ void	LLSoundBridgeAction::doIt()
 }
 
 
-//virtual
-void	LLLandmarkBridgeAction::doIt()
+// virtual
+void LLLandmarkBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if( item )
@@ -5105,8 +5076,8 @@ void	LLLandmarkBridgeAction::doIt()
 }
 
 
-//virtual
-void	LLCallingCardBridgeAction::doIt()
+// virtual
+void LLCallingCardBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if(item && item->getCreatorUUID().notNull())
@@ -5117,9 +5088,8 @@ void	LLCallingCardBridgeAction::doIt()
 	LLInvFVBridgeAction::doIt();
 }
 
-//virtual
-void
-LLNotecardBridgeAction::doIt()
+// virtual
+void LLNotecardBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if (item)
@@ -5130,8 +5100,8 @@ LLNotecardBridgeAction::doIt()
 	LLInvFVBridgeAction::doIt();
 }
 
-//virtual
-void	LLGestureBridgeAction::doIt()
+// virtual
+void LLGestureBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if (item)
@@ -5143,7 +5113,7 @@ void	LLGestureBridgeAction::doIt()
 	LLInvFVBridgeAction::doIt();
 }
 
-//virtual
+// virtual
 void	LLAnimationBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
@@ -5156,18 +5126,18 @@ void	LLAnimationBridgeAction::doIt()
 }
 
 
-//virtual
-void	LLObjectBridgeAction::doIt()
+// virtual
+void LLObjectBridgeAction::doIt()
 {
 	/*
-	LLFloaterReg::showInstance("properties", mUUID);
+	  LLFloaterReg::showInstance("properties", mUUID);
 	*/
 	LLInvFVBridgeAction::doIt();
 }
 
 
-//virtual
-void	LLLSLTextBridgeAction::doIt()
+// virtual
+void LLLSLTextBridgeAction::doIt()
 {
 	LLViewerInventoryItem* item = getItem();
 	if (item)
@@ -5224,7 +5194,7 @@ void LLWearableBridgeAction::wearOnAvatar()
 	}
 }
 
-//virtual
+// virtual
 void LLWearableBridgeAction::doIt()
 {
 	if(isItemInTrash())
@@ -5268,11 +5238,8 @@ void LLWearableBridgeAction::doIt()
 // +=================================================+
 // |        LLLinkItemBridge                         |
 // +=================================================+
-// For broken links
-
+// For broken item links
 std::string LLLinkItemBridge::sPrefix("Link: ");
-
-
 LLUIImagePtr LLLinkItemBridge::getIcon() const
 {
 	if (LLViewerInventoryItem *item = getItem())
@@ -5284,7 +5251,6 @@ LLUIImagePtr LLLinkItemBridge::getIcon() const
 	}
 	return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
 }
-
 void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	// *TODO: Translate
@@ -5307,15 +5273,11 @@ void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	hide_context_entries(menu, items, disabled_items);
 }
 
-
 // +=================================================+
 // |        LLLinkBridge                             |
 // +=================================================+
-// For broken links.
-
+// For broken folder links.
 std::string LLLinkFolderBridge::sPrefix("Link: ");
-
-
 LLUIImagePtr LLLinkFolderBridge::getIcon() const
 {
 	LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
@@ -5328,7 +5290,6 @@ LLUIImagePtr LLLinkFolderBridge::getIcon() const
 	}
 	return LLFolderBridge::getIcon(preferred_type);
 }
-
 void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 {
 	// *TODO: Translate
@@ -5347,35 +5308,32 @@ void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 	}
 	hide_context_entries(menu, items, disabled_items);
 }
-
-void LLLinkFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("goto" == action)
 	{
-		gotoItem(root);
+		gotoItem();
 		return;
 	}
-	LLItemBridge::performAction(root,model,action);
+	LLItemBridge::performAction(model,action);
 }
-
-void LLLinkFolderBridge::gotoItem(LLFolderView* root)
+void LLLinkFolderBridge::gotoItem()
 {
 	const LLUUID &cat_uuid = getFolderID();
 	if (!cat_uuid.isNull())
 	{
-		if (LLFolderViewItem *base_folder = root->getItemByID(cat_uuid))
+		if (LLFolderViewItem *base_folder = mRoot->getItemByID(cat_uuid))
 		{
 			if (LLInventoryModel* model = getInventoryModel())
 			{
 				model->fetchDescendentsOf(cat_uuid);
 			}
 			base_folder->setOpen(TRUE);
-			root->setSelectionFromRoot(base_folder,TRUE);
-			root->scrollToShowSelection();
+			mRoot->setSelectionFromRoot(base_folder,TRUE);
+			mRoot->scrollToShowSelection();
 		}
 	}
 }
-
 const LLUUID &LLLinkFolderBridge::getFolderID() const
 {
 	if (LLViewerInventoryItem *link_item = getItem())
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 22e454d645..44165594ee 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -44,6 +44,7 @@
 class LLInventoryPanel;
 class LLInventoryModel;
 class LLMenuGL;
+class LLCallingCardObserver;
 
 enum EInventoryIcon
 {
@@ -134,6 +135,7 @@ public:
 									   LLAssetType::EType actual_asset_type,
 									   LLInventoryType::EType inv_type,
 									   LLInventoryPanel* inventory,
+									   LLFolderView* root,
 									   const LLUUID& uuid,
 									   U32 flags = 0x00);
 	virtual ~LLInvFVBridge() {}
@@ -199,7 +201,7 @@ protected:
 											 menuentry_vec_t &disabled_items);
 
 protected:
-	LLInvFVBridge(LLInventoryPanel* inventory, const LLUUID& uuid);
+	LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
 
 	LLInventoryObject* getInventoryObject() const;
 	LLInventoryModel* getInventoryModel() const;
@@ -221,9 +223,11 @@ protected:
 	void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
 protected:
 	LLHandle<LLPanel> mInventoryPanel;
+	LLFolderView* mRoot;
 	const LLUUID mUUID;	// item id
 	LLInventoryType::EType mInvType;
 	void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
+
 };
 
 /**
@@ -238,6 +242,7 @@ public:
 										LLAssetType::EType actual_asset_type,
 										LLInventoryType::EType inv_type,
 										LLInventoryPanel* inventory,
+										LLFolderView* root,
 										const LLUUID& uuid,
 										U32 flags = 0x00) const;
 };
@@ -246,15 +251,17 @@ public:
 class LLItemBridge : public LLInvFVBridge
 {
 public:
-	LLItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLInvFVBridge(inventory, uuid) {}
+	LLItemBridge(LLInventoryPanel* inventory, 
+				 LLFolderView* root,
+				 const LLUUID& uuid) :
+		LLInvFVBridge(inventory, root, uuid) {}
 
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 
 	virtual void selectItem();
 	virtual void restoreItem();
 	virtual void restoreToWorld();
-	virtual void gotoItem(LLFolderView* root);
+	virtual void gotoItem();
 	virtual LLUIImagePtr getIcon() const;
 	virtual const std::string& getDisplayName() const;
 	virtual std::string getLabelSuffix() const;
@@ -292,7 +299,7 @@ public:
 							BOOL drop);
 	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category,
 								BOOL drop);
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void closeItem();
 	virtual BOOL isItemRenameable() const;
@@ -332,9 +339,10 @@ public:
 	LLViewerInventoryCategory* getCategory() const;
 
 protected:
-	LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
-		: LLInvFVBridge(inventory, uuid),
-
+	LLFolderBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root,
+				   const LLUUID& uuid) :
+		LLInvFVBridge(inventory, root, uuid),
 		mCallingCards(FALSE),
 		mWearables(FALSE),
 		mMenu(NULL) {}
@@ -383,8 +391,10 @@ public:
 	LLUIImagePtr getIcon() const;
 
 protected:
-	LLScriptBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
-		LLItemBridge(inventory, uuid) {}
+	LLScriptBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root,
+				   const LLUUID& uuid ) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 
@@ -395,11 +405,16 @@ public:
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 
 protected:
-	LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type) :
-		LLItemBridge(inventory, uuid), mInvType(type) {}
+	LLTextureBridge(LLInventoryPanel* inventory, 
+					LLFolderView* root,
+					const LLUUID& uuid, 
+					LLInventoryType::EType type) :
+		LLItemBridge(inventory, root, uuid),
+		mInvType(type) 
+	{}
 	bool canSaveTexture(void);
 	LLInventoryType::EType mInvType;
 };
@@ -415,39 +430,31 @@ public:
 	static void openSoundPreview(void*);
 
 protected:
-	LLSoundBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLItemBridge(inventory, uuid) {}
+	LLSoundBridge(LLInventoryPanel* inventory, 
+				  LLFolderView* root,
+				  const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 class LLLandmarkBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 
 protected:
-	LLLandmarkBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags = 0x00);
+	LLLandmarkBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root,
+					 const LLUUID& uuid, 
+					 U32 flags = 0x00);
 
 protected:
 	BOOL mVisited;
 };
 
-class LLCallingCardBridge;
-
-class LLCallingCardObserver : public LLFriendObserver
-{
-public:
-	LLCallingCardObserver(LLCallingCardBridge* bridge) : mBridgep(bridge) {}
-	virtual ~LLCallingCardObserver() { mBridgep = NULL; }
-	virtual void changed(U32 mask);
-
-protected:
-	LLCallingCardBridge* mBridgep;
-};
-
 class LLCallingCardBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
@@ -455,7 +462,7 @@ public:
 	virtual std::string getLabelSuffix() const;
 	//virtual const std::string& getDisplayName() const;
 	virtual LLUIImagePtr getIcon() const;
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	//virtual void renameItem(const std::string& new_name);
@@ -466,7 +473,9 @@ public:
 	void refreshFolderViewItem();
 
 protected:
-	LLCallingCardBridge( LLInventoryPanel* inventory, const LLUUID& uuid );
+	LLCallingCardBridge(LLInventoryPanel* inventory, 
+						LLFolderView* folder,
+						const LLUUID& uuid );
 	~LLCallingCardBridge();
 	
 protected:
@@ -482,8 +491,10 @@ public:
 	virtual void openItem();
 
 protected:
-	LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLItemBridge(inventory, uuid) {}
+	LLNotecardBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root,
+					 const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 class LLGestureBridge : public LLItemBridge
@@ -497,7 +508,7 @@ public:
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
 
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual BOOL removeItem();
 
@@ -506,8 +517,10 @@ public:
 	static void playGesture(const LLUUID& item_id);
 
 protected:
-	LLGestureBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
-	:	LLItemBridge(inventory, uuid) {}
+	LLGestureBridge(LLInventoryPanel* inventory, 
+					LLFolderView* root,
+					const LLUUID& uuid)
+	:	LLItemBridge(inventory, root, uuid) {}
 };
 
 
@@ -515,15 +528,17 @@ class LLAnimationBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
 
 protected:
-	LLAnimationBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLItemBridge(inventory, uuid) {}
+	LLAnimationBridge(LLInventoryPanel* inventory, 
+					  LLFolderView* root, 
+					  const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 
@@ -532,7 +547,7 @@ class LLObjectBridge : public LLItemBridge
 	friend class LLInvFVBridge;
 public:
 	virtual LLUIImagePtr	getIcon() const;
-	virtual void			performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void			performAction(LLInventoryModel* model, std::string action);
 	virtual void			openItem();
 	virtual LLFontGL::StyleFlags getLabelStyle() const;
 	virtual std::string getLabelSuffix() const;
@@ -540,10 +555,12 @@ public:
 	virtual BOOL renameItem(const std::string& new_name);
 
 	LLInventoryObject* getObject() const;
-
 protected:
-	LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLInventoryType::EType type, U32 flags);
-
+	LLObjectBridge(LLInventoryPanel* inventory, 
+				   LLFolderView* root, 
+				   const LLUUID& uuid, 
+				   LLInventoryType::EType type, 
+				   U32 flags);
 protected:
 	static LLUUID	sContextMenuItemID;  // Only valid while the context menu is open.
 	LLInventoryType::EType mInvType;
@@ -560,8 +577,10 @@ public:
 	virtual void openItem();
 
 protected:
-	LLLSLTextBridge( LLInventoryPanel* inventory, const LLUUID& uuid ) :
-		LLItemBridge(inventory, uuid) {}
+	LLLSLTextBridge(LLInventoryPanel* inventory, 
+					LLFolderView* root, 
+					const LLUUID& uuid ) :
+		LLItemBridge(inventory, root, uuid) {}
 };
 
 
@@ -570,7 +589,7 @@ class LLWearableBridge : public LLItemBridge
 	friend class LLInvFVBridge;
 public:
 	virtual LLUIImagePtr getIcon() const;
-	virtual void	performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void	performAction(LLInventoryModel* model, std::string action);
 	virtual void	openItem();
 	virtual void	buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual std::string getLabelSuffix() const;
@@ -596,13 +615,12 @@ public:
 	void			removeFromAvatar();
 
 protected:
-	LLWearableBridge(LLInventoryPanel* inventory, const LLUUID& uuid, LLAssetType::EType asset_type, LLInventoryType::EType inv_type, EWearableType  wearable_type) :
-		LLItemBridge(inventory, uuid),
-		mAssetType( asset_type ),
-		mInvType(inv_type),
-		mWearableType(wearable_type)
-		{}
-
+	LLWearableBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root, 
+					 const LLUUID& uuid, 
+					 LLAssetType::EType asset_type, 
+					 LLInventoryType::EType inv_type, 
+					 EWearableType wearable_type);
 protected:
 	LLAssetType::EType mAssetType;
 	LLInventoryType::EType mInvType;
@@ -619,8 +637,10 @@ public:
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 
 protected:
-	LLLinkItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLItemBridge(inventory, uuid) {}
+	LLLinkItemBridge(LLInventoryPanel* inventory, 
+					 LLFolderView* root,
+					 const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 
 protected:
 	static std::string sPrefix;
@@ -635,12 +655,14 @@ public:
 
 	virtual LLUIImagePtr getIcon() const;
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
-	virtual void gotoItem(LLFolderView* root);
+	virtual void performAction(LLInventoryModel* model, std::string action);
+	virtual void gotoItem();
 
 protected:
-	LLLinkFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid) :
-		LLItemBridge(inventory, uuid) {}
+	LLLinkFolderBridge(LLInventoryPanel* inventory, 
+					   LLFolderView* root,
+					   const LLUUID& uuid) :
+		LLItemBridge(inventory, root, uuid) {}
 	const LLUUID &getFolderID() const;
 
 protected:
@@ -660,22 +682,21 @@ public:
 	// This method is a convenience function which creates the correct
 	// type of bridge action based on some basic information
 	static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type,
-											 const LLUUID& uuid,LLInventoryModel* model);
-
+											 const LLUUID& uuid,
+											 LLInventoryModel* model);
 	static void doAction(LLAssetType::EType asset_type,
 						 const LLUUID& uuid, LLInventoryModel* model);
 	static void doAction(const LLUUID& uuid, LLInventoryModel* model);
 
-	virtual void doIt() {  };
+	virtual void doIt() {};
 	virtual ~LLInvFVBridgeAction(){}//need this because of warning on OSX
 protected:
-	LLInvFVBridgeAction(const LLUUID& id,LLInventoryModel* model):mUUID(id),mModel(model){}
-
+	LLInvFVBridgeAction(const LLUUID& id, LLInventoryModel* model) :
+		mUUID(id), mModel(model) {}
 	LLViewerInventoryItem* getItem() const;
 protected:
 	const LLUUID& mUUID;	// item id
 	LLInventoryModel* mModel;
-
 };
 
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 4d490b0d24..c6c2d23a4b 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -506,8 +506,8 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 																			objectp->getType(),
 																			LLInventoryType::IT_CATEGORY,
 																			this,
+																			mFolderRoot,
 																			objectp->getUUID());
-			
 			if (new_listener)
 			{
 				LLFolderViewFolder::Params params;
@@ -542,6 +542,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 																			item->getActualType(),
 																			item->getInventoryType(),
 																			this,
+																			mFolderRoot,
 																			item->getUUID(),
 																			item->getFlags());
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 9a22d9ccf0..9cc79d95b8 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -989,7 +989,7 @@ void LLLandmarksPanel::onCustomAction(const LLSD& userdata)
 	std::string command_name = userdata.asString();
 	if("more_info" == command_name)
 	{
-		cur_item->getListener()->performAction(mCurrentSelectedList->getRootFolder(),mCurrentSelectedList->getModel(),"about");
+		cur_item->getListener()->performAction(mCurrentSelectedList->getModel(),"about");
 	}
 	else if ("teleport" == command_name)
 	{
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index e4f13cdeda..8be4c8402c 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1044,7 +1044,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
 		{
 			return;
 		}
-		current_item->getListener()->performAction(getActivePanel()->getRootFolder(), getActivePanel()->getModel(), "goto");
+		current_item->getListener()->performAction(getActivePanel()->getModel(), "goto");
 	}
 
 	if (command_name == "find_links")
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 988b5576c2..f70a06cde9 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -128,7 +128,7 @@ public:
 	virtual void pasteFromClipboard();
 	virtual void pasteLinkFromClipboard();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual BOOL isUpToDate() const { return TRUE; }
 	virtual BOOL hasChildren() const { return FALSE; }
 	virtual LLInventoryType::EType getInventoryType() const { return LLInventoryType::IT_NONE; }
@@ -595,7 +595,7 @@ BOOL LLTaskInvFVBridge::dragOrDrop(MASK mask, BOOL drop,
 }
 
 // virtual
-void LLTaskInvFVBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if (action == "task_buy")
 	{
@@ -917,7 +917,7 @@ public:
 
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
-	virtual void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	static void openSoundPreview(void* data);
 };
@@ -954,7 +954,7 @@ void LLTaskSoundBridge::openSoundPreview(void* data)
 }
 
 // virtual
-void LLTaskSoundBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLTaskSoundBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if (action == "task_play")
 	{
@@ -964,7 +964,7 @@ void LLTaskSoundBridge::performAction(LLFolderView* root, LLInventoryModel* mode
 			send_sound_trigger(item->getAssetUUID(), 1.0);
 		}
 	}
-	LLTaskInvFVBridge::performAction(root, model, action);
+	LLTaskInvFVBridge::performAction(model, action);
 }
 
 void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 09a93e3714..eb13115677 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -242,7 +242,7 @@ void LLPanelOutfitsInventory::onWearButtonClick()
 	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
 	if (listenerp)
 	{
-		listenerp->performAction(NULL, NULL,"replaceoutfit");
+		listenerp->performAction(NULL, "replaceoutfit");
 	}
 }
 
@@ -251,7 +251,7 @@ void LLPanelOutfitsInventory::onAdd()
 	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
 	if (listenerp)
 	{
-		listenerp->performAction(NULL, NULL,"addtooutfit");
+		listenerp->performAction(NULL, "addtooutfit");
 	}
 }
 
@@ -260,7 +260,7 @@ void LLPanelOutfitsInventory::onRemove()
 	LLFolderViewEventListener* listenerp = getCorrectListenerForAction();
 	if (listenerp)
 	{
-		listenerp->performAction(NULL, NULL,"removefromoutfit");
+		listenerp->performAction(NULL, "removefromoutfit");
 	}
 }
 
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index f003a9b9ec..b4f960f4ac 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -122,7 +122,7 @@ void LLPlacesFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 }
 
 //virtual
-void LLPlacesFolderBridge::performAction(LLFolderView* root, LLInventoryModel* model, std::string action)
+void LLPlacesFolderBridge::performAction(LLInventoryModel* model, std::string action)
 {
 	if ("expand" == action)
 	{
@@ -136,7 +136,7 @@ void LLPlacesFolderBridge::performAction(LLFolderView* root, LLInventoryModel* m
 	}
 	else
 	{
-		LLFolderBridge::performAction(root, model, action);
+		LLFolderBridge::performAction(model, action);
 	}
 }
 
@@ -158,6 +158,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
 	LLAssetType::EType actual_asset_type,
 	LLInventoryType::EType inv_type,
 	LLInventoryPanel* inventory,
+	LLFolderView* root,
 	const LLUUID& uuid,
 	U32 flags/* = 0x00*/) const
 {
@@ -169,7 +170,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
 		{
 			llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
 		}
-		new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, uuid, flags);
+		new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags);
 		break;
 	case LLAssetType::AT_CATEGORY:
 		if (actual_asset_type == LLAssetType::AT_LINK_FOLDER)
@@ -180,11 +181,12 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
 				actual_asset_type,
 				inv_type,
 				inventory,
+				root,
 				uuid,
 				flags);
 			break;
 		}
-		new_listener = new LLPlacesFolderBridge(inv_type, inventory, uuid);
+		new_listener = new LLPlacesFolderBridge(inv_type, inventory, root, uuid);
 		break;
 	default:
 		new_listener = LLInventoryFVBridgeBuilder::createBridge(
@@ -192,6 +194,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
 			actual_asset_type,
 			inv_type,
 			inventory,
+			root,
 			uuid,
 			flags);
 	}
diff --git a/indra/newview/llplacesinventorybridge.h b/indra/newview/llplacesinventorybridge.h
index e90cc45356..7e5170cc33 100644
--- a/indra/newview/llplacesinventorybridge.h
+++ b/indra/newview/llplacesinventorybridge.h
@@ -48,8 +48,15 @@ public:
 	/*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
 
 protected:
-	LLPlacesLandmarkBridge(LLInventoryType::EType type, LLInventoryPanel* inventory, const LLUUID& uuid, U32 flags = 0x00)
-		: LLLandmarkBridge(inventory, uuid, flags) {mInvType = type;}
+	LLPlacesLandmarkBridge(LLInventoryType::EType type, 
+						   LLInventoryPanel* inventory,
+						   LLFolderView* root,
+						   const LLUUID& uuid, 
+						   U32 flags = 0x00) :
+		LLLandmarkBridge(inventory, root, uuid, flags)
+	{
+		mInvType = type;
+	}
 };
 
 /**
@@ -61,12 +68,17 @@ class LLPlacesFolderBridge : public LLFolderBridge
 
 public:
 	/*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
-	/*virtual*/ void performAction(LLFolderView* root, LLInventoryModel* model, std::string action);
+	/*virtual*/ void performAction(LLInventoryModel* model, std::string action);
 
 protected:
-	LLPlacesFolderBridge(LLInventoryType::EType type, LLInventoryPanel* inventory, const LLUUID& uuid)
-		: LLFolderBridge(inventory, uuid) {mInvType = type;}
-
+	LLPlacesFolderBridge(LLInventoryType::EType type, 
+						 LLInventoryPanel* inventory,
+						 LLFolderView* root,						 
+						 const LLUUID& uuid) :
+		LLFolderBridge(inventory, root, uuid)
+	{
+		mInvType = type;
+	}
 	LLFolderViewFolder* getFolder();
 };
 
@@ -79,13 +91,13 @@ protected:
 class LLPlacesInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder
 {
 public:
-	/*virtual*/ LLInvFVBridge* createBridge(
-		LLAssetType::EType asset_type,
-		LLAssetType::EType actual_asset_type,
-		LLInventoryType::EType inv_type,
-		LLInventoryPanel* inventory,
-		const LLUUID& uuid,
-		U32 flags = 0x00) const;
+	/*virtual*/ LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
+											LLAssetType::EType actual_asset_type,
+											LLInventoryType::EType inv_type,
+											LLInventoryPanel* inventory,
+											LLFolderView* root,
+											const LLUUID& uuid,
+											U32 flags = 0x00) const;
 };
 
 #endif // LL_LLPLACESINVENTORYBRIDGE_H
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 73880563d7..18e56a9c01 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -161,7 +161,7 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)
 	{
 		return;
 	}
-	current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getRootFolder(), panel_main_inventory->getActivePanel()->getModel(), action);
+	current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action);
 }
 
 void LLSidepanelInventory::onWearButtonClicked()
-- 
cgit v1.2.3


From 39ef9e9dd6cbeb26b7e223888a17380a272370bb Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 14:56:53 -0700
Subject: EXT-6492 - button halign=center doesn't take into account left and
 right pad

---
 indra/llui/llbutton.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp
index 1d4dc35cee..33c6a8b6ac 100644
--- a/indra/llui/llbutton.cpp
+++ b/indra/llui/llbutton.cpp
@@ -824,7 +824,7 @@ void LLButton::draw()
 			x = text_right;
 			break;
 		case LLFontGL::HCENTER:
-			x = getRect().getWidth() / 2;
+			x = text_left + (text_width / 2);
 			break;
 		case LLFontGL::LEFT:
 		default:
-- 
cgit v1.2.3


From 1d0f98f075471797605ed2b79fcbb9d79eb7291a Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:08:17 -0700
Subject: EXT-5584 	 color picker swatches are missing pure red and many
 common shades reviewed by Richard cc#176

---
 indra/newview/skins/default/colors.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index fcf5cfadb2..bea610a909 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -61,7 +61,7 @@
 	value="0.26 0.345 0.263 1" />
 	<color
 	 name="Red"
-	 value="0.729 0 0.121 1" />
+	 value="1 0 0 1" />
 	<color
 	 name="Blue"
 	 value="0 0 1 1" />
@@ -197,7 +197,7 @@
      value="0.5 0.5 0.5 1" />
     <color
      name="ColorPaletteEntry03"
-     value="0.3344 0.5456 0.5159 1" />
+     value="0.5 0 0 1" />
     <color
      name="ColorPaletteEntry04"
      value="0.5 0.5 0 1" />
@@ -239,7 +239,7 @@
      reference="LtYellow" />
     <color
      name="ColorPaletteEntry17"
-     reference="LtGreen" />
+     reference="White" />
     <color
      name="ColorPaletteEntry18"
      reference="LtGray" />
@@ -248,7 +248,7 @@
      reference="Red" />
     <color
      name="ColorPaletteEntry20"
-     reference=".5 .5 1 0" />
+     reference="Yellow" />
     <color
      name="ColorPaletteEntry21"
      reference="Green" />
-- 
cgit v1.2.3


From b6109c46451ab097ff4ce9d8d46ca596b0ab0ce0 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:10:30 -0700
Subject: EXT-5168 	 prefs review: Remove "Small nametags" option reviewed
 by Richard cc#176

---
 indra/newview/app_settings/settings.xml               | 11 -----------
 indra/newview/llfloaterpreference.cpp                 | 14 --------------
 indra/newview/llvoavatar.cpp                          |  9 +--------
 .../default/xui/en/panel_preferences_general.xml      | 19 ++++---------------
 4 files changed, 5 insertions(+), 48 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 73fb24e4eb..f50eee27de 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8653,17 +8653,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>SmallAvatarNames</key>
-    <map>
-      <key>Comment</key>
-      <string>Display avatar name text in smaller font</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>SnapEnabled</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 3487f52f35..764a0dc954 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -182,7 +182,6 @@ void LLVoiceSetKeyDialog::onCancel(void* user_data)
 // if creating/destroying these is too slow, we'll need to create
 // a static member and update all our static callbacks
 
-void handleNameTagOptionChanged(const LLSD& newvalue);	
 bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response);
 
 //bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
@@ -218,15 +217,6 @@ bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response
 	return false;
 }
 
-void handleNameTagOptionChanged(const LLSD& newvalue)
-{
-	S32 name_tag_option = S32(newvalue);
-	if(name_tag_option==2)
-	{
-		gSavedSettings.setBOOL("SmallAvatarNames", TRUE);
-	}
-}
-
 /*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
@@ -319,8 +309,6 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.MaturitySettings",		boost::bind(&LLFloaterPreference::onChangeMaturity, this));
 
 	sSkin = gSavedSettings.getString("SkinCurrent");
-	
-	gSavedSettings.getControl("AvatarNameTagMode")->getCommitSignal()->connect(boost::bind(&handleNameTagOptionChanged,  _2));
 }
 
 BOOL LLFloaterPreference::postBuild()
@@ -336,8 +324,6 @@ BOOL LLFloaterPreference::postBuild()
 	LLTabContainer* tabcontainer = getChild<LLTabContainer>("pref core");
 	if (!tabcontainer->selectTab(gSavedSettings.getS32("LastPrefTab")))
 		tabcontainer->selectFirstTab();
-	S32 show_avatar_nametag_options = gSavedSettings.getS32("AvatarNameTagMode");
-	handleNameTagOptionChanged(LLSD(show_avatar_nametag_options));
 
 	std::string cache_location = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "");
 	childSetText("cache_location", cache_location);
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index c400e8510e..0ce8894872 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2929,14 +2929,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)
 			}
 			else
 			{
-				if (gSavedSettings.getBOOL("SmallAvatarNames"))
-				{
-					mNameText->setFont(LLFontGL::getFontSansSerif());
-				}
-				else
-				{
-					mNameText->setFont(LLFontGL::getFontSansSerifBig());
-				}
+				mNameText->setFont(LLFontGL::getFontSansSerif());
 				mNameText->setTextAlignment(LLHUDText::ALIGN_TEXT_CENTER);
 				mNameText->setFadeDistance(CHAT_NORMAL_RADIUS, 5.f);
 				mNameText->setVisibleOffScreen(FALSE);
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_general.xml b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
index e667fa9a2b..9eaabbe77b 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_general.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_general.xml
@@ -177,7 +177,7 @@
      layout="topleft"
      left="30"
      name="start_location_textbox"
-     top_pad="10"
+     top_pad="15"
      width="394">
         Start location:
     </text>
@@ -256,26 +256,15 @@
      left="50"
      name="show_my_name_checkbox1"
      width="300" />
-    <check_box
-	 enabled_control="AvatarNameTagMode"
-     control_name="SmallAvatarNames"
-     height="16"
-     initial_value="true"
-     label="Small name tags"
-     layout="topleft"
-     left_delta="175"
-     name="small_avatar_names_checkbox"
-     width="200" />
    <check_box
 	 enabled_control="AvatarNameTagMode"
      control_name="RenderShowGroupTitleAll"
      height="16"
      label="Show group titles"
      layout="topleft"
-     left_delta="-175"
+     left_delta="175"
      name="show_all_title_checkbox1"
-     top_pad="5"
-     width="300" />
+     width="200" />
     <text
      type="string"
      length="1"
@@ -354,7 +343,7 @@
      left="30"
      mouse_opaque="false"
      name="text_box3"
-     top_pad="10"
+     top_pad="15"
      width="240">
        Busy mode response:
     </text>
-- 
cgit v1.2.3


From 38c1bc9e9a533b6f9b2e1fc8258da482f25aec8b Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:11:13 -0700
Subject: EXT-5179 In Prefs->Setup, move Other Devices to bottom of window or
 to advanced  EXT-5170 prefs review: move UI size to advanced reviewed by
 Richard CC#176

---
 .../default/xui/en/panel_preferences_advanced.xml  | 43 +++++++++++++++++++++-
 .../default/xui/en/panel_preferences_graphics1.xml | 29 +--------------
 .../default/xui/en/panel_preferences_setup.xml     | 14 +------
 3 files changed, 43 insertions(+), 43 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
index e604e401f6..69e8e6fdcc 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
@@ -186,6 +186,32 @@ Automatic position for:
 		     function="Pref.applyUIColor"
 		     parameter="BackgroundChatColor" />
     </color_swatch>
+  <text
+   type="string"
+   length="1"
+   follows="left|top"
+   height="12"
+   layout="topleft"
+   left="30"
+   name="UI Size:"
+   top_pad="5"
+   width="300">
+    UI size
+  </text>
+  <slider
+   control_name="UIScaleFactor"
+   decimal_digits="2"
+   follows="left|top"
+   height="17"
+   increment="0.025"
+   initial_value="1"
+   layout="topleft"
+   left_delta="52"
+   max_val="1.4"
+   min_val="0.75"
+   name="ui_scale_slider"
+   top_pad="-14"
+   width="180" />
     <check_box
      control_name="ShowScriptErrors"
      follows="left|top"
@@ -193,6 +219,7 @@ Automatic position for:
      label="Show script errors in:"
      layout="topleft"
      left="30"
+     top_pad="10" 
      name="show_script_errors"
      width="256" />
     <radio_group
@@ -247,6 +274,7 @@ Automatic position for:
      top_pad="5"
      width="200" />
     <button
+     layout="topleft" 
      follows="top|left"
      enabled_control="EnableVoiceChat"
      height="23"
@@ -257,8 +285,8 @@ Automatic position for:
           <button.commit_callback
           function="Pref.VoiceSetKey" />
     </button>
-    <button
-     enabled_control="EnableVoiceChat"
+  <button
+   enabled_control="EnableVoiceChat"
      follows="top|left"
      halign="center"
      height="23"
@@ -271,4 +299,15 @@ Automatic position for:
           <button.commit_callback
           function="Pref.VoiceSetMiddleMouse" />
     </button>
+  <button
+ height="23"
+ label="Other Devices"
+ left="30"
+ name="joystick_setup_button"
+ top_pad="12"
+ width="155">
+    <button.commit_callback
+     function="Floater.Show"
+     parameter="pref_joystick" />
+  </button>
 </panel>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index c74de043e9..44c44f5f59 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -9,33 +9,6 @@
  name="Display panel"
  top="1"
  width="517">
-    <text
-     type="string"
-     length="1"
-     follows="left|top"
-     height="12"
-     layout="topleft"
-     left="30"
-     name="UI Size:"
-     top="10"
-     width="300">
-        UI size:
-    </text>
-    <slider
-     can_edit_text="true"
-     control_name="UIScaleFactor"
-     decimal_digits="2"
-     follows="left|top"
-     height="15"
-     increment="0.025"
-     initial_value="1"
-     layout="topleft"
-     left_delta="52"
-     max_val="1.4"
-     min_val="0.75"
-     name="ui_scale_slider"
-     top_pad="2"
-     width="180" />
     <text
      type="string"
      length="1"
@@ -44,7 +17,7 @@
      layout="topleft"
      left="30"
      name="QualitySpeed"
-     top_pad="4"
+     top="10" 
      width="400">
         Quality and speed:
     </text>
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
index 2123e62daa..8d7b40b386 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_setup.xml
@@ -9,18 +9,6 @@
  name="Input panel"
  top="1"
  width="517">
-  <button
-   height="23"
-   label="Other Devices"
-   layout="topleft"
-   left="30"
-   name="joystick_setup_button"
-   top="10"
-   width="155">
-    <button.commit_callback
-     function="Floater.Show"
-     parameter="pref_joystick" />
-  </button>
   <text
    type="string"
    length="1"
@@ -29,7 +17,7 @@
    layout="topleft"
    left="30"
    name="Mouselook:"
-   top_pad="10"
+   top="10"
    width="300">
     Mouselook:
   </text>
-- 
cgit v1.2.3


From 8a22ffa622912f21908b35335e5fdb21e0596a14 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:12:20 -0700
Subject: EXT-5110 	 Save Outfit dialog is non-standard modal dialog
 (off-center placement, empty titlebar) reviewed by Richard CC#176

---
 indra/newview/llpaneloutfitsinventory.cpp          | 113 +++++++--------------
 indra/newview/llpaneloutfitsinventory.h            |   2 +-
 .../newview/skins/default/xui/en/notifications.xml |  22 ++++
 3 files changed, 61 insertions(+), 76 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index dd320f8328..7137022447 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -48,6 +48,7 @@
 #include "lllandmark.h"
 #include "lllineeditor.h"
 #include "llmodaldialog.h"
+#include "llnotificationsutil.h"
 #include "llsidepanelappearance.h"
 #include "llsidetray.h"
 #include "lltabcontainer.h"
@@ -68,75 +69,13 @@ static const std::string COF_TAB_NAME = "cof_tab";
 static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
 bool LLPanelOutfitsInventory::sShowDebugEditor = false;
 
-class LLOutfitSaveAsDialog : public LLModalDialog
-{
-private:
-	std::string	mItemName;
-	std::string mTempItemName;
-	
-	boost::signals2::signal<void (const std::string&)> mSaveAsSignal;
-
-public:
-	LLOutfitSaveAsDialog( const LLSD& key )
-		: LLModalDialog( key ),
-		  mTempItemName(key.asString())
-	{
-	}
-		
-	BOOL postBuild()
-	{
-		getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onSave, this ));
-		getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onCancel, this ));
-		
-		childSetTextArg("name ed", "[DESC]", mTempItemName);
-		return TRUE;
-	}
-
-	void setSaveAsCommit( const boost::signals2::signal<void (const std::string&)>::slot_type& cb )
-	{
-		mSaveAsSignal.connect(cb);
-	}
-
-	virtual void onOpen(const LLSD& key)
-	{
-		LLLineEditor* edit = getChild<LLLineEditor>("name ed");
-		if (edit)
-		{
-			edit->setFocus(TRUE);
-			edit->selectAll();
-		}
-	}
 
-	void onSave()
-	{
-		mItemName = childGetValue("name ed").asString();
-		LLStringUtil::trim(mItemName);
-		if( !mItemName.empty() )
-		{
-			mSaveAsSignal(mItemName);
-			closeFloater(); // destroys this object
-		}
-	}
-
-	void onCancel()
-	{
-		closeFloater(); // destroys this object
-	}
-};
-	
 LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
 	mActivePanel(NULL),
 	mParent(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
-
-	static bool registered_dialog = false;
-	if (!registered_dialog)
-	{
-		LLFloaterReg::add("outfit_save_as", "floater_outfit_save_as.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutfitSaveAsDialog>);
-		registered_dialog = true;
-	}
 }
 
 LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
@@ -268,6 +207,31 @@ void LLPanelOutfitsInventory::onEdit()
 {
 }
 
+bool LLPanelOutfitsInventory::onSaveCommit(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (0 == option)
+	{
+		std::string outfit_name = response["message"].asString();
+		LLStringUtil::trim(outfit_name);
+		if( !outfit_name.empty() )
+		{
+			LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
+			LLSD key;
+			LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
+
+			if (mAppearanceTabs)
+			{
+				mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
+			}	
+		}
+	}
+
+	return false;
+}
+
+
+
 void LLPanelOutfitsInventory::onSave()
 {
 	std::string outfit_name;
@@ -277,23 +241,22 @@ void LLPanelOutfitsInventory::onSave()
 		outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
 	}
 
+	LLSD args;
+	args["DESC"] = outfit_name;
+
+	LLSD payload;
+	//payload["ids"].append(*it);
+	
+	LLNotificationsUtil::add("SaveOutfitAs", args, payload, boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1, _2));
+
+	//)
+	
+/*
 	LLOutfitSaveAsDialog* save_as_dialog = LLFloaterReg::showTypedInstance<LLOutfitSaveAsDialog>("outfit_save_as", LLSD(outfit_name), TRUE);
 	if (save_as_dialog)
 	{
 		save_as_dialog->setSaveAsCommit(boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1 ));
-	}
-}
-
-void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name)
-{
-	LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
-	LLSD key;
-	LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
-
-	if (mAppearanceTabs)
-	{
-		mAppearanceTabs->selectTabByName(OUTFITS_TAB_NAME);
-	}
+	}*/
 }
 
 void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index ab25ef0a49..a4d38df740 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -61,7 +61,7 @@ public:
 	void onEdit();
 	void onSave();
 	
-	void onSaveCommit(const std::string& item_name);
+	bool onSaveCommit(const LLSD& notification, const LLSD& response);
 
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	void onSelectorButtonClicked();
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c39a91281e..f52996724f 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -2023,6 +2023,28 @@ Would you be my friend?
     </form>
   </notification>
 
+  <notification
+ icon="alertmodal.tga"
+ label="Save Outfit"
+ name="SaveOutfitAs"
+ type="alertmodal">
+    Save what I'm wearing as a new Outfit:
+    <form name="form">
+      <input name="message" type="text">
+        [DESC] (new)
+      </input>
+      <button
+       default="true"
+       index="0"
+       name="Offer"
+       text="OK"/>
+      <button
+       index="1"
+       name="Cancel"
+       text="Cancel"/>
+    </form>
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="RemoveFromFriends"
-- 
cgit v1.2.3


From 959ec0c305914ac71caa12920ca81230d5d9a6c4 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:13:03 -0700
Subject: EXT-3792 	 Legacy menus are still displayed in Inventory in
 Inventory side panel reviewed by Richard CC#176

---
 .../skins/default/xui/en/panel_main_inventory.xml  | 369 +--------------------
 1 file changed, 4 insertions(+), 365 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index bef62f48e0..11998a774d 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -38,367 +38,6 @@
 		     width="300">
 	        Items:
     </text>
-    <menu_bar
-     bg_visible="false"
-     follows="left|top|right"
-     height="20"
-     layout="topleft"
-     left="10"
-     mouse_opaque="false"
-     name="Inventory Menu"
-     top="+10"
-	 visible="true"
-     width="290">
-        <menu
-         height="101"
-         label="File"
-         layout="topleft"
-         left="0"
-         mouse_opaque="false"
-         name="File"
-         tear_off="true"
-         top="-117"
-         width="128">
-            <menu_item_call
-             label="Open"
-             layout="topleft"
-             name="Open">
-                <menu_item_call.on_click
-                 function="Inventory.DoToSelected"
-                 parameter="open" />
-            </menu_item_call>
-            <menu
-             create_jump_keys="true"
-             label="Upload"
-             layout="topleft"
-             name="upload"
-             tear_off="true">
-                <menu_item_call
-                 label="Image (L$[COST])..."
-                 layout="topleft"
-                 name="Upload Image"
-                 shortcut="control|U">
-                    <menu_item_call.on_click
-                     function="File.UploadImage"
-                     parameter="" />
-                    <menu_item_call.on_enable
-                     function="File.EnableUpload" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Sound (L$[COST])..."
-                 layout="topleft"
-                 name="Upload Sound">
-                    <menu_item_call.on_click
-                     function="File.UploadSound"
-                     parameter="" />
-                    <menu_item_call.on_enable
-                     function="File.EnableUpload" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Animation (L$[COST])..."
-                 layout="topleft"
-                 name="Upload Animation">
-                    <menu_item_call.on_click
-                     function="File.UploadAnim"
-                     parameter="" />
-                    <menu_item_call.on_enable
-                     function="File.EnableUpload" />
-                </menu_item_call>
-                <menu_item_call
-                 label="Bulk (L$[COST] per file)..."
-                 layout="topleft"
-                 name="Bulk Upload">
-                    <menu_item_call.on_click
-                     function="File.UploadBulk"
-                     parameter="" />
-                </menu_item_call>
-                <menu_item_separator
-                 layout="topleft" />
-            </menu>
-            <menu_item_separator
-             layout="topleft" />
-            <menu_item_call
-             label="New Window"
-             layout="topleft"
-             name="New Window">
-                <menu_item_call.on_click
-                 function="Inventory.NewWindow" />
-            </menu_item_call>
-            <menu_item_separator
-             layout="topleft"
-             name="separator2" />
-            <menu_item_call
-             label="Show Filters"
-             layout="topleft"
-             name="Show Filters">
-                <menu_item_call.on_click
-                 function="Inventory.ShowFilters" />
-            </menu_item_call>
-            <menu_item_call
-             label="Reset Filters"
-             layout="topleft"
-             name="Reset Current">
-                <menu_item_call.on_click
-                 function="Inventory.ResetFilters" />
-            </menu_item_call>
-            <menu_item_call
-             label="Close All Folders"
-             layout="topleft"
-             name="Close All Folders">
-                <menu_item_call.on_click
-                 function="Inventory.CloseAllFolders" />
-            </menu_item_call>
-            <menu_item_separator
-             layout="topleft"
-             name="separator3" />
-            <menu_item_call
-             label="Empty Trash"
-             layout="topleft"
-             name="Empty Trash">
-                <menu_item_call.on_click
-                 function="Inventory.EmptyTrash" />
-            </menu_item_call>
-            <menu_item_call
-             label="Empty Lost And Found"
-             layout="topleft"
-             name="Empty Lost And Found">
-                <menu_item_call.on_click
-                 function="Inventory.EmptyLostAndFound" />
-            </menu_item_call>
-        </menu>
-        <menu
-         height="121"
-         label="Create"
-         layout="topleft"
-         left="0"
-         mouse_opaque="false"
-         name="Create"
-         tear_off="true"
-         top="-201"
-         width="121">
-            <menu_item_call
-             label="New Folder"
-             layout="topleft"
-             name="New Folder">
-                <menu_item_call.on_click
-                 function="Inventory.DoCreate"
-                 parameter="category" />
-            </menu_item_call>
-            <menu_item_call
-             label="New Script"
-             layout="topleft"
-             name="New Script">
-                <menu_item_call.on_click
-                 function="Inventory.DoCreate"
-                 parameter="lsl" />
-            </menu_item_call>
-            <menu_item_call
-             label="New Notecard"
-             layout="topleft"
-             name="New Note">
-                <menu_item_call.on_click
-                 function="Inventory.DoCreate"
-                 parameter="notecard" />
-            </menu_item_call>
-            <menu_item_call
-             label="New Gesture"
-             layout="topleft"
-             name="New Gesture">
-                <menu_item_call.on_click
-                 function="Inventory.DoCreate"
-                 parameter="gesture" />
-            </menu_item_call>
-            <menu
-             height="175"
-             label="New Clothes"
-             layout="topleft"
-             left_delta="0"
-             mouse_opaque="false"
-             name="New Clothes"
-             top_pad="514"
-             width="125">
-                <menu_item_call
-                 label="New Shirt"
-                 layout="topleft"
-                 name="New Shirt">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="shirt" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Pants"
-                 layout="topleft"
-                 name="New Pants">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="pants" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Shoes"
-                 layout="topleft"
-                 name="New Shoes">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="shoes" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Socks"
-                 layout="topleft"
-                 name="New Socks">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="socks" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Jacket"
-                 layout="topleft"
-                 name="New Jacket">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="jacket" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Skirt"
-                 layout="topleft"
-                 name="New Skirt">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="skirt" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Gloves"
-                 layout="topleft"
-                 name="New Gloves">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="gloves" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Undershirt"
-                 layout="topleft"
-                 name="New Undershirt">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="undershirt" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Underpants"
-                 layout="topleft"
-                 name="New Underpants">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="underpants" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Alpha"
-                 layout="topleft"
-                 name="New Alpha">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="alpha" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Tattoo"
-                 layout="topleft"
-                 name="New Tattoo">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="tattoo" />
-                </menu_item_call>
-            </menu>
-            <menu
-             height="85"
-             label="New Body Parts"
-             layout="topleft"
-             left_delta="0"
-             mouse_opaque="false"
-             name="New Body Parts"
-             top_pad="514"
-             width="118">
-                <menu_item_call
-                 label="New Shape"
-                 layout="topleft"
-                 name="New Shape">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="shape" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Skin"
-                 layout="topleft"
-                 name="New Skin">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="skin" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Hair"
-                 layout="topleft"
-                 name="New Hair">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="hair" />
-                </menu_item_call>
-                <menu_item_call
-                 label="New Eyes"
-                 layout="topleft"
-                 name="New Eyes">
-                    <menu_item_call.on_click
-                     function="Inventory.DoCreate"
-                     parameter="eyes" />
-                </menu_item_call>
-            </menu>
-        </menu>
-        <menu
-         height="49"
-         label="Sort"
-         layout="topleft"
-         left="0"
-         mouse_opaque="false"
-         name="Sort"
-         tear_off="true"
-         top="-113"
-         width="118">
-            <menu_item_check
-             control_name="Inventory.SortByName"
-             label="By Name"
-             layout="topleft"
-             name="By Name">
-                <menu_item_check.on_click
-                 function="Inventory.SetSortBy"
-                 parameter="name" />
-            </menu_item_check>
-            <menu_item_check
-             control_name="Inventory.SortByDate"
-             label="By Date"
-             layout="topleft"
-             name="By Date">
-                <menu_item_check.on_click
-                 function="Inventory.SetSortBy"
-                 parameter="date" />
-            </menu_item_check>
-            <menu_item_separator
-             layout="topleft" />
-            <menu_item_check
-             control_name="Inventory.FoldersAlwaysByName"
-             label="Folders Always By Name"
-             layout="topleft"
-             name="Folders Always By Name">
-                <menu_item_check.on_click
-                 function="Inventory.SetSortBy"
-                 parameter="foldersalwaysbyname" />
-            </menu_item_check>
-            <menu_item_check
-             control_name="Inventory.SystemFoldersToTop"
-             label="System Folders To Top"
-             layout="topleft"
-             name="System Folders To Top">
-                <menu_item_check.on_click
-                 function="Inventory.SetSortBy"
-                 parameter="systemfolderstotop" />
-            </menu_item_check>
-        </menu>
-    </menu_bar>
     <filter_editor
      text_pad_left="10"
      follows="left|top|right"
@@ -408,7 +47,7 @@
      left="10"
      max_length="300"
      name="inventory search editor"
-     top="+31"
+     top="3"
      width="303" />
     <tab_container
        bg_opaque_color="DkGray2"
@@ -417,7 +56,7 @@
        background_opaque="true"
        follows="all"
        halign="center"
-       height="306"
+       height="334"
        layout="topleft"
        left="7"
        name="inventory filter tabs"
@@ -434,7 +73,7 @@
 	       border="false"
 	       bevel_style="none"
          follows="all"
-         height="295"
+         height="322"
          label="MY INVENTORY"
          help_topic="my_inventory_tab"
          layout="topleft"
@@ -451,7 +90,7 @@
 	       border="false"
 	       bevel_style="none"
          follows="all"
-         height="293"
+         height="320"
          label="RECENT"
          help_topic="recent_inventory_tab"
          layout="topleft"
-- 
cgit v1.2.3


From cec9bce226f6f8645de5796032dd97829c463232 Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Thu, 1 Apr 2010 18:18:00 -0400
Subject: Cleanup and consolidation

---
 indra/newview/llappearancemgr.cpp | 15 ++++++++++-----
 indra/newview/llappearancemgr.h   |  3 +++
 2 files changed, 13 insertions(+), 5 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 3c4341e82c..e0f1d5348d 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -1311,6 +1311,8 @@ private:
 };
 
 
+// BAP - note that this runs asynchronously if the item is not already loaded from inventory.
+// Dangerous if caller assumes link will exist after calling the function.
 void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update )
 {
 	const LLInventoryItem *item = gInventory.getItem(item_id);
@@ -1491,7 +1493,7 @@ void LLAppearanceMgr::updateIsDirty()
 	}
 }
 
-void LLAppearanceMgr::onFirstFullyVisible()
+void LLAppearanceMgr::autopopulateOutfits()
 {
 	// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
 	// then auto-populate outfits from the library into the My Outfits folder.
@@ -1508,6 +1510,12 @@ void LLAppearanceMgr::onFirstFullyVisible()
 	check_populate_my_outfits = false;
 }
 
+// Handler for anything that's deferred until avatar de-clouds.
+void LLAppearanceMgr::onFirstFullyVisible()
+{
+	autopopulateOutfits();
+}
+
 //#define DUMP_CAT_VERBOSE
 
 void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
@@ -1559,6 +1567,7 @@ void LLAppearanceMgr::setAttachmentInvLinkEnable(bool val)
 	mAttachmentInvLinkEnabled = val;
 }
 
+// BAP TODO - mRegisteredAttachments is currently maintained but not used for anything.  Consider yanking.
 void dumpAttachmentSet(const std::set<LLUUID>& atts, const std::string& msg)
 {
        llinfos << msg << llendl;
@@ -1580,7 +1589,6 @@ void LLAppearanceMgr::registerAttachment(const LLUUID& item_id)
 {
        mRegisteredAttachments.insert(item_id);
 	   gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
-       //dumpAttachmentSet(mRegisteredAttachments,"after register:");
 
 	   if (mAttachmentInvLinkEnabled)
 	   {
@@ -1597,11 +1605,8 @@ void LLAppearanceMgr::unregisterAttachment(const LLUUID& item_id)
        mRegisteredAttachments.erase(item_id);
 	   gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id);
 
-       //dumpAttachmentSet(mRegisteredAttachments,"after unregister:");
-
 	   if (mAttachmentInvLinkEnabled)
 	   {
-		   //LLAppearanceMgr::dumpCat(LLAppearanceMgr::getCOF(),"Removing attachment link:");
 		   LLAppearanceMgr::removeCOFItemLinks(item_id, false);
 	   }
 	   else
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 5e1ce55fbd..5a499026e8 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -119,6 +119,9 @@ public:
 
 	// Called when self avatar is first fully visible.
 	void onFirstFullyVisible();
+
+	// Create initial outfits from library.
+	void autopopulateOutfits();
 	
 protected:
 	LLAppearanceMgr();
-- 
cgit v1.2.3


From ca8da832bdb1532c47208ea5e1b6ef50a40c3677 Mon Sep 17 00:00:00 2001
From: Leyla Farazha <leyla@lindenlab.com>
Date: Thu, 1 Apr 2010 15:35:55 -0700
Subject: fixed line endings

---
 .../skins/default/xui/en/panel_main_inventory.xml  | 318 ++++++++++-----------
 1 file changed, 159 insertions(+), 159 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index b1c2173686..1b04d01abf 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -1,159 +1,159 @@
-<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<panel
- background_visible="true"
- follows="all"
- height="408"
- label="Things"
- layout="topleft"
- min_height="350"
- min_width="240"
- name="main inventory panel"
- width="330">
-  <panel.string
-   name="Itemcount">
-  </panel.string>
-  <panel.string
-   name="ItemcountFetching">
-    Fetching [ITEM_COUNT] Items... [FILTER]
-  </panel.string>
-  <panel.string
-   name="ItemcountCompleted">
-    [ITEM_COUNT] Items [FILTER]
-  </panel.string>
-  <panel.string
-   name="ItemcountUnknown">
-
-  </panel.string>
-  <text
-		     type="string"
-		     length="1"
-		     follows="left|top"
-		     height="13"
-		     layout="topleft"
-    		 left="12"
-		     name="ItemcountText"
-		     font="SansSerifMedium"
-		     text_color="EmphasisColor"
-		     top_pad="0"
-		     width="300">
-    Items:
-  </text>
-  <filter_editor
-   text_pad_left="10"
-   follows="left|top|right"
- height="23"
-   label="Filter Inventory"
-   layout="topleft"
-   left="10"
-   max_length="300"
-   name="inventory search editor"
-   top="3"
-   width="303" />
-  <tab_container
-     bg_alpha_color="DkGray"
-     bg_opaque_color="DkGray"
-     background_visible="true"
-     background_opaque="true"
-     follows="all"
-     halign="center"
-     height="339"
-     layout="topleft"
-     left="7"
-     name="inventory filter tabs"
-     tab_height="30"
-     tab_position="top"
-     tab_min_width="100"
-     top_pad="10"
-     width="312">
-    <inventory_panel
-        bg_opaque_color="DkGray2"
-   bg_alpha_color="DkGray2"
-   background_visible="true"
-   background_opaque="true"
-     border="false"
-     bevel_style="none"
-     follows="all"
-     height="338"
-     label="MY INVENTORY"
-     help_topic="my_inventory_tab"
-     layout="topleft"
-     left="0"
-     name="All Items"
-     sort_order_setting="InventorySortOrder"
-     top="16"
-     width="288" />
-    <inventory_panel
-        bg_opaque_color="DkGray2"
-   bg_alpha_color="DkGray2"
-   background_visible="true"
-   background_opaque="true"
-     border="false"
-     bevel_style="none"
-     follows="all"
-     height="338"
-     label="RECENT"
-     help_topic="recent_inventory_tab"
-     layout="topleft"
-     left_delta="0"
-     name="Recent Items"
-     width="290" />
-  </tab_container>
-
-  <panel
-     background_visible="true"
-   bevel_style="none"
-   follows="left|right|bottom"
-   height="27"
-   layout="topleft"
-   top_pad="-1"
-   left="10"
-   name="bottom_panel"
-   width="310">
-    <button
-     follows="bottom|left"
-     tool_tip="Show additional options"
-     height="25"
-     image_hover_unselected="Toolbar_Left_Over"
-     image_overlay="OptionsMenu_Off"
-     image_selected="Toolbar_Left_Selected"
-     image_unselected="Toolbar_Left_Off"
-     layout="topleft"
-     left="0"
-     name="options_gear_btn"
-     top="1"
-     width="31" />
-    <button
-     follows="bottom|left"
-     height="25"
-     image_hover_unselected="Toolbar_Middle_Over"
-     image_overlay="AddItem_Off"
-     image_selected="Toolbar_Middle_Selected"
-     image_unselected="Toolbar_Middle_Off"
-     layout="topleft"
-     left_pad="1"
-     name="add_btn"
-     tool_tip="Add new item"
-     width="31" />
-    <icon
-     follows="bottom|left"
-     height="25"
-     image_name="Toolbar_Middle_Off"
-     layout="topleft"
-     left_pad="1"
-     name="dummy_icon"
-     width="209"
-       />
-    <dnd_button
-     follows="bottom|left"
-     height="25"
-     image_hover_unselected="Toolbar_Right_Over"
-     image_overlay="TrashItem_Off"
-     image_selected="Toolbar_Right_Selected"
-     image_unselected="Toolbar_Right_Off"
-     left_pad="1"
-     layout="topleft"
-     name="trash_btn"
-     tool_tip="Remove selected item"
-     width="31"/>
-  </panel>
-</panel>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ background_visible="true"
+ follows="all"
+ height="408"
+ label="Things"
+ layout="topleft"
+ min_height="350"
+ min_width="240"
+ name="main inventory panel"
+ width="330">
+  <panel.string
+   name="Itemcount">
+  </panel.string>
+  <panel.string
+   name="ItemcountFetching">
+    Fetching [ITEM_COUNT] Items... [FILTER]
+  </panel.string>
+  <panel.string
+   name="ItemcountCompleted">
+    [ITEM_COUNT] Items [FILTER]
+  </panel.string>
+  <panel.string
+   name="ItemcountUnknown">
+
+  </panel.string>
+  <text
+		     type="string"
+		     length="1"
+		     follows="left|top"
+		     height="13"
+		     layout="topleft"
+    		 left="12"
+		     name="ItemcountText"
+		     font="SansSerifMedium"
+		     text_color="EmphasisColor"
+		     top_pad="0"
+		     width="300">
+    Items:
+  </text>
+  <filter_editor
+   text_pad_left="10"
+   follows="left|top|right"
+ height="23"
+   label="Filter Inventory"
+   layout="topleft"
+   left="10"
+   max_length="300"
+   name="inventory search editor"
+   top="3"
+   width="303" />
+  <tab_container
+     bg_alpha_color="DkGray"
+     bg_opaque_color="DkGray"
+     background_visible="true"
+     background_opaque="true"
+     follows="all"
+     halign="center"
+     height="339"
+     layout="topleft"
+     left="7"
+     name="inventory filter tabs"
+     tab_height="30"
+     tab_position="top"
+     tab_min_width="100"
+     top_pad="10"
+     width="312">
+    <inventory_panel
+        bg_opaque_color="DkGray2"
+   bg_alpha_color="DkGray2"
+   background_visible="true"
+   background_opaque="true"
+     border="false"
+     bevel_style="none"
+     follows="all"
+     height="338"
+     label="MY INVENTORY"
+     help_topic="my_inventory_tab"
+     layout="topleft"
+     left="0"
+     name="All Items"
+     sort_order_setting="InventorySortOrder"
+     top="16"
+     width="288" />
+    <inventory_panel
+        bg_opaque_color="DkGray2"
+   bg_alpha_color="DkGray2"
+   background_visible="true"
+   background_opaque="true"
+     border="false"
+     bevel_style="none"
+     follows="all"
+     height="338"
+     label="RECENT"
+     help_topic="recent_inventory_tab"
+     layout="topleft"
+     left_delta="0"
+     name="Recent Items"
+     width="290" />
+  </tab_container>
+
+  <panel
+     background_visible="true"
+   bevel_style="none"
+   follows="left|right|bottom"
+   height="27"
+   layout="topleft"
+   top_pad="-1"
+   left="10"
+   name="bottom_panel"
+   width="310">
+    <button
+     follows="bottom|left"
+     tool_tip="Show additional options"
+     height="25"
+     image_hover_unselected="Toolbar_Left_Over"
+     image_overlay="OptionsMenu_Off"
+     image_selected="Toolbar_Left_Selected"
+     image_unselected="Toolbar_Left_Off"
+     layout="topleft"
+     left="0"
+     name="options_gear_btn"
+     top="1"
+     width="31" />
+    <button
+     follows="bottom|left"
+     height="25"
+     image_hover_unselected="Toolbar_Middle_Over"
+     image_overlay="AddItem_Off"
+     image_selected="Toolbar_Middle_Selected"
+     image_unselected="Toolbar_Middle_Off"
+     layout="topleft"
+     left_pad="1"
+     name="add_btn"
+     tool_tip="Add new item"
+     width="31" />
+    <icon
+     follows="bottom|left"
+     height="25"
+     image_name="Toolbar_Middle_Off"
+     layout="topleft"
+     left_pad="1"
+     name="dummy_icon"
+     width="209"
+       />
+    <dnd_button
+     follows="bottom|left"
+     height="25"
+     image_hover_unselected="Toolbar_Right_Over"
+     image_overlay="TrashItem_Off"
+     image_selected="Toolbar_Right_Selected"
+     image_unselected="Toolbar_Right_Off"
+     left_pad="1"
+     layout="topleft"
+     name="trash_btn"
+     tool_tip="Remove selected item"
+     width="31"/>
+  </panel>
+</panel>
-- 
cgit v1.2.3


From dcc5e0a4faaf7d877a736ade4a334d1936e71bef Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 15:48:56 -0700
Subject: EXT-3531 - Ctrl-p doesn't work reliably on login moved
 gEditMenuHandler handling to LLEditMenuHandler destructor

---
 indra/llui/lleditmenuhandler.cpp | 7 +++++++
 indra/llui/lleditmenuhandler.h   | 2 +-
 indra/llui/lllineeditor.cpp      | 6 +-----
 indra/llui/llscrolllistctrl.cpp  | 5 -----
 indra/llui/lltexteditor.cpp      | 8 +-------
 indra/newview/llfolderview.cpp   | 5 -----
 indra/newview/llviewermedia.cpp  | 5 -----
 7 files changed, 10 insertions(+), 28 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp
index 821afae8fd..9d8af39a7a 100644
--- a/indra/llui/lleditmenuhandler.cpp
+++ b/indra/llui/lleditmenuhandler.cpp
@@ -37,3 +37,10 @@
 /* static */
 LLEditMenuHandler* LLEditMenuHandler::gEditMenuHandler = NULL;
 
+LLEditMenuHandler::~LLEditMenuHandler()
+{
+	if (gEditMenuHandler == this)
+	{
+		gEditMenuHandler = NULL;
+	}
+}
\ No newline at end of file
diff --git a/indra/llui/lleditmenuhandler.h b/indra/llui/lleditmenuhandler.h
index 1de9c56afb..d72283cd99 100644
--- a/indra/llui/lleditmenuhandler.h
+++ b/indra/llui/lleditmenuhandler.h
@@ -38,7 +38,7 @@ class LLEditMenuHandler
 {
 public:
 	// this is needed even though this is just an interface class.
-	virtual ~LLEditMenuHandler() {};
+	virtual ~LLEditMenuHandler();
 	
 	virtual void	undo() {};
 	virtual BOOL	canUndo() const { return FALSE; }
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 483a394bbd..2a17ddb9e7 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -192,12 +192,8 @@ LLLineEditor::~LLLineEditor()
 {
 	mCommitOnFocusLost = FALSE;
 
+	// calls onCommit() while LLLineEditor still valid
 	gFocusMgr.releaseFocusIfNeeded( this );
-
-	if( gEditMenuHandler == this )
-	{
-		gEditMenuHandler = NULL;
-	}
 }
 
 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index bf0866a655..db0f2bd6e2 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -324,11 +324,6 @@ LLScrollListCtrl::~LLScrollListCtrl()
 	delete mSortCallback;
 
 	std::for_each(mItemList.begin(), mItemList.end(), DeletePointer());
-
-	if( gEditMenuHandler == this )
-	{
-		gEditMenuHandler = NULL;
-	}
 }
 
 
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index 94c7ebec2a..c9751c8139 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -304,13 +304,7 @@ void LLTextEditor::initFromParams( const LLTextEditor::Params& p)
 LLTextEditor::~LLTextEditor()
 {
 	gFocusMgr.releaseFocusIfNeeded( this ); // calls onCommit() while LLTextEditor still valid
-
-	// Route menu back to the default
-	if( gEditMenuHandler == this )
-	{
-		gEditMenuHandler = NULL;
-	}
-
+	
 	// Scrollbar is deleted by LLView
 	std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
 
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 43743ec37a..83eb9579b2 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -276,11 +276,6 @@ LLFolderView::~LLFolderView( void )
 	mRenamer = NULL;
 	mStatusTextBox = NULL;
 
-	if( gEditMenuHandler == this )
-	{
-		gEditMenuHandler = NULL;
-	}
-
 	mAutoOpenItems.removeAllNodes();
 	gIdleCallbacks.deleteFunction(idle, this);
 
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index d3eed40f25..e0cbddafae 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1473,11 +1473,6 @@ LLViewerMediaImpl::LLViewerMediaImpl(	  const LLUUID& texture_id,
 //////////////////////////////////////////////////////////////////////////////////////////
 LLViewerMediaImpl::~LLViewerMediaImpl()
 {
-	if( gEditMenuHandler == this )
-	{
-		gEditMenuHandler = NULL;
-	}
-	
 	destroyMediaSource();
 	
 	LLViewerMediaTexture::removeMediaImplFromTexture(mTextureId) ;
-- 
cgit v1.2.3


From be16153af8c1caa468380498a13cf5d7e7cc2c18 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 16:19:03 -0700
Subject: added newline at eof

---
 indra/llui/lleditmenuhandler.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/lleditmenuhandler.cpp b/indra/llui/lleditmenuhandler.cpp
index 9d8af39a7a..245bce76f5 100644
--- a/indra/llui/lleditmenuhandler.cpp
+++ b/indra/llui/lleditmenuhandler.cpp
@@ -43,4 +43,4 @@ LLEditMenuHandler::~LLEditMenuHandler()
 	{
 		gEditMenuHandler = NULL;
 	}
-}
\ No newline at end of file
+}
-- 
cgit v1.2.3


From a9b806071ac0b60b9c4c36cc98564846c677dbd4 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 16:41:45 -0700
Subject: fix for bad merge

---
 indra/llui/llflatlistview.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 0fd7e7ed55..35f5a6bbb9 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -790,7 +790,7 @@ BOOL LLFlatListView::canSelectAll() const
 void LLFlatListView::selectAll()
 {
 	if (!mAllowSelection || !mMultipleSelection)
-		return false;
+		return;
 
 	mSelectedItemPairs.clear();
 
-- 
cgit v1.2.3


From 18d9efff12ef8b59c648a801fe2c5c7e0bc8fde4 Mon Sep 17 00:00:00 2001
From: Richard Linden <none@none>
Date: Thu, 1 Apr 2010 16:43:58 -0700
Subject: another fix for bad merge

---
 indra/llui/llflatlistview.h | 2 --
 1 file changed, 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llflatlistview.h b/indra/llui/llflatlistview.h
index e2f01964de..e3c07e811f 100644
--- a/indra/llui/llflatlistview.h
+++ b/indra/llui/llflatlistview.h
@@ -114,8 +114,6 @@ public:
 		Params();
 	};
 	
-	virtual ~LLFlatListView();
-
 	/**
 	 * Connects callback to signal called when Return key is pressed.
 	 */
-- 
cgit v1.2.3


From 947bd994885ec59c138a2e3835b940a22ebaea1e Mon Sep 17 00:00:00 2001
From: Roxie Linden <roxie@lindenlab.com>
Date: Thu, 1 Apr 2010 21:07:49 -0700
Subject: Incorporate Aimees code review comments

---
 indra/newview/llcallfloater.cpp       | 4 +---
 indra/newview/llviewercontrol.cpp     | 5 +----
 indra/newview/llvoicevivox.cpp        | 2 +-
 indra/newview/llxmlrpctransaction.cpp | 6 +++---
 4 files changed, 6 insertions(+), 11 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index f1b1efc2e0..25b4671f91 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -131,9 +131,7 @@ LLCallFloater::~LLCallFloater()
 	mAvatarListRefreshConnection.disconnect();
 	mVoiceChannelStateChangeConnection.disconnect();
 
-	// Don't use LLVoiceClient::getInstance() here 
-	// singleton MAY have already been destroyed.
-	if(LLVoiceClient::getInstance())
+	if(LLVoiceClient::instanceExists())
 	{
 		LLVoiceClient::getInstance()->removeObserver(this);
 	}
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 3bbd0e777f..27a23fbe74 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -411,10 +411,7 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue)
 
 bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
 {
-	if(LLVoiceClient::getInstance())
-	{
-		LLVoiceClient::getInstance()->updateSettings();
-	}
+	LLVoiceClient::getInstance()->updateSettings();
 	return true;
 }
 
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
index d7c2939b93..bf09cdef37 100644
--- a/indra/newview/llvoicevivox.cpp
+++ b/indra/newview/llvoicevivox.cpp
@@ -1,5 +1,5 @@
  /** 
- * @file LLVivoxVoiceClient.cpp
+ * @file llvoicevivox.cpp
  * @brief Implementation of LLVivoxVoiceClient class which is the interface to the voice client process.
  *
  * $LicenseInfo:firstyear=2001&license=viewergpl$
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index da61840761..d75c8ff1fb 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -325,10 +325,10 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 //	mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
 	mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
 	mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
-	BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
+	BOOL verifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
 	mCertStore = gSavedSettings.getString("CertStore");
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, verifySSLCert);
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, verifySSLCert ? 2 : 0);
 	// Be a little impatient about establishing connections.
 	mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);
 	mCurlRequest->setSSLCtxCallback(_sslCtxFunction, (void *)this);
-- 
cgit v1.2.3


From 81582cb3764c7a0d3031f8259a4be9375fb1bd81 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 13:15:50 +0300
Subject: Fixed normal bug EXT-5831(Do not apply font color to timestamps in
 chat history) - added new 'ChatTimestampColor' color setting, which is set to
 timestamps for chat history messages in text mode which are not from log.
 Reviewed by Vadim Savchuk at
 https://codereview.productengine.com/secondlife/r/160/.

--HG--
branch : product-engine
---
 indra/newview/llchathistory.cpp        | 9 ++++++++-
 indra/newview/skins/default/colors.xml | 5 ++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 71e7ae7061..ec5e61f384 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -632,7 +632,14 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 
 	if (use_plain_text_chat_history)
 	{
-		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
+		LLStyle::Params timestamp_style(style_params);
+		if (!message_from_log)
+		{
+			LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor");
+			timestamp_style.color(timestamp_color);
+			timestamp_style.readonly_color(timestamp_color);
+		}
+		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style);
 
 		if (utf8str_trim(chat.mFromName).size() != 0)
 		{
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 777d671e81..eaf95aa54c 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -731,7 +731,10 @@
     <color
      name="ChatToastAgentNameColor"
      reference="EmphasisColor" />
-  <color
+    <color
     name="ColorSwatchBorderColor"
     value="0.45098 0.517647 0.607843 1"/>
+    <color
+     name="ChatTimestampColor"
+     reference="White" />
 </colors>
-- 
cgit v1.2.3


From 32283a93e08a27e179486a5162367885131dffba Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 13:36:58 +0300
Subject: Fixed normal bug EXT-6357 (SLapp for object chat does display an
 inspector) - added new LLUrlEntry to support
 'secondlife:///app/objectim/{UUID}/' SLapps. Fixed passing the SLURL to
 inspect_remote_object floater. Reviewed by Vadim Savchuk,
 https://codereview.productengine.com/secondlife/r/158/

--HG--
branch : product-engine
---
 indra/llui/llurlentry.cpp       | 31 ++++++++++++++++++++++++++++++-
 indra/llui/llurlentry.h         | 12 ++++++++++++
 indra/llui/llurlregistry.cpp    |  1 +
 indra/newview/llchathistory.cpp |  2 +-
 4 files changed, 44 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index e8e3459673..2f93ab0f04 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -493,6 +493,35 @@ std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLab
 	return LLURI::unescape(label.empty() ? url : label);
 }
 
+//
+// LLUrlEntryObjectIM Describes a Second Life inspector for the object Url, e.g.,
+// secondlife:///app/objectim/7bcd7864-da6b-e43f-4486-91d28a28d95b?name=Object&owner=3de548e1-57be-cfea-2b78-83ae3ad95998&slurl=Danger!%20Danger!/200/200/30/&groupowned=1
+//
+LLUrlEntryObjectIM::LLUrlEntryObjectIM()
+{
+	mPattern = boost::regex("secondlife:///app/objectim/[\\da-f-]+\?.*",
+							boost::regex::perl|boost::regex::icase);
+	mMenuName = "menu_url_objectim.xml";
+}
+
+std::string LLUrlEntryObjectIM::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
+{
+	LLURI uri(url);
+	LLSD query_map = uri.queryMap();
+	if (query_map.has("name"))
+		return query_map["name"];
+	return unescapeUrl(url);
+}
+
+std::string LLUrlEntryObjectIM::getLocation(const std::string &url) const
+{
+	LLURI uri(url);
+	LLSD query_map = uri.queryMap();
+	if (query_map.has("slurl"))
+		return query_map["slurl"];
+	return LLUrlEntryBase::getLocation(url);
+}
+
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
 /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
@@ -515,7 +544,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
 //
 LLUrlEntryPlace::LLUrlEntryPlace()
 {
-	mPattern = boost::regex("secondlife://\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
+	mPattern = boost::regex("secondlife://(?!/)\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slurl.xml";
 	mTooltip = LLTrans::getString("TooltipSLURL");
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 84d0968779..29575d752c 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -201,6 +201,18 @@ public:
 private:
 };
 
+///
+/// LLUrlEntryObjectIM Describes a Second Life inspector for the object Url, e.g.,
+/// secondlife:///app/objectim/7bcd7864-da6b-e43f-4486-91d28a28d95b?name=Object&owner=3de548e1-57be-cfea-2b78-83ae3ad95998&slurl=Danger!%20Danger!/200/200/30/&groupowned=1
+///
+class LLUrlEntryObjectIM : public LLUrlEntryBase
+{
+public:
+	LLUrlEntryObjectIM();
+	/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
+	/*virtual*/ std::string getLocation(const std::string &url) const;
+private:
+};
 
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index faa02e1904..7e09a5a919 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -55,6 +55,7 @@ LLUrlRegistry::LLUrlRegistry()
 	registerUrl(new LLUrlEntryWorldMap());
 	registerUrl(new LLUrlEntryPlace());
 	registerUrl(new LLUrlEntryInventory());
+	registerUrl(new LLUrlEntryObjectIM());
 	//LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern, 
 	//so it should be registered in the end of list
 	registerUrl(new LLUrlEntrySL());
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index ec5e61f384..68c31d87fa 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -93,7 +93,7 @@ public:
 		payload["object_id"] = object_id;
 		payload["owner_id"] = query_map["owner"];
 		payload["name"] = query_map["name"];
-		payload["slurl"] = query_map["slurl"];
+		payload["slurl"] = LLWeb::escapeURL(query_map["slurl"]);
 		payload["group_owned"] = query_map["groupowned"];
 		LLFloaterReg::showInstance("inspect_remote_object", payload);
 		return true;
-- 
cgit v1.2.3


From 43d756a7dcd60215204f8f02c9bd6ba26b5b4ca0 Mon Sep 17 00:00:00 2001
From: Igor Borovkov <iborovkov@productengine.com>
Date: Fri, 2 Apr 2010 13:58:16 +0300
Subject: done EXT-6674 Switch Edit Outfit panel (list at the top) to show
 content of the Current Outfit system folder

reviewed at https://codereview.productengine.com/secondlife/r/159/

--HG--
branch : product-engine
---
 indra/newview/llpaneloutfitedit.cpp                | 50 +++++++++-------------
 indra/newview/llpaneloutfitedit.h                  | 13 +++---
 indra/newview/llpaneloutfitsinventory.cpp          | 21 +++------
 indra/newview/llpaneloutfitsinventory.h            |  2 +-
 indra/newview/llsidepanelappearance.cpp            |  6 +--
 .../skins/default/xui/en/panel_outfit_edit.xml     |  5 ++-
 .../default/xui/en/panel_outfits_inventory.xml     |  2 +-
 7 files changed, 41 insertions(+), 58 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 2b25c544e3..1ab2100a41 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -113,9 +113,9 @@ private:
 
 
 LLPanelOutfitEdit::LLPanelOutfitEdit()
-:	LLPanel(), mLookID(), mFetchLook(NULL), mSearchFilter(NULL),
+:	LLPanel(), mCurrentOutfitID(), mFetchLook(NULL), mSearchFilter(NULL),
 mLookContents(NULL), mInventoryItemsPanel(NULL), mAddToLookBtn(NULL),
-mRemoveFromLookBtn(NULL), mLookObserver(NULL), mNumItemsInLook(0)
+mRemoveFromLookBtn(NULL), mLookObserver(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
@@ -157,7 +157,7 @@ BOOL LLPanelOutfitEdit::postBuild()
 {
 	// gInventory.isInventoryUsable() no longer needs to be tested per Richard's fix for race conditions between inventory and panels
 		
-	mLookName = getChild<LLTextBox>("curr_look_name"); 
+	mCurrentOutfitName = getChild<LLTextBox>("curr_outfit_name"); 
 
 	childSetCommitCallback("add_btn", boost::bind(&LLPanelOutfitEdit::showAddWearablesPanel, this), NULL);
 
@@ -206,7 +206,7 @@ BOOL LLPanelOutfitEdit::postBuild()
 	mLookContents = getChild<LLScrollListCtrl>("look_items_list");
 	mLookContents->sortByColumn("look_item_sort", TRUE);
 	mLookContents->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onLookItemSelectionChange, this));
-	
+
 	/*
 	LLButton::Params remove_params;
 	remove_params.name("remove_from_look");
@@ -220,12 +220,12 @@ BOOL LLPanelOutfitEdit::postBuild()
 	//childSetAction("remove_from_look_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
 	mRemoveFromLookBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this));
 	//getChild<LLPanel>("look_info_group_bar")->addChild(mRemoveFromLookBtn); remove_item_btn
-
+	
 	mEditWearableBtn = getChild<LLButton>("edit_wearable_btn");
 	mEditWearableBtn->setEnabled(FALSE);
 	mEditWearableBtn->setVisible(FALSE);
 	mEditWearableBtn->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onEditWearableClicked, this));
-	
+
 	childSetAction("remove_item_btn", boost::bind(&LLPanelOutfitEdit::onRemoveFromLookClicked, this), this);
 	
 	return TRUE;
@@ -302,7 +302,7 @@ void LLPanelOutfitEdit::onAddToLookClicked(void)
 {
 	LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
 	LLFolderViewEventListener* listenerp  = curr_item->getListener();
-	link_inventory_item(gAgent.getID(), listenerp->getUUID(), mLookID, listenerp->getName(),
+	link_inventory_item(gAgent.getID(), listenerp->getUUID(), mCurrentOutfitID, listenerp->getName(),
 						LLAssetType::AT_LINK, LLPointer<LLInventoryCallback>(NULL));
 	updateLookInfo();
 }
@@ -445,7 +445,7 @@ void LLPanelOutfitEdit::lookFetched(void)
 
 	// collectDescendentsIf takes non-const reference:
 	LLFindCOFValidItems is_cof_valid;
-	gInventory.collectDescendentsIf(mLookID,
+	gInventory.collectDescendentsIf(mCurrentOutfitID,
 									cat_array,
 									item_array,
 									LLInventoryModel::EXCLUDE_TRASH,
@@ -468,12 +468,6 @@ void LLPanelOutfitEdit::lookFetched(void)
 		
 		mLookContents->addElement(row);
 	}
-	
-	if (mLookContents->getItemCount() != mNumItemsInLook)
-	{
-		mNumItemsInLook = mLookContents->getItemCount();
-		LLAppearanceMgr::instance().updateCOF(mLookID);
-	}
 }
 
 void LLPanelOutfitEdit::updateLookInfo()
@@ -483,7 +477,7 @@ void LLPanelOutfitEdit::updateLookInfo()
 		mLookContents->clearRows();
 		
 		uuid_vec_t folders;
-		folders.push_back(mLookID);
+		folders.push_back(mCurrentOutfitID);
 		mFetchLook->fetchDescendents(folders);
 		if (mFetchLook->isEverythingComplete())
 		{
@@ -496,28 +490,26 @@ void LLPanelOutfitEdit::updateLookInfo()
 	}
 }
 
-void LLPanelOutfitEdit::displayLookInfo(const LLInventoryCategory* pLook)
+void LLPanelOutfitEdit::displayCurrentOutfit()
 {
-	if (!pLook)
-	{
-		return;
-	}
-	
 	if (!getVisible())
 	{
 		setVisible(TRUE);
 	}
 
-	if (mLookID != pLook->getUUID())
+	mCurrentOutfitID = LLAppearanceMgr::getInstance()->getCOF();
+
+	std::string current_outfit_name;
+	if (LLAppearanceMgr::getInstance()->getBaseOutfitName(current_outfit_name))
 	{
-		mLookID = pLook->getUUID();
-		mLookName->setText(pLook->getName());
-		updateLookInfo();
+		mCurrentOutfitName->setText(current_outfit_name);
+	}
+	else
+	{
+		mCurrentOutfitName->setText(getString("No Outfit"));
 	}
-}
 
-void LLPanelOutfitEdit::reset()
-{
-	mLookID.setNull();
+	updateLookInfo();
 }
 
+
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 5c00f84e0e..ba382d7320 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -81,10 +81,6 @@ public:
 	/*virtual*/ BOOL postBuild();
 	/*virtual*/ void changed(U32 mask);
 
-	void reset();
-		// Ignore all old information, useful if you are 
-		// recycling an existing dialog and need to clear it.
-
 	/*virtual*/ void setParcelID(const LLUUID& parcel_id);
 		// Sends a request for data about the given parcel, which will
 		// only update the location if there is none already available.
@@ -100,7 +96,7 @@ public:
 	void onEditWearableClicked(void);
 	void onUpClicked(void);
 
-	void displayLookInfo(const LLInventoryCategory* pLook);
+	void displayCurrentOutfit();
 	
 	void lookFetched(void);
 	
@@ -108,8 +104,10 @@ public:
 
 private:
 
-	LLUUID				mLookID;
-	LLTextBox*			mLookName;
+	//*TODO got rid of mCurrentOutfitID
+	LLUUID				mCurrentOutfitID;
+
+	LLTextBox*			mCurrentOutfitName;
 	LLScrollListCtrl*	mLookContents;
 	LLInventoryPanel*	mInventoryItemsPanel;
 	LLFilterEditor*		mSearchFilter;
@@ -119,7 +117,6 @@ private:
 	LLButton*			mRemoveFromLookBtn;
 	LLButton*			mUpBtn;
 	LLButton*			mEditWearableBtn;
-	S32					mNumItemsInLook;
 	
 	LLLookFetchObserver*		mFetchLook;
 	LLInventoryLookObserver*	mLookObserver;
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index dd320f8328..a67270202e 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -192,7 +192,7 @@ void LLPanelOutfitsInventory::updateVerbs()
 
 	if (mListCommands)
 	{
-		mListCommands->childSetVisible("look_edit_btn",sShowDebugEditor);
+		mListCommands->childSetVisible("edit_current_outfit_btn",sShowDebugEditor);
 		updateListCommands();
 	}
 }
@@ -306,19 +306,12 @@ void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewIte
 	}
 }
 
-void LLPanelOutfitsInventory::onSelectorButtonClicked()
+void LLPanelOutfitsInventory::showEditOutfitPanel()
 {
-	  LLFolderViewItem* cur_item = getRootFolder()->getCurSelectedItem();
-
-	  LLFolderViewEventListener* listenerp = cur_item->getListener();
-	  if (getIsCorrectType(listenerp))
-	  {
-	  LLSD key;
-	  key["type"] = "look";
-	  key["id"] = listenerp->getUUID();
-
-	  LLSideTray::getInstance()->showPanel("sidepanel_appearance", key);
-	  } 
+	LLSD key;
+	key["type"] = "edit_outfit";
+	
+	LLSideTray::getInstance()->showPanel("sidepanel_appearance", key);
 }
 
 LLFolderViewEventListener *LLPanelOutfitsInventory::getCorrectListenerForAction()
@@ -365,7 +358,7 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
 	mListCommands->childSetAction("make_outfit_btn", boost::bind(&LLPanelOutfitsInventory::onAddButtonClick, this));
 	mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
 
-	mListCommands->childSetAction("look_edit_btn", boost::bind(&LLPanelOutfitsInventory::onSelectorButtonClicked, this));
+	mListCommands->childSetAction("edit_current_outfit_btn", boost::bind(&LLPanelOutfitsInventory::showEditOutfitPanel, this));
 
 	LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>("trash_btn");
 	trash_btn->setDragAndDropHandler(boost::bind(&LLPanelOutfitsInventory::handleDragAndDropToTrash, this
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index ab25ef0a49..83c4b8f9cd 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -64,7 +64,7 @@ public:
 	void onSaveCommit(const std::string& item_name);
 
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
-	void onSelectorButtonClicked();
+	void showEditOutfitPanel();
 
 	// If a compatible listener type is selected, then return a pointer to that.
 	// Otherwise, return NULL.
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index a80687da4d..308034225b 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -182,11 +182,9 @@ void LLSidepanelAppearance::onOpen(const LLSD& key)
 	
 	mLookInfoType = key["type"].asString();
 
-	if (mLookInfoType == "look")
+	if (mLookInfoType == "edit_outfit")
 	{
-		LLInventoryCategory *pLook = gInventory.getCategory(key["id"].asUUID());
-		if (pLook)
-			mOutfitEdit->displayLookInfo(pLook);
+		mOutfitEdit->displayCurrentOutfit();
 	}
 }
 
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index 4d3ee07195..c1800384a3 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -12,6 +12,9 @@
  name="outfit_edit"
  top="0"
  width="320">
+    <string
+     name="No Outfit"
+     value="No Outfit"/>
 	
 	<panel.string
 		name="not_available">
@@ -94,7 +97,7 @@
                  font="SansSerifHugeBold"
                  height="26"
                  layout="topleft"
-                 name="curr_look_name"
+                 name="curr_outfit_name"
                  text_color="LtGray"
                  top_pad="0"
                  value="[Current Outfit]"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
index f9ad525642..66ed43efec 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_inventory.xml
@@ -122,7 +122,7 @@
 		label="Edit Outfit" 
 		layout="topleft"
         right="-140"
-		name="look_edit_btn"
+		name="edit_current_outfit_btn"
         top="26"
         visible="false" 
 		width="50" />
-- 
cgit v1.2.3


From f6b48339d9423399ccd1c93709de978ccc7f5a8c Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Fri, 2 Apr 2010 15:49:13 +0300
Subject: Fixed major bug EXT-6595 (World->Place Profile flyout menu doesn't
 include link to side panel place info).

Added a new main menu item: World -> Place Profile -> Place Profile.
I'm not sure about its label though (double "Place Profile").

Reviewed by Sam: https://codereview.productengine.com/secondlife/r/161/

--HG--
branch : product-engine
---
 indra/newview/llviewermenu.cpp                     | 11 +++++++++++
 indra/newview/skins/default/xui/en/menu_viewer.xml |  7 +++++++
 2 files changed, 18 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 3a6aed01ce..7bdec010ee 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5330,6 +5330,16 @@ class LLWorldCreateLandmark : public view_listener_t
 	}
 };
 
+class LLWorldPlaceProfile : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent"));
+
+		return true;
+	}
+};
+
 void handle_look_at_selection(const LLSD& param)
 {
 	const F32 PADDING_FACTOR = 1.75f;
@@ -7739,6 +7749,7 @@ void initialize_menus()
 	commit.add("World.Chat", boost::bind(&handle_chat, (void*)NULL));
 	view_listener_t::addMenu(new LLWorldAlwaysRun(), "World.AlwaysRun");
 	view_listener_t::addMenu(new LLWorldCreateLandmark(), "World.CreateLandmark");
+	view_listener_t::addMenu(new LLWorldPlaceProfile(), "World.PlaceProfile");
 	view_listener_t::addMenu(new LLWorldSetHomeLocation(), "World.SetHomeLocation");
 	view_listener_t::addMenu(new LLWorldTeleportHome(), "World.TeleportHome");
 	view_listener_t::addMenu(new LLWorldSetAway(), "World.SetAway");
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index ac31636ed2..551e49daf5 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -251,6 +251,13 @@
            layout="topleft"
            name="Land"
            tear_off="true">
+        <menu_item_call
+         label="Place Profile"
+         layout="topleft"
+         name="Place Profile">
+            <menu_item_call.on_click
+             function="World.PlaceProfile" />
+        </menu_item_call>
         <menu_item_call
          label="About Land"
          layout="topleft"
-- 
cgit v1.2.3


From a3ba5836f0b24a0b2c3aeff3b97bb88a133ea69c Mon Sep 17 00:00:00 2001
From: "Brad Payne (Vir Linden)" <vir@lindenlab.com>
Date: Fri, 2 Apr 2010 09:54:29 -0400
Subject: Cleanup

---
 indra/newview/llagentwearables.h        |  2 +-
 indra/newview/llagentwearablesfetch.cpp | 12 ++++++------
 indra/newview/llagentwearablesfetch.h   | 10 +++++-----
 3 files changed, 12 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 652ffd4587..1ada9e1006 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -174,7 +174,7 @@ public:
 	
 	// Should only be called if we *know* we've never done so before, since users may
 	// not want the Library outfits to stay in their quick outfit selector and can delete them.
-	void			populateMyOutfitsFolder(void);
+	void			populateMyOutfitsFolder();
 
 private:
 	void			makeNewOutfitDone(S32 type, U32 index); 
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 021b53e135..7a9ecd1c7f 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -254,7 +254,7 @@ void LLLibraryOutfitsFetch::doneIdle()
 	}
 }
 
-void LLLibraryOutfitsFetch::folderDone(void)
+void LLLibraryOutfitsFetch::folderDone()
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
@@ -295,7 +295,7 @@ void LLLibraryOutfitsFetch::folderDone(void)
 	}
 }
 
-void LLLibraryOutfitsFetch::outfitsDone(void)
+void LLLibraryOutfitsFetch::outfitsDone()
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
@@ -372,7 +372,7 @@ private:
 };
 
 // Copy the clothing folders from the library into the imported clothing folder
-void LLLibraryOutfitsFetch::libraryDone(void)
+void LLLibraryOutfitsFetch::libraryDone()
 {
 	if (mImportedClothingID != LLUUID::null)
 	{
@@ -427,7 +427,7 @@ void LLLibraryOutfitsFetch::libraryDone(void)
 	}
 }
 
-void LLLibraryOutfitsFetch::importedFolderFetch(void)
+void LLLibraryOutfitsFetch::importedFolderFetch()
 {
 	// Fetch the contents of the Imported Clothing Folder
 	uuid_vec_t folders;
@@ -442,7 +442,7 @@ void LLLibraryOutfitsFetch::importedFolderFetch(void)
 	}
 }
 
-void LLLibraryOutfitsFetch::importedFolderDone(void)
+void LLLibraryOutfitsFetch::importedFolderDone()
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
@@ -471,7 +471,7 @@ void LLLibraryOutfitsFetch::importedFolderDone(void)
 	}
 }
 
-void LLLibraryOutfitsFetch::contentsDone(void)
+void LLLibraryOutfitsFetch::contentsDone()
 {		
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
diff --git a/indra/newview/llagentwearablesfetch.h b/indra/newview/llagentwearablesfetch.h
index 72063114b8..1d0c6739ba 100644
--- a/indra/newview/llagentwearablesfetch.h
+++ b/indra/newview/llagentwearablesfetch.h
@@ -100,11 +100,11 @@ public:
 	LLUUID mMyOutfitsID;
 	void importedFolderFetch();
 protected:
-	void folderDone(void);
-	void outfitsDone(void);
-	void libraryDone(void);
-	void importedFolderDone(void);
-	void contentsDone(void);
+	void folderDone();
+	void outfitsDone();
+	void libraryDone();
+	void importedFolderDone();
+	void contentsDone();
 	enum ELibraryOutfitFetchStep mCurrFetchStep;
 	uuid_vec_t mLibraryClothingFolders;
 	uuid_vec_t mImportedClothingFolders;
-- 
cgit v1.2.3


From ae910114f0a1345bf5f3559bc50f81ff5189b01f Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Fri, 2 Apr 2010 17:56:35 +0300
Subject: Completed normal task EXT-6646 ([TRUNCATION] Volume bar truncated.)

The reason: overridden width attributes in localized files.

Fix: remove overrides in 'es', 'fr', 'it', 'pt' locales.
 But override tab width for 'it' locale to accommodate "Mute when minimized" checkbox on Sound & Media panel.

NOTE: there is no enough room for "Mute when minimized" checkbox on Sound & Media panel in 'nl' locale.
 It requires too much space, about 117 extra px and issue should be moved into separate ticket.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/171/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/es/floater_preferences.xml | 4 ++--
 indra/newview/skins/default/xui/fr/floater_preferences.xml | 4 ++--
 indra/newview/skins/default/xui/it/floater_preferences.xml | 4 ++--
 indra/newview/skins/default/xui/pt/floater_preferences.xml | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/floater_preferences.xml b/indra/newview/skins/default/xui/es/floater_preferences.xml
index 37d56ea839..61f12fc0d7 100644
--- a/indra/newview/skins/default/xui/es/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/es/floater_preferences.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater min_width="350" name="Preferences" title="PREFERENCIAS" width="646">
+<floater name="Preferences" title="PREFERENCIAS">
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Cancelar" label_selected="Cancelar" name="Cancel"/>
-	<tab_container name="pref core" tab_width="146" width="646">
+	<tab_container name="pref core">
 		<panel label="General" name="general"/>
 		<panel label="Gráficos" name="display"/>
 		<panel label="Privacidad" name="im"/>
diff --git a/indra/newview/skins/default/xui/fr/floater_preferences.xml b/indra/newview/skins/default/xui/fr/floater_preferences.xml
index 406e91a18a..052e43388b 100644
--- a/indra/newview/skins/default/xui/fr/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/fr/floater_preferences.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater min_width="330" name="Preferences" title="PRÉFÉRENCES" width="626">
+<floater name="Preferences" title="PRÉFÉRENCES">
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Annuler" label_selected="Annuler" name="Cancel"/>
-	<tab_container name="pref core" tab_width="126" width="626">
+	<tab_container name="pref core">
 		<panel label="Général" name="general"/>
 		<panel label="Graphiques" name="display"/>
 		<panel label="Confidentialité" name="im"/>
diff --git a/indra/newview/skins/default/xui/it/floater_preferences.xml b/indra/newview/skins/default/xui/it/floater_preferences.xml
index 5ffe7f4802..c5b6654a69 100644
--- a/indra/newview/skins/default/xui/it/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/it/floater_preferences.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater min_width="350" name="Preferences" title="PREFERENZE" width="646">
+<floater name="Preferences" title="PREFERENZE">
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Annulla" label_selected="Annulla" name="Cancel"/>
-	<tab_container name="pref core" tab_width="146" width="646">
+	<tab_container name="pref core" tab_width="100">
 		<panel label="Generale" name="general"/>
 		<panel label="Grafica" name="display"/>
 		<panel label="Riservatezza" name="im"/>
diff --git a/indra/newview/skins/default/xui/pt/floater_preferences.xml b/indra/newview/skins/default/xui/pt/floater_preferences.xml
index 2736900d5f..2c76a72ca8 100644
--- a/indra/newview/skins/default/xui/pt/floater_preferences.xml
+++ b/indra/newview/skins/default/xui/pt/floater_preferences.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater min_width="332" name="Preferences" title="PREFERÊNCIAS" width="628">
+<floater name="Preferences" title="PREFERÊNCIAS">
 	<button label="OK" label_selected="OK" name="OK"/>
 	<button label="Cancelar" label_selected="Cancelar" name="Cancel"/>
-	<tab_container name="pref core" tab_width="128" width="628">
+	<tab_container name="pref core">
 		<panel label="Geral" name="general"/>
 		<panel label="Vídeo" name="display"/>
 		<panel label="Privacidade" name="im"/>
-- 
cgit v1.2.3


From 520ff658c9b5c2b595ab371224761981d0d0f333 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 18:11:42 +0300
Subject: No ticket. Fixed Linux build.

--HG--
branch : product-engine
---
 indra/newview/tests/llviewernetwork_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index f9f42cfc86..e0c7c83f4b 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -216,10 +216,10 @@ namespace tut
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Agni grid label was not modified by grid file", 
 					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
-#else \\ LL_RELEASE_FOR_DOWNLOAD
+#else // LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Agni grid label was not modified by grid file", 
 					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));
-#endif \\ LL_RELEASE_FOR_DOWNLOAD
+#endif // LL_RELEASE_FOR_DOWNLOAD
 		
 		ensure_equals("Agni name wasn't modified by grid file",
 					  grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
-- 
cgit v1.2.3


From 825e4df30d411de2b41864c5b63ef2ea5d317ebd Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 2 Apr 2010 11:12:59 -0400
Subject: EXT-6689 : INFRASTRUCTURE : LLInventoryBridge code cleanup

Moved a bunch of local llinventorybridge functions into .cpp.
Did a bunch of superficial cleanup of llinventorybridge and related files.
---
 indra/newview/llinventorybridge.cpp       | 657 +++++++++++++++++-------------
 indra/newview/llinventorybridge.h         | 295 +++-----------
 indra/newview/llinventoryfunctions.h      |  10 +-
 indra/newview/llplacesinventorybridge.cpp |   2 +-
 4 files changed, 427 insertions(+), 537 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2a570ecebb..10a3713c1e 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -70,6 +70,18 @@
 #include "llwearablelist.h"
 #include "llpaneloutfitsinventory.h"
 
+typedef std::pair<LLUUID, LLUUID> two_uuids_t;
+typedef std::list<two_uuids_t> two_uuids_list_t;
+
+struct LLMoveInv
+{
+	LLUUID mObjectID;
+	LLUUID mCategoryID;
+	two_uuids_list_t mMoveList;
+	void (*mCallback)(S32, void*);
+	void* mUserData;
+};
+
 using namespace LLOldEvents;
 
 // Helpers
@@ -93,6 +105,7 @@ void remove_inventory_category_from_avatar(LLInventoryCategory* category);
 void remove_inventory_category_from_avatar_step2( BOOL proceed, LLUUID category_id);
 bool move_task_inventory_callback(const LLSD& notification, const LLSD& response, LLMoveInv*);
 bool confirm_replace_attachment_rez(const LLSD& notification, const LLSD& response);
+void teleport_via_landmark(const LLUUID& asset_id);
 
 std::string ICON_NAME[ICON_NAME_COUNT] =
 {
@@ -864,17 +877,6 @@ void LLInvFVBridge::changeCategoryParent(LLInventoryModel* model,
 	model->notifyObservers();
 }
 
-
-const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type)
-{
-	const std::string rv= LLInventoryType::lookup(inv_type);
-	if(rv.empty())
-	{
-		return std::string("<invalid>");
-	}
-	return rv;
-}
-
 LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 										   LLAssetType::EType actual_asset_type,
 										   LLInventoryType::EType inv_type,
@@ -889,7 +891,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_TEXTURE:
 			if(!(inv_type == LLInventoryType::IT_TEXTURE || inv_type == LLInventoryType::IT_SNAPSHOT))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLTextureBridge(inventory, root, uuid, inv_type);
 			break;
@@ -897,7 +899,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_SOUND:
 			if(!(inv_type == LLInventoryType::IT_SOUND))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLSoundBridge(inventory, root, uuid);
 			break;
@@ -905,7 +907,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_LANDMARK:
 			if(!(inv_type == LLInventoryType::IT_LANDMARK))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLLandmarkBridge(inventory, root, uuid, flags);
 			break;
@@ -913,7 +915,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_CALLINGCARD:
 			if(!(inv_type == LLInventoryType::IT_CALLINGCARD))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLCallingCardBridge(inventory, root, uuid);
 			break;
@@ -921,7 +923,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_SCRIPT:
 			if(!(inv_type == LLInventoryType::IT_LSL))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLScriptBridge(inventory, root, uuid);
 			break;
@@ -929,7 +931,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_OBJECT:
 			if(!(inv_type == LLInventoryType::IT_OBJECT || inv_type == LLInventoryType::IT_ATTACHMENT))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLObjectBridge(inventory, root, uuid, inv_type, flags);
 			break;
@@ -937,7 +939,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_NOTECARD:
 			if(!(inv_type == LLInventoryType::IT_NOTECARD))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLNotecardBridge(inventory, root, uuid);
 			break;
@@ -945,7 +947,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_ANIMATION:
 			if(!(inv_type == LLInventoryType::IT_ANIMATION))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLAnimationBridge(inventory, root, uuid);
 			break;
@@ -953,7 +955,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_GESTURE:
 			if(!(inv_type == LLInventoryType::IT_GESTURE))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLGestureBridge(inventory, root, uuid);
 			break;
@@ -961,7 +963,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_LSL_TEXT:
 			if(!(inv_type == LLInventoryType::IT_LSL))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLLSLTextBridge(inventory, root, uuid);
 			break;
@@ -970,7 +972,7 @@ LLInvFVBridge* LLInvFVBridge::createBridge(LLAssetType::EType asset_type,
 		case LLAssetType::AT_BODYPART:
 			if(!(inv_type == LLInventoryType::IT_WEARABLE))
 			{
-				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+				llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 			}
 			new_listener = new LLWearableBridge(inventory, root, uuid, asset_type, inv_type, (EWearableType)flags);
 			break;
@@ -4950,50 +4952,123 @@ void LLWearableBridge::removeFromAvatar()
 	}
 }
 
-LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
-													   const LLUUID& uuid,
-													   LLInventoryModel* model)
+// +=================================================+
+// |        LLLinkItemBridge                         |
+// +=================================================+
+// For broken item links
+std::string LLLinkItemBridge::sPrefix("Link: ");
+LLUIImagePtr LLLinkItemBridge::getIcon() const
 {
-	LLInvFVBridgeAction* action = NULL;
-	switch(asset_type)
+	if (LLViewerInventoryItem *item = getItem())
 	{
-		case LLAssetType::AT_TEXTURE:
-			action = new LLTextureBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_SOUND:
-			action = new LLSoundBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_LANDMARK:
-			action = new LLLandmarkBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_CALLINGCARD:
-			action = new LLCallingCardBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_OBJECT:
-			action = new LLObjectBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_NOTECARD:
-			action = new LLNotecardBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_ANIMATION:
-			action = new LLAnimationBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_GESTURE:
-			action = new LLGestureBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_LSL_TEXT:
-			action = new LLLSLTextBridgeAction(uuid,model);
-			break;
-		case LLAssetType::AT_CLOTHING:
-		case LLAssetType::AT_BODYPART:
-			action = new LLWearableBridgeAction(uuid,model);
-			break;
-		default:
-			break;
+		U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
+		bool is_multi =  LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
+
+		return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
+	}
+	return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
+}
+void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+	// *TODO: Translate
+	lldebugs << "LLLink::buildContextMenu()" << llendl;
+	menuentry_vec_t items;
+	menuentry_vec_t disabled_items;
+
+	items.push_back(std::string("Find Original"));
+	disabled_items.push_back(std::string("Find Original"));
+	
+	if(isItemInTrash())
+	{
+		addTrashContextMenuOptions(items, disabled_items);
+	}
+	else
+	{
+		items.push_back(std::string("Properties"));
+		addDeleteContextMenuOptions(items, disabled_items);
+	}
+	hide_context_entries(menu, items, disabled_items);
+}
+
+// +=================================================+
+// |        LLLinkBridge                             |
+// +=================================================+
+// For broken folder links.
+std::string LLLinkFolderBridge::sPrefix("Link: ");
+LLUIImagePtr LLLinkFolderBridge::getIcon() const
+{
+	LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
+	if (LLViewerInventoryItem *item = getItem())
+	{
+		if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
+		{
+			preferred_type = cat->getPreferredType();
+		}
+	}
+	return LLFolderBridge::getIcon(preferred_type);
+}
+void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
+{
+	// *TODO: Translate
+	lldebugs << "LLLink::buildContextMenu()" << llendl;
+	menuentry_vec_t items;
+	menuentry_vec_t disabled_items;
+
+	if (isItemInTrash())
+	{
+		addTrashContextMenuOptions(items, disabled_items);
+	}
+	else
+	{
+		items.push_back(std::string("Find Original"));
+		addDeleteContextMenuOptions(items, disabled_items);
+	}
+	hide_context_entries(menu, items, disabled_items);
+}
+void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action)
+{
+	if ("goto" == action)
+	{
+		gotoItem();
+		return;
+	}
+	LLItemBridge::performAction(model,action);
+}
+void LLLinkFolderBridge::gotoItem()
+{
+	const LLUUID &cat_uuid = getFolderID();
+	if (!cat_uuid.isNull())
+	{
+		if (LLFolderViewItem *base_folder = mRoot->getItemByID(cat_uuid))
+		{
+			if (LLInventoryModel* model = getInventoryModel())
+			{
+				model->fetchDescendentsOf(cat_uuid);
+			}
+			base_folder->setOpen(TRUE);
+			mRoot->setSelectionFromRoot(base_folder,TRUE);
+			mRoot->scrollToShowSelection();
+		}
 	}
-	return action;
+}
+const LLUUID &LLLinkFolderBridge::getFolderID() const
+{
+	if (LLViewerInventoryItem *link_item = getItem())
+	{
+		if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
+		{
+			const LLUUID& cat_uuid = cat->getUUID();
+			return cat_uuid;
+		}
+	}
+	return LLUUID::null;
 }
 
+/********************************************************************************
+ **
+ **                    BRIDGE ACTIONS
+ **/
+
 // static
 void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
 								   const LLUUID& uuid,LLInventoryModel* model)
@@ -5006,7 +5081,7 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type,
 	}
 }
 
-//static
+// static
 void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
 {
 	llassert(model);
@@ -5026,128 +5101,231 @@ void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model)
 
 LLViewerInventoryItem* LLInvFVBridgeAction::getItem() const
 {
-	if(mModel)
+	if (mModel)
 		return (LLViewerInventoryItem*)mModel->getItem(mUUID);
 	return NULL;
 }
 
-// virtual
-void LLTextureBridgeAction::doIt()
+class LLTextureBridgeAction: public LLInvFVBridgeAction
 {
-	if (getItem())
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+		if (getItem())
+		{
+			LLFloaterReg::showInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLTextureBridgeAction(){}
+protected:
+	LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-// virtual
-void LLSoundBridgeAction::doIt()
+class LLSoundBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if(item)
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			LLFloaterReg::showInstance("preview_sound", LLSD(mUUID), TAKE_FOCUS_YES);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLSoundBridgeAction(){}
+protected:
+	LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-
-// virtual
-void LLLandmarkBridgeAction::doIt()
+class LLLandmarkBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if( item )
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		// Opening (double-clicking) a landmark immediately teleports,
-		// but warns you the first time.
-		LLSD payload;
-		payload["asset_id"] = item->getAssetUUID();		
-		
-		LLSD args; 
-		args["LOCATION"] = item->getName(); 
-		
-		LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			// Opening (double-clicking) a landmark immediately teleports,
+			// but warns you the first time.
+			LLSD payload;
+			payload["asset_id"] = item->getAssetUUID();		
+			
+			LLSD args; 
+			args["LOCATION"] = item->getName(); 
+			
+			LLNotificationsUtil::add("TeleportFromLandmark", args, payload);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLLandmarkBridgeAction(){}
+protected:
+	LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-
-// virtual
-void LLCallingCardBridgeAction::doIt()
+class LLCallingCardBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if(item && item->getCreatorUUID().notNull())
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLAvatarActions::showProfile(item->getCreatorUUID());
+		LLViewerInventoryItem* item = getItem();
+		if (item && item->getCreatorUUID().notNull())
+		{
+			LLAvatarActions::showProfile(item->getCreatorUUID());
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLCallingCardBridgeAction(){}
+protected:
+	LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
 
-	LLInvFVBridgeAction::doIt();
-}
+};
 
-// virtual
-void LLNotecardBridgeAction::doIt()
+class LLNotecardBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if (item)
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			LLFloaterReg::showInstance("preview_notecard", LLSD(item->getUUID()), TAKE_FOCUS_YES);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLNotecardBridgeAction(){}
+protected:
+	LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-// virtual
-void LLGestureBridgeAction::doIt()
+class LLGestureBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if (item)
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
-		preview->setFocus(TRUE);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			LLPreviewGesture* preview = LLPreviewGesture::show(mUUID, LLUUID::null);
+			preview->setFocus(TRUE);
+		}
+		LLInvFVBridgeAction::doIt();		
 	}
+	virtual ~LLGestureBridgeAction(){}
+protected:
+	LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-// virtual
-void	LLAnimationBridgeAction::doIt()
+class LLAnimationBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if (item)
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			LLFloaterReg::showInstance("preview_anim", LLSD(mUUID), TAKE_FOCUS_YES);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLAnimationBridgeAction(){}
+protected:
+	LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
-
-// virtual
-void LLObjectBridgeAction::doIt()
+class LLObjectBridgeAction: public LLInvFVBridgeAction
 {
-	/*
-	  LLFloaterReg::showInstance("properties", mUUID);
-	*/
-	LLInvFVBridgeAction::doIt();
-}
-
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
+	{
+		/*
+		  LLFloaterReg::showInstance("properties", mUUID);
+		*/
+		LLInvFVBridgeAction::doIt();
+	}
+	virtual ~LLObjectBridgeAction(){}
+protected:
+	LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-// virtual
-void LLLSLTextBridgeAction::doIt()
+class LLLSLTextBridgeAction: public LLInvFVBridgeAction
 {
-	LLViewerInventoryItem* item = getItem();
-	if (item)
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
 	{
-		LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+		LLViewerInventoryItem* item = getItem();
+		if (item)
+		{
+			LLFloaterReg::showInstance("preview_script", LLSD(mUUID), TAKE_FOCUS_YES);
+		}
+		LLInvFVBridgeAction::doIt();
 	}
+	virtual ~LLLSLTextBridgeAction(){}
+protected:
+	LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+};
 
-	LLInvFVBridgeAction::doIt();
-}
-
+class LLWearableBridgeAction: public LLInvFVBridgeAction
+{
+	friend class LLInvFVBridgeAction;
+public:
+	virtual void doIt()
+	{
+		if(isItemInTrash())
+		{
+			LLNotificationsUtil::add("CannotWearTrash");
+		}
+		else if(isAgentInventory())
+		{
+			if(!get_is_item_worn(mUUID))
+			{
+				wearOnAvatar();
+			}
+		}
+		else
+		{
+			// must be in the inventory library. copy it to our inventory
+			// and put it on right away.
+			LLViewerInventoryItem* item = getItem();
+			if(item && item->isComplete())
+			{
+				LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
+				copy_inventory_item(
+					gAgent.getID(),
+					item->getPermissions().getOwner(),
+					item->getUUID(),
+					LLUUID::null,
+					std::string(),
+					cb);
+			}
+			else if(item)
+			{
+				// *TODO: We should fetch the item details, and then do
+				// the operation above.
+				LLNotificationsUtil::add("CannotWearInfoNotComplete");
+			}
+		}
+		LLInvFVBridgeAction::doIt();
+	}
+	virtual ~LLWearableBridgeAction(){}
+protected:
+	LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model) : LLInvFVBridgeAction(id,model) {}
+	BOOL isItemInTrash() const;
+	// return true if the item is in agent inventory. if false, it
+	// must be lost or in the inventory library.
+	BOOL isAgentInventory() const;
+	void wearOnAvatar();
+};
 
 BOOL LLWearableBridgeAction::isItemInTrash() const
 {
@@ -5194,155 +5372,50 @@ void LLWearableBridgeAction::wearOnAvatar()
 	}
 }
 
-// virtual
-void LLWearableBridgeAction::doIt()
-{
-	if(isItemInTrash())
-	{
-		LLNotificationsUtil::add("CannotWearTrash");
-	}
-	else if(isAgentInventory())
-	{
-		if(!get_is_item_worn(mUUID))
-		{
-			wearOnAvatar();
-		}
-	}
-	else
-	{
-		// must be in the inventory library. copy it to our inventory
-		// and put it on right away.
-		LLViewerInventoryItem* item = getItem();
-		if(item && item->isComplete())
-		{
-			LLPointer<LLInventoryCallback> cb = new WearOnAvatarCallback();
-			copy_inventory_item(
-				gAgent.getID(),
-				item->getPermissions().getOwner(),
-				item->getUUID(),
-				LLUUID::null,
-				std::string(),
-				cb);
-		}
-		else if(item)
-		{
-			// *TODO: We should fetch the item details, and then do
-			// the operation above.
-			LLNotificationsUtil::add("CannotWearInfoNotComplete");
-		}
-	}
-
-	LLInvFVBridgeAction::doIt();
-}
-
-// +=================================================+
-// |        LLLinkItemBridge                         |
-// +=================================================+
-// For broken item links
-std::string LLLinkItemBridge::sPrefix("Link: ");
-LLUIImagePtr LLLinkItemBridge::getIcon() const
-{
-	if (LLViewerInventoryItem *item = getItem())
-	{
-		U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
-		bool is_multi =  LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
-
-		return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
-	}
-	return get_item_icon(LLAssetType::AT_LINK, LLInventoryType::IT_NONE, 0, FALSE);
-}
-void LLLinkItemBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
-	// *TODO: Translate
-	lldebugs << "LLLink::buildContextMenu()" << llendl;
-	menuentry_vec_t items;
-	menuentry_vec_t disabled_items;
-
-	items.push_back(std::string("Find Original"));
-	disabled_items.push_back(std::string("Find Original"));
-	
-	if(isItemInTrash())
-	{
-		addTrashContextMenuOptions(items, disabled_items);
-	}
-	else
-	{
-		items.push_back(std::string("Properties"));
-		addDeleteContextMenuOptions(items, disabled_items);
-	}
-	hide_context_entries(menu, items, disabled_items);
-}
-
-// +=================================================+
-// |        LLLinkBridge                             |
-// +=================================================+
-// For broken folder links.
-std::string LLLinkFolderBridge::sPrefix("Link: ");
-LLUIImagePtr LLLinkFolderBridge::getIcon() const
+LLInvFVBridgeAction* LLInvFVBridgeAction::createAction(LLAssetType::EType asset_type,
+													   const LLUUID& uuid,
+													   LLInventoryModel* model)
 {
-	LLFolderType::EType preferred_type = LLFolderType::FT_NONE;
-	if (LLViewerInventoryItem *item = getItem())
+	LLInvFVBridgeAction* action = NULL;
+	switch(asset_type)
 	{
-		if (const LLViewerInventoryCategory* cat = item->getLinkedCategory())
-		{
-			preferred_type = cat->getPreferredType();
-		}
+		case LLAssetType::AT_TEXTURE:
+			action = new LLTextureBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_SOUND:
+			action = new LLSoundBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_LANDMARK:
+			action = new LLLandmarkBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_CALLINGCARD:
+			action = new LLCallingCardBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_OBJECT:
+			action = new LLObjectBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_NOTECARD:
+			action = new LLNotecardBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_ANIMATION:
+			action = new LLAnimationBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_GESTURE:
+			action = new LLGestureBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_LSL_TEXT:
+			action = new LLLSLTextBridgeAction(uuid,model);
+			break;
+		case LLAssetType::AT_CLOTHING:
+		case LLAssetType::AT_BODYPART:
+			action = new LLWearableBridgeAction(uuid,model);
+			break;
+		default:
+			break;
 	}
-	return LLFolderBridge::getIcon(preferred_type);
+	return action;
 }
-void LLLinkFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
-{
-	// *TODO: Translate
-	lldebugs << "LLLink::buildContextMenu()" << llendl;
-	menuentry_vec_t items;
-	menuentry_vec_t disabled_items;
 
-	if (isItemInTrash())
-	{
-		addTrashContextMenuOptions(items, disabled_items);
-	}
-	else
-	{
-		items.push_back(std::string("Find Original"));
-		addDeleteContextMenuOptions(items, disabled_items);
-	}
-	hide_context_entries(menu, items, disabled_items);
-}
-void LLLinkFolderBridge::performAction(LLInventoryModel* model, std::string action)
-{
-	if ("goto" == action)
-	{
-		gotoItem();
-		return;
-	}
-	LLItemBridge::performAction(model,action);
-}
-void LLLinkFolderBridge::gotoItem()
-{
-	const LLUUID &cat_uuid = getFolderID();
-	if (!cat_uuid.isNull())
-	{
-		if (LLFolderViewItem *base_folder = mRoot->getItemByID(cat_uuid))
-		{
-			if (LLInventoryModel* model = getInventoryModel())
-			{
-				model->fetchDescendentsOf(cat_uuid);
-			}
-			base_folder->setOpen(TRUE);
-			mRoot->setSelectionFromRoot(base_folder,TRUE);
-			mRoot->scrollToShowSelection();
-		}
-	}
-}
-const LLUUID &LLLinkFolderBridge::getFolderID() const
-{
-	if (LLViewerInventoryItem *link_item = getItem())
-	{
-		if (const LLViewerInventoryCategory *cat = link_item->getLinkedCategory())
-		{
-			const LLUUID& cat_uuid = cat->getUUID();
-			return cat_uuid;
-		}
-	}
-	return LLUUID::null;
-}
+/**                    Bridge Actions
+ **
+ ********************************************************************************/
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 44165594ee..e7b3785a48 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -45,78 +45,12 @@ class LLInventoryPanel;
 class LLInventoryModel;
 class LLMenuGL;
 class LLCallingCardObserver;
-
-enum EInventoryIcon
-{
-	TEXTURE_ICON_NAME,
-	SOUND_ICON_NAME,
-	CALLINGCARD_ONLINE_ICON_NAME,
-	CALLINGCARD_OFFLINE_ICON_NAME,
-	LANDMARK_ICON_NAME,
-	LANDMARK_VISITED_ICON_NAME,
-	SCRIPT_ICON_NAME,
-	CLOTHING_ICON_NAME,
-	OBJECT_ICON_NAME,
-	OBJECT_MULTI_ICON_NAME,
-	NOTECARD_ICON_NAME,
-	BODYPART_ICON_NAME,
-	SNAPSHOT_ICON_NAME,
-
-	BODYPART_SHAPE_ICON_NAME,
-	BODYPART_SKIN_ICON_NAME,
-	BODYPART_HAIR_ICON_NAME,
-	BODYPART_EYES_ICON_NAME,
-	CLOTHING_SHIRT_ICON_NAME,
-	CLOTHING_PANTS_ICON_NAME,
-	CLOTHING_SHOES_ICON_NAME,
-	CLOTHING_SOCKS_ICON_NAME,
-	CLOTHING_JACKET_ICON_NAME,
-	CLOTHING_GLOVES_ICON_NAME,
-	CLOTHING_UNDERSHIRT_ICON_NAME,
-	CLOTHING_UNDERPANTS_ICON_NAME,
-	CLOTHING_SKIRT_ICON_NAME,
-	CLOTHING_ALPHA_ICON_NAME,
-	CLOTHING_TATTOO_ICON_NAME,
-	
-	ANIMATION_ICON_NAME,
-	GESTURE_ICON_NAME,
-
-	LINKITEM_ICON_NAME,
-	LINKFOLDER_ICON_NAME,
-
-	ICON_NAME_COUNT
-};
-
-extern std::string ICON_NAME[ICON_NAME_COUNT];
-
-typedef std::pair<LLUUID, LLUUID> two_uuids_t;
-typedef std::list<two_uuids_t> two_uuids_list_t;
-typedef std::pair<LLUUID, two_uuids_list_t> uuid_move_list_t;
-
-struct LLMoveInv
-{
-	LLUUID mObjectID;
-	LLUUID mCategoryID;
-	two_uuids_list_t mMoveList;
-	void (*mCallback)(S32, void*);
-	void* mUserData;
-};
-
-struct LLAttachmentRezAction
-{
-	LLUUID	mItemID;
-	S32		mAttachPt;
-};
+class LLViewerJointAttachment;
 
 typedef std::vector<std::string> menuentry_vec_t;
 
-const std::string safe_inv_type_lookup(LLInventoryType::EType inv_type);
-void hide_context_entries(LLMenuGL& menu, 
-						  const menuentry_vec_t &entries_to_show,
-						  const menuentry_vec_t &disabled_entries);
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInvFVBridge (& its derived classes)
+// Class LLInvFVBridge
 //
 // Short for Inventory-Folder-View-Bridge. This is an
 // implementation class to be able to view inventory items.
@@ -177,7 +111,7 @@ public:
 	virtual void pasteFromClipboard() {}
 	virtual void pasteLinkFromClipboard() {}
 	void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, 
-		menuentry_vec_t &disabled_items, U32 flags);
+							 menuentry_vec_t &disabled_items, U32 flags);
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
 	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
@@ -227,17 +161,18 @@ protected:
 	const LLUUID mUUID;	// item id
 	LLInventoryType::EType mInvType;
 	void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
-
 };
 
-/**
- * This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
- * It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
- */
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+// Class LLInvFVBridge
+//
+// This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
+// It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
+//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryFVBridgeBuilder
 {
 public:
- 	virtual ~LLInventoryFVBridgeBuilder(){}
+ 	virtual ~LLInventoryFVBridgeBuilder() {}
 	virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
 										LLAssetType::EType actual_asset_type,
 										LLInventoryType::EType inv_type,
@@ -247,6 +182,48 @@ public:
 										U32 flags = 0x00) const;
 };
 
+// Used by LLItemBridge::getIcon
+enum EInventoryIcon
+{
+	TEXTURE_ICON_NAME,
+	SOUND_ICON_NAME,
+	CALLINGCARD_ONLINE_ICON_NAME,
+	CALLINGCARD_OFFLINE_ICON_NAME,
+	LANDMARK_ICON_NAME,
+	LANDMARK_VISITED_ICON_NAME,
+	SCRIPT_ICON_NAME,
+	CLOTHING_ICON_NAME,
+	OBJECT_ICON_NAME,
+	OBJECT_MULTI_ICON_NAME,
+	NOTECARD_ICON_NAME,
+	BODYPART_ICON_NAME,
+	SNAPSHOT_ICON_NAME,
+
+	BODYPART_SHAPE_ICON_NAME,
+	BODYPART_SKIN_ICON_NAME,
+	BODYPART_HAIR_ICON_NAME,
+	BODYPART_EYES_ICON_NAME,
+	CLOTHING_SHIRT_ICON_NAME,
+	CLOTHING_PANTS_ICON_NAME,
+	CLOTHING_SHOES_ICON_NAME,
+	CLOTHING_SOCKS_ICON_NAME,
+	CLOTHING_JACKET_ICON_NAME,
+	CLOTHING_GLOVES_ICON_NAME,
+	CLOTHING_UNDERSHIRT_ICON_NAME,
+	CLOTHING_UNDERPANTS_ICON_NAME,
+	CLOTHING_SKIRT_ICON_NAME,
+	CLOTHING_ALPHA_ICON_NAME,
+	CLOTHING_TATTOO_ICON_NAME,
+	
+	ANIMATION_ICON_NAME,
+	GESTURE_ICON_NAME,
+
+	LINKITEM_ICON_NAME,
+	LINKFOLDER_ICON_NAME,
+
+	ICON_NAME_COUNT
+};
+extern std::string ICON_NAME[ICON_NAME_COUNT];
 
 class LLItemBridge : public LLInvFVBridge
 {
@@ -290,7 +267,6 @@ protected:
 	mutable std::string mDisplayName;
 };
 
-
 class LLFolderBridge : public LLInvFVBridge
 {
 	friend class LLInvFVBridge;
@@ -397,7 +373,6 @@ protected:
 		LLItemBridge(inventory, root, uuid) {}
 };
 
-
 class LLTextureBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
@@ -450,7 +425,6 @@ protected:
 					 LLFolderView* root,
 					 const LLUUID& uuid, 
 					 U32 flags = 0x00);
-
 protected:
 	BOOL mVisited;
 };
@@ -465,19 +439,15 @@ public:
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void openItem();
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-	//virtual void renameItem(const std::string& new_name);
-	//virtual BOOL removeItem();
 	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
 							EDragAndDropType cargo_type,
 							void* cargo_data);
 	void refreshFolderViewItem();
-
 protected:
 	LLCallingCardBridge(LLInventoryPanel* inventory, 
 						LLFolderView* folder,
 						const LLUUID& uuid );
 	~LLCallingCardBridge();
-	
 protected:
 	LLCallingCardObserver* mObserver;
 };
@@ -489,7 +459,6 @@ class LLNotecardBridge : public LLItemBridge
 public:
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
-
 protected:
 	LLNotecardBridge(LLInventoryPanel* inventory, 
 					 LLFolderView* root,
@@ -523,7 +492,6 @@ protected:
 	:	LLItemBridge(inventory, root, uuid) {}
 };
 
-
 class LLAnimationBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
@@ -541,7 +509,6 @@ protected:
 		LLItemBridge(inventory, root, uuid) {}
 };
 
-
 class LLObjectBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
@@ -568,14 +535,12 @@ protected:
 	BOOL mIsMultiObject;
 };
 
-
 class LLLSLTextBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
 	virtual LLUIImagePtr getIcon() const;
 	virtual void openItem();
-
 protected:
 	LLLSLTextBridge(LLInventoryPanel* inventory, 
 					LLFolderView* root, 
@@ -583,7 +548,6 @@ protected:
 		LLItemBridge(inventory, root, uuid) {}
 };
 
-
 class LLWearableBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
@@ -632,45 +596,38 @@ class LLLinkItemBridge : public LLItemBridge
 	friend class LLInvFVBridge;
 public:
 	virtual const std::string& getPrefix() { return sPrefix; }
-
 	virtual LLUIImagePtr getIcon() const;
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
-
 protected:
 	LLLinkItemBridge(LLInventoryPanel* inventory, 
 					 LLFolderView* root,
 					 const LLUUID& uuid) :
 		LLItemBridge(inventory, root, uuid) {}
-
 protected:
 	static std::string sPrefix;
 };
 
-
 class LLLinkFolderBridge : public LLItemBridge
 {
 	friend class LLInvFVBridge;
 public:
 	virtual const std::string& getPrefix() { return sPrefix; }
-
 	virtual LLUIImagePtr getIcon() const;
 	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
 	virtual void performAction(LLInventoryModel* model, std::string action);
 	virtual void gotoItem();
-
 protected:
 	LLLinkFolderBridge(LLInventoryPanel* inventory, 
 					   LLFolderView* root,
 					   const LLUUID& uuid) :
 		LLItemBridge(inventory, root, uuid) {}
 	const LLUUID &getFolderID() const;
-
 protected:
 	static std::string sPrefix;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInvFVBridgeAction (& its derived classes)
+// Class LLInvFVBridgeAction
 //
 // This is an implementation class to be able to 
 // perform action to view inventory items.
@@ -680,7 +637,7 @@ class LLInvFVBridgeAction
 {
 public:
 	// This method is a convenience function which creates the correct
-	// type of bridge action based on some basic information
+	// type of bridge action based on some basic information.
 	static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type,
 											 const LLUUID& uuid,
 											 LLInventoryModel* model);
@@ -689,149 +646,21 @@ public:
 	static void doAction(const LLUUID& uuid, LLInventoryModel* model);
 
 	virtual void doIt() {};
-	virtual ~LLInvFVBridgeAction(){}//need this because of warning on OSX
+	virtual ~LLInvFVBridgeAction() {} // need this because of warning on OSX
 protected:
 	LLInvFVBridgeAction(const LLUUID& id, LLInventoryModel* model) :
 		mUUID(id), mModel(model) {}
 	LLViewerInventoryItem* getItem() const;
 protected:
-	const LLUUID& mUUID;	// item id
+	const LLUUID& mUUID; // item id
 	LLInventoryModel* mModel;
 };
 
 
-
-class LLTextureBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLTextureBridgeAction(){}
-protected:
-	LLTextureBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLSoundBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLSoundBridgeAction(){}
-protected:
-	LLSoundBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLLandmarkBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLLandmarkBridgeAction(){}
-protected:
-	LLLandmarkBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLCallingCardBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLCallingCardBridgeAction(){}
-protected:
-	LLCallingCardBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLNotecardBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLNotecardBridgeAction(){}
-protected:
-	LLNotecardBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLGestureBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLGestureBridgeAction(){}
-protected:
-	LLGestureBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLAnimationBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLAnimationBridgeAction(){}
-protected:
-	LLAnimationBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLObjectBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLObjectBridgeAction(){}
-protected:
-	LLObjectBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLLSLTextBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt() ;
-	virtual ~LLLSLTextBridgeAction(){}
-protected:
-	LLLSLTextBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-};
-
-
-class LLWearableBridgeAction: public LLInvFVBridgeAction
-{
-	friend class LLInvFVBridgeAction;
-public:
-	virtual void	doIt();
-	virtual ~LLWearableBridgeAction(){}
-protected:
-	LLWearableBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
-
-
-	BOOL isItemInTrash() const;
-	// return true if the item is in agent inventory. if false, it
-	// must be lost or in the inventory library.
-	BOOL isAgentInventory() const;
-
-	void wearOnAvatar();
-
-};
-
 void wear_inventory_item_on_avatar(LLInventoryItem* item);
 
-class LLViewerJointAttachment;
-void rez_attachment(LLViewerInventoryItem* item, LLViewerJointAttachment* attachment);
+void rez_attachment(LLViewerInventoryItem* item, 
+					LLViewerJointAttachment* attachment);
 
 // Move items from an in-world object's "Contents" folder to a specified
 // folder in agent inventory.
@@ -841,13 +670,9 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 									  void (*callback)(S32, void*) = NULL,
 									  void* user_data = NULL);
 
-
-
-void teleport_via_landmark(const LLUUID& asset_id);
-
 // Utility function to hide all entries except those in the list
 void hide_context_entries(LLMenuGL& menu, 
-		const menuentry_vec_t &entries_to_show, 
-		const menuentry_vec_t &disabled_entries);
+						  const menuentry_vec_t &entries_to_show, 
+						  const menuentry_vec_t &disabled_entries);
 
 #endif // LL_LLINVENTORYBRIDGE_H
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index eb33763670..e3cd988e39 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -52,7 +52,6 @@
 // and override the () operator to return TRUE if you want to collect
 // the category or item passed in.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLInventoryCollectFunctor
 {
 public:
@@ -62,7 +61,6 @@ public:
 	static bool itemTransferCommonlyAllowed(LLInventoryItem* item);
 };
 
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLAssetIDMatches
 //
@@ -116,14 +114,12 @@ protected:
 	LLAssetType::EType mType;
 };
 
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLIsNotType
 //
 // Implementation of a LLInventoryCollectFunctor which returns FALSE if the
 // type is the type passed in during construction, otherwise false.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLIsNotType : public LLInventoryCollectFunctor
 {
 public:
@@ -156,7 +152,6 @@ protected:
 // Simple class that collects calling cards that are not null, and not
 // the agent. Duplicates are possible.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLBuddyCollector : public LLInventoryCollectFunctor
 {
 public:
@@ -172,7 +167,6 @@ public:
 // Simple class that collects calling cards that are not null, and not
 // the agent. Duplicates are discarded.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLUniqueBuddyCollector : public LLInventoryCollectFunctor
 {
 public:
@@ -202,13 +196,11 @@ protected:
 	LLUUID mBuddyID;
 };
 
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLNameCategoryCollector
 //
 // Collects categories based on case-insensitive match of prefix
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLNameCategoryCollector : public LLInventoryCollectFunctor
 {
 public:
@@ -270,7 +262,7 @@ public:
 	virtual void doItem(LLFolderViewItem* item);
 	BOOL wasItemSelected() { return mItemSelected; }
 protected:
-	BOOL	mItemSelected;
+	BOOL mItemSelected;
 };
 
 class LLOpenFilteredFolders : public LLFolderViewFunctor
diff --git a/indra/newview/llplacesinventorybridge.cpp b/indra/newview/llplacesinventorybridge.cpp
index b4f960f4ac..f59a55cb8b 100644
--- a/indra/newview/llplacesinventorybridge.cpp
+++ b/indra/newview/llplacesinventorybridge.cpp
@@ -168,7 +168,7 @@ LLInvFVBridge* LLPlacesInventoryBridgeBuilder::createBridge(
 	case LLAssetType::AT_LANDMARK:
 		if(!(inv_type == LLInventoryType::IT_LANDMARK))
 		{
-			llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << safe_inv_type_lookup(inv_type) << " on uuid " << uuid << llendl;
+			llwarns << LLAssetType::lookup(asset_type) << " asset has inventory type " << LLInventoryType::lookupHumanReadable(inv_type) << " on uuid " << uuid << llendl;
 		}
 		new_listener = new LLPlacesLandmarkBridge(inv_type, inventory, root, uuid, flags);
 		break;
-- 
cgit v1.2.3


From 580ecaefcac2eb928c3dbdc9240e3fb54f3c989f Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 2 Apr 2010 11:56:52 -0400
Subject: EXT-6689 : INFRASTRUCTURE : LLInventoryBridge code cleanup

Moved a bunch of local llinventorybridge functions into .cpp.
Did a bunch of superficial cleanup of llinventorybridge and related files.
---
 indra/llinventory/llinventorytype.h | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llinventory/llinventorytype.h b/indra/llinventory/llinventorytype.h
index e515b8a304..20da954002 100644
--- a/indra/llinventory/llinventorytype.h
+++ b/indra/llinventory/llinventorytype.h
@@ -75,7 +75,6 @@ public:
 	// machine transation between type and strings
 	static EType lookup(const std::string& name);
 	static const std::string &lookup(EType type);
-
 	// translation from a type to a human readable form.
 	static const std::string &lookupHumanReadable(EType type);
 
-- 
cgit v1.2.3


From d7579203c0ec25f90839fe8fad01077ca8f9589c Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 19:27:27 +0300
Subject: Partial fix for reopened EXT-6357 (SLapp for object chat does display
 an inspector) - changed the order of registering SLURLs so the
 LLUrlEntryObjectIM will be handled before LLUrlEntryPlace. Reviewed by Vadim
 Savchuk.

--HG--
branch : product-engine
---
 indra/llui/llurlregistry.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 7e09a5a919..687bdc6c7d 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -53,9 +53,9 @@ LLUrlRegistry::LLUrlRegistry()
 	registerUrl(new LLUrlEntryParcel());
 	registerUrl(new LLUrlEntryTeleport());
 	registerUrl(new LLUrlEntryWorldMap());
+	registerUrl(new LLUrlEntryObjectIM());
 	registerUrl(new LLUrlEntryPlace());
 	registerUrl(new LLUrlEntryInventory());
-	registerUrl(new LLUrlEntryObjectIM());
 	//LLUrlEntrySL and LLUrlEntrySLLabel have more common pattern, 
 	//so it should be registered in the end of list
 	registerUrl(new LLUrlEntrySL());
-- 
cgit v1.2.3


From 8cd95bd12a238c99052cff9195b39467d22e1275 Mon Sep 17 00:00:00 2001
From: Xiaohong Bao <bao@lindenlab.com>
Date: Fri, 2 Apr 2010 10:33:20 -0600
Subject: add some debug code for EXT-5394: Crash in
 LLViewerMediaImpl::calculateInterest()

---
 indra/newview/llviewermedia.cpp | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 6f0d9cdd95..5474eeb486 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -2875,7 +2875,13 @@ void LLViewerMediaImpl::calculateInterest()
 	if(!mObjectList.empty())
 	{
 		// Just use the first object in the list.  We could go through the list and find the closest object, but this should work well enough.
-		LLVector3d global_delta = gAgent.getPositionGlobal() - (*mObjectList.begin())->getPositionGlobal();
+		std::list< LLVOVolume* >::iterator iter = mObjectList.begin() ;
+		LLVOVolume* objp = *iter ;
+		llassert_always(objp != NULL) ;
+
+		LLVector3d obj_global = objp->getPositionGlobal() ;
+		LLVector3d agent_global = gAgent.getPositionGlobal() ;
+		LLVector3d global_delta = agent_global - obj_global ;
 		mProximityDistance = global_delta.magVecSquared();  // use distance-squared because it's cheaper and sorts the same.
 	}
 	
-- 
cgit v1.2.3


From 1cd9f71ed18a1c7cdb54aac8c9a7d5f11dd294c4 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 19:51:21 +0300
Subject: Fixed normal bug EXT-6673 (Default sort order of Nerby People list
 should be by most recent speaker) - corrected the default setting for nearby
 people sort order. Reviewed by Vadim Savchuk,
 https://codereview.productengine.com/secondlife/r/175/.

--HG--
branch : product-engine
---
 indra/newview/app_settings/settings.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 442cd5d31e..5993eb46fa 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8184,13 +8184,13 @@
     <key>NearbyPeopleSortOrder</key>
     <map>
       <key>Comment</key>
-      <string>Specifies sort order for nearby people (0 = by name, 2 = by most recent)</string>
+      <string>Specifies sort order for nearby people (0 = by name, 3 = by distance, 4 = by most recent)</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
       <string>U32</string>
       <key>Value</key>
-      <integer>2</integer>
+      <integer>4</integer>
     </map>
     <key>RecentPeopleSortOrder</key>
     <map>
-- 
cgit v1.2.3


From cf94709c60949d5376f8c5dc14bf5472631cd6c9 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Fri, 2 Apr 2010 19:53:19 +0300
Subject: Fixed normal bug EXT-6348 (SLapp world map location does not display
 the correct region) - fixed displaying the world map location for escaped
 SLapp urls. Reviewed by Vadim Savchuk,
 https://codereview.productengine.com/secondlife/r/173/.

--HG--
branch : product-engine
---
 indra/llui/llurlentry.cpp           | 2 +-
 indra/newview/llfloaterworldmap.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index d7666ca4c3..20d3e679e6 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -745,7 +745,7 @@ std::string LLUrlEntryWorldMap::getLabel(const std::string &url, const LLUrlLabe
 	}
 
 	const std::string label = LLTrans::getString("SLurlLabelShowOnMap");
-	std::string location = path_array[2];
+	std::string location = unescapeUrl(path_array[2]);
 	std::string x = (path_parts > 3) ? path_array[3] : "128";
 	std::string y = (path_parts > 4) ? path_array[4] : "128";
 	std::string z = (path_parts > 5) ? path_array[5] : "0";
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 896c410e32..152360a96e 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -125,7 +125,7 @@ public:
 		}
 
 		// support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
-		const std::string region_name = params[0].asString();
+		const std::string region_name = LLURI::unescape(params[0].asString());
 		S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
 		S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
 		S32 z = (params.size() > 3) ? params[3].asInteger() : 0;
-- 
cgit v1.2.3


From 568d6ed229e6d8a32d761482e06828ccc61209a4 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 2 Apr 2010 15:19:44 -0400
Subject: EXT-5940 : INFRASTRUCTURE: Typedef all vector<LLUUID>'s

Fixed some more typedefs that I missed in first checkin.
---
 indra/newview/llagentwearablesfetch.cpp |  8 ++++----
 indra/newview/llappearancemgr.h         |  2 +-
 indra/newview/llavatarlist.cpp          |  7 ++++---
 indra/newview/llavatarlist.h            |  6 ++----
 indra/newview/llcallfloater.cpp         |  4 ++--
 indra/newview/llgesturemgr.cpp          |  2 +-
 indra/newview/llinventorybridge.cpp     |  2 +-
 indra/newview/llinventoryobserver.cpp   | 12 ++++++++----
 indra/newview/llinventoryobserver.h     | 16 ++++++----------
 indra/newview/llpanelpeople.cpp         |  6 +++---
 indra/newview/llparticipantlist.cpp     |  6 +++---
 indra/newview/llsidepanelappearance.cpp |  2 +-
 indra/newview/lltooldraganddrop.cpp     | 10 +++++-----
 indra/newview/llviewermenu.cpp          |  2 +-
 indra/newview/llviewermessage.cpp       |  6 +++---
 15 files changed, 45 insertions(+), 46 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 7a9ecd1c7f..1f22ba040d 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -89,7 +89,7 @@ void LLInitialWearablesFetch::processContents()
 class LLFetchAndLinkObserver: public LLInventoryFetchObserver
 {
 public:
-	LLFetchAndLinkObserver(LLInventoryFetchObserver::item_ref_t& ids):
+	LLFetchAndLinkObserver(uuid_vec_t& ids):
 		m_ids(ids),
 		LLInventoryFetchObserver(true) // retry for missing items
 	{
@@ -103,7 +103,7 @@ public:
 
 		// Link to all fetched items in COF.
 		LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
-		for (LLInventoryFetchObserver::item_ref_t::iterator it = m_ids.begin();
+		for (uuid_vec_t::iterator it = m_ids.begin();
 			 it != m_ids.end();
 			 ++it)
 		{
@@ -124,7 +124,7 @@ public:
 		}
 	}
 private:
-	LLInventoryFetchObserver::item_ref_t m_ids;
+	uuid_vec_t m_ids;
 };
 
 void LLInitialWearablesFetch::processWearablesMessage()
@@ -132,7 +132,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 	if (!mAgentInitialWearables.empty()) // We have an empty current outfit folder, use the message data instead.
 	{
 		const LLUUID current_outfit_id = LLAppearanceMgr::instance().getCOF();
-		LLInventoryFetchObserver::item_ref_t ids;
+		uuid_vec_t ids;
 		for (U8 i = 0; i < mAgentInitialWearables.size(); ++i)
 		{
 			// Populate the current outfit folder with links to the wearables passed in the message
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 5a499026e8..423d9bde69 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -298,7 +298,7 @@ public:
 		}
 
 		CallAfterCategoryFetchStage2<T> *stage2 = new CallAfterCategoryFetchStage2<T>(mCallable);
-		LLInventoryFetchObserver::item_ref_t ids;
+		uuid_vec_t ids;
 		for(S32 i = 0; i < count; ++i)
 		{
 			ids.push_back(item_array.get(i)->getUUID());
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 6ec62a61a0..407c5b6153 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -39,6 +39,7 @@
 #include "llcallingcard.h" // for LLAvatarTracker
 #include "llcachename.h"
 #include "llrecentpeople.h"
+#include "lluuid.h"
 #include "llvoiceclient.h"
 #include "llviewercontrol.h"	// for gSavedSettings
 
@@ -53,7 +54,7 @@ static const unsigned ADD_LIMIT = 50;
 
 bool LLAvatarList::contains(const LLUUID& id)
 {
-	const uuid_vector_t& ids = getIDs();
+	const uuid_vec_t& ids = getIDs();
 	return std::find(ids.begin(), ids.end(), id) != ids.end();
 }
 
@@ -303,9 +304,9 @@ void LLAvatarList::refresh()
 
 bool LLAvatarList::filterHasMatches()
 {
-	uuid_vector_t values = getIDs();
+	uuid_vec_t values = getIDs();
 
-	for (uuid_vector_t::const_iterator it=values.begin(); it != values.end(); it++)
+	for (uuid_vec_t::const_iterator it=values.begin(); it != values.end(); it++)
 	{
 		std::string name;
 		const LLUUID& buddy_id = *it;
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 5a55975413..0203617867 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -53,8 +53,6 @@ class LLAvatarList : public LLFlatListView
 {
 	LOG_CLASS(LLAvatarList);
 public:
-	typedef uuid_vec_t uuid_vector_t;
-
 	struct Params : public LLInitParam::Block<Params, LLFlatListView::Params> 
 	{
 		Optional<bool>	ignore_online_status, // show all items as online
@@ -74,7 +72,7 @@ public:
 
 	void setNameFilter(const std::string& filter);
 	void setDirty(bool val = true, bool force_refresh = false);
-	uuid_vector_t& getIDs() 							{ return mIDs; }
+	uuid_vec_t& getIDs() 							{ return mIDs; }
 	bool contains(const LLUUID& id);
 
 	void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; }
@@ -122,7 +120,7 @@ private:
 	LLTimer*				mLITUpdateTimer; // last interaction time update timer
 	std::string				mIconParamName;
 	std::string				mNameFilter;
-	uuid_vector_t			mIDs;
+	uuid_vec_t				mIDs;
 	LLUUID					mSessionID;
 
 	LLAvatarListItem::ContextMenu* mContextMenu;
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 132e4f0933..df3fe522b5 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -660,8 +660,8 @@ void LLCallFloater::setVoiceRemoveTimer(const LLUUID& voice_speaker_id)
 
 bool LLCallFloater::removeVoiceLeftParticipant(const LLUUID& voice_speaker_id)
 {
-	LLAvatarList::uuid_vector_t& speaker_uuids = mAvatarList->getIDs();
-	LLAvatarList::uuid_vector_t::iterator pos = std::find(speaker_uuids.begin(), speaker_uuids.end(), voice_speaker_id);
+	uuid_vec_t& speaker_uuids = mAvatarList->getIDs();
+	uuid_vec_t::iterator pos = std::find(speaker_uuids.begin(), speaker_uuids.end(), voice_speaker_id);
 	if(pos != speaker_uuids.end())
 	{
 		speaker_uuids.erase(pos);
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index fbacbd704f..c13ebba923 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -1031,7 +1031,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
 			else
 			{
 				// Watch this item and set gesture name when item exists in inventory
-				item_ref_t ids;
+				uuid_vec_t ids;
 				ids.push_back(item_id);
 				self.fetchItems(ids);
 			}
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 10a3713c1e..47d0837ba1 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2007,7 +2007,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 
 	LLRightClickInventoryFetchObserver* outfit;
 	outfit = new LLRightClickInventoryFetchObserver(mCompleteFolders.front(), mCopyItems);
-	LLInventoryFetchObserver::item_ref_t ids;
+	uuid_vec_t ids;
 	for(S32 i = 0; i < count; ++i)
 	{
 		ids.push_back(item_array.get(i)->getUUID());
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 9913be2e88..128f16ecf5 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -108,6 +108,10 @@ void LLInventoryCompletionObserver::watchItem(const LLUUID& id)
 	}
 }
 
+LLInventoryFetchObserver::LLInventoryFetchObserver(bool retry_if_missing) :
+	mRetryIfMissing(retry_if_missing)
+{
+}
 
 void LLInventoryFetchObserver::changed(U32 mask)
 {
@@ -115,7 +119,7 @@ void LLInventoryFetchObserver::changed(U32 mask)
 	// appropriate.
 	if(!mIncomplete.empty())
 	{
-		for(item_ref_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
+		for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end(); )
 		{
 			LLViewerInventoryItem* item = gInventory.getItem(*it);
 			if(!item)
@@ -220,11 +224,11 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 }
 
 void LLInventoryFetchObserver::fetchItems(
-	const LLInventoryFetchObserver::item_ref_t& ids)
+	const uuid_vec_t& ids)
 {
 	LLUUID owner_id;
 	LLSD items_llsd;
-	for(item_ref_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
+	for(uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); ++it)
 	{
 		LLViewerInventoryItem* item = gInventory.getItem(*it);
 		if(item)
@@ -475,7 +479,7 @@ void LLInventoryExistenceObserver::changed(U32 mask)
 	// appropriate.
 	if(!mMIA.empty())
 	{
-		for(item_ref_t::iterator it = mMIA.begin(); it < mMIA.end(); )
+		for(uuid_vec_t::iterator it = mMIA.begin(); it < mMIA.end(); )
 		{
 			LLViewerInventoryItem* item = gInventory.getItem(*it);
 			if(!item)
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index e1c8bd3faf..14948f4e49 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -109,19 +109,17 @@ protected:
 class LLInventoryFetchObserver : public LLInventoryObserver
 {
 public:
-	LLInventoryFetchObserver(bool retry_if_missing = false): mRetryIfMissing(retry_if_missing) {}
+	LLInventoryFetchObserver(bool retry_if_missing = false);
 	virtual void changed(U32 mask);
 
-	typedef uuid_vec_t item_ref_t;
-
 	bool isEverythingComplete() const;
-	void fetchItems(const item_ref_t& ids);
+	void fetchItems(const uuid_vec_t& ids);
 	virtual void done() {};
 
 protected:
 	bool mRetryIfMissing;
-	item_ref_t mComplete;
-	item_ref_t mIncomplete;
+	uuid_vec_t mComplete;
+	uuid_vec_t mIncomplete;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -192,10 +190,8 @@ public:
 
 protected:
 	virtual void done() = 0;
-
-	typedef uuid_vec_t item_ref_t;
-	item_ref_t mExist;
-	item_ref_t mMIA;
+	uuid_vec_t mExist;
+	uuid_vec_t mMIA;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 7f5e63adee..4c24670f47 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -652,8 +652,8 @@ void LLPanelPeople::updateFriendList()
 	av_tracker.copyBuddyList(all_buddies);
 
 	// save them to the online and all friends vectors
-	LLAvatarList::uuid_vector_t& online_friendsp = mOnlineFriendList->getIDs();
-	LLAvatarList::uuid_vector_t& all_friendsp = mAllFriendList->getIDs();
+	uuid_vec_t& online_friendsp = mOnlineFriendList->getIDs();
+	uuid_vec_t& all_friendsp = mAllFriendList->getIDs();
 
 	all_friendsp.clear();
 	online_friendsp.clear();
@@ -746,7 +746,7 @@ void LLPanelPeople::buttonSetAction(const std::string& btn_name, const commit_si
 
 bool LLPanelPeople::isFriendOnline(const LLUUID& id)
 {
-	LLAvatarList::uuid_vector_t ids = mOnlineFriendList->getIDs();
+	uuid_vec_t ids = mOnlineFriendList->getIDs();
 	return std::find(ids.begin(), ids.end(), id) != ids.end();
 }
 
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 268738d88c..79a6d80716 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -248,8 +248,8 @@ bool LLParticipantList::onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, co
 
 bool LLParticipantList::onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
 {
-	LLAvatarList::uuid_vector_t& group_members = mAvatarList->getIDs();
-	LLAvatarList::uuid_vector_t::iterator pos = std::find(group_members.begin(), group_members.end(), event->getValue().asUUID());
+	uuid_vec_t& group_members = mAvatarList->getIDs();
+	uuid_vec_t::iterator pos = std::find(group_members.begin(), group_members.end(), event->getValue().asUUID());
 	if(pos != group_members.end())
 	{
 		group_members.erase(pos);
@@ -260,7 +260,7 @@ bool LLParticipantList::onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event,
 
 bool LLParticipantList::onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
 {
-	LLAvatarList::uuid_vector_t& group_members = mAvatarList->getIDs();
+	uuid_vec_t& group_members = mAvatarList->getIDs();
 	group_members.clear();
 	mAvatarList->setDirty();
 	return true;
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 6d53f9c049..89c60fed34 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -354,7 +354,7 @@ void LLSidepanelAppearance::fetchInventory()
 {
 
 	mNewOutfitBtn->setEnabled(false);
-	LLInventoryFetchObserver::item_ref_t ids;
+	uuid_vec_t ids;
 	LLUUID item_id;
 	for(S32 type = (S32)WT_SHAPE; type < (S32)WT_COUNT; ++type)
 	{
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index f37efd778f..617518ab57 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -267,8 +267,8 @@ void LLCategoryDropObserver::done()
 	{
 		// *FIX: coalesce these...
  		LLInventoryItem* item = NULL;
-  		item_ref_t::iterator it = mComplete.begin();
-  		item_ref_t::iterator end = mComplete.end();
+  		uuid_vec_t::iterator it = mComplete.begin();
+  		uuid_vec_t::iterator end = mComplete.end();
   		for(; it < end; ++it)
   		{
  			item = gInventory.getItem(*it);
@@ -326,8 +326,8 @@ void LLCategoryDropDescendentsObserver::done()
 		{
 			unique_ids.insert(items.get(i)->getUUID());
 		}
-		LLInventoryFetchObserver::item_ref_t ids;
-		std::back_insert_iterator<LLInventoryFetchObserver::item_ref_t> copier(ids);
+		uuid_vec_t ids;
+		std::back_insert_iterator<uuid_vec_t> copier(ids);
 		std::copy(unique_ids.begin(), unique_ids.end(), copier);
 		LLCategoryDropObserver* dropper;
 		dropper = new LLCategoryDropObserver(mObjectID, mSource);
@@ -2567,7 +2567,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 	// If every item is accepted, send it on
 	if (drop && (ACCEPT_YES_COPY_SINGLE <= rv))
 	{
-		LLInventoryFetchObserver::item_ref_t ids;
+		uuid_vec_t ids;
 		for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin();
 			 item_iter != items.end();
 			 ++item_iter)
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index a8b1257cf6..0277005a89 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6153,7 +6153,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 						// if a fetch is already out there (being sent from a slow sim)
 						// we refetch and there are 2 fetches
 						LLWornItemFetchedObserver* wornItemFetched = new LLWornItemFetchedObserver();
-						LLInventoryFetchObserver::item_ref_t items; //add item to the inventory item to be fetched
+						uuid_vec_t items; //add item to the inventory item to be fetched
 						
 						items.push_back((*attachment_iter)->getItemID());
 						
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7346b2a76e..9b39cbfdf1 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1203,7 +1203,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 				// 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.
-				LLInventoryFetchObserver::item_ref_t items;
+				uuid_vec_t items;
 				items.push_back(mObjectID);
 				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
 				open_agent_offer->fetchItems(items);
@@ -1601,7 +1601,7 @@ void inventory_offer_handler(LLOfferInfo* info)
 		p.name = "UserGiveItem";
 		
 		// Prefetch the item into your local inventory.
-		LLInventoryFetchObserver::item_ref_t items;
+		uuid_vec_t items;
 		items.push_back(info->mObjectID);
 		LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
 		fetch_item->fetchItems(items);
@@ -2120,7 +2120,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			if (is_muted)
 			{
 				// Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
-				LLInventoryFetchObserver::item_ref_t items;
+				uuid_vec_t items;
 				items.push_back(info->mObjectID);
 				LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
 				fetch_item->fetchItems(items);
-- 
cgit v1.2.3


From 3e1d33135dd559bebbf362b91c3c966a364685c0 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 2 Apr 2010 12:40:44 -0700
Subject: VWR-17709 en_xui_change to accommodate the longest translation in PL
 even though this is a bug reported for ES; undo JA old override

---
 indra/newview/skins/default/xui/en/floater_report_abuse.xml | 7 ++++---
 indra/newview/skins/default/xui/ja/floater_report_abuse.xml | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_report_abuse.xml b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
index ac0fca9cce..21c0bfef48 100644
--- a/indra/newview/skins/default/xui/en/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
@@ -456,7 +456,7 @@
      layout="topleft"
      left_delta="0"
      name="dscr_title"
-     top_pad="5"
+     top_pad="6"
      width="50">
         Details:
     </text>
@@ -464,11 +464,12 @@
      type="string"
      length="1"
      follows="left|top"
-     height="16"
+     height="22"
      layout="topleft"
      name="bug_aviso"
      left_pad="10"
-     width="200">
+     word_wrap="true"
+     width="270">
         Please be as specific as possible
     </text>
     <text_editor
diff --git a/indra/newview/skins/default/xui/ja/floater_report_abuse.xml b/indra/newview/skins/default/xui/ja/floater_report_abuse.xml
index 105e903840..dc34441535 100644
--- a/indra/newview/skins/default/xui/ja/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/ja/floater_report_abuse.xml
@@ -92,7 +92,7 @@
 	<text name="dscr_title">
 		詳細:
 	</text>
-	<text name="bug_aviso" width="210">
+	<text name="bug_aviso">
 		できるだけ具体的に詳しく記入してください。
 	</text>
 	<text name="incomplete_title">
-- 
cgit v1.2.3


From 50b97bfaf5b975d0e6ea6920b161007ade0d4fc5 Mon Sep 17 00:00:00 2001
From: Monroe Linden <monroe@lindenlab.com>
Date: Fri, 2 Apr 2010 13:30:14 -0700
Subject: Fix for EXT-6663 (TOS Screen logic for enabling agreement checkbox is
 questionable)

* remove the use of the start_url parameter, and instead store the loading url as a string in the xui, so that there's no chance of the loading screen page completing before we add our observer.
* replace the "load complete count" with explicit state variables for whether the loading screen has completed and whether the site is alive
* don't begin trying to load the real URL until both of the above conditions are met (and begin the load no matter which order they are satisfied in)

Reviewed by Richard at http://codereview.lindenlab.com/1218007
---
 indra/newview/llfloatertos.cpp                     | 44 ++++++++++++++++++----
 indra/newview/llfloatertos.h                       |  7 +++-
 indra/newview/skins/default/xui/en/floater_tos.xml |  5 ++-
 3 files changed, 47 insertions(+), 9 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatertos.cpp b/indra/newview/llfloatertos.cpp
index 69ee8cd547..3db9587797 100644
--- a/indra/newview/llfloatertos.cpp
+++ b/indra/newview/llfloatertos.cpp
@@ -57,7 +57,9 @@ LLFloaterTOS::LLFloaterTOS(const LLSD& data)
 :	LLModalDialog( data["message"].asString() ),
 	mMessage(data["message"].asString()),
 	mWebBrowserWindowId( 0 ),
-	mLoadCompleteCount( 0 ),
+	mLoadingScreenLoaded(false),
+	mSiteAlive(false),
+	mRealNavigateBegun(false),
 	mReplyPumpName(data["reply_pump"].asString())
 {
 }
@@ -138,6 +140,11 @@ BOOL LLFloaterTOS::postBuild()
 	if ( web_browser )
 	{
 		web_browser->addObserver(this);
+
+		// Don't use the start_url parameter for this browser instance -- it may finish loading before we get to add our observer.
+		// Store the URL separately and navigate here instead.
+		web_browser->navigateTo( getString( "loading_url" ) );
+		
 		gResponsePtr = LLIamHere::build( this );
 		LLHTTPClient::get( getString( "real_url" ), gResponsePtr );
 	}
@@ -147,15 +154,16 @@ BOOL LLFloaterTOS::postBuild()
 
 void LLFloaterTOS::setSiteIsAlive( bool alive )
 {
+	mSiteAlive = alive;
+	
 	// only do this for TOS pages
 	if (hasChild("tos_html"))
 	{
-		LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
 		// if the contents of the site was retrieved
 		if ( alive )
 		{
 			// navigate to the "real" page 
-			web_browser->navigateTo( getString( "real_url" ) );
+			loadIfNeeded();
 		}
 		else
 		{
@@ -167,6 +175,19 @@ void LLFloaterTOS::setSiteIsAlive( bool alive )
 	}
 }
 
+void LLFloaterTOS::loadIfNeeded()
+{
+	if(!mRealNavigateBegun && mSiteAlive)
+	{
+		LLMediaCtrl* web_browser = getChild<LLMediaCtrl>("tos_html");
+		if(web_browser)
+		{
+			mRealNavigateBegun = true;
+			web_browser->navigateTo( getString( "real_url" ) );
+		}
+	}
+}
+
 LLFloaterTOS::~LLFloaterTOS()
 {
 
@@ -216,8 +237,13 @@ void LLFloaterTOS::onCancel( void* userdata )
 		LLEventPumps::instance().obtain(self->mReplyPumpName).post(LLSD(false));
 	}
 
-	self->mLoadCompleteCount = 0;  // reset counter for next time we come to TOS
-	self->closeFloater(); // destroys this object
+	// reset state for next time we come to TOS
+	self->mLoadingScreenLoaded = false;
+	self->mSiteAlive = false;
+	self->mRealNavigateBegun = false;
+	
+	// destroys this object
+	self->closeFloater(); 
 }
 
 //virtual 
@@ -225,8 +251,12 @@ void LLFloaterTOS::handleMediaEvent(LLPluginClassMedia* /*self*/, EMediaEvent ev
 {
 	if(event == MEDIA_EVENT_NAVIGATE_COMPLETE)
 	{
-		// skip past the loading screen navigate complete
-		if ( ++mLoadCompleteCount == 2 )
+		if(!mLoadingScreenLoaded)
+		{
+			mLoadingScreenLoaded = true;
+			loadIfNeeded();
+		}
+		else if(mRealNavigateBegun)
 		{
 			llinfos << "NAVIGATE COMPLETE" << llendl;
 			// enable Agree to TOS radio button now that page has loaded
diff --git a/indra/newview/llfloatertos.h b/indra/newview/llfloatertos.h
index 1d573e8170..6ea56408ee 100644
--- a/indra/newview/llfloatertos.h
+++ b/indra/newview/llfloatertos.h
@@ -66,9 +66,14 @@ public:
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
 
 private:
+
+	void			loadIfNeeded();
+	
 	std::string		mMessage;
 	int				mWebBrowserWindowId;
-	int				mLoadCompleteCount;
+	bool			mLoadingScreenLoaded;
+	bool			mSiteAlive;
+	bool			mRealNavigateBegun;
 	std::string		mReplyPumpName;
 };
 
diff --git a/indra/newview/skins/default/xui/en/floater_tos.xml b/indra/newview/skins/default/xui/en/floater_tos.xml
index f3665e87ed..cbfaac958b 100644
--- a/indra/newview/skins/default/xui/en/floater_tos.xml
+++ b/indra/newview/skins/default/xui/en/floater_tos.xml
@@ -11,6 +11,10 @@
      name="real_url">
         http://secondlife.com/app/tos/
     </floater.string>
+    <floater.string
+     name="loading_url">
+        data:text/html,%3Chtml%3E%3Chead%3E%3C/head%3E%3Cbody text=%22000000%22%3E%3Ch2%3E Loading %3Ca%20target%3D%22_external%22%20href%3D%22http%3A//secondlife.com/app/tos/%22%3ETerms%20of%20Service%3C/a%3E...%3C/h2%3E %3C/body%3E %3C/html%3E
+    </floater.string>
     <button
      enabled="false"
      height="20"
@@ -59,7 +63,6 @@
      layout="topleft"
      left_delta="0"
      name="tos_html"
-     start_url="data:text/html,%3Chtml%3E%3Chead%3E%3C/head%3E%3Cbody text=%22000000%22%3E%3Ch2%3E Loading %3Ca%20target%3D%22_external%22%20href%3D%22http%3A//secondlife.com/app/tos/%22%3ETerms%20of%20Service%3C/a%3E...%3C/h2%3E %3C/body%3E %3C/html%3E"
      top_delta="40"
      width="568" />
 </floater>
-- 
cgit v1.2.3


From 8adb47c784c47695b55f24e1172e79a687d05007 Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Fri, 2 Apr 2010 14:11:37 -0700
Subject: EXT-6690 shorten PL translation

---
 indra/newview/skins/default/xui/pl/panel_preferences_sound.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
index b69efeb77e..04372208d6 100644
--- a/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
+++ b/indra/newview/skins/default/xui/pl/panel_preferences_sound.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <panel label="Dźwięki" name="Preference Media panel">
 	<slider label="Główny" name="System Volume"/>
-	<check_box initial_value="true" label="Wycisz dzwięk podczas minimalizacji okna" name="mute_when_minimized"/>
+	<check_box initial_value="true" label="Wycisz podczas minimalizacji" name="mute_when_minimized"/>
 	<slider label="Interfejs" name="UI Volume"/>
 	<slider label="Otoczenie" name="Wind Volume"/>
 	<slider label="Efekty dźwiękowe" name="SFX Volume"/>
-- 
cgit v1.2.3


From 9007cf3a535bc6028ca700855745130cd4baaff3 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Fri, 2 Apr 2010 17:12:13 -0400
Subject: EXT-6696 : Make Library inventory items somehow distinguishable at
 first glance from My Inventory items

Library items are now set to Emphasis Color.  This can be easily changed.
Also fixed an issue where the "(Loading...)" string was overlapping with folder inventory strings.
---
 indra/newview/llfolderviewitem.cpp     | 16 +++++++++-------
 indra/newview/skins/default/colors.xml |  3 +++
 2 files changed, 12 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 0a2a33d220..3208218302 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -834,13 +834,17 @@ void LLFolderViewItem::draw()
 	static LLUIColor sFocusOutlineColor = LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
 	static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
 	static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
-	static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemSuffixColor", DEFAULT_WHITE);
+	static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemColor", DEFAULT_WHITE);
+	static LLUIColor sLibraryColor = LLUIColorTable::instance().getColor("InventoryItemLibraryColor", DEFAULT_WHITE);
 	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
+
 	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
 	const S32 TOP_PAD = default_params.item_top_pad;
 	const S32 FOCUS_LEFT = 1;
 	const LLFontGL* font = getLabelFontForStyle(mLabelStyle);
 
+	const BOOL in_inventory = getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), gInventory.getRootFolderID());
+	const BOOL in_library = getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), gInventory.getLibraryRootFolderID());
 
 	//--------------------------------------------------------------------------------//
 	// Draw open folder arrow
@@ -961,6 +965,8 @@ void LLFolderViewItem::draw()
 	}
 
 	LLColor4 color = (mIsSelected && filled) ? sHighlightFgColor : sFgColor;
+	if (in_library) color = sLibraryColor;
+
 	F32 right_x  = 0;
 	F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
 	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
@@ -982,8 +988,6 @@ void LLFolderViewItem::draw()
 												 S32_MAX, S32_MAX, &right_x, FALSE );
 		text_left = right_x;
 	}
-
-
 	//--------------------------------------------------------------------------------//
 	// Draw the actual label text
 	//
@@ -995,13 +999,11 @@ void LLFolderViewItem::draw()
 	// Draw "Loading..." text
 	//
 	bool root_is_loading = false;
-	if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), 
-														 gInventory.getRootFolderID())) // Descendent of my inventory
+	if (in_inventory)
 	{
 		root_is_loading = LLInventoryModelBackgroundFetch::instance().inventoryFetchInProgress(); 
 	}
-	if (getListener() && gInventory.isObjectDescendentOf(getListener()->getUUID(), 
-														 gInventory.getLibraryRootFolderID())) // Descendent of library
+	if (in_library)
 	{
 		root_is_loading = LLInventoryModelBackgroundFetch::instance().libraryFetchInProgress();
 	}
diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml
index 0a906a8063..b067e07c81 100644
--- a/indra/newview/skins/default/colors.xml
+++ b/indra/newview/skins/default/colors.xml
@@ -420,6 +420,9 @@
     <color
      name="InventoryItemSuffixColor"
      reference="White_25" />
+    <color
+     name="InventoryItemLibraryColor"
+     reference="EmphasisColor" />
     <color
      name="InventorySearchStatusColor"
      reference="EmphasisColor" />
-- 
cgit v1.2.3


From 2eba9819df8c473137b0f45d5873794362b14562 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 5 Apr 2010 15:02:36 -0400
Subject: EXT-6703 : LLInventory.h cleanup and create new LLInventoryDefines

Took out enums and flags from LLInventory into LLInventoryDefines
Did a bunch of header file reformatting for LLInventory.h

Change made to simulator files as well.
---
 indra/llinventory/CMakeLists.txt          |   2 +
 indra/llinventory/llinventory.cpp         |  40 ++--
 indra/llinventory/llinventory.h           | 307 ++++++++++++------------------
 indra/llinventory/llinventorydefines.cpp  |  37 ++++
 indra/llinventory/llinventorydefines.h    | 106 +++++++++++
 indra/llmessage/message_prehash.cpp       |   2 +-
 indra/newview/llassetuploadresponders.cpp |   3 +-
 indra/newview/llcompilequeue.cpp          |  26 +--
 indra/newview/llcompilequeue.h            |  12 +-
 indra/newview/llfloaterbulkpermission.cpp |   9 +-
 indra/newview/llfloaterbulkpermission.h   |   4 +-
 indra/newview/llfloaterbuy.cpp            |  11 +-
 indra/newview/llfloaterbuy.h              |   2 +-
 indra/newview/llfloaterbuycontents.cpp    |   9 +-
 indra/newview/llfloaterbuycontents.h      |   2 +-
 indra/newview/llfloateropenobject.cpp     |   4 +-
 indra/newview/llfloaterproperties.cpp     |  16 +-
 indra/newview/llinventorybridge.cpp       |  17 +-
 indra/newview/llinventoryfunctions.cpp    |   3 +-
 indra/newview/llpanelcontents.cpp         |   3 +-
 indra/newview/llpanelgroupnotices.cpp     |   3 +-
 indra/newview/llpanelobjectinventory.cpp  |  19 +-
 indra/newview/llpanelobjectinventory.h    |   6 +-
 indra/newview/llpreview.cpp               |   2 +-
 indra/newview/llpreviewgesture.cpp        |   3 +-
 indra/newview/llpreviewnotecard.cpp       |   1 +
 indra/newview/llpreviewscript.cpp         |   3 +-
 indra/newview/llsidepaneliteminfo.cpp     |  15 +-
 indra/newview/lltooldraganddrop.cpp       |   1 +
 indra/newview/lltracker.cpp               |   7 +-
 indra/newview/llviewerinventory.cpp       |   3 +-
 indra/newview/llviewermenu.cpp            |   9 +-
 indra/newview/llviewermessage.cpp         |   9 +-
 indra/newview/llviewermessage.h           |   2 +-
 indra/newview/llviewerobject.cpp          |  27 +--
 indra/newview/llviewerobject.h            |   6 +-
 indra/newview/llviewertexteditor.cpp      |   4 +-
 indra/newview/llvoinventorylistener.h     |   2 +-
 38 files changed, 414 insertions(+), 323 deletions(-)
 create mode 100644 indra/llinventory/llinventorydefines.cpp
 create mode 100644 indra/llinventory/llinventorydefines.h

(limited to 'indra')

diff --git a/indra/llinventory/CMakeLists.txt b/indra/llinventory/CMakeLists.txt
index b358f0a013..a563db901a 100644
--- a/indra/llinventory/CMakeLists.txt
+++ b/indra/llinventory/CMakeLists.txt
@@ -20,6 +20,7 @@ set(llinventory_SOURCE_FILES
     llcategory.cpp
     lleconomy.cpp
     llinventory.cpp
+    llinventorydefines.cpp
     llinventorytype.cpp
     lllandmark.cpp
     llnotecard.cpp
@@ -36,6 +37,7 @@ set(llinventory_HEADER_FILES
     llcategory.h
     lleconomy.h
     llinventory.h
+    llinventorydefines.h
     llinventorytype.h
     lllandmark.h
     llnotecard.h
diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index d665deb605..e123d255c4 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -31,10 +31,10 @@
  */
 
 #include "linden_common.h"
-
 #include "llinventory.h"
 
 #include "lldbstrings.h"
+#include "llinventorydefines.h"
 #include "llxorcipher.h"
 #include "llsd.h"
 #include "message.h"
@@ -43,9 +43,8 @@
 #include "llsdutil.h"
 
 ///----------------------------------------------------------------------------
-/// exported functions
+/// Exported functions
 ///----------------------------------------------------------------------------
-
 static const std::string INV_ITEM_ID_LABEL("item_id");
 static const std::string INV_FOLDER_ID_LABEL("folder_id");
 static const std::string INV_PARENT_ID_LABEL("parent_id");
@@ -64,15 +63,14 @@ static const std::string INV_CREATION_DATE_LABEL("created_at");
 // key used by agent-inventory-service
 static const std::string INV_ASSET_TYPE_LABEL_WS("type_default");
 static const std::string INV_FOLDER_ID_LABEL_WS("category_id");
+
 ///----------------------------------------------------------------------------
 /// Local function declarations, constants, enums, and typedefs
 ///----------------------------------------------------------------------------
-
 const U8 TASK_INVENTORY_ITEM_KEY = 0;
 const U8 TASK_INVENTORY_ASSET_KEY = 1;
 
 const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");	
-	
 
 ///----------------------------------------------------------------------------
 /// Class LLInventoryObject
@@ -99,7 +97,7 @@ LLInventoryObject::LLInventoryObject() :
 {
 }
 
-LLInventoryObject::~LLInventoryObject( void )
+LLInventoryObject::~LLInventoryObject()
 {
 }
 
@@ -458,11 +456,18 @@ void LLInventoryItem::setCreationDate(time_t creation_date_utc)
 	mCreationDate = creation_date_utc;
 }
 
+// Currently only used in the Viewer to handle calling cards
+// where the creator is actually used to store the target.
+void LLInventoryItem::setCreator(const LLUUID& creator)
+{ 
+	mPermissions.setCreator(creator); 
+}
+
 void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_item)
 {
 	// Remove any pre-existing II_FLAGS_PERM_OVERWRITE_MASK flags 
 	// because we now detect when they should be set.
-	setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItem::II_FLAGS_PERM_OVERWRITE_MASK)) );
+	setFlags( old_item.getFlags() | (getFlags() & ~(LLInventoryItemFlags::II_FLAGS_PERM_OVERWRITE_MASK)) );
 
 	// Enforce the PERM_OVERWRITE flags for any masks that are different
 	// but only for AT_OBJECT's since that is the only asset type that can 
@@ -473,20 +478,20 @@ void LLInventoryItem::accumulatePermissionSlamBits(const LLInventoryItem& old_it
 		U32 flags_to_be_set = 0;
 		if(old_permissions.getMaskNextOwner() != getPermissions().getMaskNextOwner())
 		{
-			flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM;
+			flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
 		}
 		if(old_permissions.getMaskEveryone() != getPermissions().getMaskEveryone())
 		{
-			flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+			flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
 		}
 		if(old_permissions.getMaskGroup() != getPermissions().getMaskGroup())
 		{
-			flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+			flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
 		}
 		LLSaleInfo old_sale_info = old_item.getSaleInfo();
 		if(old_sale_info != getSaleInfo())
 		{
-			flags_to_be_set |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE;
+			flags_to_be_set |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
 		}
 		setFlags(getFlags() | flags_to_be_set);
 	}
@@ -1304,19 +1309,6 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
 	setCreationDate(now);
 }
 
-// returns TRUE if a should appear before b
-BOOL item_dictionary_sort( LLInventoryItem* a, LLInventoryItem* b )
-{
-	return (LLStringUtil::compareDict( a->getName().c_str(), b->getName().c_str() ) < 0);
-}
-
-// returns TRUE if a should appear before b
-BOOL item_date_sort( LLInventoryItem* a, LLInventoryItem* b )
-{
-	return a->getCreationDate() < b->getCreationDate();
-}
-
-
 ///----------------------------------------------------------------------------
 /// Class LLInventoryCategory
 ///----------------------------------------------------------------------------
diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index 9faecbea85..d5a64ea441 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -33,8 +33,6 @@
 #ifndef LL_LLINVENTORY_H
 #define LL_LLINVENTORY_H
 
-#include <functional>
-
 #include "lldarray.h"
 #include "llfoldertype.h"
 #include "llinventorytype.h"
@@ -45,180 +43,95 @@
 #include "llsd.h"
 #include "lluuid.h"
 
-// consts for Key field in the task inventory update message
-extern const U8 TASK_INVENTORY_ITEM_KEY;
-extern const U8 TASK_INVENTORY_ASSET_KEY;
-
-// anonymous enumeration to specify a max inventory buffer size for
-// use in packBinaryBucket()
-enum
-{
-	MAX_INVENTORY_BUFFER_SIZE = 1024
-};
-
-
+class LLMessageSystem;
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryObject
-//
-// This is the base class for inventory objects that handles the
-// common code between items and categories. The 'mParentUUID' member
-// means the parent category since all inventory objects except each
-// user's root category are in some category. Each user's root
-// category will have mParentUUID==LLUUID::null.
+// LLInventoryObject
+//   Base class for inventory objects that handles the common code between items 
+//   and categories. The 'mParentUUID' member means the parent category since all 
+//   inventory objects except each user's root category are in some category. Each 
+//   user's root category will have mParentUUID==LLUUID::null.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-class LLMessageSystem;
-
 class LLInventoryObject : public LLRefCount
 {
-protected:
-	LLUUID mUUID;
-	LLUUID mParentUUID;
-	LLAssetType::EType mType;
-	std::string mName;
+public:
+	typedef std::list<LLPointer<LLInventoryObject> > object_list_t;
 
-protected:
-	virtual ~LLInventoryObject( void );
-	
+	//--------------------------------------------------------------------
+	// Initialization
+	//--------------------------------------------------------------------
 public:
 	MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
-	LLInventoryObject(const LLUUID& uuid, const LLUUID& parent_uuid,
-					  LLAssetType::EType type, const std::string& name);
 	LLInventoryObject();
+	LLInventoryObject(const LLUUID& uuid, 
+					  const LLUUID& parent_uuid,
+					  LLAssetType::EType type, 
+					  const std::string& name);
 	void copyObject(const LLInventoryObject* other); // LLRefCount requires custom copy
+protected:
+	virtual ~LLInventoryObject();
 
-	// accessors
-	virtual const LLUUID& getUUID() const;
+	//--------------------------------------------------------------------
+	// Accessors
+	//--------------------------------------------------------------------
+public:
+	virtual const LLUUID& getUUID() const; // inventoryID that this item points to
+	virtual const LLUUID& getLinkedUUID() const; // inventoryID that this item points to, else this item's inventoryID
 	const LLUUID& getParentUUID() const;
-	virtual const LLUUID& getLinkedUUID() const; // get the inventoryID that this item points to, else this item's inventoryID
 	virtual const std::string& getName() const;
 	virtual LLAssetType::EType getType() const;
 	LLAssetType::EType getActualType() const; // bypasses indirection for linked items
 	BOOL getIsLinkType() const;
-	// mutators - will not call updateServer();
+	
+	//--------------------------------------------------------------------
+	// Mutators
+	//   Will not call updateServer
+	//--------------------------------------------------------------------
+public:
 	void setUUID(const LLUUID& new_uuid);
 	virtual void rename(const std::string& new_name);
 	void setParent(const LLUUID& new_parent);
 	void setType(LLAssetType::EType type);
 
-	// file support - implemented here so that a minimal information
-	// set can be transmitted between simulator and viewer.
-// 	virtual BOOL importFile(LLFILE* fp);
+	//--------------------------------------------------------------------
+	// File Support
+	//   Implemented here so that a minimal information set can be transmitted 
+	//   between simulator and viewer.
+	//--------------------------------------------------------------------
+public:
+	// virtual BOOL importFile(LLFILE* fp);
 	virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
-
 	virtual BOOL importLegacyStream(std::istream& input_stream);
 	virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
 
-	// virtual methods
 	virtual void removeFromServer();
 	virtual void updateParentOnServer(BOOL) const;
 	virtual void updateServer(BOOL) const;
+
+	//--------------------------------------------------------------------
+	// Member Variables
+	//--------------------------------------------------------------------
+protected:
+	LLUUID mUUID;
+	LLUUID mParentUUID;
+	LLAssetType::EType mType;
+	std::string mName;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// Class LLInventoryItem
-//
-// An inventory item represents something that the current user has in
-// their inventory.
+// LLInventoryItem
+//   An inventory item represents something that the current user has in
+//   his inventory.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLInventoryItem : public LLInventoryObject
 {
 public:
 	typedef LLDynamicArray<LLPointer<LLInventoryItem> > item_array_t;
-	
-protected:
-	LLPermissions mPermissions;
-	LLUUID mAssetUUID;
-	std::string mDescription;
-	LLSaleInfo mSaleInfo;
-	LLInventoryType::EType mInventoryType;
-	U32 mFlags;
-	time_t mCreationDate;	// seconds from 1/1/1970, UTC
-
-public:
-
-	/**
-	 * Anonymous enumeration for specifying the inventory item flags.
-	 */
-	enum
-	{
-		// The shared flags at the top are shared among all inventory
-		// types. After that section, all values of flags are type
-		// dependent.  The shared flags will start at 2^30 and work
-		// down while item type specific flags will start at 2^0 and
-		// work up.
-		II_FLAGS_NONE = 0,
-
-
-		//
-		// Shared flags
-		//
-		//
-
-		// This value means that the asset has only one reference in
-		// the system. If the inventory item is deleted, or the asset
-		// id updated, then we can remove the old reference.
-		II_FLAGS_SHARED_SINGLE_REFERENCE = 0x40000000,
-
-
-		//
-		// Landmark flags
-		//
-		II_FLAGS_LANDMARK_VISITED = 1,
-
-		//
-		// Object flags
-		//
-
-		// flag to indicate that object permissions should have next
-		// owner perm be more restrictive on rez. We bump this into
-		// the second byte of the flags since the low byte is used to
-		// track attachment points.
-		II_FLAGS_OBJECT_SLAM_PERM = 0x100,
-
-		// flag to indicate that the object sale information has been changed.
-		II_FLAGS_OBJECT_SLAM_SALE = 0x1000,
-
-		// These flags specify which permissions masks to overwrite
-		// upon rez.  Normally, if no permissions slam (above) or
-		// overwrite flags are set, the asset's permissions are
-		// used and the inventory's permissions are ignored.  If
-		// any of these flags are set, the inventory's permissions
-		// take precedence.
-		II_FLAGS_OBJECT_PERM_OVERWRITE_BASE			= 0x010000,
-		II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER		= 0x020000,
-		II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP		= 0x040000,
-		II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE		= 0x080000,
-		II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER	= 0x100000,
-
- 		// flag to indicate whether an object that is returned is composed 
-		// of muiltiple items or not.
-		II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS			= 0x200000,
-
-		//
-		// wearables use the low order byte of flags to store the
-		// EWearableType enumeration found in newview/llwearable.h
-		//
-		II_FLAGS_WEARABLES_MASK = 0xff,
-
-		// these bits need to be cleared whenever the asset_id is updated
-		// on a pre-existing inventory item (DEV-28098 and DEV-30997)
-		II_FLAGS_PERM_OVERWRITE_MASK  =   II_FLAGS_OBJECT_SLAM_PERM 
-										| II_FLAGS_OBJECT_SLAM_SALE 
-										| II_FLAGS_OBJECT_PERM_OVERWRITE_BASE
-										| II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER
-										| II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP
-										| II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE
-										| II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER,
-	};
-
-protected:
-	~LLInventoryItem(); // ref counted
 
+	//--------------------------------------------------------------------
+	// Initialization
+	//--------------------------------------------------------------------
 public:
-
 	MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
 	LLInventoryItem(const LLUUID& uuid,
 					const LLUUID& parent_uuid,
@@ -237,10 +150,14 @@ public:
 	// is prohibited
 	LLInventoryItem(const LLInventoryItem* other);
 	virtual void copyItem(const LLInventoryItem* other); // LLRefCount requires custom copy
-
 	void generateUUID() { mUUID.generate(); }
+protected:
+	~LLInventoryItem(); // ref counted
 	
-	// accessors
+	//--------------------------------------------------------------------
+	// Accessors
+	//--------------------------------------------------------------------
+public:
 	virtual const LLUUID& getLinkedUUID() const;
 	virtual const LLPermissions& getPermissions() const;
 	virtual const LLUUID& getCreatorUUID() const;
@@ -252,8 +169,12 @@ public:
 	virtual time_t getCreationDate() const;
 	virtual U32 getCRC32() const; // really more of a checksum.
 	
-	// mutators - will not call updateServer(), and will never fail
-	// (though it may correct to sane values)
+	//--------------------------------------------------------------------
+	// Mutators
+	//   Will not call updateServer and will never fail
+	//   (though it may correct to sane values)
+	//--------------------------------------------------------------------
+public:
 	void setAssetUUID(const LLUUID& asset_id);
 	void setDescription(const std::string& new_desc);
 	void setSaleInfo(const LLSaleInfo& sale_info);
@@ -261,62 +182,68 @@ public:
 	void setInventoryType(LLInventoryType::EType inv_type);
 	void setFlags(U32 flags);
 	void setCreationDate(time_t creation_date_utc);
+	void setCreator(const LLUUID& creator); // only used for calling cards
 
 	// Check for changes in permissions masks and sale info
-	// and set the corresponding bits in mFlags
+	// and set the corresponding bits in mFlags.
 	void accumulatePermissionSlamBits(const LLInventoryItem& old_item);
-	
-	// This is currently only used in the Viewer to handle calling cards
-	// where the creator is actually used to store the target.
-	void setCreator(const LLUUID& creator) { mPermissions.setCreator(creator); }
 
-	// Put this inventory item onto the current outgoing mesage. It
-	// assumes you have already called nextBlock().
+	// Put this inventory item onto the current outgoing mesage.
+	// Assumes you have already called nextBlock().
 	virtual void packMessage(LLMessageSystem* msg) const;
 
-	// unpack returns TRUE if the inventory item came through the
-	// network ok. It uses a simple crc check which is defeatable, but
-	// we want to detect network mangling somehow.
+	// Returns TRUE if the inventory item came through the network correctly.
+	// Uses a simple crc check which is defeatable, but we want to detect 
+	// network mangling somehow.
 	virtual BOOL unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
-	// file support
+
+	//--------------------------------------------------------------------
+	// File Support
+	//--------------------------------------------------------------------
+public:
 	virtual BOOL importFile(LLFILE* fp);
 	virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
-
 	virtual BOOL importLegacyStream(std::istream& input_stream);
 	virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
 
-	// helper functions
-
-	// pack all information needed to reconstruct this item into the given binary bucket.
-	// perm_override is optional
+	//--------------------------------------------------------------------
+	// Helper Functions
+	//--------------------------------------------------------------------
+public:
+	// Pack all information needed to reconstruct this item into the given binary bucket.
 	S32 packBinaryBucket(U8* bin_bucket, LLPermissions* perm_override = NULL) const;
 	void unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size);
 	LLSD asLLSD() const;
 	void asLLSD( LLSD& sd ) const;
 	bool fromLLSD(const LLSD& sd);
 
+	//--------------------------------------------------------------------
+	// Member Variables
+	//--------------------------------------------------------------------
+protected:
+	LLPermissions mPermissions;
+	LLUUID mAssetUUID;
+	std::string mDescription;
+	LLSaleInfo mSaleInfo;
+	LLInventoryType::EType mInventoryType;
+	U32 mFlags;
+	time_t mCreationDate; // seconds from 1/1/1970, UTC
 };
 
-BOOL item_dictionary_sort(LLInventoryItem* a,LLInventoryItem* b);
-BOOL item_date_sort(LLInventoryItem* a, LLInventoryItem* b);
-
-
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryCategory
-//
-// An instance of this class represents a category of inventory
-// items. Users come with a set of default categories, and can create
-// new ones as needed.
+//   An instance of this class represents a category/folder of inventory
+//   items. Users come with a set of default categories, and can create
+//   new ones as needed.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
 class LLInventoryCategory : public LLInventoryObject
 {
 public:
 	typedef LLDynamicArray<LLPointer<LLInventoryCategory> > cat_array_t;
 
-protected:
-	~LLInventoryCategory();
-	
+	//--------------------------------------------------------------------
+	// Initialization
+	//--------------------------------------------------------------------
 public:
 	MEM_TYPE_NEW(LLMemType::MTYPE_INVENTORY);
 	LLInventoryCategory(const LLUUID& uuid, const LLUUID& parent_uuid,
@@ -325,40 +252,48 @@ public:
 	LLInventoryCategory();
 	LLInventoryCategory(const LLInventoryCategory* other);
 	void copyCategory(const LLInventoryCategory* other); // LLRefCount requires custom copy
+protected:
+	~LLInventoryCategory();
 
-	// accessors and mutators
+	//--------------------------------------------------------------------
+	// Accessors And Mutators
+	//--------------------------------------------------------------------
+public:
 	LLFolderType::EType getPreferredType() const;
 	void setPreferredType(LLFolderType::EType type);
-	// For messaging system support
-	virtual void packMessage(LLMessageSystem* msg) const;
-	virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
-
 	LLSD asLLSD() const;
 	bool fromLLSD(const LLSD& sd);
 
-	// file support
+	//--------------------------------------------------------------------
+	// Messaging
+	//--------------------------------------------------------------------
+public:
+	virtual void packMessage(LLMessageSystem* msg) const;
+	virtual void unpackMessage(LLMessageSystem* msg, const char* block, S32 block_num = 0);
+
+	//--------------------------------------------------------------------
+	// File Support
+	//--------------------------------------------------------------------
+public:
 	virtual BOOL importFile(LLFILE* fp);
 	virtual BOOL exportFile(LLFILE* fp, BOOL include_asset_key = TRUE) const;
-
 	virtual BOOL importLegacyStream(std::istream& input_stream);
 	virtual BOOL exportLegacyStream(std::ostream& output_stream, BOOL include_asset_key = TRUE) const;
 
+	//--------------------------------------------------------------------
+	// Member Variables
+	//--------------------------------------------------------------------
 protected:
-	// May be the type that this category was "meant" to hold (although it may hold any type).	
-	LLFolderType::EType	mPreferredType;		
+	LLFolderType::EType	mPreferredType; // Type that this category was "meant" to hold (although it may hold any type).	
 };
 
 
 //-----------------------------------------------------------------------------
-// Useful bits
+// Convertors
+//   These functions convert between structured data and an inventory
+//   item, appropriate for serialization.
 //-----------------------------------------------------------------------------
-
-typedef std::list<LLPointer<LLInventoryObject> > InventoryObjectList;
-
-// These functions convert between structured data and an inventory
-// item, appropriate for serialization.
 LLSD ll_create_sd_from_inventory_item(LLPointer<LLInventoryItem> item);
-//LLPointer<LLInventoryItem> ll_create_item_from_sd(const LLSD& sd_item);
 LLSD ll_create_sd_from_inventory_category(LLPointer<LLInventoryCategory> cat);
 LLPointer<LLInventoryCategory> ll_create_category_from_sd(const LLSD& sd_cat);
 
diff --git a/indra/llinventory/llinventorydefines.cpp b/indra/llinventory/llinventorydefines.cpp
new file mode 100644
index 0000000000..a9610d4d4b
--- /dev/null
+++ b/indra/llinventory/llinventorydefines.cpp
@@ -0,0 +1,37 @@
+/** 
+ * @file llinventorydefines.cpp
+ * @brief Implementation of the inventory defines.
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "linden_common.h"
+#include "llinventorydefines.h"
+
+const U8 TASK_INVENTORY_ITEM_KEY = 0;
+const U8 TASK_INVENTORY_ASSET_KEY = 1;
diff --git a/indra/llinventory/llinventorydefines.h b/indra/llinventory/llinventorydefines.h
new file mode 100644
index 0000000000..ccf1a356de
--- /dev/null
+++ b/indra/llinventory/llinventorydefines.h
@@ -0,0 +1,106 @@
+/** 
+ * @file llinventorydefines.h
+ * @brief LLInventoryDefines
+ *
+ * $LicenseInfo:firstyear=2001&license=viewergpl$
+ * 
+ * Copyright (c) 2001-2009, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLINVENTORYDEFINES_H
+#define LL_LLINVENTORYDEFINES_H
+
+// Consts for "key" field in the task inventory update message
+extern const U8 TASK_INVENTORY_ITEM_KEY;
+extern const U8 TASK_INVENTORY_ASSET_KEY;
+
+// Max inventory buffer size (for use in packBinaryBucket)
+enum
+{
+	MAX_INVENTORY_BUFFER_SIZE = 1024
+};
+
+//--------------------------------------------------------------------
+// Inventory item flags enums
+//   The shared flags at the top are shared among all inventory
+//   types. After that section, all values of flags are type
+//   dependent.  The shared flags will start at 2^30 and work
+//   down while item type specific flags will start at 2^0 and work up.
+//--------------------------------------------------------------------
+class LLInventoryItemFlags
+{
+public:
+	enum EType
+	{
+		II_FLAGS_NONE 								= 0,
+		
+		II_FLAGS_SHARED_SINGLE_REFERENCE 			= 0x40000000,
+			// The asset has only one reference in the system. If the 
+			// inventory item is deleted, or the assetid updated, then we 
+			// can remove the old reference.
+		
+		II_FLAGS_LANDMARK_VISITED 					= 1,
+
+		II_FLAGS_OBJECT_SLAM_PERM 					= 0x100,
+			// Object permissions should have next owner perm be more 
+			// restrictive on rez. We bump this into the second byte of the 
+			// flags since the low byte is used to track attachment points.
+
+		II_FLAGS_OBJECT_SLAM_SALE 					= 0x1000,
+			// The object sale information has been changed.
+		
+		II_FLAGS_OBJECT_PERM_OVERWRITE_BASE			= 0x010000,
+		II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER		= 0x020000,
+		II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP		= 0x040000,
+		II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE		= 0x080000,
+		II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER	= 0x100000,
+			// Specify which permissions masks to overwrite
+			// upon rez.  Normally, if no permissions slam (above) or
+			// overwrite flags are set, the asset's permissions are
+			// used and the inventory's permissions are ignored.  If
+			// any of these flags are set, the inventory's permissions
+			// take precedence.
+
+		II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS			= 0x200000,
+			// Whether a returned object is composed of multiple items.
+
+		II_FLAGS_WEARABLES_MASK = 0xff,
+			// Wearables use the low order byte of flags to store the
+			// EWearableType enumeration found in newview/llwearable.h
+
+		II_FLAGS_PERM_OVERWRITE_MASK = 				(II_FLAGS_OBJECT_SLAM_PERM |
+													 II_FLAGS_OBJECT_SLAM_SALE |
+													 II_FLAGS_OBJECT_PERM_OVERWRITE_BASE |
+													 II_FLAGS_OBJECT_PERM_OVERWRITE_OWNER |
+													 II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP |
+													 II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE |
+													 II_FLAGS_OBJECT_PERM_OVERWRITE_NEXT_OWNER),
+			// These bits need to be cleared whenever the asset_id is updated
+			// on a pre-existing inventory item (DEV-28098 and DEV-30997)
+	};
+};
+
+#endif // LL_LLINVENTORYDEFINES_H
diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp
index 9e3986f257..a118e21ffb 100644
--- a/indra/llmessage/message_prehash.cpp
+++ b/indra/llmessage/message_prehash.cpp
@@ -1147,7 +1147,7 @@ char* _PREHASH_ForceObjectSelect = LLMessageStringTable::getInstance()->getStrin
 char* _PREHASH_Price = LLMessageStringTable::getInstance()->getString("Price");
 char* _PREHASH_SunDirection = LLMessageStringTable::getInstance()->getString("SunDirection");
 char* _PREHASH_FromName = LLMessageStringTable::getInstance()->getString("FromName");
-char* _PREHASH_ChangeInventoryItemFlags = LLMessageStringTable::getInstance()->getString("ChangeInventoryItemFlags");
+char* _PREHASH_ChangeInventoryItemFlags = LLMessageStringTable::getInstance()->getString("ChangLLInventoryItemFlags");
 char* _PREHASH_Force = LLMessageStringTable::getInstance()->getString("Force");
 char* _PREHASH_TransactionBlock = LLMessageStringTable::getInstance()->getString("TransactionBlock");
 char* _PREHASH_PowersMask = LLMessageStringTable::getInstance()->getString("PowersMask");
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 370ecc0665..2f90d652e4 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -39,6 +39,7 @@
 #include "llcompilequeue.h"
 #include "llfloaterbuycurrency.h"
 #include "llfilepicker.h"
+#include "llinventorydefines.h"
 #include "llinventoryobserver.h"
 #include "llinventorypanel.h"
 #include "llpermissionsflags.h"
@@ -288,7 +289,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
 										mPostData["name"].asString(),
 										mPostData["description"].asString(),
 										LLSaleInfo::DEFAULT,
-										LLInventoryItem::II_FLAGS_NONE,
+										LLInventoryItemFlags::II_FLAGS_NONE,
 										creation_date_now);
 		gInventory.updateItem(item);
 		gInventory.notifyObservers();
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index a96981a108..feb8c540ef 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -114,7 +114,7 @@ BOOL LLFloaterScriptQueue::postBuild()
 // worked on.
 // NOT static, virtual!
 void LLFloaterScriptQueue::inventoryChanged(LLViewerObject* viewer_object,
-											 InventoryObjectList* inv,
+											 LLInventoryObject::object_list_t* inv,
 											 S32,
 											 void* q_id)
 {
@@ -305,7 +305,7 @@ LLFloaterCompileQueue::~LLFloaterCompileQueue()
 }
 
 void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
-											InventoryObjectList* inv)
+											LLInventoryObject::object_list_t* inv)
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
@@ -313,8 +313,8 @@ void LLFloaterCompileQueue::handleInventory(LLViewerObject *viewer_object,
 	typedef std::multimap<LLUUID, LLPointer<LLInventoryItem> > uuid_item_map;
 	uuid_item_map asset_item_map;
 
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
 	{
 		if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -625,14 +625,14 @@ LLFloaterResetQueue::~LLFloaterResetQueue()
 }
 
 void LLFloaterResetQueue::handleInventory(LLViewerObject* viewer_obj,
-										  InventoryObjectList* inv)
+										  LLInventoryObject::object_list_t* inv)
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
 	LLDynamicArray<const char*> names;
 	
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
 	{
 		if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -677,14 +677,14 @@ LLFloaterRunQueue::~LLFloaterRunQueue()
 }
 
 void LLFloaterRunQueue::handleInventory(LLViewerObject* viewer_obj,
-										  InventoryObjectList* inv)
+										  LLInventoryObject::object_list_t* inv)
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
 	LLDynamicArray<const char*> names;
 	
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
 	{
 		if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
@@ -732,14 +732,14 @@ LLFloaterNotRunQueue::~LLFloaterNotRunQueue()
 }
 
 void LLFloaterNotRunQueue::handleInventory(LLViewerObject* viewer_obj,
-										  InventoryObjectList* inv)
+										  LLInventoryObject::object_list_t* inv)
 {
 	// find all of the lsl, leaving off duplicates. We'll remove
 	// all matching asset uuids on compilation success.
 	LLDynamicArray<const char*> names;
 	
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
 	{
 		if((*it)->getType() == LLAssetType::AT_LSL_TEXT)
diff --git a/indra/newview/llcompilequeue.h b/indra/newview/llcompilequeue.h
index 2d061f5d8a..4fde2572af 100644
--- a/indra/newview/llcompilequeue.h
+++ b/indra/newview/llcompilequeue.h
@@ -76,13 +76,13 @@ protected:
 	// This is the callback method for the viewer object currently
 	// being worked on.
 	/*virtual*/ void inventoryChanged(LLViewerObject* obj,
-								 InventoryObjectList* inv,
+								 LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* queue);
 	
 	// This is called by inventoryChanged
 	virtual void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv) = 0;
+								LLInventoryObject::object_list_t* inv) = 0;
 
 	static void onCloseBtn(void* user_data);
 
@@ -145,7 +145,7 @@ protected:
 	
 	// This is called by inventoryChanged
 	virtual void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv);
+								LLInventoryObject::object_list_t* inv);
 
 	// This is the callback for when each script arrives
 	static void scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
@@ -192,7 +192,7 @@ protected:
 	
 	// This is called by inventoryChanged
 	virtual void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv);
+								LLInventoryObject::object_list_t* inv);
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -210,7 +210,7 @@ protected:
 	
 	// This is called by inventoryChanged
 	virtual void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv);
+								LLInventoryObject::object_list_t* inv);
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -228,7 +228,7 @@ protected:
 	
 	// This is called by inventoryChanged
 	virtual void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv);
+								LLInventoryObject::object_list_t* inv);
 };
 
 #endif // LL_LLCOMPILEQUEUE_H
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index b2f700069f..766fc0723c 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -37,6 +37,7 @@
 #include "llfloaterperms.h" // for utilities
 #include "llagent.h"
 #include "llchat.h"
+#include "llinventorydefines.h"
 #include "llviewerwindow.h"
 #include "llviewerobject.h"
 #include "llviewerobjectlist.h"
@@ -116,7 +117,7 @@ void LLFloaterBulkPermission::doApply()
 // worked on.
 // NOT static, virtual!
 void LLFloaterBulkPermission::inventoryChanged(LLViewerObject* viewer_object,
-											 InventoryObjectList* inv,
+											 LLInventoryObject::object_list_t* inv,
 											 S32,
 											 void* q_id)
 {
@@ -250,12 +251,12 @@ void LLFloaterBulkPermission::doCheckUncheckAll(BOOL check)
 }
 
 
-void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, InventoryObjectList* inv)
+void LLFloaterBulkPermission::handleInventory(LLViewerObject* viewer_obj, LLInventoryObject::object_list_t* inv)
 {
 	LLScrollListCtrl* list = getChild<LLScrollListCtrl>("queue output");
 
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it)
 	{
 		LLAssetType::EType asstype = (*it)->getType();
diff --git a/indra/newview/llfloaterbulkpermission.h b/indra/newview/llfloaterbulkpermission.h
index bffcff7059..80dc88fbb1 100644
--- a/indra/newview/llfloaterbulkpermission.h
+++ b/indra/newview/llfloaterbulkpermission.h
@@ -63,13 +63,13 @@ private:
 	// This is the callback method for the viewer object currently
 	// being worked on.
 	/*virtual*/ void inventoryChanged(LLViewerObject* obj,
-								 InventoryObjectList* inv,
+								 LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* queue);
 	
 	// This is called by inventoryChanged
 	void handleInventory(LLViewerObject* viewer_obj,
-								InventoryObjectList* inv);
+								LLInventoryObject::object_list_t* inv);
 
 
 	void updateInventory(LLViewerObject* object,
diff --git a/indra/newview/llfloaterbuy.cpp b/indra/newview/llfloaterbuy.cpp
index 589f570d96..44c82f1941 100644
--- a/indra/newview/llfloaterbuy.cpp
+++ b/indra/newview/llfloaterbuy.cpp
@@ -44,6 +44,7 @@
 #include "llinventorymodel.h"	// for gInventory
 #include "llfloaterreg.h"
 #include "llfloaterinventory.h"	// for get_item_icon
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llnotificationsutil.h"
 #include "llselectmgr.h"
@@ -195,7 +196,7 @@ void LLFloaterBuy::show(const LLSaleInfo& sale_info)
 }
 
 void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
-								 InventoryObjectList* inv,
+								 LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* data)
 {
@@ -220,8 +221,8 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 		return;
 	}
 
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 	for ( ; it != end; ++it )
 	{
 		LLInventoryObject* obj = (LLInventoryObject*)(*it);
@@ -246,8 +247,8 @@ void LLFloaterBuy::inventoryChanged(LLViewerObject* obj,
 
 		// Compute icon for this item
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED 
-			|| inv_item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
+		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED 
+			|| inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS)
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloaterbuy.h b/indra/newview/llfloaterbuy.h
index ab38e082dc..411c8fb00e 100644
--- a/indra/newview/llfloaterbuy.h
+++ b/indra/newview/llfloaterbuy.h
@@ -65,7 +65,7 @@ protected:
 
 	void requestObjectInventories();
 	/*virtual*/ void inventoryChanged(LLViewerObject* obj,
-								 InventoryObjectList* inv,
+								 LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* data);
 
diff --git a/indra/newview/llfloaterbuycontents.cpp b/indra/newview/llfloaterbuycontents.cpp
index 0daef27af2..1d989ad0fd 100644
--- a/indra/newview/llfloaterbuycontents.cpp
+++ b/indra/newview/llfloaterbuycontents.cpp
@@ -44,6 +44,7 @@
 
 #include "llagent.h"			// for agent id
 #include "llcheckboxctrl.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"	// for gInventory
 #include "llfloaterreg.h"
@@ -142,7 +143,7 @@ void LLFloaterBuyContents::show(const LLSaleInfo& sale_info)
 
 
 void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
-											InventoryObjectList* inv,
+											LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* data)
 {
@@ -176,8 +177,8 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 	LLInventoryType::EType inv_type;
 	S32 wearable_count = 0;
 	
-	InventoryObjectList::const_iterator it = inv->begin();
-	InventoryObjectList::const_iterator end = inv->end();
+	LLInventoryObject::object_list_t::const_iterator it = inv->begin();
+	LLInventoryObject::object_list_t::const_iterator end = inv->end();
 
 	for ( ; it != end; ++it )
 	{
@@ -215,7 +216,7 @@ void LLFloaterBuyContents::inventoryChanged(LLViewerObject* obj,
 		LLSD row;
 
 		BOOL item_is_multi = FALSE;
-		if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_LANDMARK_VISITED )
+		if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED )
 		{
 			item_is_multi = TRUE;
 		}
diff --git a/indra/newview/llfloaterbuycontents.h b/indra/newview/llfloaterbuycontents.h
index 8045a46c9f..ab161adfea 100644
--- a/indra/newview/llfloaterbuycontents.h
+++ b/indra/newview/llfloaterbuycontents.h
@@ -59,7 +59,7 @@ public:
 protected:
 	void requestObjectInventories();
 	/*virtual*/ void inventoryChanged(LLViewerObject* obj,
-								 InventoryObjectList* inv,
+								 LLInventoryObject::object_list_t* inv,
 								 S32 serial_num,
 								 void* data);
 	
diff --git a/indra/newview/llfloateropenobject.cpp b/indra/newview/llfloateropenobject.cpp
index ec50ed596c..71bfae316a 100644
--- a/indra/newview/llfloateropenobject.cpp
+++ b/indra/newview/llfloateropenobject.cpp
@@ -121,12 +121,12 @@ void LLFloaterOpenObject::refresh()
 		{
 			// this folder is coming from an object, as there is only one folder in an object, the root,
 			// we need to collect the entire contents and handle them as a group
-			InventoryObjectList inventory_objects;
+			LLInventoryObject::object_list_t inventory_objects;
 			object->getInventoryContents(inventory_objects);
 			
 			if (!inventory_objects.empty())
 			{
-				for (InventoryObjectList::iterator it = inventory_objects.begin(); 
+				for (LLInventoryObject::object_list_t::iterator it = inventory_objects.begin(); 
 					 it != inventory_objects.end(); 
 					 ++it)
 				{
diff --git a/indra/newview/llfloaterproperties.cpp b/indra/newview/llfloaterproperties.cpp
index 5c0593ad29..bb9d151cd2 100644
--- a/indra/newview/llfloaterproperties.cpp
+++ b/indra/newview/llfloaterproperties.cpp
@@ -38,12 +38,12 @@
 #include "llcachename.h"
 #include "lldbstrings.h"
 #include "llfloaterreg.h"
-#include "llinventory.h"
 
 #include "llagent.h"
 #include "llbutton.h"
 #include "llcheckboxctrl.h"
 #include "llavataractions.h"
+#include "llinventorydefines.h"
 #include "llinventoryobserver.h"
 #include "llinventorymodel.h"
 #include "lllineeditor.h"
@@ -380,9 +380,9 @@ void LLFloaterProperties::refreshFromItem(LLInventoryItem* item)
 		if (item->getType() == LLAssetType::AT_OBJECT)
 		{
 			U32 flags = item->getFlags();
-			slam_perm 			= flags & LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM;
-			overwrite_everyone	= flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
-			overwrite_group		= flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+			slam_perm 			= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
+			overwrite_everyone	= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+			overwrite_group		= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
 		}
 		
 		std::string perm_string;
@@ -693,7 +693,7 @@ void LLFloaterProperties::onCommitPermissions()
 		if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
 		   && (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
 		}
 		// If everyone permissions have changed (and this is an object)
 		// then set the overwrite everyone permissions flag so they
@@ -701,7 +701,7 @@ void LLFloaterProperties::onCommitPermissions()
 		if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
 			&& (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
 		}
 		// If group permissions have changed (and this is an object)
 		// then set the overwrite group permissions flag so they
@@ -709,7 +709,7 @@ void LLFloaterProperties::onCommitPermissions()
 		if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
 			&& (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
 		}
 		new_item->setFlags(flags);
 		if(mObjectID.isNull())
@@ -821,7 +821,7 @@ void LLFloaterProperties::updateSaleInfo()
 		if (item->getType() == LLAssetType::AT_OBJECT)
 		{
 			U32 flags = new_item->getFlags();
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
 			new_item->setFlags(flags);
 		}
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 47d0837ba1..09168b4f31 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -50,6 +50,7 @@
 #include "llimfloater.h"
 #include "llimview.h"
 #include "llinventoryclipboard.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
@@ -1858,7 +1859,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 
 	// this folder is coming from an object, as there is only one folder in an object, the root,
 	// we need to collect the entire contents and handle them as a group
-	InventoryObjectList inventory_objects;
+	LLInventoryObject::object_list_t inventory_objects;
 	object->getInventoryContents(inventory_objects);
 
 	if (inventory_objects.empty())
@@ -1872,8 +1873,8 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 
 	// coming from a task. Need to figure out if the person can
 	// move/copy this item.
-	InventoryObjectList::iterator it = inventory_objects.begin();
-	InventoryObjectList::iterator end = inventory_objects.end();
+	LLInventoryObject::object_list_t::iterator it = inventory_objects.begin();
+	LLInventoryObject::object_list_t::iterator end = inventory_objects.end();
 	for ( ; it != end; ++it)
 	{
 		// coming from a task. Need to figure out if the person can
@@ -1903,7 +1904,7 @@ BOOL move_inv_category_world_to_agent(const LLUUID& object_id,
 	if(drop && accept)
 	{
 		it = inventory_objects.begin();
-		InventoryObjectList::iterator first_it = inventory_objects.begin();
+		LLInventoryObject::object_list_t::iterator first_it = inventory_objects.begin();
 		LLMoveInv* move_inv = new LLMoveInv;
 		move_inv->mObjectID = object_id;
 		move_inv->mCategoryID = category_id;
@@ -2946,7 +2947,7 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 	{
 		if (cat_and_wear && cat_and_wear->mWear)
 		{
-			InventoryObjectList inventory_objects;
+			LLInventoryObject::object_list_t inventory_objects;
 			object->getInventoryContents(inventory_objects);
 			int contents_count = inventory_objects.size()-1; //subtract one for containing folder
 
@@ -3373,7 +3374,7 @@ LLLandmarkBridge::LLLandmarkBridge(LLInventoryPanel* inventory,
 	LLItemBridge(inventory, root, uuid)
 {
 	mVisited = FALSE;
-	if (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
+	if (flags & LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
 	{
 		mVisited = TRUE;
 	}
@@ -4013,7 +4014,7 @@ LLObjectBridge::LLObjectBridge(LLInventoryPanel* inventory,
 {
 	mAttachPt = (flags & 0xff); // low bye of inventory flags
 
-	mIsMultiObject = ( flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ?  TRUE: FALSE;
+	mIsMultiObject = ( flags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS ) ?  TRUE: FALSE;
 }
 
 LLUIImagePtr LLObjectBridge::getIcon() const
@@ -4962,7 +4963,7 @@ LLUIImagePtr LLLinkItemBridge::getIcon() const
 	if (LLViewerInventoryItem *item = getItem())
 	{
 		U32 attachment_point = (item->getFlags() & 0xff); // low byte of inventory flags
-		bool is_multi =  LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
+		bool is_multi =  LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags();
 
 		return get_item_icon(item->getActualType(), item->getInventoryType(), attachment_point, is_multi);
 	}
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 3e16dfea5f..ecb8f723e8 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -41,6 +41,7 @@
 #include "llagentwearables.h"
 #include "llcallingcard.h"
 #include "llfloaterreg.h"
+#include "llinventorydefines.h"
 #include "llsdserialize.h"
 #include "llfiltereditor.h"
 #include "llspinctrl.h"
@@ -409,7 +410,7 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
 
 static void assign_clothing_bodypart_icon(EInventoryIcon &idx, U32 attachment_point)
 {
-	const EWearableType wearable_type = EWearableType(LLInventoryItem::II_FLAGS_WEARABLES_MASK & attachment_point);
+	const EWearableType wearable_type = EWearableType(LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK & attachment_point);
 	switch(wearable_type)
 	{
 		case WT_SHAPE:
diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp
index 2a7d097f94..f4c0a842e7 100644
--- a/indra/newview/llpanelcontents.cpp
+++ b/indra/newview/llpanelcontents.cpp
@@ -40,6 +40,7 @@
 #include "llerror.h"
 #include "llfloaterreg.h"
 #include "llfontgl.h"
+#include "llinventorydefines.h"
 #include "llmaterialtable.h"
 #include "llpermissionsflags.h"
 #include "llrect.h"
@@ -180,7 +181,7 @@ void LLPanelContents::onClickNewScript(void *userdata)
 				LLTrans::getString("PanelContentsNewScript"),
 				desc,
 				LLSaleInfo::DEFAULT,
-				LLViewerInventoryItem::II_FLAGS_NONE,
+				LLInventoryItemFlags::II_FLAGS_NONE,
 				time_corrected());
 		object->saveScript(new_item, TRUE, true);
 
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 5f913d5469..8da19d1574 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -38,6 +38,7 @@
 
 #include "llinventory.h"
 #include "llviewerinventory.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llfloaterinventory.h"
@@ -329,7 +330,7 @@ void LLPanelGroupNotices::setItem(LLPointer<LLInventoryItem> inv_item)
 	mInventoryItem = inv_item;
 
 	BOOL item_is_multi = FALSE;
-	if ( inv_item->getFlags() & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+	if ( inv_item->getFlags() & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
 	{
 		item_is_multi = TRUE;
 	};
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index f70a06cde9..df74c5dd47 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -50,6 +50,7 @@
 #include "llfloaterbuycurrency.h"
 #include "llfloaterreg.h"
 #include "llinventorybridge.h"
+#include "llinventorydefines.h"
 #include "llinventoryfilter.h"
 #include "llinventoryfunctions.h"
 #include "llpreviewanim.h"
@@ -344,7 +345,7 @@ time_t LLTaskInvFVBridge::getCreationDate() const
 LLUIImagePtr LLTaskInvFVBridge::getIcon() const
 {
 	BOOL item_is_multi = FALSE;
-	if ( mFlags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+	if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
 	{
 		item_is_multi = TRUE;
 	}
@@ -1208,7 +1209,7 @@ LLTaskObjectBridge::LLTaskObjectBridge(
 LLUIImagePtr LLTaskObjectBridge::getIcon() const
 {
 	BOOL item_is_multi = FALSE;
-	if ( mFlags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
+	if ( mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS )
 	{
 		item_is_multi = TRUE;
 	}
@@ -1615,7 +1616,7 @@ void LLPanelObjectInventory::reset()
 }
 
 void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
-										InventoryObjectList* inventory,
+										LLInventoryObject::object_list_t* inventory,
 										S32 serial_num,
 										void* data)
 {
@@ -1632,7 +1633,7 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object,
 	// refresh any properties floaters that are hanging around.
 	if(inventory)
 	{
-		for (InventoryObjectList::const_iterator iter = inventory->begin();
+		for (LLInventoryObject::object_list_t::const_iterator iter = inventory->begin();
 			 iter != inventory->end(); )
 		{
 			LLInventoryObject* item = *iter++;
@@ -1665,7 +1666,7 @@ void LLPanelObjectInventory::updateInventory()
 	if (objectp)
 	{
 		LLInventoryObject* inventory_root = objectp->getInventoryRoot();
-		InventoryObjectList contents;
+		LLInventoryObject::object_list_t contents;
 		objectp->getInventoryContents(contents);
 		if (inventory_root)
 		{
@@ -1719,7 +1720,7 @@ void LLPanelObjectInventory::updateInventory()
 // leads to an N^2 based on the category count. This could be greatly
 // speeded with an efficient multimap implementation, but we don't
 // have that in our current arsenal.
-void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents)
+void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root, LLInventoryObject::object_list_t& contents)
 {
 	if (!inventory_root)
 	{
@@ -1748,7 +1749,7 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root
 
 typedef std::pair<LLInventoryObject*, LLFolderViewFolder*> obj_folder_pair;
 
-void LLPanelObjectInventory::createViewsForCategory(InventoryObjectList* inventory, 
+void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_list_t* inventory, 
 											  LLInventoryObject* parent,
 											  LLFolderViewFolder* folder)
 {
@@ -1757,8 +1758,8 @@ void LLPanelObjectInventory::createViewsForCategory(InventoryObjectList* invento
 	LLTaskInvFVBridge* bridge;
 	LLFolderViewItem* view;
 
-	InventoryObjectList::iterator it = inventory->begin();
-	InventoryObjectList::iterator end = inventory->end();
+	LLInventoryObject::object_list_t::iterator it = inventory->begin();
+	LLInventoryObject::object_list_t::iterator end = inventory->end();
 	for( ; it != end; ++it)
 	{
 		LLInventoryObject* obj = *it;
diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h
index bc339ece35..d015929841 100644
--- a/indra/newview/llpanelobjectinventory.h
+++ b/indra/newview/llpanelobjectinventory.h
@@ -82,12 +82,12 @@ public:
 protected:
 	void reset();
 	/*virtual*/ void inventoryChanged(LLViewerObject* object,
-								 InventoryObjectList* inventory,
+								 LLInventoryObject::object_list_t* inventory,
 								 S32 serial_num,
 								 void* user_data);
 	void updateInventory();
-	void createFolderViews(LLInventoryObject* inventory_root, InventoryObjectList& contents);
-	void createViewsForCategory(InventoryObjectList* inventory,
+	void createFolderViews(LLInventoryObject* inventory_root, LLInventoryObject::object_list_t& contents);
+	void createViewsForCategory(LLInventoryObject::object_list_t* inventory,
 								LLInventoryObject* parent,
 								LLFolderViewFolder* folder);
 	void clearContents();
diff --git a/indra/newview/llpreview.cpp b/indra/newview/llpreview.cpp
index d5ec3a36c3..d0db77dcbe 100644
--- a/indra/newview/llpreview.cpp
+++ b/indra/newview/llpreview.cpp
@@ -36,7 +36,7 @@
 #include "llpreview.h"
 
 #include "lllineeditor.h"
-#include "llinventory.h"
+#include "llinventorydefines.h"
 #include "llinventorymodel.h"
 #include "llresmgr.h"
 #include "lltextbox.h"
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 11cde47744..fce90e4c44 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -42,7 +42,9 @@
 #include "llstring.h"
 #include "lldir.h"
 #include "llfloaterreg.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
+#include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llmultigesture.h"
 #include "llnotificationsutil.h"
@@ -58,7 +60,6 @@
 #include "lldelayedgestureerror.h"
 #include "llfloatergesture.h" // for some label constants
 #include "llgesturemgr.h"
-#include "llinventorymodel.h"
 #include "llkeyboard.h"
 #include "lllineeditor.h"
 #include "llradiogroup.h"
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index bfd9a840f2..75702dc8e5 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -42,6 +42,7 @@
 #include "llviewerwindow.h"
 #include "llbutton.h"
 #include "llfloaterreg.h"
+#include "llinventorydefines.h"
 #include "llinventorymodel.h"
 #include "lllineeditor.h"
 #include "llnotificationsutil.h"
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 4167408fc3..6b0e524f8c 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -41,6 +41,7 @@
 #include "llcombobox.h"
 #include "lldir.h"
 #include "llfloaterreg.h"
+#include "llinventorydefines.h"
 #include "llinventorymodel.h"
 #include "llkeyboard.h"
 #include "lllineeditor.h"
@@ -1578,7 +1579,7 @@ void LLLiveLSLEditor::loadAsset()
 										  DEFAULT_SCRIPT_NAME,
 										  DEFAULT_SCRIPT_DESC,
 										  LLSaleInfo::DEFAULT,
-										  LLInventoryItem::II_FLAGS_NONE,
+										  LLInventoryItemFlags::II_FLAGS_NONE,
 										  time_corrected());
 		mAssetStatus = PREVIEW_ASSET_LOADED;
 	}
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index 0275736f6d..9b073943b4 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -40,6 +40,7 @@
 #include "llbutton.h"
 #include "llfloaterreg.h"
 #include "llgroupactions.h"
+#include "llinventorydefines.h"
 #include "llinventorymodel.h"
 #include "llinventoryobserver.h"
 #include "lllineeditor.h"
@@ -439,9 +440,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		if (item->getType() == LLAssetType::AT_OBJECT)
 		{
 			U32 flags = item->getFlags();
-			slam_perm 			= flags & LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM;
-			overwrite_everyone	= flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
-			overwrite_group		= flags & LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+			slam_perm 			= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
+			overwrite_everyone	= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+			overwrite_group		= flags & LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
 		}
 		
 		std::string perm_string;
@@ -752,7 +753,7 @@ void LLSidepanelItemInfo::onCommitPermissions()
 		if((perm.getMaskNextOwner()!=item->getPermissions().getMaskNextOwner())
 		   && (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_PERM;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_PERM;
 		}
 		// If everyone permissions have changed (and this is an object)
 		// then set the overwrite everyone permissions flag so they
@@ -760,7 +761,7 @@ void LLSidepanelItemInfo::onCommitPermissions()
 		if ((perm.getMaskEveryone()!=item->getPermissions().getMaskEveryone())
 			&& (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_EVERYONE;
 		}
 		// If group permissions have changed (and this is an object)
 		// then set the overwrite group permissions flag so they
@@ -768,7 +769,7 @@ void LLSidepanelItemInfo::onCommitPermissions()
 		if ((perm.getMaskGroup()!=item->getPermissions().getMaskGroup())
 			&& (item->getType() == LLAssetType::AT_OBJECT))
 		{
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_PERM_OVERWRITE_GROUP;
 		}
 		new_item->setFlags(flags);
 		if(mObjectID.isNull())
@@ -880,7 +881,7 @@ void LLSidepanelItemInfo::updateSaleInfo()
 		if (item->getType() == LLAssetType::AT_OBJECT)
 		{
 			U32 flags = new_item->getFlags();
-			flags |= LLInventoryItem::II_FLAGS_OBJECT_SLAM_SALE;
+			flags |= LLInventoryItemFlags::II_FLAGS_OBJECT_SLAM_SALE;
 			new_item->setFlags(flags);
 		}
 
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index 617518ab57..c977377f3a 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -50,6 +50,7 @@
 #include "llhudeffecttrail.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llmutelist.h"
 #include "llpreviewnotecard.h"
diff --git a/indra/newview/lltracker.cpp b/indra/newview/lltracker.cpp
index 9a69adae31..cc074287c4 100644
--- a/indra/newview/lltracker.cpp
+++ b/indra/newview/lltracker.cpp
@@ -39,6 +39,7 @@
 #include "llgl.h"
 #include "llrender.h"
 #include "llinventory.h"
+#include "llinventorydefines.h"
 #include "llpointer.h"
 #include "llstring.h"
 #include "lluuid.h"
@@ -742,10 +743,10 @@ void LLTracker::setLandmarkVisited()
 		LLInventoryItem* i = gInventory.getItem( mTrackedLandmarkItemID );
 		LLViewerInventoryItem* item = (LLViewerInventoryItem*)i;
 		if (   item 
-			&& !(item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED))
+			&& !(item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED))
 		{
 			U32 flags = item->getFlags();
-			flags |= LLInventoryItem::II_FLAGS_LANDMARK_VISITED;
+			flags |= LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED;
 			item->setFlags(flags);
 			LLMessageSystem* msg = gMessageSystem;
 			msg->newMessage("ChangeInventoryItemFlags");
@@ -798,7 +799,7 @@ void LLTracker::cacheLandmarkPosition()
 			mLandmarkHasBeenVisited = FALSE;
 			LLInventoryItem* item = gInventory.getItem(mTrackedLandmarkItemID);
 			if (   item 
-				&& item->getFlags()&LLInventoryItem::II_FLAGS_LANDMARK_VISITED)
+				&& item->getFlags()&LLInventoryItemFlags::II_FLAGS_LANDMARK_VISITED)
 			{
 				mLandmarkHasBeenVisited = TRUE;
 			}
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index db0d57c10c..353ffee66f 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -43,6 +43,7 @@
 #include "llfolderview.h"
 #include "llviewercontrol.h"
 #include "llconsole.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
@@ -1481,7 +1482,7 @@ EWearableType LLViewerInventoryItem::getWearableType() const
 		llwarns << "item is not a wearable" << llendl;
 		return WT_INVALID;
 	}
-	return EWearableType(getFlags() & LLInventoryItem::II_FLAGS_WEARABLES_MASK);
+	return EWearableType(getFlags() & LLInventoryItemFlags::II_FLAGS_WEARABLES_MASK);
 }
 
 
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 0277005a89..24a6b12905 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -73,6 +73,7 @@
 #include "llhudmanager.h"
 #include "llimview.h"
 #include "llinventorybridge.h"
+#include "llinventorydefines.h"
 #include "llinventoryfunctions.h"
 #include "llpanellogin.h"
 #include "llpanelblockedlist.h"
@@ -3863,15 +3864,15 @@ BOOL enable_deed_object_to_group(void*)
  * No longer able to support viewer side manipulations in this way
  *
 void god_force_inv_owner_permissive(LLViewerObject* object,
-									InventoryObjectList* inventory,
+									LLInventoryObject::object_list_t* inventory,
 									S32 serial_num,
 									void*)
 {
 	typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
 	item_array_t items;
 
-	InventoryObjectList::const_iterator inv_it = inventory->begin();
-	InventoryObjectList::const_iterator inv_end = inventory->end();
+	LLInventoryObject::object_list_t::const_iterator inv_it = inventory->begin();
+	LLInventoryObject::object_list_t::const_iterator inv_end = inventory->end();
 	for ( ; inv_it != inv_end; ++inv_it)
 	{
 		if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
@@ -6971,7 +6972,7 @@ void handle_grab_texture(void* data)
 										name,
 										LLStringUtil::null,
 										LLSaleInfo::DEFAULT,
-										LLInventoryItem::II_FLAGS_NONE,
+										LLInventoryItemFlags::II_FLAGS_NONE,
 										creation_date_now);
 
 		item->updateServer(TRUE);
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 9b39cbfdf1..598e55e2c8 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -41,6 +41,7 @@
 #include "lleventtimer.h"
 #include "llfloaterreg.h"
 #include "llfollowcamparams.h"
+#include "llinventorydefines.h"
 #include "llregionhandle.h"
 #include "llsdserialize.h"
 #include "llteleportflags.h"
@@ -5227,7 +5228,7 @@ void process_derez_container(LLMessageSystem *msg, void**)
 }
 
 void container_inventory_arrived(LLViewerObject* object,
-								 InventoryObjectList* inventory,
+								 LLInventoryObject::object_list_t* inventory,
 								 S32 serial_num,
 								 void* data)
 {
@@ -5247,8 +5248,8 @@ void container_inventory_arrived(LLViewerObject* object,
 											  LLFolderType::FT_NONE,
 											  LLTrans::getString("AcquiredItems"));
 
-		InventoryObjectList::const_iterator it = inventory->begin();
-		InventoryObjectList::const_iterator end = inventory->end();
+		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)
@@ -5284,7 +5285,7 @@ void container_inventory_arrived(LLViewerObject* object,
 	{
 		// we're going to get one fake root category as well as the
 		// one actual object
-		InventoryObjectList::iterator it = inventory->begin();
+		LLInventoryObject::object_list_t::iterator it = inventory->begin();
 
 		if ((*it)->getType() == LLAssetType::AT_CATEGORY)
 		{
diff --git a/indra/newview/llviewermessage.h b/indra/newview/llviewermessage.h
index 0ba4ac0c8d..4015cca77b 100644
--- a/indra/newview/llviewermessage.h
+++ b/indra/newview/llviewermessage.h
@@ -129,7 +129,7 @@ void process_frozen_message(LLMessageSystem* msg, void**);
 
 void process_derez_container(LLMessageSystem *msg, void**);
 void container_inventory_arrived(LLViewerObject* object,
-								 std::list<LLPointer<LLInventoryObject> >* inventory, //InventoryObjectList
+								 std::list<LLPointer<LLInventoryObject> >* inventory, //LLInventoryObject::object_list_t
 								 S32 serial_num,
 								 void* data);
 
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e6d14079c9..ee89680fea 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -46,6 +46,7 @@
 #include "llfontgl.h"
 #include "llframetimer.h"
 #include "llinventory.h"
+#include "llinventorydefines.h"
 #include "llmaterialtable.h"
 #include "llmutelist.h"
 #include "llnamevalue.h"
@@ -2177,8 +2178,8 @@ void LLViewerObject::deleteInventoryItem(const LLUUID& item_id)
 {
 	if(mInventory)
 	{
-		InventoryObjectList::iterator it = mInventory->begin();
-		InventoryObjectList::iterator end = mInventory->end();
+		LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+		LLInventoryObject::object_list_t::iterator end = mInventory->end();
 		for( ; it != end; ++it )
 		{
 			if((*it)->getUUID() == item_id)
@@ -2488,7 +2489,7 @@ void LLViewerObject::processTaskInv(LLMessageSystem* msg, void** user_data)
 		}
 		else
 		{
-			object->mInventory = new InventoryObjectList();
+			object->mInventory = new LLInventoryObject::object_list_t();
 		}
 		LLPointer<LLInventoryObject> obj;
 		obj = new LLInventoryObject(object->mID, LLUUID::null,
@@ -2544,7 +2545,7 @@ void LLViewerObject::loadTaskInvFile(const std::string& filename)
 		}
 		else
 		{
-			mInventory = new InventoryObjectList;
+			mInventory = new LLInventoryObject::object_list_t;
 		}
 		while(ifs.good())
 		{
@@ -2677,8 +2678,8 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
 	LLInventoryObject* rv = NULL;
 	if(mInventory)
 	{
-		InventoryObjectList::iterator it = mInventory->begin();
-		InventoryObjectList::iterator end = mInventory->end();
+		LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+		LLInventoryObject::object_list_t::iterator end = mInventory->end();
 		for ( ; it != end; ++it)
 		{
 			if((*it)->getUUID() == item_id)
@@ -2691,12 +2692,12 @@ LLInventoryObject* LLViewerObject::getInventoryObject(const LLUUID& item_id)
 	return rv;
 }
 
-void LLViewerObject::getInventoryContents(InventoryObjectList& objects)
+void LLViewerObject::getInventoryContents(LLInventoryObject::object_list_t& objects)
 {
 	if(mInventory)
 	{
-		InventoryObjectList::iterator it = mInventory->begin();
-		InventoryObjectList::iterator end = mInventory->end();
+		LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+		LLInventoryObject::object_list_t::iterator end = mInventory->end();
 		for( ; it != end; ++it)
 		{
 			if ((*it)->getType() != LLAssetType::AT_CATEGORY)
@@ -2726,8 +2727,8 @@ LLViewerInventoryItem* LLViewerObject::getInventoryItemByAsset(const LLUUID& ass
 	{
 		LLViewerInventoryItem* item = NULL;
 
-		InventoryObjectList::iterator it = mInventory->begin();
-		InventoryObjectList::iterator end = mInventory->end();
+		LLInventoryObject::object_list_t::iterator it = mInventory->begin();
+		LLInventoryObject::object_list_t::iterator end = mInventory->end();
 		for( ; it != end; ++it)
 		{
 			LLInventoryObject* obj = *it;
@@ -4089,8 +4090,8 @@ S32 LLViewerObject::countInventoryContents(LLAssetType::EType type)
 	S32 count = 0;
 	if( mInventory )
 	{
-		InventoryObjectList::const_iterator it = mInventory->begin();
-		InventoryObjectList::const_iterator end = mInventory->end();
+		LLInventoryObject::object_list_t::const_iterator it = mInventory->begin();
+		LLInventoryObject::object_list_t::const_iterator end = mInventory->end();
 		for(  ; it != end ; ++it )
 		{
 			if( (*it)->getType() == type )
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 266c40d493..be83fb7ef8 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -88,7 +88,7 @@ typedef enum e_object_update_type
 
 // callback typedef for inventory
 typedef void (*inventory_callback)(LLViewerObject*,
-								   InventoryObjectList*,
+								   LLInventoryObject::object_list_t*,
 								   S32 serial_num,
 								   void*);
 
@@ -409,7 +409,7 @@ public:
 	void updateInventory(LLViewerInventoryItem* item, U8 key, bool is_new);
 	void updateInventoryLocal(LLInventoryItem* item, U8 key); // Update without messaging.
 	LLInventoryObject* getInventoryObject(const LLUUID& item_id);
-	void getInventoryContents(InventoryObjectList& objects);
+	void getInventoryContents(LLInventoryObject::object_list_t& objects);
 	LLInventoryObject* getInventoryRoot();
 	LLViewerInventoryItem* getInventoryItemByAsset(const LLUUID& asset_id);
 	S16 getInventorySerial() const { return mInventorySerialNum; }
@@ -629,7 +629,7 @@ protected:
 	F32				mPixelArea; // Apparent area in pixels
 
 	// This is the object's inventory from the viewer's perspective.
-	InventoryObjectList* mInventory;
+	LLInventoryObject::object_list_t* mInventory;
 	class LLInventoryCallbackInfo
 	{
 	public:
diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp
index c9b3886fef..59efae4cb2 100644
--- a/indra/newview/llviewertexteditor.cpp
+++ b/indra/newview/llviewertexteditor.cpp
@@ -40,8 +40,8 @@
 #include "llfloaterreg.h"
 #include "llfloaterworldmap.h"
 #include "llfocusmgr.h"
-#include "llinventory.h"
 #include "llinventorybridge.h"
+#include "llinventorydefines.h"
 #include "llinventorymodel.h"
 #include "lllandmark.h"
 #include "lllandmarkactions.h"
@@ -525,7 +525,7 @@ LLUIImagePtr LLEmbeddedItems::getItemImage(llwchar ext_char) const
 			case LLAssetType::AT_SOUND:			img_name = "Inv_Sound";		break;
 			case LLAssetType::AT_CLOTHING:		img_name = "Inv_Clothing";	break;
 			case LLAssetType::AT_OBJECT:
-				img_name = LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags() ?
+				img_name = LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS & item->getFlags() ?
 					"Inv_Object_Multi" : "Inv_Object";
 				break;
 			case LLAssetType::AT_CALLINGCARD:	img_name = "Inv_CallingCard"; break;
diff --git a/indra/newview/llvoinventorylistener.h b/indra/newview/llvoinventorylistener.h
index 335e867fca..1531e6e339 100644
--- a/indra/newview/llvoinventorylistener.h
+++ b/indra/newview/llvoinventorylistener.h
@@ -42,7 +42,7 @@ class LLVOInventoryListener
 {
 public:
 	virtual void inventoryChanged(LLViewerObject* object,
-								 InventoryObjectList* inventory,
+								 LLInventoryObject::object_list_t* inventory,
 								 S32 serial_num,
 								 void* user_data) = 0;
 
-- 
cgit v1.2.3


From d13dac15505ca600caf7f780a11f9095661bc22f Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 5 Apr 2010 16:13:02 -0400
Subject: EXT-6703 : LLInventory.h cleanup and create new LLInventoryDefines

Superficial header file cleanup.

Change made to simulator files as well.
---
 indra/llinventory/llinventory.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

(limited to 'indra')

diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h
index d5a64ea441..b083e305b1 100644
--- a/indra/llinventory/llinventory.h
+++ b/indra/llinventory/llinventory.h
@@ -46,11 +46,10 @@
 class LLMessageSystem;
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// LLInventoryObject
-//   Base class for inventory objects that handles the common code between items 
-//   and categories. The 'mParentUUID' member means the parent category since all 
-//   inventory objects except each user's root category are in some category. Each 
-//   user's root category will have mParentUUID==LLUUID::null.
+// Class LLInventoryObject
+//
+//   Base class for anything in the user's inventory.   Handles the common code 
+//   between items and categories. 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryObject : public LLRefCount
 {
@@ -113,15 +112,15 @@ public:
 	//--------------------------------------------------------------------
 protected:
 	LLUUID mUUID;
-	LLUUID mParentUUID;
+	LLUUID mParentUUID; // Parent category.  Root categories have LLUUID::NULL.
 	LLAssetType::EType mType;
 	std::string mName;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-// LLInventoryItem
-//   An inventory item represents something that the current user has in
-//   his inventory.
+// Class LLInventoryItem
+//
+//   An item in the current user's inventory.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryItem : public LLInventoryObject
 {
@@ -232,9 +231,9 @@ protected:
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryCategory
-//   An instance of this class represents a category/folder of inventory
-//   items. Users come with a set of default categories, and can create
-//   new ones as needed.
+//
+//   A category/folder of inventory items. Users come with a set of default 
+//   categories, and can create new ones as needed.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 class LLInventoryCategory : public LLInventoryObject
 {
@@ -290,6 +289,7 @@ protected:
 
 //-----------------------------------------------------------------------------
 // Convertors
+//
 //   These functions convert between structured data and an inventory
 //   item, appropriate for serialization.
 //-----------------------------------------------------------------------------
-- 
cgit v1.2.3


From b49165a9ddd18ef10d00cc00382295d94691078d Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 5 Apr 2010 16:16:13 -0400
Subject: EXT-6703 : LLInventory.h cleanup and create new LLInventoryDefines

Superficial header file cleanup for LLInventoryFunctions.

Change made to simulator files as well.
---
 indra/newview/llinventoryfunctions.cpp | 43 +++++++++++++++++-----------------
 indra/newview/llinventoryobserver.h    | 35 ++++++++++++++-------------
 2 files changed, 38 insertions(+), 40 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index ecb8f723e8..8487588404 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -102,30 +102,29 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(LLInventoryItem* ite
 
 	switch(item->getType())
 	{
-	case LLAssetType::AT_CALLINGCARD:
-		// not allowed
-		break;
-		
-	case LLAssetType::AT_OBJECT:
-		if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-		{
-			allowed = true;
-		}
-		break;
-		
-	case LLAssetType::AT_BODYPART:
-	case LLAssetType::AT_CLOTHING:
-		if(!gAgentWearables.isWearingItem(item->getUUID()))
-		{
+		case LLAssetType::AT_CALLINGCARD:
+			// not allowed
+			break;
+			
+		case LLAssetType::AT_OBJECT:
+			if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
+			{
+				allowed = true;
+			}
+			break;
+			
+		case LLAssetType::AT_BODYPART:
+		case LLAssetType::AT_CLOTHING:
+			if(!gAgentWearables.isWearingItem(item->getUUID()))
+			{
+				allowed = true;
+			}
+			break;
+		default:
 			allowed = true;
-		}
-		break;
-		
-	default:
-		allowed = true;
-		break;
+			break;
 	}
-
+	
 	return allowed;
 }
 
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index 14948f4e49..aaa21a9da8 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -42,8 +42,8 @@ class LLViewerInventoryCategory;
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryObserver
 //
-// This class is designed to be a simple abstract base class which can
-// relay messages when the inventory changes.
+//   A simple abstract base class that can relay messages when the inventory 
+//   changes.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 class LLInventoryObserver
@@ -54,17 +54,17 @@ public:
 	// chaged() to see if the observer is interested in the change.
 	enum 
 	{
-		NONE = 0,
-		LABEL = 1,			// name changed
-		INTERNAL = 2,		// internal change (e.g. asset uuid different)
-		ADD = 4,			// something added
-		REMOVE = 8,			// something deleted
-		STRUCTURE = 16,		// structural change (eg item or folder moved)
-		CALLING_CARD = 32,	// (eg online, grant status, cancel)
-		GESTURE = 64,
-		REBUILD = 128, 		// item UI changed (eg item type different)
-		SORT = 256, 		// folder needs to be resorted.
-		ALL = 0xffffffff
+		NONE 			= 0,
+		LABEL 			= 1,	// Name changed
+		INTERNAL 		= 2,	// Internal change (e.g. asset uuid different)
+		ADD 			= 4,	// Something added
+		REMOVE 			= 8,	// Something deleted
+		STRUCTURE 		= 16,	// Structural change (e.g. item or folder moved)
+		CALLING_CARD 	= 32,	// Calling card change (e.g. online, grant status, cancel)
+		GESTURE 		= 64,
+		REBUILD 		= 128, 	// Item UI changed (e.g. item type different)
+		SORT 			= 256, 	// Folder needs to be resorted.
+		ALL 			= 0xffffffff
 	};
 	LLInventoryObserver();
 	virtual ~LLInventoryObserver();
@@ -75,11 +75,10 @@ public:
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLInventoryCompletionObserver
 //
-// Class which can be used as a base class for doing something when
-// when all observed items are locally complete. This class implements
-// the changed() method of LLInventoryObserver and declares a new
-// method named done() which is called when all watched items have
-// complete information in the inventory model.
+//   Base class for doing something when when all observed items are locally 
+//   complete.  Implements the changed() method of LLInventoryObserver 
+//   and declares a new method named done() which is called when all watched items 
+//   have complete information in the inventory model.
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 class LLInventoryCompletionObserver : public LLInventoryObserver
-- 
cgit v1.2.3


From 7bfa3e81e726569519e3f214c5091bf65516b7f5 Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Mon, 5 Apr 2010 16:18:19 -0400
Subject: EXT-6703 : LLInventory.h cleanup and create new LLInventoryDefines

Superficial header file cleanup.

Change made to simulator files as well.
---
 indra/llinventory/llinventory.cpp | 41 ++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 22 deletions(-)

(limited to 'indra')

diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp
index e123d255c4..2c767a4857 100644
--- a/indra/llinventory/llinventory.cpp
+++ b/indra/llinventory/llinventory.cpp
@@ -76,11 +76,10 @@ const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
 /// Class LLInventoryObject
 ///----------------------------------------------------------------------------
 
-LLInventoryObject::LLInventoryObject(
-	const LLUUID& uuid,
-	const LLUUID& parent_uuid,
-	LLAssetType::EType type,
-	const std::string& name) :
+LLInventoryObject::LLInventoryObject(const LLUUID& uuid,
+									 const LLUUID& parent_uuid,
+									 LLAssetType::EType type,
+									 const std::string& name) :
 	mUUID(uuid),
 	mParentUUID(parent_uuid),
 	mType(type),
@@ -290,18 +289,17 @@ void LLInventoryObject::updateServer(BOOL) const
 /// Class LLInventoryItem
 ///----------------------------------------------------------------------------
 
-LLInventoryItem::LLInventoryItem(
-	const LLUUID& uuid,
-	const LLUUID& parent_uuid,
-	const LLPermissions& permissions,
-	const LLUUID& asset_uuid,
-	LLAssetType::EType type,
-	LLInventoryType::EType inv_type,
-	const std::string& name, 
-	const std::string& desc,
-	const LLSaleInfo& sale_info,
-	U32 flags,
-	S32 creation_date_utc) :
+LLInventoryItem::LLInventoryItem(const LLUUID& uuid,
+								 const LLUUID& parent_uuid,
+								 const LLPermissions& permissions,
+								 const LLUUID& asset_uuid,
+								 LLAssetType::EType type,
+								 LLInventoryType::EType inv_type,
+								 const std::string& name, 
+								 const std::string& desc,
+								 const LLSaleInfo& sale_info,
+								 U32 flags,
+								 S32 creation_date_utc) :
 	LLInventoryObject(uuid, parent_uuid, type, name),
 	mPermissions(permissions),
 	mAssetUUID(asset_uuid),
@@ -1313,11 +1311,10 @@ void LLInventoryItem::unpackBinaryBucket(U8* bin_bucket, S32 bin_bucket_size)
 /// Class LLInventoryCategory
 ///----------------------------------------------------------------------------
 
-LLInventoryCategory::LLInventoryCategory(
-	const LLUUID& uuid,
-	const LLUUID& parent_uuid,
-	LLFolderType::EType preferred_type,
-	const std::string& name) :
+LLInventoryCategory::LLInventoryCategory(const LLUUID& uuid,
+										 const LLUUID& parent_uuid,
+										 LLFolderType::EType preferred_type,
+										 const std::string& name) :
 	LLInventoryObject(uuid, parent_uuid, LLAssetType::AT_CATEGORY, name),
 	mPreferredType(preferred_type)
 {
-- 
cgit v1.2.3


From 0049115e5d7b342b5c89853376186a8a1035a56a Mon Sep 17 00:00:00 2001
From: Eli Linden <eli@lindenlab.com>
Date: Mon, 5 Apr 2010 14:15:08 -0700
Subject: ES fix unlocalized sidepanel titles

---
 indra/newview/skins/default/xui/es/panel_side_tray.xml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/es/panel_side_tray.xml b/indra/newview/skins/default/xui/es/panel_side_tray.xml
index 4e9834063b..cf5afb3cd1 100644
--- a/indra/newview/skins/default/xui/es/panel_side_tray.xml
+++ b/indra/newview/skins/default/xui/es/panel_side_tray.xml
@@ -3,27 +3,27 @@
 	partially on screen to hold tab buttons. -->
 <side_tray name="sidebar">
 	<sidetray_tab description="Manejar la barra lateral." name="sidebar_openclose" tab_title="Barra lateral"/>
-	<sidetray_tab description="Base." name="sidebar_home" tab_title="Home">
-		<panel label="base" name="panel_home"/>
+	<sidetray_tab description="Inicio." name="sidebar_home" tab_title="Inicio">
+		<panel label="Inicio" name="panel_home"/>
 	</sidetray_tab>
-	<sidetray_tab description="Edita tu perfil público y tus destacados." name="sidebar_me" tab_title="My Profile">
+	<sidetray_tab description="Edita tu perfil público y tus destacados." name="sidebar_me" tab_title="Mi perfil">
 		<panel_container name="panel_container">
 			<panel label="Yo" name="panel_me"/>
 		</panel_container>
 	</sidetray_tab>
-	<sidetray_tab description="Encuentra a tus amigos, contactos y gente que esté cerca." name="sidebar_people" tab_title="People">
+	<sidetray_tab description="Encuentra a tus amigos, contactos y gente que esté cerca." name="sidebar_people" tab_title="Gente">
 		<panel_container name="panel_container">
 			<panel label="Perfil del grupo" name="panel_group_info_sidetray"/>
 			<panel label="Residentes y objetos ignorados" name="panel_block_list_sidetray"/>
 		</panel_container>
 	</sidetray_tab>
-	<sidetray_tab description="Encontrar lugares donde ir o que ya visitaste." label="Lugares" name="sidebar_places" tab_title="Places">
+	<sidetray_tab description="Encontrar lugares donde ir o que ya visitaste." label="Lugares" name="sidebar_places" tab_title="Lugares">
 		<panel label="Lugares" name="panel_places"/>
 	</sidetray_tab>
-	<sidetray_tab description="Mira tu inventario." name="sidebar_inventory" tab_title="My Inventory">
+	<sidetray_tab description="Mira tu inventario." name="sidebar_inventory" tab_title="Mi inventario">
 		<panel label="Modificar el inventario" name="sidepanel_inventory"/>
 	</sidetray_tab>
-	<sidetray_tab description="Cambia tu apariencia y tu &apos;look&apos; actual." name="sidebar_appearance" tab_title="My Appearance">
+	<sidetray_tab description="Cambia tu apariencia y tu &apos;look&apos; actual." name="sidebar_appearance" tab_title="Mi apariencia">
 		<panel label="Modificar la apariencia" name="sidepanel_appearance"/>
 	</sidetray_tab>
 </side_tray>
-- 
cgit v1.2.3


From b658e4115d137713ab55bf73f517a528deffb534 Mon Sep 17 00:00:00 2001
From: Andrew Dyukov <adyukov@productengine.com>
Date: Tue, 6 Apr 2010 16:02:14 +0300
Subject: Fixed normal bug  EXT-6464 (Buy pass from popup menu doesn't work).

- The bug was caused by deselection of parcel(because of zero ref count to parcel selection) after appearance of alert with ok/cancel.
Added setting pointer to this selection before notification appearance and nullifying pointer it after user chooses ok or cancel. Nullifying
will always take place because alert is modal, so there is no chance that LLPanelLandGeneral::cbBuyPass() won't be called.

Reviewed by Mike at https://codereview.productengine.com/secondlife/r/180/

--HG--
branch : product-engine
---
 indra/newview/llfloaterland.cpp | 5 +++++
 indra/newview/llfloaterland.h   | 5 +++++
 2 files changed, 10 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 25d3f971b5..256796aa80 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -90,6 +90,7 @@ static std::string MATURITY 		= "[MATURITY]";
 // constants used in callbacks below - syntactic sugar.
 static const BOOL BUY_GROUP_LAND = TRUE;
 static const BOOL BUY_PERSONAL_LAND = FALSE;
+LLPointer<LLParcelSelection> LLPanelLandGeneral::sSelectionForBuyPass = NULL;
 
 // Statics
 LLParcelSelectionObserver* LLFloaterLand::sObserver = NULL;
@@ -974,6 +975,8 @@ void LLPanelLandGeneral::onClickBuyPass(void* data)
 	args["PARCEL_NAME"] = parcel_name;
 	args["TIME"] = time;
 	
+	// creating pointer on selection to avoid deselection of parcel until we are done with buying pass (EXT-6464)
+	sSelectionForBuyPass = LLViewerParcelMgr::getInstance()->getParcelSelection();
 	LLNotificationsUtil::add("LandBuyPass", args, LLSD(), cbBuyPass);
 }
 
@@ -1005,6 +1008,8 @@ bool LLPanelLandGeneral::cbBuyPass(const LLSD& notification, const LLSD& respons
 		// User clicked OK
 		LLViewerParcelMgr::getInstance()->buyPass();
 	}
+	// we are done with buying pass, additional selection is no longer needed
+	sSelectionForBuyPass = NULL;
 	return false;
 }
 
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index fe80766a74..0a743e5215 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -234,6 +234,11 @@ protected:
 
 	LLSafeHandle<LLParcelSelection>&	mParcel;
 
+	// This pointer is needed to avoid parcel deselection until buying pass is completed or canceled.
+	// Deselection happened because of zero references to parcel selection, which took place when 
+	// "Buy Pass" was called from popup menu(EXT-6464)
+	static LLPointer<LLParcelSelection>	sSelectionForBuyPass;
+
 	static LLHandle<LLFloater> sBuyPassDialogHandle;
 };
 
-- 
cgit v1.2.3


From 10c97a9481142a417ea4009ea30bb51b5ba1fdf0 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Tue, 6 Apr 2010 12:27:42 +0300
Subject: Fixed normal bug EXT-6545 - Admin > God Tools > Object > Sim Name
 incorrectly reported. Using region name retrieval code. Fixed labels.

Reviewed by Mike Antipov https://codereview.productengine.com/secondlife/r/125/

--HG--
branch : product-engine
---
 indra/newview/llfloatergodtools.cpp                      | 1 +
 indra/newview/skins/default/xui/en/floater_god_tools.xml | 8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index e7b2da043f..bd07cfdfbf 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -922,6 +922,7 @@ LLPanelObjectTools::~LLPanelObjectTools()
 
 BOOL LLPanelObjectTools::postBuild()
 {
+	refresh();
 	return TRUE;
 }
 
diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml
index 240871ec25..dfe3cf4485 100644
--- a/indra/newview/skins/default/xui/en/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml
@@ -61,10 +61,10 @@
              height="10"
              layout="topleft"
              left="10"
-             name="Sim Name:"
+             name="Region Name:"
              top="12"
              width="80">
-                Sim Name:
+                Region Name:
             </text>
             <line_editor
              border_style="line"
@@ -481,10 +481,10 @@
              height="10"
              layout="topleft"
              left="10"
-             name="Sim Name:"
+             name="Region Name:"
              top="10"
              width="80">
-                Sim Name:
+                Region Name:
             </text>
             <text
              type="string"
-- 
cgit v1.2.3


From 7187f08e89ca1d10fb872070dc6381a0a926f57d Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Tue, 6 Apr 2010 15:13:15 +0100
Subject: wtf-fix for using \\ instead of // as a comment.

---
 indra/newview/tests/llviewernetwork_test.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
index f9f42cfc86..e0c7c83f4b 100644
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ b/indra/newview/tests/llviewernetwork_test.cpp
@@ -216,10 +216,10 @@ namespace tut
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Agni grid label was not modified by grid file", 
 					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
-#else \\ LL_RELEASE_FOR_DOWNLOAD
+#else // LL_RELEASE_FOR_DOWNLOAD
 		ensure_equals("Agni grid label was not modified by grid file", 
 					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));
-#endif \\ LL_RELEASE_FOR_DOWNLOAD
+#endif // LL_RELEASE_FOR_DOWNLOAD
 		
 		ensure_equals("Agni name wasn't modified by grid file",
 					  grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
-- 
cgit v1.2.3


From 785d4c34b62b7ca76b292e0001c516ba8fa738bc Mon Sep 17 00:00:00 2001
From: Loren Shih <seraph@lindenlab.com>
Date: Tue, 6 Apr 2010 10:19:15 -0400
Subject: EXT-4151 : Immediately check if a fetchObserver filter is done, else
 add to observer list automatically

Preliminary work to clean up naming conventions.
---
 indra/newview/llagentwearables.cpp                |  4 ++--
 indra/newview/llagentwearablesfetch.cpp           | 20 ++++++++---------
 indra/newview/llappearancemgr.h                   |  8 +++----
 indra/newview/llfloatergesture.cpp                |  4 ++--
 indra/newview/llfriendcard.cpp                    |  2 +-
 indra/newview/llgesturemgr.cpp                    |  2 +-
 indra/newview/llinventorybridge.cpp               | 10 ++++-----
 indra/newview/llinventorymodel.cpp                |  2 +-
 indra/newview/llinventorymodelbackgroundfetch.cpp |  2 +-
 indra/newview/llinventoryobserver.cpp             | 26 +++++++++++------------
 indra/newview/llinventoryobserver.h               |  8 +++----
 indra/newview/llpaneloutfitedit.cpp               |  2 +-
 indra/newview/llsidepanelappearance.cpp           |  2 +-
 indra/newview/llstartup.cpp                       |  2 +-
 indra/newview/lltooldraganddrop.cpp               |  8 +++----
 indra/newview/llviewerinventory.cpp               |  2 +-
 indra/newview/llviewerinventory.h                 |  2 +-
 indra/newview/llviewermenu.cpp                    |  2 +-
 indra/newview/llviewermessage.cpp                 | 12 +++++------
 19 files changed, 59 insertions(+), 61 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 0542e73bfd..9d3b5763e8 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -954,7 +954,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 		// that will trigger when the complete information is fetched.
 		uuid_vec_t folders;
 		folders.push_back(current_outfit_id);
-		outfit->fetchDescendents(folders);
+		outfit->fetch(folders);
 		if(outfit->isEverythingComplete())
 		{
 			// everything is already here - call done.
@@ -2070,7 +2070,7 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
 
 	folders.push_back(outfits->mMyOutfitsID);
 	gInventory.addObserver(outfits);
-	outfits->fetchDescendents(folders);
+	outfits->fetch(folders);
 	if (outfits->isEverythingComplete())
 	{
 		outfits->done();
diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp
index 1f22ba040d..3d6740f5a1 100644
--- a/indra/newview/llagentwearablesfetch.cpp
+++ b/indra/newview/llagentwearablesfetch.cpp
@@ -69,7 +69,7 @@ void LLInitialWearablesFetch::processContents()
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
 	LLFindWearables is_wearable;
-	gInventory.collectDescendentsIf(mCompleteFolders.front(), cat_array, wearable_array, 
+	gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array, 
 									LLInventoryModel::EXCLUDE_TRASH, is_wearable);
 
 	LLAppearanceMgr::instance().setAttachmentInvLinkEnable(true);
@@ -173,7 +173,7 @@ void LLInitialWearablesFetch::processWearablesMessage()
 
 		// Need to fetch the inventory items for ids, then create links to them after they arrive.
 		LLFetchAndLinkObserver *fetcher = new LLFetchAndLinkObserver(ids);
-		fetcher->fetchItems(ids);
+		fetcher->fetch(ids);
 		// If no items to be fetched, done will never be triggered.
 		// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
 		if (fetcher->isEverythingComplete())
@@ -282,13 +282,13 @@ void LLLibraryOutfitsFetch::folderDone()
 		mLibraryClothingID = cat->getUUID();
 	}
 
-	mCompleteFolders.clear();
+	mComplete.clear();
 	
 	// Get the complete information on the items in the inventory.
 	uuid_vec_t folders;
 	folders.push_back(mClothingID);
 	folders.push_back(mLibraryClothingID);
-	fetchDescendents(folders);
+	fetch(folders);
 	if (isEverythingComplete())
 	{
 		done();
@@ -336,9 +336,9 @@ void LLLibraryOutfitsFetch::outfitsDone()
 		mImportedClothingID = cat->getUUID();
 	}
 	
-	mCompleteFolders.clear();
+	mComplete.clear();
 	
-	fetchDescendents(folders);
+	fetch(folders);
 	if (isEverythingComplete())
 	{
 		done();
@@ -433,9 +433,9 @@ void LLLibraryOutfitsFetch::importedFolderFetch()
 	uuid_vec_t folders;
 	folders.push_back(mImportedClothingID);
 	
-	mCompleteFolders.clear();
+	mComplete.clear();
 	
-	fetchDescendents(folders);
+	fetch(folders);
 	if (isEverythingComplete())
 	{
 		done();
@@ -463,8 +463,8 @@ void LLLibraryOutfitsFetch::importedFolderDone()
 		mImportedClothingFolders.push_back(cat->getUUID());
 	}
 	
-	mCompleteFolders.clear();
-	fetchDescendents(folders);
+	mComplete.clear();
+	fetch(folders);
 	if (isEverythingComplete())
 	{
 		done();
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 423d9bde69..40b8844731 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -282,14 +282,14 @@ public:
 		// happen.
 		LLInventoryModel::cat_array_t cat_array;
 		LLInventoryModel::item_array_t item_array;
-		gInventory.collectDescendents(mCompleteFolders.front(),
+		gInventory.collectDescendents(mComplete.front(),
 									  cat_array,
 									  item_array,
 									  LLInventoryModel::EXCLUDE_TRASH);
 		S32 count = item_array.count();
 		if(!count)
 		{
-			llwarns << "Nothing fetched in category " << mCompleteFolders.front()
+			llwarns << "Nothing fetched in category " << mComplete.front()
 					<< llendl;
 			//dec_busy_count();
 			gInventory.removeObserver(this);
@@ -307,7 +307,7 @@ public:
 		gInventory.removeObserver(this);
 		
 		// do the fetch
-		stage2->fetchItems(ids);
+		stage2->fetch(ids);
 		if(stage2->isEverythingComplete())
 		{
 			// everything is already here - call done.
@@ -331,7 +331,7 @@ void callAfterCategoryFetch(const LLUUID& cat_id, T callable)
 	CallAfterCategoryFetchStage1<T> *stage1 = new CallAfterCategoryFetchStage1<T>(callable);
 	uuid_vec_t folders;
 	folders.push_back(cat_id);
-	stage1->fetchDescendents(folders);
+	stage1->fetch(folders);
 	if (stage1->isEverythingComplete())
 	{
 		stage1->done();
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 0aca12bc5e..8ee8d13a9c 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -148,7 +148,7 @@ void LLFloaterGesture::done()
 		if (!unloaded_folders.empty())
 		{
 			LL_DEBUGS("Gesture")<< "Fetching subdirectories....." << LL_ENDL;
-			fetchDescendents(unloaded_folders);
+			fetch(unloaded_folders);
 		}
 		else
 		{
@@ -202,7 +202,7 @@ BOOL LLFloaterGesture::postBuild()
 	folders.push_back(mGestureFolderID);
 	//perform loading Gesture directory anyway to make sure that all subdirectory are loaded too. See method done() for details.
 	gInventory.addObserver(this);
-	fetchDescendents(folders);
+	fetch(folders);
 
 	if (mGestureList)
 	{
diff --git a/indra/newview/llfriendcard.cpp b/indra/newview/llfriendcard.cpp
index a848128d67..6f069cca17 100644
--- a/indra/newview/llfriendcard.cpp
+++ b/indra/newview/llfriendcard.cpp
@@ -413,7 +413,7 @@ void LLFriendCardsManager::fetchAndCheckFolderDescendents(const LLUUID& folder_i
 	uuid_vec_t folders;
 	folders.push_back(folder_id);
 
-	fetch->fetchDescendents(folders);
+	fetch->fetch(folders);
 	if(fetch->isEverythingComplete())
 	{
 		// everything is already here - call done.
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index c13ebba923..a4342a4bc9 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -1033,7 +1033,7 @@ void LLGestureMgr::onLoadComplete(LLVFS *vfs,
 				// Watch this item and set gesture name when item exists in inventory
 				uuid_vec_t ids;
 				ids.push_back(item_id);
-				self.fetchItems(ids);
+				self.fetch(ids);
 			}
 			self.mActive[item_id] = gesture;
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 09168b4f31..b552b5ac07 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1974,7 +1974,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 {
 	// Avoid passing a NULL-ref as mCompleteFolders.front() down to
 	// gInventory.collectDescendents()
-	if( mCompleteFolders.empty() )
+	if( mComplete.empty() )
 	{
 		llwarns << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << llendl;
 		dec_busy_count();
@@ -1988,7 +1988,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 	// happen.
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t item_array;
-	gInventory.collectDescendents(mCompleteFolders.front(),
+	gInventory.collectDescendents(mComplete.front(),
 								  cat_array,
 								  item_array,
 								  LLInventoryModel::EXCLUDE_TRASH);
@@ -2007,7 +2007,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 #endif
 
 	LLRightClickInventoryFetchObserver* outfit;
-	outfit = new LLRightClickInventoryFetchObserver(mCompleteFolders.front(), mCopyItems);
+	outfit = new LLRightClickInventoryFetchObserver(mComplete.front(), mCopyItems);
 	uuid_vec_t ids;
 	for(S32 i = 0; i < count; ++i)
 	{
@@ -2026,7 +2026,7 @@ void LLRightClickInventoryFetchDescendentsObserver::done()
 	inc_busy_count();
 
 	// do the fetch
-	outfit->fetchItems(ids);
+	outfit->fetch(ids);
 	outfit->done();				//Not interested in waiting and this will be right 99% of the time.
 //Uncomment the following code for laggy Inventory UI.
 /*	if(outfit->isEverythingComplete())
@@ -2723,7 +2723,7 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		{
 			folders.push_back(category->getUUID());
 		}
-		fetch->fetchDescendents(folders);
+		fetch->fetch(folders);
 		inc_busy_count();
 		if(fetch->isEverythingComplete())
 		{
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b6202c6a8c..e63da1ebb9 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1326,7 +1326,7 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
 	//{
 	//	known_descendents += items->count();
 	//}
-	return cat->fetchDescendents();
+	return cat->fetch();
 }
 
 void LLInventoryModel::cache(
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp
index 72e5c0dd75..cfbc2c3e05 100644
--- a/indra/newview/llinventorymodelbackgroundfetch.cpp
+++ b/indra/newview/llinventorymodelbackgroundfetch.cpp
@@ -257,7 +257,7 @@ void LLInventoryModelBackgroundFetch::backgroundFetch()
 			{
 				// category exists but has no children yet, fetch the descendants
 				// for now, just request every time and rely on retry timer to throttle
-				if (cat->fetchDescendents())
+				if (cat->fetch())
 				{
 					mFetchTimer.reset();
 					mTimelyFetchPending = TRUE;
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 128f16ecf5..83e1bbd5a0 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -223,8 +223,7 @@ void fetch_items_from_llsd(const LLSD& items_llsd)
 	}
 }
 
-void LLInventoryFetchObserver::fetchItems(
-	const uuid_vec_t& ids)
+void LLInventoryFetchObserver::fetch(const uuid_vec_t& ids)
 {
 	LLUUID owner_id;
 	LLSD items_llsd;
@@ -266,30 +265,29 @@ void LLInventoryFetchObserver::fetchItems(
 // virtual
 void LLInventoryFetchDescendentsObserver::changed(U32 mask)
 {
-	for(uuid_vec_t::iterator it = mIncompleteFolders.begin(); it < mIncompleteFolders.end();)
+	for(uuid_vec_t::iterator it = mIncomplete.begin(); it < mIncomplete.end();)
 	{
 		LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
 		if(!cat)
 		{
-			it = mIncompleteFolders.erase(it);
+			it = mIncomplete.erase(it);
 			continue;
 		}
 		if(isComplete(cat))
 		{
-			mCompleteFolders.push_back(*it);
-			it = mIncompleteFolders.erase(it);
+			mComplete.push_back(*it);
+			it = mIncomplete.erase(it);
 			continue;
 		}
 		++it;
 	}
-	if(mIncompleteFolders.empty())
+	if(mIncomplete.empty())
 	{
 		done();
 	}
 }
 
-void LLInventoryFetchDescendentsObserver::fetchDescendents(
-	const uuid_vec_t& ids)
+void LLInventoryFetchDescendentsObserver::fetch(const uuid_vec_t& ids)
 {
 	for(uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
 	{
@@ -297,19 +295,19 @@ void LLInventoryFetchDescendentsObserver::fetchDescendents(
 		if(!cat) continue;
 		if(!isComplete(cat))
 		{
-			cat->fetchDescendents();		//blindly fetch it without seeing if anything else is fetching it.
-			mIncompleteFolders.push_back(*it);	//Add to list of things being downloaded for this observer.
+			cat->fetch();		//blindly fetch it without seeing if anything else is fetching it.
+			mIncomplete.push_back(*it);	//Add to list of things being downloaded for this observer.
 		}
 		else
 		{
-			mCompleteFolders.push_back(*it);
+			mComplete.push_back(*it);
 		}
 	}
 }
 
 bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
 {
-	return mIncompleteFolders.empty();
+	return mIncomplete.empty();
 }
 
 bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
@@ -413,7 +411,7 @@ void LLInventoryFetchComboObserver::fetch(
 		if(!cat) continue;
 		if(!gInventory.isCategoryComplete(*fit))
 		{
-			cat->fetchDescendents();
+			cat->fetch();
 			lldebugs << "fetching folder " << *fit <<llendl;
 			mIncompleteFolders.push_back(*fit);
 		}
diff --git a/indra/newview/llinventoryobserver.h b/indra/newview/llinventoryobserver.h
index aaa21a9da8..ba70552ebc 100644
--- a/indra/newview/llinventoryobserver.h
+++ b/indra/newview/llinventoryobserver.h
@@ -112,7 +112,7 @@ public:
 	virtual void changed(U32 mask);
 
 	bool isEverythingComplete() const;
-	void fetchItems(const uuid_vec_t& ids);
+	void fetch(const uuid_vec_t& ids);
 	virtual void done() {};
 
 protected:
@@ -134,14 +134,14 @@ public:
 	LLInventoryFetchDescendentsObserver() {}
 	virtual void changed(U32 mask);
 
-	void fetchDescendents(const uuid_vec_t& ids);
+	void fetch(const uuid_vec_t& ids);
 	bool isEverythingComplete() const;
 	virtual void done() = 0;
 
 protected:
 	bool isComplete(LLViewerInventoryCategory* cat);
-	uuid_vec_t mIncompleteFolders;
-	uuid_vec_t mCompleteFolders;
+	uuid_vec_t mIncomplete;
+	uuid_vec_t mComplete;
 };
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ba22adc01c..9e6a66c16b 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -480,7 +480,7 @@ void LLPanelOutfitEdit::updateLookInfo()
 		
 		uuid_vec_t folders;
 		folders.push_back(mLookID);
-		mFetchLook->fetchDescendents(folders);
+		mFetchLook->fetch(folders);
 		if (mFetchLook->isEverythingComplete())
 		{
 			mFetchLook->done();
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 89c60fed34..a11b0b44d5 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -389,7 +389,7 @@ void LLSidepanelAppearance::fetchInventory()
 	}
 
 	LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(this);
-	fetch_worn->fetchItems(ids);
+	fetch_worn->fetch(ids);
 	// If no items to be fetched, done will never be triggered.
 	// TODO: Change LLInventoryFetchObserver::fetchItems to trigger done() on this condition.
 	if (fetch_worn->isEverythingComplete())
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 4f1bcde302..d7c8b5fcd4 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -1771,7 +1771,7 @@ bool idle_startup()
 					}
 				}
 				// no need to add gesture to inventory observer, it's already made in constructor 
-				LLGestureMgr::instance().fetchItems(item_ids);
+				LLGestureMgr::instance().fetch(item_ids);
 			}
 		}
 		gDisplaySwapBuffers = TRUE;
diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp
index c977377f3a..1e81e675e6 100644
--- a/indra/newview/lltooldraganddrop.cpp
+++ b/indra/newview/lltooldraganddrop.cpp
@@ -306,8 +306,8 @@ void LLCategoryDropDescendentsObserver::done()
 {
 
 	gInventory.removeObserver(this);
-	uuid_vec_t::iterator it = mCompleteFolders.begin();
-	uuid_vec_t::iterator end = mCompleteFolders.end();
+	uuid_vec_t::iterator it = mComplete.begin();
+	uuid_vec_t::iterator end = mComplete.end();
 	LLViewerInventoryCategory::cat_array_t cats;
 	LLViewerInventoryItem::item_array_t items;
 	for(; it != end; ++it)
@@ -332,7 +332,7 @@ void LLCategoryDropDescendentsObserver::done()
 		std::copy(unique_ids.begin(), unique_ids.end(), copier);
 		LLCategoryDropObserver* dropper;
 		dropper = new LLCategoryDropObserver(mObjectID, mSource);
-		dropper->fetchItems(ids);
+		dropper->fetch(ids);
 		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
@@ -2577,7 +2577,7 @@ EAcceptance LLToolDragAndDrop::dad3dUpdateInventoryCategory(
 			ids.push_back(item->getUUID());
 		}
 		LLCategoryDropObserver* dropper = new LLCategoryDropObserver(obj->getID(), mSource);
-		dropper->fetchItems(ids);
+		dropper->fetch(ids);
 		if (dropper->isEverythingComplete())
 		{
 			dropper->done();
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 353ffee66f..444d397146 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -519,7 +519,7 @@ void LLViewerInventoryCategory::removeFromServer( void )
 	gAgent.sendReliableMessage();
 }
 
-bool LLViewerInventoryCategory::fetchDescendents()
+bool LLViewerInventoryCategory::fetch()
 {
 	if((VERSION_UNKNOWN == mVersion)
 	   && mDescendentsRequested.hasExpired())	//Expired check prevents multiple downloads.
diff --git a/indra/newview/llviewerinventory.h b/indra/newview/llviewerinventory.h
index 3577bd8791..2db88c2ff8 100644
--- a/indra/newview/llviewerinventory.h
+++ b/indra/newview/llviewerinventory.h
@@ -212,7 +212,7 @@ public:
 	void setVersion(S32 version) { mVersion = version; }
 
 	// Returns true if a fetch was issued.
-	bool fetchDescendents();
+	bool fetch();
 
 	// used to help make cacheing more robust - for example, if
 	// someone is getting 4 packets but logs out after 3. the viewer
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 24a6b12905..d91b6d0b1e 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -6158,7 +6158,7 @@ class LLAttachmentEnableDrop : public view_listener_t
 						
 						items.push_back((*attachment_iter)->getItemID());
 						
-						wornItemFetched->fetchItems(items);
+						wornItemFetched->fetch(items);
 						gInventory.addObserver(wornItemFetched);
 					}
 				}
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 598e55e2c8..a471876ce1 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1207,7 +1207,7 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 				uuid_vec_t items;
 				items.push_back(mObjectID);
 				LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(from_string);
-				open_agent_offer->fetchItems(items);
+				open_agent_offer->fetch(items);
 				if(catp || (itemp && itemp->isComplete()))
 				{
 					open_agent_offer->done();
@@ -1605,7 +1605,7 @@ void inventory_offer_handler(LLOfferInfo* info)
 		uuid_vec_t items;
 		items.push_back(info->mObjectID);
 		LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
-		fetch_item->fetchItems(items);
+		fetch_item->fetch(items);
 		if(fetch_item->isEverythingComplete())
 		{
 			fetch_item->done();
@@ -2124,7 +2124,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				uuid_vec_t items;
 				items.push_back(info->mObjectID);
 				LLInventoryFetchObserver* fetch_item = new LLInventoryFetchObserver();
-				fetch_item->fetchItems(items);
+				fetch_item->fetch(items);
 				delete fetch_item;
 
 				// Same as closing window
@@ -2855,8 +2855,8 @@ public:
 		LLInventoryModel::cat_array_t	land_cats;
 		LLInventoryModel::item_array_t	land_items;
 
-		uuid_vec_t::iterator it = mCompleteFolders.begin();
-		uuid_vec_t::iterator end = mCompleteFolders.end();
+		uuid_vec_t::iterator it = mComplete.begin();
+		uuid_vec_t::iterator end = mComplete.end();
 		for(; it != end; ++it)
 		{
 			gInventory.collectDescendentsIf(
@@ -2927,7 +2927,7 @@ BOOL LLPostTeleportNotifiers::tick()
 		if(!folders.empty())
 		{
 			LLFetchInWelcomeArea* fetcher = new LLFetchInWelcomeArea;
-			fetcher->fetchDescendents(folders);
+			fetcher->fetch(folders);
 			if(fetcher->isEverythingComplete())
 			{
 				fetcher->done();
-- 
cgit v1.2.3


From 67c534d82968fd86ed84605b8a6186e27a214c9e Mon Sep 17 00:00:00 2001
From: Paul Guslisty <pguslisty@productengine.com>
Date: Tue, 6 Apr 2010 20:28:29 +0300
Subject: Fixed major bug EXT-6572 (EXT-6572 ([VARIABLE IN WRONG PLACE] in
 Taskbar \"Kaufen L$\" should be \"L$ kaufen\")

- Removed the L$ graphic and made \"L$\" part of the label string.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/172/

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/panel_status_bar.xml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index 8c7de22cf8..c2624ce0d0 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -62,11 +62,11 @@
      halign="right"
      font="SansSerifSmall"
      follows="right|top"
-     image_selected="BuyArrow_Over"
-     image_unselected="BuyArrow_Over"
-     image_pressed="BuyArrow_Press"
+     image_selected="spacer35.tga"
+     image_unselected="spacer35.tga"
+     image_pressed="spacer35.tga"
      height="16"
-     label="Buy"
+     label="Buy L$"
      label_color="EmphasisColor"
      left_pad="0"
      label_shadow="false"
-- 
cgit v1.2.3


From 3585792e73fcccb391329bb19cf00c049adc15f6 Mon Sep 17 00:00:00 2001
From: Vadim Savchuk <vsavchuk@productengine.com>
Date: Tue, 6 Apr 2010 20:42:00 +0300
Subject: Fixed major bug EXT-6718 (Top menu: 'Build' and 'Help' items are
 absent).

Restoring comment end marker, accidentally removed in changeset 73f60e5518af.

Trivial change, not reviewed.

--HG--
branch : product-engine
---
 indra/newview/skins/default/xui/en/menu_viewer.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 8a062f867a..a5e3527833 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -376,7 +376,7 @@
              function="CheckControl"
              parameter="ShowNavbarFavoritesPanel" />
         </menu_item_check>
-        <menu_item_separator/>
+        <menu_item_separator/>-->
         <menu_item_separator/>
     <menu
          create_jump_keys="true"
-- 
cgit v1.2.3


From 37c1a92da4ee981a6cbd98e682985cdf91f9e9a6 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Tue, 6 Apr 2010 19:18:16 +0100
Subject: Resurrect 'Sun' menu options. These seem to have been clobbered by
 some bad XML merging that probably came in with 73f60e5518af / EXT-3531

---
 indra/newview/skins/default/xui/en/menu_viewer.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 8b4554502a..66ae55aab7 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -369,7 +369,7 @@
              function="CheckControl"
              parameter="ShowNavbarFavoritesPanel" />
         </menu_item_check>
-        <menu_item_separator/>
+        <menu_item_separator/>-->
         <menu_item_separator/>
     <menu
          create_jump_keys="true"
@@ -815,7 +815,7 @@
              function="ShowHelp"
              parameter="f1_help" />
         </menu_item_call>
-        <menu_item_call
+<!--        <menu_item_call
          label="Tutorial"
          name="Tutorial">
             <menu_item_call.on_click
-- 
cgit v1.2.3


From dea3e7623afa69aba983cacb0ecb84efec7ed190 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Wed, 7 Apr 2010 10:26:32 +0300
Subject: Fixed major bug EXT-6534 (Snapshot to Disk with Custom Size,
 selecting Constrain Proportions causes snapshot of the active window with a
 background to the correct size but the window the same size as original,
 instead of proportionally changing the active window size.)

* The reason: completely broken functionality to keep all the GUI controls in sync with the saved settings and Preview image state. Issue occurred while upgrading snapshot/social media floater (changeset (1acc14a5e7ac) New snapshot/social media floater)

* Fix: added disabling of floater's buttons depend on snapshot is up to date ("Share Snapshot", "Save Snapshot", "Set As Profile Pic", "Share To Web", "Email Snapshot", "Save To My Inventory", "Save To My Computer").

QA Note: other controls should be checked against necessity to disable them while changing snapshot settings.

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/181/

--HG--
branch : product-engine
---
 indra/newview/llfloatersnapshot.cpp | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index aae379afe2..cfeaede832 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1319,7 +1319,27 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
 // static
 void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
 {
+	LLSnapshotLivePreview* previewp = getPreviewView(floater);
+	if (NULL == previewp)
+	{
+		return;
+	}
+
+	// Disable buttons until Snapshot is ready. EXT-6534
+	BOOL got_snap = previewp->getSnapshotUpToDate();
+
+	// process Main buttons
+	floater->childSetEnabled("share", got_snap);
+	floater->childSetEnabled("save", got_snap);
+	floater->childSetEnabled("set_profile_pic", got_snap);
+
+	// process Share actions buttons
+	floater->childSetEnabled("share_to_web", got_snap);
+	floater->childSetEnabled("share_to_email", got_snap);
 
+	// process Save actions buttons
+	floater->childSetEnabled("save_to_inventory", got_snap);
+	floater->childSetEnabled("save_to_computer", got_snap);
 }
 
 // static
-- 
cgit v1.2.3


From bb3abe5c17c92fec08da5490c3d66b411d25eacd Mon Sep 17 00:00:00 2001
From: Alexei Arabadji <aarabadji@productengine.com>
Date: Wed, 7 Apr 2010 10:49:12 +0300
Subject: fixed EXT-5842 There is a lot of unused space in the online/offline
 toasts, - decreased on/offline notification toasts width from 305 to 220px; -
 added toast right alignment; - made toasts for long avatar names taller
 (according to max length of avatar full name(63 characters) made 3 max line
 of message text in online/offline toasts, also corrected initial geometry
 parameters of panel_online_status_toast.xml to allow method
 LLToastPanel::snapToMessageHeigh works correctly);

reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/182/

--HG--
branch : product-engine
---
 indra/newview/llnotificationtiphandler.cpp                       | 4 ++--
 indra/newview/llscreenchannel.cpp                                | 4 +++-
 indra/newview/skins/default/xui/en/panel_online_status_toast.xml | 8 ++++----
 3 files changed, 9 insertions(+), 7 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp
index 1f1afe293a..afc00bf7ef 100644
--- a/indra/newview/llnotificationtiphandler.cpp
+++ b/indra/newview/llnotificationtiphandler.cpp
@@ -71,8 +71,8 @@ public:
 				p.notification->getResponseTemplate()));
 		}
 
-		// set line max count to 2 in case of a very long name
-		snapToMessageHeight(getChild<LLTextBox>("message"), 2);
+		// set line max count to 3 in case of a very long name
+		snapToMessageHeight(getChild<LLTextBox>("message"), 3);
 	}
 };
 
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index dffb5e5e12..e9a80907b7 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -480,7 +480,9 @@ void LLScreenChannel::showToastsBottom()
 		}
 
 		toast_rect = (*it).toast->getRect();
-		toast_rect.setOriginAndSize(getRect().mLeft, bottom + toast_margin, toast_rect.getWidth() ,toast_rect.getHeight());
+		toast_rect.setOriginAndSize(getRect().mRight - toast_rect.getWidth(),
+				bottom + toast_margin, toast_rect.getWidth(),
+				toast_rect.getHeight());
 		(*it).toast->setRect(toast_rect);
 
 		if(floater && floater->overlapsScreenChannel())
diff --git a/indra/newview/skins/default/xui/en/panel_online_status_toast.xml b/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
index 14cb5fffee..b1a7697e83 100644
--- a/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
+++ b/indra/newview/skins/default/xui/en/panel_online_status_toast.xml
@@ -1,13 +1,13 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <panel
  background_visible="false"
- height="152"
+ height="40"
  label="friend_online_status"
  layout="topleft"
  left="0"
  name="friend_online_status"
  top="0"
- width="305">
+ width="220">
     <avatar_icon
 	 follows="top|left"
 	 height="18"
@@ -21,7 +21,7 @@
     <text
      font="SansSerifSmall"
      follows="all"
-     height="137"
+     height="13"
      layout="topleft"
      left_pad="5"
      name="message"
@@ -29,7 +29,7 @@
      top="15"
      use_ellipses="true"
      value=""
-     width="285"
+     width="189"
      word_wrap="true"
      max_length="350" />
 </panel>
\ No newline at end of file
-- 
cgit v1.2.3


From 05a4e9dd8bb13caadd25ef3e71aab43e9b857cd1 Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Wed, 7 Apr 2010 10:45:39 +0300
Subject: (work in progress) EXT-6564(major) - Fix wearable editing panels.
 Updated layout of all Edit Wearable panels. Disabled editing of no-modify
 wearable. Disabled "Save As" for no-copy wearable.

Reviewed by Mike Antipov https://codereview.productengine.com/secondlife/r/170/

--HG--
branch : product-engine
---
 indra/newview/llpaneleditwearable.cpp              | 21 +++++++-
 indra/newview/llpaneleditwearable.h                |  4 ++
 indra/newview/llpaneloutfitedit.cpp                | 25 ++++++---
 .../skins/default/xui/en/panel_edit_alpha.xml      | 53 ++++++++++---------
 .../skins/default/xui/en/panel_edit_eyes.xml       | 55 +++++++++++++------
 .../skins/default/xui/en/panel_edit_gloves.xml     | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_hair.xml       | 55 ++++++++++++++-----
 .../skins/default/xui/en/panel_edit_jacket.xml     | 61 +++++++++++++++-------
 .../skins/default/xui/en/panel_edit_pants.xml      | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_shape.xml      |  4 +-
 .../skins/default/xui/en/panel_edit_shirt.xml      | 47 ++++++++++++-----
 .../skins/default/xui/en/panel_edit_shoes.xml      | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_skin.xml       | 57 +++++++++++++++-----
 .../skins/default/xui/en/panel_edit_skirt.xml      | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_socks.xml      | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_tattoo.xml     | 37 +++++++------
 .../skins/default/xui/en/panel_edit_underpants.xml | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_undershirt.xml | 51 +++++++++++++-----
 .../skins/default/xui/en/panel_edit_wearable.xml   |  4 +-
 19 files changed, 556 insertions(+), 224 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index c0528da999..da74295f9e 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -270,6 +270,8 @@ LLEditWearableDictionary::SubpartEntry::SubpartEntry(ESubpart part,
 
 LLPanelEditWearable::LLPanelEditWearable()
 	: LLPanel()
+	, mWearablePtr(NULL)
+	, mWearableItem(NULL)
 {
 }
 
@@ -338,8 +340,7 @@ BOOL LLPanelEditWearable::isDirty() const
 //virtual
 void LLPanelEditWearable::draw()
 {
-	BOOL is_dirty = isDirty();
-	mBtnRevert->setEnabled(is_dirty);
+	updateVerbs();
 
 	LLPanel::draw();
 }
@@ -401,6 +402,9 @@ void LLPanelEditWearable::showWearable(LLWearable* wearable, BOOL show)
 		return;
 	}
 
+	mWearableItem = gInventory.getItem(mWearablePtr->getItemID());
+	llassert(mWearableItem);
+
 	EWearableType type = wearable->getType();
 	LLPanel *targetPanel = NULL;
 	std::string title;
@@ -489,6 +493,7 @@ void LLPanelEditWearable::initializePanel()
 
 		updateScrollingPanelUI();
 	}
+	updateVerbs();
 }
 
 void LLPanelEditWearable::updateScrollingPanelUI()
@@ -645,7 +650,19 @@ void LLPanelEditWearable::buildParamList(LLScrollingPanelList *panel_list, value
 	}
 }
 
+void LLPanelEditWearable::updateVerbs()
+{
+	bool can_copy = false;
 
+	if(mWearableItem)
+	{
+		can_copy = mWearableItem->getPermissions().allowCopyBy(gAgentID);
+	}
 
+	BOOL is_dirty = isDirty();
 
+	mBtnRevert->setEnabled(is_dirty);
+	childSetEnabled("save_as_button", is_dirty && can_copy);
+}
 
+// EOF
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 4178659617..8b63685177 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -41,6 +41,7 @@
 class LLWearable;
 class LLTextEditor;
 class LLTextBox;
+class LLViewerInventoryItem;
 class LLViewerVisualParam;
 class LLVisualParamHint;
 class LLViewerJointMesh;
@@ -73,9 +74,12 @@ private:
 	LLPanel*			getPanel(EWearableType type);
 	void				getSortedParams(value_map_t &sorted_params, const std::string &edit_group);
 	void				buildParamList(LLScrollingPanelList *panel_list, value_map_t &sorted_params, LLAccordionCtrlTab *tab);
+	// update bottom bar buttons ("Save", "Revert", etc)
+	void				updateVerbs();
 
 	// the pointer to the wearable we're editing. NULL means we're not editing a wearable.
 	LLWearable *mWearablePtr;
+	LLViewerInventoryItem* mWearableItem;
 
 	// these are constant no matter what wearable we're editing
 	LLButton *mBtnRevert;
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 1ab2100a41..b956004129 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -367,19 +367,32 @@ void LLPanelOutfitEdit::onUpClicked(void)
 void LLPanelOutfitEdit::onEditWearableClicked(void)
 {
 	LLUUID id_to_edit = mLookContents->getSelectionInterface()->getCurrentID();
-
 	LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit);
 
 	if (item_to_edit)
 	{
 		// returns null if not a wearable (attachment, etc).
 		LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID());
-		if (!wearable_to_edit || !wearable_to_edit->getPermissions().allowModifyBy(gAgent.getID()) )
-		{											 
-			LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
-			if (mEditWearableBtn->getVisible())
+		if(wearable_to_edit)
+		{
+			bool can_modify = false;
+			bool is_complete = item_to_edit->isComplete();
+			// if item_to_edit is a link, its properties are not appropriate, 
+			// lets get original item with actual properties
+			LLViewerInventoryItem* original_item = gInventory.getItem(wearable_to_edit->getItemID());
+			if(original_item)
 			{
-				mEditWearableBtn->setVisible(FALSE);
+				can_modify = original_item->getPermissions().allowModifyBy(gAgentID);
+				is_complete = original_item->isComplete();
+			}
+
+			if (can_modify && is_complete)
+			{											 
+				LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
+				if (mEditWearableBtn->getVisible())
+				{
+					mEditWearableBtn->setVisible(FALSE);
+				}
 			}
 		}
 	}
diff --git a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
index 40647e1b81..1d0c0a02b0 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_alpha.xml
@@ -1,33 +1,38 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_alpha_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
    <panel
-      border="true"
-      follows="left|top|right" 
-      height="180" 
+      border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+      follows="top|left|right"
+      height="400" 
       left="10" 
       layout="topleft" 
       name="avatar_alpha_color_panel"
       top="0"
-      width="293" >
+      width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Lower Alpha"
         layout="topleft"
-        left="10"
+        left="30"
         name="Lower Alpha"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="94" />
        <check_box
         control_name="LowerAlphaTextureInvisible"
         follows="left"
@@ -41,14 +46,14 @@
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Upper Alpha"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Upper Alpha"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="94" />
        <check_box
         control_name="UpperAlphaTextureInvisible"
         follows="left"
@@ -62,14 +67,14 @@
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Head Alpha"
         layout="topleft"
-        left_pad="10"
+        left="30"
         name="Head Alpha"
         tool_tip="Click to choose a picture"
-        top="10"
-        width="64" />
+        top="120"
+        width="94" />
        <check_box
         control_name="HeadAlphaTextureInvisible"
         follows="left"
@@ -83,14 +88,14 @@
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Eye Alpha"
         layout="topleft"
-        left="10"
+        left_pad="20"
         name="Eye Alpha"
         tool_tip="Click to choose a picture"
-        top="100"
-        width="64" />
+        top="120"
+        width="94" />
        <check_box
         control_name="Eye AlphaTextureInvisible"
         follows="left"
@@ -104,14 +109,14 @@
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Hair Alpha"
         layout="topleft"
-        left_pad="10"
+        left="30"
         name="Hair Alpha"
         tool_tip="Click to choose a picture"
-        top_delta="-4"
-        width="64" />
+        top="230"
+        width="94" />
        <check_box
         control_name="HairAlphaTextureInvisible"
         follows="left"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_eyes.xml b/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
index c514054c41..f11ef43c76 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_eyes.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_eyes_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_eye_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
              can_apply_immediately="true"
              default_image_name="Default"
@@ -23,31 +28,49 @@
              height="80"
              label="Iris"
              layout="topleft"
-             left="8"
+             left="10"
              name="Iris"
              tool_tip="Click to choose a picture"
-             top_pad="10"
+             top="10"
              width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
-		<accordion_tab
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
+        <accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="eyes_main_tab"
 			title="Eyes">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="eyes_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
index 7aca40e8d9..7d8eed5085 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_gloves_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_gloves_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="gloves_main_tab"
 			title="Gloves">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="gloves_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_hair.xml b/indra/newview/skins/default/xui/en/panel_edit_hair.xml
index e7d1c05301..cd81aa2c4f 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_hair.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_hair.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_hair_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_hair_color_panel"
 	  top="0"
-	  width="293" > 
+	  width="313" > 
             <texture_picker
              can_apply_immediately="true"
              default_image_name="Default"
@@ -23,26 +28,43 @@
              height="80"
              label="Texture"
              layout="topleft"
-             left="8"
+             left="10"
              name="Texture"
              tool_tip="Click to choose a picture"
              top="10"
              width="64" />
 	 </panel>
+   <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
    <accordion 
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="hair_color_tab"
 			title="Color">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="hair_color_param_list"
 				top="0"
@@ -50,11 +72,13 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="hair_style_tab"
 			title="Style">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="hair_style_param_list"
 				top="0"
@@ -62,11 +86,13 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="hair_eyebrows_tab"
 			title="Eyebrows">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="hair_eyebrows_param_list"
 				top="0"
@@ -74,16 +100,19 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="hair_facial_tab"
 			title="Facial">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="hair_facial_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
index ed92b1e0f8..ba03865937 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_jacket_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_jacket_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -23,11 +28,11 @@
         height="80"
         label="Upper Fabric"
         layout="topleft"
-        left="10"
+        left="25"
         name="Upper Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="74" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -35,42 +40,60 @@
         height="80"
         label="Lower Fabric"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Lower Fabric"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="74" />
        <color_swatch
         can_apply_immediately="true"
         follows="left|top"
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
-        width="64" />
+        width="74" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="jacket_main_tab"
 			title="Jacket">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="jacket_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pants.xml b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
index b764188e04..5b02d1f968 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_pants_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_pants_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+   <accordion 
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="pants_main_tab"
 			title="Pants">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="pants_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index 9a3b5c26ec..e1c574001a 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -4,7 +4,7 @@
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_shape_panel"
 	 top_pad="10"
 	 width="333" >
@@ -14,7 +14,7 @@
          bg_opaque_color="DkGray2"
          background_visible="true"
          background_opaque="true"
-		 follows="top|left"
+		 follows="top|left|right"
 		 height="50"
 		 left="10"
 		 layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
index 4b7235545f..7da8de4c0b 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_shirt_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_shirt_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
 	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
+		follows="all"
+		height ="300"
+        layout="topleft"
+		left="0"
 		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+        single_expansion="true"
+		top="0"
+		width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="shirt_main_tab"
 			title="Shirt">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="shirt_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
index e886afa010..84fe26f7f6 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_shoes_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
    <panel
-      border="true"
-      follows="left|top|right" 
-      height="100" 
+      border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+      follows="top|left|right"
+      height="90" 
       left="10" 
       layout="topleft" 
       name="avatar_shoes_color_panel"
       top="0"
-      width="293" >
+      width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+   <accordion 
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="shoes_main_tab"
 			title="Shoes">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="shoes_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skin.xml b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
index 918606b54c..b5c8c95473 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skin.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skin.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_skin_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_skin_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         allow_no_texture="true"
         can_apply_immediately="true"
@@ -24,7 +29,7 @@
         height="80"
         label="Head Tattoos"
         layout="topleft"
-        left="10"
+        left="25"
         name="Head Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
@@ -37,7 +42,7 @@
         height="80"
         label="Upper Tattoos"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Upper Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
@@ -50,26 +55,43 @@
         height="80"
         label="Lower Tattoos"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Lower Tattoos"
         tool_tip="Click to choose a picture"
         top="10"
         width="74" />
 	 </panel>
+     <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">    
 	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
+        layout="topleft"
+		follows="all"
+		height ="300"
+		left="0"
 		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+		top="0"
+        single_expansion="true"
+		width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="skin_color_tab"
 			title="Skin Color">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="skin_color_param_list"
 				top="0"
@@ -77,11 +99,13 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="skin_face_tab"
 			title="Face Detail">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="skin_face_param_list"
 				top="0"
@@ -89,11 +113,13 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="skin_makeup_tab"
 			title="Makeup">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="skin_makeup_param_list"
 				top="0"
@@ -101,16 +127,19 @@
 		</accordion_tab>
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="skin_body_tab"
 			title="Body Detail">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="skin_body_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
index 6cccab1843..16f6950bd5 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_skirt_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
    <panel
-      border="true"
-      follows="left|top|right" 
-      height="100" 
+      border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+      follows="top|left|right"
+      height="90" 
       left="10" 
       layout="topleft" 
       name="avatar_skirt_color_panel"
       top="0"
-      width="293" >
+      width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="skirt_main_tab"
 			title="Skirt">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="skirt_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_socks.xml b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
index fc7de00714..e4f916703b 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_socks_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_socks_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open color picker"
         top="10"
         width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="socks_main_tab"
 			title="Socks">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="socks_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml b/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
index b214cd3de0..ed990eb095 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_tattoo.xml
@@ -1,57 +1,62 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_tattoo_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="400" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_tattoo_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Head Tattoo"
         layout="topleft"
-        left="10"
+        left="30"
         name="Head Tattoo"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="94" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Upper Tattoo"
         layout="topleft"
-        left_pad="10"
+        left_pad="30"
         name="Upper Tattoo"
         tool_tip="Click to choose a picture"
         top="10"
-        width="64" />
+        width="94" />
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
         follows="left|top"
-        height="80"
+        height="100"
         label="Lower Tattoo"
         layout="topleft"
-        left_pad="10"
+        left="30"
         name="Lower Tattoo"
         tool_tip="Click to choose a picture"
-        top="10"
-        width="64" />
+        top_pad="10"
+        width="94" />
 	 </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
index 03e0bb70ef..d43497c943 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_underpants_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
    <panel
-      border="true"
-      follows="left|top|right" 
-      height="100" 
+      border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+      follows="top|left|right"
+      height="90" 
       left="10" 
       layout="topleft" 
       name="avatar_underpants_color_panel"
       top="0"
-      width="293" >
+      width="313" >
             <texture_picker
              can_apply_immediately="true"
              default_image_name="Default"
@@ -34,31 +39,49 @@
              height="80"
              label="Color/Tint"
              layout="topleft"
-             left_pad="10"
+             left_pad="20"
              name="Color/Tint"
              tool_tip="Click to open color picker"
              top="10"
              width="64" />
 	 </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="underpants_main_tab"
 			title="Underpants">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="underpants_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
index 20c56142fb..45c6ef4526 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
@@ -1,21 +1,26 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
  <panel
+     background_visible="true"
 	 follows="all"
 	 height="400"
 	 layout="topleft"
-	 left="10"
+	 left="0"
 	 name="edit_undershirt_panel"
 	 top_pad="10"
-	 width="313" >
+	 width="333" >
 	 <panel
-	  border="true"
-	  follows="left|top|right" 
-	  height="100" 
+	  border="false"
+      bg_alpha_color="DkGray2"
+      bg_opaque_color="DkGray2"
+      background_visible="true"
+      background_opaque="true"
+	  follows="top|left|right"
+	  height="90" 
 	  left="10" 
 	  layout="topleft" 
 	  name="avatar_undershirt_color_panel"
 	  top="0"
-	  width="293" >
+	  width="313" >
        <texture_picker
         can_apply_immediately="true"
         default_image_name="Default"
@@ -34,31 +39,49 @@
         height="80"
         label="Color/Tint"
         layout="topleft"
-        left_pad="10"
+        left_pad="20"
         name="Color/Tint"
         tool_tip="Click to open Color Picker"
         top="10"
         width="64" />
        </panel>
-	 <accordion
-		follows="left|top|right|bottom"
-		height ="340"
-		left="10"
-		name="wearable_accordion"
-		top_pad="10"
-		width="303">
+	 <panel
+         border="false"
+         bg_alpha_color="DkGray2"
+         bg_opaque_color="DkGray2"
+         background_visible="true"
+         background_opaque="true"
+         follows="all"
+         height="300"
+         layout="topleft"
+         left="10"
+         name="accordion_panel"
+         top_pad="10"
+         width="313">
+     <accordion
+        follows="all"
+        height ="300"
+        layout="topleft"
+        left="0"
+        name="wearable_accordion"
+        single_expansion="true"
+        top="0"
+        width="313">
 		<accordion_tab
 			layout="topleft"
+            fit_panel="false"
 			min_height="150"
 			name="undershirt_main_tab"
 			title="Undershirt">
 			<scrolling_panel_list
 				follows="all"
+                layout="topleft"
 				left="0"
 				name="undershirt_main_param_list"
 				top="0"
 				width="303" />
 		</accordion_tab>
 	</accordion>
+    </panel>
 </panel>
 
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index b4272bb10a..dc2f085356 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -155,7 +155,7 @@ left="0"
          bg_opaque_color="DkGray2"
          background_visible="true"
          background_opaque="true"
-         follows="top|left"
+         follows="top|left|right"
          height="60"
          label="Shirt"
          layout="topleft"
@@ -164,7 +164,7 @@ left="0"
 		 top_pad="10"
          width="313">
 		 <text
-		 follows="top|left"
+		 follows="top|left|right"
 		 height="16"
 		 layout="topleft"
 		 left="10"
-- 
cgit v1.2.3


From d4deaf6c9b631c5d59765967f6f715d2ed6eaf28 Mon Sep 17 00:00:00 2001
From: Mike Antipov <mantipov@productengine.com>
Date: Wed, 7 Apr 2010 10:54:23 +0300
Subject: Done normal task EXT-6583 ([TRUNCATION] build > select build tool >
 create tool > texture tab) * Increased spinners' "width" & "label_width"
 attribute values. Updated checkboxes & "Apply" button placement to be
 accommodated in tab.     The longest label is in 'DE' locale. * Also removed
 overrides of these widgets in 'fr' & 'it' locales

Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/183/

--HG--
branch : product-engine
---
 .../newview/skins/default/xui/en/floater_tools.xml | 30 +++++++++++-----------
 .../newview/skins/default/xui/fr/floater_tools.xml |  6 ++---
 .../newview/skins/default/xui/it/floater_tools.xml |  6 ++---
 3 files changed, 21 insertions(+), 21 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 4c67698943..cc9e72cfb5 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -2540,18 +2540,18 @@ even though the user gets a free copy.
              height="19"
              initial_value="0"
              label="Horizontal (U)"
-             label_width="90"
+             label_width="125"
              layout="topleft"
              left="20"
              max_val="100"
              name="TexScaleU"
              top_pad="6"
-             width="160" />
+             width="185" />
             <check_box
              height="19"
              label="Flip"
              layout="topleft"
-             left_pad="10"
+             left_pad="5"
              name="checkbox flip s"
              top_delta="0"
              width="70" />
@@ -2560,17 +2560,17 @@ even though the user gets a free copy.
              height="19"
              initial_value="0"
              label="Vertical (V)"
-             label_width="90"
+             label_width="125"
              layout="topleft"
              left="20"
              max_val="100"
              name="TexScaleV"
-             width="160" />
+             width="185" />
             <check_box
              height="19"
              label="Flip"
              layout="topleft"
-             left_pad="10"
+             left_pad="5"
              name="checkbox flip t"
              top_delta="0"
              width="70" />
@@ -2582,12 +2582,12 @@ even though the user gets a free copy.
              initial_value="0"
 			 label="Rotation˚"
              layout="topleft"
-			 label_width="100"
+			 label_width="135"
              left="10"
              max_val="9999"
              min_val="-9999"
              name="TexRot"
-             width="170" />
+             width="195" />
 
             <spinner
              decimal_digits="1"
@@ -2596,19 +2596,19 @@ even though the user gets a free copy.
              initial_value="1"
 			 label="Repeats / Meter"
              layout="topleft"
-			 label_width="100"
+			 label_width="135"
              left="10"
              max_val="10"
              min_val="0.1"
              name="rptctrl"
-             width="170" />
+             width="195" />
             <button
              follows="left|top"
              height="23"
              label="Apply"
              label_selected="Apply"
              layout="topleft"
-             left_pad="10"
+             left_pad="5"
              name="button apply"
              width="75" />
             <text
@@ -2627,24 +2627,24 @@ even though the user gets a free copy.
              height="19"
              initial_value="0"
              label="Horizontal (U)"
-             label_width="90"
+             label_width="125"
              layout="topleft"
              left="20"
              min_val="-1"
              name="TexOffsetU"
-             width="160" />
+             width="185" />
             <spinner
              follows="left|top"
              height="19"
              initial_value="0"
              label="Vertical (V)"
-             label_width="90"
+             label_width="125"
              layout="topleft"
              left_delta="0"
              min_val="-1"
              name="TexOffsetV"
              top_pad="1"
-             width="160" />
+             width="185" />
         <panel
          border="false"
          follows="left|top"
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index 1d9d395960..16d276f8c2 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -441,9 +441,9 @@
 			<check_box label="Inverser" name="checkbox flip s"/>
 			<spinner label="Vertical (V)" name="TexScaleV"/>
 			<check_box label="Inverser" name="checkbox flip t"/>
-			<spinner label="Rotation˚" left="122" name="TexRot" width="58"/>
-			<spinner label="Répétitions / Mètre" left="122" name="rptctrl" width="58"/>
-			<button label="Appliquer" label_selected="Appliquer" left_delta="68" name="button apply" width="75"/>
+			<spinner label="Rotation˚" name="TexRot" />
+			<spinner label="Répétitions / Mètre" name="rptctrl"/>
+			<button label="Appliquer" label_selected="Appliquer" name="button apply"/>
 			<text name="tex offset">
 				Décalage de la texture
 			</text>
diff --git a/indra/newview/skins/default/xui/it/floater_tools.xml b/indra/newview/skins/default/xui/it/floater_tools.xml
index 16ee797ce4..ab3e7aa3c9 100644
--- a/indra/newview/skins/default/xui/it/floater_tools.xml
+++ b/indra/newview/skins/default/xui/it/floater_tools.xml
@@ -443,9 +443,9 @@ della texture
 			<check_box label="Inverti" name="checkbox flip s"/>
 			<spinner label="Verticale (V)" name="TexScaleV"/>
 			<check_box label="Inverti" name="checkbox flip t"/>
-			<spinner label="Rotazione˚" left="120" name="TexRot" width="60"/>
-			<spinner label="Ripetizioni / Metro" left="120" name="rptctrl" width="60"/>
-			<button label="Applica" label_selected="Applica" left_delta="72" name="button apply"/>
+			<spinner label="Rotazione˚" name="TexRot" />
+			<spinner label="Ripetizioni / Metro" name="rptctrl" />
+			<button label="Applica" label_selected="Applica" name="button apply"/>
 			<text name="tex offset">
 				Bilanciamento della texture
 			</text>
-- 
cgit v1.2.3


From 0bb3f144c0a6712a269246975635962b3b5f48d0 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Wed, 7 Apr 2010 10:37:07 +0100
Subject: Backed out changeset 63b699f90efd

---
 indra/llcommon/lluri.cpp                           |    3 +-
 indra/llcommon/lluuid.cpp                          |  162 +-
 indra/llmessage/llcurl.cpp                         |   29 +-
 indra/llmessage/llcurl.h                           |   12 +-
 indra/llmessage/llhttpclient.cpp                   |   16 +-
 indra/llmessage/llhttpclient.h                     |   11 +-
 indra/llmessage/llurlrequest.cpp                   |   51 +-
 indra/llmessage/llurlrequest.h                     |   68 +-
 indra/llui/llurlentry.cpp                          |   29 +-
 indra/llui/tests/llurlentry_test.cpp               |   26 +-
 indra/llvfs/lldir.cpp                              |   39 +-
 indra/llvfs/lldir.h                                |    4 +-
 indra/newview/CMakeLists.txt                       |   55 +-
 indra/newview/Info-SecondLife.plist                |   28 -
 indra/newview/app_settings/settings.xml            |  115 +-
 .../installers/windows/installer_template.nsi      |    6 -
 indra/newview/llagent.cpp                          |    4 +-
 indra/newview/llagent.h                            |    5 +-
 indra/newview/llagentlistener.cpp                  |    5 +-
 indra/newview/llagentui.cpp                        |   17 +-
 indra/newview/llagentui.h                          |    4 +-
 indra/newview/llappviewer.cpp                      |  124 +-
 indra/newview/llappviewer.h                        |    1 +
 indra/newview/llappviewerlinux.cpp                 |    2 +-
 indra/newview/llappviewermacosx.cpp                |    1 +
 indra/newview/llavataractions.cpp                  |    2 +-
 indra/newview/llbottomtray.cpp                     |    4 +-
 indra/newview/llcallfloater.cpp                    |   33 +-
 indra/newview/llcallingcard.cpp                    |    1 -
 indra/newview/llchathistory.cpp                    |   15 +-
 indra/newview/llcurrencyuimanager.cpp              |    2 +-
 indra/newview/llfloaterabout.cpp                   |   14 +-
 indra/newview/llfloaterbuyland.cpp                 |    4 +-
 indra/newview/llfloaterchat.cpp                    |    2 +-
 indra/newview/llfloaterchatterbox.cpp              |    2 +-
 indra/newview/llfloaterevent.cpp                   |    2 +-
 indra/newview/llfloaterland.cpp                    |   11 +-
 indra/newview/llfloaterpreference.cpp              |    4 +-
 indra/newview/llfloaterregioninfo.cpp              |    3 +-
 indra/newview/llfloaterreporter.cpp                |   12 +-
 indra/newview/llfloatersnapshot.cpp                |    2 +-
 indra/newview/llfloatervoicedevicesettings.cpp     |   41 +-
 indra/newview/llfloaterworldmap.cpp                |   23 +-
 indra/newview/llfloaterworldmap.h                  |    3 +-
 indra/newview/llgrouplist.cpp                      |    2 +-
 indra/newview/llimfloater.cpp                      |    1 +
 indra/newview/llimpanel.cpp                        |   14 +-
 indra/newview/llimview.cpp                         |   27 +-
 indra/newview/llinspectavatar.cpp                  |    8 +-
 indra/newview/llinspectobject.cpp                  |    6 +-
 indra/newview/llinspectremoteobject.cpp            |    4 +-
 indra/newview/llinventorymodel.cpp                 |    1 +
 indra/newview/lllandmarkactions.cpp                |    4 +-
 indra/newview/lllocationinputctrl.cpp              |    9 +-
 indra/newview/llloginhandler.cpp                   |  200 +-
 indra/newview/llloginhandler.h                     |   11 +-
 indra/newview/lllogininstance.cpp                  |   77 +-
 indra/newview/lllogininstance.h                    |    7 +-
 indra/newview/llnavigationbar.cpp                  |   34 +-
 indra/newview/lloutputmonitorctrl.cpp              |    8 +-
 indra/newview/lloutputmonitorctrl.h                |    2 +-
 indra/newview/lloverlaybar.cpp                     |    2 +-
 indra/newview/llpanelavatar.cpp                    |    8 +-
 indra/newview/llpanelgroup.cpp                     |    4 +-
 indra/newview/llpanelimcontrolpanel.cpp            |    5 +-
 indra/newview/llpanellogin.cpp                     |  542 +-
 indra/newview/llpanellogin.h                       |   29 +-
 indra/newview/llpanelpeople.cpp                    |    4 +-
 indra/newview/llpanelplacestab.cpp                 |    5 +-
 indra/newview/llparticipantlist.cpp                |    3 +-
 indra/newview/llsecapi.cpp                         |  161 -
 indra/newview/llsecapi.h                           |  493 --
 indra/newview/llsechandler_basic.cpp               | 1586 -----
 indra/newview/llsechandler_basic.h                 |  285 -
 indra/newview/llselectmgr.cpp                      |    8 +-
 indra/newview/llslurl.cpp                          |  514 +-
 indra/newview/llslurl.h                            |  159 +-
 indra/newview/llspeakbutton.cpp                    |   10 +-
 indra/newview/llspeakers.cpp                       |   40 +-
 indra/newview/llspeakingindicatormanager.cpp       |    4 +-
 indra/newview/llstartup.cpp                        |  722 +-
 indra/newview/llstartup.h                          |   17 +-
 indra/newview/llstylemap.cpp                       |    2 +-
 indra/newview/llurl.cpp                            |    6 -
 indra/newview/llurl.h                              |    1 -
 indra/newview/llurldispatcher.cpp                  |  201 +-
 indra/newview/llurldispatcher.h                    |   19 +-
 indra/newview/llurllineeditorctrl.cpp              |    2 +-
 indra/newview/llvieweraudio.cpp                    |   10 +-
 indra/newview/llviewercontrol.cpp                  |    6 +-
 indra/newview/llviewerinventory.cpp                |   13 +-
 indra/newview/llviewermenu.cpp                     |   16 +-
 indra/newview/llviewermessage.cpp                  |   23 +-
 indra/newview/llviewernetwork.cpp                  |  694 +-
 indra/newview/llviewernetwork.h                    |  182 +-
 indra/newview/llviewerobject.cpp                   |   12 +-
 indra/newview/llviewerstats.cpp                    |    6 +-
 indra/newview/llviewerwindow.cpp                   |   33 +-
 indra/newview/llvoavatar.cpp                       |   12 +-
 indra/newview/llvoicechannel.cpp                   |   64 +-
 indra/newview/llvoicechannel.h                     |    3 +-
 indra/newview/llvoiceclient.cpp                    | 7422 ++++++++++++++++++--
 indra/newview/llvoiceclient.h                      | 1022 ++-
 indra/newview/llvoicevivox.cpp                     | 6967 ------------------
 indra/newview/llvoicevivox.h                       |  914 ---
 indra/newview/llweb.cpp                            |    2 +-
 indra/newview/llworld.cpp                          |    3 +-
 indra/newview/llxmlrpclistener.cpp                 |   18 +-
 indra/newview/llxmlrpctransaction.cpp              |  106 +-
 indra/newview/llxmlrpctransaction.h                |    3 -
 .../newview/skins/default/xui/en/floater_about.xml |    2 +-
 .../newview/skins/default/xui/en/notifications.xml |   63 -
 indra/newview/skins/default/xui/en/panel_login.xml |   88 +-
 indra/newview/skins/default/xui/en/strings.xml     |    9 -
 indra/newview/tests/lllogininstance_test.cpp       |  115 +-
 indra/newview/tests/llsecapi_test.cpp              |  188 -
 indra/newview/tests/llsechandler_basic_test.cpp    |  964 ---
 indra/newview/tests/llslurl_test.cpp               |  258 -
 indra/newview/tests/llviewernetwork_test.cpp       |  486 --
 indra/newview/viewer_manifest.py                   |   17 -
 indra/viewer_components/login/lllogin.cpp          |   43 +-
 121 files changed, 9689 insertions(+), 16319 deletions(-)
 delete mode 100644 indra/newview/llsecapi.cpp
 delete mode 100644 indra/newview/llsecapi.h
 delete mode 100644 indra/newview/llsechandler_basic.cpp
 delete mode 100644 indra/newview/llsechandler_basic.h
 delete mode 100644 indra/newview/llvoicevivox.cpp
 delete mode 100644 indra/newview/llvoicevivox.h
 delete mode 100644 indra/newview/tests/llsecapi_test.cpp
 delete mode 100644 indra/newview/tests/llsechandler_basic_test.cpp
 delete mode 100644 indra/newview/tests/llslurl_test.cpp
 delete mode 100644 indra/newview/tests/llviewernetwork_test.cpp

(limited to 'indra')

diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index 0e8f3f0f73..9d4f3a98f0 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -231,8 +231,7 @@ static BOOL isDefault(const std::string& scheme, U16 port)
 void LLURI::parseAuthorityAndPathUsingOpaque()
 {
 	if (mScheme == "http" || mScheme == "https" ||
-		mScheme == "ftp" || mScheme == "secondlife" || 
-		mScheme == "x-grid-location-info")
+		mScheme == "ftp" || mScheme == "secondlife" )
 	{
 		if (mEscapedOpaque.substr(0,2) != "//")
 		{
diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp
index 583c1e589b..bcbae06ec5 100644
--- a/indra/llcommon/lluuid.cpp
+++ b/indra/llcommon/lluuid.cpp
@@ -33,12 +33,9 @@
 
 // We can't use WIN32_LEAN_AND_MEAN here, needs lots of includes.
 #if LL_WINDOWS
-#undef WIN32_LEAN_AND_MEAN
-#include <winsock2.h>
-#include <windows.h>
-// ugh, this is ugly.  We need to straighten out our linking for this library
-#pragma comment(lib, "IPHLPAPI.lib")
-#include <iphlpapi.h>
+#	undef WIN32_LEAN_AND_MEAN
+#	include <winsock2.h>
+#	include <windows.h>
 #endif
 
 #include "lldefs.h"
@@ -455,102 +452,67 @@ static void get_random_bytes(void *buf, int nbytes)
 	return;	
 }
 
-#if	LL_WINDOWS
-// Code	copied from	http://msdn.microsoft.com/en-us/library/aa365939(VS.85).aspx
-// This	code grabs the first hardware	address, rather	than the first interface.
-// Using a VPN can cause the first returned	interface	to be	changed.
-
-const	S32	MAC_ADDRESS_BYTES=6;
-
-
-// static
-S32	LLUUID::getNodeID(unsigned char	*node_id)
+#if LL_WINDOWS
+typedef struct _ASTAT_
 {
+	ADAPTER_STATUS adapt;
+	NAME_BUFFER    NameBuff [30];
+}ASTAT, * PASTAT;
 
-	// Declare and initialize variables.
-	DWORD	dwSize = 0;
-	DWORD	dwRetVal = 0;
-	int	i;
-
-/* variables used	for	GetIfTable and GetIfEntry	*/
-	MIB_IFTABLE	*pIfTable;
-	MIB_IFROW	*pIfRow;
-
-	// Allocate	memory for our pointers.
-	pIfTable = (MIB_IFTABLE	*) malloc(sizeof (MIB_IFTABLE));
-	if (pIfTable ==	NULL)	
-	{
-			printf("Error allocating memory needed to call GetIfTable\n");
-			return 0;
-	}
-
-	// Before	calling	GetIfEntry,	we call	GetIfTable to	make
-	// sure	there	are	entries	to get and retrieve	the	interface	index.
-
-	// Make	an initial call	to GetIfTable	to get the
-	// necessary size	into dwSize
-	if (GetIfTable(pIfTable, &dwSize,	0) ==	ERROR_INSUFFICIENT_BUFFER) {
-			free(pIfTable);
-			pIfTable = (MIB_IFTABLE	*) malloc(dwSize);
-			if (pIfTable ==	NULL)	
-			{
-					printf("Error	allocating memory\n");
-					return 0;
-			}
-	}
-	//	Make a second	call to	GetIfTable to	get	the	actual
-	// data	we want.
-	if ((dwRetVal = GetIfTable(pIfTable, &dwSize,	0))	== NO_ERROR) 
-	{
-		if (pIfTable->dwNumEntries > 0)	
-		{
-			pIfRow = (MIB_IFROW	*) malloc(sizeof (MIB_IFROW));
-			if (pIfRow ==	NULL)	
-			{
-					printf("Error allocating memory\n");
-					if (pIfTable != NULL)	
-					{
-						free(pIfTable);
-						pIfTable = NULL;
-					}
-					return 0;
-			}
-
-			int	limit	=	MAC_ADDRESS_BYTES;
-			memcpy(node_id,	"\0\0\0\0\0\0",	limit);	// zero	out	array	of bytes	 
-			for	(i = 0;	i < (int) pIfTable->dwNumEntries; i++) 
-			{
-				pIfRow->dwIndex	= pIfTable->table[i].dwIndex;
-				if ((dwRetVal = GetIfEntry(pIfRow)) == NO_ERROR) 
-				{
-					switch (pIfRow->dwType)	
-					{
-						case IF_TYPE_ETHERNET_CSMACD:
-						case IF_TYPE_IEEE80211:		 
-							 limit = min((int) pIfRow->dwPhysAddrLen, limit);
-							 if	(pIfRow->dwPhysAddrLen == 0)
-									 break;
-							 memcpy(node_id, (UCHAR *)&pIfRow->bPhysAddr[0], limit);		 //	just incase	the	PhysAddr is	not	the	expected MAC_Address size
-							 free(pIfTable);
-							 return 1;	//return first hardware	device found.	
-							break;
-
-						case IF_TYPE_OTHER:
-						case IF_TYPE_PPP:										 
-						case IF_TYPE_SOFTWARE_LOOPBACK:										 
-						case IF_TYPE_ISO88025_TOKENRING:										
-						case IF_TYPE_IEEE1394:																		
-						case IF_TYPE_ATM:										 
-						case IF_TYPE_TUNNEL:										
-								default:
-									break;
-					}
-				}
-			}
-		}
-	}
-	free(pIfTable);
-	return 0;
+// static
+S32 LLUUID::getNodeID(unsigned char * node_id)
+{
+	  ASTAT Adapter;
+      NCB Ncb;
+      UCHAR uRetCode;
+      LANA_ENUM   lenum;
+      int      i;
+	  int retval = 0;
+
+      memset( &Ncb, 0, sizeof(Ncb) );
+      Ncb.ncb_command = NCBENUM;
+      Ncb.ncb_buffer = (UCHAR *)&lenum;
+      Ncb.ncb_length = sizeof(lenum);
+      uRetCode = Netbios( &Ncb );
+ //     printf( "The NCBENUM return code is: 0x%x \n", uRetCode );
+
+      for(i=0; i < lenum.length ;i++)
+      {
+          memset( &Ncb, 0, sizeof(Ncb) );
+          Ncb.ncb_command = NCBRESET;
+          Ncb.ncb_lana_num = lenum.lana[i];
+
+          uRetCode = Netbios( &Ncb );
+ //         printf( "The NCBRESET on LANA %d return code is: 0x%x \n",
+ //                 lenum.lana[i], uRetCode );
+
+          memset( &Ncb, 0, sizeof (Ncb) );
+          Ncb.ncb_command = NCBASTAT;
+          Ncb.ncb_lana_num = lenum.lana[i];
+
+          strcpy( (char *)Ncb.ncb_callname,  "*              " );		/* Flawfinder: ignore */
+          Ncb.ncb_buffer = (unsigned char *)&Adapter;
+          Ncb.ncb_length = sizeof(Adapter);
+
+          uRetCode = Netbios( &Ncb );
+//          printf( "The NCBASTAT on LANA %d return code is: 0x%x \n",
+//                 lenum.lana[i], uRetCode );
+          if ( uRetCode == 0 )
+          {
+//            printf( "The Ethernet Number on LANA %d is: %02x%02x%02x%02x%02x%02x\n",
+//	 			  lenum.lana[i],
+//                  Adapter.adapt.adapter_address[0],
+//                  Adapter.adapt.adapter_address[1],
+//                  Adapter.adapt.adapter_address[2],
+//                  Adapter.adapt.adapter_address[3],
+//                  Adapter.adapt.adapter_address[4],
+//                  Adapter.adapt.adapter_address[5] );
+			memcpy(node_id,Adapter.adapt.adapter_address,6);		/* Flawfinder: ignore */
+			retval = 1;
+
+          }
+	  }
+	return retval;
 }
 
 #elif LL_DARWIN
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 91e11b8c0d..024e17a777 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -89,6 +89,10 @@ S32 gCurlMultiCount = 0;
 std::vector<LLMutex*> LLCurl::sSSLMutex;
 std::string LLCurl::sCAPath;
 std::string LLCurl::sCAFile;
+// Verify SSL certificates by default (matches libcurl default). The ability
+// to alter this flag is only to allow us to suppress verification if it's
+// broken for some reason.
+bool LLCurl::sSSLVerify = true;
 
 //static
 void LLCurl::setCAPath(const std::string& path)
@@ -102,6 +106,18 @@ void LLCurl::setCAFile(const std::string& file)
 	sCAFile = file;
 }
 
+//static
+void LLCurl::setSSLVerify(bool verify)
+{
+	sSSLVerify = verify;
+}
+
+//static
+bool LLCurl::getSSLVerify()
+{
+	return sSSLVerify;
+}
+
 //static
 std::string LLCurl::getVersionString()
 {
@@ -465,7 +481,8 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 	setErrorBuffer();
 	setCA();
 
-	setopt(CURLOPT_SSL_VERIFYPEER, true);
+	setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
+	setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify()? 2 : 0);
 	setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);
 
 	setoptString(CURLOPT_URL, url);
@@ -895,15 +912,6 @@ void LLCurlEasyRequest::setReadCallback(curl_read_callback callback, void* userd
 	}
 }
 
-void LLCurlEasyRequest::setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata)
-{
-	if (mEasy)
-	{
-		mEasy->setopt(CURLOPT_SSL_CTX_FUNCTION, (void*)callback);
-		mEasy->setopt(CURLOPT_SSL_CTX_DATA, userdata);
-	}
-}
-
 void LLCurlEasyRequest::slist_append(const char* str)
 {
 	if (mEasy)
@@ -1053,4 +1061,3 @@ void LLCurl::cleanupClass()
 #endif
 	curl_global_cleanup();
 }
-
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index b6a637ae5b..caf02cccd9 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -157,6 +157,16 @@ public:
 	 */
 	static const std::string& getCAPath() { return sCAPath; }
 
+	/**
+	 * @ brief Set flag controlling whether to verify HTTPS certs.
+	 */
+	static void setSSLVerify(bool verify);
+
+	/**
+	 * @ brief Get flag controlling whether to verify HTTPS certs.
+	 */
+	static bool getSSLVerify();
+
 	/**
 	 * @ brief Initialize LLCurl class
 	 */
@@ -182,6 +192,7 @@ public:
 private:
 	static std::string sCAPath;
 	static std::string sCAFile;
+	static bool sSSLVerify;
 };
 
 namespace boost
@@ -229,7 +240,6 @@ public:
 	void setHeaderCallback(curl_header_callback callback, void* userdata);
 	void setWriteCallback(curl_write_callback callback, void* userdata);
 	void setReadCallback(curl_read_callback callback, void* userdata);
-	void setSSLCtxCallback(curl_ssl_ctx_callback callback, void* userdata);
 	void slist_append(const char* str);
 	void sendRequest(const std::string& url);
 	void requestComplete();
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 345b76d1a1..dd56e18caf 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -31,7 +31,7 @@
  */
 
 #include "linden_common.h"
-#include <openssl/x509_vfy.h>
+
 #include "llhttpclient.h"
 
 #include "llassetstorage.h"
@@ -46,10 +46,7 @@
 #include "message.h"
 #include <curl/curl.h>
 
-
 const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
-LLURLRequest::SSLCertVerifyCallback LLHTTPClient::mCertVerifyCallback = NULL;
-
 ////////////////////////////////////////////////////////////////////////////
 
 // Responder class moved to LLCurl
@@ -209,19 +206,13 @@ namespace
 	LLPumpIO* theClientPump = NULL;
 }
 
-void LLHTTPClient::setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback)
-{
-	LLHTTPClient::mCertVerifyCallback = callback;
-}
-
 static void request(
 	const std::string& url,
 	LLURLRequest::ERequestAction method,
 	Injector* body_injector,
 	LLCurl::ResponderPtr responder,
 	const F32 timeout = HTTP_REQUEST_EXPIRY_SECS,
-	const LLSD& headers = LLSD()
-    )
+	const LLSD& headers = LLSD())
 {
 	if (!LLHTTPClient::hasPump())
 	{
@@ -231,7 +222,7 @@ static void request(
 	LLPumpIO::chain_t chain;
 
 	LLURLRequest* req = new LLURLRequest(method, url);
-	req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req);
+	req->checkRootCertificate(LLCurl::getSSLVerify());
 
 	
 	lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
@@ -426,6 +417,7 @@ static LLSD blocking_request(
 	std::string body_str;
 	
 	// other request method checks root cert first, we skip?
+	//req->checkRootCertificate(true);
 	
 	// * Set curl handle options
 	curl_easy_setopt(curlp, CURLOPT_NOSIGNAL, 1);	// don't use SIGALRM for timeouts
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 8afbc9e0fc..3d0646e5fe 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -40,8 +40,7 @@
 #include <string>
 
 #include <boost/intrusive_ptr.hpp>
-#include <openssl/x509_vfy.h>
-#include "llurlrequest.h"
+
 #include "llassettype.h"
 #include "llcurl.h"
 #include "lliopipe.h"
@@ -62,7 +61,6 @@ public:
 	typedef LLCurl::Responder Responder;
 	typedef LLCurl::ResponderPtr ResponderPtr;
 
-	
 	/** @name non-blocking API */
 	//@{
 	static void head(
@@ -157,12 +155,7 @@ public:
 	static void setPump(LLPumpIO& pump);
 		///< must be called before any of the above calls are made
 	static bool hasPump();
-
-	static void setCertVerifyCallback(LLURLRequest::SSLCertVerifyCallback callback);
-	static  LLURLRequest::SSLCertVerifyCallback getCertVerifyCallback() { return mCertVerifyCallback; }
-
-protected:
-	static LLURLRequest::SSLCertVerifyCallback mCertVerifyCallback;
+		///< for testing
 };
 
 #endif // LL_LLHTTPCLIENT_H
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 1e76d10828..4e7ceff984 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -36,8 +36,7 @@
 #include "llurlrequest.h"
 
 #include <algorithm>
-#include <openssl/x509_vfy.h>
-#include <openssl/ssl.h>
+
 #include "llcurl.h"
 #include "llioutil.h"
 #include "llmemtype.h"
@@ -57,8 +56,6 @@ const std::string CONTEXT_TRANSFERED_BYTES("transfered_bytes");
 
 static size_t headerCallback(void* data, size_t size, size_t nmemb, void* user);
 
-
-
 /**
  * class LLURLRequestDetail
  */
@@ -75,7 +72,6 @@ public:
 	U32 mBodyLimit;
 	S32 mByteAccumulator;
 	bool mIsBodyLimitSet;
-	LLURLRequest::SSLCertVerifyCallback mSSLVerifyCallback;
 };
 
 LLURLRequestDetail::LLURLRequestDetail() :
@@ -84,8 +80,7 @@ LLURLRequestDetail::LLURLRequestDetail() :
 	mLastRead(NULL),
 	mBodyLimit(0),
 	mByteAccumulator(0),
-	mIsBodyLimitSet(false),
-    mSSLVerifyCallback(NULL)
+	mIsBodyLimitSet(false)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
 	mCurlRequest = new LLCurlEasyRequest();
@@ -99,36 +94,6 @@ LLURLRequestDetail::~LLURLRequestDetail()
 	mLastRead = NULL;
 }
 
-void LLURLRequest::setSSLVerifyCallback(SSLCertVerifyCallback callback, void *param)
-{
-	mDetail->mSSLVerifyCallback = callback;
-	mDetail->mCurlRequest->setSSLCtxCallback(LLURLRequest::_sslCtxCallback, (void *)this);
-	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, true);
-	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, 2);	
-}
-
-
-// _sslCtxFunction
-// Callback function called when an SSL Context is created via CURL
-// used to configure the context for custom cert validation
-
-CURLcode LLURLRequest::_sslCtxCallback(CURL * curl, void *sslctx, void *param)
-{	
-	LLURLRequest *req = (LLURLRequest *)param;
-	if(req == NULL || req->mDetail->mSSLVerifyCallback == NULL)
-	{
-		SSL_CTX_set_cert_verify_callback((SSL_CTX *)sslctx, NULL, NULL);
-		return CURLE_OK;
-	}
-	SSL_CTX * ctx = (SSL_CTX *) sslctx;
-	// disable any default verification for server certs
-	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
-	// set the verification callback.
-	SSL_CTX_set_cert_verify_callback(ctx, req->mDetail->mSSLVerifyCallback, (void *)req);
-	// the calls are void
-	return CURLE_OK;
-	
-}
 
 /**
  * class LLURLRequest
@@ -183,11 +148,6 @@ void LLURLRequest::setURL(const std::string& url)
 	mDetail->mURL = url;
 }
 
-std::string LLURLRequest::getURL() const
-{
-	return mDetail->mURL;
-}
-
 void LLURLRequest::addHeader(const char* header)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
@@ -200,6 +160,13 @@ void LLURLRequest::setBodyLimit(U32 size)
 	mDetail->mIsBodyLimitSet = true;
 }
 
+void LLURLRequest::checkRootCertificate(bool check)
+{
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE));
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, (check? 2 : 0));
+	mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
+}
+
 void LLURLRequest::setCallback(LLURLRequestComplete* callback)
 {
 	LLMemType m1(LLMemType::MTYPE_IO_URL_REQUEST);
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index 69fd22e592..cb3c466440 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -44,8 +44,6 @@
 #include "lliopipe.h"
 #include "llchainio.h"
 #include "llerror.h"
-#include <openssl/x509_vfy.h>
-#include "llcurl.h"
 
 
 extern const std::string CONTEXT_REQUEST;
@@ -74,8 +72,6 @@ class LLURLRequest : public LLIOPipe
 {
 	LOG_CLASS(LLURLRequest);
 public:
-
-	typedef int (* SSLCertVerifyCallback)(X509_STORE_CTX *ctx, void *param);
 	/** 
 	 * @brief This enumeration is for specifying the type of request.
 	 */
@@ -129,7 +125,7 @@ public:
 	 * 
 	 */
 	void setURL(const std::string& url);
-	std::string getURL() const;
+
 	/** 
 	 * @brief Add a header to the http post.
 	 *
@@ -147,9 +143,8 @@ public:
 	 * Set whether request will check that remote server
 	 * certificates are signed by a known root CA when using HTTPS.
 	 */
-	void setSSLVerifyCallback(SSLCertVerifyCallback callback, void * param);
+	void checkRootCertificate(bool check);
 
-	
 	/**
 	 * @brief Return at most size bytes of body.
 	 *
@@ -194,7 +189,6 @@ public:
 	 * @brief Give this pipe a chance to handle a generated error
 	 */
 	virtual EStatus handleError(EStatus status, LLPumpIO* pump);
-
 	
 protected:
 	/** 
@@ -223,8 +217,6 @@ protected:
 	 S32 mRequestTransferedBytes;
 	 S32 mResponseTransferedBytes;
 
-	static CURLcode _sslCtxCallback(CURL * curl, void *sslctx, void *param);
-	
 private:
 	/** 
 	 * @brief Initialize the object. Called during construction.
@@ -372,6 +364,62 @@ protected:
 };
 
 
+/** 
+ * @class LLURLRequestClientFactory
+ * @brief Template class to build url request based client chains 
+ *
+ * This class eases construction of a basic sd rpc client. Here is an
+ * example of it's use:
+ * <code>
+ *  class LLUsefulService : public LLService { ... }<br>
+ *  LLService::registerCreator(<br>
+ *    "useful",<br>
+ *    LLService::creator_t(new LLURLRequestClientFactory<LLUsefulService>))<br>
+ * </code>
+ *
+ * This class should work, but I never got around to using/testing it.
+ *
+ */
+#if 0
+template<class Client>
+class LLURLRequestClientFactory : public LLChainIOFactory
+{
+public:
+	LLURLRequestClientFactory(LLURLRequest::ERequestAction action) {}
+	LLURLRequestClientFactory(
+		LLURLRequest::ERequestAction action,
+		const std::string& fixed_url) :
+		mAction(action),
+		mURL(fixed_url)
+	{
+	}
+	virtual bool build(LLPumpIO::chain_t& chain, LLSD context) const
+	{
+		lldebugs << "LLURLRequestClientFactory::build" << llendl;
+		LLIOPipe::ptr_t service(new Client);
+		chain.push_back(service);
+		LLURLRequest* http(new LLURLRequest(mAction));
+		LLIOPipe::ptr_t http_pipe(http);
+		// *FIX: how do we know the content type?
+		//http->addHeader("Content-Type: text/llsd");
+		if(mURL.empty())
+		{
+			chain.push_back(LLIOPipe::ptr_t(new LLContextURLExtractor(http)));
+		}
+		else
+		{
+			http->setURL(mURL);
+		}
+		chain.push_back(http_pipe);
+		chain.push_back(service);
+		return true;
+	}
+
+protected:
+	LLURLRequest::ERequestAction mAction;
+	std::string mURL;
+};
+#endif
 
 /**
  * External constants
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index c38e38c900..e8e3459673 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -41,9 +41,6 @@
 #include "lltrans.h"
 #include "lluicolortable.h"
 
-#define APP_HEADER_REGEX "((x-grid-location-info://[-\\w\\.]+/app)|(secondlife:///app))"
-
-
 LLUrlEntryBase::LLUrlEntryBase() :
 	mColor(LLUIColorTable::instance().getColor("HTMLLinkColor")),
 	mDisabledLink(false)
@@ -306,11 +303,10 @@ std::string LLUrlEntrySLURL::getLocation(const std::string &url) const
 //
 // LLUrlEntryAgent Describes a Second Life agent Url, e.g.,
 // secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
-// x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
 //
 LLUrlEntryAgent::LLUrlEntryAgent()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/agent/[\\da-f-]+/\\w+",
+	mPattern = boost::regex("secondlife:///app/agent/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_agent.xml";
 	mIcon = "Generic_Person";
@@ -422,11 +418,10 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
 // LLUrlEntryGroup Describes a Second Life group Url, e.g.,
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
 // secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
-// x-grid-location-info://lincoln.lindenlab.com/app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/inspect
 //
 LLUrlEntryGroup::LLUrlEntryGroup()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/group/[\\da-f-]+/\\w+",
+	mPattern = boost::regex("secondlife:///app/group/[\\da-f-]+/\\w+",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_group.xml";
 	mIcon = "Generic_Group";
@@ -487,8 +482,7 @@ LLUrlEntryInventory::LLUrlEntryInventory()
 	//*TODO: add supporting of inventory item names with whitespaces
 	//this pattern cann't parse for example 
 	//secondlife:///app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
-	//x-grid-location-info://lincoln.lindenlab.com/app/inventory/0e346d8b-4433-4d66-a6b0-fd37083abc4c/select?name=name with spaces&param2=value
-	mPattern = boost::regex(APP_HEADER_REGEX "/inventory/[\\da-f-]+/\\w+\\S*",
+	mPattern = boost::regex("secondlife:///app/inventory/[\\da-f-]+/\\w+\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_inventory.xml";
 }
@@ -502,11 +496,10 @@ std::string LLUrlEntryInventory::getLabel(const std::string &url, const LLUrlLab
 ///
 /// LLUrlEntryParcel Describes a Second Life parcel Url, e.g.,
 /// secondlife:///app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
-/// x-grid-location-info://lincoln.lindenlab.com/app/parcel/0000060e-4b39-e00b-d0c3-d98b1934e3a8/about
 ///
 LLUrlEntryParcel::LLUrlEntryParcel()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/parcel/[\\da-f-]+/about",
+	mPattern = boost::regex("secondlife:///app/parcel/[\\da-f-]+/about",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_parcel.xml";
 	mTooltip = LLTrans::getString("TooltipParcelUrl");
@@ -522,7 +515,7 @@ std::string LLUrlEntryParcel::getLabel(const std::string &url, const LLUrlLabelC
 //
 LLUrlEntryPlace::LLUrlEntryPlace()
 {
-	mPattern = boost::regex("((x-grid-location-info://[-\\w\\.]+/region/)|(secondlife://))\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
+	mPattern = boost::regex("secondlife://\\S+/?(\\d+/\\d+/\\d+|\\d+/\\d+)/?",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_slurl.xml";
 	mTooltip = LLTrans::getString("TooltipSLURL");
@@ -567,11 +560,10 @@ std::string LLUrlEntryPlace::getLocation(const std::string &url) const
 //
 // LLUrlEntryTeleport Describes a Second Life teleport Url, e.g.,
 // secondlife:///app/teleport/Ahern/50/50/50/
-// x-grid-location-info://lincoln.lindenlab.com/app/teleport/Ahern/50/50/50/
 //
 LLUrlEntryTeleport::LLUrlEntryTeleport()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
+	mPattern = boost::regex("secondlife:///app/teleport/\\S+(/\\d+)?(/\\d+)?(/\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_teleport.xml";
 	mTooltip = LLTrans::getString("TooltipTeleportUrl");
@@ -589,12 +581,7 @@ std::string LLUrlEntryTeleport::getLabel(const std::string &url, const LLUrlLabe
 	LLURI uri(url);
 	LLSD path_array = uri.pathArray();
 	S32 path_parts = path_array.size();
-	std::string host = uri.hostName();
-	std::string label = LLTrans::getString("SLurlLabelTeleport");
-	if (!host.empty())
-	{
-		label += " " + host;
-	}
+	const std::string label = LLTrans::getString("SLurlLabelTeleport");
 	if (path_parts == 6)
 	{
 		// handle teleport url with (X,Y,Z) coordinates
@@ -693,7 +680,7 @@ std::string LLUrlEntrySLLabel::getTooltip(const std::string &string) const
 //
 LLUrlEntryWorldMap::LLUrlEntryWorldMap()
 {
-	mPattern = boost::regex(APP_HEADER_REGEX "/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
+	mPattern = boost::regex("secondlife:///app/worldmap/\\S+/?(\\d+)?/?(\\d+)?/?(\\d+)?/?\\S*",
 							boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_map.xml";
 	mTooltip = LLTrans::getString("TooltipMapUrl");
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 4463b6cc6f..cbb303a059 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -286,13 +286,6 @@ namespace tut
 				  "XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar",
 				  "secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar");
 
-		testRegex("Standalone Agent Url ", url,
-				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-
-		testRegex("Standalone Agent Url Multicase with Text", url,
-				  "M x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/AGENT/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
 	}
 
 	template<> template<>
@@ -322,15 +315,6 @@ namespace tut
 		testRegex("Group Url multicase", url,
 				  "XXX secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About XXX",
 				  "secondlife:///APP/Group/00005FF3-4044-c79f-9de8-fb28ae0df991/About");
-		
-		testRegex("Standalone Group Url ", url,
-				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/group/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-		
-		testRegex("Standalone Group Url Multicase ith Text", url,
-				  "M x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about M",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/GROUP/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about");		
-		
 	}
 
 	template<> template<>
@@ -377,11 +361,7 @@ namespace tut
 		// DEV-35459: SLURLs and teleport Links not parsed properly
 		testRegex("SLURL with quote", url,
 				  "XXX secondlife://A'ksha%20Oasis/41/166/701 XXX",
-			          "secondlife://A%27ksha%20Oasis/41/166/701");
-		
-		testRegex("Standalone All Hands (50,50) [2] with text", url,
-				  "XXX x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50 XXX",
-				  "x-grid-location-info://lincoln.lindenlab.com/region/All%20Hands/50/50/50");		
+				  "secondlife://A%27ksha%20Oasis/41/166/701");
 	}
 
 	template<> template<>
@@ -481,10 +461,6 @@ namespace tut
 		testRegex("Teleport url with quote", url,
 				  "XXX secondlife:///app/teleport/A'ksha%20Oasis/41/166/701 XXX",
 				  "secondlife:///app/teleport/A%27ksha%20Oasis/41/166/701");
-		
-		testRegex("Standalone All Hands", url,
-				  "XXX x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50 XXX",
-				  "x-grid-location-info://lincoln.lindenlab.com/app/teleport/All%20Hands/50/50/50");		
 	}
 
 	template<> template<>
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index b4ee42ef3a..da4abde451 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -459,6 +459,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 	}
 
 	//llinfos << "*** EXPANDED FILENAME: <" << expanded_filename << ">" << llendl;
+
 	return expanded_filename;
 }
 
@@ -564,23 +565,27 @@ std::string LLDir::getForbiddenFileChars()
 	return "\\/:*?\"<>|";
 }
 
-void LLDir::setLindenUserDir(const std::string &username)
+void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
 {
-	// if the username isn't set, that's bad
-	if (!username.empty())
+	// if both first and last aren't set, that's bad.
+	if (!first.empty() && !last.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string userlower(username);
-		LLStringUtil::toLower(userlower);
-		LLStringUtil::replaceChar(userlower, ' ', '_');
+		std::string firstlower(first);
+		LLStringUtil::toLower(firstlower);
+		std::string lastlower(last);
+		LLStringUtil::toLower(lastlower);
 		mLindenUserDir = getOSUserAppDir();
 		mLindenUserDir += mDirDelimiter;
-		mLindenUserDir += userlower;
+		mLindenUserDir += firstlower;
+		mLindenUserDir += "_";
+		mLindenUserDir += lastlower;
+		llinfos << "Got name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
 	}
 	else
 	{
-		llerrs << "NULL name for LLDir::setLindenUserDir" << llendl;
+		llerrs << "Invalid name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
 	}
 
 	dumpCurrentDirectories();	
@@ -598,25 +603,27 @@ void LLDir::setChatLogsDir(const std::string &path)
 	}
 }
 
-void LLDir::setPerAccountChatLogsDir(const std::string &username)
+void LLDir::setPerAccountChatLogsDir(const std::string &first, const std::string &last)
 {
 	// if both first and last aren't set, assume we're grabbing the cached dir
-	if (!username.empty())
+	if (!first.empty() && !last.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
 		// utterly consistent with our firstname/lastname case.
-		std::string userlower(username);
-		LLStringUtil::toLower(userlower);
-		LLStringUtil::replaceChar(userlower, ' ', '_');
+		std::string firstlower(first);
+		LLStringUtil::toLower(firstlower);
+		std::string lastlower(last);
+		LLStringUtil::toLower(lastlower);
 		mPerAccountChatLogsDir = getChatLogsDir();
 		mPerAccountChatLogsDir += mDirDelimiter;
-		mPerAccountChatLogsDir += userlower;
+		mPerAccountChatLogsDir += firstlower;
+		mPerAccountChatLogsDir += "_";
+		mPerAccountChatLogsDir += lastlower;
 	}
 	else
 	{
-		llerrs << "NULL name for LLDir::setPerAccountChatLogsDir" << llendl;
+		llwarns << "Invalid name for LLDir::setPerAccountChatLogsDir" << llendl;
 	}
-	
 }
 
 void LLDir::setSkinFolder(const std::string &skin_folder)
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 05d5efc66f..9067d75bac 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -137,8 +137,8 @@ class LLDir
 	static std::string getForbiddenFileChars();
 
 	virtual void setChatLogsDir(const std::string &path);		// Set the chat logs dir to this user's dir
-	virtual void setPerAccountChatLogsDir(const std::string &username);		// Set the per user chat log directory.
-	virtual void setLindenUserDir(const std::string &username);		// Set the linden user dir to this user's dir
+	virtual void setPerAccountChatLogsDir(const std::string &first, const std::string &last);		// Set the per user chat log directory.
+	virtual void setLindenUserDir(const std::string &first, const std::string &last);		// Set the linden user dir to this user's dir
 	virtual void setSkinFolder(const std::string &skin_folder);
 	virtual bool setCacheDir(const std::string &path);
 
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index e0a31875c8..47fde08a9d 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -7,7 +7,6 @@ include(Boost)
 include(BuildVersion)
 include(DBusGlib)
 include(DirectX)
-include(OpenSSL)
 include(DragDrop)
 include(ELFIO)
 include(FMOD)
@@ -372,8 +371,6 @@ set(viewer_SOURCE_FILES
     llscrollingpanelparam.cpp
     llsearchcombobox.cpp
     llsearchhistory.cpp
-    llsecapi.cpp
-    llsechandler_basic.cpp
     llselectmgr.cpp
     llsidepanelappearance.cpp
     llsidepanelinventory.cpp
@@ -448,6 +445,7 @@ set(viewer_SOURCE_FILES
     llurldispatcherlistener.cpp
     llurlhistory.cpp
     llurllineeditorctrl.cpp
+    llurlsimstring.cpp
     llurlwhitelist.cpp
     llvectorperfoptions.cpp
     llversioninfo.cpp
@@ -514,9 +512,7 @@ set(viewer_SOURCE_FILES
     llvoground.cpp
     llvoicechannel.cpp
     llvoiceclient.cpp
-    llvoicedw.cpp
     llvoicevisualizer.cpp
-    llvoicevivox.cpp
     llvoinventorylistener.cpp
     llvopartgroup.cpp
     llvosky.cpp
@@ -876,8 +872,6 @@ set(viewer_HEADER_FILES
     llscrollingpanelparam.h
     llsearchcombobox.h
     llsearchhistory.h
-    llsecapi.h
-    llsechandler_basic.h
     llselectmgr.h
     llsidepanelappearance.h
     llsidepanelinventory.h
@@ -954,6 +948,7 @@ set(viewer_HEADER_FILES
     llurldispatcherlistener.h
     llurlhistory.h
     llurllineeditorctrl.h
+    llurlsimstring.h
     llurlwhitelist.h
     llvectorperfoptions.h
     llversioninfo.h
@@ -1017,9 +1012,7 @@ set(viewer_HEADER_FILES
     llvoground.h
     llvoicechannel.h
     llvoiceclient.h
-    llvoicedw.h
     llvoicevisualizer.h
-    llvoicevivox.h
     llvoinventorylistener.h
     llvopartgroup.h
     llvosky.h
@@ -1410,8 +1403,8 @@ if (WINDOWS)
         ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
         ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
         )
-     endif(USE_GOOGLE_PERFTOOLS)
- 
+    endif(USE_GOOGLE_PERFTOOLS)
+  
 
     set(COPY_INPUT_DEPENDECIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
@@ -1628,8 +1621,6 @@ target_link_libraries(${VIEWER_BINARY_NAME}
     ${WINDOWS_LIBRARIES}
     ${XMLRPCEPI_LIBRARIES}
     ${ELFIO_LIBRARIES}
-    ${OPENSSL_LIBRARIES}
-    ${CRYPTO_LIBRARIES}
     ${LLLOGIN_LIBRARIES}
     ${GOOGLE_PERFTOOLS_LIBRARIES}
     )
@@ -1806,43 +1797,6 @@ if (LL_TESTS)
     "${CMAKE_SOURCE_DIR}/llmessage/tests/test_llsdmessage_peer.py"
     )
 
-  set(test_libs 
-    ${LLMESSAGE_LIBRARIES} 
-    ${WINDOWS_LIBRARIES} 
-    ${LLVFS_LIBRARIES}
-    ${LLMATH_LIBRARIES}
-    ${LLCOMMON_LIBRARIES} 
-    ${GOOGLEMOCK_LIBRARIES}
-    ${OPENSSL_LIBRARIES}
-    ${CRYPTO_LIBRARIES}
-  )
-
-    LL_ADD_INTEGRATION_TEST(llsechandler_basic
-     llsechandler_basic.cpp
-    "${test_libs}"
-    )
-
-  LL_ADD_INTEGRATION_TEST(llsecapi
-     llsecapi.cpp
-    "${test_libs}"
-    )
-
-  set(llslurl_test_sources
-      llslurl.cpp
-      llviewernetwork.cpp
-  )
-
-
-  LL_ADD_INTEGRATION_TEST(llslurl
-     "${llslurl_test_sources}"
-    "${test_libs}"
-    )
-
-  LL_ADD_INTEGRATION_TEST(llviewernetwork
-     llviewernetwork.cpp
-    "${test_libs}"
-    )
-
   #ADD_VIEWER_BUILD_TEST(llmemoryview viewer)
   #ADD_VIEWER_BUILD_TEST(llagentaccess viewer)
   #ADD_VIEWER_BUILD_TEST(llworldmap viewer)
@@ -1850,7 +1804,6 @@ if (LL_TESTS)
   #ADD_VIEWER_BUILD_TEST(lltextureinfo viewer)
   #ADD_VIEWER_BUILD_TEST(lltextureinfodetails viewer)
   #ADD_VIEWER_BUILD_TEST(lltexturestatsuploader viewer)
-
 endif (LL_TESTS)
 
 
diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist
index 7436c5642e..4cb01a0f33 100644
--- a/indra/newview/Info-SecondLife.plist
+++ b/indra/newview/Info-SecondLife.plist
@@ -18,33 +18,6 @@
 	<string>APPL</string>
 	<key>CFBundleSignature</key>
 	<string>????</string>
-        <key>CFBundleDocumentTypes</key>
-        <array>
-                <dict>
-                        <key>CFBundleTypeExtensions</key>
-                        <array>
-                                <string>slurl</string>
-                        </array>
-                        <key>CFBundleTypeIconFile</key>
-                        <string>seconlife</string>
-                        <key>CFBundleTypeMIMETypes</key>
-                        <array>
-                                <string>application/x-grid-location-info</string>
-                        </array>
-                        <key>CFBundleTypeName</key>
-                        <string>Secondlife SLURL</string>
-			<key>CFBundleTypeOSTypes</key>
-			<array>
-			  <string>SLRL</string>
-			</array>
-                        <key>CFBundleTypeRole</key>
-                        <string>Viewer</string>
-                        <key>LSTypeIsPackage</key>
-			<true/>
-                        <key>NSDocumentClass</key>
-                        <string>SecondLifeSLURL</string>
-                </dict>
-        </array>
 	<key>CFBundleURLTypes</key>
 	<array>
 		<dict>
@@ -53,7 +26,6 @@
 			<key>CFBundleURLSchemes</key>
 			<array>
 				<string>secondlife</string>
-				<string>x-grid-location-info</string>
 			</array>
 			<key>LSIsAppleDefaultForScheme</key>
 			<true/>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 442cd5d31e..30049b73ea 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -1264,17 +1264,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>CertStore</key>
-    <map>
-      <key>Comment</key>
-      <string>Specifies the Certificate Store for certificate trust verification</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>default</string>
-    </map>
     <key>ChatBarStealsFocus</key>
     <map>
       <key>Comment</key>
@@ -1651,17 +1640,6 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>CurrentGrid</key>
-    <map>
-      <key>Comment</key>
-      <string>Currently Selected Grid</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>CustomServer</key>
     <map>
       <key>Comment</key>
@@ -2388,29 +2366,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-	<key>DefaultFemaleAvatar</key>
-	<map>
-	  <key>Comment</key>
-	  <string>Default Female Avatar</string>
-	  <key>Persist</key>
-	  <integer>1</integer>
-	  <key>Type</key>
-	  <string>String</string>
-	  <key>Value</key>
-	  <string>Female Shape &amp; Outfit</string>
-	</map>
-	<key>DefaultMaleAvatar</key>
-	<map>
-	  <key>Comment</key>
-	  <string>Default Male Avatar</string>
-	  <key>Persist</key>
-	  <integer>1</integer>
-	  <key>Type</key>
-	  <string>String</string>
-	  <key>Value</key>
-	  <string>Male Shape &amp; Outfit</string>
-	</map>
-
     <key>DefaultObjectTexture</key>
     <map>
       <key>Comment</key>
@@ -3487,7 +3442,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>ForceMandatoryUpdate</key>
     <map>
@@ -7741,17 +7696,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>SecondLifeEnterprise</key>
-    <map>
-      <key>Comment</key>
-      <string>Enables Second Life Enterprise features</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>	
     <key>SelectMovableOnly</key>
     <map>
       <key>Comment</key>
@@ -8556,7 +8500,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>0</integer>
     </map>
     <key>ShowTangentBasis</key>
     <map>
@@ -10449,17 +10393,6 @@
       <key>Value</key>
       <string></string>
     </map>
-    <key>VivoxDebugSIPURIHostName</key>
-    <map>
-      <key>Comment</key>
-      <string>Hostname portion of vivox SIP URIs (empty string for the default).</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>VivoxDebugVoiceAccountServerURI</key>
     <map>
       <key>Comment</key>
@@ -10471,28 +10404,6 @@
       <key>Value</key>
       <string></string>
     </map>
-    <key>VivoxVoiceHost</key>
-    <map>
-      <key>Comment</key>
-      <string>Client SLVoice host to connect to</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>127.0.0.1</string>
-    </map>
-    <key>VivoxVoicePort</key>
-    <map>
-      <key>Comment</key>
-      <string>Client SLVoice port to connect to</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>U32</string>
-      <key>Value</key>
-      <integer>44125</integer>
-    </map>
     <key>VoiceCallsFriendsOnly</key>
     <map>
       <key>Comment</key>
@@ -10625,17 +10536,6 @@
       <key>Value</key>
       <string>Default</string>
     </map>
-    <key>VoiceLogFile</key>
-    <map>
-      <key>Comment</key>
-      <string>Log file to use when launching the voice daemon</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string></string>
-    </map>
     <key>VoiceOutputAudioDevice</key>
     <map>
       <key>Comment</key>
@@ -10680,17 +10580,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>VoiceServerType</key>
-    <map>
-      <key>Comment</key>
-      <string>The type of voice server to connect to.</string>
-      <key>Persist</key>
-      <integer>0</integer>
-      <key>Type</key>
-      <string>String</string>
-      <key>Value</key>
-      <string>vivox</string>
-    </map>
     <key>WLSkyDetail</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/installers/windows/installer_template.nsi b/indra/newview/installers/windows/installer_template.nsi
index b7b4c54001..a7322749ca 100644
--- a/indra/newview/installers/windows/installer_template.nsi
+++ b/indra/newview/installers/windows/installer_template.nsi
@@ -797,12 +797,6 @@ WriteRegStr HKEY_CLASSES_ROOT "${URLNAME}\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
 ;; URL param must be last item passed to viewer, it ignores subsequent params
 ;; to avoid parameter injection attacks.
 WriteRegExpandStr HKEY_CLASSES_ROOT "${URLNAME}\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info"(default)" "URL:Second Life"
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info" "URL Protocol" ""
-WriteRegStr HKEY_CLASSES_ROOT "x-grid-location-info\DefaultIcon" "" '"$INSTDIR\$INSTEXE"'
-;; URL param must be last item passed to viewer, it ignores subsequent params
-;; to avoid parameter injection attacks.
-WriteRegExpandStr HKEY_CLASSES_ROOT "x-grid-location-info\shell\open\command" "" '"$INSTDIR\$INSTEXE" $INSTFLAGS -url "%1"'
 
 ; write out uninstaller
 WriteUninstaller "$INSTDIR\uninst.exe"
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 37d1bd15e1..f434782977 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3231,7 +3231,7 @@ bool LLAgent::teleportCore(bool is_local)
 	
 	// MBW -- Let the voice client know a teleport has begun so it can leave the existing channel.
 	// This was breaking the case of teleporting within a single sim.  Backing it out for now.
-//	LLVoiceClient::getInstance()->leaveChannel();
+//	gVoiceClient->leaveChannel();
 	
 	return true;
 }
@@ -3375,7 +3375,7 @@ void LLAgent::setTeleportState(ETeleportState state)
 	if (mTeleportState == TELEPORT_MOVING)
 	{
 		// We're outa here. Save "back" slurl.
-		LLAgentUI::buildSLURL(mTeleportSourceSLURL);
+		mTeleportSourceSLURL = LLAgentUI::buildSLURL();
 	}
 	else if(mTeleportState == TELEPORT_ARRIVING)
 	{
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 32f9b00135..a460077b7e 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -42,7 +42,6 @@
 #include "llpointer.h"
 #include "lluicolor.h"
 #include "llvoavatardefines.h"
-#include "llslurl.h"
 
 extern const BOOL 	ANIMATE;
 extern const U8 	AGENT_STATE_TYPING;  // Typing indication
@@ -515,13 +514,13 @@ public:
 
 public:
 	static void 	parseTeleportMessages(const std::string& xml_filename);
-	const void getTeleportSourceSLURL(LLSLURL& slurl) const { slurl = mTeleportSourceSLURL; }
+	const std::string getTeleportSourceSLURL() const { return mTeleportSourceSLURL; }
 public:
 	// ! TODO ! Define ERROR and PROGRESS enums here instead of exposing the mappings.
 	static std::map<std::string, std::string> sTeleportErrorMessages;
 	static std::map<std::string, std::string> sTeleportProgressMessages;
 private:
-	LLSLURL	mTeleportSourceSLURL; 			// SLURL where last TP began
+	std::string		mTeleportSourceSLURL; 			// SLURL where last TP began
 
 	//--------------------------------------------------------------------
 	// Teleport Actions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 7a8205acb5..b3ed7c353e 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -53,10 +53,7 @@ void LLAgentListener::requestTeleport(LLSD const & event_data) const
 	}
 	else
 	{
-		std::string url = LLSLURL(event_data["regionname"], 
-								  LLVector3(event_data["x"].asReal(), 
-											event_data["y"].asReal(), 
-											event_data["z"].asReal())).getSLURLString();
+		std::string url = LLSLURL::buildSLURL(event_data["regionname"], event_data["x"], event_data["y"], event_data["z"]);
 		LLURLDispatcher::dispatch(url, NULL, false);
 	}
 }
diff --git a/indra/newview/llagentui.cpp b/indra/newview/llagentui.cpp
index 15d9f36b74..c4597ad6f8 100644
--- a/indra/newview/llagentui.cpp
+++ b/indra/newview/llagentui.cpp
@@ -76,15 +76,16 @@ void LLAgentUI::buildFullname(std::string& name)
 }
 
 //static
-void LLAgentUI::buildSLURL(LLSLURL& slurl, const bool escaped /*= true*/)
+std::string LLAgentUI::buildSLURL(const bool escaped /*= true*/)
 {
-      LLSLURL return_slurl;
-      LLViewerRegion *regionp = gAgent.getRegion();
-      if (regionp)
-      {
-		  return_slurl = LLSLURL(regionp->getName(), gAgent.getPositionGlobal());
-      }
-	slurl = return_slurl;
+	std::string slurl;
+	LLViewerRegion *regionp = gAgent.getRegion();
+	if (regionp)
+	{
+		LLVector3d agentPos = gAgent.getPositionGlobal();
+		slurl = LLSLURL::buildSLURLfromPosGlobal(regionp->getName(), agentPos, escaped);
+	}
+	return slurl;
 }
 
 //static
diff --git a/indra/newview/llagentui.h b/indra/newview/llagentui.h
index 577b752fbe..3478793e38 100644
--- a/indra/newview/llagentui.h
+++ b/indra/newview/llagentui.h
@@ -33,8 +33,6 @@
 #ifndef LLAGENTUI_H
 #define LLAGENTUI_H
 
-class LLSLURL;
-
 class LLAgentUI
 {
 public:
@@ -50,7 +48,7 @@ public:
 	static void buildName(std::string& name);
 	static void buildFullname(std::string &name);
 
-	static void buildSLURL(LLSLURL& slurl, const bool escaped = true);
+	static std::string buildSLURL(const bool escaped = true);
 	//build location string using the current position of gAgent.
 	static BOOL buildLocationString(std::string& str, ELocationFormat fmt = LOCATION_FORMAT_LANDMARK);
 	//build location string using a region position of the avatar. 
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2a355474b1..43c8c679c6 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -153,7 +153,7 @@
 #include "llworld.h"
 #include "llhudeffecttrail.h"
 #include "llvectorperfoptions.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llwatchdog.h"
 
 // Included so that constants/settings might be initialized
@@ -193,9 +193,6 @@
 #include "llparcel.h"
 #include "llavatariconctrl.h"
 
-// Include for security api initialization
-#include "llsecapi.h"
-
 // *FIX: These extern globals should be cleaned up.
 // The globals either represent state/config/resource-storage of either 
 // this app, or another 'component' of the viewer. App globals should be 
@@ -510,6 +507,35 @@ public:
 	}
 };
 
+void LLAppViewer::initGridChoice()
+{
+	// Load	up the initial grid	choice from:
+	//	- hard coded defaults...
+	//	- command line settings...
+	//	- if dev build,	persisted settings...
+
+	// Set the "grid choice", this is specified	by command line.
+	std::string	grid_choice	= gSavedSettings.getString("CmdLineGridChoice");
+	LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+
+	// Load last server choice by default 
+	// ignored if the command line grid	choice has been	set
+	if(grid_choice.empty())
+	{
+		S32	server = gSavedSettings.getS32("ServerChoice");
+		server = llclamp(server, 0,	(S32)GRID_INFO_COUNT - 1);
+		if(server == GRID_INFO_OTHER)
+		{
+			std::string custom_server = gSavedSettings.getString("CustomServer");
+			LLViewerLogin::getInstance()->setGridChoice(custom_server);
+		}
+		else if(server != (S32)GRID_INFO_NONE)
+		{
+			LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server);
+		}
+	}
+}
+
 //virtual
 bool LLAppViewer::initSLURLHandler()
 {
@@ -621,6 +647,7 @@ bool LLAppViewer::init()
     LLCurl::initClass();
 
     initThreads();
+
     writeSystemInfo();
 
 	// Build a string representing the current version number.
@@ -750,6 +777,10 @@ bool LLAppViewer::init()
 		return false;
 	}
 
+	// Always fetch the Ethernet MAC address, needed both for login
+	// and password load.
+	LLUUID::getNodeID(gMACAddress);
+
 	// Prepare for out-of-memory situations, during which we will crash on
 	// purpose and save a dump.
 #if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD && LL_USE_SMARTHEAP
@@ -861,7 +892,6 @@ bool LLAppViewer::init()
 		}
 	}
 
-
 	// save the graphics card
 	gDebugInfo["GraphicsCard"] = LLFeatureManager::getInstance()->getGPUString();
 
@@ -872,17 +902,6 @@ bool LLAppViewer::init()
 	gSimFrames = (F32)gFrameCount;
 
 	LLViewerJoystick::getInstance()->init(false);
-
-	try {
-		initializeSecHandler();
-	}
-	catch (LLProtectedDataException ex)
-	{
-	  LLNotificationsUtil::add("CorruptedProtectedDataStore");
-	}
-	LLHTTPClient::setCertVerifyCallback(secapiSSLCertVerifyCallback);
-
-
 	gGLActive = FALSE;
 	if (gSavedSettings.getBOOL("QAMode") && gSavedSettings.getS32("QAModeEventHostPort") > 0)
 	{
@@ -917,11 +936,13 @@ bool LLAppViewer::mainLoop()
 	gServicePump = new LLPumpIO(gAPRPoolp);
 	LLHTTPClient::setPump(*gServicePump);
 	LLCurl::setCAFile(gDirUtilp->getCAFile());
-
+	LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert"));
+	
 	// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
 
 	LLVoiceChannel::initClass();
-	LLVoiceClient::getInstance()->init(gServicePump);
+	LLVoiceClient::init(gServicePump);
+
 	LLTimer frameTimer,idleTimer;
 	LLTimer debugTime;
 	LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
@@ -1252,7 +1273,7 @@ bool LLAppViewer::cleanup()
 	// to ensure shutdown order
 	LLMortician::setZealous(TRUE);
 
-	LLVoiceClient::getInstance()->terminate();
+	LLVoiceClient::terminate();
 	
 	disconnectViewer();
 
@@ -1451,6 +1472,13 @@ bool LLAppViewer::cleanup()
 
 	llinfos << "Saving Data" << llendflush;
 	
+	// Quitting with "Remember Password" turned off should always stomp your
+	// saved password, whether or not you successfully logged in.  JC
+	if (!gSavedSettings.getBOOL("RememberPassword"))
+	{
+		LLStartUp::deletePasswordFromDisk();
+	}
+	
 	// Store the time of our current logoff
 	gSavedPerAccountSettings.setU32("LastLogoff", time_corrected());
 
@@ -2019,6 +2047,7 @@ bool LLAppViewer::initConfiguration()
         }
     }
 
+    initGridChoice();
 
 	// If we have specified crash on startup, set the global so we'll trigger the crash at the right time
 	if(clp.hasOption("crashonstartup"))
@@ -2112,17 +2141,30 @@ bool LLAppViewer::initConfiguration()
     // injection and steal passwords. Phoenix. SL-55321
     if(clp.hasOption("url"))
     {
-		LLStartUp::setStartSLURL(LLSLURL(clp.getOption("url")[0]));
-		if(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION) 
-		{  
-			LLGridManager::getInstance()->setGridChoice(LLStartUp::getStartSLURL().getGrid());
-			
-		}  
+        std::string slurl = clp.getOption("url")[0];
+        if (LLSLURL::isSLURLCommand(slurl))
+        {
+	        LLStartUp::sSLURLCommand = slurl;
+        }
+        else
+        {
+	        LLURLSimString::setString(slurl);
+        }
     }
     else if(clp.hasOption("slurl"))
     {
-		LLSLURL start_slurl(clp.getOption("slurl")[0]);
-		LLStartUp::setStartSLURL(start_slurl);
+        std::string slurl = clp.getOption("slurl")[0];
+        if(LLSLURL::isSLURL(slurl))
+        {
+            if (LLSLURL::isSLURLCommand(slurl))
+            {
+	            LLStartUp::sSLURLCommand = slurl;
+            }
+            else
+            {
+	            LLURLSimString::setString(slurl);
+            }
+        }
     }
 
     const LLControlVariable* skinfolder = gSavedSettings.getControl("SkinCurrent");
@@ -2203,10 +2245,18 @@ bool LLAppViewer::initConfiguration()
 	// don't call anotherInstanceRunning() when doing URL handoff, as
 	// it relies on checking a marker file which will not work when running
 	// out of different directories
-
-	if (LLStartUp::getStartSLURL().isValid())
+	std::string slurl;
+	if (!LLStartUp::sSLURLCommand.empty())
+	{
+		slurl = LLStartUp::sSLURLCommand;
+	}
+	else if (LLURLSimString::parse())
+	{
+		slurl = LLURLSimString::getURL();
+	}
+	if (!slurl.empty())
 	{
-		if (sendURLToOtherInstance(LLStartUp::getStartSLURL().getSLURLString()))
+		if (sendURLToOtherInstance(slurl))
 		{
 			// successfully handed off URL to existing instance, exit
 			return false;
@@ -2262,9 +2312,9 @@ bool LLAppViewer::initConfiguration()
 
    	// need to do this here - need to have initialized global settings first
 	std::string nextLoginLocation = gSavedSettings.getString( "NextLoginLocation" );
-	if ( !nextLoginLocation.empty() )
+	if ( nextLoginLocation.length() )
 	{
-		LLStartUp::setStartSLURL(LLSLURL(nextLoginLocation));
+		LLURLSimString::setString( nextLoginLocation );
 	};
 
 	gLastRunVersion = gSavedSettings.getString("LastRunVersion");
@@ -2485,7 +2535,7 @@ void LLAppViewer::writeSystemInfo()
 
 	// The user is not logged on yet, but record the current grid choice login url
 	// which may have been the intended grid. This can b
-	gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+	gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
 
 	// *FIX:Mani - move this ddown in llappviewerwin32
 #ifdef LL_WINDOWS
@@ -3836,7 +3886,7 @@ void LLAppViewer::sendLogoutRequest()
 		gLogoutMaxTime = LOGOUT_REQUEST_TIME;
 		mLogoutRequestSent = TRUE;
 		
-		LLVoiceClient::getInstance()->leaveChannel();
+		gVoiceClient->leaveChannel();
 
 		//Set internal status variables and marker files
 		gLogoutInProgress = TRUE;
@@ -4256,7 +4306,7 @@ void LLAppViewer::launchUpdater()
 #endif
 	// *TODO change userserver to be grid on both viewer and sim, since
 	// userserver no longer exists.
-	query_map["userserver"] = LLGridManager::getInstance()->getGridLabel();
+	query_map["userserver"] = LLViewerLogin::getInstance()->getGridLabel();
 	query_map["channel"] = gSavedSettings.getString("VersionChannelName");
 	// *TODO constantize this guy
 	// *NOTE: This URL is also used in win_setup/lldownloader.cpp
@@ -4269,10 +4319,10 @@ void LLAppViewer::launchUpdater()
 	LLAppViewer::sUpdaterInfo = new LLAppViewer::LLUpdaterInfo() ;
 
 	// if a sim name was passed in via command line parameter (typically through a SLURL)
-	if ( LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION )
+	if ( LLURLSimString::sInstance.mSimString.length() )
 	{
 		// record the location to start at next time
-		gSavedSettings.setString( "NextLoginLocation", LLStartUp::getStartSLURL().getSLURLString()); 
+		gSavedSettings.setString( "NextLoginLocation", LLURLSimString::sInstance.mSimString ); 
 	};
 
 #if LL_WINDOWS
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index 27e8bec1d5..a915b7fa50 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -191,6 +191,7 @@ private:
 
 	bool initThreads(); // Initialize viewer threads, return false on failure.
 	bool initConfiguration(); // Initialize settings from the command line/config file.
+	void initGridChoice();
 
 	bool initCache(); // Initialize local client cache.
 
diff --git a/indra/newview/llappviewerlinux.cpp b/indra/newview/llappviewerlinux.cpp
index 78b0f7ba83..d34bcb4a68 100644
--- a/indra/newview/llappviewerlinux.cpp
+++ b/indra/newview/llappviewerlinux.cpp
@@ -604,7 +604,7 @@ void LLAppViewerLinux::handleCrashReporting(bool reportFreeze)
 				{cmd.c_str(),
 				 ask_dialog,
 				 "-user",
-				 (char*)LLGridManager::getInstance()->getGridLabel().c_str(),
+				 (char*)LLViewerLogin::getInstance()->getGridLabel().c_str(),
 				 "-name",
 				 LLAppViewer::instance()->getSecondLifeTitle().c_str(),
 				 NULL};
diff --git a/indra/newview/llappviewermacosx.cpp b/indra/newview/llappviewermacosx.cpp
index 58d28883c6..80d9b14345 100644
--- a/indra/newview/llappviewermacosx.cpp
+++ b/indra/newview/llappviewermacosx.cpp
@@ -44,6 +44,7 @@
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
 #include "llmd5.h"
+#include "llurlsimstring.h"
 #include "llfloaterworldmap.h"
 #include "llurldispatcher.h"
 #include <Carbon/Carbon.h>
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 48a85dc73f..c85c72837c 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -282,7 +282,7 @@ bool LLAvatarActions::isCalling(const LLUUID &id)
 //static
 bool LLAvatarActions::canCall()
 {
-		return LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		return LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 }
 
 // static
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 9824f59358..41bee540fc 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -319,7 +319,7 @@ 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());
+		mSpeakBtn->setFlyoutBtnEnabled(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 	}
 }
 
@@ -489,7 +489,7 @@ BOOL LLBottomTray::postBuild()
 	mSpeakBtn->setShowToolTip( getString("VoiceControlBtnToolTip") );
 
 	// Registering Chat Bar to receive Voice client status change notifications.
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 
 	mObjectDefaultWidthMap[RS_BUTTON_GESTURES] = mGesturePanel->getRect().getWidth();
 	mObjectDefaultWidthMap[RS_BUTTON_MOVEMENT] = mMovementPanel->getRect().getWidth();
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 215f1b95aa..4ea3c61ab2 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -133,9 +133,9 @@ LLCallFloater::~LLCallFloater()
 
 	// Don't use LLVoiceClient::getInstance() here 
 	// singleton MAY have already been destroyed.
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->removeObserver(this);
+		gVoiceClient->removeObserver(this);
 	}
 	LLTransientFloaterMgr::getInstance()->removeControlView(this);
 }
@@ -191,7 +191,7 @@ void LLCallFloater::draw()
 	// Seems this is a problem somewhere in Voice Client (LLVoiceClient::participantAddedEvent)
 //	onChange();
 
-	bool is_moderator_muted = LLVoiceClient::getInstance()->getIsModeratorMuted(gAgentID);
+	bool is_moderator_muted = gVoiceClient->getIsModeratorMuted(gAgentID);
 
 	if (mIsModeratorMutedVoice != is_moderator_muted)
 	{
@@ -209,6 +209,7 @@ void LLCallFloater::draw()
 void LLCallFloater::onChange()
 {
 	if (NULL == mParticipants) return;
+
 	updateParticipantsVoiceState();
 
 	// Add newly joined participants.
@@ -238,11 +239,11 @@ void LLCallFloater::updateSession()
 	LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel();
 	if (voice_channel)
 	{
-		LL_DEBUGS("Voice") << "Current voice channel: " << voice_channel->getSessionID() << LL_ENDL;
+		lldebugs << "Current voice channel: " << voice_channel->getSessionID() << llendl;
 
 		if (mSpeakerManager && voice_channel->getSessionID() == mSpeakerManager->getSessionID())
 		{
-			LL_DEBUGS("Voice") << "Speaker manager is already set for session: " << voice_channel->getSessionID() << LL_ENDL;
+			lldebugs << "Speaker manager is already set for session: " << voice_channel->getSessionID() << llendl;
 			return;
 		}
 		else
@@ -252,6 +253,7 @@ void LLCallFloater::updateSession()
 	}
 
 	const LLUUID& session_id = voice_channel ? voice_channel->getSessionID() : LLUUID::null;
+	lldebugs << "Set speaker manager for session: " << session_id << llendl;
 
 	LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(session_id);
 	if (im_session)
@@ -291,7 +293,7 @@ void LLCallFloater::updateSession()
 	{
 		// by default let show nearby chat participants
 		mSpeakerManager = LLLocalSpeakerMgr::getInstance();
-		LL_DEBUGS("Voice") << "Set DEFAULT speaker manager" << LL_ENDL;
+		lldebugs << "Set DEFAULT speaker manager" << llendl;
 		mVoiceType = VC_LOCAL_CHAT;
 	}
 
@@ -470,15 +472,16 @@ void LLCallFloater::updateAgentModeratorState()
 static void get_voice_participants_uuids(uuid_vec_t& speakers_uuids)
 {
 	// Get a list of participants from VoiceClient
-       std::set<LLUUID> participants;
-       LLVoiceClient::getInstance()->getParticipantList(participants);
-	
-	for (std::set<LLUUID>::const_iterator iter = participants.begin();
-		 iter != participants.end(); ++iter)
+	LLVoiceClient::participantMap *voice_map = gVoiceClient->getParticipantList();
+	if (voice_map)
 	{
-		speakers_uuids.push_back(*iter);
+		for (LLVoiceClient::participantMap::const_iterator iter = voice_map->begin();
+			iter != voice_map->end(); ++iter)
+		{
+			LLUUID id = (*iter).second->mAvatarID;
+			speakers_uuids.push_back(id);
+		}
 	}
-
 }
 
 void LLCallFloater::initParticipantsVoiceState()
@@ -554,7 +557,7 @@ void LLCallFloater::updateParticipantsVoiceState()
 
 		uuid_vec_t::iterator speakers_iter = std::find(speakers_uuids.begin(), speakers_uuids.end(), participant_id);
 
-		LL_DEBUGS("Voice") << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << LL_ENDL;
+		lldebugs << "processing speaker: " << item->getAvatarName() << ", " << item->getAvatarId() << llendl;
 
 		// If an avatarID assigned to a panel is found in a speakers list
 		// obtained from VoiceClient we assign the JOINED status to the owner
@@ -724,7 +727,7 @@ void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
 void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
 {
 	// check is voice operational and if it doesn't work hide VCP (EXT-4397)
-	if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
+	if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
 	{
 		updateState(new_state);
 	}
diff --git a/indra/newview/llcallingcard.cpp b/indra/newview/llcallingcard.cpp
index 1a6c11fa73..79a2631c31 100644
--- a/indra/newview/llcallingcard.cpp
+++ b/indra/newview/llcallingcard.cpp
@@ -700,7 +700,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
 						args["FIRST"] = first;
 						args["LAST"] = last;
 					}
-
 				}
 			}
 			else
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 1e404d611c..71e7ae7061 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -640,19 +640,20 @@ 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();
+				std::string url = LLSLURL::buildCommand("objectim", chat.mFromID, "");
 				url += "?name=" + chat.mFromName;
 				url += "&owner=" + args["owner_id"].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();
-				      }
+					LLViewerRegion *region = LLWorld::getInstance()->getRegionFromPosAgent(chat.mPosAgent);
+					if (region)
+					{
+						S32 x, y, z;
+						LLSLURL::globalPosToXYZ(LLVector3d(chat.mPosAgent), x, y, z);
+						slurl = region->getName() + llformat("/%d/%d/%d", x, y, z);
+					}
 				}
 				url += "&slurl=" + slurl;
 
diff --git a/indra/newview/llcurrencyuimanager.cpp b/indra/newview/llcurrencyuimanager.cpp
index fd3df359bd..be6c15eab4 100644
--- a/indra/newview/llcurrencyuimanager.cpp
+++ b/indra/newview/llcurrencyuimanager.cpp
@@ -284,7 +284,7 @@ void LLCurrencyUIManager::Impl::startTransaction(TransactionType type,
 	static std::string transactionURI;
 	if (transactionURI.empty())
 	{
-		transactionURI = LLGridManager::getInstance()->getHelperURI() + "currency.php";
+		transactionURI = LLViewerLogin::getInstance()->getHelperURI() + "currency.php";
 	}
 
 	delete mTransaction;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 56bc4a7933..ef69f39ad2 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -266,18 +266,8 @@ LLSD LLFloaterAbout::getInfo()
 	info["J2C_VERSION"] = LLImageJ2C::getEngineInfo();
 	bool want_fullname = true;
 	info["AUDIO_DRIVER_VERSION"] = gAudiop ? LLSD(gAudiop->getDriverName(want_fullname)) : LLSD();
-	if(LLVoiceClient::getInstance()->voiceEnabled())
-	{
-		LLVoiceVersionInfo version = LLVoiceClient::getInstance()->getVersion();
-		std::ostringstream version_string;
-		version_string << version.serverType << " " << version.serverVersion << std::endl;
-		info["VOICE_VERSION"] = version_string.str();
-	}
-	else 
-	{
-		info["VOICE_VERSION"] = LLTrans::getString("NotConnected");
-	}
-	
+	info["VIVOX_VERSION"] = gVoiceClient ? gVoiceClient->getAPIVersion() : LLTrans::getString("NotConnected");
+
 	// TODO: Implement media plugin version query
 	info["QT_WEBKIT_VERSION"] = "4.6 (version number hard-coded)";
 
diff --git a/indra/newview/llfloaterbuyland.cpp b/indra/newview/llfloaterbuyland.cpp
index 464b3a7214..d37bc01885 100644
--- a/indra/newview/llfloaterbuyland.cpp
+++ b/indra/newview/llfloaterbuyland.cpp
@@ -830,7 +830,7 @@ void LLFloaterBuyLandUI::updateNames()
 	else
 	{
 		mParcelSellerName =
-			LLSLURL("agent", parcelp->getOwnerID(), "inspect").getSLURLString();
+			LLSLURL::buildCommand("agent", parcelp->getOwnerID(), "inspect");
 	}
 }
 
@@ -859,7 +859,7 @@ void LLFloaterBuyLandUI::startTransaction(TransactionType type, const LLXMLRPCVa
 	static std::string transaction_uri;
 	if (transaction_uri.empty())
 	{
-		transaction_uri = LLGridManager::getInstance()->getHelperURI() + "landtool.php";
+		transaction_uri = LLViewerLogin::getInstance()->getHelperURI() + "landtool.php";
 	}
 	
 	const char* method;
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index 882d12f68e..cdb9b8edb8 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -166,7 +166,7 @@ void add_timestamped_line(LLViewerTextEditor* edit, LLChat chat, const LLColor4&
 	if (chat.mSourceType == CHAT_SOURCE_AGENT &&
 		chat.mFromID != LLUUID::null)
 	{
-		chat.mURL = LLSLURL("agent", chat.mFromID, "inspect").getSLURLString();
+		chat.mURL = LLSLURL::buildCommand("agent", chat.mFromID, "inspect");
 	}
 
 	// If the chat line has an associated url, link it up to the name.
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index a15cef7ea4..774caaec90 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -318,7 +318,7 @@ LLFloaterChatterBox* LLFloaterChatterBox::getInstance()
 //static 
 LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
 {
-	if (!LLVoiceClient::getInstance()->voiceEnabled())
+	if (!LLVoiceClient::voiceEnabled())
 	{
 		return NULL;
 	}
diff --git a/indra/newview/llfloaterevent.cpp b/indra/newview/llfloaterevent.cpp
index 84a5c3dc77..97ebab3425 100644
--- a/indra/newview/llfloaterevent.cpp
+++ b/indra/newview/llfloaterevent.cpp
@@ -193,7 +193,7 @@ void LLFloaterEvent::processEventInfoReply(LLMessageSystem *msg, void **)
 		floater->mTBCategory->setText(floater->mEventInfo.mCategoryStr);
 		floater->mTBDate->setText(floater->mEventInfo.mTimeStr);
 		floater->mTBDesc->setText(floater->mEventInfo.mDesc);
-		floater->mTBRunBy->setText(LLSLURL("agent", floater->mEventInfo.mRunByID, "inspect").getSLURLString());
+		floater->mTBRunBy->setText(LLSLURL::buildCommand("agent", floater->mEventInfo.mRunByID, "inspect"));
 
 		floater->mTBDuration->setText(llformat("%d:%.2d", floater->mEventInfo.mDuration / 60, floater->mEventInfo.mDuration % 60));
 
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 25d3f971b5..02c83dcd09 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -42,6 +42,7 @@
 #include "llnotificationsutil.h"
 #include "llparcel.h"
 #include "message.h"
+#include "lluserauth.h"
 
 #include "llagent.h"
 #include "llbutton.h"
@@ -803,7 +804,7 @@ void LLPanelLandGeneral::refreshNames()
 	else
 	{
 		// Figure out the owner's name
-		owner = LLSLURL("agent", parcel->getOwnerID(), "inspect").getSLURLString();
+		owner = LLSLURL::buildCommand("agent", parcel->getOwnerID(), "inspect");
 	}
 
 	if(LLParcel::OS_LEASE_PENDING == parcel->getOwnershipStatus())
@@ -815,7 +816,7 @@ void LLPanelLandGeneral::refreshNames()
 	std::string group;
 	if (!parcel->getGroupID().isNull())
 	{
-		group = LLSLURL("group", parcel->getGroupID(), "inspect").getSLURLString();
+		group = LLSLURL::buildCommand("group", parcel->getGroupID(), "inspect");
 	}
 	mTextGroup->setText(group);
 
@@ -824,9 +825,9 @@ void LLPanelLandGeneral::refreshNames()
 		const LLUUID& auth_buyer_id = parcel->getAuthorizedBuyerID();
 		if(auth_buyer_id.notNull())
 		{
-		  std::string name;
-		  name = LLSLURL("agent", auth_buyer_id, "inspect").getSLURLString();
-		  mSaleInfoForSale2->setTextArg("[BUYER]", name);
+			std::string name;
+			name = LLSLURL::buildCommand("agent", auth_buyer_id, "inspect");
+			mSaleInfoForSale2->setTextArg("[BUYER]", name);
 		}
 		else
 		{
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 3a73037ae8..764a0dc954 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -595,7 +595,7 @@ void LLFloaterPreference::onBtnOK()
 		llinfos << "Can't close preferences!" << llendl;
 	}
 
-	LLPanelLogin::updateLocationCombo( false );
+	LLPanelLogin::refreshLocation( false );
 }
 
 // static 
@@ -612,7 +612,7 @@ void LLFloaterPreference::onBtnApply( )
 	apply();
 	saveSettings();
 
-	LLPanelLogin::updateLocationCombo( false );
+	LLPanelLogin::refreshLocation( false );
 }
 
 // static 
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 8c219cb3fd..3758cbe74f 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -2922,7 +2922,8 @@ bool LLDispatchEstateUpdateInfo::operator()(
 	LLUUID owner_id(strings[1]);
 	regionp->setOwner(owner_id);
 	// Update estate owner name in UI
-	std::string owner_name = LLSLURL("agent", owner_id, "inspect").getSLURLString();
+	std::string owner_name =
+		LLSLURL::buildCommand("agent", owner_id, "inspect");
 	panel->setOwnerName(owner_name);
 
 	U32 estate_id = strtoul(strings[2].c_str(), NULL, 10);
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index f7c8855bf6..b42b34835d 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -126,9 +126,7 @@ void LLFloaterReporter::processRegionInfo(LLMessageSystem* msg)
 // virtual
 BOOL LLFloaterReporter::postBuild()
 {
-	LLSLURL slurl;
-	LLAgentUI::buildSLURL(slurl);
-	childSetText("abuse_location_edit", slurl.getSLURLString());
+	childSetText("abuse_location_edit", LLAgentUI::buildSLURL());
 
 	enableControls(TRUE);
 
@@ -282,6 +280,7 @@ void LLFloaterReporter::getObjectInfo(const LLUUID& object_id)
 				{
 					object_owner.append("Unknown");
 				}
+
 				setFromAvatar(mObjectID, object_owner);
 			}
 			else
@@ -326,8 +325,7 @@ void LLFloaterReporter::setFromAvatar(const LLUUID& avatar_id, const std::string
 	mAbuserID = mObjectID = avatar_id;
 	mOwnerName = avatar_name;
 
-	std::string avatar_link =
-	  LLSLURL("agent", mObjectID, "inspect").getSLURLString();
+	std::string avatar_link = LLSLURL::buildCommand("agent", mObjectID, "inspect");
 	childSetText("owner_name", avatar_link);
 	childSetText("object_name", avatar_name);
 	childSetText("abuser_name_edit", avatar_name);
@@ -506,7 +504,7 @@ void LLFloaterReporter::setPickedObjectProperties(const std::string& object_name
 {
 	childSetText("object_name", object_name);
 	std::string owner_link =
-		LLSLURL("agent", owner_id, "inspect").getSLURLString();
+		LLSLURL::buildCommand("agent", owner_id, "inspect");
 	childSetText("owner_name", owner_link);
 	childSetText("abuser_name_edit", owner_name);
 	mAbuserID = owner_id;
@@ -568,7 +566,7 @@ LLSD LLFloaterReporter::gatherReport()
 	mCopyrightWarningSeen = FALSE;
 
 	std::ostringstream summary;
-	if (!LLGridManager::getInstance()->isInProductionGrid())
+	if (!LLViewerLogin::getInstance()->isInProductionGrid())
 	{
 		summary << "Preview ";
 	}
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index aae379afe2..adac9861d4 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -1123,7 +1123,7 @@ void LLSnapshotLivePreview::saveWeb(std::string url)
 
 void LLSnapshotLivePreview::regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z)
 {
-	body["slurl"] = LLSLURL(name, LLVector3d(x, y, z)).getSLURLString();
+	body["slurl"] = LLSLURL::buildSLURL(name, x, y, z);
 
 	LLHTTPClient::post(url, body,
 		new LLSendWebResponder());
diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp
index 63365e3461..638c9f1b8c 100644
--- a/indra/newview/llfloatervoicedevicesettings.cpp
+++ b/indra/newview/llfloatervoicedevicesettings.cpp
@@ -64,6 +64,9 @@ LLPanelVoiceDeviceSettings::LLPanelVoiceDeviceSettings()
 	// grab "live" mic volume level
 	mMicVolume = gSavedSettings.getF32("AudioLevelMic");
 
+	// ask for new device enumeration
+	// now do this in onOpen() instead...
+	//gVoiceClient->refreshDeviceLists();
 }
 
 LLPanelVoiceDeviceSettings::~LLPanelVoiceDeviceSettings()
@@ -102,7 +105,7 @@ void LLPanelVoiceDeviceSettings::draw()
 	refresh();
 
 	// let user know that volume indicator is not yet available
-	bool is_in_tuning_mode = LLVoiceClient::getInstance()->inTuningMode();
+	bool is_in_tuning_mode = gVoiceClient->inTuningMode();
 	childSetVisible("wait_text", !is_in_tuning_mode);
 
 	LLPanel::draw();
@@ -110,7 +113,7 @@ void LLPanelVoiceDeviceSettings::draw()
 	if (is_in_tuning_mode)
 	{
 		const S32 num_bars = 5;
-		F32 voice_power = LLVoiceClient::getInstance()->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+		F32 voice_power = gVoiceClient->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
 		S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
 
 		for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
@@ -191,13 +194,13 @@ void LLPanelVoiceDeviceSettings::refresh()
 	LLSlider* volume_slider = getChild<LLSlider>("mic_volume_slider");
 	// set mic volume tuning slider based on last mic volume setting
 	F32 current_volume = (F32)volume_slider->getValue().asReal();
-	LLVoiceClient::getInstance()->tuningSetMicVolume(current_volume);
+	gVoiceClient->tuningSetMicVolume(current_volume);
 
 	// Fill in popup menus
 	mCtrlInputDevices = getChild<LLComboBox>("voice_input_device");
 	mCtrlOutputDevices = getChild<LLComboBox>("voice_output_device");
 
-	if(!LLVoiceClient::getInstance()->deviceSettingsAvailable())
+	if(!gVoiceClient->deviceSettingsAvailable())
 	{
 		// The combo boxes are disabled, since we can't get the device settings from the daemon just now.
 		// Put the currently set default (ONLY) in the box, and select it.
@@ -216,16 +219,17 @@ void LLPanelVoiceDeviceSettings::refresh()
 	}
 	else if (!mDevicesUpdated)
 	{
-		LLVoiceDeviceList::const_iterator iter;
+		LLVoiceClient::deviceList *devices;
+		
+		LLVoiceClient::deviceList::iterator iter;
 		
 		if(mCtrlInputDevices)
 		{
 			mCtrlInputDevices->removeall();
 			mCtrlInputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			for(iter=LLVoiceClient::getInstance()->getCaptureDevices().begin(); 
-				iter != LLVoiceClient::getInstance()->getCaptureDevices().end();
-				iter++)
+			devices = gVoiceClient->getCaptureDevices();
+			for(iter=devices->begin(); iter != devices->end(); iter++)
 			{
 				mCtrlInputDevices->add( *iter, ADD_BOTTOM );
 			}
@@ -241,8 +245,8 @@ void LLPanelVoiceDeviceSettings::refresh()
 			mCtrlOutputDevices->removeall();
 			mCtrlOutputDevices->add( getString("default_text"), ADD_BOTTOM );
 
-			for(iter= LLVoiceClient::getInstance()->getRenderDevices().begin(); 
-				iter !=  LLVoiceClient::getInstance()->getRenderDevices().end(); iter++)
+			devices = gVoiceClient->getRenderDevices();
+			for(iter=devices->begin(); iter != devices->end(); iter++)
 			{
 				mCtrlOutputDevices->add( *iter, ADD_BOTTOM );
 			}
@@ -264,34 +268,37 @@ void LLPanelVoiceDeviceSettings::initialize()
 	mDevicesUpdated = FALSE;
 
 	// ask for new device enumeration
-	LLVoiceClient::getInstance()->refreshDeviceLists();
+	gVoiceClient->refreshDeviceLists();
 
 	// put voice client in "tuning" mode
-	LLVoiceClient::getInstance()->tuningStart();
+	gVoiceClient->tuningStart();
 	LLVoiceChannel::suspend();
 }
 
 void LLPanelVoiceDeviceSettings::cleanup()
 {
-	LLVoiceClient::getInstance()->tuningStop();
+	if (gVoiceClient)
+	{
+		gVoiceClient->tuningStop();
+	}
 	LLVoiceChannel::resume();
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitInputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->setCaptureDevice(ctrl->getValue().asString());
+		gVoiceClient->setCaptureDevice(ctrl->getValue().asString());
 	}
 }
 
 // static
 void LLPanelVoiceDeviceSettings::onCommitOutputDevice(LLUICtrl* ctrl, void* user_data)
 {
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->setRenderDevice(ctrl->getValue().asString());
+		gVoiceClient->setRenderDevice(ctrl->getValue().asString());
 	}
 }
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 896c410e32..f17c9765b9 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -461,7 +461,7 @@ void LLFloaterWorldMap::draw()
 	childSetEnabled("Teleport", (BOOL)tracking_status);
 //	childSetEnabled("Clear", (BOOL)tracking_status);
 	childSetEnabled("Show Destination", (BOOL)tracking_status || LLWorldMap::getInstance()->isTracking());
-	childSetEnabled("copy_slurl", (mSLURL.isValid()) );
+	childSetEnabled("copy_slurl", (mSLURL.size() > 0) );
 
 	setMouseOpaque(TRUE);
 	getDragHandle()->setMouseOpaque(TRUE);
@@ -660,8 +660,14 @@ void LLFloaterWorldMap::updateLocation()
 				childSetValue("location", agent_sim_name);
 
 				// Figure out where user is
+				LLVector3d agentPos = gAgent.getPositionGlobal();
+
+				S32 agent_x = llround( (F32)fmod( agentPos.mdV[VX], (F64)REGION_WIDTH_METERS ) );
+				S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
+				S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
+
 				// Set the current SLURL
-				mSLURL = LLSLURL(agent_sim_name, gAgent.getPositionGlobal());
+				mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
 			}
 		}
 
@@ -688,15 +694,18 @@ void LLFloaterWorldMap::updateLocation()
 		}
 
 		childSetValue("location", sim_name);
+		
+		F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
+		F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
 
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
 		{
-		  mSLURL = LLSLURL(sim_name, pos_global);
+			mSLURL = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)pos_global.mdV[VZ]));
 		}
 		else
 		{	// Empty SLURL will disable the "Copy SLURL to clipboard" button
-			mSLURL = LLSLURL();
+			mSLURL = "";
 		}
 	}
 }
@@ -1165,7 +1174,7 @@ void LLFloaterWorldMap::onClearBtn()
 	mTrackedStatus = LLTracker::TRACKING_NOTHING;
 	LLTracker::stopTracking((void *)(intptr_t)TRUE);
 	LLWorldMap::getInstance()->cancelTracking();
-	mSLURL = LLSLURL();					// Clear the SLURL since it's invalid
+	mSLURL = "";					// Clear the SLURL since it's invalid
 	mSetToUserPosition = TRUE;	// Revert back to the current user position
 }
 
@@ -1188,10 +1197,10 @@ void LLFloaterWorldMap::onClickTeleportBtn()
 
 void LLFloaterWorldMap::onCopySLURL()
 {
-	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL.getSLURLString()));
+	getWindow()->copyTextToClipboard(utf8str_to_wstring(mSLURL));
 	
 	LLSD args;
-	args["SLURL"] = mSLURL.getSLURLString();
+	args["SLURL"] = mSLURL;
 
 	LLNotificationsUtil::add("CopySLURL", args);
 }
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 52809ff830..00f5e788fb 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -43,7 +43,6 @@
 #include "llhudtext.h"
 #include "llmapimagetype.h"
 #include "lltracker.h"
-#include "llslurl.h"
 
 class LLEventInfo;
 class LLFriendObserver;
@@ -184,7 +183,7 @@ private:
 	LLTracker::ETrackingStatus mTrackedStatus;
 	std::string				mTrackedSimName;
 	std::string				mTrackedAvatarName;
-	LLSLURL  				mSLURL;
+	std::string				mSLURL;
 };
 
 extern LLFloaterWorldMap* gFloaterWorldMap;
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 03a47b5983..8a056f836f 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -287,7 +287,7 @@ bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
 		return gAgent.getGroupID() != selected_group_id;
 
 	if (userdata.asString() == "call")
-	  return real_group_selected && LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		return real_group_selected && LLVoiceClient::voiceEnabled()&&gVoiceClient->voiceWorking();
 
 	return real_group_selected;
 }
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 9704c7537a..3ec8d11fb0 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -58,6 +58,7 @@
 #include "lltransientfloatermgr.h"
 #include "llinventorymodel.h"
 #include "llrootview.h"
+
 #include "llspeakers.h"
 
 
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 0e3b78df7f..4bdf5f42dc 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -300,7 +300,7 @@ void LLFloaterIMPanel::onVolumeChange(LLUICtrl* source, void* user_data)
 	LLFloaterIMPanel* floaterp = (LLFloaterIMPanel*)user_data;
 	if (floaterp)
 	{
-		LLVoiceClient::getInstance()->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
+		gVoiceClient->setUserVolume(floaterp->mOtherParticipantUUID, (F32)source->getValue().asReal());
 	}
 }
 
@@ -312,7 +312,7 @@ void LLFloaterIMPanel::draw()
 	
 	BOOL enable_connect = (region && region->getCapability("ChatSessionRequest") != "")
 					  && mSessionInitialized
-					  && LLVoiceClient::getInstance()->voiceEnabled()
+					  && LLVoiceClient::voiceEnabled()
 					  && mCallBackEnabled;
 
 	// hide/show start call and end call buttons
@@ -320,8 +320,8 @@ void LLFloaterIMPanel::draw()
 	if (!voice_channel)
 		return;
 
-	childSetVisible("end_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
-	childSetVisible("start_call_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("end_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED);
+	childSetVisible("start_call_btn", LLVoiceClient::voiceEnabled() && voice_channel->getState() < LLVoiceChannel::STATE_CALL_STARTED);
 	childSetEnabled("start_call_btn", enable_connect);
 	childSetEnabled("send_btn", !childGetValue("chat_editor").asString().empty());
 	
@@ -384,11 +384,11 @@ void LLFloaterIMPanel::draw()
 	else
 	{
 		// refresh volume and mute checkbox
-		childSetVisible("speaker_volume", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
-		childSetValue("speaker_volume", LLVoiceClient::getInstance()->getUserVolume(mOtherParticipantUUID));
+		childSetVisible("speaker_volume", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
+		childSetValue("speaker_volume", gVoiceClient->getUserVolume(mOtherParticipantUUID));
 
 		childSetValue("mute_btn", LLMuteList::getInstance()->isMuted(mOtherParticipantUUID, LLMute::flagVoiceChat));
-		childSetVisible("mute_btn", LLVoiceClient::getInstance()->voiceEnabled() && voice_channel->isActive());
+		childSetVisible("mute_btn", LLVoiceClient::voiceEnabled() && voice_channel->isActive());
 	}
 	LLFloater::draw();
 }
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 5201f92dbc..e0f155a6a9 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -344,13 +344,13 @@ LLIMModel::LLIMSession::~LLIMSession()
 	mSpeakers = NULL;
 
 	// End the text IM session if necessary
-	if(LLVoiceClient::getInstance() && mOtherParticipantID.notNull())
+	if(gVoiceClient && mOtherParticipantID.notNull())
 	{
 		switch(mType)
 		{
 		case IM_NOTHING_SPECIAL:
 		case IM_SESSION_P2P_INVITE:
-			LLVoiceClient::getInstance()->endUserIMSession(mOtherParticipantID);
+			gVoiceClient->endUserIMSession(mOtherParticipantID);
 			break;
 
 		default:
@@ -925,7 +925,7 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 	if((offline == IM_OFFLINE) && (LLVoiceClient::getInstance()->isOnlineSIP(other_participant_id)))
 	{
 		// User is online through the OOW connector, but not with a regular viewer.  Try to send the message via SLVoice.
-		sent = LLVoiceClient::getInstance()->sendTextMessage(other_participant_id, utf8_text);
+		sent = gVoiceClient->sendTextMessage(other_participant_id, utf8_text);
 	}
 	
 	if(!sent)
@@ -1717,7 +1717,7 @@ void LLOutgoingCallDialog::show(const LLSD& key)
 
 		// skipping "You will now be reconnected to nearby" in notification when call is ended by disabling voice,
 		// so no reconnection to nearby chat happens (EXT-4397)
-		bool voice_works = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		bool voice_works = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 		std::string reconnect_nearby = voice_works ? LLTrans::getString("reconnect_nearby") : std::string();
 		childSetTextArg("nearby", "[RECONNECT_NEARBY]", reconnect_nearby);
 
@@ -1843,11 +1843,7 @@ LLCallDialog(payload)
 void LLIncomingCallDialog::onLifetimeExpired()
 {
 	// check whether a call is valid or not
-	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mPayload["session_id"].asUUID());
-	if(channelp &&
-	   (channelp->getState() != LLVoiceChannel::STATE_NO_CHANNEL_INFO) &&
-	   (channelp->getState() != LLVoiceChannel::STATE_ERROR) &&
-	   (channelp->getState() != LLVoiceChannel::STATE_HUNG_UP))
+	if (LLVoiceClient::getInstance()->findSession(mPayload["caller_id"].asUUID()))
 	{
 		// restart notification's timer if call is still valid
 		mLifetimeTimer.start();
@@ -2081,10 +2077,10 @@ void LLIncomingCallDialog::processCallResponse(S32 response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-			if(LLVoiceClient::getInstance())
+			if(gVoiceClient)
 			{
 				std::string s = mPayload["session_handle"].asString();
-				LLVoiceClient::getInstance()->declineInvite(s);
+				gVoiceClient->declineInvite(s);
 			}
 		}
 		else
@@ -2172,8 +2168,11 @@ bool inviteUserResponse(const LLSD& notification, const LLSD& response)
 	{
 		if (type == IM_SESSION_P2P_INVITE)
 		{
-		  std::string s = payload["session_handle"].asString();
-		  LLVoiceClient::getInstance()->declineInvite(s);
+			if(gVoiceClient)
+			{
+				std::string s = payload["session_handle"].asString();
+				gVoiceClient->declineInvite(s);
+			}
 		}
 		else
 		{
@@ -3079,7 +3078,7 @@ public:
 				return;
 			}
 			
-			if(!LLVoiceClient::getInstance()->voiceEnabled())
+			if(!LLVoiceClient::voiceEnabled())
 			{
 				// Don't display voice invites unless the user has voice enabled.
 				return;
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 1299324105..94ea236757 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -536,7 +536,8 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled)
 
 void LLInspectAvatar::updateVolumeSlider()
 {
-	bool voice_enabled = LLVoiceClient::getInstance()->getVoiceEnabled(mAvatarID);
+
+	bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
 
 	// Do not display volume slider and mute button if it 
 	// is ourself or we are not in a voice channel together
@@ -566,7 +567,6 @@ void LLInspectAvatar::updateVolumeSlider()
 		volume_slider->setEnabled( !is_muted );
 
 		F32 volume;
-		
 		if (is_muted)
 		{
 			// it's clearer to display their volume as zero
@@ -575,7 +575,7 @@ void LLInspectAvatar::updateVolumeSlider()
 		else
 		{
 			// actual volume
-			volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID);
+			volume = gVoiceClient->getUserVolume(mAvatarID);
 		}
 		volume_slider->setValue( (F64)volume );
 	}
@@ -604,7 +604,7 @@ void LLInspectAvatar::onClickMuteVolume()
 void LLInspectAvatar::onVolumeChange(const LLSD& data)
 {
 	F32 volume = (F32)data.asReal();
-	LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume);
+	gVoiceClient->setUserVolume(mAvatarID, volume);
 }
 
 void LLInspectAvatar::nameUpdatedCallback(
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index a2b5ffbac4..91cbbbf430 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -480,7 +480,7 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		// Objects cannot be created by a group, so use agent URL format
 		LLUUID creator_id = nodep->mPermissions->getCreator();
 		std::string creator_url =
-			LLSLURL("agent", creator_id, "about").getSLURLString();
+			LLSLURL::buildCommand("agent", creator_id, "about");
 		args["[CREATOR]"] = creator_url;
 				
 		// created by one user but owned by another
@@ -490,12 +490,12 @@ void LLInspectObject::updateCreator(LLSelectNode* nodep)
 		if (group_owned)
 		{
 			owner_id = nodep->mPermissions->getGroup();
-			owner_url =	LLSLURL("group", owner_id, "about").getSLURLString();
+			owner_url =	LLSLURL::buildCommand("group", owner_id, "about");
 		}
 		else
 		{
 			owner_id = nodep->mPermissions->getOwner();
-			owner_url =	LLSLURL("agent", owner_id, "about").getSLURLString();
+			owner_url =	LLSLURL::buildCommand("agent", owner_id, "about");
 		}
 		args["[OWNER]"] = owner_url;
 		
diff --git a/indra/newview/llinspectremoteobject.cpp b/indra/newview/llinspectremoteobject.cpp
index 97ff771658..66e4a1bf66 100644
--- a/indra/newview/llinspectremoteobject.cpp
+++ b/indra/newview/llinspectremoteobject.cpp
@@ -176,11 +176,11 @@ void LLInspectRemoteObject::update()
 	{
 		if (mGroupOwned)
 		{
-			owner = LLSLURL("group", mOwnerID, "about").getSLURLString();
+			owner = LLSLURL::buildCommand("group", mOwnerID, "about");
 		}
 		else
 		{
-			owner = LLSLURL("agent", mOwnerID, "about").getSLURLString();
+			owner = LLSLURL::buildCommand("agent", mOwnerID, "about");
 		}
 	}
 	else
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index b6202c6a8c..d1cc0ae936 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1329,6 +1329,7 @@ bool LLInventoryModel::fetchDescendentsOf(const LLUUID& folder_id)
 	return cat->fetchDescendents();
 }
 
+
 void LLInventoryModel::cache(
 	const LLUUID& parent_folder_id,
 	const LLUUID& agent_id)
diff --git a/indra/newview/lllandmarkactions.cpp b/indra/newview/lllandmarkactions.cpp
index 539ca97a93..7336efb62a 100644
--- a/indra/newview/lllandmarkactions.cpp
+++ b/indra/newview/lllandmarkactions.cpp
@@ -299,7 +299,7 @@ void LLLandmarkActions::getSLURLfromPosGlobal(const LLVector3d& global_pos, slur
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-	  std::string slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+		std::string slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
 		cb(slurl);
 
 		return;
@@ -351,7 +351,7 @@ void LLLandmarkActions::onRegionResponseSLURL(slurl_callback_t cb,
 	bool gotSimName = LLWorldMap::getInstance()->simNameFromPosGlobal(global_pos, sim_name);
 	if (gotSimName)
 	{
-	  slurl = LLSLURL(sim_name, global_pos).getSLURLString();
+		slurl = LLSLURL::buildSLURLfromPosGlobal(sim_name, global_pos, escaped);
 	}
 	else
 	{
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 3b4a4a1344..ad2e594b49 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -668,8 +668,9 @@ void LLLocationInputCtrl::onLocationPrearrange(const LLSD& data)
 				value["item_type"] = TELEPORT_HISTORY;
 				value["global_pos"] = result->mGlobalPos.getValue();
 				std::string region_name = result->mTitle.substr(0, result->mTitle.find(','));
-				//TODO*: add Surl to teleportitem or parse region name from title
-				value["tooltip"] = LLSLURL(region_name, result->mGlobalPos).getSLURLString();
+				//TODO*: add slurl to teleportitem or parse region name from title
+				value["tooltip"] = LLSLURL::buildSLURLfromPosGlobal(region_name,
+						result->mGlobalPos,	false);
 				add(result->getTitle(), value); 
 			}
 			result = std::find_if(result + 1, th_items.end(), boost::bind(
@@ -1010,9 +1011,7 @@ void LLLocationInputCtrl::changeLocationPresentation()
 	if(!mTextEntry->hasSelection() && text == mHumanReadableLocation)
 	{
 		//needs unescaped one
-		LLSLURL slurl;
-		LLAgentUI::buildSLURL(slurl, false);
-		mTextEntry->setText(slurl.getSLURLString());
+		mTextEntry->setText(LLAgentUI::buildSLURL(false));
 		mTextEntry->selectAll();
 
 		mMaturityIcon->setVisible(FALSE);
diff --git a/indra/newview/llloginhandler.cpp b/indra/newview/llloginhandler.cpp
index 4e0a7594ba..e3817eecc4 100644
--- a/indra/newview/llloginhandler.cpp
+++ b/indra/newview/llloginhandler.cpp
@@ -35,14 +35,13 @@
 #include "llloginhandler.h"
 
 // viewer includes
-#include "llsecapi.h"
 #include "lllogininstance.h"        // to check if logged in yet
 #include "llpanellogin.h"			// save_password_to_disk()
 #include "llstartup.h"				// getStartupState()
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llviewercontrol.h"		// gSavedSettings
 #include "llviewernetwork.h"		// EGridInfo
-#include "llviewerwindow.h"                    // getWindow()
+#include "llviewerwindow.h"			// getWindow()
 
 // library includes
 #include "llmd5.h"
@@ -61,33 +60,109 @@ bool LLLoginHandler::parseDirectLogin(std::string url)
 	LLURI uri(url);
 	parse(uri.queryMap());
 
-	// NOTE: Need to add direct login as per identity evolution
-	return true;
+	if (/*mWebLoginKey.isNull() ||*/
+		mFirstName.empty() ||
+		mLastName.empty())
+	{
+		return false;
+	}
+	else
+	{
+		return true;
+	}
 }
 
+
 void LLLoginHandler::parse(const LLSD& queryMap)
 {
+	//mWebLoginKey = queryMap["web_login_key"].asUUID();
+	mFirstName = queryMap["first_name"].asString();
+	mLastName = queryMap["last_name"].asString();
 	
-	if (queryMap.has("grid"))
+	EGridInfo grid_choice = GRID_INFO_NONE;
+	if (queryMap["grid"].asString() == "aditi")
 	{
-	  LLGridManager::getInstance()->setGridChoice(queryMap["grid"].asString());
+		grid_choice = GRID_INFO_ADITI;
 	}
-	
-	
-	std::string startLocation = queryMap["location"].asString();
-	
-	if (startLocation == "specify")
+	else if (queryMap["grid"].asString() == "agni")
+	{
+		grid_choice = GRID_INFO_AGNI;
+	}
+	else if (queryMap["grid"].asString() == "siva")
+	{
+		grid_choice = GRID_INFO_SIVA;
+	}
+	else if (queryMap["grid"].asString() == "damballah")
+	{
+		grid_choice = GRID_INFO_DAMBALLAH;
+	}
+	else if (queryMap["grid"].asString() == "durga")
+	{
+		grid_choice = GRID_INFO_DURGA;
+	}
+	else if (queryMap["grid"].asString() == "shakti")
+	{
+		grid_choice = GRID_INFO_SHAKTI;
+	}
+	else if (queryMap["grid"].asString() == "soma")
+	{
+		grid_choice = GRID_INFO_SOMA;
+	}
+	else if (queryMap["grid"].asString() == "ganga")
+	{
+		grid_choice = GRID_INFO_GANGA;
+	}
+	else if (queryMap["grid"].asString() == "vaak")
+	{
+		grid_choice = GRID_INFO_VAAK;
+	}
+	else if (queryMap["grid"].asString() == "uma")
+	{
+		grid_choice = GRID_INFO_UMA;
+	}
+	else if (queryMap["grid"].asString() == "mohini")
+	{
+		grid_choice = GRID_INFO_MOHINI;
+	}
+	else if (queryMap["grid"].asString() == "yami")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLGridManager::getInstance()->getGridLoginID(),
-					   queryMap["region"].asString()));
+		grid_choice = GRID_INFO_YAMI;
 	}
-	else if (startLocation == "home")
+	else if (queryMap["grid"].asString() == "nandi")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+		grid_choice = GRID_INFO_NANDI;
 	}
-	else if (startLocation == "last")
+	else if (queryMap["grid"].asString() == "mitra")
 	{
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
+		grid_choice = GRID_INFO_MITRA;
+	}
+	else if (queryMap["grid"].asString() == "radha")
+	{
+		grid_choice = GRID_INFO_RADHA;
+	}
+	else if (queryMap["grid"].asString() == "ravi")
+	{
+		grid_choice = GRID_INFO_RAVI;
+	}
+	else if (queryMap["grid"].asString() == "aruna")
+	{
+		grid_choice = GRID_INFO_ARUNA;
+	}
+
+	if(grid_choice != GRID_INFO_NONE)
+	{
+		LLViewerLogin::getInstance()->setGridChoice(grid_choice);
+	}
+
+	std::string startLocation = queryMap["location"].asString();
+
+	if (startLocation == "specify")
+	{
+		LLURLSimString::setString(queryMap["region"].asString());
+	}
+	else if (!startLocation.empty()) // "last" or "home" or ??? (let LLURLSimString figure it out)
+	{
+		LLURLSimString::setString(startLocation);
 	}
 }
 
@@ -145,65 +220,40 @@ bool LLLoginHandler::handle(const LLSD& tokens,
 		return true;
 	}
 	
-	if  (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page         
-	{
-	  // as the login page may change from grid to grid, as well as
-	  // things like username/password/etc, we simply refresh the
-	  // login page to make sure everything is set up correctly
-	  LLPanelLogin::loadLoginPage();
-	  LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
-	}
-	return true;
-}
-
+	std::string password = query_map["password"].asString();
 
+	if (!password.empty())
+	{
+		gSavedSettings.setBOOL("RememberPassword", TRUE);
 
-//  Initialize the credentials                                                                                              
-// If the passed in URL contains login info, parse                                                                          
-// that into a credential and web login key.  Otherwise                                                                     
-// check the command line.  If the command line                                                                             
-// does not contain any login creds, load the last saved                                                                    
-// ones from the protected credential store.                                                                                
-// This always returns with a credential structure set in the                                                               
-// login handler                                                                                                            
-LLPointer<LLCredential> LLLoginHandler::initializeLoginInfo()                                         
-{                                                                                                                           
-	LLPointer<LLCredential> result = NULL;                                                                               
-	// so try to load it from the UserLoginInfo                                                                          
-	result = loadSavedUserLoginInfo();                                                                                   
-	if (result.isNull())                                                                                                 
-	{                                                                                                                    
-		result =  gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());                       
-	}                                                                                                                    
-	
-	return result;                                                                                                       
-} 
-
+		if (password.substr(0,3) != "$1$")
+		{
+			LLMD5 pass((unsigned char*)password.c_str());
+			char md5pass[33];		/* Flawfinder: ignore */
+			pass.hex_digest(md5pass);
+			std::string hashed_password = ll_safe_string(md5pass, 32);
+			LLStartUp::savePasswordToDisk(hashed_password);
+		}
+	}
+			
 
-LLPointer<LLCredential> LLLoginHandler::loadSavedUserLoginInfo()
-{
-  // load the saved user login info into a LLCredential.
-  // perhaps this should be moved.
-	LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-	if (cmd_line_login.size() == 3) 
+	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)  //on splash page
 	{
-	
-		LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
-		char md5pass[33];               /* Flawfinder: ignore */
-		pass.hex_digest(md5pass);
-		LLSD identifier = LLSD::emptyMap();
-		identifier["type"] = "agent";
-		identifier["first_name"] = cmd_line_login[0];
-		identifier["last_name"] = cmd_line_login[1];
-		
-		LLSD authenticator = LLSD::emptyMap();
-		authenticator["type"] = "hash";
-		authenticator["algorithm"] = "md5";
-		authenticator["secret"] = md5pass;
-		// yuck, we'll fix this with mani's changes.
-		gSavedSettings.setBOOL("AutoLogin", TRUE);
-		return gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), 
-													   identifier, authenticator);
-	}
-	return NULL;
+		if (!mFirstName.empty() || !mLastName.empty())
+		{
+			// Fill in the name, and maybe the password
+			LLPanelLogin::setFields(mFirstName, mLastName, password);
+		}
+
+		//if (mWebLoginKey.isNull())
+		//{
+		//	LLPanelLogin::loadLoginPage();
+		//}
+		//else
+		//{
+		//	LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+		//}
+		LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
+	}
+	return true;
 }
diff --git a/indra/newview/llloginhandler.h b/indra/newview/llloginhandler.h
index c15b998c91..ac4648761b 100644
--- a/indra/newview/llloginhandler.h
+++ b/indra/newview/llloginhandler.h
@@ -34,7 +34,6 @@
 #define LLLOGINHANDLER_H
 
 #include "llcommandhandler.h"
-#include "llsecapi.h"
 
 class LLLoginHandler : public LLCommandHandler
 {
@@ -47,15 +46,19 @@ class LLLoginHandler : public LLCommandHandler
 	// secondlife:///app/login?first=Bob&last=Dobbs
 	bool parseDirectLogin(std::string url);
 
+	std::string getFirstName() const { return mFirstName; }
+	std::string getLastName() const { return mLastName; }
+
 	// Web-based login unsupported
 	//LLUUID getWebLoginKey() const { return mWebLoginKey; }
 
-	LLPointer<LLCredential> loadSavedUserLoginInfo();  
-	LLPointer<LLCredential> initializeLoginInfo();
-
 private:
 	void parse(const LLSD& queryMap);
 
+private:
+	std::string mFirstName;
+	std::string mLastName;
+	//LLUUID mWebLoginKey;
 };
 
 extern LLLoginHandler gLoginHandler;
diff --git a/indra/newview/lllogininstance.cpp b/indra/newview/lllogininstance.cpp
index 0459c85050..24c72c65ce 100644
--- a/indra/newview/lllogininstance.cpp
+++ b/indra/newview/lllogininstance.cpp
@@ -48,16 +48,13 @@
 // newview
 #include "llviewernetwork.h"
 #include "llviewercontrol.h"
-#include "llslurl.h"
-#include "llstartup.h"
+#include "llurlsimstring.h"
 #include "llfloaterreg.h"
 #include "llnotifications.h"
 #include "llwindow.h"
 #if LL_LINUX || LL_SOLARIS
 #include "lltrans.h"
 #endif
-#include "llsecapi.h"
-#include "llstartup.h"
 
 static const char * const TOS_REPLY_PUMP = "lllogininstance_tos_callback";
 static const char * const TOS_LISTENER_NAME = "lllogininstance_tos";
@@ -86,14 +83,14 @@ LLLoginInstance::~LLLoginInstance()
 {
 }
 
-void LLLoginInstance::connect(LLPointer<LLCredential> credentials)
+void LLLoginInstance::connect(const LLSD& credentials)
 {
 	std::vector<std::string> uris;
-	LLGridManager::getInstance()->getLoginURIs(uris);
+	LLViewerLogin::getInstance()->getLoginURIs(uris);
 	connect(uris.front(), credentials);
 }
 
-void LLLoginInstance::connect(const std::string& uri, LLPointer<LLCredential> credentials)
+void LLLoginInstance::connect(const std::string& uri, const LLSD& credentials)
 {
 	mAttemptComplete = false; // Reset attempt complete at this point!
 	constructAuthParams(credentials);
@@ -105,7 +102,7 @@ void LLLoginInstance::reconnect()
 	// Sort of like connect, only using the pre-existing
 	// request params.
 	std::vector<std::string> uris;
-	LLGridManager::getInstance()->getLoginURIs(uris);
+	LLViewerLogin::getInstance()->getLoginURIs(uris);
 	mLoginModule->connect(uris.front(), mRequestData);
 }
 
@@ -121,7 +118,7 @@ LLSD LLLoginInstance::getResponse()
 	return mResponseData; 
 }
 
-void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credential)
+void LLLoginInstance::constructAuthParams(const LLSD& credentials)
 {
 	// Set up auth request options.
 //#define LL_MINIMIAL_REQUESTED_OPTIONS
@@ -148,10 +145,8 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 	requested_options.append("adult_compliant"); 
 	//requested_options.append("inventory-targets");
 	requested_options.append("buddy-list");
-	requested_options.append("newuser-config");
 	requested_options.append("ui-config");
 #endif
-	requested_options.append("voice-config");
 	requested_options.append("tutorial_setting");
 	requested_options.append("login-flags");
 	requested_options.append("global-textures");
@@ -160,18 +155,20 @@ void LLLoginInstance::constructAuthParams(LLPointer<LLCredential> user_credentia
 		gSavedSettings.setBOOL("UseDebugMenus", TRUE);
 		requested_options.append("god-connect");
 	}
-	
-	// (re)initialize the request params with creds.
-	LLSD request_params = user_credential->getLoginParams();
 
 	char hashed_mac_string[MD5HEX_STR_SIZE];		/* Flawfinder: ignore */
 	LLMD5 hashed_mac;
-	unsigned char MACAddress[MAC_ADDRESS_BYTES];
-	LLUUID::getNodeID(MACAddress);	
-	hashed_mac.update( MACAddress, MAC_ADDRESS_BYTES );
+	hashed_mac.update( gMACAddress, MAC_ADDRESS_BYTES );
 	hashed_mac.finalize();
 	hashed_mac.hex_digest(hashed_mac_string);
-	
+
+	// prepend "$1$" to the password to indicate its the md5'd version.
+	std::string dpasswd("$1$");
+	dpasswd.append(credentials["passwd"].asString());
+
+	// (re)initialize the request params with creds.
+	LLSD request_params(credentials);
+	request_params["passwd"] = dpasswd;
 	request_params["start"] = construct_start_string();
 	request_params["skipoptional"] = mSkipOptionalUpdate;
 	request_params["agree_to_tos"] = false; // Always false here. Set true in 
@@ -250,15 +247,6 @@ void LLLoginInstance::handleLoginFailure(const LLSD& event)
 			LLSD data(LLSD::emptyMap());
 			data["message"] = message_response;
 			data["reply_pump"] = TOS_REPLY_PUMP;
-			if(response.has("error_code"))
-			{
-				data["error_code"] = response["error_code"];
-			}
-			if(response.has("certificate"))
-			{
-				data["certificate"] = response["certificate"];
-			}
-			
 			LLFloaterReg::showInstance("message_critical", data);
 			LLEventPumps::instance().obtain(TOS_REPLY_PUMP)
 				.listen(TOS_LISTENER_NAME,
@@ -466,31 +454,20 @@ bool LLLoginInstance::updateDialogCallback(const LLSD& notification, const LLSD&
 std::string construct_start_string()
 {
 	std::string start;
-	LLSLURL start_slurl = LLStartUp::getStartSLURL();
-	switch(start_slurl.getType())
+	if (LLURLSimString::parse())
 	{
-		case LLSLURL::LOCATION:
-		{
-			// a startup URL was specified
-			LLVector3 position = start_slurl.getPosition();
-			std::string unescaped_start = 
+		// a startup URL was specified
+		std::string unescaped_start = 
 			STRINGIZE(  "uri:" 
-					  << start_slurl.getRegion() << "&" 
-						<< position[VX] << "&" 
-						<< position[VY] << "&" 
-						<< position[VZ]);
-			start = xml_escape_string(unescaped_start);
-			break;
-		}
-		case LLSLURL::HOME_LOCATION:
-		{
-			start = "home";
-			break;
-		}
-		default:
-		{
-			start = "last";
-		}
+						<< LLURLSimString::sInstance.mSimName << "&" 
+						<< LLURLSimString::sInstance.mX << "&" 
+						<< LLURLSimString::sInstance.mY << "&" 
+						<< LLURLSimString::sInstance.mZ);
+		start = xml_escape_string(unescaped_start);
+	}
+	else
+	{
+		start = gSavedSettings.getString("LoginLocation");
 	}
 	return start;
 }
diff --git a/indra/newview/lllogininstance.h b/indra/newview/lllogininstance.h
index 44271bb75e..c8704eddb4 100644
--- a/indra/newview/lllogininstance.h
+++ b/indra/newview/lllogininstance.h
@@ -36,7 +36,6 @@
 #include "lleventdispatcher.h"
 #include <boost/scoped_ptr.hpp>
 #include <boost/function.hpp>
-#include "llsecapi.h"
 class LLLogin;
 class LLEventStream;
 class LLNotificationsInterface;
@@ -49,8 +48,8 @@ public:
 	LLLoginInstance();
 	~LLLoginInstance();
 
-	void connect(LLPointer<LLCredential> credentials); // Connect to the current grid choice.
-	void connect(const std::string& uri, LLPointer<LLCredential> credentials);	// Connect to the given uri.
+	void connect(const LLSD& credential); // Connect to the current grid choice.
+	void connect(const std::string& uri, const LLSD& credential);	// Connect to the given uri.
 	void reconnect(); // reconnect using the current credentials.
 	void disconnect();
 
@@ -82,7 +81,7 @@ public:
 	void setUpdaterLauncher(const UpdaterLauncherCallback& ulc) { mUpdaterLauncher = ulc; }
 
 private:
-	void constructAuthParams(LLPointer<LLCredential> user_credentials);
+	void constructAuthParams(const LLSD& credentials); 
 	void updateApp(bool mandatory, const std::string& message);
 	bool updateDialogCallback(const LLSD& notification, const LLSD& response);
 
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index c3d0f1bfc2..e11df06d86 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -52,6 +52,7 @@
 #include "llsearchcombobox.h"
 #include "llsidetray.h"
 #include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llurlregistry.h"
 #include "llurldispatcher.h"
 #include "llviewerinventory.h"
@@ -507,34 +508,29 @@ void LLNavigationBar::onLocationSelection()
 	
 	std::string region_name;
 	LLVector3 local_coords(128, 128, 0);
+	S32 x = 0, y = 0, z = 0;
 	// Is the typed location a SLURL?
-	LLSLURL slurl = LLSLURL(typed_location);
-	if (slurl.getType() == LLSLURL::LOCATION)
+	if (LLSLURL::isSLURL(typed_location))
 	{
-	  region_name = slurl.getRegion();
-	  local_coords = slurl.getPosition();
+		// Yes. Extract region name and local coordinates from it.
+		if (LLURLSimString::parse(LLSLURL::stripProtocol(typed_location), &region_name, &x, &y, &z))
+				local_coords.set(x, y, z);
+		else
+			return;
 	}
-	else if(!slurl.isValid())
+	// we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
+	//but we need to know whether typed_location is a simple http url.
+	else if (LLUrlRegistry::instance().isUrl(typed_location)) 
 	{
-	  // we have to do this check after previous, because LLUrlRegistry contains handlers for slurl too  
-	  // but we need to know whether typed_location is a simple http url.
-	  if (LLUrlRegistry::instance().isUrl(typed_location)) 
-	    {
 		// display http:// URLs in the media browser, or
 		// anything else is sent to the search floater
 		LLWeb::loadURL(typed_location);
 		return;
-	  }
-	  else
-	  {
-	      // assume that an user has typed the {region name} or possible {region_name, parcel}
-	      region_name  = typed_location.substr(0,typed_location.find(','));
-	    }
 	}
 	else
 	{
-	  // was an app slurl, home, whatever.  Bail
-	  return;
+		// assume that an user has typed the {region name} or possible {region_name, parcel}
+		region_name  = typed_location.substr(0,typed_location.find(','));
 	}
 	
 	// Resolve the region name to its global coordinates.
@@ -566,7 +562,7 @@ void LLNavigationBar::onTeleportFinished(const LLVector3d& global_agent_pos)
 	 */
 		LLAgentUI::buildLocationString(location, LLAgentUI::LOCATION_FORMAT_NO_MATURITY,
 					gAgent.getPosAgentFromGlobal(global_agent_pos));
-	std::string tooltip (LLSLURL(gAgent.getRegion()->getName(), global_agent_pos).getSLURLString());
+	std::string tooltip (LLSLURL::buildSLURLfromPosGlobal(gAgent.getRegion()->getName(), global_agent_pos, false));
 	
 	LLLocationHistoryItem item (location,
 			global_agent_pos, tooltip,TYPED_REGION_SLURL);// we can add into history only TYPED location
@@ -655,7 +651,7 @@ void LLNavigationBar::onRegionNameResponse(
 	LLVector3d region_pos = from_region_handle(region_handle);
 	LLVector3d global_pos = region_pos + (LLVector3d) local_coords;
 
-	llinfos << "Teleporting to: " << LLSLURL(region_name,	global_pos).getSLURLString()  << llendl;
+	llinfos << "Teleporting to: " << LLSLURL::buildSLURLfromPosGlobal(region_name,	global_pos, false)  << llendl;
 	gAgent.teleportViaLocation(global_pos);
 }
 
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 197a0ef728..d6d48a4ead 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -142,7 +142,7 @@ void LLOutputMonitorCtrl::draw()
 
 	// Copied from llmediaremotectrl.cpp
 	// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
-	// call directly into LLVoiceClient::getInstance() to ask if that agent-id is muted, is
+	// call directly into gVoiceClient to ask if that agent-id is muted, is
 	// speaking, and what power.  This avoids duplicating data, which can get
 	// out of sync.
 	const F32 LEVEL_0 = LLVoiceClient::OVERDRIVEN_POWER_LEVEL / 3.f;
@@ -151,14 +151,14 @@ void LLOutputMonitorCtrl::draw()
 
 	if (getVisible() && mAutoUpdate && !mIsMuted && mSpeakerId.notNull())
 	{
-		setPower(LLVoiceClient::getInstance()->getCurrentPower(mSpeakerId));
+		setPower(gVoiceClient->getCurrentPower(mSpeakerId));
 		if(mIsAgentControl)
 		{
-			setIsTalking(LLVoiceClient::getInstance()->getUserPTTState());
+			setIsTalking(gVoiceClient->getUserPTTState());
 		}
 		else
 		{
-			setIsTalking(LLVoiceClient::getInstance()->getIsSpeaking(mSpeakerId));
+			setIsTalking(gVoiceClient->getIsSpeaking(mSpeakerId));
 		}
 	}
 
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 3a83da67e2..b7454a5066 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -143,7 +143,7 @@ private:
 	LLPointer<LLUIImage> mImageLevel2;
 	LLPointer<LLUIImage> mImageLevel3;
 
-	/** whether to deal with LLVoiceClient::getInstance() directly */
+	/** whether to deal with gVoiceClient directly */
 	bool			mAutoUpdate;
 
 	/** uuid of a speaker being monitored */
diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp
index 3f1b23ba14..67e048885f 100644
--- a/indra/newview/lloverlaybar.cpp
+++ b/indra/newview/lloverlaybar.cpp
@@ -258,7 +258,7 @@ void LLOverlayBar::refresh()
 	{
 		// update "remotes"
 		childSetVisible("media_remote_container", TRUE);
-		childSetVisible("voice_remote_container", LLVoiceClient::getInstance()->voiceEnabled());
+		childSetVisible("voice_remote_container", LLVoiceClient::voiceEnabled());
 		childSetVisible("state_buttons", TRUE);
 	}
 
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index b554af66f0..a0ba2f739b 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -163,7 +163,7 @@ BOOL LLPanelAvatarNotes::postBuild()
 	resetControls();
 	resetData();
 
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
+	gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
 
 	return TRUE;
 }
@@ -374,7 +374,7 @@ void LLPanelAvatarNotes::onChange(EStatusType status, const std::string &channel
 		return;
 	}
 
-	childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelAvatarNotes::setAvatarId(const LLUUID& id)
@@ -518,7 +518,7 @@ BOOL LLPanelAvatarProfile::postBuild()
 	pic = getChild<LLTextureCtrl>("real_world_pic");
 	pic->setFallbackImageName("default_profile_picture.j2c");
 
-	LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this);
+	gVoiceClient->addObserver((LLVoiceClientStatusObserver*)this);
 
 	resetControls();
 	resetData();
@@ -809,7 +809,7 @@ void LLPanelAvatarProfile::onChange(EStatusType status, const std::string &chann
 		return;
 	}
 
-	childSetEnabled("call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelAvatarProfile::setAvatarId(const LLUUID& id)
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index 716166a945..c00b6a4147 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -201,7 +201,7 @@ BOOL LLPanelGroup::postBuild()
 		mJoinText = panel_general->getChild<LLUICtrl>("join_cost_text");
 	}
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 	
 	return TRUE;
 }
@@ -322,7 +322,7 @@ void LLPanelGroup::onChange(EStatusType status, const std::string &channelURI, b
 		return;
 	}
 
-	childSetEnabled("btn_call", LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking());
+	childSetEnabled("btn_call", LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking());
 }
 
 void LLPanelGroup::notifyObservers()
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 709bb83fe4..c34f0633b9 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -81,8 +81,7 @@ void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::E
 
 void LLPanelChatControlPanel::updateCallButton()
 {
-	// hide/show call button
-	bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+	bool voice_enabled = LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 
 	LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId);
 	
@@ -125,7 +124,7 @@ BOOL LLPanelChatControlPanel::postBuild()
 	childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this));
 	childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this));
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 
 	return TRUE;
 }
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 42e4b397db..ee4dcc44fe 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -51,12 +51,11 @@
 #include "llfocusmgr.h"
 #include "lllineeditor.h"
 #include "llnotificationsutil.h"
-#include "llsecapi.h"
 #include "llstartup.h"
 #include "lltextbox.h"
 #include "llui.h"
 #include "lluiconstants.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llversioninfo.h"
 #include "llviewerhelp.h"
 #include "llviewertexturelist.h"
@@ -78,7 +77,6 @@
 #pragma warning(disable: 4355)      // 'this' used in initializer list
 #endif  // LL_WINDOWS
 
-#include "llsdserialize.h"
 #define USE_VIEWER_AUTH 0
 
 const S32 BLACK_BORDER_HEIGHT = 160;
@@ -106,6 +104,7 @@ public:
 LLLoginRefreshHandler gLoginRefreshHandler;
 
 
+
 // helper class that trys to download a URL from a web site and calls a method 
 // on parent class indicating if the web server is working or not
 class LLIamHereLogin : public LLHTTPClient::Responder
@@ -154,6 +153,10 @@ namespace {
 	boost::intrusive_ptr< LLIamHereLogin > gResponsePtr = 0;
 };
 
+void set_start_location(LLUICtrl* ctrl, void* data)
+{
+    LLURLSimString::setString(ctrl->getValue().asString());
+}
 
 //---------------------------------------------------------------------------
 // Public methods
@@ -184,7 +187,6 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 		delete LLPanelLogin::sInstance;
 	}
 
-	mPasswordModified = FALSE;
 	LLPanelLogin::sInstance = this;
 
 	// add to front so we are the bottom-most child
@@ -211,7 +213,10 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	}
 
 #if !USE_VIEWER_AUTH
-	childSetPrevalidate("username_edit", LLTextValidate::validateASCIIPrintableNoPipe);
+	childSetPrevalidate("first_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
+	childSetPrevalidate("last_name_edit", LLTextValidate::validateASCIIPrintableNoSpace);
+
+	childSetCommitCallback("password_edit", mungePassword, this);
 	getChild<LLLineEditor>("password_edit")->setKeystrokeCallback(onPassKey, this);
 
 	// change z sort of clickable text to be behind buttons
@@ -223,19 +228,27 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 
 	LLComboBox* combo = getChild<LLComboBox>("start_location_combo");
 
-	if(LLStartUp::getStartSLURL().getType() != LLSLURL::LOCATION)
+	std::string sim_string = LLURLSimString::sInstance.mSimString;
+	if(sim_string.empty())
 	{
-		LLSLURL slurl(gSavedSettings.getString("LoginLocation"));
-		LLStartUp::setStartSLURL(slurl);
+		LLURLSimString::setString(gSavedSettings.getString("LoginLocation"));
+		sim_string = LLURLSimString::sInstance.mSimString;
 	}
-	updateLocationCombo(false);
-	
-	combo->setCommitCallback(onSelectLocation, NULL);
+
+	if (!sim_string.empty())
+	{
+		// Replace "<Type region name>" with this region name
+		combo->remove(2);
+		combo->add( sim_string );
+		combo->setTextEntry(sim_string);
+		combo->setCurrentByIndex( 2 );
+	}
+
+	combo->setCommitCallback( &set_start_location, NULL );
 
 	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");
 	server_choice_combo->setCommitCallback(onSelectServer, NULL);
 	server_choice_combo->setFocusLostCallback(boost::bind(onServerComboLostFocus, _1));
-	updateServerCombo();
 
 	childSetAction("connect_btn", onClickConnect, this);
 
@@ -291,10 +304,17 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 
 	// kick off a request to grab the url manually
 	gResponsePtr = LLIamHereLogin::build( this );
+	std::string login_page = gSavedSettings.getString("LoginPage");
+	if (login_page.empty())
+	{
+		login_page = getString( "real_url" );
+	}
+	LLHTTPClient::head( login_page, gResponsePtr );
 
-	LLHTTPClient::head( LLGridManager::getInstance()->getLoginPage(), gResponsePtr );
-	
-	updateLocationCombo(false);
+#if !USE_VIEWER_AUTH
+	// Initialize visibility (and don't force visibility - use prefs)
+	refreshLocation( false );
+#endif
 
 }
 
@@ -358,6 +378,21 @@ void LLPanelLogin::setSiteIsAlive( bool alive )
 	}
 }
 
+void LLPanelLogin::mungePassword(LLUICtrl* caller, void* user_data)
+{
+	LLPanelLogin* self = (LLPanelLogin*)user_data;
+	LLLineEditor* editor = (LLLineEditor*)caller;
+	std::string password = editor->getText();
+
+	// Re-md5 if we've changed at all
+	if (password != self->mIncomingPassword)
+	{
+		LLMD5 pass((unsigned char *)password.c_str());
+		char munged_password[MD5HEX_STR_SIZE];
+		pass.hex_digest(munged_password);
+		self->mMungedPassword = munged_password;
+	}
+}
 
 LLPanelLogin::~LLPanelLogin()
 {
@@ -464,14 +499,14 @@ void LLPanelLogin::giveFocus()
 	if( sInstance )
 	{
 		// Grab focus and move cursor to first blank input field
-		std::string username = sInstance->childGetText("username_edit");
+		std::string first = sInstance->childGetText("first_name_edit");
 		std::string pass = sInstance->childGetText("password_edit");
 
-		BOOL have_username = !username.empty();
+		BOOL have_first = !first.empty();
 		BOOL have_pass = !pass.empty();
 
 		LLLineEditor* edit = NULL;
-		if (have_username && !have_pass)
+		if (have_first && !have_pass)
 		{
 			// User saved his name but not his password.  Move
 			// focus to password field.
@@ -480,7 +515,7 @@ void LLPanelLogin::giveFocus()
 		else
 		{
 			// User doesn't have a name, so start there.
-			edit = sInstance->getChild<LLLineEditor>("username_edit");
+			edit = sInstance->getChild<LLLineEditor>("first_name_edit");
 		}
 
 		if (edit)
@@ -502,8 +537,8 @@ void LLPanelLogin::showLoginWidgets()
 	// *TODO: Append all the usual login parameters, like first_login=Y etc.
 	std::string splash_screen_url = sInstance->getString("real_url");
 	web_browser->navigateTo( splash_screen_url, "text/html" );
-	LLUICtrl* username_edit = sInstance->getChild<LLUICtrl>("username_edit");
-	username_edit->setFocus(TRUE);
+	LLUICtrl* first_name_edit = sInstance->getChild<LLUICtrl>("first_name_edit");
+	first_name_edit->setFocus(TRUE);
 }
 
 // static
@@ -525,120 +560,77 @@ void LLPanelLogin::show(const LLRect &rect,
 }
 
 // static
-void LLPanelLogin::setFields(LLPointer<LLCredential> credential,
-							 BOOL remember)
+void LLPanelLogin::setFields(const std::string& firstname,
+			     const std::string& lastname,
+			     const std::string& password)
 {
 	if (!sInstance)
 	{
 		llwarns << "Attempted fillFields with no login view shown" << llendl;
 		return;
 	}
-	LL_INFOS("Credentials") << "Setting login fields to " << *credential << LL_ENDL;
 
-	LLSD identifier = credential->getIdentifier();
-	if((std::string)identifier["type"] == "agent") 
-	{
-		sInstance->childSetText("username_edit", (std::string)identifier["first_name"] + " " + 
-								(std::string)identifier["last_name"]);	
-	}
-	else if((std::string)identifier["type"] == "account")
-	{
-		sInstance->childSetText("username_edit", (std::string)identifier["account_name"]);		
-	}
-	else
-	{
-	  sInstance->childSetText("username_edit", std::string());	
-	}
-	// if the password exists in the credential, set the password field with
-	// a filler to get some stars
-	LLSD authenticator = credential->getAuthenticator();
-	LL_INFOS("Credentials") << "Setting authenticator field " << authenticator["type"].asString() << LL_ENDL;
-	if(authenticator.isMap() && 
-	   authenticator.has("secret") && 
-	   (authenticator["secret"].asString().size() > 0))
+	sInstance->childSetText("first_name_edit", firstname);
+	sInstance->childSetText("last_name_edit", lastname);
+
+	// Max "actual" password length is 16 characters.
+	// Hex digests are always 32 characters.
+	if (password.length() == 32)
 	{
-		
 		// This is a MD5 hex digest of a password.
 		// We don't actually use the password input field, 
 		// fill it with MAX_PASSWORD characters so we get a 
 		// nice row of asterixes.
 		const std::string filler("123456789!123456");
-		sInstance->childSetText("password_edit", std::string("123456789!123456"));
+		sInstance->childSetText("password_edit", filler);
+		sInstance->mIncomingPassword = filler;
+		sInstance->mMungedPassword = password;
 	}
 	else
 	{
-		sInstance->childSetText("password_edit", std::string());		
+		// this is a normal text password
+		sInstance->childSetText("password_edit", password);
+		sInstance->mIncomingPassword = password;
+		LLMD5 pass((unsigned char *)password.c_str());
+		char munged_password[MD5HEX_STR_SIZE];
+		pass.hex_digest(munged_password);
+		sInstance->mMungedPassword = munged_password;
 	}
-	sInstance->childSetValue("remember_check", remember);
 }
 
 
 // static
-void LLPanelLogin::getFields(LLPointer<LLCredential>& credential,
-							 BOOL remember)
+void LLPanelLogin::addServer(const std::string& server, S32 domain_name)
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted getFields with no login view shown" << llendl;
+		llwarns << "Attempted addServer with no login view shown" << llendl;
 		return;
 	}
-	
-	// load the credential so we can pass back the stored password or hash if the user did
-	// not modify the password field.
-	
-	credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());
 
-	LLSD identifier = LLSD::emptyMap();
-	LLSD authenticator = LLSD::emptyMap();
-	
-	if(credential.notNull())
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+	combo->add(server, LLSD(domain_name) );
+	combo->setCurrentByIndex(0);
+}
+
+// static
+void LLPanelLogin::getFields(std::string *firstname,
+			     std::string *lastname,
+			     std::string *password)
+{
+	if (!sInstance)
 	{
-		authenticator = credential->getAuthenticator();
+		llwarns << "Attempted getFields with no login view shown" << llendl;
+		return;
 	}
 
-	std::string username = sInstance->childGetText("username_edit");
-	LLStringUtil::trim(username);
-	std::string password = sInstance->childGetText("password_edit");
+	*firstname = sInstance->childGetText("first_name_edit");
+	LLStringUtil::trim(*firstname);
 
-	LL_INFOS2("Credentials", "Authentication") << "retrieving username:" << username << LL_ENDL;
-	// determine if the username is a first/last form or not.
-	size_t separator_index = username.find_first_of(' ');
-	if (separator_index == username.npos)
-	{
-		LL_INFOS2("Credentials", "Authentication") << "account: " << username << LL_ENDL;
-		// single username, so this is a 'clear' identifier
-		identifier["type"] = "account";
-		identifier["account_name"] = username;
-		
-		if (LLPanelLogin::sInstance->mPasswordModified)
-		{
-			authenticator = LLSD::emptyMap();
-			// password is plaintext
-			authenticator["type"] = "clear";
-			authenticator["secret"] = password;
-		}
-	}
-	else if (separator_index == username.find_last_of(' '))
-	{
-		LL_INFOS2("Credentials", "Authentication") << "agent: " << username << LL_ENDL;
-		// traditional firstname / lastname
-		identifier["type"] = "agent";
-		identifier["first_name"] = username.substr(0, separator_index);
-		identifier["last_name"] = username.substr(separator_index+1, username.npos);
-		
-		if (LLPanelLogin::sInstance->mPasswordModified)
-		{
-			authenticator = LLSD::emptyMap();
-			authenticator["type"] = "hash";
-			authenticator["algorithm"] = "md5";
-			LLMD5 pass((const U8 *)password.c_str());
-			char md5pass[33];               /* Flawfinder: ignore */
-			pass.hex_digest(md5pass);
-			authenticator["secret"] = md5pass;
-		}
-	}
-	credential = gSecAPIHandler->createCredential(LLGridManager::getInstance()->getGrid(), identifier, authenticator);
-	remember = sInstance->childGetValue("remember_check");
+	*lastname = sInstance->childGetText("last_name_edit");
+	LLStringUtil::trim(*lastname);
+
+	*password = sInstance->mMungedPassword;
 }
 
 // static
@@ -658,147 +650,64 @@ BOOL LLPanelLogin::isGridComboDirty()
 }
 
 // static
-BOOL LLPanelLogin::areCredentialFieldsDirty()
+void LLPanelLogin::getLocation(std::string &location)
 {
 	if (!sInstance)
 	{
-		llwarns << "Attempted getServer with no login view shown" << llendl;
-	}
-	else
-	{
-		std::string username = sInstance->childGetText("username_edit");
-		LLStringUtil::trim(username);
-		std::string password = sInstance->childGetText("password_edit");
-		LLLineEditor* ctrl = sInstance->getChild<LLLineEditor>("username_edit");
-		if(ctrl && ctrl->isDirty())
-		{
-			return true;
-		}
-		ctrl = sInstance->getChild<LLLineEditor>("password_edit");
-		if(ctrl && ctrl->isDirty()) 
-		{
-			return true;
-		}
+		llwarns << "Attempted getLocation with no login view shown" << llendl;
+		return;
 	}
-	return false;	
+	
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	location = combo->getValue().asString();
 }
 
-
 // static
-void LLPanelLogin::updateLocationCombo( bool force_visible )
+void LLPanelLogin::refreshLocation( bool force_visible )
 {
-	if (!sInstance) 
-	{
-		return;
-	}	
-	
-	llinfos << "updatelocationcombo " << LLStartUp::getStartSLURL().asString() << llendl;
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	
-	switch(LLStartUp::getStartSLURL().getType())
-	{
-		case LLSLURL::LOCATION:
-		{
-			
-			combo->setCurrentByIndex( 2 );	
-			combo->setTextEntry(LLStartUp::getStartSLURL().getLocationString());	
-			break;
-		}
-		case LLSLURL::HOME_LOCATION:
-			combo->setCurrentByIndex(1);
-			break;
-		default:
-			combo->setCurrentByIndex(0);
-			break;
-	}
-	
+	if (!sInstance) return;
+
+#if USE_VIEWER_AUTH
+	loadLoginPage();
+#else
 	BOOL show_start = TRUE;
-	
+
 	if ( ! force_visible )
+	{
+		// Don't show on first run after install
+		// Otherwise ShowStartLocation defaults to true.
 		show_start = gSavedSettings.getBOOL("ShowStartLocation");
+	}
+
+	// Update the value of the location combo.
+	updateLocationUI();
 	
 	sInstance->childSetVisible("start_location_combo", show_start);
 	sInstance->childSetVisible("start_location_text", show_start);
-	
-	sInstance->childSetVisible("server_combo", TRUE);
-}
 
-// static
-void LLPanelLogin::onSelectLocation(LLUICtrl*, void*)
-{
-	if (!sInstance) return;
-	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
-	S32 index = combo->getCurrentIndex();
-	
-	switch (index)
-	{
-		case 2:
-		{
-			LLSLURL slurl = LLSLURL(combo->getSelectedValue());
-			if((slurl.getType() == LLSLURL::LOCATION) &&
-			   (slurl.getGrid() != LLStartUp::getStartSLURL().getGrid()))
-			{
-				
-
-				// we've changed the grid, so update the grid selection
-				try 
-				{
-					LLStartUp::setStartSLURL(slurl);
-				}
-				catch (LLInvalidGridName ex)
-				{
-					LLSD args;	
-					args["GRID"] = slurl.getGrid();
-					LLNotificationsUtil::add("InvalidGrid", args);
-					return; 
-				}	
-				loadLoginPage();
-			}
-			break;
-		}
-		case 1:
-		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
-			break;
-		}
-		default:
-		{
-			LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_LAST));
-			break;
-		}
-	}
-}
+	BOOL show_server = gSavedSettings.getBOOL("ForceShowGrid");
+	sInstance->childSetVisible("server_combo", show_server);
 
+#endif
+}
 
 // static
-void LLPanelLogin::getLocation(LLSLURL& slurl)
+void LLPanelLogin::updateLocationUI()
 {
-	LLSLURL result;
-	if (!sInstance)
-	{
-		llwarns << "Attempted getLocation with no login view shown" << llendl;
-	}
-	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+	if (!sInstance) return;
 	
-	switch(combo->getCurrentIndex())
+	std::string sim_string = LLURLSimString::sInstance.mSimString;
+	if (!sim_string.empty())
 	{
-		case 0:
-			slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
-		case 1:
-			slurl =  LLSLURL(LLSLURL::SIM_LOCATION_LAST);
-		default:
-			slurl = LLSLURL(combo->getValue().asString());
+		// Replace "<Type region name>" with this region name
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+		combo->remove(2);
+		combo->add( sim_string );
+		combo->setTextEntry(sim_string);
+		combo->setCurrentByIndex( 2 );
 	}
 }
 
-void LLPanelLogin::setLocation(const LLSLURL& slurl)
-{
-	LLStartUp::setStartSLURL(slurl);
-	updateServer();
-}
-
 // static
 void LLPanelLogin::closePanel()
 {
@@ -832,13 +741,15 @@ void LLPanelLogin::loadLoginPage()
 	
 	std::ostringstream oStr;
 
-	std::string login_page = LLGridManager::getInstance()->getLoginPage();
-
+	std::string login_page = gSavedSettings.getString("LoginPage");
+	if (login_page.empty())
+	{
+		login_page = sInstance->getString( "real_url" );
+	}
 	oStr << login_page;
 	
 	// Use the right delimeter depending on how LLURI parses the URL
 	LLURI login_page_uri = LLURI(login_page);
-	
 	std::string first_query_delimiter = "&";
 	if (login_page_uri.queryMap().size() == 0)
 	{
@@ -870,10 +781,11 @@ void LLPanelLogin::loadLoginPage()
 	curl_free(curl_version);
 
 	// Grid
-	char* curl_grid = curl_escape(LLGridManager::getInstance()->getGridLoginID().c_str(), 0);
+	char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0);
 	oStr << "&grid=" << curl_grid;
 	curl_free(curl_grid);
-	gViewerWindow->setMenuBackgroundColor(false, !LLGridManager::getInstance()->isInProductionGrid());
+
+	gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid());
 	gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor());
 
 
@@ -898,20 +810,30 @@ void LLPanelLogin::loadLoginPage()
 		location = gSavedSettings.getString("LoginLocation");
 	}
 	
-	std::string username;
+	std::string firstname, lastname;
 
     if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
     {
         LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
-		username = cmd_line_login[0].asString() + " " + cmd_line_login[1];
+		firstname = cmd_line_login[0].asString();
+		lastname = cmd_line_login[1].asString();
         password = cmd_line_login[2].asString();
     }
     	
+	if (firstname.empty())
+	{
+		firstname = gSavedSettings.getString("FirstName");
+	}
+	
+	if (lastname.empty())
+	{
+		lastname = gSavedSettings.getString("LastName");
+	}
 	
 	char* curl_region = curl_escape(region.c_str(), 0);
 
-	oStr <<"username=" << username <<
-		 "&location=" << location <<	"&region=" << curl_region;
+	oStr <<"firstname=" << firstname <<
+		"&lastname=" << lastname << "&location=" << location <<	"&region=" << curl_region;
 	
 	curl_free(curl_region);
 
@@ -944,7 +866,7 @@ void LLPanelLogin::loadLoginPage()
 #endif
 	
 	LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-
+	
 	// navigate to the "real" page
 	if (gSavedSettings.getBOOL("RegInClient"))
 	{
@@ -993,33 +915,34 @@ void LLPanelLogin::onClickConnect(void *)
 		// JC - Make sure the fields all get committed.
 		sInstance->setFocus(FALSE);
 
-		LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-		LLSD combo_val = combo->getSelectedValue();
-		if (combo_val.isUndefined())
+		std::string first = sInstance->childGetText("first_name_edit");
+		std::string last  = sInstance->childGetText("last_name_edit");
+		LLComboBox* combo = sInstance->getChild<LLComboBox>("start_location_combo");
+		std::string combo_text = combo->getSimple();
+		
+		bool has_first_and_last = !(first.empty() || last.empty());
+		bool has_location = false;
+
+		if(combo_text=="<Type region name>" || combo_text =="")
 		{
-			combo_val = combo->getValue();
+			// *NOTE: Mani - Location field is not always committed by this point!
+			// This may be duplicate work, but better than not doing the work!
+			LLURLSimString::sInstance.setString("");
 		}
-		if(combo_val.isUndefined())
+		else 
 		{
-			LLNotificationsUtil::add("StartRegionEmpty");
-			return;
-		}		
-		try
-		{
-			LLGridManager::getInstance()->setGridChoice(combo_val.asString());
+			// *NOTE: Mani - Location field is not always committed by this point!
+			LLURLSimString::sInstance.setString(combo_text);
+			has_location = true;
 		}
-		catch (LLInvalidGridName ex)
+
+		if(!has_first_and_last)
 		{
-			LLSD args;
-			args["GRID"] = combo_val.asString();
-			LLNotificationsUtil::add("InvalidGrid", args);
-			return;
+			LLNotificationsUtil::add("MustHaveAccountToLogIn");
 		}
-		
-		std::string username = sInstance->childGetText("username_edit");
-		if(username.empty())
+		else if(!has_location)
 		{
-			LLNotificationsUtil::add("MustHaveAccountToLogIn");
+			LLNotificationsUtil::add("StartRegionEmpty");
 		}
 		else
 		{
@@ -1082,8 +1005,6 @@ void LLPanelLogin::onClickHelp(void*)
 // static
 void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 {
-	LLPanelLogin *This = (LLPanelLogin *) user_data;
-	This->mPasswordModified = TRUE;
 	if (gKeyboard->getKeyDown(KEY_CAPSLOCK) && sCapslockDidNotification == FALSE)
 	{
 		LLNotificationsUtil::add("CapsKeyOn");
@@ -1091,90 +1012,54 @@ void LLPanelLogin::onPassKey(LLLineEditor* caller, void* user_data)
 	}
 }
 
-
-void LLPanelLogin::updateServer()
+// static
+void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
 {
-	try 
+	// *NOTE: The paramters for this method are ignored. 
+	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
+	// calls this method.
+
+	// The user twiddled with the grid choice ui.
+	// apply the selection to the grid setting.
+	std::string grid_label;
+	S32 grid_index;
+
+	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
+	LLSD combo_val = combo->getValue();
+
+	if (LLSD::TypeInteger == combo_val.type())
 	{
+		grid_index = combo->getValue().asInteger();
 
-		updateServerCombo();	
-		// if they've selected another grid, we should load the credentials
-		// for that grid and set them to the UI.
-		if(sInstance && !sInstance->areCredentialFieldsDirty())
+		if ((S32)GRID_INFO_OTHER == grid_index)
 		{
-			LLPointer<LLCredential> credential = gSecAPIHandler->loadCredential(LLGridManager::getInstance()->getGrid());	
-			bool remember = sInstance->childGetValue("remember_check");
-			sInstance->setFields(credential, remember);
+			// This happens if the user specifies a custom grid
+			// via command line.
+			grid_label = combo->getSimple();
 		}
-		// grid changed so show new splash screen (possibly)
-		loadLoginPage();
-		updateLocationCombo(LLStartUp::getStartSLURL().getType() == LLSLURL::LOCATION);
 	}
-	catch (LLInvalidGridName ex)
+	else
 	{
-		// do nothing
+		// no valid selection, return other
+		grid_index = (S32)GRID_INFO_OTHER;
+		grid_label = combo_val.asString();
 	}
-}
 
-void LLPanelLogin::updateServerCombo()
-{
-	if (!sInstance) 
+	// This new seelction will override preset uris
+	// from the command line.
+	LLViewerLogin* vl = LLViewerLogin::getInstance();
+	vl->resetURIs();
+	if(grid_index != GRID_INFO_OTHER)
 	{
-		return;	
+		vl->setGridChoice((EGridInfo)grid_index);
 	}
-	// We add all of the possible values, sorted, and then add a bar and the current value at the top
-	LLComboBox* server_choice_combo = sInstance->getChild<LLComboBox>("server_combo");	
-	server_choice_combo->removeall();
-#ifdef LL_RELEASE_FOR_DOWNLOAD
-	std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(TRUE);
-#else
-	std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids(FALSE);	
-#endif
-	for (std::map<std::string, std::string>::iterator grid_choice = known_grids.begin();
-		 grid_choice != known_grids.end();
-		 grid_choice++)
+	else
 	{
-		if (!grid_choice->first.empty())
-		{
-			server_choice_combo->add(grid_choice->second, grid_choice->first, ADD_SORTED);
-		}
+		vl->setGridChoice(grid_label);
 	}
-	
-	server_choice_combo->addSeparator(ADD_TOP);
-	
-	server_choice_combo->add(LLGridManager::getInstance()->getGridLabel(), 
-		LLGridManager::getInstance()->getGrid(), ADD_TOP);	
-	
-	server_choice_combo->selectFirstItem();	
-}
 
-// static
-void LLPanelLogin::onSelectServer(LLUICtrl*, void*)
-{
-	// *NOTE: The paramters for this method are ignored. 
-	// LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe, void*)
-	// calls this method.
-	LL_INFOS("AppInit") << "onSelectServer" << LL_ENDL;
-	// The user twiddled with the grid choice ui.
-	// apply the selection to the grid setting.
-	LLPointer<LLCredential> credential;
-	
-	LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo");
-	LLSD combo_val = combo->getSelectedValue();
-	if (combo_val.isUndefined())
-	{
-		combo_val = combo->getValue();
-	}
-	
-	combo = sInstance->getChild<LLComboBox>("start_location_combo");	
-	combo->setCurrentByIndex(1);
-	LLStartUp::setStartSLURL(LLSLURL(gSavedSettings.getString("LoginLocation")));
-	LLGridManager::getInstance()->setGridChoice(combo_val.asString());
-	// This new selection will override preset uris
-	// from the command line.
-	updateServer();
-	updateLocationCombo(false);
-	updateLoginPanelLinks();
+	// grid changed so show new splash screen (possibly)
+	loadLoginPage();
 }
 
 void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
@@ -1187,14 +1072,3 @@ void LLPanelLogin::onServerComboLostFocus(LLFocusableElement* fe)
 		onSelectServer(combo, NULL);	
 	}
 }
-
-void LLPanelLogin::updateLoginPanelLinks()
-{
-	LLSD grid_data = LLGridManager::getInstance()->getGridInfo();
-	bool system_grid = grid_data.has(GRID_IS_SYSTEM_GRID_VALUE);
-	
-	// need to call through sInstance, as it's called from onSelectServer, which
-	// is static.
-	sInstance->childSetVisible("create_new_account_text", system_grid);
-	sInstance->childSetVisible("forgot_password_text", system_grid);
-}
diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h
index 9301c263da..1fdc3a9361 100644
--- a/indra/newview/llpanellogin.h
+++ b/indra/newview/llpanellogin.h
@@ -41,8 +41,6 @@
 class LLLineEditor;
 class LLUIImage;
 class LLPanelLoginListener;
-class LLSLURL;
-class LLCredential;
 
 class LLPanelLogin:	
 	public LLPanel,
@@ -67,16 +65,20 @@ public:
 		void (*callback)(S32 option, void* user_data), 
 		void* callback_data);
 
-	static void setFields(LLPointer<LLCredential> credential, BOOL remember);
+	// Remember password checkbox is set via gSavedSettings "RememberPassword"
+	static void setFields(const std::string& firstname, const std::string& lastname, 
+		const std::string& password);
 
-	static void getFields(LLPointer<LLCredential>& credential, BOOL remember);
+	static void addServer(const std::string& server, S32 domain_name);
+	static void refreshLocation( bool force_visible );
+	static void updateLocationUI();
+
+	static void getFields(std::string *firstname, std::string *lastname,
+						  std::string *password);
 
 	static BOOL isGridComboDirty();
-	static BOOL areCredentialFieldsDirty();
-	static void getLocation(LLSLURL& slurl);
-	static void setLocation(const LLSLURL& slurl);
-	
-	static void updateLocationCombo(bool force_visible);  // simply update the combo box
+	static void getLocation(std::string &location);
+
 	static void closePanel();
 
 	void setSiteIsAlive( bool alive );
@@ -84,10 +86,10 @@ public:
 	static void loadLoginPage();	
 	static void giveFocus();
 	static void setAlwaysRefresh(bool refresh); 
+	static void mungePassword(LLUICtrl* caller, void* user_data);
 	
 	// inherited from LLViewerMediaObserver
 	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
-	static void updateServer();  // update the combo box, change the login page to the new server, clear the combo
 
 private:
 	friend class LLPanelLoginListener;
@@ -101,10 +103,6 @@ private:
 	static void onPassKey(LLLineEditor* caller, void* user_data);
 	static void onSelectServer(LLUICtrl*, void*);
 	static void onServerComboLostFocus(LLFocusableElement*);
-	static void updateServerCombo();
-	static void onSelectLocation(LLUICtrl*, void*);
-	
-	static void updateLoginPanelLinks();
 
 private:
 	LLPointer<LLUIImage> mLogoImage;
@@ -113,7 +111,8 @@ private:
 	void			(*mCallback)(S32 option, void *userdata);
 	void*			mCallbackData;
 
-	BOOL            mPasswordModified;
+	std::string mIncomingPassword;
+	std::string mMungedPassword;
 
 	static LLPanelLogin* sInstance;
 	static BOOL		sCapslockDidNotification;
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 7f5e63adee..288edeb031 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -619,7 +619,7 @@ BOOL LLPanelPeople::postBuild()
 	if(recent_view_sort)
 		mRecentViewSortMenuHandle  = recent_view_sort->getHandle();
 
-	LLVoiceClient::getInstance()->addObserver(this);
+	gVoiceClient->addObserver(this);
 
 	// call this method in case some list is empty and buttons can be in inconsistent state
 	updateButtons();
@@ -809,7 +809,7 @@ void LLPanelPeople::updateButtons()
 		}
 	}
 
-	bool enable_calls = LLVoiceClient::getInstance()->isVoiceWorking() && LLVoiceClient::getInstance()->voiceEnabled();
+	bool enable_calls = gVoiceClient->voiceWorking() && gVoiceClient->voiceEnabled();
 
 	buttonSetEnabled("teleport_btn",		friends_tab_active && item_selected && isFriendOnline(selected_uuids.front()));
 	buttonSetEnabled("view_profile_btn",	item_selected);
diff --git a/indra/newview/llpanelplacestab.cpp b/indra/newview/llpanelplacestab.cpp
index 6b12796e59..9806b8c64d 100644
--- a/indra/newview/llpanelplacestab.cpp
+++ b/indra/newview/llpanelplacestab.cpp
@@ -70,7 +70,10 @@ void LLPanelPlacesTab::onRegionResponse(const LLVector3d& landmark_global_pos,
 	std::string sl_url;
 	if ( gotSimName )
 	{
-		sl_url = LLSLURL(sim_name, landmark_global_pos).getSLURLString();
+		F32 region_x = (F32)fmod( landmark_global_pos.mdV[VX], (F64)REGION_WIDTH_METERS );
+		F32 region_y = (F32)fmod( landmark_global_pos.mdV[VY], (F64)REGION_WIDTH_METERS );
+
+		sl_url = LLSLURL::buildSLURL(sim_name, llround(region_x), llround(region_y), llround((F32)landmark_global_pos.mdV[VZ]));
 	}
 	else
 	{
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 268738d88c..0a20ff6226 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -346,6 +346,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id)
 {
 	if (mExcludeAgent && gAgent.getID() == avatar_id) return;
 	if (mAvatarList->contains(avatar_id)) return;
+
 	mAvatarList->getIDs().push_back(avatar_id);
 	mAvatarList->setDirty();
 	adjustParticipant(avatar_id);
@@ -631,7 +632,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 	else if (item == "can_call")
 	{
 		bool not_agent = mUUIDs.front() != gAgentID;
-		bool can_call = not_agent &&  LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking();
+		bool can_call = not_agent && LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking();
 		return can_call;
 	}
 
diff --git a/indra/newview/llsecapi.cpp b/indra/newview/llsecapi.cpp
deleted file mode 100644
index ba343f5387..0000000000
--- a/indra/newview/llsecapi.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/** 
- * @file llsecapi.cpp
- * @brief Security API for services such as certificate handling
- * secure local storage, etc.
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-
-#include "llviewerprecompiledheaders.h"
-#include "llsecapi.h"
-#include "llsechandler_basic.h"
-#include <openssl/evp.h>
-#include <map>
-#include "llhttpclient.h"
-
-
-
-std::map<std::string, LLPointer<LLSecAPIHandler> > gHandlerMap;
-LLPointer<LLSecAPIHandler> gSecAPIHandler;
-
-void initializeSecHandler()
-{
-	OpenSSL_add_all_algorithms();
-	OpenSSL_add_all_ciphers();
-	OpenSSL_add_all_digests();	
-	gHandlerMap[BASIC_SECHANDLER] = new LLSecAPIBasicHandler();
-	
-	
-	// Currently, we only have the Basic handler, so we can point the main sechandler
-	// pointer to the basic handler.  Later, we'll create a wrapper handler that
-	// selects the appropriate sechandler as needed, for instance choosing the
-	// mac keyring handler, with fallback to the basic sechandler
-	gSecAPIHandler = gHandlerMap[BASIC_SECHANDLER];
-
-	// initialize all SecAPIHandlers
-	LLProtectedDataException ex = LLProtectedDataException("");
-	std::map<std::string, LLPointer<LLSecAPIHandler> >::const_iterator itr;
-	for(itr = gHandlerMap.begin(); itr != gHandlerMap.end(); ++itr)
-	{
-		LLPointer<LLSecAPIHandler> handler = (*itr).second;
-		try 
-		{
-			handler->init();
-		}
-		catch (LLProtectedDataException e)
-		{
-			ex = e;
-		}
-	}
-	if (ex.getMessage().length() > 0 )  // an exception was thrown.
-	{
-		throw ex;
-	}
-
-}
-// start using a given security api handler.  If the string is empty
-// the default is used
-LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type)
-{
-	if (gHandlerMap.find(handler_type) != gHandlerMap.end())
-	{
-		return gHandlerMap[handler_type];
-	}
-	else
-	{
-		return LLPointer<LLSecAPIHandler>(NULL);
-	}
-}
-// register a handler
-void registerSecHandler(const std::string& handler_type, 
-						LLPointer<LLSecAPIHandler>& handler)
-{
-	gHandlerMap[handler_type] = handler;
-}
-
-std::ostream& operator <<(std::ostream& s, const LLCredential& cred)
-{
-	return s << (std::string)cred;
-}
-
-	
-// secapiSSLCertVerifyCallback
-// basic callback called when a cert verification is requested.
-// calls SECAPI to validate the context
-// not initialized in the above initialization function, due to unit tests
-// see llappviewer
-
-int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
-{
-	LLURLRequest *req = (LLURLRequest *)param;
-	LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore("");
-	LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
-	LLSD validation_params = LLSD::emptyMap();
-	LLURI uri(req->getURL());
-	validation_params[CERT_HOSTNAME] = uri.hostName();
-	try
-	{
-		chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
-	}
-	catch (LLCertValidationTrustException& cert_exception)
-	{
-		LL_WARNS("AppInit") << "Cert not trusted: " << cert_exception.getMessage() << LL_ENDL;
-		return 0;		
-	}
-	catch (LLCertException& cert_exception)
-	{
-		LL_WARNS("AppInit") << "cert error " << cert_exception.getMessage() << LL_ENDL;
-		return 0;
-	}
-	catch (...)
-	{
-		LL_WARNS("AppInit") << "cert error " << LL_ENDL;
-		return 0;
-	}
-	return 1;
-}
-
-LLSD LLCredential::getLoginParams()
-{
-	LLSD result = LLSD::emptyMap();
-	if (mIdentifier["type"].asString() == "agent")
-	{
-		// legacy credential
-		result["passwd"] = "$1$" + mAuthenticator["secret"].asString();
-		result["first"] = mIdentifier["first_name"];
-		result["last"] = mIdentifier["last_name"];
-	
-	}
-	else if (mIdentifier["type"].asString() == "account")
-	{
-		result["username"] = mIdentifier["account_name"];
-		result["passwd"] = mAuthenticator["secret"];
-                                    
-	}
-	return result;
-}
diff --git a/indra/newview/llsecapi.h b/indra/newview/llsecapi.h
deleted file mode 100644
index 5211dc2699..0000000000
--- a/indra/newview/llsecapi.h
+++ /dev/null
@@ -1,493 +0,0 @@
-/** 
- * @file llsecapi.h
- * @brief Security API for services such as certificate handling
- * secure local storage, etc.
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#ifndef LLSECAPI_H
-#define LLSECAPI_H
-#include <vector>
-#include <openssl/x509.h>
-#include <ostream>
-
-#ifdef LL_WINDOWS
-#pragma warning(disable:4250)
-#endif // LL_WINDOWS
-
-// All error handling is via exceptions.
-
-
-#define CERT_SUBJECT_NAME "subject_name"
-#define CERT_ISSUER_NAME "issuer_name"
-#define CERT_NAME_CN "commonName"
-		
-#define CERT_SUBJECT_NAME_STRING "subject_name_string"
-#define CERT_ISSUER_NAME_STRING "issuer_name_string"
-		
-#define CERT_SERIAL_NUMBER "serial_number"
-		
-#define CERT_VALID_FROM "valid_from"
-#define CERT_VALID_TO "valid_to"
-#define CERT_SHA1_DIGEST "sha1_digest"
-#define CERT_MD5_DIGEST "md5_digest"
-#define CERT_HOSTNAME "hostname"
-#define CERT_BASIC_CONSTRAINTS "basicConstraints"
-#define CERT_BASIC_CONSTRAINTS_CA "CA"
-#define CERT_BASIC_CONSTRAINTS_PATHLEN "pathLen"
-
-#define CERT_KEY_USAGE "keyUsage"
-#define CERT_KU_DIGITAL_SIGNATURE    "digitalSignature"
-#define CERT_KU_NON_REPUDIATION      "nonRepudiation"
-#define CERT_KU_KEY_ENCIPHERMENT     "keyEncipherment"
-#define CERT_KU_DATA_ENCIPHERMENT    "dataEncipherment"
-#define CERT_KU_KEY_AGREEMENT        "keyAgreement"
-#define CERT_KU_CERT_SIGN        "certSigning"
-#define CERT_KU_CRL_SIGN             "crlSigning"
-#define CERT_KU_ENCIPHER_ONLY        "encipherOnly"
-#define CERT_KU_DECIPHER_ONLY        "decipherOnly"
-
-#define BASIC_SECHANDLER "BASIC_SECHANDLER"
-#define CERT_VALIDATION_DATE "validation_date"
-
-#define CERT_EXTENDED_KEY_USAGE "extendedKeyUsage"
-#define CERT_EKU_SERVER_AUTH SN_server_auth
-
-#define CERT_SUBJECT_KEY_IDENTFIER "subjectKeyIdentifier"
-#define CERT_AUTHORITY_KEY_IDENTIFIER "authorityKeyIdentifier"
-#define CERT_AUTHORITY_KEY_IDENTIFIER_ID "authorityKeyIdentifierId"
-#define CERT_AUTHORITY_KEY_IDENTIFIER_NAME "authorityKeyIdentifierName"
-#define CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL "authorityKeyIdentifierSerial"
-
-// validate the current time lies within 
-// the validation period of the cert
-#define VALIDATION_POLICY_TIME 1
-
-// validate that the CA, or some cert in the chain
-// lies within the certificate store
-#define VALIDATION_POLICY_TRUSTED 2
-
-// validate that the subject name of
-// the cert contains the passed in hostname
-// or validates against the hostname
-#define VALIDATION_POLICY_HOSTNAME 4
-
-
-// validate that the cert contains the SSL EKU
-#define VALIDATION_POLICY_SSL_KU 8
-
-// validate that the cert contains the SSL EKU
-#define VALIDATION_POLICY_CA_KU 16
-
-#define VALIDATION_POLICY_CA_BASIC_CONSTRAINTS 32
-
-// validate that the cert is correct for SSL
-#define VALIDATION_POLICY_SSL (VALIDATION_POLICY_TIME | \
-                               VALIDATION_POLICY_HOSTNAME | \
-                               VALIDATION_POLICY_TRUSTED | \
-                               VALIDATION_POLICY_SSL_KU | \
-                               VALIDATION_POLICY_CA_BASIC_CONSTRAINTS | \
-                               VALIDATION_POLICY_CA_KU)
-
-
-
-
-
-
-class LLProtectedDataException
-{
-public:
-	LLProtectedDataException(const char *msg) 
-	{
-		LL_WARNS("SECAPI") << "Protected Data Error: " << (std::string)msg << LL_ENDL;
-		mMsg = (std::string)msg;
-	}
-	std::string getMessage() { return mMsg; }
-protected:
-	std::string mMsg;
-};
-
-// class LLCertificate
-// parent class providing an interface for certifiate.
-// LLCertificates are considered unmodifiable
-// Certificates are pulled out of stores, or created via
-// factory calls
-class LLCertificate : public LLRefCount
-{
-	LOG_CLASS(LLCertificate);
-public:
-	LLCertificate() {}
-	
-	virtual ~LLCertificate() {}
-	
-	// return a PEM encoded certificate.  The encoding
-	// includes the -----BEGIN CERTIFICATE----- and end certificate elements
-	virtual std::string getPem() const=0; 
-	
-	// return a DER encoded certificate
-	virtual std::vector<U8> getBinary() const=0;  
-	
-	// return an LLSD object containing information about the certificate
-	// such as its name, signature, expiry time, serial number
-	virtual LLSD getLLSD() const=0; 
-	
-	// return an openSSL X509 struct for the certificate
-	virtual X509* getOpenSSLX509() const=0;
-
-};
-
-// class LLCertificateVector
-// base class for a list of certificates.
-
-
-class LLCertificateVector : public LLRefCount
-{
-	
-public:
-	
-	LLCertificateVector() {};
-	virtual ~LLCertificateVector() {};
-	
-	// base iterator implementation class, providing
-	// the functionality needed for the iterator class.
-	class iterator_impl : public LLRefCount
-	{
-	public:
-		iterator_impl() {};
-		virtual ~iterator_impl() {};
-		virtual void seek(bool incr)=0;
-		virtual LLPointer<iterator_impl> clone() const=0;
-		virtual bool equals(const LLPointer<iterator_impl>& _iter) const=0;
-		virtual LLPointer<LLCertificate> get()=0;
-	};
-	
-	// iterator class
-	class iterator
-	{
-	public:
-		iterator(LLPointer<iterator_impl> impl) : mImpl(impl) {}
-		iterator() : mImpl(NULL) {}
-		iterator(const iterator& _iter) {mImpl = _iter.mImpl->clone(); }
-		~iterator() {}
-		iterator& operator++() { if(mImpl.notNull()) mImpl->seek(true); return *this;}
-		iterator& operator--() { if(mImpl.notNull()) mImpl->seek(false); return *this;}
-		
-		iterator operator++(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(true); return result;}
-		iterator operator--(int) { iterator result = *this; if(mImpl.notNull()) mImpl->seek(false); return result;}
-		LLPointer<LLCertificate> operator*() { return mImpl->get(); }		
-		
-		LLPointer<iterator_impl> mImpl;
-	protected:
-		friend bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs);
-		bool equals(const iterator& _iter) const { return mImpl->equals(_iter.mImpl); }
-	};
-	
-	// numeric indexer
-	virtual LLPointer<LLCertificate> operator[](int)=0;
-	
-	// Iteration
-	virtual iterator begin()=0;
-	
-	virtual iterator end()=0;
-	
-	// find a cert given params
-	virtual iterator find(const LLSD& params) =0;
-	
-	// return the number of certs in the store
-	virtual int size() const = 0;	
-	
-	// append the cert to the store.  if a copy of the cert already exists in the store, it is removed first
-	virtual void  add(LLPointer<LLCertificate> cert)=0;
-	
-	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
-	virtual void  insert(iterator location, LLPointer<LLCertificate> cert)=0;	
-	
-	// remove a certificate from the store
-	virtual LLPointer<LLCertificate> erase(iterator cert)=0;	
-};
-
-
-// class LLCertificateStore
-// represents a store of certificates, typically a store of root CA
-// certificates.  The store can be persisted, and can be used to validate
-// a cert chain
-//
-class LLCertificateStore : virtual public LLCertificateVector
-{
-	
-public:
-	
-	LLCertificateStore() {}
-	virtual ~LLCertificateStore() {}
-	
-	// persist the store
-	virtual void save()=0;
-	
-	// return the store id
-	virtual std::string storeId() const=0;
-};
-
-// class LLCertificateChain
-// Class representing a chain of certificates in order, with the 
-// first element being the child cert.
-class LLCertificateChain : virtual public LLCertificateVector
-{	
-
-public:
-	LLCertificateChain() {}
-	
-	virtual ~LLCertificateChain() {}
-
-	// validate a certificate chain given the params.
-	// Will throw exceptions on error
-	
-	virtual void validate(int validation_policy,
-						  LLPointer<LLCertificateStore> ca_store,
-						  const LLSD& validation_params) =0;
-};
-
-
-
-
-inline
-bool operator==(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
-{
-	return _lhs.equals(_rhs);
-}
-inline
-bool operator!=(const LLCertificateVector::iterator& _lhs, const LLCertificateVector::iterator& _rhs)
-{
-	return !(_lhs == _rhs);
-}
-
-
-//
-// LLCredential - interface for credentials providing the following functionality:
-// * persistance of credential information based on grid (for saving username/password)
-// * serialization to an OGP identifier/authenticator pair
-// 
-class LLCredential  : public LLRefCount
-{
-public:
-	
-	LLCredential() {}
-	
-	LLCredential(const std::string& grid)
-	{
-		mGrid = grid;
-		mIdentifier = LLSD::emptyMap();
-		mAuthenticator = LLSD::emptyMap();
-	}
-	
-	virtual ~LLCredential() {}
-	
-	virtual void setCredentialData(const LLSD& identifier, const LLSD& authenticator) 
-	{ 
-		mIdentifier = identifier;
-		mAuthenticator = authenticator;
-	}
-	virtual LLSD getIdentifier() { return mIdentifier; }
-	virtual LLSD getAuthenticator() { return mAuthenticator; }
-	virtual LLSD getLoginParams();
-	virtual std::string getGrid() { return mGrid; }
-	
-
-	virtual void clearAuthenticator() { mAuthenticator = LLSD(); } 
-	virtual std::string userID() const { return std::string("unknown");}
-	virtual std::string asString() const { return std::string("unknown");}
-	operator std::string() const { return asString(); }
-protected:
-	LLSD mIdentifier;
-	LLSD mAuthenticator;
-	std::string mGrid;
-};
-
-std::ostream& operator <<(std::ostream& s, const LLCredential& cred);
-
-
-// All error handling is via exceptions.
-
-class LLCertException
-{
-public:
-	LLCertException(LLPointer<LLCertificate> cert, const char* msg)
-	{
-
-		mCert = cert;
-
-		LL_WARNS("SECAPI") << "Certificate Error: " << (std::string)msg << LL_ENDL;
-		mMsg = (std::string)msg;
-	}
-	LLPointer<LLCertificate> getCert() { return mCert; }
-	std::string getMessage() { return mMsg; }
-protected:
-	LLPointer<LLCertificate> mCert;
-	std::string mMsg;
-};
-
-class LLInvalidCertificate : public LLCertException
-{
-public:
-	LLInvalidCertificate(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalid")
-	{
-	}
-protected:
-};
-
-class LLCertValidationTrustException : public LLCertException
-{
-public:
-	LLCertValidationTrustException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertUntrusted")
-	{
-	}
-protected:
-};
-
-class LLCertValidationHostnameException : public LLCertException
-{
-public:
-	LLCertValidationHostnameException(std::string hostname,
-									  LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidHostname")
-	{
-		mHostname = hostname;
-	}
-	
-	std::string getHostname() { return mHostname; }
-protected:
-	std::string mHostname;
-};
-
-class LLCertValidationExpirationException : public LLCertException
-{
-public:
-	LLCertValidationExpirationException(LLPointer<LLCertificate> cert,
-										LLDate current_time) : LLCertException(cert, "CertExpired")
-	{
-		mTime = current_time;
-	}
-	LLDate GetTime() { return mTime; }
-protected:
-	LLDate mTime;
-};
-
-class LLCertKeyUsageValidationException : public LLCertException
-{
-public:
-	LLCertKeyUsageValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertKeyUsage")
-	{
-	}
-protected:
-};
-
-class LLCertBasicConstraintsValidationException : public LLCertException
-{
-public:
-	LLCertBasicConstraintsValidationException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertBasicConstraints")
-	{
-	}
-protected:
-};
-
-class LLCertValidationInvalidSignatureException : public LLCertException
-{
-public:
-	LLCertValidationInvalidSignatureException(LLPointer<LLCertificate> cert) : LLCertException(cert, "CertInvalidSignature")
-	{
-	}
-protected:
-};
-
-// LLSecAPIHandler Class
-// Interface handler class for the various security storage handlers.
-class LLSecAPIHandler : public LLRefCount
-{
-public:
-	
-	
-	LLSecAPIHandler() {}
-	virtual ~LLSecAPIHandler() {}
-	
-	// initialize the SecAPIHandler
-	virtual void init() {};
-	
-	// instantiate a certificate from a pem string
-	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert)=0;
-	
-	
-	
-	// instiate a certificate from an openssl X509 structure
-	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert)=0;
-	
-	// instantiate a chain from an X509_STORE_CTX
-	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain)=0;
-	
-	// instantiate a cert store given it's id.  if a persisted version
-	// exists, it'll be loaded.  If not, one will be created (but not
-	// persisted)
-	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id)=0;
-	
-	// persist data in a protected store
-	virtual void setProtectedData(const std::string& data_type,
-								  const std::string& data_id,
-								  const LLSD& data)=0;
-	
-	// retrieve protected data
-	virtual LLSD getProtectedData(const std::string& data_type,
-								  const std::string& data_id)=0;
-	
-	// delete a protected data item from the store
-	virtual void deleteProtectedData(const std::string& data_type,
-									 const std::string& data_id)=0;
-	
-	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
-													 const LLSD& identifier, 
-													 const LLSD& authenticator)=0;
-	
-	virtual LLPointer<LLCredential> loadCredential(const std::string& grid)=0;
-	
-	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)=0;
-	
-	virtual void deleteCredential(LLPointer<LLCredential> cred)=0;
-	
-};
-
-void initializeSecHandler();
-				
-// retrieve a security api depending on the api type
-LLPointer<LLSecAPIHandler> getSecHandler(const std::string& handler_type);
-
-void registerSecHandler(const std::string& handler_type, 
-						LLPointer<LLSecAPIHandler>& handler);
-
-extern LLPointer<LLSecAPIHandler> gSecAPIHandler;
-
-
-int secapiSSLCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
-
-
-#endif // LL_SECAPI_H
diff --git a/indra/newview/llsechandler_basic.cpp b/indra/newview/llsechandler_basic.cpp
deleted file mode 100644
index 51e250ffc6..0000000000
--- a/indra/newview/llsechandler_basic.cpp
+++ /dev/null
@@ -1,1586 +0,0 @@
-/** 
- * @file llsechandler_basic.cpp
- * @brief Security API for services such as certificate handling
- * secure local storage, etc.
- *
- * $LicenseInfo:firstyear=2003&license=viewergpl$
- * 
- * Copyright (c) 2003-2000, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
- * 
-LLS * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-
-#include "llviewerprecompiledheaders.h"
-#include "llsecapi.h"
-#include "llsechandler_basic.h"
-#include "llsdserialize.h"
-#include "llviewernetwork.h"
-#include "llxorcipher.h"
-#include "llfile.h"
-#include "lldir.h"
-#include "llviewercontrol.h"
-#include <vector>
-#include <ios>
-#include <openssl/ossl_typ.h>
-#include <openssl/x509.h>
-#include <openssl/x509v3.h>
-#include <openssl/pem.h>
-#include <openssl/asn1.h>
-#include <openssl/rand.h>
-#include <openssl/err.h>
-#include <iostream>
-#include <iomanip>
-#include <time.h>
-
-
-
-// 128 bits of salt data...
-#define STORE_SALT_SIZE 16 
-#define BUFFER_READ_SIZE 256
-std::string cert_string_from_asn1_string(ASN1_STRING* value);
-std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value);
-
-LLSD _basic_constraints_ext(X509* cert);
-LLSD _key_usage_ext(X509* cert);
-LLSD _ext_key_usage_ext(X509* cert);
-LLSD _subject_key_identifier_ext(X509 *cert);
-LLSD _authority_key_identifier_ext(X509* cert);
-
-LLBasicCertificate::LLBasicCertificate(const std::string& pem_cert) 
-{
-	
-	// BIO_new_mem_buf returns a read only bio, but takes a void* which isn't const
-	// so we need to cast it.
-	BIO * pem_bio = BIO_new_mem_buf((void*)pem_cert.c_str(), pem_cert.length());
-	if(pem_bio == NULL)
-	{
-		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
-		throw LLInvalidCertificate(this);
-	}
-	mCert = NULL;
-	PEM_read_bio_X509(pem_bio, &mCert, 0, NULL);
-	BIO_free(pem_bio);
-	if (!mCert)
-	{
-		throw LLInvalidCertificate(this);
-	}
-	_initLLSD();
-}
-
-
-LLBasicCertificate::LLBasicCertificate(X509* pCert) 
-{
-	if (!pCert || !pCert->cert_info)
-	{
-		throw LLInvalidCertificate(this);
-	}	
-	mCert = X509_dup(pCert);
-	_initLLSD();
-}
-
-LLBasicCertificate::~LLBasicCertificate() 
-{
-	if(mCert)
-	{
-		X509_free(mCert);
-	}
-}
-
-//
-// retrieve the pem using the openssl functionality
-std::string LLBasicCertificate::getPem() const
-{ 
-	char * pem_bio_chars = NULL;
-	// a BIO is the equivalent of a 'std::stream', and
-	// can be a file, mem stream, whatever.  Grab a memory based
-	// BIO for the result
-	BIO *pem_bio = BIO_new(BIO_s_mem());
-	if (!pem_bio)
-	{
-		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;		
-		return std::string();
-	}
-	PEM_write_bio_X509(pem_bio, mCert);
-	int length = BIO_get_mem_data(pem_bio, &pem_bio_chars);
-	std::string result = std::string(pem_bio_chars, length);
-	BIO_free(pem_bio);
-	return result;
-}
-
-// get the DER encoding for the cert
-// DER is a binary encoding format for certs...
-std::vector<U8> LLBasicCertificate::getBinary() const
-{ 
-	U8 * der_bio_data = NULL;
-	// get a memory bio 
-	BIO *der_bio = BIO_new(BIO_s_mem());
-	if (!der_bio)
-	{
-		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;			
-		return std::vector<U8>();
-	}
-	i2d_X509_bio(der_bio, mCert);
-	int length = BIO_get_mem_data(der_bio, &der_bio_data);
-	std::vector<U8> result(length);
-	// vectors are guranteed to be a contiguous chunk of memory.
-	memcpy(&result[0], der_bio_data,  length);
-	BIO_free(der_bio);
-	return result;
-}
-
-
-LLSD LLBasicCertificate::getLLSD() const
-{
-	return mLLSDInfo;
-}
-
-// Initialize the LLSD info for the certificate
-LLSD& LLBasicCertificate::_initLLSD()
-{ 
-
-	// call the various helpers to build the LLSD
-	mLLSDInfo[CERT_SUBJECT_NAME] = cert_name_from_X509_NAME(X509_get_subject_name(mCert));
-	mLLSDInfo[CERT_ISSUER_NAME] = cert_name_from_X509_NAME(X509_get_issuer_name(mCert));
-	mLLSDInfo[CERT_SUBJECT_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_subject_name(mCert));
-	mLLSDInfo[CERT_ISSUER_NAME_STRING] = cert_string_name_from_X509_NAME(X509_get_issuer_name(mCert));
-	ASN1_INTEGER *sn = X509_get_serialNumber(mCert);
-	if (sn != NULL)
-	{
-		mLLSDInfo[CERT_SERIAL_NUMBER] = cert_string_from_asn1_integer(sn);
-	}
-	
-	mLLSDInfo[CERT_VALID_TO] = cert_date_from_asn1_time(X509_get_notAfter(mCert));
-	mLLSDInfo[CERT_VALID_FROM] = cert_date_from_asn1_time(X509_get_notBefore(mCert));
-	mLLSDInfo[CERT_SHA1_DIGEST] = cert_get_digest("sha1", mCert);
-	mLLSDInfo[CERT_MD5_DIGEST] = cert_get_digest("md5", mCert);
-	// add the known extensions
-	mLLSDInfo[CERT_BASIC_CONSTRAINTS] = _basic_constraints_ext(mCert);
-	mLLSDInfo[CERT_KEY_USAGE] = _key_usage_ext(mCert);
-	mLLSDInfo[CERT_EXTENDED_KEY_USAGE] = _ext_key_usage_ext(mCert);
-	mLLSDInfo[CERT_SUBJECT_KEY_IDENTFIER] = _subject_key_identifier_ext(mCert);
-	mLLSDInfo[CERT_AUTHORITY_KEY_IDENTIFIER] = _authority_key_identifier_ext(mCert);
-	return mLLSDInfo; 
-}
-
-// Retrieve the basic constraints info
-LLSD _basic_constraints_ext(X509* cert)
-{
-	LLSD result;
-	BASIC_CONSTRAINTS *bs = (BASIC_CONSTRAINTS *)X509_get_ext_d2i(cert, NID_basic_constraints, NULL, NULL);
-	if(bs)
-	{
-		result = LLSD::emptyMap();
-		// Determines whether the cert can be used as a CA
-		result[CERT_BASIC_CONSTRAINTS_CA] = (bool)bs->ca;
-	
-		if(bs->pathlen) 
-		{
-			// the pathlen determines how deep a certificate chain can be from
-			// this CA
-			if((bs->pathlen->type == V_ASN1_NEG_INTEGER)
-			   || !bs->ca) 
-			{
-				result[CERT_BASIC_CONSTRAINTS_PATHLEN] = 0;
-			} 
-			else 
-			{
-				result[CERT_BASIC_CONSTRAINTS_PATHLEN] = (int)ASN1_INTEGER_get(bs->pathlen);
-			}
-		}
-
-	}
-	return result;
-}
-
-// retrieve the key usage, which specifies how the cert can be used.
-// 
-LLSD _key_usage_ext(X509* cert)
-{
-	LLSD result;
-	ASN1_STRING *usage_str = (ASN1_STRING *)X509_get_ext_d2i(cert, NID_key_usage, NULL, NULL);
-	if(usage_str)
-	{
-		result = LLSD::emptyArray();
-		long usage = 0;
-		if(usage_str->length > 0) 
-		{
-			usage = usage_str->data[0];
-			if(usage_str->length > 1)
-			{
-				usage |= usage_str->data[1] << 8;
-			}
-		}
-		ASN1_STRING_free(usage_str);
-		if(usage)
-		{
-			if(usage & KU_DIGITAL_SIGNATURE) result.append(LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE));
-			if(usage & KU_NON_REPUDIATION) result.append(LLSD((std::string)CERT_KU_NON_REPUDIATION));
-			if(usage & KU_KEY_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT));
-			if(usage & KU_DATA_ENCIPHERMENT) result.append(LLSD((std::string)CERT_KU_DATA_ENCIPHERMENT));
-			if(usage & KU_KEY_AGREEMENT) result.append(LLSD((std::string)CERT_KU_KEY_AGREEMENT));
-			if(usage & KU_KEY_CERT_SIGN) result.append(LLSD((std::string)CERT_KU_CERT_SIGN));			
-			if(usage & KU_CRL_SIGN) result.append(LLSD((std::string)CERT_KU_CRL_SIGN));	
-			if(usage & KU_ENCIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_ENCIPHER_ONLY));				
-			if(usage & KU_DECIPHER_ONLY) result.append(LLSD((std::string)CERT_KU_DECIPHER_ONLY));		
-		}
-	}
-	return result;
-}
-
-// retrieve the extended key usage for the cert
-LLSD _ext_key_usage_ext(X509* cert)
-{
-	LLSD result;
-	EXTENDED_KEY_USAGE *eku = (EXTENDED_KEY_USAGE *)X509_get_ext_d2i(cert, NID_ext_key_usage, NULL, NULL);
-	if(eku)
-	{
-		result = LLSD::emptyArray();
-		while(sk_ASN1_OBJECT_num(eku))
-		{
-			ASN1_OBJECT *usage = sk_ASN1_OBJECT_pop(eku);
-			if(usage)
-			{
-				int nid = OBJ_obj2nid(usage);
-				if (nid)
-				{
-					std::string sn = OBJ_nid2sn(nid);
-					result.append(sn);
-				}
-				ASN1_OBJECT_free(usage);
-			}
-		}
-	}
-	return result;
-}
-
-// retrieve the subject key identifier of the cert
-LLSD _subject_key_identifier_ext(X509 *cert)
-{
-	LLSD result;
-	ASN1_OCTET_STRING *skeyid = (ASN1_OCTET_STRING *)X509_get_ext_d2i(cert, NID_subject_key_identifier, NULL, NULL);
-	if(skeyid)
-	{
-		result = cert_string_from_octet_string(skeyid);
-	}
-	return result;
-}
-
-// retrieve the authority key identifier of the cert
-LLSD _authority_key_identifier_ext(X509* cert)
-{
-	LLSD result;
-	AUTHORITY_KEYID *akeyid = (AUTHORITY_KEYID *)X509_get_ext_d2i(cert, NID_authority_key_identifier, NULL, NULL);
-	if(akeyid)
-	{
-		result = LLSD::emptyMap();
-		if(akeyid->keyid)
-		{
-			result[CERT_AUTHORITY_KEY_IDENTIFIER_ID] = cert_string_from_octet_string(akeyid->keyid);
-		}
-		if(akeyid->serial)
-		{
-			result[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL] = cert_string_from_asn1_integer(akeyid->serial);
-		}	
-	}
-	
-	// we ignore the issuer name in the authority key identifier, we check the issue name via
-	// the the issuer name entry in the cert.
-	
-
-	return result;
-}
-
-// retrieve an openssl x509 object,
-// which must be freed by X509_free
-X509* LLBasicCertificate::getOpenSSLX509() const
-{ 
-	return X509_dup(mCert); 
-}  
-
-// generate a single string containing the subject or issuer
-// name of the cert.
-std::string cert_string_name_from_X509_NAME(X509_NAME* name)
-{
-	char * name_bio_chars = NULL;
-	// get a memory bio
-	BIO *name_bio = BIO_new(BIO_s_mem());
-	// stream the name into the bio.  The name will be in the 'short name' format
-	X509_NAME_print_ex(name_bio, name, 0, XN_FLAG_RFC2253);
-	int length = BIO_get_mem_data(name_bio, &name_bio_chars);
-	std::string result = std::string(name_bio_chars, length);
-	BIO_free(name_bio);
-	return result;
-}
-
-// generate an LLSD from a certificate name (issuer or subject name).  
-// the name will be strings indexed by the 'long form'
-LLSD cert_name_from_X509_NAME(X509_NAME* name)
-{
-	LLSD result = LLSD::emptyMap();
-	int name_entries = X509_NAME_entry_count(name);
-	for (int entry_index=0; entry_index < name_entries; entry_index++) 
-	{
-		char buffer[32];
-		X509_NAME_ENTRY *entry = X509_NAME_get_entry(name, entry_index);
-		
-		std::string name_value = std::string((const char*)M_ASN1_STRING_data(X509_NAME_ENTRY_get_data(entry)), 
-											 M_ASN1_STRING_length(X509_NAME_ENTRY_get_data(entry)));
-
-		ASN1_OBJECT* name_obj = X509_NAME_ENTRY_get_object(entry);		
-		OBJ_obj2txt(buffer, sizeof(buffer), name_obj, 0);
-		std::string obj_buffer_str = std::string(buffer);
-		result[obj_buffer_str] = name_value;
-	}
-	
-	return result;
-}
-
-// Generate a string from an ASN1 integer.  ASN1 Integers are
-// bignums, so they can be 'infinitely' long, therefore we
-// cannot simply use a conversion to U64 or something.
-// We retrieve as a readable string for UI
-
-std::string cert_string_from_asn1_integer(ASN1_INTEGER* value)
-{
-	std::string result;
-	BIGNUM *bn = ASN1_INTEGER_to_BN(value, NULL);
-	if(bn)
-	{
-		char * ascii_bn = BN_bn2hex(bn);
-
-		if(ascii_bn)
-		{
-			result = ascii_bn;
-			OPENSSL_free(ascii_bn);
-		}
-		BN_free(bn);
-	}
-	return result;
-}
-
-// Generate a string from an OCTET string.
-// we retrieve as a 
-
-std::string cert_string_from_octet_string(ASN1_OCTET_STRING* value)
-{
-	
-	std::stringstream result;
-	result << std::hex << std::setprecision(2);
-	for (int i=0; i < value->length; i++)
-	{
-		if (i != 0) 
-		{
-			result << ":";
-		}
-		result  << std::setfill('0') << std::setw(2) << (int)value->data[i];
-	}
-	return result.str();
-}
-
-// Generate a string from an ASN1 integer.  ASN1 Integers are
-// bignums, so they can be 'infinitely' long, therefore we
-// cannot simply use a conversion to U64 or something.
-// We retrieve as a readable string for UI
-
-std::string cert_string_from_asn1_string(ASN1_STRING* value)
-{
-	char * string_bio_chars = NULL;
-	std::string result;
-	// get a memory bio
-	BIO *string_bio = BIO_new(BIO_s_mem());
-	if(!string_bio)
-	{
-		// stream the name into the bio.  The name will be in the 'short name' format
-		ASN1_STRING_print_ex(string_bio, value, ASN1_STRFLGS_RFC2253);
-		int length = BIO_get_mem_data(string_bio, &string_bio_chars);
-		result = std::string(string_bio_chars, length);
-		BIO_free(string_bio);
-	}
-	else
-	{
-		LL_WARNS("SECAPI") << "Could not allocate an openssl memory BIO." << LL_ENDL;
-	}
-	
-	return result;
-}
-
-// retrieve a date structure from an ASN1 time, for 
-// validity checking.
-LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time)
-{
-	
-	struct tm timestruct = {0};
-	int i = asn1_time->length;
-	
-	if (i < 10)
-	{
-		return LLDate();
-	}	
-	// convert the date from the ASN1 time (which is a string in ZULU time), to
-	// a timeval.
-	timestruct.tm_year = (asn1_time->data[0]-'0') * 10 + (asn1_time->data[1]-'0');
-	
-	/* Deal with Year 2000 */
-	if (timestruct.tm_year < 70)
-		timestruct.tm_year += 100;
-	
-	timestruct.tm_mon = (asn1_time->data[2]-'0') * 10 + (asn1_time->data[3]-'0') - 1;
-	timestruct.tm_mday = (asn1_time->data[4]-'0') * 10 + (asn1_time->data[5]-'0');
-	timestruct.tm_hour = (asn1_time->data[6]-'0') * 10 + (asn1_time->data[7]-'0');
-	timestruct.tm_min = (asn1_time->data[8]-'0') * 10 + (asn1_time->data[9]-'0');
-	timestruct.tm_sec = (asn1_time->data[10]-'0') * 10 + (asn1_time->data[11]-'0');
-
-#if LL_WINDOWS
-	return LLDate((F64)_mkgmtime(&timestruct));
-#else // LL_WINDOWS
-	return LLDate((F64)timegm(&timestruct));
-#endif // LL_WINDOWS
-}
-
-													   
-// Generate a string containing a digest.  The digest time is 'ssh1' or
-// 'md5', and the resulting string is of the form "aa:12:5c:' and so on
-std::string cert_get_digest(const std::string& digest_type, X509 *cert)
-{
-	unsigned char digest_data[BUFFER_READ_SIZE];
-	unsigned int len = sizeof(digest_data);
-	std::stringstream result;
-	const EVP_MD* digest = NULL;
-	// we could use EVP_get_digestbyname, but that requires initializer code which
-	// would require us to complicate things by plumbing it into the system.
-	if (digest_type == "md5")
-	{
-		digest = EVP_md5();
-	}
-	else if (digest_type == "sha1")
-	{
-		digest = EVP_sha1();
-	}
-	else
-	{
-		return std::string();
-	}
-
-	X509_digest(cert, digest, digest_data, &len);
-	result << std::hex << std::setprecision(2);
-	for (unsigned int i=0; i < len; i++)
-	{
-		if (i != 0) 
-		{
-			result << ":";
-		}
-		result  << std::setfill('0') << std::setw(2) << (int)digest_data[i];
-	}
-	return result.str();
-}
-
-
-// class LLBasicCertificateVector
-// This class represents a list of certificates, implemented by a vector of certificate pointers.
-// it contains implementations of the virtual functions for iterators, search, add, remove, etc.
-//
-
-//  Find a certificate in the list.
-// It will find a cert that has minimally the params listed, with the values being the same
-LLBasicCertificateVector::iterator LLBasicCertificateVector::find(const LLSD& params)
-{
-	BOOL found = FALSE;
-	// loop through the entire vector comparing the values in the certs
-	// against those passed in via the params.
-	// params should be a map.  Only the items specified in the map will be
-	// checked, but they must match exactly, even if they're maps or arrays.
-	
-	for(iterator cert = begin();
-		cert != end();
-		cert++)
-	{
-
-			found= TRUE;
-		LLSD cert_info = (*cert)->getLLSD();
-			for (LLSD::map_const_iterator param = params.beginMap();
-			 param != params.endMap();
-			 param++)
-		{
-
-			if (!cert_info.has((std::string)param->first) || 
-				(!valueCompareLLSD(cert_info[(std::string)param->first], param->second)))
-			{
-				found = FALSE;
-				break;
-			}
-		}
-		if (found)
-		{
-			return (cert);
-		}
-	}
-	return end();
-}
-
-// Insert a certificate into the store.  If the certificate already 
-// exists in the store, nothing is done.
-void  LLBasicCertificateVector::insert(iterator _iter, 
-									   LLPointer<LLCertificate> cert)
-{
-	LLSD cert_info = cert->getLLSD();
-	if (cert_info.isMap() && cert_info.has(CERT_SHA1_DIGEST))
-	{
-		LLSD existing_cert_info = LLSD::emptyMap();
-		existing_cert_info[CERT_MD5_DIGEST] = cert_info[CERT_MD5_DIGEST];
-		if(find(existing_cert_info) == end())
-		{
-			BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
-			mCerts.insert(basic_iter->mIter, cert);
-		}
-	}
-}
-
-// remove a certificate from the store
-LLPointer<LLCertificate> LLBasicCertificateVector::erase(iterator _iter)
-{
-	
-	if (_iter != end())
-	{
-		BasicIteratorImpl *basic_iter = dynamic_cast<BasicIteratorImpl*>(_iter.mImpl.get());
-		LLPointer<LLCertificate> result = (*_iter);
-		mCerts.erase(basic_iter->mIter);
-		return result;
-	}
-	return NULL;
-}
-
-
-//
-// LLBasicCertificateStore
-// This class represents a store of CA certificates.  The basic implementation
-// uses a pem file such as the legacy CA.pem stored in the existing 
-// SL implementation.
-LLBasicCertificateStore::LLBasicCertificateStore(const std::string& filename)
-{
-	mFilename = filename;
-	load_from_file(filename);
-}
-
-void LLBasicCertificateStore::load_from_file(const std::string& filename)
-{
-	// scan the PEM file extracting each certificate
-	BIO* file_bio = BIO_new(BIO_s_file());
-	if(file_bio)
-	{
-		if (BIO_read_filename(file_bio, filename.c_str()) > 0)
-		{	
-			X509 *cert_x509 = NULL;
-			while((PEM_read_bio_X509(file_bio, &cert_x509, 0, NULL)) && 
-				  (cert_x509 != NULL))
-			{
-				try
-				{
-					add(new LLBasicCertificate(cert_x509));
-				}
-				catch (...)
-				{
-					LL_WARNS("SECAPI") << "Failure creating certificate from the certificate store file." << LL_ENDL;
-				}
-				X509_free(cert_x509);
-				cert_x509 = NULL;
-			}
-			BIO_free(file_bio);
-		}
-	}
-	else
-	{
-		LL_WARNS("SECAPI") << "Could not allocate a file BIO" << LL_ENDL;
-	}
-}
-
-
-LLBasicCertificateStore::~LLBasicCertificateStore()
-{
-}
-
-
-// persist the store
-void LLBasicCertificateStore::save()
-{
-	llofstream file_store(mFilename, llofstream::binary);
-	if(!file_store.fail())
-	{
-		for(iterator cert = begin();
-			cert != end();
-			cert++)
-		{
-			std::string pem = (*cert)->getPem();
-			if(!pem.empty())
-			{
-				file_store << (*cert)->getPem() << std::endl;
-			}
-		}
-		file_store.close();
-	}
-	else
-	{
-		LL_WARNS("SECAPI") << "Could not open certificate store " << mFilename << "for save" << LL_ENDL;
-	}
-}
-
-// return the store id
-std::string LLBasicCertificateStore::storeId() const
-{
-	// this is the basic handler which uses the CA.pem store,
-	// so we ignore this.
-	return std::string("");
-}
-
-
-//
-// LLBasicCertificateChain
-// This class represents a chain of certs, each cert being signed by the next cert
-// in the chain.  Certs must be properly signed by the parent
-LLBasicCertificateChain::LLBasicCertificateChain(const X509_STORE_CTX* store)
-{
-
-	// we're passed in a context, which contains a cert, and a blob of untrusted
-	// certificates which compose the chain.
-	if((store == NULL) || (store->cert == NULL))
-	{
-		LL_WARNS("SECAPI") << "An invalid store context was passed in when trying to create a certificate chain" << LL_ENDL;
-		return;
-	}
-	// grab the child cert
-	LLPointer<LLCertificate> current = new LLBasicCertificate(store->cert);
-
-	add(current);
-	if(store->untrusted != NULL)
-	{
-		// if there are other certs in the chain, we build up a vector
-		// of untrusted certs so we can search for the parents of each
-		// consecutive cert.
-		LLBasicCertificateVector untrusted_certs;
-		for(int i = 0; i < sk_X509_num(store->untrusted); i++)
-		{
-			LLPointer<LLCertificate> cert = new LLBasicCertificate(sk_X509_value(store->untrusted, i));
-			untrusted_certs.add(cert);
-
-		}		
-		while(untrusted_certs.size() > 0)
-		{
-			LLSD find_data = LLSD::emptyMap();
-			LLSD cert_data = current->getLLSD();
-			// we simply build the chain via subject/issuer name as the
-			// client should not have passed in multiple CA's with the same 
-			// subject name.  If they did, it'll come out in the wash during
-			// validation.
-			find_data[CERT_SUBJECT_NAME_STRING] = cert_data[CERT_ISSUER_NAME_STRING]; 
-			LLBasicCertificateVector::iterator issuer = untrusted_certs.find(find_data);
-			if (issuer != untrusted_certs.end())
-			{
-				current = untrusted_certs.erase(issuer);
-				add(current);
-			}
-			else
-			{
-				break;
-			}
-		}
-	}
-}
-
-
-// subdomain wildcard specifiers can be divided into 3 parts
-// the part before the first *, the part after the first * but before
-// the second *, and the part after the second *.
-// It then iterates over the second for each place in the string
-// that it matches.  ie if the subdomain was testfoofoobar, and
-// the wildcard was test*foo*bar, it would match test, then
-// recursively match foofoobar and foobar
-
-bool _cert_subdomain_wildcard_match(const std::string& subdomain,
-									const std::string& wildcard)
-{
-	// split wildcard into the portion before the *, and the portion after
-
-	int wildcard_pos = wildcard.find_first_of('*');	
-	// check the case where there is no wildcard.
-	if(wildcard_pos == wildcard.npos)
-	{
-		return (subdomain == wildcard);
-	}
-	
-	// we need to match the first part of the subdomain string up to the wildcard
-	// position
-	if(subdomain.substr(0, wildcard_pos) != wildcard.substr(0, wildcard_pos))
-	{
-		// the first portions of the strings didn't match
-		return FALSE;
-	}
-	
-	// as the portion of the wildcard string before the * matched, we need to check the
-	// portion afterwards.  Grab that portion.
-	std::string new_wildcard_string = wildcard.substr( wildcard_pos+1, wildcard.npos);
-	if(new_wildcard_string.empty())
-	{
-		// we had nothing after the *, so it's an automatic match
-		return TRUE;
-	}
-	
-	// grab the portion of the remaining wildcard string before the next '*'.  We need to find this
-	// within the remaining subdomain string. and then recursively check.
-	std::string new_wildcard_match_string = new_wildcard_string.substr(0, new_wildcard_string.find_first_of('*'));
-	
-	// grab the portion of the subdomain after the part that matched the initial wildcard portion
-	std::string new_subdomain = subdomain.substr(wildcard_pos, subdomain.npos);
-	
-	// iterate through the current subdomain, finding instances of the match string.
-	int sub_pos = new_subdomain.find_first_of(new_wildcard_match_string);
-	while(sub_pos != std::string::npos)
-	{
-		new_subdomain = new_subdomain.substr(sub_pos, std::string::npos);
-		if(_cert_subdomain_wildcard_match(new_subdomain, new_wildcard_string))
-		{
-			return TRUE;
-		}
-		sub_pos = new_subdomain.find_first_of(new_wildcard_match_string, 1);
-
-
-	}
-	// didn't find any instances of the match string that worked in the subdomain, so fail.
-	return FALSE;
-}
-
-
-// RFC2459 does not address wildcards as part of it's name matching
-// specification, and there is no RFC specifying wildcard matching,
-// RFC2818 does a few statements about wildcard matching, but is very 
-// general.  Generally, wildcard matching is per implementation, although
-// it's pretty similar.
-// in our case, we use the '*' wildcard character only, within each
-// subdomain.  The hostname and the CN specification should have the
-// same number of subdomains.
-// We then iterate that algorithm over each subdomain.
-bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& common_name)
-{
-	std::string new_hostname = hostname;
-	std::string new_cn = common_name;
-	int subdomain_pos = new_hostname.find_first_of('.');
-	int subcn_pos = new_cn.find_first_of('.');
-	
-	while((subcn_pos != std::string::npos) && (subdomain_pos != std::string::npos))
-	{
-		// snip out the first subdomain and cn element
-
-		if(!_cert_subdomain_wildcard_match(new_hostname.substr(0, subdomain_pos),
-										   new_cn.substr(0, subcn_pos)))
-		{
-			return FALSE;
-		}
-		new_hostname = new_hostname.substr(subdomain_pos+1, std::string::npos);
-		new_cn = new_cn.substr(subcn_pos+1, std::string::npos);
-		subdomain_pos = new_hostname.find_first_of('.');
-		subcn_pos = new_cn.find_first_of('.');
-	}
-	return _cert_subdomain_wildcard_match(new_hostname, new_cn);
-
-}
-
-// validate that the LLSD array in llsd_set contains the llsd_value 
-bool _LLSDArrayIncludesValue(const LLSD& llsd_set, LLSD llsd_value)
-{
-	for(LLSD::array_const_iterator set_value = llsd_set.beginArray();
-		set_value != llsd_set.endArray();
-		set_value++)
-	{
-		if(valueCompareLLSD((*set_value), llsd_value))
-		{
-			return TRUE;
-		}
-	}
-	return FALSE;
-}
-
-void _validateCert(int validation_policy,
-				  const LLPointer<LLCertificate> cert,
-				  const LLSD& validation_params,
-				  int depth)
-{
-
-	LLSD current_cert_info = cert->getLLSD();		
-	// check basic properties exist in the cert
-	if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info.has(CERT_SUBJECT_NAME_STRING))
-	{
-		throw LLCertException(cert, "Cert doesn't have a Subject Name");				
-	}
-	
-	if(!current_cert_info.has(CERT_ISSUER_NAME_STRING))
-	{
-		throw LLCertException(cert, "Cert doesn't have an Issuer Name");				
-	}
-	
-	// check basic properties exist in the cert
-	if(!current_cert_info.has(CERT_VALID_FROM) || !current_cert_info.has(CERT_VALID_TO))
-	{
-		throw LLCertException(cert, "Cert doesn't have an expiration period");				
-	}
-	if (!current_cert_info.has(CERT_SHA1_DIGEST))
-	{
-		throw LLCertException(cert, "No SHA1 digest");
-	}
-
-	if (validation_policy & VALIDATION_POLICY_TIME)
-	{
-
-		LLDate validation_date(time(NULL));
-		if(validation_params.has(CERT_VALIDATION_DATE))
-		{
-			validation_date = validation_params[CERT_VALIDATION_DATE];
-		}
-		
-		if((validation_date < current_cert_info[CERT_VALID_FROM].asDate()) ||
-		   (validation_date > current_cert_info[CERT_VALID_TO].asDate()))
-		{
-			throw LLCertValidationExpirationException(cert, validation_date);
-		}
-	}
-	if (validation_policy & VALIDATION_POLICY_SSL_KU)
-	{
-		if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
-			(!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
-									   LLSD((std::string)CERT_KU_DIGITAL_SIGNATURE))) ||
-			!(_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
-									  LLSD((std::string)CERT_KU_KEY_ENCIPHERMENT)))))
-		{
-			throw LLCertKeyUsageValidationException(cert);
-		}
-		// only validate EKU if the cert has it
-		if(current_cert_info.has(CERT_EXTENDED_KEY_USAGE) && current_cert_info[CERT_EXTENDED_KEY_USAGE].isArray() &&	   
-		   (!_LLSDArrayIncludesValue(current_cert_info[CERT_EXTENDED_KEY_USAGE], 
-									LLSD((std::string)CERT_EKU_SERVER_AUTH))))
-		{
-			throw LLCertKeyUsageValidationException(cert);			
-		}
-	}
-	if (validation_policy & VALIDATION_POLICY_CA_KU)
-	{
-		if (current_cert_info.has(CERT_KEY_USAGE) && current_cert_info[CERT_KEY_USAGE].isArray() &&
-			(!_LLSDArrayIncludesValue(current_cert_info[CERT_KEY_USAGE], 
-									   (std::string)CERT_KU_CERT_SIGN)))
-			{
-				throw LLCertKeyUsageValidationException(cert);						
-			}
-	}
-	
-	// validate basic constraints
-	if ((validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS) &&
-		current_cert_info.has(CERT_BASIC_CONSTRAINTS) && 
-		current_cert_info[CERT_BASIC_CONSTRAINTS].isMap())
-	{
-		if(!current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_CA) ||
-		   !current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_CA])
-		{
-				throw LLCertBasicConstraintsValidationException(cert);
-		}
-		if (current_cert_info[CERT_BASIC_CONSTRAINTS].has(CERT_BASIC_CONSTRAINTS_PATHLEN) &&
-			((current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger() != 0) &&
-			 (depth > current_cert_info[CERT_BASIC_CONSTRAINTS][CERT_BASIC_CONSTRAINTS_PATHLEN].asInteger())))
-		{
-			throw LLCertBasicConstraintsValidationException(cert);					
-		}
-	}
-}
-
-bool _verify_signature(LLPointer<LLCertificate> parent, 
-					   LLPointer<LLCertificate> child)
-{
-	bool verify_result = FALSE; 
-	LLSD cert1 = parent->getLLSD();
-	LLSD cert2 = child->getLLSD();
-	X509 *signing_cert = parent->getOpenSSLX509();
-	X509 *child_cert = child->getOpenSSLX509();
-	if((signing_cert != NULL) && (child_cert != NULL))
-	{
-		EVP_PKEY *pkey = X509_get_pubkey(signing_cert);
-		
-		
-		if(pkey)
-		{
-			int verify_code = X509_verify(child_cert, pkey);
-			verify_result = ( verify_code > 0);
-			EVP_PKEY_free(pkey);
-		}
-		else
-		{
-			LL_WARNS("SECAPI") << "Could not validate the cert chain signature, as the public key of the signing cert could not be retrieved" << LL_ENDL;
-		}
-
-	}
-	else
-	{
-		LL_WARNS("SECAPI") << "Signature verification failed as there are no certs in the chain" << LL_ENDL;
-	}
-	if(child_cert)
-	{
-		X509_free(child_cert);
-	}
-	if(signing_cert)
-	{
-		X509_free(signing_cert);
-	}
-	return verify_result;
-}
-
-// validate the certificate chain against a store.
-// There are many aspects of cert validatioin policy involved in
-// trust validation.  The policies in this validation algorithm include
-// * Hostname matching for SSL certs
-// * Expiration time matching
-// * Signature validation
-// * Chain trust (is the cert chain trusted against the store)
-// * Basic constraints
-// * key usage and extended key usage
-// TODO: We should add 'authority key identifier' for chaining.
-// This algorithm doesn't simply validate the chain by itself
-// and verify the last cert is in the certificate store, or points
-// to a cert in the store.  It validates whether any cert in the chain
-// is trusted in the store, even if it's not the last one.
-void LLBasicCertificateChain::validate(int validation_policy,
-									   LLPointer<LLCertificateStore> ca_store,
-									   const LLSD& validation_params)
-{
-
-	if(size() < 1)
-	{
-		throw LLCertException(NULL, "No certs in chain");
-	}
-	iterator current_cert = begin();
-	LLSD 	current_cert_info = (*current_cert)->getLLSD();
-	LLSD validation_date;
-	if (validation_params.has(CERT_VALIDATION_DATE))
-	{
-		validation_date = validation_params[CERT_VALIDATION_DATE];
-	}
-
-	if (validation_policy & VALIDATION_POLICY_HOSTNAME)
-	{
-		if(!validation_params.has(CERT_HOSTNAME))
-		{
-			throw LLCertException((*current_cert), "No hostname passed in for validation");			
-		}
-		if(!current_cert_info.has(CERT_SUBJECT_NAME) || !current_cert_info[CERT_SUBJECT_NAME].has(CERT_NAME_CN))
-		{
-			throw LLInvalidCertificate((*current_cert));				
-		}
-		
-		LL_INFOS("SECAPI") << "Validating the hostname " << validation_params[CERT_HOSTNAME].asString() << 
-		     "against the cert CN " << current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString() << LL_ENDL;
-		if(!_cert_hostname_wildcard_match(validation_params[CERT_HOSTNAME].asString(),
-										  current_cert_info[CERT_SUBJECT_NAME][CERT_NAME_CN].asString()))
-		{
-			throw LLCertValidationHostnameException(validation_params[CERT_HOSTNAME].asString(),
-													(*current_cert));
-		}
-	}
-	
-
-	int depth = 0;
-	LLPointer<LLCertificate> previous_cert;
-	// loop through the cert chain, validating the current cert against the next one.
-	while(current_cert != end())
-	{
-		
-		int local_validation_policy = validation_policy;
-		if(current_cert == begin())
-		{
-			// for the child cert, we don't validate CA stuff
-			local_validation_policy &= ~(VALIDATION_POLICY_CA_KU | 
-										 VALIDATION_POLICY_CA_BASIC_CONSTRAINTS);
-		}
-		else
-		{
-			// for non-child certs, we don't validate SSL Key usage
-			local_validation_policy &= ~VALIDATION_POLICY_SSL_KU;				
-			if(!_verify_signature((*current_cert),
-								  previous_cert))
-			{
-			   throw LLCertValidationInvalidSignatureException(previous_cert);
-			}
-		}
-		_validateCert(local_validation_policy,
-					  (*current_cert),
-					  validation_params,
-					  depth);
-		
-		// look for a CA in the CA store that may belong to this chain.
-		LLSD cert_llsd = (*current_cert)->getLLSD();
-		LLSD cert_search_params = LLSD::emptyMap();		
-		// is the cert itself in the store?
-		cert_search_params[CERT_SHA1_DIGEST] = cert_llsd[CERT_SHA1_DIGEST];
-		LLCertificateStore::iterator found_store_cert = ca_store->find(cert_search_params);
-		if(found_store_cert != ca_store->end())
-		{
-			return;
-		}
-		
-		// is the parent in the cert store?
-			
-		cert_search_params = LLSD::emptyMap();
-		cert_search_params[CERT_SUBJECT_NAME_STRING] = cert_llsd[CERT_ISSUER_NAME_STRING];
-		if (cert_llsd.has(CERT_AUTHORITY_KEY_IDENTIFIER))
-		{
-			LLSD cert_aki = cert_llsd[CERT_AUTHORITY_KEY_IDENTIFIER];
-			if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_ID))
-			{
-				cert_search_params[CERT_SUBJECT_KEY_IDENTFIER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_ID];
-			}
-			if(cert_aki.has(CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL))
-			{
-				cert_search_params[CERT_SERIAL_NUMBER] = cert_aki[CERT_AUTHORITY_KEY_IDENTIFIER_SERIAL];
-			}
-		}
-		found_store_cert = ca_store->find(cert_search_params);
-		
-		if(found_store_cert != ca_store->end())
-		{
-			LLSD foo = (*found_store_cert)->getLLSD();
-			// validate the store cert against the depth
-			_validateCert(validation_policy & VALIDATION_POLICY_CA_BASIC_CONSTRAINTS,
-						  (*found_store_cert),
-						  LLSD(),
-						  depth);
-			
-			// verify the signature of the CA
-			if(!_verify_signature((*found_store_cert),
-								  (*current_cert)))
-			{
-				throw LLCertValidationInvalidSignatureException(*current_cert);
-			}			
-			// successfully validated.
-			return;
-		}
-		previous_cert = (*current_cert);
-		current_cert++;
-			   depth++;
-	}
-	if (validation_policy & VALIDATION_POLICY_TRUSTED)
-	{
-		LLPointer<LLCertificate> untrusted_ca_cert = (*this)[size()-1];
-		// we reached the end without finding a trusted cert.
-		throw LLCertValidationTrustException((*this)[size()-1]);
-
-	}
-}
-
-
-// LLSecAPIBasicHandler Class
-// Interface handler class for the various security storage handlers.
-
-// We read the file on construction, and write it on destruction.  This
-// means multiple processes cannot modify the datastore.
-LLSecAPIBasicHandler::LLSecAPIBasicHandler(const std::string& protected_data_file,
-										   const std::string& legacy_password_path)
-{
-	mProtectedDataFilename = protected_data_file;
-	mProtectedDataMap = LLSD::emptyMap();
-	mLegacyPasswordPath = legacy_password_path;
-
-}
-
-LLSecAPIBasicHandler::LLSecAPIBasicHandler()
-{
-}
-
-
-void LLSecAPIBasicHandler::init()
-{
-	mProtectedDataMap = LLSD::emptyMap();
-	if (mProtectedDataFilename.length() == 0)
-	{
-		mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-															"bin_conf.dat");
-		mLegacyPasswordPath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "password.dat");
-	
-		mProtectedDataFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-															"bin_conf.dat");	
-		std::string store_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-														"CA.pem");
-		// copy the CA file to a user writable location so we can manipulate it.
-		// for this provider, by using a user writable file, there is a risk that
-		// an attacking program can modify the file, but OS dependent providers
-		// will reduce that risk.
-		// by using a user file, modifications will be limited to one user if
-		// we read-only the main file
-		if (!LLFile::isfile(store_file))
-		{
-
-			std::string ca_file_path = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "CA.pem");
-			llifstream ca_file(ca_file_path.c_str(), llifstream::binary | llifstream::in);
-			llofstream copied_store_file(store_file.c_str(), llofstream::binary | llofstream::out);
-
-			while(!ca_file.fail())
-			{
-				char buffer[BUFFER_READ_SIZE];
-				ca_file.read(buffer, sizeof(buffer));
-				copied_store_file.write(buffer, ca_file.gcount());
-			}
-			ca_file.close();
-			copied_store_file.close();
-		}
-		LL_INFOS("SECAPI") << "Loading certificate store from " << store_file << LL_ENDL;
-		mStore = new LLBasicCertificateStore(store_file);
-	}
-	_readProtectedData(); // initialize mProtectedDataMap
-						  // may throw LLProtectedDataException if saved datamap is not decryptable
-}
-LLSecAPIBasicHandler::~LLSecAPIBasicHandler()
-{
-	_writeProtectedData();
-}
-
-void LLSecAPIBasicHandler::_readProtectedData()
-{	
-	// attempt to load the file into our map
-	LLPointer<LLSDParser> parser = new LLSDXMLParser();
-	llifstream protected_data_stream(mProtectedDataFilename.c_str(), 
-									llifstream::binary);
-
-	if (!protected_data_stream.fail()) {
-		int offset;
-		U8 salt[STORE_SALT_SIZE];
-		U8 buffer[BUFFER_READ_SIZE];
-		U8 decrypted_buffer[BUFFER_READ_SIZE];
-		int decrypted_length;	
-		unsigned char MACAddress[MAC_ADDRESS_BYTES];
-		LLUUID::getNodeID(MACAddress);
-		LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
-
-		// read in the salt and key
-		protected_data_stream.read((char *)salt, STORE_SALT_SIZE);
-		offset = 0;
-		if (protected_data_stream.gcount() < STORE_SALT_SIZE)
-		{
-			throw LLProtectedDataException("Config file too short.");
-		}
-
-		cipher.decrypt(salt, STORE_SALT_SIZE);		
-
-		// totally lame.  As we're not using the OS level protected data, we need to
-		// at least obfuscate the data.  We do this by using a salt stored at the head of the file
-		// to encrypt the data, therefore obfuscating it from someone using simple existing tools.
-		// We do include the MAC address as part of the obfuscation, which would require an
-		// attacker to get the MAC address as well as the protected store, which improves things
-		// somewhat.  It would be better to use the password, but as this store
-		// will be used to store the SL password when the user decides to have SL remember it, 
-		// so we can't use that.  OS-dependent store implementations will use the OS password/storage 
-		// mechanisms and are considered to be more secure.
-		// We've a strong intent to move to OS dependent protected data stores.
-		
-
-		// read in the rest of the file.
-		EVP_CIPHER_CTX ctx;
-		EVP_CIPHER_CTX_init(&ctx);
-		EVP_DecryptInit(&ctx, EVP_rc4(), salt, NULL);
-		// allocate memory:
-		std::string decrypted_data;	
-		
-		while(protected_data_stream.good()) {
-			// read data as a block:
-			protected_data_stream.read((char *)buffer, BUFFER_READ_SIZE);
-			
-			EVP_DecryptUpdate(&ctx, decrypted_buffer, &decrypted_length, 
-							  buffer, protected_data_stream.gcount());
-			decrypted_data.append((const char *)decrypted_buffer, protected_data_stream.gcount());
-		}
-		
-		// RC4 is a stream cipher, so we don't bother to EVP_DecryptFinal, as there is
-		// no block padding.
-		EVP_CIPHER_CTX_cleanup(&ctx);
-		std::istringstream parse_stream(decrypted_data);
-		if (parser->parse(parse_stream, mProtectedDataMap, 
-						  LLSDSerialize::SIZE_UNLIMITED) == LLSDParser::PARSE_FAILURE)
-		{
-			throw LLProtectedDataException("Config file cannot be decrypted.");
-		}
-	}
-}
-
-void LLSecAPIBasicHandler::_writeProtectedData()
-{	
-	std::ostringstream formatted_data_ostream;
-	U8 salt[STORE_SALT_SIZE];
-	U8 buffer[BUFFER_READ_SIZE];
-	U8 encrypted_buffer[BUFFER_READ_SIZE];
-
-	
-	if(mProtectedDataMap.isUndefined())
-	{
-		LLFile::remove(mProtectedDataFilename);
-		return;
-	}
-	// create a string with the formatted data.
-	LLSDSerialize::toXML(mProtectedDataMap, formatted_data_ostream);
-	std::istringstream formatted_data_istream(formatted_data_ostream.str());
-	// generate the seed
-	RAND_bytes(salt, STORE_SALT_SIZE);
-
-	
-	// write to a temp file so we don't clobber the initial file if there is
-	// an error.
-	std::string tmp_filename = mProtectedDataFilename + ".tmp";
-	
-	llofstream protected_data_stream(tmp_filename.c_str(), 
-										llofstream::binary);
-	try
-	{
-		
-		EVP_CIPHER_CTX ctx;
-		EVP_CIPHER_CTX_init(&ctx);
-		EVP_EncryptInit(&ctx, EVP_rc4(), salt, NULL);
-		unsigned char MACAddress[MAC_ADDRESS_BYTES];
-		LLUUID::getNodeID(MACAddress);
-		LLXORCipher cipher(MACAddress, MAC_ADDRESS_BYTES);
-		cipher.encrypt(salt, STORE_SALT_SIZE);
-		protected_data_stream.write((const char *)salt, STORE_SALT_SIZE);
-
-		while (formatted_data_istream.good())
-		{
-			formatted_data_istream.read((char *)buffer, BUFFER_READ_SIZE);
-			if(formatted_data_istream.gcount() == 0)
-			{
-				break;
-			}
-			int encrypted_length;
-			EVP_EncryptUpdate(&ctx, encrypted_buffer, &encrypted_length, 
-						  buffer, formatted_data_istream.gcount());
-			protected_data_stream.write((const char *)encrypted_buffer, encrypted_length);
-		}
-		
-		// no EVP_EncrypteFinal, as this is a stream cipher
-		EVP_CIPHER_CTX_cleanup(&ctx);
-
-		protected_data_stream.close();
-	}
-	catch (...)
-	{
-		// it's good practice to clean up any secure information on error
-		// (even though this file isn't really secure.  Perhaps in the future
-		// it may be, however.
-		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Error writing Protected Data Store");
-	}
-
-	// move the temporary file to the specified file location.
-	if((((LLFile::isfile(mProtectedDataFilename) != 0) && 
-		 (LLFile::remove(mProtectedDataFilename) != 0))) || 
-	   (LLFile::rename(tmp_filename, mProtectedDataFilename)))
-	{
-		LLFile::remove(tmp_filename);
-		throw LLProtectedDataException("Could not overwrite protected data store");
-	}
-}
-		
-// instantiate a certificate from a pem string
-LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(const std::string& pem_cert)
-{
-	LLPointer<LLCertificate> result = new LLBasicCertificate(pem_cert);
-	return result;
-}
-		
-
-		
-// instiate a certificate from an openssl X509 structure
-LLPointer<LLCertificate> LLSecAPIBasicHandler::getCertificate(X509* openssl_cert)
-{
-	LLPointer<LLCertificate> result = new LLBasicCertificate(openssl_cert);
-	return result;		
-}
-		
-// instantiate a chain from an X509_STORE_CTX
-LLPointer<LLCertificateChain> LLSecAPIBasicHandler::getCertificateChain(const X509_STORE_CTX* chain)
-{
-	LLPointer<LLCertificateChain> result = new LLBasicCertificateChain(chain);
-	return result;
-}
-		
-// instantiate a cert store given it's id.  if a persisted version
-// exists, it'll be loaded.  If not, one will be created (but not
-// persisted)
-LLPointer<LLCertificateStore> LLSecAPIBasicHandler::getCertificateStore(const std::string& store_id)
-{
-	return mStore;
-}
-		
-// retrieve protected data
-LLSD LLSecAPIBasicHandler::getProtectedData(const std::string& data_type,
-											const std::string& data_id)
-{
-
-	if (mProtectedDataMap.has(data_type) && 
-		mProtectedDataMap[data_type].isMap() && 
-		mProtectedDataMap[data_type].has(data_id))
-	{
-		return mProtectedDataMap[data_type][data_id];
-	}
-																				
-	return LLSD();
-}
-
-void LLSecAPIBasicHandler::deleteProtectedData(const std::string& data_type,
-											   const std::string& data_id)
-{
-	if (mProtectedDataMap.has(data_type) &&
-		mProtectedDataMap[data_type].isMap() &&
-		mProtectedDataMap[data_type].has(data_id))
-		{
-			mProtectedDataMap[data_type].erase(data_id);
-		}
-}
-
-
-//
-// persist data in a protected store
-//
-void LLSecAPIBasicHandler::setProtectedData(const std::string& data_type,
-											const std::string& data_id,
-											const LLSD& data)
-{
-	if (!mProtectedDataMap.has(data_type) || !mProtectedDataMap[data_type].isMap()) {
-		mProtectedDataMap[data_type] = LLSD::emptyMap();
-	}
-	
-	mProtectedDataMap[data_type][data_id] = data; 
-}
-
-//
-// Create a credential object from an identifier and authenticator.  credentials are
-// per grid.
-LLPointer<LLCredential> LLSecAPIBasicHandler::createCredential(const std::string& grid,
-															   const LLSD& identifier, 
-															   const LLSD& authenticator)
-{
-	LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
-	result->setCredentialData(identifier, authenticator);
-	return result;
-}
-
-// Load a credential from the credential store, given the grid
-LLPointer<LLCredential> LLSecAPIBasicHandler::loadCredential(const std::string& grid)
-{
-	LLSD credential = getProtectedData("credential", grid);
-	LLPointer<LLSecAPIBasicCredential> result = new LLSecAPIBasicCredential(grid);
-	if(credential.isMap() && 
-	   credential.has("identifier"))
-	{
-
-		LLSD identifier = credential["identifier"];
-		LLSD authenticator;
-		if (credential.has("authenticator"))
-		{
-			authenticator = credential["authenticator"];
-		}
-		result->setCredentialData(identifier, authenticator);
-	}
-	else
-	{
-		// credential was not in protected storage, so pull the credential
-		// from the legacy store.
-		std::string first_name = gSavedSettings.getString("FirstName");
-		std::string last_name = gSavedSettings.getString("LastName");
-		
-		if ((first_name != "") &&
-			(last_name != ""))
-		{
-			LLSD identifier = LLSD::emptyMap();
-			LLSD authenticator;
-			identifier["type"] = "agent";
-			identifier["first_name"] = first_name;
-			identifier["last_name"] = last_name;
-			
-			std::string legacy_password = _legacyLoadPassword();
-			if (legacy_password.length() > 0)
-			{
-				authenticator = LLSD::emptyMap();
-				authenticator["type"] = "hash";
-				authenticator["algorithm"] = "md5";
-				authenticator["secret"] = legacy_password;
-			}
-			result->setCredentialData(identifier, authenticator);
-		}		
-	}
-	return result;
-}
-
-// Save the credential to the credential store.  Save the authenticator also if requested.
-// That feature is used to implement the 'remember password' functionality.
-void LLSecAPIBasicHandler::saveCredential(LLPointer<LLCredential> cred, bool save_authenticator)
-{
-	LLSD credential = LLSD::emptyMap();
-	credential["identifier"] = cred->getIdentifier(); 
-	if (save_authenticator) 
-	{
-		credential["authenticator"] = cred->getAuthenticator();
-	}
-	LL_INFOS("SECAPI") << "Saving Credential " << cred->getGrid() << ":" << cred->userID() << " " << save_authenticator << LL_ENDL;
-	setProtectedData("credential", cred->getGrid(), credential);
-	//*TODO: If we're saving Agni credentials, should we write the
-	// credentials to the legacy password.dat/etc?
-	_writeProtectedData();
-}
-
-// Remove a credential from the credential store.
-void LLSecAPIBasicHandler::deleteCredential(LLPointer<LLCredential> cred)
-{
-	LLSD undefVal;
-	deleteProtectedData("credential", cred->getGrid());
-	cred->setCredentialData(undefVal, undefVal);
-	_writeProtectedData();
-}
-
-// load the legacy hash for agni, and decrypt it given the 
-// mac address
-std::string LLSecAPIBasicHandler::_legacyLoadPassword()
-{
-	const S32 HASHED_LENGTH = 32;	
-	std::vector<U8> buffer(HASHED_LENGTH);
-	llifstream password_file(mLegacyPasswordPath, llifstream::binary);
-	
-	if(password_file.fail())
-	{
-		return std::string("");
-	}
-	
-	password_file.read((char*)&buffer[0], buffer.size());
-	if(password_file.gcount() != buffer.size())
-	{
-		return std::string("");
-	}
-	
-	// Decipher with MAC address
-	unsigned char MACAddress[MAC_ADDRESS_BYTES];
-	LLUUID::getNodeID(MACAddress);
-	LLXORCipher cipher(MACAddress, 6);
-	cipher.decrypt(&buffer[0], buffer.size());
-	
-	return std::string((const char*)&buffer[0], buffer.size());
-}
-
-
-// return an identifier for the user
-std::string LLSecAPIBasicCredential::userID() const
-{
-	if (!mIdentifier.isMap())
-	{
-		return mGrid + "(null)";
-	}
-	else if ((std::string)mIdentifier["type"] == "agent")
-	{
-		return  (std::string)mIdentifier["first_name"] + "_" + (std::string)mIdentifier["last_name"];
-	}
-	else if ((std::string)mIdentifier["type"] == "account")
-	{
-		return (std::string)mIdentifier["account_name"];
-	}
-
-	return "unknown";
-
-}
-
-// return a printable user identifier
-std::string LLSecAPIBasicCredential::asString() const
-{
-	if (!mIdentifier.isMap())
-	{
-		return mGrid + ":(null)";
-	}
-	else if ((std::string)mIdentifier["type"] == "agent")
-	{
-		return mGrid + ":" + (std::string)mIdentifier["first_name"] + " " + (std::string)mIdentifier["last_name"];
-	}
-	else if ((std::string)mIdentifier["type"] == "account")
-	{
-		return mGrid + ":" + (std::string)mIdentifier["account_name"];
-	}
-
-	return mGrid + ":(unknown type)";
-}
-
-
-bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs)
-{
-	if (lhs.type() != rhs.type())
-	{
-		return FALSE;
-	}
-    if (lhs.isMap())
-	{
-		// iterate through the map, verifying the right hand side has all of the
-		// values that the left hand side has.
-		for (LLSD::map_const_iterator litt = lhs.beginMap();
-			 litt != lhs.endMap();
-			 litt++)
-		{
-			if (!rhs.has(litt->first))
-			{
-				return FALSE;
-			}
-		}
-		
-		// Now validate that the left hand side has everything the
-		// right hand side has, and that the values are equal.
-		for (LLSD::map_const_iterator ritt = rhs.beginMap();
-			 ritt != rhs.endMap();
-			 ritt++)
-		{
-			if (!lhs.has(ritt->first))
-			{
-				return FALSE;
-			}
-			if (!valueCompareLLSD(lhs[ritt->first], ritt->second))
-			{
-				return FALSE;
-			}
-		}
-		return TRUE;
-	}
-    else if (lhs.isArray())
-	{
-		LLSD::array_const_iterator ritt = rhs.beginArray();
-		// iterate through the array, comparing
-		for (LLSD::array_const_iterator litt = lhs.beginArray();
-			 litt != lhs.endArray();
-			 litt++)
-		{
-			if (!valueCompareLLSD(*ritt, *litt))
-			{
-				return FALSE;
-			}
-			ritt++;
-		}
-		
-		return (ritt == rhs.endArray());
-	}
-    else
-	{
-		// simple type, compare as string
-		return (lhs.asString() == rhs.asString());
-	}
-	
-}
diff --git a/indra/newview/llsechandler_basic.h b/indra/newview/llsechandler_basic.h
deleted file mode 100644
index 4bbb73f062..0000000000
--- a/indra/newview/llsechandler_basic.h
+++ /dev/null
@@ -1,285 +0,0 @@
-/** 
- * @file llsechandler_basic.h
- * @brief Security API for services such as certificate handling
- * secure local storage, etc.
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#ifndef LLSECHANDLER_BASIC
-#define LLSECHANDLER_BASIC
-
-#include "llsecapi.h"
-#include <vector>
-#include <openssl/x509.h>
-
-// helpers
-extern LLSD cert_name_from_X509_NAME(X509_NAME* name);
-extern std::string cert_string_name_from_X509_NAME(X509_NAME* name);
-extern std::string cert_string_from_asn1_integer(ASN1_INTEGER* value);
-extern LLDate cert_date_from_asn1_time(ASN1_TIME* asn1_time);
-extern std::string cert_get_digest(const std::string& digest_type, X509 *cert);
-
-
-// class LLCertificate
-// 
-class LLBasicCertificate : public LLCertificate
-{
-public:		
-	LOG_CLASS(LLBasicCertificate);
-
-	LLBasicCertificate(const std::string& pem_cert);
-	LLBasicCertificate(X509* openSSLX509);
-	
-	virtual ~LLBasicCertificate();
-	
-	virtual std::string getPem() const;
-	virtual std::vector<U8> getBinary() const;
-	virtual LLSD getLLSD() const;
-
-	virtual X509* getOpenSSLX509() const;
-	
-	// set llsd elements for testing
-	void setLLSD(const std::string name, const LLSD& value) { mLLSDInfo[name] = value; }
-protected:
-
-	// certificates are stored as X509 objects, as validation and
-	// other functionality is via openssl
-	X509* mCert;
-	
-	LLSD& _initLLSD();
-	LLSD mLLSDInfo;
-};
-
-
-// class LLBasicCertificateVector
-// Class representing a list of certificates
-// This implementation uses a stl vector of certificates.
-class LLBasicCertificateVector : virtual public LLCertificateVector
-{
-	
-public:
-	LLBasicCertificateVector() {}
-	
-	virtual ~LLBasicCertificateVector() {}
-	
-	// Implementation of the basic iterator implementation.
-	// The implementation uses a vector iterator derived from 
-	// the vector in the LLBasicCertificateVector class
-	class BasicIteratorImpl : public iterator_impl
-	{
-	public:
-		BasicIteratorImpl(std::vector<LLPointer<LLCertificate> >::iterator _iter) { mIter = _iter;}
-		virtual ~BasicIteratorImpl() {};
-		// seek forward or back.  Used by the operator++/operator-- implementations
-		virtual void seek(bool incr)
-		{
-			if(incr)
-			{
-				mIter++;
-			}
-			else
-			{
-				mIter--;
-			}
-		}
-		// create a copy of the iterator implementation class, used by the iterator copy constructor
-		virtual LLPointer<iterator_impl> clone() const
-		{
-			return new BasicIteratorImpl(mIter);
-		}
-		
-		virtual bool equals(const LLPointer<iterator_impl>& _iter) const
-		{
-			const BasicIteratorImpl *rhs_iter = dynamic_cast<const BasicIteratorImpl *>(_iter.get());
-			return (mIter == rhs_iter->mIter);
-		}
-		virtual LLPointer<LLCertificate> get()
-		{
-			return *mIter;
-		}
-	protected:
-		friend class LLBasicCertificateVector;
-		std::vector<LLPointer<LLCertificate> >::iterator mIter;
-	};
-	
-	// numeric index of the vector
-	virtual LLPointer<LLCertificate> operator[](int _index) { return mCerts[_index];}
-	
-	// Iteration
-	virtual iterator begin() { return iterator(new BasicIteratorImpl(mCerts.begin())); }
-	
-	virtual iterator end() {  return iterator(new BasicIteratorImpl(mCerts.end())); }
-	
-	// find a cert given params
-	virtual iterator find(const LLSD& params);
-	
-	// return the number of certs in the store
-	virtual int size() const { return mCerts.size(); }	
-	
-	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
-	virtual void  add(LLPointer<LLCertificate> cert) { insert(end(), cert); }
-	
-	// insert the cert to the store.  if a copy of the cert already exists in the store, it is removed first
-	virtual void  insert(iterator _iter, LLPointer<LLCertificate> cert);	
-	
-	// remove a certificate from the store
-	virtual LLPointer<LLCertificate> erase(iterator _iter);
-	
-protected:
-	std::vector<LLPointer<LLCertificate> >mCerts;	
-};
-
-// class LLCertificateStore
-// represents a store of certificates, typically a store of root CA
-// certificates.  The store can be persisted, and can be used to validate
-// a cert chain
-//
-class LLBasicCertificateStore : virtual public LLBasicCertificateVector, public LLCertificateStore
-{
-public:
-	LLBasicCertificateStore(const std::string& filename);
-	void load_from_file(const std::string& filename);
-	
-	virtual ~LLBasicCertificateStore();
-	
-	// persist the store
-	virtual void save();
-	
-	// return the store id
-	virtual std::string storeId() const;
-	
-protected:
-	std::vector<LLPointer<LLCertificate> >mCerts;
-	std::string mFilename;
-};
-
-// class LLCertificateChain
-// Class representing a chain of certificates in order, with the 
-// first element being the child cert.
-class LLBasicCertificateChain : virtual public LLBasicCertificateVector, public LLCertificateChain
-{
-	
-public:
-	LLBasicCertificateChain(const X509_STORE_CTX * store);
-	
-	virtual ~LLBasicCertificateChain() {}
-	
-	// validate a certificate chain against a certificate store, using the
-	// given validation policy.
-	virtual void validate(int validation_policy,
-						  LLPointer<LLCertificateStore> ca_store,
-						  const LLSD& validation_params);
-};
-
-
-
-// LLSecAPIBasicCredential class
-class LLSecAPIBasicCredential : public LLCredential
-{
-public:
-	LLSecAPIBasicCredential(const std::string& grid) : LLCredential(grid) {} 
-	virtual ~LLSecAPIBasicCredential() {}
-	// return a value representing the user id, (could be guid, name, whatever)
-	virtual std::string userID() const;	
-	
-	// printible string identifying the credential.
-	virtual std::string asString() const;
-};
-
-// LLSecAPIBasicHandler Class
-// Interface handler class for the various security storage handlers.
-class LLSecAPIBasicHandler : public LLSecAPIHandler
-{
-public:
-	
-	LLSecAPIBasicHandler(const std::string& protected_data_filename,
-						 const std::string& legacy_password_path);
-	LLSecAPIBasicHandler();
-	
-	void init();
-	
-	virtual ~LLSecAPIBasicHandler();
-	
-	// instantiate a certificate from a pem string
-	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert);
-	
-	
-	// instiate a certificate from an openssl X509 structure
-	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert);
-	
-	// instantiate a chain from an X509_STORE_CTX
-	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain);
-	
-	// instantiate a cert store given it's id.  if a persisted version
-	// exists, it'll be loaded.  If not, one will be created (but not
-	// persisted)
-	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id);
-	
-	// persist data in a protected store
-	virtual void setProtectedData(const std::string& data_type,
-								  const std::string& data_id,
-								  const LLSD& data);
-	
-	// retrieve protected data
-	virtual LLSD getProtectedData(const std::string& data_type,
-								  const std::string& data_id);
-	
-	// delete a protected data item from the store
-	virtual void deleteProtectedData(const std::string& data_type,
-									 const std::string& data_id);
-	
-	// credential management routines
-	
-	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
-													 const LLSD& identifier, 
-													 const LLSD& authenticator);
-	
-	virtual LLPointer<LLCredential> loadCredential(const std::string& grid);
-
-	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator);
-	
-	virtual void deleteCredential(LLPointer<LLCredential> cred);
-	
-protected:
-	void _readProtectedData();
-	void _writeProtectedData();
-	std::string _legacyLoadPassword();
-
-	std::string mProtectedDataFilename;
-	LLSD mProtectedDataMap;
-	LLPointer<LLBasicCertificateStore> mStore;
-	
-	std::string mLegacyPasswordPath;
-};
-
-bool valueCompareLLSD(const LLSD& lhs, const LLSD& rhs);
-
-#endif // LLSECHANDLER_BASIC
-
-
-
diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp
index 3ef810c3e9..d03a492cd1 100644
--- a/indra/newview/llselectmgr.cpp
+++ b/indra/newview/llselectmgr.cpp
@@ -2435,7 +2435,7 @@ BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
 	
 	if (identical)
 	{
-		name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+		name = LLSLURL::buildCommand("agent", first_id, "inspect");
 	}
 	else
 	{
@@ -2494,11 +2494,11 @@ BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull() && !first_group_owned);
 		if (first_group_owned)
 		{
-			name = LLSLURL("group", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("group", first_id, "inspect");
 		}
 		else if(!public_owner)
 		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("agent", first_id, "inspect");
 		}
 		else
 		{
@@ -2558,7 +2558,7 @@ BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
 		BOOL public_owner = (first_id.isNull());
 		if(!public_owner)
 		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+			name = LLSLURL::buildCommand("agent", first_id, "inspect");
 		}
 		else
 		{
diff --git a/indra/newview/llslurl.cpp b/indra/newview/llslurl.cpp
index ff7e479368..5d20e280b5 100644
--- a/indra/newview/llslurl.cpp
+++ b/indra/newview/llslurl.cpp
@@ -1,11 +1,10 @@
 /** 
- * @file llurlsimstring.cpp (was llsimurlstring.cpp)
- * @brief Handles "SLURL fragments" like Ahern/123/45 for
- * startup processing, login screen, prefs, etc.
+ * @file llslurl.cpp
+ * @brief SLURL manipulation
  *
- * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
- * Copyright (c) 2006-2010, Linden Research, Inc.
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,12 +12,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -34,443 +34,155 @@
 
 #include "llslurl.h"
 
-#include "llpanellogin.h"
-#include "llviewercontrol.h"
-#include "llviewernetwork.h"
-#include "llfiltersd2xmlrpc.h"
-#include "curl/curl.h"
-const char* LLSLURL::SLURL_HTTP_SCHEME		 = "http";
-const char* LLSLURL::SLURL_HTTPS_SCHEME		 = "https";
-const char* LLSLURL::SLURL_SECONDLIFE_SCHEME	 = "secondlife";
-const char* LLSLURL::SLURL_SECONDLIFE_PATH	 = "secondlife";
-const char* LLSLURL::SLURL_COM		         = "slurl.com";
-// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you  can copy and drag
+#include "llweb.h"
+
+#include "llurlregistry.h"
+
+const std::string LLSLURL::PREFIX_SL_HELP		= "secondlife://app.";
+const std::string LLSLURL::PREFIX_SL			= "sl://";
+const std::string LLSLURL::PREFIX_SECONDLIFE	= "secondlife://";
+const std::string LLSLURL::PREFIX_SLURL_OLD		= "http://slurl.com/secondlife/";
+
+// For DnD - even though www.slurl.com redirects to slurl.com in a browser, you can copy and drag
 // text with www.slurl.com or a link explicitly pointing at www.slurl.com so testing for this
 // version is required also.
+const std::string LLSLURL::PREFIX_SLURL_WWW		= "http://www.slurl.com/secondlife/";
 
-const char* LLSLURL::WWW_SLURL_COM		 = "www.slurl.com";
-const char* LLSLURL::MAPS_SECONDLIFE_COM	 = "maps.secondlife.com";	
-const char* LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME = "x-grid-location-info";
-const char* LLSLURL::SLURL_APP_PATH              = "app";
-const char* LLSLURL::SLURL_REGION_PATH           = "region";
-const char* LLSLURL::SIM_LOCATION_HOME           = "home";
-const char* LLSLURL::SIM_LOCATION_LAST           = "last";
+const std::string LLSLURL::PREFIX_SLURL			= "http://maps.secondlife.com/secondlife/";
 
-// resolve a simstring from a slurl
-LLSLURL::LLSLURL(const std::string& slurl)
+const std::string LLSLURL::APP_TOKEN = "app/";
+
+// static
+std::string LLSLURL::stripProtocol(const std::string& url)
 {
-	// by default we go to agni.
-	mType = INVALID;
-	LL_INFOS("AppInit") << "SLURL: " << slurl << LL_ENDL;
-	if(slurl == SIM_LOCATION_HOME)
+	std::string stripped = url;
+	if (matchPrefix(stripped, PREFIX_SL_HELP))
 	{
-		mType = HOME_LOCATION;
+		stripped.erase(0, PREFIX_SL_HELP.length());
 	}
-	else if(slurl.empty() || (slurl == SIM_LOCATION_LAST))
+	else if (matchPrefix(stripped, PREFIX_SL))
 	{
-
-		mType = LAST_LOCATION;
+		stripped.erase(0, PREFIX_SL.length());
 	}
-	else
+	else if (matchPrefix(stripped, PREFIX_SECONDLIFE))
 	{
-		LLURI slurl_uri;
-		// parse the slurl as a uri
-		if(slurl.find(':') == std::string::npos)
-		{
-			// There may be no scheme ('secondlife:' etc.) passed in.  In that case
-			// we want to normalize the slurl by putting the appropriate scheme
-			// in front of the slurl.  So, we grab the appropriate slurl base
-			// from the grid manager which may be http://slurl.com/secondlife/ for maingrid, or
-			// https://<hostname>/region/ for Standalone grid (the word region, not the region name)
-			// these slurls are typically passed in from the 'starting location' box on the login panel,
-			// where the user can type in <regionname>/<x>/<y>/<z>
-			std::string fixed_slurl = LLGridManager::getInstance()->getSLURLBase();
-			// the slurl that was passed in might have a prepended /, or not.  So,
-			// we strip off the prepended '/' so we don't end up with http://slurl.com/secondlife/<region>/<x>/<y>/<z>
-			// or some such.
-			
-			if(slurl[0] == '/')
-		    {
-				fixed_slurl += slurl.substr(1);
-		    }
-			else
-		    {
-				fixed_slurl += slurl;
-		    }
-			// We then load the slurl into a LLURI form
-			slurl_uri = LLURI(fixed_slurl);
-		}
-		else
-		{
-		    // as we did have a scheme, implying a URI style slurl, we
-		    // simply parse it as a URI
-		    slurl_uri = LLURI(slurl);
-		}
-		
-		LLSD path_array = slurl_uri.pathArray();
-		
-		// determine whether it's a maingrid URI or an Standalone/open style URI
-		// by looking at the scheme.  If it's a 'secondlife:' slurl scheme or
-		// 'sl:' scheme, we know it's maingrid
-		
-		// At the end of this if/else block, we'll have determined the grid,
-		// and the slurl type (APP or LOCATION)
-		if(slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME)
-		{
-			// parse a maingrid style slurl.  We know the grid is maingrid
-			// so grab it.
-			// A location slurl for maingrid (with the special schemes) can be in the form
-			// secondlife://<regionname>/<x>/<y>/<z>
-			// or
-			// secondlife://<Grid>/secondlife/<region>/<x>/<y>/<z>
-			// where if grid is empty, it specifies Agni
-			
-			// An app style slurl for maingrid can be
-			// secondlife://<Grid>/app/<app parameters>
-			// where an empty grid implies Agni
-			
-			// we'll start by checking the top of the 'path' which will be 
-			// either 'app', 'secondlife', or <x>.
-			
-			// default to maingrid
-			
-			mGrid = MAINGRID;
-			
-			if ((path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH) ||
-				(path_array[0].asString() == LLSLURL::SLURL_APP_PATH))
-		    {
-				// it's in the form secondlife://<grid>/(app|secondlife)
-				// so parse the grid name to derive the grid ID
-				if (!slurl_uri.hostName().empty())
-				{
-					mGrid = LLGridManager::getInstance()->getGridByLabel(slurl_uri.hostName());
-				}
-				else if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
-				{
-					// If the slurl is in the form secondlife:///secondlife/<region> form, 
-					// then we are in fact on maingrid.  
-					mGrid = MAINGRID;
-				}
-				else if(path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
-				{
-					// for app style slurls, where no grid name is specified, assume the currently
-					// selected or logged in grid.
-					mGrid =  LLGridManager::getInstance()->getGrid();
-				}
-
-				if(mGrid.empty())
-				{
-					// we couldn't find the grid in the grid manager, so bail
-					return;
-				}
-				// set the type as appropriate.
-				if(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH)
-				{
-					mType = LOCATION;
-				}
-				else
-				{
-					mType = APP;
-				}
-				path_array.erase(0);
-		    }
-			else
-		    {
-				// it wasn't a /secondlife/<region> or /app/<params>, so it must be secondlife://<region>
-				// therefore the hostname will be the region name, and it's a location type
-				mType = LOCATION;
-				// 'normalize' it so the region name is in fact the head of the path_array
-				path_array.insert(0, slurl_uri.hostName());
-		    }
-		}
-		else if((slurl_uri.scheme() == LLSLURL::SLURL_HTTP_SCHEME) ||
-		   (slurl_uri.scheme() == LLSLURL::SLURL_HTTPS_SCHEME) || 
-		   (slurl_uri.scheme() == LLSLURL::SLURL_X_GRID_LOCATION_INFO_SCHEME))
-		{
-		    // We're dealing with either a Standalone style slurl or slurl.com slurl
-		  if ((slurl_uri.hostName() == LLSLURL::SLURL_COM) ||
-		      (slurl_uri.hostName() == LLSLURL::WWW_SLURL_COM) || 
-		      (slurl_uri.hostName() == LLSLURL::MAPS_SECONDLIFE_COM))
-			{
-				// slurl.com implies maingrid
-				mGrid = MAINGRID;
-			}
-		    else
-			{
-				// As it's a Standalone grid/open, we will always have a hostname, as Standalone/open  style
-				// urls are properly formed, unlike the stinky maingrid style
-				mGrid = slurl_uri.hostName();
-			}
-		    if (path_array.size() == 0)
-			{
-				// um, we need a path...
-				return;
-			}
-			
-			// we need to normalize the urls so
-			// the path portion starts with the 'command' that we want to do
-			// it can either be region or app.  
-		    if ((path_array[0].asString() == LLSLURL::SLURL_REGION_PATH) ||
-				(path_array[0].asString() == LLSLURL::SLURL_SECONDLIFE_PATH))
-			{
-				// strip off 'region' or 'secondlife'
-				path_array.erase(0);
-				// it's a location
-				mType = LOCATION;
-			}
-			else if (path_array[0].asString() == LLSLURL::SLURL_APP_PATH)
-			{
-				mType = APP;
-				path_array.erase(0);
-				// leave app appended.  
-			}
-			else
-			{
-				// not a valid https/http/x-grid-location-info slurl, so it'll likely just be a URL
-				return;
-			}
-		}
-		else
-		{
-		    // invalid scheme, so bail
-		    return;
-		}
-		
-		
-		if(path_array.size() == 0)
-		{
-			// we gotta have some stuff after the specifier as to whether it's a region or command
-			return;
-		}
-		
-		// now that we know whether it's an app slurl or a location slurl,
-		// parse the slurl into the proper data structures.
-		if(mType == APP)
-		{		
-			// grab the app command type and strip it (could be a command to jump somewhere, 
-			// or whatever )
-			mAppCmd = path_array[0].asString();
-			path_array.erase(0);
-			
-			// Grab the parameters
-			mAppPath = path_array;
-			// and the query
-			mAppQuery = slurl_uri.query();
-			mAppQueryMap = slurl_uri.queryMap();
-			return;
-		}
-		else if(mType == LOCATION)
-		{
-			// at this point, head of the path array should be [ <region>, <x>, <y>, <z> ] where x, y and z 
-			// are collectively optional
-			// are optional
-			mRegion = LLURI::unescape(path_array[0].asString());
-			path_array.erase(0);
-			
-			// parse the x, y, z
-			if(path_array.size() >= 3)
-			{	
-			  
-			  mPosition = LLVector3(path_array);
-			  if((F32(mPosition[VX]) < 0.f) || 
-                             (mPosition[VX] > REGION_WIDTH_METERS) ||
-			     (F32(mPosition[VY]) < 0.f) || 
-                             (mPosition[VY] > REGION_WIDTH_METERS) ||
-			     (F32(mPosition[VZ]) < 0.f) || 
-                             (mPosition[VZ] > REGION_HEIGHT_METERS))
-			    {
-			      mType = INVALID;
-			      return;
-			    }
- 
-			}
-			else
-			{
-				// if x, y and z were not fully passed in, go to the middle of the region.
-				// teleport will adjust the actual location to make sure you're on the ground
-				// and such
-				mPosition = LLVector3(REGION_WIDTH_METERS/2, REGION_WIDTH_METERS/2, 0);
-			}
-		}
+		stripped.erase(0, PREFIX_SECONDLIFE.length());
+	}
+	else if (matchPrefix(stripped, PREFIX_SLURL))
+	{
+		stripped.erase(0, PREFIX_SLURL.length());
 	}
+	else if (matchPrefix(stripped, PREFIX_SLURL_OLD))
+	{
+		stripped.erase(0, PREFIX_SLURL_OLD.length());
+	}
+	else if (matchPrefix(stripped, PREFIX_SLURL_WWW))
+	{
+		stripped.erase(0, PREFIX_SLURL_WWW.length());
+	}
+	
+	return stripped;
 }
 
-
-// Create a slurl for the middle of the region
-LLSLURL::LLSLURL(const std::string& grid, 
-				 const std::string& region)
+// static
+bool LLSLURL::isSLURL(const std::string& url)
 {
-	mGrid = grid;
-	mRegion = region;
-	mType = LOCATION;
-	mPosition = LLVector3((F64)REGION_WIDTH_METERS/2, (F64)REGION_WIDTH_METERS/2, 0);
+	if (matchPrefix(url, PREFIX_SL_HELP))		return true;
+	if (matchPrefix(url, PREFIX_SL))			return true;
+	if (matchPrefix(url, PREFIX_SECONDLIFE))	return true;
+	if (matchPrefix(url, PREFIX_SLURL))			return true;
+	if (matchPrefix(url, PREFIX_SLURL_OLD))		return true;
+	if (matchPrefix(url, PREFIX_SLURL_WWW))		return true;
+	
+	return false;
 }
 
-
-
-// create a slurl given the position.  The position will be modded with the region
-// width handling global positions as well
-LLSLURL::LLSLURL(const std::string& grid, 
-		 const std::string& region, 
-		 const LLVector3& position)
+bool LLSLURL::isValidSLURL(const std::string& url)
 {
-	mGrid = grid;
-	mRegion = region;
-	S32 x = llround( (F32)fmod( position[VX], (F32)REGION_WIDTH_METERS ) );
-	S32 y = llround( (F32)fmod( position[VY], (F32)REGION_WIDTH_METERS ) );
-	S32 z = llround( (F32)position[VZ] );
-	mType = LOCATION;
-	mPosition = LLVector3(x, y, z);
+	std::string temp_url(url);
+	//"www." may appear in DnD- see description of PREFIX_SLURL_WWW.
+	// If it is found, we remove it because it isn't expected in regexp.
+	if (matchPrefix(url, PREFIX_SLURL_WWW))
+	{
+		size_t position = url.find("www.");
+		temp_url.erase(position,4);
+	}
+	
+	return LLUrlRegistry::getInstance()->isUrl(temp_url);
 }
 
+// static
+bool LLSLURL::isSLURLCommand(const std::string& url)
+{ 
+	if (matchPrefix(url, PREFIX_SL + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SECONDLIFE + "/" + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL_WWW + APP_TOKEN) ||
+		matchPrefix(url, PREFIX_SLURL_OLD + APP_TOKEN) )
+	{
+		return true;
+	}
 
-// create a simstring
-LLSLURL::LLSLURL(const std::string& region, 
-		 const LLVector3& position)
-{
-  *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
-		  region, position);
+	return false;
 }
 
-// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& grid, 
-		 const std::string& region, 
-		 const LLVector3d& global_position)
+// static
+bool LLSLURL::isSLURLHelp(const std::string& url)
 {
-  *this = LLSLURL(grid,
-		  region, LLVector3(global_position.mdV[VX],
-				    global_position.mdV[VY],
-				    global_position.mdV[VZ]));
+	return matchPrefix(url, PREFIX_SL_HELP);
 }
 
-// create a slurl from a global position
-LLSLURL::LLSLURL(const std::string& region, 
-		 const LLVector3d& global_position)
+// static
+std::string LLSLURL::buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
 {
-  *this = LLSLURL(LLGridManager::getInstance()->getGrid(),
-		  region, global_position);
+	std::string slurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z); 
+	slurl = LLWeb::escapeURL( slurl );
+	return slurl;
 }
 
-LLSLURL::LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb)
+// static
+std::string LLSLURL::buildCommand(const char* noun, const LLUUID& id, const char* verb)
 {
-  mType = APP;
-  mAppCmd = command;
-  mAppPath = LLSD::emptyArray();
-  mAppPath.append(LLSD(id));
-  mAppPath.append(LLSD(verb));
+	std::string slurl = llformat("secondlife:///app/%s/%s/%s",
+		noun, id.asString().c_str(), verb);
+	return slurl;
 }
 
-
-std::string LLSLURL::getSLURLString() const
+// static
+std::string LLSLURL::buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z)
 {
-	switch(mType)
-	{
-		case HOME_LOCATION:
-			return SIM_LOCATION_HOME;
-		case LAST_LOCATION:
-			return SIM_LOCATION_LAST;
-		case LOCATION:
-			{
-				// lookup the grid
-				S32 x = llround( (F32)mPosition[VX] );
-				S32 y = llround( (F32)mPosition[VY] );
-				S32 z = llround( (F32)mPosition[VZ] );	
-				return LLGridManager::getInstance()->getSLURLBase(mGrid) + 
-				LLURI::escape(mRegion) + llformat("/%d/%d/%d",x,y,z); 
-			}
-		case APP:
-		{
-			std::ostringstream app_url;
-			app_url << LLGridManager::getInstance()->getAppSLURLBase() << "/" << mAppCmd;
-			for(LLSD::array_const_iterator i = mAppPath.beginArray();
-				i != mAppPath.endArray();
-				i++)
-			{
-				app_url << "/" << i->asString();
-			}
-			if(mAppQuery.length() > 0)
-			{
-				app_url << "?" << mAppQuery;
-			}
-			return app_url.str();
-		}	
-		default:
-			LL_WARNS("AppInit") << "Unexpected SLURL type for SLURL string" << (int)mType << LL_ENDL;			
-			return std::string();
-	}
+	std::string unescapedslurl = PREFIX_SLURL + regionname + llformat("/%d/%d/%d",x,y,z);
+	return unescapedslurl;
 }
 
-std::string LLSLURL::getLoginString() const
+// static
+std::string LLSLURL::buildSLURLfromPosGlobal(const std::string& regionname,
+											 const LLVector3d& global_pos,
+											 bool escaped /*= true*/)
 {
-	
-	std::stringstream unescaped_start;
-	switch(mType)
+	S32 x, y, z;
+	globalPosToXYZ(global_pos, x, y, z);
+	if(escaped)
 	{
-		case LOCATION:
-			unescaped_start << "uri:" 
-			<< mRegion << "&" 
-			<< llround(mPosition[0]) << "&" 
-			<< llround(mPosition[1]) << "&" 
-			<< llround(mPosition[2]);
-			break;
-		case HOME_LOCATION:
-			unescaped_start << "home";
-			break;
-		case LAST_LOCATION:
-			unescaped_start << "last";
-			break;
-		default:
-			LL_WARNS("AppInit") << "Unexpected SLURL type for login string" << (int)mType << LL_ENDL;
-			break;
+		return buildSLURL(regionname, x, y, z);
 	}
-	return  xml_escape_string(unescaped_start.str());
-}
-
-bool LLSLURL::operator==(const LLSLURL& rhs)
-{
-	if(rhs.mType != mType) return false;
-	switch(mType)
+	else
 	{
-		case LOCATION:
-			return ((mGrid == rhs.mGrid) &&
-					(mRegion == rhs.mRegion) &&
-					(mPosition == rhs.mPosition));
-		case APP:
-			return getSLURLString() == rhs.getSLURLString();
-			
-		case HOME_LOCATION:
-		case LAST_LOCATION:
-			return true;
-		default:
-			return false;
+		return buildUnescapedSLURL(regionname, x, y, z);
 	}
 }
 
-bool LLSLURL::operator !=(const LLSLURL& rhs)
+// static
+bool LLSLURL::matchPrefix(const std::string& url, const std::string& prefix)
 {
-	return !(*this == rhs);
+	std::string test_prefix = url.substr(0, prefix.length());
+	LLStringUtil::toLower(test_prefix);
+	return test_prefix == prefix;
 }
 
-std::string LLSLURL::getLocationString() const
-{
-	return llformat("%s/%d/%d/%d",
-					mRegion.c_str(),
-					(int)llround(mPosition[0]),
-					(int)llround(mPosition[1]),
-					(int)llround(mPosition[2]));						 
-}
-std::string LLSLURL::asString() const
+void LLSLURL::globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z)
 {
-    std::ostringstream result;
-    result << "   mAppCmd:"  << getAppCmd() <<
-              "   mAppPath:" + getAppPath().asString() <<
-              "   mAppQueryMap:" + getAppQueryMap().asString() <<
-              "   mAppQuery: " + getAppQuery() <<
-              "   mGrid: " + getGrid() <<
-              "   mRegion: " + getRegion() <<
-              "   mPosition: "  <<
-              "   mType: " << mType <<
-              "   mPosition: " << mPosition;
-    return result.str();
+	x = llround((F32)fmod(pos.mdV[VX], (F64)REGION_WIDTH_METERS));
+	y = llround((F32)fmod(pos.mdV[VY], (F64)REGION_WIDTH_METERS));
+	z = llround((F32)pos.mdV[VZ]);
 }
-
diff --git a/indra/newview/llslurl.h b/indra/newview/llslurl.h
index 28c23561cf..a79a8fc97c 100644
--- a/indra/newview/llslurl.h
+++ b/indra/newview/llslurl.h
@@ -1,11 +1,10 @@
-/**
+/** 
  * @file llslurl.h
- * @brief Handles "SLURL fragments" like Ahern/123/45 for
- * startup processing, login screen, prefs, etc.
+ * @brief SLURL manipulation
  *
- * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
- * Copyright (c) 2006-2010, Linden Research, Inc.
+ * Copyright (c) 2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,12 +12,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -29,84 +29,85 @@
  * COMPLETENESS OR PERFORMANCE.
  * $/LicenseInfo$
  */
-#ifndef LLSLURL_H
-#define LLSLURL_H
 
-#include "llstring.h"
+#ifndef LL_SLURL_H
+#define LL_SLURL_H
 
+#include <string>
 
-// represents a location in a grid
+// IAN BUG: where should this live?
+// IAN BUG: are static utility functions right?  See LLUUID.
+// question of whether to have a LLSLURL object or a 
+// some of this was moved from LLURLDispatcher
 
+/**
+ * SLURL manipulation
+ */
 class LLSLURL
 {
 public:
-	static const char* SLURL_HTTPS_SCHEME;
-	static const char* SLURL_HTTP_SCHEME;
-	static const char* SLURL_SL_SCHEME;
-	static const char* SLURL_SECONDLIFE_SCHEME;
-	static const char* SLURL_SECONDLIFE_PATH;
-	static const char* SLURL_COM;
-	static const char* WWW_SLURL_COM;
-	static const char* MAPS_SECONDLIFE_COM;
-	static const char* SLURL_X_GRID_LOCATION_INFO_SCHEME;
-	static LLSLURL START_LOCATION;
-	static const char* SIM_LOCATION_HOME;
-	static const char* SIM_LOCATION_LAST;
-	static const char* SLURL_APP_PATH;
-	static const char* SLURL_REGION_PATH;	
-	
-	enum SLURL_TYPE { 
-		INVALID, 
-		LOCATION,
-		HOME_LOCATION,
-		LAST_LOCATION,
-		APP,
-		HELP 
-	};
-		
-	
-	LLSLURL(): mType(LAST_LOCATION)  { }
-	LLSLURL(const std::string& slurl);
-	LLSLURL(const std::string& grid, const std::string& region);
-	LLSLURL(const std::string& region, const LLVector3& position);
-	LLSLURL(const std::string& grid, const std::string& region, const LLVector3& position);
-	LLSLURL(const std::string& grid, const std::string& region, const LLVector3d& global_position);
-	LLSLURL(const std::string& region, const LLVector3d& global_position);
-	LLSLURL(const std::string& command, const LLUUID&id, const std::string& verb);
-	
-	SLURL_TYPE getType() const { return mType; }
-	
-	std::string getSLURLString() const;
-	std::string getLoginString() const;
-	std::string getLocationString() const; 
-	std::string getGrid() const { return mGrid; }
-	std::string getRegion() const { return mRegion; }
-	LLVector3   getPosition() const { return mPosition; }
-	std::string getAppCmd() const { return mAppCmd; }
-	std::string getAppQuery() const { return mAppQuery; }
-	LLSD        getAppQueryMap() const { return mAppQueryMap; }
-	LLSD        getAppPath() const { return mAppPath; }
-	
-	bool        isValid() const { return mType != INVALID; }
-	bool        isSpatial() const { return (mType == LAST_LOCATION) || (mType == HOME_LOCATION) || (mType == LOCATION); }
-	
-	bool operator==(const LLSLURL& rhs);
-	bool operator!=(const LLSLURL&rhs);
-
-    std::string asString() const ;
-
-protected:
-	SLURL_TYPE mType;
-	
-	// used for Apps and Help
-	std::string mAppCmd;
-	LLSD        mAppPath;
-	LLSD        mAppQueryMap;
-	std::string mAppQuery;
-	
-	std::string mGrid;  // reference to grid manager grid
-	std::string mRegion;
-	LLVector3  mPosition;
+	static const std::string PREFIX_SL_HELP;
+	static const std::string PREFIX_SL;
+	static const std::string PREFIX_SECONDLIFE;
+	static const std::string PREFIX_SLURL;
+	static const std::string PREFIX_SLURL_OLD;
+	static const std::string PREFIX_SLURL_WWW;
+
+	static const std::string APP_TOKEN;
+
+	/**
+	 * Is this any sort of secondlife:// or sl:// URL?
+	 */
+	static bool isSLURL(const std::string& url);
+
+	/**
+	 * Returns true if url is proven valid by regexp check from LLUrlRegistry
+	 */
+	static bool isValidSLURL(const std::string& url);
+
+	/**
+	 * Is this a special secondlife://app/ URL?
+	 */
+	static bool isSLURLCommand(const std::string& url);
+
+	/**
+	 * Not sure what it is.
+	 */
+	static bool isSLURLHelp(const std::string& url);
+
+	/**
+	 * builds: http://slurl.com/secondlife/Region%20Name/x/y/z/ escaping result url.
+	 */
+	static std::string buildSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
+
+	/// Build a SLURL like secondlife:///app/agent/<uuid>/inspect
+	static std::string buildCommand(const char* noun, const LLUUID& id, const char* verb);
+
+	/**
+	 * builds: http://slurl.com/secondlife/Region Name/x/y/z/ without escaping result url.
+	 */
+	static std::string buildUnescapedSLURL(const std::string& regionname, S32 x, S32 y, S32 z);
+
+	/**
+	 * builds SLURL from global position. Returns escaped or unescaped url.
+	 * Returns escaped url by default.
+	 */
+	static std::string buildSLURLfromPosGlobal(const std::string& regionname,
+											   const LLVector3d& global_pos,
+											   bool escaped = true);
+	/**
+	 * Strip protocol part from the URL.
+	 */
+	static std::string stripProtocol(const std::string& url);
+
+	/**
+	 * Convert global position to X, Y Z
+	 */
+	static void globalPosToXYZ(const LLVector3d& pos, S32& x, S32& y, S32& z);
+
+private:
+	static bool matchPrefix(const std::string& url, const std::string& prefix);
+
 };
 
-#endif // LLSLURL_H
+#endif
diff --git a/indra/newview/llspeakbutton.cpp b/indra/newview/llspeakbutton.cpp
index d7de050636..c5c311ed33 100644
--- a/indra/newview/llspeakbutton.cpp
+++ b/indra/newview/llspeakbutton.cpp
@@ -59,9 +59,9 @@ LLSpeakButton::Params::Params()
 
 void LLSpeakButton::draw()
 {
-	// LLVoiceClient::getInstance() is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
-	bool openmic = LLVoiceClient::getInstance()->getUserPTTState();
-	bool voiceenabled = LLVoiceClient::getInstance()->voiceEnabled();
+	// gVoiceClient is the authoritative global source of info regarding our open-mic state, we merely reflect that state.
+	bool openmic = gVoiceClient->getUserPTTState();
+	bool voiceenabled = gVoiceClient->voiceEnabled();
 	mSpeakBtn->setToggleState(openmic && voiceenabled);
 	mOutputMonitor->setIsMuted(!voiceenabled);
 	LLUICtrl::draw();
@@ -176,11 +176,11 @@ void LLSpeakButton::setLabelVisible(bool visible)
 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
+	gVoiceClient->inputUserControlState(down); // this method knows/care about whether this translates into a toggle-to-talk or down-to-talk
 }
 void LLSpeakButton::onMouseUp_SpeakBtn()
 {
 	bool down = false;
-	LLVoiceClient::getInstance()->inputUserControlState(down);
+	gVoiceClient->inputUserControlState(down);
 }
 
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index b9534fac9a..4573520647 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -299,7 +299,7 @@ LLPointer<LLSpeaker> LLSpeakerMgr::setSpeaker(const LLUUID& id, const std::strin
 
 void LLSpeakerMgr::update(BOOL resort_ok)
 {
-	if (!LLVoiceClient::getInstance())
+	if (!gVoiceClient)
 	{
 		return;
 	}
@@ -313,7 +313,7 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 	}
 
 	// update status of all current speakers
-	BOOL voice_channel_active = (!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
+	BOOL voice_channel_active = (!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive());
 	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end();)
 	{
 		LLUUID speaker_id = speaker_it->first;
@@ -321,21 +321,21 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 		
 		speaker_map_t::iterator  cur_speaker_it = speaker_it++;
 
-		if (voice_channel_active && LLVoiceClient::getInstance()->getVoiceEnabled(speaker_id))
+		if (voice_channel_active && gVoiceClient->getVoiceEnabled(speaker_id))
 		{
-			speakerp->mSpeechVolume = LLVoiceClient::getInstance()->getCurrentPower(speaker_id);
-			BOOL moderator_muted_voice = LLVoiceClient::getInstance()->getIsModeratorMuted(speaker_id);
+			speakerp->mSpeechVolume = gVoiceClient->getCurrentPower(speaker_id);
+			BOOL moderator_muted_voice = gVoiceClient->getIsModeratorMuted(speaker_id);
 			if (moderator_muted_voice != speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mModeratorMutedVoice = moderator_muted_voice;
 				speakerp->fireEvent(new LLSpeakerVoiceModerationEvent(speakerp));
 			}
 
-			if (LLVoiceClient::getInstance()->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
+			if (gVoiceClient->getOnMuteList(speaker_id) || speakerp->mModeratorMutedVoice)
 			{
 				speakerp->mStatus = LLSpeaker::STATUS_MUTED;
 			}
-			else if (LLVoiceClient::getInstance()->getIsSpeaking(speaker_id))
+			else if (gVoiceClient->getIsSpeaking(speaker_id))
 			{
 				// reset inactivity expiration
 				if (speakerp->mStatus != LLSpeaker::STATUS_SPEAKING)
@@ -417,21 +417,19 @@ void LLSpeakerMgr::update(BOOL resort_ok)
 void LLSpeakerMgr::updateSpeakerList()
 {
 	// are we bound to the currently active voice channel?
-	if ((!mVoiceChannel && LLVoiceClient::getInstance()->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
-	{
-	        std::set<LLUUID> participants;
-	        LLVoiceClient::getInstance()->getParticipantList(participants);
-		// add new participants to our list of known speakers
-		for (std::set<LLUUID>::iterator participant_it = participants.begin();
-			 participant_it != participants.end(); 
-			 ++participant_it)
+	if ((!mVoiceChannel && gVoiceClient->inProximalChannel()) || (mVoiceChannel && mVoiceChannel->isActive()))
+	{
+		LLVoiceClient::participantMap* participants = gVoiceClient->getParticipantList();
+		if(participants)
 		{
-				setSpeaker(*participant_it, 
-						   LLVoiceClient::getInstance()->getDisplayName(*participant_it),
-						   LLSpeaker::STATUS_VOICE_ACTIVE, 
-						   (LLVoiceClient::getInstance()->isParticipantAvatar(*participant_it)?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
-
+			LLVoiceClient::participantMap::iterator participant_it;
 
+			// add new participants to our list of known speakers
+			for (participant_it = participants->begin(); participant_it != participants->end(); ++participant_it)
+			{
+				LLVoiceClient::participantState* participantp = participant_it->second;
+				setSpeaker(participantp->mAvatarID, participantp->mDisplayName, LLSpeaker::STATUS_VOICE_ACTIVE, (participantp->isAvatar()?LLSpeaker::SPEAKER_AGENT:LLSpeaker::SPEAKER_EXTERNAL));
+			}
 		}
 	}
 }
@@ -521,7 +519,7 @@ void LLSpeakerMgr::speakerChatted(const LLUUID& speaker_id)
 BOOL LLSpeakerMgr::isVoiceActive()
 {
 	// mVoiceChannel = NULL means current voice channel, whatever it is
-	return LLVoiceClient::getInstance()->voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
+	return LLVoiceClient::voiceEnabled() && mVoiceChannel && mVoiceChannel->isActive();
 }
 
 
diff --git a/indra/newview/llspeakingindicatormanager.cpp b/indra/newview/llspeakingindicatormanager.cpp
index 29237946d2..cc06179481 100644
--- a/indra/newview/llspeakingindicatormanager.cpp
+++ b/indra/newview/llspeakingindicatormanager.cpp
@@ -158,7 +158,7 @@ void SpeakingIndicatorManager::registerSpeakingIndicator(const LLUUID& speaker_i
 	mSpeakingIndicators.insert(value_type);
 
 	speaker_ids_t speakers_uuids;
-	BOOL is_in_same_voice = LLVoiceClient::getInstance()->isParticipant(speaker_id);
+	BOOL is_in_same_voice = LLVoiceClient::getInstance()->findParticipantByID(speaker_id) != NULL;
 
 	speakers_uuids.insert(speaker_id);
 	switchSpeakerIndicators(speakers_uuids, is_in_same_voice);
@@ -210,7 +210,7 @@ void SpeakingIndicatorManager::onChange()
 	LL_DEBUGS("SpeakingIndicator") << "Voice participant list was changed, updating indicators" << LL_ENDL;
 
 	speaker_ids_t speakers_uuids;
-	LLVoiceClient::getInstance()->getParticipantList(speakers_uuids);
+	LLVoiceClient::getInstance()->getParticipantsUUIDSet(speakers_uuids);
 
 	LL_DEBUGS("SpeakingIndicator") << "Switching all OFF, count: " << mSwitchedIndicatorsOn.size() << LL_ENDL;
 	// switch all indicators off
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 4f1bcde302..b5a73a3143 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -147,7 +147,7 @@
 #include "lltrans.h"
 #include "llui.h"
 #include "llurldispatcher.h"
-#include "llslurl.h"
+#include "llurlsimstring.h"
 #include "llurlhistory.h"
 #include "llurlwhitelist.h"
 #include "llvieweraudio.h"
@@ -192,7 +192,6 @@
 #include "llinventorybridge.h"
 #include "llappearancemgr.h"
 #include "llavatariconctrl.h"
-#include "llvoicechannel.h"
 
 #include "lllogin.h"
 #include "llevents.h"
@@ -229,11 +228,11 @@ static std::string sInitialOutfitGender;	// "male" or "female"
 static bool gUseCircuitCallbackCalled = false;
 
 EStartupState LLStartUp::gStartupState = STATE_FIRST;
-LLSLURL LLStartUp::sStartSLURL;
 
-static LLPointer<LLCredential> gUserCredential;
-static std::string gDisplayName;
-static BOOL gRememberPassword = TRUE;     
+// *NOTE:Mani - to reconcile with giab changes...
+static std::string gFirstname;
+static std::string gLastname;
+static std::string gPassword;
 
 static U64 gFirstSimHandle = 0;
 static LLHost gFirstSim;
@@ -250,6 +249,7 @@ boost::scoped_ptr<LLStartupListener> LLStartUp::sListener(new LLStartupListener(
 
 void login_show();
 void login_callback(S32 option, void* userdata);
+bool is_hex_string(U8* str, S32 len);
 void show_first_run_dialog();
 bool first_run_dialog_callback(const LLSD& notification, const LLSD& response);
 void set_startup_status(const F32 frac, const std::string& string, const std::string& msg);
@@ -262,9 +262,6 @@ bool callback_choose_gender(const LLSD& notification, const LLSD& response);
 void init_start_screen(S32 location_id);
 void release_start_screen();
 void reset_login();
-LLSD transform_cert_args(LLPointer<LLCertificate> cert);
-void general_cert_done(const LLSD& notification, const LLSD& response);
-void trust_cert_done(const LLSD& notification, const LLSD& response);
 void apply_udp_blacklist(const std::string& csv);
 bool process_login_success_response();
 void transition_back_to_login_panel(const std::string& emsg);
@@ -367,7 +364,7 @@ bool idle_startup()
 
 	if ( STATE_FIRST == LLStartUp::getStartupState() )
 	{
-		gViewerWindow->showCursor(); 
+		gViewerWindow->showCursor();
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
 		/////////////////////////////////////////////////
@@ -665,25 +662,69 @@ bool idle_startup()
 		//
 		// Log on to system
 		//
-		if (gUserCredential.isNull())
-		{
-			gUserCredential = gLoginHandler.initializeLoginInfo();
-		}
-		if (gUserCredential.isNull())
-		{
-			show_connect_box = TRUE;
-		}
-		else if (gSavedSettings.getBOOL("AutoLogin"))  
-		{
-			gRememberPassword = TRUE;
-			gSavedSettings.setBOOL("RememberPassword", TRUE);                                                      
-			show_connect_box = false;    			
+		if (!LLStartUp::sSLURLCommand.empty())
+		{
+			// this might be a secondlife:///app/login URL
+			gLoginHandler.parseDirectLogin(LLStartUp::sSLURLCommand);
+		}
+		if (!gLoginHandler.getFirstName().empty()
+			|| !gLoginHandler.getLastName().empty()
+			/*|| !gLoginHandler.getWebLoginKey().isNull()*/ )
+		{
+			// We have at least some login information on a SLURL
+			gFirstname = gLoginHandler.getFirstName();
+			gLastname = gLoginHandler.getLastName();
+			LL_DEBUGS("LLStartup") << "STATE_FIRST: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+
+			// Show the login screen if we don't have everything
+			show_connect_box = 
+				gFirstname.empty() || gLastname.empty();
+		}
+        else if(gSavedSettings.getLLSD("UserLoginInfo").size() == 3)
+        {
+            LLSD cmd_line_login = gSavedSettings.getLLSD("UserLoginInfo");
+			gFirstname = cmd_line_login[0].asString();
+			gLastname = cmd_line_login[1].asString();
+			LL_DEBUGS("LLStartup") << "Setting gFirstname, gLastname from gSavedSettings(\"UserLoginInfo\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+
+			LLMD5 pass((unsigned char*)cmd_line_login[2].asString().c_str());
+			char md5pass[33];               /* Flawfinder: ignore */
+			pass.hex_digest(md5pass);
+			gPassword = md5pass;
+			
+#ifdef USE_VIEWER_AUTH
+			show_connect_box = true;
+#else
+			show_connect_box = false;
+#endif
+			gSavedSettings.setBOOL("AutoLogin", TRUE);
+        }
+		else if (gSavedSettings.getBOOL("AutoLogin"))
+		{
+			gFirstname = gSavedSettings.getString("FirstName");
+			gLastname = gSavedSettings.getString("LastName");
+			LL_DEBUGS("LLStartup") << "AutoLogin: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+			gPassword = LLStartUp::loadPasswordFromDisk();
+			gSavedSettings.setBOOL("RememberPassword", TRUE);
+			
+#ifdef USE_VIEWER_AUTH
+			show_connect_box = true;
+#else
+			show_connect_box = false;
+#endif
 		}
-		else 
+		else
 		{
-			gRememberPassword = gSavedSettings.getBOOL("RememberPassword");
-			show_connect_box = TRUE;
+			// if not automatically logging in, display login dialog
+			// a valid grid is selected
+			gFirstname = gSavedSettings.getString("FirstName");
+			gLastname = gSavedSettings.getString("LastName");
+			LL_DEBUGS("LLStartup") << "normal login: setting gFirstname, gLastname from gSavedSettings(\"First|LastName\"): '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+			gPassword = LLStartUp::loadPasswordFromDisk();
+			show_connect_box = true;
 		}
+
+
 		// Go to the next startup state
 		LLStartUp::setStartupState( STATE_BROWSER_INIT );
 		return FALSE;
@@ -715,10 +756,8 @@ bool idle_startup()
 			// Load all the name information out of the login view
 			// NOTE: Hits "Attempted getFields with no login view shown" warning, since we don't
 			// show the login view until login_show() is called below.  
-			if (gUserCredential.isNull())                                                                          
-			{                                                                                                      
-				gUserCredential = gLoginHandler.initializeLoginInfo();                 
-			}     
+			// LLPanelLogin::getFields(gFirstname, gLastname, gPassword);
+
 			if (gNoRender)
 			{
 				LL_ERRS("AppInit") << "Need to autologin or use command line with norender!" << LL_ENDL;
@@ -729,10 +768,8 @@ bool idle_startup()
 			// Show the login dialog
 			login_show();
 			// connect dialog is already shown, so fill in the names
-			if (gUserCredential.notNull())                                                                         
-			{                                                                                                      
-				LLPanelLogin::setFields( gUserCredential, gRememberPassword);                                  
-			}     
+			LLPanelLogin::setFields( gFirstname, gLastname, gPassword);
+
 			LLPanelLogin::giveFocus();
 
 			gSavedSettings.setBOOL("FirstRunThisInstall", FALSE);
@@ -802,36 +839,39 @@ bool idle_startup()
 		// DEV-42215: Make sure they're not empty -- gFirstname and gLastname
 		// might already have been set from gSavedSettings, and it's too bad
 		// to overwrite valid values with empty strings.
+		if (! gLoginHandler.getFirstName().empty() && ! gLoginHandler.getLastName().empty())
+		{
+			gFirstname = gLoginHandler.getFirstName();
+			gLastname = gLoginHandler.getLastName();
+			LL_DEBUGS("LLStartup") << "STATE_LOGIN_CLEANUP: setting gFirstname, gLastname from gLoginHandler: '" << gFirstname << "' '" << gLastname << "'" << LL_ENDL;
+		}
 
 		if (show_connect_box)
 		{
 			// TODO if not use viewer auth
 			// Load all the name information out of the login view
-			LLPanelLogin::getFields(gUserCredential, gRememberPassword); 
+			LLPanelLogin::getFields(&gFirstname, &gLastname, &gPassword);
 			// end TODO
 	 
 			// HACK: Try to make not jump on login
 			gKeyboard->resetKeys();
 		}
 
-		// save the credentials                                                                                        
-		std::string userid = "unknown";                                                                                
-		if(gUserCredential.notNull())                                                                                  
-		{  
-			userid = gUserCredential->userID();                                                                    
-			gSecAPIHandler->saveCredential(gUserCredential, gRememberPassword);  
+		if (!gFirstname.empty() && !gLastname.empty())
+		{
+			gSavedSettings.setString("FirstName", gFirstname);
+			gSavedSettings.setString("LastName", gLastname);
+
+			LL_INFOS("AppInit") << "Attempting login as: " << gFirstname << " " << gLastname << LL_ENDL;
+			gDebugInfo["LoginName"] = gFirstname + " " + gLastname;	
 		}
-		gSavedSettings.setBOOL("RememberPassword", gRememberPassword);                                                 
-		LL_INFOS("AppInit") << "Attempting login as: " << userid << LL_ENDL;                                           
-		gDebugInfo["LoginName"] = userid;                                                                              
-         
+
 		// create necessary directories
 		// *FIX: these mkdir's should error check
-		gDirUtilp->setLindenUserDir(userid);
+		gDirUtilp->setLindenUserDir(gFirstname, gLastname);
 		LLFile::mkdir(gDirUtilp->getLindenUserDir());
-
+		
 		// Set PerAccountSettingsFile to the default value.
-		std::string per_account_settings_file = LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount");
 		gSavedSettings.setString("PerAccountSettingsFile",
 			gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
 				LLAppViewer::instance()->getSettingsFilename("Default", "PerAccount")));
@@ -861,8 +901,9 @@ bool idle_startup()
 		{
 			gDirUtilp->setChatLogsDir(gSavedPerAccountSettings.getString("InstantMessageLogPath"));		
 		}
-		gDirUtilp->setPerAccountChatLogsDir(userid);  
 		
+		gDirUtilp->setPerAccountChatLogsDir(gFirstname, gLastname);
+
 		LLFile::mkdir(gDirUtilp->getChatLogsDir());
 		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir());
 
@@ -883,7 +924,11 @@ bool idle_startup()
 
 		if (show_connect_box)
 		{
-			LLSLURL slurl;
+			std::string location;
+			LLPanelLogin::getLocation( location );
+			LLURLSimString::setString( location );
+
+			// END TODO
 			LLPanelLogin::closePanel();
 		}
 
@@ -907,21 +952,26 @@ bool idle_startup()
 		// their last location, or some URL "-url //sim/x/y[/z]"
 		// All accounts have both a home and a last location, and we don't support
 		// more locations than that.  Choose the appropriate one.  JC
-		switch (LLStartUp::getStartSLURL().getType())
-		  {
-		  case LLSLURL::LOCATION:
-		    agent_location_id = START_LOCATION_ID_URL;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  case LLSLURL::LAST_LOCATION:
-		    agent_location_id = START_LOCATION_ID_LAST;
-		    location_which = START_LOCATION_ID_LAST;
-		    break;
-		  default:
-		    agent_location_id = START_LOCATION_ID_HOME;
-		    location_which = START_LOCATION_ID_HOME;
-		    break;
-		  }
+		if (LLURLSimString::parse())
+		{
+			// a startup URL was specified
+			agent_location_id = START_LOCATION_ID_URL;
+
+			// doesn't really matter what location_which is, since
+			// gAgentStartLookAt will be overwritten when the
+			// UserLoginLocationReply arrives
+			location_which = START_LOCATION_ID_LAST;
+		}
+		else if (gSavedSettings.getString("LoginLocation") == "last" )
+		{
+			agent_location_id = START_LOCATION_ID_LAST;	// last location
+			location_which = START_LOCATION_ID_LAST;
+		}
+		else
+		{
+			agent_location_id = START_LOCATION_ID_HOME;	// home
+			location_which = START_LOCATION_ID_HOME;
+		}
 
 		gViewerWindow->getWindow()->setCursor(UI_CURSOR_WAIT);
 
@@ -948,7 +998,7 @@ bool idle_startup()
 
 	if(STATE_LOGIN_AUTH_INIT == LLStartUp::getStartupState())
 	{
-		gDebugInfo["GridName"] = LLGridManager::getInstance()->getGridLabel();
+		gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel();
 
 		// Update progress status and the display loop.
 		auth_desc = LLTrans::getString("LoginInProgress");
@@ -972,7 +1022,11 @@ bool idle_startup()
 
 		// This call to LLLoginInstance::connect() starts the 
 		// authentication process.
-		login->connect(gUserCredential);
+		LLSD credentials;
+		credentials["first"] = gFirstname;
+		credentials["last"] = gLastname;
+		credentials["passwd"] = gPassword;
+		login->connect(credentials);
 
 		LLStartUp::setStartupState( STATE_LOGIN_CURL_UNSTUCK );
 		return FALSE;
@@ -997,11 +1051,10 @@ bool idle_startup()
 		{
 			LL_INFOS("LLStartup") << "Login failed, LLLoginInstance::getResponse(): "
 			                      << LLLoginInstance::getInstance()->getResponse() << LL_ENDL;
-			LLSD response = LLLoginInstance::getInstance()->getResponse();
 			// Still have error conditions that may need some 
 			// sort of handling.
-			std::string reason_response = response["reason"];
-			std::string message_response = response["message"];
+			std::string reason_response = LLLoginInstance::getInstance()->getResponse("reason");
+			std::string message_response = LLLoginInstance::getInstance()->getResponse("message");
 	
 			if(!message_response.empty())
 			{
@@ -1021,8 +1074,8 @@ bool idle_startup()
 			if(reason_response == "key")
 			{
 				// Couldn't login because user/password is wrong
-				// Clear the credential
-				gUserCredential->clearAuthenticator();
+				// Clear the password
+				gPassword = "";
 			}
 
 			if(reason_response == "update" 
@@ -1035,65 +1088,18 @@ bool idle_startup()
 				LLLoginInstance::getInstance()->disconnect();
 				LLAppViewer::instance()->forceQuit();
 			}
-			else 
+			else
 			{
-				if (reason_response != "tos") 
+				// Don't pop up a notification in the TOS case because
+				// LLFloaterTOS::onCancel() already scolded the user.
+				if (reason_response != "tos")
 				{
-					// Don't pop up a notification in the TOS case because
-					// LLFloaterTOS::onCancel() already scolded the user.
-					std::string error_code;
-					if(response.has("errorcode"))
-					{
-						error_code = response["errorcode"].asString();
-					}
-					if ((reason_response == "CURLError") && 
-						(error_code == "SSL_CACERT" || error_code == "SSL_PEER_CERTIFICATE") && 
-						response.has("certificate"))
-					{
-						// This was a certificate error, so grab the certificate
-						// and throw up the appropriate dialog.
-						LLPointer<LLCertificate> certificate = gSecAPIHandler->getCertificate(response["certificate"]);
-						if(certificate)
-						{
-							LLSD args = transform_cert_args(certificate);
-
-							if(error_code == "SSL_CACERT")
-							{
-								// if we are handling an untrusted CA, throw up the dialog                             
-								// with the 'trust this CA' button.                                                    
-								LLNotificationsUtil::add("TrustCertificateError", args, response,
-														trust_cert_done);
-								
-								show_connect_box = true;
-							}
-							else
-							{
-								// the certificate exception returns a unique string for each type of exception.       
-								// we grab this string via the LLUserAuth object, and use that to grab the localized   
-								// string.                                                                             
-								args["REASON"] = LLTrans::getString(message_response);
-								
-								LLNotificationsUtil::add("GeneralCertificateError", args, response,
-														 general_cert_done);
-								
-								reset_login();
-								gSavedSettings.setBOOL("AutoLogin", FALSE);
-								show_connect_box = true;
-								
-							}
-
-						}
-					}
-					else 
-					{
-						// This wasn't a certificate error, so throw up the normal
-						// notificatioin message.
-						LLSD args;
-						args["ERROR_MESSAGE"] = emsg.str();
-						LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
-						LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
-					}
+					LLSD args;
+					args["ERROR_MESSAGE"] = emsg.str();
+					LL_INFOS("LLStartup") << "Notification: " << args << LL_ENDL;
+					LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
 				}
+
 				//setup map of datetime strings to codes and slt & local time offset from utc
 				// *TODO: Does this need to be here?
 				LLStringOps::setupDatetimeInfo (false);
@@ -1106,12 +1112,7 @@ bool idle_startup()
 			if(process_login_success_response())
 			{
 				// Pass the user information to the voice chat server interface.
-				LLVoiceClient::getInstance()->userAuthorized(gUserCredential->userID(), gAgentID);
-				// create the default proximal channel
-				LLVoiceChannel::initClass();
-				// update the voice settings
-				LLVoiceClient::getInstance()->updateSettings();
-				LLGridManager::getInstance()->setFavorite(); 
+				gVoiceClient->userAuthorized(gFirstname, gLastname, gAgentID);
 				LLStartUp::setStartupState( STATE_WORLD_INIT);
 			}
 			else
@@ -1122,7 +1123,6 @@ bool idle_startup()
 				LLNotificationsUtil::add("ErrorMessage", args, LLSD(), login_alert_done);
 				transition_back_to_login_panel(emsg.str());
 				show_connect_box = true;
-				return FALSE;
 			}
 		}
 		return FALSE;
@@ -1807,12 +1807,9 @@ bool idle_startup()
 		// thus, do not show this alert.
 		if (!gAgent.isFirstLogin())
 		{
-			llinfos << "gAgentStartLocation : " << gAgentStartLocation << llendl;
-			LLSLURL start_slurl = LLStartUp::getStartSLURL();
-			
-			if (((start_slurl.getType() == LLSLURL::LOCATION) && (gAgentStartLocation == "url")) ||
-				((start_slurl.getType() == LLSLURL::LAST_LOCATION) && (gAgentStartLocation == "last")) ||
-				((start_slurl.getType() == LLSLURL::HOME_LOCATION) && (gAgentStartLocation == "home")))
+			bool url_ok = LLURLSimString::sInstance.parse();
+			if ((url_ok && gAgentStartLocation == "url") ||
+				(!url_ok && ((gAgentStartLocation == gSavedSettings.getString("LoginLocation")))))
 			{
 				// Start location is OK
 				// Disabled code to restore camera location and focus if logging in to default location
@@ -1834,23 +1831,17 @@ bool idle_startup()
 			else
 			{
 				std::string msg;
-				switch(start_slurl.getType())
+				if (url_ok)
 				{
-					case LLSLURL::LOCATION:
-					{
-						
-						msg = "AvatarMovedDesired";
-						break;
-					}
-					case LLSLURL::HOME_LOCATION:
-					{
-						msg = "AvatarMovedHome";
-						break;
-					}
-					default:
-					{
-						msg = "AvatarMovedLast";
-					}
+					msg = "AvatarMovedDesired";
+				}
+				else if (gSavedSettings.getString("LoginLocation") == "home")
+				{
+					msg = "AvatarMovedHome";
+				}
+				else
+				{
+					msg = "AvatarMovedLast";
 				}
 				LLNotificationsUtil::add(msg);
 			}
@@ -2066,9 +2057,20 @@ void login_show()
 #endif
 
 	LLPanelLogin::show(	gViewerWindow->getWindowRectScaled(),
-						bUseDebugLogin || gSavedSettings.getBOOL("SecondLifeEnterprise"),
+						bUseDebugLogin,
 						login_callback, NULL );
 
+	// UI textures have been previously loaded in doPreloadImages()
+	
+	LL_DEBUGS("AppInit") << "Setting Servers" << LL_ENDL;
+
+	LLPanelLogin::addServer(LLViewerLogin::getInstance()->getGridLabel(), LLViewerLogin::getInstance()->getGridChoice());
+
+	LLViewerLogin* vl = LLViewerLogin::getInstance();
+	for(int grid_index = GRID_INFO_ADITI; grid_index < GRID_INFO_OTHER; ++grid_index)
+	{
+		LLPanelLogin::addServer(vl->getKnownGridLabel((EGridInfo)grid_index), grid_index);
+	}
 }
 
 // Callback for when login screen is closed.  Option 0 = connect, option 1 = quit.
@@ -2084,6 +2086,9 @@ void login_callback(S32 option, void *userdata)
 	}
 	else if (QUIT_OPTION == option) // *TODO: THIS CODE SEEMS TO BE UNREACHABLE!!!!! login_callback is never called with option equal to QUIT_OPTION
 	{
+		// Make sure we don't save the password if the user is trying to clear it.
+		std::string first, last, password;
+		LLPanelLogin::getFields(&first, &last, &password);
 		if (!gSavedSettings.getBOOL("RememberPassword"))
 		{
 			// turn off the setting and write out to disk
@@ -2106,6 +2111,142 @@ void login_callback(S32 option, void *userdata)
 	}
 }
 
+
+// static
+std::string LLStartUp::loadPasswordFromDisk()
+{
+	// Only load password if we also intend to save it (otherwise the user
+	// wonders what we're doing behind his back).  JC
+	BOOL remember_password = gSavedSettings.getBOOL("RememberPassword");
+	if (!remember_password)
+	{
+		return std::string("");
+	}
+
+	std::string hashed_password("");
+
+	// Look for legacy "marker" password from settings.ini
+	hashed_password = gSavedSettings.getString("Marker");
+	if (!hashed_password.empty())
+	{
+		// Stomp the Marker entry.
+		gSavedSettings.setString("Marker", "");
+
+		// Return that password.
+		return hashed_password;
+	}
+
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+													   "password.dat");
+	LLFILE* fp = LLFile::fopen(filepath, "rb");		/* Flawfinder: ignore */
+	if (!fp)
+	{
+		return hashed_password;
+	}
+
+	// UUID is 16 bytes, written into ASCII is 32 characters
+	// without trailing \0
+	const S32 HASHED_LENGTH = 32;
+	U8 buffer[HASHED_LENGTH+1];
+
+	if (1 != fread(buffer, HASHED_LENGTH, 1, fp))
+	{
+		return hashed_password;
+	}
+
+	fclose(fp);
+
+	// Decipher with MAC address
+	LLXORCipher cipher(gMACAddress, 6);
+	cipher.decrypt(buffer, HASHED_LENGTH);
+
+	buffer[HASHED_LENGTH] = '\0';
+
+	// Check to see if the mac address generated a bad hashed
+	// password. It should be a hex-string or else the mac adress has
+	// changed. This is a security feature to make sure that if you
+	// get someone's password.dat file, you cannot hack their account.
+	if(is_hex_string(buffer, HASHED_LENGTH))
+	{
+		hashed_password.assign((char*)buffer);
+	}
+
+	return hashed_password;
+}
+
+
+// static
+void LLStartUp::savePasswordToDisk(const std::string& hashed_password)
+{
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+													   "password.dat");
+	LLFILE* fp = LLFile::fopen(filepath, "wb");		/* Flawfinder: ignore */
+	if (!fp)
+	{
+		return;
+	}
+
+	// Encipher with MAC address
+	const S32 HASHED_LENGTH = 32;
+	U8 buffer[HASHED_LENGTH+1];
+
+	LLStringUtil::copy((char*)buffer, hashed_password.c_str(), HASHED_LENGTH+1);
+
+	LLXORCipher cipher(gMACAddress, 6);
+	cipher.encrypt(buffer, HASHED_LENGTH);
+
+	if (fwrite(buffer, HASHED_LENGTH, 1, fp) != 1)
+	{
+		LL_WARNS("AppInit") << "Short write" << LL_ENDL;
+	}
+
+	fclose(fp);
+}
+
+
+// static
+void LLStartUp::deletePasswordFromDisk()
+{
+	std::string filepath = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
+														  "password.dat");
+	LLFile::remove(filepath);
+}
+
+
+bool is_hex_string(U8* str, S32 len)
+{
+	bool rv = true;
+	U8* c = str;
+	while(rv && len--)
+	{
+		switch(*c)
+		{
+		case '0':
+		case '1':
+		case '2':
+		case '3':
+		case '4':
+		case '5':
+		case '6':
+		case '7':
+		case '8':
+		case '9':
+		case 'a':
+		case 'b':
+		case 'c':
+		case 'd':
+		case 'e':
+		case 'f':
+			++c;
+			break;
+		default:
+			rv = false;
+			break;
+		}
+	}
+	return rv;
+}
+
 void show_first_run_dialog()
 {
 	LLNotificationsUtil::add("FirstRun", LLSD(), LLSD(), first_run_dialog_callback);
@@ -2147,7 +2288,7 @@ bool login_alert_status(const LLSD& notification, const LLSD& response)
       //      break;
         case 2:     // Teleport
             // Restart the login process, starting at our home locaton
-	  LLStartUp::setStartSLURL(LLSLURL(LLSLURL::SIM_LOCATION_HOME));
+            LLURLSimString::setString("home");
             LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );
             break;
         default:
@@ -2367,35 +2508,30 @@ void asset_callback_nothing(LLVFS*, const LLUUID&, LLAssetType::EType, void*, S3
 const std::string COMMON_GESTURES_FOLDER = "Common Gestures";
 const std::string MALE_GESTURES_FOLDER = "Male Gestures";
 const std::string FEMALE_GESTURES_FOLDER = "Female Gestures";
+const std::string MALE_OUTFIT_FOLDER = "Male Shape & Outfit";
+const std::string FEMALE_OUTFIT_FOLDER = "Female Shape & Outfit";
 const S32 OPT_CLOSED_WINDOW = -1;
 const S32 OPT_MALE = 0;
 const S32 OPT_FEMALE = 1;
-const S32 OPT_TRUST_CERT = 0;
-const S32 OPT_CANCEL_TRUST = 1;
-	
+
 bool callback_choose_gender(const LLSD& notification, const LLSD& response)
-{
-	
-    // These defaults are returned from the server on login.  They are set in login.xml.                  
-    // If no default is returned from the server, they are retrieved from settings.xml.                   
-	
-	S32 option = LLNotification::getSelectedOption(notification, response);
+{	
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	switch(option)
 	{
-		case OPT_MALE:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultMaleAvatar"), "male" );
-			break;
-			
-        case OPT_FEMALE:
-        case OPT_CLOSED_WINDOW:
-        default:
-			LLStartUp::loadInitialOutfit( gSavedSettings.getString("DefaultFemaleAvatar"), "female" );
-			break;
+	case OPT_MALE:
+		LLStartUp::loadInitialOutfit( MALE_OUTFIT_FOLDER, "male" );
+		break;
+
+	case OPT_FEMALE:
+	case OPT_CLOSED_WINDOW:
+	default:
+		LLStartUp::loadInitialOutfit( FEMALE_OUTFIT_FOLDER, "female" );
+		break;
 	}
 	return false;
 }
 
-
 void LLStartUp::loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name )
 {
@@ -2610,6 +2746,7 @@ void reset_login()
 
 //---------------------------------------------------------------------------
 
+std::string LLStartUp::sSLURLCommand;
 
 bool LLStartUp::canGoFullscreen()
 {
@@ -2642,145 +2779,41 @@ void LLStartUp::fontInit()
 bool LLStartUp::dispatchURL()
 {
 	// ok, if we've gotten this far and have a startup URL
-        if (!getStartSLURL().isValid())
+	if (!sSLURLCommand.empty())
 	{
-	  return false;
+		LLMediaCtrl* web = NULL;
+		const bool trusted_browser = false;
+		LLURLDispatcher::dispatch(sSLURLCommand, web, trusted_browser);
 	}
-        if(getStartSLURL().getType() != LLSLURL::APP)
-	  {
-	    
+	else if (LLURLSimString::parse())
+	{
 		// If we started with a location, but we're already
 		// at that location, don't pop dialogs open.
 		LLVector3 pos = gAgent.getPositionAgent();
-		LLVector3 slurlpos = getStartSLURL().getPosition();
-		F32 dx = pos.mV[VX] - slurlpos.mV[VX];
-		F32 dy = pos.mV[VY] - slurlpos.mV[VY];
+		F32 dx = pos.mV[VX] - (F32)LLURLSimString::sInstance.mX;
+		F32 dy = pos.mV[VY] - (F32)LLURLSimString::sInstance.mY;
 		const F32 SLOP = 2.f;	// meters
 
-		if( getStartSLURL().getRegion() != gAgent.getRegion()->getName()
+		if( LLURLSimString::sInstance.mSimName != gAgent.getRegion()->getName()
 			|| (dx*dx > SLOP*SLOP)
 			|| (dy*dy > SLOP*SLOP) )
 		{
-			LLURLDispatcher::dispatch(getStartSLURL().getSLURLString(), 
-						  NULL, false);
+			std::string url = LLURLSimString::getURL();
+			LLMediaCtrl* web = NULL;
+			const bool trusted_browser = false;
+			LLURLDispatcher::dispatch(url, web, trusted_browser);
 		}
 		return true;
 	}
 	return false;
 }
 
-void LLStartUp::setStartSLURL(const LLSLURL& slurl) 
-{
-  sStartSLURL = slurl;
-  switch(slurl.getType())
-    {
-    case LLSLURL::HOME_LOCATION:
-      {
-		  gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_HOME);
-	break;
-      }
-    case LLSLURL::LAST_LOCATION:
-      {
-	gSavedSettings.setString("LoginLocation", LLSLURL::SIM_LOCATION_LAST);
-	break;
-      }
-    default:
-			LLGridManager::getInstance()->setGridChoice(slurl.getGrid());
-			break;
-    }
-}
-
 bool login_alert_done(const LLSD& notification, const LLSD& response)
 {
 	LLPanelLogin::giveFocus();
 	return false;
 }
 
-// parse the certificate information into args for the 
-// certificate notifications
-LLSD transform_cert_args(LLPointer<LLCertificate> cert)
-{
-	LLSD args = LLSD::emptyMap();
-	std::string value;
-	LLSD cert_info = cert->getLLSD();
-	// convert all of the elements in the cert into                                        
-	// args for the xml dialog, so we have flexability to                                  
-	// display various parts of the cert by only modifying                                 
-	// the cert alert dialog xml.                                                          
-	for(LLSD::map_iterator iter = cert_info.beginMap();
-		iter != cert_info.endMap();
-		iter++)
-	{
-		// key usage and extended key usage                                            
-		// are actually arrays, and we want to format them as comma separated          
-		// strings, so special case those.                                             
-		LLSDSerialize::toXML(cert_info[iter->first], std::cout);
-		if((iter->first== std::string(CERT_KEY_USAGE)) |
-		   (iter->first == std::string(CERT_EXTENDED_KEY_USAGE)))
-		{
-			value = "";
-			LLSD usage = cert_info[iter->first];
-			for (LLSD::array_iterator usage_iter = usage.beginArray();
-				 usage_iter != usage.endArray();
-				 usage_iter++)
-			{
-				
-				if(usage_iter != usage.beginArray())
-				{
-					value += ", ";
-				}
-				
-				value += (*usage_iter).asString();
-			}
-			
-		}
-		else
-		{
-			value = iter->second.asString();
-		}
-		
-		std::string name = iter->first;
-		std::transform(name.begin(), name.end(), name.begin(),
-					   (int(*)(int))toupper);
-		args[name.c_str()] = value;
-	}
-	return args;
-}
-
-
-// when we handle a cert error, give focus back to the login panel
-void general_cert_done(const LLSD& notification, const LLSD& response)
-{
-	LLStartUp::setStartupState( STATE_LOGIN_SHOW );			
-	LLPanelLogin::giveFocus();
-}
-
-// check to see if the user wants to trust the cert.
-// if they do, add it to the cert store and 
-void trust_cert_done(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotification::getSelectedOption(notification, response);	
-	switch(option)
-	{
-		case OPT_TRUST_CERT:
-		{
-			LLPointer<LLCertificate> cert = gSecAPIHandler->getCertificate(notification["payload"]["certificate"]);
-			LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(gSavedSettings.getString("CertStore"));			
-			store->add(cert);
-			store->save();
-			LLStartUp::setStartupState( STATE_LOGIN_CLEANUP );	
-			break;
-		}
-		case OPT_CANCEL_TRUST:
-			reset_login();
-			gSavedSettings.setBOOL("AutoLogin", FALSE);			
-			LLStartUp::setStartupState( STATE_LOGIN_SHOW );				
-		default:
-			LLPanelLogin::giveFocus();
-			break;
-	}
-
-}
 
 void apply_udp_blacklist(const std::string& csv)
 {
@@ -2828,45 +2861,33 @@ bool process_login_success_response()
 	text = response["secure_session_id"].asString();
 	if(!text.empty()) gAgent.mSecureSessionID.set(text);
 
-	// if the response contains a display name, use that,
-	// otherwise if the response contains a first and/or last name,
-	// use those.  Otherwise use the credential identifier
-
-	gDisplayName = "";
-	if (response.has("display_name"))
+	text = response["first_name"].asString();
+	if(!text.empty()) 
 	{
-		gDisplayName.assign(response["display_name"].asString());
-		if(!gDisplayName.empty())
-		{
-			// Remove quotes from string.  Login.cgi sends these to force
-			// names that look like numbers into strings.
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
+		// Remove quotes from string.  Login.cgi sends these to force
+		// names that look like numbers into strings.
+		gFirstname.assign(text);
+		LLStringUtil::replaceChar(gFirstname, '"', ' ');
+		LLStringUtil::trim(gFirstname);
 	}
-	if(gDisplayName.empty())
+	text = response["last_name"].asString();
+	if(!text.empty()) 
 	{
-		if(response.has("first_name"))
-		{
-			gDisplayName.assign(response["first_name"].asString());
-			LLStringUtil::replaceChar(gDisplayName, '"', ' ');
-			LLStringUtil::trim(gDisplayName);
-		}
-		if(response.has("last_name"))
-		{
-			text.assign(response["last_name"].asString());
-			LLStringUtil::replaceChar(text, '"', ' ');
-			LLStringUtil::trim(text);
-			if(!gDisplayName.empty())
-			{
-				gDisplayName += " ";
-			}
-			gDisplayName += text;
-		}
+		gLastname.assign(text);
 	}
-	if(gDisplayName.empty())
+	gSavedSettings.setString("FirstName", gFirstname);
+	gSavedSettings.setString("LastName", gLastname);
+
+	if (gSavedSettings.getBOOL("RememberPassword"))
 	{
-		gDisplayName.assign(gUserCredential->asString());
+		// Successful login means the password is valid, so save it.
+		LLStartUp::savePasswordToDisk(gPassword);
+	}
+	else
+	{
+		// Don't leave password from previous session sitting around
+		// during this login session.
+		LLStartUp::deletePasswordFromDisk();
 	}
 
 	// this is their actual ability to access content
@@ -2960,7 +2981,7 @@ bool process_login_success_response()
 		// replace the default help URL format
 		gSavedSettings.setString("HelpURLFormat",text);
 		
-		// don't fall back to Standalone's pre-connection static help
+		// don't fall back to Nebraska's pre-connection static help
 		gSavedSettings.setBOOL("HelpUseLocal", false);
 	}
 			
@@ -3022,44 +3043,7 @@ bool process_login_success_response()
 		//setup map of datetime strings to codes and slt & local time offset from utc
 		LLStringOps::setupDatetimeInfo(pacific_daylight_time);
 	}
-	
-	static const char* CONFIG_OPTIONS[] = {"voice-config", "newuser-config"};
-	for (int i = 0; i < sizeof(CONFIG_OPTIONS)/sizeof(CONFIG_OPTIONS[0]); i++)
-	{
-		LLSD options = response[CONFIG_OPTIONS[i]];
-		if (!options.isArray() && (options.size() < 1) && !options[0].isMap())
-		{
-			continue;
-		}
-		llinfos << "config option " << CONFIG_OPTIONS[i][0] << "response " << options << llendl;
-		for(LLSD::map_iterator option_it = options[0].beginMap();
-			option_it != options[0].endMap();
-			option_it++)
-		{
-			llinfos << "trying option " << option_it->first << llendl;
-			LLPointer<LLControlVariable> control = gSavedSettings.getControl(option_it->first);
-			if(control.notNull())
-			{
-				if(control->isType(TYPE_BOOLEAN))
-				{
-					llinfos << "Setting BOOL from login " << option_it->first << " " << option_it->second << llendl;
-					
-					gSavedSettings.setBOOL(option_it->first, !((option_it->second == "F") ||
-															   (option_it->second == "false") ||
-															   (!option_it->second)));
-				}
-				else if (control->isType(TYPE_STRING))
-				{
-					llinfos << "Setting String from login " << option_it->first << " " << option_it->second << llendl;
-					gSavedSettings.setString(option_it->first, option_it->second);
-				}
-				// we don't support other types now                                                                                                            
-				
-			}
-			
-		}
-	}
-	
+
 	LLSD initial_outfit = response["initial-outfit"][0];
 	if(initial_outfit.size())
 	{
@@ -3113,7 +3097,7 @@ bool process_login_success_response()
 
 	bool success = false;
 	// JC: gesture loading done below, when we have an asset system
-	// in place.  Don't delete/clear gUserCredentials until then.
+	// in place.  Don't delete/clear user_credentials until then.
 	if(gAgentID.notNull()
 	   && gAgentSessionID.notNull()
 	   && gMessageSystem->mOurCircuitCode
diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h
index 16cc74504f..92fe9521d3 100644
--- a/indra/newview/llstartup.h
+++ b/indra/newview/llstartup.h
@@ -38,7 +38,6 @@
 class LLViewerTexture ;
 class LLEventPump;
 class LLStartupListener;
-class LLSLURL;
 
 // functions
 bool idle_startup();
@@ -102,18 +101,26 @@ public:
 	static void loadInitialOutfit( const std::string& outfit_folder_name,
 								   const std::string& gender_name );
 
+	// Load MD5 of user's password from local disk file.
+	static std::string loadPasswordFromDisk();
+	
+	// Record MD5 of user's password for subsequent login.
+	static void savePasswordToDisk(const std::string& hashed_password);
+	
+	// Delete the saved password local disk file.
+	static void deletePasswordFromDisk();
 	
 	static bool dispatchURL();
 		// if we have a SLURL or sim string ("Ahern/123/45") that started
 		// the viewer, dispatch it
 
+	static std::string sSLURLCommand;
+		// *HACK: On startup, if we were passed a secondlife://app/do/foo
+		// command URL, store it for later processing.
+
 	static void postStartupState();
-	static void setStartSLURL(const LLSLURL& slurl); 
-	static LLSLURL& getStartSLURL() { return sStartSLURL; } 
 
 private:
-	static LLSLURL sStartSLURL;
-
 	static std::string startupStateToString(EStartupState state);
 	static EStartupState gStartupState; // Do not set directly, use LLStartup::setStartupState
 	static boost::scoped_ptr<LLEventPump> sStateWatcher;
diff --git a/indra/newview/llstylemap.cpp b/indra/newview/llstylemap.cpp
index 8fab3bb361..61705c4eb3 100644
--- a/indra/newview/llstylemap.cpp
+++ b/indra/newview/llstylemap.cpp
@@ -51,7 +51,7 @@ const LLStyle::Params &LLStyleMap::lookupAgent(const LLUUID &source)
 			style_params.color.control = "HTMLLinkColor";
 			style_params.readonly_color.control = "HTMLLinkColor";
 			style_params.link_href = 
-					LLSLURL("agent", source, "inspect").getSLURLString();
+					LLSLURL::buildCommand("agent", source, "inspect");
 		}
 		else
 		{
diff --git a/indra/newview/llurl.cpp b/indra/newview/llurl.cpp
index 83a5839a93..ab65ead4c5 100644
--- a/indra/newview/llurl.cpp
+++ b/indra/newview/llurl.cpp
@@ -286,11 +286,5 @@ const char * LLURL::getFullPath()
 	return(sReturnString);
 }
 
-const char * LLURL::getAuthority()
-{
-	strncpy(LLURL::sReturnString,mAuthority, LL_MAX_PATH -1);               /* Flawfinder: ignore */
-	LLURL::sReturnString[LL_MAX_PATH -1] = '\0';
-	return(sReturnString);
-}
 
 char LLURL::sReturnString[LL_MAX_PATH] = "";
diff --git a/indra/newview/llurl.h b/indra/newview/llurl.h
index e41b83d29f..9a089dd835 100644
--- a/indra/newview/llurl.h
+++ b/indra/newview/llurl.h
@@ -79,7 +79,6 @@ public:
 
 	virtual const char *getFQURL() const;
 	virtual const char *getFullPath();
-	virtual const char *getAuthority();
 
 	virtual const char *updateRelativePath(const LLURL &url);
 
diff --git a/indra/newview/llurldispatcher.cpp b/indra/newview/llurldispatcher.cpp
index a31c3a0f1b..b88069cd48 100644
--- a/indra/newview/llurldispatcher.cpp
+++ b/indra/newview/llurldispatcher.cpp
@@ -4,7 +4,7 @@
  *
  * $LicenseInfo:firstyear=2007&license=viewergpl$
  * 
- * Copyright (c) 2010, Linden Research, Inc.
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,12 +12,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -44,10 +45,10 @@
 #include "llsidetray.h"
 #include "llslurl.h"
 #include "llstartup.h"			// gStartupState
+#include "llurlsimstring.h"
 #include "llweb.h"
 #include "llworldmapmessage.h"
 #include "llurldispatcherlistener.h"
-#include "llviewernetwork.h"
 
 // library includes
 #include "llnotificationsutil.h"
@@ -58,25 +59,25 @@ static LLURLDispatcherListener sURLDispatcherListener;
 class LLURLDispatcherImpl
 {
 public:
-	static bool dispatch(const LLSLURL& slurl,
+	static bool dispatch(const std::string& url,
 						 LLMediaCtrl* web,
 						 bool trusted_browser);
 		// returns true if handled or explicitly blocked.
 
-	static bool dispatchRightClick(const LLSLURL& slurl);
+	static bool dispatchRightClick(const std::string& url);
 
 private:
-	static bool dispatchCore(const LLSLURL& slurl, 
+	static bool dispatchCore(const std::string& url, 
 							 bool right_mouse,
 							 LLMediaCtrl* web,
 							 bool trusted_browser);
 		// handles both left and right click
 
-	static bool dispatchHelp(const LLSLURL& slurl, bool right_mouse);
+	static bool dispatchHelp(const std::string& url, bool right_mouse);
 		// Handles sl://app.floater.html.help by showing Help floater.
 		// Returns true if handled.
 
-	static bool dispatchApp(const LLSLURL& slurl,
+	static bool dispatchApp(const std::string& url,
 							bool right_mouse,
 							LLMediaCtrl* web,
 							bool trusted_browser);
@@ -84,16 +85,16 @@ private:
 		// by showing panel in Search floater.
 		// Returns true if handled or explicitly blocked.
 
-	static bool dispatchRegion(const LLSLURL& slurl, bool right_mouse);
+	static bool dispatchRegion(const std::string& url, bool right_mouse);
 		// handles secondlife://Ahern/123/45/67/
 		// Returns true if handled.
 
-	static void regionHandleCallback(U64 handle, const LLSLURL& slurl,
+	static void regionHandleCallback(U64 handle, const std::string& url,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a location has been resolved to a
 	    // region name
 
-	static void regionNameCallback(U64 handle, const LLSLURL& slurl,
+	static void regionNameCallback(U64 handle, const std::string& url,
 		const LLUUID& snapshot_id, bool teleport);
 		// Called by LLWorldMap when a region name has been resolved to a
 		// location in-world, used by places-panel display.
@@ -102,57 +103,65 @@ private:
 };
 
 // static
-bool LLURLDispatcherImpl::dispatchCore(const LLSLURL& slurl,
+bool LLURLDispatcherImpl::dispatchCore(const std::string& url,
 									   bool right_mouse,
 									   LLMediaCtrl* web,
 									   bool trusted_browser)
 {
-	//if (dispatchHelp(slurl, right_mouse)) return true;
-	switch(slurl.getType())
-	{
-		case LLSLURL::APP: 
-			return dispatchApp(slurl, right_mouse, web, trusted_browser);
-		case LLSLURL::LOCATION:
-			return dispatchRegion(slurl, right_mouse);
-		default:
-			return false;
-	}
+	if (url.empty()) return false;
+	//if (dispatchHelp(url, right_mouse)) return true;
+	if (dispatchApp(url, right_mouse, web, trusted_browser)) return true;
+	if (dispatchRegion(url, right_mouse)) return true;
 
 	/*
 	// Inform the user we can't handle this
 	std::map<std::string, std::string> args;
-	args["SLURL"] = slurl;
+	args["SLURL"] = url;
 	r;
 	*/
+	
+	return false;
 }
 
 // static
-bool LLURLDispatcherImpl::dispatch(const LLSLURL& slurl,
+bool LLURLDispatcherImpl::dispatch(const std::string& url,
 								   LLMediaCtrl* web,
 								   bool trusted_browser)
 {
+	llinfos << "url: " << url << llendl;
 	const bool right_click = false;
-	return dispatchCore(slurl, right_click, web, trusted_browser);
+	return dispatchCore(url, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRightClick(const LLSLURL& slurl)
+bool LLURLDispatcherImpl::dispatchRightClick(const std::string& url)
 {
+	llinfos << "url: " << url << llendl;
 	const bool right_click = true;
 	LLMediaCtrl* web = NULL;
 	const bool trusted_browser = false;
-	return dispatchCore(slurl, right_click, web, trusted_browser);
+	return dispatchCore(url, right_click, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl, 
+bool LLURLDispatcherImpl::dispatchApp(const std::string& url, 
 									  bool right_mouse,
 									  LLMediaCtrl* web,
 									  bool trusted_browser)
 {
-	llinfos << "cmd: " << slurl.getAppCmd() << " path: " << slurl.getAppPath() << " query: " << slurl.getAppQuery() << llendl;
+	// ensure the URL is in the secondlife:///app/ format
+	if (!LLSLURL::isSLURLCommand(url))
+	{
+		return false;
+	}
+
+	LLURI uri(url);
+	LLSD pathArray = uri.pathArray();
+	pathArray.erase(0); // erase "app"
+	std::string cmd = pathArray.get(0);
+	pathArray.erase(0); // erase "cmd"
 	bool handled = LLCommandDispatcher::dispatch(
-			slurl.getAppCmd(), slurl.getAppPath(), slurl.getAppQuery(), web, trusted_browser);
+			cmd, pathArray, uri.queryMap(), web, trusted_browser);
 
 	// alert if we didn't handle this secondlife:///app/ SLURL
 	// (but still return true because it is a valid app SLURL)
@@ -164,72 +173,81 @@ bool LLURLDispatcherImpl::dispatchApp(const LLSLURL& slurl,
 }
 
 // static
-bool LLURLDispatcherImpl::dispatchRegion(const LLSLURL& slurl, bool right_mouse)
+bool LLURLDispatcherImpl::dispatchRegion(const std::string& url, bool right_mouse)
 {
-  if(slurl.getType() != LLSLURL::LOCATION)
-    {
-      return false;
-    }
+	if (!LLSLURL::isSLURL(url))
+	{
+		return false;
+	}
+
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+	if (! LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
+	{
+		return false;
+	}
+
 	// Before we're logged in, need to update the startup screen
 	// to tell the user where they are going.
 	if (LLStartUp::getStartupState() < STATE_LOGIN_CLEANUP)
 	{
+		// Parse it and stash in globals, it will be dispatched in
+		// STATE_CLEANUP.
+		LLURLSimString::setString(url);
 		// We're at the login screen, so make sure user can see
 		// the login location box to know where they are going.
 		
-		LLPanelLogin::setLocation(slurl);
+		LLPanelLogin::refreshLocation( true );
 		return true;
 	}
 
 	// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
-	//LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-	//if(slurl_displayp) slurl_displayp->setName(region_name);
+	//LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+	//if(url_displayp) url_displayp->setName(region_name);
 
 	// Request a region handle by name
-	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(slurl.getRegion(),
-									  LLURLDispatcherImpl::regionNameCallback,
-									  slurl.getSLURLString(),
-									  false);	// don't teleport
+	LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
+								 LLURLDispatcherImpl::regionNameCallback,
+								 url,
+								 false);	// don't teleport
 	return true;
 }
 
 /*static*/
-void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionNameCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
 {
-      
-  if(slurl.getType() == LLSLURL::LOCATION)
-    {        
-      regionHandleCallback(region_handle, slurl, snapshot_id, teleport);
-    }
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+
+	if (LLURLSimString::parse(sim_string, &region_name, &x, &y, &z))
+	{
+		regionHandleCallback(region_handle, url, snapshot_id, teleport);
+	}
 }
 
 /* static */
-void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL& slurl, const LLUUID& snapshot_id, bool teleport)
+void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const std::string& url, const LLUUID& snapshot_id, bool teleport)
 {
+	std::string sim_string = LLSLURL::stripProtocol(url);
+	std::string region_name;
+	S32 x = 128;
+	S32 y = 128;
+	S32 z = 0;
+	LLURLSimString::parse(sim_string, &region_name, &x, &y, &z);
+
+	LLVector3 local_pos;
+	local_pos.mV[VX] = (F32)x;
+	local_pos.mV[VY] = (F32)y;
+	local_pos.mV[VZ] = (F32)z;
 
-  // we can't teleport cross grid at this point
-	if((!LLGridManager::getInstance()->isSystemGrid(slurl.getGrid()) || !LLGridManager::getInstance()->isSystemGrid()) &&
-	   (slurl.getGrid() != LLGridManager::getInstance()->getGrid()))
-	{
-		LLSD args;
-		args["SLURL"] = slurl.getLocationString();
-		args["CURRENT_GRID"] = LLGridManager::getInstance()->getGridLabel();
-		LLSD grid_info = LLGridManager::getInstance()->getGridInfo(slurl.getGrid());
-		
-		if(grid_info.has(GRID_LABEL_VALUE))
-		{
-			args["GRID"] = grid_info[GRID_LABEL_VALUE].asString();
-		}
-		else 
-		{
-			args["GRID"] = slurl.getGrid();
-		}
-		LLNotificationsUtil::add("CantTeleportToGrid", args);
-		return;
-	}
-	
 	LLVector3d global_pos = from_region_handle(region_handle);
-	global_pos += LLVector3d(slurl.getPosition());
+	global_pos += LLVector3d(local_pos);
 	
 	if (teleport)
 	{	
@@ -253,8 +271,8 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
 		// LLFloaterURLDisplay functionality moved to LLPanelPlaces in Side Tray.
 
 //		// display informational floater, allow user to click teleport btn
-//		LLFloaterURLDisplay* slurl_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
-//		if(slurl_displayp)
+//		LLFloaterURLDisplay* url_displayp = LLFloaterReg::getTypedInstance<LLFloaterURLDisplay>("preview_url",LLSD());
+//		if(url_displayp)
 //		{
 //			url_displayp->displayParcelInfo(region_handle, local_pos);
 //			if(snapshot_id.notNull())
@@ -269,7 +287,7 @@ void LLURLDispatcherImpl::regionHandleCallback(U64 region_handle, const LLSLURL&
 
 //---------------------------------------------------------------------------
 // Teleportation links are handled here because they are tightly coupled
-// to SLURL parsing and sim-fragment parsing
+// to URL parsing and sim-fragment parsing
 class LLTeleportHandler : public LLCommandHandler
 {
 public:
@@ -285,21 +303,18 @@ public:
 		// a global position, and teleport to it
 		if (tokens.size() < 1) return false;
 
-		LLVector3 coords(128, 128, 0);
-		if (tokens.size() <= 4)
-		{
-			coords = LLVector3(tokens[1].asReal(), 
-							   tokens[2].asReal(), 
-							   tokens[3].asReal());
-		}
-		
 		// Region names may be %20 escaped.
-		
-		std::string region_name = LLURI::unescape(tokens[0]);
+		std::string region_name = LLURLSimString::unescapeRegionName(tokens[0]);
 
+		// build secondlife://De%20Haro/123/45/67 for use in callback
+		std::string url = LLSLURL::PREFIX_SECONDLIFE;
+		for (int i = 0; i < tokens.size(); ++i)
+		{
+			url += tokens[i].asString() + "/";
+		}
 		LLWorldMapMessage::getInstance()->sendNamedRegionRequest(region_name,
 			LLURLDispatcherImpl::regionHandleCallback,
-			LLSLURL(region_name, coords).getSLURLString(),
+			url,
 			true);	// teleport
 		return true;
 	}
@@ -309,21 +324,21 @@ LLTeleportHandler gTeleportHandler;
 //---------------------------------------------------------------------------
 
 // static
-bool LLURLDispatcher::dispatch(const std::string& slurl,
+bool LLURLDispatcher::dispatch(const std::string& url,
 							   LLMediaCtrl* web,
 							   bool trusted_browser)
 {
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
 }
 
 // static
-bool LLURLDispatcher::dispatchRightClick(const std::string& slurl)
+bool LLURLDispatcher::dispatchRightClick(const std::string& url)
 {
-	return LLURLDispatcherImpl::dispatchRightClick(LLSLURL(slurl));
+	return LLURLDispatcherImpl::dispatchRightClick(url);
 }
 
 // static
-bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
+bool LLURLDispatcher::dispatchFromTextEditor(const std::string& url)
 {
 	// *NOTE: Text editors are considered sources of trusted URLs
 	// in order to make avatar profile links in chat history work.
@@ -333,7 +348,5 @@ bool LLURLDispatcher::dispatchFromTextEditor(const std::string& slurl)
 	// *TODO: Make this trust model more refined.  JC
 	const bool trusted_browser = true;
 	LLMediaCtrl* web = NULL;
-	return LLURLDispatcherImpl::dispatch(LLSLURL(slurl), web, trusted_browser);
+	return LLURLDispatcherImpl::dispatch(url, web, trusted_browser);
 }
-
-
diff --git a/indra/newview/llurldispatcher.h b/indra/newview/llurldispatcher.h
index 407e417e58..ff8a351253 100644
--- a/indra/newview/llurldispatcher.h
+++ b/indra/newview/llurldispatcher.h
@@ -2,9 +2,9 @@
  * @file llurldispatcher.h
  * @brief Central registry for all SL URL handlers
  *
- * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * $LicenseInfo:firstyear=2007&license=viewergpl$
  * 
- * Copyright (c) 2007-2010, Linden Research, Inc.
+ * Copyright (c) 2007-2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,12 +12,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -30,16 +31,16 @@
  */
 #ifndef LLURLDISPATCHER_H
 #define LLURLDISPATCHER_H
+
 class LLMediaCtrl;
 
 
 class LLURLDispatcher
 {
 public:
-	
-	static bool dispatch(const std::string& slurl,
+	static bool dispatch(const std::string& url,
 						 LLMediaCtrl* web,
-						 bool trusted_browser);	
+						 bool trusted_browser);
 		// At startup time and on clicks in internal web browsers,
 		// teleport, open map, or run requested command.
 		// @param url
@@ -53,9 +54,9 @@ public:
 		//   that navigates to trusted (Linden Lab) pages.
 		// Returns true if someone handled the URL.
 
-	static bool dispatchRightClick(const std::string& slurl);
+	static bool dispatchRightClick(const std::string& url);
 
-	static bool dispatchFromTextEditor(const std::string& slurl);
+	static bool dispatchFromTextEditor(const std::string& url);
 };
 
 #endif
diff --git a/indra/newview/llurllineeditorctrl.cpp b/indra/newview/llurllineeditorctrl.cpp
index 8488527185..1d2687a8c2 100644
--- a/indra/newview/llurllineeditorctrl.cpp
+++ b/indra/newview/llurllineeditorctrl.cpp
@@ -89,7 +89,7 @@ void LLURLLineEditor::copyEscapedURLToClipboard()
 
 	const std::string unescaped_text = wstring_to_utf8str(mText.getWString().substr(left_pos, length));
 	LLWString text_to_copy;
-	if (LLSLURL(unescaped_text).isValid())
+	if (LLSLURL::isSLURL(unescaped_text))
 		text_to_copy = utf8str_to_wstring(LLWeb::escapeURL(unescaped_text));
 	else
 		text_to_copy = utf8str_to_wstring(unescaped_text);
diff --git a/indra/newview/llvieweraudio.cpp b/indra/newview/llvieweraudio.cpp
index ef6f4194e0..2661c9f32b 100644
--- a/indra/newview/llvieweraudio.cpp
+++ b/indra/newview/llvieweraudio.cpp
@@ -157,21 +157,21 @@ void audio_update_volume(bool force_update)
 	LLViewerMedia::setVolume( media_muted ? 0.0f : media_volume );
 
 	// Voice
-	if (LLVoiceClient::getInstance())
+	if (gVoiceClient)
 	{
 		F32 voice_volume = gSavedSettings.getF32("AudioLevelVoice");
 		voice_volume = mute_volume * master_volume * voice_volume;
 		BOOL voice_mute = gSavedSettings.getBOOL("MuteVoice");
-		LLVoiceClient::getInstance()->setVoiceVolume(voice_mute ? 0.f : voice_volume);
-		LLVoiceClient::getInstance()->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
+		gVoiceClient->setVoiceVolume(voice_mute ? 0.f : voice_volume);
+		gVoiceClient->setMicGain(voice_mute ? 0.f : gSavedSettings.getF32("AudioLevelMic"));
 
 		if (!gViewerWindow->getActive() && (gSavedSettings.getBOOL("MuteWhenMinimized")))
 		{
-			LLVoiceClient::getInstance()->setMuteMic(true);
+			gVoiceClient->setMuteMic(true);
 		}
 		else
 		{
-			LLVoiceClient::getInstance()->setMuteMic(false);
+			gVoiceClient->setMuteMic(false);
 		}
 	}
 }
diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp
index 8627f08891..b2b7e653e4 100644
--- a/indra/newview/llviewercontrol.cpp
+++ b/indra/newview/llviewercontrol.cpp
@@ -413,9 +413,9 @@ bool handleHighResSnapshotChanged(const LLSD& newvalue)
 
 bool handleVoiceClientPrefsChanged(const LLSD& newvalue)
 {
-	if(LLVoiceClient::getInstance())
+	if(gVoiceClient)
 	{
-		LLVoiceClient::getInstance()->updateSettings();
+		gVoiceClient->updateSettings();
 	}
 	return true;
 }
@@ -446,7 +446,7 @@ bool handleVelocityInterpolate(const LLSD& newvalue)
 
 bool handleForceShowGrid(const LLSD& newvalue)
 {
-	LLPanelLogin::updateServer( );
+	LLPanelLogin::refreshLocation( false );
 	return true;
 }
 
diff --git a/indra/newview/llviewerinventory.cpp b/indra/newview/llviewerinventory.cpp
index 17221219eb..b42d25c1d8 100644
--- a/indra/newview/llviewerinventory.cpp
+++ b/indra/newview/llviewerinventory.cpp
@@ -36,6 +36,7 @@
 #include "llnotificationsutil.h"
 #include "llsdserialize.h"
 #include "message.h"
+#include "indra_constants.h"
 
 #include "llagent.h"
 #include "llagentcamera.h"
@@ -263,14 +264,10 @@ void LLViewerInventoryItem::fetchFromServer(void) const
 		// we have to check region. It can be null after region was destroyed. See EXT-245
 		if (region)
 		{
-		  if(gAgent.getID() != mPermissions.getOwner())
-		    {
-		      url = region->getCapability("FetchLib");
-		    }
-		  else
-		    {	
-		      url = region->getCapability("FetchInventory");
-		    }
+			if( ALEXANDRIA_LINDEN_ID.getString() == mPermissions.getOwner().getString())
+				url = region->getCapability("FetchLib");
+			else	
+				url = region->getCapability("FetchInventory");
 		}
 		else
 		{
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index a8b1257cf6..7d87f06794 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -429,7 +429,7 @@ void init_menus()
 	gPopupMenuView->setBackgroundColor( color );
 
 	// If we are not in production, use a different color to make it apparent.
-	if (LLGridManager::getInstance()->isInProductionGrid())
+	if (LLViewerLogin::getInstance()->isInProductionGrid())
 	{
 		color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
 	}
@@ -445,7 +445,7 @@ void init_menus()
 	menu_bar_holder->addChild(gMenuBarView);
   
     gViewerWindow->setMenuBackgroundColor(false, 
-        LLGridManager::getInstance()->isInProductionGrid());
+        LLViewerLogin::getInstance()->isInProductionGrid());
 
 	// Assume L$10 for now, the server will tell us the real cost at login
 	// *TODO:Also fix cost in llfolderview.cpp for Inventory menus
@@ -3467,7 +3467,7 @@ void set_god_level(U8 god_level)
         if(gViewerWindow)
         {
             gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
-            LLGridManager::getInstance()->isInProductionGrid());
+            LLViewerLogin::getInstance()->isInProductionGrid());
         }
     
         LLSD args;
@@ -3507,7 +3507,7 @@ BOOL check_toggle_hacked_godmode(void*)
 
 bool enable_toggle_hacked_godmode(void*)
 {
-  return !LLGridManager::getInstance()->isInProductionGrid();
+  return !LLViewerLogin::getInstance()->isInProductionGrid();
 }
 #endif
 
@@ -4378,7 +4378,7 @@ BOOL enable_take()
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid() 
+		if (!LLViewerLogin::getInstance()->isInProductionGrid() 
             && gAgent.isGodlike())
 		{
 			return TRUE;
@@ -4991,7 +4991,7 @@ bool enable_object_delete()
 	TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	(!LLGridManager::getInstance()->isInProductionGrid()
+	(!LLViewerLogin::getInstance()->isInProductionGrid()
      && gAgent.isGodlike()) ||
 # endif
 	LLSelectMgr::getInstance()->canDoDelete();
@@ -6627,7 +6627,7 @@ bool enable_object_take_copy()
 		all_valid = true;
 #ifndef HACKED_GODLIKE_VIEWER
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (LLGridManager::getInstance()->isInProductionGrid()
+		if (LLViewerLogin::getInstance()->isInProductionGrid()
             || !gAgent.isGodlike())
 # endif
 		{
@@ -6689,7 +6689,7 @@ BOOL enable_save_into_inventory(void*)
 	return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-	if (!LLGridManager::getInstance()->isInProductionGrid()
+	if (!LLViewerLogin::getInstance()->isInProductionGrid()
         && gAgent.isGodlike())
 	{
 		return TRUE;
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7346b2a76e..1426c0b9e2 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1573,9 +1573,9 @@ void inventory_offer_handler(LLOfferInfo* info)
 	payload["give_inventory_notification"] = FALSE;
 	args["OBJECTFROMNAME"] = info->mFromName;
 	args["NAME"] = info->mFromName;
-	args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
+	args["NAME_SLURL"] = LLSLURL::buildCommand("agent", info->mFromID, "about");
 	std::string verb = "select?name=" + LLURI::escape(msg);
-	args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
+	args["ITEM_SLURL"] = LLSLURL::buildCommand("inventory", info->mObjectID, verb.c_str());
 
 	LLNotification::Params p("ObjectGiveItem");
 
@@ -2244,7 +2244,10 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 				query_string["groupowned"] = "true";
 			}	
 
-			chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
+			std::ostringstream link;
+			link << "secondlife:///app/objectim/" << session_id << LLURI::mapToQueryString(query_string);
+
+			chat.mURL = link.str();
 			chat.mText = message;
 			chat.mSourceType = CHAT_SOURCE_OBJECT;
 
@@ -2327,7 +2330,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			{
 				LLSD args;
 				// *TODO: Translate -> [FIRST] [LAST] (maybe)
-				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				args["MESSAGE"] = message;
 				LLSD payload;
 				payload["from_id"] = from_id;
@@ -2393,7 +2396,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
 			}
 			else
 			{
-				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
+				args["NAME_SLURL"] = LLSLURL::buildCommand("agent", from_id, "about");
 				if(message.empty())
 				{
 					//support for frienship offers from clients before July 2008
@@ -3152,9 +3155,7 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 		{
 			// Chat the "back" SLURL. (DEV-4907)
 
-			LLSLURL slurl;
-			gAgent.getTeleportSourceSLURL(slurl);
-			LLSD substitution = LLSD().with("[T_SLURL]", slurl.getSLURLString());
+			LLSD substitution = LLSD().with("[T_SLURL]", gAgent.getTeleportSourceSLURL());
 			std::string completed_from = LLAgent::sTeleportProgressMessages["completed_from"];
 			LLStringUtil::format(completed_from, substitution);
 
@@ -5547,9 +5548,7 @@ void send_group_notice(const LLUUID& group_id,
 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());
+	text.append("\r\n").append(LLAgentUI::buildSLURL());
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 
 	if(0 == option)
@@ -5992,7 +5991,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**)
 	LLFloaterBuyLand::updateEstateName(estate_name);
 
 	std::string owner_name =
-		LLSLURL("agent", estate_owner_id, "inspect").getSLURLString();
+		LLSLURL::buildCommand("agent", estate_owner_id, "inspect");
 	LLPanelEstateCovenant::updateEstateOwnerName(owner_name);
 	LLPanelLandCovenant::updateEstateOwnerName(owner_name);
 	LLFloaterBuyLand::updateEstateOwnerName(owner_name);
diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp
index d7bb4efe85..987d23630a 100644
--- a/indra/newview/llviewernetwork.cpp
+++ b/indra/newview/llviewernetwork.cpp
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2010, Linden Research, Inc.
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,12 +13,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -33,478 +34,303 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llviewernetwork.h"
-#include "llviewercontrol.h"
-#include "llsdserialize.h"
-#include "llweb.h"
-
-                                                            
-const char* DEFAULT_LOGIN_PAGE = "http://secondlife.com/app/login/";
 
-const char* SYSTEM_GRID_SLURL_BASE = "secondlife://%s/secondlife/";
-const char* MAIN_GRID_SLURL_BASE = "http://maps.secondlife.com/secondlife/";
-const char* SYSTEM_GRID_APP_SLURL_BASE = "secondlife:///app";
+#include "llevents.h"
+#include "net.h"
 
-const char* DEFAULT_SLURL_BASE = "https://%s/region/";
-const char* DEFAULT_APP_SLURL_BASE = "x-grid-location-info://%s/app";
+#include "llviewercontrol.h"
+#include "lllogin.h"
 
-LLGridManager::LLGridManager()
+struct LLGridData
 {
-	// by default, we use the 'grids.xml' file in the user settings directory
-	// this file is an LLSD file containing multiple grid definitions.
-	// This file does not contain definitions for secondlife.com grids,
-	// as that would be a security issue when they are overwritten by
-	// an attacker.  Don't want someone snagging a password.
-	std::string grid_file = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS,
-														   "grids.xml");
-	initialize(grid_file);
-	
-}
+	const char* mLabel;
+	const char* mName;
+	const char* mLoginURI;
+	const char* mHelperURI;
+};
 
-
-LLGridManager::LLGridManager(const std::string& grid_file)
+static LLGridData gGridInfo[GRID_INFO_COUNT] = 
 {
-	// initialize with an explicity grid file for testing.
-	initialize(grid_file);
-}
-
-//
-// LLGridManager - class for managing the list of known grids, and the current
-// selection
-//
-
-
-//
-// LLGridManager::initialze - initialize the list of known grids based
-// on the fixed list of linden grids (fixed for security reasons)
-// the grids.xml file
-// and the command line.
-void LLGridManager::initialize(const std::string& grid_file)
+	{ "None", "", "", ""},
+	{ "Aditi", 
+	  "util.aditi.lindenlab.com", 
+	  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://aditi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Agni", 
+	  "util.agni.lindenlab.com", 
+	  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",
+	  "https://secondlife.com/helpers/" },
+	{ "Aruna",
+	  "util.aruna.lindenlab.com",
+	  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",
+	  "http://aruna-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Bharati",
+	  "util.bharati.lindenlab.com",
+	  "https://login.bharati.lindenlab.com/cgi-bin/login.cgi",
+	  "http://bharati-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Chandra",
+	  "util.chandra.lindenlab.com",
+	  "https://login.chandra.lindenlab.com/cgi-bin/login.cgi",
+	  "http://chandra-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Damballah",
+	  "util.damballah.lindenlab.com",
+	  "https://login.damballah.lindenlab.com/cgi-bin/login.cgi",
+	  "http://damballah-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Danu",
+	  "util.danu.lindenlab.com",
+	  "https://login.danu.lindenlab.com/cgi-bin/login.cgi",
+	  "http://danu-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Durga",
+	  "util.durga.lindenlab.com",
+	  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",
+	  "http://durga-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Ganga",
+	  "util.ganga.lindenlab.com",
+	  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",
+	  "http://ganga-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Mitra",
+	  "util.mitra.lindenlab.com",
+	  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",
+	  "http://mitra-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Mohini",
+	  "util.mohini.lindenlab.com",
+	  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",
+	  "http://mohini-secondlife.webdev.lindenlab.com/helpers/" },
+  	{ "Nandi",
+	  "util.nandi.lindenlab.com",
+	  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://nandi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Parvati",
+	  "util.parvati.lindenlab.com",
+	  "https://login.parvati.lindenlab.com/cgi-bin/login.cgi",
+	  "http://parvati-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Radha",
+	  "util.radha.lindenlab.com",
+	  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",
+	  "http://radha-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Ravi",
+	  "util.ravi.lindenlab.com",
+	  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",
+	  "http://ravi-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Siva", 
+	  "util.siva.lindenlab.com",
+	  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",
+	  "http://siva-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Shakti",
+	  "util.shakti.lindenlab.com",
+	  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",
+	  "http://shakti-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Skanda",
+	  "util.skanda.lindenlab.com",
+	  "https://login.skanda.lindenlab.com/cgi-bin/login.cgi",
+	  "http://skanda-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Soma",
+	  "util.soma.lindenlab.com",
+	  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",
+	  "http://soma-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Uma",
+	  "util.uma.lindenlab.com",
+	  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",
+	  "http://uma-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Vaak",
+	  "util.vaak.lindenlab.com",
+	  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",
+	  "http://vaak-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Yami",
+	  "util.yami.lindenlab.com",
+	  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",
+	  "http://yami-secondlife.webdev.lindenlab.com/helpers/" },
+	{ "Local", 
+	  "localhost", 
+	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
+	  "" },
+	{ "Other", 
+	  "", 
+	  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",
+	  "" }
+};
+
+const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI;
+
+
+unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
+
+LLViewerLogin::LLViewerLogin() :
+	mGridChoice(DEFAULT_GRID_CHOICE)
 {
-	// default grid list.
-	// Don't move to a modifiable file for security reasons,
-	mGrid.clear() ;
-	// set to undefined
-	mGridList = LLSD();
-	mGridFile = grid_file;
-	// as we don't want an attacker to override our grid list
-	// to point the default grid to an invalid grid
-	addSystemGrid("None", "", "", "", DEFAULT_LOGIN_PAGE);
-	
-
+}
 
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-  	addSystemGrid("Agni",                                                                                             
-				  MAINGRID,                                               
-				  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",                    
-				  "https://secondlife.com/helpers/",     
-				  DEFAULT_LOGIN_PAGE);
-#else
-	addSystemGrid("Secondlife.com",                                                                                             
-				  MAINGRID,                                               
-				  "https://login.agni.lindenlab.com/cgi-bin/login.cgi",                    
-				  "https://secondlife.com/helpers/",     
-				  DEFAULT_LOGIN_PAGE,
-				  "Agni");
-#endif // LL_RELEASE_FOR_DOWNLOAD	
-	addSystemGrid("Aditi",                                                                                             
-				  "util.aditi.lindenlab.com",                                              
-				  "https://login.aditi.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://aditi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Aruna",                                                                                            
-				  "util.aruna.lindenlab.com",                                              
-				  "https://login.aruna.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://aruna-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Durga",                                                                                            
-				  "util.durga.lindenlab.com",                                              
-				  "https://login.durga.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://durga-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Ganga",                                                                                            
-				  "util.ganga.lindenlab.com",                                              
-				  "https://login.ganga.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://ganga-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Mitra",                                                                                            
-				  "util.mitra.lindenlab.com",                                              
-				  "https://login.mitra.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://mitra-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Mohini",                                                                                           
-				  "util.mohini.lindenlab.com",                                             
-				  "https://login.mohini.lindenlab.com/cgi-bin/login.cgi",                  
-				  "http://mohini-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Nandi",                                                                                            
-				  "util.nandi.lindenlab.com",                                              
-				  "https://login.nandi.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://nandi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Radha",                                                                                            
-				  "util.radha.lindenlab.com",                                              
-				  "https://login.radha.lindenlab.com/cgi-bin/login.cgi",                   
-				  "http://radha-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Ravi",                                                                                             
-				  "util.ravi.lindenlab.com",                                               
-				  "https://login.ravi.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://ravi-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Siva",                                                                                             
-				  "util.siva.lindenlab.com",                                               
-				  "https://login.siva.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://siva-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Shakti",                                                                                           
-				  "util.shakti.lindenlab.com",                                             
-				  "https://login.shakti.lindenlab.com/cgi-bin/login.cgi",                  
-				  "http://shakti-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Soma",                                                                                             
-				  "util.soma.lindenlab.com",                                               
-				  "https://login.soma.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://soma-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	
-	addSystemGrid("Uma",                                                                                              
-				  "util.uma.lindenlab.com",                                                
-				  "https://login.uma.lindenlab.com/cgi-bin/login.cgi",                     
-				  "http://uma-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Vaak",                                                                                             
-				  "util.vaak.lindenlab.com",                                               
-				  "https://login.vaak.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://vaak-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Yami",                                                                                             
-				  "util.yami.lindenlab.com",                                               
-				  "https://login.yami.lindenlab.com/cgi-bin/login.cgi",                    
-				  "http://yami-secondlife.webdev.lindenlab.com/helpers/",
-				  DEFAULT_LOGIN_PAGE);
-	addSystemGrid("Local (Linden)",                                                                                    
-				  "localhost",                                                             
-				  "https://login.dmz.lindenlab.com/cgi-bin/login.cgi",                     
-				  "",
-				  DEFAULT_LOGIN_PAGE); 
+ LLViewerLogin::~LLViewerLogin() 
+ {
+ }
 
-	
-	LLSD other_grids;
-	llifstream llsd_xml;
-	if (!grid_file.empty())
+void LLViewerLogin::setGridChoice(EGridInfo grid)
+{	
+	if(grid < 0 || grid >= GRID_INFO_COUNT)
 	{
-		llsd_xml.open( grid_file.c_str(), std::ios::in | std::ios::binary );
-
-		// parse through the gridfile, inserting grids into the list unless
-		// they overwrite a linden grid.
-		if( llsd_xml.is_open()) 
-		{
-			LLSDSerialize::fromXMLDocument( other_grids, llsd_xml );
-			if(other_grids.isMap())
-			{
-				for(LLSD::map_iterator grid_itr = other_grids.beginMap(); 
-					grid_itr != other_grids.endMap();
-					++grid_itr)
-				{
-					LLSD::String key_name = grid_itr->first;
-					LLSD grid = grid_itr->second;
-					// TODO:  Make sure gridfile specified label is not 
-					// a system grid label
-					LL_INFOS("GridManager") << "reading: " << key_name << LL_ENDL;
-					if (mGridList.has(key_name) &&
-						mGridList[key_name].has(GRID_IS_SYSTEM_GRID_VALUE))
-					{
-						LL_INFOS("GridManager") << "Cannot override grid " << key_name << " as it's a system grid" << LL_ENDL;
-						// If the system grid does exist in the grids file, and it's marked as a favorite, set it as a favorite.
-						if(grid_itr->second.has(GRID_IS_FAVORITE_VALUE) && grid_itr->second[GRID_IS_FAVORITE_VALUE].asBoolean() )
-						{
-							mGridList[key_name][GRID_IS_FAVORITE_VALUE] = TRUE;
-						}
-					}
-					else
-					{
-						try
-						{
-							addGrid(grid);
-							LL_INFOS("GridManager") << "Added grid: " << key_name << LL_ENDL;
-						}
-						catch (...)
-						{
-						}
-					}
-				}
-				llsd_xml.close();
-			}	
-		}     
+		llerrs << "Invalid grid index specified." << llendl;
+		return;
 	}
-	
-	// load a grid from the command line.
-	// if the actual grid name is specified from the command line,
-	// set it as the 'selected' grid.
-	mGrid = gSavedSettings.getString("CmdLineGridChoice");
-	LL_INFOS("GridManager") << "Grid Name: " << mGrid << LL_ENDL;		
-	
-	// If a command line login URI was passed in, so we should add the command
-	// line grid to the list of grids
 
-	LLSD cmd_line_login_uri = gSavedSettings.getLLSD("CmdLineLoginURI");
-	if (cmd_line_login_uri.isString())
+	if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid)
 	{
-		LL_INFOS("GridManager") << "adding cmd line login uri" << LL_ENDL;
-		// grab the other related URI values
-		std::string cmd_line_helper_uri = gSavedSettings.getString("CmdLineHelperURI");
-		std::string cmd_line_login_page = gSavedSettings.getString("LoginPage");
-		
-		// we've a cmd line login, so add a grid for the command line,
-		// overwriting any existing grids
-		LLSD grid = LLSD::emptyMap();
-		grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-		grid[GRID_LOGIN_URI_VALUE].append(cmd_line_login_uri);
-		LL_INFOS("GridManager") << "cmd line login uri: " << cmd_line_login_uri.asString() << LL_ENDL;
-		LLURI uri(cmd_line_login_uri.asString());
-		if (mGrid.empty())
+		mGridChoice = grid;
+		if(GRID_INFO_LOCAL == mGridChoice)
 		{
-			// if a grid name was not passed in via the command line,
-			// then set the grid name based on the hostname of the 
-			// login uri
-			mGrid = uri.hostName();
+			mGridName = LOOPBACK_ADDRESS_STRING;
 		}
-
-		grid[GRID_VALUE] = mGrid;
-
-		if (mGridList.has(mGrid) && mGridList[mGrid].has(GRID_LABEL_VALUE))
+		else if(GRID_INFO_OTHER == mGridChoice)
 		{
-			grid[GRID_LABEL_VALUE] = mGridList[mGrid][GRID_LABEL_VALUE];
+			// *FIX:Mani - could this possibly be valid?
+			mGridName = "other"; 
 		}
 		else
 		{
-			grid[GRID_LABEL_VALUE] = mGrid;			
-		}
-		if(!cmd_line_helper_uri.empty())
-		{
-			grid[GRID_HELPER_URI_VALUE] = cmd_line_helper_uri;
+			mGridName = gGridInfo[mGridChoice].mLabel;
 		}
 
-		if(!cmd_line_login_page.empty())
-		{
-			grid[GRID_LOGIN_PAGE_VALUE] = cmd_line_login_page;
-		}
-		// if the login page, helper URI value, and so on are not specified,
-		// add grid will generate them.
-
-		// Also, we will override a system grid if values are passed in via the command
-		// line, for testing.  These values will not be remembered though.
-		if (mGridList.has(mGrid) && mGridList[mGrid].has(GRID_IS_SYSTEM_GRID_VALUE))
-		{
-			grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
-		}
-		addGrid(grid);
+		gSavedSettings.setS32("ServerChoice", mGridChoice);
+		gSavedSettings.setString("CustomServer", "");
 	}
-	
-	// if a grid was not passed in via the command line, grab it from the CurrentGrid setting.
-	if (mGrid.empty())
-	{
-
-		mGrid = gSavedSettings.getString("CurrentGrid");
-	}
-
-	if (mGrid.empty() || !mGridList.has(mGrid))
-	{
-		// the grid name was empty, or the grid isn't actually in the list, then set it to the
-		// appropriate default.
-		LL_INFOS("GridManager") << "Resetting grid as grid name " << mGrid << " is not in the list" << LL_ENDL;
-#if LL_RELEASE_FOR_DOWNLOAD
-		mGrid = MAINGRID;
-#else
-		mGrid = "";
-#endif
-	}
-	LL_INFOS("GridManager") << "Selected grid is " << mGrid << LL_ENDL;		
-	gSavedSettings.setString("CurrentGrid", mGrid);
-
 }
 
-LLGridManager::~LLGridManager()
+void LLViewerLogin::setGridChoice(const std::string& grid_name)
 {
-	saveFavorites();
+	// Set the grid choice based on a string.
+	// The string can be:
+	// - a grid label from the gGridInfo table 
+	// - an ip address
+    if(!grid_name.empty())
+    {
+        // find the grid choice from the user setting.
+        int grid_index = GRID_INFO_NONE; 
+        for(;grid_index < GRID_INFO_OTHER; ++grid_index)
+        {
+            if(0 == LLStringUtil::compareInsensitive(gGridInfo[grid_index].mLabel, grid_name))
+            {
+				// Founding a matching label in the list...
+				setGridChoice((EGridInfo)grid_index);
+				break;
+            }
+        }
+
+        if(GRID_INFO_OTHER == grid_index)
+        {
+            // *FIX:MEP Can and should we validate that this is an IP address?
+            mGridChoice = GRID_INFO_OTHER;
+            mGridName = grid_name;
+			gSavedSettings.setS32("ServerChoice", mGridChoice);
+			gSavedSettings.setString("CustomServer", mGridName);
+        }
+    }
 }
 
-//
-// LLGridManager::addGrid - add a grid to the grid list, populating the needed values
-// if they're not populated yet.
-//
-
-void LLGridManager::addGrid(LLSD& grid_data)
+void LLViewerLogin::resetURIs()
 {
-	if (grid_data.isMap() && grid_data.has(GRID_VALUE))
-	{
-		std::string grid = utf8str_tolower(grid_data[GRID_VALUE]);
+    // Clear URIs when picking a new server
+	gSavedSettings.setLLSD("CmdLineLoginURI", LLSD::emptyArray());
+	gSavedSettings.setString("CmdLineHelperURI", "");
+}
 
-		// grid should be in the form of a dns address
-		if (!grid.empty() &&
-			grid.find_first_not_of("abcdefghijklmnopqrstuvwxyz1234567890-_. ") != std::string::npos)
-		{
-			printf("grid name: %s", grid.c_str());
-			throw LLInvalidGridName(grid);
-		}
-		
-		// populate the other values if they don't exist
-		if (!grid_data.has(GRID_LABEL_VALUE)) 
-		{
-			grid_data[GRID_LABEL_VALUE] = grid;
-		}
-		if (!grid_data.has(GRID_ID_VALUE))
-		{
-			grid_data[GRID_ID_VALUE] = grid;
-		}
-		
-		// if the grid data doesn't include any of the URIs, then 
-		// generate them from the grid, which should be a dns address
-		if (!grid_data.has(GRID_LOGIN_URI_VALUE)) 
-		{
-			grid_data[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-			grid_data[GRID_LOGIN_URI_VALUE].append(std::string("https://") + 
-													grid + "/cgi-bin/login.cgi");
-		}
-		// Populate to the default values
-		if (!grid_data.has(GRID_LOGIN_PAGE_VALUE)) 
-		{
-			grid_data[GRID_LOGIN_PAGE_VALUE] = std::string("http://") + grid + "/app/login/";
-		}		
-		if (!grid_data.has(GRID_HELPER_URI_VALUE)) 
-		{
-			grid_data[GRID_HELPER_URI_VALUE] = std::string("https://") + grid + "/helpers/";
-		}		
-		LL_INFOS("GridManager") << "ADDING: " << grid << LL_ENDL;
-		mGridList[grid] = grid_data;		
-	}
+EGridInfo LLViewerLogin::getGridChoice() const
+{
+	return mGridChoice;
 }
 
-//
-// LLGridManager::addSystemGrid - helper for adding a system grid.
-void LLGridManager::addSystemGrid(const std::string& label, 
-								  const std::string& name, 
-								  const std::string& login, 
-								  const std::string& helper,
-								  const std::string& login_page,
-								  const std::string& login_id)
+std::string LLViewerLogin::getGridLabel() const
 {
-	LLSD grid = LLSD::emptyMap();
-	grid[GRID_VALUE] = name;
-	grid[GRID_LABEL_VALUE] = label;
-	grid[GRID_HELPER_URI_VALUE] = helper;
-	grid[GRID_LOGIN_URI_VALUE] = LLSD::emptyArray();
-	grid[GRID_LOGIN_URI_VALUE].append(login);
-	grid[GRID_LOGIN_PAGE_VALUE] = login_page;
-	grid[GRID_IS_SYSTEM_GRID_VALUE] = TRUE;
-	grid[GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE] = GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT;
-	
-	grid[GRID_APP_SLURL_BASE] = SYSTEM_GRID_APP_SLURL_BASE;
-	if (login_id.empty())
-	{
-		grid[GRID_ID_VALUE] = name;
-	}
-	else
+	if(mGridChoice == GRID_INFO_NONE)
 	{
-		grid[GRID_ID_VALUE] = login_id;
+		return "None";
 	}
-	
-	// only add the system grids beyond agni to the visible list
-	// if we're building a debug version.
-	if (name == std::string(MAINGRID))
+	else if(mGridChoice < GRID_INFO_OTHER)
 	{
-		grid[GRID_SLURL_BASE] = MAIN_GRID_SLURL_BASE;		
-		grid[GRID_IS_FAVORITE_VALUE] = TRUE;		
+		return gGridInfo[mGridChoice].mLabel;
 	}
-	else
-	{
-		grid[GRID_SLURL_BASE] = llformat(SYSTEM_GRID_SLURL_BASE, label.c_str());		
-	}
-	addGrid(grid);
+
+	return mGridName;
 }
 
-// return a list of grid name -> grid label mappings for UI purposes
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
+std::string LLViewerLogin::getKnownGridLabel(EGridInfo grid_index) const
 {
-	std::map<std::string, std::string> result;
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++) 
+	if(grid_index > GRID_INFO_NONE && grid_index < GRID_INFO_OTHER)
 	{
-		if(!favorite_only || grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
-		{
-			result[grid_iter->first] = grid_iter->second[GRID_LABEL_VALUE].asString();
-		}
+		return gGridInfo[grid_index].mLabel;
 	}
-
-	return result;
+	return gGridInfo[GRID_INFO_NONE].mLabel;
 }
 
-void LLGridManager::setGridChoice(const std::string& grid)
+void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const
 {
-	// Set the grid choice based on a string.
-	// The string can be:
-	// - a grid label from the gGridInfo table 
-	// - a hostname
-	// - an ip address
-
-	// loop through.  We could do just a hash lookup but we also want to match
-	// on label
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++) 
+	// return the login uri set on the command line.
+	LLControlVariable* c = gSavedSettings.getControl("CmdLineLoginURI");
+	if(c)
 	{
-		if((grid == grid_iter->first) || 
-		   (grid == grid_iter->second[GRID_LABEL_VALUE].asString()))
+		LLSD v = c->getValue();
+		if(v.isArray())
 		{
-			mGrid = grid_iter->second[GRID_VALUE].asString();
-			gSavedSettings.setString("CurrentGrid", grid_iter->second[GRID_VALUE]);			
-			return; 
-
+			for(LLSD::array_const_iterator itr = v.beginArray();
+				itr != v.endArray(); ++itr)
+			{
+				std::string uri = itr->asString();
+				if(!uri.empty())
+				{
+					uris.push_back(uri);
+				}
+			}
+		}
+		else
+		{
+			std::string uri = v.asString();
+			if(!uri.empty())
+			{
+				uris.push_back(uri);
+			}
 		}
 	}
-	LLSD grid_data = LLSD::emptyMap();
-	grid_data[GRID_VALUE] = grid;
-	addGrid(grid_data);
-	mGrid = grid;
-	gSavedSettings.setString("CurrentGrid", grid);
-}
 
-std::string LLGridManager::getGridByLabel( const std::string &grid_label)
-{
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++) 
+	// If there was no command line uri...
+	if(uris.empty())
 	{
-		if (grid_iter->second.has(GRID_LABEL_VALUE) && (grid_iter->second[GRID_LABEL_VALUE].asString() == grid_label))
+		// If its a known grid choice, get the uri from the table,
+		// else try the grid name.
+		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+		{
+			uris.push_back(gGridInfo[mGridChoice].mLoginURI);
+		}
+		else
 		{
-			return grid_iter->first;
+			uris.push_back(mGridName);
 		}
 	}
-	return std::string();
 }
 
-void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+std::string LLViewerLogin::getHelperURI() const
 {
-	uris.clear();
-	for (LLSD::array_iterator llsd_uri = mGridList[mGrid][GRID_LOGIN_URI_VALUE].beginArray();
-		 llsd_uri != mGridList[mGrid][GRID_LOGIN_URI_VALUE].endArray();
-		 llsd_uri++)
+	std::string helper_uri = gSavedSettings.getString("CmdLineHelperURI");
+	if (helper_uri.empty())
 	{
-		uris.push_back(llsd_uri->asString());
+		// grab URI from selected grid
+		if(mGridChoice > GRID_INFO_NONE && mGridChoice < GRID_INFO_OTHER)
+		{
+			helper_uri = gGridInfo[mGridChoice].mHelperURI;
+		}
+
+		if (helper_uri.empty())
+		{
+			// what do we do with unnamed/miscellaneous grids?
+			// for now, operations that rely on the helper URI (currency/land purchasing) will fail
+		}
 	}
+	return helper_uri;
 }
 
-bool LLGridManager::isInProductionGrid()
+bool LLViewerLogin::isInProductionGrid()
 {
 	// *NOTE:Mani This used to compare GRID_INFO_AGNI to gGridChoice,
 	// but it seems that loginURI trumps that.
 	std::vector<std::string> uris;
 	getLoginURIs(uris);
-	if (uris.size() < 1)
-	{
-		return 1;
-	}
 	LLStringUtil::toLower(uris[0]);
 	if((uris[0].find("agni") != std::string::npos))
 	{
@@ -513,51 +339,3 @@ bool LLGridManager::isInProductionGrid()
 
 	return false;
 }
-
-void LLGridManager::saveFavorites()
-{
-	// filter out just those marked as favorites
-	LLSD output_grid_list = LLSD::emptyMap();
-	for(LLSD::map_iterator grid_iter = mGridList.beginMap();
-		grid_iter != mGridList.endMap();
-		grid_iter++)
-	{
-		if(grid_iter->second.has(GRID_IS_FAVORITE_VALUE))
-		{
-			output_grid_list[grid_iter->first] = grid_iter->second;
-		}
-	}       
-	llofstream llsd_xml;
-	llsd_xml.open( mGridFile.c_str(), std::ios::out | std::ios::binary);	
-	LLSDSerialize::toPrettyXML(output_grid_list, llsd_xml);
-	llsd_xml.close();
-}
-
-
-// build a slurl for the given region within the selected grid
-std::string LLGridManager::getSLURLBase(const std::string& grid)
-{
-	std::string grid_base;
-	if(mGridList.has(grid) && mGridList[grid].has(GRID_SLURL_BASE))
-	{
-		return mGridList[grid][GRID_SLURL_BASE].asString();
-	}
-	else
-	{
-		return  llformat(DEFAULT_SLURL_BASE, grid.c_str());
-	}
-}
-
-// build a slurl for the given region within the selected grid
-std::string LLGridManager::getAppSLURLBase(const std::string& grid)
-{
-	std::string grid_base;
-	if(mGridList.has(grid) && mGridList[grid].has(GRID_APP_SLURL_BASE))
-	{
-	  return mGridList[grid][GRID_APP_SLURL_BASE].asString();
-	}
-	else
-	{
-	  return  llformat(DEFAULT_APP_SLURL_BASE, grid.c_str());
-	}
-}
diff --git a/indra/newview/llviewernetwork.h b/indra/newview/llviewernetwork.h
index 46f21bf20f..edae6dc47b 100644
--- a/indra/newview/llviewernetwork.h
+++ b/indra/newview/llviewernetwork.h
@@ -5,7 +5,7 @@
  *
  * $LicenseInfo:firstyear=2006&license=viewergpl$
  * 
- * Copyright (c) 2006-2010, Linden Research, Inc.
+ * Copyright (c) 2006-2009, Linden Research, Inc.
  * 
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
@@ -13,12 +13,13 @@
  * ("GPL"), unless you have obtained a separate licensing agreement
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlife.com/developers/opensource/gplv2
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  * 
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlife.com/developers/opensource/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -32,136 +33,83 @@
 
 #ifndef LL_LLVIEWERNETWORK_H
 #define LL_LLVIEWERNETWORK_H
-                                                                                                       
-extern const char* DEFAULT_LOGIN_PAGE;
-      
-#define GRID_VALUE "name"
-#define GRID_LABEL_VALUE "label"
-#define GRID_ID_VALUE "grid_login_id"
-#define GRID_LOGIN_URI_VALUE "login_uri"
-#define GRID_HELPER_URI_VALUE "helper_uri"
-#define GRID_LOGIN_PAGE_VALUE "login_page"
-#define GRID_IS_SYSTEM_GRID_VALUE "system_grid"
-#define GRID_IS_FAVORITE_VALUE "favorite"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_VALUE "credential_type"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_AGENT "agent"
-#define GRID_LOGIN_CREDENTIAL_PAGE_TYPE_ACCOUNT "account"
-#define MAINGRID "util.agni.lindenlab.com"
 
-// defines slurl formats associated with various grids.
-// we need to continue to support existing forms, as slurls
-// are shared between viewers that may not understand newer
-// forms.
-#define GRID_SLURL_BASE "slurl_base"
-#define GRID_APP_SLURL_BASE "app_slurl_base"
+#include <boost/scoped_ptr.hpp>
 
-class LLInvalidGridName
+class LLHost;
+class LLLogin;
+
+enum EGridInfo
 {
-public:
-	LLInvalidGridName(std::string grid) : mGrid(grid)
-	{
-	}
-protected:
-	std::string mGrid;
+	GRID_INFO_NONE,
+	GRID_INFO_ADITI,
+	GRID_INFO_AGNI,
+	GRID_INFO_ARUNA,
+	GRID_INFO_BHARATI,
+	GRID_INFO_CHANDRA,
+	GRID_INFO_DAMBALLAH,
+	GRID_INFO_DANU,
+	GRID_INFO_DURGA,
+	GRID_INFO_GANGA,
+	GRID_INFO_MITRA,
+	GRID_INFO_MOHINI,
+	GRID_INFO_NANDI,
+	GRID_INFO_PARVATI,
+	GRID_INFO_RADHA,
+	GRID_INFO_RAVI,
+	GRID_INFO_SIVA,
+	GRID_INFO_SHAKTI,
+	GRID_INFO_SKANDA,
+	GRID_INFO_SOMA,
+	GRID_INFO_UMA,
+	GRID_INFO_VAAK,
+	GRID_INFO_YAMI,
+	GRID_INFO_LOCAL,
+	GRID_INFO_OTHER, // IP address set via command line option
+	GRID_INFO_COUNT
 };
 
-
 /**
- * @brief A class to manage the grids available to the viewer
- * including persistance.  This class also maintains the currently
- * selected grid.
+ * @brief A class to manage the viewer's login state.
  * 
  **/
-class LLGridManager : public LLSingleton<LLGridManager>
+class LLViewerLogin : public LLSingleton<LLViewerLogin>
 {
 public:
-	
-	// when the grid manager is instantiated, the default grids are automatically
-	// loaded, and the grids favorites list is loaded from the xml file.
-	LLGridManager(const std::string& grid_file);
-	LLGridManager();
-	~LLGridManager();
-	
-	void initialize(const std::string& grid_file);
-	// grid list management
-	
-	// add a grid to the list of grids
-	void addGrid(LLSD& grid_info);	
+	LLViewerLogin();
+	~LLViewerLogin();
 
-	// retrieve a map of grid-name <-> label
-	// by default only return the user visible grids
-	std::map<std::string, std::string> getKnownGrids(bool favorites_only=FALSE);
-	
-	LLSD getGridInfo(const std::string& grid)
-	{
-		if(mGridList.has(grid))
-		{
-			return mGridList[grid];
-		}
-		else
-		{
-			return LLSD();
-		}
-	}
-	
-	// current grid management
+	void setGridChoice(EGridInfo grid);
+	void setGridChoice(const std::string& grid_name);
+	void resetURIs();
 
-	// select a given grid as the current grid.  If the grid
-	// is not a known grid, then it's assumed to be a dns name for the
-	// grid, and the various URIs will be automatically generated.
-	void setGridChoice(const std::string& grid);
-	
-	
-	std::string getGridLabel() { return mGridList[mGrid][GRID_LABEL_VALUE]; } 	
-	std::string getGrid() const { return mGrid; }
-	void getLoginURIs(std::vector<std::string>& uris);
-	std::string getHelperURI() {return mGridList[mGrid][GRID_HELPER_URI_VALUE];}
-	std::string getLoginPage() {return mGridList[mGrid][GRID_LOGIN_PAGE_VALUE];}
-	std::string getGridLoginID() { return mGridList[mGrid][GRID_ID_VALUE]; }	
-	std::string getLoginPage(const std::string& grid) { return mGridList[grid][GRID_LOGIN_PAGE_VALUE]; }
-	
-	// build a slurl for the given region within the selected grid
-	std::string getSLURLBase(const std::string& grid);
-	std::string getSLURLBase() { return getSLURLBase(mGrid); }
-	
-	std::string getAppSLURLBase(const std::string& grid);
-	std::string getAppSLURLBase() { return getAppSLURLBase(mGrid); }	
-	
-	LLSD getGridInfo() { return mGridList[mGrid]; }
-	
-	std::string getGridByLabel( const std::string &grid_label);
-	
-	bool isSystemGrid(const std::string& grid) 
-	{ 
-		return mGridList.has(grid) &&
-		      mGridList[grid].has(GRID_IS_SYSTEM_GRID_VALUE) && 
-	           mGridList[grid][GRID_IS_SYSTEM_GRID_VALUE].asBoolean(); 
-	}
-	bool isSystemGrid() { return isSystemGrid(mGrid); }
-	// Mark this grid as a favorite that should be persisited on 'save'
-	// this is currently used to persist a grid after a successful login
-	void setFavorite() { mGridList[mGrid][GRID_IS_FAVORITE_VALUE] = TRUE; }
-	
-	bool isInProductionGrid();
-	void saveFavorites();
-	void clearFavorites();
+	/**
+	* @brief Get the enumeration of the grid choice.
+	* Should only return values > 0 && < GRID_INFO_COUNT
+	**/
+	EGridInfo getGridChoice() const;
 
-protected:
+	/**
+	* @brief Get a readable label for the grid choice.
+	* Returns the readable name for the grid choice. 
+	* If the grid is 'other', returns something
+	* the string used to specifiy the grid.
+	**/
+	std::string getGridLabel() const; 
+
+	std::string getKnownGridLabel(EGridInfo grid_index) const; 
+
+	void getLoginURIs(std::vector<std::string>& uris) const;
+	std::string getHelperURI() const;
+
+	bool isInProductionGrid();
 
-	// helper function for adding the predefined grids
-	void addSystemGrid(const std::string& label, 
-					   const std::string& name, 
-					   const std::string& login, 
-					   const std::string& helper,
-					   const std::string& login_page,
-					   const std::string& login_id = "");	
-	
-	
-	std::string mGrid;
-	std::string mGridFile;
-	LLSD mGridList;
+private:
+	EGridInfo mGridChoice;
+	std::string mGridName;
 };
 
 const S32 MAC_ADDRESS_BYTES = 6;
+extern unsigned char gMACAddress[MAC_ADDRESS_BYTES];		/* Flawfinder: ignore */
 
 #endif
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index e6d14079c9..8860b734bb 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -4726,7 +4726,7 @@ BOOL LLViewerObject::permYouOwner() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4763,7 +4763,7 @@ BOOL LLViewerObject::permOwnerModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4787,7 +4787,7 @@ BOOL LLViewerObject::permModify() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 	{
 			return TRUE;
@@ -4811,7 +4811,7 @@ BOOL LLViewerObject::permCopy() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4835,7 +4835,7 @@ BOOL LLViewerObject::permMove() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
@@ -4859,7 +4859,7 @@ BOOL LLViewerObject::permTransfer() const
 		return TRUE;
 #else
 # ifdef TOGGLE_HACKED_GODLIKE_VIEWER
-		if (!LLGridManager::getInstance()->isInProductionGrid()
+		if (!LLViewerLogin::getInstance()->isInProductionGrid()
             && (gAgent.getGodLevel() >= GOD_MAINTENANCE))
 		{
 			return TRUE;
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index bdc34d0f18..b7c265be59 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -768,11 +768,9 @@ void send_stats()
 	system["ram"] = (S32) gSysMemory.getPhysicalMemoryKB();
 	system["os"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	system["cpu"] = gSysCPU.getCPUString();
-	unsigned char MACAddress[MAC_ADDRESS_BYTES];
-	LLUUID::getNodeID(MACAddress);
 	std::string macAddressString = llformat("%02x-%02x-%02x-%02x-%02x-%02x",
-											MACAddress[0],MACAddress[1],MACAddress[2],
-											MACAddress[3],MACAddress[4],MACAddress[5]);
+											gMACAddress[0],gMACAddress[1],gMACAddress[2],
+											gMACAddress[3],gMACAddress[4],gMACAddress[5]);
 	system["mac_address"] = macAddressString;
 	system["serial_number"] = LLAppViewer::instance()->getSerialNumber();
 	std::string gpu_desc = llformat(
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 4c6a02db87..ae3f680cbf 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -85,6 +85,7 @@
 #include "lltooltip.h"
 #include "llmediaentry.h"
 #include "llurldispatcher.h"
+#include "llurlsimstring.h"
 
 // newview includes
 #include "llagent.h"
@@ -798,7 +799,7 @@ BOOL LLViewerWindow::handleRightMouseUp(LLWindow *window,  LLCoordGL pos, MASK m
 BOOL LLViewerWindow::handleMiddleMouseDown(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = TRUE;
-	LLVoiceClient::getInstance()->middleMouseState(true);
+	gVoiceClient->middleMouseState(true);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -825,15 +826,20 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 					
 				if (slurl_dnd_enabled)
 				{
-					LLSLURL dropped_slurl(data);
-					if(dropped_slurl.isSpatial())
+					
+					// special case SLURLs
+					// isValidSLURL() call was added here to make sure that dragged SLURL is valid (EXT-4964)
+					if ( LLSLURL::isSLURL( data ) && LLSLURL::isValidSLURL( data ) )
 					{
 						if (drop)
 						{
-							LLURLDispatcher::dispatch( dropped_slurl.getSLURLString(), NULL, true );
-							return LLWindowCallbacks::DND_MOVE;
+							LLURLDispatcher::dispatch( data, NULL, true );
+							LLURLSimString::setStringRaw( LLSLURL::stripProtocol( data ) );
+							LLPanelLogin::refreshLocation( true );
+							LLPanelLogin::updateLocationUI();
 						}
-					}
+						return LLWindowCallbacks::DND_MOVE;
+					};
 				}
 
 				if (prim_media_dnd_enabled)
@@ -951,7 +957,7 @@ LLWindowCallbacks::DragNDropResult LLViewerWindow::handleDragNDrop( LLWindow *wi
 BOOL LLViewerWindow::handleMiddleMouseUp(LLWindow *window,  LLCoordGL pos, MASK mask)
 {
 	BOOL down = FALSE;
-	LLVoiceClient::getInstance()->middleMouseState(false);
+	gVoiceClient->middleMouseState(false);
  	handleAnyMouseClick(window,pos,mask,LLMouseHandler::CLICK_MIDDLE,down);
   
   	// Always handled as far as the OS is concerned.
@@ -1068,7 +1074,7 @@ void LLViewerWindow::handleFocusLost(LLWindow *window)
 BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	LLVoiceClient::getInstance()->keyDown(key, mask);
+	gVoiceClient->keyDown(key, mask);
 	
 	if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
 	{
@@ -1090,7 +1096,7 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key,  MASK mask, BOOL repeated)
 BOOL LLViewerWindow::handleTranslatedKeyUp(KEY key,  MASK mask)
 {
 	// Let the voice chat code check for its PTT key.  Note that this never affects event processing.
-	LLVoiceClient::getInstance()->keyUp(key, mask);
+	gVoiceClient->keyUp(key, mask);
 
 	return FALSE;
 }
@@ -1949,7 +1955,7 @@ void LLViewerWindow::setNormalControlsVisible( BOOL visible )
 
 		// ...and set the menu color appropriately.
 		setMenuBackgroundColor(gAgent.getGodLevel() > GOD_NOT, 
-			LLGridManager::getInstance()->isInProductionGrid());
+			LLViewerLogin::getInstance()->isInProductionGrid());
 	}
         
 	if ( gStatusBar )
@@ -1970,15 +1976,15 @@ void LLViewerWindow::setMenuBackgroundColor(bool god_mode, bool dev_grid)
     LLSD args;
     LLColor4 new_bg_color;
 
-    if(god_mode && LLGridManager::getInstance()->isInProductionGrid())
+    if(god_mode && LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuBarGodBgColor" );
     }
-    else if(god_mode && !LLGridManager::getInstance()->isInProductionGrid())
+    else if(god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionGodBgColor" );
     }
-    else if(!god_mode && !LLGridManager::getInstance()->isInProductionGrid())
+    else if(!god_mode && !LLViewerLogin::getInstance()->isInProductionGrid())
     {
         new_bg_color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
     }
@@ -2194,6 +2200,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
 		}
 		return TRUE;
 	}
+
 	// hidden edit menu for cut/copy/paste
 	if (gEditMenu && gEditMenu->handleAcceleratorKey(key, mask))
 	{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 540cb47710..0ce8894872 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -1266,7 +1266,7 @@ void LLVOAvatar::initInstance(void)
 	
 	//VTPause();  // VTune
 	
-	mVoiceVisualizer->setVoiceEnabled( LLVoiceClient::getInstance()->getVoiceEnabled( mID ) );
+	mVoiceVisualizer->setVoiceEnabled( gVoiceClient->getVoiceEnabled( mID ) );
 }
 
 const LLVector3 LLVOAvatar::getRenderPosition() const
@@ -2197,8 +2197,8 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	}
 
 	static LLUICachedControl<bool> visualizers_in_calls("ShowVoiceVisualizersInCalls", false);
-	bool voice_enabled = (visualizers_in_calls || LLVoiceClient::getInstance()->inProximalChannel()) &&
-						 LLVoiceClient::getInstance()->getVoiceEnabled(mID);
+	bool voice_enabled = (visualizers_in_calls || gVoiceClient->inProximalChannel()) &&
+						 gVoiceClient->getVoiceEnabled(mID);
 
 	idleUpdateVoiceVisualizer( voice_enabled );
 	idleUpdateMisc( detailed_update );
@@ -2261,7 +2261,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 		// Notice the calls to "gAwayTimer.reset()". This resets the timer that determines how long the avatar has been
 		// "away", so that the avatar doesn't lapse into away-mode (and slump over) while the user is still talking. 
 		//-----------------------------------------------------------------------------------------------------------------
-		if (LLVoiceClient::getInstance()->getIsSpeaking( mID ))
+		if (gVoiceClient->getIsSpeaking( mID ))
 		{		
 			if (!mVoiceVisualizer->getCurrentlySpeaking())
 			{
@@ -2270,7 +2270,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled)
 				//printf( "gAwayTimer.reset();\n" );
 			}
 			
-			mVoiceVisualizer->setSpeakingAmplitude( LLVoiceClient::getInstance()->getCurrentPower( mID ) );
+			mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) );
 			
 			if( isSelf() )
 			{
@@ -2499,7 +2499,7 @@ F32 LLVOAvatar::calcMorphAmount()
 void LLVOAvatar::idleUpdateLipSync(bool voice_enabled)
 {
 	// Use the Lipsync_Ooh and Lipsync_Aah morphs for lip sync
-	if ( voice_enabled && (LLVoiceClient::getInstance()->lipSyncEnabled()) && LLVoiceClient::getInstance()->getIsSpeaking( mID ) )
+	if ( voice_enabled && (gVoiceClient->lipSyncEnabled()) && gVoiceClient->getIsSpeaking( mID ) )
 	{
 		F32 ooh_morph_amount = 0.0f;
 		F32 aah_morph_amount = 0.0f;
diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp
index 338bc12f04..fac7fa6a18 100644
--- a/indra/newview/llvoicechannel.cpp
+++ b/indra/newview/llvoicechannel.cpp
@@ -72,9 +72,9 @@ private:
 
 void LLVoiceCallCapResponder::error(U32 status, const std::string& reason)
 {
-	LL_WARNS("Voice") << "LLVoiceCallCapResponder::error("
+	llwarns << "LLVoiceCallCapResponder::error("
 		<< status << ": " << reason << ")"
-		<< LL_ENDL;
+		<< llendl;
 	LLVoiceChannel* channelp = LLVoiceChannel::getChannelByID(mSessionID);
 	if ( channelp )
 	{
@@ -104,8 +104,8 @@ void LLVoiceCallCapResponder::result(const LLSD& content)
 		LLSD::map_const_iterator iter;
 		for(iter = content.beginMap(); iter != content.endMap(); ++iter)
 		{
-			LL_DEBUGS("Voice") << "LLVoiceCallCapResponder::result got " 
-				<< iter->first << LL_ENDL;
+			llinfos << "LLVoiceCallCapResponder::result got " 
+				<< iter->first << llendl;
 		}
 
 		channelp->setChannelInfo(
@@ -131,8 +131,10 @@ LLVoiceChannel::LLVoiceChannel(const LLUUID& session_id, const std::string& sess
 	{
 		// a voice channel already exists for this session id, so this instance will be orphaned
 		// the end result should simply be the failure to make voice calls
-		LL_WARNS("Voice") << "Duplicate voice channels registered for session_id " << session_id << LL_ENDL;
+		llwarns << "Duplicate voice channels registered for session_id " << session_id << llendl;
 	}
+
+	LLVoiceClient::getInstance()->addObserver(this);
 }
 
 LLVoiceChannel::~LLVoiceChannel()
@@ -143,7 +145,7 @@ LLVoiceChannel::~LLVoiceChannel()
 	// later in other destructors anyway). EXT-5524
 	if(LLVoiceClient::instanceExists())
 	{
-		LLVoiceClient::getInstance()->removeObserver(this);
+		gVoiceClient->removeObserver(this);
 	}
 	
 	sVoiceChannelMap.erase(mSessionID);
@@ -163,13 +165,13 @@ void LLVoiceChannel::setChannelInfo(
 		if (mURI.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			LL_WARNS("Voice") << "Received empty URI for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received empty URI for channel " << mSessionName << llendl;
 			deactivate();
 		}
 		else if (mCredentials.empty())
 		{
 			LLNotificationsUtil::add("VoiceChannelJoinFailed", mNotifyArgs);
-			LL_WARNS("Voice") << "Received empty credentials for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received empty credentials for channel " << mSessionName << llendl;
 			deactivate();
 		}
 		else
@@ -284,14 +286,13 @@ void LLVoiceChannel::deactivate()
 		//Default mic is OFF when leaving voice calls
 		if (gSavedSettings.getBOOL("AutoDisengageMic") && 
 			sCurrentVoiceChannel == this &&
-			LLVoiceClient::getInstance()->getUserPTTState())
+			gVoiceClient->getUserPTTState())
 		{
 			gSavedSettings.setBOOL("PTTCurrentlyEnabled", true);
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 	}
-	LLVoiceClient::getInstance()->removeObserver(this);
-	
+
 	if (sCurrentVoiceChannel == this)
 	{
 		// default channel is proximal channel
@@ -331,9 +332,7 @@ void LLVoiceChannel::activate()
 	{
 		setState(STATE_CALL_STARTED);
 	}
-	
-	LLVoiceClient::getInstance()->addObserver(this);
-	
+
 	//do not send earlier, channel should be initialized, should not be in STATE_NO_CHANNEL_INFO state
 	sCurrentVoiceChannelChangedSignal(this->mSessionID);
 }
@@ -375,11 +374,6 @@ LLVoiceChannel* LLVoiceChannel::getChannelByURI(std::string uri)
 	}
 }
 
-LLVoiceChannel* LLVoiceChannel::getCurrentVoiceChannel()
-{
-	return sCurrentVoiceChannel;
-}
-
 void LLVoiceChannel::updateSessionID(const LLUUID& new_session_id)
 {
 	sVoiceChannelMap.erase(sVoiceChannelMap.find(mSessionID));
@@ -431,6 +425,7 @@ void LLVoiceChannel::initClass()
 	sCurrentVoiceChannel = LLVoiceChannelProximal::getInstance();
 }
 
+
 //static 
 void LLVoiceChannel::suspend()
 {
@@ -446,7 +441,7 @@ void LLVoiceChannel::resume()
 {
 	if (sSuspended)
 	{
-		if (LLVoiceClient::getInstance()->voiceEnabled())
+		if (gVoiceClient->voiceEnabled())
 		{
 			if (sSuspendedVoiceChannel)
 			{
@@ -516,9 +511,9 @@ void LLVoiceChannelGroup::activate()
 #endif
 
 		//Mic default state is OFF on initiating/joining Ad-Hoc/Group calls
-		if (LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+		if (gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
 		{
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 		
 	}
@@ -565,7 +560,7 @@ void LLVoiceChannelGroup::setChannelInfo(
 		else
 		{
 			//*TODO: notify user
-			LL_WARNS("Voice") << "Received invalid credentials for channel " << mSessionName << LL_ENDL;
+			llwarns << "Received invalid credentials for channel " << mSessionName << llendl;
 			deactivate();
 		}
 	}
@@ -664,6 +659,7 @@ void LLVoiceChannelGroup::setState(EState state)
 LLVoiceChannelProximal::LLVoiceChannelProximal() : 
 	LLVoiceChannel(LLUUID::null, LLStringUtil::null)
 {
+	activate();
 }
 
 BOOL LLVoiceChannelProximal::isActive()
@@ -675,13 +671,13 @@ void LLVoiceChannelProximal::activate()
 {
 	if (callStarted()) return;
 
-	if((LLVoiceChannel::sCurrentVoiceChannel != this) && (LLVoiceChannel::getState() == STATE_CONNECTED))
+	LLVoiceChannel::activate();
+
+	if (callStarted())
 	{
-		// we're connected to a non-spatial channel, so disconnect.
-		LLVoiceClient::getInstance()->leaveNonSpatialChannel();	
+		// this implicitly puts you back in the spatial channel
+		LLVoiceClient::getInstance()->leaveNonSpatialChannel();
 	}
-	LLVoiceChannel::activate();
-	
 }
 
 void LLVoiceChannelProximal::onChange(EStatusType type, const std::string &channelURI, bool proximal)
@@ -711,7 +707,7 @@ void LLVoiceChannelProximal::handleStatusChange(EStatusType status)
 		return;
 	case STATUS_VOICE_DISABLED:
 		//skip showing "Voice not available at your current location" when agent voice is disabled (EXT-4749)
-		if(LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking())
+		if(LLVoiceClient::voiceEnabled() && gVoiceClient->voiceWorking())
 		{
 			//TODO: remove or redirect this call status notification
 //			LLCallInfoDialog::show("unavailable", mNotifyArgs);
@@ -771,7 +767,7 @@ LLVoiceChannelP2P::LLVoiceChannelP2P(const LLUUID& session_id, const std::string
 
 void LLVoiceChannelP2P::handleStatusChange(EStatusType type)
 {
-	LL_INFOS("Voice") << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << LL_ENDL;
+	llinfos << "P2P CALL CHANNEL STATUS CHANGE: incoming=" << int(mReceivedCall) << " newstatus=" << LLVoiceClientStatusObserver::status2string(type) << " (mState=" << mState << ")" << llendl;
 
 	// status updates
 	switch(type)
@@ -845,9 +841,9 @@ void LLVoiceChannelP2P::activate()
 		LLRecentPeople::instance().add(mOtherUserID);
 
 		//Default mic is ON on initiating/joining P2P calls
-		if (!LLVoiceClient::getInstance()->getUserPTTState() && LLVoiceClient::getInstance()->getPTTIsToggle())
+		if (!gVoiceClient->getUserPTTState() && gVoiceClient->getPTTIsToggle())
 		{
-			LLVoiceClient::getInstance()->inputUserControlState(true);
+			gVoiceClient->inputUserControlState(true);
 		}
 	}
 }
@@ -910,7 +906,7 @@ void LLVoiceChannelP2P::setSessionHandle(const std::string& handle, const std::s
 
 void LLVoiceChannelP2P::setState(EState state)
 {
-	LL_INFOS("Voice") << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << LL_ENDL;
+	llinfos << "P2P CALL STATE CHANGE: incoming=" << int(mReceivedCall) << " oldstate=" << mState << " newstate=" << state << llendl;
 
 	if (mReceivedCall) // incoming call
 	{
diff --git a/indra/newview/llvoicechannel.h b/indra/newview/llvoicechannel.h
index 573fab1f4f..941cccacc3 100644
--- a/indra/newview/llvoicechannel.h
+++ b/indra/newview/llvoicechannel.h
@@ -98,8 +98,7 @@ public:
 
 	static LLVoiceChannel* getChannelByID(const LLUUID& session_id);
 	static LLVoiceChannel* getChannelByURI(std::string uri);
-	static LLVoiceChannel* getCurrentVoiceChannel();
-	
+	static LLVoiceChannel* getCurrentVoiceChannel() { return sCurrentVoiceChannel; }
 	static void initClass();
 	
 	static void suspend();
diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp
index e067754e3e..2238acd643 100644
--- a/indra/newview/llvoiceclient.cpp
+++ b/indra/newview/llvoiceclient.cpp
@@ -1,6 +1,6 @@
  /** 
  * @file llvoiceclient.cpp
- * @brief Voice client delegation class implementation.
+ * @brief Implementation of LLVoiceClient class which is the interface to the voice client process.
  *
  * $LicenseInfo:firstyear=2001&license=viewergpl$
  * 
@@ -17,7 +17,8 @@
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -31,730 +32,7244 @@
 
 #include "llviewerprecompiledheaders.h"
 #include "llvoiceclient.h"
-#include "llviewercontrol.h"
-#include "llviewerwindow.h"
-#include "llvoicedw.h"
-#include "llvoicevivox.h"
-#include "llviewernetwork.h"
-#include "llhttpnode.h"
+
+#include <boost/tokenizer.hpp>
+
+// library includes
 #include "llnotificationsutil.h"
 #include "llsdserialize.h"
-#include "llui.h"
+#include "llsdutil.h"
+
+
+// project includes
+#include "llvoavatar.h"
+#include "llbufferstream.h"
+#include "llfile.h"
+#ifdef LL_STANDALONE
+# include "expat.h"
+#else
+# include "expat/expat.h"
+#endif
+#include "llcallbacklist.h"
+#include "llcallingcard.h"   // for LLFriendObserver
+#include "llviewerregion.h"
+#include "llviewernetwork.h"		// for gGridChoice
+#include "llbase64.h"
+#include "llviewercontrol.h"
+#include "llkeyboard.h"
+#include "llappviewer.h"	// for gDisconnected, gDisableVoice
+#include "llmutelist.h"  // to check for muted avatars
+#include "llagent.h"
+#include "llvoavatarself.h"
+#include "llcachename.h"
+#include "llimview.h" // for LLIMMgr
+#include "llparcel.h"
+#include "llviewerparcelmgr.h"
+//#include "llfirstuse.h"
+#include "llspeakers.h"
+#include "lltrans.h"
+#include "llviewerwindow.h"
+#include "llviewercamera.h"
+#include "llvoavatarself.h"
+#include "llvoicechannel.h"
+
+// for base64 decoding
+#include "apr_base64.h"
+
+// for SHA1 hash
+#include "apr_sha1.h"
+
+// for MD5 hash
+#include "llmd5.h"
+
+#define USE_SESSION_GROUPS 0
+
+static bool sConnectingToAgni = false;
+F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
+
+const F32 LLVoiceClient::VOLUME_MIN = 0.f;
+const F32 LLVoiceClient::VOLUME_DEFAULT = 0.5f;
+const F32 LLVoiceClient::VOLUME_MAX = 1.0f;
+
+const F32 VOLUME_SCALE_VIVOX = 0.01f;
+
+const F32 SPEAKING_TIMEOUT = 1.f;
+
+const int VOICE_MAJOR_VERSION = 1;
+const int VOICE_MINOR_VERSION = 0;
+
+LLVoiceClient *gVoiceClient = NULL;
+
+// Don't retry connecting to the daemon more frequently than this:
+const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
+
+// Don't send positional updates more frequently than this:
+const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
+
+const F32 LOGIN_RETRY_SECONDS = 10.0f;
+const int MAX_LOGIN_RETRIES = 12;
+
+// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
+// which is treated as normal. If this number is exceeded we suspect there is a problem with connection
+// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen 
+// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is 
+// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability.
+const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50;
+
+static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
+{
+	LLMD5 md5_uuid;
+	md5_uuid.update((const unsigned char*)str.data(), str.size());
+	md5_uuid.finalize();
+	md5_uuid.raw_digest(uuid.mData);
+}
+
+static int scale_mic_volume(float volume)
+{
+	// incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.
+	// Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70
+	return 30 + (int)(volume * 20.0f);
+}
+
+static int scale_speaker_volume(float volume)
+{
+	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.
+	// Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70
+	return 30 + (int)(volume * 40.0f);
+}
+
+class LLViewerVoiceAccountProvisionResponder :
+	public LLHTTPClient::Responder
+{
+public:
+	LLViewerVoiceAccountProvisionResponder(int retries)
+	{
+		mRetries = retries;
+	}
+
+	virtual void error(U32 status, const std::string& reason)
+	{
+		if ( mRetries > 0 )
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying.  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			if ( gVoiceClient ) gVoiceClient->requestVoiceAccountProvision(
+				mRetries - 1);
+		}
+		else
+		{
+			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up).  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
+			if ( gVoiceClient ) gVoiceClient->giveUp();
+		}
+	}
+
+	virtual void result(const LLSD& content)
+	{
+		if ( gVoiceClient )
+		{
+			std::string voice_sip_uri_hostname;
+			std::string voice_account_server_uri;
+			
+			LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+			
+			if(content.has("voice_sip_uri_hostname"))
+				voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
+			
+			// this key is actually misnamed -- it will be an entire URI, not just a hostname.
+			if(content.has("voice_account_server_name"))
+				voice_account_server_uri = content["voice_account_server_name"].asString();
+			
+			gVoiceClient->login(
+				content["username"].asString(),
+				content["password"].asString(),
+				voice_sip_uri_hostname,
+				voice_account_server_uri);
+		}
+	}
+
+private:
+	int mRetries;
+};
+
+/** 
+ * @class LLVivoxProtocolParser
+ * @brief This class helps construct new LLIOPipe specializations
+ * @see LLIOPipe
+ *
+ * THOROUGH_DESCRIPTION
+ */
+class LLVivoxProtocolParser : public LLIOPipe
+{
+	LOG_CLASS(LLVivoxProtocolParser);
+public:
+	LLVivoxProtocolParser();
+	virtual ~LLVivoxProtocolParser();
+
+protected:
+	/* @name LLIOPipe virtual implementations
+	 */
+	//@{
+	/** 
+	 * @brief Process the data in buffer
+	 */
+	virtual EStatus process_impl(
+		const LLChannelDescriptors& channels,
+		buffer_ptr_t& buffer,
+		bool& eos,
+		LLSD& context,
+		LLPumpIO* pump);
+	//@}
+	
+	std::string 	mInput;
+	
+	// Expat control members
+	XML_Parser		parser;
+	int				responseDepth;
+	bool			ignoringTags;
+	bool			isEvent;
+	int				ignoreDepth;
+
+	// Members for processing responses. The values are transient and only valid within a call to processResponse().
+	bool			squelchDebugOutput;
+	int				returnCode;
+	int				statusCode;
+	std::string		statusString;
+	std::string		requestId;
+	std::string		actionString;
+	std::string		connectorHandle;
+	std::string		versionID;
+	std::string		accountHandle;
+	std::string		sessionHandle;
+	std::string		sessionGroupHandle;
+	std::string		alias;
+	std::string		applicationString;
+
+	// Members for processing events. The values are transient and only valid within a call to processResponse().
+	std::string		eventTypeString;
+	int				state;
+	std::string		uriString;
+	bool			isChannel;
+	bool			incoming;
+	bool			enabled;
+	std::string		nameString;
+	std::string		audioMediaString;
+	std::string		displayNameString;
+	std::string		deviceString;
+	int				participantType;
+	bool			isLocallyMuted;
+	bool			isModeratorMuted;
+	bool			isSpeaking;
+	int				volume;
+	F32				energy;
+	std::string		messageHeader;
+	std::string		messageBody;
+	std::string		notificationType;
+	bool			hasText;
+	bool			hasAudio;
+	bool			hasVideo;
+	bool			terminated;
+	std::string		blockMask;
+	std::string		presenceOnly;
+	std::string		autoAcceptMask;
+	std::string		autoAddAsBuddy;
+	int				numberOfAliases;
+	std::string		subscriptionHandle;
+	std::string		subscriptionType;
+		
+
+	// Members for processing text between tags
+	std::string		textBuffer;
+	bool			accumulateText;
+	
+	void			reset();
+
+	void			processResponse(std::string tag);
+
+static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
+static void XMLCALL ExpatEndTag(void *data, const char *el);
+static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
+
+	void			StartTag(const char *tag, const char **attr);
+	void			EndTag(const char *tag);
+	void			CharData(const char *buffer, int length);
+	
+};
+
+LLVivoxProtocolParser::LLVivoxProtocolParser()
+{
+	parser = NULL;
+	parser = XML_ParserCreate(NULL);
+	
+	reset();
+}
+
+void LLVivoxProtocolParser::reset()
+{
+	responseDepth = 0;
+	ignoringTags = false;
+	accumulateText = false;
+	energy = 0.f;
+	hasText = false;
+	hasAudio = false;
+	hasVideo = false;
+	terminated = false;
+	ignoreDepth = 0;
+	isChannel = false;
+	incoming = false;
+	enabled = false;
+	isEvent = false;
+	isLocallyMuted = false;
+	isModeratorMuted = false;
+	isSpeaking = false;
+	participantType = 0;
+	squelchDebugOutput = false;
+	returnCode = -1;
+	state = 0;
+	statusCode = 0;
+	volume = 0;
+	textBuffer.clear();
+	alias.clear();
+	numberOfAliases = 0;
+	applicationString.clear();
+}
+
+//virtual 
+LLVivoxProtocolParser::~LLVivoxProtocolParser()
+{
+	if (parser)
+		XML_ParserFree(parser);
+}
+
+// virtual
+LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
+	const LLChannelDescriptors& channels,
+	buffer_ptr_t& buffer,
+	bool& eos,
+	LLSD& context,
+	LLPumpIO* pump)
+{
+	LLBufferStream istr(channels, buffer.get());
+	std::ostringstream ostr;
+	while (istr.good())
+	{
+		char buf[1024];
+		istr.read(buf, sizeof(buf));
+		mInput.append(buf, istr.gcount());
+	}
+	
+	// Look for input delimiter(s) in the input buffer.  If one is found, send the message to the xml parser.
+	int start = 0;
+	int delim;
+	while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
+	{	
+		
+		// Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
+		reset();
+		
+		XML_ParserReset(parser, NULL);
+		XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
+		XML_SetCharacterDataHandler(parser, ExpatCharHandler);
+		XML_SetUserData(parser, this);	
+		XML_Parse(parser, mInput.data() + start, delim - start, false);
+		
+		// If this message isn't set to be squelched, output the raw XML received.
+		if(!squelchDebugOutput)
+		{
+			LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
+		}
+		
+		start = delim + 3;
+	}
+	
+	if(start != 0)
+		mInput = mInput.substr(start);
+
+	LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
+	
+	if(!gVoiceClient->mConnected)
+	{
+		// If voice has been disabled, we just want to close the socket.  This does so.
+		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
+		return STATUS_STOP;
+	}
+	
+	return STATUS_OK;
+}
+
+void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->StartTag(el, attr);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->EndTag(el);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
+{
+	if (data)
+	{
+		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
+		object->CharData(s, len);
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+
+void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
+{
+	// Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
+	textBuffer.clear();
+	// only accumulate text if we're not ignoring tags.
+	accumulateText = !ignoringTags;
+	
+	if (responseDepth == 0)
+	{	
+		isEvent = !stricmp("Event", tag);
+		
+		if (!stricmp("Response", tag) || isEvent)
+		{
+			// Grab the attributes
+			while (*attr)
+			{
+				const char	*key = *attr++;
+				const char	*value = *attr++;
+				
+				if (!stricmp("requestId", key))
+				{
+					requestId = value;
+				}
+				else if (!stricmp("action", key))
+				{
+					actionString = value;
+				}
+				else if (!stricmp("type", key))
+				{
+					eventTypeString = value;
+				}
+			}
+		}
+		LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
+	}
+	else
+	{
+		if (ignoringTags)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
+	
+			// Ignore the InputXml stuff so we don't get confused
+			if (!stricmp("InputXml", tag))
+			{
+				ignoringTags = true;
+				ignoreDepth = responseDepth;
+				accumulateText = false;
+
+				LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
+			}
+			else if (!stricmp("CaptureDevices", tag))
+			{
+				gVoiceClient->clearCaptureDevices();
+			}
+			else if (!stricmp("RenderDevices", tag))
+			{
+				gVoiceClient->clearRenderDevices();
+			}
+			else if (!stricmp("CaptureDevice", tag))
+			{
+				deviceString.clear();
+			}
+			else if (!stricmp("RenderDevice", tag))
+			{
+				deviceString.clear();
+			}
+			else if (!stricmp("Buddies", tag))
+			{
+				gVoiceClient->deleteAllBuddies();
+			}
+			else if (!stricmp("BlockRules", tag))
+			{
+				gVoiceClient->deleteAllBlockRules();
+			}
+			else if (!stricmp("AutoAcceptRules", tag))
+			{
+				gVoiceClient->deleteAllAutoAcceptRules();
+			}
+			
+		}
+	}
+	responseDepth++;
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::EndTag(const char *tag)
+{
+	const std::string& string = textBuffer;
+
+	responseDepth--;
+
+	if (ignoringTags)
+	{
+		if (ignoreDepth == responseDepth)
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
+			ignoringTags = false;
+		}
+		else
+		{
+			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+		}
+	}
+	
+	if (!ignoringTags)
+	{
+		LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
+
+		// Closing a tag. Finalize the text we've accumulated and reset
+		if (!stricmp("ReturnCode", tag))
+			returnCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("SessionHandle", tag))
+			sessionHandle = string;
+		else if (!stricmp("SessionGroupHandle", tag))
+			sessionGroupHandle = string;
+		else if (!stricmp("StatusCode", tag))
+			statusCode = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("StatusString", tag))
+			statusString = string;
+		else if (!stricmp("ParticipantURI", tag))
+			uriString = string;
+		else if (!stricmp("Volume", tag))
+			volume = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Energy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("IsModeratorMuted", tag))
+			isModeratorMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("IsSpeaking", tag))
+			isSpeaking = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Alias", tag))
+			alias = string;
+		else if (!stricmp("NumberOfAliases", tag))
+			numberOfAliases = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("Application", tag))
+			applicationString = string;
+		else if (!stricmp("ConnectorHandle", tag))
+			connectorHandle = string;
+		else if (!stricmp("VersionID", tag))
+			versionID = string;
+		else if (!stricmp("AccountHandle", tag))
+			accountHandle = string;
+		else if (!stricmp("State", tag))
+			state = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("URI", tag))
+			uriString = string;
+		else if (!stricmp("IsChannel", tag))
+			isChannel = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Incoming", tag))
+			incoming = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Enabled", tag))
+			enabled = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Name", tag))
+			nameString = string;
+		else if (!stricmp("AudioMedia", tag))
+			audioMediaString = string;
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("DisplayName", tag))
+			displayNameString = string;
+		else if (!stricmp("Device", tag))
+			deviceString = string;
+		else if (!stricmp("AccountName", tag))
+			nameString = string;
+		else if (!stricmp("ParticipantType", tag))
+			participantType = strtol(string.c_str(), NULL, 10);
+		else if (!stricmp("IsLocallyMuted", tag))
+			isLocallyMuted = !stricmp(string.c_str(), "true");
+		else if (!stricmp("MicEnergy", tag))
+			energy = (F32)strtod(string.c_str(), NULL);
+		else if (!stricmp("ChannelName", tag))
+			nameString = string;
+		else if (!stricmp("ChannelURI", tag))
+			uriString = string;
+		else if (!stricmp("BuddyURI", tag))
+			uriString = string;
+		else if (!stricmp("Presence", tag))
+			statusString = string;
+		else if (!stricmp("CaptureDevice", tag))
+		{
+			gVoiceClient->addCaptureDevice(deviceString);
+		}
+		else if (!stricmp("RenderDevice", tag))
+		{
+			gVoiceClient->addRenderDevice(deviceString);
+		}
+		else if (!stricmp("Buddy", tag))
+		{
+			gVoiceClient->processBuddyListEntry(uriString, displayNameString);
+		}
+		else if (!stricmp("BlockRule", tag))
+		{
+			gVoiceClient->addBlockRule(blockMask, presenceOnly);
+		}
+		else if (!stricmp("BlockMask", tag))
+			blockMask = string;
+		else if (!stricmp("PresenceOnly", tag))
+			presenceOnly = string;
+		else if (!stricmp("AutoAcceptRule", tag))
+		{
+			gVoiceClient->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
+		}
+		else if (!stricmp("AutoAcceptMask", tag))
+			autoAcceptMask = string;
+		else if (!stricmp("AutoAddAsBuddy", tag))
+			autoAddAsBuddy = string;
+		else if (!stricmp("MessageHeader", tag))
+			messageHeader = string;
+		else if (!stricmp("MessageBody", tag))
+			messageBody = string;
+		else if (!stricmp("NotificationType", tag))
+			notificationType = string;
+		else if (!stricmp("HasText", tag))
+			hasText = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasAudio", tag))
+			hasAudio = !stricmp(string.c_str(), "true");
+		else if (!stricmp("HasVideo", tag))
+			hasVideo = !stricmp(string.c_str(), "true");
+		else if (!stricmp("Terminated", tag))
+			terminated = !stricmp(string.c_str(), "true");
+		else if (!stricmp("SubscriptionHandle", tag))
+			subscriptionHandle = string;
+		else if (!stricmp("SubscriptionType", tag))
+			subscriptionType = string;
+		
+		textBuffer.clear();
+		accumulateText= false;
+		
+		if (responseDepth == 0)
+		{
+			// We finished all of the XML, process the data
+			processResponse(tag);
+		}
+	}
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::CharData(const char *buffer, int length)
+{
+	/*
+		This method is called for anything that isn't a tag, which can be text you
+		want that lies between tags, and a lot of stuff you don't want like file formatting
+		(tabs, spaces, CR/LF, etc).
+		
+		Only copy text if we are in accumulate mode...
+	*/
+	if (accumulateText)
+		textBuffer.append(buffer, length);
+}
+
+// --------------------------------------------------------------------------------
+
+void LLVivoxProtocolParser::processResponse(std::string tag)
+{
+	LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
+
+	// SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success.  This is a change vs. previous SDKs.
+	// According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
+	// so I believe this will give correct behavior.
+	
+	if(returnCode == 0)
+		statusCode = 0;
+		
+	if (isEvent)
+	{
+		const char *eventTypeCstr = eventTypeString.c_str();
+		if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
+		{
+			gVoiceClient->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
+		{
+			/*
+			<Event type="SessionAddedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
+				<IsChannel>true</IsChannel>
+				<Incoming>false</Incoming>
+				<ChannelName />
+			</Event>
+			*/
+			gVoiceClient->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
+		{
+			gVoiceClient->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
+		{
+			gVoiceClient->sessionGroupAddedEvent(sessionGroupHandle);
+		}
+		else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
+		{
+			/*
+			<Event type="MediaStreamUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<StatusCode>200</StatusCode>
+				<StatusString>OK</StatusString>
+				<State>2</State>
+				<Incoming>false</Incoming>
+			</Event>
+			*/
+			gVoiceClient->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
+		}		
+		else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
+		{
+			/*
+			<Event type="TextStreamUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
+				<Enabled>true</Enabled>
+				<State>1</State>
+				<Incoming>true</Incoming>
+			</Event>
+			*/
+			gVoiceClient->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
+		{
+			/* 
+			<Event type="ParticipantAddedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+				<ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
+				<AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
+				<DisplayName />
+				<ParticipantType>0</ParticipantType>
+			</Event>
+			*/
+			gVoiceClient->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
+		{
+			/*
+			<Event type="ParticipantRemovedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
+				<ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
+				<AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
+			</Event>
+			*/
+			gVoiceClient->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
+		}
+		else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
+		{
+			/*
+			<Event type="ParticipantUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
+				<IsModeratorMuted>false</IsModeratorMuted>
+				<IsSpeaking>true</IsSpeaking>
+				<Volume>44</Volume>
+				<Energy>0.0879437</Energy>
+			</Event>
+			*/
+			
+			// These happen so often that logging them is pretty useless.
+			squelchDebugOutput = true;
+			
+			gVoiceClient->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
+		}
+		else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
+		{
+			gVoiceClient->auxAudioPropertiesEvent(energy);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
+		{
+			gVoiceClient->buddyPresenceEvent(uriString, alias, statusString, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
+		{
+			// The buddy list was updated during parsing.
+			// Need to recheck against the friends list.
+			gVoiceClient->buddyListChanged();
+		}
+		else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
+		{
+			/*
+			<Event type="BuddyChangedEvent">
+				<AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
+				<BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
+				<DisplayName>Monroe Tester</DisplayName>
+				<BuddyData />
+				<GroupID>0</GroupID>
+				<ChangeType>Set</ChangeType>
+			</Event>
+			*/		
+			// TODO: Question: Do we need to process this at all?
+		}
+		else if (!stricmp(eventTypeCstr, "MessageEvent"))  
+		{
+			gVoiceClient->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))  
+		{
+			gVoiceClient->sessionNotificationEvent(sessionHandle, uriString, notificationType);
+		}
+		else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))  
+		{
+			gVoiceClient->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
+		}
+		else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))  
+		{
+			/*
+			<Event type="SessionUpdatedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+				<SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
+				<Uri>sip:confctl-9@bhd.vivox.com</Uri>
+				<IsMuted>0</IsMuted>
+				<Volume>50</Volume>
+				<TransmitEnabled>1</TransmitEnabled>
+				<IsFocused>0</IsFocused>
+				<SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
+				<SessionFontID>0</SessionFontID>
+			</Event>
+			*/
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		
+		else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))  
+		{
+			/*
+			<Event type="SessionGroupRemovedEvent">
+				<SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
+			</Event>
+			*/
+			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
+		}
+		else
+		{
+			LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
+		}
+	}
+	else
+	{
+		const char *actionCstr = actionString.c_str();
+		if (!stricmp(actionCstr, "Connector.Create.1"))
+		{
+			gVoiceClient->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
+		}
+		else if (!stricmp(actionCstr, "Account.Login.1"))
+		{
+			gVoiceClient->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
+		}
+		else if (!stricmp(actionCstr, "Session.Create.1"))
+		{
+			gVoiceClient->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
+		{
+			gVoiceClient->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);			
+		}
+		else if (!stricmp(actionCstr, "Session.Connect.1"))
+		{
+			gVoiceClient->sessionConnectResponse(requestId, statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.Logout.1"))
+		{
+			gVoiceClient->logoutResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
+		{
+			gVoiceClient->connectorShutdownResponse(statusCode, statusString);			
+		}
+		else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
+		{
+			gVoiceClient->accountListBlockRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
+		{
+			gVoiceClient->accountListAutoAcceptRulesResponse(statusCode, statusString);						
+		}
+		else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
+		{
+			// We don't need to process these, but they're so spammy we don't want to log them.
+			squelchDebugOutput = true;
+		}
+/*
+		else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
+		{
+			gVoiceClient->channelGetListResponse(statusCode, statusString);
+		}
+		else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
+		{
+			
+		}
+		else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
+		{
+			
+		}
+*/
+	}
+}
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVoiceClientMuteListObserver : public LLMuteListObserver
+{
+	/* virtual */ void onChange()  { gVoiceClient->muteListChanged();}
+};
+
+class LLVoiceClientFriendsObserver : public LLFriendObserver
+{
+public:
+	/* virtual */ void changed(U32 mask) { gVoiceClient->updateFriends(mask);}
+};
+
+static LLVoiceClientMuteListObserver mutelist_listener;
+static bool sMuteListListener_listening = false;
+
+static LLVoiceClientFriendsObserver *friendslist_listener = NULL;
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+class LLVoiceClientCapResponder : public LLHTTPClient::Responder
+{
+public:
+	LLVoiceClientCapResponder(void){};
+
+	virtual void error(U32 status, const std::string& reason);	// called with bad status codes
+	virtual void result(const LLSD& content);
+
+private:
+};
+
+void LLVoiceClientCapResponder::error(U32 status, const std::string& reason)
+{
+	LL_WARNS("Voice") << "LLVoiceClientCapResponder::error("
+		<< status << ": " << reason << ")"
+		<< LL_ENDL;
+}
+
+void LLVoiceClientCapResponder::result(const LLSD& content)
+{
+	LLSD::map_const_iterator iter;
+	
+	LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
+
+	if ( content.has("voice_credentials") )
+	{
+		LLSD voice_credentials = content["voice_credentials"];
+		std::string uri;
+		std::string credentials;
+
+		if ( voice_credentials.has("channel_uri") )
+		{
+			uri = voice_credentials["channel_uri"].asString();
+		}
+		if ( voice_credentials.has("channel_credentials") )
+		{
+			credentials =
+				voice_credentials["channel_credentials"].asString();
+		}
+
+		gVoiceClient->setSpatialChannel(uri, credentials);
+	}
+}
+
+
+
+#if LL_WINDOWS
+static HANDLE sGatewayHandle = 0;
+
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayHandle != 0)		
+	{
+		DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
+		if(waitresult != WAIT_OBJECT_0)
+		{
+			result = true;
+		}			
+	}
+	return result;
+}
+static void killGateway()
+{
+	if(sGatewayHandle != 0)
+	{
+		TerminateProcess(sGatewayHandle,0);
+	}
+}
+
+#else // Mac and linux
+
+static pid_t sGatewayPID = 0;
+static bool isGatewayRunning()
+{
+	bool result = false;
+	if(sGatewayPID != 0)
+	{
+		// A kill with signal number 0 has no effect, just does error checking.  It should return an error if the process no longer exists.
+		if(kill(sGatewayPID, 0) == 0)
+		{
+			result = true;
+		}
+	}
+	return result;
+}
+
+static void killGateway()
+{
+	if(sGatewayPID != 0)
+	{
+		kill(sGatewayPID, SIGTERM);
+	}
+}
+
+#endif
+
+class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
+{
+	LOG_CLASS(LLSpeakerVolumeStorage);
+public:
+
+	/**
+	 * Stores volume level for specified user.
+	 *
+	 * @param[in] speaker_id - LLUUID of user to store volume level for.
+	 * @param[in] volume - volume level to be stored for user.
+	 */
+	void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
+
+	/**
+	 * Gets stored volume level for specified speaker
+	 *
+	 * @param[in] speaker_id - LLUUID of user to retrieve volume level for.
+	 * @param[out] volume - set to stored volume if found, otherwise unmodified.
+	 * @return - true if a stored volume is found.
+	 */
+	bool getSpeakerVolume(const LLUUID& speaker_id, F32& volume);
+
+	/**
+	 * Removes stored volume level for specified user.
+	 *
+	 * @param[in] speaker_id - LLUUID of user to remove.
+	 */
+	void removeSpeakerVolume(const LLUUID& speaker_id);
+
+private:
+	friend class LLSingleton<LLSpeakerVolumeStorage>;
+	LLSpeakerVolumeStorage();
+	~LLSpeakerVolumeStorage();
+
+	const static std::string SETTINGS_FILE_NAME;
+
+	void load();
+	void save();
+
+	static F32 transformFromLegacyVolume(F32 volume_in);
+	static F32 transformToLegacyVolume(F32 volume_in);
+
+	typedef std::map<LLUUID, F32> speaker_data_map_t;
+	speaker_data_map_t mSpeakersData;
+};
+
+const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
+
+LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
+{
+	load();
+}
+
+LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
+{
+	save();
+}
+
+void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
+{
+	if ((volume >= LLVoiceClient::VOLUME_MIN) && (volume <= LLVoiceClient::VOLUME_MAX))
+	{
+		mSpeakersData[speaker_id] = volume;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Stored volume = " << volume <<  " for " << id << LL_ENDL;
+	}
+	else
+	{
+		LL_WARNS("Voice") << "Attempted to store out of range volume " << volume << " for " << speaker_id << LL_ENDL;
+		llassert(0);
+	}
+}
+
+bool LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id, F32& volume)
+{
+	speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
+	
+	if (it != mSpeakersData.end())
+	{
+		volume = it->second;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "Retrieved stored volume = " << volume <<  " for " << id << LL_ENDL;
+
+		return true;
+	}
+
+	return false;
+}
+
+void LLSpeakerVolumeStorage::removeSpeakerVolume(const LLUUID& speaker_id)
+{
+	mSpeakersData.erase(speaker_id);
+
+	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+	// LL_DEBUGS("Voice") << "Removing stored volume for  " << id << LL_ENDL;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformFromLegacyVolume(F32 volume_in)
+{
+	// Convert to linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// from legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.5, volume_out = 0.56
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.5f)
+	{
+		volume_out = volume_in * volume_in * 4.f * 0.56f;
+	}
+	else
+	{
+		volume_out = (1.f - 0.56f) * (4.f * volume_in * volume_in - 1.f) / 3.f + 0.56f;
+	}
+
+	return volume_out;
+}
+
+/* static */ F32 LLSpeakerVolumeStorage::transformToLegacyVolume(F32 volume_in)
+{
+	// Convert from linear-logarithmic [0.0..1.0] with 0.5 = 0dB
+	// to legacy characteristic composed of two square-curves
+	// that intersect at volume_in = 0.56, volume_out = 0.5
+
+	F32 volume_out = 0.f;
+	volume_in = llclamp(volume_in, 0.f, 1.0f);
+
+	if (volume_in <= 0.56f)
+	{
+		volume_out = sqrt(volume_in / (4.f * 0.56f));
+	}
+	else
+	{
+		volume_out = sqrt((3.f * (volume_in - 0.56f) / (1.f - 0.56f) + 1.f) / 4.f);
+	}
+
+	return volume_out;
+}
+
+void LLSpeakerVolumeStorage::load()
+{
+	// load per-resident voice volume information
+	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+
+	LL_INFOS("Voice") << "Loading stored speaker volumes from: " << filename << LL_ENDL;
+
+	LLSD settings_llsd;
+	llifstream file;
+	file.open(filename);
+	if (file.is_open())
+	{
+		LLSDSerialize::fromXML(settings_llsd, file);
+	}
+
+	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
+		iter != settings_llsd.endMap(); ++iter)
+	{
+		// Maintain compatibility with 1.23 non-linear saved volume levels
+		F32 volume = transformFromLegacyVolume((F32)iter->second.asReal());
+
+		storeSpeakerVolume(LLUUID(iter->first), volume);
+	}
+}
+
+void LLSpeakerVolumeStorage::save()
+{
+	// If we quit from the login screen we will not have an SL account
+	// name.  Don't try to save, otherwise we'll dump a file in
+	// C:\Program Files\SecondLife\ or similar. JC
+	std::string user_dir = gDirUtilp->getLindenUserDir();
+	if (!user_dir.empty())
+	{
+		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
+		LLSD settings_llsd;
+
+		LL_INFOS("Voice") << "Saving stored speaker volumes to: " << filename << LL_ENDL;
+
+		for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
+		{
+			// Maintain compatibility with 1.23 non-linear saved volume levels
+			F32 volume = transformToLegacyVolume(iter->second);
+
+			settings_llsd[iter->first.asString()] = volume;
+		}
+
+		llofstream file;
+		file.open(filename);
+		LLSDSerialize::toPrettyXML(settings_llsd, file);
+	}
+}
+
+
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+LLVoiceClient::LLVoiceClient() :
+	mState(stateDisabled),
+	mSessionTerminateRequested(false),
+	mRelogRequested(false),
+	mConnected(false),
+	mPump(NULL),
+	mSpatialJoiningNum(0),
+	
+	mTuningMode(false),
+	mTuningEnergy(0.0f),
+	mTuningMicVolume(0),
+	mTuningMicVolumeDirty(true),
+	mTuningSpeakerVolume(0),
+	mTuningSpeakerVolumeDirty(true),
+	mTuningExitState(stateDisabled),
+	
+	mAreaVoiceDisabled(false),
+	mAudioSession(NULL),
+	mAudioSessionChanged(false),
+	mNextAudioSession(NULL),
+	
+	mCurrentParcelLocalID(0),
+	mNumberOfAliases(0),
+	mCommandCookie(0),
+	mLoginRetryCount(0),
+	
+	mBuddyListMapPopulated(false),
+	mBlockRulesListReceived(false),
+	mAutoAcceptRulesListReceived(false),
+	mCaptureDeviceDirty(false),
+	mRenderDeviceDirty(false),
+	mSpatialCoordsDirty(false),
+
+	mPTTDirty(true),
+	mPTT(true),
+	mUsePTT(true),
+	mPTTIsMiddleMouse(false),
+	mPTTKey(0),
+	mPTTIsToggle(false),
+	mUserPTTState(false),
+	mMuteMic(false),
+	mFriendsListDirty(true),
+	
+	mEarLocation(0),
+	mSpeakerVolumeDirty(true),
+	mSpeakerMuteDirty(true),
+	mMicVolume(0),
+	mMicVolumeDirty(true),
+	
+	mVoiceEnabled(false),
+	mWriteInProgress(false),
+	
+	mLipSyncEnabled(false)
+{	
+	gVoiceClient = this;
+	
+	mAPIVersion = LLTrans::getString("NotConnected");
+
+	mSpeakerVolume = scale_speaker_volume(0);
+	
+#if LL_DARWIN || LL_LINUX || LL_SOLARIS
+		// HACK: THIS DOES NOT BELONG HERE
+		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
+		// This should cause us to ignore SIGPIPE and handle the error through proper channels.
+		// This should really be set up elsewhere.  Where should it go?
+		signal(SIGPIPE, SIG_IGN);
+		
+		// Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
+		// Ignoring SIGCHLD should prevent zombies from being created.  Alternately, we could use wait(), but I'd rather not do that.
+		signal(SIGCHLD, SIG_IGN);
+#endif
+
+	// set up state machine
+	setState(stateDisabled);
+	
+	gIdleCallbacks.addFunction(idle, this);
+}
+
+//---------------------------------------------------
+
+LLVoiceClient::~LLVoiceClient()
+{
+}
+
+//----------------------------------------------
+
+void LLVoiceClient::init(LLPumpIO *pump)
+{
+	// constructor will set up gVoiceClient
+	LLVoiceClient::getInstance()->mPump = pump;
+	LLVoiceClient::getInstance()->updateSettings();
+}
+
+void LLVoiceClient::terminate()
+{
+	if(gVoiceClient)
+	{
+//		gVoiceClient->leaveAudioSession();
+		gVoiceClient->logout();
+		// As of SDK version 4885, this should no longer be necessary.  It will linger after the socket close if it needs to.
+		// ms_sleep(2000);
+		gVoiceClient->connectorShutdown();
+		gVoiceClient->closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
+		
+		// This will do unpleasant things on windows.
+//		killGateway();
+		
+		// Don't do this anymore -- LLSingleton will take care of deleting the object.		
+//		delete gVoiceClient;
+		
+		// Hint to other code not to access the voice client anymore.
+		gVoiceClient = NULL;
+	}
+}
+
+//---------------------------------------------------
+
+void LLVoiceClient::updateSettings()
+{
+	setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
+	setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
+	std::string keyString = gSavedSettings.getString("PushToTalkButton");
+	setPTTKey(keyString);
+	setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
+	setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
+
+	std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
+	setCaptureDevice(inputDevice);
+	std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
+	setRenderDevice(outputDevice);
+	F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
+	setMicGain(mic_level);
+	setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
+}
+
+/////////////////////////////
+// utility functions
+
+bool LLVoiceClient::writeString(const std::string &str)
+{
+	bool result = false;
+	if(mConnected)
+	{
+		apr_status_t err;
+		apr_size_t size = (apr_size_t)str.size();
+		apr_size_t written = size;
+	
+		//MARK: Turn this on to log outgoing XML
+//		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
+
+		// check return code - sockets will fail (broken, etc.)
+		err = apr_socket_send(
+				mSocket->getSocket(),
+				(const char*)str.data(),
+				&written);
+		
+		if(err == 0)
+		{
+			// Success.
+			result = true;
+		}
+		// TODO: handle partial writes (written is number of bytes written)
+		// Need to set socket to non-blocking before this will work.
+//		else if(APR_STATUS_IS_EAGAIN(err))
+//		{
+//			// 
+//		}
+		else
+		{
+			// Assume any socket error means something bad.  For now, just close the socket.
+			char buf[MAX_STRING];
+			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
+			daemonDied();
+		}
+	}
+		
+	return result;
+}
+
+
+/////////////////////////////
+// session control messages
+void LLVoiceClient::connectorCreate()
+{
+	std::ostringstream stream;
+	std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
+	std::string loglevel = "0";
+	
+	// Transition to stateConnectorStarted when the connector handle comes back.
+	setState(stateConnectorStarting);
+
+	std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
+		
+	if(savedLogLevel != "-1")
+	{
+		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
+		loglevel = "10";
+	}
+	
+	stream 
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
+		<< "<ClientName>V2 SDK</ClientName>"
+		<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
+		<< "<Mode>Normal</Mode>"
+		<< "<Logging>"
+			<< "<Folder>" << logpath << "</Folder>"
+			<< "<FileNamePrefix>Connector</FileNamePrefix>"
+			<< "<FileNameSuffix>.log</FileNameSuffix>"
+			<< "<LogLevel>" << loglevel << "</LogLevel>"
+		<< "</Logging>"
+		<< "<Application>SecondLifeViewer.1</Application>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::connectorShutdown()
+{
+	setState(stateConnectorStopping);
+	
+	if(!mConnectorHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mConnectorHandle.clear();
+		
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::userAuthorized(const std::string& firstName, const std::string& lastName, const LLUUID &agentID)
+{
+	mAccountFirstName = firstName;
+	mAccountLastName = lastName;
+
+	mAccountDisplayName = firstName;
+	mAccountDisplayName += " ";
+	mAccountDisplayName += lastName;
+
+	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
+
+	sConnectingToAgni = LLViewerLogin::getInstance()->isInProductionGrid();
+
+	mAccountName = nameFromID(agentID);
+}
+
+void LLVoiceClient::requestVoiceAccountProvision(S32 retries)
+{
+	if ( gAgent.getRegion() && mVoiceEnabled )
+	{
+		std::string url = 
+			gAgent.getRegion()->getCapability(
+				"ProvisionVoiceAccountRequest");
+
+		if ( url == "" ) return;
+
+		LLHTTPClient::post(
+			url,
+			LLSD(),
+			new LLViewerVoiceAccountProvisionResponder(retries));
+	}
+}
+
+void LLVoiceClient::login(
+	const std::string& account_name,
+	const std::string& password,
+	const std::string& voice_sip_uri_hostname,
+	const std::string& voice_account_server_uri)
+{
+	mVoiceSIPURIHostName = voice_sip_uri_hostname;
+	mVoiceAccountServerURI = voice_account_server_uri;
+
+	if(!mAccountHandle.empty())
+	{
+		// Already logged in.
+		LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
+		
+		// Don't process another login.
+		return;
+	}
+	else if ( account_name != mAccountName )
+	{
+		//TODO: error?
+		LL_WARNS("Voice") << "Wrong account name! " << account_name
+				<< " instead of " << mAccountName << LL_ENDL;
+	}
+	else
+	{
+		mAccountPassword = password;
+	}
+
+	std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
+	
+	if( !debugSIPURIHostName.empty() )
+	{
+		mVoiceSIPURIHostName = debugSIPURIHostName;
+	}
+	
+	if( mVoiceSIPURIHostName.empty() )
+	{
+		// we have an empty account server name
+		// so we fall back to hardcoded defaults
+
+		if(sConnectingToAgni)
+		{
+			// Use the release account server
+			mVoiceSIPURIHostName = "bhr.vivox.com";
+		}
+		else
+		{
+			// Use the development account server
+			mVoiceSIPURIHostName = "bhd.vivox.com";
+		}
+	}
+	
+	std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
+
+	if( !debugAccountServerURI.empty() )
+	{
+		mVoiceAccountServerURI = debugAccountServerURI;
+	}
+	
+	if( mVoiceAccountServerURI.empty() )
+	{
+		// If the account server URI isn't specified, construct it from the SIP URI hostname
+		mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";		
+	}
+}
+
+void LLVoiceClient::idle(void* user_data)
+{
+	LLVoiceClient* self = (LLVoiceClient*)user_data;
+	self->stateMachine();
+}
+
+std::string LLVoiceClient::state2string(LLVoiceClient::state inState)
+{
+	std::string result = "UNKNOWN";
+	
+		// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
+
+	switch(inState)
+	{
+		CASE(stateDisableCleanup);
+		CASE(stateDisabled);
+		CASE(stateStart);
+		CASE(stateDaemonLaunched);
+		CASE(stateConnecting);
+		CASE(stateConnected);
+		CASE(stateIdle);
+		CASE(stateMicTuningStart);
+		CASE(stateMicTuningRunning);
+		CASE(stateMicTuningStop);
+		CASE(stateConnectorStart);
+		CASE(stateConnectorStarting);
+		CASE(stateConnectorStarted);
+		CASE(stateLoginRetry);
+		CASE(stateLoginRetryWait);
+		CASE(stateNeedsLogin);
+		CASE(stateLoggingIn);
+		CASE(stateLoggedIn);
+		CASE(stateCreatingSessionGroup);
+		CASE(stateNoChannel);
+		CASE(stateJoiningSession);
+		CASE(stateSessionJoined);
+		CASE(stateRunning);
+		CASE(stateLeavingSession);
+		CASE(stateSessionTerminated);
+		CASE(stateLoggingOut);
+		CASE(stateLoggedOut);
+		CASE(stateConnectorStopping);
+		CASE(stateConnectorStopped);
+		CASE(stateConnectorFailed);
+		CASE(stateConnectorFailedWaiting);
+		CASE(stateLoginFailed);
+		CASE(stateLoginFailedWaiting);
+		CASE(stateJoinSessionFailed);
+		CASE(stateJoinSessionFailedWaiting);
+		CASE(stateJail);
+	}
+
+#undef CASE
+	
+	return result;
+}
+
+std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
+{
+	std::string result = "UNKNOWN";
+	
+		// Prevent copy-paste errors when updating this list...
+#define CASE(x)  case x:  result = #x;  break
+
+	switch(inStatus)
+	{
+		CASE(STATUS_LOGIN_RETRY);
+		CASE(STATUS_LOGGED_IN);
+		CASE(STATUS_JOINING);
+		CASE(STATUS_JOINED);
+		CASE(STATUS_LEFT_CHANNEL);
+		CASE(STATUS_VOICE_DISABLED);
+		CASE(STATUS_VOICE_ENABLED);
+		CASE(BEGIN_ERROR_STATUS);
+		CASE(ERROR_CHANNEL_FULL);
+		CASE(ERROR_CHANNEL_LOCKED);
+		CASE(ERROR_NOT_AVAILABLE);
+		CASE(ERROR_UNKNOWN);
+	default:
+		break;
+	}
+
+#undef CASE
+	
+	return result;
+}
+
+void LLVoiceClient::setState(state inState)
+{
+	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
+	
+	mState = inState;
+}
+
+void LLVoiceClient::stateMachine()
+{
+	if(gDisconnected)
+	{
+		// The viewer has been disconnected from the sim.  Disable voice.
+		setVoiceEnabled(false);
+	}
+	
+	if(mVoiceEnabled)
+	{
+		updatePosition();
+	}
+	else if(mTuningMode)
+	{
+		// Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
+	}
+	else
+	{
+		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
+		{
+			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
+			if(!mConnected)
+			{
+				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
+				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
+				killGateway();
+			}
+			
+			logout();
+			connectorShutdown();
+			
+			setState(stateDisableCleanup);
+		}
+	}
+	
+	// Check for parcel boundary crossing
+	{
+		LLViewerRegion *region = gAgent.getRegion();
+		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
+		
+		if(region && parcel)
+		{
+			S32 parcelLocalID = parcel->getLocalID();
+			std::string regionName = region->getName();
+			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
+		
+//			LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
+
+			// The region name starts out empty and gets filled in later.  
+			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
+			// If either is empty, wait for the next time around.
+			if(!regionName.empty())
+			{
+				if(!capURI.empty())
+				{
+					if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
+					{
+						// We have changed parcels.  Initiate a parcel channel lookup.
+						mCurrentParcelLocalID = parcelLocalID;
+						mCurrentRegionName = regionName;
+						
+						parcelChanged();
+					}
+				}
+				else
+				{
+					LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability.  This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
+				}
+			}
+		}
+	}
+
+	switch(getState())
+	{
+		//MARK: stateDisableCleanup
+		case stateDisableCleanup:
+			// Clean up and reset everything. 
+			closeSocket();
+			deleteAllSessions();
+			deleteAllBuddies();		
+			
+			mConnectorHandle.clear();
+			mAccountHandle.clear();
+			mAccountPassword.clear();
+			mVoiceAccountServerURI.clear();
+			
+			setState(stateDisabled);	
+		break;
+		
+		//MARK: stateDisabled
+		case stateDisabled:
+			if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
+			{
+				setState(stateStart);
+			}
+		break;
+		
+		//MARK: stateStart
+		case stateStart:
+			if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
+			{
+				// Voice is locked out, we must not launch the vivox daemon.
+				setState(stateJail);
+			}
+			else if(!isGatewayRunning())
+			{
+				if(true)
+				{
+					// Launch the voice daemon
+					
+					// *FIX:Mani - Using the executable dir instead 
+					// of mAppRODataDir, the working directory from which the app
+					// is launched.
+					//std::string exe_path = gDirUtilp->getAppRODataDir();
+					std::string exe_path = gDirUtilp->getExecutableDir();
+					exe_path += gDirUtilp->getDirDelimiter();
+#if LL_WINDOWS
+					exe_path += "SLVoice.exe";
+#elif LL_DARWIN
+					exe_path += "../Resources/SLVoice";
+#else
+					exe_path += "SLVoice";
+#endif
+					// See if the vivox executable exists
+					llstat s;
+					if(!LLFile::stat(exe_path, &s))
+					{
+						// vivox executable exists.  Build the command line and launch the daemon.
+						// SLIM SDK: these arguments are no longer necessary.
+//						std::string args = " -p tcp -h -c";
+						std::string args;
+						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
+						
+						if(loglevel.empty())
+						{
+							loglevel = "-1";	// turn logging off completely
+						}
+						
+						args += " -ll ";
+						args += loglevel;
+						
+						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
+
+#if LL_WINDOWS
+						PROCESS_INFORMATION pinfo;
+						STARTUPINFOW sinfo;
+						memset(&sinfo, 0, sizeof(sinfo));
+
+						std::string exe_dir = gDirUtilp->getExecutableDir();
+
+						llutf16string exe_path16 = utf8str_to_utf16str(exe_path);
+						llutf16string exe_dir16 = utf8str_to_utf16str(exe_dir);
+						llutf16string args16 = utf8str_to_utf16str(args);
+						// Create a writeable copy to keep Windows happy.
+						U16 *argscpy_16 = new U16[args16.size() + 1];
+						wcscpy_s(argscpy_16,args16.size()+1,args16.c_str());
+						if(!CreateProcessW(exe_path16.c_str(), argscpy_16, NULL, NULL, FALSE, 0, NULL, exe_dir16.c_str(), &sinfo, &pinfo))
+						{
+//							DWORD dwErr = GetLastError();
+						}
+						else
+						{
+							// foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
+							// CloseHandle(pinfo.hProcess); // stops leaks - nothing else
+							sGatewayHandle = pinfo.hProcess;
+							CloseHandle(pinfo.hThread); // stops leaks - nothing else
+						}		
+						
+						delete[] argscpy_16;
+#else	// LL_WINDOWS
+						// This should be the same for mac and linux
+						{
+							std::vector<std::string> arglist;
+							arglist.push_back(exe_path);
+							
+							// Split the argument string into separate strings for each argument
+							typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
+							boost::char_separator<char> sep(" ");
+							tokenizer tokens(args, sep);
+							tokenizer::iterator token_iter;
+
+							for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
+							{
+								arglist.push_back(*token_iter);
+							}
+							
+							// create an argv vector for the child process
+							char **fakeargv = new char*[arglist.size() + 1];
+							int i;
+							for(i=0; i < arglist.size(); i++)
+								fakeargv[i] = const_cast<char*>(arglist[i].c_str());
+
+							fakeargv[i] = NULL;
+							
+							fflush(NULL); // flush all buffers before the child inherits them
+							pid_t id = vfork();
+							if(id == 0)
+							{
+								// child
+								execv(exe_path.c_str(), fakeargv);
+								
+								// If we reach this point, the exec failed.
+								// Use _exit() instead of exit() per the vfork man page.
+								_exit(0);
+							}
+
+							// parent
+							delete[] fakeargv;
+							sGatewayPID = id;
+						}
+#endif	// LL_WINDOWS
+						mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost").c_str(), gSavedSettings.getU32("VoicePort"));
+					}	
+					else
+					{
+						LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
+					}	
+				}
+				else
+				{		
+					// SLIM SDK: port changed from 44124 to 44125.
+					// We can connect to a client gateway running on another host.  This is useful for testing.
+					// To do this, launch the gateway on a nearby host like this:
+					//  vivox-gw.exe -p tcp -i 0.0.0.0:44125
+					// and put that host's IP address here.
+					mDaemonHost = LLHost(gSavedSettings.getString("VoiceHost"), gSavedSettings.getU32("VoicePort"));
+				}
+
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				setState(stateDaemonLaunched);
+				
+				// Dirty the states we'll need to sync with the daemon when it comes up.
+				mPTTDirty = true;
+				mMicVolumeDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpeakerMuteDirty = true;
+				// These only need to be set if they're not default (i.e. empty string).
+				mCaptureDeviceDirty = !mCaptureDevice.empty();
+				mRenderDeviceDirty = !mRenderDevice.empty();
+				
+				mMainSessionGroupHandle.clear();
+			}
+		break;
+
+		//MARK: stateDaemonLaunched
+		case stateDaemonLaunched:
+			if(mUpdateTimer.hasExpired())
+			{
+				LL_DEBUGS("Voice") << "Connecting to vivox daemon" << LL_ENDL;
+
+				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
+
+				if(!mSocket)
+				{
+					mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);	
+				}
+				
+				mConnected = mSocket->blockingConnect(mDaemonHost);
+				if(mConnected)
+				{
+					setState(stateConnecting);
+				}
+				else
+				{
+					// If the connect failed, the socket may have been put into a bad state.  Delete it.
+					closeSocket();
+				}
+			}
+		break;
+
+		//MARK: stateConnecting
+		case stateConnecting:
+		// Can't do this until we have the pump available.
+		if(mPump)
+		{
+			// MBW -- Note to self: pumps and pipes examples in
+			//  indra/test/io.cpp
+			//  indra/test/llpipeutil.{cpp|h}
+
+			// Attach the pumps and pipes
+				
+			LLPumpIO::chain_t readChain;
+
+			readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
+			readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
+
+			mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
+
+			setState(stateConnected);
+		}
+
+		break;
+		
+		//MARK: stateConnected
+		case stateConnected:
+			// Initial devices query
+			getCaptureDevicesSendMessage();
+			getRenderDevicesSendMessage();
+
+			mLoginRetryCount = 0;
+
+			setState(stateIdle);
+		break;
+
+		//MARK: stateIdle
+		case stateIdle:
+			// This is the idle state where we're connected to the daemon but haven't set up a connector yet.
+			if(mTuningMode)
+			{
+				mTuningExitState = stateIdle;
+				setState(stateMicTuningStart);
+			}
+			else if(!mVoiceEnabled)
+			{
+				// We never started up the connector.  This will shut down the daemon.
+				setState(stateConnectorStopped);
+			}
+			else if(!mAccountName.empty())
+			{
+				LLViewerRegion *region = gAgent.getRegion();
+				
+				if(region)
+				{
+					if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
+					{
+						if ( mAccountPassword.empty() )
+						{
+							requestVoiceAccountProvision();
+						}
+						setState(stateConnectorStart);
+					}
+					else
+					{
+						LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
+					}
+				}
+			}
+		break;
+
+		//MARK: stateMicTuningStart
+		case stateMicTuningStart:
+			if(mUpdateTimer.hasExpired())
+			{
+				if(mCaptureDeviceDirty || mRenderDeviceDirty)
+				{
+					// These can't be changed while in tuning mode.  Set them before starting.
+					std::ostringstream stream;
+					
+					buildSetCaptureDevice(stream);
+					buildSetRenderDevice(stream);
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}				
+
+					// This will come around again in the same state and start the capture, after the timer expires.
+					mUpdateTimer.start();
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+				}
+				else
+				{
+					// duration parameter is currently unused, per Mike S.
+					tuningCaptureStartSendMessage(10000);
+
+					setState(stateMicTuningRunning);
+				}
+			}
+			
+		break;
+		
+		//MARK: stateMicTuningRunning
+		case stateMicTuningRunning:
+			if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
+			{
+				// All of these conditions make us leave tuning mode.
+				setState(stateMicTuningStop);
+			}
+			else
+			{
+				// process mic/speaker volume changes
+				if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
+				{
+					std::ostringstream stream;
+					
+					if(mTuningMicVolumeDirty)
+					{
+						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
+						<< "<Level>" << mTuningMicVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					if(mTuningSpeakerVolumeDirty)
+					{
+						stream
+						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
+						<< "<Level>" << mTuningSpeakerVolume << "</Level>"
+						<< "</Request>\n\n\n";
+					}
+					
+					mTuningMicVolumeDirty = false;
+					mTuningSpeakerVolumeDirty = false;
+
+					if(!stream.str().empty())
+					{
+						writeString(stream.str());
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateMicTuningStop
+		case stateMicTuningStop:
+		{
+			// transition out of mic tuning
+			tuningCaptureStopSendMessage();
+			
+			setState(mTuningExitState);
+			
+			// if we exited just to change devices, this will keep us from re-entering too fast.
+			mUpdateTimer.start();
+			mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+			
+		}
+		break;
+												
+		//MARK: stateConnectorStart
+		case stateConnectorStart:
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else if(!mVoiceAccountServerURI.empty())
+			{
+				connectorCreate();
+			}
+		break;
+		
+		//MARK: stateConnectorStarting
+		case stateConnectorStarting:	// waiting for connector handle
+			// connectorCreateResponse() will transition from here to stateConnectorStarted.
+		break;
+		
+		//MARK: stateConnectorStarted
+		case stateConnectorStarted:		// connector handle received
+			if(!mVoiceEnabled)
+			{
+				// We were never logged in.  This will shut down the connector.
+				setState(stateLoggedOut);
+			}
+			else
+			{
+				// The connector is started.  Send a login message.
+				setState(stateNeedsLogin);
+			}
+		break;
+				
+		//MARK: stateLoginRetry
+		case stateLoginRetry:
+			if(mLoginRetryCount == 0)
+			{
+				// First retry -- display a message to the user
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
+			}
+			
+			mLoginRetryCount++;
+			
+			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
+			{
+				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
+				setState(stateLoginFailed);
+			}
+			else
+			{
+				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
+				setState(stateLoginRetryWait);
+			}
+		break;
+		
+		//MARK: stateLoginRetryWait
+		case stateLoginRetryWait:
+			if(mUpdateTimer.hasExpired())
+			{
+				setState(stateNeedsLogin);
+			}
+		break;
+		
+		//MARK: stateNeedsLogin
+		case stateNeedsLogin:
+			if(!mAccountPassword.empty())
+			{
+				setState(stateLoggingIn);
+				loginSendMessage();
+			}		
+		break;
+		
+		//MARK: stateLoggingIn
+		case stateLoggingIn:			// waiting for account handle
+			// loginResponse() will transition from here to stateLoggedIn.
+		break;
+		
+		//MARK: stateLoggedIn
+		case stateLoggedIn:				// account handle received
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
+
+			// request the current set of block rules (we'll need them when updating the friends list)
+			accountListBlockRulesSendMessage();
+			
+			// request the current set of auto-accept rules
+			accountListAutoAcceptRulesSendMessage();
+			
+			// Set up the mute list observer if it hasn't been set up already.
+			if((!sMuteListListener_listening))
+			{
+				LLMuteList::getInstance()->addObserver(&mutelist_listener);
+				sMuteListListener_listening = true;
+			}
+
+			// Set up the friends list observer if it hasn't been set up already.
+			if(friendslist_listener == NULL)
+			{
+				friendslist_listener = new LLVoiceClientFriendsObserver;
+				LLAvatarTracker::instance().addObserver(friendslist_listener);
+			}
+			
+			// Set the initial state of mic mute, local speaker volume, etc.
+			{
+				std::ostringstream stream;
+				
+				buildLocalAudioUpdates(stream);
+				
+				if(!stream.str().empty())
+				{
+					writeString(stream.str());
+				}
+			}
+			
+#if USE_SESSION_GROUPS			
+			// create the main session group
+			sessionGroupCreateSendMessage();
+			
+			setState(stateCreatingSessionGroup);
+#else
+			// Not using session groups -- skip the stateCreatingSessionGroup state.
+			setState(stateNoChannel);
+
+			// Initial kick-off of channel lookup logic
+			parcelChanged();		
+#endif
+		break;
+		
+		//MARK: stateCreatingSessionGroup
+		case stateCreatingSessionGroup:
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// TODO: Question: is this the right way out of this state
+				setState(stateSessionTerminated);
+			}
+			else if(!mMainSessionGroupHandle.empty())
+			{
+				setState(stateNoChannel);
+				
+				// Start looped recording (needed for "panic button" anti-griefing tool)
+				recordingLoopStart();
+
+				// Initial kick-off of channel lookup logic
+				parcelChanged();		
+			}
+		break;
+					
+		//MARK: stateNoChannel
+		case stateNoChannel:
+			
+			mSpatialJoiningNum = 0;
+			// Do this here as well as inside sendPositionalUpdate().  
+			// Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
+			sendFriendsListUpdates();
+			
+			if(mSessionTerminateRequested || !mVoiceEnabled)
+			{
+				// TODO: Question: Is this the right way out of this state?
+				setState(stateSessionTerminated);
+			}
+			else if(mTuningMode)
+			{
+				mTuningExitState = stateNoChannel;
+				setState(stateMicTuningStart);
+			}
+			else if(sessionNeedsRelog(mNextAudioSession))
+			{
+				requestRelog();
+				setState(stateSessionTerminated);
+			}
+			else if(mNextAudioSession)
+			{				
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = mNextAudioSession;
+				if(!mAudioSession->mReconnect)	
+				{
+					mNextAudioSession = NULL;
+				}
+				
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+				
+				if(!mAudioSession->mHandle.empty())
+				{
+					// Connect to a session by session handle
+
+					sessionMediaConnectSendMessage(mAudioSession);
+				}
+				else
+				{
+					// Connect to a session by URI
+					sessionCreateSendMessage(mAudioSession, true, false);
+				}
+
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
+				setState(stateJoiningSession);
+			}
+			else if(!mSpatialSessionURI.empty())
+			{
+				// If we're not headed elsewhere and have a spatial URI, return to spatial.
+				switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+			}
+		break;
+
+		//MARK: stateJoiningSession
+		case stateJoiningSession:		// waiting for session handle
+
+			// If this is true we have problem with connection to voice server (EXT-4313).
+			// See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM.
+			if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM) 
+			{
+				// Notify observers to let them know there is problem with voice
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+				llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl;
+			}
+
+			// Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
+			// example for p2p many times while waiting for response, so it can't be used to detect errors
+			if(mAudioSession && mAudioSession->mIsSpatial)
+			{
+				mSpatialJoiningNum++;
+			}
+			
+			// joinedAudioSession() will transition from here to stateSessionJoined.
+			if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				if(mAudioSession && !mAudioSession->mHandle.empty())
+				{
+					// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+					// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+					if(mAudioSession->mIsP2P)
+					{
+						sessionMediaDisconnectSendMessage(mAudioSession);
+						setState(stateSessionTerminated);
+					}
+				}
+			}
+		break;
+		
+		//MARK: stateSessionJoined
+		case stateSessionJoined:		// session handle received
+			
+			mSpatialJoiningNum = 0;
+			// It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
+			// before continuing from this state.  They can happen in either order, and if I don't wait for both, things can get stuck.
+			// For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
+			// This is a cheap way to make sure both have happened before proceeding.
+			if(mAudioSession && mAudioSession->mVoiceEnabled)
+			{
+				// Dirty state that may need to be sync'ed with the daemon.
+				mPTTDirty = true;
+				mSpeakerVolumeDirty = true;
+				mSpatialCoordsDirty = true;
+				
+				setState(stateRunning);
+				
+				// Start the throttle timer
+				mUpdateTimer.start();
+				mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+
+				// Events that need to happen when a session is joined could go here.
+				// Maybe send initial spatial data?
+				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
+
+			}
+			else if(!mVoiceEnabled)
+			{
+				// User bailed out during connect -- jump straight to teardown.
+				setState(stateSessionTerminated);
+			}
+			else if(mSessionTerminateRequested)
+			{
+				// Only allow direct exits from this state in p2p calls (for cancelling an invite).
+				// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
+				if(mAudioSession && mAudioSession->mIsP2P)
+				{
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateSessionTerminated);
+				}
+			}
+		break;
+		
+		//MARK: stateRunning
+		case stateRunning:				// steady state
+			// Disabling voice or disconnect requested.
+			if(!mVoiceEnabled || mSessionTerminateRequested)
+			{
+				leaveAudioSession();
+			}
+			else
+			{
+				
+				// Figure out whether the PTT state needs to change
+				{
+					bool newPTT;
+					if(mUsePTT)
+					{
+						// If configured to use PTT, track the user state.
+						newPTT = mUserPTTState;
+					}
+					else
+					{
+						// If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
+						newPTT = true;
+					}
+					
+					if(mMuteMic)
+					{
+						// This always overrides any other PTT setting.
+						newPTT = false;
+					}
+					
+					// Dirty if state changed.
+					if(newPTT != mPTT)
+					{
+						mPTT = newPTT;
+						mPTTDirty = true;
+					}
+				}
+				
+				if(!inSpatialChannel())
+				{
+					// When in a non-spatial channel, never send positional updates.
+					mSpatialCoordsDirty = false;
+				}
+				else
+				{
+					// Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
+					enforceTether();
+				}
+				
+				// Send an update only if the ptt or mute state has changed (which shouldn't be able to happen that often
+				// -- the user can only click so fast) or every 10hz, whichever is sooner.
+				// Sending for every volume update causes an excessive flood of messages whenever a volume slider is dragged.
+				if((mAudioSession && mAudioSession->mMuteDirty) || mPTTDirty || mUpdateTimer.hasExpired())
+				{
+					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
+					sendPositionalUpdate();
+				}
+			}
+		break;
+		
+		//MARK: stateLeavingSession
+		case stateLeavingSession:		// waiting for terminate session response
+			// The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
+		break;
+
+		//MARK: stateSessionTerminated
+		case stateSessionTerminated:
+			
+			// Must do this first, since it uses mAudioSession.
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
+			
+			if(mAudioSession)
+			{
+				sessionState *oldSession = mAudioSession;
+
+				mAudioSession = NULL;
+				// We just notified status observers about this change.  Don't do it again.
+				mAudioSessionChanged = false;
+
+				// The old session may now need to be deleted.
+				reapSession(oldSession);
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
+			}
+	
+			// Always reset the terminate request flag when we get here.
+			mSessionTerminateRequested = false;
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{				
+				// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
+				setState(stateNoChannel);
+			}
+			else
+			{
+				// Shutting down voice, continue with disconnecting.
+				logout();
+				
+				// The state machine will take it from here
+				mRelogRequested = false;
+			}
+			
+		break;
+		
+		//MARK: stateLoggingOut
+		case stateLoggingOut:			// waiting for logout response
+			// The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
+		break;
+		
+		//MARK: stateLoggedOut
+		case stateLoggedOut:			// logout response received
+			
+			// Once we're logged out, all these things are invalid.
+			mAccountHandle.clear();
+			deleteAllSessions();
+			deleteAllBuddies();
+
+			if(mVoiceEnabled && !mRelogRequested)
+			{
+				// User was logged out, but wants to be logged in.  Send a new login request.
+				setState(stateNeedsLogin);
+			}
+			else
+			{
+				// shut down the connector
+				connectorShutdown();
+			}
+		break;
+		
+		//MARK: stateConnectorStopping
+		case stateConnectorStopping:	// waiting for connector stop
+			// The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
+		break;
+
+		//MARK: stateConnectorStopped
+		case stateConnectorStopped:		// connector stop received
+			setState(stateDisableCleanup);
+		break;
+
+		//MARK: stateConnectorFailed
+		case stateConnectorFailed:
+			setState(stateConnectorFailedWaiting);
+		break;
+		//MARK: stateConnectorFailedWaiting
+		case stateConnectorFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateLoginFailed
+		case stateLoginFailed:
+			setState(stateLoginFailedWaiting);
+		break;
+		//MARK: stateLoginFailedWaiting
+		case stateLoginFailedWaiting:
+			if(!mVoiceEnabled)
+			{
+				setState(stateDisableCleanup);
+			}
+		break;
+
+		//MARK: stateJoinSessionFailed
+		case stateJoinSessionFailed:
+			// Transition to error state.  Send out any notifications here.
+			if(mAudioSession)
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
+			}
+			else
+			{
+				LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
+			}
+			
+			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
+			setState(stateJoinSessionFailedWaiting);
+		break;
+		
+		//MARK: stateJoinSessionFailedWaiting
+		case stateJoinSessionFailedWaiting:
+			// Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
+			// Region crossings may leave this state and try the join again.
+			if(mSessionTerminateRequested)
+			{
+				setState(stateSessionTerminated);
+			}
+		break;
+		
+		//MARK: stateJail
+		case stateJail:
+			// We have given up.  Do nothing.
+		break;
+
+	}
+	
+	if(mAudioSession && mAudioSession->mParticipantsChanged)
+	{
+		mAudioSession->mParticipantsChanged = false;
+		mAudioSessionChanged = true;
+	}
+	
+	if(mAudioSessionChanged)
+	{
+		mAudioSessionChanged = false;
+		notifyParticipantObservers();
+	}
+}
+
+void LLVoiceClient::closeSocket(void)
+{
+	mSocket.reset();
+	mConnected = false;	
+}
+
+void LLVoiceClient::loginSendMessage()
+{
+	std::ostringstream stream;
+
+	bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
+
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
+		<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+		<< "<AccountName>" << mAccountName << "</AccountName>"
+		<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
+		<< "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
+		<< "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
+		<< "<BuddyManagementMode>Application</BuddyManagementMode>"
+		<< "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
+		<< (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::logout()
+{
+	// Ensure that we'll re-request provisioning before logging in again
+	mAccountPassword.clear();
+	mVoiceAccountServerURI.clear();
+	
+	setState(stateLoggingOut);
+	logoutSendMessage();
+}
+
+void LLVoiceClient::logoutSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		mAccountHandle.clear();
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::accountListBlockRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::accountListAutoAcceptRulesSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::sessionGroupCreateSendMessage()
+{
+	if(!mAccountHandle.empty())
+	{		
+		std::ostringstream stream;
+
+		LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
+			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+			<< "<Type>Normal</Type>"
+		<< "</Request>"
+		<< "\n\n\n";
+
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
+		<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>";
+
+	static const std::string allowed_chars =
+				"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+				"0123456789"
+				"-._~";
+
+	if(!session->mHash.empty())
+	{
+		stream
+			<< "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
+			<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
+	}
+	
+	stream
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Name>" << mChannelName << "</Name>"
+	<< "</Request>\n\n\n";
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
+{
+	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
+	
+	session->mCreateInProgress = true;
+	if(startAudio)
+	{
+		session->mMediaConnectInProgress = true;
+	}
+	
+	std::string password;
+	if(!session->mHash.empty())
+	{
+		static const std::string allowed_chars =
+					"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
+					"0123456789"
+					"-._~"
+					;
+		password = LLURI::escape(session->mHash, allowed_chars);
+	}
+
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<URI>" << session->mSIPURI << "</URI>"
+		<< "<Name>" << mChannelName << "</Name>"
+		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
+		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
+		<< "<Password>" << password << "</Password>"
+		<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
+	<< "</Request>\n\n\n"
+	;
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
+
+	session->mMediaConnectInProgress = true;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionTextConnectSendMessage(sessionState *session)
+{
+	LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
+	
+	std::ostringstream stream;
+
+	stream
+	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionTerminate()
+{
+	mSessionTerminateRequested = true;
+}
+
+void LLVoiceClient::requestRelog()
+{
+	mSessionTerminateRequested = true;
+	mRelogRequested = true;
+}
+
+
+void LLVoiceClient::leaveAudioSession()
+{
+	if(mAudioSession)
+	{
+		LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
+
+		switch(getState())
+		{
+			case stateNoChannel:
+				// In this case, we want to pretend the join failed so our state machine doesn't get stuck.
+				// Skip the join failed transition state so we don't send out error notifications.
+				setState(stateJoinSessionFailedWaiting);
+			break;
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+				if(!mAudioSession->mHandle.empty())
+				{
+
+#if RECORD_EVERYTHING
+					// HACK: for testing only
+					// Save looped recording
+					std::string savepath("/tmp/vivoxrecording");
+					{
+						time_t now = time(NULL);
+						const size_t BUF_SIZE = 64;
+						char time_str[BUF_SIZE];	/* Flawfinder: ignore */
+						
+						strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
+						savepath += time_str;
+					}
+					recordingLoopSave(savepath);
+#endif
+
+					sessionMediaDisconnectSendMessage(mAudioSession);
+					setState(stateLeavingSession);
+				}
+				else
+				{
+					LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
+					setState(stateSessionTerminated);
+				}
+			break;
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				setState(stateSessionTerminated);
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
+			break;
+		}
+	}
+	else
+	{
+		LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
+		setState(stateSessionTerminated);
+	}
+}
+
+void LLVoiceClient::sessionTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+		<< "<Media>Audio</Media>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+	
+}
+
+void LLVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
+{
+	std::ostringstream stream;
+	
+	LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;	
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
+		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
+		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::getCaptureDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::getRenderDevicesSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::clearCaptureDevices()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mCaptureDevices.clear();
+}
+
+void LLVoiceClient::addCaptureDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+
+	mCaptureDevices.push_back(name);
+}
+
+LLVoiceClient::deviceList *LLVoiceClient::getCaptureDevices()
+{
+	return &mCaptureDevices;
+}
+
+void LLVoiceClient::setCaptureDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mCaptureDevice.empty())
+		{
+			mCaptureDevice.clear();
+			mCaptureDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mCaptureDevice != name)
+		{
+			mCaptureDevice = name;
+			mCaptureDeviceDirty = true;	
+		}
+	}
+}
+
+void LLVoiceClient::clearRenderDevices()
+{	
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+	mRenderDevices.clear();
+}
+
+void LLVoiceClient::addRenderDevice(const std::string& name)
+{
+	LL_DEBUGS("Voice") << name << LL_ENDL;
+	mRenderDevices.push_back(name);
+}
+
+LLVoiceClient::deviceList *LLVoiceClient::getRenderDevices()
+{
+	return &mRenderDevices;
+}
+
+void LLVoiceClient::setRenderDevice(const std::string& name)
+{
+	if(name == "Default")
+	{
+		if(!mRenderDevice.empty())
+		{
+			mRenderDevice.clear();
+			mRenderDeviceDirty = true;	
+		}
+	}
+	else
+	{
+		if(mRenderDevice != name)
+		{
+			mRenderDevice = name;
+			mRenderDeviceDirty = true;	
+		}
+	}
+	
+}
+
+void LLVoiceClient::tuningStart()
+{
+	mTuningMode = true;
+	if(getState() >= stateNoChannel)
+	{
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::tuningStop()
+{
+	mTuningMode = false;
+}
+
+bool LLVoiceClient::inTuningMode()
+{
+	bool result = false;
+	switch(getState())
+	{
+	case stateMicTuningRunning:
+		result = true;
+		break;
+	default:
+		break;
+	}
+	return result;
+}
+
+void LLVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
+{		
+	mTuningAudioFile = name;
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+    << "<Loop>" << (loop?"1":"0") << "</Loop>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningRenderStopSendMessage()
+{
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
+    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningCaptureStartSendMessage(int duration)
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
+    << "<Duration>" << duration << "</Duration>"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+}
+
+void LLVoiceClient::tuningCaptureStopSendMessage()
+{
+	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
+	
+	std::ostringstream stream;
+	stream
+	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
+	<< "</Request>\n\n\n";
+	
+	writeString(stream.str());
+
+	mTuningEnergy = 0.0f;
+}
+
+void LLVoiceClient::tuningSetMicVolume(float volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+
+	if(scaled_volume != mTuningMicVolume)
+	{
+		mTuningMicVolume = scaled_volume;
+		mTuningMicVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::tuningSetSpeakerVolume(float volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mTuningSpeakerVolume)
+	{
+		mTuningSpeakerVolume = scaled_volume;
+		mTuningSpeakerVolumeDirty = true;
+	}
+}
+				
+float LLVoiceClient::tuningGetEnergy(void)
+{
+	return mTuningEnergy;
+}
+
+bool LLVoiceClient::deviceSettingsAvailable()
+{
+	bool result = true;
+	
+	if(!mConnected)
+		result = false;
+	
+	if(mRenderDevices.empty())
+		result = false;
+	
+	return result;
+}
+
+void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
+{
+	if(clearCurrentList)
+	{
+		clearCaptureDevices();
+		clearRenderDevices();
+	}
+	getCaptureDevicesSendMessage();
+	getRenderDevicesSendMessage();
+}
+
+void LLVoiceClient::daemonDied()
+{
+	// The daemon died, so the connection is gone.  Reset everything and start over.
+	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
+
+	// Try to relaunch the daemon
+	setState(stateDisableCleanup);
+}
+
+void LLVoiceClient::giveUp()
+{
+	// All has failed.  Clean up and stop trying.
+	closeSocket();
+	deleteAllSessions();
+	deleteAllBuddies();
+	
+	setState(stateJail);
+}
+
+static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
+{
+	F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the  new position and velocity
+	F64 npos[3];
+	
+	// The original XML command was sent like this:
+	/*
+			<< "<Position>"
+				<< "<X>" << pos[VX] << "</X>"
+				<< "<Y>" << pos[VZ] << "</Y>"
+				<< "<Z>" << pos[VY] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << mAvatarVelocity[VX] << "</X>"
+				<< "<Y>" << mAvatarVelocity[VZ] << "</Y>"
+				<< "<Z>" << mAvatarVelocity[VY] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << l.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VX] << "</Y>"
+				<< "<Z>" << a.mV[VX] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << l.mV[VZ] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VY] << "</X>"
+				<< "<Y>" << u.mV [VZ] << "</Y>"
+				<< "<Z>" << a.mV [VY] << "</Z>"
+			<< "</LeftOrientation>";
+	*/
+
+#if 1
+	// This was the original transform done when building the XML command
+	nat[0] = left.mV[VX];
+	nat[1] = up.mV[VX];
+	nat[2] = at.mV[VX];
+
+	nup[0] = left.mV[VZ];
+	nup[1] = up.mV[VY];
+	nup[2] = at.mV[VZ];
+
+	nl[0] = left.mV[VY];
+	nl[1] = up.mV[VZ];
+	nl[2] = at.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY];
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+	// This was the original transform done in the SDK
+	nat[0] = at.mV[2];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * left.mV[2];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = at.mV[0];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[0];
+
+	npos[2] = pos.mdV[2] * -1.0;
+	npos[1] = pos.mdV[1];
+	npos[0] = pos.mdV[0];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+#else
+	// This is the compose of the two transforms (at least, that's what I'm trying for)
+	nat[0] = at.mV[VX];
+	nat[1] = 0; // y component of at vector is always 0, this was up[2]
+	nat[2] = -1 * up.mV[VZ];
+
+	// We override whatever the application gives us
+	nup[0] = 0; // x component of up vector is always 0
+	nup[1] = 1; // y component of up vector is always 1
+	nup[2] = 0; // z component of up vector is always 0
+
+	nl[0] = left.mV[VX];
+	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
+	nl[2] = -1 * left.mV[VY];
+
+	npos[0] = pos.mdV[VX];
+	npos[1] = pos.mdV[VZ];
+	npos[2] = pos.mdV[VY] * -1.0;
+
+	nvel[0] = vel.mV[VX];
+	nvel[1] = vel.mV[VZ];
+	nvel[2] = vel.mV[VY];
+
+	for(int i=0;i<3;++i) {
+		at.mV[i] = nat[i];
+		up.mV[i] = nup[i];
+		left.mV[i] = nl[i];
+		pos.mdV[i] = npos[i];
+	}
+	
+#endif
+}
+
+void LLVoiceClient::sendPositionalUpdate(void)
+{	
+	std::ostringstream stream;
+	
+	if(mSpatialCoordsDirty)
+	{
+		LLVector3 l, u, a, vel;
+		LLVector3d pos;
+
+		mSpatialCoordsDirty = false;
+		
+		// Always send both speaker and listener positions together.
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"		
+			<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
+		
+		stream << "<SpeakerPosition>";
+
+//		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
+		l = mAvatarRot.getLeftRow();
+		u = mAvatarRot.getUpRow();
+		a = mAvatarRot.getFwdRow();
+		pos = mAvatarPosition;
+		vel = mAvatarVelocity;
+
+		// SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
+		// The old transform is replicated by this function.
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+		stream << "</SpeakerPosition>";
+
+		stream << "<ListenerPosition>";
+
+		LLVector3d	earPosition;
+		LLVector3	earVelocity;
+		LLMatrix3	earRot;
+		
+		switch(mEarLocation)
+		{
+			case earLocCamera:
+			default:
+				earPosition = mCameraPosition;
+				earVelocity = mCameraVelocity;
+				earRot = mCameraRot;
+			break;
+			
+			case earLocAvatar:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mAvatarRot;
+			break;
+			
+			case earLocMixed:
+				earPosition = mAvatarPosition;
+				earVelocity = mAvatarVelocity;
+				earRot = mCameraRot;
+			break;
+		}
+
+		l = earRot.getLeftRow();
+		u = earRot.getUpRow();
+		a = earRot.getFwdRow();
+		pos = earPosition;
+		vel = earVelocity;
+
+//		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
+		
+		oldSDKTransform(l, u, a, pos, vel);
+		
+		stream 
+			<< "<Position>"
+				<< "<X>" << pos.mdV[VX] << "</X>"
+				<< "<Y>" << pos.mdV[VY] << "</Y>"
+				<< "<Z>" << pos.mdV[VZ] << "</Z>"
+			<< "</Position>"
+			<< "<Velocity>"
+				<< "<X>" << vel.mV[VX] << "</X>"
+				<< "<Y>" << vel.mV[VY] << "</Y>"
+				<< "<Z>" << vel.mV[VZ] << "</Z>"
+			<< "</Velocity>"
+			<< "<AtOrientation>"
+				<< "<X>" << a.mV[VX] << "</X>"
+				<< "<Y>" << a.mV[VY] << "</Y>"
+				<< "<Z>" << a.mV[VZ] << "</Z>"
+			<< "</AtOrientation>"
+			<< "<UpOrientation>"
+				<< "<X>" << u.mV[VX] << "</X>"
+				<< "<Y>" << u.mV[VY] << "</Y>"
+				<< "<Z>" << u.mV[VZ] << "</Z>"
+			<< "</UpOrientation>"
+			<< "<LeftOrientation>"
+				<< "<X>" << l.mV [VX] << "</X>"
+				<< "<Y>" << l.mV [VY] << "</Y>"
+				<< "<Z>" << l.mV [VZ] << "</Z>"
+			<< "</LeftOrientation>";
+
+
+		stream << "</ListenerPosition>";
+
+		stream << "</Request>\n\n\n";
+	}	
+	
+	if(mAudioSession && (mAudioSession->mVolumeDirty || mAudioSession->mMuteDirty))
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+
+		mAudioSession->mVolumeDirty = false;
+		mAudioSession->mMuteDirty = false;
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+
+			if(p->mVolumeDirty)
+			{
+				// Can't set volume/mute for yourself
+				if(!p->mIsSelf)
+				{
+					// scale from the range 0.0-1.0 to vivox volume in the range 0-100
+					S32 volume = llround(p->mVolume / VOLUME_SCALE_VIVOX);
+
+					bool mute = p->mOnMuteList;
+
+					if(mute)
+					{
+						// SetParticipantMuteForMe doesn't work in p2p sessions.
+						// If we want the user to be muted, set their volume to 0 as well.
+						// This isn't perfect, but it will at least reduce their volume to a minimum.
+						volume = 0;
+
+						// Mark the current volume level as set to prevent incoming events
+						// changing it to 0, so that we can return to it when unmuting.
+						p->mVolumeSet = true;
+					}
+
+					if(volume == 0)
+					{
+						mute = true;
+					}
+
+					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
+					
+					// SLIM SDK: Send both volume and mute commands.
+					
+					// Send a "volume for me" command for the user.
+					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
+						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+						<< "<Volume>" << volume << "</Volume>"
+						<< "</Request>\n\n\n";
+
+					if(!mAudioSession->mIsP2P)
+					{
+						// Send a "mute for me" command for the user
+						// Doesn't work in P2P sessions
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
+							<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
+							<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
+							<< "<Mute>" << (mute?"1":"0") << "</Mute>"
+							<< "<Scope>Audio</Scope>"
+							<< "</Request>\n\n\n";
+					}
+				}
+				
+				p->mVolumeDirty = false;
+			}
+		}
+	}
+			
+	buildLocalAudioUpdates(stream);
+	
+	if(!stream.str().empty())
+	{
+		writeString(stream.str());
+	}
+	
+	// Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
+	// Batching them all together can choke SLVoice, so send them in separate writes.
+	sendFriendsListUpdates();
+}
+
+void LLVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
+{
+	if(mCaptureDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
+	
+		stream 
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
+			<< "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		
+		mCaptureDeviceDirty = false;
+	}
+}
+
+void LLVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
+{
+	if(mRenderDeviceDirty)
+	{
+		LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
+
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
+			<< "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
+		<< "</Request>"
+		<< "\n\n\n";
+		mRenderDeviceDirty = false;
+	}
+}
+
+void LLVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
+{
+	buildSetCaptureDevice(stream);
+
+	buildSetRenderDevice(stream);
+
+	if(mPTTDirty)
+	{
+		mPTTDirty = false;
+
+		// Send a local mute command.
+		// NOTE that the state of "PTT" is the inverse of "local mute".
+		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
+		
+		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << (mPTT?"false":"true") << "</Value>"
+			<< "</Request>\n\n\n";
+		
+	}
+
+	if(mSpeakerMuteDirty)
+	{
+		const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false");
+
+		mSpeakerMuteDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
+		
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << muteval << "</Value>"
+			<< "</Request>\n\n\n";	
+		
+	}
+	
+	if(mSpeakerVolumeDirty)
+	{
+		mSpeakerVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mSpeakerVolume << "</Value>"
+			<< "</Request>\n\n\n";
+			
+	}
+	
+	if(mMicVolumeDirty)
+	{
+		mMicVolumeDirty = false;
+
+		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
+
+		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
+			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
+			<< "<Value>" << mMicVolume << "</Value>"
+			<< "</Request>\n\n\n";				
+	}
+
+	
+}
+
+void LLVoiceClient::checkFriend(const LLUUID& id)
+{
+	std::string name;
+	buddyListEntry *buddy = findBuddy(id);
+
+	// Make sure we don't add a name before it's been looked up.
+	if(gCacheName->getFullName(id, name))
+	{
+
+		const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
+		bool canSeeMeOnline = false;
+		if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
+			canSeeMeOnline = true;
+		
+		// When we get here, mNeedsSend is true and mInSLFriends is false.  Change them as necessary.
+		
+		if(buddy)
+		{
+			// This buddy is already in both lists.
+
+			if(name != buddy->mDisplayName)
+			{
+				// The buddy is in the list with the wrong name.  Update it with the correct name.
+				LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
+				buddy->mDisplayName = name;
+				buddy->mNeedsNameUpdate = true;		// This will cause the buddy to be resent.
+			}
+		}
+		else
+		{
+			// This buddy was not in the vivox list, needs to be added.
+			buddy = addBuddy(sipURIFromID(id), name);
+			buddy->mUUID = id;
+		}
+		
+		// In all the above cases, the buddy is in the SL friends list (which is how we got here).
+		buddy->mInSLFriends = true;
+		buddy->mCanSeeMeOnline = canSeeMeOnline;
+		buddy->mNameResolved = true;
+		
+	}
+	else
+	{
+		// This name hasn't been looked up yet.  Don't do anything with this buddy list entry until it has.
+		if(buddy)
+		{
+			buddy->mNameResolved = false;
+		}
+		
+		// Initiate a lookup.
+		// The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
+		lookupName(id);
+	}
+}
+
+void LLVoiceClient::clearAllLists()
+{
+	// FOR TESTING ONLY
+	
+	// This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+	{
+		buddyListEntry *buddy = buddy_it->second;
+		buddy_it++;
+		
+		std::ostringstream stream;
+
+		if(buddy->mInVivoxBuddies)
+		{
+			// delete this entry from the vivox buddy list
+			buddy->mInVivoxBuddies = false;
+			LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "</Request>\n\n\n";		
+		}
+
+		if(buddy->mHasBlockListEntry)
+		{
+			// Delete the associated block list entry (so the block list doesn't fill up with junk)
+			buddy->mHasBlockListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+				<< "</Request>\n\n\n";								
+		}
+		if(buddy->mHasAutoAcceptListEntry)
+		{
+			// Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
+			buddy->mHasAutoAcceptListEntry = false;
+			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+				<< "</Request>\n\n\n";
+		}
+
+		writeString(stream.str());
+
+	}
+}
+
+void LLVoiceClient::sendFriendsListUpdates()
+{
+	if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
+	{
+		mFriendsListDirty = false;
+		
+		if(0)
+		{
+			// FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
+			clearAllLists();
+			return;
+		}
+		
+		LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
+		
+		buddyListMap::iterator buddy_it;
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
+		{
+			// reset the temp flags in the local buddy list
+			buddy_it->second->mInSLFriends = false;
+		}
+		
+		// correlate with the friends list
+		{
+			LLCollectAllBuddies collect;
+			LLAvatarTracker::instance().applyFunctor(collect);
+			LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
+			LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
+			
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+			it = collect.mOffline.begin();
+			end = collect.mOffline.end();
+			for ( ; it != end; ++it)
+			{
+				checkFriend(it->second);
+			}
+		}
+				
+		LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
+
+		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
+		{
+			buddyListEntry *buddy = buddy_it->second;
+			buddy_it++;
+			
+			// Ignore entries that aren't resolved yet.
+			if(buddy->mNameResolved)
+			{
+				std::ostringstream stream;
+
+				if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
+				{					
+					if(mNumberOfAliases > 0)
+					{
+						// Add (or update) this entry in the vivox buddy list
+						buddy->mInVivoxBuddies = true;
+						buddy->mNeedsNameUpdate = false;
+						LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream 
+							<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+								<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
+								<< "<BuddyData></BuddyData>"	// Without this, SLVoice doesn't seem to parse the command.
+								<< "<GroupID>0</GroupID>"
+							<< "</Request>\n\n\n";	
+					}
+				}
+				else if(!buddy->mInSLFriends)
+				{
+					// This entry no longer exists in your SL friends list.  Remove all traces of it from the Vivox buddy list.
+ 					if(buddy->mInVivoxBuddies)
+					{
+						// delete this entry from the vivox buddy list
+						buddy->mInVivoxBuddies = false;
+						LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+							<< "</Request>\n\n\n";		
+					}
+
+					if(buddy->mHasBlockListEntry)
+					{
+						// Delete the associated block list entry, if any
+						buddy->mHasBlockListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+							<< "</Request>\n\n\n";								
+					}
+					if(buddy->mHasAutoAcceptListEntry)
+					{
+						// Delete the associated auto-accept list entry, if any
+						buddy->mHasAutoAcceptListEntry = false;
+						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+							<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+							<< "</Request>\n\n\n";
+					}
+				}
+				
+				if(buddy->mInSLFriends)
+				{
+
+					if(buddy->mCanSeeMeOnline)
+					{
+						// Buddy should not be blocked.
+
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+						
+						// If the buddy has a block list entry, delete it.
+						if(buddy->mHasBlockListEntry)
+						{
+							buddy->mHasBlockListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+								<< "</Request>\n\n\n";		
+							
+							
+							// If we just deleted a block list entry, add an auto-accept entry.
+							if(!buddy->mHasAutoAcceptListEntry)
+							{
+								buddy->mHasAutoAcceptListEntry = true;								
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+									<< "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
+									<< "</Request>\n\n\n";
+							}
+						}
+					}
+					else
+					{
+						// Buddy should be blocked.
+						
+						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
+
+						// If this buddy has an autoaccept entry, delete it
+						if(buddy->mHasAutoAcceptListEntry)
+						{
+							buddy->mHasAutoAcceptListEntry = false;
+							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
+								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+								<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
+								<< "</Request>\n\n\n";
+						
+							// If we just deleted an auto-accept entry, add a block list entry.
+							if(!buddy->mHasBlockListEntry)
+							{
+								buddy->mHasBlockListEntry = true;
+								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
+									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+									<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
+									<< "<PresenceOnly>1</PresenceOnly>"
+									<< "</Request>\n\n\n";								
+							}
+						}
+					}
+
+					if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
+					{
+						// Delete this entry from the local buddy list.  This should NOT invalidate the iterator,
+						// since it has already been incremented to the next entry.
+						deleteBuddy(buddy->mURI);
+					}
+
+				}
+				writeString(stream.str());
+			}
+		}
+	}
+}
+
+/////////////////////////////
+// Response/Event handlers
+
+void LLVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
+		setState(stateConnectorFailed);
+	}
+	else
+	{
+		// Connector created, move forward.
+		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
+		mAPIVersion = versionID;
+		mConnectorHandle = connectorHandle;
+		if(getState() == stateConnectorStarting)
+		{
+			setState(stateConnectorStarted);
+		}
+	}
+}
+
+void LLVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
+{ 
+	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
+	
+	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
+	
+	if ( statusCode == 401 )
+	{
+		// Login failure which is probably caused by the delay after a user's password being updated.
+		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginRetry);
+	}
+	else if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		setState(stateLoginFailed);
+	}
+	else
+	{
+		// Login succeeded, move forward.
+		mAccountHandle = accountHandle;
+		mNumberOfAliases = numberOfAliases;
+		// This needs to wait until the AccountLoginStateChangeEvent is received.
+//		if(getState() == stateLoggingIn)
+//		{
+//			setState(stateLoggedIn);
+//		}
+	}
+}
+
+void LLVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
+{	
+	sessionState *session = findSessionBeingCreatedByURI(requestId);
+	
+	if(session)
+	{
+		session->mCreateInProgress = false;
+	}
+	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+			{
+				setState(stateJoinSessionFailed);
+			}
+			else
+			{
+				reapSession(session);
+			}
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
+		if(session)
+		{
+			setSessionHandle(session, sessionHandle);
+		}
+	}
+}
+
+void LLVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
+{
+	sessionState *session = findSession(requestId);
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
+		if(session)
+		{
+			session->mMediaConnectInProgress = false;
+			session->mErrorStatusCode = statusCode;		
+			session->mErrorStatusString = statusString;
+			if(session == mAudioSession)
+				setState(stateJoinSessionFailed);
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::logoutResponse(int statusCode, std::string &statusString)
+{	
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+}
+
+void LLVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
+{
+	if(statusCode != 0)
+	{
+		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
+		// Should this ever fail?  do we care if it does?
+	}
+	
+	mConnected = false;
+	
+	if(getState() == stateConnectorStopping)
+	{
+		setState(stateConnectorStopped);
+	}
+}
+
+void LLVoiceClient::sessionAddedEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		bool isChannel, 
+		bool incoming,
+		std::string &nameString,
+		std::string &applicationString)
+{
+	sessionState *session = NULL;
+
+	LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
+	
+	session = addSession(uriString, sessionHandle);
+	if(session)
+	{
+		session->mGroupHandle = sessionGroupHandle;
+		session->mIsChannel = isChannel;
+		session->mIncoming = incoming;
+		session->mAlias = alias;
+			
+		// Generate a caller UUID -- don't need to do this for channels
+		if(!session->mIsChannel)
+		{
+			if(IDFromName(session->mSIPURI, session->mCallerID))
+			{
+				// Normal URI(base64-encoded UUID) 
+			}
+			else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
+			{
+				// Wrong URI, but an alias is available.  Stash the incoming URI as an alternate
+				session->mAlternateSIPURI = session->mSIPURI;
+				
+				// and generate a proper URI from the ID.
+				setSessionURI(session, sipURIFromID(session->mCallerID));
+			}
+			else
+			{
+				LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
+				setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
+				session->mSynthesizedCallerID = true;
+				
+				// Can't look up the name in this case -- we have to extract it from the URI.
+				std::string namePortion = nameFromsipURI(session->mSIPURI);
+				if(namePortion.empty())
+				{
+					// Didn't seem to be a SIP URI, just use the whole provided name.
+					namePortion = nameString;
+				}
+				
+				// Some incoming names may be separated with an underscore instead of a space.  Fix this.
+				LLStringUtil::replaceChar(namePortion, '_', ' ');
+				
+				// Act like we just finished resolving the name (this stores it in all the right places)
+				avatarNameResolved(session->mCallerID, namePortion);
+			}
+		
+			LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
+
+			if(!session->mSynthesizedCallerID)
+			{
+				// If we got here, we don't have a proper name.  Initiate a lookup.
+				lookupName(session->mCallerID);
+			}
+		}
+	}
+}
+
+void LLVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
+{
+	LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
+	
+#if USE_SESSION_GROUPS
+	if(mMainSessionGroupHandle.empty())
+	{
+		// This is the first (i.e. "main") session group.  Save its handle.
+		mMainSessionGroupHandle = sessionGroupHandle;
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
+	}
+#endif
+}
+
+void LLVoiceClient::joinedAudioSession(sessionState *session)
+{
+	if(mAudioSession != session)
+	{
+		sessionState *oldSession = mAudioSession;
+
+		mAudioSession = session;
+		mAudioSessionChanged = true;
+
+		// The old session may now need to be deleted.
+		reapSession(oldSession);
+	}
+	
+	// This is the session we're joining.
+	if(getState() == stateJoiningSession)
+	{
+		setState(stateSessionJoined);
+		
+		// SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
+		// Add the current user as a participant here.
+		participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
+		if(participant)
+		{
+			participant->mIsSelf = true;
+			lookupName(participant->mAvatarID);
+
+			LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+		}
+		
+		if(!session->mIsChannel)
+		{
+			// this is a p2p session.  Make sure the other end is added as a participant.
+			participantState *participant = session->addParticipant(session->mSIPURI);
+			if(participant)
+			{
+				if(participant->mAvatarIDValid)
+				{
+					lookupName(participant->mAvatarID);
+				}
+				else if(!session->mName.empty())
+				{
+					participant->mDisplayName = session->mName;
+					avatarNameResolved(participant->mAvatarID, session->mName);
+				}
+				
+				// TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
+				LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName 
+						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+			}
+		}
+	}
+}
+
+void LLVoiceClient::sessionRemovedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle)
+{
+	LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		leftAudioSession(session);
+
+		// This message invalidates the session's handle.  Set it to empty.
+		setSessionHandle(session);
+		
+		// This also means that the session's session group is now empty.
+		// Terminate the session group so it doesn't leak.
+		sessionGroupTerminateSendMessage(session);
+		
+		// Reset the media state (we now have no info)
+		session->mMediaStreamState = streamStateUnknown;
+		session->mTextStreamState = streamStateUnknown;
+		
+		// Conditionally delete the session
+		reapSession(session);
+	}
+	else
+	{
+		LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::reapSession(sessionState *session)
+{
+	if(session)
+	{
+		if(!session->mHandle.empty())
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
+		}
+		else if(session->mCreateInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
+		}
+		else if(session->mMediaConnectInProgress)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
+		}
+		else if(session == mAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
+		}
+		else if(session == mNextAudioSession)
+		{
+			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
+		}
+		else
+		{
+			// TODO: Question: Should we check for queued text messages here?
+			// We don't have a reason to keep tracking this session, so just delete it.
+			LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
+			deleteSession(session);
+			session = NULL;
+		}	
+	}
+	else
+	{
+//		LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
+	}
+}
+
+// Returns true if the session seems to indicate we've moved to a region on a different voice server
+bool LLVoiceClient::sessionNeedsRelog(sessionState *session)
+{
+	bool result = false;
+	
+	if(session != NULL)
+	{
+		// Only make this check for spatial channels (so it won't happen for group or p2p calls)
+		if(session->mIsSpatial)
+		{
+			std::string::size_type atsign;
+			
+			atsign = session->mSIPURI.find("@");
+			
+			if(atsign != std::string::npos)
+			{
+				std::string urihost = session->mSIPURI.substr(atsign + 1);
+				if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
+				{
+					// The hostname in this URI is different from what we expect.  This probably means we need to relog.
+					
+					// We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
+					// mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
+					
+					result = true;
+				}
+			}
+		}
+	}
+	
+	return result;
+}
+
+void LLVoiceClient::leftAudioSession(
+	sessionState *session)
+{
+	if(mAudioSession == session)
+	{
+		switch(getState())
+		{
+			case stateJoiningSession:
+			case stateSessionJoined:
+			case stateRunning:
+			case stateLeavingSession:
+			case stateJoinSessionFailed:
+			case stateJoinSessionFailedWaiting:
+				// normal transition
+				LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+			
+			case stateSessionTerminated:
+				// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
+				LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
+				setState(stateSessionTerminated);
+			break;
+		}
+	}
+}
+
+void LLVoiceClient::accountLoginStateChangeEvent(
+		std::string &accountHandle, 
+		int statusCode, 
+		std::string &statusString, 
+		int state)
+{
+	LL_DEBUGS("Voice") << "state is " << state << LL_ENDL;
+	/*
+		According to Mike S., status codes for this event are:
+		login_state_logged_out=0,
+        login_state_logged_in = 1,
+        login_state_logging_in = 2,
+        login_state_logging_out = 3,
+        login_state_resetting = 4,
+        login_state_error=100	
+	*/
+	
+	switch(state)
+	{
+		case 1:
+		if(getState() == stateLoggingIn)
+		{
+			setState(stateLoggedIn);
+		}
+		break;
+
+		case 3:
+			// The user is in the process of logging out.
+			setState(stateLoggingOut);
+		break;
+
+		case 0:
+			// The user has been logged out.  
+			setState(stateLoggedOut);
+		break;
+		
+		default:
+			//Used to be a commented out warning
+			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
+		break;
+	}
+}
+
+void LLVoiceClient::mediaStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	int statusCode, 
+	std::string &statusString, 
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
+	
+	if(session)
+	{
+		// We know about this session
+		
+		// Save the state for later use
+		session->mMediaStreamState = state;
+		
+		switch(statusCode)
+		{
+			case 0:
+			case 200:
+				// generic success
+				// Don't change the saved error code (it may have been set elsewhere)
+			break;
+			default:
+				// save the status code for later
+				session->mErrorStatusCode = statusCode;
+			break;
+		}
+		
+		switch(state)
+		{
+			case streamStateIdle:
+				// Standard "left audio session"
+				session->mVoiceEnabled = false;
+				session->mMediaConnectInProgress = false;
+				leftAudioSession(session);
+			break;
+
+			case streamStateConnected:
+				session->mVoiceEnabled = true;
+				session->mMediaConnectInProgress = false;
+				joinedAudioSession(session);
+			break;
+			
+			case streamStateRinging:
+				if(incoming)
+				{
+					// Send the voice chat invite to the GUI layer
+					// *TODO: Question: Should we correlate with the mute list here?
+					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
+					session->mVoiceInvitePending = true;
+					if(session->mName.empty())
+					{
+						lookupName(session->mCallerID);
+					}
+					else
+					{
+						// Act like we just finished resolving the name
+						avatarNameResolved(session->mCallerID, session->mName);
+					}
+				}
+			break;
+			
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+		
+	}
+	else
+	{
+		LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
+	}
+}
+
+void LLVoiceClient::textStreamUpdatedEvent(
+	std::string &sessionHandle, 
+	std::string &sessionGroupHandle, 
+	bool enabled,
+	int state, 
+	bool incoming)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		// Save the state for later use
+		session->mTextStreamState = state;
+		
+		// We know about this session
+		switch(state)
+		{
+			case 0:	// We see this when the text stream closes
+				LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
+			break;
+			
+			case 1:	// We see this on an incoming call from the Connector
+				// Try to send any text messages queued for this session.
+				sendQueuedTextMessages(session);
+
+				// Send the text chat invite to the GUI layer
+				// TODO: Question: Should we correlate with the mute list here?
+				session->mTextInvitePending = true;
+				if(session->mName.empty())
+				{
+					lookupName(session->mCallerID);
+				}
+				else
+				{
+					// Act like we just finished resolving the name
+					avatarNameResolved(session->mCallerID, session->mName);
+				}
+			break;
+
+			default:
+				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
+			break;
+			
+		}
+	}
+}
+
+void LLVoiceClient::participantAddedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString, 
+		std::string &displayNameString, 
+		int participantType)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->addParticipant(uriString);
+		if(participant)
+		{
+			participant->mAccountName = nameString;
+
+			LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName 
+					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
+
+			if(participant->mAvatarIDValid)
+			{
+				// Initiate a lookup
+				lookupName(participant->mAvatarID);
+			}
+			else
+			{
+				// If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
+				std::string namePortion = nameFromsipURI(uriString);
+				if(namePortion.empty())
+				{
+					// Problem with the SIP URI, fall back to the display name
+					namePortion = displayNameString;
+				}
+				if(namePortion.empty())
+				{
+					// Problems with both of the above, fall back to the account name
+					namePortion = nameString;
+				}
+				
+				// Set the display name (which is a hint to the active speakers window not to do its own lookup)
+				participant->mDisplayName = namePortion;
+				avatarNameResolved(participant->mAvatarID, namePortion);
+			}
+		}
+	}
+}
+
+void LLVoiceClient::participantRemovedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &nameString)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			session->removeParticipant(participant);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+
+void LLVoiceClient::participantUpdatedEvent(
+		std::string &sessionHandle, 
+		std::string &sessionGroupHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		bool isModeratorMuted, 
+		bool isSpeaking, 
+		int volume, 
+		F32 energy)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		
+		if(participant)
+		{
+			participant->mIsSpeaking = isSpeaking;
+			participant->mIsModeratorMuted = isModeratorMuted;
+
+			// SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
+			if (isSpeaking)
+			{
+				participant->mSpeakingTimeout.reset();
+				participant->mPower = energy;
+			}
+			else
+			{
+				participant->mPower = 0.0f;
+			}
+
+			// Ignore incoming volume level if it has been explicitly set, or there
+			//  is a volume or mute change pending.
+			if ( !participant->mVolumeSet && !participant->mVolumeDirty)
+			{
+				participant->mVolume = (F32)volume * VOLUME_SCALE_VIVOX;
+			}
+
+			// *HACK: mantipov: added while working on EXT-3544
+			/*
+			Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE 
+			LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.
+			
+			participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted
+			Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.
+			Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.
+			
+			But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()
+			voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager
+			and event is not fired.
+
+			So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it
+			in LLCallFloater::draw()
+			*/
+			LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
+
+			// ignore session ID of local chat
+			if (voice_cnl && voice_cnl->getSessionID().notNull())
+			{
+				LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
+				if (speaker_manager)
+				{
+					speaker_manager->update(true);
+				}
+			}
+		}
+		else
+		{
+			LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::buddyPresenceEvent(
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &statusString,
+		std::string &applicationString)
+{
+	buddyListEntry *buddy = findBuddy(uriString);
+	
+	if(buddy)
+	{
+		LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
+		LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+
+		if(applicationString.empty())
+		{
+			// This presence event is from a client that doesn't set up the Application string.  Do things the old-skool way.
+			// NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
+
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// User went offline with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = false;
+			}
+			else if ( stricmp("Online", statusString.c_str())== 0) 
+			{
+				// User came online with a non-SLim-enabled viewer.
+				buddy->mOnlineSL = true;
+			}
+			else
+			{
+				// If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
+				// NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
+				buddy->mOnlineSLim = true;
+			} 
+		}
+		else if(applicationString.find("SecondLifeViewer") != std::string::npos)
+		{
+			// This presence event is from a viewer that sets the application string
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// Viewer says they're offline
+				buddy->mOnlineSL = false;
+			}
+			else
+			{
+				// Viewer says they're online
+				buddy->mOnlineSL = true;
+			}
+		}
+		else
+		{
+			// This presence event is from something which is NOT the SL viewer (assume it's SLim).
+			if ( stricmp("Unknown", statusString.c_str())== 0) 
+			{
+				// SLim says they're offline
+				buddy->mOnlineSLim = false;
+			}
+			else
+			{
+				// SLim says they're online
+				buddy->mOnlineSLim = true;
+			}
+		} 
+
+		LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
+		
+		// HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
+		LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
+
+		notifyFriendObservers();
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
+	}	
+}
+
+void LLVoiceClient::messageEvent(
+		std::string &sessionHandle, 
+		std::string &uriString, 
+		std::string &alias, 
+		std::string &messageHeader, 
+		std::string &messageBody,
+		std::string &applicationString)
+{
+	LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
+//	LL_DEBUGS("Voice") << "    header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
+	
+	if(messageHeader.find("text/html") != std::string::npos)
+	{
+		std::string message;
+
+		{
+			const std::string startMarker = "<body";
+			const std::string startMarker2 = ">";
+			const std::string endMarker = "</body>";
+			const std::string startSpan = "<span";
+			const std::string endSpan = "</span>";
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			// Default to displaying the raw string, so the message gets through.
+			message = messageBody;
+
+			// Find the actual message text within the XML fragment
+			start = messageBody.find(startMarker);
+			start = messageBody.find(startMarker2, start);
+			end = messageBody.find(endMarker);
+
+			if(start != std::string::npos)
+			{
+				start += startMarker2.size();
+				
+				if(end != std::string::npos)
+					end -= start;
+					
+				message.assign(messageBody, start, end);
+			}
+			else 
+			{
+				// Didn't find a <body>, try looking for a <span> instead.
+				start = messageBody.find(startSpan);
+				start = messageBody.find(startMarker2, start);
+				end = messageBody.find(endSpan);
+				
+				if(start != std::string::npos)
+				{
+					start += startMarker2.size();
+					
+					if(end != std::string::npos)
+						end -= start;
+					
+					message.assign(messageBody, start, end);
+				}			
+			}
+		}	
+		
+//		LL_DEBUGS("Voice") << "    raw message = \n" << message << LL_ENDL;
+
+		// strip formatting tags
+		{
+			std::string::size_type start;
+			std::string::size_type end;
+			
+			while((start = message.find('<')) != std::string::npos)
+			{
+				if((end = message.find('>', start + 1)) != std::string::npos)
+				{
+					// Strip out the tag
+					message.erase(start, (end + 1) - start);
+				}
+				else
+				{
+					// Avoid an infinite loop
+					break;
+				}
+			}
+		}
+		
+		// Decode ampersand-escaped chars
+		{
+			std::string::size_type mark = 0;
+
+			// The text may contain text encoded with &lt;, &gt;, and &amp;
+			mark = 0;
+			while((mark = message.find("&lt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, "<");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&gt;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 4, ">");
+				mark += 1;
+			}
+			
+			mark = 0;
+			while((mark = message.find("&amp;", mark)) != std::string::npos)
+			{
+				message.replace(mark, 5, "&");
+				mark += 1;
+			}
+		}
+		
+		// strip leading/trailing whitespace (since we always seem to get a couple newlines)
+		LLStringUtil::trim(message);
+		
+//		LL_DEBUGS("Voice") << "    stripped message = \n" << message << LL_ENDL;
+		
+		sessionState *session = findSession(sessionHandle);
+		if(session)
+		{
+			bool is_busy = gAgent.getBusy();
+			bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
+			bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
+			bool quiet_chat = false;
+			LLChat chat;
+
+			chat.mMuted = is_muted && !is_linden;
+			
+			if(!chat.mMuted)
+			{
+				chat.mFromID = session->mCallerID;
+				chat.mFromName = session->mName;
+				chat.mSourceType = CHAT_SOURCE_AGENT;
+
+				if(is_busy && !is_linden)
+				{
+					quiet_chat = true;
+					// TODO: Question: Return busy mode response here?  Or maybe when session is started instead?
+				}
+								
+				LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
+				gIMMgr->addMessage(session->mIMSessionID,
+						session->mCallerID,
+						session->mName.c_str(),
+						message.c_str(),
+						LLStringUtil::null,		// default arg
+						IM_NOTHING_SPECIAL,		// default arg
+						0,						// default arg
+						LLUUID::null,			// default arg
+						LLVector3::zero,		// default arg
+						true);					// prepend name and make it a link to the user's profile
+			}
+		}		
+	}
+}
+
+void LLVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
+{
+	sessionState *session = findSession(sessionHandle);
+	
+	if(session)
+	{
+		participantState *participant = session->findParticipant(uriString);
+		if(participant)
+		{
+			if (!stricmp(notificationType.c_str(), "Typing"))
+			{
+				// Other end started typing
+				// TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else if (!stricmp(notificationType.c_str(), "NotTyping"))
+			{
+				// Other end stopped typing
+				// TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
+				// It requires an LLIMInfo for the message, which we don't have here.
+			}
+			else
+			{
+				LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+			}
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
+		}
+	}
+	else
+	{
+		LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
+{
+	buddyListEntry *buddy = findBuddy(buddyURI);
+	
+	if(!buddy)
+	{
+		// Couldn't find buddy by URI, try converting the alias...
+		if(!alias.empty())
+		{
+			LLUUID id;
+			if(IDFromName(alias, id))
+			{
+				buddy = findBuddy(id);
+			}
+		}
+	}
+	
+	if(buddy)
+	{
+		std::ostringstream stream;
+		
+		if(buddy->mCanSeeMeOnline)
+		{
+			// Sending the response will create an auto-accept rule
+			buddy->mHasAutoAcceptListEntry = true;
+		}
+		else
+		{
+			// Sending the response will create a block rule
+			buddy->mHasBlockListEntry = true;
+		}
+		
+		if(buddy->mInSLFriends)
+		{
+			buddy->mInVivoxBuddies = true;
+		}
+		
+		stream
+			<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
+				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
+				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
+				<< "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
+				<< "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
+				<< "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
+			<< "</Request>"
+			<< "\n\n\n";
+			
+		writeString(stream.str());
+	}
+}
+
+void LLVoiceClient::auxAudioPropertiesEvent(F32 energy)
+{
+	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
+	mTuningEnergy = energy;
+}
+
+void LLVoiceClient::buddyListChanged()
+{
+	// This is called after we receive a BuddyAndGroupListChangedEvent.
+	mBuddyListMapPopulated = true;
+	mFriendsListDirty = true;
+}
+
+void LLVoiceClient::muteListChanged()
+{
+	// The user's mute list has been updated.  Go through the current participant list and sync it with the mute list.
+	if(mAudioSession)
+	{
+		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
+		
+		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
+		{
+			participantState *p = iter->second;
+			
+			// Check to see if this participant is on the mute list already
+			if(p->updateMuteState())
+				mAudioSession->mMuteDirty = true;
+		}
+	}
+}
+
+void LLVoiceClient::updateFriends(U32 mask)
+{
+	if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
+	{
+		// Just resend the whole friend list to the daemon
+		mFriendsListDirty = true;
+	}
+}
+
+/////////////////////////////
+// Managing list of participants
+LLVoiceClient::participantState::participantState(const std::string &uri) : 
+	 mURI(uri), 
+	 mPTT(false), 
+	 mIsSpeaking(false), 
+	 mIsModeratorMuted(false), 
+	 mLastSpokeTimestamp(0.f), 
+	 mPower(0.f), 
+	 mVolume(VOLUME_DEFAULT),
+	 mOnMuteList(false),
+	 mVolumeSet(false),
+	 mVolumeDirty(false),
+	 mAvatarIDValid(false),
+	 mIsSelf(false)
+{
+}
+
+LLVoiceClient::participantState *LLVoiceClient::sessionState::addParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	bool useAlternateURI = false;
+	
+	// Note: this is mostly the body of LLVoiceClient::sessionState::findParticipant(), but since we need to know if it
+	// matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(&uri);
+
+		if(iter == mParticipantsByURI.end())
+		{
+			if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+			{
+				// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+				// Use mSIPURI instead, since it will be properly encoded.
+				iter = mParticipantsByURI.find(&(mSIPURI));
+				useAlternateURI = true;
+			}
+		}
+
+		if(iter != mParticipantsByURI.end())
+		{
+			result = iter->second;
+		}
+	}
+		
+	if(!result)
+	{
+		// participant isn't already in one list or the other.
+		result = new participantState(useAlternateURI?mSIPURI:uri);
+		mParticipantsByURI.insert(participantMap::value_type(&(result->mURI), result));
+		mParticipantsChanged = true;
+		
+		// Try to do a reverse transform on the URI to get the GUID back.
+		{
+			LLUUID id;
+			if(IDFromName(result->mURI, id))
+			{
+				result->mAvatarIDValid = true;
+				result->mAvatarID = id;
+
+				if(result->updateMuteState())
+					mMuteDirty = true;
+			}
+			else
+			{
+				// Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
+				// This tells both code in LLVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache.
+				setUUIDFromStringHash(result->mAvatarID, uri);
+			}
+		}
+		
+		mParticipantsByUUID.insert(participantUUIDMap::value_type(&(result->mAvatarID), result));
+
+		if (LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID, result->mVolume))
+		{
+			result->mVolumeDirty = true;
+			mVolumeDirty = true;
+		}
+
+		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
+	}
+	
+	return result;
+}
+
+bool LLVoiceClient::participantState::updateMuteState()
+{
+	bool result = false;
+	
+	if(mAvatarIDValid)
+	{
+		bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
+		if(mOnMuteList != isMuted)
+		{
+			mOnMuteList = isMuted;
+			mVolumeDirty = true;
+			result = true;
+		}
+	}
+	return result;
+}
+
+bool LLVoiceClient::participantState::isAvatar()
+{
+	return mAvatarIDValid;
+}
+
+void LLVoiceClient::sessionState::removeParticipant(LLVoiceClient::participantState *participant)
+{
+	if(participant)
+	{
+		participantMap::iterator iter = mParticipantsByURI.find(&(participant->mURI));
+		participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(&(participant->mAvatarID));
+		
+		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
+		
+		if(iter == mParticipantsByURI.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
+		}
+		else if(iter2 == mParticipantsByUUID.end())
+		{
+			LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
+		}
+		else if(iter->second != iter2->second)
+		{
+			LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
+		}
+		else
+		{
+			mParticipantsByURI.erase(iter);
+			mParticipantsByUUID.erase(iter2);
+			
+			delete participant;
+			mParticipantsChanged = true;
+		}
+	}
+}
+
+void LLVoiceClient::sessionState::removeAllParticipants()
+{
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mParticipantsByURI.empty())
+	{
+		removeParticipant(mParticipantsByURI.begin()->second);
+	}
+	
+	if(!mParticipantsByUUID.empty())
+	{
+		LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
+	}
+}
+
+LLVoiceClient::participantMap *LLVoiceClient::getParticipantList(void)
+{
+	participantMap *result = NULL;
+	if(mAudioSession)
+	{
+		result = &(mAudioSession->mParticipantsByURI);
+	}
+	return result;
+}
+
+void LLVoiceClient::getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids)
+{
+	if (NULL == mAudioSession) return;
+
+	participantUUIDMap::const_iterator it = mAudioSession->mParticipantsByUUID.begin(),
+		it_end = mAudioSession->mParticipantsByUUID.end();
+	for (; it != it_end; ++it)
+	{
+		participant_uuids.insert((*(*it).first));
+	}
+}
+
+LLVoiceClient::participantState *LLVoiceClient::sessionState::findParticipant(const std::string &uri)
+{
+	participantState *result = NULL;
+	
+	participantMap::iterator iter = mParticipantsByURI.find(&uri);
+
+	if(iter == mParticipantsByURI.end())
+	{
+		if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
+		{
+			// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
+			// Look up the other URI
+			iter = mParticipantsByURI.find(&(mSIPURI));
+		}
+	}
+
+	if(iter != mParticipantsByURI.end())
+	{
+		result = iter->second;
+	}
+		
+	return result;
+}
+
+LLVoiceClient::participantState* LLVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	participantUUIDMap::iterator iter = mParticipantsByUUID.find(&id);
+
+	if(iter != mParticipantsByUUID.end())
+	{
+		result = iter->second;
+	}
+
+	return result;
+}
+
+LLVoiceClient::participantState* LLVoiceClient::findParticipantByID(const LLUUID& id)
+{
+	participantState * result = NULL;
+	
+	if(mAudioSession)
+	{
+		result = mAudioSession->findParticipantByID(id);
+	}
+	
+	return result;
+}
+
+
+void LLVoiceClient::parcelChanged()
+{
+	if(getState() >= stateNoChannel)
+	{
+		// If the user is logged in, start a channel lookup.
+		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
+
+		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
+		LLSD data;
+		LLHTTPClient::post(
+			url,
+			data,
+			new LLVoiceClientCapResponder);
+	}
+	else
+	{
+		// The transition to stateNoChannel needs to kick this off again.
+		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
+	}
+}
+
+void LLVoiceClient::switchChannel(
+	std::string uri,
+	bool spatial,
+	bool no_reconnect,
+	bool is_p2p,
+	std::string hash)
+{
+	bool needsSwitch = false;
+	
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< " with uri \"" << uri << "\"" 
+		<< (spatial?", spatial is true":", spatial is false")
+		<< LL_ENDL;
+	
+	switch(getState())
+	{
+		case stateJoinSessionFailed:
+		case stateJoinSessionFailedWaiting:
+		case stateNoChannel:
+			// Always switch to the new URI from these states.
+			needsSwitch = true;
+		break;
+
+		default:
+			if(mSessionTerminateRequested)
+			{
+				// If a terminate has been requested, we need to compare against where the URI we're already headed to.
+				if(mNextAudioSession)
+				{
+					if(mNextAudioSession->mSIPURI != uri)
+						needsSwitch = true;
+				}
+				else
+				{
+					// mNextAudioSession is null -- this probably means we're on our way back to spatial.
+					if(!uri.empty())
+					{
+						// We do want to process a switch in this case.
+						needsSwitch = true;
+					}
+				}
+			}
+			else
+			{
+				// Otherwise, compare against the URI we're in now.
+				if(mAudioSession)
+				{
+					if(mAudioSession->mSIPURI != uri)
+					{
+						needsSwitch = true;
+					}
+				}
+				else
+				{
+					if(!uri.empty())
+					{
+						// mAudioSession is null -- it's not clear what case would cause this.
+						// For now, log it as a warning and see if it ever crops up.
+						LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
+					}
+				}
+			}
+		break;
+	}
+	
+	if(needsSwitch)
+	{
+		if(uri.empty())
+		{
+			// Leave any channel we may be in
+			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
+
+			sessionState *oldSession = mNextAudioSession;
+			mNextAudioSession = NULL;
+
+			// The old session may now need to be deleted.
+			reapSession(oldSession);
+
+			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
+
+			mNextAudioSession = addSession(uri);
+			mNextAudioSession->mHash = hash;
+			mNextAudioSession->mIsSpatial = spatial;
+			mNextAudioSession->mReconnect = !no_reconnect;
+			mNextAudioSession->mIsP2P = is_p2p;
+		}
+		
+		if(getState() <= stateNoChannel)
+		{
+			// We're already set up to join a channel, just needed to fill in the session URI
+		}
+		else
+		{
+			// State machine will come around and rejoin if uri/handle is not empty.
+			sessionTerminate();
+		}
+	}
+}
+
+void LLVoiceClient::joinSession(sessionState *session)
+{
+	mNextAudioSession = session;
+	
+	if(getState() <= stateNoChannel)
+	{
+		// We're already set up to join a channel, just needed to fill in the session handle
+	}
+	else
+	{
+		// State machine will come around and rejoin if uri/handle is not empty.
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::setNonSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	switchChannel(uri, false, false, false, credentials);
+}
+
+void LLVoiceClient::setSpatialChannel(
+	const std::string &uri,
+	const std::string &credentials)
+{
+	mSpatialSessionURI = uri;
+	mSpatialSessionCredentials = credentials;
+	mAreaVoiceDisabled = mSpatialSessionURI.empty();
+
+	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
+	
+	if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
+	{
+		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
+		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
+	}
+	else
+	{
+		switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
+	}
+}
+
+void LLVoiceClient::callUser(const LLUUID &uuid)
+{
+	std::string userURI = sipURIFromID(uuid);
+
+	switchChannel(userURI, false, true, true);
+}
+
+LLVoiceClient::sessionState* LLVoiceClient::startUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user already exists
+	sessionState *session = findSession(uuid);
+	if(!session)
+	{
+		// No session with user, need to start one.
+		std::string uri = sipURIFromID(uuid);
+		session = addSession(uri);
+
+		llassert(session);
+		if (!session) return NULL;
+
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+		session->mCallerID = uuid;
+	}
+	
+	if(session->mHandle.empty())
+	{
+		// Session isn't active -- start it up.
+		sessionCreateSendMessage(session, false, true);
+	}
+	else
+	{	
+		// Session is already active -- start up text.
+		sessionTextConnectSendMessage(session);
+	}
+	
+	return session;
+}
+
+bool LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+{
+	bool result = false;
+
+	// Attempt to locate the indicated session
+	sessionState *session = startUserIMSession(participant_id);
+	if(session)
+	{
+		// found the session, attempt to send the message
+		session->mTextMsgQueue.push(message);
+		
+		// Try to send queued messages (will do nothing if the session is not open yet)
+		sendQueuedTextMessages(session);
+
+		// The message is queued, so we succeed.
+		result = true;
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
+	}
+	
+	return result;
+}
+
+void LLVoiceClient::sendQueuedTextMessages(sessionState *session)
+{
+	if(session->mTextStreamState == 1)
+	{
+		if(!session->mTextMsgQueue.empty())
+		{
+			std::ostringstream stream;
+			
+			while(!session->mTextMsgQueue.empty())
+			{
+				std::string message = session->mTextMsgQueue.front();
+				session->mTextMsgQueue.pop();
+				stream
+				<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
+					<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
+					<< "<MessageHeader>text/HTML</MessageHeader>"
+					<< "<MessageBody>" << message << "</MessageBody>"
+				<< "</Request>"
+				<< "\n\n\n";
+			}		
+			writeString(stream.str());
+		}
+	}
+	else
+	{
+		// Session isn't connected yet, defer until later.
+	}
+}
+
+void LLVoiceClient::endUserIMSession(const LLUUID &uuid)
+{
+	// Figure out if a session with the user exists
+	sessionState *session = findSession(uuid);
+	if(session)
+	{
+		// found the session
+		if(!session->mHandle.empty())
+		{
+			sessionTextDisconnectSendMessage(session);
+		}
+	}	
+	else
+	{
+		LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
+	}
+}
+
+bool LLVoiceClient::answerInvite(std::string &sessionHandle)
+{
+	// this is only ever used to answer incoming p2p call invites.
+	
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		session->mIsSpatial = false;
+		session->mReconnect = false;	
+		session->mIsP2P = true;
+
+		joinSession(session);
+		return true;
+	}
+	
+	return false;
+}
+
+bool LLVoiceClient::isOnlineSIP(const LLUUID &id)
+{
+	bool result = false;
+	buddyListEntry *buddy = findBuddy(id);
+	if(buddy)
+	{
+		result = buddy->mOnlineSLim;
+		LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
+	}
+
+	if(!result)
+	{
+		// This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
+		sessionState *session = findSession(id);
+		if(session && !session->mHandle.empty())
+		{
+			if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
+			{
+				LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
+				// we have a p2p text session open with this user, so by definition they're online.
+				result = true;
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if the indicated participant in the current audio session is really an SL avatar.
+// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+bool LLVoiceClient::isParticipantAvatar(const LLUUID &id)
+{
+	bool result = true; 
+	sessionState *session = findSession(id);
+	
+	if(session != NULL)
+	{
+		// this is a p2p session with the indicated caller, or the session with the specified UUID.
+		if(session->mSynthesizedCallerID)
+			result = false;
+	}
+	else
+	{
+		// Didn't find a matching session -- check the current audio session for a matching participant
+		if(mAudioSession != NULL)
+		{
+			participantState *participant = findParticipantByID(id);
+			if(participant != NULL)
+			{
+				result = participant->isAvatar();
+			}
+		}
+	}
+	
+	return result;
+}
+
+// Returns true if calling back the session URI after the session has closed is possible.
+// Currently this will be false only for PSTN P2P calls.		
+bool LLVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
+{
+	bool result = true; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isCallBackPossible();
+	}
+	
+	return result;
+}
+
+// Returns true if the session can accepte text IM's.
+// Currently this will be false only for PSTN P2P calls.
+bool LLVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
+{
+	bool result = true; 
+	sessionState *session = findSession(session_id);
+	
+	if(session != NULL)
+	{
+		result = session->isTextIMPossible();
+	}
+	
+	return result;
+}
+		
 
-const F32 LLVoiceClient::OVERDRIVEN_POWER_LEVEL = 0.7f;
+void LLVoiceClient::declineInvite(std::string &sessionHandle)
+{
+	sessionState *session = findSession(sessionHandle);
+	if(session)
+	{
+		sessionMediaDisconnectSendMessage(session);
+	}
+}
 
-std::string LLVoiceClientStatusObserver::status2string(LLVoiceClientStatusObserver::EStatusType inStatus)
+void LLVoiceClient::leaveNonSpatialChannel()
 {
-	std::string result = "UNKNOWN";
+	LL_DEBUGS("Voice") 
+		<< "called in state " << state2string(getState()) 
+		<< LL_ENDL;
 	
-	// Prevent copy-paste errors when updating this list...
-#define CASE(x)  case x:  result = #x;  break
+	// Make sure we don't rejoin the current session.	
+	sessionState *oldNextSession = mNextAudioSession;
+	mNextAudioSession = NULL;
 	
-	switch(inStatus)
+	// Most likely this will still be the current session at this point, but check it anyway.
+	reapSession(oldNextSession);
+	
+	verifySessionState();
+	
+	sessionTerminate();
+}
+
+std::string LLVoiceClient::getCurrentChannel()
+{
+	std::string result;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
 	{
-			CASE(STATUS_LOGIN_RETRY);
-			CASE(STATUS_LOGGED_IN);
-			CASE(STATUS_JOINING);
-			CASE(STATUS_JOINED);
-			CASE(STATUS_LEFT_CHANNEL);
-			CASE(STATUS_VOICE_DISABLED);
-			CASE(BEGIN_ERROR_STATUS);
-			CASE(ERROR_CHANNEL_FULL);
-			CASE(ERROR_CHANNEL_LOCKED);
-			CASE(ERROR_NOT_AVAILABLE);
-			CASE(ERROR_UNKNOWN);
-		default:
-			break;
+		result = getAudioSessionURI();
 	}
 	
-#undef CASE
+	return result;
+}
+
+bool LLVoiceClient::inProximalChannel()
+{
+	bool result = false;
+	
+	if((getState() == stateRunning) && !mSessionTerminateRequested)
+	{
+		result = inSpatialChannel();
+	}
+	
+	return result;
+}
+
+std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
+{
+	std::string result;
+	result = "sip:";
+	result += nameFromID(id);
+	result += "@";
+	result += mVoiceSIPURIHostName;
+	
+	return result;
+}
+
+std::string LLVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = "sip:";
+		result += nameFromID(avatar->getID());
+		result += "@";
+		result += mVoiceSIPURIHostName;
+	}
 	
 	return result;
 }
 
+std::string LLVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
+{
+	std::string result;
+	if(avatar)
+	{
+		result = nameFromID(avatar->getID());
+	}	
+	return result;
+}
 
+std::string LLVoiceClient::nameFromID(const LLUUID &uuid)
+{
+	std::string result;
+	
+	if (uuid.isNull()) {
+		//VIVOX, the uuid emtpy look for the mURIString and return that instead.
+		//result.assign(uuid.mURIStringName);
+		LLStringUtil::replaceChar(result, '_', ' ');
+		return result;
+	}
+	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
+	result = "x";
+	
+	// Base64 encode and replace the pieces of base64 that are less compatible 
+	// with e-mail local-parts.
+	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
+	result += LLBase64::encode(uuid.mData, UUID_BYTES);
+	LLStringUtil::replaceChar(result, '+', '-');
+	LLStringUtil::replaceChar(result, '/', '_');
+	
+	// If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
+	// echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
+	
+	// The reverse transform can be done with:
+	// echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
+	
+	return result;
+}
 
+bool LLVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
+{
+	bool result = false;
+	
+	// SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
+	// If it is, convert to a bare name before doing the transform.
+	std::string name = nameFromsipURI(inName);
+	
+	// Doesn't look like a SIP URI, assume it's an actual name.
+	if(name.empty())
+		name = inName;
 
-///////////////////////////////////////////////////////////////////////////////////////////////
+	// This will only work if the name is of the proper form.
+	// As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
+	// "xFnPP04IpREWNkuw1cOXlhw=="
+	
+	if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
+	{
+		// The name appears to have the right form.
+
+		// Reverse the transforms done by nameFromID
+		std::string temp = name;
+		LLStringUtil::replaceChar(temp, '-', '+');
+		LLStringUtil::replaceChar(temp, '_', '/');
+
+		U8 rawuuid[UUID_BYTES + 1]; 
+		int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
+		if(len == UUID_BYTES)
+		{
+			// The decode succeeded.  Stuff the bits into the result's UUID
+			memcpy(uuid.mData, rawuuid, UUID_BYTES);
+			result = true;
+		}
+	} 
+	
+	if(!result)
+	{
+		// VIVOX:  not a standard account name, just copy the URI name mURIString field
+		// and hope for the best.  bpj
+		uuid.setNull();  // VIVOX, set the uuid field to nulls
+	}
+	
+	return result;
+}
 
-LLVoiceClient::LLVoiceClient()
+std::string LLVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
 {
-	mVoiceModule = NULL;
+	return avatar->getFullname();
 }
 
-//---------------------------------------------------
-// Basic setup/shutdown
+std::string LLVoiceClient::sipURIFromName(std::string &name)
+{
+	std::string result;
+	result = "sip:";
+	result += name;
+	result += "@";
+	result += mVoiceSIPURIHostName;
 
-LLVoiceClient::~LLVoiceClient()
+//	LLStringUtil::toLower(result);
+
+	return result;
+}
+
+std::string LLVoiceClient::nameFromsipURI(const std::string &uri)
+{
+	std::string result;
+
+	std::string::size_type sipOffset, atOffset;
+	sipOffset = uri.find("sip:");
+	atOffset = uri.find("@");
+	if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
+	{
+		result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
+	}
+	
+	return result;
+}
+
+bool LLVoiceClient::inSpatialChannel(void)
 {
+	bool result = false;
+	
+	if(mAudioSession)
+		result = mAudioSession->mIsSpatial;
+		
+	return result;
 }
 
-void LLVoiceClient::init(LLPumpIO *pump)
+std::string LLVoiceClient::getAudioSessionURI()
+{
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mSIPURI;
+		
+	return result;
+}
+
+std::string LLVoiceClient::getAudioSessionHandle()
 {
-	// Initialize all of the voice modules
-	m_servicePump = pump;
+	std::string result;
+	
+	if(mAudioSession)
+		result = mAudioSession->mHandle;
+		
+	return result;
 }
 
-void LLVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
+
+/////////////////////////////
+// Sending updates of current state
+
+void LLVoiceClient::enforceTether(void)
 {
-	// In the future, we should change this to allow voice module registration
-	// with a table lookup of sorts.
-	std::string voice_server = gSavedSettings.getString("VoiceServerType");
-	LL_DEBUGS("Voice") << "voice server type " << voice_server << LL_ENDL;
-	if(voice_server == "diamondware")
+	LLVector3d tethered	= mCameraRequestedPosition;
+
+	// constrain 'tethered' to within 50m of mAvatarPosition.
 	{
-		mVoiceModule = (LLVoiceModuleInterface *)LLDiamondwareVoiceClient::getInstance();
+		F32 max_dist = 50.0f;
+		LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
+		F32 camera_distance = (F32)camera_offset.magVec();
+		if(camera_distance > max_dist)
+		{
+			tethered = mAvatarPosition + 
+				(max_dist / camera_distance) * camera_offset;
+		}
 	}
-	else if(voice_server == "vivox")
+	
+	if(dist_vec(mCameraPosition, tethered) > 0.1)
 	{
-		mVoiceModule = (LLVoiceModuleInterface *)LLVivoxVoiceClient::getInstance();
+		mCameraPosition = tethered;
+		mSpatialCoordsDirty = true;
 	}
-	else
+}
+
+void LLVoiceClient::updatePosition(void)
+{
+	if(gVoiceClient)
+	{
+		LLViewerRegion *region = gAgent.getRegion();
+		if(region && isAgentAvatarValid())
+		{
+			LLMatrix3 rot;
+			LLVector3d pos;
+
+			// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
+			// They're currently always set to zero.
+
+			// Send the current camera position to the voice code
+			rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (),  LLViewerCamera::getInstance()->getUpAxis());		
+			pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
+			
+			gVoiceClient->setCameraPosition(
+					pos,				// position
+					LLVector3::zero, 	// velocity
+					rot);				// rotation matrix
+					
+			// Send the current avatar position to the voice code
+			rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
+	
+			pos = gAgentAvatarp->getPositionGlobal();
+			// TODO: Can we get the head offset from outside the LLVOAvatar?
+//			pos += LLVector3d(mHeadOffset);
+			pos += LLVector3d(0.f, 0.f, 1.f);
+		
+			gVoiceClient->setAvatarPosition(
+					pos,				// position
+					LLVector3::zero, 	// velocity
+					rot);				// rotation matrix
+		}
+	}
+}
+
+void LLVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	mCameraRequestedPosition = position;
+	
+	if(mCameraVelocity != velocity)
+	{
+		mCameraVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mCameraRot != rot)
 	{
-		mVoiceModule = NULL;
-		return; 
+		mCameraRot = rot;
+		mSpatialCoordsDirty = true;
 	}
-	mVoiceModule->init(m_servicePump);	
-	mVoiceModule->userAuthorized(user_id, agentID);
 }
 
+void LLVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
+{
+	if(dist_vec(mAvatarPosition, position) > 0.1)
+	{
+		mAvatarPosition = position;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarVelocity != velocity)
+	{
+		mAvatarVelocity = velocity;
+		mSpatialCoordsDirty = true;
+	}
+	
+	if(mAvatarRot != rot)
+	{
+		mAvatarRot = rot;
+		mSpatialCoordsDirty = true;
+	}
+}
 
-void LLVoiceClient::terminate()
+bool LLVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
+{
+	bool result = false;
+	
+	if(region)
+	{
+		name = region->getName();
+	}
+	
+	if(!name.empty())
+		result = true;
+	
+	return result;
+}
+
+void LLVoiceClient::leaveChannel(void)
+{
+	if(getState() == stateRunning)
+	{
+		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
+		mChannelName.clear();
+		sessionTerminate();
+	}
+}
+
+void LLVoiceClient::setMuteMic(bool muted)
+{
+	mMuteMic = muted;
+}
+
+bool LLVoiceClient::getMuteMic() const
+{
+	return mMuteMic;
+}
+
+void LLVoiceClient::setUserPTTState(bool ptt)
+{
+	mUserPTTState = ptt;
+}
+
+bool LLVoiceClient::getUserPTTState()
+{
+	return mUserPTTState;
+}
+
+void LLVoiceClient::toggleUserPTTState(void)
+{
+	mUserPTTState = !mUserPTTState;
+}
+
+void LLVoiceClient::setVoiceEnabled(bool enabled)
+{
+	if (enabled != mVoiceEnabled)
+	{
+		mVoiceEnabled = enabled;
+		LLVoiceClientStatusObserver::EStatusType status;
+
+		if (enabled)
+		{
+			LLVoiceChannel::getCurrentVoiceChannel()->activate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
+		}
+		else
+		{
+			// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
+			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
+			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
+		}
+
+		notifyStatusObservers(status);
+	}
+}
+
+bool LLVoiceClient::voiceEnabled()
+{
+	return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
+}
+
+//AD *TODO: investigate possible merge of voiceWorking() and voiceEnabled() into one non-static method
+bool LLVoiceClient::voiceWorking()
+{
+	//Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
+	// Condition with joining spatial num was added to take into account possible problems with connection to voice
+	// server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
+	return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
+}
+
+void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
 {
-	if (mVoiceModule) mVoiceModule->terminate();
-	mVoiceModule = NULL;
+	mLipSyncEnabled = enabled;
 }
 
-const LLVoiceVersionInfo LLVoiceClient::getVersion()
+BOOL LLVoiceClient::lipSyncEnabled()
 {
-	if (mVoiceModule) 
+	   
+	if ( mVoiceEnabled && stateDisabled != getState() )
 	{
-		return mVoiceModule->getVersion();
+		return mLipSyncEnabled;
 	}
 	else
 	{
-		LLVoiceVersionInfo result;
-		result.serverVersion = std::string();
-		result.serverType = std::string();
-		return result;
+		return FALSE;
 	}
 }
 
-void LLVoiceClient::updateSettings()
+void LLVoiceClient::setUsePTT(bool usePTT)
 {
-	if (mVoiceModule) mVoiceModule->updateSettings();
+	if(usePTT && !mUsePTT)
+	{
+		// When the user turns on PTT, reset the current state.
+		mUserPTTState = false;
+	}
+	mUsePTT = usePTT;
 }
 
-//--------------------------------------------------
-// tuning
+void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+{
+	if(!PTTIsToggle && mPTTIsToggle)
+	{
+		// When the user turns off toggle, reset the current state.
+		mUserPTTState = false;
+	}
+	
+	mPTTIsToggle = PTTIsToggle;
+}
 
-void LLVoiceClient::tuningStart()
+bool LLVoiceClient::getPTTIsToggle()
 {
-	if (mVoiceModule) mVoiceModule->tuningStart();
+	return mPTTIsToggle;
 }
 
-void LLVoiceClient::tuningStop()
+void LLVoiceClient::setPTTKey(std::string &key)
 {
-	if (mVoiceModule) mVoiceModule->tuningStop();
+	if(key == "MiddleMouse")
+	{
+		mPTTIsMiddleMouse = true;
+	}
+	else
+	{
+		mPTTIsMiddleMouse = false;
+		if(!LLKeyboard::keyFromString(key, &mPTTKey))
+		{
+			// If the call failed, don't match any key.
+			key = KEY_NONE;
+		}
+	}
 }
 
-bool LLVoiceClient::inTuningMode()
+void LLVoiceClient::setEarLocation(S32 loc)
+{
+	if(mEarLocation != loc)
+	{
+		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
+		
+		mEarLocation = loc;
+		mSpatialCoordsDirty = true;
+	}
+}
+
+void LLVoiceClient::setVoiceVolume(F32 volume)
+{
+	int scaled_volume = scale_speaker_volume(volume);	
+
+	if(scaled_volume != mSpeakerVolume)
+	{
+		int min_volume = scale_speaker_volume(0);
+		if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
+		{
+			mSpeakerMuteDirty = true;
+		}
+
+		mSpeakerVolume = scaled_volume;
+		mSpeakerVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::setMicGain(F32 volume)
+{
+	int scaled_volume = scale_mic_volume(volume);
+	
+	if(scaled_volume != mMicVolume)
+	{
+		mMicVolume = scaled_volume;
+		mMicVolumeDirty = true;
+	}
+}
+
+void LLVoiceClient::keyDown(KEY key, MASK mask)
+{	
+	if (gKeyboard->getKeyRepeated(key))
+	{
+		// ignore auto-repeat keys
+		return;
+	}
+
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+			&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+}
+void LLVoiceClient::keyUp(KEY key, MASK mask)
+{
+	if(!mPTTIsMiddleMouse)
+	{
+		bool down = (mPTTKey != KEY_NONE)
+			&& gKeyboard->getKeyDown(mPTTKey);
+		inputUserControlState(down);
+	}
+}
+void LLVoiceClient::inputUserControlState(bool down)
 {
-	if (mVoiceModule) 
+	if(mPTTIsToggle)
 	{
-		return mVoiceModule->inTuningMode();
+		if(down) // toggle open-mic state on 'down'
+		{
+			toggleUserPTTState();
+		}
 	}
-	else
+	else // set open-mic state as an absolute
 	{
-		return false;
+		setUserPTTState(down);
 	}
 }
-
-void LLVoiceClient::tuningSetMicVolume(float volume)
+void LLVoiceClient::middleMouseState(bool down)
 {
-	if (mVoiceModule) mVoiceModule->tuningSetMicVolume(volume);
+	if(mPTTIsMiddleMouse)
+	{
+		inputUserControlState(down);
+	}
 }
 
-void LLVoiceClient::tuningSetSpeakerVolume(float volume)
+/////////////////////////////
+// Accessors for data related to nearby speakers
+BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
 {
-	if (mVoiceModule) mVoiceModule->tuningSetSpeakerVolume(volume);
+	BOOL result = FALSE;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		// I'm not sure what the semantics of this should be.
+		// For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
+		result = TRUE;
+	}
+	
+	return result;
 }
 
-float LLVoiceClient::tuningGetEnergy(void)
+BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->tuningGetEnergy();
-	}
-	else
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return 0.0;
+		if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
+		{
+			participant->mIsSpeaking = FALSE;
+		}
+		result = participant->mIsSpeaking;
 	}
+	
+	return result;
 }
 
-
-//------------------------------------------------
-// devices
-
-bool LLVoiceClient::deviceSettingsAvailable()
+BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
 {
-	if (mVoiceModule) 
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return mVoiceModule->deviceSettingsAvailable();
+		result = participant->mIsModeratorMuted;
 	}
-	else
+	
+	return result;
+}
+
+F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
+{		
+	F32 result = 0;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return false;
+		result = participant->mPower;
 	}
+	
+	return result;
 }
 
-void LLVoiceClient::refreshDeviceLists(bool clearCurrentList)
-{
-	if (mVoiceModule) mVoiceModule->refreshDeviceLists(clearCurrentList);
-}
 
-void LLVoiceClient::setCaptureDevice(const std::string& name)
+std::string LLVoiceClient::getDisplayName(const LLUUID& id)
 {
-	if (mVoiceModule) mVoiceModule->setCaptureDevice(name);
+	std::string result;
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mDisplayName;
+	}
 	
+	return result;
 }
 
-void LLVoiceClient::setRenderDevice(const std::string& name)
-{
-	if (mVoiceModule) mVoiceModule->setRenderDevice(name);	
-}
 
-const LLVoiceDeviceList& LLVoiceClient::getCaptureDevices()
+BOOL LLVoiceClient::getUsingPTT(const LLUUID& id)
 {
-	static LLVoiceDeviceList nullCaptureDevices;
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getCaptureDevices();
-	}
-	else
+	BOOL result = FALSE;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return nullCaptureDevices;
+		// I'm not sure what the semantics of this should be.
+		// Does "using PTT" mean they're configured with a push-to-talk button?
+		// For now, we know there's no PTT mechanism in place, so nobody is using it.
 	}
+	
+	return result;
 }
 
-
-const LLVoiceDeviceList& LLVoiceClient::getRenderDevices()
+BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
 {
-	static LLVoiceDeviceList nullRenderDevices;	
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getRenderDevices();
-	}
-	else
+	BOOL result = FALSE;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-		return nullRenderDevices;
+		result = participant->mOnMuteList;
 	}
+
+	return result;
 }
 
+// External accessors.
+F32 LLVoiceClient::getUserVolume(const LLUUID& id)
+{
+	// Minimum volume will be returned for users with voice disabled
+	F32 result = VOLUME_MIN;
+	
+	participantState *participant = findParticipantByID(id);
+	if(participant)
+	{
+		result = participant->mVolume;
+
+		// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
+		// LL_DEBUGS("Voice") << "mVolume = " << result <<  " for " << id << LL_ENDL;
+	}
 
-//--------------------------------------------------
-// participants
+	return result;
+}
 
-void LLVoiceClient::getParticipantList(std::set<LLUUID> &participants)
+void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
 {
-	if (mVoiceModule) 
+	if(mAudioSession)
 	{
-	  mVoiceModule->getParticipantList(participants);
+		participantState *participant = findParticipantByID(id);
+		if (participant && !participant->mIsSelf)
+		{
+			if (!is_approx_equal(volume, VOLUME_DEFAULT))
+			{
+				// Store this volume setting for future sessions if it has been
+				// changed from the default
+				LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
+			}
+			else
+			{
+				// Remove stored volume setting if it is returned to the default
+				LLSpeakerVolumeStorage::getInstance()->removeSpeakerVolume(id);
+			}
+
+			participant->mVolume = llclamp(volume, VOLUME_MIN, VOLUME_MAX);
+			participant->mVolumeDirty = true;
+			mAudioSession->mVolumeDirty = true;
+		}
 	}
-	else
+}
+
+std::string LLVoiceClient::getGroupID(const LLUUID& id)
+{
+	std::string result;
+
+	participantState *participant = findParticipantByID(id);
+	if(participant)
 	{
-	  participants = std::set<LLUUID>();
+		result = participant->mGroupID;
 	}
+	
+	return result;
 }
 
-bool LLVoiceClient::isParticipant(const LLUUID &speaker_id)
+BOOL LLVoiceClient::getAreaVoiceDisabled()
 {
-  if(mVoiceModule)
-    {
-      return mVoiceModule->isParticipant(speaker_id);
-    }
-  return false;
+	return mAreaVoiceDisabled;
 }
 
+void LLVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
+{
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
+	
+	if(!mMainSessionGroupHandle.empty())
+	{
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
+		<< "<Filename>" << "" << "</Filename>"
+		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
+		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
+		<< "</Request>\n\n\n";
 
-//--------------------------------------------------
-// text chat
 
+		writeString(stream.str());
+	}
+}
 
-BOOL LLVoiceClient::isSessionTextIMPossible(const LLUUID& id)
+void LLVoiceClient::recordingLoopSave(const std::string& filename)
 {
-	if (mVoiceModule) 
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		return mVoiceModule->isSessionTextIMPossible(id);
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Flush</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
-	else
-	{
-		return FALSE;
-	}	
 }
 
-BOOL LLVoiceClient::isSessionCallBackPossible(const LLUUID& id)
+void LLVoiceClient::recordingStop()
 {
-	if (mVoiceModule) 
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		return mVoiceModule->isSessionCallBackPossible(id);
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
-	else
-	{
-		return FALSE;
-	}	
 }
 
-BOOL LLVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
+void LLVoiceClient::filePlaybackStart(const std::string& filename)
 {
-	if (mVoiceModule) 
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		return mVoiceModule->sendTextMessage(participant_id, message);
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Start</RecordingControlType>" 
+		<< "<Filename>" << filename << "</Filename>"
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
-	else
-	{
-		return FALSE;
-	}	
 }
 
-void LLVoiceClient::endUserIMSession(const LLUUID& participant_id)
+void LLVoiceClient::filePlaybackStop()
 {
-	if (mVoiceModule) 
+//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
+
+	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
 	{
-		mVoiceModule->endUserIMSession(participant_id);
+		std::ostringstream stream;
+		stream
+		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
+		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
+		<< "<RecordingControlType>Stop</RecordingControlType>" 
+		<< "</Request>\n\n\n";
+
+		writeString(stream.str());
 	}
 }
 
-//----------------------------------------------
-// channels
-
-bool LLVoiceClient::inProximalChannel()
+void LLVoiceClient::filePlaybackSetPaused(bool paused)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->inProximalChannel();
-	}
-	else
-	{
-		return false;
-	}
+	// TODO: Implement once Vivox gives me a sample
 }
 
-void LLVoiceClient::setNonSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
+void LLVoiceClient::filePlaybackSetMode(bool vox, float speed)
 {
-	if (mVoiceModule) mVoiceModule->setNonSpatialChannel(uri, credentials);
+	// TODO: Implement once Vivox gives me a sample
 }
 
-void LLVoiceClient::setSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
+LLVoiceClient::sessionState::sessionState() :
+	mErrorStatusCode(0),
+	mMediaStreamState(streamStateUnknown),
+	mTextStreamState(streamStateUnknown),
+	mCreateInProgress(false),
+	mMediaConnectInProgress(false),
+	mVoiceInvitePending(false),
+	mTextInvitePending(false),
+	mSynthesizedCallerID(false),
+	mIsChannel(false),
+	mIsSpatial(false),
+	mIsP2P(false),
+	mIncoming(false),
+	mVoiceEnabled(false),
+	mReconnect(false),
+	mVolumeDirty(false),
+	mMuteDirty(false),
+	mParticipantsChanged(false)
 {
-	if (mVoiceModule) mVoiceModule->setSpatialChannel(uri, credentials);
 }
 
-void LLVoiceClient::leaveNonSpatialChannel()
+LLVoiceClient::sessionState::~sessionState()
 {
-	if (mVoiceModule) mVoiceModule->leaveNonSpatialChannel();
+	removeAllParticipants();
 }
 
-void LLVoiceClient::leaveChannel(void)
+bool LLVoiceClient::sessionState::isCallBackPossible()
 {
-	if (mVoiceModule) mVoiceModule->leaveChannel();
+	// This may change to be explicitly specified by vivox in the future...
+	// Currently, only PSTN P2P calls cannot be returned.
+	// Conveniently, this is also the only case where we synthesize a caller UUID.
+	return !mSynthesizedCallerID;
 }
 
-std::string LLVoiceClient::getCurrentChannel()
+bool LLVoiceClient::sessionState::isTextIMPossible()
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getCurrentChannel();
-	}
-	else
-	{
-		return std::string();
-	}
+	// This may change to be explicitly specified by vivox in the future...
+	return !mSynthesizedCallerID;
 }
 
 
-//---------------------------------------
-// invitations
+LLVoiceClient::sessionIterator LLVoiceClient::sessionsBegin(void)
+{
+	return mSessions.begin();
+}
 
-void LLVoiceClient::callUser(const LLUUID &uuid)
+LLVoiceClient::sessionIterator LLVoiceClient::sessionsEnd(void)
 {
-	if (mVoiceModule) mVoiceModule->callUser(uuid);
+	return mSessions.end();
 }
 
-bool LLVoiceClient::answerInvite(std::string &channelHandle)
+
+LLVoiceClient::sessionState *LLVoiceClient::findSession(const std::string &handle)
 {
-	if (mVoiceModule) 
+	sessionState *result = NULL;
+	sessionMap::iterator iter = mSessionsByHandle.find(&handle);
+	if(iter != mSessionsByHandle.end())
 	{
-		return mVoiceModule->answerInvite(channelHandle);
+		result = iter->second;
 	}
-	else
+	
+	return result;
+}
+
+LLVoiceClient::sessionState *LLVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
+{	
+	sessionState *result = NULL;
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
 	{
-		return false;
+		sessionState *session = *iter;
+		if(session->mCreateInProgress && (session->mSIPURI == uri))
+		{
+			result = session;
+			break;
+		}
 	}
+	
+	return result;
 }
 
-void LLVoiceClient::declineInvite(std::string &channelHandle)
+LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participant_id)
 {
-	if (mVoiceModule) mVoiceModule->declineInvite(channelHandle);
+	sessionState *result = NULL;
+	
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+		if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
+		{
+			result = session;
+			break;
+		}
+	}
+	
+	return result;
 }
 
+LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)
+{
+	sessionState *result = NULL;
+	
+	if(handle.empty())
+	{
+		// No handle supplied.
+		// Check whether there's already a session with this URI
+		for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+		{
+			sessionState *s = *iter;
+			if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
+			{
+				// TODO: I need to think about this logic... it's possible that this case should raise an internal error.
+				result = s;
+				break;
+			}
+		}
+	}
+	else // (!handle.empty())
+	{
+		// Check for an existing session with this handle
+		sessionMap::iterator iter = mSessionsByHandle.find(&handle);
+		
+		if(iter != mSessionsByHandle.end())
+		{
+			result = iter->second;
+		}
+	}
 
-//------------------------------------------
-// Volume/gain
+	if(!result)
+	{
+		// No existing session found.
+		
+		LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
+		result = new sessionState();
+		result->mSIPURI = uri;
+		result->mHandle = handle;
+		
+		mSessions.insert(result);
 
+		if(!result->mHandle.empty())
+		{
+			mSessionsByHandle.insert(sessionMap::value_type(&(result->mHandle), result));
+		}
+	}
+	else
+	{
+		// Found an existing session
+		
+		if(uri != result->mSIPURI)
+		{
+			// TODO: Should this be an internal error?
+			LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
+			setSessionURI(result, uri);
+		}
 
-void LLVoiceClient::setVoiceVolume(F32 volume)
-{
-	if (mVoiceModule) mVoiceModule->setVoiceVolume(volume);
-}
+		if(handle != result->mHandle)
+		{
+			if(handle.empty())
+			{
+				// There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
+				LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
+			}
+			else
+			{
+				// TODO: Should this be an internal error?
+				LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
+				setSessionHandle(result, handle);
+			}
+		}
+		
+		LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
+	}
 
-void LLVoiceClient::setMicGain(F32 volume)
-{
-	if (mVoiceModule) mVoiceModule->setMicGain(volume);
+	verifySessionState();
+		
+	return result;
 }
 
-
-//------------------------------------------
-// enable/disable voice features
-
-bool LLVoiceClient::voiceEnabled()
+void LLVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
 {
-	if (mVoiceModule) 
+	// Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
+	
+	if(!session->mHandle.empty())
 	{
-		return mVoiceModule->voiceEnabled();
+		// Remove session from the map if it should have been there.
+		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
+			}
+
+			mSessionsByHandle.erase(iter);
+		}
+		else
+		{
+			LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
+		}
 	}
-	else
+			
+	session->mHandle = handle;
+
+	if(!handle.empty())
 	{
-		return false;
+		mSessionsByHandle.insert(sessionMap::value_type(&(session->mHandle), session));
 	}
-}
 
-void LLVoiceClient::setVoiceEnabled(bool enabled)
-{
-	if (mVoiceModule) mVoiceModule->setVoiceEnabled(enabled);
+	verifySessionState();
 }
 
-void LLVoiceClient::setLipSyncEnabled(BOOL enabled)
+void LLVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
 {
-	if (mVoiceModule) mVoiceModule->setLipSyncEnabled(enabled);
+	// There used to be a map of session URIs to sessions, which made this complex....
+	session->mSIPURI = uri;
+
+	verifySessionState();
 }
 
-BOOL LLVoiceClient::lipSyncEnabled()
+void LLVoiceClient::deleteSession(sessionState *session)
 {
-	if (mVoiceModule) 
+	// Remove the session from the handle map
+	if(!session->mHandle.empty())
 	{
-		return mVoiceModule->lipSyncEnabled();
+		sessionMap::iterator iter = mSessionsByHandle.find(&(session->mHandle));
+		if(iter != mSessionsByHandle.end())
+		{
+			if(iter->second != session)
+			{
+				LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
+			}
+			mSessionsByHandle.erase(iter);
+		}
 	}
-	else
+
+	// Remove the session from the URI map
+	mSessions.erase(session);
+	
+	// At this point, the session should be unhooked from all lists and all state should be consistent.
+	verifySessionState();
+
+	// If this is the current audio session, clean up the pointer which will soon be dangling.
+	if(mAudioSession == session)
 	{
-		return false;
+		mAudioSession = NULL;
+		mAudioSessionChanged = true;
 	}
-}
-
-void LLVoiceClient::setMuteMic(bool muted)
-{
-	if (mVoiceModule) mVoiceModule->setMuteMic(muted);
-}
 
+	// ditto for the next audio session
+	if(mNextAudioSession == session)
+	{
+		mNextAudioSession = NULL;
+	}
 
-// ----------------------------------------------
-// PTT
+	// delete the session
+	delete session;
+}
 
-void LLVoiceClient::setUserPTTState(bool ptt)
+void LLVoiceClient::deleteAllSessions()
 {
-	if (mVoiceModule) mVoiceModule->setUserPTTState(ptt);
+	LL_DEBUGS("Voice") << "called" << LL_ENDL;
+
+	while(!mSessions.empty())
+	{
+		deleteSession(*(sessionsBegin()));
+	}
+	
+	if(!mSessionsByHandle.empty())
+	{
+		LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
+	}
 }
 
-bool LLVoiceClient::getUserPTTState()
+void LLVoiceClient::verifySessionState(void)
 {
-	if (mVoiceModule) 
+	// This is mostly intended for debugging problems with session state management.
+	LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
+
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
 	{
-		return mVoiceModule->getUserPTTState();
+		sessionState *session = *iter;
+
+		LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
+		
+		if(!session->mHandle.empty())
+		{
+			// every session with a non-empty handle needs to be in the handle map
+			sessionMap::iterator i2 = mSessionsByHandle.find(&(session->mHandle));
+			if(i2 == mSessionsByHandle.end())
+			{
+				LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+			}
+			else
+			{
+				if(i2->second != session)
+				{
+					LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
+				}
+			}
+		}
 	}
-	else
+		
+	// check that every entry in the handle map points to a valid session in the session set
+	for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
 	{
-		return false;
+		sessionState *session = iter->second;
+		sessionIterator i2 = mSessions.find(session);
+		if(i2 == mSessions.end())
+		{
+			LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
+		}
+		else
+		{
+			if(session->mHandle != (*i2)->mHandle)
+			{
+				LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
+			}
+		}
 	}
 }
 
-void LLVoiceClient::setUsePTT(bool usePTT)
+LLVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
+	mURI(uri)
 {
-	if (mVoiceModule) mVoiceModule->setUsePTT(usePTT);
+	mOnlineSL = false;
+	mOnlineSLim = false;
+	mCanSeeMeOnline = true;
+	mHasBlockListEntry = false;
+	mHasAutoAcceptListEntry = false;
+	mNameResolved = false;
+	mInVivoxBuddies = false;
+	mInSLFriends = false;
+	mNeedsNameUpdate = false;
 }
 
-void LLVoiceClient::setPTTIsToggle(bool PTTIsToggle)
+void LLVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
 {
-	if (mVoiceModule) mVoiceModule->setPTTIsToggle(PTTIsToggle);
+	buddyListEntry *buddy = addBuddy(uri, displayName);
+	buddy->mInVivoxBuddies = true;	
 }
 
-bool LLVoiceClient::getPTTIsToggle()
+LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri)
 {
-	if (mVoiceModule) 
+	std::string empty;
+	buddyListEntry *buddy = addBuddy(uri, empty);
+	if(buddy->mDisplayName.empty())
 	{
-		return mVoiceModule->getPTTIsToggle();
-	}
-	else {
-		return false;
+		buddy->mNameResolved = false;
 	}
-
-}
-
-void LLVoiceClient::inputUserControlState(bool down)
-{
-	if (mVoiceModule) mVoiceModule->inputUserControlState(down);	
+	return buddy;
 }
 
-void LLVoiceClient::toggleUserPTTState(void)
+LLVoiceClient::buddyListEntry *LLVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
 {
-	if (mVoiceModule) mVoiceModule->toggleUserPTTState();
-}
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	
+	if(iter != mBuddyListMap.end())
+	{
+		// Found a matching buddy already in the map.
+		LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
+		result = iter->second;
+	}
 
-void LLVoiceClient::keyDown(KEY key, MASK mask)
-{	
-	if (mVoiceModule) mVoiceModule->keyDown(key, mask);
-}
-void LLVoiceClient::keyUp(KEY key, MASK mask)
-{
-	if (mVoiceModule) mVoiceModule->keyUp(key, mask);
-}
-void LLVoiceClient::middleMouseState(bool down)
-{
-	if (mVoiceModule) mVoiceModule->middleMouseState(down);
-}
+	if(!result)
+	{
+		// participant isn't already in one list or the other.
+		LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
+		result = new buddyListEntry(uri);
+		result->mDisplayName = displayName;
 
+		if(IDFromName(uri, result->mUUID)) 
+		{
+			// Extracted UUID from name successfully.
+		}
+		else
+		{
+			LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
+		}
 
-//-------------------------------------------
-// nearby speaker accessors
+		mBuddyListMap.insert(buddyListMap::value_type(&(result->mURI), result));
+	}
+	
+	return result;
+}
 
-BOOL LLVoiceClient::getVoiceEnabled(const LLUUID& id)
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const std::string &uri)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getVoiceEnabled(id);
-	} 
-	else
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	if(iter != mBuddyListMap.end())
 	{
-		return FALSE;
+		result = iter->second;
 	}
+	
+	return result;
 }
 
-std::string LLVoiceClient::getDisplayName(const LLUUID& id)
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddy(const LLUUID &id)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getDisplayName(id);
-	}
-	else
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
 	{
-	  return std::string();
+		if(iter->second->mUUID == id)
+		{
+			result = iter->second;
+			break;
+		}
 	}
+	
+	return result;
 }
 
-bool LLVoiceClient::isVoiceWorking()
+LLVoiceClient::buddyListEntry *LLVoiceClient::findBuddyByDisplayName(const std::string &name)
 {
-	if (mVoiceModule) 
+	buddyListEntry *result = NULL;
+	buddyListMap::iterator iter;
+
+	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
 	{
-		return mVoiceModule->isVoiceWorking();
+		if(iter->second->mDisplayName == name)
+		{
+			result = iter->second;
+			break;
+		}
 	}
-	return false;
+	
+	return result;
 }
 
-BOOL LLVoiceClient::isParticipantAvatar(const LLUUID& id)
+void LLVoiceClient::deleteBuddy(const std::string &uri)
 {
-	if (mVoiceModule) 
+	buddyListMap::iterator iter = mBuddyListMap.find(&uri);
+	if(iter != mBuddyListMap.end())
 	{
-		return mVoiceModule->isParticipantAvatar(id);
+		LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
+		buddyListEntry *buddy = iter->second;
+		mBuddyListMap.erase(iter);
+		delete buddy;
 	}
 	else
 	{
-		return FALSE;
+		LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
 	}
+	
 }
 
-BOOL LLVoiceClient::isOnlineSIP(const LLUUID& id)
+void LLVoiceClient::deleteAllBuddies(void)
 {
-	if (mVoiceModule) 
+	while(!mBuddyListMap.empty())
 	{
-		return mVoiceModule->isOnlineSIP(id);
-	}
-	else
-	{
-		return FALSE;
+		deleteBuddy(*(mBuddyListMap.begin()->first));
 	}
+	
+	// Don't want to correlate with friends list when we've emptied the buddy list.
+	mBuddyListMapPopulated = false;
+	
+	// Don't want to correlate with friends list when we've reset the block rules.
+	mBlockRulesListReceived = false;
+	mAutoAcceptRulesListReceived = false;
 }
 
-BOOL LLVoiceClient::getIsSpeaking(const LLUUID& id)
+void LLVoiceClient::deleteAllBlockRules(void)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getIsSpeaking(id);
-	}
-	else
+	// Clear the block list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
 	{
-		return FALSE;
+		buddy_it->second->mHasBlockListEntry = false;
 	}
 }
 
-BOOL LLVoiceClient::getIsModeratorMuted(const LLUUID& id)
+void LLVoiceClient::deleteAllAutoAcceptRules(void)
 {
-	if (mVoiceModule) 
+	// Clear the auto-accept list entry flags from all local buddy list entries
+	buddyListMap::iterator buddy_it;
+	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
 	{
-		return mVoiceModule->getIsModeratorMuted(id);
+		buddy_it->second->mHasAutoAcceptListEntry = false;
 	}
-	else
+}
+
+void LLVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
+{
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(&blockMask);
+	if(iter != mBuddyListMap.end())
 	{
-		return FALSE;
+		LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
+		buddy = iter->second;
 	}
-}
 
-F32 LLVoiceClient::getCurrentPower(const LLUUID& id)
-{		
-	if (mVoiceModule) 
+	if(buddy == NULL)
 	{
-		return mVoiceModule->getCurrentPower(id);
+		LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
+		buddy = addBuddy(blockMask);
 	}
-	else
+	
+	if(buddy != NULL)
 	{
-		return 0.0;
+		buddy->mHasBlockListEntry = true;
 	}
 }
 
-BOOL LLVoiceClient::getOnMuteList(const LLUUID& id)
+void LLVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->getOnMuteList(id);
-	}
-	else
+	buddyListEntry *buddy = NULL;
+
+	// blockMask is the SIP URI of a friends list entry
+	buddyListMap::iterator iter = mBuddyListMap.find(&autoAcceptMask);
+	if(iter != mBuddyListMap.end())
 	{
-		return FALSE;
+		LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
+		buddy = iter->second;
 	}
-}
 
-F32 LLVoiceClient::getUserVolume(const LLUUID& id)
-{
-	if (mVoiceModule) 
+	if(buddy == NULL)
 	{
-		return mVoiceModule->getUserVolume(id);
+		LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
+		buddy = addBuddy(autoAcceptMask);
 	}
-	else
+
+	if(buddy != NULL)
 	{
-		return 0.0;
+		buddy->mHasAutoAcceptListEntry = true;
 	}
 }
 
-void LLVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
+void LLVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
+{
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mBlockRulesListReceived = true;
+}
+
+void LLVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
+{
+	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
+	mAutoAcceptRulesListReceived = true;
+}
+
+void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+{
+	mParticipantObservers.insert(observer);
+}
+
+void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->setUserVolume(id, volume);
+	mParticipantObservers.erase(observer);
 }
 
-//--------------------------------------------------
-// status observers
+void LLVoiceClient::notifyParticipantObservers()
+{
+	for (observer_set_t::iterator it = mParticipantObservers.begin();
+		it != mParticipantObservers.end();
+		)
+	{
+		LLVoiceClientParticipantObserver* observer = *it;
+		observer->onChange();
+		// In case onChange() deleted an entry.
+		it = mParticipantObservers.upper_bound(observer);
+	}
+}
 
 void LLVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	mStatusObservers.insert(observer);
 }
 
 void LLVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	mStatusObservers.erase(observer);
+}
+
+void LLVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
+{
+	if(mAudioSession)
+	{
+		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 20713:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; 		break;
+				case 20714:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; 	break;
+				case 20715:
+					//invalid channel, we may be using a set of poorly cached
+					//info
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+				case 1009:
+					//invalid username and password
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+					break;
+			}
+
+			// Reset the error code to make sure it won't be reused later by accident.
+			mAudioSession->mErrorStatusCode = 0;
+		}
+		else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
+		{
+			switch(mAudioSession->mErrorStatusCode)
+			{
+				case 404:	// NOT_FOUND
+				case 480:	// TEMPORARILY_UNAVAILABLE
+				case 408:	// REQUEST_TIMEOUT
+					// call failed because other user was not available
+					// treat this as an error case
+					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
+
+					// Reset the error code to make sure it won't be reused later by accident.
+					mAudioSession->mErrorStatusCode = 0;
+				break;
+			}
+		}
+	}
+		
+	LL_DEBUGS("Voice") 
+		<< " " << LLVoiceClientStatusObserver::status2string(status)  
+		<< ", session URI " << getAudioSessionURI() 
+		<< (inSpatialChannel()?", proximal is true":", proximal is false")
+	<< LL_ENDL;
+
+	for (status_observer_set_t::iterator it = mStatusObservers.begin();
+		it != mStatusObservers.end();
+		)
+	{
+		LLVoiceClientStatusObserver* observer = *it;
+		observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
+		// In case onError() deleted an entry.
+		it = mStatusObservers.upper_bound(observer);
+	}
+
 }
 
 void LLVoiceClient::addObserver(LLFriendObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	mFriendObservers.insert(observer);
 }
 
 void LLVoiceClient::removeObserver(LLFriendObserver* observer)
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	mFriendObservers.erase(observer);
 }
 
-void LLVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
+void LLVoiceClient::notifyFriendObservers()
 {
-	if (mVoiceModule) mVoiceModule->addObserver(observer);
+	for (friend_observer_set_t::iterator it = mFriendObservers.begin();
+		it != mFriendObservers.end();
+		)
+	{
+		LLFriendObserver* observer = *it;
+		it++;
+		// The only friend-related thing we notify on is online/offline transitions.
+		observer->changed(LLFriendObserver::ONLINE);
+	}
 }
 
-void LLVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
+void LLVoiceClient::lookupName(const LLUUID &id)
 {
-	if (mVoiceModule) mVoiceModule->removeObserver(observer);
+	BOOL is_group = FALSE;
+	gCacheName->get(id, is_group, &LLVoiceClient::onAvatarNameLookup);
 }
 
-std::string LLVoiceClient::sipURIFromID(const LLUUID &id)
+//static
+void LLVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
 {
-	if (mVoiceModule) 
-	{
-		return mVoiceModule->sipURIFromID(id);
-	}
-	else
+	if(gVoiceClient)
 	{
-		return std::string();
+		std::string name = llformat("%s %s", first.c_str(), last.c_str());
+		gVoiceClient->avatarNameResolved(id, name);
 	}
 }
 
-
-///////////////////
-// version checking
-
-class LLViewerRequiredVoiceVersion : public LLHTTPNode
+void LLVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
 {
-	static BOOL sAlertedUser;
-	virtual void post(
-					  LLHTTPNode::ResponsePtr response,
-					  const LLSD& context,
-					  const LLSD& input) const
+	// If the avatar whose name just resolved is on our friends list, resync the friends list.
+	if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
 	{
-		//You received this messsage (most likely on region cross or
-		//teleport)
-		if ( input.has("body") && input["body"].has("major_version") )
+		mFriendsListDirty = true;
+	}
+	
+	// Iterate over all sessions.
+	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
+	{
+		sessionState *session = *iter;
+
+		// Check for this user as a participant in this session
+		participantState *participant = session->findParticipantByID(id);
+		if(participant)
 		{
-			int major_voice_version =
-			input["body"]["major_version"].asInteger();
-			// 			int minor_voice_version =
-			// 				input["body"]["minor_version"].asInteger();
-			LLVoiceVersionInfo versionInfo = LLVoiceClient::getInstance()->getVersion();
-			
-			if (major_voice_version > 1)
+			// Found -- fill in the name
+			participant->mAccountName = name;
+			// and post a "participants updated" message to listeners later.
+			session->mParticipantsChanged = true;
+		}
+		
+		// Check whether this is a p2p session whose caller name just resolved
+		if(session->mCallerID == id)
+		{
+			// this session's "caller ID" just resolved.  Fill in the name.
+			session->mName = name;
+			if(session->mTextInvitePending)
 			{
-				if (!sAlertedUser)
-				{
-					//sAlertedUser = TRUE;
-					LLNotificationsUtil::add("VoiceVersionMismatch");
-					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
-				}
+				session->mTextInvitePending = false;
+
+				// We don't need to call gIMMgr->addP2PSession() here.  The first incoming message will create the panel.				
+			}
+			if(session->mVoiceInvitePending)
+			{
+				session->mVoiceInvitePending = false;
+
+				gIMMgr->inviteToSession(
+					session->mIMSessionID,
+					session->mName,
+					session->mCallerID, 
+					session->mName, 
+					IM_SESSION_P2P_INVITE, 
+					LLIMMgr::INVITATION_TYPE_VOICE,
+					session->mHandle,
+					session->mSIPURI);
 			}
+			
 		}
 	}
-};
+}
 
 class LLViewerParcelVoiceInfo : public LLHTTPNode
 {
 	virtual void post(
-					  LLHTTPNode::ResponsePtr response,
-					  const LLSD& context,
-					  const LLSD& input) const
+		LLHTTPNode::ResponsePtr response,
+		const LLSD& context,
+		const LLSD& input) const
 	{
 		//the parcel you are in has changed something about its
 		//voice information
-		
+
 		//this is a misnomer, as it can also be when you are not in
 		//a parcel at all.  Should really be something like
 		//LLViewerVoiceInfoChanged.....
 		if ( input.has("body") )
 		{
 			LLSD body = input["body"];
-			
+
 			//body has "region_name" (str), "parcel_local_id"(int),
 			//"voice_credentials" (map).
-			
+
 			//body["voice_credentials"] has "channel_uri" (str),
 			//body["voice_credentials"] has "channel_credentials" (str)
-			
+
 			//if we really wanted to be extra careful,
 			//we'd check the supplied
 			//local parcel id to make sure it's for the same parcel
@@ -764,7 +7279,7 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				LLSD voice_credentials = body["voice_credentials"];
 				std::string uri;
 				std::string credentials;
-				
+
 				if ( voice_credentials.has("channel_uri") )
 				{
 					uri = voice_credentials["channel_uri"].asString();
@@ -772,96 +7287,51 @@ class LLViewerParcelVoiceInfo : public LLHTTPNode
 				if ( voice_credentials.has("channel_credentials") )
 				{
 					credentials =
-					voice_credentials["channel_credentials"].asString();
+						voice_credentials["channel_credentials"].asString();
 				}
-				
-				LLVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
+
+				gVoiceClient->setSpatialChannel(uri, credentials);
 			}
 		}
 	}
 };
 
-const std::string LLSpeakerVolumeStorage::SETTINGS_FILE_NAME = "volume_settings.xml";
-
-LLSpeakerVolumeStorage::LLSpeakerVolumeStorage()
-{
-	load();
-}
-
-LLSpeakerVolumeStorage::~LLSpeakerVolumeStorage()
-{
-	save();
-}
-
-void LLSpeakerVolumeStorage::storeSpeakerVolume(const LLUUID& speaker_id, F32 volume)
-{
-	mSpeakersData[speaker_id] = volume;
-}
-
-S32 LLSpeakerVolumeStorage::getSpeakerVolume(const LLUUID& speaker_id)
-{
-	// Return value of -1 indicates no level is stored for this speaker
-	S32 ret_val = -1;
-	speaker_data_map_t::const_iterator it = mSpeakersData.find(speaker_id);
-	
-	if (it != mSpeakersData.end())
-	{
-		F32 f_val = it->second;
-		// volume can amplify by as much as 4x!
-		S32 ivol = (S32)(400.f * f_val * f_val);
-		ret_val = llclamp(ivol, 0, 400);
-	}
-	return ret_val;
-}
-
-void LLSpeakerVolumeStorage::load()
-{
-	// load per-resident voice volume information
-	std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-
-	LLSD settings_llsd;
-	llifstream file;
-	file.open(filename);
-	if (file.is_open())
-	{
-		LLSDSerialize::fromXML(settings_llsd, file);
-	}
-
-	for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
-		iter != settings_llsd.endMap(); ++iter)
-	{
-		mSpeakersData.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal()));
-	}
-}
-
-void LLSpeakerVolumeStorage::save()
+class LLViewerRequiredVoiceVersion : public LLHTTPNode
 {
-	// If we quit from the login screen we will not have an SL account
-	// name.  Don't try to save, otherwise we'll dump a file in
-	// C:\Program Files\SecondLife\ or similar. JC
-	std::string user_dir = gDirUtilp->getLindenUserDir();
-	if (!user_dir.empty())
+	static BOOL sAlertedUser;
+	virtual void post(
+		LLHTTPNode::ResponsePtr response,
+		const LLSD& context,
+		const LLSD& input) const
 	{
-		std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, SETTINGS_FILE_NAME);
-		LLSD settings_llsd;
-
-		for(speaker_data_map_t::const_iterator iter = mSpeakersData.begin(); iter != mSpeakersData.end(); ++iter)
+		//You received this messsage (most likely on region cross or
+		//teleport)
+		if ( input.has("body") && input["body"].has("major_version") )
 		{
-			settings_llsd[iter->first.asString()] = iter->second;
-		}
+			int major_voice_version =
+				input["body"]["major_version"].asInteger();
+// 			int minor_voice_version =
+// 				input["body"]["minor_version"].asInteger();
 
-		llofstream file;
-		file.open(filename);
-		LLSDSerialize::toPrettyXML(settings_llsd, file);
+			if (gVoiceClient &&
+				(major_voice_version > VOICE_MAJOR_VERSION) )
+			{
+				if (!sAlertedUser)
+				{
+					//sAlertedUser = TRUE;
+					LLNotificationsUtil::add("VoiceVersionMismatch");
+					gSavedSettings.setBOOL("EnableVoiceChat", FALSE); // toggles listener
+				}
+			}
+		}
 	}
-}
-
+};
 BOOL LLViewerRequiredVoiceVersion::sAlertedUser = FALSE;
 
 LLHTTPRegistration<LLViewerParcelVoiceInfo>
-gHTTPRegistrationMessageParcelVoiceInfo(
-										"/message/ParcelVoiceInfo");
+    gHTTPRegistrationMessageParcelVoiceInfo(
+		"/message/ParcelVoiceInfo");
 
 LLHTTPRegistration<LLViewerRequiredVoiceVersion>
-gHTTPRegistrationMessageRequiredVoiceVersion(
-											 "/message/RequiredVoiceVersion");
+    gHTTPRegistrationMessageRequiredVoiceVersion(
+		"/message/RequiredVoiceVersion");
diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h
index f1a7d3dbec..a29c386182 100644
--- a/indra/newview/llvoiceclient.h
+++ b/indra/newview/llvoiceclient.h
@@ -17,7 +17,8 @@
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  * 
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
@@ -32,6 +33,7 @@
 #define LL_VOICE_CLIENT_H
 
 class LLVOAvatar;
+class LLVivoxProtocolParser;
 
 #include "lliopipe.h"
 #include "llpumpio.h"
@@ -40,14 +42,9 @@ class LLVOAvatar;
 #include "v3math.h"
 #include "llframetimer.h"
 #include "llviewerregion.h"
-#include "llcallingcard.h"   // for LLFriendObserver
-#include "llsecapi.h"
-
-// devices
-
-typedef std::vector<std::string> LLVoiceDeviceList;	
-
+#include "m3math.h"			// LLMatrix3
 
+class LLFriendObserver;
 class LLVoiceClientParticipantObserver
 {
 public:
@@ -55,9 +52,6 @@ public:
 	virtual void onChange() = 0;
 };
 
-
-///////////////////////////////////
-/// @class LLVoiceClientStatusObserver
 class LLVoiceClientStatusObserver
 {
 public:
@@ -71,7 +65,11 @@ public:
 		STATUS_JOINED,
 		STATUS_LEFT_CHANNEL,
 		STATUS_VOICE_DISABLED,
+
+		// Adding STATUS_VOICE_ENABLED as pair status for STATUS_VOICE_DISABLED
+		// See LLVoiceClient::setVoiceEnabled()
 		STATUS_VOICE_ENABLED,
+
 		BEGIN_ERROR_STATUS,
 		ERROR_CHANNEL_FULL,
 		ERROR_CHANNEL_LOCKED,
@@ -85,367 +83,699 @@ public:
 	static std::string status2string(EStatusType inStatus);
 };
 
-struct LLVoiceVersionInfo
+class LLVoiceClient: public LLSingleton<LLVoiceClient>
 {
-	std::string serverType;
-	std::string serverVersion;
-};
+	LOG_CLASS(LLVoiceClient);
+	public:
+		LLVoiceClient();	
+		~LLVoiceClient();
+		
+	public:
+		static void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
+		static void terminate();	// Call this to clean up during shutdown
+						
+	protected:
+		bool writeString(const std::string &str);
+
+	public:
+		
+		static F32 OVERDRIVEN_POWER_LEVEL;
 
-//////////////////////////////////
-/// @class LLVoiceModuleInterface
-/// @brief Voice module interface
-///
-/// Voice modules should provide an implementation for this interface.
-/////////////////////////////////
+		static const F32 VOLUME_MIN;
+		static const F32 VOLUME_DEFAULT;
+		static const F32 VOLUME_MAX;
 
-class LLVoiceModuleInterface
-{
-public:
-	LLVoiceModuleInterface() {}
-	virtual ~LLVoiceModuleInterface() {}
-	
-	virtual void init(LLPumpIO *pump)=0;	// Call this once at application startup (creates connector)
-	virtual void terminate()=0;	// Call this to clean up during shutdown
-	
-	virtual void updateSettings()=0; // call after loading settings and whenever they change
+		void updateSettings(); // call after loading settings and whenever they change
 	
-	virtual bool isVoiceWorking()=0; // connected to a voice server and voice channel
+		void getCaptureDevicesSendMessage();
+		void getRenderDevicesSendMessage();
+		
+		void clearCaptureDevices();
+		void addCaptureDevice(const std::string& name);
+		void setCaptureDevice(const std::string& name);
+		
+		void clearRenderDevices();
+		void addRenderDevice(const std::string& name);
+		void setRenderDevice(const std::string& name);
+
+		void tuningStart();
+		void tuningStop();
+		bool inTuningMode();
+		bool inTuningStates();
+		
+		void tuningRenderStartSendMessage(const std::string& name, bool loop);
+		void tuningRenderStopSendMessage();
 
-	virtual const LLVoiceVersionInfo& getVersion()=0;
-	
-	/////////////////////
-	/// @name Tuning
-	//@{
-	virtual void tuningStart()=0;
-	virtual void tuningStop()=0;
-	virtual bool inTuningMode()=0;
-	
-	virtual void tuningSetMicVolume(float volume)=0;
-	virtual void tuningSetSpeakerVolume(float volume)=0;
-	virtual float tuningGetEnergy(void)=0;
-	//@}
-	
-	/////////////////////
-	/// @name Devices
-	//@{
-	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-	// i.e. when the daemon is running and connected, and the device lists are populated.
-	virtual bool deviceSettingsAvailable()=0;
-	
-	// Requery the vivox daemon for the current list of input/output devices.
-	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-	// (use this if you want to know when it's done).
-	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-	virtual void refreshDeviceLists(bool clearCurrentList = true)=0;
-	
-	virtual void setCaptureDevice(const std::string& name)=0;
-	virtual void setRenderDevice(const std::string& name)=0;
-	
-	virtual LLVoiceDeviceList& getCaptureDevices()=0;
-	virtual LLVoiceDeviceList& getRenderDevices()=0;
-	
-	virtual void getParticipantList(std::set<LLUUID> &participants)=0;
-	virtual bool isParticipant(const LLUUID& speaker_id)=0;
-	//@}
-	
-	////////////////////////////
-	/// @ name Channel stuff
-	//@{
-	// returns true iff the user is currently in a proximal (local spatial) channel.
-	// Note that gestures should only fire if this returns true.
-	virtual bool inProximalChannel()=0;
-	
-	virtual void setNonSpatialChannel(const std::string &uri,
-									  const std::string &credentials)=0;
-	
-	virtual void setSpatialChannel(const std::string &uri,
-								   const std::string &credentials)=0;
-	
-	virtual void leaveNonSpatialChannel()=0;
-	
-	virtual void leaveChannel(void)=0;	
-	
-	// Returns the URI of the current channel, or an empty string if not currently in a channel.
-	// NOTE that it will return an empty string if it's in the process of joining a channel.
-	virtual std::string getCurrentChannel()=0;
-	//@}
-	
-	
-	//////////////////////////
-	/// @name invitations
-	//@{
-	// start a voice channel with the specified user
-	virtual void callUser(const LLUUID &uuid)=0;
-	virtual bool answerInvite(std::string &channelHandle)=0;
-	virtual void declineInvite(std::string &channelHandle)=0;
-	//@}
-	
-	/////////////////////////
-	/// @name Volume/gain
-	//@{
-	virtual void setVoiceVolume(F32 volume)=0;
-	virtual void setMicGain(F32 volume)=0;
-	//@}
-	
-	/////////////////////////
-	/// @name enable disable voice and features
-	//@{
-	virtual bool voiceEnabled()=0;
-	virtual void setVoiceEnabled(bool enabled)=0;
-	virtual void setLipSyncEnabled(BOOL enabled)=0;
-	virtual BOOL lipSyncEnabled()=0;	
-	virtual void setMuteMic(bool muted)=0;		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-	//@}
-	
-	////////////////////////
-	/// @name PTT
-	//@{
-	virtual void setUserPTTState(bool ptt)=0;
-	virtual bool getUserPTTState()=0;
-	virtual void setUsePTT(bool usePTT)=0;
-	virtual void setPTTIsToggle(bool PTTIsToggle)=0;
-	virtual bool getPTTIsToggle()=0;	
-	virtual void toggleUserPTTState(void)=0;
-	virtual void inputUserControlState(bool down)=0;  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
-	
-	virtual void keyDown(KEY key, MASK mask)=0;
-	virtual void keyUp(KEY key, MASK mask)=0;
-	virtual void middleMouseState(bool down)=0;
-	//@}
-	
-	//////////////////////////
-	/// @name nearby speaker accessors
-	//@{
-
-
-	virtual BOOL getVoiceEnabled(const LLUUID& id)=0;		// true if we've received data for this avatar
-	virtual std::string getDisplayName(const LLUUID& id)=0;
-	virtual BOOL isOnlineSIP(const LLUUID &id)=0;	
-	virtual BOOL isParticipantAvatar(const LLUUID &id)=0;
-	virtual BOOL getIsSpeaking(const LLUUID& id)=0;
-	virtual BOOL getIsModeratorMuted(const LLUUID& id)=0;
-	virtual F32 getCurrentPower(const LLUUID& id)=0;		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-	virtual BOOL getOnMuteList(const LLUUID& id)=0;
-	virtual F32 getUserVolume(const LLUUID& id)=0;
-	virtual void setUserVolume(const LLUUID& id, F32 volume)=0; // set's volume for specified agent, from 0-1 (where .5 is nominal)	
-	//@}
-	
-	//////////////////////////
-	/// @name text chat
-	//@{
-	virtual BOOL isSessionTextIMPossible(const LLUUID& id)=0;
-	virtual BOOL isSessionCallBackPossible(const LLUUID& id)=0;
-	virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message)=0;
-	virtual void endUserIMSession(const LLUUID &uuid)=0;	
-	//@}
-	
-	// authorize the user
-	virtual void userAuthorized(const std::string& user_id,
-								const LLUUID &agentID)=0;
-	
-	//////////////////////////////
-	/// @name Status notification
-	//@{
-	virtual void addObserver(LLVoiceClientStatusObserver* observer)=0;
-	virtual void removeObserver(LLVoiceClientStatusObserver* observer)=0;
-	virtual void addObserver(LLFriendObserver* observer)=0;
-	virtual void removeObserver(LLFriendObserver* observer)=0;	
-	virtual void addObserver(LLVoiceClientParticipantObserver* observer)=0;
-	virtual void removeObserver(LLVoiceClientParticipantObserver* observer)=0;	
-	//@}
-	
-	virtual std::string sipURIFromID(const LLUUID &id)=0;
-	//@}
-	
-};
+		void tuningCaptureStartSendMessage(int duration);
+		void tuningCaptureStopSendMessage();
+		
+		void tuningSetMicVolume(float volume);
+		void tuningSetSpeakerVolume(float volume);
+		float tuningGetEnergy(void);
+				
+		// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
+		// i.e. when the daemon is running and connected, and the device lists are populated.
+		bool deviceSettingsAvailable();
+		
+		// Requery the vivox daemon for the current list of input/output devices.
+		// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
+		// (use this if you want to know when it's done).
+		// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
+		void refreshDeviceLists(bool clearCurrentList = true);
+		
+		// Call this if the connection to the daemon terminates unexpectedly.  It will attempt to reset everything and relaunch.
+		void daemonDied();
 
+		// Call this if we're just giving up on voice (can't provision an account, etc.).  It will clean up and go away.
+		void giveUp();
+		
+		/////////////////////////////
+		// Response/Event handlers
+		void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
+		void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
+		void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+		void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
+		void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
+		void logoutResponse(int statusCode, std::string &statusString);
+		void connectorShutdownResponse(int statusCode, std::string &statusString);
+
+		void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
+		void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
+		void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
+		void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
+		void sessionGroupAddedEvent(std::string &sessionGroupHandle);
+		void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
+		void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
+		void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
+		void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
+		void auxAudioPropertiesEvent(F32 energy);
+		void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
+		void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
+		void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
+		void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
+		
+		void buddyListChanged();
+		void muteListChanged();
+		void updateFriends(U32 mask);
+		
+		/////////////////////////////
+		// Sending updates of current state
+static	void updatePosition(void);
+		void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+		void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
+		bool channelFromRegion(LLViewerRegion *region, std::string &name);
+		void leaveChannel(void);		// call this on logout or teleport begin
 
-class LLVoiceClient: public LLSingleton<LLVoiceClient>
-{
-	LOG_CLASS(LLVoiceClient);
-public:
-	LLVoiceClient();	
-	~LLVoiceClient();
+		
+		void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
+		bool getMuteMic() const;
+		void setUserPTTState(bool ptt);
+		bool getUserPTTState();
+		void toggleUserPTTState(void);
+		void inputUserControlState(bool down); // interpret any sort of up-down mic-open control input according to ptt-toggle prefs
+		void setVoiceEnabled(bool enabled);
+		static bool voiceEnabled();
+		// Checks is voice working judging from mState
+		// Returns true if vivox has successfully logged in and is not in error state
+		bool voiceWorking();
+		void setUsePTT(bool usePTT);
+		void setPTTIsToggle(bool PTTIsToggle);
+		bool getPTTIsToggle();
+		void setPTTKey(std::string &key);
+		void setEarLocation(S32 loc);
+		void setVoiceVolume(F32 volume);
+		void setMicGain(F32 volume);
+		void setUserVolume(const LLUUID& id, F32 volume); // sets volume for specified agent, from 0-1 (where .5 is nominal)
+		void setLipSyncEnabled(BOOL enabled);
+		BOOL lipSyncEnabled();
+
+		// PTT key triggering
+		void keyDown(KEY key, MASK mask);
+		void keyUp(KEY key, MASK mask);
+		void middleMouseState(bool down);
+
+		// Return the version of the Vivox library
+		std::string getAPIVersion() const { return mAPIVersion; }
+		
+		/////////////////////////////
+		// Accessors for data related to nearby speakers
+		BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
+		BOOL getIsSpeaking(const LLUUID& id);
+		BOOL getIsModeratorMuted(const LLUUID& id);
+		F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
+		BOOL getOnMuteList(const LLUUID& id);
+		F32 getUserVolume(const LLUUID& id);
+		std::string getDisplayName(const LLUUID& id);
+		
+		// MBW -- XXX -- Not sure how to get this data out of the TVC
+		BOOL getUsingPTT(const LLUUID& id);
+		std::string getGroupID(const LLUUID& id);		// group ID if the user is in group chat (empty string if not applicable)
 
-	void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
-	void terminate();	// Call this to clean up during shutdown
-	
-	const LLVoiceVersionInfo getVersion();
-	
-static const F32 OVERDRIVEN_POWER_LEVEL;
+		/////////////////////////////
+		BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
+											// Use this to determine whether to show a "no speech" icon in the menu bar.
+		
+		/////////////////////////////
+		// Recording controls
+		void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
+		void recordingLoopSave(const std::string& filename);
+		void recordingStop();
+		
+		// Playback controls
+		void filePlaybackStart(const std::string& filename);
+		void filePlaybackStop();
+		void filePlaybackSetPaused(bool paused);
+		void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
+		
+		
+		// This is used by the string-keyed maps below, to avoid storing the string twice.
+		// The 'const std::string *' in the key points to a string actually stored in the object referenced by the map.
+		// The add and delete operations for each map allocate and delete in the right order to avoid dangling references.
+		// The default compare operation would just compare pointers, which is incorrect, so they must use this comparitor instead.
+		struct stringMapComparitor
+		{
+			bool operator()(const std::string* a, const std::string * b) const
+			{
+				return a->compare(*b) < 0;
+			}
+		};
+
+		struct uuidMapComparitor
+		{
+			bool operator()(const LLUUID* a, const LLUUID * b) const
+			{
+				return *a < *b;
+			}
+		};
+		
+		struct participantState
+		{
+		public:
+			participantState(const std::string &uri);
+
+			bool updateMuteState();	// true if mute state has changed
+			bool isAvatar();
+
+			std::string mURI;
+			LLUUID mAvatarID;
+			std::string mAccountName;
+			std::string mDisplayName;
+			LLFrameTimer mSpeakingTimeout;
+			F32	mLastSpokeTimestamp;
+			F32 mPower;
+			F32 mVolume;
+			std::string mGroupID;
+			bool mPTT;
+			bool mIsSpeaking;
+			bool mIsModeratorMuted;
+			bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
+			bool mVolumeSet;		// true if incoming volume messages should not change the volume
+			bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
+			bool mAvatarIDValid;
+			bool mIsSelf;
+		};
+		typedef std::map<const std::string *, participantState*, stringMapComparitor> participantMap;
+
+		typedef std::map<const LLUUID *, participantState*, uuidMapComparitor> participantUUIDMap;
+	
+		enum streamState
+		{
+			streamStateUnknown = 0,
+			streamStateIdle = 1,
+			streamStateConnected = 2,
+			streamStateRinging = 3,
+		};
+		
+		struct sessionState
+		{
+		public:
+			sessionState();
+			~sessionState();
+
+			participantState *addParticipant(const std::string &uri);
+			// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
+			// Take care not to use the pointer again after that.
+			void removeParticipant(participantState *participant);
+			void removeAllParticipants();
+
+			participantState *findParticipant(const std::string &uri);
+			participantState *findParticipantByID(const LLUUID& id);
+
+			bool isCallBackPossible();
+			bool isTextIMPossible();
+
+			std::string mHandle;
+			std::string mGroupHandle;
+			std::string mSIPURI;
+			std::string mAlias;
+			std::string mName;
+			std::string mAlternateSIPURI;
+			std::string mHash;			// Channel password
+			std::string mErrorStatusString;
+			std::queue<std::string> mTextMsgQueue;
+			
+			LLUUID		mIMSessionID;
+			LLUUID		mCallerID;
+			int			mErrorStatusCode;
+			int			mMediaStreamState;
+			int			mTextStreamState;
+			bool		mCreateInProgress;	// True if a Session.Create has been sent for this session and no response has been received yet.
+			bool		mMediaConnectInProgress;	// True if a Session.MediaConnect has been sent for this session and no response has been received yet.
+			bool		mVoiceInvitePending;	// True if a voice invite is pending for this session (usually waiting on a name lookup)
+			bool		mTextInvitePending;		// True if a text invite is pending for this session (usually waiting on a name lookup)
+			bool		mSynthesizedCallerID;	// True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
+			bool		mIsChannel;	// True for both group and spatial channels (false for p2p, PSTN)
+			bool		mIsSpatial;	// True for spatial channels
+			bool		mIsP2P;
+			bool		mIncoming;
+			bool		mVoiceEnabled;
+			bool		mReconnect;	// Whether we should try to reconnect to this session if it's dropped
+			// Set to true when the mute state of someone in the participant list changes.
+			// The code will have to walk the list to find the changed participant(s).
+			bool		mVolumeDirty;
+			bool		mMuteDirty;
+
+			bool		mParticipantsChanged;
+			participantMap mParticipantsByURI;
+			participantUUIDMap mParticipantsByUUID;
+		};
+
+		participantState *findParticipantByID(const LLUUID& id);
+		participantMap *getParticipantList(void);
+		void getParticipantsUUIDSet(std::set<LLUUID>& participant_uuids);
+		
+		typedef std::map<const std::string*, sessionState*, stringMapComparitor> sessionMap;
+		typedef std::set<sessionState*> sessionSet;
+				
+		typedef sessionSet::iterator sessionIterator;
+		sessionIterator sessionsBegin(void);
+		sessionIterator sessionsEnd(void);
+
+		sessionState *findSession(const std::string &handle);
+		sessionState *findSessionBeingCreatedByURI(const std::string &uri);
+		sessionState *findSession(const LLUUID &participant_id);
+		sessionState *findSessionByCreateID(const std::string &create_id);
+		
+		sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
+		void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
+		void setSessionURI(sessionState *session, const std::string &uri);
+		void deleteSession(sessionState *session);
+		void deleteAllSessions(void);
 
-	void updateSettings(); // call after loading settings and whenever they change
+		void verifySessionState(void);
 
-	bool isVoiceWorking(); // connected to a voice server and voice channel
+		void joinedAudioSession(sessionState *session);
+		void leftAudioSession(sessionState *session);
 
-	// tuning
-	void tuningStart();
-	void tuningStop();
-	bool inTuningMode();
+		// This is called in several places where the session _may_ need to be deleted.
+		// It contains logic for whether to delete the session or keep it around.
+		void reapSession(sessionState *session);
+		
+		// Returns true if the session seems to indicate we've moved to a region on a different voice server
+		bool sessionNeedsRelog(sessionState *session);
+		
+		struct buddyListEntry
+		{
+			buddyListEntry(const std::string &uri);
+			std::string mURI;
+			std::string mDisplayName;
+			LLUUID	mUUID;
+			bool mOnlineSL;
+			bool mOnlineSLim;
+			bool mCanSeeMeOnline;
+			bool mHasBlockListEntry;
+			bool mHasAutoAcceptListEntry;
+			bool mNameResolved;
+			bool mInSLFriends;
+			bool mInVivoxBuddies;
+			bool mNeedsNameUpdate;
+		};
+
+		typedef std::map<const std::string*, buddyListEntry*, stringMapComparitor> buddyListMap;
+		
+		// This should be called when parsing a buddy list entry sent by SLVoice.		
+		void processBuddyListEntry(const std::string &uri, const std::string &displayName);
+
+		buddyListEntry *addBuddy(const std::string &uri);
+		buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
+		buddyListEntry *findBuddy(const std::string &uri);
+		buddyListEntry *findBuddy(const LLUUID &id);
+		buddyListEntry *findBuddyByDisplayName(const std::string &name);
+		void deleteBuddy(const std::string &uri);
+		void deleteAllBuddies(void);
+
+		void deleteAllBlockRules(void);
+		void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
+		void deleteAllAutoAcceptRules(void);
+		void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
+		void accountListBlockRulesResponse(int statusCode, const std::string &statusString);						
+		void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);						
+		
+		/////////////////////////////
+		// session control messages
+		void connectorCreate();
+		void connectorShutdown();
+
+		void requestVoiceAccountProvision(S32 retries = 3);
+		void userAuthorized(
+			const std::string& firstName,
+			const std::string& lastName,
+			const LLUUID &agentID);
+		void login(
+			const std::string& account_name,
+			const std::string& password,
+			const std::string& voice_sip_uri_hostname,
+			const std::string& voice_account_server_uri);
+		void loginSendMessage();
+		void logout();
+		void logoutSendMessage();
+
+		void accountListBlockRulesSendMessage();
+		void accountListAutoAcceptRulesSendMessage();
 		
-	void tuningSetMicVolume(float volume);
-	void tuningSetSpeakerVolume(float volume);
-	float tuningGetEnergy(void);
+		void sessionGroupCreateSendMessage();
+		void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+		void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
+		void sessionMediaConnectSendMessage(sessionState *session);		// just joins the audio session
+		void sessionTextConnectSendMessage(sessionState *session);		// just joins the text session
+		void sessionTerminateSendMessage(sessionState *session);
+		void sessionGroupTerminateSendMessage(sessionState *session);
+		void sessionMediaDisconnectSendMessage(sessionState *session);
+		void sessionTextDisconnectSendMessage(sessionState *session);
+
+		// Pokes the state machine to leave the audio session next time around.
+		void sessionTerminate();	
+		
+		// Pokes the state machine to shut down the connector and restart it.
+		void requestRelog();
+		
+		// Does the actual work to get out of the audio session
+		void leaveAudioSession();
+		
+		void addObserver(LLVoiceClientParticipantObserver* observer);
+		void removeObserver(LLVoiceClientParticipantObserver* observer);
+
+		void addObserver(LLVoiceClientStatusObserver* observer);
+		void removeObserver(LLVoiceClientStatusObserver* observer);
+
+		void addObserver(LLFriendObserver* observer);
+		void removeObserver(LLFriendObserver* observer);
+		
+		void lookupName(const LLUUID &id);
+		static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
+		void avatarNameResolved(const LLUUID &id, const std::string &name);
+		
+		typedef std::vector<std::string> deviceList;
+
+		deviceList *getCaptureDevices();
+		deviceList *getRenderDevices();
+		
+		void setNonSpatialChannel(
+			const std::string &uri,
+			const std::string &credentials);
+		void setSpatialChannel(
+			const std::string &uri,
+			const std::string &credentials);
+		// start a voice session with the specified user
+		void callUser(const LLUUID &uuid);
+		
+		// Send a text message to the specified user, initiating the session if necessary.
+		bool sendTextMessage(const LLUUID& participant_id, const std::string& message);
+		
+		// close any existing text IM session with the specified user
+		void endUserIMSession(const LLUUID &uuid);
+		
+		bool answerInvite(std::string &sessionHandle);
+		void declineInvite(std::string &sessionHandle);
+		void leaveNonSpatialChannel();
+
+		// Returns the URI of the current channel, or an empty string if not currently in a channel.
+		// NOTE that it will return an empty string if it's in the process of joining a channel.
+		std::string getCurrentChannel();
+		
+		// returns true iff the user is currently in a proximal (local spatial) channel.
+		// Note that gestures should only fire if this returns true.
+		bool inProximalChannel();
+
+		std::string sipURIFromID(const LLUUID &id);
 				
-	// devices
-	
-	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-	// i.e. when the daemon is running and connected, and the device lists are populated.
-	bool deviceSettingsAvailable();
+		// Returns true if the indicated user is online via SIP presence according to SLVoice.
+		// Note that we only get SIP presence data for other users that are in our vivox buddy list.
+		bool isOnlineSIP(const LLUUID &id);
+
+		// Returns true if the indicated participant is really an SL avatar.
+		// This should be used to control the state of the "profile" button.
+		// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
+		bool isParticipantAvatar(const LLUUID &id);
+		
+		// Returns true if calling back the session URI after the session has closed is possible.
+		// Currently this will be false only for PSTN P2P calls.		
+		// NOTE: this will return true if the session can't be found. 
+		bool isSessionCallBackPossible(const LLUUID &session_id);
+		
+		// Returns true if the session can accepte text IM's.
+		// Currently this will be false only for PSTN P2P calls.
+		// NOTE: this will return true if the session can't be found. 
+		bool isSessionTextIMPossible(const LLUUID &session_id);
+		
+	private:
+
+		// internal state for a simple state machine.  This is used to deal with the asynchronous nature of some of the messages.
+		// Note: if you change this list, please make corresponding changes to LLVoiceClient::state2string().
+		enum state
+		{
+			stateDisableCleanup,
+			stateDisabled,				// Voice is turned off.
+			stateStart,					// Class is initialized, socket is created
+			stateDaemonLaunched,		// Daemon has been launched
+			stateConnecting,			// connect() call has been issued
+			stateConnected,				// connection to the daemon has been made, send some initial setup commands.
+			stateIdle,					// socket is connected, ready for messaging
+			stateMicTuningStart,
+			stateMicTuningRunning,		
+			stateMicTuningStop,
+			stateConnectorStart,		// connector needs to be started
+			stateConnectorStarting,		// waiting for connector handle
+			stateConnectorStarted,		// connector handle received
+			stateLoginRetry,			// need to retry login (failed due to changing password)
+			stateLoginRetryWait,		// waiting for retry timer
+			stateNeedsLogin,			// send login request
+			stateLoggingIn,				// waiting for account handle
+			stateLoggedIn,				// account handle received
+			stateCreatingSessionGroup,	// Creating the main session group
+			stateNoChannel,				// 
+			stateJoiningSession,		// waiting for session handle
+			stateSessionJoined,			// session handle received
+			stateRunning,				// in session, steady state
+			stateLeavingSession,		// waiting for terminate session response
+			stateSessionTerminated,		// waiting for terminate session response
+
+			stateLoggingOut,			// waiting for logout response
+			stateLoggedOut,				// logout response received
+			stateConnectorStopping,		// waiting for connector stop
+			stateConnectorStopped,		// connector stop received
+			
+			// We go to this state if the login fails because the account needs to be provisioned.
+			
+			// error states.  No way to recover from these yet.
+			stateConnectorFailed,
+			stateConnectorFailedWaiting,
+			stateLoginFailed,
+			stateLoginFailedWaiting,
+			stateJoinSessionFailed,
+			stateJoinSessionFailedWaiting,
+
+			stateJail					// Go here when all else has failed.  Nothing will be retried, we're done.
+		};
 		
-	// Requery the vivox daemon for the current list of input/output devices.
-	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-	// (use this if you want to know when it's done).
-	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-	void refreshDeviceLists(bool clearCurrentList = true);
+		state mState;
+		bool mSessionTerminateRequested;
+		bool mRelogRequested;
+		// Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
+		// The larger it is the greater is possibility there is a problem with connection to voice server.
+		// Introduced while fixing EXT-4313.
+		int mSpatialJoiningNum;
+		
+		void setState(state inState);
+		state getState(void)  { return mState; };
+		static std::string state2string(state inState);
+		
+		void stateMachine();
+		static void idle(void *user_data);
+		
+		LLHost mDaemonHost;
+		LLSocket::ptr_t mSocket;
+		bool mConnected;
+		
+		void closeSocket(void);
+		
+		LLPumpIO *mPump;
+		friend class LLVivoxProtocolParser;
+		
+		std::string mAccountName;
+		std::string mAccountPassword;
+		std::string mAccountDisplayName;
+		std::string mAccountFirstName;
+		std::string mAccountLastName;
+				
+		bool mTuningMode;
+		float mTuningEnergy;
+		std::string mTuningAudioFile;
+		int mTuningMicVolume;
+		bool mTuningMicVolumeDirty;
+		int mTuningSpeakerVolume;
+		bool mTuningSpeakerVolumeDirty;
+		state mTuningExitState;					// state to return to when we leave tuning mode.
+		
+		std::string mSpatialSessionURI;
+		std::string mSpatialSessionCredentials;
 
-	void setCaptureDevice(const std::string& name);
-	void setRenderDevice(const std::string& name);
+		std::string mMainSessionGroupHandle; // handle of the "main" session group.
+		
+		std::string mChannelName;			// Name of the channel to be looked up 
+		bool mAreaVoiceDisabled;
+		sessionState *mAudioSession;		// Session state for the current audio session
+		bool mAudioSessionChanged;			// set to true when the above pointer gets changed, so observers can be notified.
 
-	const LLVoiceDeviceList& getCaptureDevices();
-	const LLVoiceDeviceList& getRenderDevices();
+		sessionState *mNextAudioSession;	// Session state for the audio session we're trying to join
 
-	////////////////////////////
-	// Channel stuff
-	//
-	
-	// returns true iff the user is currently in a proximal (local spatial) channel.
-	// Note that gestures should only fire if this returns true.
-	bool inProximalChannel();
-	void setNonSpatialChannel(
-							  const std::string &uri,
-							  const std::string &credentials);
-	void setSpatialChannel(
-						   const std::string &uri,
-						   const std::string &credentials);
-	void leaveNonSpatialChannel();
-	
-	// Returns the URI of the current channel, or an empty string if not currently in a channel.
-	// NOTE that it will return an empty string if it's in the process of joining a channel.
-	std::string getCurrentChannel();
-	// start a voice channel with the specified user
-	void callUser(const LLUUID &uuid);	
-	bool answerInvite(std::string &channelHandle);
-	void declineInvite(std::string &channelHandle);	
-	void leaveChannel(void);		// call this on logout or teleport begin
-	
-	
-	/////////////////////////////
-	// Sending updates of current state
+//		std::string mSessionURI;			// URI of the session we're in.
+//		std::string mSessionHandle;		// returned by ?
+		
+		S32 mCurrentParcelLocalID;			// Used to detect parcel boundary crossings
+		std::string mCurrentRegionName;		// Used to detect parcel boundary crossings
+		
+		std::string mConnectorHandle;	// returned by "Create Connector" message
+		std::string mAccountHandle;		// returned by login message		
+		int 		mNumberOfAliases;
+		U32 mCommandCookie;
 	
+		std::string mVoiceAccountServerURI;
+		std::string mVoiceSIPURIHostName;
+		
+		int mLoginRetryCount;
+		
+		sessionMap mSessionsByHandle;				// Active sessions, indexed by session handle.  Sessions which are being initiated may not be in this map.
+		sessionSet mSessions;						// All sessions, not indexed.  This is the canonical session list.
+		
+		bool mBuddyListMapPopulated;
+		bool mBlockRulesListReceived;
+		bool mAutoAcceptRulesListReceived;
+		buddyListMap mBuddyListMap;
+		
+		deviceList mCaptureDevices;
+		deviceList mRenderDevices;
 
-	void setVoiceVolume(F32 volume);
-	void setMicGain(F32 volume);
-	void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)		
-	bool voiceEnabled();
-	void setLipSyncEnabled(BOOL enabled);
-	void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-	void setUserPTTState(bool ptt);
-	bool getUserPTTState();
-	void toggleUserPTTState(void);
-	void inputUserControlState(bool down);  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs	
-	void setVoiceEnabled(bool enabled);
-
-	void setUsePTT(bool usePTT);
-	void setPTTIsToggle(bool PTTIsToggle);
-	bool getPTTIsToggle();	
-	
-	BOOL lipSyncEnabled();
-	
-	// PTT key triggering
-	void keyDown(KEY key, MASK mask);
-	void keyUp(KEY key, MASK mask);
-	void middleMouseState(bool down);
-	
-	
-	/////////////////////////////
-	// Accessors for data related to nearby speakers
-	BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
-	std::string getDisplayName(const LLUUID& id);	
-	BOOL isOnlineSIP(const LLUUID &id);
-	BOOL isParticipantAvatar(const LLUUID &id);
-	BOOL getIsSpeaking(const LLUUID& id);
-	BOOL getIsModeratorMuted(const LLUUID& id);
-	F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-	BOOL getOnMuteList(const LLUUID& id);
-	F32 getUserVolume(const LLUUID& id);
-
-	/////////////////////////////
-	BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
-													  // Use this to determine whether to show a "no speech" icon in the menu bar.
-	void getParticipantList(std::set<LLUUID> &participants);
-	bool isParticipant(const LLUUID& speaker_id);
-	
-	//////////////////////////
-	/// @name text chat
-	//@{
-	BOOL isSessionTextIMPossible(const LLUUID& id);
-	BOOL isSessionCallBackPossible(const LLUUID& id);
-	BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
-	void endUserIMSession(const LLUUID &uuid);	
-	//@}
-	
+		std::string mCaptureDevice;
+		std::string mRenderDevice;
+		bool mCaptureDeviceDirty;
+		bool mRenderDeviceDirty;
+		
+		// This should be called when the code detects we have changed parcels.
+		// It initiates the call to the server that gets the parcel channel.
+		void parcelChanged();
+		
+	void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
+		void joinSession(sessionState *session);
+		
+static 	std::string nameFromAvatar(LLVOAvatar *avatar);
+static	std::string nameFromID(const LLUUID &id);
+static	bool IDFromName(const std::string name, LLUUID &uuid);
+static	std::string displayNameFromAvatar(LLVOAvatar *avatar);
+		std::string sipURIFromAvatar(LLVOAvatar *avatar);
+		std::string sipURIFromName(std::string &name);
+		
+		// Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
+static	std::string nameFromsipURI(const std::string &uri);		
 
-	void userAuthorized(const std::string& user_id,
-			const LLUUID &agentID);
-	
-	void addObserver(LLVoiceClientStatusObserver* observer);
-	void removeObserver(LLVoiceClientStatusObserver* observer);
-	void addObserver(LLFriendObserver* observer);
-	void removeObserver(LLFriendObserver* observer);
-	void addObserver(LLVoiceClientParticipantObserver* observer);
-	void removeObserver(LLVoiceClientParticipantObserver* observer);
-	
-	std::string sipURIFromID(const LLUUID &id);	
+		bool inSpatialChannel(void);
+		std::string getAudioSessionURI();
+		std::string getAudioSessionHandle();
+				
+		void sendPositionalUpdate(void);
 		
-protected:
-	LLVoiceModuleInterface* mVoiceModule;
-	LLPumpIO *m_servicePump;
-};
+		void buildSetCaptureDevice(std::ostringstream &stream);
+		void buildSetRenderDevice(std::ostringstream &stream);
+		void buildLocalAudioUpdates(std::ostringstream &stream);
+		
+		void clearAllLists();
+		void checkFriend(const LLUUID& id);
+		void sendFriendsListUpdates();
+
+		// start a text IM session with the specified user
+		// This will be asynchronous, the session may be established at a future time.
+		sessionState* startUserIMSession(const LLUUID& uuid);
+		void sendQueuedTextMessages(sessionState *session);
+		
+		void enforceTether(void);
+		
+		bool		mSpatialCoordsDirty;
+		
+		LLVector3d	mCameraPosition;
+		LLVector3d	mCameraRequestedPosition;
+		LLVector3	mCameraVelocity;
+		LLMatrix3	mCameraRot;
+
+		LLVector3d	mAvatarPosition;
+		LLVector3	mAvatarVelocity;
+		LLMatrix3	mAvatarRot;
+		
+		bool		mPTTDirty;
+		bool		mPTT;
+		
+		bool		mUsePTT;
+		bool		mPTTIsMiddleMouse;
+		KEY			mPTTKey;
+		bool		mPTTIsToggle;
+		bool		mUserPTTState;
+		bool		mMuteMic;
+				
+		// Set to true when the friends list is known to have changed.
+		bool		mFriendsListDirty;
+		
+		enum
+		{
+			earLocCamera = 0,		// ear at camera
+			earLocAvatar,			// ear at avatar
+			earLocMixed				// ear at avatar location/camera direction
+		};
+		
+		S32			mEarLocation;  
+		
+		bool		mSpeakerVolumeDirty;
+		bool		mSpeakerMuteDirty;
+		int			mSpeakerVolume;
+
+		int			mMicVolume;
+		bool		mMicVolumeDirty;
+		
+		bool		mVoiceEnabled;
+		bool		mWriteInProgress;
+		std::string mWriteString;
+		
+		LLTimer		mUpdateTimer;
+		
+		BOOL		mLipSyncEnabled;
 
-/**
- * Speaker volume storage helper class
- **/
+		std::string	mAPIVersion;
 
-class LLSpeakerVolumeStorage : public LLSingleton<LLSpeakerVolumeStorage>
-{
-	LOG_CLASS(LLSpeakerVolumeStorage);
-public:
+		typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
+		observer_set_t mParticipantObservers;
 
-	/**
-	 * Sets internal voluem level for specified user.
-	 *
-	 * @param[in] speaker_id - LLUUID of user to store volume level for
-	 * @param[in] volume - external volume level to be stored for user.
-	 */
-	void storeSpeakerVolume(const LLUUID& speaker_id, F32 volume);
-
-	/**
-	 * Gets stored external volume level for specified speaker.
-	 *
-	 * If specified user is not found default level will be returned. It is equivalent of 
-	 * external level 0.5 from the 0.0..1.0 range.
-	 * Default external level is calculated as: internal = 400 * external^2
-	 * Maps 0.0 to 1.0 to internal values 0-400 with default 0.5 == 100
-	 *
-	 * @param[in] speaker_id - LLUUID of user to get his volume level
-	 */
-	S32 getSpeakerVolume(const LLUUID& speaker_id);
-
-private:
-	friend class LLSingleton<LLSpeakerVolumeStorage>;
-	LLSpeakerVolumeStorage();
-	~LLSpeakerVolumeStorage();
-
-	const static std::string SETTINGS_FILE_NAME;
-
-	void load();
-	void save();
-
-	typedef std::map<LLUUID, F32> speaker_data_map_t;
-	speaker_data_map_t mSpeakersData;
+		void notifyParticipantObservers();
+
+		typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
+		status_observer_set_t mStatusObservers;
+		
+		void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
+
+		typedef std::set<LLFriendObserver*> friend_observer_set_t;
+		friend_observer_set_t mFriendObservers;
+		void notifyFriendObservers();
 };
 
+extern LLVoiceClient *gVoiceClient;
+
 #endif //LL_VOICE_CLIENT_H
 
 
diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp
deleted file mode 100644
index a7efc49c67..0000000000
--- a/indra/newview/llvoicevivox.cpp
+++ /dev/null
@@ -1,6967 +0,0 @@
- /** 
- * @file LLVivoxVoiceClient.cpp
- * @brief Implementation of LLVivoxVoiceClient class which is the interface to the voice client process.
- *
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- * 
- * Copyright (c) 2001-2010, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-
-#include "llviewerprecompiledheaders.h"
-#include "llvoicevivox.h"
-
-#include <boost/tokenizer.hpp>
-
-#include "llsdutil.h"
-
-#include "llvoavatarself.h"
-#include "llbufferstream.h"
-#include "llfile.h"
-#ifdef LL_STANDALONE
-# include "expat.h"
-#else
-# include "expat/expat.h"
-#endif
-#include "llcallbacklist.h"
-#include "llviewerregion.h"
-#include "llviewernetwork.h"		// for gGridChoice
-#include "llbase64.h"
-#include "llviewercontrol.h"
-#include "llkeyboard.h"
-#include "llappviewer.h"	// for gDisconnected, gDisableVoice
-#include "llmutelist.h"  // to check for muted avatars
-#include "llagent.h"
-#include "llcachename.h"
-#include "llimview.h" // for LLIMMgr
-#include "llparcel.h"
-#include "llviewerparcelmgr.h"
-//#include "llfirstuse.h"
-#include "llspeakers.h"
-#include "llviewerwindow.h"
-#include "llviewercamera.h"
-
-#include "llfloaterfriends.h"  //VIVOX, inorder to refresh communicate panel
-#include "llviewernetwork.h"
-#include "llnotificationsutil.h"
-
-// for base64 decoding
-#include "apr_base64.h"
-
-// for SHA1 hash
-#include "apr_sha1.h"
-
-// for MD5 hash
-#include "llmd5.h"
-
-#define USE_SESSION_GROUPS 0
-
-const F32 SPEAKING_TIMEOUT = 1.f;
-
-static const std::string VOICE_SERVER_TYPE = "Vivox";
-
-// Don't retry connecting to the daemon more frequently than this:
-const F32 CONNECT_THROTTLE_SECONDS = 1.0f;
-
-// Don't send positional updates more frequently than this:
-const F32 UPDATE_THROTTLE_SECONDS = 0.1f;
-
-const F32 LOGIN_RETRY_SECONDS = 10.0f;
-const int MAX_LOGIN_RETRIES = 12;
-
-// Defines the maximum number of times(in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine()
-// which is treated as normal. If this number is exceeded we suspect there is a problem with connection
-// to voice server (EXT-4313). When voice works correctly, there is from 1 to 15 times. 50 was chosen 
-// to make sure we don't make mistake when slight connection problems happen- situation when connection to server is 
-// blocked is VERY rare and it's better to sacrifice response time in this situation for the sake of stability.
-const int MAX_NORMAL_JOINING_SPATIAL_NUM = 50;
-
-
-static void setUUIDFromStringHash(LLUUID &uuid, const std::string &str)
-{
-	LLMD5 md5_uuid;
-	md5_uuid.update((const unsigned char*)str.data(), str.size());
-	md5_uuid.finalize();
-	md5_uuid.raw_digest(uuid.mData);
-}
-
-static int scale_mic_volume(float volume)
-{
-	// incoming volume has the range [0.0 ... 2.0], with 1.0 as the default.                                                
-	// Map it to Vivox levels as follows: 0.0 -> 30, 1.0 -> 50, 2.0 -> 70                                                   
-	return 30 + (int)(volume * 20.0f);
-}
-
-static int scale_speaker_volume(float volume)
-{
-	// incoming volume has the range [0.0 ... 1.0], with 0.5 as the default.                                                
-	// Map it to Vivox levels as follows: 0.0 -> 30, 0.5 -> 50, 1.0 -> 70                                                   
-	return 30 + (int)(volume * 40.0f);
-	
-}
-
-class LLVivoxVoiceAccountProvisionResponder :
-	public LLHTTPClient::Responder
-{
-public:
-	LLVivoxVoiceAccountProvisionResponder(int retries)
-	{
-		mRetries = retries;
-	}
-
-	virtual void error(U32 status, const std::string& reason)
-	{
-		if ( mRetries > 0 )
-		{
-			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, retrying.  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
-			LLVivoxVoiceClient::getInstance()->requestVoiceAccountProvision(
-				mRetries - 1);
-		}
-		else
-		{
-			LL_WARNS("Voice") << "ProvisionVoiceAccountRequest returned an error, too many retries (giving up).  status = " << status << ", reason = \"" << reason << "\"" << LL_ENDL;
-			LLVivoxVoiceClient::getInstance()->giveUp();
-		}
-	}
-
-	virtual void result(const LLSD& content)
-	{
-
-		std::string voice_sip_uri_hostname;
-		std::string voice_account_server_uri;
-		
-		LL_DEBUGS("Voice") << "ProvisionVoiceAccountRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-		
-		if(content.has("voice_sip_uri_hostname"))
-			voice_sip_uri_hostname = content["voice_sip_uri_hostname"].asString();
-		
-		// this key is actually misnamed -- it will be an entire URI, not just a hostname.
-		if(content.has("voice_account_server_name"))
-			voice_account_server_uri = content["voice_account_server_name"].asString();
-		
-		LLVivoxVoiceClient::getInstance()->login(
-			content["username"].asString(),
-			content["password"].asString(),
-			voice_sip_uri_hostname,
-			voice_account_server_uri);
-
-	}
-
-private:
-	int mRetries;
-};
-
-
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVivoxVoiceClientMuteListObserver : public LLMuteListObserver
-{
-	/* virtual */ void onChange()  { LLVivoxVoiceClient::getInstance()->muteListChanged();}
-};
-
-class LLVivoxVoiceClientFriendsObserver : public LLFriendObserver
-{
-public:
-	/* virtual */ void changed(U32 mask) { LLVivoxVoiceClient::getInstance()->updateFriends(mask);}
-};
-
-static LLVivoxVoiceClientMuteListObserver mutelist_listener;
-static bool sMuteListListener_listening = false;
-
-static LLVivoxVoiceClientFriendsObserver *friendslist_listener = NULL;
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-class LLVivoxVoiceClientCapResponder : public LLHTTPClient::Responder
-{
-public:
-	LLVivoxVoiceClientCapResponder(void){};
-
-	virtual void error(U32 status, const std::string& reason);	// called with bad status codes
-	virtual void result(const LLSD& content);
-
-private:
-};
-
-void LLVivoxVoiceClientCapResponder::error(U32 status, const std::string& reason)
-{
-	LL_WARNS("Voice") << "LLVivoxVoiceClientCapResponder::error("
-		<< status << ": " << reason << ")"
-		<< LL_ENDL;
-}
-
-void LLVivoxVoiceClientCapResponder::result(const LLSD& content)
-{
-	LLSD::map_const_iterator iter;
-	
-	LL_DEBUGS("Voice") << "ParcelVoiceInfoRequest response:" << ll_pretty_print_sd(content) << LL_ENDL;
-
-	if ( content.has("voice_credentials") )
-	{
-		LLSD voice_credentials = content["voice_credentials"];
-		std::string uri;
-		std::string credentials;
-
-		if ( voice_credentials.has("channel_uri") )
-		{
-			uri = voice_credentials["channel_uri"].asString();
-		}
-		if ( voice_credentials.has("channel_credentials") )
-		{
-			credentials =
-				voice_credentials["channel_credentials"].asString();
-		}
-
-		LLVivoxVoiceClient::getInstance()->setSpatialChannel(uri, credentials);
-	}
-}
-
-
-
-#if LL_WINDOWS
-static HANDLE sGatewayHandle = 0;
-
-static bool isGatewayRunning()
-{
-	bool result = false;
-	if(sGatewayHandle != 0)		
-	{
-		DWORD waitresult = WaitForSingleObject(sGatewayHandle, 0);
-		if(waitresult != WAIT_OBJECT_0)
-		{
-			result = true;
-		}			
-	}
-	return result;
-}
-static void killGateway()
-{
-	if(sGatewayHandle != 0)
-	{
-		TerminateProcess(sGatewayHandle,0);
-	}
-}
-
-#else // Mac and linux
-
-static pid_t sGatewayPID = 0;
-static bool isGatewayRunning()
-{
-	bool result = false;
-	if(sGatewayPID != 0)
-	{
-		// A kill with signal number 0 has no effect, just does error checking.  It should return an error if the process no longer exists.
-		if(kill(sGatewayPID, 0) == 0)
-		{
-			result = true;
-		}
-	}
-	return result;
-}
-
-static void killGateway()
-{
-	if(sGatewayPID != 0)
-	{
-		kill(sGatewayPID, SIGTERM);
-	}
-}
-
-#endif
-
-///////////////////////////////////////////////////////////////////////////////////////////////
-
-LLVivoxVoiceClient::LLVivoxVoiceClient() :
-	mState(stateDisabled),
-	mSessionTerminateRequested(false),
-	mRelogRequested(false),
-	mConnected(false),
-	mPump(NULL),
-	mSpatialJoiningNum(0),
-
-	mTuningMode(false),
-	mTuningEnergy(0.0f),
-	mTuningMicVolume(0),
-	mTuningMicVolumeDirty(true),
-	mTuningSpeakerVolume(0),
-	mTuningSpeakerVolumeDirty(true),
-	mTuningExitState(stateDisabled),
-
-	mAreaVoiceDisabled(false),
-	mAudioSession(NULL),
-	mAudioSessionChanged(false),
-	mNextAudioSession(NULL),
-
-	mCurrentParcelLocalID(0),
-	mNumberOfAliases(0),
-	mCommandCookie(0),
-	mLoginRetryCount(0),
-
-	mBuddyListMapPopulated(false),
-	mBlockRulesListReceived(false),
-	mAutoAcceptRulesListReceived(false),
-	mCaptureDeviceDirty(false),
-	mRenderDeviceDirty(false),
-	mSpatialCoordsDirty(false),
-
-	mPTTDirty(true),
-	mPTT(true),
-	mUsePTT(true),
-	mPTTIsMiddleMouse(false),
-	mPTTKey(0),
-	mPTTIsToggle(false),
-	mUserPTTState(false),
-	mMuteMic(false),
-	mFriendsListDirty(true),
-
-	mEarLocation(0),
-	mSpeakerVolumeDirty(true),
-	mSpeakerMuteDirty(true),
-	mMicVolume(0),
-	mMicVolumeDirty(true),
-
-	mVoiceEnabled(false),
-	mWriteInProgress(false),
-
-	mLipSyncEnabled(false)
-
-
-
-{	
-	mSpeakerVolume = scale_speaker_volume(0);
-
-	mVoiceVersion.serverVersion = "";
-	mVoiceVersion.serverType = VOICE_SERVER_TYPE;
-	
-	//  gMuteListp isn't set up at this point, so we defer this until later.
-//	gMuteListp->addObserver(&mutelist_listener);
-	
-	
-#if LL_DARWIN || LL_LINUX || LL_SOLARIS
-		// HACK: THIS DOES NOT BELONG HERE
-		// When the vivox daemon dies, the next write attempt on our socket generates a SIGPIPE, which kills us.
-		// This should cause us to ignore SIGPIPE and handle the error through proper channels.
-		// This should really be set up elsewhere.  Where should it go?
-		signal(SIGPIPE, SIG_IGN);
-		
-		// Since we're now launching the gateway with fork/exec instead of system(), we need to deal with zombie processes.
-		// Ignoring SIGCHLD should prevent zombies from being created.  Alternately, we could use wait(), but I'd rather not do that.
-		signal(SIGCHLD, SIG_IGN);
-#endif
-
-	// set up state machine
-	setState(stateDisabled);
-	
-	gIdleCallbacks.addFunction(idle, this);
-}
-
-//---------------------------------------------------
-
-LLVivoxVoiceClient::~LLVivoxVoiceClient()
-{
-}
-
-//----------------------------------------------
-
-void LLVivoxVoiceClient::init(LLPumpIO *pump)
-{
-	// constructor will set up LLVoiceClient::getInstance()
-	LLVivoxVoiceClient::getInstance()->mPump = pump;
-}
-
-void LLVivoxVoiceClient::terminate()
-{
-
-//	leaveAudioSession();
-	logout();
-	// As of SDK version 4885, this should no longer be necessary.  It will linger after the socket close if it needs to.
-	// ms_sleep(2000);
-	connectorShutdown();
-	closeSocket();		// Need to do this now -- bad things happen if the destructor does it later.
-	
-	// This will do unpleasant things on windows.
-//	killGateway();
-	
-
-
-}
-
-const LLVoiceVersionInfo& LLVivoxVoiceClient::getVersion()
-{
-	return mVoiceVersion;
-}
-
-//---------------------------------------------------
-
-void LLVivoxVoiceClient::updateSettings()
-{
-	setVoiceEnabled(gSavedSettings.getBOOL("EnableVoiceChat"));
-	setUsePTT(gSavedSettings.getBOOL("PTTCurrentlyEnabled"));
-	std::string keyString = gSavedSettings.getString("PushToTalkButton");
-	setPTTKey(keyString);
-	setPTTIsToggle(gSavedSettings.getBOOL("PushToTalkToggle"));
-	setEarLocation(gSavedSettings.getS32("VoiceEarLocation"));
-
-	std::string inputDevice = gSavedSettings.getString("VoiceInputAudioDevice");
-	setCaptureDevice(inputDevice);
-	std::string outputDevice = gSavedSettings.getString("VoiceOutputAudioDevice");
-	setRenderDevice(outputDevice);
-	F32 mic_level = gSavedSettings.getF32("AudioLevelMic");
-	setMicGain(mic_level);
-	setLipSyncEnabled(gSavedSettings.getBOOL("LipSyncEnabled"));
-}
-
-/////////////////////////////
-// utility functions
-
-bool LLVivoxVoiceClient::writeString(const std::string &str)
-{
-	bool result = false;
-	if(mConnected)
-	{
-		apr_status_t err;
-		apr_size_t size = (apr_size_t)str.size();
-		apr_size_t written = size;
-	
-		//MARK: Turn this on to log outgoing XML
-//		LL_DEBUGS("Voice") << "sending: " << str << LL_ENDL;
-
-		// check return code - sockets will fail (broken, etc.)
-		err = apr_socket_send(
-				mSocket->getSocket(),
-				(const char*)str.data(),
-				&written);
-		
-		if(err == 0)
-		{
-			// Success.
-			result = true;
-		}
-		// TODO: handle partial writes (written is number of bytes written)
-		// Need to set socket to non-blocking before this will work.
-//		else if(APR_STATUS_IS_EAGAIN(err))
-//		{
-//			// 
-//		}
-		else
-		{
-			// Assume any socket error means something bad.  For now, just close the socket.
-			char buf[MAX_STRING];
-			LL_WARNS("Voice") << "apr error " << err << " ("<< apr_strerror(err, buf, MAX_STRING) << ") sending data to vivox daemon." << LL_ENDL;
-			daemonDied();
-		}
-	}
-		
-	return result;
-}
-
-
-/////////////////////////////
-// session control messages
-void LLVivoxVoiceClient::connectorCreate()
-{
-	std::ostringstream stream;
-	std::string logpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "");
-	std::string loglevel = "0";
-	
-	// Transition to stateConnectorStarted when the connector handle comes back.
-	setState(stateConnectorStarting);
-
-	std::string savedLogLevel = gSavedSettings.getString("VivoxDebugLevel");
-		
-	if(savedLogLevel != "-1")
-	{
-		LL_DEBUGS("Voice") << "creating connector with logging enabled" << LL_ENDL;
-		loglevel = "10";
-	}
-	
-	stream 
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.Create.1\">"
-		<< "<ClientName>V2 SDK</ClientName>"
-		<< "<AccountManagementServer>" << mVoiceAccountServerURI << "</AccountManagementServer>"
-		<< "<Mode>Normal</Mode>"
-		<< "<Logging>"
-			<< "<Folder>" << logpath << "</Folder>"
-			<< "<FileNamePrefix>Connector</FileNamePrefix>"
-			<< "<FileNameSuffix>.log</FileNameSuffix>"
-			<< "<LogLevel>" << loglevel << "</LogLevel>"
-		<< "</Logging>"
-		<< "<Application>SecondLifeViewer.1</Application>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::connectorShutdown()
-{
-	setState(stateConnectorStopping);
-	
-	if(!mConnectorHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.InitiateShutdown.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-		
-		mConnectorHandle.clear();
-		
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::userAuthorized(const std::string& user_id, const LLUUID &agentID)
-{
-
-	mAccountDisplayName = user_id;
-
-	LL_INFOS("Voice") << "name \"" << mAccountDisplayName << "\" , ID " << agentID << LL_ENDL;
-
-	mAccountName = nameFromID(agentID);
-}
-
-void LLVivoxVoiceClient::requestVoiceAccountProvision(S32 retries)
-{
-	if ( gAgent.getRegion() && mVoiceEnabled )
-	{
-		std::string url = 
-			gAgent.getRegion()->getCapability(
-				"ProvisionVoiceAccountRequest");
-
-		if ( url == "" ) return;
-
-		LLHTTPClient::post(
-			url,
-			LLSD(),
-			new LLVivoxVoiceAccountProvisionResponder(retries));
-	}
-}
-
-void LLVivoxVoiceClient::login(
-	const std::string& account_name,
-	const std::string& password,
-	const std::string& voice_sip_uri_hostname,
-	const std::string& voice_account_server_uri)
-{
-	mVoiceSIPURIHostName = voice_sip_uri_hostname;
-	mVoiceAccountServerURI = voice_account_server_uri;
-
-	if(!mAccountHandle.empty())
-	{
-		// Already logged in.
-		LL_WARNS("Voice") << "Called while already logged in." << LL_ENDL;
-		
-		// Don't process another login.
-		return;
-	}
-	else if ( account_name != mAccountName )
-	{
-		//TODO: error?
-		LL_WARNS("Voice") << "Wrong account name! " << account_name
-				<< " instead of " << mAccountName << LL_ENDL;
-	}
-	else
-	{
-		mAccountPassword = password;
-	}
-
-	std::string debugSIPURIHostName = gSavedSettings.getString("VivoxDebugSIPURIHostName");
-	
-	if( !debugSIPURIHostName.empty() )
-	{
-		mVoiceSIPURIHostName = debugSIPURIHostName;
-	}
-	
-	if( mVoiceSIPURIHostName.empty() )
-	{
-		// we have an empty account server name
-		// so we fall back to hardcoded defaults
-
-		if(LLGridManager::getInstance()->isInProductionGrid())
-		{
-			// Use the release account server
-			mVoiceSIPURIHostName = "bhr.vivox.com";
-		}
-		else
-		{
-			// Use the development account server
-			mVoiceSIPURIHostName = "bhd.vivox.com";
-		}
-	}
-	
-	std::string debugAccountServerURI = gSavedSettings.getString("VivoxDebugVoiceAccountServerURI");
-
-	if( !debugAccountServerURI.empty() )
-	{
-		mVoiceAccountServerURI = debugAccountServerURI;
-	}
-	
-	if( mVoiceAccountServerURI.empty() )
-	{
-		// If the account server URI isn't specified, construct it from the SIP URI hostname
-		mVoiceAccountServerURI = "https://www." + mVoiceSIPURIHostName + "/api2/";		
-	}
-}
-
-void LLVivoxVoiceClient::idle(void* user_data)
-{
-	LLVivoxVoiceClient* self = (LLVivoxVoiceClient*)user_data;
-	self->stateMachine();
-}
-
-std::string LLVivoxVoiceClient::state2string(LLVivoxVoiceClient::state inState)
-{
-	std::string result = "UNKNOWN";
-	
-		// Prevent copy-paste errors when updating this list...
-#define CASE(x)  case x:  result = #x;  break
-
-	switch(inState)
-	{
-		CASE(stateDisableCleanup);
-		CASE(stateDisabled);
-		CASE(stateStart);
-		CASE(stateDaemonLaunched);
-		CASE(stateConnecting);
-		CASE(stateConnected);
-		CASE(stateIdle);
-		CASE(stateMicTuningStart);
-		CASE(stateMicTuningRunning);
-		CASE(stateMicTuningStop);
-		CASE(stateConnectorStart);
-		CASE(stateConnectorStarting);
-		CASE(stateConnectorStarted);
-		CASE(stateLoginRetry);
-		CASE(stateLoginRetryWait);
-		CASE(stateNeedsLogin);
-		CASE(stateLoggingIn);
-		CASE(stateLoggedIn);
-		CASE(stateCreatingSessionGroup);
-		CASE(stateNoChannel);
-		CASE(stateJoiningSession);
-		CASE(stateSessionJoined);
-		CASE(stateRunning);
-		CASE(stateLeavingSession);
-		CASE(stateSessionTerminated);
-		CASE(stateLoggingOut);
-		CASE(stateLoggedOut);
-		CASE(stateConnectorStopping);
-		CASE(stateConnectorStopped);
-		CASE(stateConnectorFailed);
-		CASE(stateConnectorFailedWaiting);
-		CASE(stateLoginFailed);
-		CASE(stateLoginFailedWaiting);
-		CASE(stateJoinSessionFailed);
-		CASE(stateJoinSessionFailedWaiting);
-		CASE(stateJail);
-	}
-
-#undef CASE
-	
-	return result;
-}
-
-
-
-void LLVivoxVoiceClient::setState(state inState)
-{
-	LL_DEBUGS("Voice") << "entering state " << state2string(inState) << LL_ENDL;
-	
-	mState = inState;
-}
-
-void LLVivoxVoiceClient::stateMachine()
-{
-	if(gDisconnected)
-	{
-		// The viewer has been disconnected from the sim.  Disable voice.
-		setVoiceEnabled(false);
-	}
-	
-	if(mVoiceEnabled)
-	{
-		updatePosition();
-	}
-	else if(mTuningMode)
-	{
-		// Tuning mode is special -- it needs to launch SLVoice even if voice is disabled.
-	}
-	else
-	{
-		if((getState() != stateDisabled) && (getState() != stateDisableCleanup))
-		{
-			// User turned off voice support.  Send the cleanup messages, close the socket, and reset.
-			if(!mConnected)
-			{
-				// if voice was turned off after the daemon was launched but before we could connect to it, we may need to issue a kill.
-				LL_INFOS("Voice") << "Disabling voice before connection to daemon, terminating." << LL_ENDL;
-				killGateway();
-			}
-			
-			logout();
-			connectorShutdown();
-			
-			setState(stateDisableCleanup);
-		}
-	}
-	
-	// Check for parcel boundary crossing
-	{
-		LLViewerRegion *region = gAgent.getRegion();
-		LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-		
-		if(region && parcel)
-		{
-			S32 parcelLocalID = parcel->getLocalID();
-			std::string regionName = region->getName();
-			std::string capURI = region->getCapability("ParcelVoiceInfoRequest");
-		
-//			LL_DEBUGS("Voice") << "Region name = \"" << regionName << "\", parcel local ID = " << parcelLocalID << ", cap URI = \"" << capURI << "\"" << LL_ENDL;
-
-			// The region name starts out empty and gets filled in later.  
-			// Also, the cap gets filled in a short time after the region cross, but a little too late for our purposes.
-			// If either is empty, wait for the next time around.
-			if(!regionName.empty())
-			{
-				if(!capURI.empty())
-				{
-					if((parcelLocalID != mCurrentParcelLocalID) || (regionName != mCurrentRegionName))
-					{
-						// We have changed parcels.  Initiate a parcel channel lookup.
-						mCurrentParcelLocalID = parcelLocalID;
-						mCurrentRegionName = regionName;
-						
-						parcelChanged();
-					}
-				}
-				else
-				{
-					LL_WARNS_ONCE("Voice") << "region doesn't have ParcelVoiceInfoRequest capability.  This is normal for a short time after teleporting, but bad if it persists for very long." << LL_ENDL;
-				}
-			}
-		}
-	}
-
-	switch(getState())
-	{
-		//MARK: stateDisableCleanup
-		case stateDisableCleanup:
-			// Clean up and reset everything. 
-			closeSocket();
-			deleteAllSessions();
-			deleteAllBuddies();		
-			
-			mConnectorHandle.clear();
-			mAccountHandle.clear();
-			mAccountPassword.clear();
-			mVoiceAccountServerURI.clear();
-			
-			setState(stateDisabled);	
-		break;
-		
-		//MARK: stateDisabled
-		case stateDisabled:
-			if(mTuningMode || (mVoiceEnabled && !mAccountName.empty()))
-			{
-				setState(stateStart);
-			}
-		break;
-		
-		//MARK: stateStart
-		case stateStart:
-			if(gSavedSettings.getBOOL("CmdLineDisableVoice"))
-			{
-				// Voice is locked out, we must not launch the vivox daemon.
-				setState(stateJail);
-			}
-			else if(!isGatewayRunning())
-			{
-				if(true)
-				{
-					// Launch the voice daemon
-					
-					// *FIX:Mani - Using the executable dir instead 
-					// of mAppRODataDir, the working directory from which the app
-					// is launched.
-					//std::string exe_path = gDirUtilp->getAppRODataDir();
-					std::string exe_path = gDirUtilp->getExecutableDir();
-					exe_path += gDirUtilp->getDirDelimiter();
-#if LL_WINDOWS
-					exe_path += "SLVoice.exe";
-#elif LL_DARWIN
-					exe_path += "../Resources/SLVoice";
-#else
-					exe_path += "SLVoice";
-#endif
-					// See if the vivox executable exists
-					llstat s;
-					if(!LLFile::stat(exe_path, &s))
-					{
-						// vivox executable exists.  Build the command line and launch the daemon.
-						// SLIM SDK: these arguments are no longer necessary.
-//						std::string args = " -p tcp -h -c";
-						std::string args;
-						std::string cmd;
-						std::string loglevel = gSavedSettings.getString("VivoxDebugLevel");
-						
-						if(loglevel.empty())
-						{
-							loglevel = "-1";	// turn logging off completely
-						}
-						
-						args += " -ll ";
-						args += loglevel;
-						
-						LL_DEBUGS("Voice") << "Args for SLVoice: " << args << LL_ENDL;
-
-#if LL_WINDOWS
-						PROCESS_INFORMATION pinfo;
-						STARTUPINFOA sinfo;
-						
-						memset(&sinfo, 0, sizeof(sinfo));
-						
-						std::string exe_dir = gDirUtilp->getAppRODataDir();
-						cmd = "SLVoice.exe";
-						cmd += args;
-
-						// So retarded.  Windows requires that the second parameter to CreateProcessA be writable (non-const) string...
-						char *args2 = new char[args.size() + 1];
-						strcpy(args2, args.c_str());
-						if(!CreateProcessA(exe_path.c_str(), args2, NULL, NULL, FALSE, 0, NULL, exe_dir.c_str(), &sinfo, &pinfo))
-						{
-//							DWORD dwErr = GetLastError();
-						}
-						else
-						{
-							// foo = pinfo.dwProcessId; // get your pid here if you want to use it later on
-							// CloseHandle(pinfo.hProcess); // stops leaks - nothing else
-							sGatewayHandle = pinfo.hProcess;
-							CloseHandle(pinfo.hThread); // stops leaks - nothing else
-						}		
-						
-						delete[] args2;
-#else	// LL_WINDOWS
-						// This should be the same for mac and linux
-						{
-							std::vector<std::string> arglist;
-							arglist.push_back(exe_path);
-							
-							// Split the argument string into separate strings for each argument
-							typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
-							boost::char_separator<char> sep(" ");
-							tokenizer tokens(args, sep);
-							tokenizer::iterator token_iter;
-
-							for(token_iter = tokens.begin(); token_iter != tokens.end(); ++token_iter)
-							{
-								arglist.push_back(*token_iter);
-							}
-							
-							// create an argv vector for the child process
-							char **fakeargv = new char*[arglist.size() + 1];
-							int i;
-							for(i=0; i < arglist.size(); i++)
-								fakeargv[i] = const_cast<char*>(arglist[i].c_str());
-
-							fakeargv[i] = NULL;
-							
-							fflush(NULL); // flush all buffers before the child inherits them
-							pid_t id = vfork();
-							if(id == 0)
-							{
-								// child
-								execv(exe_path.c_str(), fakeargv);
-								
-								// If we reach this point, the exec failed.
-								// Use _exit() instead of exit() per the vfork man page.
-								_exit(0);
-							}
-
-							// parent
-							delete[] fakeargv;
-							sGatewayPID = id;
-						}
-#endif	// LL_WINDOWS
-						mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost").c_str(), gSavedSettings.getU32("VivoxVoicePort"));
-					}	
-					else
-					{
-						LL_INFOS("Voice") << exe_path << " not found." << LL_ENDL;
-					}	
-				}
-				else
-				{		
-					// SLIM SDK: port changed from 44124 to 44125.
-					// We can connect to a client gateway running on another host.  This is useful for testing.
-					// To do this, launch the gateway on a nearby host like this:
-					//  vivox-gw.exe -p tcp -i 0.0.0.0:44125
-					// and put that host's IP address here.
-					mDaemonHost = LLHost(gSavedSettings.getString("VivoxVoiceHost"), gSavedSettings.getU32("VivoxVoicePort"));
-				}
-
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
-				setState(stateDaemonLaunched);
-				
-				// Dirty the states we'll need to sync with the daemon when it comes up.
-				mPTTDirty = true;
-				mMicVolumeDirty = true;
-				mSpeakerVolumeDirty = true;
-				mSpeakerMuteDirty = true;
-				// These only need to be set if they're not default (i.e. empty string).
-				mCaptureDeviceDirty = !mCaptureDevice.empty();
-				mRenderDeviceDirty = !mRenderDevice.empty();
-				
-				mMainSessionGroupHandle.clear();
-			}
-		break;
-
-		//MARK: stateDaemonLaunched
-		case stateDaemonLaunched:
-			if(mUpdateTimer.hasExpired())
-			{
-				LL_DEBUGS("Voice") << "Connecting to vivox daemon:" << mDaemonHost << LL_ENDL;
-
-				mUpdateTimer.setTimerExpirySec(CONNECT_THROTTLE_SECONDS);
-
-				if(!mSocket)
-				{
-					mSocket = LLSocket::create(gAPRPoolp, LLSocket::STREAM_TCP);	
-				}
-				
-				mConnected = mSocket->blockingConnect(mDaemonHost);
-				if(mConnected)
-				{
-					setState(stateConnecting);
-				}
-				else
-				{
-					// If the connect failed, the socket may have been put into a bad state.  Delete it.
-					closeSocket();
-				}
-			}
-		break;
-
-		//MARK: stateConnecting
-		case stateConnecting:
-		// Can't do this until we have the pump available.
-		if(mPump)
-		{
-			// MBW -- Note to self: pumps and pipes examples in
-			//  indra/test/io.cpp
-			//  indra/test/llpipeutil.{cpp|h}
-
-			// Attach the pumps and pipes
-				
-			LLPumpIO::chain_t readChain;
-
-			readChain.push_back(LLIOPipe::ptr_t(new LLIOSocketReader(mSocket)));
-			readChain.push_back(LLIOPipe::ptr_t(new LLVivoxProtocolParser()));
-
-			mPump->addChain(readChain, NEVER_CHAIN_EXPIRY_SECS);
-
-			setState(stateConnected);
-		}
-
-		break;
-		
-		//MARK: stateConnected
-		case stateConnected:
-			// Initial devices query
-			getCaptureDevicesSendMessage();
-			getRenderDevicesSendMessage();
-
-			mLoginRetryCount = 0;
-
-			setState(stateIdle);
-		break;
-
-		//MARK: stateIdle
-		case stateIdle:
-			// This is the idle state where we're connected to the daemon but haven't set up a connector yet.
-			if(mTuningMode)
-			{
-				mTuningExitState = stateIdle;
-				setState(stateMicTuningStart);
-			}
-			else if(!mVoiceEnabled)
-			{
-				// We never started up the connector.  This will shut down the daemon.
-				setState(stateConnectorStopped);
-			}
-			else if(!mAccountName.empty())
-			{
-				LLViewerRegion *region = gAgent.getRegion();
-				
-				if(region)
-				{
-					if ( region->getCapability("ProvisionVoiceAccountRequest") != "" )
-					{
-						if ( mAccountPassword.empty() )
-						{
-							requestVoiceAccountProvision();
-						}
-						setState(stateConnectorStart);
-					}
-					else
-					{
-						LL_WARNS_ONCE("Voice") << "region doesn't have ProvisionVoiceAccountRequest capability!" << LL_ENDL;
-					}
-				}
-			}
-		break;
-
-		//MARK: stateMicTuningStart
-		case stateMicTuningStart:
-			if(mUpdateTimer.hasExpired())
-			{
-				if(mCaptureDeviceDirty || mRenderDeviceDirty)
-				{
-					// These can't be changed while in tuning mode.  Set them before starting.
-					std::ostringstream stream;
-					
-					buildSetCaptureDevice(stream);
-					buildSetRenderDevice(stream);
-
-					if(!stream.str().empty())
-					{
-						writeString(stream.str());
-					}				
-
-					// This will come around again in the same state and start the capture, after the timer expires.
-					mUpdateTimer.start();
-					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-				}
-				else
-				{
-					// duration parameter is currently unused, per Mike S.
-					tuningCaptureStartSendMessage(10000);
-
-					setState(stateMicTuningRunning);
-				}
-			}
-			
-		break;
-		
-		//MARK: stateMicTuningRunning
-		case stateMicTuningRunning:
-			if(!mTuningMode || mCaptureDeviceDirty || mRenderDeviceDirty)
-			{
-				// All of these conditions make us leave tuning mode.
-				setState(stateMicTuningStop);
-			}
-			else
-			{
-				// process mic/speaker volume changes
-				if(mTuningMicVolumeDirty || mTuningSpeakerVolumeDirty)
-				{
-					std::ostringstream stream;
-					
-					if(mTuningMicVolumeDirty)
-					{
-						LL_INFOS("Voice") << "setting tuning mic level to " << mTuningMicVolume << LL_ENDL;
-						stream
-						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetMicLevel.1\">"
-						<< "<Level>" << mTuningMicVolume << "</Level>"
-						<< "</Request>\n\n\n";
-					}
-					
-					if(mTuningSpeakerVolumeDirty)
-					{
-						stream
-						<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetSpeakerLevel.1\">"
-						<< "<Level>" << mTuningSpeakerVolume << "</Level>"
-						<< "</Request>\n\n\n";
-					}
-					
-					mTuningMicVolumeDirty = false;
-					mTuningSpeakerVolumeDirty = false;
-
-					if(!stream.str().empty())
-					{
-						writeString(stream.str());
-					}
-				}
-			}
-		break;
-		
-		//MARK: stateMicTuningStop
-		case stateMicTuningStop:
-		{
-			// transition out of mic tuning
-			tuningCaptureStopSendMessage();
-			
-			setState(mTuningExitState);
-			
-			// if we exited just to change devices, this will keep us from re-entering too fast.
-			mUpdateTimer.start();
-			mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-			
-		}
-		break;
-												
-		//MARK: stateConnectorStart
-		case stateConnectorStart:
-			if(!mVoiceEnabled)
-			{
-				// We were never logged in.  This will shut down the connector.
-				setState(stateLoggedOut);
-			}
-			else if(!mVoiceAccountServerURI.empty())
-			{
-				connectorCreate();
-			}
-		break;
-		
-		//MARK: stateConnectorStarting
-		case stateConnectorStarting:	// waiting for connector handle
-			// connectorCreateResponse() will transition from here to stateConnectorStarted.
-		break;
-		
-		//MARK: stateConnectorStarted
-		case stateConnectorStarted:		// connector handle received
-			if(!mVoiceEnabled)
-			{
-				// We were never logged in.  This will shut down the connector.
-				setState(stateLoggedOut);
-			}
-			else
-			{
-				// The connector is started.  Send a login message.
-				setState(stateNeedsLogin);
-			}
-		break;
-				
-		//MARK: stateLoginRetry
-		case stateLoginRetry:
-			if(mLoginRetryCount == 0)
-			{
-				// First retry -- display a message to the user
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGIN_RETRY);
-			}
-			
-			mLoginRetryCount++;
-			
-			if(mLoginRetryCount > MAX_LOGIN_RETRIES)
-			{
-				LL_WARNS("Voice") << "too many login retries, giving up." << LL_ENDL;
-				setState(stateLoginFailed);
-				LLSD args;
-				std::stringstream errs;
-				errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
-				args["HOSTID"] = errs.str();
-				if (LLGridManager::getInstance()->isSystemGrid())
-				{
-					LLNotificationsUtil::add("NoVoiceConnect", args);	
-				}
-				else
-				{
-					LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);	
-				}				
-			}
-			else
-			{
-				LL_INFOS("Voice") << "will retry login in " << LOGIN_RETRY_SECONDS << " seconds." << LL_ENDL;
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(LOGIN_RETRY_SECONDS);
-				setState(stateLoginRetryWait);
-			}
-		break;
-		
-		//MARK: stateLoginRetryWait
-		case stateLoginRetryWait:
-			if(mUpdateTimer.hasExpired())
-			{
-				setState(stateNeedsLogin);
-			}
-		break;
-		
-		//MARK: stateNeedsLogin
-		case stateNeedsLogin:
-			if(!mAccountPassword.empty())
-			{
-				setState(stateLoggingIn);
-				loginSendMessage();
-			}		
-		break;
-		
-		//MARK: stateLoggingIn
-		case stateLoggingIn:			// waiting for account handle
-			// loginResponse() will transition from here to stateLoggedIn.
-		break;
-		
-		//MARK: stateLoggedIn
-		case stateLoggedIn:				// account handle received
-
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LOGGED_IN);
-
-			// request the current set of block rules (we'll need them when updating the friends list)
-			accountListBlockRulesSendMessage();
-			
-			// request the current set of auto-accept rules
-			accountListAutoAcceptRulesSendMessage();
-			
-			// Set up the mute list observer if it hasn't been set up already.
-			if((!sMuteListListener_listening))
-			{
-				LLMuteList::getInstance()->addObserver(&mutelist_listener);
-				sMuteListListener_listening = true;
-			}
-
-			// Set up the friends list observer if it hasn't been set up already.
-			if(friendslist_listener == NULL)
-			{
-				friendslist_listener = new LLVivoxVoiceClientFriendsObserver;
-				LLAvatarTracker::instance().addObserver(friendslist_listener);
-			}
-			
-			// Set the initial state of mic mute, local speaker volume, etc.
-			{
-				std::ostringstream stream;
-				
-				buildLocalAudioUpdates(stream);
-				
-				if(!stream.str().empty())
-				{
-					writeString(stream.str());
-				}
-			}
-			
-#if USE_SESSION_GROUPS			
-			// create the main session group
-			sessionGroupCreateSendMessage();
-			
-			setState(stateCreatingSessionGroup);
-#else
-			// Not using session groups -- skip the stateCreatingSessionGroup state.
-			setState(stateNoChannel);
-
-			// Initial kick-off of channel lookup logic
-			parcelChanged();		
-#endif
-		break;
-		
-		//MARK: stateCreatingSessionGroup
-		case stateCreatingSessionGroup:
-			if(mSessionTerminateRequested || !mVoiceEnabled)
-			{
-				// *TODO: Question: is this the right way out of this state
-				setState(stateSessionTerminated);
-			}
-			else if(!mMainSessionGroupHandle.empty())
-			{
-				setState(stateNoChannel);
-				
-				// Start looped recording (needed for "panic button" anti-griefing tool)
-				recordingLoopStart();
-
-				// Initial kick-off of channel lookup logic
-				parcelChanged();		
-			}
-		break;
-					
-		//MARK: stateNoChannel
-		case stateNoChannel:
-			
-			LL_DEBUGS("Voice") << "State No Channel" << LL_ENDL;
-			mSpatialJoiningNum = 0;
-			// Do this here as well as inside sendPositionalUpdate().  
-			// Otherwise, if you log in but don't join a proximal channel (such as when your login location has voice disabled), your friends list won't sync.
-			sendFriendsListUpdates();
-			
-			if(mSessionTerminateRequested || !mVoiceEnabled)
-			{
-				// TODO: Question: Is this the right way out of this state?
-				setState(stateSessionTerminated);
-			}
-			else if(mTuningMode)
-			{
-				mTuningExitState = stateNoChannel;
-				setState(stateMicTuningStart);
-			}
-			else if(sessionNeedsRelog(mNextAudioSession))
-			{
-				requestRelog();
-				setState(stateSessionTerminated);
-			}
-			else if(mNextAudioSession)
-			{				
-				sessionState *oldSession = mAudioSession;
-
-				mAudioSession = mNextAudioSession;
-				if(!mAudioSession->mReconnect)	
-				{
-					mNextAudioSession = NULL;
-				}
-				
-				// The old session may now need to be deleted.
-				reapSession(oldSession);
-				
-				if(!mAudioSession->mHandle.empty())
-				{
-					// Connect to a session by session handle
-
-					sessionMediaConnectSendMessage(mAudioSession);
-				}
-				else
-				{
-					// Connect to a session by URI
-					sessionCreateSendMessage(mAudioSession, true, false);
-				}
-
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINING);
-				setState(stateJoiningSession);
-			}
-			else if(!mSpatialSessionURI.empty())
-			{
-				// If we're not headed elsewhere and have a spatial URI, return to spatial.
-				switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
-			}
-		break;
-
-		//MARK: stateJoiningSession
-		case stateJoiningSession:		// waiting for session handle
-		  
-		  // If this is true we have problem with connection to voice server (EXT-4313).
-		  // See descriptions of mSpatialJoiningNum and MAX_NORMAL_JOINING_SPATIAL_NUM.
-		  if(mSpatialJoiningNum == MAX_NORMAL_JOINING_SPATIAL_NUM) 
-		    {
-		      // Notify observers to let them know there is problem with voice
-		      notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
-		      llwarns << "There seems to be problem with connection to voice server. Disabling voice chat abilities." << llendl;
-		    }
-		  
-		  // Increase mSpatialJoiningNum only for spatial sessions- it's normal to reach this case for
-		  // example for p2p many times while waiting for response, so it can't be used to detect errors
-		  if(mAudioSession && mAudioSession->mIsSpatial)
-		    {
-		      mSpatialJoiningNum++;
-		    }
-      
-			// joinedAudioSession() will transition from here to stateSessionJoined.
-			if(!mVoiceEnabled)
-			{
-				// User bailed out during connect -- jump straight to teardown.
-				setState(stateSessionTerminated);
-			}
-			else if(mSessionTerminateRequested)
-			{
-				if(mAudioSession && !mAudioSession->mHandle.empty())
-				{
-					// Only allow direct exits from this state in p2p calls (for cancelling an invite).
-					// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
-					if(mAudioSession->mIsP2P)
-					{
-						sessionMediaDisconnectSendMessage(mAudioSession);
-						setState(stateSessionTerminated);
-					}
-				}
-			}
-		break;
-		
-		//MARK: stateSessionJoined
-		case stateSessionJoined:		// session handle received
-
-		  mSpatialJoiningNum = 0;
-			// It appears that I need to wait for BOTH the SessionGroup.AddSession response and the SessionStateChangeEvent with state 4
-			// before continuing from this state.  They can happen in either order, and if I don't wait for both, things can get stuck.
-			// For now, the SessionGroup.AddSession response handler sets mSessionHandle and the SessionStateChangeEvent handler transitions to stateSessionJoined.
-			// This is a cheap way to make sure both have happened before proceeding.
-			if(mAudioSession && mAudioSession->mVoiceEnabled)
-			{
-				// Dirty state that may need to be sync'ed with the daemon.
-				mPTTDirty = true;
-				mSpeakerVolumeDirty = true;
-				mSpatialCoordsDirty = true;
-				
-				setState(stateRunning);
-				
-				// Start the throttle timer
-				mUpdateTimer.start();
-				mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-
-				// Events that need to happen when a session is joined could go here.
-				// Maybe send initial spatial data?
-				notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_JOINED);
-
-			}
-			else if(!mVoiceEnabled)
-			{
-				// User bailed out during connect -- jump straight to teardown.
-				setState(stateSessionTerminated);
-			}
-			else if(mSessionTerminateRequested)
-			{
-				// Only allow direct exits from this state in p2p calls (for cancelling an invite).
-				// Terminating a half-connected session on other types of calls seems to break something in the vivox gateway.
-				if(mAudioSession && mAudioSession->mIsP2P)
-				{
-					sessionMediaDisconnectSendMessage(mAudioSession);
-					setState(stateSessionTerminated);
-				}
-			}
-		break;
-		
-		//MARK: stateRunning
-		case stateRunning:				// steady state
-			// Disabling voice or disconnect requested.
-			if(!mVoiceEnabled || mSessionTerminateRequested)
-			{
-				leaveAudioSession();
-			}
-			else
-			{
-				
-				// Figure out whether the PTT state needs to change
-				{
-					bool newPTT;
-					if(mUsePTT)
-					{
-						// If configured to use PTT, track the user state.
-						newPTT = mUserPTTState;
-					}
-					else
-					{
-						// If not configured to use PTT, it should always be true (otherwise the user will be unable to speak).
-						newPTT = true;
-					}
-					
-					if(mMuteMic)
-					{
-						// This always overrides any other PTT setting.
-						newPTT = false;
-					}
-					
-					// Dirty if state changed.
-					if(newPTT != mPTT)
-					{
-						mPTT = newPTT;
-						mPTTDirty = true;
-					}
-				}
-				
-				if(!inSpatialChannel())
-				{
-					// When in a non-spatial channel, never send positional updates.
-					mSpatialCoordsDirty = false;
-				}
-				else
-				{
-					// Do the calculation that enforces the listener<->speaker tether (and also updates the real camera position)
-					enforceTether();
-				}
-				
-				// Send an update if the ptt state has changed (which shouldn't be able to happen that often -- the user can only click so fast)
-				// or every 10hz, whichever is sooner.
-				if((mAudioSession && mAudioSession->mVolumeDirty) || mPTTDirty || mSpeakerVolumeDirty || mUpdateTimer.hasExpired())
-				{
-					mUpdateTimer.setTimerExpirySec(UPDATE_THROTTLE_SECONDS);
-					sendPositionalUpdate();
-				}
-			}
-		break;
-		
-		//MARK: stateLeavingSession
-		case stateLeavingSession:		// waiting for terminate session response
-			// The handler for the Session.Terminate response will transition from here to stateSessionTerminated.
-		break;
-
-		//MARK: stateSessionTerminated
-		case stateSessionTerminated:
-			
-			// Must do this first, since it uses mAudioSession.
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL);
-			
-			if(mAudioSession)
-			{
-				sessionState *oldSession = mAudioSession;
-
-				mAudioSession = NULL;
-				// We just notified status observers about this change.  Don't do it again.
-				mAudioSessionChanged = false;
-
-				// The old session may now need to be deleted.
-				reapSession(oldSession);
-			}
-			else
-			{
-				LL_WARNS("Voice") << "stateSessionTerminated with NULL mAudioSession" << LL_ENDL;
-			}
-	
-			// Always reset the terminate request flag when we get here.
-			mSessionTerminateRequested = false;
-
-			if(mVoiceEnabled && !mRelogRequested)
-			{				
-				// Just leaving a channel, go back to stateNoChannel (the "logged in but have no channel" state).
-				setState(stateNoChannel);
-			}
-			else
-			{
-				// Shutting down voice, continue with disconnecting.
-				logout();
-				
-				// The state machine will take it from here
-				mRelogRequested = false;
-			}
-			
-		break;
-		
-		//MARK: stateLoggingOut
-		case stateLoggingOut:			// waiting for logout response
-			// The handler for the AccountLoginStateChangeEvent will transition from here to stateLoggedOut.
-		break;
-		
-		//MARK: stateLoggedOut
-		case stateLoggedOut:			// logout response received
-			
-			// Once we're logged out, all these things are invalid.
-			mAccountHandle.clear();
-			deleteAllSessions();
-			deleteAllBuddies();
-
-			if(mVoiceEnabled && !mRelogRequested)
-			{
-				// User was logged out, but wants to be logged in.  Send a new login request.
-				setState(stateNeedsLogin);
-			}
-			else
-			{
-				// shut down the connector
-				connectorShutdown();
-			}
-		break;
-		
-		//MARK: stateConnectorStopping
-		case stateConnectorStopping:	// waiting for connector stop
-			// The handler for the Connector.InitiateShutdown response will transition from here to stateConnectorStopped.
-		break;
-
-		//MARK: stateConnectorStopped
-		case stateConnectorStopped:		// connector stop received
-			setState(stateDisableCleanup);
-		break;
-
-		//MARK: stateConnectorFailed
-		case stateConnectorFailed:
-			setState(stateConnectorFailedWaiting);
-		break;
-		//MARK: stateConnectorFailedWaiting
-		case stateConnectorFailedWaiting:
-			if(!mVoiceEnabled)
-			{
-				setState(stateDisableCleanup);
-			}
-		break;
-
-		//MARK: stateLoginFailed
-		case stateLoginFailed:
-			setState(stateLoginFailedWaiting);
-		break;
-		//MARK: stateLoginFailedWaiting
-		case stateLoginFailedWaiting:
-			if(!mVoiceEnabled)
-			{
-				setState(stateDisableCleanup);
-			}
-		break;
-
-		//MARK: stateJoinSessionFailed
-		case stateJoinSessionFailed:
-			// Transition to error state.  Send out any notifications here.
-			if(mAudioSession)
-			{
-				LL_WARNS("Voice") << "stateJoinSessionFailed: (" << mAudioSession->mErrorStatusCode << "): " << mAudioSession->mErrorStatusString << LL_ENDL;
-			}
-			else
-			{
-				LL_WARNS("Voice") << "stateJoinSessionFailed with no current session" << LL_ENDL;
-			}
-			
-			notifyStatusObservers(LLVoiceClientStatusObserver::ERROR_UNKNOWN);
-			setState(stateJoinSessionFailedWaiting);
-		break;
-		
-		//MARK: stateJoinSessionFailedWaiting
-		case stateJoinSessionFailedWaiting:
-			// Joining a channel failed, either due to a failed channel name -> sip url lookup or an error from the join message.
-			// Region crossings may leave this state and try the join again.
-			if(mSessionTerminateRequested)
-			{
-				setState(stateSessionTerminated);
-			}
-		break;
-		
-		//MARK: stateJail
-		case stateJail:
-			// We have given up.  Do nothing.
-		break;
-
-	}
-	
-	if(mAudioSession && mAudioSession->mParticipantsChanged)
-	{
-		mAudioSession->mParticipantsChanged = false;
-		mAudioSessionChanged = true;
-	}
-	
-	if(mAudioSessionChanged)
-	{
-		mAudioSessionChanged = false;
-		notifyParticipantObservers();
-	}
-}
-
-void LLVivoxVoiceClient::closeSocket(void)
-{
-	mSocket.reset();
-	mConnected = false;	
-}
-
-void LLVivoxVoiceClient::loginSendMessage()
-{
-	std::ostringstream stream;
-
-	bool autoPostCrashDumps = gSavedSettings.getBOOL("VivoxAutoPostCrashDumps");
-
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Login.1\">"
-		<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-		<< "<AccountName>" << mAccountName << "</AccountName>"
-		<< "<AccountPassword>" << mAccountPassword << "</AccountPassword>"
-		<< "<AudioSessionAnswerMode>VerifyAnswer</AudioSessionAnswerMode>"
-		<< "<EnableBuddiesAndPresence>true</EnableBuddiesAndPresence>"
-		<< "<BuddyManagementMode>Application</BuddyManagementMode>"
-		<< "<ParticipantPropertyFrequency>5</ParticipantPropertyFrequency>"
-		<< (autoPostCrashDumps?"<AutopostCrashDumps>true</AutopostCrashDumps>":"")
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::logout()
-{
-	// Ensure that we'll re-request provisioning before logging in again
-	mAccountPassword.clear();
-	mVoiceAccountServerURI.clear();
-	
-	setState(stateLoggingOut);
-	logoutSendMessage();
-}
-
-void LLVivoxVoiceClient::logoutSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.Logout.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		mAccountHandle.clear();
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::accountListBlockRulesSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "requesting block rules" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListBlockRules.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::accountListAutoAcceptRulesSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "requesting auto-accept rules" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.ListAutoAcceptRules.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::sessionGroupCreateSendMessage()
-{
-	if(!mAccountHandle.empty())
-	{		
-		std::ostringstream stream;
-
-		LL_DEBUGS("Voice") << "creating session group" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Create.1\">"
-			<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-			<< "<Type>Normal</Type>"
-		<< "</Request>"
-		<< "\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::sessionCreateSendMessage(sessionState *session, bool startAudio, bool startText)
-{
-	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-	
-	session->mCreateInProgress = true;
-	if(startAudio)
-	{
-		session->mMediaConnectInProgress = true;
-	}
-
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"Session.Create.1\">"
-		<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-		<< "<URI>" << session->mSIPURI << "</URI>";
-
-	static const std::string allowed_chars =
-				"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-				"0123456789"
-				"-._~";
-
-	if(!session->mHash.empty())
-	{
-		stream
-			<< "<Password>" << LLURI::escape(session->mHash, allowed_chars) << "</Password>"
-			<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>";
-	}
-	
-	stream
-		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
-		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
-		<< "<Name>" << mChannelName << "</Name>"
-	<< "</Request>\n\n\n";
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio, bool startText)
-{
-	LL_DEBUGS("Voice") << "requesting create: " << session->mSIPURI << LL_ENDL;
-	
-	session->mCreateInProgress = true;
-	if(startAudio)
-	{
-		session->mMediaConnectInProgress = true;
-	}
-	
-	std::string password;
-	if(!session->mHash.empty())
-	{
-		static const std::string allowed_chars =
-					"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
-					"0123456789"
-					"-._~"
-					;
-		password = LLURI::escape(session->mHash, allowed_chars);
-	}
-
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << session->mSIPURI << "\" action=\"SessionGroup.AddSession.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<URI>" << session->mSIPURI << "</URI>"
-		<< "<Name>" << mChannelName << "</Name>"
-		<< "<ConnectAudio>" << (startAudio?"true":"false") << "</ConnectAudio>"
-		<< "<ConnectText>" << (startText?"true":"false") << "</ConnectText>"
-		<< "<Password>" << password << "</Password>"
-		<< "<PasswordHashAlgorithm>SHA1UserName</PasswordHashAlgorithm>"
-	<< "</Request>\n\n\n"
-	;
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionMediaConnectSendMessage(sessionState *session)
-{
-	LL_DEBUGS("Voice") << "connecting audio to session handle: " << session->mHandle << LL_ENDL;
-
-	session->mMediaConnectInProgress = true;
-	
-	std::ostringstream stream;
-
-	stream
-	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.MediaConnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-		<< "<Media>Audio</Media>"
-	<< "</Request>\n\n\n";
-
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionTextConnectSendMessage(sessionState *session)
-{
-	LL_DEBUGS("Voice") << "connecting text to session handle: " << session->mHandle << LL_ENDL;
-	
-	std::ostringstream stream;
-
-	stream
-	<< "<Request requestId=\"" << session->mHandle << "\" action=\"Session.TextConnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionTerminate()
-{
-	mSessionTerminateRequested = true;
-}
-
-void LLVivoxVoiceClient::requestRelog()
-{
-	mSessionTerminateRequested = true;
-	mRelogRequested = true;
-}
-
-
-void LLVivoxVoiceClient::leaveAudioSession()
-{
-	if(mAudioSession)
-	{
-		LL_DEBUGS("Voice") << "leaving session: " << mAudioSession->mSIPURI << LL_ENDL;
-
-		switch(getState())
-		{
-			case stateNoChannel:
-				// In this case, we want to pretend the join failed so our state machine doesn't get stuck.
-				// Skip the join failed transition state so we don't send out error notifications.
-				setState(stateJoinSessionFailedWaiting);
-			break;
-			case stateJoiningSession:
-			case stateSessionJoined:
-			case stateRunning:
-				if(!mAudioSession->mHandle.empty())
-				{
-
-#if RECORD_EVERYTHING
-					// HACK: for testing only
-					// Save looped recording
-					std::string savepath("/tmp/vivoxrecording");
-					{
-						time_t now = time(NULL);
-						const size_t BUF_SIZE = 64;
-						char time_str[BUF_SIZE];	/* Flawfinder: ignore */
-						
-						strftime(time_str, BUF_SIZE, "%Y-%m-%dT%H:%M:%SZ", gmtime(&now));
-						savepath += time_str;
-					}
-					recordingLoopSave(savepath);
-#endif
-
-					sessionMediaDisconnectSendMessage(mAudioSession);
-					setState(stateLeavingSession);
-				}
-				else
-				{
-					LL_WARNS("Voice") << "called with no session handle" << LL_ENDL;	
-					setState(stateSessionTerminated);
-				}
-			break;
-			case stateJoinSessionFailed:
-			case stateJoinSessionFailedWaiting:
-				setState(stateSessionTerminated);
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "called from unknown state" << LL_ENDL;
-			break;
-		}
-	}
-	else
-	{
-		LL_WARNS("Voice") << "called with no active session" << LL_ENDL;
-		setState(stateSessionTerminated);
-	}
-}
-
-void LLVivoxVoiceClient::sessionTerminateSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.Terminate with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Terminate.1\">"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionGroupTerminateSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending SessionGroup.Terminate with handle " << session->mGroupHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.Terminate.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::sessionMediaDisconnectSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.MediaDisconnect with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.MediaDisconnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-		<< "<Media>Audio</Media>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-	
-}
-
-void LLVivoxVoiceClient::sessionTextDisconnectSendMessage(sessionState *session)
-{
-	std::ostringstream stream;
-	
-	LL_DEBUGS("Voice") << "Sending Session.TextDisconnect with handle " << session->mHandle << LL_ENDL;	
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.TextDisconnect.1\">"
-		<< "<SessionGroupHandle>" << session->mGroupHandle << "</SessionGroupHandle>"
-		<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::getCaptureDevicesSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetCaptureDevices.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::getRenderDevicesSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.GetRenderDevices.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::clearCaptureDevices()
-{
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-	mCaptureDevices.clear();
-}
-
-void LLVivoxVoiceClient::addCaptureDevice(const std::string& name)
-{
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-
-	mCaptureDevices.push_back(name);
-}
-
-LLVoiceDeviceList& LLVivoxVoiceClient::getCaptureDevices()
-{
-	return mCaptureDevices;
-}
-
-void LLVivoxVoiceClient::setCaptureDevice(const std::string& name)
-{
-	if(name == "Default")
-	{
-		if(!mCaptureDevice.empty())
-		{
-			mCaptureDevice.clear();
-			mCaptureDeviceDirty = true;	
-		}
-	}
-	else
-	{
-		if(mCaptureDevice != name)
-		{
-			mCaptureDevice = name;
-			mCaptureDeviceDirty = true;	
-		}
-	}
-}
-
-void LLVivoxVoiceClient::clearRenderDevices()
-{	
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-	mRenderDevices.clear();
-}
-
-void LLVivoxVoiceClient::addRenderDevice(const std::string& name)
-{
-	LL_DEBUGS("Voice") << name << LL_ENDL;
-	mRenderDevices.push_back(name);
-}
-
-LLVoiceDeviceList& LLVivoxVoiceClient::getRenderDevices()
-{
-	return mRenderDevices;
-}
-
-void LLVivoxVoiceClient::setRenderDevice(const std::string& name)
-{
-	if(name == "Default")
-	{
-		if(!mRenderDevice.empty())
-		{
-			mRenderDevice.clear();
-			mRenderDeviceDirty = true;	
-		}
-	}
-	else
-	{
-		if(mRenderDevice != name)
-		{
-			mRenderDevice = name;
-			mRenderDeviceDirty = true;	
-		}
-	}
-	
-}
-
-void LLVivoxVoiceClient::tuningStart()
-{
-	mTuningMode = true;
-	LL_DEBUGS("Voice") << "Starting tuning" << LL_ENDL;
-	if(getState() >= stateNoChannel)
-	{
-		LL_DEBUGS("Voice") << "no channel" << LL_ENDL;
-		sessionTerminate();
-	}
-}
-
-void LLVivoxVoiceClient::tuningStop()
-{
-	mTuningMode = false;
-}
-
-bool LLVivoxVoiceClient::inTuningMode()
-{
-	bool result = false;
-	switch(getState())
-	{
-	case stateMicTuningRunning:
-		result = true;
-		break;
-	default:
-		break;
-	}
-	return result;
-}
-
-void LLVivoxVoiceClient::tuningRenderStartSendMessage(const std::string& name, bool loop)
-{		
-	mTuningAudioFile = name;
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStart.1\">"
-    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
-    << "<Loop>" << (loop?"1":"0") << "</Loop>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::tuningRenderStopSendMessage()
-{
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.RenderAudioStop.1\">"
-    << "<SoundFilePath>" << mTuningAudioFile << "</SoundFilePath>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::tuningCaptureStartSendMessage(int duration)
-{
-	LL_DEBUGS("Voice") << "sending CaptureAudioStart" << LL_ENDL;
-	
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStart.1\">"
-    << "<Duration>" << duration << "</Duration>"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-}
-
-void LLVivoxVoiceClient::tuningCaptureStopSendMessage()
-{
-	LL_DEBUGS("Voice") << "sending CaptureAudioStop" << LL_ENDL;
-	
-	std::ostringstream stream;
-	stream
-	<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.CaptureAudioStop.1\">"
-	<< "</Request>\n\n\n";
-	
-	writeString(stream.str());
-
-	mTuningEnergy = 0.0f;
-}
-
-void LLVivoxVoiceClient::tuningSetMicVolume(float volume)
-{
-	int scaled_volume = scale_mic_volume(volume);
-
-	if(scaled_volume != mTuningMicVolume)
-	{
-		mTuningMicVolume = scaled_volume;
-		mTuningMicVolumeDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::tuningSetSpeakerVolume(float volume)
-{
-	int scaled_volume = scale_speaker_volume(volume);	
-
-	if(scaled_volume != mTuningSpeakerVolume)
-	{
-		mTuningSpeakerVolume = scaled_volume;
-		mTuningSpeakerVolumeDirty = true;
-	}
-}
-				
-float LLVivoxVoiceClient::tuningGetEnergy(void)
-{
-	return mTuningEnergy;
-}
-
-bool LLVivoxVoiceClient::deviceSettingsAvailable()
-{
-	bool result = true;
-	
-	if(!mConnected)
-		result = false;
-	
-	if(mRenderDevices.empty())
-		result = false;
-	
-	return result;
-}
-
-void LLVivoxVoiceClient::refreshDeviceLists(bool clearCurrentList)
-{
-	if(clearCurrentList)
-	{
-		clearCaptureDevices();
-		clearRenderDevices();
-	}
-	getCaptureDevicesSendMessage();
-	getRenderDevicesSendMessage();
-}
-
-void LLVivoxVoiceClient::daemonDied()
-{
-	// The daemon died, so the connection is gone.  Reset everything and start over.
-	LL_WARNS("Voice") << "Connection to vivox daemon lost.  Resetting state."<< LL_ENDL;
-
-	// Try to relaunch the daemon
-	setState(stateDisableCleanup);
-}
-
-void LLVivoxVoiceClient::giveUp()
-{
-	// All has failed.  Clean up and stop trying.
-	closeSocket();
-	deleteAllSessions();
-	deleteAllBuddies();
-	
-	setState(stateJail);
-}
-
-static void oldSDKTransform (LLVector3 &left, LLVector3 &up, LLVector3 &at, LLVector3d &pos, LLVector3 &vel)
-{
-	F32 nat[3], nup[3], nl[3], nvel[3]; // the new at, up, left vectors and the  new position and velocity
-	F64 npos[3];
-	
-	// The original XML command was sent like this:
-	/*
-			<< "<Position>"
-				<< "<X>" << pos[VX] << "</X>"
-				<< "<Y>" << pos[VZ] << "</Y>"
-				<< "<Z>" << pos[VY] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << mAvatarVelocity[VX] << "</X>"
-				<< "<Y>" << mAvatarVelocity[VZ] << "</Y>"
-				<< "<Z>" << mAvatarVelocity[VY] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << l.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VX] << "</Y>"
-				<< "<Z>" << a.mV[VX] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << l.mV[VZ] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VY] << "</X>"
-				<< "<Y>" << u.mV [VZ] << "</Y>"
-				<< "<Z>" << a.mV [VY] << "</Z>"
-			<< "</LeftOrientation>";
-	*/
-
-#if 1
-	// This was the original transform done when building the XML command
-	nat[0] = left.mV[VX];
-	nat[1] = up.mV[VX];
-	nat[2] = at.mV[VX];
-
-	nup[0] = left.mV[VZ];
-	nup[1] = up.mV[VY];
-	nup[2] = at.mV[VZ];
-
-	nl[0] = left.mV[VY];
-	nl[1] = up.mV[VZ];
-	nl[2] = at.mV[VY];
-
-	npos[0] = pos.mdV[VX];
-	npos[1] = pos.mdV[VZ];
-	npos[2] = pos.mdV[VY];
-
-	nvel[0] = vel.mV[VX];
-	nvel[1] = vel.mV[VZ];
-	nvel[2] = vel.mV[VY];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-	
-	// This was the original transform done in the SDK
-	nat[0] = at.mV[2];
-	nat[1] = 0; // y component of at vector is always 0, this was up[2]
-	nat[2] = -1 * left.mV[2];
-
-	// We override whatever the application gives us
-	nup[0] = 0; // x component of up vector is always 0
-	nup[1] = 1; // y component of up vector is always 1
-	nup[2] = 0; // z component of up vector is always 0
-
-	nl[0] = at.mV[0];
-	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
-	nl[2] = -1 * left.mV[0];
-
-	npos[2] = pos.mdV[2] * -1.0;
-	npos[1] = pos.mdV[1];
-	npos[0] = pos.mdV[0];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-#else
-	// This is the compose of the two transforms (at least, that's what I'm trying for)
-	nat[0] = at.mV[VX];
-	nat[1] = 0; // y component of at vector is always 0, this was up[2]
-	nat[2] = -1 * up.mV[VZ];
-
-	// We override whatever the application gives us
-	nup[0] = 0; // x component of up vector is always 0
-	nup[1] = 1; // y component of up vector is always 1
-	nup[2] = 0; // z component of up vector is always 0
-
-	nl[0] = left.mV[VX];
-	nl[1] = 0;  // y component of left vector is always zero, this was up[0]
-	nl[2] = -1 * left.mV[VY];
-
-	npos[0] = pos.mdV[VX];
-	npos[1] = pos.mdV[VZ];
-	npos[2] = pos.mdV[VY] * -1.0;
-
-	nvel[0] = vel.mV[VX];
-	nvel[1] = vel.mV[VZ];
-	nvel[2] = vel.mV[VY];
-
-	for(int i=0;i<3;++i) {
-		at.mV[i] = nat[i];
-		up.mV[i] = nup[i];
-		left.mV[i] = nl[i];
-		pos.mdV[i] = npos[i];
-	}
-	
-#endif
-}
-
-void LLVivoxVoiceClient::sendPositionalUpdate(void)
-{	
-	std::ostringstream stream;
-	
-	if(mSpatialCoordsDirty)
-	{
-		LLVector3 l, u, a, vel;
-		LLVector3d pos;
-
-		mSpatialCoordsDirty = false;
-		
-		// Always send both speaker and listener positions together.
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.Set3DPosition.1\">"		
-			<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>";
-		
-		stream << "<SpeakerPosition>";
-
-//		LL_DEBUGS("Voice") << "Sending speaker position " << mAvatarPosition << LL_ENDL;
-		l = mAvatarRot.getLeftRow();
-		u = mAvatarRot.getUpRow();
-		a = mAvatarRot.getFwdRow();
-		pos = mAvatarPosition;
-		vel = mAvatarVelocity;
-
-		// SLIM SDK: the old SDK was doing a transform on the passed coordinates that the new one doesn't do anymore.
-		// The old transform is replicated by this function.
-		oldSDKTransform(l, u, a, pos, vel);
-		
-		stream 
-			<< "<Position>"
-				<< "<X>" << pos.mdV[VX] << "</X>"
-				<< "<Y>" << pos.mdV[VY] << "</Y>"
-				<< "<Z>" << pos.mdV[VZ] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << vel.mV[VX] << "</X>"
-				<< "<Y>" << vel.mV[VY] << "</Y>"
-				<< "<Z>" << vel.mV[VZ] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << a.mV[VX] << "</X>"
-				<< "<Y>" << a.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << u.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << u.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VX] << "</X>"
-				<< "<Y>" << l.mV [VY] << "</Y>"
-				<< "<Z>" << l.mV [VZ] << "</Z>"
-			<< "</LeftOrientation>";
-
-		stream << "</SpeakerPosition>";
-
-		stream << "<ListenerPosition>";
-
-		LLVector3d	earPosition;
-		LLVector3	earVelocity;
-		LLMatrix3	earRot;
-		
-		switch(mEarLocation)
-		{
-			case earLocCamera:
-			default:
-				earPosition = mCameraPosition;
-				earVelocity = mCameraVelocity;
-				earRot = mCameraRot;
-			break;
-			
-			case earLocAvatar:
-				earPosition = mAvatarPosition;
-				earVelocity = mAvatarVelocity;
-				earRot = mAvatarRot;
-			break;
-			
-			case earLocMixed:
-				earPosition = mAvatarPosition;
-				earVelocity = mAvatarVelocity;
-				earRot = mCameraRot;
-			break;
-		}
-
-		l = earRot.getLeftRow();
-		u = earRot.getUpRow();
-		a = earRot.getFwdRow();
-		pos = earPosition;
-		vel = earVelocity;
-
-//		LL_DEBUGS("Voice") << "Sending listener position " << earPosition << LL_ENDL;
-		
-		oldSDKTransform(l, u, a, pos, vel);
-		
-		stream 
-			<< "<Position>"
-				<< "<X>" << pos.mdV[VX] << "</X>"
-				<< "<Y>" << pos.mdV[VY] << "</Y>"
-				<< "<Z>" << pos.mdV[VZ] << "</Z>"
-			<< "</Position>"
-			<< "<Velocity>"
-				<< "<X>" << vel.mV[VX] << "</X>"
-				<< "<Y>" << vel.mV[VY] << "</Y>"
-				<< "<Z>" << vel.mV[VZ] << "</Z>"
-			<< "</Velocity>"
-			<< "<AtOrientation>"
-				<< "<X>" << a.mV[VX] << "</X>"
-				<< "<Y>" << a.mV[VY] << "</Y>"
-				<< "<Z>" << a.mV[VZ] << "</Z>"
-			<< "</AtOrientation>"
-			<< "<UpOrientation>"
-				<< "<X>" << u.mV[VX] << "</X>"
-				<< "<Y>" << u.mV[VY] << "</Y>"
-				<< "<Z>" << u.mV[VZ] << "</Z>"
-			<< "</UpOrientation>"
-			<< "<LeftOrientation>"
-				<< "<X>" << l.mV [VX] << "</X>"
-				<< "<Y>" << l.mV [VY] << "</Y>"
-				<< "<Z>" << l.mV [VZ] << "</Z>"
-			<< "</LeftOrientation>";
-
-
-		stream << "</ListenerPosition>";
-
-		stream << "</Request>\n\n\n";
-	}	
-	
-	if(mAudioSession && mAudioSession->mVolumeDirty)
-	{
-		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-
-		mAudioSession->mVolumeDirty = false;
-		
-		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
-		{
-			participantState *p = iter->second;
-			
-			if(p->mVolumeDirty)
-			{
-				// Can't set volume/mute for yourself
-				if(!p->mIsSelf)
-				{
-					int volume = 56; // nominal default value
-					bool mute = p->mOnMuteList;
-					
-					if(p->mUserVolume != -1)
-					{
-						// scale from user volume in the range 0-400 (with 100 as "normal") to vivox volume in the range 0-100 (with 56 as "normal")
-						if(p->mUserVolume < 100)
-							volume = (p->mUserVolume * 56) / 100;
-						else
-							volume = (((p->mUserVolume - 100) * (100 - 56)) / 300) + 56;
-					}
-					else if(p->mVolume != -1)
-					{
-						// Use the previously reported internal volume (comes in with a ParticipantUpdatedEvent)
-						volume = p->mVolume;
-					}
-										
-
-					if(mute)
-					{
-						// SetParticipantMuteForMe doesn't work in p2p sessions.
-						// If we want the user to be muted, set their volume to 0 as well.
-						// This isn't perfect, but it will at least reduce their volume to a minimum.
-						volume = 0;
-					}
-					
-					if(volume == 0)
-						mute = true;
-
-					LL_DEBUGS("Voice") << "Setting volume/mute for avatar " << p->mAvatarID << " to " << volume << (mute?"/true":"/false") << LL_ENDL;
-					
-					// SLIM SDK: Send both volume and mute commands.
-					
-					// Send a "volume for me" command for the user.
-					stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantVolumeForMe.1\">"
-						<< "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
-						<< "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
-						<< "<Volume>" << volume << "</Volume>"
-						<< "</Request>\n\n\n";
-
-					if(!mAudioSession->mIsP2P)
-					  {
-					    // Send a "mute for me" command for the user
-					    // Doesn't work in P2P sessions
-					    stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SetParticipantMuteForMe.1\">"
-					      << "<SessionHandle>" << getAudioSessionHandle() << "</SessionHandle>"
-					      << "<ParticipantURI>" << p->mURI << "</ParticipantURI>"
-					      << "<Mute>" << (mute?"1":"0") << "</Mute>"
-					      << "<Scope>Audio</Scope>"
-					      << "</Request>\n\n\n";
-					    }
-				}
-				
-				p->mVolumeDirty = false;
-			}
-		}
-	}
-			
-	buildLocalAudioUpdates(stream);
-	
-	if(!stream.str().empty())
-	{
-		writeString(stream.str());
-	}
-	
-	// Friends list updates can be huge, especially on the first voice login of an account with lots of friends.
-	// Batching them all together can choke SLVoice, so send them in separate writes.
-	sendFriendsListUpdates();
-}
-
-void LLVivoxVoiceClient::buildSetCaptureDevice(std::ostringstream &stream)
-{
-	if(mCaptureDeviceDirty)
-	{
-		LL_DEBUGS("Voice") << "Setting input device = \"" << mCaptureDevice << "\"" << LL_ENDL;
-	
-		stream 
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetCaptureDevice.1\">"
-			<< "<CaptureDeviceSpecifier>" << mCaptureDevice << "</CaptureDeviceSpecifier>"
-		<< "</Request>"
-		<< "\n\n\n";
-		
-		mCaptureDeviceDirty = false;
-	}
-}
-
-void LLVivoxVoiceClient::buildSetRenderDevice(std::ostringstream &stream)
-{
-	if(mRenderDeviceDirty)
-	{
-		LL_DEBUGS("Voice") << "Setting output device = \"" << mRenderDevice << "\"" << LL_ENDL;
-
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Aux.SetRenderDevice.1\">"
-			<< "<RenderDeviceSpecifier>" << mRenderDevice << "</RenderDeviceSpecifier>"
-		<< "</Request>"
-		<< "\n\n\n";
-		mRenderDeviceDirty = false;
-	}
-}
-
-void LLVivoxVoiceClient::buildLocalAudioUpdates(std::ostringstream &stream)
-{
-	buildSetCaptureDevice(stream);
-
-	buildSetRenderDevice(stream);
-
-	if(mPTTDirty)
-	{
-		mPTTDirty = false;
-
-		// Send a local mute command.
-		// NOTE that the state of "PTT" is the inverse of "local mute".
-		//   (i.e. when PTT is true, we send a mute command with "false", and vice versa)
-		
-		LL_DEBUGS("Voice") << "Sending MuteLocalMic command with parameter " << (mPTT?"false":"true") << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalMic.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << (mPTT?"false":"true") << "</Value>"
-			<< "</Request>\n\n\n";
-		
-	}
-
-	if(mSpeakerMuteDirty)
-	{
-	  const char *muteval = ((mSpeakerVolume <= scale_speaker_volume(0))?"true":"false");
-
-		mSpeakerMuteDirty = false;
-
-		LL_INFOS("Voice") << "Setting speaker mute to " << muteval  << LL_ENDL;
-		
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.MuteLocalSpeaker.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << muteval << "</Value>"
-			<< "</Request>\n\n\n";	
-		
-	}
-	
-	if(mSpeakerVolumeDirty)
-	{
-		mSpeakerVolumeDirty = false;
-
-		LL_INFOS("Voice") << "Setting speaker volume to " << mSpeakerVolume  << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalSpeakerVolume.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << mSpeakerVolume << "</Value>"
-			<< "</Request>\n\n\n";
-			
-	}
-	
-	if(mMicVolumeDirty)
-	{
-		mMicVolumeDirty = false;
-
-		LL_INFOS("Voice") << "Setting mic volume to " << mMicVolume  << LL_ENDL;
-
-		stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Connector.SetLocalMicVolume.1\">"
-			<< "<ConnectorHandle>" << mConnectorHandle << "</ConnectorHandle>"
-			<< "<Value>" << mMicVolume << "</Value>"
-			<< "</Request>\n\n\n";				
-	}
-
-	
-}
-
-void LLVivoxVoiceClient::checkFriend(const LLUUID& id)
-{
-	std::string name;
-	buddyListEntry *buddy = findBuddy(id);
-
-	// Make sure we don't add a name before it's been looked up.
-	if(gCacheName->getFullName(id, name))
-	{
-
-		const LLRelationship* relationInfo = LLAvatarTracker::instance().getBuddyInfo(id);
-		bool canSeeMeOnline = false;
-		if(relationInfo && relationInfo->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS))
-			canSeeMeOnline = true;
-		
-		// When we get here, mNeedsSend is true and mInSLFriends is false.  Change them as necessary.
-		
-		if(buddy)
-		{
-			// This buddy is already in both lists.
-
-			if(name != buddy->mDisplayName)
-			{
-				// The buddy is in the list with the wrong name.  Update it with the correct name.
-				LL_WARNS("Voice") << "Buddy " << id << " has wrong name (\"" << buddy->mDisplayName << "\" should be \"" << name << "\"), updating."<< LL_ENDL;
-				buddy->mDisplayName = name;
-				buddy->mNeedsNameUpdate = true;		// This will cause the buddy to be resent.
-			}
-		}
-		else
-		{
-			// This buddy was not in the vivox list, needs to be added.
-			buddy = addBuddy(sipURIFromID(id), name);
-			buddy->mUUID = id;
-		}
-		
-		// In all the above cases, the buddy is in the SL friends list (which is how we got here).
-		buddy->mInSLFriends = true;
-		buddy->mCanSeeMeOnline = canSeeMeOnline;
-		buddy->mNameResolved = true;
-		
-	}
-	else
-	{
-		// This name hasn't been looked up yet.  Don't do anything with this buddy list entry until it has.
-		if(buddy)
-		{
-			buddy->mNameResolved = false;
-		}
-		
-		// Initiate a lookup.
-		// The "lookup completed" callback will ensure that the friends list is rechecked after it completes.
-		lookupName(id);
-	}
-}
-
-void LLVivoxVoiceClient::clearAllLists()
-{
-	// FOR TESTING ONLY
-	
-	// This will send the necessary commands to delete ALL buddies, autoaccept rules, and block rules SLVoice tells us about.
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
-	{
-		buddyListEntry *buddy = buddy_it->second;
-		buddy_it++;
-		
-		std::ostringstream stream;
-
-		if(buddy->mInVivoxBuddies)
-		{
-			// delete this entry from the vivox buddy list
-			buddy->mInVivoxBuddies = false;
-			LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-				<< "</Request>\n\n\n";		
-		}
-
-		if(buddy->mHasBlockListEntry)
-		{
-			// Delete the associated block list entry (so the block list doesn't fill up with junk)
-			buddy->mHasBlockListEntry = false;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-				<< "</Request>\n\n\n";								
-		}
-		if(buddy->mHasAutoAcceptListEntry)
-		{
-			// Delete the associated auto-accept list entry (so the auto-accept list doesn't fill up with junk)
-			buddy->mHasAutoAcceptListEntry = false;
-			stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-				<< "</Request>\n\n\n";
-		}
-
-		writeString(stream.str());
-
-	}
-}
-
-void LLVivoxVoiceClient::sendFriendsListUpdates()
-{
-	if(mBuddyListMapPopulated && mBlockRulesListReceived && mAutoAcceptRulesListReceived && mFriendsListDirty)
-	{
-		mFriendsListDirty = false;
-		
-		if(0)
-		{
-			// FOR TESTING ONLY -- clear all buddy list, block list, and auto-accept list entries.
-			clearAllLists();
-			return;
-		}
-		
-		LL_INFOS("Voice") << "Checking vivox buddy list against friends list..." << LL_ENDL;
-		
-		buddyListMap::iterator buddy_it;
-		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
-		{
-			// reset the temp flags in the local buddy list
-			buddy_it->second->mInSLFriends = false;
-		}
-		
-		// correlate with the friends list
-		{
-			LLCollectAllBuddies collect;
-			LLAvatarTracker::instance().applyFunctor(collect);
-			LLCollectAllBuddies::buddy_map_t::const_iterator it = collect.mOnline.begin();
-			LLCollectAllBuddies::buddy_map_t::const_iterator end = collect.mOnline.end();
-			
-			for ( ; it != end; ++it)
-			{
-				checkFriend(it->second);
-			}
-			it = collect.mOffline.begin();
-			end = collect.mOffline.end();
-			for ( ; it != end; ++it)
-			{
-				checkFriend(it->second);
-			}
-		}
-				
-		LL_INFOS("Voice") << "Sending friend list updates..." << LL_ENDL;
-
-		for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end();)
-		{
-			buddyListEntry *buddy = buddy_it->second;
-			buddy_it++;
-			
-			// Ignore entries that aren't resolved yet.
-			if(buddy->mNameResolved)
-			{
-				std::ostringstream stream;
-
-				if(buddy->mInSLFriends && (!buddy->mInVivoxBuddies || buddy->mNeedsNameUpdate))
-				{					
-					if(mNumberOfAliases > 0)
-					{
-						// Add (or update) this entry in the vivox buddy list
-						buddy->mInVivoxBuddies = true;
-						buddy->mNeedsNameUpdate = false;
-						LL_DEBUGS("Voice") << "add/update " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-						stream 
-							<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddySet.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-								<< "<DisplayName>" << buddy->mDisplayName << "</DisplayName>"
-								<< "<BuddyData></BuddyData>"	// Without this, SLVoice doesn't seem to parse the command.
-								<< "<GroupID>0</GroupID>"
-							<< "</Request>\n\n\n";	
-					}
-				}
-				else if(!buddy->mInSLFriends)
-				{
-					// This entry no longer exists in your SL friends list.  Remove all traces of it from the Vivox buddy list.
- 					if(buddy->mInVivoxBuddies)
-					{
-						// delete this entry from the vivox buddy list
-						buddy->mInVivoxBuddies = false;
-						LL_DEBUGS("Voice") << "delete " << buddy->mURI << " (" << buddy->mDisplayName << ")" << LL_ENDL;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.BuddyDelete.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-							<< "</Request>\n\n\n";		
-					}
-
-					if(buddy->mHasBlockListEntry)
-					{
-						// Delete the associated block list entry, if any
-						buddy->mHasBlockListEntry = false;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-							<< "</Request>\n\n\n";								
-					}
-					if(buddy->mHasAutoAcceptListEntry)
-					{
-						// Delete the associated auto-accept list entry, if any
-						buddy->mHasAutoAcceptListEntry = false;
-						stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-							<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-							<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-							<< "</Request>\n\n\n";
-					}
-				}
-				
-				if(buddy->mInSLFriends)
-				{
-
-					if(buddy->mCanSeeMeOnline)
-					{
-						// Buddy should not be blocked.
-
-						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-						
-						// If the buddy has a block list entry, delete it.
-						if(buddy->mHasBlockListEntry)
-						{
-							buddy->mHasBlockListEntry = false;
-							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteBlockRule.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-								<< "</Request>\n\n\n";		
-							
-							
-							// If we just deleted a block list entry, add an auto-accept entry.
-							if(!buddy->mHasAutoAcceptListEntry)
-							{
-								buddy->mHasAutoAcceptListEntry = true;								
-								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateAutoAcceptRule.1\">"
-									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-									<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-									<< "<AutoAddAsBuddy>0</AutoAddAsBuddy>"
-									<< "</Request>\n\n\n";
-							}
-						}
-					}
-					else
-					{
-						// Buddy should be blocked.
-						
-						// If this buddy doesn't already have either a block or autoaccept list entry, we'll update their status when we receive a SubscriptionEvent.
-
-						// If this buddy has an autoaccept entry, delete it
-						if(buddy->mHasAutoAcceptListEntry)
-						{
-							buddy->mHasAutoAcceptListEntry = false;
-							stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.DeleteAutoAcceptRule.1\">"
-								<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-								<< "<AutoAcceptMask>" << buddy->mURI << "</AutoAcceptMask>"
-								<< "</Request>\n\n\n";
-						
-							// If we just deleted an auto-accept entry, add a block list entry.
-							if(!buddy->mHasBlockListEntry)
-							{
-								buddy->mHasBlockListEntry = true;
-								stream << "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.CreateBlockRule.1\">"
-									<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-									<< "<BlockMask>" << buddy->mURI << "</BlockMask>"
-									<< "<PresenceOnly>1</PresenceOnly>"
-									<< "</Request>\n\n\n";								
-							}
-						}
-					}
-
-					if(!buddy->mInSLFriends && !buddy->mInVivoxBuddies)
-					{
-						// Delete this entry from the local buddy list.  This should NOT invalidate the iterator,
-						// since it has already been incremented to the next entry.
-						deleteBuddy(buddy->mURI);
-					}
-
-				}
-				writeString(stream.str());
-			}
-		}
-	}
-}
-
-/////////////////////////////
-// Response/Event handlers
-
-void LLVivoxVoiceClient::connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID)
-{	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Connector.Create response failure: " << statusString << LL_ENDL;
-		setState(stateConnectorFailed);
-		LLSD args;
-		std::stringstream errs;
-		errs << mVoiceAccountServerURI << "\n:UDP: 3478, 3479, 5060, 5062, 12000-17000";
-		args["HOSTID"] = errs.str();
-		if (LLGridManager::getInstance()->isSystemGrid())
-		{
-			LLNotificationsUtil::add("NoVoiceConnect", args);	
-		}
-		else
-		{
-			LLNotificationsUtil::add("NoVoiceConnect-GIAB", args);	
-		}
-	}
-	else
-	{
-		// Connector created, move forward.
-		LL_INFOS("Voice") << "Connector.Create succeeded, Vivox SDK version is " << versionID << LL_ENDL;
-		mVoiceVersion.serverVersion = versionID;
-		mConnectorHandle = connectorHandle;
-		if(getState() == stateConnectorStarting)
-		{
-			setState(stateConnectorStarted);
-		}
-	}
-}
-
-void LLVivoxVoiceClient::loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases)
-{ 
-	LL_DEBUGS("Voice") << "Account.Login response (" << statusCode << "): " << statusString << LL_ENDL;
-	
-	// Status code of 20200 means "bad password".  We may want to special-case that at some point.
-	
-	if ( statusCode == 401 )
-	{
-		// Login failure which is probably caused by the delay after a user's password being updated.
-		LL_INFOS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		setState(stateLoginRetry);
-	}
-	else if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Account.Login response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		setState(stateLoginFailed);
-	}
-	else
-	{
-		// Login succeeded, move forward.
-		mAccountHandle = accountHandle;
-		mNumberOfAliases = numberOfAliases;
-		// This needs to wait until the AccountLoginStateChangeEvent is received.
-//		if(getState() == stateLoggingIn)
-//		{
-//			setState(stateLoggedIn);
-//		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{	
-	sessionState *session = findSessionBeingCreatedByURI(requestId);
-	
-	if(session)
-	{
-		session->mCreateInProgress = false;
-	}
-	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Session.Create response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-			{
-				setState(stateJoinSessionFailed);
-			}
-			else
-			{
-				reapSession(session);
-			}
-		}
-	}
-	else
-	{
-		LL_INFOS("Voice") << "Session.Create response received (success), session handle is " << sessionHandle << LL_ENDL;
-		if(session)
-		{
-			setSessionHandle(session, sessionHandle);
-		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle)
-{	
-	sessionState *session = findSessionBeingCreatedByURI(requestId);
-	
-	if(session)
-	{
-		session->mCreateInProgress = false;
-	}
-	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "SessionGroup.AddSession response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-			{
-				setState(stateJoinSessionFailed);
-			}
-			else
-			{
-				reapSession(session);
-			}
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "SessionGroup.AddSession response received (success), session handle is " << sessionHandle << LL_ENDL;
-		if(session)
-		{
-			setSessionHandle(session, sessionHandle);
-		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString)
-{
-	sessionState *session = findSession(requestId);
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Session.Connect response failure (" << statusCode << "): " << statusString << LL_ENDL;
-		if(session)
-		{
-			session->mMediaConnectInProgress = false;
-			session->mErrorStatusCode = statusCode;		
-			session->mErrorStatusString = statusString;
-			if(session == mAudioSession)
-				setState(stateJoinSessionFailed);
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Session.Connect response received (success)" << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::logoutResponse(int statusCode, std::string &statusString)
-{	
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Account.Logout response failure: " << statusString << LL_ENDL;
-		// Should this ever fail?  do we care if it does?
-	}
-}
-
-void LLVivoxVoiceClient::connectorShutdownResponse(int statusCode, std::string &statusString)
-{
-	if(statusCode != 0)
-	{
-		LL_WARNS("Voice") << "Connector.InitiateShutdown response failure: " << statusString << LL_ENDL;
-		// Should this ever fail?  do we care if it does?
-	}
-	
-	mConnected = false;
-	
-	if(getState() == stateConnectorStopping)
-	{
-		setState(stateConnectorStopped);
-	}
-}
-
-void LLVivoxVoiceClient::sessionAddedEvent(
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		bool isChannel, 
-		bool incoming,
-		std::string &nameString,
-		std::string &applicationString)
-{
-	sessionState *session = NULL;
-
-	LL_INFOS("Voice") << "session " << uriString << ", alias " << alias << ", name " << nameString << " handle " << sessionHandle << LL_ENDL;
-	
-	session = addSession(uriString, sessionHandle);
-	if(session)
-	{
-		session->mGroupHandle = sessionGroupHandle;
-		session->mIsChannel = isChannel;
-		session->mIncoming = incoming;
-		session->mAlias = alias;
-			
-		// Generate a caller UUID -- don't need to do this for channels
-		if(!session->mIsChannel)
-		{
-			if(IDFromName(session->mSIPURI, session->mCallerID))
-			{
-				// Normal URI(base64-encoded UUID) 
-			}
-			else if(!session->mAlias.empty() && IDFromName(session->mAlias, session->mCallerID))
-			{
-				// Wrong URI, but an alias is available.  Stash the incoming URI as an alternate
-				session->mAlternateSIPURI = session->mSIPURI;
-				
-				// and generate a proper URI from the ID.
-				setSessionURI(session, sipURIFromID(session->mCallerID));
-			}
-			else
-			{
-				LL_INFOS("Voice") << "Could not generate caller id from uri, using hash of uri " << session->mSIPURI << LL_ENDL;
-				setUUIDFromStringHash(session->mCallerID, session->mSIPURI);
-				session->mSynthesizedCallerID = true;
-				
-				// Can't look up the name in this case -- we have to extract it from the URI.
-				std::string namePortion = nameFromsipURI(session->mSIPURI);
-				if(namePortion.empty())
-				{
-					// Didn't seem to be a SIP URI, just use the whole provided name.
-					namePortion = nameString;
-				}
-				
-				// Some incoming names may be separated with an underscore instead of a space.  Fix this.
-				LLStringUtil::replaceChar(namePortion, '_', ' ');
-				
-				// Act like we just finished resolving the name (this stores it in all the right places)
-				avatarNameResolved(session->mCallerID, namePortion);
-			}
-		
-			LL_INFOS("Voice") << "caller ID: " << session->mCallerID << LL_ENDL;
-
-			if(!session->mSynthesizedCallerID)
-			{
-				// If we got here, we don't have a proper name.  Initiate a lookup.
-				lookupName(session->mCallerID);
-			}
-		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionGroupAddedEvent(std::string &sessionGroupHandle)
-{
-	LL_DEBUGS("Voice") << "handle " << sessionGroupHandle << LL_ENDL;
-	
-#if USE_SESSION_GROUPS
-	if(mMainSessionGroupHandle.empty())
-	{
-		// This is the first (i.e. "main") session group.  Save its handle.
-		mMainSessionGroupHandle = sessionGroupHandle;
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Already had a session group handle " << mMainSessionGroupHandle << LL_ENDL;
-	}
-#endif
-}
-
-void LLVivoxVoiceClient::joinedAudioSession(sessionState *session)
-{
-	LL_DEBUGS("Voice") << "Joined Audio Session" << LL_ENDL;
-	if(mAudioSession != session)
-	{
-		sessionState *oldSession = mAudioSession;
-
-		mAudioSession = session;
-		mAudioSessionChanged = true;
-
-		// The old session may now need to be deleted.
-		reapSession(oldSession);
-	}
-	
-	// This is the session we're joining.
-	if(getState() == stateJoiningSession)
-	{
-		setState(stateSessionJoined);
-		
-		// SLIM SDK: we don't always receive a participant state change for ourselves when joining a channel now.
-		// Add the current user as a participant here.
-		participantState *participant = session->addParticipant(sipURIFromName(mAccountName));
-		if(participant)
-		{
-			participant->mIsSelf = true;
-			lookupName(participant->mAvatarID);
-
-			LL_INFOS("Voice") << "added self as participant \"" << participant->mAccountName 
-					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-		}
-		
-		if(!session->mIsChannel)
-		{
-			// this is a p2p session.  Make sure the other end is added as a participant.
-			participantState *participant = session->addParticipant(session->mSIPURI);
-			if(participant)
-			{
-				if(participant->mAvatarIDValid)
-				{
-					lookupName(participant->mAvatarID);
-				}
-				else if(!session->mName.empty())
-				{
-					participant->mDisplayName = session->mName;
-					avatarNameResolved(participant->mAvatarID, session->mName);
-				}
-				
-				// TODO: Question: Do we need to set up mAvatarID/mAvatarIDValid here?
-				LL_INFOS("Voice") << "added caller as participant \"" << participant->mAccountName 
-						<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-			}
-		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionRemovedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle)
-{
-	LL_INFOS("Voice") << "handle " << sessionHandle << LL_ENDL;
-	
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		leftAudioSession(session);
-
-		// This message invalidates the session's handle.  Set it to empty.
-		setSessionHandle(session);
-		
-		// This also means that the session's session group is now empty.
-		// Terminate the session group so it doesn't leak.
-		sessionGroupTerminateSendMessage(session);
-		
-		// Reset the media state (we now have no info)
-		session->mMediaStreamState = streamStateUnknown;
-		session->mTextStreamState = streamStateUnknown;
-		
-		// Conditionally delete the session
-		reapSession(session);
-	}
-	else
-	{
-		LL_WARNS("Voice") << "unknown session " << sessionHandle << " removed" << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::reapSession(sessionState *session)
-{
-	if(session)
-	{
-		if(!session->mHandle.empty())
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (non-null session handle)" << LL_ENDL;
-		}
-		else if(session->mCreateInProgress)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (create in progress)" << LL_ENDL;
-		}
-		else if(session->mMediaConnectInProgress)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (connect in progress)" << LL_ENDL;
-		}
-		else if(session == mAudioSession)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the current session)" << LL_ENDL;
-		}
-		else if(session == mNextAudioSession)
-		{
-			LL_DEBUGS("Voice") << "NOT deleting session " << session->mSIPURI << " (it's the next session)" << LL_ENDL;
-		}
-		else
-		{
-			// TODO: Question: Should we check for queued text messages here?
-			// We don't have a reason to keep tracking this session, so just delete it.
-			LL_DEBUGS("Voice") << "deleting session " << session->mSIPURI << LL_ENDL;
-			deleteSession(session);
-			session = NULL;
-		}	
-	}
-	else
-	{
-//		LL_DEBUGS("Voice") << "session is NULL" << LL_ENDL;
-	}
-}
-
-// Returns true if the session seems to indicate we've moved to a region on a different voice server
-bool LLVivoxVoiceClient::sessionNeedsRelog(sessionState *session)
-{
-	bool result = false;
-	
-	if(session != NULL)
-	{
-		// Only make this check for spatial channels (so it won't happen for group or p2p calls)
-		if(session->mIsSpatial)
-		{	
-			std::string::size_type atsign;
-			
-			atsign = session->mSIPURI.find("@");
-			
-			if(atsign != std::string::npos)
-			{
-				std::string urihost = session->mSIPURI.substr(atsign + 1);
-				if(stricmp(urihost.c_str(), mVoiceSIPURIHostName.c_str()))
-				{
-					// The hostname in this URI is different from what we expect.  This probably means we need to relog.
-					
-					// We could make a ProvisionVoiceAccountRequest and compare the result with the current values of
-					// mVoiceSIPURIHostName and mVoiceAccountServerURI to be really sure, but this is a pretty good indicator.
-					
-					result = true;
-				}
-			}
-		}
-	}
-	
-	return result;
-}
-
-void LLVivoxVoiceClient::leftAudioSession(
-	sessionState *session)
-{
-	if(mAudioSession == session)
-	{
-		switch(getState())
-		{
-			case stateJoiningSession:
-			case stateSessionJoined:
-			case stateRunning:
-			case stateLeavingSession:
-			case stateJoinSessionFailed:
-			case stateJoinSessionFailedWaiting:
-				// normal transition
-				LL_DEBUGS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
-				setState(stateSessionTerminated);
-			break;
-			
-			case stateSessionTerminated:
-				// this will happen sometimes -- there are cases where we send the terminate and then go straight to this state.
-				LL_WARNS("Voice") << "left session " << session->mHandle << " in state " << state2string(getState()) << LL_ENDL;
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "unexpected SessionStateChangeEvent (left session) in state " << state2string(getState()) << LL_ENDL;
-				setState(stateSessionTerminated);
-			break;
-		}
-	}
-}
-
-void LLVivoxVoiceClient::accountLoginStateChangeEvent(
-		std::string &accountHandle, 
-		int statusCode, 
-		std::string &statusString, 
-		int state)
-{
-	/*
-		According to Mike S., status codes for this event are:
-		login_state_logged_out=0,
-        login_state_logged_in = 1,
-        login_state_logging_in = 2,
-        login_state_logging_out = 3,
-        login_state_resetting = 4,
-        login_state_error=100	
-	*/
-	
-	LL_DEBUGS("Voice") << "state change event: " << state << LL_ENDL;
-	switch(state)
-	{
-		case 1:
-		if(getState() == stateLoggingIn)
-		{
-			setState(stateLoggedIn);
-		}
-		break;
-
-		case 3:
-			// The user is in the process of logging out.
-			setState(stateLoggingOut);
-		break;
-
-		case 0:
-			// The user has been logged out.  
-			setState(stateLoggedOut);
-		break;
-		
-		default:
-			//Used to be a commented out warning
-			LL_DEBUGS("Voice") << "unknown state: " << state << LL_ENDL;
-		break;
-	}
-}
-
-void LLVivoxVoiceClient::mediaStreamUpdatedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle, 
-	int statusCode, 
-	std::string &statusString, 
-	int state, 
-	bool incoming)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	LL_DEBUGS("Voice") << "session " << sessionHandle << ", status code " << statusCode << ", string \"" << statusString << "\"" << LL_ENDL;
-	
-	if(session)
-	{
-		// We know about this session
-		
-		// Save the state for later use
-		session->mMediaStreamState = state;
-		
-		switch(statusCode)
-		{
-			case 0:
-			case 200:
-				// generic success
-				// Don't change the saved error code (it may have been set elsewhere)
-			break;
-			default:
-				// save the status code for later
-				session->mErrorStatusCode = statusCode;
-			break;
-		}
-		
-		switch(state)
-		{
-			case streamStateIdle:
-				// Standard "left audio session"
-				session->mVoiceEnabled = false;
-				session->mMediaConnectInProgress = false;
-				leftAudioSession(session);
-			break;
-
-			case streamStateConnected:
-				session->mVoiceEnabled = true;
-				session->mMediaConnectInProgress = false;
-				joinedAudioSession(session);
-			break;
-			
-			case streamStateRinging:
-				if(incoming)
-				{
-					// Send the voice chat invite to the GUI layer
-					// TODO: Question: Should we correlate with the mute list here?
-					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);
-					session->mVoiceInvitePending = true;
-					if(session->mName.empty())
-					{
-						lookupName(session->mCallerID);
-					}
-					else
-					{
-						// Act like we just finished resolving the name
-						avatarNameResolved(session->mCallerID, session->mName);
-					}
-				}
-			break;
-			
-			default:
-				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
-			break;
-			
-		}
-		
-	}
-	else
-	{
-		LL_WARNS("Voice") << "session " << sessionHandle << "not found"<< LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::textStreamUpdatedEvent(
-	std::string &sessionHandle, 
-	std::string &sessionGroupHandle, 
-	bool enabled,
-	int state, 
-	bool incoming)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	if(session)
-	{
-		// Save the state for later use
-		session->mTextStreamState = state;
-		
-		// We know about this session
-		switch(state)
-		{
-			case 0:	// We see this when the text stream closes
-				LL_DEBUGS("Voice") << "stream closed" << LL_ENDL;
-			break;
-			
-			case 1:	// We see this on an incoming call from the Connector
-				// Try to send any text messages queued for this session.
-				sendQueuedTextMessages(session);
-
-				// Send the text chat invite to the GUI layer
-				// TODO: Question: Should we correlate with the mute list here?
-				session->mTextInvitePending = true;
-				if(session->mName.empty())
-				{
-					lookupName(session->mCallerID);
-				}
-				else
-				{
-					// Act like we just finished resolving the name
-					avatarNameResolved(session->mCallerID, session->mName);
-				}
-			break;
-
-			default:
-				LL_WARNS("Voice") << "unknown state " << state << LL_ENDL;
-			break;
-			
-		}
-	}
-}
-
-void LLVivoxVoiceClient::participantAddedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &nameString, 
-		std::string &displayNameString, 
-		int participantType)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->addParticipant(uriString);
-		if(participant)
-		{
-			participant->mAccountName = nameString;
-
-			LL_DEBUGS("Voice") << "added participant \"" << participant->mAccountName 
-					<< "\" (" << participant->mAvatarID << ")"<< LL_ENDL;
-
-			if(participant->mAvatarIDValid)
-			{
-				// Initiate a lookup
-				lookupName(participant->mAvatarID);
-			}
-			else
-			{
-				// If we don't have a valid avatar UUID, we need to fill in the display name to make the active speakers floater work.
-				std::string namePortion = nameFromsipURI(uriString);
-				if(namePortion.empty())
-				{
-					// Problem with the SIP URI, fall back to the display name
-					namePortion = displayNameString;
-				}
-				if(namePortion.empty())
-				{
-					// Problems with both of the above, fall back to the account name
-					namePortion = nameString;
-				}
-				
-				// Set the display name (which is a hint to the active speakers window not to do its own lookup)
-				participant->mDisplayName = namePortion;
-				avatarNameResolved(participant->mAvatarID, namePortion);
-			}
-		}
-	}
-}
-
-void LLVivoxVoiceClient::participantRemovedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &nameString)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		if(participant)
-		{
-			session->removeParticipant(participant);
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "unknown participant " << uriString << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
-	}
-}
-
-
-void LLVivoxVoiceClient::participantUpdatedEvent(
-		std::string &sessionHandle, 
-		std::string &sessionGroupHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		bool isModeratorMuted, 
-		bool isSpeaking, 
-		int volume, 
-		F32 energy)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		
-		if(participant)
-		{
-			participant->mIsSpeaking = isSpeaking;
-			participant->mIsModeratorMuted = isModeratorMuted;
-
-			// SLIM SDK: convert range: ensure that energy is set to zero if is_speaking is false
-			if (isSpeaking)
-			{
-				participant->mSpeakingTimeout.reset();
-				participant->mPower = energy;
-			}
-			else
-			{
-				participant->mPower = 0.0f;
-			}
-
-			// *HACK: Minimal hack to fix EXT-6508, ignore the incoming volume if it is zero.
-			// This happens because we send volume zero to Vivox when someone is muted,
-			// Vivox then send it back to us, overwriting the previous volume.
-			// Remove this hack once volume refactoring from EXT-6031 is applied.
-			if (volume != 0)
-			  {
-			    participant->mVolume = volume;
-			  }
- 
-			
-			// *HACK: mantipov: added while working on EXT-3544                                                                                   
-			/*                                                                                                                                    
-			 Sometimes LLVoiceClient::participantUpdatedEvent callback is called BEFORE                                                            
-			 LLViewerChatterBoxSessionAgentListUpdates::post() sometimes AFTER.                                                                    
-			 
-			 participantUpdatedEvent updates voice participant state in particular participantState::mIsModeratorMuted                             
-			 Originally we wanted to update session Speaker Manager to fire LLSpeakerVoiceModerationEvent to fix the EXT-3544 bug.                 
-			 Calling of the LLSpeakerMgr::update() method was added into LLIMMgr::processAgentListUpdates.                                         
-			 
-			 But in case participantUpdatedEvent() is called after LLViewerChatterBoxSessionAgentListUpdates::post()                               
-			 voice participant mIsModeratorMuted is changed after speakers are updated in Speaker Manager                                          
-			 and event is not fired.                                                                                                               
-			 
-			 So, we have to call LLSpeakerMgr::update() here. In any case it is better than call it                                                
-			 in LLCallFloater::draw()                                                                                                              
-			 */
-			LLVoiceChannel* voice_cnl = LLVoiceChannel::getCurrentVoiceChannel();
-			
-			// ignore session ID of local chat                                                                                                    
-			if (voice_cnl && voice_cnl->getSessionID().notNull())
-			{
-				LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(voice_cnl->getSessionID());
-				if (speaker_manager)
-				{
-					speaker_manager->update(true);
-				}
-			}
-			
-		}
-		else
-		{
-			LL_WARNS("Voice") << "unknown participant: " << uriString << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_INFOS("Voice") << "unknown session " << sessionHandle << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::buddyPresenceEvent(
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &statusString,
-		std::string &applicationString)
-{
-	buddyListEntry *buddy = findBuddy(uriString);
-	
-	if(buddy)
-	{
-		LL_DEBUGS("Voice") << "Presence event for " << buddy->mDisplayName << " status \"" << statusString << "\", application \"" << applicationString << "\""<< LL_ENDL;
-		LL_DEBUGS("Voice") << "before: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-
-		if(applicationString.empty())
-		{
-			// This presence event is from a client that doesn't set up the Application string.  Do things the old-skool way.
-			// NOTE: this will be needed to support people who aren't on the 3010-class SDK yet.
-
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// User went offline with a non-SLim-enabled viewer.
-				buddy->mOnlineSL = false;
-			}
-			else if ( stricmp("Online", statusString.c_str())== 0) 
-			{
-				// User came online with a non-SLim-enabled viewer.
-				buddy->mOnlineSL = true;
-			}
-			else
-			{
-				// If the user is online through SLim, their status will be "Online-slc", "Away", or something else.
-				// NOTE: we should never see this unless someone is running an OLD version of SLim -- the versions that should be in use now all set the application string.
-				buddy->mOnlineSLim = true;
-			} 
-		}
-		else if(applicationString.find("SecondLifeViewer") != std::string::npos)
-		{
-			// This presence event is from a viewer that sets the application string
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// Viewer says they're offline
-				buddy->mOnlineSL = false;
-			}
-			else
-			{
-				// Viewer says they're online
-				buddy->mOnlineSL = true;
-			}
-		}
-		else
-		{
-			// This presence event is from something which is NOT the SL viewer (assume it's SLim).
-			if ( stricmp("Unknown", statusString.c_str())== 0) 
-			{
-				// SLim says they're offline
-				buddy->mOnlineSLim = false;
-			}
-			else
-			{
-				// SLim says they're online
-				buddy->mOnlineSLim = true;
-			}
-		} 
-
-		LL_DEBUGS("Voice") << "after: mOnlineSL = " << (buddy->mOnlineSL?"true":"false") << ", mOnlineSLim = " << (buddy->mOnlineSLim?"true":"false") << LL_ENDL;
-		
-		// HACK -- increment the internal change serial number in the LLRelationship (without changing the actual status), so the UI notices the change.
-		LLAvatarTracker::instance().setBuddyOnline(buddy->mUUID,LLAvatarTracker::instance().isBuddyOnline(buddy->mUUID));
-
-		notifyFriendObservers();
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Presence for unknown buddy " << uriString << LL_ENDL;
-	}	
-}
-
-void LLVivoxVoiceClient::messageEvent(
-		std::string &sessionHandle, 
-		std::string &uriString, 
-		std::string &alias, 
-		std::string &messageHeader, 
-		std::string &messageBody,
-		std::string &applicationString)
-{
-	LL_DEBUGS("Voice") << "Message event, session " << sessionHandle << " from " << uriString << LL_ENDL;
-//	LL_DEBUGS("Voice") << "    header " << messageHeader << ", body: \n" << messageBody << LL_ENDL;
-	
-	if(messageHeader.find("text/html") != std::string::npos)
-	{
-		std::string message;
-
-		{
-			const std::string startMarker = "<body";
-			const std::string startMarker2 = ">";
-			const std::string endMarker = "</body>";
-			const std::string startSpan = "<span";
-			const std::string endSpan = "</span>";
-			std::string::size_type start;
-			std::string::size_type end;
-			
-			// Default to displaying the raw string, so the message gets through.
-			message = messageBody;
-
-			// Find the actual message text within the XML fragment
-			start = messageBody.find(startMarker);
-			start = messageBody.find(startMarker2, start);
-			end = messageBody.find(endMarker);
-
-			if(start != std::string::npos)
-			{
-				start += startMarker2.size();
-				
-				if(end != std::string::npos)
-					end -= start;
-					
-				message.assign(messageBody, start, end);
-			}
-			else 
-			{
-				// Didn't find a <body>, try looking for a <span> instead.
-				start = messageBody.find(startSpan);
-				start = messageBody.find(startMarker2, start);
-				end = messageBody.find(endSpan);
-				
-				if(start != std::string::npos)
-				{
-					start += startMarker2.size();
-					
-					if(end != std::string::npos)
-						end -= start;
-					
-					message.assign(messageBody, start, end);
-				}			
-			}
-		}	
-		
-//		LL_DEBUGS("Voice") << "    raw message = \n" << message << LL_ENDL;
-
-		// strip formatting tags
-		{
-			std::string::size_type start;
-			std::string::size_type end;
-			
-			while((start = message.find('<')) != std::string::npos)
-			{
-				if((end = message.find('>', start + 1)) != std::string::npos)
-				{
-					// Strip out the tag
-					message.erase(start, (end + 1) - start);
-				}
-				else
-				{
-					// Avoid an infinite loop
-					break;
-				}
-			}
-		}
-		
-		// Decode ampersand-escaped chars
-		{
-			std::string::size_type mark = 0;
-
-			// The text may contain text encoded with &lt;, &gt;, and &amp;
-			mark = 0;
-			while((mark = message.find("&lt;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 4, "<");
-				mark += 1;
-			}
-			
-			mark = 0;
-			while((mark = message.find("&gt;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 4, ">");
-				mark += 1;
-			}
-			
-			mark = 0;
-			while((mark = message.find("&amp;", mark)) != std::string::npos)
-			{
-				message.replace(mark, 5, "&");
-				mark += 1;
-			}
-		}
-		
-		// strip leading/trailing whitespace (since we always seem to get a couple newlines)
-		LLStringUtil::trim(message);
-		
-//		LL_DEBUGS("Voice") << "    stripped message = \n" << message << LL_ENDL;
-		
-		sessionState *session = findSession(sessionHandle);
-		if(session)
-		{
-			bool is_busy = gAgent.getBusy();
-			bool is_muted = LLMuteList::getInstance()->isMuted(session->mCallerID, session->mName, LLMute::flagTextChat);
-			bool is_linden = LLMuteList::getInstance()->isLinden(session->mName);
-			bool quiet_chat = false;
-			LLChat chat;
-
-			chat.mMuted = is_muted && !is_linden;
-			
-			if(!chat.mMuted)
-			{
-				chat.mFromID = session->mCallerID;
-				chat.mFromName = session->mName;
-				chat.mSourceType = CHAT_SOURCE_AGENT;
-
-				if(is_busy && !is_linden)
-				{
-					quiet_chat = true;
-					// TODO: Question: Return busy mode response here?  Or maybe when session is started instead?
-				}
-				
-				LL_DEBUGS("Voice") << "adding message, name " << session->mName << " session " << session->mIMSessionID << ", target " << session->mCallerID << LL_ENDL;
-				gIMMgr->addMessage(session->mIMSessionID,
-						session->mCallerID,
-						session->mName.c_str(),
-						message.c_str(),
-						LLStringUtil::null,		// default arg
-						IM_NOTHING_SPECIAL,		// default arg
-						0,						// default arg
-						LLUUID::null,			// default arg
-						LLVector3::zero,		// default arg
-						true);					// prepend name and make it a link to the user's profile
-
-			}
-		}		
-	}
-}
-
-void LLVivoxVoiceClient::sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType)
-{
-	sessionState *session = findSession(sessionHandle);
-	
-	if(session)
-	{
-		participantState *participant = session->findParticipant(uriString);
-		if(participant)
-		{
-			if (!stricmp(notificationType.c_str(), "Typing"))
-			{
-				// Other end started typing
-				// TODO: The proper way to add a typing notification seems to be LLIMMgr::processIMTypingStart().
-				// It requires an LLIMInfo for the message, which we don't have here.
-			}
-			else if (!stricmp(notificationType.c_str(), "NotTyping"))
-			{
-				// Other end stopped typing
-				// TODO: The proper way to remove a typing notification seems to be LLIMMgr::processIMTypingStop().
-				// It requires an LLIMInfo for the message, which we don't have here.
-			}
-			else
-			{
-				LL_DEBUGS("Voice") << "Unknown notification type " << notificationType << "for participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
-			}
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "Unknown participant " << uriString << " in session " << session->mSIPURI << LL_ENDL;
-		}
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "Unknown session handle " << sessionHandle << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType)
-{
-	buddyListEntry *buddy = findBuddy(buddyURI);
-	
-	if(!buddy)
-	{
-		// Couldn't find buddy by URI, try converting the alias...
-		if(!alias.empty())
-		{
-			LLUUID id;
-			if(IDFromName(alias, id))
-			{
-				buddy = findBuddy(id);
-			}
-		}
-	}
-	
-	if(buddy)
-	{
-		std::ostringstream stream;
-		
-		if(buddy->mCanSeeMeOnline)
-		{
-			// Sending the response will create an auto-accept rule
-			buddy->mHasAutoAcceptListEntry = true;
-		}
-		else
-		{
-			// Sending the response will create a block rule
-			buddy->mHasBlockListEntry = true;
-		}
-		
-		if(buddy->mInSLFriends)
-		{
-			buddy->mInVivoxBuddies = true;
-		}
-		
-		stream
-			<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Account.SendSubscriptionReply.1\">"
-				<< "<AccountHandle>" << mAccountHandle << "</AccountHandle>"
-				<< "<BuddyURI>" << buddy->mURI << "</BuddyURI>"
-				<< "<RuleType>" << (buddy->mCanSeeMeOnline?"Allow":"Hide") << "</RuleType>"
-				<< "<AutoAccept>"<< (buddy->mInSLFriends?"1":"0")<< "</AutoAccept>"
-				<< "<SubscriptionHandle>" << subscriptionHandle << "</SubscriptionHandle>"
-			<< "</Request>"
-			<< "\n\n\n";
-			
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::auxAudioPropertiesEvent(F32 energy)
-{
-	LL_DEBUGS("Voice") << "got energy " << energy << LL_ENDL;
-	mTuningEnergy = energy;
-}
-
-void LLVivoxVoiceClient::buddyListChanged()
-{
-	// This is called after we receive a BuddyAndGroupListChangedEvent.
-	mBuddyListMapPopulated = true;
-	mFriendsListDirty = true;
-}
-
-void LLVivoxVoiceClient::muteListChanged()
-{
-	// The user's mute list has been updated.  Go through the current participant list and sync it with the mute list.
-	if(mAudioSession)
-	{
-		participantMap::iterator iter = mAudioSession->mParticipantsByURI.begin();
-		
-		for(; iter != mAudioSession->mParticipantsByURI.end(); iter++)
-		{
-			participantState *p = iter->second;
-			
-			// Check to see if this participant is on the mute list already
-			if(p->updateMuteState())
-				mAudioSession->mVolumeDirty = true;
-		}
-	}
-}
-
-void LLVivoxVoiceClient::updateFriends(U32 mask)
-{
-	if(mask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::POWERS))
-	{
-		// Just resend the whole friend list to the daemon
-		mFriendsListDirty = true;
-	}
-}
-
-/////////////////////////////
-// Managing list of participants
-LLVivoxVoiceClient::participantState::participantState(const std::string &uri) : 
-	 mURI(uri), 
-	 mPTT(false), 
-	 mIsSpeaking(false), 
-	 mIsModeratorMuted(false), 
-	 mLastSpokeTimestamp(0.f), 
-	 mPower(0.f), 
-	 mVolume(-1), 
-	 mOnMuteList(false), 
-	 mUserVolume(-1), 
-	 mVolumeDirty(false), 
-	 mAvatarIDValid(false),
-	 mIsSelf(false)
-{
-}
-
-LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::addParticipant(const std::string &uri)
-{
-	participantState *result = NULL;
-	bool useAlternateURI = false;
-	
-	// Note: this is mostly the body of LLVivoxVoiceClient::sessionState::findParticipant(), but since we need to know if it
-	// matched the alternate SIP URI (so we can add it properly), we need to reproduce it here.
-	{
-		participantMap::iterator iter = mParticipantsByURI.find(uri);
-
-		if(iter == mParticipantsByURI.end())
-		{
-			if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
-			{
-				// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
-				// Use mSIPURI instead, since it will be properly encoded.
-				iter = mParticipantsByURI.find(mSIPURI);
-				useAlternateURI = true;
-			}
-		}
-
-		if(iter != mParticipantsByURI.end())
-		{
-			result = iter->second;
-		}
-	}
-		
-	if(!result)
-	{
-		// participant isn't already in one list or the other.
-		result = new participantState(useAlternateURI?mSIPURI:uri);
-		mParticipantsByURI.insert(participantMap::value_type(result->mURI, result));
-		mParticipantsChanged = true;
-		
-		// Try to do a reverse transform on the URI to get the GUID back.
-		{
-			LLUUID id;
-			if(LLVivoxVoiceClient::getInstance()->IDFromName(result->mURI, id))
-			{
-				result->mAvatarIDValid = true;
-				result->mAvatarID = id;
-
-				if(result->updateMuteState())
-					mVolumeDirty = true;
-			}
-			else
-			{
-				// Create a UUID by hashing the URI, but do NOT set mAvatarIDValid.
-				// This tells both code in LLVivoxVoiceClient and code in llfloateractivespeakers.cpp that the ID will not be in the name cache.
-				setUUIDFromStringHash(result->mAvatarID, uri);
-			}
-		}
-		
-		mParticipantsByUUID.insert(participantUUIDMap::value_type(result->mAvatarID, result));
-
-		result->mUserVolume = LLSpeakerVolumeStorage::getInstance()->getSpeakerVolume(result->mAvatarID);
-		
-		LL_DEBUGS("Voice") << "participant \"" << result->mURI << "\" added." << LL_ENDL;
-	}
-	
-	return result;
-}
-
-bool LLVivoxVoiceClient::participantState::updateMuteState()
-{
-	bool result = false;
-	
-	if(mAvatarIDValid)
-	{
-		bool isMuted = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat);
-		if(mOnMuteList != isMuted)
-		{
-			mOnMuteList = isMuted;
-			mVolumeDirty = true;
-			result = true;
-		}
-	}
-	return result;
-}
-
-bool LLVivoxVoiceClient::participantState::isAvatar()
-{
-	return mAvatarIDValid;
-}
-
-void LLVivoxVoiceClient::sessionState::removeParticipant(LLVivoxVoiceClient::participantState *participant)
-{
-	if(participant)
-	{
-		participantMap::iterator iter = mParticipantsByURI.find(participant->mURI);
-		participantUUIDMap::iterator iter2 = mParticipantsByUUID.find(participant->mAvatarID);
-		
-		LL_DEBUGS("Voice") << "participant \"" << participant->mURI <<  "\" (" << participant->mAvatarID << ") removed." << LL_ENDL;
-		
-		if(iter == mParticipantsByURI.end())
-		{
-			LL_ERRS("Voice") << "Internal error: participant " << participant->mURI << " not in URI map" << LL_ENDL;
-		}
-		else if(iter2 == mParticipantsByUUID.end())
-		{
-			LL_ERRS("Voice") << "Internal error: participant ID " << participant->mAvatarID << " not in UUID map" << LL_ENDL;
-		}
-		else if(iter->second != iter2->second)
-		{
-			LL_ERRS("Voice") << "Internal error: participant mismatch!" << LL_ENDL;
-		}
-		else
-		{
-			mParticipantsByURI.erase(iter);
-			mParticipantsByUUID.erase(iter2);
-			
-			delete participant;
-			mParticipantsChanged = true;
-		}
-	}
-}
-
-void LLVivoxVoiceClient::sessionState::removeAllParticipants()
-{
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-
-	while(!mParticipantsByURI.empty())
-	{
-		removeParticipant(mParticipantsByURI.begin()->second);
-	}
-	
-	if(!mParticipantsByUUID.empty())
-	{
-		LL_ERRS("Voice") << "Internal error: empty URI map, non-empty UUID map" << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::getParticipantList(std::set<LLUUID> &participants)
-{
-	if(mAudioSession)
-	{
-		for(participantUUIDMap::iterator iter = mAudioSession->mParticipantsByUUID.begin();
-			iter != mAudioSession->mParticipantsByUUID.end(); 
-			iter++)
-		{
-			participants.insert(iter->first);
-		}
-	}
-}
-
-bool LLVivoxVoiceClient::isParticipant(const LLUUID &speaker_id)
-{
-  if(mAudioSession)
-    {
-      return (mAudioSession->mParticipantsByUUID.find(speaker_id) != mAudioSession->mParticipantsByUUID.end());
-    }
-  return false;
-}
-
-
-LLVivoxVoiceClient::participantState *LLVivoxVoiceClient::sessionState::findParticipant(const std::string &uri)
-{
-	participantState *result = NULL;
-	
-	participantMap::iterator iter = mParticipantsByURI.find(uri);
-
-	if(iter == mParticipantsByURI.end())
-	{
-		if(!mAlternateSIPURI.empty() && (uri == mAlternateSIPURI))
-		{
-			// This is a p2p session (probably with the SLIM client) with an alternate URI for the other participant.
-			// Look up the other URI
-			iter = mParticipantsByURI.find(mSIPURI);
-		}
-	}
-
-	if(iter != mParticipantsByURI.end())
-	{
-		result = iter->second;
-	}
-		
-	return result;
-}
-
-LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::sessionState::findParticipantByID(const LLUUID& id)
-{
-	participantState * result = NULL;
-	participantUUIDMap::iterator iter = mParticipantsByUUID.find(id);
-
-	if(iter != mParticipantsByUUID.end())
-	{
-		result = iter->second;
-	}
-
-	return result;
-}
-
-LLVivoxVoiceClient::participantState* LLVivoxVoiceClient::findParticipantByID(const LLUUID& id)
-{
-	participantState * result = NULL;
-	
-	if(mAudioSession)
-	{
-		result = mAudioSession->findParticipantByID(id);
-	}
-	
-	return result;
-}
-
-
-void LLVivoxVoiceClient::parcelChanged()
-{
-	if(getState() >= stateNoChannel)
-	{
-		// If the user is logged in, start a channel lookup.
-		LL_DEBUGS("Voice") << "sending ParcelVoiceInfoRequest (" << mCurrentRegionName << ", " << mCurrentParcelLocalID << ")" << LL_ENDL;
-
-		std::string url = gAgent.getRegion()->getCapability("ParcelVoiceInfoRequest");
-		LLSD data;
-		LLHTTPClient::post(
-			url,
-			data,
-			new LLVivoxVoiceClientCapResponder);
-	}
-	else
-	{
-		// The transition to stateNoChannel needs to kick this off again.
-		LL_INFOS("Voice") << "not logged in yet, deferring" << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::switchChannel(
-	std::string uri,
-	bool spatial,
-	bool no_reconnect,
-	bool is_p2p,
-	std::string hash)
-{
-	bool needsSwitch = false;
-	
-	LL_DEBUGS("Voice") 
-		<< "called in state " << state2string(getState()) 
-		<< " with uri \"" << uri << "\"" 
-		<< (spatial?", spatial is true":", spatial is false")
-		<< LL_ENDL;
-	
-	switch(getState())
-	{
-		case stateJoinSessionFailed:
-		case stateJoinSessionFailedWaiting:
-		case stateNoChannel:
-			// Always switch to the new URI from these states.
-			needsSwitch = true;
-		break;
-
-		default:
-			if(mSessionTerminateRequested)
-			{
-				// If a terminate has been requested, we need to compare against where the URI we're already headed to.
-				if(mNextAudioSession)
-				{
-					if(mNextAudioSession->mSIPURI != uri)
-						needsSwitch = true;
-				}
-				else
-				{
-					// mNextAudioSession is null -- this probably means we're on our way back to spatial.
-					if(!uri.empty())
-					{
-						// We do want to process a switch in this case.
-						needsSwitch = true;
-					}
-				}
-			}
-			else
-			{
-				// Otherwise, compare against the URI we're in now.
-				if(mAudioSession)
-				{
-					if(mAudioSession->mSIPURI != uri)
-					{
-						needsSwitch = true;
-					}
-				}
-				else
-				{
-					if(!uri.empty())
-					{
-						// mAudioSession is null -- it's not clear what case would cause this.
-						// For now, log it as a warning and see if it ever crops up.
-						LL_WARNS("Voice") << "No current audio session." << LL_ENDL;
-					}
-				}
-			}
-		break;
-	}
-	
-	if(needsSwitch)
-	{
-		if(uri.empty())
-		{
-			// Leave any channel we may be in
-			LL_DEBUGS("Voice") << "leaving channel" << LL_ENDL;
-
-			sessionState *oldSession = mNextAudioSession;
-			mNextAudioSession = NULL;
-
-			// The old session may now need to be deleted.
-			reapSession(oldSession);
-
-			notifyStatusObservers(LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED);
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "switching to channel " << uri << LL_ENDL;
-
-			mNextAudioSession = addSession(uri);
-			mNextAudioSession->mHash = hash;
-			mNextAudioSession->mIsSpatial = spatial;
-			mNextAudioSession->mReconnect = !no_reconnect;
-			mNextAudioSession->mIsP2P = is_p2p;
-		}
-		
-		if(getState() <= stateNoChannel)
-		{
-			// We're already set up to join a channel, just needed to fill in the session URI
-		}
-		else
-		{
-			// State machine will come around and rejoin if uri/handle is not empty.
-			sessionTerminate();
-		}
-	}
-}
-
-void LLVivoxVoiceClient::joinSession(sessionState *session)
-{
-	mNextAudioSession = session;
-	
-	if(getState() <= stateNoChannel)
-	{
-		// We're already set up to join a channel, just needed to fill in the session handle
-	}
-	else
-	{
-		// State machine will come around and rejoin if uri/handle is not empty.
-		sessionTerminate();
-	}
-}
-
-void LLVivoxVoiceClient::setNonSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
-{
-	switchChannel(uri, false, false, false, credentials);
-}
-
-void LLVivoxVoiceClient::setSpatialChannel(
-	const std::string &uri,
-	const std::string &credentials)
-{
-	mSpatialSessionURI = uri;
-	mSpatialSessionCredentials = credentials;
-	mAreaVoiceDisabled = mSpatialSessionURI.empty();
-
-	LL_DEBUGS("Voice") << "got spatial channel uri: \"" << uri << "\"" << LL_ENDL;
-	
-	if((mAudioSession && !(mAudioSession->mIsSpatial)) || (mNextAudioSession && !(mNextAudioSession->mIsSpatial)))
-	{
-		// User is in a non-spatial chat or joining a non-spatial chat.  Don't switch channels.
-		LL_INFOS("Voice") << "in non-spatial chat, not switching channels" << LL_ENDL;
-	}
-	else
-	{
-		switchChannel(mSpatialSessionURI, true, false, false, mSpatialSessionCredentials);
-	}
-}
-
-void LLVivoxVoiceClient::callUser(const LLUUID &uuid)
-{
-	std::string userURI = sipURIFromID(uuid);
-
-	switchChannel(userURI, false, true, true);
-}
-
-LLVivoxVoiceClient::sessionState* LLVivoxVoiceClient::startUserIMSession(const LLUUID &uuid)
-{
-	// Figure out if a session with the user already exists
-	sessionState *session = findSession(uuid);
-	if(!session)
-	{
-		// No session with user, need to start one.
-		std::string uri = sipURIFromID(uuid);
-		session = addSession(uri);
-
-		llassert(session);
-		if (!session) return NULL;
-
-		session->mIsSpatial = false;
-		session->mReconnect = false;	
-		session->mIsP2P = true;
-		session->mCallerID = uuid;
-	}
-	
-	if(session->mHandle.empty())
-	  {
-	    // Session isn't active -- start it up.
-	    sessionCreateSendMessage(session, false, true);
-	  }
-	else
-	  {	
-	    // Session is already active -- start up text.
-	    sessionTextConnectSendMessage(session);
-	  }
-	
-	return session;
-}
-
-BOOL LLVivoxVoiceClient::sendTextMessage(const LLUUID& participant_id, const std::string& message)
-{
-	bool result = false;
-
-	// Attempt to locate the indicated session
-	sessionState *session = startUserIMSession(participant_id);
-	if(session)
-	{
-		// found the session, attempt to send the message
-		session->mTextMsgQueue.push(message);
-		
-		// Try to send queued messages (will do nothing if the session is not open yet)
-		sendQueuedTextMessages(session);
-
-		// The message is queued, so we succeed.
-		result = true;
-	}	
-	else
-	{
-		LL_DEBUGS("Voice") << "Session not found for participant ID " << participant_id << LL_ENDL;
-	}
-	
-	return result;
-}
-
-void LLVivoxVoiceClient::sendQueuedTextMessages(sessionState *session)
-{
-	if(session->mTextStreamState == 1)
-	{
-		if(!session->mTextMsgQueue.empty())
-		{
-			std::ostringstream stream;
-			
-			while(!session->mTextMsgQueue.empty())
-			{
-				std::string message = session->mTextMsgQueue.front();
-				session->mTextMsgQueue.pop();
-				stream
-				<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"Session.SendMessage.1\">"
-					<< "<SessionHandle>" << session->mHandle << "</SessionHandle>"
-					<< "<MessageHeader>text/HTML</MessageHeader>"
-					<< "<MessageBody>" << message << "</MessageBody>"
-				<< "</Request>"
-				<< "\n\n\n";
-			}		
-			writeString(stream.str());
-		}
-	}
-	else
-	{
-		// Session isn't connected yet, defer until later.
-	}
-}
-
-void LLVivoxVoiceClient::endUserIMSession(const LLUUID &uuid)
-{
-	// Figure out if a session with the user exists
-	sessionState *session = findSession(uuid);
-	if(session)
-	{
-		// found the session
-		if(!session->mHandle.empty())
-		{
-			sessionTextDisconnectSendMessage(session);
-		}
-	}	
-	else
-	{
-		LL_DEBUGS("Voice") << "Session not found for participant ID " << uuid << LL_ENDL;
-	}
-}
-
-bool LLVivoxVoiceClient::answerInvite(std::string &sessionHandle)
-{
-	// this is only ever used to answer incoming p2p call invites.
-	
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		session->mIsSpatial = false;
-		session->mReconnect = false;	
-		session->mIsP2P = true;
-
-		joinSession(session);
-		return true;
-	}
-	
-	return false;
-}
-
-BOOL LLVivoxVoiceClient::isOnlineSIP(const LLUUID &id)
-{
-	bool result = false;
-	buddyListEntry *buddy = findBuddy(id);
-	if(buddy)
-	{
-		result = buddy->mOnlineSLim;
-		LL_DEBUGS("Voice") << "Buddy " << buddy->mDisplayName << " is SIP " << (result?"online":"offline") << LL_ENDL;
-	}
-
-	if(!result)
-	{
-		// This user isn't on the buddy list or doesn't show online status through the buddy list, but could be a participant in an existing session if they initiated a text IM.
-		sessionState *session = findSession(id);
-		if(session && !session->mHandle.empty())
-		{
-			if((session->mTextStreamState != streamStateUnknown) || (session->mMediaStreamState > streamStateIdle))
-			{
-				LL_DEBUGS("Voice") << "Open session with " << id << " found, returning SIP online state" << LL_ENDL;
-				// we have a p2p text session open with this user, so by definition they're online.
-				result = true;
-			}
-		}
-	}
-	
-	return result;
-}
-
-bool LLVivoxVoiceClient::isVoiceWorking()
-{
-  //Added stateSessionTerminated state to avoid problems with call in parcels with disabled voice (EXT-4758)
-  // Condition with joining spatial num was added to take into account possible problems with connection to voice
-  // server(EXT-4313). See bug descriptions and comments for MAX_NORMAL_JOINING_SPATIAL_NUM for more info.
-  return (mSpatialJoiningNum < MAX_NORMAL_JOINING_SPATIAL_NUM) && (stateLoggedIn <= mState) && (mState <= stateSessionTerminated);
-}
-
-// Returns true if the indicated participant in the current audio session is really an SL avatar.
-// Currently this will be false only for PSTN callers into group chats, and PSTN p2p calls.
-BOOL LLVivoxVoiceClient::isParticipantAvatar(const LLUUID &id)
-{
-	BOOL result = TRUE; 
-	sessionState *session = findSession(id);
-	
-	if(session != NULL)
-	{
-		// this is a p2p session with the indicated caller, or the session with the specified UUID.
-		if(session->mSynthesizedCallerID)
-			result = FALSE;
-	}
-	else
-	{
-		// Didn't find a matching session -- check the current audio session for a matching participant
-		if(mAudioSession != NULL)
-		{
-			participantState *participant = findParticipantByID(id);
-			if(participant != NULL)
-			{
-				result = participant->isAvatar();
-			}
-		}
-	}
-	
-	return result;
-}
-
-// Returns true if calling back the session URI after the session has closed is possible.
-// Currently this will be false only for PSTN P2P calls.		
-BOOL LLVivoxVoiceClient::isSessionCallBackPossible(const LLUUID &session_id)
-{
-	BOOL result = TRUE; 
-	sessionState *session = findSession(session_id);
-	
-	if(session != NULL)
-	{
-		result = session->isCallBackPossible();
-	}
-	
-	return result;
-}
-
-// Returns true if the session can accepte text IM's.
-// Currently this will be false only for PSTN P2P calls.
-BOOL LLVivoxVoiceClient::isSessionTextIMPossible(const LLUUID &session_id)
-{
-	bool result = TRUE; 
-	sessionState *session = findSession(session_id);
-	
-	if(session != NULL)
-	{
-		result = session->isTextIMPossible();
-	}
-	
-	return result;
-}
-		
-
-void LLVivoxVoiceClient::declineInvite(std::string &sessionHandle)
-{
-	sessionState *session = findSession(sessionHandle);
-	if(session)
-	{
-		sessionMediaDisconnectSendMessage(session);
-	}
-}
-
-void LLVivoxVoiceClient::leaveNonSpatialChannel()
-{
-	LL_DEBUGS("Voice") 
-		<< "called in state " << state2string(getState()) 
-		<< LL_ENDL;
-	
-	// Make sure we don't rejoin the current session.	
-	sessionState *oldNextSession = mNextAudioSession;
-	mNextAudioSession = NULL;
-	
-	// Most likely this will still be the current session at this point, but check it anyway.
-	reapSession(oldNextSession);
-	
-	verifySessionState();
-	
-	sessionTerminate();
-}
-
-std::string LLVivoxVoiceClient::getCurrentChannel()
-{
-	std::string result;
-	
-	if((getState() == stateRunning) && !mSessionTerminateRequested)
-	{
-		result = getAudioSessionURI();
-	}
-	
-	return result;
-}
-
-bool LLVivoxVoiceClient::inProximalChannel()
-{
-	bool result = false;
-	
-	if((getState() == stateRunning) && !mSessionTerminateRequested)
-	{
-		result = inSpatialChannel();
-	}
-	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::sipURIFromID(const LLUUID &id)
-{
-	std::string result;
-	result = "sip:";
-	result += nameFromID(id);
-	result += "@";
-	result += mVoiceSIPURIHostName;
-	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::sipURIFromAvatar(LLVOAvatar *avatar)
-{
-	std::string result;
-	if(avatar)
-	{
-		result = "sip:";
-		result += nameFromID(avatar->getID());
-		result += "@";
-		result += mVoiceSIPURIHostName;
-	}
-	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::nameFromAvatar(LLVOAvatar *avatar)
-{
-	std::string result;
-	if(avatar)
-	{
-		result = nameFromID(avatar->getID());
-	}	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::nameFromID(const LLUUID &uuid)
-{
-	std::string result;
-	
-	if (uuid.isNull()) {
-		//VIVOX, the uuid emtpy look for the mURIString and return that instead.
-		//result.assign(uuid.mURIStringName);
-		LLStringUtil::replaceChar(result, '_', ' ');
-		return result;
-	}
-	// Prepending this apparently prevents conflicts with reserved names inside the vivox and diamondware code.
-	result = "x";
-	
-	// Base64 encode and replace the pieces of base64 that are less compatible 
-	// with e-mail local-parts.
-	// See RFC-4648 "Base 64 Encoding with URL and Filename Safe Alphabet"
-	result += LLBase64::encode(uuid.mData, UUID_BYTES);
-	LLStringUtil::replaceChar(result, '+', '-');
-	LLStringUtil::replaceChar(result, '/', '_');
-	
-	// If you need to transform a GUID to this form on the Mac OS X command line, this will do so:
-	// echo -n x && (echo e669132a-6c43-4ee1-a78d-6c82fff59f32 |xxd -r -p |openssl base64|tr '/+' '_-')
-	
-	// The reverse transform can be done with:
-	// echo 'x5mkTKmxDTuGnjWyC__WfMg==' |cut -b 2- -|tr '_-' '/+' |openssl base64 -d|xxd -p
-	
-	return result;
-}
-
-bool LLVivoxVoiceClient::IDFromName(const std::string inName, LLUUID &uuid)
-{
-	bool result = false;
-	
-	// SLIM SDK: The "name" may actually be a SIP URI such as: "sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com"
-	// If it is, convert to a bare name before doing the transform.
-	std::string name = nameFromsipURI(inName);
-	
-	// Doesn't look like a SIP URI, assume it's an actual name.
-	if(name.empty())
-		name = inName;
-
-	// This will only work if the name is of the proper form.
-	// As an example, the account name for Monroe Linden (UUID 1673cfd3-8229-4445-8d92-ec3570e5e587) is:
-	// "xFnPP04IpREWNkuw1cOXlhw=="
-	
-	if((name.size() == 25) && (name[0] == 'x') && (name[23] == '=') && (name[24] == '='))
-	{
-		// The name appears to have the right form.
-
-		// Reverse the transforms done by nameFromID
-		std::string temp = name;
-		LLStringUtil::replaceChar(temp, '-', '+');
-		LLStringUtil::replaceChar(temp, '_', '/');
-
-		U8 rawuuid[UUID_BYTES + 1]; 
-		int len = apr_base64_decode_binary(rawuuid, temp.c_str() + 1);
-		if(len == UUID_BYTES)
-		{
-			// The decode succeeded.  Stuff the bits into the result's UUID
-			memcpy(uuid.mData, rawuuid, UUID_BYTES);
-			result = true;
-		}
-	} 
-	
-	if(!result)
-	{
-		// VIVOX:  not a standard account name, just copy the URI name mURIString field
-		// and hope for the best.  bpj
-		uuid.setNull();  // VIVOX, set the uuid field to nulls
-	}
-	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::displayNameFromAvatar(LLVOAvatar *avatar)
-{
-	return avatar->getFullname();
-}
-
-std::string LLVivoxVoiceClient::sipURIFromName(std::string &name)
-{
-	std::string result;
-	result = "sip:";
-	result += name;
-	result += "@";
-	result += mVoiceSIPURIHostName;
-
-//	LLStringUtil::toLower(result);
-
-	return result;
-}
-
-std::string LLVivoxVoiceClient::nameFromsipURI(const std::string &uri)
-{
-	std::string result;
-
-	std::string::size_type sipOffset, atOffset;
-	sipOffset = uri.find("sip:");
-	atOffset = uri.find("@");
-	if((sipOffset != std::string::npos) && (atOffset != std::string::npos))
-	{
-		result = uri.substr(sipOffset + 4, atOffset - (sipOffset + 4));
-	}
-	
-	return result;
-}
-
-bool LLVivoxVoiceClient::inSpatialChannel(void)
-{
-	bool result = false;
-	
-	if(mAudioSession)
-		result = mAudioSession->mIsSpatial;
-		
-	return result;
-}
-
-std::string LLVivoxVoiceClient::getAudioSessionURI()
-{
-	std::string result;
-	
-	if(mAudioSession)
-		result = mAudioSession->mSIPURI;
-		
-	return result;
-}
-
-std::string LLVivoxVoiceClient::getAudioSessionHandle()
-{
-	std::string result;
-	
-	if(mAudioSession)
-		result = mAudioSession->mHandle;
-		
-	return result;
-}
-
-
-/////////////////////////////
-// Sending updates of current state
-
-void LLVivoxVoiceClient::enforceTether(void)
-{
-	LLVector3d tethered	= mCameraRequestedPosition;
-
-	// constrain 'tethered' to within 50m of mAvatarPosition.
-	{
-		F32 max_dist = 50.0f;
-		LLVector3d camera_offset = mCameraRequestedPosition - mAvatarPosition;
-		F32 camera_distance = (F32)camera_offset.magVec();
-		if(camera_distance > max_dist)
-		{
-			tethered = mAvatarPosition + 
-				(max_dist / camera_distance) * camera_offset;
-		}
-	}
-	
-	if(dist_vec(mCameraPosition, tethered) > 0.1)
-	{
-		mCameraPosition = tethered;
-		mSpatialCoordsDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::updatePosition(void)
-{
-	
-	LLViewerRegion *region = gAgent.getRegion();
-	if(region && isAgentAvatarValid())
-	{
-		LLMatrix3 rot;
-		LLVector3d pos;
-		
-		// TODO: If camera and avatar velocity are actually used by the voice system, we could compute them here...
-		// They're currently always set to zero.
-		
-		// Send the current camera position to the voice code
-		rot.setRows(LLViewerCamera::getInstance()->getAtAxis(), LLViewerCamera::getInstance()->getLeftAxis (),  LLViewerCamera::getInstance()->getUpAxis());		
-		pos = gAgent.getRegion()->getPosGlobalFromRegion(LLViewerCamera::getInstance()->getOrigin());
-		
-		LLVivoxVoiceClient::getInstance()->setCameraPosition(
-															 pos,				// position
-															 LLVector3::zero, 	// velocity
-															 rot);				// rotation matrix
-		
-		// Send the current avatar position to the voice code
-		rot = gAgentAvatarp->getRootJoint()->getWorldRotation().getMatrix3();
-		pos = gAgentAvatarp->getPositionGlobal();
-
-		// TODO: Can we get the head offset from outside the LLVOAvatar?
-		//			pos += LLVector3d(mHeadOffset);
-		pos += LLVector3d(0.f, 0.f, 1.f);
-		
-		LLVivoxVoiceClient::getInstance()->setAvatarPosition(
-															 pos,				// position
-															 LLVector3::zero, 	// velocity
-															 rot);				// rotation matrix
-	}
-}
-
-void LLVivoxVoiceClient::setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
-{
-	mCameraRequestedPosition = position;
-	
-	if(mCameraVelocity != velocity)
-	{
-		mCameraVelocity = velocity;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mCameraRot != rot)
-	{
-		mCameraRot = rot;
-		mSpatialCoordsDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot)
-{
-	if(dist_vec(mAvatarPosition, position) > 0.1)
-	{
-		mAvatarPosition = position;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mAvatarVelocity != velocity)
-	{
-		mAvatarVelocity = velocity;
-		mSpatialCoordsDirty = true;
-	}
-	
-	if(mAvatarRot != rot)
-	{
-		mAvatarRot = rot;
-		mSpatialCoordsDirty = true;
-	}
-}
-
-bool LLVivoxVoiceClient::channelFromRegion(LLViewerRegion *region, std::string &name)
-{
-	bool result = false;
-	
-	if(region)
-	{
-		name = region->getName();
-	}
-	
-	if(!name.empty())
-		result = true;
-	
-	return result;
-}
-
-void LLVivoxVoiceClient::leaveChannel(void)
-{
-	if(getState() == stateRunning)
-	{
-		LL_DEBUGS("Voice") << "leaving channel for teleport/logout" << LL_ENDL;
-		mChannelName.clear();
-		sessionTerminate();
-	}
-}
-
-void LLVivoxVoiceClient::setMuteMic(bool muted)
-{
-	mMuteMic = muted;
-}
-
-void LLVivoxVoiceClient::setUserPTTState(bool ptt)
-{
-	mUserPTTState = ptt;
-}
-
-bool LLVivoxVoiceClient::getUserPTTState()
-{
-	return mUserPTTState;
-}
-
-void LLVivoxVoiceClient::inputUserControlState(bool down)
-{
-	if(mPTTIsToggle)
-	{
-		if(down) // toggle open-mic state on 'down'                                                        
-		{
-			toggleUserPTTState();
-		}
-	}
-	else // set open-mic state as an absolute                                                                  
-	{
-		setUserPTTState(down);
-	}
-}
-
-
-void LLVivoxVoiceClient::toggleUserPTTState(void)
-{
-	mUserPTTState = !mUserPTTState;
-}
-
-void LLVivoxVoiceClient::setVoiceEnabled(bool enabled)
-{
-	if (enabled != mVoiceEnabled)
-	{
-		// TODO: Refactor this so we don't call into LLVoiceChannel, but simply
-		// use the status observer
-		mVoiceEnabled = enabled;
-		LLVoiceClientStatusObserver::EStatusType status;
-		
-		
-		if (enabled)
-		{
-			LLVoiceChannel::getCurrentVoiceChannel()->activate();
-			status = LLVoiceClientStatusObserver::STATUS_VOICE_ENABLED;
-		}
-		else
-		{
-			// Turning voice off looses your current channel -- this makes sure the UI isn't out of sync when you re-enable it.
-			LLVoiceChannel::getCurrentVoiceChannel()->deactivate();
-			status = LLVoiceClientStatusObserver::STATUS_VOICE_DISABLED;
-		}
-	}
-}
-
-bool LLVivoxVoiceClient::voiceEnabled()
-{
-	return gSavedSettings.getBOOL("EnableVoiceChat") && !gSavedSettings.getBOOL("CmdLineDisableVoice");
-}
-
-void LLVivoxVoiceClient::setLipSyncEnabled(BOOL enabled)
-{
-	mLipSyncEnabled = enabled;
-}
-
-BOOL LLVivoxVoiceClient::lipSyncEnabled()
-{
-	   
-	if ( mVoiceEnabled && stateDisabled != getState() )
-	{
-		return mLipSyncEnabled;
-	}
-	else
-	{
-		return FALSE;
-	}
-}
-
-void LLVivoxVoiceClient::setUsePTT(bool usePTT)
-{
-	if(usePTT && !mUsePTT)
-	{
-		// When the user turns on PTT, reset the current state.
-		mUserPTTState = false;
-	}
-	mUsePTT = usePTT;
-}
-
-void LLVivoxVoiceClient::setPTTIsToggle(bool PTTIsToggle)
-{
-	if(!PTTIsToggle && mPTTIsToggle)
-	{
-		// When the user turns off toggle, reset the current state.
-		mUserPTTState = false;
-	}
-	
-	mPTTIsToggle = PTTIsToggle;
-}
-
-bool LLVivoxVoiceClient::getPTTIsToggle()
-{
-	return mPTTIsToggle;
-}
-
-void LLVivoxVoiceClient::setPTTKey(std::string &key)
-{
-	if(key == "MiddleMouse")
-	{
-		mPTTIsMiddleMouse = true;
-	}
-	else
-	{
-		mPTTIsMiddleMouse = false;
-		if(!LLKeyboard::keyFromString(key, &mPTTKey))
-		{
-			// If the call failed, don't match any key.
-			key = KEY_NONE;
-		}
-	}
-}
-
-void LLVivoxVoiceClient::setEarLocation(S32 loc)
-{
-	if(mEarLocation != loc)
-	{
-		LL_DEBUGS("Voice") << "Setting mEarLocation to " << loc << LL_ENDL;
-		
-		mEarLocation = loc;
-		mSpatialCoordsDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::setVoiceVolume(F32 volume)
-{
-	int scaled_volume = scale_speaker_volume(volume);	
-
-	if(scaled_volume != mSpeakerVolume)
-	{
-	  int min_volume = scale_speaker_volume(0);
-		if((scaled_volume == min_volume) || (mSpeakerVolume == min_volume))
-		{
-			mSpeakerMuteDirty = true;
-		}
-
-		mSpeakerVolume = scaled_volume;
-		mSpeakerVolumeDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::setMicGain(F32 volume)
-{
-	int scaled_volume = scale_mic_volume(volume);
-	
-	if(scaled_volume != mMicVolume)
-	{
-		mMicVolume = scaled_volume;
-		mMicVolumeDirty = true;
-	}
-}
-
-void LLVivoxVoiceClient::keyDown(KEY key, MASK mask)
-{	
-	if (gKeyboard->getKeyRepeated(key))
-	{
-		// ignore auto-repeat keys                                                                         
-		return;
-	}
-	
-	if(!mPTTIsMiddleMouse)
-	{
-		bool down = (mPTTKey != KEY_NONE)
-		&& gKeyboard->getKeyDown(mPTTKey);
-		inputUserControlState(down);
-	}
-	
-	
-}
-void LLVivoxVoiceClient::keyUp(KEY key, MASK mask)
-{
-	if(!mPTTIsMiddleMouse)
-	{
-		bool down = (mPTTKey != KEY_NONE)
-		&& gKeyboard->getKeyDown(mPTTKey);
-		inputUserControlState(down);
-	}
-	
-}
-void LLVivoxVoiceClient::middleMouseState(bool down)
-{
-	if(mPTTIsMiddleMouse)
-	{
-        if(mPTTIsMiddleMouse)
-        {
-			inputUserControlState(down);
-        }		
-	}
-}
-
-/////////////////////////////
-// Accessors for data related to nearby speakers
-BOOL LLVivoxVoiceClient::getVoiceEnabled(const LLUUID& id)
-{
-	BOOL result = FALSE;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		// I'm not sure what the semantics of this should be.
-		// For now, if we have any data about the user that came through the chat channel, assume they're voice-enabled.
-		result = TRUE;
-	}
-	
-	return result;
-}
-
-std::string LLVivoxVoiceClient::getDisplayName(const LLUUID& id)
-{
-	std::string result;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mDisplayName;
-	}
-	
-	return result;
-}
-
-
-
-BOOL LLVivoxVoiceClient::getIsSpeaking(const LLUUID& id)
-{
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		if (participant->mSpeakingTimeout.getElapsedTimeF32() > SPEAKING_TIMEOUT)
-		{
-			participant->mIsSpeaking = FALSE;
-		}
-		result = participant->mIsSpeaking;
-	}
-	
-	return result;
-}
-
-BOOL LLVivoxVoiceClient::getIsModeratorMuted(const LLUUID& id)
-{
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mIsModeratorMuted;
-	}
-	
-	return result;
-}
-
-F32 LLVivoxVoiceClient::getCurrentPower(const LLUUID& id)
-{		
-	F32 result = 0;
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mPower;
-	}
-	
-	return result;
-}
-
-
-
-BOOL LLVivoxVoiceClient::getUsingPTT(const LLUUID& id)
-{
-	BOOL result = FALSE;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		// I'm not sure what the semantics of this should be.
-		// Does "using PTT" mean they're configured with a push-to-talk button?
-		// For now, we know there's no PTT mechanism in place, so nobody is using it.
-	}
-	
-	return result;
-}
-
-BOOL LLVivoxVoiceClient::getOnMuteList(const LLUUID& id)
-{
-	BOOL result = FALSE;
-	
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mOnMuteList;
-	}
-
-	return result;
-}
-
-// External accessiors. Maps 0.0 to 1.0 to internal values 0-400 with .5 == 100
-// internal = 400 * external^2
-F32 LLVivoxVoiceClient::getUserVolume(const LLUUID& id)
-{
-	F32 result = 0.0f;
-	
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		S32 ires = 100; // nominal default volume
-		
-		if(participant->mIsSelf)
-		{
-			// Always make it look like the user's own volume is set at the default.
-		}
-		else if(participant->mUserVolume != -1)
-		{
-			// Use the internal volume
-			ires = participant->mUserVolume;
-			
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mUserVolume " << ires << LL_ENDL;
-		}
-		else if(participant->mVolume != -1)
-		{
-			// Map backwards from vivox volume 
-
-			// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//			LL_DEBUGS("Voice") << "mapping from mVolume " << participant->mVolume << LL_ENDL;
-
-			if(participant->mVolume < 56)
-			{
-				ires = (participant->mVolume * 100) / 56;
-			}
-			else
-			{
-				ires = (((participant->mVolume - 56) * 300) / (100 - 56)) + 100;
-			}
-		}
-		result = sqrtf(((F32)ires) / 400.f);
-	}
-
-	// Enable this when debugging voice slider issues.  It's way to spammy even for debug-level logging.
-//	LL_DEBUGS("Voice") << "returning " << result << LL_ENDL;
-
-	return result;
-}
-
-void LLVivoxVoiceClient::setUserVolume(const LLUUID& id, F32 volume)
-{
-	if(mAudioSession)
-	{
-		participantState *participant = findParticipantByID(id);
-		if (participant)
-		{
-			// store this volume setting for future sessions
-			LLSpeakerVolumeStorage::getInstance()->storeSpeakerVolume(id, volume);
-			// volume can amplify by as much as 4x!
-			S32 ivol = (S32)(400.f * volume * volume);
-			participant->mUserVolume = llclamp(ivol, 0, 400);
-			participant->mVolumeDirty = TRUE;
-			mAudioSession->mVolumeDirty = TRUE;
-
-		}
-	}
-}
-
-std::string LLVivoxVoiceClient::getGroupID(const LLUUID& id)
-{
-	std::string result;
-
-	participantState *participant = findParticipantByID(id);
-	if(participant)
-	{
-		result = participant->mGroupID;
-	}
-	
-	return result;
-}
-
-BOOL LLVivoxVoiceClient::getAreaVoiceDisabled()
-{
-	return mAreaVoiceDisabled;
-}
-
-void LLVivoxVoiceClient::recordingLoopStart(int seconds, int deltaFramesPerControlFrame)
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Start)" << LL_ENDL;
-	
-	if(!mMainSessionGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Start</RecordingControlType>" 
-		<< "<DeltaFramesPerControlFrame>" << deltaFramesPerControlFrame << "</DeltaFramesPerControlFrame>"
-		<< "<Filename>" << "" << "</Filename>"
-		<< "<EnableAudioRecordingEvents>false</EnableAudioRecordingEvents>"
-		<< "<LoopModeDurationSeconds>" << seconds << "</LoopModeDurationSeconds>"
-		<< "</Request>\n\n\n";
-
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::recordingLoopSave(const std::string& filename)
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Flush)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Flush</RecordingControlType>" 
-		<< "<Filename>" << filename << "</Filename>"
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::recordingStop()
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlRecording (Stop)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlRecording.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Stop</RecordingControlType>" 
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::filePlaybackStart(const std::string& filename)
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Start)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Start</RecordingControlType>" 
-		<< "<Filename>" << filename << "</Filename>"
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::filePlaybackStop()
-{
-//	LL_DEBUGS("Voice") << "sending SessionGroup.ControlPlayback (Stop)" << LL_ENDL;
-
-	if(mAudioSession != NULL && !mAudioSession->mGroupHandle.empty())
-	{
-		std::ostringstream stream;
-		stream
-		<< "<Request requestId=\"" << mCommandCookie++ << "\" action=\"SessionGroup.ControlPlayback.1\">"
-		<< "<SessionGroupHandle>" << mMainSessionGroupHandle << "</SessionGroupHandle>"
-		<< "<RecordingControlType>Stop</RecordingControlType>" 
-		<< "</Request>\n\n\n";
-
-		writeString(stream.str());
-	}
-}
-
-void LLVivoxVoiceClient::filePlaybackSetPaused(bool paused)
-{
-	// TODO: Implement once Vivox gives me a sample
-}
-
-void LLVivoxVoiceClient::filePlaybackSetMode(bool vox, float speed)
-{
-	// TODO: Implement once Vivox gives me a sample
-}
-
-LLVivoxVoiceClient::sessionState::sessionState() :
-        mErrorStatusCode(0),
-	mMediaStreamState(streamStateUnknown),
-	mTextStreamState(streamStateUnknown),
-	mCreateInProgress(false),
-	mMediaConnectInProgress(false),
-	mVoiceInvitePending(false),
-	mTextInvitePending(false),
-	mSynthesizedCallerID(false),
-	mIsChannel(false),
-	mIsSpatial(false),
-	mIsP2P(false),
-	mIncoming(false),
-	mVoiceEnabled(false),
-	mReconnect(false),
-	mVolumeDirty(false),
-	mParticipantsChanged(false)
-{
-}
-
-LLVivoxVoiceClient::sessionState::~sessionState()
-{
-	removeAllParticipants();
-}
-
-bool LLVivoxVoiceClient::sessionState::isCallBackPossible()
-{
-	// This may change to be explicitly specified by vivox in the future...
-	// Currently, only PSTN P2P calls cannot be returned.
-	// Conveniently, this is also the only case where we synthesize a caller UUID.
-	return !mSynthesizedCallerID;
-}
-
-bool LLVivoxVoiceClient::sessionState::isTextIMPossible()
-{
-	// This may change to be explicitly specified by vivox in the future...
-	return !mSynthesizedCallerID;
-}
-
-
-LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsBegin(void)
-{
-	return mSessions.begin();
-}
-
-LLVivoxVoiceClient::sessionIterator LLVivoxVoiceClient::sessionsEnd(void)
-{
-	return mSessions.end();
-}
-
-
-LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const std::string &handle)
-{
-	sessionState *result = NULL;
-	sessionMap::iterator iter = mSessionsByHandle.find(handle);
-	if(iter != mSessionsByHandle.end())
-	{
-		result = iter->second;
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSessionBeingCreatedByURI(const std::string &uri)
-{	
-	sessionState *result = NULL;
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
-		if(session->mCreateInProgress && (session->mSIPURI == uri))
-		{
-			result = session;
-			break;
-		}
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::findSession(const LLUUID &participant_id)
-{
-	sessionState *result = NULL;
-	
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
-		if((session->mCallerID == participant_id) || (session->mIMSessionID == participant_id))
-		{
-			result = session;
-			break;
-		}
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::sessionState *LLVivoxVoiceClient::addSession(const std::string &uri, const std::string &handle)
-{
-	sessionState *result = NULL;
-	
-	if(handle.empty())
-	{
-		// No handle supplied.
-		// Check whether there's already a session with this URI
-		for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-		{
-			sessionState *s = *iter;
-			if((s->mSIPURI == uri) || (s->mAlternateSIPURI == uri))
-			{
-				// TODO: I need to think about this logic... it's possible that this case should raise an internal error.
-				result = s;
-				break;
-			}
-		}
-	}
-	else // (!handle.empty())
-	{
-		// Check for an existing session with this handle
-		sessionMap::iterator iter = mSessionsByHandle.find(handle);
-		
-		if(iter != mSessionsByHandle.end())
-		{
-			result = iter->second;
-		}
-	}
-
-	if(!result)
-	{
-		// No existing session found.
-		
-		LL_DEBUGS("Voice") << "adding new session: handle " << handle << " URI " << uri << LL_ENDL;
-		result = new sessionState();
-		result->mSIPURI = uri;
-		result->mHandle = handle;
-		
-		mSessions.insert(result);
-
-		if(!result->mHandle.empty())
-		{
-			mSessionsByHandle.insert(sessionMap::value_type(result->mHandle, result));
-		}
-	}
-	else
-	{
-		// Found an existing session
-		
-		if(uri != result->mSIPURI)
-		{
-			// TODO: Should this be an internal error?
-			LL_DEBUGS("Voice") << "changing uri from " << result->mSIPURI << " to " << uri << LL_ENDL;
-			setSessionURI(result, uri);
-		}
-
-		if(handle != result->mHandle)
-		{
-			if(handle.empty())
-			{
-				// There's at least one race condition where where addSession was clearing an existing session handle, which caused things to break.
-				LL_DEBUGS("Voice") << "NOT clearing handle " << result->mHandle << LL_ENDL;
-			}
-			else
-			{
-				// TODO: Should this be an internal error?
-				LL_DEBUGS("Voice") << "changing handle from " << result->mHandle << " to " << handle << LL_ENDL;
-				setSessionHandle(result, handle);
-			}
-		}
-		
-		LL_DEBUGS("Voice") << "returning existing session: handle " << handle << " URI " << uri << LL_ENDL;
-	}
-
-	verifySessionState();
-		
-	return result;
-}
-
-void LLVivoxVoiceClient::setSessionHandle(sessionState *session, const std::string &handle)
-{
-	// Have to remove the session from the handle-indexed map before changing the handle, or things will break badly.
-	
-	if(!session->mHandle.empty())
-	{
-		// Remove session from the map if it should have been there.
-		sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
-		if(iter != mSessionsByHandle.end())
-		{
-			if(iter->second != session)
-			{
-				LL_ERRS("Voice") << "Internal error: session mismatch!" << LL_ENDL;
-			}
-
-			mSessionsByHandle.erase(iter);
-		}
-		else
-		{
-			LL_ERRS("Voice") << "Internal error: session handle not found in map!" << LL_ENDL;
-		}
-	}
-			
-	session->mHandle = handle;
-
-	if(!handle.empty())
-	{
-		mSessionsByHandle.insert(sessionMap::value_type(session->mHandle, session));
-	}
-
-	verifySessionState();
-}
-
-void LLVivoxVoiceClient::setSessionURI(sessionState *session, const std::string &uri)
-{
-	// There used to be a map of session URIs to sessions, which made this complex....
-	session->mSIPURI = uri;
-
-	verifySessionState();
-}
-
-void LLVivoxVoiceClient::deleteSession(sessionState *session)
-{
-	// Remove the session from the handle map
-	if(!session->mHandle.empty())
-	{
-		sessionMap::iterator iter = mSessionsByHandle.find(session->mHandle);
-		if(iter != mSessionsByHandle.end())
-		{
-			if(iter->second != session)
-			{
-				LL_ERRS("Voice") << "Internal error: session mismatch" << LL_ENDL;
-			}
-			mSessionsByHandle.erase(iter);
-		}
-	}
-
-	// Remove the session from the URI map
-	mSessions.erase(session);
-	
-	// At this point, the session should be unhooked from all lists and all state should be consistent.
-	verifySessionState();
-
-	// If this is the current audio session, clean up the pointer which will soon be dangling.
-	if(mAudioSession == session)
-	{
-		mAudioSession = NULL;
-		mAudioSessionChanged = true;
-	}
-
-	// ditto for the next audio session
-	if(mNextAudioSession == session)
-	{
-		mNextAudioSession = NULL;
-	}
-
-	// delete the session
-	delete session;
-}
-
-void LLVivoxVoiceClient::deleteAllSessions()
-{
-	LL_DEBUGS("Voice") << "called" << LL_ENDL;
-
-	while(!mSessions.empty())
-	{
-		deleteSession(*(sessionsBegin()));
-	}
-	
-	if(!mSessionsByHandle.empty())
-	{
-		LL_ERRS("Voice") << "Internal error: empty session map, non-empty handle map" << LL_ENDL;
-	}
-}
-
-void LLVivoxVoiceClient::verifySessionState(void)
-{
-	// This is mostly intended for debugging problems with session state management.
-	LL_DEBUGS("Voice") << "Total session count: " << mSessions.size() << " , session handle map size: " << mSessionsByHandle.size() << LL_ENDL;
-
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
-
-		LL_DEBUGS("Voice") << "session " << session << ": handle " << session->mHandle << ", URI " << session->mSIPURI << LL_ENDL;
-		
-		if(!session->mHandle.empty())
-		{
-			// every session with a non-empty handle needs to be in the handle map
-			sessionMap::iterator i2 = mSessionsByHandle.find(session->mHandle);
-			if(i2 == mSessionsByHandle.end())
-			{
-				LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " not found in session map)" << LL_ENDL;
-			}
-			else
-			{
-				if(i2->second != session)
-				{
-					LL_ERRS("Voice") << "internal error (handle " << session->mHandle << " in session map points to another session)" << LL_ENDL;
-				}
-			}
-		}
-	}
-		
-	// check that every entry in the handle map points to a valid session in the session set
-	for(sessionMap::iterator iter = mSessionsByHandle.begin(); iter != mSessionsByHandle.end(); iter++)
-	{
-		sessionState *session = iter->second;
-		sessionIterator i2 = mSessions.find(session);
-		if(i2 == mSessions.end())
-		{
-			LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " not found in session map)" << LL_ENDL;
-		}
-		else
-		{
-			if(session->mHandle != (*i2)->mHandle)
-			{
-				LL_ERRS("Voice") << "internal error (session for handle " << session->mHandle << " points to session with different handle " << (*i2)->mHandle << ")" << LL_ENDL;
-			}
-		}
-	}
-}
-
-LLVivoxVoiceClient::buddyListEntry::buddyListEntry(const std::string &uri) :
-	mURI(uri)
-{
-	mOnlineSL = false;
-	mOnlineSLim = false;
-	mCanSeeMeOnline = true;
-	mHasBlockListEntry = false;
-	mHasAutoAcceptListEntry = false;
-	mNameResolved = false;
-	mInVivoxBuddies = false;
-	mInSLFriends = false;
-	mNeedsNameUpdate = false;
-}
-
-void LLVivoxVoiceClient::processBuddyListEntry(const std::string &uri, const std::string &displayName)
-{
-	buddyListEntry *buddy = addBuddy(uri, displayName);
-	buddy->mInVivoxBuddies = true;	
-}
-
-LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri)
-{
-	std::string empty;
-	buddyListEntry *buddy = addBuddy(uri, empty);
-	if(buddy->mDisplayName.empty())
-	{
-		buddy->mNameResolved = false;
-	}
-	return buddy;
-}
-
-LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::addBuddy(const std::string &uri, const std::string &displayName)
-{
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter = mBuddyListMap.find(uri);
-	
-	if(iter != mBuddyListMap.end())
-	{
-		// Found a matching buddy already in the map.
-		LL_DEBUGS("Voice") << "adding existing buddy " << uri << LL_ENDL;
-		result = iter->second;
-	}
-
-	if(!result)
-	{
-		// participant isn't already in one list or the other.
-		LL_DEBUGS("Voice") << "adding new buddy " << uri << LL_ENDL;
-		result = new buddyListEntry(uri);
-		result->mDisplayName = displayName;
-
-		if(IDFromName(uri, result->mUUID)) 
-		{
-			// Extracted UUID from name successfully.
-		}
-		else
-		{
-			LL_DEBUGS("Voice") << "Couldn't find ID for buddy " << uri << " (\"" << displayName << "\")" << LL_ENDL;
-		}
-
-		mBuddyListMap.insert(buddyListMap::value_type(result->mURI, result));
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const std::string &uri)
-{
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter = mBuddyListMap.find(uri);
-	if(iter != mBuddyListMap.end())
-	{
-		result = iter->second;
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddy(const LLUUID &id)
-{
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter;
-
-	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
-	{
-		if(iter->second->mUUID == id)
-		{
-			result = iter->second;
-			break;
-		}
-	}
-	
-	return result;
-}
-
-LLVivoxVoiceClient::buddyListEntry *LLVivoxVoiceClient::findBuddyByDisplayName(const std::string &name)
-{
-	buddyListEntry *result = NULL;
-	buddyListMap::iterator iter;
-
-	for(iter = mBuddyListMap.begin(); iter != mBuddyListMap.end(); iter++)
-	{
-		if(iter->second->mDisplayName == name)
-		{
-			result = iter->second;
-			break;
-		}
-	}
-	
-	return result;
-}
-
-void LLVivoxVoiceClient::deleteBuddy(const std::string &uri)
-{
-	buddyListMap::iterator iter = mBuddyListMap.find(uri);
-	if(iter != mBuddyListMap.end())
-	{
-		LL_DEBUGS("Voice") << "deleting buddy " << uri << LL_ENDL;
-		buddyListEntry *buddy = iter->second;
-		mBuddyListMap.erase(iter);
-		delete buddy;
-	}
-	else
-	{
-		LL_DEBUGS("Voice") << "attempt to delete nonexistent buddy " << uri << LL_ENDL;
-	}
-	
-}
-
-void LLVivoxVoiceClient::deleteAllBuddies(void)
-{
-	while(!mBuddyListMap.empty())
-	{
-		deleteBuddy(mBuddyListMap.begin()->first);
-	}
-	
-	// Don't want to correlate with friends list when we've emptied the buddy list.
-	mBuddyListMapPopulated = false;
-	
-	// Don't want to correlate with friends list when we've reset the block rules.
-	mBlockRulesListReceived = false;
-	mAutoAcceptRulesListReceived = false;
-}
-
-void LLVivoxVoiceClient::deleteAllBlockRules(void)
-{
-	// Clear the block list entry flags from all local buddy list entries
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
-	{
-		buddy_it->second->mHasBlockListEntry = false;
-	}
-}
-
-void LLVivoxVoiceClient::deleteAllAutoAcceptRules(void)
-{
-	// Clear the auto-accept list entry flags from all local buddy list entries
-	buddyListMap::iterator buddy_it;
-	for(buddy_it = mBuddyListMap.begin(); buddy_it != mBuddyListMap.end(); buddy_it++)
-	{
-		buddy_it->second->mHasAutoAcceptListEntry = false;
-	}
-}
-
-void LLVivoxVoiceClient::addBlockRule(const std::string &blockMask, const std::string &presenceOnly)
-{
-	buddyListEntry *buddy = NULL;
-
-	// blockMask is the SIP URI of a friends list entry
-	buddyListMap::iterator iter = mBuddyListMap.find(blockMask);
-	if(iter != mBuddyListMap.end())
-	{
-		LL_DEBUGS("Voice") << "block list entry for " << blockMask << LL_ENDL;
-		buddy = iter->second;
-	}
-
-	if(buddy == NULL)
-	{
-		LL_DEBUGS("Voice") << "block list entry for unknown buddy " << blockMask << LL_ENDL;
-		buddy = addBuddy(blockMask);
-	}
-	
-	if(buddy != NULL)
-	{
-		buddy->mHasBlockListEntry = true;
-	}
-}
-
-void LLVivoxVoiceClient::addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy)
-{
-	buddyListEntry *buddy = NULL;
-
-	// blockMask is the SIP URI of a friends list entry
-	buddyListMap::iterator iter = mBuddyListMap.find(autoAcceptMask);
-	if(iter != mBuddyListMap.end())
-	{
-		LL_DEBUGS("Voice") << "auto-accept list entry for " << autoAcceptMask << LL_ENDL;
-		buddy = iter->second;
-	}
-
-	if(buddy == NULL)
-	{
-		LL_DEBUGS("Voice") << "auto-accept list entry for unknown buddy " << autoAcceptMask << LL_ENDL;
-		buddy = addBuddy(autoAcceptMask);
-	}
-
-	if(buddy != NULL)
-	{
-		buddy->mHasAutoAcceptListEntry = true;
-	}
-}
-
-void LLVivoxVoiceClient::accountListBlockRulesResponse(int statusCode, const std::string &statusString)
-{
-	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
-	mBlockRulesListReceived = true;
-}
-
-void LLVivoxVoiceClient::accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString)
-{
-	// Block list entries were updated via addBlockRule() during parsing.  Just flag that we're done.
-	mAutoAcceptRulesListReceived = true;
-}
-
-void LLVivoxVoiceClient::addObserver(LLVoiceClientParticipantObserver* observer)
-{
-	mParticipantObservers.insert(observer);
-}
-
-void LLVivoxVoiceClient::removeObserver(LLVoiceClientParticipantObserver* observer)
-{
-	mParticipantObservers.erase(observer);
-}
-
-void LLVivoxVoiceClient::notifyParticipantObservers()
-{
-	for (observer_set_t::iterator it = mParticipantObservers.begin();
-		it != mParticipantObservers.end();
-		)
-	{
-		LLVoiceClientParticipantObserver* observer = *it;
-		observer->onChange();
-		// In case onChange() deleted an entry.
-		it = mParticipantObservers.upper_bound(observer);
-	}
-}
-
-void LLVivoxVoiceClient::addObserver(LLVoiceClientStatusObserver* observer)
-{
-	mStatusObservers.insert(observer);
-}
-
-void LLVivoxVoiceClient::removeObserver(LLVoiceClientStatusObserver* observer)
-{
-	mStatusObservers.erase(observer);
-}
-
-void LLVivoxVoiceClient::notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status)
-{
-	if(mAudioSession)
-	{
-		if(status == LLVoiceClientStatusObserver::ERROR_UNKNOWN)
-		{
-			switch(mAudioSession->mErrorStatusCode)
-			{
-				case 20713:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_FULL; 		break;
-				case 20714:		status = LLVoiceClientStatusObserver::ERROR_CHANNEL_LOCKED; 	break;
-				case 20715:
-					//invalid channel, we may be using a set of poorly cached
-					//info
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-					break;
-				case 1009:
-					//invalid username and password
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-					break;
-			}
-
-			// Reset the error code to make sure it won't be reused later by accident.
-			mAudioSession->mErrorStatusCode = 0;
-		}
-		else if(status == LLVoiceClientStatusObserver::STATUS_LEFT_CHANNEL)
-		{
-			switch(mAudioSession->mErrorStatusCode)
-			{
-				case 404:	// NOT_FOUND
-				case 480:	// TEMPORARILY_UNAVAILABLE
-				case 408:	// REQUEST_TIMEOUT
-					// call failed because other user was not available
-					// treat this as an error case
-					status = LLVoiceClientStatusObserver::ERROR_NOT_AVAILABLE;
-
-					// Reset the error code to make sure it won't be reused later by accident.
-					mAudioSession->mErrorStatusCode = 0;
-				break;
-			}
-		}
-	}
-		
-	LL_DEBUGS("Voice") 
-		<< " " << LLVoiceClientStatusObserver::status2string(status)  
-		<< ", session URI " << getAudioSessionURI() 
-		<< (inSpatialChannel()?", proximal is true":", proximal is false")
-	<< LL_ENDL;
-
-	for (status_observer_set_t::iterator it = mStatusObservers.begin();
-		it != mStatusObservers.end();
-		)
-	{
-		LLVoiceClientStatusObserver* observer = *it;
-		observer->onChange(status, getAudioSessionURI(), inSpatialChannel());
-		// In case onError() deleted an entry.
-		it = mStatusObservers.upper_bound(observer);
-	}
-
-}
-
-void LLVivoxVoiceClient::addObserver(LLFriendObserver* observer)
-{
-	mFriendObservers.insert(observer);
-}
-
-void LLVivoxVoiceClient::removeObserver(LLFriendObserver* observer)
-{
-	mFriendObservers.erase(observer);
-}
-
-void LLVivoxVoiceClient::notifyFriendObservers()
-{
-	for (friend_observer_set_t::iterator it = mFriendObservers.begin();
-		it != mFriendObservers.end();
-		)
-	{
-		LLFriendObserver* observer = *it;
-		it++;
-		// The only friend-related thing we notify on is online/offline transitions.
-		observer->changed(LLFriendObserver::ONLINE);
-	}
-}
-
-void LLVivoxVoiceClient::lookupName(const LLUUID &id)
-{
-	BOOL is_group = FALSE;
-	gCacheName->get(id, is_group, &LLVivoxVoiceClient::onAvatarNameLookup);
-}
-
-//static
-void LLVivoxVoiceClient::onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group)
-{
-		std::string name = llformat("%s %s", first.c_str(), last.c_str());
-		LLVivoxVoiceClient::getInstance()->avatarNameResolved(id, name);
-	
-}
-
-void LLVivoxVoiceClient::avatarNameResolved(const LLUUID &id, const std::string &name)
-{
-	// If the avatar whose name just resolved is on our friends list, resync the friends list.
-	if(LLAvatarTracker::instance().getBuddyInfo(id) != NULL)
-	{
-		mFriendsListDirty = true;
-	}
-	
-	// Iterate over all sessions.
-	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++)
-	{
-		sessionState *session = *iter;
-
-		// Check for this user as a participant in this session
-		participantState *participant = session->findParticipantByID(id);
-		if(participant)
-		{
-			// Found -- fill in the name
-			participant->mAccountName = name;
-			// and post a "participants updated" message to listeners later.
-			session->mParticipantsChanged = true;
-		}
-		
-		// Check whether this is a p2p session whose caller name just resolved
-		if(session->mCallerID == id)
-		{
-			// this session's "caller ID" just resolved.  Fill in the name.
-			session->mName = name;
-			if(session->mTextInvitePending)
-			{
-				session->mTextInvitePending = false;
-
-				// We don't need to call gIMMgr->addP2PSession() here.  The first incoming message will create the panel.				
-			}
-			if(session->mVoiceInvitePending)
-			{
-				session->mVoiceInvitePending = false;
-
-				gIMMgr->inviteToSession(
-										LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID),
-										session->mName,
-										session->mCallerID, 
-										session->mName, 
-										IM_SESSION_P2P_INVITE, 
-										LLIMMgr::INVITATION_TYPE_VOICE,
-										session->mHandle);
-			}
-			
-		}
-	}
-}
-
-
-LLVivoxProtocolParser::LLVivoxProtocolParser()
-{
-	parser = NULL;
-	parser = XML_ParserCreate(NULL);
-	
-	reset();
-}
-
-void LLVivoxProtocolParser::reset()
-{
-	responseDepth = 0;
-	ignoringTags = false;
-	accumulateText = false;
-	energy = 0.f;
-	hasText = false;
-	hasAudio = false;
-	hasVideo = false;
-	terminated = false;
-	ignoreDepth = 0;
-	isChannel = false;
-	incoming = false;
-	enabled = false;
-	isEvent = false;
-	isLocallyMuted = false;
-	isModeratorMuted = false;
-	isSpeaking = false;
-	participantType = 0;
-	squelchDebugOutput = false;
-	returnCode = -1;
-	state = 0;
-	statusCode = 0;
-	volume = 0;
-	textBuffer.clear();
-	alias.clear();
-	numberOfAliases = 0;
-	applicationString.clear();
-}
-
-//virtual 
-LLVivoxProtocolParser::~LLVivoxProtocolParser()
-{
-	if (parser)
-		XML_ParserFree(parser);
-}
-
-// virtual
-LLIOPipe::EStatus LLVivoxProtocolParser::process_impl(
-													  const LLChannelDescriptors& channels,
-													  buffer_ptr_t& buffer,
-													  bool& eos,
-													  LLSD& context,
-													  LLPumpIO* pump)
-{
-	LLBufferStream istr(channels, buffer.get());
-	std::ostringstream ostr;
-	while (istr.good())
-	{
-		char buf[1024];
-		istr.read(buf, sizeof(buf));
-		mInput.append(buf, istr.gcount());
-	}
-	
-	// Look for input delimiter(s) in the input buffer.  If one is found, send the message to the xml parser.
-	int start = 0;
-	int delim;
-	while((delim = mInput.find("\n\n\n", start)) != std::string::npos)
-	{	
-		
-		// Reset internal state of the LLVivoxProtocolParser (no effect on the expat parser)
-		reset();
-		
-		XML_ParserReset(parser, NULL);
-		XML_SetElementHandler(parser, ExpatStartTag, ExpatEndTag);
-		XML_SetCharacterDataHandler(parser, ExpatCharHandler);
-		XML_SetUserData(parser, this);	
-		XML_Parse(parser, mInput.data() + start, delim - start, false);
-		
-		// If this message isn't set to be squelched, output the raw XML received.
-		if(!squelchDebugOutput)
-		{
-			LL_DEBUGS("Voice") << "parsing: " << mInput.substr(start, delim - start) << LL_ENDL;
-		}
-		
-		start = delim + 3;
-	}
-	
-	if(start != 0)
-		mInput = mInput.substr(start);
-	
-	LL_DEBUGS("VivoxProtocolParser") << "at end, mInput is: " << mInput << LL_ENDL;
-	
-	if(!LLVivoxVoiceClient::getInstance()->mConnected)
-	{
-		// If voice has been disabled, we just want to close the socket.  This does so.
-		LL_INFOS("Voice") << "returning STATUS_STOP" << LL_ENDL;
-		return STATUS_STOP;
-	}
-	
-	return STATUS_OK;
-}
-
-void XMLCALL LLVivoxProtocolParser::ExpatStartTag(void *data, const char *el, const char **attr)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->StartTag(el, attr);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatEndTag(void *data, const char *el)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->EndTag(el);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void XMLCALL LLVivoxProtocolParser::ExpatCharHandler(void *data, const XML_Char *s, int len)
-{
-	if (data)
-	{
-		LLVivoxProtocolParser	*object = (LLVivoxProtocolParser*)data;
-		object->CharData(s, len);
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-
-void LLVivoxProtocolParser::StartTag(const char *tag, const char **attr)
-{
-	// Reset the text accumulator. We shouldn't have strings that are inturrupted by new tags
-	textBuffer.clear();
-	// only accumulate text if we're not ignoring tags.
-	accumulateText = !ignoringTags;
-	
-	if (responseDepth == 0)
-	{	
-		isEvent = !stricmp("Event", tag);
-		
-		if (!stricmp("Response", tag) || isEvent)
-		{
-			// Grab the attributes
-			while (*attr)
-			{
-				const char	*key = *attr++;
-				const char	*value = *attr++;
-				
-				if (!stricmp("requestId", key))
-				{
-					requestId = value;
-				}
-				else if (!stricmp("action", key))
-				{
-					actionString = value;
-				}
-				else if (!stricmp("type", key))
-				{
-					eventTypeString = value;
-				}
-			}
-		}
-		LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
-	}
-	else
-	{
-		if (ignoringTags)
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-		}
-		else
-		{
-			LL_DEBUGS("VivoxProtocolParser") << tag << " (" << responseDepth << ")"  << LL_ENDL;
-			
-			// Ignore the InputXml stuff so we don't get confused
-			if (!stricmp("InputXml", tag))
-			{
-				ignoringTags = true;
-				ignoreDepth = responseDepth;
-				accumulateText = false;
-				
-				LL_DEBUGS("VivoxProtocolParser") << "starting ignore, ignoreDepth is " << ignoreDepth << LL_ENDL;
-			}
-			else if (!stricmp("CaptureDevices", tag))
-			{
-				LLVivoxVoiceClient::getInstance()->clearCaptureDevices();
-			}			
-			else if (!stricmp("RenderDevices", tag))
-			{
-				LLVivoxVoiceClient::getInstance()->clearRenderDevices();
-			}
-			else if (!stricmp("CaptureDevice", tag))
-			{
-				deviceString.clear();
-			}
-			else if (!stricmp("RenderDevice", tag))
-			{
-				deviceString.clear();
-			}			
-			else if (!stricmp("Buddies", tag))
-			{
-				LLVivoxVoiceClient::getInstance()->deleteAllBuddies();
-			}
-			else if (!stricmp("BlockRules", tag))
-			{
-				LLVivoxVoiceClient::getInstance()->deleteAllBlockRules();
-			}
-			else if (!stricmp("AutoAcceptRules", tag))
-			{
-				LLVivoxVoiceClient::getInstance()->deleteAllAutoAcceptRules();
-			}
-			
-		}
-	}
-	responseDepth++;
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::EndTag(const char *tag)
-{
-	const std::string& string = textBuffer;
-	
-	responseDepth--;
-	
-	if (ignoringTags)
-	{
-		if (ignoreDepth == responseDepth)
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "end of ignore" << LL_ENDL;
-			ignoringTags = false;
-		}
-		else
-		{
-			LL_DEBUGS("VivoxProtocolParser") << "ignoring tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-		}
-	}
-	
-	if (!ignoringTags)
-	{
-		LL_DEBUGS("VivoxProtocolParser") << "processing tag " << tag << " (depth = " << responseDepth << ")" << LL_ENDL;
-		
-		// Closing a tag. Finalize the text we've accumulated and reset
-		if (!stricmp("ReturnCode", tag))
-			returnCode = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("SessionHandle", tag))
-			sessionHandle = string;
-		else if (!stricmp("SessionGroupHandle", tag))
-			sessionGroupHandle = string;
-		else if (!stricmp("StatusCode", tag))
-			statusCode = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("StatusString", tag))
-			statusString = string;
-		else if (!stricmp("ParticipantURI", tag))
-			uriString = string;
-		else if (!stricmp("Volume", tag))
-			volume = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("Energy", tag))
-			energy = (F32)strtod(string.c_str(), NULL);
-		else if (!stricmp("IsModeratorMuted", tag))
-			isModeratorMuted = !stricmp(string.c_str(), "true");
-		else if (!stricmp("IsSpeaking", tag))
-			isSpeaking = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Alias", tag))
-			alias = string;
-		else if (!stricmp("NumberOfAliases", tag))
-			numberOfAliases = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("Application", tag))
-			applicationString = string;
-		else if (!stricmp("ConnectorHandle", tag))
-			connectorHandle = string;
-		else if (!stricmp("VersionID", tag))
-			versionID = string;
-		else if (!stricmp("AccountHandle", tag))
-			accountHandle = string;
-		else if (!stricmp("State", tag))
-			state = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("URI", tag))
-			uriString = string;
-		else if (!stricmp("IsChannel", tag))
-			isChannel = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Incoming", tag))
-			incoming = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Enabled", tag))
-			enabled = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Name", tag))
-			nameString = string;
-		else if (!stricmp("AudioMedia", tag))
-			audioMediaString = string;
-		else if (!stricmp("ChannelName", tag))
-			nameString = string;
-		else if (!stricmp("DisplayName", tag))
-			displayNameString = string;
-		else if (!stricmp("Device", tag))
-			deviceString = string;		
-		else if (!stricmp("AccountName", tag))
-			nameString = string;
-		else if (!stricmp("ParticipantType", tag))
-			participantType = strtol(string.c_str(), NULL, 10);
-		else if (!stricmp("IsLocallyMuted", tag))
-			isLocallyMuted = !stricmp(string.c_str(), "true");
-		else if (!stricmp("MicEnergy", tag))
-			energy = (F32)strtod(string.c_str(), NULL);
-		else if (!stricmp("ChannelName", tag))
-			nameString = string;
-		else if (!stricmp("ChannelURI", tag))
-			uriString = string;
-		else if (!stricmp("BuddyURI", tag))
-			uriString = string;
-		else if (!stricmp("Presence", tag))
-			statusString = string;
-		else if (!stricmp("CaptureDevice", tag))
-		{
-			LLVivoxVoiceClient::getInstance()->addCaptureDevice(deviceString);
-		}
-		else if (!stricmp("RenderDevice", tag))
-		{
-			LLVivoxVoiceClient::getInstance()->addRenderDevice(deviceString);
-		}
-		else if (!stricmp("Buddy", tag))
-		{
-			LLVivoxVoiceClient::getInstance()->processBuddyListEntry(uriString, displayNameString);
-		}
-		else if (!stricmp("BlockRule", tag))
-		{
-			LLVivoxVoiceClient::getInstance()->addBlockRule(blockMask, presenceOnly);
-		}
-		else if (!stricmp("BlockMask", tag))
-			blockMask = string;
-		else if (!stricmp("PresenceOnly", tag))
-			presenceOnly = string;
-		else if (!stricmp("AutoAcceptRule", tag))
-		{
-			LLVivoxVoiceClient::getInstance()->addAutoAcceptRule(autoAcceptMask, autoAddAsBuddy);
-		}
-		else if (!stricmp("AutoAcceptMask", tag))
-			autoAcceptMask = string;
-		else if (!stricmp("AutoAddAsBuddy", tag))
-			autoAddAsBuddy = string;
-		else if (!stricmp("MessageHeader", tag))
-			messageHeader = string;
-		else if (!stricmp("MessageBody", tag))
-			messageBody = string;
-		else if (!stricmp("NotificationType", tag))
-			notificationType = string;
-		else if (!stricmp("HasText", tag))
-			hasText = !stricmp(string.c_str(), "true");
-		else if (!stricmp("HasAudio", tag))
-			hasAudio = !stricmp(string.c_str(), "true");
-		else if (!stricmp("HasVideo", tag))
-			hasVideo = !stricmp(string.c_str(), "true");
-		else if (!stricmp("Terminated", tag))
-			terminated = !stricmp(string.c_str(), "true");
-		else if (!stricmp("SubscriptionHandle", tag))
-			subscriptionHandle = string;
-		else if (!stricmp("SubscriptionType", tag))
-			subscriptionType = string;
-		
-	
-		textBuffer.clear();
-		accumulateText= false;
-		
-		if (responseDepth == 0)
-		{
-			// We finished all of the XML, process the data
-			processResponse(tag);
-		}
-	}
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::CharData(const char *buffer, int length)
-{
-	/*
-	 This method is called for anything that isn't a tag, which can be text you
-	 want that lies between tags, and a lot of stuff you don't want like file formatting
-	 (tabs, spaces, CR/LF, etc).
-	 
-	 Only copy text if we are in accumulate mode...
-	 */
-	if (accumulateText)
-		textBuffer.append(buffer, length);
-}
-
-// --------------------------------------------------------------------------------
-
-void LLVivoxProtocolParser::processResponse(std::string tag)
-{
-	LL_DEBUGS("VivoxProtocolParser") << tag << LL_ENDL;
-	
-	// SLIM SDK: the SDK now returns a statusCode of "200" (OK) for success.  This is a change vs. previous SDKs.
-	// According to Mike S., "The actual API convention is that responses with return codes of 0 are successful, regardless of the status code returned",
-	// so I believe this will give correct behavior.
-	
-	if(returnCode == 0)
-		statusCode = 0;
-	
-	if (isEvent)
-	{
-		const char *eventTypeCstr = eventTypeString.c_str();
-		if (!stricmp(eventTypeCstr, "AccountLoginStateChangeEvent"))
-		{
-			LLVivoxVoiceClient::getInstance()->accountLoginStateChangeEvent(accountHandle, statusCode, statusString, state);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionAddedEvent"))
-		{
-			/*
-			 <Event type="SessionAddedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-			 <Uri>sip:confctl-1408789@bhr.vivox.com</Uri>
-			 <IsChannel>true</IsChannel>
-			 <Incoming>false</Incoming>
-			 <ChannelName />
-			 </Event>
-			 */
-			LLVivoxVoiceClient::getInstance()->sessionAddedEvent(uriString, alias, sessionHandle, sessionGroupHandle, isChannel, incoming, nameString, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionRemovedEvent"))
-		{
-			LLVivoxVoiceClient::getInstance()->sessionRemovedEvent(sessionHandle, sessionGroupHandle);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionGroupAddedEvent"))
-		{
-			LLVivoxVoiceClient::getInstance()->sessionGroupAddedEvent(sessionGroupHandle);
-		}
-		else if (!stricmp(eventTypeCstr, "MediaStreamUpdatedEvent"))
-		{
-			/*
-			 <Event type="MediaStreamUpdatedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-			 <StatusCode>200</StatusCode>
-			 <StatusString>OK</StatusString>
-			 <State>2</State>
-			 <Incoming>false</Incoming>
-			 </Event>
-			 */
-			LLVivoxVoiceClient::getInstance()->mediaStreamUpdatedEvent(sessionHandle, sessionGroupHandle, statusCode, statusString, state, incoming);
-		}		
-		else if (!stricmp(eventTypeCstr, "TextStreamUpdatedEvent"))
-		{
-			/*
-			 <Event type="TextStreamUpdatedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg1</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==1</SessionHandle>
-			 <Enabled>true</Enabled>
-			 <State>1</State>
-			 <Incoming>true</Incoming>
-			 </Event>
-			 */
-			LLVivoxVoiceClient::getInstance()->textStreamUpdatedEvent(sessionHandle, sessionGroupHandle, enabled, state, incoming);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantAddedEvent"))
-		{
-			/* 
-			 <Event type="ParticipantAddedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
-			 <ParticipantUri>sip:xI5auBZ60SJWIk606-1JGRQ==@bhr.vivox.com</ParticipantUri>
-			 <AccountName>xI5auBZ60SJWIk606-1JGRQ==</AccountName>
-			 <DisplayName />
-			 <ParticipantType>0</ParticipantType>
-			 </Event>
-			 */
-			LLVivoxVoiceClient::getInstance()->participantAddedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString, displayNameString, participantType);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantRemovedEvent"))
-		{
-			/*
-			 <Event type="ParticipantRemovedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg4</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==4</SessionHandle>
-			 <ParticipantUri>sip:xtx7YNV-3SGiG7rA1fo5Ndw==@bhr.vivox.com</ParticipantUri>
-			 <AccountName>xtx7YNV-3SGiG7rA1fo5Ndw==</AccountName>
-			 </Event>
-			 */
-			LLVivoxVoiceClient::getInstance()->participantRemovedEvent(sessionHandle, sessionGroupHandle, uriString, alias, nameString);
-		}
-		else if (!stricmp(eventTypeCstr, "ParticipantUpdatedEvent"))
-		{
-			/*
-			 <Event type="ParticipantUpdatedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-			 <ParticipantUri>sip:xFnPP04IpREWNkuw1cOXlhw==@bhr.vivox.com</ParticipantUri>
-			 <IsModeratorMuted>false</IsModeratorMuted>
-			 <IsSpeaking>true</IsSpeaking>
-			 <Volume>44</Volume>
-			 <Energy>0.0879437</Energy>
-			 </Event>
-			 */
-			
-			// These happen so often that logging them is pretty useless.
-			squelchDebugOutput = true;
-			
-			LLVivoxVoiceClient::getInstance()->participantUpdatedEvent(sessionHandle, sessionGroupHandle, uriString, alias, isModeratorMuted, isSpeaking, volume, energy);
-		}
-		else if (!stricmp(eventTypeCstr, "AuxAudioPropertiesEvent"))
-		{
-			LLVivoxVoiceClient::getInstance()->auxAudioPropertiesEvent(energy);
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyPresenceEvent"))
-		{
-			LLVivoxVoiceClient::getInstance()->buddyPresenceEvent(uriString, alias, statusString, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyAndGroupListChangedEvent"))
-		{
-			// The buddy list was updated during parsing.
-			// Need to recheck against the friends list.
-			LLVivoxVoiceClient::getInstance()->buddyListChanged();
-		}
-		else if (!stricmp(eventTypeCstr, "BuddyChangedEvent"))
-		{
-			/*
-			 <Event type="BuddyChangedEvent">
-			 <AccountHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==</AccountHandle>
-			 <BuddyURI>sip:x9fFHFZjOTN6OESF1DUPrZQ==@bhr.vivox.com</BuddyURI>
-			 <DisplayName>Monroe Tester</DisplayName>
-			 <BuddyData />
-			 <GroupID>0</GroupID>
-			 <ChangeType>Set</ChangeType>
-			 </Event>
-			 */		
-			// TODO: Question: Do we need to process this at all?
-		}
-		else if (!stricmp(eventTypeCstr, "MessageEvent"))  
-		{
-			LLVivoxVoiceClient::getInstance()->messageEvent(sessionHandle, uriString, alias, messageHeader, messageBody, applicationString);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionNotificationEvent"))  
-		{
-			LLVivoxVoiceClient::getInstance()->sessionNotificationEvent(sessionHandle, uriString, notificationType);
-		}
-		else if (!stricmp(eventTypeCstr, "SubscriptionEvent"))  
-		{
-			LLVivoxVoiceClient::getInstance()->subscriptionEvent(uriString, subscriptionHandle, alias, displayNameString, applicationString, subscriptionType);
-		}
-		else if (!stricmp(eventTypeCstr, "SessionUpdatedEvent"))  
-		{
-			/*
-			 <Event type="SessionUpdatedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			 <SessionHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==0</SessionHandle>
-			 <Uri>sip:confctl-9@bhd.vivox.com</Uri>
-			 <IsMuted>0</IsMuted>
-			 <Volume>50</Volume>
-			 <TransmitEnabled>1</TransmitEnabled>
-			 <IsFocused>0</IsFocused>
-			 <SpeakerPosition><Position><X>0</X><Y>0</Y><Z>0</Z></Position></SpeakerPosition>
-			 <SessionFontID>0</SessionFontID>
-			 </Event>
-			 */
-			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
-		}
-		
-		else if (!stricmp(eventTypeCstr, "SessionGroupRemovedEvent"))  
-		{
-			/*
-			 <Event type="SessionGroupRemovedEvent">
-			 <SessionGroupHandle>c1_m1000xFnPP04IpREWNkuw1cOXlhw==_sg0</SessionGroupHandle>
-			 </Event>
-			 */
-			// We don't need to process this, but we also shouldn't warn on it, since that confuses people.
-		}
-		else
-		{
-			LL_WARNS("VivoxProtocolParser") << "Unknown event type " << eventTypeString << LL_ENDL;
-		}
-	}
-	else
-	{
-		const char *actionCstr = actionString.c_str();
-		if (!stricmp(actionCstr, "Connector.Create.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->connectorCreateResponse(statusCode, statusString, connectorHandle, versionID);
-		}
-		else if (!stricmp(actionCstr, "Account.Login.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->loginResponse(statusCode, statusString, accountHandle, numberOfAliases);
-		}
-		else if (!stricmp(actionCstr, "Session.Create.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->sessionCreateResponse(requestId, statusCode, statusString, sessionHandle);			
-		}
-		else if (!stricmp(actionCstr, "SessionGroup.AddSession.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->sessionGroupAddSessionResponse(requestId, statusCode, statusString, sessionHandle);			
-		}
-		else if (!stricmp(actionCstr, "Session.Connect.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->sessionConnectResponse(requestId, statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Account.Logout.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->logoutResponse(statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Connector.InitiateShutdown.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->connectorShutdownResponse(statusCode, statusString);			
-		}
-		else if (!stricmp(actionCstr, "Account.ListBlockRules.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->accountListBlockRulesResponse(statusCode, statusString);						
-		}
-		else if (!stricmp(actionCstr, "Account.ListAutoAcceptRules.1"))
-		{
-			LLVivoxVoiceClient::getInstance()->accountListAutoAcceptRulesResponse(statusCode, statusString);						
-		}
-		else if (!stricmp(actionCstr, "Session.Set3DPosition.1"))
-		{
-			// We don't need to process these, but they're so spammy we don't want to log them.
-			squelchDebugOutput = true;
-		}
-		/*
-		 else if (!stricmp(actionCstr, "Account.ChannelGetList.1"))
-		 {
-		 LLVoiceClient::getInstance()->channelGetListResponse(statusCode, statusString);
-		 }
-		 else if (!stricmp(actionCstr, "Connector.AccountCreate.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Connector.MuteLocalMic.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Connector.MuteLocalSpeaker.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Connector.SetLocalMicVolume.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Connector.SetLocalSpeakerVolume.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Session.ListenerSetPosition.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Session.SpeakerSetPosition.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Session.AudioSourceSetPosition.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Session.GetChannelParticipants.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelCreate.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelUpdate.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelDelete.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelCreateAndInvite.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelFolderCreate.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelFolderUpdate.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelFolderDelete.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelAddModerator.1"))
-		 {
-		 
-		 }
-		 else if (!stricmp(actionCstr, "Account.ChannelDeleteModerator.1"))
-		 {
-		 
-		 }
-		 */
-	}
-}
-
diff --git a/indra/newview/llvoicevivox.h b/indra/newview/llvoicevivox.h
deleted file mode 100644
index 10577254e8..0000000000
--- a/indra/newview/llvoicevivox.h
+++ /dev/null
@@ -1,914 +0,0 @@
-/** 
- * @file llvoicevivox.h
- * @brief Declaration of LLDiamondwareVoiceClient class which is the interface to the voice client process.
- *
- * $LicenseInfo:firstyear=2001&license=viewergpl$
- * 
- * Copyright (c) 2001-2010, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-#ifndef LL_VOICE_VIVOX_H
-#define LL_VOICE_VIVOX_H
-
-class LLVOAvatar;
-class LLVivoxProtocolParser;
-
-#include "lliopipe.h"
-#include "llpumpio.h"
-#include "llchainio.h"
-#include "lliosocket.h"
-#include "v3math.h"
-#include "llframetimer.h"
-#include "llviewerregion.h"
-#include "llcallingcard.h"   // for LLFriendObserver
-
-#ifdef LL_STANDALONE
-# include "expat.h"
-#else
-# include "expat/expat.h"
-#endif
-#include "llvoiceclient.h"
-
-
-class LLVivoxVoiceAccountProvisionResponder;
-class LLVivoxVoiceClientMuteListObserver;
-class LLVivoxVoiceClientFriendsObserver;	
-
-
-class LLVivoxVoiceClientParticipantObserver
-{
-public:
-	virtual ~LLVivoxVoiceClientParticipantObserver() { }
-	virtual void onChange() = 0;
-};
-
-
-class LLVivoxVoiceClient: public LLSingleton<LLVivoxVoiceClient>, virtual public LLVoiceModuleInterface
-{
-	LOG_CLASS(LLVivoxVoiceClient);
-public:
-	LLVivoxVoiceClient();	
-	virtual ~LLVivoxVoiceClient();
-	
-	
-	/// @name LLVoiceModuleInterface virtual implementations
-	///  @see LLVoiceModuleInterface
-	//@{
-	virtual void init(LLPumpIO *pump);	// Call this once at application startup (creates connector)
-	virtual void terminate();	// Call this to clean up during shutdown
-	
-	virtual const LLVoiceVersionInfo& getVersion();
-	
-	virtual void updateSettings(); // call after loading settings and whenever they change
-
-	// Returns true if vivox has successfully logged in and is not in error state	
-	virtual bool isVoiceWorking();
-
-	/////////////////////
-	/// @name Tuning
-	//@{
-	virtual void tuningStart();
-	virtual void tuningStop();
-	virtual bool inTuningMode();
-	
-	virtual void tuningSetMicVolume(float volume);
-	virtual void tuningSetSpeakerVolume(float volume);
-	virtual float tuningGetEnergy(void);
-	//@}
-	
-	/////////////////////
-	/// @name Devices
-	//@{
-	// This returns true when it's safe to bring up the "device settings" dialog in the prefs.
-	// i.e. when the daemon is running and connected, and the device lists are populated.
-	virtual bool deviceSettingsAvailable();
-	
-	// Requery the vivox daemon for the current list of input/output devices.
-	// If you pass true for clearCurrentList, deviceSettingsAvailable() will be false until the query has completed
-	// (use this if you want to know when it's done).
-	// If you pass false, you'll have no way to know when the query finishes, but the device lists will not appear empty in the interim.
-	virtual void refreshDeviceLists(bool clearCurrentList = true);
-	
-	virtual void setCaptureDevice(const std::string& name);
-	virtual void setRenderDevice(const std::string& name);
-	
-	virtual LLVoiceDeviceList& getCaptureDevices();
-	virtual LLVoiceDeviceList& getRenderDevices();
-	//@}	
-	
-	virtual void getParticipantList(std::set<LLUUID> &participants);
-	virtual bool isParticipant(const LLUUID& speaker_id);
-
-	// Send a text message to the specified user, initiating the session if necessary.
-	virtual BOOL sendTextMessage(const LLUUID& participant_id, const std::string& message);
-	
-	// close any existing text IM session with the specified user
-	virtual void endUserIMSession(const LLUUID &uuid);
-	
-	// Returns true if calling back the session URI after the session has closed is possible.
-	// Currently this will be false only for PSTN P2P calls.		
-	// NOTE: this will return true if the session can't be found. 
-	virtual BOOL isSessionCallBackPossible(const LLUUID &session_id);
-	
-	// Returns true if the session can accepte text IM's.
-	// Currently this will be false only for PSTN P2P calls.
-	// NOTE: this will return true if the session can't be found. 
-	virtual BOOL isSessionTextIMPossible(const LLUUID &session_id);
-	
-	
-	////////////////////////////
-	/// @name Channel stuff
-	//@{
-	// returns true iff the user is currently in a proximal (local spatial) channel.
-	// Note that gestures should only fire if this returns true.
-	virtual bool inProximalChannel();
-	
-	virtual void setNonSpatialChannel(const std::string &uri,
-									  const std::string &credentials);
-	
-	virtual void setSpatialChannel(const std::string &uri,
-								   const std::string &credentials);
-	
-	virtual void leaveNonSpatialChannel();
-	
-	virtual void leaveChannel(void);	
-	
-	// Returns the URI of the current channel, or an empty string if not currently in a channel.
-	// NOTE that it will return an empty string if it's in the process of joining a channel.
-	virtual std::string getCurrentChannel();
-	//@}
-	
-	
-	//////////////////////////
-	/// @name invitations
-	//@{
-	// start a voice channel with the specified user
-	virtual void callUser(const LLUUID &uuid);	
-	virtual bool answerInvite(std::string &channelHandle);
-	virtual void declineInvite(std::string &channelHandle);
-	//@}
-	
-	/////////////////////////
-	/// @name Volume/gain
-	//@{
-	virtual void setVoiceVolume(F32 volume);
-	virtual void setMicGain(F32 volume);
-	//@}
-	
-	/////////////////////////
-	/// @name enable disable voice and features
-	//@{
-	virtual bool voiceEnabled();
-	virtual void setVoiceEnabled(bool enabled);
-	virtual BOOL lipSyncEnabled();	
-	virtual void setLipSyncEnabled(BOOL enabled);
-	virtual void setMuteMic(bool muted);		// Use this to mute the local mic (for when the client is minimized, etc), ignoring user PTT state.
-	//@}
-	
-	////////////////////////
-	/// @name PTT
-	//@{
-	virtual void setUserPTTState(bool ptt);
-	virtual bool getUserPTTState();
-	virtual void setUsePTT(bool usePTT);
-	virtual void setPTTIsToggle(bool PTTIsToggle);
-	virtual bool getPTTIsToggle();
-	virtual void inputUserControlState(bool down);  // interpret any sort of up-down mic-open control input according to ptt-toggle prefs	
-	virtual void toggleUserPTTState(void);
-	
-	virtual void keyDown(KEY key, MASK mask);
-	virtual void keyUp(KEY key, MASK mask);
-	virtual void middleMouseState(bool down);
-	//@}
-	
-	//////////////////////////
-	/// @name nearby speaker accessors
-	//@{
-	virtual BOOL getVoiceEnabled(const LLUUID& id);		// true if we've received data for this avatar
-	virtual std::string getDisplayName(const LLUUID& id);
-	virtual BOOL isOnlineSIP(const LLUUID &id);
-	virtual BOOL isParticipantAvatar(const LLUUID &id);
-	virtual BOOL getIsSpeaking(const LLUUID& id);
-	virtual BOOL getIsModeratorMuted(const LLUUID& id);
-	virtual F32 getCurrentPower(const LLUUID& id);		// "power" is related to "amplitude" in a defined way.  I'm just not sure what the formula is...
-	virtual BOOL getOnMuteList(const LLUUID& id);
-	virtual F32 getUserVolume(const LLUUID& id);
-	virtual void setUserVolume(const LLUUID& id, F32 volume); // set's volume for specified agent, from 0-1 (where .5 is nominal)	
-	//@}
-	
-	// authorize the user
-	virtual void userAuthorized(const std::string& user_id,
-								const LLUUID &agentID);
-	
-	//////////////////////////////
-	/// @name Status notification
-	//@{
-	virtual void addObserver(LLVoiceClientStatusObserver* observer);
-	virtual void removeObserver(LLVoiceClientStatusObserver* observer);
-	virtual void addObserver(LLFriendObserver* observer);
-	virtual void removeObserver(LLFriendObserver* observer);		
-	virtual void addObserver(LLVoiceClientParticipantObserver* observer);
-	virtual void removeObserver(LLVoiceClientParticipantObserver* observer);
-	
-	
-	
-	//@}
-	
-	virtual std::string sipURIFromID(const LLUUID &id);
-	//@}
-
-				
-protected:
-	//////////////////////
-	// Vivox Specific definitions	
-	
-	friend class LLVivoxVoiceAccountProvisionResponder;
-	friend class LLVivoxVoiceClientMuteListObserver;
-	friend class LLVivoxVoiceClientFriendsObserver;	
-	
-	enum streamState
-	{
-		streamStateUnknown = 0,
-		streamStateIdle = 1,
-		streamStateConnected = 2,
-		streamStateRinging = 3,
-	};	
-	struct participantState
-	{
-	public:
-		participantState(const std::string &uri);
-		
-		bool updateMuteState();
-		bool isAvatar();
-		
-		std::string mURI;
-		LLUUID mAvatarID;
-		std::string mAccountName;
-		std::string mDisplayName;
-		LLFrameTimer mSpeakingTimeout;
-		F32	mLastSpokeTimestamp;
-		F32 mPower;
-		int mVolume;
-		std::string mGroupID;
-		int mUserVolume;
-		bool mPTT;
-		bool mIsSpeaking;
-		bool mIsModeratorMuted;
-		bool mOnMuteList;		// true if this avatar is on the user's mute list (and should be muted)
-		bool mVolumeDirty;		// true if this participant needs a volume command sent (either mOnMuteList or mUserVolume has changed)
-		bool mAvatarIDValid;
-		bool mIsSelf;
-	};
-	
-	typedef std::map<const std::string, participantState*> participantMap;
-	
-	typedef std::map<const LLUUID, participantState*> participantUUIDMap;
-	
-	struct sessionState
-	{
-	public:
-		sessionState();
-		~sessionState();
-		
-		participantState *addParticipant(const std::string &uri);
-		// Note: after removeParticipant returns, the participant* that was passed to it will have been deleted.
-		// Take care not to use the pointer again after that.
-		void removeParticipant(participantState *participant);
-		void removeAllParticipants();
-		
-		participantState *findParticipant(const std::string &uri);
-		participantState *findParticipantByID(const LLUUID& id);
-		
-		bool isCallBackPossible();
-		bool isTextIMPossible();
-		
-		std::string mHandle;
-		std::string mGroupHandle;
-		std::string mSIPURI;
-		std::string mAlias;
-		std::string mName;
-		std::string mAlternateSIPURI;
-		std::string mHash;			// Channel password
-		std::string mErrorStatusString;
-		std::queue<std::string> mTextMsgQueue;
-		
-		LLUUID		mIMSessionID;
-		LLUUID		mCallerID;
-		int			mErrorStatusCode;
-		int			mMediaStreamState;
-		int			mTextStreamState;
-		bool		mCreateInProgress;	// True if a Session.Create has been sent for this session and no response has been received yet.
-		bool		mMediaConnectInProgress;	// True if a Session.MediaConnect has been sent for this session and no response has been received yet.
-		bool		mVoiceInvitePending;	// True if a voice invite is pending for this session (usually waiting on a name lookup)
-		bool		mTextInvitePending;		// True if a text invite is pending for this session (usually waiting on a name lookup)
-		bool		mSynthesizedCallerID;	// True if the caller ID is a hash of the SIP URI -- this means we shouldn't do a name lookup.
-		bool		mIsChannel;	// True for both group and spatial channels (false for p2p, PSTN)
-		bool		mIsSpatial;	// True for spatial channels
-		bool		mIsP2P;
-		bool		mIncoming;
-		bool		mVoiceEnabled;
-		bool		mReconnect;	// Whether we should try to reconnect to this session if it's dropped
-		// Set to true when the mute state of someone in the participant list changes.
-		// The code will have to walk the list to find the changed participant(s).
-		bool		mVolumeDirty;
-		
-		bool		mParticipantsChanged;
-		participantMap mParticipantsByURI;
-		participantUUIDMap mParticipantsByUUID;
-	};
-
-	// internal state for a simple state machine.  This is used to deal with the asynchronous nature of some of the messages.
-	// Note: if you change this list, please make corresponding changes to LLVivoxVoiceClient::state2string().
-	enum state
-	{
-		stateDisableCleanup,
-		stateDisabled,				// Voice is turned off.
-		stateStart,					// Class is initialized, socket is created
-		stateDaemonLaunched,		// Daemon has been launched
-		stateConnecting,			// connect() call has been issued
-		stateConnected,				// connection to the daemon has been made, send some initial setup commands.
-		stateIdle,					// socket is connected, ready for messaging
-		stateMicTuningStart,
-		stateMicTuningRunning,		
-		stateMicTuningStop,
-		stateConnectorStart,		// connector needs to be started
-		stateConnectorStarting,		// waiting for connector handle
-		stateConnectorStarted,		// connector handle received
-		stateLoginRetry,			// need to retry login (failed due to changing password)
-		stateLoginRetryWait,		// waiting for retry timer
-		stateNeedsLogin,			// send login request
-		stateLoggingIn,				// waiting for account handle
-		stateLoggedIn,				// account handle received
-		stateCreatingSessionGroup,	// Creating the main session group
-		stateNoChannel,				// 
-		stateJoiningSession,		// waiting for session handle
-		stateSessionJoined,			// session handle received
-		stateRunning,				// in session, steady state
-		stateLeavingSession,		// waiting for terminate session response
-		stateSessionTerminated,		// waiting for terminate session response
-		
-		stateLoggingOut,			// waiting for logout response
-		stateLoggedOut,				// logout response received
-		stateConnectorStopping,		// waiting for connector stop
-		stateConnectorStopped,		// connector stop received
-		
-		// We go to this state if the login fails because the account needs to be provisioned.
-		
-		// error states.  No way to recover from these yet.
-		stateConnectorFailed,
-		stateConnectorFailedWaiting,
-		stateLoginFailed,
-		stateLoginFailedWaiting,
-		stateJoinSessionFailed,
-		stateJoinSessionFailedWaiting,
-		
-		stateJail					// Go here when all else has failed.  Nothing will be retried, we're done.
-	};
-	
-	typedef std::map<std::string, sessionState*> sessionMap;
-	
-	
-	
-	///////////////////////////////////////////////////////
-	// Private Member Functions
-	//////////////////////////////////////////////////////
-	
-	//////////////////////////////
-	/// @name TVC/Server management and communication
-	//@{
-	// Call this if the connection to the daemon terminates unexpectedly.  It will attempt to reset everything and relaunch.
-	void daemonDied();
-	
-	// Call this if we're just giving up on voice (can't provision an account, etc.).  It will clean up and go away.
-	void giveUp();	
-	
-	// write to the tvc
-	bool writeString(const std::string &str);
-	
-	void connectorCreate();
-	void connectorShutdown();	
-	void closeSocket(void);	
-	
-	void requestVoiceAccountProvision(S32 retries = 3);
-	void login(
-			   const std::string& account_name,
-			   const std::string& password,
-			   const std::string& voice_sip_uri_hostname,
-			   const std::string& voice_account_server_uri);
-	void loginSendMessage();
-	void logout();
-	void logoutSendMessage();	
-	
-	
-	//@}
-	
-	//------------------------------------
-	// tuning
-	
-	void tuningRenderStartSendMessage(const std::string& name, bool loop);
-	void tuningRenderStopSendMessage();
-
-	void tuningCaptureStartSendMessage(int duration);
-	void tuningCaptureStopSendMessage();
-
-	bool inTuningStates();
-
-	//----------------------------------
-	// devices
-	void clearCaptureDevices();
-	void addCaptureDevice(const std::string& name);
-	void clearRenderDevices();
-	void addRenderDevice(const std::string& name);	
-	void buildSetAudioDevices(std::ostringstream &stream);
-	
-	void getCaptureDevicesSendMessage();
-	void getRenderDevicesSendMessage();
-	
-	// local audio updates
-	void buildLocalAudioUpdates(std::ostringstream &stream);		
-
-
-	/////////////////////////////
-	// Response/Event handlers
-	void connectorCreateResponse(int statusCode, std::string &statusString, std::string &connectorHandle, std::string &versionID);
-	void loginResponse(int statusCode, std::string &statusString, std::string &accountHandle, int numberOfAliases);
-	void sessionCreateResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
-	void sessionGroupAddSessionResponse(std::string &requestId, int statusCode, std::string &statusString, std::string &sessionHandle);
-	void sessionConnectResponse(std::string &requestId, int statusCode, std::string &statusString);
-	void logoutResponse(int statusCode, std::string &statusString);
-	void connectorShutdownResponse(int statusCode, std::string &statusString);
-
-	void accountLoginStateChangeEvent(std::string &accountHandle, int statusCode, std::string &statusString, int state);
-	void mediaStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, int statusCode, std::string &statusString, int state, bool incoming);
-	void textStreamUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, bool enabled, int state, bool incoming);
-	void sessionAddedEvent(std::string &uriString, std::string &alias, std::string &sessionHandle, std::string &sessionGroupHandle, bool isChannel, bool incoming, std::string &nameString, std::string &applicationString);
-	void sessionGroupAddedEvent(std::string &sessionGroupHandle);
-	void sessionRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle);
-	void participantAddedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString, std::string &displayNameString, int participantType);
-	void participantRemovedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, std::string &nameString);
-	void participantUpdatedEvent(std::string &sessionHandle, std::string &sessionGroupHandle, std::string &uriString, std::string &alias, bool isModeratorMuted, bool isSpeaking, int volume, F32 energy);
-	void auxAudioPropertiesEvent(F32 energy);
-	void buddyPresenceEvent(std::string &uriString, std::string &alias, std::string &statusString, std::string &applicationString);
-	void messageEvent(std::string &sessionHandle, std::string &uriString, std::string &alias, std::string &messageHeader, std::string &messageBody, std::string &applicationString);
-	void sessionNotificationEvent(std::string &sessionHandle, std::string &uriString, std::string &notificationType);
-	void subscriptionEvent(std::string &buddyURI, std::string &subscriptionHandle, std::string &alias, std::string &displayName, std::string &applicationString, std::string &subscriptionType);
-	
-	void buddyListChanged();
-	void muteListChanged();
-	void updateFriends(U32 mask);
-		
-	/////////////////////////////
-	// Sending updates of current state
-	void updatePosition(void);
-	void setCameraPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
-	void setAvatarPosition(const LLVector3d &position, const LLVector3 &velocity, const LLMatrix3 &rot);
-	bool channelFromRegion(LLViewerRegion *region, std::string &name);
-
-	void setEarLocation(S32 loc);
-
-	
-	/////////////////////////////
-	// Accessors for data related to nearby speakers
-
-	// MBW -- XXX -- Not sure how to get this data out of the TVC
-	BOOL getUsingPTT(const LLUUID& id);
-	std::string getGroupID(const LLUUID& id);		// group ID if the user is in group chat (empty string if not applicable)
-
-	/////////////////////////////
-	BOOL getAreaVoiceDisabled();		// returns true if the area the avatar is in is speech-disabled.
-										// Use this to determine whether to show a "no speech" icon in the menu bar.
-		
-	
-	// PTT
-	void setPTTKey(std::string &key);
-	
-	/////////////////////////////
-	// Recording controls
-	void recordingLoopStart(int seconds = 3600, int deltaFramesPerControlFrame = 200);
-	void recordingLoopSave(const std::string& filename);
-	void recordingStop();
-	
-	// Playback controls
-	void filePlaybackStart(const std::string& filename);
-	void filePlaybackStop();
-	void filePlaybackSetPaused(bool paused);
-	void filePlaybackSetMode(bool vox = false, float speed = 1.0f);
-	
-	participantState *findParticipantByID(const LLUUID& id);
-	
-
-	////////////////////////////////////////
-	// voice sessions.
-	typedef std::set<sessionState*> sessionSet;
-			
-	typedef sessionSet::iterator sessionIterator;
-	sessionIterator sessionsBegin(void);
-	sessionIterator sessionsEnd(void);
-
-	sessionState *findSession(const std::string &handle);
-	sessionState *findSessionBeingCreatedByURI(const std::string &uri);
-	sessionState *findSession(const LLUUID &participant_id);
-	sessionState *findSessionByCreateID(const std::string &create_id);
-	
-	sessionState *addSession(const std::string &uri, const std::string &handle = LLStringUtil::null);
-	void setSessionHandle(sessionState *session, const std::string &handle = LLStringUtil::null);
-	void setSessionURI(sessionState *session, const std::string &uri);
-	void deleteSession(sessionState *session);
-	void deleteAllSessions(void);
-
-	void verifySessionState(void);
-
-	void joinedAudioSession(sessionState *session);
-	void leftAudioSession(sessionState *session);
-
-	// This is called in several places where the session _may_ need to be deleted.
-	// It contains logic for whether to delete the session or keep it around.
-	void reapSession(sessionState *session);
-	
-	// Returns true if the session seems to indicate we've moved to a region on a different voice server
-	bool sessionNeedsRelog(sessionState *session);
-	
-	
-	//////////////////////////////////////
-	// buddy list stuff, needed for SLIM later
-	struct buddyListEntry
-	{
-		buddyListEntry(const std::string &uri);
-		std::string mURI;
-		std::string mDisplayName;
-		LLUUID	mUUID;
-		bool mOnlineSL;
-		bool mOnlineSLim;
-		bool mCanSeeMeOnline;
-		bool mHasBlockListEntry;
-		bool mHasAutoAcceptListEntry;
-		bool mNameResolved;
-		bool mInSLFriends;
-		bool mInVivoxBuddies;
-		bool mNeedsNameUpdate;
-	};
-
-	typedef std::map<std::string, buddyListEntry*> buddyListMap;
-	
-	// This should be called when parsing a buddy list entry sent by SLVoice.		
-	void processBuddyListEntry(const std::string &uri, const std::string &displayName);
-
-	buddyListEntry *addBuddy(const std::string &uri);
-	buddyListEntry *addBuddy(const std::string &uri, const std::string &displayName);
-	buddyListEntry *findBuddy(const std::string &uri);
-	buddyListEntry *findBuddy(const LLUUID &id);
-	buddyListEntry *findBuddyByDisplayName(const std::string &name);
-	void deleteBuddy(const std::string &uri);
-	void deleteAllBuddies(void);
-
-	void deleteAllBlockRules(void);
-	void addBlockRule(const std::string &blockMask, const std::string &presenceOnly);
-	void deleteAllAutoAcceptRules(void);
-	void addAutoAcceptRule(const std::string &autoAcceptMask, const std::string &autoAddAsBuddy);
-	void accountListBlockRulesResponse(int statusCode, const std::string &statusString);						
-	void accountListAutoAcceptRulesResponse(int statusCode, const std::string &statusString);						
-	
-	/////////////////////////////
-	// session control messages
-
-	void accountListBlockRulesSendMessage();
-	void accountListAutoAcceptRulesSendMessage();
-	
-	void sessionGroupCreateSendMessage();
-	void sessionCreateSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
-	void sessionGroupAddSessionSendMessage(sessionState *session, bool startAudio = true, bool startText = false);
-	void sessionMediaConnectSendMessage(sessionState *session);		// just joins the audio session
-	void sessionTextConnectSendMessage(sessionState *session);		// just joins the text session
-	void sessionTerminateSendMessage(sessionState *session);
-	void sessionGroupTerminateSendMessage(sessionState *session);
-	void sessionMediaDisconnectSendMessage(sessionState *session);
-	void sessionTextDisconnectSendMessage(sessionState *session);
-
-	// Pokes the state machine to leave the audio session next time around.
-	void sessionTerminate();	
-	
-	// Pokes the state machine to shut down the connector and restart it.
-	void requestRelog();
-	
-	// Does the actual work to get out of the audio session
-	void leaveAudioSession();
-	
-	void lookupName(const LLUUID &id);
-	static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group);
-	void avatarNameResolved(const LLUUID &id, const std::string &name);
-		
-private:
-	LLVoiceVersionInfo mVoiceVersion;
-		
-	state mState;
-	bool mSessionTerminateRequested;
-	bool mRelogRequested;
-	// Number of times (in a row) "stateJoiningSession" case for spatial channel is reached in stateMachine().
-	// The larger it is the greater is possibility there is a problem with connection to voice server.
-	// Introduced while fixing EXT-4313.
-	int mSpatialJoiningNum;
-	
-	void setState(state inState);
-	state getState(void)  { return mState; };
-	std::string state2string(state inState);
-	
-	void stateMachine();
-	static void idle(void *user_data);
-	
-	LLHost mDaemonHost;
-	LLSocket::ptr_t mSocket;
-	bool mConnected;
-	
-	
-	LLPumpIO *mPump;
-	friend class LLVivoxProtocolParser;
-	
-	std::string mAccountName;
-	std::string mAccountPassword;
-	std::string mAccountDisplayName;
-			
-	bool mTuningMode;
-	float mTuningEnergy;
-	std::string mTuningAudioFile;
-	int mTuningMicVolume;
-	bool mTuningMicVolumeDirty;
-	int mTuningSpeakerVolume;
-	bool mTuningSpeakerVolumeDirty;
-	state mTuningExitState;					// state to return to when we leave tuning mode.
-	
-	std::string mSpatialSessionURI;
-	std::string mSpatialSessionCredentials;
-
-	std::string mMainSessionGroupHandle; // handle of the "main" session group.
-	
-	std::string mChannelName;			// Name of the channel to be looked up 
-	bool mAreaVoiceDisabled;
-	sessionState *mAudioSession;		// Session state for the current audio session
-	bool mAudioSessionChanged;			// set to true when the above pointer gets changed, so observers can be notified.
-
-	sessionState *mNextAudioSession;	// Session state for the audio session we're trying to join
-
-//		std::string mSessionURI;			// URI of the session we're in.
-//		std::string mSessionHandle;		// returned by ?
-	
-	S32 mCurrentParcelLocalID;			// Used to detect parcel boundary crossings
-	std::string mCurrentRegionName;		// Used to detect parcel boundary crossings
-	
-	std::string mConnectorHandle;	// returned by "Create Connector" message
-	std::string mAccountHandle;		// returned by login message		
-	int 		mNumberOfAliases;
-	U32 mCommandCookie;
-
-	std::string mVoiceAccountServerURI;
-	std::string mVoiceSIPURIHostName;
-	
-	int mLoginRetryCount;
-	
-	sessionMap mSessionsByHandle;				// Active sessions, indexed by session handle.  Sessions which are being initiated may not be in this map.
-	sessionSet mSessions;						// All sessions, not indexed.  This is the canonical session list.
-	
-	bool mBuddyListMapPopulated;
-	bool mBlockRulesListReceived;
-	bool mAutoAcceptRulesListReceived;
-	buddyListMap mBuddyListMap;
-	
-	LLVoiceDeviceList mCaptureDevices;
-	LLVoiceDeviceList mRenderDevices;
-
-	std::string mCaptureDevice;
-	std::string mRenderDevice;
-	bool mCaptureDeviceDirty;
-	bool mRenderDeviceDirty;
-	
-	// This should be called when the code detects we have changed parcels.
-	// It initiates the call to the server that gets the parcel channel.
-	void parcelChanged();
-	
-	void switchChannel(std::string uri = std::string(), bool spatial = true, bool no_reconnect = false, bool is_p2p = false, std::string hash = "");
-	void joinSession(sessionState *session);
-	
-	std::string nameFromAvatar(LLVOAvatar *avatar);
-	std::string nameFromID(const LLUUID &id);
-	bool IDFromName(const std::string name, LLUUID &uuid);
-	std::string displayNameFromAvatar(LLVOAvatar *avatar);
-	std::string sipURIFromAvatar(LLVOAvatar *avatar);
-	std::string sipURIFromName(std::string &name);
-	
-	// Returns the name portion of the SIP URI if the string looks vaguely like a SIP URI, or an empty string if not.
-	std::string nameFromsipURI(const std::string &uri);		
-
-	bool inSpatialChannel(void);
-	std::string getAudioSessionURI();
-	std::string getAudioSessionHandle();
-			
-	void sendPositionalUpdate(void);
-	
-	void buildSetCaptureDevice(std::ostringstream &stream);
-	void buildSetRenderDevice(std::ostringstream &stream);
-	
-	void clearAllLists();
-	void checkFriend(const LLUUID& id);
-	void sendFriendsListUpdates();
-
-	// start a text IM session with the specified user
-	// This will be asynchronous, the session may be established at a future time.
-	sessionState* startUserIMSession(const LLUUID& uuid);
-	void sendQueuedTextMessages(sessionState *session);
-	
-	void enforceTether(void);
-	
-	bool		mSpatialCoordsDirty;
-	
-	LLVector3d	mCameraPosition;
-	LLVector3d	mCameraRequestedPosition;
-	LLVector3	mCameraVelocity;
-	LLMatrix3	mCameraRot;
-
-	LLVector3d	mAvatarPosition;
-	LLVector3	mAvatarVelocity;
-	LLMatrix3	mAvatarRot;
-	
-	bool		mPTTDirty;
-	bool		mPTT;
-	
-	bool		mUsePTT;
-	bool		mPTTIsMiddleMouse;
-	KEY			mPTTKey;
-	bool		mPTTIsToggle;
-	bool		mUserPTTState;
-	bool		mMuteMic;
-			
-	// Set to true when the friends list is known to have changed.
-	bool		mFriendsListDirty;
-	
-	enum
-	{
-		earLocCamera = 0,		// ear at camera
-		earLocAvatar,			// ear at avatar
-		earLocMixed				// ear at avatar location/camera direction
-	};
-	
-	S32			mEarLocation;  
-	
-	bool		mSpeakerVolumeDirty;
-	bool		mSpeakerMuteDirty;
-	int			mSpeakerVolume;
-
-	int			mMicVolume;
-	bool		mMicVolumeDirty;
-	
-	bool		mVoiceEnabled;
-	bool		mWriteInProgress;
-	std::string mWriteString;
-	size_t		mWriteOffset;
-	
-	LLTimer		mUpdateTimer;
-	
-	BOOL		mLipSyncEnabled;
-
-	typedef std::set<LLVoiceClientParticipantObserver*> observer_set_t;
-	observer_set_t mParticipantObservers;
-
-	void notifyParticipantObservers();
-
-	typedef std::set<LLVoiceClientStatusObserver*> status_observer_set_t;
-	status_observer_set_t mStatusObservers;
-	
-	void notifyStatusObservers(LLVoiceClientStatusObserver::EStatusType status);
-
-	typedef std::set<LLFriendObserver*> friend_observer_set_t;
-	friend_observer_set_t mFriendObservers;
-	void notifyFriendObservers();
-};
-
-/** 
- * @class LLVivoxProtocolParser
- * @brief This class helps construct new LLIOPipe specializations
- * @see LLIOPipe
- *
- * THOROUGH_DESCRIPTION
- */
-class LLVivoxProtocolParser : public LLIOPipe
-{
-	LOG_CLASS(LLVivoxProtocolParser);
-public:
-	LLVivoxProtocolParser();
-	virtual ~LLVivoxProtocolParser();
-	
-protected:
-	/* @name LLIOPipe virtual implementations
-	 */
-	//@{
-	/** 
-	 * @brief Process the data in buffer
-	 */
-	virtual EStatus process_impl(
-								 const LLChannelDescriptors& channels,
-								 buffer_ptr_t& buffer,
-								 bool& eos,
-								 LLSD& context,
-								 LLPumpIO* pump);
-	//@}
-	
-	std::string 	mInput;
-	
-	// Expat control members
-	XML_Parser		parser;
-	int				responseDepth;
-	bool			ignoringTags;
-	bool			isEvent;
-	int				ignoreDepth;
-	
-	// Members for processing responses. The values are transient and only valid within a call to processResponse().
-	bool			squelchDebugOutput;
-	int				returnCode;
-	int				statusCode;
-	std::string		statusString;
-	std::string		requestId;
-	std::string		actionString;
-	std::string		connectorHandle;
-	std::string		versionID;
-	std::string		accountHandle;
-	std::string		sessionHandle;
-	std::string		sessionGroupHandle;
-	std::string		alias;
-	std::string		applicationString;
-	
-	// Members for processing events. The values are transient and only valid within a call to processResponse().
-	std::string		eventTypeString;
-	int				state;
-	std::string		uriString;
-	bool			isChannel;
-	bool			incoming;
-	bool			enabled;
-	std::string		nameString;
-	std::string		audioMediaString;
-	std::string     deviceString;
-	std::string		displayNameString;
-	int				participantType;
-	bool			isLocallyMuted;
-	bool			isModeratorMuted;
-	bool			isSpeaking;
-	int				volume;
-	F32				energy;
-	std::string		messageHeader;
-	std::string		messageBody;
-	std::string		notificationType;
-	bool			hasText;
-	bool			hasAudio;
-	bool			hasVideo;
-	bool			terminated;
-	std::string		blockMask;
-	std::string		presenceOnly;
-	std::string		autoAcceptMask;
-	std::string		autoAddAsBuddy;
-	int				numberOfAliases;
-	std::string		subscriptionHandle;
-	std::string		subscriptionType;
-	
-	
-	// Members for processing text between tags
-	std::string		textBuffer;
-	bool			accumulateText;
-	
-	void			reset();
-	
-	void			processResponse(std::string tag);
-	
-	static void XMLCALL ExpatStartTag(void *data, const char *el, const char **attr);
-	static void XMLCALL ExpatEndTag(void *data, const char *el);
-	static void XMLCALL ExpatCharHandler(void *data, const XML_Char *s, int len);
-	
-	void			StartTag(const char *tag, const char **attr);
-	void			EndTag(const char *tag);
-	void			CharData(const char *buffer, int length);
-	
-};
-
-
-#endif //LL_VIVOX_VOICE_CLIENT_H
-
-
-
diff --git a/indra/newview/llweb.cpp b/indra/newview/llweb.cpp
index aa03b1afd1..1a64f9d881 100644
--- a/indra/newview/llweb.cpp
+++ b/indra/newview/llweb.cpp
@@ -155,7 +155,7 @@ std::string LLWeb::expandURLSubstitutions(const std::string &url,
 	substitution["VERSION_PATCH"] = LLVersionInfo::getPatch();
 	substitution["VERSION_BUILD"] = LLVersionInfo::getBuild();
 	substitution["CHANNEL"] = LLVersionInfo::getChannel();
-	substitution["GRID"] = LLGridManager::getInstance()->getGridLabel();
+	substitution["GRID"] = LLViewerLogin::getInstance()->getGridLabel();
 	substitution["OS"] = LLAppViewer::instance()->getOSInfo().getOSStringSimple();
 	substitution["SESSION_ID"] = gAgent.getSessionID();
 	substitution["FIRST_LOGIN"] = gAgent.isFirstLogin();
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 58b9f5ce18..0b63f5efbd 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -133,11 +133,10 @@ void LLWorld::destroyClass()
 LLViewerRegion* LLWorld::addRegion(const U64 &region_handle, const LLHost &host)
 {
 	LLMemType mt(LLMemType::MTYPE_REGIONS);
-	llinfos << "Add region with handle: " << region_handle << " on host " << host << llendl;
+	
 	LLViewerRegion *regionp = getRegionFromHandle(region_handle);
 	if (regionp)
 	{
-		llinfos << "Region exists, removing it " << llendl;
 		LLHost old_host = regionp->getHost();
 		// region already exists!
 		if (host == old_host && regionp->isAlive())
diff --git a/indra/newview/llxmlrpclistener.cpp b/indra/newview/llxmlrpclistener.cpp
index 8237132ac5..15417614af 100644
--- a/indra/newview/llxmlrpclistener.cpp
+++ b/indra/newview/llxmlrpclistener.cpp
@@ -28,7 +28,6 @@
 #include "llerror.h"
 #include "stringize.h"
 #include "llxmlrpctransaction.h"
-#include "llsecapi.h"
 
 #if LL_WINDOWS
 #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally
@@ -357,22 +356,7 @@ public:
                                      << data["errorcode"].asString()
                                      << " (" << data["error"].asString() << ")"
                                      << LL_ENDL;
-		
-		switch (curlcode)
-		{
-			case CURLE_SSL_PEER_CERTIFICATE:
-			case CURLE_SSL_CACERT:
-			{
-				LLPointer<LLCertificate> error_cert(mTransaction->getErrorCert());
-				if(error_cert)
-				{
-					data["certificate"] = error_cert->getPem();
-				}
-				break;
-			}
-			default:
-				break;
-		}
+        // In addition to CURLE_OK, LLUserAuth distinguishes different error
         // values of 'curlcode':
         // CURLE_COULDNT_RESOLVE_HOST,
         // CURLE_SSL_PEER_CERTIFICATE,
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index da61840761..c19be37e75 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -31,9 +31,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include <openssl/x509_vfy.h>
-#include <openssl/ssl.h>
-#include "llsecapi.h"
 
 #include "llxmlrpctransaction.h"
 #include "llxmlrpclistener.h"
@@ -179,8 +176,6 @@ public:
 
 	std::string			mResponseText;
 	XMLRPC_REQUEST		mResponse;
-	std::string         mCertStore;
-	LLPointer<LLCertificate> mErrorCert;
 	
 	Impl(const std::string& uri, XMLRPC_REQUEST request, bool useGzip);
 	Impl(const std::string& uri,
@@ -195,8 +190,7 @@ public:
 
 private:
 	void init(XMLRPC_REQUEST request, bool useGzip);
-	static int _sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param);
-	static CURLcode _sslCtxFunction(CURL * curl, void *sslctx, void *param);
+
 	static size_t curlDownloadCallback(
 		char* data, size_t size, size_t nmemb, void* user_data);
 };
@@ -234,74 +228,8 @@ LLXMLRPCTransaction::Impl::Impl(const std::string& uri,
     XMLRPC_RequestFree(request, 1);
 }
 
-// _sslCertVerifyCallback
-// callback called when a cert verification is requested.
-// calls SECAPI to validate the context
-int LLXMLRPCTransaction::Impl::_sslCertVerifyCallback(X509_STORE_CTX *ctx, void *param)
-{
-	LLXMLRPCTransaction::Impl *transaction = (LLXMLRPCTransaction::Impl *)param;
-	LLPointer<LLCertificateStore> store = gSecAPIHandler->getCertificateStore(transaction->mCertStore);
-	LLPointer<LLCertificateChain> chain = gSecAPIHandler->getCertificateChain(ctx);
-	LLSD validation_params = LLSD::emptyMap();
-	LLURI uri(transaction->mURI);
-	validation_params[CERT_HOSTNAME] = uri.hostName();
-	try
-	{
-		chain->validate(VALIDATION_POLICY_SSL, store, validation_params);
-	}
-	catch (LLCertValidationTrustException& cert_exception)
-	{
-		// this exception is is handled differently than the general cert
-		// exceptions, as we allow the user to actually add the certificate
-		// for trust.
-		// therefore we pass back a different error code
-		// NOTE: We're currently 'wired' to pass around CURL error codes.  This is
-		// somewhat clumsy, as we may run into errors that do not map directly to curl
-		// error codes.  Should be refactored with login refactoring, perhaps.
-		transaction->mCurlCode = CURLE_SSL_CACERT;
-		// set the status directly.  set curl status generates error messages and we want
-		// to use the fixed ones from the exceptions
-		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
-		// We should probably have a more generic way of passing information
-		// back to the error handlers.
-		transaction->mErrorCert = cert_exception.getCert();
-		return 0;		
-	}
-	catch (LLCertException& cert_exception)
-	{
-		transaction->mCurlCode = CURLE_SSL_PEER_CERTIFICATE;
-		// set the status directly.  set curl status generates error messages and we want
-		// to use the fixed ones from the exceptions
-		transaction->setStatus(StatusCURLError, cert_exception.getMessage(), std::string());
-		transaction->mErrorCert = cert_exception.getCert();
-		return 0;
-	}
-	catch (...)
-	{
-		// any other odd error, we just handle as a connect error.
-		transaction->mCurlCode = CURLE_SSL_CONNECT_ERROR;
-		transaction->setCurlStatus(CURLE_SSL_CONNECT_ERROR);
-		return 0;
-	}
-	return 1;
-}
 
-// _sslCtxFunction
-// Callback function called when an SSL Context is created via CURL
-// used to configure the context for custom cert validate(<, <#const & xs#>, <#T * #>, <#long #>)tion
-// based on SECAPI
 
-CURLcode LLXMLRPCTransaction::Impl::_sslCtxFunction(CURL * curl, void *sslctx, void *param)
-{
-	SSL_CTX * ctx = (SSL_CTX *) sslctx;
-	// disable any default verification for server certs
-	SSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, NULL);
-	// set the verification callback.
-	SSL_CTX_set_cert_verify_callback(ctx, _sslCertVerifyCallback, param);
-	// the calls are void
-	return CURLE_OK;
-	
-}
 
 void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 {
@@ -309,7 +237,6 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 	{
 		mCurlRequest = new LLCurlEasyRequest();
 	}
-	mErrorCert = NULL;
 	
 	if (gSavedSettings.getBOOL("BrowserProxyEnabled"))
 	{
@@ -325,13 +252,10 @@ void LLXMLRPCTransaction::Impl::init(XMLRPC_REQUEST request, bool useGzip)
 //	mCurlRequest->setopt(CURLOPT_VERBOSE, 1); // usefull for debugging
 	mCurlRequest->setopt(CURLOPT_NOSIGNAL, 1);
 	mCurlRequest->setWriteCallback(&curlDownloadCallback, (void*)this);
-	BOOL vefifySSLCert = !gSavedSettings.getBOOL("NoVerifySSLCert");
-	mCertStore = gSavedSettings.getString("CertStore");
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, vefifySSLCert);
-	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, vefifySSLCert ? 2 : 0);
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
+	mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify() ? 2 : 0);
 	// Be a little impatient about establishing connections.
 	mCurlRequest->setopt(CURLOPT_CONNECTTIMEOUT, 40L);
-	mCurlRequest->setSSLCtxCallback(_sslCtxFunction, (void *)this);
 
 	/* Setting the DNS cache timeout to -1 disables it completely.
 	   This might help with bug #503 */
@@ -417,19 +341,11 @@ bool LLXMLRPCTransaction::Impl::process()
 		{
 			if (result != CURLE_OK)
 			{
-				if ((result != CURLE_SSL_PEER_CERTIFICATE) &&
-					(result != CURLE_SSL_CACERT))
-				{
-					// if we have a curl error that's not already been handled
-					// (a non cert error), then generate the error message as
-					// appropriate
-					setCurlStatus(result);
-				
-					llwarns << "LLXMLRPCTransaction CURL error "
-					<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
-					llwarns << "LLXMLRPCTransaction request URI: "
-					<< mURI << llendl;
-				}
+				setCurlStatus(result);
+				llwarns << "LLXMLRPCTransaction CURL error "
+						<< mCurlCode << ": " << mCurlRequest->getErrorString() << llendl;
+				llwarns << "LLXMLRPCTransaction request URI: "
+						<< mURI << llendl;
 					
 				return true;
 			}
@@ -507,6 +423,7 @@ void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
 			case StatusComplete:
 				mStatusMessage = "(done)";
 				break;
+				
 			default:
 				// Usually this means that there's a problem with the login server,
 				// not with the client.  Direct user to status page.
@@ -622,11 +539,6 @@ std::string LLXMLRPCTransaction::statusMessage()
 	return impl.mStatusMessage;
 }
 
-LLPointer<LLCertificate> LLXMLRPCTransaction::getErrorCert()
-{
-	return impl.mErrorCert;
-}
-
 std::string LLXMLRPCTransaction::statusURI()
 {
 	return impl.mStatusURI;
diff --git a/indra/newview/llxmlrpctransaction.h b/indra/newview/llxmlrpctransaction.h
index 8beb2e2623..c835423d67 100644
--- a/indra/newview/llxmlrpctransaction.h
+++ b/indra/newview/llxmlrpctransaction.h
@@ -38,7 +38,6 @@
 typedef struct _xmlrpc_request* XMLRPC_REQUEST;
 typedef struct _xmlrpc_value* XMLRPC_VALUE;
 	// foward decl of types from xmlrpc.h (this usage is type safe)
-class LLCertificate;
 
 class LLXMLRPCValue
 	// a c++ wrapper around XMLRPC_VALUE
@@ -116,8 +115,6 @@ public:
 		
 	EStatus status(int* curlCode);
 		// return status, and extended CURL code, if code isn't null
-	
-	LLPointer<LLCertificate> getErrorCert();
 	std::string statusMessage();
 		// return a message string, suitable for showing the user
 	std::string statusURI();
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index a55201fd53..d03231a3fa 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -49,7 +49,7 @@ libcurl Version: [LIBCURL_VERSION]
 J2C Decoder Version: [J2C_VERSION]
 Audio Driver Version: [AUDIO_DRIVER_VERSION]
 Qt Webkit Version: [QT_WEBKIT_VERSION]
-Voice Server Version: [VOICE_VERSION]
+Vivox Version: [VIVOX_VERSION]
 </floater.string>
   <floater.string
      name="none">
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index c42b846dbb..e8ba8c683d 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1382,18 +1382,6 @@ Unknown Vorbis encode failure on: [FILE]
 Unable to encode file: [FILE]
   </notification>
 
-  <notification
-   icon="alertmodal.tga"
-   name="CorruptedProtectedDataStore"
-   type="alertmodal">
-  We are unable to read your protected data so it is being reset.
-   This may happen when you change network setup.
-
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-  </notification>
-    
   <notification
    icon="alertmodal.tga"
    name="CorruptResourceFile"
@@ -2429,57 +2417,6 @@ Please choose the male or female avatar. You can change your mind later.
      notext="Female"
      yestext="Male"/>
   </notification>
-  <notification icon="alertmodal.tga"
-		name="CantTeleportToGrid"
-		type="alertmodal">
-Could not teleport to [SLURL] as it's on a different grid ([GRID]) than the current grid ([CURRENT_GRID]).  Please close your viewer and try again.
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-  </notification>
-
-  <notification icon="alertmodal.tga"
-		name="GeneralCertificateError"
-		type="alertmodal">
-Could not connect to the server.
-[REASON]
-
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-    <usetemplate
-     name="okbutton"
-     yestext="OK"/>
-   </notification>
-
-  <notification icon="alertmodal.tga"
-		name="TrustCertificateError"
-		type="alertmodal">
-The certification authority for this server is not known.
-
-Certificate Information:
-SubjectName: [SUBJECT_NAME_STRING]
-IssuerName: [ISSUER_NAME_STRING]
-Valid From: [VALID_FROM]
-Valid To: [VALID_TO]
-MD5 Fingerprint: [SHA1_DIGEST]
-SHA1 Fingerprint: [MD5_DIGEST]
-Key Usage: [KEYUSAGE]
-Extended Key Usage: [EXTENDEDKEYUSAGE]
-Subject Key Identifier: [SUBJECTKEYIDENTIFIER]
-
-Would you like to trust this authority?
-    <usetemplate
-     name="okcancelbuttons"
-     notext="Cancel"
-     yestext="Trust"/>
-  </notification>
 
   <notification
    icon="alertmodal.tga"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index 539c5f785c..01adc00e1a 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -48,31 +48,50 @@ auto_resize="false"
 follows="left|bottom"
 name="login"
 layout="topleft"
-width="850"
-min_width="850"
+width="695"
+min_width="695"
 user_resize="false"
 height="80">
 <text
 follows="left|bottom"
 font="SansSerifSmall"
 height="16"
-name="username_text"
+name="first_name_text"
 top="20"
 left="20"
 width="150">
-Username:
+First name:
 </text>
 <line_editor
 follows="left|bottom"
 height="22"
-label="Username"
+label="First"
 left_delta="0"
 max_length="31"
-name="username_edit"
+name="first_name_edit"
 select_on_focus="true"
-tool_tip="[SECOND_LIFE] Username"
+tool_tip="[SECOND_LIFE] First Name"
 top_pad="0"
-width="150" />
+   width="135" />
+  <text
+   follows="left|bottom"
+   font="SansSerifSmall"
+   height="16"
+   left_pad="8"
+   name="last_name_text"
+   top="20"
+   width="150">
+    Last name:   </text>
+<line_editor
+follows="left|bottom"
+height="22"
+label="Last"
+max_length="31"
+name="last_name_edit"
+select_on_focus="true"
+tool_tip="[SECOND_LIFE] Last Name"
+  top_pad="0"
+  width="135" />
 <text
 follows="left|bottom"
 font="SansSerifSmall"
@@ -80,7 +99,7 @@ height="15"
 left_pad="8"
 name="password_text"
 top="20"
-    width="135">
+    width="150">
        Password:
 </text>
 <line_editor
@@ -100,14 +119,26 @@ label="Remember password"
   top_pad="3"
   name="remember_check"
  width="135" />
+<button
+  follows="left|bottom"
+  height="23"
+  image_unselected="PushButton_On"
+  image_selected="PushButton_On_Selected"
+  label="Log In"
+  label_color="White"
+  layout="topleft"
+  left_pad="10"
+  name="connect_btn"
+  top="35"
+  width="90" />
   <text
   follows="left|bottom"
   font="SansSerifSmall"
   height="15"
-  left_pad="10"
+  left_pad="18"
   name="start_location_text"
 top="20"
-  width="250">
+  width="130">
        Start at:
  </text>
 <combo_box
@@ -118,7 +149,7 @@ control_name="LoginLocation"
 max_chars="128"
 top_pad="0"
 name="start_location_combo"
-     width="250">
+     width="135">
 <combo_box.item
 label="My last location"
 name="MyLastLocation"
@@ -131,37 +162,16 @@ name="MyHome"
 label="&lt;Type region name&gt;"
 name="Typeregionname"   value="" />
 </combo_box>
-<button
-  height="23"
-  image_unselected="PushButton_On"
-  image_selected="PushButton_On_Selected"
-  label="Log In"
-  label_color="White"
-  layout="topleft"
-  left_pad="10"
-  name="connect_btn"
-  top="35"
-  width="90" />
-  <text
-  follows="left|bottom"
-  font="SansSerifSmall"
-  height="15"
-  left_pad="10"
-  name="start_location_text"
-top="20"
-  width="150">
-       Grid Name:
- </text>
 <combo_box
-follows="left|bottom"
 allow_text_entry="true"
 font="SansSerifSmall"
-height="23"
+   follows="left|right|bottom"
+   height="23"
+layout="topleft"
+top_pad="2"
 name="server_combo"
-top_pad="0"
-width="150"
-max_chars="255"
-visible="false" />
+width="135"
+  visible="false" />
 </layout_panel>
 <layout_panel
 follows="right|bottom"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 9ac4ef9b37..0c73b8d769 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -46,15 +46,6 @@
 	<string name="LoginWaitingForRegionHandshake">Waiting for region handshake...</string>
 	<string name="LoginConnectingToRegion">Connecting to region...</string>
 	<string name="LoginDownloadingClothing">Downloading clothing...</string>
-        <string name="InvalidCertificate">The server returned an invalid or corrupt certificate. Please contact the Grid administrator.</string>
-        <string name="CertInvalidHostname">An invalid hostname was used to access the server, please check your SLURL or Grid hostname.</string>
-        <string name="CertExpired">The certificate returned by the Grid appears to be expired.  Please check your system clock, or contact your Grid administr\
-ator.</string>
-        <string name="CertKeyUsage">The certificate returned by the server could not be used for SSL.  Please contact your Grid administrator.</string>
-        <string name="CertBasicConstraints">Too many certificates were in the servers Certificate chain.  Please contact your Grid administrator.</string>
-        <string name="CertInvalidSignature">The certificate signature returned by the Grid server could not be verified.  Please contact your Grid administrat
-or.</string>
-
 	<string name="LoginFailedNoNetwork">Network Error: Could not establish connection, please check your network connection.</string>
 	<string name="LoginFailed">Login failed.</string>
 	<string name="Quit">Quit</string>
diff --git a/indra/newview/tests/lllogininstance_test.cpp b/indra/newview/tests/lllogininstance_test.cpp
index 67da9f2cdf..ef93586c6e 100644
--- a/indra/newview/tests/lllogininstance_test.cpp
+++ b/indra/newview/tests/lllogininstance_test.cpp
@@ -10,10 +10,7 @@
 // Precompiled header
 #include "../llviewerprecompiledheaders.h"
 // Own header
-#include "../llsecapi.h"
-#include "../llviewernetwork.h"
 #include "../lllogininstance.h"
-
 // STL headers
 // std headers
 // external library headers
@@ -36,12 +33,7 @@ const std::string APPVIEWER_SERIALNUMBER("appviewer_serialno");
 //-----------------------------------------------------------------------------
 static LLEventStream gTestPump("test_pump");
 
-#include "../llslurl.h"
-#include "../llstartup.h"
-LLSLURL LLStartUp::sStartSLURL;
-
 #include "lllogin.h"
-
 static std::string gLoginURI;
 static LLSD gLoginCreds;
 static bool gDisconnectCalled = false;
@@ -62,68 +54,17 @@ void LLLogin::disconnect()
 	gDisconnectCalled = true;
 }
 
-LLSD LLCredential::getLoginParams()
-{
-	LLSD result = LLSD::emptyMap();
-
-	// legacy credential
-	result["passwd"] = "$1$testpasssd";
-	result["first"] = "myfirst";
-	result["last"] ="mylast";
-	return result;
-}
-
 //-----------------------------------------------------------------------------
 #include "../llviewernetwork.h"
-LLGridManager::~LLGridManager()
-{
-}
-
-void LLGridManager::addGrid(LLSD& grid_data)
-{
-}
-LLGridManager::LLGridManager()
-{	
-}
+unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {'1','2','3','4','5','6'};
 
-void LLGridManager::getLoginURIs(std::vector<std::string>& uris)
+LLViewerLogin::LLViewerLogin() : mGridChoice(GRID_INFO_NONE) {}
+LLViewerLogin::~LLViewerLogin() {}
+void LLViewerLogin::getLoginURIs(std::vector<std::string>& uris) const 
 {
 	uris.push_back(VIEWERLOGIN_URI);
 }
-
-void LLGridManager::addSystemGrid(const std::string& label, 
-								  const std::string& name, 
-								  const std::string& login, 
-								  const std::string& helper,
-								  const std::string& login_page,
-								  const std::string& login_id)
-{
-}
-std::map<std::string, std::string> LLGridManager::getKnownGrids(bool favorite_only)
-{
-	std::map<std::string, std::string> result;
-	return result;
-}
-
-void LLGridManager::setGridChoice(const std::string& grid_name)
-{
-}
-
-bool LLGridManager::isInProductionGrid()
-{
-	return false;
-}
-
-void LLGridManager::saveFavorites()
-{}
-std::string LLGridManager::getSLURLBase(const std::string& grid_name)
-{
-	return "myslurl";
-}
-std::string LLGridManager::getAppSLURLBase(const std::string& grid_name)
-{
-	return "myappslurl";
-}
+std::string LLViewerLogin::getGridLabel() const { return VIEWERLOGIN_GRIDLABEL; }
 
 //-----------------------------------------------------------------------------
 #include "../llviewercontrol.h"
@@ -145,6 +86,10 @@ BOOL LLControlGroup::declareString(const std::string& name, const std::string &i
 #include "lluicolortable.h"
 void LLUIColorTable::saveUserSettings(void)const {}
 
+//-----------------------------------------------------------------------------
+#include "../llurlsimstring.h"
+LLURLSimString LLURLSimString::sInstance;
+bool LLURLSimString::parse() { return true; }
 
 //-----------------------------------------------------------------------------
 #include "llnotifications.h"
@@ -252,29 +197,15 @@ namespace tut
 			gSavedSettings.declareString("NextLoginLocation", "", "", FALSE);
 			gSavedSettings.declareBOOL("LoginLastLocation", FALSE, "", FALSE);
 
-			LLSD authenticator = LLSD::emptyMap();
-			LLSD identifier = LLSD::emptyMap();
-			identifier["type"] = "agent";
-			identifier["first_name"] = "testfirst";
-			identifier["last_name"] = "testlast";
-			authenticator["passwd"] = "testpass";
-			agentCredential = new LLCredential();
-			agentCredential->setCredentialData(identifier, authenticator);
-			
-			authenticator = LLSD::emptyMap();
-			identifier = LLSD::emptyMap();
-			identifier["type"] = "account";
-			identifier["username"] = "testuser";
-			authenticator["secret"] = "testsecret";
-			accountCredential = new LLCredential();
-			accountCredential->setCredentialData(identifier, authenticator);			
+			credentials["first"] = "testfirst";
+			credentials["last"] = "testlast";
+			credentials["passwd"] = "testpass";
 
 			logininstance->setNotificationsInterface(&notifications);
 		}
 
 		LLLoginInstance* logininstance;
-		LLPointer<LLCredential> agentCredential;
-		LLPointer<LLCredential> accountCredential;
+		LLSD credentials;
 		MockNotifications notifications;
     };
 
@@ -288,7 +219,7 @@ namespace tut
 		set_test_name("Test Simple Success And Disconnect");
 
 		// Test default connect.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -329,7 +260,7 @@ namespace tut
 		const std::string test_uri = "testing-uri";
 
 		// Test default connect.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 
 		// connect should call LLLogin::connect to init gLoginURI and gLoginCreds.
 		ensure_equals("Default connect uri", gLoginURI, "testing-uri"); 
@@ -351,7 +282,7 @@ namespace tut
 		ensure("No TOS, failed auth", logininstance->authFailure());
 
 		// Start again.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		gTestPump.post(response); // Fail for tos again.
 		gTOSReplyPump->post(true); // Accept tos, should reconnect w/ agree_to_tos.
 		ensure_equals("Accepted agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), true);
@@ -363,11 +294,11 @@ namespace tut
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
 
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		ensure_equals("Reset to default for agree to tos", gLoginCreds["params"]["agree_to_tos"].asBoolean(), false);
 
 		// Critical Message failure response.
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		response["data"]["reason"] = "critical"; // Change response to "critical message"
 		gTestPump.post(response);
 
@@ -381,7 +312,7 @@ namespace tut
 		response["data"]["reason"] = "key"; // bad creds.
 		gTestPump.post(response);
 		ensure("TOS auth failure", logininstance->authFailure());
-		logininstance->connect(test_uri, agentCredential);
+		logininstance->connect(test_uri, credentials);
 		ensure_equals("Default for agree to tos", gLoginCreds["params"]["read_critical"].asBoolean(), false);
 	}
 
@@ -392,7 +323,7 @@ namespace tut
 
 		// Part 1 - Mandatory Update, with User accepts response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -418,7 +349,7 @@ namespace tut
 		set_test_name("Test Mandatory Update User Decline");
 
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -444,7 +375,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
@@ -470,7 +401,7 @@ namespace tut
 
 		// Part 3 - Mandatory Update, with bogus response.
 		// Test connect with update needed.
-		logininstance->connect(agentCredential);
+		logininstance->connect(credentials);
 
 		ensure_equals("Default connect uri", gLoginURI, VIEWERLOGIN_URI); 
 
diff --git a/indra/newview/tests/llsecapi_test.cpp b/indra/newview/tests/llsecapi_test.cpp
deleted file mode 100644
index caa1461987..0000000000
--- a/indra/newview/tests/llsecapi_test.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/** 
- * @file llsecapi_test.cpp
- * @author Roxie
- * @date 2009-02-10
- * @brief Test the sec api functionality
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-#include "../llviewerprecompiledheaders.h"
-#include "../llviewernetwork.h"
-#include "../test/lltut.h"
-#include "../llsecapi.h"
-#include "../../llxml/llcontrol.h"
-
-
-//----------------------------------------------------------------------------               
-// Mock objects for the dependencies of the code we're testing                               
-
-LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name) {}
-LLControlGroup::~LLControlGroup() {}
-BOOL LLControlGroup::declareString(const std::string& name,
-                                   const std::string& initial_val,
-                                   const std::string& comment,
-                                   BOOL persist) {return TRUE;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-std::string LLControlGroup::getString(const std::string& name)
-{
-	return "";
-}
-
-
-LLControlGroup gSavedSettings("test");
-class LLSecAPIBasicHandler : public LLSecAPIHandler
-{
-protected:
-	LLPointer<LLCertificateChain> mCertChain;
-	LLPointer<LLCertificate> mCert;
-	LLPointer<LLCertificateStore> mCertStore;
-	LLSD mLLSD;
-	
-public:
-	LLSecAPIBasicHandler() {}
-	
-	virtual ~LLSecAPIBasicHandler() {}
-	
-	// instantiate a certificate from a pem string
-	virtual LLPointer<LLCertificate> getCertificate(const std::string& pem_cert) 
-	{ 
-		return mCert; 
-	}
-	
-	
-	// instiate a certificate from an openssl X509 structure
-	virtual LLPointer<LLCertificate> getCertificate(X509* openssl_cert) 
-	{	
-		return mCert; 
-	}
-	
-	
-	// instantiate a chain from an X509_STORE_CTX
-	virtual LLPointer<LLCertificateChain> getCertificateChain(const X509_STORE_CTX* chain) 
-	{ 
-		return mCertChain; 
-	}
-	
-	// instantiate a cert store given it's id.  if a persisted version
-	// exists, it'll be loaded.  If not, one will be created (but not
-	// persisted)
-	virtual LLPointer<LLCertificateStore> getCertificateStore(const std::string& store_id) 
-	{ 
-		return mCertStore; 
-	}
-	
-	// persist data in a protected store
-	virtual void setProtectedData(const std::string& data_type,
-								  const std::string& data_id,
-								  const LLSD& data) {}
-	
-	// retrieve protected data
-	virtual LLSD getProtectedData(const std::string& data_type,
-								  const std::string& data_id) 
-	{ 
-		return mLLSD;
-	}
-	
-	virtual void deleteProtectedData(const std::string& data_type,
-									 const std::string& data_id)
-	{
-	}
-	
-	virtual LLPointer<LLCredential> createCredential(const std::string& grid,
-													 const LLSD& identifier, 
-													 const LLSD& authenticator)
-	{
-		LLPointer<LLCredential> cred = NULL;
-		return cred;
-	}
-	
-	virtual LLPointer<LLCredential> loadCredential(const std::string& grid)
-	{
-		LLPointer<LLCredential> cred = NULL;
-		return cred;
-	}
-	
-	virtual void saveCredential(LLPointer<LLCredential> cred, bool save_authenticator) {}
-	
-	virtual void deleteCredential(LLPointer<LLCredential> cred) {}
-};
-
-// -------------------------------------------------------------------------------------------
-// TUT
-// -------------------------------------------------------------------------------------------
-namespace tut
-{
-	// Test wrapper declaration : wrapping nothing for the moment
-	struct secapiTest
-	{
-		
-		secapiTest()
-		{
-		}
-		~secapiTest()
-		{
-		}
-	};
-	
-	// Tut templating thingamagic: test group, object and test instance
-	typedef test_group<secapiTest> secapiTestFactory;
-	typedef secapiTestFactory::object secapiTestObject;
-	tut::secapiTestFactory tut_test("llsecapi");
-	
-	// ---------------------------------------------------------------------------------------
-	// Test functions 
-	// ---------------------------------------------------------------------------------------
-	// registration
-	template<> template<>
-	void secapiTestObject::test<1>()
-	{
-		// retrieve an unknown handler
-
-		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
-		LLPointer<LLSecAPIHandler> test1_handler =  new LLSecAPIBasicHandler();
-		registerSecHandler("sectest1", test1_handler);
-		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
-		LLPointer<LLSecAPIHandler> retrieved_test1_handler = getSecHandler("sectest1");
-		ensure("Retrieved sectest1 handler should be the same", 
-			   retrieved_test1_handler == test1_handler);
-		
-		// insert a second handler
-		LLPointer<LLSecAPIHandler> test2_handler =  new LLSecAPIBasicHandler();
-		registerSecHandler("sectest2", test2_handler);
-		ensure("'Unknown' handler should be NULL", !(BOOL)getSecHandler("unknown"));
-		retrieved_test1_handler = getSecHandler("sectest1");
-		ensure("Retrieved sectest1 handler should be the same", 
-			   retrieved_test1_handler == test1_handler);
-
-		LLPointer<LLSecAPIHandler> retrieved_test2_handler = getSecHandler("sectest2");
-		ensure("Retrieved sectest1 handler should be the same", 
-			   retrieved_test2_handler == test2_handler);
-		
-	}
-}
diff --git a/indra/newview/tests/llsechandler_basic_test.cpp b/indra/newview/tests/llsechandler_basic_test.cpp
deleted file mode 100644
index 236d17c591..0000000000
--- a/indra/newview/tests/llsechandler_basic_test.cpp
+++ /dev/null
@@ -1,964 +0,0 @@
-/** 
- * @file llsechandler_basic_test.cpp
- * @author Roxie
- * @date 2009-02-10
- * @brief Test the 'basic' sec handler functions
- *
- * $LicenseInfo:firstyear=2005&license=viewergpl$
- * 
- * Copyright (c) 2005-2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-#include "../llviewerprecompiledheaders.h"
-#include "../test/lltut.h"
-#include "../llsecapi.h"
-#include "../llsechandler_basic.h"
-#include "../../llxml/llcontrol.h"
-#include "../llviewernetwork.h"
-#include "lluuid.h"
-#include "llxorcipher.h"
-#include "apr_base64.h"
-#include <vector>
-#include <ios>
-#include <llsdserialize.h>
-#include <openssl/pem.h>
-#include <openssl/err.h>
-#include <openssl/evp.h>
-#include "llxorcipher.h"
-
-#define ensure_throws(str, exc_type, cert, func, ...) \
-try \
-{ \
-func(__VA_ARGS__); \
-fail("throws, " str); \
-} \
-catch(exc_type& except) \
-{ \
-ensure("Exception cert is incorrect for " str, except.getCert() == cert); \
-}
-
-extern bool _cert_hostname_wildcard_match(const std::string& hostname, const std::string& wildcard_string);
-
-//----------------------------------------------------------------------------               
-// Mock objects for the dependencies of the code we're testing                               
-
-std::string gFirstName;
-std::string gLastName;
-LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name) {}
-LLControlGroup::~LLControlGroup() {}
-BOOL LLControlGroup::declareString(const std::string& name,
-                                   const std::string& initial_val,
-                                   const std::string& comment,
-                                   BOOL persist) {return TRUE;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-std::string LLControlGroup::getString(const std::string& name)
-{
-
-	if (name == "FirstName")
-		return gFirstName;
-	else if (name == "LastName")
-		return gLastName;
-	return "";
-}
-
-LLSD LLCredential::getLoginParams()
-{
-	LLSD result = LLSD::emptyMap();
-	
-	// legacy credential
-	result["passwd"] = "$1$testpasssd";
-	result["first"] = "myfirst";
-	result["last"] ="mylast";
-	return result;
-}
-
-
-
-LLControlGroup gSavedSettings("test");
-unsigned char gMACAddress[MAC_ADDRESS_BYTES] = {77,21,46,31,89,2};
-
-// -------------------------------------------------------------------------------------------
-// TUT
-// -------------------------------------------------------------------------------------------
-namespace tut
-{
-	// Test wrapper declaration : wrapping nothing for the moment
-	struct sechandler_basic_test
-	{
-		std::string mPemTestCert, mPemRootCert, mPemIntermediateCert, mPemChildCert;
-		std::string mDerFormat;
-		X509 *mX509TestCert, *mX509RootCert, *mX509IntermediateCert, *mX509ChildCert;
-
-		sechandler_basic_test()
-		{
-			OpenSSL_add_all_algorithms();
-			OpenSSL_add_all_ciphers();
-			OpenSSL_add_all_digests();	
-			ERR_load_crypto_strings();
-			gFirstName = "";
-			gLastName = "";
-			LLFile::remove("test_password.dat");
-			LLFile::remove("sechandler_settings.tmp");			
-			mPemTestCert = "-----BEGIN CERTIFICATE-----\n"
-				"MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIx\n"
-				"EzARBgNVBAoTCklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25h\n"
-				"bCBkZSBUZWNub2xvZ2lhIGRhIEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJy\n"
-				"YXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UEAxMoQXV0b3JpZGFkZSBDZXJ0aWZp\n"
-				"Y2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4MDBaFw0xMTExMzAy\n"
-				"MzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9MDsG\n"
-				"A1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3Jt\n"
-				"YWNhbyAtIElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYD\n"
-				"VQQDEyhBdXRvcmlkYWRlIENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIB\n"
-				"IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVA\n"
-				"isamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma/3pUpgcfNAj0vYm5gsyj\n"
-				"Qo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt4CyNrY50\n"
-				"QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYt\n"
-				"bRhFboUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbUR\n"
-				"yEeNvZneVRKAAU6ouwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwID\n"
-				"AQABo4HSMIHPME4GA1UdIARHMEUwQwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0\n"
-				"cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQQ2FjcmFpei5wZGYwPQYDVR0f\n"
-				"BDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0xDUmFj\n"
-				"cmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB\n"
-				"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1\n"
-				"U/hgIh6OcgLAfiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGl\n"
-				"YjJe+9zd+izPRbBqXPVQA34EXcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75Fos\n"
-				"SzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQfS//JYeIc7Fue2JNLd00UOSMMaiK/\n"
-				"t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr1ME7a55lFEnSeT0u\n"
-				"mlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5nmPb\n"
-				"K+9A46sd33oqK8n8\n"
-				"-----END CERTIFICATE-----\n";
-
-			mPemRootCert = "-----BEGIN CERTIFICATE-----\n"
-			"MIIB0TCCATqgAwIBAgIJANaTqrzEvHaRMA0GCSqGSIb3DQEBBAUAMBsxGTAXBgNV\n"
-			"BAMTEFJveGllcyB0ZXN0IHJvb3QwHhcNMDkwNDE1MjEwNzQ3WhcNMTAwNDE1MjEw\n"
-			"NzQ3WjAbMRkwFwYDVQQDExBSb3hpZXMgdGVzdCByb290MIGfMA0GCSqGSIb3DQEB\n"
-			"AQUAA4GNADCBiQKBgQCpo5nDW6RNz9IHUVZd7Tw2XAQiBniDF4xH0N1w7sUYTiFq\n"
-			"21mABsnOPJD3ra+MtOsXPHcaljm661JjTD8L40v5sfEbqDUPcOw76ClrPqnuAeyT\n"
-			"38qk8DHku/mT8YdprevGZdVcUXQg3vosVzOL93HOOHK+u61mEEoM9W5xoNVEdQID\n"
-			"AQABox0wGzAMBgNVHRMEBTADAQH/MAsGA1UdDwQEAwIBBjANBgkqhkiG9w0BAQQF\n"
-			"AAOBgQAzn0aW/+zWPmcTbvxonyiYYUr9b4SOB/quhAkT8KT4ir1dcZAXRR59+kEn\n"
-			"HSTu1FAodV0gvESqyobftF5hZ1XMxdJqGu//xP+YCwlv244G/0pp7KLI8ihNO2+N\n"
-			"lPBUJgbo++ZkhiE1jotZi9Ay0Oedh3s/AfbMZPyfpJ23ll6+BA==\n"
-			"-----END CERTIFICATE-----\n";
-			
-			
-			
-			mPemIntermediateCert = "-----BEGIN CERTIFICATE-----\n"
-			"MIIBzzCCATigAwIBAgIBATANBgkqhkiG9w0BAQQFADAbMRkwFwYDVQQDExBSb3hp\n"
-			"ZXMgdGVzdCByb290MB4XDTA5MDQxNTIxMzE1NloXDTEwMDQxNTIxMzE1NlowITEf\n"
-			"MB0GA1UEAxMWUm94aWVzIGludGVybWVkaWF0ZSBDQTCBnzANBgkqhkiG9w0BAQEF\n"
-			"AAOBjQAwgYkCgYEA15MM0W1R37rx/24Q2Qkb5bSiQZxTUcQAhJ2pA8mwUucXuCVt\n"
-			"6ayI2TuN32nkjmsCgUkiT/bdXWp0OJo7/MXRIFeUNMCRxrpeFnxuigYEqbIXAdN6\n"
-			"qu/vdG2X4PRv/v9Ijrju4cBEiKIldIgOurWEIfXEsVSFP2XmFQHesF04qDcCAwEA\n"
-			"AaMdMBswDAYDVR0TBAUwAwEB/zALBgNVHQ8EBAMCAQYwDQYJKoZIhvcNAQEEBQAD\n"
-			"gYEAYljikYgak3W1jSo0vYthNHUy3lBVAKzDhpM96lY5OuXFslpCRX42zNL8X3kN\n"
-			"U/4IaJUVtZqx8WsUXl1eXHzBCaXCftapV4Ir6cENLIsXCdXs8paFYzN5nPJA5GYU\n"
-			"zWgkSEl1MEhNIc+bJW34vwi29EjrAShAhsIZ84Mt/lvD3Pc=\n"
-			"-----END CERTIFICATE-----\n";
-			
-			mPemChildCert = "-----BEGIN CERTIFICATE-----\n"
-			"MIIB5DCCAU0CBEnm9eUwDQYJKoZIhvcNAQEEBQAwITEfMB0GA1UEAxMWUm94aWVz\n"
-			"IGludGVybWVkaWF0ZSBDQTAeFw0wOTA0MTYwMDAzNDlaFw0xMDA0MTYwMDAzNDla\n"
-			"MCAxHjAcBgNVBAMTFWVuaWFjNjMubGluZGVubGFiLmNvbTCBnzANBgkqhkiG9w0B\n"
-			"AQEFAAOBjQAwgYkCgYEAp9I5rofEzbjNht+9QejfnsIlEPqSxskoWKCG255TesWR\n"
-			"RTmw9wafHQQkJk/VIsaU4RMBYHkknGbHX2dGvMHmKZoWUPSQ/8FZz09o0Qx3TNUZ\n"
-			"l7KlGOD2d1c7ZxXDPqlLC6QW8DrE1/8zfwJ5cbYBXc8e7OKdSZeRrnwHyw4Q8r8C\n"
-			"AwEAAaMvMC0wEwYDVR0lBAwwCgYIKwYBBQUHAwEwCQYDVR0TBAIwADALBgNVHQ8E\n"
-			"BAMCBaAwDQYJKoZIhvcNAQEEBQADgYEAIG0M5tqYlXyMiGKPZfXy/R3M3ZZOapDk\n"
-			"W0dsXJYXAc35ftwtn0VYu9CNnZCcli17/d+AKhkK8a/oGPazqudjFF6WLJLTXaY9\n"
-			"NmhkJcOPADXkbyQPUPXzLe4YRrkEQeGhzMb4rKDQ1TKAcXfs0Y068pTpsixNSxja\n"
-			"NhAUUcve5Is=\n"
-			"-----END CERTIFICATE-----\n";
-			
-			mDerFormat = "MIIEuDCCA6CgAwIBAgIBBDANBgkqhkiG9w0BAQUFADCBtDELMAkGA1UEBhMCQlIxEzARBgNVBAoT"
-"CklDUC1CcmFzaWwxPTA7BgNVBAsTNEluc3RpdHV0byBOYWNpb25hbCBkZSBUZWNub2xvZ2lhIGRh"
-"IEluZm9ybWFjYW8gLSBJVEkxETAPBgNVBAcTCEJyYXNpbGlhMQswCQYDVQQIEwJERjExMC8GA1UE"
-"AxMoQXV0b3JpZGFkZSBDZXJ0aWZpY2Fkb3JhIFJhaXogQnJhc2lsZWlyYTAeFw0wMTExMzAxMjU4"
-"MDBaFw0xMTExMzAyMzU5MDBaMIG0MQswCQYDVQQGEwJCUjETMBEGA1UEChMKSUNQLUJyYXNpbDE9"
-"MDsGA1UECxM0SW5zdGl0dXRvIE5hY2lvbmFsIGRlIFRlY25vbG9naWEgZGEgSW5mb3JtYWNhbyAt"
-"IElUSTERMA8GA1UEBxMIQnJhc2lsaWExCzAJBgNVBAgTAkRGMTEwLwYDVQQDEyhBdXRvcmlkYWRl"
-"IENlcnRpZmljYWRvcmEgUmFpeiBCcmFzaWxlaXJhMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB"
-"CgKCAQEAwPMudwX/hvm+Uh2b/lQAcHVAisamaLkWdkwP9/S/tOKIgRrL6Oy+ZIGlOUdd6uYtk9Ma"
-"/3pUpgcfNAj0vYm5gsyjQo9emsc+x6m4VWwk9iqMZSCK5EQkAq/Ut4n7KuLE1+gdftwdIgxfUsPt"
-"4CyNrY50QV57KM2UT8x5rrmzEjr7TICGpSUAl2gVqe6xaii+bmYR1QrmWaBSAG59LrkrjrYtbRhF"
-"boUDe1DK+6T8s5L6k8c8okpbHpa9veMztDVC9sPJ60MWXh6anVKo1UcLcbURyEeNvZneVRKAAU6o"
-"uwdjDvwlsaKydFKwed0ToQ47bmUKgcm+wV3eTRk36UOnTwIDAQABo4HSMIHPME4GA1UdIARHMEUw"
-"QwYFYEwBAQAwOjA4BggrBgEFBQcCARYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292LmJyL0RQ"
-"Q2FjcmFpei5wZGYwPQYDVR0fBDYwNDAyoDCgLoYsaHR0cDovL2FjcmFpei5pY3BicmFzaWwuZ292"
-"LmJyL0xDUmFjcmFpei5jcmwwHQYDVR0OBBYEFIr68VeEERM1kEL6V0lUaQ2kxPA3MA8GA1UdEwEB"
-"/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQAZA5c1U/hgIh6OcgLA"
-"fiJgFWpvmDZWqlV30/bHFpj8iBobJSm5uDpt7TirYh1Uxe3fQaGlYjJe+9zd+izPRbBqXPVQA34E"
-"Xcwk4qpWuf1hHriWfdrx8AcqSqr6CuQFwSr75FosSzlwDADa70mT7wZjAmQhnZx2xJ6wfWlT9VQf"
-"S//JYeIc7Fue2JNLd00UOSMMaiK/t79enKNHEA2fupH3vEigf5Eh4bVAN5VohrTm6MY53x7XQZZr"
-"1ME7a55lFEnSeT0umlOAjR2mAbvSM5X5oSZNrmetdzyTj2flCM8CC7MLab0kkdngRIlUBGHF1/S5"
-"nmPbK+9A46sd33oqK8n8";
-			
-			mX509TestCert = NULL;
-			mX509RootCert = NULL;
-			mX509IntermediateCert = NULL;
-			mX509ChildCert = NULL;
-			
-			BIO * validation_bio = BIO_new_mem_buf((void*)mPemTestCert.c_str(), mPemTestCert.length());			
-			PEM_read_bio_X509(validation_bio, &mX509TestCert, 0, NULL);
-			BIO_free(validation_bio);
-			validation_bio = BIO_new_mem_buf((void*)mPemRootCert.c_str(), mPemRootCert.length());
-			PEM_read_bio_X509(validation_bio, &mX509RootCert, 0, NULL);
-			BIO_free(validation_bio);
-			validation_bio = BIO_new_mem_buf((void*)mPemIntermediateCert.c_str(), mPemIntermediateCert.length());
-			PEM_read_bio_X509(validation_bio, &mX509IntermediateCert, 0, NULL);
-			BIO_free(validation_bio);	
-			validation_bio = BIO_new_mem_buf((void*)mPemChildCert.c_str(), mPemChildCert.length());
-			PEM_read_bio_X509(validation_bio, &mX509ChildCert, 0, NULL);
-			BIO_free(validation_bio);				
-		}
-		~sechandler_basic_test()
-		{
-			LLFile::remove("test_password.dat");
-			LLFile::remove("sechandler_settings.tmp");
-			LLFile::remove("mycertstore.pem");
-			X509_free(mX509TestCert);
-			X509_free(mX509RootCert);
-			X509_free(mX509IntermediateCert);
-			X509_free(mX509ChildCert);
-		}
-	};
-	
-	// Tut templating thingamagic: test group, object and test instance
-	typedef test_group<sechandler_basic_test> sechandler_basic_test_factory;
-	typedef sechandler_basic_test_factory::object sechandler_basic_test_object;
-	tut::sechandler_basic_test_factory tut_test("llsechandler_basic");
-	
-	// ---------------------------------------------------------------------------------------
-	// Test functions 
-	// ---------------------------------------------------------------------------------------
-	// test cert data retrieval
-	template<> template<>
-	void sechandler_basic_test_object::test<1>()
-	
-	{
-		char buffer[4096];
-		LLPointer<LLCertificate> test_cert = new LLBasicCertificate(mPemTestCert);
-		
-		ensure_equals("Resultant pem is correct",
-			   mPemTestCert, test_cert->getPem());
-		std::vector<U8> binary_cert = test_cert->getBinary();
-
-		apr_base64_encode(buffer, (const char *)&binary_cert[0], binary_cert.size());
-		
-		ensure_equals("Der Format is correct", memcmp(buffer, mDerFormat.c_str(), mDerFormat.length()), 0);
-		
-		LLSD llsd_cert = test_cert->getLLSD();
-		std::ostringstream llsd_value;
-		llsd_value << LLSDOStreamer<LLSDNotationFormatter>(llsd_cert) << std::endl;
-		std::string llsd_cert_str = llsd_value.str();
-		ensure_equals("Issuer Name/commonName", 
-			   (std::string)llsd_cert["issuer_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
-		ensure_equals("Issure Name/countryName", (std::string)llsd_cert["issuer_name"]["countryName"], "BR");
-		ensure_equals("Issuer Name/localityName", (std::string)llsd_cert["issuer_name"]["localityName"], "Brasilia");
-		ensure_equals("Issuer Name/org name", (std::string)llsd_cert["issuer_name"]["organizationName"], "ICP-Brasil");
-		ensure_equals("IssuerName/org unit", 
-			   (std::string)llsd_cert["issuer_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
-		ensure_equals("IssuerName/state", (std::string)llsd_cert["issuer_name"]["stateOrProvinceName"], "DF");
-		ensure_equals("Issuer name string", 
-			   (std::string)llsd_cert["issuer_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
-															   "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
-		ensure_equals("subject Name/commonName", 
-			   (std::string)llsd_cert["subject_name"]["commonName"], "Autoridade Certificadora Raiz Brasileira");
-		ensure_equals("subject Name/countryName", (std::string)llsd_cert["subject_name"]["countryName"], "BR");
-		ensure_equals("subject Name/localityName", (std::string)llsd_cert["subject_name"]["localityName"], "Brasilia");
-		ensure_equals("subject Name/org name", (std::string)llsd_cert["subject_name"]["organizationName"], "ICP-Brasil");
-		ensure_equals("subjectName/org unit", 
-			   (std::string)llsd_cert["subject_name"]["organizationalUnitName"], "Instituto Nacional de Tecnologia da Informacao - ITI");
-		ensure_equals("subjectName/state", (std::string)llsd_cert["subject_name"]["stateOrProvinceName"], "DF");
-		ensure_equals("subject name string", 
-			   (std::string)llsd_cert["subject_name_string"], "CN=Autoridade Certificadora Raiz Brasileira,ST=DF,"
-			                                                    "L=Brasilia,OU=Instituto Nacional de Tecnologia da Informacao - ITI,O=ICP-Brasil,C=BR");
-		
-		ensure_equals("md5 digest", (std::string)llsd_cert["md5_digest"], "96:89:7d:61:d1:55:2b:27:e2:5a:39:b4:2a:6c:44:6f");
-		ensure_equals("serial number", (std::string)llsd_cert["serial_number"], "04");
-		// sha1 digest is giving a weird value, and I've no idea why...feh
-		//ensure_equals("sha1 digest", (std::string)llsd_cert["sha1_digest"], "8e:fd:ca:bc:93:e6:1e:92:5d:4d:1d:ed:18:1a:43:20:a4:67:a1:39");
-		ensure_equals("valid from", (std::string)llsd_cert["valid_from"], "2001-11-30T12:58:00Z");
-		ensure_equals("valid to", (std::string)llsd_cert["valid_to"], "2011-11-30T23:59:00Z");
-		LLSD expectedKeyUsage = LLSD::emptyArray();
-		expectedKeyUsage.append(LLSD((std::string)"certSigning"));
-		expectedKeyUsage.append(LLSD((std::string)"crlSigning"));
-		ensure("key usage", valueCompareLLSD(llsd_cert["keyUsage"], expectedKeyUsage));
-		ensure("basic constraints", (bool)llsd_cert["basicConstraints"]["CA"]);
-		
-		ensure("x509 is equal", !X509_cmp(mX509TestCert, test_cert->getOpenSSLX509()));
-	}
-
-	
-	// test protected data
-	template<> template<>
-	void sechandler_basic_test_object::test<2>()
-
-	{
-		unsigned char MACAddress[MAC_ADDRESS_BYTES];
-		LLUUID::getNodeID(MACAddress);
-		
-		std::string protected_data = "sUSh3wj77NG9oAMyt3XIhaej3KLZhLZWFZvI6rIGmwUUOmmelrRg0NI9rkOj8ZDpTPxpwToaBT5u"
-		"GQhakdaGLJznr9bHr4/6HIC1bouKj4n2rs4TL6j2WSjto114QdlNfLsE8cbbE+ghww58g8SeyLQO"
-		"nyzXoz+/PBz0HD5SMFDuObccoPW24gmqYySz8YoEWhSwO0pUtEEqOjVRsAJgF5wLAtJZDeuilGsq"
-		"4ZT9Y4wZ9Rh8nnF3fDUL6IGamHe1ClXM1jgBu10F6UMhZbnH4C3aJ2E9+LiOntU+l3iCb2MpkEpr"
-		"82r2ZAMwIrpnirL/xoYoyz7MJQYwUuMvBPToZJrxNSsjI+S2Z+I3iEJAELMAAA==";
-		
-		std::vector<U8> binary_data(apr_base64_decode_len(protected_data.c_str()));
-		apr_base64_decode_binary(&binary_data[0], protected_data.c_str());
-
-		LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
-		cipher.decrypt(&binary_data[0], 16);
-		LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
-		cipher2.encrypt(&binary_data[0], 16);
-		std::ofstream temp_file("sechandler_settings.tmp", std::ofstream::binary);
-		temp_file.write((const char *)&binary_data[0], binary_data.size());
-		temp_file.close();
-
-		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp",
-																		   "test_password.dat");
-		handler->init();																		
-		// data retrieval for existing data
-		LLSD data = handler->getProtectedData("test_data_type", "test_data_id");
-
-
-		ensure_equals("retrieve existing data1", (std::string)data["data1"], "test_data_1");
-		ensure_equals("retrieve existing data2", (std::string)data["data2"], "test_data_2");
-		ensure_equals("retrieve existing data3", (std::string)data["data3"]["elem1"], "test element1");
-		
-		// data storage
-		LLSD store_data = LLSD::emptyMap();
-		store_data["store_data1"] = "test_store_data1";
-		store_data["store_data2"] = 27;
-		store_data["store_data3"] = LLSD::emptyMap();
-		store_data["store_data3"]["subelem1"] = "test_subelem1";
-		
-		handler->setProtectedData("test_data_type", "test_data_id1", store_data);
-		data = handler->getProtectedData("test_data_type", "test_data_id");
-		
-		data = handler->getProtectedData("test_data_type", "test_data_id");
-		// verify no overwrite of existing data
-		ensure_equals("verify no overwrite 1", (std::string)data["data1"], "test_data_1");
-		ensure_equals("verify no overwrite 2", (std::string)data["data2"], "test_data_2");
-		ensure_equals("verify no overwrite 3", (std::string)data["data3"]["elem1"], "test element1");
-		
-		// verify written data is good
-		data = handler->getProtectedData("test_data_type", "test_data_id1");
-		ensure_equals("verify stored data1", (std::string)data["store_data1"], "test_store_data1");
-		ensure_equals("verify stored data2", (int)data["store_data2"], 27);
-		ensure_equals("verify stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
-		
-		// verify overwrite works
-		handler->setProtectedData("test_data_type", "test_data_id", store_data);	
-		data = handler->getProtectedData("test_data_type", "test_data_id");
-		ensure_equals("verify overwrite stored data1", (std::string)data["store_data1"], "test_store_data1");
-		ensure_equals("verify overwrite stored data2", (int)data["store_data2"], 27);
-		ensure_equals("verify overwrite stored data3", (std::string)data["store_data3"]["subelem1"], "test_subelem1");
-		
-		// verify other datatype doesn't conflict
-		store_data["store_data3"] = "test_store_data3";
-		store_data["store_data4"] = 28;
-		store_data["store_data5"] = LLSD::emptyMap();
-		store_data["store_data5"]["subelem2"] = "test_subelem2";
-		
-		handler->setProtectedData("test_data_type1", "test_data_id", store_data);	
-		data = handler->getProtectedData("test_data_type1", "test_data_id");
-		ensure_equals("verify datatype stored data3", (std::string)data["store_data3"], "test_store_data3");
-		ensure_equals("verify datatype stored data4", (int)data["store_data4"], 28);
-		ensure_equals("verify datatype stored data5", (std::string)data["store_data5"]["subelem2"], "test_subelem2");	
-		
-		// test data not found
-
-		data = handler->getProtectedData("test_data_type1", "test_data_not_found");
-		ensure("not found", data.isUndefined());
-
-		// cause a 'write' by using 'LLPointer' to delete then instantiate a handler
-		handler = NULL;
-		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler->init();
-
-		data = handler->getProtectedData("test_data_type1", "test_data_id");
-		ensure_equals("verify datatype stored data3a", (std::string)data["store_data3"], "test_store_data3");
-		ensure_equals("verify datatype stored data4a", (int)data["store_data4"], 28);
-		ensure_equals("verify datatype stored data5a", (std::string)data["store_data5"]["subelem2"], "test_subelem2");	
-		
-		// rewrite the initial file to verify reloads
-		handler = NULL;
-		std::ofstream temp_file2("sechandler_settings.tmp", std::ofstream::binary);
-		temp_file2.write((const char *)&binary_data[0], binary_data.size());
-		temp_file2.close();
-		
-		// cause a 'write'
-		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler->init();		
-		data = handler->getProtectedData("test_data_type1", "test_data_id");
-		ensure("not found", data.isUndefined());
-		
-		handler->deleteProtectedData("test_data_type", "test_data_id");
-		ensure("Deleted data not found", handler->getProtectedData("test_data_type", "test_data_id").isUndefined());
-		
-		LLFile::remove("sechandler_settings.tmp");
-		handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler->init();		
-		data = handler->getProtectedData("test_data_type1", "test_data_id");
-		ensure("not found", data.isUndefined());
-		handler = NULL;
-		
-		ensure(LLFile::isfile("sechandler_settings.tmp"));
-	}
-	
-	// test credenitals
-	template<> template<>
-	void sechandler_basic_test_object::test<3>()
-	{
-		LLPointer<LLSecAPIBasicHandler> handler = new LLSecAPIBasicHandler("sechandler_settings.tmp", "test_password.dat");
-		handler->init();
-
-		LLSD my_id = LLSD::emptyMap();
-		LLSD my_authenticator = LLSD::emptyMap();
-		my_id["type"] = "test_type";
-		my_id["username"] = "testuser@lindenlab.com";
-		my_authenticator["type"] = "test_auth";
-		my_authenticator["creds"] = "12345";
-
-		// test creation of credentials		
-		LLPointer<LLCredential> my_cred = handler->createCredential("my_grid", my_id, my_authenticator);
-
-		// test retrieval of credential components
-		ensure_equals("basic credential creation: identifier", my_id, my_cred->getIdentifier());
-		ensure_equals("basic credential creation: authenticator", my_authenticator, my_cred->getAuthenticator());
-		ensure_equals("basic credential creation: grid", "my_grid", my_cred->getGrid());
-		
-		// test setting/overwriting of credential components
-		my_id["first_name"] = "firstname";
-		my_id.erase("username");
-		my_authenticator.erase("creds");
-		my_authenticator["hash"] = "6563245";
-		
-		my_cred->setCredentialData(my_id, my_authenticator);
-		ensure_equals("set credential data: identifier", my_id, my_cred->getIdentifier());
-		ensure_equals("set credential data: authenticator", my_authenticator, my_cred->getAuthenticator());
-		ensure_equals("set credential data: grid", "my_grid", my_cred->getGrid());		
-			
-		// test loading of a credential, that hasn't been saved, without
-		// any legacy saved credential data
-		LLPointer<LLCredential> my_new_cred = handler->loadCredential("my_grid2");
-		ensure("unknown credential load test", my_new_cred->getIdentifier().isMap());
-		ensure("unknown credential load test", !my_new_cred->getIdentifier().has("type"));		
-		ensure("unknown credential load test", my_new_cred->getAuthenticator().isMap());
-		ensure("unknown credential load test", !my_new_cred->getAuthenticator().has("type"));	
-		// test saving of a credential
-		handler->saveCredential(my_cred, true);
-
-		// test loading of a known credential
-		my_new_cred = handler->loadCredential("my_grid");
-		ensure_equals("load a known credential: identifier", my_id, my_new_cred->getIdentifier());
-		ensure_equals("load a known credential: authenticator",my_authenticator, my_new_cred->getAuthenticator());
-		ensure_equals("load a known credential: grid", "my_grid", my_cred->getGrid());
-	
-		// test deletion of a credential
-		handler->deleteCredential(my_new_cred);
-
-		ensure("delete credential: identifier", my_new_cred->getIdentifier().isUndefined());
-		ensure("delete credentialt: authenticator", my_new_cred->getIdentifier().isUndefined());
-		ensure_equals("delete credential: grid", "my_grid", my_cred->getGrid());		
-		// load unknown cred
-		
-		my_new_cred = handler->loadCredential("my_grid");
-		ensure("deleted credential load test", my_new_cred->getIdentifier().isMap());
-		ensure("deleted credential load test", !my_new_cred->getIdentifier().has("type"));		
-		ensure("deleted credential load test", my_new_cred->getAuthenticator().isMap());
-		ensure("deleted credential load test", !my_new_cred->getAuthenticator().has("type"));
-		
-		// test loading of an unknown credential with legacy saved username, but without
-		// saved password
-		gFirstName = "myfirstname";
-		gLastName = "mylastname";
-		my_new_cred = handler->loadCredential("my_legacy_grid");
-		ensure_equals("legacy credential with no password: type", 
-					  (const std::string)my_new_cred->getIdentifier()["type"], "agent");
-		ensure_equals("legacy credential with no password: first_name", 
-					  (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
-		ensure_equals("legacy credential with no password: last_name",
-					  (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
-		
-		ensure("legacy credential with no password: no authenticator", my_new_cred->getAuthenticator().isUndefined());
-		
-		// test loading of an unknown credential with legacy saved password and username
-
-		std::string hashed_password = "fSQcLG03eyIWJmkzfyYaKm81dSweLmsxeSAYKGE7fSQ=";		
-		int length = apr_base64_decode_len(hashed_password.c_str());
-		std::vector<char> decoded_password(length);
-		apr_base64_decode(&decoded_password[0], hashed_password.c_str());
-		unsigned char MACAddress[MAC_ADDRESS_BYTES];
-		LLUUID::getNodeID(MACAddress);
-		LLXORCipher cipher(gMACAddress, MAC_ADDRESS_BYTES);
-		cipher.decrypt((U8*)&decoded_password[0], length);
-		LLXORCipher cipher2(MACAddress, MAC_ADDRESS_BYTES);
-		cipher2.encrypt((U8*)&decoded_password[0], length);
-		llofstream password_file("test_password.dat", std::ofstream::binary);
-		password_file.write(&decoded_password[0], length); 
-		password_file.close();
-		
-		my_new_cred = handler->loadCredential("my_legacy_grid2");		
-		ensure_equals("legacy credential with password: type", 
-					  (const std::string)my_new_cred->getIdentifier()["type"], "agent");
-		ensure_equals("legacy credential with password: first_name", 
-					  (const std::string)my_new_cred->getIdentifier()["first_name"], "myfirstname");
-		ensure_equals("legacy credential with password: last_name",
-					  (const std::string)my_new_cred->getIdentifier()["last_name"], "mylastname");
-		
-		LLSD legacy_authenticator = my_new_cred->getAuthenticator();
-		ensure_equals("legacy credential with password: type", 
-					  (std::string)legacy_authenticator["type"], 
-					  "hash");
-		ensure_equals("legacy credential with password: algorithm", 
-					  (std::string)legacy_authenticator["algorithm"], 
-					  "md5");	
-		ensure_equals("legacy credential with password: algorithm", 
-					  (std::string)legacy_authenticator["secret"], 
-					  "01234567890123456789012345678901");
-		
-		// test creation of credentials		
-		my_cred = handler->createCredential("mysavedgrid", my_id, my_authenticator);
-		// test save without saving authenticator. 		
-		handler->saveCredential(my_cred, FALSE);
-		my_new_cred = handler->loadCredential("mysavedgrid");	
-		ensure_equals("saved credential without auth", 
-					  (const std::string)my_new_cred->getIdentifier()["type"], "test_type");
-		ensure("no authenticator values were saved", my_new_cred->getAuthenticator().isUndefined());
-	}
-
-	// test cert vector
-	template<> template<>
-	void sechandler_basic_test_object::test<4>()
-	{
-		
-		// validate create from empty vector
-		LLPointer<LLBasicCertificateVector> test_vector = new LLBasicCertificateVector();
-		ensure_equals("when loading with nothing, we should result in no certs in vector", test_vector->size(), 0);
-		
-		test_vector->add(new LLBasicCertificate(mPemTestCert));
-		ensure_equals("one element in vector", test_vector->size(), 1);
-		test_vector->add(new LLBasicCertificate(mPemChildCert));
-		ensure_equals("two elements in vector after add", test_vector->size(), 2);
-		
-		test_vector->add(new LLBasicCertificate(mPemChildCert));
-		ensure_equals("two elements in vector after re-add", test_vector->size(), 2);
-		// validate order
-		X509* test_cert = (*test_vector)[0]->getOpenSSLX509();		
-		ensure("first cert added remains first cert", !X509_cmp(test_cert, mX509TestCert));
-		X509_free(test_cert);
-		
-		test_cert = (*test_vector)[1]->getOpenSSLX509();	
-		ensure("adding a duplicate cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);		
-		
-		//
-		// validate iterator
-		//
-		LLBasicCertificateVector::iterator current_cert = test_vector->begin();
-		LLBasicCertificateVector::iterator copy_current_cert = current_cert;
-		// operator++(int)
-		ensure("validate iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[0]);
-		ensure("validate 2nd iterator++ element in vector is expected cert", *current_cert++ == (*test_vector)[1]);
-		ensure("validate end iterator++", current_cert == test_vector->end());
-		
-		// copy 
-		ensure("validate copy iterator element in vector is expected cert", *copy_current_cert == (*test_vector)[0]);		
-		
-		// operator--(int)
-		current_cert--;
-		ensure("validate iterator-- element in vector is expected cert", *current_cert-- == (*test_vector)[1]);		
-		ensure("validate iterator-- element in vector is expected cert", *current_cert == (*test_vector)[0]);
-		
-		ensure("begin iterator is equal", current_cert == test_vector->begin());
-		
-		// operator++
-		ensure("validate ++iterator element in vector is expected cert", *++current_cert == (*test_vector)[1]);				
-		ensure("end of cert vector after ++iterator", ++current_cert == test_vector->end());
-		// operator--
-		ensure("validate --iterator element in vector is expected cert", *--current_cert == (*test_vector)[1]);		
-		ensure("validate 2nd --iterator element in vector is expected cert", *--current_cert == (*test_vector)[0]);		
-		
-		// validate remove
-		// validate create from empty vector
-		test_vector = new LLBasicCertificateVector();
-		test_vector->add(new LLBasicCertificate(mPemTestCert));
-		test_vector->add(new LLBasicCertificate(mPemChildCert));
-		test_vector->erase(test_vector->begin());
-		ensure_equals("one element in store after remove", test_vector->size(), 1);
-		test_cert = (*test_vector)[0]->getOpenSSLX509();
-		ensure("validate cert was removed", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		
-		// validate insert
-		test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemChildCert));
-		test_cert = (*test_vector)[0]->getOpenSSLX509();
-		
-		ensure("validate cert was inserted", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);	
-
-		//validate find
-		LLSD find_info = LLSD::emptyMap();
-		test_vector->insert(test_vector->begin(), new LLBasicCertificate(mPemRootCert));
-		find_info["issuer_name"] = LLSD::emptyMap();
-		find_info["issuer_name"]["commonName"] = "Roxies intermediate CA";
-		find_info["md5_digest"] = "97:24:c7:4c:d4:ba:2d:0e:9c:a1:18:8e:3a:c6:1f:c3";
-		current_cert = test_vector->find(find_info);
-		ensure("found", current_cert != test_vector->end());
-		ensure("found cert", (*current_cert).get() == (*test_vector)[1].get());
-		find_info["sha1_digest"] = "bad value";
-		current_cert =test_vector->find(find_info);
-		ensure("didn't find cert", current_cert == test_vector->end());		
-	}	
-	
-	// test cert store
-	template<> template<>
-	void sechandler_basic_test_object::test<5>()
-	{
-		// validate load with nothing
-		LLFile::remove("mycertstore.pem");
-		LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
-		ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
-		
-		// validate load with empty file
-		test_store->save();
-		test_store = NULL;
-		test_store = new LLBasicCertificateStore("mycertstore.pem");
-		ensure_equals("when loading with nothing, we should result in no certs in store", test_store->size(), 0);
-		test_store=NULL;
-		
-		// instantiate a cert store from a file
-		llofstream certstorefile("mycertstore.pem", std::ios::out);
-		certstorefile << mPemChildCert << std::endl << mPemTestCert << std::endl;
-		certstorefile.close();
-		// validate loaded certs
-		test_store = new LLBasicCertificateStore("mycertstore.pem");
-		ensure_equals("two elements in store", test_store->size(), 2);
-		
-		// operator[]
-		X509* test_cert = (*test_store)[0]->getOpenSSLX509();
-
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		test_cert = (*test_store)[1]->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));	
-		X509_free(test_cert);
-
-
-		// validate save
-		LLFile::remove("mycertstore.pem");
-		test_store->save();
-		test_store = NULL;
-		test_store = new LLBasicCertificateStore("mycertstore.pem");
-		ensure_equals("two elements in store after save", test_store->size(), 2);				
-		LLCertificateStore::iterator current_cert = test_store->begin();		
-		test_cert = (*current_cert)->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		current_cert++;
-		X509_free(test_cert);
-		test_cert = (*current_cert)->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509TestCert));	
-		X509_free(test_cert);
-		current_cert++;
-		ensure("end of cert store", current_cert == test_store->end());
-		
-	}
-	
-	// cert name wildcard matching
-	template<> template<>
-	void sechandler_basic_test_object::test<6>()
-	{
-		ensure("simple name match", 
-			   _cert_hostname_wildcard_match("foo", "foo"));
-		
-		ensure("simple name match, with end period", 
-			   _cert_hostname_wildcard_match("foo.", "foo."));
-		
-		ensure("simple name match, with begin period", 
-			   _cert_hostname_wildcard_match(".foo", ".foo"));		
-		
-		ensure("simple name match, with subdomain", 
-			   _cert_hostname_wildcard_match("foo.bar", "foo.bar"));	
-		
-		ensure("stutter name match", 
-			   _cert_hostname_wildcard_match("foobbbbfoo", "foo*bbbfoo"));			
-		
-		ensure("simple name match, with beginning wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "*bar"));	
-		
-		ensure("simple name match, with ending wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "foo*"));
-		
-		ensure("simple name match, with beginning null wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "*foobar"));			
-
-		ensure("simple name match, with ending null wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "foobar*"));
-		
-		ensure("simple name match, with embedded wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "f*r"));		
-		
-		ensure("simple name match, with embedded null wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "foo*bar"));
-
-		ensure("simple name match, with dual embedded wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "f*o*ar"));		
-
-		ensure("simple name mismatch", 
-			   !_cert_hostname_wildcard_match("bar", "foo"));
-		
-		ensure("simple name mismatch, with end period", 
-			   !_cert_hostname_wildcard_match("foobar.", "foo."));
-		
-		ensure("simple name mismatch, with begin period", 
-			   !_cert_hostname_wildcard_match(".foobar", ".foo"));		
-		
-		ensure("simple name mismatch, with subdomain", 
-			   !_cert_hostname_wildcard_match("foobar.bar", "foo.bar"));	
-		
-		ensure("simple name mismatch, with beginning wildcard", 
-			   !_cert_hostname_wildcard_match("foobara", "*bar"));	
-		
-		ensure("simple name mismatch, with ending wildcard", 
-			   !_cert_hostname_wildcard_match("oobar", "foo*"));
-		
-		ensure("simple name mismatch, with embedded wildcard", 
-			   !_cert_hostname_wildcard_match("oobar", "f*r"));		
-		
-		ensure("simple name mismatch, with dual embedded wildcard", 
-			   !_cert_hostname_wildcard_match("foobar", "f*d*ar"));
-		
-		ensure("simple wildcard", 
-			   _cert_hostname_wildcard_match("foobar", "*"));
-		
-		ensure("long domain", 
-			   _cert_hostname_wildcard_match("foo.bar.com", "foo.bar.com"));
-		
-		ensure("long domain with multiple wildcards", 
-			   _cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com"));	
-
-		ensure("end periods", 
-			   _cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com."));	
-		
-		ensure("mismatch end period", 
-			   !_cert_hostname_wildcard_match("foo.bar.com.", "*.b*r.com"));
-		
-		ensure("mismatch end period2", 
-			   !_cert_hostname_wildcard_match("foo.bar.com", "*.b*r.com."));				
-	}
-	
-	// test cert chain
-	template<> template<>
-	void sechandler_basic_test_object::test<7>()
-	{
-		// validate create from empty chain
-		LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
-		ensure_equals("when loading with nothing, we should result in no certs in chain", test_chain->size(), 0);
-
-		// Single cert in the chain.
-		X509_STORE_CTX *test_store = X509_STORE_CTX_new();
-		test_store->cert = mX509ChildCert;		
-		test_store->untrusted = NULL;
-		test_chain = new LLBasicCertificateChain(test_store);
-		X509_STORE_CTX_free(test_store);
-		ensure_equals("two elements in store", test_chain->size(), 1);		
-		X509* test_cert = (*test_chain)[0]->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);		
-		
-		// cert + CA
-		
-		test_store = X509_STORE_CTX_new();
-		test_store->cert = mX509ChildCert;
-		test_store->untrusted = sk_X509_new_null();
-		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
-		test_chain = new LLBasicCertificateChain(test_store);
-		X509_STORE_CTX_free(test_store);
-		ensure_equals("two elements in store", test_chain->size(), 2);	
-		test_cert = (*test_chain)[0]->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		test_cert = (*test_chain)[1]->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
-		X509_free(test_cert);
-
-		// cert + nonrelated
-		
-		test_store = X509_STORE_CTX_new();
-		test_store->cert = mX509ChildCert;
-		test_store->untrusted = sk_X509_new_null();
-		sk_X509_push(test_store->untrusted, mX509TestCert);
-		test_chain = new LLBasicCertificateChain(test_store);
-		X509_STORE_CTX_free(test_store);
-		ensure_equals("two elements in store", test_chain->size(), 1);	
-		test_cert = (*test_chain)[0]->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		
-		// cert + CA + nonrelated
-		test_store = X509_STORE_CTX_new();
-		test_store->cert = mX509ChildCert;
-		test_store->untrusted = sk_X509_new_null();
-		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
-		sk_X509_push(test_store->untrusted, mX509TestCert);
-		test_chain = new LLBasicCertificateChain(test_store);
-		X509_STORE_CTX_free(test_store);
-		ensure_equals("two elements in store", test_chain->size(), 2);	
-		test_cert = (*test_chain)[0]->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		test_cert = (*test_chain)[1]->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
-		X509_free(test_cert);
-
-		// cert + intermediate + CA 
-		test_store = X509_STORE_CTX_new();
-		test_store->cert = mX509ChildCert;
-		test_store->untrusted = sk_X509_new_null();
-		sk_X509_push(test_store->untrusted, mX509IntermediateCert);
-		sk_X509_push(test_store->untrusted, mX509RootCert);
-		test_chain = new LLBasicCertificateChain(test_store);
-		X509_STORE_CTX_free(test_store);
-		ensure_equals("three elements in store", test_chain->size(), 3);	
-		test_cert = (*test_chain)[0]->getOpenSSLX509();
-		ensure("validate first element in store is expected cert", !X509_cmp(test_cert, mX509ChildCert));
-		X509_free(test_cert);
-		test_cert = (*test_chain)[1]->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509IntermediateCert));	
-		X509_free(test_cert);
-
-		test_cert = (*test_chain)[2]->getOpenSSLX509();
-		ensure("validate second element in store is expected cert", !X509_cmp(test_cert, mX509RootCert));	
-		X509_free(test_cert);		
-	}
-	// test cert validation
-	template<> template<>
-	void sechandler_basic_test_object::test<8>()
-	{
-		// start with a trusted store with our known root cert
-		LLFile::remove("mycertstore.pem");
-		LLPointer<LLBasicCertificateStore> test_store = new LLBasicCertificateStore("mycertstore.pem");
-		test_store->add(new LLBasicCertificate(mX509RootCert));
-		LLSD validation_params;
-		
-		// validate basic trust for a chain containing only the intermediate cert.  (1 deep)
-		LLPointer<LLBasicCertificateChain> test_chain = new LLBasicCertificateChain(NULL);
-
-		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
-
-		test_chain->validate(0, test_store, validation_params);
-
-		// add the root certificate to the chain and revalidate
-		test_chain->add(new LLBasicCertificate(mX509RootCert));	
-		test_chain->validate(0, test_store, validation_params);
-
-		// add the child cert at the head of the chain, and revalidate (3 deep chain)
-		test_chain->insert(test_chain->begin(), new LLBasicCertificate(mX509ChildCert));
-		test_chain->validate(0, test_store, validation_params);
-
-		// basic failure cases
-		test_chain = new LLBasicCertificateChain(NULL);
-		//validate with only the child cert
-		test_chain->add(new LLBasicCertificate(mX509ChildCert));
-		ensure_throws("no CA, with only a child cert", 
-					  LLCertValidationTrustException, 
-					  (*test_chain)[0],
-					  test_chain->validate, 
-					  VALIDATION_POLICY_TRUSTED, 
-					  test_store, 
-					  validation_params);
-
-
-		// validate without the trust flag.
-		test_chain->validate(0, test_store, validation_params);		
-
-		// clear out the store
-		test_store = new LLBasicCertificateStore("mycertstore.pem");
-		// append the intermediate cert
-		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));		
-		ensure_throws("no CA, with child and intermediate certs", 
-					  LLCertValidationTrustException, 
-					  (*test_chain)[1],
-					  test_chain->validate, 
-					  VALIDATION_POLICY_TRUSTED, 
-					  test_store, 
-					  validation_params);
-		// validate without the trust flag
-		test_chain->validate(0, test_store, validation_params);
-
-		// Test time validity
-		LLSD child_info = (*test_chain)[0]->getLLSD();
-		validation_params = LLSD::emptyMap();
-		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() + 1.0);  
-		test_chain->validate(VALIDATION_POLICY_TIME, test_store, validation_params);
-
-		validation_params = LLSD::emptyMap();		
-		validation_params[CERT_VALIDATION_DATE] = child_info[CERT_VALID_FROM].asDate();
-		
-		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_FROM].asDate().secondsSinceEpoch() - 1.0);
- 		
-		// test not yet valid
-		ensure_throws("Child cert not yet valid", 
-					  LLCertValidationExpirationException, 
-					  (*test_chain)[0],
-					  test_chain->validate, 
-					  VALIDATION_POLICY_TIME, 
-					  test_store, 
-					  validation_params);	
-		validation_params = LLSD::emptyMap();		
-		validation_params[CERT_VALIDATION_DATE] = LLDate(child_info[CERT_VALID_TO].asDate().secondsSinceEpoch() + 1.0);
- 		
-		// test cert expired
-		ensure_throws("Child cert expired", 
-					  LLCertValidationExpirationException, 
-					  (*test_chain)[0],
-					  test_chain->validate, 
-					  VALIDATION_POLICY_TIME, 
-					  test_store, 
-					  validation_params);
-
-		// test SSL KU
-		// validate basic trust for a chain containing child and intermediate.
-		test_chain = new LLBasicCertificateChain(NULL);
-		test_chain->add(new LLBasicCertificate(mX509ChildCert));
-		test_chain->add(new LLBasicCertificate(mX509IntermediateCert));
-		test_chain->validate(VALIDATION_POLICY_SSL_KU, test_store, validation_params);	
-
-		test_chain = new LLBasicCertificateChain(NULL);
-		test_chain->add(new LLBasicCertificate(mX509TestCert));
-
-		ensure_throws("Cert doesn't have ku", 
-					  LLCertKeyUsageValidationException, 
-					  (*test_chain)[0],
-					  test_chain->validate, 
-					  VALIDATION_POLICY_SSL_KU, 
-					  test_store, 
-					  validation_params);
-	}
-};
-
diff --git a/indra/newview/tests/llslurl_test.cpp b/indra/newview/tests/llslurl_test.cpp
deleted file mode 100644
index 803020dc7a..0000000000
--- a/indra/newview/tests/llslurl_test.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/** 
- * @file llsecapi_test.cpp
- * @author Roxie
- * @date 2009-02-10
- * @brief Test the sec api functionality
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version maps.secondlife.com2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-#include "../llviewerprecompiledheaders.h"
-#include "../llviewernetwork.h"
-#include "../test/lltut.h"
-#include "../llslurl.h"
-#include "../../llxml/llcontrol.h"
-#include "llsdserialize.h"
-//----------------------------------------------------------------------------               
-// Mock objects for the dependencies of the code we're testing                               
-
-LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name) {}
-LLControlGroup::~LLControlGroup() {}
-BOOL LLControlGroup::declareString(const std::string& name,
-                                   const std::string& initial_val,
-                                   const std::string& comment,
-                                   BOOL persist) {return TRUE;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-
-std::string gCmdLineLoginURI;
-std::string gCmdLineGridChoice;
-std::string gCmdLineHelperURI;
-std::string gLoginPage;
-std::string gCurrentGrid;
-std::string LLControlGroup::getString(const std::string& name)
-{
-	if (name == "CmdLineGridChoice")
-		return gCmdLineGridChoice;
-	else if (name == "CmdLineHelperURI")
-		return gCmdLineHelperURI;
-	else if (name == "LoginPage")
-		return gLoginPage;
-	else if (name == "CurrentGrid")
-		return gCurrentGrid;
-	return "";
-}
-
-LLSD LLControlGroup::getLLSD(const std::string& name)
-{
-	if (name == "CmdLineLoginURI")
-	{
-		if(!gCmdLineLoginURI.empty())
-		{
-			return LLSD(gCmdLineLoginURI);
-		}
-	}
-	return LLSD();
-}
-
-
-LLControlGroup gSavedSettings("test");
-
-// -------------------------------------------------------------------------------------------
-// TUT
-// -------------------------------------------------------------------------------------------
-namespace tut
-{
-	// Test wrapper declaration : wrapping nothing for the moment
-	struct slurlTest
-	{
-		slurlTest()
-		{	
-			LLGridManager::getInstance()->initialize(std::string(""));
-		}
-		~slurlTest()
-		{
-		}
-	};
-	
-	// Tut templating thingamagic: test group, object and test instance
-	typedef test_group<slurlTest> slurlTestFactory;
-	typedef slurlTestFactory::object slurlTestObject;
-	tut::slurlTestFactory tut_test("llslurl");
-	
-	// ---------------------------------------------------------------------------------------
-	// Test functions 
-	// ---------------------------------------------------------------------------------------
-	// construction from slurl string
-	template<> template<>
-	void slurlTestObject::test<1>()
-	{
-		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
-		
-		LLSLURL slurl = LLSLURL("");
-		ensure_equals("null slurl", (int)slurl.getType(), LLSLURL::LAST_LOCATION);
-		
-		slurl = LLSLURL("http://slurl.com/secondlife/myregion");
-		ensure_equals("slurl.com slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("slurl.com slurl, region only", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-		
-		slurl = LLSLURL("http://maps.secondlife.com/secondlife/myregion/1/2/3");
-		ensure_equals("maps.secondlife.com slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("maps.secondlife.com slurl, region + coords", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");
-
-		slurl = LLSLURL("secondlife://myregion");
-		ensure_equals("secondlife: slurl, region only - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("secondlife: slurl, region only", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-		
-		slurl = LLSLURL("secondlife://myregion/1/2/3");
-		ensure_equals("secondlife: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("secondlife slurl, region + coords", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");
-		
-		slurl = LLSLURL("/myregion");
-		ensure_equals("/region slurl, region- type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("/region slurl, region ", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/128/128/0");
-		
-		slurl = LLSLURL("/myregion/1/2/3");
-		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/myregion/1/2/3");	
-		
-		slurl = LLSLURL("my region/1/2/3");
-		ensure_equals(" slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/my%20region/1/2/3");	
-		
-		slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
-		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
-					  "https://my.grid.com/region/my%20region/1/2/3");	
-		
-		slurl = LLSLURL("https://my.grid.com/region/my region");
-		ensure_equals("grid slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("grid slurl, region + coords", slurl.getSLURLString(), 
-					  "https://my.grid.com/region/my%20region/128/128/0");
-		
-		LLGridManager::getInstance()->setGridChoice("foo.bar.com");		
-		slurl = LLSLURL("/myregion/1/2/3");
-		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("/ slurl, region + coords", slurl.getSLURLString(), 
-					  "https://foo.bar.com/region/myregion/1/2/3");		
-		
-		slurl = LLSLURL("myregion/1/2/3");
-		ensure_equals(": slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals(" slurl, region + coords", slurl.getSLURLString(), 
-					  "https://foo.bar.com/region/myregion/1/2/3");		
-		
-		slurl = LLSLURL(LLSLURL::SIM_LOCATION_HOME);
-		ensure_equals("home", slurl.getType(), LLSLURL::HOME_LOCATION);
-
-		slurl = LLSLURL(LLSLURL::SIM_LOCATION_LAST);
-		ensure_equals("last", slurl.getType(), LLSLURL::LAST_LOCATION);
-		
-		slurl = LLSLURL("secondlife:///app/foo/bar?12345");
-		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
-		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
-		ensure_equals("apppath", slurl.getAppPath().size(), 1);
-		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
-		ensure_equals("appquery", slurl.getAppQuery(), "12345");
-		ensure_equals("grid1", "foo.bar.com", slurl.getGrid());
-	
-		slurl = LLSLURL("secondlife://Aditi/app/foo/bar?12345");
-		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
-		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
-		ensure_equals("apppath", slurl.getAppPath().size(), 1);
-		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
-		ensure_equals("appquery", slurl.getAppQuery(), "12345");
-		ensure_equals("grid2", "util.aditi.lindenlab.com", slurl.getGrid());		
-
-		LLGridManager::getInstance()->setGridChoice("foo.bar.com");			
-		slurl = LLSLURL("secondlife:///secondlife/myregion/1/2/3");
-		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("region" , "myregion", slurl.getRegion());
-		ensure_equals("grid3", "util.agni.lindenlab.com", slurl.getGrid());
-				
-		slurl = LLSLURL("secondlife://Aditi/secondlife/myregion/1/2/3");
-		ensure_equals("/: slurl, region + coords - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("location", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("region" , "myregion", slurl.getRegion());
-		ensure_equals("grid4", "util.aditi.lindenlab.com", slurl.getGrid());		
-		
-		slurl = LLSLURL("https://my.grid.com/app/foo/bar?12345");
-		ensure_equals("app", slurl.getType(), LLSLURL::APP);		
-		ensure_equals("appcmd", slurl.getAppCmd(), "foo");
-		ensure_equals("apppath", slurl.getAppPath().size(), 1);
-		ensure_equals("apppath2", slurl.getAppPath()[0].asString(), "bar");
-		ensure_equals("appquery", slurl.getAppQuery(), "12345");	
-		
-	}
-	
-	// construction from grid/region/vector combos
-	template<> template<>
-	void slurlTestObject::test<2>()
-	{
-		LLSLURL slurl = LLSLURL("mygrid.com", "my region");
-		ensure_equals("grid/region - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals("grid/region", slurl.getSLURLString(), 
-					  "https://mygrid.com/region/my%20region/128/128/0");	
-		
-		slurl = LLSLURL("mygrid.com", "my region", LLVector3(1,2,3));
-		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
-					  "https://mygrid.com/region/my%20region/1/2/3");			
-
-		LLGridManager::getInstance()->setGridChoice("foo.bar.com.bar");			
-		slurl = LLSLURL("my region", LLVector3(1,2,3));
-		ensure_equals("grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals(" grid/region/vector", slurl.getSLURLString(), 
-					  "https://foo.bar.com.bar/region/my%20region/1/2/3");	
-		
-		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");	
-		slurl = LLSLURL("my region", LLVector3(1,2,3));
-		ensure_equals("default grid/region/vector - type", slurl.getType(), LLSLURL::LOCATION);
-		ensure_equals(" default grid/region/vector", slurl.getSLURLString(), 
-					  "http://maps.secondlife.com/secondlife/my%20region/1/2/3");	
-		
-	}
-	// Accessors
-	template<> template<>
-	void slurlTestObject::test<3>()
-	{
-		LLSLURL slurl = LLSLURL("https://my.grid.com/region/my%20region/1/2/3");
-		ensure_equals("login string", slurl.getLoginString(), "uri:my region&amp;1&amp;2&amp;3");
-		ensure_equals("location string", slurl.getLocationString(), "my region/1/2/3");
-		ensure_equals("grid", slurl.getGrid(), "my.grid.com");
-		ensure_equals("region", slurl.getRegion(), "my region");
-		ensure_equals("position", slurl.getPosition(), LLVector3(1, 2, 3));
-		
-	}
-}
diff --git a/indra/newview/tests/llviewernetwork_test.cpp b/indra/newview/tests/llviewernetwork_test.cpp
deleted file mode 100644
index f9f42cfc86..0000000000
--- a/indra/newview/tests/llviewernetwork_test.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/** 
- * @file llviewernetwork_test.cpp
- * @author Roxie
- * @date 2009-03-9
- * @brief Test the viewernetwork functionality
- *
- * $LicenseInfo:firstyear=2009&license=viewergpl$
- * 
- * Copyright (c) 2009, Linden Research, Inc.
- * 
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden LregisterSecAPIab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab.  Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- * 
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
-#include "../llviewerprecompiledheaders.h"
-#include "../llviewernetwork.h"
-#include "../test/lltut.h"
-#include "../../llxml/llcontrol.h"
-#include "llfile.h"
-
-//----------------------------------------------------------------------------               
-// Mock objects for the dependencies of the code we're testing                               
-
-LLControlGroup::LLControlGroup(const std::string& name)
-: LLInstanceTracker<LLControlGroup, std::string>(name) {}
-LLControlGroup::~LLControlGroup() {}
-BOOL LLControlGroup::declareString(const std::string& name,
-                                   const std::string& initial_val,
-                                   const std::string& comment,
-                                   BOOL persist) {return TRUE;}
-void LLControlGroup::setString(const std::string& name, const std::string& val){}
-
-std::string gCmdLineLoginURI;
-std::string gCmdLineGridChoice;
-std::string gCmdLineHelperURI;
-std::string gLoginPage;
-std::string gCurrentGrid;
-std::string LLControlGroup::getString(const std::string& name)
-{
-	if (name == "CmdLineGridChoice")
-		return gCmdLineGridChoice;
-	else if (name == "CmdLineHelperURI")
-		return gCmdLineHelperURI;
-	else if (name == "LoginPage")
-		return gLoginPage;
-	else if (name == "CurrentGrid")
-		return gCurrentGrid;
-	return "";
-}
-
-LLSD LLControlGroup::getLLSD(const std::string& name)
-{
-	if (name == "CmdLineLoginURI")
-	{
-		if(!gCmdLineLoginURI.empty())
-		{
-			return LLSD(gCmdLineLoginURI);
-		}
-	}
-	return LLSD();
-}
-
-
-LLControlGroup gSavedSettings("test");
-
-const char *gSampleGridFile = "<llsd><map>"
-"<key>grid1</key><map>"
-"  <key>favorite</key><integer>1</integer>"
-"  <key>helper_uri</key><string>https://helper1/helpers/</string>"
-"  <key>label</key><string>mylabel</string>"
-"  <key>login_page</key><string>loginpage</string>"
-"  <key>login_uri</key><array><string>myloginuri</string></array>"
-"  <key>name</key><string>grid1</string>"
-"  <key>visible</key><integer>1</integer>"
-"  <key>credential_type</key><string>agent</string>"
-"  <key>grid_login_id</key><string>MyGrid</string>"
-"</map>"
-"<key>util.agni.lindenlab.com</key><map>"
-"  <key>favorite</key><integer>1</integer>"
-"  <key>helper_uri</key><string>https://helper1/helpers/</string>"
-"  <key>label</key><string>mylabel</string>"
-"  <key>login_page</key><string>loginpage</string>"
-"  <key>login_uri</key><array><string>myloginuri</string></array>"
-"  <key>name</key><string>util.agni.lindenlab.com</string>"
-"</map></map></llsd>";
-// -------------------------------------------------------------------------------------------
-// TUT
-// -------------------------------------------------------------------------------------------
-namespace tut
-{
-  // Test wrapper declaration : wrapping nothing for the moment
-  struct viewerNetworkTest
-	{
-		viewerNetworkTest()
-		{
-			LLFile::remove("grid_test.xml");
-			gCmdLineLoginURI.clear();
-			gCmdLineGridChoice.clear();
-			gCmdLineHelperURI.clear();
-			gLoginPage.clear();
-			gCurrentGrid.clear();			
-		}
-		~viewerNetworkTest()
-		{
-			LLFile::remove("grid_test.xml");
-		}
-	};
-	
-	// Tut templating thingamagic: test group, object and test instance
-	typedef test_group<viewerNetworkTest> viewerNetworkTestFactory;
-	typedef viewerNetworkTestFactory::object viewerNetworkTestObject;
-	tut::viewerNetworkTestFactory tut_test("llviewernetwork");
-	
-	// ---------------------------------------------------------------------------------------
-	// Test functions 
-	// ---------------------------------------------------------------------------------------
-	// initialization without a grid file
-	template<> template<>
-	void viewerNetworkTestObject::test<1>()
-	{
-
-		LLGridManager *manager = LLGridManager::getInstance();
-		// grid file doesn't exist
-		manager->initialize("grid_test.xml");
-		// validate that some of the defaults are available.
-		std::map<std::string, std::string> known_grids = manager->getKnownGrids();
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("Known grids is a string-string map of size 18", known_grids.size(), 18);
-		ensure_equals("Agni has the right name and label", 
-					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Agni"));
-#else // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("Known grids is a string-string map of size 2", known_grids.size(), 2);
-		ensure_equals("Agni has the right name and label", 
-					  known_grids[std::string("util.agni.lindenlab.com")], std::string("Secondlife.com"));		
-#endif // LL_RELEASE_FOR_DOWNLOAD
-
-
-		ensure_equals("None exists", known_grids[""], "None");
-		
-		LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
-		ensure("Grid info for agni is a map", grid.isMap());
-		ensure_equals("name is correct for agni", 
-					  grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
-#ifndef LL_RELEASE_FOR_DOWNLOAD		
-		ensure_equals("label is correct for agni", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
-#else // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("label is correct for agni", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));		
-#endif // LL_RELEASE_FOR_DOWNLOAD
-		ensure("Login URI is an array", 
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("Agni login uri is correct", 
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
-					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
-		ensure_equals("Agni helper uri is correct",
-					  grid[GRID_HELPER_URI_VALUE].asString(), 
-					  std::string("https://secondlife.com/helpers/"));
-		ensure_equals("Agni login page is correct",
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
-					  std::string("http://secondlife.com/app/login/"));
-		ensure("Agni is a favorite",
-			   grid.has(GRID_IS_FAVORITE_VALUE));
-		ensure("Agni is a system grid", 
-			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
-		ensure("Grid file wasn't greated as it wasn't saved", 
-			   !LLFile::isfile("grid_test.xml"));
-	}
-	
-	// initialization with a grid file
-	template<> template<>
-	void viewerNetworkTestObject::test<2>()
-	{
-		llofstream gridfile("grid_test.xml");
-		gridfile << gSampleGridFile;
-		gridfile.close();
-		
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("adding a grid via a grid file increases known grid size", 
-					  known_grids.size(), 19);
-		ensure_equals("Agni is still there after we've added a grid via a grid file", 
-					  known_grids["util.agni.lindenlab.com"], std::string("Agni"));
-	
-#else
-		ensure_equals("adding a grid via a grid file increases known grid size", 
-					  known_grids.size(), 3);
-		ensure_equals("Agni is still there after we've added a grid via a grid file", 
-					  known_grids["util.agni.lindenlab.com"], std::string("Secondlife.com"));
-
-#endif
-	
-		
-		// assure Agni doesn't get overwritten
-		LLSD grid = LLGridManager::getInstance()->getGridInfo("util.agni.lindenlab.com");
-#ifndef LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("Agni grid label was not modified by grid file", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("Agni"));
-#else \\ LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("Agni grid label was not modified by grid file", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("Secondlife.com"));
-#endif \\ LL_RELEASE_FOR_DOWNLOAD
-		
-		ensure_equals("Agni name wasn't modified by grid file",
-					  grid[GRID_VALUE].asString(), std::string("util.agni.lindenlab.com"));
-		ensure("Agni grid URI is still an array after grid file", 
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("Agni login uri still the same after grid file", 
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(),  
-					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
-		ensure_equals("Agni helper uri still the same after grid file", 
-					  grid[GRID_HELPER_URI_VALUE].asString(), 
-					  std::string("https://secondlife.com/helpers/"));
-		ensure_equals("Agni login page the same after grid file", 
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
-					  std::string("http://secondlife.com/app/login/"));
-		ensure("Agni still a favorite after grid file", 
-			   grid.has(GRID_IS_FAVORITE_VALUE));
-		ensure("Agni system grid still set after grid file", 
-			   grid.has(GRID_IS_SYSTEM_GRID_VALUE));
-		
-		ensure_equals("Grid file adds to name<->label map", 
-					  known_grids["grid1"], std::string("mylabel"));
-		grid = LLGridManager::getInstance()->getGridInfo("grid1");
-		ensure_equals("grid file grid name is set",
-					  grid[GRID_VALUE].asString(), std::string("grid1"));
-		ensure_equals("grid file label is set", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("mylabel"));
-		ensure("grid file login uri is an array",
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("grid file login uri is set",
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
-					  std::string("myloginuri"));
-		ensure_equals("grid file helper uri is set",
-					  grid[GRID_HELPER_URI_VALUE].asString(), 
-					  std::string("https://helper1/helpers/"));
-		ensure_equals("grid file login page is set",
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
-					  std::string("loginpage"));
-		ensure("grid file favorite is set",
-			   grid.has(GRID_IS_FAVORITE_VALUE));
-		ensure("grid file isn't a system grid",
-			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));		
-		ensure("Grid file still exists after loading", 
-			   LLFile::isfile("grid_test.xml"));
-	}
-	
-	// Initialize via command line
-	
-	template<> template<>
-	void viewerNetworkTestObject::test<3>()
-	{	
-		gCmdLineLoginURI = "https://my.login.uri/cgi-bin/login.cgi";
-		
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		// with single login uri specified.
-		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure_equals("adding a command line grid increases known grid size", 
-					  known_grids.size(), 19);
-		ensure_equals("Command line grid is added to the list of grids", 
-					  known_grids["my.login.uri"], std::string("my.login.uri"));
-		LLSD grid = LLGridManager::getInstance()->getGridInfo("my.login.uri");
-		ensure_equals("Command line grid name is set",
-					  grid[GRID_VALUE].asString(), std::string("my.login.uri"));
-		ensure_equals("Command line grid label is set", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("my.login.uri"));
-		ensure("Command line grid login uri is an array",
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("Command line grid login uri is set",
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
-					  std::string("https://my.login.uri/cgi-bin/login.cgi"));
-		ensure_equals("Command line grid helper uri is set",
-					  grid[GRID_HELPER_URI_VALUE].asString(), 
-					  std::string("https://my.login.uri/helpers/"));
-		ensure_equals("Command line grid login page is set",
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(), 
-					  std::string("http://my.login.uri/app/login/"));
-		ensure("Command line grid favorite is set",
-			   !grid.has(GRID_IS_FAVORITE_VALUE));
-		ensure("Command line grid isn't a system grid",
-			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));		
-		
-		// now try a command line with a custom grid identifier
-		gCmdLineGridChoice = "mycustomgridchoice";		
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure_equals("adding a command line grid with custom name increases known grid size", 
-					  known_grids.size(), 19);
-		ensure_equals("Custom Command line grid is added to the list of grids", 
-					  known_grids["mycustomgridchoice"], std::string("mycustomgridchoice"));
-		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");
-		ensure_equals("Custom Command line grid name is set",
-					  grid[GRID_VALUE].asString(), std::string("mycustomgridchoice"));
-		ensure_equals("Custom Command line grid label is set", 
-					  grid[GRID_LABEL_VALUE].asString(), std::string("mycustomgridchoice"));		
-		ensure("Custom Command line grid login uri is an array",
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("Custom Command line grid login uri is set",
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(), 
-					  std::string("https://my.login.uri/cgi-bin/login.cgi"));
-		
-		// add a helperuri
-		gCmdLineHelperURI = "myhelperuri";
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");		
-		ensure_equals("Validate command line helper uri", 
-					  grid[GRID_HELPER_URI_VALUE].asString(), std::string("myhelperuri"));		
-		
-		// add a login page
-		gLoginPage = "myloginpage";
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		grid = LLGridManager::getInstance()->getGridInfo("mycustomgridchoice");		
-		ensure_equals("Validate command line helper uri", 
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(), std::string("myloginpage"));			
-	}
-	
-	// validate grid selection
-	template<> template<>
-	void viewerNetworkTestObject::test<4>()
-	{	
-		LLSD loginURI = LLSD::emptyArray();
-		LLSD grid = LLSD::emptyMap();
-		// adding a grid with simply a name will populate the values.
-		grid[GRID_VALUE] = "myaddedgrid";
-
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		LLGridManager::getInstance()->addGrid(grid);
-		LLGridManager::getInstance()->setGridChoice("util.agni.lindenlab.com");
-#ifndef LL_RELEASE_FOR_DOWNLOAD		
-		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Agni"));
-#else // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("Secondlife.com"));		
-#endif // LL_RELEASE_FOR_DOWNLOAD
-		ensure_equals("getGrid", LLGridManager::getInstance()->getGrid(), 
-					  std::string("util.agni.lindenlab.com"));
-		ensure_equals("getHelperURI", LLGridManager::getInstance()->getHelperURI(), 
-					  std::string("https://secondlife.com/helpers/"));
-		ensure_equals("getLoginPage", LLGridManager::getInstance()->getLoginPage(), 
-					  std::string("http://secondlife.com/app/login/"));
-		ensure_equals("getLoginPage2", LLGridManager::getInstance()->getLoginPage("util.agni.lindenlab.com"), 
-					  std::string("http://secondlife.com/app/login/"));
-		ensure("Is Agni a production grid", LLGridManager::getInstance()->isInProductionGrid());		
-		std::vector<std::string> uris;
-		LLGridManager::getInstance()->getLoginURIs(uris);
-		ensure_equals("getLoginURIs size", uris.size(), 1);
-		ensure_equals("getLoginURIs", uris[0], 
-					  std::string("https://login.agni.lindenlab.com/cgi-bin/login.cgi"));
-		LLGridManager::getInstance()->setGridChoice("myaddedgrid");
-		ensure_equals("getGridLabel", LLGridManager::getInstance()->getGridLabel(), std::string("myaddedgrid"));		
-		ensure("Is myaddedgrid a production grid", !LLGridManager::getInstance()->isInProductionGrid());
-		
-		LLGridManager::getInstance()->setFavorite();
-		grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
-		ensure("setting favorite", grid.has(GRID_IS_FAVORITE_VALUE));
-	}
-	
-	// name based grid population
-	template<> template<>
-	void viewerNetworkTestObject::test<5>()
-	{
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		LLSD grid = LLSD::emptyMap();
-		// adding a grid with simply a name will populate the values.
-		grid[GRID_VALUE] = "myaddedgrid";
-		LLGridManager::getInstance()->addGrid(grid);
-		grid = LLGridManager::getInstance()->getGridInfo("myaddedgrid");
-		
-		ensure_equals("name based grid has name value", 
-					  grid[GRID_VALUE].asString(),
-					  std::string("myaddedgrid"));
-		ensure_equals("name based grid has label value", 
-					  grid[GRID_LABEL_VALUE].asString(),
-					  std::string("myaddedgrid"));
-		ensure_equals("name based grid has name value", 
-					  grid[GRID_HELPER_URI_VALUE].asString(),
-					  std::string("https://myaddedgrid/helpers/"));
-		ensure_equals("name based grid has name value", 
-					  grid[GRID_LOGIN_PAGE_VALUE].asString(),
-					  std::string("http://myaddedgrid/app/login/"));
-		ensure("name based grid has array loginuri", 
-			   grid[GRID_LOGIN_URI_VALUE].isArray());
-		ensure_equals("name based grid has single login uri value",
-			   grid[GRID_LOGIN_URI_VALUE].size(), 1);
-		ensure_equals("Name based grid login uri is correct",
-					  grid[GRID_LOGIN_URI_VALUE][0].asString(),
-					  std::string("https://myaddedgrid/cgi-bin/login.cgi"));
-		ensure("name based grid is not a favorite yet", 
-			   !grid.has(GRID_IS_FAVORITE_VALUE));
-		ensure("name based grid does not have system setting",
-			   !grid.has(GRID_IS_SYSTEM_GRID_VALUE));
-		
-		llofstream gridfile("grid_test.xml");
-		gridfile << gSampleGridFile;
-		gridfile.close();
-	}
-	
-	// persistence of the grid list with an empty gridfile.
-	template<> template<>
-	void viewerNetworkTestObject::test<6>()
-	{
-		// try with initial grid list without a grid file,
-		// without setting the grid to a saveable favorite.
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		LLSD grid = LLSD::emptyMap();
-		grid[GRID_VALUE] = std::string("mynewgridname");
-		LLGridManager::getInstance()->addGrid(grid);
-		LLGridManager::getInstance()->saveFavorites();
-		ensure("Grid file exists after saving", 
-			   LLFile::isfile("grid_test.xml"));
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		// should not be there
-		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure("New grid wasn't added to persisted list without being marked a favorite",
-					  known_grids.find(std::string("mynewgridname")) == known_grids.end());
-		
-		// mark a grid a favorite to make sure it's persisted
-		LLGridManager::getInstance()->addGrid(grid);
-		LLGridManager::getInstance()->setGridChoice("mynewgridname");
-		LLGridManager::getInstance()->setFavorite();
-		LLGridManager::getInstance()->saveFavorites();
-		ensure("Grid file exists after saving", 
-			   LLFile::isfile("grid_test.xml"));
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		// should not be there
-		known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure("New grid wasn't added to persisted list after being marked a favorite",
-					  known_grids.find(std::string("mynewgridname")) !=
-					  known_grids.end());
-	}
-	
-	// persistence of the grid file with existing gridfile
-	template<> template<>
-	void viewerNetworkTestObject::test<7>()
-	{
-		
-		llofstream gridfile("grid_test.xml");
-		gridfile << gSampleGridFile;
-		gridfile.close();
-		
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		LLSD grid = LLSD::emptyMap();
-		grid[GRID_VALUE] = std::string("mynewgridname");
-		LLGridManager::getInstance()->addGrid(grid);
-		LLGridManager::getInstance()->saveFavorites();
-		// validate we didn't lose existing favorites
-		LLGridManager::getInstance()->initialize("grid_test.xml");
-		std::map<std::string, std::string> known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure("New grid wasn't added to persisted list after being marked a favorite",
-			   known_grids.find(std::string("grid1")) !=
-			   known_grids.end());
-		
-		// add a grid
-		LLGridManager::getInstance()->addGrid(grid);
-		LLGridManager::getInstance()->setGridChoice("mynewgridname");
-		LLGridManager::getInstance()->setFavorite();
-		LLGridManager::getInstance()->saveFavorites();
-		known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure("New grid wasn't added to persisted list after being marked a favorite",
-			   known_grids.find(std::string("grid1")) !=
-			   known_grids.end());
-		known_grids = LLGridManager::getInstance()->getKnownGrids();
-		ensure("New grid wasn't added to persisted list after being marked a favorite",
-			   known_grids.find(std::string("mynewgridname")) !=
-			   known_grids.end());
-	}
-}
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 659da31007..18ac10fe38 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -397,15 +397,6 @@ class WindowsManifest(ViewerManifest):
 
         self.disable_manifest_check()
 
-        # Diamondware Runtimes
-        if self.prefix(src="diamondware-runtime/i686-win32", dst=""):
-            self.path("SLVoice_dwTVC.exe")
-            self.path("libcurl.dll")
-            self.path("libeay32.dll")
-            self.path("ssleay32.dll")
-            self.path("zlib1.dll")
-            self.end_prefix()
-
         # pull in the crash logger and updater from other projects
         # tag:"crash-logger" here as a cue to the exporter
         self.path(src='../win_crash_logger/%s/windows-crash-logger.exe' % self.args['configuration'],
@@ -615,9 +606,6 @@ class DarwinManifest(ViewerManifest):
                 self.path("vivox-runtime/universal-darwin/libvivoxsdk.dylib", "libvivoxsdk.dylib")
                 self.path("vivox-runtime/universal-darwin/libvivoxplatform.dylib", "libvivoxplatform.dylib")
                 self.path("vivox-runtime/universal-darwin/SLVoice", "SLVoice")
-                # DiamondWare runtime                                           
-                self.path("diamondware-runtime/universal-darwin/SLVoice_dwTVC","SLVoice_dwTVC")
-                self.path("diamondware-runtime/universal-darwin/libfmodex.dylib", "libfmodex.dylib")
 
                 libdir = "../../libraries/universal-darwin/lib_release"
                 dylibs = {}
@@ -913,11 +901,6 @@ class Linux_i686Manifest(LinuxManifest):
                     pass
             self.end_prefix("lib")
 
-            # Diamondware runtimes
-            if self.prefix(src="diamondware-runtime/i686-linux", dst="bin"):
-                    self.path("SLVoice_dwTVC")
-                    self.end_prefix()
-
             # Vivox runtimes
             if self.prefix(src="vivox-runtime/i686-linux", dst="bin"):
                     self.path("SLVoice")
diff --git a/indra/viewer_components/login/lllogin.cpp b/indra/viewer_components/login/lllogin.cpp
index e1922367bf..b9f61ca7e1 100644
--- a/indra/viewer_components/login/lllogin.cpp
+++ b/indra/viewer_components/login/lllogin.cpp
@@ -122,35 +122,29 @@ private:
 	LLSD mAuthResponse, mValidAuthResponse;
 };
 
-void LLLogin::Impl::connect(const std::string& uri, const LLSD& login_params)
+void LLLogin::Impl::connect(const std::string& uri, const LLSD& credentials)
 {
-    LL_DEBUGS("LLLogin") << " connect with  uri '" << uri << "', login_params " << login_params << LL_ENDL;
-	
     // Launch a coroutine with our login_() method. Run the coroutine until
     // its first wait; at that point, return here.
     std::string coroname = 
         LLCoros::instance().launch("LLLogin::Impl::login_",
-                                   boost::bind(&Impl::login_, this, _1, uri, login_params));
-    LL_DEBUGS("LLLogin") << " connected with  uri '" << uri << "', login_params " << login_params << LL_ENDL;	
+                                   boost::bind(&Impl::login_, this, _1, uri, credentials));
 }
 
-void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_params)
+void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD credentials)
 {
-	try
+	LLSD printable_credentials = credentials;
+	if(printable_credentials.has("params") 
+		&& printable_credentials["params"].has("passwd")) 
 	{
-	LLSD printable_params = login_params;
-	//if(printable_params.has("params") 
-	//	&& printable_params["params"].has("passwd")) 
-	//{
-	//	printable_params["params"]["passwd"] = "*******";
-	//}
+		printable_credentials["params"]["passwd"] = "*******";
+	}
     LL_DEBUGS("LLLogin") << "Entering coroutine " << LLCoros::instance().getName(self)
-                        << " with uri '" << uri << "', parameters " << printable_params << LL_ENDL;
+                        << " with uri '" << uri << "', credentials " << printable_credentials << LL_ENDL;
 
 	// Arriving in SRVRequest state
     LLEventStream replyPump("SRVreply", true);
     // Should be an array of one or more uri strings.
-
     LLSD rewrittenURIs;
     {
         LLEventTimeout filter(replyPump);
@@ -161,9 +155,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 
         // *NOTE:Mani - Completely arbitrary default timeout value for SRV request.
 		F32 seconds_to_timeout = 5.0f;
-		if(login_params.has("cfg_srv_timeout"))
+		if(credentials.has("cfg_srv_timeout"))
 		{
-			seconds_to_timeout = login_params["cfg_srv_timeout"].asReal();
+			seconds_to_timeout = credentials["cfg_srv_timeout"].asReal();
 		}
 
         // If the SRV request times out (e.g. EXT-3934), simulate response: an
@@ -173,9 +167,9 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 		filter.eventAfter(seconds_to_timeout, fakeResponse);
 
 		std::string srv_pump_name = "LLAres";
-		if(login_params.has("cfg_srv_pump"))
+		if(credentials.has("cfg_srv_pump"))
 		{
-			srv_pump_name = login_params["cfg_srv_pump"].asString();
+			srv_pump_name = credentials["cfg_srv_pump"].asString();
 		}
 
 		// Make request
@@ -200,7 +194,7 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
              urend(rewrittenURIs.endArray());
          urit != urend; ++urit)
     {
-        LLSD request(login_params);
+        LLSD request(credentials);
         request["reply"] = loginReplyPump.getName();
         request["uri"] = *urit;
         std::string status;
@@ -297,17 +291,8 @@ void LLLogin::Impl::login_(LLCoros::self& self, std::string uri, LLSD login_para
 	// to success, add a data/message and data/reason fields.
 	LLSD error_response;
 	error_response["reason"] = mAuthResponse["status"];
-	error_response["errorcode"] = mAuthResponse["errorcode"];
 	error_response["message"] = mAuthResponse["error"];
-	if(mAuthResponse.has("certificate"))
-	{
-		error_response["certificate"] = mAuthResponse["certificate"];
-	}
 	sendProgressEvent("offline", "fail.login", error_response);
-	}
-	catch (...) {
-		llerrs << "login exception caught" << llendl; 
-	}
 }
 
 void LLLogin::Impl::disconnect()
-- 
cgit v1.2.3


From 1e7ae7a69398a1bca88812545da7bc86db9f3c38 Mon Sep 17 00:00:00 2001
From: Tofu Linden <tofu.linden@lindenlab.com>
Date: Wed, 7 Apr 2010 11:14:44 +0100
Subject: fix to the SLE backout.

---
 indra/newview/llxmlrpctransaction.cpp | 3 ---
 1 file changed, 3 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index 012c668ee4..5884cdd1c3 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -31,9 +31,6 @@
  */
 
 #include "llviewerprecompiledheaders.h"
-#include <openssl/x509_vfy.h>
-#include <openssl/ssl.h>
-#include "llsecapi.h"
 
 #include "llxmlrpctransaction.h"
 #include "llxmlrpclistener.h"
-- 
cgit v1.2.3


From 8723a285fae8afa0ad7458c9a9ac00ac4504239b Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 7 Apr 2010 13:38:21 +0300
Subject: Fixed normal bug EXT-6600(Block List button in Preferences does
 nothing prior to login (should be disabled)) - added disabling of Block List
 button if user is not logged in. Reviewed by Mike Antipov at
 https://codereview.productengine.com/secondlife/r/186/

--HG--
branch : product-engine
---
 indra/newview/llfloaterpreference.cpp | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'indra')

diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 804ef609ec..4c4ccc02d7 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -107,6 +107,8 @@
 #include "llpluginclassmedia.h"
 #include "llteleporthistorystorage.h"
 
+#include "lllogininstance.h"        // to check if logged in yet
+
 const F32 MAX_USER_FAR_CLIP = 512.f;
 const F32 MIN_USER_FAR_CLIP = 64.f;
 
@@ -858,6 +860,8 @@ void LLFloaterPreference::refreshEnabledState()
 	ctrl_wind_light->setEnabled(ctrl_shader_enable->getEnabled() && shaders);
 	// now turn off any features that are unavailable
 	disableUnavailableSettings();
+
+	childSetEnabled ("block_list", LLLoginInstance::getInstance()->authSuccess());
 }
 
 void LLFloaterPreference::disableUnavailableSettings()
-- 
cgit v1.2.3


From 7dd71a60c51ed81c1ddfa98d09a158488a85b753 Mon Sep 17 00:00:00 2001
From: Eugene Mutavchi <emutavchi@productengine.com>
Date: Wed, 7 Apr 2010 13:38:21 +0300
Subject: Fixed critical bug EXT-1655 ([BSI] Always flying after pressing
 "Stand" to stand up from an object)  - moved restoring the flying of the
 agent before calling the mAutoPilotFinishedCallback, to allow finished
 callback to change it.  - fixed LLVOAvatar::sitOnObject() to set mIsSitting =
 TRUE before stoping the autopilot, like it was in 1.23 version. Reviewed by
 Mike Antipov at https://codereview.productengine.com/secondlife/r/185/

--HG--
branch : product-engine
---
 indra/newview/llagent.cpp    | 10 +++++-----
 indra/newview/llvoavatar.cpp |  3 ++-
 2 files changed, 7 insertions(+), 6 deletions(-)

(limited to 'indra')

diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index 37d1bd15e1..056f406942 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -1295,6 +1295,11 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
 		{
 			resetAxes(mAutoPilotTargetFacing);
 		}
+		// If the user cancelled, don't change the fly state
+		if (!user_cancel)
+		{
+			setFlying(mAutoPilotFlyOnStop);
+		}
 		//NB: auto pilot can terminate for a reason other than reaching the destination
 		if (mAutoPilotFinishedCallback)
 		{
@@ -1302,11 +1307,6 @@ void LLAgent::stopAutoPilot(BOOL user_cancel)
 		}
 		mLeaderID = LLUUID::null;
 
-		// If the user cancelled, don't change the fly state
-		if (!user_cancel)
-		{
-			setFlying(mAutoPilotFlyOnStop);
-		}
 		setControlFlags(AGENT_CONTROL_STOP);
 
 		if (user_cancel && !mAutoPilotBehaviorName.empty())
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 540cb47710..14750c996c 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -5607,6 +5607,8 @@ void LLVOAvatar::sitDown(BOOL bSitting)
 //-----------------------------------------------------------------------------
 void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
 {
+	sitDown(TRUE);
+
 	if (isSelf())
 	{
 		// Might be first sit
@@ -5639,7 +5641,6 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object)
 	mDrawable->mXform.setRotation(mDrawable->getWorldRotation() * inv_obj_rot);
 
 	gPipeline.markMoved(mDrawable, TRUE);
-	sitDown(TRUE);
 	mRoot.getXform()->setParent(&sit_object->mDrawable->mXform); // LLVOAvatar::sitOnObject
 	mRoot.setPosition(getPosition());
 	mRoot.updateWorldMatrixChildren();
-- 
cgit v1.2.3