diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index e2a39d89e4b8e166383439a999f1781f2300ee8b..0276ade3e18d3c58e60a9e5be2660e52506090bb 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 cf707d87dc30cc839e2a4e9b2314fa1cb159bc03..d006209284318e9c5de62ed7925884cfcfffb391 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 1984ec63e96a511160fb1e0eb5c47f39b829aa18..e731376b95e03d6419ed3f1a29e14344ac15d486 100755 --- a/indra/llui/llurlaction.h +++ b/indra/llui/llurlaction.h @@ -77,9 +77,12 @@ class LLUrlAction /// 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; diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 3b95b4647679ad0e2ff00914d9d04e6adce2f208..5acc98904ba6b4589ec49599c8cbf6d087dd0a5d 100755 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -36,6 +36,8 @@ #include "lltabcontainer.h" #include "llviewercontrol.h" #include "llviewernetwork.h" +#include "llmutelist.h" +#include "llpanelblockedlist.h" static const std::string PANEL_PICKS = "panel_picks"; @@ -161,6 +163,18 @@ class LLAgentHandler : public LLCommandHandler return true; } + if (verb == "block") + { + if (params.size() > 2) + { + const std::string object_name = params[2].asString(); + LLMute mute(avatar_id, object_name, LLMute::OBJECT); + LLMuteList::getInstance()->add(mute); + LLPanelBlockedList::showPanelAndSelect(mute.mID); + } + return true; + } + return false; } }; diff --git a/indra/newview/skins/default/xui/en/menu_url_objectim.xml b/indra/newview/skins/default/xui/en/menu_url_objectim.xml index 87ab58e622e70dcd717cee5fd35b2b2584b54674..b9d003b8419c244edfc95f9c391d0dfd001af118 100755 --- a/indra/newview/skins/default/xui/en/menu_url_objectim.xml +++ b/indra/newview/skins/default/xui/en/menu_url_objectim.xml @@ -9,6 +9,13 @@ <menu_item_call.on_click function="Url.Execute" /> </menu_item_call> + <menu_item_call + label="Block..." + layout="topleft" + name="block_object"> + <menu_item_call.on_click + function="Url.Block" /> + </menu_item_call> <menu_item_separator layout="topleft" /> <menu_item_call