Index: code/branches/output/src/libraries/network/CMakeLists.txt
===================================================================
--- code/branches/output/src/libraries/network/CMakeLists.txt	(revision 8827)
+++ code/branches/output/src/libraries/network/CMakeLists.txt	(revision 8829)
@@ -19,5 +19,4 @@
 
 SET_SOURCE_FILES(NETWORK_SRC_FILES
-  ChatListener.cc
   Client.cc
   ClientConnection.cc
@@ -45,5 +44,4 @@
 
 SET_SOURCE_FILES(NETWORK_HDR_FILES
-  ChatListener.h
   Client.h
   ClientConnection.h
@@ -61,4 +59,5 @@
   WANDiscovery.h
   MasterServerComm.h
+  NetworkChatListener.h
   NetworkFunction.h
   NetworkPrecompiledHeaders.h
Index: code/branches/output/src/libraries/network/ChatListener.cc
===================================================================
--- code/branches/output/src/libraries/network/ChatListener.cc	(revision 8827)
+++ 	(revision )
@@ -1,50 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#include "ChatListener.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
-    ChatListener::ChatListener()
-    {
-        RegisterRootObject(ChatListener);
-    }
-
-    //void ChatListener::incomingChat( const std::string& message,
-      //unsigned int senderID )
-    //{
-      //orxout(message) << "Chat: \"" << message << "\"" << endl;
-
-
-    //}
-
-
-}
-
-
Index: code/branches/output/src/libraries/network/ChatListener.h
===================================================================
--- code/branches/output/src/libraries/network/ChatListener.h	(revision 8827)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- *   ORXONOX - the hottest 3D action shooter ever to exist
- *                    > www.orxonox.net <
- *
- *
- *   License notice:
- *
- *   This program is free software; you can redistribute it and/or
- *   modify it under the terms of the GNU General Public License
- *   as published by the Free Software Foundation; either version 2
- *   of the License, or (at your option) any later version.
- *
- *   This program is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with this program; if not, write to the Free Software
- *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
- *
- *   Author:
- *      Fabian 'x3n' Landau
- *   Co-authors:
- *      ...
- *
- */
-
-#ifndef _NETWORK_ChatListener__
-#define _NETWORK_ChatListener__
-
-#include "NetworkPrereqs.h"
-#include "core/OrxonoxClass.h"
-
-namespace orxonox
-{
-    class _NetworkExport ChatListener : virtual public OrxonoxClass
-    {
-        public:
-            /* constructor, destructor */
-            ChatListener();
-            virtual ~ChatListener() {}
-
-            /* What to do with incoming chat */
-            virtual void incomingChat(const std::string& message, unsigned int senderID) = 0;
-    };
-}
-
-#endif /* _NETWORK_ChatListener__ */
Index: code/branches/output/src/libraries/network/Client.cc
===================================================================
--- code/branches/output/src/libraries/network/Client.cc	(revision 8827)
+++ code/branches/output/src/libraries/network/Client.cc	(revision 8829)
@@ -116,10 +116,4 @@
   }
 
