STORM-68 Code cleanup/function renaming

meow-7.2.2
Jonathan Yap 2013-12-05 13:26:43 -05:00
parent 9e8a7869ce
commit 944840c8b1
3 changed files with 26 additions and 16 deletions

View File

@ -158,30 +158,42 @@ void LLFloaterPermsDefault::onCommitCopy(const LLSD& user_data)
class LLFloaterPermsResponder : public LLHTTPClient::Responder
{
public:
LLFloaterPermsResponder(): LLHTTPClient::Responder() {}
LLFloaterPermsResponder(): LLHTTPClient::Responder() {}
private:
std::string mPreviousReason;
void error(U32 status, const std::string& reason)
{
LLSD args;
args["REASON"] = reason;
LLNotificationsUtil::add("DefaultObjectPermissions", args);
llwarns << "DBG !" << mPreviousReason << "!" << llendl;
// Do not display the same error more than once in a row
if (reason != mPreviousReason)
{
mPreviousReason = reason;
LLSD args;
args["REASON"] = reason;
LLNotificationsUtil::add("DefaultObjectPermissions", args);
}
}
void result(const LLSD& content)
{
// Since we have had a successful POST call be sure to display the next error message
// even if it is the same as a previous one.
mPreviousReason = "";
LLFloaterPermsDefault::setCapSent(true);
LL_INFOS("FloaterPermsResponder") << "Sent default permissions to simulator" << LL_ENDL;
}
};
void LLFloaterPermsDefault::updateCap(bool alwaysUpdate)
void LLFloaterPermsDefault::sendInitialPerms()
{
llwarns << "DBG start" << llendl;
if(!alwaysUpdate && mCapSent)
if(!mCapSent)
{
return;
updateCap();
}
}
llwarns << "DBG getRegion" << llendl;
void LLFloaterPermsDefault::updateCap()
{
std::string object_url = gAgent.getRegion()->getCapability("AgentPreferences");
if(!object_url.empty())
@ -193,7 +205,7 @@ llwarns << "DBG getRegion" << llendl;
(LLSD::Integer)LLFloaterPerms::getEveryonePerms(sCategoryNames[CAT_OBJECTS]);
report["default_object_perm_masks"]["NextOwner"] =
(LLSD::Integer)LLFloaterPerms::getNextOwnerPerms(sCategoryNames[CAT_OBJECTS]);
llwarns << "DBG post:" << report << llendl;
LLHTTPClient::post(object_url, report, new LLFloaterPermsResponder());
}
}
@ -211,7 +223,7 @@ void LLFloaterPermsDefault::ok()
// We know some setting has changed but not which one. Just in case it was a setting for
// object permissions tell the server what the values are.
updateCap(true);
updateCap();
}
void LLFloaterPermsDefault::cancel()

View File

@ -59,7 +59,8 @@ public:
void onClickOK();
void onClickCancel();
void onCommitCopy(const LLSD& user_data);
static void updateCap(bool alwaysUpdate);
static void sendInitialPerms();
static void updateCap();
static void setCapSent(bool cap_sent);
// Update instantiation of sCategoryNames in the .cpp file to match if you change this!

View File

@ -1574,10 +1574,7 @@ void LLViewerRegion::unpackRegionHandshake()
msg->addU32("Flags", 0x0 );
msg->sendReliable(host);
// Supplying false in this call means only send the default permissions to the simulator if
// it has never been sent. Once this data is sent the simulator will pass this data to new
// simulators as the agent moves around.
LLFloaterPermsDefault::updateCap(false);
LLFloaterPermsDefault::sendInitialPerms();
}
void LLViewerRegionImpl::buildCapabilityNames(LLSD& capabilityNames)