summaryrefslogtreecommitdiff
path: root/src/mode.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mode.cpp')
-rw-r--r--src/mode.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/mode.cpp b/src/mode.cpp
index dc4de1261..560bd8d04 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -249,11 +249,18 @@ void ModeParser::DisplayCurrentModes(userrec *user, userrec* targetuser, chanrec
}
else if (targetuser)
{
- /* Display user's current mode string */
- user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes());
- if (*targetuser->oper)
- user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks());
- return;
+ if ((targetuser == user) || (*user->oper))
+ {
+ /* Display user's current mode string */
+ user->WriteServ("221 %s :+%s",targetuser->nick,targetuser->FormatModes());
+ if (*targetuser->oper)
+ user->WriteServ("008 %s +%s :Server notice mask", targetuser->nick, targetuser->FormatNoticeMasks());
+ return;
+ }
+ else
+ {
+ user->WriteServ("502 %s :Can't change mode for other users", user->nick);
+ }
}
/* No such nick/channel */
@@ -340,6 +347,11 @@ void ModeParser::Process(const char** parameters, int pcnt, userrec *user, bool
{
type = MODETYPE_USER;
mask = MASK_USER;
+ if ((user != targetuser) && (!ServerInstance->ULine(user->server)))
+ {
+ user->WriteServ("502 %s :Can't change mode for other users", user->nick);
+ return;
+ }
}
else
{