Index: code/trunk/src/modules/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.h	(revision 7552)
+++ code/trunk/src/modules/notifications/NotificationManager.h	(revision 8706)
@@ -42,6 +42,7 @@
 #include <string>
 
+#include "core/OrxonoxClass.h"
 #include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "interfaces/NotificationListener.h"
 
 namespace orxonox // tolua_export
@@ -50,7 +51,60 @@
     /**
     @brief
-        The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners".
-        It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners".
-        It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
+        A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts).
+
+        A Notification is just a data structure that is used internally by the Notifications module.
+
+    @author
+        Damian 'Mozork' Frick
+
+    @ingroup Notifications
+    */
+    class _NotificationsExport Notification
+    {
+        public:
+            Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
+            virtual ~Notification();
+
+            /**
+            @brief Destroys the Notification.
+            */
+            void destroy(void)
+                { delete this; }
+
+            /**
+            @brief Get the message of the Notification.
+            @return Returns the message of the Notification.
+            */
+            inline const std::string & getMessage(void) const
+                { return this->message_; }
+
+            /**
+            @brief Get the sender of the Notification.
+            @return Returns the sender of the Notification.
+            */
+            inline const std::string & getSender(void) const
+                { return this->sender_; }
+
+            /**
+            @brief Get the type of the Notification.
+            @return Returns an enum with the type of the Notification.
+            */
+            inline notificationMessageType::Value getType(void) const
+                { return this->type_; }
+
+        private:
+            std::string message_; //!< The Notification message.
+            std::string sender_; //!< The sender of the notification.
+            notificationMessageType::Value type_; //!< The type of the notification.
+
+            void initialize(void); //!< Registers the object and sets some default values.
+
+    };
+
+    /**
+    @brief
+        The Singleton NotificationManager is a NotificationListener and functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationQueue "NotificationQueues".
+        It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationQueue "NotificationQueues".
+        It also works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
 
     @author
@@ -60,5 +114,5 @@
     */
     class _NotificationsExport NotificationManager // tolua_export
-        : public Singleton<NotificationManager>, public OrxonoxClass
+        : public Singleton<NotificationManager>, public NotificationListener
     { // tolua_export
             friend class Singleton<NotificationManager>;
@@ -67,5 +121,5 @@
             virtual ~NotificationManager();
 
-            virtual void preDestroy(void); //!< Is called before the object is destroyed.
+            virtual void preDestroy(void); // Is called before the object is destroyed.
 
             /**
@@ -75,50 +129,43 @@
             static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
 
-            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
-            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
+            virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
+            virtual bool executeCommand(notificationCommand::Value command, const std::string& sender);
 
-            //! Sends a Notification with the specified message to the specified client from the specified sender.
-            static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationManager::NONE, bool isLocal = false);
+            bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager.
+            void unregisterNotification(Notification* notification, NotificationQueue* queue); // Unregisters a Notification within the NotificationManager for a given NotificationQueue.
 
-            bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
-            void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener.
-            bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
-            void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
-
-            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
+            void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); // Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map.
 
             /**
-            @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map.
-            @param listener The NotificationListener the Notifications are fetched for.
+            @brief Fetches the Notifications for a specific NotificationQueue in a timeframe from (now-timeDelay) to now and stores them in the input map.
+            @param queue The NotificationQueue the Notifications are fetched for.
             @param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
             @param timeDelay The timespan.
             @return Returns true if successful.
             */
-            void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
-                { this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+            void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int timeDelay)
+                { this->getNotifications(queue, map, std::time(0)-timeDelay, std::time(0)); }
 
-            void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
+            void getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); // Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map.
 
-            bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
-            void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue.
+            bool registerQueue(NotificationQueue* queue); // Registers a NotificationQueue.
+            void unregisterQueue(NotificationQueue* queue); // Unregisters a NotificationQueue.
 
-            // tolua_begin
-            void loadQueues(void); //!< Loads all the NotificationQueues that should exist.
-            void createQueue(const std::string& name); //!< Creates a new NotificationQueue.
-            orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name.
-            // tolua_end
+            void loadQueues(void); // tolua_export // Loads all the NotificationQueues that should exist.
+
+            NotificationQueue* getQueue(const std::string & name); // Get the NotificationQueue with the input name.
 
         private:
             static NotificationManager* singletonPtr_s;
 
-            unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
-
             std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored.
-            std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
-            std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
+            std::map<const std::string, std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
 
             std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
 
-            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
+            bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); // Helper method that removes an input Notification form an input map.
+            
+            // Commands
+            bool commandClear(const std::string& sender); // The clear command. Clears all NotificationQueues that have its sender as a target.
 
     }; // tolua_export
