aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-08-22 19:38:52 -0700
committerJacek Antonelli2010-08-27 13:25:15 -0500
commit615b9f34fb21b40cb3ba9489c00ba8f5338e3a7d (patch)
treeb40db983469b75ed2b978903e8797509d9f10e69 /linden/indra/newview
parentFixed terminology in VivoxLicenseAccepted help string. (diff)
downloadmeta-impy-615b9f34fb21b40cb3ba9489c00ba8f5338e3a7d.zip
meta-impy-615b9f34fb21b40cb3ba9489c00ba8f5338e3a7d.tar.gz
meta-impy-615b9f34fb21b40cb3ba9489c00ba8f5338e3a7d.tar.bz2
meta-impy-615b9f34fb21b40cb3ba9489c00ba8f5338e3a7d.tar.xz
Wip - mute group chat
Diffstat (limited to 'linden/indra/newview')
-rw-r--r--linden/indra/newview/llappviewer.cpp2
-rw-r--r--linden/indra/newview/llimview.cpp116
-rw-r--r--linden/indra/newview/llimview.h8
-rw-r--r--linden/indra/newview/llpanelgroupgeneral.cpp29
-rw-r--r--linden/indra/newview/llpanelgroupgeneral.h1
-rw-r--r--linden/indra/newview/llviewerwindow.cpp4
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml5
7 files changed, 165 insertions, 0 deletions
diff --git a/linden/indra/newview/llappviewer.cpp b/linden/indra/newview/llappviewer.cpp
index bcfeaa3..89eeb13 100644
--- a/linden/indra/newview/llappviewer.cpp
+++ b/linden/indra/newview/llappviewer.cpp
@@ -3734,6 +3734,8 @@ void LLAppViewer::idleShutdown()
3734 // close IM interface 3734 // close IM interface
3735 if(gIMMgr) 3735 if(gIMMgr)
3736 { 3736 {
3737 // Save group chat ignore list -- MC
3738 gIMMgr->saveIgnoreGroup();
3737 gIMMgr->disconnectAllSessions(); 3739 gIMMgr->disconnectAllSessions();
3738 } 3740 }
3739 3741
diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp
index 790e20b..2ad743b 100644
--- a/linden/indra/newview/llimview.cpp
+++ b/linden/indra/newview/llimview.cpp
@@ -53,6 +53,7 @@
53#include "llhttpnode.h" 53#include "llhttpnode.h"
54#include "llimpanel.h" 54#include "llimpanel.h"
55#include "llresizebar.h" 55#include "llresizebar.h"
56#include "llsdserialize.h"
56#include "lltabcontainer.h" 57#include "lltabcontainer.h"
57#include "llviewercontrol.h" 58#include "llviewercontrol.h"
58#include "llfloater.h" 59#include "llfloater.h"
@@ -534,6 +535,8 @@ LLIMMgr::LLIMMgr() :
534 535
535 mPendingInvitations = LLSD::emptyMap(); 536 mPendingInvitations = LLSD::emptyMap();
536 mPendingAgentListUpdates = LLSD::emptyMap(); 537 mPendingAgentListUpdates = LLSD::emptyMap();
538
539 loadIgnoreGroup();
537} 540}
538 541
539LLIMMgr::~LLIMMgr() 542LLIMMgr::~LLIMMgr()
@@ -594,6 +597,30 @@ void LLIMMgr::addMessage(
594 // create IM window as necessary 597 // create IM window as necessary
595 if(!floater) 598 if(!floater)
596 { 599 {
600 if (!mIgnoreGroupList.empty())
601 {
602 // Check to see if we're blocking this group's chat
603 LLGroupData *group_data = NULL;
604
605 // Search for this group in the agent's groups list
606 LLDynamicArray<LLGroupData>::iterator i;
607
608 for (i = gAgent.mGroups.begin(); i != gAgent.mGroups.end(); i++)
609 {
610 if (i->mID == session_id)
611 {
612 group_data = &*i;
613 break;
614 }
615 }
616
617 // If the group is in our list then return
618 if (group_data && (mIgnoreGroupList.count(group_data->mID) == 1))
619 {
620 return;
621 }
622 }
623
597 std::string name = from; 624 std::string name = from;
598 if(!session_name.empty() && session_name.size()>1) 625 if(!session_name.empty() && session_name.size()>1)
599 { 626 {
@@ -1275,6 +1302,95 @@ void LLIMMgr::updateFloaterSessionID(
1275 } 1302 }
1276} 1303}
1277 1304
1305void LLIMMgr::loadIgnoreGroup()
1306{
1307 // Load groups we want to ignore in chat -- MC
1308 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");
1309
1310 LLSD settings_llsd;
1311 llifstream file;
1312 file.open(filename);
1313 if (file.is_open())
1314 {
1315 llinfos << "loading ignore_groups.xml" << llendl;
1316 LLSDSerialize::fromXML(settings_llsd, file);
1317 }
1318 else
1319 {
1320 llinfos << "creating blank ignore_groups.xml" << llendl;
1321 FILE* fp = LLFile::fopen(filename, "w+");
1322 fclose(fp);
1323 }
1324
1325 for (LLSD::map_const_iterator iter = settings_llsd.beginMap();
1326 iter != settings_llsd.endMap(); ++iter)
1327 {
1328 llinfos << "group chat for id " << iter->first << " is ignored? " << iter->second << llendl;
1329 mIgnoreGroupList.insert(std::make_pair(LLUUID(iter->first), (bool)(iter->second.asBoolean())));
1330 }
1331}
1332
1333void LLIMMgr::saveIgnoreGroup()
1334{
1335 // Save groups we want to ignore in chat before killing gIMMgr
1336 std::string user_dir = gDirUtilp->getLindenUserDir();
1337 if (!user_dir.empty())
1338 {
1339 llinfos << "saving ignore_groups.xml" << llendl;
1340 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");
1341 LLSD settings_llsd;
1342
1343 for(std::map<LLUUID, bool>::iterator iter = mIgnoreGroupList.begin();
1344 iter != mIgnoreGroupList.end(); ++iter)
1345 {
1346 settings_llsd[iter->first.asString()] = iter->second;
1347 }
1348
1349 llofstream file;
1350 file.open(filename);
1351 LLSDSerialize::toPrettyXML(settings_llsd, file);
1352 }
1353}
1354
1355void LLIMMgr::updateIgnoreGroup(const LLUUID& group_id, const bool& ignore)
1356{
1357 if (group_id.notNull())
1358 {
1359 std::map<LLUUID, bool>::iterator found_it = mIgnoreGroupList.find(group_id);
1360 if (found_it != mIgnoreGroupList.end())
1361 {
1362 llinfos << "existing group " << group_id << " updated to " << ignore << llendl;
1363 mIgnoreGroupList[group_id] = ignore;
1364 }
1365 else
1366 {
1367 llinfos << "new group " << group_id << " created and set to " << ignore << llendl;
1368 mIgnoreGroupList.insert(std::make_pair(group_id, ignore));
1369 }
1370 }
1371}
1372
1373bool LLIMMgr::getIgnoreGroup(const LLUUID& group_id)
1374{
1375 if (group_id.notNull())
1376 {
1377 std::map<LLUUID, bool>::iterator found_it = mIgnoreGroupList.find(group_id);
1378 if (found_it != mIgnoreGroupList.end())
1379 {
1380 llinfos << "group found in ignore_groups.xml, " << found_it->second << llendl;
1381 return found_it->second;
1382 }
1383 }
1384 llinfos << "no group info found in ignore_groups.xml" << llendl;
1385 return false;
1386}
1387
1388
1389//////////////////////
1390///// ChatterBox /////
1391//////////////////////
1392
1393
1278LLFloaterChatterBox* LLIMMgr::getFloater() 1394LLFloaterChatterBox* LLIMMgr::getFloater()
1279{ 1395{
1280 return LLFloaterChatterBox::getInstance(LLSD()); 1396 return LLFloaterChatterBox::getInstance(LLSD());
diff --git a/linden/indra/newview/llimview.h b/linden/indra/newview/llimview.h
index b03036b..a7a088a 100644
--- a/linden/indra/newview/llimview.h
+++ b/linden/indra/newview/llimview.h
@@ -172,6 +172,12 @@ public:
172 //HACK: need a better way of enumerating existing session, or listening to session create/destroy events 172 //HACK: need a better way of enumerating existing session, or listening to session create/destroy events
173 const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; } 173 const std::set<LLHandle<LLFloater> >& getIMFloaterHandles() { return mFloaters; }
174 174
175 void loadIgnoreGroup();
176 void saveIgnoreGroup();
177 void updateIgnoreGroup(const LLUUID& group_id, const bool& ignore);
178 // Returns true if group chat is ignored for the UUID, false if not
179 bool getIgnoreGroup(const LLUUID& group_id);
180
175private: 181private:
176 // create a panel and update internal representation for 182 // create a panel and update internal representation for
177 // consistency. Returns the pointer, caller (the class instance 183 // consistency. Returns the pointer, caller (the class instance
@@ -211,6 +217,8 @@ private:
211 217
212 LLSD mPendingInvitations; 218 LLSD mPendingInvitations;
213 LLSD mPendingAgentListUpdates; 219 LLSD mPendingAgentListUpdates;
220
221 std::map<LLUUID, bool> mIgnoreGroupList;
214}; 222};
215 223
216 224
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp
index 8006981..402929e 100644
--- a/linden/indra/newview/llpanelgroupgeneral.cpp
+++ b/linden/indra/newview/llpanelgroupgeneral.cpp
@@ -47,6 +47,7 @@
47#include "llcheckboxctrl.h" 47#include "llcheckboxctrl.h"
48#include "llcombobox.h" 48#include "llcombobox.h"
49#include "lldbstrings.h" 49#include "lldbstrings.h"
50#include "llimview.h"
50#include "lllineeditor.h" 51#include "lllineeditor.h"
51#include "llnamebox.h" 52#include "llnamebox.h"
52#include "llnamelistctrl.h" 53#include "llnamelistctrl.h"
@@ -89,6 +90,7 @@ LLPanelGroupGeneral::LLPanelGroupGeneral(const std::string& name,
89 mCtrlEnrollmentFee(NULL), 90 mCtrlEnrollmentFee(NULL),
90 mSpinEnrollmentFee(NULL), 91 mSpinEnrollmentFee(NULL),
91 mCtrlReceiveNotices(NULL), 92 mCtrlReceiveNotices(NULL),
93 mCtrlReceiveChat(NULL),
92 mCtrlListGroup(NULL), 94 mCtrlListGroup(NULL),
93 mActiveTitleLabel(NULL), 95 mActiveTitleLabel(NULL),
94 mComboActiveTitle(NULL) 96 mComboActiveTitle(NULL)
@@ -217,6 +219,15 @@ BOOL LLPanelGroupGeneral::postBuild()
217 mCtrlReceiveNotices->set(accept_notices); 219 mCtrlReceiveNotices->set(accept_notices);
218 mCtrlReceiveNotices->setEnabled(data.mID.notNull()); 220 mCtrlReceiveNotices->setEnabled(data.mID.notNull());
219 } 221 }
222
223 mCtrlReceiveChat = getChild<LLCheckBoxCtrl>("receive_chat", recurse);
224 if (mCtrlReceiveChat)
225 {
226 mCtrlReceiveChat->setCommitCallback(onCommitUserOnly);
227 mCtrlReceiveChat->setCallbackUserData(this);
228 mCtrlReceiveChat->set(!gIMMgr->getIgnoreGroup(mGroupID));
229 mCtrlReceiveChat->setEnabled(mGroupID.notNull());
230 }
220 231
221 mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse); 232 mCtrlListGroup = getChild<LLCheckBoxCtrl>("list_groups_in_profile", recurse);
222 if (mCtrlListGroup) 233 if (mCtrlListGroup)
@@ -534,6 +545,7 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
534 } 545 }
535 546
536 BOOL receive_notices = false; 547 BOOL receive_notices = false;
548 BOOL receive_chat = false;
537 BOOL list_in_profile = false; 549 BOOL list_in_profile = false;
538 if (mCtrlReceiveNotices) 550 if (mCtrlReceiveNotices)
539 receive_notices = mCtrlReceiveNotices->get(); 551 receive_notices = mCtrlReceiveNotices->get();
@@ -542,6 +554,15 @@ bool LLPanelGroupGeneral::apply(std::string& mesg)
542 554
543 gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile); 555 gAgent.setUserGroupFlags(mGroupID, receive_notices, list_in_profile);
544 556
557 if (mCtrlReceiveChat)
558 {
559 receive_chat = mCtrlReceiveChat->get();
560 }
561
562 gIMMgr->updateIgnoreGroup(mGroupID, receive_chat);
563 // Save here too in case we crash somewhere down the road -- MC
564 gIMMgr->saveIgnoreGroup();
565
545 mChanged = FALSE; 566 mChanged = FALSE;
546 567
547 return true; 568 return true;
@@ -758,6 +779,13 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
758 mCtrlReceiveNotices->resetDirty(); 779 mCtrlReceiveNotices->resetDirty();
759 } 780 }
760 781
782 if (mCtrlReceiveChat)
783 {
784 mCtrlReceiveChat->setVisible(is_member);
785 mCtrlReceiveChat->setEnabled(TRUE);
786 mCtrlReceiveChat->resetDirty();
787 }
788
761 789
762 if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident); 790 if (mInsignia) mInsignia->setEnabled(mAllowEdit && can_change_ident);
763 if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident); 791 if (mEditCharter) mEditCharter->setEnabled(mAllowEdit && can_change_ident);
@@ -902,6 +930,7 @@ void LLPanelGroupGeneral::updateChanged()
902 mCtrlEnrollmentFee, 930 mCtrlEnrollmentFee,
903 mSpinEnrollmentFee, 931 mSpinEnrollmentFee,
904 mCtrlReceiveNotices, 932 mCtrlReceiveNotices,
933 mCtrlReceiveChat,
905 mCtrlListGroup, 934 mCtrlListGroup,
906 mActiveTitleLabel, 935 mActiveTitleLabel,
907 mComboActiveTitle 936 mComboActiveTitle
diff --git a/linden/indra/newview/llpanelgroupgeneral.h b/linden/indra/newview/llpanelgroupgeneral.h
index 7135667..c4572e2 100644
--- a/linden/indra/newview/llpanelgroupgeneral.h
+++ b/linden/indra/newview/llpanelgroupgeneral.h
@@ -107,6 +107,7 @@ private:
107 LLCheckBoxCtrl *mCtrlEnrollmentFee; 107 LLCheckBoxCtrl *mCtrlEnrollmentFee;
108 LLSpinCtrl *mSpinEnrollmentFee; 108 LLSpinCtrl *mSpinEnrollmentFee;
109 LLCheckBoxCtrl *mCtrlReceiveNotices; 109 LLCheckBoxCtrl *mCtrlReceiveNotices;
110 LLCheckBoxCtrl *mCtrlReceiveChat;
110 LLCheckBoxCtrl *mCtrlListGroup; 111 LLCheckBoxCtrl *mCtrlListGroup;
111 LLTextBox *mActiveTitleLabel; 112 LLTextBox *mActiveTitleLabel;
112 LLComboBox *mComboActiveTitle; 113 LLComboBox *mComboActiveTitle;
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp
index c89e0c5..dd27726 100644
--- a/linden/indra/newview/llviewerwindow.cpp
+++ b/linden/indra/newview/llviewerwindow.cpp
@@ -1660,6 +1660,10 @@ void LLViewerWindow::initWorldUI()
1660 mRootView->addChild(gHoverView); 1660 mRootView->addChild(gHoverView);
1661 1661
1662 gIMMgr = LLIMMgr::getInstance(); 1662 gIMMgr = LLIMMgr::getInstance();
1663 if (gIMMgr)
1664 {
1665 gIMMgr->loadIgnoreGroup();
1666 }
1663 1667
1664 if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) 1668 if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
1665 { 1669 {
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
index 3e2a34a..a967a90 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_group_general.xml
@@ -129,6 +129,11 @@ Hover your mouse over the options for more help.
129 mouse_opaque="true" name="receive_notices" radio_style="false" 129 mouse_opaque="true" name="receive_notices" radio_style="false"
130 tool_tip="Sets whether you want to receive Notices from this group. Uncheck this box if this group is spamming you." 130 tool_tip="Sets whether you want to receive Notices from this group. Uncheck this box if this group is spamming you."
131 width="95" /> 131 width="95" />
132 <check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16"
133 initial_value="false" label="Join group chat" left_delta="0"
134 mouse_opaque="true" name="receive_chat" radio_style="false"
135 tool_tip="Sets whether you want to participate in group chat. Uncheck this box if this group is spamming you."
136 width="95" />
132 <check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16" 137 <check_box bottom_delta="-18" follows="left|top" font="SansSerifSmall" height="16"
133 initial_value="false" label="List group in my profile" left_delta="0" 138 initial_value="false" label="List group in my profile" left_delta="0"
134 mouse_opaque="true" name="list_groups_in_profile" radio_style="false" 139 mouse_opaque="true" name="list_groups_in_profile" radio_style="false"