hedgewars/uFLNetProtocol.pas
branchqmlfrontend
changeset 11423 e045dc60c37e
parent 11420 ef7f8ac96dfa
child 11424 86c13e5662f1
equal deleted inserted replaced
11422:c6c6a4b32cea 11423:e045dc60c37e
     2 interface
     2 interface
     3 
     3 
     4 procedure passNetData(p: pointer); cdecl;
     4 procedure passNetData(p: pointer); cdecl;
     5 
     5 
     6 procedure sendChatLine(msg: PChar); cdecl;
     6 procedure sendChatLine(msg: PChar); cdecl;
       
     7 procedure joinRoom(roomName: PChar); cdecl;
     7 
     8 
     8 implementation
     9 implementation
     9 uses uFLNetTypes, uFLTypes, uFLUICallback, uFLNet;
    10 uses uFLNetTypes, uFLTypes, uFLUICallback, uFLNet;
    10 
    11 
    11 type
    12 type
    58 begin
    59 begin
    59 end;
    60 end;
    60 
    61 
    61 procedure handler_ERROR(var p: TCmdParamL);
    62 procedure handler_ERROR(var p: TCmdParamL);
    62 begin
    63 begin
       
    64     sendUI(mtError, @p.str1[1], length(p.str1));
    63 end;
    65 end;
    64 
    66 
    65 procedure handler_HH_NUM(var p: TCmdParam);
    67 procedure handler_HH_NUM(var p: TCmdParam);
    66 begin
    68 begin
    67 end;
    69 end;
    82 begin
    84 begin
    83 end;
    85 end;
    84 
    86 
    85 procedure handler_JOINED_s(var s: TCmdParamS);
    87 procedure handler_JOINED_s(var s: TCmdParamS);
    86 begin
    88 begin
       
    89     if s.str1 = 'qmlfrontend' then // we joined a room
       
    90         sendNet('LIST');
    87 end;
    91 end;
    88 
    92 
    89 procedure handler_JOINING(var p: TCmdParamS);
    93 procedure handler_JOINING(var p: TCmdParamS);
    90 begin
    94 begin
    91 end;
    95 end;
   113     sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1));
   117     sendUI(mtAddLobbyClient, @s.str1[1], length(s.str1));
   114 end;
   118 end;
   115 
   119 
   116 procedure handler_LOBBY_LEFT(var p: TCmdParamSL);
   120 procedure handler_LOBBY_LEFT(var p: TCmdParamSL);
   117 begin
   121 begin
       
   122     p.str2:= p.str1 + #10 + p.str2;
       
   123     sendUI(mtRemoveLobbyClient, @p.str2[1], length(p.str2));
   118 end;
   124 end;
   119 
   125 
   120 procedure handler_NICK(var p: TCmdParamS);
   126 procedure handler_NICK(var p: TCmdParamS);
   121 begin
   127 begin
   122 end;
   128 end;
   228 begin
   234 begin
   229 end;
   235 end;
   230 
   236 
   231 procedure handler_WARNING(var p: TCmdParamL);
   237 procedure handler_WARNING(var p: TCmdParamL);
   232 begin
   238 begin
       
   239     sendUI(mtWarning, @p.str1[1], length(p.str1));
   233 end;
   240 end;
   234 
   241 
   235 const handlers: array[TCmdType] of PHandler = (PHandler(@handler_ASKPASSWORD),
   242 const handlers: array[TCmdType] of PHandler = (PHandler(@handler_ASKPASSWORD),
   236     PHandler(@handler_BANLIST), PHandler(@handler_BANLIST_s),
   243     PHandler(@handler_BANLIST), PHandler(@handler_BANLIST_s),
   237     PHandler(@handler_BYE), PHandler(@handler_CHAT),
   244     PHandler(@handler_BYE), PHandler(@handler_CHAT),
   261 begin
   268 begin
   262     sendNetLn('CHAT');
   269     sendNetLn('CHAT');
   263     sendNet(msg);
   270     sendNet(msg);
   264 end;
   271 end;
   265 
   272 
       
   273 procedure joinRoom(roomName: PChar); cdecl;
       
   274 begin
       
   275     sendNetLn('JOIN_ROOM');
       
   276     sendNet(roomName);
       
   277 end;
       
   278 
   266 end.
   279 end.
   267 
   280