Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2006-07-24 02:08:43 UTC

Modified files:
     ChangeLog include/channel.h include/send.h include/struct.h
     ircd/channel.c ircd/m_invite.c ircd/m_join.c ircd/s_debug.c
     ircd/s_misc.c ircd/s_user.c

Log message:

Implement new ANNOUNCE_INVITES handling code.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.807 ircu2.10/ChangeLog:1.808
--- ircu2.10/ChangeLog:1.807    Sun Jul 23 19:00:29 2006
+++ ircu2.10/ChangeLog  Sun Jul 23 19:08:33 2006
@@ -1,5 +1,41 @@
 2006-07-23  Michael Poole <[EMAIL PROTECTED]>
 
+       * include/channel.h (struct Invite): New structure.
+       (struct Channel): Change type of invites field.
+       (IsInvited): Rename to is_invited; change return type.
+       (add_invite): Declare function.
+
+       * include/send.h (SKIP_LOCALS): Remove definition.
+
+       * include/struct.h (struct Invite): Declare
+       (struct User): Change type of invited field; remove invites.
+
+       * ircd/channel.c (sub1_from_channel): Use mode_invite_clear() to
+       clear the channel's invite list.
+       (destruct_channel): Likewise.
+       (IsInvited): Rename to is_invited and rework significantly.
+       (invite_freelist): New file-scope variable.
+       (add_invite): Rewrite function.
+       (del_invite): Rewrite function.
+       (mode_invite_clear): Adapt to new struct Invite.
+
+       * ircd/m_invite.c (list_length): Delete function.
+       (add_invite): Delete function (it moved to channel.c).
+       (m_invite): Adapt to new struct Invite and add_invite().  Remove
+       old ANNOUNCE_INVITES handling.
+       (ms_invite): Adapt to new add_invite().  Remove old
+       ANNOUNCE_INVITES handling.
+
+       * ircd/m_join.c (m_join): Add new ANNOUNCE_INVITES handling.
+
+       * ircd/s_debug.c (count_memory): Adapt to new struct Invite.
+
+       * ircd/s_misc.c (exit_one_client): Adapt to new struct Invite.
+
+       * ircd/s_user.c (check_target_limit): Rename IsInvited().
+
+2006-07-23  Michael Poole <[EMAIL PROTECTED]>
+
        * include/msg.h (CMD_WALLCHOPS): Change to what is actually used.
        (CMD_WALLVOICES): Likewise.
 
Index: ircu2.10/include/channel.h
diff -u ircu2.10/include/channel.h:1.60 ircu2.10/include/channel.h:1.61
--- ircu2.10/include/channel.h:1.60     Mon Jul 17 15:52:11 2006
+++ ircu2.10/include/channel.h  Sun Jul 23 19:08:33 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance.
- * @version $Id: channel.h,v 1.60 2006/07/17 22:52:11 entrope Exp $
+ * @version $Id: channel.h,v 1.61 2006/07/24 02:08:33 entrope Exp $
  */
 #ifndef INCLUDED_channel_h
 #define INCLUDED_channel_h
@@ -250,6 +250,15 @@
   char banstr[NICKLEN+USERLEN+HOSTLEN+3];  /**< hostmask that the ban matches 
*/
 };
 
