1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-06-12 16:54:46 +02:00

- Added option to apply spamfilters to aliases as well (such as /MS, etc). To do so,

you have to put 'spamfilter yes;' in every alias block you want to get filtered.
  This is so you can have for example /MS filtered (due to heavy spam), while keeping
  /NS and /CS unfiltered. Reported by Homer (#0002496).
- The memoserv aliases (/MS and /MEMOSERV) now have spamfiltering enabled by default.
This commit is contained in:
Bram Matthys
2005-12-09 20:21:37 +00:00
parent 704918754c
commit b930f9a2fc
11 changed files with 59 additions and 22 deletions
+5
View File
@@ -932,3 +932,8 @@
- [CVS Only] Refixed name<->ip mapping check in new resolver, reported by Darko.
- Reverting "Changed the way we build most of the .so's" feature, this caused m_*.so
to be build incorrectly. So now back at normal compile speed :p.
- Added option to apply spamfilters to aliases as well (such as /MS, etc). To do so,
you have to put 'spamfilter yes;' in every alias block you want to get filtered.
This is so you can have for example /MS filtered (due to heavy spam), while keeping
/NS and /CS unfiltered. Reported by Homer (#0002496).
- The memoserv aliases (/MS and /MEMOSERV) now have spamfiltering enabled by default.
+2 -2
View File
@@ -4,8 +4,8 @@ alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias chanserv { type services; };
alias cs { target chanserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias operserv { type services; };
alias os { target operserv; type services; };
alias helpserv { type services; };
+2 -2
View File
@@ -21,8 +21,8 @@ alias helpserv { type services; };
alias hs { target helpserv; type services; };
alias hostserv { type services; };
alias ho { target hostserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias operserv { type services; };
+2 -2
View File
@@ -4,8 +4,8 @@ alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias chanserv { type services; };
alias cs { target chanserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias rootserv { type services; };
alias rs { target rootserv; type services; };
+2 -2
View File
@@ -4,8 +4,8 @@ alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias chanserv { type services; };
alias cs { target chanserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias operserv { type services; };
alias os { target operserv; type services; };
alias helpserv { type services; };
+2 -2
View File
@@ -4,8 +4,8 @@ alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias chanserv { type services; };
alias cs { target chanserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias operserv { type services; };
alias os { target operserv; type services; };
alias helpserv { type services; };
+2 -2
View File
@@ -4,8 +4,8 @@ alias nickserv { type services; };
alias ns { target nickserv; type services; };
alias chanserv { type services; };
alias cs { target chanserv; type services; };
alias memoserv { type services; };
alias ms { target memoserv; type services; };
alias memoserv { type services; spamfilter yes; };
alias ms { target memoserv; type services; spamfilter yes; };
alias operserv { type services; };
alias os { target operserv; type services; };
alias helpserv { type services; };
+5 -2
View File
@@ -1973,6 +1973,7 @@ link hub.mynet.com {
alias &lt;name&gt; {
target &lt;nick-to-forward-to&gt;;
type &lt;type-of-alias&gt;;
spamfilter &lt;yes|no&gt;;
};</pre></p>
<p>(Note: also see <a href="#includedirective">here</a> about the standard alias files UnrealIRCd has)</p>
<p>The alias block [standard alias] allows you to forward a command to a user,
@@ -1982,8 +1983,9 @@ alias &lt;name&gt; {
forward to, alias::target can be left out. The alias::type specifies the type
of alias, valid types are services (the user is on the services server), stats
(the user is on the stats server), normal (the user is a normal user on
any server), and channel (the target is a channel name). The alias block also has another
purpose which is explained below.</p>
any server), and channel (the target is a channel name). If alias::spamfilter (optional)
is set to 'yes', then the spamfilters will be checked (default is 'no').<br>
The alias block also has another purpose which is explained below.</p>
<p>Syntax [command alias]:<br>
<pre>
alias &lt;name&gt; {
@@ -1996,6 +1998,7 @@ alias &lt;name&gt; {
...
};
type command;
spamfilter &lt;yes|no&gt;;
};</pre></p>
<p>When the alias block is used in this format, it allows you a much broader range
of usage. For example you can create aliases such as /identify. The alias::
+1
View File
@@ -1314,6 +1314,7 @@ struct _configitem_alias {
ConfigItem_alias_format *format;
char *alias, *nick;
AliasType type;
unsigned int spamfilter:1;
};
struct _configitem_alias_format {
+4 -1
View File
@@ -7933,7 +7933,8 @@ int _conf_alias(ConfigFile *conf, ConfigEntry *ce)
else if (!strcmp(cep->ce_vardata, "command"))
alias->type = ALIAS_COMMAND;
}
else if (!strcmp(cep->ce_varname, "spamfilter"))
alias->spamfilter = config_checkval(cep->ce_vardata, CFG_YESNO);
}
if (BadPtr(alias->nick) && alias->type != ALIAS_COMMAND) {
ircstrdup(alias->nick, alias->alias);
@@ -8110,6 +8111,8 @@ int _test_alias(ConfigFile *conf, ConfigEntry *ce) {
errors++;
}
}
else if (!strcmp(cep->ce_varname, "spamfilter"))
;
else {
config_error_unknown(cep->ce_fileptr->cf_filename, cep->ce_varlinenum,
"alias", cep->ce_varname);
+32 -7
View File
@@ -220,9 +220,12 @@ void strrangetok(char *in, char *out, char tok, short first, short last) {
out[j] = 0;
}
int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
ConfigItem_alias *alias;
aClient *acptr;
int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd)
{
ConfigItem_alias *alias;
aClient *acptr;
int ret;
if (parc < 2 || *parv[1] == '\0')
{
sendto_one(sptr, err_str(ERR_NOTEXTTOSEND), me.name, parv[0]);
@@ -238,9 +241,13 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
if (alias->type == ALIAS_SERVICES)
{
if (SERVICES_NAME && (acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, parv[1], SPAMF_USERMSG, alias->nick, 0)) < 0)
return ret;
sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE,
alias->nick, SERVICES_NAME, parv[1]);
}
else
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
parv[0], alias->nick);
@@ -248,9 +255,13 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
else if (alias->type == ALIAS_STATS)
{
if (STATS_SERVER && (acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, parv[1], SPAMF_USERMSG, alias->nick, 0)) < 0)
return ret;
sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE,
alias->nick, STATS_SERVER, parv[1]);
}
else
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
parv[0], alias->nick);
@@ -259,6 +270,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
{
if ((acptr = find_person(alias->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, parv[1], SPAMF_USERMSG, alias->nick, 0)) < 0)
return ret;
if (MyClient(acptr))
sendto_one(acptr, ":%s!%s@%s PRIVMSG %s :%s", parv[0],
sptr->user->username, GetHost(sptr),
@@ -279,6 +292,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
{
if (!can_send(sptr, chptr, parv[1], 0))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, parv[1], SPAMF_CHANMSG, chptr->chname, 0)) < 0)
return ret;
sendto_channelprefix_butone_tok(sptr,
sptr, chptr,
PREFIX_ALL,
@@ -355,27 +370,35 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
if (format->type == ALIAS_SERVICES)
{
if (SERVICES_NAME && (acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, output, SPAMF_USERMSG, format->nick, 0)) < 0)
return ret;
sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE,
format->nick, SERVICES_NAME, output);
else
} else
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
parv[0], format->nick);
}
else if (format->type == ALIAS_STATS)
{
if (STATS_SERVER && (acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, output, SPAMF_USERMSG, format->nick, 0)) < 0)
return ret;
sendto_one(acptr, ":%s %s %s@%s :%s", parv[0],
IsToken(acptr->from) ? TOK_PRIVATE : MSG_PRIVATE,
format->nick, STATS_SERVER, output);
else
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
parv[0], format->nick);
} else
sendto_one(sptr, err_str(ERR_SERVICESDOWN), me.name,
parv[0], format->nick);
}
else if (format->type == ALIAS_NORMAL)
{
if ((acptr = find_person(format->nick, NULL)))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, output, SPAMF_USERMSG, format->nick, 0)) < 0)
return ret;
if (MyClient(acptr))
sendto_one(acptr, ":%s!%s@%s PRIVMSG %s :%s", parv[0],
sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost,
@@ -396,6 +419,8 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
{
if (!can_send(sptr, chptr, parv[1], 0))
{
if (alias->spamfilter && (ret = dospamfilter(sptr, parv[1], SPAMF_CHANMSG, chptr->chname, 0)) < 0)
return ret;
sendto_channelprefix_butone_tok(sptr,
sptr, chptr,
PREFIX_ALL, MSG_PRIVATE,