/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. #ifndef LL_LLEVENTNOTIFIER_H
  27. #define LL_LLEVENTNOTIFIER_H
  28. #include "llframetimer.h"
  29. #include "v3dmath.h"
  30. class LLEventNotification;
  31. class LLMessageSystem;
  32. class LLEventNotifier
  33. {
  34. public:
  35. LLEventNotifier();
  36. virtual ~LLEventNotifier();
  37. void update(); // Notify the user of the event if it's coming up
  38. bool add(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
  39. void add(U32 eventId);
  40. void load(const LLSD& event_options); // In the format that it comes in from login
  41. void remove(U32 event_id);
  42. BOOL hasNotification(const U32 event_id);
  43. void serverPushRequest(U32 event_id, bool add);
  44. typedef std::map<U32, LLEventNotification *> en_map;
  45. bool handleResponse(U32 eventId, const LLSD& notification, const LLSD& response);
  46. static void processEventInfoReply(LLMessageSystem *msg, void **);
  47. protected:
  48. en_map mEventNotifications;
  49. LLFrameTimer mNotificationTimer;
  50. };
  51. class LLEventNotification
  52. {
  53. public:
  54. LLEventNotification(U32 eventId, F64 eventEpoch, const std::string& eventDateStr, const std::string &eventName);
  55. U32 getEventID() const { return mEventID; }
  56. const std::string &getEventName() const { return mEventName; }
  57. bool isValid() const { return mEventID > 0 && mEventDateEpoch != 0 && mEventName.size() > 0; }
  58. const F64 &getEventDateEpoch() const { return mEventDateEpoch; }
  59. const std::string &getEventDateStr() const { return mEventDateStr; }
  60. protected:
  61. U32 mEventID; // EventID for this event
  62. std::string mEventName;
  63. F64 mEventDateEpoch;
  64. std::string mEventDateStr;
  65. };
  66. extern LLEventNotifier gEventNotifier;
  67. #endif //LL_LLEVENTNOTIFIER_H