1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 22:03:13 +02:00

- Add lclient_list and aClient.lclient_node, which iterates local clients.

This commit is contained in:
William Pitcock
2012-11-21 23:14:28 +00:00
parent f09b1ac4d4
commit a35fe3ea3b
3 changed files with 19 additions and 3 deletions
+1 -1
View File
@@ -151,7 +151,7 @@ extern MODVAR int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns,
R_do_id, R_fin_id, R_fail_id;
#endif
extern struct list_head client_list;
extern struct list_head client_list, lclient_list;
extern inline aCommand *find_Command(char *cmd, short token, int flags);
extern aCommand *find_Command_simple(char *cmd);
extern aChannel *find_channel(char *, aChannel *);
+3
View File
@@ -995,6 +995,7 @@ typedef struct {
struct Client {
struct list_head client_node; /* for global client list (client_list) */
struct list_head client_hash; /* for clientTable */
anUser *user; /* ...defined, if this is a User */
aServer *serv; /* ...defined, if this is a server */
TS lastnick; /* TimeStamp on nick */
@@ -1016,6 +1017,8 @@ struct Client {
** these fields, if (from != self).
*/
int count; /* Amount of data in buffer */
struct list_head lclient_node; /* for local client list (lclient_list) */
#if 1
int oflag; /* oper access flags (removed from anUser for mem considerations) */
TS since; /* time they will next be allowed to send something */
+15 -2
View File
@@ -70,7 +70,8 @@ MODVAR Member *freemember = NULL;
MODVAR Membership *freemembership = NULL;
MODVAR MembershipL *freemembershipL = NULL;
MODVAR int numclients = 0;
MODVAR struct list_head client_list;
MODVAR struct list_head client_list, lclient_list;
void initlists(void)
{
@@ -84,6 +85,7 @@ void initlists(void)
#endif
INIT_LIST_HEAD(&client_list);
INIT_LIST_HEAD(&lclient_list);
}
void outofmemory(void)
@@ -139,6 +141,8 @@ aClient *make_client(aClient *from, aClient *servr)
(void)strcpy(cptr->username, "unknown");
if (size == CLIENT_LOCAL_SIZE)
{
INIT_LIST_HEAD(&cptr->lclient_node);
cptr->since = cptr->lasttime =
cptr->lastnick = cptr->firsttime = TStime();
cptr->class = NULL;
@@ -299,7 +303,13 @@ void remove_client_from_list(aClient *cptr)
#endif
)
IRCstats.unknown--;
list_del(&cptr->client_node);
/* delink ourselves from various lists */
if (!list_empty(&cptr->client_node))
list_del(&cptr->client_node);
if (!list_empty(&cptr->lclient_node))
list_del(&cptr->lclient_node);
checklist();
if (IsPerson(cptr)) /* Only persons can have been added before */
{
@@ -338,6 +348,9 @@ void remove_client_from_list(aClient *cptr)
void add_client_to_list(aClient *cptr)
{
list_add(&cptr->client_node, &client_list);
if (MyConnect(cptr))
list_add(&cptr->lclient_node, &lclient_list);
}
/*