diff options
| author | Adam <Adam@anope.org> | 2016-10-09 19:51:08 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2016-10-09 19:51:08 -0400 |
| commit | 8ceca4fd3f9cb82bc93801d5eb682d27b2ad2f54 (patch) | |
| tree | f7213b5e6676f8eed283215f5afdbbdb6e5f5338 | |
| parent | 5fd2d0ee3e136e01926f21edc759a4ab9fd48806 (diff) | |
Fix SendMessage formatting messages with mixes of multiple spaces and words
| -rw-r--r-- | src/users.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
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); } |
