Fix up the Name System just a little bit more.
Better viewed without space changes Pretty much add support for sending LLAvatarName and std::string to become a name via the system... Also a bit of a revert for llcallingcard.cpp in this regard, just allow it to use a callback along with the new support, but still handle the actual name switching in LLAvatarNameCache. Fixes a problem I was having with "[NAME] is Online" notifications appearing early on, only.
This commit is contained in:
@@ -666,10 +666,17 @@ bool LLAvatarNameCache::get(const LLUUID& agent_id, LLAvatarName *av_name)
|
|||||||
// Return true when name has been set to Phoenix Name System Name, if not return false.
|
// Return true when name has been set to Phoenix Name System Name, if not return false.
|
||||||
bool LLAvatarNameCache::getPNSName(const LLUUID& agent_id, std::string& name)
|
bool LLAvatarNameCache::getPNSName(const LLUUID& agent_id, std::string& name)
|
||||||
{
|
{
|
||||||
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
|
|
||||||
LLAvatarName avatar_name;
|
LLAvatarName avatar_name;
|
||||||
if (LLAvatarNameCache::get(agent_id, &avatar_name))
|
if (get(agent_id, &avatar_name))
|
||||||
|
getPNSName(avatar_name, name);
|
||||||
|
else return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get() with callback compatible version of getPNSName
|
||||||
|
void LLAvatarNameCache::getPNSName(const LLAvatarName& avatar_name, std::string& name)
|
||||||
{
|
{
|
||||||
|
static LLCachedControl<S32> phoenix_name_system("PhoenixNameSystem", 0);
|
||||||
switch (phoenix_name_system)
|
switch (phoenix_name_system)
|
||||||
{
|
{
|
||||||
case 0 : name = avatar_name.getLegacyName(); break;
|
case 0 : name = avatar_name.getLegacyName(); break;
|
||||||
@@ -677,11 +684,6 @@ bool LLAvatarNameCache::getPNSName(const LLUUID& agent_id, std::string& name)
|
|||||||
case 2 : name = avatar_name.mDisplayName; break;
|
case 2 : name = avatar_name.mDisplayName; break;
|
||||||
default : name = avatar_name.getLegacyName(); break;
|
default : name = avatar_name.getLegacyName(); break;
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (gCacheName->getFullName(agent_id, name)) //We've failed, try to get the legacy name anyway
|
|
||||||
return false; //Legacy name is still a failure, it's not a PNSName, afterall.
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLAvatarNameCache::fireSignal(const LLUUID& agent_id,
|
void LLAvatarNameCache::fireSignal(const LLUUID& agent_id,
|
||||||
|
|||||||
@@ -65,9 +65,12 @@ namespace LLAvatarNameCache
|
|||||||
// If name is in cache, returns true and fills in provided LLAvatarName
|
// If name is in cache, returns true and fills in provided LLAvatarName
|
||||||
// otherwise returns false
|
// otherwise returns false
|
||||||
bool get(const LLUUID& agent_id, LLAvatarName *av_name);
|
bool get(const LLUUID& agent_id, LLAvatarName *av_name);
|
||||||
// If get() succeeds, returns true and fills in name string according to Phoenix Name System
|
// If get() succeeds, returns true and fills in name string
|
||||||
// otherwise returns false
|
// via void function below, otherwise returns false
|
||||||
bool getPNSName(const LLUUID& agent_id, std::string& name);
|
bool getPNSName(const LLUUID& agent_id, std::string& name);
|
||||||
|
// Perform a filling of name string according to Phoenix Name System,
|
||||||
|
// when we have an LLAvatarName already.
|
||||||
|
void getPNSName(const LLAvatarName& avatar_name, std::string& name);
|
||||||
|
|
||||||
// Callback types for get() below
|
// Callback types for get() below
|
||||||
typedef boost::signals2::signal<
|
typedef boost::signals2::signal<
|
||||||
|
|||||||
@@ -99,6 +99,11 @@ const F32 OFFLINE_SECONDS = FIND_FREQUENCY + 8.0f;
|
|||||||
// static
|
// static
|
||||||
LLAvatarTracker LLAvatarTracker::sInstance;
|
LLAvatarTracker LLAvatarTracker::sInstance;
|
||||||
|
|
||||||
|
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
|
||||||
|
const LLAvatarName& av_name,
|
||||||
|
bool online,
|
||||||
|
LLSD payload);
|
||||||
|
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
/// Class LLAvatarTracker
|
/// Class LLAvatarTracker
|
||||||
///----------------------------------------------------------------------------
|
///----------------------------------------------------------------------------
|
||||||
@@ -706,9 +711,27 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
|
|||||||
if(chat_notify)
|
if(chat_notify)
|
||||||
{
|
{
|
||||||
// Look up the name of this agent for the notification
|
// Look up the name of this agent for the notification
|
||||||
|
LLAvatarNameCache::get(agent_id,
|
||||||
|
boost::bind(&on_avatar_name_cache_notify,
|
||||||
|
_1, _2, online, payload));
|
||||||
|
}
|
||||||
|
|
||||||
|
mModifyMask |= LLFriendObserver::ONLINE;
|
||||||
|
instance().notifyObservers();
|
||||||
|
gInventory.notifyObservers();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void on_avatar_name_cache_notify(const LLUUID& agent_id,
|
||||||
|
const LLAvatarName& av_name,
|
||||||
|
bool online,
|
||||||
|
LLSD payload)
|
||||||
|
{
|
||||||
|
// Popup a notify box with online status of this agent
|
||||||
|
// Use display name only because this user is your friend
|
||||||
std::string name;
|
std::string name;
|
||||||
|
LLAvatarNameCache::getPNSName(av_name, name);
|
||||||
LLSD args;
|
LLSD args;
|
||||||
if (LLAvatarNameCache::getPNSName(agent_id, name))
|
|
||||||
args["NAME"] = name;
|
args["NAME"] = name;
|
||||||
|
|
||||||
// Popup a notify box with online status of this agent
|
// Popup a notify box with online status of this agent
|
||||||
@@ -725,12 +748,6 @@ void LLAvatarTracker::processNotify(LLMessageSystem* msg, bool online)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mModifyMask |= LLFriendObserver::ONLINE;
|
|
||||||
instance().notifyObservers();
|
|
||||||
gInventory.notifyObservers();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLAvatarTracker::formFriendship(const LLUUID& id)
|
void LLAvatarTracker::formFriendship(const LLUUID& id)
|
||||||
{
|
{
|
||||||
if(id.notNull())
|
if(id.notNull())
|
||||||
|
|||||||
Reference in New Issue
Block a user