LLGroupActions too! (Strengthens RLVa restrictions!)

Cleans up llfloatergroupinfo, makes it an instance tracker... pretty much as nice as llfloateravatarinfo now ^*^
Adds notifications JoinGroupNoCost and JoinedTooManyGroups (added to our existing translations, of course)
Cleans up all around, placing groupactions around.

Touches up bits for avataractions
This commit is contained in:
Lirusaito
2013-05-31 07:37:00 -04:00
parent 8d10a21a7a
commit fcd6f217d2
34 changed files with 890 additions and 654 deletions

View File

@@ -91,6 +91,7 @@ set(viewer_SOURCE_FILES
floatervoicelicense.cpp
generichandlers.cpp
hbfloatergrouptitles.cpp
groupchatlistener.cpp
hippofloaterxml.cpp
hippogridmanager.cpp
hippolimits.cpp
@@ -272,6 +273,7 @@ set(viewer_SOURCE_FILES
llgiveinventory.cpp
llgivemoney.cpp
llglsandbox.cpp
llgroupactions.cpp
llgroupmgr.cpp
llgroupnotify.cpp
llhomelocationresponder.cpp
@@ -587,6 +589,7 @@ set(viewer_HEADER_FILES
floaterlocalassetbrowse.h
floatervoicelicense.h
generichandlers.h
groupchatlistener.h
hbfloatergrouptitles.h
hippofloaterxml.h
hippogridmanager.h
@@ -770,6 +773,7 @@ set(viewer_HEADER_FILES
llgesturemgr.h
llgiveinventory.h
llgivemoney.h
llgroupactions.h
llgroupmgr.h
llgroupnotify.h
llhomelocationresponder.h

View File

@@ -0,0 +1,81 @@
/**
* @file groupchatlistener.cpp
* @author Nat Goodspeed
* @date 2011-04-11
* @brief Implementation for groupchatlistener.
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
// Precompiled header
#include "llviewerprecompiledheaders.h"
// associated header
#include "groupchatlistener.h"
// STL headers
// std headers
// external library headers
// other Linden headers
#include "llgroupactions.h"
//#include "llimview.h"
namespace {
void startIm_wrapper(LLSD const & event)
{
LLUUID session_id = LLGroupActions::startIM(event["id"].asUUID());
sendReply(LLSDMap("session_id", LLSD(session_id)), event);
}
/* Singu TODO
void send_message_wrapper(const std::string& text, const LLUUID& session_id, const LLUUID& group_id)
{
LLIMModel::sendMessage(text, session_id, group_id, IM_SESSION_GROUP_START);
}
*/
}
GroupChatListener::GroupChatListener():
LLEventAPI("GroupChat",
"API to enter, leave, send and intercept group chat messages")
{
add("startIM",
"Enter a group chat in group with UUID [\"id\"]\n"
"Assumes the logged-in agent is already a member of this group.",
&startIm_wrapper);
add("endIM",
"Leave a group chat in group with UUID [\"id\"]\n"
"Assumes a prior successful startIM request.",
&LLGroupActions::endIM,
LLSDArray("id"));
/* Singu TODO
add("sendIM",
"send a groupchat IM",
&send_message_wrapper,
LLSDArray("text")("session_id")("group_id"));
*/
}
/*
static void sendMessage(const std::string& utf8_text, const LLUUID& im_session_id,
const LLUUID& other_participant_id, EInstantMessage dialog);
*/

View File

@@ -0,0 +1,41 @@
/**
* @file groupchatlistener.h
* @author Nat Goodspeed
* @date 2011-04-11
* @brief
*
* $LicenseInfo:firstyear=2011&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2011, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#if ! defined(LL_GROUPCHATLISTENER_H)
#define LL_GROUPCHATLISTENER_H
#include "lleventapi.h"
class GroupChatListener: public LLEventAPI
{
public:
GroupChatListener();
};
#endif /* ! defined(LL_GROUPCHATLISTENER_H) */

View File

@@ -40,6 +40,7 @@
#include "hbfloatergrouptitles.h"
#include "llagent.h"
#include "llgroupactions.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
@@ -145,13 +146,7 @@ void HBFloaterGroupTitles::onActivate(void* userdata)
LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID();
if (group_id != old_group_id)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ActivateGroup);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, group_id);
gAgent.sendReliableMessage();
LLGroupActions::activate(group_id);
}
// Set the title

View File

@@ -43,6 +43,7 @@
#include "llfirstuse.h"
#include "llfloatercamera.h"
#include "llfloatertools.h"
#include "llgroupactions.h"
#include "llgroupmgr.h"
#include "llhomelocationresponder.h"
#include "llhudmanager.h"
@@ -3247,7 +3248,7 @@ BOOL LLAgent::downGrabbed() const
void update_group_floaters(const LLUUID& group_id)
{
LLFloaterGroupInfo::refreshGroup(group_id);
LLGroupActions::refresh(group_id);
// update avatar info
LLFloaterAvatarInfo* fa = LLFloaterAvatarInfo::getInstance(gAgent.getID());
@@ -3300,7 +3301,7 @@ void LLAgent::processAgentDropGroup(LLMessageSystem *msg, void **)
LLGroupMgr::getInstance()->clearGroupData(group_id);
// close the floater for this group, if any.
LLFloaterGroupInfo::closeGroup(group_id);
LLGroupActions::closeGroup(group_id);
// refresh the group panel of the search window, if necessary.
LLFloaterDirectory::refreshGroup(group_id);
}
@@ -3379,7 +3380,7 @@ class LLAgentDropGroupViewerNode : public LLHTTPNode
LLGroupMgr::getInstance()->clearGroupData(group_id);
// close the floater for this group, if any.
LLFloaterGroupInfo::closeGroup(group_id);
LLGroupActions::closeGroup(group_id);
// refresh the group panel of the search window,
//if necessary.
LLFloaterDirectory::refreshGroup(group_id);

View File

