Author: Greg Sikorski <gte@atomicrevs.demon.co.uk>
authorGreg Sikorski <gte@atomicrevs.demon.co.uk>
Thu, 28 Sep 2000 18:40:50 +0000 (18:40 +0000)
committerGreg Sikorski <gte@atomicrevs.demon.co.uk>
Thu, 28 Sep 2000 18:40:50 +0000 (18:40 +0000)
Log message:

Switch logic in m_names to avoid an assert() while debugging.

--Gte

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

ChangeLog
ircd/m_names.c

index 76d9b4762bedf4a16b4ad16f69371a34382ae2ad..ea80cfc4537a81fd8929eea71950781a9d509e30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2000-09-28  Greg Sikorski <gte@atomicrevs.demon.co.uk>
+       * ircd/m_names.c: Fixed a non-lethal logic error that 
+       triggers an assert() in find_member_link while debugging.
+       (Spotted by Maniac-).
 2000-09-19  Thomas Helvey <helveytw@home.com>
        * ircd/s_conf.c: move K:lines to their own list and data
        structures, add supporting code.
index 072b567dd94bdec4894635fea9eaace16c6bb409..330b6f8e0183f223964d73810cd647a4d8dd00a1 100644 (file)
@@ -317,30 +317,28 @@ int m_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   clean_channelname(para);
   chptr = FindChannel(para); 
-  member = find_member_link(chptr, sptr); 
-  if (member)
-  { 
-    if (chptr) do_names(sptr, chptr, NAMES_ALL);
-    if (!EmptyString(para))
-    {
-      send_reply(sptr, RPL_ENDOFNAMES, chptr ? chptr->chname : para);
-      return 1;
+
+  if (chptr) {
+    member = find_member_link(chptr, sptr);
+    if (member)
+    { 
+      do_names(sptr, chptr, NAMES_ALL);
+      if (!EmptyString(para))
+      {
+        send_reply(sptr, RPL_ENDOFNAMES, chptr ? chptr->chname : para);
+        return 1;
+      }
     }
-  }
-    else
-  {
-    /*
-     *  Special Case 3: User isn't on this channel, show all visible users, in 
-     *  non secret channels.
-     */
-     
-    if (chptr) do_names(sptr, chptr, NAMES_VIS);
-    if (!EmptyString(para))
+      else 
     {
-      send_reply(sptr, RPL_ENDOFNAMES, para);
-      return 1;
-    }
+      /*
+       *  Special Case 3: User isn't on this channel, show all visible users, in 
+       *  non secret channels.
+       */ 
+      do_names(sptr, chptr, NAMES_VIS);
+    } 
+  } else { /* Channel doesn't exist. */ 
+      send_reply(sptr, RPL_ENDOFNAMES, para); 
   }
   return 1;
 }
@@ -460,32 +458,29 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   clean_channelname(para);
   chptr = FindChannel(para); 
-  member = find_member_link(chptr, sptr); 
-  if (member)
-  { 
-    if (chptr) do_names(sptr, chptr, NAMES_ALL);
-    if (!EmptyString(para))
-    {
-      send_reply(sptr, RPL_ENDOFNAMES, chptr ? chptr->chname : para);
-      return 1;
-    }
 
-  }
-    else
-  {
-    /*
-     *  Special Case 3: User isn't on this channel, show all visible users, in 
-     *  non secret channels.
-     */
-     
-    if (chptr) do_names(sptr, chptr, NAMES_VIS);
-    if (!EmptyString(para))
-    {
-      send_reply(sptr, RPL_ENDOFNAMES, para);
-      return 1;
+  if (chptr) {
+    member = find_member_link(chptr, sptr);
+    if (member)
+    { 
+      do_names(sptr, chptr, NAMES_ALL);
+      if (!EmptyString(para))
+      {
+        send_reply(sptr, RPL_ENDOFNAMES, chptr ? chptr->chname : para);
+        return 1;
+      }
     }
-  } 
+      else 
+    {
+      /*
+       *  Special Case 3: User isn't on this channel, show all visible users, in 
+       *  non secret channels.
+       */ 
+      do_names(sptr, chptr, NAMES_VIS);
+    } 
+  } else { /* Channel doesn't exist. */ 
+      send_reply(sptr, RPL_ENDOFNAMES, para); 
+  }
   return 1;
 }