Changed estate experience editing to use sendEstateOwnerMessage

meow-7.2.2
dolphin 2014-04-04 16:30:04 -07:00
parent 572af460ec
commit a8a0506b35
7 changed files with 158 additions and 65 deletions

View File

@ -146,19 +146,20 @@ const U32 ESTATE_ACCESS_ALL = ESTATE_ACCESS_ALLOWED_AGENTS
| ESTATE_ACCESS_BANNED_AGENTS
| ESTATE_ACCESS_MANAGERS;
// for EstateOwnerRequest, estateaccessdelta message
const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1 << 0;
const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1 << 1;
// for EstateOwnerRequest, estateaccessdelta, estateexperiencedelta messages
const U32 ESTATE_ACCESS_APPLY_TO_ALL_ESTATES = 1U << 0;
const U32 ESTATE_ACCESS_APPLY_TO_MANAGED_ESTATES = 1U << 1;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1 << 2;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1 << 3;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1 << 4;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1 << 5;
const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1 << 6;
const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1 << 7;
const U32 ESTATE_ACCESS_MANAGER_ADD = 1 << 8;
const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1 << 9;
const U32 ESTATE_ACCESS_NO_REPLY = 1 << 10;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_ADD = 1U << 2;
const U32 ESTATE_ACCESS_ALLOWED_AGENT_REMOVE = 1U << 3;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_ADD = 1U << 4;
const U32 ESTATE_ACCESS_ALLOWED_GROUP_REMOVE = 1U << 5;
const U32 ESTATE_ACCESS_BANNED_AGENT_ADD = 1U << 6;
const U32 ESTATE_ACCESS_BANNED_AGENT_REMOVE = 1U << 7;
const U32 ESTATE_ACCESS_MANAGER_ADD = 1U << 8;
const U32 ESTATE_ACCESS_MANAGER_REMOVE = 1U << 9;
const U32 ESTATE_ACCESS_NO_REPLY = 1U << 10;
const U32 ESTATE_ACCESS_FAILED_BAN_ESTATE_MANAGER = 1U << 11;
const S32 ESTATE_MAX_MANAGERS = 10;
const S32 ESTATE_MAX_ACCESS_IDS = 500; // max for access, banned
@ -169,6 +170,26 @@ const U32 SWD_OTHERS_LAND_ONLY = (1 << 0);
const U32 SWD_ALWAYS_RETURN_OBJECTS = (1 << 1);
const U32 SWD_SCRIPTED_ONLY = (1 << 2);
// Controls experience key validity in the estate
const U32 EXPERIENCE_KEY_TYPE_NONE = 0;
const U32 EXPERIENCE_KEY_TYPE_BLOCKED = 1;
const U32 EXPERIENCE_KEY_TYPE_ALLOWED = 2;
const U32 EXPERIENCE_KEY_TYPE_TRUSTED = 3;
const U32 EXPERIENCE_KEY_TYPE_FIRST = EXPERIENCE_KEY_TYPE_BLOCKED;
const U32 EXPERIENCE_KEY_TYPE_LAST = EXPERIENCE_KEY_TYPE_TRUSTED;
//
const U32 ESTATE_EXPERIENCE_TRUSTED_ADD = 1U << 2;
const U32 ESTATE_EXPERIENCE_TRUSTED_REMOVE = 1U << 3;
const U32 ESTATE_EXPERIENCE_ALLOWED_ADD = 1U << 4;
const U32 ESTATE_EXPERIENCE_ALLOWED_REMOVE = 1U << 5;
const U32 ESTATE_EXPERIENCE_BLOCKED_ADD = 1U << 6;
const U32 ESTATE_EXPERIENCE_BLOCKED_REMOVE = 1U << 7;
const S32 ESTATE_MAX_EXPERIENCE_IDS = 8;
#endif

View File

