added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / m_links.c
index 7814a512d3803a0292971d95a32587915b8e9392..68bf87fd92fc1edc781f9b1c37b0f4847ac2a681 100644 (file)
@@ -83,7 +83,9 @@
 
 #include "client.h"
 #include "ircd.h"
-#include "ircd_policy.h"
+#include "ircd_defs.h"
+#include "ircd_features.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "match.h"
@@ -94,7 +96,7 @@
 #include "send.h"
 #include "struct.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
 /*
  * m_links - generic message handler
@@ -113,6 +115,15 @@ int m_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char *mask;
   struct Client *acptr;
 
+  if (feature_bool(FEAT_HIS_LINKS) && !IsAnOper(sptr))
+  {
+    send_reply(sptr, RPL_ENDOFLINKS, parc < 2 ? "*" : parv[1]);
+    sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s %s", sptr,
+                  "/LINKS has been disabled, from CFV-165.  Visit ", 
+                  feature_str(FEAT_HIS_URLSERVERS));
+    return 0;
+  }
+
   if (parc > 2)
   {
     if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
@@ -135,24 +146,9 @@ int m_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   }
 
   send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
-  return 0;
-}
-
-#ifdef HEAD_IN_SAND_LINKS
-int m_links_redirect(struct Client* cptr, struct Client* sptr, int parc,
-                    char* parv[])
-{
-
-  if (parc > 2)
-    return send_reply(cptr, ERR_NOPRIVILEGES);
 
-  send_reply(sptr, RPL_ENDOFLINKS, parc < 2 ? "*" : parv[1]);
-  sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :%s", sptr,
-               "/LINKS has been disabled, from CFV-165.  "
-               "Visit http://www.undernet.org/servers.php");
   return 0;
 }
-#endif
 
 /*
  * ms_links - server message handler
@@ -166,32 +162,33 @@ int m_links_redirect(struct Client* cptr, struct Client* sptr, int parc,
  * parv[1] = server to query
  * parv[2] = servername mask
  */
-int ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
-{
-  char *mask;
-  struct Client *acptr;
-
-  if (parc > 2)
-  {
-    if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
-        HUNTED_ISME)
-      return 0;
-    mask = parv[2];
-  }
-  else
-    mask = parc < 2 ? 0 : parv[1];
-
-  for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
-  {
-    if (!IsServer(acptr) && !IsMe(acptr))
-      continue;
-    if (!BadPtr(mask) && match(mask, cli_name(acptr)))
-      continue;
-    send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
-        cli_hopcount(acptr), cli_serv(acptr)->prot,
-        ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
-  }
+int
+ms_links(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+ {
+   char *mask;
+   struct Client *acptr;
 
-  send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
-  return 0;
-}
+   if (parc > 2)
+   {
+     if (hunt_server_cmd(sptr, CMD_LINKS, cptr, 1, "%C :%s", 1, parc, parv) !=
+         HUNTED_ISME)
+       return 0;
+     mask = parv[2];
+   }
+   else
+     mask = parc < 2 ? 0 : parv[1];
+   for (acptr = GlobalClientList, collapse(mask); acptr; acptr = cli_next(acptr))
+   {
+     if (!IsServer(acptr) && !IsMe(acptr))
+       continue;
+     if (!BadPtr(mask) && match(mask, cli_name(acptr)))
+       continue;
+     send_reply(sptr, RPL_LINKS, cli_name(acptr), cli_name(cli_serv(acptr)->up),
+                cli_hopcount(acptr), cli_serv(acptr)->prot,
+                ((cli_info(acptr))[0] ? cli_info(acptr) : "(Unknown Location)"));
+   }
+   send_reply(sptr, RPL_ENDOFLINKS, BadPtr(mask) ? "*" : mask);
+   return 0;
+ }