inline const T& operator*() const { return *value; }
inline T* operator->() { return value; }
inline T& operator*() { return *value; }
- operator bool() const { return value; }
- operator T*() const { return value; }
+ inline operator bool() const { return value; }
+ inline operator T*() const { return value; }
};
/** This class can be used on its own to represent an exception, or derived to represent a module-specific exception.
};
/** If you change the module API in any way, increment this value. */
-#define API_VERSION 132
+#define API_VERSION 133
class ServerConfig;
* @return MOD_RES_DENY to apply the restriction, MOD_RES_ALLOW to bypass
* the restriction, or MOD_RES_PASSTHRU to check restriction status normally
*/
- virtual ModResult OnChannelRestrictionApply(Membership* memb, Channel* chan, const char* restriction);
+ virtual ModResult OnChannelRestrictionApply(User* user, Channel* chan, const char* restriction);
};
ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnHookIO(StreamSocket*, ListenSocketBase*) { }
void Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { }
-ModResult Module::OnChannelRestrictionApply(Membership*, Channel*, const char*) { return MOD_RES_PASSTHRU; }
+ModResult Module::OnChannelRestrictionApply(User*, Channel*, const char*) { return MOD_RES_PASSTHRU; }
ModuleManager::ModuleManager() : ModCount(0)
{
Channel* c = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"blockcaps"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"blockcaps"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
{
Channel* c = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"blockcolor"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"blockcolor"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
active = ((Channel*)dest)->IsModeSet('G');
Channel* c = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"censor"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"censor"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
virtual ModResult ProcessMessages(User* user,Channel* chan,std::string &text)
{
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (chan->GetUser(user),chan,"filter"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,chan,"filter"));
if (!IS_LOCAL(user) || res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
ec.DoSyncChannel(chan, proto, opaque);
}
- virtual ModResult OnChannelRestrictionApply(Membership* memb, Channel* chan, const char* restriction)
+ virtual ModResult OnChannelRestrictionApply(User* user, Channel* chan, const char* restriction)
{
irc::spacesepstream allowstream(alwaysexempt), denystream(neverexempt);
std::string current;
- if (memb->getRank() != OP_VALUE)
+ if (chan->GetPrefixValue(user) != OP_VALUE)
return MOD_RES_PASSTHRU; // They're not opped, so we don't exempt them
while(denystream.GetToken(current))
if (!strcasecmp(restriction, current.c_str())) return MOD_RES_PASSTHRU; // This mode is set to never allow exemptions in the config
ModResult ProcessMessages(User* user,Channel* dest, const std::string &text)
{
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (dest->GetUser(user),dest,"flood"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,dest,"flood"));
if (!IS_LOCAL(user) || res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
nickfloodsettings *f = nf.ext.get(channel);
if (f)
{
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood"));
if (res == MOD_RES_ALLOW)
continue;
nickfloodsettings *f = nf.ext.get(channel);
if (f)
{
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (channel->GetUser(user),channel,"nickflood"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,channel,"nickflood"));
if (res == MOD_RES_ALLOW)
return;
{
Channel* c = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"noctcp"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"noctcp"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
Channel* curr = *i;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (curr->GetUser(user),curr,"nonick"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,curr,"nonick"));
if (res == MOD_RES_ALLOW)
continue;
// ulines are exempt.
return MOD_RES_PASSTHRU;
}
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"nonotice"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"nonotice"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;
else
{
Channel* c = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"regmoderated"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,c,"regmoderated"));
if (c->IsModeSet('M') && !is_registered && res != MOD_RES_ALLOW)
{
{
Channel* t = (Channel*)dest;
ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (t->GetUser(user),t,"stripcolor"));
+ FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (user,t,"stripcolor"));
if (res == MOD_RES_ALLOW)
return MOD_RES_PASSTHRU;