本文整理汇总了C++中LLAvatarName类的典型用法代码示例。如果您正苦于以下问题:C++ LLAvatarName类的具体用法?C++ LLAvatarName怎么用?C++ LLAvatarName使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLAvatarName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: filterNames
// Checked: 2010-12-08 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy)
{
std::vector<LLUUID> idAgents;
LLWorld::getInstance()->getAvatars(&idAgents, NULL);
for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++)
{
LLAvatarName avName;
if (LLAvatarNameCache::get(idAgents[idxAgent], &avName))
{
const std::string& strAnonym = RlvStrings::getAnonym(avName.mDisplayName);
// NOTE: if the legacy first and last name are empty we get a legacy name of " " which would replace all spaces in the string
std::string strLegacyName;
if ( (fFilterLegacy) && (!avName.mIsDisplayNameDefault) && (!avName.mLegacyFirstName.empty()) )
strLegacyName = avName.getLegacyName();
// If the display name is a subset of the legacy name we need to filter that first, otherwise it's the other way around
if (std::string::npos != strLegacyName.find(avName.mDisplayName))
{
if (!strLegacyName.empty())
rlvStringReplace(strUTF8Text, strLegacyName, strAnonym);
rlvStringReplace(strUTF8Text, avName.mDisplayName, strAnonym);
}
else
{
rlvStringReplace(strUTF8Text, avName.mDisplayName, strAnonym);
if (!strLegacyName.empty())
rlvStringReplace(strUTF8Text, strLegacyName, strAnonym);
}
}
}
}
示例2: filterNames
// Checked: 2010-12-08 (RLVa-1.2.2c) | Modified: RLVa-1.2.2c
void RlvUtil::filterNames(std::string& strUTF8Text, bool fFilterLegacy)
{
uuid_vec_t idAgents;
LLWorld::getInstance()->getAvatars(&idAgents, NULL);
for (int idxAgent = 0, cntAgent = idAgents.size(); idxAgent < cntAgent; idxAgent++)
{
LLAvatarName avName;
if (LLAvatarNameCache::get(idAgents[idxAgent], &avName))
{
const std::string& strDisplayName = escape_for_regex(avName.getDisplayName());
bool fFilterDisplay = (strDisplayName.length() > 2);
const std::string& strLegacyName = avName.getLegacyName();
fFilterLegacy &= (strLegacyName.length() > 2);
const std::string& strAnonym = RlvStrings::getAnonym(avName);
// If the display name is a subset of the legacy name we need to filter that first, otherwise it's the other way around
if (boost::icontains(strLegacyName, strDisplayName))
{
if (fFilterLegacy)
boost::replace_all_regex(strUTF8Text, boost::regex("\\b" + strLegacyName + "\\b", boost::regex::icase), strAnonym);
if (fFilterDisplay)
boost::replace_all_regex(strUTF8Text, boost::regex("\\b" + strDisplayName + "\\b", boost::regex::icase), strAnonym);
}
else
{
if (fFilterDisplay)
boost::replace_all_regex(strUTF8Text, boost::regex("\\b" + strDisplayName + "\\b", boost::regex::icase), strAnonym);
if (fFilterLegacy)
boost::replace_all_regex(strUTF8Text, boost::regex("\\b" + strLegacyName + "\\b", boost::regex::icase), strAnonym);
}
}
}
}
示例3: on_avatar_name_cache_notify
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
LLSD args;
switch (gSavedSettings.getS32("PhoenixNameSystem"))
{
case 0 : args["NAME"] = av_name.getLegacyName(); break;
case 1 : args["NAME"] = (av_name.mIsDisplayNameDefault ? av_name.mDisplayName : av_name.getCompleteName()); break;
case 2 : args["NAME"] = av_name.mDisplayName; break;
default : args["NAME"] = av_name.getCompleteName(); break;
}
// Popup a notify box with online status of this agent
LLNotificationPtr notification = LLNotificationsUtil::add(online ? "FriendOnline" : "FriendOffline", args, payload);
// If there's an open IM session with this agent, send a notification there too.
LLUUID session_id = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, agent_id);
LLFloaterIMPanel *floater = gIMMgr->findFloaterBySession(session_id);
if (floater)
{
std::string notifyMsg = notification->getMessage();
if (!notifyMsg.empty())
floater->addHistoryLine(notifyMsg,gSavedSettings.getColor4("SystemChatColor"));
}
}
示例4: onAvatarNameCache
void LLInspectAvatar::onAvatarNameCache(
const LLUUID& agent_id,
const LLAvatarName& av_name)
{
mAvatarNameCacheConnection.disconnect();
if (agent_id == mAvatarID)
{
getChild<LLUICtrl>("user_name")->setValue(av_name.getDisplayName());
getChild<LLUICtrl>("user_name_small")->setValue(av_name.getDisplayName());
getChild<LLUICtrl>("user_slid")->setValue(av_name.getUserName());
mAvatarName = av_name;
// show smaller display name if too long to display in regular size
if (getChild<LLTextBox>("user_name")->getTextPixelWidth() > getChild<LLTextBox>("user_name")->getRect().getWidth())
{
getChild<LLUICtrl>("user_name_small")->setVisible( true );
getChild<LLUICtrl>("user_name")->setVisible( false );
}
else
{
getChild<LLUICtrl>("user_name_small")->setVisible( false );
getChild<LLUICtrl>("user_name")->setVisible( true );
}
}
}
示例5: onAvatarNameLookup
//static
// [Ansariel/Henri: Display name support]
void LLSpeaker::onAvatarNameLookup(const LLUUID& id, const LLAvatarName& avatar_name, void* user_data)
// [/Ansariel/Henri: Display name support]
{
LLSpeaker* speaker_ptr = ((LLHandle<LLSpeaker>*)user_data)->get();
delete (LLHandle<LLSpeaker>*)user_data;
if (speaker_ptr)
{
// [Ansariel/Henri: Display name support]
static S32* sPhoenixNameSystem = rebind_llcontrol<S32>("PhoenixNameSystem", &gSavedSettings, true);
switch (*sPhoenixNameSystem)
{
case 0 : speaker_ptr->mDisplayName = avatar_name.getLegacyName(); break;
case 1 : speaker_ptr->mDisplayName = (avatar_name.mIsDisplayNameDefault ? avatar_name.mDisplayName : avatar_name.getCompleteName()); break;
case 2 : speaker_ptr->mDisplayName = avatar_name.mDisplayName; break;
default : speaker_ptr->mDisplayName = avatar_name.getLegacyName(); break;
}
// Also set the legacy name. We will need it to initiate a new
// IM session.
speaker_ptr->mLegacyName = avatar_name.getLegacyName();
// [/Ansariel/Henri: Display name support]
// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Added: RLVa-1.0.0g
// TODO-RLVa: this seems to get called per frame which is very likely an LL bug that will eventuall get fixed
if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
speaker_ptr->mDisplayName = RlvStrings::getAnonym(speaker_ptr->mDisplayName);
// [/RLVa:KB]
}
}
示例6: onAvatarNameCache
void LLNameListCtrl::onAvatarNameCache(const LLUUID& agent_id,
const LLAvatarName& av_name,
std::string suffix,
LLHandle<LLNameListItem> item)
{
avatar_name_cache_connection_map_t::iterator it = mAvatarNameCacheConnections.find(agent_id);
if (it != mAvatarNameCacheConnections.end())
{
if (it->second.connected())
{
it->second.disconnect();
}
mAvatarNameCacheConnections.erase(it);
}
std::string name;
if (mShortNames)
name = av_name.getDisplayName();
else
name = av_name.getCompleteName();
// Append optional suffix.
if (!suffix.empty())
{
name.append(suffix);
}
LLNameListItem* list_item = item.get();
if (list_item && list_item->getUUID() == agent_id)
{
LLScrollListCell* cell = list_item->getColumn(mNameColumnIndex);
if (cell)
{
cell->setValue(name);
setNeedsSort();
}
}
//////////////////////////////////////////////////////////////////////////
// BAKER - FIX NameListCtrl
//if (mPendingLookupsRemaining <= 0)
{
// We might get into a state where mPendingLookupsRemaining might
// go negative. So just reset it right now and figure out if it's
// possible later :)
//mPendingLookupsRemaining = 0;
mNameListCompleteSignal(true);
}
//else
{
// mPendingLookupsRemaining--;
}
//////////////////////////////////////////////////////////////////////////
dirtyColumns();
}
示例7: onAvatarNameCache
void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name)
{
if (mObjectID == avatar_id)
{
mOwnerName = av_name.getCompleteName();
getChild<LLUICtrl>("object_name")->setValue(av_name.getCompleteName());
getChild<LLUICtrl>("object_name")->setToolTip(av_name.getCompleteName());
getChild<LLUICtrl>("abuser_name_edit")->setValue(av_name.getCompleteName());
}
}
示例8: getPNSName
// 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)
{
case 0 : name = avatar_name.getLegacyName(); break;
case 1 : name = avatar_name.getCompleteName(); break;
case 2 : name = avatar_name.mDisplayName; break;
default : name = avatar_name.getLegacyName(); break;
}
}
示例9: getPNSName
// get() with callback compatible version of getPNSName
void LLAvatarNameCache::getPNSName(const LLAvatarName& avatar_name, std::string& name, const S32& name_system)
{
switch (name_system)
{
case 0 : name = avatar_name.getLegacyName(); break;
case 1 : name = avatar_name.getCompleteName(); break;
case 2 : name = avatar_name.mDisplayName; break;
case 3 : name = avatar_name.getLegacyName() + (avatar_name.mIsDisplayNameDefault ? "" : " (" + avatar_name.mDisplayName + ")"); break;
default : name = avatar_name.getLegacyName(); break;
}
}
示例10: onAvatarNameCache
void LLFloaterReporter::onAvatarNameCache(const LLUUID& avatar_id, const LLAvatarName& av_name)
{
mAvatarNameCacheConnection.disconnect();
if (mObjectID == avatar_id)
{
mOwnerName = av_name.getNSName();
getChild<LLUICtrl>("owner_name")->setValue(av_name.getNSName());
getChild<LLUICtrl>("object_name")->setValue(av_name.getNSName());
getChild<LLUICtrl>("abuser_name_edit")->setValue(av_name.getNSName());
}
}
示例11: onAvatarNameLookup
// Ansariel: Name lookup callback for chat console output
// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
//void LLIMHandler::onAvatarNameLookup(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& message_str)
void LLIMHandler::onAvatarNameLookup(const LLUUID& agent_id, const LLAvatarName& av_name, const std::string& message_str, const std::string& group)
{
std::string senderName;
std::string message(message_str);
std::string delimiter = ": ";
std::string prefix = message.substr(0, 4);
LLStringUtil::toLower(prefix);
// irc styled messages
if (prefix == "/me " || prefix == "/me'")
{
delimiter = LLStringUtil::null;
message = message.substr(3);
}
static LLCachedControl<bool> nameTagShowUsernames(gSavedSettings, "NameTagShowUsernames");
static LLCachedControl<bool> useDisplayNames(gSavedSettings, "UseDisplayNames");
if (nameTagShowUsernames && useDisplayNames)
{
senderName = av_name.getCompleteName();
}
else if (useDisplayNames)
{
senderName = av_name.mDisplayName;
}
else
{
senderName = av_name.getLegacyName();
}
if (rlv_handler_t::isEnabled() && gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
{
senderName = RlvStrings::getAnonym(senderName);
}
// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
if(group != "")
{
senderName = "[" + group + "] " + senderName;
}
// FS:LO FIRE-5230 - Chat Console Improvement: Replacing the "IM" in front of group chat messages with the actual group name
LLColor4 textColor = LLUIColorTable::instance().getColor("AgentChatColor");
//color based on contact sets prefs
if(LGGContactSets::getInstance()->hasFriendColorThatShouldShow(agent_id,TRUE))
{
textColor = LGGContactSets::getInstance()->getFriendColor(agent_id);
}
gConsole->addConsoleLine("IM: " + senderName + delimiter + message, textColor);
LLFloaterNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLFloaterNearbyChat>("nearby_chat", LLSD());
gConsole->setVisible(!nearby_chat->getVisible());
}
示例12: onAvatarNameLookup
void LLFloaterIMPanel::onAvatarNameLookup(const LLAvatarName& avatar_name)
{
setTitle(avatar_name.getNSName());
const S32& ns(gSavedSettings.getS32("IMNameSystem"));
std::string title(avatar_name.getNSName(ns));
if (!ns || ns == 3) // Remove Resident, if applicable.
{
size_t pos(title.find(" Resident"));
if (pos != std::string::npos && !gSavedSettings.getBOOL("LiruShowLastNameResident"))
title.erase(pos, 9);
}
setShortTitle(title);
if (LLMultiFloater* mf = dynamic_cast<LLMultiFloater*>(getParent()))
mf->updateFloaterTitle(this);
}
示例13: onAvatarNameCache
void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
{
// setAvatarName(av_name.mDisplayName);
// setAvatarToolTip(av_name.mUsername);
// [RLVa:KB] - Checked: 2010-10-31 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a
bool fRlvFilter = (mRlvCheckShowNames) && (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES));
if (mShowDisplayName && !mShowUsername)
setAvatarName( (!fRlvFilter) ? av_name.mDisplayName : RlvStrings::getAnonym(av_name) );
else if (!mShowDisplayName && mShowUsername)
setAvatarName( (!fRlvFilter) ? av_name.mUsername : RlvStrings::getAnonym(av_name) );
else
setAvatarName( (!fRlvFilter) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name) );
// NOTE: If you change this, you will break sorting the contacts list
// by username unless you go change the comparator too. -- TS
setAvatarToolTip( (!fRlvFilter) ? av_name.mUsername : RlvStrings::getAnonym(av_name) );
// TODO-RLVa: bit of a hack putting this here. Maybe find a better way?
mAvatarIcon->setDrawTooltip(!fRlvFilter);
// [/RLVa:KB]
//KC - store the username for use in sorting
mUserName = av_name.mUsername;
//requesting the list to resort
notifyParent(LLSD().with("sort", LLSD()));
//update children, because this call tends to effect the size of the name field width
updateChildren();
}
示例14: on_avatar_name_cache_teleport_request
// static
void LLAvatarActions::on_avatar_name_cache_teleport_request(const LLUUID& id, const LLAvatarName& av_name)
{
LLSD notification;
notification["uuid"] = id;
std::string name;
// [RLVa:KB] - Checked: 2014-03-31 (Catznip-3.6)
if (!RlvActions::canShowName(RlvActions::SNC_TELEPORTREQUEST))
name = RlvStrings::getAnonym(av_name.getLegacyName());
else
// [RLVa:KB]
name = av_name.getNSName();
notification["NAME"] = name;
LLSD payload;
LLNotificationsUtil::add("TeleportRequestPrompt", notification, payload, teleport_request_callback);
}
示例15: on_avatar_name_show_profile
static void on_avatar_name_show_profile(const LLUUID& agent_id, const LLAvatarName& av_name, bool web)
{
if (gSavedSettings.getString("WebProfileURL").empty() || !(web || gSavedSettings.getBOOL("UseWebProfiles")))
{
LLFloaterAvatarInfo* floater = LLFloaterAvatarInfo::getInstance(agent_id);
if(!floater)
{
floater = new LLFloaterAvatarInfo(av_name.getCompleteName()+" - "+LLTrans::getString("Command_Profile_Label"), agent_id);
floater->center();
}
// ...bring that window to front
floater->open(); /*Flawfinder: ignore*/
}
else
{
std::string username = av_name.mUsername;
if (username.empty())
{
username = LLCacheName::buildUsername(av_name.mDisplayName);
}
llinfos << "opening web profile for " << username << llendl;
std::string url = getProfileURL(username);
// PROFILES: open in webkit window
LLFloaterWebContent::Params p;
p.url(url).
id(agent_id.asString());
LLFloaterWebProfile::showInstance(get_profile_floater_name(agent_id), p);
}
}