mirror of
https://github.com/anope/anope.git
synced 2026-07-08 00:23:14 +02:00
Added sendmailpath directive to mail block in new config.
Added ValidateMail function to validate certain mail block config directives only when usemail is enabled. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1622 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
+14
-1
@@ -222,11 +222,24 @@ mail
|
||||
{
|
||||
/*
|
||||
* If set, this option enables the mail commands in Services. You may choose
|
||||
* to disable it if you have no sendmail-compatible mailer installed. While
|
||||
* to disable it if you have no Sendmail-compatible mailer installed. While
|
||||
* this directive (and entire block) is optional, it is required if the
|
||||
* nickserv:emailregistration is set to yes.
|
||||
*/
|
||||
usemail = yes
|
||||
|
||||
/*
|
||||
* This is the command-line that will be used to call Sendmail to send an
|
||||
* e-mail. It must be called with all the parameters needed to make it
|
||||
* scan the mail input to find the mail recipient; consult your Sendmail
|
||||
* documentation.
|
||||
*
|
||||
* Postfix users must use the compatible sendmail utility provided with
|
||||
* it; this one usually needs no parameters on the command-line. Most
|
||||
* sendmail applications (or replacements of it) require the -t option
|
||||
* to be used.
|
||||
*/
|
||||
sendmailpath = "/usr/sbin/sendmail -t"
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
+11
-2
@@ -543,6 +543,16 @@ bool ValidateNickLen(ServerConfig *, const char *, const char *, ValueItem &data
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateMail(ServerConfig *, const char *tag, const char *value, ValueItem &data)
|
||||
{
|
||||
if (UseMail) {
|
||||
if (static_cast<std::string>(value) == "sendmailpath") {
|
||||
if (!*data.GetString()) throw ConfigException(static_cast<std::string>("The value for <") + tag + ":" + value + "> cannot be empty when e-mail is enabled!");
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ServerConfig::ReportConfigError(const std::string &errormessage, bool bail)
|
||||
{
|
||||
alog("There were errors in your configuration file: %s", errormessage.c_str());
|
||||
@@ -653,6 +663,7 @@ int ServerConfig::Read(bool bail)
|
||||
{"nickserv", "nicktracking", "no", new ValueContainerBool(&NSNickTracking), DT_BOOLEAN, NoValidation},
|
||||
{"nickserv", "addaccessonreg", "no", new ValueContainerBool(&NSAddAccessOnReg), DT_BOOLEAN, NoValidation},
|
||||
{"mail", "usemail", "no", new ValueContainerBool(&UseMail), DT_BOOLEAN, ValidateEmailReg},
|
||||
{"mail", "sendmailpath", "", new ValueContainerChar(&SendMailPath), DT_CHARPTR, ValidateMail},
|
||||
{"chanserv", "nick", "ChanServ", new ValueContainerChar(&s_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"chanserv", "description", "Channel Registration Service", new ValueContainerChar(&desc_ChanServ), DT_CHARPTR | DT_NORELOAD, ValidateNotEmpty},
|
||||
{"chanserv", "database", "chan.db", new ValueContainerChar(&ChanDBName), DT_CHARPTR, ValidateNotEmpty},
|
||||
@@ -1351,7 +1362,6 @@ Directive directives[] = {
|
||||
{PARAM_STRING, 0, &RemotePassword3}}},
|
||||
{"RestrictMail", {{PARAM_SET, PARAM_RELOAD, &RestrictMail}}},
|
||||
{"RestrictOperNicks", {{PARAM_SET, PARAM_RELOAD, &RestrictOperNicks}}},
|
||||
{"SendMailPath", {{PARAM_STRING, PARAM_RELOAD, &SendMailPath}}},
|
||||
{"SendFrom", {{PARAM_STRING, PARAM_RELOAD, &SendFrom}}},
|
||||
{"HideStatsO", {{PARAM_SET, PARAM_RELOAD, &HideStatsO}}},
|
||||
{"GlobalOnCycle", {{PARAM_SET, PARAM_RELOAD, &GlobalOnCycle}}},
|
||||
@@ -1890,7 +1900,6 @@ int read_config(int reload)
|
||||
}
|
||||
|
||||
if (UseMail) {
|
||||
CHECK(SendMailPath);
|
||||
CHECK(SendFrom);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user