aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimview.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-08-22 19:38:52 -0700
committerMcCabe Maxsted2010-08-28 05:01:29 -0700
commitb190be8d292b2d2fbd02b370ba143103e0adfaaa (patch)
treebf3a2122db2e20ce2645cd2bd1e67aa5e7091643 /linden/indra/newview/llimview.cpp
parentFixed reconnect to voice button in prefs not disabling when voice is disabled (diff)
downloadmeta-impy-b190be8d292b2d2fbd02b370ba143103e0adfaaa.zip
meta-impy-b190be8d292b2d2fbd02b370ba143103e0adfaaa.tar.gz
meta-impy-b190be8d292b2d2fbd02b370ba143103e0adfaaa.tar.bz2
meta-impy-b190be8d292b2d2fbd02b370ba143103e0adfaaa.tar.xz
Wip - mute group chat
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llimview.cpp116
1 files changed, 116 insertions, 0 deletions
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());