Exemplo n.º 1
0
void LLEventNotifier::update()
{
	if (mNotificationTimer.getElapsedTimeF32() > 30.f)
	{
		// Check our notifications again and send out updates
		// if they happen.

		time_t alert_time = time_corrected() + 5 * 60;
		en_map::iterator iter;
		for (iter = mEventNotifications.begin();
			 iter != mEventNotifications.end();)
		{
			LLEventNotification *np = iter->second;

			if (np->getEventDate() < (alert_time))
			{
				LLSD args;
				args["NAME"] = np->getEventName();
				args["DATE"] = np->getEventDateStr();
				LLNotifications::instance().add("EventNotification", args, LLSD(),
					boost::bind(&LLEventNotification::handleResponse, np, _1, _2));
				mEventNotifications.erase(iter++);
			}
			else
			{
				iter++;
			}
		}
		mNotificationTimer.reset();
	}
}
Exemplo n.º 2
0
void LLEventNotifier::update()
{
	if (mNotificationTimer.getElapsedTimeF32() > 30.f)
	{
		// Check our notifications again and send out updates
		// if they happen.

		U32 alert_time = time_corrected() + 5 * 60;
		en_map::iterator iter;
		for (iter = mEventNotifications.begin();
			 iter != mEventNotifications.end();)
		{
			LLEventNotification *np = iter->second;

			if (np->getEventDate() < (alert_time))
			{
				LLString::format_map_t args;
				args["[NAME]"] = np->getEventName();
				args["[DATE]"] = np->getEventDateStr();
				LLNotifyBox::showXml("EventNotification", args, 
									 notifyCallback, np);
				mEventNotifications.erase(iter++);
			}
			else
			{
				iter++;
			}
		}
		mNotificationTimer.reset();
	}
}
Exemplo n.º 3
0
void LLEventNotifier::update()
{
	if (mNotificationTimer.getElapsedTimeF32() > 30.f)
	{
		// Check our notifications again and send out updates
		// if they happen.

		F64 alert_time = LLDate::now().secondsSinceEpoch() + 5 * 60;
		en_map::iterator iter;
		for (iter = mEventNotifications.begin();
			 iter != mEventNotifications.end();)
		{
			LLEventNotification *np = iter->second;

			iter++;
			if (np->getEventDateEpoch() < alert_time)
			{
				LLSD args;
				args["NAME"] = np->getEventName();
				
				args["DATE"] = np->getEventDateStr();
				LLNotificationsUtil::add("EventNotification", args, LLSD(),
					boost::bind(&LLEventNotifier::handleResponse, this, np->getEventID(), _1, _2));
				remove(np->getEventID());
				
			}
		}
		mNotificationTimer.reset();
	}
}
Exemplo n.º 4
0
void LLEventNotifier::add(LLEventInfo &event_info)
{
	// We need to tell the simulator that we want to pay attention to
	// this event, as well as add it to our list.

	if (mEventNotifications.find(event_info.mID) != mEventNotifications.end())
	{
		// We already have a notification for this event, don't bother.
		return;
	}

	// Push up a message to tell the server we have this notification.
	gMessageSystem->newMessage("EventNotificationAddRequest");
	gMessageSystem->nextBlockFast(_PREHASH_AgentData);
	gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
	gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
	gMessageSystem->nextBlock("EventData");
	gMessageSystem->addU32("EventID", event_info.mID);
	gAgent.sendReliableMessage();

	LLEventNotification *enp = new LLEventNotification;
	enp->load(event_info);
	mEventNotifications[event_info.mID] = enp;
}
Exemplo n.º 5
0
//static
void LLEventNotifier::notifyCallback(S32 option, void *user_data)
{
	LLEventNotification *np = (LLEventNotification *)user_data;
	if (!np)
	{
		llwarns << "Event notification callback without data!" << llendl;
		return;
	}
	switch (option)
	{
	case 0:
		gAgent.teleportViaLocation(np->getEventPosGlobal());
		gFloaterWorldMap->trackLocation(np->getEventPosGlobal());
		break;
	case 1:
		gDisplayEventHack = TRUE;
		LLFloaterDirectory::showEvents(np->getEventID());
		break;
	case 2:
		break;
	}

	// We could clean up the notification on the server now if we really wanted to.
}