-  bool Client::processChat(const std::string& message, unsigned int playerID)
-  {
-//    orxout(message) << "Player " << playerID << ": " << message << endl;
-    return true;
-  }
-
   void Client::printRTT()
   {
@@ -128,14 +122,24 @@
 
   /**
-   * This function implements the method of sending a chat message to the server
+   * @brief Sends a chat message to the server.
    * @param message message to be sent
-   * @return result(true/false)
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
    */
-  bool Client::chat(const std::string& message)
-  {
-    packet::Chat *m = new packet::Chat(message, Host::getPlayerID());
-    return m->send(static_cast<Host*>(this));
-  }
-
+  void Client::doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // send the message to the server
+    packet::Chat* packet = new packet::Chat(message, sourceID, targetID);
+    packet->send(static_cast<Host*>(this));
+  }
+
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Calls the parent function which passes the message to the listeners.
+   */
+  void Client::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // call the parent function which passes the message to the listeners
+    Host::doReceiveChat(message, sourceID, targetID);
+  }
 
   /**
@@ -203,5 +207,5 @@
     Game::getInstance().popState();
   }
-  
+
   void Client::processPacket(packet::Packet* packet)
   {
@@ -216,7 +220,3 @@
       packet->process(static_cast<Host*>(this));
   }
-
-
-
-
 }
Index: code/branches/output/src/libraries/network/Client.h
===================================================================
--- code/branches/output/src/libraries/network/Client.h	(revision 8827)
+++ code/branches/output/src/libraries/network/Client.h	(revision 8829)
@@ -73,5 +73,5 @@
     Client();
     ~Client();
-    
+
     static Client* getInstance(){ return singletonPtr_s; } // tolua_export
 
@@ -81,7 +81,6 @@
     void queuePacket(ENetPacket* packet, int clientID, uint8_t channelID);
     virtual bool sendPacket( packet::Packet* packet ){ return packet->send( static_cast<Host*>(this) ); }
-    bool processChat(const std::string& message, unsigned int playerID);
-    virtual bool chat(const std::string& message);
-    virtual bool broadcast(const std::string& message) { return false; }
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     virtual void printRTT();
 
Index: code/branches/output/src/libraries/network/Host.cc
===================================================================
--- code/branches/output/src/libraries/network/Host.cc	(revision 8827)
+++ code/branches/output/src/libraries/network/Host.cc	(revision 8829)
@@ -32,7 +32,8 @@
 #include <string>
 
+#include "core/CoreIncludes.h"
 #include "core/ObjectList.h"
 #include "core/command/ConsoleCommand.h"
-#include "ChatListener.h"
+#include "NetworkChatListener.h"
 
 namespace orxonox {
@@ -41,5 +42,4 @@
   static const std::string __CC_printRTT_name = "printRTT";
 
-  SetConsoleCommand("chat", &Host::Chat);
   SetConsoleCommand(__CC_printRTT_group, __CC_printRTT_name, &Host::printRTT);
 
@@ -89,54 +89,26 @@
   }
 
-  void Host::Chat(const std::string& message)
+  /**
+   * @brief Sends a chat message through the network.
+   * @param message message to be sent
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
+   */
+  void Host::sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
   {
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, 0);
-
-    bool result = true;
     for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-    {
       if( (*it)->isActive() )
-      {
-        if( !(*it)->chat(message) )
-          result = false;
-      }
-    }
-//    return result;
+        (*it)->doSendChat(message, sourceID, targetID);
   }
 
-  bool Host::Broadcast(const std::string& message)
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Passes the message to the listeners.
+   */
+  void Host::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
   {
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, NETWORK_PEER_ID_BROADCAST);
-
-    bool result = true;
-    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-    {
-      if( (*it)->isActive() )
-      {
-        if( !(*it)->broadcast(message) )
-          result = false;
-      }
-    }
-    return result;
+    for (ObjectList<NetworkChatListener>::iterator it = ObjectList<NetworkChatListener>::begin(); it != ObjectList<NetworkChatListener>::end(); ++it)
+      it->incomingChat(message, sourceID);
   }
 
-  bool Host::incomingChat(const std::string& message, unsigned int playerID)
-  {
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, playerID);
-
-    bool result = true;
-    for( std::vector<Host*>::iterator it = instances_s.begin(); it!=instances_s.end(); ++it )
-    {
-      if( (*it)->isActive() )
-      {
-        if( !(*it)->processChat(message, playerID) )
-          result = false;
-      }
-    }
-    return result;
-  }
 
   bool Host::isServer()
@@ -167,3 +139,12 @@
 
 
+  //////////////////////////////////////////////////////////////////////////
+  // NetworkChatListener                                                  //
+  //////////////////////////////////////////////////////////////////////////
+
+  NetworkChatListener::NetworkChatListener()
+  {
+      RegisterRootObject(NetworkChatListener);
+  }
+
 }//namespace orxonox
Index: code/branches/output/src/libraries/network/Host.h
===================================================================
--- code/branches/output/src/libraries/network/Host.h	(revision 8827)
+++ code/branches/output/src/libraries/network/Host.h	(revision 8829)
@@ -52,15 +52,9 @@
 class _NetworkExport Host: public GamestateManager
 {
+  friend class packet::Chat;
+
   private:
-    //TODO add these functions or adequate
-    //virtual bool processChat(packet::Chat *message, unsigned int clientID)=0;
-    //virtual bool sendChat(packet::Chat *chat)=0;
     virtual void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID)=0;
-    virtual bool chat(const std::string& message)=0;
-    virtual bool broadcast(const std::string& message)=0;
-    virtual bool processChat(const std::string& message, unsigned int playerID)=0;
     virtual bool isServer_()=0;
