diff options
author | Attila Molnar <attilamolnar@hush.com> | 2015-12-06 11:20:00 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2015-12-06 11:20:00 +0100 |
commit | 81215de4f00d0044f1dbe0d1c81d1b7081e5405d (patch) | |
tree | 97d46b2663a7497c1aec4ba7fcf4922ccd6b010e /src | |
parent | 27f69fdc424fc1c934a4a994731f412118f4c051 (diff) |
cmd_invite Extend scope of the prefix character variable
Diffstat (limited to 'src')
-rw-r--r-- | src/coremods/core_channel/cmd_invite.cpp | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index 96f560582..8a906f052 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -122,30 +122,27 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use user->WriteNumeric(RPL_AWAY, "%s :%s", u->nick.c_str(), u->awaymsg.c_str()); } - if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE) + char prefix = 0; + switch (ServerInstance->Config->AnnounceInvites) { - char prefix; - switch (ServerInstance->Config->AnnounceInvites) + case ServerConfig::INVITE_ANNOUNCE_OPS: + { + prefix = '@'; + break; + } + case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: + { + PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h'); + prefix = (mh && mh->name == "halfop" ? mh->GetPrefix() : '@'); + break; + } + default: { - case ServerConfig::INVITE_ANNOUNCE_OPS: - { - prefix = '@'; - break; - } - case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: - { - PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h'); - 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()); } + + if (ServerInstance->Config->AnnounceInvites != ServerConfig::INVITE_ANNOUNCE_NONE) + 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(OnUserInvite, (user,u,c,timeout)); } else if (IS_LOCAL(user)) |