Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Tue, 12 Dec 2000 02:33:04 +0000 (02:33 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Tue, 12 Dec 2000 02:33:04 +0000 (02:33 +0000)
Log message:

I'm fed up with struct Client as it is.  I'm going to restructure the
interface quite a bit, though the basic fields in struct Client will
remain as they are.  However, instead of having a two-size struct Client,
I will split it into a struct Client and a struct Connection (or similar).

The first step to doing this is creating a set of accessor macros and
making all of ircd use them to access the fields.  This will allow me to
divorce the structures and only have to change the accessor macros and the
struct Client allocation functions and a bit of networking code, rather
than going through all of ircd later and fixing things after they're all
broken.

This commit is the first step toward this.  All the affected header files
have been converted, and all the .c files up through hash.c have been
carefully checked.  Everything compiles cleanly at this point, so I am
assuming that it works; I'll double-check when this phase of the project is
complete.

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@334 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
include/client.h
include/numnicks.h
ircd/IPcheck.c
ircd/channel.c
ircd/class.c
ircd/client.c
ircd/crule.c
ircd/gline.c
ircd/hash.c

index ce78b49046f9a8f8ed6da429d88c97dce8e262cd..fe6a8ff00cfcfb614fa0702c20bd092437f3da40 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
 2000-12-11  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/hash.c: use struct Client accessor macros
+
+       * ircd/gline.c: use struct Client accessor macros
+
+       * ircd/crule.c: use struct Client accessor macros
+
+       * ircd/client.c: use struct Client accessor macros; remove some
+       dead code
+
+       * ircd/class.c: use struct Client accessor macros
+
+       * ircd/channel.c: use struct Client accessor macros; remove some
+       dead code
+
+       * ircd/IPcheck.c: use struct Client accessor macros
+
+       * include/numnicks.h: use struct Client accessor macros
+
+       * include/client.h: first step to divorcing struct Client and
+       struct Connection--define accessor macros and use them
+
        * ircd/gline.c: When Uworld removed Uworld-set G-lines, only the
        uplink would remove them.  This is because the removal protocol
        message wasn't being sent to the uplinks.  This is fixed by fixing
index 15ca14d355a78c939fd2b82719ecc80cf8adfd6b..327bb6a5336386a30daa10cc9aa5476fbb56fce0 100644 (file)
@@ -139,6 +139,57 @@ struct Client {
                                    caused this clients socket to be `dead' */
 };
 
+#define cli_next(cli)          ((cli)->next)
+#define cli_prev(cli)          ((cli)->prev)
+#define cli_hnext(cli)         ((cli)->hnext)
+#define cli_from(cli)          ((cli)->from)
+#define cli_user(cli)          ((cli)->user)
+#define cli_serv(cli)          ((cli)->serv)
+#define cli_whowas(cli)                ((cli)->whowas)
+#define cli_yxx(cli)           ((cli)->yxx)
+#define cli_lasttime(cli)      ((cli)->lasttime)
+#define cli_since(cli)         ((cli)->since)
+#define cli_firsttime(cli)     ((cli)->firsttime)
+#define cli_lastnick(cli)      ((cli)->lastnick)
+#define cli_marker(cli)                ((cli)->marker)
+#define cli_flags(cli)         ((cli)->flags)
+#define cli_hopcount(cli)      ((cli)->hopcount)
+#define cli_ip(cli)            ((cli)->ip)
+#define cli_status(cli)                ((cli)->status)
+#define cli_local(cli)         ((cli)->local)
+#define cli_name(cli)          ((cli)->name)
+#define cli_username(cli)      ((cli)->username)
+#define cli_info(cli)          ((cli)->info)
+
+#define con_count(con)         ((con)->count)
+#define con_fd(con)            ((con)->fd)
+#define con_error(con)         ((con)->error)
+#define con_snomask(con)       ((con)->snomask)
+#define con_nextnick(con)      ((con)->nextnick)
+#define con_nexttarget(con)    ((con)->nexttarget)
+#define con_cookie(con)                ((con)->cookie)
+#define con_sendQ(con)         ((con)->sendQ)
+#define con_recvQ(con)         ((con)->recvQ)
+#define con_sendM(con)         ((con)->sendM)
+#define con_sendK(con)         ((con)->sendK)
+#define con_receiveM(con)      ((con)->receiveM)
+#define con_receiveK(con)      ((con)->receiveK)
+#define con_sendB(con)         ((con)->sendB)
+#define con_receiveB(con)      ((con)->receiveB)
+#define con_listener(con)      ((con)->listener)
+#define con_confs(con)         ((con)->confs)
+#define con_handler(con)       ((con)->handler)
+#define con_dns_reply(con)     ((con)->dns_reply)
+#define con_listing(con)       ((con)->listing)
+#define con_max_sendq(con)     ((con)->max_sendq)
+#define con_ping_freq(con)     ((con)->ping_freq)
+#define con_lastsq(con)                ((con)->lastsq)
+#define con_port(con)          ((con)->port)
+#define con_targets(con)       ((con)->targets)
+#define con_sock_ip(con)       ((con)->sock_ip)
+#define con_sockhost(con)      ((con)->sockhost)
+#define con_passwd(con)                ((con)->passwd)
+#define con_buffer(con)                ((con)->buffer)
 
 #define STAT_CONNECTING         0x001 /* connecting to another server */
 #define STAT_HANDSHAKE          0x002 /* pass - server sent */
@@ -152,38 +203,38 @@ struct Client {
 /*
  * status macros.
  */
-#define IsRegistered(x)         ((x)->status & (STAT_SERVER | STAT_USER))
-#define IsConnecting(x)         ((x)->status == STAT_CONNECTING)
-#define IsHandshake(x)          ((x)->status == STAT_HANDSHAKE)
-#define IsMe(x)                 ((x)->status == STAT_ME)
-#define IsUnknown(x)            ((x)->status & \
+#define IsRegistered(x)         (cli_status(x) & (STAT_SERVER | STAT_USER))
+#define IsConnecting(x)         (cli_status(x) == STAT_CONNECTING)
+#define IsHandshake(x)          (cli_status(x) == STAT_HANDSHAKE)
+#define IsMe(x)                 (cli_status(x) == STAT_ME)
+#define IsUnknown(x)            (cli_status(x) & \
         (STAT_UNKNOWN | STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER))
 
-#define IsServerPort(x)         ((x)->status == STAT_UNKNOWN_SERVER )
-#define IsUserPort(x)           ((x)->status == STAT_UNKNOWN_USER )
-#define IsClient(x)             ((x)->status & \
+#define IsServerPort(x)         (cli_status(x) == STAT_UNKNOWN_SERVER )
+#define IsUserPort(x)           (cli_status(x) == STAT_UNKNOWN_USER )
+#define IsClient(x)             (cli_status(x) & \
         (STAT_HANDSHAKE | STAT_ME | STAT_UNKNOWN |\
          STAT_UNKNOWN_USER | STAT_UNKNOWN_SERVER | STAT_SERVER | STAT_USER))
 
-#define IsTrusted(x)            ((x)->status & \
+#define IsTrusted(x)            (cli_status(x) & \
         (STAT_CONNECTING | STAT_HANDSHAKE | STAT_ME | STAT_SERVER))
 
-#define IsServer(x)             ((x)->status == STAT_SERVER)
-#define IsUser(x)               ((x)->status == STAT_USER)
+#define IsServer(x)             (cli_status(x) == STAT_SERVER)
+#define IsUser(x)               (cli_status(x) == STAT_USER)
 
 
-#define SetConnecting(x)        ((x)->status = STAT_CONNECTING)
-#define SetHandshake(x)         ((x)->status = STAT_HANDSHAKE)
-#define SetServer(x)            ((x)->status = STAT_SERVER)
-#define SetMe(x)                ((x)->status = STAT_ME)
-#define SetUser(x)              ((x)->status = STAT_USER)
+#define SetConnecting(x)        (cli_status(x) = STAT_CONNECTING)
+#define SetHandshake(x)         (cli_status(x) = STAT_HANDSHAKE)
+#define SetServer(x)            (cli_status(x) = STAT_SERVER)
+#define SetMe(x)                (cli_status(x) = STAT_ME)
+#define SetUser(x)              (cli_status(x) = STAT_USER)
 
-#define MyConnect(x)    ((x)->from == (x))
+#define MyConnect(x)    (cli_from(x) == (x))
 #define MyUser(x)       (MyConnect(x) && IsUser(x))
 #define MyOper(x)       (MyConnect(x) && IsOper(x))
-#define Protocol(x)     ((x)->serv->prot)
+#define Protocol(x)     ((cli_serv(x))->prot)
 
-#define PARSE_AS_SERVER(x) ((x)->status & \
+#define PARSE_AS_SERVER(x) (cli_status(x) & \
             (STAT_SERVER | STAT_CONNECTING | STAT_HANDSHAKE))
 
 /*
@@ -224,57 +275,57 @@ struct Client {
 /*
  * flags macros.
  */
-#define DoAccess(x)             ((x)->flags & FLAGS_CHKACCESS)
-#define IsAnOper(x)             ((x)->flags & (FLAGS_OPER|FLAGS_LOCOP))
-#define IsBlocked(x)            ((x)->flags & FLAGS_BLOCKED)
-#define IsBurst(x)              ((x)->flags & FLAGS_BURST)
-#define IsBurstAck(x)           ((x)->flags & FLAGS_BURST_ACK)
-#define IsBurstOrBurstAck(x)    ((x)->flags & (FLAGS_BURST|FLAGS_BURST_ACK))
-#define IsChannelService(x)     ((x)->flags & FLAGS_CHSERV)
-#define IsDead(x)               ((x)->flags & FLAGS_DEADSOCKET)
-#define IsDeaf(x)               ((x)->flags & FLAGS_DEAF)
-#define IsIPChecked(x)          ((x)->flags & FLAGS_IPCHECK)
-#define IsIdented(x)            ((x)->flags & FLAGS_GOTID)
-#define IsInvisible(x)          ((x)->flags & FLAGS_INVISIBLE)
-#define IsJunction(x)           ((x)->flags & FLAGS_JUNCTION)
-#define IsLocOp(x)              ((x)->flags & FLAGS_LOCOP)
-#define IsLocal(x)              ((x)->flags & FLAGS_LOCAL)
-#define IsOper(x)               ((x)->flags & FLAGS_OPER)
-#define IsUPing(x)              ((x)->flags & FLAGS_UPING)
-#define NoNewLine(x)            ((x)->flags & FLAGS_NONL)
-#define SendDebug(x)            ((x)->flags & FLAGS_DEBUG)
-#define SendServNotice(x)       ((x)->flags & FLAGS_SERVNOTICE)
-#define SendWallops(x)          ((x)->flags & FLAGS_WALLOP)
+#define DoAccess(x)             (cli_flags(x) & FLAGS_CHKACCESS)
+#define IsAnOper(x)             (cli_flags(x) & (FLAGS_OPER|FLAGS_LOCOP))
+#define IsBlocked(x)            (cli_flags(x) & FLAGS_BLOCKED)
+#define IsBurst(x)              (cli_flags(x) & FLAGS_BURST)
+#define IsBurstAck(x)           (cli_flags(x) & FLAGS_BURST_ACK)
+#define IsBurstOrBurstAck(x)    (cli_flags(x) & (FLAGS_BURST|FLAGS_BURST_ACK))
+#define IsChannelService(x)     (cli_flags(x) & FLAGS_CHSERV)
+#define IsDead(x)               (cli_flags(x) & FLAGS_DEADSOCKET)
+#define IsDeaf(x)               (cli_flags(x) & FLAGS_DEAF)
+#define IsIPChecked(x)          (cli_flags(x) & FLAGS_IPCHECK)
+#define IsIdented(x)            (cli_flags(x) & FLAGS_GOTID)
+#define IsInvisible(x)          (cli_flags(x) & FLAGS_INVISIBLE)
+#define IsJunction(x)           (cli_flags(x) & FLAGS_JUNCTION)
+#define IsLocOp(x)              (cli_flags(x) & FLAGS_LOCOP)
+#define IsLocal(x)              (cli_flags(x) & FLAGS_LOCAL)
+#define IsOper(x)               (cli_flags(x) & FLAGS_OPER)
+#define IsUPing(x)              (cli_flags(x) & FLAGS_UPING)
+#define NoNewLine(x)            (cli_flags(x) & FLAGS_NONL)
+#define SendDebug(x)            (cli_flags(x) & FLAGS_DEBUG)
+#define SendServNotice(x)       (cli_flags(x) & FLAGS_SERVNOTICE)
+#define SendWallops(x)          (cli_flags(x) & FLAGS_WALLOP)
 
 #define IsPrivileged(x)         (IsAnOper(x) || IsServer(x))
 
-#define SetAccess(x)            ((x)->flags |= FLAGS_CHKACCESS)
-#define SetBurst(x)             ((x)->flags |= FLAGS_BURST)
-#define SetBurstAck(x)          ((x)->flags |= FLAGS_BURST_ACK)
-#define SetChannelService(x)    ((x)->flags |= FLAGS_CHSERV)
-#define SetDeaf(x)              ((x)->flags |= FLAGS_DEAF)
-#define SetDebug(x)             ((x)->flags |= FLAGS_DEBUG)
-#define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
-#define SetIPChecked(x)         ((x)->flags |= FLAGS_IPCHECK)
-#define SetInvisible(x)         ((x)->flags |= FLAGS_INVISIBLE)
-#define SetJunction(x)          ((x)->flags |= FLAGS_JUNCTION)
-#define SetLocOp(x)             ((x)->flags |= FLAGS_LOCOP)
-#define SetOper(x)              ((x)->flags |= FLAGS_OPER)
-#define SetUPing(x)             ((x)->flags |= FLAGS_UPING)
-#define SetWallops(x)           ((x)->flags |= FLAGS_WALLOP)
-
-#define ClearAccess(x)          ((x)->flags &= ~FLAGS_CHKACCESS)
-#define ClearBurst(x)           ((x)->flags &= ~FLAGS_BURST)
-#define ClearBurstAck(x)        ((x)->flags &= ~FLAGS_BURST_ACK)
-#define ClearChannelService(x)  ((x)->flags &= ~FLAGS_CHSERV)
-#define ClearDeaf(x)            ((x)->flags &= ~FLAGS_DEAF)
-#define ClearDebug(x)           ((x)->flags &= ~FLAGS_DEBUG)
-#define ClearIPChecked(x)       ((x)->flags &= ~FLAGS_IPCHECK)
-#define ClearInvisible(x)       ((x)->flags &= ~FLAGS_INVISIBLE)
-#define ClearLocOp(x)           ((x)->flags &= ~FLAGS_LOCOP)
-#define ClearOper(x)            ((x)->flags &= ~FLAGS_OPER)
-#define ClearUPing(x)           ((x)->flags &= ~FLAGS_UPING)
-#define ClearWallops(x)         ((x)->flags &= ~FLAGS_WALLOP)
+#define SetAccess(x)            (cli_flags(x) |= FLAGS_CHKACCESS)
+#define SetBurst(x)             (cli_flags(x) |= FLAGS_BURST)
+#define SetBurstAck(x)          (cli_flags(x) |= FLAGS_BURST_ACK)
+#define SetChannelService(x)    (cli_flags(x) |= FLAGS_CHSERV)
+#define SetDeaf(x)              (cli_flags(x) |= FLAGS_DEAF)
+#define SetDebug(x)             (cli_flags(x) |= FLAGS_DEBUG)
+#define SetGotId(x)             (cli_flags(x) |= FLAGS_GOTID)
+#define SetIPChecked(x)         (cli_flags(x) |= FLAGS_IPCHECK)
+#define SetInvisible(x)         (cli_flags(x) |= FLAGS_INVISIBLE)
+#define SetJunction(x)          (cli_flags(x) |= FLAGS_JUNCTION)
+#define SetLocOp(x)             (cli_flags(x) |= FLAGS_LOCOP)
+#define SetOper(x)              (cli_flags(x) |= FLAGS_OPER)
+#define SetUPing(x)             (cli_flags(x) |= FLAGS_UPING)
+#define SetWallops(x)           (cli_flags(x) |= FLAGS_WALLOP)
+
+#define ClearAccess(x)          (cli_flags(x) &= ~FLAGS_CHKACCESS)
+#define ClearBurst(x)           (cli_flags(x) &= ~FLAGS_BURST)
+#define ClearBurstAck(x)        (cli_flags(x) &= ~FLAGS_BURST_ACK)
+#define ClearChannelService(x)  (cli_flags(x) &= ~FLAGS_CHSERV)
+#define ClearDeaf(x)            (cli_flags(x) &= ~FLAGS_DEAF)
+#define ClearDebug(x)           (cli_flags(x) &= ~FLAGS_DEBUG)
+#define ClearIPChecked(x)       (cli_flags(x) &= ~FLAGS_IPCHECK)
+#define ClearInvisible(x)       (cli_flags(x) &= ~FLAGS_INVISIBLE)
+#define ClearLocOp(x)           (cli_flags(x) &= ~FLAGS_LOCOP)
+#define ClearOper(x)            (cli_flags(x) &= ~FLAGS_OPER)
+#define ClearUPing(x)           (cli_flags(x) &= ~FLAGS_UPING)
+#define ClearWallops(x)         (cli_flags(x) &= ~FLAGS_WALLOP)
 
 /* server notice stuff */
 
index 46ca1081ed774acc6e9a51632fdae77b4518ee61..cb812c399a86616006c5699e9b834e32616fbd86 100644 (file)
@@ -20,6 +20,9 @@
  */
 #ifndef INCLUDED_numnicks_h
 #define INCLUDED_numnicks_h
+#ifndef INCLUDED_client_h
+#include "client.h"
+#endif
 #ifndef INCLUDED_sys_types_h
 #include <sys/types.h>
 #define INCLUDED_sys_types_h
 /*
  * Use this macro as follows: sprintf(buf, "%s%s ...", NumNick(cptr), ...);
  */
-#define NumNick(c) (c)->user->server->yxx, (c)->yxx
+#define NumNick(c) cli_yxx((cli_user(c))->server), cli_yxx(c)
 
 /*
  * Use this macro as follows: sprintf(buf, "%s ...", NumServ(cptr), ...);
  */
-#define NumServ(c) (c)->yxx
+#define NumServ(c) cli_yxx(c)
 
 /*
  * Use this macro as follows: sprintf(buf, "%s%s ...", NumServCap(cptr), ...);
  */
-#define NumServCap(c) (c)->yxx, (c)->serv->nn_capacity
+#define NumServCap(c) cli_yxx(c), (cli_serv(c))->nn_capacity
 
 /*
  * Structures
index 36c2aaab93fbf706092eeb3f171b106b05de35c7..88c45916def709996fb24332af3f40c166729b8a 100644 (file)
@@ -269,7 +269,7 @@ int ip_registry_check_local(unsigned int addr, time_t* next_target_out)
  */
 int ip_registry_check_remote(struct Client* cptr, int is_burst)
 {
-  struct IPRegistryEntry* entry = ip_registry_find(cptr->ip.s_addr);
+  struct IPRegistryEntry* entry = ip_registry_find((cli_ip(cptr)).s_addr);
 
   /*
    * Mark that we did add/update an IPregistry entry
@@ -277,7 +277,7 @@ int ip_registry_check_remote(struct Client* cptr, int is_burst)
   SetIPChecked(cptr);
   if (0 == entry) {
     entry = ip_registry_new_entry();
-    entry->addr = cptr->ip.s_addr;
+    entry->addr = (cli_ip(cptr)).s_addr;
     if (is_burst)
       entry->attempts = 0;
     ip_registry_add(entry);
@@ -336,14 +336,14 @@ void ip_registry_connect_succeeded(struct Client *cptr)
 {
   const char*             tr    = "";
   unsigned int free_targets     = STARTTARGETS;
-  struct IPRegistryEntry* entry = ip_registry_find(cptr->ip.s_addr);
+  struct IPRegistryEntry* entry = ip_registry_find((cli_ip(cptr)).s_addr);
 
   if (!entry) {
-    Debug((DEBUG_ERROR, "Missing registry entry for: %s", cptr->sock_ip));
+    Debug((DEBUG_ERROR, "Missing registry entry for: %s", con_sock_ip(cptr)));
     return;
   }
   if (entry->target) {
-    memcpy(cptr->targets, entry->target->targets, MAXTARGETS);
+    memcpy(con_targets(cptr), entry->target->targets, MAXTARGETS);
     free_targets = entry->target->count;
     tr = " tr";
   }
@@ -365,7 +365,7 @@ void ip_registry_connect_succeeded(struct Client *cptr)
  */
 void ip_registry_disconnect(struct Client *cptr)
 {
-  struct IPRegistryEntry* entry = ip_registry_find(cptr->ip.s_addr);
+  struct IPRegistryEntry* entry = ip_registry_find((cli_ip(cptr)).s_addr);
   if (0 == entry) {
     /*
      * trying to find an entry for a server causes this to happen,
@@ -397,7 +397,7 @@ void ip_registry_disconnect(struct Client *cptr)
     }
     assert(0 != entry->target);
 
-    memcpy(entry->target->targets, cptr->targets, MAXTARGETS);
+    memcpy(entry->target->targets, con_targets(cptr), MAXTARGETS);
     /*
      * This calculation can be pretty unfair towards large multi-user hosts, but
      * there is "nothing" we can do without also allowing spam bots to send more
@@ -411,22 +411,22 @@ void ip_registry_disconnect(struct Client *cptr)
      * ALL should get no free targets when reconnecting.  We'd need to store an entry
      * per client (instead of per IP number) to avoid this.
      */
-    if (cptr->nexttarget < CurrentTime) {
+    if (con_nexttarget(cptr) < CurrentTime) {
         /*
          * Number of free targets
          */
-      free_targets = (CurrentTime - cptr->nexttarget) / TARGET_DELAY + 1;
+      free_targets = (CurrentTime - con_nexttarget(cptr)) / TARGET_DELAY + 1;
     }
     else
       free_targets = 0;
     /*
      * Add bonus, this is pretty fuzzy, but it will help in some cases.
      */
-    if ((CurrentTime - cptr->firsttime) > 600)
+    if ((CurrentTime - cli_firsttime(cptr)) > 600)
       /*
        * Was longer then 10 minutes online?
        */
-      free_targets += (CurrentTime - cptr->firsttime - 600) / TARGET_DELAY;
+      free_targets += (CurrentTime - cli_firsttime(cptr) - 600) / TARGET_DELAY;
     /*
      * Finally, store smallest value for Judgement Day
      */
index 34d0fc2bbc76c4b9415f677aeabba994a3ed5eca..c787b88d1790dc8377dda7c4abe87b319bb3943a 100644 (file)
@@ -122,7 +122,7 @@ struct Membership* find_member_link(struct Channel* chptr, const struct Client*
    * and 99% are on 10 or less.
    */
   else {
-   m = cptr->user->channel;
+   m = (cli_user(cptr))->channel;
    while (m) {
      assert(m->user == cptr);
      if (m->channel == chptr)
@@ -180,33 +180,6 @@ static char *make_nick_user_ip(char *nick, char *name, struct in_addr ip)
   return ipbuf;
 }
 
-#if 0
-static int DoesOp(const char* modebuf)
-{
-  assert(0 != modebuf);
-  while (*modebuf) {
-    if (*modebuf == 'o' || *modebuf == 'v')
-      return 1;
-    ++modebuf;
-  }
-  return 0;
-}
-
-/*
- * This function should be removed when all servers are 2.10
- */
-static void sendmodeto_one(struct Client* cptr, const char* from,
-                           const char* name, const char* mode,
-                           const char* param, time_t creationtime)
-{
-  if (IsServer(cptr) && DoesOp(mode) && creationtime)
-    sendto_one(cptr, ":%s MODE %s %s %s " TIME_T_FMT, /* XXX DEAD */
-               from, name, mode, param, creationtime);
-  else
-    sendto_one(cptr, ":%s MODE %s %s %s", from, name, mode, param); /* XXX DEAD */
-}
-#endif /* 0 */
-
 /*
  * Subtract one user from channel i (and free channel
  * block, if channel became empty).
@@ -234,8 +207,8 @@ int sub1_from_channel(struct Channel* chptr)
     for (i = 0; i <= HighestFd; i++)
     {
       struct Client *acptr = 0;
-      if ((acptr = LocalClientArray[i]) && acptr->listing &&
-          acptr->listing->chptr == chptr)
+      if ((acptr = LocalClientArray[i]) && con_listing(acptr) &&
+          (con_listing(acptr))->chptr == chptr)
       {
         list_next_channels(acptr, 1);
         break;                  /* Only one client can list a channel */
@@ -382,9 +355,9 @@ int add_banid(struct Client *cptr, struct Channel *chptr, char *banid,
     assert(0 != ban->value.ban.banstr);
     strcpy(ban->value.ban.banstr, banid);
 
-    ban->value.ban.who = (char*) MyMalloc(strlen(cptr->name) + 1);
+    ban->value.ban.who = (char*) MyMalloc(strlen(cli_name(cptr)) + 1);
     assert(0 != ban->value.ban.who);
-    strcpy(ban->value.ban.who, cptr->name);
+    strcpy(ban->value.ban.who, cli_name(cptr));
 
     ban->value.ban.when = TStime();
     ban->flags = CHFL_BAN;      /* This bit is never used I think... */
@@ -497,12 +470,14 @@ static int is_banned(struct Client *cptr, struct Channel *chptr,
   if (member && IsBanValid(member))
     return IsBanned(member);
 
-  s = make_nick_user_host(cptr->name, cptr->user->username, cptr->user->host);
+  s = make_nick_user_host(cli_name(cptr), (cli_user(cptr))->username,
+                         (cli_user(cptr))->host);
 
   for (tmp = chptr->banlist; tmp; tmp = tmp->next) {
     if ((tmp->flags & CHFL_BAN_IPMASK)) {
       if (!ip_s)
-        ip_s = make_nick_user_ip(cptr->name, cptr->user->username, cptr->ip);
+        ip_s = make_nick_user_ip(cli_name(cptr), (cli_user(cptr))->username,
+                                cli_ip(cptr));
       if (match(tmp->value.ban.banstr, ip_s) == 0)
         break;
     }
@@ -535,7 +510,7 @@ void add_user_to_channel(struct Channel* chptr, struct Client* who,
   assert(0 != chptr);
   assert(0 != who);
 
-  if (who->user) {
+  if (cli_user(who)) {
    
     struct Membership* member = membershipFreeList;
     if (member)
@@ -556,14 +531,14 @@ void add_user_to_channel(struct Channel* chptr, struct Client* who,
     member->prev_member  = 0; 
     chptr->members       = member;
 
-    member->next_channel = who->user->channel;
+    member->next_channel = (cli_user(who))->channel;
     if (member->next_channel)
       member->next_channel->prev_channel = member;
     member->prev_channel = 0;
-    who->user->channel = member;
+    (cli_user(who))->channel = member;
 
     ++chptr->users;
-    ++who->user->joined;
+    ++((cli_user(who))->joined);
   }
 }
 
@@ -590,9 +565,9 @@ static int remove_member_from_channel(struct Membership* member)
   if (member->prev_channel)
     member->prev_channel->next_channel = member->next_channel;
   else
-    member->user->user->channel = member->next_channel;
+    (cli_user(member->user))->channel = member->next_channel;
 
-  --member->user->user->joined;
+  --(cli_user(member->user))->joined;
 
   member->next_member = membershipFreeList;
   membershipFreeList = member;
@@ -638,7 +613,7 @@ void remove_user_from_all_channels(struct Client* cptr)
   assert(0 != cptr);
   assert(0 != cptr->user);
 
-  while ((chan = cptr->user->channel))
+  while ((chan = (cli_user(cptr))->channel))
     remove_user_from_channel(cptr, chan->channel);
 }
 
@@ -741,7 +716,8 @@ const char* find_no_nickchange_channel(struct Client* cptr)
 {
   if (MyUser(cptr)) {
     struct Membership* member;
-    for (member = cptr->user->channel; member; member = member->next_channel) {
+    for (member = (cli_user(cptr))->channel; member;
+        member = member->next_channel) {
       if (!IsVoicedOrOpped(member) && is_banned(cptr, member->channel, member))
         return member->channel->chname;
     }
@@ -790,64 +766,6 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf,
   *mbuf = '\0';
 }
 
-#if 0
-static int send_mode_list(struct Client *cptr, char *chname,
-                          time_t creationtime, struct SLink *top,
-                          int mask, char flag)
-{
-  struct SLink* lp;
-  char*         cp;
-  char*         name;
-  int           count = 0;
-  int           send = 0;
-  int           sent = 0;
-
-  cp = modebuf + strlen(modebuf);
-  if (*parabuf)                 /* mode +l or +k xx */
-    count = 1;
-  for (lp = top; lp; lp = lp->next)
-  {
-    if (!(lp->flags & mask))
-      continue;
-    if (mask == CHFL_BAN)
-      name = lp->value.ban.banstr;
-    else
-      name = lp->value.cptr->name;
-    if (strlen(parabuf) + strlen(name) + 11 < MODEBUFLEN)
-    {
-      strcat(parabuf, " ");
-      strcat(parabuf, name);
-      count++;
-      *cp++ = flag;
-      *cp = '\0';
-    }
-    else if (*parabuf)
-      send = 1;
-    if (count == 6)
-      send = 1;
-    if (send)
-    {
-      /* cptr is always a server! So we send creationtimes */
-      sendmodeto_one(cptr, me.name, chname, modebuf, parabuf, creationtime);
-      sent = 1;
-      send = 0;
-      *parabuf = '\0';
-      cp = modebuf;
-      *cp++ = '+';
-      if (count != 6)
-      {
-        strcpy(parabuf, name);
-        *cp++ = flag;
-      }
-      count = 0;
-      *cp = '\0';
-    }
-  }
-  return sent;
-}
-
-#endif /* 0 */
-
 /*
  * send "cptr" a full list of the modes for channel chptr.
  */
@@ -1131,7 +1049,7 @@ int can_join(struct Client *sptr, struct Channel *chptr, char *key)
    * Now a user CAN escape anything if invited -- Isomer
    */
 
-  for (lp = sptr->user->invited; lp; lp = lp->next)
+  for (lp = (cli_user(sptr))->invited; lp; lp = lp->next)
     if (lp->value.chptr == chptr)
       return 0;
   
@@ -1238,9 +1156,9 @@ void add_invite(struct Client *cptr, struct Channel *chptr)
   /*
    * Delete last link in chain if the list is max length
    */
-  assert(list_length(cptr->user->invited) == cptr->user->invites);
-  if (cptr->user->invites>=MAXCHANNELSPERUSER)
-    del_invite(cptr, cptr->user->invited->value.chptr);
+  assert(list_length((cli_user(cptr))->invited) == (cli_user(cptr))->invites);
+  if ((cli_user(cptr))->invites>=MAXCHANNELSPERUSER)
+    del_invite(cptr, (cli_user(cptr))->invited->value.chptr);
   /*
    * Add client to channel invite list
    */
@@ -1251,12 +1169,12 @@ void add_invite(struct Client *cptr, struct Channel *chptr)
   /*
    * Add channel to the end of the client invite list
    */
-  for (tmp = &(cptr->user->invited); *tmp; tmp = &((*tmp)->next));
+  for (tmp = &((cli_user(cptr))->invited); *tmp; tmp = &((*tmp)->next));
   inv = make_link();
   inv->value.chptr = chptr;
   inv->next = NULL;
   (*tmp) = inv;
-  cptr->user->invites++;
+  (cli_user(cptr))->invites++;
 }
 
 /*
@@ -1272,11 +1190,11 @@ void del_invite(struct Client *cptr, struct Channel *chptr)
       *inv = tmp->next;
       free_link(tmp);
       tmp = 0;
-      cptr->user->invites--;
+      (cli_user(cptr))->invites--;
       break;
     }
 
-  for (inv = &(cptr->user->invited); (tmp = *inv); inv = &tmp->next)
+  for (inv = &((cli_user(cptr))->invited); (tmp = *inv); inv = &tmp->next)
     if (tmp->value.chptr == chptr)
     {
       *inv = tmp->next;
@@ -1289,14 +1207,14 @@ void del_invite(struct Client *cptr, struct Channel *chptr)
 /* List and skip all channels that are listen */
 void list_next_channels(struct Client *cptr, int nr)
 {
-  struct ListingArgs *args = cptr->listing;
+  struct ListingArgs *args = con_listing(cptr);
   struct Channel *chptr = args->chptr;
   chptr->mode.mode &= ~MODE_LISTED;
   while (is_listed(chptr) || --nr >= 0)
   {
     for (; chptr; chptr = chptr->next)
     {
-      if (!cptr->user || (SecretChannel(chptr) && !find_channel_member(cptr, chptr)))
+      if (!cli_user(cptr) || (SecretChannel(chptr) && !find_channel_member(cptr, chptr)))
         continue;
       if (chptr->users > args->min_users && chptr->users < args->max_users &&
           chptr->creationtime > args->min_time &&
@@ -1314,15 +1232,15 @@ void list_next_channels(struct Client *cptr, int nr)
     }
     if (!chptr)
     {
-      MyFree(cptr->listing);
-      cptr->listing = NULL;
+      MyFree(con_listing(cptr));
+      con_listing(cptr) = NULL;
       send_reply(cptr, RPL_LISTEND);
       break;
     }
   }
   if (chptr)
   {
-    cptr->listing->chptr = chptr;
+    (con_listing(cptr))->chptr = chptr;
     chptr->mode.mode |= MODE_LISTED;
   }
 }
@@ -1391,11 +1309,11 @@ void make_zombie(struct Membership* member, struct Client* who, struct Client* c
     remove_user_from_channel(who, chptr);
     return;
   }
-  if (who->from == cptr)        /* True on servers 1, 5 and 6 */
+  if (cli_from(who) == cptr)        /* True on servers 1, 5 and 6 */
   {
-    struct Client *acptr = IsServer(sptr) ? sptr : sptr->user->server;
-    for (; acptr != &me; acptr = acptr->serv->up)
-      if (acptr == who->user->server)   /* Case d) (server 5) */
+    struct Client *acptr = IsServer(sptr) ? sptr : (cli_user(sptr))->server;
+    for (; acptr != &me; acptr = (cli_serv(acptr))->up)
+      if (acptr == (cli_user(who))->server)   /* Case d) (server 5) */
       {
         remove_user_from_channel(who, chptr);
         return;
@@ -1502,7 +1420,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
   /* Ok, if we were given the OPMODE flag, hide the source if its a user */
   if (mbuf->mb_dest & MODEBUF_DEST_OPMODE && !IsServer(mbuf->mb_source))
-    app_source = mbuf->mb_source->user->server;
+    app_source = (cli_user(mbuf->mb_source))->server;
   else
     app_source = mbuf->mb_source;
 
@@ -1532,7 +1450,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
     }
 
     if (MB_TYPE(mbuf, i) & (MODE_CHANOP | MODE_VOICE)) {
-      tmp = strlen(MB_CLIENT(mbuf, i)->name);
+      tmp = strlen(cli_name(MB_CLIENT(mbuf, i)));
 
       if ((totalbuflen - IRCD_MAX(5, tmp)) <= 0) /* don't overflow buffer */
        MB_TYPE(mbuf, i) |= MODE_SAVE; /* save for later */
@@ -1592,7 +1510,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
       /* deal with clients... */
       if (MB_TYPE(mbuf, i) & (MODE_CHANOP | MODE_VOICE))
-       build_string(strptr, strptr_i, MB_CLIENT(mbuf, i)->name, 0, ' ');
+       build_string(strptr, strptr_i, cli_name(MB_CLIENT(mbuf, i)), 0, ' ');
 
       /* deal with strings... */
       else if (MB_TYPE(mbuf, i) & (MODE_KEY | MODE_BAN))
@@ -1610,13 +1528,14 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
     /* send the messages off to their destination */
     if (mbuf->mb_dest & MODEBUF_DEST_HACK2) {
       sendto_opmask_butone(0, SNO_HACK2, "HACK(2): %s MODE %s %s%s%s%s%s%s "
-                          "[%Tu]", app_source->name, mbuf->mb_channel->chname,
+                          "[%Tu]", cli_name(app_source),
+                          mbuf->mb_channel->chname,
                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
                           addbuf, remstr, addstr,
                           mbuf->mb_channel->creationtime);
       sendcmdto_serv_butone(&me, CMD_DESYNCH, mbuf->mb_connect,
                            ":HACK: %s MODE %s %s%s%s%s%s%s [%Tu]",
-                           app_source->name, mbuf->mb_channel->chname,
+                           cli_name(app_source), mbuf->mb_channel->chname,
                            rembuf_i ? "-" : "", rembuf,
                            addbuf_i ? "+" : "", addbuf, remstr, addstr,
                            mbuf->mb_channel->creationtime);
@@ -1624,14 +1543,15 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all)
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK3)
       sendto_opmask_butone(0, SNO_HACK3, "BOUNCE or HACK(3): %s MODE %s "
-                          "%s%s%s%s%s%s [%Tu]", app_source->name,
+                          "%s%s%s%s%s%s [%Tu]", cli_name(app_source),
                           mbuf->mb_channel->chname, rembuf_i ? "-" : "",
                           rembuf, addbuf_i ? "+" : "", addbuf, remstr, addstr,
                           mbuf->mb_channel->creationtime);
 
     if (mbuf->mb_dest & MODEBUF_DEST_HACK4)
       sendto_opmask_butone(0, SNO_HACK4, "HACK(4): %s MODE %s %s%s%s%s%s%s "
-                          "[%Tu]", app_source->name, mbuf->mb_channel->chname,
+                          "[%Tu]", cli_name(app_source),
+                          mbuf->mb_channel->chname,
                           rembuf_i ? "-" : "", rembuf, addbuf_i ? "+" : "",
                           addbuf, remstr, addstr,
                           mbuf->mb_channel->creationtime);
@@ -2436,7 +2356,8 @@ mode_process_clients(struct ParseState *state)
        (MyUser(state->sptr) && IsZombie(member))) {
       if (MyUser(state->sptr))
        send_reply(state->sptr, ERR_USERNOTINCHANNEL,
-                  state->cli_change[i].client->name, state->chptr->chname);
+                  cli_name(state->cli_change[i].client),
+                  state->chptr->chname);
       continue;
     }
 
@@ -2454,12 +2375,13 @@ mode_process_clients(struct ParseState *state)
        if (state->flags & MODE_PARSE_FORCE) /* it was forced */
          sendto_opmask_butone(0, SNO_HACK4, "Deop of +k user on %H by %s",
                               state->chptr,
-                              (IsServer(state->sptr) ? state->sptr->name :
-                               state->sptr->user->server->name));
+                              (IsServer(state->sptr) ? cli_name(state->sptr) :
+                               cli_name((cli_user(state->sptr))->server)));
 
        else if (MyUser(state->sptr) && state->flags & MODE_PARSE_SET) {
          send_reply(state->sptr, ERR_ISCHANSERVICE,
-                    state->cli_change[i].client->name, state->chptr->chname);
+                    cli_name(state->cli_change[i].client),
+                    state->chptr->chname);
          continue;
        }
       }
@@ -2470,7 +2392,8 @@ mode_process_clients(struct ParseState *state)
          IsOperOnLocalChannel(state->cli_change[i].client,
                               state->chptr->chname)) {
        send_reply(state->sptr, ERR_ISOPERLCHAN,
-                  state->cli_change[i].client->name, state->chptr->chname);
+                  cli_name(state->cli_change[i].client),
+                  state->chptr->chname);
        continue;
       }
 #endif
index 2f302161b7965dda4bb1b0b5137c214af66fdd12..cdfb19bf925c9af2d0073345746e23b07963f788 100644 (file)
@@ -150,8 +150,8 @@ unsigned int get_client_class(struct Client *acptr)
   struct ConnectionClass *cl;
   unsigned int retc = BAD_CLIENT_CLASS;
 
-  if (acptr && !IsMe(acptr) && (acptr->confs))
-    for (tmp = acptr->confs; tmp; tmp = tmp->next)
+  if (acptr && !IsMe(acptr) && (con_confs(acptr)))
+    for (tmp = con_confs(acptr); tmp; tmp = tmp->next)
     {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
         continue;
@@ -159,7 +159,7 @@ unsigned int get_client_class(struct Client *acptr)
         retc = ConClass(cl);
     }
 
-  Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, acptr->name));
+  Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, cli_name(acptr)));
 
   return (retc);
 }
@@ -171,7 +171,7 @@ unsigned int get_client_ping(struct Client *acptr)
   struct ConfItem *aconf;
   struct SLink *link;
 
-  link = acptr->confs;
+  link = con_confs(acptr);
 
   if (link) {
     while (link) {
@@ -186,11 +186,11 @@ unsigned int get_client_ping(struct Client *acptr)
   }
   else {
     ping = PINGFREQUENCY;
-    Debug((DEBUG_DEBUG, "No Attached Confs for: %s", acptr->name));
+    Debug((DEBUG_DEBUG, "No Attached Confs for: %s", cli_name(acptr)));
   }
   if (ping <= 0)
     ping = PINGFREQUENCY;
-  Debug((DEBUG_DEBUG, "Client %s Ping %d", acptr->name, ping));
+  Debug((DEBUG_DEBUG, "Client %s Ping %d", cli_name(acptr), ping));
   return (ping);
 }
 
@@ -262,19 +262,19 @@ unsigned int get_sendq(struct Client *cptr)
   assert(0 != cptr);
   assert(0 != cptr->local);
 
-  if (cptr->max_sendq)
-    return cptr->max_sendq;
+  if (con_max_sendq(cptr))
+    return con_max_sendq(cptr);
 
-  else if (cptr->confs) {
+  else if (con_confs(cptr)) {
     struct SLink*     tmp;
     struct ConnectionClass* cl;
 
-    for (tmp = cptr->confs; tmp; tmp = tmp->next) {
+    for (tmp = con_confs(cptr); tmp; tmp = tmp->next) {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
         continue;
       if (ConClass(cl) != BAD_CLIENT_CLASS) {
-        cptr->max_sendq = MaxSendq(cl);
-        return cptr->max_sendq;
+        con_max_sendq(cptr) = MaxSendq(cl);
+        return con_max_sendq(cptr);
       }
     }
   }
index c2042268c8a6ea5381729d44f821681fda89e785..b471766a232d8826470c909f2d57d77596047497 100644 (file)
@@ -44,7 +44,7 @@ int client_get_ping(const struct Client* acptr)
   struct ConfItem* aconf;
   struct SLink*    link;
 
-  for (link = acptr->confs; link; link = link->next) {
+  for (link = con_confs(acptr); link; link = link->next) {
     aconf = link->value.aconf;
     if (aconf->status & (CONF_CLIENT | CONF_SERVER)) {
       int tmp = get_conf_ping(aconf);
@@ -55,55 +55,6 @@ int client_get_ping(const struct Client* acptr)
   if (0 == ping)
     ping = PINGFREQUENCY;
 
-  Debug((DEBUG_DEBUG, "Client %s Ping %d", acptr->name, ping));
+  Debug((DEBUG_DEBUG, "Client %s Ping %d", cli_name(acptr), ping));
   return ping;
 }
-
-#if 0
-#define BAD_CONF_CLASS          ((unsigned int)-1)
-#define BAD_CLIENT_CLASS        ((unsigned int)-3)
-
-unsigned int get_client_class(struct Client* acptr)
-{
-  struct SLink *tmp;
-  struct ConnectionClass *cl;
-  unsigned int retc = BAD_CLIENT_CLASS;
-
-  if (acptr && !IsMe(acptr) && (acptr->confs))
-    for (tmp = acptr->confs; tmp; tmp = tmp->next)
-    {
-      if (!tmp->value.aconf || !(cl = tmp->value.aconf->confClass))
-        continue;
-      if (ConClass(cl) > retc || retc == BAD_CLIENT_CLASS)
-        retc = ConClass(cl);
-    }
-
-  Debug((DEBUG_DEBUG, "Returning Class %d For %s", retc, acptr->name));
-
-  return (retc);
-}
-
-unsigned int get_sendq(struct Client *cptr)
-{
-  assert(0 != cptr);
-  assert(0 != cptr->local);
-
-  if (cptr->max_sendq)
-    return cptr->max_sendq;
-
-  else if (cptr->confs) {
-    struct SLink*     tmp;
-    struct ConnectionClass* cl;
-
-    for (tmp = cptr->confs; tmp; tmp = tmp->next) {
-      if (!tmp->value.aconf || !(cl = tmp->value.aconf->confClass))
-        continue;
-      if (ConClass(cl) != BAD_CLIENT_CLASS) {
-        cptr->max_sendq = MaxSendq(cl);
-        return cptr->max_sendq;
-      }
-    }
-  }
-  return DEFAULTMAXSENDQLENGTH;
-}
-#endif
index aa27662a6908c3e78d6cc7dea7306788c8ebc766..d956ede0edd247d5a58ae21fdd63c654cfac0883 100644 (file)
@@ -180,7 +180,7 @@ static int crule_connected(int numargs, void *crulearg[])
   {
     if (!IsServer(acptr) && !IsMe(acptr))
       continue;
-    if (match((char *)crulearg[0], acptr->name))
+    if (match((char *)crulearg[0], cli_name(acptr)))
       continue;
     return (1);
   }
@@ -204,7 +204,7 @@ static int crule_directcon(int numargs, void *crulearg[])
   {
     if (!(acptr = LocalClientArray[i]) || !IsServer(acptr))
       continue;
-    if (match((char *)crulearg[0], acptr->name))
+    if (match((char *)crulearg[0], cli_name(acptr)))
       continue;
     return (1);
   }
@@ -227,9 +227,10 @@ static int crule_via(int numargs, void *crulearg[])
   {
     if (!IsServer(acptr) && !IsMe(acptr))
       continue;
-    if (match((char *)crulearg[1], acptr->name))
+    if (match((char *)crulearg[1], cli_name(acptr)))
       continue;
-    if (match((char *)crulearg[0], (LocalClientArray[acptr->from->fd])->name))
+    if (match((char *)crulearg[0],
+             cli_name(LocalClientArray[(cli_from(acptr))->fd])))
       continue;
     return (1);
   }
index 7cd6655dcfe53e787dc5f752531b7238ae6003c7..98cfb27b8e984243ad4f0f43b70f290df0454384 100644 (file)
@@ -165,16 +165,16 @@ do_gline(struct Client *cptr, struct Client *sptr, struct Gline *gline)
      * get the users!
      */
     if ((acptr = LocalClientArray[fd])) {
-      if (!acptr->user)
+      if (!cli_user(acptr))
        continue;
        
       if (acptr->user->username && 
-          match (gline->gl_user, acptr->user->username) != 0)
+          match (gline->gl_user, (cli_user(acptr))->username) != 0)
                continue;
           
       if (GlineIsIpMask(gline)) {
-        Debug((DEBUG_DEBUG,"IP gline: %08x %08x/%i",cptr->ip.s_addr,gline->ipnum.s_addr,gline->bits));
-        if ((acptr->ip.s_addr & NETMASK(gline->bits)) != gline->ipnum.s_addr)
+        Debug((DEBUG_DEBUG,"IP gline: %08x %08x/%i",(cli_ip(cptr)).s_addr,gline->ipnum.s_addr,gline->bits));
+        if (((cli_ip(acptr)).s_addr & NETMASK(gline->bits)) != gline->ipnum.s_addr)
           continue;
       }
       else {
@@ -257,8 +257,8 @@ gline_add(struct Client *cptr, struct Client *sptr, char *userhost,
 
   /* Inform ops... */
   sendto_opmask_butone(0, SNO_GLINE, "%s adding %s %s for %s, expiring at "
-                      "%Tu: %s",
-                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      "%Tu: %s", IsServer(sptr) ? cli_name(sptr) :
+                      cli_name((cli_user(sptr))->server),
                       flags & GLINE_LOCAL ? "local" : "global",
                       flags & GLINE_BADCHAN ? "BADCHAN" : "GLINE", userhost,
                       expire + TSoffset, reason);
@@ -310,8 +310,8 @@ gline_activate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
 
   /* Inform ops and log it */
   sendto_opmask_butone(0, SNO_GLINE, "%s activating global %s for %s%s%s, "
-                      "expiring at %Tu: %s",
-                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      "expiring at %Tu: %s", IsServer(sptr) ? cli_name(sptr) :
+                      cli_name((cli_user(sptr))->server),
                       GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
                       gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
                       GlineIsBadChan(gline) ? "" : gline->gl_host,
@@ -366,8 +366,8 @@ gline_deactivate(struct Client *cptr, struct Client *sptr, struct Gline *gline,
 
   /* Inform ops and log it */
   sendto_opmask_butone(0, SNO_GLINE, "%s %s %s for %s%s%s, expiring at %Tu: "
-                      "%s",
-                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      "%s", IsServer(sptr) ? cli_name(sptr) :
+                      cli_name((cli_user(sptr))->server),
                       msg, GlineIsBadChan(gline) ? "BADCHAN" : "GLINE",
                       gline->gl_user, GlineIsBadChan(gline) ? "" : "@",
                       GlineIsBadChan(gline) ? "" : gline->gl_host,
@@ -467,16 +467,16 @@ gline_lookup(struct Client *cptr, unsigned int flags)
             (flags & GLINE_LASTMOD && !gline->gl_lastmod))
       continue;
      
-    if (match(gline->gl_user, cptr->user->username) != 0)
+    if (match(gline->gl_user, (cli_user(cptr))->username) != 0)
       continue;
         
     if (GlineIsIpMask(gline)) {
-      Debug((DEBUG_DEBUG,"IP gline: %08x %08x/%i",cptr->ip.s_addr,gline->ipnum.s_addr,gline->bits));
-      if ((cptr->ip.s_addr & NETMASK(gline->bits)) != gline->ipnum.s_addr)
+      Debug((DEBUG_DEBUG,"IP gline: %08x %08x/%i",(cli_ip(cptr)).s_addr,gline->ipnum.s_addr,gline->bits));
+      if (((cli_ip(cptr)).s_addr & NETMASK(gline->bits)) != gline->ipnum.s_addr)
         continue;
     }
     else {
-      if (match(gline->gl_host, cptr->user->host) != 0) 
+      if (match(gline->gl_host, (cli_user(cptr))->host) != 0) 
         continue;
     }
     return gline;
index 100c9600b853bdef6b0929dbe80f7886c9a423bb..c3b58b5a973ef571f468ef73c01d8db2d842873c 100644 (file)
@@ -281,9 +281,9 @@ static HASHREGS strhash(const char *n)
  */
 int hAddClient(struct Client *cptr)
 {
-  HASHREGS hashv = strhash(cptr->name);
+  HASHREGS hashv = strhash(cli_name(cptr));
 
-  cptr->hnext = clientTable[hashv];
+  cli_hnext(cptr) = clientTable[hashv];
   clientTable[hashv] = cptr;
 
   return 0;
@@ -312,22 +312,22 @@ int hAddChannel(struct Channel *chptr)
  */
 int hRemClient(struct Client *cptr)
 {
-  HASHREGS hashv = strhash(cptr->name);
+  HASHREGS hashv = strhash(cli_name(cptr));
   struct Client *tmp = clientTable[hashv];
 
   if (tmp == cptr) {
-    clientTable[hashv] = cptr->hnext;
-    cptr->hnext = cptr;
+    clientTable[hashv] = cli_hnext(cptr);
+    cli_hnext(cptr) = cptr;
     return 0;
   }
 
   while (tmp) {
-    if (tmp->hnext == cptr) {
-      tmp->hnext = tmp->hnext->hnext;
-      cptr->hnext = cptr;
+    if (cli_hnext(tmp) == cptr) {
+      cli_hnext(tmp) = cli_hnext(cli_hnext(tmp));
+      cli_hnext(cptr) = cptr;
       return 0;
     }
-    tmp = tmp->hnext;
+    tmp = cli_hnext(tmp);
   }
   return -1;
 }
@@ -400,12 +400,12 @@ struct Client* hSeekClient(const char *name, int TMask)
   struct Client *cptr = clientTable[hashv];
 
   if (cptr) {
-    if (0 == (cptr->status & TMask) || 0 != ircd_strcmp(name, cptr->name)) {
+    if (0 == (cli_status(cptr) & TMask) || 0 != ircd_strcmp(name, cli_name(cptr))) {
       struct Client* prev;
       while (prev = cptr, cptr = cptr->hnext) {
-        if ((cptr->status & TMask) && (0 == ircd_strcmp(name, cptr->name))) {
-          prev->hnext = cptr->hnext;
-          cptr->hnext = clientTable[hashv];
+        if ((cli_status(cptr) & TMask) && (0 == ircd_strcmp(name, cli_name(cptr)))) {
+          cli_hnext(prev) = cli_hnext(cptr);
+          cli_hnext(cptr) = clientTable[hashv];
           clientTable[hashv] = cptr;
           break;
         }
@@ -463,7 +463,7 @@ int m_hash(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     if ((cl = clientTable[i])) {
       int len = 0;
       ++buckets;
-      for ( ; cl; cl = cl->hnext)
+      for ( ; cl; cl = cli_hnext(cl))
         ++len; 
       if (len > max_chain)
         max_chain = len;