diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llimview.cpp | 116 |
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 | ||
539 | LLIMMgr::~LLIMMgr() | 542 | LLIMMgr::~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 | ||
1305 | void 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 | |||
1333 | void 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 | |||
1355 | void 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 | |||
1373 | bool 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 | |||
1278 | LLFloaterChatterBox* LLIMMgr::getFloater() | 1394 | LLFloaterChatterBox* LLIMMgr::getFloater() |
1279 | { | 1395 | { |
1280 | return LLFloaterChatterBox::getInstance(LLSD()); | 1396 | return LLFloaterChatterBox::getInstance(LLSD()); |