From 81215de4f00d0044f1dbe0d1c81d1b7081e5405d Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Sun, 6 Dec 2015 11:20:00 +0100 Subject: cmd_invite Extend scope of the prefix character variable --- src/coremods/core_channel/cmd_invite.cpp | 37 +++++++++++++++----------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'src/coremods') 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& 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)) -- cgit v1.2.3