]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_notice.cpp
Merge pull request #543 from SaberUK/master+sizeparam-removal
[user/henk/code/inspircd.git] / src / commands / cmd_notice.cpp
index e10d6286d0ec2aae568aa631501666e0536d832a..d0845a0517a6f5a22b4150462aeb913b898a6d9d 100644 (file)
@@ -57,7 +57,9 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
 
        CUList exempt_list;
 
-       user->idle_lastmsg = ServerInstance->Time();
+       LocalUser* localuser = IS_LOCAL(user);
+       if (localuser)
+               localuser->idle_lastmsg = ServerInstance->Time();
 
        if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
@@ -98,7 +100,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
 
                if (chan)
                {
-                       if (IS_LOCAL(user))
+                       if (localuser)
                        {
                                if ((chan->IsModeSet('n')) && (!chan->HasUser(user)))
                                {
@@ -110,6 +112,15 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
                                        user->WriteNumeric(404, "%s %s :Cannot send to channel (+m)", user->nick.c_str(), chan->name.c_str());
                                        return CMD_FAILURE;
                                }
+
+                               if (ServerInstance->Config->RestrictBannedUsers)
+                               {
+                                       if (chan->IsBanned(user))
+                                       {
+                                               user->WriteNumeric(404, "%s %s :Cannot send to channel (you're banned)", user->nick.c_str(), chan->name.c_str());
+                                               return CMD_FAILURE;
+                                       }
+                               }
                        }
                        ModResult MOD_RESULT;
 
@@ -157,7 +168,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
 
        const char* destnick = parameters[0].c_str();
 
-       if (IS_LOCAL(user))
+       if (localuser)
        {
                const char* targetserver = strchr(destnick, '@');
 
@@ -180,7 +191,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
        else
                dest = ServerInstance->FindNick(destnick);
 
-       if (dest)
+       if ((dest) && (dest->registered == REG_ALL))
        {
                if (parameters[1].empty())
                {