Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

cmd_invite Send invite announcements to halfops and higher when <secu…

…rity:announceinvites> is 'dynamic' regardless of the channel being +i or not

Clarify what the various options mean in the doc

Fixes #418 reported by @RawrDragon
  • Loading branch information...
commit a0f92dd232097fa6662265ca49b222b72ca39c83 1 parent 1f541d7
@attilamolnar attilamolnar authored
Showing with 29 additions and 23 deletions.
  1. +7 −7 docs/conf/inspircd.conf.example
  2. +22 −16 src/commands/cmd_invite.cpp
View
14 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
View
38 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));
}
Please sign in to comment.
Something went wrong with that request. Please try again.