From 720cd84ab2355fc82bfc4887ef3875f3d09a380a Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Wed, 11 Aug 2021 20:47:18 +0200 Subject: [PATCH] Newlog: convert sendto_realops() to unreal_log() in 9 files. --- src/modules/antimixedutf8.c | 9 +++------ src/modules/chanmodes/floodprot.c | 8 -------- src/modules/close.c | 5 +++-- src/modules/connthrottle.c | 6 +++--- src/modules/dccallow.c | 7 +++++-- src/modules/dccdeny.c | 11 ++++++++--- src/modules/history_backend_mem.c | 4 +++- src/modules/ident_lookup.c | 3 ++- src/modules/join.c | 12 +++++++++--- 9 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/modules/antimixedutf8.c b/src/modules/antimixedutf8.c index a097297e0..7f9885e40 100644 --- a/src/modules/antimixedutf8.c +++ b/src/modules/antimixedutf8.c @@ -206,12 +206,9 @@ CMD_OVERRIDE_FUNC(override_msg) score = lookalikespam_score(StripControlCodes(parv[2])); if ((score >= cfg.score) && !find_tkl_exception(TKL_ANTIMIXEDUTF8, client)) { - if (cfg.ban_action == BAN_ACT_KILL) - { - sendto_realops("[antimixedutf8] Killed connection from %s (score %d)", - GetIP(client), score); - } /* no else here!! */ - + unreal_log(ULOG_INFO, "antimixedutf8", "ANTIMIXEDUTF8_HIT", client, + "[antimixedutf8] Client $client.details hit score $score -- taking action", + log_data_integer("score", score)); if ((cfg.ban_action == BAN_ACT_BLOCK) || ((cfg.ban_action == BAN_ACT_SOFT_BLOCK) && !IsLoggedIn(client))) { diff --git a/src/modules/chanmodes/floodprot.c b/src/modules/chanmodes/floodprot.c index 854ec70a7..521be2a70 100644 --- a/src/modules/chanmodes/floodprot.c +++ b/src/modules/chanmodes/floodprot.c @@ -1141,9 +1141,6 @@ EVENT(modef_event) /* Remove chanmode... */ long mode = 0; Cmode_t extmode = 0; -#ifdef NEWFLDDBG - sendto_realops("modef_event: chan %s mode -%c EXPIRED", e->channel->name, e->m); -#endif mode = get_mode_bitbychar(e->m); if (mode == 0) extmode = get_extmode_bitbychar(e->m); @@ -1167,11 +1164,6 @@ EVENT(modef_event) /* And delete... */ DelListItem(e, removechannelmodetimer_list); safe_free(e); - } else { -#ifdef NEWFLDDBG - sendto_realops("modef_event: chan %s mode -%c about %d seconds", - e->channel->name, e->m, e->when - now); -#endif } } } diff --git a/src/modules/close.c b/src/modules/close.c index 219f02cde..a73299099 100644 --- a/src/modules/close.c +++ b/src/modules/close.c @@ -75,7 +75,8 @@ CMD_FUNC(cmd_close) } sendnumeric(client, RPL_CLOSEEND, closed); - sendto_realops("%s!%s@%s closed %d unknown connections", client->name, - client->user->username, GetHost(client), closed); + unreal_log(ULOG_INFO, "close", "CLOSED_CONNECTIONS", client, + "$client.details closed $num_closed unknown connections", + log_data_integer("num_closed", closed)); irccounts.unknown = 0; } diff --git a/src/modules/connthrottle.c b/src/modules/connthrottle.c index 3a343dc83..3a85dcfef 100644 --- a/src/modules/connthrottle.c +++ b/src/modules/connthrottle.c @@ -439,9 +439,9 @@ int ct_pre_lconnect(Client *client) if (!ucounter->throttling_previous_minute && !ucounter->throttling_banner_displayed) { unreal_log(ULOG_WARNING, "connthrottle", "CONNTHROTLE_ACTIVATED", NULL, - "[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE."); - sendto_realops("[ConnThrottle] Users with IP addresses that have not been seen before will be rejected above the set connection rate. Known users can still get in."); - sendto_realops("[ConnThrottle] For more information see https://www.unrealircd.org/docs/ConnThrottle"); + "[ConnThrottle] Connection throttling has been ACTIVATED due to a HIGH CONNECTION RATE.\n" + "Users with IP addresses that have not been seen before will be rejected above the set connection rate. Known users can still get in.\n" + "or more information see https://www.unrealircd.org/docs/ConnThrottle"); ucounter->throttling_banner_displayed = 1; } exit_client(client, NULL, cfg.reason); diff --git a/src/modules/dccallow.c b/src/modules/dccallow.c index 0ba88b061..231645ecb 100644 --- a/src/modules/dccallow.c +++ b/src/modules/dccallow.c @@ -243,8 +243,11 @@ int del_dccallow(Client *client, Client *optr) } } if (!found) - sendto_realops("[BUG!] %s was in dccallowme list of %s but not in dccallowrem list!", - optr->name, client->name); + { + unreal_log(LOG_WARNING, "dccallow", "BUG_DCCALLOW", client, + "[BUG] DCCALLOW list for $client did not contain $target", + log_data_client("target", optr)); + } sendnumeric(client, RPL_DCCSTATUS, optr->name, "removed from"); diff --git a/src/modules/dccdeny.c b/src/modules/dccdeny.c index c859af766..febc62491 100644 --- a/src/modules/dccdeny.c +++ b/src/modules/dccdeny.c @@ -371,8 +371,10 @@ CMD_FUNC(cmd_dccdeny) if (!find_deny_dcc(parv[1])) { - sendto_ops("%s added a temp dccdeny for %s (%s)", client->name, - parv[1], parv[2]); + unreal_log(ULOG_INFO, "dccdeny", "DCCDENY_ADD", client, + "[dccdeny] $client added a temporary DCCDENY for $file ($reason)", + log_data_string("file", parv[1]), + log_data_string("reason", parv[2])); DCCdeny_add(parv[1], parv[2], DCCDENY_HARD, CONF_BAN_TYPE_TEMPORARY); return; } else @@ -405,7 +407,10 @@ CMD_FUNC(cmd_undccdeny) if ((d = find_deny_dcc(parv[1])) && d->flag.type2 == CONF_BAN_TYPE_TEMPORARY) { - sendto_ops("%s removed a temp dccdeny for %s", client->name, parv[1]); + unreal_log(ULOG_INFO, "dccdeny", "DCCDENY_DEL", client, + "[dccdeny] $client removed a temporary DCCDENY for $file ($reason)", + log_data_string("file", d->filename), + log_data_string("reason", d->reason)); DCCdeny_del(d); return; } else diff --git a/src/modules/history_backend_mem.c b/src/modules/history_backend_mem.c index 01777db70..fdc73d1e0 100644 --- a/src/modules/history_backend_mem.c +++ b/src/modules/history_backend_mem.c @@ -595,7 +595,9 @@ int hbm_history_add(char *object, MessageTag *mtags, char *line) HistoryLogObject *h = hbm_find_or_add_object(object); if (!h->max_lines) { - sendto_realops("hbm_history_add() for '%s', which has no limit", h->name); + unreal_log(ULOG_WARNING, "history", "BUG_HISTORY_ADD_NO_LIMIT", NULL, + "[BUG] hbm_history_add() called for $object, which has no limit set", + log_data_string("object", h->name)); #ifdef DEBUGMODE abort(); #else diff --git a/src/modules/ident_lookup.c b/src/modules/ident_lookup.c index 142e8177b..46137d5b5 100644 --- a/src/modules/ident_lookup.c +++ b/src/modules/ident_lookup.c @@ -92,7 +92,8 @@ static int ident_lookup_connect(Client *client) } if (++OpenFiles >= maxclients+1) { - sendto_ops("Can't allocate fd, too many connections."); + unreal_log(ULOG_FATAL, "ident", "IDENT_ERROR_MAXCLIENTS", client, + "Cannot do ident connection for $client.detail: All connections in use"); fd_close(client->local->authfd); --OpenFiles; client->local->authfd = -1; diff --git a/src/modules/join.c b/src/modules/join.c index f0e70c978..a28cd213c 100644 --- a/src/modules/join.c +++ b/src/modules/join.c @@ -170,7 +170,12 @@ CMD_FUNC(cmd_join) int r; if (bouncedtimes) - sendto_realops("join: bouncedtimes=%d??? [please report at https://bugs.unrealircd.org/]", bouncedtimes); + { + unreal_log(ULOG_ERROR, "join", "BUG_JOIN_BOUNCEDTIMES", NULL, + "[BUG] join: bouncedtimes is not initialized to zero ($bounced_times)!! " + "Please report at https://bugs.unrealircd.org/", + log_data_integer("bounced_times", bouncedtimes)); + } bouncedtimes = 0; if (IsServer(client)) @@ -485,8 +490,9 @@ void _do_join(Client *client, int parc, char *parv[]) { if (d->warn) { - sendto_snomask(SNO_EYES, "*** %s tried to join forbidden channel %s", - get_client_name(client, 1), name); + unreal_log(ULOG_INFO, "join", "JOIN_DENIED_FORBIDDEN_CHANNEL", client, + "Client $client.details tried to join forbidden channel $channel", + log_data_string("channel", name)); } if (d->reason) sendnumeric(client, ERR_FORBIDDENCHANNEL, name, d->reason);