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

Here's some more conversions.  This gets everything but the m_*.c stuff.
Even though it's currently unstable, I'd appreciate testing to catch
anything I might have missed so far...

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

29 files changed:
ChangeLog
include/client.h
ircd/IPcheck.c
ircd/channel.c
ircd/class.c
ircd/client.c
ircd/gline.c
ircd/ircd.c
ircd/ircd_relay.c
ircd/ircd_reply.c
ircd/ircd_snprintf.c
ircd/jupe.c
ircd/list.c
ircd/listener.c
ircd/motd.c
ircd/numnicks.c
ircd/packet.c
ircd/parse.c
ircd/s_auth.c
ircd/s_bsd.c
ircd/s_conf.c
ircd/s_debug.c
ircd/s_misc.c
ircd/s_numeric.c
ircd/s_serv.c
ircd/s_user.c
ircd/send.c
ircd/whocmds.c
ircd/whowas.c

index fe6a8ff00cfcfb614fa0702c20bd092437f3da40..79e9a38544c1fc2e438031dbc10a2995b9cdb932 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,66 @@
+2000-12-12  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * ircd/whowas.c: use new struct Client accessor macros
+
+       * ircd/whocmds.c: use new struct Client accessor macros
+
+       * ircd/send.c: use new struct Client accessor macros
+
+       * ircd/s_user.c: use new struct Client accessor macros; removed
+       some dead code
+
+       * ircd/s_serv.c: use new struct Client accessor macros; removed
+       some dead code
+
+       * ircd/s_numeric.c: use new struct Client accessor macros
+
+       * ircd/s_misc.c: use new struct Client accessor macros
+
+       * ircd/s_debug.c: use new struct Client accessor macros
+
+       * ircd/s_conf.c: use new struct Client accessor macros
+
+       * ircd/s_bsd.c: use new struct Client accessor macros
+
+       * ircd/s_auth.c: use new struct Client accessor macros
+
+       * ircd/parse.c: use new struct Client accessor macros
+
+       * ircd/packet.c: use new struct Client accessor macros
+
+       * ircd/numnicks.c: use new struct Client accessor macros
+
+       * ircd/motd.c: use new struct Client accessor macros
+
+       * ircd/listener.c: use new struct Client accessor macros
+
+       * ircd/list.c: use new struct Client accessor macros
+
+       * ircd/jupe.c: use new struct Client accessor macros
+
+       * ircd/ircd_snprintf.c: use new struct Client accessor macros
+
+       * ircd/ircd_reply.c: use new struct Client accessor macros
+
+       * ircd/ircd_relay.c: use new struct Client accessor macros
+
+       * ircd/ircd.c: use new struct Client accessor macros
+
+       * ircd/gline.c: catch some instances of me.<stuff> I missed
+       previously
+
+       * ircd/client.c: use cli_ instead of con_
+
+       * ircd/class.c: use cli_ instead of con_
+
+       * ircd/channel.c: use cli_ instead of con_
+
+       * ircd/IPcheck.c: use cli_ instead of con_; catch some instances
+       of me.<stuff> I missed previously
+
+       * include/client.h: use cli_ instead of con_...seemed like a good
+       idea at the time *shrug*
+
 2000-12-11  Kevin L. Mitchell  <klmitch@mit.edu>
 
        * ircd/hash.c: use struct Client accessor macros
index 327bb6a5336386a30daa10cc9aa5476fbb56fce0..af04046b7c15124f02583783682374734c71d90f 100644 (file)
@@ -161,35 +161,35 @@ struct Client {
 #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 cli_count(cli)         ((cli)->count)
+#define cli_fd(cli)            ((cli)->fd)
+#define cli_error(cli)         ((cli)->error)
+#define cli_snomask(cli)       ((cli)->snomask)
+#define cli_nextnick(cli)      ((cli)->nextnick)
+#define cli_nexttarget(cli)    ((cli)->nexttarget)
+#define cli_cookie(cli)                ((cli)->cookie)
+#define cli_sendQ(cli)         ((cli)->sendQ)
+#define cli_recvQ(cli)         ((cli)->recvQ)
+#define cli_sendM(cli)         ((cli)->sendM)
+#define cli_sendK(cli)         ((cli)->sendK)
+#define cli_receiveM(cli)      ((cli)->receiveM)
+#define cli_receiveK(cli)      ((cli)->receiveK)
+#define cli_sendB(cli)         ((cli)->sendB)
+#define cli_receiveB(cli)      ((cli)->receiveB)
+#define cli_listener(cli)      ((cli)->listener)
+#define cli_confs(cli)         ((cli)->confs)
+#define cli_handler(cli)       ((cli)->handler)
+#define cli_dns_reply(cli)     ((cli)->dns_reply)
+#define cli_listing(cli)       ((cli)->listing)
+#define cli_max_sendq(cli)     ((cli)->max_sendq)
+#define cli_ping_freq(cli)     ((cli)->ping_freq)
+#define cli_lastsq(cli)                ((cli)->lastsq)
+#define cli_port(cli)          ((cli)->port)
+#define cli_targets(cli)       ((cli)->targets)
+#define cli_sock_ip(cli)       ((cli)->sock_ip)
+#define cli_sockhost(cli)      ((cli)->sockhost)
+#define cli_passwd(cli)                ((cli)->passwd)
+#define cli_buffer(cli)                ((cli)->buffer)
 
 #define STAT_CONNECTING         0x001 /* connecting to another server */
 #define STAT_HANDSHAKE          0x002 /* pass - server sent */
index 88c45916def709996fb24332af3f40c166729b8a..439d60e51fe151cac49c21a1c5929f83a3d620c7 100644 (file)
@@ -242,7 +242,7 @@ int ip_registry_check_local(unsigned int addr, time_t* next_target_out)
     if (next_target_out)
       *next_target_out = CurrentTime - (TARGET_DELAY * free_targets - 1);
   }
