Index: branches/proxy/src/lib/network/message_manager.cc
===================================================================
--- branches/proxy/src/lib/network/message_manager.cc	(revision 9247)
+++ branches/proxy/src/lib/network/message_manager.cc	(revision 9250)
@@ -52,13 +52,13 @@
       }
     }
-    
+
     it->second.messages.clear();
     it->second.toAck.clear();
   }
-  
+
   messageQueue.clear();
-  
+
   this->messageHandlerMap.clear();
-  
+
   MessageManager::singletonRef = NULL;
 }
@@ -82,9 +82,9 @@
   int i = 0;
   int n;
-  
+
   n = Converter::intToByteArray( messageQueue[userId].toAck.size(), data + i, maxLength );
   i += n;
   assert( n == INTSIZE );
-  
+
   for ( std::list<int>::iterator it = messageQueue[userId].toAck.begin(); it != messageQueue[userId].toAck.end(); it++)
   {
@@ -93,11 +93,11 @@
     assert( n == INTSIZE );
   }
-  
+
   messageQueue[userId].toAck.clear();
-  
+
   n = Converter::intToByteArray( messageQueue[userId].messages.size(), data + i, maxLength );
   i += n;
   assert( n == INTSIZE );
-  
+
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end(); it++ )
   {
@@ -105,18 +105,18 @@
     i += n;
     assert( n == INTSIZE );
-    
+
     n = Converter::intToByteArray( it->number, data + i, maxLength );
     i += n;
     assert( n == INTSIZE );
-    
+
     n = Converter::intToByteArray( it->messageId, data + i, maxLength );
     i += n;
     assert( n == INTSIZE );
-    
+
     assert( i + it->length <= maxLength );
     memcpy( data + i, it->data, it->length );
     i += it->length;
   }
-  
+
   return i;
 }
@@ -136,16 +136,16 @@
   int i = 0;
   int n;
-  
+
   int nAcks;
-  
+
   assert( i + INTSIZE <= length );
   n = Converter::byteArrayToInt( data + i, &nAcks );
   assert( n == INTSIZE );
   i += n;
-  
+
   std::list<int> acks;
-  
+
   int number;
-  
+
   for ( int j = 0; j < nAcks; j++ )
   {
@@ -154,10 +154,10 @@
     assert( n == INTSIZE );
     i += n;
-    
+
     acks.push_back( number );
   }
-  
+
   int nMessages;
-  
+
   assert( i + INTSIZE <= length );
   n = Converter::byteArrayToInt( data + i, &nMessages );
@@ -166,5 +166,5 @@
 
   int messageLength, messageId;
-  
+
   for ( int j = 0; j < nMessages; j++ )
   {
@@ -173,18 +173,18 @@
     assert( n == INTSIZE );
     i += n;
-    
+
     assert( i + INTSIZE <= length );
     n = Converter::byteArrayToInt( data + i, &number );
     assert( n == INTSIZE );
     i += n;
-  
+
     assert( i + INTSIZE <= length );
     n = Converter::byteArrayToInt( data + i, &messageId );
     assert( n == INTSIZE );
     i += n;
-    
+
     if ( number > 0 )
       messageQueue[userId].toAck.push_back( number );
-    
+
     assert( i + messageLength <= length );
     assert( messageHandlerMap.find( (MessageId)messageId ) != messageHandlerMap.end() );
@@ -194,5 +194,5 @@
       {
         NetworkMessage msg;
-        
+
         msg.data = new byte[messageLength];
         memcpy( msg.data, data + i, messageLength );
@@ -200,5 +200,5 @@
         msg.messageId = (MessageId)messageId;
         msg.number = userId;
-        
+
         incomingMessageBuffer.push_back( msg );
       }
@@ -207,6 +207,6 @@
     i += messageLength;
   }
-  
-  
+
+
   //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();  )
@@ -223,5 +223,5 @@
     it++;
   }
-  
+
   //walk throu message queue and remove acked messages
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end();  )
@@ -236,5 +236,5 @@
     it++;
   }
-  
+
   //TODO find bether way. maybe with timestamp
   if ( messageQueue[userId].recievedMessages.size() > 1000 )
@@ -255,5 +255,5 @@
   if ( messageQueue.find( userId ) == messageQueue.end() )
     return;
-    
+
   for ( std::list<NetworkMessage>::iterator it = messageQueue[userId].messages.begin(); it != messageQueue[userId].messages.end(); it++ )
   {
@@ -262,7 +262,7 @@
     it->data = NULL;
   }
-  
+
   messageQueue[userId].toAck.clear();
-  
+
   messageQueue.erase( userId );
 }
@@ -270,5 +270,5 @@
 /**
  * registers function to handle messages with id messageId. someData is passed to callbackfuntion
- * @param messageId message id to handle 
+ * @param messageId message id to handle
  * @param cb function pointer to callback function
  * @param someData this pointer is passed to callback function without modification
@@ -278,11 +278,11 @@
 {
   MessageHandler messageHandler;
-  
+
   messageHandler.cb = cb;
   messageHandler.messageId = messageId;
   messageHandler.someData = someData;
-  
+
   messageHandlerMap[messageId] = messageHandler;
-  
+
   return true;
 }
@@ -309,6 +309,6 @@
  * @param data pointer to data
  * @param dataLength length of data
- * @param recieverType 
- * @param reciever 
+ * @param recieverType
+ * @param reciever
  */
 void MessageManager::sendMessage( MessageId messageId, byte * data, int dataLength, RecieverType recieverType, int reciever, MessagePriority messagePriority )
@@ -316,10 +316,10 @@
   for ( MessageQueue::iterator it = messageQueue.begin(); it != messageQueue.end(); it++ )
   {
-    if ( 
+    if (
          recieverType == RT_ALL_ME ||
          recieverType == RT_ALL_NOT_ME ||
          recieverType == RT_USER && it->first == reciever ||
          recieverType == RT_NOT_USER && it->first != reciever ||
-         recieverType == RT_SERVER && getNetworkStream()->isUserServer( it->first )
+         recieverType == RT_SERVER && getNetworkStream()->isUserMasterServer( it->first )
        )
     {
@@ -336,5 +336,5 @@
     }
   }
-  
+
   if ( recieverType == RT_ALL_ME )
   {
