summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-09-12 08:07:11 -0400
committerAdam <Adam@anope.org>2013-09-27 16:33:03 -0400
commitabc7e4b423d6701e5771ff08b3eadf81f50488ec (patch)
tree4f5480e690bf01b5a9478eb188a5409aa9c11d24
parente5ece18ee7804ed81f1b0f80af30a9aea8320522 (diff)
Fix os_news to not load items until the news service is constructed
Fix session exceptions not expirigin
-rw-r--r--modules/commands/os_modinfo.cpp2
-rw-r--r--modules/commands/os_news.cpp19
-rw-r--r--modules/commands/os_session.cpp2
3 files changed, 18 insertions, 5 deletions
diff --git a/modules/commands/os_modinfo.cpp b/modules/commands/os_modinfo.cpp
index 3563185ae..972f8631e 100644
--- a/modules/commands/os_modinfo.cpp
+++ b/modules/commands/os_modinfo.cpp
@@ -30,6 +30,8 @@ class CommandOSModInfo : public Command
if (m)
{
source.Reply(_("Module: \002%s\002 Version: \002%s\002 Author: \002%s\002 loaded: \002%s\002"), m->name.c_str(), !m->version.empty() ? m->version.c_str() : "?", !m->author.empty() ? m->author.c_str() : "Unknown", Anope::strftime(m->created).c_str());
+ if (Anope::Debug)
+ source.Reply(_(" Loaded at: %p"), m->handle);
std::vector<Anope::string> servicekeys = Service::GetServiceKeys("Command");
for (unsigned i = 0; i < servicekeys.size(); ++i)
diff --git a/modules/commands/os_news.cpp b/modules/commands/os_news.cpp
index 487a45300..c71d7ed27 100644
--- a/modules/commands/os_news.cpp
+++ b/modules/commands/os_news.cpp
@@ -329,13 +329,16 @@ static unsigned cur_rand_news = 0;
class OSNews : public Module
{
- Serialize::Type newsitem_type;
MyNewsService newsservice;
+ Serialize::Type newsitem_type;
CommandOSLogonNews commandoslogonnews;
CommandOSOperNews commandosopernews;
CommandOSRandomNews commandosrandomnews;
+ Anope::string oper_announcer, announcer;
+ unsigned news_count;
+
void DisplayNews(User *u, NewsType Type)
{
std::vector<NewsItem *> &newsList = this->newsservice.GetNewsList(Type);
@@ -358,13 +361,13 @@ class OSNews : public Module
else if (Type == NEWS_RANDOM)
msg = _("[\002Random News\002 - %s] %s");
- unsigned displayed = 0, news_count = Config->GetModule(this)->Get<unsigned>("newscount", "3");
+ unsigned displayed = 0;
for (unsigned i = 0, 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).c_str(), newsList[i]->text.c_str());
+ u->SendMessage(bi, msg.c_str(), Anope::strftime(newsList[i]->time, u->Account(), true).c_str(), newsList[i]->text.c_str());
++displayed;
@@ -384,8 +387,16 @@ class OSNews : public Module
public:
OSNews(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR),
- newsitem_type("NewsItem", NewsItem::Unserialize), newsservice(this), commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this)
+ newsservice(this), newsitem_type("NewsItem", NewsItem::Unserialize),
+ commandoslogonnews(this), commandosopernews(this), commandosrandomnews(this)
+ {
+ }
+
+ void OnReload(Configuration::Conf *conf) anope_override
{
+ oper_announcer = conf->GetModule(this)->Get<const Anope::string>("oper_announcer", "OperServ");
+ announcer = conf->GetModule(this)->Get<const Anope::string>("announcer", "Global");
+ news_count = conf->GetModule(this)->Get<unsigned>("newscount", "3");
}
void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) anope_override
diff --git a/modules/commands/os_session.cpp b/modules/commands/os_session.cpp
index 7b0ee1fb1..d04085347 100644
--- a/modules/commands/os_session.cpp
+++ b/modules/commands/os_session.cpp
@@ -742,7 +742,7 @@ class OSSession : public Module
void OnExpireTick() anope_override
{
- if (!Anope::NoExpire)
+ if (Anope::NoExpire)
return;
for (unsigned i = this->ss.GetExceptions().size(); i > 0; --i)
{