//--------------------------------------------------------------------------
void LLScreenChannel::killToastByNotificationID(LLUUID id)
{
	// searching among toasts on a screen
	std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), id);
	
	if( it != mToastList.end())
	{
		LLToast* toast = it->getToast();
		// if it is a notification toast and notification is UnResponded - then respond on it
		// else - simply destroy a toast
		//
		// NOTE:	if a notification is unresponded this function will be called twice for the same toast.
		//			At first, the notification will be discarded, at second (it will be caused by discarding),
		//			the toast will be destroyed.
		if(toast && toast->isNotificationValid())
		{
			mRejectToastSignal(toast->getNotificationID());
		}
		else
		{

			deleteToast(toast);
			mToastList.erase(it);
			redrawToasts();
		}
		return;
	}

	// searching among stored toasts
	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);

	if (it != mStoredToastList.end())
	{
		LLToast* toast = it->getToast();
		if (toast)
		{
			// send signal to a listener to let him perform some action on toast rejecting
			mRejectToastSignal(toast->getNotificationID());
			deleteToast(toast);
		}
	}

	// Call find() once more, because the mStoredToastList could have been changed
	// in mRejectToastSignal callback and the iterator could have become invalid.
	it = find(mStoredToastList.begin(), mStoredToastList.end(), id);
	if (it != mStoredToastList.end())
	{
		mStoredToastList.erase(it);
	}

}
Exemplo n.º 2
0
//--------------------------------------------------------------------------
void LLScreenChannel::removeStoredToastByNotificationID(LLUUID id)
{
	// *TODO: may be remove this function
	std::vector<ToastElem>::iterator it = find(mStoredToastList.begin(), mStoredToastList.end(), id);

	if( it == mStoredToastList.end() )
		return;

	LLToast* toast = (*it).toast;
	mStoredToastList.erase(it);
	mRejectToastSignal(toast->getNotificationID());
}