diff options
Diffstat (limited to 'linden/indra/newview/llgroupmgr.cpp')
-rw-r--r-- | linden/indra/newview/llgroupmgr.cpp | 167 |
1 files changed, 77 insertions, 90 deletions
diff --git a/linden/indra/newview/llgroupmgr.cpp b/linden/indra/newview/llgroupmgr.cpp index 0dd8c6d..af6a6aa 100644 --- a/linden/indra/newview/llgroupmgr.cpp +++ b/linden/indra/newview/llgroupmgr.cpp | |||
@@ -96,16 +96,16 @@ LLGroupMemberData::~LLGroupMemberData() | |||
96 | 96 | ||
97 | void LLGroupMemberData::addRole(const LLUUID& role, LLGroupRoleData* rd) | 97 | void LLGroupMemberData::addRole(const LLUUID& role, LLGroupRoleData* rd) |
98 | { | 98 | { |
99 | mRoles[role] = rd; | 99 | mRolesList[role] = rd; |
100 | } | 100 | } |
101 | 101 | ||
102 | bool LLGroupMemberData::removeRole(const LLUUID& role) | 102 | bool LLGroupMemberData::removeRole(const LLUUID& role) |
103 | { | 103 | { |
104 | std::map<LLUUID,LLGroupRoleData*>::iterator it = mRoles.find(role); | 104 | role_list_t::iterator it = mRolesList.find(role); |
105 | 105 | ||
106 | if (it != mRoles.end()) | 106 | if (it != mRolesList.end()) |
107 | { | 107 | { |
108 | mRoles.erase(it); | 108 | mRolesList.erase(it); |
109 | return true; | 109 | return true; |
110 | } | 110 | } |
111 | 111 | ||
@@ -233,7 +233,7 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : | |||
233 | 233 | ||
234 | BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) | 234 | BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_data) |
235 | { | 235 | { |
236 | std::map<LLUUID,LLRoleData>::const_iterator it; | 236 | role_data_map_t::const_iterator it; |
237 | 237 | ||
238 | // Do we have changes for it? | 238 | // Do we have changes for it? |
239 | it = mRoleChanges.find(role_id); | 239 | it = mRoleChanges.find(role_id); |
@@ -246,7 +246,7 @@ BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_da | |||
246 | } | 246 | } |
247 | 247 | ||
248 | // Ok, no changes, hasn't been deleted, isn't a new role, just find the role. | 248 | // Ok, no changes, hasn't been deleted, isn't a new role, just find the role. |
249 | role_list::const_iterator rit = mRoles.find(role_id); | 249 | role_list_t::const_iterator rit = mRoles.find(role_id); |
250 | if (rit != mRoles.end()) | 250 | if (rit != mRoles.end()) |
251 | { | 251 | { |
252 | role_data = (*rit).second->getRoleData(); | 252 | role_data = (*rit).second->getRoleData(); |
@@ -261,7 +261,7 @@ BOOL LLGroupMgrGroupData::getRoleData(const LLUUID& role_id, LLRoleData& role_da | |||
261 | void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_data) | 261 | void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_data) |
262 | { | 262 | { |
263 | // If this is a newly created group, we need to change the data in the created list. | 263 | // If this is a newly created group, we need to change the data in the created list. |
264 | std::map<LLUUID,LLRoleData>::iterator it; | 264 | role_data_map_t::iterator it; |
265 | it = mRoleChanges.find(role_id); | 265 | it = mRoleChanges.find(role_id); |
266 | if (it != mRoleChanges.end()) | 266 | if (it != mRoleChanges.end()) |
267 | { | 267 | { |
@@ -280,7 +280,7 @@ void LLGroupMgrGroupData::setRoleData(const LLUUID& role_id, LLRoleData role_dat | |||
280 | 280 | ||
281 | // Not a new role, so put it in the changes list. | 281 | // Not a new role, so put it in the changes list. |
282 | LLRoleData old_role_data; | 282 | LLRoleData old_role_data; |
283 | role_iter rit = mRoles.find(role_id); | 283 | role_list_t::iterator rit = mRoles.find(role_id); |
284 | if (rit != mRoles.end()) | 284 | if (rit != mRoles.end()) |
285 | { | 285 | { |
286 | bool data_change = ( ((*rit).second->mRoleData.mRoleDescription != role_data.mRoleDescription) | 286 | bool data_change = ( ((*rit).second->mRoleData.mRoleDescription != role_data.mRoleDescription) |
@@ -337,7 +337,7 @@ void LLGroupMgrGroupData::createRole(const LLUUID& role_id, LLRoleData role_data | |||
337 | 337 | ||
338 | void LLGroupMgrGroupData::deleteRole(const LLUUID& role_id) | 338 | void LLGroupMgrGroupData::deleteRole(const LLUUID& role_id) |
339 | { | 339 | { |
340 | std::map<LLUUID,LLRoleData>::iterator it; | 340 | role_data_map_t::iterator it; |
341 | 341 | ||
342 | // If this was a new role, just discard it. | 342 | // If this was a new role, just discard it. |
343 | it = mRoleChanges.find(role_id); | 343 | it = mRoleChanges.find(role_id); |
@@ -404,7 +404,7 @@ void LLGroupMgrGroupData::removeData() | |||
404 | 404 | ||
405 | void LLGroupMgrGroupData::removeMemberData() | 405 | void LLGroupMgrGroupData::removeMemberData() |
406 | { | 406 | { |
407 | for (member_iter mi = mMembers.begin(); mi != mMembers.end(); ++mi) | 407 | for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi) |
408 | { | 408 | { |
409 | delete mi->second; | 409 | delete mi->second; |
410 | } | 410 | } |
@@ -414,7 +414,7 @@ void LLGroupMgrGroupData::removeMemberData() | |||
414 | 414 | ||
415 | void LLGroupMgrGroupData::removeRoleData() | 415 | void LLGroupMgrGroupData::removeRoleData() |
416 | { | 416 | { |
417 | for (member_iter mi = mMembers.begin(); mi != mMembers.end(); ++mi) | 417 | for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi) |
418 | { | 418 | { |
419 | LLGroupMemberData* data = mi->second; | 419 | LLGroupMemberData* data = mi->second; |
420 | if (data) | 420 | if (data) |
@@ -423,7 +423,7 @@ void LLGroupMgrGroupData::removeRoleData() | |||
423 | } | 423 | } |
424 | } | 424 | } |
425 | 425 | ||
426 | for (role_iter ri = mRoles.begin(); ri != mRoles.end(); ++ri) | 426 | for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri) |
427 | { | 427 | { |
428 | LLGroupRoleData* data = ri->second; | 428 | LLGroupRoleData* data = ri->second; |
429 | delete data; | 429 | delete data; |
@@ -436,7 +436,7 @@ void LLGroupMgrGroupData::removeRoleData() | |||
436 | 436 | ||
437 | void LLGroupMgrGroupData::removeRoleMemberData() | 437 | void LLGroupMgrGroupData::removeRoleMemberData() |
438 | { | 438 | { |
439 | for (member_iter mi = mMembers.begin(); mi != mMembers.end(); ++mi) | 439 | for (member_list_t::iterator mi = mMembers.begin(); mi != mMembers.end(); ++mi) |
440 | { | 440 | { |
441 | LLGroupMemberData* data = mi->second; | 441 | LLGroupMemberData* data = mi->second; |
442 | if (data) | 442 | if (data) |
@@ -445,7 +445,7 @@ void LLGroupMgrGroupData::removeRoleMemberData() | |||
445 | } | 445 | } |
446 | } | 446 | } |
447 | 447 | ||
448 | for (role_iter ri = mRoles.begin(); ri != mRoles.end(); ++ri) | 448 | for (role_list_t::iterator ri = mRoles.begin(); ri != mRoles.end(); ++ri) |
449 | { | 449 | { |
450 | LLGroupRoleData* data = ri->second; | 450 | LLGroupRoleData* data = ri->second; |
451 | if (data) | 451 | if (data) |
@@ -467,8 +467,8 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, | |||
467 | const LLUUID& member_id, | 467 | const LLUUID& member_id, |
468 | LLRoleMemberChangeType rmc) | 468 | LLRoleMemberChangeType rmc) |
469 | { | 469 | { |
470 | role_iter ri = mRoles.find(role_id); | 470 | role_list_t::iterator ri = mRoles.find(role_id); |
471 | member_iter mi = mMembers.find(member_id); | 471 | member_list_t::iterator mi = mMembers.find(member_id); |
472 | 472 | ||
473 | if (ri == mRoles.end() | 473 | if (ri == mRoles.end() |
474 | || mi == mMembers.end() ) | 474 | || mi == mMembers.end() ) |
@@ -511,7 +511,7 @@ bool LLGroupMgrGroupData::changeRoleMember(const LLUUID& role_id, | |||
511 | role_member.first = role_id; | 511 | role_member.first = role_id; |
512 | role_member.second = member_id; | 512 | role_member.second = member_id; |
513 | 513 | ||
514 | change_map::iterator it = mRoleMemberChanges.find(role_member); | 514 | change_map_t::iterator it = mRoleMemberChanges.find(role_member); |
515 | if (it != mRoleMemberChanges.end()) | 515 | if (it != mRoleMemberChanges.end()) |
516 | { | 516 | { |
517 | // There was already a role change for this role_member | 517 | // There was already a role change for this role_member |
@@ -554,18 +554,15 @@ void LLGroupMgrGroupData::recalcAllAgentPowers() | |||
554 | { | 554 | { |
555 | LLGroupMemberData* gmd; | 555 | LLGroupMemberData* gmd; |
556 | 556 | ||
557 | member_iter mit = mMembers.begin(); | 557 | for (member_list_t::iterator mit = mMembers.begin(); |
558 | member_iter mend = mMembers.end(); | 558 | mit != mMembers.end(); ++mit) |
559 | for( ; mit != mend; ++mit) | ||
560 | { | 559 | { |
561 | gmd = mit->second; | 560 | gmd = mit->second; |
562 | if (!gmd) continue; | 561 | if (!gmd) continue; |
563 | 562 | ||
564 | std::map<LLUUID,LLGroupRoleData*>::iterator it = gmd->mRoles.begin(); | ||
565 | std::map<LLUUID,LLGroupRoleData*>::iterator end = gmd->mRoles.end(); | ||
566 | |||
567 | gmd->mAgentPowers = 0; | 563 | gmd->mAgentPowers = 0; |
568 | for ( ; it != end; ++it) | 564 | for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin(); |
565 | it != gmd->mRolesList.end(); ++it) | ||
569 | { | 566 | { |
570 | LLGroupRoleData* grd = (*it).second; | 567 | LLGroupRoleData* grd = (*it).second; |
571 | if (!grd) continue; | 568 | if (!grd) continue; |
@@ -577,18 +574,16 @@ void LLGroupMgrGroupData::recalcAllAgentPowers() | |||
577 | 574 | ||
578 | void LLGroupMgrGroupData::recalcAgentPowers(const LLUUID& agent_id) | 575 | void LLGroupMgrGroupData::recalcAgentPowers(const LLUUID& agent_id) |
579 | { | 576 | { |
580 | member_iter mi = mMembers.find(agent_id); | 577 | member_list_t::iterator mi = mMembers.find(agent_id); |
581 | if (mi == mMembers.end()) return; | 578 | if (mi == mMembers.end()) return; |
582 | 579 | ||
583 | LLGroupMemberData* gmd = mi->second; | 580 | LLGroupMemberData* gmd = mi->second; |
584 | 581 | ||
585 | if (!gmd) return; | 582 | if (!gmd) return; |
586 | 583 | ||
587 | std::map<LLUUID,LLGroupRoleData*>::iterator it = gmd->mRoles.begin(); | ||
588 | std::map<LLUUID,LLGroupRoleData*>::iterator end = gmd->mRoles.end(); | ||
589 | |||
590 | gmd->mAgentPowers = 0; | 584 | gmd->mAgentPowers = 0; |
591 | for ( ; it != end; ++it) | 585 | for (LLGroupMemberData::role_list_t::iterator it = gmd->mRolesList.begin(); |
586 | it != gmd->mRolesList.end(); ++it) | ||
592 | { | 587 | { |
593 | LLGroupRoleData* grd = (*it).second; | 588 | LLGroupRoleData* grd = (*it).second; |
594 | if (!grd) continue; | 589 | if (!grd) continue; |
@@ -633,10 +628,8 @@ bool packRoleUpdateMessageBlock(LLMessageSystem* msg, | |||
633 | void LLGroupMgrGroupData::sendRoleChanges() | 628 | void LLGroupMgrGroupData::sendRoleChanges() |
634 | { | 629 | { |
635 | // Commit changes locally | 630 | // Commit changes locally |
636 | std::map<LLUUID,LLRoleData>::iterator it; | ||
637 | std::map<LLUUID,LLRoleData>::iterator end; | ||
638 | LLGroupRoleData* grd; | 631 | LLGroupRoleData* grd; |
639 | role_iter role_it; | 632 | role_list_t::iterator role_it; |
640 | LLMessageSystem* msg = gMessageSystem; | 633 | LLMessageSystem* msg = gMessageSystem; |
641 | bool start_message = true; | 634 | bool start_message = true; |
642 | 635 | ||
@@ -645,16 +638,15 @@ void LLGroupMgrGroupData::sendRoleChanges() | |||
645 | bool need_power_recalc = false; | 638 | bool need_power_recalc = false; |
646 | 639 | ||
647 | // Apply all changes | 640 | // Apply all changes |
648 | it = mRoleChanges.begin(); | 641 | for (role_data_map_t::iterator iter = mRoleChanges.begin(); |
649 | end = mRoleChanges.end(); | 642 | iter != mRoleChanges.end(); ) |
650 | for ( ; it != end; ++it) | ||
651 | { | 643 | { |
644 | role_data_map_t::iterator it = iter++; // safely incrament iter | ||
652 | const LLUUID& role_id = (*it).first; | 645 | const LLUUID& role_id = (*it).first; |
653 | const LLRoleData& role_data = (*it).second; | 646 | const LLRoleData& role_data = (*it).second; |
654 | 647 | ||
655 | // Commit to local data set | 648 | // Commit to local data set |
656 | role_it = mRoles.find((*it).first); | 649 | role_it = mRoles.find((*it).first); |
657 | LLGroupRoleData* group_role_data = (*role_it).second; | ||
658 | if ( (mRoles.end() == role_it | 650 | if ( (mRoles.end() == role_it |
659 | && RC_CREATE != role_data.mChangeType) | 651 | && RC_CREATE != role_data.mChangeType) |
660 | || (mRoles.end() != role_it | 652 | || (mRoles.end() != role_it |
@@ -662,11 +654,13 @@ void LLGroupMgrGroupData::sendRoleChanges() | |||
662 | { | 654 | { |
663 | continue; | 655 | continue; |
664 | } | 656 | } |
665 | 657 | ||
658 | // NOTE: role_it is valid EXCEPT for the RC_CREATE case | ||
666 | switch (role_data.mChangeType) | 659 | switch (role_data.mChangeType) |
667 | { | 660 | { |
668 | case RC_CREATE: | 661 | case RC_CREATE: |
669 | { | 662 | { |
663 | // NOTE: role_it is NOT valid in this case | ||
670 | grd = new LLGroupRoleData(role_id, role_data, 0); | 664 | grd = new LLGroupRoleData(role_id, role_data, 0); |
671 | mRoles[role_id] = grd; | 665 | mRoles[role_id] = grd; |
672 | need_role_data = true; | 666 | need_role_data = true; |
@@ -674,6 +668,7 @@ void LLGroupMgrGroupData::sendRoleChanges() | |||
674 | } | 668 | } |
675 | case RC_DELETE: | 669 | case RC_DELETE: |
676 | { | 670 | { |
671 | LLGroupRoleData* group_role_data = (*role_it).second; | ||
677 | delete group_role_data; | 672 | delete group_role_data; |
678 | mRoles.erase(role_it); | 673 | mRoles.erase(role_it); |
679 | need_role_cleanup = true; | 674 | need_role_cleanup = true; |
@@ -686,7 +681,8 @@ void LLGroupMgrGroupData::sendRoleChanges() | |||
686 | case RC_UPDATE_DATA: | 681 | case RC_UPDATE_DATA: |
687 | default: | 682 | default: |
688 | { | 683 | { |
689 | group_role_data->setRoleData(role_data); | 684 | LLGroupRoleData* group_role_data = (*role_it).second; |
685 | group_role_data->setRoleData(role_data); // NOTE! might modify mRoleChanges! | ||
690 | break; | 686 | break; |
691 | } | 687 | } |
692 | } | 688 | } |
@@ -751,7 +747,7 @@ void LLGroupMgr::clearGroups() | |||
751 | 747 | ||
752 | void LLGroupMgr::clearGroupData(const LLUUID& group_id) | 748 | void LLGroupMgr::clearGroupData(const LLUUID& group_id) |
753 | { | 749 | { |
754 | std::map<LLUUID, LLGroupMgrGroupData*>::iterator iter = mGroups.find(group_id); | 750 | group_map_t::iterator iter = mGroups.find(group_id); |
755 | if (iter != mGroups.end()) | 751 | if (iter != mGroups.end()) |
756 | { | 752 | { |
757 | delete (*iter).second; | 753 | delete (*iter).second; |
@@ -770,7 +766,7 @@ void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer) | |||
770 | { | 766 | { |
771 | return; | 767 | return; |
772 | } | 768 | } |
773 | observer_iter it; | 769 | observer_multimap_t::iterator it; |
774 | it = mObservers.find(observer->getID()); | 770 | it = mObservers.find(observer->getID()); |
775 | while (it != mObservers.end()) | 771 | while (it != mObservers.end()) |
776 | { | 772 | { |
@@ -788,7 +784,7 @@ void LLGroupMgr::removeObserver(LLGroupMgrObserver* observer) | |||
788 | 784 | ||
789 | LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) | 785 | LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) |
790 | { | 786 | { |
791 | group_iter gi = mGroups.find(id); | 787 | group_map_t::iterator gi = mGroups.find(id); |
792 | 788 | ||
793 | if (gi != mGroups.end()) | 789 | if (gi != mGroups.end()) |
794 | { | 790 | { |
@@ -800,7 +796,7 @@ LLGroupMgrGroupData* LLGroupMgr::getGroupData(const LLUUID& id) | |||
800 | // static | 796 | // static |
801 | void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) | 797 | void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) |
802 | { | 798 | { |
803 | llinfos << "LLGroupMgr::processGroupMembersReply" << llendl; | 799 | lldebugs << "LLGroupMgr::processGroupMembersReply" << llendl; |
804 | LLUUID agent_id; | 800 | LLUUID agent_id; |
805 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); | 801 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); |
806 | if (gAgent.getID() != agent_id) | 802 | if (gAgent.getID() != agent_id) |
@@ -854,7 +850,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) | |||
854 | std::string(online_status), | 850 | std::string(online_status), |
855 | is_owner); | 851 | is_owner); |
856 | #if LL_DEBUG | 852 | #if LL_DEBUG |
857 | LLGroupMgrGroupData::member_iter mit = group_datap->mMembers.find(member_id); | 853 | LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(member_id); |
858 | if (mit != group_datap->mMembers.end()) | 854 | if (mit != group_datap->mMembers.end()) |
859 | { | 855 | { |
860 | llinfos << " *** Received duplicate member data for agent " << member_id << llendl; | 856 | llinfos << " *** Received duplicate member data for agent " << member_id << llendl; |
@@ -894,7 +890,7 @@ void LLGroupMgr::processGroupMembersReply(LLMessageSystem* msg, void** data) | |||
894 | //static | 890 | //static |
895 | void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) | 891 | void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) |
896 | { | 892 | { |
897 | llinfos << "LLGroupMgr::processGroupPropertiesReply" << llendl; | 893 | lldebugs << "LLGroupMgr::processGroupPropertiesReply" << llendl; |
898 | LLUUID agent_id; | 894 | LLUUID agent_id; |
899 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); | 895 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); |
900 | if (gAgent.getID() != agent_id) | 896 | if (gAgent.getID() != agent_id) |
@@ -961,7 +957,7 @@ void LLGroupMgr::processGroupPropertiesReply(LLMessageSystem* msg, void** data) | |||
961 | // static | 957 | // static |
962 | void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) | 958 | void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) |
963 | { | 959 | { |
964 | llinfos << "LLGroupMgr::processGroupRoleDataReply" << llendl; | 960 | lldebugs << "LLGroupMgr::processGroupRoleDataReply" << llendl; |
965 | LLUUID agent_id; | 961 | LLUUID agent_id; |
966 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); | 962 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); |
967 | if (gAgent.getID() != agent_id) | 963 | if (gAgent.getID() != agent_id) |
@@ -1028,7 +1024,7 @@ void LLGroupMgr::processGroupRoleDataReply(LLMessageSystem* msg, void** data) | |||
1028 | // static | 1024 | // static |
1029 | void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) | 1025 | void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) |
1030 | { | 1026 | { |
1031 | llinfos << "LLGroupMgr::processGroupRoleMembersReply" << llendl; | 1027 | lldebugs << "LLGroupMgr::processGroupRoleMembersReply" << llendl; |
1032 | LLUUID agent_id; | 1028 | LLUUID agent_id; |
1033 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); | 1029 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); |
1034 | if (gAgent.getID() != agent_id) | 1030 | if (gAgent.getID() != agent_id) |
@@ -1061,8 +1057,8 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) | |||
1061 | LLGroupRoleData* rd = NULL; | 1057 | LLGroupRoleData* rd = NULL; |
1062 | LLGroupMemberData* md = NULL; | 1058 | LLGroupMemberData* md = NULL; |
1063 | 1059 | ||
1064 | LLGroupMgrGroupData::role_iter ri; | 1060 | LLGroupMgrGroupData::role_list_t::iterator ri; |
1065 | LLGroupMgrGroupData::member_iter mi; | 1061 | LLGroupMgrGroupData::member_list_t::iterator mi; |
1066 | 1062 | ||
1067 | // If total_pairs == 0, there are no members in any custom roles. | 1063 | // If total_pairs == 0, there are no members in any custom roles. |
1068 | if (total_pairs > 0) | 1064 | if (total_pairs > 0) |
@@ -1115,9 +1111,8 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) | |||
1115 | } | 1111 | } |
1116 | else | 1112 | else |
1117 | { | 1113 | { |
1118 | LLGroupMgrGroupData::member_iter mi = group_data->mMembers.begin(); | 1114 | for (LLGroupMgrGroupData::member_list_t::iterator mi = group_data->mMembers.begin(); |
1119 | LLGroupMgrGroupData::member_iter end = group_data->mMembers.end(); | 1115 | mi != group_data->mMembers.end(); ++mi) |
1120 | for ( ; mi != end; ++mi) | ||
1121 | { | 1116 | { |
1122 | LLGroupMemberData* data = mi->second; | 1117 | LLGroupMemberData* data = mi->second; |
1123 | if (data) | 1118 | if (data) |
@@ -1138,7 +1133,7 @@ void LLGroupMgr::processGroupRoleMembersReply(LLMessageSystem* msg, void** data) | |||
1138 | // static | 1133 | // static |
1139 | void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) | 1134 | void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) |
1140 | { | 1135 | { |
1141 | llinfos << "LLGroupMgr::processGroupTitlesReply" << llendl; | 1136 | lldebugs << "LLGroupMgr::processGroupTitlesReply" << llendl; |
1142 | LLUUID agent_id; | 1137 | LLUUID agent_id; |
1143 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); | 1138 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id ); |
1144 | if (gAgent.getID() != agent_id) | 1139 | if (gAgent.getID() != agent_id) |
@@ -1188,7 +1183,7 @@ void LLGroupMgr::processGroupTitlesReply(LLMessageSystem* msg, void** data) | |||
1188 | // static | 1183 | // static |
1189 | void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data) | 1184 | void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data) |
1190 | { | 1185 | { |
1191 | llinfos << "processEjectGroupMemberReply" << llendl; | 1186 | lldebugs << "processEjectGroupMemberReply" << llendl; |
1192 | LLUUID group_id; | 1187 | LLUUID group_id; |
1193 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); | 1188 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); |
1194 | BOOL success; | 1189 | BOOL success; |
@@ -1204,7 +1199,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data | |||
1204 | // static | 1199 | // static |
1205 | void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) | 1200 | void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) |
1206 | { | 1201 | { |
1207 | llinfos << "processJoinGroupReply" << llendl; | 1202 | lldebugs << "processJoinGroupReply" << llendl; |
1208 | LLUUID group_id; | 1203 | LLUUID group_id; |
1209 | BOOL success; | 1204 | BOOL success; |
1210 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); | 1205 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); |
@@ -1226,7 +1221,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data) | |||
1226 | // static | 1221 | // static |
1227 | void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) | 1222 | void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data) |
1228 | { | 1223 | { |
1229 | llinfos << "processLeaveGroupReply" << llendl; | 1224 | lldebugs << "processLeaveGroupReply" << llendl; |
1230 | LLUUID group_id; | 1225 | LLUUID group_id; |
1231 | BOOL success; | 1226 | BOOL success; |
1232 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); | 1227 | msg->getUUIDFast(_PREHASH_GroupData, _PREHASH_GroupID, group_id); |
@@ -1291,7 +1286,7 @@ LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) | |||
1291 | { | 1286 | { |
1292 | LLGroupMgrGroupData* group_datap; | 1287 | LLGroupMgrGroupData* group_datap; |
1293 | 1288 | ||
1294 | group_iter existing_group = gGroupMgr->mGroups.find(id); | 1289 | group_map_t::iterator existing_group = gGroupMgr->mGroups.find(id); |
1295 | if (existing_group == gGroupMgr->mGroups.end()) | 1290 | if (existing_group == gGroupMgr->mGroups.end()) |
1296 | { | 1291 | { |
1297 | group_datap = new LLGroupMgrGroupData(id); | 1292 | group_datap = new LLGroupMgrGroupData(id); |
@@ -1307,12 +1302,12 @@ LLGroupMgrGroupData* LLGroupMgr::createGroupData(const LLUUID& id) | |||
1307 | 1302 | ||
1308 | void LLGroupMgr::notifyObservers(LLGroupChange gc) | 1303 | void LLGroupMgr::notifyObservers(LLGroupChange gc) |
1309 | { | 1304 | { |
1310 | for (group_iter gi = mGroups.begin(); gi != mGroups.end(); ++gi) | 1305 | for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end(); ++gi) |
1311 | { | 1306 | { |
1312 | if (gi->second->mChanged) | 1307 | if (gi->second->mChanged) |
1313 | { | 1308 | { |
1314 | // find all observers for this group id | 1309 | // find all observers for this group id |
1315 | observer_iter oi = mObservers.find(gi->first); | 1310 | observer_multimap_t::iterator oi = mObservers.find(gi->first); |
1316 | for (; oi != mObservers.end(); ++oi) | 1311 | for (; oi != mObservers.end(); ++oi) |
1317 | { | 1312 | { |
1318 | oi->second->changed(gc); | 1313 | oi->second->changed(gc); |
@@ -1327,9 +1322,9 @@ void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap) | |||
1327 | if (mGroups.size() > MAX_CACHED_GROUPS) | 1322 | if (mGroups.size() > MAX_CACHED_GROUPS) |
1328 | { | 1323 | { |
1329 | // get rid of groups that aren't observed | 1324 | // get rid of groups that aren't observed |
1330 | for (group_iter gi = mGroups.begin(); gi != mGroups.end() && mGroups.size() > MAX_CACHED_GROUPS / 2; ) | 1325 | for (group_map_t::iterator gi = mGroups.begin(); gi != mGroups.end() && mGroups.size() > MAX_CACHED_GROUPS / 2; ) |
1331 | { | 1326 | { |
1332 | observer_iter oi = mObservers.find(gi->first); | 1327 | observer_multimap_t::iterator oi = mObservers.find(gi->first); |
1333 | if (oi == mObservers.end()) | 1328 | if (oi == mObservers.end()) |
1334 | { | 1329 | { |
1335 | // not observed | 1330 | // not observed |
@@ -1349,7 +1344,7 @@ void LLGroupMgr::addGroup(LLGroupMgrGroupData* group_datap) | |||
1349 | 1344 | ||
1350 | void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id) | 1345 | void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id) |
1351 | { | 1346 | { |
1352 | llinfos << "LLGroupMgr::sendGroupPropertiesRequest" << llendl; | 1347 | lldebugs << "LLGroupMgr::sendGroupPropertiesRequest" << llendl; |
1353 | // This will happen when we get the reply | 1348 | // This will happen when we get the reply |
1354 | //LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1349 | //LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1355 | 1350 | ||
@@ -1365,7 +1360,7 @@ void LLGroupMgr::sendGroupPropertiesRequest(const LLUUID& group_id) | |||
1365 | 1360 | ||
1366 | void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) | 1361 | void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) |
1367 | { | 1362 | { |
1368 | llinfos << "LLGroupMgr::sendGroupMembersRequest" << llendl; | 1363 | lldebugs << "LLGroupMgr::sendGroupMembersRequest" << llendl; |
1369 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1364 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1370 | if (group_datap->mMemberRequestID.isNull()) | 1365 | if (group_datap->mMemberRequestID.isNull()) |
1371 | { | 1366 | { |
@@ -1386,7 +1381,7 @@ void LLGroupMgr::sendGroupMembersRequest(const LLUUID& group_id) | |||
1386 | 1381 | ||
1387 | void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) | 1382 | void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) |
1388 | { | 1383 | { |
1389 | llinfos << "LLGroupMgr::sendGroupRoleDataRequest" << llendl; | 1384 | lldebugs << "LLGroupMgr::sendGroupRoleDataRequest" << llendl; |
1390 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1385 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1391 | if (group_datap->mRoleDataRequestID.isNull()) | 1386 | if (group_datap->mRoleDataRequestID.isNull()) |
1392 | { | 1387 | { |
@@ -1407,7 +1402,7 @@ void LLGroupMgr::sendGroupRoleDataRequest(const LLUUID& group_id) | |||
1407 | 1402 | ||
1408 | void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) | 1403 | void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) |
1409 | { | 1404 | { |
1410 | llinfos << "LLGroupMgr::sendGroupRoleMembersRequest" << llendl; | 1405 | lldebugs << "LLGroupMgr::sendGroupRoleMembersRequest" << llendl; |
1411 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1406 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1412 | 1407 | ||
1413 | if (group_datap->mRoleMembersRequestID.isNull()) | 1408 | if (group_datap->mRoleMembersRequestID.isNull()) |
@@ -1441,7 +1436,7 @@ void LLGroupMgr::sendGroupRoleMembersRequest(const LLUUID& group_id) | |||
1441 | 1436 | ||
1442 | void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id) | 1437 | void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id) |
1443 | { | 1438 | { |
1444 | llinfos << "LLGroupMgr::sendGroupTitlesRequest" << llendl; | 1439 | lldebugs << "LLGroupMgr::sendGroupTitlesRequest" << llendl; |
1445 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1440 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1446 | 1441 | ||
1447 | group_datap->mTitles.clear(); | 1442 | group_datap->mTitles.clear(); |
@@ -1460,7 +1455,7 @@ void LLGroupMgr::sendGroupTitlesRequest(const LLUUID& group_id) | |||
1460 | 1455 | ||
1461 | void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id) | 1456 | void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& title_role_id) |
1462 | { | 1457 | { |
1463 | llinfos << "LLGroupMgr::sendGroupTitleUpdate" << llendl; | 1458 | lldebugs << "LLGroupMgr::sendGroupTitleUpdate" << llendl; |
1464 | 1459 | ||
1465 | LLMessageSystem* msg = gMessageSystem; | 1460 | LLMessageSystem* msg = gMessageSystem; |
1466 | msg->newMessage("GroupTitleUpdate"); | 1461 | msg->newMessage("GroupTitleUpdate"); |
@@ -1474,10 +1469,8 @@ void LLGroupMgr::sendGroupTitleUpdate(const LLUUID& group_id, const LLUUID& titl | |||
1474 | 1469 | ||
1475 | // Save the change locally | 1470 | // Save the change locally |
1476 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1471 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1477 | std::vector<LLGroupTitle>::iterator iter = group_datap->mTitles.begin(); | 1472 | for (std::vector<LLGroupTitle>::iterator iter = group_datap->mTitles.begin(); |
1478 | std::vector<LLGroupTitle>::iterator end = group_datap->mTitles.end(); | 1473 | iter != group_datap->mTitles.end(); ++iter) |
1479 | |||
1480 | for ( ; iter != end; ++iter) | ||
1481 | { | 1474 | { |
1482 | if (iter->mRoleID == title_role_id) | 1475 | if (iter->mRoleID == title_role_id) |
1483 | { | 1476 | { |
@@ -1521,7 +1514,7 @@ void LLGroupMgr::sendCreateGroupRequest(const std::string& name, | |||
1521 | 1514 | ||
1522 | void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) | 1515 | void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) |
1523 | { | 1516 | { |
1524 | llinfos << "LLGroupMgr::sendUpdateGroupInfo" << llendl; | 1517 | lldebugs << "LLGroupMgr::sendUpdateGroupInfo" << llendl; |
1525 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1518 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1526 | 1519 | ||
1527 | LLMessageSystem* msg = gMessageSystem; | 1520 | LLMessageSystem* msg = gMessageSystem; |
@@ -1550,18 +1543,16 @@ void LLGroupMgr::sendUpdateGroupInfo(const LLUUID& group_id) | |||
1550 | 1543 | ||
1551 | void LLGroupMgr::sendGroupRoleMemberChanges(const LLUUID& group_id) | 1544 | void LLGroupMgr::sendGroupRoleMemberChanges(const LLUUID& group_id) |
1552 | { | 1545 | { |
1553 | llinfos << "LLGroupMgr::sendGroupRoleMemberChanges" << llendl; | 1546 | lldebugs << "LLGroupMgr::sendGroupRoleMemberChanges" << llendl; |
1554 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); | 1547 | LLGroupMgrGroupData* group_datap = createGroupData(group_id); |
1555 | 1548 | ||
1556 | if (group_datap->mRoleMemberChanges.empty()) return; | 1549 | if (group_datap->mRoleMemberChanges.empty()) return; |
1557 | 1550 | ||
1558 | LLMessageSystem* msg = gMessageSystem; | 1551 | LLMessageSystem* msg = gMessageSystem; |
1559 | 1552 | ||
1560 | change_map::const_iterator citer = group_datap->mRoleMemberChanges.begin(); | ||
1561 | change_map::const_iterator end = group_datap->mRoleMemberChanges.end(); | ||
1562 | bool start_message = true; | 1553 | bool start_message = true; |
1563 | 1554 | for (LLGroupMgrGroupData::change_map_t::const_iterator citer = group_datap->mRoleMemberChanges.begin(); | |
1564 | for ( ; citer != end; ++citer) | 1555 | citer != group_datap->mRoleMemberChanges.end(); ++citer) |
1565 | { | 1556 | { |
1566 | if (start_message) | 1557 | if (start_message) |
1567 | { | 1558 | { |
@@ -1618,9 +1609,8 @@ void LLGroupMgr::sendGroupMemberInvites(const LLUUID& group_id, std::map<LLUUID, | |||
1618 | bool start_message = true; | 1609 | bool start_message = true; |
1619 | LLMessageSystem* msg = gMessageSystem; | 1610 | LLMessageSystem* msg = gMessageSystem; |
1620 | 1611 | ||
1621 | std::map<LLUUID,LLUUID>::iterator it = member_role_pairs.begin(); | 1612 | for (std::map<LLUUID,LLUUID>::iterator it = member_role_pairs.begin(); |
1622 | std::map<LLUUID,LLUUID>::iterator end = member_role_pairs.end(); | 1613 | it != member_role_pairs.end(); ++it) |
1623 | for ( ; it != end; ++it) | ||
1624 | { | 1614 | { |
1625 | if (start_message) | 1615 | if (start_message) |
1626 | { | 1616 | { |
@@ -1660,15 +1650,14 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, | |||
1660 | LLGroupMgrGroupData* group_datap = gGroupMgr->getGroupData(group_id); | 1650 | LLGroupMgrGroupData* group_datap = gGroupMgr->getGroupData(group_id); |
1661 | if (!group_datap) return; | 1651 | if (!group_datap) return; |
1662 | 1652 | ||
1663 | std::vector<LLUUID>::iterator it = member_ids.begin(); | 1653 | for (std::vector<LLUUID>::iterator it = member_ids.begin(); |
1664 | std::vector<LLUUID>::iterator end = member_ids.end(); | 1654 | it != member_ids.end(); ++it) |
1665 | for ( ; it != end; ++it) | ||
1666 | { | 1655 | { |
1667 | // Can't use 'eject' to leave a group. | 1656 | // Can't use 'eject' to leave a group. |
1668 | if ((*it) == gAgent.getID()) continue; | 1657 | if ((*it) == gAgent.getID()) continue; |
1669 | 1658 | ||
1670 | // Make sure they are in the group, and we need the member data | 1659 | // Make sure they are in the group, and we need the member data |
1671 | LLGroupMgrGroupData::member_iter mit = group_datap->mMembers.find(*it); | 1660 | LLGroupMgrGroupData::member_list_t::iterator mit = group_datap->mMembers.find(*it); |
1672 | if (mit != group_datap->mMembers.end()) | 1661 | if (mit != group_datap->mMembers.end()) |
1673 | { | 1662 | { |
1674 | // Add them to the message | 1663 | // Add them to the message |
@@ -1693,9 +1682,8 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, | |||
1693 | } | 1682 | } |
1694 | 1683 | ||
1695 | // Clean up groupmgr | 1684 | // Clean up groupmgr |
1696 | std::map<LLUUID,LLGroupRoleData*>::iterator rit = (*mit).second->roleBegin(); | 1685 | for (LLGroupMemberData::role_list_t::iterator rit = (*mit).second->roleBegin(); |
1697 | std::map<LLUUID,LLGroupRoleData*>::iterator rend = (*mit).second->roleEnd(); | 1686 | rit != (*mit).second->roleEnd(); ++rit) |
1698 | for ( ; rit != rend; ++rit) | ||
1699 | { | 1687 | { |
1700 | if ((*rit).first.notNull()) | 1688 | if ((*rit).first.notNull()) |
1701 | { | 1689 | { |
@@ -1715,7 +1703,7 @@ void LLGroupMgr::sendGroupMemberEjects(const LLUUID& group_id, | |||
1715 | 1703 | ||
1716 | void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) | 1704 | void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) |
1717 | { | 1705 | { |
1718 | llinfos << "LLGroupMgr::sendGroupRoleChanges" << llendl; | 1706 | lldebugs << "LLGroupMgr::sendGroupRoleChanges" << llendl; |
1719 | LLGroupMgrGroupData* group_datap = getGroupData(group_id); | 1707 | LLGroupMgrGroupData* group_datap = getGroupData(group_id); |
1720 | 1708 | ||
1721 | if (group_datap && group_datap->pendingRoleChanges()) | 1709 | if (group_datap && group_datap->pendingRoleChanges()) |
@@ -1730,7 +1718,7 @@ void LLGroupMgr::sendGroupRoleChanges(const LLUUID& group_id) | |||
1730 | 1718 | ||
1731 | void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id) | 1719 | void LLGroupMgr::cancelGroupRoleChanges(const LLUUID& group_id) |
1732 | { | 1720 | { |
1733 | llinfos << "LLGroupMgr::cancelGroupRoleChanges" << llendl; | 1721 | lldebugs << "LLGroupMgr::cancelGroupRoleChanges" << llendl; |
1734 | LLGroupMgrGroupData* group_datap = getGroupData(group_id); | 1722 | LLGroupMgrGroupData* group_datap = getGroupData(group_id); |
1735 | 1723 | ||
1736 | if (group_datap) group_datap->cancelRoleChanges(); | 1724 | if (group_datap) group_datap->cancelRoleChanges(); |
@@ -1750,11 +1738,10 @@ bool LLGroupMgr::parseRoleActions(const LLString& xml_filename) | |||
1750 | } | 1738 | } |
1751 | 1739 | ||
1752 | LLXMLNodeList role_list; | 1740 | LLXMLNodeList role_list; |
1753 | LLXMLNodeList::iterator role_iter; | ||
1754 | 1741 | ||
1755 | root->getChildren("action_set", role_list, false); | 1742 | root->getChildren("action_set", role_list, false); |
1756 | 1743 | ||
1757 | for (role_iter = role_list.begin(); role_iter != role_list.end(); ++role_iter) | 1744 | for (LLXMLNodeList::iterator role_iter = role_list.begin(); role_iter != role_list.end(); ++role_iter) |
1758 | { | 1745 | { |
1759 | LLXMLNodePtr action_set = role_iter->second; | 1746 | LLXMLNodePtr action_set = role_iter->second; |
1760 | 1747 | ||