2 * IRC - Internet Relay Chat, ircd/client.c
3 * Copyright (C) 1990 Darren Reed
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 1, or (at your option)
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "ircd_reply.h"
34 #define BAD_PING ((unsigned int)-2)
38 * returns shortest ping time in attached server or client conf
39 * classes or PINGFREQUENCY
41 int client_get_ping(const struct Client* acptr)
44 struct ConfItem* aconf;
47 for (link = acptr->confs; link; link = link->next) {
48 aconf = link->value.aconf;
49 if (aconf->status & (CONF_CLIENT | CONF_SERVER)) {
50 int tmp = get_conf_ping(aconf);
51 if (0 < tmp && (ping > tmp || !ping))
58 Debug((DEBUG_DEBUG, "Client %s Ping %d", acptr->name, ping));
63 #define BAD_CONF_CLASS ((unsigned int)-1)
64 #define BAD_CLIENT_CLASS ((unsigned int)-3)
66 unsigned int get_client_class(struct Client* acptr)
69 struct ConnectionClass *cl;
70 unsigned int retc = BAD_CLIENT_CLASS;
72 if (acptr && !IsMe(acptr) && (acptr->confs))
73 for (tmp = acptr->confs; tmp; tmp = tmp->next)
75 if (!tmp->value.aconf || !(cl = tmp->value.aconf->confClass))
77 if (ConClass(cl) > retc || retc == BAD_CLIENT_CLASS)
81 Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, acptr->name));
86 unsigned int get_sendq(struct Client *cptr)
89 assert(0 != cptr->local);
92 return cptr->max_sendq;
94 else if (cptr->confs) {
96 struct ConnectionClass* cl;
98 for (tmp = cptr->confs; tmp; tmp = tmp->next) {
99 if (!tmp->value.aconf || !(cl = tmp->value.aconf->confClass))
101 if (ConClass(cl) != BAD_CLIENT_CLASS) {
102 cptr->max_sendq = MaxSendq(cl);
103 return cptr->max_sendq;
107 return DEFAULTMAXSENDQLENGTH;