Beispiel #1
0
	ModuleInviteException(InspIRCd* Me) : Module(Me)
	{
		ie = new InviteException(ServerInstance);
		if (!ServerInstance->Modes->AddMode(ie))
			throw ModuleException("Could not add new modes!");
		ServerInstance->Modules->PublishInterface("ChannelBanList", this);

		ie->DoImplements(this);
		Implementation eventlist[] = { I_OnRequest, I_On005Numeric, I_OnCheckInvite };
		ServerInstance->Modules->Attach(eventlist, this, 3);
	}
	ModResult OnCheckInvite(User* user, Channel* chan)
	{
		ListModeBase::ModeList* list = ie.GetList(chan);
		if (list)
		{
			for (ListModeBase::ModeList::iterator it = list->begin(); it != list->end(); it++)
			{
				if (chan->CheckBan(user, it->mask))
				{
					return MOD_RES_ALLOW;
				}
			}
		}

		return MOD_RES_PASSTHRU;
	}
Beispiel #3
0
	virtual int OnCheckInvite(User* user, Channel* chan)
	{
		if(chan != NULL)
		{
			modelist* list;
			chan->GetExt(ie->GetInfoKey(), list);
			if (list)
			{
				std::string mask = std::string(user->nick) + "!" + user->ident + "@" + user->GetIPString();
				for (modelist::iterator it = list->begin(); it != list->end(); it++)
				{
					if(InspIRCd::Match(user->GetFullRealHost(), it->mask) || InspIRCd::Match(user->GetFullHost(), it->mask) || (InspIRCd::MatchCIDR(mask, it->mask)))
					{
						// They match an entry on the list, so let them in.
						return 1;
					}
				}
			}
			// or if there wasn't a list, there can't be anyone on it, so we don't need to do anything.
		}

		return 0;
	}
Beispiel #4
0
	virtual void OnChannelDelete(Channel* chan)
	{
		ie->DoChannelDelete(chan);
	}
Beispiel #5
0
	virtual void OnSyncChannel(Channel* chan, Module* proto, void* opaque)
	{
		ie->DoSyncChannel(chan, proto, opaque);
	}
Beispiel #6
0
	virtual void OnCleanup(int target_type, void* item)
	{
		ie->DoCleanup(target_type, item);
	}
Beispiel #7
0
	virtual const char* OnRequest(Request* request)
	{
		return ie->DoOnRequest(request);
	}
Beispiel #8
0
	virtual void OnRehash(User* user)
	{
		ie->DoRehash();
	}
	void OnRehash(User* user)
	{
		invite_bypass_key = ServerInstance->Config->ConfValue("inviteexception")->getBool("bypasskey", true);
		ie.DoRehash();
	}