summaryrefslogtreecommitdiff
path: root/modules/commands/os_news.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-12-19 15:37:15 -0500
committerAdam <Adam@anope.org>2011-12-19 15:37:15 -0500
commit45fc3ce1c41b06af6e03712988870ead95b72435 (patch)
tree7b574d077f77707edb3916fb43dfa30dec8b0f54 /modules/commands/os_news.cpp
parentd320c73f23ff7a9b848b86b59c6bf91c1254e410 (diff)
Fixed formatting of many lists and INFO outputs
Diffstat (limited to 'modules/commands/os_news.cpp')
-rw-r--r--modules/commands/os_news.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index cf127d284..ea8a44c8c 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -116,10 +116,28 @@ class NewsBase : public Command
source.Reply(msgs[MSG_LIST_NONE]);
else
{
- source.Reply(msgs[MSG_LIST_HEADER]);
+ ListFormatter lflist;
+ lflist.addColumn("Number").addColumn("Creator").addColumn("Created").addColumn("Text");
+
for (unsigned i = 0, end = list.size(); i < end; ++i)
- source.Reply(_("%5d (%s by %s)\n"" %s"), i + 1, do_strftime(list[i]->time).c_str(), !list[i]->who.empty() ? list[i]->who.c_str() : "<unknown>", list[i]->text.c_str());
- source.Reply(END_OF_ANY_LIST, "News");
+ {
+ ListFormatter::ListEntry entry;
+ entry["Number"] = stringify(i + 1);
+ entry["Creator"] = list[i]->who;
+ entry["Created"] = do_strftime(list[i]->time);
+ entry["Text"] = list[i]->text;
+ lflist.addEntry(entry);
+ }
+
+ source.Reply(msgs[MSG_LIST_HEADER]);
+
+ std::vector<Anope::string> replies;
+ lflist.Process(replies);
+
+ for (unsigned i = 0; i < replies.size(); ++i)
+ source.Reply(replies[i]);
+
+ source.Reply(_("End of \2news\2 list."));
}
return;