Index: trunk/src/lib/network/message_manager.cc
===================================================================
--- trunk/src/lib/network/message_manager.cc	(revision 8623)
+++ trunk/src/lib/network/message_manager.cc	(revision 8708)
@@ -19,4 +19,5 @@
 
 #include "network_stream.h"
+#include "shared_network_data.h"
 
 using namespace std;
@@ -196,5 +197,5 @@
         msg.number = userId;
         
-        incomingMessabeBuffer.push_back( msg );
+        incomingMessageBuffer.push_back( msg );
       }
       messageQueue[userId].recievedMessages.push_back( number );
@@ -204,5 +205,6 @@
   
   
-  for ( std::list<NetworkMessage>::iterator it = incomingMessabeBuffer.begin(); it != incomingMessabeBuffer.end();  )
+  //TODO maybe handle incomingMessage in tick function. else local messages will not be handled if no clients are connected
+  for ( std::list<NetworkMessage>::iterator it = incomingMessageBuffer.begin(); it != incomingMessageBuffer.end();  )
   {
     if ( (*(messageHandlerMap[it->messageId].cb))( it->messageId, it->data, it->length, messageHandlerMap[it->messageId].someData, it->number ) )
@@ -212,5 +214,5 @@
         delete it->data;
       it++;
-      incomingMessabeBuffer.erase( delIt );
+      incomingMessageBuffer.erase( delIt );
       continue;
     }
@@ -328,6 +330,4 @@
 
       it->second.messages.push_back( msg );
-      
-     
     }
   }
@@ -341,10 +341,10 @@
     msg.length = dataLength;
     msg.messageId = messageId;
-    msg.number = newNumber++;
+    msg.number = SharedNetworkData::getInstance()->getHostID();
     msg.priority = messagePriority;
 
-    incomingMessabeBuffer.push_back( msg );
-  }
-}
-
-
+    incomingMessageBuffer.push_back( msg );
+  }
+}
+
+
Index: trunk/src/lib/network/message_manager.h
===================================================================
--- trunk/src/lib/network/message_manager.h	(revision 8623)
+++ trunk/src/lib/network/message_manager.h	(revision 8708)
@@ -109,5 +109,5 @@
 
    int                       newNumber;              //!< used to create unique message numbers
-   std::list<NetworkMessage> incomingMessabeBuffer; 
+   std::list<NetworkMessage> incomingMessageBuffer; 
 
 };
Index: trunk/src/lib/network/network_game_manager.cc
===================================================================
--- trunk/src/lib/network/network_game_manager.cc	(revision 8623)
+++ trunk/src/lib/network/network_game_manager.cc	(revision 8708)
@@ -112,5 +112,5 @@
   stats->setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
   stats->setSynchronized( true );
-  stats->setOwner( getHostID() );
+  stats->setOwner( SharedNetworkData::getInstance()->getHostID() );
   
   stats->setTeamId( team );
