mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-06 00:53:13 +02:00
Code cleanup: 'make format', this fixes those list_for_each* for loops.
This commit is contained in:
+1
-1
@@ -207,7 +207,7 @@ int dbuf_get(dbuf *dyn, char **buf)
|
||||
|
||||
/* First calculate the room needed... */
|
||||
list_for_each_entry2(block, dbufbuf, &dyn->dbuf_list, dbuf_node)
|
||||
bytes += block->size;
|
||||
bytes += block->size;
|
||||
|
||||
d = *buf = safe_alloc(bytes + 1);
|
||||
|
||||
|
||||
+1
-1
@@ -640,7 +640,7 @@ EVENT(update_known_user_cache_timer)
|
||||
do
|
||||
{
|
||||
list_for_each_entry(client, &idTable[slot], id_hash)
|
||||
update_known_user_cache(client);
|
||||
update_known_user_cache(client);
|
||||
|
||||
if (++slot >= NICK_HASH_TABLE_SIZE)
|
||||
slot = 0;
|
||||
|
||||
@@ -1566,8 +1566,10 @@ void do_unreal_log_control(LogLevel loglevel, const char *subsystem, const char
|
||||
if (!strcmp(subsystem, "rawtraffic"))
|
||||
return;
|
||||
|
||||
list_for_each_entry(client, &control_list, lclient_node) if (IsMonitorRehash(client) && IsControl(client)) for (m = msg; m; m = m->next)
|
||||
sendto_one(client, NULL, "REPLY [%s] %s", log_level_valtostring(loglevel), m->line);
|
||||
list_for_each_entry(client, &control_list, lclient_node)
|
||||
if (IsMonitorRehash(client) && IsControl(client))
|
||||
for (m = msg; m; m = m->next)
|
||||
sendto_one(client, NULL, "REPLY [%s] %s", log_level_valtostring(loglevel), m->line);
|
||||
|
||||
if (json_rehash_log)
|
||||
{
|
||||
|
||||
+4
-2
@@ -2649,7 +2649,8 @@ void s_die()
|
||||
loop.terminating = 1;
|
||||
unload_all_modules();
|
||||
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)(void) send_queued(client);
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)
|
||||
(void)send_queued(client);
|
||||
|
||||
exit(-1);
|
||||
} else
|
||||
@@ -2732,7 +2733,8 @@ void server_reboot(const char *mesg)
|
||||
"Restarting server: $reason",
|
||||
log_data_string("reason", mesg));
|
||||
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)(void) send_queued(client);
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)
|
||||
(void)send_queued(client);
|
||||
|
||||
/*
|
||||
* ** fd 0 must be 'preserved' if either the -d or -i options have
|
||||
|
||||
@@ -916,9 +916,9 @@ EVENT(ct_check)
|
||||
b->check_known = b->check_excepted = b->check_unknown = 0;
|
||||
|
||||
list_for_each_entry(client, &client_list, client_node)
|
||||
ct_check_walk_one(client);
|
||||
ct_check_walk_one(client);
|
||||
list_for_each_entry(client, &unknown_list, lclient_node)
|
||||
ct_check_walk_one(client);
|
||||
ct_check_walk_one(client);
|
||||
|
||||
for (tier = 0; tier < CT_NUM_TIERS; tier++)
|
||||
{
|
||||
|
||||
@@ -145,8 +145,9 @@ void isupport_check_for_changes_one(const char *addstr, char *buf, size_t buflen
|
||||
if (*changes == 0)
|
||||
{
|
||||
/* First change, need to start the batch */
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
|
||||
sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch);
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
|
||||
sendto_one(acptr, NULL, ":%s BATCH +%s draft/isupport", me.name, batch);
|
||||
}
|
||||
|
||||
*changes = *changes + 1;
|
||||
@@ -221,8 +222,9 @@ void _isupport_check_for_changes(void)
|
||||
if (changes)
|
||||
{
|
||||
/* End the batch (for those clients who received a batch, that is) */
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node) if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
|
||||
sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch);
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
if (HasCapability(acptr, "draft/extended-isupport") && HasCapability(acptr, "batch"))
|
||||
sendto_one(acptr, NULL, ":%s BATCH -%s", me.name, batch);
|
||||
}
|
||||
|
||||
safe_free_message_tags(mtags);
|
||||
|
||||
+3
-2
@@ -331,8 +331,9 @@ void _exit_client_ex(Client *client, Client *origin, MessageTag *recv_mtags, con
|
||||
remove_dependents(client, origin, recv_mtags, comment, splitstr);
|
||||
|
||||
/* Special case for remote async RPC, server.rehash in particular.. */
|
||||
list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node) if (!strncmp(client->id, acptr->id, SIDLEN))
|
||||
free_client(acptr);
|
||||
list_for_each_entry_safe(acptr, next, &rpc_remote_list, client_node)
|
||||
if (!strncmp(client->id, acptr->id, SIDLEN))
|
||||
free_client(acptr);
|
||||
|
||||
RunHook(HOOKTYPE_SERVER_QUIT, client, recv_mtags);
|
||||
} else if (IsUser(client) && !IsKilled(client))
|
||||
|
||||
+13
-12
@@ -422,18 +422,19 @@ int stats_links(Client *client, const char *para)
|
||||
link_p->leaf, link_p->servername, link_p->leaf_depth);
|
||||
}
|
||||
#ifdef DEBUGMODE
|
||||
list_for_each_entry(acptr, &client_list, client_node) if (MyConnect(acptr) && acptr->server && !IsMe(acptr))
|
||||
{
|
||||
if (!acptr->server->conf)
|
||||
sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)",
|
||||
acptr->name, acptr);
|
||||
else
|
||||
sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s",
|
||||
acptr->name, acptr,
|
||||
acptr->server->conf,
|
||||
acptr->server->conf->refcount,
|
||||
acptr->server->conf->flag.temporary ? "YES" : "NO");
|
||||
}
|
||||
list_for_each_entry(acptr, &client_list, client_node)
|
||||
if (MyConnect(acptr) && acptr->server && !IsMe(acptr))
|
||||
{
|
||||
if (!acptr->server->conf)
|
||||
sendnotice(client, "client '%s' (%p) has NO CONF attached (? :P)",
|
||||
acptr->name, acptr);
|
||||
else
|
||||
sendnotice(client, "client '%s' (%p) has conf %p attached, refcount: %d, temporary: %s",
|
||||
acptr->name, acptr,
|
||||
acptr->server->conf,
|
||||
acptr->server->conf->refcount,
|
||||
acptr->server->conf->flag.temporary ? "YES" : "NO");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
+34
-33
@@ -3784,50 +3784,51 @@ void _tkl_check_local_remove_shun(TKL *tmp)
|
||||
|
||||
for (i = 0; i <= 5; i++)
|
||||
{
|
||||
list_for_each_entry(client, &lclient_list, lclient_node) if (MyUser(client) && IsShunned(client))
|
||||
{
|
||||
chost = client->local->sockhost;
|
||||
cname = client->user->username;
|
||||
|
||||
cip = GetIP(client);
|
||||
|
||||
if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9'))
|
||||
is_ip = 1;
|
||||
else
|
||||
is_ip = 0;
|
||||
|
||||
if (is_ip == 0
|
||||
? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname))
|
||||
: (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) &&
|
||||
match_simple(tmp->ptr.serverban->usermask, cname))
|
||||
list_for_each_entry(client, &lclient_list, lclient_node)
|
||||
if (MyUser(client) && IsShunned(client))
|
||||
{
|
||||
/*
|
||||
chost = client->local->sockhost;
|
||||
cname = client->user->username;
|
||||
|
||||
cip = GetIP(client);
|
||||
|
||||
if ((*tmp->ptr.serverban->hostmask >= '0') && (*tmp->ptr.serverban->hostmask <= '9'))
|
||||
is_ip = 1;
|
||||
else
|
||||
is_ip = 0;
|
||||
|
||||
if (is_ip == 0
|
||||
? (match_simple(tmp->ptr.serverban->hostmask, chost) && match_simple(tmp->ptr.serverban->usermask, cname))
|
||||
: (match_simple(tmp->ptr.serverban->hostmask, chost) || match_simple(tmp->ptr.serverban->hostmask, cip)) &&
|
||||
match_simple(tmp->ptr.serverban->usermask, cname))
|
||||
{
|
||||
/*
|
||||
before blindly marking this user as un-shunned, we need to check
|
||||
if the user is under any other existing shuns. (#0003906)
|
||||
Unfortunately, this requires crazy amounts of indentation ;-).
|
||||
|
||||
This enumeration code is based off of _tkl_stats()
|
||||
*/
|
||||
keep_shun = 0;
|
||||
for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next)
|
||||
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
{
|
||||
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
|
||||
/* the hostmask is an IP */
|
||||
&& (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip)))
|
||||
keep_shun = 1;
|
||||
else
|
||||
/* the hostmask is not an IP */
|
||||
if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
keep_shun = 0;
|
||||
for (tk = tklines[tkl_hash('s')]; tk && !keep_shun; tk = tk->next)
|
||||
if (tk != tmp && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
{
|
||||
if ((*tk->ptr.serverban->hostmask >= '0') && (*tk->ptr.serverban->hostmask <= '9')
|
||||
/* the hostmask is an IP */
|
||||
&& (match_simple(tk->ptr.serverban->hostmask, chost) || match_simple(tk->ptr.serverban->hostmask, cip)))
|
||||
keep_shun = 1;
|
||||
}
|
||||
else
|
||||
/* the hostmask is not an IP */
|
||||
if (match_simple(tk->ptr.serverban->hostmask, chost) && match_simple(tk->ptr.serverban->usermask, cname))
|
||||
keep_shun = 1;
|
||||
}
|
||||
|
||||
if (!keep_shun)
|
||||
{
|
||||
ClearShunned(client);
|
||||
if (!keep_shun)
|
||||
{
|
||||
ClearShunned(client);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -285,8 +285,9 @@ int count_whowas_and_user_entries(void)
|
||||
cnt++;
|
||||
}
|
||||
|
||||
list_for_each_entry(client, &client_list, client_node) if (IsUser(client))
|
||||
cnt++;
|
||||
list_for_each_entry(client, &client_list, client_node)
|
||||
if (IsUser(client))
|
||||
cnt++;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
+1
-1
@@ -630,7 +630,7 @@ static void who_global(Client *client, char *mask, int operspy, struct who_forma
|
||||
|
||||
/* Initialize the markers to zero */
|
||||
list_for_each_entry(acptr, &client_list, client_node)
|
||||
ClearMark(acptr);
|
||||
ClearMark(acptr);
|
||||
|
||||
/* First, if not operspy, then list all matching clients on common channels */
|
||||
if (!operspy)
|
||||
|
||||
+9
-8
@@ -881,15 +881,16 @@ void sendto_umode(int umodes, FORMAT_STRING(const char *pattern), ...)
|
||||
Client *acptr;
|
||||
char nbuf[1024];
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node) if (IsUser(acptr) && (acptr->umodes & umodes) == umodes)
|
||||
{
|
||||
ircsnprintf(nbuf, sizeof(nbuf), ":%s NOTICE %s :", me.name, acptr->name);
|
||||
strlcat(nbuf, pattern, sizeof nbuf);
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
if (IsUser(acptr) && (acptr->umodes & umodes) == umodes)
|
||||
{
|
||||
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);
|
||||
}
|
||||
va_start(vl, pattern);
|
||||
vsendto_one(acptr, NULL, nbuf, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
}
|
||||
|
||||
/** Send a message to all users with specified user mode (local & remote users).
|
||||
|
||||
Reference in New Issue
Block a user