diff options
author | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-06 21:54:55 +0000 |
---|---|---|
committer | Adam- <Adam-@5417fbe8-f217-4b02-8779-1006273d7864> | 2009-10-06 21:54:55 +0000 |
commit | fb5356ccbcb96f0c71d650876bf4d7571e8e0ffc (patch) | |
tree | 3e70765aaceca785875ddf3bc21f31d7125b00ef | |
parent | 6ac61a185226c30d8ae2a77ddbc94f330852c55c (diff) |
Destroyed Command::help_param* and rewrote the help part of os_news to be much better
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2538 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r-- | include/modules.h | 5 | ||||
-rw-r--r-- | lang/cat.l | 4 | ||||
-rw-r--r-- | lang/de.l | 4 | ||||
-rw-r--r-- | lang/en_us.l | 4 | ||||
-rw-r--r-- | lang/es.l | 4 | ||||
-rw-r--r-- | lang/fr.l | 4 | ||||
-rw-r--r-- | lang/gr.l | 4 | ||||
-rw-r--r-- | lang/hun.l | 4 | ||||
-rw-r--r-- | lang/it.l | 4 | ||||
-rw-r--r-- | lang/nl.l | 4 | ||||
-rw-r--r-- | lang/pl.l | 4 | ||||
-rw-r--r-- | lang/ru.l | 4 | ||||
-rw-r--r-- | lang/tr.l | 4 | ||||
-rw-r--r-- | src/command.cpp | 4 | ||||
-rw-r--r-- | src/core/os_news.c | 59 |
15 files changed, 30 insertions, 86 deletions
diff --git a/include/modules.h b/include/modules.h index 45f5bf091..576df6ebc 100644 --- a/include/modules.h +++ b/include/modules.h @@ -285,11 +285,6 @@ class CoreExport Command */ void SetPermission(const std::string &reststr); - char *help_param1; - char *help_param2; - char *help_param3; - char *help_param4; - /* Module related stuff */ int core; /* Can this command be deleted? */ char *mod_name; /* Name of the module who owns us, NULL for core's */ diff --git a/lang/cat.l b/lang/cat.l index e1858b1cf..98c82b446 100644 --- a/lang/cat.l +++ b/lang/cat.l @@ -3339,7 +3339,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3353,7 +3353,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3290,7 +3290,7 @@ NEWS_HELP_LOGON Zeigt oder bearbeitet die Liste der LogonNews. Nach der Verbindung des Users werden diese Nachrichten - angezeigt. (Es werden jedoch nur max. %s angezeigt, um ein + angezeigt. (Es werden jedoch nur max. %d angezeigt, um ein Flooding des Users zu verhindern. Wenn mehr News existieren, werden nur die neuesten angezeigt.) NewsCount can be configured in services.conf. @@ -3305,7 +3305,7 @@ NEWS_HELP_OPER Zeigt oder bearbeitet die Liste der Oper-News.Nachdem sich ein User die Oper-Flags gesetzt hat (mit dem /OPER Befehl) werden ihm diese Nachrichten angezeigt. - (Es werden jedoch nur max. %s Nachrichten angezeigt, um ein + (Es werden jedoch nur max. %d Nachrichten angezeigt, um ein Flooding des Users zu verhindern. Wenn mehr News existieren, werden nur die neьsten angezeigt.) NewsCount can be configured in services.conf. diff --git a/lang/en_us.l b/lang/en_us.l index 104c4bf0c..aedf19e56 100644 --- a/lang/en_us.l +++ b/lang/en_us.l @@ -3203,7 +3203,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3217,7 +3217,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3311,7 +3311,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3325,7 +3325,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3364,7 +3364,7 @@ NEWS_HELP_LOGON Edite ou affiche la liste de messages logon news. Lorsqu'un utilisateur se connecte au rйseau, ces messages leur seront - envoyйs. (Cependant, pas plus de %s messages ne seront + envoyйs. (Cependant, pas plus de %d messages ne seront envoyйs pour йviter le flood des utilisateurs. Si il y a plus messages de news, seuls les plus rйcents seront envoyйs.) NewsCount peut кtre configurй en services.conf. @@ -3378,7 +3378,7 @@ NEWS_HELP_OPER Edite ou affiche la liste des messages oper news. Quand un utilisateur utilise la commande /OPER, ces messages lui seront - envoyйs. (Cependant, pas plus de %s messages ne seront + envoyйs. (Cependant, pas plus de %d messages ne seront envoyйs afin de ne pas flooder l'utilisateur. Si il y a plus messages news, seuls les plus rйcents seront envoyйs.) NewsCount peut кtre configurй en services.conf. @@ -3331,7 +3331,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3345,7 +3345,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. diff --git a/lang/hun.l b/lang/hun.l index b881ce18c..8b68c3e8a 100644 --- a/lang/hun.l +++ b/lang/hun.l @@ -3265,7 +3265,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3279,7 +3279,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3215,7 +3215,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3229,7 +3229,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3289,7 +3289,7 @@ NEWS_HELP_LOGON Wijzigt de lijst met login nieuwsberichten of geeft deze weer. Wanneer een gebruiker met het netwerk verbindt, worden deze berichten naar hem/haar verzonden. (Echter, er zullen nooit - meer dan %s berichten worden verstuurd om het flooden van de + meer dan %d berichten worden verstuurd om het flooden van de gebruiker te voorkomen. Als er meer nieuwsberichten zijn worden alleen de meest recente vestuurd.) NewsCount kan geconfigureerd worden in services.conf. @@ -3304,7 +3304,7 @@ NEWS_HELP_OPER Wijzigt de lijst met oper nieuwsberichten of geeft deze weer. Wanneer een gebruiker opert (dmv het /OPER commando), worden deze berichtennaar hem/haar verzonden. (Echter, er zullen - nooit meer dan %s berichten worden verstuurd om het flooden + nooit meer dan %d berichten worden verstuurd om het flooden van de gebruiker te voorkomen. Als er meer nieuwsberichten zijn worden alleen de meest recente vestuurd.) NewsCount kan geconfigureerd worden in services.conf. @@ -4266,7 +4266,7 @@ NEWS_HELP_LOGON Edytuje lub wy¶wietla listк wiadomo¶ci wysyіanych po przyі±czeniu uїytkownika do sieci. Je¶li zdefniowanych - wiadomo¶ci jest wiкcej tylko najnowsze %s zostanie + wiadomo¶ci jest wiкcej tylko najnowsze %d zostanie wysіanych (aby zapobiec floodowaniu). Warto¶ж NewsCount moїe zostaж zmieniona w pliku konfiguracyjym serwisуw. @@ -4279,7 +4279,7 @@ NEWS_HELP_OPER Edytuje lub wy¶wietla listк wiadomo¶ci wysyіanych po wykonaniu polecenia /OPER. Je¶li zdefiniowanych - wiadomo¶ci jest wiкcej tylko najnowsze %s zostanie + wiadomo¶ci jest wiкcej tylko najnowsze %d zostanie wysіanych (aby zapobiec floodowaniu). Warto¶ж NewsCount moїe zostaж zmieniona w pliku konfiguracyjym serwisуw. @@ -3216,7 +3216,7 @@ NEWS_HELP_LOGON Позволяет управлять списком новостей, которые будут автоматически выдаваться пользователю сразу же, как только он подключится к сети. Стоит заметить, что во избежание флуда пользователь получит только - %s новость(и), так что если у вас в списке их больше - показаны + %d новость(и), так что если у вас в списке их больше - показаны будут только последние из них. Значение NewsCount, отвечающее за одновременно посылаемое кол-во новостей, указывается в services.conf @@ -3237,7 +3237,7 @@ NEWS_HELP_OPER пользователь получит статус IRC-оператора (использовав команду /OPER), данные сообщения будут ему отправлены автоматически. Стоит заметить, что во избежание флуда пользователь получит только - %s новость(и), так что если у вас в списке их больше - показаны + %d новость(и), так что если у вас в списке их больше - показаны будут только последние из них. Значение NewsCount, отвечающее за одновременно посылаемое кол-во новостей, указывается в services.conf @@ -3334,7 +3334,7 @@ NEWS_HELP_LOGON Edits or displays the list of logon news messages. When a user connects to the network, these messages will be sent - to them. (However, no more than %s messages will be + to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. @@ -3348,7 +3348,7 @@ NEWS_HELP_OPER Edits or displays the list of oper news messages. When a user opers up (with the /OPER command), these messages will - be sent to them. (However, no more than %s messages will + be sent to them. (However, no more than %d messages will be sent in order to avoid flooding the user. If there are more news messages, only the most recent will be sent.) NewsCount can be configured in services.conf. 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) |