summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2010-02-24 14:31:46 -0800
committerJames Cook <james@lindenlab.com>2010-02-24 14:31:46 -0800
commitf3e0e9a5264a80d146a1d4d77fd9c4f5d3070278 (patch)
treedcefc0dd92c17186fc09e232e06e6db1c10bc6db /indra
parent649bdf412f4cead9721b5393d3929b6fbd6df272 (diff)
Hack to refresh name tags when I change my display name.
Also fixes a crash when turning on display names.
Diffstat (limited to 'indra')
-rw-r--r--indra/llcommon/llchat.h3
-rw-r--r--indra/llmessage/llavatarnamecache.cpp5
-rw-r--r--indra/llmessage/llavatarnamecache.h1
-rw-r--r--indra/newview/llpanelme.cpp27
-rw-r--r--indra/newview/llpanelme.h3
-rw-r--r--indra/newview/llpanelprofile.h1
-rw-r--r--indra/newview/llviewermessage.cpp17
-rw-r--r--indra/newview/llvoavatar.cpp9
-rw-r--r--indra/newview/llvoavatar.h1
9 files changed, 55 insertions, 12 deletions
diff --git a/indra/llcommon/llchat.h b/indra/llcommon/llchat.h
index a77bd211f3..71ab80159e 100644
--- a/indra/llcommon/llchat.h
+++ b/indra/llcommon/llchat.h
@@ -34,7 +34,6 @@
#ifndef LL_LLCHAT_H
#define LL_LLCHAT_H
-#include "llstring.h"
#include "lluuid.h"
#include "v3math.h"
@@ -75,7 +74,7 @@ typedef enum e_chat_style
class LLChat
{
public:
- LLChat(const std::string& text = LLStringUtil::null)
+ LLChat(const std::string& text = std::string())
: mText(text),
mFromName(),
mFromID(),
diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp
index 1a456e15be..5384e1f067 100644
--- a/indra/llmessage/llavatarnamecache.cpp
+++ b/indra/llmessage/llavatarnamecache.cpp
@@ -308,3 +308,8 @@ bool LLAvatarNameCache::useDisplayNames()
{
return sUseDisplayNames;
}
+
+void LLAvatarNameCache::erase(const LLUUID& agent_id)
+{
+ sCache.erase(agent_id);
+}
diff --git a/indra/llmessage/llavatarnamecache.h b/indra/llmessage/llavatarnamecache.h
index e2166b568f..a09f549877 100644
--- a/indra/llmessage/llavatarnamecache.h
+++ b/indra/llmessage/llavatarnamecache.h
@@ -68,6 +68,7 @@ namespace LLAvatarNameCache
// HACK: turn display names on and off
void toggleDisplayNames();
bool useDisplayNames();
+ void erase(const LLUUID& agent_id);
}
#endif
diff --git a/indra/newview/llpanelme.cpp b/indra/newview/llpanelme.cpp
index 211187a769..19eddb8c51 100644
--- a/indra/newview/llpanelme.cpp
+++ b/indra/newview/llpanelme.cpp
@@ -32,19 +32,23 @@
#include "llviewerprecompiledheaders.h"
-#include "llpanelprofile.h"
+#include "llpanelme.h"
+// Viewer includes
+#include "llpanelprofile.h"
#include "llavatarconstants.h"
-#include "llavatarnamecache.h" // IDEVO
-#include "llpanelme.h"
#include "llagent.h"
#include "llagentwearables.h"
+#include "llsidetray.h"
+#include "llviewercontrol.h"
+
+// Linden libraries
+#include "llavatarnamecache.h" // IDEVO
+#include "llchat.h" // IDEVO HACK
#include "lliconctrl.h"
#include "llnotificationsutil.h" // IDEVO
-#include "llsidetray.h"
#include "lltabcontainer.h"
#include "lltexturectrl.h"
-#include "llviewercontrol.h"
#define PICKER_SECOND_LIFE "2nd_life_pic"
#define PICKER_FIRST_LIFE "real_world_pic"
@@ -298,7 +302,10 @@ void LLPanelMyProfileEdit::onTexturePickerMouseLeave(LLUICtrl* ctrl)
mTextureEditIconMap[ctrl->getName()]->setVisible(FALSE);
}
-static void set_name_callback(const LLSD& notification, const LLSD& response)
+// IDEVO HACK
+extern void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
+
+void LLPanelMyProfileEdit::callbackSetName(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0)
@@ -308,6 +315,11 @@ static void set_name_callback(const LLSD& notification, const LLSD& response)
std::string display_name = response["display_name"].asString();
LLAvatarNameCache::setDisplayName(agent_id, display_name);
+
+ // HACK: Use chat to invalidate names
+ send_chat_from_viewer("refreshname", CHAT_TYPE_NORMAL, 0);
+
+ getChild<LLUICtrl>("user_name")->setValue( display_name );
}
}
@@ -333,7 +345,8 @@ void LLPanelMyProfileEdit::onClickSetName()
args["DISPLAY_NAME"] = display_name;
LLSD payload;
payload["agent_id"] = agent_id;
- LLNotificationsUtil::add("SetDisplayName", args, payload, set_name_callback);
+ LLNotificationsUtil::add("SetDisplayName", args, payload,
+ boost::bind(&LLPanelMyProfileEdit::callbackSetName, this, _1, _2));
}
}
diff --git a/indra/newview/llpanelme.h b/indra/newview/llpanelme.h
index 368fdb307a..ed630133ca 100644
--- a/indra/newview/llpanelme.h
+++ b/indra/newview/llpanelme.h
@@ -34,7 +34,7 @@
#define LL_LLPANELMEPROFILE_H
#include "llpanel.h"
-#include "llpanelavatar.h"
+#include "llpanelprofile.h"
class LLPanelMyProfileEdit;
class LLPanelProfile;
@@ -96,6 +96,7 @@ private:
void onTexturePickerMouseEnter(LLUICtrl* ctrl);
void onTexturePickerMouseLeave(LLUICtrl* ctrl);
void onClickSetName();
+ void callbackSetName(const LLSD& notification, const LLSD& response);
/**
* Enabled/disables controls to prevent overwriting edited data upon receiving
diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h
index f1aa3f10f8..be5b440050 100644
--- a/indra/newview/llpanelprofile.h
+++ b/indra/newview/llpanelprofile.h
@@ -33,7 +33,6 @@
#ifndef LL_LLPANELPROFILE_H
#define LL_LLPANELPROFILE_H
-#include "llviewerprecompiledheaders.h"
#include "llpanel.h"
#include "llpanelavatar.h"
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5b16347db3..1a4d34b217 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -33,9 +33,11 @@
#include "llviewerprecompiledheaders.h"
#include "llviewermessage.h"
+// Linden libraries
#include "llanimationstates.h"
#include "llaudioengine.h"
#include "llavataractions.h"
+#include "llavatarnamecache.h" // IDEVO HACK
#include "lscript_byteformat.h"
#include "lleconomy.h"
#include "lleventtimer.h"
@@ -82,6 +84,7 @@
#include "llspeakers.h"
#include "lltrans.h"
#include "llviewerfoldertype.h"
+#include "llvoavatar.h" // IDEVO HACK
#include "lluri.h"
#include "llviewergenericmessage.h"
#include "llviewermenu.h"
@@ -2661,6 +2664,20 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data)
}
chat.mText = mesg;
+ // IDEVO HACK Use chat to invalidate names
+ if (chat.mSourceType == CHAT_SOURCE_AGENT
+ && chat.mText == "refreshname")
+ {
+ LLAvatarNameCache::erase(chat.mFromID);
+
+ // force name tag to update
+ LLVOAvatar* avatar = dynamic_cast<LLVOAvatar*>(chatter);
+ if (avatar)
+ {
+ avatar->invalidateName();
+ }
+ }
+
// Look for the start of typing so we can put "..." in the bubbles.
if (CHAT_TYPE_START == chat.mChatType)
{
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 2cd1d48aa0..ac91ded18b 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -2829,7 +2829,7 @@ void LLVOAvatar::idleUpdateNameTagText(BOOL new_name)
// ...call this function back when the name arrives
// and force a rebuild
LLAvatarNameCache::get(getID(),
- boost::bind(&LLVOAvatar::idleUpdateNameTagText, this, TRUE));
+ boost::bind(&LLVOAvatar::invalidateName, this));
}
// Might be blank if name not available yet, that's OK
@@ -7629,6 +7629,13 @@ std::string LLVOAvatar::getFullname() const
return name;
}
+// IDEVO
+void LLVOAvatar::invalidateName()
+{
+ // force update by clearing name string
+ mNameString.clear();
+}
+
LLHost LLVOAvatar::getObjectHost() const
{
LLViewerRegion* region = getRegion();
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index b370bcb26d..b1bdf453f3 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -819,6 +819,7 @@ private:
public:
std::string getFullname() const; // Returns "FirstName LastName"
+ void invalidateName(); // force name to update
protected:
static void getAnimLabels(LLDynamicArray<std::string>* labels);
static void getAnimNames(LLDynamicArray<std::string>* names);