summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llurlentry.cpp103
-rw-r--r--indra/llui/llurlentry.h7
-rw-r--r--indra/llui/llurlregistry.cpp9
-rw-r--r--indra/llui/llurlregistry.h4
-rw-r--r--indra/llui/tests/llurlentry_stub.cpp9
-rw-r--r--indra/llui/tests/llurlentry_test.cpp1
6 files changed, 106 insertions, 27 deletions
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 92b7816bdd..0bbf1fe084 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -311,13 +311,82 @@ LLUrlEntryAgent::LLUrlEntryAgent()
mColor = LLUIColorTable::instance().getColor("AgentLinkColor");
}
-void LLUrlEntryAgent::onAgentNameReceived(const LLUUID& id,
- const std::string& first,
- const std::string& last,
- BOOL is_group)
+// IDEVO demo code
+static std::string clean_name(const std::string& full_name)
{
+ std::string displayname;
+ if (full_name == "miyazaki23") // IDEVO demo code
+ {
+ // miyazaki
+ displayname += (char)(0xE5);
+ displayname += (char)(0xAE);
+ displayname += (char)(0xAE);
+ displayname += (char)(0xE5);
+ displayname += (char)(0xB4);
+ displayname += (char)(0x8E);
+ // hayao
+ displayname += (char)(0xE9);
+ displayname += (char)(0xA7);
+ displayname += (char)(0xBF);
+ // san
+ displayname += (char)(0xE3);
+ displayname += (char)(0x81);
+ displayname += (char)(0x95);
+ displayname += (char)(0xE3);
+ displayname += (char)(0x82);
+ displayname += (char)(0x93);
+ }
+ else if (full_name == "Jim Linden")
+ {
+ displayname = "Jos";
+ displayname += (char)(0xC3);
+ displayname += (char)(0xA9);
+ displayname += " Sanchez";
+ }
+ else if (full_name == "James Linden")
+ {
+ displayname = "James Cook";
+ }
+ else if (full_name == "Hamilton Linden")
+ {
+ displayname = "Hamilton Hitchings";
+ }
+ else if (full_name == "Rome Linden")
+ {
+ displayname = "Rome Portlock";
+ }
+ else if (full_name == "M Linden")
+ {
+ displayname = "Mark Kingdon";
+ }
+ else if (full_name == "T Linden")
+ {
+ displayname = "Tom Hale";
+ }
+ else if (full_name == "Callen Linden")
+ {
+ displayname = "Christina Allen";
+ }
+
+ std::string final;
+ if (!displayname.empty())
+ {
+ final = displayname + " (" + full_name + ")";
+ }
+ else
+ {
+ final = full_name;
+ }
+ return final;
+}
+
+void LLUrlEntryAgent::onNameCache(const LLUUID& id,
+ const std::string& full_name,
+ bool is_group)
+{
+ std::string final = clean_name(full_name);
// received the agent name from the server - tell our observers
- callObservers(id.asString(), first + " " + last);
+ callObservers(id.asString(), final);
}
std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
@@ -327,14 +396,14 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
// 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);
std::string full_name;
if (agent_id.isNull())
@@ -343,18 +412,19 @@ std::string LLUrlEntryAgent::getLabel(const std::string &url, const LLUrlLabelCa
}
else if (gCacheName->getFullName(agent_id, full_name))
{
- return full_name;
+ return clean_name(full_name);
}
else
{
- gCacheName->get(agent_id, FALSE,
- boost::bind(&LLUrlEntryAgent::onAgentNameReceived,
- this, _1, _2, _3, _4));
+ gCacheName->get(agent_id, false,
+ boost::bind(&LLUrlEntryAgent::onNameCache,
+ this, _1, _2, _3));
addObserver(agent_id_string, url, cb);
return LLTrans::getString("LoadingData");
}
}
+
//
// LLUrlEntryGroup Describes a Second Life group Url, e.g.,
// secondlife:///app/group/00005ff3-4044-c79f-9de8-fb28ae0df991/about
@@ -371,12 +441,11 @@ LLUrlEntryGroup::LLUrlEntryGroup()
}
void LLUrlEntryGroup::onGroupNameReceived(const LLUUID& id,
- const std::string& first,
- const std::string& last,
- BOOL is_group)
+ const std::string& name,
+ bool is_group)
{
// received the group name from the server - tell our observers
- callObservers(id.asString(), first);
+ callObservers(id.asString(), name);
}
std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCallback &cb)
@@ -406,9 +475,9 @@ std::string LLUrlEntryGroup::getLabel(const std::string &url, const LLUrlLabelCa
}
else
{
- gCacheName->get(group_id, TRUE,
+ gCacheName->get(group_id, true,
boost::bind(&LLUrlEntryGroup::onGroupNameReceived,
- this, _1, _2, _3, _4));
+ this, _1, _2, _3));
addObserver(group_id_string, url, cb);
return LLTrans::getString("LoadingData");
}
diff --git a/indra/llui/llurlentry.h b/indra/llui/llurlentry.h
index 3abada0f24..e6844b595c 100644
--- a/indra/llui/llurlentry.h
+++ b/indra/llui/llurlentry.h
@@ -163,15 +163,13 @@ public:
///
/// LLUrlEntryAgent Describes a Second Life agent Url, e.g.,
/// secondlife:///app/agent/0e346d8b-4433-4d66-a6b0-fd37083abc4c/about
-///
class LLUrlEntryAgent : public LLUrlEntryBase
{
public:
LLUrlEntryAgent();
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
private:
- void onAgentNameReceived(const LLUUID& id, const std::string& first,
- const std::string& last, BOOL is_group);
+ void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group);
};
///
@@ -184,8 +182,7 @@ public:
LLUrlEntryGroup();
/*virtual*/ std::string getLabel(const std::string &url, const LLUrlLabelCallback &cb);
private:
- void onGroupNameReceived(const LLUUID& id, const std::string& first,
- const std::string& last, BOOL is_group);
+ void onGroupNameReceived(const LLUUID& id, const std::string& name, bool is_group);
};
///
diff --git a/indra/llui/llurlregistry.cpp b/indra/llui/llurlregistry.cpp
index 722dbe41b3..5db1f46b8d 100644
--- a/indra/llui/llurlregistry.cpp
+++ b/indra/llui/llurlregistry.cpp
@@ -43,6 +43,8 @@ void LLUrlRegistryNullCallback(const std::string &url, const std::string &label)
LLUrlRegistry::LLUrlRegistry()
{
+ mUrlEntry.reserve(16);
+
// Urls are matched in the order that they were registered
registerUrl(new LLUrlEntryNoLink());
registerUrl(new LLUrlEntrySLURL());
@@ -74,11 +76,14 @@ LLUrlRegistry::~LLUrlRegistry()
}
}
-void LLUrlRegistry::registerUrl(LLUrlEntryBase *url)
+void LLUrlRegistry::registerUrl(LLUrlEntryBase *url, bool force_front)
{
if (url)
{
- mUrlEntry.push_back(url);
+ if (force_front) // IDEVO
+ mUrlEntry.insert(mUrlEntry.begin(), url);
+ else
+ mUrlEntry.push_back(url);
}
}
diff --git a/indra/llui/llurlregistry.h b/indra/llui/llurlregistry.h
index 399ee0a988..6d47c2c2a2 100644
--- a/indra/llui/llurlregistry.h
+++ b/indra/llui/llurlregistry.h
@@ -70,7 +70,9 @@ public:
~LLUrlRegistry();
/// add a new Url handler to the registry (will be freed on destruction)
- void registerUrl(LLUrlEntryBase *url);
+ /// optionally force it to the front of the list, making it take
+ /// priority over other regular expression matches for URLs
+ void registerUrl(LLUrlEntryBase *url, bool force_front = false);
/// get the next Url in an input string, starting at a given character offset
/// your callback is invoked if the matched Url's label changes in the future
diff --git a/indra/llui/tests/llurlentry_stub.cpp b/indra/llui/tests/llurlentry_stub.cpp
index 26d1f2e067..30bab1eb91 100644
--- a/indra/llui/tests/llurlentry_stub.cpp
+++ b/indra/llui/tests/llurlentry_stub.cpp
@@ -36,13 +36,20 @@ BOOL LLCacheName::getFullName(const LLUUID& id, std::string& fullname)
return TRUE;
}
+BOOL LLCacheName::getName(const LLUUID& id, std::string& first, std::string& last)
+{
+ first = "Lynx";
+ last = "Linden";
+ return TRUE;
+}
+
BOOL LLCacheName::getGroupName(const LLUUID& id, std::string& group)
{
group = "My Group";
return TRUE;
}
-boost::signals2::connection LLCacheName::get(const LLUUID& id, BOOL is_group, const LLCacheNameCallback& callback)
+boost::signals2::connection LLCacheName::get(const LLUUID& id, bool is_group, const LLCacheNameCallback& callback)
{
return boost::signals2::connection();
}
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index cbb303a059..bcb1e65092 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -285,7 +285,6 @@ namespace tut
testRegex("Agent Url alternate command", url,
"XXX secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar",
"secondlife:///App/AGENT/0E346D8B-4433-4d66-a6b0-fd37083abc4c/foobar");
-
}
template<> template<>