diff options
-rw-r--r-- | docs/conf/inspircd.conf.example | 14 | ||||
-rw-r--r-- | src/commands/cmd_invite.cpp | 38 |
2 files changed, 29 insertions, 23 deletions
diff --git a/docs/conf/inspircd.conf.example b/docs/conf/inspircd.conf.example index 22369bc50..fea9d5d5c 100644 --- a/docs/conf/inspircd.conf.example +++ b/docs/conf/inspircd.conf.example @@ -660,13 +660,13 @@ <security - # announceinvites: If this option is set, then invites are announced - # to the channel when a user invites another user. If you consider - # this to be unnecessary noise, set this to 'none'. - # To announce to all ops, set this to 'ops' and to announce to all users, - # set the value to 'all'. The value 'dynamic' will make the messages - # go to every user who has power of INVITE on the channel. This - # is the recommended setting. + # announceinvites: This option controls which members of the channel + # receive an announcement when someone is INVITEd. Available values: + # 'none' - don't send invite announcements + # 'all' - send invite announcements to all members + # 'ops' - send invite announcements to ops and higher ranked users + # 'dynamic' - send invite announcements to halfops (if available) and + # higher ranked users. This is the recommended setting. announceinvites="dynamic" # hidemodes: If enabled, then the listmodes given will be hidden diff --git a/src/commands/cmd_invite.cpp b/src/commands/cmd_invite.cpp index e12b8244f..fd595d618 100644 --- a/src/commands/cmd_invite.cpp +++ b/src/commands/cmd_invite.cpp @@ -110,23 +110,29 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use IS_LOCAL(u)->InviteTo(c->name.c_str(), timeout); u->WriteFrom(user,"INVITE %s :%s",u->nick.c_str(),c->name.c_str()); user->WriteNumeric(RPL_INVITING, "%s %s %s",user->nick.c_str(),u->nick.c_str(),c->name.c_str()); - switch (ServerInstance->Config->AnnounceInvites) + if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE) { - case ServerConfig::INVITE_ANNOUNCE_ALL: - c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); - break; - case ServerConfig::INVITE_ANNOUNCE_OPS: - c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); - break; - case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: - if (c->IsModeSet('i')) - c->WriteAllExceptSender(user, true, '@', "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); - else - c->WriteChannelWithServ(ServerInstance->Config->ServerName, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); - break; - default: - /* Nobody */ - break; + char prefix; + switch (ServerInstance->Config->AnnounceInvites) + { + case ServerConfig::INVITE_ANNOUNCE_OPS: + { + prefix = '@'; + break; + } + case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: + { + ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); + prefix = (mh && mh->name == "halfop" ? mh->GetPrefix() : '@'); + break; + } + default: + { + prefix = 0; + break; + } + } + c->WriteAllExceptSender(user, true, prefix, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); } FOREACH_MOD(I_OnUserInvite,OnUserInvite(user,u,c,timeout)); } |