-  else if ((CurrentTime - me.since) > IPCHECK_CLONE_DELAY) {
+  else if ((CurrentTime - cli_since(&me)) > IPCHECK_CLONE_DELAY) {
     /* 
      * Don't refuse connection when we just rebooted the server
      */
@@ -339,11 +339,11 @@ void ip_registry_connect_succeeded(struct Client *cptr)
   struct IPRegistryEntry* entry = ip_registry_find((cli_ip(cptr)).s_addr);
 
   if (!entry) {
-    Debug((DEBUG_ERROR, "Missing registry entry for: %s", con_sock_ip(cptr)));
+    Debug((DEBUG_ERROR, "Missing registry entry for: %s", cli_sock_ip(cptr)));
     return;
   }
   if (entry->target) {
-    memcpy(con_targets(cptr), entry->target->targets, MAXTARGETS);
+    memcpy(cli_targets(cptr), entry->target->targets, MAXTARGETS);
     free_targets = entry->target->count;
     tr = " tr";
   }
@@ -397,7 +397,7 @@ void ip_registry_disconnect(struct Client *cptr)
     }
     assert(0 != entry->target);
 
-    memcpy(entry->target->targets, con_targets(cptr), MAXTARGETS);
+    memcpy(entry->target->targets, cli_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,11 +411,11 @@ 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 (con_nexttarget(cptr) < CurrentTime) {
+    if (cli_nexttarget(cptr) < CurrentTime) {
         /*
          * Number of free targets
          */
-      free_targets = (CurrentTime - con_nexttarget(cptr)) / TARGET_DELAY + 1;
+      free_targets = (CurrentTime - cli_nexttarget(cptr)) / TARGET_DELAY + 1;
     }
     else
       free_targets = 0;
index c787b88d1790dc8377dda7c4abe87b319bb3943a..bbedf15202793ed4787dfda1cf54132d62f9544f 100644 (file)
@@ -207,8 +207,8 @@ int sub1_from_channel(struct Channel* chptr)
     for (i = 0; i <= HighestFd; i++)
     {
       struct Client *acptr = 0;
-      if ((acptr = LocalClientArray[i]) && con_listing(acptr) &&
-          (con_listing(acptr))->chptr == chptr)
+      if ((acptr = LocalClientArray[i]) && cli_listing(acptr) &&
+          (cli_listing(acptr))->chptr == chptr)
       {
         list_next_channels(acptr, 1);
         break;                  /* Only one client can list a channel */
@@ -1207,7 +1207,7 @@ 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 = con_listing(cptr);
+  struct ListingArgs *args = cli_listing(cptr);
   struct Channel *chptr = args->chptr;
   chptr->mode.mode &= ~MODE_LISTED;
   while (is_listed(chptr) || --nr >= 0)
@@ -1232,15 +1232,15 @@ void list_next_channels(struct Client *cptr, int nr)
     }
     if (!chptr)
     {
-      MyFree(con_listing(cptr));
-      con_listing(cptr) = NULL;
+      MyFree(cli_listing(cptr));
+      cli_listing(cptr) = NULL;
       send_reply(cptr, RPL_LISTEND);
       break;
     }
   }
   if (chptr)
   {
-    (con_listing(cptr))->chptr = chptr;
+    (cli_listing(cptr))->chptr = chptr;
     chptr->mode.mode |= MODE_LISTED;
   }
 }
index cdfb19bf925c9af2d0073345746e23b07963f788..32c1febffef804a3abcfc52b78dbfc7bb0d44fad 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) && (con_confs(acptr)))
-    for (tmp = con_confs(acptr); tmp; tmp = tmp->next)
+  if (acptr && !IsMe(acptr) && (cli_confs(acptr)))
+    for (tmp = cli_confs(acptr); tmp; tmp = tmp->next)
     {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
         continue;
@@ -171,7 +171,7 @@ unsigned int get_client_ping(struct Client *acptr)
   struct ConfItem *aconf;
   struct SLink *link;
 
-  link = con_confs(acptr);
+  link = cli_confs(acptr);
 
   if (link) {
     while (link) {
@@ -262,19 +262,19 @@ unsigned int get_sendq(struct Client *cptr)
   assert(0 != cptr);
   assert(0 != cptr->local);
 
-  if (con_max_sendq(cptr))
-    return con_max_sendq(cptr);
+  if (cli_max_sendq(cptr))
+    return cli_max_sendq(cptr);
 
-  else if (con_confs(cptr)) {
+  else if (cli_confs(cptr)) {
     struct SLink*     tmp;
     struct ConnectionClass* cl;
 
-    for (tmp = con_confs(cptr); tmp; tmp = tmp->next) {
+    for (tmp = cli_confs(cptr); tmp; tmp = tmp->next) {
       if (!tmp->value.aconf || !(cl = tmp->value.aconf->conn_class))
         continue;
       if (ConClass(cl) != BAD_CLIENT_CLASS) {
-        con_max_sendq(cptr) = MaxSendq(cl);
-        return con_max_sendq(cptr);
+        cli_max_sendq(cptr) = MaxSendq(cl);
+        return cli_max_sendq(cptr);
       }
     }
   }
index b471766a232d8826470c909f2d57d77596047497..d9944ef0303d7e1418484411d3d13a6fab0c2c4c 100644 (file)
@@ -44,7 +44,7 @@ int client_get_ping(const struct Client* acptr)
   struct ConfItem* aconf;
   struct SLink*    link;
 
-  for (link = con_confs(acptr); link; link = link->next) {
+  for (link = cli_confs(acptr); link; link = link->next) {
     aconf = link->value.aconf;
     if (aconf->status & (CONF_CLIENT | CONF_SERVER)) {
       int tmp = get_conf_ping(aconf);
index 98cfb27b8e984243ad4f0f43b70f290df0454384..faa65476fb2b00c188c5ab91aaa0edfb33c1a5de 100644 (file)
@@ -565,7 +565,7 @@ gline_list(struct Client *sptr, char *userhost)
               GlineIsBadChan(gline) ? "" : "@",
               GlineIsBadChan(gline) ? "" : gline->gl_host,
               gline->gl_expire + TSoffset,
-              GlineIsLocal(gline) ? me.name : "*",
+              GlineIsLocal(gline) ? cli_name(&me) : "*",
               GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
   } else {
     for (gline = GlobalGlineList; gline; gline = sgline) {
@@ -576,7 +576,7 @@ gline_list(struct Client *sptr, char *userhost)
       else
        send_reply(sptr, RPL_GLIST, gline->gl_user, "@", gline->gl_host,
                   gline->gl_expire + TSoffset,
-                  GlineIsLocal(gline) ? me.name : "*",
+                  GlineIsLocal(gline) ? cli_name(&me) : "*",
                   GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
     }
 
@@ -588,7 +588,7 @@ gline_list(struct Client *sptr, char *userhost)
       else
        send_reply(sptr, RPL_GLIST, gline->gl_user, "", "",
                   gline->gl_expire + TSoffset,
-                  GlineIsLocal(gline) ? me.name : "*",
+                  GlineIsLocal(gline) ? cli_name(&me) : "*",
                   GlineIsActive(gline) ? '+' : '-', gline->gl_reason);
     }
   }
index 8e90c19c274e00f978237648c5fc5a7e650313ee..65a445d2b72a281627c7429324348c87c26357dc 100644 (file)
@@ -285,33 +285,33 @@ static time_t check_pings(void) {
 
     /* Remove dead clients. */
     if (IsDead(cptr)) {
-      exit_client(cptr, cptr, &me, cptr->info);
+      exit_client(cptr, cptr, &me, cli_info(cptr));
       continue;
     }
 
     max_ping = IsRegistered(cptr) ? client_get_ping(cptr) : CONNECTTIMEOUT;
    
     Debug((DEBUG_DEBUG, "check_pings(%s)=status:%s limit: %d current: %d",
-          cptr->name, (cptr->flags & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]", 
-          max_ping, (int)(CurrentTime - cptr->lasttime)));
+          cli_name(cptr), (cli_flags(cptr) & FLAGS_PINGSENT) ? "[Ping Sent]" : "[]", 
+          max_ping, (int)(CurrentTime - cli_lasttime(cptr))));
           
 
     /* Ok, the thing that will happen most frequently, is that someone will
      * have sent something recently.  Cover this first for speed.
      */
-    if (CurrentTime-cptr->lasttime < max_ping) {
-      expire = cptr->lasttime + max_ping;
+    if (CurrentTime-cli_lasttime(cptr) < max_ping) {
+      expire = cli_lasttime(cptr) + max_ping;
       if (expire < next_check) 
        next_check = expire;
       continue;
     }
 
     /* Quit the client after max_ping*2 - they should have answered by now */
-    if (CurrentTime-cptr->lasttime >= (max_ping*2) ) {
+    if (CurrentTime-cli_lasttime(cptr) >= (max_ping*2) ) {
       /* If it was a server, then tell ops about it. */
       if (IsServer(cptr) || IsConnecting(cptr) || IsHandshake(cptr))
        sendto_opmask_butone(0, SNO_OLDSNO,
-                            "No response from %s, closing link", cptr->name);
+                            "No response from %s, closing link", cli_name(cptr));
       exit_client_msg(cptr, cptr, &me, "Ping timeout");
       continue;
     }
@@ -325,7 +325,7 @@ static time_t check_pings(void) {
       /* Display message if they have sent a NICK and a USER but no
        * nospoof PONG.
        */
-      if (*cptr->name && cptr->user && *cptr->user->username) {
+      if (*(cli_name(cptr)) && cli_user(cptr) && *(cli_user(cptr))->username) {
        send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
                   ":Your client may not be compatible with this server.");
        send_reply(cptr, SND_EXPLICIT | ERR_BADPING,
@@ -336,22 +336,22 @@ static time_t check_pings(void) {
       continue;
     }
     
-    if (!(cptr->flags & FLAGS_PINGSENT)) {
+    if (!(cli_flags(cptr) & FLAGS_PINGSENT)) {
       /* If we havent PINGed the connection and we havent heard from it in a
        * while, PING it to make sure it is still alive.
        */
-      cptr->flags |= FLAGS_PINGSENT;
+      cli_flags(cptr) |= FLAGS_PINGSENT;
 
       /* If we're late in noticing don't hold it against them :) */
-      cptr->lasttime = CurrentTime - max_ping;
+      cli_lasttime(cptr) = CurrentTime - max_ping;
       
       if (IsUser(cptr))
-       sendrawto_one(cptr, MSG_PING " :%s", me.name);
+       sendrawto_one(cptr, MSG_PING " :%s", cli_name(&me));
       else
-       sendcmdto_one(&me, CMD_PING, cptr, ":%s", me.name);
+       sendcmdto_one(&me, CMD_PING, cptr, ":%s", cli_name(&me));
     }
     
-    expire = cptr->lasttime + max_ping * 2;
+    expire = cli_lasttime(cptr) + max_ping * 2;
     if (expire < next_check)
       next_check=expire;
   }
@@ -386,7 +386,7 @@ static void parse_command_line(int argc, char** argv) {
     case 't':  thisServer.bootopt |= BOOT_TTY;         break;
     case 'd':  dpath      = optarg;                    break;
     case 'f':  configfile = optarg;                    break;
-    case 'h':  ircd_strncpy(me.name, optarg, HOSTLEN); break;
+    case 'h':  ircd_strncpy(cli_name(&me), optarg, HOSTLEN); break;
     case 'v':  printf("ircd %s\n", version);           exit(0);
       
     case 'x':
@@ -612,7 +612,7 @@ int main(int argc, char **argv) {
 
   umask(077);                   /* better safe than sorry --SRB */
   memset(&me, 0, sizeof(me));
-  me.fd = -1;
+  cli_fd(&me) = -1;
 
   parse_command_line(argc, argv);
 
@@ -674,18 +674,18 @@ int main(int argc, char **argv) {
   CurrentTime = time(NULL);
 
   SetMe(&me);
-  me.from = &me;
+  cli_from(&me) = &me;
   make_server(&me);
 
-  me.serv->timestamp = TStime();  /* Abuse own link timestamp as start TS */
-  me.serv->prot      = atoi(MAJOR_PROTOCOL);
-  me.serv->up        = &me;
-  me.serv->down      = NULL;
-  me.handler         = SERVER_HANDLER;
+  cli_serv(&me)->timestamp = TStime();  /* Abuse own link timestamp as start TS */
+  cli_serv(&me)->prot      = atoi(MAJOR_PROTOCOL);
+  cli_serv(&me)->up        = &me;
+  cli_serv(&me)->down      = NULL;
+  cli_handler(&me)         = SERVER_HANDLER;
 
   SetYXXCapacity(&me, MAXCLIENTS);
 
-  me.lasttime = me.since = me.firsttime = CurrentTime;
+  cli_lasttime(&me) = cli_since(&me) = cli_firsttime(&me) = CurrentTime;
 
   hAddClient(&me);
 
index 7930420a9131aa7adcd64064d7d59f5d88253206..f0992194f8bd5eb70e99c83c5bd8c4aa7a96bd45 100644 (file)
@@ -73,7 +73,7 @@ void relay_channel_message(struct Client* sptr, const char* name, const char* te
       check_target_limit(sptr, chptr, chptr->chname, 0))
     return;
 
-  sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, sptr->from,
+  sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr),
                           SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
 }
 
@@ -96,7 +96,7 @@ void relay_channel_notice(struct Client* sptr, const char* name, const char* tex
       check_target_limit(sptr, chptr, chptr->chname, 0))
     return;  
 
-  sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, sptr->from,
+  sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
                           SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
 }
 
@@ -119,7 +119,7 @@ void server_relay_channel_message(struct Client* sptr, const char* name, const c
    * Servers may have channel services, need to check for it here
    */
   if (client_can_send_to_channel(sptr, chptr) || IsChannelService(sptr)) {
-    sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, sptr->from,
+    sendcmdto_channel_butone(sptr, CMD_PRIVATE, chptr, cli_from(sptr),
                             SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
   }
   else
@@ -140,7 +140,7 @@ void server_relay_channel_notice(struct Client* sptr, const char* name, const ch
    * Servers may have channel services, need to check for it here
    */
   if (client_can_send_to_channel(sptr, chptr) || IsChannelService(sptr)) {
-    sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, sptr->from,
+    sendcmdto_channel_butone(sptr, CMD_NOTICE, chptr, cli_from(sptr),
                             SKIP_DEAF | SKIP_BURST, "%H :%s", chptr, text);
   }
 }
@@ -177,7 +177,7 @@ void relay_directed_message(struct Client* sptr, char* name, char* server, const
     *host++ = '\0';
 
   if (!(acptr = FindUser(name)) || !MyUser(acptr) ||
-      (!EmptyString(host) && 0 != match(host, acptr->user->host))) {
+      (!EmptyString(host) && 0 != match(host, cli_user(acptr)->host))) {
     send_reply(sptr, ERR_NOSUCHNICK, name);
     return;
   }
@@ -219,7 +219,7 @@ void relay_directed_notice(struct Client* sptr, char* name, char* server, const
     *host++ = '\0';
 
   if (!(acptr = FindUser(name)) || !MyUser(acptr) ||
-      (!EmptyString(host) && 0 != match(host, acptr->user->host)))
+      (!EmptyString(host) && 0 != match(host, cli_user(acptr)->host)))
     return;
 
   *server = '@';
@@ -242,15 +242,15 @@ void relay_private_message(struct Client* sptr, const char* name, const char* te
     send_reply(sptr, ERR_NOSUCHNICK, name);
     return;
   }
-  if (check_target_limit(sptr, acptr, acptr->name, 0) ||
+  if (check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
       is_silenced(sptr, acptr))
     return;
 
   /*
    * send away message if user away
    */
-  if (acptr->user && acptr->user->away)
-    send_reply(sptr, RPL_AWAY, acptr->name, acptr->user->away);
+  if (cli_user(acptr) && cli_user(acptr)->away)
+    send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away);
   /*
    * deliver the message
    */
@@ -269,7 +269,7 @@ void relay_private_notice(struct Client* sptr, const char* name, const char* tex
 
   if (0 == (acptr = FindUser(name)))
     return;
-  if (check_target_limit(sptr, acptr, acptr->name, 0) ||
+  if (check_target_limit(sptr, acptr, cli_name(acptr), 0) ||
       is_silenced(sptr, acptr))
     return;
   /*
@@ -356,7 +356,7 @@ void relay_masked_message(struct Client* sptr, const char* mask, const char* tex
   }
 
   sendcmdto_match_butone(sptr, CMD_PRIVATE, s,
-                        IsServer(sptr->from) ? sptr->from : 0,
+                        IsServer(cli_from(sptr)) ? cli_from(sptr) : 0,
                         host_mask ? MATCH_HOST : MATCH_SERVER,
                         "%s :%s", mask, text);
 }
@@ -391,7 +391,7 @@ void relay_masked_notice(struct Client* sptr, const char* mask, const char* text
   }
 
   sendcmdto_match_butone(sptr, CMD_NOTICE, s,
-                        IsServer(sptr->from) ? sptr->from : 0,
+                        IsServer(cli_from(sptr)) ? cli_from(sptr) : 0,
                         host_mask ? MATCH_HOST : MATCH_SERVER,
                         "%s :%s", mask, text);
 }
@@ -409,7 +409,7 @@ void server_relay_masked_message(struct Client* sptr, const char* mask, const ch
     ++s;
   }
   sendcmdto_match_butone(sptr, CMD_PRIVATE, s,
-                        IsServer(sptr->from) ? sptr->from : 0,
+                        IsServer(cli_from(sptr)) ? cli_from(sptr) : 0,
                         host_mask ? MATCH_HOST : MATCH_SERVER,
                         "%s :%s", mask, text);
 }
@@ -427,7 +427,7 @@ void server_relay_masked_notice(struct Client* sptr, const char* mask, const cha
     ++s;
   }
   sendcmdto_match_butone(sptr, CMD_NOTICE, s,
-                        IsServer(sptr->from) ? sptr->from : 0,
+                        IsServer(cli_from(sptr)) ? cli_from(sptr) : 0,
                         host_mask ? MATCH_HOST : MATCH_SERVER,
                         "%s :%s", mask, text);
 }
index aa448881afae75fd142e74303a97ccbab6845c34..c8df3c4cacd25c826e1c88fb9eee4b8d9ace95bd 100644 (file)
@@ -51,7 +51,7 @@ int protocol_violation(struct Client* cptr, const char* pattern, ...)
   va_start(vd.vd_args, pattern);
 
   sendcmdto_flag_butone(&me, CMD_DESYNCH, NULL, FLAGS_DEBUG,
-                       ":Protocol Violation from %s: %v", cptr->name, &vd);
+                       ":Protocol Violation from %s: %v", cli_name(cptr), &vd);
 
   va_end(vd.vd_args);
   return 0;
@@ -86,7 +86,7 @@ int send_reply(struct Client *to, int reply, ...)
   assert(0 != vd.vd_format);
 
   /* build buffer */
-  mb = msgq_make(to->from, "%:#C %s %C %v", &me, num->str, to, &vd);
+  mb = msgq_make(cli_from(to), "%:#C %s %C %v", &me, num->str, to, &vd);
 
   va_end(vd.vd_args);
 
@@ -103,7 +103,7 @@ int send_admin_info(struct Client* sptr)
   const struct LocalConf* admin = conf_get_local();
   assert(0 != sptr);
 
-  send_reply(sptr, RPL_ADMINME,    me.name);
+  send_reply(sptr, RPL_ADMINME,    cli_name(&me));
   send_reply(sptr, RPL_ADMINLOC1,  admin->location1);
   send_reply(sptr, RPL_ADMINLOC2,  admin->location2);
   send_reply(sptr, RPL_ADMINEMAIL, admin->contact);
index 991de2a27e8c5eb6a6ea5d5b8896f30ef266fcda..7a85d6bb770388921e98691be8b743fe95043f13 100644 (file)
@@ -2012,19 +2012,19 @@ doprintf(struct Client *dest, struct BufData *buf_p, const char *fmt,
       /* &me is used if it's not a definite server */
       if (dest && (IsServer(dest) || IsMe(dest))) {
        if (IsServer(cptr) || IsMe(cptr))
-         str1 = cptr->yxx;
+         str1 = cli_yxx(cptr);
        else {
-         str1 = cptr->user->server->yxx;
-         str2 = cptr->yxx;
+         str1 = cli_yxx(cli_user(cptr)->server);
+         str2 = cli_yxx(cptr);
        }
        fld_s.flags &= ~(FLAG_ALT | FLAG_COLON);
       } else {
-       str1 = *cptr->name ? cptr->name : "*";
+       str1 = *cli_name(cptr) ? cli_name(cptr) : "*";
        if (!IsServer(cptr) && !IsMe(cptr) && fld_s.flags & FLAG_ALT) {
-         assert(0 != cptr->user);
-         assert(0 != *cptr->name);
-         str2 = cptr->user->username;
-         str3 = cptr->user->host;
+         assert(0 != cli_user(cptr));
+         assert(0 != *(cli_name(cptr)));
+         str2 = cli_user(cptr)->username;
+         str3 = cli_user(cptr)->host;
        } else
          fld_s.flags &= ~FLAG_ALT;
       }
index 27fc778b4e19765c039c8358c88ba87c26cc9205..8c0ecef622596e2512919fa81f0a9ed4437d9047 100644 (file)
@@ -120,8 +120,8 @@ jupe_add(struct Client *cptr, struct Client *sptr, char *server, char *reason,
 
   /* Inform ops and log it */
   sendto_opmask_butone(0, SNO_NETWORK, "%s adding %sJUPE 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 & JUPE_LOCAL ? "local " : "", server,
                       expire + TSoffset, reason);
 
@@ -166,7 +166,7 @@ jupe_activate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
   /* Inform ops and log it */
   sendto_opmask_butone(0, SNO_NETWORK, "%s activating JUPE for %s, expiring "
                       "at %Tu: %s",
-                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      IsServer(sptr) ? cli_name(sptr) : cli_name(cli_user(sptr)->server),
                       jupe->ju_server, jupe->ju_expire + TSoffset,
                       jupe->ju_reason);
 
@@ -209,7 +209,7 @@ jupe_deactivate(struct Client *cptr, struct Client *sptr, struct Jupe *jupe,
   /* Inform ops and log it */
   sendto_opmask_butone(0, SNO_NETWORK, "%s %s JUPE for %s, expiring at %Tu: "
                       "%s",
-                      IsServer(sptr) ? sptr->name : sptr->user->server->name,
+                      IsServer(sptr) ? cli_name(sptr) : cli_name(cli_user(sptr)->server),
                       JupeIsLocal(jupe) ? "removing local" : "deactivating",
                       jupe->ju_server, jupe->ju_expire + TSoffset,
                       jupe->ju_reason);
@@ -304,7 +304,7 @@ jupe_list(struct Client *sptr, char *server)
 
     /* send jupe information along */
     send_reply(sptr, RPL_JUPELIST, jupe->ju_server, jupe->ju_expire + TSoffset,
-              JupeIsLocal(jupe) ? me.name : "*",
+              JupeIsLocal(jupe) ? cli_name(&me) : "*",
               JupeIsActive(jupe) ? '+' : '-', jupe->ju_reason);
   } else {
     for (jupe = GlobalJupeList; jupe; jupe = sjupe) { /* go through jupes */
@@ -315,7 +315,7 @@ jupe_list(struct Client *sptr, char *server)
       else /* send jupe information along */
        send_reply(sptr, RPL_JUPELIST, jupe->ju_server,
                   jupe->ju_expire + TSoffset,
-                  JupeIsLocal(jupe) ? me.name : "*",
+                  JupeIsLocal(jupe) ? cli_name(&me) : "*",
                   JupeIsActive(jupe) ? '+' : '-', jupe->ju_reason);
     }
   }
index 0d6cc5035fef9f945e7222d601326764a21e3b1f..bf2ac5c38b267c5014cd1c13ea3c23526adb8c9a 100644 (file)
@@ -69,7 +69,7 @@ void init_list(void)
    */
   for (i = 0; i < MAXCONNECTIONS; ++i) {
     cptr = (struct Client*) MyMalloc(CLIENT_LOCAL_SIZE);
-    cptr->next = localClientFreeList;
+    cli_next(cptr) = localClientFreeList;
     localClientFreeList = cptr;
     ++localClientAllocCount;
   }
@@ -104,7 +104,7 @@ struct Client* make_client(struct Client *from, int status)
      * remote client
      */
     if ((cptr = remoteClientFreeList))
-      remoteClientFreeList = cptr->next;
+      remoteClientFreeList = cli_next(cptr);
     else {
       cptr = (struct Client*) MyMalloc(CLIENT_REMOTE_SIZE);
       ++remoteClientAllocCount;
@@ -115,14 +115,14 @@ struct Client* make_client(struct Client *from, int status)
      * structure being zeroed out
      */
     memset(cptr, 0, CLIENT_REMOTE_SIZE);        /* All variables are 0 by default */
-    cptr->from = from;
+    cli_from(cptr) = from;
   }
   else {
     /*
      * local client
      */
     if ((cptr = localClientFreeList))
-      localClientFreeList = cptr->next;
+      localClientFreeList = cli_next(cptr);
     else {
       cptr = (struct Client*) MyMalloc(CLIENT_LOCAL_SIZE);
       ++localClientAllocCount;
@@ -133,18 +133,18 @@ struct Client* make_client(struct Client *from, int status)
      * structure being zeroed out
      */
     memset(cptr, 0, CLIENT_LOCAL_SIZE);        /* All variables are 0 by default */
-    cptr->fd = -1;
-    cptr->local = 1;
-    cptr->since = cptr->lasttime = cptr->firsttime = CurrentTime;
-    cptr->lastnick = TStime();
-    cptr->nextnick = CurrentTime - NICK_DELAY;
-    cptr->nexttarget = CurrentTime - (TARGET_DELAY * (STARTTARGETS - 1));
-    cptr->handler = UNREGISTERED_HANDLER;
-    cptr->from = cptr;      /* 'from' of local client is self! */
+    cli_fd(cptr) = -1;
+    cli_local(cptr) = 1;
+    cli_since(cptr) = cli_lasttime(cptr) = cli_firsttime(cptr) = CurrentTime;
+    cli_lastnick(cptr) = TStime();
+    cli_nextnick(cptr) = CurrentTime - NICK_DELAY;
+    cli_nexttarget(cptr) = CurrentTime - (TARGET_DELAY * (STARTTARGETS - 1));
+    cli_handler(cptr) = UNREGISTERED_HANDLER;
+    cli_from(cptr) = cptr;      /* 'from' of local client is self! */
   }
-  cptr->status = status;
-  cptr->hnext = cptr;
-  strcpy(cptr->username, "unknown");
+  cli_status(cptr) = status;
+  cli_hnext(cptr) = cptr;
+  strcpy(cli_username(cptr), "unknown");
 
 #ifdef  DEBUGMODE
   if (from)
@@ -163,40 +163,40 @@ void free_client(struct Client* cptr)
   /*
    * forget to remove the client from the hash table?
    */
-  assert(cptr->hnext == cptr);
+  assert(cli_hnext(cptr) == cptr);
 
 #ifdef  DEBUGMODE
-  if (cptr->local)
+  if (cli_local(cptr))
     --cloc.inuse;
   else
     --crem.inuse;
 #endif
 
-  if (cptr->local) {
+  if (cli_local(cptr)) {
     /*
      * make sure we have cleaned up local resources
      */
-    if (cptr->dns_reply)
-      --cptr->dns_reply->ref_count;
-    if (-1 < cptr->fd) {
-      close(cptr->fd);
+    if (cli_dns_reply(cptr))
+      --(cli_dns_reply(cptr))->ref_count;
+    if (-1 < cli_fd(cptr)) {
+      close(cli_fd(cptr));
     }
-    MsgQClear(&cptr->sendQ);
-    DBufClear(&cptr->recvQ);
-    if (cptr->listener)
-      release_listener(cptr->listener);
-    cptr->next = localClientFreeList;
+    MsgQClear(&(cli_sendQ(cptr)));
+    DBufClear(&(cli_recvQ(cptr)));
+    if (cli_listener(cptr))
+      release_listener(cli_listener(cptr));
+    cli_next(cptr) = localClientFreeList;
     localClientFreeList = cptr;
   }    
   else {
-    cptr->next = remoteClientFreeList;
+    cli_next(cptr) = remoteClientFreeList;
     remoteClientFreeList = cptr;
   }
 }
 
 struct Server *make_server(struct Client *cptr)
 {
-  struct Server *serv = cptr->serv;
+  struct Server *serv = cli_serv(cptr);
 
   if (!serv)
   {
@@ -206,12 +206,12 @@ struct Server *make_server(struct Client *cptr)
 #ifdef  DEBUGMODE
     servs.inuse++;
 #endif
-    cptr->serv = serv;
-    cptr->serv->lag = 60000;
+    cli_serv(cptr) = serv;
+    cli_serv(cptr)->lag = 60000;
     *serv->by = '\0';
     DupString(serv->last_error_msg, "<>");      /* String must be non-empty */
   }
-  return cptr->serv;
+  return cli_serv(cptr);
 }
 
 /*
@@ -220,35 +220,35 @@ struct Server *make_server(struct Client *cptr)
  */
 void remove_client_from_list(struct Client *cptr)
 {
-  if (cptr->prev)
-    cptr->prev->next = cptr->next;
+  if (cli_prev(cptr))
+    cli_next(cli_prev(cptr)) = cli_next(cptr);
   else {
-    GlobalClientList = cptr->next;
-    GlobalClientList->prev = 0;
+    GlobalClientList = cli_next(cptr);
+    cli_prev(GlobalClientList) = 0;
   }
-  if (cptr->next)
-    cptr->next->prev = cptr->prev;
+  if (cli_next(cptr))
+    cli_prev(cli_next(cptr)) = cli_prev(cptr);
 
-  cptr->next = cptr->prev = 0;
+  cli_next(cptr) = cli_prev(cptr) = 0;
 
-  if (IsUser(cptr) && cptr->user) {
+  if (IsUser(cptr) && cli_user(cptr)) {
     add_history(cptr, 0);
     off_history(cptr);
   }
-  if (cptr->user) {
-    free_user(cptr->user);
-    cptr->user = 0;
+  if (cli_user(cptr)) {
+    free_user(cli_user(cptr));
+    cli_user(cptr) = 0;
   }
 
-  if (cptr->serv) {
-    if (cptr->serv->user) {
-      free_user(cptr->serv->user);
-      cptr->serv->user = 0;
+  if (cli_serv(cptr)) {
+    if (cli_serv(cptr)->user) {
+      free_user(cli_serv(cptr)->user);
+      cli_serv(cptr)->user = 0;
     }
-    if (cptr->serv->client_list)
-      MyFree(cptr->serv->client_list);
-    MyFree(cptr->serv->last_error_msg);
-    MyFree(cptr->serv);
+    if (cli_serv(cptr)->client_list)
+      MyFree(cli_serv(cptr)->client_list);
+    MyFree(cli_serv(cptr)->last_error_msg);
+    MyFree(cli_serv(cptr));
 #ifdef  DEBUGMODE
     --servs.inuse;
 #endif
@@ -269,11 +269,11 @@ void add_client_to_list(struct Client *cptr)
    * this should mean the "me" is the bottom most item in the list.
    * XXX - don't always count on the above, things change
    */
-  cptr->prev = 0;
-  cptr->next = GlobalClientList;
+  cli_prev(cptr) = 0;
+  cli_next(cptr) = GlobalClientList;
   GlobalClientList = cptr;
-  if (cptr->next)
-    cptr->next->prev = cptr;
+  if (cli_next(cptr))
+    cli_prev(cli_next(cptr)) = cptr;
 }
 
 /*
index 1123b5e9d77474119d30dd573fec987f792389c0..a36d755fead990b8c6d201395bd5af401a935e15 100644 (file)
@@ -84,7 +84,7 @@ const char* get_listener_name(const struct Listener* listener)
 {
   static char buf[HOSTLEN + PORTNAMELEN + 4];
   assert(0 != listener);
-  sprintf_irc(buf, "%s:%u", me.name, listener->port);
+  sprintf_irc(buf, "%s:%u", cli_name(&me), listener->port);
   return buf;
 }
 
index 9a027e0750609d239f852d028c9b13e17abe7493..acf1cecddc109b7666e641cfb03092b57451a100 100644 (file)
@@ -210,7 +210,7 @@ motd_lookup(struct Client *cptr)
     if (ptr->type == MOTD_CLASS && ptr->id.class == class)
       return ptr;
     else if (ptr->type == MOTD_HOSTMASK &&
-            !match(ptr->id.hostmask, cptr->sockhost))
+            !match(ptr->id.hostmask, cli_sockhost(cptr)))
       return ptr;
   }
 
@@ -229,7 +229,7 @@ motd_forward(struct Client *cptr, struct MotdCache *cache)
     return send_reply(cptr, ERR_NOMOTD);
 
   /* send the motd */
-  send_reply(cptr, RPL_MOTDSTART, me.name);
+  send_reply(cptr, RPL_MOTDSTART, cli_name(&me));
   send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":- %d-%d-%d %d:%02d",
             cache->modtime.tm_year + 1900, cache->modtime.tm_mon + 1,
             cache->modtime.tm_mday, cache->modtime.tm_hour,
@@ -259,7 +259,7 @@ motd_signon(struct Client* cptr)
   cache = motd_cache(motd_lookup(cptr));
 
 #ifdef NODEFAULTMOTD
-  send_reply(cptr, RPL_MOTDSTART, me.name);
+  send_reply(cptr, RPL_MOTDSTART, cli_name(&me));
   send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":\002Type /MOTD to read the AUP "
             "before continuing using this service.\002");
   send_reply(cptr, SND_EXPLICIT | RPL_MOTD, ":The message of the day was last "
index 93053f46738af1ba20777c6c19e7a360311915c9..921206c18de4dfa486a55a325977f0e9257e3d02 100644 (file)
@@ -177,14 +177,14 @@ struct Client* findNUser(const char* yxx)
   if (5 == strlen(yxx)) {
     if (0 != (server = FindXNServer(yxx))) {
       Debug((DEBUG_DEBUG, "findNUser: %s(%d)", yxx, 
-             base64toint(yxx + 2) & server->serv->nn_mask));
-      return server->serv->client_list[base64toint(yxx + 2) & server->serv->nn_mask];
+             base64toint(yxx + 2) & cli_serv(server)->nn_mask));
+      return cli_serv(server)->client_list[base64toint(yxx + 2) & cli_serv(server)->nn_mask];
     }
   }
   else if (0 != (server = FindNServer(yxx))) {
     Debug((DEBUG_DEBUG, "findNUser: %s(%d)",
-           yxx, base64toint(yxx + 1) & server->serv->nn_mask));
-    return server->serv->client_list[base64toint(yxx + 1) & server->serv->nn_mask];
+           yxx, base64toint(yxx + 1) & cli_serv(server)->nn_mask));
+    return cli_serv(server)->client_list[base64toint(yxx + 1) & cli_serv(server)->nn_mask];
   }
   return 0;
 }
@@ -195,8 +195,8 @@ void RemoveYXXClient(struct Client* server, const char* yxx)
   assert(0 != yxx);
   if (*yxx) {
     Debug((DEBUG_DEBUG, "RemoveYXXClient: %s(%d)", yxx,
-           base64toint(yxx) & server->serv->nn_mask));
-    server->serv->client_list[base64toint(yxx) & server->serv->nn_mask] = 0;
+           base64toint(yxx) & cli_serv(server)->nn_mask));
+    cli_serv(server)->client_list[base64toint(yxx) & cli_serv(server)->nn_mask] = 0;
   }
 }
 
@@ -204,17 +204,17 @@ void SetServerYXX(struct Client* cptr, struct Client* server, const char* yxx)
 {
   unsigned int index;
   if (5 == strlen(yxx)) {
-    ircd_strncpy(server->yxx, yxx, 2);
-    ircd_strncpy(server->serv->nn_capacity, yxx + 2, 3);
+    ircd_strncpy(cli_yxx(server), yxx, 2);
+    ircd_strncpy(cli_serv(server)->nn_capacity, yxx + 2, 3);
   }
   else {
-    server->yxx[0]               = yxx[0];
-    server->serv->nn_capacity[0] = yxx[1];
-    server->serv->nn_capacity[1] = yxx[2];
+    (cli_yxx(server))[0]               = yxx[0];
+    cli_serv(server)->nn_capacity[0] = yxx[1];
+    cli_serv(server)->nn_capacity[1] = yxx[2];
   }
-  server->serv->nn_mask = base64toint(server->serv->nn_capacity);
+  cli_serv(server)->nn_mask = base64toint(cli_serv(server)->nn_capacity);
 
-  index = base64toint(server->yxx);
+  index = base64toint(cli_yxx(server));
   if (index >= lastNNServer)
     lastNNServer = index + 1;
   server_list[index] = server;
@@ -222,8 +222,8 @@ void SetServerYXX(struct Client* cptr, struct Client* server, const char* yxx)
   /* Note, exit_one_client uses the fact that `client_list' != NULL to
    * determine that SetServerYXX has been called - and then calls
    * ClearServerYXX. However, freeing the allocation happens in free_client() */
-  server->serv->client_list =
-      (struct Client**) MyCalloc(server->serv->nn_mask + 1, sizeof(struct Client*));
+  cli_serv(server)->client_list =
+      (struct Client**) MyCalloc(cli_serv(server)->nn_mask + 1, sizeof(struct Client*));
 }
 
 void SetYXXCapacity(struct Client* c, unsigned int capacity)
@@ -245,14 +245,14 @@ void SetYXXCapacity(struct Client* c, unsigned int capacity)
   }
   --max_clients;
 #if defined(EXTENDED_NUMERICS)
-  inttobase64(c->serv->nn_capacity, max_clients, 3); 
+  inttobase64(cli_serv(c)->nn_capacity, max_clients, 3); 
 #else
-  inttobase64(c->serv->nn_capacity, max_clients, 2); 
+  inttobase64(cli_serv(c)->nn_capacity, max_clients, 2); 
 #endif
-  c->serv->nn_mask = max_clients;       /* Our Numeric Nick mask */
-  c->serv->client_list = (struct Client**) MyCalloc(max_clients + 1, 
+  cli_serv(c)->nn_mask = max_clients;       /* Our Numeric Nick mask */
+  cli_serv(c)->client_list = (struct Client**) MyCalloc(max_clients + 1, 
                                                      sizeof(struct Client*));
-  server_list[base64toint(c->yxx)] = c;
+  server_list[base64toint(cli_yxx(c))] = c;
 }
 
 void SetYXXServerName(struct Client* c, unsigned int numeric)
@@ -261,10 +261,10 @@ void SetYXXServerName(struct Client* c, unsigned int numeric)
   assert(numeric < NN_MAX_SERVER);
 
 #if defined(EXTENDED_NUMERICS)
-  inttobase64(c->yxx, numeric, 2);
+  inttobase64(cli_yxx(c), numeric, 2);
 #else
   assert(numeric < NUMNICKBASE);
-  c->yxx[0] = convert2y[numeric];
+  (cli_yxx(c))[0] = convert2y[numeric];
 #endif
   if (numeric >= lastNNServer)
     lastNNServer = numeric + 1;
@@ -273,7 +273,7 @@ void SetYXXServerName(struct Client* c, unsigned int numeric)
 
 void ClearServerYXX(const struct Client *server)
 {
-  unsigned int index = base64toint(server->yxx);
+  unsigned int index = base64toint(cli_yxx(server));
   if (server_list[index] == server)     /* Sanity check */
     server_list[index] = 0;
 }
@@ -287,26 +287,26 @@ void ClearServerYXX(const struct Client *server)
 void SetRemoteNumNick(struct Client* acptr, const char *yxx)
 {
   struct Client** acptrp;
-  struct Client*  server = acptr->user->server;
+  struct Client*  server = cli_user(acptr)->server;
  
   if (5 == strlen(yxx)) {
-    strcpy(acptr->yxx, yxx + 2);
+    strcpy(cli_yxx(acptr), yxx + 2);
   }
   else {
-    acptr->yxx[0] = *++yxx;
-    acptr->yxx[1] = *++yxx;
-    acptr->yxx[2] = 0;
+    (cli_yxx(acptr))[0] = *++yxx;
+    (cli_yxx(acptr))[1] = *++yxx;
+    (cli_yxx(acptr))[2] = 0;
   }
-  Debug((DEBUG_DEBUG, "SetRemoteNumNick: %s(%d)", acptr->yxx
-         base64toint(acptr->yxx) & server->serv->nn_mask));
+  Debug((DEBUG_DEBUG, "SetRemoteNumNick: %s(%d)", cli_yxx(acptr)
+         base64toint(cli_yxx(acptr)) & cli_serv(server)->nn_mask));
 
-  acptrp = &server->serv->client_list[base64toint(acptr->yxx) & server->serv->nn_mask];
+  acptrp = &(cli_serv(server))->client_list[base64toint(cli_yxx(acptr)) & cli_serv(server)->nn_mask];
   if (*acptrp) {
     /*
      * this exits the old client in the array, not the client
      * that is being set
      */
-    exit_client(acptr->from, *acptrp, server, "Numeric nick collision (Ghost)");
+    exit_client(cli_from(acptr), *acptrp, server, "Numeric nick collision (Ghost)");
   }
   *acptrp = acptr;
 }
@@ -321,11 +321,11 @@ void SetRemoteNumNick(struct Client* acptr, const char *yxx)
 int SetLocalNumNick(struct Client *cptr)
 {
   static unsigned int last_nn     = 0;
-  struct Client**     client_list = me.serv->client_list;
-  unsigned int        mask        = me.serv->nn_mask;
+  struct Client**     client_list = cli_serv(&me)->client_list;
+  unsigned int        mask        = cli_serv(&me)->nn_mask;
   unsigned int        count       = 0;
 
-  assert(cptr->user->server == &me);
+  assert(cli_user(cptr)->server == &me);
 
   while (client_list[last_nn & mask]) {
     if (++count == NN_MAX_CLIENT) {
@@ -338,9 +338,9 @@ int SetLocalNumNick(struct Client *cptr)
   client_list[last_nn & mask] = cptr;  /* Reserve the numeric ! */
 
 #if defined(EXTENDED_NUMERICS)
-  inttobase64(cptr->yxx, last_nn, 3);
+  inttobase64(cli_yxx(cptr), last_nn, 3);
 #else
-  inttobase64(cptr->yxx, last_nn, 2);
+  inttobase64(cli_yxx(cptr), last_nn, 2);
 #endif
   if (++last_nn == NN_MAX_CLIENT)
     last_nn = 0;
@@ -360,10 +360,10 @@ int markMatchexServer(const char *cmask, int minlen)
 
   for (i = 0; i < lastNNServer; i++) {
     if ((acptr = server_list[i])) {
-      if (matchexec(acptr->name, cmask, minlen))
-        acptr->flags &= ~FLAGS_MAP;
+      if (matchexec(cli_name(acptr), cmask, minlen))
+        cli_flags(acptr) &= ~FLAGS_MAP;
       else {
-        acptr->flags |= FLAGS_MAP;
+        cli_flags(acptr) |= FLAGS_MAP;
         cnt++;
       }
     }
@@ -379,7 +379,7 @@ struct Client* find_match_server(char *mask)
   if (!(BadPtr(mask))) {
     collapse(mask);
     for (i = 0; i < lastNNServer; i++) {
-      if ((acptr = server_list[i]) && (!match(mask, acptr->name)))
+      if ((acptr = server_list[i]) && (!match(mask, cli_name(acptr))))
         return acptr;
     }
   }
index 2d2f873982a9c0f20df12ddfa4bebcd31d84b896..12323a565c20c3d144883330344a6a8aebe73b4a 100644 (file)
 
 static void update_bytes_received(struct Client* cptr, unsigned int length)
 {
-  me.receiveB    += length;     /* Update bytes received */
-  cptr->receiveB += length;
+  cli_receiveB(&me)  += length;     /* Update bytes received */
+  cli_receiveB(cptr) += length;
 
-  if (cptr->receiveB > 1023) {
-    cptr->receiveK += (cptr->receiveB >> 10);
-    cptr->receiveB &= 0x03ff;   /* 2^10 = 1024, 3ff = 1023 */
+  if (cli_receiveB(cptr) > 1023) {
+    cli_receiveK(cptr) += (cli_receiveB(cptr) >> 10);
+    cli_receiveB(cptr) &= 0x03ff;   /* 2^10 = 1024, 3ff = 1023 */
   }
-  if (me.receiveB > 1023) {
-    me.receiveK += (me.receiveB >> 10);
-    me.receiveB &= 0x03ff;
+  if (cli_receiveB(&me) > 1023) {
+    cli_receiveK(&me) += (cli_receiveB(&me) >> 10);
+    cli_receiveB(&me) &= 0x03ff;
   }
 }
 
 static void update_messages_received(struct Client* cptr)
 {
-  ++me.receiveM;
-  ++cptr->receiveM;
+  ++(cli_receiveM(&me));
+  ++(cli_receiveM(cptr));
 }
 
 /*
@@ -74,8 +74,8 @@ int server_dopacket(struct Client* cptr, const char* buffer, int length)
 
   update_bytes_received(cptr, length);
 
-  client_buffer = cptr->buffer;
-  endp = client_buffer + cptr->count;
+  client_buffer = cli_buffer(cptr);
+  endp = client_buffer + cli_count(cptr);
   src = buffer;
 
   while (length-- > 0) {
@@ -94,19 +94,19 @@ int server_dopacket(struct Client* cptr, const char* buffer, int length)
 
       update_messages_received(cptr);
 
-      if (parse_server(cptr, cptr->buffer, endp) == CPTR_KILLED)
+      if (parse_server(cptr, cli_buffer(cptr), endp) == CPTR_KILLED)
         return CPTR_KILLED;
       /*
        *  Socket is dead so exit
        */
       if (IsDead(cptr))
-        return exit_client(cptr, cptr, &me, cptr->info);
+        return exit_client(cptr, cptr, &me, cli_info(cptr));
       endp = client_buffer;
     }
     else if (endp < client_buffer + BUFSIZE)
       ++endp;                   /* There is always room for the null */
   }
-  cptr->count = endp - cptr->buffer;
+  cli_count(cptr) = endp - cli_buffer(cptr);
   return 1;
 }
 
@@ -120,10 +120,10 @@ int client_dopacket(struct Client *cptr, unsigned int length)
   update_bytes_received(cptr, length);
   update_messages_received(cptr);
 
-  if (CPTR_KILLED == parse_client(cptr, cptr->buffer, cptr->buffer + length))
+  if (CPTR_KILLED == parse_client(cptr, cli_buffer(cptr), cli_buffer(cptr) + length))
     return CPTR_KILLED;
   else if (IsDead(cptr))
-    return exit_client(cptr, cptr, &me, cptr->info);
+    return exit_client(cptr, cptr, &me, cli_info(cptr));
 
   return 1;
 }
index 658bfc4920efdae0666dec6835e1526dc3f1c1e3..64893c8fa2c482d4c606a9b00255b93c3063524f 100644 (file)
@@ -807,7 +807,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
   if (IsDead(cptr))
     return 0;
 
-  para[0] = from->name;
+  para[0] = cli_name(from);
   for (ch = buffer; *ch == ' '; ch++);  /* Eat leading spaces */
   if (*ch == ':')               /* Is any client doing this ? */
   {
@@ -822,7 +822,7 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
   {
     ServerStats->is_empt++;
     Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
-        cptr->name, from->name));
+        cli_name(cptr), cli_name(from)));
     return (-1);
   }
 
@@ -913,24 +913,13 @@ int parse_client(struct Client *cptr, char *buffer, char *bufend)
   }
   para[++i] = NULL;
   ++mptr->count;
-#if 0
-  /*
-   * The "unregistered command check" was ugly and mildly inefficient.
-   * I fixed it. :)  --Shadow
-   */
-  if (!IsUser(cptr) && 0 == (mptr->flags & MFLG_UNREG)) {
-    if (0 == (mptr->flags & MFLG_IGNORE))
-      sendto_one(from, ":%s %d * %s :Register first.", /* XXX DEAD */
-                 me.name, ERR_NOTREGISTERED, ch);
-    return -1;
-  }
-#endif
-  handler = mptr->handlers[cptr->handler];
+
+  handler = mptr->handlers[cli_handler(cptr)];
   assert(0 != handler);
 
 #ifndef IDLE_FROM_MSG
   if (IsUser(cptr) && handler != m_ping && handler != m_ignore)
-    from->user->last = CurrentTime;
+    cli_user(from)->last = CurrentTime;
 #endif
 
   return (*handler) (cptr, from, i, para);
@@ -952,7 +941,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
   if (IsDead(cptr))
     return 0;
 
-  para[0] = from->name;
+  para[0] = cli_name(from);
 
   /*
    * A server ALWAYS sends a prefix. When it starts with a ':' it's the
@@ -981,7 +970,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
     if (!from)
     {
       Debug((DEBUG_NOTICE, "Unknown prefix (%s)(%s) from (%s)",
-          para[0], buffer, cptr->name));
+          para[0], buffer, cli_name(cptr)));
       ++ServerStats->is_unpf;
       while (*ch == ' ')
         ch++;
@@ -993,17 +982,17 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
        */
       if (ch[1] == 'Q')
       {
-        para[0] = cptr->name;
+        para[0] = cli_name(cptr);
         from = cptr;
       }
       else
         return 0;
     }
-    else if (from->from != cptr)
+    else if (cli_from(from) != cptr)
     {
       ++ServerStats->is_wrdi;
       Debug((DEBUG_NOTICE, "Fake direction: Message (%s) coming from (%s)",
-          buffer, cptr->name));
+          buffer, cli_name(cptr)));
       return 0;
     }
   }
@@ -1056,9 +1045,9 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
         struct Client *server;
         /* Kill the unknown numeric prefix upstream if
          * it's server still exists: */
-        if ((server = FindNServer(numeric_prefix)) && server->from == cptr)
+        if ((server = FindNServer(numeric_prefix)) && cli_from(server) == cptr)
          sendcmdto_one(&me, CMD_KILL, cptr, "%s :%s (Unknown numeric nick)",
-                       numeric_prefix, me.name);
+                       numeric_prefix, cli_name(&me));
       }
       /*
        * Things that must be allowed to travel
@@ -1072,13 +1061,13 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
     }
 
     /* Let para[0] point to the name of the sender */
-    para[0] = from->name;
+    para[0] = cli_name(from);
 
-    if (from->from != cptr)
+    if (cli_from(from) != cptr)
     {
       ServerStats->is_wrdi++;
       Debug((DEBUG_NOTICE, "Fake direction: Message (%s) coming from (%s)",
-          buffer, cptr->name));
+          buffer, cli_name(cptr)));
       return 0;
     }
   }
@@ -1089,7 +1078,7 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
   {
     ServerStats->is_empt++;
     Debug((DEBUG_NOTICE, "Empty message from host %s:%s",
-        cptr->name, from->name));
+        cli_name(cptr), cli_name(from)));
     return (-1);
   }
 
@@ -1217,5 +1206,5 @@ int parse_server(struct Client *cptr, char *buffer, char *bufend)
     return (do_numeric(numeric, (*buffer != ':'), cptr, from, i, para));
   mptr->count++;
 
-  return (*mptr->handlers[cptr->handler]) (cptr, from, i, para);
+  return (*mptr->handlers[cli_handler(cptr)]) (cptr, from, i, para);
 }
index 9c5db4cb64c86f5c778d7a700e249033b90a41af..f521649da2d17d7649dfc34e02e2dbbcd923599c 100644 (file)
@@ -159,14 +159,14 @@ static void link_auth_request(struct AuthRequest* request,
 static void release_auth_client(struct Client* client)
 {
   assert(0 != client);
-  client->lasttime = client->since = CurrentTime;
-  if (client->fd > HighestFd)
-    HighestFd = client->fd;
-  LocalClientArray[client->fd] = client;
+  cli_lasttime(client) = cli_since(client) = CurrentTime;
+  if (cli_fd(client) > HighestFd)
+    HighestFd = cli_fd(client);
+  LocalClientArray[cli_fd(client)] = client;
 
   add_client_to_list(client);
   Debug((DEBUG_INFO, "Auth: release_auth_client %s@%s[%s]",
-         client->username, client->sockhost, client->sock_ip));
+         cli_username(client), cli_sockhost(client), cli_sock_ip(client)));
 }
  
 static void auth_kill_client(struct AuthRequest* auth)