+/** An invitation to a channel. */
+struct Invite {
+  struct Invite*     next_user;    /**< next invite to the user */
+  struct Invite*     next_channel; /**< next invite to the channel */
+  struct Client*     user;         /**< user being invited */
+  struct Channel*    channel;      /**< channel to which invited */
+  char inviter[NICKLEN+USERLEN+HOSTLEN+3]; /**< hostmask of inviter */
+};
+
 /** Information about a channel */
 struct Channel {
   struct Channel*    next;     /**< next channel in the global channel list */
@@ -260,7 +269,7 @@
   time_t             topic_time;   /**< Modification time of the topic */
   unsigned int       users;       /**< Number of clients on this channel */
   struct Membership* members;     /**< Pointer to the clients on this channel*/
-  struct SLink*      invites;     /**< List of invites on this channel */
+  struct Invite*     invites;     /**< List of invites on this channel */
   struct Ban*        banlist;      /**< List of bans on this channel */
   struct Mode        mode;        /**< This channels mode */
   char               topic[TOPICLEN + 1]; /**< Channels topic */
@@ -380,14 +389,10 @@
 extern void remove_user_from_all_channels(struct Client* cptr);
 
 extern int is_chan_op(struct Client *cptr, struct Channel *chptr);
-/*
-   NOTE: pointer is compared, and not dereferenced, called by
-   add_target with a void*, since targets could be anything,
-   this function can't make any assumptions that it has a channel
-*/
-extern int IsInvited(struct Client* cptr, const void* chptr);
 extern void send_channel_modes(struct Client *cptr, struct Channel *chptr);
 extern char *pretty_mask(char *mask);
+extern struct Invite* is_invited(struct Client* cptr, struct Channel* chptr);
+extern void add_invite(struct Client *cptr, struct Channel *chptr, struct 
Client *inviter);
 extern void del_invite(struct Client *cptr, struct Channel *chptr);
 extern void list_set_default(void); /* this belongs elsewhere! */
 extern void check_spambot_warning(struct Client *cptr);
Index: ircu2.10/include/send.h
diff -u ircu2.10/include/send.h:1.24 ircu2.10/include/send.h:1.25
--- ircu2.10/include/send.h:1.24        Sun Jul 23 11:04:21 2006
+++ ircu2.10/include/send.h     Sun Jul 23 19:08:33 2006
@@ -1,6 +1,6 @@
 /** @file send.h
  * @brief Send messages to certain targets.
- * @version $Id: send.h,v 1.24 2006/07/23 18:04:21 entrope Exp $
+ * @version $Id: send.h,v 1.25 2006/07/24 02:08:33 entrope Exp $
  */
 #ifndef INCLUDED_send_h
 #define INCLUDED_send_h
@@ -74,7 +74,6 @@
 #define SKIP_NONVOICES  0x08    /**< skip users that aren't voiced (includes
                                    chanops) */
 #define SKIP_SERVERS    0x10    /**< skip server links */
