1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-08 03:03:13 +02:00

set::prefix-quit was not working, reported by capitaine (#4586).

This commit is contained in:
Bram Matthys
2016-03-04 12:40:26 +01:00
parent 99c3fd3c36
commit da9a1be85b
3 changed files with 31 additions and 30 deletions
+1 -1
View File
@@ -188,7 +188,7 @@ extern MODVAR int ipv6_disabled;
#define STATS_SERVER iConf.network.x_stats_server
#define SASL_SERVER iConf.network.x_sasl_server
#define iNAH iConf.network.x_inah
#define prefix_quit iConf.network.x_prefix_quit
#define PREFIX_QUIT iConf.network.x_prefix_quit
#define SSL_SERVER_CERT_PEM iConf.x_server_cert_pem
#define SSL_SERVER_KEY_PEM iConf.x_server_key_pem
+27 -25
View File
@@ -79,51 +79,53 @@ MOD_UNLOAD(m_quit)
*/
CMD_FUNC(m_quit)
{
char *ocomment = (parc > 1 && parv[1]) ? parv[1] : sptr->name;
static char comment[TOPICLEN + 1];
char *comment = (parc > 1 && parv[1]) ? parv[1] : sptr->name;
static char commentbuf[TOPICLEN + 1];
Membership *lp;
if (!IsServer(cptr) && IsPerson(sptr))
{
int n;
char *s = comment;
Hook *tmphook;
if (STATIC_QUIT)
return exit_client(cptr, sptr, sptr, STATIC_QUIT);
if (IsVirus(sptr))
return exit_client(cptr, sptr, sptr, "Client exited");
if (!prefix_quit || strcmp(prefix_quit, "no"))
s = ircsnprintf(comment, sizeof(comment), "%s ",
BadPtr(prefix_quit) ? "Quit:" : prefix_quit);
n = dospamfilter(sptr, ocomment, SPAMF_QUIT, NULL, 0, NULL);
n = dospamfilter(sptr, comment, SPAMF_QUIT, NULL, 0, NULL);
if (n == FLUSH_BUFFER)
return n;
if (n < 0)
ocomment = sptr->name;
comment = sptr->name;
if (!ValidatePermissionsForPath("immune:antispamtimer",sptr,NULL,NULL,NULL) && ANTI_SPAM_QUIT_MSG_TIME)
if (sptr->local->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime())
ocomment = sptr->name;
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_QUIT]; tmphook; tmphook = tmphook->next)
{
ocomment = (*(tmphook->func.pcharfunc))(sptr, ocomment);
if (!ocomment)
{
ocomment = sptr->name;
break;
}
}
if (sptr->local->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime())
comment = sptr->name;
}
strncpy(s, ocomment, TOPICLEN - (s - comment));
comment[TOPICLEN] = '\0';
return exit_client(cptr, sptr, sptr, comment);
for (tmphook = Hooks[HOOKTYPE_PRE_LOCAL_QUIT]; tmphook; tmphook = tmphook->next)
{
comment = (*(tmphook->func.pcharfunc))(sptr, comment);
if (!comment)
{
comment = sptr->name;
break;
}
}
if (PREFIX_QUIT)
snprintf(commentbuf, sizeof(commentbuf), "%s: %s", PREFIX_QUIT, comment);
else
strlcpy(commentbuf, comment, sizeof(commentbuf));
return exit_client(cptr, sptr, sptr, commentbuf);
}
else
{
return exit_client(cptr, sptr, sptr, ocomment);
/* Remote quits and non-person quits always use their original comment */
return exit_client(cptr, sptr, sptr, comment);
}
}
+3 -4
View File
@@ -1416,6 +1416,7 @@ void config_setdefaultsettings(aConfiguration *i)
i->x_server_key_pem = strdup(tmp);
if (!ipv6_capable())
DISABLE_IPV6 = 1;
i->network.x_prefix_quit = strdup("Quit");
}
/* 1: needed for set::options::allow-part-if-shunned,
@@ -6844,10 +6845,8 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce)
tempiConf.hide_ban_reason = config_checkval(cep->ce_vardata, CFG_YESNO);
}
else if (!strcmp(cep->ce_varname, "prefix-quit")) {
if (*cep->ce_vardata == '0')
{
safestrdup(tempiConf.network.x_prefix_quit, "");
}
if (!strcmp(cep->ce_vardata, "0") || !strcmp(cep->ce_vardata, "no"))
safefree(tempiConf.network.x_prefix_quit);
else
safestrdup(tempiConf.network.x_prefix_quit, cep->ce_vardata);
}