Author: Isomer <isomer@coders.net>
[ircu2.10.12-pk.git] / ircd / s_user.c
index 3af97a6d5e7fb30e34044e334a316e3d01fe5b86..cf34ba2566876e014f04807576f1cc42bc1f0c72 100644 (file)
@@ -191,6 +191,11 @@ int hunt_server_cmd(struct Client *from, const char *cmd, const char *tok,
   struct Client *acptr;
   char *to;
 
+  if (MustBeOper && !IsPrivileged(acptr))
+  {
+    send_reply(from, ERR_NOPRIVILEGES);
+    return HUNTED_NOSUCH;
+  }
   /* Assume it's me, if no server or an unregistered client */
   if (parc <= server || EmptyString((to = parv[server])) || IsUnknown(from))
     return (HUNTED_ISME);
@@ -383,7 +388,6 @@ int register_user(struct Client *cptr, struct Client *sptr,
   short            digitgroups = 0;
   struct User*     user = cli_user(sptr);
   char             ip_base64[8];
-  char             featurebuf[512];
 
   user->last = CurrentTime;
   parv[0] = cli_name(sptr);
@@ -567,8 +571,7 @@ int register_user(struct Client *cptr, struct Client *sptr,
     send_reply(sptr, RPL_YOURHOST, cli_name(&me), version);
     send_reply(sptr, RPL_CREATED, creation);
     send_reply(sptr, RPL_MYINFO, cli_name(&me), version);
-    ircd_snprintf(0, featurebuf, sizeof(featurebuf), FEATURES, FEATURESVALUES);
-    send_reply(sptr, RPL_ISUPPORT, featurebuf);
+    send_supported(sptr);
     m_lusers(sptr, sptr, 1, parv);
     update_load();
     motd_signon(sptr);
@@ -1218,7 +1221,8 @@ int set_user_mode(struct Client *cptr, struct Client *sptr, int parc, char *parv
        set_snomask(sptr, tmpmask, SNO_SET);
       if (cli_snomask(sptr) && snomask_given)
        send_reply(sptr, RPL_SNOMASK, cli_snomask(sptr), cli_snomask(sptr));
-    }
+    } else
+      set_snomask(sptr, 0, SNO_SET);
   }
   /*
    * Compare new flags with old flags and send string which
@@ -1540,3 +1544,15 @@ int add_silence(struct Client* sptr, const char* mask)
   return 0;
 }
 
+int
+send_supported(struct Client *cptr)
+{
+  char featurebuf[512];
+
+  ircd_snprintf(0, featurebuf, sizeof(featurebuf), FEATURES1, FEATURESVALUES1);
+  send_reply(cptr, RPL_ISUPPORT, featurebuf);
+  ircd_snprintf(0, featurebuf, sizeof(featurebuf), FEATURES2, FEATURESVALUES2);
+  send_reply(cptr, RPL_ISUPPORT, featurebuf);
+
+  return 0; /* convenience return, if it's ever needed */
+}