* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ * InspIRCd: (C) 2002-2010 InspIRCd Development Team
* See: http://wiki.inspircd.org/Credits
*
* This program is free but copyrighted software; see
*/
class Channel_r : public ModeHandler
{
-
public:
- Channel_r(Module* Creator) : ModeHandler(Creator, "registered", 'r', PARAM_NONE, MODETYPE_CHANNEL) { }
+ Channel_r(Module* Creator) : ModeHandler(Creator, "c_registered", 'r', PARAM_NONE, MODETYPE_CHANNEL) { }
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
// only a u-lined server may add or remove the +r mode.
- if (IS_REMOTE(source) || ServerInstance->ULine(source->nick.c_str()) || ServerInstance->ULine(source->server))
+ if (!IS_LOCAL(source) || ServerInstance->ULine(source->nick.c_str()) || ServerInstance->ULine(source->server))
{
// Only change the mode if it's not redundant
if ((adding && !channel->IsModeSet('r')) || (!adding && channel->IsModeSet('r')))
{
public:
- User_r(Module* Creator) : ModeHandler(Creator, "registered", 'r', PARAM_NONE, MODETYPE_USER) { }
+ User_r(Module* Creator) : ModeHandler(Creator, "u_registered", 'r', PARAM_NONE, MODETYPE_USER) { }
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
- if (IS_REMOTE(source) || ServerInstance->ULine(source->nick.c_str()) || ServerInstance->ULine(source->server))
+ if (!IS_LOCAL(source) || ServerInstance->ULine(source->nick.c_str()) || ServerInstance->ULine(source->server))
{
if ((adding && !dest->IsModeSet('r')) || (!adding && dest->IsModeSet('r')))
{
AUser_R m3;
Channel_r m4;
User_r m5;
- StringExtItem accountname;
+ AccountExtItem accountname;
public:
ModuleServicesAccount() : m1(this), m2(this), m3(this), m4(this), m5(this),
accountname("accountname", this)
{
+ }
- if (!ServerInstance->Modes->AddMode(&m1) || !ServerInstance->Modes->AddMode(&m2) ||
- !ServerInstance->Modes->AddMode(&m3) || !ServerInstance->Modes->AddMode(&m4) ||
- !ServerInstance->Modes->AddMode(&m5))
- throw ModuleException("Some other module has claimed our modes!");
-
- Extensible::Register(&accountname);
+ void init()
+ {
+ ServerInstance->Modules->AddService(m1);
+ ServerInstance->Modules->AddService(m2);
+ ServerInstance->Modules->AddService(m3);
+ ServerInstance->Modules->AddService(m4);
+ ServerInstance->Modules->AddService(m5);
+ ServerInstance->Modules->AddService(accountname);
Implementation eventlist[] = { I_OnWhois, I_OnUserPreMessage, I_OnUserPreNotice, I_OnUserPreJoin, I_OnCheckBan,
- I_OnSyncUser, I_OnUserQuit, I_OnDecodeMetaData, I_On005Numeric, I_OnUserPostNick };
+ I_OnDecodeMetaData, I_On005Numeric, I_OnUserPostNick, I_OnSetConnectClass };
- ServerInstance->Modules->Attach(eventlist, this, 10);
+ ServerInstance->Modules->Attach(eventlist, this, 9);
}
void On005Numeric(std::string &t)
if (target_type == TYPE_CHANNEL)
{
Channel* c = (Channel*)dest;
- ModResult res;
- FIRST_MOD_RESULT(OnChannelRestrictionApply, res, (c->GetUser(user),c,"regmoderated"));
+ ModResult res = ServerInstance->OnCheckExemption(user,c,"regmoderated");
if (c->IsModeSet('M') && !is_registered && res != MOD_RES_ALLOW)
{
}
}
- ~ModuleServicesAccount()
+ ModResult OnSetConnectClass(LocalUser* user, ConnectClass* myclass)
{
+ if (myclass->config->getBool("requireaccount") && !accountname.get(user))
+ return MOD_RES_DENY;
+ return MOD_RES_PASSTHRU;
}
Version GetVersion()
{
- return Version("Povides support for ircu-style services accounts, including chmode +R, etc.",VF_COMMON|VF_VENDOR,API_VERSION);
+ return Version("Povides support for ircu-style services accounts, including chmode +R, etc.",VF_OPTCOMMON|VF_VENDOR);
}
};