-#define SKIP_LOCALS     0x20    /**< skip local clients */
 
 /* Send command to all users having a particular flag set */
 extern void sendwallto_group(struct Client *from, int type, 
Index: ircu2.10/include/struct.h
diff -u ircu2.10/include/struct.h:1.9 ircu2.10/include/struct.h:1.10
--- ircu2.10/include/struct.h:1.9       Wed Mar 30 20:05:55 2005
+++ ircu2.10/include/struct.h   Sun Jul 23 19:08:33 2006
@@ -20,7 +20,7 @@
  */
 /** @file
  * @brief Structure definitions for users and servers.
- * @version $Id: struct.h,v 1.9 2005/03/31 04:05:55 entrope Exp $
+ * @version $Id: struct.h,v 1.10 2006/07/24 02:08:33 entrope Exp $
  */
 #ifndef INCLUDED_struct_h
 #define INCLUDED_struct_h
@@ -36,6 +36,7 @@
 struct Client;
 struct User;
 struct Membership;
+struct Invite;
 struct SLink;
 
 /** Describes a server on the network. */
@@ -66,13 +67,12 @@
 struct User {
   struct Client*     server;         /**< client structure of server */
   struct Membership* channel;        /**< chain of channel pointer blocks */
-  struct SLink*      invited;        /**< chain of invite pointer blocks */
+  struct Invite*     invited;        /**< chain of invite pointer blocks */
   struct Ban*        silence;        /**< chain of silence pointer blocks */
   char*              away;           /**< pointer to away message */
   time_t             last;           /**< last time user sent a message */
   unsigned int       refcnt;         /**< Number of times this block is 
referenced */
   unsigned int       joined;         /**< number of channels joined */
-  unsigned int       invites;        /**< Number of channels we've been 
invited to */
   /** Remote account name.  Before registration is complete, this is
    * either empty or contains the username from the USER command.
    * After registration, that may be prefixed with ~ or it may be
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.173 ircu2.10/ircd/channel.c:1.174
--- ircu2.10/ircd/channel.c:1.173       Sun Jul 23 11:04:21 2006
+++ ircu2.10/ircd/channel.c     Sun Jul 23 19:08:33 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.173 2006/07/23 18:04:21 entrope Exp $
+ * @version $Id: channel.c,v 1.174 2006/07/24 02:08:33 entrope Exp $
  */
 #include "config.h"
 
@@ -294,8 +294,7 @@
     struct Ban *link, *next;
     chptr->mode.mode = 0;
     *chptr->mode.key = '\0';
-    while (chptr->invites)
-      del_invite(chptr->invites->value.cptr, chptr);
+    mode_invite_clear(chptr);
     for (link = chptr->banlist; link; link = next) {
       next = link->next;
       free_ban(link);
@@ -336,8 +335,7 @@
   /*
    * Now, find all invite links from channel structure
    */
-  while (chptr->invites)
-    del_invite(chptr->invites->value.cptr, chptr);
+  mode_invite_clear(chptr);
 
   for (ban = chptr->banlist; ban; ban = next)
   {
@@ -1240,6 +1238,83 @@
   return chptr;
 }
 
+/** Find invitation (if any) for \a cptr to \a chptr.
+ * @param[in] cptr Possibly invited client.
+ * @param[in] chptr Channel to search for.
+ * @return A pointer to the relevant struct Invite, or NULL if not invited.
+ */
+struct Invite *is_invited(struct Client* cptr, struct Channel* chptr)
+{
+  struct Invite *ip;
+
+  for (ip = (cli_user(cptr))->invited; ip; ip = ip->next_user)
+    if (ip->channel == chptr)
+      return ip;
+
+  return 0;
+}
+
+static struct Invite *invite_freelist;
+
+/** Invite a user to a channel.
+ *
+ * Adds an invite for a user to a channel.  Limits the number of invites
+ * to FEAT_MAXCHANNELSPERUSER.  Does not notify the user.
+ *
+ * @param[in] cptr     The client to be invited.
+ * @param[in] chptr    The channel to be invited to.
+ * @param[in] inviter  The client inviting \a cptr.
+ */
+void add_invite(struct Client *cptr, struct Channel *chptr, struct Client 
*inviter)
+{
+  struct Invite **uprev = &cli_user(cptr)->invited;
+  struct Invite *inv;
+  int max = feature_int(FEAT_MAXCHANNELSPERUSER);
+  int count = 0;
+
+  /* See if the user is already invited. */
+  while ((inv = *uprev) != NULL)
+  {
+    if (inv->channel == chptr)
+      break;
+    else if (++count >= max)
+      del_invite(cptr, inv->channel);
+    else
+      uprev = &inv->next_user;
+  }
+
+  if (inv) {
+    /* Remove from the user's invite list. */
+    *uprev = inv->next_user;
+    /* Search for end of invite list. */
+    while ((*uprev)->next_user)
+      uprev = &(*uprev)->next_user;
+  } else {
+    /* Find or allocate an Invite struct. */
+    if (invite_freelist) {
+      inv = invite_freelist;
+      invite_freelist = inv->next_user;
+    } else {
+      inv = MyCalloc(1, sizeof(*inv));
+    }
+
+    /* Set client and channel fields; add to channel list. */
+    inv->user = cptr;
+    inv->channel = chptr;
+    inv->next_channel = chptr->invites;
+    chptr->invites = inv;
+  }
+
+  /* Add to the user's invite list. */
+  assert(uprev != NULL);
+  *uprev = inv;
+
+  /* Set the remaining fields. */
+  ircd_snprintf(NULL, inv->inviter, sizeof(inv->inviter) - 1,
+                "%#C", inviter);
+  inv->next_user = NULL;
+}
+
 /** Delete an invite
  * Delete Invite block from channel invite list and client invite list
  *
@@ -1248,26 +1323,31 @@
  */
 void del_invite(struct Client *cptr, struct Channel *chptr)
 {
-  struct SLink **inv, *tmp;
+  struct Invite **inv, *tmp;
 
-  for (inv = &(chptr->invites); (tmp = *inv); inv = &tmp->next)
-    if (tmp->value.cptr == cptr)
+  /* Remove from channel's invite list. */
+  for (inv = &(chptr->invites); (tmp = *inv); inv = &tmp->next_channel)
+    if (tmp->user == cptr)
     {
-      *inv = tmp->next;
-      free_link(tmp);
-      tmp = 0;
-      (cli_user(cptr))->invites--;
+      *inv = tmp->next_channel;
       break;
     }
 
-  for (inv = &((cli_user(cptr))->invited); (tmp = *inv); inv = &tmp->next)
-    if (tmp->value.chptr == chptr)
+  /* If nothing found, bail. */
+  if (!tmp)
+    return;
+
+  /* Remove from client's invite list. */
+  for (inv = &((cli_user(cptr))->invited); (tmp = *inv); inv = &tmp->next_user)
+    if (tmp->channel == chptr)
     {
-      *inv = tmp->next;
-      free_link(tmp);
-      tmp = 0;
+      *inv = tmp->next_user;
       break;
     }
+
+  /* Append to freelist of invites. */
+  tmp->next_user = invite_freelist;
+  invite_freelist = tmp;
 }
 
 /** @page zombie Explanation of Zombies
@@ -2087,7 +2167,7 @@
 mode_invite_clear(struct Channel *chan)
 {
   while (chan->invites)
-    del_invite(chan->invites->value.cptr, chan);
+    del_invite(chan->invites->user, chan);
 }
 
 /* What we've done for mode_parse so far... */
@@ -3456,17 +3536,6 @@
   return 0;
 }
 
-/* Returns TRUE (1) if client is invited, FALSE (0) if not */
-int IsInvited(struct Client* cptr, const void* chptr)
-{
-  struct SLink *lp;
-
-  for (lp = (cli_user(cptr))->invited; lp; lp = lp->next)
-    if (lp->value.chptr == chptr)
-      return 1;
-  return 0;
-}
-
 /** Check whether \a sptr is acting like a spambot when it leaves a
  * channel.
  * Side effects: Updates \a sptr's join_part_count, last_part and
Index: ircu2.10/ircd/m_invite.c
diff -u ircu2.10/ircd/m_invite.c:1.28 ircu2.10/ircd/m_invite.c:1.29
--- ircu2.10/ircd/m_invite.c:1.28       Sun Jul 23 11:04:21 2006
+++ ircu2.10/ircd/m_invite.c    Sun Jul 23 19:08:33 2006
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_invite.c,v 1.28 2006/07/23 18:04:21 entrope Exp $
+ * $Id: m_invite.c,v 1.29 2006/07/24 02:08:33 entrope Exp $
  */
 
 #include "config.h"
@@ -43,59 +43,6 @@
 
 /* #include <assert.h> -- Now using assert in ircd_log.h */
 
-#if !defined(NDEBUG)
-/** return the length (>=0) of a chain of links.
- * @param lp   pointer to the start of the linked list
- * @return the number of items in the list
- */
-static unsigned int list_length(struct SLink *lp)
-{
-  unsigned int count = 0;
-
-  for (; lp; lp = lp->next)
-    ++count;
-  return count;
-}
-#endif
-
-/** invite a user to a channel.
- *
- * Adds an invite for a user to a channel.  Limits the number of invites
- * to FEAT_MAXCHANNELSPERUSER.  Does not sent notification to the user.
- *
- * @param cptr The client to be invited.
- * @param chptr        The channel to be invited to.
- */
-static void add_invite(struct Client *cptr, struct Channel *chptr)
-{
-  struct SLink *inv, **tmp;
-
-  del_invite(cptr, chptr);
-  /*
-   * Delete last link in chain if the list is max length
-   */
-  assert(list_length((cli_user(cptr))->invited) == (cli_user(cptr))->invites);
-  if ((int)(cli_user(cptr))->invites >= feature_int(FEAT_MAXCHANNELSPERUSER))
-    del_invite(cptr, (cli_user(cptr))->invited->value.chptr);
-  /*
-   * Add client to channel invite list
-   */
-  inv = make_link();
-  inv->value.cptr = cptr;
-  inv->next = chptr->invites;
-  chptr->invites = inv;
-  /*
-   * Add channel to the end of the client invite list
-   */
-  for (tmp = &((cli_user(cptr))->invited); *tmp; tmp = &((*tmp)->next));
-  inv = make_link();
-  inv->value.chptr = chptr;
-  inv->next = NULL;
-  (*tmp) = inv;
-  (cli_user(cptr))->invites++;
-}
-
-
 /** Handle an INVITE from a local client.
  *
  * \a parv has the following elements:
@@ -121,18 +68,18 @@
 {
   struct Client *acptr;
   struct Channel *chptr;
-  
-  if (parc < 2 ) { 
+
+  if (parc < 2 ) {
     /*
      * list the channels you have an invite to.
      */
-    struct SLink *lp;
-    for (lp = cli_user(sptr)->invited; lp; lp = lp->next)
-      send_reply(cptr, RPL_INVITELIST, lp->value.chptr->chname);
+    struct Invite *ip;
+    for (ip = cli_user(sptr)->invited; ip; ip = ip->next_user)
+      send_reply(cptr, RPL_INVITELIST, ip->channel->chname);
     send_reply(cptr, RPL_ENDOFINVITELIST);
     return 0;
   }
-  
+
   if (parc < 3 || EmptyString(parv[2]))
     return need_more_params(sptr, "INVITE");
 
@@ -177,28 +124,13 @@
     send_reply(sptr, RPL_AWAY, cli_name(acptr), cli_user(acptr)->away);
 
   if (MyConnect(acptr)) {
-    add_invite(acptr, chptr);
+    add_invite(acptr, chptr, sptr);
     sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
   } else if (!IsLocalChannel(chptr->chname)) {
     sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr,
                   chptr->creationtime);
   }
 
