From 8ceca4fd3f9cb82bc93801d5eb682d27b2ad2f54 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 9 Oct 2016 19:51:08 -0400 Subject: Fix SendMessage formatting messages with mixes of multiple spaces and words --- src/users.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/users.cpp b/src/users.cpp index 3d4b7e1b7..3c081a918 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -340,7 +340,15 @@ void User::SendMessage(const MessageSource &source, const Anope::string &msg) Anope::string buf; for (Anope::string word; ssep.GetToken(word);) { - Anope::string add = buf.empty() ? word : " " + word; + Anope::string add; + if (word.empty()) // was two spaces + word = " "; + + if (buf.empty() || buf[buf.length() - 1] == ' ') + add = word; + else + add = " " + word; + if (buf.length() + add.length() > Config->LineWrap) { if (send_privmsg) @@ -348,8 +356,10 @@ void User::SendMessage(const MessageSource &source, const Anope::string &msg) else IRCD->SendNotice(source, this->GetUID(), "%s", buf.c_str()); buf.clear(); + add = word; } + buf.append(add); } -- cgit