/* $ModDesc: Provides channel mode +J (delay rejoin after kick) */
+
+
inline int strtoint(const std::string &str)
{
std::istringstream ss(str);
class KickRejoin : public ModeHandler
{
public:
- KickRejoin() : ModeHandler('J', 1, 0, false, MODETYPE_CHANNEL, false) { }
+ KickRejoin(InspIRCd* Instance) : ModeHandler(Instance, 'J', 1, 0, false, MODETYPE_CHANNEL, false) { }
- std::pair<bool,std::string> ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter)
+ ModePair ModeSet(userrec* source, userrec* dest, chanrec* channel, const std::string ¶meter)
{
if (channel->IsModeSet('J'))
return std::make_pair(true, channel->GetModeParameter('J'));
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)
+ {
+ /* 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)
{
if (!adding)
class ModuleKickNoRejoin : public Module
{
- Server *Srv;
+
KickRejoin* kr;
public:
- ModuleKickNoRejoin(Server* Me)
+ ModuleKickNoRejoin(InspIRCd* Me)
: Module::Module(Me)
{
- Srv = Me;
- kr = new KickRejoin();
- Srv->AddMode(kr, 'J');
+
+ kr = new KickRejoin(ServerInstance);
+ ServerInstance->AddMode(kr, 'J');
}
virtual int OnUserPreJoin(userrec* user, chanrec* chan, const char* cname)
if (iter->first == user)
{
log(DEBUG, "m_kicknorejoin.so: and we have the right user");
- WriteServ(user->fd, "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name);
+ user->WriteServ( "495 %s %s :You cannot rejoin this channel yet after being kicked (+J)", user->nick, chan->name);
return 1;
}
}
virtual void On005Numeric(std::string &output)
{
- InsertMode(output, "J", 3);
+ ServerInstance->ModeGrok->InsertMode(output, "J", 3);
}
virtual ~ModuleKickNoRejoin()
{
}
- virtual Module * CreateModule(Server* Me)
+ virtual Module * CreateModule(InspIRCd* Me)
{
return new ModuleKickNoRejoin(Me);
}