IPv6 support (hopefully with fewer future transition pains)
[ircu2.10.12-pk.git] / ircd / m_connect.c
index cbc75bbef3254d4ed7706335200cf913daf1a7bc..55feddd1732b495b2472ad8754d0a7ade56fbf11 100644 (file)
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
-#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 "config.h"
+
 #include "client.h"
 #include "crule.h"
 #include "hash.h"
@@ -138,6 +132,7 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
      * checked it's args, if we don't have parc == 4, something
      * isn't right.
      */
+    protocol_violation(sptr, "Too few parameters to connect");
     return need_more_params(sptr, "CONNECT");
   }
 
@@ -190,24 +185,23 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   /*
    * save the old port
    */
-  tmpport = aconf->port;
-  if (port) { 
-    aconf->port = port;
-  }
-  else {
-    port = aconf->port;
-  }
+  tmpport = aconf->address.port;
+  if (port)
+    aconf->address.port = port;
+  else
+    port = aconf->address.port;
+
   /*
    * Notify all operators about remote connect requests
    */
-  sendcmdto_flag_butone(&me, CMD_WALLOPS, 0, FLAGS_WALLOP,
-                       ":Remote CONNECT %s %s from %s", parv[1],
+  sendwallto_group_butone(&me, WALL_WALLOPS, 0,
+                       "Remote CONNECT %s %s from %s", parv[1],
                        parv[2] ? parv[2] : "",
                        get_client_name(sptr, HIDE_IP));
   log_write(LS_NETWORK, L_INFO, 0, "CONNECT From %C : %s %s", sptr, parv[1],
            parv[2] ? parv[2] : "");
 
-  if (connect_server(aconf, sptr, 0)) {
+  if (connect_server(aconf, sptr)) {
     sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connecting to %s.", sptr,
                  aconf->name);
   }
@@ -215,7 +209,7 @@ int ms_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed",
                  sptr, aconf->name);
   }
-  aconf->port = tmpport;
+  aconf->address.port = tmpport;
   return 0;
 }
 
@@ -319,7 +313,7 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
    *  use the default from configuration structure. If missing
    *  from there, then use the precompiled default.
    */
-  port = aconf->port;
+  port = aconf->address.port;
   if (parc > 2) {
     assert(0 != parv[2]);
     if (0 == (port = atoi(parv[2]))) {
@@ -334,10 +328,10 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     return 0;
   }
 
-  tmpport = aconf->port;
-  aconf->port = port;
+  tmpport = aconf->address.port;
+  aconf->address.port = port;
 
-  if (connect_server(aconf, sptr, 0)) {
+  if (connect_server(aconf, sptr)) {
     sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connecting to %s.", sptr,
                  aconf->name);
   }
@@ -345,6 +339,6 @@ int mo_connect(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     sendcmdto_one(&me, CMD_NOTICE, sptr, "%C :*** Connection to %s failed",
                  sptr, aconf->name);
   }
-  aconf->port = tmpport;
+  aconf->address.port = tmpport;
   return 0;
 }