diff options
-rw-r--r-- | indra/newview/llavataractions.cpp | 109 | ||||
-rw-r--r-- | indra/newview/llavataractions.h | 24 | ||||
-rw-r--r-- | indra/newview/llfloaterpreference.cpp | 3 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 34 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 9 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_profile_overflow.xml | 36 |
6 files changed, 214 insertions, 1 deletions
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 636b1de4d4..a98de900c8 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -336,6 +336,54 @@ void LLAvatarActions::pay(const LLUUID& id) } } +// static +void LLAvatarActions::kick(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("KickUser", LLSD(), payload, handleKick); +} + +// static +void LLAvatarActions::freeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("FreezeUser", LLSD(), payload, handleFreeze); +} + +// static +void LLAvatarActions::unfreeze(const LLUUID& id) +{ + LLSD payload; + payload["avatar_id"] = id; + LLNotifications::instance().add("UnFreezeUser", LLSD(), payload, handleUnfreeze); +} + +//static +void LLAvatarActions::csr(const LLUUID& id, std::string name) +{ + if (name.empty()) return; + + std::string url = "http://csr.lindenlab.com/agent/"; + + // slow and stupid, but it's late + S32 len = name.length(); + for (S32 i = 0; i < len; i++) + { + if (name[i] == ' ') + { + url += "%20"; + } + else + { + url += name[i]; + } + } + + LLWeb::loadURL(url); +} + //static void LLAvatarActions::share(const LLUUID& id) { @@ -460,6 +508,67 @@ bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, con } // static +bool LLAvatarActions::handleKick(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_DEFAULT ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleFreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_FREEZE ); + msg->addStringFast(_PREHASH_Reason, response["message"].asString() ); + gAgent.sendReliableMessage(); + } + return false; +} +bool LLAvatarActions::handleUnfreeze(const LLSD& notification, const LLSD& response) +{ + S32 option = LLNotification::getSelectedOption(notification, response); + std::string text = response["message"].asString(); + if (option == 0) + { + LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID(); + LLMessageSystem* msg = gMessageSystem; + + msg->newMessageFast(_PREHASH_GodKickUser); + msg->nextBlockFast(_PREHASH_UserInfo); + msg->addUUIDFast(_PREHASH_GodID, gAgent.getID() ); + msg->addUUIDFast(_PREHASH_GodSessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_AgentID, avatar_id ); + msg->addU32("KickFlags", KICK_FLAGS_UNFREEZE ); + msg->addStringFast(_PREHASH_Reason, text ); + gAgent.sendReliableMessage(); + } + return false; +} +// static bool LLAvatarActions::callbackAddFriend(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); diff --git a/indra/newview/llavataractions.h b/indra/newview/llavataractions.h index 01c18d4228..a4504ae679 100644 --- a/indra/newview/llavataractions.h +++ b/indra/newview/llavataractions.h @@ -138,11 +138,35 @@ public: */ static void inviteToGroup(const LLUUID& id); + /** + * Kick avatar off grid + */ + static void kick(const LLUUID& id); + + /** + * Freeze avatar + */ + static void freeze(const LLUUID& id); + + /** + * Unfreeze avatar + */ + static void unfreeze(const LLUUID& id); + + /** + * Open csr page for avatar + */ + static void csr(const LLUUID& id, std::string name); + + private: static bool callbackAddFriend(const LLSD& notification, const LLSD& response); static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response); static bool handleRemove(const LLSD& notification, const LLSD& response); static bool handlePay(const LLSD& notification, const LLSD& response, LLUUID avatar_id); + static bool handleKick(const LLSD& notification, const LLSD& response); + static bool handleFreeze(const LLSD& notification, const LLSD& response); + static bool handleUnfreeze(const LLSD& notification, const LLSD& response); static void callback_invite_to_group(LLUUID group_id, LLUUID id); // Just request friendship, no dialog. diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp index ff568a11a9..7e0e8bfaa7 100644 --- a/indra/newview/llfloaterpreference.cpp +++ b/indra/newview/llfloaterpreference.cpp @@ -760,8 +760,9 @@ void LLFloaterPreference::onClickResetCache() { gSavedSettings.setString("NewCacheLocation", ""); gSavedSettings.setString("NewCacheLocationTopFolder", ""); - LLNotificationsUtil::add("CacheWillBeMoved"); } + + LLNotificationsUtil::add("CacheWillBeMoved"); std::string cache_location = gDirUtilp->getCacheDir(true); gSavedSettings.setString("CacheLocation", cache_location); std::string top_folder(gDirUtilp->getBaseFileName(cache_location)); diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index ffe7f57167..e9131a342e 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -403,6 +403,11 @@ void LLPanelProfileTab::updateButtons() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +bool enable_god() +{ + return gAgent.isGodlike(); +} + LLPanelAvatarProfile::LLPanelAvatarProfile() : LLPanelProfileTab() { @@ -423,6 +428,13 @@ BOOL LLPanelAvatarProfile::postBuild() LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); registrar.add("Profile.Share", boost::bind(&LLPanelAvatarProfile::share, this)); + registrar.add("Profile.Kick", boost::bind(&LLPanelAvatarProfile::kick, this)); + registrar.add("Profile.Freeze", boost::bind(&LLPanelAvatarProfile::freeze, this)); + registrar.add("Profile.Unfreeze", boost::bind(&LLPanelAvatarProfile::unfreeze, this)); + registrar.add("Profile.CSR", boost::bind(&LLPanelAvatarProfile::csr, this)); + + LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable; + enable.add("Profile.EnableGod", boost::bind(&enable_god)); mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); @@ -622,6 +634,28 @@ void LLPanelAvatarProfile::share() LLAvatarActions::share(getAvatarId()); } +void LLPanelAvatarProfile::kick() +{ + LLAvatarActions::kick(getAvatarId()); +} + +void LLPanelAvatarProfile::freeze() +{ + LLAvatarActions::freeze(getAvatarId()); +} + +void LLPanelAvatarProfile::unfreeze() +{ + LLAvatarActions::unfreeze(getAvatarId()); +} + +void LLPanelAvatarProfile::csr() +{ + std::string name; + gCacheName->getFullName(getAvatarId(), name); + LLAvatarActions::csr(getAvatarId(), name); +} + void LLPanelAvatarProfile::onUrlTextboxClicked(const std::string& url) { LLWeb::loadURL(url); diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index b19c5cca49..8f07c67fb1 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -181,6 +181,15 @@ protected: */ void share(); + void kick(); + void freeze(); + void unfreeze(); + void csr(); + + + bool enableGod(); + + void onUrlTextboxClicked(const std::string& url); void onHomepageTextboxClicked(); void onAddFriendButtonClick(); diff --git a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml index d0128d1c9a..1dc1c610cf 100644 --- a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml +++ b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml @@ -19,4 +19,40 @@ <menu_item_call.on_click function="Profile.Share" /> </menu_item_call> + <menu_item_call + label="Kick" + layout="topleft" + name="kick"> + <menu_item_call.on_click + function="Profile.Kick" /> + <menu_item_call.on_visible + function="Profile.EnableGod" /> + </menu_item_call> + <menu_item_call + label="Freeze" + layout="topleft" + name="freeze"> + <menu_item_call.on_click + function="Profile.Freeze" /> + <menu_item_call.on_visible + function="Profile.EnableGod" /> + </menu_item_call> + <menu_item_call + label="Unfreeze" + layout="topleft" + name="unfreeze"> + <menu_item_call.on_click + function="Profile.Unfreeze" /> + <menu_item_call.on_visible + function="Profile.EnableGod" /> + </menu_item_call> + <menu_item_call + label="CSR" + layout="topleft" + name="csr"> + <menu_item_call.on_click + function="Profile.CSR" /> + <menu_item_call.on_visible + function="Profile.EnableGod" /> + </menu_item_call> </toggleable_menu> |