]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_invite.cpp
Split up spanningtree some more, the filenames should be more intuitive so that devel...
[user/henk/code/inspircd.git] / src / cmd_invite.cpp
index 2910aca3fe56d647960e2c1c7867a86d922e7fa7..74ac7ea2c0a3ed81b58de2eba70bb18d12679a72 100644 (file)
  * ---------------------------------------------------
  */
 
-#include "configreader.h"
-#include "users.h"
-#include "modules.h"
+#include "inspircd.h"
 #include "commands/cmd_invite.h"
 
-extern "C" command_t* init_command(InspIRCd* Instance)
+extern "C" DllExport command_t* init_command(InspIRCd* Instance)
 {
        return new cmd_invite(Instance);
 }
@@ -46,11 +44,11 @@ CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
                        return CMD_FAILURE;
                }
 
-               if ((c->modes[CM_INVITEONLY]) && (IS_LOCAL(user)))
+               if ((c->IsModeSet('i')) && (IS_LOCAL(user)))
                {
                        if (c->GetStatus(user) < STATUS_HOP)
                        {
-                               user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel",user->nick, c->name);
+                               user->WriteServ("482 %s %s :You must be a channel %soperator", user->nick, c->name, c->GetStatus(u) == STATUS_HOP ? "" : "half-");
                                return CMD_FAILURE;
                        }
                }
@@ -77,8 +75,24 @@ CmdResult cmd_invite::Handle (const char** parameters, int pcnt, userrec *user)
                u->InviteTo(c->name);
                u->WriteFrom(user,"INVITE %s :%s",u->nick,c->name);
                user->WriteServ("341 %s %s %s",user->nick,u->nick,c->name);
-               if (ServerInstance->Config->AnnounceInvites)
-                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "%s invited %s into the channel", user->nick, u->nick)
+               switch (ServerInstance->Config->AnnounceInvites)
+               {
+                       case ServerConfig::INVITE_ANNOUNCE_ALL:
+                               c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+                       break;
+                       case ServerConfig::INVITE_ANNOUNCE_OPS:
+                               c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+                       break;
+                       case ServerConfig::INVITE_ANNOUNCE_DYNAMIC:
+                               if (c->IsModeSet('i'))
+                                       c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+                               else
+                                       c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name, user->nick, u->nick);
+                       break;
+                       default:
+                               /* Nobody */
+                       break;
+               }
                FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c));
        }
        else