void MessageCommandBase::SendAll(User* user, const std::string& msg, MessageType mt)
{
const std::string message = ":" + user->GetFullHost() + " " + MessageTypeString[mt] + " $* :" + msg;
- const LocalUserList& list = ServerInstance->Users->local_users;
- for (LocalUserList::const_iterator i = list.begin(); i != list.end(); ++i)
+ const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
+ for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
{
if ((*i)->registered == REG_ALL)
(*i)->Write(message);
{
if (chan->IsModeSet(noextmsgmode) && !chan->HasUser(user))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (no external messages)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (no external messages)");
return CMD_FAILURE;
}
if (chan->IsModeSet(moderatedmode))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (+m)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (+m)");
return CMD_FAILURE;
}
{
if (chan->IsBanned(user))
{
- user->WriteNumeric(ERR_CANNOTSENDTOCHAN, "%s :Cannot send to channel (you're banned)", chan->name.c_str());
+ user->WriteNumeric(ERR_CANNOTSENDTOCHAN, chan->name, "Cannot send to channel (you're banned)");
return CMD_FAILURE;
}
}
/* Check again, a module may have zapped the input string */
if (temp.empty())
{
- user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send");
+ user->WriteNumeric(ERR_NOTEXTTOSEND, "No text to send");
return CMD_FAILURE;
}
if (status)
{
- if (ServerInstance->Config->UndernetMsgPrefix)
- {
- chan->WriteAllExcept(user, false, status, except_list, "%s %c%s :%c %s", MessageTypeString[mt], status, chan->name.c_str(), status, text);
- }
- else
- {
- chan->WriteAllExcept(user, false, status, except_list, "%s %c%s :%s", MessageTypeString[mt], status, chan->name.c_str(), text);
- }
+ chan->WriteAllExcept(user, false, status, except_list, "%s %c%s :%s", MessageTypeString[mt], status, chan->name.c_str(), text);
}
else
{
else
{
/* no such nick/channel */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", target);
+ user->WriteNumeric(Numerics::NoSuchNick(target));
return CMD_FAILURE;
}
return CMD_SUCCESS;
if (dest && strcasecmp(dest->server->GetName().c_str(), targetserver + 1))
{
/* Incorrect server for user */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
}
{
if (parameters[1].empty())
{
- user->WriteNumeric(ERR_NOTEXTTOSEND, ":No text to send");
+ user->WriteNumeric(ERR_NOTEXTTOSEND, "No text to send");
return CMD_FAILURE;
}
if ((dest->IsAway()) && (mt == MSG_PRIVMSG))
{
/* auto respond with aweh msg */
- user->WriteNumeric(RPL_AWAY, "%s :%s", dest->nick.c_str(), dest->awaymsg.c_str());
+ user->WriteNumeric(RPL_AWAY, dest->nick, dest->awaymsg);
}
ModResult MOD_RESULT;
else
{
/* no such nick/channel */
- user->WriteNumeric(ERR_NOSUCHNICK, "%s :No such nick/channel", parameters[0].c_str());
+ user->WriteNumeric(Numerics::NoSuchNick(parameters[0]));
return CMD_FAILURE;
}
return CMD_SUCCESS;