-  if (!IsLocalChannel(chptr->chname) || MyConnect(acptr)) {
-    if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
-      /* Announce to channel operators. */
-      sendcmdto_channel(&his, get_error_numeric(RPL_ISSUEDINVITE)->str,
-                        NULL, chptr, sptr, SKIP_NONOPS | SKIP_SERVERS,
-                        "%H %C %C :%C has been invited by %C",
-                        chptr, acptr, sptr, acptr, sptr);
-      /* Announce to servers with channel operators. */
-      sendcmdto_channel(sptr, NULL, TOK_INVITE, chptr, acptr,
-                        SKIP_NONOPS | SKIP_LOCALS,
-                        "%s %H %Tu", cli_name(acptr),
-                        chptr, chptr->creationtime);
-    }
-  }
-
   return 0;
 }
 
@@ -288,25 +220,12 @@
     return 0;
 
   if (MyConnect(acptr)) {
-    add_invite(acptr, chptr);
+    add_invite(acptr, chptr, sptr);
     sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H", cli_name(acptr), chptr);
   } else {
     sendcmdto_one(sptr, CMD_INVITE, acptr, "%s %H %Tu", cli_name(acptr), chptr,
                   chptr->creationtime);
   }
 
-  if (feature_bool(FEAT_ANNOUNCE_INVITES)) {
-    /* Announce to channel operators. */
-    sendcmdto_channel(&his, get_error_numeric(RPL_ISSUEDINVITE)->str,
-                      NULL, chptr, sptr, SKIP_NONOPS | SKIP_SERVERS,
-                      "%H %C %C :%C has been invited by %C",
-                      chptr, acptr, sptr, acptr, sptr);
-    /* Announce to servers with channel operators. */
-    sendcmdto_channel(sptr, NULL, TOK_INVITE, chptr, acptr,
-                      SKIP_NONOPS | SKIP_LOCALS,
-                      "%s %H %Tu", cli_name(acptr), chptr,
-                      chptr->creationtime);
-  }
-
   return 0;
 }
