diff options
-rw-r--r-- | include/textproc.h | 4 | ||||
-rw-r--r-- | src/misc.cpp | 10 | ||||
-rw-r--r-- | src/users.cpp | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/include/textproc.h b/include/textproc.h index cfde60637..f76ae8a04 100644 --- a/include/textproc.h +++ b/include/textproc.h @@ -22,7 +22,7 @@ public: void SendTo(CommandSource &source); }; -class CoreExport TextSplitter final +class CoreExport LineWrapper final { private: std::vector<Anope::string> formatting; @@ -30,7 +30,7 @@ private: Anope::string text; public: - TextSplitter(const Anope::string &t, size_t ml = 0); + LineWrapper(const Anope::string &t, size_t ml = 0); bool GetLine(Anope::string &out); }; diff --git a/src/misc.cpp b/src/misc.cpp index 7b2759f90..0c9caf06c 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -277,24 +277,24 @@ void HelpWrapper::SendTo(CommandSource &source) const auto max_length = Config->GetBlock("options").Get<size_t>("linelength", "100") - longest - 8; for (const auto &[entry_name, entry_desc] : entries) { - TextSplitter splitter(Language::Translate(source.nc, entry_desc.c_str()), max_length); + LineWrapper lw(Language::Translate(source.nc, entry_desc.c_str()), max_length); Anope::string line; - if (splitter.GetLine(line)) + if (lw.GetLine(line)) source.Reply(" %-*s %s", (int)longest, entry_name.c_str(), line.c_str()); - while (splitter.GetLine(line)) + while (lw.GetLine(line)) source.Reply(" %-*s %s", (int)longest, "", line.c_str()); } }; -TextSplitter::TextSplitter(const Anope::string &t, size_t ml) +LineWrapper::LineWrapper(const Anope::string &t, size_t ml) : max_length(ml ? ml : Config->GetBlock("options").Get<size_t>("linelength", "100")) , text(t) { } -bool TextSplitter::GetLine(Anope::string &out) +bool LineWrapper::GetLine(Anope::string &out) { out.clear(); if (text.empty()) diff --git a/src/users.cpp b/src/users.cpp index c252e51d7..0abe0b66e 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -347,8 +347,8 @@ namespace { void SendMessageInternal(BotInfo *source, User *target, const Anope::string &msg, const Anope::map<Anope::string> &tags) { - TextSplitter ts(Language::Translate(target, msg.c_str())); - for (Anope::string line; ts.GetLine(line); ) + LineWrapper lw(Language::Translate(target, msg.c_str())); + for (Anope::string line; lw.GetLine(line); ) { if (target->ShouldPrivmsg()) IRCD->SendPrivmsg(source, target->GetUID(), line, tags); |