1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-07 11:43:11 +02:00

Newlog: SAPART/SAJOIN and also broadcast SAJOIN now so all servers can log

it appropriately.
This commit is contained in:
Bram Matthys
2021-08-05 16:30:14 +02:00
parent b21048c3e1
commit a118a3313d
2 changed files with 16 additions and 25 deletions
+14 -22
View File
@@ -52,6 +52,13 @@ MOD_UNLOAD()
return MOD_SUCCESS;
}
static void log_sajoin(Client *client, Client *target, char *channels)
{
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channels",
log_data_client("target", target),
log_data_string("channels", channels));
}
/* cmd_sajoin() - Lamego - Wed Jul 21 20:04:48 1999
Copied off PTlink IRCd (C) PTlink coders team.
Coded for Sadmin by Stskeeps
@@ -89,20 +96,18 @@ CMD_FUNC(cmd_sajoin)
return;
}
/* Broadcast so other servers can log it appropriately as an SAJOIN */
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
/* If it's not for our client, then simply pass on the message... */
if (!MyUser(target))
{
sendto_one(target, NULL, ":%s SAJOIN %s %s", client->id, target->id, parv[2]);
/* Logging function added by XeRXeS */
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
client->name, target->name, parv[2]);
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: %s used SAJOIN to make %s join %s",
log_data_client("target", target),
log_data_string("channel", parv[2]));
log_sajoin(client, target, parv[2]);
return;
}
/* 'target' is our client... */
/* Can't this just use do_join() or something with a parameter to bypass some checks?
* This duplicate code is damn ugly. Ah well..
*/
@@ -281,23 +286,10 @@ CMD_FUNC(cmd_sajoin)
if (did_anything)
{
if (!sjmode)
{
sendnotice(target, "*** You were forced to join %s", jbuf);
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %s", client->name, target->name, jbuf);
/* Logging function added by XeRXeS */
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %s",
client->name, target->name, jbuf);
}
else
{
sendnotice(target, "*** You were forced to join %s with '%c'", jbuf, sjmode);
sendto_umode_global(UMODE_OPER, "%s used SAJOIN to make %s join %c%s", client->name, target->name, sjmode, jbuf);
ircd_log(LOG_SACMDS,"SAJOIN: %s used SAJOIN to make %s join %c%s",
client->name, target->name, sjmode, jbuf);
}
unreal_log(ULOG_INFO, "sacmds", "SAJOIN_COMMAND", client, "SAJOIN: $client used SAJOIN to make $target join $channels",
log_data_client("target", target),
log_data_string("channels", jbuf));
log_sajoin(client, target, jbuf);
}
}
}
+2 -3
View File
@@ -52,7 +52,7 @@ MOD_UNLOAD()
return MOD_SUCCESS;
}
void log_sapart(Client *client, Client *target, char *channels, char *comment)
static void log_sapart(Client *client, Client *target, char *channels, char *comment)
{
if (comment)
{
@@ -111,13 +111,12 @@ CMD_FUNC(cmd_sapart)
return;
}
/* Broadcast */
/* Broadcast so other servers can log it appropriately as an SAPART */
if (parv[3])
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s :%s", client->id, target->id, parv[2], comment);
else
sendto_server(client, 0, 0, recv_mtags, ":%s SAPART %s %s", client->id, target->id, parv[2]);
/* Relay it on, if it's not my target */
if (!MyUser(target))
{
log_sapart(client, target, parv[2], comment);