Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_mode.c
index e3c6a21a4d9e35744732c1d131b8186cdd5fa6b0..eaa5f19ebf27c1b0f4dfcd9608d5924c01b0cb14 100644 (file)
@@ -98,7 +98,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef CONFIG_NEW_MODE
 int
 m_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 {
@@ -210,314 +209,3 @@ ms_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   return modebuf_flush(&mbuf);
 }
-#else /* CONFIG_NEW_MODE */
-/*
- * m_mode - generic message handler
- */
-int m_mode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
-{
-  int             badop;
-  int             sendts;
-  struct Channel* chptr = 0;
-  char modebuf[MODEBUFLEN];
-  char parabuf[MODEBUFLEN];
-  char nparabuf[MODEBUFLEN];
-
-
-  if (parc < 2)
-    return need_more_params(sptr, "MODE");
-
-  /*
-   * if local user, cleanup channel name, don't allow local channel operations
-   * for remote clients
-   */
-  if (MyUser(sptr))
-    clean_channelname(parv[1]);
-  else if (IsLocalChannel(parv[1]))
-    return 0;
-
-  /* 
-   * try to find the channel
-   */
-  if ('#' == *parv[1] || '&' == *parv[1] || '+' == *parv[1])
-    chptr = FindChannel(parv[1]);
-  if (!chptr)
-    return set_user_mode(cptr, sptr, parc, parv);
-
-  sptr->flags &= ~FLAGS_TS8;
-  /*
-   * sending an error wasnt good, lets just send an empty mode reply..  poptix
-   */
-  if (IsModelessChannel(chptr->chname)) {
-    if (IsUser(sptr))
-      send_reply(sptr, RPL_CHANNELMODEIS, chptr->chname, "+nt", "");
-    return 0;
-  }
-
-  if (parc < 3) {
-    /*
-     * no parameters, send channel modes
-     */
-    *modebuf = *parabuf = '\0';
-    modebuf[1] = '\0';
-    channel_modes(sptr, modebuf, parabuf, chptr);
-    send_reply(sptr, RPL_CHANNELMODEIS, chptr->chname, modebuf, parabuf);
-    send_reply(sptr, RPL_CREATIONTIME, chptr->chname, chptr->creationtime);
-    return 0;
-  }
-
-  LocalChanOperMode = 0;
-
-  if (!(sendts = set_mode(cptr, sptr, chptr, parc - 2, parv + 2,
-                          modebuf, parabuf, nparabuf, &badop))) {
-    send_reply(sptr, (find_channel_member(sptr, chptr) ?
-                     ERR_CHANOPRIVSNEEDED : ERR_NOTONCHANNEL), chptr->chname);
-    return 0;
-  }
-
-  if (badop >= 2)
-    send_hack_notice(cptr, sptr, parc, parv, badop, 1); /* XXX DYING */
-
-  if (strlen(modebuf) > 1 || sendts > 0) {
-    if (badop != 2 && strlen(modebuf) > 1) {
-#ifdef OPER_MODE_LCHAN
-      if (LocalChanOperMode) {
-       sendcmdto_channel_butserv(&me, CMD_MODE, chptr, "%H %s %s", chptr,
-                                 modebuf, parabuf);
-        sendto_opmask_butone(0, SNO_HACK4, "OPER MODE: %C MODE %H %s %s",
-                            sptr, chptr, modebuf, parabuf);
-      }
-      else
-#endif
-      sendcmdto_channel_butserv(sptr, CMD_MODE, chptr, "%H %s %s", chptr,
-                               modebuf, parabuf);
-    }
-    if (IsLocalChannel(chptr->chname))
-      return 0;
-    /* We send a creationtime of 0, to mark it as a hack --Run */
-    if (IsServer(sptr) && (badop == 2 || sendts > 0)) {
-      if (*modebuf == '\0')
-        strcpy(modebuf, "+");
-      if (badop != 2) {
-       sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%H %s %s %Tu", chptr,
-                             modebuf, nparabuf, (badop == 4) ? (time_t) 0 :
-                             chptr->creationtime);
-      }
-    }
-    else {
-      sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%H %s %s", chptr, modebuf,
-                           nparabuf);
-    }
-  }
-  return 0;
-}
-
-/*
- * ms_mode - server message handler
- */
-int ms_mode(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
-{
-  int             badop;
-  int             sendts;
-  struct Channel* chptr = 0;
-  char modebuf[MODEBUFLEN];
-  char parabuf[MODEBUFLEN];
-  char nparabuf[MODEBUFLEN];
-
-  if (parc < 2)
-    return need_more_params(sptr, "MODE");
-
-  /*
-   * if local user, cleanup channel name, don't allow local channel operations
-   * for remote clients
-   */
-  if (MyUser(sptr))
-    clean_channelname(parv[1]);
-  else if (IsLocalChannel(parv[1]))
-    return 0;
-
-  /* 
-   * try to find the channel
-   */
-  if ('#' == *parv[1] || '&' == *parv[1] || '+' == *parv[1])
-    chptr = FindChannel(parv[1]);
-  if (!chptr)
-    return set_user_mode(cptr, sptr, parc, parv);
-
-  sptr->flags &= ~FLAGS_TS8;
-  /*
-   * sending an error wasnt good, lets just send an empty mode reply..  poptix
-   */
-  if (IsModelessChannel(chptr->chname)) {
-    if (IsUser(sptr))
-      send_reply(sptr, RPL_CHANNELMODEIS, chptr->chname, "+nt", "");
-    return 0;
-  }
-
-  if (parc < 3) {
-    /*
-     * no parameters, send channel modes
-     */
-    *modebuf = *parabuf = '\0';
-    modebuf[1] = '\0';
-    channel_modes(sptr, modebuf, parabuf, chptr);
-    send_reply(sptr, RPL_CHANNELMODEIS, chptr->chname, modebuf, parabuf);
-    send_reply(sptr, RPL_CREATIONTIME, chptr->chname, chptr->creationtime);
-    return 0;
-  }
-
-  LocalChanOperMode = 0;
-
-  if (!(sendts = set_mode(cptr, sptr, chptr, parc - 2, parv + 2,
-                          modebuf, parabuf, nparabuf, &badop))) {
-    send_reply(sptr, (find_channel_member(sptr, chptr) ?
-                     ERR_CHANOPRIVSNEEDED : ERR_NOTONCHANNEL), chptr->chname);
-    return 0;
-  }
-
-  if (badop >= 2)
-    send_hack_notice(cptr, sptr, parc, parv, badop, 1); /* XXX DYING */
-
-  if (strlen(modebuf) > 1 || sendts > 0) {
-    if (badop != 2 && strlen(modebuf) > 1) {
-#ifdef OPER_MODE_LCHAN
-      if (LocalChanOperMode) {
-       sendcmdto_channel_butserv(&me, CMD_MODE, chptr, "%H %s %s", chptr,
-                                 modebuf, parabuf);
-        sendto_opmask_butone(0, SNO_HACK4, "OPER MODE: %C MODE %H %s %s",
-                            sptr, chptr, modebuf, parabuf);
-      }
-      else
-#endif
-      sendcmdto_channel_butserv(sptr, CMD_MODE, chptr, "%H %s %s", chptr,
-                               modebuf, parabuf);
-    }
-    if (IsLocalChannel(chptr->chname))
-      return 0;
-    /* We send a creationtime of 0, to mark it as a hack --Run */
-    if (IsServer(sptr) && (badop == 2 || sendts > 0)) {
-      if (*modebuf == '\0')
-        strcpy(modebuf, "+");
-      if (badop != 2) {
-       sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%H %s %s %Tu", chptr,
-                             modebuf, nparabuf, (badop == 4) ? (time_t) 0 :
-                             chptr->creationtime);
-      }
-    }
-    else {
-      sendcmdto_serv_butone(sptr, CMD_MODE, cptr, "%H %s %s", chptr, modebuf,
-                           nparabuf);
-    }
-  }
-  return 0;
-}
-#endif /* CONFIG_NEW_MODE */
-
-#if 0
-/*
- * m_mode
- * parv[0] - sender
- * parv[1] - channel
- */
-int m_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
-{
-  int             badop;
-  int             sendts;
-  struct Channel* chptr = 0;
-
-  if (parc < 2)
-    return need_more_params(sptr, "MODE");
-
-  /*
-   * if local user, cleanup channel name, don't allow local channel operations
-   * for remote clients
-   */
-  if (MyUser(sptr))
-    clean_channelname(parv[1]);
-  else if (IsLocalChannel(parv[1]))
-    return 0;
-
-  /* 
-   * try to find the channel
-   */
-  if ('#' == *parv[1] || '&' == *parv[1] || '+' == *parv[1])
-    chptr = FindChannel(parv[1]);
-  if (!chptr)
-    return set_user_mode(cptr, sptr, parc, parv);
-
-  sptr->flags &= ~FLAGS_TS8;
-  /*
-   * sending an error wasnt good, lets just send an empty mode reply..  poptix
-   */
-  if (IsModelessChannel(chptr->chname)) {
-    if (IsUser(sptr))
-      sendto_one(sptr, rpl_str(RPL_CHANNELMODEIS), me.name, parv[0], /* XXX DEAD */
-                 chptr->chname, "+nt", "");
-    return 0;
-  }
-
-  if (parc < 3) {
-    /*
-     * no parameters, send channel modes
-     */
-    *modebuf = *parabuf = '\0';
-    modebuf[1] = '\0';
-    channel_modes(sptr, modebuf, parabuf, chptr);
-    sendto_one(sptr, rpl_str(RPL_CHANNELMODEIS), me.name, parv[0], /* XXX DEAD */
-               chptr->chname, modebuf, parabuf);
-    sendto_one(sptr, rpl_str(RPL_CREATIONTIME), me.name, parv[0], /* XXX DEAD */
-               chptr->chname, chptr->creationtime);
-    return 0;
-  }
-
-  LocalChanOperMode = 0;
-
-  if (!(sendts = set_mode(cptr, sptr, chptr, parc - 2, parv + 2,
-                          modebuf, parabuf, nparabuf, &badop))) {
-    sendto_one(sptr, err_str(find_channel_member(sptr, chptr) ? ERR_CHANOPRIVSNEEDED : /* XXX DEAD */
-        ERR_NOTONCHANNEL), me.name, parv[0], chptr->chname);
-    return 0;
-  }
-
-  if (badop >= 2)
-    send_hack_notice(cptr, sptr, parc, parv, badop, 1);
-
-  if (strlen(modebuf) > 1 || sendts > 0) {
-    if (badop != 2 && strlen(modebuf) > 1) {
-#ifdef OPER_MODE_LCHAN
-      if (LocalChanOperMode) {
-        sendto_channel_butserv(chptr, &me, ":%s MODE %s %s %s", /* XXX DEAD */
-                               me.name, chptr->chname, modebuf, parabuf);
-        sendto_op_mask(SNO_HACK4,"OPER MODE: %s MODE %s %s %s", /* XXX DEAD */
-                       me.name, chptr->chname, modebuf, parabuf);
-      }
-      else
-#endif
-      sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s", /* XXX DEAD */
-          parv[0], chptr->chname, modebuf, parabuf);
-    }
-    if (IsLocalChannel(chptr->chname))
-      return 0;
-    /* We send a creationtime of 0, to mark it as a hack --Run */
-    if (IsServer(sptr) && (badop == 2 || sendts > 0)) {
-      if (*modebuf == '\0')
-        strcpy(modebuf, "+");
-      if (badop != 2) {
-        sendto_highprot_butone(cptr, 10, "%s " TOK_MODE " %s %s %s " TIME_T_FMT, /* XXX DEAD */
-            NumServ(sptr), chptr->chname, modebuf, nparabuf,
-            (badop == 4) ? (time_t) 0 : chptr->creationtime);
-      }
-    }
-    else {
-      if (IsServer(sptr))
-         sendto_highprot_butone(cptr, 10, "%s " TOK_MODE " %s %s %s", /* XXX DEAD */
-           NumServ(sptr), chptr->chname, modebuf, nparabuf);
-      else
-         sendto_highprot_butone(cptr, 10, "%s%s " TOK_MODE " %s %s %s", /* XXX DEAD */
-           NumNick(sptr), chptr->chname, modebuf, nparabuf);
-    }
-  }
-  return 0;
-}
-
-#endif /* 0 */