-
-
 
   protected:
@@ -68,5 +62,7 @@
     virtual ~Host();
     void setActive( bool bActive ){ bIsActive_ = bActive; }
-//     static Host *instance_;
+
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)=0;
 
   public:
@@ -74,12 +70,8 @@
     static bool running(){ return instances_s.size(); }
     static void addPacket(ENetPacket* packet, int clientID = NETWORK_PEER_ID_SERVER, uint8_t channelID = 0);
-    //static bool chat(std::string& message);
-//     static bool receiveChat(packet::Chat *message, unsigned int clientID);
     static unsigned int getPlayerID(){ return clientID_s; }
     static void setClientID(unsigned int id){ clientID_s = id; }
     static bool isServer();
-    static void Chat(const std::string& message);
-    static bool Broadcast(const std::string& message);
-    static bool incomingChat(const std::string& message, unsigned int playerID);
+    static void sendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     virtual void printRTT()=0;
     bool isActive(){ return bIsActive_; }
Index: code/branches/output/src/libraries/network/NetworkChatListener.h
===================================================================
--- code/branches/output/src/libraries/network/NetworkChatListener.h	(revision 8829)
+++ code/branches/output/src/libraries/network/NetworkChatListener.h	(revision 8829)
@@ -0,0 +1,61 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#ifndef _NetworkChatListener_H__
+#define _NetworkChatListener_H__
+
+#include "NetworkPrereqs.h"
+
+namespace orxonox
+{
+    /**
+        @brief The only function of this interface, incomingChat(), gets called whenever a chat
+        message was received through the network.
+
+        This interface exists mostly to resolve circular dependencies between the chat functions
+        in Host and ChatManager. ChatManager is the main derivative of this interface.
+    */
+    class _NetworkExport NetworkChatListener : virtual public OrxonoxClass
+    {
+        friend class Host;
+
+        public:
+            NetworkChatListener(); // implemented in Host.cc
+            virtual ~NetworkChatListener() {}
+
+        protected:
+            /**
+                @brief Gets called when a chat message was received through the network.
+                @param message The message
+                @param sourceID The (network) client ID of the sender
+            */
+            virtual void incomingChat(const std::string& message, unsigned int sourceID) = 0;
+    };
+}
+
+#endif /* _NetworkChatListener_H__ */
Index: code/branches/output/src/libraries/network/NetworkPrereqs.h
===================================================================
--- code/branches/output/src/libraries/network/NetworkPrereqs.h	(revision 8827)
+++ code/branches/output/src/libraries/network/NetworkPrereqs.h	(revision 8829)
@@ -118,5 +118,4 @@
 namespace orxonox
 {
-  class ChatListener;
   class Client;
   class ClientConnection;
@@ -130,4 +129,5 @@
   class GamestateManager;
   class Host;
+  class NetworkChatListener;
   class NetworkFunctionBase;
   struct NetworkFunctionPointer;
Index: code/branches/output/src/libraries/network/Server.cc
===================================================================
--- code/branches/output/src/libraries/network/Server.cc	(revision 8827)
+++ code/branches/output/src/libraries/network/Server.cc	(revision 8829)
@@ -56,5 +56,4 @@
 #include "packet/Gamestate.h"
 #include "packet/Welcome.h"
-#include "ChatListener.h"
 // #include "ClientInformation.h"
 #include "FunctionCallManager.h"
@@ -104,5 +103,5 @@
   void Server::helper_ConnectToMasterserver()
   {
-//     WANDiscovery::getInstance().msc.sendRequest( MSPROTO_GAME_SERVER " " 
+//     WANDiscovery::getInstance().msc.sendRequest( MSPROTO_GAME_SERVER " "
 //       MSPROTO_REGISTER_SERVER );
   }
@@ -116,5 +115,5 @@
     orxout(verbose, context::network) << "opening server" << endl;
     this->openListener();
-    
+
     /* make discoverable on LAN */
     LANDiscoverable::setActivity(true);
@@ -123,5 +122,5 @@
     WANDiscoverable::setActivity(true);
     /* TODO this needs to be optional, we need a switch from the UI to
-     * enable/disable this 
+     * enable/disable this
      */
 //     helper_ConnectToMasterserver();
@@ -143,5 +142,5 @@
     /* tell master server we're closing */
     orxout(internal_info, context::network) << "disconnecting." << endl;
-    WANDiscoverable::setActivity(false);    
+    WANDiscoverable::setActivity(false);
     orxout(internal_info, context::network) << "disconnecting done" << endl;
 
@@ -150,29 +149,13 @@
   }
 
