Fixed up some silly issues with the client tag system.

This commit is contained in:
Shyotl
2013-02-17 02:54:30 -06:00
parent 51cbb8d6bd
commit 4cc35d6c66
7 changed files with 41 additions and 21 deletions

View File

@@ -598,7 +598,7 @@ bool llsd_equals(const LLSD& lhs, const LLSD& rhs, unsigned bits)
case LLSD::TypeReal:
// This is where the 'bits' argument comes in handy. If passed
// explicitly, it means to use is_approx_equal_fraction() to compare.
if (bits >= 0)
if (bits != -1)
{
return is_approx_equal_fraction(lhs.asReal(), rhs.asReal(), bits);
}

View File

@@ -268,7 +268,7 @@
<key>Value</key>
<integer>1</integer>
</map>
<key>AscentUseTag</key>
<key>AscentBroadcastTag</key>
<map>
<key>Comment</key>
<string>Broadcast client tag</string>

View File

@@ -193,7 +193,7 @@ void LLPrefsAscentVan::refreshValues()
mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata");
//Tags\Colors ----------------------------------------------------------------------------
mAscentUseTag = gSavedSettings.getBOOL("AscentUseTag");
mAscentBroadcastTag = gSavedSettings.getBOOL("AscentBroadcastTag");
mReportClientUUID = gSavedSettings.getString("AscentReportClientUUID");
mSelectedClient = gSavedSettings.getU32("AscentReportClientIndex");
mShowSelfClientTag = gSavedSettings.getBOOL("AscentShowSelfTag");
@@ -276,7 +276,7 @@ void LLPrefsAscentVan::cancel()
gSavedSettings.setBOOL("AnnounceStreamMetadata", mAnnounceStreamMetadata);
//Tags\Colors ----------------------------------------------------------------------------
gSavedSettings.setBOOL("AscentUseTag", mAscentUseTag);
gSavedSettings.setBOOL("AscentBroadcastTag", mAscentBroadcastTag);
gSavedSettings.setString("AscentReportClientUUID", mReportClientUUID);
gSavedSettings.setU32("AscentReportClientIndex", mSelectedClient);
gSavedSettings.setBOOL("AscentShowSelfTag", mShowSelfClientTag);

View File

@@ -63,7 +63,7 @@ protected:
bool mAnnounceSnapshots;
bool mAnnounceStreamMetadata;
//Tags\Colors
BOOL mAscentUseTag;
BOOL mAscentBroadcastTag;
std::string mReportClientUUID;
U32 mSelectedClient;
BOOL mShowSelfClientTag;

View File

@@ -567,10 +567,15 @@ SHClientTagMgr::SHClientTagMgr()
gSavedSettings.getControl("AscentFriendColor")->getSignal()->connect(boost::bind(&LLVOAvatar::invalidateNameTags));
gSavedSettings.getControl("AscentMutedColor")->getSignal()->connect(boost::bind(&LLVOAvatar::invalidateNameTags));
//Following group of settings all actually manipulate the tag cache for agent avatar. Even if the tag system is 'disabled', we still allow an
//entry to exist for the agent avatar.
gSavedSettings.getControl("AscentUseCustomTag")->getSignal()->connect(boost::bind(&SHClientTagMgr::updateAgentAvatarTag, this));
gSavedSettings.getControl("AscentCustomTagColor")->getSignal()->connect(boost::bind(&SHClientTagMgr::updateAgentAvatarTag, this));
gSavedSettings.getControl("AscentCustomTagLabel")->getSignal()->connect(boost::bind(&SHClientTagMgr::updateAgentAvatarTag, this));
//And because there can be an entry for the self avatar, always perform this as well.
gSavedSettings.getControl("AscentShowSelfTag")->getSignal()->connect(boost::bind(&LLVOAvatar::invalidateNameTags));
if(!getIsEnabled())
return;
@@ -578,12 +583,14 @@ SHClientTagMgr::SHClientTagMgr()
fetchDefinitions();
parseDefinitions();
//These only matter to the agent avatar. Don't iterate over everything.
gSavedSettings.getControl("AscentUseTag")->getSignal()->connect(boost::bind(&SHClientTagMgr::updateAgentAvatarTag, this));
//Tags for other users only exist if the tag system is enabled. No point in registering this callback if non-agent avatars can't have tags.
gSavedSettings.getControl("AscentShowOthersTag")->getSignal()->connect(boost::bind(&LLVOAvatar::invalidateNameTags));
//Update the cached tag for the agent avatar. AscentReportClientUUID dictates what tag the agent avatar sees on their self.
gSavedSettings.getControl("AscentReportClientUUID")->getSignal()->connect(boost::bind(&SHClientTagMgr::updateAgentAvatarTag, this));
//Fire off a AgentSetAppearance update if these change.
gSavedSettings.getControl("AscentUseTag")->getSignal()->connect(boost::bind(&LLAgent::sendAgentSetAppearance, &gAgent));
//Fire off a AgentSetAppearance update if these change. Essentially, forces the new clientid (or lack thereof) to be sent off to the server for others to see.
gSavedSettings.getControl("AscentBroadcastTag")->getSignal()->connect(boost::bind(&LLAgent::sendAgentSetAppearance, &gAgent));
gSavedSettings.getControl("AscentReportClientUUID")->getSignal()->connect(boost::bind(&LLAgent::sendAgentSetAppearance, &gAgent));
}
@@ -682,7 +689,6 @@ const LLSD SHClientTagMgr::generateClientTag(const LLVOAvatar* pAvatar) const
if (pAvatar->isSelf())
{
static const LLCachedControl<bool> ascent_use_tag("AscentUseTag",true);
static const LLCachedControl<bool> ascent_use_custom_tag("AscentUseCustomTag", false);
static const LLCachedControl<LLColor4> ascent_custom_tag_color("AscentCustomTagColor", LLColor4(.5f,1.f,.25f,1.f));
static const LLCachedControl<std::string> ascent_custom_tag_label("AscentCustomTagLabel","custom");
@@ -699,7 +705,7 @@ const LLSD SHClientTagMgr::generateClientTag(const LLVOAvatar* pAvatar) const
{
return LLSD();
}
else if (ascent_use_tag)
else
{
id.set(ascent_report_client_uuid,false);
}
@@ -796,24 +802,32 @@ void SHClientTagMgr::updateAvatarTag(LLVOAvatar* pAvatar)
if(new_tag.isUndefined())
mAvatarTags.erase(id);
else
mAvatarTags.insert(std::pair<LLUUID,LLSD>(id, new_tag));
mAvatarTags[id]=new_tag;
pAvatar->clearNameTag(); //LLVOAvatar::idleUpdateNameTag will pick up on mNameString being cleared.
}
}
const std::string SHClientTagMgr::getClientName(const LLVOAvatar* pAvatar, bool is_friend) const
{
static LLCachedControl<bool> ascent_show_friends_tag("AscentShowFriendsTag", false);
static LLCachedControl<bool> ascent_show_self_tag("AscentShowSelfTag", false);
static LLCachedControl<bool> ascent_show_others_tag("AscentShowOthersTag", false);
if(is_friend && ascent_show_friends_tag)
return "Friend";
else
{
LLSD tag;
std::map<LLUUID, LLSD>::const_iterator it = mAvatarTags.find(pAvatar->getID());
if(it != mAvatarTags.end())
if((!pAvatar->isSelf() && ascent_show_others_tag) ||
(pAvatar->isSelf() && ascent_show_self_tag))
{
tag = it->second.get("name");
LLSD tag;
std::map<LLUUID, LLSD>::const_iterator it = mAvatarTags.find(pAvatar->getID());
if(it != mAvatarTags.end())
{
tag = it->second.get("name");
}
return tag.asString();
}
return tag.asString();
else
return std::string();
}
}
const LLUUID SHClientTagMgr::getClientID(const LLVOAvatar* pAvatar) const
@@ -3222,7 +3236,13 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
while ((index = line.find("%f")) != std::string::npos)
line.replace(index, 2, firstnameText);
while ((index = line.find("%l")) != std::string::npos)
line.replace(index, 2, lastnameText);
{
llinfos << "'" << line.substr(index) << "'" << llendl;
if(lastnameText.empty() && line[index+2] == ' ') //Entire displayname string crammed into firstname
line.replace(index, 3, ""); //so eat the extra space.
else
line.replace(index, 2, lastnameText);
}
while ((index = line.find("%g")) != std::string::npos)
line.replace(index, 2, groupText);
while ((index = line.find("%t")) != std::string::npos)

