mirror of
https://github.com/anope/anope.git
synced 2026-07-04 05:03:11 +02:00
Rename TextSplitter to LineWrapper.
This commit is contained in:
+2
-2
@@ -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);
|
||||
};
|
||||
|
||||
|
||||
+5
-5
@@ -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())
|
||||
|
||||
+2
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user