summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2018-05-16 19:07:41 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2018-05-16 19:07:41 +0300
commit30df194a0a621aff57998a1cd7379e2a7f279acd (patch)
tree31007e3788293c9e5eca1f2edb454d2f3ff5fa81
parentbbb560bf8d99cc61f2f19f654322384458f82516 (diff)
MAINT-8592 EstateAccess capability support #2
-rw-r--r--indra/newview/llfloaterregioninfo.cpp78
-rw-r--r--indra/newview/llfloaterregioninfo.h10
2 files changed, 31 insertions, 57 deletions
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index 34f1be4e15..c6271209a8 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -263,6 +263,12 @@ void LLFloaterRegionInfo::onOpen(const LLSD& key)
refreshFromRegion(gAgent.getRegion());
requestRegionInfo();
requestMeshRezInfo();
+
+ LLPanelEstateAccess* panel_access = LLFloaterRegionInfo::getPanelAccess();
+ if (panel_access)
+ {
+ panel_access->updateLists();
+ }
}
// static
@@ -285,14 +291,6 @@ void LLFloaterRegionInfo::requestRegionInfo()
msg->addUUID("AgentID", gAgent.getID());
msg->addUUID("SessionID", gAgent.getSessionID());
gAgent.sendReliableMessage();
-
-
- bool cr = gAgent.getRegion()->capabilitiesReceived();
- std::string cap_url = gAgent.getRegionCapability("EstateAccess");
- if (!cap_url.empty() && cr)
- {
- LLCoros::instance().launch("LLFloaterRegionInfo::requestEstateGetAccessCoro", boost::bind(LLFloaterRegionInfo::requestEstateGetAccessCoro, cap_url, this->getHandle()));
- }
}
// static
@@ -310,8 +308,7 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
LLPanelEstateInfo::initDispatch(dispatch);
}
- LLTabContainer* tab = floater->getChild<LLTabContainer>("region_panels");
- LLPanelEstateInfo* panel = (LLPanelEstateInfo*)tab->getChild<LLPanel>("Estate");
+ LLPanelEstateInfo* panel = LLFloaterRegionInfo::getPanelEstate();
// unpack the message
std::string request;
@@ -327,7 +324,10 @@ void LLFloaterRegionInfo::processEstateOwnerRequest(LLMessageSystem* msg,void**)
//dispatch the message
dispatch.dispatch(request, invoice, strings);
- panel->updateControls(gAgent.getRegion());
+ if (panel)
+ {
+ panel->updateControls(gAgent.getRegion());
+ }
}
@@ -1707,10 +1707,6 @@ void LLPanelEstateInfo::updateControls(LLViewerRegion* region)
getChildView("message_estate_btn")->setEnabled(god || owner || manager);
getChildView("kick_user_from_estate_btn")->setEnabled(god || owner || manager);
- LLPanelEstateAccess* access_panel = LLFloaterRegionInfo::getPanelAccess(); // TODO: remove this call from here
- if (access_panel)
- access_panel->updateControls(region);
-
refresh();
}
@@ -1732,10 +1728,6 @@ bool LLPanelEstateInfo::refreshFromRegion(LLViewerRegion* region)
//integers.push_back(LLFloaterRegionInfo::());::getPanelEstate();
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
- panel->clearAccessLists();
-
-
sendEstateOwnerMessage(gMessageSystem, "getinfo", invoice, strings);
refresh();
@@ -3859,33 +3851,14 @@ void LLPanelEstateAccess::sendEstateAccessDelta(U32 flags, const LLUUID& agent_o
msg->nextBlock("ParamList");
msg->addString("Parameter", buf);
-
- LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
-
- if (flags & (ESTATE_ACCESS_ALLOWED_AGENT_ADD | ESTATE_ACCESS_ALLOWED_AGENT_REMOVE |
- ESTATE_ACCESS_BANNED_AGENT_ADD | ESTATE_ACCESS_BANNED_AGENT_REMOVE))
- {
-
- panel->clearAccessLists();
- }
-
gAgent.sendReliableMessage();
-}
-void LLPanelEstateAccess::clearAccessLists()
-{
- LLNameListCtrl* name_list = getChild<LLNameListCtrl>("allowed_avatar_name_list");
- if (name_list)
- {
- name_list->deleteAllItems();
- }
- name_list = getChild<LLNameListCtrl>("banned_avatar_name_list");
- if (name_list)
+ LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
+ if (panel)
{
- name_list->deleteAllItems();
+ panel->updateLists();
}
- updateControls(gAgent.getRegion());
}
void LLPanelEstateAccess::updateChild(LLUICtrl* child_ctrl)
@@ -3894,7 +3867,16 @@ void LLPanelEstateAccess::updateChild(LLUICtrl* child_ctrl)
updateControls(gAgent.getRegion());
}
-void LLFloaterRegionInfo::requestEstateGetAccessCoro(std::string url, LLHandle<LLFloater> handle)
+void LLPanelEstateAccess::updateLists()
+{
+ std::string cap_url = gAgent.getRegionCapability("EstateAccess");
+ if (!cap_url.empty())
+ {
+ LLCoros::instance().launch("LLFloaterRegionInfo::requestEstateGetAccessCoro", boost::bind(LLPanelEstateAccess::requestEstateGetAccessCoro, cap_url));
+ }
+}
+
+void LLPanelEstateAccess::requestEstateGetAccessCoro(std::string url)
{
LLCore::HttpRequest::policy_t httpPolicy(LLCore::HttpRequest::DEFAULT_POLICY_ID);
LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("requestEstateGetAccessoCoro", httpPolicy));
@@ -3905,12 +3887,6 @@ void LLFloaterRegionInfo::requestEstateGetAccessCoro(std::string url, LLHandle<L
LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS];
LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults);
- if (handle.isDead())
- {
- // nothing to do
- return;
- }
-
LLPanelEstateAccess* panel = LLFloaterRegionInfo::getPanelAccess();
if (!panel) return;
@@ -3923,8 +3899,8 @@ void LLFloaterRegionInfo::requestEstateGetAccessCoro(std::string url, LLHandle<L
std::string msg = LLTrans::getString("RegionInfoAllowedResidents", args);
panel->getChild<LLUICtrl>("allow_resident_label")->setValue(LLSD(msg));
- allowed_agent_name_list->clear();
allowed_agent_name_list->clearSortOrder();
+ allowed_agent_name_list->deleteAllItems();
for (LLSD::array_const_iterator it = result["AllowedAgents"].beginArray(); it != result["AllowedAgents"].endArray(); ++it)
{
LLUUID id = (*it)["id"].asUUID();
@@ -3942,8 +3918,8 @@ void LLFloaterRegionInfo::requestEstateGetAccessCoro(std::string url, LLHandle<L
std::string msg = LLTrans::getString("RegionInfoBannedResidents", args);
panel->getChild<LLUICtrl>("ban_resident_label")->setValue(LLSD(msg));
- banned_agent_name_list->clear();
banned_agent_name_list->clearSortOrder();
+ banned_agent_name_list->deleteAllItems();
for (LLSD::array_const_iterator it = result["BannedAgents"].beginArray(); it != result["BannedAgents"].endArray(); ++it)
{
LLUUID id = (*it)["id"].asUUID();
@@ -3981,7 +3957,7 @@ void LLFloaterRegionInfo::requestEstateGetAccessCoro(std::string url, LLHandle<L
panel->getChild<LLUICtrl>("estate_manager_label")->setValue(LLSD(msg));
estate_manager_name_list->clearSortOrder();
- allowed_group_name_list->deleteAllItems();
+ estate_manager_name_list->deleteAllItems();
for (LLSD::array_const_iterator it = result["Managers"].beginArray(); it != result["Managers"].endArray(); ++it)
{
LLUUID id = (*it)["agent_id"].asUUID();
diff --git a/indra/newview/llfloaterregioninfo.h b/indra/newview/llfloaterregioninfo.h
index ee6db9a87b..20ba3a7d9c 100644
--- a/indra/newview/llfloaterregioninfo.h
+++ b/indra/newview/llfloaterregioninfo.h
@@ -112,9 +112,6 @@ private:
LLFloaterRegionInfo(const LLSD& seed);
~LLFloaterRegionInfo();
- static void requestEstateGetAccessCoro(std::string url, LLHandle<LLFloater> handle);
-
-
protected:
void onTabSelected(const LLSD& param);
void disableTabCtrls();
@@ -495,7 +492,9 @@ public:
virtual void updateChild(LLUICtrl* child_ctrl);
void updateControls(LLViewerRegion* region);
+ void updateLists();
+private:
void onClickAddAllowedAgent();
void onClickRemoveAllowedAgent();
void onClickAddAllowedGroup();
@@ -504,7 +503,7 @@ public:
void onClickRemoveBannedAgent();
void onClickAddEstateManager();
void onClickRemoveEstateManager();
-
+
// Group picker callback is different, can't use core methods below
bool addAllowedGroup(const LLSD& notification, const LLSD& response);
void addAllowedGroup2(LLUUID id);
@@ -523,8 +522,7 @@ public:
// Send the actual EstateOwnerRequest "estateaccessdelta" message
static void sendEstateAccessDelta(U32 flags, const LLUUID& agent_id);
-
- void clearAccessLists();
+ static void requestEstateGetAccessCoro(std::string url);
};
#endif