Author: Kev <klmitch@mit.edu>
[ircu2.10.12-pk.git] / ircd / m_pass.c
index 2087118d6b2400dddb256f744238d431e75b6ef7..4629f691c6497ec0eee20d62b01f4884a52b0793 100644 (file)
@@ -79,6 +79,8 @@
  *            note:   it is guaranteed that parv[0]..parv[parc-1] are all
  *                    non-NULL pointers.
  */
+#include "config.h"
+
 #if 0
 /*
  * No need to include handlers.h here the signatures must match
@@ -97,7 +99,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 +110,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;
 }
 
@@ -131,6 +139,10 @@ int m_pass(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
     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;
 }