summaryrefslogtreecommitdiff
path: root/indra/newview/llgroupactions.cpp
diff options
context:
space:
mode:
authorJames Cook <james@lindenlab.com>2009-10-16 23:20:05 +0000
committerJames Cook <james@lindenlab.com>2009-10-16 23:20:05 +0000
commita4c657a49dd055cdc773c95b04713f403ea9c44c (patch)
treeab4731917d9d330c636773d4ce5015f59dd070a4 /indra/newview/llgroupactions.cpp
parente3c4b5ad26e6c4583fc2a736aea1370cc06ac6b2 (diff)
Group inspectors now work. They are hooked up to About Land, build tools floater, and anywhere secondlife:///app/group URLs appear. Reviewed with Leyla.
Diffstat (limited to 'indra/newview/llgroupactions.cpp')
-rw-r--r--indra/newview/llgroupactions.cpp66
1 files changed, 64 insertions, 2 deletions
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index d1cbe96906..220fb3c8a0 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -35,13 +35,14 @@
#include "llgroupactions.h"
+// Viewer includes
#include "llagent.h"
+#include "llcommandhandler.h"
#include "llfloaterreg.h"
#include "llgroupmgr.h"
#include "llimview.h" // for gIMMgr
#include "llsidetray.h"
-
-#include "llcommandhandler.h"
+#include "llstatusbar.h" // can_afford_transaction()
//
// Globals
@@ -96,6 +97,13 @@ public:
return true;
}
+ if (tokens[1].asString() == "inspect")
+ {
+ LLSD key;
+ key["group_id"] = group_id;
+ LLFloaterReg::showInstance("inspect_group", key);
+ return true;
+ }
return false;
}
};
@@ -108,6 +116,52 @@ void LLGroupActions::search()
}
// static
+void LLGroupActions::join(const LLUUID& group_id)
+{
+ LLGroupMgrGroupData* gdatap =
+ LLGroupMgr::getInstance()->getGroupData(group_id);
+
+ if (gdatap)
+ {
+ S32 cost = gdatap->mMembershipFee;
+ LLSD args;
+ args["COST"] = llformat("%d", cost);
+ LLSD payload;
+ payload["group_id"] = group_id;
+
+ if (can_afford_transaction(cost))
+ {
+ LLNotifications::instance().add("JoinGroupCanAfford", args, payload, onJoinGroup);
+ }
+ else
+ {
+ LLNotifications::instance().add("JoinGroupCannotAfford", args, payload);
+ }
+ }
+ else
+ {
+ llwarns << "LLGroupMgr::getInstance()->getGroupData(" << group_id
+ << ") was NULL" << llendl;
+ }
+}
+
+// static
+bool LLGroupActions::onJoinGroup(const LLSD& notification, const LLSD& response)
+{
+ S32 option = LLNotification::getSelectedOption(notification, response);
+
+ if (option == 1)
+ {
+ // user clicked cancel
+ return false;
+ }
+
+ LLGroupMgr::getInstance()->
+ sendGroupMemberJoin(notification["payload"]["group_id"].asUUID());
+ return false;
+}
+
+// static
void LLGroupActions::leave(const LLUUID& group_id)
{
if (group_id.isNull())
@@ -240,6 +294,14 @@ void LLGroupActions::startChat(const LLUUID& group_id)
}
// static
+bool LLGroupActions::isInGroup(const LLUUID& group_id)
+{
+ // *TODO: Move all the LLAgent group stuff into another class, such as
+ // this one.
+ return gAgent.isInGroup(group_id);
+}
+
+// static
bool LLGroupActions::isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id)
{
if(group_id.isNull() || avatar_id.isNull())