diff options
author | mberezhnoy <mberezhnoy@productengine.com> | 2013-06-20 12:45:22 +0300 |
---|---|---|
committer | mberezhnoy <mberezhnoy@productengine.com> | 2013-06-20 12:45:22 +0300 |
commit | 2b8beeeff1485682e2b47f330dc8b3c24e966961 (patch) | |
tree | 245cbf45e7cac4ceebb4b6f30d43cde20d6e039d /indra/llui | |
parent | db803e193efee4a54fc0ca3a7fe1a6d4e089c06a (diff) |
CHUI-809 (Right-click menu on user name in compat chat mode doesn't have "IM")
Fixed "Add friend" option always being greyed out, add ability to block object via context menu in compact chat mode.
Diffstat (limited to 'indra/llui')
-rwxr-xr-x | indra/llui/lltextbase.cpp | 3 | ||||
-rwxr-xr-x | indra/llui/llurlaction.cpp | 34 | ||||
-rwxr-xr-x | indra/llui/llurlaction.h | 3 |
3 files changed, 39 insertions, 1 deletions
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e2a39d89e4..0276ade3e1 100755 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -1941,6 +1941,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) registrar.add("Url.OpenInternal", boost::bind(&LLUrlAction::openURLInternal, url)); registrar.add("Url.OpenExternal", boost::bind(&LLUrlAction::openURLExternal, url)); registrar.add("Url.Execute", boost::bind(&LLUrlAction::executeSLURL, url)); + registrar.add("Url.Block", boost::bind(&LLUrlAction::blockObject, url)); registrar.add("Url.Teleport", boost::bind(&LLUrlAction::teleportToLocation, url)); registrar.add("Url.ShowProfile", boost::bind(&LLUrlAction::showProfile, url)); registrar.add("Url.AddFriend", boost::bind(&LLUrlAction::addFriend, url)); @@ -1956,7 +1957,7 @@ void LLTextBase::createUrlContextMenu(S32 x, S32 y, const std::string &in_url) LLMenuHolderGL::child_registry_t::instance()); if (mIsFriendSignal) { - bool isFriend = (*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url))); + bool isFriend = *(*mIsFriendSignal)(LLUUID(LLUrlAction::getUserID(url))); LLView* addFriendButton = mPopupMenu->getChild<LLView>("add_friend"); LLView* removeFriendButton = mPopupMenu->getChild<LLView>("remove_friend"); diff --git a/indra/llui/llurlaction.cpp b/indra/llui/llurlaction.cpp index cf707d87dc..d006209284 100755 --- a/indra/llui/llurlaction.cpp +++ b/indra/llui/llurlaction.cpp @@ -170,6 +170,30 @@ std::string LLUrlAction::getUserID(std::string url) return id_str; } +std::string LLUrlAction::getObjectId(std::string url) +{ + LLURI uri(url); + LLSD path_array = uri.pathArray(); + std::string id_str; + if (path_array.size() >= 3) + { + id_str = path_array.get(2).asString(); + } + return id_str; +} + +std::string LLUrlAction::getObjectName(std::string url) +{ + LLURI uri(url); + LLSD query_map = uri.queryMap(); + std::string name; + if (query_map.has("name")) + { + name = query_map["name"]; + } + return name; +} + void LLUrlAction::sendIM(std::string url) { std::string id_str = getUserID(url); @@ -196,3 +220,13 @@ void LLUrlAction::removeFriend(std::string url) executeSLURL("secondlife:///app/agent/" + id_str + "/removefriend"); } } + +void LLUrlAction::blockObject(std::string url) +{ + std::string object_id = getObjectId(url); + std::string object_name = getObjectName(url); + if (LLUUID::validate(object_id)) + { + executeSLURL("secondlife:///app/agent/" + object_id + "/block/" + object_name); + } +} diff --git a/indra/llui/llurlaction.h b/indra/llui/llurlaction.h index 1984ec63e9..e731376b95 100755 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -77,9 +77,12 @@ public: /// if the Url specifies an SL command in the form like 'app/{cmd}/{id}/*', show its profile static void showProfile(std::string url); static std::string getUserID(std::string url); + static std::string getObjectName(std::string url); + static std::string getObjectId(std::string url); static void sendIM(std::string url); static void addFriend(std::string url); static void removeFriend(std::string url); + static void blockObject(std::string url); /// specify the callbacks to enable this class's functionality typedef boost::function<void (const std::string&)> url_callback_t; |