Merge Firestorm LGPL

Wed, 21 Mar 2018 20:23:52 +0100

author
Ansariel
date
Wed, 21 Mar 2018 20:23:52 +0100
changeset 55082
c230dd5e6f29
parent 55081
cd11db88290d
parent 54975
12674e7f0f74
child 55083
6cc7466e6e3c

Merge Firestorm LGPL

autobuild.xml file | annotate | diff | revisions
indra/media_plugins/cef/media_plugin_cef.cpp file | annotate | diff | revisions
indra/newview/app_settings/settings.xml file | annotate | diff | revisions
indra/newview/llappviewer.cpp file | annotate | diff | revisions
     1.1 --- a/autobuild.xml	Fri Mar 02 12:11:50 2018 +0100
     1.2 +++ b/autobuild.xml	Wed Mar 21 20:23:52 2018 +0100
     1.3 @@ -948,11 +948,11 @@
     1.4              <key>archive</key>
     1.5              <map>
     1.6                <key>hash</key>
     1.7 -              <string>6324120be383af3564f2b46b07f1b765</string>
     1.8 +              <string>9f69c9fa0932d54d17c159fc33faea87</string>
     1.9                <key>hash_algorithm</key>
    1.10                <string>md5</string>
    1.11                <key>url</key>
    1.12 -              <string>file:///opt/firestorm/fmodstudio-1.10.03-darwin-.tar.bz2</string>
    1.13 +              <string>file:///opt/firestorm/fmodstudio-1.10.04-darwin-180681405.tar.bz2</string>
    1.14              </map>
    1.15              <key>name</key>
    1.16              <string>darwin</string>
    1.17 @@ -990,18 +990,32 @@
    1.18              <key>archive</key>
    1.19              <map>
    1.20                <key>hash</key>
    1.21 -              <string>4be36322f3bf16dfbba67c8df574d446</string>
    1.22 +              <string>7cf0785fa38889c9028fe776eda060f6</string>
    1.23                <key>hash_algorithm</key>
    1.24                <string>md5</string>
    1.25                <key>url</key>
    1.26 -              <string>file:///c:/cygwin/opt/firestorm/fmodstudio-1.10.03-windows-180491728.tar.bz2</string>
    1.27 +              <string>file:///c:/cygwin/opt/firestorm/fmodstudio-1.10.04-windows-180672209.tar.bz2</string>
    1.28              </map>
    1.29              <key>name</key>
    1.30              <string>windows</string>
    1.31            </map>
    1.32 +          <key>windows64</key>
    1.33 +          <map>
    1.34 +            <key>archive</key>
    1.35 +            <map>
    1.36 +              <key>hash</key>
    1.37 +              <string>fe0951c7fffbf1cd0154bcdb5bcaa5c9</string>
    1.38 +              <key>hash_algorithm</key>
    1.39 +              <string>md5</string>
    1.40 +              <key>url</key>
    1.41 +              <string>file:///c:/cygwin/opt/firestorm/fmodstudio-1.10.04-windows64-180672211.tar.bz2</string>
    1.42 +            </map>
    1.43 +            <key>name</key>
    1.44 +            <string>windows64</string>
    1.45 +          </map>
    1.46          </map>
    1.47          <key>version</key>
    1.48 -        <string>1.10.03</string>
    1.49 +        <string>1.10.04</string>
    1.50        </map>
    1.51        <key>fmodex</key>
    1.52        <map>
    1.53 @@ -1958,9 +1972,9 @@
    1.54              <key>archive</key>
    1.55              <map>
    1.56                <key>hash</key>
    1.57 -              <string>88ab0fb55e82f8cd3a75ee636def785a</string>
    1.58 -              <key>url</key>
    1.59 -              <string>file:///opt/firestorm/kdu-7.9.0-darwin-201702032052-r58.tar.bz2</string>
    1.60 +              <string>75991f598df209713faf94b4a1cb1a89</string>
    1.61 +              <key>url</key>
    1.62 +              <string>file:///opt/firestorm/kdu-7.A.3-darwin-180711129.tar.bz2</string>
    1.63              </map>
    1.64              <key>name</key>
    1.65              <string>darwin</string>
    1.66 @@ -1970,9 +1984,9 @@
    1.67              <key>archive</key>
    1.68              <map>
    1.69                <key>hash</key>
    1.70 -              <string>88ab0fb55e82f8cd3a75ee636def785a</string>
    1.71 -              <key>url</key>
    1.72 -              <string>file:///opt/firestorm/kdu-7.9.0-darwin-201702032052-r58.tar.bz2</string>
    1.73 +              <string>75991f598df209713faf94b4a1cb1a89</string>
    1.74 +              <key>url</key>
    1.75 +              <string>file:///opt/firestorm/kdu-7.A.3-darwin-180711129.tar.bz2</string>
    1.76              </map>
    1.77              <key>name</key>
    1.78              <string>darwin64</string>
    1.79 @@ -2006,9 +2020,9 @@
    1.80              <key>archive</key>
    1.81              <map>
    1.82                <key>hash</key>
    1.83 -              <string>adeb9db4d4435a65c44a72f981a18b33</string>
    1.84 -              <key>url</key>
    1.85 -              <string>file:///c:/cygwin/opt/firestorm/kdu-7.9.1-windows-201703182143-r61.tar.bz2</string>
    1.86 +              <string>be46f22a4fbf7bd06c2fcd65cd434ed1</string>
    1.87 +              <key>url</key>
    1.88 +              <string>file:///c:/cygwin/opt/firestorm/kdu-7.A.4-windows-180791827.tar.bz2</string>
    1.89              </map>
    1.90              <key>name</key>
    1.91              <string>windows</string>
    1.92 @@ -2018,16 +2032,16 @@
    1.93              <key>archive</key>
    1.94              <map>
    1.95                <key>hash</key>
    1.96 -              <string>adeb9db4d4435a65c44a72f981a18b33</string>
    1.97 -              <key>url</key>
    1.98 -              <string>file:///c:/cygwin/opt/firestorm/kdu-7.9.1-windows-201703182143-r61.tar.bz2</string>
    1.99 +              <string>be46f22a4fbf7bd06c2fcd65cd434ed1</string>
   1.100 +              <key>url</key>
   1.101 +              <string>file:///c:/cygwin/opt/firestorm/kdu-7.A.4-windows-180791827.tar.bz2</string>
   1.102              </map>
   1.103              <key>name</key>
   1.104              <string>windows64</string>
   1.105            </map>
   1.106          </map>
   1.107          <key>version</key>
   1.108 -        <string>7.9.1.504041</string>
   1.109 +        <string>7.A.4</string>
   1.110        </map>
   1.111        <key>libhunspell</key>
   1.112        <map>
   1.113 @@ -4232,7 +4246,7 @@
   1.114                    <string>--package</string>
   1.115                    <string>--platform darwin</string>
   1.116                    <string>--btype RelWithDebInfo</string>
   1.117 -                  <string>--fmodex</string>
   1.118 +                  <string>--fmodstudio</string>
   1.119                    <string>--kdu</string>
   1.120                  </array>
   1.121                </map>
   1.122 @@ -4243,7 +4257,7 @@
   1.123                    <string>--platform darwin</string>
   1.124                    <string>--package</string>
   1.125                    <string>--btype RelWithDebInfo</string>
   1.126 -                  <string>--fmodex</string>
   1.127 +                  <string>--fmodstudio</string>
   1.128                    <string>--kdu</string>
   1.129                  </array>
   1.130                </map>
   1.131 @@ -4288,7 +4302,7 @@
   1.132                  <array>
   1.133                    <string>--build</string>
   1.134                    <string>--platform darwin</string>
   1.135 -                  <string>--fmodex</string>
   1.136 +                  <string>--fmodstudio</string>
   1.137                    <string>--kdu</string>
   1.138                  </array>
   1.139                </map>
   1.140 @@ -4298,7 +4312,7 @@
   1.141                  <array>
   1.142                    <string>--platform darwin</string>
   1.143                    <string>--kdu</string>
   1.144 -                  <string>--fmodex</string>
   1.145 +                  <string>--fmodstudio</string>
   1.146                  </array>
   1.147                </map>
   1.148                <key>name</key>
     2.1 --- a/indra/media_plugins/cef/media_plugin_cef.cpp	Fri Mar 02 12:11:50 2018 +0100
     2.2 +++ b/indra/media_plugins/cef/media_plugin_cef.cpp	Wed Mar 21 20:23:52 2018 +0100
     2.3 @@ -810,7 +810,7 @@
     2.4  
     2.5  	// adding new code below in unicodeInput means we don't send ascii chars
     2.6  	// here too or we get double key presses on a mac.  
     2.7 -	if (((unsigned char)event_chars < 0x20 || (unsigned char)event_chars >= 0x7f ))
     2.8 +	if (((unsigned char)event_chars < 0x10 || (unsigned char)event_chars >= 0x7f ))
     2.9  	{
    2.10  		mCEFLib->nativeKeyboardEventOSX(key_event, event_modifiers, 
    2.11  										event_keycode, event_chars, 
     3.1 --- a/indra/newview/CMakeLists.txt	Fri Mar 02 12:11:50 2018 +0100
     3.2 +++ b/indra/newview/CMakeLists.txt	Wed Mar 21 20:23:52 2018 +0100
     3.3 @@ -459,6 +459,7 @@
     3.4      llhudview.cpp
     3.5      llimagefiltersmanager.cpp
     3.6      llimhandler.cpp
     3.7 +    llimprocessing.cpp
     3.8      llimview.cpp
     3.9      llinspect.cpp
    3.10      llinspectavatar.cpp
    3.11 @@ -1212,6 +1213,7 @@
    3.12      llhudtext.h
    3.13      llhudview.h
    3.14      llimagefiltersmanager.h
    3.15 +    llimprocessing.h
    3.16      llimview.h
    3.17      llinspect.h
    3.18      llinspectavatar.h
     4.1 --- a/indra/newview/app_settings/settings.xml	Fri Mar 02 12:11:50 2018 +0100
     4.2 +++ b/indra/newview/app_settings/settings.xml	Wed Mar 21 20:23:52 2018 +0100
     4.3 @@ -24565,6 +24565,17 @@
     4.4        <key>Value</key>
     4.5        <string>Scripting</string>
     4.6      </map>
     4.7 +    <key>FSEnableRightclickOnTransparentObjects</key>
     4.8 +    <map>
     4.9 +      <key>Comment</key>
    4.10 +      <string>If enabled, right-clicks on transparent objects will open the context menu</string>
    4.11 +      <key>Persist</key>
    4.12 +      <integer>1</integer>
    4.13 +      <key>Type</key>
    4.14 +      <string>Boolean</string>
    4.15 +      <key>Value</key>
    4.16 +      <integer>1</integer>
    4.17 +    </map>
    4.18    </map>
    4.19  </llsd>
    4.20  
     5.1 --- a/indra/newview/fsdata.cpp	Fri Mar 02 12:11:50 2018 +0100
     5.2 +++ b/indra/newview/fsdata.cpp	Wed Mar 21 20:23:52 2018 +0100
     5.3 @@ -194,9 +194,9 @@
     5.4  bool FSData::loadFromFile(LLSD& data, std::string filename)
     5.5  {
     5.6  	llifstream file(filename.c_str());
     5.7 -	if(file.is_open())
     5.8 +	if (file.is_open())
     5.9  	{
    5.10 -		if(LLSDSerialize::fromXML(data, file) != LLSDParser::PARSE_FAILURE)
    5.11 +		if (LLSDSerialize::fromXML(data, file) != LLSDParser::PARSE_FAILURE)
    5.12  		{
    5.13  			file.close();
    5.14  			return true;
    5.15 @@ -297,7 +297,7 @@
    5.16  	// Stat the file to see if it exists and when it was last modified.
    5.17  	time_t last_modified = 0;
    5.18  	llstat stat_data;
    5.19 -	if(!LLFile::stat(mFSdataFilename, &stat_data))
    5.20 +	if (!LLFile::stat(mFSdataFilename, &stat_data))
    5.21  	{
    5.22  		last_modified = stat_data.st_mtime;
    5.23  	}
    5.24 @@ -305,7 +305,7 @@
    5.25  	FSCoreHttpUtil::callbackHttpGet(mFSDataURL, last_modified, boost::bind(downloadComplete, _1, mFSDataURL, true), boost::bind(downloadComplete, _1, mFSDataURL, false));
    5.26  
    5.27  	last_modified = 0;
    5.28 -	if(!LLFile::stat(mFSdataDefaultsFilename, &stat_data))
    5.29 +	if (!LLFile::stat(mFSdataDefaultsFilename, &stat_data))
    5.30  	{
    5.31  		last_modified = stat_data.st_mtime;
    5.32  	}
    5.33 @@ -320,7 +320,7 @@
    5.34  	{
    5.35  		filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, script_name);
    5.36  		last_modified = 0;
    5.37 -		if(!LLFile::stat(filename, &stat_data))
    5.38 +		if (!LLFile::stat(filename, &stat_data))
    5.39  		{
    5.40  			last_modified = stat_data.st_mtime;
    5.41  		}
    5.42 @@ -365,7 +365,7 @@
    5.43  		mAgentsFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename_prefix + "_agents.xml");
    5.44  		time_t last_modified = 0;
    5.45  		llstat stat_data;
    5.46 -		if(!LLFile::stat(mAgentsFilename, &stat_data))
    5.47 +		if (!LLFile::stat(mAgentsFilename, &stat_data))
    5.48  		{
    5.49  			last_modified = stat_data.st_mtime;
    5.50  		}
    5.51 @@ -378,7 +378,7 @@
    5.52  		mAssestsFilename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, filename_prefix + "_assets.xml");
    5.53  		time_t last_modified = 0;
    5.54  		llstat stat_data;
    5.55 -		if(!LLFile::stat(mAssestsFilename, &stat_data))
    5.56 +		if (!LLFile::stat(mAssestsFilename, &stat_data))
    5.57  		{
    5.58  			last_modified = stat_data.st_mtime;
    5.59  		}
    5.60 @@ -472,6 +472,7 @@
    5.61  	{
    5.62  		return;
    5.63  	}
    5.64 +
    5.65  	const LLSD& asset = assets["assets"];
    5.66  	for (LLSD::map_const_iterator itr = asset.beginMap(); itr != asset.endMap(); ++itr)
    5.67  	{
    5.68 @@ -505,7 +506,7 @@
    5.69  	{
    5.70  		const LLSD& support_agents = data["SupportAgents"];
    5.71  		std::string newFormat;
    5.72 -		for(LLSD::map_const_iterator iter = support_agents.beginMap(); iter != support_agents.endMap(); ++iter)
    5.73 +		for (LLSD::map_const_iterator iter = support_agents.beginMap(); iter != support_agents.endMap(); ++iter)
    5.74  		{
    5.75  			LLUUID key = LLUUID(iter->first);
    5.76  			mSupportAgents[key] = 0;
    5.77 @@ -576,7 +577,7 @@
    5.78  
    5.79  //WS: Create a new LLSD based on the data from the mLegacyClientList if
    5.80  LLSD FSData::resolveClientTag(const LLUUID& id, bool new_system, const LLColor4& color)
    5.81 -{	
    5.82 +{
    5.83  	LLSD curtag;
    5.84  	curtag["uuid"] = id.asString();
    5.85  	curtag["id_based"] = new_system;
    5.86 @@ -674,7 +675,7 @@
    5.87  
    5.88  	//If we only want to display tpvd viewer. And "tpvd" is not available or false, then
    5.89  	// clear the data, but keep the basedata (like uuid, id_based and tex_color) for (maybe) later displaying.
    5.90 -	if(client_tag_visibility <= 1 && (!curtag.has("tpvd") || !curtag["tpvd"].asBoolean()))
    5.91 +	if (client_tag_visibility <= 1 && (!curtag.has("tpvd") || !curtag["tpvd"].asBoolean()))
    5.92  	{
    5.93  		curtag.clear();
    5.94  	}
    5.95 @@ -705,7 +706,7 @@
    5.96  	LL_INFOS("fsdata") << "Saving " << filename << LL_ENDL;
    5.97  	llofstream file;
    5.98  	file.open(filename.c_str());
    5.99 -	if(!file.is_open())
   5.100 +	if (!file.is_open())
   5.101  	{
   5.102  		LL_WARNS("fsdata") << "Unable to open " << filename << LL_ENDL;
   5.103  		return;
   5.104 @@ -719,7 +720,7 @@
   5.105  	const std::time_t new_time = last_modified.secondsSinceEpoch();
   5.106  
   5.107  #ifdef LL_WINDOWS
   5.108 -	boost::filesystem::last_write_time(boost::filesystem::path( utf8str_to_utf16str(filename) ), new_time);
   5.109 +	boost::filesystem::last_write_time(boost::filesystem::path(utf8str_to_utf16str(filename)), new_time);
   5.110  #else
   5.111  	boost::filesystem::last_write_time(boost::filesystem::path(filename), new_time);
   5.112  #endif
   5.113 @@ -737,22 +738,20 @@
   5.114  
   5.115  bool FSData::isSupport(const LLUUID& avatar_id)
   5.116  {
   5.117 -	std::map<LLUUID, S32>::iterator iter = mSupportAgents.find(avatar_id);
   5.118 -	if (iter == mSupportAgents.end())
   5.119 -	{
   5.120 -		return false;
   5.121 -	}
   5.122 -	return (iter->second & SUPPORT);
   5.123 +	S32 flags = getAgentFlags(avatar_id);
   5.124 +	return (flags != -1 && (flags & SUPPORT));
   5.125  }
   5.126  
   5.127  bool FSData::isDeveloper(const LLUUID& avatar_id)
   5.128  {
   5.129 -	std::map<LLUUID, S32>::iterator iter = mSupportAgents.find(avatar_id);
   5.130 -	if (iter == mSupportAgents.end())
   5.131 -	{
   5.132 -		return false;
   5.133 -	}
   5.134 -	return (iter->second & DEVELOPER);
   5.135 +	S32 flags = getAgentFlags(avatar_id);
   5.136 +	return (flags != -1 && (flags & DEVELOPER));
   5.137 +}
   5.138 +
   5.139 +bool FSData::isQA(const LLUUID& avatar_id)
   5.140 +{
   5.141 +	S32 flags = getAgentFlags(avatar_id);
   5.142 +	return (flags != -1 && (flags & QA));
   5.143  }
   5.144  
   5.145  LLSD FSData::allowedLogin()
   5.146 @@ -760,13 +759,13 @@
   5.147  	std::map<std::string, LLSD>::iterator iter = mBlockedVersions.find(LLVersionInfo::getChannelAndVersionFS());
   5.148  	if (iter == mBlockedVersions.end())
   5.149  	{
   5.150 -		return LLSD(); 
   5.151 +		return LLSD();
   5.152  	}
   5.153  	else
   5.154  	{
   5.155  		LLSD block = iter->second;
   5.156  		bool blocked = true; // default is to block all unless there is a gridtype or grids present.
   5.157 -		if(block.has("gridtype"))
   5.158 +		if (block.has("gridtype"))
   5.159  		{
   5.160  			blocked = false;
   5.161  #ifdef OPENSIM
   5.162 @@ -780,13 +779,11 @@
   5.163  				return block;
   5.164  			}
   5.165  		}
   5.166 -		if(block.has("grids"))
   5.167 +		if (block.has("grids"))
   5.168  		{
   5.169  			blocked = false;
   5.170  			LLSD grids = block["grids"];
   5.171 -			for (LLSD::array_iterator grid_iter = grids.beginArray();
   5.172 -				grid_iter != grids.endArray();
   5.173 -				++grid_iter)
   5.174 +			for (LLSD::array_iterator grid_iter = grids.beginArray(); grid_iter != grids.endArray(); ++grid_iter)
   5.175  			{
   5.176  				if ((*grid_iter).asString() == LLGridManager::getInstance()->getGrid())
   5.177  				{
   5.178 @@ -798,7 +795,7 @@
   5.179  	}
   5.180  }
   5.181  
   5.182 -BOOL FSData::isSupportGroup(const LLUUID& id)
   5.183 +bool FSData::isSupportGroup(const LLUUID& id)
   5.184  {
   5.185  	return (mSupportGroup.count(id));
   5.186  }
   5.187 @@ -865,7 +862,7 @@
   5.188  		return message;
   5.189  	}
   5.190  
   5.191 -	if (!isSupport(requester) && !isDeveloper(requester))
   5.192 +	if (!isSupport(requester) && !isDeveloper(requester) && !isQA(requester))
   5.193  	{
   5.194  		return message;
   5.195  	}
   5.196 @@ -969,10 +966,8 @@
   5.197  	LLSD info = LLAppViewer::instance()->getViewerInfo();
   5.198  
   5.199  	std::string sysinfo1("\n");
   5.200 -	sysinfo1 += llformat("%s %s (%d) %s %s (%s) %s\n\n", LLAppViewer::instance()->getSecondLifeTitle().c_str(), LLVersionInfo::getShortVersion().c_str(), LLVersionInfo::getBuild(), info["BUILD_DATE"].asString().c_str(), info["BUILD_TIME"].asString().c_str(), LLVersionInfo::getChannel().c_str(),
   5.201 -//<FS:CR> FIRE-8273: Add Havok/Opensim indicator to getSystemInfo()
   5.202 -		info["BUILD_TYPE"].asString().c_str());
   5.203 -// </FS:CR>
   5.204 +	sysinfo1 += llformat("%s %s (%d) %s %s (%s %dbit) %s\n\n", LLAppViewer::instance()->getSecondLifeTitle().c_str(), LLVersionInfo::getShortVersion().c_str(), LLVersionInfo::getBuild(), info["BUILD_DATE"].asString().c_str(), info["BUILD_TIME"].asString().c_str(), LLVersionInfo::getChannel().c_str(),
   5.205 +		info["ADDRESS_SIZE"].asInteger(), info["BUILD_TYPE"].asString().c_str());
   5.206  	sysinfo1 += llformat("Build with %s version %s\n\n", info["COMPILER"].asString().c_str(), info["COMPILER_VERSION"].asString().c_str());
   5.207  	sysinfo1 += llformat("I am in %s located at %s (%s)\n", info["REGION"].asString().c_str(), info["HOSTNAME"].asString().c_str(), info["HOSTIP"].asString().c_str());
   5.208  	sysinfo1 += llformat("%s\n\n", info["SERVER_VERSION"].asString().c_str());
   5.209 @@ -993,7 +988,7 @@
   5.210  	sysinfo2 += llformat("libcurl Version: %s\n", info["LIBCURL_VERSION"].asString().c_str());
   5.211  	sysinfo2 += llformat("J2C Decoder Version: %s\n", info["J2C_VERSION"].asString().c_str());
   5.212  	sysinfo2 += llformat("Audio Driver Version: %s\n", info["AUDIO_DRIVER_VERSION"].asString().c_str());
   5.213 -	sysinfo2 += llformat("CEF Version: %s\n", info["LLCEFLIB_VERSION"].asString().c_str());
   5.214 +	sysinfo2 += llformat("%s\n", info["LIBCEF_VERSION"].asString().c_str());
   5.215  	sysinfo2 += llformat("LibVLC Version: %s\n", info["LIBVLC_VERSION"].asString().c_str());
   5.216  
   5.217  	sysinfo2 += llformat("Vivox Version: %s\n", info["VOICE_VERSION"].asString().c_str());
     6.1 --- a/indra/newview/fsdata.h	Fri Mar 02 12:11:50 2018 +0100
     6.2 +++ b/indra/newview/fsdata.h	Wed Mar 21 20:23:52 2018 +0100
     6.3 @@ -56,14 +56,16 @@
     6.4  		NO_SUPPORT	= (1 << 4), //0x10 16
     6.5  		NO_USE		= (1 << 5), //0x20 32
     6.6  		NO_SPAM		= (1 << 6), //0x40 64
     6.7 -		GATEWAY		= (1 << 7), //0x80 128 <FS:JL>
     6.8 +		GATEWAY		= (1 << 7), //0x80 128
     6.9  	};
    6.10  
    6.11  	std::set<LLUUID> mSupportGroup;
    6.12  
    6.13  	bool isDeveloper(const LLUUID& avatar_id);
    6.14  	bool isSupport(const LLUUID& avatar_id);
    6.15 -	BOOL isSupportGroup(const LLUUID& id); // BOOL is used due to used in a LL function.
    6.16 +	bool isQA(const LLUUID& avatar_id);
    6.17 +	bool isSupportGroup(const LLUUID& id);
    6.18 +
    6.19  	// returns -1 if agent is not found.
    6.20  	S32 getAgentFlags(const LLUUID& avatar_id);
    6.21  
     7.1 --- a/indra/newview/fsfloaterim.cpp	Fri Mar 02 12:11:50 2018 +0100
     7.2 +++ b/indra/newview/fsfloaterim.cpp	Wed Mar 21 20:23:52 2018 +0100
     7.3 @@ -335,7 +335,7 @@
     7.4  		|| !mOtherParticipantUUID.isNull())
     7.5  	{
     7.6  		// <FS:Techwolf Lupindo> fsdata support
     7.7 -		if(mDialog == IM_NOTHING_SPECIAL && FSData::instance().isSupport(mOtherParticipantUUID) && FSData::instance().isAgentFlag(gAgentID, FSData::NO_SUPPORT))
     7.8 +		if (mDialog == IM_NOTHING_SPECIAL && FSData::instance().isSupport(mOtherParticipantUUID) && FSData::instance().isAgentFlag(gAgentID, FSData::NO_SUPPORT))
     7.9  		{
    7.10  			return;
    7.11  		}
    7.12 @@ -873,8 +873,8 @@
    7.13  
    7.14  	getChild<LLButton>("send_chat")->setCommitCallback(boost::bind(&FSFloaterIM::sendMsgFromInputEditor, this, CHAT_TYPE_NORMAL));
    7.15  
    7.16 -	BOOL isFSSupportGroup = FSData::getInstance()->isSupportGroup(mSessionID);
    7.17 -	getChild<LLUICtrl>("support_panel")->setVisible(isFSSupportGroup);
    7.18 +	bool isFSSupportGroup = FSData::getInstance()->isSupportGroup(mSessionID);
    7.19 +	childSetVisible("support_panel", isFSSupportGroup);
    7.20  
    7.21  	// <FS:Zi> Viewer version popup
    7.22  	if (isFSSupportGroup)
     8.1 --- a/indra/newview/fsfloatersearch.cpp	Fri Mar 02 12:11:50 2018 +0100
     8.2 +++ b/indra/newview/fsfloatersearch.cpp	Wed Mar 21 20:23:52 2018 +0100
     8.3 @@ -301,7 +301,7 @@
     8.4  	if (mPanelProfile)
     8.5  	{
     8.6  		mPanelProfile->setVisible(false);
     8.7 -		mPanelProfile->setEmbedded(TRUE);
     8.8 +		mPanelProfile->setEmbedded(true);
     8.9  		mPanelPeople->childSetAction("people_profile_btn", boost::bind(&FSFloaterSearch::onBtnPeopleProfile, this));
    8.10  	}
    8.11  	
     9.1 --- a/indra/newview/fspanelprofile.cpp	Fri Mar 02 12:11:50 2018 +0100
     9.2 +++ b/indra/newview/fspanelprofile.cpp	Wed Mar 21 20:23:52 2018 +0100
     9.3 @@ -94,10 +94,10 @@
     9.4  FSPanelProfileTab::FSPanelProfileTab()
     9.5  : LLPanel()
     9.6  , mAvatarId(LLUUID::null)
     9.7 -, mLoading(FALSE)
     9.8 -, mLoaded(FALSE)
     9.9 -, mEmbedded(FALSE)
    9.10 -, mSelfProfile(FALSE)
    9.11 +, mLoading(false)
    9.12 +, mLoaded(false)
    9.13 +, mEmbedded(false)
    9.14 +, mSelfProfile(false)
    9.15  {
    9.16  }
    9.17  
    9.18 @@ -136,7 +136,7 @@
    9.19  {
    9.20  	setApplyProgress(false);
    9.21  
    9.22 -	mLoaded = TRUE;
    9.23 +	mLoaded = true;
    9.24  }
    9.25  
    9.26  void FSPanelProfileTab::setApplyProgress(bool started)
    9.27 @@ -316,7 +316,7 @@
    9.28  		mDisplayNameButton->setEnabled(TRUE);
    9.29  	}
    9.30  
    9.31 -	mDescriptionEdit->setParseHTML( !own_profile && !getEmbedded() );
    9.32 +	mDescriptionEdit->setParseHTML(!own_profile && !getEmbedded());
    9.33  
    9.34  	FSDropTarget* drop_target = getChild<FSDropTarget>("drop_target");
    9.35  	drop_target->setVisible(!own_profile);
    9.36 @@ -750,10 +750,10 @@
    9.37  
    9.38  	if (getSelfProfile() && !getEmbedded())
    9.39  	{
    9.40 -		mShowInSearchCheckbox->setVisible( TRUE );
    9.41 -		mShowInSearchCheckbox->setEnabled( TRUE );
    9.42 -		mDescriptionEdit->setEnabled( TRUE );
    9.43 -		mSecondLifePic->setEnabled( TRUE );
    9.44 +		mShowInSearchCheckbox->setVisible(TRUE);
    9.45 +		mShowInSearchCheckbox->setEnabled(TRUE);
    9.46 +		mDescriptionEdit->setEnabled(TRUE);
    9.47 +		mSecondLifePic->setEnabled(TRUE);
    9.48  	}
    9.49  }
    9.50  
    9.51 @@ -1039,7 +1039,7 @@
    9.52  
    9.53  	if (getSelfProfile() && !getEmbedded())
    9.54  	{
    9.55 -		mUrlEdit->setEnabled( TRUE );
    9.56 +		mUrlEdit->setEnabled(TRUE);
    9.57  	}
    9.58  }
    9.59  
    9.60 @@ -1296,10 +1296,6 @@
    9.61  		mPickDescription->setEnabled(TRUE);
    9.62  		mSetCurrentLocationButton->setVisible(TRUE);
    9.63  	}
    9.64 -	/*else
    9.65 -	{
    9.66 -		mSnapshotCtrl->setEnabled(FALSE);
    9.67 -	}*/
    9.68  }
    9.69  
    9.70  BOOL FSPanelPick::postBuild()
    9.71 @@ -1855,7 +1851,8 @@
    9.72  //////////////////////////////////////////////////////////////////////////
    9.73  
    9.74  FSPanelProfileFirstLife::FSPanelProfileFirstLife()
    9.75 - : FSPanelProfileTab()
    9.76 + : FSPanelProfileTab(),
    9.77 + mIsEditing(false)
    9.78  {
    9.79  }
    9.80  
    9.81 @@ -1865,9 +1862,11 @@
    9.82  
    9.83  BOOL FSPanelProfileFirstLife::postBuild()
    9.84  {
    9.85 -	mDescriptionEdit = getChild<LLUICtrl>("fl_description_edit");
    9.86 +	mDescriptionEdit = getChild<LLTextEditor>("fl_description_edit");
    9.87  	mPicture = getChild<LLTextureCtrl>("real_world_pic");
    9.88  
    9.89 +	mDescriptionEdit->setFocusReceivedCallback(boost::bind(&FSPanelProfileFirstLife::onDescriptionFocusReceived, this));
    9.90 +
    9.91  	return TRUE;
    9.92  }
    9.93  
    9.94 @@ -1878,6 +1877,17 @@
    9.95  	resetData();
    9.96  }
    9.97  
    9.98 +
    9.99 +void FSPanelProfileFirstLife::onDescriptionFocusReceived()
   9.100 +{
   9.101 +	if (!mIsEditing && getSelfProfile())
   9.102 +	{
   9.103 +		mIsEditing = true;
   9.104 +		mDescriptionEdit->setParseHTML(false);
   9.105 +		mDescriptionEdit->setText(mCurrentDescription);
   9.106 +	}
   9.107 +}
   9.108 +
   9.109  void FSPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type)
   9.110  {
   9.111  	if (APT_PROPERTIES == type)
   9.112 @@ -1885,7 +1895,8 @@
   9.113  		const LLAvatarData* avatar_data = static_cast<const LLAvatarData*>(data);
   9.114  		if (avatar_data && getAvatarId() == avatar_data->avatar_id)
   9.115  		{
   9.116 -			mDescriptionEdit->setValue(avatar_data->fl_about_text);
   9.117 +			mCurrentDescription = avatar_data->fl_about_text;
   9.118 +			mDescriptionEdit->setValue(mCurrentDescription);
   9.119  			mPicture->setValue(avatar_data->fl_image_id);
   9.120  			enableControls();
   9.121  		}
   9.122 @@ -1910,8 +1921,8 @@
   9.123  
   9.124  	if (getSelfProfile() && !getEmbedded())
   9.125  	{
   9.126 -		mDescriptionEdit->setEnabled( TRUE );
   9.127 -		mPicture->setEnabled( TRUE );
   9.128 +		mDescriptionEdit->setEnabled(TRUE);
   9.129 +		mPicture->setEnabled(TRUE);
   9.130  	}
   9.131  }
   9.132  
   9.133 @@ -2135,12 +2146,17 @@
   9.134  //////////////////////////////////////////////////////////////////////////
   9.135  
   9.136  FSPanelProfile::FSPanelProfile()
   9.137 - : FSPanelProfileTab()
   9.138 + : FSPanelProfileTab(),
   9.139 + mAvatarNameCacheConnection()
   9.140  {
   9.141  }
   9.142  
   9.143  FSPanelProfile::~FSPanelProfile()
   9.144  {
   9.145 +	if (mAvatarNameCacheConnection.connected())
   9.146 +	{
   9.147 +		mAvatarNameCacheConnection.disconnect();
   9.148 +	}
   9.149  }
   9.150  
   9.151  BOOL FSPanelProfile::postBuild()
   9.152 @@ -2214,7 +2230,7 @@
   9.153  		getChild<LLUICtrl>("cancel_btn")->setVisible(TRUE);
   9.154  	}
   9.155  
   9.156 -	LLAvatarNameCache::get(getAvatarId(), boost::bind(&FSPanelProfile::onAvatarNameCache, this, _1, _2));
   9.157 +	mAvatarNameCacheConnection = LLAvatarNameCache::get(getAvatarId(), boost::bind(&FSPanelProfile::onAvatarNameCache, this, _1, _2));
   9.158  }
   9.159  
   9.160  void FSPanelProfile::updateData()
   9.161 @@ -2239,8 +2255,6 @@
   9.162  		mPanelWeb->apply(&data);
   9.163  		mPanelSecondlife->apply(&data);
   9.164  
   9.165 -		// panel_classifieds->apply();
   9.166 -
   9.167  		mPanelInterests->apply();
   9.168  		mPanelPicks->apply();
   9.169  		mPanelNotes->apply();
   9.170 @@ -2249,9 +2263,8 @@
   9.171  
   9.172  void FSPanelProfile::onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name)
   9.173  {
   9.174 +	mAvatarNameCacheConnection.disconnect();
   9.175 +
   9.176  	mPanelSecondlife->onAvatarNameCache(agent_id, av_name);
   9.177  	mPanelWeb->onAvatarNameCache(agent_id, av_name);
   9.178  }
   9.179 -
   9.180 -
   9.181 -// eof
    10.1 --- a/indra/newview/fspanelprofile.h	Fri Mar 02 12:11:50 2018 +0100
    10.2 +++ b/indra/newview/fspanelprofile.h	Wed Mar 21 20:23:52 2018 +0100
    10.3 @@ -85,7 +85,7 @@
    10.4  
    10.5  	/*virtual*/ ~FSPanelProfileTab();
    10.6  
    10.7 -	void setEmbedded(BOOL embedded) { mEmbedded = embedded; }
    10.8 +	void setEmbedded(bool embedded) { mEmbedded = embedded; }
    10.9  
   10.10  protected:
   10.11  
   10.12 @@ -93,28 +93,28 @@
   10.13  
   10.14  	virtual void enableControls();
   10.15  
   10.16 -	// mLoading: FALSE: Initial state, can request
   10.17 -	//           TRUE:  Data requested, skip duplicate requests (happens due to LLUI's habit of repeated callbacks)
   10.18 -	// mLoaded:  FALSE: Initial state, show loading indicator
   10.19 -	//           TRUE:  Data recieved, which comes in a single message, hide indicator
   10.20 +	// mLoading: false: Initial state, can request
   10.21 +	//           true:  Data requested, skip duplicate requests (happens due to LLUI's habit of repeated callbacks)
   10.22 +	// mLoaded:  false: Initial state, show loading indicator
   10.23 +	//           true:  Data recieved, which comes in a single message, hide indicator
   10.24  	bool getIsLoading() { return mLoading; }
   10.25 -	void setIsLoading() { mLoading = TRUE; }
   10.26 +	void setIsLoading() { mLoading = true; }
   10.27  	bool getIsLoaded() { return mLoaded; }
   10.28 -	void resetLoading() { mLoading = FALSE; mLoaded = FALSE; }
   10.29 +	void resetLoading() { mLoading = false; mLoaded = false; }
   10.30  	
   10.31 -	const BOOL getEmbedded() const { return mEmbedded; }
   10.32 +	const bool getEmbedded() const { return mEmbedded; }
   10.33  	
   10.34 -	const BOOL getSelfProfile() const { return mSelfProfile; }
   10.35 +	const bool getSelfProfile() const { return mSelfProfile; }
   10.36  
   10.37  	void setApplyProgress(bool started);
   10.38  
   10.39  private:
   10.40  
   10.41 -	LLUUID  mAvatarId;
   10.42 -	BOOL    mLoading;
   10.43 -	BOOL    mLoaded;
   10.44 -	BOOL	mEmbedded;
   10.45 -	BOOL	mSelfProfile;
   10.46 +	LLUUID	mAvatarId;
   10.47 +	bool	mLoading;
   10.48 +	bool	mLoaded;
   10.49 +	bool	mEmbedded;
   10.50 +	bool	mSelfProfile;
   10.51  };
   10.52  
   10.53  
   10.54 @@ -248,11 +248,11 @@
   10.55  	void onAvatarNameCacheSetName(const LLUUID& id, const LLAvatarName& av_name);
   10.56  
   10.57  private:
   10.58 -	typedef std::map<std::string,LLUUID>    group_map_t;
   10.59 -	group_map_t             mGroups;
   10.60 -	void                    openGroupProfile();
   10.61 +	typedef std::map<std::string, LLUUID> group_map_t;
   10.62 +	group_map_t			mGroups;
   10.63 +	void				openGroupProfile();
   10.64  
   10.65 -	LLTextBox*          mStatusText;
   10.66 +	LLTextBox*			mStatusText;
   10.67  	LLGroupList*		mGroupList;
   10.68  	LLCheckBoxCtrl*		mShowInSearchCheckbox;
   10.69  	LLTextureCtrl*		mSecondLifePic;
   10.70 @@ -268,7 +268,7 @@
   10.71  	LLButton*			mIMButton;
   10.72  	LLMenuButton*		mOverflowButton;
   10.73  
   10.74 -	bool                mVoiceStatus;
   10.75 +	bool				mVoiceStatus;
   10.76  
   10.77  	boost::signals2::connection mRlvBehaviorCallbackConnection;
   10.78  	void updateRlvRestrictions(ERlvBehaviour behavior);
   10.79 @@ -306,12 +306,6 @@
   10.80  
   10.81  	/*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
   10.82  
   10.83 -	// void load(std::string url);
   10.84 -	// static void onURLKeystroke(LLLineEditor* editor, void* data);
   10.85 -	// static void onCommitLoad(LLUICtrl* ctrl, void* data);
   10.86 -	// static void onCommitURL(LLUICtrl* ctrl, void* data);
   10.87 -	// static void onClickWebProfileHelp(void *);
   10.88 -
   10.89  	void onAvatarNameCache(const LLUUID& agent_id, const LLAvatarName& av_name);
   10.90  
   10.91  	virtual void enableControls();
   10.92 @@ -359,8 +353,8 @@
   10.93  	virtual void enableControls();
   10.94  
   10.95  private:
   10.96 -	LLCheckBoxCtrl *mWantChecks[8];
   10.97 -	LLCheckBoxCtrl *mSkillChecks[6];
   10.98 +	LLCheckBoxCtrl*	mWantChecks[8];
   10.99 +	LLCheckBoxCtrl*	mSkillChecks[6];
  10.100  	LLLineEditor*	mWantToEditor;
  10.101  	LLLineEditor*	mSkillsEditor;
  10.102  	LLLineEditor*	mLanguagesEditor;
  10.103 @@ -499,14 +493,14 @@
  10.104  	LLButton*			mSetCurrentLocationButton;
  10.105  	LLButton*			mSaveButton;
  10.106  
  10.107 -	LLVector3d mPosGlobal;
  10.108 -	LLUUID mParcelId;
  10.109 -	LLUUID mPickId;
  10.110 -	LLUUID mRequestedId;
  10.111 +	LLVector3d			mPosGlobal;
  10.112 +	LLUUID				mParcelId;
  10.113 +	LLUUID				mPickId;
  10.114 +	LLUUID				mRequestedId;
  10.115  
  10.116 -	bool mLocationChanged;
  10.117 -	bool mNewPick;
  10.118 -	bool mIsEditing;
  10.119 +	bool				mLocationChanged;
  10.120 +	bool				mNewPick;
  10.121 +	bool				mIsEditing;
  10.122  
  10.123  	std::string mCurrentPickDescription;
  10.124  
  10.125 @@ -582,9 +576,13 @@
  10.126  
  10.127  protected:
  10.128  	virtual void enableControls();
  10.129 +	void onDescriptionFocusReceived();
  10.130  
  10.131 -	LLUICtrl*		mDescriptionEdit;
  10.132 +	LLTextEditor*	mDescriptionEdit;
  10.133  	LLTextureCtrl*	mPicture;
  10.134 +
  10.135 +	bool			mIsEditing;
  10.136 +	std::string		mCurrentDescription;
  10.137  };
  10.138  
  10.139  /**
  10.140 @@ -626,8 +624,7 @@
  10.141  	 */
  10.142  	void fillRightsData();
  10.143  
  10.144 -	void rightsConfirmationCallback(const LLSD& notification,
  10.145 -			const LLSD& response, S32 rights);
  10.146 +	void rightsConfirmationCallback(const LLSD& notification, const LLSD& response, S32 rights);
  10.147  	void confirmModifyRights(bool grant, S32 rights);
  10.148  	void onCommitRights();
  10.149  	void onCommitNotes();
  10.150 @@ -676,6 +673,8 @@
  10.151  	FSPanelProfileFirstLife*	mPanelFirstlife;
  10.152  	FSPanelAvatarNotes*			mPanelNotes;
  10.153  	LLTabContainer*				mTabContainer;
  10.154 +
  10.155 +	boost::signals2::connection	mAvatarNameCacheConnection;
  10.156  };
  10.157  
  10.158  #endif // FS_PANELPROFILE_H
    11.1 --- a/indra/newview/llappviewer.cpp	Fri Mar 02 12:11:50 2018 +0100
    11.2 +++ b/indra/newview/llappviewer.cpp	Wed Mar 21 20:23:52 2018 +0100
    11.3 @@ -43,6 +43,7 @@
    11.4  #include "llagentui.h"
    11.5  #include "llagentwearables.h"
    11.6  #include "llfloaterimcontainer.h"
    11.7 +#include "llimprocessing.h"
    11.8  #include "llwindow.h"
    11.9  #include "llviewerstats.h"
   11.10  #include "llviewerstatsrecorder.h"
   11.11 @@ -613,26 +614,6 @@
   11.12  	return true;
   11.13  }
   11.14  
   11.15 -void request_initial_instant_messages()
   11.16 -{
   11.17 -	static BOOL requested = FALSE;
   11.18 -	if (!requested
   11.19 -		&& gMessageSystem
   11.20 -		&& LLMuteList::getInstance()->isLoaded()
   11.21 -		&& isAgentAvatarValid())
   11.22 -	{
   11.23 -		// Auto-accepted inventory items may require the avatar object
   11.24 -		// to build a correct name.  Likewise, inventory offers from
   11.25 -		// muted avatars require the mute list to properly mute.
   11.26 -		LLMessageSystem* msg = gMessageSystem;
   11.27 -		msg->newMessageFast(_PREHASH_RetrieveInstantMessages);
   11.28 -		msg->nextBlockFast(_PREHASH_AgentData);
   11.29 -		msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
   11.30 -		msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
   11.31 -		gAgent.sendReliableMessage();
   11.32 -		requested = TRUE;
   11.33 -	}
   11.34 -}
   11.35  
   11.36  // Use these strictly for things that are constructed at startup,
   11.37  // or for things that are performance critical.  JC
   11.38 @@ -5540,7 +5521,7 @@
   11.39  
   11.40  	// Must wait until both have avatar object and mute list, so poll
   11.41  	// here.
   11.42 -	request_initial_instant_messages();
   11.43 +	LLIMProcessing::requestOfflineMessages();
   11.44  
   11.45  	///////////////////////////////////
   11.46  	//
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/indra/newview/llimprocessing.cpp	Wed Mar 21 20:23:52 2018 +0100
    12.3 @@ -0,0 +1,2188 @@
    12.4 +/**
    12.5 +* @file LLIMProcessing.cpp
    12.6 +* @brief Container for Instant Messaging
    12.7 +*
    12.8 +* $LicenseInfo:firstyear=2001&license=viewerlgpl$
    12.9 +* Second Life Viewer Source Code
   12.10 +* Copyright (C) 2018, Linden Research, Inc.
   12.11 +*
   12.12 +* This library is free software; you can redistribute it and/or
   12.13 +* modify it under the terms of the GNU Lesser General Public
   12.14 +* License as published by the Free Software Foundation;
   12.15 +* version 2.1 of the License only.
   12.16 +*
   12.17 +* This library is distributed in the hope that it will be useful,
   12.18 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
   12.19 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   12.20 +* Lesser General Public License for more details.
   12.21 +*
   12.22 +* You should have received a copy of the GNU Lesser General Public
   12.23 +* License along with this library; if not, write to the Free Software
   12.24 +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   12.25 +*
   12.26 +* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
   12.27 +* $/LicenseInfo$
   12.28 +*/
   12.29 +
   12.30 +#include "llviewerprecompiledheaders.h"
   12.31 +
   12.32 +#include "llimprocessing.h"
   12.33 +
   12.34 +#include "llagent.h"
   12.35 +#include "llavatarnamecache.h"
   12.36 +#include "llfirstuse.h"
   12.37 +#include "llfloaterreg.h"
   12.38 +// <FS:Ansariel> [FS communication UI]
   12.39 +//#include "llfloaterimnearbychat.h"
   12.40 +#include "fsfloaternearbychat.h"
   12.41 +// </FS:Ansariel> [FS communication UI]
   12.42 +#include "llimview.h"
   12.43 +#include "llinventoryobserver.h"
   12.44 +#include "llinventorymodel.h"
   12.45 +#include "llmutelist.h"
   12.46 +#include "llnotifications.h"
   12.47 +#include "llnotificationsutil.h"
   12.48 +#include "llnotificationmanager.h"
   12.49 +#include "llpanelgroup.h"
   12.50 +#include "llregionhandle.h"
   12.51 +#include "llslurl.h"
   12.52 +#include "llstring.h"
   12.53 +#include "lltoastnotifypanel.h"
   12.54 +#include "lltrans.h"
   12.55 +#include "llviewergenericmessage.h"
   12.56 +#include "llviewerobjectlist.h"
   12.57 +#include "llviewermessage.h"
   12.58 +#include "llviewerwindow.h"
   12.59 +#include "llviewerregion.h"
   12.60 +#include "llvoavatarself.h"
   12.61 +
   12.62 +#include <boost/regex.hpp>
   12.63 +#include "boost/lexical_cast.hpp"
   12.64 +
   12.65 +// [RLVa:KB] - Checked: 2010-03-09 (RLVa-1.2.0a)
   12.66 +#include "rlvactions.h"
   12.67 +#include "rlvhandler.h"
   12.68 +#include "rlvinventory.h"
   12.69 +#include "rlvui.h"
   12.70 +// [/RLVa:KB]
   12.71 +
   12.72 +// Firestorm includes
   12.73 +#include "fscommon.h"
   12.74 +#include "fsdata.h"
   12.75 +#include "fskeywords.h"
   12.76 +#include "llagentui.h"
   12.77 +#include "llavataractions.h"
   12.78 +#include "llgiveinventory.h"
   12.79 +#include "lllandmarkactions.h"
   12.80 +#include "llviewernetwork.h"
   12.81 +#include "sound_ids.h"
   12.82 +#include "NACLantispam.h"
   12.83 +
   12.84 +#if LL_MSVC
   12.85 +// disable boost::lexical_cast warning
   12.86 +#pragma warning (disable:4702)
   12.87 +#endif
   12.88 +
   12.89 +// Strip out "Resident" for display, but only if the message came from a user
   12.90 +// (rather than a script)
   12.91 +static std::string clean_name_from_im(const std::string& name, EInstantMessage type)
   12.92 +{
   12.93 +    switch (type)
   12.94 +    {
   12.95 +        case IM_NOTHING_SPECIAL:
   12.96 +        case IM_MESSAGEBOX:
   12.97 +        case IM_GROUP_INVITATION:
   12.98 +        case IM_INVENTORY_OFFERED:
   12.99 +        case IM_INVENTORY_ACCEPTED:
  12.100 +        case IM_INVENTORY_DECLINED:
  12.101 +        case IM_GROUP_VOTE:
  12.102 +        case IM_GROUP_MESSAGE_DEPRECATED:
  12.103 +            //IM_TASK_INVENTORY_OFFERED
  12.104 +            //IM_TASK_INVENTORY_ACCEPTED
  12.105 +            //IM_TASK_INVENTORY_DECLINED
  12.106 +        case IM_NEW_USER_DEFAULT:
  12.107 +        case IM_SESSION_INVITE:
  12.108 +        case IM_SESSION_P2P_INVITE:
  12.109 +        case IM_SESSION_GROUP_START:
  12.110 +        case IM_SESSION_CONFERENCE_START:
  12.111 +        case IM_SESSION_SEND:
  12.112 +        case IM_SESSION_LEAVE:
  12.113 +            //IM_FROM_TASK
  12.114 +        case IM_DO_NOT_DISTURB_AUTO_RESPONSE:
  12.115 +        case IM_CONSOLE_AND_CHAT_HISTORY:
  12.116 +        case IM_LURE_USER:
  12.117 +        case IM_LURE_ACCEPTED:
  12.118 +        case IM_LURE_DECLINED:
  12.119 +        case IM_GODLIKE_LURE_USER:
  12.120 +        case IM_TELEPORT_REQUEST:
  12.121 +        case IM_GROUP_ELECTION_DEPRECATED:
  12.122 +            //IM_GOTO_URL
  12.123 +            //IM_FROM_TASK_AS_ALERT
  12.124 +        case IM_GROUP_NOTICE:
  12.125 +        case IM_GROUP_NOTICE_INVENTORY_ACCEPTED:
  12.126 +        case IM_GROUP_NOTICE_INVENTORY_DECLINED:
  12.127 +        case IM_GROUP_INVITATION_ACCEPT:
  12.128 +        case IM_GROUP_INVITATION_DECLINE:
  12.129 +        case IM_GROUP_NOTICE_REQUESTED:
  12.130 +        case IM_FRIENDSHIP_OFFERED:
  12.131 +        case IM_FRIENDSHIP_ACCEPTED:
  12.132 +        case IM_FRIENDSHIP_DECLINED_DEPRECATED:
  12.133 +            //IM_TYPING_START
  12.134 +            //IM_TYPING_STOP
  12.135 +            return LLCacheName::cleanFullName(name);
  12.136 +        default:
  12.137 +            return name;
  12.138 +    }
  12.139 +}
  12.140 +
  12.141 +static std::string clean_name_from_task_im(const std::string& msg,
  12.142 +    BOOL from_group)
  12.143 +{
  12.144 +    boost::smatch match;
  12.145 +    static const boost::regex returned_exp(
  12.146 +        "(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)");
  12.147 +    if (boost::regex_match(msg, match, returned_exp))
  12.148 +    {
  12.149 +        // match objects are 1-based for groups
  12.150 +        std::string final = match[1].str();
  12.151 +        std::string name = match[2].str();
  12.152 +        // Don't try to clean up group names
  12.153 +        if (!from_group)
  12.154 +        {
  12.155 +            final += LLCacheName::buildUsername(name);
  12.156 +        }
  12.157 +        final += match[3].str();
  12.158 +        return final;
  12.159 +    }
  12.160 +    return msg;
  12.161 +}
  12.162 +
  12.163 +const std::string NOT_ONLINE_MSG("User not online - message will be stored and delivered later.");
  12.164 +const std::string NOT_ONLINE_INVENTORY("User not online - inventory has been saved.");
  12.165 +void translate_if_needed(std::string& message)
  12.166 +{
  12.167 +    if (message == NOT_ONLINE_MSG)
  12.168 +    {
  12.169 +        message = LLTrans::getString("not_online_msg");
  12.170 +    }
  12.171 +    else if (message == NOT_ONLINE_INVENTORY)
  12.172 +    {
  12.173 +        message = LLTrans::getString("not_online_inventory");
  12.174 +    }
  12.175 +}
  12.176 +
  12.177 +class LLPostponedIMSystemTipNotification : public LLPostponedNotification
  12.178 +{
  12.179 +protected:
  12.180 +    /* virtual */
  12.181 +    void modifyNotificationParams()
  12.182 +    {
  12.183 +        LLSD payload = mParams.payload;
  12.184 +        payload["SESSION_NAME"] = mName;
  12.185 +        mParams.payload = payload;
  12.186 +    }
  12.187 +};
  12.188 +
  12.189 +class LLPostponedOfferNotification : public LLPostponedNotification
  12.190 +{
  12.191 +protected:
  12.192 +    /* virtual */
  12.193 +    void modifyNotificationParams()
  12.194 +    {
  12.195 +        LLSD substitutions = mParams.substitutions;
  12.196 +        substitutions["NAME"] = mName;
  12.197 +        mParams.substitutions = substitutions;
  12.198 +    }
  12.199 +};
  12.200 +
  12.201 +void inventory_offer_handler(LLOfferInfo* info)
  12.202 +{
  12.203 +    // If muted, don't even go through the messaging stuff.  Just curtail the offer here.
  12.204 +    // Passing in a null UUID handles the case of where you have muted one of your own objects by_name.
  12.205 +    // The solution for STORM-1297 seems to handle the cases where the object is owned by someone else.
  12.206 +    if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName) ||
  12.207 +        LLMuteList::getInstance()->isMuted(LLUUID::null, info->mFromName))
  12.208 +    {
  12.209 +        info->forceResponse(IOR_MUTE);
  12.210 +        return;
  12.211 +    }
  12.212 +
  12.213 +
  12.214 +    bool bAutoAccept(false);
  12.215 +    // Avoid the Accept/Discard dialog if the user so desires. JC
  12.216 +    // <FS:Ansariel> Auto-accept any kind of inventory (FIRE-4128)
  12.217 +    //if (gSavedSettings.getBOOL("AutoAcceptNewInventory")
  12.218 +    //  && (info->mType == LLAssetType::AT_NOTECARD
  12.219 +    //      || info->mType == LLAssetType::AT_LANDMARK
  12.220 +    //      || info->mType == LLAssetType::AT_TEXTURE))
  12.221 +//  if (gSavedSettings.getBOOL("AutoAcceptNewInventory"))
  12.222 +    // </FS:Ansariel> Auto-accept any kind of inventory (FIRE-4128)
  12.223 +// [RLVa:KB]
  12.224 +    // Don't auto-accept give-to-RLV inventory offers
  12.225 +    if ( (gSavedSettings.getBOOL("AutoAcceptNewInventory")) &&
  12.226 +         ( (!rlv_handler_t::isEnabled()) || (!RlvInventory::instance().isGiveToRLVOffer(*info)) ) )
  12.227 +// [/RLVa:KB]
  12.228 +    {
  12.229 +        // For certain types, just accept the items into the inventory,
  12.230 +        // and possibly open them on receipt depending upon "ShowNewInventory".
  12.231 +        bAutoAccept = true;
  12.232 +    }
  12.233 +
  12.234 +    // Strip any SLURL from the message display. (DEV-2754)
  12.235 +    std::string msg = info->mDesc;
  12.236 +    int indx = msg.find(" ( http://slurl.com/secondlife/");
  12.237 +    if(indx == std::string::npos)
  12.238 +    {
  12.239 +        // try to find new slurl host
  12.240 +        indx = msg.find(" ( http://maps.secondlife.com/secondlife/");
  12.241 +    }
  12.242 +    if(indx >= 0)
  12.243 +    {
  12.244 +        LLStringUtil::truncate(msg, indx);
  12.245 +    }
  12.246 +
  12.247 +    LLSD args;
  12.248 +    args["[OBJECTNAME]"] = msg;
  12.249 +
  12.250 +    LLSD payload;
  12.251 +
  12.252 +    // must protect against a NULL return from lookupHumanReadable()
  12.253 +    std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType));
  12.254 +    if (!typestr.empty())
  12.255 +    {
  12.256 +        // human readable matches string name from strings.xml
  12.257 +        // lets get asset type localized name
  12.258 +        args["OBJECTTYPE"] = LLTrans::getString(typestr);
  12.259 +    }
  12.260 +    else
  12.261 +    {
  12.262 +        LL_WARNS("Messaging") << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << LL_ENDL;
  12.263 +        args["OBJECTTYPE"] = "";
  12.264 +
  12.265 +        // This seems safest, rather than propagating bogosity
  12.266 +        LL_WARNS("Messaging") << "Forcing an inventory-decline for probably-bad asset type." << LL_ENDL;
  12.267 +        info->forceResponse(IOR_DECLINE);
  12.268 +        return;
  12.269 +    }
  12.270 +
  12.271 +    // If mObjectID is null then generate the object_id based on msg to prevent
  12.272 +    // multiple creation of chiclets for same object.
  12.273 +    LLUUID object_id = info->mObjectID;
  12.274 +    if (object_id.isNull())
  12.275 +        object_id.generate(msg);
  12.276 +
  12.277 +    payload["from_id"] = info->mFromID;
  12.278 +    // Needed by LLScriptFloaterManager to bind original notification with 
  12.279 +    // faked for toast one.
  12.280 +    payload["object_id"] = object_id;
  12.281 +    // Flag indicating that this notification is faked for toast.
  12.282 +    payload["give_inventory_notification"] = FALSE;
  12.283 +    args["OBJECTFROMNAME"] = info->mFromName;
  12.284 +    args["NAME"] = info->mFromName;
  12.285 +    if (info->mFromGroup)
  12.286 +    {
  12.287 +        args["NAME_SLURL"] = LLSLURL("group", info->mFromID, "about").getSLURLString();
  12.288 +    }
  12.289 +    else
  12.290 +    {
  12.291 +// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
  12.292 +        args["NAME_LABEL"] = LLSLURL("agent", info->mFromID, "completename").getSLURLString();
  12.293 +// [/SL:KB]
  12.294 +        args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
  12.295 +    }
  12.296 +    std::string verb = "select?name=" + LLURI::escape(msg);
  12.297 +    args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
  12.298 +
  12.299 +    LLNotification::Params p;
  12.300 +
  12.301 +    // Object -> Agent Inventory Offer
  12.302 +    if (info->mFromObject && !bAutoAccept)
  12.303 +    {
  12.304 +// [RLVa:KB] - Checked: RLVa-1.2.2
  12.305 +        // Only filter if the object owner is a nearby agent
  12.306 +        if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) && (RlvUtil::isNearbyAgent(info->mFromID)) )
  12.307 +        {
  12.308 +            payload["rlv_shownames"] = TRUE;
  12.309 +            args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "rlvanonym").getSLURLString();
  12.310 +        }
  12.311 +// [/RLVa:KB]
  12.312 +
  12.313 +        // Inventory Slurls don't currently work for non agent transfers, so only display the object name.
  12.314 +        args["ITEM_SLURL"] = msg;
  12.315 +        // Note: sets inventory_task_offer_callback as the callback
  12.316 +        p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
  12.317 +        info->mPersist = true;
  12.318 +
  12.319 +        // Offers from your own objects need a special notification template.
  12.320 +        p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem";
  12.321 +
  12.322 +        // Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
  12.323 +        LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
  12.324 +    }
  12.325 +    else // Agent -> Agent Inventory Offer
  12.326 +    {
  12.327 +// [RLVa:KB] - Checked: RLVa-2.0.1
  12.328 +        // Only filter if the offer is from a nearby agent and if there's no open IM session (doesn't necessarily have to be focused)
  12.329 +        bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
  12.330 +            (RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) || (!RlvUtil::isNearbyAgent(info->mFromID)) || (RlvUIEnabler::hasOpenIM(info->mFromID)) || (RlvUIEnabler::hasOpenProfile(info->mFromID));
  12.331 +        if (!fRlvCanShowName)
  12.332 +        {
  12.333 +            payload["rlv_shownames"] = TRUE;
  12.334 +            LLAvatarName av_name;
  12.335 +            if (LLAvatarNameCache::get(info->mFromID, &av_name))
  12.336 +            {
  12.337 +                args["NAME"] = RlvStrings::getAnonym(av_name);
  12.338 +            }
  12.339 +            else
  12.340 +            {
  12.341 +                args["NAME"] = RlvStrings::getAnonym(info->mFromName);
  12.342 +            }
  12.343 +            args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "rlvanonym").getSLURLString();
  12.344 +        }
  12.345 +// [/RLVa:KB]
  12.346 +
  12.347 +        p.responder = info;
  12.348 +        // Note: sets inventory_offer_callback as the callback
  12.349 +        // *TODO fix memory leak
  12.350 +        // inventory_offer_callback() is not invoked if user received notification and 
  12.351 +        // closes viewer(without responding the notification)
  12.352 +        p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
  12.353 +        info->mPersist = true;
  12.354 +        // <FS:Ansariel> FIRE-3832: Silent accept/decline of inventory offers
  12.355 +        //p.name = "UserGiveItem";
  12.356 +        p.name = (gSavedSettings.getBOOL("FSUseLegacyInventoryAcceptMessages") ? "UserGiveItemLegacy" : "UserGiveItem");
  12.357 +        // </FS:Ansariel>
  12.358 +        p.offer_from_agent = true;
  12.359 +        
  12.360 +        // Prefetch the item into your local inventory.
  12.361 +        LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
  12.362 +        fetch_item->startFetch();
  12.363 +        if(fetch_item->isFinished())
  12.364 +        {
  12.365 +            fetch_item->done();
  12.366 +        }
  12.367 +        else
  12.368 +        {
  12.369 +            gInventory.addObserver(fetch_item);
  12.370 +        }
  12.371 +        
  12.372 +        // In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages).
  12.373 +        // <FS:Ansariel> Optional V1-like inventory accept messages
  12.374 +        //info->send_auto_receive_response();
  12.375 +        // Also needs to be send on auto-accept so the item gets into the inventory!
  12.376 +        if (bAutoAccept || !gSavedSettings.getBOOL("FSUseLegacyInventoryAcceptMessages"))
  12.377 +        {
  12.378 +            info->send_auto_receive_response();
  12.379 +        }
  12.380 +        // </FS:Ansariel> Optional V1-like inventory accept messages
  12.381 +
  12.382 +        if (gAgent.isDoNotDisturb()) 
  12.383 +        {
  12.384 +            send_do_not_disturb_message(gMessageSystem, info->mFromID);
  12.385 +        }
  12.386 +
  12.387 +        if (!bAutoAccept) // if we auto accept, do not pester the user
  12.388 +        {
  12.389 +            // Inform user that there is a script floater via toast system
  12.390 +            payload["give_inventory_notification"] = TRUE;
  12.391 +            p.payload = payload;
  12.392 +            LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false);
  12.393 +        }
  12.394 +        // <FS:Ansariel> FIRE-19540: Log auto-accepted inventory to nearby chat
  12.395 +        else if (gSavedSettings.getBOOL("FSLogAutoAcceptInventoryToChat"))
  12.396 +        {
  12.397 +            std::string message_type;
  12.398 +            LLStringUtil::format_map_t chat_args;
  12.399 +            
  12.400 +            chat_args["OBJECT_TYPE"] = (!typestr.empty() ? LLTrans::getString(typestr) : "");
  12.401 +            chat_args["DESC"] = msg;
  12.402 +
  12.403 +            if (info->mFromObject)
  12.404 +            {
  12.405 +                std::string str_pos;
  12.406 +                std::string::size_type idx_start = info->mDesc.rfind(" ( http://");
  12.407 +                std::string::size_type idx_end = info->mDesc.find(" )", idx_start);
  12.408 +                if (idx_start != std::string::npos && idx_end != std::string::npos)
  12.409 +                {
  12.410 +                    LLSLURL url_pos(info->mDesc.substr(idx_start + 3, idx_end - (idx_start + 3)));
  12.411 +                    str_pos = "&slurl=" + LLURI::escape(url_pos.getLocationString());
  12.412 +                }
  12.413 +
  12.414 +                chat_args["OBJECT_NAME"] = "[" + LLSLURL("objectim", info->mObjectID, "").getSLURLString() + "?name=" + LLURI::escape(info->mFromName) + "&owner=" + info->mFromID.asString() + (info->mFromGroup ? "&groupowned=true" : "") + str_pos + " " + info->mFromName + "]";
  12.415 +                message_type = "InvOfferAutoAcceptObject";
  12.416 +            }
  12.417 +            else
  12.418 +            {
  12.419 +                bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
  12.420 +                    (RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) || (!RlvUtil::isNearbyAgent(info->mFromID)) || (RlvUIEnabler::hasOpenIM(info->mFromID)) || (RlvUIEnabler::hasOpenProfile(info->mFromID));
  12.421 +                
  12.422 +                std::string name_slurl = LLSLURL("agent", info->mFromID, (fRlvCanShowName ? "inspect" : "rlvanonym")).getSLURLString();
  12.423 +
  12.424 +                chat_args["USER_NAME"] = name_slurl;
  12.425 +                message_type = "InvOfferAutoAcceptUser";
  12.426 +            }
  12.427 +
  12.428 +            report_to_nearby_chat(LLTrans::getString(message_type, chat_args));
  12.429 +        }
  12.430 +        // </FS:Ansariel>
  12.431 +
  12.432 +        // <FS:Ansariel> Show offered inventory also if auto-accept is enabled (FIRE-5101)
  12.433 +        if (bAutoAccept && gSavedSettings.getBOOL("ShowNewInventory"))
  12.434 +        {
  12.435 +            LLViewerInventoryCategory* catp = NULL;
  12.436 +            catp = (LLViewerInventoryCategory*)gInventory.getCategory(info->mObjectID);
  12.437 +            LLViewerInventoryItem* itemp = NULL;
  12.438 +            if(!catp)
  12.439 +            {
  12.440 +                itemp = (LLViewerInventoryItem*)gInventory.getItem(info->mObjectID);
  12.441 +            }
  12.442 +
  12.443 +            LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(info->mObjectID, info->mFromName);
  12.444 +            open_agent_offer->startFetch();
  12.445 +            if(catp || (itemp && itemp->isFinished()))
  12.446 +            {
  12.447 +                open_agent_offer->done();
  12.448 +            }
  12.449 +            else
  12.450 +            {
  12.451 +                gInventory.addObserver(open_agent_offer);
  12.452 +            }
  12.453 +        }
  12.454 +        // </FS:Ansariel> Show offered inventory also if auto-accept is enabled (FIRE-5101)
  12.455 +    }
  12.456 +
  12.457 +    LLFirstUse::newInventory();
  12.458 +}
  12.459 +
  12.460 +// Callback for name resolution of a god/estate message
  12.461 +static void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message)
  12.462 +{	
  12.463 +    LLSD args;
  12.464 +    args["NAME"] = av_name.getCompleteName();
  12.465 +    args["MESSAGE"] = message;
  12.466 +    LLNotificationsUtil::add("GodMessage", args);
  12.467 +
  12.468 +    // Treat like a system message and put in chat history.
  12.469 +    chat.mSourceType = CHAT_SOURCE_SYSTEM;
  12.470 +    chat.mText = message;
  12.471 +
  12.472 +    // <FS:Ansariel> [FS communication UI]
  12.473 +    //LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
  12.474 +    FSFloaterNearbyChat* nearby_chat = FSFloaterNearbyChat::getInstance();
  12.475 +    // </FS:Ansariel> [FS communication UI]
  12.476 +    if (nearby_chat)
  12.477 +    {
  12.478 +        nearby_chat->addMessage(chat);
  12.479 +    }
  12.480 +}
  12.481 +
  12.482 +// <FS:Ansariel> FIRE-505: Group name not shown in notification well
  12.483 +static void notification_group_name_cb(const std::string& group_name,
  12.484 +                                        const std::string& sender,
  12.485 +                                        const std::string& subject,
  12.486 +                                        const std::string& message,
  12.487 +                                        const LLSD& payload,
  12.488 +                                        U32 timestamp)
  12.489 +{
  12.490 +    LLAvatarName av_name;
  12.491 +    av_name.fromString(sender);
  12.492 +    LLSD args;
  12.493 +    args["SENDER"] = av_name.getUserNameForDisplay();
  12.494 +    args["GROUP"] = group_name;
  12.495 +    args["SUBJECT"] = subject;
  12.496 +    args["MESSAGE"] = message;
  12.497 +    LLDate notice_date = LLDate(timestamp).notNull() ? LLDate(timestamp) : LLDate::now();
  12.498 +    LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(notice_date));
  12.499 +    make_ui_sound("UISndGroupNotice"); // <FS:PP> Group notice sound
  12.500 +}
  12.501 +// </FS:Ansariel>
  12.502 +
  12.503 +// <FS:Ansariel> FIRE-6786: Always show teleport location in teleport offer
  12.504 +static void teleport_region_info_cb(const std::string& slurl, LLSD args, const LLSD& payload, const LLUUID& from_id, const LLUUID& session_id, bool can_user_access_dst_region, bool does_user_require_maturity_increase)
  12.505 +{
  12.506 +    if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
  12.507 +    {
  12.508 +        args["POS_SLURL"] = RlvStrings::getString(RLV_STRING_HIDDEN);
  12.509 +    }
  12.510 +    else
  12.511 +    {
  12.512 +        args["POS_SLURL"] = slurl;
  12.513 +    }
  12.514 +
  12.515 +    LLNotification::Params params;
  12.516 +
  12.517 +    if (!can_user_access_dst_region)
  12.518 +    {
  12.519 +        params.name = "TeleportOffered_MaturityBlocked_SLUrl";
  12.520 +        send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
  12.521 +        send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
  12.522 +    }
  12.523 +    else if (does_user_require_maturity_increase)
  12.524 +    {
  12.525 +        params.name = "TeleportOffered_MaturityExceeded_SLUrl";
  12.526 +    }
  12.527 +    else
  12.528 +    {
  12.529 +        params.name = "TeleportOffered_SLUrl";
  12.530 +        params.functor.name = "TeleportOffered";
  12.531 +    }
  12.532 +
  12.533 +    params.substitutions = args;
  12.534 +    params.payload = payload;
  12.535 +    LLPostponedNotification::add<LLPostponedOfferNotification>(params, from_id, false);
  12.536 +
  12.537 +    LLWindow* viewer_window = gViewerWindow->getWindow();
  12.538 +    static LLCachedControl<bool> sFlashIcon(gSavedSettings, "FSFlashOnMessage");
  12.539 +    if (viewer_window && sFlashIcon)
  12.540 +    {
  12.541 +        viewer_window->flashIcon(5.f);
  12.542 +    }
  12.543 +}
  12.544 +// </FS:Ansariel>
  12.545 +
  12.546 +static bool parse_lure_bucket(const std::string& bucket,
  12.547 +    U64& region_handle,
  12.548 +    LLVector3& pos,
  12.549 +    LLVector3& look_at,
  12.550 +    U8& region_access)
  12.551 +{
  12.552 +    // tokenize the bucket
  12.553 +    typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
  12.554 +    boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
  12.555 +    tokenizer tokens(bucket, sep);
  12.556 +    tokenizer::iterator iter = tokens.begin();
  12.557 +
  12.558 +    S32 gx, gy, rx, ry, rz, lx, ly, lz;
  12.559 +    try
  12.560 +    {
  12.561 +        gx = boost::lexical_cast<S32>((*(iter)).c_str());
  12.562 +        gy = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.563 +        rx = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.564 +        ry = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.565 +        rz = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.566 +        lx = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.567 +        ly = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.568 +        lz = boost::lexical_cast<S32>((*(++iter)).c_str());
  12.569 +    }
  12.570 +    catch (boost::bad_lexical_cast&)
  12.571 +    {
  12.572 +        LL_WARNS("parse_lure_bucket")
  12.573 +            << "Couldn't parse lure bucket."
  12.574 +            << LL_ENDL;
  12.575 +        return false;
  12.576 +    }
  12.577 +    // Grab region access
  12.578 +    region_access = SIM_ACCESS_MIN;
  12.579 +    if (++iter != tokens.end())
  12.580 +    {
  12.581 +        std::string access_str((*iter).c_str());
  12.582 +        LLStringUtil::trim(access_str);
  12.583 +        if (access_str == "A")
  12.584 +        {
  12.585 +            region_access = SIM_ACCESS_ADULT;
  12.586 +        }
  12.587 +        else if (access_str == "M")
  12.588 +        {
  12.589 +            region_access = SIM_ACCESS_MATURE;
  12.590 +        }
  12.591 +        else if (access_str == "PG")
  12.592 +        {
  12.593 +            region_access = SIM_ACCESS_PG;
  12.594 +        }
  12.595 +    }
  12.596 +
  12.597 +    pos.setVec((F32)rx, (F32)ry, (F32)rz);
  12.598 +    look_at.setVec((F32)lx, (F32)ly, (F32)lz);
  12.599 +
  12.600 +    region_handle = to_region_handle(gx, gy);
  12.601 +    return true;
  12.602 +}
  12.603 +
  12.604 +static void notification_display_name_callback(const LLUUID& id,
  12.605 +    const LLAvatarName& av_name,
  12.606 +    const std::string& name,
  12.607 +    LLSD& substitutions,
  12.608 +    const LLSD& payload)
  12.609 +{
  12.610 +    substitutions["NAME"] = av_name.getDisplayName();
  12.611 +    LLNotificationsUtil::add(name, substitutions, payload);
  12.612 +}
  12.613 +
  12.614 +void LLIMProcessing::processNewMessage(LLUUID from_id,
  12.615 +    BOOL from_group,
  12.616 +    LLUUID to_id,
  12.617 +    U8 offline,
  12.618 +    EInstantMessage dialog, // U8
  12.619 +    LLUUID session_id,
  12.620 +    U32 timestamp,
  12.621 +    std::string agentName,
  12.622 +    std::string message,
  12.623 +    U32 parent_estate_id,
  12.624 +    LLUUID region_id,
  12.625 +    LLVector3 position,
  12.626 +    U8 *binary_bucket,
  12.627 +    S32 binary_bucket_size,
  12.628 +    LLHost &sender)
  12.629 +{
  12.630 +    LLChat chat;
  12.631 +    std::string buffer;
  12.632 +    std::string name = agentName;
  12.633 +
  12.634 +    // NaCl - Antispam Registry
  12.635 +    if (dialog != IM_TYPING_START && dialog != IM_TYPING_STOP &&											// Typing notifications
  12.636 +        !(dialog == IM_NOTHING_SPECIAL && offline == IM_OFFLINE && from_id.notNull() && to_id.notNull()) &&	// Saved offline IMs
  12.637 +        !(dialog == IM_FROM_TASK && offline == IM_OFFLINE)													// Saved offline IMs from objects
  12.638 +        )
  12.639 +    {
  12.640 +        if (NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_IM, from_id, ANTISPAM_SOURCE_AGENT))
  12.641 +        {
  12.642 +            return;
  12.643 +        }
  12.644 +    }
  12.645 +    // NaCl End
  12.646 +
  12.647 +    // make sure that we don't have an empty or all-whitespace name
  12.648 +    LLStringUtil::trim(name);
  12.649 +    if (name.empty())
  12.650 +    {
  12.651 +        name = LLTrans::getString("Unnamed");
  12.652 +    }
  12.653 +
  12.654 +    // Preserve the unaltered name for use in group notice mute checking.
  12.655 +    std::string original_name = name;
  12.656 +
  12.657 +    // IDEVO convert new-style "Resident" names for display
  12.658 +    name = clean_name_from_im(name, dialog);
  12.659 +
  12.660 +    BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
  12.661 +    BOOL is_autorespond = gAgent.getAutorespond();
  12.662 +    BOOL is_autorespond_nonfriends = gAgent.getAutorespondNonFriends();
  12.663 +    // <FS:PP> FIRE-1245: Option to block/reject teleport offers
  12.664 +    BOOL is_rejecting_tp_offers = gAgent.getRejectTeleportOffers();
  12.665 +    static LLCachedControl<bool> FSDontRejectTeleportOffersFromFriends(gSavedPerAccountSettings, "FSDontRejectTeleportOffersFromFriends");
  12.666 +    // </FS:PP>
  12.667 +    BOOL is_rejecting_group_invites = gAgent.getRejectAllGroupInvites(); // <FS:PP> Option to block/reject all group invites
  12.668 +    BOOL is_rejecting_friendship_requests = gAgent.getRejectFriendshipRequests(); // <FS:PP> FIRE-15233: Automatic friendship request refusal
  12.669 +    BOOL is_autorespond_muted = gSavedPerAccountSettings.getBOOL("FSSendMutedAvatarResponse");
  12.670 +    BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat)
  12.671 +        // object IMs contain sender object id in session_id (STORM-1209)
  12.672 +        || (dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id));
  12.673 +    BOOL is_owned_by_me = FALSE;
  12.674 +    BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true;
  12.675 +    static LLCachedControl<bool> accept_im_from_only_friend(gSavedSettings, "VoiceCallsFriendsOnly");
  12.676 +    //BOOL is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
  12.677 +    //		LLMuteList::getInstance()->isLinden(name); <:FS:TM> Bear compie fix - is_linden not referenced
  12.678 +
  12.679 +    // <FS:PP> FIRE-10500: Autoresponse for (Away)
  12.680 +    static LLCachedControl<bool> FSSendAwayAvatarResponse(gSavedPerAccountSettings, "FSSendAwayAvatarResponse");
  12.681 +    BOOL is_afk = gAgent.getAFK();
  12.682 +    // </FS:PP>
  12.683 +
  12.684 +    chat.mMuted = is_muted;
  12.685 +    chat.mFromID = from_id;
  12.686 +    chat.mFromName = name;
  12.687 +    chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
  12.688 +    
  12.689 +    if (chat.mSourceType == CHAT_SOURCE_SYSTEM)
  12.690 +    { // Translate server message if required (MAINT-6109)
  12.691 +        translate_if_needed(message);
  12.692 +    }
  12.693 +
  12.694 +    LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
  12.695 +    if (source)
  12.696 +    {
  12.697 +        is_owned_by_me = source->permYouOwner();
  12.698 +    }
  12.699 +
  12.700 +    // NaCl - Newline flood protection
  12.701 +    static LLCachedControl<bool> useAntiSpam(gSavedSettings, "UseAntiSpam");
  12.702 +    if (useAntiSpam && dialog != IM_GROUP_INVITATION)
  12.703 +    {
  12.704 +        bool doCheck = true;
  12.705 +        if (from_id.isNull() || gAgentID == from_id)
  12.706 +        {
  12.707 +            doCheck = false;
  12.708 +        }
  12.709 +        if (doCheck && is_owned_by_me)
  12.710 +        {
  12.711 +            doCheck = false;
  12.712 +        }
  12.713 +        if (doCheck && NACLAntiSpamRegistry::instance().checkNewlineFlood(ANTISPAM_QUEUE_IM, from_id, message))
  12.714 +        {
  12.715 +            return;
  12.716 +        }
  12.717 +    }
  12.718 +    // NaCl End
  12.719 +
  12.720 +    std::string separator_string(": ");
  12.721 +
  12.722 +    LLSD args;
  12.723 +    LLSD payload;
  12.724 +    LLNotification::Params params;
  12.725 +
  12.726 +    switch(dialog)
  12.727 +    { 
  12.728 +    case IM_CONSOLE_AND_CHAT_HISTORY:
  12.729 +        args["MESSAGE"] = message;
  12.730 +        payload["from_id"] = from_id;
  12.731 +
  12.732 +        params.name = "IMSystemMessageTip";
  12.733 +        params.substitutions = args;
  12.734 +        params.payload = payload;
  12.735 +        LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false);
  12.736 +        break;
  12.737 +
  12.738 +    case IM_NOTHING_SPECIAL:	// p2p IM
  12.739 +        // Don't show dialog, just do IM
  12.740 +        if (!gAgent.isGodlike()
  12.741 +                && gAgent.getRegion()->isPrelude() 
  12.742 +                && to_id.isNull() )
  12.743 +        {
  12.744 +            // do nothing -- don't distract newbies in
  12.745 +            // Prelude with global IMs
  12.746 +        }
  12.747 +// [RLVa:KB] - Checked: RLVa-2.1.0
  12.748 +        else if ( (RlvActions::isRlvEnabled()) && (offline == IM_ONLINE) && (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) &&
  12.749 +                  (message.length() > 3) && (RLV_CMD_PREFIX == message[0]) && (RlvHandler::instance().processIMQuery(from_id, message)) )
  12.750 +        {
  12.751 +            // Eat the message and do nothing
  12.752 +            return;
  12.753 +        }
  12.754 +// [/RLVa:KB]
  12.755 +//      else if (offline == IM_ONLINE 
  12.756 +//                  && is_do_not_disturb
  12.757 +//                  && from_id.notNull() //not a system message
  12.758 +//                  && to_id.notNull()) //not global message
  12.759 +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
  12.760 +        // <FS:Ansariel> Only send the busy reponse if either the sender is not
  12.761 +        //               muted OR the sender is muted and we explicitely want
  12.762 +        //               to inform him about that fact.
  12.763 +        else if (offline == IM_ONLINE
  12.764 +                    && (!accept_im_from_only_friend || is_friend)                                    // is friend or accept IMs from friend only disabled
  12.765 +                    && ((is_do_not_disturb && (!is_muted || (is_muted && !is_autorespond_muted))) || // do not disturb
  12.766 +                        (is_autorespond && !is_muted) ||                                             // autorespond everyone
  12.767 +                        (is_autorespond_nonfriends && !is_friend && !is_muted) ||                    // autorespond friends only
  12.768 +                        (is_afk && FSSendAwayAvatarResponse && !is_muted))                           // away
  12.769 +                    && from_id.notNull() //not a system message
  12.770 +                    && to_id.notNull() //not global message
  12.771 +                    && RlvActions::canReceiveIM(from_id))
  12.772 +// [/RLVa:KB]
  12.773 +        {
  12.774 +            // <FS:Ansariel> Log autoresponse notification after initial message
  12.775 +            bool has_session = true;
  12.776 +
  12.777 +            // <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  12.778 +            // Session id will be null if avatar answers from offline IM via email
  12.779 +            std::string response;
  12.780 +            if (!gIMMgr->hasSession(session_id) && session_id.notNull())
  12.781 +            {
  12.782 +            // </FS:Ansariel>
  12.783 +                // <FS:Ansariel> Log autoresponse notification after initial message
  12.784 +                has_session = false;
  12.785 +                // <FS:Ansariel> FS autoresponse feature
  12.786 +                std::string my_name;
  12.787 +                LLAgentUI::buildFullname(my_name);
  12.788 +                if (is_do_not_disturb)
  12.789 +                {
  12.790 +                    response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse");
  12.791 +                }
  12.792 +                else if (is_autorespond_nonfriends && !is_friend)
  12.793 +                {
  12.794 +                    response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse");
  12.795 +                }
  12.796 +                else if (is_autorespond)
  12.797 +                {
  12.798 +                    response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse");
  12.799 +                }
  12.800 +                // <FS:PP> FIRE-10500: Autoresponse for (Away)
  12.801 +                else if (is_afk && FSSendAwayAvatarResponse)
  12.802 +                {
  12.803 +                    response = gSavedPerAccountSettings.getString("FSAwayAvatarResponse");
  12.804 +                }
  12.805 +                // </FS:PP>
  12.806 +                else
  12.807 +                {
  12.808 +                    LL_WARNS() << "Unknown auto-response mode" << LL_ENDL;
  12.809 +                }
  12.810 +                pack_instant_message(
  12.811 +                    gMessageSystem,
  12.812 +                    gAgent.getID(),
  12.813 +                    FALSE,
  12.814 +                    gAgent.getSessionID(),
  12.815 +                    from_id,
  12.816 +                    my_name,
  12.817 +                    response,
  12.818 +                    IM_ONLINE,
  12.819 +                    IM_DO_NOT_DISTURB_AUTO_RESPONSE,
  12.820 +                    session_id);
  12.821 +                gAgent.sendReliableMessage();
  12.822 +                // </FS:Ansariel> FS autoresponse feature
  12.823 +            // <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  12.824 +            }
  12.825 +            // </FS:Ansariel>
  12.826 +
  12.827 +            // <FS:Ansariel> checkfor and process reqinfo
  12.828 +            if (has_session)
  12.829 +            {
  12.830 +                message = FSData::getInstance()->processRequestForInfo(from_id,message,name,session_id);
  12.831 +            }
  12.832 +            // </FS:Ansariel>
  12.833 +
  12.834 +            // now store incoming IM in chat history
  12.835 +
  12.836 +            buffer = message;
  12.837 +    
  12.838 +            LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
  12.839 +
  12.840 +            // <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
  12.841 +            chat.mText = buffer;
  12.842 +            bool keyword_alert_performed = false;
  12.843 +            if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
  12.844 +            {
  12.845 +                FSKeywords::notify(chat);
  12.846 +                keyword_alert_performed = true;
  12.847 +            }
  12.848 +            // </FS:PP>
  12.849 +
  12.850 +            // add to IM panel, but do not bother the user
  12.851 +            gIMMgr->addMessage(
  12.852 +                session_id,
  12.853 +                from_id,
  12.854 +                name,
  12.855 +                buffer,
  12.856 +                IM_OFFLINE == offline,
  12.857 +                LLStringUtil::null,
  12.858 +                dialog,
  12.859 +                parent_estate_id,
  12.860 +                region_id,
  12.861 +                position,
  12.862 +                true,
  12.863 +                false,
  12.864 +                keyword_alert_performed);
  12.865 +
  12.866 +            // <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  12.867 +            //if (!gIMMgr->isDNDMessageSend(session_id))
  12.868 +            //{
  12.869 +            //	// return a standard "do not disturb" message, but only do it to online IM
  12.870 +            //	// (i.e. not other auto responses and not store-and-forward IM)
  12.871 +            //	send_do_not_disturb_message(msg, from_id, session_id);
  12.872 +            //	gIMMgr->setDNDMessageSent(session_id, true);
  12.873 +            //}
  12.874 +            // </FS:Ansariel>
  12.875 +
  12.876 +            if (!has_session)
  12.877 +            {
  12.878 +                // <FS:LO> Fire-5389 - "Autoresponse Sent" message added to Firestorm as was in Phoenix
  12.879 +                LLStringUtil::format_map_t args;
  12.880 +                args["MESSAGE"] = response;
  12.881 +
  12.882 +                gIMMgr->addMessage(
  12.883 +                    session_id,
  12.884 +                    gAgentID,
  12.885 +                    LLStringUtil::null, // Pass null value so no name gets prepended
  12.886 +                    LLTrans::getString("IM_autoresponse_sent", args),
  12.887 +                    false,
  12.888 +                    name,
  12.889 +                    IM_NOTHING_SPECIAL,
  12.890 +                    parent_estate_id,
  12.891 +                    region_id,
  12.892 +                    position,
  12.893 +                    false,
  12.894 +                    true
  12.895 +                    );
  12.896 +                // </FS:LO>
  12.897 +
  12.898 +                // <FS:Ansariel> Send inventory item on autoresponse
  12.899 +                LLUUID item_id(gSavedPerAccountSettings.getString("FSAutoresponseItemUUID"));
  12.900 +                if (item_id.notNull())
  12.901 +                {
  12.902 +                    LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(gInventory.getItem(item_id));
  12.903 +                    if (item)
  12.904 +                    {
  12.905 +                        gIMMgr->addMessage(
  12.906 +                                session_id,
  12.907 +                                gAgentID,
  12.908 +                                LLStringUtil::null, // Pass null value so no name gets prepended
  12.909 +                                LLTrans::getString("IM_autoresponse_item_sent", LLSD().with("[ITEM_NAME]", item->getName())),
  12.910 +                                false,
  12.911 +                                name,
  12.912 +                                IM_NOTHING_SPECIAL,
  12.913 +                                parent_estate_id,
  12.914 +                                region_id,
  12.915 +                                position,
  12.916 +                                false,
  12.917 +                                true);
  12.918 +                        LLGiveInventory::doGiveInventoryItem(from_id, item, session_id);
  12.919 +                    }
  12.920 +                }
  12.921 +                // </FS:Ansariel>
  12.922 +            }
  12.923 +        }
  12.924 +        else if (from_id.isNull())
  12.925 +        {
  12.926 +            LLSD args;
  12.927 +            args["MESSAGE"] = message;
  12.928 +            LLNotificationsUtil::add("SystemMessage", args);
  12.929 +        }
  12.930 +        else if (to_id.isNull())
  12.931 +        {
  12.932 +            // Message to everyone from GOD, look up the fullname since
  12.933 +            // server always slams name to legacy names
  12.934 +            LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message));
  12.935 +        }
  12.936 +        else
  12.937 +        {
  12.938 +            // standard message, not from system
  12.939 +            std::string saved;
  12.940 +            if(offline == IM_OFFLINE)
  12.941 +            {
  12.942 +                LLStringUtil::format_map_t args;
  12.943 +                args["[LONG_TIMESTAMP]"] = formatted_time(timestamp);
  12.944 +                saved = LLTrans::getString("Saved_message", args);
  12.945 +            }
  12.946 +            buffer = saved + message;
  12.947 +
  12.948 +            LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
  12.949 +
  12.950 +            bool mute_im = is_muted;
  12.951 +            if (accept_im_from_only_friend && !is_friend)
  12.952 +            {
  12.953 +                if (!gIMMgr->isNonFriendSessionNotified(session_id))
  12.954 +                {
  12.955 +                    // <FS:Ansariel> Disable this - doesn't make sense it will be skipped by LLIMMgr::addMessage() anyway
  12.956 +                    //std::string message = LLTrans::getString("IM_unblock_only_groups_friends");
  12.957 +                    //gIMMgr->addMessage(session_id, from_id, name, message, IM_OFFLINE == offline);
  12.958 +                    // </FS:Ansariel>
  12.959 +                    gIMMgr->addNotifiedNonFriendSessionID(session_id);
  12.960 +                }
  12.961 +
  12.962 +                mute_im = true;
  12.963 +            }
  12.964 +
  12.965 +// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
  12.966 +            // Don't block offline IMs, or IMs from Lindens
  12.967 +            if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!LLMuteList::getInstance()->isLinden(original_name) ))
  12.968 +            {
  12.969 +                if (!mute_im)
  12.970 +                    RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id);
  12.971 +                message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
  12.972 +            }
  12.973 +// [/RLVa:KB]
  12.974 +
  12.975 +            if (!mute_im) 
  12.976 +            {
  12.977 +                // checkfor and process reqinfo
  12.978 +                message = FSData::getInstance()->processRequestForInfo(from_id, message, name, session_id);
  12.979 +
  12.980 +                // <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
  12.981 +                chat.mText = message;
  12.982 +                bool keyword_alert_performed = false;
  12.983 +                if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
  12.984 +                {
  12.985 +                    FSKeywords::notify(chat);
  12.986 +                    keyword_alert_performed = true;
  12.987 +                }
  12.988 +                // </FS:PP>
  12.989 +
  12.990 +                buffer = saved + message;
  12.991 +
  12.992 +                gIMMgr->addMessage(
  12.993 +                    session_id,
  12.994 +                    from_id,
  12.995 +                    name,
  12.996 +                    buffer,
  12.997 +                    IM_OFFLINE == offline,
  12.998 +                    LLStringUtil::null,
  12.999 +                    dialog,
 12.1000 +                    parent_estate_id,
 12.1001 +                    region_id,
 12.1002 +                    position,
 12.1003 +                    true,
 12.1004 +                    false,
 12.1005 +                    keyword_alert_performed);
 12.1006 +            }
 12.1007 +            else
 12.1008 +            {
 12.1009 +                /*
 12.1010 +                EXT-5099
 12.1011 +                currently there is no way to store in history only...
 12.1012 +                using  LLNotificationsUtil::add will add message to Nearby Chat
 12.1013 +
 12.1014 +                // muted user, so don't start an IM session, just record line in chat
 12.1015 +                // history.  Pretend the chat is from a local agent,
 12.1016 +                // so it will go into the history but not be shown on screen.
 12.1017 +
 12.1018 +                LLSD args;
 12.1019 +                args["MESSAGE"] = buffer;
 12.1020 +                LLNotificationsUtil::add("SystemMessageTip", args);
 12.1021 +                */
 12.1022 +                static LLCachedControl<bool> fsSendMutedAvatarResponse(gSavedPerAccountSettings, "FSSendMutedAvatarResponse");
 12.1023 +                if (fsSendMutedAvatarResponse && (!accept_im_from_only_friend || is_friend))
 12.1024 +                {
 12.1025 +                    std::string my_name;
 12.1026 +                    LLAgentUI::buildFullname(my_name);
 12.1027 +                    std::string response = gSavedPerAccountSettings.getString("FSMutedAvatarResponse");
 12.1028 +                    pack_instant_message(
 12.1029 +                        gMessageSystem,
 12.1030 +                        gAgent.getID(),
 12.1031 +                        FALSE,
 12.1032 +                        gAgent.getSessionID(),
 12.1033 +                        from_id,
 12.1034 +                        my_name,
 12.1035 +                        response,
 12.1036 +                        IM_ONLINE,
 12.1037 +                        IM_DO_NOT_DISTURB_AUTO_RESPONSE,
 12.1038 +                        session_id);
 12.1039 +                    gAgent.sendReliableMessage();
 12.1040 +                }
 12.1041 +
 12.1042 +                // <FS:Ansariel> Don't flash for muted IMs
 12.1043 +                return;
 12.1044 +            }
 12.1045 +        }
 12.1046 +        break;
 12.1047 +
 12.1048 +    case IM_TYPING_START:
 12.1049 +        {
 12.1050 +            LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
 12.1051 +            gIMMgr->processIMTypingStart(im_info);
 12.1052 +        }
 12.1053 +        break;
 12.1054 +
 12.1055 +    case IM_TYPING_STOP:
 12.1056 +        {
 12.1057 +            LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
 12.1058 +            gIMMgr->processIMTypingStop(im_info);
 12.1059 +        }
 12.1060 +        break;
 12.1061 +
 12.1062 +    case IM_MESSAGEBOX:
 12.1063 +        {
 12.1064 +            // This is a block, modeless dialog.
 12.1065 +            args["MESSAGE"] = message;
 12.1066 +            LLNotificationsUtil::add("SystemMessageTip", args);
 12.1067 +        }
 12.1068 +        break;
 12.1069 +    case IM_GROUP_NOTICE:
 12.1070 +    case IM_GROUP_NOTICE_REQUESTED:
 12.1071 +        {
 12.1072 +            LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
 12.1073 +            // Read the binary bucket for more information.
 12.1074 +            struct notice_bucket_header_t
 12.1075 +            {
 12.1076 +                U8 has_inventory;
 12.1077 +                U8 asset_type;
 12.1078 +                LLUUID group_id;
 12.1079 +            };
 12.1080 +            struct notice_bucket_full_t
 12.1081 +            {
 12.1082 +                struct notice_bucket_header_t header;
 12.1083 +                U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
 12.1084 +            }* notice_bin_bucket;
 12.1085 +
 12.1086 +            // Make sure the binary bucket is big enough to hold the header 
 12.1087 +            // and a null terminated item name.
 12.1088 +            if ( (binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
 12.1089 +                || (binary_bucket[binary_bucket_size - 1] != '\0') )
 12.1090 +            {
 12.1091 +                LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
 12.1092 +                // <FS:Ansariel> Don't flash task icon
 12.1093 +                //break;
 12.1094 +                return;
 12.1095 +            }
 12.1096 +
 12.1097 +            // The group notice packet does not have an AgentID.  Obtain one from the name cache.
 12.1098 +            // If last name is "Resident" strip it out so the cache name lookup works.
 12.1099 +            std::string::size_type index = original_name.find(" Resident");
 12.1100 +            if (index != std::string::npos)
 12.1101 +            {
 12.1102 +                original_name = original_name.substr(0, index);
 12.1103 +            }
 12.1104 +
 12.1105 +            std::string legacy_name = gCacheName->buildLegacyName(original_name);
 12.1106 +            LLUUID agent_id = LLAvatarNameCache::findIdByName(legacy_name);
 12.1107 +
 12.1108 +            if (agent_id.isNull())
 12.1109 +            {
 12.1110 +                LL_WARNS("Messaging") << "buildLegacyName returned null while processing " << original_name << LL_ENDL;
 12.1111 +            }
 12.1112 +            else if (LLMuteList::getInstance()->isMuted(agent_id))
 12.1113 +            {
 12.1114 +                // <FS:Ansariel> Don't flash task icon
 12.1115 +                //break;
 12.1116 +                return;
 12.1117 +            }
 12.1118 +
 12.1119 +            notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
 12.1120 +            U8 has_inventory = notice_bin_bucket->header.has_inventory;
 12.1121 +            U8 asset_type = notice_bin_bucket->header.asset_type;
 12.1122 +            LLUUID group_id = notice_bin_bucket->header.group_id;
 12.1123 +            std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name);
 12.1124 +
 12.1125 +            // If there is inventory, give the user the inventory offer.
 12.1126 +            LLOfferInfo* info = NULL;
 12.1127 +
 12.1128 +            if (has_inventory)
 12.1129 +            {
 12.1130 +                info = new LLOfferInfo();
 12.1131 +                
 12.1132 +                info->mIM = IM_GROUP_NOTICE;
 12.1133 +                info->mFromID = from_id;
 12.1134 +                info->mFromGroup = from_group;
 12.1135 +                info->mTransactionID = session_id;
 12.1136 +                info->mType = (LLAssetType::EType) asset_type;
 12.1137 +                info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
 12.1138 +                std::string from_name;
 12.1139 +
 12.1140 +                // <FS:Ansariel> FIRE-17714: Make group notice attachment confirmation localizable
 12.1141 +                //from_name += "A group member named ";
 12.1142 +                //from_name += name;
 12.1143 +                LLStringUtil::format_map_t args;
 12.1144 +                args["NAME"] = name;
 12.1145 +                from_name += LLTrans::getString("InvOfferGroupNoticeName", args);
 12.1146 +                // </FS:Ansariel>
 12.1147 +
 12.1148 +                info->mFromName = from_name;
 12.1149 +                info->mDesc = item_name;
 12.1150 +                info->mHost = sender;
 12.1151 +            }
 12.1152 +            
 12.1153 +            std::string str(message);
 12.1154 +
 12.1155 +            // Tokenize the string.
 12.1156 +            // TODO: Support escaped tokens ("||" -> "|")
 12.1157 +            typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 12.1158 +            boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
 12.1159 +            tokenizer tokens(str, sep);
 12.1160 +            tokenizer::iterator iter = tokens.begin();
 12.1161 +
 12.1162 +            std::string subj(*iter++);
 12.1163 +            std::string mes(*iter++);
 12.1164 +
 12.1165 +            // Send the notification down the new path.
 12.1166 +            // For requested notices, we don't want to send the popups.
 12.1167 +            if (dialog != IM_GROUP_NOTICE_REQUESTED)
 12.1168 +            {
 12.1169 +                payload["subject"] = subj;
 12.1170 +                payload["message"] = mes;
 12.1171 +                payload["sender_name"] = name;
 12.1172 +                payload["sender_id"] = agent_id;
 12.1173 +                payload["group_id"] = group_id;
 12.1174 +                payload["inventory_name"] = item_name;
 12.1175 +                payload["received_time"] = LLDate::now();
 12.1176 +                if(info && info->asLLSD())
 12.1177 +                {
 12.1178 +                    payload["inventory_offer"] = info->asLLSD();
 12.1179 +                }
 12.1180 +
 12.1181 +                // <FS:Ansariel> FIRE-505: Group name not shown in notification well
 12.1182 +                //LLSD args;
 12.1183 +                //args["SUBJECT"] = subj;
 12.1184 +                //args["MESSAGE"] = mes;
 12.1185 +                //LLDate notice_date = LLDate(timestamp).notNull() ? LLDate(timestamp) : LLDate::now();
 12.1186 +                //LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(notice_date));
 12.1187 +                //make_ui_sound("UISndGroupNotice"); // <FS:PP> Group notice sound
 12.1188 +                if (group_id.isNull())
 12.1189 +                {
 12.1190 +                    LL_WARNS() << "Received group notice with null id!" << LL_ENDL;
 12.1191 +                }
 12.1192 +                gCacheName->get(group_id, true, boost::bind(&notification_group_name_cb, _2, name, subj, mes, payload, timestamp));
 12.1193 +                // </FS:Ansariel>
 12.1194 +            }
 12.1195 +
 12.1196 +            // Also send down the old path for now.
 12.1197 +            if (IM_GROUP_NOTICE_REQUESTED == dialog)
 12.1198 +            {
 12.1199 +                
 12.1200 +                LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info);
 12.1201 +            }
 12.1202 +            else
 12.1203 +            {
 12.1204 +                delete info;
 12.1205 +            }
 12.1206 +        }
 12.1207 +        break;
 12.1208 +    case IM_GROUP_INVITATION:
 12.1209 +        {
 12.1210 +            // <FS:Ansariel> FIRE-20385: Don't show group invitation for groups agent is already a member of
 12.1211 +            if (gAgent.isInGroup(from_id) && !gSavedSettings.getBOOL("FSShowJoinedGroupInvitations"))
 12.1212 +            {
 12.1213 +                LL_INFOS("Messaging") << "Received group invitation for group " << from_id << " but we are already a member" << LL_ENDL;
 12.1214 +                return;
 12.1215 +            }
 12.1216 +            // </FS:Ansariel>
 12.1217 +
 12.1218 +            if (!is_muted)
 12.1219 +            {
 12.1220 +                // group is not blocked, but we still need to check agent that sent the invitation
 12.1221 +                // and we have no agent's id
 12.1222 +                // Note: server sends username "first.last".
 12.1223 +                is_muted |= LLMuteList::getInstance()->isMuted(name);
 12.1224 +            }
 12.1225 +            if (is_do_not_disturb || is_muted)
 12.1226 +            {
 12.1227 +                send_do_not_disturb_message(gMessageSystem, from_id);
 12.1228 +            }
 12.1229 +            
 12.1230 +            if (!is_muted)
 12.1231 +            {
 12.1232 +                LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL;
 12.1233 +                // Read the binary bucket for more information.
 12.1234 +                struct invite_bucket_t
 12.1235 +                {
 12.1236 +                    S32 membership_fee;
 12.1237 +                    LLUUID role_id;
 12.1238 +                }* invite_bucket;
 12.1239 +
 12.1240 +                // Make sure the binary bucket is the correct size.
 12.1241 +                if (binary_bucket_size != sizeof(invite_bucket_t))
 12.1242 +                {
 12.1243 +                    LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL;
 12.1244 +                    // <FS:Ansariel> Don't flash task icon
 12.1245 +                    //break;
 12.1246 +                    return;
 12.1247 +                }
 12.1248 +
 12.1249 +                invite_bucket = (struct invite_bucket_t*) &binary_bucket[0];
 12.1250 +                S32 membership_fee = ntohl(invite_bucket->membership_fee);
 12.1251 +
 12.1252 +                LLSD payload;
 12.1253 +                payload["transaction_id"] = session_id;
 12.1254 +                payload["group_id"] = from_id;
 12.1255 +                payload["name"] = name;
 12.1256 +                payload["message"] = message;
 12.1257 +                payload["fee"] = membership_fee;
 12.1258 +
 12.1259 +                LLSD args;
 12.1260 +                args["MESSAGE"] = message;
 12.1261 +                // we shouldn't pass callback functor since it is registered in LLFunctorRegistration
 12.1262 +
 12.1263 +                // <FS:PP> Option to block/reject all group invites
 12.1264 +                // LLNotificationsUtil::add("JoinGroup", args, payload);
 12.1265 +                if (is_rejecting_group_invites)
 12.1266 +                {
 12.1267 +                    LL_INFOS("Messaging") << "Group invite automatically rejected because of the user setting..." << LL_ENDL;
 12.1268 +                    return;
 12.1269 +                }
 12.1270 +                else
 12.1271 +                {
 12.1272 +                    make_ui_sound("UISndGroupInvitation"); // <FS:PP> Group invitation sound
 12.1273 +                    LLNotificationsUtil::add("JoinGroup", args, payload);
 12.1274 +                }
 12.1275 +                // </FS:PP>
 12.1276 +            }
 12.1277 +            // <FS:Ansariel> Don't flash task icon for group messages from muted senders
 12.1278 +            else
 12.1279 +            {
 12.1280 +                return;
 12.1281 +            }
 12.1282 +            // </FS:Ansariel>
 12.1283 +        }
 12.1284 +        break;
 12.1285 +
 12.1286 +    case IM_INVENTORY_OFFERED:
 12.1287 +    case IM_TASK_INVENTORY_OFFERED:
 12.1288 +        // Someone has offered us some inventory.
 12.1289 +        {
 12.1290 +            LLOfferInfo* info = new LLOfferInfo;
 12.1291 +            if (IM_INVENTORY_OFFERED == dialog)
 12.1292 +            {
 12.1293 +                struct offer_agent_bucket_t
 12.1294 +                {
 12.1295 +                    S8		asset_type;
 12.1296 +                    LLUUID	object_id;
 12.1297 +                }* bucketp;
 12.1298 +
 12.1299 +                if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
 12.1300 +                {
 12.1301 +                    LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL;
 12.1302 +                    delete info;
 12.1303 +                    // <FS:Ansariel> Don't flash task icon
 12.1304 +                    //break;
 12.1305 +                    return; 
 12.1306 +                }
 12.1307 +                bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
 12.1308 +                info->mType = (LLAssetType::EType) bucketp->asset_type;
 12.1309 +                info->mObjectID = bucketp->object_id;
 12.1310 +                info->mFromObject = FALSE;
 12.1311 +            }
 12.1312 +            else // IM_TASK_INVENTORY_OFFERED
 12.1313 +            {
 12.1314 +                if (sizeof(S8) != binary_bucket_size)
 12.1315 +                {
 12.1316 +                    LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL;
 12.1317 +                    delete info;
 12.1318 +                    // <FS:Ansariel> Don't flash task icon
 12.1319 +                    //break;
 12.1320 +                    return; 
 12.1321 +                }
 12.1322 +                info->mType = (LLAssetType::EType) binary_bucket[0];
 12.1323 +                info->mObjectID = LLUUID::null;
 12.1324 +                info->mFromObject = TRUE;
 12.1325 +            }
 12.1326 +
 12.1327 +            info->mIM = dialog;
 12.1328 +            info->mFromID = from_id;
 12.1329 +            info->mFromGroup = from_group;
 12.1330 +            info->mTransactionID = session_id;
 12.1331 +            info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
 12.1332 +
 12.1333 +            info->mFromName = name;
 12.1334 +            info->mDesc = message;
 12.1335 +            info->mHost = sender;
 12.1336 +            //if (((is_do_not_disturb && !is_owned_by_me) || is_muted))
 12.1337 +            if (is_muted)
 12.1338 +            {
 12.1339 +                // Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
 12.1340 +                LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
 12.1341 +                fetch_item->startFetch();
 12.1342 +                delete fetch_item;
 12.1343 +
 12.1344 +                // Same as closing window
 12.1345 +                info->forceResponse(IOR_DECLINE);
 12.1346 +            }
 12.1347 +            // old logic: busy mode must not affect interaction with objects (STORM-565)
 12.1348 +            // new logic: inventory offers from in-world objects should be auto-declined (CHUI-519)
 12.1349 +            else if (is_do_not_disturb && dialog == IM_TASK_INVENTORY_OFFERED)
 12.1350 +            {
 12.1351 +                // Until throttling is implemented, do not disturb mode should reject inventory instead of silently
 12.1352 +                // accepting it.  SEE SL-39554
 12.1353 +                info->forceResponse(IOR_DECLINE);
 12.1354 +            }
 12.1355 +            else
 12.1356 +            {
 12.1357 +                inventory_offer_handler(info);
 12.1358 +            }
 12.1359 +        }
 12.1360 +        break;
 12.1361 +
 12.1362 +    case IM_INVENTORY_ACCEPTED:
 12.1363 +    {
 12.1364 +//      args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
 12.1365 +//      args["ORIGINAL_NAME"] = original_name;
 12.1366 +// [RLVa:KB] - Checked: RLVa-1.2.2
 12.1367 +        // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open
 12.1368 +        LLAvatarName av_name;
 12.1369 +        bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
 12.1370 +            (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id));
 12.1371 +        args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();;
 12.1372 +        args["ORIGINAL_NAME"] = fRlvCanShowName ? original_name : (LLAvatarNameCache::get(from_id, &av_name) ? RlvStrings::getAnonym(av_name) : RlvStrings::getAnonym(original_name));
 12.1373 +// [/RLVa:KB]
 12.1374 +        LLSD payload;
 12.1375 +        payload["from_id"] = from_id;
 12.1376 +        // Passing the "SESSION_NAME" to use it for IM notification logging
 12.1377 +        // in LLTipHandler::processNotification(). See STORM-941.
 12.1378 +        payload["SESSION_NAME"] = name;
 12.1379 +        LLNotificationsUtil::add("InventoryAccepted", args, payload);
 12.1380 +        break;
 12.1381 +    }
 12.1382 +    case IM_INVENTORY_DECLINED:
 12.1383 +    {
 12.1384 +//      args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
 12.1385 +// [RLVa:KB] - Checked: RLVa-1.2.2
 12.1386 +        // Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open
 12.1387 +        bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
 12.1388 +            (RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id));
 12.1389 +        args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();;
 12.1390 +// [/RLVa:KB]
 12.1391 +        LLSD payload;
 12.1392 +        payload["from_id"] = from_id;
 12.1393 +        LLNotificationsUtil::add("InventoryDeclined", args, payload);
 12.1394 +        break;
 12.1395 +    }
 12.1396 +    // TODO: _DEPRECATED suffix as part of vote removal - DEV-24856
 12.1397 +    case IM_GROUP_VOTE:
 12.1398 +        {
 12.1399 +            LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL;
 12.1400 +        }
 12.1401 +        break;
 12.1402 +
 12.1403 +    case IM_GROUP_ELECTION_DEPRECATED:
 12.1404 +    {
 12.1405 +        LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL;
 12.1406 +    }
 12.1407 +    break;
 12.1408 +    
 12.1409 +    case IM_FROM_TASK:
 12.1410 +        {
 12.1411 +
 12.1412 +            if (is_do_not_disturb && !is_owned_by_me)
 12.1413 +            {
 12.1414 +                return;
 12.1415 +            }
 12.1416 +
 12.1417 +            // <FS:PP> FIRE-6406: Feature to disable Object Return notification
 12.1418 +            static LLCachedControl<bool> FSDisableReturnObjectNotification(gSavedSettings, "FSDisableReturnObjectNotification");
 12.1419 +            if (FSDisableReturnObjectNotification)
 12.1420 +            {
 12.1421 +                if (message.find("been returned to your inventory") != -1)
 12.1422 +                {
 12.1423 +                    return;
 12.1424 +                }
 12.1425 +            }
 12.1426 +            // </FS:PP>
 12.1427 +
 12.1428 +            // Build a link to open the object IM info window.
 12.1429 +            std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size - 1);
 12.1430 +
 12.1431 +            if (session_id.notNull())
 12.1432 +            {
 12.1433 +                chat.mFromID = session_id;
 12.1434 +            }
 12.1435 +            else
 12.1436 +            {
 12.1437 +                // This message originated on a region without the updated code for task id and slurl information.
 12.1438 +                // We just need a unique ID for this object that isn't the owner ID.
 12.1439 +                // If it is the owner ID it will overwrite the style that contains the link to that owner's profile.
 12.1440 +                // This isn't ideal - it will make 1 style for all objects owned by the the same person/group.
 12.1441 +                // This works because the only thing we can really do in this case is show the owner name and link to their profile.
 12.1442 +                chat.mFromID = from_id ^ gAgent.getSessionID();
 12.1443 +            }
 12.1444 +
 12.1445 +            chat.mSourceType = CHAT_SOURCE_OBJECT;
 12.1446 +            chat.mChatType = CHAT_TYPE_IM;
 12.1447 +
 12.1448 +            // To conclude that the source type of message is CHAT_SOURCE_SYSTEM it's not
 12.1449 +            // enough to check only from name (i.e. fromName = "Second Life"). For example
 12.1450 +            // source type of messages from objects called "Second Life" should not be CHAT_SOURCE_SYSTEM.
 12.1451 +            bool chat_from_system = (SYSTEM_FROM == name) && region_id.isNull() && position.isNull();
 12.1452 +            if(chat_from_system)
 12.1453 +            {
 12.1454 +                // System's UUID is NULL (fixes EXT-4766)
 12.1455 +                chat.mFromID = LLUUID::null;
 12.1456 +                chat.mSourceType = CHAT_SOURCE_SYSTEM;
 12.1457 +            }
 12.1458 +
 12.1459 +            // IDEVO Some messages have embedded resident names
 12.1460 +            message = clean_name_from_task_im(message, from_group);
 12.1461 +
 12.1462 +            LLSD query_string;
 12.1463 +            query_string["owner"] = from_id;
 12.1464 +// [RLVa:KB] - Checked: RLVa-1.2.0
 12.1465 +            if (RlvActions::isRlvEnabled())
 12.1466 +            {
 12.1467 +                // NOTE: the chat message itself will be filtered in LLNearbyChatHandler::processChat()
 12.1468 +                if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) && (!from_group) && (RlvUtil::isNearbyAgent(from_id)) )
 12.1469 +                {
 12.1470 +                    query_string["rlv_shownames"] = TRUE;
 12.1471 +
 12.1472 +                    RlvUtil::filterNames(name);
 12.1473 +                    chat.mFromName = name;
 12.1474 +                }
 12.1475 +                if (!RlvActions::canShowLocation())
 12.1476 +                {
 12.1477 +                    std::string::size_type idxPos = location.find('/');
 12.1478 +                    if ( (std::string::npos != idxPos) && (RlvUtil::isNearbyRegion(location.substr(0, idxPos))) )
 12.1479 +                        location = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
 12.1480 +                }
 12.1481 +            }
 12.1482 +// [/RLVa:KB]
 12.1483 +            query_string["slurl"] = location;
 12.1484 +            query_string["name"] = name;
 12.1485 +            if (from_group)
 12.1486 +            {
 12.1487 +                query_string["groupowned"] = "true";
 12.1488 +            }	
 12.1489 +
 12.1490 +//          chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
 12.1491 +// [SL:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Added: RLVa-1.2.2a
 12.1492 +            chat.mURL = LLSLURL("objectim", session_id, LLURI::mapToQueryString(query_string)).getSLURLString();
 12.1493 +// [/SL:KB]
 12.1494 +            chat.mText = message;
 12.1495 +
 12.1496 +            // <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of Task IM)
 12.1497 +            if (FSKeywords::getInstance()->chatContainsKeyword(chat, true))
 12.1498 +            {
 12.1499 +                FSKeywords::notify(chat);
 12.1500 +            }
 12.1501 +            // </FS:PP>
 12.1502 +
 12.1503 +            // Note: lie to Nearby Chat, pretending that this is NOT an IM, because
 12.1504 +            // IMs from obejcts don't open IM sessions.
 12.1505 +            // <FS:Ansariel> [FS communication UI]
 12.1506 +            //LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
 12.1507 +            FSFloaterNearbyChat* nearby_chat = FSFloaterNearbyChat::getInstance();
 12.1508 +            // </FS:Ansariel> [FS communication UI]
 12.1509 +            if(!chat_from_system && nearby_chat)
 12.1510 +            {
 12.1511 +                chat.mOwnerID = from_id;
 12.1512 +                LLSD args;
 12.1513 +                args["slurl"] = location;
 12.1514 +
 12.1515 +                // Look for IRC-style emotes here so object name formatting is correct
 12.1516 +                // <FS:Ansariel> Consolidate IRC /me prefix checks
 12.1517 +                //std::string prefix = message.substr(0, 4);
 12.1518 +                //if (prefix == "/me " || prefix == "/me'")
 12.1519 +                if (is_irc_me_prefix(message))
 12.1520 +                // </FS:Ansariel>
 12.1521 +                {
 12.1522 +                    chat.mChatStyle = CHAT_STYLE_IRC;
 12.1523 +                }
 12.1524 +
 12.1525 +                LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
 12.1526 +            }
 12.1527 +
 12.1528 +
 12.1529 +            //Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590)
 12.1530 +            if (!chat_from_system) break;
 12.1531 +            
 12.1532 +            LLSD substitutions;
 12.1533 +            substitutions["NAME"] = name;
 12.1534 +            substitutions["MSG"] = message;
 12.1535 +
 12.1536 +            LLSD payload;
 12.1537 +            payload["object_id"] = session_id;
 12.1538 +            payload["owner_id"] = from_id;
 12.1539 +            payload["from_id"] = from_id;
 12.1540 +            payload["slurl"] = location;
 12.1541 +            payload["name"] = name;
 12.1542 +
 12.1543 +            if (from_group)
 12.1544 +            {
 12.1545 +                payload["group_owned"] = "true";
 12.1546 +            }
 12.1547 +
 12.1548 +            LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload);
 12.1549 +        }
 12.1550 +        break;
 12.1551 +
 12.1552 +    case IM_SESSION_SEND:		// ad-hoc or group IMs
 12.1553 +
 12.1554 +        // Only show messages if we have a session open (which
 12.1555 +        // should happen after you get an "invitation"
 12.1556 +// [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2012-06-16 (Catznip-3.3)
 12.1557 +        //if ( !gIMMgr->hasSession(session_id) )
 12.1558 +        if ( (!gIMMgr->hasSession(session_id)) &&
 12.1559 +             ( (!gAgent.isInGroup(session_id)) || (!gIMMgr->checkSnoozeExpiration(session_id)) || LLAvatarActions::isBlocked(from_id) || (!gIMMgr->restoreSnoozedSession(session_id)) ) )
 12.1560 +// [/SL:KB]
 12.1561 +        {
 12.1562 +            return;
 12.1563 +        }
 12.1564 +
 12.1565 +        else if (offline == IM_ONLINE && is_do_not_disturb)
 12.1566 +        {
 12.1567 +
 12.1568 +            // return a standard "do not disturb" message, but only do it to online IM 
 12.1569 +            // (i.e. not other auto responses and not store-and-forward IM)
 12.1570 +            if (!gIMMgr->hasSession(session_id))
 12.1571 +            {
 12.1572 +                // if there is not a panel for this conversation (i.e. it is a new IM conversation
 12.1573 +                // initiated by the other party) then...
 12.1574 +                send_do_not_disturb_message(gMessageSystem, from_id, session_id);
 12.1575 +            }
 12.1576 +
 12.1577 +            // now store incoming IM in chat history
 12.1578 +
 12.1579 +            buffer = message;
 12.1580 +    
 12.1581 +            LL_DEBUGS("Messaging") << "message in dnd; session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 12.1582 +
 12.1583 +            // add to IM panel, but do not bother the user
 12.1584 +            gIMMgr->addMessage(
 12.1585 +                session_id,
 12.1586 +                from_id,
 12.1587 +                name,
 12.1588 +                buffer,
 12.1589 +                IM_OFFLINE == offline,
 12.1590 +                ll_safe_string((char*)binary_bucket),
 12.1591 +                IM_SESSION_INVITE,
 12.1592 +                parent_estate_id,
 12.1593 +                region_id,
 12.1594 +                position,
 12.1595 +                true);
 12.1596 +        }
 12.1597 +        else
 12.1598 +        {
 12.1599 +
 12.1600 +            // <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
 12.1601 +            chat.mText = message;
 12.1602 +            bool keyword_alert_performed = false;
 12.1603 +            if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
 12.1604 +            {
 12.1605 +                FSKeywords::notify(chat);
 12.1606 +                keyword_alert_performed = true;
 12.1607 +            }
 12.1608 +            // </FS:PP>
 12.1609 +
 12.1610 +            // standard message, not from system
 12.1611 +            std::string saved;
 12.1612 +            if(offline == IM_OFFLINE)
 12.1613 +            {
 12.1614 +                saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str());
 12.1615 +            }
 12.1616 +
 12.1617 +            buffer = saved + message;
 12.1618 +
 12.1619 +            LL_DEBUGS("Messaging") << "standard message session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 12.1620 +
 12.1621 +            gIMMgr->addMessage(
 12.1622 +                session_id,
 12.1623 +                from_id,
 12.1624 +                name,
 12.1625 +                buffer,
 12.1626 +                IM_OFFLINE == offline,
 12.1627 +                ll_safe_string((char*)binary_bucket),
 12.1628 +                IM_SESSION_INVITE,
 12.1629 +                parent_estate_id,
 12.1630 +                region_id,
 12.1631 +                position,
 12.1632 +                true,
 12.1633 +                false,
 12.1634 +                keyword_alert_performed);
 12.1635 +        }
 12.1636 +        break;
 12.1637 +
 12.1638 +    case IM_FROM_TASK_AS_ALERT:
 12.1639 +        if (is_do_not_disturb && !is_owned_by_me)
 12.1640 +        {
 12.1641 +            return;
 12.1642 +        }
 12.1643 +        {
 12.1644 +            // Construct a viewer alert for this message.
 12.1645 +            args["NAME"] = name;
 12.1646 +            args["MESSAGE"] = message;
 12.1647 +            LLNotificationsUtil::add("ObjectMessage", args);
 12.1648 +        }
 12.1649 +        break;
 12.1650 +    case IM_DO_NOT_DISTURB_AUTO_RESPONSE:
 12.1651 +        if (is_muted)
 12.1652 +        {
 12.1653 +            LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL;
 12.1654 +            return;
 12.1655 +        }
 12.1656 +        else
 12.1657 +        {
 12.1658 +            // <FS:Ansariel> FIRE-12908: Add busy response indicator back to busy messages
 12.1659 +            //gIMMgr->addMessage(session_id, from_id, name, message);
 12.1660 +            buffer = llformat("(%s): %s", LLTrans::getString("BusyResponse").c_str(), message.c_str());
 12.1661 +            gIMMgr->addMessage(session_id, from_id, name, buffer);
 12.1662 +            // </FS:Ansariel>
 12.1663 +        }
 12.1664 +        break;
 12.1665 +        
 12.1666 +    case IM_LURE_USER:
 12.1667 +    case IM_TELEPORT_REQUEST:
 12.1668 +        {
 12.1669 +// [RLVa:KB] - Checked: RLVa-1.4.9
 12.1670 +            // If we auto-accept the offer/request then this will override DnD status (but we'll still let the other party know later)
 12.1671 +            bool fRlvAutoAccept = (rlv_handler_t::isEnabled()) &&
 12.1672 +                ( ((IM_LURE_USER == dialog) && (RlvActions::autoAcceptTeleportOffer(from_id))) ||
 12.1673 +                  ((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) );
 12.1674 +// [/RLVa:KB]
 12.1675 +
 12.1676 +            if (is_muted)
 12.1677 +            { 
 12.1678 +                return;
 12.1679 +            }
 12.1680 +
 12.1681 +            // <FS:PP> FIRE-1245: Option to block/reject teleport offers
 12.1682 +            //else if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL))
 12.1683 +            //{
 12.1684 +            //	return;
 12.1685 +            //}
 12.1686 +            else if ( (is_rejecting_tp_offers && (!FSDontRejectTeleportOffersFromFriends || (FSDontRejectTeleportOffersFromFriends && !is_friend))) && (!fRlvAutoAccept) )
 12.1687 +            {
 12.1688 +                send_rejecting_tp_offers_message(gMessageSystem, from_id);
 12.1689 +            }
 12.1690 +            // </FS:PP>
 12.1691 +            else
 12.1692 +            {
 12.1693 +//              if (is_do_not_disturb)
 12.1694 +// [RLVa:KB] - Checked: RLVa-1.4.9
 12.1695 +                if ( (is_do_not_disturb) && (!fRlvAutoAccept) )
 12.1696 +// [/RLVa:KB]
 12.1697 +                {
 12.1698 +                    send_do_not_disturb_message(gMessageSystem, from_id);
 12.1699 +                }
 12.1700 +
 12.1701 +                LLVector3 pos, look_at;
 12.1702 +                U64 region_handle(0);
 12.1703 +                U8 region_access(SIM_ACCESS_MIN);
 12.1704 +                std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
 12.1705 +                std::string region_access_str = LLStringUtil::null;
 12.1706 +                std::string region_access_icn = LLStringUtil::null;
 12.1707 +                std::string region_access_lc  = LLStringUtil::null;
 12.1708 +
 12.1709 +                bool canUserAccessDstRegion = true;
 12.1710 +                bool doesUserRequireMaturityIncrease = false;
 12.1711 +
 12.1712 +                // Do not parse the (empty) lure bucket for TELEPORT_REQUEST
 12.1713 +                if (IM_TELEPORT_REQUEST != dialog && parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
 12.1714 +                {
 12.1715 +                    region_access_str = LLViewerRegion::accessToString(region_access);
 12.1716 +                    region_access_icn = LLViewerRegion::getAccessIcon(region_access);
 12.1717 +                    region_access_lc  = region_access_str;
 12.1718 +                    LLStringUtil::toLower(region_access_lc);
 12.1719 +
 12.1720 +                    if (!gAgent.isGodlike())
 12.1721 +                    {
 12.1722 +                        switch (region_access)
 12.1723 +                        {
 12.1724 +                        case SIM_ACCESS_MIN :
 12.1725 +                        case SIM_ACCESS_PG :
 12.1726 +                            break;
 12.1727 +                        case SIM_ACCESS_MATURE :
 12.1728 +                            if (gAgent.isTeen())
 12.1729 +                            {
 12.1730 +                                canUserAccessDstRegion = false;
 12.1731 +                            }
 12.1732 +                            else if (gAgent.prefersPG())
 12.1733 +                            {
 12.1734 +                                doesUserRequireMaturityIncrease = true;
 12.1735 +                            }
 12.1736 +                            break;
 12.1737 +                        case SIM_ACCESS_ADULT :
 12.1738 +                            if (!gAgent.isAdult())
 12.1739 +                            {
 12.1740 +                                canUserAccessDstRegion = false;
 12.1741 +                            }
 12.1742 +                            else if (!gAgent.prefersAdult())
 12.1743 +                            {
 12.1744 +                                doesUserRequireMaturityIncrease = true;
 12.1745 +                            }
 12.1746 +                            break;
 12.1747 +                        default :
 12.1748 +                            llassert(0);
 12.1749 +                            break;
 12.1750 +                        }
 12.1751 +                    }
 12.1752 +                }
 12.1753 +
 12.1754 +// [RLVa:KB] - Checked: RLVa-1.4.9
 12.1755 +                if (rlv_handler_t::isEnabled())
 12.1756 +                {
 12.1757 +                    if ( ((IM_LURE_USER == dialog) && (!RlvActions::canAcceptTpOffer(from_id))) ||
 12.1758 +                         ((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) )
 12.1759 +                    {
 12.1760 +                        RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLUREREQ_REMOTE));
 12.1761 +                        if (is_do_not_disturb)
 12.1762 +                            send_do_not_disturb_message(gMessageSystem, from_id);
 12.1763 +                        return;
 12.1764 +                    }
 12.1765 +
 12.1766 +                    // Censor message if: 1) restricted from receiving IMs from the sender, or 2) teleport offer/request and @showloc=n restricted
 12.1767 +                    if ( (!RlvActions::canReceiveIM(from_id)) || 
 12.1768 +                         ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (IM_LURE_USER == dialog || IM_TELEPORT_REQUEST == dialog)) )
 12.1769 +                    {
 12.1770 +                        message = RlvStrings::getString(RLV_STRING_HIDDEN);
 12.1771 +                    }
 12.1772 +                }
 12.1773 +// [/RLVa:KB]
 12.1774 +
 12.1775 +                LLSD args;
 12.1776 +                // *TODO: Translate -> [FIRST] [LAST] (maybe)
 12.1777 +// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
 12.1778 +                args["NAME_LABEL"] = LLSLURL("agent", from_id, "completename").getSLURLString();
 12.1779 +// [/SL:KB]
 12.1780 +                args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 12.1781 +                args["MESSAGE"] = message;
 12.1782 +                args["MATURITY_STR"] = region_access_str;
 12.1783 +                args["MATURITY_ICON"] = region_access_icn;
 12.1784 +                args["REGION_CONTENT_MATURITY"] = region_access_lc;
 12.1785 +                LLSD payload;
 12.1786 +                payload["from_id"] = from_id;
 12.1787 +                payload["lure_id"] = session_id;
 12.1788 +                payload["godlike"] = FALSE;
 12.1789 +                payload["region_maturity"] = region_access;
 12.1790 +
 12.1791 +                // <FS:Ansariel> FIRE-6786: Always show teleport location in teleport offer
 12.1792 +                if (dialog == IM_LURE_USER && (!rlv_handler_t::isEnabled() || !fRlvAutoAccept) && LLGridManager::instance().isInSecondLife())
 12.1793 +                {
 12.1794 +                    LLVector3d pos_global = from_region_handle(region_handle);
 12.1795 +                    pos_global += LLVector3d(pos);
 12.1796 +                    LLLandmarkActions::getSLURLfromPosGlobal(pos_global, boost::bind(&teleport_region_info_cb, _1, args, payload, from_id, session_id, canUserAccessDstRegion, doesUserRequireMaturityIncrease));
 12.1797 +                    return;
 12.1798 +                }
 12.1799 +                // </FS:Ansariel>
 12.1800 +
 12.1801 +                if (!canUserAccessDstRegion)
 12.1802 +                {
 12.1803 +                    LLNotification::Params params("TeleportOffered_MaturityBlocked");
 12.1804 +                    params.substitutions = args;
 12.1805 +                    params.payload = payload;
 12.1806 +                    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 12.1807 +                    send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
 12.1808 +                    send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
 12.1809 +                }
 12.1810 +                else if (doesUserRequireMaturityIncrease)
 12.1811 +                {
 12.1812 +                    LLNotification::Params params("TeleportOffered_MaturityExceeded");
 12.1813 +                    params.substitutions = args;
 12.1814 +                    params.payload = payload;
 12.1815 +                    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 12.1816 +                }
 12.1817 +                else
 12.1818 +                {
 12.1819 +                    LLNotification::Params params;
 12.1820 +                    if (IM_LURE_USER == dialog)
 12.1821 +                    {
 12.1822 +                        params.name = "TeleportOffered";
 12.1823 +                        params.functor.name = "TeleportOffered";
 12.1824 +                    }
 12.1825 +                    else if (IM_TELEPORT_REQUEST == dialog)
 12.1826 +                    {
 12.1827 +                        params.name = "TeleportRequest";
 12.1828 +                        params.functor.name = "TeleportRequest";
 12.1829 +                    }
 12.1830 +
 12.1831 +                    params.substitutions = args;
 12.1832 +                    params.payload = payload;
 12.1833 +
 12.1834 +// [RLVa:KB] - Checked: RLVa-1.4.9
 12.1835 +                    if (fRlvAutoAccept)
 12.1836 +                    {
 12.1837 +                        if (IM_LURE_USER == dialog)
 12.1838 +                            gRlvHandler.setCanCancelTp(false);
 12.1839 +                        if (is_do_not_disturb)
 12.1840 +                            send_do_not_disturb_message(gMessageSystem, from_id);
 12.1841 +                        LLNotifications::instance().forceResponse(LLNotification::Params(params.name).payload(payload), 0);
 12.1842 +                    }
 12.1843 +                    else
 12.1844 +                    {
 12.1845 +                        LLPostponedNotification::add<LLPostponedOfferNotification>(params, from_id, false);
 12.1846 +                    }
 12.1847 +// [/RLVa:KB]
 12.1848 +//                  LLPostponedNotification::add<LLPostponedOfferNotification>(params, from_id, false);
 12.1849 +                }
 12.1850 +            }
 12.1851 +        }
 12.1852 +        break;
 12.1853 +
 12.1854 +    case IM_GODLIKE_LURE_USER:
 12.1855 +        {
 12.1856 +            LLVector3 pos, look_at;
 12.1857 +            U64 region_handle(0);
 12.1858 +            U8 region_access(SIM_ACCESS_MIN);
 12.1859 +            std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
 12.1860 +            std::string region_access_str = LLStringUtil::null;
 12.1861 +            std::string region_access_icn = LLStringUtil::null;
 12.1862 +            std::string region_access_lc  = LLStringUtil::null;
 12.1863 +
 12.1864 +            bool canUserAccessDstRegion = true;
 12.1865 +            bool doesUserRequireMaturityIncrease = false;
 12.1866 +
 12.1867 +            if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
 12.1868 +            {
 12.1869 +                region_access_str = LLViewerRegion::accessToString(region_access);
 12.1870 +                region_access_icn = LLViewerRegion::getAccessIcon(region_access);
 12.1871 +                region_access_lc  = region_access_str;
 12.1872 +                LLStringUtil::toLower(region_access_lc);
 12.1873 +
 12.1874 +                if (!gAgent.isGodlike())
 12.1875 +                {
 12.1876 +                    switch (region_access)
 12.1877 +                    {
 12.1878 +                    case SIM_ACCESS_MIN :
 12.1879 +                    case SIM_ACCESS_PG :
 12.1880 +                        break;
 12.1881 +                    case SIM_ACCESS_MATURE :
 12.1882 +                        if (gAgent.isTeen())
 12.1883 +                        {
 12.1884 +                            canUserAccessDstRegion = false;
 12.1885 +                        }
 12.1886 +                        else if (gAgent.prefersPG())
 12.1887 +                        {
 12.1888 +                            doesUserRequireMaturityIncrease = true;
 12.1889 +                        }
 12.1890 +                        break;
 12.1891 +                    case SIM_ACCESS_ADULT :
 12.1892 +                        if (!gAgent.isAdult())
 12.1893 +                        {
 12.1894 +                            canUserAccessDstRegion = false;
 12.1895 +                        }
 12.1896 +                        else if (!gAgent.prefersAdult())
 12.1897 +                        {
 12.1898 +                            doesUserRequireMaturityIncrease = true;
 12.1899 +                        }
 12.1900 +                        break;
 12.1901 +                    default :
 12.1902 +                        llassert(0);
 12.1903 +                        break;
 12.1904 +                    }
 12.1905 +                }
 12.1906 +            }
 12.1907 +
 12.1908 +            LLSD args;
 12.1909 +            // *TODO: Translate -> [FIRST] [LAST] (maybe)
 12.1910 +            args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 12.1911 +            args["MESSAGE"] = message;
 12.1912 +            args["MATURITY_STR"] = region_access_str;
 12.1913 +            args["MATURITY_ICON"] = region_access_icn;
 12.1914 +            args["REGION_CONTENT_MATURITY"] = region_access_lc;
 12.1915 +            LLSD payload;
 12.1916 +            payload["from_id"] = from_id;
 12.1917 +            payload["lure_id"] = session_id;
 12.1918 +            payload["godlike"] = TRUE;
 12.1919 +            payload["region_maturity"] = region_access;
 12.1920 +
 12.1921 +            if (!canUserAccessDstRegion)
 12.1922 +            {
 12.1923 +                LLNotification::Params params("TeleportOffered_MaturityBlocked");
 12.1924 +                params.substitutions = args;
 12.1925 +                params.payload = payload;
 12.1926 +                LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 12.1927 +                send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
 12.1928 +                send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
 12.1929 +            }
 12.1930 +            else if (doesUserRequireMaturityIncrease)
 12.1931 +            {
 12.1932 +                LLNotification::Params params("TeleportOffered_MaturityExceeded");
 12.1933 +                params.substitutions = args;
 12.1934 +                params.payload = payload;
 12.1935 +                LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 12.1936 +            }
 12.1937 +            else
 12.1938 +            {
 12.1939 +            // do not show a message box, because you're about to be
 12.1940 +            // teleported.
 12.1941 +            LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0);
 12.1942 +        }
 12.1943 +        }
 12.1944 +        break;
 12.1945 +
 12.1946 +    case IM_GOTO_URL:
 12.1947 +        {
 12.1948 +            LLSD args;
 12.1949 +            // n.b. this is for URLs sent by the system, not for
 12.1950 +            // URLs sent by scripts (i.e. llLoadURL)
 12.1951 +            if (binary_bucket_size <= 0)
 12.1952 +            {
 12.1953 +                LL_WARNS("Messaging") << "bad binary_bucket_size: "
 12.1954 +                    << binary_bucket_size
 12.1955 +                    << " - aborting function." << LL_ENDL;
 12.1956 +                return;
 12.1957 +            }
 12.1958 +
 12.1959 +            std::string url;
 12.1960 +
 12.1961 +            url.assign((char*)binary_bucket, binary_bucket_size - 1);
 12.1962 +            args["MESSAGE"] = message;
 12.1963 +            args["URL"] = url;
 12.1964 +            LLSD payload;
 12.1965 +            payload["url"] = url;
 12.1966 +            LLNotificationsUtil::add("GotoURL", args, payload );
 12.1967 +        }
 12.1968 +        break;
 12.1969 +
 12.1970 +    case IM_FRIENDSHIP_OFFERED:
 12.1971 +        {
 12.1972 +
 12.1973 +            // <FS:PP> FIRE-15233: Automatic friendship request refusal
 12.1974 +            if (is_rejecting_friendship_requests)
 12.1975 +            {
 12.1976 +                send_rejecting_friendship_requests_message(gMessageSystem, from_id);
 12.1977 +                return;
 12.1978 +            }
 12.1979 +            // </FS:PP>
 12.1980 +
 12.1981 +            LLSD payload;
 12.1982 +            payload["from_id"] = from_id;
 12.1983 +            payload["session_id"] = session_id;
 12.1984 +            payload["online"] = (offline == IM_ONLINE);
 12.1985 +            payload["sender"] = sender.getIPandPort();
 12.1986 +
 12.1987 +            bool add_notification = true;
 12.1988 +            for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
 12.1989 +                , tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
 12.1990 +            {
 12.1991 +                LLToastNotifyPanel& panel = *ti;
 12.1992 +                const std::string& notification_name = panel.getNotificationName();
 12.1993 +                if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled())
 12.1994 +                {
 12.1995 +                    add_notification = false;
 12.1996 +                    break;
 12.1997 +                }
 12.1998 +            }
 12.1999 +
 12.2000 +            if (is_muted && add_notification)
 12.2001 +            {
 12.2002 +                LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
 12.2003 +            }
 12.2004 +            else
 12.2005 +            {
 12.2006 +                if (is_do_not_disturb)
 12.2007 +                {
 12.2008 +                    send_do_not_disturb_message(gMessageSystem, from_id);
 12.2009 +                }
 12.2010 +// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
 12.2011 +                args["NAME_LABEL"] = LLSLURL("agent", from_id, "completename").getSLURLString();
 12.2012 +// [/SL:KB]
 12.2013 +                args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 12.2014 +
 12.2015 +                if (add_notification)
 12.2016 +                {
 12.2017 +                if(message.empty())
 12.2018 +                {
 12.2019 +                    //support for frienship offers from clients before July 2008
 12.2020 +                        LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload);
 12.2021 +                        make_ui_sound("UISndFriendshipOffer"); // <FS:PP> Friendship offer sound
 12.2022 +                }
 12.2023 +                else
 12.2024 +                {
 12.2025 +                    args["[MESSAGE]"] = message;
 12.2026 +                    LLNotification::Params params("OfferFriendship");
 12.2027 +                    params.substitutions = args;
 12.2028 +                    params.payload = payload;
 12.2029 +                    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 12.2030 +                    make_ui_sound("UISndFriendshipOffer"); // <FS:PP> Friendship offer sound
 12.2031 +                }
 12.2032 +            }
 12.2033 +        }
 12.2034 +        }
 12.2035 +        break;
 12.2036 +
 12.2037 +    case IM_FRIENDSHIP_ACCEPTED:
 12.2038 +        {
 12.2039 +            // In the case of an offline IM, the formFriendship() may be extraneous
 12.2040 +            // as the database should already include the relationship.  But it
 12.2041 +            // doesn't hurt for dupes.
 12.2042 +            LLAvatarTracker::formFriendship(from_id);
 12.2043 +            
 12.2044 +            std::vector<std::string> strings;
 12.2045 +            strings.push_back(from_id.asString());
 12.2046 +            send_generic_message("requestonlinenotification", strings);
 12.2047 +            
 12.2048 +            args["NAME"] = name;
 12.2049 +            LLSD payload;
 12.2050 +            payload["from_id"] = from_id;
 12.2051 +            LLAvatarNameCache::get(from_id, boost::bind(&notification_display_name_callback, _1, _2, "FriendshipAccepted", args, payload));
 12.2052 +        }
 12.2053 +        break;
 12.2054 +
 12.2055 +    case IM_FRIENDSHIP_DECLINED_DEPRECATED:
 12.2056 +    default:
 12.2057 +        LL_WARNS("Messaging") << "Instant message calling for unknown dialog "
 12.2058 +                << (S32)dialog << LL_ENDL;
 12.2059 +        break;
 12.2060 +    }
 12.2061 +
 12.2062 +    LLWindow* viewer_window = gViewerWindow->getWindow();
 12.2063 +    // <FS:CR> Make osx dashboard icon bounce when window isn't in focus
 12.2064 +    //if (viewer_window && viewer_window->getMinimized())
 12.2065 +    static LLCachedControl<bool> sFlashIcon(gSavedSettings, "FSFlashOnMessage");
 12.2066 +    static LLCachedControl<bool> sFSFlashOnObjectIM(gSavedSettings, "FSFlashOnObjectIM");
 12.2067 +    if (viewer_window && dialog != IM_TYPING_START && dialog != IM_TYPING_STOP && sFlashIcon && (sFSFlashOnObjectIM || (chat.mChatType != CHAT_TYPE_IM)) && !is_muted)
 12.2068 +    {
 12.2069 +        viewer_window->flashIcon(5.f);
 12.2070 +    }
 12.2071 +}
 12.2072 +
 12.2073 +void LLIMProcessing::requestOfflineMessages()
 12.2074 +{
 12.2075 +    static BOOL requested = FALSE;
 12.2076 +    if (!requested
 12.2077 +        && gMessageSystem
 12.2078 +        && LLMuteList::getInstance()->isLoaded()
 12.2079 +        && isAgentAvatarValid()
 12.2080 +        && gAgent.getRegion()
 12.2081 +        && gAgent.getRegion()->capabilitiesReceived())
 12.2082 +    {
 12.2083 +        std::string cap_url = gAgent.getRegionCapability("ReadOfflineMsgs");
 12.2084 +
 12.2085 +        // Auto-accepted inventory items may require the avatar object
 12.2086 +        // to build a correct name.  Likewise, inventory offers from
 12.2087 +        // muted avatars require the mute list to properly mute.
 12.2088 +        if (cap_url.empty())
 12.2089 +        {
 12.2090 +            requestOfflineMessagesLegacy();
 12.2091 +        }
 12.2092 +        else
 12.2093 +        {
 12.2094 +            LLCoros::instance().launch("LLIMProcessing::requestOfflineMessagesCoro",
 12.2095 +                boost::bind(&LLIMProcessing::requestOfflineMessagesCoro, cap_url));
 12.2096 +        }
 12.2097 +        requested = TRUE;
 12.2098 +    }
 12.2099 +}
 12.2100 +
 12.2101 +void LLIMProcessing::requestOfflineMessagesCoro(std::string url)
 12.2102 +{
 12.2103 +    LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
 12.2104 +    LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t
 12.2105 +        httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestOfflineMessagesCoro", httpPolicy));
 12.2106 +    LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest);
 12.2107 +
 12.2108 +    LLSD result = httpAdapter->getAndSuspend(httpRequest, url);
 12.2109 +
 12.2110 +    LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
 12.2111 +    LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
 12.2112 +
 12.2113 +    if (!status) // success = httpResults["success"].asBoolean();
 12.2114 +    {
 12.2115 +        LL_WARNS() << "Error requesting offline messages via capability " << url << ", Status: " << status.toString() << "\nFalling back to legacy method." << LL_ENDL;
 12.2116 +
 12.2117 +        requestOfflineMessagesLegacy();
 12.2118 +        return;
 12.2119 +    }
 12.2120 +
 12.2121 +    LLSD contents = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS_CONTENT];
 12.2122 +
 12.2123 +    if (!contents.size())
 12.2124 +    {
 12.2125 +        LL_WARNS() << "No contents received for offline messages via capability " << url << LL_ENDL;
 12.2126 +        return;
 12.2127 +    }
 12.2128 +
 12.2129 +    LLSD messages;
 12.2130 +    if (contents.isArray())
 12.2131 +    {
 12.2132 +        messages = *contents.beginArray();
 12.2133 +    }
 12.2134 +    else if (contents.has("messages"))
 12.2135 +    {
 12.2136 +        messages = contents["messages"];
 12.2137 +    }
 12.2138 +    else
 12.2139 +    {
 12.2140 +        LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
 12.2141 +        return;
 12.2142 +    }
 12.2143 +
 12.2144 +    if (!messages.isArray())
 12.2145 +    {
 12.2146 +        LL_WARNS() << "Invalid offline message content received via capability " << url << LL_ENDL;
 12.2147 +        return;
 12.2148 +    }
 12.2149 +
 12.2150 +    std::vector<U8> data;
 12.2151 +    S32 binary_bucket_size = 0;
 12.2152 +    LLHost sender = gAgent.getRegion()->getHost();
 12.2153 +
 12.2154 +    LLSD::array_iterator i = messages.beginArray();
 12.2155 +    LLSD::array_iterator iEnd = messages.endArray();
 12.2156 +    for (; i != iEnd; ++i)
 12.2157 +    {
 12.2158 +        const LLSD &message_data(*i);
 12.2159 +        LLVector3 position(message_data["local_x"].asReal(), message_data["local_y"].asReal(), message_data["local_z"].asReal());
 12.2160 +        data = message_data["binary_bucket"].asBinary();
 12.2161 +        binary_bucket_size = data.size(); // message_data["count"] == data.size() - 1 due to ('\0')
 12.2162 +        U32 parent_estate_id = message_data.has("parent_estate_id") ? message_data["ParentEstateID"].asInteger() : 1; // 1 - IMMainland
 12.2163 +
 12.2164 +        LLIMProcessing::processNewMessage(message_data["from_agent_id"].asUUID(),
 12.2165 +            message_data["from_group"].asInteger(), // BOOL
 12.2166 +            message_data["to_agent_id"].asUUID(),
 12.2167 +            IM_OFFLINE,
 12.2168 +            (EInstantMessage)message_data["dialog"].asInteger(),
 12.2169 +            message_data["session_id"].asUUID(),
 12.2170 +            message_data["timestamp"].asInteger(),
 12.2171 +            message_data["from_agent_name"].asString(),
 12.2172 +            message_data["message"].asString(),
 12.2173 +            parent_estate_id,
 12.2174 +            message_data["region_id"].asUUID(),
 12.2175 +            position,
 12.2176 +            &data[0],
 12.2177 +            binary_bucket_size,
 12.2178 +            sender);
 12.2179 +    }
 12.2180 +}
 12.2181 +
 12.2182 +void LLIMProcessing::requestOfflineMessagesLegacy()
 12.2183 +{
 12.2184 +    LLMessageSystem* msg = gMessageSystem;
 12.2185 +    msg->newMessageFast(_PREHASH_RetrieveInstantMessages);
 12.2186 +    msg->nextBlockFast(_PREHASH_AgentData);
 12.2187 +    msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
 12.2188 +    msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 12.2189 +    gAgent.sendReliableMessage();
 12.2190 +}
 12.2191 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/indra/newview/llimprocessing.h	Wed Mar 21 20:23:52 2018 +0100
    13.3 @@ -0,0 +1,62 @@
    13.4 +/**
    13.5 +* @file LLIMMgr.h
    13.6 +* @brief Container for Instant Messaging
    13.7 +*
    13.8 +* $LicenseInfo:firstyear=2001&license=viewerlgpl$
    13.9 +* Second Life Viewer Source Code
   13.10 +* Copyright (C) 2010, Linden Research, Inc.
   13.11 +*
   13.12 +* This library is free software; you can redistribute it and/or
   13.13 +* modify it under the terms of the GNU Lesser General Public
   13.14 +* License as published by the Free Software Foundation;
   13.15 +* version 2.1 of the License only.
   13.16 +*
   13.17 +* This library is distributed in the hope that it will be useful,
   13.18 +* but WITHOUT ANY WARRANTY; without even the implied warranty of
   13.19 +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   13.20 +* Lesser General Public License for more details.
   13.21 +*
   13.22 +* You should have received a copy of the GNU Lesser General Public
   13.23 +* License along with this library; if not, write to the Free Software
   13.24 +* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
   13.25 +*
   13.26 +* Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
   13.27 +* $/LicenseInfo$
   13.28 +*/
   13.29 +
   13.30 +#ifndef LL_LLIMPROCESSING_H
   13.31 +#define LL_LLIMPROCESSING_H
   13.32 +
   13.33 +#include "llinstantmessage.h"
   13.34 +
   13.35 +class LLIMProcessing
   13.36 +{
   13.37 +public:
   13.38 +    // Pre-process message for IM manager
   13.39 +    static void processNewMessage(LLUUID from_id,
   13.40 +        BOOL from_group,
   13.41 +        LLUUID to_id,
   13.42 +        U8 offline,
   13.43 +        EInstantMessage dialog, // U8
   13.44 +        LLUUID session_id,
   13.45 +        U32 timestamp,
   13.46 +        std::string agentName,
   13.47 +        std::string message,
   13.48 +        U32 parent_estate_id,
   13.49 +        LLUUID region_id,
   13.50 +        LLVector3 position,
   13.51 +        U8 *binary_bucket,
   13.52 +        S32 binary_bucket_size,
   13.53 +        LLHost &sender);
   13.54 +
   13.55 +    // Either receives list of offline messages from 'ReadOfflineMsgs' capability
   13.56 +    // or uses legacy method
   13.57 +    static void requestOfflineMessages();
   13.58 +
   13.59 +private:
   13.60 +    static void requestOfflineMessagesCoro(std::string url);
   13.61 +    static void requestOfflineMessagesLegacy();
   13.62 +};
   13.63 +
   13.64 +
   13.65 +#endif  // LL_LLLLIMPROCESSING_H
    14.1 --- a/indra/newview/llinventorypanel.cpp	Fri Mar 02 12:11:50 2018 +0100
    14.2 +++ b/indra/newview/llinventorypanel.cpp	Wed Mar 21 20:23:52 2018 +0100
    14.3 @@ -1230,7 +1230,7 @@
    14.4  			{
    14.5  				if(prev_folder_item)
    14.6  				{
    14.7 -					LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
    14.8 +					LLFolderBridge* prev_bridge = static_cast<LLFolderBridge*>(prev_folder_item->getViewModelItem());
    14.9  					if(prev_bridge)
   14.10  					{
   14.11  						prev_bridge->clearDisplayName();
   14.12 @@ -1239,7 +1239,7 @@
   14.13  					}
   14.14  				}
   14.15  
   14.16 -				LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem();
   14.17 +				LLFolderBridge* bridge = static_cast<LLFolderBridge*>(folder_item->getViewModelItem());
   14.18  				if(bridge)
   14.19  				{
   14.20  					bridge->clearDisplayName();
   14.21 @@ -1254,7 +1254,7 @@
   14.22  	{
   14.23  		if(prev_folder_item)
   14.24  		{
   14.25 -			LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem();
   14.26 +			LLFolderBridge* prev_bridge = static_cast<LLFolderBridge*>(prev_folder_item->getViewModelItem());
   14.27  			if(prev_bridge)
   14.28  			{
   14.29  				prev_bridge->clearDisplayName();
    15.1 --- a/indra/newview/llpanelmarketplaceinboxinventory.cpp	Fri Mar 02 12:11:50 2018 +0100
    15.2 +++ b/indra/newview/llpanelmarketplaceinboxinventory.cpp	Wed Mar 21 20:23:52 2018 +0100
    15.3 @@ -180,6 +180,12 @@
    15.4  	return LLFolderViewFolder::handleDoubleClick(x, y, mask);
    15.5  }
    15.6  
    15.7 +void LLInboxFolderViewFolder::selectItem()
    15.8 +{
    15.9 +	deFreshify();
   15.10 +	LLFolderViewFolder::selectItem();
   15.11 +}
   15.12 +
   15.13  void LLInboxFolderViewFolder::computeFreshness()
   15.14  {
   15.15  	const U32 last_expansion_utc = gSavedPerAccountSettings.getU32("LastInventoryInboxActivity");
    16.1 --- a/indra/newview/llpanelmarketplaceinboxinventory.h	Fri Mar 02 12:11:50 2018 +0100
    16.2 +++ b/indra/newview/llpanelmarketplaceinboxinventory.h	Wed Mar 21 20:23:52 2018 +0100
    16.3 @@ -71,6 +71,7 @@
    16.4  	
    16.5  	BOOL handleMouseDown(S32 x, S32 y, MASK mask);
    16.6  	BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
    16.7 +	void selectItem();
    16.8  
    16.9  	void computeFreshness();
   16.10  	void deFreshify();
    17.1 --- a/indra/newview/lltoolpie.cpp	Fri Mar 02 12:11:50 2018 +0100
    17.2 +++ b/indra/newview/lltoolpie.cpp	Wed Mar 21 20:23:52 2018 +0100
    17.3 @@ -139,7 +139,7 @@
    17.4  	// don't pick transparent so users can't "pay" transparent objects
    17.5  	// <FS:Ansariel> FIRE-1396: Allow selecting transparent objects
    17.6  	//mPick = gViewerWindow->pickImmediate(x, y, /*BOOL pick_transparent*/ FALSE, /*BOOL pick_rigged*/ TRUE, /*BOOL pick_particle*/ TRUE);
    17.7 -	mPick = gViewerWindow->pickImmediate(x, y, /*BOOL pick_transparent*/ TRUE, /*BOOL pick_rigged*/ TRUE, /*BOOL pick_particle*/ TRUE);
    17.8 +	mPick = gViewerWindow->pickImmediate(x, y, /*BOOL pick_transparent*/ gSavedSettings.getBOOL("FSEnableRightclickOnTransparentObjects"), /*BOOL pick_rigged*/ TRUE, /*BOOL pick_particle*/ TRUE);
    17.9  	// </FS:Ansariel>
   17.10  	mPick.mKeyMask = mask;
   17.11  
    18.1 --- a/indra/newview/llviewermessage.cpp	Fri Mar 02 12:11:50 2018 +0100
    18.2 +++ b/indra/newview/llviewermessage.cpp	Wed Mar 21 20:23:52 2018 +0100
    18.3 @@ -26,7 +26,6 @@
    18.4  
    18.5  #include "llviewerprecompiledheaders.h"
    18.6  #include "llviewermessage.h"
    18.7 -#include "boost/lexical_cast.hpp"
    18.8  
    18.9  // Linden libraries
   18.10  #include "llanimationstates.h"
   18.11 @@ -66,7 +65,7 @@
   18.12  #include "llfloatersnapshot.h"
   18.13  #include "llhudeffecttrail.h"
   18.14  #include "llhudmanager.h"
   18.15 -#include "llimview.h"
   18.16 +#include "llimprocessing.h"
   18.17  #include "llinventoryfunctions.h"
   18.18  #include "llinventoryobserver.h"
   18.19  #include "llinventorypanel.h"
   18.20 @@ -127,7 +126,6 @@
   18.21  // [/RLVa:KB]
   18.22  
   18.23  #include <boost/algorithm/string/split.hpp> //
   18.24 -#include <boost/regex.hpp>
   18.25  #include <boost/foreach.hpp>
   18.26  
   18.27  #include "llnotificationmanager.h" //
   18.28 @@ -135,12 +133,12 @@
   18.29  
   18.30  #include "llexperiencecache.h"
   18.31  
   18.32 -// Firestorm inclues
   18.33 +// Firestorm includes
   18.34 +#include <boost/regex.hpp>
   18.35  #include "animationexplorer.h"		// <FS:Zi> Animation Explorer
   18.36  #include "fsareasearch.h"
   18.37  #include "fsassetblacklist.h"
   18.38  #include "fscommon.h"
   18.39 -#include "fsdata.h"
   18.40  #include "fsfloaterplacedetails.h"
   18.41  #include "fsradar.h"
   18.42  #include "fskeywords.h" // <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground
   18.43 @@ -150,19 +148,10 @@
   18.44  #include "llfloaterbump.h"
   18.45  #include "llfloaterreg.h"
   18.46  #include "llfriendcard.h"
   18.47 -#include "llgiveinventory.h"
   18.48 -#include "lllandmarkactions.h"
   18.49 -#include "lltexturefetch.h"
   18.50 -#include "sound_ids.h"
   18.51  #include "tea.h" // <FS:AW opensim currency support>
   18.52  #include "NACLantispam.h"
   18.53  #include "chatbar_as_cmdline.h"
   18.54  
   18.55 -#if LL_MSVC
   18.56 -// disable boost::lexical_cast warning
   18.57 -#pragma warning (disable:4702)
   18.58 -#endif
   18.59 -
   18.60  extern void on_new_message(const LLSD& msg);
   18.61  
   18.62  //
   18.63 @@ -839,38 +828,36 @@
   18.64  //-----------------------------------------------------------------------------
   18.65  // Instant Message
   18.66  //-----------------------------------------------------------------------------
   18.67 -class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
   18.68 -{
   18.69 -public:
   18.70 -	LLOpenAgentOffer(const LLUUID& object_id,
   18.71 -					 const std::string& from_name) : 
   18.72 -		LLInventoryFetchItemsObserver(object_id),
   18.73 -		mFromName(from_name) {}
   18.74 -	/*virtual*/ void startFetch()
   18.75 -	{
   18.76 -		for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
   18.77 -		{
   18.78 -			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
   18.79 -			if (cat)
   18.80 -			{
   18.81 -				mComplete.push_back((*it));
   18.82 -			}
   18.83 -		}
   18.84 -		LLInventoryFetchItemsObserver::startFetch();
   18.85 -	}
   18.86 -	/*virtual*/ void done()
   18.87 -	{
   18.88 -		// <FS:Ansariel> FIRE-3234: Don't need a check for ShowNewInventory here;
   18.89 -		// This only gets called if the user explicity clicks "Show" or
   18.90 -		// AutoAcceptNewInventory and ShowNewInventory are TRUE.
   18.91 -		//open_inventory_offer(mComplete, mFromName);
   18.92 -		open_inventory_offer(mComplete, mFromName, true);
   18.93 -		gInventory.removeObserver(this);
   18.94 -		delete this;
   18.95 -	}
   18.96 -private:
   18.97 -	std::string mFromName;
   18.98 -};
   18.99 +// <FS:Ansariel> Moved to header; needed in llimprocessing.cpp
  18.100 +//class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
  18.101 +//{
  18.102 +//public:
  18.103 +//	LLOpenAgentOffer(const LLUUID& object_id,
  18.104 +//					 const std::string& from_name) : 
  18.105 +//		LLInventoryFetchItemsObserver(object_id),
  18.106 +//		mFromName(from_name) {}
  18.107 +//	/*virtual*/ void startFetch()
  18.108 +//	{
  18.109 +//		for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
  18.110 +//		{
  18.111 +//			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
  18.112 +//			if (cat)
  18.113 +//			{
  18.114 +//				mComplete.push_back((*it));
  18.115 +//			}
  18.116 +//		}
  18.117 +//		LLInventoryFetchItemsObserver::startFetch();
  18.118 +//	}
  18.119 +//	/*virtual*/ void done()
  18.120 +//	{
  18.121 +//		open_inventory_offer(mComplete, mFromName);
  18.122 +//		gInventory.removeObserver(this);
  18.123 +//		delete this;
  18.124 +//	}
  18.125 +//private:
  18.126 +//	std::string mFromName;
  18.127 +//};
  18.128 +// </FS:Ansariel>
  18.129  
  18.130  /**
  18.131   * Class to observe adding of new items moved from the world to user's inventory to select them in inventory.
  18.132 @@ -2174,18 +2161,6 @@
  18.133  	return false;
  18.134  }
  18.135  
  18.136 -class LLPostponedOfferNotification: public LLPostponedNotification
  18.137 -{
  18.138 -protected:
  18.139 -	/* virtual */
  18.140 -	void modifyNotificationParams()
  18.141 -	{
  18.142 -		LLSD substitutions = mParams.substitutions;
  18.143 -		substitutions["NAME"] = mName;
  18.144 -		mParams.substitutions = substitutions;
  18.145 -	}
  18.146 -};
  18.147 -
  18.148  void LLOfferInfo::initRespondFunctionMap()
  18.149  {
  18.150  	if(mRespondFunctions.empty())
  18.151 @@ -2198,265 +2173,6 @@
  18.152  	}
  18.153  }
  18.154  
  18.155 -void inventory_offer_handler(LLOfferInfo* info)
  18.156 -{
  18.157 -	// If muted, don't even go through the messaging stuff.  Just curtail the offer here.
  18.158 -	// Passing in a null UUID handles the case of where you have muted one of your own objects by_name.
  18.159 -	// The solution for STORM-1297 seems to handle the cases where the object is owned by someone else.
  18.160 -	if (LLMuteList::getInstance()->isMuted(info->mFromID, info->mFromName) ||
  18.161 -		LLMuteList::getInstance()->isMuted(LLUUID::null, info->mFromName))
  18.162 -	{
  18.163 -		info->forceResponse(IOR_MUTE);
  18.164 -		return;
  18.165 -	}
  18.166 -
  18.167 -
  18.168 -	bool bAutoAccept(false);
  18.169 -	// Avoid the Accept/Discard dialog if the user so desires. JC
  18.170 -	// <FS:Ansariel> Auto-accept any kind of inventory (FIRE-4128)
  18.171 -	//if (gSavedSettings.getBOOL("AutoAcceptNewInventory")
  18.172 -	//	&& (info->mType == LLAssetType::AT_NOTECARD
  18.173 -	//		|| info->mType == LLAssetType::AT_LANDMARK
  18.174 -	//		|| info->mType == LLAssetType::AT_TEXTURE))
  18.175 -//	if (gSavedSettings.getBOOL("AutoAcceptNewInventory"))
  18.176 -	// </FS:Ansariel> Auto-accept any kind of inventory (FIRE-4128)
  18.177 -// [RLVa:KB]
  18.178 -	// Don't auto-accept give-to-RLV inventory offers
  18.179 -	if ( (gSavedSettings.getBOOL("AutoAcceptNewInventory")) &&
  18.180 -		 ( (!rlv_handler_t::isEnabled()) || (!RlvInventory::instance().isGiveToRLVOffer(*info)) ) )
  18.181 -// [/RLVa:KB]
  18.182 -	{
  18.183 -		// For certain types, just accept the items into the inventory,
  18.184 -		// and possibly open them on receipt depending upon "ShowNewInventory".
  18.185 -		bAutoAccept = true;
  18.186 -	}
  18.187 -
  18.188 -	// Strip any SLURL from the message display. (DEV-2754)
  18.189 -	std::string msg = info->mDesc;
  18.190 -	int indx = msg.find(" ( http://slurl.com/secondlife/");
  18.191 -	if(indx == std::string::npos)
  18.192 -	{
  18.193 -		// try to find new slurl host
  18.194 -		indx = msg.find(" ( http://maps.secondlife.com/secondlife/");
  18.195 -	}
  18.196 -	if(indx >= 0)
  18.197 -	{
  18.198 -		LLStringUtil::truncate(msg, indx);
  18.199 -	}
  18.200 -
  18.201 -	LLSD args;
  18.202 -	args["[OBJECTNAME]"] = msg;
  18.203 -
  18.204 -	LLSD payload;
  18.205 -
  18.206 -	// must protect against a NULL return from lookupHumanReadable()
  18.207 -	std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType));
  18.208 -	if (!typestr.empty())
  18.209 -	{
  18.210 -		// human readable matches string name from strings.xml
  18.211 -		// lets get asset type localized name
  18.212 -		args["OBJECTTYPE"] = LLTrans::getString(typestr);
  18.213 -	}
  18.214 -	else
  18.215 -	{
  18.216 -		LL_WARNS("Messaging") << "LLAssetType::lookupHumanReadable() returned NULL - probably bad asset type: " << info->mType << LL_ENDL;
  18.217 -		args["OBJECTTYPE"] = "";
  18.218 -
  18.219 -		// This seems safest, rather than propagating bogosity
  18.220 -		LL_WARNS("Messaging") << "Forcing an inventory-decline for probably-bad asset type." << LL_ENDL;
  18.221 -		info->forceResponse(IOR_DECLINE);
  18.222 -		return;
  18.223 -	}
  18.224 -
  18.225 -	// If mObjectID is null then generate the object_id based on msg to prevent
  18.226 -	// multiple creation of chiclets for same object.
  18.227 -	LLUUID object_id = info->mObjectID;
  18.228 -	if (object_id.isNull())
  18.229 -		object_id.generate(msg);
  18.230 -
  18.231 -	payload["from_id"] = info->mFromID;
  18.232 -	// Needed by LLScriptFloaterManager to bind original notification with 
  18.233 -	// faked for toast one.
  18.234 -	payload["object_id"] = object_id;
  18.235 -	// Flag indicating that this notification is faked for toast.
  18.236 -	payload["give_inventory_notification"] = FALSE;
  18.237 -	args["OBJECTFROMNAME"] = info->mFromName;
  18.238 -	args["NAME"] = info->mFromName;
  18.239 -	if (info->mFromGroup)
  18.240 -	{
  18.241 -		args["NAME_SLURL"] = LLSLURL("group", info->mFromID, "about").getSLURLString();
  18.242 -	}
  18.243 -	else
  18.244 -	{
  18.245 -// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
  18.246 -		args["NAME_LABEL"] = LLSLURL("agent", info->mFromID, "completename").getSLURLString();
  18.247 -// [/SL:KB]
  18.248 -		args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "about").getSLURLString();
  18.249 -	}
  18.250 -	std::string verb = "select?name=" + LLURI::escape(msg);
  18.251 -	args["ITEM_SLURL"] = LLSLURL("inventory", info->mObjectID, verb.c_str()).getSLURLString();
  18.252 -
  18.253 -	LLNotification::Params p;
  18.254 -
  18.255 -	// Object -> Agent Inventory Offer
  18.256 -	if (info->mFromObject && !bAutoAccept)
  18.257 -	{
  18.258 -// [RLVa:KB] - Checked: RLVa-1.2.2
  18.259 -		// Only filter if the object owner is a nearby agent
  18.260 -		if ( (RlvActions::isRlvEnabled()) && (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) && (RlvUtil::isNearbyAgent(info->mFromID)) )
  18.261 -		{
  18.262 -			payload["rlv_shownames"] = TRUE;
  18.263 -			args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "rlvanonym").getSLURLString();
  18.264 -		}
  18.265 -// [/RLVa:KB]
  18.266 -
  18.267 -		// Inventory Slurls don't currently work for non agent transfers, so only display the object name.
  18.268 -		args["ITEM_SLURL"] = msg;
  18.269 -		// Note: sets inventory_task_offer_callback as the callback
  18.270 -		p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
  18.271 -		info->mPersist = true;
  18.272 -
  18.273 -		// Offers from your own objects need a special notification template.
  18.274 -		p.name = info->mFromID == gAgentID ? "OwnObjectGiveItem" : "ObjectGiveItem";
  18.275 -
  18.276 -		// Pop up inv offer chiclet and let the user accept (keep), or reject (and silently delete) the inventory.
  18.277 -	    LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, info->mFromGroup == TRUE);
  18.278 -	}
  18.279 -	else // Agent -> Agent Inventory Offer
  18.280 -	{
  18.281 -// [RLVa:KB] - Checked: RLVa-2.0.1
  18.282 -		// Only filter if the offer is from a nearby agent and if there's no open IM session (doesn't necessarily have to be focused)
  18.283 -		bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
  18.284 -			(RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) || (!RlvUtil::isNearbyAgent(info->mFromID)) || (RlvUIEnabler::hasOpenIM(info->mFromID)) || (RlvUIEnabler::hasOpenProfile(info->mFromID));
  18.285 -		if (!fRlvCanShowName)
  18.286 -		{
  18.287 -			payload["rlv_shownames"] = TRUE;
  18.288 -			LLAvatarName av_name;
  18.289 -			if (LLAvatarNameCache::get(info->mFromID, &av_name))
  18.290 -			{
  18.291 -				args["NAME"] = RlvStrings::getAnonym(av_name);
  18.292 -			}
  18.293 -			else
  18.294 -			{
  18.295 -				args["NAME"] = RlvStrings::getAnonym(info->mFromName);
  18.296 -			}
  18.297 -			args["NAME_SLURL"] = LLSLURL("agent", info->mFromID, "rlvanonym").getSLURLString();
  18.298 -		}
  18.299 -// [/RLVa:KB]
  18.300 -
  18.301 -		p.responder = info;
  18.302 -		// Note: sets inventory_offer_callback as the callback
  18.303 -		// *TODO fix memory leak
  18.304 -		// inventory_offer_callback() is not invoked if user received notification and 
  18.305 -		// closes viewer(without responding the notification)
  18.306 -		p.substitutions(args).payload(payload).functor.responder(LLNotificationResponderPtr(info));
  18.307 -		info->mPersist = true;
  18.308 -		// <FS:Ansariel> FIRE-3832: Silent accept/decline of inventory offers
  18.309 -		//p.name = "UserGiveItem";
  18.310 -		p.name = (gSavedSettings.getBOOL("FSUseLegacyInventoryAcceptMessages") ? "UserGiveItemLegacy" : "UserGiveItem");
  18.311 -		// </FS:Ansariel>
  18.312 -		p.offer_from_agent = true;
  18.313 -		
  18.314 -		// Prefetch the item into your local inventory.
  18.315 -		LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
  18.316 -		fetch_item->startFetch();
  18.317 -		if(fetch_item->isFinished())
  18.318 -		{
  18.319 -			fetch_item->done();
  18.320 -		}
  18.321 -		else
  18.322 -		{
  18.323 -			gInventory.addObserver(fetch_item);
  18.324 -		}
  18.325 -		
  18.326 -		// In viewer 2 we're now auto receiving inventory offers and messaging as such (not sending reject messages).
  18.327 -		// <FS:Ansariel> Optional V1-like inventory accept messages
  18.328 -		//info->send_auto_receive_response();
  18.329 -		// Also needs to be send on auto-accept so the item gets into the inventory!
  18.330 -		if (bAutoAccept || !gSavedSettings.getBOOL("FSUseLegacyInventoryAcceptMessages"))
  18.331 -		{
  18.332 -			info->send_auto_receive_response();
  18.333 -		}
  18.334 -		// </FS:Ansariel> Optional V1-like inventory accept messages
  18.335 -
  18.336 -        if (gAgent.isDoNotDisturb()) 
  18.337 -        {
  18.338 -            send_do_not_disturb_message(gMessageSystem, info->mFromID);
  18.339 -        }
  18.340 -        
  18.341 -		if( !bAutoAccept ) // if we auto accept, do not pester the user
  18.342 -		{
  18.343 -			// Inform user that there is a script floater via toast system
  18.344 -			payload["give_inventory_notification"] = TRUE;
  18.345 -			p.payload = payload;
  18.346 -			LLPostponedNotification::add<LLPostponedOfferNotification>(p, info->mFromID, false);
  18.347 -		}
  18.348 -		// <FS:Ansariel> FIRE-19540: Log auto-accepted inventory to nearby chat
  18.349 -		else if (gSavedSettings.getBOOL("FSLogAutoAcceptInventoryToChat"))
  18.350 -		{
  18.351 -			std::string message_type;
  18.352 -			LLStringUtil::format_map_t chat_args;
  18.353 -			
  18.354 -			chat_args["OBJECT_TYPE"] = (!typestr.empty() ? LLTrans::getString(typestr) : "");
  18.355 -			chat_args["DESC"] = msg;
  18.356 -
  18.357 -			if (info->mFromObject)
  18.358 -			{
  18.359 -				std::string str_pos;
  18.360 -				std::string::size_type idx_start = info->mDesc.rfind(" ( http://");
  18.361 -				std::string::size_type idx_end = info->mDesc.find(" )", idx_start);
  18.362 -				if (idx_start != std::string::npos && idx_end != std::string::npos)
  18.363 -				{
  18.364 -					LLSLURL url_pos(info->mDesc.substr(idx_start + 3, idx_end - (idx_start + 3)));
  18.365 -					str_pos = "&slurl=" + LLURI::escape(url_pos.getLocationString());
  18.366 -				}
  18.367 -
  18.368 -				chat_args["OBJECT_NAME"] = "[" + LLSLURL("objectim", info->mObjectID, "").getSLURLString() + "?name=" + LLURI::escape(info->mFromName) + "&owner=" + info->mFromID.asString() + (info->mFromGroup ? "&groupowned=true" : "") + str_pos + " " + info->mFromName + "]";
  18.369 -				message_type = "InvOfferAutoAcceptObject";
  18.370 -			}
  18.371 -			else
  18.372 -			{
  18.373 -				bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
  18.374 -					(RlvActions::canShowName(RlvActions::SNC_DEFAULT, info->mFromID)) || (!RlvUtil::isNearbyAgent(info->mFromID)) || (RlvUIEnabler::hasOpenIM(info->mFromID)) || (RlvUIEnabler::hasOpenProfile(info->mFromID));
  18.375 -				
  18.376 -				std::string name_slurl = LLSLURL("agent", info->mFromID, (fRlvCanShowName ? "inspect" : "rlvanonym")).getSLURLString();
  18.377 -
  18.378 -				chat_args["USER_NAME"] = name_slurl;
  18.379 -				message_type = "InvOfferAutoAcceptUser";
  18.380 -			}
  18.381 -
  18.382 -			report_to_nearby_chat(LLTrans::getString(message_type, chat_args));
  18.383 -		}
  18.384 -		// </FS:Ansariel>
  18.385 -
  18.386 -		// <FS:Ansariel> Show offered inventory also if auto-accept is enabled (FIRE-5101)
  18.387 -		if (bAutoAccept && gSavedSettings.getBOOL("ShowNewInventory"))
  18.388 -		{
  18.389 -			LLViewerInventoryCategory* catp = NULL;
  18.390 -			catp = (LLViewerInventoryCategory*)gInventory.getCategory(info->mObjectID);
  18.391 -			LLViewerInventoryItem* itemp = NULL;
  18.392 -			if(!catp)
  18.393 -			{
  18.394 -				itemp = (LLViewerInventoryItem*)gInventory.getItem(info->mObjectID);
  18.395 -			}
  18.396 -
  18.397 -			LLOpenAgentOffer* open_agent_offer = new LLOpenAgentOffer(info->mObjectID, info->mFromName);
  18.398 -			open_agent_offer->startFetch();
  18.399 -			if(catp || (itemp && itemp->isFinished()))
  18.400 -			{
  18.401 -				open_agent_offer->done();
  18.402 -			}
  18.403 -			else
  18.404 -			{
  18.405 -				gInventory.addObserver(open_agent_offer);
  18.406 -			}
  18.407 -		}
  18.408 -		// </FS:Ansariel> Show offered inventory also if auto-accept is enabled (FIRE-5101)
  18.409 -	}
  18.410 -
  18.411 -	LLFirstUse::newInventory();
  18.412 -}
  18.413 -
  18.414  bool lure_callback(const LLSD& notification, const LLSD& response)
  18.415  {
  18.416  	S32 option = 0;
  18.417 @@ -2592,1735 +2308,57 @@
  18.418  	}
  18.419  };
  18.420  
  18.421 -static bool parse_lure_bucket(const std::string& bucket,
  18.422 -							  U64& region_handle,
  18.423 -							  LLVector3& pos,
  18.424 -							  LLVector3& look_at,
  18.425 -							  U8& region_access)
  18.426 -{
  18.427 -	// tokenize the bucket
  18.428 -	typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
  18.429 -	boost::char_separator<char> sep("|", "", boost::keep_empty_tokens);
  18.430 -	tokenizer tokens(bucket, sep);
  18.431 -	tokenizer::iterator iter = tokens.begin();
  18.432 -
  18.433 -	S32 gx,gy,rx,ry,rz,lx,ly,lz;
  18.434 -	try
  18.435 -	{
  18.436 -		gx = boost::lexical_cast<S32>((*(iter)).c_str());
  18.437 -		gy = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.438 -		rx = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.439 -		ry = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.440 -		rz = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.441 -		lx = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.442 -		ly = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.443 -		lz = boost::lexical_cast<S32>((*(++iter)).c_str());
  18.444 -	}
  18.445 -	catch( boost::bad_lexical_cast& )
  18.446 -	{
  18.447 -		LL_WARNS("parse_lure_bucket")
  18.448 -			<< "Couldn't parse lure bucket."
  18.449 -			<< LL_ENDL;
  18.450 -		return false;
  18.451 -	}
  18.452 -	// Grab region access
  18.453 -	region_access = SIM_ACCESS_MIN;
  18.454 -	if (++iter != tokens.end())
  18.455 -	{
  18.456 -		std::string access_str((*iter).c_str());
  18.457 -		LLStringUtil::trim(access_str);
  18.458 -		if ( access_str == "A" )
  18.459 -		{
  18.460 -			region_access = SIM_ACCESS_ADULT;
  18.461 -		}
  18.462 -		else if ( access_str == "M" )
  18.463 -		{
  18.464 -			region_access = SIM_ACCESS_MATURE;
  18.465 -		}
  18.466 -		else if ( access_str == "PG" )
  18.467 -		{
  18.468 -			region_access = SIM_ACCESS_PG;
  18.469 -		}
  18.470 -	}
  18.471 -
  18.472 -	pos.setVec((F32)rx, (F32)ry, (F32)rz);
  18.473 -	look_at.setVec((F32)lx, (F32)ly, (F32)lz);
  18.474 -
  18.475 -	region_handle = to_region_handle(gx, gy);
  18.476 -	return true;
  18.477 -}
  18.478 -
  18.479 -// Strip out "Resident" for display, but only if the message came from a user
  18.480 -// (rather than a script)
  18.481 -static std::string clean_name_from_im(const std::string& name, EInstantMessage type)
  18.482 -{
  18.483 -	switch(type)
  18.484 -	{
  18.485 -	case IM_NOTHING_SPECIAL:
  18.486 -	case IM_MESSAGEBOX:
  18.487 -	case IM_GROUP_INVITATION:
  18.488 -	case IM_INVENTORY_OFFERED:
  18.489 -	case IM_INVENTORY_ACCEPTED:
  18.490 -	case IM_INVENTORY_DECLINED:
  18.491 -	case IM_GROUP_VOTE:
  18.492 -	case IM_GROUP_MESSAGE_DEPRECATED:
  18.493 -	//IM_TASK_INVENTORY_OFFERED
  18.494 -	//IM_TASK_INVENTORY_ACCEPTED
  18.495 -	//IM_TASK_INVENTORY_DECLINED
  18.496 -	case IM_NEW_USER_DEFAULT:
  18.497 -	case IM_SESSION_INVITE:
  18.498 -	case IM_SESSION_P2P_INVITE:
  18.499 -	case IM_SESSION_GROUP_START:
  18.500 -	case IM_SESSION_CONFERENCE_START:
  18.501 -	case IM_SESSION_SEND:
  18.502 -	case IM_SESSION_LEAVE:
  18.503 -	//IM_FROM_TASK
  18.504 -	case IM_DO_NOT_DISTURB_AUTO_RESPONSE:
  18.505 -	case IM_CONSOLE_AND_CHAT_HISTORY:
  18.506 -	case IM_LURE_USER:
  18.507 -	case IM_LURE_ACCEPTED:
  18.508 -	case IM_LURE_DECLINED:
  18.509 -	case IM_GODLIKE_LURE_USER:
  18.510 -	case IM_TELEPORT_REQUEST:
  18.511 -	case IM_GROUP_ELECTION_DEPRECATED:
  18.512 -	//IM_GOTO_URL
  18.513 -	//IM_FROM_TASK_AS_ALERT
  18.514 -	case IM_GROUP_NOTICE:
  18.515 -	case IM_GROUP_NOTICE_INVENTORY_ACCEPTED:
  18.516 -	case IM_GROUP_NOTICE_INVENTORY_DECLINED:
  18.517 -	case IM_GROUP_INVITATION_ACCEPT:
  18.518 -	case IM_GROUP_INVITATION_DECLINE:
  18.519 -	case IM_GROUP_NOTICE_REQUESTED:
  18.520 -	case IM_FRIENDSHIP_OFFERED:
  18.521 -	case IM_FRIENDSHIP_ACCEPTED:
  18.522 -	case IM_FRIENDSHIP_DECLINED_DEPRECATED:
  18.523 -	//IM_TYPING_START
  18.524 -	//IM_TYPING_STOP
  18.525 -		return LLCacheName::cleanFullName(name);
  18.526 -	default:
  18.527 -		return name;
  18.528 -	}
  18.529 -}
  18.530 -
  18.531 -static std::string clean_name_from_task_im(const std::string& msg,
  18.532 -										   BOOL from_group)
  18.533 -{
  18.534 -	boost::smatch match;
  18.535 -	static const boost::regex returned_exp(
  18.536 -		"(.*been returned to your inventory lost and found folder by )(.+)( (from|near).*)");
  18.537 -	if (boost::regex_match(msg, match, returned_exp))
  18.538 -	{
  18.539 -		// match objects are 1-based for groups
  18.540 -		std::string final = match[1].str();
  18.541 -		std::string name = match[2].str();
  18.542 -		// Don't try to clean up group names
  18.543 -		if (!from_group)
  18.544 -		{
  18.545 -			final += LLCacheName::buildUsername(name);
  18.546 -		}
  18.547 -		final += match[3].str();
  18.548 -		return final;
  18.549 -	}
  18.550 -	return msg;
  18.551 -}
  18.552 -
  18.553 -static void notification_display_name_callback(const LLUUID& id,
  18.554 -					  const LLAvatarName& av_name,
  18.555 -					  const std::string& name, 
  18.556 -					  LLSD& substitutions, 
  18.557 -					  const LLSD& payload)
  18.558 -{
  18.559 -	substitutions["NAME"] = av_name.getDisplayName();
  18.560 -	LLNotificationsUtil::add(name, substitutions, payload);
  18.561 -}
  18.562 -
  18.563 -class LLPostponedIMSystemTipNotification: public LLPostponedNotification
  18.564 -{
  18.565 -protected:
  18.566 -	/* virtual */
  18.567 -	void modifyNotificationParams()
  18.568 -	{
  18.569 -		LLSD payload = mParams.payload;
  18.570 -		payload["SESSION_NAME"] = mName;
  18.571 -		mParams.payload = payload;
  18.572 -	}
  18.573 -
  18.574 -};
  18.575 -
  18.576 -// Callback for name resolution of a god/estate message
  18.577 -static void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string message)
  18.578 -{	
  18.579 -	LLSD args;
  18.580 -	args["NAME"] = av_name.getCompleteName();
  18.581 -	args["MESSAGE"] = message;
  18.582 -	LLNotificationsUtil::add("GodMessage", args);
  18.583 -
  18.584 -	// Treat like a system message and put in chat history.
  18.585 -	chat.mSourceType = CHAT_SOURCE_SYSTEM;
  18.586 -	chat.mText = message;
  18.587 -
  18.588 -	// <FS:Ansariel> [FS communication UI]
  18.589 -	//LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
  18.590 -	FSFloaterNearbyChat* nearby_chat = FSFloaterNearbyChat::getInstance();
  18.591 -	// </FS:Ansariel> [FS communication UI]
  18.592 -	if (nearby_chat)
  18.593 -	{
  18.594 -		nearby_chat->addMessage(chat);
  18.595 -	}
  18.596 -}
  18.597 -
  18.598 -const std::string NOT_ONLINE_MSG("User not online - message will be stored and delivered later.");
  18.599 -const std::string NOT_ONLINE_INVENTORY("User not online - inventory has been saved.");
  18.600 -void translate_if_needed(std::string& message)
  18.601 -{
  18.602 -	if (message == NOT_ONLINE_MSG)
  18.603 -	{
  18.604 -		message = LLTrans::getString("not_online_msg");
  18.605 -	}
  18.606 -	else if (message == NOT_ONLINE_INVENTORY)
  18.607 -	{
  18.608 -		message = LLTrans::getString("not_online_inventory");
  18.609 -	}
  18.610 -}
  18.611 -
  18.612 -// <FS:Ansariel> FIRE-505: Group name not shown in notification well
  18.613 -static void notification_group_name_cb(const std::string& group_name,
  18.614 -										const std::string& sender,
  18.615 -										const std::string& subject,
  18.616 -										const std::string& message,
  18.617 -										const LLSD& payload,
  18.618 -										U32 timestamp)
  18.619 -{
  18.620 -	LLAvatarName av_name;
  18.621 -	av_name.fromString(sender);
  18.622 -	LLSD args;
  18.623 -	args["SENDER"] = av_name.getUserNameForDisplay();
  18.624 -	args["GROUP"] = group_name;
  18.625 -	args["SUBJECT"] = subject;
  18.626 -	args["MESSAGE"] = message;
  18.627 -	LLDate notice_date = LLDate(timestamp).notNull() ? LLDate(timestamp) : LLDate::now();
  18.628 -	LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(notice_date));
  18.629 -	make_ui_sound("UISndGroupNotice"); // <FS:PP> Group notice sound
  18.630 -}
  18.631 -// </FS:Ansariel>
  18.632 -
  18.633 -// <FS:Ansariel> FIRE-6786: Always show teleport location in teleport offer
  18.634 -static void teleport_region_info_cb(const std::string& slurl, LLSD args, const LLSD& payload, const LLUUID& from_id, const LLUUID& session_id, bool can_user_access_dst_region, bool does_user_require_maturity_increase)
  18.635 -{
  18.636 -	if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC))
  18.637 -	{
  18.638 -		args["POS_SLURL"] = RlvStrings::getString(RLV_STRING_HIDDEN);
  18.639 -	}
  18.640 -	else
  18.641 -	{
  18.642 -		args["POS_SLURL"] = slurl;
  18.643 -	}
  18.644 -
  18.645 -	LLNotification::Params params;
  18.646 -
  18.647 -	if (!can_user_access_dst_region)
  18.648 -	{
  18.649 -		params.name = "TeleportOffered_MaturityBlocked_SLUrl";
  18.650 -		send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
  18.651 -		send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
  18.652 -	}
  18.653 -	else if (does_user_require_maturity_increase)
  18.654 -	{
  18.655 -		params.name = "TeleportOffered_MaturityExceeded_SLUrl";
  18.656 -	}
  18.657 -	else
  18.658 -	{
  18.659 -		params.name = "TeleportOffered_SLUrl";
  18.660 -		params.functor.name = "TeleportOffered";
  18.661 -	}
  18.662 -
  18.663 -	params.substitutions = args;
  18.664 -	params.payload = payload;
  18.665 -	LLPostponedNotification::add<LLPostponedOfferNotification>(params, from_id, false);
  18.666 -
  18.667 -	LLWindow* viewer_window = gViewerWindow->getWindow();
  18.668 -	static LLCachedControl<bool> sFlashIcon(gSavedSettings, "FSFlashOnMessage");
  18.669 -	if (viewer_window && sFlashIcon)
  18.670 -	{
  18.671 -		viewer_window->flashIcon(5.f);
  18.672 -	}
  18.673 -}
  18.674 -// </FS:Ansariel>
  18.675 -
  18.676  void process_improved_im(LLMessageSystem *msg, void **user_data)
  18.677  {
  18.678 -	LLUUID from_id;
  18.679 -	BOOL from_group;
  18.680 -	LLUUID to_id;
  18.681 -	U8 offline;
  18.682 -	U8 d = 0;
  18.683 -	LLUUID session_id;
  18.684 -	U32 timestamp;
  18.685 -	std::string name;
  18.686 -	std::string message;
  18.687 -	U32 parent_estate_id = 0;
  18.688 -	LLUUID region_id;
  18.689 -	LLVector3 position;
  18.690 -	U8 binary_bucket[MTUBYTES];
  18.691 -	S32 binary_bucket_size;
  18.692 -	LLChat chat;
  18.693 -	std::string buffer;
  18.694 -	
  18.695 -	// *TODO: Translate - need to fix the full name to first/last (maybe)
  18.696 -	msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id);
  18.697 -	msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group);
  18.698 -	msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id);
  18.699 -	msg->getU8Fast(  _PREHASH_MessageBlock, _PREHASH_Offline, offline);
  18.700 -	msg->getU8Fast(  _PREHASH_MessageBlock, _PREHASH_Dialog, d);
  18.701 -	msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id);
  18.702 -	msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, timestamp);
  18.703 -	//msg->getData("MessageBlock", "Count",		&count);
  18.704 -	msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name);
  18.705 -	msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message,		message);
  18.706 -	msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id);
  18.707 -	msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id);
  18.708 -	msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position);
  18.709 -	msg->getBinaryDataFast(  _PREHASH_MessageBlock, _PREHASH_BinaryBucket, binary_bucket, 0, 0, MTUBYTES);
  18.710 -	binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket);
  18.711 -	EInstantMessage dialog = (EInstantMessage)d;
  18.712 -
  18.713 -	// NaCl - Antispam Registry
  18.714 -	if (dialog != IM_TYPING_START && dialog != IM_TYPING_STOP &&											// Typing notifications
  18.715 -		!(dialog == IM_NOTHING_SPECIAL && offline == IM_OFFLINE && from_id.notNull() && to_id.notNull()) &&	// Saved offline IMs
  18.716 -		!(dialog == IM_FROM_TASK && offline == IM_OFFLINE)													// Saved offline IMs from objects
  18.717 -		)
  18.718 -	{
  18.719 -		if (NACLAntiSpamRegistry::instance().checkQueue(ANTISPAM_QUEUE_IM, from_id, ANTISPAM_SOURCE_AGENT))
  18.720 -		{
  18.721 -			return;
  18.722 -		}
  18.723 -	}
  18.724 -	// NaCl End
  18.725 -
  18.726 -    // make sure that we don't have an empty or all-whitespace name
  18.727 -	LLStringUtil::trim(name);
  18.728 -	if (name.empty())
  18.729 -	{
  18.730 -        name = LLTrans::getString("Unnamed");
  18.731 -	}
  18.732 -
  18.733 -	// Preserve the unaltered name for use in group notice mute checking.
  18.734 -	std::string original_name = name;
  18.735 -
  18.736 -	// IDEVO convert new-style "Resident" names for display
  18.737 -	name = clean_name_from_im(name, dialog);
  18.738 -
  18.739 -	BOOL is_do_not_disturb = gAgent.isDoNotDisturb();
  18.740 -	BOOL is_autorespond = gAgent.getAutorespond();
  18.741 -	BOOL is_autorespond_nonfriends = gAgent.getAutorespondNonFriends();
  18.742 -	// <FS:PP> FIRE-1245: Option to block/reject teleport offers
  18.743 -	BOOL is_rejecting_tp_offers = gAgent.getRejectTeleportOffers();
  18.744 -	static LLCachedControl<bool> FSDontRejectTeleportOffersFromFriends(gSavedPerAccountSettings, "FSDontRejectTeleportOffersFromFriends");
  18.745 -	// </FS:PP>
  18.746 -	BOOL is_rejecting_group_invites = gAgent.getRejectAllGroupInvites(); // <FS:PP> Option to block/reject all group invites
  18.747 -	BOOL is_rejecting_friendship_requests = gAgent.getRejectFriendshipRequests(); // <FS:PP> FIRE-15233: Automatic friendship request refusal
  18.748 -	BOOL is_autorespond_muted = gSavedPerAccountSettings.getBOOL("FSSendMutedAvatarResponse");
  18.749 -	BOOL is_muted = LLMuteList::getInstance()->isMuted(from_id, name, LLMute::flagTextChat)
  18.750 -		// object IMs contain sender object id in session_id (STORM-1209)
  18.751 -		|| (dialog == IM_FROM_TASK && LLMuteList::getInstance()->isMuted(session_id));
  18.752 -	BOOL is_owned_by_me = FALSE;
  18.753 -	BOOL is_friend = (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL) ? false : true;
  18.754 -	static LLCachedControl<bool> accept_im_from_only_friend(gSavedSettings, "VoiceCallsFriendsOnly");
  18.755 -	//BOOL is_linden = chat.mSourceType != CHAT_SOURCE_OBJECT &&
  18.756 -	//		LLMuteList::getInstance()->isLinden(name); <:FS:TM> Bear compie fix - is_linden not referenced
  18.757 -
  18.758 -	// <FS:PP> FIRE-10500: Autoresponse for (Away)
  18.759 -	static LLCachedControl<bool> FSSendAwayAvatarResponse(gSavedPerAccountSettings, "FSSendAwayAvatarResponse");
  18.760 -	BOOL is_afk = gAgent.getAFK();
  18.761 -	// </FS:PP>
  18.762 -
  18.763 -	chat.mMuted = is_muted;
  18.764 -	chat.mFromID = from_id;
  18.765 -	chat.mFromName = name;
  18.766 -	chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT;
  18.767 -	
  18.768 -	if (chat.mSourceType == CHAT_SOURCE_SYSTEM)
  18.769 -	{ // Translate server message if required (MAINT-6109)
  18.770 -		translate_if_needed(message);
  18.771 -	}
  18.772 -
  18.773 -	LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing.
  18.774 -	if (source)
  18.775 -	{
  18.776 -		is_owned_by_me = source->permYouOwner();
  18.777 -	}
  18.778 -
  18.779 -	// NaCl - Newline flood protection
  18.780 -	static LLCachedControl<bool> useAntiSpam(gSavedSettings, "UseAntiSpam");
  18.781 -	if (useAntiSpam && dialog != IM_GROUP_INVITATION)
  18.782 -	{
  18.783 -		bool doCheck = true;
  18.784 -		if (from_id.isNull() || gAgentID == from_id)
  18.785 -		{
  18.786 -			doCheck = false;
  18.787 -		}
  18.788 -		if (doCheck && is_owned_by_me)
  18.789 -		{
  18.790 -			doCheck = false;
  18.791 -		}
  18.792 -		if (doCheck && NACLAntiSpamRegistry::instance().checkNewlineFlood(ANTISPAM_QUEUE_IM, from_id, message))
  18.793 -		{
  18.794 -			return;
  18.795 -		}
  18.796 -	}
  18.797 -	// NaCl End
  18.798 -
  18.799 -	std::string separator_string(": ");
  18.800 -
  18.801 -	LLSD args;
  18.802 -	LLSD payload;
  18.803 -	LLNotification::Params params;
  18.804 -
  18.805 -	switch(dialog)
  18.806 -	{ 
  18.807 -	case IM_CONSOLE_AND_CHAT_HISTORY:
  18.808 -		args["MESSAGE"] = message;
  18.809 -		payload["from_id"] = from_id;
  18.810 -
  18.811 -		params.name = "IMSystemMessageTip";
  18.812 -		params.substitutions = args;
  18.813 -		params.payload = payload;
  18.814 -	    LLPostponedNotification::add<LLPostponedIMSystemTipNotification>(params, from_id, false);
  18.815 -		break;
  18.816 -
  18.817 -	case IM_NOTHING_SPECIAL:	// p2p IM
  18.818 -		// Don't show dialog, just do IM
  18.819 -		if (!gAgent.isGodlike()
  18.820 -				&& gAgent.getRegion()->isPrelude() 
  18.821 -				&& to_id.isNull() )
  18.822 -		{
  18.823 -			// do nothing -- don't distract newbies in
  18.824 -			// Prelude with global IMs
  18.825 -		}
  18.826 -// [RLVa:KB] - Checked: RLVa-2.1.0
  18.827 -		else if ( (RlvActions::isRlvEnabled()) && (offline == IM_ONLINE) && (!is_muted) && ((!accept_im_from_only_friend) || (is_friend)) &&
  18.828 -		          (message.length() > 3) && (RLV_CMD_PREFIX == message[0]) && (RlvHandler::instance().processIMQuery(from_id, message)) )
  18.829 -		{
  18.830 -			// Eat the message and do nothing
  18.831 -			return;
  18.832 -		}
  18.833 -// [/RLVa:KB]
  18.834 -//		else if (offline == IM_ONLINE 
  18.835 -//					&& is_do_not_disturb
  18.836 -//					&& from_id.notNull() //not a system message
  18.837 -//					&& to_id.notNull()) //not global message
  18.838 -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
  18.839 -		// <FS:Ansariel> Only send the busy reponse if either the sender is not
  18.840 -		//               muted OR the sender is muted and we explicitely want
  18.841 -		//               to inform him about that fact.
  18.842 -		else if (offline == IM_ONLINE
  18.843 -					&& (!accept_im_from_only_friend || is_friend)                                    // is friend or accept IMs from friend only disabled
  18.844 -					&& ((is_do_not_disturb && (!is_muted || (is_muted && !is_autorespond_muted))) || // do not disturb
  18.845 -						(is_autorespond && !is_muted) ||                                             // autorespond everyone
  18.846 -						(is_autorespond_nonfriends && !is_friend && !is_muted) ||                    // autorespond friends only
  18.847 -						(is_afk && FSSendAwayAvatarResponse && !is_muted))                           // away
  18.848 -					&& from_id.notNull() //not a system message
  18.849 -					&& to_id.notNull() //not global message
  18.850 -					&& RlvActions::canReceiveIM(from_id))
  18.851 -// [/RLVa:KB]
  18.852 -		{
  18.853 -			// <FS:Ansariel> Log autoresponse notification after initial message
  18.854 -			bool has_session = true;
  18.855 -
  18.856 -			// <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  18.857 -			// Session id will be null if avatar answers from offline IM via email
  18.858 -			std::string response;
  18.859 -			if (!gIMMgr->hasSession(session_id) && session_id.notNull())
  18.860 -			{
  18.861 -			// </FS:Ansariel>
  18.862 -				// <FS:Ansariel> Log autoresponse notification after initial message
  18.863 -				has_session = false;
  18.864 -				// <FS:Ansariel> FS autoresponse feature
  18.865 -				std::string my_name;
  18.866 -				LLAgentUI::buildFullname(my_name);
  18.867 -				if (is_do_not_disturb)
  18.868 -				{
  18.869 -					response = gSavedPerAccountSettings.getString("DoNotDisturbModeResponse");
  18.870 -				}
  18.871 -				else if (is_autorespond_nonfriends && !is_friend)
  18.872 -				{
  18.873 -					response = gSavedPerAccountSettings.getString("FSAutorespondNonFriendsResponse");
  18.874 -				}
  18.875 -				else if (is_autorespond)
  18.876 -				{
  18.877 -					response = gSavedPerAccountSettings.getString("FSAutorespondModeResponse");
  18.878 -				}
  18.879 -				// <FS:PP> FIRE-10500: Autoresponse for (Away)
  18.880 -				else if (is_afk && FSSendAwayAvatarResponse)
  18.881 -				{
  18.882 -					response = gSavedPerAccountSettings.getString("FSAwayAvatarResponse");
  18.883 -				}
  18.884 -				// </FS:PP>
  18.885 -				else
  18.886 -				{
  18.887 -					LL_WARNS() << "Unknown auto-response mode" << LL_ENDL;
  18.888 -				}
  18.889 -				pack_instant_message(
  18.890 -					gMessageSystem,
  18.891 -					gAgent.getID(),
  18.892 -					FALSE,
  18.893 -					gAgent.getSessionID(),
  18.894 -					from_id,
  18.895 -					my_name,
  18.896 -					response,
  18.897 -					IM_ONLINE,
  18.898 -					IM_DO_NOT_DISTURB_AUTO_RESPONSE,
  18.899 -					session_id);
  18.900 -				gAgent.sendReliableMessage();
  18.901 -				// </FS:Ansariel> FS autoresponse feature
  18.902 -			// <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  18.903 -			}
  18.904 -			// </FS:Ansariel>
  18.905 -
  18.906 -			// <FS:Ansariel> checkfor and process reqinfo
  18.907 -			if (has_session)
  18.908 -			{
  18.909 -				message = FSData::getInstance()->processRequestForInfo(from_id,message,name,session_id);
  18.910 -			}
  18.911 -			// </FS:Ansariel>
  18.912 -
  18.913 -			// now store incoming IM in chat history
  18.914 -
  18.915 -			buffer = message;
  18.916 -	
  18.917 -			LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
  18.918 -
  18.919 -			// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
  18.920 -			chat.mText = buffer;
  18.921 -			bool keyword_alert_performed = false;
  18.922 -			if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
  18.923 -			{
  18.924 -				FSKeywords::notify(chat);
  18.925 -				keyword_alert_performed = true;
  18.926 -			}
  18.927 -			// </FS:PP>
  18.928 -
  18.929 -			// add to IM panel, but do not bother the user
  18.930 -			gIMMgr->addMessage(
  18.931 -				session_id,
  18.932 -				from_id,
  18.933 -				name,
  18.934 -				buffer,
  18.935 -				IM_OFFLINE == offline,
  18.936 -				LLStringUtil::null,
  18.937 -				dialog,
  18.938 -				parent_estate_id,
  18.939 -				region_id,
  18.940 -				position,
  18.941 -				true,
  18.942 -				false,
  18.943 -				keyword_alert_performed);
  18.944 -
  18.945 -			// <FS:Ansariel> Old "do not disturb" message behavior: only send once if session not open
  18.946 -			//if (!gIMMgr->isDNDMessageSend(session_id))
  18.947 -			//{
  18.948 -			//	// return a standard "do not disturb" message, but only do it to online IM
  18.949 -			//	// (i.e. not other auto responses and not store-and-forward IM)
  18.950 -			//	send_do_not_disturb_message(msg, from_id, session_id);
  18.951 -			//	gIMMgr->setDNDMessageSent(session_id, true);
  18.952 -			//}
  18.953 -			// </FS:Ansariel>
  18.954 -
  18.955 -			if (!has_session)
  18.956 -			{
  18.957 -				// <FS:LO> Fire-5389 - "Autoresponse Sent" message added to Firestorm as was in Phoenix
  18.958 -				LLStringUtil::format_map_t args;
  18.959 -				args["MESSAGE"] = response;
  18.960 -
  18.961 -				gIMMgr->addMessage(
  18.962 -					session_id,
  18.963 -					gAgentID,
  18.964 -					LLStringUtil::null, // Pass null value so no name gets prepended
  18.965 -					LLTrans::getString("IM_autoresponse_sent", args),
  18.966 -					false,
  18.967 -					name,
  18.968 -					IM_NOTHING_SPECIAL,
  18.969 -					parent_estate_id,
  18.970 -					region_id,
  18.971 -					position,
  18.972 -					false,
  18.973 -					true
  18.974 -					);
  18.975 -				// </FS:LO>
  18.976 -
  18.977 -				// <FS:Ansariel> Send inventory item on autoresponse
  18.978 -				LLUUID item_id(gSavedPerAccountSettings.getString("FSAutoresponseItemUUID"));
  18.979 -				if (item_id.notNull())
  18.980 -				{
  18.981 -					LLInventoryItem* item = dynamic_cast<LLInventoryItem*>(gInventory.getItem(item_id));
  18.982 -					if (item)
  18.983 -					{
  18.984 -						gIMMgr->addMessage(
  18.985 -								session_id,
  18.986 -								gAgentID,
  18.987 -								LLStringUtil::null, // Pass null value so no name gets prepended
  18.988 -								LLTrans::getString("IM_autoresponse_item_sent", LLSD().with("[ITEM_NAME]", item->getName())),
  18.989 -								false,
  18.990 -								name,
  18.991 -								IM_NOTHING_SPECIAL,
  18.992 -								parent_estate_id,
  18.993 -								region_id,
  18.994 -								position,
  18.995 -								false,
  18.996 -								true);
  18.997 -						LLGiveInventory::doGiveInventoryItem(from_id, item, session_id);
  18.998 -					}
  18.999 -				}
 18.1000 -				// </FS:Ansariel>
 18.1001 -			}
 18.1002 -		}
 18.1003 -		else if (from_id.isNull())
 18.1004 -		{
 18.1005 -			LLSD args;
 18.1006 -			args["MESSAGE"] = message;
 18.1007 -			LLNotificationsUtil::add("SystemMessage", args);
 18.1008 -		}
 18.1009 -		else if (to_id.isNull())
 18.1010 -		{
 18.1011 -			// Message to everyone from GOD, look up the fullname since
 18.1012 -			// server always slams name to legacy names
 18.1013 -			LLAvatarNameCache::get(from_id, boost::bind(god_message_name_cb, _2, chat, message));
 18.1014 -		}
 18.1015 -		else
 18.1016 -		{
 18.1017 -			// standard message, not from system
 18.1018 -			std::string saved;
 18.1019 -			if(offline == IM_OFFLINE)
 18.1020 -			{
 18.1021 -				LLStringUtil::format_map_t args;
 18.1022 -				args["[LONG_TIMESTAMP]"] = formatted_time(timestamp);
 18.1023 -				saved = LLTrans::getString("Saved_message", args);
 18.1024 -			}
 18.1025 -			buffer = saved + message;
 18.1026 -
 18.1027 -			LL_DEBUGS("Messaging") << "session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 18.1028 -
 18.1029 -			bool mute_im = is_muted;
 18.1030 -			if(accept_im_from_only_friend&&!is_friend)
 18.1031 -			{
 18.1032 -				if (!gIMMgr->isNonFriendSessionNotified(session_id))
 18.1033 -				{
 18.1034 -					// <FS:Ansariel> Disable this - doesn't make sense it will be skipped by LLIMMgr::addMessage() anyway
 18.1035 -					//std::string message = LLTrans::getString("IM_unblock_only_groups_friends");
 18.1036 -					//gIMMgr->addMessage(session_id, from_id, name, message, IM_OFFLINE == offline);
 18.1037 -					// </FS:Ansariel>
 18.1038 -					gIMMgr->addNotifiedNonFriendSessionID(session_id);
 18.1039 -				}
 18.1040 -
 18.1041 -				mute_im = true;
 18.1042 -			}
 18.1043 -
 18.1044 -// [RLVa:KB] - Checked: 2010-11-30 (RLVa-1.3.0)
 18.1045 -			// Don't block offline IMs, or IMs from Lindens
 18.1046 -			if ( (rlv_handler_t::isEnabled()) && (offline != IM_OFFLINE) && (!RlvActions::canReceiveIM(from_id)) && (!LLMuteList::getInstance()->isLinden(original_name) ))
 18.1047 -			{
 18.1048 -				if (!mute_im)
 18.1049 -					RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM_REMOTE), session_id);
 18.1050 -				message = RlvStrings::getString(RLV_STRING_BLOCKED_RECVIM);
 18.1051 -			}
 18.1052 -// [/RLVa:KB]
 18.1053 -
 18.1054 -			if (!mute_im) 
 18.1055 -			{
 18.1056 -				// checkfor and process reqinfo
 18.1057 -				message = FSData::getInstance()->processRequestForInfo(from_id, message, name, session_id);
 18.1058 -
 18.1059 -				// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
 18.1060 -				chat.mText = message;
 18.1061 -				bool keyword_alert_performed = false;
 18.1062 -				if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
 18.1063 -				{
 18.1064 -					FSKeywords::notify(chat);
 18.1065 -					keyword_alert_performed = true;
 18.1066 -				}
 18.1067 -				// </FS:PP>
 18.1068 -
 18.1069 -				buffer = saved + message;
 18.1070 -
 18.1071 -				gIMMgr->addMessage(
 18.1072 -					session_id,
 18.1073 -					from_id,
 18.1074 -					name,
 18.1075 -					buffer,
 18.1076 -					IM_OFFLINE == offline,
 18.1077 -					LLStringUtil::null,
 18.1078 -					dialog,
 18.1079 -					parent_estate_id,
 18.1080 -					region_id,
 18.1081 -					position,
 18.1082 -					true,
 18.1083 -					false,
 18.1084 -					keyword_alert_performed);
 18.1085 -			}
 18.1086 -			else
 18.1087 -			{
 18.1088 -				/*
 18.1089 -				EXT-5099
 18.1090 -				currently there is no way to store in history only...
 18.1091 -				using  LLNotificationsUtil::add will add message to Nearby Chat
 18.1092 -
 18.1093 -				// muted user, so don't start an IM session, just record line in chat
 18.1094 -				// history.  Pretend the chat is from a local agent,
 18.1095 -				// so it will go into the history but not be shown on screen.
 18.1096 -
 18.1097 -				LLSD args;
 18.1098 -				args["MESSAGE"] = buffer;
 18.1099 -				LLNotificationsUtil::add("SystemMessageTip", args);
 18.1100 -				*/
 18.1101 -				static LLCachedControl<bool> fsSendMutedAvatarResponse(gSavedPerAccountSettings, "FSSendMutedAvatarResponse");
 18.1102 -				if (fsSendMutedAvatarResponse && (!accept_im_from_only_friend || is_friend))
 18.1103 -				{
 18.1104 -					std::string my_name;
 18.1105 -					LLAgentUI::buildFullname(my_name);
 18.1106 -					std::string response = gSavedPerAccountSettings.getString("FSMutedAvatarResponse");
 18.1107 -					pack_instant_message(
 18.1108 -						gMessageSystem,
 18.1109 -						gAgent.getID(),
 18.1110 -						FALSE,
 18.1111 -						gAgent.getSessionID(),
 18.1112 -						from_id,
 18.1113 -						my_name,
 18.1114 -						response,
 18.1115 -						IM_ONLINE,
 18.1116 -						IM_DO_NOT_DISTURB_AUTO_RESPONSE,
 18.1117 -						session_id);
 18.1118 -					gAgent.sendReliableMessage();
 18.1119 -				}
 18.1120 -
 18.1121 -				// <FS:Ansariel> Don't flash for muted IMs
 18.1122 -				return;
 18.1123 -			}
 18.1124 -		}
 18.1125 -		break;
 18.1126 -
 18.1127 -	case IM_TYPING_START:
 18.1128 -		{
 18.1129 -			LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
 18.1130 -			gIMMgr->processIMTypingStart(im_info);
 18.1131 -		}
 18.1132 -		break;
 18.1133 -
 18.1134 -	case IM_TYPING_STOP:
 18.1135 -		{
 18.1136 -			LLPointer<LLIMInfo> im_info = new LLIMInfo(gMessageSystem);
 18.1137 -			gIMMgr->processIMTypingStop(im_info);
 18.1138 -		}
 18.1139 -		break;
 18.1140 -
 18.1141 -	case IM_MESSAGEBOX:
 18.1142 -		{
 18.1143 -			// This is a block, modeless dialog.
 18.1144 -			//*TODO: Translate
 18.1145 -			args["MESSAGE"] = message;
 18.1146 -			LLNotificationsUtil::add("SystemMessageTip", args);
 18.1147 -		}
 18.1148 -		break;
 18.1149 -	case IM_GROUP_NOTICE:
 18.1150 -	case IM_GROUP_NOTICE_REQUESTED:
 18.1151 -		{
 18.1152 -			LL_INFOS("Messaging") << "Received IM_GROUP_NOTICE message." << LL_ENDL;
 18.1153 -			// Read the binary bucket for more information.
 18.1154 -			struct notice_bucket_header_t
 18.1155 -			{
 18.1156 -				U8 has_inventory;
 18.1157 -				U8 asset_type;
 18.1158 -				LLUUID group_id;
 18.1159 -			};
 18.1160 -			struct notice_bucket_full_t
 18.1161 -			{
 18.1162 -				struct notice_bucket_header_t header;
 18.1163 -				U8 item_name[DB_INV_ITEM_NAME_BUF_SIZE];
 18.1164 -			}* notice_bin_bucket;
 18.1165 -
 18.1166 -			// Make sure the binary bucket is big enough to hold the header 
 18.1167 -			// and a null terminated item name.
 18.1168 -			if ( (binary_bucket_size < (S32)((sizeof(notice_bucket_header_t) + sizeof(U8))))
 18.1169 -				|| (binary_bucket[binary_bucket_size - 1] != '\0') )
 18.1170 -			{
 18.1171 -				LL_WARNS("Messaging") << "Malformed group notice binary bucket" << LL_ENDL;
 18.1172 -				// <FS:Ansariel> Don't flash task icon
 18.1173 -				//break;
 18.1174 -				return;
 18.1175 -			}
 18.1176 -
 18.1177 -			// The group notice packet does not have an AgentID.  Obtain one from the name cache.
 18.1178 -			// If last name is "Resident" strip it out so the cache name lookup works.
 18.1179 -			std::string::size_type index = original_name.find(" Resident");
 18.1180 -			if (index != std::string::npos)
 18.1181 -			{
 18.1182 -				original_name = original_name.substr(0, index);
 18.1183 -			}
 18.1184 -
 18.1185 -			std::string legacy_name = gCacheName->buildLegacyName(original_name);
 18.1186 -			LLUUID agent_id = LLAvatarNameCache::findIdByName(legacy_name);
 18.1187 -
 18.1188 -			if (agent_id.isNull())
 18.1189 -			{
 18.1190 -				LL_WARNS("Messaging") << "buildLegacyName returned null while processing " << original_name << LL_ENDL;
 18.1191 -			}
 18.1192 -			else if (LLMuteList::getInstance()->isMuted(agent_id))
 18.1193 -			{
 18.1194 -				// <FS:Ansariel> Don't flash task icon
 18.1195 -				//break;
 18.1196 -				return;
 18.1197 -			}
 18.1198 -
 18.1199 -			notice_bin_bucket = (struct notice_bucket_full_t*) &binary_bucket[0];
 18.1200 -			U8 has_inventory = notice_bin_bucket->header.has_inventory;
 18.1201 -			U8 asset_type = notice_bin_bucket->header.asset_type;
 18.1202 -			LLUUID group_id = notice_bin_bucket->header.group_id;
 18.1203 -			std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name);
 18.1204 -
 18.1205 -			// If there is inventory, give the user the inventory offer.
 18.1206 -			LLOfferInfo* info = NULL;
 18.1207 -
 18.1208 -			if (has_inventory)
 18.1209 -			{
 18.1210 -				info = new LLOfferInfo();
 18.1211 -				
 18.1212 -				info->mIM = IM_GROUP_NOTICE;
 18.1213 -				info->mFromID = from_id;
 18.1214 -				info->mFromGroup = from_group;
 18.1215 -				info->mTransactionID = session_id;
 18.1216 -				info->mType = (LLAssetType::EType) asset_type;
 18.1217 -				info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
 18.1218 -				std::string from_name;
 18.1219 -
 18.1220 -				// <FS:Ansariel> FIRE-17714: Make group notice attachment confirmation localizable
 18.1221 -				//from_name += "A group member named ";
 18.1222 -				//from_name += name;
 18.1223 -				LLStringUtil::format_map_t args;
 18.1224 -				args["NAME"] = name;
 18.1225 -				from_name += LLTrans::getString("InvOfferGroupNoticeName", args);
 18.1226 -				// </FS:Ansariel>
 18.1227 -
 18.1228 -				info->mFromName = from_name;
 18.1229 -				info->mDesc = item_name;
 18.1230 -				info->mHost = msg->getSender();
 18.1231 -			}
 18.1232 -			
 18.1233 -			std::string str(message);
 18.1234 -
 18.1235 -			// Tokenize the string.
 18.1236 -			// TODO: Support escaped tokens ("||" -> "|")
 18.1237 -			typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
 18.1238 -			boost::char_separator<char> sep("|","",boost::keep_empty_tokens);
 18.1239 -			tokenizer tokens(str, sep);
 18.1240 -			tokenizer::iterator iter = tokens.begin();
 18.1241 -
 18.1242 -			std::string subj(*iter++);
 18.1243 -			std::string mes(*iter++);
 18.1244 -
 18.1245 -			// Send the notification down the new path.
 18.1246 -			// For requested notices, we don't want to send the popups.
 18.1247 -			if (dialog != IM_GROUP_NOTICE_REQUESTED)
 18.1248 -			{
 18.1249 -				payload["subject"] = subj;
 18.1250 -				payload["message"] = mes;
 18.1251 -				payload["sender_name"] = name;
 18.1252 -				payload["sender_id"] = agent_id;
 18.1253 -				payload["group_id"] = group_id;
 18.1254 -				payload["inventory_name"] = item_name;
 18.1255 - 				payload["received_time"] = LLDate::now();
 18.1256 -				if(info && info->asLLSD())
 18.1257 -				{
 18.1258 -					payload["inventory_offer"] = info->asLLSD();
 18.1259 -				}
 18.1260 -
 18.1261 -				// <FS:Ansariel> FIRE-505: Group name not shown in notification well
 18.1262 -				//LLSD args;
 18.1263 -				//args["SUBJECT"] = subj;
 18.1264 -				//LLDate notice_date = LLDate(timestamp).notNull() ? LLDate(timestamp) : LLDate::now();
 18.1265 -				//LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).time_stamp(notice_date));
 18.1266 -				//make_ui_sound("UISndGroupNotice"); // <FS:PP> Group notice sound
 18.1267 -				if (group_id.isNull())
 18.1268 -				{
 18.1269 -					LL_WARNS() << "Received group notice with null id!" << LL_ENDL;
 18.1270 -				}
 18.1271 -				gCacheName->get(group_id, true, boost::bind(&notification_group_name_cb, _2, name, subj, mes, payload, timestamp));
 18.1272 -				// </FS:Ansariel>
 18.1273 -			}
 18.1274 -
 18.1275 -			// Also send down the old path for now.
 18.1276 -			if (IM_GROUP_NOTICE_REQUESTED == dialog)
 18.1277 -			{
 18.1278 -				
 18.1279 -				LLPanelGroup::showNotice(subj,mes,group_id,has_inventory,item_name,info);
 18.1280 -			}
 18.1281 -			else
 18.1282 -			{
 18.1283 -				delete info;
 18.1284 -			}
 18.1285 -		}
 18.1286 -		break;
 18.1287 -	case IM_GROUP_INVITATION:
 18.1288 -		{
 18.1289 -			// <FS:Ansariel> FIRE-20385: Don't show group invitation for groups agent is already a member of
 18.1290 -			if (gAgent.isInGroup(from_id) && !gSavedSettings.getBOOL("FSShowJoinedGroupInvitations"))
 18.1291 -			{
 18.1292 -				LL_INFOS("Messaging") << "Received group invitation for group " << from_id << " but we are already a member" << LL_ENDL;
 18.1293 -				return;
 18.1294 -			}
 18.1295 -			// </FS:Ansariel>
 18.1296 -
 18.1297 -			if (!is_muted)
 18.1298 -			{
 18.1299 -				// group is not blocked, but we still need to check agent that sent the invitation
 18.1300 -				// and we have no agent's id
 18.1301 -				// Note: server sends username "first.last".
 18.1302 -				is_muted |= LLMuteList::getInstance()->isMuted(name);
 18.1303 -			}
 18.1304 -			if (is_do_not_disturb || is_muted)
 18.1305 -			{
 18.1306 -				send_do_not_disturb_message(msg, from_id);
 18.1307 -			}
 18.1308 -			
 18.1309 -			if (!is_muted)
 18.1310 -			{
 18.1311 -				LL_INFOS("Messaging") << "Received IM_GROUP_INVITATION message." << LL_ENDL;
 18.1312 -				// Read the binary bucket for more information.
 18.1313 -				struct invite_bucket_t
 18.1314 -				{
 18.1315 -					S32 membership_fee;
 18.1316 -					LLUUID role_id;
 18.1317 -				}* invite_bucket;
 18.1318 -
 18.1319 -				// Make sure the binary bucket is the correct size.
 18.1320 -				if (binary_bucket_size != sizeof(invite_bucket_t))
 18.1321 -				{
 18.1322 -					LL_WARNS("Messaging") << "Malformed group invite binary bucket" << LL_ENDL;
 18.1323 -					// <FS:Ansariel> Don't flash task icon
 18.1324 -					//break;
 18.1325 -					return;
 18.1326 -				}
 18.1327 -
 18.1328 -				invite_bucket = (struct invite_bucket_t*) &binary_bucket[0];
 18.1329 -				S32 membership_fee = ntohl(invite_bucket->membership_fee);
 18.1330 -
 18.1331 -				LLSD payload;
 18.1332 -				payload["transaction_id"] = session_id;
 18.1333 -				payload["group_id"] = from_id;
 18.1334 -				payload["name"] = name;
 18.1335 -				payload["message"] = message;
 18.1336 -				payload["fee"] = membership_fee;
 18.1337 -
 18.1338 -				LLSD args;
 18.1339 -				args["MESSAGE"] = message;
 18.1340 -				// we shouldn't pass callback functor since it is registered in LLFunctorRegistration
 18.1341 -
 18.1342 -				// <FS:PP> Option to block/reject all group invites
 18.1343 -				// LLNotificationsUtil::add("JoinGroup", args, payload);
 18.1344 -				if (is_rejecting_group_invites)
 18.1345 -				{
 18.1346 -					LL_INFOS("Messaging") << "Group invite automatically rejected because of the user setting..." << LL_ENDL;
 18.1347 -					return;
 18.1348 -				}
 18.1349 -				else
 18.1350 -				{
 18.1351 -					make_ui_sound("UISndGroupInvitation"); // <FS:PP> Group invitation sound
 18.1352 -					LLNotificationsUtil::add("JoinGroup", args, payload);
 18.1353 -				}
 18.1354 -				// </FS:PP>
 18.1355 -			}
 18.1356 -			// <FS:Ansariel> Don't flash task icon for group messages from muted senders
 18.1357 -			else
 18.1358 -			{
 18.1359 -				return;
 18.1360 -			}
 18.1361 -			// </FS:Ansariel>
 18.1362 -		}
 18.1363 -		break;
 18.1364 -
 18.1365 -	case IM_INVENTORY_OFFERED:
 18.1366 -	case IM_TASK_INVENTORY_OFFERED:
 18.1367 -		// Someone has offered us some inventory.
 18.1368 -		{
 18.1369 -			LLOfferInfo* info = new LLOfferInfo;
 18.1370 -			if (IM_INVENTORY_OFFERED == dialog)
 18.1371 -			{
 18.1372 -				struct offer_agent_bucket_t
 18.1373 -				{
 18.1374 -					S8		asset_type;
 18.1375 -					LLUUID	object_id;
 18.1376 -				}* bucketp;
 18.1377 -
 18.1378 -				if (sizeof(offer_agent_bucket_t) != binary_bucket_size)
 18.1379 -				{
 18.1380 -					LL_WARNS("Messaging") << "Malformed inventory offer from agent" << LL_ENDL;
 18.1381 -					delete info;
 18.1382 -					// <FS:Ansariel> Don't flash task icon
 18.1383 -					//break;
 18.1384 -					return; 
 18.1385 -				}
 18.1386 -				bucketp = (struct offer_agent_bucket_t*) &binary_bucket[0];
 18.1387 -				info->mType = (LLAssetType::EType) bucketp->asset_type;
 18.1388 -				info->mObjectID = bucketp->object_id;
 18.1389 -				info->mFromObject = FALSE;
 18.1390 -			}
 18.1391 -			else // IM_TASK_INVENTORY_OFFERED
 18.1392 -			{
 18.1393 -				if (sizeof(S8) != binary_bucket_size)
 18.1394 -				{
 18.1395 -					LL_WARNS("Messaging") << "Malformed inventory offer from object" << LL_ENDL;
 18.1396 -					delete info;
 18.1397 -					// <FS:Ansariel> Don't flash task icon
 18.1398 -					//break;
 18.1399 -					return; 
 18.1400 -				}
 18.1401 -				info->mType = (LLAssetType::EType) binary_bucket[0];
 18.1402 -				info->mObjectID = LLUUID::null;
 18.1403 -				info->mFromObject = TRUE;
 18.1404 -			}
 18.1405 -
 18.1406 -			info->mIM = dialog;
 18.1407 -			info->mFromID = from_id;
 18.1408 -			info->mFromGroup = from_group;
 18.1409 -			info->mTransactionID = session_id;
 18.1410 -			info->mFolderID = gInventory.findCategoryUUIDForType(LLFolderType::assetTypeToFolderType(info->mType));
 18.1411 -
 18.1412 -			info->mFromName = name;
 18.1413 -			info->mDesc = message;
 18.1414 -			info->mHost = msg->getSender();
 18.1415 -			//if (((is_do_not_disturb && !is_owned_by_me) || is_muted))
 18.1416 -			if (is_muted)
 18.1417 -			{
 18.1418 -				// Prefetch the offered item so that it can be discarded by the appropriate observer. (EXT-4331)
 18.1419 -				LLInventoryFetchItemsObserver* fetch_item = new LLInventoryFetchItemsObserver(info->mObjectID);
 18.1420 -				fetch_item->startFetch();
 18.1421 -				delete fetch_item;
 18.1422 -
 18.1423 -				// Same as closing window
 18.1424 -				info->forceResponse(IOR_DECLINE);
 18.1425 -			}
 18.1426 -			// old logic: busy mode must not affect interaction with objects (STORM-565)
 18.1427 -			// new logic: inventory offers from in-world objects should be auto-declined (CHUI-519)
 18.1428 -			else if (is_do_not_disturb && dialog == IM_TASK_INVENTORY_OFFERED)
 18.1429 -			{
 18.1430 -				// Until throttling is implemented, do not disturb mode should reject inventory instead of silently
 18.1431 -				// accepting it.  SEE SL-39554
 18.1432 -				info->forceResponse(IOR_DECLINE);
 18.1433 -			}
 18.1434 -			else
 18.1435 -			{
 18.1436 -				inventory_offer_handler(info);
 18.1437 -			}
 18.1438 -		}
 18.1439 -		break;
 18.1440 -
 18.1441 -	case IM_INVENTORY_ACCEPTED:
 18.1442 -	{
 18.1443 -//		args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
 18.1444 -//		args["ORIGINAL_NAME"] = original_name;
 18.1445 -// [RLVa:KB] - Checked: RLVa-1.2.2
 18.1446 -		// Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open
 18.1447 -		LLAvatarName av_name;
 18.1448 -		bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
 18.1449 -			(RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id));
 18.1450 -		args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();;
 18.1451 -		args["ORIGINAL_NAME"] = fRlvCanShowName ? original_name : (LLAvatarNameCache::get(from_id, &av_name) ? RlvStrings::getAnonym(av_name) : RlvStrings::getAnonym(original_name));
 18.1452 -// [/RLVa:KB]
 18.1453 -		LLSD payload;
 18.1454 -		payload["from_id"] = from_id;
 18.1455 -		// Passing the "SESSION_NAME" to use it for IM notification logging
 18.1456 -		// in LLTipHandler::processNotification(). See STORM-941.
 18.1457 -		payload["SESSION_NAME"] = name;
 18.1458 -		LLNotificationsUtil::add("InventoryAccepted", args, payload);
 18.1459 -		break;
 18.1460 -	}
 18.1461 -	case IM_INVENTORY_DECLINED:
 18.1462 -	{
 18.1463 -//		args["NAME"] = LLSLURL("agent", from_id, "completename").getSLURLString();;
 18.1464 -// [RLVa:KB] - Checked: RLVa-1.2.2
 18.1465 -		// Only anonymize the name if the agent is nearby, there isn't an open IM session to them and their profile isn't open
 18.1466 -		bool fRlvCanShowName = (!RlvActions::isRlvEnabled()) ||
 18.1467 -			(RlvActions::canShowName(RlvActions::SNC_DEFAULT, from_id)) || (!RlvUtil::isNearbyAgent(from_id)) || (RlvUIEnabler::hasOpenProfile(from_id)) || (RlvUIEnabler::hasOpenIM(from_id));
 18.1468 -		args["NAME"] = LLSLURL("agent", from_id, (fRlvCanShowName) ? "completename" : "rlvanonym").getSLURLString();;
 18.1469 -// [/RLVa:KB]
 18.1470 -		LLSD payload;
 18.1471 -		payload["from_id"] = from_id;
 18.1472 -		LLNotificationsUtil::add("InventoryDeclined", args, payload);
 18.1473 -		break;
 18.1474 -	}
 18.1475 -	// TODO: _DEPRECATED suffix as part of vote removal - DEV-24856
 18.1476 -	case IM_GROUP_VOTE:
 18.1477 -		{
 18.1478 -			LL_WARNS("Messaging") << "Received IM: IM_GROUP_VOTE_DEPRECATED" << LL_ENDL;
 18.1479 -		}
 18.1480 -		break;
 18.1481 -
 18.1482 -	case IM_GROUP_ELECTION_DEPRECATED:
 18.1483 -	{
 18.1484 -		LL_WARNS("Messaging") << "Received IM: IM_GROUP_ELECTION_DEPRECATED" << LL_ENDL;
 18.1485 -	}
 18.1486 -	break;
 18.1487 -	
 18.1488 -	case IM_FROM_TASK:
 18.1489 -		{
 18.1490 -
 18.1491 -			if (is_do_not_disturb && !is_owned_by_me)
 18.1492 -			{
 18.1493 -				return;
 18.1494 -			}
 18.1495 -
 18.1496 -			// <FS:PP> FIRE-6406: Feature to disable Object Return notification
 18.1497 -			static LLCachedControl<bool> FSDisableReturnObjectNotification(gSavedSettings, "FSDisableReturnObjectNotification");
 18.1498 -			if (FSDisableReturnObjectNotification)
 18.1499 -			{
 18.1500 -				if (message.find("been returned to your inventory") != -1)
 18.1501 -				{
 18.1502 -					return;
 18.1503 -				}
 18.1504 -			}
 18.1505 -			// </FS:PP>
 18.1506 -
 18.1507 -			// Build a link to open the object IM info window.
 18.1508 -			std::string location = ll_safe_string((char*)binary_bucket, binary_bucket_size-1);
 18.1509 -
 18.1510 -			if (session_id.notNull())
 18.1511 -			{
 18.1512 -				chat.mFromID = session_id;
 18.1513 -			}
 18.1514 -			else
 18.1515 -			{
 18.1516 -				// This message originated on a region without the updated code for task id and slurl information.
 18.1517 -				// We just need a unique ID for this object that isn't the owner ID.
 18.1518 -				// If it is the owner ID it will overwrite the style that contains the link to that owner's profile.
 18.1519 -				// This isn't ideal - it will make 1 style for all objects owned by the the same person/group.
 18.1520 -				// This works because the only thing we can really do in this case is show the owner name and link to their profile.
 18.1521 -				chat.mFromID = from_id ^ gAgent.getSessionID();
 18.1522 -			}
 18.1523 -
 18.1524 -			chat.mSourceType = CHAT_SOURCE_OBJECT;
 18.1525 -			chat.mChatType = CHAT_TYPE_IM;
 18.1526 -
 18.1527 -			// To conclude that the source type of message is CHAT_SOURCE_SYSTEM it's not
 18.1528 -			// enough to check only from name (i.e. fromName = "Second Life"). For example
 18.1529 -			// source type of messages from objects called "Second Life" should not be CHAT_SOURCE_SYSTEM.
 18.1530 -			bool chat_from_system = (SYSTEM_FROM == name) && region_id.isNull() && position.isNull();
 18.1531 -			if(chat_from_system)
 18.1532 -			{
 18.1533 -				// System's UUID is NULL (fixes EXT-4766)
 18.1534 -				chat.mFromID = LLUUID::null;
 18.1535 -				chat.mSourceType = CHAT_SOURCE_SYSTEM;
 18.1536 -			}
 18.1537 -
 18.1538 -			// IDEVO Some messages have embedded resident names
 18.1539 -			message = clean_name_from_task_im(message, from_group);
 18.1540 -
 18.1541 -			LLSD query_string;
 18.1542 -			query_string["owner"] = from_id;
 18.1543 -// [RLVa:KB] - Checked: RLVa-1.2.0
 18.1544 -			if (RlvActions::isRlvEnabled())
 18.1545 -			{
 18.1546 -				// NOTE: the chat message itself will be filtered in LLNearbyChatHandler::processChat()
 18.1547 -				if ( (!RlvActions::canShowName(RlvActions::SNC_DEFAULT)) && (!from_group) && (RlvUtil::isNearbyAgent(from_id)) )
 18.1548 -				{
 18.1549 -					query_string["rlv_shownames"] = TRUE;
 18.1550 -
 18.1551 -					RlvUtil::filterNames(name);
 18.1552 -					chat.mFromName = name;
 18.1553 -				}
 18.1554 -				if (!RlvActions::canShowLocation())
 18.1555 -				{
 18.1556 -					std::string::size_type idxPos = location.find('/');
 18.1557 -					if ( (std::string::npos != idxPos) && (RlvUtil::isNearbyRegion(location.substr(0, idxPos))) )
 18.1558 -						location = RlvStrings::getString(RLV_STRING_HIDDEN_REGION);
 18.1559 -				}
 18.1560 -			}
 18.1561 -// [/RLVa:KB]
 18.1562 -			query_string["slurl"] = location;
 18.1563 -			query_string["name"] = name;
 18.1564 -			if (from_group)
 18.1565 -			{
 18.1566 -				query_string["groupowned"] = "true";
 18.1567 -			}	
 18.1568 -
 18.1569 -//			chat.mURL = LLSLURL("objectim", session_id, "").getSLURLString();
 18.1570 -// [SL:KB] - Checked: 2010-11-02 (RLVa-1.2.2a) | Added: RLVa-1.2.2a
 18.1571 -			chat.mURL = LLSLURL("objectim", session_id, LLURI::mapToQueryString(query_string)).getSLURLString();
 18.1572 -// [/SL:KB]
 18.1573 -			chat.mText = message;
 18.1574 -
 18.1575 -			// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of Task IM)
 18.1576 -			if (FSKeywords::getInstance()->chatContainsKeyword(chat, true))
 18.1577 -			{
 18.1578 -				FSKeywords::notify(chat);
 18.1579 -			}
 18.1580 -			// </FS:PP>
 18.1581 -
 18.1582 -			// Note: lie to Nearby Chat, pretending that this is NOT an IM, because
 18.1583 -			// IMs from obejcts don't open IM sessions.
 18.1584 -			// <FS:Ansariel> [FS communication UI]
 18.1585 -			//LLFloaterIMNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterIMNearbyChat>("nearby_chat");
 18.1586 -			FSFloaterNearbyChat* nearby_chat = FSFloaterNearbyChat::getInstance();
 18.1587 -			// </FS:Ansariel> [FS communication UI]
 18.1588 -			if(!chat_from_system && nearby_chat)
 18.1589 -			{
 18.1590 -				chat.mOwnerID = from_id;
 18.1591 -				LLSD args;
 18.1592 -				args["slurl"] = location;
 18.1593 -
 18.1594 -				// Look for IRC-style emotes here so object name formatting is correct
 18.1595 -				// <FS:Ansariel> Consolidate IRC /me prefix checks
 18.1596 -				//std::string prefix = message.substr(0, 4);
 18.1597 -				//if (prefix == "/me " || prefix == "/me'")
 18.1598 -				if (is_irc_me_prefix(message))
 18.1599 -				// </FS:Ansariel>
 18.1600 -				{
 18.1601 -					chat.mChatStyle = CHAT_STYLE_IRC;
 18.1602 -				}
 18.1603 -
 18.1604 -				LLNotificationsUI::LLNotificationManager::instance().onChat(chat, args);
 18.1605 -			}
 18.1606 -
 18.1607 -
 18.1608 -			//Object IMs send with from name: 'Second Life' need to be displayed also in notification toasts (EXT-1590)
 18.1609 -			if (!chat_from_system) break;
 18.1610 -			
 18.1611 -			LLSD substitutions;
 18.1612 -			substitutions["NAME"] = name;
 18.1613 -			substitutions["MSG"] = message;
 18.1614 -
 18.1615 -			LLSD payload;
 18.1616 -			payload["object_id"] = session_id;
 18.1617 -			payload["owner_id"] = from_id;
 18.1618 -			payload["from_id"] = from_id;
 18.1619 -			payload["slurl"] = location;
 18.1620 -			payload["name"] = name;
 18.1621 -
 18.1622 -			if (from_group)
 18.1623 -			{
 18.1624 -				payload["group_owned"] = "true";
 18.1625 -			}
 18.1626 -
 18.1627 -			LLNotificationsUtil::add("ServerObjectMessage", substitutions, payload);
 18.1628 -		}
 18.1629 -		break;
 18.1630 -
 18.1631 -	case IM_SESSION_SEND:		// ad-hoc or group IMs
 18.1632 -
 18.1633 -		// Only show messages if we have a session open (which
 18.1634 -		// should happen after you get an "invitation"
 18.1635 -// [SL:KB] - Patch: Chat-GroupSnooze | Checked: 2012-06-16 (Catznip-3.3)
 18.1636 -		//if ( !gIMMgr->hasSession(session_id) )
 18.1637 -		if ( (!gIMMgr->hasSession(session_id)) &&
 18.1638 -			 ( (!gAgent.isInGroup(session_id)) || (!gIMMgr->checkSnoozeExpiration(session_id)) || LLAvatarActions::isBlocked(from_id) || (!gIMMgr->restoreSnoozedSession(session_id)) ) )
 18.1639 -// [/SL:KB]
 18.1640 -		{
 18.1641 -			return;
 18.1642 -		}
 18.1643 -
 18.1644 -		else if (offline == IM_ONLINE && is_do_not_disturb)
 18.1645 -		{
 18.1646 -
 18.1647 -			// return a standard "do not disturb" message, but only do it to online IM 
 18.1648 -			// (i.e. not other auto responses and not store-and-forward IM)
 18.1649 -			if (!gIMMgr->hasSession(session_id))
 18.1650 -			{
 18.1651 -				// if there is not a panel for this conversation (i.e. it is a new IM conversation
 18.1652 -				// initiated by the other party) then...
 18.1653 -				send_do_not_disturb_message(msg, from_id, session_id);
 18.1654 -			}
 18.1655 -
 18.1656 -			// now store incoming IM in chat history
 18.1657 -
 18.1658 -			buffer = message;
 18.1659 -	
 18.1660 -			LL_DEBUGS("Messaging") << "message in dnd; session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 18.1661 -
 18.1662 -			// add to IM panel, but do not bother the user
 18.1663 -			gIMMgr->addMessage(
 18.1664 -				session_id,
 18.1665 -				from_id,
 18.1666 -				name,
 18.1667 -				buffer,
 18.1668 -				IM_OFFLINE == offline,
 18.1669 -				ll_safe_string((char*)binary_bucket),
 18.1670 -				IM_SESSION_INVITE,
 18.1671 -				parent_estate_id,
 18.1672 -				region_id,
 18.1673 -				position,
 18.1674 -				true);
 18.1675 -		}
 18.1676 -		else
 18.1677 -		{
 18.1678 -
 18.1679 -			// <FS:PP> FIRE-10178: Keyword Alerts in group IM do not work unless the group is in the foreground (notification on receipt of IM)
 18.1680 -			chat.mText = message;
 18.1681 -			bool keyword_alert_performed = false;
 18.1682 -			if (FSKeywords::getInstance()->chatContainsKeyword(chat, false))
 18.1683 -			{
 18.1684 -				FSKeywords::notify(chat);
 18.1685 -				keyword_alert_performed = true;
 18.1686 -			}
 18.1687 -			// </FS:PP>
 18.1688 -
 18.1689 -			// standard message, not from system
 18.1690 -			std::string saved;
 18.1691 -			if(offline == IM_OFFLINE)
 18.1692 -			{
 18.1693 -				saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str());
 18.1694 -			}
 18.1695 -
 18.1696 -			buffer = saved + message;
 18.1697 -
 18.1698 -			LL_DEBUGS("Messaging") << "standard message session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL;
 18.1699 -
 18.1700 -			gIMMgr->addMessage(
 18.1701 -				session_id,
 18.1702 -				from_id,
 18.1703 -				name,
 18.1704 -				buffer,
 18.1705 -				IM_OFFLINE == offline,
 18.1706 -				ll_safe_string((char*)binary_bucket),
 18.1707 -				IM_SESSION_INVITE,
 18.1708 -				parent_estate_id,
 18.1709 -				region_id,
 18.1710 -				position,
 18.1711 -				true,
 18.1712 -				false,
 18.1713 -				keyword_alert_performed);
 18.1714 -		}
 18.1715 -		break;
 18.1716 -
 18.1717 -	case IM_FROM_TASK_AS_ALERT:
 18.1718 -		if (is_do_not_disturb && !is_owned_by_me)
 18.1719 -		{
 18.1720 -			return;
 18.1721 -		}
 18.1722 -		{
 18.1723 -			// Construct a viewer alert for this message.
 18.1724 -			args["NAME"] = name;
 18.1725 -			args["MESSAGE"] = message;
 18.1726 -			LLNotificationsUtil::add("ObjectMessage", args);
 18.1727 -		}
 18.1728 -		break;
 18.1729 -	case IM_DO_NOT_DISTURB_AUTO_RESPONSE:
 18.1730 -		if (is_muted)
 18.1731 -		{
 18.1732 -			LL_DEBUGS("Messaging") << "Ignoring do-not-disturb response from " << from_id << LL_ENDL;
 18.1733 -			return;
 18.1734 -		}
 18.1735 -		else
 18.1736 -		{
 18.1737 -			// <FS:Ansariel> FIRE-12908: Add busy response indicator back to busy messages
 18.1738 -			//gIMMgr->addMessage(session_id, from_id, name, message);
 18.1739 -			buffer = llformat("(%s): %s", LLTrans::getString("BusyResponse").c_str(), message.c_str());
 18.1740 -			gIMMgr->addMessage(session_id, from_id, name, buffer);
 18.1741 -			// </FS:Ansariel>
 18.1742 -		}
 18.1743 -		break;
 18.1744 -		
 18.1745 -	case IM_LURE_USER:
 18.1746 -	case IM_TELEPORT_REQUEST:
 18.1747 -		{
 18.1748 -// [RLVa:KB] - Checked: RLVa-1.4.9
 18.1749 -			// If we auto-accept the offer/request then this will override DnD status (but we'll still let the other party know later)
 18.1750 -			bool fRlvAutoAccept = (rlv_handler_t::isEnabled()) &&
 18.1751 -				( ((IM_LURE_USER == dialog) && (RlvActions::autoAcceptTeleportOffer(from_id))) ||
 18.1752 -				  ((IM_TELEPORT_REQUEST == dialog) && (RlvActions::autoAcceptTeleportRequest(from_id))) );
 18.1753 -// [/RLVa:KB]
 18.1754 -
 18.1755 -			if (is_muted)
 18.1756 -			{ 
 18.1757 -				return;
 18.1758 -			}
 18.1759 -
 18.1760 -			// <FS:PP> FIRE-1245: Option to block/reject teleport offers
 18.1761 -			//else if (gSavedSettings.getBOOL("VoiceCallsFriendsOnly") && (LLAvatarTracker::instance().getBuddyInfo(from_id) == NULL))
 18.1762 -			//{
 18.1763 -			//	return;
 18.1764 -			//}
 18.1765 -			else if ( (is_rejecting_tp_offers && (!FSDontRejectTeleportOffersFromFriends || (FSDontRejectTeleportOffersFromFriends && !is_friend))) && (!fRlvAutoAccept) )
 18.1766 -			{
 18.1767 -				send_rejecting_tp_offers_message(msg, from_id);
 18.1768 -			}
 18.1769 -			// </FS:PP>
 18.1770 -			else
 18.1771 -			{
 18.1772 -//				if (is_do_not_disturb)
 18.1773 -// [RLVa:KB] - Checked: RLVa-1.4.9
 18.1774 -				if ( (is_do_not_disturb) && (!fRlvAutoAccept) )
 18.1775 -// [/RLVa:KB]
 18.1776 -				{
 18.1777 -					send_do_not_disturb_message(msg, from_id);
 18.1778 -				}
 18.1779 -
 18.1780 -				LLVector3 pos, look_at;
 18.1781 -				U64 region_handle(0);
 18.1782 -				U8 region_access(SIM_ACCESS_MIN);
 18.1783 -				std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
 18.1784 -				std::string region_access_str = LLStringUtil::null;
 18.1785 -				std::string region_access_icn = LLStringUtil::null;
 18.1786 -				std::string region_access_lc  = LLStringUtil::null;
 18.1787 -
 18.1788 -				bool canUserAccessDstRegion = true;
 18.1789 -				bool doesUserRequireMaturityIncrease = false;
 18.1790 -
 18.1791 -				// Do not parse the (empty) lure bucket for TELEPORT_REQUEST
 18.1792 -				if (IM_TELEPORT_REQUEST != dialog && parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
 18.1793 -				{
 18.1794 -					region_access_str = LLViewerRegion::accessToString(region_access);
 18.1795 -					region_access_icn = LLViewerRegion::getAccessIcon(region_access);
 18.1796 -					region_access_lc  = region_access_str;
 18.1797 -					LLStringUtil::toLower(region_access_lc);
 18.1798 -
 18.1799 -					if (!gAgent.isGodlike())
 18.1800 -					{
 18.1801 -						switch (region_access)
 18.1802 -						{
 18.1803 -						case SIM_ACCESS_MIN :
 18.1804 -						case SIM_ACCESS_PG :
 18.1805 -							break;
 18.1806 -						case SIM_ACCESS_MATURE :
 18.1807 -							if (gAgent.isTeen())
 18.1808 -							{
 18.1809 -								canUserAccessDstRegion = false;
 18.1810 -							}
 18.1811 -							else if (gAgent.prefersPG())
 18.1812 -							{
 18.1813 -								doesUserRequireMaturityIncrease = true;
 18.1814 -							}
 18.1815 -							break;
 18.1816 -						case SIM_ACCESS_ADULT :
 18.1817 -							if (!gAgent.isAdult())
 18.1818 -							{
 18.1819 -								canUserAccessDstRegion = false;
 18.1820 -							}
 18.1821 -							else if (!gAgent.prefersAdult())
 18.1822 -							{
 18.1823 -								doesUserRequireMaturityIncrease = true;
 18.1824 -							}
 18.1825 -							break;
 18.1826 -						default :
 18.1827 -							llassert(0);
 18.1828 -							break;
 18.1829 -						}
 18.1830 -					}
 18.1831 -				}
 18.1832 -
 18.1833 -// [RLVa:KB] - Checked: RLVa-1.4.9
 18.1834 -				if (rlv_handler_t::isEnabled())
 18.1835 -				{
 18.1836 -					if ( ((IM_LURE_USER == dialog) && (!RlvActions::canAcceptTpOffer(from_id))) ||
 18.1837 -					     ((IM_TELEPORT_REQUEST == dialog) && (!RlvActions::canAcceptTpRequest(from_id))) )
 18.1838 -					{
 18.1839 -						RlvUtil::sendBusyMessage(from_id, RlvStrings::getString(RLV_STRING_BLOCKED_TPLUREREQ_REMOTE));
 18.1840 -						if (is_do_not_disturb)
 18.1841 -							send_do_not_disturb_message(msg, from_id);
 18.1842 -						return;
 18.1843 -					}
 18.1844 -
 18.1845 -					// Censor message if: 1) restricted from receiving IMs from the sender, or 2) teleport offer/request and @showloc=n restricted
 18.1846 -					if ( (!RlvActions::canReceiveIM(from_id)) || 
 18.1847 -						 ((gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC)) && (IM_LURE_USER == dialog || IM_TELEPORT_REQUEST == dialog)) )
 18.1848 -					{
 18.1849 -						message = RlvStrings::getString(RLV_STRING_HIDDEN);
 18.1850 -					}
 18.1851 -				}
 18.1852 -// [/RLVa:KB]
 18.1853 -
 18.1854 -				LLSD args;
 18.1855 -				// *TODO: Translate -> [FIRST] [LAST] (maybe)
 18.1856 -// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
 18.1857 -				args["NAME_LABEL"] = LLSLURL("agent", from_id, "completename").getSLURLString();
 18.1858 -// [/SL:KB]
 18.1859 -				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 18.1860 -				args["MESSAGE"] = message;
 18.1861 -				args["MATURITY_STR"] = region_access_str;
 18.1862 -				args["MATURITY_ICON"] = region_access_icn;
 18.1863 -				args["REGION_CONTENT_MATURITY"] = region_access_lc;
 18.1864 -				LLSD payload;
 18.1865 -				payload["from_id"] = from_id;
 18.1866 -				payload["lure_id"] = session_id;
 18.1867 -				payload["godlike"] = FALSE;
 18.1868 -				payload["region_maturity"] = region_access;
 18.1869 -
 18.1870 -				// <FS:Ansariel> FIRE-6786: Always show teleport location in teleport offer
 18.1871 -				if (dialog == IM_LURE_USER && (!rlv_handler_t::isEnabled() || !fRlvAutoAccept) && LLGridManager::instance().isInSecondLife())
 18.1872 -				{
 18.1873 -					LLVector3d pos_global = from_region_handle(region_handle);
 18.1874 -					pos_global += LLVector3d(pos);
 18.1875 -					LLLandmarkActions::getSLURLfromPosGlobal(pos_global, boost::bind(&teleport_region_info_cb, _1, args, payload, from_id, session_id, canUserAccessDstRegion, doesUserRequireMaturityIncrease));
 18.1876 -					return;
 18.1877 -				}
 18.1878 -				// </FS:Ansariel>
 18.1879 -
 18.1880 -				if (!canUserAccessDstRegion)
 18.1881 -				{
 18.1882 -					LLNotification::Params params("TeleportOffered_MaturityBlocked");
 18.1883 -					params.substitutions = args;
 18.1884 -					params.payload = payload;
 18.1885 -					LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.1886 -					send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
 18.1887 -					send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
 18.1888 -				}
 18.1889 -				else if (doesUserRequireMaturityIncrease)
 18.1890 -				{
 18.1891 -					LLNotification::Params params("TeleportOffered_MaturityExceeded");
 18.1892 -					params.substitutions = args;
 18.1893 -					params.payload = payload;
 18.1894 -					LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.1895 -				}
 18.1896 -				else
 18.1897 -				{
 18.1898 -					LLNotification::Params params;
 18.1899 -					if (IM_LURE_USER == dialog)
 18.1900 -					{
 18.1901 -						params.name = "TeleportOffered";
 18.1902 -						params.functor.name = "TeleportOffered";
 18.1903 -					}
 18.1904 -					else if (IM_TELEPORT_REQUEST == dialog)
 18.1905 -					{
 18.1906 -						params.name = "TeleportRequest";
 18.1907 -						params.functor.name = "TeleportRequest";
 18.1908 -					}
 18.1909 -
 18.1910 -					params.substitutions = args;
 18.1911 -					params.payload = payload;
 18.1912 -
 18.1913 -// [RLVa:KB] - Checked: RLVa-1.4.9
 18.1914 -					if (fRlvAutoAccept)
 18.1915 -					{
 18.1916 -						if (IM_LURE_USER == dialog)
 18.1917 -							gRlvHandler.setCanCancelTp(false);
 18.1918 -						if (is_do_not_disturb)
 18.1919 -							send_do_not_disturb_message(msg, from_id);
 18.1920 -						LLNotifications::instance().forceResponse(LLNotification::Params(params.name).payload(payload), 0);
 18.1921 -					}
 18.1922 -					else
 18.1923 -					{
 18.1924 -						LLPostponedNotification::add<LLPostponedOfferNotification>(params, from_id, false);
 18.1925 -					}
 18.1926 -// [/RLVa:KB]
 18.1927 -//					LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.1928 -				}
 18.1929 -			}
 18.1930 -		}
 18.1931 -		break;
 18.1932 -
 18.1933 -	case IM_GODLIKE_LURE_USER:
 18.1934 -		{
 18.1935 -			LLVector3 pos, look_at;
 18.1936 -			U64 region_handle(0);
 18.1937 -			U8 region_access(SIM_ACCESS_MIN);
 18.1938 -			std::string region_info = ll_safe_string((char*)binary_bucket, binary_bucket_size);
 18.1939 -			std::string region_access_str = LLStringUtil::null;
 18.1940 -			std::string region_access_icn = LLStringUtil::null;
 18.1941 -			std::string region_access_lc  = LLStringUtil::null;
 18.1942 -
 18.1943 -			bool canUserAccessDstRegion = true;
 18.1944 -			bool doesUserRequireMaturityIncrease = false;
 18.1945 -
 18.1946 -			if (parse_lure_bucket(region_info, region_handle, pos, look_at, region_access))
 18.1947 -			{
 18.1948 -				region_access_str = LLViewerRegion::accessToString(region_access);
 18.1949 -				region_access_icn = LLViewerRegion::getAccessIcon(region_access);
 18.1950 -				region_access_lc  = region_access_str;
 18.1951 -				LLStringUtil::toLower(region_access_lc);
 18.1952 -
 18.1953 -				if (!gAgent.isGodlike())
 18.1954 -				{
 18.1955 -					switch (region_access)
 18.1956 -					{
 18.1957 -					case SIM_ACCESS_MIN :
 18.1958 -					case SIM_ACCESS_PG :
 18.1959 -						break;
 18.1960 -					case SIM_ACCESS_MATURE :
 18.1961 -						if (gAgent.isTeen())
 18.1962 -						{
 18.1963 -							canUserAccessDstRegion = false;
 18.1964 -						}
 18.1965 -						else if (gAgent.prefersPG())
 18.1966 -						{
 18.1967 -							doesUserRequireMaturityIncrease = true;
 18.1968 -						}
 18.1969 -						break;
 18.1970 -					case SIM_ACCESS_ADULT :
 18.1971 -						if (!gAgent.isAdult())
 18.1972 -						{
 18.1973 -							canUserAccessDstRegion = false;
 18.1974 -						}
 18.1975 -						else if (!gAgent.prefersAdult())
 18.1976 -						{
 18.1977 -							doesUserRequireMaturityIncrease = true;
 18.1978 -						}
 18.1979 -						break;
 18.1980 -					default :
 18.1981 -						llassert(0);
 18.1982 -						break;
 18.1983 -					}
 18.1984 -				}
 18.1985 -			}
 18.1986 -
 18.1987 -			LLSD args;
 18.1988 -			// *TODO: Translate -> [FIRST] [LAST] (maybe)
 18.1989 -			args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 18.1990 -			args["MESSAGE"] = message;
 18.1991 -			args["MATURITY_STR"] = region_access_str;
 18.1992 -			args["MATURITY_ICON"] = region_access_icn;
 18.1993 -			args["REGION_CONTENT_MATURITY"] = region_access_lc;
 18.1994 -			LLSD payload;
 18.1995 -			payload["from_id"] = from_id;
 18.1996 -			payload["lure_id"] = session_id;
 18.1997 -			payload["godlike"] = TRUE;
 18.1998 -			payload["region_maturity"] = region_access;
 18.1999 -
 18.2000 -			if (!canUserAccessDstRegion)
 18.2001 -			{
 18.2002 -				LLNotification::Params params("TeleportOffered_MaturityBlocked");
 18.2003 -				params.substitutions = args;
 18.2004 -				params.payload = payload;
 18.2005 -				LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.2006 -				send_simple_im(from_id, LLTrans::getString("TeleportMaturityExceeded"), IM_NOTHING_SPECIAL, session_id);
 18.2007 -				send_simple_im(from_id, LLStringUtil::null, IM_LURE_DECLINED, session_id);
 18.2008 -			}
 18.2009 -			else if (doesUserRequireMaturityIncrease)
 18.2010 -			{
 18.2011 -				LLNotification::Params params("TeleportOffered_MaturityExceeded");
 18.2012 -				params.substitutions = args;
 18.2013 -				params.payload = payload;
 18.2014 -				LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.2015 -			}
 18.2016 -			else
 18.2017 -			{
 18.2018 -			// do not show a message box, because you're about to be
 18.2019 -			// teleported.
 18.2020 -			LLNotifications::instance().forceResponse(LLNotification::Params("TeleportOffered").payload(payload), 0);
 18.2021 -		}
 18.2022 -		}
 18.2023 -		break;
 18.2024 -
 18.2025 -	case IM_GOTO_URL:
 18.2026 -		{
 18.2027 -			LLSD args;
 18.2028 -			// n.b. this is for URLs sent by the system, not for
 18.2029 -			// URLs sent by scripts (i.e. llLoadURL)
 18.2030 -			if (binary_bucket_size <= 0)
 18.2031 -			{
 18.2032 -				LL_WARNS("Messaging") << "bad binary_bucket_size: "
 18.2033 -					<< binary_bucket_size
 18.2034 -					<< " - aborting function." << LL_ENDL;
 18.2035 -				return;
 18.2036 -			}
 18.2037 -
 18.2038 -			std::string url;
 18.2039 -			
 18.2040 -			url.assign((char*)binary_bucket, binary_bucket_size-1);
 18.2041 -			args["MESSAGE"] = message;
 18.2042 -			args["URL"] = url;
 18.2043 -			LLSD payload;
 18.2044 -			payload["url"] = url;
 18.2045 -			LLNotificationsUtil::add("GotoURL", args, payload );
 18.2046 -		}
 18.2047 -		break;
 18.2048 -
 18.2049 -	case IM_FRIENDSHIP_OFFERED:
 18.2050 -		{
 18.2051 -
 18.2052 -			// <FS:PP> FIRE-15233: Automatic friendship request refusal
 18.2053 -			if (is_rejecting_friendship_requests)
 18.2054 -			{
 18.2055 -				send_rejecting_friendship_requests_message(msg, from_id);
 18.2056 -				return;
 18.2057 -			}
 18.2058 -			// </FS:PP>
 18.2059 -
 18.2060 -			LLSD payload;
 18.2061 -			payload["from_id"] = from_id;
 18.2062 -			payload["session_id"] = session_id;
 18.2063 -			payload["online"] = (offline == IM_ONLINE);
 18.2064 -			payload["sender"] = msg->getSender().getIPandPort();
 18.2065 -
 18.2066 -			bool add_notification = true;
 18.2067 -			for (LLToastNotifyPanel::instance_iter ti(LLToastNotifyPanel::beginInstances())
 18.2068 -				, tend(LLToastNotifyPanel::endInstances()); ti != tend; ++ti)
 18.2069 -			{
 18.2070 -				LLToastNotifyPanel& panel = *ti;
 18.2071 -				const std::string& notification_name = panel.getNotificationName();
 18.2072 -				if (notification_name == "OfferFriendship" && panel.isControlPanelEnabled())
 18.2073 -				{
 18.2074 -					add_notification = false;
 18.2075 -					break;
 18.2076 -				}
 18.2077 -			}
 18.2078 -
 18.2079 -			if (is_muted && add_notification)
 18.2080 -			{
 18.2081 -				LLNotifications::instance().forceResponse(LLNotification::Params("OfferFriendship").payload(payload), 1);
 18.2082 -			}
 18.2083 -			else
 18.2084 -			{
 18.2085 -				if (is_do_not_disturb)
 18.2086 -				{
 18.2087 -					send_do_not_disturb_message(msg, from_id);
 18.2088 -				}
 18.2089 -// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Added: Catznip-2.5.0a
 18.2090 -				args["NAME_LABEL"] = LLSLURL("agent", from_id, "completename").getSLURLString();
 18.2091 -// [/SL:KB]
 18.2092 -				args["NAME_SLURL"] = LLSLURL("agent", from_id, "about").getSLURLString();
 18.2093 -
 18.2094 -				if (add_notification)
 18.2095 -				{
 18.2096 -				if(message.empty())
 18.2097 -				{
 18.2098 -					//support for frienship offers from clients before July 2008
 18.2099 -				        LLNotificationsUtil::add("OfferFriendshipNoMessage", args, payload);
 18.2100 -				        make_ui_sound("UISndFriendshipOffer"); // <FS:PP> Friendship offer sound
 18.2101 -				}
 18.2102 -				else
 18.2103 -				{
 18.2104 -					args["[MESSAGE]"] = message;
 18.2105 -				    LLNotification::Params params("OfferFriendship");
 18.2106 -				    params.substitutions = args;
 18.2107 -				    params.payload = payload;
 18.2108 -				    LLPostponedNotification::add<LLPostponedOfferNotification>(	params, from_id, false);
 18.2109 -				    make_ui_sound("UISndFriendshipOffer"); // <FS:PP> Friendship offer sound
 18.2110 -				}
 18.2111 -			}
 18.2112 -		}
 18.2113 -		}
 18.2114 -		break;
 18.2115 -
 18.2116 -	case IM_FRIENDSHIP_ACCEPTED:
 18.2117 -		{
 18.2118 -			// In the case of an offline IM, the formFriendship() may be extraneous
 18.2119 -			// as the database should already include the relationship.  But it
 18.2120 -			// doesn't hurt for dupes.
 18.2121 -			LLAvatarTracker::formFriendship(from_id);
 18.2122 -			
 18.2123 -			std::vector<std::string> strings;
 18.2124 -			strings.push_back(from_id.asString());
 18.2125 -			send_generic_message("requestonlinenotification", strings);
 18.2126 -			
 18.2127 -			args["NAME"] = name;
 18.2128 -			LLSD payload;
 18.2129 -			payload["from_id"] = from_id;
 18.2130 -			LLAvatarNameCache::get(from_id, boost::bind(&notification_display_name_callback,_1,_2,"FriendshipAccepted",args,payload));
 18.2131 -		}
 18.2132 -		break;
 18.2133 -
 18.2134 -	case IM_FRIENDSHIP_DECLINED_DEPRECATED:
 18.2135 -	default:
 18.2136 -		LL_WARNS("Messaging") << "Instant message calling for unknown dialog "
 18.2137 -				<< (S32)dialog << LL_ENDL;
 18.2138 -		break;
 18.2139 -	}
 18.2140 -
 18.2141 -	LLWindow* viewer_window = gViewerWindow->getWindow();
 18.2142 -	// <FS:CR> Make osx dashboard icon bounce when window isn't in focus
 18.2143 -	//if (viewer_window && viewer_window->getMinimized())
 18.2144 -	static LLCachedControl<bool> sFlashIcon(gSavedSettings, "FSFlashOnMessage");
 18.2145 -	static LLCachedControl<bool> sFSFlashOnObjectIM(gSavedSettings, "FSFlashOnObjectIM");
 18.2146 -	if (viewer_window && dialog != IM_TYPING_START && dialog != IM_TYPING_STOP && sFlashIcon && (sFSFlashOnObjectIM || (chat.mChatType != CHAT_TYPE_IM)) && !is_muted)
 18.2147 -	{
 18.2148 -		viewer_window->flashIcon(5.f);
 18.2149 -	}
 18.2150 +    LLUUID from_id;
 18.2151 +    BOOL from_group;
 18.2152 +    LLUUID to_id;
 18.2153 +    U8 offline;
 18.2154 +    U8 d = 0;
 18.2155 +    LLUUID session_id;
 18.2156 +    U32 timestamp;
 18.2157 +    std::string agentName;
 18.2158 +    std::string message;
 18.2159 +    U32 parent_estate_id = 0;
 18.2160 +    LLUUID region_id;
 18.2161 +    LLVector3 position;
 18.2162 +    U8 binary_bucket[MTUBYTES];
 18.2163 +    S32 binary_bucket_size;
 18.2164 +
 18.2165 +    // *TODO: Translate - need to fix the full name to first/last (maybe)
 18.2166 +    msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id);
 18.2167 +    msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group);
 18.2168 +    msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ToAgentID, to_id);
 18.2169 +    msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Offline, offline);
 18.2170 +    msg->getU8Fast(_PREHASH_MessageBlock, _PREHASH_Dialog, d);
 18.2171 +    msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id);
 18.2172 +    msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_Timestamp, timestamp);
 18.2173 +    //msg->getData("MessageBlock", "Count",		&count);
 18.2174 +    msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, agentName);
 18.2175 +    msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message);
 18.2176 +    msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id);
 18.2177 +    msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id);
 18.2178 +    msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position);
 18.2179 +    msg->getBinaryDataFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket, binary_bucket, 0, 0, MTUBYTES);
 18.2180 +    binary_bucket_size = msg->getSizeFast(_PREHASH_MessageBlock, _PREHASH_BinaryBucket);
 18.2181 +    EInstantMessage dialog = (EInstantMessage)d;
 18.2182 +    LLHost sender = msg->getSender();
 18.2183 +
 18.2184 +    LLIMProcessing::processNewMessage(from_id,
 18.2185 +        from_group,
 18.2186 +        to_id,
 18.2187 +        offline,
 18.2188 +        dialog,
 18.2189 +        session_id,
 18.2190 +        timestamp,
 18.2191 +        agentName,
 18.2192 +        message,
 18.2193 +        parent_estate_id,
 18.2194 +        region_id,
 18.2195 +        position,
 18.2196 +        binary_bucket,
 18.2197 +        binary_bucket_size,
 18.2198 +        sender);
 18.2199  }
 18.2200  
 18.2201  void send_do_not_disturb_message (LLMessageSystem* msg, const LLUUID& from_id, const LLUUID& session_id)
    19.1 --- a/indra/newview/llviewermessage.h	Fri Mar 02 12:11:50 2018 +0100
    19.2 +++ b/indra/newview/llviewermessage.h	Wed Mar 21 20:23:52 2018 +0100
    19.3 @@ -39,6 +39,9 @@
    19.4  #include <boost/function.hpp>
    19.5  #include <boost/signals2.hpp>
    19.6  
    19.7 +#include "llinventorymodel.h" // <FS:Ansariel> For LLOpenAgentOffer
    19.8 +#include "llinventoryobserver.h" // <FS:Ansariel> For LLOpenAgentOffer
    19.9 +
   19.10  //
   19.11  // Forward declarations
   19.12  //
   19.13 @@ -282,6 +285,41 @@
   19.14  	respond_function_map_t mRespondFunctions;
   19.15  };
   19.16  
   19.17 +// <FS:Ansariel> Moved from source; needed in llimprocessing.cpp
   19.18 +class LLOpenAgentOffer : public LLInventoryFetchItemsObserver
   19.19 +{
   19.20 +public:
   19.21 +	LLOpenAgentOffer(const LLUUID& object_id,
   19.22 +					 const std::string& from_name) : 
   19.23 +		LLInventoryFetchItemsObserver(object_id),
   19.24 +		mFromName(from_name) {}
   19.25 +	/*virtual*/ void startFetch()
   19.26 +	{
   19.27 +		for (uuid_vec_t::const_iterator it = mIDs.begin(); it < mIDs.end(); ++it)
   19.28 +		{
   19.29 +			LLViewerInventoryCategory* cat = gInventory.getCategory(*it);
   19.30 +			if (cat)
   19.31 +			{
   19.32 +				mComplete.push_back((*it));
   19.33 +			}
   19.34 +		}
   19.35 +		LLInventoryFetchItemsObserver::startFetch();
   19.36 +	}
   19.37 +	/*virtual*/ void done()
   19.38 +	{
   19.39 +		// <FS:Ansariel> FIRE-3234: Don't need a check for ShowNewInventory here;
   19.40 +		// This only gets called if the user explicity clicks "Show" or
   19.41 +		// AutoAcceptNewInventory and ShowNewInventory are TRUE.
   19.42 +		//open_inventory_offer(mComplete, mFromName);
   19.43 +		open_inventory_offer(mComplete, mFromName, true);
   19.44 +		gInventory.removeObserver(this);
   19.45 +		delete this;
   19.46 +	}
   19.47 +private:
   19.48 +	std::string mFromName;
   19.49 +};
   19.50 +// </FS:Ansariel>
   19.51 +
   19.52  void process_feature_disabled_message(LLMessageSystem* msg, void**);
   19.53  
   19.54  #endif
    20.1 --- a/indra/newview/llviewerregion.cpp	Fri Mar 02 12:11:50 2018 +0100
    20.2 +++ b/indra/newview/llviewerregion.cpp	Wed Mar 21 20:23:52 2018 +0100
    20.3 @@ -299,6 +299,13 @@
    20.4              continue;
    20.5          }
    20.6  
    20.7 +        if (!result.isMap() || result.has("error"))
    20.8 +        {
    20.9 +            LL_WARNS("AppInit", "Capabilities") << "Malformed response" << LL_ENDL;
   20.10 +            // setup for retry.
   20.11 +            continue;
   20.12 +        }
   20.13 +
   20.14          LLSD httpResults = result["http_result"];
   20.15          LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
   20.16          if (!status)
   20.17 @@ -3067,6 +3074,7 @@
   20.18  	capabilityNames.append("ParcelVoiceInfoRequest");
   20.19  	capabilityNames.append("ProductInfoRequest");
   20.20  	capabilityNames.append("ProvisionVoiceAccountRequest");
   20.21 +	capabilityNames.append("ReadOfflineMsgs");
   20.22  	capabilityNames.append("RemoteParcelRequest");
   20.23  	capabilityNames.append("RenderMaterials");
   20.24  	capabilityNames.append("RequestTextureDownload");
    21.1 --- a/indra/newview/llworldmapview.cpp	Fri Mar 02 12:11:50 2018 +0100
    21.2 +++ b/indra/newview/llworldmapview.cpp	Wed Mar 21 20:23:52 2018 +0100
    21.3 @@ -1926,10 +1926,14 @@
    21.4  		case MAP_ITEM_LAND_FOR_SALE:
    21.5  		case MAP_ITEM_LAND_FOR_SALE_ADULT:
    21.6  			{
    21.7 -				LLVector3d pos_global = viewPosToGlobal(x, y);
    21.8 -				LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
    21.9 +				// <FS:Ansariel> Show parcel details instead of search with possible useless result
   21.10 +				//LLVector3d pos_global = viewPosToGlobal(x, y);
   21.11 +				//LLSimInfo* info = LLWorldMap::getInstance()->simInfoFromPosGlobal(pos_global);
   21.12 +				//LLFloaterReg::hideInstance("world_map");
   21.13 +				//LLFloaterReg::showInstance("search", LLSD().with("category", "land").with("query", info->getName()));
   21.14  				LLFloaterReg::hideInstance("world_map");
   21.15 -				LLFloaterReg::showInstance("search", LLSD().with("category", "land").with("query", info->getName()));
   21.16 +				LLUrlAction::executeSLURL(LLSLURL("parcel", id, "about").getSLURLString());
   21.17 +				// </FS:Ansariel>
   21.18  				break;
   21.19  			}
   21.20  		case MAP_ITEM_CLASSIFIED:
    22.1 --- a/indra/newview/qtoolalign.cpp	Fri Mar 02 12:11:50 2018 +0100
    22.2 +++ b/indra/newview/qtoolalign.cpp	Wed Mar 21 20:23:52 2018 +0100
    22.3 @@ -18,6 +18,7 @@
    22.4  #include "llfloatertools.h"
    22.5  #include "llselectmgr.h"
    22.6  #include "llviewercamera.h"
    22.7 +#include "llviewercontrol.h"
    22.8  #include "llviewerobject.h"
    22.9  #include "llviewerwindow.h"
   22.10  
   22.11 @@ -350,8 +351,10 @@
   22.12  
   22.13  BOOL QToolAlign::canAffectSelection()
   22.14  {
   22.15 -	// An selection is scalable if you are allowed to both edit and move
   22.16 -	// everything in it, and it does not have any sitting agents
   22.17 +	// An selection is scalable if you are allowed to move the objects
   22.18 +	// and it does not have any sitting agents. In case of editing linked parts,
   22.19 +	// the object itself has to be modifiable.
   22.20 +	static LLCachedControl<bool> edit_linked_parts(gSavedSettings, "EditLinkedParts");
   22.21  	BOOL can_scale = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0;
   22.22  	if (can_scale)
   22.23  	{
   22.24 @@ -359,7 +362,7 @@
   22.25  		{
   22.26  			virtual bool apply(LLViewerObject* objectp)
   22.27  			{
   22.28 -				return objectp->permModify() && objectp->permMove() && !objectp->isSeat();
   22.29 +				return (!edit_linked_parts || objectp->permModify()) && objectp->permMove() && !objectp->isSeat();
   22.30  			}
   22.31  		} func;
   22.32  		can_scale = LLSelectMgr::getInstance()->getSelection()->applyToObjects(&func);
    23.1 --- a/indra/newview/skins/default/xui/de/panel_preferences_colors.xml	Fri Mar 02 12:11:50 2018 +0100
    23.2 +++ b/indra/newview/skins/default/xui/de/panel_preferences_colors.xml	Wed Mar 21 20:23:52 2018 +0100
    23.3 @@ -53,7 +53,7 @@
    23.4  			<text name="object_name_header_label">
    23.5  				Objekte
    23.6  			</text>
    23.7 -			<slider label="Abschwächungsfaktor außerhalb Chat-Reichweite:" label_width="275" name="FSBeyondNearbyChatColorDiminishFactor" tool_tip="Faktor, der dafür verwendet wird, die normale Chatfarbe abzuschwächen, wenn sich der Sender außerhalb der normalen Chatreichweite befindet."/>
    23.8 +			<slider label="Abschwächungsfaktor außerhalb Chat-Reichweite:" label_width="275" name="FSBeyondNearbyChatColorDiminishFactor" tool_tip="Faktor, der dafür verwendet wird, die normale Chatfarbe abzuschwächen, wenn sich der Sender außerhalb der normalen Chatreichweite befindet (0 = dunkel, 1 = hell)."/>
    23.9  			<check_box name="FSColorIMsDistinctly" label="IM/Gruppenchat in Konsole unterschiedlich einfärben:"/>
   23.10  			<panel name="im_color_panel">
   23.11  				<text name="console_im_label">
    24.1 --- a/indra/newview/skins/default/xui/en/panel_preferences_colors.xml	Fri Mar 02 12:11:50 2018 +0100
    24.2 +++ b/indra/newview/skins/default/xui/en/panel_preferences_colors.xml	Wed Mar 21 20:23:52 2018 +0100
    24.3 @@ -538,7 +538,7 @@
    24.4        min_val="0"
    24.5        max_val="1"
    24.6        name="FSBeyondNearbyChatColorDiminishFactor"
    24.7 -      tool_tip="The factor used to diminish the actual chat color if the sender is beyond normal chat range."
    24.8 +      tool_tip="The factor used to diminish the actual chat color if the sender is beyond normal chat range (0 = dim, 1 = bright)"
    24.9        top_pad="20"
   24.10        width="450" />
   24.11       <check_box
    25.1 --- a/indra/newview/skins/default/xui/pl/panel_preferences_colors.xml	Fri Mar 02 12:11:50 2018 +0100
    25.2 +++ b/indra/newview/skins/default/xui/pl/panel_preferences_colors.xml	Wed Mar 21 20:23:52 2018 +0100
    25.3 @@ -50,7 +50,7 @@
    25.4  			<text name="object_name_header_label">
    25.5  				Obiekty
    25.6  			</text>
    25.7 -			<slider label="Współczynnik zanikania koloru poza zasięgiem czatu:" label_width="295" name="FSBeyondNearbyChatColorDiminishFactor" tool_tip="Współczynnik zanikania koloru czcionki czatu dla osób przebywających poza normalnym zasięgiem pisania." />
    25.8 +			<slider label="Współczynnik zanikania koloru poza zasięgiem czatu:" label_width="295" name="FSBeyondNearbyChatColorDiminishFactor" tool_tip="Współczynnik zanikania koloru czcionki czatu dla osób przebywających poza normalnym zasięgiem pisania (0 = ciemny, 1 = jasny)." />
    25.9  			<check_box name="FSColorIMsDistinctly" label="Koloruj czat IM/Grup oddzielnie w konsoli:" />
   25.10  			<panel name="im_color_panel">
   25.11  				<text name="console_im_label">

mercurial