Also report chat and added rooms in log
authorunc0rr
Wed, 24 Oct 2018 21:52:19 +0200
changeset 13957 a4877a16564d
parent 13956 2568fa516733
child 13958 9f336409e2ea
Also report chat and added rooms in log
rust/hedgewars-checker/Cargo.toml
rust/hedgewars-checker/src/main.rs
--- a/rust/hedgewars-checker/Cargo.toml	Wed Oct 24 21:07:26 2018 +0200
+++ b/rust/hedgewars-checker/Cargo.toml	Wed Oct 24 21:52:19 2018 +0200
@@ -1,6 +1,6 @@
 [package]
 name = "hedgewars-checker"
-version = "0.1.0"
+version = "1.0.0"
 authors = ["Andrey Korotaev <a.korotaev@hedgewars.org>"]
 
 [dependencies]
--- a/rust/hedgewars-checker/src/main.rs	Wed Oct 24 21:07:26 2018 +0200
+++ b/rust/hedgewars-checker/src/main.rs	Wed Oct 24 21:52:19 2018 +0200
@@ -154,6 +154,18 @@
             } else if msg[..].starts_with(b"BYE") {
                 warn!("Received BYE: {}", String::from_utf8_lossy(&msg[..]));
                 return Ok(());
+            } else if msg[..].starts_with(b"CHAT") {
+                let body = String::from_utf8_lossy(&msg[5..]);
+                let mut l = body.lines();
+                info!("Chat [{}]: {}", l.next().unwrap(), l.next().unwrap());
+            } else if msg[..].starts_with(b"ROOM") {
+                let body = String::from_utf8_lossy(&msg[5..]);
+                let mut l = body.lines();
+                if let Some(action) = l.next() {
+                    if action == "ADD" {
+                        info!("Room added: {}", l.skip(1).next().unwrap());
+                    }
+                }
             } else if msg[..].starts_with(b"ERROR") {
                 warn!("Received ERROR: {}", String::from_utf8_lossy(&msg[..]));
                 return Ok(());