hedgewars/uFLNet.pas
branchqmlfrontend
changeset 11848 01f88c3b7b66
parent 11847 93e6c401cc3d
--- a/hedgewars/uFLNet.pas	Tue Aug 02 23:08:17 2016 +0300
+++ b/hedgewars/uFLNet.pas	Thu Aug 11 23:05:14 2016 +0300
@@ -11,6 +11,7 @@
 procedure passToNet(data: PByteArray; len: Longword);
 
 var isConnected: boolean = false;
+    myNickname: shortstring = 'qmlfrontend';
 
 implementation
 uses uFLIPC, uFLUICallback, uFLNetTypes, uFLUtils, uFLTypes;
@@ -402,6 +403,8 @@
 
 procedure passToNet(data: PByteArray; len: Longword);
 var i: Longword;
+    l: ansistring;
+    s: shortstring;
 begin
     i:= 0;
 
@@ -409,8 +412,15 @@
     begin
         if data^[i + 1] = ord('s') then
         begin
-            sendUI(mtRoomChatLine, @(data^[i + 2]), data^[i]);
-            //sendChatLine()
+            s[0]:= char(data^[i] - 1);
+            Move(data^[i + 2], s[1], data^[i] - 1);
+
+            l:= myNickname + #10;
+            l:= l + s;
+
+            sendUI(mtRoomChatLine, @l[1], length(l));
+            sendNetLn('CHAT');
+            sendNet(s);
         end;
 
         inc(i, data^[i] + 1);