summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterland.cpp
diff options
context:
space:
mode:
authorAndreyL ProductEngine <alihatskiy@productengine.com>2018-09-14 08:14:05 +0300
committerAndreyL ProductEngine <alihatskiy@productengine.com>2018-09-14 08:14:05 +0300
commitde52689954f575914cc91745808fa6cd6ece021a (patch)
tree0b88ef6ed913c623c26c9ca3edc41c216a086d8a /indra/newview/llfloaterland.cpp
parentfd83e889642518803b0041761a3d4bf81df21e3e (diff)
SL-1956 added support for temporary bans to parcel ban list
Diffstat (limited to 'indra/newview/llfloaterland.cpp')
-rw-r--r--indra/newview/llfloaterland.cpp75
1 files changed, 55 insertions, 20 deletions
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 88b3fb7b96..2ecb6f21cd 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -46,6 +46,7 @@
#include "llfloaterreg.h"
#include "llfloateravatarpicker.h"
#include "llfloaterauction.h"
+#include "llfloaterbanduration.h"
#include "llfloatergroups.h"
#include "llfloaterscriptlimits.h"
#include "llavataractions.h"
@@ -2502,33 +2503,49 @@ void LLPanelLandAccess::refresh()
cit != parcel->mBanList.end(); ++cit)
{
const LLAccessEntry& entry = (*cit).second;
- std::string prefix;
+ std::string duration;
if (entry.mTime != 0)
{
LLStringUtil::format_map_t args;
S32 now = time(NULL);
- S32 seconds = entry.mTime - now;
+ S32 seconds = entry.mTime - now;
if (seconds < 0) seconds = 0;
- prefix.assign(" (");
- if (seconds >= 120)
+
+ if (seconds >= 7200)
{
- args["[MINUTES]"] = llformat("%d", (seconds/60));
- std::string buf = parent_floater->getString ("Minutes", args);
- prefix.append(buf);
+ args["[HOURS]"] = llformat("%d", (seconds / 7200));
+ duration = parent_floater->getString("Hours", args);
+ }
+ if (seconds >= 3600)
+ {
+ duration = "1 " + parent_floater->getString("Hour");
+ }
+ else if (seconds >= 120)
+ {
+ args["[MINUTES]"] = llformat("%d", (seconds / 60));
+ duration = parent_floater->getString("Minutes", args);
}
else if (seconds >= 60)
{
- prefix.append("1 " + parent_floater->getString("Minute"));
+ duration = "1 " + parent_floater->getString("Minute");
}
else
{
args["[SECONDS]"] = llformat("%d", seconds);
- std::string buf = parent_floater->getString ("Seconds", args);
- prefix.append(buf);
+ duration = parent_floater->getString("Seconds", args);
}
- prefix.append(" " + parent_floater->getString("Remaining") + ") ");
}
- mListBanned->addNameItem(entry.mID, ADD_DEFAULT, TRUE, "", prefix);
+ else
+ {
+ duration = parent_floater->getString("Always");
+ }
+ LLSD item;
+ item["id"] = entry.mID;
+ LLSD& columns = item["columns"];
+ columns[0]["column"] = "name"; // to be populated later
+ columns[1]["column"] = "duration";
+ columns[1]["value"] = duration;
+ mListBanned->addElement(item);
}
mListBanned->sortByName(TRUE);
}
@@ -2880,7 +2897,7 @@ void LLPanelLandAccess::onClickAddBanned()
LLView * button = findChild<LLButton>("add_banned");
LLFloater * root_floater = gFloaterView->getParentFloater(this);
LLFloaterAvatarPicker* picker = LLFloaterAvatarPicker::show(
- boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), FALSE, FALSE, FALSE, root_floater->getName(), button);
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned, this, _1), TRUE, FALSE, FALSE, root_floater->getName(), button);
if (picker)
{
root_floater->addDependentFloater(picker);
@@ -2890,23 +2907,41 @@ void LLPanelLandAccess::onClickAddBanned()
// static
void LLPanelLandAccess::callbackAvatarCBBanned(const uuid_vec_t& ids)
{
- if (!ids.empty())
+ LLFloater * root_floater = gFloaterView->getParentFloater(this);
+ LLFloaterBanDuration* duration_floater = LLFloaterBanDuration::show(
+ boost::bind(&LLPanelLandAccess::callbackAvatarCBBanned2, this, _1, _2), ids);
+ if (duration_floater)
{
- LLUUID id = ids[0];
- LLParcel* parcel = mParcel->getParcel();
- if (parcel && parcel->addToBanList(id, 0))
+ root_floater->addDependentFloater(duration_floater);
+ }
+}
+
+void LLPanelLandAccess::callbackAvatarCBBanned2(const uuid_vec_t& ids, S32 duration)
+{
+ LLParcel* parcel = mParcel->getParcel();
+ if (!parcel) return;
+
+ U32 lists_to_update = 0;
+
+ for (uuid_vec_t::const_iterator it = ids.begin(); it < ids.end(); it++)
+ {
+ LLUUID id = *it;
+ if (parcel->addToBanList(id, duration))
{
- U32 lists_to_update = AL_BAN;
+ lists_to_update |= AL_BAN;
// agent was successfully added to ban list
// but we also need to check access list to ensure that agent will not be in two lists simultaneously
if (parcel->removeFromAccessList(id))
{
lists_to_update |= AL_ACCESS;
}
- LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
- refresh();
}
}
+ if (lists_to_update > 0)
+ {
+ LLViewerParcelMgr::getInstance()->sendParcelAccessListUpdate(lists_to_update);
+ refresh();
+ }
}
// static