@@ -247,5 +247,5 @@
 {
   if ( isServer() )
-    setPreferedTeam( getHostID(), teamId );
+    setPreferedTeam( SharedNetworkData::getInstance()->getHostID(), teamId );
   else
   {
@@ -284,4 +284,10 @@
 bool NetworkGameManager::chatMessageHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
 {
+  PRINTF(0)("NetworkGameManager::chatMessageHandler %d %d\n", userId, SharedNetworkData::getInstance()->getHostID() );
+  if ( NetworkGameManager::getInstance()->isServer() && userId !=  SharedNetworkData::getInstance()->getHostID() )
+  {
+    MessageManager::getInstance()->sendMessage( messageId, data, dataLength, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
+  }
+  
   assert( State::getGameRules() );
   assert( State::getGameRules()->isA( CL_NETWORK_GAME_RULES ) );
@@ -289,5 +295,5 @@
   NetworkGameRules & rules = *(dynamic_cast<NetworkGameRules*>(State::getGameRules()));
   
-  if ( dataLength < 2*INTSIZE )
+  if ( dataLength < 3*INTSIZE )
   {
     PRINTF(2)("got too small chatmessage from client %d\n", userId);
@@ -298,8 +304,10 @@
   int messageType = 0;
   Converter::byteArrayToInt( data, &messageType );
+  int senderUserId = 0;
+  Converter::byteArrayToInt( data+INTSIZE, &senderUserId );
   std::string message;
-  Converter::byteArrayToString( data+INTSIZE, message, dataLength-INTSIZE );
-  
-  rules.handleChatMessage( userId, message, messageType );
+  Converter::byteArrayToString( data+2*INTSIZE, message, dataLength-2*INTSIZE );
+  
+  rules.handleChatMessage( senderUserId, message, messageType );
 
   return true;
@@ -310,17 +318,18 @@
  * @param message message text
  * @param messageType some int
- * @param userId user to send message to -1 = ALL
- */
-void NetworkGameManager::sendChatMessage( const std::string & message, int messageType, int userId )
-{
-  byte * buf = new byte[message.length()+2*INTSIZE];
+ */
+void NetworkGameManager::sendChatMessage( const std::string & message, int messageType )
+{
+  byte * buf = new byte[message.length()+3*INTSIZE];
 
   assert( Converter::intToByteArray( messageType, buf, INTSIZE ) == INTSIZE );
-  assert( Converter::stringToByteArray(message, buf+INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
-  
-  if ( userId == -1 )
-    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+2*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
+  assert( Converter::intToByteArray( SharedNetworkData::getInstance()->getHostID(), buf+INTSIZE, INTSIZE ) == INTSIZE );
+  assert( Converter::stringToByteArray(message, buf+2*INTSIZE, message.length()+INTSIZE) == message.length()+INTSIZE );
+  
+  if ( this->isServer() )
+    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_ME, 0, MP_HIGHBANDWIDTH );
   else
-    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+2*INTSIZE, RT_USER, userId, MP_HIGHBANDWIDTH );
+    MessageManager::getInstance()->sendMessage( MSGID_CHATMESSAGE, buf, message.length()+3*INTSIZE, RT_ALL_NOT_ME, 0, MP_HIGHBANDWIDTH );
+
   
   delete [] buf;
Index: trunk/src/lib/network/network_game_manager.h
===================================================================
--- trunk/src/lib/network/network_game_manager.h	(revision 8623)
+++ trunk/src/lib/network/network_game_manager.h	(revision 8708)
@@ -65,5 +65,5 @@
     void tick( float ds );
     
-    void sendChatMessage( const std::string & message, int messageType, int userId = -1 );
+    void sendChatMessage( const std::string & message, int messageType );
 
   private:
Index: trunk/src/lib/network/network_manager.cc
===================================================================
--- trunk/src/lib/network/network_manager.cc	(revision 8623)
+++ trunk/src/lib/network/network_manager.cc	(revision 8708)
@@ -144,5 +144,5 @@
   this->elapsedTime = 0.0f;
 
-  if ( networkStream->isActive() )
+//  if ( networkStream->isActive() )
     networkStream->processData();
   
Index: trunk/src/lib/network/player_stats.cc
===================================================================
--- trunk/src/lib/network/player_stats.cc	(revision 8623)
+++ trunk/src/lib/network/player_stats.cc	(revision 8708)
@@ -95,5 +95,5 @@
     this->setPlayableUniqueId( this->playableUniqueId );
     
-    PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID());
+    PRINTF(0)("uniqueID changed %d %d %d\n", userId, SharedNetworkData::getInstance()->getHostID(), getUniqueID());
   }
   
@@ -155,5 +155,5 @@
   }
   
-  if ( this->playable && userId == getHostID() )
+  if ( this->playable && userId == SharedNetworkData::getInstance()->getHostID() )
   {
     State::getPlayer()->setPlayable( this->playable );
Index: trunk/src/lib/network/synchronizeable.cc
===================================================================
--- trunk/src/lib/network/synchronizeable.cc	(revision 8623)
+++ trunk/src/lib/network/synchronizeable.cc	(revision 8708)
@@ -38,6 +38,5 @@
   this->setClassID(CL_SYNCHRONIZEABLE, "Synchronizeable");
   this->owner = 0;
-  this->hostID = SharedNetworkData::getInstance()->getHostID();
-  this->setIsServer(this->hostID == 0);
+  this->setIsServer(SharedNetworkData::getInstance()->getHostID() == 0);
   this->uniqueID = NET_UID_UNASSIGNED;
   this->networkStream = NULL;
@@ -222,5 +221,5 @@
     hasPermission = (
             this->isServer() && (*it)->checkPermission( PERMISSION_SERVER ) ||
-            this->owner == this->hostID && (*it)->checkPermission( PERMISSION_OWNER ) ||
+        this->owner == SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
             this->isServer() && this->owner != userId && (*it)->checkPermission( PERMISSION_OWNER ) ||
             (*it)->checkPermission( PERMISSION_ALL ) 
@@ -345,5 +344,5 @@
         (*it)->checkPermission( PERMISSION_SERVER ) && networkStream->isUserServer( userId ) ||
         (*it)->checkPermission( PERMISSION_OWNER ) && this->owner == userId ||
-        networkStream->isUserServer( userId ) && this->owner != getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
+        networkStream->isUserServer( userId ) && this->owner != SharedNetworkData::getInstance()->getHostID() && (*it)->checkPermission( PERMISSION_OWNER ) ||
         (*it)->checkPermission( PERMISSION_ALL ) 
        )
Index: trunk/src/lib/network/synchronizeable.h
===================================================================
--- trunk/src/lib/network/synchronizeable.h	(revision 8623)
+++ trunk/src/lib/network/synchronizeable.h	(revision 8708)
@@ -67,5 +67,4 @@
     inline void setUniqueID( int id ){ uniqueID = id; }
     inline int  getUniqueID() const { return uniqueID; }
-    inline int getHostID() { return this->hostID; }
 
     inline int getOwner(){ return owner; }
@@ -89,5 +88,4 @@
     int               mLeafClassId;   //!< store leafClassId to send via states
     int               owner;          //!< hostId of owner ( 0 if none / server )
-    int               hostID;         //!< my own host id
     bool              bSynchronize;   //!< do we need beeing synchronized?
 
Index: trunk/src/util/multiplayer_team_deathmatch.cc
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.cc	(revision 8623)
+++ trunk/src/util/multiplayer_team_deathmatch.cc	(revision 8708)
@@ -43,4 +43,6 @@
 
 #include "story_entity.h"
+
+#include "shell_command.h"
 
 
@@ -80,4 +82,14 @@
   
   subscribeEvent( ES_GAME, SDLK_o );
+  subscribeEvent( ES_GAME, SDLK_TAB );
+  
+  this->notifier = new OrxGui::GLGuiNotifier();
+  this->notifier->show();
+  this->notifier->setAbsCoor2D(5, 30);
+  this->notifier->setFadeAge( 6.0 );
+  this->notifier->setHideAge( 8.0 );
+  this->input = new OrxGui::GLGuiInputLine();
+  this->input->setAbsCoor2D(180, 5);
+  this->input->connect(SIGNAL(input, enterPushed), this, SLOT(MultiplayerTeamDeathmatch, onInputEnter));
 }
 
@@ -91,4 +103,17 @@
   
   unsubscribeEvent( ES_GAME, SDLK_o );
+  unsubscribeEvent( ES_GAME, SDLK_TAB );
+  
+  if ( this->notifier )
+  {
+    delete this->notifier;
+    this->notifier = NULL;
+  }
+  
+  if ( this->input )
+  {
+    delete this->input;
+    this->input = NULL;
+  }
 }
 
@@ -539,4 +564,16 @@
       this->bShowTeamChange = true;
   }
+  else if ( event.type == SDLK_TAB )
+  {
+    if ( !event.bPressed )
+    {
+      EventHandler::getInstance()->pushState( ES_MENU );
+      OrxGui::GLGuiHandler::getInstance()->activateCursor();
+      OrxGui::GLGuiHandler::getInstance()->deactivateCursor();
+      input->show();
+      input->giveFocus();
+      input->setText("say ");
+    }
+  }
 }
 
@@ -563,8 +600,28 @@
   }
   