@ -131,6 +131,18 @@ public:
const sparam_t& strings);
};
class LLDispatchSetEstateExperience : public LLDispatchHandler
{
public:
virtual bool operator()(
const LLDispatcher* dispatcher,
const std::string& key,
const LLUUID& invoice,
const sparam_t& strings);
LLSD getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count );
};
/*
void unpack_request_params(
@ -457,6 +469,16 @@ LLPanelRegionTerrainInfo* LLFloaterRegionInfo::getPanelRegionTerrain()
return panel;
}
LLPanelRegionExperiences* LLFloaterRegionInfo::getPanelExperiences()
{
LLFloaterRegionInfo* floater = LLFloaterReg::getTypedInstance<LLFloaterRegionInfo>("region_info");
if (!floater) return NULL;
LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
return (LLPanelRegionExperiences*)tab->getChild<LLPanel>("Experiences");
}
void LLFloaterRegionInfo::onTabSelected(const LLSD& param)
{
LLPanel* active_panel = getChild<LLPanel>(param.asString());
@ -1376,6 +1398,11 @@ void LLPanelEstateInfo::initDispatch(LLDispatcher& dispatch)
static LLDispatchSetEstateAccess set_access;
dispatch.addHandler(name, &set_access);
name.assign("setexperiences");
static LLDispatchSetEstateExperience set_experience;
dispatch.addHandler(name, &set_experience);
estate_dispatch_initialized = true;
}
@ -2886,6 +2913,56 @@ bool LLDispatchSetEstateAccess::operator()(
return true;
}
LLSD LLDispatchSetEstateExperience::getIDs( sparam_t::const_iterator it, sparam_t::const_iterator end, S32 count )
{
LLSD idList = LLSD::emptyArray();
LLUUID id;
while(count--> 0)
{
memcpy(id.mData, (*(++it)).data(), UUID_BYTES);
idList.append(id);
}
return idList;
}
// key = "setexperience"
// strings[0] = str(estate_id)
// strings[1] = str(send_to_agent_only)
// strings[2] = str(num blocked)
// strings[3] = str(num trusted)
// strings[4] = str(num allowed)
// strings[8] = bin(uuid) ...
// ...
bool LLDispatchSetEstateExperience::operator()(
const LLDispatcher* dispatcher,
const std::string& key,
const LLUUID& invoice,
const sparam_t& strings)
{
LLPanelRegionExperiences* panel = LLFloaterRegionInfo::getPanelExperiences();
if (!panel) return true;
sparam_t::const_iterator it = strings.begin();
++it; // U32 estate_id = strtol((*it).c_str(), NULL, 10);
++it; // U32 send_to_agent_only = strtoul((*(++it)).c_str(), NULL, 10);
LLUUID id;
S32 num_blocked = strtol((*(++it)).c_str(), NULL, 10);
S32 num_trusted = strtol((*(++it)).c_str(), NULL, 10);
S32 num_allowed = strtol((*(++it)).c_str(), NULL, 10);
LLSD ids = LLSD::emptyMap()
.with("blocked", getIDs(it, strings.end(), num_blocked))
.with("trusted", getIDs(it, strings.end(), num_trusted))
.with("allowed", getIDs(it, strings.end(), num_allowed));
panel->processResponse(ids);
return true;
}
LLPanelEnvironmentInfo::LLPanelEnvironmentInfo()
: mEnableEditing(false),
mRegionSettingsRadioGroup(NULL),
@ -3483,6 +3560,14 @@ BOOL LLPanelRegionExperiences::postBuild()
mAllowed = setupList("panel_allowed");
mTrusted = setupList("panel_trusted");
mBlocked = setupList("panel_blocked");
mAllowed->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_ALLOWED_ADD, _1));
mAllowed->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_ALLOWED_REMOVE, _1));
mBlocked->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_BLOCKED_ADD, _1));
mBlocked->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_BLOCKED_REMOVE, _1));
mTrusted->setAddedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_TRUSTED_ADD, _1));
mTrusted->setRemovedCallback( boost::bind(&LLPanelRegionExperiences::itemChanged, this, ESTATE_EXPERIENCE_TRUSTED_REMOVE, _1));
return LLPanelRegionInfo::postBuild();
}
@ -3498,27 +3583,11 @@ LLPanelExperienceListEditor* LLPanelRegionExperiences::setupList( const char* co
}
boost::signals2::connection LLPanelRegionExperiences::processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& conn, const LLSD& content )
{
if(conn.connected())
{
conn.disconnect();
}
panel->setExperienceIds(content);
return panel->setChangedCallback(boost::bind(&LLPanelRegionExperiences::listChanged, this));
}
void LLPanelRegionExperiences::processResponse( const LLSD& content )
{
mAllowedConnection=processResponse(mAllowed, mAllowedConnection, content["allowed"]);
mBlockedConnection=processResponse(mBlocked, mBlockedConnection, content["blocked"]);
mTrustedConnection=processResponse(mTrusted, mTrustedConnection, content["trusted"]);
disableButton("apply_btn");
mAllowed->setExperienceIds(content["allowed"]);
mBlocked->setExperienceIds(content["blocked"]);
mTrusted->setExperienceIds(content["trusted"]);
}
@ -3629,7 +3698,14 @@ BOOL LLPanelRegionExperiences::sendUpdate()
return TRUE;
}
void LLPanelRegionExperiences::listChanged()
void LLPanelRegionExperiences::itemChanged( U32 event_type, const LLUUID& id )
{
strings_t str(3, std::string());
gAgent.getID().toString(str[0]);
str[1].swap(llformat("%u", event_type));
id.toString(str[2]);
why does this happen twice
sendEstateOwnerMessage(gMessageSystem, "estateexperiencedelta", LLFloaterRegionInfo::getLastInvoice(), str);
onChangeAnything();
}

View File

@ -62,6 +62,7 @@ class LLPanelEstateInfo;
class LLPanelEstateCovenant;
class LLPanelExperienceListEditor;
class LLPanelExperiences;
class LLPanelRegionExperiences;
class LLEventTimer;
class LLEnvironmentSettings;
@ -92,6 +93,7 @@ public:
static LLPanelEstateInfo* getPanelEstate();
static LLPanelEstateCovenant* getPanelCovenant();
static LLPanelRegionTerrainInfo* getPanelRegionTerrain();
static LLPanelRegionExperiences* getPanelExperiences();
// from LLPanel
virtual void refresh();
@ -462,25 +464,21 @@ public:
virtual BOOL sendUpdate();
static void infoCallback(LLHandle<LLPanelRegionExperiences> handle, const LLSD& content);
void listChanged();
bool refreshFromRegion(LLViewerRegion* region);
void sendPurchaseRequest()const;
private:
void processResponse( const LLSD& content );
boost::signals2::connection processResponse( LLPanelExperienceListEditor* panel, boost::signals2::connection& connection, const LLSD& content);
private:
void refreshRegionExperiences();
LLPanelExperienceListEditor* setupList(const char* control_name);
static LLSD addIds( LLPanelExperienceListEditor* panel );
bool FilterExisting(const LLSD& experience );
void itemChanged(U32 event_type, const LLUUID& id);
LLPanelExperienceListEditor* mTrusted;
boost::signals2::connection mTrustedConnection;
LLPanelExperienceListEditor* mAllowed;
boost::signals2::connection mAllowedConnection;
LLPanelExperienceListEditor* mBlocked;
boost::signals2::connection mBlockedConnection;
};
#endif

View File

@ -45,7 +45,6 @@ LLPanelExperienceListEditor::LLPanelExperienceListEditor()
:mItems(NULL)
,mProfile(NULL)
,mRemove(NULL)
,mChangedCallback(NULL)
,mReadonly(false)
{
}
@ -76,6 +75,13 @@ void LLPanelExperienceListEditor::addExperienceIds( const uuid_vec_t& experience
{
mExperienceIds.insert(experience_ids.begin(), experience_ids.end());
onItems();
if(!mAddedCallback.empty())
{
for(uuid_vec_t::const_iterator it = experience_ids.begin(); it != experience_ids.end(); ++it)
{
mAddedCallback(*it);
}
}
}
@ -118,6 +124,7 @@ void LLPanelExperienceListEditor::onRemove()
if((*it) != NULL)
{
mExperienceIds.erase((*it)->getValue());
mRemovedCallback((*it)->getValue());
}
}
onItems();
@ -167,10 +174,6 @@ void LLPanelExperienceListEditor::onItems()
checkButtonsEnabled();
if(mChangedCallback)
{
(*mChangedCallback)();
}
}
void LLPanelExperienceListEditor::experienceDetailsCallback( LLHandle<LLPanelExperienceListEditor> panel, const LLSD& experience )
@ -196,7 +199,6 @@ LLPanelExperienceListEditor::~LLPanelExperienceListEditor()
{
mPicker.get()->closeFloater();
}
delete mChangedCallback;
}
void LLPanelExperienceListEditor::loading()
@ -211,3 +213,13 @@ void LLPanelExperienceListEditor::setReadonly( bool val )
setCtrlsEnabled(!mReadonly);
checkButtonsEnabled();
}
boost::signals2::connection LLPanelExperienceListEditor::setAddedCallback( list_changed_signal_t::slot_type cb )
{
return mAddedCallback.connect(cb);
}
boost::signals2::connection LLPanelExperienceListEditor::setRemovedCallback( list_changed_signal_t::slot_type cb )
{
return mRemovedCallback.connect(cb);
}

View File

@ -39,7 +39,7 @@ class LLPanelExperienceListEditor : public LLPanel
{
public:
typedef boost::signals2::signal<void () > list_changed_signal_t;
typedef boost::signals2::signal<void (const LLUUID&) > list_changed_signal_t;
// filter function for experiences, return true if the experience should be hidden.
typedef boost::function<bool (const LLSD&)> filter_function;
typedef std::vector<filter_function> filter_list;
@ -55,12 +55,9 @@ public:
void addExperienceIds(const uuid_vec_t& experience_ids);
void addExperience(const LLUUID& id);
boost::signals2::connection setChangedCallback(list_changed_signal_t::slot_type cb )
{
if (!mChangedCallback) mChangedCallback = new list_changed_signal_t();
return mChangedCallback->connect(cb);
}
boost::signals2::connection setAddedCallback(list_changed_signal_t::slot_type cb );
boost::signals2::connection setRemovedCallback(list_changed_signal_t::slot_type cb );
bool getReadonly() const { return mReadonly; }
void setReadonly(bool val);
@ -87,7 +84,8 @@ private:
LLButton* mRemove;
LLButton* mProfile;
PickerHandle mPicker;
list_changed_signal_t* mChangedCallback;
list_changed_signal_t mAddedCallback;
list_changed_signal_t mRemovedCallback;
LLUUID mKey;
bool mReadonly;

View File

@ -111,7 +111,7 @@
left="7"
name="experience_description"
top="0"
value="It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. It is mainly just a lot of men in tights on patrol for evil-doers. "
value=""
width="293"/>
</layout_panel>
<layout_panel

View File

@ -63,17 +63,5 @@
class="panel_experience_list_editor"
filename="panel_experience_list_editor.xml"/>
</layout_panel>
<layout_panel
height="30"
min_height="30"
max_height="30"
width="530">
<button
layout="topleft"
width="85"
left="3"
label="Apply"
name="apply_btn"/>
</layout_panel>
</layout_stack>
</panel>