2004-05-09 Michael Poole <mdpoole@troilus.org>
[ircu2.10.12-pk.git] / ircd / m_server.c
index b27f7e2006c804eea9c112e8d5ef92a10ceb6430..4f06d2fb0724a50302a185aa589d3a789d306e53 100644 (file)
@@ -85,7 +85,6 @@
 #include "hash.h"
 #include "ircd.h"
 #include "ircd_log.h"
-#include "ircd_policy.h"
 #include "ircd_features.h"
 #include "ircd_reply.h"
 #include "ircd_string.h"
 #include "s_serv.h"
 #include "send.h"
 #include "userload.h"
-#include "map.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -151,7 +149,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   recv_time = TStime();
   info[0] = '\0';
 
-  if (parc < 7)
+  if (parc < 8)
   {
     need_more_params(sptr, "SERVER");
     return exit_client(cptr, cptr, &me, "Need more parameters");
@@ -172,22 +170,22 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 
   *parv[5] = 'J';
 
+  prot = atoi(parv[5] + 1);
+  if (prot > atoi(MAJOR_PROTOCOL))
+    prot = atoi(MAJOR_PROTOCOL);
+
   if (*parv[7] == '+') {
     for (ch = parv[7] + 1; *ch; ch++)
       switch (*ch) {
       case 'h':
-       SetHub(cptr);
-       break;
+        SetHub(cptr);
+        break;
       case 's':
-       SetService(cptr);
-       break;
+        SetService(cptr);
+        break;
       }
   }
 
-  prot = atoi(parv[5] + 1);
-  if (prot > atoi(MAJOR_PROTOCOL))
-    prot = atoi(MAJOR_PROTOCOL);
-
   hop = atoi(parv[2]);
   start_timestamp = atoi(parv[3]);
   timestamp = atoi(parv[4]);
@@ -639,7 +637,7 @@ int mr_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   else
     ret = 0;
 
-#ifdef HEAD_IN_SAND_MAP
+#if defined(HEAD_IN_SAND_MAP) || defined(HEAD_IN_SAND_LINKS)
   map_update(cptr);
 #endif
 
@@ -704,20 +702,6 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (strlen(parv[5]) != 3 || (parv[5][0] != 'P' && parv[5][0] != 'J'))
     return exit_client_msg(cptr, sptr, &me, "Bogus protocol (%s)", parv[5]);
 
-  *parv[5] = 'J';
-
-  if (*parv[7] == '+') {
-    for (ch = parv[7] + 1; *ch; ch++)
-      switch (*ch) {
-      case 'h':
-       SetHub(cptr);
-       break;
-      case 's':
-       SetService(cptr);
-       break;
-      }
-  }
-
   prot = atoi(parv[5] + 1);
   if (prot > atoi(MAJOR_PROTOCOL))
     prot = atoi(MAJOR_PROTOCOL);
@@ -1076,10 +1060,22 @@ int ms_server(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      for numeric nicks ! */
   SetServerYXX(cptr, acptr, parv[6]);
 
+  if (*parv[7] == '+') {
+    for (ch = parv[7] + 1; *ch; ch++)
+      switch (*ch) {
+      case 'h':
+       SetHub(acptr);
+       break;
+      case 's':
+       SetService(acptr);
+       break;
+      }
+  }
+
   Count_newremoteserver(UserStats);
   add_client_to_list(acptr);
   hAddClient(acptr);
-#ifdef HEAD_IN_SAND_MAP
+#if defined(HEAD_IN_SAND_MAP) || defined(HEAD_IN_SAND_LINKS)
   map_update(acptr);
 #endif