diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5e2e374df65727a51af2d73023872ae1f211659b..35b28d8ec009c87c1d0540644fec167a34127e89 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -5157,6 +5157,11 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO return FALSE; } +BOOL LLAgent::canJoinGroups() const +{ + return mGroups.count() < MAX_AGENT_GROUPS; +} + LLQuaternion LLAgent::getHeadRotation() { if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp) diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 2e95dc72be1fc0ce3dad966b5e427bdd5b93d42b..beede7fbe34829abf3e639b9c3df658bddd357ba 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -972,6 +972,7 @@ class LLAgent : public LLOldEvents::LLObservable BOOL setGroupContribution(const LLUUID& group_id, S32 contribution); BOOL setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile); const std::string &getGroupName() const { return mGroupName; } + BOOL canJoinGroups() const; private: std::string mGroupName; LLUUID mGroupID; diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index 7cb925bc0b09a8d795cc9761cb3f41bc812e0421..29f415bd43904b5288ab32731908e34d4ea080e3 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -247,14 +247,7 @@ void LLPanelGroups::enableButtons() childDisable("IM"); childDisable("Leave"); } - if(gAgent.mGroups.count() < MAX_AGENT_GROUPS) - { - childEnable("Create"); - } - else - { - childDisable("Create"); - } + childSetEnabled("Create", gAgent.canJoinGroups()); } diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp index 7dd8ea694e9b061f2721b36870ddd523ccfaf4dc..a78a0a43b463f74841a7098b9f269248fe05cd70 100644 --- a/indra/newview/llgroupactions.cpp +++ b/indra/newview/llgroupactions.cpp @@ -146,6 +146,12 @@ void LLGroupActions::startCall(const LLUUID& group_id) // static void LLGroupActions::join(const LLUUID& group_id) { + if (!gAgent.canJoinGroups()) + { + LLNotificationsUtil::add("JoinedTooManyGroups"); + return; + } + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index e14a5778adc47fbe9cc6613cf7d777e121b6e198..03cc870a59572bcdefe78f470f5c166bdd493ef9 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -35,6 +35,7 @@ // libs #include "llfloaterreg.h" #include "llmenugl.h" +#include "llnotificationsutil.h" #include "llfiltereditor.h" #include "lltabcontainer.h" #include "lluictrlfactory.h" @@ -750,7 +751,6 @@ void LLPanelPeople::updateButtons() LLPanel* groups_panel = mTabContainer->getCurrentPanel(); groups_panel->childSetEnabled("activate_btn", item_selected && !cur_group_active); // "none" or a non-active group selected - groups_panel->childSetEnabled("plus_btn", item_selected); groups_panel->childSetEnabled("minus_btn", item_selected && selected_id.notNull()); } else @@ -1138,6 +1138,12 @@ void LLPanelPeople::onAvatarPicked( void LLPanelPeople::onGroupPlusButtonClicked() { + if (!gAgent.canJoinGroups()) + { + LLNotificationsUtil::add("JoinedTooManyGroups"); + return; + } + LLMenuGL* plus_menu = (LLMenuGL*)mGroupPlusMenuHandle.get(); if (!plus_menu) return; diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 410c398ea51e4ebcdbd47e4987cfe2da0bc25b7f..b4ce0df6a2dd283964e4574b8af325c60f6776a6 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -2915,6 +2915,16 @@ You have reached your maximum number of groups. Please leave another group befor yestext="Join"/> </notification> + <notification + icon="alert.tga" + name="JoinedTooManyGroups" + type="alert"> +You have reached your maximum number of groups. Please leave some group before joining or creating a new one. + <usetemplate + name="okbutton" + yestext="OK"/> + </notification> + <notification icon="alert.tga" name="KickUser"