#include "inspircd.h"
-#include "u_listmode.h"
+#include "listmode.h"
/* $ModDesc: Allows an extended ban (+b) syntax redirecting banned users to another channel */
class BanRedirect : public ModeWatcher
{
+ ModeReference ban;
public:
SimpleExtItem<BanRedirectList> extItem;
- BanRedirect(Module* parent) : ModeWatcher(parent, 'b', MODETYPE_CHANNEL),
- extItem("banredirect", parent)
+ BanRedirect(Module* parent)
+ : ModeWatcher(parent, 'b', MODETYPE_CHANNEL)
+ , ban(parent, "ban")
+ , extItem("banredirect", parent)
{
}
std::string mask[4];
enum { NICK, IDENT, HOST, CHAN } current = NICK;
std::string::iterator start_pos = param.begin();
- long maxbans = channel->GetMaxBans();
if (param.length() >= 2 && param[1] == ':')
return true;
- if(adding && (channel->bans.size() > static_cast<unsigned>(maxbans)))
+ ListModeBase* banlm = static_cast<ListModeBase*>(*ban);
+ unsigned int maxbans = banlm->GetLimit(channel);
+ ListModeBase::ModeList* list = banlm->GetList(channel);
+ if ((list) && (adding) && (maxbans <= list->size()))
{
- source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %ld)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans);
+ source->WriteNumeric(478, "%s %s :Channel ban list for %s is full (maximum entries for this channel is %u)", source->nick.c_str(), channel->name.c_str(), channel->name.c_str(), maxbans);
return false;
}
{
/* XXX is this the best place to do this? */
if (!ServerInstance->Modes->DelModeWatcher(&re))
- ServerInstance->Logs->Log("m_banredirect.so", DEBUG, "Failed to delete modewatcher!");
+ ServerInstance->Logs->Log("m_banredirect.so", LOG_DEBUG, "Failed to delete modewatcher!");
}
virtual Version GetVersion()