diff options
author | Baker Linden <baker@lindenlab.com> | 2013-08-30 16:38:25 -0700 |
---|---|---|
committer | Baker Linden <baker@lindenlab.com> | 2013-08-30 16:38:25 -0700 |
commit | 1299f6d63fbe313329e6e5ced7be797e2a23d6a7 (patch) | |
tree | b228a3f7e776afb16bae94d86ff4eb75e7ccb847 | |
parent | 4945ae17d3692f089ce6c996f6585a5e5b308e4d (diff) |
- Got all major functionality working
- Changed PUT and DEL to POST which accepts an enum for a create or delete
-rwxr-xr-x | indra/newview/llgroupmgr.cpp | 43 | ||||
-rwxr-xr-x | indra/newview/llgroupmgr.h | 21 | ||||
-rw-r--r-- | indra/newview/llpanelgroupbulkban.cpp | 2 | ||||
-rwxr-xr-x | indra/newview/llpanelgroupinvite.cpp | 3 | ||||
-rwxr-xr-x | indra/newview/llpanelgrouproles.cpp | 90 | ||||
-rwxr-xr-x | indra/newview/llpanelgrouproles.h | 4 |
6 files changed, 88 insertions, 75 deletions
diff --git a/indra/newview/llgroupmgr.cpp b/indra/newview/llgroupmgr.cpp index 0d4b678019..bfdb8588e4 100755 --- a/indra/newview/llgroupmgr.cpp +++ b/indra/newview/llgroupmgr.cpp @@ -235,8 +235,7 @@ LLGroupMgrGroupData::LLGroupMgrGroupData(const LLUUID& id) : mRoleDataComplete(false), mRoleMemberDataComplete(false), mGroupPropertiesDataComplete(false), - mGroupBanStatus(STATUS_INIT), - mGroupBanDataComplete(false), + mGroupBanStatus(LLGroupMgrGroupData::STATUS_INIT), mPendingRoleMemberRequest(false), mAccessTime(0.0f) { @@ -748,13 +747,14 @@ void LLGroupMgrGroupData::cancelRoleChanges() void LLGroupMgrGroupData::createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data) { mBanList[ban_id] = ban_data; + // Refresh the list } -bool LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id) +void LLGroupMgrGroupData::removeBanEntry(const LLUUID& ban_id) { // Once we get this hooked up to the backend, we want to confirm the create or delete worked. mBanList.erase(ban_id); - return true; + // Refresh the list } @@ -1880,7 +1880,10 @@ void GroupBanDataResponder::result(const LLSD& content) LLGroupMgr::processGroupBanRequest(content); } -void LLGroupMgr::sendGroupBanRequest(EBanRequestType request_type, const LLUUID& group_id, const std::vector<LLUUID> ban_list /* = std::vector<LLUUID>() */) +void LLGroupMgr::sendGroupBanRequest( EBanRequestType request_type, + const LLUUID& group_id, + EBanRequestAction ban_action, /* = BAN_NO_ACTION */ + const std::vector<LLUUID> ban_list) /* = std::vector<LLUUID>() */ { LLViewerRegion* currentRegion = gAgent.getRegion(); if(!currentRegion) @@ -1902,39 +1905,31 @@ void LLGroupMgr::sendGroupBanRequest(EBanRequestType request_type, const LLUUID& { return; } + cap_url += "?group_id=" + group_id.asString(); - LLHTTPClient::ResponderPtr grp_ban_responder = new GroupBanDataResponder(); - // PUT to our service. Add a body containing the group_id and list of agents to ban. - LLSD ban_ids = LLSD::emptyMap(); - ban_ids["group_id"] = group_id; + LLSD body = LLSD::emptyMap(); + body["ban_action"] = ban_action; // Add our list of potential banned agents to the list - ban_ids["ban_ids"] = LLSD::emptyArray(); + body["ban_ids"] = LLSD::emptyArray(); LLSD ban_entry; - std::vector<LLUUID>::const_iterator iter = ban_list.cbegin(); + + uuid_vec_t::const_iterator iter = ban_list.begin(); for(;iter != ban_list.end(); ++iter) { ban_entry = (*iter); - ban_ids["ban_ids"].append(ban_entry); + body["ban_ids"].append(ban_entry); } + LLHTTPClient::ResponderPtr grp_ban_responder = new GroupBanDataResponder(); switch(request_type) { case REQUEST_GET: - cap_url += "?group_id=" + group_id.asString(); LLHTTPClient::get(cap_url, grp_ban_responder); break; - case REQUEST_PUT: - // BAKER TODO: Figure out which 'body' is correct. - LLHTTPClient::put(cap_url, ban_ids, grp_ban_responder, LLSD(), 60); - break; - case REQUEST_DEL: - LLHTTPClient::del(cap_url, grp_ban_responder, ban_ids, 60); + case REQUEST_POST: + LLHTTPClient::post(cap_url, body, grp_ban_responder); break; } - - LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(group_id); - if (gdatap) - gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); } @@ -1953,7 +1948,7 @@ void LLGroupMgr::processGroupBanRequest(const LLSD& content) if (!gdatap) return; - LLSD banlist = LLSD::emptyMap(); + //LLSD banlist = LLSD::emptyMap(); LLSD::map_const_iterator i = content["ban_list"].beginMap(); diff --git a/indra/newview/llgroupmgr.h b/indra/newview/llgroupmgr.h index 876883e87e..49e354a26c 100755 --- a/indra/newview/llgroupmgr.h +++ b/indra/newview/llgroupmgr.h @@ -215,7 +215,7 @@ friend class LLGroupMgr; public: enum EGroupDataStatus { - STATUS_NONE, + STATUS_INIT, STATUS_REQUESTING, STATUS_COMPLETE }; @@ -250,7 +250,6 @@ public: bool isRoleDataComplete() { return mRoleDataComplete; } bool isRoleMemberDataComplete() { return mRoleMemberDataComplete; } bool isGroupPropertiesDataComplete() { return mGroupPropertiesDataComplete; } - bool isGroupBanDataComplete() { return mGroupBanDataComplete; } EGroupDataStatus getGroupBanStatus() { return mGroupBanStatus; } void setGroupBanStatus(EGroupDataStatus status) { mGroupBanStatus = status; } @@ -269,7 +268,7 @@ public: const LLGroupBanData& getBanEntry(const LLUUID& ban_id) { return mBanList[ban_id]; } void createBanEntry(const LLUUID& ban_id, const LLGroupBanData& ban_data = LLGroupBanData()); - bool removeBanEntry(const LLUUID& ban_id); + void removeBanEntry(const LLUUID& ban_id); @@ -322,8 +321,6 @@ private: bool mGroupPropertiesDataComplete; EGroupDataStatus mGroupBanStatus; - bool mGroupBanDataComplete; - bool mGroupBanDataPending; bool mPendingRoleMemberRequest; F32 mAccessTime; @@ -356,10 +353,18 @@ public: enum EBanRequestType { REQUEST_GET = 0, + REQUEST_POST, REQUEST_PUT, REQUEST_DEL }; + enum EBanRequestAction + { + BAN_NO_ACTION = 0, + BAN_CREATE = 1, + BAN_DELETE = 2 + }; + public: LLGroupMgr(); ~LLGroupMgr(); @@ -394,7 +399,11 @@ public: static void sendGroupMemberEjects(const LLUUID& group_id, uuid_vec_t& member_ids); // BAKER - Group Ban - static void sendGroupBanRequest(EBanRequestType request_type, const LLUUID& group_id, const std::vector<LLUUID> ban_list = std::vector<LLUUID>()); + static void sendGroupBanRequest(EBanRequestType request_type, + const LLUUID& group_id, + EBanRequestAction ban_action = BAN_NO_ACTION, + const uuid_vec_t ban_list = uuid_vec_t()); + static void processGroupBanRequest(const LLSD& content); // BAKER diff --git a/indra/newview/llpanelgroupbulkban.cpp b/indra/newview/llpanelgroupbulkban.cpp index 57bab0c813..d6bb669275 100644 --- a/indra/newview/llpanelgroupbulkban.cpp +++ b/indra/newview/llpanelgroupbulkban.cpp @@ -141,7 +141,7 @@ void LLPanelGroupBulkBan::submit() return; } - LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_PUT, mImplementation->mGroupID, banned_agent_list); + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mImplementation->mGroupID, LLGroupMgr::BAN_CREATE, banned_agent_list); // BAKER TEMP: // For now, don't close, but clear the list. diff --git a/indra/newview/llpanelgroupinvite.cpp b/indra/newview/llpanelgroupinvite.cpp index c990584d22..43d94b36fc 100755 --- a/indra/newview/llpanelgroupinvite.cpp +++ b/indra/newview/llpanelgroupinvite.cpp @@ -48,9 +48,6 @@ #include "llviewerwindow.h" -// BAKER TODO: -// Figure out how to use LLHandle<LLPanel> to make this safer -//bool invite_owner_callback(LLPanelGroupInvite panel, const LLSD& notification, const LLSD& response) bool invite_owner_callback(LLHandle<LLPanel> panel_handle, const LLSD& notification, const LLSD& response) { LLPanelGroupInvite* panel = dynamic_cast<LLPanelGroupInvite*>(panel_handle.get()); diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp index 8d7b3c38ee..f3cb9900fe 100755 --- a/indra/newview/llpanelgrouproles.cpp +++ b/indra/newview/llpanelgrouproles.cpp @@ -1763,18 +1763,20 @@ void LLPanelGroupMembersSubTab::handleBanMember() return; } + uuid_vec_t ban_ids; std::vector<LLScrollListItem*>::iterator itor; for(itor = selection.begin(); itor != selection.end(); ++itor) { LLUUID ban_id = (*itor)->getUUID(); + ban_ids.push_back(ban_id); + LLGroupBanData ban_data; - - // DEL to People API somewhere in this chain... gdatap->createBanEntry(ban_id, ban_data); - mMembersList->removeNameItem(ban_id); - } + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_CREATE, ban_ids); + // Will this work? + handleEjectMembers(); } @@ -2721,8 +2723,7 @@ LLPanelGroupBanListSubTab::LLPanelGroupBanListSubTab() : LLPanelGroupSubTab(), mBanList(NULL), mCreateBanButton(NULL), - mDeleteBanButton(NULL), - mUpdateBanList(true) + mDeleteBanButton(NULL) { LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::ctor()" << LL_ENDL; } @@ -2763,6 +2764,13 @@ BOOL LLPanelGroupBanListSubTab::postBuildSubTab(LLView* root) setFooterEnabled(FALSE); + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + if(gdatap && (gdatap->getGroupBanStatus() == LLGroupMgrGroupData::STATUS_INIT)) + { + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); + gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); + } + return TRUE; } @@ -2809,8 +2817,8 @@ void LLPanelGroupBanListSubTab::update(LLGroupChange gc) { LL_INFOS("BAKER") << "[BAKER] LLPanelGroupBanListSubTab::update()" << LL_ENDL; - if (gc != GC_ALL || gc != GC_BANLIST) - return; + //if (gc != GC_ALL && gc != GC_BANLIST) + // return; LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); if(!gdatap) @@ -2826,6 +2834,7 @@ void LLPanelGroupBanListSubTab::update(LLGroupChange gc) // Request our ban list! case LLGroupMgrGroupData::STATUS_INIT: LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); + gdatap->setGroupBanStatus(LLGroupMgrGroupData::STATUS_REQUESTING); break; // Already have a request out -- don't bother sending another one @@ -2839,31 +2848,38 @@ void LLPanelGroupBanListSubTab::update(LLGroupChange gc) // [SOMETHING CHANGED] - Don't panic! Just repopulate the ban list! case LLGroupMgrGroupData::STATUS_COMPLETE: populateBanList(); - - break; } } +void LLPanelGroupBanListSubTab::draw() +{ + LLPanelGroupSubTab::draw(); + + // if(mPendingBanUpdate) + // populateBanList(); +} void LLPanelGroupBanListSubTab::populateBanList() { - //if(gdatap->getGroupBanStatus() == ) - + LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); + if(!gdatap) + { + LL_INFOS("BAKER") << "[BAKER] No group data!" << LL_ENDL; + return; + } + if(gdatap->getGroupBanStatus() != LLGroupMgrGroupData::STATUS_COMPLETE) + return; -// mBanList->deleteAllItems(); -// LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_GET, mGroupID); -// -// std::map<LLUUID,LLGroupBanData>::const_iterator entry = gdatap->mBanList.begin(); -// for(; entry != gdatap->mBanList.end(); entry++) -// { -// LLNameListCtrl::NameItem ban_entry; -// ban_entry.value = entry->first; -// mBanList->addNameItemRow(ban_entry); -// } - - mUpdateBanList = false; + mBanList->deleteAllItems(); + std::map<LLUUID,LLGroupBanData>::const_iterator entry = gdatap->mBanList.begin(); + for(; entry != gdatap->mBanList.end(); entry++) + { + LLNameListCtrl::NameItem ban_entry; + ban_entry.value = entry->first; + mBanList->addNameItemRow(ban_entry); + } } @@ -2885,7 +2901,7 @@ void LLPanelGroupBanListSubTab::handleBanEntrySelect() // BAKER TODO: -- MOVE TO SELECT BAN ENTRY // Make sure only authorized people have access to adding / deleting bans //if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) - mCreateBanButton->setEnabled(TRUE); + mCreateBanButton->setEnabled(TRUE); // Check if the agent has the ability to unban this person //if (gAgent.hasPowerInGroup(mGroupID, GP_GROUP_BAN_ACCESS)) @@ -3000,26 +3016,22 @@ void LLPanelGroupBanListSubTab::handleDeleteBanEntry() } } + std::vector<LLUUID> ban_ids; std::vector<LLScrollListItem*>::iterator itor; for(itor = selection.begin(); itor != selection.end(); ++itor) { - // STUB - // Attempt to remove entry from the database - // If there was a problem with the delete, don't remove it from the list yet! - // Otherwise, remove it from our local list. - // - LLUUID ban_id = (*itor)->getUUID(); - if(gdatap->removeBanEntry(ban_id)) - { - mBanList->removeNameItem(ban_id); - // Removing an item removes the selection, we shouldn't be able to click - // the button anymore until we reselect another entry. - mDeleteBanButton->setEnabled(FALSE); - } + ban_ids.push_back(ban_id); + + //gdatap->removeBanEntry(ban_id); + //mBanList->removeNameItem(ban_id); + + // Removing an item removes the selection, we shouldn't be able to click + // the button anymore until we reselect another entry. + mDeleteBanButton->setEnabled(FALSE); } - + LLGroupMgr::getInstance()->sendGroupBanRequest(LLGroupMgr::REQUEST_POST, mGroupID, LLGroupMgr::BAN_DELETE, ban_ids); } diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h index 1695097fc5..01c1d8c16d 100755 --- a/indra/newview/llpanelgrouproles.h +++ b/indra/newview/llpanelgrouproles.h @@ -335,6 +335,8 @@ public: // Triggered when group information changes in the group manager. virtual void update(LLGroupChange gc); + // + virtual void draw(); static void onBanEntrySelect(LLUICtrl* ctrl, void* user_data); void handleBanEntrySelect(); @@ -358,8 +360,6 @@ protected: LLNameListCtrl* mBanList; LLButton* mCreateBanButton; LLButton* mDeleteBanButton; - - bool mUpdateBanList; }; |