X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_invite.cpp;h=74ac7ea2c0a3ed81b58de2eba70bb18d12679a72;hb=f087d825a88760d251b8f80b5d50bc98b40fa2ae;hp=2910aca3fe56d647960e2c1c7867a86d922e7fa7;hpb=feeeced47094ed52541d1bc74440f1b223e6dadc;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_invite.cpp b/src/cmd_invite.cpp index 2910aca3f..74ac7ea2c 100644 --- a/src/cmd_invite.cpp +++ b/src/cmd_invite.cpp @@ -11,12 +11,10 @@ * --------------------------------------------------- */ -#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