Index: ircu2.10/ircd/m_join.c
diff -u ircu2.10/ircd/m_join.c:1.47 ircu2.10/ircd/m_join.c:1.48
--- ircu2.10/ircd/m_join.c:1.47 Sun Jul 23 11:04:21 2006
+++ ircu2.10/ircd/m_join.c      Sun Jul 23 19:08:33 2006
@@ -20,7 +20,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: m_join.c,v 1.47 2006/07/23 18:04:21 entrope Exp $
+ * $Id: m_join.c,v 1.48 2006/07/24 02:08:33 entrope Exp $
  */
 
 #include "config.h"
@@ -178,6 +178,7 @@
     } else if (check_target_limit(sptr, chptr, chptr->chname, 0)) {
       continue;
     } else {
+      struct Invite *invite;
       int flags = 0;
       int err = 0;
 
@@ -191,8 +192,6 @@
         /* Joining a zombie channel (zannel): give ops and increment TS. */
         flags = CHFL_CHANOP;
         chptr->creationtime++;
-      } else if (IsInvited(sptr, chptr)) {
-        /* Invites bypass these other checks. */
       } else if (chptr->mode.mode & MODE_INVITEONLY)
         err = ERR_INVITEONLYCHAN;
       else if (chptr->mode.limit && (chptr->users >= chptr->mode.limit))