@@ -389,9 +389,7 @@ void* LLFloaterDirectory::createEventDetail(void* userdata)
void* LLFloaterDirectory::createGroupDetail(void* userdata)
{
LLFloaterDirectory *self = (LLFloaterDirectory*)userdata;
self->mPanelGroupp = new LLPanelGroup("panel_group.xml",
"PanelGroup",
gAgent.getGroupID());
self->mPanelGroupp = new LLPanelGroup(gAgent.getGroupID());
self->mPanelGroupp->setAllowEdit(FALSE || gAgent.isGodlike()); // Gods can always edit panels
self->mPanelGroupp->setVisible(FALSE);
return self->mPanelGroupp;

View File

@@ -36,100 +36,30 @@
#include "llfloatergroupinfo.h"
#include "llagent.h"
#include "llcommandhandler.h"
#include "llfloaterchatterbox.h"
#include "llpanelgroup.h"
#include "llviewermessage.h" // for inventory_offer_callback
//#include "llviewerwindow.h"
#include "llnotifications.h"
#include "llcachename.h"
#include "llpanelgroup.h"
const char FLOATER_TITLE[] = "Group Information";
const LLRect FGI_RECT(0, 530, 420, 0);
//
// Globals
//
std::map<LLUUID, LLFloaterGroupInfo*> LLFloaterGroupInfo::sInstances;
class LLGroupHandler : public LLCommandHandler
{
public:
// requires trusted browser to trigger
LLGroupHandler() : LLCommandHandler("group", true) { }
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
{
if (tokens.size() < 1)
{
return false;
}
if (tokens[0].asString() == "create")
{
LLFloaterGroupInfo::showCreateGroup(NULL);
return true;
}
if (tokens.size() < 2)
{
return false;
}
if (tokens[0].asString() == "list")
{
if (tokens[1].asString() == "show")
{
// CP_TODO: get the value we pass in via the XUI name
// of the tab instead of using a literal like this
LLFloaterMyFriends::showInstance( 1 );
return true;
}
return false;
}
LLUUID group_id;
if (!group_id.set(tokens[0], FALSE))
{
return false;
}
if ((tokens[1].asString() == "about") || (tokens[1].asString() == "inspect"))
{
LLFloaterGroupInfo::showFromUUID(group_id);
return true;
}
return false;
}
};
LLGroupHandler gGroupHandler;
//-----------------------------------------------------------------------------
// Implementation
//-----------------------------------------------------------------------------
LLFloaterGroupInfo::LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id, const std::string& tab_name)
: LLFloater(name, rect, title),
mGroupID( group_id )
LLFloaterGroupInfo::LLFloaterGroupInfo(const LLUUID& group_id)
: LLFloater(FLOATER_TITLE, LLRect(0, 530, 420, 0), FLOATER_TITLE), LLInstanceTracker<LLFloaterGroupInfo, LLUUID>(group_id)
{
llinfos << name << " : " << title << llendl;
llinfos << rect << llendl;
llinfos << getRect() << llendl;
llinfos << getLocalRect() << llendl;
// Construct the filename of the group panel xml definition file.
mPanelGroupp = new LLPanelGroup("panel_group.xml",
"PanelGroup",
group_id,
tab_name);
mPanelGroupp = new LLPanelGroup(group_id);
addChild(mPanelGroupp);
if (group_id.notNull())
{
// Look up the group name. The callback will insert it into the title.
gCacheName->get(group_id, true, boost::bind(&LLFloaterGroupInfo::callbackLoadGroupName, this, _2));
}
}
// virtual
LLFloaterGroupInfo::~LLFloaterGroupInfo()
{
sInstances.erase(mGroupID);
}
BOOL LLFloaterGroupInfo::canClose()
@@ -147,125 +77,11 @@ void LLFloaterGroupInfo::selectTabByName(std::string tab_name)
mPanelGroupp->selectTab(tab_name);
}
// static
void LLFloaterGroupInfo::showMyGroupInfo(void *)
void LLFloaterGroupInfo::callbackLoadGroupName(const std::string& full_name)
{
showFromUUID( gAgent.getGroupID() );
// Build a new title including the group name.
std::ostringstream title;
title << full_name << " - " << FLOATER_TITLE;
setTitle(title.str());
}
// static
void LLFloaterGroupInfo::showCreateGroup(void *)
{
showFromUUID(LLUUID::null, "general_tab");
}
// static
void LLFloaterGroupInfo::closeGroup(const LLUUID& group_id)
{
LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL);
if (fgi)
{
if (fgi->mPanelGroupp)
{
fgi->mPanelGroupp->close();
}
}
}
// static
void LLFloaterGroupInfo::closeCreateGroup()
{
closeGroup(LLUUID::null);
}
// static
void LLFloaterGroupInfo::refreshGroup(const LLUUID& group_id)
{
LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL);
if (fgi)
{
if (fgi->mPanelGroupp)
{
fgi->mPanelGroupp->refreshData();
}
}
}
// static
void LLFloaterGroupInfo::callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group)
{
LLFloaterGroupInfo *fgi = get_if_there(sInstances, id, (LLFloaterGroupInfo*)NULL);
if (fgi)
{
// Build a new title including the group name.
std::ostringstream title;
title << full_name << " - " << FLOATER_TITLE;
fgi->setTitle(title.str());
}
}
// static
void LLFloaterGroupInfo::showFromUUID(const LLUUID& group_id,
const std::string& tab_name)
{
// If we don't have a floater for this group, create one.
LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL);
if (!fgi)
{
fgi = new LLFloaterGroupInfo("groupinfo",
FGI_RECT,
FLOATER_TITLE,
group_id,
tab_name);
sInstances[group_id] = fgi;
if (group_id.notNull())
{
// Look up the group name.
// The callback will insert it into the title.
gCacheName->get(group_id, true, boost::bind(&callbackLoadGroupName, _1, _2, _3));
}
}
fgi->selectTabByName(tab_name);
fgi->center();
fgi->open(); /*Flawfinder: ignore*/
}
// static
void LLFloaterGroupInfo::showNotice(const std::string& subject,
const std::string& message,
const LLUUID& group_id,
const bool& has_inventory,
const std::string& inventory_name,
LLOfferInfo* inventory_offer)
{
llinfos << "LLFloaterGroupInfo::showNotice : " << subject << llendl;
if (group_id.isNull())
{
// We need to clean up that inventory offer.
if (inventory_offer)
{
inventory_offer->forceResponse(IOR_DECLINE);
}
return;
}
// If we don't have a floater for this group, drop this packet on the floor.
LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL);
if (!fgi)
{
// We need to clean up that inventory offer.
if (inventory_offer)
{
inventory_offer->forceResponse(IOR_DECLINE);
}
return;
}
fgi->mPanelGroupp->showNotice(subject,message,has_inventory,inventory_name,inventory_offer);
}

View File

@@ -39,48 +39,29 @@
#define LL_LLFLOATERGROUPINFO_H
#include "llfloater.h"
#include "lluuid.h"
#include "llinstancetracker.h"
class LLPanelGroup;
struct LLOfferInfo;
class LLFloaterGroupInfo
: public LLFloater
: public LLFloater, public LLInstanceTracker<LLFloaterGroupInfo, LLUUID>
{
public:
LLFloaterGroupInfo(const LLUUID& group_id);
virtual ~LLFloaterGroupInfo();
static void showCreateGroup(void *);
static void showMyGroupInfo(void *);
static void showFromUUID(const LLUUID &group_id,
const std::string& tab_name = std::string());
static void closeCreateGroup();
static void closeGroup(const LLUUID& group_id);
static void refreshGroup(const LLUUID& group_id);
static void showNotice(const std::string& subject,
const std::string& message,
const LLUUID& group_id,
const bool& has_inventory,
const std::string& inventory_name,
LLOfferInfo* inventory_offer);
LLUUID getGroupID() { return mGroupID;}
void selectTabByName(std::string tab_name);
// This allow us to block the user from closing the floater
// if there is information that needs to be applied.
// This allows us to block the user from closing the floater if there is information that needs to be applied.
virtual BOOL canClose();
protected:
LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id = LLUUID::null, const std::string& tab_name = std::string());
friend class LLGroupActions;
LLPanelGroup* mPanelGroupp;
private:
static void callbackLoadGroupName(const LLUUID& id, const std::string& full_name, bool is_group);
static std::map<LLUUID, LLFloaterGroupInfo*> sInstances;
LLUUID mGroupID;
LLPanelGroup* mPanelGroupp;
void callbackLoadGroupName(const std::string& full_name);
};
#endif

View File

