PageRenderTime 35ms CodeModel.GetById 17ms app.highlight 13ms RepoModel.GetById 2ms app.codeStats 0ms

/indra/newview/lleventnotifier.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 87 lines | 42 code | 20 blank | 25 comment | 3 complexity | 64fe5a00d583f26265dd4082b7bdb286 MD5 | raw file
 1/** 
 2 * @file lleventnotifier.h
 3 * @brief Viewer code for managing event notifications
 4 *
 5 * $LicenseInfo:firstyear=2004&license=viewerlgpl$
 6 * Second Life Viewer Source Code
 7 * Copyright (C) 2010, Linden Research, Inc.
 8 * 
 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation;
12 * version 2.1 of the License only.
13 * 
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17 * Lesser General Public License for more details.
18 * 
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 * 
23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
24 * $/LicenseInfo$
25 */
26
27#ifndef LL_LLEVENTNOTIFIER_H
28#define LL_LLEVENTNOTIFIER_H
29
30#include "llframetimer.h"
31#include "v3dmath.h"
32
33class LLEventNotification;
34class LLMessageSystem;
35
36
37class LLEventNotifier
38{
39public:
40	LLEventNotifier();
41	virtual ~LLEventNotifier();
42
43	void update();	// Notify the user of the event if it's coming up
44	bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
45	void add(U32 eventId);
46
47	
48	void load(const LLSD& event_options);	// In the format that it comes in from login
49	void remove(U32 event_id);
50
51	BOOL hasNotification(const U32 event_id);
52	void serverPushRequest(U32 event_id, bool add);
53
54	typedef std::map<U32, LLEventNotification *> en_map;
55	bool  handleResponse(U32 eventId, const LLSD& notification, const LLSD& response);		
56
57	static void processEventInfoReply(LLMessageSystem *msg, void **);	
58	
59protected:
60	en_map	mEventNotifications;
61	LLFrameTimer	mNotificationTimer;
62};
63
64
65class LLEventNotification
66{
67public:
68	LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
69
70
71	U32					getEventID() const				{ return mEventID; }
72	const std::string	&getEventName() const			{ return mEventName; }
73	bool                isValid() const                 { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; }
74	const F64		    &getEventDateEpoch() const		{ return mEventDateEpoch; }
75	const std::string   &getEventDateStr() const        { return mEventDateStr; }
76	
77	
78protected:
79	U32			mEventID;			// EventID for this event
80	std::string	mEventName;
81	F64		    mEventDateEpoch;
82	std::string mEventDateStr;
83};
84
85extern LLEventNotifier gEventNotifier;
86
87#endif //LL_LLEVENTNOTIFIER_H