From 20748e4433f97c31da1dd1965f2b56e065a7c07d Mon Sep 17 00:00:00 2001 From: Rider Linden Date: Fri, 17 Mar 2017 17:02:24 -0700 Subject: Readd the depricated way of updating the estate info. TODO: Figure out why the cap is not working. --- indra/newview/llestateinfomodel.cpp | 72 ++++++++++++++++++++++++++++++------- indra/newview/llestateinfomodel.h | 2 ++ 2 files changed, 62 insertions(+), 12 deletions(-) (limited to 'indra') 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; } -- cgit v1.2.3