gameServer2/src/server/handlers.rs
changeset 12151 8d8fb85bc09c
parent 12150 a482c7a5f6e3
equal deleted inserted replaced
12150:a482c7a5f6e3 12151:8d8fb85bc09c
    15         HWProtocolMessage::Quit(Some(msg)) =>
    15         HWProtocolMessage::Quit(Some(msg)) =>
    16             server.react(token, poll, vec![ByeClient("User quit: ".to_string() + &msg)]),
    16             server.react(token, poll, vec![ByeClient("User quit: ".to_string() + &msg)]),
    17         HWProtocolMessage::Quit(None) =>
    17         HWProtocolMessage::Quit(None) =>
    18             server.react(token, poll, vec![ByeClient("User quit".to_string())]),
    18             server.react(token, poll, vec![ByeClient("User quit".to_string())]),
    19         HWProtocolMessage::Nick(nick) =>
    19         HWProtocolMessage::Nick(nick) =>
    20             if server.clients[token].nick.len() == 0 {
    20             if server.clients[token].room_id == None {
    21                 server.react(token, poll, vec![SendMe(Nick(&nick).to_raw_protocol())]);
    21                 server.react(token, poll, vec![SendMe(Nick(&nick).to_raw_protocol())]);
    22                 server.clients[token].nick = nick;
    22                 server.clients[token].nick = nick;
    23                 server.react(token, poll, vec![CheckRegistered]);
    23                 server.react(token, poll, vec![CheckRegistered]);
    24             },
    24             },
    25         HWProtocolMessage::Proto(proto) => {
    25         HWProtocolMessage::Proto(proto) => {
    26                 server.clients[token].protocolNumber = proto;
    26                 server.clients[token].protocol_number = proto;
    27                 server.react(token, poll, vec![CheckRegistered]);
    27                 server.react(token, poll, vec![CheckRegistered]);
    28         },
    28         },
    29         HWProtocolMessage::List => warn!("Deprecated LIST message received"),
    29         HWProtocolMessage::List => warn!("Deprecated LIST message received"),
    30         HWProtocolMessage::Malformed => warn!("Malformed/unknown message"),
    30         HWProtocolMessage::Malformed => warn!("Malformed/unknown message"),
    31         HWProtocolMessage::Empty => warn!("Empty message"),
    31         HWProtocolMessage::Empty => warn!("Empty message"),