diff --git a/src/client/mod.rs b/src/client/mod.rs index 0210f88..04a56f8 100644 --- a/src/client/mod.rs +++ b/src/client/mod.rs @@ -336,7 +336,11 @@ macro_rules! pub_sender_base { S1: fmt::Display, S2: fmt::Display, { - self.send_privmsg(target, &format!("\u{001}{}\u{001}", msg.to_string())[..]) + let msg = msg.to_string(); + for line in msg.split("\r\n") { + self.send(PRIVMSG(target.to_string(), format!("\u{001}{}\u{001}", line)))? + } + Ok(()) } /// Sends an action command to the specified target. @@ -1842,11 +1846,11 @@ mod test { #[cfg(feature = "ctcp")] async fn send_ctcp() -> Result<()> { let mut client = Client::from_config(test_config()).await?; - client.send_ctcp("test", "MESSAGE")?; + client.send_ctcp("test", "LINE1\r\nLINE2\r\nLINE3")?; client.stream()?.collect().await?; assert_eq!( &get_client_value(client)[..], - "PRIVMSG test \u{001}MESSAGE\u{001}\r\n" + "PRIVMSG test \u{001}LINE1\u{001}\r\nPRIVMSG test \u{001}LINE2\u{001}\r\nPRIVMSG test \u{001}LINE3\u{001}\r\n" ); Ok(()) }