merge changes for storm-2018

meow-7.2.2
Oz Linden 2014-03-11 16:43:00 -04:00
commit 54bc8b10ee
2 changed files with 46 additions and 9 deletions

View File

@ -695,6 +695,7 @@ Jonathan Yap
STORM-1986
STORM-1981
STORM-2015
STORM-2018
Kadah Coba
STORM-1060
STORM-1843

View File

@ -644,25 +644,57 @@ 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;
}
else 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 +709,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 +724,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 +750,9 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
transaction_id);
}
sSavedGroupInvite[id] = LLSD::emptyMap();
sSavedResponse[id] = LLSD::emptyMap();
return false;
}