@@ -211,7 +211,7 @@ static void auth_dns_callback(void* vptr, struct DNSReply* reply)
      * the ip#(s) for the socket is listed for the host.
      */
     for (i = 0; hp->h_addr_list[i]; ++i) {
-      if (0 == memcmp(hp->h_addr_list[i], &auth->client->ip,
+      if (0 == memcmp(hp->h_addr_list[i], &(cli_ip(auth->client)),
                       sizeof(struct in_addr)))
          break;
     }
@@ -219,7 +219,7 @@ static void auth_dns_callback(void* vptr, struct DNSReply* reply)
       if (IsUserPort(auth->client))
         sendheader(auth->client, REPORT_IP_MISMATCH);
       sendto_opmask_butone(0, SNO_IPMISMATCH, "IP# Mismatch: %s != %s[%s]",
-                          auth->client->sock_ip, hp->h_name, 
+                          cli_sock_ip(auth->client), hp->h_name, 
                           ircd_ntoa(hp->h_addr_list[0]));
 #if defined(KILL_IPMISMATCH)
       auth_kill_client(auth);
@@ -228,8 +228,8 @@ static void auth_dns_callback(void* vptr, struct DNSReply* reply)
     }
     else {
       ++reply->ref_count;
-      auth->client->dns_reply = reply;
-      ircd_strncpy(auth->client->sockhost, hp->h_name, HOSTLEN);
+      cli_dns_reply(auth->client) = reply;
+      ircd_strncpy(cli_sockhost(auth->client), hp->h_name, HOSTLEN);
       if (IsUserPort(auth->client))
         sendheader(auth->client, REPORT_FIN_DNS);
     }
@@ -334,7 +334,7 @@ static int start_auth_query(struct AuthRequest* auth)
    * and machines with multiple IP addresses are common now
    */
   memset(&local_addr, 0, sizeof(struct sockaddr_in));
-  os_get_sockname(auth->client->fd, &local_addr);
+  os_get_sockname(cli_fd(auth->client), &local_addr);
   local_addr.sin_port = htons(0);
 
   if (bind(fd, (struct sockaddr*) &local_addr, sizeof(struct sockaddr_in))) {
@@ -346,7 +346,7 @@ static int start_auth_query(struct AuthRequest* auth)
     return 0;
   }
 
-  remote_addr.sin_addr.s_addr = auth->client->ip.s_addr;
+  remote_addr.sin_addr.s_addr = (cli_ip(auth->client)).s_addr;
   remote_addr.sin_port = htons(113);
   remote_addr.sin_family = AF_INET;
 
@@ -522,8 +522,8 @@ void start_auth(struct Client* client)
   assert(0 != auth);
 
 #if !defined(NODNS)
-  if (LOOPBACK == inet_netof(client->ip)) {
-    strcpy(client->sockhost, me.name);
+  if (LOOPBACK == inet_netof(cli_ip(client))) {
+    strcpy(client->sockhost, cli_name(&me));
   }
   else {
     struct DNSQuery query;
@@ -534,11 +534,11 @@ void start_auth(struct Client* client)
     if (IsUserPort(auth->client))
       sendheader(client, REPORT_DO_DNS);
 
-    client->dns_reply = gethost_byaddr((const char*) &client->ip, &query);
+    client->dns_reply = gethost_byaddr((const char*) &(cli_ip(client)), &query);
 
-    if (client->dns_reply) {
-      ++client->dns_reply->ref_count;
-      ircd_strncpy(client->sockhost, client->dns_reply->hp->h_name, HOSTLEN);
+    if (cli_dns_reply(client)) {
+      ++(cli_dns_reply(client))->ref_count;
+      ircd_strncpy(cli_sockhost(client), cli_dns_reply(client)->hp->h_name, HOSTLEN);
       if (IsUserPort(auth->client))
        sendheader(client, REPORT_FIN_DNSC);
     }
@@ -622,8 +622,8 @@ void send_auth_query(struct AuthRequest* auth)
   assert(0 != auth);
   assert(0 != auth->client);
 
-  if (!os_get_sockname(auth->client->fd, &us) ||
-      !os_get_peername(auth->client->fd, &them)) {
+  if (!os_get_sockname(cli_fd(auth->client), &us) ||
+      !os_get_peername(cli_fd(auth->client), &them)) {
     auth_error(auth, 1);
     return;
   }
@@ -668,7 +668,7 @@ void read_auth_reply(struct AuthRequest* auth)
   ClearAuth(auth);
   
   if (!EmptyString(username)) {
-    ircd_strncpy(auth->client->username, username, USERLEN);
+    ircd_strncpy(cli_username(auth->client), username, USERLEN);
     /*
      * Not needed, struct is zeroed by memset
      * auth->client->username[USERLEN] = '\0';
@@ -681,7 +681,7 @@ void read_auth_reply(struct AuthRequest* auth)
   else {
     ++ServerStats->is_abad;
 #if 0
-    strcpy(auth->client->username, "unknown");
+    strcpy(cli_username(auth->client), "unknown");
 #endif
   }
   unlink_auth_request(auth, &AuthPollList);
index 36cb7dcfac930933a31ebbd94329185e75a2c8e5..949a02a868bffc3cf0136192a104cab1f86c3fb9 100644 (file)
@@ -237,16 +237,16 @@ static int connect_inet(struct ConfItem* aconf, struct Client* cptr)
    * Might as well get sockhost from here, the connection is attempted
    * with it so if it fails its useless.
    */
-  cptr->fd = socket(AF_INET, SOCK_STREAM, 0);
-  if (-1 == cptr->fd) {
-    cptr->error = errno;
-    report_error(SOCKET_ERROR_MSG, cptr->name, errno);
+  cli_fd(cptr) = socket(AF_INET, SOCK_STREAM, 0);
+  if (-1 == cli_fd(cptr)) {
+    cli_error(cptr) = errno;
+    report_error(SOCKET_ERROR_MSG, cli_name(cptr), errno);
     return 0;
   }
-  if (cptr->fd >= MAXCLIENTS) {
-    report_error(CONNLIMIT_ERROR_MSG, cptr->name, 0);
-    close(cptr->fd);
-    cptr->fd = -1;
+  if (cli_fd(cptr) >= MAXCLIENTS) {
+    report_error(CONNLIMIT_ERROR_MSG, cli_name(cptr), 0);
+    close(cli_fd(cptr));
+    cli_fd(cptr) = -1;
     return 0;
   }
   /*
@@ -265,8 +265,8 @@ static int connect_inet(struct ConfItem* aconf, struct Client* cptr)
    * explicitly bind it, it will default to IN_ADDR_ANY and we lose
    * due to the other server not allowing our base IP --smg
    */
-  if (bind(cptr->fd, (struct sockaddr*) &VirtualHost, sizeof(VirtualHost))) {
-    report_error(BIND_ERROR_MSG, cptr->name, errno);
+  if (bind(cli_fd(cptr), (struct sockaddr*) &VirtualHost, sizeof(VirtualHost))) {
+    report_error(BIND_ERROR_MSG, cli_name(cptr), errno);
     return 0;
   }
 #endif
@@ -278,28 +278,28 @@ static int connect_inet(struct ConfItem* aconf, struct Client* cptr)
   /*
    * save connection info in client
    */
-  cptr->ip.s_addr = aconf->ipnum.s_addr;
-  cptr->port      = aconf->port;
-  ircd_ntoa_r(cptr->sock_ip, (const char*) &cptr->ip);
+  (cli_ip(cptr)).s_addr = aconf->ipnum.s_addr;
+  cli_port(cptr)        = aconf->port;
+  ircd_ntoa_r(cli_sock_ip(cptr), (const char*) &(cli_ip(cptr)));
   /*
    * we want a big buffer for server connections
    */
-  if (!os_set_sockbufs(cptr->fd, SERVER_TCP_WINDOW)) {
-    cptr->error = errno;
-    report_error(SETBUFS_ERROR_MSG, cptr->name, errno);
+  if (!os_set_sockbufs(cli_fd(cptr), SERVER_TCP_WINDOW)) {
+    cli_error(cptr) = errno;
+    report_error(SETBUFS_ERROR_MSG, cli_name(cptr), errno);
     return 0;
   }
   /*
    * ALWAYS set sockets non-blocking
    */
-  if (!os_set_nonblocking(cptr->fd)) {
-    cptr->error = errno;
-    report_error(NONB_ERROR_MSG, cptr->name, errno);
+  if (!os_set_nonblocking(cli_fd(cptr))) {
+    cli_error(cptr) = errno;
+    report_error(NONB_ERROR_MSG, cli_name(cptr), errno);
     return 0;
   }
-  if (!os_connect_nonb(cptr->fd, &sin)) {
-    cptr->error = errno;
-    report_error(CONNECT_ERROR_MSG, cptr->name, errno);
+  if (!os_connect_nonb(cli_fd(cptr), &sin)) {
+    cli_error(cptr) = errno;
+    report_error(CONNECT_ERROR_MSG, cli_name(cptr), errno);
     return 0;
   }
   return 1;
@@ -334,33 +334,33 @@ unsigned int deliver_it(struct Client *cptr, struct MsgQ *buf)
   unsigned int bytes_count = 0;
   assert(0 != cptr);
 
-  switch (os_sendv_nonb(cptr->fd, buf, &bytes_count, &bytes_written)) {
+  switch (os_sendv_nonb(cli_fd(cptr), buf, &bytes_count, &bytes_written)) {
   case IO_SUCCESS:
-    cptr->flags &= ~FLAGS_BLOCKED;
+    cli_flags(cptr) &= ~FLAGS_BLOCKED;
 
-    cptr->sendB += bytes_written;
-    me.sendB    += bytes_written;
-    if (cptr->sendB > 1023) {
-      cptr->sendK += (cptr->sendB >> 10);
-      cptr->sendB &= 0x03ff;    /* 2^10 = 1024, 3ff = 1023 */
+    cli_sendB(cptr) += bytes_written;
+    cli_sendB(&me)  += bytes_written;
+    if (cli_sendB(cptr) > 1023) {
+      cli_sendK(cptr) += (cli_sendB(cptr) >> 10);
+      cli_sendB(cptr) &= 0x03ff;    /* 2^10 = 1024, 3ff = 1023 */
     }
-    if (me.sendB > 1023) {
-      me.sendK += (me.sendB >> 10);
-      me.sendB &= 0x03ff;
+    if (cli_sendB(&me) > 1023) {
+      cli_sendK(&me) += (cli_sendB(&me) >> 10);
+      cli_sendB(&me) &= 0x03ff;
     }
     /*
      * XXX - hrmm.. set blocked here? the socket didn't
      * say it was blocked
      */
     if (bytes_written < bytes_count)
-      cptr->flags |= FLAGS_BLOCKED;
+      cli_flags(cptr) |= FLAGS_BLOCKED;
     break;
   case IO_BLOCKED:
-    cptr->flags |= FLAGS_BLOCKED;
+    cli_flags(cptr) |= FLAGS_BLOCKED;
     break;
   case IO_FAILURE:
-    cptr->error = errno;
-    cptr->flags |= FLAGS_DEADSOCKET;
+    cli_error(cptr) = errno;
+    cli_flags(cptr) |= FLAGS_DEADSOCKET;
     break;
   }
   return bytes_written;
@@ -372,10 +372,10 @@ void release_dns_reply(struct Client* cptr)
   assert(0 != cptr);
   assert(MyConnect(cptr));
 
-  if (cptr->dns_reply) {
-    assert(0 < cptr->dns_reply->ref_count);
-    --cptr->dns_reply->ref_count;
-    cptr->dns_reply = 0;
+  if (cli_dns_reply(cptr)) {
+    assert(0 < cli_dns_reply(cptr)->ref_count);
+    --(cli_dns_reply(cptr))->ref_count;
+    cli_dns_reply(cptr) = 0;
   }
 }
 
@@ -401,26 +401,22 @@ static int completed_connection(struct Client* cptr)
    * get the socket status from the fd first to check if
    * connection actually succeeded
    */
-  if ((cptr->error = os_get_sockerr(cptr->fd))) {
-    const char* msg = strerror(cptr->error);
+  if ((cli_error(cptr) = os_get_sockerr(cli_fd(cptr)))) {
+    const char* msg = strerror(cli_error(cptr));
     if (!msg)
       msg = "Unknown error";
     sendto_opmask_butone(0, SNO_OLDSNO, "Connection failed to %s: %s",
-                         cptr->name, msg);
+                         cli_name(cptr), msg);
     return 0;
   }
-  if (!(aconf = find_conf_byname(cptr->confs, cptr->name, CONF_SERVER))) {
-    sendto_opmask_butone(0, SNO_OLDSNO, "Lost Server Line for %s", cptr->name);
+  if (!(aconf = find_conf_byname(cli_confs(cptr), cli_name(cptr), CONF_SERVER))) {
+    sendto_opmask_butone(0, SNO_OLDSNO, "Lost Server Line for %s", cli_name(cptr));
     return 0;
   }
 
   if (!EmptyString(aconf->passwd))
     sendrawto_one(cptr, MSG_PASS " :%s", aconf->passwd);
 
-#if 0 
-  /* dead code, already done in connect_server */
-  make_server(cptr);
-#endif
   /*
    * Create a unique timestamp
    */
@@ -428,23 +424,23 @@ static int completed_connection(struct Client* cptr)
   for (i = HighestFd; i > -1; --i) {
     if ((acptr = LocalClientArray[i]) && 
         (IsServer(acptr) || IsHandshake(acptr))) {
-      if (acptr->serv->timestamp >= newts)
-        newts = acptr->serv->timestamp + 1;
+      if (cli_serv(acptr)->timestamp >= newts)
+        newts = cli_serv(acptr)->timestamp + 1;
     }
   }
-  assert(0 != cptr->serv);
+  assert(0 != cli_serv(cptr));
 
-  cptr->serv->timestamp = newts;
+  cli_serv(cptr)->timestamp = newts;
   SetHandshake(cptr);
   /*
    * Make us timeout after twice the timeout for DNS look ups
    */
-  cptr->lasttime = CurrentTime;
-  cptr->flags |= FLAGS_PINGSENT;
+  cli_lasttime(cptr) = CurrentTime;
+  cli_flags(cptr) |= FLAGS_PINGSENT;
 
   sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s",
-                me.name, me.serv->timestamp, newts, MAJOR_PROTOCOL, 
-                NumServCap(&me), me.info);
+                cli_name(&me), cli_serv(&me)->timestamp, newts, MAJOR_PROTOCOL, 
+                NumServCap(&me), cli_info(&me));
 
   return (IsDead(cptr)) ? 0 : 1;
 }
@@ -461,11 +457,11 @@ void close_connection(struct Client *cptr)
 
   if (IsServer(cptr)) {
     ServerStats->is_sv++;
-    ServerStats->is_sbs += cptr->sendB;
-    ServerStats->is_sbr += cptr->receiveB;
-    ServerStats->is_sks += cptr->sendK;
-    ServerStats->is_skr += cptr->receiveK;
-    ServerStats->is_sti += CurrentTime - cptr->firsttime;
+    ServerStats->is_sbs += cli_sendB(cptr);
+    ServerStats->is_sbr += cli_receiveB(cptr);
+    ServerStats->is_sks += cli_sendK(cptr);
+    ServerStats->is_skr += cli_receiveK(cptr);
+    ServerStats->is_sti += CurrentTime - cli_firsttime(cptr);
     if (ServerStats->is_sbs > 1023) {
       ServerStats->is_sks += (ServerStats->is_sbs >> 10);
       ServerStats->is_sbs &= 0x3ff;
@@ -478,7 +474,7 @@ void close_connection(struct Client *cptr)
      * If the connection has been up for a long amount of time, schedule
      * a 'quick' reconnect, else reset the next-connect cycle.
      */
-    if ((aconf = find_conf_exact(cptr->name, 0, cptr->sockhost, CONF_SERVER))) {
+    if ((aconf = find_conf_exact(cli_name(cptr), 0, cli_sockhost(cptr), CONF_SERVER))) {
       /*
        * Reschedule a faster reconnect, if this was a automaticly
        * connected configuration entry. (Note that if we have had
@@ -494,11 +490,11 @@ void close_connection(struct Client *cptr)
   }
   else if (IsUser(cptr)) {
     ServerStats->is_cl++;
-    ServerStats->is_cbs += cptr->sendB;
-    ServerStats->is_cbr += cptr->receiveB;
-    ServerStats->is_cks += cptr->sendK;
-    ServerStats->is_ckr += cptr->receiveK;
-    ServerStats->is_cti += CurrentTime - cptr->firsttime;
+    ServerStats->is_cbs += cli_sendB(cptr);
+    ServerStats->is_cbr += cli_receiveB(cptr);
+    ServerStats->is_cks += cli_sendK(cptr);
+    ServerStats->is_ckr += cli_receiveK(cptr);
+    ServerStats->is_cti += CurrentTime - cli_firsttime(cptr);
     if (ServerStats->is_cbs > 1023) {
       ServerStats->is_cks += (ServerStats->is_cbs >> 10);
       ServerStats->is_cbs &= 0x3ff;
@@ -511,24 +507,24 @@ void close_connection(struct Client *cptr)
   else
     ServerStats->is_ni++;
 
-  if (-1 < cptr->fd) {
+  if (-1 < cli_fd(cptr)) {
     flush_connections(cptr);
-    LocalClientArray[cptr->fd] = 0;
-    close(cptr->fd);
-    cptr->fd = -1;
+    LocalClientArray[cli_fd(cptr)] = 0;
+    close(cli_fd(cptr));
+    cli_fd(cptr) = -1;
   }
-  cptr->flags |= FLAGS_DEADSOCKET;
+  cli_flags(cptr) |= FLAGS_DEADSOCKET;
 
-  MsgQClear(&cptr->sendQ);
-  DBufClear(&cptr->recvQ);
-  memset(cptr->passwd, 0, sizeof(cptr->passwd));
+  MsgQClear(&(cli_sendQ(cptr)));
+  DBufClear(&(cli_recvQ(cptr)));
+  memset(cli_passwd(cptr), 0, sizeof(cli_passwd(cptr)));
   set_snomask(cptr, 0, SNO_SET);
 
   det_confs_butmask(cptr, 0);
 
-  if (cptr->listener) {
-    release_listener(cptr->listener);
-    cptr->listener = 0;
+  if (cli_listener(cptr)) {
+    release_listener(cli_listener(cptr));
+    cli_listener(cptr) = 0;
   }
 
   for ( ; HighestFd > 0; --HighestFd) {
@@ -604,16 +600,16 @@ void add_connection(struct Listener* listener, int fd) {
    * Copy ascii address to 'sockhost' just in case. Then we have something
    * valid to put into error messages...  
    */
-  ircd_ntoa_r(new_client->sock_ip, (const char*) &addr.sin_addr);   
-  strcpy(new_client->sockhost, new_client->sock_ip);
-  new_client->ip.s_addr = addr.sin_addr.s_addr;
-  new_client->port      = ntohs(addr.sin_port);
+  ircd_ntoa_r(cli_sock_ip(new_client), (const char*) &addr.sin_addr);   
+  strcpy(cli_sockhost(new_client), cli_sock_ip(new_client));
+  (cli_ip(new_client)).s_addr = addr.sin_addr.s_addr;
+  cli_port(new_client)        = ntohs(addr.sin_port);
 
   if (next_target)
-    new_client->nexttarget = next_target;
+    cli_nexttarget(new_client) = next_target;
 
-  new_client->fd = fd;
-  new_client->listener = listener;
+  cli_fd(new_client) = fd;
+  cli_listener(new_client) = listener;
   ++listener->ref_count;
 
   Count_newunknown(UserStats);
@@ -635,20 +631,20 @@ static int read_packet(struct Client *cptr, int socket_ready)
   unsigned int dolen = 0;
   unsigned int length = 0;
 
-  if (socket_ready && !(IsUser(cptr) && DBufLength(&cptr->recvQ) > CLIENT_FLOOD)) {
-    switch (os_recv_nonb(cptr->fd, readbuf, sizeof(readbuf), &length)) {
+  if (socket_ready && !(IsUser(cptr) && DBufLength(&(cli_recvQ(cptr))) > CLIENT_FLOOD)) {
+    switch (os_recv_nonb(cli_fd(cptr), readbuf, sizeof(readbuf), &length)) {
     case IO_SUCCESS:
       if (length) {
-        cptr->lasttime = CurrentTime;
-        if (cptr->lasttime > cptr->since)
-          cptr->since = cptr->lasttime;
-        cptr->flags &= ~(FLAGS_PINGSENT | FLAGS_NONL);
+        cli_lasttime(cptr) = CurrentTime;
+        if (cli_lasttime(cptr) > cli_since(cptr))
+          cli_since(cptr) = cli_lasttime(cptr);
+        cli_flags(cptr) &= ~(FLAGS_PINGSENT | FLAGS_NONL);
       }
       break;
     case IO_BLOCKED:
       break;
     case IO_FAILURE:
-      cptr->error = errno;
+      cli_error(cptr) = errno;
       /* cptr->flags |= FLAGS_DEADSOCKET; */
       return 0;
     }
@@ -667,20 +663,20 @@ static int read_packet(struct Client *cptr, int socket_ready)
      * it on the end of the receive queue and do it when its
      * turn comes around.
      */
-    if (length > 0 && 0 == dbuf_put(&cptr->recvQ, readbuf, length)) {
+    if (length > 0 && 0 == dbuf_put(&(cli_recvQ(cptr)), readbuf, length)) {
       return exit_client(cptr, cptr, &me, "dbuf_put fail");
     }
 #ifndef NOFLOODCONTROL
     /*
      * XXX - cptr will always be a user or unregistered
      */
-    if (IsUser(cptr) && DBufLength(&cptr->recvQ) > CLIENT_FLOOD)
+    if (IsUser(cptr) && DBufLength(&(cli_recvQ(cptr))) > CLIENT_FLOOD)
       return exit_client(cptr, cptr, &me, "Excess Flood");
 
-    while (DBufLength(&cptr->recvQ) && !NoNewLine(cptr) && 
-           (IsTrusted(cptr) || cptr->since - CurrentTime < 10))
+    while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr) && 
+           (IsTrusted(cptr) || cli_since(cptr) - CurrentTime < 10))
 #else
-    while (DBufLength(&cptr->recvQ) && !NoNewLine(cptr))
+    while (DBufLength(&(cli_recvQ(cptr))) && !NoNewLine(cptr))
 #endif
     {
       /*
@@ -688,10 +684,10 @@ static int read_packet(struct Client *cptr, int socket_ready)
        * then skip the per-message parsing below.
        */
       if (IsServer(cptr)) {
-        dolen = dbuf_get(&cptr->recvQ, readbuf, sizeof(readbuf));
+        dolen = dbuf_get(&(cli_recvQ(cptr)), readbuf, sizeof(readbuf));
         return (dolen) ? server_dopacket(cptr, readbuf, dolen) : 1;
       }
-      dolen = dbuf_getmsg(&cptr->recvQ, cptr->buffer, BUFSIZE);
+      dolen = dbuf_getmsg(&(cli_recvQ(cptr)), cli_buffer(cptr), BUFSIZE);
       /*
        * Devious looking...whats it do ? well..if a client
        * sends a *long* message without any CR or LF, then
@@ -701,10 +697,10 @@ static int read_packet(struct Client *cptr, int socket_ready)
        * -avalon
        */
       if (0 == dolen) {
-        if (DBufLength(&cptr->recvQ) < 510)
+        if (DBufLength(&(cli_recvQ(cptr))) < 510)
           cptr->flags |= FLAGS_NONL;
         else
-          DBufClear(&cptr->recvQ);
+          DBufClear(&(cli_recvQ(cptr)));
       }
       else if (CPTR_KILLED == client_dopacket(cptr, dolen))
         return CPTR_KILLED;
@@ -718,12 +714,12 @@ static int on_write_unblocked(struct Client* cptr)
   /*
    *  ...room for writing, empty some queue then...
    */
-  cptr->flags &= ~FLAGS_BLOCKED;
+  cli_flags(cptr) &= ~FLAGS_BLOCKED;
   if (IsConnecting(cptr)) {
     if (!completed_connection(cptr))
       return 0;
   }
-  else if (cptr->listing && MsgQLength(&cptr->sendQ) < 2048)
+  else if (cli_listing(cptr) && MsgQLength(&(cli_sendQ(cptr))) < 2048)
     list_next_channels(cptr, 64);
   send_queued(cptr);
   return 1;
@@ -901,13 +897,13 @@ int read_message(time_t delay)
     for (i = HighestFd; -1 < i; --i) {
       if ((cptr = LocalClientArray[i])) {
 
-        if (DBufLength(&cptr->recvQ))
+        if (DBufLength(&(cli_recvQ(cptr))))
           delay2 = 1;
-        if (DBufLength(&cptr->recvQ) < 4088 || IsServer(cptr)) {
+        if (DBufLength(&(cli_recvQ(cptr))) < 4088 || IsServer(cptr)) {
           PFD_SETR(i);
         }
-        if (MsgQLength(&cptr->sendQ) || IsConnecting(cptr) ||
-            (cptr->listing && MsgQLength(&cptr->sendQ) < 2048)) {
+        if (MsgQLength(&(cli_sendQ(cptr))) || IsConnecting(cptr) ||
+            (cli_listing(cptr) && MsgQLength(&(cli_sendQ(cptr))) < 2048)) {
           PFD_SETW(i);
         }
       }
@@ -925,7 +921,7 @@ int read_message(time_t delay)
 
     if (EINTR == errno)
       return -1;
-    report_error(POLL_ERROR_MSG, me.name, errno);
+    report_error(POLL_ERROR_MSG, cli_name(&me), errno);
     ++res;
     if (res > 5)
       server_restart("too many poll errors");
@@ -1016,7 +1012,7 @@ int read_message(time_t delay)
     }
     if (write_ready) {
       if (!on_write_unblocked(cptr) || IsDead(cptr)) {
-        const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
+        const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : cli_info(cptr);
         if (!msg)
           msg = "Unknown error";
         exit_client(cptr, cptr, &me, msg);
@@ -1035,7 +1031,7 @@ int read_message(time_t delay)
       flush_connections(poll_cptr[i]);
 #endif
     if (IsDead(cptr)) {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
+      const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : cli_info(cptr);
       if (!msg)
         msg = "Unknown error";
       exit_client(cptr, cptr, &me, (char*) msg);
@@ -1043,7 +1039,7 @@ int read_message(time_t delay)
     }
     if (length > 0)
       continue;
-    cptr->flags |= FLAGS_DEADSOCKET;
+    cli_flags(cptr) |= FLAGS_DEADSOCKET;
     /*
      * ...hmm, with non-blocking sockets we might get
      * here from quite valid reasons, although.. why
@@ -1055,11 +1051,11 @@ int read_message(time_t delay)
      */
     Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d %d", pfd->fd, errno, length));
 
-    if ((IsServer(cptr) || IsHandshake(cptr)) && cptr->error == 0 && length == 0)
+    if ((IsServer(cptr) || IsHandshake(cptr)) && cli_error(cptr) == 0 && length == 0)
       exit_client_msg(cptr, cptr, &me, "Server %s closed the connection (%s)",
-                      cptr->name, cptr->serv->last_error_msg);
+                      cli_name(cptr), cli_serv(cptr)->last_error_msg);
     else {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : "EOF from client";
+      const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : "EOF from client";
       if (!msg)
         msg = "Unknown error";
       exit_client_msg(cptr, cptr, &me, "Read error: %s", msg);
@@ -1140,12 +1136,12 @@ int read_message(time_t delay)
 
     for (i = HighestFd; i > -1; --i) {
       if ((cptr = LocalClientArray[i])) {
-        if (DBufLength(&cptr->recvQ))
+        if (DBufLength(&(cli_recvQ(cptr))))
           delay2 = 1;
-        if (DBufLength(&cptr->recvQ) < 4088 || IsServer(cptr))
+        if (DBufLength(&(cli_recvq(cptr))) < 4088 || IsServer(cptr))
           FD_SET(i, &read_set);
-        if (MsgQLength(&cptr->sendQ) || IsConnecting(cptr) ||
-            (cptr->listing && MsgQLength(&cptr->sendQ) < 2048))
+        if (MsgQLength(&(cli_sendq(cptr))) || IsConnecting(cptr) ||
+            (cli_listing(cptr) && MsgQLength(&(cli_sendQ(cptr))) < 2048))
           FD_SET(i, &write_set);
       }
     }
@@ -1164,7 +1160,7 @@ int read_message(time_t delay)
 
     if (errno == EINTR)
       return -1;
-    report_error(SELECT_ERROR_MSG, me.name, errno);
+    report_error(SELECT_ERROR_MSG, cli_name(&me), errno);
     if (++res > 5)
       server_restart("too many select errors");
     sleep(1);
@@ -1230,7 +1226,7 @@ int read_message(time_t delay)
       if (FD_ISSET(i, &write_set)) {
         --nfds;
         if (!on_write_unblocked(cptr) || IsDead(cptr)) {
-          const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
+          const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : cli_info(cptr);
           if (!msg)
             msg = "Unknown error";
           if (FD_ISSET(i, &read_set))
@@ -1248,7 +1244,7 @@ int read_message(time_t delay)
         continue;
     }
     if (IsDead(cptr)) {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : cptr->info;
+      const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : cli_info(cptr);
       if (!msg)
         msg = "Unknown error";
       exit_client(cptr, cptr, &me, msg);
@@ -1266,13 +1262,13 @@ int read_message(time_t delay)
      * in due course, select() returns that fd as ready
      * for reading even though it ends up being an EOF. -avalon
      */
-    Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d %d", i, cptr->error, length));
+    Debug((DEBUG_ERROR, "READ ERROR: fd = %d %d %d", i, cli_error(cptr), length));
 
-    if ((IsServer(cptr) || IsHandshake(cptr)) && cptr->error == 0 && length == 0)
+    if ((IsServer(cptr) || IsHandshake(cptr)) && cli_error(cptr) == 0 && length == 0)
       exit_client_msg(cptr, cptr, &me, "Server %s closed the connection (%s)",
-                      cptr->name, cptr->serv->last_error_msg);
+                      cli_name(cptr), cli_serv(cptr)->last_error_msg);
     else {
-      const char* msg = (cptr->error) ? strerror(cptr->error) : "EOF from client";
+      const char* msg = (cli_error(cptr)) ? strerror(cli_error(cptr)) : "EOF from client";
       if (!msg)
         msg = "Unknown error";
       exit_client_msg(cptr, cptr, &me, "Read error: %s", msg);
@@ -1313,17 +1309,17 @@ int connect_server(struct ConfItem* aconf, struct Client* by,
   if ((cptr = FindClient(aconf->name))) {
     if (IsServer(cptr) || IsMe(cptr)) {
       sendto_opmask_butone(0, SNO_OLDSNO, "Server %s already present from %s", 
-                           aconf->name, cptr->from->name);
+                           aconf->name, cli_name(cli_from(cptr)));
       if (by && IsUser(by) && !MyUser(by)) {
         sendcmdto_one(&me, CMD_NOTICE, by, "%C :Server %s already present "
-                      "from %s", by, aconf->name, cptr->from->name);
+                      "from %s", by, aconf->name, cli_name(cli_from(cptr)));
       }
       return 0;
     }
     else if (IsHandshake(cptr) || IsConnecting(cptr)) {
       if (by && IsUser(by)) {
         sendcmdto_one(&me, CMD_NOTICE, by, "%C :Connection to %s already in "
-                      "progress", by, cptr->name);
+                      "progress", by, cli_name(cptr));
       }
       return 0;
     }
@@ -1355,13 +1351,13 @@ int connect_server(struct ConfItem* aconf, struct Client* by,
   cptr = make_client(NULL, STAT_UNKNOWN_SERVER);
   if (reply)
     ++reply->ref_count;
-  cptr->dns_reply = reply;
+  cli_dns_reply(cptr) = reply;
 
   /*
    * Copy these in so we have something for error detection.
    */
-  ircd_strncpy(cptr->name, aconf->name, HOSTLEN);
-  ircd_strncpy(cptr->sockhost, aconf->host, HOSTLEN);
+  ircd_strncpy(cli_name(cptr), aconf->name, HOSTLEN);
+  ircd_strncpy(cli_sockhost(cptr), aconf->host, HOSTLEN);
 
   /*
    * Attach config entries to client here rather than in
@@ -1369,7 +1365,7 @@ int connect_server(struct ConfItem* aconf, struct Client* by,
    */
   attach_confs_byhost(cptr, aconf->host, CONF_SERVER);
 
-  if (!find_conf_byhost(cptr->confs, aconf->host, CONF_SERVER)) {
+  if (!find_conf_byhost(cli_confs(cptr), aconf->host, CONF_SERVER)) {
     sendto_opmask_butone(0, SNO_OLDSNO, "Host %s is not enabled for "
                          "connecting: no C-line", aconf->name);
     if (by && IsUser(by) && !MyUser(by)) {
@@ -1386,7 +1382,7 @@ int connect_server(struct ConfItem* aconf, struct Client* by,
   if (!connect_inet(aconf, cptr)) {
     if (by && IsUser(by) && !MyUser(by)) {
       sendcmdto_one(&me, CMD_NOTICE, by, "%C :Couldn't connect to %s", by,
-                    cptr->name);
+                    cli_name(cptr));
     }
     det_confs_butmask(cptr, 0);
     free_client(cptr);
@@ -1401,23 +1397,23 @@ int connect_server(struct ConfItem* aconf, struct Client* by,
    */
   make_server(cptr);
   if (by && IsUser(by)) {
-    sprintf_irc(cptr->serv->by, "%s%s", NumNick(by));
-    assert(0 == cptr->serv->user);
-    cptr->serv->user = by->user;
+    sprintf_irc(cli_serv(cptr)->by, "%s%s", NumNick(by));
+    assert(0 == cli_serv(cptr)->user);
+    cli_serv(cptr)->user = by->user;
     by->user->refcnt++;
   }
   else {
-    *cptr->serv->by = '\0';
+    *(cli_serv(cptr))->by = '\0';
     /* strcpy(cptr->serv->by, "Auto"); */
   }
-  cptr->serv->up = &me;
+  cli_serv(cptr)->up = &me;
   SetConnecting(cptr);
 
-  if (cptr->fd > HighestFd)
-    HighestFd = cptr->fd;
+  if (cli_fd(cptr) > HighestFd)
+    HighestFd = cli_fd(cptr);
 
   
-  LocalClientArray[cptr->fd] = cptr;
+  LocalClientArray[cli_fd(cptr)] = cptr;
 
   Count_newunknown(UserStats);
   /* Actually we lie, the connect hasn't succeeded yet, but we have a valid
@@ -1451,7 +1447,7 @@ void init_server_identity(void)
   const struct LocalConf* conf = conf_get_local();
   assert(0 != conf);
 
-  ircd_strncpy(me.name, conf->name, HOSTLEN);
+  ircd_strncpy(cli_name(&me), conf->name, HOSTLEN);
   SetYXXServerName(&me, conf->numeric);
 }
 
index f5ba4ffb8c983aa1cfae1d3af8a78796dee91a29..4be9c2a00c9a4df30fd4c646ef7ae2294335b066 100644 (file)
@@ -173,7 +173,7 @@ static void detach_conf(struct Client* cptr, struct ConfItem* aconf)
   assert(0 != cptr);
   assert(0 < aconf->clients);
 
-  lp = &(cptr->confs);
+  lp = &(cli_confs(cptr));
 
   while (*lp) {
     if ((*lp)->value.aconf == aconf) {
@@ -323,7 +323,7 @@ void det_confs_butmask(struct Client* cptr, int mask)
   struct SLink* next;
   assert(0 != cptr);
 
-  for (link = cptr->confs; link; link = next) {
+  for (link = cli_confs(cptr); link; link = next) {
     next = link->next;
     if ((link->value.aconf->status & mask) == 0)
       detach_conf(cptr, link->value.aconf);
@@ -369,13 +369,13 @@ enum AuthorizationCheckResult attach_iline(struct Client*  cptr)
 
   assert(0 != cptr);
 
-  if (cptr->dns_reply)
-    hp = cptr->dns_reply->hp;
+  if (cli_dns_reply(cptr))
+    hp = cli_dns_reply(cptr)->hp;
 
   for (aconf = GlobalConfList; aconf; aconf = aconf->next) {
     if (aconf->status != CONF_CLIENT)
       continue;
-    if (aconf->port && aconf->port != cptr->listener->port)
+    if (aconf->port && aconf->port != cli_listener(cptr)->port)
       continue;
     if (!aconf->host || !aconf->name)
       continue;
@@ -384,10 +384,10 @@ enum AuthorizationCheckResult attach_iline(struct Client*  cptr)
         ircd_strncpy(fullname, hname, HOSTLEN);
         fullname[HOSTLEN] = '\0';
 
-        Debug((DEBUG_DNS, "a_il: %s->%s", cptr->sockhost, fullname));
+        Debug((DEBUG_DNS, "a_il: %s->%s", cli_sockhost(cptr), fullname));
 
         if (strchr(aconf->name, '@')) {
-          strcpy(uhost, cptr->username);
+          strcpy(uhost, cli_username(cptr));
           strcat(uhost, "@");
         }
         else
@@ -396,24 +396,24 @@ enum AuthorizationCheckResult attach_iline(struct Client*  cptr)
         uhost[sizeof(uhost) - 1] = 0;
         if (0 == match(aconf->name, uhost)) {
           if (strchr(uhost, '@'))
-            cptr->flags |= FLAGS_DOID;
+            cli_flags(cptr) |= FLAGS_DOID;
           return check_limit_and_attach(cptr, aconf);
         }
       }
     }
     if (strchr(aconf->host, '@')) {
-      ircd_strncpy(uhost, cptr->username, sizeof(uhost) - 2);
+      ircd_strncpy(uhost, cli_username(cptr), sizeof(uhost) - 2);
       uhost[sizeof(uhost) - 2] = 0;
       strcat(uhost, "@");
     }
     else
       *uhost = '\0';
-    strncat(uhost, cptr->sock_ip, sizeof(uhost) - 1 - strlen(uhost));
+    strncat(uhost, cli_sock_ip(cptr), sizeof(uhost) - 1 - strlen(uhost));
     uhost[sizeof(uhost) - 1] = 0;
     if (match(aconf->host, uhost))
       continue;
     if (strchr(uhost, '@'))
-      cptr->flags |= FLAGS_DOID;
+      cli_flags(cptr) |= FLAGS_DOID;
 
     return check_limit_and_attach(cptr, aconf);
   }
@@ -731,7 +731,7 @@ void conf_add_local(const char* const* fields, int count)
   /*
    * XXX - shouldn't be setting these directly here
    */
-  ircd_strncpy(me.info, fields[3], REALLEN);
+  ircd_strncpy(cli_info(&me), fields[3], REALLEN);
   set_virtual_host(localConf.vhost_address);
 }
 
@@ -1388,11 +1388,11 @@ int find_kill(struct Client *cptr)
 
   assert(0 != cptr);
 
-  if (!cptr->user)
+  if (!cli_user(cptr))
     return 0;
 
-  host = cptr->sockhost;
-  name = cptr->user->username;
+  host = cli_sockhost(cptr);
+  name = cli_user(cptr)->username;
 
   assert(strlen(host) <= HOSTLEN);
   assert((name ? strlen(name) : 0) <= HOSTLEN);
@@ -1409,8 +1409,8 @@ int find_kill(struct Client *cptr)
     
     if (deny->ip_kill) { /* k: by IP */
       Debug((DEBUG_DEBUG, "ip: %08x network: %08x/%i mask: %08x",
-             cptr->ip.s_addr, deny->s_addr, deny->bits, NETMASK(deny->bits)));
-      if ((cptr->ip.s_addr & NETMASK(deny->bits)) == deny->s_addr)
+             cli_ip(cptr).s_addr, deny->s_addr, deny->bits, NETMASK(deny->bits)));
+      if ((cli_ip(cptr).s_addr & NETMASK(deny->bits)) == deny->s_addr)
         break;
     }
     else if (0 == match(deny->hostmask, host))
@@ -1457,7 +1457,7 @@ enum AuthorizationCheckResult conf_check_client(struct Client *cptr)
 
   if ((acr = attach_iline(cptr))) {
     Debug((DEBUG_DNS, "ch_cl: access denied: %s[%s]", 
-          cptr->name, cptr->sockhost));
+          cli_name(cptr), cli_sockhost(cptr)));
     return acr;
   }
   return ACR_OK;
@@ -1483,23 +1483,23 @@ int conf_check_server(struct Client *cptr)
   struct SLink*    lp;
 
   Debug((DEBUG_DNS, "sv_cl: check access for %s[%s]", 
-        cptr->name, cptr->sockhost));
+        cli_name(cptr), cli_sockhost(cptr)));
 
-  if (IsUnknown(cptr) && !attach_confs_byname(cptr, cptr->name, CONF_SERVER)) {
-    Debug((DEBUG_DNS, "No C/N lines for %s", cptr->sockhost));
+  if (IsUnknown(cptr) && !attach_confs_byname(cptr, cli_name(cptr), CONF_SERVER)) {
+    Debug((DEBUG_DNS, "No C/N lines for %s", cli_sockhost(cptr)));
     return -1;
   }
-  lp = cptr->confs;
+  lp = cli_confs(cptr);
   /*
    * We initiated this connection so the client should have a C and N
    * line already attached after passing through the connect_server()
    * function earlier.
    */
   if (IsConnecting(cptr) || IsHandshake(cptr)) {
-    c_conf = find_conf_byname(lp, cptr->name, CONF_SERVER);
+    c_conf = find_conf_byname(lp, cli_name(cptr), CONF_SERVER);
     if (!c_conf) {
       sendto_opmask_butone(0, SNO_OLDSNO, "Connect Error: lost C:line for %s",
-                           cptr->name);
+                           cli_name(cptr));
       det_confs_butmask(cptr, 0);
       return -1;
     }
@@ -1508,9 +1508,9 @@ int conf_check_server(struct Client *cptr)
   ClearAccess(cptr);
 
   if (!c_conf) {
-    if (cptr->dns_reply) {
+    if (cli_dns_reply(cptr)) {
       int             i;
-      struct hostent* hp = cptr->dns_reply->hp;
+      struct hostent* hp = cli_dns_reply(cptr)->hp;
       const char*     name = hp->h_name;
       /*
        * If we are missing a C or N line from above, search for
@@ -1518,7 +1518,7 @@ int conf_check_server(struct Client *cptr)
        */
       for (i = 0; name; name = hp->h_aliases[i++]) {
         if ((c_conf = find_conf_byhost(lp, name, CONF_SERVER))) {
-          ircd_strncpy(cptr->sockhost, name, HOSTLEN);
+          ircd_strncpy(cli_sockhost(cptr), name, HOSTLEN);
           break;
         }
       }
@@ -1535,7 +1535,7 @@ int conf_check_server(struct Client *cptr)
        * of the host the server runs on. This also checks the case where
        * there is a server connecting from 'localhost'.
        */
-      c_conf = find_conf_byhost(lp, cptr->sockhost, CONF_SERVER);
+      c_conf = find_conf_byhost(lp, cli_sockhost(cptr), CONF_SERVER);
     }
   }
   /*
@@ -1544,7 +1544,7 @@ int conf_check_server(struct Client *cptr)
    * happen when using DNS in the way the irc server does. -avalon
    */
   if (!c_conf)
-    c_conf = find_conf_byip(lp, (const char*) &cptr->ip, CONF_SERVER);
+    c_conf = find_conf_byip(lp, (const char*) &(cli_ip(cptr)), CONF_SERVER);
   /*
    * detach all conf lines that got attached by attach_confs()
    */
@@ -1554,20 +1554,20 @@ int conf_check_server(struct Client *cptr)
    */
   if (!c_conf) {
     Debug((DEBUG_DNS, "sv_cl: access denied: %s[%s@%s]",
-          cptr->name, cptr->username, cptr->sockhost));
+          cli_name(cptr), cli_username(cptr), cli_sockhost(cptr)));
     return -1;
   }
-  ircd_strncpy(cptr->name, c_conf->name, HOSTLEN);
+  ircd_strncpy(cli_name(cptr), c_conf->name, HOSTLEN);
   /*
    * attach the C and N lines to the client structure for later use.
    */
   attach_conf(cptr, c_conf);
-  attach_confs_byname(cptr, cptr->name, CONF_HUB | CONF_LEAF | CONF_UWORLD);
+  attach_confs_byname(cptr, cli_name(cptr), CONF_HUB | CONF_LEAF | CONF_UWORLD);
 
   if (INADDR_NONE == c_conf->ipnum.s_addr)
-    c_conf->ipnum.s_addr = cptr->ip.s_addr;
+    c_conf->ipnum.s_addr = cli_ip(cptr).s_addr;
 
-  Debug((DEBUG_DNS, "sv_cl: access ok: %s[%s]", cptr->name, cptr->sockhost));
+  Debug((DEBUG_DNS, "sv_cl: access ok: %s[%s]", cli_name(cptr), cli_sockhost(cptr)));
   return 0;
 }
 
index 8bf56eb07b6a67a24ae7860b7f0927bd5e1d79ba..6bb79a60fe719468e316ffdb24537dac5439e9a4 100644 (file)
@@ -233,7 +233,7 @@ static void debug_enumerator(struct Client* cptr, const char* msg)
  */
 void send_usage(struct Client *cptr, char *nick)
 {
-  os_get_rusage(cptr, CurrentTime - me.since, debug_enumerator);
+  os_get_rusage(cptr, CurrentTime - cli_since(&me), debug_enumerator);
 
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":DBUF alloc %d used %d",
             DBufAllocCount, DBufUsedCount);
@@ -286,27 +286,27 @@ void count_memory(struct Client *cptr, char *nick)
   wwm += sizeof(struct Whowas) * NICKNAMEHISTORYLENGTH;
   wwm += sizeof(struct Whowas *) * WW_MAX;
 
-  for (acptr = GlobalClientList; acptr; acptr = acptr->next)
+  for (acptr = GlobalClientList; acptr; acptr = cli_next(acptr))
   {
     if (MyConnect(acptr))
     {
       lc++;
-      for (link = acptr->confs; link; link = link->next)
+      for (link = cli_confs(acptr); link; link = link->next)
         lcc++;
     }
     else
       rc++;
-    if (acptr->user)
+    if (cli_user(acptr))
     {
       us++;
-      for (link = acptr->user->invited; link; link = link->next)
+      for (link = cli_user(acptr)->invited; link; link = link->next)
         usi++;
-      for (member = acptr->user->channel; member; member = member->next_channel)
+      for (member = cli_user(acptr)->channel; member; member = member->next_channel)
         ++memberships;
-      if (acptr->user->away)
+      if (cli_user(acptr)->away)
       {
         aw++;
-        awm += (strlen(acptr->user->away) + 1);
+        awm += (strlen(cli_user(acptr)->away) + 1);
       }
     }
   }
index 6cba7aa99df13df70a374115b3299ff2a0bca5c6..90c5b3be731a6f404d6fe6ed66c9dad40436de17 100644 (file)
@@ -165,13 +165,13 @@ const char* get_client_name(const struct Client* sptr, int showip)
 
   if (MyConnect(sptr)) {
     if (showip)
-      sprintf_irc(nbuf, "%s[%s@%s]", sptr->name,
-            (IsIdented(sptr)) ? sptr->username : "", sptr->sock_ip);
+      sprintf_irc(nbuf, "%s[%s@%s]", cli_name(sptr),
+            (IsIdented(sptr)) ? cli_username(sptr) : "", cli_sock_ip(sptr));
     else
-        return sptr->name;
+        return cli_name(sptr);
     return nbuf;
   }
-  return sptr->name;
+  return cli_name(sptr);
 }
 
 const char *get_client_host(const struct Client *cptr)
@@ -190,7 +190,7 @@ void get_sockhost(struct Client *cptr, char *host)
     s++;
   else
     s = host;
-  ircd_strncpy(cptr->sockhost, s, HOSTLEN);
+  ircd_strncpy(cli_sockhost(cptr), s, HOSTLEN);
 }
 
 /*
@@ -208,7 +208,7 @@ static void exit_one_client(struct Client* bcptr, const char* comment)
 {
   struct SLink *lp;
 
-  if (bcptr->serv && bcptr->serv->client_list)  /* Was SetServerYXX called ? */
+  if (cli_serv(bcptr) && cli_serv(bcptr)->client_list)  /* Was SetServerYXX called ? */
     ClearServerYXX(bcptr);      /* Removes server from server_list[] */
   if (IsUser(bcptr)) {
     /*
@@ -219,10 +219,10 @@ static void exit_one_client(struct Client* bcptr, const char* comment)
     /*
      * Stop a running /LIST clean
      */
-    if (MyUser(bcptr) && bcptr->listing) {
-      bcptr->listing->chptr->mode.mode &= ~MODE_LISTED;
-      MyFree(bcptr->listing);
-      bcptr->listing = NULL;
+    if (MyUser(bcptr) && cli_listing(bcptr)) {
+      cli_listing(bcptr)->chptr->mode.mode &= ~MODE_LISTED;
+      MyFree(cli_listing(bcptr));
+      cli_listing(bcptr) = NULL;
     }
     /*
      * If a person is on a channel, send a QUIT notice
@@ -235,11 +235,11 @@ static void exit_one_client(struct Client* bcptr, const char* comment)
     remove_user_from_all_channels(bcptr);
 
     /* Clean up invitefield */
-    while ((lp = bcptr->user->invited))
+    while ((lp = cli_user(bcptr)->invited))
       del_invite(bcptr, lp->value.chptr);
 
     /* Clean up silencefield */
-    while ((lp = bcptr->user->silence))
+    while ((lp = cli_user(bcptr)->silence))
       del_silence(bcptr, lp->value.cp);
 
     if (IsInvisible(bcptr))
@@ -255,8 +255,8 @@ static void exit_one_client(struct Client* bcptr, const char* comment)
   else if (IsServer(bcptr))
   {
     /* Remove downlink list node of uplink */
-    remove_dlink(&bcptr->serv->up->serv->down, bcptr->serv->updown);
-    bcptr->serv->updown = 0;
+    remove_dlink(&(cli_serv(cli_serv(bcptr)->up))->down, cli_serv(bcptr)->updown);
+    cli_serv(bcptr)->updown = 0;
 
     if (MyConnect(bcptr))
       Count_serverdisconnects(UserStats);
@@ -282,19 +282,19 @@ static void exit_one_client(struct Client* bcptr, const char* comment)
    * Remove from serv->client_list
    * NOTE: user is *always* NULL if this is a server
    */
-  if (bcptr->user) {
+  if (cli_user(bcptr)) {
     assert(!IsServer(bcptr));
     /* bcptr->user->server->serv->client_list[IndexYXX(bcptr)] = NULL; */
-    RemoveYXXClient(bcptr->user->server, bcptr->yxx);
+    RemoveYXXClient(cli_user(bcptr)->server, cli_yxx(bcptr));
   }
 
   /* Remove bcptr from the client list */
 #ifdef DEBUGMODE
   if (hRemClient(bcptr) != 0)
     Debug((DEBUG_ERROR, "%p !in tab %s[%s] %p %p %p %d %d %p",
-          bcptr, bcptr->name, bcptr->from ? bcptr->from->sockhost : "??host",
-          bcptr->from, bcptr->next, bcptr->prev, bcptr->fd,
-          bcptr->status, bcptr->user));
+          bcptr, cli_name(bcptr), cli_from(bcptr) ? cli_sockhost(cli_from(bcptr)) : "??host",
+          cli_from(bcptr), cli_next(bcptr), cli_prev(bcptr), cli_fd(bcptr),
+          cli_status(bcptr), cli_user(bcptr)));
 #else
   hRemClient(bcptr);
 #endif
@@ -320,7 +320,7 @@ static void exit_downlinks(struct Client *cptr, struct Client *sptr, char *comme
   int i;
 
   /* Run over all its downlinks */
-  for (lp = cptr->serv->down; lp; lp = next)
+  for (lp = cli_serv(cptr)->down; lp; lp = next)
   {
     next = lp->next;
     acptr = lp->value.cptr;
@@ -330,8 +330,8 @@ static void exit_downlinks(struct Client *cptr, struct Client *sptr, char *comme
     exit_one_client(acptr, me.name);
   }
   /* Remove all clients of this server */
-  acptrp = cptr->serv->client_list;
-  for (i = 0; i <= cptr->serv->nn_mask; ++acptrp, ++i) {
+  acptrp = cli_serv(cptr)->client_list;
+  for (i = 0; i <= cli_serv(cptr)->nn_mask; ++acptrp, ++i) {
     if (*acptrp)
       exit_one_client(*acptrp, comment);
   }
@@ -383,26 +383,26 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
   char comment1[HOSTLEN + HOSTLEN + 2];
   assert(killer);
   if (MyConnect(victim)) {
-    victim->flags |= FLAGS_CLOSING;
+    cli_flags(victim) |= FLAGS_CLOSING;
     update_load();
 
-    on_for = CurrentTime - victim->firsttime;
+    on_for = CurrentTime - cli_firsttime(victim);
 
     if (IsUser(victim))
       log_write(LS_USER, L_TRACE, 0, "%s (%3d:%02d:%02d): %s@%s (%s)",
-               myctime(victim->firsttime), on_for / 3600,
-               (on_for % 3600) / 60, on_for % 60, victim->user->username,
-               victim->sockhost, victim->name);
+               myctime(cli_firsttime(victim)), on_for / 3600,
+               (on_for % 3600) / 60, on_for % 60, cli_user(victim)->username,
+               cli_sockhost(victim), cli_name(victim));
 
-    if (victim != killer->from  /* The source knows already */
+    if (victim != cli_from(killer)  /* The source knows already */
         && IsClient(victim))    /* Not a Ping struct or Log file */
     {
       if (IsServer(victim) || IsHandshake(victim))
-       sendcmdto_one(killer, CMD_SQUIT, victim, "%s 0 :%s", me.name, comment);
+       sendcmdto_one(killer, CMD_SQUIT, victim, "%s 0 :%s", cli_name(&me), comment);
       else if (!IsConnecting(victim)) {
         if (!IsDead(victim))
          sendrawto_one(victim, MSG_ERROR " :Closing Link: %s by %s (%s)",
-                       victim->name, killer->name, comment);
+                       cli_name(victim), cli_name(killer), comment);
       }
       if ((IsServer(victim) || IsHandshake(victim) || IsConnecting(victim)) &&
           (killer == &me || (IsServer(killer) &&
@@ -413,24 +413,24 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
          * Note: check user == user needed to make sure we have the same
          * client
          */
-        if (victim->serv->user && *victim->serv->by &&
-            (acptr = findNUser(victim->serv->by))) {
-          if (acptr->user == victim->serv->user) {
+        if (cli_serv(victim)->user && *(cli_serv(victim))->by &&
+            (acptr = findNUser(cli_serv(victim)->by))) {
+          if (cli_user(acptr) == cli_serv(victim)->user) {
            sendcmdto_one(&me, CMD_NOTICE, acptr,
                          "%C :Link with %s cancelled: %s", acptr,
-                         victim->name, comment);
+                         cli_name(victim), comment);
           }
           else {
             /*
              * not right client, set by to empty string
              */
             acptr = 0;
-            *victim->serv->by = '\0';
+            *(cli_serv(victim))->by = '\0';
           }
         }
         if (killer == &me)
          sendto_opmask_butone(acptr, SNO_OLDSNO, "Link with %s cancelled: %s",
-                              victim->name, comment);
+                              cli_name(victim), comment);
       }
     }
     /*
@@ -441,19 +441,19 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
 
   if (IsServer(victim))
   {
-    strcpy(comment1, victim->serv->up->name);
+    strcpy(comment1, cli_name(cli_serv(victim)->up));
     strcat(comment1, " ");
-    strcat(comment1, victim->name);
+    strcat(comment1, cli_name(victim));
     if (IsUser(killer))
       sendto_opmask_butone(killer, SNO_OLDSNO, "%s SQUIT by %s [%s]:",
-                          (killer->user->server == victim ||
-                           killer->user->server == victim->serv->up) ?
+                          (cli_user(killer)->server == victim ||
+                           cli_user(killer)->server == cli_serv(victim)->up) ?
                           "Local" : "Remote",
                           get_client_name(killer, HIDE_IP),
-                          killer->user->server->name);
-    else if (killer != &me && victim->serv->up != killer)
+                          cli_name(cli_user(killer)->server));
+    else if (killer != &me && cli_serv(victim)->up != killer)
       sendto_opmask_butone(0, SNO_OLDSNO, "Received SQUIT %s from %s :",
-                          victim->name, IsServer(killer) ? killer->name :
+                          cli_name(victim), IsServer(killer) ? cli_name(killer) :
                           get_client_name(killer, HIDE_IP));
     sendto_opmask_butone(0, SNO_NETWORK, "Net break: %s (%s)", comment1,
                         comment);
@@ -463,12 +463,12 @@ int exit_client(struct Client *cptr,    /* Connection being handled by
    * First generate the needed protocol for the other server links
    * except the source:
    */
-  for (dlp = me.serv->down; dlp; dlp = dlp->next) {
-    if (dlp->value.cptr != killer->from && dlp->value.cptr != victim) {
+  for (dlp = cli_serv(&me)->down; dlp; dlp = dlp->next) {
+    if (dlp->value.cptr != cli_from(killer) && dlp->value.cptr != victim) {
       if (IsServer(victim))
        sendcmdto_one(killer, CMD_SQUIT, dlp->value.cptr, "%s %Tu :%s",
-                     victim->name, victim->serv->timestamp, comment);
-      else if (IsUser(victim) && 0 == (victim->flags & FLAGS_KILLED))
+                     cli_name(victim), cli_serv(victim)->timestamp, comment);
+      else if (IsUser(victim) && 0 == (cli_flags(victim) & FLAGS_KILLED))
        sendcmdto_one(victim, CMD_QUIT, dlp->value.cptr, ":%s", comment);
     }
   }
@@ -528,11 +528,11 @@ void tstats(struct Client *cptr, char *name)
       continue;
     if (IsServer(acptr))
     {
-      sp->is_sbs += acptr->sendB;
-      sp->is_sbr += acptr->receiveB;
-      sp->is_sks += acptr->sendK;
-      sp->is_skr += acptr->receiveK;
-      sp->is_sti += CurrentTime - acptr->firsttime;
+      sp->is_sbs += cli_sendB(acptr);
+      sp->is_sbr += cli_receiveB(acptr);
+      sp->is_sks += cli_sendK(acptr);
+      sp->is_skr += cli_receiveK(acptr);
+      sp->is_sti += CurrentTime - cli_firsttime(acptr);
       sp->is_sv++;
       if (sp->is_sbs > 1023)
       {
@@ -547,11 +547,11 @@ void tstats(struct Client *cptr, char *name)
     }
     else if (IsUser(acptr))
     {
-      sp->is_cbs += acptr->sendB;
-      sp->is_cbr += acptr->receiveB;
-      sp->is_cks += acptr->sendK;
-      sp->is_ckr += acptr->receiveK;
-      sp->is_cti += CurrentTime - acptr->firsttime;
+      sp->is_cbs += cli_sendB(acptr);
+      sp->is_cbr += cli_receiveB(acptr);
+      sp->is_cks += cli_sendK(acptr);
+      sp->is_ckr += cli_receiveK(acptr);
+      sp->is_cti += CurrentTime - cli_firsttime(acptr);
       sp->is_cl++;
       if (sp->is_cbs > 1023)
       {
index 747567cb3a978bcc9254a247546c673fe0c53fd2..5d9803c43114500e47b7514eb067deaf040c8858 100644 (file)
@@ -63,7 +63,7 @@ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr,
   else
     acptr = (nnn) ? (findNUser(parv[1])) : (FindUser(parv[1]));
 
-  if (((!acptr) || (acptr->from == cptr)) && !achptr)
+  if (((!acptr) || (cli_from(acptr) == cptr)) && !achptr)
     return 0;
 
   /* Remap low number numerics, not that I understand WHY.. --Nemesi  */
index aa02c73e43a5e9865aae4ada2c6b54c34304d600..8e0524c0ff95ecc3dc638e980a0974b504c02a4c 100644 (file)
 
 unsigned int max_connection_count = 0;
 unsigned int max_client_count = 0;
-#if 0
-int exit_new_server(struct Client* cptr, struct Client* sptr,
-                    const char* host, time_t timestamp, const char* fmt, ...)
-{
-  va_list vl;
-  char *buf =
-      (char*) MyMalloc(strlen(me.name) + strlen(host) + 22 + strlen(fmt));
-  assert(0 != buf);
-  va_start(vl, fmt);
-  if (!IsServer(sptr))
-    return vexit_client_msg(cptr, cptr, &me, fmt, vl);
-  sprintf_irc(buf, ":%s " TOK_SQUIT " %s " TIME_T_FMT " :", me.name, host, timestamp);
-  strcat(buf, fmt);
-  vsendto_one(cptr, buf, vl); /* XXX DEAD */
-  va_end(vl);
-  MyFree(buf);
-  return 0;
-}
-#endif /* 0 */
 
 int exit_new_server(struct Client *cptr, struct Client *sptr, const char *host,
                     time_t timestamp, const char *pattern, ...)
@@ -101,7 +82,7 @@ int exit_new_server(struct Client *cptr, struct Client *sptr, const char *host,
 
 int a_kills_b_too(struct Client *a, struct Client *b)
 {
-  for (; b != a && b != &me; b = b->serv->up);
+  for (; b != a && b != &me; b = cli_serv(b)->up);
   return (a == b ? 1 : 0);
 }
 
@@ -119,11 +100,11 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
   int split,     i;
 
   assert(0 != cptr);
-  assert(0 != cptr->local);
+  assert(0 != cli_local(cptr));
 
-  split = (0 != ircd_strcmp(cptr->name, cptr->sockhost)
-      &&   0 != ircd_strncmp(cptr->info, "JUPE", 4));
-  inpath = cptr->name;
+  split = (0 != ircd_strcmp(cli_name(cptr), cli_sockhost(cptr))
+      &&   0 != ircd_strncmp(cli_info(cptr), "JUPE", 4));
+  inpath = cli_name(cptr);
 
   if (IsUnknown(cptr)) {
     if (aconf->passwd[0])
@@ -131,15 +112,15 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
     /*
      *  Pass my info to the new server
      */
-    sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s", me.name,
-                  me.serv->timestamp, cptr->serv->timestamp, MAJOR_PROTOCOL,
-                  NumServCap(&me), *me.info ? me.info : "IRCers United");
+    sendrawto_one(cptr, MSG_SERVER " %s 1 %Tu %Tu J%s %s%s :%s", cli_name(&me),
+                  cli_serv(&me)->timestamp, cli_serv(cptr)->timestamp, MAJOR_PROTOCOL,
+                  NumServCap(&me), *(cli_info(&me)) ? cli_info(&me) : "IRCers United");
     /*
      * Don't charge this IP# for connecting
      * XXX - if this comes from a server port, it will not have been added
      * to the IP check registry, see add_connection in s_bsd.c
      */
-    IPcheck_connect_fail(cptr->ip);
+    IPcheck_connect_fail(cli_ip(cptr));
   }
 
   det_confs_butmask(cptr, CONF_LEAF | CONF_HUB | CONF_SERVER | CONF_UWORLD);
@@ -147,7 +128,7 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
   if (!IsHandshake(cptr))
     hAddClient(cptr);
   SetServer(cptr);
-  cptr->handler = SERVER_HANDLER;
+  cli_handler(cptr) = SERVER_HANDLER;
   Count_unknownbecomesserver(UserStats);
 
   release_dns_reply(cptr);
@@ -160,9 +141,9 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
    * NOTE: check for acptr->user == cptr->serv->user is necessary to insure
    * that we got the same one... bleah
    */
-  if (cptr->serv->user && *cptr->serv->by &&
-      (acptr = findNUser(cptr->serv->by))) {
-    if (acptr->user == cptr->serv->user) {
+  if (cli_serv(cptr)->user && *(cli_serv(cptr))->by &&
+      (acptr = findNUser(cli_serv(cptr)->by))) {
+    if (cli_user(acptr) == cli_serv(cptr)->user) {
       sendcmdto_one(&me, CMD_NOTICE, acptr, "%C :Link with %s established.",
                     acptr, inpath);
     }
@@ -171,15 +152,15 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
        * if not the same client, set by to empty string
        */
       acptr = 0;
-      *cptr->serv->by = '\0';
+      *(cli_serv(cptr))->by = '\0';
     }
   }
 
   sendto_opmask_butone(acptr, SNO_OLDSNO, "Link with %s established.", inpath);
-  cptr->serv->up = &me;
-  cptr->serv->updown = add_dlink(&me.serv->down, cptr);
-  sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", me.name,
-                       cptr->name);
+  cli_serv(cptr)->up = &me;
+  cli_serv(cptr)->updown = add_dlink(&(cli_serv(&me))->down, cptr);
+  sendto_opmask_butone(0, SNO_NETWORK, "Net junction: %s %s", cli_name(&me),
+                       cli_name(cptr));
   SetJunction(cptr);
   /*
    * Old sendto_serv_but_one() call removed because we now
@@ -191,18 +172,18 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
     if (!(acptr = LocalClientArray[i]) || !IsServer(acptr) ||
         acptr == cptr || IsMe(acptr))
       continue;
-    if (!match(me.name, cptr->name))
+    if (!match(cli_name(&me), cli_name(cptr)))
       continue;
     if (ajupe)
       sendcmdto_one(&me, CMD_SERVER, acptr,
-                    "%s 2 0 %Tu J%02u %s%s 0 %%%Tu :%s", cptr->name,
-                    cptr->serv->timestamp, Protocol(cptr), NumServCap(cptr),
-                    JupeLastMod(ajupe), cptr->info);
+                    "%s 2 0 %Tu J%02u %s%s 0 %%%Tu :%s", cli_name(cptr),
+                    cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
+                    JupeLastMod(ajupe), cli_info(cptr));
     else
       sendcmdto_one(&me, CMD_SERVER, acptr,
-                    "%s 2 0 %Tu J%02u %s%s 0 :%s", cptr->name,
-                    cptr->serv->timestamp, Protocol(cptr), NumServCap(cptr),
-                    cptr->info);
+                    "%s 2 0 %Tu J%02u %s%s 0 :%s", cli_name(cptr),
+                    cli_serv(cptr)->timestamp, Protocol(cptr), NumServCap(cptr),
+                    cli_info(cptr));
   }
 
   /*
@@ -220,9 +201,9 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
    * a race condition, not the normal way of operation...
    */
 
-  for (acptr = &me; acptr; acptr = acptr->prev) {
+  for (acptr = &me; acptr; acptr = cli_prev(acptr)) {
     /* acptr->from == acptr for acptr == cptr */
-    if (acptr->from == cptr)
+    if (cli_from(acptr) == cptr)
       continue;
     if (IsServer(acptr)) {
       const char* protocol_str;
@@ -232,30 +213,30 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
       else
         protocol_str = IsBurst(acptr) ? "J0" : "P0";
 
-      if (0 == match(me.name, acptr->name))
+      if (0 == match(cli_name(&me), cli_name(acptr)))
         continue;
       split = (MyConnect(acptr) && 
-               0 != ircd_strcmp(acptr->name, acptr->sockhost) &&
-               0 != ircd_strncmp(acptr->info, "JUPE", 4));
-      if ((ajupe = jupe_find(acptr->name)) && !JupeIsLocal(ajupe))
-        sendcmdto_one(acptr->serv->up, CMD_SERVER, cptr,
-                      "%s %d 0 %Tu %s%u %s%s 0 %%%Tu :%s", acptr->name,
-                      acptr->hopcount + 1, acptr->serv->timestamp,
+               0 != ircd_strcmp(cli_name(acptr), cli_sockhost(acptr)) &&
+               0 != ircd_strncmp(cli_info(acptr), "JUPE", 4));
+      if ((ajupe = jupe_find(cli_name(acptr))) && !JupeIsLocal(ajupe))
+        sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
+                      "%s %d 0 %Tu %s%u %s%s 0 %%%Tu :%s", cli_name(acptr),
+                      cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
                       protocol_str, Protocol(acptr), NumServCap(acptr),
-                      JupeLastMod(ajupe), acptr->info);
+                      JupeLastMod(ajupe), cli_info(acptr));
       else
-        sendcmdto_one(acptr->serv->up, CMD_SERVER, cptr,
-                      "%s %d 0 %Tu %s%u %s%s 0 :%s", acptr->name,
-                      acptr->hopcount + 1, acptr->serv->timestamp,
+        sendcmdto_one(cli_serv(acptr)->up, CMD_SERVER, cptr,
+                      "%s %d 0 %Tu %s%u %s%s 0 :%s", cli_name(acptr),
+                      cli_hopcount(acptr) + 1, cli_serv(acptr)->timestamp,
                       protocol_str, Protocol(acptr), NumServCap(acptr),
-                      acptr->info);
+                      cli_info(acptr));
     }
   }
 
-  for (acptr = &me; acptr; acptr = acptr->prev)
+  for (acptr = &me; acptr; acptr = cli_prev(acptr))
   {
     /* acptr->from == acptr for acptr == cptr */
-    if (acptr->from == cptr)
+    if (cli_from(acptr) == cptr)
       continue;
     if (IsUser(acptr))
     {
@@ -263,23 +244,23 @@ int server_estab(struct Client *cptr, struct ConfItem *aconf,
       char *s = umode_str(acptr);
       struct Gline *agline = 0;
       if ((agline = gline_lookup(acptr, GLINE_GLOBAL | GLINE_LASTMOD)))
-        sendcmdto_one(acptr->user->server, CMD_NICK, cptr,
+        sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
                       "%s %d %Tu %s %s %s%s%s%%%Tu:%s@%s %s %s%s :%s",
-                      acptr->name, acptr->hopcount + 1, acptr->lastnick,
-                      acptr->user->username, acptr->user->host,
+                      cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
+                      cli_user(acptr)->username, cli_user(acptr)->host,
                       *s ? "+" : "", s, *s ? " " : "",
                       GlineLastMod(agline), GlineUser(agline),
                       GlineHost(agline),
-                      inttobase64(xxx_buf, ntohl(acptr->ip.s_addr), 6),
-                      NumNick(acptr), acptr->info);
+                      inttobase64(xxx_buf, ntohl(cli_ip(acptr).s_addr), 6),
+                      NumNick(acptr), cli_info(acptr));
       else
-        sendcmdto_one(acptr->user->server, CMD_NICK, cptr,
+        sendcmdto_one(cli_user(acptr)->server, CMD_NICK, cptr,
                       "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
-                      acptr->name, acptr->hopcount + 1, acptr->lastnick,
-                      acptr->user->username, acptr->user->host,
+                      cli_name(acptr), cli_hopcount(acptr) + 1, cli_lastnick(acptr),
+                      cli_user(acptr)->username, cli_user(acptr)->host,
                       *s ? "+" : "", s, *s ? " " : "",
-                      inttobase64(xxx_buf, ntohl(acptr->ip.s_addr), 6),
-                      NumNick(acptr), acptr->info);
+                      inttobase64(xxx_buf, ntohl(cli_ip(acptr).s_addr), 6),
+                      NumNick(acptr), cli_info(acptr));
     }
   }
   /*
index ec16da597fcee41c23a9173dde18bd12c33bcf60..af86cdfdb101de925204758df16ccbf682f62d3b 100644 (file)
@@ -80,18 +80,18 @@ struct User *make_user(struct Client *cptr)
 {
   assert(0 != cptr);
 
-  if (!cptr->user) {
-    cptr->user = (struct User*) MyMalloc(sizeof(struct User));
-    assert(0 != cptr->user);
+  if (!cli_user(cptr)) {
+    cli_user(cptr) = (struct User*) MyMalloc(sizeof(struct User));
+    assert(0 != cli_user(cptr));
 
     /* All variables are 0 by default */
-    memset(cptr->user, 0, sizeof(struct User));
+    memset(cli_user(cptr), 0, sizeof(struct User));
 #ifdef  DEBUGMODE
     ++userCount;
 #endif
-    cptr->user->refcnt = 1;
+    cli_user(cptr)->refcnt = 1;
   }
-  return cptr->user;
+  return cli_user(cptr);
 }
 
 /*
@@ -194,12 +194,12 @@ struct Client *next_client(struct Client *next, const char* ch)
 
   next = FindClient(ch);
   next = next ? next : tmp;
-  if (tmp->prev == next)
+  if (cli_prev(tmp) == next)
     return NULL;
   if (next != tmp)
     return next;
-  for (; next; next = next->next)
-    if (!match(ch, next->name))
+  for (; next; next = cli_next(next))
+    if (!match(ch, cli_name(next)))
       break;
   return next;
 }
@@ -243,8 +243,8 @@ int hunt_server_cmd(struct Client *from, const char *cmd, const char *tok,
       if (0 == (acptr = FindClient(to)))
         return HUNTED_NOSUCH;
 
-      if (acptr->user)
-        acptr = acptr->user->server;
+      if (cli_user(acptr))
+        acptr = cli_user(acptr)->server;
     } else if (!(acptr = find_match_server(to))) {
       send_reply(from, ERR_NOSUCHSERVER, to);
       return (HUNTED_NOSUCH);
@@ -376,12 +376,12 @@ int register_user(struct Client *cptr, struct Client *sptr,
   short            digits = 0;
   short            badid = 0;
   short            digitgroups = 0;
-  struct User*     user = sptr->user;
+  struct User*     user = cli_user(sptr);
   char             ip_base64[8];
   char             featurebuf[512];
 
   user->last = CurrentTime;
-  parv[0] = sptr->name;
+  parv[0] = cli_name(sptr);
   parv[1] = parv[2] = NULL;
 
   if (MyConnect(sptr))
@@ -409,7 +409,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
                                get_client_name(sptr, HIDE_IP));
         }
         ++ServerStats->is_ref;
-        IPcheck_connect_fail(sptr->ip);
+        IPcheck_connect_fail(cli_ip(sptr));
         return exit_client(cptr, sptr, &me,
                            "Sorry, your connection class is full - try "
                            "again later or try another server");
@@ -428,15 +428,15 @@ int register_user(struct Client *cptr, struct Client *sptr,
         /* Can this ever happen? */
       case ACR_BAD_SOCKET:
         ++ServerStats->is_ref;
-        IPcheck_connect_fail(sptr->ip);
+        IPcheck_connect_fail(cli_ip(sptr));
         return exit_client(cptr, sptr, &me, "Unknown error -- Try again");
     }
-    ircd_strncpy(user->host, sptr->sockhost, HOSTLEN);
-    aconf = sptr->confs->value.aconf;
+    ircd_strncpy(user->host, cli_sockhost(sptr), HOSTLEN);
+    aconf = cli_confs(sptr)->value.aconf;
 
     clean_user_id(user->username,
-        (sptr->flags & FLAGS_GOTID) ? sptr->username : username,
-        (sptr->flags & FLAGS_DOID) && !(sptr->flags & FLAGS_GOTID));
+        (cli_flags(sptr) & FLAGS_GOTID) ? cli_username(sptr) : username,
+        (cli_flags(sptr) & FLAGS_DOID) && !(cli_flags(sptr) & FLAGS_GOTID));
 
     if ((user->username[0] == '\0')
         || ((user->username[0] == '~') && (user->username[1] == '\000')))
@@ -444,20 +444,20 @@ int register_user(struct Client *cptr, struct Client *sptr,
 
     if (!EmptyString(aconf->passwd)
         && !(IsDigit(*aconf->passwd) && !aconf->passwd[1])
-        && strcmp(sptr->passwd, aconf->passwd))
+        && strcmp(cli_passwd(sptr), aconf->passwd))
     {
       ServerStats->is_ref++;
-      IPcheck_connect_fail(sptr->ip);
+      IPcheck_connect_fail(cli_ip(sptr));
       send_reply(sptr, ERR_PASSWDMISMATCH);
       return exit_client(cptr, sptr, &me, "Bad Password");
     }
-    memset(sptr->passwd, 0, sizeof(sptr->passwd));
+    memset(cli_passwd(sptr), 0, sizeof(cli_passwd(sptr)));
     /*
      * following block for the benefit of time-dependent K:-lines
      */
     if (find_kill(sptr)) {
       ServerStats->is_ref++;
-      IPcheck_connect_fail(sptr->ip);
+      IPcheck_connect_fail(cli_ip(sptr));
       return exit_client(cptr, sptr, &me, "K-lined");
     }
     /*
@@ -525,7 +525,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
         badid = 1;
     }
     if (badid && (!(sptr->flags & FLAGS_GOTID) ||
-        strcmp(sptr->username, username) != 0))
+        strcmp(cli_username(sptr), username) != 0))
     {
       ServerStats->is_ref++;
 
@@ -560,16 +560,16 @@ int register_user(struct Client *cptr, struct Client *sptr,
     ++UserStats.opers;
 
   if (MyConnect(sptr)) {
-    sptr->handler = CLIENT_HANDLER;
+    cli_handler(sptr) = CLIENT_HANDLER;
     release_dns_reply(sptr);
 
     send_reply(sptr, RPL_WELCOME, nick);
     /*
      * This is a duplicate of the NOTICE but see below...
      */
-    send_reply(sptr, RPL_YOURHOST, me.name, version);
+    send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
     send_reply(sptr, RPL_CREATED, creation);
-    send_reply(sptr, RPL_MYINFO, me.name, version);
+    send_reply(sptr, RPL_MYINFO, cli_name(&me), version);
     sprintf_irc(featurebuf,FEATURES,FEATURESVALUES);
     send_reply(sptr, RPL_ISUPPORT, featurebuf);
     m_lusers(sptr, sptr, 1, parv);
@@ -577,7 +577,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
     motd_signon(sptr);
     nextping = CurrentTime;
     if (sptr->snomask & SNO_NOISY)
-      set_snomask(sptr, sptr->snomask & SNO_NOISY, SNO_ADD);
+      set_snomask(sptr, cli_snomask(sptr) & SNO_NOISY, SNO_ADD);
     IPcheck_connect_succeeded(sptr);
   }
   else
@@ -586,16 +586,16 @@ int register_user(struct Client *cptr, struct Client *sptr,
     struct Client *acptr;
 
     acptr = user->server;
-    if (acptr->from != sptr->from)
+    if (cli_from(acptr) != cli_from(sptr))
     {
       sendcmdto_one(&me, CMD_KILL, cptr, "%C :%s (%s != %s[%s])",
-                    sptr, me.name, user->server->name, acptr->from->name,
-                    acptr->from->sockhost);
-      sptr->flags |= FLAGS_KILLED;
+                    sptr, cli_name(&me), cli_name(user->server), cli_name(cli_from(acptr)),
+                    cli_sockhost(cli_from(acptr)));
+      cli_flags(sptr) |= FLAGS_KILLED;
       return exit_client(cptr, sptr, &me, "NICK server wrong direction");
     }
     else
-      sptr->flags |= (acptr->flags & FLAGS_TS8);
+      cli_flags(sptr) |= (cli_flags(acptr) & FLAGS_TS8);
 
     /*
      * Check to see if this user is being propogated
@@ -603,7 +603,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
      * FIXME: This can be speeded up - its stupid to check it for
      * every NICK message in a burst again  --Run.
      */
-    for (acptr = user->server; acptr != &me; acptr = acptr->serv->up) {
+    for (acptr = user->server; acptr != &me; acptr = cli_serv(acptr)->up) {
       if (IsBurst(acptr) || Protocol(acptr) < 10)
         break;
     }
@@ -612,7 +612,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
        * We ran out of bits to count this
        */
       sendcmdto_one(&me, CMD_KILL, sptr, "%C :%s (Too many connections from your host -- Ghost)",
-                    sptr, me.name);
+                    sptr, cli_name(&me));
       return exit_client(cptr, sptr, &me,"Too many connections from your host -- throttled");
     }
   }
@@ -620,28 +620,28 @@ int register_user(struct Client *cptr, struct Client *sptr,
   if (agline)
     sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
                           "%s %d %Tu %s %s %s%s%s%%%Tu:%s@%s %s %s%s :%s",
-                          nick, sptr->hopcount + 1, sptr->lastnick,
+                          nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
                           user->username, user->host,
                           *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
                           GlineLastMod(agline), GlineUser(agline),
                           GlineHost(agline),
-                          inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6),
-                          NumNick(sptr), sptr->info);
+                          inttobase64(ip_base64, ntohl(cli_ip(sptr).s_addr), 6),
+                          NumNick(sptr), cli_info(sptr));
   else
     sendcmdto_serv_butone(user->server, CMD_NICK, cptr,
                           "%s %d %Tu %s %s %s%s%s%s %s%s :%s",
-                          nick, sptr->hopcount + 1, sptr->lastnick,
+                          nick, cli_hopcount(sptr) + 1, cli_lastnick(sptr),
                           user->username, user->host,
                           *tmpstr ? "+" : "", tmpstr, *tmpstr ? " " : "",
-                          inttobase64(ip_base64, ntohl(sptr->ip.s_addr), 6),
-                          NumNick(sptr), sptr->info);
+                          inttobase64(ip_base64, ntohl(cli_ip(sptr).s_addr), 6),
+                          NumNick(sptr), cli_info(sptr));
   
   /* Send umode to client */
   if (MyUser(sptr))
   {
     send_umode(cptr, sptr, 0, ALL_UMODES);
-    if (sptr->snomask != SNO_DEFAULT && (sptr->flags & FLAGS_SERVNOTICE))
-      send_reply(sptr, RPL_SNOMASK, sptr->snomask, sptr->snomask);
+    if (cli_snomask(sptr) != SNO_DEFAULT && (cli_flags(sptr) & FLAGS_SERVNOTICE))
+      send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
   }
 
   return 0;
@@ -664,20 +664,6 @@ static const struct UserMode {
 
 #define USERMODELIST_SIZE sizeof(userModeList) / sizeof(struct UserMode)
 
-#if 0
-static int user_modes[] = {
-  FLAGS_OPER,        'o',
-  FLAGS_LOCOP,       'O',
-  FLAGS_INVISIBLE,   'i',
-  FLAGS_WALLOP,      'w',
-  FLAGS_SERVNOTICE,  's',
-  FLAGS_DEAF,        'd',
-  FLAGS_CHSERV,      'k',
-  FLAGS_DEBUG,       'g',
-  0,                  0
-};
-#endif
-
 /*
  * XXX - find a way to get rid of this
  */
@@ -698,13 +684,13 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
     struct Client* new_client = make_client(cptr, STAT_UNKNOWN);
     assert(0 != new_client);
 
-    new_client->hopcount = atoi(parv[2]);
-    new_client->lastnick = atoi(parv[3]);
+    cli_hopcount(new_client) = atoi(parv[2]);
+    cli_lastnick(new_client) = atoi(parv[3]);
     if (Protocol(cptr) > 9 && parc > 7 && *parv[6] == '+') {
       for (p = parv[6] + 1; *p; p++) {
         for (i = 0; i < USERMODELIST_SIZE; ++i) {
           if (userModeList[i].c == *p) {
-            new_client->flags |= userModeList[i].flag;
+            cli_flags(new_client) |= userModeList[i].flag;
             break;
           }
         }
@@ -713,22 +699,22 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
     /*
      * Set new nick name.
      */
-    strcpy(new_client->name, nick);
-    new_client->user = make_user(new_client);
-    new_client->user->server = sptr;
+    strcpy(cli_name(new_client), nick);
+    cli_user(new_client) = make_user(new_client);
+    cli_user(new_client)->server = sptr;
     SetRemoteNumNick(new_client, parv[parc - 2]);
     /*
      * IP# of remote client
      */
-    new_client->ip.s_addr = htonl(base64toint(parv[parc - 3]));
+    cli_ip(new_client).s_addr = htonl(base64toint(parv[parc - 3]));
 
     add_client_to_list(new_client);
     hAddClient(new_client);
 
-    sptr->serv->ghost = 0;        /* :server NICK means end of net.burst */
-    ircd_strncpy(new_client->username, parv[4], USERLEN);
-    ircd_strncpy(new_client->user->host, parv[5], HOSTLEN);
-    ircd_strncpy(new_client->info, parv[parc - 1], REALLEN);
+    cli_serv(sptr)->ghost = 0;        /* :server NICK means end of net.burst */
+    ircd_strncpy(cli_username(new_client), parv[4], USERLEN);
+    ircd_strncpy(cli_user(new_client)->host, parv[5], HOSTLEN);
+    ircd_strncpy(cli_info(new_client), parv[parc - 1], REALLEN);
 
     /* Deal with GLINE parameters... */
     if (*parv[parc - 4] == '%' && (t = strchr(parv[parc - 4] + 1, ':'))) {
@@ -742,9 +728,9 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
           && GlineLastMod(agline) > lastmod && !IsBurstOrBurstAck(cptr))
         gline_resend(cptr, agline);
     }
-    return register_user(cptr, new_client, new_client->name, parv[4], agline);
+    return register_user(cptr, new_client, cli_name(new_client), parv[4], agline);
   }
-  else if (sptr->name[0]) {
+  else if ((cli_name(sptr))[0]) {
     /*
      * Client changing its nick
      *
@@ -765,28 +751,28 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
        * however, allow to do two nick changes immedately after another
        * before limiting the nick flood. -Run
        */
-      if (CurrentTime < cptr->nextnick) {
-        cptr->nextnick += 2;
+      if (CurrentTime < cli_nextnick(cptr)) {
+        cli_nextnick(cptr) += 2;
         send_reply(cptr, ERR_NICKTOOFAST, parv[1],
-                   cptr->nextnick - CurrentTime);
+                   cli_nextnick(cptr) - CurrentTime);
         /* Send error message */
-        sendcmdto_one(cptr, CMD_NICK, cptr, "%s", cptr->name);
+        sendcmdto_one(cptr, CMD_NICK, cptr, "%s", cli_name(cptr));
         /* bounce NICK to user */
         return 0;                /* ignore nick change! */
       }
       else {
         /* Limit total to 1 change per NICK_DELAY seconds: */
-        cptr->nextnick += NICK_DELAY;
+        cli_nextnick(cptr) += NICK_DELAY;
         /* However allow _maximal_ 1 extra consecutive nick change: */
-        if (cptr->nextnick < CurrentTime)
-          cptr->nextnick = CurrentTime;
+        if (cli_nextnick(cptr) < CurrentTime)
+          cli_nextnick(cptr) = CurrentTime;
       }
     }
     /*
      * Also set 'lastnick' to current time, if changed.
      */
     if (0 != ircd_strcmp(parv[0], nick))
-      sptr->lastnick = (sptr == cptr) ? TStime() : atoi(parv[2]);
+      cli_lastnick(sptr) = (sptr == cptr) ? TStime() : atoi(parv[2]);
 
     /*
      * Client just changing his/her nick. If he/she is
@@ -797,23 +783,23 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
       sendcmdto_common_channels(sptr, CMD_NICK, ":%s", nick);
       add_history(sptr, 1);
       sendcmdto_serv_butone(sptr, CMD_NICK, cptr, "%s %Tu", nick,
-                            sptr->lastnick);
+                            cli_lastnick(sptr));
     }
     else
       sendcmdto_one(sptr, CMD_NICK, sptr, ":%s", nick);
 
-    if (sptr->name[0])
+    if ((cli_name(sptr))[0])
       hRemClient(sptr);
-    strcpy(sptr->name, nick);
+    strcpy(cli_name(sptr), nick);
     hAddClient(sptr);
   }
   else {
     /* Local client setting NICK the first time */
 
-    strcpy(sptr->name, nick);
-    if (!sptr->user) {
-      sptr->user = make_user(sptr);
-      sptr->user->server = &me;
+    strcpy(cli_name(sptr), nick);
+    if (!cli_user(sptr)) {
+      cli_user(sptr) = make_user(sptr);
+      cli_user(sptr)->server = &me;
     }
     SetLocalNumNick(sptr);
     hAddClient(sptr);
@@ -822,20 +808,20 @@ int set_nick_name(struct Client* cptr, struct Client* sptr,
      * If the client hasn't gotten a cookie-ping yet,
      * choose a cookie and send it. -record!jegelhof@cloud9.net
      */
-    if (!sptr->cookie) {
+    if (!cli_cookie(sptr)) {
       do {
-        sptr->cookie = (ircrandom() & 0x7fffffff);
-      } while (!sptr->cookie);
+        cli_cookie(sptr) = (ircrandom() & 0x7fffffff);
+      } while (!cli_cookie(sptr));
       sendrawto_one(cptr, MSG_PING " :%u", sptr->cookie);
     }
-    else if (*sptr->user->host && sptr->cookie == COOKIE_VERIFIED) {
+    else if (*(cli_user(sptr))->host && cli_cookie(sptr) == COOKIE_VERIFIED) {
       /*
        * USER and PONG already received, now we have NICK.
        * register_user may reject the client and call exit_client
        * for it - must test this and exit m_nick too !
        */
-      sptr->lastnick = TStime();        /* Always local client */
-      if (register_user(cptr, sptr, nick, sptr->user->username, 0) == CPTR_KILLED)
+      cli_lastnick(sptr) = TStime();        /* Always local client */
+      if (register_user(cptr, sptr, nick, cli_user(sptr)->username, 0) == CPTR_KILLED)
         return CPTR_KILLED;
     }
   }
@@ -862,9 +848,9 @@ void add_target(struct Client *sptr, void *target)
   unsigned char* targets;
   int            i;
   assert(0 != sptr);
-  assert(sptr->local);
+  assert(cli_local(sptr));
 
-  targets = sptr->targets;
+  targets = cli_targets(sptr);
   /* 
    * Already in table?
    */
@@ -896,8 +882,8 @@ int check_target_limit(struct Client *sptr, void *target, const char *name,
   unsigned char* targets;
 
   assert(0 != sptr);
-  assert(sptr->local);
-  targets = sptr->targets;
+  assert(cli_local(sptr));
+  targets = cli_targets(sptr);
 
   /*
    * Same target as last time?
@@ -915,26 +901,21 @@ int check_target_limit(struct Client *sptr, void *target, const char *name,
    * New target
    */
   if (!created) {
-    if (CurrentTime < sptr->nexttarget) {
-      if (sptr->nexttarget - CurrentTime < TARGET_DELAY + 8) {
+    if (CurrentTime < cli_nexttarget(sptr)) {
+      if (cli_nexttarget(sptr) - CurrentTime < TARGET_DELAY + 8) {
         /*
          * No server flooding
          */
-        sptr->nexttarget += 2;
+        cli_nexttarget(sptr) += 2;
         send_reply(sptr, ERR_TARGETTOOFAST, name,
-                   sptr->nexttarget - CurrentTime);
+                   cli_nexttarget(sptr) - CurrentTime);
       }
       return 1;
     }
     else {
-#ifdef GODMODE
-      /* XXX Let's get rid of GODMODE */
-      sendto_one(sptr, ":%s NOTICE %s :New target: %s; ft " TIME_T_FMT, /* XXX Possibly DEAD */
-          me.name, sptr->name, name, (CurrentTime - sptr->nexttarget) / TARGET_DELAY);
-#endif
-      sptr->nexttarget += TARGET_DELAY;
-      if (sptr->nexttarget < CurrentTime - (TARGET_DELAY * (MAXTARGETS - 1)))
-        sptr->nexttarget = CurrentTime - (TARGET_DELAY * (MAXTARGETS - 1));
+      cli_nexttarget(sptr) += TARGET_DELAY;
+      if (cli_nexttarget(sptr) < CurrentTime - (TARGET_DELAY * (MAXTARGETS - 1)))
+        cli_nexttarget(sptr) = CurrentTime - (TARGET_DELAY * (MAXTARGETS - 1));
     }
   }
   memmove(&targets[1], &targets[0], MAXTARGETS - 1);
@@ -982,7 +963,7 @@ int whisper(struct Client* source, const char* nick, const char* channel,
    * since the link is the same, this should be a little faster for channels
    * with a lot of users
    */
-  for (membership = source->user->channel; membership; membership = membership->next_channel) {
+  for (membership = cli_user(source)->channel; membership; membership = membership->next_channel) {
     if (chptr == membership->channel)
       break;
   }
@@ -995,19 +976,19 @@ int whisper(struct Client* source, const char* nick, const char* channel,
   /*
    * lookup channel in destination
    */
-  assert(0 != dest->user);
-  for (membership = dest->user->channel; membership; membership = membership->next_channel) {
+  assert(0 != cli_user(dest));
+  for (membership = cli_user(dest)->channel; membership; membership = membership->next_channel) {
     if (chptr == membership->channel)
       break;
   }
   if (0 == membership || IsZombie(membership)) {
-    return send_reply(source, ERR_USERNOTINCHANNEL, dest->name, chptr->chname);
+    return send_reply(source, ERR_USERNOTINCHANNEL, cli_name(dest), chptr->chname);
   }
   if (is_silenced(source, dest))
     return 0;
           
-  if (dest->user->away)
-    send_reply(source, RPL_AWAY, dest->name, dest->user->away);
+  if (cli_user(dest)->away)
+    send_reply(source, RPL_AWAY, cli_name(dest), cli_user(dest)->away);
   if (is_notice)
     sendcmdto_one(source, CMD_NOTICE, dest, "%C :%s", dest, text);
   else
@@ -1029,7 +1010,7 @@ void send_umode_out(struct Client *cptr, struct Client *sptr, int old)
   for (i = HighestFd; i >= 0; i--) {
     if ((acptr = LocalClientArray[i]) && IsServer(acptr) &&
         (acptr != cptr) && (acptr != sptr) && *umodeBuf)
-      sendcmdto_one(sptr, CMD_MODE, acptr, "%s :%s", sptr->name, umodeBuf);
+      sendcmdto_one(sptr, CMD_MODE, acptr, "%s :%s", cli_name(sptr), umodeBuf);
   }
   if (cptr && MyUser(cptr))
     send_umode(cptr, sptr, old, ALL_UMODES);
@@ -1054,7 +1035,7 @@ void send_user_info(struct Client* sptr, char* names, int rpl, InfoFormatter fmt
   assert(0 != names);
   assert(0 != fmt);
 
-  mb = msgq_make(sptr, rpl_str(rpl), me.name, sptr->name);
+  mb = msgq_make(sptr, rpl_str(rpl), cli_name(&me), cli_name(sptr));
 
   for (name = ircd_strtok(&p, names, " "); name; name = ircd_strtok(&p, 0, " ")) {
     if ((acptr = FindUser(name))) {
@@ -1106,7 +1087,7 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
     if (IsServer(cptr))
       sendcmdto_flag_butone(&me, CMD_WALLOPS, 0, FLAGS_WALLOP,
                             ":MODE for User %s from %s!%s", parv[1],
-                            cptr->name, sptr->name);
+                            cli_name(cptr), cli_name(sptr));
     else
       send_reply(sptr, ERR_USERSDONTMATCH);
     return 0;
@@ -1117,15 +1098,15 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
     m = buf;
     *m++ = '+';
     for (i = 0; i < USERMODELIST_SIZE; ++i) {
-      if ( (userModeList[i].flag & sptr->flags))
+      if ( (userModeList[i].flag & cli_flags(sptr)))
         *m++ = userModeList[i].c;
     }
     *m = '\0';
     send_reply(sptr, RPL_UMODEIS, buf);
-    if ((sptr->flags & FLAGS_SERVNOTICE) && MyConnect(sptr)
-        && sptr->snomask !=
+    if ((cli_flags(sptr) & FLAGS_SERVNOTICE) && MyConnect(sptr)
+        && cli_snomask(sptr) !=
         (unsigned int)(IsOper(sptr) ? SNO_OPERDEFAULT : SNO_DEFAULT))
-      send_reply(sptr, RPL_SNOMASK, sptr->snomask, sptr->snomask);
+      send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
     return 0;
   }
 
@@ -1133,16 +1114,10 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
    * find flags already set for user
    * why not just copy them?
    */
-  setflags = sptr->flags;
-#if 0
-  setflags = 0;
-  for (i = 0; i < USERMODELIST_SIZE; ++i) {
-    if (sptr->flags & userModeList[i].flag)
-      setflags |= userModeList[i].flag;
-  }
-#endif
+  setflags = cli_flags(sptr);
+
   if (MyConnect(sptr))
-    tmpmask = sptr->snomask;
+    tmpmask = cli_snomask(sptr);
 
   /*
    * parse mode change string(s)
@@ -1166,9 +1141,9 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
           tmpmask = (what == MODE_ADD) ?
               (IsAnOper(sptr) ? SNO_OPERDEFAULT : SNO_DEFAULT) : 0;
         if (tmpmask)
-          sptr->flags |= FLAGS_SERVNOTICE;
+          cli_flags(sptr) |= FLAGS_SERVNOTICE;
         else
-          sptr->flags &= ~FLAGS_SERVNOTICE;
+          cli_flags(sptr) &= ~FLAGS_SERVNOTICE;
         break;
       case 'w':
         if (what == MODE_ADD)
@@ -1180,10 +1155,10 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
         if (what == MODE_ADD)
           SetOper(sptr);
         else {
-          sptr->flags &= ~(FLAGS_OPER | FLAGS_LOCOP);
+          cli_flags(sptr) &= ~(FLAGS_OPER | FLAGS_LOCOP);
           if (MyConnect(sptr)) {
-            tmpmask = sptr->snomask & ~SNO_OPER;
-            sptr->handler = CLIENT_HANDLER;
+            tmpmask = cli_snomask(sptr) & ~SNO_OPER;
+            cli_handler(sptr) = CLIENT_HANDLER;
           }
         }
         break;
@@ -1191,10 +1166,10 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
         if (what == MODE_ADD)
           SetLocOp(sptr);
         else { 
-          sptr->flags &= ~(FLAGS_OPER | FLAGS_LOCOP);
+          cli_flags(sptr) &= ~(FLAGS_OPER | FLAGS_LOCOP);
           if (MyConnect(sptr)) {
-            tmpmask = sptr->snomask & ~SNO_OPER;
-            sptr->handler = CLIENT_HANDLER;
+            tmpmask = cli_snomask(sptr) & ~SNO_OPER;
+            cli_handler(sptr) = CLIENT_HANDLER;
           }
         }
         break;
@@ -1254,10 +1229,10 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
     if ((setflags & (FLAGS_OPER | FLAGS_LOCOP)) && !IsAnOper(sptr))
       det_confs_butmask(sptr, CONF_CLIENT & ~CONF_OPS);
 
-    if (tmpmask != sptr->snomask)
+    if (tmpmask != cli_snomask(sptr))
       set_snomask(sptr, tmpmask, SNO_SET);
-    if (sptr->snomask && snomask_given)
-      send_reply(sptr, RPL_SNOMASK, sptr->snomask, sptr->snomask);
+    if (cli_snomask(sptr) && snomask_given)
+      send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
   }
   /*
    * Compare new flags with old flags and send string which
@@ -1286,7 +1261,7 @@ char *umode_str(struct Client *cptr)
   int   i;
   int   c_flags;
 
-  c_flags = cptr->flags & SEND_UMODES;        /* cleaning up the original code */
+  c_flags = cli_flags(cptr) & SEND_UMODES;        /* cleaning up the original code */
 
   for (i = 0; i < USERMODELIST_SIZE; ++i) {
     if ( (c_flags & userModeList[i].flag))
@@ -1319,7 +1294,7 @@ void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask)
     flag = userModeList[i].flag;
     if (MyUser(sptr) && !(flag & sendmask))
       continue;
-    if ( (flag & old) && !(sptr->flags & flag))
+    if ( (flag & old) && !(cli_flags(sptr) & flag))
     {
       if (what == MODE_DEL)
         *m++ = userModeList[i].c;
@@ -1344,7 +1319,7 @@ void send_umode(struct Client *cptr, struct Client *sptr, int old, int sendmask)
   }
   *m = '\0';
   if (*umodeBuf && cptr)
-    sendcmdto_one(sptr, CMD_MODE, cptr, "%s :%s", sptr->name, umodeBuf);
+    sendcmdto_one(sptr, CMD_MODE, cptr, "%s :%s", cli_name(sptr), umodeBuf);
 }
 
 /*
@@ -1429,7 +1404,7 @@ void set_snomask(struct Client *cptr, unsigned int newmask, int what)
   int i;
   struct SLink *tmp;
 
-  oldmask = cptr->snomask;
+  oldmask = cli_snomask(cptr);
 
   if (what == SNO_ADD)
     newmask |= oldmask;
@@ -1457,7 +1432,7 @@ void set_snomask(struct Client *cptr, unsigned int newmask, int what)
         delfrom_list(cptr, &opsarray[i]);
     }
   }
-  cptr->snomask = newmask;
+  cli_snomask(cptr) = newmask;
 }
 
 /*
@@ -1475,11 +1450,11 @@ int is_silenced(struct Client *sptr, struct Client *acptr)
   static char sender[HOSTLEN + NICKLEN + USERLEN + 5];
   static char senderip[16 + NICKLEN + USERLEN + 5];
 
-  if (!(acptr->user) || !(lp = acptr->user->silence) || !(user = sptr->user))
+  if (!cli_user(acptr) || !(lp = cli_user(acptr)->silence) || !(user = cli_user(sptr)))
     return 0;
-  sprintf_irc(sender, "%s!%s@%s", sptr->name, user->username, user->host);
-  sprintf_irc(senderip, "%s!%s@%s", sptr->name, user->username,
-              ircd_ntoa((const char*) &sptr->ip));
+  sprintf_irc(sender, "%s!%s@%s", cli_name(sptr), user->username, user->host);
+  sprintf_irc(senderip, "%s!%s@%s", cli_name(sptr), user->username,
+              ircd_ntoa((const char*) &(cli_ip(sptr))));
   for (; lp; lp = lp->next)
   {
     if ((!(lp->flags & CHFL_SILENCE_IPMASK) && !match(lp->value.cp, sender)) ||
@@ -1487,7 +1462,7 @@ int is_silenced(struct Client *sptr, struct Client *acptr)
     {
       if (!MyConnect(sptr))
       {
-        sendcmdto_one(acptr, CMD_SILENCE, sptr->from, "%C %s", sptr,
+        sendcmdto_one(acptr, CMD_SILENCE, cli_from(sptr), "%C %s", sptr,
                       lp->value.cp);
       }
       return 1;
@@ -1508,7 +1483,7 @@ int del_silence(struct Client *sptr, char *mask)
   struct SLink *tmp;
   int ret = -1;
 
-  for (lp = &sptr->user->silence; *lp;) {
+  for (lp = &(cli_user(sptr))->silence; *lp;) {
     if (!mmatch(mask, (*lp)->value.cp))
     {
       tmp = *lp;
@@ -1529,7 +1504,7 @@ int add_silence(struct Client* sptr, const char* mask)
   int cnt = 0, len = strlen(mask);
   char *ip_start;
 
-  for (lpp = &sptr->user->silence, lp = *lpp; lp;)
+  for (lpp = &(cli_user(sptr))->silence, lp = *lpp; lp;)
   {
     if (0 == ircd_strcmp(mask, lp->value.cp))
       return -1;
@@ -1557,13 +1532,13 @@ int add_silence(struct Client* sptr, const char* mask)
   }
   lp = make_link();
   memset(lp, 0, sizeof(struct SLink));
-  lp->next = sptr->user->silence;
+  lp->next = cli_user(sptr)->silence;
   lp->value.cp = (char*) MyMalloc(strlen(mask) + 1);
   assert(0 != lp->value.cp);
   strcpy(lp->value.cp, mask);
   if ((ip_start = strrchr(mask, '@')) && check_if_ipmask(ip_start + 1))
     lp->flags = CHFL_SILENCE_IPMASK;
-  sptr->user->silence = lp;
+  cli_user(sptr)->silence = lp;
   return 0;
 }
 
index 95d35bbba958cfdfe485e754dd0f5cfeccb54b18..f05d04479672444d6caa5a0c84bc0de76028869f 100644 (file)
@@ -66,28 +66,28 @@ struct SLink *opsarray[32];     /* don't use highest bit unless you change
 
 static void dead_link(struct Client *to, char *notice)
 {
-  to->flags |= FLAGS_DEADSOCKET;
+  cli_flags(to) |= FLAGS_DEADSOCKET;
   /*
    * If because of BUFFERPOOL problem then clean dbuf's now so that
    * notices don't hurt operators below.
    */
-  DBufClear(&to->recvQ);
-  MsgQClear(&to->sendQ);
+  DBufClear(&(cli_recvQ(to)));
+  MsgQClear(&(cli_sendQ(to)));
 
   /*
    * Keep a copy of the last comment, for later use...
    */
-  ircd_strncpy(to->info, notice, REALLEN);
+  ircd_strncpy(cli_info(to), notice, REALLEN);
 
-  if (!IsUser(to) && !IsUnknown(to) && !(to->flags & FLAGS_CLOSING))
-    sendto_opmask_butone(0, SNO_OLDSNO, "%s for %s", to->info, to->name);
-  Debug((DEBUG_ERROR, to->info));
+  if (!IsUser(to) && !IsUnknown(to) && !(cli_flags(to) & FLAGS_CLOSING))
+    sendto_opmask_butone(0, SNO_OLDSNO, "%s for %s", cli_info(to), cli_name(to));
+  Debug((DEBUG_ERROR, cli_info(to)));
 }
 
 static int can_send(struct Client* to)
 {
   assert(0 != to);
-  return (IsDead(to) || IsMe(to) || -1 == to->fd) ? 0 : 1;
+  return (IsDead(to) || IsMe(to) || -1 == cli_fd(to)) ? 0 : 1;
 }
 
 /*
@@ -141,24 +141,24 @@ void flush_sendq_except(void)
 void send_queued(struct Client *to)
 {
   assert(0 != to);
-  assert(0 != to->local);
+  assert(0 != cli_local(to));
 
   if (IsBlocked(to) || !can_send(to))
     return;                     /* Don't bother */
 
-  while (MsgQLength(&to->sendQ) > 0) {
+  while (MsgQLength(&(cli_sendQ(to))) > 0) {
     unsigned int len;
 
-    if ((len = deliver_it(to, &to->sendQ))) {
-      msgq_delete(&to->sendQ, len);
-      to->lastsq = MsgQLength(&to->sendQ) / 1024;
+    if ((len = deliver_it(to, &(cli_sendQ(to))))) {
+      msgq_delete(&(cli_sendQ(to)), len);
+      to->lastsq = MsgQLength(&(cli_sendQ(to))) / 1024;
       if (IsBlocked(to))
         break;
     }
     else {
       if (IsDead(to)) {
         char tmp[512];
-        sprintf(tmp,"Write error: %s",(strerror(to->error)) ? (strerror(to->error)) : "Unknown error" );
+        sprintf(tmp,"Write error: %s",(strerror(cli_error(to))) ? (strerror(cli_error(to))) : "Unknown error" );
         dead_link(to, tmp);
       }
       break;
@@ -171,8 +171,8 @@ void send_buffer(struct Client* to, struct MsgBuf* buf, int prio)
   assert(0 != to);
   assert(0 != buf);
 
-  if (to->from)
-    to = to->from;
+  if (cli_from(to))
+    to = cli_from(to);
 
   if (!can_send(to))
     /*
@@ -180,26 +180,26 @@ void send_buffer(struct Client* to, struct MsgBuf* buf, int prio)
      */
     return;
 
-  if (MsgQLength(&to->sendQ) > get_sendq(to)) {
+  if (MsgQLength(&(cli_sendQ(to))) > get_sendq(to)) {
     if (IsServer(to))
       sendto_opmask_butone(0, SNO_OLDSNO, "Max SendQ limit exceeded for %C: "
-                          "%zu > %zu", to, MsgQLength(&to->sendQ),
+                          "%zu > %zu", to, MsgQLength(&(cli_sendQ(to))),
                           get_sendq(to));
     dead_link(to, "Max sendQ exceeded");
     return;
   }
 
-  Debug((DEBUG_SEND, "Sending [%p] to %s", buf, to->name));
+  Debug((DEBUG_SEND, "Sending [%p] to %s", buf, cli_name(to)));
 
-  msgq_add(&to->sendQ, buf, prio);
+  msgq_add(&(cli_sendQ(to)), buf, prio);
 
   /*
    * Update statistics. The following is slightly incorrect
    * because it counts messages even if queued, but bytes
    * only really sent. Queued bytes get updated in SendQueued.
    */
-  ++to->sendM;
-  ++me.sendM;
+  ++(cli_sendM(to));
+  ++(cli_sendM(&me));
   /*
    * This little bit is to stop the sendQ from growing too large when
    * there is no need for it to. Thus we call send_queued() every time
@@ -208,7 +208,7 @@ void send_buffer(struct Client* to, struct MsgBuf* buf, int prio)
    * trying to flood that link with data (possible during the net
    * relinking done by servers with a large load).
    */
-  if (MsgQLength(&to->sendQ) / 1024 > to->lastsq)
+  if (MsgQLength(&(cli_sendQ(to))) / 1024 > cli_lastsq(to))
     send_queued(to);
 }
 
@@ -224,10 +224,10 @@ static int match_it(struct Client *one, const char *mask, int what)
   switch (what)
   {
     case MATCH_HOST:
-      return (match(mask, one->user->host) == 0);
+      return (match(mask, cli_user(one)->host) == 0);
     case MATCH_SERVER:
     default:
-      return (match(mask, one->user->server->name) == 0);
+      return (match(mask, cli_name(cli_user(one)->server)) == 0);
   }
 }
 
@@ -270,7 +270,7 @@ void vsendcmdto_one(struct Client *from, const char *cmd, const char *tok,
   struct VarData vd;
   struct MsgBuf *mb;
 
-  to = to->from;
+  to = cli_from(to);
 
   vd.vd_format = pattern; /* set up the struct VarData for %v */
   vd.vd_args = vl;
@@ -304,7 +304,7 @@ void sendcmdto_serv_butone(struct Client *from, const char *cmd,
 
   /* send it to our downlinks */
   for (lp = me.serv->down; lp; lp = lp->next) {
-    if (one && lp->value.cptr == one->from)
+    if (one && lp->value.cptr == cli_from(one))
       continue;
     send_buffer(lp->value.cptr, mb, 0);
   }
@@ -338,7 +338,7 @@ void sendcmdto_common_channels(struct Client *from, const char *cmd,
   struct Membership *member;
 
   assert(0 != from);
-  assert(0 != from->from);
+  assert(0 != cli_from(from));
   assert(0 != pattern);
   assert(!IsServer(from) && !IsMe(from));
 
@@ -351,17 +351,17 @@ void sendcmdto_common_channels(struct Client *from, const char *cmd,
   va_end(vd.vd_args);
 
   sentalong_marker++;
-  if (-1 < from->from->fd)
-    sentalong[from->from->fd] = sentalong_marker;
+  if (-1 < cli_fd(cli_from(from)))
+    sentalong[cli_fd(cli_from(from))] = sentalong_marker;
   /*
    * loop through from's channels, and the members on their channels
    */
-  for (chan = from->user->channel; chan; chan = chan->next_channel)
+  for (chan = cli_user(from)->channel; chan; chan = chan->next_channel)
     for (member = chan->channel->members; member;
         member = member->next_member)
-      if (MyConnect(member->user) && -1 < member->user->from->fd &&
-         sentalong[member->user->from->fd] != sentalong_marker) {
-       sentalong[member->user->from->fd] = sentalong_marker;
+      if (MyConnect(member->user) && -1 < cli_fd(cli_from(member->user)) &&
+         sentalong[cli_fd(cli_from(member->user))] != sentalong_marker) {
+       sentalong[cli_fd(cli_from(member->user))] = sentalong_marker;
        send_buffer(member->user, mb, 0);
       }
 
@@ -443,14 +443,14 @@ void sendcmdto_channel_butone(struct Client *from, const char *cmd,
   sentalong_marker++;
   for (member = to->members; member; member = member->next_member) {
     /* skip one, zombies, and deaf users... */
-    if (member->user->from == one || IsZombie(member) ||
+    if (cli_from(member->user) == one || IsZombie(member) ||
        (skip & SKIP_DEAF && IsDeaf(member->user)) ||
        (skip & SKIP_NONOPS && !IsChanOp(member)) ||
-       (skip & SKIP_BURST && IsBurstOrBurstAck(member->user->from)) ||
-       member->user->from->fd < 0 ||
-       sentalong[member->user->from->fd] == sentalong_marker)
+       (skip & SKIP_BURST && IsBurstOrBurstAck(cli_from(member->user))) ||
+       cli_fd(cli_from(member->user)) < 0 ||
+       sentalong[cli_fd(cli_from(member->user))] == sentalong_marker)
       continue;
-    sentalong[member->user->from->fd] = sentalong_marker;
+    sentalong[cli_fd(cli_from(member->user))] = sentalong_marker;
 
     if (MyConnect(member->user)) /* pick right buffer to send */
       send_buffer(member->user, user_mb, 0);
@@ -499,11 +499,12 @@ void sendcmdto_flag_butone(struct Client *from, const char *cmd,
 
   /* send buffer along! */
   sentalong_marker++;
-  for (cptr = GlobalClientList; cptr; cptr = cptr->next) {
-    if (cptr->from == one || IsServer(cptr) || !(cptr->flags & flag) ||
-       cptr->from->fd < 0 || sentalong[cptr->from->fd] == sentalong_marker)
+  for (cptr = GlobalClientList; cptr; cptr = cli_next(cptr)) {
+    if (cli_from(cptr) == one || IsServer(cptr) || !(cli_flags(cptr) & flag) ||
+       cli_fd(cli_from(cptr)) < 0 ||
+       sentalong[cli_fd(cli_from(cptr))] == sentalong_marker)
       continue; /* skip it */
-    sentalong[cptr->from->fd] = sentalong_marker;
+    sentalong[cli_fd(cli_from(cptr))] = sentalong_marker;
 
     if (MyConnect(cptr)) /* send right buffer */
       send_buffer(cptr, user_mb, 1);
@@ -558,11 +559,11 @@ void sendcmdto_match_butone(struct Client *from, const char *cmd,
   /* send buffer along */
   sentalong_marker++;
   for (cptr = GlobalClientList; cptr; cptr = cptr->next) {
-    if (cptr->from == one || IsServer(cptr) || IsMe(cptr) ||
-       !match_it(cptr, to, who) || cptr->from->fd < 0 ||
-       sentalong[cptr->from->fd] == sentalong_marker)
+    if (cli_from(cptr) == one || IsServer(cptr) || IsMe(cptr) ||
+       !match_it(cptr, to, who) || cli_fd(cli_from(cptr)) < 0 ||
+       sentalong[cli_fd(cli_from(cptr))] == sentalong_marker)
       continue; /* skip it */
-    sentalong[cptr->from->fd] = sentalong_marker;
+    sentalong[cli_fd(cli_from(cptr))] = sentalong_marker;
 
     if (MyConnect(cptr)) /* send right buffer */
       send_buffer(cptr, user_mb, 0);
index 47f774f687bc2cc9b04ce1d3b0b2fda89311ed4e..775ad39dcf77df1e94c7b1dbdd068b5c1f9a824e 100644 (file)
@@ -82,7 +82,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
       !IsChannelService(acptr))
   {
     struct Membership* chan;
-    for (chan = acptr->user->channel; chan && !chptr; chan = chan->next_channel)
+    for (chan = cli_user(acptr)->channel; chan && !chptr; chan = chan->next_channel)
       if (PubChannel(chan->channel) &&
           (acptr == sptr || !IsZombie(chan)))
         chptr = chan->channel;
@@ -112,35 +112,35 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (!fields || (fields & WHO_FIELD_UID))
   {
-    char *p2 = acptr->user->username;
+    char *p2 = cli_user(acptr)->username;
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
 
   if (fields & WHO_FIELD_NIP)
   {
-    const char* p2 = ircd_ntoa((const char*) &acptr->ip);
+    const char* p2 = ircd_ntoa((const char*) &(cli_ip(acptr)));
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
 
   if (!fields || (fields & WHO_FIELD_HOS))
   {
-    char *p2 = acptr->user->host;
+    char *p2 = cli_user(acptr)->host;
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
 
   if (!fields || (fields & WHO_FIELD_SER))
   {
-    char *p2 = acptr->user->server->name;
+    char *p2 = cli_name(cli_user(acptr)->server);
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
 
   if (!fields || (fields & WHO_FIELD_NIC))
   {
-    char *p2 = acptr->name;
+    char *p2 = cli_name(acptr);
     *(p1++) = ' ';
     while ((*p2) && (*(p1++) = *(p2++)));
   }
@@ -148,7 +148,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
   if (!fields || (fields & WHO_FIELD_FLA))
   {
     *(p1++) = ' ';
-    if (acptr->user->away)
+    if (cli_user(acptr)->away)
       *(p1++) = 'G';
     else
       *(p1++) = 'H';
@@ -192,14 +192,14 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
     *p1++ = ' ';
     if (!fields)
       *p1++ = ':';              /* Place colon here for default reply */
-    p1 = sprintf_irc(p1, "%d", acptr->hopcount);
+    p1 = sprintf_irc(p1, "%d", cli_hopcount(acptr));
   }
 
   if (fields & WHO_FIELD_IDL)
   {
     *p1++ = ' ';
     if (MyUser(acptr)) {
-           p1 = sprintf_irc(p1, "%d", CurrentTime - acptr->user->last);
+           p1 = sprintf_irc(p1, "%d", CurrentTime - cli_user(acptr)->last);
     }    
     else {
            *p1++ = '0';
@@ -208,7 +208,7 @@ void do_who(struct Client* sptr, struct Client* acptr, struct Channel* repchan,
 
   if (!fields || (fields & WHO_FIELD_REN))
   {
-    char *p2 = acptr->info;
+    char *p2 = cli_info(acptr);
     *p1++ = ' ';
     if (fields)
       *p1++ = ':';              /* Place colon here for special reply */
index 9f9c19588b1bcc5bb5ef441bb8dd888860100739..b8b12f3b706db721e8d317a690b6d9d3fe6666f0 100644 (file)
@@ -183,16 +183,16 @@ void add_history(struct Client *cptr, int still_on)
   }
 
   /* Initialize aWhoWas struct `newww' */
-  ww.newww->hashv = hash_whowas_name(cptr->name);
+  ww.newww->hashv = hash_whowas_name(cli_name(cptr));
   ww.newww->logoff = CurrentTime;
-  DupString(ww.newww->name, cptr->name);
-  DupString(ww.newww->username, cptr->user->username);
-  DupString(ww.newww->hostname, cptr->user->host);
+  DupString(ww.newww->name, cli_name(cptr));
+  DupString(ww.newww->username, cli_user(cptr)->username);
+  DupString(ww.newww->hostname, cli_user(cptr)->host);
   /* Should be changed to server numeric */
-  DupString(ww.newww->servername, cptr->user->server->name);
-  DupString(ww.newww->realname, cptr->info);
+  DupString(ww.newww->servername, cli_name(cli_user(cptr)->server));
+  DupString(ww.newww->realname, cli_info(cptr));
   if (cptr->user->away)
-    DupString(ww.newww->away, cptr->user->away);
+    DupString(ww.newww->away, cli_user(cptr)->away);
   else
     ww.newww->away = NULL;
 
@@ -201,10 +201,10 @@ void add_history(struct Client *cptr, int still_on)
   {
     ww.newww->online = cptr;
     /* Add struct Whowas struct `newww' to start of 'online list': */
-    if ((ww.newww->cnext = cptr->whowas))
+    if ((ww.newww->cnext = cli_whowas(cptr)))
       ww.newww->cnext->cprevnextp = &ww.newww->cnext;
-    ww.newww->cprevnextp = &cptr->whowas;
-    cptr->whowas = ww.newww;
+    ww.newww->cprevnextp = &(cli_whowas(cptr));
+    cli_whowas(cptr) = ww.newww;
   }
   else                          /* User quitting */
     ww.newww->online = NULL;
@@ -230,7 +230,7 @@ void off_history(const struct Client *cptr)
 {
   struct Whowas *temp;
 
-  for (temp = cptr->whowas; temp; temp = temp->cnext)
+  for (temp = cli_whowas(cptr); temp; temp = temp->cnext)
     temp->online = NULL;
 }