diff options
Diffstat (limited to 'linden/indra')
-rw-r--r-- | linden/indra/newview/llimview.cpp | 79 | ||||
-rw-r--r-- | linden/indra/newview/llimview.h | 2 | ||||
-rw-r--r-- | linden/indra/newview/llpanelgroupgeneral.cpp | 10 | ||||
-rw-r--r-- | linden/indra/newview/llstartup.cpp | 4 | ||||
-rw-r--r-- | linden/indra/newview/llviewerwindow.cpp | 4 |
5 files changed, 56 insertions, 43 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 | ||
542 | LLIMMgr::~LLIMMgr() | 540 | LLIMMgr::~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 | ||
1305 | void LLIMMgr::loadIgnoreGroup() | 1304 | void 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 | ||
1333 | void LLIMMgr::saveIgnoreGroup() | 1333 | void 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 | ||
diff --git a/linden/indra/newview/llimview.h b/linden/indra/newview/llimview.h index a7a088a..8f665d2 100644 --- a/linden/indra/newview/llimview.h +++ b/linden/indra/newview/llimview.h | |||
@@ -218,7 +218,7 @@ private: | |||
218 | LLSD mPendingInvitations; | 218 | LLSD mPendingInvitations; |
219 | LLSD mPendingAgentListUpdates; | 219 | LLSD mPendingAgentListUpdates; |
220 | 220 | ||
221 | std::map<LLUUID, bool> mIgnoreGroupList; | 221 | std::list<LLUUID> mIgnoreGroupList; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | 224 | ||
diff --git a/linden/indra/newview/llpanelgroupgeneral.cpp b/linden/indra/newview/llpanelgroupgeneral.cpp index 402929e..55e1b33 100644 --- a/linden/indra/newview/llpanelgroupgeneral.cpp +++ b/linden/indra/newview/llpanelgroupgeneral.cpp | |||
@@ -545,7 +545,6 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) | |||
545 | } | 545 | } |
546 | 546 | ||
547 | BOOL receive_notices = false; | 547 | BOOL receive_notices = false; |
548 | BOOL receive_chat = false; | ||
549 | BOOL list_in_profile = false; | 548 | BOOL list_in_profile = false; |
550 | if (mCtrlReceiveNotices) | 549 | if (mCtrlReceiveNotices) |
551 | receive_notices = mCtrlReceiveNotices->get(); | 550 | receive_notices = mCtrlReceiveNotices->get(); |
@@ -556,13 +555,12 @@ bool LLPanelGroupGeneral::apply(std::string& mesg) | |||
556 | 555 | ||
557 | if (mCtrlReceiveChat) | 556 | if (mCtrlReceiveChat) |
558 | { | 557 | { |
559 | receive_chat = mCtrlReceiveChat->get(); | 558 | bool receive_chat = mCtrlReceiveChat->get(); |
559 | gIMMgr->updateIgnoreGroup(mGroupID, !receive_chat); | ||
560 | // Save here too in case we crash somewhere down the road -- MC | ||
561 | gIMMgr->saveIgnoreGroup(); | ||
560 | } | 562 | } |
561 | 563 | ||
562 | gIMMgr->updateIgnoreGroup(mGroupID, receive_chat); | ||
563 | // Save here too in case we crash somewhere down the road -- MC | ||
564 | gIMMgr->saveIgnoreGroup(); | ||
565 | |||
566 | mChanged = FALSE; | 564 | mChanged = FALSE; |
567 | 565 | ||
568 | return true; | 566 | return true; |
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index 3f55fd8..0464e99 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp | |||
@@ -111,6 +111,7 @@ | |||
111 | #include "llhudmanager.h" | 111 | #include "llhudmanager.h" |
112 | #include "llhttpclient.h" | 112 | #include "llhttpclient.h" |
113 | #include "llimagebmp.h" | 113 | #include "llimagebmp.h" |
114 | #include "llimview.h" // for gIMMgr | ||
114 | #include "llinventorymodel.h" | 115 | #include "llinventorymodel.h" |
115 | #include "llinventoryview.h" | 116 | #include "llinventoryview.h" |
116 | #include "llkeyboard.h" | 117 | #include "llkeyboard.h" |
@@ -1716,6 +1717,9 @@ bool idle_startup() | |||
1716 | gHippoGridManager->saveFile(); | 1717 | gHippoGridManager->saveFile(); |
1717 | gHippoLimits->setLimits(); | 1718 | gHippoLimits->setLimits(); |
1718 | 1719 | ||
1720 | // Load list of groups to ignore incoming chat from. | ||
1721 | gIMMgr->loadIgnoreGroup(); | ||
1722 | |||
1719 | // JC: gesture loading done below, when we have an asset system | 1723 | // JC: gesture loading done below, when we have an asset system |
1720 | // in place. Don't delete/clear user_credentials until then. | 1724 | // in place. Don't delete/clear user_credentials until then. |
1721 | 1725 | ||
diff --git a/linden/indra/newview/llviewerwindow.cpp b/linden/indra/newview/llviewerwindow.cpp index dd27726..c89e0c5 100644 --- a/linden/indra/newview/llviewerwindow.cpp +++ b/linden/indra/newview/llviewerwindow.cpp | |||
@@ -1660,10 +1660,6 @@ 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 | } | ||
1667 | 1663 | ||
1668 | if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) | 1664 | if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") ) |
1669 | { | 1665 | { |