meow-7.2.2
Leyla Farazha 2009-12-21 16:18:28 -08:00
commit 470dba630b
6 changed files with 214 additions and 1 deletions

View File

@ -333,6 +333,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)
{
@ -456,6 +504,67 @@ bool LLAvatarActions::callbackAddFriendWithMessage(const LLSD& notification, con
return false;
}
// 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)
{

View File

@ -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.

View File

@ -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));

View File

@ -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);

View File

@ -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();

View File

@ -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>