|
|
@@ -450,18 +450,13 @@ impl<C: AsyncRead + AsyncWrite + Send + Unpin + 'static> IrcClient<C> {
|
|
|
}
|
|
|
|
|
|
async fn on_receive_privmsg(&mut self, line: &str, target: &str) -> Result<()> {
|
|
|
- let message = match line.find(':') {
|
|
|
- Some(substr_idx) => {
|
|
|
- if substr_idx >= line.len() {
|
|
|
- return Err(Error::MalformedPacket)
|
|
|
- }
|
|
|
- line[substr_idx + 1..].to_string()
|
|
|
- }
|
|
|
- None => {
|
|
|
- let split = line.split(' ').collect::<Vec<_>>()[2..].to_vec();
|
|
|
- split.join(" ")
|
|
|
- }
|
|
|
- };
|
|
|
+ let substr_idx = line.find(':').ok_or(Error::MalformedPacket)?;
|
|
|
+
|
|
|
+ if substr_idx >= line.len() {
|
|
|
+ return Err(Error::MalformedPacket)
|
|
|
+ }
|
|
|
+
|
|
|
+ let message = line[substr_idx + 1..].to_string();
|
|
|
|
|
|
info!("[CLIENT {}] (Plain) PRIVMSG {} :{}", self.address, target, message,);
|
|
|
|