aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimview.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llimview.cpp79
1 files changed, 47 insertions, 32 deletions
diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp
index 2ad743b..e3ec5e6 100644
--- a/linden/indra/newview/llimview.cpp
+++ b/linden/indra/newview/llimview.cpp
@@ -535,8 +535,6 @@ LLIMMgr::LLIMMgr() :
535 535
536 mPendingInvitations = LLSD::emptyMap(); 536 mPendingInvitations = LLSD::emptyMap();
537 mPendingAgentListUpdates = LLSD::emptyMap(); 537 mPendingAgentListUpdates = LLSD::emptyMap();
538
539 loadIgnoreGroup();
540} 538}
541 539
542LLIMMgr::~LLIMMgr() 540LLIMMgr::~LLIMMgr()
@@ -615,8 +613,9 @@ void LLIMMgr::addMessage(
615 } 613 }
616 614
617 // If the group is in our list then return 615 // If the group is in our list then return
618 if (group_data && (mIgnoreGroupList.count(group_data->mID) == 1)) 616 if (group_data && getIgnoreGroup(group_data->mID))
619 { 617 {
618 // llinfos << "ignoring chat from group " << group_data->mID << llendl;
620 return; 619 return;
621 } 620 }
622 } 621 }
@@ -1304,7 +1303,6 @@ void LLIMMgr::updateFloaterSessionID(
1304 1303
1305void LLIMMgr::loadIgnoreGroup() 1304void LLIMMgr::loadIgnoreGroup()
1306{ 1305{
1307 // Load groups we want to ignore in chat -- MC
1308 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml"); 1306 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");
1309 1307
1310 LLSD settings_llsd; 1308 LLSD settings_llsd;
@@ -1312,38 +1310,41 @@ void LLIMMgr::loadIgnoreGroup()
1312 file.open(filename); 1310 file.open(filename);
1313 if (file.is_open()) 1311 if (file.is_open())
1314 { 1312 {
1315 llinfos << "loading ignore_groups.xml" << llendl; 1313 // llinfos << "loading group chat ignore from " << filename << "..." << llendl;
1316 LLSDSerialize::fromXML(settings_llsd, file); 1314 LLSDSerialize::fromXML(settings_llsd, file);
1315
1316 mIgnoreGroupList.clear();
1317
1318 for(LLSD::array_const_iterator iter = settings_llsd.beginArray();
1319 iter != settings_llsd.endArray(); ++iter)
1320 {
1321 // llinfos << "added " << iter->asUUID()
1322 // << " to group chat ignore list" << llendl;
1323 mIgnoreGroupList.push_back( iter->asUUID() );
1324 }
1317 } 1325 }
1318 else 1326 else
1319 { 1327 {
1320 llinfos << "creating blank ignore_groups.xml" << llendl; 1328 // llinfos << "can't load " << filename
1321 FILE* fp = LLFile::fopen(filename, "w+"); 1329 // << " (probably it doesn't exist yet)" << llendl;
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 } 1330 }
1331} 1331}
1332 1332
1333void LLIMMgr::saveIgnoreGroup() 1333void LLIMMgr::saveIgnoreGroup()
1334{ 1334{
1335 // Save groups we want to ignore in chat before killing gIMMgr 1335 // llinfos << "saving ignore_groups.xml" << llendl;
1336
1336 std::string user_dir = gDirUtilp->getLindenUserDir(); 1337 std::string user_dir = gDirUtilp->getLindenUserDir();
1337 if (!user_dir.empty()) 1338 if (!user_dir.empty())
1338 { 1339 {
1339 llinfos << "saving ignore_groups.xml" << llendl;
1340 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml"); 1340 std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "ignore_groups.xml");
1341 LLSD settings_llsd;
1342 1341
1343 for(std::map<LLUUID, bool>::iterator iter = mIgnoreGroupList.begin(); 1342 LLSD settings_llsd = LLSD::emptyArray();
1344 iter != mIgnoreGroupList.end(); ++iter) 1343
1344 for(std::list<LLUUID>::iterator iter = mIgnoreGroupList.begin();
1345 iter != mIgnoreGroupList.end(); ++iter)
1345 { 1346 {
1346 settings_llsd[iter->first.asString()] = iter->second; 1347 settings_llsd.append(*iter);
1347 } 1348 }
1348 1349
1349 llofstream file; 1350 llofstream file;
@@ -1356,16 +1357,27 @@ void LLIMMgr::updateIgnoreGroup(const LLUUID& group_id, const bool& ignore)
1356{ 1357{
1357 if (group_id.notNull()) 1358 if (group_id.notNull())
1358 { 1359 {
1359 std::map<LLUUID, bool>::iterator found_it = mIgnoreGroupList.find(group_id); 1360 std::list<LLUUID>::iterator found =
1360 if (found_it != mIgnoreGroupList.end()) 1361 std::find( mIgnoreGroupList.begin(), mIgnoreGroupList.end(),
1362 group_id);
1363
1364 if (found != mIgnoreGroupList.end() && !ignore)
1361 { 1365 {
1362 llinfos << "existing group " << group_id << " updated to " << ignore << llendl; 1366 // change from ignored to not ignored
1363 mIgnoreGroupList[group_id] = ignore; 1367 // llinfos << "unignoring group " << group_id << llendl;
1368 mIgnoreGroupList.remove(group_id);
1369 }
1370 else if (found == mIgnoreGroupList.end() && ignore)
1371 {
1372 // change from not ignored to ignored
1373 // llinfos << "ignoring group " << group_id << llendl;
1374 mIgnoreGroupList.push_back(group_id);
1364 } 1375 }
1365 else 1376 else
1366 { 1377 {
1367 llinfos << "new group " << group_id << " created and set to " << ignore << llendl; 1378 // nothing to do
1368 mIgnoreGroupList.insert(std::make_pair(group_id, ignore)); 1379 // llinfos << "no change to group " << group_id << ", it is already "
1380 // << (ignore ? "" : "not ") << "ignored" << llendl;
1369 } 1381 }
1370 } 1382 }
1371} 1383}
@@ -1374,14 +1386,17 @@ bool LLIMMgr::getIgnoreGroup(const LLUUID& group_id)
1374{ 1386{
1375 if (group_id.notNull()) 1387 if (group_id.notNull())
1376 { 1388 {
1377 std::map<LLUUID, bool>::iterator found_it = mIgnoreGroupList.find(group_id); 1389 std::list<LLUUID>::iterator found =
1378 if (found_it != mIgnoreGroupList.end()) 1390 std::find( mIgnoreGroupList.begin(), mIgnoreGroupList.end(),
1391 group_id);
1392
1393 if (found != mIgnoreGroupList.end())
1379 { 1394 {
1380 llinfos << "group found in ignore_groups.xml, " << found_it->second << llendl; 1395 // llinfos << "group " << group_id << " is ignored." << llendl;
1381 return found_it->second; 1396 return true;
1382 } 1397 }
1383 } 1398 }
1384 llinfos << "no group info found in ignore_groups.xml" << llendl; 1399 // llinfos << "group " << group_id << " is not ignored." << llendl;
1385 return false; 1400 return false;
1386} 1401}
1387 1402