@@ -51,6 +51,7 @@
#include "llfloatergroupinfo.h"
#include "llfloaterdirectory.h"
#include "llfocusmgr.h"
#include "llgroupactions.h"
#include "llselectmgr.h"
#include "llscrolllistctrl.h"
#include "llnotificationsutil.h"
@@ -218,23 +219,23 @@ BOOL LLPanelGroups::postBuild()
init_group_list(group_list, gAgent.getGroupID(), none_text);
group_list->setCommitCallback(boost::bind(&LLPanelGroups::onGroupList,this));
group_list->setSortChangedCallback(boost::bind(&LLPanelGroups::onGroupSortChanged,this)); //Force 'none' to always be first entry.
group_list->setDoubleClickCallback(boost::bind(&LLPanelGroups::onBtnIM,this));
group_list->setDoubleClickCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list)));
childSetAction("Activate", onBtnActivate, this);
getChild<LLUICtrl>("Activate")->setCommitCallback(boost::bind(LLGroupActions::activate, boost::bind(&LLScrollListCtrl::getCurrentID, group_list)));
childSetAction("Info", onBtnInfo, this);
getChild<LLUICtrl>("Info")->setCommitCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, group_list)));
childSetAction("IM", onBtnIM, this);
getChild<LLUICtrl>("IM")->setCommitCallback(boost::bind(LLGroupActions::startIM, boost::bind(&LLScrollListCtrl::getCurrentID, group_list)));
childSetAction("Leave", onBtnLeave, this);
getChild<LLUICtrl>("Leave")->setCommitCallback(boost::bind(LLGroupActions::leave, boost::bind(&LLScrollListCtrl::getCurrentID, group_list)));
childSetAction("Create", onBtnCreate, this);
getChild<LLUICtrl>("Create")->setCommitCallback(boost::bind(LLGroupActions::createGroup));
childSetAction("Search...", onBtnSearch, this);
getChild<LLUICtrl>("Search...")->setCommitCallback(boost::bind(LLGroupActions::search));
childSetAction("Invite...", onBtnInvite, this);
childSetAction("Titles...", onBtnTitles, this);
getChild<LLUICtrl>("Titles...")->setCommitCallback(boost::bind(HBFloaterGroupTitles::toggle));
setDefaultBtn("IM");
@@ -291,147 +292,12 @@ void LLPanelGroups::enableButtons()
}
void LLPanelGroups::onBtnCreate(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->create();
}
void LLPanelGroups::onBtnInvite(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->invite();
}
void LLPanelGroups::onBtnActivate(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->activate();
}
void LLPanelGroups::onBtnInfo(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->info();
}
void LLPanelGroups::onBtnIM(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->startIM();
}
void LLPanelGroups::onBtnLeave(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->leave();
}
void LLPanelGroups::onBtnSearch(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->search();
}
void LLPanelGroups::onBtnTitles(void* userdata)
{
LLPanelGroups* self = (LLPanelGroups*)userdata;
if(self) self->titles();
}
void LLPanelGroups::create()
{
llinfos << "LLPanelGroups::create" << llendl;
LLFloaterGroupInfo::showCreateGroup(NULL);
}
void LLPanelGroups::activate()
{
llinfos << "LLPanelGroups::activate" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list)
{
group_id = group_list->getCurrentID();
}
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ActivateGroup);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, group_id);
gAgent.sendReliableMessage();
}
void LLPanelGroups::info()
{
llinfos << "LLPanelGroups::info" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
LLFloaterGroupInfo::showFromUUID(group_id);
}
}
void LLPanelGroups::startIM()
{
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
LLGroupData group_data;
if (gAgent.getGroupData(group_id, group_data))
{
static LLCachedControl<bool> tear_off("OtherChatsTornOff");
if (!tear_off)
gIMMgr->setFloaterOpen(TRUE);
gIMMgr->addSession(
group_data.mName,
IM_SESSION_GROUP_START,
group_id);
make_ui_sound("UISndStartIM");
}
else
{
// this should never happen, as starting a group IM session
// relies on you belonging to the group and hence having the group data
make_ui_sound("UISndInvalidOp");
}
}
}
void LLPanelGroups::leave()
{
llinfos << "LLPanelGroups::leave" << llendl;
LLCtrlListInterface *group_list = childGetListInterface("group list");
LLUUID group_id;
if (group_list && (group_id = group_list->getCurrentID()).notNull())
{
S32 count = gAgent.mGroups.count();
S32 i;
for(i = 0; i < count; ++i)
{
if(gAgent.mGroups.get(i).mID == group_id)
break;
}
if(i < count)
{
LLSD args;
args["GROUP"] = gAgent.mGroups.get(i).mName;
LLSD payload;
payload["group_id"] = group_id;
LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, callbackLeaveGroup);
}
}
}
void LLPanelGroups::search()
{
LLFloaterDirectory::showGroups();
}
void LLPanelGroups::invite()
{
LLCtrlListInterface *group_list = childGetListInterface("group list");
@@ -447,31 +313,6 @@ void LLPanelGroups::invite()
LLFloaterGroupInvite::showForGroup(group_id);
}
void LLPanelGroups::titles()
{
HBFloaterGroupTitles::toggle();
}
// static
bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
LLUUID group_id = notification["payload"]["group_id"].asUUID();
if(option == 0)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_LeaveGroupRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_GroupData);
msg->addUUIDFast(_PREHASH_GroupID, group_id);
gAgent.sendReliableMessage();
}
return false;
}
void LLPanelGroups::onGroupSortChanged()
{
LLScrollListCtrl *group_list = getChild<LLScrollListCtrl>("group list");

View File

@@ -52,7 +52,6 @@ class LLUICtrl;
class LLTextBox;
class LLScrollListCtrl;
class LLButton;
class LLFloaterGroupPicker;
class LLFloaterGroupPicker : public LLFloater, public LLUIFactory<LLFloaterGroupPicker, LLFloaterGroupPicker, VisibilityPolicy<LLFloater> >
{
@@ -105,29 +104,8 @@ protected:
void onGroupSortChanged();
void onGroupList();
static void onBtnCreate(void* userdata);
static void onBtnActivate(void* userdata);
static void onBtnInfo(void* userdata);
static void onBtnIM(void* userdata);
static void onBtnLeave(void* userdata);
static void onBtnSearch(void* userdata);
static void onBtnVote(void* userdata);
static void onBtnInvite(void* userdata);
static void onBtnTitles(void* userdata);
static void onDoubleClickGroup(void* userdata);
void create();
void activate();
void info();
void startIM();
void leave();
void search();
void callVote();
void invite();
void titles();
static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response);
};

View File

