From 72c4a8f71e0452dc51a52dd3a0874ef7d6094f94 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Thu, 17 Apr 2014 09:28:15 +0200 Subject: [PATCH] FIRE-12229: Limited to 42 groups on an opensim grid; Patch by Cinder Roxley --- indra/newview/fscommon.cpp | 12 +++++++++++ indra/newview/fscommon.h | 1 + indra/newview/fsfloatercontacts.cpp | 7 +++---- indra/newview/llagent.cpp | 5 ++++- indra/newview/llfloatergroups.cpp | 16 ++++++++++---- indra/newview/llpanelpeople.cpp | 12 +++++++---- indra/newview/llstartup.cpp | 7 +++++++ indra/newview/llviewermessage.cpp | 5 ++++- .../xui/en/panel_fs_contacts_groups.xml | 21 +++++++++---------- .../newview/skins/default/xui/en/strings.xml | 4 ++++ 10 files changed, 65 insertions(+), 25 deletions(-) diff --git a/indra/newview/fscommon.cpp b/indra/newview/fscommon.cpp index 4673263a29..7f8e18bce7 100644 --- a/indra/newview/fscommon.cpp +++ b/indra/newview/fscommon.cpp @@ -56,6 +56,8 @@ static const std::string LL_SCOUT = "Scout"; static const std::string LL_TESTER = "Tester"; +extern S32 gMaxAgentGroups; + S32 FSCommon::sObjectAddMsg = 0; void reportToNearbyChat(const std::string& message) @@ -338,3 +340,13 @@ bool FSCommon::checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionAct return false; } +LLSD FSCommon::populateGroupCount() +{ + LLStringUtil::format_map_t args; + S32 groupcount = gAgent.mGroups.count(); + args["[COUNT]"] = llformat("%d", groupcount); + args["[REMAINING]"] = llformat("%d", gMaxAgentGroups - groupcount); + LLUIString groupcountstring = LLTrans::getString((gMaxAgentGroups ? "groupcountstring" : "groupcountunlimitedstring"), args); + return LLSD(groupcountstring); +} + diff --git a/indra/newview/fscommon.h b/indra/newview/fscommon.h index 9f3adf20f1..403fd4c440 100644 --- a/indra/newview/fscommon.h +++ b/indra/newview/fscommon.h @@ -76,6 +76,7 @@ namespace FSCommon extern S32 sObjectAddMsg; bool checkIsActionEnabled(const LLUUID& av_id, EFSRegistrarFunctionActionType); + LLSD populateGroupCount(); }; #endif // FS_COMMON_H diff --git a/indra/newview/fsfloatercontacts.cpp b/indra/newview/fsfloatercontacts.cpp index efa2ae07fe..ce53ffc9bf 100644 --- a/indra/newview/fsfloatercontacts.cpp +++ b/indra/newview/fsfloatercontacts.cpp @@ -51,6 +51,7 @@ #include "llstartup.h" #include "llviewercontrol.h" #include "llvoiceclient.h" +#include "fscommon.h" //Maximum number of people you can select to do an operation on at once. const U32 MAX_FRIEND_SELECT = 20; @@ -171,15 +172,13 @@ void FSFloaterContacts::updateGroupButtons() LLUUID groupId = getCurrentItemID(); bool isGroup = groupId.notNull(); - LLUICtrl* groupcount = mGroupsTab->getChild("groupcount"); - groupcount->setTextArg("[COUNT]", llformat("%d", gAgent.mGroups.count())); - groupcount->setTextArg("[MAX]", llformat("%d", gMaxAgentGroups)); + mGroupsTab->getChild("groupcount")->setValue(FSCommon::populateGroupCount()); getChildView("chat_btn")->setEnabled(isGroup && gAgent.hasPowerInGroup(groupId, GP_SESSION_JOIN)); getChildView("info_btn")->setEnabled(isGroup); getChildView("activate_btn")->setEnabled(groupId != gAgent.getGroupID()); getChildView("leave_btn")->setEnabled(isGroup); - getChildView("create_btn")->setEnabled(gAgent.mGroups.count() < gMaxAgentGroups); + getChildView("create_btn")->setEnabled((!gMaxAgentGroups) || (gAgent.mGroups.count() < gMaxAgentGroups)); getChildView("invite_btn")->setEnabled(isGroup && gAgent.hasPowerInGroup(groupId, GP_MEMBER_INVITE)); } diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e80f1aa7c9..6cb4e57e73 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -3404,7 +3404,10 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO BOOL LLAgent::canJoinGroups() const { - return mGroups.count() < gMaxAgentGroups; + // [CR] FIRE-12229 + //return mGroups.count() < gMaxAgentGroups; + return ((!gMaxAgentGroups) || (mGroups.count() < gMaxAgentGroups)); + // [/CR] } LLQuaternion LLAgent::getHeadRotation() diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index d84364a68a..701eac8431 100755 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -46,6 +46,8 @@ #include "lluictrlfactory.h" #include "lltrans.h" +#include "fscommon.h" + using namespace LLOldEvents; // helper functions @@ -171,8 +173,11 @@ void LLPanelGroups::reset() { group_list->operateOnAll(LLCtrlListInterface::OP_DELETE); } - getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + // [CR] FIRE-12229 + //getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); + //getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setValue(FSCommon::populateGroupCount()); + // [/CR] init_group_list(getChild("group list"), gAgent.getGroupID()); enableButtons(); @@ -182,8 +187,11 @@ BOOL LLPanelGroups::postBuild() { childSetCommitCallback("group list", onGroupList, this); - getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + // [CR] FIRE-12229 + //getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); + //getChild("groupcount")->setTextArg("[MAX]", llformat("%d",gMaxAgentGroups)); + getChild("groupcount")->setValue(FSCommon::populateGroupCount()); + // [/CR] LLScrollListCtrl *list = getChild("group list"); if (list) diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 30316678c5..72bb2e350e 100755 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -77,6 +77,7 @@ #include "llevents.h" // for LLEventPumps // Firestorm includes +#include "fscommon.h" #include "fspanelradar.h" #include "lggcontactsets.h" #include "llcombobox.h" @@ -97,8 +98,8 @@ static const std::string BLOCKED_TAB_NAME = "blocked_panel"; // blocked avatars static const std::string CONTACT_SETS_TAB_NAME = "contact_sets_panel"; // [FS:CR] Contact sets static const std::string COLLAPSED_BY_USER = "collapsed_by_user"; - -extern S32 gMaxAgentGroups; +// [FS] FIRE-12229 +//extern S32 gMaxAgentGroups; /** Comparator for comparing avatar items by last interaction date */ class LLAvatarItemRecentComparator : public LLAvatarItemComparator @@ -996,8 +997,11 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->getChildView("minus_btn")->setEnabled(item_selected && selected_id.notNull()); // a real group selected - groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); - groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d",(gMaxAgentGroups-gAgent.mGroups.count()))); + // [CR] FIRE-12229 + //groups_panel->getChild("groupcount")->setTextArg("[COUNT]", llformat("%d",gAgent.mGroups.count())); + //groups_panel->getChild("groupcount")->setTextArg("[REMAINING]", llformat("%d",(gMaxAgentGroups-gAgent.mGroups.count()))); + getChild("groupcount")->setValue(FSCommon::populateGroupCount()); + // [/CR] } else { diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7ebd3502ad..3ffb923e3f 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -4093,9 +4093,16 @@ bool process_login_success_response(U32 &first_sim_size_x, U32 &first_sim_size_y } else { +// [CR] FIRE-12229 +#ifdef OPENSIM + gMaxAgentGroups = 0; + LL_INFOS("LLStartup") << "did not receive max-agent-groups. unlimited groups activated" << LL_ENDL; +#else gMaxAgentGroups = DEFAULT_MAX_AGENT_GROUPS; LL_INFOS("LLStartup") << "using gMaxAgentGroups default: " << gMaxAgentGroups << LL_ENDL; +#endif +// [CR] FIRE-12229 } // diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 468422170c..dbd4cce163 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -716,7 +716,10 @@ bool join_group_response(const LLSD& notification, const LLSD& response) S32 max_groups = gMaxAgentGroups; if(gAgent.isInGroup(group_id)) ++max_groups; - if(gAgent.mGroups.count() < max_groups) + // [CR] FIRE-12229 + //if(gAgent.mGroups.count() < max_groups) + if(!max_groups || gAgent.mGroups.count() < max_groups) + // [/CR] FIRE-12229 { accept_invite = true; } diff --git a/indra/newview/skins/default/xui/en/panel_fs_contacts_groups.xml b/indra/newview/skins/default/xui/en/panel_fs_contacts_groups.xml index 35866ef830..2c5b574260 100644 --- a/indra/newview/skins/default/xui/en/panel_fs_contacts_groups.xml +++ b/indra/newview/skins/default/xui/en/panel_fs_contacts_groups.xml @@ -23,17 +23,16 @@ color="ScrollBgWriteableColor" top="-1" width="260" /> - -You belong to [COUNT] out of [MAX] groups. - + +