View File

@@ -2589,7 +2589,7 @@ bool LLVOAvatarSelf::sendAppearanceMessage(LLMessageSystem *mesgsys) const
{
LLTextureEntry* entry = getTE((U8) index);
texture_id[index] = entry->getID();
if (SHClientTagMgr::instance().getIsEnabled() && index == 0 && gSavedSettings.getBOOL("AscentUseTag"))
if (SHClientTagMgr::instance().getIsEnabled() && index == 0 && gSavedSettings.getBOOL("AscentBroadcastTag"))
entry->setID(LLUUID(gSavedSettings.getString("AscentReportClientUUID")));
else
entry->setID(IMG_DEFAULT_AVATAR);

View File

@@ -14,11 +14,11 @@
</panel>
<panel border="true" left="1" bottom="-190" height="180" width="500" label="Tags/Colors" name="TagsColors">
<!-- Client tag options -->
<check_box bottom_delta="-25" control_name="AscentUseTag" follows="top" height="16" initial_value="true" label="Use Client Tag:" left="10" tool_tip="Enabling this will show your client tag on your avatar name locally." name="show_my_tag_check"/>
<check_box bottom_delta="-25" control_name="AscentBroadcastTag" follows="top" height="16" initial_value="true" label="Broadcast Client Tag:" left="10" tool_tip="Choose whether others see that you enjoy Singularity." name="show_my_tag_check"/>
<combo_box follows="top" bottom_delta="-24" height="18" left_delta="24" max_chars="32" tool_tip="The client tag (And subsequent color) to broadcast. Overridden locally by Custom Tag/Color." name="tag_spoofing_combobox" width="130">
<combo_item name="Singularity" value="f25263b7-6167-4f34-a4ef-af65213b2e39">Singularity</combo_item>
</combo_box>
<check_box bottom_delta="-23" control_name="AscentShowSelfTag" follows="top" height="16" initial_value="true" label="Display client tag to self" left_delta="-24" tool_tip="Choose whether others see that you enjoy Singularity." name="show_self_tag_check"/>
<check_box bottom_delta="-23" control_name="AscentShowSelfTag" follows="top" height="16" initial_value="true" label="Display client tag to self" left_delta="-24" tool_tip="Enabling this will show your client tag on your avatar name locally." name="show_self_tag_check"/>
<check_box bottom_delta="-20" control_name="AscentShowSelfTagColor" follows="top" height="16" initial_value="true" label="Display client tag color to self" tool_tip="Enabling this set your avatar name color to your client tag color or custom set color." name="show_self_tag_color_check"/>
<check_box bottom_delta="-20" control_name="AscentShowFriendsTag" follows="top" height="16" initial_value="true" label="Display friend client tags as (Friend)" tool_tip="Enabling this changes your friends' client tags to (Friend)." name="show_friend_tag_check"/>
<!-- End of Left Side -->