Shiny new name cache.

This commit is contained in:
Shyotl
2011-07-15 00:21:38 -05:00
parent ce064f5af2
commit 7e0ee6bb71
52 changed files with 932 additions and 742 deletions

View File

@@ -132,9 +132,8 @@ LLMute::LLMute(const LLUUID& id, const std::string& name, EType type, U32 flags)
LLNameValue* lastname = mute_object->getNVPair("LastName");
if (firstname && lastname)
{
mName.assign( firstname->getString() );
mName.append(" ");
mName.append( lastname->getString() );
mName = LLCacheName::buildFullName(
firstname->getString(), lastname->getString());
}
mType = mute_object->isAvatar() ? AGENT : OBJECT;
}
@@ -501,11 +500,8 @@ void LLMuteList::updateRemove(const LLMute& mute)
gAgent.sendReliableMessage();
}
void notify_automute_callback(const LLUUID& agent_id, const std::string& first_name, const std::string& last_name, BOOL is_group, void* user_data)
void notify_automute_callback(const LLUUID& agent_id, const std::string& full_name, bool is_group, LLMuteList::EAutoReason reason)
{
U32 temp_data = (U32) (uintptr_t) user_data;
LLMuteList::EAutoReason reason = (LLMuteList::EAutoReason)temp_data;
std::string notif_name;
switch (reason)
{
@@ -522,8 +518,7 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& first_n
}
LLSD args;
args["FIRST"] = first_name;
args["LAST"] = last_name;
args["NAME"] = full_name;
LLNotificationPtr notif_ptr = LLNotifications::instance().add(notif_name, args);
if (notif_ptr)
@@ -545,7 +540,7 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& first_n
}
BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, const std::string& first_name, const std::string& last_name)
BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason)
{
BOOL removed = FALSE;
@@ -555,24 +550,17 @@ BOOL LLMuteList::autoRemove(const LLUUID& agent_id, const EAutoReason reason, co
removed = TRUE;
remove(automute);
if (first_name.empty() && last_name.empty())
{
std::string cache_first, cache_last;
if (gCacheName->getName(agent_id, cache_first, cache_last))
std::string full_name;
if (gCacheName->getFullName(agent_id, full_name))
{
// name in cache, call callback directly
notify_automute_callback(agent_id, cache_first, cache_last, FALSE, (void *)reason);
notify_automute_callback(agent_id, full_name, false, reason);
}
else
{
// not in cache, lookup name from cache
gCacheName->get(agent_id, FALSE, notify_automute_callback, (void *)reason);
}
}
else
{
// call callback directly
notify_automute_callback(agent_id, first_name, last_name, FALSE, (void *)reason);
gCacheName->get(agent_id, false,
boost::bind(&notify_automute_callback, _1, _2, _3, reason));
}
}