rust/hedgewars-server/src/server/io.rs
changeset 14785 a1077e8d26f4
parent 14781 01f8ab45f806
child 15074 c5a6e8566425
equal deleted inserted replaced
14784:8390d5e4e39c 14785:a1077e8d26f4
    44                             &password_hash,
    44                             &password_hash,
    45                             &client_salt,
    45                             &client_salt,
    46                             &server_salt,
    46                             &server_salt,
    47                         ) {
    47                         ) {
    48                             Ok(account) => IoResult::Account(account),
    48                             Ok(account) => IoResult::Account(account),
    49                             Err(..) => {
    49                             Err(e) => {
    50                                 warn!("Unable to get account data: {}", 0);
    50                                 warn!("Unable to get account data: {}", e);
    51                                 IoResult::Account(None)
    51                                 IoResult::Account(None)
    52                             }
    52                             }
    53                         }
    53                         }
       
    54                     }
       
    55 
       
    56                     IoTask::GetReplay { id } => {
       
    57                         let result = match db.get_replay_name(id) {
       
    58                             Ok(Some(filename)) => {
       
    59                                 let filename = format!(
       
    60                                     "checked/{}",
       
    61                                     if filename.starts_with("replays/") {
       
    62                                         &filename[8..]
       
    63                                     } else {
       
    64                                         &filename
       
    65                                     }
       
    66                                 );
       
    67                                 match load_file(&filename) {
       
    68                                     Ok(contents) => Some(unimplemented!()),
       
    69                                     Err(e) => {
       
    70                                         warn!(
       
    71                                             "Error while writing the room config file \"{}\": {}",
       
    72                                             filename, e
       
    73                                         );
       
    74                                         None
       
    75                                     }
       
    76                                 }
       
    77                             }
       
    78                             Ok(None) => None,
       
    79                             Err(e) => {
       
    80                                 warn!("Unable to get replay name: {}", e);
       
    81                                 None
       
    82                             }
       
    83                         };
       
    84                         IoResult::Replay(result)
    54                     }
    85                     }
    55 
    86 
    56                     IoTask::SaveRoom {
    87                     IoTask::SaveRoom {
    57                         room_id,
    88                         room_id,
    58                         filename,
    89                         filename,