Sfoglia il codice sorgente

darkirc: trim all whitespaces from client and silently ignore empty IRC commands

dasman 1 anno fa
parent
commit
2d805ac515
1 ha cambiato i file con 3 aggiunte e 3 eliminazioni
  1. 3 3
      bin/darkirc/src/irc/client.rs

+ 3 - 3
bin/darkirc/src/irc/client.rs

@@ -207,7 +207,6 @@ impl Client {
 
                     // Clear the line buffer
                     line = String::new();
-                    continue
                 }
 
                 // Process message from the network. These should only be PRIVMSG.
@@ -316,8 +315,9 @@ impl Client {
     where
         W: AsyncWrite + Unpin,
     {
-        if line.is_empty() || line == "\n" || line == "\r\n" {
-            return Err(Error::ParseFailed("Line is empty"))
+        if line.trim().is_empty() {
+            // Silently ignore empty commands
+            return Ok(None)
         }
 
         let mut line = line.to_string();