From 89d938efe371645756240da72f4c359c36985060 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Wed, 13 Feb 2008 19:06:55 +0000 Subject: merge elar-merge-3 -r 79884 : 79923 -> release --- indra/llmessage/llhttpnode.h | 2 +- indra/newview/llfloaterregioninfo.cpp | 124 ++++++++++++++++++++++++++++++++-- indra/newview/llfloaterregioninfo.h | 10 ++- indra/newview/llviewerregion.cpp | 1 + 4 files changed, 129 insertions(+), 8 deletions(-) diff --git a/indra/llmessage/llhttpnode.h b/indra/llmessage/llhttpnode.h index a283a26acb..2f177bf0ef 100644 --- a/indra/llmessage/llhttpnode.h +++ b/indra/llmessage/llhttpnode.h @@ -176,7 +176,7 @@ public: /* @name Description system The Description object contains information about a service. - All subclasses of LLHTTPNode should override description() and use + All subclasses of LLHTTPNode should override describe() and use the methods of the Description class to set the various properties. */ //@{ diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index ca0314cce1..c3ded7de4f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -229,6 +229,7 @@ void LLFloaterRegionInfo::onOpen() LLFloater::onOpen(); } +// static void LLFloaterRegionInfo::requestRegionInfo() { // Must allow anyone to request the RegionInfo data @@ -359,6 +360,8 @@ void LLFloaterRegionInfo::processRegionInfo(LLMessageSystem* msg) panel->childSetEnabled("fixed_sun_check", allow_modify && !use_estate_sun); panel->childSetValue("sun_hour_slider", LLSD(sun_hour)); panel->childSetEnabled("sun_hour_slider", allow_modify && !use_estate_sun); + + sInstance->refreshFromRegion( gAgent.getRegion() ); } // static @@ -450,6 +453,15 @@ void LLPanelRegionInfo::onChangeAnything(LLUICtrl* ctrl, void* user_data) } } +// static +// Enables set button on change to line editor +void LLPanelRegionInfo::onChangeText(LLLineEditor* caller, void* user_data) +{ + // reuse the previous method + onChangeAnything(0, user_data); +} + + // virtual BOOL LLPanelRegionInfo::postBuild() { @@ -519,6 +531,12 @@ void LLPanelRegionInfo::initCtrl(const char* name) childSetCommitCallback(name, onChangeAnything, this); } +void LLPanelRegionInfo::initTextCtrl(const char* name) +{ + childSetCommitCallback(name, onChangeAnything, this); + childSetKeystrokeCallback("abuse_email_address", onChangeText, this); +} + void LLPanelRegionInfo::initHelpBtn(const char* name, const char* xml_alert) { childSetAction(name, onClickHelp, (void*)xml_alert); @@ -1920,6 +1938,7 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region) childSetEnabled("remove_banned_avatar_btn", god || owner || manager); childSetEnabled("message_estate_btn", god || owner || manager); childSetEnabled("kick_user_from_estate_btn", god || owner || manager); + childSetEnabled("abuse_email_address", god || owner || manager); // estate managers can't add estate managers childSetEnabled("add_estate_manager_btn", god || owner); @@ -1980,6 +1999,7 @@ BOOL LLPanelEstateInfo::postBuild() initCtrl("limit_payment"); initCtrl("limit_age_verified"); initCtrl("voice_chat_check"); + initTextCtrl("abuse_email_address"); initHelpBtn("estate_manager_help", "HelpEstateEstateManager"); initHelpBtn("use_global_time_help", "HelpEstateUseGlobalTime"); @@ -1989,7 +2009,8 @@ BOOL LLPanelEstateInfo::postBuild() initHelpBtn("allow_resident_help", "HelpEstateAllowResident"); initHelpBtn("allow_group_help", "HelpEstateAllowGroup"); initHelpBtn("ban_resident_help", "HelpEstateBanResident"); - initHelpBtn("voice_chat_help", "HelpEstateVoiceChat"); + initHelpBtn("abuse_email_address_help", "HelpEstateAbuseEmailAddress"); + initHelpBtn("voice_chat_help", "HelpEstateVoiceChat"); // set up the use global time checkbox childSetCommitCallback("use_global_time_check", onChangeUseGlobalTime, this); @@ -2086,8 +2107,19 @@ void LLPanelEstateInfo::callbackChangeLindenEstate(S32 option, void* data) { case 0: // send the update - LLFloaterRegionInfo::nextInvoice(); - self->commitEstateInfo(); + if (!self->commitEstateInfoCaps()) + { + // the caps method failed, try the old way + LLFloaterRegionInfo::nextInvoice(); + self->commitEstateInfoDataserver(); + } + // we don't want to do this because we'll get it automatically from the sim + // after the spaceserver processes it +// else +// { +// // caps method does not automatically send this info +// LLFloaterRegionInfo::requestRegionInfo(); +// } break; case 1: default: @@ -2125,12 +2157,75 @@ void LLPanelEstateInfo::getEstateOwner() } */ +class LLEstateChangeInfoResponder : public LLHTTPClient::Responder +{ +public: + LLEstateChangeInfoResponder(void* userdata) : mpPanel((LLPanelEstateInfo*)userdata) {}; + + // if we get a normal response, handle it here + virtual void result(const LLSD& content) + { + // refresh the panel from the database + mpPanel->refresh(); + } + + // if we get an error response + virtual void error(U32 status, const std::string& reason) + { + llinfos << "LLEstateChangeInfoResponder::error " + << status << ": " << reason << llendl; + } +private: + LLPanelEstateInfo* mpPanel; +}; + +// tries to send estate info using a cap; returns true if it succeeded +bool LLPanelEstateInfo::commitEstateInfoCaps() +{ + std::string url = gAgent.getRegion()->getCapability("EstateChangeInfo"); + + if (url.empty()) + { + // whoops, couldn't find the cap, so bail out + return false; + } + + LLSD body; + body["estate_name"] = getEstateName(); + + body["is_externally_visible"] = childGetValue("externally_visible_check").asBoolean(); + body["allow_direct_teleport"] = childGetValue("allow_direct_teleport").asBoolean(); + body["is_sun_fixed" ] = childGetValue("fixed_sun_check").asBoolean(); + body["deny_anonymous" ] = childGetValue("limit_payment").asBoolean(); + body["deny_age_unverified" ] = childGetValue("limit_age_verified").asBoolean(); + body["allow_voice_chat" ] = childGetValue("voice_chat_check").asBoolean(); + body["invoice" ] = LLFloaterRegionInfo::getLastInvoice(); + + // block fly is in estate database but not in estate UI, so we're not supporting it + //body["block_fly" ] = childGetValue("").asBoolean(); + + F32 sun_hour = getSunHour(); + if (childGetValue("use_global_time_check").asBoolean()) + { + sun_hour = 0.f; // 0 = global time + } + body["sun_hour"] = sun_hour; + + body["owner_abuse_email"] = childGetValue("abuse_email_address").asString(); + + // we use a responder so that we can re-get the data after committing to the database + LLHTTPClient::post(url, body, new LLEstateChangeInfoResponder((void*)this)); + return true; +} + +/* 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 LLPanelEstateInfo::commitEstateInfo() +void LLPanelEstateInfo::commitEstateInfoDataserver() { LLMessageSystem* msg = gMessageSystem; msg->newMessage("EstateOwnerMessage"); @@ -2174,7 +2269,6 @@ void LLPanelEstateInfo::setEstateFlags(U32 flags) childSetValue("allow_direct_teleport", LLSD(flags & REGION_FLAGS_ALLOW_DIRECT_TELEPORT ? TRUE : FALSE) ); childSetValue("limit_payment", LLSD(flags & REGION_FLAGS_DENY_ANONYMOUS ? TRUE : FALSE) ); childSetValue("limit_age_verified", LLSD(flags & REGION_FLAGS_DENY_AGEUNVERIFIED ? TRUE : FALSE) ); - childSetVisible("abuse_email_text", flags & REGION_FLAGS_ABUSE_EMAIL_TO_ESTATE_OWNER); refresh(); } @@ -2277,6 +2371,16 @@ void LLPanelEstateInfo::setOwnerName(const std::string& name) childSetValue("estate_owner", LLSD(name)); } +const std::string LLPanelEstateInfo::getAbuseEmailAddress() const +{ + return childGetValue("abuse_email_address").asString(); +} + +void LLPanelEstateInfo::setAbuseEmailAddress(const std::string& address) +{ + childSetValue("abuse_email_address", LLSD(address)); +} + void LLPanelEstateInfo::setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban) @@ -2821,6 +2925,7 @@ bool LLDispatchSetEstateOwner::operator()( // strings[6] = str(covenant_id) // strings[7] = str(covenant_timestamp) // strings[8] = str(send_to_agent_only) +// strings[9] = str(abuse_email_addr) bool LLDispatchEstateUpdateInfo::operator()( const LLDispatcher* dispatcher, const std::string& key, @@ -2836,6 +2941,15 @@ bool LLDispatchEstateUpdateInfo::operator()( std::string estate_name = strings[0].c_str(); panel->setEstateName(estate_name); + if (strings.size() > 9) + { + std::string abuse_email = strings[9].c_str(); + panel->setAbuseEmailAddress(abuse_email); + } + else + { + panel->setAbuseEmailAddress("@ Old Server @"); + } LLViewerRegion* regionp = gAgent.getRegion(); diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h index 6f9ed1fc34..96cf8af667 100644 --- a/indra/newview/llfloaterregioninfo.h +++ b/indra/newview/llfloaterregioninfo.h @@ -83,7 +83,7 @@ public: // from LLPanel virtual void refresh(); - void requestRegionInfo(); + static void requestRegionInfo(); protected: LLFloaterRegionInfo(const LLSD& seed); @@ -106,6 +106,7 @@ public: static void onBtnSet(void* user_data); static void onChangeChildCtrl(LLUICtrl* ctrl, void* user_data); static void onChangeAnything(LLUICtrl* ctrl, void* user_data); + static void onChangeText(LLLineEditor* caller, void* user_data); virtual bool refreshFromRegion(LLViewerRegion* region); virtual bool estateUpdate(LLMessageSystem* msg) { return true; } @@ -118,6 +119,7 @@ public: protected: void initCtrl(const char* name); + void initTextCtrl(const char* name); void initHelpBtn(const char* name, const char* xml_alert); // Callback for all help buttons, data is name of XML alert to show. @@ -320,6 +322,9 @@ public: const std::string getOwnerName() const; void setOwnerName(const std::string& name); + const std::string getAbuseEmailAddress() const; + void setAbuseEmailAddress(const std::string& address); + // If visible from mainland, allowed agent and allowed groups // are ignored, so must disable UI. void setAccessAllowedEnabled(bool enable_agent, bool enable_group, bool enable_ban); @@ -338,7 +343,8 @@ protected: // confirmation dialog callback static void callbackChangeLindenEstate(S32 opt, void* data); - void commitEstateInfo(); + void commitEstateInfoDataserver(); + bool commitEstateInfoCaps(); void commitEstateAccess(); void commitEstateManagers(); diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 46f9c46a31..2a7d2c1367 100644 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -1353,6 +1353,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url) capabilityNames.append("ChatSessionRequest"); capabilityNames.append("CopyInventoryFromNotecard"); capabilityNames.append("DispatchRegionInfo"); + capabilityNames.append("EstateChangeInfo"); capabilityNames.append("EventQueueGet"); capabilityNames.append("GroupProposalBallot"); capabilityNames.append("MapLayer"); -- cgit v1.2.3