-  PRINTF(0)("CHATMESSAGE %s: %s\n", name.c_str(), message.c_str() );
-}
-
-
-
-
+  PRINTF(0)("CHATMESSAGE %s (%d): %s\n", name.c_str(), userId, message.c_str() );
+  notifier->pushNotifyMessage(name + ": " + message);
+}
+
+void MultiplayerTeamDeathmatch::onInputEnter( const std::string & text )
+{
+  EventHandler::getInstance()->popState();
+  input->breakFocus();
+  input->hide();
+  input->setText("");
+
+  std::string command = text;
+ 
+  //HACK insert " in say commands so user doesn't have to type them
+  if ( command.length() >= 4 && command[0] == 's' && command[1] == 'a' && command[2] == 'y' && command[3] == ' ' )
+  {
+    command.insert( 4, "\"" );
+    command = command + "\"";
+  }
+
+  OrxShell::ShellCommand::execute( command );
+}
+
+
+
+
Index: trunk/src/util/multiplayer_team_deathmatch.h
===================================================================
--- trunk/src/util/multiplayer_team_deathmatch.h	(revision 8623)
+++ trunk/src/util/multiplayer_team_deathmatch.h	(revision 8708)
@@ -13,4 +13,5 @@
 
 #include "glgui.h"
+#include "specials/glgui_notifier.h"
 
 class TiXmlElement;
@@ -82,4 +83,7 @@
     OrxGui::GLGuiBox* box;
     
+    OrxGui::GLGuiNotifier* notifier;
+    OrxGui::GLGuiInputLine* input;
+    
     void calculateTeamScore();
     void nextGameState();
@@ -94,4 +98,6 @@
     void onButtonCancel();
     void onButtonExit();
+    
+    void onInputEnter( const std::string & text );
 };
 
Index: trunk/src/world_entities/space_ships/space_ship.cc
===================================================================
--- trunk/src/world_entities/space_ships/space_ship.cc	(revision 8623)
+++ trunk/src/world_entities/space_ships/space_ship.cc	(revision 8708)
@@ -33,4 +33,5 @@
 
 #include "network_game_manager.h"
+#include "shared_network_data.h"
 
 #include "power_ups/weapon_power_up.h"
@@ -326,5 +327,5 @@
   Playable::tick(time);
 
-  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == this->getHostID() )
+  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
    {
     if (xMouse > controlVelocityX) xMouse = controlVelocityX;
Index: trunk/src/world_entities/spectator.cc
===================================================================
--- trunk/src/world_entities/spectator.cc	(revision 8623)
+++ trunk/src/world_entities/spectator.cc	(revision 8708)
@@ -20,4 +20,5 @@
 #include "key_mapper.h"
 
+#include "shared_network_data.h"
 
 CREATE_FACTORY(Spectator, CL_SPECTATOR);
@@ -161,5 +162,5 @@
   Playable::tick( time );
   
-  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == this->getHostID() )
+  if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() )
   {
     xMouse *= time / 10;
