summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/commands/os_news.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index b74ca3b57..a0dc13407 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -403,23 +403,27 @@ class OSNews : public Module
else if (Type == NEWS_RANDOM)
msg = _("[\002Random News\002 - %s] %s");
- unsigned displayed = 0;
- for (unsigned i = 0, end = newsList.size(); i < end; ++i)
+ int start = 0;
+
+ if (type != NEWS_RANDOM)
+ {
+ start = newsList.size() - news_count;
+ if (start < 0)
+ start = 0;
+ }
+
+ for (unsigned i = start, end = newsList.size(); i < end; ++i)
{
if (Type == NEWS_RANDOM && i != cur_rand_news)
continue;
u->SendMessage(bi, msg.c_str(), Anope::strftime(newsList[i]->time, u->Account(), true).c_str(), newsList[i]->text.c_str());
- ++displayed;
-
if (Type == NEWS_RANDOM)
{
++cur_rand_news;
break;
}
- else if (displayed >= news_count)
- break;
}
/* Reset to head of list to get first random news value */