1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 03:16:38 +02:00

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
This commit is contained in:
Adam-
2009-10-06 21:54:55 +00:00
parent 6ac61a1852
commit fb5356ccbc
15 changed files with 30 additions and 86 deletions
-5
View File
@@ -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 */
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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.
-4
View File
@@ -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;
+6 -53
View File
@@ -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> &params)
@@ -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> &params)
@@ -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)