added basic ssl support to ircu
[ircu2.10.12-pk.git] / ircd / m_version.c
index 082deefcfaa1160920fe78fec36148dc70996b05..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);
+
+  send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me),
+             debug_serveropts());
+  send_supported(sptr);
+  return 0;
+}
+
+/*
+ * mo_version - oper message handler
+ *
+ *   parv[0] = sender prefix
+ *   parv[1] = servername
+ */
+int mo_version(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
 {
   struct Client *acptr;
 
@@ -120,16 +138,14 @@ int m_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)
   {
-    char featurebuf[512];
-    
-    ircd_snprintf(0, featurebuf, sizeof(featurebuf), FEATURES, FEATURESVALUES);
-    
     send_reply(sptr, RPL_VERSION, version, debugmode, cli_name(&me),
               debug_serveropts());
-    send_reply(sptr, RPL_ISUPPORT, featurebuf);
+    send_supported(sptr);
   }
 
   return 0;
@@ -139,7 +155,7 @@ int m_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[])
 {