@@ -204,6 +203,19 @@
       else if (*chptr->mode.key && (!key || strcmp(key, chptr->mode.key)))
         err = ERR_BADCHANNELKEY;
 
+      /* If the user is invited, s/he can bypass the normal errors. */
+      if (err && feature_bool(FEAT_ANNOUNCE_INVITES)
+          && (invite = is_invited(sptr, chptr))) {
+        const struct Numeric *num;
+        num = get_error_numeric(RPL_ISSUEDINVITE);
+        sendcmdto_channel(&me, num->str, num->str, chptr, cptr,
+                          SKIP_NONOPS | SKIP_BURST,
+                          "%H %s %s :%s has been invited by %s",
+                          chptr, cli_name(sptr), invite->inviter,
+                          cli_name(sptr), invite->inviter);
+        err = 0;
+      }
+
       /* An oper with WALK_LCHAN privilege can join a local channel
        * he otherwise could not join by using "OVERRIDE" as the key.
        * This will generate a HACK(4) notice, but fails if the oper
Index: ircu2.10/ircd/s_debug.c
diff -u ircu2.10/ircd/s_debug.c:1.42 ircu2.10/ircd/s_debug.c:1.43
--- ircu2.10/ircd/s_debug.c:1.42        Wed Dec 28 20:55:16 2005
+++ ircu2.10/ircd/s_debug.c     Sun Jul 23 19:08:33 2006
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Debug support for the ircd.
- * @version $Id: s_debug.c,v 1.42 2005/12/29 04:55:16 entrope Exp $
+ * @version $Id: s_debug.c,v 1.43 2006/07/24 02:08:33 entrope Exp $
  */
 #include "config.h"
 
