summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermessage.cpp
diff options
context:
space:
mode:
authorJonathan Yap <none@none>2014-03-07 12:50:08 -0500
committerJonathan Yap <none@none>2014-03-07 12:50:08 -0500
commit2d6314f93fb5e7bf5f0494d8f9e746a647daa52b (patch)
tree61e0536ec4bd6e2f25949eba824e2f87697bc551 /indra/newview/llviewermessage.cpp
parentde8fea13627cc5978b8a6135802a52864a11c39a (diff)
STORM-2018 Group invite fails to let you join groups when groups maxed even when you leave group
Diffstat (limited to 'indra/newview/llviewermessage.cpp')
-rwxr-xr-xindra/newview/llviewermessage.cpp55
1 files changed, 46 insertions, 9 deletions
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 267aa9532c..9d80e0c04c 100755
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -644,25 +644,58 @@ void send_sound_trigger(const LLUUID& sound_id, F32 gain)
gAgent.sendMessage();
}
+static LLSD sSavedGroupInvite;
+static LLSD sSavedResponse;
+
bool join_group_response(const LLSD& notification, const LLSD& response)
{
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+// A bit of variable saving and restoring is used to deal with the case where your group list is full and you
+// receive an invitation to another group. The data from that invitation is stored in the sSaved
+// variables. If you then drop a group and click on the Join button the stored data is restored and used
+// to join the group.
+ LLSD notification_adjusted = notification;
+ LLSD response_adjusted = response;
+
+ std::string action = notification["name"];
+
+// Storing all the information by group id allows for the rare case of being at your maximum
+// group count and receiving more than one invitation.
+ std::string id = notification_adjusted["payload"]["group_id"].asString();
+
+ if ("JoinGroup" == action || "JoinGroupCanAfford" == action)
+ {
+ sSavedGroupInvite[id] = notification;
+ sSavedResponse[id] = response;
+ }
+
+ if ("JoinedTooManyGroupsMember" == action)
+ {
+ S32 opt = LLNotificationsUtil::getSelectedOption(notification, response);
+ if (0 == opt) // Join button pressed
+ {
+ notification_adjusted = sSavedGroupInvite[id];
+ response_adjusted = sSavedResponse[id];
+ }
+ }
+
+ S32 option = LLNotificationsUtil::getSelectedOption(notification_adjusted, response_adjusted);
bool accept_invite = false;
- LLUUID group_id = notification["payload"]["group_id"].asUUID();
- LLUUID transaction_id = notification["payload"]["transaction_id"].asUUID();
- std::string name = notification["payload"]["name"].asString();
- std::string message = notification["payload"]["message"].asString();
- S32 fee = notification["payload"]["fee"].asInteger();
+ LLUUID group_id = notification_adjusted["payload"]["group_id"].asUUID();
+ LLUUID transaction_id = notification_adjusted["payload"]["transaction_id"].asUUID();
+ std::string name = notification_adjusted["payload"]["name"].asString();
+ std::string message = notification_adjusted["payload"]["message"].asString();
+ S32 fee = notification_adjusted["payload"]["fee"].asInteger();
if (option == 2 && !group_id.isNull())
{
LLGroupActions::show(group_id);
LLSD args;
args["MESSAGE"] = message;
- LLNotificationsUtil::add("JoinGroup", args, notification["payload"]);
+ LLNotificationsUtil::add("JoinGroup", args, notification_adjusted["payload"]);
return false;
}
+
if(option == 0 && !group_id.isNull())
{
// check for promotion or demotion.
@@ -677,7 +710,8 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
{
LLSD args;
args["NAME"] = name;
- LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification["payload"]);
+ LLNotificationsUtil::add("JoinedTooManyGroupsMember", args, notification_adjusted["payload"]);
+ return false;
}
}
@@ -691,7 +725,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
args["COST"] = llformat("%d", fee);
// Set the fee for next time to 0, so that we don't keep
// asking about a fee.
- LLSD next_payload = notification["payload"];
+ LLSD next_payload = notification_adjusted["payload"];
next_payload["fee"] = 0;
LLNotificationsUtil::add("JoinGroupCanAfford",
args,
@@ -717,6 +751,9 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
transaction_id);
}
+ sSavedGroupInvite[id] = LLSD::emptyMap();
+ sSavedResponse[id] = LLSD::emptyMap();
+
return false;
}