Transplant MAINT-7118 and fix some bad design on the way
parent
01e3226ddf
commit
4608aeb505
|
|
@ -526,6 +526,16 @@ void invrepair()
|
|||
gInventory.collectDescendents(gInventory.getRootFolderID(), cats, items, FALSE);
|
||||
}
|
||||
|
||||
void key_to_name_callback(const LLUUID& id, const LLAvatarName& av_name)
|
||||
{
|
||||
std::string name = av_name.getCompleteName();
|
||||
if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, id))
|
||||
{
|
||||
name = RlvStrings::getAnonym(name);
|
||||
}
|
||||
report_to_nearby_chat(llformat("%s: (%s)", id.asString().c_str(), name.c_str()));
|
||||
}
|
||||
|
||||
bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_gesture)
|
||||
{
|
||||
static LLCachedControl<bool> sFSCmdLine(gSavedSettings, "FSCmdLine");
|
||||
|
|
@ -701,13 +711,7 @@ bool cmd_line_chat(const std::string& revised_text, EChatType type, bool from_ge
|
|||
LLUUID target_key;
|
||||
if (i >> target_key)
|
||||
{
|
||||
std::string object_name;
|
||||
gCacheName->getFullName(target_key, object_name);
|
||||
if (!RlvActions::canShowName(RlvActions::SNC_DEFAULT, target_key))
|
||||
{
|
||||
object_name = RlvStrings::getAnonym(object_name);
|
||||
}
|
||||
report_to_nearby_chat(llformat("%s: (%s)", target_key.asString().c_str(), object_name.c_str()));
|
||||
LLAvatarNameCache::get(target_key, boost::bind(&key_to_name_callback, _1, _2));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -743,9 +743,7 @@ bool DAESaver::saveDAE(std::string filename)
|
|||
up_axis->setCharData("Z_UP");
|
||||
|
||||
// File creator
|
||||
std::string author = "Unknown";
|
||||
if (gCacheName)
|
||||
gCacheName->getFullName(gAgentID, author);
|
||||
std::string author = gAgentUsername;
|
||||
|
||||
daeElement* contributor = asset->add("contributor");
|
||||
contributor->add("author")->setCharData(author);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include "fsareasearch.h"
|
||||
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llscrolllistctrl.h"
|
||||
#include "lllineeditor.h"
|
||||
#include "lltextbox.h"
|
||||
|
|
@ -1076,17 +1077,41 @@ void FSAreaSearch::updateObjectCosts(const LLUUID& object_id, F32 object_cost, F
|
|||
|
||||
void FSAreaSearch::getNameFromUUID(LLUUID& id, std::string& name, BOOL group, bool& name_requested)
|
||||
{
|
||||
BOOL is_group;
|
||||
|
||||
if(!gCacheName->getIfThere(id, name, is_group))
|
||||
if (group)
|
||||
{
|
||||
if(std::find(mNamesRequested.begin(), mNamesRequested.end(), id) == mNamesRequested.end())
|
||||
BOOL is_group;
|
||||
if(!gCacheName->getIfThere(id, name, is_group))
|
||||
{
|
||||
mNamesRequested.push_back(id);
|
||||
gCacheName->get(id, group, boost::bind(&FSAreaSearch::callbackLoadFullName, this, _1, _2));
|
||||
if(std::find(mNamesRequested.begin(), mNamesRequested.end(), id) == mNamesRequested.end())
|
||||
{
|
||||
mNamesRequested.push_back(id);
|
||||
gCacheName->get(id, group, boost::bind(&FSAreaSearch::callbackLoadFullName, this, _1, _2));
|
||||
}
|
||||
name_requested = true;
|
||||
}
|
||||
name_requested = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(id, &av_name))
|
||||
{
|
||||
name = av_name.getUserName();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(std::find(mNamesRequested.begin(), mNamesRequested.end(), id) == mNamesRequested.end())
|
||||
{
|
||||
mNamesRequested.push_back(id);
|
||||
LLAvatarNameCache::get(id, boost::bind(&FSAreaSearch::avatarNameCacheCallback, this, _1, _2));
|
||||
}
|
||||
name_requested = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FSAreaSearch::avatarNameCacheCallback(const LLUUID& id, const LLAvatarName& av_name)
|
||||
{
|
||||
callbackLoadFullName(id, av_name.getUserName());
|
||||
}
|
||||
|
||||
void FSAreaSearch::callbackLoadFullName(const LLUUID& id, const std::string& full_name)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@
|
|||
#include <boost/regex.hpp>
|
||||
#include "llscrolllistcolumn.h"
|
||||
|
||||
class LLAvatarName;
|
||||
class LLTextBox;
|
||||
class LLViewerRegion;
|
||||
class LLCheckBoxCtrl;
|
||||
|
|
@ -112,6 +113,7 @@ public:
|
|||
virtual void draw();
|
||||
virtual void onOpen(const LLSD& key);
|
||||
|
||||
void avatarNameCacheCallback(const LLUUID& id, const LLAvatarName& av_name);
|
||||
void callbackLoadFullName(const LLUUID& id, const std::string& full_name);
|
||||
void processObjectProperties(LLMessageSystem* msg);
|
||||
void updateObjectCosts(const LLUUID& object_id, F32 object_cost, F32 link_cost, F32 physics_cost, F32 link_physics_cost);
|
||||
|
|
|
|||
|
|
@ -306,9 +306,9 @@ public:
|
|||
void mute(const LLUUID& participant_id, U32 flags)
|
||||
{
|
||||
BOOL is_muted = LLMuteList::getInstance()->isMuted(participant_id, flags);
|
||||
std::string name;
|
||||
gCacheName->getFullName(participant_id, name);
|
||||
LLMute mute(participant_id, name, LLMute::AGENT);
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(participant_id, &av_name);
|
||||
LLMute mute(participant_id, av_name.getUserName(), LLMute::AGENT);
|
||||
|
||||
if (!is_muted)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -86,6 +86,18 @@ FSData::FSData() :
|
|||
mFSDataURL = mBaseURL + "/" + "data.xml";
|
||||
}
|
||||
|
||||
FSData::~FSData()
|
||||
{
|
||||
for (avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.begin(); it != mAvatarNameCacheConnections.end(); ++it)
|
||||
{
|
||||
if (it->second.connected())
|
||||
{
|
||||
it->second.disconnect();
|
||||
}
|
||||
}
|
||||
mAvatarNameCacheConnections.clear();
|
||||
}
|
||||
|
||||
void FSData::processResponder(const LLSD& content, const std::string& url, bool save_to_file, const LLDate& last_modified)
|
||||
{
|
||||
if (url == mFSDataURL)
|
||||
|
|
@ -783,6 +795,21 @@ bool FSData::isAgentFlag(const LLUUID& agent_id, flags_t flag)
|
|||
return (iter->second & flag);
|
||||
}
|
||||
|
||||
void FSData::onNameCache(const LLUUID& av_id, const LLAvatarName& av_name)
|
||||
{
|
||||
avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(av_id);
|
||||
if (it != mAvatarNameCacheConnections.end())
|
||||
{
|
||||
if (it->second.connected())
|
||||
{
|
||||
it->second.disconnect();
|
||||
}
|
||||
mAvatarNameCacheConnections.erase(it);
|
||||
}
|
||||
LLMute mute(av_id, av_name.getUserName(), LLMute::EXTERNAL);
|
||||
LLMuteList::getInstance()->add(mute);
|
||||
}
|
||||
|
||||
// this is called in two different places due to can recieved .xml before gCacheName is created and vice versa.
|
||||
void FSData::addAgents()
|
||||
{
|
||||
|
|
@ -796,10 +823,18 @@ void FSData::addAgents()
|
|||
if (iter->second & NO_SPAM)
|
||||
{
|
||||
LLUUID id = iter->first;
|
||||
std::string name;
|
||||
gCacheName->getFullName(id, name);
|
||||
LLMute mute(id, name, LLMute::EXTERNAL);
|
||||
LLMuteList::getInstance()->add(mute);
|
||||
avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(id);
|
||||
if (it != mAvatarNameCacheConnections.end())
|
||||
{
|
||||
if (it->second.connected())
|
||||
{
|
||||
it->second.disconnect();
|
||||
}
|
||||
mAvatarNameCacheConnections.erase(it);
|
||||
}
|
||||
|
||||
LLAvatarNameCache::callback_connection_t cb = LLAvatarNameCache::get(id, boost::bind(&FSData::onNameCache, this, _1, _2));
|
||||
mAvatarNameCacheConnections.insert(std::make_pair(id, cb));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,12 +30,14 @@
|
|||
|
||||
#include "llinstantmessage.h"
|
||||
#include "llsingleton.h"
|
||||
#include "llavatarnamecache.h"
|
||||
|
||||
class FSData : public LLSingleton<FSData>
|
||||
{
|
||||
LOG_CLASS(FSData);
|
||||
|
||||
LLSINGLETON(FSData);
|
||||
virtual ~FSData();
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -90,6 +92,7 @@ private:
|
|||
void processData(const LLSD& fs_data);
|
||||
void processClientTags(const LLSD& tags);
|
||||
void updateClientTagsLocal();
|
||||
void onNameCache(const LLUUID& av_id, const LLAvatarName& av_name);
|
||||
|
||||
std::map<LLUUID, S32> mSupportAgents;
|
||||
std::map<std::string, LLSD> mBlockedVersions;
|
||||
|
|
@ -114,6 +117,9 @@ private:
|
|||
bool mLegacySearch;
|
||||
bool mFSDataDone;
|
||||
bool mAgentsDone;
|
||||
|
||||
typedef std::map<LLUUID, boost::signals2::connection> avatar_name_cache_connection_map_t;
|
||||
avatar_name_cache_connection_map_t mAvatarNameCacheConnections;
|
||||
};
|
||||
|
||||
#endif // FS_DATA_H
|
||||
|
|
|
|||
|
|
@ -299,9 +299,8 @@ bool FSFloaterObjectExport::exportSelection()
|
|||
mAssetRequests.clear();
|
||||
mTextureChecked.clear();
|
||||
|
||||
std::string author = "Unknown";
|
||||
if (gCacheName)
|
||||
gCacheName->getFullName(gAgentID, author);
|
||||
std::string author = gAgentUsername;
|
||||
|
||||
time_t rawtime;
|
||||
time(&rawtime);
|
||||
struct tm* utc_time = gmtime(&rawtime);
|
||||
|
|
|
|||
|
|
@ -564,8 +564,8 @@ void FSFloaterNearbyChat::loadHistory()
|
|||
}
|
||||
|
||||
std::string legacy_name = gCacheName->buildLegacyName(from);
|
||||
gCacheName->getUUID(legacy_name, from_id);
|
||||
}
|
||||
from_id = LLAvatarNameCache::findIdByName(legacy_name);
|
||||
}
|
||||
|
||||
LLChat chat;
|
||||
chat.mFromName = from;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include "fsnearbychatcontrol.h"
|
||||
#include "llagent.h" // gAgent
|
||||
#include "llanimationstates.h" // ANIM_AGENT_WHISPER, ANIM_AGENT_TALK, ANIM_AGENT_SHOUT
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llchatentry.h"
|
||||
#include "llcommandhandler.h"
|
||||
#include "llgesturemgr.h"
|
||||
|
|
@ -752,8 +753,10 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 *
|
|||
// Look for a match
|
||||
while (iter != avatar_ids.end() && !found)
|
||||
{
|
||||
if (gCacheName->getFullName(*iter++, name))
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(*iter++, &av_name))
|
||||
{
|
||||
name = av_name.getUserName();
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
|
||||
{
|
||||
name = RlvStrings::getAnonym(name);
|
||||
|
|
@ -778,8 +781,10 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 *
|
|||
// Look for a match
|
||||
while (iter != avatar_ids.end() && !found)
|
||||
{
|
||||
if (gCacheName->getFullName(*iter++, name))
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(*iter++, &av_name))
|
||||
{
|
||||
name = av_name.getUserName();
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
|
||||
{
|
||||
name = RlvStrings::getAnonym(name);
|
||||
|
|
@ -794,7 +799,16 @@ void FSNearbyChat::handleChatBarKeystroke(LLUICtrl* source, S32 channel /* = 0 *
|
|||
if (found)
|
||||
{
|
||||
std::string first_name, last_name;
|
||||
gCacheName->getFirstLastName(*(iter - 1), first_name, last_name);
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(*(iter - 1), &av_name);
|
||||
std::string username = av_name.getLegacyName();
|
||||
size_t delim_pos = username.find(' ');
|
||||
first_name = username.substr(0, delim_pos);
|
||||
if (delim_pos + 1 < username.length())
|
||||
{
|
||||
last_name = username.substr(delim_pos + 1, std::string::npos);
|
||||
}
|
||||
|
||||
std::string rest_of_match;
|
||||
std::string replaced_text;
|
||||
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
|
||||
|
|
|
|||
|
|
@ -589,8 +589,9 @@ void FSPanelProfileSecondLife::unfreeze()
|
|||
|
||||
void FSPanelProfileSecondLife::csr()
|
||||
{
|
||||
std::string name;
|
||||
gCacheName->getFullName(getAvatarId(), name);
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(getAvatarId(), &av_name);
|
||||
std::string name = av_name.getUserName();
|
||||
LLAvatarActions::csr(getAvatarId(), name);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@
|
|||
#include "llviewermenu.h"
|
||||
#include "llviewerobjectlist.h"
|
||||
|
||||
#include "llavatarnamecache.h"
|
||||
#include "fsradar.h"
|
||||
#include "fsscrolllistctrl.h"
|
||||
#include "llclipboard.h"
|
||||
|
|
@ -417,8 +418,9 @@ bool FSBumpListMenu::onContextMenuItemEnable(const LLSD& userdata)
|
|||
{
|
||||
if (!gMeanCollisionList.empty() && mUUIDs.size() == 1)
|
||||
{
|
||||
std::string name;
|
||||
gCacheName->getFullName(mUUIDs.front(), name);
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(mUUIDs.front(), &av_name);
|
||||
std::string name = av_name.getUserName();
|
||||
return LLMuteList::getInstance()->isMuted(mUUIDs.front(), name);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@
|
|||
|
||||
// <FS:Ansariel> Undo CHUI-90 and make avatar inspector useful again
|
||||
#include "llagentdata.h"
|
||||
#include "llavatarnamecache.h"
|
||||
#include "llcallingcard.h"
|
||||
#include "llfloaterreporter.h"
|
||||
#include "llfloaterworldmap.h"
|
||||
|
|
@ -798,8 +799,9 @@ void LLInspectAvatar::onClickKick()
|
|||
|
||||
void LLInspectAvatar::onClickCSR()
|
||||
{
|
||||
std::string name;
|
||||
gCacheName->getFullName(mAvatarID, name);
|
||||
LLAvatarName av_name;
|
||||
LLAvatarNameCache::get(mAvatarID, &av_name);
|
||||
std::string name = av_name.getUserName();
|
||||
LLAvatarActions::csr(mAvatarID, name);
|
||||
closeFloater();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7997,8 +7997,12 @@ std::string LLInvFVBridge::getSearchableCreator( void ) const
|
|||
std::string strCreator;
|
||||
if(pItem)
|
||||
{
|
||||
if( gCacheName->getFullName( pItem->getCreatorUUID(), strCreator ) )
|
||||
LLAvatarName av_name;
|
||||
if (LLAvatarNameCache::get(pItem->getCreatorUUID(), &av_name))
|
||||
{
|
||||
strCreator = av_name.getUserName();
|
||||
LLStringUtil::toUpper( strCreator );
|
||||
}
|
||||
}
|
||||
|
||||
return strCreator;
|
||||
|
|
|
|||
|
|
@ -78,6 +78,10 @@ void LLSpeaker::lookupName()
|
|||
{
|
||||
if (mDisplayName.empty())
|
||||
{
|
||||
// <FS:Zi> Crash fix on login
|
||||
if(!gCacheName)
|
||||
return;
|
||||
// </FS:Zi>
|
||||
LLAvatarNameCache::get(mID, boost::bind(&LLSpeaker::onNameCache, this, _1, _2)); // todo: can be group???
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue