std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
	if (!gCacheName)
	{
		// probably at login screen, give something short for layout
		return LLTrans::getString("LoadingData");
	}

	std::string group_id_string = getIDStringFromUrl(url);
	if (group_id_string.empty())
	{
		// something went wrong, give raw url
		return unescapeUrl(url);
	}

	LLUUID group_id(group_id_string);
	std::string group_name;
	if (group_id.isNull())
	{
		return LLTrans::getString("GroupNameNone");
	}
	else if (gCacheName->getGroupName(group_id, group_name))
	{
		return group_name;
	}
	else
	{
		gCacheName->getGroup(group_id,
			boost::bind(&LLUrlEntryGroup::onGroupNameReceived,
				this, _1, _2, _3));
		addObserver(group_id_string, url, cb);
		return LLTrans::getString("LoadingData");
	}
}
std::string LLUrlEntryAgentName::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
	if (!gCacheName)
	{
		// probably at the login screen, use short string for layout
		return LLTrans::getString("LoadingData");
	}

	std::string agent_id_string = getIDStringFromUrl(url);
	if (agent_id_string.empty())
	{
		// something went wrong, just give raw url
		return unescapeUrl(url);
	}

	LLUUID agent_id(agent_id_string);
	if (agent_id.isNull())
	{
		return LLTrans::getString("AvatarNameNobody");
	}

	LLAvatarName av_name;
	if (LLAvatarNameCache::get(agent_id, &av_name))
	{
		return getName(av_name);
	}
	else
	{
		LLAvatarNameCache::get(agent_id,
			boost::bind(&LLUrlEntryAgentCompleteName::onAvatarNameCache,
				this, _1, _2));
		addObserver(agent_id_string, url, cb);
		return LLTrans::getString("LoadingData");
	}
}
std::string LLUrlEntryExperienceProfile::getLabel( const std::string &url, const LLUrlLabelCallback &cb )
{
    if (!gCacheName)
    {
        // probably at the login screen, use short string for layout
        return LLTrans::getString("LoadingData");
    }

    std::string experience_id_string = getIDStringFromUrl(url);
    if (experience_id_string.empty())
    {
        // something went wrong, just give raw url
        return unescapeUrl(url);
    }

    LLUUID experience_id(experience_id_string);
    if (experience_id.isNull())
    {
        return LLTrans::getString("ExperienceNameNull");
    }

    const LLSD& experience_details = LLExperienceCache::get(experience_id);
    if(!experience_details.isUndefined())
    {
		std::string experience_name_string = experience_details[LLExperienceCache::NAME].asString();
        return experience_name_string.empty() ? LLTrans::getString("ExperienceNameUntitled") : experience_name_string;
    }

    addObserver(experience_id_string, url, cb);
    LLExperienceCache::get(experience_id, boost::bind(&LLUrlEntryExperienceProfile::onExperienceDetails, this, _1));
    return LLTrans::getString("LoadingData");

}
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
	if (!gCacheName)
	{
		// probably at the login screen, use short string for layout
		return LLTrans::getString("AvatarNameWaiting");
	}

	std::string agent_id_string = getIDStringFromUrl(url);
	if (agent_id_string.empty())
	{
		// something went wrong, just give raw url
		return unescapeUrl(url);
	}

	LLUUID agent_id(agent_id_string);
	if (agent_id.isNull())
	{
		return LLTrans::getString("AvatarNameNobody");
	}

	LLAvatarName av_name;
	if (LLAvatarNameCache::get(agent_id, &av_name))
	{
		std::string label = av_name.getCompleteName();

		// handle suffixes like /mute or /offerteleport
		label = localize_slapp_label(url, label);
		return label;
	}
	else
	{
		// <FS:Ansariel> FIRE-11330: Names in chat get stuck as "Loading..."
		//if (mAvatarNameCacheConnection.connected())
		//{
		//	mAvatarNameCacheConnection.disconnect();
		//}
		//mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
		boost::signals2::connection connection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
		mAvatarNameCacheConnections.insert(std::make_pair(agent_id, connection));
		// </FS:Ansariel>
		addObserver(agent_id_string, url, cb);
		return LLTrans::getString("AvatarNameWaiting");
	}
}
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
{
	if (!gCacheName)
	{
		// probably at the login screen, use short string for layout
		return LLTrans::getString("LoadingData");
	}

	std::string agent_id_string = getIDStringFromUrl(url);
	if (agent_id_string.empty())
	{
		// something went wrong, just give raw url
		return unescapeUrl(url);
	}

	LLUUID agent_id(agent_id_string);
	if (agent_id.isNull())
	{
		return LLTrans::getString("AvatarNameNobody");
	}

	LLAvatarName av_name;
	if (LLAvatarNameCache::get(agent_id, &av_name))
	{
		std::string label = av_name.getCompleteName();

		// handle suffixes like /mute or /offerteleport
		label = localize_slapp_label(url, label);
		return label;
	}
	else
	{
		if (mAvatarNameCacheConnection.connected())
		{
			mAvatarNameCacheConnection.disconnect();
		}
		mAvatarNameCacheConnection = LLAvatarNameCache::get(agent_id, boost::bind(&LLUrlEntryAgent::onAvatarNameCache, this, _1, _2));
		addObserver(agent_id_string, url, cb);
		return LLTrans::getString("LoadingData");
	}
}
LLUUID	LLUrlEntryGroup::getID(const std::string &string) const
{
	return LLUUID(getIDStringFromUrl(string));
}