X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_channel%2Fcmd_invite.cpp;h=a1319ebc049651d2099faf6149b33c960622128b;hb=dcd3438011d59aa4de4df64abf06bca1cbf36859;hp=8a906f0522614194f78b120bfe36be32130cf827;hpb=81215de4f00d0044f1dbe0d1c81d1b7081e5405d;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_channel/cmd_invite.cpp b/src/coremods/core_channel/cmd_invite.cpp index 8a906f052..a1319ebc0 100644 --- a/src/coremods/core_channel/cmd_invite.cpp +++ b/src/coremods/core_channel/cmd_invite.cpp @@ -58,7 +58,7 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use if ((!c) || (!u) || (u->registered != REG_ALL)) { - user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", c ? parameters[0].c_str() : parameters[1].c_str()); + user->WriteNumeric(Numerics::NoSuchNick(c ? parameters[0] : parameters[1])); return CMD_FAILURE; } @@ -77,13 +77,13 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use if ((IS_LOCAL(user)) && (!c->HasUser(user))) { - user->WriteNumeric(ERR_NOTONCHANNEL, "%s :You're not on that channel!", c->name.c_str()); + user->WriteNumeric(ERR_NOTONCHANNEL, c->name, "You're not on that channel!"); return CMD_FAILURE; } if (c->HasUser(u)) { - user->WriteNumeric(ERR_USERONCHANNEL, "%s %s :is already on channel", u->nick.c_str(), c->name.c_str()); + user->WriteNumeric(ERR_USERONCHANNEL, u->nick, c->name, "is already on channel"); return CMD_FAILURE; } @@ -102,8 +102,8 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use { // Check whether halfop mode is available and phrase error message accordingly ModeHandler* mh = ServerInstance->Modes->FindMode('h', MODETYPE_CHANNEL); - user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s :You must be a channel %soperator", - c->name.c_str(), (mh && mh->name == "halfop" ? "half-" : "")); + user->WriteNumeric(ERR_CHANOPRIVSNEEDED, c->name, InspIRCd::Format("You must be a channel %soperator", + (mh && mh->name == "halfop" ? "half-" : ""))); return CMD_FAILURE; } } @@ -117,23 +117,29 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use if (IS_LOCAL(user)) { - user->WriteNumeric(RPL_INVITING, "%s %s", u->nick.c_str(),c->name.c_str()); + user->WriteNumeric(RPL_INVITING, u->nick, c->name); if (u->IsAway()) - user->WriteNumeric(RPL_AWAY, "%s :%s", u->nick.c_str(), u->awaymsg.c_str()); + user->WriteNumeric(RPL_AWAY, u->nick, u->awaymsg); } char prefix = 0; + unsigned int minrank = 0; switch (ServerInstance->Config->AnnounceInvites) { case ServerConfig::INVITE_ANNOUNCE_OPS: { prefix = '@'; + minrank = OP_VALUE; break; } case ServerConfig::INVITE_ANNOUNCE_DYNAMIC: { PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h'); - prefix = (mh && mh->name == "halfop" ? mh->GetPrefix() : '@'); + if ((mh) && (mh->name == "halfop")) + { + prefix = mh->GetPrefix(); + minrank = mh->GetPrefixRank(); + } break; } default: @@ -141,9 +147,11 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use } } + CUList excepts; + FOREACH_MOD(OnUserInvite, (user, u, c, timeout, minrank, excepts)); + 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)); + c->WriteAllExcept(user, true, prefix, excepts, "NOTICE %s :*** %s invited %s into the channel", c->name.c_str(), user->nick.c_str(), u->nick.c_str()); } else if (IS_LOCAL(user)) { @@ -153,9 +161,9 @@ CmdResult CommandInvite::Handle (const std::vector& parameters, Use if (list) { for (Invite::List::const_iterator i = list->begin(); i != list->end(); ++i) - user->WriteNumeric(RPL_INVITELIST, ":%s", (*i)->chan->name.c_str()); + user->WriteNumeric(RPL_INVITELIST, (*i)->chan->name); } - user->WriteNumeric(RPL_ENDOFINVITELIST, ":End of INVITE list"); + user->WriteNumeric(RPL_ENDOFINVITELIST, "End of INVITE list"); } return CMD_SUCCESS; }