memset(&modes,0,64);
}
-void chanrec::SetCustomMode(char mode,bool mode_on)
+void chanrec::SetMode(char mode,bool mode_on)
{
modes[mode-65] = mode_on;
if (!mode_on)
- this->SetCustomModeParam(mode,"",false);
+ this->SetModeParam(mode,"",false);
}
-void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on)
+void chanrec::SetModeParam(char mode,const char* parameter,bool mode_on)
{
- log(DEBUG,"SetCustomModeParam called");
+ log(DEBUG,"SetModeParam called");
CustomModeList::iterator n = custom_mode_params.find(mode);
log(DEBUG,"add_channel: about to walk banlist");
MOD_RESULT = 0;
FOREACH_RESULT(I_OnCheckBan,OnCheckBan(user, Ptr));
+ char mask[MAXBUF];
+ sprintf(mask,"%s!%s@%s",user->nick, user->ident, user->GetIPString());
if (!MOD_RESULT)
{
for (BanList::iterator i = Ptr->bans.begin(); i != Ptr->bans.end(); i++)
{
- if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match((char*)inet_ntoa(user->ip4),i->data)))
+ /* This allows CIDR ban matching
+ *
+ * Full masked host Full unmasked host IP with/without CIDR
+ */
+ if ((match(user->GetFullHost(),i->data)) || (match(user->GetFullRealHost(),i->data)) || (match(mask, i->data, true)))
{
WriteServ(user->fd,"474 %s %s :Cannot join channel (You're banned)",user->nick, Ptr->name);
return NULL;