FIRE-1379: Additional option to only mute group chats of a particular group - by Katharine Berry (Exodus Viewer)
parent
894d651f1c
commit
e4cd16fbad
|
|
@ -99,6 +99,7 @@ set(viewer_SOURCE_FILES
|
|||
aoset.cpp
|
||||
chatbar_as_cmdline.cpp
|
||||
kcwlinterface.cpp
|
||||
exogroupmutelist.cpp
|
||||
floatermedialists.cpp
|
||||
fscontactsfloater.cpp
|
||||
fsareasearch.cpp
|
||||
|
|
@ -742,6 +743,7 @@ set(viewer_HEADER_FILES
|
|||
aoset.h
|
||||
chatbar_as_cmdline.h
|
||||
kcwlinterface.h
|
||||
exogroupmutelist.h
|
||||
floatermedialists.h
|
||||
fscontactsfloater.h
|
||||
fsareasearch.h
|
||||
|
|
|
|||
|
|
@ -0,0 +1,105 @@
|
|||
/**
|
||||
* @file exogroupmutelist.cpp
|
||||
* @brief Persistently stores groups to ignore.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Copyright (C) 2012 Katharine Berry
|
||||
*
|
||||
* 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.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#include "llviewerprecompiledheaders.h"
|
||||
|
||||
#include "lldir.h"
|
||||
#include "llfile.h"
|
||||
#include "llgroupactions.h"
|
||||
#include "llsdserialize.h"
|
||||
|
||||
#include "exogroupmutelist.h"
|
||||
|
||||
exoGroupMuteList::exoGroupMuteList()
|
||||
: mMuted()
|
||||
{
|
||||
loadMuteList();
|
||||
}
|
||||
|
||||
bool exoGroupMuteList::isMuted(const LLUUID& group) const
|
||||
{
|
||||
return mMuted.count(group);
|
||||
}
|
||||
|
||||
void exoGroupMuteList::add(const LLUUID& group)
|
||||
{
|
||||
LLGroupActions::endIM(group); // Actually kill ongoing conversation
|
||||
if(mMuted.insert(group).second)
|
||||
{
|
||||
saveMuteList();
|
||||
}
|
||||
}
|
||||
|
||||
void exoGroupMuteList::remove(const LLUUID& group)
|
||||
{
|
||||
if(mMuted.erase(group))
|
||||
{
|
||||
saveMuteList();
|
||||
}
|
||||
}
|
||||
|
||||
bool exoGroupMuteList::loadMuteList()
|
||||
{
|
||||
std::string path = getFilePath();
|
||||
if(!LLFile::isfile(path))
|
||||
{
|
||||
// We consider the absence of a mute file to be a successful load
|
||||
// because it won't exist if the user's never muted a group.
|
||||
LL_INFOS("GroupMute") << "Mute file doesn't exist; skipping load." << LL_ENDL;
|
||||
return true;
|
||||
}
|
||||
llifstream file(path);
|
||||
if(!file.is_open())
|
||||
{
|
||||
LL_WARNS("GroupMute") << "Failed to open group muting list." << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
LLSD data;
|
||||
LLSDSerialize::fromXMLDocument(data, file);
|
||||
file.close();
|
||||
|
||||
std::copy(data.beginArray(), data.endArray(), inserter(mMuted, mMuted.begin()));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool exoGroupMuteList::saveMuteList()
|
||||
{
|
||||
LLSD data;
|
||||
// LLSD doesn't seem to expose insertion using iterators.
|
||||
for(std::set<LLUUID>::iterator it = mMuted.begin(); it != mMuted.end(); ++it)
|
||||
{
|
||||
data.append(*it);
|
||||
}
|
||||
|
||||
llofstream file(getFilePath());
|
||||
if(!file.is_open())
|
||||
{
|
||||
LL_WARNS("GroupMute") << "Unable to save group muting list!" << LL_ENDL;
|
||||
return false;
|
||||
}
|
||||
LLSDSerialize::toPrettyXML(data, file);
|
||||
file.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string exoGroupMuteList::getFilePath() const
|
||||
{
|
||||
return gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "muted_groups.xml");
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
/**
|
||||
* @file exogroupmutelist.h
|
||||
* @brief Persistently stores groups to ignore.
|
||||
*
|
||||
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
|
||||
* Copyright (C) 2012 Katharine Berry
|
||||
*
|
||||
* 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.
|
||||
* $/LicenseInfo$
|
||||
*/
|
||||
|
||||
#ifndef EXO_GROUPMUTELIST_H
|
||||
#define EXO_GROUPMUTELIST_H
|
||||
|
||||
#include "lluuid.h"
|
||||
|
||||
class exoGroupMuteList : public LLSingleton<exoGroupMuteList>
|
||||
{
|
||||
public:
|
||||
exoGroupMuteList();
|
||||
bool isMuted(const LLUUID &group) const;
|
||||
void add(const LLUUID &group);
|
||||
void remove(const LLUUID &group);
|
||||
|
||||
private:
|
||||
bool loadMuteList();
|
||||
bool saveMuteList();
|
||||
std::string getFilePath() const;
|
||||
|
||||
std::set<LLUUID> mMuted;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -53,6 +53,8 @@
|
|||
#include "rlvhandler.h"
|
||||
// [/RLVa:KB]
|
||||
|
||||
#include "exogroupmutelist.h"
|
||||
|
||||
//
|
||||
// Globals
|
||||
//
|
||||
|
|
@ -413,6 +415,10 @@ LLUUID LLGroupActions::startIM(const LLUUID& group_id)
|
|||
LLGroupData group_data;
|
||||
if (gAgent.getGroupData(group_id, group_data))
|
||||
{
|
||||
// <exodus>
|
||||
// Unmute the group if the user tries to start a session with it.
|
||||
exoGroupMuteList::instance().remove(group_id);
|
||||
// </exodus>
|
||||
LLUUID session_id = gIMMgr->addSession(
|
||||
group_data.mName,
|
||||
IM_SESSION_GROUP_START,
|
||||
|
|
|
|||
|
|
@ -70,6 +70,8 @@
|
|||
#include "rlvhandler.h"
|
||||
// [/RLVa:KB]
|
||||
|
||||
#include "exogroupmutelist.h"
|
||||
|
||||
const static std::string ADHOC_NAME_SUFFIX(" Conference");
|
||||
|
||||
const static std::string NEARBY_P2P_BY_OTHER("nearby_P2P_by_other");
|
||||
|
|
@ -2658,7 +2660,9 @@ void LLIMMgr::addMessage(
|
|||
|
||||
// Logically it would make more sense to reject the session sooner, in another area of the
|
||||
// code, but the session has to be established inside the server before it can be left.
|
||||
if (LLMuteList::getInstance()->isMuted(other_participant_id) && !LLMuteList::getInstance()->isLinden(from))
|
||||
//if (LLMuteList::getInstance()->isMuted(other_participant_id) && !LLMuteList::getInstance()->isLinden(from))
|
||||
if ((LLMuteList::getInstance()->isMuted(other_participant_id) && !LLMuteList::getInstance()->isLinden(from))
|
||||
|| exoGroupMuteList::instance().isMuted(new_session_id)) // <exodus/>
|
||||
{
|
||||
llwarns << "Leaving IM session from initiating muted resident " << from << llendl;
|
||||
if(!gIMMgr->leaveSession(new_session_id))
|
||||
|
|
|
|||
|
|
@ -56,6 +56,8 @@
|
|||
// for copy URI button
|
||||
#include "llclipboard.h"
|
||||
|
||||
#include "exogroupmutelist.h"
|
||||
|
||||
static LLRegisterPanelClassWrapper<LLPanelGroupGeneral> t_panel_group_general("panel_group_general");
|
||||
|
||||
// consts
|
||||
|
|
@ -82,7 +84,8 @@ LLPanelGroupGeneral::LLPanelGroupGeneral()
|
|||
mCtrlReceiveNotices(NULL),
|
||||
mCtrlListGroup(NULL),
|
||||
mActiveTitleLabel(NULL),
|
||||
mComboActiveTitle(NULL)
|
||||
mComboActiveTitle(NULL),
|
||||
mCtrlReceiveGroupChat(NULL) // <exodus/>
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -169,6 +172,19 @@ BOOL LLPanelGroupGeneral::postBuild()
|
|||
mCtrlReceiveNotices->set(accept_notices);
|
||||
mCtrlReceiveNotices->setEnabled(data.mID.notNull());
|
||||
}
|
||||
|
||||
// <exodus>
|
||||
mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat", recurse);
|
||||
if(mCtrlReceiveGroupChat)
|
||||
{
|
||||
mCtrlReceiveNotices->setCommitCallback(onCommitUserOnly, this);
|
||||
mCtrlReceiveNotices->setEnabled(data.mID.notNull());
|
||||
if(data.mID.notNull())
|
||||
{
|
||||
mCtrlReceiveNotices->set(!exoGroupMuteList::instance().isMuted(data.mID));
|
||||
}
|
||||
}
|
||||
// </exodus>
|
||||
|
||||
mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
|
||||
if (mCtrlListGroup)
|
||||
|
|
@ -449,6 +465,20 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
|
|||
|
||||
gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
|
||||
|
||||
// <exodus>
|
||||
if(mCtrlReceiveGroupChat)
|
||||
{
|
||||
if(mCtrlReceiveGroupChat->get())
|
||||
{
|
||||
exoGroupMuteList::instance().remove(mGroupID);
|
||||
}
|
||||
else
|
||||
{
|
||||
exoGroupMuteList::instance().add(mGroupID);
|
||||
}
|
||||
}
|
||||
// </exodus>
|
||||
|
||||
resetDirty();
|
||||
|
||||
mChanged = FALSE;
|
||||
|
|
@ -649,6 +679,16 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
|
|||
}
|
||||
}
|
||||
|
||||
// <exodus>
|
||||
if (mCtrlReceiveGroupChat)
|
||||
{
|
||||
mCtrlReceiveGroupChat->setVisible(is_member);
|
||||
if (is_member)
|
||||
{
|
||||
mCtrlReceiveGroupChat->setEnabled(mAllowEdit);
|
||||
}
|
||||
}
|
||||
// </exodus>
|
||||
|
||||
if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
|
||||
if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
|
||||
|
|
@ -812,7 +852,8 @@ void LLPanelGroupGeneral::updateChanged()
|
|||
mCtrlReceiveNotices,
|
||||
mCtrlListGroup,
|
||||
mActiveTitleLabel,
|
||||
mComboActiveTitle
|
||||
mComboActiveTitle,
|
||||
mCtrlReceiveGroupChat // <exodus/>
|
||||
};
|
||||
|
||||
mChanged = FALSE;
|
||||
|
|
@ -865,6 +906,12 @@ void LLPanelGroupGeneral::reset()
|
|||
|
||||
mInsignia->setImageAssetName(mInsignia->getDefaultImageName());
|
||||
|
||||
// <exodus>
|
||||
mCtrlReceiveGroupChat->set(false);
|
||||
mCtrlReceiveGroupChat->setEnabled(false);
|
||||
mCtrlReceiveGroupChat->setVisible(true);
|
||||
// </exodus>
|
||||
|
||||
{
|
||||
std::string empty_str = "";
|
||||
mEditCharter->setText(empty_str);
|
||||
|
|
@ -909,7 +956,8 @@ void LLPanelGroupGeneral::resetDirty()
|
|||
mCtrlReceiveNotices,
|
||||
mCtrlListGroup,
|
||||
mActiveTitleLabel,
|
||||
mComboActiveTitle
|
||||
mComboActiveTitle,
|
||||
mCtrlReceiveGroupChat // <exodus/>
|
||||
};
|
||||
|
||||
for( size_t i=0; i<LL_ARRAY_SIZE(check_list); i++ )
|
||||
|
|
@ -969,6 +1017,18 @@ void LLPanelGroupGeneral::setGroupID(const LLUUID& id)
|
|||
mCtrlListGroup->setEnabled(data.mID.notNull());
|
||||
}
|
||||
|
||||
// <exodus>
|
||||
mCtrlReceiveGroupChat = getChild<LLCheckBoxCtrl>("receive_chat");
|
||||
if (mCtrlReceiveGroupChat)
|
||||
{
|
||||
if(data.mID.notNull())
|
||||
{
|
||||
mCtrlReceiveGroupChat->set(!exoGroupMuteList::instance().isMuted(data.mID));
|
||||
}
|
||||
mCtrlReceiveGroupChat->setEnabled(data.mID.notNull());
|
||||
}
|
||||
// </exodus>
|
||||
|
||||
mCtrlShowInGroupList->setEnabled(data.mID.notNull());
|
||||
|
||||
mActiveTitleLabel = getChild<LLTextBox>("active_title_label");
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ private:
|
|||
LLTextBox *mActiveTitleLabel;
|
||||
LLComboBox *mComboActiveTitle;
|
||||
LLComboBox *mComboMature;
|
||||
LLCheckBoxCtrl *mCtrlReceiveGroupChat; // <exodus/>
|
||||
|
||||
LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
|
||||
LLUUID mIteratorGroup; // <FS:ND/> FIRE-6074; UUID of the group mMemberProgress belongs to.
|
||||
|
|
|
|||
|
|
@ -259,10 +259,23 @@ Hover your mouse over the options for more help.
|
|||
top_pad="4"
|
||||
width="300" />
|
||||
|
||||
<!-- <exodus> -->
|
||||
<check_box
|
||||
height="16"
|
||||
font="SansSerifSmall"
|
||||
label="Receive group instant messages"
|
||||
layout="topleft"
|
||||
left="10"
|
||||
name="receive_chat"
|
||||
tool_tip="Sets whether you want to participate in group chat for this group."
|
||||
top_pad="5"
|
||||
width="300" />
|
||||
<!-- </exodus> -->
|
||||
|
||||
<text
|
||||
name="active_title_label"
|
||||
left="0"
|
||||
top_pad="30"
|
||||
top_pad="9"
|
||||
width="200"
|
||||
height="12"
|
||||
type="string"
|
||||
|
|
|
|||
Loading…
Reference in New Issue