* +------------------------------------+
*
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
* the file COPYING for details.
{
private:
CUList empty;
- Module* Creator;
public:
- DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, 'D', 0, 0, false, MODETYPE_CHANNEL, false, '@', '@'), Creator(Parent) {};
+ DelayJoinMode(InspIRCd* Instance, Module* Parent) : ModeHandler(Instance, Parent, 'D', 0, 0, false, MODETYPE_CHANNEL, false, 0, '@') {};
- ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool);
+ ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding);
};
class ModuleDelayJoin : public Module
{
private:
- DelayJoinMode* djm;
+ DelayJoinMode djm;
CUList nl;
public:
- ModuleDelayJoin(InspIRCd* Me) : Module(Me)
+ ModuleDelayJoin(InspIRCd* Me) : Module(Me), djm(Me, this)
{
- djm = new DelayJoinMode(ServerInstance, this);
- if (!ServerInstance->Modes->AddMode(djm))
+ if (!ServerInstance->Modes->AddMode(&djm))
throw ModuleException("Could not add new modes!");
Implementation eventlist[] = { I_OnUserJoin, I_OnUserPart, I_OnUserKick, I_OnUserQuit, I_OnNamesListItem, I_OnText, I_OnHostCycle };
ServerInstance->Modules->Attach(eventlist, this, 7);
virtual ~ModuleDelayJoin();
virtual Version GetVersion();
virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick);
- virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent);
+ virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created);
void CleanUser(User* user);
- bool OnHostCycle(User* user);
+ ModResult OnHostCycle(User* user);
void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent);
void OnUserKick(User* source, User* user, Channel* chan, const std::string &reason, bool &silent);
void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message);
/* $ModDesc: Allows for delay-join channels (+D) where users dont appear to join until they speak */
-ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding, bool)
+ModeAction DelayJoinMode::OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
/* no change */
if (channel->IsModeSet('D') == adding)
*/
CUList* names = channel->GetUsers();
for (CUListIter n = names->begin(); n != names->end(); ++n)
- Creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
+ creator->OnText(n->first, channel, TYPE_CHANNEL, "", 0, empty);
}
channel->SetMode('D', adding);
return MODEACTION_ALLOW;
ModuleDelayJoin::~ModuleDelayJoin()
{
- ServerInstance->Modes->DelMode(djm);
- delete djm;
+ ServerInstance->Modes->DelMode(&djm);
}
Version ModuleDelayJoin::GetVersion()
nick.clear();
}
-void ModuleDelayJoin::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
+void ModuleDelayJoin::OnUserJoin(User* user, Channel* channel, bool sync, bool &silent, bool created)
{
if (channel->IsModeSet('D'))
{
}
}
-bool ModuleDelayJoin::OnHostCycle(User* user)
+ModResult ModuleDelayJoin::OnHostCycle(User* user)
{
- return user->GetExt("delayjoin");
+ return user->GetExt("delayjoin") ? MOD_RES_DENY : MOD_RES_PASSTHRU;
}
void ModuleDelayJoin::OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
if (user == i->first)
continue;
- /* Users with a visibility state that hides them dont appear */
- if (user->Visibility && !user->Visibility->VisibleTo(i->first))
- continue;
-
i->first->Write(std::string(tb));
}
}