Notifications.h 885 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef NOTIFICATIONS_H
  2. #define NOTIFICATIONS_H
  3. #include <map>
  4. #include <string>
  5. #include <vector>
  6. /**
  7. * Namespace which holds notifications
  8. */
  9. namespace Notifications {
  10. /**
  11. * Add a new notification. Will be stored in messages and delivered by getMessages
  12. * @param message the new notification
  13. */
  14. void newNotification(const std::string &message);
  15. /**
  16. * Get all messages for a given users
  17. * Deletes all messages wihch are older than a week
  18. * @param user
  19. * @return vector with all messages
  20. */
  21. std::vector<std::string> getMessages(const std::string &user);
  22. /**
  23. * Stores the notifications
  24. * First is the timestamp
  25. * Second is the message
  26. */
  27. extern std::vector<std::pair<long int, std::string>> messages;
  28. /**
  29. * Stores information when a user get messages for the last time
  30. */
  31. extern std::map<std::string, long int> userTimeStamps;
  32. }; // namespace Notifications
  33. #endif