@@ -58,6 +58,7 @@
#include "llfloatergroups.h"
#include "llfloatergroupinfo.h"
#include "llfloaterscriptlimits.h"
#include "llgroupactions.h"
#include "lllineeditor.h"
#include "llnamelistctrl.h"
#include "llnotify.h"
@@ -848,8 +849,7 @@ void LLPanelLandGeneral::onClickInfoGroup(void* userdata)
LLPanelLandGeneral* panelp = (LLPanelLandGeneral*)userdata;
LLParcel* parcel = panelp->mParcel->getParcel();
if (!parcel) return;
LLUUID id = parcel->getGroupID();
if(id.notNull())LLFloaterGroupInfo::showFromUUID(parcel->getGroupID());
LLGroupActions::show(parcel->getGroupID());
}
void LLPanelLandGeneral::onClickProfile()
@@ -859,8 +859,7 @@ void LLPanelLandGeneral::onClickProfile()
if (parcel->getIsGroupOwned())
{
const LLUUID& group_id = parcel->getGroupID();
LLFloaterGroupInfo::showFromUUID(group_id);
LLGroupActions::show(parcel->getGroupID());
}
else
{
@@ -1178,7 +1177,7 @@ void LLPanelLandObjects::onDoubleClickOwner(void *userdata)
BOOL is_group = cell->getValue().asString() == OWNER_GROUP;
if (is_group)
{
LLFloaterGroupInfo::showFromUUID(owner_id);
LLGroupActions::show(owner_id);
}
else
{

View File

@@ -42,8 +42,8 @@
#include "llagent.h"
#include "llbutton.h"
#include "llfloatergroupinfo.h"
#include "llfloaterworldmap.h"
#include "llgroupactions.h"
#include "llproductinforequest.h"
#include "llscrolllistctrl.h"
#include "llstatusbar.h"
@@ -103,7 +103,7 @@ BOOL LLFloaterLandHoldings::postBuild()
LLScrollListCtrl *grant_list = getChild<LLScrollListCtrl>("grant list");
// Grant list
grant_list->setDoubleClickCallback(boost::bind(&LLFloaterLandHoldings::onGrantList,this));
grant_list->setDoubleClickCallback(boost::bind(LLGroupActions::show, boost::bind(&LLScrollListCtrl::getCurrentID, grant_list)));
LLCtrlListInterface *list = grant_list->getListInterface();
if (!list) return TRUE;
@@ -323,19 +323,6 @@ void LLFloaterLandHoldings::onClickMap(void* data)
self->buttonCore(1);
}
// static
void LLFloaterLandHoldings::onGrantList(void* data)
{
LLFloaterLandHoldings* self = (LLFloaterLandHoldings*)data;
LLCtrlSelectionInterface *list = self->childGetSelectionInterface("grant list");
if (!list) return;
LLUUID group_id = list->getCurrentID();
if (group_id.notNull())
{
LLFloaterGroupInfo::showFromUUID(group_id);
}
}
void LLFloaterLandHoldings::refreshAggregates()
{
S32 allowed_area = gStatusBar->getSquareMetersCredit();

View File

@@ -60,8 +60,6 @@ public:
static void onClickMap(void*);
static void onClickLandmark(void*);
static void onGrantList(void* data);
protected:
LLFloaterLandHoldings();
virtual ~LLFloaterLandHoldings();

View File

@@ -40,11 +40,11 @@
#include "llcommandhandler.h"
#include "llfloatergroupinfo.h"
#include "llfloatermute.h"
#include "llgroupactions.h"
#include "llmutelist.h"
#include "llsdutil.h"
#include "lluictrlfactory.h"
#include "llurldispatcher.h"
#include "llviewercontrol.h"
// [RLVa:KB] - Version: 1.23.4
#include "rlvhandler.h"
@@ -146,7 +146,7 @@ void LLFloaterObjectIMInfo::onClickOwner(void* data)
LLFloaterObjectIMInfo* self = (LLFloaterObjectIMInfo*)data;
if (self->mOwnerIsGroup)
{
LLFloaterGroupInfo::showFromUUID(self->mOwnerID);
LLGroupActions::show(self->mOwnerID);
}
// else
// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-0.2.0g

View File

@@ -44,7 +44,7 @@
#include "llavataractions.h"
#include "llbutton.h"
#include "llcheckboxctrl.h"
#include "llfloatergroupinfo.h"
#include "llgroupactions.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
#include "lllineeditor.h"
@@ -604,7 +604,7 @@ void LLFloaterProperties::onClickOwner()
if(!item) return;
if(item->getPermissions().isGroupOwned())
{
LLFloaterGroupInfo::showFromUUID(item->getPermissions().getGroup());
LLGroupActions::show(item->getPermissions().getGroup());
}
else
{

View File

@@ -0,0 +1,489 @@
/**
* @file llgroupactions.cpp
* @brief Group-related actions (join, leave, new, delete, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "llgroupactions.h"
#include "llagent.h"
#include "llcommandhandler.h"
#include "llfloaterchatterbox.h" // for LLFloaterMyFriends
#include "llfloaterdirectory.h"
#include "llfloatergroupinfo.h"
#include "llgroupmgr.h"
#include "llimview.h" // for gIMMgr
#include "llnotificationsutil.h"
#include "llpanelgroup.h"
#include "groupchatlistener.h"
#include "hippolimits.h" // for getMaxAgentGroups
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.3.0f)
//#include "llslurl.h"
#include "rlvhandler.h"
// [/RLVa:KB]
BOOL can_afford_transaction(S32 cost);
//
// Globals
//
static GroupChatListener sGroupChatListener;
class LLGroupHandler : public LLCommandHandler
{
public:
// requires trusted browser to trigger
LLGroupHandler() : LLCommandHandler("group", true/*UNTRUSTED_THROTTLE*/) { }
bool handle(const LLSD& tokens, const LLSD& query_map,
LLMediaCtrl* web)
{
/*if (!LLUI::sSettingGroups["config"]->getBOOL("EnableGroupInfo"))
{
LLNotificationsUtil::add("NoGroupInfo", LLSD(), LLSD(), std::string("SwitchToStandardSkinAndQuit"));
return true;
}*/
if (tokens.size() < 1)
{
return false;
}
if (tokens[0].asString() == "create")
{
LLGroupActions::createGroup();
return true;
}
if (tokens.size() < 2)
{
return false;
}
if (tokens[0].asString() == "list")
{
if (tokens[1].asString() == "show")
{
// CP_TODO: get the value we pass in via the XUI name
// of the tab instead of using a literal like this
LLFloaterMyFriends::showInstance( 1 );
return true;
}
return false;
}
LLUUID group_id;
if (!group_id.set(tokens[0], FALSE))
{
return false;
}
if (tokens[1].asString() == "about")
{
if (group_id.isNull())
return true;
LLGroupActions::show(group_id);
return true;
}
if (tokens[1].asString() == "inspect")
{
if (group_id.isNull())
return true;
LLGroupActions::inspect(group_id);
return true;
}
return false;
}
};
LLGroupHandler gGroupHandler;
// static
void LLGroupActions::search()
{
//LLFloaterReg::showInstance("search", LLSD().with("category", "groups"));
LLFloaterDirectory::showGroups();
}
/* Singu TODO: Voice refactor
// static
void LLGroupActions::startCall(const LLUUID& group_id)
{
// create a new group voice session
LLGroupData gdata;
if (!gAgent.getGroupData(group_id, gdata))
{
llwarns << "Error getting group data" << llendl;
return;
}
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) )
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", LLSLURL("group", group_id, "about").getSLURLString()));
return;
}
// [/RLVa:KB]
LLUUID session_id = gIMMgr->addSession(gdata.mName, IM_SESSION_GROUP_START, group_id, true);
if (session_id.isNull())
{
llwarns << "Error adding session" << llendl;
return;
}
// start the call
gIMMgr->autoStartCallOnStartup(session_id);
make_ui_sound("UISndStartIM");
}
*/
// static
void LLGroupActions::join(const LLUUID& group_id)
{
if (gAgent.mGroups.count() >= gHippoLimits->getMaxAgentGroups()) //!gAgent.canJoinGroups()
{
LLNotificationsUtil::add("JoinedTooManyGroups");
return;
}
LLGroupMgrGroupData* gdatap =
LLGroupMgr::getInstance()->getGroupData(group_id);
if (gdatap)
{
S32 cost = gdatap->mMembershipFee;
LLSD args;
args["COST"] = llformat("%d", cost);
args["NAME"] = gdatap->mName;
LLSD payload;
payload["group_id"] = group_id;
if (can_afford_transaction(cost))
{
if(cost > 0)
LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, onJoinGroup);
else
LLNotificationsUtil::add("JoinGroupNoCost", args, payload, onJoinGroup);
}
else
{
LLNotificationsUtil::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 = LLNotificationsUtil::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())
// return;
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f
if ( (group_id.isNull()) || ((gAgent.getGroupID() == group_id) && (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP))) )
return;
// [/RLVa:KB]
S32 count = gAgent.mGroups.count();
S32 i;
for (i = 0; i < count; ++i)
{
if(gAgent.mGroups.get(i).mID == group_id)
break;
}
if (i < count)
{
LLSD args;
args["GROUP"] = gAgent.mGroups.get(i).mName;
LLSD payload;
payload["group_id"] = group_id;
LLNotificationsUtil::add("GroupLeaveConfirmMember", args, payload, onLeaveGroup);
}
}
// static
void LLGroupActions::activate(const LLUUID& group_id)
{
// [RLVa:KB] - Checked: 2011-03-28 (RLVa-1.4.1a) | Added: RLVa-1.3.0f
if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SETGROUP)) && (gRlvHandler.getAgentGroup() != group_id) )
{
return;
}
// [/RLVa:KB]
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_ActivateGroup);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->addUUIDFast(_PREHASH_GroupID, group_id);
gAgent.sendReliableMessage();
}
/* Singu Note: this function serves no purpose to us, it is here as an honorable mention
static bool isGroupUIVisible()
{
static LLPanel* panel = 0;
if(!panel)
panel = LLFloaterSidePanelContainer::getPanel("people", "panel_group_info_sidetray");
if(!panel)
return false;
return panel->isInVisibleChain();
}
*/
// static
void LLGroupActions::inspect(const LLUUID& group_id)
{
//LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", group_id));
openGroupProfile(group_id);
}
// static
void LLGroupActions::show(const LLUUID& group_id)
{
if (group_id.isNull())
return;
/*
LLSD params;
params["group_id"] = group_id;
params["open_tab_name"] = "panel_group_info_sidetray";
LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
*/
openGroupProfile(group_id);
}
// static
void LLGroupActions::showTab(const LLUUID& group_id, const std::string& tab_name)
{
if (group_id.isNull()) return;
openGroupProfile(group_id)->selectTabByName(tab_name);
}
/* Singu Note: How could this ever work with a null id, it's only used by llnotificationgrouphandler.cpp which we don't have
void LLGroupActions::refresh_notices()
{
if(!isGroupUIVisible())
return;
LLSD params;
params["group_id"] = LLUUID::null;
params["open_tab_name"] = "panel_group_info_sidetray";
params["action"] = "refresh_notices";
LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
}
*/
//static
void LLGroupActions::refresh(const LLUUID& group_id)
{
/*
if(!isGroupUIVisible())
return;
LLSD params;
params["group_id"] = group_id;
params["open_tab_name"] = "panel_group_info_sidetray";
params["action"] = "refresh";
LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
*/
if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id))
if (LLPanelGroup* pg = fgi->mPanelGroupp)
pg->refreshData();
}
//static
void LLGroupActions::createGroup()
{
/*
LLSD params;
params["group_id"] = LLUUID::null;
params["open_tab_name"] = "panel_group_info_sidetray";
params["action"] = "create";
LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
*/
openGroupProfile(LLUUID::null);
}
//static
void LLGroupActions::closeGroup(const LLUUID& group_id)
{
/*
if(!isGroupUIVisible())
return;
LLSD params;
params["group_id"] = group_id;
params["open_tab_name"] = "panel_group_info_sidetray";
params["action"] = "close";
LLFloaterSidePanelContainer::showPanel("people", "panel_group_info_sidetray", params);
*/
if (LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id))
fgi->close();
}
// static
LLUUID LLGroupActions::startIM(const LLUUID& group_id)
{
if (group_id.isNull()) return LLUUID::null;
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
if ( (rlv_handler_t::isEnabled()) && (!gRlvHandler.canStartIM(group_id)) && (!gIMMgr->hasSession(group_id)) )
{
make_ui_sound("UISndInvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTIM, LLSD().with("RECIPIENT", group_id/*LLSLURL("group", group_id, "about").getSLURLString()*/));
return LLUUID::null;
}
// [/RLVa:KB]
LLGroupData group_data;
if (gAgent.getGroupData(group_id, group_data))
{
static LLCachedControl<bool> tear_off("OtherChatsTornOff");
if (!tear_off) gIMMgr->setFloaterOpen(TRUE);
LLUUID session_id = gIMMgr->addSession(
group_data.mName,
IM_SESSION_GROUP_START,
group_id);
make_ui_sound("UISndStartIM");
return session_id;
}
else
{
// this should never happen, as starting a group IM session
// relies on you belonging to the group and hence having the group data
make_ui_sound("UISndInvalidOp");
return LLUUID::null;
}
}
// static
void LLGroupActions::endIM(const LLUUID& group_id)
{
if (group_id.isNull())
return;
LLUUID session_id = gIMMgr->computeSessionID(IM_SESSION_GROUP_START, group_id);
if (session_id.notNull())
{
gIMMgr->removeSession(session_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())
{
return false;
}
LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(group_id);
if(!group_data)
{
return false;
}
if(group_data->mMembers.end() == group_data->mMembers.find(avatar_id))
{
return false;
}
return true;
}
//-- Private methods ----------------------------------------------------------
// static
bool LLGroupActions::onLeaveGroup(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
LLUUID group_id = notification["payload"]["group_id"].asUUID();
if(option == 0)
{
LLMessageSystem* msg = gMessageSystem;
msg->newMessageFast(_PREHASH_LeaveGroupRequest);
msg->nextBlockFast(_PREHASH_AgentData);
msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
msg->nextBlockFast(_PREHASH_GroupData);
msg->addUUIDFast(_PREHASH_GroupID, group_id);
gAgent.sendReliableMessage();
}
return false;
}
// Singu helper function, open a profile and center it
// static
LLFloaterGroupInfo* LLGroupActions::openGroupProfile(const LLUUID& group_id)
{
LLFloaterGroupInfo* fgi = LLFloaterGroupInfo::getInstance(group_id);
if (!fgi) fgi = new LLFloaterGroupInfo(group_id);
fgi->center();
fgi->open();
return fgi;
}

View File

@@ -0,0 +1,125 @@
/**
* @file llgroupactions.h
* @brief Group-related actions (join, leave, new, delete, etc)
*
* $LicenseInfo:firstyear=2009&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#ifndef LL_LLGROUPACTIONS_H
#define LL_LLGROUPACTIONS_H
class LLFloaterGroupInfo;
/**
* Group-related actions (join, leave, new, delete, etc)
*/
class LLGroupActions
{
public:
/**
* Invokes group search floater.
*/
static void search();
/// Join a group. Assumes LLGroupMgr has data for that group already.
static void join(const LLUUID& group_id);
/**
* Invokes "Leave Group" floater.
*/
static void leave(const LLUUID& group_id);
/**
* Activate group.
*/
static void activate(const LLUUID& group_id);
/**
* Show group information panel.
*/
static void show(const LLUUID& group_id);
/**
* Show group information panel, with specific tab open.
*/
static void showTab(const LLUUID& group_id, const std::string& tab_name);
/**
* Show group inspector floater.
*/
static void inspect(const LLUUID& group_id);
/**
* Refresh group information panel.
*/
static void refresh(const LLUUID& group_id);
/**
* Refresh group notices panel.
*/
static void refresh_notices();
/**
* Refresh group information panel.
*/
static void createGroup();
/**
* Close group information panel.
*/
static void closeGroup(const LLUUID& group_id);
/**
* Start group instant messaging session.
*/
static LLUUID startIM(const LLUUID& group_id);
/**
* End group instant messaging session.
*/
static void endIM(const LLUUID& group_id);
/// Returns if the current user is a member of the group
static bool isInGroup(const LLUUID& group_id);
/**
* Start a group voice call.
*/
static void startCall(const LLUUID& group_id);
/**
* Returns true if avatar is in group.
*
* Note that data about group members is loaded from server.
* If data has not been loaded yet, function will return inaccurate result.
* See LLGroupMgr::sendGroupMembersRequest
*/
static bool isAvatarMemberOfGroup(const LLUUID& group_id, const LLUUID& avatar_id);
private:
static bool onJoinGroup(const LLSD& notification, const LLSD& response);
static bool onLeaveGroup(const LLSD& notification, const LLSD& response);
static LLFloaterGroupInfo* openGroupProfile(const LLUUID& group_id);
};
#endif // LL_LLGROUPACTIONS_H

View File

@@ -44,11 +44,10 @@
#include "lltransactiontypes.h"
#include "llstatusbar.h"
#include "lleconomy.h"
#include "llviewercontrol.h"
#include "llviewerregion.h"
#include "llviewerwindow.h"
#include "llfloaterdirectory.h"
#include "llfloatergroupinfo.h"
#include "llgroupactions.h"
#include "llnotificationsutil.h"
#include "lluictrlfactory.h"
#include "lltrans.h"
@@ -1361,7 +1360,7 @@ void LLGroupMgr::processEjectGroupMemberReply(LLMessageSystem* msg, void ** data
// If we had a failure, the group panel needs to be updated.
if (!success)
{
LLFloaterGroupInfo::refreshGroup(group_id);
LLGroupActions::refresh(group_id);
}
}
@@ -1381,7 +1380,7 @@ void LLGroupMgr::processJoinGroupReply(LLMessageSystem* msg, void ** data)
LLGroupMgr::getInstance()->clearGroupData(group_id);
// refresh the floater for this group, if any.
LLFloaterGroupInfo::refreshGroup(group_id);
LLGroupActions::refresh(group_id);
// refresh the group panel of the search window, if necessary.
LLFloaterDirectory::refreshGroup(group_id);
}
@@ -1403,7 +1402,7 @@ void LLGroupMgr::processLeaveGroupReply(LLMessageSystem* msg, void ** data)
LLGroupMgr::getInstance()->clearGroupData(group_id);
// close the floater for this group, if any.
LLFloaterGroupInfo::closeGroup(group_id);
LLGroupActions::closeGroup(group_id);
// refresh the group panel of the search window, if necessary.
LLFloaterDirectory::refreshGroup(group_id);
}
@@ -1439,8 +1438,8 @@ void LLGroupMgr::processCreateGroupReply(LLMessageSystem* msg, void ** data)
gAgent.mGroups.push_back(gd);
LLFloaterGroupInfo::closeCreateGroup();
LLFloaterGroupInfo::showFromUUID(group_id,"roles_tab");
LLGroupActions::closeGroup(LLUUID::null);
LLGroupActions::showTab(group_id, "roles_tab");
}
else
{

View File

@@ -39,13 +39,13 @@
#include "llbutton.h"
#include "lliconctrl.h"
#include "llfloaterchat.h" // for add_chat_history()
#include "llgroupactions.h"
#include "llnotify.h"
#include "lltextbox.h"
#include "llviewertexteditor.h"
#include "lluiconstants.h"
#include "llui.h"
#include "llviewercontrol.h"
#include "llfloatergroupinfo.h"
#include "llinventoryicon.h"
#include "llinventory.h"
#include "lltrans.h"
@@ -279,7 +279,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject,
wide_btn_width,
BTN_HEIGHT);
btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(&LLGroupNotifyBox::onClickGroupInfo,this));
btn = new LLButton(LLTrans::getString("GroupNotifyGroupNotices"), btn_rect, LLStringUtil::null, boost::bind(LLGroupActions::showTab, mGroupID, "notices_tab"));
btn->setToolTip(LLTrans::getString("GroupNotifyViewPastNotices"));
addChild(btn, -1);
@@ -457,12 +457,6 @@ void LLGroupNotifyBox::onClickOk()
close();
}
void LLGroupNotifyBox::onClickGroupInfo()
{
LLFloaterGroupInfo::showFromUUID(mGroupID, "notices_tab");
//Leave notice open until explicitly closed
}
void LLGroupNotifyBox::onClickSaveInventory()
{
mInventoryOffer->forceResponse(IOR_ACCEPT);

View File

@@ -90,7 +90,6 @@ protected:
// internal handler for button being clicked
void onClickOk();
void onClickGroupInfo();
void onClickSaveInventory();
// for "next" button

View File

@@ -50,6 +50,7 @@
#include "llcallingcard.h"
#include "llchat.h"
#include "llconsole.h"
#include "llgroupactions.h"
#include "llfloateractivespeakers.h"
#include "llfloaterchat.h"
#include "llfloatergroupinfo.h"
@@ -1363,7 +1364,7 @@ BOOL LLFloaterIMPanel::postBuild()
if (LLButton* btn = findChild<LLButton>("profile_tele_btn"))
btn->setCommitCallback(boost::bind(static_cast<void(*)(const LLUUID&)>(LLAvatarActions::offerTeleport), mOtherParticipantUUID));
if (LLButton* btn = findChild<LLButton>("group_info_btn"))
btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickGroupInfo, this));
btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID));
childSetAction("history_btn", onClickHistory, this);
if (LLUICtrl* ctrl = findChild<LLUICtrl>("rp_mode"))
ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onRPMode, this, _2));
@@ -1374,9 +1375,6 @@ BOOL LLFloaterIMPanel::postBuild()
if (LLButton* btn = findChild<LLButton>("toggle_active_speakers_btn"))
btn->setCommitCallback(boost::bind(&LLFloaterIMPanel::onClickToggleActiveSpeakers, this, _2));
//LLButton* close_btn = getChild<LLButton>("close_btn");
//close_btn->setClickedCallback(&LLFloaterIMPanel::onClickClose, this);
mHistoryEditor = getChild<LLViewerTextEditor>("im_history");
mHistoryEditor->setParseHTML(TRUE);
mHistoryEditor->setParseHighlights(TRUE);
@@ -1899,22 +1897,6 @@ void LLFloaterIMPanel::onClickHistory( void* userdata )
}
}
void LLFloaterIMPanel::onClickGroupInfo()
{
// Bring up the Profile window
LLFloaterGroupInfo::showFromUUID(mSessionUUID);
}
// static
void LLFloaterIMPanel::onClickClose( void* userdata )
{
LLFloaterIMPanel* self = (LLFloaterIMPanel*) userdata;
if(self)
{
self->close();
}
}
// static
void LLFloaterIMPanel::onClickStartCall(void* userdata)
{

View File

@@ -241,8 +241,6 @@ public:
static void onClickHistory( void* userdata );
void onRPMode(const LLSD& value);
void onClickGroupInfo();
static void onClickClose( void* userdata );
static void onClickStartCall( void* userdata );
static void onClickEndCall( void* userdata );
void onClickToggleActiveSpeakers(const LLSD& value);

View File

@@ -51,6 +51,7 @@
#include "llfloatergroupinfo.h"
#include "llfloatermute.h"
#include "llfloateravatarinfo.h"
#include "llgroupactions.h"
#include "lllineeditor.h"
#include "llnameeditor.h"
#include "llnotificationsutil.h"
@@ -430,18 +431,14 @@ void LLPanelAvatarSecondLife::onClickImage(void* data)
void LLPanelAvatarSecondLife::onDoubleClickGroup(void* data)
{
LLPanelAvatarSecondLife* self = (LLPanelAvatarSecondLife*)data;
LLScrollListCtrl* group_list = self->getChild<LLScrollListCtrl>("groups");
if(group_list)
{
LLScrollListItem* item = group_list->getFirstSelected();
if(item && item->getUUID().notNull())
if (item)
{
llinfos << "Show group info " << item->getUUID() << llendl;
LLFloaterGroupInfo::showFromUUID(item->getUUID());
LLGroupActions::show(item->getUUID());
}
}
}

View File

@@ -125,18 +125,14 @@ void LLPanelGroupTab::handleClickHelp()
}
}
LLPanelGroup::LLPanelGroup(const std::string& filename,
const std::string& name,
const LLUUID& group_id,
const std::string& initial_tab_selected)
: LLPanel(name, LLRect(), FALSE),
LLPanelGroup::LLPanelGroup(const LLUUID& group_id)
: LLPanel("PanelGroup", LLRect(), FALSE),
LLGroupMgrObserver( group_id ),
mCurrentTab( NULL ),
mRequestedTab( NULL ),
mTabContainer( NULL ),
mIgnoreTransition( FALSE ),
mForceClose( FALSE ),
mInitialTab(initial_tab_selected),
mAllowEdit( TRUE ),
mShowingNotifyDialog( FALSE )
{
@@ -159,18 +155,14 @@ LLPanelGroup::LLPanelGroup(const std::string& filename,
LLGroupMgr::getInstance()->addObserver(this);
// Pass on construction of this panel to the control factory.
LLUICtrlFactory::getInstance()->buildPanel(this, filename, &getFactoryMap());
mFilename = filename;
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap());
}
LLPanelGroup::~LLPanelGroup()
{
LLGroupMgr::getInstance()->removeObserver(this);
int i;
int tab_count = mTabContainer->getTabCount();
for (i = tab_count - 1; i >=0; --i)
for (int i = mTabContainer->getTabCount() - 1; i >=0; --i)
{
LLPanelGroupTab* panelp =
(LLPanelGroupTab*) mTabContainer->getPanelByIndex(i);
@@ -181,10 +173,7 @@ LLPanelGroup::~LLPanelGroup()
void LLPanelGroup::updateTabVisibility()
{
S32 i;
S32 tab_count = mTabContainer->getTabCount();
for (i = tab_count - 1; i >=0; --i)
for (int i = mTabContainer->getTabCount() - 1; i >=0; --i)
{
LLPanelGroupTab* panelp =
(LLPanelGroupTab*) mTabContainer->getPanelByIndex(i);
@@ -211,38 +200,23 @@ BOOL LLPanelGroup::postBuild()
if (mTabContainer)
{
// Select the initial tab specified via constructor
const BOOL recurse = TRUE;
LLPanelGroupTab* tabp =
getChild<LLPanelGroupTab>(mInitialTab, recurse);
//our initial tab selection was invalid, just select the
//first tab then or default to selecting the initial
//selected tab specified in the layout file
LLPanelGroupTab* tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
//no tab was initially selected through constructor
//or the XML, select the first tab
if (!tabp)
{
//our initial tab selection was invalid, just select the
//first tab then or default to selecting the initial
//selected tab specified in the layout file
mTabContainer->selectFirstTab();
tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
//no tab was initially selected through constructor
//or the XML, select the first tab
if (!tabp)
{
mTabContainer->selectFirstTab();
tabp = (LLPanelGroupTab*) mTabContainer->getCurrentPanel();
}
}
else
{
mTabContainer->selectTabPanel(tabp);
}
mCurrentTab = tabp;
// Add click callbacks.
S32 i;
S32 tab_count = mTabContainer->getTabCount();
for (i = tab_count - 1; i >=0; --i)
for (int i = mTabContainer->getTabCount() - 1; i >=0; --i)
{
LLPanel* tab_panel = mTabContainer->getPanelByIndex(i);
LLPanelGroupTab* panelp =(LLPanelGroupTab*)tab_panel; // bit of a hack
@@ -342,8 +316,6 @@ void LLPanelGroup::handleClickTab()
void LLPanelGroup::setGroupID(const LLUUID& group_id)
{
LLRect rect(getRect());
LLGroupMgr::getInstance()->removeObserver(this);
mID = group_id;
LLGroupMgr::getInstance()->addObserver(this);
@@ -355,7 +327,7 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
// For now, rebuild panel
//delete children and rebuild panel
deleteAllChildren();
LLUICtrlFactory::getInstance()->buildPanel(this, mFilename, &getFactoryMap());
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group.xml", &getFactoryMap());
}
void LLPanelGroup::selectTab(std::string tab_name)

View File

@@ -58,10 +58,7 @@ class LLPanelGroup : public LLPanel,
public LLPanelGroupTabObserver
{
public:
LLPanelGroup(const std::string& filename,
const std::string& name,
const LLUUID& group_id,
const std::string& initial_tab_selected = std::string());
LLPanelGroup(const LLUUID& group_id);
virtual ~LLPanelGroup();
virtual BOOL postBuild();
@@ -119,9 +116,6 @@ protected:
BOOL mForceClose;
std::string mInitialTab;
std::string mFilename;
std::string mDefaultNeedsApplyMesg;
std::string mWantApplyMesg;

View File

@@ -37,8 +37,9 @@
#include "lluictrlfactory.h"
#include "llagent.h"
#include "llavataractions.h"
#include "llfloatergroups.h"
#include "llgroupactions.h"
#include "roles_constants.h"
#include "llfloatergroupinfo.h"
// UI elements
#include "llbutton.h"
@@ -133,13 +134,13 @@ BOOL LLPanelGroupGeneral::postBuild()
mBtnJoinGroup = getChild<LLButton>("join_button", recurse);
if ( mBtnJoinGroup )
{
mBtnJoinGroup->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickJoin, this));
mBtnJoinGroup->setClickedCallback(boost::bind(LLGroupActions::join, mGroupID));
}
mBtnInfo = getChild<LLButton>("info_button", recurse);
if ( mBtnInfo )
{
mBtnInfo->setClickedCallback(boost::bind(&LLPanelGroupGeneral::onClickInfo, this));
mBtnInfo->setClickedCallback(boost::bind(LLGroupActions::show, mGroupID));
}
LLTextBox* founder = getChild<LLTextBox>("founder_name");
@@ -154,7 +155,7 @@ BOOL LLPanelGroupGeneral::postBuild()
mListVisibleMembers = getChild<LLNameListCtrl>("visible_members", recurse);
if (mListVisibleMembers)
{
mListVisibleMembers->setDoubleClickCallback(boost::bind(&LLPanelGroupGeneral::openProfile,this));
mListVisibleMembers->setDoubleClickCallback(boost::bind(LLAvatarActions::showProfile, boost::bind(&LLScrollListCtrl::getCurrentID, mListVisibleMembers)));
}
// Options
@@ -322,83 +323,6 @@ void LLPanelGroupGeneral::onCommitTitle()
mComboActiveTitle->resetDirty();
}
// static
void LLPanelGroupGeneral::onClickInfo(void *userdata)
{
LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata;
if ( !self ) return;
lldebugs << "open group info: " << self->mGroupID << llendl;
LLFloaterGroupInfo::showFromUUID(self->mGroupID);
}
// static
void LLPanelGroupGeneral::onClickJoin(void *userdata)
{
LLPanelGroupGeneral *self = (LLPanelGroupGeneral *)userdata;
if ( !self ) return;
lldebugs << "joining group: " << self->mGroupID << llendl;
LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(self->mGroupID);
if (gdatap)
{
S32 cost = gdatap->mMembershipFee;
LLSD args;
args["COST"] = llformat("%d", cost);
LLSD payload;
payload["group_id"] = self->mGroupID;
if (can_afford_transaction(cost))
{
LLNotificationsUtil::add("JoinGroupCanAfford", args, payload, LLPanelGroupGeneral::joinDlgCB);
}
else
{
LLNotificationsUtil::add("JoinGroupCannotAfford", args, payload);
}
}
else
{
llwarns << "LLGroupMgr::getInstance()->getGroupData(" << self->mGroupID
<< ") was NULL" << llendl;
}
}
// static
bool LLPanelGroupGeneral::joinDlgCB(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 LLPanelGroupGeneral::openProfile(void* data)
{
LLPanelGroupGeneral* self = (LLPanelGroupGeneral*)data;
if (self && self->mListVisibleMembers)
{
LLScrollListItem* selected = self->mListVisibleMembers->getFirstSelected();
if (selected)
{
LLAvatarActions::showProfile(selected->getUUID());
}
}
}
bool LLPanelGroupGeneral::needsApply(std::string& mesg)
{
updateChanged();

View File

@@ -75,14 +75,9 @@ private:
void onCommitUserOnly();
void onCommitTitle();
void onCommitEnrollment();
static void onClickJoin(void* userdata);
static void onClickInfo(void* userdata);
static void onReceiveNotices(LLUICtrl* ctrl, void* data);
static void openProfile(void* data);
void addMember(LLGroupMemberData* member);
static bool joinDlgCB(const LLSD& notification, const LLSD& response);
void updateMembers();
void updateChanged();
bool confirmMatureApply(const LLSD& notification, const LLSD& response);

View File

@@ -39,6 +39,7 @@
#include "llbutton.h"
#include "llcallingcard.h"
#include "llcombobox.h"
#include "llgroupactions.h"
#include "llgroupmgr.h"
#include "llnamelistctrl.h"
#include "llnotificationsutil.h"
@@ -49,8 +50,6 @@
#include "lluictrlfactory.h"
#include "llviewerwindow.h"
#include <boost/signals2.hpp>
class LLPanelGroupInvite::impl : public boost::signals2::trackable
{
public:
@@ -183,7 +182,7 @@ void LLPanelGroupInvite::impl::submitInvitations()
iter != items.end(); ++iter)
{
LLScrollListItem* item = *iter;
if(gdatap->mMembers.find(item->getUUID()) != gdatap->mMembers.end())
if(LLGroupActions::isAvatarMemberOfGroup(mGroupID, item->getUUID()))
{
already_in_group = true;
continue;

View File

@@ -52,12 +52,12 @@
#include "llselectmgr.h"
#include "llagent.h"
#include "llavataractions.h"
#include "llfloatergroups.h"
#include "llgroupactions.h"
#include "lllineeditor.h"
#include "llradiogroup.h"
#include "llcombobox.h"
#include "lldbstrings.h"
#include "llfloatergroupinfo.h"
#include "llfloatergroups.h"
#include "llnamebox.h"
#include "lluictrlfactory.h"
#include "roles_constants.h"
@@ -1013,7 +1013,7 @@ void LLPanelPermissions::onClickOwner(void *data)
{
LLUUID group_id;
LLSelectMgr::getInstance()->selectGetGroup(group_id);
LLFloaterGroupInfo::showFromUUID(group_id);
LLGroupActions::show(group_id);
}
else
{
@@ -1064,7 +1064,7 @@ void LLPanelPermissions::onClickOpenGroup(void* data)
LLUUID group_id;
LLSelectMgr::getInstance()->selectGetGroup(group_id);
LLFloaterGroupInfo::showFromUUID(group_id);
LLGroupActions::show(group_id);
}
// static

View File

@@ -60,7 +60,6 @@
#include "llfloaterbuycurrency.h"
#include "llfloaterbuyland.h"
#include "llfloaterchat.h"
#include "llfloatergroupinfo.h"
#include "llfloaterimagepreview.h"
#include "llfloaterland.h"
#include "llfloaterregioninfo.h"
@@ -69,6 +68,7 @@
#include "llfloaterpostcard.h"
#include "llfloaterpreference.h"
#include "llfloaterteleporthistory.h"
#include "llgroupactions.h"
#include "llhudeffecttrail.h"
#include "llhudmanager.h"
#include "llimpanel.h"
@@ -639,7 +639,7 @@ bool join_group_response(const LLSD& notification, const LLSD& response)
if (option == 2 && !group_id.isNull())
{
LLFloaterGroupInfo::showFromUUID(group_id);
LLGroupActions::show(group_id);
LLSD args;
args["MESSAGE"] = message;
LLNotificationsUtil::add("JoinGroup", args, notification["payload"]);
@@ -1780,7 +1780,7 @@ bool group_vote_callback(const LLSD& notification, const LLSD& response)
case 0:
// Vote Now
// Open up the voting tab
LLFloaterGroupInfo::showFromUUID(group_id, "voting_tab");
LLGroupActions::showTab(group_id, "voting_tab");
break;
default:
// Vote Later or
@@ -2529,16 +2529,6 @@ void process_improved_im(LLMessageSystem *msg, void **user_data)
args["MESSAGE"] = mes;
LLNotifications::instance().add(LLNotification::Params("GroupNotice").substitutions(args).payload(payload).timestamp(timestamp));
}
// Also send down the old path for now.
if (IM_GROUP_NOTICE_REQUESTED == dialog)
{
LLFloaterGroupInfo::showNotice(subj,mes,group_id,has_inventory,item_name,info);
}
else
{
delete info;
}
}
break;
case IM_GROUP_INVITATION:

View File

@@ -711,6 +711,21 @@ Do you wish to proceed?
yestext="Join"/>
</notification>
<notification
icon="alertmodal.tga"
name="JoinGroupNoCost"
type="alertmodal">
You are joining group [NAME].
Do you wish to proceed?
<tag>group</tag>
<tag>confirm</tag>
<usetemplate
name="okcancelbuttons"
notext="Cancel"
yestext="Join"/>
</notification>
<notification
icon="alertmodal.tga"
name="JoinGroupCannotAfford"
@@ -3280,6 +3295,18 @@ To leave a group select the &apos;Groups...&apos; option from the &apos;Edit&apo
yestext="Join"/>
</notification>
<notification
icon="alert.tga"
name="JoinedTooManyGroups"
type="alert">
You have reached your maximum number of groups. Please leave some group before joining or creating a new one.
<tag>group</tag>
<tag>fail</tag>
<usetemplate
name="okbutton"
yestext="OK"/>
</notification>
<notification
icon="alert.tga"
name="KickUser"

View File

@@ -391,6 +391,12 @@ Los demás residentes podrán visitar la URL que hayas elegido cuando vean tu pe
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Unirse"/>
</notification>
<notification name="JoinGroupNoCost">
Vas a entrar al grupo [NAME].
¿Quieres seguir?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Entrar"/>
</notification>
<notification name="JoinGroupCannotAfford">
Unirse a este grupo cuesta [CURRENCY][COST].
No tienes suficientes [CURRENCY] para unirte a este grupo.
@@ -1879,6 +1885,11 @@ Se ocultará el chat y los mensajes instantáneos. Los mensajes instantáneos re
<usetemplate name="okcancelbuttons" notext="Rehusar" yestext="Entrar"/>
</notification>
<notification name="JoinedTooManyGroups">
Has superado tu número máximo de grupos. Por favor, sal de al menos uno de ellos antes de crear uno nuevo o entrar en alguno.
<usetemplate name="okbutton" yestext="OK"/>
</notification>
<notification name="KickUser">
¿Con qué mensaje se expulsará a este usuario?
<form name="form">

View File

@@ -264,6 +264,12 @@ Voulez-vous continuer ?
<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Rejoindre"/>
</notification>
<notification name="JoinGroupNoCost">
Vous vous apprêtez à rejoindre le groupe [NAME].
Voulez-vous continuer ?
<usetemplate name="okcancelbuttons" notext="Annuler" yestext="Fusionner"/>
</notification>
<notification name="JoinGroupCannotAfford">
Rejoindre ce groupe coûte [COST] [CURRENCY].
Vous n'avez pas suffisamment de [CURRENCY] pour rejoindre ce groupe.
@@ -1606,6 +1612,11 @@ Pour quitter un groupe, sélectionnez l'option Groupe dans le menu Éditer.
<usetemplate name="okcancelbuttons" notext="Refuser" yestext="Rejoindre"/>
</notification>
<notification name="JoinedTooManyGroups">
Vous avez atteint le nombre de groupes maximum. Vous devez en quitter un avant d'en rejoindre ou d'en créer un nouveau.
<usetemplate name="okbutton" yestext="OK"/>
</notification>
<notification name="KickUser">
Éjecter cet utilisateur avec quel message ?
<form name="form">

View File

@@ -274,6 +274,11 @@ Outros residentes podem visitar a URL que você definiu, quando eles olharem seu
Deseja prosseguir?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Unir-se"/>
</notification>
<notification name="JoinGroupNoCost">
Você está prestes a entrar no grupo [NAME].
Deseja continuar?
<usetemplate name="okcancelbuttons" notext="Cancelar" yestext="Entrar"/>
</notification>
<notification name="JoinGroupCannotAfford">
Associar-se a este grupo custa [CURRENCY][COST].
Você não tem [CURRENCY] suficientes para associar-se a este grupo.
@@ -1623,6 +1628,11 @@ Bate-papo e mensagens instantâneas serão escondidas. Mensagens instantâneas i
<usetemplate name="okcancelbuttons" notext="Recusar" yestext="Entrar"/>
</notification>
<notification name="JoinedTooManyGroups">
Você atingiu o limite máximo de grupos. Sai de um grupo para entrar ou criar outro.
<usetemplate name="okbutton" yestext="OK"/>
</notification>
<notification name="KickUser">
Expulsar este usuário com qual mensagem?
<form name="form">