#include "channels.h"
#include "modules.h"
#include "mode.h"
-#include "helperfuncs.h"
+
#include "u_listmode.h"
/* $ModDesc: Provides support for the +I channel mode */
* ignoring if +i is set on the channel
*/
+class InspIRCd* ServerInstance;
+
+/** Handles channel mode +I
+ */
class InviteException : public ListModeBase
{
public:
- InviteException(Server* serv) : ListModeBase(serv, 'I', "End of Channel Invite Exception List", "346", "347", true) { }
+ InviteException(InspIRCd* Instance) : ListModeBase(Instance, 'I', "End of Channel Invite Exception List", "346", "347", true) { }
};
class ModuleInviteException : public Module
{
InviteException* ie;
- Server* Srv;
-
public:
- ModuleInviteException(Server* serv) : Module(serv)
+ ModuleInviteException(InspIRCd* Me) : Module(Me)
{
- ie = new InviteException(serv);
- Srv = serv;
- Srv->AddMode(ie, 'I');
+ ie = new InviteException(ServerInstance);
+ ServerInstance->AddMode(ie, 'I');
}
virtual void Implements(char* List)
virtual void On005Numeric(std::string &output)
{
output.append(" INVEX=I");
- InsertMode(output, "I", 1);
}
virtual int OnCheckInvite(userrec* user, chanrec* chan)
{
modelist* list;
chan->GetExt(ie->GetInfoKey(), list);
- Srv->Log(DEBUG, std::string(user->nick)+" is trying to join "+std::string(chan->name)+", checking for invite exceptions");
if (list)
{
for (modelist::iterator it = list->begin(); it != list->end(); it++)
{
- if(Srv->MatchText(user->GetFullRealHost(), it->mask) || Srv->MatchText(user->GetFullHost(), it->mask))
+ if(match(user->GetFullRealHost(), it->mask.c_str()) || match(user->GetFullHost(), it->mask.c_str()))
{
// They match an entry on the list, so let them in.
return 1;
virtual Version GetVersion()
{
- return Version(1, 0, 0, 3, VF_VENDOR | VF_STATIC);
+ return Version(1, 0, 0, 3, VF_VENDOR | VF_COMMON);
+ }
+
+ ~ModuleInviteException()
+ {
+ ServerInstance->Modes->DelMode(ie);
+ DELETE(ie);
}
};
{
}
- virtual Module * CreateModule(Server* serv)
+ virtual Module * CreateModule(InspIRCd* Me)
{
- return new ModuleInviteException(serv);
+ return new ModuleInviteException(Me);
}
};