diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-02-11 17:52:21 +0100 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-02-11 17:52:21 +0100 |
commit | a0f92dd232097fa6662265ca49b222b72ca39c83 (patch) | |
tree | e42b66a6f0611ad898ecd2cdd453dc0937fb2915 /src | |
parent | 1f541d7bbce6f2a254b3ba46ed9a31da593674de (diff) |
cmd_invite Send invite announcements to halfops and higher when <security: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
Diffstat (limited to 'src')
-rw-r--r-- | src/commands/cmd_invite.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
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)); } |