Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_names.c
index 1ccb30489a66e6b7565c19592840cb0c651d7b80..01df99181ae0892a2b33c05f5b0da1d5c71322df 100644 (file)
  */
 #include "config.h"
 
-#if 0
-/*
- * No need to include handlers.h here the signatures must match
- * and we don't need to force a rebuild of all the handlers everytime
- * we add a new one to the list. --Bleep
- */
-#include "handlers.h"
-#endif /* 0 */
 #include "channel.h"
 #include "client.h"
 #include "hash.h"
@@ -490,206 +482,3 @@ int ms_names(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   }
   return 1;
 }
-
-#if 0
-/*
- * m_names                              - Added by Jto 27 Apr 1989
- *
- * parv[0] = sender prefix
- * parv[1] = channel
- */
-int m_names(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  struct Channel *chptr;
-  struct Client *c2ptr;
-  struct Membership* member;
-  struct Channel *ch2ptr = 0;
-  int idx, flag, len, mlen;
-  char *s, *para = parc > 1 ? parv[1] : 0;
-  char buf[BUFSIZE];
-
-  if (parc > 2 && hunt_server(1, cptr, sptr, "%s%s " TOK_NAMES " %s %s", 2, parc, parv)) /* XXX DEAD */
-    return 0;
-
-  mlen = strlen(me.name) + 10 + strlen(sptr->name);
-
-  if (!EmptyString(para))
-  {
-    s = strchr(para, ',');
-    if (s)
-    {
-      parv[1] = ++s;
-      m_names(cptr, sptr, parc, parv);
-    }
-    clean_channelname(para);
-    ch2ptr = FindChannel(para);
-  }
-
-  /*
-   * First, do all visible channels (public and the one user self is)
-   */
-
-  for (chptr = GlobalChannelList; chptr; chptr = chptr->next)
-  {
-    if ((chptr != ch2ptr) && !EmptyString(para))
-      continue;                 /* -- wanted a specific channel */
-    if (!MyConnect(sptr) && EmptyString(para))
-      continue;
-#ifndef GODMODE
-    if (!ShowChannel(sptr, chptr))
-      continue;                 /* -- users on this are not listed */
-#endif
-
-    /* Find users on same channel (defined by chptr) */
-
-    strcpy(buf, "* ");
-    len = strlen(chptr->chname);
-    strcpy(buf + 2, chptr->chname);
-    strcpy(buf + 2 + len, " :");
-
-    if (PubChannel(chptr))
-      *buf = '=';
-    else if (SecretChannel(chptr))
-      *buf = '@';
-    idx = len + 4;
-    flag = 1;
-    for (member = chptr->members; member; member = member->next_member)
-    {
-      c2ptr = member->user;
-#ifndef GODMODE
-      if (sptr != c2ptr && IsInvisible(c2ptr) && !find_channel_member(sptr, chptr))
-        continue;
-#endif
-      if (IsZombie(member))
-      {
-        if (member->user != sptr)
-          continue;
-        else
-        {
-          strcat(buf, "!");
-          idx++;
-        }
-      }
-      else if (IsChanOp(member))
-      {
-        strcat(buf, "@");
-        idx++;
-      }
-      else if (HasVoice(member))
-      {
-        strcat(buf, "+");
-        idx++;
-      }
-      strcat(buf, c2ptr->name);
-      strcat(buf, " ");
-      idx += strlen(c2ptr->name) + 1;
-      flag = 1;
-#ifdef GODMODE
-      {
-        char yxx[6];
-        sprintf_irc(yxx, "%s%s", NumNick(c2ptr));
-        assert(c2ptr == findNUser(yxx));
-        sprintf_irc(buf + strlen(buf), "(%s) ", yxx);
-        idx += 6;
-      }
-      if (mlen + idx + NICKLEN + 11 > BUFSIZE)
-#else
-      if (mlen + idx + NICKLEN + 5 > BUFSIZE)
-#endif
-        /* space, modifier, nick, \r \n \0 */
-      {
-        sendto_one(sptr, rpl_str(RPL_NAMREPLY), me.name, parv[0], buf); /* XXX DEAD */
-        strcpy(buf, "* ");
-        ircd_strncpy(buf + 2, chptr->chname, len + 1);
-        buf[len + 2] = 0;
-        strcat(buf, " :");
-        if (PubChannel(chptr))
-          *buf = '=';
-        else if (SecretChannel(chptr))
-          *buf = '@';
-        idx = len + 4;
-        flag = 0;
-      }
-    }
-    if (flag)
-      sendto_one(sptr, rpl_str(RPL_NAMREPLY), me.name, parv[0], buf); /* XXX DEAD */
-  }
-  if (!EmptyString(para))
-  {
-    sendto_one(sptr, rpl_str(RPL_ENDOFNAMES), me.name, parv[0], /* XXX DEAD */
-        ch2ptr ? ch2ptr->chname : para);
-    return (1);
-  }
-
-  /* Second, do all non-public, non-secret channels in one big sweep */
-
-  strcpy(buf, "* * :");
-  idx = 5;
-  flag = 0;
-  for (c2ptr = GlobalClientList; c2ptr; c2ptr = c2ptr->next)
-  {
-    struct Channel *ch3ptr;
-    int showflag = 0, secret = 0;
-
-#ifndef GODMODE
-    if (!IsUser(c2ptr) || (sptr != c2ptr && IsInvisible(c2ptr)))
-#else
-    if (!IsUser(c2ptr))
-#endif
-      continue;
-    member = c2ptr->user->channel;
-    /*
-     * Don't show a client if they are on a secret channel or when
-     * they are on a channel sptr is on since they have already
-     * been show earlier. -avalon
-     */
-    while (member)
-    {
-      ch3ptr = member->channel;
-#ifndef GODMODE
-      if (PubChannel(ch3ptr) || find_channel_member(sptr, ch3ptr))
-#endif
-        showflag = 1;
-      if (SecretChannel(ch3ptr))
-        secret = 1;
-      member = member->next_channel;
-    }
-    if (showflag)               /* Have we already shown them ? */
-      continue;
-#ifndef GODMODE
-    if (secret)                 /* On any secret channels ? */
-      continue;
-#endif
-    strcat(buf, c2ptr->name);
-    strcat(buf, " ");
-    idx += strlen(c2ptr->name) + 1;
-    flag = 1;
-#ifdef GODMODE
-    {
-      char yxx[6];
-      sprintf_irc(yxx, "%s%s", NumNick(c2ptr));
-      assert(c2ptr == findNUser(yxx));
-      sprintf_irc(buf + strlen(buf), "(%s) ", yxx);
-      idx += 6;
-    }
-#endif
-#ifdef GODMODE
-    if (mlen + idx + NICKLEN + 9 > BUFSIZE)
-#else
-    if (mlen + idx + NICKLEN + 3 > BUFSIZE)     /* space, \r\n\0 */
-#endif
-    {
-      sendto_one(sptr, rpl_str(RPL_NAMREPLY), me.name, parv[0], buf); /* XXX DEAD */
-      strcpy(buf, "* * :");
-      idx = 5;
-      flag = 0;
-    }
-  }
-  if (flag)
-    sendto_one(sptr, rpl_str(RPL_NAMREPLY), me.name, parv[0], buf); /* XXX DEAD */
-  sendto_one(sptr, rpl_str(RPL_ENDOFNAMES), me.name, parv[0], "*"); /* XXX DEAD */
-  return 1;
-}
-#endif /* 0 */
-