diff options
Diffstat (limited to 'linden/indra/newview/llpanelgroupinvite.cpp')
-rw-r--r-- | linden/indra/newview/llpanelgroupinvite.cpp | 81 |
1 files changed, 61 insertions, 20 deletions
diff --git a/linden/indra/newview/llpanelgroupinvite.cpp b/linden/indra/newview/llpanelgroupinvite.cpp index c393854..e051bb6 100644 --- a/linden/indra/newview/llpanelgroupinvite.cpp +++ b/linden/indra/newview/llpanelgroupinvite.cpp | |||
@@ -42,7 +42,8 @@ | |||
42 | #include "lltextbox.h" | 42 | #include "lltextbox.h" |
43 | #include "llviewerobject.h" | 43 | #include "llviewerobject.h" |
44 | #include "llviewerobjectlist.h" | 44 | #include "llviewerobjectlist.h" |
45 | #include "llvieweruictrlfactory.h" | 45 | #include "lluictrlfactory.h" |
46 | #include "llviewerwindow.h" | ||
46 | 47 | ||
47 | class LLPanelGroupInvite::impl | 48 | class LLPanelGroupInvite::impl |
48 | { | 49 | { |
@@ -65,6 +66,7 @@ public: | |||
65 | static void callbackAddUsers(const std::vector<std::string>& names, | 66 | static void callbackAddUsers(const std::vector<std::string>& names, |
66 | const std::vector<LLUUID>& agent_ids, | 67 | const std::vector<LLUUID>& agent_ids, |
67 | void* user_data); | 68 | void* user_data); |
69 | static void inviteOwnerCallback(S32 option, void* userdata); | ||
68 | 70 | ||
69 | public: | 71 | public: |
70 | LLUUID mGroupID; | 72 | LLUUID mGroupID; |
@@ -75,6 +77,8 @@ public: | |||
75 | LLButton *mOKButton; | 77 | LLButton *mOKButton; |
76 | LLButton *mRemoveButton; | 78 | LLButton *mRemoveButton; |
77 | LLTextBox *mGroupName; | 79 | LLTextBox *mGroupName; |
80 | LLString mOwnerWarning; | ||
81 | bool mConfirmedOwnerInvite; | ||
78 | 82 | ||
79 | void (*mCloseCallback)(void* data); | 83 | void (*mCloseCallback)(void* data); |
80 | 84 | ||
@@ -82,16 +86,18 @@ public: | |||
82 | }; | 86 | }; |
83 | 87 | ||
84 | 88 | ||
85 | LLPanelGroupInvite::impl::impl(const LLUUID& group_id) | 89 | LLPanelGroupInvite::impl::impl(const LLUUID& group_id): |
90 | mGroupID( group_id ), | ||
91 | mLoadingText (), | ||
92 | mInvitees ( NULL ), | ||
93 | mRoleNames( NULL ), | ||
94 | mOKButton ( NULL ), | ||
95 | mRemoveButton( NULL ), | ||
96 | mGroupName( NULL ), | ||
97 | mConfirmedOwnerInvite( false ), | ||
98 | mCloseCallback( NULL ), | ||
99 | mCloseCallbackUserData( NULL ) | ||
86 | { | 100 | { |
87 | mGroupID = group_id; | ||
88 | |||
89 | mInvitees = NULL; | ||
90 | mRoleNames = NULL; | ||
91 | mRemoveButton = NULL; | ||
92 | |||
93 | mCloseCallback = NULL; | ||
94 | mCloseCallbackUserData = NULL; | ||
95 | } | 101 | } |
96 | 102 | ||
97 | LLPanelGroupInvite::impl::~impl() | 103 | LLPanelGroupInvite::impl::~impl() |
@@ -140,12 +146,23 @@ void LLPanelGroupInvite::impl::submitInvitations() | |||
140 | { | 146 | { |
141 | std::map<LLUUID, LLUUID> role_member_pairs; | 147 | std::map<LLUUID, LLUUID> role_member_pairs; |
142 | 148 | ||
149 | LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID); | ||
150 | |||
143 | // Default to everyone role. | 151 | // Default to everyone role. |
144 | LLUUID role_id = LLUUID::null; | 152 | LLUUID role_id = LLUUID::null; |
145 | 153 | ||
146 | if (mRoleNames) | 154 | if (mRoleNames) |
147 | { | 155 | { |
148 | role_id = mRoleNames->getCurrentID(); | 156 | role_id = mRoleNames->getCurrentID(); |
157 | |||
158 | // owner role: display confirmation and wait for callback | ||
159 | if ((role_id == gdatap->mOwnerRole) && (!mConfirmedOwnerInvite)) | ||
160 | { | ||
161 | LLString::format_map_t args; | ||
162 | args["[MESSAGE]"] = mOwnerWarning; | ||
163 | gViewerWindow->alertXml("GenericAlertYesCancel", args, inviteOwnerCallback, this); | ||
164 | return; // we'll be called again if user confirms | ||
165 | } | ||
149 | } | 166 | } |
150 | 167 | ||
151 | //loop over the users | 168 | //loop over the users |
@@ -157,12 +174,34 @@ void LLPanelGroupInvite::impl::submitInvitations() | |||
157 | role_member_pairs[item->getUUID()] = role_id; | 174 | role_member_pairs[item->getUUID()] = role_id; |
158 | } | 175 | } |
159 | 176 | ||
160 | gGroupMgr->sendGroupMemberInvites(mGroupID, role_member_pairs); | 177 | LLGroupMgr::getInstance()->sendGroupMemberInvites(mGroupID, role_member_pairs); |
161 | 178 | ||
162 | //then close | 179 | //then close |
163 | (*mCloseCallback)(mCloseCallbackUserData); | 180 | (*mCloseCallback)(mCloseCallbackUserData); |
164 | } | 181 | } |
165 | 182 | ||
183 | //static | ||
184 | void LLPanelGroupInvite::impl::inviteOwnerCallback(S32 option, void* userdata) | ||
185 | { | ||
186 | LLPanelGroupInvite::impl* self = (LLPanelGroupInvite::impl*)userdata; | ||
187 | if (!self) return; | ||
188 | |||
189 | switch(option) | ||
190 | { | ||
191 | case 0: | ||
192 | // user confirmed that they really want a new group owner | ||
193 | self->mConfirmedOwnerInvite = true; | ||
194 | self->submitInvitations(); | ||
195 | break; | ||
196 | case 1: | ||
197 | // fall through | ||
198 | default: | ||
199 | break; | ||
200 | } | ||
201 | } | ||
202 | |||
203 | |||
204 | |||
166 | void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap) | 205 | void LLPanelGroupInvite::impl::addRoleNames(LLGroupMgrGroupData* gdatap) |
167 | { | 206 | { |
168 | LLGroupMgrGroupData::member_list_t::iterator agent_iter = | 207 | LLGroupMgrGroupData::member_list_t::iterator agent_iter = |
@@ -323,7 +362,7 @@ LLPanelGroupInvite::LLPanelGroupInvite(const std::string& name, | |||
323 | std::string panel_def_file; | 362 | std::string panel_def_file; |
324 | 363 | ||
325 | // Pass on construction of this panel to the control factory. | 364 | // Pass on construction of this panel to the control factory. |
326 | gUICtrlFactory->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); | 365 | LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_invite.xml", &getFactoryMap()); |
327 | } | 366 | } |
328 | 367 | ||
329 | LLPanelGroupInvite::~LLPanelGroupInvite() | 368 | LLPanelGroupInvite::~LLPanelGroupInvite() |
@@ -412,8 +451,8 @@ void LLPanelGroupInvite::update() | |||
412 | 451 | ||
413 | void LLPanelGroupInvite::updateLists() | 452 | void LLPanelGroupInvite::updateLists() |
414 | { | 453 | { |
415 | LLGroupMgrGroupData* gdatap = gGroupMgr->getGroupData(mImplementation->mGroupID); | 454 | LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mImplementation->mGroupID); |
416 | BOOL waiting = FALSE; | 455 | bool waiting = false; |
417 | 456 | ||
418 | if (gdatap) | 457 | if (gdatap) |
419 | { | 458 | { |
@@ -426,7 +465,7 @@ void LLPanelGroupInvite::updateLists() | |||
426 | } | 465 | } |
427 | else | 466 | else |
428 | { | 467 | { |
429 | waiting = TRUE; | 468 | waiting = true; |
430 | } | 469 | } |
431 | if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()) | 470 | if (gdatap->isRoleDataComplete() && gdatap->isMemberDataComplete()) |
432 | { | 471 | { |
@@ -442,21 +481,21 @@ void LLPanelGroupInvite::updateLists() | |||
442 | } | 481 | } |
443 | else | 482 | else |
444 | { | 483 | { |
445 | waiting = TRUE; | 484 | waiting = true; |
446 | } | 485 | } |
447 | } | 486 | } |
448 | else | 487 | else |
449 | { | 488 | { |
450 | waiting = TRUE; | 489 | waiting = true; |
451 | } | 490 | } |
452 | 491 | ||
453 | if (waiting) | 492 | if (waiting) |
454 | { | 493 | { |
455 | if (!mPendingUpdate) | 494 | if (!mPendingUpdate) |
456 | { | 495 | { |
457 | gGroupMgr->sendGroupPropertiesRequest(mImplementation->mGroupID); | 496 | LLGroupMgr::getInstance()->sendGroupPropertiesRequest(mImplementation->mGroupID); |
458 | gGroupMgr->sendGroupMembersRequest(mImplementation->mGroupID); | 497 | LLGroupMgr::getInstance()->sendGroupMembersRequest(mImplementation->mGroupID); |
459 | gGroupMgr->sendGroupRoleDataRequest(mImplementation->mGroupID); | 498 | LLGroupMgr::getInstance()->sendGroupRoleDataRequest(mImplementation->mGroupID); |
460 | } | 499 | } |
461 | mPendingUpdate = TRUE; | 500 | mPendingUpdate = TRUE; |
462 | } | 501 | } |
@@ -523,6 +562,8 @@ BOOL LLPanelGroupInvite::postBuild() | |||
523 | button->setCallbackUserData(mImplementation); | 562 | button->setCallbackUserData(mImplementation); |
524 | } | 563 | } |
525 | 564 | ||
565 | mImplementation->mOwnerWarning = getString("confirm_invite_owner_str"); | ||
566 | |||
526 | update(); | 567 | update(); |
527 | 568 | ||
528 | return (mImplementation->mRoleNames && | 569 | return (mImplementation->mRoleNames && |