*/
#include "inspircd.h"
-#include "users.h"
-#include "channels.h"
-#include "modules.h"
/* $ModDesc: Provides channel mode +F (nick flood protection) */
public:
NickFlood(InspIRCd* Instance) : ModeHandler(Instance, 'F', 1, 0, false, MODETYPE_CHANNEL, false) { }
- ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter)
+ ModePair ModeSet(User* source, User* dest, Channel* channel, const std::string ¶meter)
{
nickfloodsettings* x;
if (channel->GetExt("nickflood",x))
return std::make_pair(false, parameter);
}
- bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, chanrec* channel)
+ bool CheckTimeStamp(time_t theirs, time_t ours, const std::string &their_param, const std::string &our_param, Channel* channel)
{
/* When TS is equal, the alphabetically later one wins */
return (their_param < our_param);
}
- ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
nickfloodsettings* dummy;
{
jf = new NickFlood(ServerInstance);
- if (!ServerInstance->AddMode(jf, 'F'))
+ if (!ServerInstance->AddMode(jf))
throw ModuleException("Could not add new modes!");
}
- virtual int OnUserPreNick(userrec* user, const std::string &newnick)
+ virtual int OnUserPreNick(User* user, const std::string &newnick)
{
+ if (isdigit(newnick[0])) /* allow switches to UID */
+ return 0;
+
for (UCListIter i = user->chans.begin(); i != user->chans.end(); i++)
{
- chanrec *channel = i->first;
+ Channel *channel = i->first;
nickfloodsettings *f;
if (channel->GetExt("nickflood", f))
return 0;
}
- void OnChannelDelete(chanrec* chan)
+ void OnChannelDelete(Channel* chan)
{
nickfloodsettings *f;
if (chan->GetExt("nickflood",f))