void LLNotifications::update(const LLNotificationPtr pNotif)
{
	LLNotificationSet::iterator it=mItems.find(pNotif);
	if (it != mItems.end())
	{
		updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
	}
}
void LLNotifications::cancel(LLNotificationPtr pNotif)
{
	LLNotificationSet::iterator it=mItems.find(pNotif);
	if (it == mItems.end())
	{
		llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
	}
	updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
	pNotif->cancel();
}
void LLNotifications::add(const LLNotificationPtr pNotif)
{
	// first see if we already have it -- if so, that's a problem
	LLNotificationSet::iterator it=mItems.find(pNotif);
	if (it != mItems.end())
	{
		llerrs << "Notification added a second time to the master notification channel." << llendl;
	}

	updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
}
LLSD LLNotificationsListener::asLLSD(LLNotificationPtr note)
{
    LLSD notificationInfo(note->asLLSD());
    // For some reason the following aren't included in LLNotification::asLLSD().
    notificationInfo["summary"] = note->summarize();
    notificationInfo["id"]      = note->id();
    notificationInfo["type"]    = note->getType();
    notificationInfo["message"] = note->getMessage();
    notificationInfo["label"]   = note->getLabel();
    return notificationInfo;
}
void UpdateItem::doit(void) const
{
  LLNotifications::getInstance()->updateItem(LLSD().with("sigtype", sigtype).with("id", pNotif->id()), pNotif);
  if (!strcmp(sigtype, "delete"))
  {
	pNotif->cancel();
  }
}