@@ -206,6 +206,7 @@
                   char *param)
 {
   struct Client *acptr;
+  struct Invite *inv;
   struct SLink *link;
   struct Ban *ban;
   struct Channel *chptr;
@@ -218,7 +219,6 @@
       cn = 0,                   /* connections */
       ch = 0,                   /* channels */
       lcc = 0,                  /* local client conf links */
-      chi = 0,                  /* channel invites */
       chb = 0,                  /* channel bans */
       wwu = 0,                  /* whowas users */
       cl = 0,                   /* classes */
@@ -267,7 +267,7 @@
     }
     if (cli_user(acptr))
     {
-      for (link = cli_user(acptr)->invited; link; link = link->next)
+      for (inv = cli_user(acptr)->invited; inv; inv = inv->next_user)
         usi++;
       for (member = cli_user(acptr)->channel; member; member = 
member->next_channel)
         ++memberships;
@@ -289,8 +289,6 @@
   {
     ch++;
     chm += (strlen(chptr->chname) + sizeof(struct Channel));
-    for (link = chptr->invites; link; link = link->next)
-      chi++;
     for (ban = chptr->banlist; ban; ban = ban->next)
     {
       chb++;
@@ -315,7 +313,7 @@
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
             ":Users %zu(%zu) Accounts %d(%zu) Invites %d(%zu)",
              us, usm, acc, acc * (ACCOUNTLEN + 1),
-            usi, usi * sizeof(struct SLink));
+            usi, usi * sizeof(struct Invite));
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
             ":User channels %d(%zu) Aways %d(%zu)", memberships,
             memberships * sizeof(struct Membership), aw, awm);
@@ -330,11 +328,10 @@
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
             ":Channels %d(%zu) Bans %d(%zu)", ch, chm, chb, chbm);
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
-            ":Channel Members %d(%zu) Invites %d(%zu)", memberships,
-            memberships * sizeof(struct Membership), chi,
-            chi * sizeof(struct SLink));
+            ":Channel Members %d(%zu)", memberships,
+            memberships * sizeof(struct Membership));
 
-  totch = chm + chbm + chi * sizeof(struct SLink);
+  totch = chm + chbm;
 
   send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG,
             ":Whowas Users %d(%zu) Away %d(%zu) Array %d(%zu)",
Index: ircu2.10/ircd/s_misc.c
diff -u ircu2.10/ircd/s_misc.c:1.54 ircu2.10/ircd/s_misc.c:1.55
--- ircu2.10/ircd/s_misc.c:1.54 Sun Jul 23 11:04:22 2006
+++ ircu2.10/ircd/s_misc.c      Sun Jul 23 19:08:33 2006
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous support functions.
- * @version $Id: s_misc.c,v 1.54 2006/07/23 18:04:22 entrope Exp $
+ * @version $Id: s_misc.c,v 1.55 2006/07/24 02:08:33 entrope Exp $
  */
 #include "config.h"
 
@@ -180,7 +180,7 @@
 /* Rewritten by Run - 24 sept 94 */
 static void exit_one_client(struct Client* bcptr, const char* comment)
 {
-  struct SLink *lp;
+  struct Invite *ip;
   struct Ban *bp;
 
   if (cli_serv(bcptr) && cli_serv(bcptr)->client_list)  /* Was SetServerYXX 
called ? */
@@ -209,8 +209,8 @@
     remove_user_from_all_channels(bcptr);
 
     /* Clean up invitefield */
-    while ((lp = cli_user(bcptr)->invited))
-      del_invite(bcptr, lp->value.chptr);
+    while ((ip = cli_user(bcptr)->invited))
+      del_invite(bcptr, ip->channel);
 
     /* Clean up silencefield */
     while ((bp = cli_user(bcptr)->silence)) {
Index: ircu2.10/ircd/s_user.c
diff -u ircu2.10/ircd/s_user.c:1.107 ircu2.10/ircd/s_user.c:1.108
--- ircu2.10/ircd/s_user.c:1.107        Sun Jul 23 17:29:17 2006
+++ ircu2.10/ircd/s_user.c      Sun Jul 23 19:08:33 2006
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Miscellaneous user-related helper functions.
- * @version $Id: s_user.c,v 1.107 2006/07/24 00:29:17 entrope Exp $
+ * @version $Id: s_user.c,v 1.108 2006/07/24 02:08:33 entrope Exp $
  */
 #include "config.h"
 
@@ -742,7 +742,7 @@
   targets = cli_targets(sptr);
 
   /* If user is invited to channel, give him/her a free target */
-  if (IsChannelName(name) && IsInvited(sptr, target))
+  if (IsChannelName(name) && is_invited(sptr, target))
     return 0;
 
   /*
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to