diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command.cpp | 4 | ||||
-rw-r--r-- | src/core/os_news.c | 59 |
2 files changed, 6 insertions, 57 deletions
diff --git a/src/command.cpp b/src/command.cpp index f3bc7ad1f..fa5b21a2a 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -14,10 +14,6 @@ Command::Command(const std::string &sname, size_t min_params, size_t max_params, const std::string &spermission) : MaxParams(max_params), MinParams(min_params), name(sname), permission(spermission) { this->flags = 0; - this->help_param1 = NULL; - this->help_param2 = NULL; - this->help_param3 = NULL; - this->help_param4 = NULL; this->core = 0; this->mod_name = NULL; this->service = NULL; diff --git a/src/core/os_news.c b/src/core/os_news.c index 370b82f31..4fe690da1 100644 --- a/src/core/os_news.c +++ b/src/core/os_news.c @@ -240,14 +240,6 @@ class CommandOSLogonNews : public NewsBase public: CommandOSLogonNews() : NewsBase("LOGONNEWS") { - this->help_param1 = NULL; - - this->UpdateHelpParam(); - } - - ~CommandOSLogonNews() - { - delete [] this->help_param1; } CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) @@ -257,7 +249,7 @@ class CommandOSLogonNews : public NewsBase bool OnHelp(User *u, const ci::string &subcommand) { - notice_help(s_OperServ, u, NEWS_HELP_LOGON, this->help_param1); + notice_help(s_OperServ, u, NEWS_HELP_LOGON, NewsCount); return true; } @@ -265,32 +257,13 @@ class CommandOSLogonNews : public NewsBase { syntax_error(s_OperServ, u, "LOGONNEWS", NEWS_LOGON_SYNTAX); } - - void UpdateHelpParam() - { - if (this->help_param1) - delete [] this->help_param1; - - char buf[BUFSIZE]; - - snprintf(buf, BUFSIZE, "%d", NewsCount), - this->help_param1 = sstrdup(buf); - } -} *OSLogonNews = NULL; +}; class CommandOSOperNews : public NewsBase { public: CommandOSOperNews() : NewsBase("OPERNEWS") { - this->help_param1 = NULL; - - this->UpdateHelpParam(); - } - - ~CommandOSOperNews() - { - delete [] this->help_param1; } CommandReturn Execute(User *u, std::vector<ci::string> ¶ms) @@ -300,7 +273,7 @@ class CommandOSOperNews : public NewsBase bool OnHelp(User *u, const ci::string &subcommand) { - notice_help(s_OperServ, u, NEWS_HELP_OPER, this->help_param1); + notice_help(s_OperServ, u, NEWS_HELP_OPER, NewsCount); return true; } @@ -308,18 +281,7 @@ class CommandOSOperNews : public NewsBase { syntax_error(s_OperServ, u, "OPERNEWS", NEWS_OPER_SYNTAX); } - - void UpdateHelpParam() - { - if (this->help_param1) - delete [] this->help_param1; - - char buf[BUFSIZE]; - - snprintf(buf, BUFSIZE, "%d", NewsCount), - this->help_param1 = sstrdup(buf); - } -} *OSOperNews = NULL; +}; class CommandOSRandomNews : public NewsBase { @@ -354,12 +316,9 @@ class OSNews : public Module this->SetVersion("$Id$"); this->SetType(CORE); - OSLogonNews = new CommandOSLogonNews(); - this->AddCommand(OPERSERV, OSLogonNews); - OSOperNews = new CommandOSOperNews(); - this->AddCommand(OPERSERV, OSOperNews); + this->AddCommand(OPERSERV, new CommandOSLogonNews()); + this->AddCommand(OPERSERV, new CommandOSOperNews()); this->AddCommand(OPERSERV, new CommandOSRandomNews()); - ModuleManager::Attach(I_OnReload, this); } void OperServHelp(User *u) @@ -368,12 +327,6 @@ class OSNews : public Module notice_lang(s_OperServ, u, OPER_HELP_CMD_OPERNEWS); notice_lang(s_OperServ, u, OPER_HELP_CMD_RANDOMNEWS); } - - void OnReload(bool starting) - { - OSLogonNews->UpdateHelpParam(); - OSOperNews->UpdateHelpParam(); - } }; MODULE_INIT(OSNews) |