Derive LLPanelPlace from LLRemoteParcelInfoObserver, and update affected sections to v-d.
This commit is contained in:
@@ -39,7 +39,6 @@
|
|||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
#include "llsecondlifeurls.h"
|
#include "llsecondlifeurls.h"
|
||||||
#include "llremoteparcelrequest.h"
|
|
||||||
#include "llfloater.h"
|
#include "llfloater.h"
|
||||||
|
|
||||||
#include "llagent.h"
|
#include "llagent.h"
|
||||||
@@ -62,9 +61,6 @@
|
|||||||
|
|
||||||
#include "hippogridmanager.h"
|
#include "hippogridmanager.h"
|
||||||
|
|
||||||
//static
|
|
||||||
std::list<LLPanelPlace*> LLPanelPlace::sAllPanels;
|
|
||||||
|
|
||||||
LLPanelPlace::LLPanelPlace()
|
LLPanelPlace::LLPanelPlace()
|
||||||
: LLPanel(std::string("Places Panel")),
|
: LLPanel(std::string("Places Panel")),
|
||||||
mParcelID(),
|
mParcelID(),
|
||||||
@@ -74,14 +70,14 @@ LLPanelPlace::LLPanelPlace()
|
|||||||
mPosRegion(),
|
mPosRegion(),
|
||||||
mAuctionID(0),
|
mAuctionID(0),
|
||||||
mLandmarkAssetID()
|
mLandmarkAssetID()
|
||||||
{
|
{}
|
||||||
sAllPanels.push_back(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LLPanelPlace::~LLPanelPlace()
|
LLPanelPlace::~LLPanelPlace()
|
||||||
{
|
{
|
||||||
sAllPanels.remove(this);
|
if (mParcelID.isNull()) return;
|
||||||
|
|
||||||
|
LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -179,8 +175,14 @@ void LLPanelPlace::resetName(const std::string& name)
|
|||||||
|
|
||||||
void LLPanelPlace::setParcelID(const LLUUID& parcel_id)
|
void LLPanelPlace::setParcelID(const LLUUID& parcel_id)
|
||||||
{
|
{
|
||||||
|
if (parcel_id.isNull()) return;
|
||||||
|
|
||||||
|
if(mParcelID.notNull())
|
||||||
|
LLRemoteParcelInfoProcessor::getInstance()->removeObserver(mParcelID, this);
|
||||||
|
|
||||||
mParcelID = parcel_id;
|
mParcelID = parcel_id;
|
||||||
sendParcelInfoRequest();
|
LLRemoteParcelInfoProcessor::getInstance()->addObserver(mParcelID, this);
|
||||||
|
LLRemoteParcelInfoProcessor::getInstance()->sendParcelInfoRequest(mParcelID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelPlace::setSnapshot(const LLUUID& snapshot_id)
|
void LLPanelPlace::setSnapshot(const LLUUID& snapshot_id)
|
||||||
@@ -199,23 +201,6 @@ void LLPanelPlace::setLandTypeString(const std::string& land_type)
|
|||||||
mLandTypeEditor->setText(land_type);
|
mLandTypeEditor->setText(land_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LLPanelPlace::sendParcelInfoRequest()
|
|
||||||
{
|
|
||||||
LLMessageSystem *msg = gMessageSystem;
|
|
||||||
|
|
||||||
if (mParcelID != mRequestedID)
|
|
||||||
{
|
|
||||||
msg->newMessage("ParcelInfoRequest");
|
|
||||||
msg->nextBlockFast(_PREHASH_AgentData);
|
|
||||||
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
|
|
||||||
msg->addUUID("SessionID", gAgent.getSessionID());
|
|
||||||
msg->nextBlock("Data");
|
|
||||||
msg->addUUID("ParcelID", mParcelID);
|
|
||||||
gAgent.sendReliableMessage();
|
|
||||||
mRequestedID = mParcelID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason)
|
void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason)
|
||||||
{
|
{
|
||||||
// We only really handle 404 and 499 errors
|
// We only really handle 404 and 499 errors
|
||||||
@@ -231,141 +216,94 @@ void LLPanelPlace::setErrorStatus(U32 status, const std::string& reason)
|
|||||||
mDescEditor->setText(error_text);
|
mDescEditor->setText(error_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
//static
|
void LLPanelPlace::processParcelInfo(const LLParcelData& parcel_data)
|
||||||
void LLPanelPlace::processParcelInfoReply(LLMessageSystem *msg, void **)
|
|
||||||
{
|
{
|
||||||
LLUUID agent_id;
|
mAuctionID = parcel_data.auction_id;
|
||||||
LLUUID parcel_id;
|
|
||||||
LLUUID owner_id;
|
|
||||||
std::string name;
|
|
||||||
std::string desc;
|
|
||||||
S32 actual_area;
|
|
||||||
S32 billable_area;
|
|
||||||
U8 flags;
|
|
||||||
F32 global_x;
|
|
||||||
F32 global_y;
|
|
||||||
F32 global_z;
|
|
||||||
std::string sim_name;
|
|
||||||
LLUUID snapshot_id;
|
|
||||||
F32 dwell;
|
|
||||||
S32 sale_price;
|
|
||||||
S32 auction_id;
|
|
||||||
|
|
||||||
msg->getUUID("AgentData", "AgentID", agent_id );
|
if (parcel_data.snapshot_id.notNull())
|
||||||
msg->getUUID("Data", "ParcelID", parcel_id);
|
|
||||||
|
|
||||||
// look up all panels which have this avatar
|
|
||||||
for (panel_list_t::iterator iter = sAllPanels.begin(); iter != sAllPanels.end(); ++iter)
|
|
||||||
{
|
{
|
||||||
LLPanelPlace* self = *iter;
|
setSnapshot(parcel_data.snapshot_id);
|
||||||
if (self->mParcelID != parcel_id)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg->getUUID ("Data", "OwnerID", owner_id);
|
|
||||||
msg->getString ("Data", "Name", name);
|
|
||||||
msg->getString ("Data", "Desc", desc);
|
|
||||||
msg->getS32 ("Data", "ActualArea", actual_area);
|
|
||||||
msg->getS32 ("Data", "BillableArea", billable_area);
|
|
||||||
msg->getU8 ("Data", "Flags", flags);
|
|
||||||
msg->getF32 ("Data", "GlobalX", global_x);
|
|
||||||
msg->getF32 ("Data", "GlobalY", global_y);
|
|
||||||
msg->getF32 ("Data", "GlobalZ", global_z);
|
|
||||||
msg->getString ("Data", "SimName", sim_name);
|
|
||||||
msg->getUUID ("Data", "SnapshotID", snapshot_id);
|
|
||||||
msg->getF32 ("Data", "Dwell", dwell);
|
|
||||||
msg->getS32 ("Data", "SalePrice", sale_price);
|
|
||||||
msg->getS32 ("Data", "AuctionID", auction_id);
|
|
||||||
|
|
||||||
|
|
||||||
self->mAuctionID = auction_id;
|
|
||||||
|
|
||||||
if(snapshot_id.notNull())
|
|
||||||
{
|
|
||||||
self->mSnapshotCtrl->setImageAssetID(snapshot_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only assign the name and description if they are not empty and there is not a
|
|
||||||
// value present (passed in from a landmark, e.g.)
|
|
||||||
|
|
||||||
if( !name.empty()
|
|
||||||
&& self->mNameEditor && self->mNameEditor->getText().empty())
|
|
||||||
{
|
|
||||||
self->mNameEditor->setText(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( !desc.empty()
|
|
||||||
&& self->mDescEditor && self->mDescEditor->getText().empty())
|
|
||||||
{
|
|
||||||
self->mDescEditor->setText(desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string info_text;
|
|
||||||
LLUIString traffic = self->getString("traffic_text");
|
|
||||||
traffic.setArg("[TRAFFIC]", llformat("%d ", (int)dwell));
|
|
||||||
info_text = traffic;
|
|
||||||
LLUIString area = self->getString("area_text");
|
|
||||||
area.setArg("[AREA]", llformat("%d", actual_area));
|
|
||||||
info_text += area;
|
|
||||||
if (flags & DFQ_FOR_SALE)
|
|
||||||
{
|
|
||||||
LLUIString forsale = self->getString("forsale_text");
|
|
||||||
forsale.setArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
|
|
||||||
forsale.setArg("[PRICE]", llformat("%d", sale_price));
|
|
||||||
info_text += forsale;
|
|
||||||
}
|
|
||||||
if (auction_id != 0)
|
|
||||||
{
|
|
||||||
LLUIString auction = self->getString("auction_text");
|
|
||||||
auction.setArg("[ID]", llformat("%010d ", auction_id));
|
|
||||||
info_text += auction;
|
|
||||||
}
|
|
||||||
if (self->mInfoEditor)
|
|
||||||
{
|
|
||||||
self->mInfoEditor->setText(info_text);
|
|
||||||
}
|
|
||||||
|
|
||||||
// HACK: Flag 0x2 == adult region,
|
|
||||||
// Flag 0x1 == mature region, otherwise assume PG
|
|
||||||
std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
|
|
||||||
if (flags & 0x2)
|
|
||||||
{
|
|
||||||
rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT);
|
|
||||||
}
|
|
||||||
else if (flags & 0x1)
|
|
||||||
{
|
|
||||||
rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Just use given region position for display
|
|
||||||
S32 region_x = llround(self->mPosRegion.mV[0]);
|
|
||||||
S32 region_y = llround(self->mPosRegion.mV[1]);
|
|
||||||
S32 region_z = llround(self->mPosRegion.mV[2]);
|
|
||||||
|
|
||||||
// If the region position is zero, grab position from the global
|
|
||||||
if(self->mPosRegion.isExactlyZero())
|
|
||||||
{
|
|
||||||
region_x = llround(global_x) % REGION_WIDTH_UNITS;
|
|
||||||
region_y = llround(global_y) % REGION_WIDTH_UNITS;
|
|
||||||
region_z = llround(global_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(self->mPosGlobal.isExactlyZero())
|
|
||||||
{
|
|
||||||
self->mPosGlobal.setVec(global_x, global_y, global_z);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string location = llformat("%s %d, %d, %d (%s)",
|
|
||||||
sim_name.c_str(), region_x, region_y, region_z, rating.c_str());
|
|
||||||
if (self->mLocationDisplay)
|
|
||||||
{
|
|
||||||
self->mLocationDisplay->setText(location);
|
|
||||||
}
|
|
||||||
|
|
||||||
BOOL show_auction = (auction_id > 0);
|
|
||||||
self->mAuctionBtn->setVisible(show_auction);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only assign the name and description if they are not empty and there is not a
|
||||||
|
// value present (passed in from a landmark, e.g.)
|
||||||
|
|
||||||
|
if( !parcel_data.name.empty()
|
||||||
|
&& mNameEditor && mNameEditor->getText().empty())
|
||||||
|
{
|
||||||
|
mNameEditor->setText(parcel_data.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !parcel_data.desc.empty()
|
||||||
|
&& mDescEditor && mDescEditor->getText().empty())
|
||||||
|
{
|
||||||
|
mDescEditor->setText(parcel_data.desc);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string info_text;
|
||||||
|
LLUIString traffic = getString("traffic_text");
|
||||||
|
traffic.setArg("[TRAFFIC]", llformat("%d ", (int)parcel_data.dwell));
|
||||||
|
info_text = traffic;
|
||||||
|
LLUIString area = getString("area_text");
|
||||||
|
area.setArg("[AREA]", llformat("%d", parcel_data.actual_area));
|
||||||
|
info_text += area;
|
||||||
|
if (parcel_data.flags & DFQ_FOR_SALE)
|
||||||
|
{
|
||||||
|
LLUIString forsale = getString("forsale_text");
|
||||||
|
forsale.setArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol());
|
||||||
|
forsale.setArg("[PRICE]", llformat("%d", parcel_data.sale_price));
|
||||||
|
info_text += forsale;
|
||||||
|
}
|
||||||
|
if (parcel_data.auction_id != 0)
|
||||||
|
{
|
||||||
|
LLUIString auction = getString("auction_text");
|
||||||
|
auction.setArg("[ID]", llformat("%010d ", parcel_data.auction_id));
|
||||||
|
info_text += auction;
|
||||||
|
}
|
||||||
|
if (mInfoEditor)
|
||||||
|
{
|
||||||
|
mInfoEditor->setText(info_text);
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: Flag 0x2 == adult region,
|
||||||
|
// Flag 0x1 == mature region, otherwise assume PG
|
||||||
|
std::string rating = LLViewerRegion::accessToString(SIM_ACCESS_PG);
|
||||||
|
if (parcel_data.flags & 0x2)
|
||||||
|
{
|
||||||
|
rating = LLViewerRegion::accessToString(SIM_ACCESS_ADULT);
|
||||||
|
}
|
||||||
|
else if (parcel_data.flags & 0x1)
|
||||||
|
{
|
||||||
|
rating = LLViewerRegion::accessToString(SIM_ACCESS_MATURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Just use given region position for display
|
||||||
|
S32 region_x = llround(mPosRegion.mV[0]);
|
||||||
|
S32 region_y = llround(mPosRegion.mV[1]);
|
||||||
|
S32 region_z = llround(mPosRegion.mV[2]);
|
||||||
|
|
||||||
|
// If the region position is zero, grab position from the global
|
||||||
|
if(mPosRegion.isExactlyZero())
|
||||||
|
{
|
||||||
|
region_x = llround(parcel_data.global_x) % REGION_WIDTH_UNITS;
|
||||||
|
region_y = llround(parcel_data.global_y) % REGION_WIDTH_UNITS;
|
||||||
|
region_z = llround(parcel_data.global_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(mPosGlobal.isExactlyZero())
|
||||||
|
{
|
||||||
|
mPosGlobal.setVec(parcel_data.global_x, parcel_data.global_y, parcel_data.global_z);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string location = llformat("%s %d, %d, %d (%s)",
|
||||||
|
parcel_data.sim_name.c_str(), region_x, region_y, region_z, rating.c_str());
|
||||||
|
if (mLocationDisplay)
|
||||||
|
{
|
||||||
|
mLocationDisplay->setText(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL show_auction = (parcel_data.auction_id > 0);
|
||||||
|
mAuctionBtn->setVisible(show_auction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -391,7 +329,7 @@ void LLPanelPlace::displayParcelInfo(const LLVector3& pos_region,
|
|||||||
U64 region_handle = to_region_handle(pos_global);
|
U64 region_handle = to_region_handle(pos_global);
|
||||||
body["region_handle"] = ll_sd_from_U64(region_handle);
|
body["region_handle"] = ll_sd_from_U64(region_handle);
|
||||||
}
|
}
|
||||||
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(this->getHandle()));
|
LLHTTPClient::post(url, body, new LLRemoteParcelRequestResponder(this->getObserverHandle()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
#define LL_LLPANELPLACE_H
|
#define LL_LLPANELPLACE_H
|
||||||
|
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
|
#include "llremoteparcelrequest.h"
|
||||||
|
|
||||||
#include "v3dmath.h"
|
#include "v3dmath.h"
|
||||||
#include "lluuid.h"
|
#include "lluuid.h"
|
||||||
@@ -46,7 +47,7 @@ class LLTextureCtrl;
|
|||||||
class LLMessageSystem;
|
class LLMessageSystem;
|
||||||
class LLInventoryItem;
|
class LLInventoryItem;
|
||||||
|
|
||||||
class LLPanelPlace : public LLPanel
|
class LLPanelPlace : public LLPanel, public LLRemoteParcelInfoObserver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLPanelPlace();
|
LLPanelPlace();
|
||||||
@@ -58,7 +59,7 @@ public:
|
|||||||
// Ignore all old location information, useful if you are
|
// Ignore all old location information, useful if you are
|
||||||
// recycling an existing dialog and need to clear it.
|
// recycling an existing dialog and need to clear it.
|
||||||
|
|
||||||
void setParcelID(const LLUUID& parcel_id);
|
/*virtual*/ void setParcelID(const LLUUID& parcel_id);
|
||||||
// Sends a request for data about the given parcel, which will
|
// Sends a request for data about the given parcel, which will
|
||||||
// only update the location if there is none already available.
|
// only update the location if there is none already available.
|
||||||
|
|
||||||
@@ -67,15 +68,14 @@ public:
|
|||||||
void setSnapshot(const LLUUID& snapshot_id);
|
void setSnapshot(const LLUUID& snapshot_id);
|
||||||
void setLocationString(const std::string& location);
|
void setLocationString(const std::string& location);
|
||||||
void setLandTypeString(const std::string& land_type);
|
void setLandTypeString(const std::string& land_type);
|
||||||
void setErrorStatus(U32 status, const std::string& reason);
|
/*virtual*/ void setErrorStatus(U32 status, const std::string& reason);
|
||||||
void resetName(const std::string& name);
|
void resetName(const std::string& name);
|
||||||
|
|
||||||
void sendParcelInfoRequest();
|
|
||||||
void displayParcelInfo(const LLVector3& pos_region,
|
void displayParcelInfo(const LLVector3& pos_region,
|
||||||
const LLUUID& landmark_asset_id,
|
const LLUUID& landmark_asset_id,
|
||||||
const LLUUID& region_id,
|
const LLUUID& region_id,
|
||||||
const LLVector3d& pos_global);
|
const LLVector3d& pos_global);
|
||||||
static void processParcelInfoReply(LLMessageSystem* msg, void**);
|
/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
|
||||||
|
|
||||||
LLTextureCtrl *getSnapshotCtrl() const { return mSnapshotCtrl; }
|
LLTextureCtrl *getSnapshotCtrl() const { return mSnapshotCtrl; }
|
||||||
|
|
||||||
@@ -113,9 +113,6 @@ protected:
|
|||||||
LLButton* mMapBtn;
|
LLButton* mMapBtn;
|
||||||
//LLButton* mLandmarkBtn;
|
//LLButton* mLandmarkBtn;
|
||||||
LLButton* mAuctionBtn;
|
LLButton* mAuctionBtn;
|
||||||
|
|
||||||
typedef std::list<LLPanelPlace*> panel_list_t;
|
|
||||||
static panel_list_t sAllPanels;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLPANELPLACE_H
|
#endif // LL_LLPANELPLACE_H
|
||||||
|
|||||||
@@ -34,46 +34,172 @@
|
|||||||
|
|
||||||
#include "llviewerprecompiledheaders.h"
|
#include "llviewerprecompiledheaders.h"
|
||||||
|
|
||||||
#include "llagent.h"
|
#include "message.h"
|
||||||
#include "llremoteparcelrequest.h"
|
|
||||||
|
|
||||||
#include "llpanelplace.h"
|
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
#include "llhttpclient.h"
|
#include "llhttpclient.h"
|
||||||
#include "llsdserialize.h"
|
#include "llsdserialize.h"
|
||||||
|
//#include "llurlentry.h"
|
||||||
#include "llviewerregion.h"
|
#include "llviewerregion.h"
|
||||||
#include "llview.h"
|
#include "llview.h"
|
||||||
#include "message.h"
|
|
||||||
|
|
||||||
LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle)
|
#include "llagent.h"
|
||||||
{
|
#include "llremoteparcelrequest.h"
|
||||||
mPlacePanelHandle = place_panel_handle;
|
|
||||||
}
|
|
||||||
/*virtual*/
|
LLRemoteParcelRequestResponder::LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle)
|
||||||
|
: mObserverHandle(observer_handle)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//If we get back a normal response, handle it here
|
||||||
|
//virtual
|
||||||
void LLRemoteParcelRequestResponder::result(const LLSD& content)
|
void LLRemoteParcelRequestResponder::result(const LLSD& content)
|
||||||
{
|
{
|
||||||
LLUUID parcel_id = content["parcel_id"];
|
LLUUID parcel_id = content["parcel_id"];
|
||||||
|
|
||||||
LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get();
|
// Panel inspecting the information may be closed and destroyed
|
||||||
|
// before this response is received.
|
||||||
if(place_panelp)
|
LLRemoteParcelInfoObserver* observer = mObserverHandle.get();
|
||||||
|
if (observer)
|
||||||
{
|
{
|
||||||
place_panelp->setParcelID(parcel_id);
|
observer->setParcelID(parcel_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*virtual*/
|
//If we get back an error (not found, etc...), handle it here
|
||||||
|
//virtual
|
||||||
void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason)
|
void LLRemoteParcelRequestResponder::error(U32 status, const std::string& reason)
|
||||||
{
|
{
|
||||||
llinfos << "LLRemoteParcelRequest::error("
|
llinfos << "LLRemoteParcelRequest::error("
|
||||||
<< status << ": " << reason << ")" << llendl;
|
<< status << ": " << reason << ")" << llendl;
|
||||||
LLPanelPlace* place_panelp = (LLPanelPlace*)mPlacePanelHandle.get();
|
|
||||||
|
|
||||||
if(place_panelp)
|
// Panel inspecting the information may be closed and destroyed
|
||||||
|
// before this response is received.
|
||||||
|
LLRemoteParcelInfoObserver* observer = mObserverHandle.get();
|
||||||
|
if (observer)
|
||||||
{
|
{
|
||||||
place_panelp->setErrorStatus(status, reason);
|
observer->setErrorStatus(status, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LLRemoteParcelInfoProcessor::addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer)
|
||||||
|
{
|
||||||
|
observer_multimap_t::iterator it;
|
||||||
|
observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
|
||||||
|
observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
|
||||||
|
|
||||||
|
// Check if the observer is already in observers list for this UUID
|
||||||
|
for(it = start; it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second.get() == observer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mObservers.insert(std::make_pair(parcel_id, observer->getObserverHandle()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLRemoteParcelInfoProcessor::removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer)
|
||||||
|
{
|
||||||
|
if (!observer)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
observer_multimap_t::iterator it;
|
||||||
|
observer_multimap_t::iterator start = mObservers.lower_bound(parcel_id);
|
||||||
|
observer_multimap_t::iterator end = mObservers.upper_bound(parcel_id);
|
||||||
|
|
||||||
|
for(it = start; it != end; ++it)
|
||||||
|
{
|
||||||
|
if (it->second.get() == observer)
|
||||||
|
{
|
||||||
|
mObservers.erase(it);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//static
|
||||||
|
void LLRemoteParcelInfoProcessor::processParcelInfoReply(LLMessageSystem* msg, void**)
|
||||||
|
{
|
||||||
|
LLParcelData parcel_data;
|
||||||
|
|
||||||
|
msg->getUUID ("Data", "ParcelID", parcel_data.parcel_id);
|
||||||
|
msg->getUUID ("Data", "OwnerID", parcel_data.owner_id);
|
||||||
|
msg->getString ("Data", "Name", parcel_data.name);
|
||||||
|
msg->getString ("Data", "Desc", parcel_data.desc);
|
||||||
|
msg->getS32 ("Data", "ActualArea", parcel_data.actual_area);
|
||||||
|
msg->getS32 ("Data", "BillableArea", parcel_data.billable_area);
|
||||||
|
msg->getU8 ("Data", "Flags", parcel_data.flags);
|
||||||
|
msg->getF32 ("Data", "GlobalX", parcel_data.global_x);
|
||||||
|
msg->getF32 ("Data", "GlobalY", parcel_data.global_y);
|
||||||
|
msg->getF32 ("Data", "GlobalZ", parcel_data.global_z);
|
||||||
|
msg->getString ("Data", "SimName", parcel_data.sim_name);
|
||||||
|
msg->getUUID ("Data", "SnapshotID", parcel_data.snapshot_id);
|
||||||
|
msg->getF32 ("Data", "Dwell", parcel_data.dwell);
|
||||||
|
msg->getS32 ("Data", "SalePrice", parcel_data.sale_price);
|
||||||
|
msg->getS32 ("Data", "AuctionID", parcel_data.auction_id);
|
||||||
|
|
||||||
|
LLRemoteParcelInfoProcessor::observer_multimap_t & observers = LLRemoteParcelInfoProcessor::getInstance()->mObservers;
|
||||||
|
|
||||||
|
typedef std::vector<observer_multimap_t::iterator> deadlist_t;
|
||||||
|
deadlist_t dead_iters;
|
||||||
|
|
||||||
|
observer_multimap_t::iterator oi = observers.lower_bound(parcel_data.parcel_id);
|
||||||
|
observer_multimap_t::iterator end = observers.upper_bound(parcel_data.parcel_id);
|
||||||
|
|
||||||
|
while (oi != end)
|
||||||
|
{
|
||||||
|
// increment the loop iterator now since it may become invalid below
|
||||||
|
observer_multimap_t::iterator cur_oi = oi++;
|
||||||
|
|
||||||
|
LLRemoteParcelInfoObserver * observer = cur_oi->second.get();
|
||||||
|
if(observer)
|
||||||
|
{
|
||||||
|
// may invalidate cur_oi if the observer removes itself
|
||||||
|
observer->processParcelInfo(parcel_data);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// the handle points to an expired observer, so don't keep it
|
||||||
|
// around anymore
|
||||||
|
dead_iters.push_back(cur_oi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
deadlist_t::iterator i;
|
||||||
|
deadlist_t::iterator end_dead = dead_iters.end();
|
||||||
|
for(i = dead_iters.begin(); i != end_dead; ++i)
|
||||||
|
{
|
||||||
|
observers.erase(*i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef LL_LLURLENTRY_H
|
||||||
|
LLUrlEntryParcel::LLParcelData url_data;
|
||||||
|
url_data.parcel_id = parcel_data.parcel_id;
|
||||||
|
url_data.name = parcel_data.name;
|
||||||
|
url_data.sim_name = parcel_data.sim_name;
|
||||||
|
url_data.global_x = parcel_data.global_x;
|
||||||
|
url_data.global_y = parcel_data.global_y;
|
||||||
|
url_data.global_z = parcel_data.global_z;
|
||||||
|
|
||||||
|
// Pass the parcel data to LLUrlEntryParcel to render
|
||||||
|
// human readable parcel name.
|
||||||
|
LLUrlEntryParcel::processParcelInfo(url_data);
|
||||||
|
#endif //LL_LLURLENTRY_H
|
||||||
|
}
|
||||||
|
|
||||||
|
void LLRemoteParcelInfoProcessor::sendParcelInfoRequest(const LLUUID& parcel_id)
|
||||||
|
{
|
||||||
|
LLMessageSystem *msg = gMessageSystem;
|
||||||
|
|
||||||
|
msg->newMessage("ParcelInfoRequest");
|
||||||
|
msg->nextBlockFast(_PREHASH_AgentData);
|
||||||
|
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
|
||||||
|
msg->addUUID("SessionID", gAgent.getSessionID());
|
||||||
|
msg->nextBlock("Data");
|
||||||
|
msg->addUUID("ParcelID", parcel_id);
|
||||||
|
gAgent.sendReliableMessage();
|
||||||
|
}
|
||||||
|
|||||||
@@ -38,22 +38,78 @@
|
|||||||
#include "llhttpclient.h"
|
#include "llhttpclient.h"
|
||||||
#include "llpanel.h"
|
#include "llpanel.h"
|
||||||
|
|
||||||
|
class LLRemoteParcelInfoObserver;
|
||||||
|
|
||||||
class AIHTTPTimeoutPolicy;
|
class AIHTTPTimeoutPolicy;
|
||||||
extern AIHTTPTimeoutPolicy remoteParcelRequestResponder_timeout;
|
extern AIHTTPTimeoutPolicy remoteParcelRequestResponder_timeout;
|
||||||
|
|
||||||
class LLRemoteParcelRequestResponder : public LLHTTPClient::ResponderWithResult
|
class LLRemoteParcelRequestResponder : public LLHTTPClient::ResponderWithResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
LLRemoteParcelRequestResponder(LLHandle<LLPanel> place_panel_handle);
|
LLRemoteParcelRequestResponder(LLHandle<LLRemoteParcelInfoObserver> observer_handle);
|
||||||
|
|
||||||
//If we get back a normal response, handle it here
|
//If we get back a normal response, handle it here
|
||||||
/*virtual*/ void result(const LLSD& content);
|
/*virtual*/ void result(const LLSD& content);
|
||||||
|
|
||||||
//If we get back an error (not found, etc...), handle it here
|
//If we get back an error (not found, etc...), handle it here
|
||||||
/*virtual*/ void error(U32 status, const std::string& reason);
|
/*virtual*/ void error(U32 status, const std::string& reason);
|
||||||
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; }
|
/*virtual*/ AIHTTPTimeoutPolicy const& getHTTPTimeoutPolicy(void) const { return remoteParcelRequestResponder_timeout; }
|
||||||
/*virtual*/ char const* getName(void) const { return "LLRemoteParcelRequestResponder"; }
|
/*virtual*/ char const* getName(void) const { return "LLRemoteParcelRequestResponder"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
LLHandle<LLPanel> mPlacePanelHandle;
|
LLHandle<LLRemoteParcelInfoObserver> mObserverHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LLParcelData
|
||||||
|
{
|
||||||
|
LLUUID parcel_id;
|
||||||
|
LLUUID owner_id;
|
||||||
|
std::string name;
|
||||||
|
std::string desc;
|
||||||
|
S32 actual_area;
|
||||||
|
S32 billable_area;
|
||||||
|
U8 flags;
|
||||||
|
F32 global_x;
|
||||||
|
F32 global_y;
|
||||||
|
F32 global_z;
|
||||||
|
std::string sim_name;
|
||||||
|
LLUUID snapshot_id;
|
||||||
|
F32 dwell;
|
||||||
|
S32 sale_price;
|
||||||
|
S32 auction_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
// An interface class for panels which display parcel information
|
||||||
|
// like name, description, area, snapshot etc.
|
||||||
|
class LLRemoteParcelInfoObserver
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LLRemoteParcelInfoObserver() { mObserverHandle.bind(this); }
|
||||||
|
virtual ~LLRemoteParcelInfoObserver() {}
|
||||||
|
virtual void processParcelInfo(const LLParcelData& parcel_data) = 0;
|
||||||
|
virtual void setParcelID(const LLUUID& parcel_id) = 0;
|
||||||
|
virtual void setErrorStatus(U32 status, const std::string& reason) = 0;
|
||||||
|
LLHandle<LLRemoteParcelInfoObserver> getObserverHandle() const { return mObserverHandle; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
LLRootHandle<LLRemoteParcelInfoObserver> mObserverHandle;
|
||||||
|
};
|
||||||
|
|
||||||
|
class LLRemoteParcelInfoProcessor : public LLSingleton<LLRemoteParcelInfoProcessor>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~LLRemoteParcelInfoProcessor() {}
|
||||||
|
|
||||||
|
void addObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
|
||||||
|
void removeObserver(const LLUUID& parcel_id, LLRemoteParcelInfoObserver* observer);
|
||||||
|
|
||||||
|
void sendParcelInfoRequest(const LLUUID& parcel_id);
|
||||||
|
|
||||||
|
static void processParcelInfoReply(LLMessageSystem* msg, void**);
|
||||||
|
|
||||||
|
private:
|
||||||
|
typedef std::multimap<LLUUID, LLHandle<LLRemoteParcelInfoObserver> > observer_multimap_t;
|
||||||
|
observer_multimap_t mObservers;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LL_LLREMOTEPARCELREQUEST_H
|
#endif // LL_LLREMOTEPARCELREQUEST_H
|
||||||
|
|||||||
@@ -62,16 +62,16 @@
|
|||||||
#include "statemachine/aifilepicker.h"
|
#include "statemachine/aifilepicker.h"
|
||||||
|
|
||||||
#include "llares.h"
|
#include "llares.h"
|
||||||
|
#include "llavatarnamecache.h"
|
||||||
|
#include "lllandmark.h"
|
||||||
#include "llcachename.h"
|
#include "llcachename.h"
|
||||||
#include "llviewercontrol.h"
|
|
||||||
#include "lldir.h"
|
#include "lldir.h"
|
||||||
#include "llerrorcontrol.h"
|
#include "llerrorcontrol.h"
|
||||||
#include "llfiltersd2xmlrpc.h"
|
#include "llfiltersd2xmlrpc.h"
|
||||||
#include "llfocusmgr.h"
|
#include "llfocusmgr.h"
|
||||||
#include "llhttpsender.h"
|
#include "llhttpsender.h"
|
||||||
#include "imageids.h"
|
|
||||||
#include "llimageworker.h"
|
#include "llimageworker.h"
|
||||||
#include "lllandmark.h"
|
|
||||||
#include "llloginflags.h"
|
#include "llloginflags.h"
|
||||||
#include "llmd5.h"
|
#include "llmd5.h"
|
||||||
#include "llmemorystream.h"
|
#include "llmemorystream.h"
|
||||||
@@ -87,8 +87,10 @@
|
|||||||
#include "llstring.h"
|
#include "llstring.h"
|
||||||
#include "lluserrelations.h"
|
#include "lluserrelations.h"
|
||||||
#include "sgversion.h"
|
#include "sgversion.h"
|
||||||
|
#include "llviewercontrol.h"
|
||||||
#include "llvfs.h"
|
#include "llvfs.h"
|
||||||
#include "llxorcipher.h" // saved password, MAC address
|
#include "llxorcipher.h" // saved password, MAC address
|
||||||
|
#include "imageids.h"
|
||||||
#include "message.h"
|
#include "message.h"
|
||||||
#include "v3math.h"
|
#include "v3math.h"
|
||||||
|
|
||||||
@@ -144,23 +146,24 @@
|
|||||||
#include "llpanelevent.h"
|
#include "llpanelevent.h"
|
||||||
#include "llpanelclassified.h"
|
#include "llpanelclassified.h"
|
||||||
#include "llpanelpick.h"
|
#include "llpanelpick.h"
|
||||||
#include "llpanelplace.h"
|
|
||||||
#include "llpanelgrouplandmoney.h"
|
#include "llpanelgrouplandmoney.h"
|
||||||
#include "llpanelgroupnotices.h"
|
#include "llpanelgroupnotices.h"
|
||||||
#include "llpreview.h"
|
#include "llpreview.h"
|
||||||
#include "llpreviewscript.h"
|
#include "llpreviewscript.h"
|
||||||
|
#include "llproxy.h"
|
||||||
#include "llproductinforequest.h"
|
#include "llproductinforequest.h"
|
||||||
|
#include "llremoteparcelrequest.h"
|
||||||
#include "llsecondlifeurls.h"
|
#include "llsecondlifeurls.h"
|
||||||
#include "llselectmgr.h"
|
#include "llselectmgr.h"
|
||||||
#include "llsky.h"
|
#include "llsky.h"
|
||||||
#include "llsrv.h"
|
#include "llsrv.h"
|
||||||
#include "llstatview.h"
|
#include "llstatview.h"
|
||||||
#include "lltrans.h"
|
|
||||||
#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
|
#include "llstatusbar.h" // sendMoneyBalanceRequest(), owns L$ balance
|
||||||
#include "llsurface.h"
|
#include "llsurface.h"
|
||||||
#include "lltexturecache.h"
|
#include "lltexturecache.h"
|
||||||
#include "lltexturefetch.h"
|
#include "lltexturefetch.h"
|
||||||
#include "lltoolmgr.h"
|
#include "lltoolmgr.h"
|
||||||
|
#include "lltrans.h"
|
||||||
#include "llui.h"
|
#include "llui.h"
|
||||||
#include "llurldispatcher.h"
|
#include "llurldispatcher.h"
|
||||||
#include "llurlsimstring.h"
|
#include "llurlsimstring.h"
|
||||||
@@ -205,7 +208,6 @@
|
|||||||
#include "llwlparammanager.h"
|
#include "llwlparammanager.h"
|
||||||
#include "llwaterparammanager.h"
|
#include "llwaterparammanager.h"
|
||||||
#include "llagentlanguage.h"
|
#include "llagentlanguage.h"
|
||||||
#include "llproxy.h"
|
|
||||||
#include "llwearable.h"
|
#include "llwearable.h"
|
||||||
#include "llinventorybridge.h"
|
#include "llinventorybridge.h"
|
||||||
#include "llappearancemgr.h"
|
#include "llappearancemgr.h"
|
||||||
@@ -225,7 +227,6 @@
|
|||||||
|
|
||||||
#include "llpathfindingmanager.h"
|
#include "llpathfindingmanager.h"
|
||||||
|
|
||||||
#include "llavatarnamecache.h"
|
|
||||||
#include "lgghunspell_wrapper.h"
|
#include "lgghunspell_wrapper.h"
|
||||||
|
|
||||||
// [RLVa:KB]
|
// [RLVa:KB]
|
||||||
@@ -457,8 +458,8 @@ bool idle_startup()
|
|||||||
// is using SOCKS for HTTP so we get the login
|
// is using SOCKS for HTTP so we get the login
|
||||||
// screen and HTTP tables via SOCKS.
|
// screen and HTTP tables via SOCKS.
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
LLStartUp::startLLProxy();
|
LLStartUp::startLLProxy();
|
||||||
|
|
||||||
gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
|
gSavedSettings.setS32("LastFeatureVersion", LLFeatureManager::getInstance()->getVersion());
|
||||||
|
|
||||||
std::string xml_file = LLUI::locateSkin("xui_version.xml");
|
std::string xml_file = LLUI::locateSkin("xui_version.xml");
|
||||||
@@ -518,7 +519,7 @@ bool idle_startup()
|
|||||||
|
|
||||||
#if LL_WINDOWS
|
#if LL_WINDOWS
|
||||||
// On the windows dev builds, unpackaged, the message_template.msg
|
// On the windows dev builds, unpackaged, the message_template.msg
|
||||||
// file will be located in
|
// file will be located in:
|
||||||
// indra/build-vc**/newview/<config>/app_settings.
|
// indra/build-vc**/newview/<config>/app_settings.
|
||||||
if (!found_template)
|
if (!found_template)
|
||||||
{
|
{
|
||||||
@@ -934,7 +935,6 @@ bool idle_startup()
|
|||||||
|
|
||||||
if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
|
if (STATE_LOGIN_CLEANUP == LLStartUp::getStartupState())
|
||||||
{
|
{
|
||||||
|
|
||||||
// Post login screen, we should see if any settings have changed that may
|
// Post login screen, we should see if any settings have changed that may
|
||||||
// require us to either start/stop or change the socks proxy. As various communications
|
// require us to either start/stop or change the socks proxy. As various communications
|
||||||
// past this point may require the proxy to be up.
|
// past this point may require the proxy to be up.
|
||||||
@@ -3391,9 +3391,9 @@ void register_viewer_callbacks(LLMessageSystem* msg)
|
|||||||
|
|
||||||
msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
|
msg->setHandlerFunc("EventInfoReply", LLPanelEvent::processEventInfoReply);
|
||||||
msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
|
msg->setHandlerFunc("PickInfoReply", &LLAvatarPropertiesProcessor::processPickInfoReply);
|
||||||
//msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply);
|
// msg->setHandlerFunc("ClassifiedInfoReply", LLPanelClassified::processClassifiedInfoReply);
|
||||||
msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
|
msg->setHandlerFunc("ClassifiedInfoReply", LLAvatarPropertiesProcessor::processClassifiedInfoReply);
|
||||||
msg->setHandlerFunc("ParcelInfoReply", LLPanelPlace::processParcelInfoReply);
|
msg->setHandlerFunc("ParcelInfoReply", LLRemoteParcelInfoProcessor::processParcelInfoReply);
|
||||||
msg->setHandlerFunc("ScriptDialog", process_script_dialog);
|
msg->setHandlerFunc("ScriptDialog", process_script_dialog);
|
||||||
msg->setHandlerFunc("LoadURL", process_load_url);
|
msg->setHandlerFunc("LoadURL", process_load_url);
|
||||||
msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
|
msg->setHandlerFunc("ScriptTeleportRequest", process_script_teleport_request);
|
||||||
|
|||||||
Reference in New Issue
Block a user