diff --git a/src/conf.c b/src/conf.c index 8217cd7e7..bdf9b2d1c 100644 --- a/src/conf.c +++ b/src/conf.c @@ -2156,10 +2156,8 @@ int config_test(void) if (old_pid_file && strcmp(old_pid_file, conf_files->pid_file)) { - sendto_ops("pidfile is being rewritten to %s, please delete %s", - conf_files->pid_file, - old_pid_file); write_pidfile(); + unlink(old_pid_file); } safe_free(old_pid_file); diff --git a/src/modules/sdesc.c b/src/modules/sdesc.c index ca476591b..685c04477 100644 --- a/src/modules/sdesc.c +++ b/src/modules/sdesc.c @@ -86,6 +86,7 @@ CMD_FUNC(cmd_sdesc) sendto_server(client, 0, 0, NULL, ":%s SDESC :%s", client->name, parv[1]); - sendto_ops("Server description for %s is now '%s' (changed by %s)", - client->uplink->name, client->uplink->info, client->name); + unreal_log(ULOG_INFO, "sdesc", "SDESC_COMMAND", client, + "Server description for $server is now '$server.server.info' (changed by $client)", + log_data_client("server", client->uplink)); } diff --git a/src/modules/sjoin.c b/src/modules/sjoin.c index 6f3d9d102..b6818d30d 100644 --- a/src/modules/sjoin.c +++ b/src/modules/sjoin.c @@ -310,11 +310,6 @@ CMD_FUNC(cmd_sjoin) sj3_parabuf[0] = '\0'; for (i = 2; i <= (parc - 2); i++) { - if (!parv[i]) - { - sendto_ops("Got null parv in SJ3 code"); - continue; - } strlcat(sj3_parabuf, parv[i], sizeof sj3_parabuf); if (((i + 1) <= (parc - 2))) strlcat(sj3_parabuf, " ", sizeof sj3_parabuf); @@ -348,8 +343,10 @@ CMD_FUNC(cmd_sjoin) if (!end) { /* this obviously should never happen */ - sendto_ops("Malformed SJOIN piece from %s for channel %s: %s", - client->name, channel->name, tp); + unreal_log(ULOG_WARNING, "sjoin", "SJOIN_INVALID_SJSBY", NULL, + "SJOIN for channel $channel has invalid SJSBY in item '$item' (from $client)", + log_data_channel("channel", channel), + log_data_string("item", s)); continue; } *end++ = '\0'; @@ -358,8 +355,10 @@ CMD_FUNC(cmd_sjoin) if (!p) { /* missing setby parameter */ - sendto_ops("Malformed SJOIN piece from %s for channel %s: %s", - client->name, channel->name, tp); + unreal_log(ULOG_WARNING, "sjoin", "SJOIN_INVALID_SJSBY", NULL, + "SJOIN for channel $channel has invalid SJSBY in item '$item' (from $client)", + log_data_channel("channel", channel), + log_data_string("item", s)); continue; } *p++ = '\0'; diff --git a/src/modules/svsnoop.c b/src/modules/svsnoop.c index 1b5044310..9eba91da8 100644 --- a/src/modules/svsnoop.c +++ b/src/modules/svsnoop.c @@ -67,7 +67,8 @@ CMD_FUNC(cmd_svsnoop) if (parv[2][0] == '+') { SVSNOOP = 1; - sendto_ops("This server has been placed in NOOP mode"); + unreal_log(ULOG_INFO, "svsnoop", "SVSNOOP_ENABLED", client, + "This server has been placed in NOOP mode (by $client) -- all IRCOp rights disabled"); list_for_each_entry(acptr, &client_list, client_node) { if (MyUser(acptr) && IsOper(acptr)) @@ -89,7 +90,8 @@ CMD_FUNC(cmd_svsnoop) else { SVSNOOP = 0; - sendto_ops("This server is no longer in NOOP mode"); + unreal_log(ULOG_INFO, "svsnoop", "SVSNOOP_ENABLED", client, + "This server is no longer in NOOP mode (by $client) -- IRCOps can oper up again"); } } } diff --git a/src/modules/wallops.c b/src/modules/wallops.c index d7ca3ed3e..288be2206 100644 --- a/src/modules/wallops.c +++ b/src/modules/wallops.c @@ -73,4 +73,5 @@ CMD_FUNC(cmd_wallops) } sendto_ops_butone(client->direction, client, ":%s WALLOPS :%s", client->name, message); + // FIXME: move all that code to here and modularize +w } diff --git a/src/modules/watch-backend.c b/src/modules/watch-backend.c index 9d6b9f0af..40f73c434 100644 --- a/src/modules/watch-backend.c +++ b/src/modules/watch-backend.c @@ -283,11 +283,12 @@ int _watch_del(char *nick, Client *client, int flags) * No error checking in ircd is unneccessary ;) -Cabal95 */ if (!*lp) - sendto_ops("WATCH debug error: _watch_del " - "found a watch entry with no client " - "counterpoint processing nick %s on client %p!", - nick, client->user); - else { + { + unreal_log(ULOG_WARNING, "watch", "BUG_WATCH_DEL", client, + "[BUG] watch_del found a watch entry with no client counterpoint, " + "while processing nick $nick on client $client.details", + log_data_string("nick", nick)); + } else { prev = *lp; *lp = prev->next; free_link(prev); @@ -334,11 +335,11 @@ int _watch_del_list(Client *client, int flags) /* Not found, another "worst case" debug error */ if (!*lp) - sendto_ops("WATCH Debug error: _watch_del_list " - "found a WATCH entry with no table " - "counterpoint processing client %s!", - client->name); - else { + { + unreal_log(ULOG_WARNING, "watch", "BUG_WATCH_DEL_LIST", client, + "[BUG] watch_del_list found a watch entry with no table counterpoint, " + "while processing client $client.details"); + } else { /* Fix the watch-list and remove entry */ Link *prev = *lp; *lp = prev->next; diff --git a/src/modules/websocket.c b/src/modules/websocket.c index dc768bcc5..89ece689c 100644 --- a/src/modules/websocket.c +++ b/src/modules/websocket.c @@ -1123,8 +1123,12 @@ int websocket_create_packet(int opcode, char **buf, int *len) if (bytes_in_sendbuf + bytes_single_frame > sizeof(sendbuf)) { /* Overflow. This should never happen. */ - sendto_ops("[websocket] [BUG] Overflow prevented: %d + %d > %d", - bytes_in_sendbuf, bytes_single_frame, (int)sizeof(sendbuf)); + unreal_log(ULOG_WARNING, "websocket", "BUG_WEBSOCKET_OVERFLOW", NULL, + "[BUG] [websocket] Overflow prevented in websocket_create_packet(): " + "$bytes_in_sendbuf + $bytes_single_frame > $sendbuf_size", + log_data_integer("bytes_in_sendbuf", bytes_in_sendbuf), + log_data_integer("bytes_single_frame", bytes_single_frame), + log_data_integer("sendbuf_size", sizeof(sendbuf))); return -1; } diff --git a/src/parse.c b/src/parse.c index 8c8d05b44..8d520496a 100644 --- a/src/parse.c +++ b/src/parse.c @@ -758,10 +758,6 @@ static void remove_unknown(Client *client, char *sender) if (!IsServer(client)) return; -#ifdef DEVELOP - sendto_ops("Killing %s (%s)", sender, backupbuf); - return; -#endif /* * Do kill if it came from a server because it means there is a ghost * user on the other server which needs to be removed. -avalon diff --git a/src/send.c b/src/send.c index 52d6f1497..75a752b67 100644 --- a/src/send.c +++ b/src/send.c @@ -701,34 +701,6 @@ void sendto_match_butone(Client *one, Client *from, const char *mask, int what, } } -/** Send a message to all locally connected IRCOps - * @param pattern The format string / pattern to use. - * @param ... Format string parameters. - */ -void sendto_ops(FORMAT_STRING(const char *pattern), ...) -{ - va_list vl; - Client *acptr; - char nbuf[1024]; - - list_for_each_entry(acptr, &oper_list, special_node) - { - if (!IsServer(acptr) && !IsMe(acptr) && acptr->user->snomask) - { - ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :*** ", me.name, acptr->name); - strlcat(nbuf, pattern, sizeof nbuf); - - va_start(vl, pattern); - vsendto_one(acptr, NULL, nbuf, vl); - va_end(vl); - } - } -} - -/* Hmm.. so local sending is called sendto_ops() and local+remote is sendto_ops_butone(), - * that is weird naming... (TODO fix some day in a new major series) - */ - /** Send a message to all IRCOps (local and remote), except one. * @param one Skip sending the message to this client/direction * @param from The sender (can not be NULL) diff --git a/src/socket.c b/src/socket.c index 70bbee875..d19c2f53b 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1093,16 +1093,10 @@ int deliver_it(Client *client, char *str, int len, int *want_read) *want_read = 0; - if (IsDeadSocket(client) || (!IsServer(client) && !IsUser(client) - && !IsHandshake(client) - && !IsTLSHandshake(client) - - && !IsUnknown(client))) + if (IsDeadSocket(client) || + (!IsServer(client) && !IsUser(client) && !IsHandshake(client) && + !IsTLSHandshake(client) && !IsUnknown(client))) { - str[len] = '\0'; - sendto_ops - ("* * * DEBUG ERROR * * * !!! Calling deliver_it() for %s, status %d %s, with message: %s", - client->name, client->status, IsDeadSocket(client) ? "DEAD" : "", str); return -1; }