added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / m_version.c
index 31dd236d9875649e2a4752d30b40be3cc52fb02f..656332e3a5bdc8e931975ff8166591c73b2fd992 100644 (file)
 #include "hash.h"
 #include "ircd.h"
 #include "ircd_features.h"
-#include "ircd_policy.h"
+#include "ircd_log.h"
 #include "ircd_reply.h"
 #include "ircd_snprintf.h"
 #include "ircd_string.h"
+#include "match.h"
 #include "msg.h"
 #include "numeric.h"
 #include "numnicks.h"
 #include "supported.h"
 #include "version.h"
 
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
 
 /*
  * m_version - generic message handler
  *
  *   parv[0] = sender prefix
- *   parv[1] = remote server
+ *   parv[1] = servername
  */
 int m_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
+  if (parc > 1 && match(parv[1], cli_name(&me)))
+    return send_reply(sptr, ERR_NOPRIVILEGES);
 
-  if (parc > 1)
-    send_reply(sptr, ERR_NOPRIVILEGES);
-  else
-    send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me),
-              debug_serveropts());
-
+  send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me),
+             debug_serveropts());
+  send_supported(sptr);
   return 0;
 }
 
 /*
- * mo_version - generic message handler
+ * mo_version - oper message handler
  *
  *   parv[0] = sender prefix
- *   parv[1] = remote server
+ *   parv[1] = servername
  */
 int mo_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
@@ -138,8 +138,10 @@ int mo_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
     parv[1] = cli_name(acptr);
   }
 
-  if (hunt_server_cmd(sptr, CMD_VERSION, cptr, HEAD_IN_SAND_REMOTE, ":%C", 1,
-                     parc, parv) == HUNTED_ISME)
+  if (hunt_server_cmd(sptr, CMD_VERSION, cptr, feature_int(FEAT_HIS_REMOTE),
+                                                           ":%C", 1,
+                                                           parc, parv)
+                      == HUNTED_ISME)
   {
     send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me),
               debug_serveropts());
@@ -153,7 +155,7 @@ int mo_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
  * ms_version - server message handler
  *
  *   parv[0] = sender prefix
- *   parv[1] = remote server
+ *   parv[1] = servername
  */
 int ms_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {