diff options
author | Rider Linden <rider@lindenlab.com> | 2017-03-17 17:02:24 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2017-03-17 17:02:24 -0700 |
commit | 20748e4433f97c31da1dd1965f2b56e065a7c07d (patch) | |
tree | f488e4375e86004b1f2ab9c92939fabc60a6d2c2 /indra/newview | |
parent | cee83074e96e8dcf86113ff950750e43dad9882e (diff) |
Readd the depricated way of updating the estate info. TODO: Figure out why the cap is not working.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llestateinfomodel.cpp | 72 | ||||
-rw-r--r-- | indra/newview/llestateinfomodel.h | 2 |
2 files changed, 62 insertions, 12 deletions
diff --git a/indra/newview/llestateinfomodel.cpp b/indra/newview/llestateinfomodel.cpp index 950ac712d1..e422581129 100644 --- a/indra/newview/llestateinfomodel.cpp +++ b/indra/newview/llestateinfomodel.cpp @@ -58,18 +58,12 @@ boost::signals2::connection LLEstateInfoModel::setCommitCallback(const update_si void LLEstateInfoModel::sendEstateInfo() { - std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); - - if (url.empty()) - { - LL_WARNS("EstateInfo") << "Unable to get URL for cap: EstateChangeInfo!!!" << LL_ENDL; - // whoops, couldn't find the cap, so bail out - return; - } - - LLCoros::instance().launch("LLEstateInfoModel::commitEstateInfoCapsCoro", - boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, url)); - + if (!commitEstateInfoCaps()) + { + // the caps method failed, try the old way + LLFloaterRegionInfo::nextInvoice(); + commitEstateInfoDataserver(); + } } bool LLEstateInfoModel::getUseFixedSun() const { return getFlag(REGION_FLAGS_SUN_FIXED); } @@ -119,6 +113,23 @@ void LLEstateInfoModel::notifyCommit() //== PRIVATE STUFF ============================================================ +// tries to send estate info using a cap; returns true if it succeeded +bool LLEstateInfoModel::commitEstateInfoCaps() +{ + std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); + + if (url.empty()) + { + // whoops, couldn't find the cap, so bail out + return false; + } + + LLCoros::instance().launch("LLEstateInfoModel::commitEstateInfoCapsCoro", + boost::bind(&LLEstateInfoModel::commitEstateInfoCapsCoro, this, url)); + + return true; +} + void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) { LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID); @@ -161,6 +172,43 @@ void LLEstateInfoModel::commitEstateInfoCapsCoro(std::string url) } } +/* This is the old way of doing things, is deprecated, and should be + deleted when the dataserver model can be removed */ +// key = "estatechangeinfo" +// strings[0] = str(estate_id) (added by simulator before relay - not here) +// strings[1] = estate_name +// strings[2] = str(estate_flags) +// strings[3] = str((S32)(sun_hour * 1024.f)) +void LLEstateInfoModel::commitEstateInfoDataserver() +{ + LL_DEBUGS("Windlight Sync") << "Sending estate info: " + << "is_sun_fixed = " << getUseFixedSun() + << ", sun_hour = " << getSunHour() << LL_ENDL; + LL_DEBUGS() << getInfoDump() << LL_ENDL; + + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("EstateOwnerMessage"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used + + msg->nextBlock("MethodData"); + msg->addString("Method", "estatechangeinfo"); + msg->addUUID("Invoice", LLFloaterRegionInfo::getLastInvoice()); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", getName()); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", llformat("%u", getFlags())); + + msg->nextBlock("ParamList"); + msg->addString("Parameter", llformat("%d", (S32) (getSunHour() * 1024.0f))); + + gAgent.sendMessage(); +} + std::string LLEstateInfoModel::getInfoDump() { LLSD dump; diff --git a/indra/newview/llestateinfomodel.h b/indra/newview/llestateinfomodel.h index 566cde34eb..0082b5b1f4 100644 --- a/indra/newview/llestateinfomodel.h +++ b/indra/newview/llestateinfomodel.h @@ -84,6 +84,8 @@ protected: void notifyCommit(); private: + bool commitEstateInfoCaps(); + void commitEstateInfoDataserver(); inline bool getFlag(U64 flag) const; inline void setFlag(U64 flag, bool val); U64 getFlags() const { return mFlags; } |