-  bool Server::processChat(const std::string& message, unsigned int playerID)
-  {
-//     ClientInformation *temp = ClientInformation::getBegin();
-    packet::Chat *chat;
-//     while(temp){
-    chat = new packet::Chat(message, playerID);
-    chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
-    chat->send( static_cast<Host*>(this) );
-//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
-//       temp = temp->next();
-//     }
-//    orxout(message) << "Player " << playerID << ": " << message << endl;
-    return true;
-  }
-
-
   /* handle incoming data */
   int rephandler( char *addr, ENetEvent *ev )
-  { 
+  {
     /* reply to pings */
-    if( !strncmp( (char *)ev->packet->data, MSPROTO_PING_GAMESERVER, 
+    if( !strncmp( (char *)ev->packet->data, MSPROTO_PING_GAMESERVER,
       MSPROTO_PING_GAMESERVER_LEN ) )
       //this->msc.sendRequest( MSPROTO_ACK );
       /* NOTE implement this after pollForReply
-       * reimplementation 
+       * reimplementation
        */
       return 0;
@@ -183,6 +166,6 @@
 
   void Server::helper_HandleMasterServerRequests()
-  { 
-    /* poll the master server for replies and see whether something 
+  {
+    /* poll the master server for replies and see whether something
      * has to be done or changed.
      */
@@ -202,5 +185,5 @@
     // receive and process incoming discovery packets
     LANDiscoverable::update();
-    
+
     // receive and process requests from master server
     /* todo */
@@ -330,5 +313,5 @@
   {
 //     static unsigned int newid=1;
-// 
+//
 //     orxout(internal_info, context::network) << "Server: adding client" << endl;
 //     ClientInformation *temp = ClientInformation::insertBack(new ClientInformation);
@@ -375,5 +358,5 @@
 //     }
   }
-  
+
   void Server::processPacket(packet::Packet* packet)
   {
@@ -411,5 +394,5 @@
 //     temp->setSynched(true);
     GamestateManager::setSynched(clientID);
-    
+
     orxout(verbose, context::network) << "sending welcome" << endl;
     packet::Welcome *w = new packet::Welcome(clientID);
@@ -438,31 +421,50 @@
   }
 
-  bool Server::chat(const std::string& message)
-  {
-      return this->sendChat(message, Host::getPlayerID());
-  }
-
-  bool Server::broadcast(const std::string& message)
-  {
-      return this->sendChat(message, NETWORK_PEER_ID_BROADCAST);
-  }
-
-  bool Server::sendChat(const std::string& message, unsigned int clientID)
-  {
-//     ClientInformation *temp = ClientInformation::getBegin();
-    packet::Chat *chat;
-//     while(temp)
-    {
-      chat = new packet::Chat(message, clientID);
-      chat->setPeerID(NETWORK_PEER_ID_BROADCAST);
-      chat->send( static_cast<Host*>(this) );
-//         orxout(internal_warning, context::network) << "could not send Chat message to client ID: " << temp->getID() << endl;
-//       temp = temp->next();
-    }
-//    orxout(message) << "Player " << Host::getPlayerID() << ": " << message << endl;
-    for (ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)
-      it->incomingChat(message, clientID);
-
-    return true;
+  /**
+   * @brief Sends a chat message to the given target ID.
+   * @param message message to be sent
+   * @param sourceID the ID of the sender
+   * @param targetID the ID of the receiver
+   */
+  void Server::doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+    // check if the target exists. just ignore the message otherwise
+    if (!this->isValidTarget(targetID)) // TODO: remove this if an invalid clientIDs don't trigger assertions anymore
+      return;
+
+    // send the message to the target
+    packet::Chat* packet = new packet::Chat(message, sourceID, targetID);
+    packet->setPeerID(targetID);
+    packet->send( static_cast<Host*>(this) );
+
+    // if the target is (or includes) this host as well, call the parent function which passes the message to the listeners
+    if (targetID == NETWORK_PEER_ID_BROADCAST || targetID == Host::getPlayerID())
+      Host::doReceiveChat(message, sourceID, targetID);
+  }
+
+  /**
+   * @brief Gets called if a packet::Chat packet is received. Forwards the packet to the target
+   * and calls the parent function if necessary.
+   */
+  void Server::doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID)
+  {
+      this->doSendChat(message, sourceID, targetID);
+  }
+
+  /**
+   * @brief Returns true if the target ID is in the list of clients (or if it
+   * corresponds to the broadcast or the server ID).
+   */
+  bool Server::isValidTarget(unsigned int targetID)
+  {
+    if (targetID == NETWORK_PEER_ID_BROADCAST || targetID == NETWORK_PEER_ID_SERVER)
+      return true;
+
+    std::vector<uint32_t>::iterator it;
+    for( it=this->clientIDs_.begin(); it!=this->clientIDs_.end(); ++it )
+      if( *it == targetID )
+        return true;
+
+    return false;
   }
 
Index: code/branches/output/src/libraries/network/Server.h
===================================================================
--- code/branches/output/src/libraries/network/Server.h	(revision 8827)
+++ code/branches/output/src/libraries/network/Server.h	(revision 8829)
@@ -68,5 +68,4 @@
     void open();
     void close();
-    bool processChat(const std::string& message, unsigned int playerID);
     void queuePacket(ENetPacket *packet, int clientID, uint8_t channelID);
     virtual bool sendPacket( packet::Packet* packet ){ return packet->send( static_cast<Host*>(this) ); }
@@ -89,7 +88,7 @@
     bool sendGameStates();
     bool sendObjectDeletes();
-    virtual bool chat(const std::string& message);
-    virtual bool broadcast(const std::string& message);
-    bool sendChat(const std::string& message, unsigned int clientID);
+    bool isValidTarget(unsigned int targetID);
+    virtual void doSendChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
+    virtual void doReceiveChat(const std::string& message, unsigned int sourceID, unsigned int targetID);
     void syncClassid(unsigned int clientID);
 
Index: code/branches/output/src/libraries/network/packet/Chat.cc
===================================================================
--- code/branches/output/src/libraries/network/packet/Chat.cc	(revision 8827)
+++ code/branches/output/src/libraries/network/packet/Chat.cc	(revision 8829)
@@ -39,10 +39,11 @@
 
 /* Some lengths */
-#define   _PACKETID         0
-const int _PLAYERID     =   _PACKETID + sizeof(Type::Value);
-#define   _MESSAGELENGTH    _PLAYERID + sizeof(uint32_t)
-#define   _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
+#define _PACKETID         0
+#define _SOURCEID         _PACKETID + sizeof(Type::Value)
+#define _TARGETID         _SOURCEID + sizeof(uint32_t)
+#define _MESSAGELENGTH    _TARGETID + sizeof(uint32_t)
+#define _MESSAGE          _MESSAGELENGTH + sizeof(uint32_t)
 
-Chat::Chat( const std::string& message, unsigned int playerID )
+Chat::Chat( const std::string& message, unsigned int sourceID, unsigned int targetID )
  : Packet()
 {
@@ -57,5 +58,6 @@
 
   *(Type::Value *)(data_ + _PACKETID ) = Type::Chat;
-  *(unsigned int *)(data_ + _PLAYERID ) = playerID;
+  *(unsigned int *)(data_ + _SOURCEID ) = sourceID;
+  *(unsigned int *)(data_ + _TARGETID ) = targetID;
   *(unsigned int *)(data_ + _MESSAGELENGTH ) = messageLength_;
 
@@ -81,7 +83,7 @@
 
 bool Chat::process(orxonox::Host* host){
-  bool b = host->incomingChat(std::string((const char*)data_+_MESSAGE), *(uint32_t *)(data_+_PLAYERID));
+  host->doReceiveChat(std::string((const char*)data_+_MESSAGE), *(uint32_t *)(data_+_SOURCEID), *(uint32_t *)(data_+_TARGETID));
   delete this;
-  return b;
+  return true;
 }
 
Index: code/branches/output/src/libraries/network/packet/Chat.h
===================================================================
--- code/branches/output/src/libraries/network/packet/Chat.h	(revision 8827)
+++ code/branches/output/src/libraries/network/packet/Chat.h	(revision 8829)
@@ -42,5 +42,5 @@
 public:
   /* constructors */
-  Chat( const std::string& message, unsigned int playerID );
+  Chat( const std::string& message, unsigned int sourceID, unsigned int targetID );
   Chat( uint8_t* data, unsigned int clientID );
 
