Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / m_pass.c
index 50870b2b536d91de439c60bb5613f55149e756c1..5dee35bcf129bcb43e261630d503a8b57685991d 100644 (file)
@@ -97,7 +97,7 @@
 /*
  * mr_pass - registration message handler
  */
-int m_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
+int mr_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   const char* password = parc > 1 ? parv[1] : 0;
 
@@ -108,7 +108,13 @@ int m_pass(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   if (EmptyString(password))
     return need_more_params(cptr, "PASS");
 
-  ircd_strncpy(cptr->passwd, password, PASSWDLEN);
+  /* TODO: For protocol negotiation */
+#if 0
+  if (ircd_strcmp(password,"PROT")==0) {
+       /* Do something here */
+  }
+#endif
+  ircd_strncpy(cli_passwd(cptr), password, PASSWDLEN);
   return 0;
 }
 
@@ -128,9 +134,13 @@ int m_pass(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
 
   if (!MyConnect(sptr) || (!IsUnknown(cptr) && !IsHandshake(cptr)))
   {
-    sendto_one(cptr, err_str(ERR_ALREADYREGISTRED), me.name, parv[0]);
+    sendto_one(cptr, err_str(ERR_ALREADYREGISTRED), me.name, parv[0]); /* XXX DEAD */
     return 0;
   }
+  if (ircd_strcmp("PROTO",password)) {
+       proto_send_supported(sptr);
+       return 0;
+  }
   ircd_strncpy(cptr->passwd, password, PASSWDLEN);
   return 0;
 }