d = ServerInstance->FindNick(dest);
if (!d)
{
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), dest);
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), dest);
return NULL;
}
return d;
if (targetchannel)
{
/* Display channel's current mode string */
- user->WriteNumeric(324, "%s %s +%s",user->nick.c_str(), targetchannel->name, targetchannel->ChanModes(targetchannel->HasUser(user)));
- user->WriteNumeric(329, "%s %s %lu", user->nick.c_str(), targetchannel->name, (unsigned long)targetchannel->age);
+ user->WriteNumeric(RPL_CHANNELMODEIS, "%s %s +%s",user->nick.c_str(), targetchannel->name.c_str(), targetchannel->ChanModes(targetchannel->HasUser(user)));
+ user->WriteNumeric(RPL_CHANNELCREATED, "%s %s %lu", user->nick.c_str(), targetchannel->name.c_str(), (unsigned long)targetchannel->age);
return;
}
else if (targetuser)
{
if (targetuser->Visibility && !targetuser->Visibility->VisibleTo(user))
{
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), text);
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text);
return;
}
if ((targetuser == user) || (IS_OPER(user)))
{
/* Display user's current mode string */
- user->WriteNumeric(221, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes());
+ user->WriteNumeric(RPL_UMODEIS, "%s :+%s",targetuser->nick.c_str(),targetuser->FormatModes());
if (IS_OPER(targetuser))
- user->WriteNumeric(8, "%s +%s :Server notice mask", targetuser->nick.c_str(), targetuser->FormatNoticeMasks());
+ user->WriteNumeric(RPL_SNOMASKIS, "%s +%s :Server notice mask", targetuser->nick.c_str(), targetuser->FormatNoticeMasks());
return;
}
else
{
- user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick.c_str());
+ user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str());
return;
}
}
/* No such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), text);
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), text);
return;
}
continue;
}
- if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
+ if (!IS_OPER(user))
{
- user->WriteNumeric(482, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name, *mode++);
- mh->DisplayEmptyList(user, targetchannel);
- continue;
+ if (ServerInstance->Config->HideModeLists[mletter] && (targetchannel->GetStatus(user) < STATUS_HOP))
+ {
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only half-operators and above may view the +%c list",user->nick.c_str(), targetchannel->name.c_str(), *mode++);
+ mh->DisplayEmptyList(user, targetchannel);
+ continue;
+ }
}
/** See below for a description of what craq this is :D
mask = MASK_USER;
if ((user != targetuser) && (!ServerInstance->ULine(user->server)))
{
- user->WriteNumeric(502, "%s :Can't change mode for other users", user->nick.c_str());
+ user->WriteNumeric(ERR_USERSDONTMATCH, "%s :Can't change mode for other users", user->nick.c_str());
return;
}
}
else
{
/* No such nick/channel */
- user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str());
+ user->WriteNumeric(ERR_NOSUCHNICK, "%s %s :No such nick/channel",user->nick.c_str(), parameters[0].c_str());
return;
}
if (!ourmode || ourmode->GetPrefixRank() < neededrank)
{
/* Bog off */
- user->WriteNumeric(482, "%s %s :You must have channel privilege %c or above to %sset channel mode %c",
- user->nick.c_str(), targetchannel->name, needed, adding ? "" : "un", modechar);
+ user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must have channel privilege %c or above to %sset channel mode %c",
+ user->nick.c_str(), targetchannel->name.c_str(), needed, adding ? "" : "un", modechar);
continue;
}
}
{
if (IS_OPER(user))
{
- user->WriteNumeric(481, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c",
+ user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Oper type %s does not have access to set %s mode %c",
user->nick.c_str(),
user->oper.c_str(),
type == MODETYPE_CHANNEL ? "channel" : "user",
}
else
{
- user->WriteNumeric(481, "%s :Permission Denied - Only operators may set %s mode %c",
+ user->WriteNumeric(ERR_NOPRIVILEGES, "%s :Permission Denied - Only operators may set %s mode %c",
user->nick.c_str(),
type == MODETYPE_CHANNEL ? "channel" : "user",
modehandlers[handler_id]->GetModeChar());
state_change = false;
if ((output_sequence.length() + parameter_list.str().length() > 450) || (output_sequence.length() > 100)
- || (parameter_count > MAXMODES))
+ || (parameter_count > ServerInstance->Config->Limits.MaxModes))
{
/* We cant have a mode sequence this long */
letter = mode_sequence.end() - 1;
{
if (type == MODETYPE_CHANNEL)
{
- targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name, output_sequence.c_str(), parameter_list.str().c_str());
+ targetchannel->WriteChannelWithServ(ServerInstance->Config->ServerName, "MODE %s %s%s", targetchannel->name.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
this->LastParse = targetchannel->name;
}
else
{
if (type == MODETYPE_CHANNEL)
{
- targetchannel->WriteChannel(user,"MODE %s %s%s",targetchannel->name,output_sequence.c_str(),parameter_list.str().c_str());
+ targetchannel->WriteChannel(user, "MODE %s %s%s", targetchannel->name.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
FOREACH_MOD(I_OnMode,OnMode(user, targetchannel, TYPE_CHANNEL, output_sequence + parameter_list.str()));
this->LastParse = targetchannel->name;
}
else
{
- user->WriteTo(targetuser,"MODE %s %s%s",targetuser->nick.c_str(),output_sequence.c_str(), parameter_list.str().c_str());
+ user->WriteTo(targetuser, "MODE %s %s%s", targetuser->nick.c_str(), output_sequence.c_str(), parameter_list.str().c_str());
FOREACH_MOD(I_OnMode,OnMode(user, targetuser, TYPE_USER, output_sequence + parameter_list.str()));
this->LastParse = targetuser->nick;
}
std::string::size_type pos_of_dot = mask.find_first_of('.');
std::string::size_type pos_of_colons = mask.find("::"); /* Because ipv6 addresses are colon delimited -- double so it treats extban as nick */
+ if (mask.length() >= 2 && mask[1] == ':')
+ return; // if it's an extban, don't even try guess how it needs to be formed.
+
if ((pos_of_pling == std::string::npos) && (pos_of_at == std::string::npos))
{
/* Just a nick, or just a host - or clearly ipv6 (starting with :) */