diff options
Diffstat (limited to 'indra/newview/llchannelmanager.cpp')
-rw-r--r-- | indra/newview/llchannelmanager.cpp | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/indra/newview/llchannelmanager.cpp b/indra/newview/llchannelmanager.cpp index 4ab3d8dc98..ca635eaa8f 100644 --- a/indra/newview/llchannelmanager.cpp +++ b/indra/newview/llchannelmanager.cpp @@ -58,7 +58,10 @@ LLChannelManager::~LLChannelManager() { for(std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it) { - delete (*it).channel; + LLScreenChannelBase* channel = it->channel.get(); + if (!channel) continue; + + delete channel; } mChannelList.clear(); @@ -68,7 +71,7 @@ LLChannelManager::~LLChannelManager() LLScreenChannel* LLChannelManager::createNotificationChannel() { // creating params for a channel - LLChannelManager::Params p; + LLScreenChannelBase::Params p; p.id = LLUUID(gSavedSettings.getString("NotificationChannelUUID")); p.channel_align = CA_RIGHT; @@ -84,16 +87,19 @@ void LLChannelManager::onLoginCompleted() // calc a number of all offline notifications for(std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); ++it) { + LLScreenChannelBase* channel = it->channel.get(); + if (!channel) continue; + // don't calc notifications for Nearby Chat - if((*it).channel->getChannelID() == LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))) + if(channel->getChannelID() == LLUUID(gSavedSettings.getString("NearByChatChannelUUID"))) { continue; } // don't calc notifications for channels that always show their notifications - if(!(*it).channel->getDisplayToastsAlways()) + if(!channel->getDisplayToastsAlways()) { - away_notifications +=(*it).channel->getNumberOfHiddenToasts(); + away_notifications +=channel->getNumberOfHiddenToasts(); } } @@ -106,7 +112,7 @@ void LLChannelManager::onLoginCompleted() else { // create a channel for the StartUp Toast - LLChannelManager::Params p; + LLScreenChannelBase::Params p; p.id = LLUUID(gSavedSettings.getString("StartUpChannelUUID")); p.channel_align = CA_RIGHT; mStartUpChannel = createChannel(p); @@ -157,33 +163,22 @@ LLScreenChannelBase* LLChannelManager::addChannel(LLScreenChannelBase* channel) ChannelElem new_elem; new_elem.id = channel->getChannelID(); - new_elem.channel = channel; + new_elem.channel = channel->getHandle(); mChannelList.push_back(new_elem); return channel; } -LLScreenChannel* LLChannelManager::createChannel(LLChannelManager::Params& p) +LLScreenChannel* LLChannelManager::createChannel(LLScreenChannelBase::Params& p) { - LLScreenChannel* new_channel = new LLScreenChannel(p.id); - - if(!new_channel) - { - llerrs << "LLChannelManager::getChannel(LLChannelManager::Params& p) - can't create a channel!" << llendl; - } - else - { - new_channel->setToastAlignment(p.toast_align); - new_channel->setChannelAlignment(p.channel_align); - new_channel->setDisplayToastsAlways(p.display_toasts_always); + LLScreenChannel* new_channel = new LLScreenChannel(p); - addChannel(new_channel); - } + addChannel(new_channel); return new_channel; } -LLScreenChannelBase* LLChannelManager::getChannel(LLChannelManager::Params& p) +LLScreenChannelBase* LLChannelManager::getChannel(LLScreenChannelBase::Params& p) { LLScreenChannelBase* new_channel = findChannelByID(p.id); @@ -195,19 +190,19 @@ LLScreenChannelBase* LLChannelManager::getChannel(LLChannelManager::Params& p) } //-------------------------------------------------------------------------- -LLScreenChannelBase* LLChannelManager::findChannelByID(const LLUUID id) +LLScreenChannelBase* LLChannelManager::findChannelByID(const LLUUID& id) { std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id); if(it != mChannelList.end()) { - return (*it).channel; + return (*it).channel.get(); } return NULL; } //-------------------------------------------------------------------------- -void LLChannelManager::removeChannelByID(const LLUUID id) +void LLChannelManager::removeChannelByID(const LLUUID& id) { std::vector<ChannelElem>::iterator it = find(mChannelList.begin(), mChannelList.end(), id); if(it != mChannelList.end()) @@ -222,7 +217,10 @@ void LLChannelManager::muteAllChannels(bool mute) for (std::vector<ChannelElem>::iterator it = mChannelList.begin(); it != mChannelList.end(); it++) { - it->channel->setShowToasts(!mute); + if (it->channel.get()) + { + it->channel.get()->setShowToasts(!mute); + } } } |