- ServerInstance->SNO->WriteToSnoMask('A', std::string(user->nick) + " used SAMODE: " + ServerInstance->Modes->GetLastParse());
-
- std::deque<std::string> n;
- irc::spacesepstream spaced(ServerInstance->Modes->GetLastParse());
- std::string one;
- while (spaced.GetToken(one))
- n.push_back(one);
-
- std::string channel = n[0];
- n.pop_front();
- ServerInstance->PI->SendMode(channel, n);
-
- /* XXX: Yes, this is right. We dont want to propagate the
- * actual SAMODE command, just the MODE command generated
- * by the Protocol Interface
- */
- return CMD_LOCALONLY;
+ User* target = ServerInstance->FindNickOnly(parameters[0]);
+ if ((!target) || (target->registered != REG_ALL))
+ {
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
+ return CMD_FAILURE;
+ }
+
+ // Changing the modes of another user requires a special permission
+ if ((target != user) && (!user->HasPrivPermission("users/samode-usermodes")))
+ {
+ user->WriteNotice("*** You are not allowed to /SAMODE other users (the privilege users/samode-usermodes is needed to /SAMODE others).");
+ return CMD_FAILURE;
+ }