mirror of
https://github.com/unrealircd/unrealircd.git
synced 2026-07-10 15:43:12 +02:00
- Use lists instead of looping on LastSlot in a few places.
This commit is contained in:
+1
-8
@@ -1825,14 +1825,7 @@ ConfigItem_log *ca = MyMallocEx(sizeof(ConfigItem_log));
|
||||
|
||||
int isanyserverlinked(void)
|
||||
{
|
||||
int i;
|
||||
aClient *acptr;
|
||||
|
||||
for (i = LastSlot; i >= 0; i--)
|
||||
if ((acptr = local[i]) && (acptr != &me) && IsServer(acptr))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
return !list_empty(&server_list);
|
||||
}
|
||||
|
||||
void applymeblock(void)
|
||||
|
||||
+7
-15
@@ -678,12 +678,12 @@ static void exit_one_client(aClient *cptr, aClient *sptr, aClient *from, char *c
|
||||
** need to send different names to different servers
|
||||
** (domain name matching)
|
||||
*/
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
list_for_each_entry(acptr, &server_list, special_node)
|
||||
{
|
||||
|
||||
if (!(acptr = local[i]) || !IsServer(acptr) || acptr == cptr || IsMe(acptr)
|
||||
|| (DontSendQuit(acptr) && split))
|
||||
if (acptr == cptr || IsMe(acptr) || (DontSendQuit(acptr) && split))
|
||||
continue;
|
||||
|
||||
/*
|
||||
** SQUIT going "upstream". This is the remote
|
||||
** squit still hunting for the target. Use prefixed
|
||||
@@ -791,20 +791,12 @@ static void exit_one_client(aClient *cptr, aClient *sptr, aClient *from, char *c
|
||||
|
||||
void checklist(void)
|
||||
{
|
||||
aClient *acptr;
|
||||
int i, j;
|
||||
|
||||
if (!(bootopt & BOOT_AUTODIE))
|
||||
return;
|
||||
for (j = i = 0; i <= LastSlot; i++)
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
else if (IsClient(acptr))
|
||||
j++;
|
||||
if (!j)
|
||||
{
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (!list_empty(&lclient_list))
|
||||
exit (0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+5
-11
@@ -871,11 +871,9 @@ char *reason = parv[1];
|
||||
}
|
||||
}
|
||||
sendto_ops("Server is Restarting by request of %s", parv[0]);
|
||||
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (IsClient(acptr))
|
||||
sendto_one(acptr,
|
||||
":%s %s %s :Server Restarting. %s",
|
||||
@@ -1221,10 +1219,8 @@ CMD_FUNC(m_die)
|
||||
/* Let the +s know what is going on */
|
||||
sendto_ops("Server Terminating by request of %s", parv[0]);
|
||||
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (IsClient(acptr))
|
||||
sendto_one(acptr,
|
||||
":%s %s %s :Server Terminating. %s",
|
||||
@@ -1233,6 +1229,7 @@ CMD_FUNC(m_die)
|
||||
sendto_one(acptr, ":%s ERROR :Terminated by %s",
|
||||
me.name, get_client_name(sptr, TRUE));
|
||||
}
|
||||
|
||||
(void)s_die();
|
||||
return 0;
|
||||
}
|
||||
@@ -1245,12 +1242,9 @@ CMD_FUNC(m_die)
|
||||
int localdie(void)
|
||||
{
|
||||
aClient *acptr;
|
||||
int i;
|
||||
|
||||
for (i = 0; i <= LastSlot; i++)
|
||||
list_for_each_entry(acptr, &lclient_list, lclient_node)
|
||||
{
|
||||
if (!(acptr = local[i]))
|
||||
continue;
|
||||
if (IsClient(acptr))
|
||||
sendto_one(acptr,
|
||||
":%s %s %s :Server Terminated by local console",
|
||||
|
||||
+10
-10
@@ -740,14 +740,14 @@ void send_umode(aClient *cptr, aClient *sptr, long old, long sendmask, char *umo
|
||||
*/
|
||||
void send_umode_out(aClient *cptr, aClient *sptr, long old)
|
||||
{
|
||||
int i;
|
||||
aClient *acptr;
|
||||
|
||||
send_umode(NULL, sptr, old, SEND_UMODES, buf);
|
||||
|
||||
for (i = LastSlot; i >= 0; i--)
|
||||
if ((acptr = local[i]) && IsServer(acptr) &&
|
||||
(acptr != cptr) && (acptr != sptr) && *buf) {
|
||||
list_for_each_entry(acptr, &server_list, special_node)
|
||||
{
|
||||
if ((acptr != cptr) && (acptr != sptr) && *buf)
|
||||
{
|
||||
if (!SupportUMODE2(acptr))
|
||||
{
|
||||
sendto_one(acptr, ":%s MODE %s :%s",
|
||||
@@ -761,28 +761,28 @@ void send_umode_out(aClient *cptr, aClient *sptr, long old)
|
||||
buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cptr && MyClient(cptr))
|
||||
send_umode(cptr, sptr, old, ALL_UMODES, buf);
|
||||
|
||||
}
|
||||
|
||||
void send_umode_out_nickv2(aClient *cptr, aClient *sptr, long old)
|
||||
{
|
||||
int i;
|
||||
aClient *acptr;
|
||||
|
||||
send_umode(NULL, sptr, old, SEND_UMODES, buf);
|
||||
|
||||
for (i = LastSlot; i >= 0; i--)
|
||||
if ((acptr = local[i]) && IsServer(acptr)
|
||||
&& !SupportNICKv2(acptr) && (acptr != cptr)
|
||||
list_for_each_entry(acptr, &server_list, special_node)
|
||||
{
|
||||
if (!SupportNICKv2(acptr) && (acptr != cptr)
|
||||
&& (acptr != sptr) && *buf)
|
||||
sendto_one(acptr, ":%s MODE %s :%s", sptr->name,
|
||||
sptr->name, buf);
|
||||
}
|
||||
|
||||
if (cptr && MyClient(cptr))
|
||||
send_umode(cptr, sptr, old, ALL_UMODES, buf);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user