diff options
author | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
---|---|---|
committer | danieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-09-13 20:30:25 +0000 |
commit | 6d57bbe05c31c79eaad02fe81cfb9c1ed6b79c58 (patch) | |
tree | e0c89ed36b00f4c2925d7f39c32a835657b0fa6e /src/modules/m_cap.cpp | |
parent | 7eea21b8d43b0d5993e88b62d9d4894c2af49303 (diff) |
Change Extensible to use strongly typed entries
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11696 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_cap.cpp')
-rw-r--r-- | src/modules/m_cap.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/modules/m_cap.cpp b/src/modules/m_cap.cpp index 626b4c23c..160c7a9c9 100644 --- a/src/modules/m_cap.cpp +++ b/src/modules/m_cap.cpp @@ -35,7 +35,9 @@ CAP END class CommandCAP : public Command { public: - CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true) + LocalIntExt reghold; + CommandCAP (InspIRCd* Instance, Module* mod) : Command(Instance, mod, "CAP", 0, 1, true), + reghold("CAP_REGHOLD", mod) { } @@ -64,7 +66,7 @@ class CommandCAP : public Command Data.wanted.push_back(cap_); } - user->Extend("CAP_REGHOLD"); + reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_req"); event.Send(this->ServerInstance); @@ -82,7 +84,7 @@ class CommandCAP : public Command } else if (subcommand == "END") { - user->Shrink("CAP_REGHOLD"); + reghold.set(user, 0); } else if ((subcommand == "LS") || (subcommand == "LIST")) { @@ -92,7 +94,7 @@ class CommandCAP : public Command Data.user = user; Data.creator = this->creator; - user->Extend("CAP_REGHOLD"); + reghold.set(user, 1); Event event((char*) &Data, this->creator, subcommand == "LS" ? "cap_ls" : "cap_list"); event.Send(this->ServerInstance); @@ -112,7 +114,7 @@ class CommandCAP : public Command Data.user = user; Data.creator = this->creator; - user->Extend("CAP_REGHOLD"); + reghold.set(user, 1); Event event((char*) &Data, this->creator, "cap_clear"); event.Send(this->ServerInstance); @@ -130,33 +132,34 @@ class CommandCAP : public Command class ModuleCAP : public Module { - CommandCAP newcommand; + CommandCAP cmd; public: ModuleCAP(InspIRCd* Me) - : Module(Me), newcommand(Me, this) + : Module(Me), cmd(Me, this) { - ServerInstance->AddCommand(&newcommand); + ServerInstance->AddCommand(&cmd); + Extensible::Register(&cmd.reghold); Implementation eventlist[] = { I_OnCheckReady }; ServerInstance->Modules->Attach(eventlist, this, 1); } - virtual ModResult OnCheckReady(User* user) + ModResult OnCheckReady(User* user) { /* Users in CAP state get held until CAP END */ - if (user->GetExt("CAP_REGHOLD")) + if (cmd.reghold.get(user)) return MOD_RES_DENY; return MOD_RES_PASSTHRU; } - virtual ~ModuleCAP() + ~ModuleCAP() { } - virtual Version GetVersion() + Version GetVersion() { - return Version("$Id$", VF_VENDOR, API_VERSION); + return Version("Client CAP extension support", VF_VENDOR); } }; |