コード例 #1
0
//--------------------------------------------------------------------------
void LLOfferHandler::onRejectToast(LLUUID& id)
{
	LLNotificationPtr notification = LLNotifications::instance().find(id);

//	if (notification
//			&& LLNotificationManager::getInstance()->getHandlerForNotification(
//					notification->getType()) == this
//					// don't delete notification since it may be used by IM floater
//					&& !LLHandlerUtil::canAddNotifPanelToIM(notification))
//	{
//		LLNotifications::instance().cancel(notification);
//	}
// [SL:KB] - Patch: UI-Notifications | Checked: 2011-04-11 (Catznip-2.5.0a) | Modified: Catznip-2.5.0a
	// NOTE: this will be fired from LLScreenChannel::killToastByNotificationID() which treats visible and stored toasts differently
	if ( (notification) && (!notification->isCancelled()) && 
		 (LLNotificationManager::getInstance()->getHandlerForNotification(notification->getType()) == this)  )
	{
		LLScreenChannel* pChannel = dynamic_cast<LLScreenChannel*>(mChannel);
		LLToast* pToast = (pChannel) ? pChannel->getToastByNotificationID(notification->getID()) : NULL;
		if ( (!pToast) || (pToast->getCanBeStored()) )
		{
			LLNotifications::instance().cancel(notification);
		}
	}
// [/SL:KB]
}
コード例 #2
0
void LLScriptFloaterManager::removeNotification(const LLUUID& notification_id)
{
	LLNotificationPtr notification = LLNotifications::instance().find(notification_id);
	if (notification != NULL && !notification->isCancelled())
	{
		LLNotificationsUtil::cancel(notification);
	}

	onRemoveNotification(notification_id);
}
コード例 #3
0
void LLNotifications::cancel(LLNotificationPtr pNotif)
{
	if (pNotif == NULL || pNotif->isCancelled()) return;

	LLNotificationSet::iterator it=mItems.find(pNotif);
	if (it == mItems.end())
	{
		llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
	}
	updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
	pNotif->cancel();
}
コード例 #4
0
void LLNotifications::cancel(LLNotificationPtr pNotif)
{
	if (pNotif == NULL || pNotif->isCancelled()) return;

	AILOCK_mItems;
	LLNotificationSet::iterator it=mItems.find(pNotif);
	if (it == mItems.end())
	{
		LL_ERRS() << "Attempted to delete nonexistent notification " << pNotif->getName() << LL_ENDL;
	}
	UpdateItemSM::add(UpdateItem("delete", pNotif));
}
コード例 #5
0
void LLPersistentNotificationStorage::saveNotifications()
{
	LL_RECORD_BLOCK_TIME(FTM_SAVE_NOTIFICATIONS);

	boost::intrusive_ptr<LLPersistentNotificationChannel> history_channel = boost::dynamic_pointer_cast<LLPersistentNotificationChannel>(LLNotifications::instance().getChannel("Persistent"));
	if (!history_channel)
	{
		return;
	}

	LLSD output = LLSD::emptyMap();
	LLSD& data = output["data"];

	for ( std::vector<LLNotificationPtr>::iterator it = history_channel->beginHistory(), end_it = history_channel->endHistory();
		it != end_it;
		++it)
	{
		LLNotificationPtr notification = *it;

		// After a notification was placed in Persist channel, it can become
		// responded, expired or canceled - in this case we are should not save it
		if(notification->isRespondedTo() || notification->isCancelled()
			|| notification->isExpired())
		{
			continue;
		}

		data.append(notification->asLLSD(true));
		if (data.size() >= gSavedSettings.getS32("MaxPersistentNotifications"))
		{
			LL_WARNS() << "Too many persistent notifications."
					<< " Saved " << gSavedSettings.getS32("MaxPersistentNotifications") << " of " << history_channel->size()
					<< " persistent notifications." << LL_ENDL;
			break;
		}

	}

	writeNotifications(output);
}
コード例 #6
0
// The expiration channel gets all notifications that are cancelled
bool LLNotifications::expirationFilter(LLNotificationPtr pNotification)
{
	return pNotification->isCancelled() || pNotification->isRespondedTo();
}
コード例 #7
0
	// The history channel gets all notifications except those that have been cancelled
	static bool historyFilter(LLNotificationPtr pNotification)
	{
		return !pNotification->isCancelled();
	}