#include "inspircd.h"
#include "modules/account.h"
#include "modules/exemption.h"
+#include "modules/whois.h"
enum
{
+ // From UnrealIRCd.
+ RPL_WHOISREGNICK = 307,
+
+ // From ircu.
+ RPL_WHOISACCOUNT = 330,
+
// From ircd-hybrid?
ERR_NEEDREGGEDNICK = 477,
if (account)
{
- whois.SendLine(330, *account, "is logged in as");
+ whois.SendLine(RPL_WHOISACCOUNT, *account, "is logged in as");
}
if (whois.GetTarget()->IsModeSet(m5))
{
/* user is registered */
- whois.SendLine(307, "is a registered nick");
+ whois.SendLine(RPL_WHOISREGNICK, "is a registered nick");
}
}
m5.RemoveMode(user);
}
- ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE
+ ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE
{
if (!IS_LOCAL(user))
return MOD_RES_PASSTHRU;
std::string *account = accountname.get(user);
bool is_registered = account && !account->empty();
- if (target_type == TYPE_CHANNEL)
+ if (target.type == MessageTarget::TYPE_CHANNEL)
{
- Channel* c = (Channel*)dest;
+ Channel* c = target.Get<Channel>();
ModResult res = CheckExemption::Call(exemptionprov, user, c, "regmoderated");
if (c->IsModeSet(m2) && !is_registered && res != MOD_RES_ALLOW)
return MOD_RES_DENY;
}
}
- else if (target_type == TYPE_USER)
+ else if (target.type == MessageTarget::TYPE_USER)
{
- User* u = (User*)dest;
+ User* u = target.Get<User>();
if (u->IsModeSet(m3) && !is_registered)
{